From 4ae45b1f4a71915807411da242a2911d293195bf Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Thu, 31 Oct 2024 22:15:37 +0100 Subject: [PATCH 001/877] OpenWrt v24.10: 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 fc679335e0e47f..581de056c41e3e 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,8 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git -src-git luci https://git.openwrt.org/project/luci.git -src-git routing https://git.openwrt.org/feed/routing.git -src-git telephony https://git.openwrt.org/feed/telephony.git -#src-git video https://github.com/openwrt/video.git -#src-git targets https://github.com/openwrt/targets.git -#src-git oldpackages http://git.openwrt.org/packages.git -#src-link custom /usr/src/openwrt/custom-feed +src-git packages https://git.openwrt.org/feed/packages.git;openwrt-24.10 +src-git luci https://git.openwrt.org/project/luci.git;openwrt-24.10 +src-git routing https://git.openwrt.org/feed/routing.git;openwrt-24.10 +src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-24.10 diff --git a/include/version.mk b/include/version.mk index 1ac29b629adb6b..a6ebe587797707 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),24.10-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/24.10-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 dee06e9b864b78..80db993d46b837 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/24.10-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 07e5dd4c4f99c27f2d15fb73c1beeff3c9696cf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Fri, 1 Nov 2024 06:25:07 +0000 Subject: [PATCH 002/877] openwrt-keyring: add OpenWrt 24.10 release build usign key MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fbae29d730f8 usign: add OpenWrt 24.10 release build public key Signed-off-by: Petr Štetiar (cherry picked from commit a535cfc09e1ced5785d65bee0a0116a71585128e) --- package/system/openwrt-keyring/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/system/openwrt-keyring/Makefile b/package/system/openwrt-keyring/Makefile index 9344ec321d93b3..029463817b85dd 100644 --- a/package/system/openwrt-keyring/Makefile +++ b/package/system/openwrt-keyring/Makefile @@ -7,9 +7,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/keyring.git -PKG_SOURCE_DATE:=2024-09-28 -PKG_SOURCE_VERSION:=3c066ce24e80d8f537d582406930d60c7cafb251 -PKG_MIRROR_HASH:=27a52fd164d38cc57d052e0e04c95ac941ce90be6231c2eb85dcbbde9d3b916e +PKG_SOURCE_DATE:=2024-11-01 +PKG_SOURCE_VERSION:=fbae29d730f81c892f52e0ff00fe867444aeeae6 +PKG_MIRROR_HASH:=9a314756ddb61dde084f810ef056835addd9097ad26cb5e66efc6b38debc8aa0 PKG_MAINTAINER:=John Crispin PKG_LICENSE:=GPL-2.0 From 05b3adc0dbfd888f2a91c675146db5b62cdce0dc Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Fri, 1 Nov 2024 03:37:51 +0000 Subject: [PATCH 003/877] mediatek: mt7988: fix peripheral SPI busses The clocks for SPI busses were named wrongly which resulted in the spi-mt65xx driver not requesting them. This has apparently been worked around by marking the clocks required for SPI0 which is used for SPI-NOR and SPI-NAND flash chips as critical. Fix the device tree for all 3 generic SPI host controllers and no longer mark clocks as critical. Signed-off-by: Daniel Golle (cherry picked from commit 2b173ab730897f53539cab39e87e2b4638cb482a) --- .../arch/arm64/boot/dts/mediatek/mt7988a.dtsi | 8 +-- ...nfracfg-SPI0-clocks-are-not-critical.patch | 65 +++++++++++++++++++ 2 files changed, 69 insertions(+), 4 deletions(-) create mode 100644 target/linux/mediatek/patches-6.6/255-clk-mediatek-mt7988-infracfg-SPI0-clocks-are-not-critical.patch diff --git a/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a.dtsi b/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a.dtsi index c894253feddc07..39f8fd2ab14fcf 100644 --- a/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a.dtsi +++ b/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a.dtsi @@ -806,7 +806,7 @@ <&infracfg CLK_INFRA_104M_SPI0>, <&infracfg CLK_INFRA_66M_SPI0_HCK>; clock-names = "parent-clk", "sel-clk", "spi-clk", - "spi-hclk"; + "hclk"; #address-cells = <1>; #size-cells = <0>; status = "disabled"; @@ -817,11 +817,11 @@ reg = <0 0x11008000 0 0x100>; interrupts = ; clocks = <&topckgen CLK_TOP_MPLL_D2>, - <&topckgen CLK_TOP_SPI_SEL>, + <&topckgen CLK_TOP_SPIM_MST_SEL>, <&infracfg CLK_INFRA_104M_SPI1>, <&infracfg CLK_INFRA_66M_SPI1_HCK>; clock-names = "parent-clk", "sel-clk", "spi-clk", - "spi-hclk"; + "hclk"; #address-cells = <1>; #size-cells = <0>; pinctrl-names = "default"; @@ -838,7 +838,7 @@ <&infracfg CLK_INFRA_104M_SPI2_BCK>, <&infracfg CLK_INFRA_66M_SPI2_HCK>; clock-names = "parent-clk", "sel-clk", "spi-clk", - "spi-hclk"; + "hclk"; #address-cells = <1>; #size-cells = <0>; status = "disabled"; diff --git a/target/linux/mediatek/patches-6.6/255-clk-mediatek-mt7988-infracfg-SPI0-clocks-are-not-critical.patch b/target/linux/mediatek/patches-6.6/255-clk-mediatek-mt7988-infracfg-SPI0-clocks-are-not-critical.patch new file mode 100644 index 00000000000000..ed3471933c4103 --- /dev/null +++ b/target/linux/mediatek/patches-6.6/255-clk-mediatek-mt7988-infracfg-SPI0-clocks-are-not-critical.patch @@ -0,0 +1,65 @@ +From patchwork Fri Nov 1 03:19:39 2024 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Daniel Golle +X-Patchwork-Id: 13858671 +Return-Path: + +Date: Fri, 1 Nov 2024 03:19:39 +0000 +From: Daniel Golle +To: linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, + linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, Uwe + =?iso-8859-1?q?Kleine-K=F6nig?= , + Sam Shih , Frank Wunderlich , + Daniel Golle , + AngeloGioacchino Del Regno , + Matthias Brugger , Stephen Boyd , + Michael Turquette +Subject: [PATCH] clk: mediatek: mt7988-infracfg: SPI0 clocks are not critical +Message-ID: +MIME-Version: 1.0 +Content-Disposition: inline +X-BeenThere: linux-mediatek@lists.infradead.org +X-Mailman-Version: 2.1.34 +Precedence: list +List-Id: +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +Sender: "Linux-mediatek" +Errors-To: + linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org + +SPI0 clocks have wrongly been marked as critical while, probably due +to the SPI driver not requesting them. This can (and should) be addressed +in device tree instead. +Remove CLK_IS_CRITICAL flag from clocks related to SPI0. + +Fixes: 4b4719437d85 ("clk: mediatek: add drivers for MT7988 SoC") +Signed-off-by: Daniel Golle +--- + drivers/clk/mediatek/clk-mt7988-infracfg.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +--- a/drivers/clk/mediatek/clk-mt7988-infracfg.c ++++ b/drivers/clk/mediatek/clk-mt7988-infracfg.c +@@ -196,12 +196,10 @@ static const struct mtk_gate infra_clks[ + 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_SPI0, "infra_hf_104m_spi0", "infra_mux_spi0_sel", 12), + 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_SPI0_HCK, "infra_hf_66m_spi0_hck", "sysaxi_sel", 15), + 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), From a4f3e170291416981093884d6326de63d780d6d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Fri, 1 Nov 2024 21:44:43 +0100 Subject: [PATCH 004/877] bcm27xx-gpu-fw: fix package MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Install definition was accidentally removed in 7afdbc0955a5 and IB fails. Fixes: 7afdbc0955a5 ("bcm27xx-gpu-fw: update to latest version") Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit efd1ec51a1) --- package/kernel/bcm27xx-gpu-fw/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/package/kernel/bcm27xx-gpu-fw/Makefile b/package/kernel/bcm27xx-gpu-fw/Makefile index 6de2fd7501c45b..0b8f5781e5499f 100644 --- a/package/kernel/bcm27xx-gpu-fw/Makefile +++ b/package/kernel/bcm27xx-gpu-fw/Makefile @@ -4,7 +4,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=bcm27xx-gpu-fw PKG_VERSION:=2024.10.08 PKG_VERSION_REAL:=1.$(subst .,,$(PKG_VERSION)) -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=raspi-firmware_$(PKG_VERSION_REAL).orig.tar.xz PKG_SOURCE_URL:=https://github.com/raspberrypi/firmware/releases/download/$(PKG_VERSION_REAL) @@ -33,6 +33,10 @@ define Build/Compile true endef +define Package/bcm27xx-gpu-fw/install + true +endef + define Build/InstallDev $(CP) $(PKG_BUILD_DIR)/boot/bootcode.bin $(KERNEL_BUILD_DIR) $(CP) $(PKG_BUILD_DIR)/boot/LICENCE.broadcom $(KERNEL_BUILD_DIR) From e3bbeabe9248938ab506bc55c13ff545a72f1d9b Mon Sep 17 00:00:00 2001 From: Paul Donald Date: Tue, 29 Oct 2024 21:49:00 +0100 Subject: [PATCH 005/877] kernel: KERNEL_NET_L3_MASTER_DEV default to y if !SMALL_FLASH Follow-up for 45d541bb409355f090b971d96ebebd8610ef84a7 This change allows features such as kmod-vrf ``` KERNEL_NET_L3_MASTER_DEV=n x86_64 generic bzImage 6,927,360 bytes aarch64 coretex-a53 kernel 4,268,836 bytes KERNEL_NET_L3_MASTER_DEV=y x86_64 generic bzImage 6,931,456 bytes aarch64 coretex-a53 kernel 4,273,042 bytes Delta: x86_64 generic +4096 bytes aarch64 coretex-a53 +4206 bytes x86_64 generic vrf.ko - 258,792 bytes aarch64 coretex-a53 vrf.ko - 263,632 bytes ``` See: https://forum.openwrt.org/t/vrf-support-testing-out-evpn-at-home/181108 https://forum.openwrt.org/t/please-enable-net-l3-master-dev-in-kernel-build-by-default/201825 Signed-off-by: Paul Donald Link: https://github.com/openwrt/openwrt/pull/16819 Signed-off-by: Robert Marko --- config/Config-kernel.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/Config-kernel.in b/config/Config-kernel.in index 43ed9eaf36b861..0fa039db404b78 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -1187,9 +1187,11 @@ endif config KERNEL_NET_L3_MASTER_DEV bool "L3 Master device support" + default y if !SMALL_FLASH help This module provides glue between core networking code and device drivers to support L3 master devices like VRF. + Increases the compressed kernel size by ~4kB (as of Linux 6.6). config KERNEL_XDP_SOCKETS bool "XDP sockets support" From 92fd12e7fd90ab2dc44b70300eb05c9da4f1f698 Mon Sep 17 00:00:00 2001 From: Kuan-Yi Li Date: Sun, 3 Nov 2024 04:11:36 +0800 Subject: [PATCH 006/877] openwrt-keyring: fix missing 24.10 usign key by installing it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @KA2107 reported that opkg is not able to verify the artifact signatures produced by buildbot using the usign 24.10 release keys. So lets fix it by actually adding the 24.10 usign key with d310c6f2833e97f7 fingerprint into the openwrt-keyring package. Fixes: #16850 Reported-by: @KA2107 Fixes: a535cfc09e1c ("openwrt-keyring: add OpenWrt 24.10 release build usign key") References: 2d03f27f0f07 ("openwrt-keyring: make opkg use 22.03 usign key") Signed-off-by: Kuan-Yi Li Signed-off-by: Petr Štetiar [commit description] --- package/system/openwrt-keyring/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/system/openwrt-keyring/Makefile b/package/system/openwrt-keyring/Makefile index 029463817b85dd..6c2fa3d108b6da 100644 --- a/package/system/openwrt-keyring/Makefile +++ b/package/system/openwrt-keyring/Makefile @@ -3,7 +3,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=openwrt-keyring -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/keyring.git @@ -38,8 +38,8 @@ endef else define Package/openwrt-keyring/install $(INSTALL_DIR) $(1)/etc/opkg/keys/ - # Public usign key for unattended snapshot builds - $(INSTALL_DATA) $(PKG_BUILD_DIR)/usign/b5043e70f9a75cde $(1)/etc/opkg/keys/ + # Public usign key for 24.10 release builds + $(INSTALL_DATA) $(PKG_BUILD_DIR)/usign/d310c6f2833e97f7 $(1)/etc/opkg/keys/ endef endif From 6bc930c47dd612a0933f29426e5765362f54e17b Mon Sep 17 00:00:00 2001 From: "Leon M. Busch-George" Date: Sat, 2 Nov 2024 12:28:51 +0100 Subject: [PATCH 007/877] mediatek: YunCore AX835: fix voltage regulator Specifying GPIO_ACTIVE_HIGH on the GPIO for the voltage regulator doesn't suffice. The regulator itself requires enable-active-high to be set. Fixes: #16292 Signed-off-by: Leon M. Busch-George Link: https://github.com/openwrt/openwrt/pull/16839 Signed-off-by: Robert Marko --- target/linux/mediatek/dts/mt7981b-yuncore-ax835.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/mediatek/dts/mt7981b-yuncore-ax835.dts b/target/linux/mediatek/dts/mt7981b-yuncore-ax835.dts index 5f98e6178aedff..b5de1c34b4457e 100644 --- a/target/linux/mediatek/dts/mt7981b-yuncore-ax835.dts +++ b/target/linux/mediatek/dts/mt7981b-yuncore-ax835.dts @@ -35,6 +35,7 @@ regulator-name = "led_vbus"; regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; + enable-active-high; regulator-always-on; gpios = <&pio 5 GPIO_ACTIVE_HIGH>; }; From d92306d020f3672d4fa3fc2e09235265a7547926 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Sun, 3 Nov 2024 09:34:31 +0100 Subject: [PATCH 008/877] mtd: Add backported Winbond fix Upstream stable is slow at picking this up and several systems are regressing. Add the patch locally in OpenWrt. Signed-off-by: Linus Walleij --- ...i-nor-winbond-fix-w25q128-regression.patch | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 target/linux/generic/backport-6.6/409-mtd-spi-nor-winbond-fix-w25q128-regression.patch diff --git a/target/linux/generic/backport-6.6/409-mtd-spi-nor-winbond-fix-w25q128-regression.patch b/target/linux/generic/backport-6.6/409-mtd-spi-nor-winbond-fix-w25q128-regression.patch new file mode 100644 index 00000000000000..de79328138b0a5 --- /dev/null +++ b/target/linux/generic/backport-6.6/409-mtd-spi-nor-winbond-fix-w25q128-regression.patch @@ -0,0 +1,59 @@ +From 342672bbdf713654316a0ff73c7f2ecf7ea6693d Mon Sep 17 00:00:00 2001 +From: Michael Walle +Date: Fri, 21 Jun 2024 14:09:29 +0200 +Subject: [PATCH] mtd: spi-nor: winbond: fix w25q128 regression + +Upstream commit d35df77707bf5ae1221b5ba1c8a88cf4fcdd4901 + +("mtd: spi-nor: winbond: fix w25q128 regression") +however the code has changed a lot after v6.6 so the patch did +not apply to v6.6 or v6.1 which still has the problem. + +This patch fixes the issue in the way of the old API and has +been tested on hardware. Please apply it for v6.1 and v6.6. + +Commit 83e824a4a595 ("mtd: spi-nor: Correct flags for Winbond w25q128") +removed the flags for non-SFDP devices. It was assumed that it wasn't in +use anymore. This wasn't true. Add the no_sfdp_flags as well as the size +again. + +We add the additional flags for dual and quad read because they have +been reported to work properly by Hartmut using both older and newer +versions of this flash, the similar flashes with 64Mbit and 256Mbit +already have these flags and because it will (luckily) trigger our +legacy SFDP parsing, so newer versions with SFDP support will still get +the parameters from the SFDP tables. + +Reported-by: Hartmut Birr +Closes: https://lore.kernel.org/r/CALxbwRo_-9CaJmt7r7ELgu+vOcgk=xZcGHobnKf=oT2=u4d4aA@mail.gmail.com/ +Fixes: 83e824a4a595 ("mtd: spi-nor: Correct flags for Winbond w25q128") +Reviewed-by: Linus Walleij +Signed-off-by: Michael Walle +Acked-by: Tudor Ambarus +Reviewed-by: Esben Haabendal +Reviewed-by: Pratyush Yadav +Signed-off-by: Pratyush Yadav +Link: https://lore.kernel.org/r/20240621120929.2670185-1-mwalle@kernel.org +[Backported to v6.6 - vastly different due to upstream changes] +Reviewed-by: Tudor Ambarus +Signed-off-by: Linus Walleij +--- + drivers/mtd/spi-nor/winbond.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +--- a/drivers/mtd/spi-nor/winbond.c ++++ b/drivers/mtd/spi-nor/winbond.c +@@ -120,9 +120,10 @@ static const struct flash_info winbond_n + NO_SFDP_FLAGS(SECT_4K) }, + { "w25q80bl", INFO(0xef4014, 0, 64 * 1024, 16) + NO_SFDP_FLAGS(SECT_4K) }, +- { "w25q128", INFO(0xef4018, 0, 0, 0) +- PARSE_SFDP +- FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) }, ++ { "w25q128", INFO(0xef4018, 0, 64 * 1024, 256) ++ FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) ++ NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | ++ SPI_NOR_QUAD_READ) }, + { "w25q256", INFO(0xef4019, 0, 64 * 1024, 512) + NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) + .fixups = &w25q256_fixups }, From 547feaca2ca7a8d1f81757d6905da3da127139d9 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Fri, 2 Aug 2024 14:30:32 -0700 Subject: [PATCH 009/877] gpio-button-hotplug: use flexible array member zero length arrays are deprecated. Fixes coccinelle warning: WARNING use flexible-array member instead Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/16848 Signed-off-by: Robert Marko --- package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c index 1dd0ff2a1a1abf..52346c25d98a3c 100644 --- a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c +++ b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c @@ -302,7 +302,7 @@ struct gpio_keys_button_dev { struct device *dev; struct gpio_keys_platform_data *pdata; - struct gpio_keys_button_data data[0]; + struct gpio_keys_button_data data[]; }; static void gpio_keys_polled_queue_work(struct gpio_keys_button_dev *bdev) From de3d57a60caff8654f600dd6e68023eca242f61b Mon Sep 17 00:00:00 2001 From: Enrico Mioso Date: Mon, 21 Oct 2024 23:39:59 +0200 Subject: [PATCH 010/877] uboot-mediatek: fix boot media for mt7981 RFB NOR profile Signed-off-by: Enrico Mioso CC: Daniel Golle --- 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 e5a0a393fe5cb8..0376eea8f2e5bf 100644 --- a/package/boot/uboot-mediatek/Makefile +++ b/package/boot/uboot-mediatek/Makefile @@ -370,7 +370,7 @@ define U-Boot/mt7981_rfb-nor BUILD_DEVICES:=mediatek_mt7981-rfb UBOOT_CONFIG:=mt7981_nor_rfb UBOOT_IMAGE:=u-boot.fip - BL2_BOOTDEV:=spim-nand + BL2_BOOTDEV:=nor BL2_SOC:=mt7981 BL2_DDRTYPE:=ddr3 DEPENDS:=+trusted-firmware-a-mt7981-nor-ddr3 From a923d1f9eca8393656ec18430366877b196a1583 Mon Sep 17 00:00:00 2001 From: Mauri Sandberg Date: Fri, 11 Oct 2024 10:38:07 +0300 Subject: [PATCH 011/877] ramips: Fix EX400 imagebuilder A factory image for DNA EX400 depends on an initramfs image and they were explicitly removed from the imagebuilder recently. Now the factory image creation fails miserably and it also affects custom image creation with the firmware selector. Add the initramfs kernel to the staging so that it's shipped with the imagebuilder. Also remove a image build target added solely for DNA EX400. Tested by creating a factory and syspupgrade images locally with the imagebuilder and verified their functionality. Related work c85348d9abf4 ("imagebuilder: remove initramfs image files") Fixes: fea2264d9fdd ("ramips: mt7621: Add DNA Valokuitu Plus EX400") Signed-off-by: Mauri Sandberg --- v4: use append-image-stage, remove Build/kernel-initramfs-bin v3: adjust commit subject v2: remove fix for inconsistent line ending elsewhere in the file Link: https://github.com/openwrt/openwrt/pull/16659 Signed-off-by: Robert Marko --- target/linux/ramips/image/mt7621.mk | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 34ed9a4d54a634..9654e237a8af22 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -180,10 +180,6 @@ define Build/iodata-mstc-header2 mv $@.new $@ endef -define Build/kernel-initramfs-bin - $(CP) $(KDIR)/vmlinux-initramfs $@ -endef - define Build/znet-header $(eval version=$(word 1,$(1))) $(eval magic=$(if $(word 2,$(1)),$(word 2,$(1)),ZNET)) @@ -1093,8 +1089,8 @@ define Device/dna_valokuitu-plus-ex400 DEVICE_MODEL := Valokuitu Plus EX400 KERNEL := kernel-bin | lzma | uImage lzma KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | uImage lzma - IMAGES := factory.bin sysupgrade.bin - IMAGE/factory.bin := kernel-initramfs-bin | lzma | uImage lzma | \ + IMAGES += factory.bin + IMAGE/factory.bin := append-image-stage initramfs-kernel.bin | \ dna-bootfs with-initrd | dna-header | \ append-md5sum-ascii-salted IMAGE/sysupgrade.bin := dna-bootfs | sysupgrade-tar kernel=$$$$@ | check-size | \ From 4ec95518de3cf29d85136721921355f4cd2f9b35 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Mon, 4 Nov 2024 18:20:06 +0100 Subject: [PATCH 012/877] nu801: Mark as nonshared to build in step 1 Mark the package as nonshared to build it in the target specific build step 1 of the build bots instead of the architecture generic build step 2. In the build step 2 it may be left out if we build it using a different target. Fixes: #16857 Link: https://github.com/openwrt/openwrt/pull/16859 Signed-off-by: Robert Marko --- package/system/gpio-cdev/nu801/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/package/system/gpio-cdev/nu801/Makefile b/package/system/gpio-cdev/nu801/Makefile index 82c04ccb415d1e..7724cd808bff66 100644 --- a/package/system/gpio-cdev/nu801/Makefile +++ b/package/system/gpio-cdev/nu801/Makefile @@ -3,6 +3,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=nu801 +PKG_FLAGS:=nonshared PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git From 7c8bfc0be5cfbcdbeb937689210c2fe78572198c Mon Sep 17 00:00:00 2001 From: John Crispin Date: Sat, 21 Sep 2024 09:47:26 +0200 Subject: [PATCH 013/877] uboot-mediatek: add support for arcadyan,mozart Signed-off-by: John Crispin --- package/boot/uboot-mediatek/Makefile | 13 + .../patches/456-add-arcadyan-mozart.patch | 308 ++++++++++++++++++ 2 files changed, 321 insertions(+) create mode 100644 package/boot/uboot-mediatek/patches/456-add-arcadyan-mozart.patch diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile index 0376eea8f2e5bf..fe8d61e56c07b5 100644 --- a/package/boot/uboot-mediatek/Makefile +++ b/package/boot/uboot-mediatek/Makefile @@ -629,6 +629,18 @@ define U-Boot/mt7986_zyxel_ex5601-t0 DEPENDS:=+trusted-firmware-a-mt7986-spim-nand-4k-ddr4 endef +define U-Boot/mt7988_arcadyan_mozart + NAME:=Arcadyan Mozart + BUILD_SUBTARGET:=filogic + BUILD_DEVICES:=arcadyan_mozart + UBOOT_CONFIG:=mt7988a_arcadyan_mozart + UBOOT_IMAGE:=u-boot.fip + BL2_BOOTDEV:=emmc + BL2_SOC:=mt7988 + BL2_DDRTYPE:=comb + DEPENDS:=+trusted-firmware-a-mt7988-emmc-comb +endef + define U-Boot/mt7988_bananapi_bpi-r4-emmc NAME:=BananaPi BPi-R4 BUILD_SUBTARGET:=filogic @@ -816,6 +828,7 @@ UBOOT_TARGETS := \ mt7986_xiaomi_redmi-router-ax6000 \ mt7986_zyxel_ex5601-t0 \ mt7986_rfb \ + mt7988_arcadyan_mozart \ mt7988_bananapi_bpi-r4-emmc \ mt7988_bananapi_bpi-r4-sdmmc \ mt7988_bananapi_bpi-r4-snand \ diff --git a/package/boot/uboot-mediatek/patches/456-add-arcadyan-mozart.patch b/package/boot/uboot-mediatek/patches/456-add-arcadyan-mozart.patch new file mode 100644 index 00000000000000..5c9c6e697719c4 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/456-add-arcadyan-mozart.patch @@ -0,0 +1,308 @@ +--- /dev/null ++++ b/configs/mt7988a_arcadyan_mozart_defconfig +@@ -0,0 +1,119 @@ ++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=0x40000 ++CONFIG_ENV_OFFSET=0x400000 ++CONFIG_DEFAULT_DEVICE_TREE="mt7988a-arcadyan-mozart" ++CONFIG_OF_LIBFDT_OVERLAY=y ++CONFIG_TARGET_MT7988=y ++CONFIG_PRE_CON_BUF_ADDR=0x4007EF00 ++CONFIG_DEBUG_UART_BASE=0x11000000 ++CONFIG_DEBUG_UART_CLOCK=40000000 ++CONFIG_ENV_OFFSET_REDUND=0x440000 ++CONFIG_SYS_LOAD_ADDR=0x50000000 ++CONFIG_PCI=y ++CONFIG_DEBUG_UART=y ++CONFIG_AHCI=y ++CONFIG_FIT=y ++CONFIG_BOOTDELAY=30 ++CONFIG_AUTOBOOT_KEYED=y ++CONFIG_AUTOBOOT_MENU_SHOW=y ++CONFIG_OF_SYSTEM_SETUP=y ++CONFIG_DEFAULT_FDT_FILE="mediatek/mt7988a-arcadyan-mozart.dtb" ++CONFIG_SYS_CBSIZE=512 ++CONFIG_SYS_PBSIZE=1049 ++CONFIG_LOGLEVEL=7 ++CONFIG_PRE_CONSOLE_BUFFER=y ++CONFIG_LOG=y ++CONFIG_BOARD_LATE_INIT=y ++CONFIG_HUSH_PARSER=y ++CONFIG_SYS_PROMPT="MT7988> " ++CONFIG_CMD_CPU=y ++CONFIG_CMD_LICENSE=y ++# CONFIG_CMD_BOOTEFI_BOOTMGR is not set ++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_MTD=y ++CONFIG_CMD_PART=y ++CONFIG_CMD_PCI=y ++CONFIG_CMD_SF_TEST=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_PXE=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_CMD_EXT4=y ++CONFIG_CMD_FAT=y ++CONFIG_CMD_FS_GENERIC=y ++CONFIG_CMD_FS_UUID=y ++CONFIG_OF_EMBED=y ++CONFIG_ENV_OVERWRITE=y ++CONFIG_ENV_IS_IN_MMC=y ++CONFIG_SYS_REDUNDAND_ENVIRONMENT=y ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_USE_DEFAULT_ENV_FILE=y ++CONFIG_DEFAULT_ENV_FILE="arcadyan_mozart_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_MT7988=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_SCSI=y ++CONFIG_DM_SERIAL=y ++CONFIG_MTK_SERIAL=y ++CONFIG_ZSTD=y ++CONFIG_HEXDUMP=y ++CONFIG_LMB_MAX_REGIONS=64 +--- /dev/null ++++ b/arcadyan_mozart_env +@@ -0,0 +1,55 @@ ++ipaddr=192.168.1.1 ++serverip=192.168.1.254 ++loadaddr=0x50000000 ++bootargs=console=ttyS0,115200n1 pci=pcie_bus_perf root=/dev/fit0 rootwait ++bootcmd=if pstore check ; then run boot_recovery ; else run boot_emmc ; fi ++bootconf=config-1 ++bootconf_extra= ++bootdelay=0 ++bootfile=openwrt-mediatek-filogic-arcadyan_mozart-initramfs.itb ++bootfile_bl2=openwrt-mediatek-filogic-arcadyan_mozart-emmc-preloader.bin ++bootfile_fip=openwrt-mediatek-filogic-arcadyan_mozart-emmc-bl31-uboot.fip ++bootfile_upg=openwrt-mediatek-filogic-arcadyan_mozart-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 ) ) ) [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#$bootconf_extra ; led $bootled_pwr off ++boot_recovery=led $bootled_rec on ; run emmc_read_recovery && bootm $loadaddr#$bootconf#$bootconf_extra ; 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#$bootconf_extra ; 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/arch/arm/dts/mt7988a-arcadyan-mozart.dts +@@ -0,0 +1,125 @@ ++// SPDX-License-Identifier: GPL-2.0 ++ ++/dts-v1/; ++#include "mt7988.dtsi" ++#include ++#include ++ ++/ { ++ model = "MediaTek / Arcadyan - Mozart"; ++ compatible = "arcadyan,mozart", "mediatek,mt7988"; ++ ++ chosen { ++ stdout-path = &uart0; ++ }; ++ ++ memory@40000000 { ++ device_type = "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_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; ++ }; ++ ++ keys { ++ compatible = "gpio-keys"; ++ ++ wps { ++ label = "reset"; ++ linux,code = ; ++ gpios = <&gpio 143 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ led-red { ++ label = "red:status"; ++ gpios = <&gpio 29 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ led-green { ++ label = "blue:status"; ++ gpios = <&gpio 30 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ led-blue { ++ label = "blue:status"; ++ gpios = <&gpio 31 GPIO_ACTIVE_HIGH>; ++ }; ++ }; ++}; ++ ++&uart0 { ++ status = "okay"; ++}; ++ ++ð { ++ status = "okay"; ++ mediatek,gmac-id = <0>; ++ phy-mode = "usxgmii"; ++ mediatek,switch = "mt7988"; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ pause; ++ }; ++}; ++ ++&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; ++ }; ++ ++ conf-clk { ++ pins = "EMMC_CK"; ++ }; ++ ++ conf-dsl { ++ pins = "EMMC_DSL"; ++ }; ++ ++ conf-rst { ++ pins = "EMMC_RSTB"; ++ }; ++ }; ++}; ++ ++&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"; ++}; From 0f6aafcc24805d98f0556412e1d9154259a295a2 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Tue, 29 Oct 2024 13:37:40 +0100 Subject: [PATCH 014/877] mediatek: add support for Realtek RTL8261n 10G PHYs There is no upstream driver yet. Merge the RTL SDK driver for now. Signed-off-by: John Crispin --- .../drivers/net/phy/rtl8261n/Kconfig | 5 + .../drivers/net/phy/rtl8261n/Makefile | 11 + .../phy/rtl8261n/construct/conf_rtl8261n_c.c | 1465 +++++++++++ .../phy/rtl8261n/construct/conf_rtl8264b.c | 2177 +++++++++++++++++ .../drivers/net/phy/rtl8261n/error.h | 165 ++ .../drivers/net/phy/rtl8261n/phy_patch.c | 179 ++ .../drivers/net/phy/rtl8261n/phy_patch.h | 174 ++ .../net/phy/rtl8261n/phy_rtl826xb_patch.c | 1031 ++++++++ .../net/phy/rtl8261n/phy_rtl826xb_patch.h | 63 + .../drivers/net/phy/rtl8261n/rtk_osal.c | 56 + .../drivers/net/phy/rtl8261n/rtk_osal.h | 99 + .../drivers/net/phy/rtl8261n/rtk_phy.c | 282 +++ .../drivers/net/phy/rtl8261n/rtk_phylib.c | 108 + .../drivers/net/phy/rtl8261n/rtk_phylib.h | 101 + .../drivers/net/phy/rtl8261n/rtk_phylib_def.h | 166 ++ .../net/phy/rtl8261n/rtk_phylib_rtl826xb.c | 57 + .../net/phy/rtl8261n/rtk_phylib_rtl826xb.h | 19 + .../files-6.6/drivers/net/phy/rtl8261n/type.h | 117 + target/linux/mediatek/filogic/config-6.6 | 1 + target/linux/mediatek/mt7622/config-6.6 | 1 + target/linux/mediatek/mt7623/config-6.6 | 1 + target/linux/mediatek/mt7629/config-6.6 | 1 + .../735-net-phy-realtek-rtl8261n.patch | 21 + 23 files changed, 6300 insertions(+) create mode 100644 target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/Kconfig create mode 100644 target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/Makefile create mode 100644 target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/construct/conf_rtl8261n_c.c create mode 100644 target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/construct/conf_rtl8264b.c create mode 100644 target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/error.h create mode 100644 target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/phy_patch.c create mode 100644 target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/phy_patch.h create mode 100644 target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/phy_rtl826xb_patch.c create mode 100644 target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/phy_rtl826xb_patch.h create mode 100644 target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/rtk_osal.c create mode 100644 target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/rtk_osal.h create mode 100644 target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/rtk_phy.c create mode 100644 target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/rtk_phylib.c create mode 100644 target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/rtk_phylib.h create mode 100644 target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/rtk_phylib_def.h create mode 100644 target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/rtk_phylib_rtl826xb.c create mode 100644 target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/rtk_phylib_rtl826xb.h create mode 100644 target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/type.h create mode 100644 target/linux/mediatek/patches-6.6/735-net-phy-realtek-rtl8261n.patch diff --git a/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/Kconfig b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/Kconfig new file mode 100644 index 00000000000000..cdb5cb74882a91 --- /dev/null +++ b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/Kconfig @@ -0,0 +1,5 @@ + +config RTL8261N_PHY + tristate "Driver for Realtek RTL8261N PHYs" + help + Currently supports the RTL8261N,RTL8264B PHYs. diff --git a/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/Makefile b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/Makefile new file mode 100644 index 00000000000000..a661d6ce85e8c9 --- /dev/null +++ b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/Makefile @@ -0,0 +1,11 @@ + +obj-$(CONFIG_RTL8261N_PHY) += rtl8621n.o + +rtl8621n-objs += phy_patch.o +rtl8621n-objs += phy_rtl826xb_patch.o +rtl8621n-objs += rtk_osal.o +rtl8621n-objs += rtk_phy.o +rtl8621n-objs += rtk_phylib.o +rtl8621n-objs += rtk_phylib_rtl826xb.o + +ccflags-y += -Werror -DRTK_PHYDRV_IN_LINUX diff --git a/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/construct/conf_rtl8261n_c.c b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/construct/conf_rtl8261n_c.c new file mode 100644 index 00000000000000..8e7c714fc40191 --- /dev/null +++ b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/construct/conf_rtl8261n_c.c @@ -0,0 +1,1465 @@ +/* + * SPDX-License-Identifier: GPL-2.0-only + * + * Copyright (c) 2023 Realtek Semiconductor Corp. All rights reserved. + */ + +//Date: Tue Nov 15 19:53:03 2022 + +rtk_hwpatch_t rtl8261n_c_top_conf[] = { + {RTK_PATCH_OP_TOP , 0xf , 2 , 20 , 15, 0 , 0x5 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 2 , 21 , 15, 0 , 0x0 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 2 , 22 , 15, 0 , 0x280 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 2 , 23 , 15, 0 , 0x0014, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 3 , 16 , 15, 0 , 0x0300, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 3 , 17 , 15, 0 , 0x01ff, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 3 , 18 , 15, 0 , 0x000c, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 3 , 19 , 15, 0 , 0x01ff, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 3 , 20 , 15, 0 , 0x0200, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 3 , 21 , 15, 0 , 0x0015, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 3 , 22 , 15, 0 , 0x0200, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 3 , 23 , 15, 0 , 0x0 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 4 , 16 , 15, 0 , 0x0 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 13 , 23 , 8 , 5 , 0x6 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 90 , 18 , 15, 0 , 0x5 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 90 , 19 , 15, 0 , 0x5 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 90 , 20 , 15, 8 , 0x01 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, +}; + +rtk_hwpatch_t rtl8261n_c_sds_conf[] = { + {RTK_PATCH_OP_TOP , 0xf , 24 , 18 , 15, 0 , 0x881F, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 24 , 19 , 15, 0 , 0x003F, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 24 , 20 , 15, 0 , 0x003F, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 24 , 21 , 15, 0 , 0x003F, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 24 , 22 , 15, 0 , 0x001F, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x06 , 0x0D , 15, 0 , 0x0F00, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x06 , 0x0E , 15, 0 , 0x3F5A, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x07 , 0x10 , 15, 12, 0x8 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x07 , 0x10 , 7 , 0 , 0x3 , RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x06 , 0x1D , 15, 0 , 0x0600, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x21 , 0x00 , 15, 0 , 0x4902, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x21 , 0x08 , 15, 0 , 0x0FC0, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x21 , 0x09 , 15, 0 , 0x33F0, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x21 , 0x0C , 15, 0 , 0x08BF, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x21 , 0x12 , 15, 0 , 0x8000, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x36 , 0x07 , 15, 0 , 0x04C0, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x36 , 0x08 , 15, 0 , 0x2000, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2E , 0x0B , 15, 0 , 0x2390, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2E , 0x0C , 15, 0 , 0xAA17, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2E , 0x0D , 15, 0 , 0xFE40, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2E , 0x0E , 15, 0 , 0x12F4, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2E , 0x11 , 15, 0 , 0xF2AD, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2E , 0x15 , 15, 0 , 0x7A41, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2E , 0x16 , 15, 0 , 0x0041, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2F , 0x00 , 15, 0 , 0x1F00, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2F , 0x01 , 15, 0 , 0x2800, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2F , 0x02 , 15, 0 , 0x0FC8, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2F , 0x11 , 15, 0 , 0x3000, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2F , 0x13 , 15, 0 , 0xF400, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2F , 0x1E , 15, 0 , 0x0500, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x34 , 0x0B , 15, 0 , 0x2390, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x34 , 0x0C , 15, 0 , 0xA517, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x34 , 0x0D , 15, 0 , 0xFE41, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x34 , 0x0E , 15, 0 , 0x12F4, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x34 , 0x11 , 15, 0 , 0xF2AD, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x34 , 0x15 , 15, 0 , 0x7A41, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x34 , 0x16 , 15, 0 , 0x0041, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x35 , 0x00 , 15, 0 , 0x1F80, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x35 , 0x01 , 15, 0 , 0x0800, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x35 , 0x02 , 15, 0 , 0x0FC8, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x35 , 0x11 , 15, 0 , 0x3001, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x35 , 0x13 , 15, 0 , 0xF400, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x35 , 0x1E , 15, 0 , 0x0100, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2C , 0x0B , 15, 0 , 0x2390, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2C , 0x0C , 15, 0 , 0xA517, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2C , 0x0D , 15, 0 , 0xFE41, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2C , 0x0E , 15, 0 , 0x12F4, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2C , 0x11 , 15, 0 , 0xF2AD, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2C , 0x15 , 15, 0 , 0x7A61, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2C , 0x16 , 15, 0 , 0x0041, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2D , 0x00 , 15, 0 , 0x1F80, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2D , 0x01 , 15, 0 , 0x0800, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2D , 0x02 , 15, 0 , 0x0FC8, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2D , 0x11 , 15, 0 , 0x3001, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2D , 0x13 , 15, 0 , 0xF400, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2D , 0x1E , 15, 0 , 0x0100, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x28 , 0x0B , 15, 0 , 0x2390, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x28 , 0x0C , 15, 0 , 0xA514, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x28 , 0x0D , 15, 0 , 0xFE43, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x28 , 0x0E , 15, 0 , 0x12F4, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x28 , 0x11 , 15, 0 , 0xF2AD, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x28 , 0x15 , 15, 0 , 0x7A61, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x28 , 0x16 , 15, 0 , 0x0041, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x29 , 0x00 , 15, 0 , 0x1F80, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x29 , 0x01 , 15, 0 , 0x0800, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x29 , 0x02 , 15, 0 , 0x0FC8, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x29 , 0x11 , 15, 0 , 0x3001, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x29 , 0x13 , 15, 0 , 0xF400, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x29 , 0x1E , 15, 0 , 0x0100, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x26 , 0x0B , 15, 0 , 0x2390, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x26 , 0x0C , 15, 0 , 0xA514, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x26 , 0x0D , 15, 0 , 0xFE43, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x26 , 0x0E , 15, 0 , 0x12F4, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x26 , 0x11 , 15, 0 , 0xF2AD, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x26 , 0x15 , 15, 0 , 0x7A41, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x26 , 0x16 , 15, 0 , 0x0041, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x27 , 0x00 , 15, 0 , 0x1F80, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x27 , 0x01 , 15, 0 , 0x0800, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x27 , 0x02 , 15, 0 , 0x0FC8, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x27 , 0x11 , 15, 0 , 0x3001, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x27 , 0x13 , 15, 0 , 0xF400, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x27 , 0x1E , 15, 0 , 0x0100, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x24 , 0x0B , 15, 0 , 0x2390, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x24 , 0x0C , 15, 0 , 0xA514, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x24 , 0x0D , 15, 0 , 0xFE43, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x24 , 0x0E , 15, 0 , 0x12F4, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x24 , 0x11 , 15, 0 , 0xF2AD, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x24 , 0x15 , 15, 0 , 0x7A41, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x24 , 0x16 , 15, 0 , 0x0041, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x25 , 0x00 , 15, 0 , 0x1F80, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x25 , 0x01 , 15, 0 , 0x0800, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x25 , 0x02 , 15, 0 , 0x0FC8, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x25 , 0x11 , 15, 0 , 0x3001, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x25 , 0x13 , 15, 0 , 0xF400, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x25 , 0x1E , 15, 0 , 0x0100, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 24 , 18 , 15, 0 , 0x880D, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 24 , 19 , 15, 0 , 0x0024, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 24 , 20 , 15, 0 , 0x0036, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 24 , 21 , 15, 0 , 0x0035, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 24 , 22 , 15, 0 , 0x001A, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x1F , 0x00 , 15, 0 , 0x001B, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x1F , 0x00 , 15, 0 , 0x0000, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 90 , 20 , 7 , 0 , 0x01 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, +}; + +rtk_hwpatch_t rtl8261n_c_afe_conf[] = { +}; + +rtk_hwpatch_t rtl8261n_c_uc_conf[] = { + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb820, 7 , 7 , 0x0 , RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xbd8a, 5 , 3 , 0x3 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xbd8c, 6 , 4 , 0x5 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x8060, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 12, 10, 0x3 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x8061, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 13, 0x5 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa466, 1 , 1 , 0x1 , RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x8491, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 8 , 0x3D , RTK_PATCH_CMP_WS , 0, 0, 0, 0}, +}; + +rtk_hwpatch_t rtl8261n_c_uc2_conf[] = { + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb820, 7 , 7 , 0x1 , RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xb87c, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8af6, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xb87e, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xaf8b, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8af6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0eaf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8af8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8b41, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8afa}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xaf8b, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8afc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4faf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8afe}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8b5b, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b00}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xaf8b, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b02}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xb4af, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b04}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8bc0, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b06}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xaf8b, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b08}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xdaaf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b0a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8bda, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b0c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf8ef, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b0e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x49f8, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b10}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf70, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b12}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3f02, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b14}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6772, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b16}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xad28, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b18}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13e1, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b1a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8a55, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b1c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xad28, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b1e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0502, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b20}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5ee2, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b22}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xae0e, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b24}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x025d, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b26}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8f02, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b28}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8bda, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b2a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xae06, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b2c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x025d, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b2e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x7002, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b30}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8c22, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b32}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xe087, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b34}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1ef6, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b36}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x27e4, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b38}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x871e, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b3a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xfcef, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b3c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x94fc, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b3e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x04a1, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b40}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0103, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b42}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x028b, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b44}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xfee0, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b46}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8a09, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b48}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xef23, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b4a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xaf5e, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b4c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5bac, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b4e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5003, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b50}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xaf62, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b52}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8a02, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b54}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8c22, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b56}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xaf62, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b58}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xb0bf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b5a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x68e0, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b5c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0267, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b5e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x72ef, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b60}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x31bf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b62}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x68dd, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b64}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0267, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b66}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x721e, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b68}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x31ac, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b6a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3819, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b6c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf68, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b6e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xe902, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b70}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6772, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b72}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xef31, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b74}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf68, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b76}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xe602, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b78}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6772, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b7a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1e31, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b7c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xac38, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b7e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0cee, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b80}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8933, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b82}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x02ae, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b84}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0aee, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b86}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8933, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b88}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x00ae, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b8a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x04ee, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b8c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8933, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b8e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x01bf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b90}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8ff9, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b92}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xe189, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b94}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x331a, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b96}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x91db, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b98}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf69, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b9a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4c02, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b9c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6772, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b9e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1f00, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ba0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1f22, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ba2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1b45, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ba4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xad27, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ba6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x05e1, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ba8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x870d, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8baa}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xae03, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bac}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xe187, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bae}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0eaf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bb0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x2d1a, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bb2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0248, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bb4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf702, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bb6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8c46, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bb8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0222, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bba}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4faf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bbc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4176, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bbe}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf8c, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bc0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9002, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bc2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x70eb, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bc4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf8c, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bc6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9f02, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bc8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x70eb, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bca}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf8c, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bcc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa502, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bce}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x70eb, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bd0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd300, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bd2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0241, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bd4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x7caf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bd6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x46b2, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bd8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf8ef, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bda}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x49f8, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bdc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6f, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bde}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3a02, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8be0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6772, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8be2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xac28, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8be4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x12bf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8be6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6d63, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8be8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0267, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bea}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x72e5, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bec}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8ffc, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bee}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6d, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bf0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6f02, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bf2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6772, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bf4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xe58f, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bf6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xfdfc, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bf8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xef94, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bfa}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xfc04, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bfc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf8ef, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bfe}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x49f8, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c00}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6f, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c02}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3a02, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c04}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6772, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c06}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xac28, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c08}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x12e1, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c0a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8ffe, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c0c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6d, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c0e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6302, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c10}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6753, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c12}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xe18f, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c14}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xffbf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c16}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6d6f, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c18}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0267, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c1a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x53fc, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c1c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xef94, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c1e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xfc04, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c20}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf8ef, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c22}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x49f8, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c24}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6f, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c26}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3a02, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c28}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6772, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c2a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xac28, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c2c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x12e1, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c2e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8ffc, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c30}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6d, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c32}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6302, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c34}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6753, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c36}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xe18f, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c38}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xfdbf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c3a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6d6f, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c3c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0267, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c3e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x53fc, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c40}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xef94, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c42}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xfc04, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c44}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf8fa, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c46}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xef69, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c48}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6f, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c4a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3a02, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c4c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6772, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c4e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xad28, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c50}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0ebf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c52}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8c93, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c54}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0270, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c56}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf4bf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c58}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8c90, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c5a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0270, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c5c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf4ae, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c5e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x2ad1, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c60}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0fbf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c62}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8c96, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c64}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0267, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c66}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x53bf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c68}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8c99, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c6a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0270, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c6c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xebd1, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c6e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x00bf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c70}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8c9c, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c72}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0267, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c74}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x53bf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c76}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8c9f, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c78}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0270, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c7a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf4d1, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c7c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x00bf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c7e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8ca2, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c80}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0267, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c82}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x53bf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c84}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8ca5, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c86}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0270, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c88}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf4ef, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c8a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x96fe, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c8c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xfc04, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c8e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x77bd, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c90}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6c66, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c92}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbd6c, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c94}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x30bd, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c96}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5444, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c98}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbd54, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c9a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x85bd, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c9c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5e55, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c9e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbd54, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ca0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa7bd, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ca2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5cbb, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ca4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbd5c, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ca6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xb85e, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x62ba, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xb860, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5e56, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xb862, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6287, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xb864, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x2d07, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xb886, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4170, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xb888, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x46ad, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xb88a, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xffff, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xb88c, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xffff, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xb838, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x003f, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb820, 7 , 7 , 0x0 , RTK_PATCH_CMP_WS , 0, 0, 0, 0}, +}; + +rtk_hwpatch_t rtl8261n_c_nctl0_conf[] = { + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb820, 7 , 7 , 0x1 , RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA016, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0000, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA012, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0000, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA014, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8010, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x801a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x801a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x801a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x801a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xa}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x801a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x801a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xe}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x801a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xf}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd719, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x10}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3bb7, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x11}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8014, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x12}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf003, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x13}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd704, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x14}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x406e, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x15}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x16}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x12db, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x17}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x18}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1301, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x19}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA026, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xffff, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA024, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xffff, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA022, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xffff, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA020, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xffff, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA006, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xffff, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA004, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xffff, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA002, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xffff, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA000, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x12d7, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA008, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0100, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb820, 7 , 7 , 0x0 , RTK_PATCH_CMP_WS , 0, 0, 0, 0}, +}; + +rtk_hwpatch_t rtl8261n_c_nctl1_conf[] = { +}; + +rtk_hwpatch_t rtl8261n_c_nctl2_conf[] = { + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb820, 7 , 7 , 0x1 , RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA016, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0020, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA012, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0000, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA014, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8010, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8029, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8217, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x82d0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x82f9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xa}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8322, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8322, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xe}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8322, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xf}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x10}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x11}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xcb0a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x12}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0cc7, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x13}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x14}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x15}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x16}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4127, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x17}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x18}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x19}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c0f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0b05, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c38, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0d28, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf008, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x20}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x21}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c0f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x22}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0b0a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x23}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c38, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x24}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0d18, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x25}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x26}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x27}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0f73, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x28}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x29}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x37c9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8034, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x33a9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8031, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd1bf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd06d, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf006, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x30}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd1dd, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x31}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd06d, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x32}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf003, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x33}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd199, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x34}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd06e, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x35}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x36}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1418, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x37}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x38}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5fba, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x39}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x3a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd05a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x3b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x3c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x60cf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x3d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x60f1, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x3e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6113, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x3f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6135, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x40}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6157, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x41}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf00b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x42}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x43}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf00a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x44}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x45}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf008, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x46}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x47}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf006, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x48}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x49}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf004, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x4a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x4b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf002, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x4c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x4d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x4e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x142d, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x4f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x50}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x51}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0ccf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x52}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0b40, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x53}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c3f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x54}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c24, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x55}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x56}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa340, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x57}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x58}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x147c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x59}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa110, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x5a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x5b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1435, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x5c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8110, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x5d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x5e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1485, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x5f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa304, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x60}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa8c0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x61}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8810, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x62}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa00a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x63}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa120, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x64}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa310, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x65}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0cfc, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x66}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0224, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x67}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0ca0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x68}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0480, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x69}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x6a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x6b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa340, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x6c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x6d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd162, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x6e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd048, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x6f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x70}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1418, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x71}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x72}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5fba, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x73}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8840, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x74}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd1c4, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x75}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd045, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x76}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x77}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1418, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x78}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x79}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5fba, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x7a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd706, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x7b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6127, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x7c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x7d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f3b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x7e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x88c0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x7f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x800a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x80}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8120, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x81}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8350, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x82}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x84a0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x83}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xffb6, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x84}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xb920, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x85}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xcd33, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x86}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x87}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1418, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x88}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd71f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x89}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x7fb4, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x8a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9920, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x8b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x8c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1418, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x8d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd71f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x8e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6065, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x8f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f94, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x90}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xffee, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x91}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xb820, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x92}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x93}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1418, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x94}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd71f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x95}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x7fa5, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x96}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9820, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x97}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x800a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x98}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8120, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x99}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x9a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x147c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x9b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa108, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x9c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x9d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1435, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x9e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8108, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x9f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xa0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1485, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xa1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa2fc, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xa2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa304, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xa3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8880, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xa4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0cc0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xa5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0440, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xa6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xcd34, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xa7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xa8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xa9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0cc0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xaa}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0b80, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xab}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xac3f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xac}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c38, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xad}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0d08, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xae}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xaf}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa810, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xb0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa00a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xb1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa120, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xb2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa480, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xb3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa604, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xb4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xb5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x37c9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xb6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x80bb, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xb7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xb8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd049, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xb9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf003, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xba}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd19f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xbb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd049, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xbc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xbd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1418, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xbe}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd71f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xbf}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x63f4, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xc0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xc1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f7a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xc2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd706, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xc3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4368, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xc4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xc5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xc6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0cc0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xc7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0b40, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xc8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8c3f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xc9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8d38, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xca}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xcb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xcc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x37c9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xcd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x80d7, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xce}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x33a9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xcf}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x80d4, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xd0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd1f4, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xd1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xd2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf006, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xd3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd1b7, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xd4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xd5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf003, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xd6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd1c6, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xd7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xd8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xd9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1418, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xda}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd71f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xdb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6074, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xdc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xdd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f7a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xde}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xdf}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1418, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xe0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd71f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xe1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4056, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xe2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf004, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xe3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xe4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x61fc, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xe5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xfff9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xe6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd706, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xe7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6048, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xe8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf00b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xe9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xea}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4070, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xeb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xec}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x81a4, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xed}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xee}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xef}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xae80, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xf0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xf1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xf2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x81a4, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xf3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xf4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd05a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xf5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xf6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x60cf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xf7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x60f1, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xf8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6113, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xf9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6135, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xfa}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6157, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xfb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf00b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xfc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xfd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf00a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xfe}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xff}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf008, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x100}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x101}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf006, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x102}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x103}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf004, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x104}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x105}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf002, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x106}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x107}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x108}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x142d, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x109}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x10a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x10b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0ccf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x10c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0b40, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x10d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c3f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x10e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c24, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x10f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x110}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa340, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x111}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x112}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x147c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x113}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa110, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x114}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x115}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1435, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x116}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8110, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x117}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x118}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1485, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x119}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa304, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x11a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa8c0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x11b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8810, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x11c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa00a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x11d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa120, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x11e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa310, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x11f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0cfc, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x120}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0224, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x121}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0ca0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x122}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0480, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x123}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8604, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x124}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xcd35, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x125}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd162, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x126}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd048, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x127}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x128}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1418, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x129}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x12a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5fba, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x12b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8840, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x12c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd1c4, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x12d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd045, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x12e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x12f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1418, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x130}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x131}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5fba, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x132}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd706, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x133}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6127, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x134}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x135}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f3b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x136}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x88c0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x137}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x800a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x138}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8120, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x139}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8350, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x13a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x84a0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x13b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xffb8, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x13c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbb80, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x13d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x13e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1418, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x13f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd71f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x140}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5fb4, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x141}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xb920, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x142}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xcd36, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x143}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x144}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1418, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x145}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd71f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x146}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x7fb4, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x147}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9920, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x148}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9b80, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x149}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x14a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1418, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x14b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd71f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x14c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6065, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x14d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f94, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x14e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xffe8, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x14f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xb820, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x150}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x151}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1418, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x152}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd71f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x153}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x7fa5, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x154}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9820, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x155}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x800a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x156}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8120, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x157}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x158}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x147c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x159}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa108, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x15a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x15b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1435, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x15c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8108, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x15d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x15e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1485, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x15f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa2fc, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x160}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa304, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x161}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8880, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x162}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0cc0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x163}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0440, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x164}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xcd37, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x165}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x166}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x167}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0cc0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x168}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0b80, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x169}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xac3f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x16a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c38, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x16b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0d08, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x16c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x16d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa810, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x16e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa00a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x16f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa120, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x170}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa480, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x171}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa604, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x172}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x173}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x37c9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x174}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x817e, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x175}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x33a9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x176}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x817b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x177}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x178}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd048, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x179}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf006, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x17a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x17b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd048, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x17c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf003, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x17d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x17e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd048, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x17f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x180}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1418, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x181}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x182}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1463, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x183}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x184}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f7a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x185}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd706, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x186}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f28, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x187}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x188}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x189}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0cc0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x18a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0b40, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x18b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8c3f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x18c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8d38, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x18d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x18e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x18f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x37c9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x190}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x819a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x191}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x33a9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x192}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8197, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x193}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd199, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x194}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x195}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf006, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x196}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x197}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x198}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf003, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x199}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd189, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x19a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x19b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x19c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1418, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x19d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x19e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1463, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x19f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1a0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f7a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1a1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd706, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1a2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f28, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1a3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1a4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1a5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c0f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1a6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0b05, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1a7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1a8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1a9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x60cf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1aa}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x60f1, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ab}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6113, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ac}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6135, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ad}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6157, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ae}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf00b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1af}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce08, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1b0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf00a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1b1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce08, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1b2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf008, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1b3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce08, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1b4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf006, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1b5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce08, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1b6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf004, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1b7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce08, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1b8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf002, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1b9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce08, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ba}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1bb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x142d, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1bc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa180, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1bd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xcd38, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1be}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1bf}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x37c9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1c0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x81d4, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1c1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x33a9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1c2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x81cc, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1c3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1c4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1c5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1c6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1c7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf013, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1c8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd100, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1c9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd049, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ca}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf010, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1cb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1cc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1cd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd1b7, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ce}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd049, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1cf}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf00b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1d0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd100, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1d1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd048, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1d2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf008, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1d3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1d4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1d5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1d6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1d7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf003, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1d8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd199, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1d9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1da}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd13b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1db}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd055, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1dc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1dd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1418, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1de}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1df}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1463, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1e0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1e1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f7b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1e2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa302, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1e3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1e4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1418, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1e5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1e6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1463, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1e7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1e8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f7a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1e9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd706, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ea}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f28, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1eb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ec}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ed}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c3f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ee}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c12, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ef}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1f0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1f1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x37c9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1f2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8206, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1f3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x33a9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1f4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x81fe, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1f5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1f6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1f7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd199, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1f8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1f9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf013, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1fa}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd100, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1fb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd048, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1fc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf010, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1fd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1fe}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ff}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x200}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x201}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf00b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x202}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd100, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x203}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd040, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x204}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf008, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x205}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x206}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x207}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd199, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x208}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x209}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf003, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x20a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd16b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x20b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x20c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x20d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1418, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x20e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x20f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1463, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x210}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x211}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f7a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x212}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd706, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x213}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f2a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x214}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x215}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x087a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x216}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x217}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x646d, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x218}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x37c9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x219}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8231, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x21a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x33a9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x21b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8227, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x21c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x21d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x40c7, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x21e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x21f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x220}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd100, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x221}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd049, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x222}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf01a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x223}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x224}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd049, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x225}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf017, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x226}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x227}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x40c7, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x228}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x229}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x22a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd100, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x22b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd049, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x22c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf010, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x22d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x22e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x22f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf00d, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x230}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x231}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x40c7, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x232}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x233}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x234}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x235}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x236}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf006, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x237}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x238}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x239}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf003, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x23a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x23b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd048, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x23c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x23d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1418, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x23e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x23f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1463, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x240}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x241}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f7a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x242}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd706, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x243}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f29, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x244}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x245}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x60cf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x246}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x60f1, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x247}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6113, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x248}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6135, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x249}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6157, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x24a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf00b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x24b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x24c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf00a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x24d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x24e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf008, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x24f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x250}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf006, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x251}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x252}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf004, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x253}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x254}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf002, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x255}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x256}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x257}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x142d, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x258}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x259}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x25a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8bc0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x25b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c3f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x25c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c09, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x25d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x25e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa120, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x25f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa310, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x260}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa420, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x261}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xcd3b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x262}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x263}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x65ad, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x264}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x43c7, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x265}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x266}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x37c9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x267}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x827b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x268}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x33a9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x269}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8273, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x26a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x26b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x26c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd199, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x26d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x26e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf024, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x26f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd15d, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x270}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x271}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf021, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x272}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x273}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x274}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd1c6, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x275}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x276}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf01c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x277}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd15d, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x278}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x279}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf019, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x27a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x27b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x27c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd199, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x27d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x27e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf014, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x27f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x280}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x281}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf011, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x282}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x283}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x37c9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x284}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x828e, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x285}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x33a9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x286}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x828b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x287}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd1e5, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x288}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x289}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf009, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x28a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd191, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x28b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04d, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x28c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf006, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x28d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x28e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04d, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x28f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf003, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x290}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd16b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x291}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x292}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x293}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1418, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x294}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x295}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1463, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x296}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x297}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f7a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x298}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd706, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x299}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f2c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x29a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x29b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x40e7, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x29c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x29d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x29e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c0f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x29f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0b05, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2a0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2a1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf006, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2a2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2a3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2a4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c0f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2a5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0b0a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2a6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2a7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xcd3c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2a8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2a9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x644d, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2aa}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x43c7, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2ab}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2ac}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x37c9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2ad}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x82c1, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2ae}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x33a9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2af}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x82b9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2b0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2b1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2b2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2b3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2b4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf019, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2b5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2b6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd048, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2b7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf016, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2b8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2b9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2ba}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2bb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2bc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf011, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2bd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd13e, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2be}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd049, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2bf}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf00e, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2c0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2c1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2c2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2c3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2c4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf009, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2c5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2c6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd049, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2c7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf006, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2c8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2c9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2ca}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf003, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2cb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2cc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd048, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2cd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2ce}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0956, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2cf}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2d0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x2969, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2d1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x82f5, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2d2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x37c9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2d3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x82eb, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2d4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x33a9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2d5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x82e1, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2d6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2d7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x40c7, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2d8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2d9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2da}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd15c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2db}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2dc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf01a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2dd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd199, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2de}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2df}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf017, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2e0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2e1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x40c7, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2e2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2e3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2e4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd13e, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2e5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2e6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf010, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2e7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd199, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2e8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2e9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf00d, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2ea}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2eb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x40c7, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2ec}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2ed}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2ee}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2ef}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2f0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf006, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2f1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd199, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2f2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2f3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf003, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2f4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2f5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2f6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2f7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x09a0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2f8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2f9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x2969, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2fa}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x831e, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2fb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x37c9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2fc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8314, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2fd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x33a9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2fe}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x830a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2ff}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x300}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x40c7, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x301}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x302}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x303}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd15d, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x304}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x305}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf01a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x306}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x307}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x308}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf017, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x309}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x30a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x40c7, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x30b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x30c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x30d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd16b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x30e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x30f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf010, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x310}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x311}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x312}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf00d, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x313}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x314}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x40c7, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x315}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x316}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x317}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x318}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x319}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf006, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x31a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x31b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x31c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf003, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x31d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd1b7, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x31e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x31f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x320}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0a39, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x321}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA10E, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xffff, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA10C, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xffff, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA10A, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xffff, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA108, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0a12, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA106, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0979, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA104, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x089f, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA102, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0692, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA100, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0f60, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA110, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x001f, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA016, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0020, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA012, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1ff8, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA014, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0b0e, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ff8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0b0e, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ff9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0b0e, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ffa}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ffb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ffc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ffd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ffe}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1fff}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA164, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0baa, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA166, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c19, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA168, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1293, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA16A, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3fff, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA16C, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3fff, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA16E, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3fff, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA170, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3fff, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA172, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3fff, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA162, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0007, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb820, 7 , 7 , 0x0 , RTK_PATCH_CMP_WS , 0, 0, 0, 0}, +}; + +rtk_hwpatch_t rtl8261n_c_algxg_conf[] = { + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8165, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x22 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8167, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x33 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x827E, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x68 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8013, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x39 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8ffb, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x14 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8ffa, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x1e , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8ff9, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x1e , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x82D9, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x20 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x82DA, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x00 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x816E, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0xab , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8159, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x58 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x815A, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x99 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8139, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x25 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8125, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x67 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8126, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x89 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x827D, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x42 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, +}; + +rtk_hwpatch_t rtl8261n_c_alg_giga_conf[] = { + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x8367, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 8 , 0x5d , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, +}; + +rtk_hwpatch_t rtl8261n_c_normal_conf[] = { + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x817d, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 8 , 0x07 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb516, 6 , 0 , 0x0 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8ffe, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x04 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8fff, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x05 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8132, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x77 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8134, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x88 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x80ca, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x77 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x80cc, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x88 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8062, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x77 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8064, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x88 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x801E, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0005, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, +}; + +rtk_hwpatch_t rtl8261n_c_dataram_conf[] = { + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb820, 7 , 7 , 0x0 , RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb896, 0 , 0 , 0x0 , RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb892, 15, 8 , 0x0 , RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC10B, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0xD5 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC10C, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0xD5 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC10D, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0xD5 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC10E, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0xD5 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC10F, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0xD5 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC110, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0xD5 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC149, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0x08 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC14A, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0x08 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC14B, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0x08 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC14C, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0x08 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC14D, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0x08 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC14E, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0x08 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC166, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0xEE , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC167, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0xEE , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC168, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0x07 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC169, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0x09 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC16A, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0x0B , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC16B, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0x0D , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC16C, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0x13 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC16D, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0x0E , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC16E, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0x11 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC16F, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0x14 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC170, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0x17 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC171, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0x15 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC172, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0x10 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC173, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0x0B , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC128, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0xF7 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC129, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0xF7 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC12A, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0xF8 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC12B, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0xF7 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC12C, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0xF6 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC12D, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0xF5 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC12E, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0xF2 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC12F, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0xF7 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC130, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0xF5 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC131, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0xF2 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC132, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0xF0 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC133, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0xF1 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC134, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0xF4 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC135, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0xF7 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb896, 0 , 0 , 0x1 , RTK_PATCH_CMP_W , 0, 0, 0, 0}, +}; + +rtk_hwpatch_t rtl8261n_c_rtct_conf[] = { +}; + diff --git a/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/construct/conf_rtl8264b.c b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/construct/conf_rtl8264b.c new file mode 100644 index 00000000000000..d5cae3fd3bac03 --- /dev/null +++ b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/construct/conf_rtl8264b.c @@ -0,0 +1,2177 @@ +/* + * SPDX-License-Identifier: GPL-2.0-only + * + * Copyright (c) 2023 Realtek Semiconductor Corp. All rights reserved. + */ + +//Date: Thu Dec 15 16:01:01 2022 + +rtk_hwpatch_t rtl8264b_top_conf[] = { + {RTK_PATCH_OP_TOP , 0xf , 2 , 20 , 15, 0 , 0x5 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 2 , 21 , 15, 0 , 0x0 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 2 , 22 , 15, 0 , 0x280 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 2 , 23 , 15, 0 , 0x0014, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 3 , 16 , 15, 0 , 0x0300, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 3 , 17 , 15, 0 , 0x01ff, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 3 , 18 , 15, 0 , 0x000c, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 3 , 19 , 15, 0 , 0x01ff, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 3 , 20 , 15, 0 , 0x0200, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 3 , 21 , 15, 0 , 0x0015, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 3 , 22 , 15, 0 , 0x0200, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 3 , 23 , 15, 0 , 0x0 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 4 , 16 , 15, 0 , 0x0 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 13 , 23 , 8 , 5 , 0x6 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 90 , 18 , 15, 0 , 0xc , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 90 , 19 , 15, 0 , 0xc , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 90 , 20 , 15, 8 , 0x01 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, +}; + +rtk_hwpatch_t rtl8264b_sds_conf[] = { + {RTK_PATCH_OP_TOP , 0xf , 24 , 18 , 15, 0 , 0x881F, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 24 , 19 , 15, 0 , 0x003F, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 24 , 20 , 15, 0 , 0x003F, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 24 , 21 , 15, 0 , 0x003F, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 24 , 22 , 15, 0 , 0x001F, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x06 , 0x0D , 15, 0 , 0x0F00, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x06 , 0x0E , 15, 0 , 0x3F5A, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x07 , 0x10 , 15, 12, 0x8 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x07 , 0x10 , 7 , 0 , 0x3 , RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x06 , 0x1D , 15, 0 , 0x0600, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x21 , 0x00 , 15, 0 , 0x4902, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x21 , 0x08 , 15, 0 , 0x0FC0, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x21 , 0x09 , 15, 0 , 0x33F0, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x21 , 0x0C , 15, 0 , 0x08BF, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x21 , 0x12 , 15, 0 , 0x8000, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x36 , 0x07 , 15, 0 , 0x04C0, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x36 , 0x08 , 15, 0 , 0x2000, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2E , 0x0B , 15, 0 , 0x2390, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2E , 0x0C , 15, 0 , 0xAA17, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2E , 0x0D , 15, 0 , 0xFE40, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2E , 0x0E , 15, 0 , 0x12F4, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2E , 0x11 , 15, 0 , 0xF2AD, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2E , 0x15 , 15, 0 , 0x7A41, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2E , 0x16 , 15, 0 , 0x0041, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2F , 0x00 , 15, 0 , 0x1F00, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2F , 0x01 , 15, 0 , 0x2800, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2F , 0x02 , 15, 0 , 0x0FC8, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2F , 0x11 , 15, 0 , 0x3000, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2F , 0x13 , 15, 0 , 0xF400, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2F , 0x1E , 15, 0 , 0x0500, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x34 , 0x0B , 15, 0 , 0x2390, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x34 , 0x0C , 15, 0 , 0xA517, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x34 , 0x0D , 15, 0 , 0xFE41, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x34 , 0x0E , 15, 0 , 0x12F4, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x34 , 0x11 , 15, 0 , 0xF2AD, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x34 , 0x15 , 15, 0 , 0x7A41, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x34 , 0x16 , 15, 0 , 0x0041, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x35 , 0x00 , 15, 0 , 0x1F80, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x35 , 0x01 , 15, 0 , 0x0800, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x35 , 0x02 , 15, 0 , 0x0FC8, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x35 , 0x11 , 15, 0 , 0x3001, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x35 , 0x13 , 15, 0 , 0xF400, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x35 , 0x1E , 15, 0 , 0x0100, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2C , 0x0B , 15, 0 , 0x2390, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2C , 0x0C , 15, 0 , 0xA517, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2C , 0x0D , 15, 0 , 0xFE41, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2C , 0x0E , 15, 0 , 0x12F4, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2C , 0x11 , 15, 0 , 0xF2AD, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2C , 0x15 , 15, 0 , 0x7A61, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2C , 0x16 , 15, 0 , 0x0041, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2D , 0x00 , 15, 0 , 0x1F80, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2D , 0x01 , 15, 0 , 0x0800, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2D , 0x02 , 15, 0 , 0x0FC8, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2D , 0x11 , 15, 0 , 0x3001, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2D , 0x13 , 15, 0 , 0xF400, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x2D , 0x1E , 15, 0 , 0x0100, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x28 , 0x0B , 15, 0 , 0x2390, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x28 , 0x0C , 15, 0 , 0xA514, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x28 , 0x0D , 15, 0 , 0xFE43, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x28 , 0x0E , 15, 0 , 0x12F4, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x28 , 0x11 , 15, 0 , 0xF2AD, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x28 , 0x15 , 15, 0 , 0x7A61, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x28 , 0x16 , 15, 0 , 0x0041, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x29 , 0x00 , 15, 0 , 0x1F80, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x29 , 0x01 , 15, 0 , 0x0800, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x29 , 0x02 , 15, 0 , 0x0FC8, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x29 , 0x11 , 15, 0 , 0x3001, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x29 , 0x13 , 15, 0 , 0xF400, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x29 , 0x1E , 15, 0 , 0x0100, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x26 , 0x0B , 15, 0 , 0x2390, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x26 , 0x0C , 15, 0 , 0xA514, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x26 , 0x0D , 15, 0 , 0xFE43, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x26 , 0x0E , 15, 0 , 0x12F4, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x26 , 0x11 , 15, 0 , 0xF2AD, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x26 , 0x15 , 15, 0 , 0x7A41, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x26 , 0x16 , 15, 0 , 0x0041, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x27 , 0x00 , 15, 0 , 0x1F80, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x27 , 0x01 , 15, 0 , 0x0800, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x27 , 0x02 , 15, 0 , 0x0FC8, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x27 , 0x11 , 15, 0 , 0x3001, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x27 , 0x13 , 15, 0 , 0xF400, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x27 , 0x1E , 15, 0 , 0x0100, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x24 , 0x0B , 15, 0 , 0x2390, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x24 , 0x0C , 15, 0 , 0xA514, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x24 , 0x0D , 15, 0 , 0xFE43, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x24 , 0x0E , 15, 0 , 0x12F4, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x24 , 0x11 , 15, 0 , 0xF2AD, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x24 , 0x15 , 15, 0 , 0x7A41, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x24 , 0x16 , 15, 0 , 0x0041, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x25 , 0x00 , 15, 0 , 0x1F80, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x25 , 0x01 , 15, 0 , 0x0800, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x25 , 0x02 , 15, 0 , 0x0FC8, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x25 , 0x11 , 15, 0 , 0x3001, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x25 , 0x13 , 15, 0 , 0xF400, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x25 , 0x1E , 15, 0 , 0x0100, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 24 , 18 , 15, 0 , 0x880D, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 24 , 19 , 15, 0 , 0x0024, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 24 , 20 , 15, 0 , 0x0036, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 24 , 21 , 15, 0 , 0x0035, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 24 , 22 , 15, 0 , 0x001A, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x1F , 0x00 , 15, 0 , 0x001B, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xf , 0x1F , 0x00 , 15, 0 , 0x0000, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 90 , 20 , 7 , 0 , 0x03 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, +}; + +rtk_hwpatch_t rtl8264b_afe_conf[] = { + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xbf92, 15, 11, 0x1C , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xbfaa, 10, 8 , 0x5 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xbfae, 8 , 6 , 0x5 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xbfaa, 12, 11, 0x1 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xbf1c, 4 , 4 , 0x1 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xbf0e, 5 , 4 , 0x3 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xbf1c, 15, 13, 0x5 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xbf16, 12, 12, 0x0 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xbc24, 3 , 2 , 0x1 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xbc24, 1 , 0 , 0x1 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xbf08, 2 , 0 , 0x6 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xbf0c, 5 , 3 , 0x7 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xbf0c, 8 , 6 , 0x7 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xbf0c, 11, 9 , 0x7 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xbf0c, 14, 12, 0x7 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_TOP , 0xf , 90 , 21 , 15, 8 , 0x03 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, +}; + +rtk_hwpatch_t rtl8264b_uc_conf[] = { + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb820, 7 , 7 , 0x0 , RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xbd8a, 5 , 3 , 0x3 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xbd8c, 6 , 4 , 0x5 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x8060, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 12, 10, 0x3 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x8061, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 13, 0x5 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa466, 1 , 1 , 0x1 , RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x8491, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 8 , 0x1D , RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x8018, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 12, 12, 0x1 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x85af, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xaf85, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85af}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xc7af, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85b1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x85df, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85b3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xaf86, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85b5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1baf, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85b7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8674, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85b9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xaf86, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85bb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x7daf, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85bd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x875b, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85bf}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xaf87, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85c1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x67af, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85c3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8774, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85c5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf85, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85c7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xdc02, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85c9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6957, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85cb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xe48f, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85cd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x2ce5, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85cf}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8f2d, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85d1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xe084, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85d3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x11e1, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85d5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8412, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85d7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xaf5d, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85d9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x73f6, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85db}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xb01a, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85dd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xe08f, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85df}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x2ce1, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85e1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8f2d, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85e3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6d, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85e5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6802, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85e7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6938, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85e9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6d, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85eb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6b02, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85ed}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6938, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85ef}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6d, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85f1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6e02, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85f3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6938, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85f5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6d, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85f7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x7102, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85f9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6938, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85fb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6d, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85fd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x7402, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x85ff}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x70e5, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8601}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6d, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8603}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x7702, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8605}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x70e5, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8607}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6d, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8609}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x7a02, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x860b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x70e5, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x860d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6d, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x860f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x7d02, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8611}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x70e5, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8613}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd784, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8615}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa2af, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8617}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5eed, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8619}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0286, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x861b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x21af, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x861d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x07ad, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x861f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf8f9, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8621}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xfaef, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8623}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x69e0, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8625}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8018, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8627}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xad24, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8629}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x39d4, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x862b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x002e, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x862d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6e, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x862f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0402, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8631}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6938, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8633}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd480, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8635}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x03bf, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8637}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x866e, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8639}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0269, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x863b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x38d4, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x863d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x000f, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x863f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf86, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8641}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x7102, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8643}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6938, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8645}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf86, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8647}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x7102, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8649}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x70dc, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x864b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd480, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x864d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0bbf, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x864f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x866e, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8651}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0269, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8653}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x38d4, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8655}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x000f, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8657}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf86, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8659}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x7102, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x865b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6938, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x865d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf86, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x865f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x7102, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8661}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x70dc, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8663}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0208, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8665}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1eef, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8667}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x96fe, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8669}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xfdfc, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x866b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x04f0, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x866d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbd94, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x866f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x30bd, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8671}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9602, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8673}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8621, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8675}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0254, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8677}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xdcaf, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8679}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x03c1, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x867b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0286, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x867d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x2102, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x867f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8686, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8681}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xaf04, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8683}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x41f8, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8685}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xfbef, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8687}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x79e0, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8689}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8018, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x868b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xac20, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x868d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x03af, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x868f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8756, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8691}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6b, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8693}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3402, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8695}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x70dc, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8697}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6b, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8699}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3102, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x869b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x70e5, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x869d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6f, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x869f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4902, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86a1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x70dc, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86a3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6f, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86a5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4c02, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86a7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x70e5, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86a9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6f, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86ab}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4f02, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86ad}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x70e5, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86af}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6b, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86b1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3702, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86b3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x70dc, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86b5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6c, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86b7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c02, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86b9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x70dc, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86bb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6b, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86bd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3402, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86bf}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x70e5, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86c1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1f00, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86c3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xe183, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86c5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd4bf, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86c7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6bcd, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86c9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0269, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86cb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x38bf, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86cd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6bd0, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86cf}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0269, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86d1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x38bf, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86d3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6bd3, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86d5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0269, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86d7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x38bf, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86d9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6bd6, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86db}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0269, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86dd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x38bf, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86df}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6bd9, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86e1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0270, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86e3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xe5bf, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86e5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6bdc, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86e7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0270, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86e9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xe5bf, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86eb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6bdf, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86ed}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0270, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86ef}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xe5bf, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86f1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6be2, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86f3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0270, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86f5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xe5bf, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86f7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6f46, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86f9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0270, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86fb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xdce1, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86fd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x83d3, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x86ff}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6f, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8701}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3a02, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8703}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6938, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8705}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0d14, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8707}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6f, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8709}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4002, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x870b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6938, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x870d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0d12, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x870f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6f, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8711}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3d02, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8713}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6938, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8715}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6f, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8717}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4302, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8719}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x70dc, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x871b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0238, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x871d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xb5bf, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x871f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6bd9, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8721}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0270, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8723}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xdcbf, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8725}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6bdc, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8727}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0270, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8729}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xdcbf, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x872b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6bdf, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x872d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0270, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x872f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xdcbf, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8731}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6be2, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8733}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0270, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8735}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xdcbf, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8737}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6b34, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8739}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0270, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x873b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xdcbf, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x873d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6b37, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x873f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0270, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8741}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xe5bf, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8743}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6f4f, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8745}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0270, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8747}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xdcbf, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8749}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6b31, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x874b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0270, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x874d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xdcbf, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x874f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6f4c, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8751}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0270, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8753}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xdcef, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8755}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x97ff, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8757}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xfc04, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8759}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xac2f, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x875b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x03af, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x875d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0b2a, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x875f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x020e, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8761}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x95af, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8763}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0b3f, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8765}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xee84, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8767}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3c00, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8769}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6c, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x876b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c02, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x876d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x70e5, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x876f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xaf01, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8771}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0300, RTK_PATCH_CMP_SWC , 0, 0xa438, 0xa436, 0x8773}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xb818, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5d6d, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xb81a, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5eea, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xb81c, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x07aa, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xb81e, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x03be, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xb850, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x043e, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xb852, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0b26, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xb878, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x00fd, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xb884, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xffff, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xb832, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x007f, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, +}; + +rtk_hwpatch_t rtl8264b_uc2_conf[] = { + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb820, 7 , 7 , 0x1 , RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xb87c, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8acf, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xb87e, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xaf8a, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8acf}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xe7af, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ad1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8b40, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ad3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xaf8b, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ad5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4caf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ad7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8b6a, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ad9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xaf8b, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8adb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xb5af, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8add}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8bd1, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8adf}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xaf8c, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ae1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x04af, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ae3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8c12, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ae5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf67, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ae7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6302, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ae9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x65f5, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8aeb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xef31, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8aed}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf67, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8aef}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6002, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8af1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x65f5, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8af3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1e31, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8af5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xac38, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8af7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x19bf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8af9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x676c, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8afb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0265, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8afd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf5ef, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8aff}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x31bf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b01}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6769, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b03}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0265, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b05}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf51e, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b07}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x31ac, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b09}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x380c, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b0b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xee89, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b0d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x2c02, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b0f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xae0a, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b11}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xee89, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b13}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x2c00, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b15}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xae04, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b17}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xee89, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b19}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x2c01, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b1b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf8f, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b1d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd5e1, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b1f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x892c, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b21}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1a91, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b23}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xdbbf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b25}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x67cf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b27}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0265, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b29}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf51f, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b2b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x001f, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b2d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x221b, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b2f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x45ad, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b31}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x2705, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b33}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xe187, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b35}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x06ae, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b37}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x03e1, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b39}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8707, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b3b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xaf2d, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b3d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1a02, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b3f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8c1e, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b41}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x028c, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b43}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x7b02, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b45}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x224f, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b47}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xaf40, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b49}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xb8ac, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b4b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x2f0f, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b4d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0210, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b4f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x62bf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b51}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6d36, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b53}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0265, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b55}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf5e5, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b57}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8fde, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b59}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xaf10, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b5b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4ae1, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b5d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8fde, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b5f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6d, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b61}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3602, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b63}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x65d6, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b65}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xaf10, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b67}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x59e1, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b69}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8fdd, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b6b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa100, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b6d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0dbf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b6f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6d36, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b71}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0265, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b73}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf5e5, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b75}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8fdc, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b77}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xee8f, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b79}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xdd01, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b7b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6d, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b7d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3602, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b7f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6f77, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b81}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf86, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b83}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xc7e1, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b85}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x892c, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b87}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4903, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b89}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1a91, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b8b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xef69, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b8d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xdbbf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b8f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x67cf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b91}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0265, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b93}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf51f, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b95}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x001f, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b97}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x22ef, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b99}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x741b, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b9b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x45ad, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b9d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x2711, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8b9f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf86, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ba1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd0d0, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ba3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x00e1, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ba5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8fdc, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ba7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6d, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ba9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3602, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bab}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x65d6, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bad}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xaf35, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8baf}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x46af, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bb1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3527, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bb3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x026f, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bb5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6eee, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bb7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8fdd, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bb9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x00bf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bbb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8d31, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bbd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x026f, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bbf}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6ebf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bc1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8d40, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bc3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x026f, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bc5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6ebf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bc7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8d46, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bc9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x026f, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bcb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6eaf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bcd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x36a9, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bcf}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf8ef, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bd1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x49f8, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bd3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6e, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bd5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xc202, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bd7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x65f5, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bd9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xad28, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bdb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13e1, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bdd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8a4e, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bdf}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xad28, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8be1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0502, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8be3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5d65, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8be5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xae0e, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8be7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x025c, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8be9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1202, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8beb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8cc5, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bed}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xae06, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bef}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x025b, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bf1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf302, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bf3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8d0d, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bf5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xe087, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bf7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x17f6, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bf9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x27e4, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bfb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8717, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bfd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xfcef, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8bff}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x94fc, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c01}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x04a1, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c03}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0103, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c05}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x028c, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c07}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xe9e0, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c09}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8a02, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c0b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xef23, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c0d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xaf5c, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c0f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xdeac, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c11}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5003, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c13}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xaf61, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c15}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0d02, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c17}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8d0d, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c19}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xaf61, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c1b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x33f8, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c1d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xfafb, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c1f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xef79, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c21}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xfbbf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c23}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6766, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c25}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0265, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c27}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf5ad, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c29}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x2810, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c2b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xad30, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c2d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x05d7, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c2f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0002, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c31}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xae16, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c33}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xad32, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c35}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x24d7, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c37}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0003, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c39}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xae0e, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c3b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xad31, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c3d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x05d7, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c3f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0000, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c41}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xae06, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c43}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xad33, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c45}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x14d7, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c47}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0001, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c49}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf8f, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c4b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xdf4f, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c4d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0008, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c4f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1a97, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c51}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd78c, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c53}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x63d6, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c55}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8c7b, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c57}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0265, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c59}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3bff, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c5b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xef97, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c5d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xfffe, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c5f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xfc04, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c61}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x206b, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c63}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0e20, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c65}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6b11, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c67}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x206b, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c69}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1420, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c6b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6b17, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c6d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x206b, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c6f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x2020, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c71}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6b23, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c73}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x206b, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c75}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x2600, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c77}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6b29, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c79}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf8fa, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c7b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xef69, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c7d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6d, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c7f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbd02, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c81}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x65f5, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c83}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xad28, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c85}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0ebf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c87}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8d34, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c89}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x026f, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c8b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x77bf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c8d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8d31, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c8f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x026f, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c91}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x77ae, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c93}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x2ad1, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c95}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0fbf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c97}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8d37, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c99}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0265, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c9b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd6bf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c9d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8d3a, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8c9f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x026f, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ca1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6ed1, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ca3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x00bf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ca5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8d3d, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ca7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0265, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ca9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd6bf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8cab}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8d40, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8cad}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x026f, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8caf}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x77d1, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8cb1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x00bf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8cb3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8d43, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8cb5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0265, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8cb7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd6bf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8cb9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8d46, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8cbb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x026f, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8cbd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x77ef, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8cbf}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x96fe, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8cc1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xfc04, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8cc3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf8ef, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8cc5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x49f8, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8cc7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6d, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8cc9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbd02, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ccb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x65f5, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ccd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xac28, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ccf}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x12bf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8cd1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6be6, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8cd3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0265, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8cd5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf5e5, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8cd7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8fd8, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8cd9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6b, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8cdb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf202, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8cdd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x65f5, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8cdf}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xe58f, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ce1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd9fc, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ce3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xef94, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ce5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xfc04, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ce7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf8ef, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ce9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x49f8, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ceb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6d, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8ced}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbd02, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8cef}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x65f5, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8cf1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xac28, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8cf3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x12e1, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8cf5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8fda, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8cf7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6b, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8cf9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xe602, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8cfb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x65d6, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8cfd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xe18f, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8cff}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xdbbf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d01}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6bf2, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d03}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0265, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d05}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd6fc, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d07}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xef94, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d09}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xfc04, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d0b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf8ef, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d0d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x49f8, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d0f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6d, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d11}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbd02, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d13}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x65f5, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d15}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xac28, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d17}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x12e1, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d19}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8fd8, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d1b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf6b, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d1d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xe602, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d1f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x65d6, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d21}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xe18f, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d23}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd9bf, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d25}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6bf2, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d27}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0265, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d29}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd6fc, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d2b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xef94, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d2d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xfc04, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d2f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x77bd, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d31}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6c66, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d33}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbd6c, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d35}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x30bd, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d37}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5444, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d39}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbd54, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d3b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x85bd, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d3d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5e55, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d3f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbd54, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d41}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa7bd, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d43}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5cbb, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d45}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbd5c, RTK_PATCH_CMP_SWC , 0, 0xb87e, 0xb87c, 0x8d47}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xb85e, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x2d07, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xb860, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x40b5, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xb862, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1047, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xb864, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3504, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xb886, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x36A6, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xb888, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x613d, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xb88a, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5cd9, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xb88c, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x610a, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xb838, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x00ff, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb820, 7 , 7 , 0x0 , RTK_PATCH_CMP_WS , 0, 0, 0, 0}, +}; + +rtk_hwpatch_t rtl8264b_nctl0_conf[] = { + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb820, 7 , 7 , 0x1 , RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA016, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0000, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA012, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0000, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA014, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8010, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8015, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8020, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x802a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8030, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xa}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8035, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8046, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xe}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x806b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xf}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd707, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x10}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x606f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x11}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x12}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x801a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x13}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x14}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd707, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x15}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x606f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x16}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x17}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x801a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x18}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x19}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce10, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xcf01, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd705, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4004, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xcf02, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd719, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x20}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3bb7, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x21}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8024, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x22}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf003, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x23}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd704, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x24}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x406e, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x25}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x26}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x12bd, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x27}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x28}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x12e3, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x29}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xab80, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd500, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xc402, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x004a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x30}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8b80, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x31}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd500, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x32}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x33}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0108, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x34}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c0f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x35}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x090f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x36}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c0f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x37}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0a03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x38}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd004, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x39}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd1c1, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x3a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x3b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x401c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x3c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce00, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x3d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd500, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x3e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x3f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x801a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x40}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd501, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x41}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce01, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x42}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x43}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x44}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0aa9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x45}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd500, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x46}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd706, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x47}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x2a69, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x48}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8056, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x49}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3f48, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x4a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8058, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x4b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3f4b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x4c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x805a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x4d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x618c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x4e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3f40, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x4f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x805c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x50}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3f43, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x51}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x805e, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x52}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x616b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x53}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6187, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x54}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf00c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x55}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xcc8f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x56}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf00a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x57}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xcc8d, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x58}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf008, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x59}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xcc8b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x5a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf006, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x5b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xcc89, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x5c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf004, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x5d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xcc87, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x5e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf002, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x5f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xcc91, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x60}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x61}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0b9a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x62}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x63}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xca80, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x64}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x65}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0ba0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x66}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xca00, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x67}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd504, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x68}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x69}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1658, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x6a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa208, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x6b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x6c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0a88, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x6d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x6e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0d91, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x6f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA026, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0d90, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA024, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1657, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA022, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0aa1, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA020, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0047, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA006, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0049, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA004, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x12b9, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA002, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0be5, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA000, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1811, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA008, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xff00, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA016, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0000, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA012, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0ff8, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA014, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xc483, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x0ff8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xc483, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xff9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xffa}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xffb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xffc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xffd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xffe}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xfff}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA152, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1a83, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA154, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1d29, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA156, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3fff, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA158, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3fff, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA15A, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3fff, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA15C, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3fff, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA15E, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3fff, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA160, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3fff, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA150, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0003, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb820, 7 , 7 , 0x0 , RTK_PATCH_CMP_WS , 0, 0, 0, 0}, +}; + +rtk_hwpatch_t rtl8264b_nctl1_conf[] = { +}; + +rtk_hwpatch_t rtl8264b_nctl2_conf[] = { + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb820, 7 , 7 , 0x1 , RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA016, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0020, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA012, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0000, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA014, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8010, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8022, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8029, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8085, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x808c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xa}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8093, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8281, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xe}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x829a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xf}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x10}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x11}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8370, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x12}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x13}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd707, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x14}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x416f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x15}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x16}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd05a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x17}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa501, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x18}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x19}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13cf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd701, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5fbd, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8501, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0427, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x20}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x040b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x21}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8501, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x22}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd707, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x23}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x406f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x24}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x25}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x01d8, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x26}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x27}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x01cb, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x28}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd705, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x29}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3fa7, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8030, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd75f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x699c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1340, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd704, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x30}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4066, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x31}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x800a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x32}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf002, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x33}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa00a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x34}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd705, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x35}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x61b4, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x36}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd704, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x37}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x609f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x38}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6150, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x39}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x2d71, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x3a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8043, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x3b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x3c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x3d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0cf0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x3e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x05a0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x3f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x40}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x41}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13b1, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x42}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x43}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x44}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8220, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x45}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c30, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x46}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0410, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x47}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x48}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x800a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x49}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x81a0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x4a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8302, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x4b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8480, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x4c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8684, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x4d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x4e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x4f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8203, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x50}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8340, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x51}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x52}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xaa10, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x53}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8b07, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x54}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x55}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x60cf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x56}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x60f1, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x57}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6113, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x58}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6135, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x59}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6157, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x5a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf00b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x5b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce0b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x5c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf00a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x5d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce0b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x5e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf008, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x5f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce0a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x60}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf006, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x61}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce0a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x62}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf004, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x63}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce09, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x64}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf002, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x65}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce09, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x66}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x67}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x68}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa204, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x69}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x6a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x6b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13e4, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x6c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xab08, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x6d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xcda0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x6e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd705, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x6f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x40de, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x70}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd162, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x71}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd045, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x72}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbf10, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x73}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x74}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13b1, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x75}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9f10, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x76}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x77}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13b1, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x78}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x79}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x607a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x7a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x7b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13b1, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x7c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9f10, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x7d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x7e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x7f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8210, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x80}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa210, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x81}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x82}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x83}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1340, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x84}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x85}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x86}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8df8, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x87}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8370, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x88}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x89}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x8a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x01c1, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x8b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x8c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x8d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8df8, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x8e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8370, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x8f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x90}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x91}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x009e, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x92}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x93}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x37c9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x94}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x809e, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x95}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x33a9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x96}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x809b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x97}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd1bf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x98}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd06d, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x99}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf006, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x9a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd1dd, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x9b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd06d, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x9c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf003, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x9d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd199, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x9e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd06e, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x9f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xa0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13cf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xa1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xa2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5fba, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xa3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xa4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd05a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xa5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xa6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x60cf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xa7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x60f1, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xa8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6113, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xa9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6135, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xaa}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6157, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xab}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf00b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xac}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xad}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf00a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xae}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xaf}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf008, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xb0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xb1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf006, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xb2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xb3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf004, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xb4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xb5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf002, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xb6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xb7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xb8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13e4, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xb9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xba}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xbb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0ccf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xbc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0b40, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xbd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c3f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xbe}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c24, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xbf}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xc0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa340, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xc1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xc2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1433, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xc3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa110, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xc4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xc5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13ec, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xc6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8110, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xc7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xc8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x143c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xc9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa304, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xca}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa8c0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xcb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8810, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xcc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa00a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xcd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa120, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xce}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa310, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xcf}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0cfc, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xd0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0224, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xd1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0ca0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xd2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0480, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xd3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xd4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xd5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa340, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xd6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xd7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd162, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xd8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd048, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xd9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xda}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13cf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xdb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xdc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5fba, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xdd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8840, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xde}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd1c4, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xdf}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd045, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xe0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xe1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13cf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xe2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xe3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5fba, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xe4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd706, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xe5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6127, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xe6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xe7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f3b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xe8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x88c0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xe9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x800a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xea}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8120, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xeb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8350, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xec}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x84a0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xed}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xffb6, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xee}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xb920, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xef}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xcd33, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xf0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xf1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13cf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xf2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd71f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xf3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x7fb4, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xf4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9920, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xf5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xf6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13cf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xf7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd71f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xf8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6065, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xf9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f94, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xfa}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xffee, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xfb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xb820, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xfc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xfd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13cf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xfe}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd71f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0xff}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x7fa5, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x100}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9820, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x101}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x800a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x102}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8120, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x103}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x104}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1433, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x105}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa108, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x106}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x107}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13ec, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x108}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8108, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x109}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x10a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x143c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x10b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa2fc, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x10c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa304, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x10d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8880, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x10e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0cc0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x10f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0440, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x110}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xcd34, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x111}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x112}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x113}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0cc0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x114}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0b80, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x115}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xac3f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x116}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c38, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x117}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0d08, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x118}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x119}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa810, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x11a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa00a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x11b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa120, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x11c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa480, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x11d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa604, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x11e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x11f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x37c9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x120}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8125, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x121}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x122}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd049, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x123}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf003, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x124}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd19f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x125}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd049, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x126}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x127}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13cf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x128}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd71f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x129}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x63f4, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x12a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x12b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f7a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x12c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd706, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x12d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4368, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x12e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x12f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x130}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0cc0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x131}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0b40, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x132}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8c3f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x133}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8d38, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x134}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x135}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x136}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x37c9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x137}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8141, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x138}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x33a9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x139}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x813e, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x13a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd1f4, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x13b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x13c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf006, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x13d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd1b7, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x13e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x13f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf003, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x140}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd1c6, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x141}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x142}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x143}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13cf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x144}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd71f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x145}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6074, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x146}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x147}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f7a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x148}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x149}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13cf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x14a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd71f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x14b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4056, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x14c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf004, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x14d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x14e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x61fc, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x14f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xfff9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x150}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd706, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x151}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6048, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x152}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf00b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x153}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x154}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4070, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x155}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x156}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x820e, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x157}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x158}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x159}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xae80, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x15a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x15b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x15c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x820e, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x15d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x15e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd05a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x15f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x160}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x60cf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x161}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x60f1, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x162}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6113, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x163}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6135, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x164}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6157, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x165}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf00b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x166}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x167}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf00a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x168}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x169}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf008, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x16a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x16b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf006, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x16c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x16d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf004, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x16e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x16f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf002, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x170}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x171}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x172}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13e4, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x173}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x174}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x175}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0ccf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x176}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0b40, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x177}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c3f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x178}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c24, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x179}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x17a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa340, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x17b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x17c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1433, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x17d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa110, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x17e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x17f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13ec, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x180}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8110, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x181}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x182}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x143c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x183}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa304, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x184}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa8c0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x185}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8810, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x186}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa00a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x187}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa120, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x188}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa310, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x189}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0cfc, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x18a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0224, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x18b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0ca0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x18c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0480, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x18d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8604, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x18e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xcd35, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x18f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd162, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x190}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd048, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x191}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x192}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13cf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x193}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x194}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5fba, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x195}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8840, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x196}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd1c4, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x197}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd045, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x198}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x199}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13cf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x19a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x19b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5fba, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x19c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd706, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x19d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6127, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x19e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x19f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f3b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1a0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x88c0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1a1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x800a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1a2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8120, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1a3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8350, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1a4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x84a0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1a5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xffb8, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1a6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xbb80, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1a7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1a8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13cf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1a9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd71f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1aa}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5fb4, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ab}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xb920, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ac}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xcd36, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ad}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ae}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13cf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1af}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd71f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1b0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x7fb4, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1b1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9920, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1b2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9b80, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1b3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1b4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13cf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1b5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd71f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1b6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6065, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1b7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f94, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1b8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xffe8, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1b9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xb820, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ba}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1bb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13cf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1bc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd71f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1bd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x7fa5, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1be}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9820, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1bf}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x800a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1c0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8120, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1c1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1c2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1433, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1c3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa108, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1c4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1c5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13ec, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1c6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8108, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1c7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1c8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x143c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1c9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa2fc, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ca}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa304, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1cb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8880, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1cc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0cc0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1cd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0440, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ce}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xcd37, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1cf}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1d0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1d1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0cc0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1d2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0b80, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1d3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xac3f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1d4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c38, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1d5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0d08, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1d6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1d7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa810, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1d8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa00a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1d9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa120, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1da}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa480, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1db}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa604, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1dc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1dd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x37c9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1de}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x81e8, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1df}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x33a9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1e0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x81e5, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1e1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1e2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd048, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1e3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf006, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1e4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1e5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd048, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1e6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf003, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1e7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1e8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd048, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1e9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ea}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13cf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1eb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ec}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x141a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ed}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ee}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f7a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ef}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd706, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1f0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f28, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1f1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1f2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1f3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0cc0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1f4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0b40, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1f5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8c3f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1f6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8d38, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1f7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1f8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1f9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x37c9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1fa}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8204, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1fb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x33a9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1fc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8201, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1fd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd199, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1fe}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ff}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf006, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x200}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x201}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x202}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf003, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x203}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd189, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x204}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x205}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x206}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13cf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x207}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x208}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x141a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x209}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x20a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f7a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x20b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd706, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x20c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f28, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x20d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x20e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x20f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c0f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x210}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0b05, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x211}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x212}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x213}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x60cf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x214}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x60f1, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x215}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6113, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x216}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6135, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x217}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6157, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x218}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf00b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x219}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce08, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x21a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf00a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x21b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce08, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x21c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf008, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x21d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce08, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x21e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf006, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x21f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce08, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x220}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf004, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x221}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce08, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x222}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf002, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x223}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce08, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x224}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x225}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13e4, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x226}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa180, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x227}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xcd38, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x228}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x229}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x37c9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x22a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x823e, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x22b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x33a9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x22c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8236, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x22d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x22e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x22f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x230}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x231}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf013, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x232}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd100, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x233}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd049, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x234}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf010, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x235}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x236}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x237}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd1b7, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x238}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd049, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x239}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf00b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x23a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd100, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x23b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd048, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x23c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf008, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x23d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x23e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x23f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x240}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x241}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf003, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x242}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd199, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x243}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x244}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd13b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x245}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd055, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x246}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x247}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13cf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x248}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x249}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x141a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x24a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x24b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f7b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x24c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa302, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x24d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x24e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13cf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x24f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x250}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x141a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x251}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x252}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f7a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x253}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd706, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x254}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f28, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x255}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x256}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x257}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c3f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x258}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c12, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x259}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x25a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x25b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x37c9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x25c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8270, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x25d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x33a9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x25e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8268, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x25f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x260}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x261}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd199, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x262}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x263}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf013, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x264}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd100, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x265}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd048, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x266}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf010, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x267}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x268}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x269}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x26a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x26b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf00b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x26c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd100, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x26d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd040, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x26e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf008, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x26f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x270}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x271}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd199, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x272}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x273}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf003, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x274}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd16b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x275}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x276}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x277}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13cf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x278}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x279}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x141a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x27a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x27b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f7a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x27c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd706, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x27d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f2a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x27e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x27f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x085e, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x280}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x281}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x282}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xcb0a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x283}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0cc7, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x284}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x285}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x286}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x287}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4127, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x288}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x289}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x28a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c0f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x28b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0b05, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x28c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c38, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x28d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0d28, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x28e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x28f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf008, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x290}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x291}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x292}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c0f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x293}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0b0a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x294}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c38, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x295}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0d18, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x296}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x297}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x298}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0f45, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x299}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x29a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x646d, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x29b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x37c9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x29c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x82b4, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x29d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x33a9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x29e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x82aa, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x29f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2a0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x40c7, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2a1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2a2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2a3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd100, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2a4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd049, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2a5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf01a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2a6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2a7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd049, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2a8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf017, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2a9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2aa}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x40c7, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2ab}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2ac}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2ad}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd100, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2ae}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd049, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2af}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf010, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2b0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2b1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2b2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf00d, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2b3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2b4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x40c7, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2b5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2b6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2b7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2b8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2b9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf006, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2ba}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2bb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2bc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf003, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2bd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2be}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd048, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2bf}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2c0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13cf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2c1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2c2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x141a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2c3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2c4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f7a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2c5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd706, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2c6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f29, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2c7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2c8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x60cf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2c9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x60f1, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2ca}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6113, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2cb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6135, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2cc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x6157, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2cd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf00b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2ce}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2cf}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf00a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2d0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2d1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf008, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2d2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2d3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf006, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2d4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2d5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf004, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2d6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2d7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf002, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2d8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xce06, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2d9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2da}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13e4, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2db}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2dc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2dd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8bc0, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2de}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c3f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2df}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c09, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2e0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2e1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa120, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2e2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa310, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2e3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xa420, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2e4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xcd3b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2e5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2e6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x65ad, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2e7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x43c7, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2e8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2e9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x37c9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2ea}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x82fe, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2eb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x33a9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2ec}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x82f6, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2ed}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2ee}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2ef}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd199, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2f0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2f1}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf024, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2f2}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd15d, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2f3}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2f4}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf021, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2f5}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2f6}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2f7}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd1c6, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2f8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2f9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf01c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2fa}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd15d, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2fb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2fc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf019, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2fd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2fe}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x2ff}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd199, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x300}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x301}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf014, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x302}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x303}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x304}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf011, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x305}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x306}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x37c9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x307}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8311, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x308}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x33a9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x309}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x830e, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x30a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd1e5, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x30b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x30c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf009, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x30d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd191, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x30e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04d, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x30f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf006, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x310}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x311}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04d, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x312}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf003, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x313}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd16b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x314}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x315}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x316}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x13cf, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x317}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x318}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x141a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x319}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x31a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f7a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x31b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd706, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x31c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x5f2c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x31d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x31e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x40e7, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x31f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x320}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x321}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c0f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x322}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0b05, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x323}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x324}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf006, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x325}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c03, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x326}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1502, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x327}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0c0f, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x328}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0b0a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x329}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x9503, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x32a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xcd3c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x32b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x32c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x644d, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x32d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x43c7, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x32e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd700, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x32f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x37c9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x330}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x8344, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x331}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x33a9, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x332}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x833c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x333}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x334}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x335}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x336}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x337}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf019, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x338}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x339}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd048, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x33a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf016, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x33b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x33c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x33d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x33e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x33f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf011, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x340}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd13e, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x341}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd049, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x342}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf00e, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x343}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd702, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x344}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x4098, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x345}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x346}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x347}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf009, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x348}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x349}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd049, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x34a}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf006, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x34b}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x34c}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd04b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x34d}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf003, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x34e}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd17a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x34f}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd048, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x350}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1800, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x351}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x093a, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x352}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA10E, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0883, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA10C, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0f32, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA10A, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0676, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA108, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x00fa, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA106, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x021d, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA104, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x12fe, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA102, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x01ca, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA100, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x047f, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA110, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x00ff, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA016, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0020, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA012, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x1ff8, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA014, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd13e, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ff8}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd15c, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ff9}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd16b, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ffa}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xd15d, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ffb}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0b0e, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ffc}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0b0e, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ffd}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0b0e, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1ffe}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0000, RTK_PATCH_CMP_SWC , 0, 0xa014, 0xa012, 0x1fff}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA164, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0972, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA166, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0968, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA168, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0a0b, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA16A, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0a01, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA16C, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0b8a, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA16E, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0bf9, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA170, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x125c, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA172, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x3fff, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0xA162, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x007F, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb820, 7 , 7 , 0x0 , RTK_PATCH_CMP_WS , 0, 0, 0, 0}, +}; + +rtk_hwpatch_t rtl8264b_algxg_conf[] = { + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x815B, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x75 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x80CD, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x25 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8065, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x15 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8175, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0xa2 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8176, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0xc5 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8077, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x40 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8078, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0xcc , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8969, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x0f , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8957, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x2C , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8959, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x15 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x895A, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x3E , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x895F, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x1E , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8165, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x22 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x827E, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x68 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8167, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x33 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8013, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x39 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8fd7, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x14 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8fd6, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x1e , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8fd5, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x1e , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x82D9, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x20 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x82DA, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x00 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x816E, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0xab , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8159, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x58 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x815A, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x99 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8139, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x25 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8125, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x67 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8126, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x89 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x827D, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x42 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, +}; + +rtk_hwpatch_t rtl8264b_alg_giga_conf[] = { + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x80b8, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 8 , 0x4d , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x80b9, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 8 , 0xcc , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x80ba, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 8 , 0x0 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x80bb, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 13, 8 , 0x0 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x80bc, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 8 , 0x37 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x80bd, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 12, 8 , 0x0c , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x80be, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 8 , 0xBB , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x80bf, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 8 , 0xca , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x80c0, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 8 , 0x45 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x80c2, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 8 , 0x3b , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x80cc, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 8 , 0x16 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x80cd, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 10, 8 , 0x4 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x80ce, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 8 , 0x0 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x80cf, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 13, 8 , 0x0 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x80d0, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 8 , 0x53 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x80d1, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 12, 8 , 0x0a , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x80d2, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 8 , 0xB9 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x80d3, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 8 , 0xd0 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x80d4, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 8 , 0x4a , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x80d6, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 8 , 0x35 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x80a4, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 8 , 0x0d , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x80a5, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 8 , 0xa4 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x80a6, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 8 , 0x59 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x80a7, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 13, 8 , 0x05 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x80a8, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 8 , 0xab , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x80a9, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 12, 8 , 0x0b , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x80aa, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 8 , 0xef , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x80ab, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 8 , 0xae , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x80ac, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 8 , 0xdf , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x80ae, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 8 , 0x28 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x8367, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 8 , 0x5d , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, +}; + +rtk_hwpatch_t rtl8264b_normal_conf[] = { + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xbd92, 15, 0 , 0x002e, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xbd94, 15, 0 , 0x8003, RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xbd96, 3 , 0 , 0xf , RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xbd96, 3 , 0 , 0x0 , RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xbd94, 15, 0 , 0x800b, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xbd96, 3 , 0 , 0xf , RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xbd96, 3 , 0 , 0x0 , RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x817D, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 8 , 0x07 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x8426, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 8 , 0x46 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x8428, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 8 , 0x46 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x84de, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0000, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x84e0, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x00fc, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x84e2, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf61a, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x84e4, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 8 , 0x58 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x84e6, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0000, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x84e8, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x00fc, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x84ea, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf61a, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x84ec, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 8 , 0x58 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x84ee, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0000, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x84f0, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x00fc, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x84f2, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0xf61a, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x84f4, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 8 , 0x58 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xae32, 5 , 5 , 0x1 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x8018, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 12, 12, 0x1 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8fdf, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 0 , 0x0496, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8fe1, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 0 , 0x03a5, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8fe3, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 0 , 0x02e5, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8fe5, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 0 , 0x020d, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8fe7, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 0 , 0x0496, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8fe9, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 0 , 0x03a5, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8feb, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 0 , 0x02e5, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8fed, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 0 , 0x020d, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8fef, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 0 , 0x0496, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8ff1, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 0 , 0x03a5, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8ff3, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 0 , 0x02e5, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8ff5, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 0 , 0x020d, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8ff7, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 0 , 0x0496, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8ff9, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 0 , 0x03a5, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8ffb, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 0 , 0x02e5, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8ffd, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 0 , 0x020d, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb516, 6 , 0 , 0x0 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8fda, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x04 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8fdb, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x05 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8132, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x77 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8134, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x88 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x80ca, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x77 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x80cc, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x88 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8062, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x77 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87c, 15, 0 , 0x8064, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb87e, 15, 8 , 0x88 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa436, 15, 0 , 0x801E, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xa438, 15, 0 , 0x0012, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, +}; + +rtk_hwpatch_t rtl8264b_dataram_conf[] = { + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb820, 7 , 7 , 0x0 , RTK_PATCH_CMP_WS , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb896, 0 , 0 , 0x0 , RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb892, 15, 8 , 0x0 , RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC037, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0x33 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC038, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0x2A , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC039, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0x25 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC03A, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0x20 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC03B, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0x1C , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC03C, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0x17 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC03D, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0x13 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC075, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0xA1 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC076, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0xB1 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC077, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0x2E , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC078, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0x55 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC079, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0x19 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC07A, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0xDC , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC07B, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0xA0 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC10B, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0xD5 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC10C, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0xD5 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC10D, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0xD5 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC10E, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0xD5 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC10F, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0xD5 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC110, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0xD5 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC149, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0x08 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC14A, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0x08 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC14B, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0x08 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC14C, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0x08 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC14D, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0x08 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC14E, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0x08 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC166, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0xEE , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC167, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0xEE , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC168, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0x07 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC169, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0x09 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC16A, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0x0B , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC16B, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0x0D , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC16C, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0x13 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC16D, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0x0E , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC16E, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0x11 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC16F, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0x14 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC170, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0x17 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC171, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0x15 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC172, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0x10 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC173, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0x0B , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC128, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0xF7 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC129, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0xF7 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC12A, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0xF8 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC12B, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0xF7 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC12C, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0xF6 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC12D, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0xF5 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC12E, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0xF2 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC12F, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0xF7 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC130, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0xF5 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC131, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0xF2 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC132, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0xF0 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC133, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0xF1 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC134, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 15, 8 , 0xF4 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb88e, 15, 0 , 0xC135, RTK_PATCH_CMP_W , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb890, 7 , 0 , 0xF7 , RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PHYOCP , 0xf , 0 , 0xb896, 0 , 0 , 0x1 , RTK_PATCH_CMP_W , 0, 0, 0, 0}, +}; + +rtk_hwpatch_t rtl8264b_rtct_conf[] = { +}; + diff --git a/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/error.h b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/error.h new file mode 100644 index 00000000000000..d99a996f8c05c2 --- /dev/null +++ b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/error.h @@ -0,0 +1,165 @@ +/* + * SPDX-License-Identifier: GPL-2.0-only + * + * Copyright (c) 2023 Realtek Semiconductor Corp. All rights reserved. + */ + +#ifndef __COMMON_ERROR_H__ +#define __COMMON_ERROR_H__ + +/* + * Include Files + */ +#if defined(RTK_PHYDRV_IN_LINUX) + #include "type.h" +#else + #include +#endif +/* + * Data Type Declaration + */ +typedef enum rt_error_common_e +{ + RT_ERR_FAILED = -1, /* General Error */ + + /* 0x0000xxxx for common error code */ + RT_ERR_OK = 0, /* 0x00000000, OK */ + RT_ERR_INPUT = 0xF001, /* 0x0000F001, invalid input parameter */ + RT_ERR_UNIT_ID, /* 0x0000F002, invalid unit id */ + RT_ERR_PORT_ID, /* 0x0000F003, invalid port id */ + RT_ERR_PORT_MASK, /* 0x0000F004, invalid port mask */ + RT_ERR_PORT_LINKDOWN, /* 0x0000F005, link down port status */ + RT_ERR_ENTRY_INDEX, /* 0x0000F006, invalid entry index */ + RT_ERR_NULL_POINTER, /* 0x0000F007, input parameter is null pointer */ + RT_ERR_QUEUE_ID, /* 0x0000F008, invalid queue id */ + RT_ERR_QUEUE_NUM, /* 0x0000F009, invalid queue number */ + RT_ERR_BUSYWAIT_TIMEOUT, /* 0x0000F00a, busy watting time out */ + RT_ERR_MAC, /* 0x0000F00b, invalid mac address */ + RT_ERR_OUT_OF_RANGE, /* 0x0000F00c, input parameter out of range */ + RT_ERR_CHIP_NOT_SUPPORTED, /* 0x0000F00d, functions not supported by this chip model */ + RT_ERR_SMI, /* 0x0000F00e, SMI error */ + RT_ERR_NOT_INIT, /* 0x0000F00f, The module is not initial */ + RT_ERR_CHIP_NOT_FOUND, /* 0x0000F010, The chip can not found */ + RT_ERR_NOT_ALLOWED, /* 0x0000F011, actions not allowed by the function */ + RT_ERR_DRIVER_NOT_FOUND, /* 0x0000F012, The driver can not found */ + RT_ERR_SEM_LOCK_FAILED, /* 0x0000F013, Failed to lock semaphore */ + RT_ERR_SEM_UNLOCK_FAILED, /* 0x0000F014, Failed to unlock semaphore */ + RT_ERR_THREAD_EXIST, /* 0x0000F015, Thread exist */ + RT_ERR_THREAD_CREATE_FAILED, /* 0x0000F016, Thread create fail */ + RT_ERR_FWD_ACTION, /* 0x0000F017, Invalid forwarding Action */ + RT_ERR_IPV4_ADDRESS, /* 0x0000F018, Invalid IPv4 address */ + RT_ERR_IPV6_ADDRESS, /* 0x0000F019, Invalid IPv6 address */ + RT_ERR_PRIORITY, /* 0x0000F01a, Invalid Priority value */ + RT_ERR_FID, /* 0x0000F01b, invalid fid */ + RT_ERR_ENTRY_NOTFOUND, /* 0x0000F01c, specified entry not found */ + RT_ERR_DROP_PRECEDENCE, /* 0x0000F01d, invalid drop precedence */ + RT_ERR_NOT_FINISH, /* 0x0000F01e, Action not finish, still need to wait */ + RT_ERR_TIMEOUT, /* 0x0000F01f, Time out */ + RT_ERR_REG_ARRAY_INDEX_1, /* 0x0000F020, invalid index 1 of register array */ + RT_ERR_REG_ARRAY_INDEX_2, /* 0x0000F021, invalid index 2 of register array */ + RT_ERR_ETHER_TYPE, /* 0x0000F022, invalid ether type */ + RT_ERR_MBUF_PKT_NOT_AVAILABLE, /* 0x0000F023, mbuf->packet is not available */ + RT_ERR_QOS_INVLD_RSN, /* 0x0000F024, invalid pkt to CPU reason */ + RT_ERR_CB_FUNCTION_EXIST, /* 0x0000F025, Callback function exist */ + RT_ERR_CB_FUNCTION_FULL, /* 0x0000F026, Callback function number is full */ + RT_ERR_CB_FUNCTION_NOT_FOUND, /* 0x0000F027, Callback function can not found */ + RT_ERR_TBL_FULL, /* 0x0000F028, The table is full */ + RT_ERR_TRUNK_ID, /* 0x0000F029, invalid trunk id */ + RT_ERR_TYPE, /* 0x0000F02a, invalid type */ + RT_ERR_ENTRY_EXIST, /* 0x0000F02b, entry exists */ + RT_ERR_CHIP_UNDEFINED_VALUE, /* 0x0000F02c, chip returned an undefined value */ + RT_ERR_EXCEEDS_CAPACITY, /* 0x0000F02d, exceeds the capacity of hardware */ + RT_ERR_ENTRY_REFERRED, /* 0x0000F02e, entry is still being referred */ + RT_ERR_OPER_DENIED, /* 0x0000F02f, operation denied */ + RT_ERR_PORT_NOT_SUPPORTED, /* 0x0000F030, functions not supported by this port */ + RT_ERR_SOCKET, /* 0x0000F031, socket error */ + RT_ERR_MEM_ALLOC, /* 0x0000F032, insufficient memory resource */ + RT_ERR_ABORT, /* 0x0000F033, operation aborted */ + RT_ERR_DEV_ID, /* 0x0000F034, invalid device id */ + RT_ERR_DRIVER_NOT_SUPPORTED, /* 0x0000F035, functions not supported by this driver */ + RT_ERR_NOT_SUPPORTED, /* 0x0000F036, functions not supported */ + RT_ERR_SER, /* 0x0000F037, ECC or parity error */ + RT_ERR_MEM_NOT_ALIGN, /* 0x0000F038, memory address is not aligned */ + RT_ERR_SEM_FAKELOCK_OK, /* 0x0000F039, attach thread lock a semaphore which was already locked */ + RT_ERR_CHECK_FAILED, /* 0x0000F03a, check result is failed */ + + RT_ERR_COMMON_END = 0xFFFF /* The symbol is the latest symbol of common error */ +} rt_error_common_t; + +/* + * Macro Definition + */ +#define RT_PARAM_CHK(expr, errCode)\ +do {\ + if ((int32)(expr)) {\ + return errCode; \ + }\ +} while (0) + +#define RT_PARAM_CHK_EHDL(expr, errCode, err_hdl)\ +do {\ + if ((int32)(expr)) {\ + {err_hdl}\ + return errCode; \ + }\ +} while (0) + +#define RT_INIT_CHK(state)\ +do {\ + if (INIT_COMPLETED != (state)) {\ + return RT_ERR_NOT_INIT;\ + }\ +} while (0) + +#define RT_INIT_REENTRY_CHK(state)\ +do {\ + if (INIT_COMPLETED == (state)) {\ + osal_printf(" %s had already been initialized!\n", __FUNCTION__);\ + return RT_ERR_OK;\ + }\ +} while (0) + +#define RT_INIT_REENTRY_CHK_NO_WARNING(state)\ + do {\ + if (INIT_COMPLETED == (state)) {\ + return RT_ERR_OK;\ + }\ + } while (0) + +#define RT_ERR_CHK(op, ret)\ +do {\ + if ((ret = (op)) != RT_ERR_OK)\ + return ret;\ +} while(0) + +#define RT_ERR_HDL(op, errHandle, ret)\ +do {\ + if ((ret = (op)) != RT_ERR_OK)\ + goto errHandle;\ +} while(0) + +#define RT_ERR_CHK_EHDL(op, ret, err_hdl)\ +do {\ + if ((ret = (op)) != RT_ERR_OK)\ + {\ + {err_hdl}\ + return ret;\ + }\ +} while(0) + +#define RT_NULL_HDL(pointer, err_label)\ +do {\ + if (NULL == (pointer)) {\ + goto err_label;\ + }\ +} while (0) + +#define RT_ERR_VOID_CHK(op, ret)\ +do {\ + if ((ret = (op)) != RT_ERR_OK) {\ + osal_printf("Fail in %s %d, ret %x!\n", __FUNCTION__, __LINE__, ret);\ + return ;}\ +} while(0) + +#endif /* __COMMON_ERROR_H__ */ + diff --git a/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/phy_patch.c b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/phy_patch.c new file mode 100644 index 00000000000000..f9af3ffe022e54 --- /dev/null +++ b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/phy_patch.c @@ -0,0 +1,179 @@ +/* + * SPDX-License-Identifier: GPL-2.0-only + * + * Copyright (c) 2023 Realtek Semiconductor Corp. All rights reserved. + */ + +/* + * Include Files + */ +#if defined(RTK_PHYDRV_IN_LINUX) + #include "rtk_osal.h" +#else + #include + #include + #include + #include + #include +#endif + +/* + * Function Declaration + */ +uint8 phy_patch_op_translate(uint8 patch_mode, uint8 patch_op, uint8 compare_op) +{ + if (patch_mode != PHY_PATCH_MODE_CMP) + { + return patch_op; + } + else + { + switch (compare_op) + { + case RTK_PATCH_CMP_WS: + return RTK_PATCH_OP_SKIP; + case RTK_PATCH_CMP_W: + case RTK_PATCH_CMP_WC: + case RTK_PATCH_CMP_SWC: + default: + return RTK_PATCH_OP_TO_CMP(patch_op, compare_op); + } + } +} + +int32 phy_patch_op(rt_phy_patch_db_t *pPhy_patchDb, uint32 unit, rtk_port_t port, uint8 portOffset, uint8 patch_op, uint16 portmask, uint16 pagemmd, uint16 addr, uint8 msb, uint8 lsb, uint16 data, uint8 patch_mode) +{ + rtk_hwpatch_t op; + + op.patch_op = patch_op; + op.portmask = portmask; + op.pagemmd = pagemmd; + op.addr = addr; + op.msb = msb; + op.lsb = lsb; + op.data = data; + op.compare_op = RTK_PATCH_CMP_W; + + return pPhy_patchDb->fPatch_op(unit, port, portOffset, &op, patch_mode); +} + +static int32 _phy_patch_process(uint32 unit, rtk_port_t port, uint8 portOffset, rtk_hwpatch_t *pPatch, int32 size, uint8 patch_mode) +{ + int32 i = 0; + int32 ret = 0; + int32 chk_ret = RT_ERR_OK; + int32 n; + rtk_hwpatch_t *patch = pPatch; + rt_phy_patch_db_t *pPatchDb = NULL; + + PHYPATCH_DB_GET(unit, port, pPatchDb); + + if (size <= 0) + { + return RT_ERR_OK; + } + n = size / sizeof(rtk_hwpatch_t); + + for (i = 0; i < n; i++) + { + ret = pPatchDb->fPatch_op(unit, port, portOffset, &patch[i], patch_mode); + if ((ret != RT_ERR_ABORT) && (ret != RT_ERR_OK)) + { + if ((ret == RT_ERR_CHECK_FAILED) && (patch_mode == PHY_PATCH_MODE_CMP)) + { + osal_printf("PATCH CHECK: Failed entry:%u|%u|0x%X|0x%X|%u|%u|0x%X\n", + i + 1, patch[i].patch_op, patch[i].pagemmd, patch[i].addr, patch[i].msb, patch[i].lsb, patch[i].data); + chk_ret = RT_ERR_CHECK_FAILED; + continue; + } + else + { + RT_LOG(LOG_MAJOR_ERR, (MOD_HAL | MOD_PHY), "U%u P%u %s failed! %u[%u][0x%X][0x%X][0x%X] ret=0x%X\n", unit, port, __FUNCTION__, + i+1, patch[i].patch_op, patch[i].pagemmd, patch[i].addr, patch[i].data, ret); + return ret; + } + } + + } + return (chk_ret == RT_ERR_CHECK_FAILED) ? chk_ret : RT_ERR_OK; +} + +/* Function Name: + * phy_patch + * Description: + * apply initial patch data to PHY + * Input: + * unit - unit id + * port - port id + * portOffset - the index offset of port based the base port in the PHY chip + * Output: + * None + * Return: + * RT_ERR_OK + * RT_ERR_FAILED + * RT_ERR_CHECK_FAILED + * RT_ERR_NOT_SUPPORTED + * Note: + * None + */ +int32 phy_patch(uint32 unit, rtk_port_t port, uint8 portOffset, uint8 patch_mode) +{ + int32 ret = RT_ERR_OK; + int32 chk_ret = RT_ERR_OK; + uint32 i = 0; + uint8 patch_type = 0; + rt_phy_patch_db_t *pPatchDb = NULL; + rtk_hwpatch_seq_t *table = NULL; + + PHYPATCH_DB_GET(unit, port, pPatchDb); + + if ((pPatchDb == NULL) || (pPatchDb->fPatch_op == NULL) || (pPatchDb->fPatch_flow == NULL)) + { + RT_LOG(LOG_MAJOR_ERR, (MOD_HAL | MOD_PHY), "U%u P%u phy_patch, db is NULL\n", unit, port); + return RT_ERR_DRIVER_NOT_SUPPORTED; + } + + if (patch_mode == PHY_PATCH_MODE_CMP) + { + table = pPatchDb->cmp_table; + } + else + { + table = pPatchDb->seq_table; + } + RT_LOG(LOG_INFO, (MOD_HAL | MOD_PHY), "phy_patch: U%u P%u portOffset:%u patch_mode:%u\n", unit, port, portOffset, patch_mode); + + for (i = 0; i < RTK_PATCH_SEQ_MAX; i++) + { + patch_type = table[i].patch_type; + RT_LOG(LOG_INFO, (MOD_HAL | MOD_PHY), "phy_patch: table[%u] patch_type:%u\n", i, patch_type); + + if (RTK_PATCH_TYPE_IS_DATA(patch_type)) + { + ret = _phy_patch_process(unit, port, portOffset, table[i].patch.data.conf, table[i].patch.data.size, patch_mode); + + if (ret == RT_ERR_CHECK_FAILED) + chk_ret = ret; + else if (ret != RT_ERR_OK) + { + RT_LOG(LOG_MAJOR_ERR, (MOD_HAL | MOD_PHY), "U%u P%u patch_mode:%u id:%u patch-%u failed. ret:0x%X\n", unit, port, patch_mode, i, patch_type, ret); + return ret; + } + } + else if (RTK_PATCH_TYPE_IS_FLOW(patch_type)) + { + RT_ERR_CHK_EHDL(pPatchDb->fPatch_flow(unit, port, portOffset, table[i].patch.flow_id, patch_mode), + ret, RT_LOG(LOG_MAJOR_ERR, (MOD_HAL | MOD_PHY), "U%u P%u patch_mode:%u id:%u patch-%u failed. ret:0x%X\n", unit, port, patch_mode, i, patch_type, ret);); + } + else + { + break; + } + } + + return (chk_ret == RT_ERR_CHECK_FAILED) ? chk_ret : RT_ERR_OK; +} + + + + diff --git a/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/phy_patch.h b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/phy_patch.h new file mode 100644 index 00000000000000..c2b7b1279c7e2c --- /dev/null +++ b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/phy_patch.h @@ -0,0 +1,174 @@ +/* + * SPDX-License-Identifier: GPL-2.0-only + * + * Copyright (c) 2023 Realtek Semiconductor Corp. All rights reserved. + */ + +#ifndef __HAL_PHY_PATCH_H__ +#define __HAL_PHY_PATCH_H__ + +/* + * Include Files + */ +#if defined(RTK_PHYDRV_IN_LINUX) + #include "rtk_phylib_def.h" +#else + #include + #include +#endif + +/* + * Symbol Definition + */ +#define PHYPATCH_PHYCTRL_IN_HALCTRL 0 /* 3.6.x: 1 ,4.0.x: 1, 4.1.x+: 0 */ +#define PHYPATCH_FMAILY_IN_HWP 0 /* 3.6.x: 1 ,4.0.x: 0, 4.1.x+: 0 */ +#define PHY_PATCH_MODE_BCAST_DEFAULT PHY_PATCH_MODE_BCAST /* 3.6.x: PHY_PATCH_MODE_BCAST_BUS ,4.0.x+: PHY_PATCH_MODE_BCAST */ + +#define PHY_PATCH_MODE_NORMAL 0 +#define PHY_PATCH_MODE_CMP 1 +#define PHY_PATCH_MODE_BCAST 2 +#define PHY_PATCH_MODE_BCAST_BUS 3 + +#define RTK_PATCH_CMP_W 0 /* write */ +#define RTK_PATCH_CMP_WC 1 /* compare */ +#define RTK_PATCH_CMP_SWC 2 /* sram compare */ +#define RTK_PATCH_CMP_WS 3 /* skip */ + +#define RTK_PATCH_OP_SECTION_SIZE 50 +#define RTK_PATCH_OP_TO_CMP(_op, _cmp) (_op + (RTK_PATCH_OP_SECTION_SIZE * _cmp)) +/* 0~49 normal op */ +#define RTK_PATCH_OP_PHY 0 +#define RTK_PATCH_OP_PHYOCP 1 +#define RTK_PATCH_OP_TOP 2 +#define RTK_PATCH_OP_TOPOCP 3 +#define RTK_PATCH_OP_PSDS0 4 +#define RTK_PATCH_OP_PSDS1 5 +#define RTK_PATCH_OP_MSDS 6 +#define RTK_PATCH_OP_MAC 7 + +/* 50~99 normal op for compare */ +#define RTK_PATCH_OP_CMP_PHY RTK_PATCH_OP_TO_CMP(RTK_PATCH_OP_PHY , RTK_PATCH_CMP_WC) +#define RTK_PATCH_OP_CMP_PHYOCP RTK_PATCH_OP_TO_CMP(RTK_PATCH_OP_PHYOCP , RTK_PATCH_CMP_WC) +#define RTK_PATCH_OP_CMP_TOP RTK_PATCH_OP_TO_CMP(RTK_PATCH_OP_TOP , RTK_PATCH_CMP_WC) +#define RTK_PATCH_OP_CMP_TOPOCP RTK_PATCH_OP_TO_CMP(RTK_PATCH_OP_TOPOCP , RTK_PATCH_CMP_WC) +#define RTK_PATCH_OP_CMP_PSDS0 RTK_PATCH_OP_TO_CMP(RTK_PATCH_OP_PSDS0 , RTK_PATCH_CMP_WC) +#define RTK_PATCH_OP_CMP_PSDS1 RTK_PATCH_OP_TO_CMP(RTK_PATCH_OP_PSDS1 , RTK_PATCH_CMP_WC) +#define RTK_PATCH_OP_CMP_MSDS RTK_PATCH_OP_TO_CMP(RTK_PATCH_OP_MSDS , RTK_PATCH_CMP_WC) +#define RTK_PATCH_OP_CMP_MAC RTK_PATCH_OP_TO_CMP(RTK_PATCH_OP_MAC , RTK_PATCH_CMP_WC) + +/* 100~149 normal op for sram compare */ +#define RTK_PATCH_OP_CMP_SRAM_PHY RTK_PATCH_OP_TO_CMP(RTK_PATCH_OP_PHY , RTK_PATCH_CMP_SWC) +#define RTK_PATCH_OP_CMP_SRAM_PHYOCP RTK_PATCH_OP_TO_CMP(RTK_PATCH_OP_PHYOCP , RTK_PATCH_CMP_SWC) +#define RTK_PATCH_OP_CMP_SRAM_TOP RTK_PATCH_OP_TO_CMP(RTK_PATCH_OP_TOP , RTK_PATCH_CMP_SWC) +#define RTK_PATCH_OP_CMP_SRAM_TOPOCP RTK_PATCH_OP_TO_CMP(RTK_PATCH_OP_TOPOCP , RTK_PATCH_CMP_SWC) +#define RTK_PATCH_OP_CMP_SRAM_PSDS0 RTK_PATCH_OP_TO_CMP(RTK_PATCH_OP_PSDS0 , RTK_PATCH_CMP_SWC) +#define RTK_PATCH_OP_CMP_SRAM_PSDS1 RTK_PATCH_OP_TO_CMP(RTK_PATCH_OP_PSDS1 , RTK_PATCH_CMP_SWC) +#define RTK_PATCH_OP_CMP_SRAM_MSDS RTK_PATCH_OP_TO_CMP(RTK_PATCH_OP_MSDS , RTK_PATCH_CMP_SWC) +#define RTK_PATCH_OP_CMP_SRAM_MAC RTK_PATCH_OP_TO_CMP(RTK_PATCH_OP_MAC , RTK_PATCH_CMP_SWC) + +/* 200~255 control op */ +#define RTK_PATCH_OP_DELAY_MS 200 +#define RTK_PATCH_OP_SKIP 255 + + +/* + patch type PHY_PATCH_TYPE_NONE => empty + patch type: PHY_PATCH_TYPE_TOP ~ (PHY_PATCH_TYPE_END-1) => data array + patch type: PHY_PATCH_TYPE_END ~ (PHY_PATCH_TYPE_END + RTK_PATCH_TYPE_FLOW_MAX) => flow +*/ +#define RTK_PATCH_TYPE_IS_DATA(_patch_type) (_patch_type > PHY_PATCH_TYPE_NONE && _patch_type < PHY_PATCH_TYPE_END) +#define RTK_PATCH_TYPE_IS_FLOW(_patch_type) (_patch_type >= PHY_PATCH_TYPE_END && _patch_type <= (PHY_PATCH_TYPE_END + RTK_PATCH_TYPE_FLOWID_MAX)) + + +/* + * Macro Definition + */ +#if PHYPATCH_PHYCTRL_IN_HALCTRL + #define PHYPATCH_DB_GET(_unit, _port, _pPatchDb) \ + do {\ + hal_control_t *pHalCtrl = NULL;\ + if ((pHalCtrl = hal_ctrlInfo_get(_unit)) == NULL)\ + return RT_ERR_FAILED;\ + _pPatchDb = (pHalCtrl->pPhy_ctrl[_port]->pPhy_patchDb);\ + } while(0) +#else + #if defined(RTK_PHYDRV_IN_LINUX) + #else + #include + #include + #endif + #define PHYPATCH_DB_GET(_unit, _port, _pPatchDb) \ + do {\ + rt_phyctrl_t *pPhyCtrl = NULL;\ + if ((pPhyCtrl = phy_phyctrl_get(_unit, _port)) == NULL)\ + return RT_ERR_FAILED;\ + _pPatchDb = (pPhyCtrl->pPhy_patchDb);\ + } while(0) +#endif + +#if PHYPATCH_FMAILY_IN_HWP + #define PHYPATCH_IS_RTKSDS(_unit) (HWP_9300_FAMILY_ID(_unit) || HWP_9310_FAMILY_ID(_unit)) +#else + #define PHYPATCH_IS_RTKSDS(_unit) (RTK_9300_FAMILY_ID(_unit) || RTK_9310_FAMILY_ID(_unit) || RTK_9311B_FAMILY_ID(_unit) || RTK_9330_FAMILY_ID(_unit)) +#endif + +#define PHYPATCH_TABLE_ASSIGN(_pPatchDb, _table, _idx, _patch_type, _para) \ + do {\ + if (RTK_PATCH_TYPE_IS_DATA(_patch_type)) {\ + _pPatchDb->_table[_idx].patch_type = _patch_type;\ + _pPatchDb->_table[_idx].patch.data.conf = _para;\ + _pPatchDb->_table[_idx].patch.data.size = sizeof(_para);\ + }\ + else if (RTK_PATCH_TYPE_IS_FLOW(_patch_type)) {\ + _pPatchDb->_table[_idx].patch_type = _patch_type;\ + _pPatchDb->_table[_idx].patch.flow_id = _patch_type;\ + }\ + else {\ + _pPatchDb->_table[_idx].patch_type = PHY_PATCH_TYPE_NONE;\ + }\ + } while(0) +#define PHYPATCH_SEQ_TABLE_ASSIGN(_pPatchDb, _idx, _patch_type, _para) PHYPATCH_TABLE_ASSIGN(_pPatchDb, seq_table, _idx, _patch_type, _para) +#define PHYPATCH_CMP_TABLE_ASSIGN(_pPatchDb, _idx, _patch_type, _para) PHYPATCH_TABLE_ASSIGN(_pPatchDb, cmp_table, _idx, _patch_type, _para) + +#define PHYPATCH_COMPARE(_mmdpage, _reg, _msb, _lsb, _exp, _real, _mask) \ + do {\ + uint32 _rData = REG32_FIELD_GET(_real, _lsb, _mask);\ + if (_exp != _rData) {\ + osal_printf("PATCH CHECK: %u(0x%X).%u(0x%X)[%u:%u] = 0x%X (!= 0x%X)\n", _mmdpage, _mmdpage, _reg, _reg, _msb, _lsb, _rData, _exp);\ + return RT_ERR_CHECK_FAILED;\ + }\ + } while (0) + +/* + * Function Declaration + */ + +extern uint8 phy_patch_op_translate(uint8 patch_mode, uint8 patch_op, uint8 compare_op); +extern int32 phy_patch_op(rt_phy_patch_db_t *pPhy_patchDb, uint32 unit, rtk_port_t port, uint8 portOffset, + uint8 patch_op, uint16 portmask, uint16 pagemmd, uint16 addr, uint8 msb, uint8 lsb, uint16 data, + uint8 patch_mode); + + +/* Function Name: + * phy_patch + * Description: + * apply initial patch data to PHY + * Input: + * unit - unit id + * port - port id + * portOffset - the index offset of port based the base port in the PHY chip + * Output: + * None + * Return: + * RT_ERR_OK + * RT_ERR_FAILED + * RT_ERR_CHECK_FAILED + * RT_ERR_NOT_SUPPORTED + * Note: + * None + */ +extern int32 phy_patch(uint32 unit, rtk_port_t port, uint8 portOffset, uint8 patch_mode); + + + +#endif /* __HAL_PHY_PATCH_H__ */ diff --git a/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/phy_rtl826xb_patch.c b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/phy_rtl826xb_patch.c new file mode 100644 index 00000000000000..90a792a17b26ae --- /dev/null +++ b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/phy_rtl826xb_patch.c @@ -0,0 +1,1031 @@ +/* + * SPDX-License-Identifier: GPL-2.0-only + * + * Copyright (c) 2023 Realtek Semiconductor Corp. All rights reserved. + */ + +/* + * Include Files + */ +#if defined(RTK_PHYDRV_IN_LINUX) + #include "phy_rtl826xb_patch.h" + #include "construct/conf_rtl8264b.c" + #include "construct/conf_rtl8261n_c.c" +#else + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #if defined(CONFIG_SDK_RTL826XB) + #include + #include + #include + #endif +#endif +/* + * Symbol Definition + */ +#define PHY_PATCH_WAIT_TIMEOUT 10000000 + +#define PHY_PATCH_LOG LOG_INFO + +/* + * Data Declaration + */ + +/* + * Macro Declaration + */ + +/* + * Function Declaration + */ +static uint16 _phy_rtl826xb_mmd_convert(uint16 page, uint16 addr) +{ + uint16 reg = 0; + if (addr < 16) + { + reg = 0xA400 + (page * 2); + } + else if (addr < 24) + { + reg = (16*page) + ((addr - 16) * 2); + } + else + { + reg = 0xA430 + ((addr - 24) * 2); + } + return reg; +} + +int32 +_phy_rtl826xb_patch_wait(uint32 unit, rtk_port_t port, uint32 mmdAddr, uint32 mmdReg, uint32 data, uint32 mask, uint8 patch_mode) +{ + int32 ret = 0; + uint32 rData = 0; + uint32 cnt = 0; + WAIT_COMPLETE_VAR() + + rtk_port_t p = 0; + uint8 smiBus = HWP_PORT_SMI(unit, port); + uint32 phyChip = HWP_PHY_MODEL_BY_PORT(unit, port); + uint8 bcast_phyad = HWP_PHY_ADDR(unit, port);; + + + if (patch_mode == PHY_PATCH_MODE_BCAST_BUS) + { + if ((ret = phy_826xb_ctrl_set(unit, port, RTK_PHY_CTRL_MIIM_BCAST, 0)) != RT_ERR_OK) + { + RT_LOG(LOG_MAJOR_ERR, (MOD_HAL | MOD_PHY), "U%u P%u 826XB patch wait disable broadcast failed! 0x%X\n", unit, p, ret); + return ret; + } + + HWP_PORT_TRAVS_EXCEPT_CPU(unit, p) + { + if ((HWP_PORT_SMI(unit, p) == smiBus) && (HWP_PHY_MODEL_BY_PORT(unit, p) == phyChip)) + { + WAIT_COMPLETE(PHY_PATCH_WAIT_TIMEOUT) + { + if ((ret = phy_common_general_reg_mmd_get(unit, p, mmdAddr, mmdReg, &rData)) != RT_ERR_OK) + { + return ret; + } + ++cnt; + + if ((rData & mask) == data) + break; + + //osal_time_udelay(10); + } + + if (WAIT_COMPLETE_IS_TIMEOUT()) + { + RT_LOG(LOG_MAJOR_ERR, (MOD_HAL | MOD_PHY), "U%u P%u 826XB patch wait[%u,0x%X,0x%X,0x%X]:0x%X cnt:%u\n", unit, p, mmdAddr, mmdReg, data, mask, rData, cnt); + return RT_ERR_TIMEOUT; + } + } + } + + osal_time_mdelay(1); + //for port in same SMI bus, set mdio broadcast ENABLE + HWP_PORT_TRAVS_EXCEPT_CPU(unit, p) + { + if ((HWP_PORT_SMI(unit, p) == smiBus) && (HWP_PHY_MODEL_BY_PORT(unit, p) == phyChip)) + { + if ((ret = phy_826xb_ctrl_set(unit, p, RTK_PHY_CTRL_MIIM_BCAST_PHYAD, (uint32)bcast_phyad)) != RT_ERR_OK) + { + RT_LOG(LOG_MAJOR_ERR, (MOD_HAL | MOD_PHY), "U%u P%u 826XB patch wait set broadcast PHYAD failed! 0x%X\n", unit, p, ret); + return ret; + } + + if ((ret = phy_826xb_ctrl_set(unit, p, RTK_PHY_CTRL_MIIM_BCAST, 1)) != RT_ERR_OK) + { + RT_LOG(LOG_MAJOR_ERR, (MOD_HAL | MOD_PHY), "U%u P%u 826XB patch wait enable broadcast failed! 0x%X\n", unit, p, ret); + return ret; + } + } + } + } + else if (patch_mode == PHY_PATCH_MODE_BCAST) + { + if ((ret = phy_826xb_ctrl_set(unit, port, RTK_PHY_CTRL_MIIM_BCAST, 0)) != RT_ERR_OK) + { + RT_LOG(LOG_MAJOR_ERR, (MOD_HAL | MOD_PHY), "U%u P%u 826x patch wait disable broadcast failed! 0x%X\n", unit, p, ret); + return ret; + } + + HWP_PORT_TRAVS_EXCEPT_CPU(unit, p) + { + if (HWP_PHY_BASE_MACID(unit, p) == HWP_PHY_BASE_MACID(unit, port)) + { + WAIT_COMPLETE(PHY_PATCH_WAIT_TIMEOUT) + { + if ((ret = phy_common_general_reg_mmd_get(unit, p, mmdAddr, mmdReg, &rData)) != RT_ERR_OK) + { + return ret; + } + ++cnt; + + if ((rData & mask) == data) + break; + //osal_time_udelay(10); + } + + if (WAIT_COMPLETE_IS_TIMEOUT()) + { + RT_LOG(LOG_MAJOR_ERR, (MOD_HAL | MOD_PHY), "U%u P%u 826x patch wait[%u,0x%X,0x%X,0x%X]:0x%X cnt:%u\n", unit, p, mmdAddr, mmdReg, data, mask, rData, cnt); + return RT_ERR_TIMEOUT; + } + } + } + + osal_time_mdelay(1); + //for port in same PHY, set mdio broadcast ENABLE + HWP_PORT_TRAVS_EXCEPT_CPU(unit, p) + { + if (HWP_PHY_BASE_MACID(unit, p) == HWP_PHY_BASE_MACID(unit, port)) + { + if ((ret = phy_826xb_ctrl_set(unit, p, RTK_PHY_CTRL_MIIM_BCAST_PHYAD, (uint32)bcast_phyad)) != RT_ERR_OK) + { + RT_LOG(LOG_MAJOR_ERR, (MOD_HAL | MOD_PHY), "U%u P%u 826XB patch wait set broadcast PHYAD failed! 0x%X\n", unit, p, ret); + return ret; + } + + if ((ret = phy_826xb_ctrl_set(unit, p, RTK_PHY_CTRL_MIIM_BCAST, 1)) != RT_ERR_OK) + { + RT_LOG(LOG_MAJOR_ERR, (MOD_HAL | MOD_PHY), "U%u P%u 826XB patch wait enable broadcast failed! 0x%X\n", unit, p, ret); + return ret; + } + } + } + } + else + { + WAIT_COMPLETE(PHY_PATCH_WAIT_TIMEOUT) + { + if ((ret = phy_common_general_reg_mmd_get(unit, port, mmdAddr, mmdReg, &rData)) != RT_ERR_OK) + return ret; + + ++cnt; + if ((rData & mask) == data) + break; + + osal_time_mdelay(1); + } + + if (WAIT_COMPLETE_IS_TIMEOUT()) + { + RT_LOG(LOG_MAJOR_ERR, (MOD_HAL | MOD_PHY), "U%u P%u 826XB patch wait[%u,0x%X,0x%X,0x%X]:0x%X cnt:%u\n", unit, port, mmdAddr, mmdReg, data, mask, rData, cnt); + return RT_ERR_TIMEOUT; + } + } + + return RT_ERR_OK; +} + +int32 +_phy_rtl826xb_patch_wait_not_equal(uint32 unit, rtk_port_t port, uint32 mmdAddr, uint32 mmdReg, uint32 data, uint32 mask, uint8 patch_mode) +{ + int32 ret = 0; + uint32 rData = 0; + uint32 cnt = 0; + WAIT_COMPLETE_VAR() + + rtk_port_t p = 0; + uint8 smiBus = HWP_PORT_SMI(unit, port); + uint32 phyChip = HWP_PHY_MODEL_BY_PORT(unit, port); + uint8 bcast_phyad = HWP_PHY_ADDR(unit, port); + + if (patch_mode == PHY_PATCH_MODE_BCAST_BUS) + { + if ((ret = phy_826xb_ctrl_set(unit, port, RTK_PHY_CTRL_MIIM_BCAST, 0)) != RT_ERR_OK) + { + RT_LOG(LOG_MAJOR_ERR, (MOD_HAL | MOD_PHY), "U%u P%u 826XB patch wait disable broadcast failed! 0x%X\n", unit, p, ret); + return ret; + } + + HWP_PORT_TRAVS_EXCEPT_CPU(unit, p) + { + if ((HWP_PORT_SMI(unit, p) == smiBus) && (HWP_PHY_MODEL_BY_PORT(unit, p) == phyChip)) + { + WAIT_COMPLETE(PHY_PATCH_WAIT_TIMEOUT) + { + if ((ret = phy_common_general_reg_mmd_get(unit, p, mmdAddr, mmdReg, &rData)) != RT_ERR_OK) + { + return ret; + } + ++cnt; + + if ((rData & mask) != data) + break; + + //osal_time_udelay(10); + } + if (WAIT_COMPLETE_IS_TIMEOUT()) + { + RT_LOG(LOG_MAJOR_ERR, (MOD_HAL | MOD_PHY), "U%u P%u 826XB patch wait[%u,0x%X,0x%X,0x%X]:0x%X cnt:%u\n", unit, p, mmdAddr, mmdReg, data, mask, rData, cnt); + return RT_ERR_TIMEOUT; + } + } + } + + osal_time_mdelay(1); + //for port in same SMI bus, set mdio broadcast ENABLE + HWP_PORT_TRAVS_EXCEPT_CPU(unit, p) + { + if ((HWP_PORT_SMI(unit, p) == smiBus) && (HWP_PHY_MODEL_BY_PORT(unit, p) == phyChip)) + { + if ((ret = phy_826xb_ctrl_set(unit, p, RTK_PHY_CTRL_MIIM_BCAST_PHYAD, (uint32)bcast_phyad)) != RT_ERR_OK) + { + RT_LOG(LOG_MAJOR_ERR, (MOD_HAL | MOD_PHY), "U%u P%u 826XB patch wait set broadcast PHYAD failed! 0x%X\n", unit, p, ret); + return ret; + } + + if ((ret = phy_826xb_ctrl_set(unit, p, RTK_PHY_CTRL_MIIM_BCAST, 1)) != RT_ERR_OK) + { + RT_LOG(LOG_MAJOR_ERR, (MOD_HAL | MOD_PHY), "U%u P%u 826XB patch wait enable broadcast failed! 0x%X\n", unit, p, ret); + return ret; + } + } + } + } + else if (patch_mode == PHY_PATCH_MODE_BCAST) + { + if ((ret = phy_826xb_ctrl_set(unit, port, RTK_PHY_CTRL_MIIM_BCAST, 0)) != RT_ERR_OK) + { + RT_LOG(LOG_MAJOR_ERR, (MOD_HAL | MOD_PHY), "U%u P%u 826x patch wait disable broadcast failed! 0x%X\n", unit, p, ret); + return ret; + } + + HWP_PORT_TRAVS_EXCEPT_CPU(unit, p) + { + if (HWP_PHY_BASE_MACID(unit, p) == HWP_PHY_BASE_MACID(unit, port)) + { + WAIT_COMPLETE(PHY_PATCH_WAIT_TIMEOUT) + { + if ((ret = phy_common_general_reg_mmd_get(unit, p, mmdAddr, mmdReg, &rData)) != RT_ERR_OK) + { + return ret; + } + ++cnt; + + if (((rData & mask) != data)) + break; + + //osal_time_udelay(10); + } + + if (WAIT_COMPLETE_IS_TIMEOUT()) + { + RT_LOG(LOG_MAJOR_ERR, (MOD_HAL | MOD_PHY), "U%u P%u 826XB patch wait[%u,0x%X,0x%X,0x%X]:0x%X cnt:%u\n", unit, p, mmdAddr, mmdReg, data, mask, rData, cnt); + return RT_ERR_TIMEOUT; + } + } + } + + osal_time_mdelay(1); + //for port in same PHY, set mdio broadcast ENABLE + HWP_PORT_TRAVS_EXCEPT_CPU(unit, p) + { + if (HWP_PHY_BASE_MACID(unit, p) == HWP_PHY_BASE_MACID(unit, port)) + { + if ((ret = phy_826xb_ctrl_set(unit, p, RTK_PHY_CTRL_MIIM_BCAST_PHYAD, (uint32)bcast_phyad)) != RT_ERR_OK) + { + RT_LOG(LOG_MAJOR_ERR, (MOD_HAL | MOD_PHY), "U%u P%u 826XB patch wait set broadcast PHYAD failed! 0x%X\n", unit, p, ret); + return ret; + } + + if ((ret = phy_826xb_ctrl_set(unit, p, RTK_PHY_CTRL_MIIM_BCAST, 1)) != RT_ERR_OK) + { + RT_LOG(LOG_MAJOR_ERR, (MOD_HAL | MOD_PHY), "U%u P%u 826XB patch wait enable broadcast failed! 0x%X\n", unit, p, ret); + return ret; + } + } + } + } + else + { + WAIT_COMPLETE(PHY_PATCH_WAIT_TIMEOUT) + { + if ((ret = phy_common_general_reg_mmd_get(unit, port, mmdAddr, mmdReg, &rData)) != RT_ERR_OK) + return ret; + + ++cnt; + if ((rData & mask) != data) + break; + + osal_time_mdelay(1); + } + if (WAIT_COMPLETE_IS_TIMEOUT()) + { + RT_LOG(LOG_MAJOR_ERR, (MOD_HAL | MOD_PHY), "U%u P%u 826xb patch wait[%u,0x%X,0x%X,0x%X]:0x%X cnt:%u\n", unit, port, mmdAddr, mmdReg, data, mask, rData, cnt); + return RT_ERR_TIMEOUT; + } + + } + + return RT_ERR_OK; +} + +int32 +_phy_rtl826xb_patch_top_get(uint32 unit, rtk_port_t port, uint32 topPage, uint32 topReg, uint32 *pData) +{ + int32 ret = 0; + uint32 rData = 0; + uint32 topAddr = (topPage * 8) + (topReg - 16); + + if ((ret = phy_common_general_reg_mmd_get(unit, port, PHY_MMD_VEND1, topAddr, &rData)) != RT_ERR_OK) + return ret; + *pData = rData; + return RT_ERR_OK; +} + +int32 +_phy_rtl826xb_patch_top_set(uint32 unit, rtk_port_t port, uint32 topPage, uint32 topReg, uint32 wData) +{ + int32 ret = 0; + uint32 topAddr = (topPage * 8) + (topReg - 16); + if ((ret = phy_common_general_reg_mmd_set(unit, port, PHY_MMD_VEND1, topAddr, wData)) != RT_ERR_OK) + return ret; + return RT_ERR_OK; +} + +int32 +_phy_rtl826xb_patch_sds_get(uint32 unit, rtk_port_t port, uint32 sdsPage, uint32 sdsReg, uint32 *pData) +{ + int32 ret = 0; + uint32 rData = 0; + uint32 sdsAddr = 0x8000 + (sdsReg << 6) + sdsPage; + + if ((ret = _phy_rtl826xb_patch_top_set(unit, port, 40, 19, sdsAddr)) != RT_ERR_OK) + return ret; + if ((ret = _phy_rtl826xb_patch_top_get(unit, port, 40, 18, &rData)) != RT_ERR_OK) + return ret; + *pData = rData; + return _phy_rtl826xb_patch_wait(unit, port, PHY_MMD_VEND1, 0x143, 0, BIT_15, PHY_PATCH_MODE_NORMAL); +} + +int32 +_phy_rtl826xb_patch_sds_set(uint32 unit, rtk_port_t port, uint32 sdsPage, uint32 sdsReg, uint32 wData, uint8 patch_mode) +{ + int32 ret = 0; + uint32 sdsAddr = 0x8800 + (sdsReg << 6) + sdsPage; + + if ((ret = _phy_rtl826xb_patch_top_set(unit, port, 40, 17, wData)) != RT_ERR_OK) + return ret; + if ((ret = _phy_rtl826xb_patch_top_set(unit, port, 40, 19, sdsAddr)) != RT_ERR_OK) + return ret; + return _phy_rtl826xb_patch_wait(unit, port, PHY_MMD_VEND1, 0x143, 0, BIT_15, patch_mode); +} + +static int32 _phy_rtl826xb_flow_r1(uint32 unit, rtk_port_t port, uint8 portOffset, uint8 patch_mode) +{ + int32 ret = RT_ERR_OK; + rt_phy_patch_db_t *pPatchDb = NULL; + + PHYPATCH_DB_GET(unit, port, pPatchDb); + + //PHYReg_bit w $PHYID 0xb82 16 4 4 0x1 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xb82, 16, 4, 4, 0x1, patch_mode), ret); + //PHYReg_bit w $PHYID 0xb82 16 4 4 0x1 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xb82, 16, 4, 4, 0x1, patch_mode), ret); + + //set patch_rdy [PHYReg_bit r $PHYID 0xb80 16 6 6] ; Wait for patch ready = 1 + RT_ERR_CHK(_phy_rtl826xb_patch_wait(unit, port, 31, _phy_rtl826xb_mmd_convert(0xb80, 16), BIT_6, BIT_6, patch_mode), ret); + + //PHYReg w $PHYID 0xa43 27 $0x8023 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xa43, 27, 15, 0, 0x8023, patch_mode), ret); + //PHYReg w $PHYID 0xa43 28 $0x3802 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xa43, 28, 15, 0, 0x3802, patch_mode), ret); + //PHYReg w $PHYID 0xa43 27 0xB82E + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xa43, 27, 15, 0, 0xB82E, patch_mode), ret); + //PHYReg w $PHYID 0xa43 28 0x1 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xa43, 28, 15, 0, 0x1, patch_mode), ret); + + return RT_ERR_OK; +} + +static int32 _phy_rtl826xb_flow_r12(uint32 unit, rtk_port_t port, uint8 portOffset, uint8 patch_mode) +{ + int32 ret = RT_ERR_OK; + rt_phy_patch_db_t *pPatchDb = NULL; + + PHYPATCH_DB_GET(unit, port, pPatchDb); + + //PHYReg_bit w $PHYID 0xb82 16 4 4 0x1 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xb82, 16, 4, 4, 0x1, patch_mode), ret); + //PHYReg_bit w $PHYID 0xb82 16 4 4 0x1 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xb82, 16, 4, 4, 0x1, patch_mode), ret); + + //set patch_rdy [PHYReg_bit r $PHYID 0xb80 16 6 6] ; Wait for patch ready = 1 + RT_ERR_CHK(_phy_rtl826xb_patch_wait(unit, port, 31, _phy_rtl826xb_mmd_convert(0xb80, 16), BIT_6, BIT_6, patch_mode), ret); + + //PHYReg w $PHYID 0xa43 27 $0x8023 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xa43, 27, 15, 0, 0x8023, patch_mode), ret); + //PHYReg w $PHYID 0xa43 28 $0x3800 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xa43, 28, 15, 0, 0x3800, patch_mode), ret); + //PHYReg w $PHYID 0xa43 27 0xB82E + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xa43, 27, 15, 0, 0xB82E, patch_mode), ret); + //PHYReg w $PHYID 0xa43 28 0x1 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xa43, 28, 15, 0, 0x1, patch_mode), ret); + + return RT_ERR_OK; +} + + +static int32 _phy_rtl826xb_flow_r2(uint32 unit, rtk_port_t port, uint8 portOffset, uint8 patch_mode) +{ + int32 ret = RT_ERR_OK; + rt_phy_patch_db_t *pPatchDb = NULL; + + PHYPATCH_DB_GET(unit, port, pPatchDb); + + //PHYReg w $PHYID 0xa43 27 0x0000 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xa43, 27, 15, 0, 0x0000, patch_mode), ret); + //PHYReg w $PHYID 0xa43 28 0x0000 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xa43, 28, 15, 0, 0x0000, patch_mode), ret); + //PHYReg_bit w $PHYID 0xB82 23 0 0 0x0 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xB82, 23, 0, 0, 0x0, patch_mode), ret); + //PHYReg w $PHYID 0xa43 27 $0x8023 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xa43, 27, 15, 0, 0x8023, patch_mode), ret); + //PHYReg w $PHYID 0xa43 28 0x0000 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xa43, 28, 15, 0, 0x0000, patch_mode), ret); + + //PHYReg_bit w $PHYID 0xb82 16 4 4 0x0 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xb82, 16, 4, 4, 0x0, patch_mode), ret); + //set patch_rdy [PHYReg_bit r $PHYID 0xb80 16 6 6] ; Wait for patch ready != 1 + RT_ERR_CHK( _phy_rtl826xb_patch_wait_not_equal(unit, port, 31, _phy_rtl826xb_mmd_convert(0xb80, 16), BIT_6, BIT_6, patch_mode), ret); + + return RT_ERR_OK; +} + +static int32 _phy_rtl826xb_flow_l1(uint32 unit, rtk_port_t port, uint8 portOffset, uint8 patch_mode) +{ + int32 ret = RT_ERR_OK; + rt_phy_patch_db_t *pPatchDb = NULL; + + PHYPATCH_DB_GET(unit, port, pPatchDb); + + //PHYReg_bit w $PHYID 0xa4a 16 10 10 0x1 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xa4a, 16, 10, 10, 0x1, patch_mode), ret); + //PHYReg_bit w $PHYID 0xa4a 16 10 10 0x1 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xa4a, 16, 10, 10, 0x1, patch_mode), ret); + + //set pcs_state [PHYReg_bit r $PHYID 0xa60 16 7 0] ; Wait for pcs state = 1 + RT_ERR_CHK( _phy_rtl826xb_patch_wait(unit, port, 31, _phy_rtl826xb_mmd_convert(0xa60, 16), 0x1, 0xFF, patch_mode), ret); + + return RT_ERR_OK; +} + +static int32 _phy_rtl826xb_flow_l2(uint32 unit, rtk_port_t port, uint8 portOffset, uint8 patch_mode) +{ + int32 ret = RT_ERR_OK; + rt_phy_patch_db_t *pPatchDb = NULL; + + PHYPATCH_DB_GET(unit, port, pPatchDb); + + //PHYReg_bit w $PHYID 0xa4a 16 10 10 0x0 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xa4a, 16, 10, 10, 0x0, patch_mode), ret); + + //set pcs_state [PHYReg_bit r $PHYID 0xa60 16 7 0] ; Wait for pcs state != 1 + RT_ERR_CHK( _phy_rtl826xb_patch_wait_not_equal(unit, port, 31, _phy_rtl826xb_mmd_convert(0xa60, 16), 0x1, 0xFF, patch_mode), ret); + + return RT_ERR_OK; +} + +static int32 _phy_rtl826xb_flow_pi(uint32 unit, rtk_port_t port, uint8 portOffset, uint8 patch_mode) +{ + int32 ret = RT_ERR_OK; + rt_phy_patch_db_t *pPatchDb = NULL; + uint32 rData = 0, cnt = 0; + + PHYPATCH_DB_GET(unit, port, pPatchDb); + + _phy_rtl826xb_flow_l1(unit, port, portOffset, patch_mode); + + // PP_PHYReg_bit w $PHYID 0xbf86 9 9 0x1; #SS_EN_XG = 1 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHYOCP, 0xFF, 31, 0xbf86, 9, 9, 0x1, patch_mode), ret); + // PP_PHYReg_bit w $PHYID 0xbf86 8 8 0x0; + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHYOCP, 0xFF, 31, 0xbf86, 8, 8, 0x0, patch_mode), ret); + // PP_PHYReg_bit w $PHYID 0xbf86 7 7 0x1; + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHYOCP, 0xFF, 31, 0xbf86, 7, 7, 0x1, patch_mode), ret); + // PP_PHYReg_bit w $PHYID 0xbf86 6 6 0x1; + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHYOCP, 0xFF, 31, 0xbf86, 6, 6, 0x1, patch_mode), ret); + // PP_PHYReg_bit w $PHYID 0xbf86 5 5 0x1; + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHYOCP, 0xFF, 31, 0xbf86, 5, 5, 0x1, patch_mode), ret); + // PP_PHYReg_bit w $PHYID 0xbf86 4 4 0x1; + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHYOCP, 0xFF, 31, 0xbf86, 4, 4, 0x1, patch_mode), ret); + // PP_PHYReg_bit w $PHYID 0xbf86 6 6 0x0; + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHYOCP, 0xFF, 31, 0xbf86, 6, 6, 0x0, patch_mode), ret); + // PP_PHYReg_bit w $PHYID 0xbf86 9 9 0x0; + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHYOCP, 0xFF, 31, 0xbf86, 9, 9, 0x0, patch_mode), ret); + // PP_PHYReg_bit w $PHYID 0xbf86 7 7 0x0; + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHYOCP, 0xFF, 31, 0xbf86, 7, 7, 0x0, patch_mode), ret); + + //PP_PHYReg_bit r $PHYID 0xbc62 12 8 + if ((ret = phy_common_general_reg_mmd_get(unit, port, PHY_MMD_VEND2, 0xbc62, &rData)) != RT_ERR_OK) + return ret; + rData = REG32_FIELD_GET(rData, 8, 0x1F00); + for (cnt = 0; cnt <= rData; cnt++) + { + //PP_PHYReg_bit w $PHYID 0xbc62 12 8 $t + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHYOCP, 0xFF, 31, 0xbc62, 12, 8, cnt, patch_mode), ret); + } + + // PP_PHYReg_bit w $PHYID 0xbc02 2 2 0x1 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHYOCP, 0xFF, 31, 0xbc02, 2, 2, 0x1, patch_mode), ret); + // PP_PHYReg_bit w $PHYID 0xbc02 3 3 0x1 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHYOCP, 0xFF, 31, 0xbc02, 3, 3, 0x1, patch_mode), ret); + // PP_PHYReg_bit w $PHYID 0xbf86 6 6 0x1 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHYOCP, 0xFF, 31, 0xbf86, 6, 6, 0x1, patch_mode), ret); + // PP_PHYReg_bit w $PHYID 0xbf86 9 9 0x1 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHYOCP, 0xFF, 31, 0xbf86, 9, 9, 0x1, patch_mode), ret); + // PP_PHYReg_bit w $PHYID 0xbf86 7 7 0x1 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHYOCP, 0xFF, 31, 0xbf86, 7, 7, 0x1, patch_mode), ret); + // PP_PHYReg_bit w $PHYID 0xbc04 9 2 0xff + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHYOCP, 0xFF, 31, 0xbc04, 9, 2, 0xff, patch_mode), ret); + + _phy_rtl826xb_flow_l2(unit, port, portOffset, patch_mode); + return RT_ERR_OK; +} + +static int32 _phy_rtl826xb_flow_n01(uint32 unit, rtk_port_t port, uint8 portOffset, uint8 patch_mode) +{ + int32 ret = RT_ERR_OK; + rt_phy_patch_db_t *pPatchDb = NULL; + + PHYPATCH_DB_GET(unit, port, pPatchDb); + + //PHYReg_bit w $PHYID 0xa01 21 15 0 0x1 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xa01, 21, 15, 0, 0x1, patch_mode), ret); + //PHYReg_bit w $PHYID 0xa01 19 15 0 0x0000 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xa01, 19, 15, 0, 0x0000, patch_mode), ret); + //# PHYReg_bit w $PHYID 0xa01 17 15 0 0x0000 + //RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xa01, 17, 15, 0, 0x0000, patch_mode), ret); + + return RT_ERR_OK; +} + +static int32 _phy_rtl826xb_flow_n02(uint32 unit, rtk_port_t port, uint8 portOffset, uint8 patch_mode) +{ + int32 ret = RT_ERR_OK; + rt_phy_patch_db_t *pPatchDb = NULL; + + PHYPATCH_DB_GET(unit, port, pPatchDb); + + //PHYReg_bit w $PHYID 0xa01 21 15 0 0x0 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xa01, 21, 15, 0, 0x0, patch_mode), ret); + //PHYReg_bit w $PHYID 0xa01 19 15 0 0x0000 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xa01, 19, 15, 0, 0x0000, patch_mode), ret); + //PHYReg_bit w $PHYID 0xa01 17 15 0 0x0000 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xa01, 17, 15, 0, 0x0000, patch_mode), ret); + return RT_ERR_OK; +} + +static int32 _phy_rtl826xb_flow_n11(uint32 unit, rtk_port_t port, uint8 portOffset, uint8 patch_mode) +{ + int32 ret = RT_ERR_OK; + rt_phy_patch_db_t *pPatchDb = NULL; + + PHYPATCH_DB_GET(unit, port, pPatchDb); + + //PHYReg_bit w $PHYID 0xa01 21 15 0 0x1 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xa01, 21, 15, 0, 0x1, patch_mode), ret); + //PHYReg_bit w $PHYID 0xa01 19 15 0 0x0010 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xa01, 19, 15, 0, 0x0010, patch_mode), ret); + //# PHYReg_bit w $PHYID 0xa01 17 15 0 0x0000 + //RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xa01, 17, 15, 0, 0x0000, patch_mode), ret); + + return RT_ERR_OK; +} + +static int32 _phy_rtl826xb_flow_n12(uint32 unit, rtk_port_t port, uint8 portOffset, uint8 patch_mode) +{ + int32 ret = RT_ERR_OK; + rt_phy_patch_db_t *pPatchDb = NULL; + + PHYPATCH_DB_GET(unit, port, pPatchDb); + + //PHYReg_bit w $PHYID 0xa01 21 15 0 0x0 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xa01, 21, 15, 0, 0x0, patch_mode), ret); + //PHYReg_bit w $PHYID 0xa01 19 15 0 0x0010 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xa01, 19, 15, 0, 0x0010, patch_mode), ret); + //PHYReg_bit w $PHYID 0xa01 17 15 0 0x0000 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xa01, 17, 15, 0, 0x0000, patch_mode), ret); + + return RT_ERR_OK; +} + +static int32 _phy_rtl826xb_flow_n21(uint32 unit, rtk_port_t port, uint8 portOffset, uint8 patch_mode) +{ + int32 ret = RT_ERR_OK; + rt_phy_patch_db_t *pPatchDb = NULL; + + PHYPATCH_DB_GET(unit, port, pPatchDb); + + //PHYReg_bit w $PHYID 0xa01 21 15 0 0x1 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xa01, 21, 15, 0, 0x1, patch_mode), ret); + //PHYReg_bit w $PHYID 0xa01 19 15 0 0x0020 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xa01, 19, 15, 0, 0x0020, patch_mode), ret); + //# PHYReg_bit w $PHYID 0xa01 17 15 0 0x0000 + //RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xa01, 17, 15, 0, 0x0000, patch_mode), ret); + + return RT_ERR_OK; +} + +static int32 _phy_rtl826xb_flow_n22(uint32 unit, rtk_port_t port, uint8 portOffset, uint8 patch_mode) +{ + int32 ret = RT_ERR_OK; + rt_phy_patch_db_t *pPatchDb = NULL; + + PHYPATCH_DB_GET(unit, port, pPatchDb); + + //PHYReg_bit w $PHYID 0xa01 21 15 0 0x0 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xa01, 21, 15, 0, 0x0, patch_mode), ret); + //PHYReg_bit w $PHYID 0xa01 19 15 0 0x0020 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xa01, 19, 15, 0, 0x0020, patch_mode), ret); + //PHYReg_bit w $PHYID 0xa01 17 15 0 0x0000 + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PHY, 0xFF, 0xa01, 17, 15, 0, 0x0000, patch_mode), ret); + + return RT_ERR_OK; +} + +static int32 _phy_rtl826xb_flow_s(uint32 unit, rtk_port_t port, uint8 portOffset, uint8 patch_mode) +{ + int32 ret = RT_ERR_OK; + rt_phy_patch_db_t *pPatchDb = NULL; + + if (PHYPATCH_IS_RTKSDS(unit)) + { + PHYPATCH_DB_GET(unit, port, pPatchDb); + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PSDS0, 0xff, 0x07, 0x10, 15, 0, 0x80aa, patch_mode), ret); + RT_ERR_CHK(phy_patch_op(pPatchDb, unit, port, portOffset, RTK_PATCH_OP_PSDS0, 0xff, 0x06, 0x12, 15, 0, 0x5078, patch_mode), ret); + } + + return RT_ERR_OK; +} + +int32 phy_rtl826xb_patch_op(uint32 unit, rtk_port_t port, uint8 portOffset, rtk_hwpatch_t *pPatch_data, uint8 patch_mode) +{ + int32 ret = RT_ERR_OK; + uint32 rData = 0, wData = 0; + uint16 reg = 0; + uint8 patch_op = 0; + uint32 mask = 0; + + if ((pPatch_data->portmask & (1 << portOffset)) == 0) + { + return RT_ERR_ABORT; + } + mask = UINT32_BITS_MASK(pPatch_data->msb, pPatch_data->lsb); + patch_op = phy_patch_op_translate(patch_mode, pPatch_data->patch_op, pPatch_data->compare_op); + + #if 0 + osal_printf("[%s,%d]u%up%u, patch_mode:%u/patch_op:%u/compare_op:%u => op: %u\n", __FUNCTION__, __LINE__, unit, port, + patch_mode, pPatch_data->patch_op, pPatch_data->compare_op, + patch_op); + #endif + + switch (patch_op) + { + case RTK_PATCH_OP_PHY: + reg = _phy_rtl826xb_mmd_convert(pPatch_data->pagemmd, pPatch_data->addr); + if ((pPatch_data->msb != 15) || (pPatch_data->lsb != 0)) + { + RT_ERR_CHK(phy_common_general_reg_mmd_get(unit, port, 31, reg, &rData), ret); + } + wData = REG32_FIELD_SET(rData, pPatch_data->data, pPatch_data->lsb, mask); + RT_ERR_CHK(phy_common_general_reg_mmd_set(unit, port, 31, reg, wData), ret); + break; + case RTK_PATCH_OP_CMP_PHY: + reg = _phy_rtl826xb_mmd_convert(pPatch_data->pagemmd, pPatch_data->addr); + RT_ERR_CHK(phy_common_general_reg_mmd_get(unit, port, 31, reg, &rData), ret); + PHYPATCH_COMPARE(pPatch_data->pagemmd, pPatch_data->addr, pPatch_data->msb, pPatch_data->lsb, pPatch_data->data, rData, mask); + break; + case RTK_PATCH_OP_CMP_SRAM_PHY: + reg = _phy_rtl826xb_mmd_convert(pPatch_data->sram_p, pPatch_data->sram_rw); + RT_ERR_CHK(phy_common_general_reg_mmd_set(unit, port, 31, reg, pPatch_data->sram_a), ret); + reg = _phy_rtl826xb_mmd_convert(pPatch_data->sram_p, pPatch_data->sram_rr); + RT_ERR_CHK(phy_common_general_reg_mmd_get(unit, port, 31, reg, &rData), ret); + PHYPATCH_COMPARE(pPatch_data->pagemmd, pPatch_data->addr, pPatch_data->msb, pPatch_data->lsb, pPatch_data->data, rData, mask); + break; + + case RTK_PATCH_OP_PHYOCP: + if ((pPatch_data->msb != 15) || (pPatch_data->lsb != 0)) + { + RT_ERR_CHK(phy_common_general_reg_mmd_get(unit, port, 31, pPatch_data->addr, &rData), ret); + } + wData = REG32_FIELD_SET(rData, pPatch_data->data, pPatch_data->lsb, mask); + RT_ERR_CHK(phy_common_general_reg_mmd_set(unit, port, 31, pPatch_data->addr, wData), ret); + break; + case RTK_PATCH_OP_CMP_PHYOCP: + RT_ERR_CHK(phy_common_general_reg_mmd_get(unit, port, 31, pPatch_data->addr, &rData), ret); + PHYPATCH_COMPARE(pPatch_data->pagemmd, pPatch_data->addr, pPatch_data->msb, pPatch_data->lsb, pPatch_data->data, rData, mask); + break; + case RTK_PATCH_OP_CMP_SRAM_PHYOCP: + RT_ERR_CHK(phy_common_general_reg_mmd_set(unit, port, 31, pPatch_data->sram_rw, pPatch_data->sram_a), ret); + RT_ERR_CHK(phy_common_general_reg_mmd_get(unit, port, 31, pPatch_data->sram_rr, &rData), ret); + PHYPATCH_COMPARE(pPatch_data->pagemmd, pPatch_data->addr, pPatch_data->msb, pPatch_data->lsb, pPatch_data->data, rData, mask); + break; + + case RTK_PATCH_OP_TOP: + if ((pPatch_data->msb != 15) || (pPatch_data->lsb != 0)) + { + RT_ERR_CHK(_phy_rtl826xb_patch_top_get(unit, port, pPatch_data->pagemmd, pPatch_data->addr, &rData), ret); + } + wData = REG32_FIELD_SET(rData, pPatch_data->data, pPatch_data->lsb, mask); + RT_ERR_CHK(_phy_rtl826xb_patch_top_set(unit, port, pPatch_data->pagemmd, pPatch_data->addr, wData), ret); + break; + case RTK_PATCH_OP_CMP_TOP: + RT_ERR_CHK(_phy_rtl826xb_patch_top_get(unit, port, pPatch_data->pagemmd, pPatch_data->addr, &rData), ret); + PHYPATCH_COMPARE(pPatch_data->pagemmd, pPatch_data->addr, pPatch_data->msb, pPatch_data->lsb, pPatch_data->data, rData, mask); + break; + case RTK_PATCH_OP_CMP_SRAM_TOP: + RT_ERR_CHK(_phy_rtl826xb_patch_top_set(unit, port, pPatch_data->sram_p, pPatch_data->sram_rw, pPatch_data->sram_a), ret); + RT_ERR_CHK(_phy_rtl826xb_patch_top_get(unit, port, pPatch_data->sram_p, pPatch_data->sram_rr, &rData), ret); + PHYPATCH_COMPARE(pPatch_data->pagemmd, pPatch_data->addr, pPatch_data->msb, pPatch_data->lsb, pPatch_data->data, rData, mask); + break; + + case RTK_PATCH_OP_PSDS0: + if ((pPatch_data->msb != 15) || (pPatch_data->lsb != 0)) + { + RT_ERR_CHK(_phy_rtl826xb_patch_sds_get(unit, port, pPatch_data->pagemmd, pPatch_data->addr, &rData), ret); + } + wData = REG32_FIELD_SET(rData, pPatch_data->data, pPatch_data->lsb, mask); + RT_ERR_CHK(_phy_rtl826xb_patch_sds_set(unit, port, pPatch_data->pagemmd, pPatch_data->addr, wData, patch_mode), ret); + break; + case RTK_PATCH_OP_CMP_PSDS0: + RT_ERR_CHK(_phy_rtl826xb_patch_sds_get(unit, port, pPatch_data->pagemmd, pPatch_data->addr, &rData), ret); + PHYPATCH_COMPARE(pPatch_data->pagemmd, pPatch_data->addr, pPatch_data->msb, pPatch_data->lsb, pPatch_data->data, rData, mask); + break; + case RTK_PATCH_OP_CMP_SRAM_PSDS0: + RT_ERR_CHK(_phy_rtl826xb_patch_sds_set(unit, port, pPatch_data->sram_p, pPatch_data->sram_rw, pPatch_data->sram_a, patch_mode), ret); + RT_ERR_CHK(_phy_rtl826xb_patch_sds_get(unit, port, pPatch_data->sram_p, pPatch_data->sram_rr, &rData), ret); + PHYPATCH_COMPARE(pPatch_data->pagemmd, pPatch_data->addr, pPatch_data->msb, pPatch_data->lsb, pPatch_data->data, rData, mask); + break; + + case RTK_PATCH_OP_SKIP: + return RT_ERR_ABORT; + + default: + RT_LOG(LOG_MAJOR_ERR, (MOD_HAL | MOD_PHY), "U%u P%u patch_op:%u not implemented yet!\n", unit, port, pPatch_data->patch_op); + return RT_ERR_DRIVER_NOT_SUPPORTED; + } + + return ret; +} + +int32 phy_rtl826xb_patch_flow(uint32 unit, rtk_port_t port, uint8 portOffset, uint8 patch_flow, uint8 patch_mode) +{ + int32 ret = RT_ERR_OK; + + RT_LOG(LOG_INFO, (MOD_HAL | MOD_PHY), "[%s]U%u,P%u,flow%u\n", __FUNCTION__, unit, port, (patch_flow - PHY_PATCH_TYPE_END)); + switch (patch_flow) + { + case RTK_PATCH_TYPE_FLOW(0): + RT_ERR_CHK(_phy_rtl826xb_flow_r1(unit, port, portOffset, patch_mode), ret); + break; + case RTK_PATCH_TYPE_FLOW(1): + RT_ERR_CHK(_phy_rtl826xb_flow_r2(unit, port, portOffset, patch_mode), ret); + break; + + case RTK_PATCH_TYPE_FLOW(2): + RT_ERR_CHK(_phy_rtl826xb_flow_l1(unit, port, portOffset, patch_mode), ret); + break; + case RTK_PATCH_TYPE_FLOW(3): + RT_ERR_CHK(_phy_rtl826xb_flow_l2(unit, port, portOffset, patch_mode), ret); + break; + + case RTK_PATCH_TYPE_FLOW(4): + RT_ERR_CHK(_phy_rtl826xb_flow_n01(unit, port, portOffset, patch_mode), ret); + break; + case RTK_PATCH_TYPE_FLOW(5): + RT_ERR_CHK(_phy_rtl826xb_flow_n02(unit, port, portOffset, patch_mode), ret); + break; + + case RTK_PATCH_TYPE_FLOW(6): + RT_ERR_CHK(_phy_rtl826xb_flow_n11(unit, port, portOffset, patch_mode), ret); + break; + case RTK_PATCH_TYPE_FLOW(7): + RT_ERR_CHK(_phy_rtl826xb_flow_n12(unit, port, portOffset, patch_mode), ret); + break; + + case RTK_PATCH_TYPE_FLOW(8): + RT_ERR_CHK(_phy_rtl826xb_flow_n21(unit, port, portOffset, patch_mode), ret); + break; + case RTK_PATCH_TYPE_FLOW(9): + RT_ERR_CHK(_phy_rtl826xb_flow_n22(unit, port, portOffset, patch_mode), ret); + break; + + case RTK_PATCH_TYPE_FLOW(10): + RT_ERR_CHK(_phy_rtl826xb_flow_s(unit, port, portOffset, patch_mode), ret); + break; + + case RTK_PATCH_TYPE_FLOW(11): + RT_ERR_CHK(_phy_rtl826xb_flow_pi(unit, port, portOffset, patch_mode), ret); + break; + case RTK_PATCH_TYPE_FLOW(12): + RT_ERR_CHK(_phy_rtl826xb_flow_r12(unit, port, portOffset, patch_mode), ret); + break; + + default: + return RT_ERR_INPUT; + } + return RT_ERR_OK; +} + +int32 phy_rtl826xb_patch_db_init(uint32 unit, rtk_port_t port, rt_phy_patch_db_t **pPhy_patchDb) +{ + int32 ret = RT_ERR_OK; + rt_phy_patch_db_t *patch_db = NULL; + uint32 rData = 0; + + patch_db = osal_alloc(sizeof(rt_phy_patch_db_t)); + RT_PARAM_CHK(NULL == patch_db, RT_ERR_MEM_ALLOC); + osal_memset(patch_db, 0x0, sizeof(rt_phy_patch_db_t)); + + /* patch callback */ + patch_db->fPatch_op = phy_rtl826xb_patch_op; + patch_db->fPatch_flow = phy_rtl826xb_patch_flow; + + /* patch table */ + RT_ERR_CHK(phy_common_general_reg_mmd_get(unit, port, 30, 0x104, &rData), ret); + if ((rData & 0x7) == 0x0) + { + /* patch */ + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 0, RTK_PATCH_TYPE_FLOW(12), NULL); + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 1, PHY_PATCH_TYPE_NCTL0, rtl8264b_nctl0_conf); + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 2, PHY_PATCH_TYPE_NCTL1, rtl8264b_nctl1_conf); + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 3, PHY_PATCH_TYPE_NCTL2, rtl8264b_nctl2_conf); + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 4, PHY_PATCH_TYPE_UC2, rtl8264b_uc2_conf); + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 5, PHY_PATCH_TYPE_UC, rtl8264b_uc_conf); + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 6, PHY_PATCH_TYPE_DATARAM, rtl8264b_dataram_conf); + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 7, RTK_PATCH_TYPE_FLOW(1), NULL); + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 8, RTK_PATCH_TYPE_FLOW(2), NULL); + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 9, PHY_PATCH_TYPE_ALGXG, rtl8264b_algxg_conf); + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 10, PHY_PATCH_TYPE_ALG1G, rtl8264b_alg_giga_conf); + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 11, PHY_PATCH_TYPE_NORMAL, rtl8264b_normal_conf); + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 12, PHY_PATCH_TYPE_TOP, rtl8264b_top_conf); + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 13, PHY_PATCH_TYPE_SDS, rtl8264b_sds_conf); + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 14, PHY_PATCH_TYPE_AFE, rtl8264b_afe_conf); + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 15, PHY_PATCH_TYPE_RTCT, rtl8264b_rtct_conf); + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 16, RTK_PATCH_TYPE_FLOW(3), NULL); + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 17, RTK_PATCH_TYPE_FLOW(11), NULL); + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 18, RTK_PATCH_TYPE_FLOW(10), NULL); + + /* compare */ + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 0, PHY_PATCH_TYPE_TOP, rtl8264b_top_conf); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 1, PHY_PATCH_TYPE_SDS, rtl8264b_sds_conf); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 2, PHY_PATCH_TYPE_AFE, rtl8264b_afe_conf); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 3, RTK_PATCH_TYPE_FLOW(4), NULL); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 4, PHY_PATCH_TYPE_NCTL0, rtl8264b_nctl0_conf); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 5, RTK_PATCH_TYPE_FLOW(5), NULL); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 6, RTK_PATCH_TYPE_FLOW(6), NULL); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 7, PHY_PATCH_TYPE_NCTL1, rtl8264b_nctl1_conf); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 8, RTK_PATCH_TYPE_FLOW(7), NULL); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 9, RTK_PATCH_TYPE_FLOW(8), NULL); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 10, PHY_PATCH_TYPE_NCTL2, rtl8264b_nctl2_conf); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 11, RTK_PATCH_TYPE_FLOW(9), NULL); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 12, PHY_PATCH_TYPE_UC, rtl8264b_uc_conf); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 13, PHY_PATCH_TYPE_UC2, rtl8264b_uc2_conf); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 14, RTK_PATCH_TYPE_FLOW(12), NULL); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 15, PHY_PATCH_TYPE_DATARAM, rtl8264b_dataram_conf); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 16, RTK_PATCH_TYPE_FLOW(1), NULL); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 17, PHY_PATCH_TYPE_ALGXG, rtl8264b_algxg_conf); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 18, PHY_PATCH_TYPE_ALG1G, rtl8264b_alg_giga_conf); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 19, PHY_PATCH_TYPE_NORMAL, rtl8264b_normal_conf); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 20, PHY_PATCH_TYPE_RTCT, rtl8264b_rtct_conf); + } + else + { + /* patch */ + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 0, RTK_PATCH_TYPE_FLOW(0), NULL); + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 1, PHY_PATCH_TYPE_NCTL0, rtl8261n_c_nctl0_conf); + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 2, PHY_PATCH_TYPE_NCTL1, rtl8261n_c_nctl1_conf); + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 3, PHY_PATCH_TYPE_NCTL2, rtl8261n_c_nctl2_conf); + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 4, PHY_PATCH_TYPE_UC2, rtl8261n_c_uc2_conf); + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 5, PHY_PATCH_TYPE_UC, rtl8261n_c_uc_conf); + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 6, PHY_PATCH_TYPE_DATARAM, rtl8261n_c_dataram_conf); + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 7, RTK_PATCH_TYPE_FLOW(1), NULL); + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 8, RTK_PATCH_TYPE_FLOW(2), NULL); + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 9, PHY_PATCH_TYPE_ALGXG, rtl8261n_c_algxg_conf); + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 10, PHY_PATCH_TYPE_ALG1G, rtl8261n_c_alg_giga_conf); + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 11, PHY_PATCH_TYPE_NORMAL, rtl8261n_c_normal_conf); + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 12, PHY_PATCH_TYPE_TOP, rtl8261n_c_top_conf); + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 13, PHY_PATCH_TYPE_SDS, rtl8261n_c_sds_conf); + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 14, PHY_PATCH_TYPE_AFE, rtl8261n_c_afe_conf); + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 15, PHY_PATCH_TYPE_RTCT, rtl8261n_c_rtct_conf); + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 16, RTK_PATCH_TYPE_FLOW(3), NULL); + PHYPATCH_SEQ_TABLE_ASSIGN(patch_db, 17, RTK_PATCH_TYPE_FLOW(10), NULL); + + /* compare */ + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 0, PHY_PATCH_TYPE_TOP, rtl8261n_c_top_conf); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 1, PHY_PATCH_TYPE_SDS, rtl8261n_c_sds_conf); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 2, PHY_PATCH_TYPE_AFE, rtl8261n_c_afe_conf); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 3, RTK_PATCH_TYPE_FLOW(4), NULL); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 4, PHY_PATCH_TYPE_NCTL0, rtl8261n_c_nctl0_conf); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 5, RTK_PATCH_TYPE_FLOW(5), NULL); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 6, RTK_PATCH_TYPE_FLOW(6), NULL); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 7, PHY_PATCH_TYPE_NCTL1, rtl8261n_c_nctl1_conf); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 8, RTK_PATCH_TYPE_FLOW(7), NULL); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 9, RTK_PATCH_TYPE_FLOW(8), NULL); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 10, PHY_PATCH_TYPE_NCTL2, rtl8261n_c_nctl2_conf); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 11, RTK_PATCH_TYPE_FLOW(9), NULL); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 12, PHY_PATCH_TYPE_UC, rtl8261n_c_uc_conf); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 13, PHY_PATCH_TYPE_UC2, rtl8261n_c_uc2_conf); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 14, RTK_PATCH_TYPE_FLOW(0), NULL); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 15, PHY_PATCH_TYPE_DATARAM, rtl8261n_c_dataram_conf); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 16, RTK_PATCH_TYPE_FLOW(1), NULL); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 17, PHY_PATCH_TYPE_ALGXG, rtl8261n_c_algxg_conf); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 18, PHY_PATCH_TYPE_ALG1G, rtl8261n_c_alg_giga_conf); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 19, PHY_PATCH_TYPE_NORMAL, rtl8261n_c_normal_conf); + PHYPATCH_CMP_TABLE_ASSIGN(patch_db, 20, PHY_PATCH_TYPE_RTCT, rtl8261n_c_rtct_conf); + } + *pPhy_patchDb = patch_db; + return ret; +} + +/* Function Name: + * phy_rtl826xb_patch + * Description: + * apply initial patch data to PHY + * Input: + * unit - unit id + * baseport - base port id on the PHY chip + * portOffset - the index offset base on baseport for the port to patch + * Output: + * None + * Return: + * RT_ERR_OK + * RT_ERR_FAILED + * RT_ERR_NOT_SUPPORTED + * RT_ERR_ABORT + * Note: + * None + */ +int32 phy_rtl826xb_patch(uint32 unit, rtk_port_t port, uint8 portOffset) +{ + return phy_patch( unit, port, portOffset, PHY_PATCH_MODE_NORMAL); +} + +/* Function Name: + * phy_rtl826xb_broadcast_patch + * Description: + * apply patch data to PHY + * Input: + * unit - unit id + * baseport - base port id on the PHY chip + * portOffset - the index offset base on baseport for the port to patch + * perChip - 1 for per-chip mode, 0 for per-bus mode + * Output: + * None + * Return: + * RT_ERR_OK + * RT_ERR_FAILED + * RT_ERR_NOT_SUPPORTED + * RT_ERR_ABORT + * Note: + * None + */ +int32 phy_rtl826xb_broadcast_patch(uint32 unit, rtk_port_t port, uint8 portOffset, uint8 perChip) +{ + int32 ret = 0; + if (perChip == 0) + { + ret = phy_patch(unit, port, portOffset, PHY_PATCH_MODE_BCAST_BUS); + } + else + { + ret = phy_patch(unit, port, portOffset, PHY_PATCH_MODE_BCAST); + } + return ret; +} + diff --git a/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/phy_rtl826xb_patch.h b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/phy_rtl826xb_patch.h new file mode 100644 index 00000000000000..c2311ef2bf46d9 --- /dev/null +++ b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/phy_rtl826xb_patch.h @@ -0,0 +1,63 @@ +/* + * SPDX-License-Identifier: GPL-2.0-only + * + * Copyright (c) 2023 Realtek Semiconductor Corp. All rights reserved. + */ + +#ifndef __HAL_PHY_PHY_RTL826XB_PATCH_H__ +#define __HAL_PHY_PHY_RTL826XB_PATCH_H__ + +/* + * Include Files + */ +#if defined(RTK_PHYDRV_IN_LINUX) + #include "rtk_osal.h" + #include "rtk_phylib_def.h" +#else + #include + #include +#endif + +/* Function Name: + * phy_rtl826xb_patch + * Description: + * apply patch data to PHY + * Input: + * unit - unit id + * baseport - base port id on the PHY chip + * portOffset - the index offset base on baseport for the port to patch + * Output: + * None + * Return: + * RT_ERR_OK + * RT_ERR_FAILED + * RT_ERR_NOT_SUPPORTED + * RT_ERR_ABORT + * Note: + * None + */ +extern int32 phy_rtl826xb_patch(uint32 unit, rtk_port_t baseport, uint8 portOffset); + +/* Function Name: + * phy_rtl826xb_broadcast_patch + * Description: + * apply patch data to PHY + * Input: + * unit - unit id + * baseport - base port id on the PHY chip + * portOffset - the index offset base on baseport for the port to patch + * perChip - 1 for per-chip mode, 0 for per-bus mode + * Output: + * None + * Return: + * RT_ERR_OK + * RT_ERR_FAILED + * RT_ERR_NOT_SUPPORTED + * RT_ERR_ABORT + * Note: + * None + */ +extern int32 phy_rtl826xb_broadcast_patch(uint32 unit, rtk_port_t port, uint8 portOffset, uint8 perChip); + +extern int32 phy_rtl826xb_patch_db_init(uint32 unit, rtk_port_t port, rt_phy_patch_db_t **pPhy_patchDb); +#endif /* __HAL_PHY_PHY_RTL826XB_PATCH_H__ */ diff --git a/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/rtk_osal.c b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/rtk_osal.c new file mode 100644 index 00000000000000..bf3ac4b12447c8 --- /dev/null +++ b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/rtk_osal.c @@ -0,0 +1,56 @@ +/* + * SPDX-License-Identifier: GPL-2.0-only + * + * Copyright (c) 2023 Realtek Semiconductor Corp. All rights reserved. + */ + +#include "type.h" +#include "error.h" +#include "rtk_phylib_def.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +int32 +osal_time_usecs_get(osal_usecs_t *pUsec) +{ + struct timespec64 ts; + + RT_PARAM_CHK((NULL == pUsec), RT_ERR_NULL_POINTER); + + ktime_get_ts64(&ts); + *pUsec = (osal_usecs_t)((ts.tv_sec * USEC_PER_SEC) + (ts.tv_nsec / NSEC_PER_USEC)); + return RT_ERR_OK; +} + +void * +osal_alloc(uint32 size) +{ + void *p; + p = kmalloc((size_t)size, GFP_ATOMIC); + return p; +} + +int32 +phy_common_general_reg_mmd_get(uint32 unit, rtk_port_t port, uint32 mmdAddr, uint32 mmdReg, uint32 *pData) +{ + int32 rData = 0; + rData = phy_read_mmd(port, mmdAddr, mmdReg); + if (rData < 0) + return RT_ERR_FAILED; + *pData = (uint32)rData; + return RT_ERR_OK; +} + +int32 +phy_common_general_reg_mmd_set(uint32 unit, rtk_port_t port, uint32 mmdAddr, uint32 mmdReg, uint32 data) +{ + int ret = phy_write_mmd(port, mmdAddr, mmdReg, data); + return (ret < 0) ? RT_ERR_FAILED : RT_ERR_OK; +} diff --git a/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/rtk_osal.h b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/rtk_osal.h new file mode 100644 index 00000000000000..edf674611efdae --- /dev/null +++ b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/rtk_osal.h @@ -0,0 +1,99 @@ +/* + * SPDX-License-Identifier: GPL-2.0-only + * + * Copyright (c) 2023 Realtek Semiconductor Corp. All rights reserved. + */ + +#ifndef __RTK_PHY_OSAL_H +#define __RTK_PHY_OSAL_H + +#include +#include +#include "type.h" +#include "error.h" +#include "phy_patch.h" +#include "rtk_phylib.h" + +#ifdef PHYPATCH_DB_GET + #undef PHYPATCH_DB_GET +#endif + +#define PHYPATCH_DB_GET(_unit, _pPhy_device, _pPatchDb) \ + do { \ + struct rtk_phy_priv *_pPriv = (_pPhy_device)->priv; \ + rt_phy_patch_db_t *_pDb = _pPriv->patch; _pPatchDb = _pDb; \ + /*printk("[PHYPATCH_DB_GET] ? [%s]\n", (_pDb != NULL) ? "E":"N");*/ \ + } while(0) + +#define HWP_9300_FAMILY_ID(_unit) 0 +#define HWP_9310_FAMILY_ID(_unit) 0 +#define RTK_9300_FAMILY_ID(_unit) 0 +#define RTK_9310_FAMILY_ID(_unit) 0 +#define RTK_9311B_FAMILY_ID(_unit) 0 +#define RTK_9330_FAMILY_ID(_unit) 0 + +#ifndef WAIT_COMPLETE_VAR +#define WAIT_COMPLETE_VAR() \ + osal_usecs_t _t, _now, _t_wait=0, _timeout; \ + int32 _chkCnt=0; + +#define WAIT_COMPLETE(_timeout_us) \ + _timeout = _timeout_us; \ + for(osal_time_usecs_get(&_t),osal_time_usecs_get(&_now),_t_wait=0,_chkCnt=0 ; \ + (_t_wait <= _timeout); \ + osal_time_usecs_get(&_now), _chkCnt++, _t_wait += ((_now >= _t) ? (_now - _t) : (0xFFFFFFFF - _t + _now)),_t = _now \ + ) + +#define WAIT_COMPLETE_IS_TIMEOUT() (_t_wait > _timeout) +#endif + +/* OSAL */ +#include +int32 osal_time_usecs_get(osal_usecs_t *pUsec); +void *osal_alloc(uint32 size); +#define osal_time_mdelay mdelay + +#include /* for Kernel Space */ +#include +#include +#define osal_strlen strlen +#define osal_strcmp strcmp +#define osal_strcpy strcpy +#define osal_strncpy strncpy +#define osal_strcat strcat +#define osal_strchr strchr +#define osal_memset memset +#define osal_memcpy memcpy +#define osal_memcmp memcmp +#define osal_strdup strdup +#define osal_strncmp strncmp +#define osal_strstr strstr +#define osal_strtok strtok +#define osal_strtok_r strtok_r +#define osal_toupper toupper + +#define osal_printf printk + +/* HWP */ +#define HWP_PORT_SMI(unit, port) 0 +#define HWP_PHY_MODEL_BY_PORT(unit, port) 0 +#define HWP_PHY_ADDR(unit, port) 0 +#define HWP_PHY_BASE_MACID(unit, p) 0 +#define HWP_PORT_TRAVS_EXCEPT_CPU(unit, p) if (bcast_phyad < 0x1F && p != NULL) + + +/* RT_LOG */ +//#define RT_LOG(level, module, fmt, args...) do { printk("RT_LOG:"fmt, ## args); } while(0) +#define RT_LOG(level, module, fmt, args...) do {} while(0) +#define RT_ERR(error_code, module, fmt, args...) do {} while(0) +#define RT_INIT_ERR(error_code, module, fmt, args...) do {} while(0) +#define RT_INIT_MSG(fmt, args...) do {} while(0) + +#define phy_826xb_ctrl_set(unit, p, RTK_PHY_CTRL_MIIM_BCAST_PHYAD, bcast_phyad) 0 + +/* reg access */ +int32 phy_common_general_reg_mmd_get(uint32 unit, rtk_port_t port, uint32 mmdAddr, uint32 mmdReg, uint32 *pData); +int32 phy_common_general_reg_mmd_set(uint32 unit, rtk_port_t port, uint32 mmdAddr, uint32 mmdReg, uint32 data); + + +#endif /* __RTK_PHY_OSAL_H */ diff --git a/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/rtk_phy.c b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/rtk_phy.c new file mode 100644 index 00000000000000..2818a2736b73bc --- /dev/null +++ b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/rtk_phy.c @@ -0,0 +1,282 @@ +/* + * SPDX-License-Identifier: GPL-2.0-only + * + * Copyright (c) 2023 Realtek Semiconductor Corp. All rights reserved. + */ + +#include +#include + +#include "phy_rtl826xb_patch.h" +#include "rtk_phylib_rtl826xb.h" +#include "rtk_phylib.h" + +#define REALTEK_PHY_ID_RTL8261N 0x001CCAF3 +#define REALTEK_PHY_ID_RTL8264B 0x001CC813 + +static int rtl826xb_get_features(struct phy_device *phydev) +{ + int ret; + ret = genphy_c45_pma_read_abilities(phydev); + if (ret) + return ret; + + linkmode_or(phydev->supported, phydev->supported, PHY_BASIC_FEATURES); + + + linkmode_set_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, + phydev->supported); + linkmode_set_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT, + phydev->supported); + + /* not support 10M modes */ + linkmode_clear_bit(ETHTOOL_LINK_MODE_10baseT_Half_BIT, + phydev->supported); + linkmode_clear_bit(ETHTOOL_LINK_MODE_10baseT_Full_BIT, + phydev->supported); + + return 0; +} + +static int rtl826xb_probe(struct phy_device *phydev) +{ + struct rtk_phy_priv *priv = NULL; + + priv = devm_kzalloc(&phydev->mdio.dev, sizeof(struct rtk_phy_priv), GFP_KERNEL); + if (!priv) + { + return -ENOMEM; + } + memset(priv, 0, sizeof(struct rtk_phy_priv)); + + if (phy_rtl826xb_patch_db_init(0, phydev, &(priv->patch)) != RT_ERR_OK) + return -ENOMEM; + + priv->phytype = (phydev->drv->phy_id == REALTEK_PHY_ID_RTL8261N) ? (RTK_PHYLIB_RTL8261N) : (RTK_PHYLIB_RTL8264B); + priv->isBasePort = (phydev->drv->phy_id == REALTEK_PHY_ID_RTL8261N) ? (1) : (((phydev->mdio.addr % 4) == 0) ? (1) : (0)); + phydev->priv = priv; + + return 0; +} + +static int rtkphy_config_init(struct phy_device *phydev) +{ + int ret = 0; + switch (phydev->drv->phy_id) + { + case REALTEK_PHY_ID_RTL8261N: + case REALTEK_PHY_ID_RTL8264B: + phydev_info(phydev, "%s:%u [RTL8261N/RTL826XB] phy_id: 0x%X PHYAD:%d\n", __FUNCTION__, __LINE__, phydev->drv->phy_id, phydev->mdio.addr); + + + #if 1 /* toggle reset */ + phy_modify_mmd_changed(phydev, 30, 0x145, BIT(0) , 1); + phy_modify_mmd_changed(phydev, 30, 0x145, BIT(0) , 0); + mdelay(30); + #endif + + ret = phy_patch(0, phydev, 0, PHY_PATCH_MODE_NORMAL); + if (ret) + { + phydev_err(phydev, "%s:%u [RTL8261N/RTL826XB] patch failed!! 0x%X\n", __FUNCTION__, __LINE__, ret); + return ret; + } + #if 0 /* Debug: patch check */ + ret = phy_patch(0, phydev, 0, PHY_PATCH_MODE_CMP); + if (ret) + { + phydev_err(phydev, "%s:%u [RTL8261N/RTL826XB] phy_patch failed!! 0x%X\n", __FUNCTION__, __LINE__, ret); + return ret; + } + printk("[%s,%u] patch chk %s\n", __FUNCTION__, __LINE__, (ret == 0) ? "PASS" : "FAIL"); + #endif + #if 0 /* Debug: USXGMII*/ + { + uint32 data = 0; + rtk_phylib_826xb_sds_read(phydev, 0x07, 0x10, 15, 0, &data); + printk("[%s,%u] SDS 0x07, 0x10 : 0x%X\n", __FUNCTION__, __LINE__, data); + rtk_phylib_826xb_sds_read(phydev, 0x06, 0x12, 15, 0, &data); + printk("[%s,%u] SDS 0x06, 0x12 : 0x%X\n", __FUNCTION__, __LINE__, data); + } + { + u16 sdspage = 0x5, sdsreg = 0x0; + u16 regData = (sdspage & 0x3f) | ((sdsreg & 0x1f) << 6) | BIT(15); + u16 readData = 0; + phy_write_mmd(phydev, 30, 323, regData); + do + { + udelay(10); + readData = phy_read_mmd(phydev, 30, 323); + } while ((readData & BIT(15)) != 0); + readData = phy_read_mmd(phydev, 30, 322); + printk("[%s,%d] sds link [%s] (0x%X)\n", __FUNCTION__, __LINE__, (readData & BIT(12)) ? "UP" : "DOWN", readData); + } + #endif + + break; + default: + phydev_err(phydev, "%s:%u Unknow phy_id: 0x%X\n", __FUNCTION__, __LINE__, phydev->drv->phy_id); + return -EPERM; + } + + return ret; +} + +static int rtkphy_c45_suspend(struct phy_device *phydev) +{ + int ret = 0; + + ret = rtk_phylib_c45_power_low(phydev); + + phydev->speed = SPEED_UNKNOWN; + phydev->duplex = DUPLEX_UNKNOWN; + phydev->pause = 0; + phydev->asym_pause = 0; + + return ret; +} + +static int rtkphy_c45_resume(struct phy_device *phydev) +{ + return rtk_phylib_c45_power_normal(phydev); +} + +static int rtkphy_c45_config_aneg(struct phy_device *phydev) +{ + bool changed = false; + u16 reg = 0; + int ret = 0; + + phydev->mdix_ctrl = ETH_TP_MDI_AUTO; + 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; + + reg = 0; + if (linkmode_test_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, + phydev->advertising)) + reg |= BIT(9); + + if (linkmode_test_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT, + phydev->advertising)) + reg |= BIT(8); + + ret = phy_modify_mmd_changed(phydev, MDIO_MMD_VEND2, 0xA412, + BIT(9) | BIT(8) , reg); + if (ret < 0) + return ret; + if (ret > 0) + changed = true; + + return genphy_c45_check_and_restart_aneg(phydev, changed); +} + +static int rtkphy_c45_aneg_done(struct phy_device *phydev) +{ + return genphy_c45_aneg_done(phydev); +} + +static int rtkphy_c45_read_status(struct phy_device *phydev) +{ + int ret = 0, status = 0; + phydev->speed = SPEED_UNKNOWN; + phydev->duplex = DUPLEX_UNKNOWN; + phydev->pause = 0; + phydev->asym_pause = 0; + + ret = genphy_c45_read_link(phydev); + if (ret) + return ret; + + if (phydev->autoneg == AUTONEG_ENABLE) + { + linkmode_clear_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, + phydev->lp_advertising); + + ret = genphy_c45_read_lpa(phydev); + if (ret) + return ret; + + status = phy_read_mmd(phydev, 31, 0xA414); + if (status < 0) + return status; + linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, + phydev->lp_advertising, status & BIT(11)); + + phy_resolve_aneg_linkmode(phydev); + } + else + { + ret = genphy_c45_read_pma(phydev); + } + + /* mdix*/ + status = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_PMA_10GBT_SWAPPOL); + if (status < 0) + return status; + + switch (status & 0x3) + { + case MDIO_PMA_10GBT_SWAPPOL_ABNX | MDIO_PMA_10GBT_SWAPPOL_CDNX: + phydev->mdix = ETH_TP_MDI; + break; + + case 0: + phydev->mdix = ETH_TP_MDI_X; + break; + + default: + phydev->mdix = ETH_TP_MDI_INVALID; + break; + } + + return ret; +} + + +static struct phy_driver rtk_phy_drivers[] = { + { + PHY_ID_MATCH_EXACT(REALTEK_PHY_ID_RTL8261N), + .name = "Realtek RTL8261N", + .get_features = rtl826xb_get_features, + .config_init = rtkphy_config_init, + .probe = rtl826xb_probe, + .suspend = rtkphy_c45_suspend, + .resume = rtkphy_c45_resume, + .config_aneg = rtkphy_c45_config_aneg, + .aneg_done = rtkphy_c45_aneg_done, + .read_status = rtkphy_c45_read_status, + }, + { + PHY_ID_MATCH_EXACT(REALTEK_PHY_ID_RTL8264B), + .name = "Realtek RTL8264B", + .get_features = rtl826xb_get_features, + .config_init = rtkphy_config_init, + .probe = rtl826xb_probe, + .suspend = rtkphy_c45_suspend, + .resume = rtkphy_c45_resume, + .config_aneg = rtkphy_c45_config_aneg, + .aneg_done = rtkphy_c45_aneg_done, + .read_status = rtkphy_c45_read_status, + }, +}; + +module_phy_driver(rtk_phy_drivers); + + +static struct mdio_device_id __maybe_unused rtk_phy_tbl[] = { + { PHY_ID_MATCH_EXACT(REALTEK_PHY_ID_RTL8261N) }, + { PHY_ID_MATCH_EXACT(REALTEK_PHY_ID_RTL8264B) }, + { }, +}; + +MODULE_DEVICE_TABLE(mdio, rtk_phy_tbl); + +MODULE_AUTHOR("Realtek"); +MODULE_DESCRIPTION("Realtek PHY drivers"); +MODULE_LICENSE("GPL"); diff --git a/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/rtk_phylib.c b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/rtk_phylib.c new file mode 100644 index 00000000000000..7dd593ce72df27 --- /dev/null +++ b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/rtk_phylib.c @@ -0,0 +1,108 @@ +/* + * SPDX-License-Identifier: GPL-2.0-only + * + * Copyright (c) 2023 Realtek Semiconductor Corp. All rights reserved. + */ + +#include "rtk_phylib.h" +#include + + +/* OSAL */ + +void rtk_phylib_mdelay(uint32 msec) +{ +#if defined(RTK_PHYDRV_IN_LINUX) + mdelay(msec); +#else + osal_time_mdelay(msec); +#endif +} + + +void rtk_phylib_udelay(uint32 usec) +{ +#if defined(RTK_PHYDRV_IN_LINUX) + if (1000 <= usec) + { + mdelay(usec/1000); + usec = usec % 1000; + } + udelay(usec); +#else + osal_time_udelay(usec); +#endif +} + + +/* Register Access APIs */ +int32 rtk_phylib_mmd_write(rtk_phydev *phydev, uint32 mmd, uint32 reg, uint8 msb, uint8 lsb, uint32 data) +{ + int32 ret = 0; + uint32 mask = 0; + mask = UINT32_BITS_MASK(msb,lsb); + +#if defined(RTK_PHYDRV_IN_LINUX) + ret = phy_modify_mmd(phydev, mmd, reg, mask, data); +#else + { + uint32 rData = 0, wData = 0; + if ((msb != 15) || (lsb != 0)) + { + if ((ret = phy_common_general_reg_mmd_get(phydev->unit, phydev->port, page, reg, &rData)) != RT_ERR_OK) + return ret; + } + wData = REG32_FIELD_SET(rData, data, lsb, mask); + ret = phy_common_general_reg_mmd_set(phydev->unit, phydev->port, page, reg, wData); + } +#endif + + return ret; +} + +int32 rtk_phylib_mmd_read(rtk_phydev *phydev, uint32 mmd, uint32 reg, uint8 msb, uint8 lsb, uint32 *pData) +{ + int32 ret = 0; + uint32 rData = 0; + uint32 mask = 0; + mask = UINT32_BITS_MASK(msb,lsb); + +#if defined(RTK_PHYDRV_IN_LINUX) + rData = phy_read_mmd(phydev, mmd, reg); +#else + { + ret = phy_common_general_reg_mmd_get(phydev->unit, phydev->port, page, reg, &rData); + } +#endif + + *pData = REG32_FIELD_GET(rData, lsb, mask); + return ret; +} + +/* Function Driver */ + +int32 rtk_phylib_c45_power_normal(rtk_phydev *phydev) +{ + int32 ret = 0; + RTK_PHYLIB_ERR_CHK(rtk_phylib_mmd_write(phydev, 1, 0, 11, 11, 0)); + + return 0; +} + +int32 rtk_phylib_c45_power_low(rtk_phydev *phydev) +{ + int32 ret = 0; + RTK_PHYLIB_ERR_CHK(rtk_phylib_mmd_write(phydev, 1, 0, 11, 11, 1)); + + return 0; +} + +int32 rtk_phylib_c45_pcs_loopback(rtk_phydev *phydev, uint32 enable) +{ + int32 ret = 0; + RTK_PHYLIB_ERR_CHK(rtk_phylib_mmd_write(phydev, 3, 0, 14, 14, (enable == 0) ? 0 : 1)); + + return 0; +} + + diff --git a/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/rtk_phylib.h b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/rtk_phylib.h new file mode 100644 index 00000000000000..70eb8e48edc90f --- /dev/null +++ b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/rtk_phylib.h @@ -0,0 +1,101 @@ +/* + * SPDX-License-Identifier: GPL-2.0-only + * + * Copyright (c) 2023 Realtek Semiconductor Corp. All rights reserved. + */ + +#ifndef __RTK_PHYLIB_H +#define __RTK_PHYLIB_H + +#if defined(RTK_PHYDRV_IN_LINUX) + #include "type.h" + #include "rtk_phylib_def.h" +#else + //#include SDK headers +#endif + +#if defined(RTK_PHYDRV_IN_LINUX) + #define PR_INFO(_fmt, _args...) pr_info(_fmt, ##_args) + #define PR_DBG(_fmt, _args...) pr_debug(_fmt, ##_args) + #define PR_ERR(_fmt, _args...) pr_err("ERROR: "_fmt, ##_args) + + #define RTK_PHYLIB_ERR_FAILED (-EPERM) + #define RTK_PHYLIB_ERR_INPUT (-EINVAL) + #define RTK_PHYLIB_ERR_EXCEEDS_CAPACITY (-ENOSPC) + #define RTK_PHYLIB_ERR_TIMEOUT (-ETIME) + #define RTK_PHYLIB_ERR_ENTRY_NOTFOUND (-ENODATA) +#else + #define PR_INFO(_fmt, _args...) RT_LOG(LOG_INFO, (MOD_HAL|MOD_PHY), _fmt, ##_args) + #define PR_DBG(_fmt, _args...) RT_LOG(LOG_DEBUG, (MOD_HAL|MOD_PHY), _fmt, ##_args) + #define PR_ERR(_fmt, _args...) RT_LOG(LOG_MAJOR_ERR, (MOD_HAL|MOD_PHY), _fmt, ##_args) + + #define RTK_PHYLIB_ERR_FAILED (RT_ERR_FAILED) + #define RTK_PHYLIB_ERR_INPUT (RT_ERR_INPUT) + #define RTK_PHYLIB_ERR_EXCEEDS_CAPACITY (RT_ERR_EXCEEDS_CAPACITY) + #define RTK_PHYLIB_ERR_TIMEOUT (RT_ERR_BUSYWAIT_TIMEOUT) + #define RTK_PHYLIB_ERR_ENTRY_NOTFOUND (RT_ERR_ENTRY_NOTFOUND) +#endif + +typedef enum rtk_phylib_phy_e +{ + RTK_PHYLIB_NONE, + RTK_PHYLIB_RTL8261N, + RTK_PHYLIB_RTL8264B, + RTK_PHYLIB_END +} rtk_phylib_phy_t; + +struct rtk_phy_priv { + rtk_phylib_phy_t phytype; + uint8 isBasePort; + rt_phy_patch_db_t *patch; +}; + +#if defined(RTK_PHYDRV_IN_LINUX) + typedef struct phy_device rtk_phydev; +#else + struct rtk_phy_dev_s + { + uint32 unit; + rtk_port_t port; + + struct rtk_phy_priv *priv; + }; + typedef struct rtk_phy_dev_s rtk_phydev; +#endif + +#define RTK_PHYLIB_ERR_CHK(op)\ +do {\ + if ((ret = (op)) != 0)\ + return ret;\ +} while(0) + +#define RTK_PHYLIB_VAL_TO_BYTE_ARRAY(_val, _valbytes, _array, _start, _bytes)\ +do{\ + uint32 _i = 0;\ + for (_i = 0; _i < _bytes; _i++)\ + _array[_start+_i] = (_val >> (8* (_valbytes - _i - 1)));\ +}while(0) + +#define RTK_PHYLIB_BYTE_ARRAY_TO_VAL(_val, _array, _start, _bytes)\ +do{\ + uint32 _i = 0;\ + for (_i = 0; _i < _bytes; _i++)\ + _val = (_val << 8) | _array[_start + _i];\ +}while(0) + + +/* OSAL */ +void rtk_phylib_mdelay(uint32 msec); +void rtk_phylib_udelay(uint32 usec); + +/* Register Access APIs */ +int32 rtk_phylib_mmd_write(rtk_phydev *phydev, uint32 mmd, uint32 reg, uint8 msb, uint8 lsb, uint32 data); +int32 rtk_phylib_mmd_read(rtk_phydev *phydev, uint32 mmd, uint32 reg, uint8 msb, uint8 lsb, uint32 *pData); + +/* Function Driver */ +int32 rtk_phylib_c45_power_normal(rtk_phydev *phydev); +int32 rtk_phylib_c45_power_low(rtk_phydev *phydev); +int32 rtk_phylib_c45_pcs_loopback(rtk_phydev *phydev, uint32 enable); + + +#endif /* __RTK_PHYLIB_H */ diff --git a/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/rtk_phylib_def.h b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/rtk_phylib_def.h new file mode 100644 index 00000000000000..f49f0b547cc3e2 --- /dev/null +++ b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/rtk_phylib_def.h @@ -0,0 +1,166 @@ +/* + * SPDX-License-Identifier: GPL-2.0-only + * + * Copyright (c) 2023 Realtek Semiconductor Corp. All rights reserved. + */ +#ifndef __RTK_PHYLIB_DEF_H +#define __RTK_PHYLIB_DEF_H + +#include "type.h" + +//#define PHY_C22_MMD_PAGE 0 +#define PHY_C22_MMD_PAGE 0x0A41 +#define PHY_C22_MMD_DEV_REG 13 +#define PHY_C22_MMD_ADD_REG 14 + +/* MDIO Manageable Device(MDD) address*/ +#define PHY_MMD_PMAPMD 1 +#define PHY_MMD_PCS 3 +#define PHY_MMD_AN 7 +#define PHY_MMD_VEND1 30 /* Vendor specific 1 */ +#define PHY_MMD_VEND2 31 /* Vendor specific 2 */ + +#define BIT_0 0x00000001U +#define BIT_1 0x00000002U +#define BIT_2 0x00000004U +#define BIT_3 0x00000008U +#define BIT_4 0x00000010U +#define BIT_5 0x00000020U +#define BIT_6 0x00000040U +#define BIT_7 0x00000080U +#define BIT_8 0x00000100U +#define BIT_9 0x00000200U +#define BIT_10 0x00000400U +#define BIT_11 0x00000800U +#define BIT_12 0x00001000U +#define BIT_13 0x00002000U +#define BIT_14 0x00004000U +#define BIT_15 0x00008000U +#define BIT_16 0x00010000U +#define BIT_17 0x00020000U +#define BIT_18 0x00040000U +#define BIT_19 0x00080000U +#define BIT_20 0x00100000U +#define BIT_21 0x00200000U +#define BIT_22 0x00400000U +#define BIT_23 0x00800000U +#define BIT_24 0x01000000U +#define BIT_25 0x02000000U +#define BIT_26 0x04000000U +#define BIT_27 0x08000000U +#define BIT_28 0x10000000U +#define BIT_29 0x20000000U +#define BIT_30 0x40000000U +#define BIT_31 0x80000000U + +#define MASK_1_BITS (BIT_1 - 1) +#define MASK_2_BITS (BIT_2 - 1) +#define MASK_3_BITS (BIT_3 - 1) +#define MASK_4_BITS (BIT_4 - 1) +#define MASK_5_BITS (BIT_5 - 1) +#define MASK_6_BITS (BIT_6 - 1) +#define MASK_7_BITS (BIT_7 - 1) +#define MASK_8_BITS (BIT_8 - 1) +#define MASK_9_BITS (BIT_9 - 1) +#define MASK_10_BITS (BIT_10 - 1) +#define MASK_11_BITS (BIT_11 - 1) +#define MASK_12_BITS (BIT_12 - 1) +#define MASK_13_BITS (BIT_13 - 1) +#define MASK_14_BITS (BIT_14 - 1) +#define MASK_15_BITS (BIT_15 - 1) +#define MASK_16_BITS (BIT_16 - 1) +#define MASK_17_BITS (BIT_17 - 1) +#define MASK_18_BITS (BIT_18 - 1) +#define MASK_19_BITS (BIT_19 - 1) +#define MASK_20_BITS (BIT_20 - 1) +#define MASK_21_BITS (BIT_21 - 1) +#define MASK_22_BITS (BIT_22 - 1) +#define MASK_23_BITS (BIT_23 - 1) +#define MASK_24_BITS (BIT_24 - 1) +#define MASK_25_BITS (BIT_25 - 1) +#define MASK_26_BITS (BIT_26 - 1) +#define MASK_27_BITS (BIT_27 - 1) +#define MASK_28_BITS (BIT_28 - 1) +#define MASK_29_BITS (BIT_29 - 1) +#define MASK_30_BITS (BIT_30 - 1) +#define MASK_31_BITS (BIT_31 - 1) + +#define REG32_FIELD_SET(_data, _val, _fOffset, _fMask) ((_data & ~(_fMask)) | ((_val << (_fOffset)) & (_fMask))) +#define REG32_FIELD_GET(_data, _fOffset, _fMask) ((_data & (_fMask)) >> (_fOffset)) +#define UINT32_BITS_MASK(_mBit, _lBit) ((0xFFFFFFFF >> (31 - _mBit)) ^ ((1 << _lBit) - 1)) + +typedef struct phy_device * rtk_port_t; + +#if 1 /* ss\sdk\include\hal\phy\phydef.h */ +/* unified patch format */ +typedef enum rtk_phypatch_type_e +{ + PHY_PATCH_TYPE_NONE = 0, + PHY_PATCH_TYPE_TOP = 1, + PHY_PATCH_TYPE_SDS, + PHY_PATCH_TYPE_AFE, + PHY_PATCH_TYPE_UC, + PHY_PATCH_TYPE_UC2, + PHY_PATCH_TYPE_NCTL0, + PHY_PATCH_TYPE_NCTL1, + PHY_PATCH_TYPE_NCTL2, + PHY_PATCH_TYPE_ALGXG, + PHY_PATCH_TYPE_ALG1G, + PHY_PATCH_TYPE_NORMAL, + PHY_PATCH_TYPE_DATARAM, + PHY_PATCH_TYPE_RTCT, + PHY_PATCH_TYPE_END +} rtk_phypatch_type_t; + +#define RTK_PATCH_TYPE_FLOW(_id) (PHY_PATCH_TYPE_END + _id) +#define RTK_PATCH_TYPE_FLOWID_MAX PHY_PATCH_TYPE_END +#define RTK_PATCH_SEQ_MAX ( PHY_PATCH_TYPE_END + RTK_PATCH_TYPE_FLOWID_MAX -1) + +typedef struct rtk_hwpatch_s +{ + uint8 patch_op; + uint8 portmask; + uint16 pagemmd; + uint16 addr; + uint8 msb; + uint8 lsb; + uint16 data; + uint8 compare_op; + uint16 sram_p; + uint16 sram_rr; + uint16 sram_rw; + uint16 sram_a; +} rtk_hwpatch_t; + +typedef struct rtk_hwpatch_data_s +{ + rtk_hwpatch_t *conf; + uint32 size; +} rtk_hwpatch_data_t; + +typedef struct rtk_hwpatch_seq_s +{ + uint8 patch_type; + union + { + rtk_hwpatch_data_t data; + uint8 flow_id; + } patch; +} rtk_hwpatch_seq_t; + +typedef struct rt_phy_patch_db_s +{ + /* patch operation */ + int32 (*fPatch_op)(uint32 unit, rtk_port_t port, uint8 portOffset, rtk_hwpatch_t *pPatch_data, uint8 patch_mode); + int32 (*fPatch_flow)(uint32 unit, rtk_port_t port, uint8 portOffset, uint8 patch_flow, uint8 patch_mode); + + /* patch data */ + rtk_hwpatch_seq_t seq_table[RTK_PATCH_SEQ_MAX]; + rtk_hwpatch_seq_t cmp_table[RTK_PATCH_SEQ_MAX]; + +} rt_phy_patch_db_t; +#endif + + + +#endif /* __RTK_PHYLIB_DEF_H */ diff --git a/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/rtk_phylib_rtl826xb.c b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/rtk_phylib_rtl826xb.c new file mode 100644 index 00000000000000..1c33846a70fc46 --- /dev/null +++ b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/rtk_phylib_rtl826xb.c @@ -0,0 +1,57 @@ +/* + * SPDX-License-Identifier: GPL-2.0-only + * + * Copyright (c) 2023 Realtek Semiconductor Corp. All rights reserved. + */ + +#include "rtk_phylib_rtl826xb.h" + +/* Indirect Register Access APIs */ +int rtk_phylib_826xb_sds_read(rtk_phydev *phydev, uint32 page, uint32 reg, uint8 msb, uint8 lsb, uint32 *pData) +{ + int32 ret = 0; + uint32 rData = 0; + uint32 op = (page & 0x3f) | ((reg & 0x1f) << 6) | (0x8000); + uint32 i = 0; + uint32 mask = 0; + mask = UINT32_BITS_MASK(msb,lsb); + + RTK_PHYLIB_ERR_CHK(rtk_phylib_mmd_write(phydev, 30, 323, 15, 0, op)); + + for (i = 0; i < 10; i++) + { + RTK_PHYLIB_ERR_CHK(rtk_phylib_mmd_read(phydev, 30, 323, 15, 15, &rData)); + if (rData == 0) + { + break; + } + rtk_phylib_udelay(10); + } + if (i == 10) + { + return -1; + } + + RTK_PHYLIB_ERR_CHK(rtk_phylib_mmd_read(phydev, 30, 322, 15, 0, &rData)); + *pData = REG32_FIELD_GET(rData, lsb, mask); + + return ret; +} + +int rtk_phylib_826xb_sds_write(rtk_phydev *phydev, uint32 page, uint32 reg, uint8 msb, uint8 lsb, uint32 data) +{ + int32 ret = 0; + uint32 wData = 0, rData = 0; + uint32 op = (page & 0x3f) | ((reg & 0x1f) << 6) | (0x8800); + uint32 mask = 0; + mask = UINT32_BITS_MASK(msb,lsb); + + RTK_PHYLIB_ERR_CHK(rtk_phylib_826xb_sds_read(phydev, page, reg, 15, 0, &rData)); + + wData = REG32_FIELD_SET(rData, data, lsb, mask); + + RTK_PHYLIB_ERR_CHK(rtk_phylib_mmd_write(phydev, 30, 321, 15, 0, wData)); + RTK_PHYLIB_ERR_CHK(rtk_phylib_mmd_write(phydev, 30, 323, 15, 0, op)); + + return ret; +} diff --git a/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/rtk_phylib_rtl826xb.h b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/rtk_phylib_rtl826xb.h new file mode 100644 index 00000000000000..9f827d4ba25469 --- /dev/null +++ b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/rtk_phylib_rtl826xb.h @@ -0,0 +1,19 @@ +/* + * SPDX-License-Identifier: GPL-2.0-only + * + * Copyright (c) 2023 Realtek Semiconductor Corp. All rights reserved. + */ + +#ifndef __RTK_PHYLIB_RTL826XB_H +#define __RTK_PHYLIB_RTL826XB_H + +#if defined(RTK_PHYDRV_IN_LINUX) + #include "rtk_phylib.h" +#else + //#include SDK headers +#endif + +int rtk_phylib_826xb_sds_read(rtk_phydev *phydev, uint32 page, uint32 reg, uint8 msb, uint8 lsb, uint32 *pData); +int rtk_phylib_826xb_sds_write(rtk_phydev *phydev, uint32 page, uint32 reg, uint8 msb, uint8 lsb, uint32 data); + +#endif /* __RTK_PHYLIB_RTL826XB_H */ diff --git a/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/type.h b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/type.h new file mode 100644 index 00000000000000..98d7e15e1e4bc9 --- /dev/null +++ b/target/linux/mediatek/files-6.6/drivers/net/phy/rtl8261n/type.h @@ -0,0 +1,117 @@ +/* + * SPDX-License-Identifier: GPL-2.0-only + * + * Copyright (c) 2023 Realtek Semiconductor Corp. All rights reserved. + */ + +#ifndef __COMMON_TYPE_H__ +#define __COMMON_TYPE_H__ + +/* + * Symbol Definition + */ + +#define USING_RTSTK_PKT_AS_RAIL + + +#ifndef NULL +#define NULL 0 +#endif + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef ETHER_ADDR_LEN +#define ETHER_ADDR_LEN 6 +#endif + +#ifndef IP6_ADDR_LEN +#define IP6_ADDR_LEN 16 +#endif + + +/* + * Data Type Declaration + */ +#ifndef uint64 +typedef unsigned long long uint64; +#endif + +#ifndef int64 +typedef signed long long int64; +#endif + +#ifndef uint32 +typedef unsigned int uint32; +#endif + +#ifndef int32 +typedef signed int int32; +#endif + +#ifndef uint16 +typedef unsigned short uint16; +#endif + +#ifndef int16 +typedef signed short int16; +#endif + +#ifndef uint8 +typedef unsigned char uint8; +#endif + +#ifndef int8 +typedef signed char int8; +#endif + +//#define CONFIG_SDK_WORDSIZE_64 /* not ready */ +#ifdef CONFIG_SDK_WORDSIZE_64 + typedef long int intptr; + typedef unsigned long int uintptr; +#else + typedef int intptr; + typedef unsigned int uintptr; +#endif + + +#ifndef ipaddr_t +typedef uint32 ipaddr_t; /* ipv4 address type */ +#endif + +/* configuration mode type */ +typedef enum rtk_enable_e +{ + DISABLED = 0, + ENABLED, + RTK_ENABLE_END +} rtk_enable_t; + +/* initial state of module */ +typedef enum init_state_e +{ + INIT_NOT_COMPLETED = 0, + INIT_COMPLETED, + INIT_STATE_END +} init_state_t; + +/* ethernet address type */ +typedef struct rtk_mac_s +{ + uint8 octet[ETHER_ADDR_LEN]; +} rtk_mac_t; + +typedef uint32 osal_time_t; +typedef uint32 osal_usecs_t; + +/* + * Macro Definition + */ + +#endif /* __COMMON_TYPE_H__ */ + diff --git a/target/linux/mediatek/filogic/config-6.6 b/target/linux/mediatek/filogic/config-6.6 index 7cf045ade2a5e2..ba472b6ced78af 100644 --- a/target/linux/mediatek/filogic/config-6.6 +++ b/target/linux/mediatek/filogic/config-6.6 @@ -428,6 +428,7 @@ CONFIG_RPS=y CONFIG_RTC_CLASS=y CONFIG_RTC_DRV_MT7622=y CONFIG_RTC_I2C_AND_SPI=y +CONFIG_RTL8261N_PHY=y # CONFIG_RTL8367S_GSW is not set CONFIG_RWSEM_SPIN_ON_OWNER=y CONFIG_SCHED_MC=y diff --git a/target/linux/mediatek/mt7622/config-6.6 b/target/linux/mediatek/mt7622/config-6.6 index 138eb2aaca0e04..e4a9e4b9cb66e9 100644 --- a/target/linux/mediatek/mt7622/config-6.6 +++ b/target/linux/mediatek/mt7622/config-6.6 @@ -424,6 +424,7 @@ CONFIG_RPS=y CONFIG_RTC_CLASS=y CONFIG_RTC_DRV_MT7622=y CONFIG_RTC_I2C_AND_SPI=y +# CONFIG_RTL8261N_PHY is not set CONFIG_RTL8367S_GSW=y CONFIG_RWSEM_SPIN_ON_OWNER=y CONFIG_SCHED_MC=y diff --git a/target/linux/mediatek/mt7623/config-6.6 b/target/linux/mediatek/mt7623/config-6.6 index baa31b465df9ad..d04188f20cd6d0 100644 --- a/target/linux/mediatek/mt7623/config-6.6 +++ b/target/linux/mediatek/mt7623/config-6.6 @@ -541,6 +541,7 @@ CONFIG_RTC_CLASS=y # CONFIG_RTC_DRV_MT7622 is not set CONFIG_RTC_I2C_AND_SPI=y CONFIG_RTC_MC146818_LIB=y +# CONFIG_RTL8261N_PHY is not set # CONFIG_RTL8367S_GSW is not set CONFIG_RWSEM_SPIN_ON_OWNER=y # CONFIG_SERIAL_8250_DMA is not set diff --git a/target/linux/mediatek/mt7629/config-6.6 b/target/linux/mediatek/mt7629/config-6.6 index 5169acb99f0033..384311dc7107cf 100644 --- a/target/linux/mediatek/mt7629/config-6.6 +++ b/target/linux/mediatek/mt7629/config-6.6 @@ -301,6 +301,7 @@ CONFIG_REGMAP_MMIO=y CONFIG_RESET_CONTROLLER=y CONFIG_RFS_ACCEL=y CONFIG_RPS=y +# CONFIG_RTL8261N_PHY is not set # CONFIG_RTL8367S_GSW is not set CONFIG_RWSEM_SPIN_ON_OWNER=y CONFIG_SCSI=y diff --git a/target/linux/mediatek/patches-6.6/735-net-phy-realtek-rtl8261n.patch b/target/linux/mediatek/patches-6.6/735-net-phy-realtek-rtl8261n.patch new file mode 100644 index 00000000000000..3612b521e1c5fe --- /dev/null +++ b/target/linux/mediatek/patches-6.6/735-net-phy-realtek-rtl8261n.patch @@ -0,0 +1,21 @@ +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -334,6 +334,8 @@ config REALTEK_PHY + help + Supports the Realtek 821x PHY. + ++source "drivers/net/phy/rtl8261n/Kconfig" ++ + config RENESAS_PHY + tristate "Renesas PHYs" + help +--- a/drivers/net/phy/Makefile ++++ b/drivers/net/phy/Makefile +@@ -85,6 +85,7 @@ obj-$(CONFIG_ADIN_PHY) += adin.o + obj-y += qcom/ + obj-$(CONFIG_QSEMI_PHY) += qsemi.o + obj-$(CONFIG_REALTEK_PHY) += realtek.o ++obj-y += rtl8261n/ + obj-$(CONFIG_RENESAS_PHY) += uPD60620.o + obj-$(CONFIG_ROCKCHIP_PHY) += rockchip.o + obj-$(CONFIG_SMSC_PHY) += smsc.o From ab5c090077df21afa6046aee50678862814e22e0 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Tue, 29 Oct 2024 13:40:11 +0100 Subject: [PATCH 015/877] mediatek: add support for swapping the polarity on usxgmii interfaces This patch comes from the MTK SDK. Signed-off-by: John Crispin --- ...pcs-mtk_usxgmii-add-polarity-control.patch | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 target/linux/mediatek/patches-6.6/736-net-pcs-mtk_usxgmii-add-polarity-control.patch diff --git a/target/linux/mediatek/patches-6.6/736-net-pcs-mtk_usxgmii-add-polarity-control.patch b/target/linux/mediatek/patches-6.6/736-net-pcs-mtk_usxgmii-add-polarity-control.patch new file mode 100644 index 00000000000000..678761990b85cc --- /dev/null +++ b/target/linux/mediatek/patches-6.6/736-net-pcs-mtk_usxgmii-add-polarity-control.patch @@ -0,0 +1,58 @@ +diff --git a/drivers/net/pcs/pcs-mtk-usxgmii.c b/drivers/net/pcs/pcs-mtk-usxgmii.c +index 9af9035..9caab92 100644 +--- a/drivers/net/pcs/pcs-mtk-usxgmii.c ++++ b/drivers/net/pcs/pcs-mtk-usxgmii.c +@@ -52,6 +52,12 @@ + #define USXGMII_LPA GENMASK(15, 0) + #define USXGMII_LPA_LATCH BIT(31) + ++/* Register to control PCS polarity */ ++#define RG_PHY_TOP_CTRL0 0x82C ++#define USXGMII_PN_SWAP_MASK GENMASK(1, 0) ++#define USXGMII_PN_SWAP_RX BIT(1) ++#define USXGMII_PN_SWAP_TX BIT(0) ++ + /* Register to read PCS link status */ + #define RG_PCS_RX_STATUS0 0x904 + #define RG_PCS_RX_STATUS_UPDATE BIT(16) +@@ -74,6 +80,7 @@ struct mtk_usxgmii_pcs { + struct clk *clk; + struct reset_control *reset; + phy_interface_t interface; ++ unsigned int polarity; + unsigned int neg_mode; + struct list_head node; + }; +@@ -155,6 +162,10 @@ static int mtk_usxgmii_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode + + mtk_usxgmii_reset(mpcs); + ++ /* Configure the interface polarity */ ++ mtk_m32(mpcs, RG_PHY_TOP_CTRL0, ++ USXGMII_PN_SWAP_MASK, mpcs->polarity); ++ + /* Setup USXGMII AN ctrl */ + mtk_m32(mpcs, RG_PCS_AN_CTRL0, + USXGMII_AN_SYNC_CNT | USXGMII_AN_ENABLE, +@@ -332,6 +343,7 @@ static const struct phylink_pcs_ops mtk_usxgmii_pcs_ops = { + static int mtk_usxgmii_probe(struct platform_device *pdev) + { + struct device *dev = &pdev->dev; ++ struct device_node *np = dev->of_node; + struct mtk_usxgmii_pcs *mpcs; + + mpcs = devm_kzalloc(dev, sizeof(*mpcs), GFP_KERNEL); +@@ -342,6 +354,13 @@ static int mtk_usxgmii_probe(struct platform_device *pdev) + if (IS_ERR(mpcs->base)) + return PTR_ERR(mpcs->base); + ++ if (of_property_read_bool(np->parent, "mediatek,pnswap")) ++ mpcs->polarity = USXGMII_PN_SWAP_TX | USXGMII_PN_SWAP_RX; ++ else if (of_property_read_bool(np, "mediatek,pnswap-tx")) ++ mpcs->polarity = USXGMII_PN_SWAP_TX; ++ else if (of_property_read_bool(np, "mediatek,pnswap-rx")) ++ mpcs->polarity = USXGMII_PN_SWAP_RX; ++ + mpcs->dev = dev; + mpcs->pcs.ops = &mtk_usxgmii_pcs_ops; + mpcs->pcs.poll = true; From f4b62a6b28193570d803b50fd47e48f09cbfefe8 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Sat, 21 Sep 2024 09:48:47 +0200 Subject: [PATCH 016/877] mediatek: filogic: add Arcadyan Mozart platform * Mediatek MT7988A (4x Cortex-A73, up to 1.8 GHz clock speed) * 8 GiB eMMC * 4 GiB DDR4 RAM * 2x 10000M + 1x 1000M ports * MT7996 Tri-band (2.4G, 5G, 6G) 4T4R 802.11be Wi-Fi * 2 buttons (Reset, WPS) * 2x LED for each GMAC * USB-C PD power input Signed-off-by: John Crispin --- .../mediatek/dts/mt7988a-arcadyan-mozart.dts | 336 ++++++++++++++++++ .../filogic/base-files/etc/board.d/02_network | 3 + .../base-files/lib/upgrade/platform.sh | 2 + target/linux/mediatek/image/filogic.mk | 24 ++ 4 files changed, 365 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7988a-arcadyan-mozart.dts diff --git a/target/linux/mediatek/dts/mt7988a-arcadyan-mozart.dts b/target/linux/mediatek/dts/mt7988a-arcadyan-mozart.dts new file mode 100644 index 00000000000000..8b5f0526b2098f --- /dev/null +++ b/target/linux/mediatek/dts/mt7988a-arcadyan-mozart.dts @@ -0,0 +1,336 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/dts-v1/; +#include "mt7988a-rfb.dts" +#include +#include +#include + +/ { + compatible = "arcadyan,mozart", "mediatek,mt7988a"; + model = "MediaTek / Arcadyan - Mozart"; + + aliases { + serial0 = &uart0; + led-boot = &led_status_blue; + led-failsafe = &led_status_red; + led-running = &led_status_green; + led-upgrade = &led_status_green; + }; + + chosen { + rootdisk = <&emmc_rootfs>; + }; + + gpio-leds { + compatible = "gpio-leds"; + + wifi_white { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&pio 68 GPIO_ACTIVE_HIGH>; + }; + + led_status_red: wifi_red { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&pio 29 GPIO_ACTIVE_HIGH>; + }; + + led_status_green: wifi_green { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&pio 30 GPIO_ACTIVE_HIGH>; + }; + + led_status_blue: wifi_blue { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&pio 31 GPIO_ACTIVE_HIGH>; + }; + }; + + keys { + compatible = "gpio-keys"; + + button-reset { + label = "reset"; + linux,code = ; + gpios = <&pio 13 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&pio { + mdio0_pins: mdio0-pins { + mux { + function = "eth"; + groups = "mdc_mdio0"; + }; + + conf { + groups = "mdc_mdio0"; + drive-strength = ; + }; + }; + + spic_pins: spi1-pins { + mux { + function = "spi"; + groups = "spi1"; + }; + }; +}; + +&usxgmiisys0 { + mediatek,pnswap-rx; +}; + +&usxgmiisys1 { + mediatek,pnswap-rx; +}; + +&mdio_bus { + #address-cells = <1>; + #size-cells = <0>; + reset-gpios = <&pio 72 GPIO_ACTIVE_LOW>; + reset-assert-us = <100000>; + reset-deassert-us = <100000>; + + phy0: ethernet-phy@0 { + reg = <0>; + compatible = "ethernet-phy-ieee802.3-c45"; + }; + + phy8: ethernet-phy@8 { + reg = <8>; + compatible = "ethernet-phy-ieee802.3-c45"; + }; +}; + +&gmac0 { + nvmem-cells = <&macaddr_factory_4 3>; + nvmem-cell-names = "mac-address"; +}; + +&gmac1 { + phy-mode = "usxgmii"; + phy-connection-type = "usxgmii"; + phy = <&phy0>; + nvmem-cells = <&macaddr_factory_4 4>; + nvmem-cell-names = "mac-address"; + status = "okay"; +}; + +&gmac2 { + phy-mode = "usxgmii"; + phy-connection-type = "usxgmii"; + phy = <&phy8>; + nvmem-cells = <&macaddr_factory_4 5>; + nvmem-cell-names = "mac-address"; + status = "okay"; +}; + +&switch { + /delete-node/ports; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + gsw_port0: port@0 { + reg = <0>; + label = "lan0"; + phy-mode = "internal"; + phy-handle = <&gsw_phy0>; + }; + + port@6 { + reg = <6>; + ethernet = <&gmac0>; + phy-mode = "internal"; + + fixed-link { + speed = <10000>; + full-duplex; + pause; + }; + }; + }; +}; + +&i2c1 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c1_pins>; + clock-frequency = <100000>; + status = "okay"; + + icp201xx@63{ + compatible = "invensense,icp201xx"; + reg = <0x63>; + #address-cells = <1>; + #size-cells = <0>; + }; +}; + +&uart1 { + status = "okay"; +}; + +&fan { + pwms = <&pwm 1 40000 0>; + status = "okay"; +}; + +&pwm { + status = "okay"; +}; + +&spi1 { + pinctrl-names = "default"; + /* pin shared with snfi */ + pinctrl-0 = <&spic_pins>; + status = "disabled"; +}; + +&mmc0 { + 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"; + + card@0 { + compatible = "mmc-card"; + reg = <0>; + + block { + compatible = "block-device"; + partitions { + block-partition-env { + partname = "u-boot-env"; + nvmem-layout { + compatible = "u-boot,env-layout"; + }; + }; + + emmc_rootfs: block-partition-production { + partname = "production"; + }; + + block-partition-factory { + partname = "factory"; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x1e00>; + }; + + macaddr_factory_4: macaddr@a { + compatible = "mac-base"; + reg = <0x4 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + }; + }; + }; +}; + +&cpu_thermal { + /delete-node/cooling-maps; + /delete-node/trips; + + 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 = <110000>; + hysteresis = <2000>; + type = "active"; + }; + + cpu_trip_active_med: active-med { + temperature = <80000>; + hysteresis = <2000>; + type = "active"; + }; + + cpu_trip_active_low: active-low { + temperature = <60000>; + hysteresis = <2000>; + type = "active"; + }; + + cpu_trip_active_silent: active-silent { + temperature = <40000>; + hysteresis = <2000>; + type = "active"; + }; + }; + + 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 { + /* active: set fan to cooling level 1 */ + cooling-device = <&fan 1 1>; + trip = <&cpu_trip_active_low>; + }; + + cpu-active-silent { + /* active: set fan to cooling level 0 */ + cooling-device = <&fan 0 0>; + trip = <&cpu_trip_active_silent>; + }; + }; +}; + +&pcie0 { + status = "okay"; + + pcie@0,0 { + reg = <0x0000 0 0 0 0>; + + mt7996@1,0 { + reg = <0x0000 0 0 0 0>; + nvmem-cells = <&eeprom_factory_0>; + 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 af5c4ceafee131..fff39006da82bc 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 @@ -21,6 +21,9 @@ mediatek_setup_interfaces() acer,predator-w6) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 game" eth1 ;; + arcadyan,mozart) + ucidef_set_interfaces_lan_wan "lan0 eth1" eth2 + ;; asus,rt-ax59u|\ cetron,ct3003|\ confiabits,mt7981|\ 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 edc045656639c2..7fe2d29d31d207 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -90,6 +90,7 @@ platform_do_upgrade() { fit_do_upgrade "$1" ;; acer,predator-w6|\ + arcadyan,mozart|\ smartrg,sdg-8612|\ smartrg,sdg-8614|\ smartrg,sdg-8622|\ @@ -202,6 +203,7 @@ platform_copy_config() { fi ;; acer,predator-w6|\ + arcadyan,mozart|\ glinet,gl-mt2500|\ glinet,gl-mt6000|\ glinet,gl-x3000|\ diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 37fe740c31d4e3..5dfde755a0125b 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -254,6 +254,30 @@ define Device/asus_tuf-ax4200 endef TARGET_DEVICES += asus_tuf-ax4200 +define Device/arcadyan_mozart + DEVICE_VENDOR := Arcadyan + DEVICE_MODEL := Mozart + DEVICE_DTS := mt7988a-arcadyan-mozart + DEVICE_DTS_DIR := ../dts + DEVICE_DTC_FLAGS := --pad 4096 + DEVICE_DTS_LOADADDR := 0x45f00000 + DEVICE_PACKAGES := kmod-hwmon-pwmfan e2fsprogs f2fsck mkf2fs kmod-mt7996-firmware + 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 + 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-preloader.bin emmc-bl31-uboot.fip emmc-gpt.bin + ARTIFACT/emmc-gpt.bin := mt798x-gpt emmc + ARTIFACT/emmc-preloader.bin := mt7988-bl2 emmc-comb + ARTIFACT/emmc-bl31-uboot.fip := mt7988-bl31-uboot arcadyan_mozart + SUPPORTED_DEVICES += arcadyan,mozart +endef +TARGET_DEVICES += arcadyan_mozart + define Device/asus_tuf-ax6000 DEVICE_VENDOR := ASUS DEVICE_MODEL := TUF-AX6000 From de3dfe57148367f2a580b45680b8495ee75960c6 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Thu, 31 Oct 2024 21:08:10 +0000 Subject: [PATCH 017/877] uboot-mediatek: import patches improving menu navigation Using the arrow keys to navigate the U-Boot menu often leads to being dropped into the U-Boot shell unexpectedly. This can be prevented in most cases by improving the logic to detect the arrow key ESC sequence and only reprinting the menu if actually needed. Also enable CONFIG_SERIAL_RX_BUFFER for all boards as it helps preventing the remaining cases. Signed-off-by: Daniel Golle --- package/boot/uboot-mediatek/Makefile | 3 +- ...ic-checking-whether-ESC-key-is-press.patch | 63 ++++++++++ ...-to-check-if-menu-needs-to-be-reprin.patch | 112 ++++++++++++++++++ .../012-bootmenu-add-reprint-check.patch | 75 ++++++++++++ ...d-ability-to-select-item-by-shortkey.patch | 45 +++---- .../211-cmd-bootmenu-custom-title.patch | 8 +- 6 files changed, 279 insertions(+), 27 deletions(-) create mode 100644 package/boot/uboot-mediatek/patches/010-menu-fix-the-logic-checking-whether-ESC-key-is-press.patch create mode 100644 package/boot/uboot-mediatek/patches/011-menu-add-support-to-check-if-menu-needs-to-be-reprin.patch create mode 100644 package/boot/uboot-mediatek/patches/012-bootmenu-add-reprint-check.patch diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile index fe8d61e56c07b5..34857653688117 100644 --- a/package/boot/uboot-mediatek/Makefile +++ b/package/boot/uboot-mediatek/Makefile @@ -844,7 +844,8 @@ UBOOT_TARGETS := \ UBOOT_CUSTOMIZE_CONFIG := \ --disable TOOLS_KWBIMAGE \ --disable TOOLS_LIBCRYPTO \ - --disable TOOLS_MKEFICAPSULE + --disable TOOLS_MKEFICAPSULE \ + --enable SERIAL_RX_BUFFER ifdef CONFIG_TARGET_mediatek UBOOT_MAKE_FLAGS += $(UBOOT_IMAGE:.fip=.bin) diff --git a/package/boot/uboot-mediatek/patches/010-menu-fix-the-logic-checking-whether-ESC-key-is-press.patch b/package/boot/uboot-mediatek/patches/010-menu-fix-the-logic-checking-whether-ESC-key-is-press.patch new file mode 100644 index 00000000000000..f3589c46220c4c --- /dev/null +++ b/package/boot/uboot-mediatek/patches/010-menu-fix-the-logic-checking-whether-ESC-key-is-press.patch @@ -0,0 +1,63 @@ +From 72b4ba8417d33516b8489bac3c90dbbbf781a3d2 Mon Sep 17 00:00:00 2001 +From: Weijie Gao +Date: Tue, 29 Oct 2024 17:47:10 +0800 +Subject: [PATCH 1/3] menu: fix the logic checking whether ESC key is pressed + +It's observed that the bootmenu on a serial console sometimes +incorrectly quitted with superfluous characters filled to command +line input: + +> *** U-Boot Boot Menu *** +> +> 1. Startup system (Default) +> 2. Upgrade firmware +> 3. Upgrade ATF BL2 +> 4. Upgrade ATF FIP +> 5. Load image +> 0. U-Boot console +> +> +> Press UP/DOWN to move, ENTER to select, ESC to quit +>MT7988> [B + +Analysis shows it was caused by the wrong logic of bootmenu_loop: + +At first the bootmenu_loop received the first ESC char correctly. + +However, during the second call to bootmenu_loop, there's no data +in the UART Rx FIFO. Due to the low baudrate, the second char of +the down array key sequence hasn't be fully received. + +But bootmenu_loop just did a mdelay(10), and then treated it as a +single ESC key press event. It didn't even try tstc() again after +the 10ms timeout. + +This patch fixes this issue by letting bootmenu_loop check tstc() +twice. + +Tested-By: E Shattow +Signed-off-by: Weijie Gao +--- + common/menu.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/common/menu.c ++++ b/common/menu.c +@@ -525,14 +525,15 @@ enum bootmenu_key bootmenu_loop(struct b + struct cli_ch_state *cch) + { + enum bootmenu_key key; +- int c; ++ int c, errchar = 0; + + c = cli_ch_process(cch, 0); + if (!c) { + while (!c && !tstc()) { + schedule(); + mdelay(10); +- c = cli_ch_process(cch, -ETIMEDOUT); ++ c = cli_ch_process(cch, errchar); ++ errchar = -ETIMEDOUT; + } + if (!c) { + c = getchar(); diff --git a/package/boot/uboot-mediatek/patches/011-menu-add-support-to-check-if-menu-needs-to-be-reprin.patch b/package/boot/uboot-mediatek/patches/011-menu-add-support-to-check-if-menu-needs-to-be-reprin.patch new file mode 100644 index 00000000000000..9d356ff0b4c257 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/011-menu-add-support-to-check-if-menu-needs-to-be-reprin.patch @@ -0,0 +1,112 @@ +From f1cbdd3330f0055dfbff0ef7d86276c4cc3cff2a Mon Sep 17 00:00:00 2001 +From: Weijie Gao +Date: Tue, 29 Oct 2024 17:47:16 +0800 +Subject: [PATCH 2/3] menu: add support to check if menu needs to be reprinted + +This patch adds a new callback named need_reprint for menu. +The need_reprint will be called before printing the menu. If the +callback exists and returns FALSE, menu printing will be canceled. + +This is very useful if the menu was not changed. It can save time +for serial-based menu to handle more input data. + +Signed-off-by: Weijie Gao +--- + boot/pxe_utils.c | 2 +- + cmd/bootmenu.c | 2 +- + cmd/eficonfig.c | 2 +- + common/menu.c | 11 +++++++++++ + include/menu.h | 1 + + 5 files changed, 15 insertions(+), 3 deletions(-) + +--- a/boot/pxe_utils.c ++++ b/boot/pxe_utils.c +@@ -1449,7 +1449,7 @@ static struct menu *pxe_menu_to_menu(str + * Create a menu and add items for all the labels. + */ + m = menu_create(cfg->title, DIV_ROUND_UP(cfg->timeout, 10), +- cfg->prompt, NULL, label_print, NULL, NULL); ++ cfg->prompt, NULL, label_print, NULL, NULL, NULL); + if (!m) + return NULL; + +--- a/cmd/bootmenu.c ++++ b/cmd/bootmenu.c +@@ -506,7 +506,7 @@ static enum bootmenu_ret bootmenu_show(i + + menu = menu_create(NULL, bootmenu->delay, 1, menu_display_statusline, + bootmenu_print_entry, bootmenu_choice_entry, +- bootmenu); ++ NULL, bootmenu); + if (!menu) { + bootmenu_destroy(bootmenu); + return BOOTMENU_RET_FAIL; +--- a/cmd/eficonfig.c ++++ b/cmd/eficonfig.c +@@ -443,7 +443,7 @@ efi_status_t eficonfig_process_common(st + efi_menu->menu_desc = menu_desc; + + menu = menu_create(NULL, 0, 1, display_statusline, item_data_print, +- item_choice, efi_menu); ++ item_choice, NULL, efi_menu); + if (!menu) + return EFI_INVALID_PARAMETER; + +--- a/common/menu.c ++++ b/common/menu.c +@@ -43,6 +43,7 @@ struct menu { + void (*display_statusline)(struct menu *); + void (*item_data_print)(void *); + char *(*item_choice)(void *); ++ bool (*need_reprint)(void *); + void *item_choice_data; + struct list_head items; + int item_cnt; +@@ -117,6 +118,11 @@ static inline void *menu_item_destroy(st + */ + static inline void menu_display(struct menu *m) + { ++ if (m->need_reprint) { ++ if (!m->need_reprint(m->item_choice_data)) ++ return; ++ } ++ + if (m->title) { + puts(m->title); + putc('\n'); +@@ -362,6 +368,9 @@ int menu_item_add(struct menu *m, char * + * item. Returns a key string corresponding to the chosen item or NULL if + * no item has been selected. + * ++ * need_reprint - If not NULL, will be called before printing the menu. ++ * Returning FALSE means the menu does not need reprint. ++ * + * item_choice_data - Will be passed as the argument to the item_choice function + * + * Returns a pointer to the menu if successful, or NULL if there is +@@ -371,6 +380,7 @@ struct menu *menu_create(char *title, in + void (*display_statusline)(struct menu *), + void (*item_data_print)(void *), + char *(*item_choice)(void *), ++ bool (*need_reprint)(void *), + void *item_choice_data) + { + struct menu *m; +@@ -386,6 +396,7 @@ struct menu *menu_create(char *title, in + m->display_statusline = display_statusline; + m->item_data_print = item_data_print; + m->item_choice = item_choice; ++ m->need_reprint = need_reprint; + m->item_choice_data = item_choice_data; + m->item_cnt = 0; + +--- a/include/menu.h ++++ b/include/menu.h +@@ -13,6 +13,7 @@ struct menu *menu_create(char *title, in + void (*display_statusline)(struct menu *), + void (*item_data_print)(void *), + char *(*item_choice)(void *), ++ bool (*need_reprint)(void *), + void *item_choice_data); + int menu_default_set(struct menu *m, char *item_key); + int menu_get_choice(struct menu *m, void **choice); diff --git a/package/boot/uboot-mediatek/patches/012-bootmenu-add-reprint-check.patch b/package/boot/uboot-mediatek/patches/012-bootmenu-add-reprint-check.patch new file mode 100644 index 00000000000000..8f4db3a82eb8a5 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/012-bootmenu-add-reprint-check.patch @@ -0,0 +1,75 @@ +From 702752cfae954648d6133bdff19283343b3339ef Mon Sep 17 00:00:00 2001 +From: Weijie Gao +Date: Tue, 29 Oct 2024 17:47:22 +0800 +Subject: [PATCH 3/3] bootmenu: add reprint check + +Record the last active menu item and check if it equals to the +current selected item before reprint. + +Signed-off-by: Weijie Gao +--- + cmd/bootmenu.c | 16 +++++++++++++++- + include/menu.h | 1 + + 2 files changed, 16 insertions(+), 1 deletion(-) + +--- a/cmd/bootmenu.c ++++ b/cmd/bootmenu.c +@@ -103,11 +103,13 @@ static char *bootmenu_choice_entry(void + + switch (key) { + case BKEY_UP: ++ menu->last_active = menu->active; + if (menu->active > 0) + --menu->active; + /* no menu key selected, regenerate menu */ + return NULL; + case BKEY_DOWN: ++ menu->last_active = menu->active; + if (menu->active < menu->count - 1) + ++menu->active; + /* no menu key selected, regenerate menu */ +@@ -133,6 +135,17 @@ static char *bootmenu_choice_entry(void + return NULL; + } + ++static bool bootmenu_need_reprint(void *data) ++{ ++ struct bootmenu_data *menu = data; ++ bool need_reprint; ++ ++ need_reprint = menu->last_active != menu->active; ++ menu->last_active = menu->active; ++ ++ return need_reprint; ++} ++ + static void bootmenu_destroy(struct bootmenu_data *menu) + { + struct bootmenu_entry *iter = menu->first; +@@ -332,6 +345,7 @@ static struct bootmenu_data *bootmenu_cr + + menu->delay = delay; + menu->active = 0; ++ menu->last_active = -1; + menu->first = NULL; + + default_str = env_get("bootmenu_default"); +@@ -506,7 +520,7 @@ static enum bootmenu_ret bootmenu_show(i + + menu = menu_create(NULL, bootmenu->delay, 1, menu_display_statusline, + bootmenu_print_entry, bootmenu_choice_entry, +- NULL, bootmenu); ++ bootmenu_need_reprint, bootmenu); + if (!menu) { + bootmenu_destroy(bootmenu); + return BOOTMENU_RET_FAIL; +--- a/include/menu.h ++++ b/include/menu.h +@@ -40,6 +40,7 @@ int menu_show(int bootdelay); + struct bootmenu_data { + int delay; /* delay for autoboot */ + int active; /* active menu entry */ ++ int last_active; /* last active menu entry */ + int count; /* total count of menu entries */ + struct bootmenu_entry *first; /* first menu entry */ + }; 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 4aa4318493ef5f..47e158b521ceca 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 @@ -35,7 +35,7 @@ Signed-off-by: Weijie Gao } switch (key) { -@@ -112,6 +113,12 @@ static char *bootmenu_choice_entry(void +@@ -114,6 +115,12 @@ static char *bootmenu_choice_entry(void ++menu->active; /* no menu key selected, regenerate menu */ return NULL; @@ -48,7 +48,7 @@ Signed-off-by: Weijie Gao case BKEY_SELECT: iter = menu->first; for (i = 0; i < menu->active; ++i) -@@ -169,6 +176,9 @@ static int prepare_bootmenu_entry(struct +@@ -182,6 +189,9 @@ static int prepare_bootmenu_entry(struct unsigned short int i = *index; struct bootmenu_entry *entry = NULL; struct bootmenu_entry *iter = *current; @@ -58,7 +58,7 @@ Signed-off-by: Weijie Gao while ((option = bootmenu_getoption(i))) { -@@ -183,11 +193,24 @@ static int prepare_bootmenu_entry(struct +@@ -196,11 +206,24 @@ static int prepare_bootmenu_entry(struct if (!entry) return -ENOMEM; @@ -84,15 +84,15 @@ Signed-off-by: Weijie Gao entry->command = strdup(sep + 1); if (!entry->command) { -@@ -333,6 +356,7 @@ static struct bootmenu_data *bootmenu_cr - menu->delay = delay; +@@ -347,6 +370,7 @@ static struct bootmenu_data *bootmenu_cr menu->active = 0; + menu->last_active = -1; menu->first = NULL; + menu->last_choiced = false; default_str = env_get("bootmenu_default"); if (default_str) -@@ -368,9 +392,9 @@ static struct bootmenu_data *bootmenu_cr +@@ -382,9 +406,9 @@ static struct bootmenu_data *bootmenu_cr /* Add Quit entry if exiting bootmenu is disabled */ if (!IS_ENABLED(CONFIG_BOOTMENU_DISABLE_UBOOT_CONSOLE)) @@ -106,7 +106,7 @@ Signed-off-by: Weijie Gao free(entry); --- a/common/menu.c +++ b/common/menu.c -@@ -48,6 +48,33 @@ struct menu { +@@ -49,6 +49,33 @@ struct menu { int item_cnt; }; @@ -140,7 +140,7 @@ Signed-off-by: Weijie Gao /* * An iterator function for menu items. callback will be called for each item * in m, with m, a pointer to the item, and extra being passed to callback. If -@@ -426,7 +453,7 @@ int menu_destroy(struct menu *m) +@@ -437,7 +464,7 @@ int menu_destroy(struct menu *m) } enum bootmenu_key bootmenu_autoboot_loop(struct bootmenu_data *menu, @@ -149,7 +149,7 @@ Signed-off-by: Weijie Gao { enum bootmenu_key key = BKEY_NONE; int i, c; -@@ -461,6 +488,19 @@ enum bootmenu_key bootmenu_autoboot_loop +@@ -472,6 +499,19 @@ enum bootmenu_key bootmenu_autoboot_loop break; default: key = BKEY_NONE; @@ -169,7 +169,7 @@ Signed-off-by: Weijie Gao break; } break; -@@ -481,7 +521,8 @@ enum bootmenu_key bootmenu_autoboot_loop +@@ -492,7 +532,8 @@ enum bootmenu_key bootmenu_autoboot_loop return key; } @@ -179,7 +179,7 @@ Signed-off-by: Weijie Gao { enum bootmenu_key key; -@@ -513,6 +554,20 @@ enum bootmenu_key bootmenu_conv_key(int +@@ -524,6 +565,20 @@ enum bootmenu_key bootmenu_conv_key(int case ' ': key = BKEY_SPACE; break; @@ -200,15 +200,16 @@ Signed-off-by: Weijie Gao default: key = BKEY_NONE; break; -@@ -522,11 +577,16 @@ enum bootmenu_key bootmenu_conv_key(int +@@ -533,11 +588,17 @@ enum bootmenu_key bootmenu_conv_key(int } enum bootmenu_key bootmenu_loop(struct bootmenu_data *menu, - struct cli_ch_state *cch) -+ struct cli_ch_state *cch, int *choice) ++ struct cli_ch_state *cch, ++ int *choice) { enum bootmenu_key key; - int c; + int c, errchar = 0; + if (menu->last_choiced) { + menu->last_choiced = false; @@ -218,7 +219,7 @@ Signed-off-by: Weijie Gao c = cli_ch_process(cch, 0); if (!c) { while (!c && !tstc()) { -@@ -540,7 +600,7 @@ enum bootmenu_key bootmenu_loop(struct b +@@ -552,7 +613,7 @@ enum bootmenu_key bootmenu_loop(struct b } } @@ -238,7 +239,7 @@ Signed-off-by: Weijie Gao struct cli_ch_state; struct menu; -@@ -19,6 +21,8 @@ int menu_get_choice(struct menu *m, void +@@ -20,6 +22,8 @@ int menu_get_choice(struct menu *m, void int menu_item_add(struct menu *m, char *item_key, void *item_data); int menu_destroy(struct menu *m); int menu_default_choice(struct menu *m, void **choice); @@ -247,15 +248,15 @@ Signed-off-by: Weijie Gao /** * menu_show() Show a boot menu -@@ -41,6 +45,7 @@ struct bootmenu_data { - int active; /* active menu entry */ +@@ -43,6 +47,7 @@ struct bootmenu_data { + int last_active; /* last active menu entry */ int count; /* total count of menu entries */ struct bootmenu_entry *first; /* first menu entry */ + bool last_choiced; }; /** enum bootmenu_key - keys that can be returned by the bootmenu */ -@@ -51,6 +56,7 @@ enum bootmenu_key { +@@ -53,6 +58,7 @@ enum bootmenu_key { BKEY_SELECT, BKEY_QUIT, BKEY_SAVE, @@ -263,7 +264,7 @@ Signed-off-by: Weijie Gao /* 'extra' keys, which are used by menus but not cedit */ BKEY_PLUS, -@@ -81,7 +87,7 @@ enum bootmenu_key { +@@ -83,7 +89,7 @@ enum bootmenu_key { * anything else: KEY_NONE */ enum bootmenu_key bootmenu_autoboot_loop(struct bootmenu_data *menu, @@ -272,7 +273,7 @@ Signed-off-by: Weijie Gao /** * bootmenu_loop() - handle waiting for a keypress when autoboot is disabled -@@ -107,7 +113,7 @@ enum bootmenu_key bootmenu_autoboot_loop +@@ -109,7 +115,7 @@ enum bootmenu_key bootmenu_autoboot_loop * Space: BKEY_SPACE */ enum bootmenu_key bootmenu_loop(struct bootmenu_data *menu, @@ -281,7 +282,7 @@ Signed-off-by: Weijie Gao /** * bootmenu_conv_key() - Convert a U-Boot keypress into a menu key -@@ -115,6 +121,7 @@ enum bootmenu_key bootmenu_loop(struct b +@@ -117,6 +123,7 @@ enum bootmenu_key bootmenu_loop(struct b * @ichar: Keypress to convert (ASCII, including control characters) * Returns: Menu key that corresponds to @ichar, or BKEY_NONE if none */ diff --git a/package/boot/uboot-mediatek/patches/211-cmd-bootmenu-custom-title.patch b/package/boot/uboot-mediatek/patches/211-cmd-bootmenu-custom-title.patch index 76ff745e93f8b4..be06832ea1ea32 100644 --- a/package/boot/uboot-mediatek/patches/211-cmd-bootmenu-custom-title.patch +++ b/package/boot/uboot-mediatek/patches/211-cmd-bootmenu-custom-title.patch @@ -1,6 +1,6 @@ --- a/cmd/bootmenu.c +++ b/cmd/bootmenu.c -@@ -451,7 +451,11 @@ static void menu_display_statusline(stru +@@ -465,7 +465,11 @@ static void menu_display_statusline(stru printf(ANSI_CURSOR_POSITION, 1, 1); puts(ANSI_CLEAR_LINE); printf(ANSI_CURSOR_POSITION, 2, 3); @@ -13,7 +13,7 @@ puts(ANSI_CLEAR_LINE_TO_END); printf(ANSI_CURSOR_POSITION, 3, 1); puts(ANSI_CLEAR_LINE); -@@ -536,6 +540,7 @@ static enum bootmenu_ret bootmenu_show(i +@@ -550,6 +554,7 @@ static enum bootmenu_ret bootmenu_show(i return BOOTMENU_RET_FAIL; } @@ -23,8 +23,8 @@ goto cleanup; --- a/include/menu.h +++ b/include/menu.h -@@ -45,6 +45,7 @@ struct bootmenu_data { - int active; /* active menu entry */ +@@ -47,6 +47,7 @@ struct bootmenu_data { + int last_active; /* last active menu entry */ int count; /* total count of menu entries */ struct bootmenu_entry *first; /* first menu entry */ + char *mtitle; /* custom menu title */ From 4b4e307a013abcc4977a93c8118e4309f08e3d88 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sat, 2 Nov 2024 20:01:05 +0000 Subject: [PATCH 018/877] mediatek: pinctrl-mt7988: add missing PWM pingroups Add additionals possible pinctrl group for pwm2~7 on pins pin 4 (GPIO_A) pwm7 pin 58 (JTAG_JTDI) pwm2 pin 59 (JTAG_JTDO) pwm3 pin 60 (JTAG_JTMS) pwm4 pin 61 (JTAG_JTCLK) pwm5 pin 62 (JTAG_JTRST_N) pwm6 They can be useful e.g. on the BPi-R4 as in that way pwm2~6 can be exposed on the 26-pin header (pwm6 always, pwm2~5 instead of the full UART). Signed-off-by: Daniel Golle --- .../drivers/pinctrl/mediatek/pinctrl-mt7988.c | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/target/linux/mediatek/files-6.6/drivers/pinctrl/mediatek/pinctrl-mt7988.c b/target/linux/mediatek/files-6.6/drivers/pinctrl/mediatek/pinctrl-mt7988.c index 9f9291124522c9..648bd03acbc3cf 100644 --- a/target/linux/mediatek/files-6.6/drivers/pinctrl/mediatek/pinctrl-mt7988.c +++ b/target/linux/mediatek/files-6.6/drivers/pinctrl/mediatek/pinctrl-mt7988.c @@ -776,21 +776,39 @@ static int mt7988_pwm1_funcs[] = { 1 }; static int mt7988_pwm2_pins[] = { 80 }; static int mt7988_pwm2_funcs[] = { 2 }; +static int mt7988_pwm2_0_pins[] = { 58 }; +static int mt7988_pwm2_0_funcs[] = { 5 }; + static int mt7988_pwm3_pins[] = { 81 }; static int mt7988_pwm3_funcs[] = { 2 }; +static int mt7988_pwm3_0_pins[] = { 59 }; +static int mt7988_pwm3_0_funcs[] = { 5 }; + static int mt7988_pwm4_pins[] = { 82 }; static int mt7988_pwm4_funcs[] = { 2 }; +static int mt7988_pwm4_0_pins[] = { 60 }; +static int mt7988_pwm4_0_funcs[] = { 5 }; + static int mt7988_pwm5_pins[] = { 83 }; static int mt7988_pwm5_funcs[] = { 2 }; +static int mt7988_pwm5_0_pins[] = { 61 }; +static int mt7988_pwm5_0_funcs[] = { 5 }; + static int mt7988_pwm6_pins[] = { 69 }; static int mt7988_pwm6_funcs[] = { 3 }; +static int mt7988_pwm6_0_pins[] = { 62 }; +static int mt7988_pwm6_0_funcs[] = { 5 }; + static int mt7988_pwm7_pins[] = { 70 }; static int mt7988_pwm7_funcs[] = { 3 }; +static int mt7988_pwm7_0_pins[] = { 4 }; +static int mt7988_pwm7_0_funcs[] = { 3 }; + /* dfd */ static int mt7988_dfd_pins[] = { 0, 1, 2, 3, 4 }; static int mt7988_dfd_funcs[] = { 4, 4, 4, 4, 4 }; @@ -1113,6 +1131,8 @@ static const struct group_desc mt7988_groups[] = { 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(4): pwm7 */ + PINCTRL_PIN_GROUP("pwm7_0", mt7988_pwm7_0), /* @GPIO(5,6) i2c0_0 */ PINCTRL_PIN_GROUP("i2c0_0", mt7988_i2c0_0), /* @GPIO(5,6) i2c1_sfp */ @@ -1243,6 +1263,14 @@ static const struct group_desc mt7988_groups[] = { PINCTRL_PIN_GROUP("wo2_jtag", mt7988_wo2_jtag), /* @GPIO(57) pwm0 */ PINCTRL_PIN_GROUP("pwm0", mt7988_pwm0), + /* @GPIO(58) pwm2_0 */ + PINCTRL_PIN_GROUP("pwm2_0", mt7988_pwm2_0), + /* @GPIO(59) pwm3_0 */ + PINCTRL_PIN_GROUP("pwm3_0", mt7988_pwm3_0), + /* @GPIO(60) pwm4_0 */ + PINCTRL_PIN_GROUP("pwm4_0", mt7988_pwm4_0), + /* @GPIO(61) pwm5_0 */ + PINCTRL_PIN_GROUP("pwm5_0", mt7988_pwm5_0), /* @GPIO(58,59,60,61,62) jtag */ PINCTRL_PIN_GROUP("jtag", mt7988_jtag), /* @GPIO(58,59,60,61,62) tops_jtag0_1 */ @@ -1256,6 +1284,8 @@ static const struct group_desc mt7988_groups[] = { 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) pwm6_0 */ + PINCTRL_PIN_GROUP("pwm6_0", mt7988_pwm6_0), /* @GPIO(62) 2p5gbe_led1 */ PINCTRL_PIN_GROUP("2p5gbe_led1", mt7988_2p5gbe_led1), /* @GPIO(64,65,66,67) gbe_led0 */ @@ -1336,7 +1366,8 @@ 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" + "pwm0", "pwm1", "pwm2", "pwm2_0", "pwm3", "pwm3_0", "pwm4", "pwm4_0", + "pwm5", "pwm5_0", "pwm6", "pwm6_0", "pwm7", "pwm7_0", }; static const char * const mt7988_dfd_groups[] = { "dfd", From ccd30b9ed7d83ec1d340c7f3193497b19251dc2a Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sat, 2 Nov 2024 20:17:52 +0000 Subject: [PATCH 019/877] mediatek: filogic: BPi-R4: wire up pinctrl for pwm-fan Assign pwm function of PWM0 pin to the pwm-fan. This is mostly just cosmetics as it basically reflects the default setting of that pin. Signed-off-by: Daniel Golle --- .../boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi b/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi index fae5d0ebfa8aa3..c4455fbc7471ed 100644 --- a/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi +++ b/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi @@ -297,11 +297,22 @@ status = "okay"; }; +&pio { + pwm0_pins: pwm0-pins { + mux { + groups = "pwm0"; + function = "pwm"; + }; + }; +}; + &pwm { status = "okay"; }; &fan { + pinctrl-names = "default"; + pinctrl-0 = <&pwm0_pins>; pwms = <&pwm 0 50000>; status = "okay"; }; From 5b7357e0a10de581f5adb8984aa527f448966d98 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 3 Nov 2024 02:38:17 +0000 Subject: [PATCH 020/877] mediatek: refresh patches The mediatek target requires refreshing after recent additions. Fixes: cfe8e6e75f ("mediatek: add support for Realtek RTL8261n 10G PHYs") Fixes: ddfae94a14 ("mediatek: add support for swapping the polarity on usxgmii interfaces") Signed-off-by: Daniel Golle --- .../patches-6.6/735-net-phy-realtek-rtl8261n.patch | 6 +++--- .../736-net-pcs-mtk_usxgmii-add-polarity-control.patch | 8 +++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/target/linux/mediatek/patches-6.6/735-net-phy-realtek-rtl8261n.patch b/target/linux/mediatek/patches-6.6/735-net-phy-realtek-rtl8261n.patch index 3612b521e1c5fe..40771202c56528 100644 --- a/target/linux/mediatek/patches-6.6/735-net-phy-realtek-rtl8261n.patch +++ b/target/linux/mediatek/patches-6.6/735-net-phy-realtek-rtl8261n.patch @@ -1,6 +1,6 @@ --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -334,6 +334,8 @@ config REALTEK_PHY +@@ -399,6 +399,8 @@ config REALTEK_PHY help Supports the Realtek 821x PHY. @@ -11,11 +11,11 @@ help --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile -@@ -85,6 +85,7 @@ obj-$(CONFIG_ADIN_PHY) += adin.o +@@ -100,6 +100,7 @@ obj-$(CONFIG_NXP_TJA11XX_PHY) += nxp-tja obj-y += qcom/ obj-$(CONFIG_QSEMI_PHY) += qsemi.o obj-$(CONFIG_REALTEK_PHY) += realtek.o +obj-y += rtl8261n/ obj-$(CONFIG_RENESAS_PHY) += uPD60620.o obj-$(CONFIG_ROCKCHIP_PHY) += rockchip.o - obj-$(CONFIG_SMSC_PHY) += smsc.o + obj-$(CONFIG_RTL8367S_GSW) += rtk/ diff --git a/target/linux/mediatek/patches-6.6/736-net-pcs-mtk_usxgmii-add-polarity-control.patch b/target/linux/mediatek/patches-6.6/736-net-pcs-mtk_usxgmii-add-polarity-control.patch index 678761990b85cc..68ee609aace0ce 100644 --- a/target/linux/mediatek/patches-6.6/736-net-pcs-mtk_usxgmii-add-polarity-control.patch +++ b/target/linux/mediatek/patches-6.6/736-net-pcs-mtk_usxgmii-add-polarity-control.patch @@ -1,5 +1,3 @@ -diff --git a/drivers/net/pcs/pcs-mtk-usxgmii.c b/drivers/net/pcs/pcs-mtk-usxgmii.c -index 9af9035..9caab92 100644 --- a/drivers/net/pcs/pcs-mtk-usxgmii.c +++ b/drivers/net/pcs/pcs-mtk-usxgmii.c @@ -52,6 +52,12 @@ @@ -23,7 +21,7 @@ index 9af9035..9caab92 100644 unsigned int neg_mode; struct list_head node; }; -@@ -155,6 +162,10 @@ static int mtk_usxgmii_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode +@@ -155,6 +162,10 @@ static int mtk_usxgmii_pcs_config(struct mtk_usxgmii_reset(mpcs); @@ -34,7 +32,7 @@ index 9af9035..9caab92 100644 /* Setup USXGMII AN ctrl */ mtk_m32(mpcs, RG_PCS_AN_CTRL0, USXGMII_AN_SYNC_CNT | USXGMII_AN_ENABLE, -@@ -332,6 +343,7 @@ static const struct phylink_pcs_ops mtk_usxgmii_pcs_ops = { +@@ -332,6 +343,7 @@ static const struct phylink_pcs_ops mtk_ static int mtk_usxgmii_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -42,7 +40,7 @@ index 9af9035..9caab92 100644 struct mtk_usxgmii_pcs *mpcs; mpcs = devm_kzalloc(dev, sizeof(*mpcs), GFP_KERNEL); -@@ -342,6 +354,13 @@ static int mtk_usxgmii_probe(struct platform_device *pdev) +@@ -342,6 +354,13 @@ static int mtk_usxgmii_probe(struct plat if (IS_ERR(mpcs->base)) return PTR_ERR(mpcs->base); From 895f30e31ade4a0e130e59272ec8bc88ed5da415 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Sun, 22 Sep 2024 09:07:58 +0200 Subject: [PATCH 021/877] mediatek: set mac increment to 7 for the 5G radio on OpenWrt One Mass production units will get 16 assigned MAC addresses. This allows each phy to spawn up to 7 VAPs which will each have unique MAC without needing the private bit. Signed-off-by: John Crispin --- target/linux/mediatek/dts/mt7981b-openwrt-one.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/mediatek/dts/mt7981b-openwrt-one.dts b/target/linux/mediatek/dts/mt7981b-openwrt-one.dts index 46d351f76d09df..584b48217928ce 100644 --- a/target/linux/mediatek/dts/mt7981b-openwrt-one.dts +++ b/target/linux/mediatek/dts/mt7981b-openwrt-one.dts @@ -450,7 +450,7 @@ band@1 { reg = <1>; - nvmem-cells = <&macaddr_factory_4 1>; + nvmem-cells = <&macaddr_factory_4 7>; nvmem-cell-names = "mac-address"; }; }; From 0d97e775ac9c62e0feed932430c53db1965ed0db Mon Sep 17 00:00:00 2001 From: John Crispin Date: Tue, 5 Nov 2024 09:43:38 +0100 Subject: [PATCH 022/877] mediatek: set 7 MACs per wifi band in board.json on OpenWrt One Mass production units will get 16 assigned MAC addresses. This allows each phy to spawn up to 7 VAPs which will each have unique MAC without needing the private bit. Signed-off-by: John Crispin --- .../filogic/base-files/etc/board.d/04_defaults | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 target/linux/mediatek/filogic/base-files/etc/board.d/04_defaults diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/04_defaults b/target/linux/mediatek/filogic/base-files/etc/board.d/04_defaults new file mode 100644 index 00000000000000..4d4131ec90c1d2 --- /dev/null +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/04_defaults @@ -0,0 +1,16 @@ +. /lib/functions/uci-defaults.sh + +board=$(board_name) + +board_config_update + +case $board in +openwrt,one) + ucidef_set_wireless_mac_count 2g 7 + ucidef_set_wireless_mac_count 5g 7 + ;; +esac + +board_config_flush + +exit 0 From 7763c5aabc422f62ae4a7559b52ba30551283520 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Tue, 5 Nov 2024 00:33:02 +0100 Subject: [PATCH 023/877] kernel: r8126: update to v10.014.01 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changelog: https://github.com/openwrt/rtl8126/compare/10.013.00...10.014.01 Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 562b2c22fff363f060e72c9018d243981b7d6447) --- package/kernel/r8126/Makefile | 6 ++--- .../patches/001-r8126.h-use-BIT_ULL.patch | 21 --------------- .../100-r8126_rss-silence-rxnfc-log.patch | 27 ------------------- ...126-print-link-speed-and-duplex-mode.patch | 10 +++---- 4 files changed, 8 insertions(+), 56 deletions(-) delete mode 100644 package/kernel/r8126/patches/001-r8126.h-use-BIT_ULL.patch delete mode 100644 package/kernel/r8126/patches/100-r8126_rss-silence-rxnfc-log.patch diff --git a/package/kernel/r8126/Makefile b/package/kernel/r8126/Makefile index c269cdcadc4ba6..a8f60f9dbb664b 100644 --- a/package/kernel/r8126/Makefile +++ b/package/kernel/r8126/Makefile @@ -1,12 +1,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=r8126 -PKG_VERSION:=10.013.00 -PKG_RELEASE:=4 +PKG_VERSION:=10.014.01 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://github.com/openwrt/rtl8126/releases/download/$(PKG_VERSION) -PKG_HASH:=b41bda6ff3bbb7d9bc5b81c5c21355f031587d3a3a5862abcd4d766e942272e7 +PKG_HASH:=dbb10a7abd0972e4abd1b89ea4eb22fc55d6c1dc2f711b5acf4a3bc376275e21 PKG_BUILD_PARALLEL:=1 PKG_LICENSE:=GPLv2 diff --git a/package/kernel/r8126/patches/001-r8126.h-use-BIT_ULL.patch b/package/kernel/r8126/patches/001-r8126.h-use-BIT_ULL.patch deleted file mode 100644 index cfbf31fcbb3e44..00000000000000 --- a/package/kernel/r8126/patches/001-r8126.h-use-BIT_ULL.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 9649df50a239d1379cc8d9febd4854a0c7ca0731 Mon Sep 17 00:00:00 2001 -From: Mieczyslaw Nalewaj -Date: Sat, 10 Aug 2024 17:42:44 +0200 -Subject: [PATCH] r8126.h: use BIT_ULL - -Fixes compilation on 32 bit systems. ---- - src/r8126.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/src/r8126.h -+++ b/src/r8126.h -@@ -678,7 +678,7 @@ This is free software, and you are welco - #ifndef ADVERTISED_2500baseX_Full - #define ADVERTISED_2500baseX_Full 0x8000 - #endif --#define RTK_ADVERTISED_5000baseX_Full BIT(48) -+#define RTK_ADVERTISED_5000baseX_Full BIT_ULL(48) - - #define RTK_ADVERTISE_2500FULL 0x80 - #define RTK_ADVERTISE_5000FULL 0x100 diff --git a/package/kernel/r8126/patches/100-r8126_rss-silence-rxnfc-log.patch b/package/kernel/r8126/patches/100-r8126_rss-silence-rxnfc-log.patch deleted file mode 100644 index d06406004c7c68..00000000000000 --- a/package/kernel/r8126/patches/100-r8126_rss-silence-rxnfc-log.patch +++ /dev/null @@ -1,27 +0,0 @@ -From cd20cf48c0ec2a01fd9f512e25218a6ac8131794 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= -Date: Sat, 17 Aug 2024 22:07:23 +0200 -Subject: [PATCH] r8126_rss: silence rxnfc log -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This log is noisy and useless, just ignore it. - -Signed-off-by: Chukun Pan -Signed-off-by: Álvaro Fernández Rojas ---- - src/r8126_rss.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/src/r8126_rss.c -+++ b/src/r8126_rss.c -@@ -91,7 +91,7 @@ int rtl8126_get_rxnfc(struct net_device - struct rtl8126_private *tp = netdev_priv(dev); - int ret = -EOPNOTSUPP; - -- netif_info(tp, drv, tp->dev, "rss get rxnfc\n"); -+ netif_dbg(tp, drv, tp->dev, "rss get rxnfc\n"); - - if (!(dev->features & NETIF_F_RXHASH)) - return ret; diff --git a/package/kernel/r8126/patches/200-r8126-print-link-speed-and-duplex-mode.patch b/package/kernel/r8126/patches/200-r8126-print-link-speed-and-duplex-mode.patch index 308d2494b3e952..27b3d626c152be 100644 --- a/package/kernel/r8126/patches/200-r8126-print-link-speed-and-duplex-mode.patch +++ b/package/kernel/r8126/patches/200-r8126-print-link-speed-and-duplex-mode.patch @@ -18,7 +18,7 @@ Signed-off-by: Álvaro Fernández Rojas --- a/src/r8126.h +++ b/src/r8126.h -@@ -1561,6 +1561,8 @@ enum RTL8126_register_content { +@@ -1740,6 +1740,8 @@ enum RTL8126_register_content { LinkStatus = 0x02, FullDup = 0x01, @@ -37,7 +37,7 @@ Signed-off-by: Álvaro Fernández Rojas #include #include #include -@@ -4740,6 +4741,40 @@ rtl8126_link_down_patch(struct net_devic +@@ -4744,6 +4745,40 @@ rtl8126_link_down_patch(struct net_devic #endif } @@ -76,10 +76,10 @@ Signed-off-by: Álvaro Fernández Rojas +} + static void - _rtl8126_check_link_status(struct net_device *dev) + _rtl8126_check_link_status(struct net_device *dev, unsigned int link_state) { -@@ -4748,11 +4783,18 @@ _rtl8126_check_link_status(struct net_de - if (tp->link_ok(dev)) { +@@ -4756,11 +4791,18 @@ _rtl8126_check_link_status(struct net_de + if (link_state == R8126_LINK_STATE_ON) { rtl8126_link_on_patch(dev); - if (netif_msg_ifup(tp)) From 49d8f4b83383253de7037611926230f8b04cf7b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Tue, 5 Nov 2024 14:01:06 +0100 Subject: [PATCH 024/877] kernel: r8168: refresh patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patches weren't refreshed when r8168 was updated to v8.054.00 in a85e18b53f0f. Fixes: a85e18b53f0f ("kernel: r8168: update to v8.054.00") Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 6490c88c75b3392aca9dae5f4d47a13a0aa35220) --- .../200-r8168-print-link-speed-and-duplex-mode.patch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/kernel/r8168/patches/200-r8168-print-link-speed-and-duplex-mode.patch b/package/kernel/r8168/patches/200-r8168-print-link-speed-and-duplex-mode.patch index 0212ae9bc41c39..41162b4d9b11fb 100644 --- a/package/kernel/r8168/patches/200-r8168-print-link-speed-and-duplex-mode.patch +++ b/package/kernel/r8168/patches/200-r8168-print-link-speed-and-duplex-mode.patch @@ -18,7 +18,7 @@ Signed-off-by: Chukun Pan --- a/src/r8168.h +++ b/src/r8168.h -@@ -1385,6 +1385,8 @@ enum RTL8168_register_content { +@@ -1468,6 +1468,8 @@ enum RTL8168_register_content { LinkStatus = 0x02, FullDup = 0x01, @@ -37,7 +37,7 @@ Signed-off-by: Chukun Pan #include #include #include -@@ -5373,6 +5374,36 @@ rtl8168_link_down_patch(struct net_devic +@@ -5369,6 +5370,36 @@ rtl8168_link_down_patch(struct net_devic #endif } @@ -74,7 +74,7 @@ Signed-off-by: Chukun Pan static void rtl8168_check_link_status(struct net_device *dev) { -@@ -5392,11 +5423,18 @@ rtl8168_check_link_status(struct net_dev +@@ -5388,11 +5419,18 @@ rtl8168_check_link_status(struct net_dev if (link_status_on) { rtl8168_link_on_patch(dev); From a82b097635647a8d7717cd7a02ef5b20cc8d0810 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Wed, 6 Nov 2024 10:38:20 +0100 Subject: [PATCH 025/877] procd: update to Git HEAD (2024-11-06) 109fa41b2321 system: fix description value from os-release Signed-off-by: Christian Marangi (cherry picked from commit 09a8b4920cf117942561237d639d5101283a53c4) --- 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 e07f3ec81d7cc1..86de4babfdfaff 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:=3d15a68fb614c4d7e129dc1bbe8a79adcb3115753c2fc95a36fd03855efc7a58 -PKG_SOURCE_DATE:=2024-10-20 -PKG_SOURCE_VERSION:=ef3ab8bc8fb18216793dd0c8106dd222c560453a +PKG_MIRROR_HASH:=0f494faf2811af6cd7332acda8049ad9713dcabc4b2885dc14acbd9f61920be1 +PKG_SOURCE_DATE:=2024-11-06 +PKG_SOURCE_VERSION:=109fa41b2321506280397e03757976c468832668 CMAKE_INSTALL:=1 PKG_LICENSE:=GPL-2.0 From f3359da4b89380144c91d1d05c5f6bacb14e6ce2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Wed, 6 Nov 2024 10:00:56 +0100 Subject: [PATCH 026/877] kernel: r8125: update to v9.014.01 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changelog: https://github.com/openwrt/rtl8125/compare/9.013.02...9.014.01 Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit e29bc67f9d8451d3baf80da9358b3a01dc4b20b7) --- package/kernel/r8125/Makefile | 6 ++--- .../100-r8125_rss-silence-rxnfc-log.patch | 26 ------------------- ...125-print-link-speed-and-duplex-mode.patch | 10 +++---- 3 files changed, 8 insertions(+), 34 deletions(-) delete mode 100644 package/kernel/r8125/patches/100-r8125_rss-silence-rxnfc-log.patch diff --git a/package/kernel/r8125/Makefile b/package/kernel/r8125/Makefile index ef95b52e679549..647630393a4141 100644 --- a/package/kernel/r8125/Makefile +++ b/package/kernel/r8125/Makefile @@ -1,12 +1,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=r8125 -PKG_VERSION:=9.013.02 -PKG_RELEASE:=4 +PKG_VERSION:=9.014.01 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://github.com/openwrt/rtl8125/releases/download/$(PKG_VERSION) -PKG_HASH:=d36410ee99c956f250d9cd08340d8c36567d190f420a8ee128ff6e51225aac0c +PKG_HASH:=f006aa95501738ca55c522812c9d1b473ac781675f3ad88ce341a09316b8aa13 PKG_BUILD_PARALLEL:=1 PKG_LICENSE:=GPLv2 diff --git a/package/kernel/r8125/patches/100-r8125_rss-silence-rxnfc-log.patch b/package/kernel/r8125/patches/100-r8125_rss-silence-rxnfc-log.patch deleted file mode 100644 index 58eb470037f2d2..00000000000000 --- a/package/kernel/r8125/patches/100-r8125_rss-silence-rxnfc-log.patch +++ /dev/null @@ -1,26 +0,0 @@ -From cd20cf48c0ec2a01fd9f512e25218a6ac8131794 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= -Date: Sat, 17 Aug 2024 22:07:23 +0200 -Subject: [PATCH] r8125_rss: silence rxnfc log -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This log is noisy and useless, just ignore it. - -Signed-off-by: Chukun Pan ---- - src/r8125_rss.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/src/r8125_rss.c -+++ b/src/r8125_rss.c -@@ -91,7 +91,7 @@ int rtl8125_get_rxnfc(struct net_device - struct rtl8125_private *tp = netdev_priv(dev); - int ret = -EOPNOTSUPP; - -- netif_info(tp, drv, tp->dev, "rss get rxnfc\n"); -+ netif_dbg(tp, drv, tp->dev, "rss get rxnfc\n"); - - if (!(dev->features & NETIF_F_RXHASH)) - return ret; diff --git a/package/kernel/r8125/patches/200-r8125-print-link-speed-and-duplex-mode.patch b/package/kernel/r8125/patches/200-r8125-print-link-speed-and-duplex-mode.patch index df649c9ae9f619..a3b35621494d67 100644 --- a/package/kernel/r8125/patches/200-r8125-print-link-speed-and-duplex-mode.patch +++ b/package/kernel/r8125/patches/200-r8125-print-link-speed-and-duplex-mode.patch @@ -18,7 +18,7 @@ Signed-off-by: Álvaro Fernández Rojas --- a/src/r8125.h +++ b/src/r8125.h -@@ -1563,6 +1563,8 @@ enum RTL8125_register_content { +@@ -1672,6 +1672,8 @@ enum RTL8125_register_content { LinkStatus = 0x02, FullDup = 0x01, @@ -37,7 +37,7 @@ Signed-off-by: Álvaro Fernández Rojas #include #include #include -@@ -5112,6 +5113,38 @@ rtl8125_link_down_patch(struct net_devic +@@ -5116,6 +5117,38 @@ rtl8125_link_down_patch(struct net_devic #endif } @@ -74,10 +74,10 @@ Signed-off-by: Álvaro Fernández Rojas +} + static void - _rtl8125_check_link_status(struct net_device *dev) + _rtl8125_check_link_status(struct net_device *dev, unsigned int link_state) { -@@ -5120,11 +5153,18 @@ _rtl8125_check_link_status(struct net_de - if (tp->link_ok(dev)) { +@@ -5128,11 +5161,18 @@ _rtl8125_check_link_status(struct net_de + if (link_state == R8125_LINK_STATE_ON) { rtl8125_link_on_patch(dev); - if (netif_msg_ifup(tp)) From 983a753f389efb893e3b75fff1b8af28839e3f3e Mon Sep 17 00:00:00 2001 From: Edward Chow Date: Tue, 5 Mar 2024 01:24:10 +0800 Subject: [PATCH 027/877] ath79: linksys_ea4500-v3: take over the space for user data The last "syscfg" partition of the OEM firmware turns out to be a UBIFS used to store user data, just as the "rootfs_data" of OpenWrt, so it should be reasonable to absorb it into the "ubi" partition. Factory installations via either OEM firmware or tftp, or by forcibly flashing factory image to mtd5 (firmware) partition with mtd tool are confirmed working, but the UBI remaining inside "syscfg" partition could break upgrade. Fortunately, installing kmod-mtd-rw and erasing "syscfg" partition before upgrade is confirmed working, in which case, "ubi" will automatically expand to the blank space once occupied by the former mtd8 (syscfg), with the total block number increased, but the UBIFS for rootfs_data will not automatically claim the newly available space (since it is created when mtd8 still exists, and sysupgrade does not set "autoresize" flag to rootfs_data). These space will be claimed during the next upgrade, when rootfs_data is removed and created again. Fixes: 50f727b7737d1 ("ath79: add support for Linksys EA4500 v3") Signed-off-by: Edward Chow Link: https://github.com/openwrt/openwrt/pull/14791 Signed-off-by: Robert Marko --- target/linux/ath79/dts/qca9558_linksys_ea4500-v3.dts | 10 +++++----- target/linux/ath79/image/nand.mk | 8 +++++++- .../nand/base-files/etc/board.d/05_compat-version | 1 + 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/target/linux/ath79/dts/qca9558_linksys_ea4500-v3.dts b/target/linux/ath79/dts/qca9558_linksys_ea4500-v3.dts index 6c799efe33a54e..1da46d72145b10 100644 --- a/target/linux/ath79/dts/qca9558_linksys_ea4500-v3.dts +++ b/target/linux/ath79/dts/qca9558_linksys_ea4500-v3.dts @@ -123,7 +123,7 @@ partition@2c0000 { label = "firmware"; - reg = <0x2c0000 0x5000000>; + reg = <0x2c0000 0x7d40000>; compatible = "fixed-partitions"; #address-cells = <1>; @@ -136,7 +136,7 @@ partition@400000 { label = "ubi"; - reg = <0x400000 0x4c00000>; + reg = <0x400000 0x7940000>; }; /* Original layout for secondary partitions */ @@ -151,11 +151,11 @@ }; */ }; - partition@52c0000 { + /* Original layout for user data partition */ + /* partition@52c0000 { label = "syscfg"; reg = <0x52c0000 0x2d40000>; - read-only; - }; + }; */ }; }; diff --git a/target/linux/ath79/image/nand.mk b/target/linux/ath79/image/nand.mk index a3bdedaf6d53d5..d3c1120aa23ca0 100644 --- a/target/linux/ath79/image/nand.mk +++ b/target/linux/ath79/image/nand.mk @@ -281,6 +281,12 @@ TARGET_DEVICES += glinet_gl-x1200-nor define Device/linksys_ea4500-v3 SOC := qca9558 + DEVICE_COMPAT_VERSION := 1.1 + DEVICE_COMPAT_MESSAGE := Partition table has been changed. Please \ + install kmod-mtd-rw and erase mtd8 (syscfg) before upgrade \ + to keep configures, or forcibly flash factory image to mtd5 \ + (firmware) partition with mtd tool to discard configures but \ + claim additional space immediately. DEVICE_VENDOR := Linksys DEVICE_MODEL := EA4500 DEVICE_VARIANT := v3 @@ -288,7 +294,7 @@ define Device/linksys_ea4500-v3 BLOCKSIZE := 128k PAGESIZE := 2048 KERNEL_SIZE := 4096k - IMAGE_SIZE := 81920k + IMAGE_SIZE := 128256k IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata LINKSYS_HWNAME := EA4500V3 IMAGES += factory.img 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 index 238927aa7b474c..4d826d978d62ad 100644 --- 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 @@ -4,6 +4,7 @@ board_config_update case "$(board_name)" in + linksys,ea4500-v3|\ netgear,wndr4300-v2|\ netgear,wndr4500-v3) ucidef_set_compat_version "1.1" From c0a50b1d59b6555c1a41303177061115c1949e2d Mon Sep 17 00:00:00 2001 From: Andrew MacIntyre Date: Fri, 8 Nov 2024 23:44:13 +1100 Subject: [PATCH 028/877] vrx518_tc: allow larger MTU to support RFC4638 vrx518_tc currently sets the interface maximum MTU to the ethernet default of 1500 bytes by default via ether_setup() called from ptm_setup(). To support 1508 byte baby jumbo frames (RFC4638) for PPPoE connections over VDSL links as already supported by the VR9 ltq_ptm driver ([1], [2]) set the interface maximum MTU to MAX_MTU. MAX_MTU is defined in dcdp/inc/tc_common.h to 2002 bytes and this value is used in ptm_change_mtu() and elsewhere as the maximum MTU, however this is short circuited by checks against the interface maximum MTU. [1]: https://forum.openwrt.org/t/fritzbox-7530-and-rfc4638-baby-jumbo-frames/181327 [2]: https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=8a2a20e71e2909f84dab47e51dfda9e292a6c1ae Signed-off-by: Andrew MacIntyre Link: https://github.com/openwrt/openwrt/pull/16856 Signed-off-by: Robert Marko (cherry picked from commit ca53f2d430ce1f9ff5a560291de1e93380963417) --- ...-allow-larger-mtu-to-support-rfc4638.patch | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 package/kernel/lantiq/vrx518_tc/patches/206-dcdp-ptm_tc-allow-larger-mtu-to-support-rfc4638.patch diff --git a/package/kernel/lantiq/vrx518_tc/patches/206-dcdp-ptm_tc-allow-larger-mtu-to-support-rfc4638.patch b/package/kernel/lantiq/vrx518_tc/patches/206-dcdp-ptm_tc-allow-larger-mtu-to-support-rfc4638.patch new file mode 100644 index 00000000000000..35a709e9fa1ee2 --- /dev/null +++ b/package/kernel/lantiq/vrx518_tc/patches/206-dcdp-ptm_tc-allow-larger-mtu-to-support-rfc4638.patch @@ -0,0 +1,34 @@ +From 3983dc1674fec43beb8ce9d9bfdd6302fef86eae Mon Sep 17 00:00:00 2001 +From: Andrew MacIntyre +Date: Mon, 4 Nov 2024 22:41:25 +1100 +Subject: [PATCH] vrx518_tc: allow larger MTU to support RFC4638 + +vrx518_tc currently sets the interface maximum MTU to the ethernet default +of 1500 bytes by default via ether_setup() called from ptm_setup(). + +To support 1508 byte baby jumbo frames (RFC4638) for PPPoE connections +over VDSL links as already supported by the VR9 ltq_ptm driver ([1], [2]) +set the interface maximum MTU to MAX_MTU. + +MAX_MTU is defined in dcdp/inc/tc_common.h to 2002 bytes and this value is +used in ptm_change_mtu() and elsewhere as the maximum MTU, however this is +short circuited by checks against the interface maximum MTU. + +[1]: https://forum.openwrt.org/t/fritzbox-7530-and-rfc4638-baby-jumbo-frames/181327 +[2]: https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=8a2a20e71e2909f84dab47e51dfda9e292a6c1ae + +Signed-off-by: Andrew MacIntyre +--- + dcdp/ptm_tc.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/dcdp/ptm_tc.c 2023-12-17 16:11:22.503500398 +1100 ++++ b/dcdp/ptm_tc.c 2024-01-26 16:48:49.881623474 +1100 +@@ -657,6 +657,7 @@ static void ptm_setup(struct net_device + ether_setup(dev); + dev->watchdog_timeo = 10 * HZ; + dev->netdev_ops = &g_ptm_netdev_ops; ++ dev->max_mtu = MAX_MTU; + } + + static int ptm_dev_init(struct tc_priv *tc_priv, u32 id, From 7a1815f64dcca632d1a707cdd987b4f5431baf5a Mon Sep 17 00:00:00 2001 From: Mieczyslaw Nalewaj Date: Sun, 3 Nov 2024 08:53:37 +0100 Subject: [PATCH 029/877] kernel: bump 6.6 to 6.6.59 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.59 Removed upstreamed: - generic/backport-6.6/777-netfilter-xtables-fix-typo-causing-some-targets-to-not-load-on-IPv6.patch[1] - generic/backport-6.6/780-24-v6.12-r8169-avoid-unsolicited-interrupts.patch[2] All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.59&id=433742ba96baf30c21e654ce3e698ad87100593b 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.59&id=7d6d46b429804b1a182106e27e2f8c0e84689e1a Signed-off-by: Mieczyslaw Nalewaj Link: https://github.com/openwrt/openwrt/pull/16835 Signed-off-by: Hauke Mehrtens (cherry picked from commit 4fc47c60006ccacda5ef644c5447ebfcb26c0680) --- include/kernel-6.6 | 4 +- ...ore-event-ring-segment-table-entries.patch | 2 +- ...-quirks-add-link-TRB-quirk-for-VL805.patch | 2 +- ...b-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch | 2 +- ...5-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch | 2 +- ...wc3-Set-DMA-and-coherent-masks-early.patch | 2 +- ...-add-FS-LS-bus-instance-parkmode-dis.patch | 2 +- ...support-for-performing-fake-doorbell.patch | 2 +- ...-create-a-dummy-net_device-allocator.patch | 2 +- ...ing-some-targets-to-not-load-on-IPv6.patch | 43 ------------------- ...169-improve-handling-task-scheduling.patch | 2 +- ...support-for-LED-s-on-RTL8168-RTL8101.patch | 4 +- ...ix-building-with-CONFIG_LEDS_CLASS-m.patch | 2 +- ...-07-v6.9-r8169-simplify-EEE-handling.patch | 4 +- ...-v6.9-r8169-add-support-for-RTL8126A.patch | 2 +- ...ode-by-using-core-provided-pcpu-stat.patch | 4 +- ...-add-LED-support-for-RTL8125-RTL8126.patch | 2 +- ...D-related-deadlock-on-module-removal.patch | 4 +- ...g-conditional-compiling-for-call-to-.patch | 2 +- ...-disable-interrupt-source-RxOverflow.patch | 2 +- ...r8169-add-support-for-RTL8126A-rev.b.patch | 2 +- ...2-r8169-avoid-unsolicited-interrupts.patch | 39 ----------------- ...et-dsa-mv88e6xxx-Support-LED-control.patch | 6 +-- ...c3-add-optional-PHY-interface-clocks.patch | 2 +- ...ove-performance-usb-using-lowmem-for.patch | 6 +-- 25 files changed, 32 insertions(+), 114 deletions(-) delete mode 100644 target/linux/generic/backport-6.6/777-netfilter-xtables-fix-typo-causing-some-targets-to-not-load-on-IPv6.patch delete mode 100644 target/linux/generic/backport-6.6/780-24-v6.12-r8169-avoid-unsolicited-interrupts.patch diff --git a/include/kernel-6.6 b/include/kernel-6.6 index df3464ab4118fa..5e154f2d217549 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .58 -LINUX_KERNEL_HASH-6.6.58 = e7df81e588d70fab5ec3ec3bb04ac53d51f0860fc3b1ec45e0a4167a026899db +LINUX_VERSION-6.6 = .59 +LINUX_KERNEL_HASH-6.6.59 = 23616808d8c08f12815ff898f4edb4c11397a2b2843d029ee62452d21833a76d diff --git a/target/linux/bcm27xx/patches-6.6/950-0481-xhci-Use-more-event-ring-segment-table-entries.patch b/target/linux/bcm27xx/patches-6.6/950-0481-xhci-Use-more-event-ring-segment-table-entries.patch index 27a43828dd4698..ff8c9223b5f5ba 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0481-xhci-Use-more-event-ring-segment-table-entries.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0481-xhci-Use-more-event-ring-segment-table-entries.patch @@ -52,7 +52,7 @@ Signed-off-by: Jonathan Bell erst_base = xhci_read_64(xhci, &ir->ir_set->erst_base); --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1681,8 +1681,9 @@ struct urb_priv { +@@ -1425,8 +1425,9 @@ struct urb_priv { * Each segment table entry is 4*32bits long. 1K seems like an ok size: * (1K bytes * 8bytes/bit) / (4*32 bits) = 64 segment entries in the table, * meaning 64 ring segments. diff --git a/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch b/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch index ca49ada4e79107..4a7bfd4f2eb060 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch @@ -52,7 +52,7 @@ 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 -@@ -1918,6 +1918,9 @@ struct xhci_hcd { +@@ -1662,6 +1662,9 @@ struct xhci_hcd { #define XHCI_WRITE_64_HI_LO BIT_ULL(47) #define XHCI_CDNS_SCTX_QUIRK BIT_ULL(48) diff --git a/target/linux/bcm27xx/patches-6.6/950-0484-usb-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch b/target/linux/bcm27xx/patches-6.6/950-0484-usb-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch index a7d255db40adf8..663a2f93233fe7 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0484-usb-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0484-usb-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch @@ -100,7 +100,7 @@ Signed-off-by: Jonathan Bell if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1920,6 +1920,7 @@ struct xhci_hcd { +@@ -1664,6 +1664,7 @@ struct xhci_hcd { /* Downstream VLI fixes */ #define XHCI_AVOID_DQ_ON_LINK BIT_ULL(56) diff --git a/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch b/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch index 935ed89c08faea..f0c75c6bfaf4dc 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch @@ -144,7 +144,7 @@ Signed-off-by: Jonathan Bell return 0; --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1921,6 +1921,7 @@ struct xhci_hcd { +@@ -1665,6 +1665,7 @@ struct xhci_hcd { /* Downstream VLI fixes */ #define XHCI_AVOID_DQ_ON_LINK BIT_ULL(56) #define XHCI_VLI_SS_BULK_OUT_BUG BIT_ULL(57) diff --git a/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch b/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch index 7d3a139a776107..7609657162d259 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch @@ -341,7 +341,7 @@ Signed-off-by: Jonathan Bell * @hsphy_interface: "utmi" or "ulpi" * @connected: true when we're connected to a host, false otherwise * @softconnect: true when gadget connect is called, false when disconnect runs -@@ -1296,6 +1300,7 @@ struct dwc3 { +@@ -1298,6 +1302,7 @@ struct dwc3 { u8 tx_max_burst_prd; u8 tx_fifo_resize_max_num; u8 clear_stall_protocol; diff --git a/target/linux/bcm27xx/patches-6.6/950-0853-drivers-usb-dwc3-add-FS-LS-bus-instance-parkmode-dis.patch b/target/linux/bcm27xx/patches-6.6/950-0853-drivers-usb-dwc3-add-FS-LS-bus-instance-parkmode-dis.patch index 557bb033eff250..901553cd6cebce 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0853-drivers-usb-dwc3-add-FS-LS-bus-instance-parkmode-dis.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0853-drivers-usb-dwc3-add-FS-LS-bus-instance-parkmode-dis.patch @@ -62,7 +62,7 @@ Signed-off-by: Jonathan Bell * @tx_de_emphasis_quirk: set if we enable Tx de-emphasis quirk * @tx_de_emphasis: Tx de-emphasis value * 0 - -6dB de-emphasis -@@ -1344,6 +1347,7 @@ struct dwc3 { +@@ -1346,6 +1349,7 @@ struct dwc3 { unsigned ulpi_ext_vbus_drv:1; unsigned parkmode_disable_ss_quirk:1; unsigned parkmode_disable_hs_quirk:1; diff --git a/target/linux/bcm53xx/patches-6.6/180-usb-xhci-add-support-for-performing-fake-doorbell.patch b/target/linux/bcm53xx/patches-6.6/180-usb-xhci-add-support-for-performing-fake-doorbell.patch index efcda986796d27..13b6566a8e980f 100644 --- a/target/linux/bcm53xx/patches-6.6/180-usb-xhci-add-support-for-performing-fake-doorbell.patch +++ b/target/linux/bcm53xx/patches-6.6/180-usb-xhci-add-support-for-performing-fake-doorbell.patch @@ -103,7 +103,7 @@ it on BCM4708 family. if (xhci->quirks & XHCI_NEC_HOST) --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1916,6 +1916,7 @@ struct xhci_hcd { +@@ -1660,6 +1660,7 @@ struct xhci_hcd { #define XHCI_ZHAOXIN_HOST BIT_ULL(46) #define XHCI_WRITE_64_HI_LO BIT_ULL(47) #define XHCI_CDNS_SCTX_QUIRK BIT_ULL(48) diff --git a/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch b/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch index a17a91ec7c759c..aea95667e5f9b6 100644 --- a/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch +++ b/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch @@ -37,7 +37,7 @@ Signed-off-by: David S. Miller --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h -@@ -4549,6 +4549,9 @@ static inline void netif_addr_unlock_bh( +@@ -4561,6 +4561,9 @@ static inline void netif_addr_unlock_bh( void ether_setup(struct net_device *dev); diff --git a/target/linux/generic/backport-6.6/777-netfilter-xtables-fix-typo-causing-some-targets-to-not-load-on-IPv6.patch b/target/linux/generic/backport-6.6/777-netfilter-xtables-fix-typo-causing-some-targets-to-not-load-on-IPv6.patch deleted file mode 100644 index d29c7d463dd65e..00000000000000 --- a/target/linux/generic/backport-6.6/777-netfilter-xtables-fix-typo-causing-some-targets-to-not-load-on-IPv6.patch +++ /dev/null @@ -1,43 +0,0 @@ -Subject: [PATCH v2] netfilter: xtables: fix typo causing some targets to not load on IPv6 -Date: Sat, 19 Oct 2024 08:05:07 +0300 [thread overview] -Message-ID: <20241019-xtables-typos-v2-1-6b8b1735dc8e@0upti.me> (raw) - -These were added with the wrong family in 4cdc55e, which seems -to just have been a typo, but now ip6tables rules with --set-mark -don't work anymore, which is pretty bad. - -Fixes: 0bfcb7b71e73 ("netfilter: xtables: avoid NFPROTO_UNSPEC where needed") -Reviewed-by: Phil Sutter -Signed-off-by: Ilya Katsnelson ---- -Changes in v2: -- Fixed a typo in the commit message (that's karma). -- Replaced a reference to backport commit. -- Link to v1: https://lore.kernel.org/r/20241018-xtables-typos-v1-1-02a51789c0ec@0upti.me ---- - net/netfilter/xt_NFLOG.c | 2 +- - net/netfilter/xt_mark.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - ---- a/net/netfilter/xt_NFLOG.c -+++ b/net/netfilter/xt_NFLOG.c -@@ -79,7 +79,7 @@ static struct xt_target nflog_tg_reg[] _ - { - .name = "NFLOG", - .revision = 0, -- .family = NFPROTO_IPV4, -+ .family = NFPROTO_IPV6, - .checkentry = nflog_tg_check, - .destroy = nflog_tg_destroy, - .target = nflog_tg, ---- a/net/netfilter/xt_mark.c -+++ b/net/netfilter/xt_mark.c -@@ -62,7 +62,7 @@ static struct xt_target mark_tg_reg[] __ - { - .name = "MARK", - .revision = 2, -- .family = NFPROTO_IPV4, -+ .family = NFPROTO_IPV6, - .target = mark_tg, - .targetsize = sizeof(struct xt_mark_tginfo2), - .me = THIS_MODULE, diff --git a/target/linux/generic/backport-6.6/780-04-v6.8-r8169-improve-handling-task-scheduling.patch b/target/linux/generic/backport-6.6/780-04-v6.8-r8169-improve-handling-task-scheduling.patch index f020284cc80a43..757c800533dac3 100644 --- a/target/linux/generic/backport-6.6/780-04-v6.8-r8169-improve-handling-task-scheduling.patch +++ b/target/linux/generic/backport-6.6/780-04-v6.8-r8169-improve-handling-task-scheduling.patch @@ -29,7 +29,7 @@ Signed-off-by: Jakub Kicinski set_bit(flag, tp->wk.flags); schedule_work(&tp->wk.work); } -@@ -4518,8 +4521,7 @@ static void rtl_task(struct work_struct +@@ -4520,8 +4523,7 @@ static void rtl_task(struct work_struct rtnl_lock(); diff --git a/target/linux/generic/backport-6.6/780-05-v6.8-r8169-add-support-for-LED-s-on-RTL8168-RTL8101.patch b/target/linux/generic/backport-6.6/780-05-v6.8-r8169-add-support-for-LED-s-on-RTL8168-RTL8101.patch index 95245b9a54ce60..0504a00df4f87a 100644 --- a/target/linux/generic/backport-6.6/780-05-v6.8-r8169-add-support-for-LED-s-on-RTL8168-RTL8101.patch +++ b/target/linux/generic/backport-6.6/780-05-v6.8-r8169-add-support-for-LED-s-on-RTL8168-RTL8101.patch @@ -296,7 +296,7 @@ Signed-off-by: David S. Miller static void r8168fp_adjust_ocp_cmd(struct rtl8169_private *tp, u32 *cmd, int type) { /* based on RTL8168FP_OOBMAC_BASE in vendor driver */ -@@ -5195,6 +5253,7 @@ static int rtl_init_one(struct pci_dev * +@@ -5197,6 +5255,7 @@ static int rtl_init_one(struct pci_dev * raw_spin_lock_init(&tp->cfg9346_usage_lock); raw_spin_lock_init(&tp->config25_lock); raw_spin_lock_init(&tp->mac_ocp_lock); @@ -304,7 +304,7 @@ Signed-off-by: David S. Miller dev->tstats = devm_netdev_alloc_pcpu_stats(&pdev->dev, struct pcpu_sw_netstats); -@@ -5351,6 +5410,12 @@ static int rtl_init_one(struct pci_dev * +@@ -5353,6 +5412,12 @@ static int rtl_init_one(struct pci_dev * if (rc) return rc; diff --git a/target/linux/generic/backport-6.6/780-06-v6.8-r8169-fix-building-with-CONFIG_LEDS_CLASS-m.patch b/target/linux/generic/backport-6.6/780-06-v6.8-r8169-fix-building-with-CONFIG_LEDS_CLASS-m.patch index 819a611cb3f26d..1adaf87625e6ce 100644 --- a/target/linux/generic/backport-6.6/780-06-v6.8-r8169-fix-building-with-CONFIG_LEDS_CLASS-m.patch +++ b/target/linux/generic/backport-6.6/780-06-v6.8-r8169-fix-building-with-CONFIG_LEDS_CLASS-m.patch @@ -59,7 +59,7 @@ Signed-off-by: Jakub Kicinski obj-$(CONFIG_R8169) += r8169.o --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -5410,11 +5410,10 @@ static int rtl_init_one(struct pci_dev * +@@ -5412,11 +5412,10 @@ static int rtl_init_one(struct pci_dev * if (rc) return rc; diff --git a/target/linux/generic/backport-6.6/780-07-v6.9-r8169-simplify-EEE-handling.patch b/target/linux/generic/backport-6.6/780-07-v6.9-r8169-simplify-EEE-handling.patch index d3a26303ef0e57..c3f94b3aff07aa 100644 --- a/target/linux/generic/backport-6.6/780-07-v6.9-r8169-simplify-EEE-handling.patch +++ b/target/linux/generic/backport-6.6/780-07-v6.9-r8169-simplify-EEE-handling.patch @@ -75,7 +75,7 @@ Signed-off-by: Jakub Kicinski genphy_soft_reset(tp->phydev); } -@@ -5112,7 +5087,9 @@ static int r8169_mdio_register(struct rt +@@ -5114,7 +5089,9 @@ static int r8169_mdio_register(struct rt } tp->phydev->mac_managed_pm = true; @@ -86,7 +86,7 @@ Signed-off-by: Jakub Kicinski phy_support_asym_pause(tp->phydev); /* PHY will be woken up in rtl_open() */ -@@ -5247,7 +5224,6 @@ static int rtl_init_one(struct pci_dev * +@@ -5249,7 +5226,6 @@ static int rtl_init_one(struct pci_dev * tp->dev = dev; tp->pci_dev = pdev; tp->supports_gmii = ent->driver_data == RTL_CFG_NO_GBIT ? 0 : 1; diff --git a/target/linux/generic/backport-6.6/780-08-v6.9-r8169-add-support-for-RTL8126A.patch b/target/linux/generic/backport-6.6/780-08-v6.9-r8169-add-support-for-RTL8126A.patch index 6dfaa904a175e3..354aacf1cf7c89 100644 --- a/target/linux/generic/backport-6.6/780-08-v6.9-r8169-add-support-for-RTL8126A.patch +++ b/target/linux/generic/backport-6.6/780-08-v6.9-r8169-add-support-for-RTL8126A.patch @@ -321,7 +321,7 @@ Signed-off-by: David S. Miller padto = max_t(unsigned int, padto, ETH_ZLEN); break; default: -@@ -5139,7 +5196,7 @@ static void rtl_hw_initialize(struct rtl +@@ -5141,7 +5198,7 @@ static void rtl_hw_initialize(struct rtl case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_48: rtl_hw_init_8168g(tp); break; diff --git a/target/linux/generic/backport-6.6/780-10-v6.9-r8169-simplify-code-by-using-core-provided-pcpu-stat.patch b/target/linux/generic/backport-6.6/780-10-v6.9-r8169-simplify-code-by-using-core-provided-pcpu-stat.patch index 0288dcb11e7aef..c155b11431f87c 100644 --- a/target/linux/generic/backport-6.6/780-10-v6.9-r8169-simplify-code-by-using-core-provided-pcpu-stat.patch +++ b/target/linux/generic/backport-6.6/780-10-v6.9-r8169-simplify-code-by-using-core-provided-pcpu-stat.patch @@ -16,7 +16,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -5288,11 +5288,6 @@ static int rtl_init_one(struct pci_dev * +@@ -5290,11 +5290,6 @@ static int rtl_init_one(struct pci_dev * raw_spin_lock_init(&tp->mac_ocp_lock); mutex_init(&tp->led_lock); @@ -28,7 +28,7 @@ Signed-off-by: Paolo Abeni /* Get the *optional* external "ether_clk" used on some boards */ tp->clk = devm_clk_get_optional_enabled(&pdev->dev, "ether_clk"); if (IS_ERR(tp->clk)) -@@ -5407,6 +5402,8 @@ static int rtl_init_one(struct pci_dev * +@@ -5409,6 +5404,8 @@ static int rtl_init_one(struct pci_dev * dev->hw_features |= NETIF_F_RXALL; dev->hw_features |= NETIF_F_RXFCS; diff --git a/target/linux/generic/backport-6.6/780-11-v6.9-r8169-add-LED-support-for-RTL8125-RTL8126.patch b/target/linux/generic/backport-6.6/780-11-v6.9-r8169-add-LED-support-for-RTL8125-RTL8126.patch index 449aa11591a1d0..1c793f9b1d337a 100644 --- a/target/linux/generic/backport-6.6/780-11-v6.9-r8169-add-LED-support-for-RTL8125-RTL8126.patch +++ b/target/linux/generic/backport-6.6/780-11-v6.9-r8169-add-LED-support-for-RTL8125-RTL8126.patch @@ -225,7 +225,7 @@ Signed-off-by: Jakub Kicinski void r8169_get_led_name(struct rtl8169_private *tp, int idx, char *buf, int buf_len) { -@@ -5440,10 +5491,12 @@ static int rtl_init_one(struct pci_dev * +@@ -5442,10 +5493,12 @@ static int rtl_init_one(struct pci_dev * if (rc) return rc; diff --git a/target/linux/generic/backport-6.6/780-16-v6.9-r8169-fix-LED-related-deadlock-on-module-removal.patch b/target/linux/generic/backport-6.6/780-16-v6.9-r8169-fix-LED-related-deadlock-on-module-removal.patch index 6e0ff9b14bd566..cb031d8f34887a 100644 --- a/target/linux/generic/backport-6.6/780-16-v6.9-r8169-fix-LED-related-deadlock-on-module-removal.patch +++ b/target/linux/generic/backport-6.6/780-16-v6.9-r8169-fix-LED-related-deadlock-on-module-removal.patch @@ -124,7 +124,7 @@ Signed-off-by: David S. Miller u32 ocp_base; }; -@@ -5067,6 +5069,8 @@ static void rtl_remove_one(struct pci_de +@@ -5069,6 +5071,8 @@ static void rtl_remove_one(struct pci_de cancel_work_sync(&tp->wk.work); @@ -133,7 +133,7 @@ Signed-off-by: David S. Miller unregister_netdev(tp->dev); if (tp->dash_type != RTL_DASH_NONE) -@@ -5525,9 +5529,9 @@ static int rtl_init_one(struct pci_dev * +@@ -5527,9 +5531,9 @@ static int rtl_init_one(struct pci_dev * if (IS_ENABLED(CONFIG_R8169_LEDS)) { if (rtl_is_8125(tp)) diff --git a/target/linux/generic/backport-6.6/780-17-v6.9-r8169-add-missing-conditional-compiling-for-call-to-.patch b/target/linux/generic/backport-6.6/780-17-v6.9-r8169-add-missing-conditional-compiling-for-call-to-.patch index e647e18167e48a..0412c919035f4b 100644 --- a/target/linux/generic/backport-6.6/780-17-v6.9-r8169-add-missing-conditional-compiling-for-call-to-.patch +++ b/target/linux/generic/backport-6.6/780-17-v6.9-r8169-add-missing-conditional-compiling-for-call-to-.patch @@ -19,7 +19,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -5069,7 +5069,8 @@ static void rtl_remove_one(struct pci_de +@@ -5071,7 +5071,8 @@ static void rtl_remove_one(struct pci_de cancel_work_sync(&tp->wk.work); diff --git a/target/linux/generic/backport-6.6/780-20-v6.11-r8169-disable-interrupt-source-RxOverflow.patch b/target/linux/generic/backport-6.6/780-20-v6.11-r8169-disable-interrupt-source-RxOverflow.patch index 9389585f160355..fc10a3ff143076 100644 --- a/target/linux/generic/backport-6.6/780-20-v6.11-r8169-disable-interrupt-source-RxOverflow.patch +++ b/target/linux/generic/backport-6.6/780-20-v6.11-r8169-disable-interrupt-source-RxOverflow.patch @@ -18,7 +18,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -5110,12 +5110,10 @@ static void rtl_set_irq_mask(struct rtl8 +@@ -5112,12 +5112,10 @@ static void rtl_set_irq_mask(struct rtl8 tp->irq_mask = RxOK | RxErr | TxOK | TxErr | LinkChg; if (tp->mac_version <= RTL_GIGA_MAC_VER_06) diff --git a/target/linux/generic/backport-6.6/780-22-v6.12-r8169-add-support-for-RTL8126A-rev.b.patch b/target/linux/generic/backport-6.6/780-22-v6.12-r8169-add-support-for-RTL8126A-rev.b.patch index dd90fc1a65a67e..a825627e743919 100644 --- a/target/linux/generic/backport-6.6/780-22-v6.12-r8169-add-support-for-RTL8126A-rev.b.patch +++ b/target/linux/generic/backport-6.6/780-22-v6.12-r8169-add-support-for-RTL8126A-rev.b.patch @@ -224,7 +224,7 @@ Signed-off-by: Jakub Kicinski padto = max_t(unsigned int, padto, ETH_ZLEN); break; default: -@@ -5286,7 +5298,7 @@ static void rtl_hw_initialize(struct rtl +@@ -5288,7 +5300,7 @@ static void rtl_hw_initialize(struct rtl case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_48: rtl_hw_init_8168g(tp); break; diff --git a/target/linux/generic/backport-6.6/780-24-v6.12-r8169-avoid-unsolicited-interrupts.patch b/target/linux/generic/backport-6.6/780-24-v6.12-r8169-avoid-unsolicited-interrupts.patch deleted file mode 100644 index 8332a285f9f085..00000000000000 --- a/target/linux/generic/backport-6.6/780-24-v6.12-r8169-avoid-unsolicited-interrupts.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 10ce0db787004875f4dba068ea952207d1d8abeb Mon Sep 17 00:00:00 2001 -From: Heiner Kallweit -Date: Fri, 18 Oct 2024 11:08:16 +0200 -Subject: [PATCH] r8169: avoid unsolicited interrupts - -It was reported that after resume from suspend a PCI error is logged -and connectivity is broken. Error message is: -PCI error (cmd = 0x0407, status_errs = 0x0000) -The message seems to be a red herring as none of the error bits is set, -and the PCI command register value also is normal. Exception handling -for a PCI error includes a chip reset what apparently brakes connectivity -here. The interrupt status bit triggering the PCI error handling isn't -actually used on PCIe chip versions, so it's not clear why this bit is -set by the chip. Fix this by ignoring this bit on PCIe chip versions. - -Fixes: 0e4851502f84 ("r8169: merge with version 8.001.00 of Realtek's r8168 driver") -Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219388 -Tested-by: Atlas Yu -Signed-off-by: Heiner Kallweit -Reviewed-by: Simon Horman -Link: https://patch.msgid.link/78e2f535-438f-4212-ad94-a77637ac6c9c@gmail.com -Signed-off-by: Paolo Abeni ---- - drivers/net/ethernet/realtek/r8169_main.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - ---- a/drivers/net/ethernet/realtek/r8169_main.c -+++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -4683,7 +4683,9 @@ static irqreturn_t rtl8169_interrupt(int - if ((status & 0xffff) == 0xffff || !(status & tp->irq_mask)) - return IRQ_NONE; - -- if (unlikely(status & SYSErr)) { -+ /* At least RTL8168fp may unexpectedly set the SYSErr bit */ -+ if (unlikely(status & SYSErr && -+ tp->mac_version <= RTL_GIGA_MAC_VER_06)) { - rtl8169_pcierr_interrupt(tp->dev); - goto out; - } diff --git a/target/linux/generic/backport-6.6/901-v6.13-net-dsa-mv88e6xxx-Support-LED-control.patch b/target/linux/generic/backport-6.6/901-v6.13-net-dsa-mv88e6xxx-Support-LED-control.patch index 8557fe2510b8a2..711246da617e09 100644 --- a/target/linux/generic/backport-6.6/901-v6.13-net-dsa-mv88e6xxx-Support-LED-control.patch +++ b/target/linux/generic/backport-6.6/901-v6.13-net-dsa-mv88e6xxx-Support-LED-control.patch @@ -217,7 +217,7 @@ Signed-off-by: Linus Walleij #include #include #include -@@ -275,6 +277,7 @@ struct mv88e6xxx_vlan { +@@ -276,6 +278,7 @@ struct mv88e6xxx_vlan { struct mv88e6xxx_port { struct mv88e6xxx_chip *chip; int port; @@ -225,7 +225,7 @@ Signed-off-by: Linus Walleij struct mv88e6xxx_vlan bridge_pvid; u64 serdes_stats[2]; u64 atu_member_violation; -@@ -289,6 +292,11 @@ struct mv88e6xxx_port { +@@ -290,6 +293,11 @@ struct mv88e6xxx_port { struct devlink_region *region; void *pcs_private; @@ -237,7 +237,7 @@ Signed-off-by: Linus Walleij /* MacAuth Bypass control flag */ bool mab; }; -@@ -561,6 +569,9 @@ struct mv88e6xxx_ops { +@@ -563,6 +571,9 @@ struct mv88e6xxx_ops { phy_interface_t mode); int (*port_get_cmode)(struct mv88e6xxx_chip *chip, int port, u8 *cmode); diff --git a/target/linux/rockchip/patches-6.6/034-v6.7-usb-dwc3-add-optional-PHY-interface-clocks.patch b/target/linux/rockchip/patches-6.6/034-v6.7-usb-dwc3-add-optional-PHY-interface-clocks.patch index 3ae1c54ef2a057..0b9e47da3c9879 100644 --- a/target/linux/rockchip/patches-6.6/034-v6.7-usb-dwc3-add-optional-PHY-interface-clocks.patch +++ b/target/linux/rockchip/patches-6.6/034-v6.7-usb-dwc3-add-optional-PHY-interface-clocks.patch @@ -80,7 +80,7 @@ Signed-off-by: Greg Kroah-Hartman * @reset: reset control * @regs: base address for our registers * @regs_size: address space size -@@ -1167,6 +1169,8 @@ struct dwc3 { +@@ -1169,6 +1171,8 @@ struct dwc3 { struct clk *bus_clk; struct clk *ref_clk; struct clk *susp_clk; diff --git a/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch b/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch index 2554e731987841..44c6fe6126802f 100644 --- a/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch +++ b/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch @@ -263,7 +263,7 @@ Signed-off-by: minda.chen /** --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1764,6 +1764,13 @@ struct xhci_hub { +@@ -1508,6 +1508,13 @@ struct xhci_hub { u8 min_rev; }; @@ -277,7 +277,7 @@ Signed-off-by: minda.chen /* There is one xhci_hcd structure per controller */ struct xhci_hcd { struct usb_hcd *main_hcd; -@@ -1917,6 +1924,8 @@ struct xhci_hcd { +@@ -1661,6 +1668,8 @@ struct xhci_hcd { #define XHCI_WRITE_64_HI_LO BIT_ULL(47) #define XHCI_CDNS_SCTX_QUIRK BIT_ULL(48) @@ -286,7 +286,7 @@ Signed-off-by: minda.chen unsigned int num_active_eps; unsigned int limit_active_eps; struct xhci_port *hw_ports; -@@ -1946,6 +1955,8 @@ struct xhci_hcd { +@@ -1690,6 +1699,8 @@ struct xhci_hcd { struct list_head regset_list; void *dbc; From 4b413687e68084d2c81472ae40eaa7d15e89c37b Mon Sep 17 00:00:00 2001 From: Mieczyslaw Nalewaj Date: Fri, 1 Nov 2024 21:59:23 +0100 Subject: [PATCH 030/877] mac80211: compatibility with kernel 6.6.59 Fix genlmsg_multicast_allns() build error on kernel 6.6.59. Based on kernel patch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit?h=v6.6.59&id=e0f83d268974dab0361d11904dfc9acec53f96a6 Signed-off-by: Mieczyslaw Nalewaj Link: https://github.com/openwrt/openwrt/pull/16835 Signed-off-by: Hauke Mehrtens (cherry picked from commit 31f1dabb4b9727b300ddaa2801903ae4b72e4e1e) Link: https://github.com/openwrt/openwrt/pull/16894 Signed-off-by: Robert Marko --- ...t_allns-build-error-on-kernel-6.6.59.patch | 169 ++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 package/kernel/mac80211/patches/build/236-fix-genlmsg_multicast_allns-build-error-on-kernel-6.6.59.patch diff --git a/package/kernel/mac80211/patches/build/236-fix-genlmsg_multicast_allns-build-error-on-kernel-6.6.59.patch b/package/kernel/mac80211/patches/build/236-fix-genlmsg_multicast_allns-build-error-on-kernel-6.6.59.patch new file mode 100644 index 00000000000000..905bf8dfc17634 --- /dev/null +++ b/package/kernel/mac80211/patches/build/236-fix-genlmsg_multicast_allns-build-error-on-kernel-6.6.59.patch @@ -0,0 +1,169 @@ +From e0f83d268974dab0361d11904dfc9acec53f96a6 Mon Sep 17 00:00:00 2001 +From: Eric Dumazet +Date: Fri, 11 Oct 2024 17:12:17 +0000 +Subject: [PATCH] genetlink: hold RCU in genlmsg_mcast() + +[ Upstream commit 56440d7ec28d60f8da3bfa09062b3368ff9b16db ] + +While running net selftests with CONFIG_PROVE_RCU_LIST=y I saw +one lockdep splat [1]. + +genlmsg_mcast() uses for_each_net_rcu(), and must therefore hold RCU. + +Instead of letting all callers guard genlmsg_multicast_allns() +with a rcu_read_lock()/rcu_read_unlock() pair, do it in genlmsg_mcast(). + +This also means the @flags parameter is useless, we need to always use +GFP_ATOMIC. + +[1] +[10882.424136] ============================= +[10882.424166] WARNING: suspicious RCU usage +[10882.424309] 6.12.0-rc2-virtme #1156 Not tainted +[10882.424400] ----------------------------- +[10882.424423] net/netlink/genetlink.c:1940 RCU-list traversed in non-reader section!! +[10882.424469] +other info that might help us debug this: + +[10882.424500] +rcu_scheduler_active = 2, debug_locks = 1 +[10882.424744] 2 locks held by ip/15677: +[10882.424791] #0: ffffffffb6b491b0 (cb_lock){++++}-{3:3}, at: genl_rcv (net/netlink/genetlink.c:1219) +[10882.426334] #1: ffffffffb6b49248 (genl_mutex){+.+.}-{3:3}, at: genl_rcv_msg (net/netlink/genetlink.c:61 net/netlink/genetlink.c:57 net/netlink/genetlink.c:1209) +[10882.426465] +stack backtrace: +[10882.426805] CPU: 14 UID: 0 PID: 15677 Comm: ip Not tainted 6.12.0-rc2-virtme #1156 +[10882.426919] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 +[10882.427046] Call Trace: +[10882.427131] +[10882.427244] dump_stack_lvl (lib/dump_stack.c:123) +[10882.427335] lockdep_rcu_suspicious (kernel/locking/lockdep.c:6822) +[10882.427387] genlmsg_multicast_allns (net/netlink/genetlink.c:1940 (discriminator 7) net/netlink/genetlink.c:1977 (discriminator 7)) +[10882.427436] l2tp_tunnel_notify.constprop.0 (net/l2tp/l2tp_netlink.c:119) l2tp_netlink +[10882.427683] l2tp_nl_cmd_tunnel_create (net/l2tp/l2tp_netlink.c:253) l2tp_netlink +[10882.427748] genl_family_rcv_msg_doit (net/netlink/genetlink.c:1115) +[10882.427834] genl_rcv_msg (net/netlink/genetlink.c:1195 net/netlink/genetlink.c:1210) +[10882.427877] ? __pfx_l2tp_nl_cmd_tunnel_create (net/l2tp/l2tp_netlink.c:186) l2tp_netlink +[10882.427927] ? __pfx_genl_rcv_msg (net/netlink/genetlink.c:1201) +[10882.427959] netlink_rcv_skb (net/netlink/af_netlink.c:2551) +[10882.428069] genl_rcv (net/netlink/genetlink.c:1220) +[10882.428095] netlink_unicast (net/netlink/af_netlink.c:1332 net/netlink/af_netlink.c:1357) +[10882.428140] netlink_sendmsg (net/netlink/af_netlink.c:1901) +[10882.428210] ____sys_sendmsg (net/socket.c:729 (discriminator 1) net/socket.c:744 (discriminator 1) net/socket.c:2607 (discriminator 1)) + +Fixes: 33f72e6f0c67 ("l2tp : multicast notification to the registered listeners") +Signed-off-by: Eric Dumazet +Cc: James Chapman +Cc: Tom Parkin +Cc: Johannes Berg +Link: https://patch.msgid.link/20241011171217.3166614-1-edumazet@google.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/target/target_core_user.c | 2 +- + include/net/genetlink.h | 3 +-- + net/l2tp/l2tp_netlink.c | 4 ++-- + net/netlink/genetlink.c | 28 ++++++++++++++-------------- + net/wireless/nl80211.c | 8 ++------ + 5 files changed, 20 insertions(+), 25 deletions(-) + +--- a/backport-include/net/genetlink.h ++++ b/backport-include/net/genetlink.h +@@ -150,7 +150,7 @@ int genlmsg_multicast(const struct genl_ + #define genlmsg_multicast_allns LINUX_BACKPORT(genlmsg_multicast_allns) + int backport_genlmsg_multicast_allns(const struct genl_family *family, + struct sk_buff *skb, u32 portid, +- unsigned int group, gfp_t flags); ++ unsigned int group); + + #define genl_family_attrbuf LINUX_BACKPORT(genl_family_attrbuf) + static inline struct nlattr **genl_family_attrbuf(struct genl_family *family) +--- a/compat/backport-genetlink.c ++++ b/compat/backport-genetlink.c +@@ -198,23 +198,23 @@ int genlmsg_multicast(const struct genl_ + } + EXPORT_SYMBOL_GPL(genlmsg_multicast); + +-static int genlmsg_mcast(struct sk_buff *skb, u32 portid, unsigned long group, +- gfp_t flags) ++static int genlmsg_mcast(struct sk_buff *skb, u32 portid, unsigned long group) + { + struct sk_buff *tmp; + struct net *net, *prev = NULL; + bool delivered = false; + int err; + ++ rcu_read_lock(); + for_each_net_rcu(net) { + if (prev) { +- tmp = skb_clone(skb, flags); ++ tmp = skb_clone(skb, GFP_ATOMIC); + if (!tmp) { + err = -ENOMEM; + goto error; + } + err = nlmsg_multicast(prev->genl_sock, tmp, +- portid, group, flags); ++ portid, group, GFP_ATOMIC); + if (!err) + delivered = true; + else if (err != -ESRCH) +@@ -223,25 +223,29 @@ static int genlmsg_mcast(struct sk_buff + + prev = net; + } ++ err = nlmsg_multicast(prev->genl_sock, skb, portid, group, GFP_ATOMIC); ++ ++ rcu_read_unlock(); + +- err = nlmsg_multicast(prev->genl_sock, skb, portid, group, flags); + if (!err) + delivered = true; + else if (err != -ESRCH) + return err; + return delivered ? 0 : -ESRCH; + error: ++ rcu_read_unlock(); ++ + kfree_skb(skb); + return err; + } + + int backport_genlmsg_multicast_allns(const struct genl_family *family, + struct sk_buff *skb, u32 portid, +- unsigned int group, gfp_t flags) ++ unsigned int group) + { + group = __backport_genl_group(family, group); + if (group == INVALID_GROUP) + return -EINVAL; +- return genlmsg_mcast(skb, portid, group, flags); ++ return genlmsg_mcast(skb, portid, group); + } + EXPORT_SYMBOL_GPL(backport_genlmsg_multicast_allns); +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -17956,10 +17956,8 @@ void nl80211_common_reg_change_event(enu + + genlmsg_end(msg, hdr); + +- rcu_read_lock(); + genlmsg_multicast_allns(&nl80211_fam, msg, 0, +- NL80211_MCGRP_REGULATORY, GFP_ATOMIC); +- rcu_read_unlock(); ++ NL80211_MCGRP_REGULATORY); + + return; + +@@ -18692,10 +18690,8 @@ void nl80211_send_beacon_hint_event(stru + + genlmsg_end(msg, hdr); + +- rcu_read_lock(); + genlmsg_multicast_allns(&nl80211_fam, msg, 0, +- NL80211_MCGRP_REGULATORY, GFP_ATOMIC); +- rcu_read_unlock(); ++ NL80211_MCGRP_REGULATORY); + + return; + From 92eb867873414e67df398859e082bffe0fcdfe80 Mon Sep 17 00:00:00 2001 From: John Audia Date: Fri, 8 Nov 2024 14:57:44 -0500 Subject: [PATCH 031/877] kernel: bump 6.6 to 6.6.60 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.60 Removed upstreamed: generic/backport-6.6/409-mtd-spi-nor-winbond-fix-w25q128-regression.patch All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.60&id=27a58a19bd20a7afe369da2ce6d4ebea70768acd Build system: x86/64 Build-tested: x86/64/AMD Cezanne, flogic/glinet_gl-mt6000, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Run-tested: x86/64/AMD Cezanne, flogic/glinet_gl-mt6000, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/16892 Signed-off-by: Nick Hainke (cherry picked from commit 85844cfc5c591d00997ade665340315d54bc5822) --- include/kernel-6.6 | 4 +- ...evm_thermal_of_zone_register_with_pa.patch | 4 +- ...-Poll-the-device-if-no-interrupt-is-.patch | 2 +- ...-Clean-up-timer-and-workqueue-on-rem.patch | 4 +- ...ci_sync-Add-fallback-bd-address-prop.patch | 4 +- ...n-edt-ft5x06-Suppress-bogus-data-on-.patch | 4 +- ...th-hci_sync-Fix-crash-on-NULL-parent.patch | 2 +- ...i-nor-winbond-fix-w25q128-regression.patch | 59 ------------------- ...tional-threaded-NAPI-wakeup-based-on.patch | 6 +- ...-to-use-SMP-threads-for-backlog-NAPI.patch | 22 +++---- ...klog-NAPI-to-clean-up-the-defer_list.patch | 2 +- ...-net-Rename-rps_lock-to-backlog_lock.patch | 18 +++--- ...-net-Make-USO-depend-on-CSUM-offload.patch | 6 +- ...64-if-device-if-driver-is-configured.patch | 2 +- ...-create-a-dummy-net_device-allocator.patch | 6 +- ...t-introduce-napi_is_scheduled-helper.patch | 2 +- ...c-move-TX-timer-arm-after-DMA-enable.patch | 12 ++-- ...et-free_netdev-exit-earlier-if-dummy.patch | 2 +- ...vert-driver-core-Set-fw_devlink-on-b.patch | 2 +- ...fix-serdes-init-sequence-for-IPQ6018.patch | 2 +- .../1009-net-stmmac-use-GFP_DMA32.patch | 2 +- 21 files changed, 54 insertions(+), 113 deletions(-) delete mode 100644 target/linux/generic/backport-6.6/409-mtd-spi-nor-winbond-fix-w25q128-regression.patch diff --git a/include/kernel-6.6 b/include/kernel-6.6 index 5e154f2d217549..261a77428cd3be 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .59 -LINUX_KERNEL_HASH-6.6.59 = 23616808d8c08f12815ff898f4edb4c11397a2b2843d029ee62452d21833a76d +LINUX_VERSION-6.6 = .60 +LINUX_KERNEL_HASH-6.6.60 = 52f9e32d5082ab94253447fd66670d0c3bb765cfcb99b0bf61d1b8eae25952ef diff --git a/target/linux/airoha/patches-6.6/101-01-thermal-of-Add-devm_thermal_of_zone_register_with_pa.patch b/target/linux/airoha/patches-6.6/101-01-thermal-of-Add-devm_thermal_of_zone_register_with_pa.patch index e69f57d27309c0..889ec1123ef314 100644 --- a/target/linux/airoha/patches-6.6/101-01-thermal-of-Add-devm_thermal_of_zone_register_with_pa.patch +++ b/target/linux/airoha/patches-6.6/101-01-thermal-of-Add-devm_thermal_of_zone_register_with_pa.patch @@ -181,7 +181,7 @@ Signed-off-by: Christian Marangi * @dev: Device for which which resource was allocated. --- a/include/linux/thermal.h +++ b/include/linux/thermal.h -@@ -261,6 +261,10 @@ struct thermal_zone_params { +@@ -263,6 +263,10 @@ struct thermal_zone_params { #ifdef CONFIG_THERMAL_OF struct thermal_zone_device *devm_thermal_of_zone_register(struct device *dev, int id, void *data, const struct thermal_zone_device_ops *ops); @@ -192,7 +192,7 @@ Signed-off-by: Christian Marangi void devm_thermal_of_zone_unregister(struct device *dev, struct thermal_zone_device *tz); -@@ -272,6 +276,15 @@ struct thermal_zone_device *devm_thermal +@@ -274,6 +278,15 @@ struct thermal_zone_device *devm_thermal { return ERR_PTR(-ENOTSUPP); } diff --git a/target/linux/bcm27xx/patches-6.6/950-0262-Input-edt-ft5x06-Poll-the-device-if-no-interrupt-is-.patch b/target/linux/bcm27xx/patches-6.6/950-0262-Input-edt-ft5x06-Poll-the-device-if-no-interrupt-is-.patch index bfb26e8f02850c..9369883fc6084f 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0262-Input-edt-ft5x06-Poll-the-device-if-no-interrupt-is-.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0262-Input-edt-ft5x06-Poll-the-device-if-no-interrupt-is-.patch @@ -193,7 +193,7 @@ Signed-off-by: Dave Stevenson tsdata->tdata_offset + crclen; } -@@ -1317,17 +1374,27 @@ static int edt_ft5x06_ts_probe(struct i2 +@@ -1335,17 +1392,27 @@ static int edt_ft5x06_ts_probe(struct i2 return error; } diff --git a/target/linux/bcm27xx/patches-6.6/950-0302-Input-edt-ft54x6-Clean-up-timer-and-workqueue-on-rem.patch b/target/linux/bcm27xx/patches-6.6/950-0302-Input-edt-ft54x6-Clean-up-timer-and-workqueue-on-rem.patch index 2b5abd258175b5..3486c2acaacfe0 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0302-Input-edt-ft54x6-Clean-up-timer-and-workqueue-on-rem.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0302-Input-edt-ft54x6-Clean-up-timer-and-workqueue-on-rem.patch @@ -18,7 +18,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/input/touchscreen/edt-ft5x06.c +++ b/drivers/input/touchscreen/edt-ft5x06.c -@@ -1420,6 +1420,10 @@ static void edt_ft5x06_ts_remove(struct +@@ -1438,6 +1438,10 @@ static void edt_ft5x06_ts_remove(struct { struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client); @@ -27,5 +27,5 @@ Signed-off-by: Dave Stevenson + cancel_work_sync(&tsdata->work_i2c_poll); + } edt_ft5x06_ts_teardown_debugfs(tsdata); - regmap_exit(tsdata->regmap); } + diff --git a/target/linux/bcm27xx/patches-6.6/950-0441-Bluetooth-hci_sync-Add-fallback-bd-address-prop.patch b/target/linux/bcm27xx/patches-6.6/950-0441-Bluetooth-hci_sync-Add-fallback-bd-address-prop.patch index 0e404906be64a7..cc5e3d1dc304b6 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0441-Bluetooth-hci_sync-Add-fallback-bd-address-prop.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0441-Bluetooth-hci_sync-Add-fallback-bd-address-prop.patch @@ -20,7 +20,7 @@ Signed-off-by: Phil Elwell --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c -@@ -4861,6 +4861,7 @@ static const struct { +@@ -4865,6 +4865,7 @@ static const struct { */ static int hci_dev_setup_sync(struct hci_dev *hdev) { @@ -28,7 +28,7 @@ Signed-off-by: Phil Elwell int ret = 0; bool invalid_bdaddr; size_t i; -@@ -4889,7 +4890,8 @@ static int hci_dev_setup_sync(struct hci +@@ -4893,7 +4894,8 @@ static int hci_dev_setup_sync(struct hci test_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks); if (!ret) { if (test_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks) && diff --git a/target/linux/bcm27xx/patches-6.6/950-0669-input-touchscreen-edt-ft5x06-Suppress-bogus-data-on-.patch b/target/linux/bcm27xx/patches-6.6/950-0669-input-touchscreen-edt-ft5x06-Suppress-bogus-data-on-.patch index b3bf708ade9b56..9019a430493645 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0669-input-touchscreen-edt-ft5x06-Suppress-bogus-data-on-.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0669-input-touchscreen-edt-ft5x06-Suppress-bogus-data-on-.patch @@ -58,7 +58,7 @@ Signed-off-by: Nick Hollinghurst if (!error && num_points) error = regmap_bulk_read(tsdata->regmap, tsdata->tdata_offset, -@@ -1300,7 +1318,7 @@ static int edt_ft5x06_ts_probe(struct i2 +@@ -1318,7 +1336,7 @@ static int edt_ft5x06_ts_probe(struct i2 if (tsdata->reset_gpio) { usleep_range(5000, 6000); gpiod_set_value_cansleep(tsdata->reset_gpio, 0); @@ -67,7 +67,7 @@ Signed-off-by: Nick Hollinghurst } input = devm_input_allocate_device(&client->dev); -@@ -1389,11 +1407,12 @@ static int edt_ft5x06_ts_probe(struct i2 +@@ -1407,11 +1425,12 @@ static int edt_ft5x06_ts_probe(struct i2 return error; } } else { diff --git a/target/linux/bcm27xx/patches-6.6/950-1218-Bluetooth-hci_sync-Fix-crash-on-NULL-parent.patch b/target/linux/bcm27xx/patches-6.6/950-1218-Bluetooth-hci_sync-Fix-crash-on-NULL-parent.patch index 272f711e632d88..3b4c7e65afc17d 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1218-Bluetooth-hci_sync-Fix-crash-on-NULL-parent.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1218-Bluetooth-hci_sync-Fix-crash-on-NULL-parent.patch @@ -15,7 +15,7 @@ Signed-off-by: Phil Elwell --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c -@@ -4861,7 +4861,8 @@ static const struct { +@@ -4865,7 +4865,8 @@ static const struct { */ static int hci_dev_setup_sync(struct hci_dev *hdev) { diff --git a/target/linux/generic/backport-6.6/409-mtd-spi-nor-winbond-fix-w25q128-regression.patch b/target/linux/generic/backport-6.6/409-mtd-spi-nor-winbond-fix-w25q128-regression.patch deleted file mode 100644 index de79328138b0a5..00000000000000 --- a/target/linux/generic/backport-6.6/409-mtd-spi-nor-winbond-fix-w25q128-regression.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 342672bbdf713654316a0ff73c7f2ecf7ea6693d Mon Sep 17 00:00:00 2001 -From: Michael Walle -Date: Fri, 21 Jun 2024 14:09:29 +0200 -Subject: [PATCH] mtd: spi-nor: winbond: fix w25q128 regression - -Upstream commit d35df77707bf5ae1221b5ba1c8a88cf4fcdd4901 - -("mtd: spi-nor: winbond: fix w25q128 regression") -however the code has changed a lot after v6.6 so the patch did -not apply to v6.6 or v6.1 which still has the problem. - -This patch fixes the issue in the way of the old API and has -been tested on hardware. Please apply it for v6.1 and v6.6. - -Commit 83e824a4a595 ("mtd: spi-nor: Correct flags for Winbond w25q128") -removed the flags for non-SFDP devices. It was assumed that it wasn't in -use anymore. This wasn't true. Add the no_sfdp_flags as well as the size -again. - -We add the additional flags for dual and quad read because they have -been reported to work properly by Hartmut using both older and newer -versions of this flash, the similar flashes with 64Mbit and 256Mbit -already have these flags and because it will (luckily) trigger our -legacy SFDP parsing, so newer versions with SFDP support will still get -the parameters from the SFDP tables. - -Reported-by: Hartmut Birr -Closes: https://lore.kernel.org/r/CALxbwRo_-9CaJmt7r7ELgu+vOcgk=xZcGHobnKf=oT2=u4d4aA@mail.gmail.com/ -Fixes: 83e824a4a595 ("mtd: spi-nor: Correct flags for Winbond w25q128") -Reviewed-by: Linus Walleij -Signed-off-by: Michael Walle -Acked-by: Tudor Ambarus -Reviewed-by: Esben Haabendal -Reviewed-by: Pratyush Yadav -Signed-off-by: Pratyush Yadav -Link: https://lore.kernel.org/r/20240621120929.2670185-1-mwalle@kernel.org -[Backported to v6.6 - vastly different due to upstream changes] -Reviewed-by: Tudor Ambarus -Signed-off-by: Linus Walleij ---- - drivers/mtd/spi-nor/winbond.c | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - ---- a/drivers/mtd/spi-nor/winbond.c -+++ b/drivers/mtd/spi-nor/winbond.c -@@ -120,9 +120,10 @@ static const struct flash_info winbond_n - NO_SFDP_FLAGS(SECT_4K) }, - { "w25q80bl", INFO(0xef4014, 0, 64 * 1024, 16) - NO_SFDP_FLAGS(SECT_4K) }, -- { "w25q128", INFO(0xef4018, 0, 0, 0) -- PARSE_SFDP -- FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) }, -+ { "w25q128", INFO(0xef4018, 0, 64 * 1024, 256) -+ FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) -+ NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | -+ SPI_NOR_QUAD_READ) }, - { "w25q256", INFO(0xef4019, 0, 64 * 1024, 512) - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) - .fixups = &w25q256_fixups }, diff --git a/target/linux/generic/backport-6.6/600-v6.10-net-Remove-conditional-threaded-NAPI-wakeup-based-on.patch b/target/linux/generic/backport-6.6/600-v6.10-net-Remove-conditional-threaded-NAPI-wakeup-based-on.patch index 3f75dffde71999..6ee4716c5cd095 100644 --- a/target/linux/generic/backport-6.6/600-v6.10-net-Remove-conditional-threaded-NAPI-wakeup-based-on.patch +++ b/target/linux/generic/backport-6.6/600-v6.10-net-Remove-conditional-threaded-NAPI-wakeup-based-on.patch @@ -32,7 +32,7 @@ Signed-off-by: Paolo Abeni --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -4477,13 +4477,7 @@ static inline void ____napi_schedule(str +@@ -4481,13 +4481,7 @@ static inline void ____napi_schedule(str */ thread = READ_ONCE(napi->thread); if (thread) { @@ -47,7 +47,7 @@ Signed-off-by: Paolo Abeni wake_up_process(thread); return; } -@@ -6639,8 +6633,6 @@ static int napi_poll(struct napi_struct +@@ -6643,8 +6637,6 @@ static int napi_poll(struct napi_struct static int napi_thread_wait(struct napi_struct *napi) { @@ -56,7 +56,7 @@ Signed-off-by: Paolo Abeni set_current_state(TASK_INTERRUPTIBLE); while (!kthread_should_stop()) { -@@ -6649,15 +6641,13 @@ static int napi_thread_wait(struct napi_ +@@ -6653,15 +6645,13 @@ static int napi_thread_wait(struct napi_ * Testing SCHED bit is not enough because SCHED bit might be * set by some other busy poll thread or by napi_disable(). */ diff --git a/target/linux/generic/backport-6.6/601-v6.10-net-Allow-to-use-SMP-threads-for-backlog-NAPI.patch b/target/linux/generic/backport-6.6/601-v6.10-net-Allow-to-use-SMP-threads-for-backlog-NAPI.patch index b343a3f9642a22..8c0b41f37b33ff 100644 --- a/target/linux/generic/backport-6.6/601-v6.10-net-Allow-to-use-SMP-threads-for-backlog-NAPI.patch +++ b/target/linux/generic/backport-6.6/601-v6.10-net-Allow-to-use-SMP-threads-for-backlog-NAPI.patch @@ -108,7 +108,7 @@ Signed-off-by: Paolo Abeni static inline void rps_lock_irqsave(struct softnet_data *sd, unsigned long *flags) { -@@ -4445,6 +4471,7 @@ EXPORT_SYMBOL(__dev_direct_xmit); +@@ -4449,6 +4475,7 @@ EXPORT_SYMBOL(__dev_direct_xmit); /************************************************************************* * Receiver routines *************************************************************************/ @@ -116,7 +116,7 @@ Signed-off-by: Paolo Abeni int netdev_max_backlog __read_mostly = 1000; EXPORT_SYMBOL(netdev_max_backlog); -@@ -4477,12 +4504,16 @@ static inline void ____napi_schedule(str +@@ -4481,12 +4508,16 @@ static inline void ____napi_schedule(str */ thread = READ_ONCE(napi->thread); if (thread) { @@ -133,7 +133,7 @@ Signed-off-by: Paolo Abeni list_add_tail(&napi->poll_list, &sd->poll_list); WRITE_ONCE(napi->list_owner, smp_processor_id()); /* If not called from net_rx_action() -@@ -4728,6 +4759,11 @@ static void napi_schedule_rps(struct sof +@@ -4732,6 +4763,11 @@ static void napi_schedule_rps(struct sof #ifdef CONFIG_RPS if (sd != mysd) { @@ -145,7 +145,7 @@ Signed-off-by: Paolo Abeni sd->rps_ipi_next = mysd->rps_ipi_list; mysd->rps_ipi_list = sd; -@@ -5951,7 +5987,7 @@ static void net_rps_action_and_irq_enabl +@@ -5955,7 +5991,7 @@ static void net_rps_action_and_irq_enabl #ifdef CONFIG_RPS struct softnet_data *remsd = sd->rps_ipi_list; @@ -154,7 +154,7 @@ Signed-off-by: Paolo Abeni sd->rps_ipi_list = NULL; local_irq_enable(); -@@ -5966,7 +6002,7 @@ static void net_rps_action_and_irq_enabl +@@ -5970,7 +6006,7 @@ static void net_rps_action_and_irq_enabl static bool sd_has_rps_ipi_waiting(struct softnet_data *sd) { #ifdef CONFIG_RPS @@ -163,7 +163,7 @@ Signed-off-by: Paolo Abeni #else return false; #endif -@@ -6010,7 +6046,7 @@ static int process_backlog(struct napi_s +@@ -6014,7 +6050,7 @@ 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. */ @@ -172,7 +172,7 @@ Signed-off-by: Paolo Abeni again = false; } else { skb_queue_splice_tail_init(&sd->input_pkt_queue, -@@ -6676,43 +6712,48 @@ static void skb_defer_free_flush(struct +@@ -6680,43 +6716,48 @@ static void skb_defer_free_flush(struct } } @@ -250,7 +250,7 @@ Signed-off-by: Paolo Abeni return 0; } -@@ -11293,7 +11334,7 @@ static int dev_cpu_dead(unsigned int old +@@ -11297,7 +11338,7 @@ static int dev_cpu_dead(unsigned int old list_del_init(&napi->poll_list); if (napi->poll == process_backlog) @@ -259,7 +259,7 @@ Signed-off-by: Paolo Abeni else ____napi_schedule(sd, napi); } -@@ -11301,12 +11342,14 @@ static int dev_cpu_dead(unsigned int old +@@ -11305,12 +11346,14 @@ static int dev_cpu_dead(unsigned int old raise_softirq_irqoff(NET_TX_SOFTIRQ); local_irq_enable(); @@ -278,7 +278,7 @@ Signed-off-by: Paolo Abeni /* Process offline CPU's input_pkt_queue */ while ((skb = __skb_dequeue(&oldsd->process_queue))) { -@@ -11569,6 +11612,38 @@ static struct pernet_operations __net_in +@@ -11573,6 +11616,38 @@ static struct pernet_operations __net_in * */ @@ -317,7 +317,7 @@ Signed-off-by: Paolo Abeni /* * This is called single threaded during boot, so no need * to take the rtnl semaphore. -@@ -11619,7 +11694,10 @@ static int __init net_dev_init(void) +@@ -11623,7 +11698,10 @@ static int __init net_dev_init(void) init_gro_hash(&sd->backlog); sd->backlog.poll = process_backlog; sd->backlog.weight = weight_p; diff --git a/target/linux/generic/backport-6.6/602-v6.10-net-Use-backlog-NAPI-to-clean-up-the-defer_list.patch b/target/linux/generic/backport-6.6/602-v6.10-net-Use-backlog-NAPI-to-clean-up-the-defer_list.patch index 3b1a64e4c64f46..3fcc72e589532c 100644 --- a/target/linux/generic/backport-6.6/602-v6.10-net-Use-backlog-NAPI-to-clean-up-the-defer_list.patch +++ b/target/linux/generic/backport-6.6/602-v6.10-net-Use-backlog-NAPI-to-clean-up-the-defer_list.patch @@ -82,7 +82,7 @@ Signed-off-by: Paolo Abeni spin_unlock_irq(&sd->input_pkt_queue.lock); else if (!IS_ENABLED(CONFIG_PREEMPT_RT)) local_irq_enable(); -@@ -4778,6 +4778,23 @@ static void napi_schedule_rps(struct sof +@@ -4782,6 +4782,23 @@ static void napi_schedule_rps(struct sof __napi_schedule_irqoff(&mysd->backlog); } diff --git a/target/linux/generic/backport-6.6/603-v6.10-net-Rename-rps_lock-to-backlog_lock.patch b/target/linux/generic/backport-6.6/603-v6.10-net-Rename-rps_lock-to-backlog_lock.patch index dab96763fc292f..056bd5686eaff1 100644 --- a/target/linux/generic/backport-6.6/603-v6.10-net-Rename-rps_lock-to-backlog_lock.patch +++ b/target/linux/generic/backport-6.6/603-v6.10-net-Rename-rps_lock-to-backlog_lock.patch @@ -67,7 +67,7 @@ Signed-off-by: Paolo Abeni { if (IS_ENABLED(CONFIG_RPS) || use_backlog_threads()) spin_unlock_irq(&sd->input_pkt_queue.lock); -@@ -4783,12 +4783,12 @@ void kick_defer_list_purge(struct softne +@@ -4787,12 +4787,12 @@ void kick_defer_list_purge(struct softne unsigned long flags; if (use_backlog_threads()) { @@ -82,7 +82,7 @@ Signed-off-by: Paolo Abeni } else if (!cmpxchg(&sd->defer_ipi_scheduled, 0, 1)) { smp_call_function_single_async(cpu, &sd->defer_csd); -@@ -4850,7 +4850,7 @@ static int enqueue_to_backlog(struct sk_ +@@ -4854,7 +4854,7 @@ static int enqueue_to_backlog(struct sk_ reason = SKB_DROP_REASON_NOT_SPECIFIED; sd = &per_cpu(softnet_data, cpu); @@ -91,7 +91,7 @@ Signed-off-by: Paolo Abeni if (!netif_running(skb->dev)) goto drop; qlen = skb_queue_len(&sd->input_pkt_queue); -@@ -4859,7 +4859,7 @@ static int enqueue_to_backlog(struct sk_ +@@ -4863,7 +4863,7 @@ static int enqueue_to_backlog(struct sk_ enqueue: __skb_queue_tail(&sd->input_pkt_queue, skb); input_queue_tail_incr_save(sd, qtail); @@ -100,7 +100,7 @@ Signed-off-by: Paolo Abeni return NET_RX_SUCCESS; } -@@ -4874,7 +4874,7 @@ enqueue: +@@ -4878,7 +4878,7 @@ enqueue: drop: sd->dropped++; @@ -109,7 +109,7 @@ Signed-off-by: Paolo Abeni dev_core_stats_rx_dropped_inc(skb->dev); kfree_skb_reason(skb, reason); -@@ -5905,7 +5905,7 @@ static void flush_backlog(struct work_st +@@ -5909,7 +5909,7 @@ static void flush_backlog(struct work_st local_bh_disable(); sd = this_cpu_ptr(&softnet_data); @@ -118,7 +118,7 @@ Signed-off-by: Paolo Abeni skb_queue_walk_safe(&sd->input_pkt_queue, skb, tmp) { if (skb->dev->reg_state == NETREG_UNREGISTERING) { __skb_unlink(skb, &sd->input_pkt_queue); -@@ -5913,7 +5913,7 @@ static void flush_backlog(struct work_st +@@ -5917,7 +5917,7 @@ static void flush_backlog(struct work_st input_queue_head_incr(sd); } } @@ -127,7 +127,7 @@ Signed-off-by: Paolo Abeni skb_queue_walk_safe(&sd->process_queue, skb, tmp) { if (skb->dev->reg_state == NETREG_UNREGISTERING) { -@@ -5931,14 +5931,14 @@ static bool flush_required(int cpu) +@@ -5935,14 +5935,14 @@ static bool flush_required(int cpu) struct softnet_data *sd = &per_cpu(softnet_data, cpu); bool do_flush; @@ -144,7 +144,7 @@ Signed-off-by: Paolo Abeni return do_flush; #endif -@@ -6053,7 +6053,7 @@ static int process_backlog(struct napi_s +@@ -6057,7 +6057,7 @@ static int process_backlog(struct napi_s } @@ -153,7 +153,7 @@ Signed-off-by: Paolo Abeni if (skb_queue_empty(&sd->input_pkt_queue)) { /* * Inline a custom version of __napi_complete(). -@@ -6069,7 +6069,7 @@ static int process_backlog(struct napi_s +@@ -6073,7 +6073,7 @@ static int process_backlog(struct napi_s skb_queue_splice_tail_init(&sd->input_pkt_queue, &sd->process_queue); } diff --git a/target/linux/generic/backport-6.6/611-02-v6.11-net-Make-USO-depend-on-CSUM-offload.patch b/target/linux/generic/backport-6.6/611-02-v6.11-net-Make-USO-depend-on-CSUM-offload.patch index 30758f180f3e95..42aff7f0afc1ee 100644 --- a/target/linux/generic/backport-6.6/611-02-v6.11-net-Make-USO-depend-on-CSUM-offload.patch +++ b/target/linux/generic/backport-6.6/611-02-v6.11-net-Make-USO-depend-on-CSUM-offload.patch @@ -20,7 +20,7 @@ Signed-off-by: Jakub Kicinski --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -9755,6 +9755,15 @@ static void netdev_sync_lower_features(s +@@ -9759,6 +9759,15 @@ static void netdev_sync_lower_features(s } } @@ -36,7 +36,7 @@ Signed-off-by: Jakub Kicinski static netdev_features_t netdev_fix_features(struct net_device *dev, netdev_features_t features) { -@@ -9836,15 +9845,9 @@ static netdev_features_t netdev_fix_feat +@@ -9840,15 +9849,9 @@ static netdev_features_t netdev_fix_feat features &= ~NETIF_F_LRO; } @@ -55,7 +55,7 @@ Signed-off-by: Jakub Kicinski } if ((features & NETIF_F_HW_TLS_RX) && !(features & NETIF_F_RXCSUM)) { -@@ -9852,6 +9855,11 @@ static netdev_features_t netdev_fix_feat +@@ -9856,6 +9859,11 @@ static netdev_features_t netdev_fix_feat features &= ~NETIF_F_HW_TLS_RX; } diff --git a/target/linux/generic/backport-6.6/612-v6.9-net-get-stats64-if-device-if-driver-is-configured.patch b/target/linux/generic/backport-6.6/612-v6.9-net-get-stats64-if-device-if-driver-is-configured.patch index 2db89c5a05a3dd..d72882dbb6829b 100644 --- a/target/linux/generic/backport-6.6/612-v6.9-net-get-stats64-if-device-if-driver-is-configured.patch +++ b/target/linux/generic/backport-6.6/612-v6.9-net-get-stats64-if-device-if-driver-is-configured.patch @@ -18,7 +18,7 @@ Signed-off-by: Paolo Abeni --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -10662,6 +10662,8 @@ struct rtnl_link_stats64 *dev_get_stats( +@@ -10666,6 +10666,8 @@ struct rtnl_link_stats64 *dev_get_stats( ops->ndo_get_stats64(dev, storage); } else if (ops->ndo_get_stats) { netdev_stats_to_stats64(storage, ops->ndo_get_stats(dev)); diff --git a/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch b/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch index aea95667e5f9b6..3f48a8c34a9338 100644 --- a/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch +++ b/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch @@ -49,7 +49,7 @@ Signed-off-by: David S. Miller unsigned char name_assign_type, --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -10349,25 +10349,12 @@ err_free_name: +@@ -10353,25 +10353,12 @@ err_free_name: } EXPORT_SYMBOL(register_netdevice); @@ -79,7 +79,7 @@ Signed-off-by: David S. Miller /* make sure we BUG if trying to hit standard * register/unregister code path */ -@@ -10387,12 +10374,32 @@ int init_dummy_netdev(struct net_device +@@ -10391,12 +10378,32 @@ int init_dummy_netdev(struct net_device * because users of this 'device' dont need to change * its refcount. */ @@ -113,7 +113,7 @@ Signed-off-by: David S. Miller /** * register_netdev - register a network device * @dev: device to register -@@ -10986,6 +10993,19 @@ void free_netdev(struct net_device *dev) +@@ -10990,6 +10997,19 @@ void free_netdev(struct net_device *dev) EXPORT_SYMBOL(free_netdev); /** diff --git a/target/linux/generic/backport-6.6/770-net-introduce-napi_is_scheduled-helper.patch b/target/linux/generic/backport-6.6/770-net-introduce-napi_is_scheduled-helper.patch index 838bd03c8c55ef..d7b2b275067fb8 100644 --- a/target/linux/generic/backport-6.6/770-net-introduce-napi_is_scheduled-helper.patch +++ b/target/linux/generic/backport-6.6/770-net-introduce-napi_is_scheduled-helper.patch @@ -85,7 +85,7 @@ Signed-off-by: Paolo Abeni /** --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -6606,7 +6606,7 @@ static int __napi_poll(struct napi_struc +@@ -6610,7 +6610,7 @@ static int __napi_poll(struct napi_struc * accidentally calling ->poll() when NAPI is not scheduled. */ work = 0; diff --git a/target/linux/generic/backport-6.6/771-v6.7-02-net-stmmac-move-TX-timer-arm-after-DMA-enable.patch b/target/linux/generic/backport-6.6/771-v6.7-02-net-stmmac-move-TX-timer-arm-after-DMA-enable.patch index 60dfe4c0357aaa..66a9251438a265 100644 --- a/target/linux/generic/backport-6.6/771-v6.7-02-net-stmmac-move-TX-timer-arm-after-DMA-enable.patch +++ b/target/linux/generic/backport-6.6/771-v6.7-02-net-stmmac-move-TX-timer-arm-after-DMA-enable.patch @@ -42,7 +42,7 @@ Signed-off-by: Paolo Abeni u64_stats_update_begin(&txq_stats->napi_syncp); u64_stats_add(&txq_stats->napi.tx_packets, tx_packets); -@@ -5590,6 +5594,7 @@ static int stmmac_napi_poll_tx(struct na +@@ -5602,6 +5606,7 @@ static int stmmac_napi_poll_tx(struct na container_of(napi, struct stmmac_channel, tx_napi); struct stmmac_priv *priv = ch->priv_data; struct stmmac_txq_stats *txq_stats; @@ -50,7 +50,7 @@ Signed-off-by: Paolo Abeni u32 chan = ch->index; int work_done; -@@ -5598,7 +5603,7 @@ static int stmmac_napi_poll_tx(struct na +@@ -5610,7 +5615,7 @@ static int stmmac_napi_poll_tx(struct na u64_stats_inc(&txq_stats->napi.poll); u64_stats_update_end(&txq_stats->napi_syncp); @@ -59,7 +59,7 @@ Signed-off-by: Paolo Abeni work_done = min(work_done, budget); if (work_done < budget && napi_complete_done(napi, work_done)) { -@@ -5609,6 +5614,10 @@ static int stmmac_napi_poll_tx(struct na +@@ -5621,6 +5626,10 @@ static int stmmac_napi_poll_tx(struct na spin_unlock_irqrestore(&ch->lock, flags); } @@ -70,7 +70,7 @@ Signed-off-by: Paolo Abeni return work_done; } -@@ -5617,6 +5626,7 @@ static int stmmac_napi_poll_rxtx(struct +@@ -5629,6 +5638,7 @@ static int stmmac_napi_poll_rxtx(struct struct stmmac_channel *ch = container_of(napi, struct stmmac_channel, rxtx_napi); struct stmmac_priv *priv = ch->priv_data; @@ -78,7 +78,7 @@ Signed-off-by: Paolo Abeni int rx_done, tx_done, rxtx_done; struct stmmac_rxq_stats *rxq_stats; struct stmmac_txq_stats *txq_stats; -@@ -5632,7 +5642,7 @@ static int stmmac_napi_poll_rxtx(struct +@@ -5644,7 +5654,7 @@ static int stmmac_napi_poll_rxtx(struct u64_stats_inc(&txq_stats->napi.poll); u64_stats_update_end(&txq_stats->napi_syncp); @@ -87,7 +87,7 @@ Signed-off-by: Paolo Abeni tx_done = min(tx_done, budget); rx_done = stmmac_rx_zc(priv, budget, chan); -@@ -5657,6 +5667,10 @@ static int stmmac_napi_poll_rxtx(struct +@@ -5669,6 +5679,10 @@ static int stmmac_napi_poll_rxtx(struct spin_unlock_irqrestore(&ch->lock, flags); } diff --git a/target/linux/generic/backport-6.6/900-v6.11-net-free_netdev-exit-earlier-if-dummy.patch b/target/linux/generic/backport-6.6/900-v6.11-net-free_netdev-exit-earlier-if-dummy.patch index 9e38d88e22bf36..21db87419ee970 100644 --- a/target/linux/generic/backport-6.6/900-v6.11-net-free_netdev-exit-earlier-if-dummy.patch +++ b/target/linux/generic/backport-6.6/900-v6.11-net-free_netdev-exit-earlier-if-dummy.patch @@ -23,7 +23,7 @@ Signed-off-by: David S. Miller --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -10979,7 +10979,8 @@ void free_netdev(struct net_device *dev) +@@ -10983,7 +10983,8 @@ void free_netdev(struct net_device *dev) dev->xdp_bulkq = NULL; /* Compatibility with error handling in drivers */ diff --git a/target/linux/generic/hack-6.6/930-Revert-Revert-Revert-driver-core-Set-fw_devlink-on-b.patch b/target/linux/generic/hack-6.6/930-Revert-Revert-Revert-driver-core-Set-fw_devlink-on-b.patch index 85a19027fda7f6..1c5fb11ff540cd 100644 --- a/target/linux/generic/hack-6.6/930-Revert-Revert-Revert-driver-core-Set-fw_devlink-on-b.patch +++ b/target/linux/generic/hack-6.6/930-Revert-Revert-Revert-driver-core-Set-fw_devlink-on-b.patch @@ -19,7 +19,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/base/core.c +++ b/drivers/base/core.c -@@ -1658,7 +1658,7 @@ static void device_links_purge(struct de +@@ -1657,7 +1657,7 @@ static void device_links_purge(struct de #define FW_DEVLINK_FLAGS_RPM (FW_DEVLINK_FLAGS_ON | \ DL_FLAG_PM_RUNTIME) diff --git a/target/linux/qualcommax/patches-6.6/0061-v6.8-phy-qcom-qmp-usb-fix-serdes-init-sequence-for-IPQ6018.patch b/target/linux/qualcommax/patches-6.6/0061-v6.8-phy-qcom-qmp-usb-fix-serdes-init-sequence-for-IPQ6018.patch index 4082e3d8526b9d..9021b572e8e04d 100644 --- a/target/linux/qualcommax/patches-6.6/0061-v6.8-phy-qcom-qmp-usb-fix-serdes-init-sequence-for-IPQ6018.patch +++ b/target/linux/qualcommax/patches-6.6/0061-v6.8-phy-qcom-qmp-usb-fix-serdes-init-sequence-for-IPQ6018.patch @@ -47,7 +47,7 @@ Signed-off-by: Vinod Koul static const struct qmp_phy_cfg ipq8074_usb3phy_cfg = { .lanes = 1, -@@ -2238,7 +2258,7 @@ err_node_put: +@@ -2239,7 +2259,7 @@ err_node_put: static const struct of_device_id qmp_usb_of_match_table[] = { { .compatible = "qcom,ipq6018-qmp-usb3-phy", diff --git a/target/linux/starfive/patches-6.6/1009-net-stmmac-use-GFP_DMA32.patch b/target/linux/starfive/patches-6.6/1009-net-stmmac-use-GFP_DMA32.patch index ad8b92f7158083..25849e7c26d984 100644 --- a/target/linux/starfive/patches-6.6/1009-net-stmmac-use-GFP_DMA32.patch +++ b/target/linux/starfive/patches-6.6/1009-net-stmmac-use-GFP_DMA32.patch @@ -19,7 +19,7 @@ Signed-off-by: Matteo Croce if (priv->dma_cap.host_dma_width <= 32) gfp |= GFP_DMA32; -@@ -4673,7 +4673,7 @@ static inline void stmmac_rx_refill(stru +@@ -4685,7 +4685,7 @@ static inline void stmmac_rx_refill(stru struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[queue]; int dirty = stmmac_rx_dirty(priv, queue); unsigned int entry = rx_q->dirty_rx; From d83ae23d08c8e8bd3c5028f8756d9b234d5bb820 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Tue, 12 Nov 2024 13:55:30 +0100 Subject: [PATCH 032/877] airoha: an7581: backport upstream ethernet fixes Backport patches fixing some ethernet problem merged upstream. Signed-off-by: Christian Marangi --- ...completion-queue-data-in-airoha_qdma.patch | 92 +++++++++++++ ...13-net-airoha-Simplify-Tx-napi-logic.patch | 130 ++++++++++++++++++ 2 files changed, 222 insertions(+) create mode 100644 target/linux/airoha/patches-6.6/031-01-v6.13-net-airoha-Read-completion-queue-data-in-airoha_qdma.patch create mode 100644 target/linux/airoha/patches-6.6/031-02-v6.13-net-airoha-Simplify-Tx-napi-logic.patch diff --git a/target/linux/airoha/patches-6.6/031-01-v6.13-net-airoha-Read-completion-queue-data-in-airoha_qdma.patch b/target/linux/airoha/patches-6.6/031-01-v6.13-net-airoha-Read-completion-queue-data-in-airoha_qdma.patch new file mode 100644 index 00000000000000..306ce6588396bf --- /dev/null +++ b/target/linux/airoha/patches-6.6/031-01-v6.13-net-airoha-Read-completion-queue-data-in-airoha_qdma.patch @@ -0,0 +1,92 @@ +From 3affa310de523d63e52ea8e2efb3c476df29e414 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Tue, 29 Oct 2024 13:17:09 +0100 +Subject: [PATCH 1/2] net: airoha: Read completion queue data in + airoha_qdma_tx_napi_poll() + +In order to avoid any possible race, read completion queue head and +pending entry in airoha_qdma_tx_napi_poll routine instead of doing it in +airoha_irq_handler. Remove unused airoha_tx_irq_queue unused fields. +This is a preliminary patch to add Qdisc offload for airoha_eth driver. + +Signed-off-by: Lorenzo Bianconi +Link: https://patch.msgid.link/20241029-airoha-en7581-tx-napi-work-v1-1-96ad1686b946@kernel.org +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/mediatek/airoha_eth.c | 31 +++++++++------------- + 1 file changed, 13 insertions(+), 18 deletions(-) + +--- a/drivers/net/ethernet/mediatek/airoha_eth.c ++++ b/drivers/net/ethernet/mediatek/airoha_eth.c +@@ -752,11 +752,9 @@ struct airoha_tx_irq_queue { + struct airoha_qdma *qdma; + + struct napi_struct napi; +- u32 *q; + + int size; +- int queued; +- u16 head; ++ u32 *q; + }; + + struct airoha_hw_stats { +@@ -1656,25 +1654,31 @@ static int airoha_qdma_init_rx(struct ai + static int airoha_qdma_tx_napi_poll(struct napi_struct *napi, int budget) + { + struct airoha_tx_irq_queue *irq_q; ++ int id, done = 0, irq_queued; + struct airoha_qdma *qdma; + struct airoha_eth *eth; +- int id, done = 0; ++ u32 status, head; + + irq_q = container_of(napi, struct airoha_tx_irq_queue, napi); + qdma = irq_q->qdma; + id = irq_q - &qdma->q_tx_irq[0]; + eth = qdma->eth; + +- while (irq_q->queued > 0 && done < budget) { +- u32 qid, last, val = irq_q->q[irq_q->head]; ++ status = airoha_qdma_rr(qdma, REG_IRQ_STATUS(id)); ++ head = FIELD_GET(IRQ_HEAD_IDX_MASK, status); ++ head = head % irq_q->size; ++ irq_queued = FIELD_GET(IRQ_ENTRY_LEN_MASK, status); ++ ++ while (irq_queued > 0 && done < budget) { ++ u32 qid, last, val = irq_q->q[head]; + struct airoha_queue *q; + + if (val == 0xff) + break; + +- irq_q->q[irq_q->head] = 0xff; /* mark as done */ +- irq_q->head = (irq_q->head + 1) % irq_q->size; +- irq_q->queued--; ++ irq_q->q[head] = 0xff; /* mark as done */ ++ head = (head + 1) % irq_q->size; ++ irq_queued--; + done++; + + last = FIELD_GET(IRQ_DESC_IDX_MASK, val); +@@ -2026,20 +2030,11 @@ static irqreturn_t airoha_irq_handler(in + + if (intr[0] & INT_TX_MASK) { + for (i = 0; i < ARRAY_SIZE(qdma->q_tx_irq); i++) { +- struct airoha_tx_irq_queue *irq_q = &qdma->q_tx_irq[i]; +- u32 status, head; +- + if (!(intr[0] & TX_DONE_INT_MASK(i))) + continue; + + airoha_qdma_irq_disable(qdma, QDMA_INT_REG_IDX0, + TX_DONE_INT_MASK(i)); +- +- status = airoha_qdma_rr(qdma, REG_IRQ_STATUS(i)); +- head = FIELD_GET(IRQ_HEAD_IDX_MASK, status); +- irq_q->head = head % irq_q->size; +- irq_q->queued = FIELD_GET(IRQ_ENTRY_LEN_MASK, status); +- + napi_schedule(&qdma->q_tx_irq[i].napi); + } + } diff --git a/target/linux/airoha/patches-6.6/031-02-v6.13-net-airoha-Simplify-Tx-napi-logic.patch b/target/linux/airoha/patches-6.6/031-02-v6.13-net-airoha-Simplify-Tx-napi-logic.patch new file mode 100644 index 00000000000000..b35f828f118d9e --- /dev/null +++ b/target/linux/airoha/patches-6.6/031-02-v6.13-net-airoha-Simplify-Tx-napi-logic.patch @@ -0,0 +1,130 @@ +From 0c729f53b8c33b9e5eadc2d5e673759e3510501e Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Tue, 29 Oct 2024 13:17:10 +0100 +Subject: [PATCH 2/2] net: airoha: Simplify Tx napi logic + +Simplify Tx napi logic relying just on the packet index provided by +completion queue indicating the completed packet that can be removed +from the Tx DMA ring. +This is a preliminary patch to add Qdisc offload for airoha_eth driver. + +Signed-off-by: Lorenzo Bianconi +Link: https://patch.msgid.link/20241029-airoha-en7581-tx-napi-work-v1-2-96ad1686b946@kernel.org +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/mediatek/airoha_eth.c | 73 ++++++++++++---------- + 1 file changed, 41 insertions(+), 32 deletions(-) + +--- a/drivers/net/ethernet/mediatek/airoha_eth.c ++++ b/drivers/net/ethernet/mediatek/airoha_eth.c +@@ -1670,8 +1670,12 @@ static int airoha_qdma_tx_napi_poll(stru + irq_queued = FIELD_GET(IRQ_ENTRY_LEN_MASK, status); + + while (irq_queued > 0 && done < budget) { +- u32 qid, last, val = irq_q->q[head]; ++ u32 qid, val = irq_q->q[head]; ++ struct airoha_qdma_desc *desc; ++ struct airoha_queue_entry *e; + struct airoha_queue *q; ++ u32 index, desc_ctrl; ++ struct sk_buff *skb; + + if (val == 0xff) + break; +@@ -1681,9 +1685,7 @@ static int airoha_qdma_tx_napi_poll(stru + irq_queued--; + done++; + +- last = FIELD_GET(IRQ_DESC_IDX_MASK, val); + qid = FIELD_GET(IRQ_RING_IDX_MASK, val); +- + if (qid >= ARRAY_SIZE(qdma->q_tx)) + continue; + +@@ -1691,46 +1693,53 @@ static int airoha_qdma_tx_napi_poll(stru + if (!q->ndesc) + continue; + ++ index = FIELD_GET(IRQ_DESC_IDX_MASK, val); ++ if (index >= q->ndesc) ++ continue; ++ + spin_lock_bh(&q->lock); + +- while (q->queued > 0) { +- struct airoha_qdma_desc *desc = &q->desc[q->tail]; +- struct airoha_queue_entry *e = &q->entry[q->tail]; +- u32 desc_ctrl = le32_to_cpu(desc->ctrl); +- struct sk_buff *skb = e->skb; +- u16 index = q->tail; +- +- if (!(desc_ctrl & QDMA_DESC_DONE_MASK) && +- !(desc_ctrl & QDMA_DESC_DROP_MASK)) +- break; ++ if (!q->queued) ++ goto unlock; + +- q->tail = (q->tail + 1) % q->ndesc; +- q->queued--; ++ desc = &q->desc[index]; ++ desc_ctrl = le32_to_cpu(desc->ctrl); + +- dma_unmap_single(eth->dev, e->dma_addr, e->dma_len, +- DMA_TO_DEVICE); +- +- WRITE_ONCE(desc->msg0, 0); +- WRITE_ONCE(desc->msg1, 0); ++ if (!(desc_ctrl & QDMA_DESC_DONE_MASK) && ++ !(desc_ctrl & QDMA_DESC_DROP_MASK)) ++ goto unlock; ++ ++ e = &q->entry[index]; ++ skb = e->skb; ++ ++ dma_unmap_single(eth->dev, e->dma_addr, e->dma_len, ++ DMA_TO_DEVICE); ++ memset(e, 0, sizeof(*e)); ++ WRITE_ONCE(desc->msg0, 0); ++ WRITE_ONCE(desc->msg1, 0); ++ q->queued--; ++ ++ /* completion ring can report out-of-order indexes if hw QoS ++ * is enabled and packets with different priority are queued ++ * to same DMA ring. Take into account possible out-of-order ++ * reports incrementing DMA ring tail pointer ++ */ ++ while (q->tail != q->head && !q->entry[q->tail].dma_addr) ++ q->tail = (q->tail + 1) % q->ndesc; + +- if (skb) { +- u16 queue = skb_get_queue_mapping(skb); +- struct netdev_queue *txq; +- +- txq = netdev_get_tx_queue(skb->dev, queue); +- netdev_tx_completed_queue(txq, 1, skb->len); +- if (netif_tx_queue_stopped(txq) && +- q->ndesc - q->queued >= q->free_thr) +- netif_tx_wake_queue(txq); +- +- dev_kfree_skb_any(skb); +- e->skb = NULL; +- } ++ if (skb) { ++ u16 queue = skb_get_queue_mapping(skb); ++ struct netdev_queue *txq; ++ ++ txq = netdev_get_tx_queue(skb->dev, queue); ++ netdev_tx_completed_queue(txq, 1, skb->len); ++ if (netif_tx_queue_stopped(txq) && ++ q->ndesc - q->queued >= q->free_thr) ++ netif_tx_wake_queue(txq); + +- if (index == last) +- break; ++ dev_kfree_skb_any(skb); + } +- ++unlock: + spin_unlock_bh(&q->lock); + } + From e39f5d4b360ca3e163550592cea35949f0ea8622 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Tue, 12 Nov 2024 07:49:22 +0100 Subject: [PATCH 033/877] base-files: improve default root-passwd script The script was not exiting cleanly causing it to not be removed from the uci-defaults folder. Signed-off-by: John Crispin --- .../files/etc/uci-defaults/50-root-passwd | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/package/base-files/files/etc/uci-defaults/50-root-passwd b/package/base-files/files/etc/uci-defaults/50-root-passwd index 9eddf1559baf33..f0bb519aece4f4 100644 --- a/package/base-files/files/etc/uci-defaults/50-root-passwd +++ b/package/base-files/files/etc/uci-defaults/50-root-passwd @@ -3,10 +3,16 @@ json_init json_load "$(cat /etc/board.json)" -json_select credentials - json_get_vars root_password_hash root_password_hash - [ -z "$root_password_hash" ] || sed -i "s|^root:[^:]*|root:$root_password_hash|g" /etc/shadow +if json_is_a credentials object; then + json_select credentials + json_get_vars root_password_hash root_password_hash + if [ -n "$root_password_hash" ]; then + sed -i "s|^root:[^:]*|root:$root_password_hash|g" /etc/shadow + fi - json_get_vars root_password_plain root_password_plain - [ -z "$root_password_plain" ] || { (echo "$root_password_plain"; sleep 1; echo "$root_password_plain") | passwd root } -json_select .. + json_get_vars root_password_plain root_password_plain + if [ -n "$root_password_plain" ]; then + (echo "$root_password_plain"; sleep 1; echo "$root_password_plain") | passwd root + fi + json_select .. +fi From 1fdc4b144b095fa881746a74d4a8488b317f199b Mon Sep 17 00:00:00 2001 From: Rodrigo Balerdi Date: Wed, 13 Nov 2024 17:23:52 -0300 Subject: [PATCH 034/877] ipq806x: tr4400v2: revert nesting of MTD partitions that bricks device This reverts commit e1043a746a1030062e73ea027d9a35c58bce6c6a, that attempts to nest partitions that overlap but are not nested. This causes the 'ubi' partition to be truncated, making rootfs inaccessible and bricking the device. Also, had this commit worked, it would have renumbered MTD partitions in a way that would have broken documented scripts for installation and update of main and recovery OSes, making backups, return to stock, etc, and broken user configurations that put the 'extra' partition to use. Signed-off-by: Rodrigo Balerdi Link: https://github.com/openwrt/openwrt/pull/16944 Signed-off-by: Robert Marko (cherry picked from commit 0e59eaa7962fc21635af5c9d2f6552a4accdc7ea) --- .../boot/dts/qcom/qcom-ipq8065-tr4400-v2.dts | 80 ++++++++----------- 1 file changed, 35 insertions(+), 45 deletions(-) diff --git a/target/linux/ipq806x/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq8065-tr4400-v2.dts b/target/linux/ipq806x/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq8065-tr4400-v2.dts index 8818e95e8d1b3b..8410721b72c0e8 100644 --- a/target/linux/ipq806x/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq8065-tr4400-v2.dts +++ b/target/linux/ipq806x/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq8065-tr4400-v2.dts @@ -207,15 +207,6 @@ stock_partition@1340000 { label = "stock_rootfs"; reg = <0x1340000 0x4000000>; - - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "extra"; - reg = <0x0 0x4000000>; - }; }; partition@5340000 { label = "0:BOOTCONFIG"; @@ -265,42 +256,6 @@ stock_partition@6400000 { label = "stock_rootfs_1"; reg = <0x6400000 0x4000000>; - - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "fw_env"; - reg = <0x0 0x100000>; - - nvmem-layout { - compatible = "fixed-layout"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_fw_env_0: macaddr@0 { - reg = <0x00 0x6>; - }; - macaddr_fw_env_6: macaddr@6 { - reg = <0x06 0x6>; - }; - macaddr_fw_env_c: macaddr@c { - reg = <0x0c 0x6>; - }; - macaddr_fw_env_12: macaddr@12 { - reg = <0x12 0x6>; - }; - macaddr_fw_env_18: macaddr@18 { - reg = <0x18 0x6>; - }; - }; - }; - - partition@100000 { - label = "ubi"; - reg = <0x100000 0x9b00000>; - }; }; stock_partition@a400000 { label = "stock_fw_env"; @@ -318,6 +273,41 @@ label = "stock_scfgmgr"; reg = <0xaf00000 0x0100000>; }; + + partition@6400000 { + label = "fw_env"; + reg = <0x6400000 0x0100000>; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_fw_env_0: macaddr@0 { + reg = <0x00 0x6>; + }; + macaddr_fw_env_6: macaddr@6 { + reg = <0x06 0x6>; + }; + macaddr_fw_env_c: macaddr@c { + reg = <0x0c 0x6>; + }; + macaddr_fw_env_12: macaddr@12 { + reg = <0x12 0x6>; + }; + macaddr_fw_env_18: macaddr@18 { + reg = <0x18 0x6>; + }; + }; + }; + partition@6500000 { + label = "ubi"; + reg = <0x6500000 0x9b00000>; + }; + partition@1340000 { + label = "extra"; + reg = <0x1340000 0x4000000>; + }; }; }; }; From c02af3fd857e567a1dfae8d029eed461442b0dce Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 8 Nov 2024 09:13:54 +0100 Subject: [PATCH 035/877] wifi-scripts: add free-form "tags" array option for wifi-iface This allows annotating wifi interfaces in the config in a way that can be queried through wifi status. One example use case is to mark wifi interfaces for use with specific services without having to explicitly reference the (often unnamed) sections from elsewhere. Signed-off-by: Felix Fietkau (cherry picked from commit a3ec35cadb77265c0e00c8d3789734586a6f7111) --- .../config/wifi-scripts/files/lib/netifd/netifd-wireless.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/package/network/config/wifi-scripts/files/lib/netifd/netifd-wireless.sh b/package/network/config/wifi-scripts/files/lib/netifd/netifd-wireless.sh index 5b852e0937631a..c3772bb44312d4 100644 --- a/package/network/config/wifi-scripts/files/lib/netifd/netifd-wireless.sh +++ b/package/network/config/wifi-scripts/files/lib/netifd/netifd-wireless.sh @@ -379,6 +379,7 @@ _wdev_common_device_config() { _wdev_common_iface_config() { config_add_string mode ssid encryption 'key:wpakey' config_add_boolean bridge_isolate + config_add_array tags } _wdev_common_vlan_config() { From 13f166763f0cdc522e235433c7d15fb386ebc194 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 8 Nov 2024 10:50:39 +0100 Subject: [PATCH 036/877] netifd: update to Git HEAD (2024-11-08) e93f6c3fc729 main: fix format string related warnings for log/debug printf functions 6ab44a2413f9 fix signed/unsigned comparison warnings 4fe997b61d7d system-dummy: add system_if_apply_settings_after_up 992d33cb42a6 ubus: add notifications on wireless device state changes 34eb11eb6f5c device/interface: add "tags" attribute from config to status dump Signed-off-by: Felix Fietkau (cherry picked from commit 5f68e243338a653f44f079acc001de369aa42efa) --- 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 771d7dadafd119..a4400c9516eca6 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:=2024-10-06 -PKG_SOURCE_VERSION:=3c6265fdbd02ebd35fa3e7a58d6dfeed081a09d7 -PKG_MIRROR_HASH:=00b01243b99995dc52a047e5663cf5c7732f8defd6b726f73ac15e142b02b4fa +PKG_SOURCE_DATE:=2024-11-08 +PKG_SOURCE_VERSION:=34eb11eb6f5c62de480d6192f0ca840093127fee +PKG_MIRROR_HASH:=c4c2bc626426d2cd73c9ece54b22ada6ed6254afa992f51b8725312aca240cfd PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 From fe048b5e875dd09e54d4b2c43f4e6c98c6d1ffae Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 14 Nov 2024 13:03:23 +0100 Subject: [PATCH 037/877] mt76: update to Git HEAD (2024-10-28) 8dfead68c202 wifi: mt76: mt7915: hold dev->mutex while interacting with the thermal state d508a6eb935d wifi: mt76: mt7996: use mac80211 .sta_state op 57019e663f57 wifi: mt76: add code for emulating hardware scanning dc4c2bdf7c56 wifi: mt76: add support for allocating a phy without hw 8cd0263f92e1 wifi: mt76: rename struct mt76_vif to mt76_vif_link 99df84d62883 wifi: mt76: add vif link specific data structure dcc6f158d759 wifi: mt76: mt7996: split link specific data from struct mt7996_vif d388deab9e73 wifi: mt76: initialize more wcid fields mt76_wcid_init d026be405c54 wifi: mt76: add chanctx functions for multi-channel phy support 0b05795ca81c wifi: mt76: remove dev->wcid_phy_mask 0b526090de95 wifi: mt76: add multi-radio support to a few core hw ops aeedee5c0a2c wifi: mt76: add multi-radio support to tx scheduling fc0ff17b53ff wifi: mt76: add multi-radio support to scanning code f19cbcf83400 wifi: mt76: add multi-radio remain_on_channel functions 42429ae0eaf6 wifi: mt76: mt7996: use emulated hardware scan support f9d593d4a6b4 wifi: mt76: mt7996: pass wcid to mt7996_mcu_sta_hdr_trans_tlv 807090b28661 wifi: mt76: mt7996: prepare mt7996_mcu_add_dev/bss_info for MLO support 252baa7bf477 wifi: mt76: mt7996: prepare mt7996_mcu_add_beacon for MLO support 9ee990050305 wifi: mt76: mt7996: prepare mt7996_mcu_set_tx for MLO support bf12cc404334 wifi: mt76: mt7996: prepare mt7996_mcu_set_timing for MLO support 60bf2bef95dc wifi: mt76: connac: prepare mt76_connac_mcu_sta_basic_tlv for MLO support 1289737e12a8 wifi: mt76: mt7996: prepare mt7996_mcu_update_bss_color for MLO support 7c00df0e7e57 wifi: mt76: connac: rework connac helpers 484e3f289a40 wifi: mt76: mt7996: move all debugfs files to the primary phy d258f4e3e1ca wifi: mt76: mt7996: switch to single multi-radio wiphy c246fa545119 wifi: mt76: mt7996: fix monitor mode Signed-off-by: Felix Fietkau (cherry picked from commit 6720c4ccba256186bf2f1b1edadb851c447e62a5) --- 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 73f34d8edadf18..b5cdc765729975 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:=2024-10-11.1 -PKG_SOURCE_VERSION:=ecca0e77b4bce629ec1f79d83bbd14a68f919188 -PKG_MIRROR_HASH:=770823f282c76532567a651bb020208c3ddd5a728c656fcde43129fc95edf538 +PKG_SOURCE_DATE:=2024-10-28 +PKG_SOURCE_VERSION:=c246fa545119abe5097682316700f13c91399042 +PKG_MIRROR_HASH:=ff59d9588e6b114be8fe08013b55da975bc6bb4219b97b6fedb72246e9337c18 PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 From 740052e84e4b669dc750d15e0bc75d67fcfc46df Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Thu, 7 Nov 2024 22:49:21 +0100 Subject: [PATCH 038/877] base-files: Remove pkg_check when using apk /sbin/pkg_check uses opkg and is not even packaged when using the default opkg configuration. remove it when using apk too. Signed-off-by: Hauke Mehrtens (cherry picked from commit 0ce237a20cc5168c62afcacb3b47d77a952d64c1) --- package/base-files/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/package/base-files/Makefile b/package/base-files/Makefile index 4da50a27362dce..4bcb4882d733c4 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -251,6 +251,7 @@ ifneq ($(CONFIG_USE_APK),) $(VERSION_SED_SCRIPT) $(1)/etc/apk/repositories rm -f $(1)/etc/uci-defaults/13_fix-group-user + rm -f $(1)/sbin/pkg_check else $(if $(CONFIG_CLEAN_IPKG),, \ mkdir -p $(1)/etc/opkg; \ From 3e094777e7a660840648f68d1d10c532cbe6ab05 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Thu, 24 Oct 2024 00:06:09 +0200 Subject: [PATCH 039/877] libnftnl: update to 1.2.8 Release Announcement: https://www.spinics.net/lists/netfilter-devel/msg87287.html https://www.spinics.net/lists/netfilter-devel/msg88520.html Link: https://github.com/openwrt/openwrt/pull/16769 Signed-off-by: Hauke Mehrtens (cherry picked from commit d9ed0d438b0ec7d813764d629be7a753dc3fbac5) --- package/libs/libnftnl/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/libs/libnftnl/Makefile b/package/libs/libnftnl/Makefile index b512d4d58fe616..f06b223993c2be 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.6 +PKG_VERSION:=1.2.8 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://netfilter.org/projects/$(PKG_NAME)/files -PKG_HASH:=ceeaea2cd92147da19f13a35a7f1a4bc2767ff897e838e4b479cf54b59c777f4 +PKG_HASH:=37fea5d6b5c9b08de7920d298de3cdc942e7ae64b1a3e8b880b2d390ae67ad95 PKG_MAINTAINER:=Steven Barth PKG_LICENSE:=GPL-2.0-or-later From faebcc61eb331f5898504933a49c18a5de02b8b1 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Thu, 24 Oct 2024 00:09:22 +0200 Subject: [PATCH 040/877] nftables: update to 1.1.1 Release Announcement: https://lwn.net/Articles/982283/ https://lwn.net/Articles/992760/ Link: https://github.com/openwrt/openwrt/pull/16769 Signed-off-by: Hauke Mehrtens (cherry picked from commit c11a18be0dc38c81280baa948500fe1a57de0685) --- 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 38a8199d11dc09..06b3fcfcdad7ad 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.9 +PKG_VERSION:=1.1.1 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://netfilter.org/projects/$(PKG_NAME)/files -PKG_HASH:=a3c304cd9ba061239ee0474f9afb938a9bb99d89b960246f66f0c3a0a85e14cd +PKG_HASH:=6358830f3a64f31e39b0ad421d7dadcd240b72343ded48d8ef13b8faf204865a PKG_MAINTAINER:= PKG_LICENSE:=GPL-2.0 From 2d465fbf570e1f3286210305a26580cd417fec7c Mon Sep 17 00:00:00 2001 From: David Lutz Date: Tue, 5 Nov 2024 10:55:43 +0100 Subject: [PATCH 041/877] ath79: Add support for Sophos AP15C The Sophos AP15C uses the same hardware as the AP15, but has a reset button. Based on: commit 6f1efb289837 ("ath79: add support for Sophos AP100/AP55 family") author Andrew Powers-Holmes Fri, 3 Sep 2021 15:53:57 +0200 (23:53 +1000) committer Hauke Mehrtens Sat, 16 Apr 2022 16:59:29 +0200 (16:59 +0200) Unique to AP15C: - Reset button - External RJ45 serial console port Flashing instructions: This firmware can be flashed either via a compatible Sophos SG or XG firewall appliance, which does not require disassembling the device, or via the U-Boot console available on the internal UART header. To flash via XG appliance: - Register on Sophos' website for a no-cost Home Use XG firewall license - Download and install the XG software on a compatible PC or virtual machine, complete initial appliance setup, and enable SSH console access - Connect the target AP device to the XG appliance's LAN interface - Approve the AP from the XG Web UI and wait until it shows as Active (this can take 3-5 minutes) - Connect to the XG appliance over SSH and access the Advanced Console (Menu option 5, then menu option 3) - Run `sudo awetool` and select the menu option to connect to an AP via SSH. When prompted to enable SSH on the target AP, select Yes. - Wait 2-3 minutes, then select the AP from the awetool menu again. This will connect you to a root shell on the target AP. - Copy the firmware to /tmp/openwrt.bin on the target AP via SCP/TFTP/etc - Run `mtd -r write /tmp/openwrt.bin astaro_image` - When complete, the access point will reboot to OpenWRT. To flash via U-Boot serial console: - Configure a TFTP server on your PC, and set IP address 192.168.99.8 with netmask 255.255.255.0 - Copy the firmware .bin to the TFTP server and rename to 'uImage_AP15C' - Open the target AP's enclosure and locate the 4-pin 3.3V UART header [4] - Connect the AP ethernet to your PC's ethernet port - Connect a terminal to the UART at 115200 8/N/1 as usual - Power on the AP and press a key to cancel autoboot when prompted - Run the following commands at the U-Boot console: - `tftpboot` - `cp.b $fileaddr 0x9f070000 $filesize` - `boot` - The access point will boot to OpenWRT. Signed-off-by: David Lutz (cherry picked from commit a7abc7ec3b61be553f33c49e5acc90a4d539d992) --- package/boot/uboot-envtools/files/ath79 | 1 + .../linux/ath79/dts/qca9557_sophos_ap15c.dts | 159 ++++++++++++++++++ .../generic/base-files/etc/board.d/02_network | 1 + target/linux/ath79/image/generic.mk | 8 + 4 files changed, 169 insertions(+) create mode 100644 target/linux/ath79/dts/qca9557_sophos_ap15c.dts diff --git a/package/boot/uboot-envtools/files/ath79 b/package/boot/uboot-envtools/files/ath79 index 1d9d3bcfaa1fc5..c6d23ce73dcee1 100644 --- a/package/boot/uboot-envtools/files/ath79 +++ b/package/boot/uboot-envtools/files/ath79 @@ -163,6 +163,7 @@ ruckus,zf7372) ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x40000" "0x10000" ;; sophos,ap15|\ +sophos,ap15c|\ sophos,ap55|\ sophos,ap55c|\ sophos,ap100|\ diff --git a/target/linux/ath79/dts/qca9557_sophos_ap15c.dts b/target/linux/ath79/dts/qca9557_sophos_ap15c.dts new file mode 100644 index 00000000000000..68d02e97a54a14 --- /dev/null +++ b/target/linux/ath79/dts/qca9557_sophos_ap15c.dts @@ -0,0 +1,159 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca955x.dtsi" + +#include +#include +#include + +/ { + compatible = "sophos,ap15c", "qca,qca9557"; + model = "Sophos AP15C"; + + aliases { + led-boot = &led_status_green; + led-failsafe = &led_status_yellow; + led-running = &led_status_green; + led-upgrade = &led_status_yellow; + label-mac-device = ð0; + }; + + chosen { + bootargs = "console=ttyS0,115200n8"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status_green: status_green { + function = LED_FUNCTION_STATUS; + color = ; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + + led_status_yellow: status_yellow { + function = LED_FUNCTION_STATUS; + color = ; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&spi { + 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@0 { + label = "u-boot"; + reg = <0x000000 0x040000>; + read-only; + }; + + partition@40000 { + label = "u-boot-env"; + reg = <0x040000 0x010000>; + }; + + partition@50000 { + label = "art"; + reg = <0x050000 0x010000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + cal_art_1000: calibration@1000 { + reg = <0x1000 0x440>; + }; + }; + }; + + partition@60000 { + label = "config"; + reg = <0x060000 0x010000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_config_201a: macaddr@201a { + reg = <0x201a 0x6>; + }; + }; + }; + + partition@70000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x070000 0xf90000>; + }; + }; + }; +}; + +&mdio0 { + status = "okay"; + + phy-mask = <0x10>; + + phy4: ethernet-phy@4 { + reg = <4>; + eee-broken-100tx; + eee-broken-1000t; + }; +}; + +ð0 { + status = "okay"; + + pll-data = <0xa6000000 0xa0000101 0xa0001313>; + + nvmem-cells = <&macaddr_config_201a>; + nvmem-cell-names = "mac-address"; + + phy-mode = "rgmii-id"; + phy-handle = <&phy4>; + + gmac_config: gmac-config { + device = <&gmac>; + + rgmii-enabled = <1>; + + rxdv-delay = <3>; + rxd-delay = <3>; + txen-delay = <3>; + txd-delay = <3>; + }; +}; + +&wmac { + status = "okay"; + + nvmem-cells = <&cal_art_1000>; + nvmem-cell-names = "calibration"; +}; 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 8474c1c4c2df00..8f79a3fad8114d 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 @@ -76,6 +76,7 @@ ath79_setup_interfaces() ruckus,zf7351|\ siemens,ws-ap3610|\ sophos,ap15|\ + sophos,ap15c|\ sophos,ap55|\ sophos,ap55c|\ sophos,ap100|\ diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index c075f050db2298..0173f5cb16180d 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -2972,6 +2972,14 @@ define Device/sophos_ap15 endef TARGET_DEVICES += sophos_ap15 +define Device/sophos_ap15c + SOC := qca9557 + DEVICE_VENDOR := Sophos + DEVICE_MODEL := AP15C + IMAGE_SIZE := 15936k +endef +TARGET_DEVICES += sophos_ap15c + define Device/sophos_ap55 SOC := qca9558 DEVICE_VENDOR := Sophos From 585eb0d6c8bf5ec2016f245c6f5c5b60a14ec074 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 18 Nov 2024 11:21:02 +0100 Subject: [PATCH 042/877] mac80211: backport some upstream fixes Fix various issues, including potential crashes Signed-off-by: Felix Fietkau (cherry picked from commit 53eab6198bf87d12055409bc4a38d58b68291b2f) --- ...x-vif-addr-when-switching-from-monit.patch | 63 ++++++++ ...x-incorrect-timing-to-initialize-sta.patch | 32 ++++ ...ee80211_i-Fix-memory-corruption-bug-.patch | 53 +++++++ ...ix-user-power-when-emulating-chanctx.patch | 24 +++ ...80211-Add-wiphy_delayed_work_pending.patch | 83 ++++++++++ ...nvert-color-collision-detection-to-w.patch | 148 ++++++++++++++++++ 6 files changed, 403 insertions(+) create mode 100644 package/kernel/mac80211/patches/subsys/361-wifi-mac80211-fix-vif-addr-when-switching-from-monit.patch create mode 100644 package/kernel/mac80211/patches/subsys/362-wifi-mac80211-fix-incorrect-timing-to-initialize-sta.patch create mode 100644 package/kernel/mac80211/patches/subsys/363-wifi-mac80211-ieee80211_i-Fix-memory-corruption-bug-.patch create mode 100644 package/kernel/mac80211/patches/subsys/364-mac80211-fix-user-power-when-emulating-chanctx.patch create mode 100644 package/kernel/mac80211/patches/subsys/365-wifi-cfg80211-Add-wiphy_delayed_work_pending.patch create mode 100644 package/kernel/mac80211/patches/subsys/366-wifi-mac80211-Convert-color-collision-detection-to-w.patch diff --git a/package/kernel/mac80211/patches/subsys/361-wifi-mac80211-fix-vif-addr-when-switching-from-monit.patch b/package/kernel/mac80211/patches/subsys/361-wifi-mac80211-fix-vif-addr-when-switching-from-monit.patch new file mode 100644 index 00000000000000..f4cfc95aa3b7a1 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/361-wifi-mac80211-fix-vif-addr-when-switching-from-monit.patch @@ -0,0 +1,63 @@ +From: Felix Fietkau +Date: Fri, 15 Nov 2024 12:28:43 +0100 +Subject: [PATCH] wifi: mac80211: fix vif addr when switching from monitor + to station + +Since adding support for opting out of virtual monitor support, a zero vif +addr was used to indicate passive vs active monitor to the driver. +This would break the vif->addr when changing the netdev mac address before +switching the interface from monitor to sta mode. +Fix the regression by adding a separate flag to indicate whether vif->addr +is valid. + +Reported-by: syzbot+9ea265d998de25ac6a46@syzkaller.appspotmail.com +Fixes: 9d40f7e32774 ("wifi: mac80211: add flag to opt out of virtual monitor support") +Signed-off-by: Felix Fietkau +--- + +--- a/include/net/mac80211.h ++++ b/include/net/mac80211.h +@@ -1972,6 +1972,8 @@ enum ieee80211_neg_ttlm_res { + * @neg_ttlm: negotiated TID to link mapping info. + * see &struct ieee80211_neg_ttlm. + * @addr: address of this interface ++ * @addr_valid: indicates if the address is actively used. Set to false for ++ * passive monitor interfaces, true in all other cases. + * @p2p: indicates whether this AP or STA interface is a p2p + * interface, i.e. a GO or p2p-sta respectively + * @netdev_features: tx netdev features supported by the hardware for this +@@ -2011,6 +2013,7 @@ struct ieee80211_vif { + u16 valid_links, active_links, dormant_links, suspended_links; + struct ieee80211_neg_ttlm neg_ttlm; + u8 addr[ETH_ALEN] __aligned(2); ++ bool addr_valid; + bool p2p; + + u8 cab_queue; +--- a/net/mac80211/iface.c ++++ b/net/mac80211/iface.c +@@ -279,13 +279,8 @@ static int _ieee80211_change_mac(struct + ret = eth_mac_addr(sdata->dev, sa); + + if (ret == 0) { +- if (check_dup) { +- memcpy(sdata->vif.addr, sa->sa_data, ETH_ALEN); +- ether_addr_copy(sdata->vif.bss_conf.addr, sdata->vif.addr); +- } else { +- memset(sdata->vif.addr, 0, ETH_ALEN); +- memset(sdata->vif.bss_conf.addr, 0, ETH_ALEN); +- } ++ memcpy(sdata->vif.addr, sa->sa_data, ETH_ALEN); ++ ether_addr_copy(sdata->vif.bss_conf.addr, sdata->vif.addr); + } + + /* Regardless of eth_mac_addr() return we still want to add the +@@ -1324,6 +1319,8 @@ int ieee80211_do_open(struct wireless_de + } + } + ++ sdata->vif.addr_valid = sdata->vif.type != NL80211_IFTYPE_MONITOR || ++ (sdata->u.mntr.flags & MONITOR_FLAG_ACTIVE); + switch (sdata->vif.type) { + case NL80211_IFTYPE_AP_VLAN: + /* no need to tell driver, but set carrier and chanctx */ diff --git a/package/kernel/mac80211/patches/subsys/362-wifi-mac80211-fix-incorrect-timing-to-initialize-sta.patch b/package/kernel/mac80211/patches/subsys/362-wifi-mac80211-fix-incorrect-timing-to-initialize-sta.patch new file mode 100644 index 00000000000000..94e51afd859529 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/362-wifi-mac80211-fix-incorrect-timing-to-initialize-sta.patch @@ -0,0 +1,32 @@ +From: Benjamin Lin +Date: Mon, 18 Nov 2024 16:07:22 +0800 +Subject: [PATCH] wifi: mac80211: fix incorrect timing to initialize + station NSS capability + +Station's spatial streaming capability should be initialized before +handling VHT OMN, because the handling requires the capability information. + +Fixes: a8bca3e9371d ("wifi: mac80211: track capability/opmode NSS separately") +Signed-off-by: Benjamin Lin +--- + +--- a/net/mac80211/cfg.c ++++ b/net/mac80211/cfg.c +@@ -1914,6 +1914,8 @@ static int sta_link_apply_parameters(str + params->eht_capa_len, + link_sta); + ++ ieee80211_sta_init_nss(link_sta); ++ + if (params->opmode_notif_used) { + /* returned value is only needed for rc update, but the + * rc isn't initialized here yet, so ignore it +@@ -1923,8 +1925,6 @@ static int sta_link_apply_parameters(str + sband->band); + } + +- ieee80211_sta_init_nss(link_sta); +- + return 0; + } + diff --git a/package/kernel/mac80211/patches/subsys/363-wifi-mac80211-ieee80211_i-Fix-memory-corruption-bug-.patch b/package/kernel/mac80211/patches/subsys/363-wifi-mac80211-ieee80211_i-Fix-memory-corruption-bug-.patch new file mode 100644 index 00000000000000..dcdb89cd4a6542 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/363-wifi-mac80211-ieee80211_i-Fix-memory-corruption-bug-.patch @@ -0,0 +1,53 @@ +From: "Gustavo A. R. Silva" +Date: Fri, 25 Oct 2024 16:05:50 -0600 +Subject: [PATCH] wifi: mac80211: ieee80211_i: Fix memory corruption bug in + struct ieee80211_chanctx + +Move the `struct ieee80211_chanctx_conf conf` to the end of +`struct ieee80211_chanctx` and fix a memory corruption bug +triggered e.g. in `hwsim_set_chanctx_magic()`: `radar_detected` +is being overwritten when `cp->magic = HWSIM_CHANCTX_MAGIC;` +See the function call sequence below: + +drv_add_chanctx(... struct ieee80211_chanctx *ctx) -> + local->ops->add_chanctx(&local->hw, &ctx->conf) -> + mac80211_hwsim_add_chanctx(... struct ieee80211_chanctx_conf *ctx) -> + hwsim_set_chanctx_magic(ctx) + +This also happens in a number of other drivers. + +Also, add a code comment to try to prevent people from introducing +new members after `struct ieee80211_chanctx_conf conf`. Notice that +`struct ieee80211_chanctx_conf` is a flexible structure --a structure +that contains a flexible-array member, so it should always be at +the end of any other containing structures. + +This change also fixes 50 of the following warnings: + +net/mac80211/ieee80211_i.h:895:39: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] + +-Wflex-array-member-not-at-end was introduced in GCC-14, and we are +getting ready to enable it, globally. + +Fixes: bca8bc0399ac ("wifi: mac80211: handle ieee80211_radar_detected() for MLO") +Signed-off-by: Gustavo A. R. Silva +Link: https://patch.msgid.link/ZxwWPrncTeSi1UTq@kspp +[also refer to other drivers in commit message] +Signed-off-by: Johannes Berg +--- + +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -894,9 +894,10 @@ struct ieee80211_chanctx { + /* temporary data for search algorithm etc. */ + struct ieee80211_chan_req req; + +- struct ieee80211_chanctx_conf conf; +- + bool radar_detected; ++ ++ /* MUST be last - ends in a flexible-array member. */ ++ struct ieee80211_chanctx_conf conf; + }; + + struct mac80211_qos_map { diff --git a/package/kernel/mac80211/patches/subsys/364-mac80211-fix-user-power-when-emulating-chanctx.patch b/package/kernel/mac80211/patches/subsys/364-mac80211-fix-user-power-when-emulating-chanctx.patch new file mode 100644 index 00000000000000..15db2c54e4d4e2 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/364-mac80211-fix-user-power-when-emulating-chanctx.patch @@ -0,0 +1,24 @@ +From: Ben Greear +Date: Thu, 10 Oct 2024 13:39:54 -0700 +Subject: [PATCH] mac80211: fix user-power when emulating chanctx + +ieee80211_calc_hw_conf_chan was ignoring the configured +user_txpower. If it is set, use it to potentially decrease +txpower as requested. + +Signed-off-by: Ben Greear +Link: https://patch.msgid.link/20241010203954.1219686-1-greearb@candelatech.com +Signed-off-by: Johannes Berg +--- + +--- a/net/mac80211/main.c ++++ b/net/mac80211/main.c +@@ -167,6 +167,8 @@ static u32 ieee80211_calc_hw_conf_chan(s + } + + power = ieee80211_chandef_max_power(&chandef); ++ if (local->user_power_level != IEEE80211_UNSET_POWER_LEVEL) ++ power = min(local->user_power_level, power); + + rcu_read_lock(); + list_for_each_entry_rcu(sdata, &local->interfaces, list) { diff --git a/package/kernel/mac80211/patches/subsys/365-wifi-cfg80211-Add-wiphy_delayed_work_pending.patch b/package/kernel/mac80211/patches/subsys/365-wifi-cfg80211-Add-wiphy_delayed_work_pending.patch new file mode 100644 index 00000000000000..981cc2433b3563 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/365-wifi-cfg80211-Add-wiphy_delayed_work_pending.patch @@ -0,0 +1,83 @@ +From: Remi Pommarel +Date: Tue, 24 Sep 2024 21:28:04 +0200 +Subject: [PATCH] wifi: cfg80211: Add wiphy_delayed_work_pending() + +Add wiphy_delayed_work_pending() to check if any delayed work timer is +pending, that can be used to be sure that wiphy_delayed_work_queue() +won't postpone an already pending delayed work. + +Signed-off-by: Remi Pommarel +Link: https://patch.msgid.link/20240924192805.13859-2-repk@triplefau.lt +[fix return value kernel-doc] +Signed-off-by: Johannes Berg +--- + +--- a/include/net/cfg80211.h ++++ b/include/net/cfg80211.h +@@ -6141,6 +6141,50 @@ void wiphy_delayed_work_flush(struct wip + struct wiphy_delayed_work *dwork); + + /** ++ * wiphy_delayed_work_pending - Find out whether a wiphy delayable ++ * work item is currently pending. ++ * ++ * @wiphy: the wiphy, for debug purposes ++ * @dwork: the delayed work in question ++ * ++ * Return: true if timer is pending, false otherwise ++ * ++ * How wiphy_delayed_work_queue() works is by setting a timer which ++ * when it expires calls wiphy_work_queue() to queue the wiphy work. ++ * Because wiphy_delayed_work_queue() uses mod_timer(), if it is ++ * called twice and the second call happens before the first call ++ * deadline, the work will rescheduled for the second deadline and ++ * won't run before that. ++ * ++ * wiphy_delayed_work_pending() can be used to detect if calling ++ * wiphy_work_delayed_work_queue() would start a new work schedule ++ * or delayed a previous one. As seen below it cannot be used to ++ * detect precisely if the work has finished to execute nor if it ++ * is currently executing. ++ * ++ * CPU0 CPU1 ++ * wiphy_delayed_work_queue(wk) ++ * mod_timer(wk->timer) ++ * wiphy_delayed_work_pending(wk) -> true ++ * ++ * [...] ++ * expire_timers(wk->timer) ++ * detach_timer(wk->timer) ++ * wiphy_delayed_work_pending(wk) -> false ++ * wk->timer->function() | ++ * wiphy_work_queue(wk) | delayed work pending ++ * list_add_tail() | returns false but ++ * queue_work(cfg80211_wiphy_work) | wk->func() has not ++ * | been run yet ++ * [...] | ++ * cfg80211_wiphy_work() | ++ * wk->func() V ++ * ++ */ ++bool wiphy_delayed_work_pending(struct wiphy *wiphy, ++ struct wiphy_delayed_work *dwork); ++ ++/** + * enum ieee80211_ap_reg_power - regulatory power for an Access Point + * + * @IEEE80211_REG_UNSET_AP: Access Point has no regulatory power mode +--- a/net/wireless/core.c ++++ b/net/wireless/core.c +@@ -1735,6 +1735,13 @@ void wiphy_delayed_work_flush(struct wip + } + EXPORT_SYMBOL_GPL(wiphy_delayed_work_flush); + ++bool wiphy_delayed_work_pending(struct wiphy *wiphy, ++ struct wiphy_delayed_work *dwork) ++{ ++ return timer_pending(&dwork->timer); ++} ++EXPORT_SYMBOL_GPL(wiphy_delayed_work_pending); ++ + static int __init cfg80211_init(void) + { + int err; diff --git a/package/kernel/mac80211/patches/subsys/366-wifi-mac80211-Convert-color-collision-detection-to-w.patch b/package/kernel/mac80211/patches/subsys/366-wifi-mac80211-Convert-color-collision-detection-to-w.patch new file mode 100644 index 00000000000000..ae72441c468819 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/366-wifi-mac80211-Convert-color-collision-detection-to-w.patch @@ -0,0 +1,148 @@ +From: Remi Pommarel +Date: Tue, 24 Sep 2024 21:28:05 +0200 +Subject: [PATCH] wifi: mac80211: Convert color collision detection to wiphy + work + +Call to ieee80211_color_collision_detection_work() needs wiphy lock to +be held (see lockdep assert in cfg80211_bss_color_notify()). Not locking +wiphy causes the following lockdep error: + + WARNING: CPU: 2 PID: 42 at net/wireless/nl80211.c:19505 cfg80211_bss_color_notify+0x1a4/0x25c + Modules linked in: + CPU: 2 PID: 42 Comm: kworker/u8:3 Tainted: G W 6.4.0-02327-g36c6cb260481 #1048 + Hardware name: + Workqueue: phy1 ieee80211_color_collision_detection_work + pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) + pc : cfg80211_bss_color_notify+0x1a4/0x25c + lr : cfg80211_bss_color_notify+0x1a0/0x25c + sp : ffff000002947d00 + x29: ffff000002947d00 x28: ffff800008e1a000 x27: ffff000002bd4705 + x26: ffff00000d034000 x25: ffff80000903cf40 x24: 0000000000000000 + x23: ffff00000cb70720 x22: 0000000000800000 x21: ffff800008dfb008 + x20: 000000000000008d x19: ffff00000d035fa8 x18: 0000000000000010 + x17: 0000000000000001 x16: 000003564b1ce96a x15: 000d69696d057970 + x14: 000000000000003b x13: 0000000000000001 x12: 0000000000040000 + x11: 0000000000000001 x10: ffff80000978f9c0 x9 : ffff0000028d3174 + x8 : ffff800008e30000 x7 : 0000000000000000 x6 : 0000000000000028 + x5 : 000000000002f498 x4 : ffff00000d034a80 x3 : 0000000000800000 + x2 : ffff800016143000 x1 : 0000000000000000 x0 : 0000000000000000 + Call trace: + cfg80211_bss_color_notify+0x1a4/0x25c + ieee80211_color_collision_detection_work+0x20/0x118 + process_one_work+0x294/0x554 + worker_thread+0x70/0x440 + kthread+0xf4/0xf8 + ret_from_fork+0x10/0x20 + irq event stamp: 77372 + hardirqs last enabled at (77371): [] _raw_spin_unlock_irq+0x2c/0x4c + hardirqs last disabled at (77372): [] el1_dbg+0x20/0x48 + softirqs last enabled at (77350): [] batadv_send_outstanding_bcast_packet+0xb8/0x120 + softirqs last disabled at (77348): [] batadv_send_outstanding_bcast_packet+0x80/0x120 + +The wiphy lock cannot be taken directly from color collision detection +delayed work (ieee80211_color_collision_detection_work()) because this +work is cancel_delayed_work_sync() under this wiphy lock causing a +potential deadlock( see [0] for details). + +To fix that ieee80211_color_collision_detection_work() could be +converted to a wiphy work and cancel_delayed_work_sync() can be simply +replaced by wiphy_delayed_work_cancel() serving the same purpose under +wiphy lock. + +This could potentially fix [1]. + +[0]: https://lore.kernel.org/linux-wireless/D4A40Q44OAY2.W3SIF6UEPBUN@freebox.fr/ +[1]: https://lore.kernel.org/lkml/000000000000612f290618eee3e5@google.com/ + +Reported-by: Nicolas Escande +Signed-off-by: Remi Pommarel +Link: https://patch.msgid.link/20240924192805.13859-3-repk@triplefau.lt +Signed-off-by: Johannes Berg +--- + +--- a/net/mac80211/cfg.c ++++ b/net/mac80211/cfg.c +@@ -4836,12 +4836,12 @@ void ieee80211_color_change_finalize_wor + ieee80211_color_change_finalize(link); + } + +-void ieee80211_color_collision_detection_work(struct work_struct *work) ++void ieee80211_color_collision_detection_work(struct wiphy *wiphy, ++ struct wiphy_work *work) + { +- struct delayed_work *delayed_work = to_delayed_work(work); + struct ieee80211_link_data *link = +- container_of(delayed_work, struct ieee80211_link_data, +- color_collision_detect_work); ++ container_of(work, struct ieee80211_link_data, ++ color_collision_detect_work.work); + struct ieee80211_sub_if_data *sdata = link->sdata; + + cfg80211_obss_color_collision_notify(sdata->dev, link->color_bitmap, +@@ -4894,7 +4894,8 @@ ieee80211_obss_color_collision_notify(st + return; + } + +- if (delayed_work_pending(&link->color_collision_detect_work)) { ++ if (wiphy_delayed_work_pending(sdata->local->hw.wiphy, ++ &link->color_collision_detect_work)) { + rcu_read_unlock(); + return; + } +@@ -4903,9 +4904,9 @@ ieee80211_obss_color_collision_notify(st + /* queue the color collision detection event every 500 ms in order to + * avoid sending too much netlink messages to userspace. + */ +- ieee80211_queue_delayed_work(&sdata->local->hw, +- &link->color_collision_detect_work, +- msecs_to_jiffies(500)); ++ wiphy_delayed_work_queue(sdata->local->hw.wiphy, ++ &link->color_collision_detect_work, ++ msecs_to_jiffies(500)); + + rcu_read_unlock(); + } +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -1056,7 +1056,7 @@ struct ieee80211_link_data { + } csa; + + struct wiphy_work color_change_finalize_work; +- struct delayed_work color_collision_detect_work; ++ struct wiphy_delayed_work color_collision_detect_work; + u64 color_bitmap; + + /* context reservation -- protected with wiphy mutex */ +@@ -2010,7 +2010,8 @@ int ieee80211_channel_switch(struct wiph + /* color change handling */ + void ieee80211_color_change_finalize_work(struct wiphy *wiphy, + struct wiphy_work *work); +-void ieee80211_color_collision_detection_work(struct work_struct *work); ++void ieee80211_color_collision_detection_work(struct wiphy *wiphy, ++ struct wiphy_work *work); + + /* interface handling */ + #define MAC80211_SUPPORTED_FEATURES_TX (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | \ +--- a/net/mac80211/link.c ++++ b/net/mac80211/link.c +@@ -41,8 +41,8 @@ void ieee80211_link_init(struct ieee8021 + ieee80211_csa_finalize_work); + wiphy_work_init(&link->color_change_finalize_work, + ieee80211_color_change_finalize_work); +- INIT_DELAYED_WORK(&link->color_collision_detect_work, +- ieee80211_color_collision_detection_work); ++ wiphy_delayed_work_init(&link->color_collision_detect_work, ++ ieee80211_color_collision_detection_work); + INIT_LIST_HEAD(&link->assigned_chanctx_list); + INIT_LIST_HEAD(&link->reserved_chanctx_list); + wiphy_delayed_work_init(&link->dfs_cac_timer_work, +@@ -72,7 +72,8 @@ void ieee80211_link_stop(struct ieee8021 + if (link->sdata->vif.type == NL80211_IFTYPE_STATION) + ieee80211_mgd_stop_link(link); + +- cancel_delayed_work_sync(&link->color_collision_detect_work); ++ wiphy_delayed_work_cancel(link->sdata->local->hw.wiphy, ++ &link->color_collision_detect_work); + wiphy_work_cancel(link->sdata->local->hw.wiphy, + &link->color_change_finalize_work); + wiphy_work_cancel(link->sdata->local->hw.wiphy, From 3ecfc24c511c51e42e98a27a94543a442a7f59a7 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Mon, 18 Nov 2024 15:01:07 +0100 Subject: [PATCH 043/877] airoha: an7581: sync patch with upstream version and tag them Sync patch with upstream version and tag them. Minor changes done to Pinctrl patch to support older kernel. Patch automatically refreshed with make target/linux/refresh. Signed-off-by: Christian Marangi (cherry picked from commit a5d23e3aee9bd616044c3eadfe2dbcad5d18b163) --- ...-support-for-Airoha-EN7851-watchdog.patch} | 15 ++++--- ...-REG_PCIE-_-MEM-MEM_MASK-configurat.patch} | 6 ++- ...-clock_register-in-hw_init-callback.patch} | 6 ++- ...lk-en7523-introduce-chip_scu-regmap.patch} | 6 ++- ...estimation-of-fixed-rate-for-EN7581.patch} | 6 ++- ...n7581_reset_register-in-en7581_clk_.patch} | 6 ++- ...523-map-io-region-in-a-single-block.patch} | 6 ++- ...l-airoha-Add-support-for-EN7581-SoC.patch} | 42 +++++++++---------- 8 files changed, 52 insertions(+), 41 deletions(-) rename target/linux/airoha/patches-6.6/{103-watchdog-Add-support-for-Airoha-EN7851-watchdog.patch => 032-v6.13-watchdog-Add-support-for-Airoha-EN7851-watchdog.patch} (94%) rename target/linux/airoha/patches-6.6/{106-01-clk-en7523-remove-REG_PCIE-_-MEM-MEM_MASK-configurat.patch => 033-01-v6.13-clk-en7523-remove-REG_PCIE-_-MEM-MEM_MASK-configurat.patch} (89%) rename target/linux/airoha/patches-6.6/{106-02-clk-en7523-move-clock_register-in-hw_init-callback.patch => 033-02-v6.13-clk-en7523-move-clock_register-in-hw_init-callback.patch} (94%) rename target/linux/airoha/patches-6.6/{106-03-clk-en7523-introduce-chip_scu-regmap.patch => 033-03-v6.13-clk-en7523-introduce-chip_scu-regmap.patch} (95%) rename target/linux/airoha/patches-6.6/{106-04-clk-en7523-fix-estimation-of-fixed-rate-for-EN7581.patch => 033-04-v6.13-clk-en7523-fix-estimation-of-fixed-rate-for-EN7581.patch} (94%) rename target/linux/airoha/patches-6.6/{106-05-clk-en7523-move-en7581_reset_register-in-en7581_clk_.patch => 033-05-v6.13-clk-en7523-move-en7581_reset_register-in-en7581_clk_.patch} (95%) rename target/linux/airoha/patches-6.6/{106-06-clk-en7523-map-io-region-in-a-single-block.patch => 033-06-v6.13-clk-en7523-map-io-region-in-a-single-block.patch} (91%) rename target/linux/airoha/patches-6.6/{107-pinctrl-airoha-Add-support-for-EN7581-SoC.patch => 034-v6.13-pinctrl-airoha-Add-support-for-EN7581-SoC.patch} (99%) diff --git a/target/linux/airoha/patches-6.6/103-watchdog-Add-support-for-Airoha-EN7851-watchdog.patch b/target/linux/airoha/patches-6.6/032-v6.13-watchdog-Add-support-for-Airoha-EN7851-watchdog.patch similarity index 94% rename from target/linux/airoha/patches-6.6/103-watchdog-Add-support-for-Airoha-EN7851-watchdog.patch rename to target/linux/airoha/patches-6.6/032-v6.13-watchdog-Add-support-for-Airoha-EN7851-watchdog.patch index e58ee546094250..02dbadff4e8704 100644 --- a/target/linux/airoha/patches-6.6/103-watchdog-Add-support-for-Airoha-EN7851-watchdog.patch +++ b/target/linux/airoha/patches-6.6/032-v6.13-watchdog-Add-support-for-Airoha-EN7851-watchdog.patch @@ -1,19 +1,18 @@ -From 4019d58ca5b249e4cf79169cc0c6a4ff5275c155 Mon Sep 17 00:00:00 2001 +From 3cf67f3769b8227ca75ca7102180a2e270ee01aa Mon Sep 17 00:00:00 2001 From: Christian Marangi -Date: Fri, 5 Jul 2024 19:12:12 +0200 -Subject: [PATCH v2 2/2] watchdog: Add support for Airoha EN7851 watchdog +Date: Fri, 11 Oct 2024 12:43:53 +0200 +Subject: [PATCH] watchdog: Add support for Airoha EN7851 watchdog Add support for Airoha EN7851 watchdog. This is a very basic watchdog with no pretimeout support, max timeout is 28 seconds and it ticks based on half the SoC BUS clock. Signed-off-by: Christian Marangi +Reviewed-by: Guenter Roeck +Link: https://lore.kernel.org/r/20241011104411.28659-2-ansuelsmth@gmail.com +Signed-off-by: Guenter Roeck +Signed-off-by: Wim Van Sebroeck --- -Changes v2: -- Drop clock-frequency implementation -- Add missing bitfield.h header -- Attach BUS clock - drivers/watchdog/Kconfig | 8 ++ drivers/watchdog/Makefile | 1 + drivers/watchdog/airoha_wdt.c | 216 ++++++++++++++++++++++++++++++++++ diff --git a/target/linux/airoha/patches-6.6/106-01-clk-en7523-remove-REG_PCIE-_-MEM-MEM_MASK-configurat.patch b/target/linux/airoha/patches-6.6/033-01-v6.13-clk-en7523-remove-REG_PCIE-_-MEM-MEM_MASK-configurat.patch similarity index 89% rename from target/linux/airoha/patches-6.6/106-01-clk-en7523-remove-REG_PCIE-_-MEM-MEM_MASK-configurat.patch rename to target/linux/airoha/patches-6.6/033-01-v6.13-clk-en7523-remove-REG_PCIE-_-MEM-MEM_MASK-configurat.patch index d2e0c6d5417ec9..59aefbb66e96d0 100644 --- a/target/linux/airoha/patches-6.6/106-01-clk-en7523-remove-REG_PCIE-_-MEM-MEM_MASK-configurat.patch +++ b/target/linux/airoha/patches-6.6/033-01-v6.13-clk-en7523-remove-REG_PCIE-_-MEM-MEM_MASK-configurat.patch @@ -1,6 +1,6 @@ -From 64e497f372dfca3e6be9fe05a0f9b874ea8604d2 Mon Sep 17 00:00:00 2001 +From c31d1cdd7bff1d2c13d435bb9d0c76bfaa332097 Mon Sep 17 00:00:00 2001 From: Lorenzo Bianconi -Date: Tue, 3 Sep 2024 23:39:46 +0200 +Date: Tue, 12 Nov 2024 01:08:49 +0100 Subject: [PATCH 1/6] clk: en7523: remove REG_PCIE*_{MEM,MEM_MASK} configuration @@ -12,6 +12,8 @@ This patch does not introduce any backward incompatibility since the dts for EN7581 SoC is not upstream yet. Signed-off-by: Lorenzo Bianconi +Link: https://lore.kernel.org/r/20241112-clk-en7581-syscon-v2-2-8ada5e394ae4@kernel.org +Signed-off-by: Stephen Boyd --- drivers/clk/clk-en7523.c | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/target/linux/airoha/patches-6.6/106-02-clk-en7523-move-clock_register-in-hw_init-callback.patch b/target/linux/airoha/patches-6.6/033-02-v6.13-clk-en7523-move-clock_register-in-hw_init-callback.patch similarity index 94% rename from target/linux/airoha/patches-6.6/106-02-clk-en7523-move-clock_register-in-hw_init-callback.patch rename to target/linux/airoha/patches-6.6/033-02-v6.13-clk-en7523-move-clock_register-in-hw_init-callback.patch index 44bfc4404bb52d..f4cfaa2bf9d901 100644 --- a/target/linux/airoha/patches-6.6/106-02-clk-en7523-move-clock_register-in-hw_init-callback.patch +++ b/target/linux/airoha/patches-6.6/033-02-v6.13-clk-en7523-move-clock_register-in-hw_init-callback.patch @@ -1,6 +1,6 @@ -From 0dd8a6df58a4a8cf1f341249e7358b3bb51f52ad Mon Sep 17 00:00:00 2001 +From b8bdfc666bc5f58caf46e67b615132fccbaca3d4 Mon Sep 17 00:00:00 2001 From: Lorenzo Bianconi -Date: Tue, 3 Sep 2024 23:39:47 +0200 +Date: Tue, 12 Nov 2024 01:08:50 +0100 Subject: [PATCH 2/6] clk: en7523: move clock_register in hw_init callback Move en7523_register_clocks routine in hw_init callback. @@ -11,6 +11,8 @@ EN7523 and EN7581 SoCs in order to access chip-scu IO region miscellaneous registers needed by multiple devices (clock, pinctrl ..). Signed-off-by: Lorenzo Bianconi +Link: https://lore.kernel.org/r/20241112-clk-en7581-syscon-v2-3-8ada5e394ae4@kernel.org +Signed-off-by: Stephen Boyd --- drivers/clk/clk-en7523.c | 82 ++++++++++++++++++++++++---------------- 1 file changed, 50 insertions(+), 32 deletions(-) diff --git a/target/linux/airoha/patches-6.6/106-03-clk-en7523-introduce-chip_scu-regmap.patch b/target/linux/airoha/patches-6.6/033-03-v6.13-clk-en7523-introduce-chip_scu-regmap.patch similarity index 95% rename from target/linux/airoha/patches-6.6/106-03-clk-en7523-introduce-chip_scu-regmap.patch rename to target/linux/airoha/patches-6.6/033-03-v6.13-clk-en7523-introduce-chip_scu-regmap.patch index 4f8211c564658c..6c34ca2fa54808 100644 --- a/target/linux/airoha/patches-6.6/106-03-clk-en7523-introduce-chip_scu-regmap.patch +++ b/target/linux/airoha/patches-6.6/033-03-v6.13-clk-en7523-introduce-chip_scu-regmap.patch @@ -1,6 +1,6 @@ -From f849bcb746abeaafa63b4f02f1d8bb22703fc645 Mon Sep 17 00:00:00 2001 +From f72fc22038dd544fa4d39c06e8c81c09c0041ed4 Mon Sep 17 00:00:00 2001 From: Lorenzo Bianconi -Date: Tue, 3 Sep 2024 23:39:48 +0200 +Date: Tue, 12 Nov 2024 01:08:51 +0100 Subject: [PATCH 3/6] clk: en7523: introduce chip_scu regmap Introduce chip_scu regmap pointer since EN7581 SoC will access chip-scu @@ -9,6 +9,8 @@ for EN7581 SoC. This patch does not introduce any backward incompatibility since the dts for EN7581 SoC is not upstream yet. Signed-off-by: Lorenzo Bianconi +Link: https://lore.kernel.org/r/20241112-clk-en7581-syscon-v2-4-8ada5e394ae4@kernel.org +Signed-off-by: Stephen Boyd --- drivers/clk/clk-en7523.c | 81 ++++++++++++++++++++++++++++++---------- 1 file changed, 61 insertions(+), 20 deletions(-) diff --git a/target/linux/airoha/patches-6.6/106-04-clk-en7523-fix-estimation-of-fixed-rate-for-EN7581.patch b/target/linux/airoha/patches-6.6/033-04-v6.13-clk-en7523-fix-estimation-of-fixed-rate-for-EN7581.patch similarity index 94% rename from target/linux/airoha/patches-6.6/106-04-clk-en7523-fix-estimation-of-fixed-rate-for-EN7581.patch rename to target/linux/airoha/patches-6.6/033-04-v6.13-clk-en7523-fix-estimation-of-fixed-rate-for-EN7581.patch index c311375a8b780d..79c9ab2ee1c486 100644 --- a/target/linux/airoha/patches-6.6/106-04-clk-en7523-fix-estimation-of-fixed-rate-for-EN7581.patch +++ b/target/linux/airoha/patches-6.6/033-04-v6.13-clk-en7523-fix-estimation-of-fixed-rate-for-EN7581.patch @@ -1,6 +1,6 @@ -From b9ea4918216ca0c2511446c531d3f8163ac1466d Mon Sep 17 00:00:00 2001 +From f98eded9e9ab048c88ff59c5523e703a6ced5523 Mon Sep 17 00:00:00 2001 From: Lorenzo Bianconi -Date: Tue, 3 Sep 2024 23:39:49 +0200 +Date: Tue, 12 Nov 2024 01:08:52 +0100 Subject: [PATCH 4/6] clk: en7523: fix estimation of fixed rate for EN7581 Introduce en7581_base_clks array in order to define per-SoC fixed-rate @@ -9,6 +9,8 @@ clocks Fixes: 66bc47326ce2 ("clk: en7523: Add EN7581 support") Signed-off-by: Lorenzo Bianconi +Link: https://lore.kernel.org/r/20241112-clk-en7581-syscon-v2-5-8ada5e394ae4@kernel.org +Signed-off-by: Stephen Boyd --- drivers/clk/clk-en7523.c | 105 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 103 insertions(+), 2 deletions(-) diff --git a/target/linux/airoha/patches-6.6/106-05-clk-en7523-move-en7581_reset_register-in-en7581_clk_.patch b/target/linux/airoha/patches-6.6/033-05-v6.13-clk-en7523-move-en7581_reset_register-in-en7581_clk_.patch similarity index 95% rename from target/linux/airoha/patches-6.6/106-05-clk-en7523-move-en7581_reset_register-in-en7581_clk_.patch rename to target/linux/airoha/patches-6.6/033-05-v6.13-clk-en7523-move-en7581_reset_register-in-en7581_clk_.patch index 3869a58a83ac57..36b9d9f3dc6ed2 100644 --- a/target/linux/airoha/patches-6.6/106-05-clk-en7523-move-en7581_reset_register-in-en7581_clk_.patch +++ b/target/linux/airoha/patches-6.6/033-05-v6.13-clk-en7523-move-en7581_reset_register-in-en7581_clk_.patch @@ -1,6 +1,6 @@ -From 2c5b1a5b68973947a6919d9c951f9b3e0d84f347 Mon Sep 17 00:00:00 2001 +From 82e6bf912d5846646892becea659b39d178d79e3 Mon Sep 17 00:00:00 2001 From: Lorenzo Bianconi -Date: Tue, 3 Sep 2024 23:39:50 +0200 +Date: Tue, 12 Nov 2024 01:08:53 +0100 Subject: [PATCH 5/6] clk: en7523: move en7581_reset_register() in en7581_clk_hw_init() @@ -9,6 +9,8 @@ feature is supported just by EN7581 SoC. Get rid of reset struct in en_clk_soc_data data struct. Signed-off-by: Lorenzo Bianconi +Link: https://lore.kernel.org/r/20241112-clk-en7581-syscon-v2-6-8ada5e394ae4@kernel.org +Signed-off-by: Stephen Boyd --- drivers/clk/clk-en7523.c | 93 ++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 60 deletions(-) diff --git a/target/linux/airoha/patches-6.6/106-06-clk-en7523-map-io-region-in-a-single-block.patch b/target/linux/airoha/patches-6.6/033-06-v6.13-clk-en7523-map-io-region-in-a-single-block.patch similarity index 91% rename from target/linux/airoha/patches-6.6/106-06-clk-en7523-map-io-region-in-a-single-block.patch rename to target/linux/airoha/patches-6.6/033-06-v6.13-clk-en7523-map-io-region-in-a-single-block.patch index db04d602f33299..dec7b81e5b2012 100644 --- a/target/linux/airoha/patches-6.6/106-06-clk-en7523-map-io-region-in-a-single-block.patch +++ b/target/linux/airoha/patches-6.6/033-06-v6.13-clk-en7523-map-io-region-in-a-single-block.patch @@ -1,6 +1,6 @@ -From 665a59f4836c3d7813a9d8bfb9680d93adb4626e Mon Sep 17 00:00:00 2001 +From a9eaf305017a5ebe73ab34e85bd5414055a88f29 Mon Sep 17 00:00:00 2001 From: Lorenzo Bianconi -Date: Tue, 3 Sep 2024 23:39:51 +0200 +Date: Tue, 12 Nov 2024 01:08:54 +0100 Subject: [PATCH 6/6] clk: en7523: map io region in a single block Map all clock-controller memory region in a single block. @@ -8,6 +8,8 @@ This patch does not introduce any backward incompatibility since the dts for EN7581 SoC is not upstream yet. Signed-off-by: Lorenzo Bianconi +Link: https://lore.kernel.org/r/20241112-clk-en7581-syscon-v2-7-8ada5e394ae4@kernel.org +Signed-off-by: Stephen Boyd --- drivers/clk/clk-en7523.c | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/target/linux/airoha/patches-6.6/107-pinctrl-airoha-Add-support-for-EN7581-SoC.patch b/target/linux/airoha/patches-6.6/034-v6.13-pinctrl-airoha-Add-support-for-EN7581-SoC.patch similarity index 99% rename from target/linux/airoha/patches-6.6/107-pinctrl-airoha-Add-support-for-EN7581-SoC.patch rename to target/linux/airoha/patches-6.6/034-v6.13-pinctrl-airoha-Add-support-for-EN7581-SoC.patch index 8e299512c36a40..2e36a2540fa737 100644 --- a/target/linux/airoha/patches-6.6/107-pinctrl-airoha-Add-support-for-EN7581-SoC.patch +++ b/target/linux/airoha/patches-6.6/034-v6.13-pinctrl-airoha-Add-support-for-EN7581-SoC.patch @@ -1,7 +1,7 @@ -From 21cb14f3e6d12d666a9ec0fd7cc01d722b04e514 Mon Sep 17 00:00:00 2001 +From 1c8ace2d0725c1c8d5012f8a56c5fb31805aad27 Mon Sep 17 00:00:00 2001 From: Lorenzo Bianconi -Date: Wed, 16 Oct 2024 12:07:33 +0200 -Subject: [PATCH 1/2] pinctrl: airoha: Add support for EN7581 SoC +Date: Wed, 23 Oct 2024 01:20:05 +0200 +Subject: [PATCH] pinctrl: airoha: Add support for EN7581 SoC Introduce pinctrl driver for EN7581 SoC. Current EN7581 pinctrl driver supports the following functionalities: @@ -15,8 +15,10 @@ Tested-by: Benjamin Larsson Co-developed-by: Benjamin Larsson Signed-off-by: Benjamin Larsson Reviewed-by: Linus Walleij -Signed-off-by: Lorenzo Bianconi Reviewed-by: AngeloGioacchino Del Regno +Signed-off-by: Lorenzo Bianconi +Link: https://lore.kernel.org/20241023-en7581-pinctrl-v9-5-afb0cbcab0ec@kernel.org +Signed-off-by: Linus Walleij --- MAINTAINERS | 7 + drivers/pinctrl/mediatek/Kconfig | 17 +- @@ -25,24 +27,22 @@ Reviewed-by: AngeloGioacchino Del Regno -# +L: linux-mediatek@lists.infradead.org (moderated for non-subscribers) -# +S: Maintained -# +F: Documentation/devicetree/bindings/pinctrl/airoha,en7581-pinctrl.yaml -# +F: drivers/pinctrl/mediatek/pinctrl-airoha.c -# + -# PIN CONTROLLER - AMD -# M: Basavaraj Natikar -# M: Shyam Sundar S K ++PIN CONTROLLER - AIROHA ++M: Lorenzo Bianconi ++L: linux-mediatek@lists.infradead.org (moderated for non-subscribers) ++S: Maintained ++F: Documentation/devicetree/bindings/pinctrl/airoha,en7581-pinctrl.yaml ++F: drivers/pinctrl/mediatek/pinctrl-airoha.c ++ + PIN CONTROLLER - AMD + M: Basavaraj Natikar + M: Shyam Sundar S K --- a/drivers/pinctrl/mediatek/Kconfig +++ b/drivers/pinctrl/mediatek/Kconfig @@ -1,6 +1,6 @@ From 112adbee6822d39b418c7c569a522b9c4ae2456c Mon Sep 17 00:00:00 2001 From: David Bauer Date: Sun, 17 Nov 2024 13:23:09 +0100 Subject: [PATCH 044/877] net: phy: broadcom: update dependency condition The broadcom PHY driver only has to depend upon PTP_1588_CLOCK_OPTIONAL if NETWORK_PHY_TIMESTAMPING is enabled. The PTP functionality is stubbed in this case. Reflect this circumstance in the dependence condition. This allows to build the driver as a built-in module even if PTP is built as a module. This is required to include the broadcom PHY module regardless of the built-setting of the PTP subsystem. On ath79 (and probably more) targets with Broadcom PHY, Gigabit operation is currently broken as the PHY driver is only built as a module in case all kernel-packages are built. Due to this circumstance, affected devices fall back to using the generic PHY driver. Signed-off-by: David Bauer (cherry picked from commit cbce32e30c29dc69907c6f4c0ab79dd5d9a8fb28) --- ...broadcom-update-dependency-condition.patch | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 target/linux/generic/pending-6.6/741-net-phy-broadcom-update-dependency-condition.patch diff --git a/target/linux/generic/pending-6.6/741-net-phy-broadcom-update-dependency-condition.patch b/target/linux/generic/pending-6.6/741-net-phy-broadcom-update-dependency-condition.patch new file mode 100644 index 00000000000000..80b69920e9d46f --- /dev/null +++ b/target/linux/generic/pending-6.6/741-net-phy-broadcom-update-dependency-condition.patch @@ -0,0 +1,35 @@ +From 1be3688b3eaa7ea2d9e19bd29ae6a6a51c121a0b Mon Sep 17 00:00:00 2001 +From: David Bauer +Date: Sat, 16 Nov 2024 22:36:15 +0100 +Subject: [PATCH] net: phy: broadcom: update dependency condition + +The broadcom PHY driver only has to depend upon PTP_1588_CLOCK_OPTIONAL +if NETWORK_PHY_TIMESTAMPING is enabled. The PTP functionality is stubbed +in this case. + +Reflect this circumstance in the dependence condition. This allows to +build the driver as a built-in module even if PTP is built as a module. + +This is required to include the broadcom PHY module regardless of the +built-setting of the PTP subsystem. On ath79 (and probably more) +targets with Broadcom PHY, Gigabit operation is currently broken as the +PHY driver is only built as a module in case all kernel-packages are +built. Due to this circumstance, affected devices fall back to using the +generic PHY driver. + +Signed-off-by: David Bauer +--- + drivers/net/phy/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -113,7 +113,7 @@ config BROADCOM_PHY + tristate "Broadcom 54XX PHYs" + select BCM_NET_PHYLIB + select BCM_NET_PHYPTP if NETWORK_PHY_TIMESTAMPING +- depends on PTP_1588_CLOCK_OPTIONAL ++ depends on NETWORK_PHY_TIMESTAMPING=n || PTP_1588_CLOCK_OPTIONAL + help + Currently supports the BCM5411, BCM5421, BCM5461, BCM54616S, BCM5464, + BCM5481, BCM54810 and BCM5482 PHYs. From 5ad5677067cbad3c209c38e9fffdc5e839e87e6e Mon Sep 17 00:00:00 2001 From: Rodrigo Balerdi Date: Thu, 14 Nov 2024 17:37:32 -0300 Subject: [PATCH 045/877] ipq806x: tr4400v2: fix dtc warnings by deleting stock partitions The original set of stock partitions was kept in the TR4400 v2 port, with the same partition numbers but their names prefixed with 'stock_'. This allowed scripts (installation, back to stock, etc) to run on both stock and OpenWrt firmware. But this triggers warnings in the device tree compiler, as partitions of the old and new schemes overlap. This commit fixes the dtc warnings by deleting the stock partitions, also renumbering some of the remaining MTD partitions in the process. Additionally, the 'fw_env' partition is set to read-only. These changes can break existing scripts as well as user configurations that utilize the 'extra' partition. Users wanting to run old scripts can do so by reverting to the 23.05 series releases. Signed-off-by: Rodrigo Balerdi Link: https://github.com/openwrt/openwrt/pull/16958 Signed-off-by: Robert Marko (cherry picked from commit 8ec35a2a1533ccff8a4b0e6f4f0a0954d1bee6a6) --- .../boot/dts/qcom/qcom-ipq8065-tr4400-v2.dts | 30 ++----------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/target/linux/ipq806x/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq8065-tr4400-v2.dts b/target/linux/ipq806x/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq8065-tr4400-v2.dts index 8410721b72c0e8..5d86d80047f4cd 100644 --- a/target/linux/ipq806x/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq8065-tr4400-v2.dts +++ b/target/linux/ipq806x/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq8065-tr4400-v2.dts @@ -204,8 +204,8 @@ }; }; }; - stock_partition@1340000 { - label = "stock_rootfs"; + partition@1340000 { + label = "extra"; reg = <0x1340000 0x4000000>; }; partition@5340000 { @@ -253,30 +253,10 @@ reg = <0x5f00000 0x0500000>; read-only; }; - stock_partition@6400000 { - label = "stock_rootfs_1"; - reg = <0x6400000 0x4000000>; - }; - stock_partition@a400000 { - label = "stock_fw_env"; - reg = <0xa400000 0x0100000>; - }; - stock_partition@a500000 { - label = "stock_config"; - reg = <0xa500000 0x0800000>; - }; - stock_partition@ad00000 { - label = "stock_PKI"; - reg = <0xad00000 0x0200000>; - }; - stock_partition@af00000 { - label = "stock_scfgmgr"; - reg = <0xaf00000 0x0100000>; - }; - partition@6400000 { label = "fw_env"; reg = <0x6400000 0x0100000>; + read-only; nvmem-layout { compatible = "fixed-layout"; @@ -304,10 +284,6 @@ label = "ubi"; reg = <0x6500000 0x9b00000>; }; - partition@1340000 { - label = "extra"; - reg = <0x1340000 0x4000000>; - }; }; }; }; From 1abaf051d2f8b53eac2ebc245e22dfeef45ec1c9 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Tue, 19 Nov 2024 23:56:19 +0100 Subject: [PATCH 046/877] imagebuilder: fix OPKG package_whatdepends support Trying to use 'package_whatdepends' feature of the ImageBuilder with OPKG will currently fail as OPKG does not support "list --depends" call at all, it seems that this is a mixup from the original APK support commit. So, lets restore 'package_whatdepends' support for OPKG by calling "whatdepends -A" instead as we used to before APK support. Fixes: d788ab376f85 ("build: add APK package build capabilities") Link: https://github.com/openwrt/openwrt/pull/17022 Signed-off-by: Robert Marko (cherry picked from commit 52519a59a859d349f154ed79e0a3d63457b6aa6a) --- target/imagebuilder/files/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/imagebuilder/files/Makefile b/target/imagebuilder/files/Makefile index f46b61b7870670..54bc6128407289 100644 --- a/target/imagebuilder/files/Makefile +++ b/target/imagebuilder/files/Makefile @@ -352,7 +352,7 @@ ifeq ($(PACKAGE),) endif @$(MAKE) -s package_reload ifeq ($(CONFIG_USE_APK),) - @$(OPKG) list --depends $(PACKAGE) + @$(OPKG) whatdepends -A $(PACKAGE) else @$(APK) list --depends $(PACKAGE) endif From c279ca8b799e567226df804f07fd7a6073487b5f Mon Sep 17 00:00:00 2001 From: David Bauer Date: Sat, 23 Nov 2024 20:00:57 +0100 Subject: [PATCH 047/877] mediatek: fix Cudy AP3000 Outdoor label-mac The label-mac does not match the one assigned to the ethernet interface. Use the mac-address assigned to the wifi interface instead, as it matches the one found on the device label. Signed-off-by: David Bauer (cherry picked from commit b8b658bc0d22df31e7ac2d07cdd2af7155d12630) --- target/linux/mediatek/dts/mt7981b-cudy-ap3000outdoor-v1.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/mediatek/dts/mt7981b-cudy-ap3000outdoor-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-ap3000outdoor-v1.dts index 62e406394755ac..a1eb9c6e1e981a 100644 --- a/target/linux/mediatek/dts/mt7981b-cudy-ap3000outdoor-v1.dts +++ b/target/linux/mediatek/dts/mt7981b-cudy-ap3000outdoor-v1.dts @@ -11,7 +11,7 @@ compatible = "cudy,ap3000outdoor-v1", "mediatek,mt7981-spim-snand-rfb"; aliases { - label-mac-device = &gmac1; + label-mac-device = &wifi; led-boot = &led_status_green; led-failsafe = &led_status_red; led-running = &led_status_green; From b506c964a268dec3f7912288c77803b511213e1e Mon Sep 17 00:00:00 2001 From: John Audia Date: Thu, 14 Nov 2024 15:16:32 -0500 Subject: [PATCH 048/877] kernel: bump 6.6 to 6.6.61 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.61 Manually rebased: bcm27xx/patches-6.6/950-0998-i2c-designware-Add-support-for-bus-clear-feature.patch All other patches automatically rebased. Build system: x86/64 Build-tested: x86/64/AMD Cezanne, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Run-tested: x86/64/AMD Cezanne, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/16959 (cherry picked from commit 487ca61f917f9308222faf481ad8be4e2cef0c90) Link: https://github.com/openwrt/openwrt/pull/17055 Signed-off-by: Hauke Mehrtens --- include/kernel-6.6 | 4 ++-- ...devm_thermal_of_zone_register_with_pa.patch | 18 +++++++++--------- ...-all-the-downstream-rpi-sound-card-dr.patch | 2 +- ...nware-Add-SMBUS-quick-command-support.patch | 2 +- ...nware-Support-non-standard-bus-speeds.patch | 2 +- ...are-Add-support-for-bus-clear-feature.patch | 13 +++++++------ ...ac-move-TX-timer-arm-after-DMA-enable.patch | 12 ++++++------ .../780-usb-net-MeigLink_modem_support.patch | 4 ++-- ...bles-ignore-EOPNOTSUPP-on-flowtable-d.patch | 2 +- .../901-arm-add-cmdline-override.patch | 2 +- ...-arm64-dts-rockchip-Add-Radxa-ROCK-3C.patch | 2 +- ...m64-dts-rockchip-Add-Radxa-ZERO-3W-3E.patch | 2 +- ...-arm64-dts-rockchip-Add-Radxa-ROCK-3B.patch | 2 +- ...s-rockchip-Add-support-for-NanoPi-R6S.patch | 2 +- ...s-rockchip-Add-support-for-NanoPi-R6C.patch | 2 +- ...4-dts-rockchip-Add-ArmSom-Sige7-board.patch | 2 +- ...64-dts-rockchip-rk3566-Add-Nanopi-R3S.patch | 2 +- .../1009-net-stmmac-use-GFP_DMA32.patch | 2 +- ...smccc-Export-revision-soc_id-function.patch | 2 +- 19 files changed, 40 insertions(+), 39 deletions(-) diff --git a/include/kernel-6.6 b/include/kernel-6.6 index 261a77428cd3be..d870747f8362d5 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .60 -LINUX_KERNEL_HASH-6.6.60 = 52f9e32d5082ab94253447fd66670d0c3bb765cfcb99b0bf61d1b8eae25952ef +LINUX_VERSION-6.6 = .61 +LINUX_KERNEL_HASH-6.6.61 = 418fc24df9190f1c3ed9906dc3b7651c2a2eae5c1cb9ab4a6348e20faf047c0b diff --git a/target/linux/airoha/patches-6.6/101-01-thermal-of-Add-devm_thermal_of_zone_register_with_pa.patch b/target/linux/airoha/patches-6.6/101-01-thermal-of-Add-devm_thermal_of_zone_register_with_pa.patch index 889ec1123ef314..7836aef7dd1704 100644 --- a/target/linux/airoha/patches-6.6/101-01-thermal-of-Add-devm_thermal_of_zone_register_with_pa.patch +++ b/target/linux/airoha/patches-6.6/101-01-thermal-of-Add-devm_thermal_of_zone_register_with_pa.patch @@ -40,7 +40,7 @@ Signed-off-by: Christian Marangi --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c -@@ -249,7 +249,7 @@ static void thermal_of_parameters_init(s +@@ -245,7 +245,7 @@ static void thermal_of_parameters_init(s { int coef[2]; int ncoef = ARRAY_SIZE(coef); @@ -49,7 +49,7 @@ Signed-off-by: Christian Marangi tzp->no_hwmon = true; -@@ -261,14 +261,11 @@ static void thermal_of_parameters_init(s +@@ -257,14 +257,11 @@ static void thermal_of_parameters_init(s * thermal zone. Thus, we are considering only the first two * values as slope and offset. */ @@ -67,7 +67,7 @@ Signed-off-by: Christian Marangi } static struct device_node *thermal_of_zone_get_by_name(struct thermal_zone_device *tz) -@@ -462,10 +459,15 @@ static void thermal_of_zone_unregister(s +@@ -458,10 +455,15 @@ static void thermal_of_zone_unregister(s * zone properties and registers new thermal zone with those * properties. * @@ -83,7 +83,7 @@ Signed-off-by: Christian Marangi * * Return: a valid thermal zone structure pointer on success. * - EINVAL: if the device tree thermal description is malformed -@@ -473,11 +475,11 @@ static void thermal_of_zone_unregister(s +@@ -469,11 +471,11 @@ static void thermal_of_zone_unregister(s * - Other negative errors are returned by the underlying called functions */ static struct thermal_zone_device *thermal_of_zone_register(struct device_node *sensor, int id, void *data, @@ -97,7 +97,7 @@ Signed-off-by: Christian Marangi struct thermal_zone_device_ops *of_ops; struct device_node *np; int delay, pdelay; -@@ -509,7 +511,7 @@ static struct thermal_zone_device *therm +@@ -508,7 +510,7 @@ static struct thermal_zone_device *therm goto out_kfree_trips; } @@ -106,7 +106,7 @@ Signed-off-by: Christian Marangi of_ops->bind = thermal_of_bind; of_ops->unbind = thermal_of_unbind; -@@ -517,7 +519,7 @@ static struct thermal_zone_device *therm +@@ -516,7 +518,7 @@ static struct thermal_zone_device *therm mask = GENMASK_ULL((ntrips) - 1, 0); tz = thermal_zone_device_register_with_trips(np->name, trips, ntrips, @@ -115,7 +115,7 @@ Signed-off-by: Christian Marangi pdelay, delay); if (IS_ERR(tz)) { ret = PTR_ERR(tz); -@@ -572,6 +574,7 @@ static int devm_thermal_of_zone_match(st +@@ -571,6 +573,7 @@ static int devm_thermal_of_zone_match(st struct thermal_zone_device *devm_thermal_of_zone_register(struct device *dev, int sensor_id, void *data, const struct thermal_zone_device_ops *ops) { @@ -123,7 +123,7 @@ Signed-off-by: Christian Marangi struct thermal_zone_device **ptr, *tzd; ptr = devres_alloc(devm_thermal_of_zone_release, sizeof(*ptr), -@@ -579,7 +582,7 @@ struct thermal_zone_device *devm_thermal +@@ -578,7 +581,7 @@ struct thermal_zone_device *devm_thermal if (!ptr) return ERR_PTR(-ENOMEM); @@ -132,7 +132,7 @@ Signed-off-by: Christian Marangi if (IS_ERR(tzd)) { devres_free(ptr); return tzd; -@@ -593,6 +596,46 @@ struct thermal_zone_device *devm_thermal +@@ -592,6 +595,46 @@ struct thermal_zone_device *devm_thermal EXPORT_SYMBOL_GPL(devm_thermal_of_zone_register); /** diff --git a/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch b/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch index 8685508ddf6af7..395ec0797c15ca 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch @@ -17583,7 +17583,7 @@ Signed-off-by: Phil Elwell * For devices with more than one control interface, we assume the --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c -@@ -2195,6 +2195,8 @@ static const struct usb_audio_quirk_flag +@@ -2197,6 +2197,8 @@ static const struct usb_audio_quirk_flag QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x534d, 0x2109, /* MacroSilicon MS2109 */ QUIRK_FLAG_ALIGN_TRANSFER), diff --git a/target/linux/bcm27xx/patches-6.6/950-0535-i2c-designware-Add-SMBUS-quick-command-support.patch b/target/linux/bcm27xx/patches-6.6/950-0535-i2c-designware-Add-SMBUS-quick-command-support.patch index ed57365598ae6a..e588003e6e56e0 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0535-i2c-designware-Add-SMBUS-quick-command-support.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0535-i2c-designware-Add-SMBUS-quick-command-support.patch @@ -17,7 +17,7 @@ Signed-off-by: Phil Elwell --- a/drivers/i2c/busses/i2c-designware-core.h +++ b/drivers/i2c/busses/i2c-designware-core.h -@@ -123,7 +123,9 @@ +@@ -124,7 +124,9 @@ #define DW_IC_ERR_TX_ABRT 0x1 diff --git a/target/linux/bcm27xx/patches-6.6/950-0864-i2c-designware-Support-non-standard-bus-speeds.patch b/target/linux/bcm27xx/patches-6.6/950-0864-i2c-designware-Support-non-standard-bus-speeds.patch index 0e1cd5bf2a164d..90a64e8f2bbfb4 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0864-i2c-designware-Support-non-standard-bus-speeds.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0864-i2c-designware-Support-non-standard-bus-speeds.patch @@ -59,7 +59,7 @@ Signed-off-by: Phil Elwell --- a/drivers/i2c/busses/i2c-designware-core.h +++ b/drivers/i2c/busses/i2c-designware-core.h -@@ -292,6 +292,7 @@ struct dw_i2c_dev { +@@ -293,6 +293,7 @@ struct dw_i2c_dev { u16 fp_lcnt; u16 hs_hcnt; u16 hs_lcnt; diff --git a/target/linux/bcm27xx/patches-6.6/950-0998-i2c-designware-Add-support-for-bus-clear-feature.patch b/target/linux/bcm27xx/patches-6.6/950-0998-i2c-designware-Add-support-for-bus-clear-feature.patch index 5eb4bcc5d2a9de..691484d46e02c8 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0998-i2c-designware-Add-support-for-bus-clear-feature.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0998-i2c-designware-Add-support-for-bus-clear-feature.patch @@ -33,7 +33,7 @@ Signed-off-by: Phil Elwell }; static int dw_reg_read(void *context, unsigned int reg, unsigned int *val) -@@ -607,8 +609,16 @@ int i2c_dw_wait_bus_not_busy(struct dw_i +@@ -609,8 +611,16 @@ int i2c_dw_wait_bus_not_busy(struct dw_i int i2c_dw_handle_tx_abort(struct dw_i2c_dev *dev) { unsigned long abort_source = dev->abort_source; @@ -50,7 +50,7 @@ Signed-off-by: Phil Elwell if (abort_source & DW_IC_TX_ABRT_NOACK) { for_each_set_bit(i, &abort_source, ARRAY_SIZE(abort_sources)) dev_dbg(dev->dev, -@@ -623,6 +633,8 @@ int i2c_dw_handle_tx_abort(struct dw_i2c +@@ -625,6 +635,8 @@ int i2c_dw_handle_tx_abort(struct dw_i2c return -EAGAIN; else if (abort_source & DW_IC_TX_ABRT_GCALL_READ) return -EINVAL; /* wrong msgs[] data */ @@ -74,7 +74,7 @@ Signed-off-by: Phil Elwell #define DW_IC_COMP_TYPE 0xfc #define DW_IC_COMP_TYPE_VALUE 0x44570140 /* "DW" + 0x0140 */ -@@ -111,12 +114,14 @@ +@@ -111,6 +114,7 @@ #define DW_IC_ENABLE_ENABLE BIT(0) #define DW_IC_ENABLE_ABORT BIT(1) @@ -82,14 +82,15 @@ Signed-off-by: Phil Elwell #define DW_IC_STATUS_ACTIVITY BIT(0) #define DW_IC_STATUS_TFE BIT(2) - #define DW_IC_STATUS_RFNE BIT(3) +@@ -118,6 +122,7 @@ #define DW_IC_STATUS_MASTER_ACTIVITY BIT(5) #define DW_IC_STATUS_SLAVE_ACTIVITY BIT(6) + #define DW_IC_STATUS_MASTER_HOLD_TX_FIFO_EMPTY BIT(7) +#define DW_IC_STATUS_SDA_STUCK_NOT_RECOVERED BIT(11) #define DW_IC_SDA_HOLD_RX_SHIFT 16 #define DW_IC_SDA_HOLD_RX_MASK GENMASK(23, 16) -@@ -164,6 +169,7 @@ +@@ -165,6 +170,7 @@ #define ABRT_SLAVE_FLUSH_TXFIFO 13 #define ABRT_SLAVE_ARBLOST 14 #define ABRT_SLAVE_RD_INTX 15 @@ -97,7 +98,7 @@ Signed-off-by: Phil Elwell #define DW_IC_TX_ABRT_7B_ADDR_NOACK BIT(ABRT_7B_ADDR_NOACK) #define DW_IC_TX_ABRT_10ADDR1_NOACK BIT(ABRT_10ADDR1_NOACK) -@@ -179,6 +185,7 @@ +@@ -180,6 +186,7 @@ #define DW_IC_RX_ABRT_SLAVE_RD_INTX BIT(ABRT_SLAVE_RD_INTX) #define DW_IC_RX_ABRT_SLAVE_ARBLOST BIT(ABRT_SLAVE_ARBLOST) #define DW_IC_RX_ABRT_SLAVE_FLUSH_TXFIFO BIT(ABRT_SLAVE_FLUSH_TXFIFO) diff --git a/target/linux/generic/backport-6.6/771-v6.7-02-net-stmmac-move-TX-timer-arm-after-DMA-enable.patch b/target/linux/generic/backport-6.6/771-v6.7-02-net-stmmac-move-TX-timer-arm-after-DMA-enable.patch index 66a9251438a265..bd61343e0eed3a 100644 --- a/target/linux/generic/backport-6.6/771-v6.7-02-net-stmmac-move-TX-timer-arm-after-DMA-enable.patch +++ b/target/linux/generic/backport-6.6/771-v6.7-02-net-stmmac-move-TX-timer-arm-after-DMA-enable.patch @@ -42,7 +42,7 @@ Signed-off-by: Paolo Abeni u64_stats_update_begin(&txq_stats->napi_syncp); u64_stats_add(&txq_stats->napi.tx_packets, tx_packets); -@@ -5602,6 +5606,7 @@ static int stmmac_napi_poll_tx(struct na +@@ -5603,6 +5607,7 @@ static int stmmac_napi_poll_tx(struct na container_of(napi, struct stmmac_channel, tx_napi); struct stmmac_priv *priv = ch->priv_data; struct stmmac_txq_stats *txq_stats; @@ -50,7 +50,7 @@ Signed-off-by: Paolo Abeni u32 chan = ch->index; int work_done; -@@ -5610,7 +5615,7 @@ static int stmmac_napi_poll_tx(struct na +@@ -5611,7 +5616,7 @@ static int stmmac_napi_poll_tx(struct na u64_stats_inc(&txq_stats->napi.poll); u64_stats_update_end(&txq_stats->napi_syncp); @@ -59,7 +59,7 @@ Signed-off-by: Paolo Abeni work_done = min(work_done, budget); if (work_done < budget && napi_complete_done(napi, work_done)) { -@@ -5621,6 +5626,10 @@ static int stmmac_napi_poll_tx(struct na +@@ -5622,6 +5627,10 @@ static int stmmac_napi_poll_tx(struct na spin_unlock_irqrestore(&ch->lock, flags); } @@ -70,7 +70,7 @@ Signed-off-by: Paolo Abeni return work_done; } -@@ -5629,6 +5638,7 @@ static int stmmac_napi_poll_rxtx(struct +@@ -5630,6 +5639,7 @@ static int stmmac_napi_poll_rxtx(struct struct stmmac_channel *ch = container_of(napi, struct stmmac_channel, rxtx_napi); struct stmmac_priv *priv = ch->priv_data; @@ -78,7 +78,7 @@ Signed-off-by: Paolo Abeni int rx_done, tx_done, rxtx_done; struct stmmac_rxq_stats *rxq_stats; struct stmmac_txq_stats *txq_stats; -@@ -5644,7 +5654,7 @@ static int stmmac_napi_poll_rxtx(struct +@@ -5645,7 +5655,7 @@ static int stmmac_napi_poll_rxtx(struct u64_stats_inc(&txq_stats->napi.poll); u64_stats_update_end(&txq_stats->napi_syncp); @@ -87,7 +87,7 @@ Signed-off-by: Paolo Abeni tx_done = min(tx_done, budget); rx_done = stmmac_rx_zc(priv, budget, chan); -@@ -5669,6 +5679,10 @@ static int stmmac_napi_poll_rxtx(struct +@@ -5670,6 +5680,10 @@ static int stmmac_napi_poll_rxtx(struct spin_unlock_irqrestore(&ch->lock, flags); } diff --git a/target/linux/generic/hack-6.6/780-usb-net-MeigLink_modem_support.patch b/target/linux/generic/hack-6.6/780-usb-net-MeigLink_modem_support.patch index e80dfbeb0f3926..66c58dba64e42a 100644 --- a/target/linux/generic/hack-6.6/780-usb-net-MeigLink_modem_support.patch +++ b/target/linux/generic/hack-6.6/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 */ -@@ -1159,6 +1164,11 @@ static const struct usb_device_id option +@@ -1160,6 +1165,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), -@@ -1200,6 +1210,11 @@ static const struct usb_device_id option +@@ -1201,6 +1211,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-6.6/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch b/target/linux/generic/pending-6.6/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch index f27581d3e922b3..cfa3975c386bff 100644 --- a/target/linux/generic/pending-6.6/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch +++ b/target/linux/generic/pending-6.6/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 -@@ -8376,7 +8376,7 @@ static int nft_register_flowtable_net_ho +@@ -8377,7 +8377,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/mediatek/patches-6.6/901-arm-add-cmdline-override.patch b/target/linux/mediatek/patches-6.6/901-arm-add-cmdline-override.patch index 034826253df2a6..4f4fb9f23e42b6 100644 --- a/target/linux/mediatek/patches-6.6/901-arm-add-cmdline-override.patch +++ b/target/linux/mediatek/patches-6.6/901-arm-add-cmdline-override.patch @@ -37,7 +37,7 @@ * CONFIG_CMDLINE is meant to be a default in case nothing else --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig -@@ -2308,6 +2308,14 @@ config CMDLINE_FORCE +@@ -2309,6 +2309,14 @@ config CMDLINE_FORCE endchoice diff --git a/target/linux/rockchip/patches-6.6/009-v6.10-arm64-dts-rockchip-Add-Radxa-ROCK-3C.patch b/target/linux/rockchip/patches-6.6/009-v6.10-arm64-dts-rockchip-Add-Radxa-ROCK-3C.patch index 9901d9fff04d6b..164b65bdf5d876 100644 --- a/target/linux/rockchip/patches-6.6/009-v6.10-arm64-dts-rockchip-Add-Radxa-ROCK-3C.patch +++ b/target/linux/rockchip/patches-6.6/009-v6.10-arm64-dts-rockchip-Add-Radxa-ROCK-3C.patch @@ -30,7 +30,7 @@ Signed-off-by: Heiko Stuebner --- a/arch/arm64/boot/dts/rockchip/Makefile +++ b/arch/arm64/boot/dts/rockchip/Makefile -@@ -81,6 +81,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-qu +@@ -82,6 +82,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-qu dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-quartz64-b.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-radxa-cm3-io.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-roc-pc.dtb diff --git a/target/linux/rockchip/patches-6.6/011-v6.11-arm64-dts-rockchip-Add-Radxa-ZERO-3W-3E.patch b/target/linux/rockchip/patches-6.6/011-v6.11-arm64-dts-rockchip-Add-Radxa-ZERO-3W-3E.patch index 746078cf9e226f..19e6377ad1dab3 100644 --- a/target/linux/rockchip/patches-6.6/011-v6.11-arm64-dts-rockchip-Add-Radxa-ZERO-3W-3E.patch +++ b/target/linux/rockchip/patches-6.6/011-v6.11-arm64-dts-rockchip-Add-Radxa-ZERO-3W-3E.patch @@ -32,7 +32,7 @@ Signed-off-by: Heiko Stuebner --- a/arch/arm64/boot/dts/rockchip/Makefile +++ b/arch/arm64/boot/dts/rockchip/Makefile -@@ -80,6 +80,8 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-pi +@@ -81,6 +81,8 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-pi dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-quartz64-a.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-quartz64-b.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-radxa-cm3-io.dtb diff --git a/target/linux/rockchip/patches-6.6/014-v6.11-arm64-dts-rockchip-Add-Radxa-ROCK-3B.patch b/target/linux/rockchip/patches-6.6/014-v6.11-arm64-dts-rockchip-Add-Radxa-ROCK-3B.patch index e93a055c3ef0f0..4b2897f5249802 100644 --- a/target/linux/rockchip/patches-6.6/014-v6.11-arm64-dts-rockchip-Add-Radxa-ROCK-3B.patch +++ b/target/linux/rockchip/patches-6.6/014-v6.11-arm64-dts-rockchip-Add-Radxa-ROCK-3B.patch @@ -21,7 +21,7 @@ Signed-off-by: Heiko Stuebner --- a/arch/arm64/boot/dts/rockchip/Makefile +++ b/arch/arm64/boot/dts/rockchip/Makefile -@@ -100,6 +100,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-od +@@ -101,6 +101,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-od dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-radxa-e25.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-roc-pc.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-rock-3a.dtb diff --git a/target/linux/rockchip/patches-6.6/053-v6.9-arm64-dts-rockchip-Add-support-for-NanoPi-R6S.patch b/target/linux/rockchip/patches-6.6/053-v6.9-arm64-dts-rockchip-Add-support-for-NanoPi-R6S.patch index d0243023fc3089..f31f38ac9d9ce3 100644 --- a/target/linux/rockchip/patches-6.6/053-v6.9-arm64-dts-rockchip-Add-support-for-NanoPi-R6S.patch +++ b/target/linux/rockchip/patches-6.6/053-v6.9-arm64-dts-rockchip-Add-support-for-NanoPi-R6S.patch @@ -17,7 +17,7 @@ Signed-off-by: Heiko Stuebner --- a/arch/arm64/boot/dts/rockchip/Makefile +++ b/arch/arm64/boot/dts/rockchip/Makefile -@@ -108,4 +108,5 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-na +@@ -109,4 +109,5 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-na dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-rock-5b.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588s-indiedroid-nova.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588s-khadas-edge2.dtb diff --git a/target/linux/rockchip/patches-6.6/054-v6.9-arm64-dts-rockchip-Add-support-for-NanoPi-R6C.patch b/target/linux/rockchip/patches-6.6/054-v6.9-arm64-dts-rockchip-Add-support-for-NanoPi-R6C.patch index 7e2b083cf8d076..b63c01338fcc89 100644 --- a/target/linux/rockchip/patches-6.6/054-v6.9-arm64-dts-rockchip-Add-support-for-NanoPi-R6C.patch +++ b/target/linux/rockchip/patches-6.6/054-v6.9-arm64-dts-rockchip-Add-support-for-NanoPi-R6C.patch @@ -17,7 +17,7 @@ Signed-off-by: Heiko Stuebner --- a/arch/arm64/boot/dts/rockchip/Makefile +++ b/arch/arm64/boot/dts/rockchip/Makefile -@@ -109,4 +109,5 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-ro +@@ -110,4 +110,5 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-ro dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588s-indiedroid-nova.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588s-khadas-edge2.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588s-nanopi-r6s.dtb diff --git a/target/linux/rockchip/patches-6.6/056-01-v6.10-arm64-dts-rockchip-Add-ArmSom-Sige7-board.patch b/target/linux/rockchip/patches-6.6/056-01-v6.10-arm64-dts-rockchip-Add-ArmSom-Sige7-board.patch index bc1845b0d3c344..c60b9791094205 100644 --- a/target/linux/rockchip/patches-6.6/056-01-v6.10-arm64-dts-rockchip-Add-ArmSom-Sige7-board.patch +++ b/target/linux/rockchip/patches-6.6/056-01-v6.10-arm64-dts-rockchip-Add-ArmSom-Sige7-board.patch @@ -44,7 +44,7 @@ Signed-off-by: Heiko Stuebner --- a/arch/arm64/boot/dts/rockchip/Makefile +++ b/arch/arm64/boot/dts/rockchip/Makefile -@@ -101,6 +101,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-ra +@@ -102,6 +102,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-ra dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-roc-pc.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-rock-3a.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-rock-3b.dtb diff --git a/target/linux/rockchip/patches-6.6/127-arm64-dts-rockchip-rk3566-Add-Nanopi-R3S.patch b/target/linux/rockchip/patches-6.6/127-arm64-dts-rockchip-rk3566-Add-Nanopi-R3S.patch index ff2ad5bb9a8995..899c85e0d2bdce 100644 --- a/target/linux/rockchip/patches-6.6/127-arm64-dts-rockchip-rk3566-Add-Nanopi-R3S.patch +++ b/target/linux/rockchip/patches-6.6/127-arm64-dts-rockchip-rk3566-Add-Nanopi-R3S.patch @@ -557,7 +557,7 @@ +}; --- a/arch/arm64/boot/dts/rockchip/Makefile +++ b/arch/arm64/boot/dts/rockchip/Makefile -@@ -75,6 +75,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-an +@@ -76,6 +76,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-an dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-anbernic-rg353v.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-anbernic-rg353vs.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-anbernic-rg503.dtb diff --git a/target/linux/starfive/patches-6.6/1009-net-stmmac-use-GFP_DMA32.patch b/target/linux/starfive/patches-6.6/1009-net-stmmac-use-GFP_DMA32.patch index 25849e7c26d984..3191b1d9e328d9 100644 --- a/target/linux/starfive/patches-6.6/1009-net-stmmac-use-GFP_DMA32.patch +++ b/target/linux/starfive/patches-6.6/1009-net-stmmac-use-GFP_DMA32.patch @@ -19,7 +19,7 @@ Signed-off-by: Matteo Croce if (priv->dma_cap.host_dma_width <= 32) gfp |= GFP_DMA32; -@@ -4685,7 +4685,7 @@ static inline void stmmac_rx_refill(stru +@@ -4686,7 +4686,7 @@ static inline void stmmac_rx_refill(stru struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[queue]; int dirty = stmmac_rx_dirty(priv, queue); unsigned int entry = rx_q->dirty_rx; diff --git a/target/linux/sunxi/patches-6.6/017-v6.10-firmware-smccc-Export-revision-soc_id-function.patch b/target/linux/sunxi/patches-6.6/017-v6.10-firmware-smccc-Export-revision-soc_id-function.patch index 538484dd82b6e4..aacd0ba9067316 100644 --- a/target/linux/sunxi/patches-6.6/017-v6.10-firmware-smccc-Export-revision-soc_id-function.patch +++ b/target/linux/sunxi/patches-6.6/017-v6.10-firmware-smccc-Export-revision-soc_id-function.patch @@ -22,7 +22,7 @@ Signed-off-by: Viresh Kumar --- a/drivers/firmware/smccc/smccc.c +++ b/drivers/firmware/smccc/smccc.c -@@ -69,6 +69,7 @@ s32 arm_smccc_get_soc_id_revision(void) +@@ -65,6 +65,7 @@ s32 arm_smccc_get_soc_id_revision(void) { return smccc_soc_id_revision; } From d665be7c1e8c78d59a62431cd9cf65ef5dff99b3 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sun, 17 Nov 2024 19:30:35 +0800 Subject: [PATCH 049/877] ath79: lzma-loader: fix syntax error C compiler can't parse '#else if'. Fixes: f84a9f7dc095 ("ath79: add support for Huawei AP6010DN") Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/16989 (cherry picked from commit 98f26346cbbb45e5c0417f57846ce1783e884ea2) Link: https://github.com/openwrt/openwrt/pull/17055 Signed-off-by: Hauke Mehrtens --- target/linux/ath79/image/lzma-loader/src/board.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ath79/image/lzma-loader/src/board.c b/target/linux/ath79/image/lzma-loader/src/board.c index 14451085085ce1..294ca307d5d797 100644 --- a/target/linux/ath79/image/lzma-loader/src/board.c +++ b/target/linux/ath79/image/lzma-loader/src/board.c @@ -209,7 +209,7 @@ static inline void huawei_ap_init(void) #if defined(CONFIG_BOARD_HUAWEI_AP5030DN) WRITEREG(gpiobase + AR934X_GPIO_REG_OUT_FUNC3, reg | (QCA955X_GPIO_OUTSEL_CLK_OBS5 << 24)); -#else if defined(CONFIG_BOARD_HUAWEI_AP6010DN) +#elif defined(CONFIG_BOARD_HUAWEI_AP6010DN) WRITEREG(gpiobase + AR934X_GPIO_REG_OUT_FUNC3, reg | (AR934X_GPIO_OUTSEL_CLK_OBS4 << 24)); #endif From a2e7d8761bb752d113b0e6dd4bd19c61da4c3bda Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 16 Nov 2024 18:36:45 +0100 Subject: [PATCH 050/877] debugcc: Mark it nonshared This tool was build in the phase 2 build, there the TARGET dependencies are probably not meat. Mark it as non shared to build it together with the targets where this option is set. Link: https://github.com/openwrt/openwrt/pull/16975 Signed-off-by: Robert Marko (cherry picked from commit febe1db43d1a01f83e474bcb143dcb3997bd35a3) Link: https://github.com/openwrt/openwrt/pull/17055 Signed-off-by: Hauke Mehrtens --- package/utils/debugcc/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/package/utils/debugcc/Makefile b/package/utils/debugcc/Makefile index 3e26cea7e510c0..c3821cd8c6eb68 100644 --- a/package/utils/debugcc/Makefile +++ b/package/utils/debugcc/Makefile @@ -11,6 +11,7 @@ PKG_MIRROR_HASH:=4cd7a770a05db28f496a60eb9fe015a4af677bba05053b4d4be21adcf95e52e PKG_LICENSE:=BSD-3-Clause PKG_LICENSE_FILES:=LICENSE +PKG_FLAGS:=nonshared PKG_MAINTAINER:=Christian Marangi From 610652090d589f1118a8d40709cef0b338f874f0 Mon Sep 17 00:00:00 2001 From: John Audia Date: Sun, 17 Nov 2024 14:33:47 -0500 Subject: [PATCH 051/877] kernel: bump 6.6 to 6.6.62 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.62 All patches automatically rebased. Build system: x86/64 Build-tested: x86/64/AMD Cezanne, flogic/glinet_gl-mt6000, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Run-tested: x86/64/AMD Cezanne, flogic/glinet_gl-mt6000, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/16997 (cherry picked from commit 611bfa4d72c87e8163d7193d9557479fc7312467) Link: https://github.com/openwrt/openwrt/pull/17055 Signed-off-by: Hauke Mehrtens --- include/kernel-6.6 | 4 ++-- ...-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch | 2 +- ..._alloc-cma-introduce-a-customisable-threshold.patch | 2 +- ...-Allow-override-of-kernel-s-default-NUMA-poli.patch | 10 +++++----- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/kernel-6.6 b/include/kernel-6.6 index d870747f8362d5..dfb1e855f8de02 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .61 -LINUX_KERNEL_HASH-6.6.61 = 418fc24df9190f1c3ed9906dc3b7651c2a2eae5c1cb9ab4a6348e20faf047c0b +LINUX_VERSION-6.6 = .62 +LINUX_KERNEL_HASH-6.6.62 = e2c35611775534941b9d4dd871f3ae5b988b6594dc9033b5ca784366e07d9336 diff --git a/target/linux/bcm27xx/patches-6.6/950-0169-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch b/target/linux/bcm27xx/patches-6.6/950-0169-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch index 5301066196f53b..6e9ca2261bb087 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0169-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0169-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 -@@ -1404,6 +1407,9 @@ +@@ -1405,6 +1408,9 @@ #define USB_VENDOR_ID_XIAOMI 0x2717 #define USB_DEVICE_ID_MI_SILENT_MOUSE 0x5014 diff --git a/target/linux/bcm27xx/patches-6.6/950-0359-mm-page_alloc-cma-introduce-a-customisable-threshold.patch b/target/linux/bcm27xx/patches-6.6/950-0359-mm-page_alloc-cma-introduce-a-customisable-threshold.patch index 8c39ae9931e8ba..f8baf9befc5b0f 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0359-mm-page_alloc-cma-introduce-a-customisable-threshold.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0359-mm-page_alloc-cma-introduce-a-customisable-threshold.patch @@ -48,7 +48,7 @@ Signed-off-by: David Plowman /* * A cached value of the page's pageblock's migratetype, used when the page is * put on a pcplist. Used to avoid the pageblock migratetype lookup when -@@ -2095,12 +2116,13 @@ __rmqueue(struct zone *zone, unsigned in +@@ -2094,12 +2115,13 @@ __rmqueue(struct zone *zone, unsigned in if (IS_ENABLED(CONFIG_CMA)) { /* * Balance movable allocations between regular and CMA areas by diff --git a/target/linux/bcm27xx/patches-6.6/950-1340-mm-numa-Allow-override-of-kernel-s-default-NUMA-poli.patch b/target/linux/bcm27xx/patches-6.6/950-1340-mm-numa-Allow-override-of-kernel-s-default-NUMA-poli.patch index f0de0ce9d59b1e..dceb6df45f86da 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1340-mm-numa-Allow-override-of-kernel-s-default-NUMA-poli.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1340-mm-numa-Allow-override-of-kernel-s-default-NUMA-poli.patch @@ -23,7 +23,7 @@ Signed-off-by: Tvrtko Ursulin --- a/mm/mempolicy.c +++ b/mm/mempolicy.c -@@ -2974,7 +2974,9 @@ void __init numa_policy_init(void) +@@ -2963,7 +2963,9 @@ void __init numa_policy_init(void) /* Reset policy of current process to default */ void numa_default_policy(void) { @@ -34,7 +34,7 @@ Signed-off-by: Tvrtko Ursulin } /* -@@ -2992,7 +2994,6 @@ static const char * const policy_modes[] +@@ -2981,7 +2983,6 @@ static const char * const policy_modes[] }; @@ -42,7 +42,7 @@ Signed-off-by: Tvrtko Ursulin /** * mpol_parse_str - parse string to mempolicy, for tmpfs mpol mount option. * @str: string containing mempolicy to parse -@@ -3005,13 +3006,18 @@ static const char * const policy_modes[] +@@ -2994,13 +2995,18 @@ static const char * const policy_modes[] */ int mpol_parse_str(char *str, struct mempolicy **mpol) { @@ -62,7 +62,7 @@ Signed-off-by: Tvrtko Ursulin if (flags) *flags++ = '\0'; /* terminate mode string */ -@@ -3090,9 +3096,16 @@ int mpol_parse_str(char *str, struct mem +@@ -3079,9 +3085,16 @@ int mpol_parse_str(char *str, struct mem goto out; } @@ -82,7 +82,7 @@ Signed-off-by: Tvrtko Ursulin /* * Save nodes for mpol_to_str() to show the tmpfs mount options -@@ -3125,7 +3138,29 @@ out: +@@ -3114,7 +3127,29 @@ out: *mpol = new; return err; } From 7402e7dd866125fd7391831fe58163fbab28b38d Mon Sep 17 00:00:00 2001 From: John Audia Date: Fri, 22 Nov 2024 10:53:37 -0500 Subject: [PATCH 052/877] kernel: bump 6.6 to 6.6.63 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.63 Manually rebased: bcm27xx/patches-6.6/950-0297-staging-vchiq_arm-Add-36-bit-address-support.patch All other patches automatically rebased. Build system: x86/64 Build-tested: x86/64/AMD Cezanne, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Run-tested: x86/64/AMD Cezanne, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/16997 (cherry picked from commit eb395585ae1b7560bbcea9544f428db2a9105152) Link: https://github.com/openwrt/openwrt/pull/17055 Signed-off-by: Hauke Mehrtens --- include/kernel-6.6 | 4 +-- .../900-unaligned_access_hacks.patch | 4 +-- ...m-Register-vcsm-cma-as-a-platform-dr.patch | 4 +-- ...m-Register-bcm2835-codec-as-a-platfo.patch | 4 +-- ...m-Set-up-dma-ranges-on-child-devices.patch | 2 +- ...e-the-old-dma-controller-for-OF-conf.patch | 4 +-- ...hiq_arm-Give-vchiq-children-DT-nodes.patch | 2 +- ...q-Load-bcm2835_isp-driver-from-vchiq.patch | 4 +-- ...vchiq_arm-Add-36-bit-address-support.patch | 30 +++++++++---------- ...chiq_arm-children-inherit-DMA-config.patch | 2 +- ...q_arm-Usa-a-DMA-pool-for-small-bulks.patch | 14 ++++----- 11 files changed, 37 insertions(+), 37 deletions(-) diff --git a/include/kernel-6.6 b/include/kernel-6.6 index dfb1e855f8de02..0cfe052e651ad1 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .62 -LINUX_KERNEL_HASH-6.6.62 = e2c35611775534941b9d4dd871f3ae5b988b6594dc9033b5ca784366e07d9336 +LINUX_VERSION-6.6 = .63 +LINUX_KERNEL_HASH-6.6.63 = d1054ab4803413efe2850f50f1a84349c091631ec50a1cf9e891d1b1f9061835 diff --git a/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch b/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch index c5b01b7daddfc4..dd57c53a18101a 100644 --- a/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch @@ -557,7 +557,7 @@ SVN-Revision: 35130 static inline struct neighbour *__ipv6_neigh_lookup_noref(struct net_device *dev, const void *pkey) --- a/net/sched/cls_u32.c +++ b/net/sched/cls_u32.c -@@ -157,7 +157,7 @@ next_knode: +@@ -167,7 +167,7 @@ next_knode: data = skb_header_pointer(skb, toff, 4, &hdata); if (!data) goto out; @@ -566,7 +566,7 @@ SVN-Revision: 35130 n = rcu_dereference_bh(n->next); goto next_knode; } -@@ -208,8 +208,8 @@ check_terminal: +@@ -218,8 +218,8 @@ check_terminal: &hdata); if (!data) goto out; diff --git a/target/linux/bcm27xx/patches-6.6/950-0184-staging-vchiq_arm-Register-vcsm-cma-as-a-platform-dr.patch b/target/linux/bcm27xx/patches-6.6/950-0184-staging-vchiq_arm-Register-vcsm-cma-as-a-platform-dr.patch index 102931650446f4..741d377fc8d3be 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0184-staging-vchiq_arm-Register-vcsm-cma-as-a-platform-dr.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0184-staging-vchiq_arm-Register-vcsm-cma-as-a-platform-dr.patch @@ -22,7 +22,7 @@ Signed-off-by: Dave Stevenson struct vchiq_drvdata { const unsigned int cache_line_size; -@@ -1838,6 +1839,7 @@ static int vchiq_probe(struct platform_d +@@ -1825,6 +1826,7 @@ static int vchiq_probe(struct platform_d goto error_exit; } @@ -30,7 +30,7 @@ Signed-off-by: Dave Stevenson bcm2835_camera = vchiq_register_child(pdev, "bcm2835-camera"); bcm2835_audio = vchiq_register_child(pdev, "bcm2835_audio"); -@@ -1853,6 +1855,7 @@ static void vchiq_remove(struct platform +@@ -1840,6 +1842,7 @@ static void vchiq_remove(struct platform { platform_device_unregister(bcm2835_audio); platform_device_unregister(bcm2835_camera); diff --git a/target/linux/bcm27xx/patches-6.6/950-0185-staging-vchiq_arm-Register-bcm2835-codec-as-a-platfo.patch b/target/linux/bcm27xx/patches-6.6/950-0185-staging-vchiq_arm-Register-bcm2835-codec-as-a-platfo.patch index ab4fb514d6dd28..5a3c91b7800471 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0185-staging-vchiq_arm-Register-bcm2835-codec-as-a-platfo.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0185-staging-vchiq_arm-Register-bcm2835-codec-as-a-platfo.patch @@ -22,7 +22,7 @@ Signed-off-by: Dave Stevenson static struct platform_device *vcsm_cma; struct vchiq_drvdata { -@@ -1840,6 +1841,7 @@ static int vchiq_probe(struct platform_d +@@ -1827,6 +1828,7 @@ static int vchiq_probe(struct platform_d } vcsm_cma = vchiq_register_child(pdev, "vcsm-cma"); @@ -30,7 +30,7 @@ Signed-off-by: Dave Stevenson bcm2835_camera = vchiq_register_child(pdev, "bcm2835-camera"); bcm2835_audio = vchiq_register_child(pdev, "bcm2835_audio"); -@@ -1855,6 +1857,7 @@ static void vchiq_remove(struct platform +@@ -1842,6 +1844,7 @@ static void vchiq_remove(struct platform { platform_device_unregister(bcm2835_audio); platform_device_unregister(bcm2835_camera); diff --git a/target/linux/bcm27xx/patches-6.6/950-0190-staging-vchiq_arm-Set-up-dma-ranges-on-child-devices.patch b/target/linux/bcm27xx/patches-6.6/950-0190-staging-vchiq_arm-Set-up-dma-ranges-on-child-devices.patch index b008f909468268..3abc4f19bf77fb 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0190-staging-vchiq_arm-Set-up-dma-ranges-on-child-devices.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0190-staging-vchiq_arm-Set-up-dma-ranges-on-child-devices.patch @@ -18,7 +18,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -@@ -1790,6 +1790,12 @@ vchiq_register_child(struct platform_dev +@@ -1777,6 +1777,12 @@ vchiq_register_child(struct platform_dev child = NULL; } diff --git a/target/linux/bcm27xx/patches-6.6/950-0191-staging-vchiq-Use-the-old-dma-controller-for-OF-conf.patch b/target/linux/bcm27xx/patches-6.6/950-0191-staging-vchiq-Use-the-old-dma-controller-for-OF-conf.patch index 85d1174a60e553..e5c5fdbc0b775a 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0191-staging-vchiq-Use-the-old-dma-controller-for-OF-conf.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0191-staging-vchiq-Use-the-old-dma-controller-for-OF-conf.patch @@ -17,7 +17,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -@@ -1776,6 +1776,7 @@ vchiq_register_child(struct platform_dev +@@ -1763,6 +1763,7 @@ vchiq_register_child(struct platform_dev { struct platform_device_info pdevinfo; struct platform_device *child; @@ -25,7 +25,7 @@ Signed-off-by: Dave Stevenson memset(&pdevinfo, 0, sizeof(pdevinfo)); -@@ -1791,10 +1792,20 @@ vchiq_register_child(struct platform_dev +@@ -1778,10 +1779,20 @@ vchiq_register_child(struct platform_dev } /* diff --git a/target/linux/bcm27xx/patches-6.6/950-0194-staging-vchiq_arm-Give-vchiq-children-DT-nodes.patch b/target/linux/bcm27xx/patches-6.6/950-0194-staging-vchiq_arm-Give-vchiq-children-DT-nodes.patch index eab0710367f632..9dba2dffca16a1 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0194-staging-vchiq_arm-Give-vchiq-children-DT-nodes.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0194-staging-vchiq_arm-Give-vchiq-children-DT-nodes.patch @@ -16,7 +16,7 @@ Signed-off-by: Phil Elwell --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -@@ -1785,12 +1785,20 @@ vchiq_register_child(struct platform_dev +@@ -1772,12 +1772,20 @@ vchiq_register_child(struct platform_dev pdevinfo.id = PLATFORM_DEVID_NONE; pdevinfo.dma_mask = DMA_BIT_MASK(32); diff --git a/target/linux/bcm27xx/patches-6.6/950-0209-staging-vchiq-Load-bcm2835_isp-driver-from-vchiq.patch b/target/linux/bcm27xx/patches-6.6/950-0209-staging-vchiq-Load-bcm2835_isp-driver-from-vchiq.patch index a33b39967f857f..b5f912c85b0aad 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0209-staging-vchiq-Load-bcm2835_isp-driver-from-vchiq.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0209-staging-vchiq-Load-bcm2835_isp-driver-from-vchiq.patch @@ -21,7 +21,7 @@ Signed-off-by: Naushir Patuck struct vchiq_drvdata { const unsigned int cache_line_size; -@@ -1869,6 +1870,7 @@ static int vchiq_probe(struct platform_d +@@ -1856,6 +1857,7 @@ static int vchiq_probe(struct platform_d bcm2835_codec = vchiq_register_child(pdev, "bcm2835-codec"); bcm2835_camera = vchiq_register_child(pdev, "bcm2835-camera"); bcm2835_audio = vchiq_register_child(pdev, "bcm2835_audio"); @@ -29,7 +29,7 @@ Signed-off-by: Naushir Patuck return 0; -@@ -1880,6 +1882,7 @@ error_exit: +@@ -1867,6 +1869,7 @@ error_exit: static void vchiq_remove(struct platform_device *pdev) { diff --git a/target/linux/bcm27xx/patches-6.6/950-0297-staging-vchiq_arm-Add-36-bit-address-support.patch b/target/linux/bcm27xx/patches-6.6/950-0297-staging-vchiq_arm-Add-36-bit-address-support.patch index 0c1ee62fab2670..11147d9fd9615a 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0297-staging-vchiq_arm-Add-36-bit-address-support.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0297-staging-vchiq_arm-Add-36-bit-address-support.patch @@ -36,10 +36,10 @@ Signed-off-by: Phil Elwell + .use_36bit_addrs = true, +}; + - struct vchiq_2835_state { - int inited; - struct vchiq_arm_state arm_state; -@@ -147,10 +153,12 @@ static void __iomem *g_regs; + struct vchiq_pagelist_info { + struct pagelist *pagelist; + size_t pagelist_buffer_size; +@@ -142,10 +148,12 @@ static void __iomem *g_regs; * of 32. */ static unsigned int g_cache_line_size = 32; @@ -52,7 +52,7 @@ Signed-off-by: Phil Elwell static DEFINE_SEMAPHORE(g_free_fragments_mutex, 1); -@@ -180,7 +188,7 @@ static void +@@ -175,7 +183,7 @@ static void cleanup_pagelistinfo(struct vchiq_instance *instance, struct vchiq_pagelist_info *pagelistinfo) { if (pagelistinfo->scatterlist_mapped) { @@ -61,7 +61,7 @@ Signed-off-by: Phil Elwell pagelistinfo->num_pages, pagelistinfo->dma_dir); } -@@ -340,7 +348,7 @@ create_pagelist(struct vchiq_instance *i +@@ -335,7 +343,7 @@ create_pagelist(struct vchiq_instance *i count -= len; } @@ -70,7 +70,7 @@ Signed-off-by: Phil Elwell scatterlist, num_pages, pagelistinfo->dma_dir); -@@ -354,22 +362,61 @@ create_pagelist(struct vchiq_instance *i +@@ -349,22 +357,61 @@ create_pagelist(struct vchiq_instance *i /* Combine adjacent blocks for performance */ k = 0; @@ -148,7 +148,7 @@ Signed-off-by: Phil Elwell } /* Partial cache lines (fragments) require special measures */ -@@ -413,7 +460,7 @@ free_pagelist(struct vchiq_instance *ins +@@ -408,7 +455,7 @@ free_pagelist(struct vchiq_instance *ins * NOTE: dma_unmap_sg must be called before the * cpu can touch any of the data/pages. */ @@ -157,7 +157,7 @@ Signed-off-by: Phil Elwell pagelistinfo->num_pages, pagelistinfo->dma_dir); pagelistinfo->scatterlist_mapped = 0; -@@ -468,6 +515,7 @@ free_pagelist(struct vchiq_instance *ins +@@ -463,6 +510,7 @@ free_pagelist(struct vchiq_instance *ins static int vchiq_platform_init(struct platform_device *pdev, struct vchiq_state *state) { struct device *dev = &pdev->dev; @@ -165,7 +165,7 @@ Signed-off-by: Phil Elwell struct vchiq_drvdata *drvdata = platform_get_drvdata(pdev); struct rpi_firmware *fw = drvdata->fw; struct vchiq_slot_zero *vchiq_slot_zero; -@@ -489,6 +537,24 @@ static int vchiq_platform_init(struct pl +@@ -484,6 +532,24 @@ static int vchiq_platform_init(struct pl g_cache_line_size = drvdata->cache_line_size; g_fragments_size = 2 * g_cache_line_size; @@ -190,7 +190,7 @@ Signed-off-by: Phil Elwell /* Allocate space for the channels in coherent memory */ slot_mem_size = PAGE_ALIGN(TOTAL_SLOTS * VCHIQ_SLOT_SIZE); frag_mem_size = PAGE_ALIGN(g_fragments_size * MAX_FRAGMENTS); -@@ -501,13 +567,14 @@ static int vchiq_platform_init(struct pl +@@ -496,13 +562,14 @@ static int vchiq_platform_init(struct pl } WARN_ON(((unsigned long)slot_mem & (PAGE_SIZE - 1)) != 0); @@ -206,7 +206,7 @@ Signed-off-by: Phil Elwell vchiq_slot_zero->platform_data[VCHIQ_PLATFORM_FRAGMENTS_COUNT_IDX] = MAX_FRAGMENTS; -@@ -541,7 +608,6 @@ static int vchiq_platform_init(struct pl +@@ -536,7 +603,6 @@ static int vchiq_platform_init(struct pl } /* Send the base address of the slots to VideoCore */ @@ -214,7 +214,7 @@ Signed-off-by: Phil Elwell err = rpi_firmware_property(fw, RPI_FIRMWARE_VCHIQ_INIT, &channelbase, sizeof(channelbase)); if (err) { -@@ -555,6 +621,8 @@ static int vchiq_platform_init(struct pl +@@ -550,6 +616,8 @@ static int vchiq_platform_init(struct pl return -ENXIO; } @@ -223,7 +223,7 @@ Signed-off-by: Phil Elwell vchiq_log_info(vchiq_arm_log_level, "vchiq_init - done (slots %pK, phys %pad)", vchiq_slot_zero, &slot_phys); -@@ -1768,6 +1836,7 @@ void vchiq_platform_conn_state_changed(s +@@ -1755,6 +1823,7 @@ void vchiq_platform_conn_state_changed(s static const struct of_device_id vchiq_of_match[] = { { .compatible = "brcm,bcm2835-vchiq", .data = &bcm2835_drvdata }, { .compatible = "brcm,bcm2836-vchiq", .data = &bcm2836_drvdata }, @@ -231,7 +231,7 @@ Signed-off-by: Phil Elwell {}, }; MODULE_DEVICE_TABLE(of, vchiq_of_match); -@@ -1800,22 +1869,8 @@ vchiq_register_child(struct platform_dev +@@ -1787,22 +1856,8 @@ vchiq_register_child(struct platform_dev child->dev.of_node = np; diff --git a/target/linux/bcm27xx/patches-6.6/950-0298-staging-vchiq_arm-children-inherit-DMA-config.patch b/target/linux/bcm27xx/patches-6.6/950-0298-staging-vchiq_arm-children-inherit-DMA-config.patch index b6fb2e9eda2f55..87bea65fc76523 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0298-staging-vchiq_arm-children-inherit-DMA-config.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0298-staging-vchiq_arm-children-inherit-DMA-config.patch @@ -15,7 +15,7 @@ Signed-off-by: Phil Elwell --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -@@ -1869,8 +1869,18 @@ vchiq_register_child(struct platform_dev +@@ -1856,8 +1856,18 @@ vchiq_register_child(struct platform_dev child->dev.of_node = np; diff --git a/target/linux/bcm27xx/patches-6.6/950-0299-staging-vchiq_arm-Usa-a-DMA-pool-for-small-bulks.patch b/target/linux/bcm27xx/patches-6.6/950-0299-staging-vchiq_arm-Usa-a-DMA-pool-for-small-bulks.patch index bcd9dae853d5ab..162d333c6127e8 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0299-staging-vchiq_arm-Usa-a-DMA-pool-for-small-bulks.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0299-staging-vchiq_arm-Usa-a-DMA-pool-for-small-bulks.patch @@ -37,7 +37,7 @@ Signed-off-by: Oliver Gjoneski /* Override the default prefix, which would be vchiq_arm (from the filename) */ #undef MODULE_PARAM_PREFIX #define MODULE_PARAM_PREFIX DEVICE_NAME "." -@@ -133,6 +136,7 @@ struct vchiq_pagelist_info { +@@ -128,6 +131,7 @@ struct vchiq_pagelist_info { struct pagelist *pagelist; size_t pagelist_buffer_size; dma_addr_t dma_addr; @@ -45,7 +45,7 @@ Signed-off-by: Oliver Gjoneski enum dma_data_direction dma_dir; unsigned int num_pages; unsigned int pages_need_release; -@@ -153,6 +157,7 @@ static void __iomem *g_regs; +@@ -148,6 +152,7 @@ static void __iomem *g_regs; * of 32. */ static unsigned int g_cache_line_size = 32; @@ -53,7 +53,7 @@ Signed-off-by: Oliver Gjoneski static unsigned int g_use_36bit_addrs = 0; static unsigned int g_fragments_size; static char *g_fragments_base; -@@ -195,8 +200,13 @@ cleanup_pagelistinfo(struct vchiq_instan +@@ -190,8 +195,13 @@ cleanup_pagelistinfo(struct vchiq_instan if (pagelistinfo->pages_need_release) unpin_user_pages(pagelistinfo->pages, pagelistinfo->num_pages); @@ -69,7 +69,7 @@ Signed-off-by: Oliver Gjoneski } static inline bool -@@ -231,6 +241,7 @@ create_pagelist(struct vchiq_instance *i +@@ -226,6 +236,7 @@ create_pagelist(struct vchiq_instance *i u32 *addrs; unsigned int num_pages, offset, i, k; int actual_pages; @@ -77,7 +77,7 @@ Signed-off-by: Oliver Gjoneski size_t pagelist_size; struct scatterlist *scatterlist, *sg; int dma_buffers; -@@ -260,8 +271,14 @@ create_pagelist(struct vchiq_instance *i +@@ -255,8 +266,14 @@ create_pagelist(struct vchiq_instance *i /* Allocate enough storage to hold the page pointers and the page * list */ @@ -94,7 +94,7 @@ Signed-off-by: Oliver Gjoneski vchiq_log_trace(vchiq_arm_log_level, "%s - %pK", __func__, pagelist); -@@ -282,6 +299,7 @@ create_pagelist(struct vchiq_instance *i +@@ -277,6 +294,7 @@ create_pagelist(struct vchiq_instance *i pagelistinfo->pagelist = pagelist; pagelistinfo->pagelist_buffer_size = pagelist_size; pagelistinfo->dma_addr = dma_addr; @@ -102,7 +102,7 @@ Signed-off-by: Oliver Gjoneski pagelistinfo->dma_dir = (type == PAGELIST_WRITE) ? DMA_TO_DEVICE : DMA_FROM_DEVICE; pagelistinfo->num_pages = num_pages; -@@ -622,6 +640,13 @@ static int vchiq_platform_init(struct pl +@@ -617,6 +635,13 @@ static int vchiq_platform_init(struct pl } g_dma_dev = dma_dev ?: dev; From a5b291116b282e9bad6ba289acb7af22c482ed0a Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 23 Nov 2024 00:34:30 +0100 Subject: [PATCH 053/877] wifi-scripts: Fix parsing of Capabilities Fixup capabilities parsing in iw output. In addition to the normal capabilities iw now also outputs HE MAC, HE PHY and EHT MAC and EHT PHY capabilities. Exclude them in the parsing. The grep returns this with mac80211-hwsim: ``` root@OpenWrt:~# iw phy phy0 info | grep 'Capabilities:' Capabilities: 0x107e HE PHY Capabilities: (0x02bfce0000000000000000): EHT PHY Capabilities: (0x7c0000feffff7f01): HE PHY Capabilities: (0x02bfce0000000000000000): EHT PHY Capabilities: (0x7c0000feffff7f01): HE PHY Capabilities: (0x02bf000000000000000000): Capabilities: 0x107e HE PHY Capabilities: (0x1cbfce0000000000000000): EHT PHY Capabilities: (0xfc1f3ffeffff7f37): HE PHY Capabilities: (0x1cbfce0000000000000000): EHT PHY Capabilities: (0xfc1f3ffeffff7f37): HE PHY Capabilities: (0x1cbf000000000000000000): HE PHY Capabilities: (0x1cbfce0000000000000000): EHT PHY Capabilities: (0xfefffffeffffff7f): HE PHY Capabilities: (0x1cbfce0000000000000000): EHT PHY Capabilities: (0xfefffffeffffff7f): HE PHY Capabilities: (0x1cbf000000000000000000): Capabilities: 0x107e ``` With busybox 1.36.1 the ht_cap_mask variable will be set to -72057598332895361. With busybox 1.37.0 it will be set to -1. Both values are wrong, after this change it will be set to 4222 (0x107E). Link: https://github.com/openwrt/openwrt/pull/17043 (cherry picked from commit adf958c9192d94fbeeb0ec8e16800b0071455909) Link: https://github.com/openwrt/openwrt/pull/17055 Signed-off-by: Hauke Mehrtens --- .../config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh index 9998e26ec13189..3d953eff74d2fa 100755 --- a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh +++ b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh @@ -208,7 +208,7 @@ mac80211_hostapd_setup_base() { dsss_cck_40:1 ht_cap_mask=0 - for cap in $(iw phy "$phy" info | grep 'Capabilities:' | cut -d: -f2); do + for cap in $(iw phy "$phy" info | grep -E '^\s*Capabilities:' | cut -d: -f2); do ht_cap_mask="$(($ht_cap_mask | $cap))" done From 141ccfd5483d115beb8e81ff94b871f8516c3a18 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Sun, 24 Nov 2024 21:15:08 +0100 Subject: [PATCH 054/877] ramips: mt7621: support openwrt,netdev-name for renaming interfaces Edgerouter X currently has its eth1 port on the switch missing since there is a naming conflict currently. So, as the root cause is mixing kernel support for DSA interfaces having predictable names set via "label" property vs others having it assigned dynamically lets avoid the conflict by using our own custom property as suggested upstream [1]. So, add support via "openwrt,netdev-name" property and use it on ERX. Fixes: 2a25c6ace8d8 ("ramips: get rid of downstream network device label patch") Fixes: #15643 Link: https://github.com/openwrt/openwrt/pull/17062 Signed-off-by: Robert Marko (cherry picked from commit 5695267847c2fe51290fdbde6ecd7114654f7988) --- .../ramips/dts/mt7621_ubnt_edgerouter-x-sfp.dts | 3 ++- .../ramips/dts/mt7621_ubnt_edgerouter-x.dts | 2 +- .../ramips/dts/mt7621_ubnt_edgerouter-x.dtsi | 17 +++++++++++------ .../base-files/lib/preinit/04_set_netdev_label | 8 ++++++++ 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_ubnt_edgerouter-x-sfp.dts b/target/linux/ramips/dts/mt7621_ubnt_edgerouter-x-sfp.dts index 50a77c3877a055..9f1e0a8d20c675 100644 --- a/target/linux/ramips/dts/mt7621_ubnt_edgerouter-x-sfp.dts +++ b/target/linux/ramips/dts/mt7621_ubnt_edgerouter-x-sfp.dts @@ -69,11 +69,12 @@ ports { port@5 { reg = <5>; - label = "eth5"; + openwrt,netdev-name = "eth5"; phy-handle = <&ephy7>; phy-mode = "rgmii-rxid"; nvmem-cells = <&macaddr_factory_22 5>; nvmem-cell-names = "mac-address"; + /delete-property/ label; }; }; }; diff --git a/target/linux/ramips/dts/mt7621_ubnt_edgerouter-x.dts b/target/linux/ramips/dts/mt7621_ubnt_edgerouter-x.dts index 80467c88e98343..c0230e13b42393 100644 --- a/target/linux/ramips/dts/mt7621_ubnt_edgerouter-x.dts +++ b/target/linux/ramips/dts/mt7621_ubnt_edgerouter-x.dts @@ -7,7 +7,7 @@ &gmac1 { status = "okay"; - label = "eth0"; + openwrt,netdev-name = "eth0"; phy-handle = <ðphy0>; nvmem-cells = <&macaddr_factory_22 0>; diff --git a/target/linux/ramips/dts/mt7621_ubnt_edgerouter-x.dtsi b/target/linux/ramips/dts/mt7621_ubnt_edgerouter-x.dtsi index 0902ad56b961ff..7648e4298268bb 100644 --- a/target/linux/ramips/dts/mt7621_ubnt_edgerouter-x.dtsi +++ b/target/linux/ramips/dts/mt7621_ubnt_edgerouter-x.dtsi @@ -22,42 +22,47 @@ &gmac0 { nvmem-cells = <&macaddr_factory_22 0>; nvmem-cell-names = "mac-address"; - label = "dsa"; + openwrt,netdev-name = "dsa"; }; &switch0 { ports { port@0 { status = "okay"; - label = "eth0"; + openwrt,netdev-name = "eth0"; + /delete-property/ label; }; port@1 { status = "okay"; - label = "eth1"; + openwrt,netdev-name = "eth1"; nvmem-cells = <&macaddr_factory_22 1>; nvmem-cell-names = "mac-address"; + /delete-property/ label; }; port@2 { status = "okay"; - label = "eth2"; + openwrt,netdev-name = "eth2"; nvmem-cells = <&macaddr_factory_22 2>; nvmem-cell-names = "mac-address"; + /delete-property/ label; }; port@3 { status = "okay"; - label = "eth3"; + openwrt,netdev-name = "eth3"; nvmem-cells = <&macaddr_factory_22 3>; nvmem-cell-names = "mac-address"; + /delete-property/ label; }; port@4 { status = "okay"; - label = "eth4"; + openwrt,netdev-name = "eth4"; nvmem-cells = <&macaddr_factory_22 4>; nvmem-cell-names = "mac-address"; + /delete-property/ label; }; }; }; diff --git a/target/linux/ramips/mt7621/base-files/lib/preinit/04_set_netdev_label b/target/linux/ramips/mt7621/base-files/lib/preinit/04_set_netdev_label index 110e023b962d3d..2c5e420f93bd17 100644 --- a/target/linux/ramips/mt7621/base-files/lib/preinit/04_set_netdev_label +++ b/target/linux/ramips/mt7621/base-files/lib/preinit/04_set_netdev_label @@ -10,6 +10,14 @@ set_netdev_labels() { [ "$netdev" = "$label" ] && continue ip link set "$netdev" name "$label" done + + for dir in /sys/class/net/*; do + [ -r "$dir/of_node/openwrt,netdev-name" ] || continue + read -r label < "$dir/of_node/openwrt,netdev-name" + netdev="${dir##*/}" + [ "$netdev" = "$label" ] && continue + ip link set "$netdev" name "$label" + done } boot_hook_add preinit_main set_netdev_labels From 79dafe4ad1be6619fa8a13d7db02f7ba43f51853 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sat, 2 Nov 2024 20:22:35 +0000 Subject: [PATCH 055/877] kernel: modules: package driver for generic MIPI DBI TFT panels Package kmod-drm-panel-mipi-dbi as well as modules it depends on in order to support a wide range of MIPI DBI complaint SPI-connected TFT panels. See https://github.com/notro/panel-mipi-dbi/ for more information on how to use specific panels. Signed-off-by: Daniel Golle (cherry picked from commit 0a7b7ef27cfc00521a0f99de073a7168f1b79e8f) --- package/kernel/linux/modules/video.mk | 50 +++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/package/kernel/linux/modules/video.mk b/package/kernel/linux/modules/video.mk index 52fc55bbadd07b..8b4585a624e604 100644 --- a/package/kernel/linux/modules/video.mk +++ b/package/kernel/linux/modules/video.mk @@ -311,6 +311,38 @@ endef $(eval $(call KernelPackage,drm-exec)) +define KernelPackage/drm-dma-helper + SUBMENU:=$(VIDEO_MENU) + HIDDEN:=1 + TITLE:=GEM DMA helper functions + DEPENDS:=@DISPLAY_SUPPORT +kmod-drm-kms-helper + KCONFIG:=CONFIG_DRM_GEM_DMA_HELPER + FILES:=$(LINUX_DIR)/drivers/gpu/drm/drm_dma_helper.ko + AUTOLOAD:=$(call AutoProbe,drm_dma_helper) +endef + +define KernelPackage/drm-dma-helper/description + GEM DMA helper functions. +endef + +$(eval $(call KernelPackage,drm-dma-helper)) + +define KernelPackage/drm-mipi-dbi + SUBMENU:=$(VIDEO_MENU) + HIDDEN:=1 + TITLE:=MIPI DBI helpers + DEPENDS:=@DISPLAY_SUPPORT +kmod-backlight +kmod-drm-kms-helper + KCONFIG:=CONFIG_DRM_MIPI_DBI + FILES:=$(LINUX_DIR)/drivers/gpu/drm/drm_mipi_dbi.ko + AUTOLOAD:=$(call AutoProbe,drm_mipi_dbi) +endef + +define KernelPackage/drm-mipi-dbi/description + MIPI Display Bus Interface (DBI) LCD controller support. +endef + +$(eval $(call KernelPackage,drm-mipi-dbi)) + define KernelPackage/drm-ttm SUBMENU:=$(VIDEO_MENU) TITLE:=GPU memory management subsystem @@ -484,6 +516,24 @@ endef $(eval $(call KernelPackage,drm-imx-ldb)) +define KernelPackage/drm-panel-mipi-dbi + SUBMENU:=$(VIDEO_MENU) + TITLE:=Generic MIPI DBI LCD panel + DEPENDS:=+kmod-drm-mipi-dbi +kmod-drm-dma-helper + KCONFIG:=CONFIG_DRM_PANEL_MIPI_DBI \ + CONFIG_DRM_FBDEV_EMULATION=y \ + CONFIG_DRM_FBDEV_OVERALLOC=100 + FILES:= \ + $(LINUX_DIR)/drivers/gpu/drm/tiny/panel-mipi-dbi.ko + AUTOLOAD:=$(call AutoProbe,panel-mipi-dbi) +endef + +define KernelPackage/drm-panel-mipi-dbi/description + Generic driver for MIPI Alliance Display Bus Interface +endef + +$(eval $(call KernelPackage,drm-panel-mipi-dbi)) + define KernelPackage/drm-radeon SUBMENU:=$(VIDEO_MENU) TITLE:=Radeon DRM support From 1d612c33de2a57157b3d92e6df0d03fabcbf30b9 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 10 Nov 2024 00:31:18 +0100 Subject: [PATCH 056/877] include: cmake.mk: honor CONFIG_DEBUG Set CMAKE_BUILD_TYPE according to CONFIG_DEBUG. Signed-off-by: Daniel Golle (cherry picked from commit fc9ec5bd3d22d50654af154fc779517fa7aecb33) --- include/cmake.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/cmake.mk b/include/cmake.mk index 87309dd0458a82..f59410c2f32dd8 100644 --- a/include/cmake.mk +++ b/include/cmake.mk @@ -97,7 +97,7 @@ define Build/Configure/Default -DCMAKE_SYSTEM_NAME=Linux \ -DCMAKE_SYSTEM_VERSION=1 \ -DCMAKE_SYSTEM_PROCESSOR=$(ARCH) \ - -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_BUILD_TYPE=$(if $(CONFIG_DEBUG),Debug,Release) \ -DCMAKE_C_FLAGS_RELEASE="-DNDEBUG" \ -DCMAKE_CXX_FLAGS_RELEASE="-DNDEBUG" \ -DCMAKE_C_COMPILER_LAUNCHER="$(CMAKE_C_COMPILER_LAUNCHER)" \ From 634ac989e999cf0fe47f28ae7ef52b1b41b79670 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 10 Nov 2024 00:32:05 +0100 Subject: [PATCH 057/877] include: meson.mk: honor CONFIG_DEBUG Set buildtype according to CONFIG_DEBUG. Signed-off-by: Daniel Golle (cherry picked from commit be3e7a84bd37f29e14e4c6a89b8c79bc9808c36c) --- include/meson.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/meson.mk b/include/meson.mk index 2a20c2bd6bd04e..ff452d8b01fa4c 100644 --- a/include/meson.mk +++ b/include/meson.mk @@ -124,7 +124,7 @@ define Build/Configure/Meson $(call Meson/CreateCrossFile,$(PKG_BUILD_DIR)/openwrt-cross.txt) $(call Meson, \ setup \ - --buildtype plain \ + --buildtype $(if $(CONFIG_DEBUG),debug,plain) \ --native-file $(PKG_BUILD_DIR)/openwrt-native.txt \ --cross-file $(PKG_BUILD_DIR)/openwrt-cross.txt \ -Ddefault_library=both \ From 0de3c201b139979dd22b4f723846b85c4ad6f170 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Wed, 13 Nov 2024 21:58:38 +0000 Subject: [PATCH 058/877] procd: update to git HEAD 7330fa5 initd: mount /sys and /proc with MS_RELATIME Fixes mounting /proc in unpriviledged user namespace. Signed-off-by: Daniel Golle (cherry picked from commit 1e8505ac4e88212106fe78486cfcbe9cae7660f9) --- 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 86de4babfdfaff..81e133f55bc482 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:=0f494faf2811af6cd7332acda8049ad9713dcabc4b2885dc14acbd9f61920be1 -PKG_SOURCE_DATE:=2024-11-06 -PKG_SOURCE_VERSION:=109fa41b2321506280397e03757976c468832668 +PKG_MIRROR_HASH:=56c5f71da3f68036c63ae59d01992785e74027726da5973297895985cd27c215 +PKG_SOURCE_DATE:=2024-11-13 +PKG_SOURCE_VERSION:=7330fa55c5211eb7b3c675d1c7b8281b69b53553 CMAKE_INSTALL:=1 PKG_LICENSE:=GPL-2.0 From 39d6d318a6c3427ef7fc91b14bdbd316837f1446 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sat, 16 Nov 2024 15:29:24 +0000 Subject: [PATCH 059/877] mtd-utils: add ubihealthd to nand-utils Add ubihealthd to the nand-utils package, auto-create UCI config for each UBI device and launch the daemon on boot. The default time interval between scrubbing a random PED is 120 seconds which means that a fully used 128 MiB flash chip gets scrubbed in about a day and a half. The interval can be adjusted in UCI using the 'interval' option. Suggested-by: Rodrigo Balerdi Signed-off-by: Daniel Golle Link: https://github.com/openwrt/openwrt/pull/16973 Signed-off-by: Christian Marangi (cherry picked from commit 7e287b563aa1043a1af54d5e2b0bd96326371732) --- package/utils/mtd-utils/Makefile | 12 +++++++-- .../utils/mtd-utils/files/ubihealthd.defaults | 18 +++++++++++++ package/utils/mtd-utils/files/ubihealthd.init | 27 +++++++++++++++++++ 3 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 package/utils/mtd-utils/files/ubihealthd.defaults create mode 100644 package/utils/mtd-utils/files/ubihealthd.init diff --git a/package/utils/mtd-utils/Makefile b/package/utils/mtd-utils/Makefile index 046572e83b415b..0dc88312514641 100644 --- a/package/utils/mtd-utils/Makefile +++ b/package/utils/mtd-utils/Makefile @@ -65,12 +65,20 @@ CONFIGURE_ARGS += \ --without-lzo \ --without-zlib +define Package/ubi-utils/conffiles +/etc/config/ubihealthd +endef + define Package/ubi-utils/install $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) \ - $(PKG_INSTALL_DIR)/usr/sbin/{ubiattach,ubicrc32,ubiblock,ubidetach,ubiformat,ubimkvol} $(1)/usr/sbin/ + $(PKG_INSTALL_DIR)/usr/sbin/{ubiattach,ubicrc32,ubiblock,ubidetach,ubiformat,ubihealthd} $(1)/usr/sbin/ $(INSTALL_BIN) \ - $(PKG_INSTALL_DIR)/usr/sbin/{ubinfo,ubinize,ubirename,ubirmvol,ubirsvol,ubiupdatevol} $(1)/usr/sbin/ + $(PKG_INSTALL_DIR)/usr/sbin/{ubimkvol,ubinfo,ubinize,ubirename,ubirmvol,ubirsvol,ubiupdatevol} $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/ubihealthd.init $(1)/etc/init.d/ubihealthd + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_DATA) ./files/ubihealthd.defaults $(1)/etc/uci-defaults/ubihealthd endef define Package/nand-utils/install diff --git a/package/utils/mtd-utils/files/ubihealthd.defaults b/package/utils/mtd-utils/files/ubihealthd.defaults new file mode 100644 index 00000000000000..5222961bd48ddb --- /dev/null +++ b/package/utils/mtd-utils/files/ubihealthd.defaults @@ -0,0 +1,18 @@ +#!/bin/sh + +[ -e "/etc/config/ubihealthd" ] && exit 0 +[ ! -e "/sys/class/ubi" ] && exit 0 + +touch "/etc/config/ubihealthd" + +for ubidev in /sys/class/ubi/*/total_eraseblocks; do + ubidev="${ubidev%/*}" + ubidev="${ubidev##*/}" + uci batch < Date: Fri, 22 Nov 2024 09:00:25 -0800 Subject: [PATCH 060/877] build: profiles.json: add kernel version information MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently downstream tools like ASU lack information about kernel version to find out the relevant kmod build folder on downloads server. So lets fix it by providing a new `linux_kernel` JSON array which would for the start provide Linux kernel version, revision and vermagic information. "linux_kernel": { "release": "1", "vermagic": "b57450c07d3a786158c3601fc5cee57d", "version": "6.6.61" }, Fixes: openwrt/openwrt#17036 Fixes: efahl/owut#9 Co-developed-by: Petr Štetiar Signed-off-by: Eric Fahlgren Link: https://github.com/openwrt/openwrt/pull/17042 Signed-off-by: Petr Štetiar (cherry picked from commit c857145e034f623e31ab2028049a547ecd94ce85) --- scripts/json_overview_image_info.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/scripts/json_overview_image_info.py b/scripts/json_overview_image_info.py index 0d2cf7f1ef5134..96921c27430a86 100755 --- a/scripts/json_overview_image_info.py +++ b/scripts/json_overview_image_info.py @@ -47,7 +47,13 @@ def get_initial_output(image_info): if output: - default_packages, output["arch_packages"] = run( + ( + default_packages, + output["arch_packages"], + linux_version, + linux_release, + linux_vermagic, + ) = run( [ "make", "--no-print-directory", @@ -55,6 +61,9 @@ def get_initial_output(image_info): "target/linux/", "val.DEFAULT_PACKAGES", "val.ARCH_PACKAGES", + "val.LINUX_VERSION", + "val.LINUX_RELEASE", + "val.LINUX_VERMAGIC", "V=s", ], stdout=PIPE, @@ -64,7 +73,11 @@ def get_initial_output(image_info): ).stdout.splitlines() output["default_packages"] = sorted(default_packages.split()) - + output["linux_kernel"] = { + "version": linux_version, + "release": linux_release, + "vermagic": linux_vermagic, + } output_path.write_text(json.dumps(output, sort_keys=True, separators=(",", ":"))) else: print("JSON info file script could not find any JSON files for target") From fbe50c67c615a2df77072586fc4a5c2144bb9597 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Fri, 18 Oct 2024 18:56:30 -0700 Subject: [PATCH 061/877] ipq40xx: use devm for mutex_init MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Avoids having to call mutex_destroy in remove. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/16755 Signed-off-by: Robert Marko (cherry picked from commit 57f2c72505f24b41fd9beaef3a8aa713b436cdb9) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- ...-net-dsa-qca8k-add-IPQ4019-built-in-switch-support.patch | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/target/linux/ipq40xx/patches-6.6/706-net-dsa-qca8k-add-IPQ4019-built-in-switch-support.patch b/target/linux/ipq40xx/patches-6.6/706-net-dsa-qca8k-add-IPQ4019-built-in-switch-support.patch index 20dd345c6997a4..9bd5ca515ee5d7 100644 --- a/target/linux/ipq40xx/patches-6.6/706-net-dsa-qca8k-add-IPQ4019-built-in-switch-support.patch +++ b/target/linux/ipq40xx/patches-6.6/706-net-dsa-qca8k-add-IPQ4019-built-in-switch-support.patch @@ -87,7 +87,7 @@ Signed-off-by: Robert Marko if (!dsa_port_offloads_bridge(dsa_to_port(ds, i), &bridge)) --- /dev/null +++ b/drivers/net/dsa/qca/qca8k-ipq4019.c -@@ -0,0 +1,946 @@ +@@ -0,0 +1,948 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2009 Felix Fietkau @@ -989,7 +989,9 @@ Signed-off-by: Robert Marko + priv->ds->num_ports = QCA8K_IPQ4019_NUM_PORTS; + priv->ds->priv = priv; + priv->ds->ops = &qca8k_ipq4019_switch_ops; -+ mutex_init(&priv->reg_mutex); ++ ret = devm_mutex_init(dev, &priv->reg_mutex); ++ if (ret) ++ return ret; + platform_set_drvdata(pdev, priv); + + return dsa_register_switch(priv->ds); From 3451a7035600d06631dc05333ddeb63ebdfda16e Mon Sep 17 00:00:00 2001 From: Chuanhong Guo Date: Sat, 2 Nov 2024 22:24:21 +0800 Subject: [PATCH 062/877] kernel: can: package driver for Geschwister Schneider interface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Package gs_usb CAN driver, which is for Geschwister Schneider and bytewerk.org candleLight compatible USB/CAN interfaces. Signed-off-by: Chuanhong Guo (cherry picked from commit ef4df2b5e9d66a6461982a0a81f928abb0f6a074) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/kernel/linux/modules/can.mk | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/package/kernel/linux/modules/can.mk b/package/kernel/linux/modules/can.mk index c86d02d8deeab0..1a4c81cc31c53c 100644 --- a/package/kernel/linux/modules/can.mk +++ b/package/kernel/linux/modules/can.mk @@ -245,6 +245,25 @@ endef $(eval $(call KernelPackage,can-usb-esd)) +define KernelPackage/can-usb-gs + TITLE:=Geschwister Schneider UG interfaces + KCONFIG:=CONFIG_CAN_GS_USB + FILES:= \ + $(LINUX_DIR)/drivers/net/can/usb/gs_usb.ko + AUTOLOAD:=$(call AutoProbe,gs_usb) + $(call AddDepends/can,+kmod-usb-core) +endef + +define KernelPackage/can-usb-gsr/description + This driver supports the Geschwister Schneider and + bytewerk.org candleLight compatible + (https://github.com/candle-usb/candleLight_fw) USB/CAN + interfaces. +endef + +$(eval $(call KernelPackage,can-usb-gs)) + + define KernelPackage/can-usb-kvaser TITLE:=Kvaser CAN/USB interface KCONFIG:=CONFIG_CAN_KVASER_USB From 0cf557876ae77985f120e3fbf2b8007d08b5495d Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Thu, 24 Oct 2024 14:51:29 -0700 Subject: [PATCH 063/877] ramips: mt7621: convert usb power to regulators MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These things are regulators. Should silence dmesg messages about using dummy regulators. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/16804 Signed-off-by: Robert Marko (cherry picked from commit e612900ae0fd6c4624fa661e004536216409107f) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- .../ramips/dts/mt7621_d-team_newifi-d2.dts | 20 ++++++++-------- target/linux/ramips/dts/mt7621_humax_e10.dts | 23 +++++++++++-------- .../dts/mt7621_mikrotik_routerboard-7xx.dtsi | 17 ++++++++++---- .../dts/mt7621_zbtlink_zbt-wg1602-v04.dtsi | 19 ++++++++++----- .../ramips/dts/mt7621_zbtlink_zbt-wg1602.dtsi | 19 ++++++++++----- .../ramips/dts/mt7621_zyxel_lte3301-plus.dts | 19 +++++++-------- .../ramips/dts/mt7621_zyxel_lte5398-m904.dts | 17 ++++++++++---- 7 files changed, 84 insertions(+), 50 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_d-team_newifi-d2.dts b/target/linux/ramips/dts/mt7621_d-team_newifi-d2.dts index 9d426fb17df106..00ff80e3ca9fd0 100644 --- a/target/linux/ramips/dts/mt7621_d-team_newifi-d2.dts +++ b/target/linux/ramips/dts/mt7621_d-team_newifi-d2.dts @@ -80,15 +80,13 @@ }; }; - gpio_export { - compatible = "gpio-export"; - #size-cells = <0>; - - power_usb3 { - gpio-export,name = "power_usb3"; - gpio-export,output = <1>; - gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; - }; + reg_power_usb3: regulator { + compatible = "regulator-fixed"; + regulator-name = "power_usb3"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; + enable-active-high; }; }; @@ -155,6 +153,10 @@ }; }; +&xhci { + vbus-supply = <®_power_usb3>; +}; + &pcie { status = "okay"; }; diff --git a/target/linux/ramips/dts/mt7621_humax_e10.dts b/target/linux/ramips/dts/mt7621_humax_e10.dts index 39eac32d538f4e..7ba772d5e50ad2 100644 --- a/target/linux/ramips/dts/mt7621_humax_e10.dts +++ b/target/linux/ramips/dts/mt7621_humax_e10.dts @@ -19,16 +19,6 @@ label-mac-device = &gmac1; }; - gpio-export { - compatible = "gpio-export"; - - gpio-usb-power { - gpio-export,name = "power:usb"; - gpio-export,output = <1>; - gpios = <&gpio 8 GPIO_ACTIVE_HIGH>; - }; - }; - leds { compatible = "gpio-leds"; @@ -65,6 +55,15 @@ linux,code = ; }; }; + + reg_power_usb: regulator { + compatible = "regulator-fixed"; + regulator-name = "power:usb"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpios = <&gpio 8 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; }; &spi0 { @@ -131,6 +130,10 @@ }; }; +&xhci { + vbus-supply = <®_power_usb>; +}; + &pcie { status = "okay"; }; diff --git a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-7xx.dtsi b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-7xx.dtsi index cdca47f8b8c77a..4a3de8cfba7b88 100644 --- a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-7xx.dtsi +++ b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-7xx.dtsi @@ -13,15 +13,22 @@ gpio-export,output = <0>; gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; }; + }; - usb_power { - gpio-export,name = "usb_power"; - gpio-export,output = <1>; - gpios = <&gpio 12 GPIO_ACTIVE_HIGH>; - }; + reg_usb_power: regulator { + compatible = "regulator-fixed"; + regulator-name = "usb_power"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpios = <&gpio 12 GPIO_ACTIVE_HIGH>; + enable-active-high; }; }; +&xhci { + vbus-supply = <®_usb_power>; +}; + &keys { mode { label = "mode"; diff --git a/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1602-v04.dtsi b/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1602-v04.dtsi index c3712fea7b910f..c70b3330e9c79d 100644 --- a/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1602-v04.dtsi +++ b/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1602-v04.dtsi @@ -48,6 +48,15 @@ }; }; + reg_power_usb: regulator { + compatible = "regulator-fixed"; + regulator-name = "power_usb"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpios = <&gpio 6 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; + watchdog { compatible = "linux,wdt-gpio"; gpios = <&gpio 3 GPIO_ACTIVE_HIGH>; @@ -72,15 +81,13 @@ gpio-export,output = <1>; gpios = <&gpio 7 GPIO_ACTIVE_HIGH>; }; - - ext-usb { - gpio-export,name = "ext-usb"; - gpio-export,output = <1>; - gpios = <&gpio 6 GPIO_ACTIVE_LOW>; - }; }; }; +&xhci { + vbus-supply = <®_power_usb>; +}; + &sdhci { status = "okay"; }; diff --git a/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1602.dtsi b/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1602.dtsi index dcad7b26d23b38..3e2a593ae710da 100644 --- a/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1602.dtsi +++ b/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1602.dtsi @@ -47,6 +47,15 @@ }; }; + reg_power_usb: regulator { + compatible = "regulator-fixed"; + regulator-name = "power_usb"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpios = <&gpio 6 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; + watchdog { compatible = "linux,wdt-gpio"; gpios = <&gpio 3 GPIO_ACTIVE_HIGH>; @@ -71,15 +80,13 @@ gpio-export,output = <1>; gpios = <&gpio 7 GPIO_ACTIVE_HIGH>; }; - - ext-usb { - gpio-export,name = "ext-usb"; - gpio-export,output = <1>; - gpios = <&gpio 6 GPIO_ACTIVE_LOW>; - }; }; }; +&xhci { + vbus-supply = <®_power_usb>; +}; + &sdhci { status = "okay"; }; diff --git a/target/linux/ramips/dts/mt7621_zyxel_lte3301-plus.dts b/target/linux/ramips/dts/mt7621_zyxel_lte3301-plus.dts index 9eed123157ebfa..88894325b5ca62 100644 --- a/target/linux/ramips/dts/mt7621_zyxel_lte3301-plus.dts +++ b/target/linux/ramips/dts/mt7621_zyxel_lte3301-plus.dts @@ -96,17 +96,18 @@ }; + reg_power_usb: regulator { + compatible = "regulator-fixed"; + regulator-name = "power_usb"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpios = <&gpio 7 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; }; -&gpio { - status = "okay"; - - enable_usb_power { - gpio-hog; - line-name = "enable USB power"; - gpios = <7 GPIO_ACTIVE_HIGH>; - output-high; - }; +&xhci { + vbus-supply = <®_power_usb>; }; &nand { diff --git a/target/linux/ramips/dts/mt7621_zyxel_lte5398-m904.dts b/target/linux/ramips/dts/mt7621_zyxel_lte5398-m904.dts index e121077b0ac908..e6ff5ecf6aed53 100644 --- a/target/linux/ramips/dts/mt7621_zyxel_lte5398-m904.dts +++ b/target/linux/ramips/dts/mt7621_zyxel_lte5398-m904.dts @@ -92,15 +92,22 @@ gpio-export,output = <0>; gpios = <&gpio 27 GPIO_ACTIVE_LOW>; }; + }; - usb_power { - gpio-export,name = "usb_power"; - gpio-export,output = <1>; - gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; - }; + reg_usb_power: regulator { + compatible = "regulator-fixed"; + reglator-name = "usb_power"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; + enable-active-high; }; }; +&xhci { + vbus-supply = <®_usb_power>; +}; + &nand { status = "okay"; From e5a20b0f49070f17ac54c7d651dadc3a0a803d03 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sat, 19 Oct 2024 15:49:42 -0700 Subject: [PATCH 064/877] ath79: gpio-latch-miktorik: use gpiochip_get_data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Oversight from devm conversion. No need for a custom static inline function. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/16747 Signed-off-by: Robert Marko (cherry picked from commit 6d2ed484fa2f62e355893f5e1fe3734c88201bfc) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- .../ath79/files/drivers/gpio/gpio-latch-mikrotik.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/target/linux/ath79/files/drivers/gpio/gpio-latch-mikrotik.c b/target/linux/ath79/files/drivers/gpio/gpio-latch-mikrotik.c index 6e3f0f9690e75c..4baed52e5799fe 100644 --- a/target/linux/ath79/files/drivers/gpio/gpio-latch-mikrotik.c +++ b/target/linux/ath79/files/drivers/gpio/gpio-latch-mikrotik.c @@ -28,11 +28,6 @@ struct gpio_latch_chip { struct gpio_desc *gpios[GPIO_LATCH_LINES]; }; -static inline struct gpio_latch_chip *to_gpio_latch_chip(struct gpio_chip *gc) -{ - return container_of(gc, struct gpio_latch_chip, gc); -} - static void gpio_latch_lock(struct gpio_latch_chip *glc, bool enable) { mutex_lock(&glc->mutex); @@ -58,7 +53,7 @@ static void gpio_latch_unlock(struct gpio_latch_chip *glc, bool disable) static int gpio_latch_get(struct gpio_chip *gc, unsigned offset) { - struct gpio_latch_chip *glc = to_gpio_latch_chip(gc); + struct gpio_latch_chip *glc = gpiochip_get_data(gc); int ret; gpio_latch_lock(glc, false); @@ -71,7 +66,7 @@ gpio_latch_get(struct gpio_chip *gc, unsigned offset) static void gpio_latch_set(struct gpio_chip *gc, unsigned offset, int value) { - struct gpio_latch_chip *glc = to_gpio_latch_chip(gc); + struct gpio_latch_chip *glc = gpiochip_get_data(gc); bool enable_latch = false; bool disable_latch = false; @@ -88,7 +83,7 @@ gpio_latch_set(struct gpio_chip *gc, unsigned offset, int value) static int gpio_latch_direction_output(struct gpio_chip *gc, unsigned offset, int value) { - struct gpio_latch_chip *glc = to_gpio_latch_chip(gc); + struct gpio_latch_chip *glc = gpiochip_get_data(gc); bool enable_latch = false; bool disable_latch = false; int ret; From ec774fafe60763376f0dd82d34c621eea48dfa5f Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sat, 19 Oct 2024 15:51:51 -0700 Subject: [PATCH 065/877] ath79: gpio-rb91x-key: use gpiochip_get_data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No need for a custom function that does the same thing. Oversight from devm conversion. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/16748 Signed-off-by: Robert Marko (cherry picked from commit e99b5832e801fdf2ec366419797360e09c2348c6) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- target/linux/ath79/files/drivers/gpio/gpio-rb91x-key.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/target/linux/ath79/files/drivers/gpio/gpio-rb91x-key.c b/target/linux/ath79/files/drivers/gpio/gpio-rb91x-key.c index b2c8e633051f52..02639cf0115d3b 100644 --- a/target/linux/ath79/files/drivers/gpio/gpio-rb91x-key.c +++ b/target/linux/ath79/files/drivers/gpio/gpio-rb91x-key.c @@ -41,14 +41,9 @@ struct gpio_rb91x_key { struct gpio_desc *gpio; }; -static inline struct gpio_rb91x_key *to_gpio_rb91x_key(struct gpio_chip *gc) -{ - return container_of(gc, struct gpio_rb91x_key, gc); -} - static int gpio_rb91x_key_get(struct gpio_chip *gc, unsigned offset) { - struct gpio_rb91x_key *drvdata = to_gpio_rb91x_key(gc); + struct gpio_rb91x_key *drvdata = gpiochip_get_data(gc); struct gpio_desc *gpio = drvdata->gpio; int val, bak_val; @@ -97,7 +92,7 @@ static int gpio_rb91x_key_direction_input(struct gpio_chip *gc, unsigned offset) static void gpio_rb91x_key_set(struct gpio_chip *gc, unsigned offset, int value) { - struct gpio_rb91x_key *drvdata = to_gpio_rb91x_key(gc); + struct gpio_rb91x_key *drvdata = gpiochip_get_data(gc); struct gpio_desc *gpio = drvdata->gpio; mutex_lock(&drvdata->mutex); From 70ee25f70f58dcad301b04ab493ff40723064c51 Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Mon, 4 Nov 2024 22:34:52 +0100 Subject: [PATCH 066/877] packages: drop DEVICE specific dependency for omnia MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both packages `ombnia-mcu-firmware` and `omnia-mcutool` would depend on a specific device. The buildbots however build all devices and therefore the package isn't build at all, due to unmet dependencies. While this didn't cause issues with OPKG, APK fails actively due to the missing packages. Drop the specific dependency, however wants to install unrelated firmware on any device can do that anyway. Signed-off-by: Paul Spooren (cherry picked from commit f35a29d63f445d784f1e266eaa6d3825a249cd6c) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/firmware/omnia-mcu-firmware/Makefile | 1 - package/utils/omnia-mcutool/Makefile | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/package/firmware/omnia-mcu-firmware/Makefile b/package/firmware/omnia-mcu-firmware/Makefile index 6f7bd6ca70737e..9c1c8fbe6c6b55 100644 --- a/package/firmware/omnia-mcu-firmware/Makefile +++ b/package/firmware/omnia-mcu-firmware/Makefile @@ -29,7 +29,6 @@ define Package/omnia-mcu-firmware CATEGORY:=Firmware URL:=https://gitlab.nic.cz/turris/hw/$(PKG_DISTNAME)/-/releases TITLE:=CZ.NIC Turris Omnia MCU firmware - DEPENDS:=@TARGET_mvebu_cortexa9_DEVICE_cznic_turris-omnia endef define Package/omnia-mcu-firmware/description diff --git a/package/utils/omnia-mcutool/Makefile b/package/utils/omnia-mcutool/Makefile index 2eca0cf1902474..66f8ffc6d4a86a 100644 --- a/package/utils/omnia-mcutool/Makefile +++ b/package/utils/omnia-mcutool/Makefile @@ -27,7 +27,7 @@ define Package/omnia-mcutool CATEGORY:=Utilities URL:=https://gitlab.nic.cz/turris/$(PKG_NAME) TITLE:=CZ.NIC Turris Omnia MCU utility - DEPENDS:=+libopenssl +omnia-mcu-firmware @TARGET_mvebu_cortexa9_DEVICE_cznic_turris-omnia + DEPENDS:=+libopenssl +omnia-mcu-firmware endef define Package/omnia-mcutool/description From c4c1bb523f1ae14de049df65c302b817445b00e3 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Tue, 5 Nov 2024 20:03:39 +0100 Subject: [PATCH 067/877] fritz-tools: fix mixed indentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: David Bauer (cherry picked from commit 685e979d470a09361defe1612b001dfc3b7d9832) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- .../utils/fritz-tools/src/fritz_cal_extract.c | 140 +++++++++--------- 1 file changed, 70 insertions(+), 70 deletions(-) diff --git a/package/utils/fritz-tools/src/fritz_cal_extract.c b/package/utils/fritz-tools/src/fritz_cal_extract.c index 2978d86e0cc48e..9899cd53c33e5d 100644 --- a/package/utils/fritz-tools/src/fritz_cal_extract.c +++ b/package/utils/fritz-tools/src/fritz_cal_extract.c @@ -48,86 +48,86 @@ static inline size_t special_min(size_t a, size_t b) is an error reading or writing the files. */ static int inf(FILE *source, FILE *dest, size_t limit, size_t skip) { - int ret; - size_t have; - z_stream strm; - unsigned char in[CHUNK]; - unsigned char out[CHUNK]; + int ret; + size_t have; + z_stream strm; + unsigned char in[CHUNK]; + unsigned char out[CHUNK]; - /* allocate inflate state */ - strm.zalloc = Z_NULL; - strm.zfree = Z_NULL; - strm.opaque = Z_NULL; - strm.avail_in = 0; - strm.next_in = Z_NULL; - ret = inflateInit(&strm); - if (ret != Z_OK) - return ret; + /* allocate inflate state */ + strm.zalloc = Z_NULL; + strm.zfree = Z_NULL; + strm.opaque = Z_NULL; + strm.avail_in = 0; + strm.next_in = Z_NULL; + ret = inflateInit(&strm); + if (ret != Z_OK) + return ret; - /* decompress until deflate stream ends or end of file */ - do { - strm.avail_in = fread(in, 1, CHUNK, source); - if (ferror(source)) { - (void)inflateEnd(&strm); - return Z_ERRNO; - } - if (strm.avail_in == 0) - break; - strm.next_in = in; + /* decompress until deflate stream ends or end of file */ + do { + strm.avail_in = fread(in, 1, CHUNK, source); + if (ferror(source)) { + (void)inflateEnd(&strm); + return Z_ERRNO; + } + if (strm.avail_in == 0) + break; + strm.next_in = in; - /* run inflate() on input until output buffer not full */ - do { - strm.avail_out = CHUNK; - strm.next_out = out; - ret = inflate(&strm, Z_NO_FLUSH); - assert(ret != Z_STREAM_ERROR); /* state not clobbered */ - switch (ret) { - case Z_NEED_DICT: - ret = Z_DATA_ERROR; /* and fall through */ - case Z_DATA_ERROR: - case Z_MEM_ERROR: - (void)inflateEnd(&strm); - return ret; - } - have = special_min(limit, CHUNK - strm.avail_out) - skip; - if (fwrite(&out[skip], have, 1, dest) != 1 || ferror(dest)) { - (void)inflateEnd(&strm); - return Z_ERRNO; - } - skip = 0; - limit -= have; - } while (strm.avail_out == 0 && limit > 0); + /* run inflate() on input until output buffer not full */ + do { + strm.avail_out = CHUNK; + strm.next_out = out; + ret = inflate(&strm, Z_NO_FLUSH); + assert(ret != Z_STREAM_ERROR); /* state not clobbered */ + switch (ret) { + case Z_NEED_DICT: + ret = Z_DATA_ERROR; /* and fall through */ + case Z_DATA_ERROR: + case Z_MEM_ERROR: + (void)inflateEnd(&strm); + return ret; + } + have = special_min(limit, CHUNK - strm.avail_out) - skip; + if (fwrite(&out[skip], have, 1, dest) != 1 || ferror(dest)) { + (void)inflateEnd(&strm); + return Z_ERRNO; + } + skip = 0; + limit -= have; + } while (strm.avail_out == 0 && limit > 0); - /* done when inflate() says it's done */ - } while (ret != Z_STREAM_END && limit > 0); + /* done when inflate() says it's done */ + } while (ret != Z_STREAM_END && limit > 0); - /* clean up and return */ - (void)inflateEnd(&strm); - return (limit == 0 ? Z_OK : (ret == Z_STREAM_END ? Z_OK : Z_DATA_ERROR)); + /* clean up and return */ + (void)inflateEnd(&strm); + return (limit == 0 ? Z_OK : (ret == Z_STREAM_END ? Z_OK : Z_DATA_ERROR)); } /* report a zlib or i/o error */ static void zerr(int ret) { - switch (ret) { - case Z_ERRNO: - if (ferror(stdin)) - fputs("error reading stdin\n", stderr); - if (ferror(stdout)) - fputs("error writing stdout\n", stderr); - break; - case Z_STREAM_ERROR: - fputs("invalid compression level\n", stderr); - break; - case Z_DATA_ERROR: - fputs("invalid or incomplete deflate data\n", stderr); - break; - case Z_MEM_ERROR: - fputs("out of memory\n", stderr); - break; - case Z_VERSION_ERROR: - fputs("zlib version mismatch!\n", stderr); - } + switch (ret) { + case Z_ERRNO: + if (ferror(stdin)) + fputs("error reading stdin\n", stderr); + if (ferror(stdout)) + fputs("error writing stdout\n", stderr); + break; + case Z_STREAM_ERROR: + fputs("invalid compression level\n", stderr); + break; + case Z_DATA_ERROR: + fputs("invalid or incomplete deflate data\n", stderr); + break; + case Z_MEM_ERROR: + fputs("out of memory\n", stderr); + break; + case Z_VERSION_ERROR: + fputs("zlib version mismatch!\n", stderr); + } } static unsigned int get_num(char *str) From 4b9e9a03108258bffef7d779cb965f5b91608dd7 Mon Sep 17 00:00:00 2001 From: Tim Lunn Date: Wed, 17 Apr 2024 10:49:49 +1000 Subject: [PATCH 068/877] rampis: mt7621: Convert Edgerouter-X dts to single kernel config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The OEM layout for Edgerouter X provides for two 3MB kernel slots. As of linux 6.1 the kernel images no longer fit and as such Edgerouter X builds have been disabled in Main. Revise the layout to make kernel1 slot 6MB and drop kernel2 slot. This patch applies the required changes to the dts file. Signed-off-by: Tim Lunn Tested-by: Mauri Sandberg Link: https://github.com/openwrt/openwrt/pull/15194 (cherry picked from commit dc51c4355d48e91ed8fd06d70f0bf71b0b4bc4d2) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- target/linux/ramips/dts/mt7621_ubnt_edgerouter-x.dtsi | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_ubnt_edgerouter-x.dtsi b/target/linux/ramips/dts/mt7621_ubnt_edgerouter-x.dtsi index 7648e4298268bb..40433c1c43b23d 100644 --- a/target/linux/ramips/dts/mt7621_ubnt_edgerouter-x.dtsi +++ b/target/linux/ramips/dts/mt7621_ubnt_edgerouter-x.dtsi @@ -105,13 +105,8 @@ }; partition@140000 { - label = "kernel1"; - reg = <0x140000 0x300000>; - }; - - partition@440000 { - label = "kernel2"; - reg = <0x440000 0x300000>; + label = "kernel"; + reg = <0x140000 0x600000>; }; partition@740000 { From c2cde63ae654185d2c117ec72c1837b683212734 Mon Sep 17 00:00:00 2001 From: Tim Lunn Date: Wed, 17 Apr 2024 12:51:22 +1000 Subject: [PATCH 069/877] rampis: mt7621: Edgerouter-X disable toggling of kernel slots MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Uboot selects which kernel slot to boot based on a flag in the factory mtd partition. Patch ubnt.sh to ensure always flash to kernel1 slot and update flag if required. Signed-off-by: Tim Lunn Tested-by: Mauri Sandberg Link: https://github.com/openwrt/openwrt/pull/15194 (cherry picked from commit 5e355f1f9084c1b6de3151fbcde948d736292d6c) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- .../mt7621/base-files/lib/upgrade/ubnt.sh | 39 ++++--------------- 1 file changed, 7 insertions(+), 32 deletions(-) diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/ubnt.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/ubnt.sh index 748ec8e6286ee6..7e9d937d79f856 100644 --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/ubnt.sh +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/ubnt.sh @@ -8,32 +8,16 @@ UBNT_ERX_KERNEL_INDEX_OFFSET=160 -ubnt_get_target_kernel() { +ubnt_update_kernel_flag() { local factory_mtd=$1 - local current_kernel_index=$(hexdump -s $UBNT_ERX_KERNEL_INDEX_OFFSET -n 1 -e '/1 "%X "' ${factory_mtd}) + local kernel_index=$(hexdump -s $UBNT_ERX_KERNEL_INDEX_OFFSET -n 1 -e '/1 "%X "' ${factory_mtd}) - if [ $current_kernel_index == "0" ]; then - echo 'kernel2' - elif [ $current_kernel_index == "1" ]; then - echo 'kernel1' - fi -} - -ubnt_update_target_kernel() { - local factory_mtd=$1 - local kernel_part=$2 - - local new_kernel_index - if [ $kernel_part == "kernel1" ]; then - new_kernel_index="\x00" - elif [ $kernel_part == "kernel2" ]; then - new_kernel_index="\x01" - else - echo 'Unknown kernel image index' >&2 - return 1 + if [ $kernel_index = "0" ]; then + echo "Kernel flag already set to kernel slot 1" + return 0 fi - if ! (echo -e $new_kernel_index | dd of=${factory_mtd} bs=1 count=1 seek=$UBNT_ERX_KERNEL_INDEX_OFFSET); then + if ! (echo -e "\x00" | dd of=${factory_mtd} bs=1 count=1 seek=$UBNT_ERX_KERNEL_INDEX_OFFSET); then echo 'Failed to update kernel bootup index' >&2 return 1 fi @@ -46,15 +30,6 @@ platform_upgrade_ubnt_erx() { exit 1 fi - local kernel_part="$(ubnt_get_target_kernel ${factory_mtd})" - if [ -z "$kernel_part" ]; then - echo "cannot find factory partition" >&2 - exit 1 - fi - - # This is a global defined in nand.sh, sets partition kernel will be flashed into - CI_KERNPART=${kernel_part} - #Remove volume possibly left over from stock firmware local ubidev="$( nand_find_ubi "$CI_UBIPART" )" if [ -z "$ubidev" ]; then @@ -72,7 +47,7 @@ platform_upgrade_ubnt_erx() { [ -n "$troot_ubivol" ] && ubirmvol /dev/$ubidev -N troot || true fi - ubnt_update_target_kernel ${factory_mtd} ${kernel_part} || exit 1 + ubnt_update_kernel_flag ${factory_mtd} || exit 1 nand_do_upgrade "$1" } From 1fd7e5124ebe06b4fab8b619d38f695828640905 Mon Sep 17 00:00:00 2001 From: Tim Lunn Date: Wed, 17 Apr 2024 10:51:35 +1000 Subject: [PATCH 070/877] rampis: mt7621: resize Edgerouter-X kernel size to 6MB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With the updated partition layout set in dts, set the KERNEL_SIZE parameter to 6MB allowing builds of Linux 6.1 and later to fit. Signed-off-by: Tim Lunn Tested-by: Mauri Sandberg Link: https://github.com/openwrt/openwrt/pull/15194 (cherry picked from commit 09a6bffb6e0a714f20d71043ae8382af4c5925b6) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- 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 9654e237a8af22..27adb06bf7ddf2 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -2860,7 +2860,7 @@ define Device/ubnt_edgerouter_common DEVICE_VENDOR := Ubiquiti IMAGE_SIZE := 256768k FILESYSTEMS := squashfs - KERNEL_SIZE := 3145728 + KERNEL_SIZE := 6144k KERNEL_INITRAMFS := $$(KERNEL) | \ ubnt-erx-factory-image $(KDIR)/tmp/$$(KERNEL_INITRAMFS_PREFIX)-factory.tar IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata From a5efcbd327f837b4ca425ac46d9e63e203580d4f Mon Sep 17 00:00:00 2001 From: Tim Lunn Date: Thu, 18 Apr 2024 10:56:07 +1000 Subject: [PATCH 071/877] rampis: mt7621: Edgerouter-X set compat version message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refer user to the wiki page for instructions on how to migrate to the new kernel layout. Signed-off-by: Tim Lunn Tested-by: Mauri Sandberg Link: https://github.com/openwrt/openwrt/pull/15194 (cherry picked from commit 70c371d91cda300d7c655f019cb2076d2dd537fb) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- target/linux/ramips/image/mt7621.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 27adb06bf7ddf2..f4dacba8943fd3 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -2865,6 +2865,10 @@ define Device/ubnt_edgerouter_common ubnt-erx-factory-image $(KDIR)/tmp/$$(KERNEL_INITRAMFS_PREFIX)-factory.tar IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata DEVICE_PACKAGES += -wpad-basic-mbedtls -uboot-envtools + DEVICE_COMPAT_VERSION := 2.0 + DEVICE_COMPAT_MESSAGE := Partition table has been changed due to kernel size restrictions. \ + Refer to the wiki page for instructions to migrate to the new layout: \ + https://openwrt.org/toh/ubiquiti/edgerouter_x_er-x_ka DEFAULT := n endef From 1c934c7dc7355cb5ff9dda5a52256d74dfd2aa83 Mon Sep 17 00:00:00 2001 From: Tim Lunn Date: Thu, 18 Apr 2024 10:57:17 +1000 Subject: [PATCH 072/877] rampis: mt7621: Edgerouter-X update compat version to 2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use compat version to indicate that the new layout for larger kernels is in place. This handled by the patch to ubnt.sh to always select the kernel1 slot for flashing and as active kernel slot. Signed-off-by: Tim Lunn Tested-by: Mauri Sandberg Link: https://github.com/openwrt/openwrt/pull/15194 (cherry picked from commit 1bdbd511b27017157e92ffe128e66853d169dcbf) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- .../ramips/mt7621/base-files/etc/board.d/05_compat-version | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/05_compat-version b/target/linux/ramips/mt7621/base-files/etc/board.d/05_compat-version index acc69021d09f71..156fb1735e318e 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/05_compat-version +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/05_compat-version @@ -8,6 +8,8 @@ board_config_update case "$(board_name)" in + ubnt,edgerouter-x|\ + ubnt,edgerouter-x-sfp|\ iptime,ax2004m) ucidef_set_compat_version "2.0" ;; From 14880209d5c38a9146359ea439783f8c02ea2f7b Mon Sep 17 00:00:00 2001 From: Tim Lunn Date: Thu, 18 Apr 2024 10:53:54 +1000 Subject: [PATCH 073/877] rampis: mt7621: Re-enable Edgerouter-X image builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With the new layout providing 6MB for kernel there will be no issues with kernel size affecting build of images. Re-enable image builds for Edgerouter-X and X-SFP. Signed-off-by: Tim Lunn Tested-by: Mauri Sandberg Link: https://github.com/openwrt/openwrt/pull/15194 (cherry picked from commit 71b4842e3bdaed91cd2daa4b28a208559c3de7c6) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- target/linux/ramips/image/mt7621.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index f4dacba8943fd3..b9692c5f3ad94f 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -2869,7 +2869,6 @@ define Device/ubnt_edgerouter_common DEVICE_COMPAT_MESSAGE := Partition table has been changed due to kernel size restrictions. \ Refer to the wiki page for instructions to migrate to the new layout: \ https://openwrt.org/toh/ubiquiti/edgerouter_x_er-x_ka - DEFAULT := n endef define Device/ubnt_edgerouter-x From d582b369c3e6d7d4c103066bc82b00055a4a27a9 Mon Sep 17 00:00:00 2001 From: Tim Lunn Date: Fri, 19 Apr 2024 22:16:11 +1000 Subject: [PATCH 074/877] ramips: mt7621: Edgerouter-X drop factory image MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Edgerouter-X factory images have not built automatically since 19.x due to images being over 3MB. While it was possible to build custom images with very stripped down config, this is no longer possible with the size increases of linux 6.1 and 6.6. Drop code for generation of factory images, if some dev later wishes to try custom images they can revert this commit. Signed-off-by: Tim Lunn Link: https://github.com/openwrt/openwrt/pull/15194 (cherry picked from commit 4d90b79704efba57ab158c47ae6936ce4c1ef185) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- target/linux/ramips/image/mt7621.mk | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index b9692c5f3ad94f..bebe40c2161838 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -229,30 +229,6 @@ define Build/belkin-header mv $@.new $@ endef -define Build/ubnt-erx-factory-image - if [ -e $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) -a "$$(stat -c%s $@)" -lt "$(KERNEL_SIZE)" ]; then \ - echo '21001:7' > $(1).compat; \ - $(TAR) -cf $(1) --transform='s/^.*/compat/' $(1).compat; \ - \ - $(TAR) -rf $(1) --transform='s/^.*/vmlinux.tmp/' $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE); \ - $(MKHASH) md5 $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) > $(1).md5; \ - $(TAR) -rf $(1) --transform='s/^.*/vmlinux.tmp.md5/' $(1).md5; \ - \ - echo "dummy" > $(1).rootfs; \ - $(TAR) -rf $(1) --transform='s/^.*/squashfs.tmp/' $(1).rootfs; \ - \ - $(MKHASH) md5 $(1).rootfs > $(1).md5; \ - $(TAR) -rf $(1) --transform='s/^.*/squashfs.tmp.md5/' $(1).md5; \ - \ - echo '$(BOARD) $(VERSION_CODE) $(VERSION_NUMBER)' > $(1).version; \ - $(TAR) -rf $(1) --transform='s/^.*/version.tmp/' $(1).version; \ - \ - $(CP) $(1) $(BIN_DIR)/; \ - else \ - echo "WARNING: initramfs kernel image too big, cannot generate factory image (actual $$(stat -c%s $@); max $(KERNEL_SIZE))" >&2; \ - fi -endef - define Build/zytrx-header $(eval board=$(word 1,$(1))) $(eval version=$(word 2,$(1))) @@ -2861,8 +2837,6 @@ define Device/ubnt_edgerouter_common IMAGE_SIZE := 256768k FILESYSTEMS := squashfs KERNEL_SIZE := 6144k - KERNEL_INITRAMFS := $$(KERNEL) | \ - ubnt-erx-factory-image $(KDIR)/tmp/$$(KERNEL_INITRAMFS_PREFIX)-factory.tar IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata DEVICE_PACKAGES += -wpad-basic-mbedtls -uboot-envtools DEVICE_COMPAT_VERSION := 2.0 From 79c711a035e5a98dcb16b1e68d323c865a08db1e Mon Sep 17 00:00:00 2001 From: Tim Lunn Date: Fri, 26 Apr 2024 11:27:45 +1000 Subject: [PATCH 075/877] rampis: mt7621: Edgerouter-X adjust IMAGE_SIZE to reflect new kernel size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit IMAGE_SIZE was previously set to kernel1 + ubi size = 256768k, now kernel1 is 6MB adjust this value to add 3072k to total image size. Signed-off-by: Tim Lunn Link: https://github.com/openwrt/openwrt/pull/15194 (cherry picked from commit 5b406bccaccadb494cad139b3f69e17ab62d3968) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- 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 bebe40c2161838..1dc1219d241e46 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -2834,7 +2834,7 @@ define Device/ubnt_edgerouter_common $(Device/dsa-migration) $(Device/uimage-lzma-loader) DEVICE_VENDOR := Ubiquiti - IMAGE_SIZE := 256768k + IMAGE_SIZE := 259840k FILESYSTEMS := squashfs KERNEL_SIZE := 6144k IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata From 68465e524bb8134ac514b4257c5cd5c1cb97dd83 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Wed, 6 Nov 2024 13:23:35 -0800 Subject: [PATCH 076/877] ramips: mt7621: add missing regulator-boot-on MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit What seems to be happening is that the kernel requests an ACTIVE_LOW gpio initially and sets it to high later based on gpios in dts. This seems to break some devices where the bootloader sets it to high. Fixes: e612900ae0 ("ramips: mt7621: convert usb power to regulators") Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/16877 Signed-off-by: Robert Marko (cherry picked from commit a7bc6bf7dba98c77724cb8284d21a9c77c263d56) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- target/linux/ramips/dts/mt7621_d-team_newifi-d2.dts | 1 + target/linux/ramips/dts/mt7621_humax_e10.dts | 1 + target/linux/ramips/dts/mt7621_mikrotik_routerboard-7xx.dtsi | 1 + target/linux/ramips/dts/mt7621_zyxel_lte3301-plus.dts | 1 + target/linux/ramips/dts/mt7621_zyxel_lte5398-m904.dts | 1 + 5 files changed, 5 insertions(+) diff --git a/target/linux/ramips/dts/mt7621_d-team_newifi-d2.dts b/target/linux/ramips/dts/mt7621_d-team_newifi-d2.dts index 00ff80e3ca9fd0..cba4ceae72810a 100644 --- a/target/linux/ramips/dts/mt7621_d-team_newifi-d2.dts +++ b/target/linux/ramips/dts/mt7621_d-team_newifi-d2.dts @@ -87,6 +87,7 @@ regulator-max-microvolt = <5000000>; gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; enable-active-high; + regulator-boot-on; }; }; diff --git a/target/linux/ramips/dts/mt7621_humax_e10.dts b/target/linux/ramips/dts/mt7621_humax_e10.dts index 7ba772d5e50ad2..fd66578eaf0953 100644 --- a/target/linux/ramips/dts/mt7621_humax_e10.dts +++ b/target/linux/ramips/dts/mt7621_humax_e10.dts @@ -63,6 +63,7 @@ regulator-max-microvolt = <5000000>; gpios = <&gpio 8 GPIO_ACTIVE_HIGH>; enable-active-high; + regulator-boot-on; }; }; diff --git a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-7xx.dtsi b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-7xx.dtsi index 4a3de8cfba7b88..7429ce673dd2f8 100644 --- a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-7xx.dtsi +++ b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-7xx.dtsi @@ -22,6 +22,7 @@ regulator-max-microvolt = <5000000>; gpios = <&gpio 12 GPIO_ACTIVE_HIGH>; enable-active-high; + regulator-boot-on; }; }; diff --git a/target/linux/ramips/dts/mt7621_zyxel_lte3301-plus.dts b/target/linux/ramips/dts/mt7621_zyxel_lte3301-plus.dts index 88894325b5ca62..2a556190d0b068 100644 --- a/target/linux/ramips/dts/mt7621_zyxel_lte3301-plus.dts +++ b/target/linux/ramips/dts/mt7621_zyxel_lte3301-plus.dts @@ -103,6 +103,7 @@ regulator-max-microvolt = <5000000>; gpios = <&gpio 7 GPIO_ACTIVE_HIGH>; enable-active-high; + regulator-boot-on; }; }; diff --git a/target/linux/ramips/dts/mt7621_zyxel_lte5398-m904.dts b/target/linux/ramips/dts/mt7621_zyxel_lte5398-m904.dts index e6ff5ecf6aed53..2d06b949f2f027 100644 --- a/target/linux/ramips/dts/mt7621_zyxel_lte5398-m904.dts +++ b/target/linux/ramips/dts/mt7621_zyxel_lte5398-m904.dts @@ -101,6 +101,7 @@ regulator-max-microvolt = <5000000>; gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; enable-active-high; + regulator-boot-on; }; }; From f05d49cfbda927a618123ccc787b52640baed5e3 Mon Sep 17 00:00:00 2001 From: Marius Dinu Date: Sat, 9 Nov 2024 19:20:47 +0200 Subject: [PATCH 077/877] menuconfig: add help description for Stack Smashing Protection options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Descriptions taken from: https://wiki.osdev.org/Stack_Smashing_Protector Signed-off-by: Marius Dinu Link: https://github.com/openwrt/openwrt/pull/16897 Signed-off-by: Christian Marangi (cherry picked from commit cbf7be9fb37baaaf7ee5c2b6315028bd47c764bc) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- config/Config-build.in | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/config/Config-build.in b/config/Config-build.in index 41c1daccd99564..481be0bb6c55dd 100644 --- a/config/Config-build.in +++ b/config/Config-build.in @@ -295,12 +295,22 @@ menu "Global build settings" Enable GCC Stack Smashing Protection (SSP) for userspace applications config PKG_CC_STACKPROTECTOR_NONE bool "None" + help + No stack smashing protection. config PKG_CC_STACKPROTECTOR_REGULAR bool "Regular" + help + Protects functions with vulnerable objects. + This includes functions with buffers larger than 8 bytes or calls to alloca. config PKG_CC_STACKPROTECTOR_STRONG bool "Strong" + help + Like Regular, but also protects functions with + local arrays or references to local frame addresses. config PKG_CC_STACKPROTECTOR_ALL bool "All" + help + Protects all functions. endchoice choice @@ -310,10 +320,18 @@ menu "Global build settings" Enable GCC Stack-Smashing Protection (SSP) for the kernel config KERNEL_CC_STACKPROTECTOR_NONE bool "None" + help + No stack smashing protection. config KERNEL_CC_STACKPROTECTOR_REGULAR bool "Regular" + help + Protects functions with vulnerable objects. + This includes functions with buffers larger than 8 bytes or calls to alloca. config KERNEL_CC_STACKPROTECTOR_STRONG bool "Strong" + help + Like Regular, but also protects functions with + local arrays or references to local frame addresses. endchoice config KERNEL_STACKPROTECTOR From 69fd722edd3437d29047fce72395c7999572b281 Mon Sep 17 00:00:00 2001 From: "Leon M. Busch-George" Date: Mon, 19 Feb 2024 12:49:28 +0100 Subject: [PATCH 078/877] hostapd: split long lines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These two were getting rather long. Signed-off-by: Leon M. Busch-George Link: https://github.com/openwrt/openwrt/pull/16849 Signed-off-by: Christian Marangi (cherry picked from commit 8b6d5874b88bbe2e7a53bcab0e102b8781480880) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/network/services/hostapd/Makefile | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index 0e3396262d0c13..16dfbff2b06d5c 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -84,7 +84,11 @@ ifneq ($(CONFIG_DRIVER_11BE_SUPPORT),) HOSTAPD_IEEE80211BE:=y endif -CORE_DEPENDS = +ucode +libubus +libucode +ucode-mod-fs +ucode-mod-nl80211 +ucode-mod-rtnl +ucode-mod-ubus +ucode-mod-uloop +libblobmsg-json +libudebug + +CORE_DEPENDS = +ucode +libucode \ + +ucode-mod-fs +ucode-mod-nl80211 +ucode-mod-rtnl +ucode-mod-ubus +ucode-mod-uloop \ + +libubus +libblobmsg-json \ + +libudebug OPENSSL_DEPENDS = +PACKAGE_$(1):libopenssl +PACKAGE_$(1):libopenssl-legacy DRIVER_MAKEOPTS= \ @@ -716,7 +720,13 @@ define Install/supplicant 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 $(1)/usr/share/hostap + $(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_BIN) ./files/wpad.init $(1)/etc/init.d/wpad $(INSTALL_BIN) ./files/wps-hotplug.sh $(1)/etc/rc.button/wps From 2af51fbdabbec7ec3d6adcc5090222a9292d0a79 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Thu, 31 Oct 2024 12:22:04 -0700 Subject: [PATCH 079/877] treewide: remove THIS_MODULE assignment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Matches upstream coccinelle check: api/platform_no_drv_owner.cocci. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/16846 Signed-off-by: Christian Marangi (cherry picked from commit cc98cfafd799d502fbe09ddb62bab68633d570f5) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- .../kernel/gpio-button-hotplug/src/gpio-button-hotplug.c | 2 -- package/kernel/gpio-nct5104d/src/gpio-nct5104d.c | 1 - package/kernel/lantiq/ltq-adsl-mei/src/drv_mei_cpe.c | 1 - package/kernel/lantiq/ltq-adsl/patches/120-platform.patch | 3 +-- package/kernel/lantiq/ltq-atm/src/ltq_atm.c | 1 - package/kernel/lantiq/ltq-deu/src/ifxmips_deu.c | 1 - package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c | 1 - package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c | 1 - package/kernel/ubootenv-nvram/src/ubootenv-nvram.c | 1 - target/linux/ath79/files/drivers/gpio/gpio-latch-mikrotik.c | 1 - target/linux/ath79/files/drivers/gpio/gpio-rb91x-key.c | 1 - target/linux/ath79/files/drivers/mtd/nand/raw/ar934x_nand.c | 1 - target/linux/ath79/files/drivers/mtd/nand/raw/rb91x_nand.c | 1 - target/linux/bcm47xx/patches-6.6/831-old_gpio_wdt.patch | 3 +-- target/linux/generic/files/drivers/net/phy/rtl8366rb.c | 1 - target/linux/generic/files/drivers/net/phy/rtl8366s.c | 1 - target/linux/generic/files/drivers/net/phy/rtl8367.c | 1 - target/linux/generic/files/drivers/net/phy/rtl8367b.c | 1 - .../generic/hack-6.6/800-GPIO-add-named-gpio-exports.patch | 3 +-- .../510-block-add-uImage.FIT-subimage-block-driver.patch | 3 +-- .../ipq40xx/patches-6.6/850-soc-add-qualcomm-syscon.patch | 3 +-- .../ipq806x/patches-6.6/850-soc-add-qualcomm-syscon.patch | 3 +-- .../0008-MIPS-lantiq-backport-old-timer-code.patch | 3 +-- .../0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch | 3 +-- ...0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch | 3 +-- .../patches-6.6/0151-lantiq-ifxmips_pcie-use-of.patch | 3 +-- .../mediatek/files/drivers/net/phy/rtk/rtl8367s_mdio.c | 1 - .../patches-6.6/0900-power-Add-Qualcomm-APM.patch | 3 +-- .../0901-regulator-add-Qualcomm-CPR-regulators.patch | 6 ++---- .../ramips/files/drivers/net/ethernet/ralink/esw_rt3050.c | 1 - .../ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.c | 1 - .../ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c | 1 - .../linux/siflower/files-6.6/drivers/gpio/gpio-siflower.c | 1 - 33 files changed, 13 insertions(+), 48 deletions(-) diff --git a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c index 52346c25d98a3c..9876dee90fc821 100644 --- a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c +++ b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c @@ -693,7 +693,6 @@ static struct platform_driver gpio_keys_driver = { .remove = gpio_keys_remove, .driver = { .name = "gpio-keys", - .owner = THIS_MODULE, .of_match_table = of_match_ptr(gpio_keys_of_match), }, }; @@ -703,7 +702,6 @@ static struct platform_driver gpio_keys_polled_driver = { .remove = gpio_keys_remove, .driver = { .name = "gpio-keys-polled", - .owner = THIS_MODULE, .of_match_table = of_match_ptr(gpio_keys_polled_of_match), }, }; diff --git a/package/kernel/gpio-nct5104d/src/gpio-nct5104d.c b/package/kernel/gpio-nct5104d/src/gpio-nct5104d.c index e31a94b5cfb20d..ffeab29eda2efa 100644 --- a/package/kernel/gpio-nct5104d/src/gpio-nct5104d.c +++ b/package/kernel/gpio-nct5104d/src/gpio-nct5104d.c @@ -366,7 +366,6 @@ nct5104d_gpio_device_add(const struct nct5104d_sio *sio) static struct platform_driver nct5104d_gpio_driver = { .driver = { - .owner = THIS_MODULE, .name = DRVNAME, }, .probe = nct5104d_gpio_probe, diff --git a/package/kernel/lantiq/ltq-adsl-mei/src/drv_mei_cpe.c b/package/kernel/lantiq/ltq-adsl-mei/src/drv_mei_cpe.c index ba23232ee9429c..20a63716a310ea 100644 --- a/package/kernel/lantiq/ltq-adsl-mei/src/drv_mei_cpe.c +++ b/package/kernel/lantiq/ltq-adsl-mei/src/drv_mei_cpe.c @@ -2807,7 +2807,6 @@ static struct platform_driver ltq_mei_driver = { .remove = ltq_mei_remove, .driver = { .name = "lantiq,mei-xway", - .owner = THIS_MODULE, .of_match_table = ltq_mei_match, }, }; diff --git a/package/kernel/lantiq/ltq-adsl/patches/120-platform.patch b/package/kernel/lantiq/ltq-adsl/patches/120-platform.patch index 7bbcf35cd2834c..69f2b45e321cd3 100644 --- a/package/kernel/lantiq/ltq-adsl/patches/120-platform.patch +++ b/package/kernel/lantiq/ltq-adsl/patches/120-platform.patch @@ -36,7 +36,7 @@ } #ifndef _lint -@@ -1159,8 +1159,30 @@ module_param(debug_level, byte, 0); +@@ -1159,8 +1159,29 @@ module_param(debug_level, byte, 0); MODULE_PARM_DESC(debug_level, "set to get more (1) or fewer (4) debug outputs"); #endif /* #ifndef DSL_DEBUG_DISABLE*/ @@ -59,7 +59,6 @@ + .remove = __devexit_p(ltq_adsl_remove), + .driver = { + .name = "adsl", -+ .owner = THIS_MODULE, + .of_match_table = ltq_adsl_match, + }, +}; diff --git a/package/kernel/lantiq/ltq-atm/src/ltq_atm.c b/package/kernel/lantiq/ltq-atm/src/ltq_atm.c index 0cb49a59bd0e4d..6b1e0321b3ee17 100644 --- a/package/kernel/lantiq/ltq-atm/src/ltq_atm.c +++ b/package/kernel/lantiq/ltq-atm/src/ltq_atm.c @@ -1894,7 +1894,6 @@ static struct platform_driver ltq_atm_driver = { .remove = ltq_atm_remove, .driver = { .name = "atm", - .owner = THIS_MODULE, .of_match_table = ltq_atm_match, }, }; diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_deu.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_deu.c index 096b8b5bba83fb..e44e84c03cd7a3 100644 --- a/package/kernel/lantiq/ltq-deu/src/ifxmips_deu.c +++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_deu.c @@ -196,7 +196,6 @@ static struct platform_driver ltq_deu_driver = { .remove = ltq_deu_remove, .driver = { .name = "deu", - .owner = THIS_MODULE, .of_match_table = ltq_deu_match, }, }; diff --git a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c index 3ff01d588ad24a..5e5535348d832f 100644 --- a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c +++ b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c @@ -1600,7 +1600,6 @@ static struct platform_driver ltq_ptm_driver = { .remove = ltq_ptm_remove, .driver = { .name = "ptm", - .owner = THIS_MODULE, .of_match_table = ltq_ptm_match, }, }; diff --git a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c index 6731904bba9a85..c5bbd9fd874594 100644 --- a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c +++ b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c @@ -1138,7 +1138,6 @@ static struct platform_driver ltq_ptm_driver = { .remove = ltq_ptm_remove, .driver = { .name = "ptm", - .owner = THIS_MODULE, .of_match_table = ltq_ptm_match, }, }; diff --git a/package/kernel/ubootenv-nvram/src/ubootenv-nvram.c b/package/kernel/ubootenv-nvram/src/ubootenv-nvram.c index f6244142167b0b..106e41231c9094 100644 --- a/package/kernel/ubootenv-nvram/src/ubootenv-nvram.c +++ b/package/kernel/ubootenv-nvram/src/ubootenv-nvram.c @@ -146,7 +146,6 @@ static struct platform_driver ubootenv_driver = { .remove = ubootenv_remove, .driver = { .name = NAME, - .owner = THIS_MODULE, .of_match_table = of_ubootenv_match, }, }; diff --git a/target/linux/ath79/files/drivers/gpio/gpio-latch-mikrotik.c b/target/linux/ath79/files/drivers/gpio/gpio-latch-mikrotik.c index 4baed52e5799fe..a0759fe9e37172 100644 --- a/target/linux/ath79/files/drivers/gpio/gpio-latch-mikrotik.c +++ b/target/linux/ath79/files/drivers/gpio/gpio-latch-mikrotik.c @@ -168,7 +168,6 @@ static struct platform_driver gpio_latch_driver = { .probe = gpio_latch_probe, .driver = { .name = GPIO_LATCH_DRIVER_NAME, - .owner = THIS_MODULE, .of_match_table = gpio_latch_match, }, }; diff --git a/target/linux/ath79/files/drivers/gpio/gpio-rb91x-key.c b/target/linux/ath79/files/drivers/gpio/gpio-rb91x-key.c index 02639cf0115d3b..d83b690afeccfd 100644 --- a/target/linux/ath79/files/drivers/gpio/gpio-rb91x-key.c +++ b/target/linux/ath79/files/drivers/gpio/gpio-rb91x-key.c @@ -182,7 +182,6 @@ static struct platform_driver gpio_rb91x_key_driver = { .probe = gpio_rb91x_key_probe, .driver = { .name = GPIO_RB91X_KEY_DRIVER_NAME, - .owner = THIS_MODULE, .of_match_table = gpio_rb91x_key_match, }, }; diff --git a/target/linux/ath79/files/drivers/mtd/nand/raw/ar934x_nand.c b/target/linux/ath79/files/drivers/mtd/nand/raw/ar934x_nand.c index d0d9e2090ba802..029142ca618abd 100644 --- a/target/linux/ath79/files/drivers/mtd/nand/raw/ar934x_nand.c +++ b/target/linux/ath79/files/drivers/mtd/nand/raw/ar934x_nand.c @@ -1478,7 +1478,6 @@ static struct platform_driver ar934x_nfc_driver = { .remove = ar934x_nfc_remove, .driver = { .name = AR934X_NFC_DRIVER_NAME, - .owner = THIS_MODULE, .of_match_table = ar934x_nfc_match, }, }; diff --git a/target/linux/ath79/files/drivers/mtd/nand/raw/rb91x_nand.c b/target/linux/ath79/files/drivers/mtd/nand/raw/rb91x_nand.c index 092cd85d82e117..cf2809bfa36678 100644 --- a/target/linux/ath79/files/drivers/mtd/nand/raw/rb91x_nand.c +++ b/target/linux/ath79/files/drivers/mtd/nand/raw/rb91x_nand.c @@ -356,7 +356,6 @@ static struct platform_driver rb91x_nand_driver = { .remove = rb91x_nand_remove, .driver = { .name = "rb91x-nand", - .owner = THIS_MODULE, .of_match_table = rb91x_nand_match, }, }; diff --git a/target/linux/bcm47xx/patches-6.6/831-old_gpio_wdt.patch b/target/linux/bcm47xx/patches-6.6/831-old_gpio_wdt.patch index 6c76cbeee7fb65..f7ab33802c698f 100644 --- a/target/linux/bcm47xx/patches-6.6/831-old_gpio_wdt.patch +++ b/target/linux/bcm47xx/patches-6.6/831-old_gpio_wdt.patch @@ -32,7 +32,7 @@ Signed-off-by: Mathias Adam obj-$(CONFIG_TXX9_WDT) += txx9wdt.o --- /dev/null +++ b/drivers/watchdog/old_gpio_wdt.c -@@ -0,0 +1,301 @@ +@@ -0,0 +1,300 @@ +/* + * Driver for GPIO-controlled Hardware Watchdogs. + * @@ -294,7 +294,6 @@ Signed-off-by: Mathias Adam + .probe = gpio_wdt_probe, + .remove = gpio_wdt_remove, + .driver.name = "gpio-wdt", -+ .driver.owner = THIS_MODULE, +}; + +static int __init gpio_wdt_init(void) diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366rb.c b/target/linux/generic/files/drivers/net/phy/rtl8366rb.c index 0e0116051a8cb3..0878ca9f1400cf 100644 --- a/target/linux/generic/files/drivers/net/phy/rtl8366rb.c +++ b/target/linux/generic/files/drivers/net/phy/rtl8366rb.c @@ -1503,7 +1503,6 @@ MODULE_DEVICE_TABLE(of, rtl8366rb_match); static struct platform_driver rtl8366rb_driver = { .driver = { .name = RTL8366RB_DRIVER_NAME, - .owner = THIS_MODULE, .of_match_table = of_match_ptr(rtl8366rb_match), }, .probe = rtl8366rb_probe, diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366s.c b/target/linux/generic/files/drivers/net/phy/rtl8366s.c index 8c746778b8f820..d4045fcc062259 100644 --- a/target/linux/generic/files/drivers/net/phy/rtl8366s.c +++ b/target/linux/generic/files/drivers/net/phy/rtl8366s.c @@ -1291,7 +1291,6 @@ MODULE_DEVICE_TABLE(of, rtl8366s_match); static struct platform_driver rtl8366s_driver = { .driver = { .name = RTL8366S_DRIVER_NAME, - .owner = THIS_MODULE, #ifdef CONFIG_OF .of_match_table = of_match_ptr(rtl8366s_match), #endif diff --git a/target/linux/generic/files/drivers/net/phy/rtl8367.c b/target/linux/generic/files/drivers/net/phy/rtl8367.c index 0acfeb54bba587..950e9d2767d9ec 100644 --- a/target/linux/generic/files/drivers/net/phy/rtl8367.c +++ b/target/linux/generic/files/drivers/net/phy/rtl8367.c @@ -1834,7 +1834,6 @@ MODULE_DEVICE_TABLE(of, rtl8367_match); static struct platform_driver rtl8367_driver = { .driver = { .name = RTL8367_DRIVER_NAME, - .owner = THIS_MODULE, #ifdef CONFIG_OF .of_match_table = of_match_ptr(rtl8367_match), #endif diff --git a/target/linux/generic/files/drivers/net/phy/rtl8367b.c b/target/linux/generic/files/drivers/net/phy/rtl8367b.c index 4236912dd51e47..5f885aa5be8cd5 100644 --- a/target/linux/generic/files/drivers/net/phy/rtl8367b.c +++ b/target/linux/generic/files/drivers/net/phy/rtl8367b.c @@ -1633,7 +1633,6 @@ MODULE_DEVICE_TABLE(of, rtl8367b_match); static struct platform_driver rtl8367b_driver = { .driver = { .name = RTL8367B_DRIVER_NAME, - .owner = THIS_MODULE, #ifdef CONFIG_OF .of_match_table = of_match_ptr(rtl8367b_match), #endif diff --git a/target/linux/generic/hack-6.6/800-GPIO-add-named-gpio-exports.patch b/target/linux/generic/hack-6.6/800-GPIO-add-named-gpio-exports.patch index a1d787191ccdae..e6dcdfd92b6a1b 100644 --- a/target/linux/generic/hack-6.6/800-GPIO-add-named-gpio-exports.patch +++ b/target/linux/generic/hack-6.6/800-GPIO-add-named-gpio-exports.patch @@ -15,7 +15,7 @@ Signed-off-by: John Crispin #include "gpiolib.h" #include "gpiolib-of.h" -@@ -1129,3 +1131,74 @@ void of_gpiochip_remove(struct gpio_chip +@@ -1129,3 +1131,73 @@ void of_gpiochip_remove(struct gpio_chip { of_node_put(dev_of_node(&chip->gpiodev->dev)); } @@ -81,7 +81,6 @@ Signed-off-by: John Crispin +static struct platform_driver gpio_export_driver = { + .driver = { + .name = "gpio-export", -+ .owner = THIS_MODULE, + .of_match_table = of_match_ptr(gpio_export_ids), + }, + .probe = of_gpio_export_probe, diff --git a/target/linux/generic/pending-6.6/510-block-add-uImage.FIT-subimage-block-driver.patch b/target/linux/generic/pending-6.6/510-block-add-uImage.FIT-subimage-block-driver.patch index ff38964ecee8bf..b06c29ffaf18c4 100644 --- a/target/linux/generic/pending-6.6/510-block-add-uImage.FIT-subimage-block-driver.patch +++ b/target/linux/generic/pending-6.6/510-block-add-uImage.FIT-subimage-block-driver.patch @@ -81,7 +81,7 @@ Signed-off-by: Daniel Golle swim_mod-y := swim.o swim_asm.o --- /dev/null +++ b/drivers/block/fitblk.c -@@ -0,0 +1,659 @@ +@@ -0,0 +1,658 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * uImage.FIT virtual block device driver. @@ -714,7 +714,6 @@ Signed-off-by: Daniel Golle + .probe = fitblk_probe, + .driver = { + .name = "fitblk", -+ .owner = THIS_MODULE, + }, +}; + diff --git a/target/linux/ipq40xx/patches-6.6/850-soc-add-qualcomm-syscon.patch b/target/linux/ipq40xx/patches-6.6/850-soc-add-qualcomm-syscon.patch index 0e93ebb646b510..7cd473b24eb299 100644 --- a/target/linux/ipq40xx/patches-6.6/850-soc-add-qualcomm-syscon.patch +++ b/target/linux/ipq40xx/patches-6.6/850-soc-add-qualcomm-syscon.patch @@ -23,7 +23,7 @@ Subject: SoC: add qualcomm syscon +obj-$(CONFIG_QCOM_TCSR) += qcom_tcsr.o --- /dev/null +++ b/drivers/soc/qcom/qcom_tcsr.c -@@ -0,0 +1,96 @@ +@@ -0,0 +1,95 @@ +/* + * Copyright (c) 2014, The Linux foundation. All rights reserved. + * @@ -109,7 +109,6 @@ Subject: SoC: add qualcomm syscon +static struct platform_driver tcsr_driver = { + .driver = { + .name = "tcsr", -+ .owner = THIS_MODULE, + .of_match_table = tcsr_dt_match, + }, + .probe = tcsr_probe, diff --git a/target/linux/ipq806x/patches-6.6/850-soc-add-qualcomm-syscon.patch b/target/linux/ipq806x/patches-6.6/850-soc-add-qualcomm-syscon.patch index 8b49af8e84f5a3..2d639bbfd386fd 100644 --- a/target/linux/ipq806x/patches-6.6/850-soc-add-qualcomm-syscon.patch +++ b/target/linux/ipq806x/patches-6.6/850-soc-add-qualcomm-syscon.patch @@ -28,7 +28,7 @@ Subject: SoC: add qualcomm syscon depends on ARCH_QCOM || COMPILE_TEST --- /dev/null +++ b/drivers/soc/qcom/qcom_tcsr.c -@@ -0,0 +1,62 @@ +@@ -0,0 +1,61 @@ +/* + * Copyright (c) 2014, The Linux foundation. All rights reserved. + * @@ -80,7 +80,6 @@ Subject: SoC: add qualcomm syscon +static struct platform_driver tcsr_driver = { + .driver = { + .name = "tcsr", -+ .owner = THIS_MODULE, + .of_match_table = tcsr_dt_match, + }, + .probe = tcsr_probe, diff --git a/target/linux/lantiq/patches-6.6/0008-MIPS-lantiq-backport-old-timer-code.patch b/target/linux/lantiq/patches-6.6/0008-MIPS-lantiq-backport-old-timer-code.patch index 3e6c2676855e5e..81bf72913b66f4 100644 --- a/target/linux/lantiq/patches-6.6/0008-MIPS-lantiq-backport-old-timer-code.patch +++ b/target/linux/lantiq/patches-6.6/0008-MIPS-lantiq-backport-old-timer-code.patch @@ -186,7 +186,7 @@ Signed-off-by: John Crispin obj-y += vmmc.o --- /dev/null +++ b/arch/mips/lantiq/xway/timer.c -@@ -0,0 +1,887 @@ +@@ -0,0 +1,886 @@ +#ifndef CONFIG_SOC_AMAZON_SE + +#include @@ -1043,7 +1043,6 @@ Signed-off-by: John Crispin + .probe = gptu_probe, + .driver = { + .name = "gptu-xway", -+ .owner = THIS_MODULE, + .of_match_table = gptu_match, + }, +}; diff --git a/target/linux/lantiq/patches-6.6/0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch b/target/linux/lantiq/patches-6.6/0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch index 1992b536f4c11a..235e48f6deb0ff 100644 --- a/target/linux/lantiq/patches-6.6/0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch +++ b/target/linux/lantiq/patches-6.6/0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch @@ -47,7 +47,7 @@ Signed-off-by: John Crispin obj-$(CONFIG_I2C_MESON) += i2c-meson.o --- /dev/null +++ b/drivers/i2c/busses/i2c-lantiq.c -@@ -0,0 +1,746 @@ +@@ -0,0 +1,745 @@ + +/* + * Lantiq I2C bus adapter @@ -782,7 +782,6 @@ Signed-off-by: John Crispin + .remove = ltq_i2c_remove, + .driver = { + .name = DRV_NAME, -+ .owner = THIS_MODULE, + .of_match_table = ltq_i2c_match, + }, +}; diff --git a/target/linux/lantiq/patches-6.6/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch b/target/linux/lantiq/patches-6.6/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch index 8bb6e5a0da25b4..3ece97052b4e4a 100644 --- a/target/linux/lantiq/patches-6.6/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch +++ b/target/linux/lantiq/patches-6.6/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch @@ -36,7 +36,7 @@ Signed-off-by: John Crispin +obj-$(CONFIG_PCI) += ath5k_eep.o --- /dev/null +++ b/arch/mips/lantiq/xway/ath5k_eep.c -@@ -0,0 +1,136 @@ +@@ -0,0 +1,135 @@ +/* + * Copyright (C) 2011 Luca Olivetti + * Copyright (C) 2011 John Crispin @@ -149,7 +149,6 @@ Signed-off-by: John Crispin +static struct platform_driver ath5k_eeprom_driver = { + .driver = { + .name = "ath5k,eeprom", -+ .owner = THIS_MODULE, + .of_match_table = of_match_ptr(ath5k_eeprom_ids), + }, +}; diff --git a/target/linux/lantiq/patches-6.6/0151-lantiq-ifxmips_pcie-use-of.patch b/target/linux/lantiq/patches-6.6/0151-lantiq-ifxmips_pcie-use-of.patch index b83bf992a6ef50..65253bc7e440a6 100644 --- a/target/linux/lantiq/patches-6.6/0151-lantiq-ifxmips_pcie-use-of.patch +++ b/target/linux/lantiq/patches-6.6/0151-lantiq-ifxmips_pcie-use-of.patch @@ -293,7 +293,7 @@ Signed-off-by: Eddi De Pieri register_pci_controller(&ifx_pcie_controller[pcie_port].pcic); /* XXX, clear error status */ -@@ -1083,6 +1185,30 @@ static int __init ifx_pcie_bios_init(voi +@@ -1083,6 +1185,29 @@ static int __init ifx_pcie_bios_init(voi return 0; } @@ -308,7 +308,6 @@ Signed-off-by: Eddi De Pieri + .probe = ifx_pcie_bios_probe, + .driver = { + .name = "pcie-xrx200", -+ .owner = THIS_MODULE, + .of_match_table = ifxmips_pcie_match, + }, +}; diff --git a/target/linux/mediatek/files/drivers/net/phy/rtk/rtl8367s_mdio.c b/target/linux/mediatek/files/drivers/net/phy/rtk/rtl8367s_mdio.c index b4d4554d4fef51..d958d622e0c28c 100644 --- a/target/linux/mediatek/files/drivers/net/phy/rtk/rtl8367s_mdio.c +++ b/target/linux/mediatek/files/drivers/net/phy/rtk/rtl8367s_mdio.c @@ -296,7 +296,6 @@ static struct platform_driver gsw_driver = { .remove = rtk_gsw_remove, .driver = { .name = "rtk-gsw", - .owner = THIS_MODULE, .of_match_table = rtk_gsw_match, }, }; diff --git a/target/linux/qualcommax/patches-6.6/0900-power-Add-Qualcomm-APM.patch b/target/linux/qualcommax/patches-6.6/0900-power-Add-Qualcomm-APM.patch index 2e5c72b7d1f6b7..f1053515844ada 100644 --- a/target/linux/qualcommax/patches-6.6/0900-power-Add-Qualcomm-APM.patch +++ b/target/linux/qualcommax/patches-6.6/0900-power-Add-Qualcomm-APM.patch @@ -49,7 +49,7 @@ Signed-off-by: Robert Marko +obj-$(CONFIG_QCOM_APM) += apm.o --- /dev/null +++ b/drivers/power/qcom/apm.c -@@ -0,0 +1,944 @@ +@@ -0,0 +1,943 @@ +/* + * Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. + * @@ -971,7 +971,6 @@ Signed-off-by: Robert Marko + .driver = { + .name = MSM_APM_DRIVER_NAME, + .of_match_table = msm_apm_match_table, -+ .owner = THIS_MODULE, + }, + .probe = msm_apm_probe, + .remove = msm_apm_remove, diff --git a/target/linux/qualcommax/patches-6.6/0901-regulator-add-Qualcomm-CPR-regulators.patch b/target/linux/qualcommax/patches-6.6/0901-regulator-add-Qualcomm-CPR-regulators.patch index c85be0357c1fad..46d4fc246fbdc1 100644 --- a/target/linux/qualcommax/patches-6.6/0901-regulator-add-Qualcomm-CPR-regulators.patch +++ b/target/linux/qualcommax/patches-6.6/0901-regulator-add-Qualcomm-CPR-regulators.patch @@ -77,7 +77,7 @@ Signed-off-by: Robert Marko obj-$(CONFIG_REGULATOR_PF8X00) += pf8x00-regulator.o --- /dev/null +++ b/drivers/regulator/cpr3-npu-regulator.c -@@ -0,0 +1,695 @@ +@@ -0,0 +1,694 @@ +/* + * Copyright (c) 2017, The Linux Foundation. All rights reserved. + * @@ -752,7 +752,6 @@ Signed-off-by: Robert Marko + .driver = { + .name = "qcom,cpr3-npu-regulator", + .of_match_table = cpr3_regulator_match_table, -+ .owner = THIS_MODULE, + }, + .probe = cpr3_npu_regulator_probe, + .remove = cpr3_npu_regulator_remove, @@ -9866,7 +9865,7 @@ Signed-off-by: Robert Marko +} --- /dev/null +++ b/drivers/regulator/cpr4-apss-regulator.c -@@ -0,0 +1,1819 @@ +@@ -0,0 +1,1818 @@ +/* + * Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. + * @@ -11663,7 +11662,6 @@ Signed-off-by: Robert Marko + .driver = { + .name = "qcom,cpr4-apss-regulator", + .of_match_table = cpr4_regulator_match_table, -+ .owner = THIS_MODULE, + }, + .probe = cpr4_apss_regulator_probe, + .remove = cpr4_apss_regulator_remove, 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 cafa28e7a44f5e..bbb52d74b240a2 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 @@ -1525,7 +1525,6 @@ static struct platform_driver esw_driver = { .remove = esw_remove, .driver = { .name = "rt3050-esw", - .owner = THIS_MODULE, .of_match_table = ralink_esw_match, }, }; diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.c index 9fc54a74b42337..154983494ee1aa 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.c +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620.c @@ -296,7 +296,6 @@ static struct platform_driver gsw_driver = { .remove = mt7620_gsw_remove, .driver = { .name = "mt7620-gsw", - .owner = THIS_MODULE, .of_match_table = mediatek_gsw_match, }, }; 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 d8d27fda3b15d9..4dff1340d70571 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 @@ -1657,7 +1657,6 @@ static struct platform_driver fe_driver = { .remove = fe_remove, .driver = { .name = "mtk_soc_eth", - .owner = THIS_MODULE, .of_match_table = of_fe_match, }, }; diff --git a/target/linux/siflower/files-6.6/drivers/gpio/gpio-siflower.c b/target/linux/siflower/files-6.6/drivers/gpio/gpio-siflower.c index f061021e30a58f..bd3d8906b44540 100644 --- a/target/linux/siflower/files-6.6/drivers/gpio/gpio-siflower.c +++ b/target/linux/siflower/files-6.6/drivers/gpio/gpio-siflower.c @@ -333,7 +333,6 @@ static struct platform_driver sf_gpio_driver = { .remove = sf_gpio_remove, .driver = { .name = "siflower_gpio", - .owner = THIS_MODULE, .of_match_table = sf_gpio_ids, }, }; From 62690e3b51e0ac227cf23e3da2f83e2fca3de6c4 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Fri, 18 Oct 2024 19:08:02 -0700 Subject: [PATCH 080/877] lantiq: use more devm for i2c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit i2c_add_numbered_adapter is the wrong function to use here. It requires setting nr to some value, otherwise it behaves the same as i2c_add_adapter. nr is not set. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/16825 Signed-off-by: Hauke Mehrtens (cherry picked from commit 44824f0b787b13e2f2fccc58256b2c42fa3f9f5d) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- ...I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/target/linux/lantiq/patches-6.6/0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch b/target/linux/lantiq/patches-6.6/0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch index 235e48f6deb0ff..1f2f5139d60a13 100644 --- a/target/linux/lantiq/patches-6.6/0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch +++ b/target/linux/lantiq/patches-6.6/0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch @@ -47,7 +47,7 @@ Signed-off-by: John Crispin obj-$(CONFIG_I2C_MESON) += i2c-meson.o --- /dev/null +++ b/drivers/i2c/busses/i2c-lantiq.c -@@ -0,0 +1,745 @@ +@@ -0,0 +1,742 @@ + +/* + * Lantiq I2C bus adapter @@ -658,7 +658,9 @@ Signed-off-by: John Crispin + } + + init_completion(&priv->cmd_complete); -+ mutex_init(&priv->mutex); ++ ret = devm_mutex_init(&pdev->dev, &priv->mutex); ++ if (ret) ++ return ret; + + priv->membase = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(priv->membase)) @@ -719,7 +721,7 @@ Signed-off-by: John Crispin + clk_activate(priv->clk_gate); + + /* add our adapter to the i2c stack */ -+ ret = i2c_add_numbered_adapter(adap); ++ ret = devm_i2c_add_adapter(&pdev->dev, adap); + if (ret) { + dev_err(&pdev->dev, "can't register I2C adapter\n"); + goto out; @@ -737,7 +739,6 @@ Signed-off-by: John Crispin + ret = ltq_i2c_hw_init(adap); + if (ret) { + dev_err(&pdev->dev, "can't configure adapter\n"); -+ i2c_del_adapter(adap); + platform_set_drvdata(pdev, NULL); + goto out; + } else { @@ -762,10 +763,6 @@ Signed-off-by: John Crispin + /* power down the core */ + clk_deactivate(priv->clk_gate); + -+ /* remove driver */ -+ i2c_del_adapter(&priv->adap); -+ kfree(priv); -+ + dev_dbg(&pdev->dev, "removed\n"); + platform_set_drvdata(pdev, NULL); + From 67da3d33f3df328f89780bc0c79e1620dc47267a Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Thu, 31 Oct 2024 12:22:04 -0700 Subject: [PATCH 081/877] lantiq: use devm for mutex_init MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's common to avoid calling mutex_destroy when done. It's not correct strictly speaking. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/16832 Signed-off-by: Hauke Mehrtens (cherry picked from commit fccff963c0a6ba035455daea61566f4d121643e3) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- .../0008-MIPS-lantiq-backport-old-timer-code.patch | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/target/linux/lantiq/patches-6.6/0008-MIPS-lantiq-backport-old-timer-code.patch b/target/linux/lantiq/patches-6.6/0008-MIPS-lantiq-backport-old-timer-code.patch index 81bf72913b66f4..a396efd99078f6 100644 --- a/target/linux/lantiq/patches-6.6/0008-MIPS-lantiq-backport-old-timer-code.patch +++ b/target/linux/lantiq/patches-6.6/0008-MIPS-lantiq-backport-old-timer-code.patch @@ -186,7 +186,7 @@ Signed-off-by: John Crispin obj-y += vmmc.o --- /dev/null +++ b/arch/mips/lantiq/xway/timer.c -@@ -0,0 +1,886 @@ +@@ -0,0 +1,888 @@ +#ifndef CONFIG_SOC_AMAZON_SE + +#include @@ -989,7 +989,9 @@ Signed-off-by: John Crispin + ltq_w32(0xfff, LQ_GPTU_IRNCR); + + memset(&timer_dev, 0, sizeof(timer_dev)); -+ mutex_init(&timer_dev.gptu_mutex); ++ ret = devm_mutex_init(&pdev->dev, &timer_dev.gptu_mutex); ++ if (ret) ++ return ret; + + lq_enable_gptu(); + timer_dev.number_of_timers = GPTU_ID_CFG * 2; From 25427d794288de530a0663b4ab9a8f82da8307d4 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sat, 9 Nov 2024 15:46:26 -0800 Subject: [PATCH 082/877] mdadm: backport musl patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Needed to fix compilation with GCC14. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/16912 Signed-off-by: Robert Marko (cherry picked from commit 1f3d5858b441cf4e1195b96242dd08d68538e83d) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/utils/mdadm/Makefile | 2 +- package/utils/mdadm/patches/060-gcc14.patch | 24 +++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 package/utils/mdadm/patches/060-gcc14.patch diff --git a/package/utils/mdadm/Makefile b/package/utils/mdadm/Makefile index c2778fe351cb3a..b521daaefc92b2 100644 --- a/package/utils/mdadm/Makefile +++ b/package/utils/mdadm/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mdadm PKG_VERSION:=4.3 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/utils/raid/mdadm diff --git a/package/utils/mdadm/patches/060-gcc14.patch b/package/utils/mdadm/patches/060-gcc14.patch new file mode 100644 index 00000000000000..545a40ac0ac563 --- /dev/null +++ b/package/utils/mdadm/patches/060-gcc14.patch @@ -0,0 +1,24 @@ +From 8bda86099089b44129ef6206764f9de47a45f0db Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin +Date: Tue, 12 Mar 2024 11:01:50 +0100 +Subject: [PATCH] util.c: add limits.h include for NAME_MAX definition + +Add limits.h include for NAME_MAX definition. + +Signed-off-by: Alexander Kanavin +Signed-off-by: Mariusz Tkaczyk +--- + util.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/util.c ++++ b/util.c +@@ -36,7 +36,7 @@ + #include + #include + #include +- ++#include + + /* + * following taken from linux/blkpg.h because they aren't From 96ab90a9aa75c06fd85cb94babe12b8cb49e32ce Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Mon, 11 Nov 2024 12:23:01 -0800 Subject: [PATCH 083/877] ramips: mt7621: fix typo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Missing u caused the regulator to fail probe. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/16925 Signed-off-by: Robert Marko (cherry picked from commit 3e42526404f021094ae3fa41524c396d753f4c6c) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- target/linux/ramips/dts/mt7621_zyxel_lte5398-m904.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ramips/dts/mt7621_zyxel_lte5398-m904.dts b/target/linux/ramips/dts/mt7621_zyxel_lte5398-m904.dts index 2d06b949f2f027..41173dd1295ffe 100644 --- a/target/linux/ramips/dts/mt7621_zyxel_lte5398-m904.dts +++ b/target/linux/ramips/dts/mt7621_zyxel_lte5398-m904.dts @@ -96,7 +96,7 @@ reg_usb_power: regulator { compatible = "regulator-fixed"; - reglator-name = "usb_power"; + regulator-name = "usb_power"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; From 655874713ee32f5f16f038c4291b02da3a018b76 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 10 Nov 2024 15:54:14 -0800 Subject: [PATCH 084/877] realtek: rtl83xx: use devm for mutex_init MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mutex_destroy is missing in remove. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/16926 Signed-off-by: Robert Marko (cherry picked from commit 1125ed408c7f0d130b5606ab39e4dd98a41d5f0a) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- .../linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/common.c b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/common.c index 5468fc0653ef51..fe0980a1beb82a 100644 --- a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/common.c +++ b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/common.c @@ -1492,7 +1492,9 @@ static int __init rtl83xx_sw_probe(struct platform_device *pdev) priv->ds->needs_standalone_vlan_filtering = true; priv->dev = dev; - mutex_init(&priv->reg_mutex); + err = devm_mutex_init(dev, &priv->reg_mutex); + if (err) + return err; priv->family_id = soc_info.family; priv->id = soc_info.id; From 9d44e00fc564c92bd4f21fdcb30d67d5256e7f59 Mon Sep 17 00:00:00 2001 From: Paul Donald Date: Sun, 10 Nov 2024 19:53:07 +0100 Subject: [PATCH 085/877] cryptodev-linux: give a coherent description MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For the last ten years, nobody has noticed that this driver doesn't actually say what it is for. ;) Signed-off-by: Paul Donald Link: https://github.com/openwrt/openwrt/pull/16910 Signed-off-by: Christian Marangi (cherry picked from commit 3df5966f9453ecefcabc893f6449c8c4f1054aef) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/kernel/cryptodev-linux/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package/kernel/cryptodev-linux/Makefile b/package/kernel/cryptodev-linux/Makefile index ea1bd241617b7d..611d4ae27adf2f 100644 --- a/package/kernel/cryptodev-linux/Makefile +++ b/package/kernel/cryptodev-linux/Makefile @@ -36,8 +36,9 @@ define KernelPackage/cryptodev endef define KernelPackage/cryptodev/description - This is a driver for that allows to use the Linux kernel supported - hardware ciphers by user-space applications. + This driver allows use of the Linux kernel supported hardware-based + cryptographic and hash accelerators by user-space applications, + via a "/dev/crypto" device. endef define Build/Configure From 7424f58eb6cee31e8a34180c945c1037dc748980 Mon Sep 17 00:00:00 2001 From: Paul Donald Date: Sun, 10 Nov 2024 19:47:34 +0100 Subject: [PATCH 086/877] cryptodev-linux: change home-page URL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Most links and info on the org page are broken or defunct, and all new versions are available on the github based repo anyway. Signed-off-by: Paul Donald Link: https://github.com/openwrt/openwrt/pull/16910 Signed-off-by: Christian Marangi (cherry picked from commit ce0b843ac7d27e124cb9ca13e9a1aeb115fcaf23) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/kernel/cryptodev-linux/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kernel/cryptodev-linux/Makefile b/package/kernel/cryptodev-linux/Makefile index 611d4ae27adf2f..165cc60487b5b0 100644 --- a/package/kernel/cryptodev-linux/Makefile +++ b/package/kernel/cryptodev-linux/Makefile @@ -28,7 +28,7 @@ include $(INCLUDE_DIR)/package.mk define KernelPackage/cryptodev SUBMENU:=Cryptographic API modules TITLE:=Driver for cryptographic acceleration - URL:=http://cryptodev-linux.org/ + URL:=https://github.com/cryptodev-linux/cryptodev-linux DEPENDS:=+kmod-crypto-authenc +kmod-crypto-hash FILES:=$(PKG_BUILD_DIR)/cryptodev.$(LINUX_KMOD_SUFFIX) AUTOLOAD:=$(call AutoLoad,50,cryptodev) From 03984356bdb2d476dcd9c9115dca0c64599c94d0 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Wed, 6 Nov 2024 20:13:06 +0100 Subject: [PATCH 087/877] qualcommax: ipq60xx: add NSS reserved memory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It seems that despite NSS not being supported in OpenWrt the memory it usually uses needs to be reserved anyway for stability reasons. Link: https://github.com/openwrt/openwrt/pull/16928 Signed-off-by: Robert Marko (cherry picked from commit 8729d2a64d282d37b69c0853269af401a0102517) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- ...qcom-ipq6018-add-NSS-reserved-memory.patch | 27 +++++++++++++++++++ ...arm64-dts-qcom-ipq6018-add-wifi-node.patch | 2 +- ...07-soc-qcom-fix-smp2p-ack-on-ipq6018.patch | 2 +- ...pq6018-assign-QDSS_AT-clock-to-wifi-.patch | 2 +- 4 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 target/linux/qualcommax/patches-6.6/0140-arm64-dts-qcom-ipq6018-add-NSS-reserved-memory.patch diff --git a/target/linux/qualcommax/patches-6.6/0140-arm64-dts-qcom-ipq6018-add-NSS-reserved-memory.patch b/target/linux/qualcommax/patches-6.6/0140-arm64-dts-qcom-ipq6018-add-NSS-reserved-memory.patch new file mode 100644 index 00000000000000..84591c845dc5e7 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/0140-arm64-dts-qcom-ipq6018-add-NSS-reserved-memory.patch @@ -0,0 +1,27 @@ +From 7e102b1eb2ca3eff7a6f33ebeab17825e6f70956 Mon Sep 17 00:00:00 2001 +From: Robert Marko +Date: Mon, 4 Nov 2024 22:01:24 +0100 +Subject: [PATCH] arm64: dts: qcom: ipq6018: add NSS reserved memory + +It seems that despite NSS not being supported in OpenWrt the memory it +usually uses needs to be reserved anyway for stability reasons. + +Signed-off-by: Robert Marko +--- + arch/arm64/boot/dts/qcom/ipq6018.dtsi | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi ++++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi +@@ -199,6 +199,11 @@ + no-map; + }; + ++ nss_region: memory@40000000 { ++ reg = <0x0 0x40000000 0x0 0x01000000>; ++ no-map; ++ }; ++ + bootloader@4a100000 { + reg = <0x0 0x4a100000 0x0 0x400000>; + no-map; diff --git a/target/linux/qualcommax/patches-6.6/0906-arm64-dts-qcom-ipq6018-add-wifi-node.patch b/target/linux/qualcommax/patches-6.6/0906-arm64-dts-qcom-ipq6018-add-wifi-node.patch index f4968f1a4d1c99..d41244d65a6f39 100644 --- a/target/linux/qualcommax/patches-6.6/0906-arm64-dts-qcom-ipq6018-add-wifi-node.patch +++ b/target/linux/qualcommax/patches-6.6/0906-arm64-dts-qcom-ipq6018-add-wifi-node.patch @@ -15,7 +15,7 @@ Signed-off-by: Mantas Pucka --- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi +++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi -@@ -809,6 +809,102 @@ +@@ -814,6 +814,102 @@ }; }; diff --git a/target/linux/qualcommax/patches-6.6/0907-soc-qcom-fix-smp2p-ack-on-ipq6018.patch b/target/linux/qualcommax/patches-6.6/0907-soc-qcom-fix-smp2p-ack-on-ipq6018.patch index 094442a59bec6b..5154aad53163db 100644 --- a/target/linux/qualcommax/patches-6.6/0907-soc-qcom-fix-smp2p-ack-on-ipq6018.patch +++ b/target/linux/qualcommax/patches-6.6/0907-soc-qcom-fix-smp2p-ack-on-ipq6018.patch @@ -15,7 +15,7 @@ Signed-off-by: Mantas Pucka --- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi +++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi -@@ -1157,6 +1157,7 @@ +@@ -1162,6 +1162,7 @@ wcss_smp2p_out: master-kernel { qcom,entry-name = "master-kernel"; diff --git a/target/linux/qualcommax/patches-6.6/0909-arm64-dts-qcom-ipq6018-assign-QDSS_AT-clock-to-wifi-.patch b/target/linux/qualcommax/patches-6.6/0909-arm64-dts-qcom-ipq6018-assign-QDSS_AT-clock-to-wifi-.patch index a0528e7f50a21a..993d60870b82ce 100644 --- a/target/linux/qualcommax/patches-6.6/0909-arm64-dts-qcom-ipq6018-assign-QDSS_AT-clock-to-wifi-.patch +++ b/target/linux/qualcommax/patches-6.6/0909-arm64-dts-qcom-ipq6018-assign-QDSS_AT-clock-to-wifi-.patch @@ -13,7 +13,7 @@ Signed-off-by: Mantas Pucka --- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi +++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi -@@ -930,8 +930,8 @@ +@@ -935,8 +935,8 @@ "wcss_reset", "wcss_q6_reset"; From 11d36818b99463cb8709586011958b8fc9d36ca3 Mon Sep 17 00:00:00 2001 From: Sergey Matsievskiy Date: Fri, 8 Nov 2024 14:43:52 +0300 Subject: [PATCH 088/877] build: add comments to makefiles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add comments to build system makefile functions and variables to help developers in understanding build system internals and ease the development process. This patch adds some documentation examples with proposed doxygen-like syntax. Hopefully, this would start the discussion and result in generation of the makefile documentation guidelines. Signed-off-by: Sergey Matsievskiy Link: https://github.com/openwrt/openwrt/pull/16888 Signed-off-by: Christian Marangi (cherry picked from commit a72c8c770584075782959f2aa5c1487d68517edd) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- include/image.mk | 56 +++++++++++++++++++++++++++ include/target.mk | 34 ++++++++++++++--- rules.mk | 97 ++++++++++++++++++++++++++++++++++++++++------- 3 files changed, 169 insertions(+), 18 deletions(-) diff --git a/include/image.mk b/include/image.mk index a4ac1b49cf8aa4..9a4dff2167a14f 100644 --- a/include/image.mk +++ b/include/image.mk @@ -21,6 +21,11 @@ include $(INCLUDE_DIR)/rootfs.mk override MAKE:=$(_SINGLE)$(SUBMAKE) override NO_TRACE_MAKE:=$(_SINGLE)$(NO_TRACE_MAKE) +##@ +# @brief Convert size with unit postfix to unitless expression in bytes. +# +# @param 1: Size with unit. Possible unit postfix are `g`, `m`, `k`. +## exp_units = $(subst k, * 1024,$(subst m, * 1024k,$(subst g, * 1024m,$(1)))) target_params = $(subst +,$(space),$*) @@ -111,6 +116,12 @@ endef PROFILE_SANITIZED := $(call tolower,$(subst DEVICE_,,$(subst $(space),-,$(PROFILE)))) +##@ +# @brief Call function for each group of arguments. +# +# @param 1: List of lists of arguments. Lists are separated by `|`. +# @param 2: Function to call for list of arguments. +## define split_args $(foreach data, \ $(subst |,$(space),\ @@ -118,12 +129,24 @@ $(foreach data, \ $(call $(2),$(strip $(subst ^,$(space),$(data))))) endef +##@ +# @brief Call build function with arguments. +# +# @param 1: Function to call. Function name is prepended with `Build/`. +# @param 2...: Function arguments. +## define build_cmd $(if $(Build/$(word 1,$(1))),,$(error Missing Build/$(word 1,$(1)))) $(call Build/$(word 1,$(1)),$(wordlist 2,$(words $(1)),$(1))) endef +##@ +# @brief Call build functions from the list. +# +# @param 1: List of build functions with arguments, separated by `|`. +# First word in each group is a build command without `Build/` prefix. +## define concat_cmd $(call split_args,$(1),build_cmd) endef @@ -163,6 +186,12 @@ DTC_WARN_FLAGS := \ DTC_FLAGS += $(DTC_WARN_FLAGS) DTCO_FLAGS += $(DTC_WARN_FLAGS) +##@ +# @brief Pad file to specified size. +# +# @param 1: File. +# @param 2: Padding. +## define Image/pad-to dd if=$(1) of=$(1).new bs=$(2) conv=sync mv $(1).new $(1) @@ -403,26 +432,53 @@ define Device/InitProfile DEVICE_DESCRIPTION = Build firmware images for $$(DEVICE_TITLE) endef +##@ +# @brief Image configuration variables. +# +# @param 1: Device name. +## define Device/Init + ##@ Device name. DEVICE_NAME := $(1) + ##@ Commands to build kernel. + # Commands with arguments are separated by `|`. + ## KERNEL:= + ##@ Commands to build initramfs. + # Commands with arguments are separated by `|`. + ## KERNEL_INITRAMFS = $$(KERNEL) + ##@ Kernel command line. CMDLINE:= + ##@ Images to build. IMAGES := + ##@ Artifacts to build. ARTIFACTS := + ##@ Device image prefix. DEVICE_IMG_PREFIX := $(IMG_PREFIX)-$(1) + ##@ Device image name. DEVICE_IMG_NAME = $$(DEVICE_IMG_PREFIX)-$$(1)-$$(2) + ##@ Factory image name. FACTORY_IMG_NAME := + ##@ Maximum image size. Optional. IMAGE_SIZE := + ##@ Maximum image size. Optional. NAND_SIZE := + ##@ Kernel image prefix. KERNEL_PREFIX = $$(DEVICE_IMG_PREFIX) + ##@ Kernel image suffix. KERNEL_SUFFIX := -kernel.bin + ##@ Initramfs image suffix. KERNEL_INITRAMFS_SUFFIX = $$(KERNEL_SUFFIX) + ##@ Kernel image name. KERNEL_IMAGE = $$(KERNEL_PREFIX)$$(KERNEL_SUFFIX) + ##@ Initramfs image prefix. KERNEL_INITRAMFS_PREFIX = $$(DEVICE_IMG_PREFIX)-initramfs KERNEL_INITRAMFS_IMAGE = $$(KERNEL_INITRAMFS_PREFIX)$$(KERNEL_INITRAMFS_SUFFIX) + ##@ Initramfs image name. KERNEL_INITRAMFS_NAME = $$(KERNEL_NAME)-initramfs + ##@ Kernel install flag. KERNEL_INSTALL := KERNEL_NAME := vmlinux KERNEL_DEPENDS := diff --git a/include/target.mk b/include/target.mk index d13902ad6e78ec..0108bced99c963 100644 --- a/include/target.mk +++ b/include/target.mk @@ -7,10 +7,17 @@ ifneq ($(__target_inc),1) __target_inc=1 -# default device type +##@ +# @brief Default device type ( basic | nas | router ). +## DEVICE_TYPE?=router -# Default packages - the really basic set +##@ +# @brief Default packages. +# +# The really basic set. Additional packages are added based on @DEVICE_TYPE and +# @CONFIG_* values. +## DEFAULT_PACKAGES:=\ base-files \ ca-bundle \ @@ -27,15 +34,21 @@ DEFAULT_PACKAGES:=\ urandom-seed \ urngd -# For the basic set +##@ +# @brief Default packages for @DEVICE_TYPE basic. +## DEFAULT_PACKAGES.basic:= -# For nas targets +##@ +# @brief Default packages for @DEVICE_TYPE nas. +## DEFAULT_PACKAGES.nas:=\ block-mount \ fdisk \ lsblk \ mdadm -# For router targets +##@ +# @brief Default packages for @DEVICE_TYPE router. +## DEFAULT_PACKAGES.router:=\ dnsmasq \ firewall4 \ @@ -121,7 +134,18 @@ endif # Add device specific packages (here below to allow device type set from subtarget) DEFAULT_PACKAGES += $(DEFAULT_PACKAGES.$(DEVICE_TYPE)) +##@ +# @brief Filter out packages, prepended with `-`. +# +# @param 1: Package list. +## filter_packages = $(filter-out -% $(patsubst -%,%,$(filter -%,$(1))),$(1)) + +##@ +# @brief Append extra package dependencies. +# +# @param 1: Package list. +## extra_packages = $(if $(filter wpad wpad-% nas,$(1)),iwinfo) define ProfileDefault diff --git a/rules.mk b/rules.mk index 973fd1cbb90ea3..54df407fca4b95 100644 --- a/rules.mk +++ b/rules.mk @@ -20,6 +20,11 @@ endif export TMP_DIR:=$(TOPDIR)/tmp export TMPDIR:=$(TMP_DIR) +##@ +# @brief Strip quotes `"` and pounds `#` from string. +# +# @param 1: String. +## qstrip=$(strip $(subst ",,$(1))) #")) @@ -27,8 +32,23 @@ empty:= space:= $(empty) $(empty) comma:=, pound:=\# +##@ +# @brief Merge strings by removing spaces. +# +# @param 1: String. +## merge=$(subst $(space),,$(1)) +##@ +# @brief Get hash sum of variable list. +# +# @param 1: List of variable names. +## confvar=$(shell echo '$(foreach v,$(1),$(v)=$(subst ','\'',$($(v))))' | $(MKHASH) md5) +##@ +# @brief Strip last extension from file name. +# +# @param 1: File name. +## strip_last=$(patsubst %.$(lastword $(subst .,$(space),$(1))),%,$(1)) paren_left = ( @@ -51,9 +71,18 @@ __tr_head = $(subst $(paren_left)subst,$(paren_left)subst$(space),$(__tr_head_st __tr_tail = $(subst $(space),,$(foreach cv,$(1),$(paren_right))) __tr_template = $(__tr_head)$$(1)$(__tr_tail) +##@ +# @brief Convert string characters to upper. +## $(eval toupper = $(call __tr_template,$(chars_lower),$(chars_upper))) +##@ +# @brief Convert string characters to lower. +## $(eval tolower = $(call __tr_template,$(chars_upper),$(chars_lower))) +##@ +# @brief Abbreviate version. Truncate to 8 characters. +## version_abbrev = $(if $(if $(CHECK),,$(DUMP)),$(1),$(shell printf '%.8s' $(1))) _SINGLE=export MAKEFLAGS=$(space); @@ -102,6 +131,13 @@ endif DEFAULT_SUBDIR_TARGETS:=clean download prepare compile update refresh prereq dist distcheck configure check check-depends +##@ +# @brief Create default targets. +# +# Targets are created from @DEFAULT_SUBDIR_TARGETS and input argument lists. +# +# @param 1: Additional targets list. +## define DefaultTargets $(foreach t,$(DEFAULT_SUBDIR_TARGETS) $(1), .$(t): @@ -371,16 +407,28 @@ export BISON_PKGDATADIR:=$(STAGING_DIR_HOST)/share/bison export HOST_GNULIB_SRCDIR:=$(STAGING_DIR_HOST)/share/gnulib export M4:=$(STAGING_DIR_HOST)/bin/m4 +##@ +# @brief Slugify variable name and prepend suffix. +## define shvar V_$(subst .,_,$(subst -,_,$(subst /,_,$(1)))) endef +##@ +# @brief Create and export variable, set to function result. +# +# @param 1: Function name. Used as variable name, prepended with `V_`. +## define shexport export $(call shvar,$(1))=$$(call $(1)) endef +##@ +# @brief Support 64 bit tine in C code. +# # Test support for 64-bit time with C code from largefile.m4 provided by GNU Gnulib -# the value is 'y' when successful and '' otherwise +# the value is `y` when successful and `` otherwise +## define YEAR_2038 $(shell \ mkdir -p $(TMP_DIR); \ @@ -392,9 +440,12 @@ $(shell \ ) endef -# Execute commands under flock -# $(1) => The shell expression. -# $(2) => The lock name. If not given, the global lock will be used. +##@ +# @brief Execute commands under flock +# +# @param 1: The shell expression. +# @param 2: The lock name. If not given, the global lock will be used. +## ifneq ($(wildcard $(STAGING_DIR_HOST)/bin/flock),) define locked SHELL= \ @@ -406,10 +457,14 @@ else locked=$(1) endif -# Recursively copy paths into another directory, purge dangling + +##@ +# @brief Recursively copy paths into another directory, purge dangling # symlinks before. -# $(1) => File glob expression -# $(2) => Destination directory +# +# @param 1: File glob expression. +# @param 1: Destination directory. +## define file_copy for src_dir in $(sort $(foreach d,$(wildcard $(1)),$(dir $(d)))); do \ ( cd $$src_dir; find -type f -or -type d ) | \ @@ -424,19 +479,30 @@ define file_copy $(CP) $(1) $(2) endef -# Calculate sha256sum of any plain file within a given directory -# $(1) => Input directory -# $(2) => If set, recurse into subdirectories +##@ +# @brief Calculate sha256sum of any plain file within a given directory. +# +# @param 1: Input directory. +# @param 2: If set, recurse into subdirectories. +## define sha256sums (cd $(1); find . $(if $(2),,-maxdepth 1) -type f -not -name 'sha256sums' -printf "%P\n" | sort | \ xargs -r $(MKHASH) -n sha256 | sed -ne 's!^\(.*\) \(.*\)$$!\1 *\2!p' > sha256sums) endef -# file extension +##@ +# @brief Retrieve file extension. +# +# @param 1: File name. +## ext=$(word $(words $(subst ., ,$(1))),$(subst ., ,$(1))) -# Count Git commits of a package -# $(1) => if non-empty: count commits since last ": [uU]pdate to " or ": [bB]ump to " in commit message +##@ +# @brief Count Git commits of a package. +# +# @param 1: if non-empty: count commits since last ": [uU]pdate to " +# or ": [bB]ump to " in commit message. +## define commitcount $(shell \ if git log -1 >/dev/null 2>/dev/null; then \ @@ -458,6 +524,11 @@ $(shell \ ) endef +##@ +# @brief Get ABI version string, stripping `-`, `_` and `.`. +# +# @param 1: Version string. +## abi_version_str = $(subst -,,$(subst _,,$(subst .,,$(1)))) COMMITCOUNT = $(if $(DUMP),0,$(call commitcount)) From 2942ee0a8d205428afcca9cd9c0479b161246229 Mon Sep 17 00:00:00 2001 From: "David S. H. Rosenthal" Date: Wed, 6 Nov 2024 10:19:17 +0000 Subject: [PATCH 089/877] scripts: add download-check-artifact.sh script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While checking wiki documentation about GPG signatures checking I found this nice script and I've thought, that it would be nice to provide it officially instead of some random internet site. Usage example: $ ./scripts/download-check-artifact.sh https://downloads.openwrt.org/snapshots/targets/mediatek/filogic/openwrt-mediatek-filogic-openwrt_one-squashfs-sysupgrade.itb 1) Downloading image file ========================= ########################################### 100.0% 2) Downloading checksum file ============================ ########################################### 100.0% 3) Downloading the GPG signature ================================ ########################################### 100.0% 4) Verifying GPG signature ========================== gpg: Signature made Tue 05 Nov 2024 05:21:50 PM UTC gpg: using EDDSA key 92C561DE55AE6552F3C736B82B0151090606D1D9 gpg: Good signature from "OpenWrt Build System (Nitrokey3) " [ultimate] Primary key fingerprint: 8A8B C12F 46B8 36C0 F9CD B36F 1D53 D187 7742 E911 Subkey fingerprint: 92C5 61DE 55AE 6552 F3C7 36B8 2B01 5109 0606 D1D9 5) Verifying SHA256 checksum ============================ openwrt-mediatek-filogic-openwrt_one-squashfs-sysupgrade.itb: OK Verification done! ================== Downloaded artifact placed in '/var/home/ynezz/dev/openwrt/openwrt.git/openwrt-mediatek-filogic-openwrt_one-squashfs-sysupgrade.itb' Cleaning up. Adding file in a state as downloaded from https://www.abitare.org/bin/download.sh References: https://openwrt.org/docs/guide-quick-start/verify_firmware_checksum?s[]=gpg#linux Signed-off-by: David S. H. Rosenthal Link: https://github.com/openwrt/openwrt/pull/16871 (cherry picked from commit 4c9031fda271ed7d4503642f63ff824faa6cc3a0) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- scripts/download-check-artifact.sh | 154 +++++++++++++++++++++++++++++ 1 file changed, 154 insertions(+) create mode 100755 scripts/download-check-artifact.sh diff --git a/scripts/download-check-artifact.sh b/scripts/download-check-artifact.sh new file mode 100755 index 00000000000000..31868da5cd408e --- /dev/null +++ b/scripts/download-check-artifact.sh @@ -0,0 +1,154 @@ +#!/usr/bin/env bash +# Script to perform verified file downloads. +# Exit codes: +# 0 - File downloaded successfully and verified +# 1 - Failed to download requested file +# 2 - Failed to download sha256sums file +# 3 - Failed to download sha256sums.gpg file +# 4 - GnuPG is available but fails to verify the signature (missing pubkey, file integrity error, ...) +# 5 - The checksums do not match +# 6 - Unable to copy the requested file to its final destination +# 254 - The script got interrupted by a signal +# 255 - A suitable download or checksum utility is missing + +[ -n "$1" ] || { + echo "Usage: $0 " >&2 + exit 1 +} + +finish() { + [ -e "/tmp/verify.$$" ] && { + echo "Cleaning up." + rm -r "/tmp/verify.$$" + } + exit $1 +} + +trap "finish 254" INT TERM + +destdir="$(pwd)" +image_url="$1" +image_file="${image_url##*/}" +sha256_url="${image_url%/*}/sha256sums" +gpgsig_url="${image_url%/*}/sha256sums.asc" +keyserver_url="hkp://keyserver.ubuntu.com" + +# Find a suitable download utility +if which curl >/dev/null; then + download() { curl --progress-bar -o "$1" "$2"; } +elif which wget >/dev/null; then + download() { wget -O "$1" "$2"; } +elif which fetch >/dev/null; then + download() { fetch -o "$1" "$2"; } +else + echo "No suitable download utility found, cannot download files!" >&2 + finish 255 +fi + +# Find a suitable checksum utility +if which sha256sum >/dev/null; then + checksum() { sha256sum -c --ignore-missing "sha256sums"; } +elif which shasum >/dev/null; then + checksum() { + local sum="$(shasum -a 256 "$image_file")"; + grep -xF "${sum%% *} *$image_file" "sha256sums"; + } +else + echo "No SHA256 checksum executable installed, cannot verify checksums!" >&2 + finish 255 +fi + +# Check for gpg availability +if which gpg >/dev/null; then + runpgp() { gpg "$@"; } +else + runpgp() { + echo "WARNING: No GnuPG installed, cannot verify digital signature!" >&2 + return 0 + } +fi + +mkdir -p "/tmp/verify.$$" +cd "/tmp/verify.$$" + +echo "" +echo "1) Downloading image file" +echo "=========================" +download "$image_file" "$image_url" || { + echo "Failed to download image file!" >&2 + finish 1 +} + +echo "" +echo "2) Downloading checksum file" +echo "============================" +download "sha256sums" "$sha256_url" || { + echo "Failed to download checksum file!" >&2 + finish 2 +} + +echo "" +echo "3) Downloading the GPG signature" +echo "================================" +download "sha256sums.gpg" "$gpgsig_url" || { + echo "Failed to download GPG signature!" >&2 + finish 3 +} + +echo "" +echo "4) Verifying GPG signature" +echo "==========================" +missing_key=$(runpgp --status-fd 1 --with-fingerprint --verify \ + "sha256sums.gpg" "sha256sums" 2>/dev/null | sed -ne 's!^.* NO_PUBKEY !!p') + +if [ -n "$missing_key" ]; then + echo "The signature was signed by a public key with the id $missing_key" >&2 + echo "which is not present on this system." >&2 + echo "" >&2 + + echo "Provide a public keyserver url below or press enter to accept the" >&2 + echo "default suggestion. Hit Ctrl-C to abort the operation." >&2 + echo "" >&2 + + while true; do + printf "Keyserver to use? [$keyserver_url] > " + read url; case "${url:-$keyserver_url}" in + hkp://*) + gpg --keyserver "${url:-$keyserver_url}" --recv-keys "$missing_key" || { + echo "Failed to download public key." >&2 + finish 7 + } + break + ;; + *) + echo "Expecting a key server url in the form 'hkp://hostname'." >&2 + ;; + esac + done +fi + +runpgp --with-fingerprint --verify "sha256sums.gpg" "sha256sums" || { + echo "Failed to verify checksum file with GPG signature!" >&2 + finish 4 +} + +echo "" +echo "5) Verifying SHA256 checksum" +echo "============================" +checksum || { + echo "Checksums do not match!" >&2 + finish 5 +} + +cp "$image_file" "$destdir/$image_file" || { + echo "Failed to write '$destdir/$image_file'" >&2 + finish 6 +} + +echo "" +echo "Verification done!" +echo "==================" +echo "Firmware image placed in '$destdir/$image_file'." +echo "" + +finish 0 From 8f0d52d8c42234ffd6292e6e2d6490987c92e624 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Wed, 6 Nov 2024 10:40:37 +0000 Subject: [PATCH 090/877] scripts: download-check-artifact.sh: fix shellcheck and improve MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes following shellcheck's recommendations: In scripts/download-check-artifact.sh line 24: exit $1 ^-- SC2086 (info): Double quote to prevent globbing and word splitting. In scripts/download-check-artifact.sh line 53: local sum="$(shasum -a 256 "$image_file")"; ^-^ SC2155 (warning): Declare and assign separately to avoid masking return values. In scripts/download-check-artifact.sh line 72: cd "/tmp/verify.$$" ^-----------------^ SC2164 (warning): Use 'cd ... || exit' or 'cd ... || return' in case cd fails. In scripts/download-check-artifact.sh line 114: printf "Keyserver to use? [$keyserver_url] > " ^-- SC2059 (info): Don't use variables in the printf format string. Use printf '..%s..' "$foo". In scripts/download-check-artifact.sh line 115: read url; case "${url:-$keyserver_url}" in ^--^ SC2162 (info): read without -r will mangle backslashes. While at it make it clear, that it is possible to download/check any build artifacts like even SDK or ImageBuilder. Link: https://github.com/openwrt/openwrt/pull/16871 (cherry picked from commit 27c2c140b16cb490f20c1c2259b3decf50ae5762) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- scripts/download-check-artifact.sh | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/scripts/download-check-artifact.sh b/scripts/download-check-artifact.sh index 31868da5cd408e..bc0918b2146388 100755 --- a/scripts/download-check-artifact.sh +++ b/scripts/download-check-artifact.sh @@ -12,6 +12,7 @@ # 255 - A suitable download or checksum utility is missing [ -n "$1" ] || { + echo "$0 - Download and verify build artifacts" echo "Usage: $0 " >&2 exit 1 } @@ -21,7 +22,7 @@ finish() { echo "Cleaning up." rm -r "/tmp/verify.$$" } - exit $1 + exit "$1" } trap "finish 254" INT TERM @@ -50,7 +51,8 @@ if which sha256sum >/dev/null; then checksum() { sha256sum -c --ignore-missing "sha256sums"; } elif which shasum >/dev/null; then checksum() { - local sum="$(shasum -a 256 "$image_file")"; + local sum + sum="$(shasum -a 256 "$image_file")"; grep -xF "${sum%% *} *$image_file" "sha256sums"; } else @@ -68,11 +70,14 @@ else } fi -mkdir -p "/tmp/verify.$$" -cd "/tmp/verify.$$" +tmpdir="$(mktemp -d)" +cd "$tmpdir" || { + echo "Failed to create temporary directory!" >&2 + finish 255 +} echo "" -echo "1) Downloading image file" +echo "1) Downloading artifact file" echo "=========================" download "$image_file" "$image_url" || { echo "Failed to download image file!" >&2 @@ -111,8 +116,8 @@ if [ -n "$missing_key" ]; then echo "" >&2 while true; do - printf "Keyserver to use? [$keyserver_url] > " - read url; case "${url:-$keyserver_url}" in + printf 'Keyserver to use? [%s] > ' "$keyserver_url" + read -r url; case "${url:-$keyserver_url}" in hkp://*) gpg --keyserver "${url:-$keyserver_url}" --recv-keys "$missing_key" || { echo "Failed to download public key." >&2 @@ -148,7 +153,7 @@ cp "$image_file" "$destdir/$image_file" || { echo "" echo "Verification done!" echo "==================" -echo "Firmware image placed in '$destdir/$image_file'." +echo "Downloaded artifact placed in '$destdir/$image_file'." echo "" finish 0 From 2226546e1c07ca442ccd89bb0dad54776c216d89 Mon Sep 17 00:00:00 2001 From: Enrico Mioso Date: Sat, 9 Nov 2024 22:14:31 +0100 Subject: [PATCH 091/877] uboot-mediatek: add support for GatoNetworks GDSP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The GatoNetworks GDSP is a re-branded version of the R5000 5G Industrial router from Yinghua Technologies. Advantages over stock bootloader: 1. supports serving the external GPIO WDT, allowing for easier work in U-Boot shell 2. supports cool features like netconsole, easy recovery, scripting and so on 3. allows using FIT image and image integrity validation and ultimately gives you much more flexibility to implement your tweaks. Known issues ------------ To make it easier to operate the device, console I/O multiplexing support has been enabled in U-Boot configuration. Setting I/O related U-Boot environment variables to something like "serial,nc" will have the desired effect. Still, setting these variables to such a value in the persistent environment will lead to a crash and make it impossible to boot the system or recover it. I decided to leave it on anyway since I think it can be very practical in development. Signed-off-by: Enrico Mioso (cherry picked from commit 7f2c7b3238ee26180d44528ae98fd2f54e874511) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/boot/uboot-mediatek/Makefile | 14 + ...ialized-the-watchdog-subsystem-later.patch | 54 +++ .../patches/458-add-GatoNetworks-GDSP.patch | 406 ++++++++++++++++++ 3 files changed, 474 insertions(+) create mode 100644 package/boot/uboot-mediatek/patches/457-initialized-the-watchdog-subsystem-later.patch create mode 100644 package/boot/uboot-mediatek/patches/458-add-GatoNetworks-GDSP.patch diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile index 34857653688117..d2a03277d4057d 100644 --- a/package/boot/uboot-mediatek/Makefile +++ b/package/boot/uboot-mediatek/Makefile @@ -364,6 +364,19 @@ define U-Boot/mt7981_rfb-emmc DEPENDS:=+trusted-firmware-a-mt7981-emmc-ddr3 endef +define U-Boot/mt7981_gatonetworks_gdsp + NAME:=GatoNetworks GDSP + BUILD_SUBTARGET:=filogic + BUILD_DEVICES:=gatonetworks_gdsp + UBOOT_CONFIG:=mt7981_gatonetworks_gdsp + UBOOT_IMAGE:=u-boot.fip + BL2_BOOTDEV:=nor + BL2_SOC:=mt7981 + BL2_DDRTYPE:=ddr3 + DEPENDS:=+trusted-firmware-a-mt7981-nor-ddr3 + FIP_COMPRESS:=1 +endef + define U-Boot/mt7981_rfb-nor NAME:=MT7981 Reference Board BUILD_SUBTARGET:=filogic @@ -797,6 +810,7 @@ UBOOT_TARGETS := \ mt7981_abt_asr3000 \ mt7981_cmcc_rax3000m-emmc \ mt7981_cmcc_rax3000m-nand \ + mt7981_gatonetworks_gdsp \ mt7981_glinet_gl-x3000 \ mt7981_glinet_gl-xe3000 \ mt7981_h3c_magic-nx30-pro \ diff --git a/package/boot/uboot-mediatek/patches/457-initialized-the-watchdog-subsystem-later.patch b/package/boot/uboot-mediatek/patches/457-initialized-the-watchdog-subsystem-later.patch new file mode 100644 index 00000000000000..7919b365601a7a --- /dev/null +++ b/package/boot/uboot-mediatek/patches/457-initialized-the-watchdog-subsystem-later.patch @@ -0,0 +1,54 @@ +From 9c1ad8a18ac1a20aee7a617964bcae3e90dac700 Mon Sep 17 00:00:00 2001 +From: Enrico Mioso +Date: Wed, 23 Oct 2024 17:46:35 +0200 +Subject: [PATCH] uboot-mediatek: initialized the watchdog subsystem later + +Initialize the watchdog subsystem later during initialization, to allow for +the gpio-wdt driver to work. + +Signed-off-by: Enrico Mioso +--- + common/board_r.c | 11 ++++------- + 1 file changed, 4 insertions(+), 7 deletions(-) + +--- a/common/board_r.c ++++ b/common/board_r.c +@@ -663,19 +663,13 @@ static init_fnc_t init_sequence_r[] = { + serial_initialize, + initr_announce, + dm_announce, +-#if CONFIG_IS_ENABLED(WDT) +- initr_watchdog, +-#endif +- INIT_FUNC_WATCHDOG_RESET + arch_initr_trap, + #if defined(CONFIG_BOARD_EARLY_INIT_R) + board_early_init_r, + #endif +- INIT_FUNC_WATCHDOG_RESET + #ifdef CONFIG_POST + post_output_backlog, + #endif +- INIT_FUNC_WATCHDOG_RESET + #if defined(CONFIG_PCI_INIT_R) && defined(CONFIG_SYS_EARLY_PCI_INIT) + /* + * Do early PCI configuration _before_ the flash gets initialised, +@@ -690,7 +684,6 @@ static init_fnc_t init_sequence_r[] = { + #ifdef CONFIG_MTD_NOR_FLASH + initr_flash, + #endif +- INIT_FUNC_WATCHDOG_RESET + #if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_X86) + /* initialize higher level parts of CPU like time base and timers */ + cpu_init_r, +@@ -719,6 +712,10 @@ static init_fnc_t init_sequence_r[] = { + #ifdef CONFIG_PVBLOCK + initr_pvblock, + #endif ++#if CONFIG_IS_ENABLED(WDT) ++ initr_watchdog, ++#endif ++ INIT_FUNC_WATCHDOG_RESET + initr_env, + #ifdef CONFIG_SYS_MALLOC_BOOTPARAMS + initr_malloc_bootparams, diff --git a/package/boot/uboot-mediatek/patches/458-add-GatoNetworks-GDSP.patch b/package/boot/uboot-mediatek/patches/458-add-GatoNetworks-GDSP.patch new file mode 100644 index 00000000000000..28bdd95e15355d --- /dev/null +++ b/package/boot/uboot-mediatek/patches/458-add-GatoNetworks-GDSP.patch @@ -0,0 +1,406 @@ +From 57d0f608d925cb688b5c9b71512fca7d228f07f6 Mon Sep 17 00:00:00 2001 +From: Enrico Mioso +Date: Wed, 23 Oct 2024 20:39:28 +0200 +Subject: [PATCH] add GatoNetworks GDSP + +Signed-off-by: Enrico Mioso +--- + arch/arm/dts/mt7981-gatonetworks_gdsp.dts | 200 +++++++++++++++++++++ + configs/mt7981_gatonetworks_gdsp_defconfig | 144 +++++++++++++++ + gatonetworks_gdsp_env | 38 ++++ + 3 files changed, 382 insertions(+) + create mode 100644 arch/arm/dts/mt7981-gatonetworks_gdsp.dts + create mode 100644 configs/mt7981_gatonetworks_gdsp_defconfig + create mode 100644 gatonetworks_gdsp_env + +--- /dev/null ++++ b/arch/arm/dts/mt7981-gatonetworks_gdsp.dts +@@ -0,0 +1,200 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++ ++/dts-v1/; ++#include "mt7981.dtsi" ++#include ++#include ++ ++/ { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ model = "GatoNetworks GDSP"; ++ compatible = "gatonetworks,gdsp", "mediatek,mt7981"; ++ chosen { ++ stdout-path = &uart0; ++ tick-timer = &timer0; ++ }; ++ ++ memory { ++ device_type = "memory"; ++ reg = <0x40000000 0x10000000>; ++ }; ++ ++ keys { ++ compatible = "gpio-keys"; ++ ++ reset { ++ label = "reset"; ++ linux,code = ; ++ gpios = <&gpio 1 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ sim1 { ++ label = "sim1"; ++ gpios = <&gpio 13 GPIO_ACTIVE_LOW>; ++ }; ++ ++ sim2 { ++ label = "sim2"; ++ gpios = <&gpio 0 GPIO_ACTIVE_LOW>; ++ }; ++ ++ sg1 { ++ label = "sg1"; ++ gpios = <&gpio 10 GPIO_ACTIVE_LOW>; ++ }; ++ ++ sg2 { ++ label = "sg2"; ++ gpios = <&gpio 11 GPIO_ACTIVE_LOW>; ++ }; ++ ++ sg3 { ++ label = "sg3"; ++ gpios = <&gpio 12 GPIO_ACTIVE_LOW>; ++ }; ++ ++ sg4 { ++ label = "sg4"; ++ gpios = <&gpio 7 GPIO_ACTIVE_LOW>; ++ }; ++ ++ sg5 { ++ label = "sg5"; ++ gpios = <&gpio 8 GPIO_ACTIVE_LOW>; ++ }; ++ ++ sg6 { ++ label = "sg6"; ++ gpios = <&gpio 9 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ gpio-watchdog { ++ compatible = "linux,wdt-gpio"; ++ gpios = <&gpio 6 GPIO_ACTIVE_LOW>; ++ hw_algo = "toggle"; ++ hw_margin_ms = <25000>; ++ always-running; ++ u-boot,autostart; ++ }; ++}; ++ ++ð { ++ 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; ++ }; ++}; ++ ++&spi2 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi2_flash_pins>; ++ status = "okay"; ++ must_tx; ++ enhance_timing; ++ dma_ext; ++ ipm_design; ++ support_quad; ++ tick_dly = <2>; ++ sample_sel = <0>; ++ ++ flash@0 { ++ 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>; ++ read-only; ++ }; ++ ++ partition@40000 { ++ label = "u-boot-env"; ++ reg = <0x40000 0x0010000>; ++ }; ++ ++ partition@50000 { ++ label = "Factory"; ++ reg = <0x50000 0x00B0000>; ++ read-only; ++ }; ++ ++ partition@100000 { ++ label = "FIP"; ++ reg = <0x100000 0x0080000>; ++ }; ++ ++ partition@180000 { ++ label = "firmware"; ++ reg = <0x180000 0x1E80000>; ++ }; ++ }; ++ }; ++}; ++ ++&pinctrl { ++ uart1_pins: uart1-pins { ++ mux { ++ function = "uart"; ++ groups = "uart1_0"; ++ }; ++ }; ++ ++ uart2_pins: uart2-pins { ++ mux { ++ function = "uart"; ++ groups = "uart2_0_tx_rx"; ++ }; ++ }; ++ ++ spi2_flash_pins: spi2-pins { ++ mux { ++ function = "spi"; ++ groups = "spi2", "spi2_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 = ; ++ }; ++ }; ++}; ++ ++&uart0 { ++ status = "okay"; ++}; ++ ++&uart1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart1_pins>; ++ status = "okay"; ++}; ++ ++&uart2 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart2_pins>; ++ status = "okay"; ++}; +--- /dev/null ++++ b/configs/mt7981_gatonetworks_gdsp_defconfig +@@ -0,0 +1,144 @@ ++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=0x10000 ++CONFIG_ENV_OFFSET=0x0 ++CONFIG_DEFAULT_DEVICE_TREE="mt7981-gatonetworks_gdsp" ++CONFIG_OF_LIBFDT_OVERLAY=y ++CONFIG_TARGET_MT7981=y ++CONFIG_WATCHDOG_TIMEOUT_MSECS=25000 ++CONFIG_DEBUG_UART_BASE=0x11002000 ++CONFIG_DEBUG_UART_CLOCK=40000000 ++CONFIG_SYS_LOAD_ADDR=0x46000000 ++CONFIG_DEBUG_UART=y ++CONFIG_FIT=y ++CONFIG_SPI_BOOT=y ++CONFIG_AUTOBOOT_MENU_SHOW=y ++CONFIG_USE_PREBOOT=y ++CONFIG_DEFAULT_FDT_FILE="mt7981-gatonetworks_gdsp" ++CONFIG_SYS_CBSIZE=512 ++CONFIG_SYS_PBSIZE=1049 ++CONFIG_LOGLEVEL=7 ++CONFIG_CONSOLE_MUX=y ++CONFIG_LOG=y ++CONFIG_BOARD_LATE_INIT=y ++CONFIG_HUSH_PARSER=y ++CONFIG_SYS_PROMPT="GDSP> " ++CONFIG_SYS_MAXARGS=16 ++CONFIG_CMD_BDINFO_EXTRA=y ++CONFIG_CMD_CPU=y ++CONFIG_CMD_HISTORY=y ++CONFIG_CMD_LICENSE=y ++# 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_BOOTEFI_BOOTMGR is not set ++CONFIG_CMD_BOOTMENU=y ++CONFIG_CMD_ASKENV=y ++CONFIG_CMD_ERASEENV=y ++CONFIG_CMD_ENV_CALLBACK=y ++CONFIG_CMD_ENV_FLAGS=y ++CONFIG_CRC32_VERIFY=y ++CONFIG_LOOPW=y ++CONFIG_CMD_MEMINFO=y ++CONFIG_CMD_MEMTEST=y ++CONFIG_CMD_STRINGS=y ++# CONFIG_CMD_UNLZ4 is not set ++# CONFIG_CMD_UNZIP is not set ++CONFIG_CMD_DM=y ++CONFIG_CMD_GPIO=y ++CONFIG_CMD_GPIO_READ=y ++CONFIG_CMD_PWM=y ++CONFIG_CMD_MTD=y ++# CONFIG_CMD_NAND_EXT is not set ++CONFIG_CMD_SF_TEST=y ++CONFIG_CMD_CAT=y ++CONFIG_CMD_SETEXPR_FMT=y ++CONFIG_CMD_XXD=y ++CONFIG_CMD_DHCP=y ++CONFIG_CMD_TFTPPUT=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_PXE=y ++CONFIG_CMD_CACHE=y ++# CONFIG_CMD_EFICONFIG is not set ++CONFIG_CMD_PSTORE=y ++CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000 ++CONFIG_CMD_UUID=y ++CONFIG_CMD_HASH=y ++CONFIG_CMD_SMC=y ++CONFIG_CMD_FAT=y ++CONFIG_CMD_FS_GENERIC=y ++CONFIG_CMD_FS_UUID=y ++CONFIG_ENV_OVERWRITE=y ++CONFIG_ENV_IS_IN_MTD=y ++CONFIG_ENV_MTD_NAME="u-boot-env" ++CONFIG_ENV_SIZE_REDUND=0x0 ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_USE_DEFAULT_ENV_FILE=y ++CONFIG_DEFAULT_ENV_FILE="gatonetworks_gdsp_env" ++CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y ++CONFIG_VERSION_VARIABLE=y ++CONFIG_NET_RANDOM_ETHADDR=y ++CONFIG_NETCONSOLE=y ++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_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_UBI_SILENCE_MSG=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_MT7981=y ++CONFIG_POWER_DOMAIN=y ++CONFIG_MTK_POWER_DOMAIN=y ++CONFIG_DM_PWM=y ++CONFIG_PWM_MTK=y ++CONFIG_DM_SERIAL=y ++CONFIG_MTK_SERIAL=y ++CONFIG_SPI=y ++CONFIG_DM_SPI=y ++CONFIG_MTK_SPIM=y ++CONFIG_USB=y ++CONFIG_USB_XHCI_HCD=y ++CONFIG_USB_XHCI_MTK=y ++CONFIG_USB_STORAGE=y ++CONFIG_WDT=y ++CONFIG_WDT_GPIO=y ++CONFIG_UBIFS_SILENCE_MSG=y ++CONFIG_HEXDUMP=y ++CONFIG_LMB_MAX_REGIONS=64 +--- /dev/null ++++ b/gatonetworks_gdsp_env +@@ -0,0 +1,38 @@ ++load_factory_data=if env exists factory_data_present ; then else mtd read Factory $loadaddr 0x0 0x1000 ; setenv factory_data_present 1 ; fi ++lan_mac_factory=run load_factory_data ; setexpr macoffs $loadaddr + 0x2a ; env readmem -b lan_mac $macoffs 0x6 ; setenv lan_mac_factory ; setenv macoffs ++wan_mac_factory=run load_factory_data ; setexpr macoffs $loadaddr + 0x24 ; env readmem -b wan_mac $macoffs 0x6 ; setenv wan_mac_factory ; setenv macoffs ++label_mac_factory=run load_factory_data ; setexpr macoffs $loadaddr + 0x4 ; env readmem -b label_mac $macoffs 0x6 ; setenv label_mac_factory ; setenv macoffs ++ethaddr_factory=setenv ethaddr $lan_mac ; setenv ethaddr_factory ++wifi_mac_factory=setenv wifi_mac $label_mac ; setenv wifi_mac_factory ++env_cleanup=setenv load_factory_data ; setenv factory_data_present ; setenv env_cleanup ++ipaddr=192.168.1.1 ++serverip=192.168.1.10 ++loadaddr=0x46000000 ++bootcmd=run boot_nor ++bootdelay=0 ++bootfile=openwrt-mediatek-filogic-gatonetworks_gdsp-initramfs-kernel.bin ++bootfile_upg=openwrt-mediatek-filogic-gatonetworks_gdsp-squashfs-sysupgrade.bin ++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 system from flash.=run boot_nor ; run bootmenu_confirm_return ++bootmenu_3=Load system via TFTP then write to flash.=run boot_tftp_sysupgrade ; run bootmenu_confirm_return ++bootmenu_4=Reset all settings to factory defaults.=run reset_factory ; reset ++bootmenu_5=Reboot.=reset ++boot_first=if button reset ; then run boot_tftp ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu ++boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_tftp_forever ++boot_nor=mtd read firmware ${loadaddr} ; bootm $loadaddr ++boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr ++boot_tftp_forever=while true ; do run boot_tftp ; sleep 1 ; done ++boot_tftp_sysupgrade=tftpboot $loadaddr $bootfile_upg && iminfo $loadaddr && run nor_write_production ++reset_factory=env default -a && saveenv && reset ++nor_pad_size=setexpr image_eb $filesize / 0x1000 ; setexpr tmp1 image_size % 0x1000 ; test 0x$tmp1 -gt 0 && setexpr image_eb $image_eb + 1 ; setexpr image_eb $image_eb * 0x1000 ++nor_write_production=run nor_pad_size ; test 0x$image_eb -le 0x1e80000 && mtd erase firmware 0x0 0x$image_eb && mtd write firmware $loadaddr 0x0 $filesize ++_init_env=setenv _init_env ; saveenv ++_firstboot=setenv _firstboot ; run _switch_to_menu ; run lan_mac_factory ; run wan_mac_factory ; run label_mac_factory ; run env_cleanup ; run ethaddr_factory ; run wifi_mac_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" From 7d9fc260a1e56299a17eb23f1ba0ccda13fb445d Mon Sep 17 00:00:00 2001 From: Enrico Mioso Date: Sat, 9 Nov 2024 22:14:32 +0100 Subject: [PATCH 092/877] uboot-envtools: add support for GatoNetworks GDSP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This configuration should work with both stock and OpenWrt-based U-Boot. Signed-off-by: Enrico Mioso (cherry picked from commit 785ebf2baff4adadf818d71a99fdb2d2300590ba) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- 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 a38024de65976b..9de1a4d75ddc96 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -86,6 +86,9 @@ zbtlink,zbt-z8103ax) dlink,aquila-pro-ai-m30-a1) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x40000" "0x40000" ;; +gatonetworks,gdsp) + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000" + ;; glinet,gl-x3000|\ glinet,gl-xe3000|\ glinet,gl-mt2500|\ From f2a40e11176f74adba1228880725af7a95ebfaf0 Mon Sep 17 00:00:00 2001 From: Enrico Mioso Date: Sat, 9 Nov 2024 22:14:33 +0100 Subject: [PATCH 093/877] mediatek: filogic: add support for GatoNetworks GDSP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The GatoNetworks GDSP is a re-branded version of the R5000 5G Industrial router from Yinghua Technologies. The re-branded device comes with OpenWrt preinstalled, and an OpenWrt-based U-Boot bootloader version. While the flash layout has been kept compatible with the OpenWrt version found on the stock device (see [5]), the image format changed, making a bootloader upgrade necessary. Specifications: SoC: Mediatek MT7981BA RAM: 256MB Flash: SPI-NOR 32 MiB (Winbond W25Q256) WLAN: MT7976CN DBDC AX Wi-Fi Switch: MT7531AE (4x LAN Gigabit ports, 1x WAN Gigabit port) 5G: Quectel RM520N modem Watchdog: an external WDT connected to GPIO 6 is present and always running; the built-in Mediatek watchdog is also present and effective, but not used at the moment. This porting has been tested only with 1x 5G modems installed (the device supports up to two). Installation: Installation is possible via sysupgrade both in the stock device and re-branded version. However, in the former case, updating the bootloader is required. OpenWrt-based U-Boot Bootloader installation -------------------------------------------- The firmware flashed in the re-branded device at manifacturing time will flash an OpenWrt-based U-Boot bootloader with some extra recovery features (see [1]) at first boot. To update the bootloader, you need to install the mtd-rw module and insmod it: insmod mtd-rw i_want_a_brick=1 Then update relevant flash partitions: mtd erase u-boot-env mtd erase BL2 mtd erase FIP mtd write openwrt-mediatek-filogic-gatonetworks_gdsp-preloader.bin BL2 mtd write openwrt-mediatek-filogic-gatonetworks_gdsp-bl31-uboot.fip FIP And reboot, making sure all previous commands ran succesfully. If something goes wrong, you can recover your device via the mtk_uartboot tool. In my testing, it was possible to start the process even without (un)-plugging the device, may be handy for remote recovery. Installation from stock device and firmware ------------------------------------------- To install vanilla OpenWrt in the stock device (R5000 5G Industrial router from Yinghua Technologies) running the stock vendor firmware, you will need to update your bootloader as described in previous section. Remember to use -F (force upgrade) and -n (not keeping settings). U-Boot Recovery --------------- This procedure has been tested only with the OpenWrt-based U-boot bootloader. Assign your system static IP address 192.168.1.1 and start a TFTP server. The device will look for an initramfs image named openwrt-mediatek-filogic-gatonetworks_gdsp-initramfs-kernel.bin (so you may use openwrt/bin/targets/mediatek/filogic as root dir for your TFTP server). Power on the device while keeping the reset button pressed, until you see a TFTP request from 192.168.1.10. Your environment will be restored to it's default state. MAC addresses assignment ------------------------ MAC addresses are assigned slightly differently than in stock firmware. In particular, the 5 GHz Wi-Fi uses 2.4 GHZ MAC + 1, rather than reusing it with LA bit set as done in stock firmware. This MAC address is allocated to the device, so it can be used. The 2.4 GHz Wi-Fi MAC address is the label MAC. LAN MAC is used to set the special U-Boot environment ethaddr variable. device MAC address U-Boot env variable factory partition offset 2.4 GHz Wi-Fi :84 wifi_mac 0x4 5.8 GHz Wi-Fi :85 not present not present WAN :86 wan_mac 0x24 LAN :87 lan_mac 0x2A Notes ----- [1]: the OpenWrt-based U-Boot bootloader you will find installed in the re-branded device is configured to request for the initramfs image via TFTP for $gdsp_tftp_tries times before trying normal boot from NOR flash. Setting this U-Boot environment variable to 0x0 will disable the feature, which is not implemented in this patch. [2]: the exposed UART port is connected to ttyS1; the ttyS0 console port is not exposed. [3]: the provided bootloader environment has no provision for operating on BL2 and the FIP partitions. This is an intentional choice to make it (slightly) more difficult to brick the device. [4]: it seems GPIO 6 is used both for the "SYS" LED and external WDT. [5] BL2 expects to find FIP payload at a fixed offset, so some constraints apply. Signed-off-by: Enrico Mioso (cherry picked from commit b43194e041b17fbb574fb3721dafedcc30a20ab5) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- .../dts/mt7981b-gatonetworks-gdsp.dts | 389 ++++++++++++++++++ .../base-files/lib/upgrade/platform.sh | 1 + target/linux/mediatek/image/filogic.mk | 20 + 3 files changed, 410 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7981b-gatonetworks-gdsp.dts diff --git a/target/linux/mediatek/dts/mt7981b-gatonetworks-gdsp.dts b/target/linux/mediatek/dts/mt7981b-gatonetworks-gdsp.dts new file mode 100644 index 00000000000000..fd9fdca12404d5 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-gatonetworks-gdsp.dts @@ -0,0 +1,389 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include "mt7981.dtsi" + +/ { + model = "GatoNetworks GDSP"; + compatible = "gatonetworks,gdsp", "mediatek,mt7981"; + + aliases { + serial0 = &uart0; + label-mac-device = &wifi_band_0; + led-boot = &sg1; + led-failsafe = &sg1; + led-running = &sg1; + led-upgrade = &sg1; + }; + + chosen { + stdout-path = "serial0:115200n8"; + bootargs = "console=ttyS0,115200n1 earlycon=uart8250,mmio32,0x11002000"; + rootdisk = <&firmware>; + }; + + 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_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>; + }; + }; + + gpio-export { + compatible = "gpio-export"; + + modem1 { + gpio-export,name = "modem1"; + gpio-export,output = <0>; + gpios = <&pio 2 GPIO_ACTIVE_LOW>; + }; + + modem2 { + gpio-export,name = "modem2"; + gpio-export,output = <0>; + gpios = <&pio 14 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + + sim1 { + label = "green:sim1"; + gpios = <&pio 13 GPIO_ACTIVE_LOW>; + }; + + sim2 { + label = "green:sim2"; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + }; + + sg1: sg1 { + label = "green:sg1"; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + }; + + sg2 { + label = "green:sg2"; + gpios = <&pio 11 GPIO_ACTIVE_LOW>; + }; + + sg3 { + label = "green:sg3"; + gpios = <&pio 12 GPIO_ACTIVE_LOW>; + }; + + sg4 { + label = "green:sg4"; + gpios = <&pio 7 GPIO_ACTIVE_LOW>; + }; + + sg5 { + label = "green:sg5"; + gpios = <&pio 8 GPIO_ACTIVE_LOW>; + }; + + sg6 { + label = "green:sg6"; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-watchdog { + compatible = "linux,wdt-gpio"; + gpios = <&pio 6 GPIO_ACTIVE_LOW>; + hw_algo = "toggle"; + hw_margin_ms = <25000>; + always-running; + }; +}; + +&watchdog { + status = "okay"; +}; + +ð { + 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: mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + + switch@1f { + compatible = "mediatek,mt7531"; + reg = <31>; + reset-gpios = <&pio 39 0>; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&pio>; + interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; + + mdio { + #address-cells = <1>; + #size-cells = <0>; + + swphy0: phy@0 { + reg = <0>; + }; + + swphy1: phy@1 { + reg = <1>; + }; + + swphy2: phy@2 { + reg = <2>; + }; + + swphy3: phy@3 { + reg = <3>; + }; + + swphy4: phy@4 { + reg = <4>; + }; + }; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan1"; + phy-handle = <&swphy0>; + }; + + port@1 { + reg = <1>; + label = "lan2"; + phy-handle = <&swphy1>; + }; + + port@2 { + reg = <2>; + label = "lan3"; + phy-handle = <&swphy2>; + }; + + port@3 { + reg = <3>; + label = "lan4"; + phy-handle = <&swphy3>; + }; + + port@4 { + reg = <4>; + label = "wan"; + nvmem-cells = <&macaddr_wan>; + nvmem-cell-names = "mac-address"; + phy-handle = <&swphy4>; + }; + + port@6 { + reg = <6>; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; + }; + }; +}; + +&crypto { + status = "okay"; +}; + +&wifi { + mediatek,mtd-eeprom = <&factory 0x0>; + status = "okay"; + + wifi_band_0: band@0 { + reg = <0>; + nvmem-cells = <&macaddr_wifi 0>; + nvmem-cell-names = "mac-address"; + }; + + band@1 { + reg = <1>; + nvmem-cells = <&macaddr_wifi 1>; + nvmem-cell-names = "mac-address"; + }; +}; + +&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>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@00000 { + label = "BL2"; + reg = <0x00000 0x0040000>; + read-only; + }; + + partition@40000 { + label = "u-boot-env"; + reg = <0x40000 0x0010000>; + }; + + factory: partition@50000 { + label = "Factory"; + reg = <0x50000 0x00B0000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_wifi: macaddr@4 { + reg = <0x4 0x6>; + compatible = "mac-base"; + #nvmem-cell-cells = <1>; + }; + + macaddr_wan: macaddr@24 { + reg = <0x24 0x6>; + }; + + macaddr_lan: macaddr@2a { + reg = <0x2a 0x6>; + }; + }; + }; + + partition@100000 { + label = "FIP"; + reg = <0x100000 0x0080000>; + read-only; + }; + + firmware: partition@180000 { + label = "firmware"; + reg = <0x180000 0x1E80000>; + }; + }; + }; +}; + +&pio { + uart1_pins: uart1-pins { + mux { + function = "uart"; + groups = "uart1_0"; + }; + }; + + uart2_pins: uart2-pins { + mux { + function = "uart"; + groups = "uart2_0_tx_rx"; + }; + }; + + spi2_flash_pins: spi2-pins { + mux { + function = "spi"; + groups = "spi2", "spi2_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 = ; + }; + }; +}; + +&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"; +}; + +&xhci { + mediatek,u3p-dis-msk = <0x0>; + phys = <&u2port0 PHY_TYPE_USB2>, + <&u3port0 PHY_TYPE_USB3>; + status = "okay"; + vusb33-supply = <®_3p3v>; + vbus-supply = <®_5v>; +}; 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 7fe2d29d31d207..cfd77b62d7affb 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() { bananapi,bpi-r4|\ bananapi,bpi-r4-poe|\ cmcc,rax3000m|\ + gatonetworks,gdsp|\ h3c,magic-nx30-pro|\ jcg,q30-pro|\ jdcloud,re-cp-03|\ diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 5dfde755a0125b..739fd543085c60 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -670,6 +670,26 @@ define Device/edgecore_eap111 endef TARGET_DEVICES += edgecore_eap111 +define Device/gatonetworks_gdsp + DEVICE_VENDOR := GatoNetworks + DEVICE_MODEL := gdsp + DEVICE_DTS := mt7981b-gatonetworks-gdsp + DEVICE_DTS_DIR := ../dts + IMAGES := sysupgrade.itb + IMAGE_SIZE := 32768k + DEVICE_PACKAGES := fitblk kmod-mt7915e kmod-mt7981-firmware \ + kmod-usb-net-qmi-wwan kmod-usb-serial-option kmod-usb3 \ + mt7981-wo-firmware -kmod-phy-aquantia + ARTIFACTS := preloader.bin bl31-uboot.fip + ARTIFACT/preloader.bin := mt7981-bl2 nor-ddr3 + ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot gatonetworks_gdsp + 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 | pad-rootfs | append-metadata +endef +TARGET_DEVICES += gatonetworks_gdsp + define Device/glinet_gl-mt2500 DEVICE_VENDOR := GL.iNet DEVICE_MODEL := GL-MT2500 From 77af73050cd53d022a5a4a503f38ffa226a48384 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Fri, 15 Nov 2024 10:01:35 +0100 Subject: [PATCH 094/877] utils: Add the omnia-eeprom utility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a new utility, `omnia-eeprom`, which can be used to print / set EEPROM fields on Turris Omnia. One example when this utility might be useful is if the board experiences random crashes due to newer versions of the DDR training algorithm in newer U-Boot. The user can change the DDR speed from 1600K to 1333H to solve these issues, with ``` omnia-eeprom set ddr_speed 1333H ``` Signed-off-by: Marek Behún Link: https://github.com/openwrt/openwrt/pull/16264 Signed-off-by: Robert Marko (cherry picked from commit 749a43325b98afe4430fa7e2f23ac3ee44791ad6) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/utils/omnia-eeprom/Makefile | 56 ++++++++++++++++++++++++++++ target/linux/mvebu/image/cortexa9.mk | 3 +- 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 package/utils/omnia-eeprom/Makefile diff --git a/package/utils/omnia-eeprom/Makefile b/package/utils/omnia-eeprom/Makefile new file mode 100644 index 00000000000000..03eb13bbc1d23e --- /dev/null +++ b/package/utils/omnia-eeprom/Makefile @@ -0,0 +1,56 @@ +# +# Copyright (C) 2024 Marek Behún +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=omnia-eeprom +PKG_VERSION:=0.1 +PKG_RELEASE:=1 + +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-v$(PKG_VERSION) +PKG_SOURCE:=$(PKG_NAME)-v$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=https://gitlab.nic.cz/turris/omnia-eeprom/-/archive/v$(PKG_VERSION)/ +PKG_HASH:=6f949d0b8080adca8bae088774ce615b563ba6ec2807cce97ee6769b4eee7bbf + +PKG_MAINTAINER:=Marek Behun +PKG_LICENSE:=GPL-2.0-or-later + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR) + +include $(INCLUDE_DIR)/package.mk + +define Package/omnia-eeprom + SECTION:=utils + CATEGORY:=Utilities + URL:=https://gitlab.nic.cz/turris/omnia-eeprom + TITLE:=CZ.NIC Turris Omnia EEPROM accessing utility + DEPENDS:=@TARGET_mvebu_cortexa9_DEVICE_cznic_turris-omnia +kmod-eeprom-at24 +endef + +define Package/omnia-eeprom/description +This package contains the omnia-eeprom utility, which allows you to display +and update EEPROM fields on the Turris Omnia router. +The EEPROM is normally not meant to be updated by users, but there are some +exceptions where it might be useful. +One such example is to change the DDR3 speed from the default 1600K mode to +1333H mode, in order to solve random crashes that occur on some boards with +newer versions of the U-Boot bootloader (because of bugs in newer versions of +the DDR training algorithm). +endef + +MAKE_VARS += OMNIA_EEPROM_VERSION="v$(PKG_VERSION)" + +TARGET_CFLAGS += -Wall + +Build/Compile = $(Build/Compile/Default) + +define Package/omnia-eeprom/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/omnia-eeprom $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,omnia-eeprom)) diff --git a/target/linux/mvebu/image/cortexa9.mk b/target/linux/mvebu/image/cortexa9.mk index 6e49045f68432e..4a41f2c1029c33 100644 --- a/target/linux/mvebu/image/cortexa9.mk +++ b/target/linux/mvebu/image/cortexa9.mk @@ -107,7 +107,8 @@ define Device/cznic_turris-omnia mkf2fs e2fsprogs kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1 \ wpad-basic-mbedtls kmod-ath9k kmod-ath10k-ct ath10k-firmware-qca988x-ct \ kmod-mt7915-firmware partx-utils kmod-i2c-mux-pca954x kmod-leds-turris-omnia \ - kmod-turris-omnia-mcu kmod-gpio-button-hotplug omnia-mcu-firmware omnia-mcutool + kmod-turris-omnia-mcu kmod-gpio-button-hotplug omnia-eeprom omnia-mcu-firmware \ + omnia-mcutool IMAGES := sysupgrade.img.gz IMAGE/sysupgrade.img.gz := boot-scr | boot-img | sdcard-img | gzip | append-metadata SUPPORTED_DEVICES += armada-385-turris-omnia From f59c665660e54dbf57c82711074a9c483d24b88f Mon Sep 17 00:00:00 2001 From: Joe Zheng Date: Fri, 20 Sep 2024 05:57:34 +0000 Subject: [PATCH 095/877] linux-firmware: rename packages for i915 firmware MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change the package name from intel-igpu-firmware-* to i915-firmware-*, the prefix "intel-igpu" is misleading, i915 firmware is not only for iGPU but also for dGPU now. Remove the redundant "intel" as i915 is already well known. More accurate file classification to handle following files correctly: adlp_dmc.bin mtl_huc.bin mtl_huc_gsc.bin mtl_gsc_1.bin The pattern in regex is "([[:alnum:]]+)_([[:alnum:]]+)(_[\w-.]+)?\.bin", where $1 is the platform, $2 is the firmware type (dmc, guc, huc, etc.), and the optional $3 which is revision or other suffix. Glob first to narrow down the target file set, and then split with "_" to extract the firmware type (remove the ".bin" in case there is no $3) Add package "i915-firmware" as a meta package to install all the i915 firmwares, it is a balance between simplicity and optimization. * Installing all the available firmwares as a whole, can support all the platforms, not only the current one but also the future ones. The price to pay is the increased size. * If we want to minimize the storage, we can customize to install the necessary ones only, even for the target platform only (e.g. ADL) and skip the others. The price to pay is the time to tune. What I am going to do is: * Let drm-i915 driver depend on i915-firmware-dmc, which is small and can cover most of the old platforms * Let the user select i915-firmware to install all the i915 firmwares as a whole to cover the latest or future platforms Signed-off-by: Joe Zheng Link: https://github.com/openwrt/openwrt/pull/16276 Signed-off-by: Robert Marko (cherry picked from commit ca00bafd7e05b3f77e38acac6add223ce46df585) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/firmware/linux-firmware/intel.mk | 56 ++++++++++++++++-------- 1 file changed, 38 insertions(+), 18 deletions(-) diff --git a/package/firmware/linux-firmware/intel.mk b/package/firmware/linux-firmware/intel.mk index 225b2aa86295e3..4c9e04cd3d344c 100644 --- a/package/firmware/linux-firmware/intel.mk +++ b/package/firmware/linux-firmware/intel.mk @@ -216,29 +216,49 @@ define Package/e100-firmware/install endef $(eval $(call BuildPackage,e100-firmware)) -Package/intel-igpu-firmware-dmc = $(call Package/firmware-default,Intel iGPU DMC Display MC firmware) -define Package/intel-igpu-firmware-dmc/install +i915_deps:=+i915-firmware-dmc +i915-firmware-guc +i915-firmware-huc +i915-firmware-gsc +Package/i915-firmware = $(call Package/firmware-default,Intel I915 firmware \(meta package\),$(i915_deps),LICENSE.i915) +define Package/i915-firmware/install + true +endef +$(eval $(call BuildPackage,i915-firmware)) + +Package/i915-firmware-dmc = $(call Package/firmware-default,Intel I915 DMC firmware,,LICENSE.i915) +define Package/i915-firmware-dmc/install $(INSTALL_DIR) $(1)/lib/firmware/i915 - $(CP) \ - $(PKG_BUILD_DIR)/i915/*_dmc_*.bin* \ - $(1)/lib/firmware/i915/ + for f in $(PKG_BUILD_DIR)/i915/*_dmc*.bin; do \ + t=`echo $$$${f##*/} | cut -d_ -f2 | cut -d. -f1`; \ + if [ "$$$$t" = dmc ]; then $(CP) $$$$f $(1)/lib/firmware/i915/; fi \ + done endef -$(eval $(call BuildPackage,intel-igpu-firmware-dmc)) +$(eval $(call BuildPackage,i915-firmware-dmc)) -Package/intel-igpu-firmware-guc = $(call Package/firmware-default,Intel iGPU GUC Graphics MC firmware) -define Package/intel-igpu-firmware-guc/install +Package/i915-firmware-guc = $(call Package/firmware-default,Intel I915 GUC firmware,,LICENSE.i915) +define Package/i915-firmware-guc/install $(INSTALL_DIR) $(1)/lib/firmware/i915 - $(CP) \ - $(PKG_BUILD_DIR)/i915/*_guc_*.bin* \ - $(1)/lib/firmware/i915/ + for f in $(PKG_BUILD_DIR)/i915/*_guc*.bin; do \ + t=`echo $$$${f##*/} | cut -d_ -f2 | cut -d. -f1`; \ + if [ "$$$$t" = guc ]; then $(CP) $$$$f $(1)/lib/firmware/i915/; fi \ + done endef -$(eval $(call BuildPackage,intel-igpu-firmware-guc)) +$(eval $(call BuildPackage,i915-firmware-guc)) -Package/intel-igpu-firmware-huc = $(call Package/firmware-default,Intel iGPU HUC H.265 MC firmware) -define Package/intel-igpu-firmware-huc/install +Package/i915-firmware-huc = $(call Package/firmware-default,Intel I915 HUC firmware,,LICENSE.i915) +define Package/i915-firmware-huc/install $(INSTALL_DIR) $(1)/lib/firmware/i915 - $(CP) \ - $(PKG_BUILD_DIR)/i915/*_huc_*.bin* \ - $(1)/lib/firmware/i915/ + for f in $(PKG_BUILD_DIR)/i915/*_huc*.bin; do \ + t=`echo $$$${f##*/} | cut -d_ -f2 | cut -d. -f1`; \ + if [ "$$$$t" = huc ]; then $(CP) $$$$f $(1)/lib/firmware/i915/; fi \ + done +endef +$(eval $(call BuildPackage,i915-firmware-huc)) + +Package/i915-firmware-gsc = $(call Package/firmware-default,Intel I915 GSC firmware,,LICENSE.i915) +define Package/i915-firmware-gsc/install + $(INSTALL_DIR) $(1)/lib/firmware/i915 + for f in $(PKG_BUILD_DIR)/i915/*_gsc*.bin; do \ + t=`echo $$$${f##*/} | cut -d_ -f2 | cut -d. -f1`; \ + if [ "$$$$t" = gsc ]; then $(CP) $$$$f $(1)/lib/firmware/i915/; fi \ + done endef -$(eval $(call BuildPackage,intel-igpu-firmware-huc)) +$(eval $(call BuildPackage,i915-firmware-gsc)) From 756c955a9ca129b55e2b06ac6dab487373d867c7 Mon Sep 17 00:00:00 2001 From: Joe Zheng Date: Sun, 25 Aug 2024 00:53:01 +0000 Subject: [PATCH 096/877] x86: make i915 as a kmod with required firmware MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit i915 driver requires to load correct firmware to work on latest x86 GPU, it is more reasonable to make it as a kernel module, so that initramfs is not required, and it can also save some space from the kernel image comparing being a built-in driver Signed-off-by: Joe Zheng Link: https://github.com/openwrt/openwrt/pull/16276 Signed-off-by: Robert Marko (cherry picked from commit 77cfe8fd15d3d0f77ee16660d06a174f41b53444) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/kernel/linux/modules/video.mk | 42 +++++++++++++++++++++++++++ target/linux/x86/64/config-6.6 | 24 --------------- target/linux/x86/generic/config-6.6 | 24 --------------- target/linux/x86/legacy/config-6.6 | 24 --------------- 4 files changed, 42 insertions(+), 72 deletions(-) diff --git a/package/kernel/linux/modules/video.mk b/package/kernel/linux/modules/video.mk index 8b4585a624e604..fc0f038863ceaf 100644 --- a/package/kernel/linux/modules/video.mk +++ b/package/kernel/linux/modules/video.mk @@ -438,6 +438,48 @@ endef $(eval $(call KernelPackage,drm-amdgpu)) +define KernelPackage/drm-i915 + SUBMENU:=$(VIDEO_MENU) + TITLE:=Intel i915 DRM support + DEPENDS:=@TARGET_x86 @DISPLAY_SUPPORT +kmod-backlight +kmod-drm-ttm \ + +kmod-drm-ttm-helper +kmod-drm-kms-helper +kmod-i2c-algo-bit +i915-firmware-dmc \ + +kmod-drm-display-helper +kmod-drm-buddy +kmod-acpi-video \ + +kmod-drm-exec +kmod-drm-suballoc-helper + KCONFIG:=CONFIG_DRM_I915 \ + CONFIG_DRM_I915_CAPTURE_ERROR=y \ + CONFIG_DRM_I915_COMPRESS_ERROR=y \ + CONFIG_DRM_I915_DEBUG=n \ + CONFIG_DRM_I915_DEBUG_GUC=n \ + CONFIG_DRM_I915_DEBUG_MMIO=n \ + CONFIG_DRM_I915_DEBUG_RUNTIME_PM=n \ + CONFIG_DRM_I915_DEBUG_VBLANK_EVADE=n \ + CONFIG_DRM_I915_FENCE_TIMEOUT=10000 \ + CONFIG_DRM_I915_FORCE_PROBE="" \ + CONFIG_DRM_I915_HEARTBEAT_INTERVAL=2500 \ + CONFIG_DRM_I915_LOW_LEVEL_TRACEPOINTS=n \ + CONFIG_DRM_I915_MAX_REQUEST_BUSYWAIT=8000 \ + CONFIG_DRM_I915_PREEMPT_TIMEOUT=640 \ + CONFIG_DRM_I915_PREEMPT_TIMEOUT_COMPUTE=7500 \ + CONFIG_DRM_I915_REQUEST_TIMEOUT=20000 \ + CONFIG_DRM_I915_SELFTEST=n \ + CONFIG_DRM_I915_STOP_TIMEOUT=100 \ + CONFIG_DRM_I915_SW_FENCE_CHECK_DAG=n \ + CONFIG_DRM_I915_SW_FENCE_DEBUG_OBJECTS=n \ + CONFIG_DRM_I915_TIMESLICE_DURATION=1 \ + CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND=250 \ + CONFIG_DRM_I915_USERPTR=y \ + CONFIG_DRM_I915_WERROR=n \ + CONFIG_FB_INTEL=n + FILES:=$(LINUX_DIR)/drivers/gpu/drm/i915/i915.ko + AUTOLOAD:=$(call AutoProbe,i915) +endef + +define KernelPackage/drm-i915/description + Direct Rendering Manager (DRM) support for Intel GPU +endef + +$(eval $(call KernelPackage,drm-i915)) + define KernelPackage/drm-imx SUBMENU:=$(VIDEO_MENU) diff --git a/target/linux/x86/64/config-6.6 b/target/linux/x86/64/config-6.6 index def4527f77180b..3475e65287288b 100644 --- a/target/linux/x86/64/config-6.6 +++ b/target/linux/x86/64/config-6.6 @@ -151,30 +151,6 @@ CONFIG_DRM_FBDEV_EMULATION=y CONFIG_DRM_FBDEV_OVERALLOC=100 CONFIG_DRM_GEM_SHMEM_HELPER=y # CONFIG_DRM_HYPERV is not set -CONFIG_DRM_I915=y -CONFIG_DRM_I915_CAPTURE_ERROR=y -CONFIG_DRM_I915_COMPRESS_ERROR=y -# CONFIG_DRM_I915_DEBUG is not set -# CONFIG_DRM_I915_DEBUG_GUC is not set -# CONFIG_DRM_I915_DEBUG_MMIO is not set -# CONFIG_DRM_I915_DEBUG_RUNTIME_PM is not set -# CONFIG_DRM_I915_DEBUG_VBLANK_EVADE is not set -CONFIG_DRM_I915_FENCE_TIMEOUT=10000 -CONFIG_DRM_I915_FORCE_PROBE="" -CONFIG_DRM_I915_HEARTBEAT_INTERVAL=2500 -# CONFIG_DRM_I915_LOW_LEVEL_TRACEPOINTS is not set -CONFIG_DRM_I915_MAX_REQUEST_BUSYWAIT=8000 -CONFIG_DRM_I915_PREEMPT_TIMEOUT=640 -CONFIG_DRM_I915_PREEMPT_TIMEOUT_COMPUTE=7500 -CONFIG_DRM_I915_REQUEST_TIMEOUT=20000 -# CONFIG_DRM_I915_SELFTEST is not set -CONFIG_DRM_I915_STOP_TIMEOUT=100 -# CONFIG_DRM_I915_SW_FENCE_CHECK_DAG is not set -# CONFIG_DRM_I915_SW_FENCE_DEBUG_OBJECTS is not set -CONFIG_DRM_I915_TIMESLICE_DURATION=1 -CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND=250 -CONFIG_DRM_I915_USERPTR=y -# CONFIG_DRM_I915_WERROR is not set CONFIG_DRM_KMS_HELPER=y CONFIG_DRM_MIPI_DSI=y CONFIG_DRM_PANEL=y diff --git a/target/linux/x86/generic/config-6.6 b/target/linux/x86/generic/config-6.6 index 091584e0774aa8..ecbd0aa93ee29a 100644 --- a/target/linux/x86/generic/config-6.6 +++ b/target/linux/x86/generic/config-6.6 @@ -86,30 +86,6 @@ CONFIG_DRM_FBDEV_EMULATION=y CONFIG_DRM_FBDEV_OVERALLOC=100 CONFIG_DRM_GEM_SHMEM_HELPER=y # CONFIG_DRM_HYPERV is not set -CONFIG_DRM_I915=y -CONFIG_DRM_I915_CAPTURE_ERROR=y -CONFIG_DRM_I915_COMPRESS_ERROR=y -# CONFIG_DRM_I915_DEBUG is not set -# CONFIG_DRM_I915_DEBUG_GUC is not set -# CONFIG_DRM_I915_DEBUG_MMIO is not set -# CONFIG_DRM_I915_DEBUG_RUNTIME_PM is not set -# CONFIG_DRM_I915_DEBUG_VBLANK_EVADE is not set -CONFIG_DRM_I915_FENCE_TIMEOUT=10000 -CONFIG_DRM_I915_FORCE_PROBE="" -CONFIG_DRM_I915_HEARTBEAT_INTERVAL=2500 -# CONFIG_DRM_I915_LOW_LEVEL_TRACEPOINTS is not set -CONFIG_DRM_I915_MAX_REQUEST_BUSYWAIT=8000 -CONFIG_DRM_I915_PREEMPT_TIMEOUT=640 -CONFIG_DRM_I915_PREEMPT_TIMEOUT_COMPUTE=7500 -CONFIG_DRM_I915_REQUEST_TIMEOUT=20000 -# CONFIG_DRM_I915_SELFTEST is not set -CONFIG_DRM_I915_STOP_TIMEOUT=100 -# CONFIG_DRM_I915_SW_FENCE_CHECK_DAG is not set -# CONFIG_DRM_I915_SW_FENCE_DEBUG_OBJECTS is not set -CONFIG_DRM_I915_TIMESLICE_DURATION=1 -CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND=250 -CONFIG_DRM_I915_USERPTR=y -# CONFIG_DRM_I915_WERROR is not set CONFIG_DRM_KMS_HELPER=y CONFIG_DRM_MIPI_DSI=y CONFIG_DRM_PANEL=y diff --git a/target/linux/x86/legacy/config-6.6 b/target/linux/x86/legacy/config-6.6 index 8ce9237a21dfe5..10511ff08b384d 100644 --- a/target/linux/x86/legacy/config-6.6 +++ b/target/linux/x86/legacy/config-6.6 @@ -67,30 +67,6 @@ CONFIG_DRM_DISPLAY_HELPER=y CONFIG_DRM_EXEC=y CONFIG_DRM_FBDEV_EMULATION=y CONFIG_DRM_FBDEV_OVERALLOC=100 -CONFIG_DRM_I915=y -CONFIG_DRM_I915_CAPTURE_ERROR=y -CONFIG_DRM_I915_COMPRESS_ERROR=y -# CONFIG_DRM_I915_DEBUG is not set -# CONFIG_DRM_I915_DEBUG_GUC is not set -# CONFIG_DRM_I915_DEBUG_MMIO is not set -# CONFIG_DRM_I915_DEBUG_RUNTIME_PM is not set -# CONFIG_DRM_I915_DEBUG_VBLANK_EVADE is not set -CONFIG_DRM_I915_FENCE_TIMEOUT=10000 -CONFIG_DRM_I915_FORCE_PROBE="" -CONFIG_DRM_I915_HEARTBEAT_INTERVAL=2500 -# CONFIG_DRM_I915_LOW_LEVEL_TRACEPOINTS is not set -CONFIG_DRM_I915_MAX_REQUEST_BUSYWAIT=8000 -CONFIG_DRM_I915_PREEMPT_TIMEOUT=640 -CONFIG_DRM_I915_PREEMPT_TIMEOUT_COMPUTE=7500 -CONFIG_DRM_I915_REQUEST_TIMEOUT=20000 -# CONFIG_DRM_I915_SELFTEST is not set -CONFIG_DRM_I915_STOP_TIMEOUT=100 -# CONFIG_DRM_I915_SW_FENCE_CHECK_DAG is not set -# CONFIG_DRM_I915_SW_FENCE_DEBUG_OBJECTS is not set -CONFIG_DRM_I915_TIMESLICE_DURATION=1 -CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND=250 -CONFIG_DRM_I915_USERPTR=y -# CONFIG_DRM_I915_WERROR is not set CONFIG_DRM_KMS_HELPER=y CONFIG_DRM_MIPI_DSI=y CONFIG_DRM_PANEL=y From 71d60c69836de7543e86fddb60e8c3eba05ef50e Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Thu, 14 Nov 2024 21:47:47 +0100 Subject: [PATCH 097/877] base-files: Create /run and /run/lock folder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Create the folder /run and /run/lock using symlinks. Other Linux distributions also have these folders and some applications might already depend on them. Just create symlinks pointing to the older folder. Signed-off-by: Hauke Mehrtens Link: https://github.com/openwrt/openwrt/pull/16961 Signed-off-by: Christian Marangi (cherry picked from commit 3b710375dd97af1e0416904c4174d11c51e3f09c) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/base-files/files/etc/init.d/boot | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package/base-files/files/etc/init.d/boot b/package/base-files/files/etc/init.d/boot index c7d1d4af3ad375..332a5c96f35c95 100755 --- a/package/base-files/files/etc/init.d/boot +++ b/package/base-files/files/etc/init.d/boot @@ -24,6 +24,8 @@ boot() { chmod 1777 /var/lock mkdir -p /var/log mkdir -p /var/run + ln -s /var/run /run + ln -s /var/lock /run/lock mkdir -p /var/state mkdir -p /var/tmp mkdir -p /tmp/.uci From 7d4be068da502cd68f252cad73d18faf8e59e2a5 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Thu, 14 Nov 2024 21:46:36 +0100 Subject: [PATCH 098/877] base-files: Mount debugfs and pstore with nosuid,nodev,noexec MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These permissions are not needed. Systemd also mounts these file systems without these permissions on other Linux distributions. Dropping these permissions should make the system more secure. Signed-off-by: Hauke Mehrtens Link: https://github.com/openwrt/openwrt/pull/16960 Signed-off-by: Christian Marangi (cherry picked from commit b88d51898d126d2f918cb476d4158e9fcd62492c) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/base-files/files/etc/init.d/boot | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/base-files/files/etc/init.d/boot b/package/base-files/files/etc/init.d/boot index 332a5c96f35c95..a26d4886b2873b 100755 --- a/package/base-files/files/etc/init.d/boot +++ b/package/base-files/files/etc/init.d/boot @@ -35,9 +35,9 @@ boot() { mkdir -p /tmp/resolv.conf.d touch /tmp/resolv.conf.d/resolv.conf.auto ln -sf /tmp/resolv.conf.d/resolv.conf.auto /tmp/resolv.conf - grep -q debugfs /proc/filesystems && /bin/mount -o noatime -t debugfs debugfs /sys/kernel/debug + grep -q debugfs /proc/filesystems && /bin/mount -o nosuid,nodev,noexec,noatime -t debugfs debugfs /sys/kernel/debug grep -q bpf /proc/filesystems && /bin/mount -o nosuid,nodev,noexec,noatime,mode=0700 -t bpf bpffs /sys/fs/bpf - grep -q pstore /proc/filesystems && /bin/mount -o noatime -t pstore pstore /sys/fs/pstore + grep -q pstore /proc/filesystems && /bin/mount -o nosuid,nodev,noexec,noatime -t pstore pstore /sys/fs/pstore [ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe touch /tmp/.config_pending From be082a7c7e9b1edf60346752e8dc9935905b7dda Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sun, 13 Oct 2024 21:15:59 +0800 Subject: [PATCH 099/877] ppp: remove more unnecessary kernel checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ppp package can support all features since Linux 4.7.0 kernel. Therefore, most kernel version checks can pass unconditionally on OpenWrt v18.06 and later version. This patch can reduce the size of ppp package by approximately 2.5 KB. Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/16695 Signed-off-by: Christian Marangi (cherry picked from commit 3dbe730080e70e96990a5e89cbe2035adcca8d4b) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- .../patches/400-simplify_kernel_checks.patch | 100 ++++++++++-------- 1 file changed, 53 insertions(+), 47 deletions(-) diff --git a/package/network/services/ppp/patches/400-simplify_kernel_checks.patch b/package/network/services/ppp/patches/400-simplify_kernel_checks.patch index 137937c2448de0..311bb8752f9d44 100644 --- a/package/network/services/ppp/patches/400-simplify_kernel_checks.patch +++ b/package/network/services/ppp/patches/400-simplify_kernel_checks.patch @@ -10,7 +10,14 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c -@@ -231,7 +231,7 @@ static int driver_is_old = 0; +@@ -224,14 +224,10 @@ static fd_set in_fds; /* set of fds tha + static int max_in_fd; /* highest fd set in in_fds */ + + static int has_proxy_arp = 0; +-static int driver_version = 0; +-static int driver_modification = 0; +-static int driver_patch = 0; +-static int driver_is_old = 0; static int restore_term = 0; /* 1 => we've munged the terminal */ static struct termios inittermios; /* Initial TTY termios */ @@ -19,17 +26,18 @@ Signed-off-by: Jo-Philipp Wich static char loop_name[20]; static unsigned char inbuf[512]; /* buffer for chars read from loopback */ -@@ -250,8 +250,8 @@ static int looped; /* 1 if using loop +@@ -249,9 +245,8 @@ static int dynaddr_set; /* 1 if ip_dyna + static int looped; /* 1 if using loop */ static int link_mtu; /* mtu for the link (not bundle) */ - static struct utsname utsname; /* for the kernel version */ +-static struct utsname utsname; /* for the kernel version */ -static int kernel_version; #define KVERSION(j,n,p) ((j)*1000000 + (n)*1000 + (p)) -+static const int kernel_version = KVERSION(2,6,37); ++static const int kernel_version = KVERSION(4,9,0); #define MAX_IFS 100 -@@ -1970,11 +1970,12 @@ int ccp_fatal_error (int unit) +@@ -1970,11 +1965,12 @@ int ccp_fatal_error (int unit) * * path_to_procfs - find the path to the proc file system mount point */ @@ -44,7 +52,7 @@ Signed-off-by: Jo-Philipp Wich struct mntent *mntent; FILE *fp; -@@ -1996,6 +1997,7 @@ static char *path_to_procfs(const char * +@@ -1996,6 +1992,7 @@ static char *path_to_procfs(const char * fclose (fp); } } @@ -52,35 +60,24 @@ Signed-off-by: Jo-Philipp Wich strlcpy(proc_path + proc_path_len, tail, sizeof(proc_path) - proc_path_len); -@@ -2895,15 +2897,19 @@ int ppp_check_kernel_support(void) - int my_version, my_modification, my_patch; - int osmaj, osmin, ospatch; +@@ -2889,6 +2886,8 @@ ppp_registered(void) + int ppp_check_kernel_support(void) + { ++ return 1; /* OpenWrt support ppp device "/dev/ppp" by default */ +#if 0 - /* get the kernel version now, since we are called before sys_init */ - uname(&utsname); - osmaj = osmin = ospatch = 0; - sscanf(utsname.release, "%d.%d.%d", &osmaj, &osmin, &ospatch); - kernel_version = KVERSION(osmaj, osmin, ospatch); -+#endif - - fd = open("/dev/ppp", O_RDWR); - if (fd >= 0) { -+#if 0 - new_style_driver = 1; + int s, ok, fd; + struct ifreq ifr; + int size; +@@ -3016,6 +3015,7 @@ int ppp_check_kernel_support(void) + } + close(s); + return ok; +#endif + } - /* XXX should get from driver */ - driver_version = 2; -@@ -2963,6 +2969,7 @@ int ppp_check_kernel_support(void) - - if (ok && ((ifr.ifr_hwaddr.sa_family & ~0xFF) != ARPHRD_PPP)) - ok = 0; -+ return ok; - - /* - * This is the PPP device. Validate the version of the driver at this -@@ -3577,6 +3584,7 @@ get_pty(int *master_fdp, int *slave_fdp, + #ifndef HAVE_LOGWTMP +@@ -3577,6 +3577,7 @@ get_pty(int *master_fdp, int *slave_fdp, } #endif /* TIOCGPTN */ @@ -88,7 +85,7 @@ Signed-off-by: Jo-Philipp Wich if (sfd < 0) { /* the old way - scan through the pty name space */ for (i = 0; i < 64; ++i) { -@@ -3601,6 +3609,7 @@ get_pty(int *master_fdp, int *slave_fdp, +@@ -3601,6 +3602,7 @@ get_pty(int *master_fdp, int *slave_fdp, } } } @@ -96,23 +93,35 @@ Signed-off-by: Jo-Philipp Wich if (sfd < 0) return 0; +@@ -3716,6 +3718,7 @@ get_host_seed(void) + int + sys_check_options(void) + { ++#if 0 + if (demand && driver_is_old) { + ppp_option_error("demand dialling is not supported by kernel driver " + "version %d.%d.%d", driver_version, driver_modification, +@@ -3726,6 +3729,7 @@ sys_check_options(void) + warn("Warning: multilink is not supported by the kernel driver"); + multilink = 0; + } ++#endif + return 1; + } + --- a/pppd/plugins/pppoatm/pppoatm.c +++ b/pppd/plugins/pppoatm/pppoatm.c -@@ -179,14 +179,6 @@ static void disconnect_pppoatm(void) - +@@ -180,10 +180,6 @@ static void disconnect_pppoatm(void) void plugin_init(void) { --#ifdef linux + #ifdef linux - extern int new_style_driver; /* From sys-linux.c */ - if (!ppp_check_kernel_support() && !new_style_driver) - fatal("Kernel doesn't support ppp_generic - " - "needed for PPPoATM"); --#else -- fatal("No PPPoATM support on this OS"); --#endif - ppp_add_options(pppoa_options); - } - + #else + fatal("No PPPoATM support on this OS"); + #endif --- a/pppd/plugins/pppoe/plugin.c +++ b/pppd/plugins/pppoe/plugin.c @@ -57,9 +57,6 @@ static char const RCSID[] = @@ -138,17 +147,14 @@ Signed-off-by: Jo-Philipp Wich info("PPPoE plugin from pppd %s", PPPD_VERSION); --- a/pppd/plugins/pppol2tp/pppol2tp.c +++ b/pppd/plugins/pppol2tp/pppol2tp.c -@@ -500,12 +500,7 @@ static void pppol2tp_cleanup(void) - +@@ -501,10 +501,6 @@ static void pppol2tp_cleanup(void) void plugin_init(void) { --#if defined(__linux__) + #if defined(__linux__) - extern int new_style_driver; /* From sys-linux.c */ - if (!ppp_check_kernel_support() && !new_style_driver) - fatal("Kernel doesn't support ppp_generic - " - "needed for PPPoL2TP"); --#else -+#if !defined(__linux__) + #else fatal("No PPPoL2TP support on this OS"); #endif - ppp_add_options(pppol2tp_options); From 4c22224bcc08c9bd18e6e9921280c73e2abcd7c3 Mon Sep 17 00:00:00 2001 From: John Audia Date: Mon, 2 Sep 2024 19:53:47 -0400 Subject: [PATCH 100/877] x86: switch config to a tickless kernel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes and closes #16313. Switch the x86 kernel's timer to tickless operation which is more power efficient since it is not woken up by periodic timer interrupts when idle. Also add several other options for CPU idle governors particularly the upstream default for tickless kernels, CONFIG_CPU_IDLE_GOV_MENU. Without this commit, my AMD Ryzen 7 5800U can only achieve a minimum core frequency of 1,384 MHz which is over 3x higher than the processor's minimum frequency of 400 MHz which is accessible with this modification. In addition to the lower clock rate, I have seen a concomitant reduction in both idle temps and at-the-wall power consumption. Summary: * Idle CPU freqs dropped from 1,384 MHz to 400 Mhz. * Idle power consumption dropped from 7 W avg to 5 W. * Idle temps have dropped from 50C on avg to 43C. There are other well known reasons to switch to a tickless timer including: reduced interrupt overhead, better use of CPU resources, and reduced latency to name a few. Build system: x86/64 Build-tested: x86/64/AMD Cezanne Run-tested: x86/64/AMD Cezanne Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/16317 Signed-off-by: Christian Marangi (cherry picked from commit 31111680f6fc5f17201b02b8ce656b955be56d7a) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- target/linux/x86/config-6.6 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/target/linux/x86/config-6.6 b/target/linux/x86/config-6.6 index b8d38e60fa372c..3d1c00513852d4 100644 --- a/target/linux/x86/config-6.6 +++ b/target/linux/x86/config-6.6 @@ -48,6 +48,7 @@ CONFIG_COMPAT_32=y CONFIG_COMPAT_32BIT_TIME=y # CONFIG_COMPAT_VDSO is not set CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_CONTEXT_TRACKING_USER_FORCE=y # CONFIG_CPU5_WDT is not set CONFIG_CPU_FREQ=y CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y @@ -61,7 +62,10 @@ CONFIG_CPU_FREQ_GOV_PERFORMANCE=y # CONFIG_CPU_FREQ_GOV_USERSPACE is not set CONFIG_CPU_FREQ_STAT=y CONFIG_CPU_IDLE=y +CONFIG_CPU_IDLE_GOV_HALTPOLL=y CONFIG_CPU_IDLE_GOV_LADDER=y +CONFIG_CPU_IDLE_GOV_MENU=y +CONFIG_CPU_IDLE_GOV_TEO=y CONFIG_CPU_MITIGATIONS=y CONFIG_CPU_SUP_AMD=y CONFIG_CPU_SUP_CENTAUR=y @@ -180,7 +184,6 @@ CONFIG_HW_RANDOM=y CONFIG_HW_RANDOM_GEODE=y CONFIG_HW_RANDOM_VIA=y # CONFIG_HYPERVISOR_GUEST is not set -CONFIG_HZ_PERIODIC=y CONFIG_I8253_LOCK=y CONFIG_IA32_FEAT_CTL=y # CONFIG_IB700_WDT is not set @@ -275,6 +278,9 @@ CONFIG_NET_XGRESS=y CONFIG_NLS=y # CONFIG_NMI_CHECK_CPU is not set # CONFIG_NOHIGHMEM is not set +CONFIG_NO_HZ=y +CONFIG_NO_HZ_COMMON=y +CONFIG_NO_HZ_FULL=y CONFIG_NR_CPUS=1 CONFIG_NR_CPUS_DEFAULT=1 CONFIG_NR_CPUS_RANGE_BEGIN=1 @@ -330,6 +336,8 @@ CONFIG_PTP_1588_CLOCK_OPTIONAL=y # CONFIG_PUNIT_ATOM_DEBUG is not set CONFIG_RANDSTRUCT_NONE=y CONFIG_RATIONAL=y +CONFIG_RCU_LAZY=y +CONFIG_RCU_NOCB_CPU_DEFAULT_ALL=y CONFIG_RD_BZIP2=y CONFIG_RD_GZIP=y CONFIG_RETHUNK=y From 994a95584aeb7b5168306eaac6d62dcae4784106 Mon Sep 17 00:00:00 2001 From: Jeronimo Pellegrini Date: Sat, 21 Sep 2024 15:46:36 -0300 Subject: [PATCH 101/877] libreadlne: create symlinks for .so MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, libreadline only installs ``` /usr/lib/libhistory.so.8 -> libhistory.so.8.2 /usr/lib/libhistory.so.8.2 /usr/lib/libreadline.so.8 -> libreadline.so.8.2 /usr/lib/libreadline.so.8.2 ``` But there is no `libreadline.so` or `libhistory.so` available. So this happens: ``` root@OpenWRT:~# cat a.c int main() { } root@OpenWRT:~# gcc a.c -lreadline /usr/bin/ld: cannot find -lreadline: No such file or directory collect2: error: ld returned 1 exit status ``` Unless, of course, one uses `-l:libreadline.so.8`... But that doesn't help with binaries that try to dynamically open `libreadline.so`. I have one of those here (the STklos Scheme compiler -- I didn't make a PR for it because it's far from being ready, but one issue is that it does use dlopen to use readline...) With the symlink, it works: ``` root@OpenWRT:~# ln -s /usr/lib/libreadline.so.8 /usr/lib/libreadline.so root@OpenWRT:~# root@OpenWRT:~# gcc a.c -lreadline root@OpenWRT:~# ``` Another example: when trying to package rlwrap, the build failed complaining it could not find readline (using `-lreadline`). It would then be necessary to change rlwrap's `configure.ac` (and also in all packages that use readline), but it seems simpler to add the symlinks... This PR changes the Makefile so it will include the links. Signed-off-by: Jeronimo Pellegrini Link: https://github.com/openwrt/openwrt/pull/16445 Signed-off-by: Christian Marangi (cherry picked from commit 0000ba6ab8062f965d8fed240b76d36f9a493b55) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/libs/readline/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/libs/readline/Makefile b/package/libs/readline/Makefile index 11b9e0172f844a..03e56f36ed4d15 100644 --- a/package/libs/readline/Makefile +++ b/package/libs/readline/Makefile @@ -69,7 +69,7 @@ endef define Package/libreadline/install $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{history,readline}.so.* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{history,readline}.so* $(1)/usr/lib/ endef $(eval $(call HostBuild)) From d4a26ffd1a739e15b797c1b12e4f31a7fa29682f Mon Sep 17 00:00:00 2001 From: Markus Stockhausen Date: Fri, 15 Nov 2024 01:32:47 -0500 Subject: [PATCH 102/877] realtek: align kernel config with upstream MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since the start of the Realtek target OpenWrt works with RTL83XX as the target architecture. Upstream is using MACH_REALTEK_RTL instead. To simplify further development align that. Signed-off-by: Markus Stockhausen Link: https://github.com/openwrt/openwrt/pull/16963 Signed-off-by: Hauke Mehrtens (cherry picked from commit 65964c42f8744ed8ca09448a155b99e3a99be283) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- .../files-6.6/arch/mips/rtl838x/Platform | 4 +- .../files-6.6/drivers/clk/realtek/Kconfig | 4 +- .../files-6.6/drivers/net/dsa/rtl83xx/Kconfig | 2 +- .../300-mips-add-rtl838x-platform.patch | 51 ++++++++++--------- .../301-gpio-add-rtl8231-driver.patch | 2 +- ...e-dependencies-for-gpio-realtek-otto.patch | 26 ---------- ...pdate-dependency-for-spi-realtek-rtl.patch | 25 --------- ...pdate-dependency-for-irq-realtek-rtl.patch | 25 --------- ...date-dependency-for-realtek-otto-wdt.patch | 32 ------------ ...net-add-support-for-rtl838x-ethernet.patch | 2 +- .../realtek/patches-6.6/720-add-rtl-phy.patch | 2 +- target/linux/realtek/rtl838x/config-6.6 | 2 +- target/linux/realtek/rtl839x/config-6.6 | 2 +- target/linux/realtek/rtl930x/config-6.6 | 2 +- target/linux/realtek/rtl931x/config-6.6 | 2 +- 15 files changed, 39 insertions(+), 144 deletions(-) delete mode 100644 target/linux/realtek/patches-6.6/303-gpio-update-dependencies-for-gpio-realtek-otto.patch delete mode 100644 target/linux/realtek/patches-6.6/304-spi-update-dependency-for-spi-realtek-rtl.patch delete mode 100644 target/linux/realtek/patches-6.6/305-irqchip-update-dependency-for-irq-realtek-rtl.patch delete mode 100644 target/linux/realtek/patches-6.6/307-wdt-update-dependency-for-realtek-otto-wdt.patch diff --git a/target/linux/realtek/files-6.6/arch/mips/rtl838x/Platform b/target/linux/realtek/files-6.6/arch/mips/rtl838x/Platform index 98f18cac1be13b..e824dee7b724d4 100644 --- a/target/linux/realtek/files-6.6/arch/mips/rtl838x/Platform +++ b/target/linux/realtek/files-6.6/arch/mips/rtl838x/Platform @@ -1,5 +1,5 @@ # # Realtek RTL838x SoCs # -cflags-$(CONFIG_RTL83XX) += -I$(srctree)/arch/mips/include/asm/mach-rtl838x/ -load-$(CONFIG_RTL83XX) += 0xffffffff80100000 +cflags-$(CONFIG_MACH_REALTEK_RTL) += -I$(srctree)/arch/mips/include/asm/mach-rtl838x/ +load-$(CONFIG_MACH_REALTEK_RTL) += 0xffffffff80100000 diff --git a/target/linux/realtek/files-6.6/drivers/clk/realtek/Kconfig b/target/linux/realtek/files-6.6/drivers/clk/realtek/Kconfig index 4cf3cd963399a2..62b704077ac75f 100644 --- a/target/linux/realtek/files-6.6/drivers/clk/realtek/Kconfig +++ b/target/linux/realtek/files-6.6/drivers/clk/realtek/Kconfig @@ -2,13 +2,13 @@ menuconfig COMMON_CLK_REALTEK bool "Support for Realtek's clock controllers" - depends on RTL83XX + depends on MACH_REALTEK_RTL if COMMON_CLK_REALTEK config COMMON_CLK_RTL83XX bool "Clock driver for Realtek RTL83XX" - depends on RTL83XX + depends on MACH_REALTEK_RTL select SRAM help This driver adds support for the Realtek RTL83xx series basic clocks. diff --git a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/Kconfig b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/Kconfig index 3124ee8d20c219..0af4abcfb9cbd2 100644 --- a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/Kconfig +++ b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/Kconfig @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only config NET_DSA_RTL83XX tristate "Realtek RTL838x/RTL839x switch support" - depends on RTL83XX + depends on MACH_REALTEK_RTL select NET_DSA_TAG_TRAILER help This driver adds support for Realtek RTL83xx series switching. diff --git a/target/linux/realtek/patches-6.6/300-mips-add-rtl838x-platform.patch b/target/linux/realtek/patches-6.6/300-mips-add-rtl838x-platform.patch index 7adbbbc517431b..bb89a7864fe49a 100644 --- a/target/linux/realtek/patches-6.6/300-mips-add-rtl838x-platform.patch +++ b/target/linux/realtek/patches-6.6/300-mips-add-rtl838x-platform.patch @@ -9,64 +9,67 @@ configurations for the SoCs, which are introduced in addition. Submitted-by: Birger Koblitz --- - arch/mips/Kbuild.platforms | 1 + - arch/mips/Kconfig | 57 ++++++++++++++ - 2 files changed, 58 insertions(+) - --- a/arch/mips/Kbuild.platforms +++ b/arch/mips/Kbuild.platforms @@ -22,6 +22,7 @@ platform-$(CONFIG_MACH_NINTENDO64) += n6 platform-$(CONFIG_PIC32MZDA) += pic32/ platform-$(CONFIG_RALINK) += ralink/ platform-$(CONFIG_MIKROTIK_RB532) += rb532/ -+platform-$(CONFIG_RTL83XX) += rtl838x/ ++platform-$(CONFIG_MACH_REALTEK_RTL) += rtl838x/ platform-$(CONFIG_SGI_IP22) += sgi-ip22/ platform-$(CONFIG_SGI_IP27) += sgi-ip27/ platform-$(CONFIG_SGI_IP28) += sgi-ip22/ --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -968,8 +968,58 @@ config CAVIUM_OCTEON_SOC - Hikari - Say Y here for most Octeon reference boards. +@@ -620,21 +620,23 @@ config RALINK -+config RTL83XX -+ bool "Realtek based platforms" -+ select DMA_NONCOHERENT -+ select IRQ_MIPS_CPU + config MACH_REALTEK_RTL + bool "Realtek RTL838x/RTL839x based machines" +- select MIPS_GENERIC + select DMA_NONCOHERENT + select IRQ_MIPS_CPU +- select CSRC_R4K +- select CEVT_R4K + select SYS_HAS_CPU_MIPS32_R1 + select SYS_HAS_CPU_MIPS32_R2 + select SYS_SUPPORTS_BIG_ENDIAN + select SYS_SUPPORTS_32BIT_KERNEL + select SYS_SUPPORTS_MIPS16 +- select SYS_SUPPORTS_MULTITHREADING +- select SYS_SUPPORTS_VPE_LOADER + select BOOT_RAW + select PINCTRL + select USE_OF + select NO_EXCEPT_FILL -+ select SYS_HAS_CPU_MIPS32_R1 -+ select SYS_HAS_CPU_MIPS32_R2 -+ select SYS_SUPPORTS_BIG_ENDIAN + select SYS_SUPPORTS_HIGHMEM -+ select SYS_SUPPORTS_32BIT_KERNEL -+ select SYS_SUPPORTS_MIPS16 + select SYS_HAS_EARLY_PRINTK + select SYS_HAS_EARLY_PRINTK_8250 + select USE_GENERIC_EARLY_PRINTK_8250 -+ select BOOT_RAW -+ select PINCTRL + select ARCH_HAS_RESET_CONTROLLER + select RESET_CONTROLLER -+ select USE_OF -+ + + config SGI_IP22 + bool "SGI IP22 (Indy/Indigo2)" +@@ -970,6 +972,36 @@ config CAVIUM_OCTEON_SOC + endchoice +config RTL838X + bool "Realtek RTL838X based platforms" -+ depends on RTL83XX ++ depends on MACH_REALTEK_RTL + select CPU_SUPPORTS_CPUFREQ + select MIPS_EXTERNAL_TIMER + +config RTL839X + bool "Realtek RTL839X based platforms" -+ depends on RTL83XX ++ depends on MACH_REALTEK_RTL + select CPU_SUPPORTS_CPUFREQ + select MIPS_EXTERNAL_TIMER + select SYS_SUPPORTS_MULTITHREADING + +config RTL930X + bool "Realtek RTL930X based platforms" -+ depends on RTL83XX ++ depends on MACH_REALTEK_RTL + select MIPS_CPU_SCACHE + select MIPS_EXTERNAL_TIMER + select SYS_SUPPORTS_MULTITHREADING diff --git a/target/linux/realtek/patches-6.6/301-gpio-add-rtl8231-driver.patch b/target/linux/realtek/patches-6.6/301-gpio-add-rtl8231-driver.patch index a1778764206d12..f64e2cf94eff8c 100644 --- a/target/linux/realtek/patches-6.6/301-gpio-add-rtl8231-driver.patch +++ b/target/linux/realtek/patches-6.6/301-gpio-add-rtl8231-driver.patch @@ -31,7 +31,7 @@ Submitted-by: John Crispin +config GPIO_RTL8231 + tristate "RTL8231 GPIO" -+ depends on RTL83XX ++ depends on MACH_REALTEK_RTL + help + Say yes here to support Realtek RTL8231 GPIO expansion chips. + diff --git a/target/linux/realtek/patches-6.6/303-gpio-update-dependencies-for-gpio-realtek-otto.patch b/target/linux/realtek/patches-6.6/303-gpio-update-dependencies-for-gpio-realtek-otto.patch deleted file mode 100644 index 2b466340e6343a..00000000000000 --- a/target/linux/realtek/patches-6.6/303-gpio-update-dependencies-for-gpio-realtek-otto.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 9bac1c20b8f39f2e0e342b087add5093b94feaed Mon Sep 17 00:00:00 2001 -From: INAGAKI Hiroshi -Date: Wed, 5 May 2021 22:05:39 +0900 -Subject: realtek: backport gpio-realtek-otto driver from 5.13 to 5.10 - -This patch backports "gpio-realtek-otto" driver to Kernel 5.10. -"MACH_REALTEK_RTL" is used as a platform name in upstream, but "RTL838X" -is used in OpenWrt, so update the dependency by the additional patch. - -Submitted-by: INAGAKI Hiroshi ---- - drivers/gpio/Kconfig | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) ---- a/drivers/gpio/Kconfig -+++ b/drivers/gpio/Kconfig -@@ -527,8 +527,8 @@ config GPIO_RDA - - config GPIO_REALTEK_OTTO - tristate "Realtek Otto GPIO support" -- depends on MACH_REALTEK_RTL -- default MACH_REALTEK_RTL -+ depends on RTL83XX -+ default RTL838X - select GPIO_GENERIC - select GPIOLIB_IRQCHIP - help diff --git a/target/linux/realtek/patches-6.6/304-spi-update-dependency-for-spi-realtek-rtl.patch b/target/linux/realtek/patches-6.6/304-spi-update-dependency-for-spi-realtek-rtl.patch deleted file mode 100644 index 01530257b857d9..00000000000000 --- a/target/linux/realtek/patches-6.6/304-spi-update-dependency-for-spi-realtek-rtl.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0b000cbfe0aa0323bffa855ef8449c0687a4c071 Mon Sep 17 00:00:00 2001 -From: INAGAKI Hiroshi -Date: Thu, 6 May 2021 19:30:58 +0900 -Subject: realtek: backport spi-realtek-rtl driver from 5.12 to 5.10 - -This patch backports "spi-realtek-rtl" driver to Kernel 5.10 from 5.12. -"MACH_REALTEK_RTL" is used as a platform name in upstream, but "RTL838X" -is used in OpenWrt, so update the dependency by the additional patch. - -Submitted-by: INAGAKI Hiroshi ---- - drivers/spi/Makefile | 2 +- - 1 files changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/spi/Makefile -+++ b/drivers/spi/Makefile -@@ -114,7 +114,7 @@ obj-$(CONFIG_SPI_QUP) += spi-qup.o - obj-$(CONFIG_SPI_ROCKCHIP) += spi-rockchip.o - obj-$(CONFIG_SPI_ROCKCHIP_SFC) += spi-rockchip-sfc.o - obj-$(CONFIG_SPI_RB4XX) += spi-rb4xx.o --obj-$(CONFIG_MACH_REALTEK_RTL) += spi-realtek-rtl.o -+obj-$(CONFIG_RTL83XX) += spi-realtek-rtl.o - obj-$(CONFIG_SPI_RPCIF) += spi-rpc-if.o - obj-$(CONFIG_SPI_RSPI) += spi-rspi.o - obj-$(CONFIG_SPI_RZV2M_CSI) += spi-rzv2m-csi.o diff --git a/target/linux/realtek/patches-6.6/305-irqchip-update-dependency-for-irq-realtek-rtl.patch b/target/linux/realtek/patches-6.6/305-irqchip-update-dependency-for-irq-realtek-rtl.patch deleted file mode 100644 index 0ecc33376e1c02..00000000000000 --- a/target/linux/realtek/patches-6.6/305-irqchip-update-dependency-for-irq-realtek-rtl.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 2cd00b51470a30198b048a5fca48a04db77e29cc Mon Sep 17 00:00:00 2001 -From: INAGAKI Hiroshi -Date: Fri, 21 May 2021 23:16:37 +0900 -Subject: [PATCH] realtek: backport irq-realtek-rtl driver from 5.12 to 5.10 - -This patch backports "irq-realtek-rtl" driver to Kernel 5.10 from 5.12. -"MACH_REALTEK_RTL" is used as a platform name in upstream, but "RTL838X" -is used in OpenWrt, so update the dependency by the additional patch. - -Submitted-by: INAGAKI Hiroshi ---- - drivers/irqchip/Makefile | 2 +- - 1 files changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/irqchip/Makefile -+++ b/drivers/irqchip/Makefile -@@ -114,7 +114,7 @@ obj-$(CONFIG_LOONGSON_PCH_MSI) += irq-l - obj-$(CONFIG_LOONGSON_PCH_LPC) += irq-loongson-pch-lpc.o - obj-$(CONFIG_MST_IRQ) += irq-mst-intc.o - obj-$(CONFIG_SL28CPLD_INTC) += irq-sl28cpld.o --obj-$(CONFIG_MACH_REALTEK_RTL) += irq-realtek-rtl.o -+obj-$(CONFIG_RTL83XX) += irq-realtek-rtl.o - obj-$(CONFIG_WPCM450_AIC) += irq-wpcm450-aic.o - obj-$(CONFIG_IRQ_IDT3243X) += irq-idt3243x.o - obj-$(CONFIG_APPLE_AIC) += irq-apple-aic.o diff --git a/target/linux/realtek/patches-6.6/307-wdt-update-dependency-for-realtek-otto-wdt.patch b/target/linux/realtek/patches-6.6/307-wdt-update-dependency-for-realtek-otto-wdt.patch deleted file mode 100644 index c9dab65b72cea5..00000000000000 --- a/target/linux/realtek/patches-6.6/307-wdt-update-dependency-for-realtek-otto-wdt.patch +++ /dev/null @@ -1,32 +0,0 @@ -From b8fc5eecdc5d33cf261986436597b5482ab856da Mon Sep 17 00:00:00 2001 -From: Sander Vanheule -Date: Sun, 14 Nov 2021 19:45:32 +0100 -Subject: [PATCH] realtek: Backport Realtek Otto WDT driver - -Add patch submitted upstream to linux-watchdog and replace the MIPS -architecture symbols. Requires one extra patch for the DIV_ROUND_* -macros, which have moved to a different header since 5.10. - -Submitted-by: Sander Vanheule -Tested-by: Stijn Segers -Tested-by: Paul Fertser -Tested-by: Stijn Tintel ---- - drivers/watchdog/Kconfig | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/drivers/watchdog/Kconfig -+++ b/drivers/watchdog/Kconfig -@@ -977,10 +977,10 @@ config RTD119X_WATCHDOG - - config REALTEK_OTTO_WDT - tristate "Realtek Otto MIPS watchdog support" -- depends on MACH_REALTEK_RTL || COMPILE_TEST -+ depends on RTL83XX - depends on COMMON_CLK - select WATCHDOG_CORE -- default MACH_REALTEK_RTL -+ default RTL83XX - help - Say Y here to include support for the watchdog timer on Realtek - RTL838x, RTL839x, RTL930x SoCs. This watchdog has pretimeout diff --git a/target/linux/realtek/patches-6.6/716-net-ethernet-add-support-for-rtl838x-ethernet.patch b/target/linux/realtek/patches-6.6/716-net-ethernet-add-support-for-rtl838x-ethernet.patch index 9d79ea565d2ccb..e0c10bca633fad 100644 --- a/target/linux/realtek/patches-6.6/716-net-ethernet-add-support-for-rtl838x-ethernet.patch +++ b/target/linux/realtek/patches-6.6/716-net-ethernet-add-support-for-rtl838x-ethernet.patch @@ -29,7 +29,7 @@ Submitted-by: John Crispin + +config NET_RTL838X + tristate "Realtek rtl838x Ethernet MAC support" -+ depends on RTL83XX ++ depends on MACH_REALTEK_RTL + help + Say Y here if you want to use the Realtek rtl838x Gbps Ethernet MAC. + diff --git a/target/linux/realtek/patches-6.6/720-add-rtl-phy.patch b/target/linux/realtek/patches-6.6/720-add-rtl-phy.patch index 78a57f0a3e9810..43d4a7d4fccf51 100644 --- a/target/linux/realtek/patches-6.6/720-add-rtl-phy.patch +++ b/target/linux/realtek/patches-6.6/720-add-rtl-phy.patch @@ -20,7 +20,7 @@ Submitted-by: Birger Koblitz +config REALTEK_SOC_PHY + tristate "Realtek SoC PHYs" -+ depends on RTL83XX ++ depends on MACH_REALTEK_RTL + help + Supports the PHYs found in combination with Realtek Switch SoCs + diff --git a/target/linux/realtek/rtl838x/config-6.6 b/target/linux/realtek/rtl838x/config-6.6 index ad2c1b43cce8d7..44c1d7e0645c9d 100644 --- a/target/linux/realtek/rtl838x/config-6.6 +++ b/target/linux/realtek/rtl838x/config-6.6 @@ -116,6 +116,7 @@ CONFIG_JFFS2_ZLIB=y CONFIG_LEDS_GPIO=y CONFIG_LIBFDT=y CONFIG_LOCK_DEBUGGING_SUPPORT=y +CONFIG_MACH_REALTEK_RTL=y CONFIG_MARVELL_PHY=y CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y @@ -192,7 +193,6 @@ CONFIG_REGMAP_MMIO=y CONFIG_RESET_CONTROLLER=y CONFIG_RTL838X=y # CONFIG_RTL839X is not set -CONFIG_RTL83XX=y # CONFIG_RTL930X is not set CONFIG_SERIAL_MCTRL_GPIO=y CONFIG_SERIAL_OF_PLATFORM=y diff --git a/target/linux/realtek/rtl839x/config-6.6 b/target/linux/realtek/rtl839x/config-6.6 index a357eb39666015..630027bf8133bb 100644 --- a/target/linux/realtek/rtl839x/config-6.6 +++ b/target/linux/realtek/rtl839x/config-6.6 @@ -115,6 +115,7 @@ CONFIG_JFFS2_ZLIB=y CONFIG_LEDS_GPIO=y CONFIG_LIBFDT=y CONFIG_LOCK_DEBUGGING_SUPPORT=y +CONFIG_MACH_REALTEK_RTL=y CONFIG_MARVELL_PHY=y CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y @@ -204,7 +205,6 @@ CONFIG_RFS_ACCEL=y CONFIG_RPS=y # CONFIG_RTL838X is not set CONFIG_RTL839X=y -CONFIG_RTL83XX=y # CONFIG_RTL930X is not set CONFIG_SERIAL_MCTRL_GPIO=y CONFIG_SERIAL_OF_PLATFORM=y diff --git a/target/linux/realtek/rtl930x/config-6.6 b/target/linux/realtek/rtl930x/config-6.6 index af5f2ca7a313b4..5a29bdc3c1ba78 100644 --- a/target/linux/realtek/rtl930x/config-6.6 +++ b/target/linux/realtek/rtl930x/config-6.6 @@ -97,6 +97,7 @@ CONFIG_JFFS2_ZLIB=y CONFIG_LEDS_GPIO=y CONFIG_LIBFDT=y CONFIG_LOCK_DEBUGGING_SUPPORT=y +CONFIG_MACH_REALTEK_RTL=y CONFIG_MARVELL_PHY=y CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y @@ -172,7 +173,6 @@ CONFIG_REGMAP_MMIO=y CONFIG_RESET_CONTROLLER=y # CONFIG_RTL838X is not set # CONFIG_RTL839X is not set -CONFIG_RTL83XX=y CONFIG_RTL930X=y # CONFIG_RTL931X is not set CONFIG_SERIAL_MCTRL_GPIO=y diff --git a/target/linux/realtek/rtl931x/config-6.6 b/target/linux/realtek/rtl931x/config-6.6 index 736f4720296d8c..df235defe83c84 100644 --- a/target/linux/realtek/rtl931x/config-6.6 +++ b/target/linux/realtek/rtl931x/config-6.6 @@ -106,6 +106,7 @@ CONFIG_KMAP_LOCAL=y CONFIG_LEDS_GPIO=y CONFIG_LIBFDT=y CONFIG_LOCK_DEBUGGING_SUPPORT=y +CONFIG_MACH_REALTEK_RTL=y CONFIG_MARVELL_PHY=y CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y @@ -195,7 +196,6 @@ CONFIG_RFS_ACCEL=y CONFIG_RPS=y # CONFIG_RTL838X is not set # CONFIG_RTL839X is not set -CONFIG_RTL83XX=y CONFIG_RTL930X=y CONFIG_RTL931X=y CONFIG_SENSORS_GPIO_FAN=y From 4166aaf98abc848496fbe3b8be3f4ec59bbb5cac Mon Sep 17 00:00:00 2001 From: Ryan Keane Date: Thu, 7 Nov 2024 21:50:58 -0800 Subject: [PATCH 103/877] elfutils: Update to 0.192 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a patch still under review to fix some errors. Refresh patch: - 003-libintl-compatibility.patch - 005-build_only_libs.patch - 006-Fix-build-on-aarch64-musl.patch Add patch: - 102-fix-potential-deref-of-null-error.patch Release notes are in the link below. Link: https://inbox.sourceware.org/elfutils-devel/CAJDtP-T3+gXqHWp3T0mejWWbPr0_1tHetEXwfB67-o+zz7ShiA@mail.gmail.com/T/#u Signed-off-by: Ryan Keane Link: https://github.com/openwrt/openwrt/pull/16886 Signed-off-by: Robert Marko (cherry picked from commit f5132df69db50a99e556e6fbd165002aac0e3e38) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/libs/elfutils/Makefile | 4 +- .../patches/003-libintl-compatibility.patch | 2 +- .../patches/005-build_only_libs.patch | 2 +- .../006-Fix-build-on-aarch64-musl.patch | 4 +- ...02-fix-potential-deref-of-null-error.patch | 55 +++++++++++++++++++ 5 files changed, 61 insertions(+), 6 deletions(-) create mode 100644 package/libs/elfutils/patches/102-fix-potential-deref-of-null-error.patch diff --git a/package/libs/elfutils/Makefile b/package/libs/elfutils/Makefile index ac5841c604b235..b8bb50b564c93f 100644 --- a/package/libs/elfutils/Makefile +++ b/package/libs/elfutils/Makefile @@ -7,12 +7,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=elfutils -PKG_VERSION:=0.191 +PKG_VERSION:=0.192 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://sourceware.org/$(PKG_NAME)/ftp/$(PKG_VERSION) -PKG_HASH:=df76db71366d1d708365fc7a6c60ca48398f14367eb2b8954efc8897147ad871 +PKG_HASH:=616099beae24aba11f9b63d86ca6cc8d566d968b802391334c91df54eab416b4 PKG_MAINTAINER:=Luiz Angelo Daros de Luca PKG_LICENSE:=GPL-3.0-or-later diff --git a/package/libs/elfutils/patches/003-libintl-compatibility.patch b/package/libs/elfutils/patches/003-libintl-compatibility.patch index 1271796af54fd4..eda9f2204a928c 100644 --- a/package/libs/elfutils/patches/003-libintl-compatibility.patch +++ b/package/libs/elfutils/patches/003-libintl-compatibility.patch @@ -11,7 +11,7 @@ Requires.private: zlib @LIBZSTD@ --- a/configure.ac +++ b/configure.ac -@@ -717,6 +717,9 @@ dnl AM_GNU_GETTEXT_REQUIRE_VERSION suppo +@@ -728,6 +728,9 @@ dnl AM_GNU_GETTEXT_REQUIRE_VERSION suppo AM_GNU_GETTEXT_VERSION([0.19.6]) AM_GNU_GETTEXT_REQUIRE_VERSION([0.19.6]) diff --git a/package/libs/elfutils/patches/005-build_only_libs.patch b/package/libs/elfutils/patches/005-build_only_libs.patch index 598b734874e764..177ac659e62403 100644 --- a/package/libs/elfutils/patches/005-build_only_libs.patch +++ b/package/libs/elfutils/patches/005-build_only_libs.patch @@ -8,4 +8,4 @@ + libasm EXTRA_DIST = elfutils.spec GPG-KEY NOTES CONTRIBUTING SECURITY \ - COPYING COPYING-GPLV2 COPYING-LGPLV3 + COPYING COPYING-GPLV2 COPYING-LGPLV3 CONDUCT diff --git a/package/libs/elfutils/patches/006-Fix-build-on-aarch64-musl.patch b/package/libs/elfutils/patches/006-Fix-build-on-aarch64-musl.patch index d8066c5ca717cf..a7786ed2c011a0 100644 --- a/package/libs/elfutils/patches/006-Fix-build-on-aarch64-musl.patch +++ b/package/libs/elfutils/patches/006-Fix-build-on-aarch64-musl.patch @@ -32,8 +32,8 @@ Signed-off-by: Hongxu Jia +# include # include # include - /* Deal with old glibc defining user_pt_regs instead of user_regs_struct. */ -@@ -82,7 +82,7 @@ aarch64_set_initial_registers_tid (pid_t + # include +@@ -94,7 +94,7 @@ aarch64_set_initial_registers_tid (pid_t Dwarf_Word dwarf_fregs[32]; for (int r = 0; r < 32; r++) diff --git a/package/libs/elfutils/patches/102-fix-potential-deref-of-null-error.patch b/package/libs/elfutils/patches/102-fix-potential-deref-of-null-error.patch new file mode 100644 index 00000000000000..6710e4ef9cf176 --- /dev/null +++ b/package/libs/elfutils/patches/102-fix-potential-deref-of-null-error.patch @@ -0,0 +1,55 @@ +strip.c: Pointer `arhdr` created at strip.c:2741 and then dereferenced without NULL-check. +The same situation for the `arhdr` pointer at the objdump.c:313 and +the `h` pointer at the readelf.c:13545. + +Triggers found by static analyzer Svace. + +Signed-off-by: Maks Mishin +--- + src/objdump.c | 5 +++++ + src/readelf.c | 5 +++++ + src/strip.c | 5 +++++ + 3 files changed, 15 insertions(+) + +--- a/src/objdump.c ++++ b/src/objdump.c +@@ -311,6 +311,11 @@ handle_ar (int fd, Elf *elf, const char + { + /* The the header for this element. */ + Elf_Arhdr *arhdr = elf_getarhdr (subelf); ++ if (arhdr == NULL) ++ { ++ printf ("cannot get arhdr: %s\n", elf_errmsg (-1)); ++ exit (1); ++ } + + /* Skip over the index entries. */ + if (strcmp (arhdr->ar_name, "/") != 0 +--- a/src/readelf.c ++++ b/src/readelf.c +@@ -13543,6 +13543,11 @@ dump_archive_index (Elf *elf, const char + as_off, fname, elf_errmsg (-1)); + + const Elf_Arhdr *h = elf_getarhdr (subelf); ++ if (h == NULL) ++ { ++ printf ("cannot get arhdr: %s\n", elf_errmsg (-1)); ++ exit (1); ++ } + + printf (_("Archive member '%s' contains:\n"), h->ar_name); + +--- a/src/strip.c ++++ b/src/strip.c +@@ -2739,6 +2739,11 @@ handle_ar (int fd, Elf *elf, const char + { + /* The the header for this element. */ + Elf_Arhdr *arhdr = elf_getarhdr (subelf); ++ if (arhdr == NULL) ++ { ++ printf ("cannot get arhdr: %s\n", elf_errmsg (-1)); ++ exit (1); ++ } + + if (elf_kind (subelf) == ELF_K_ELF) + result |= handle_elf (fd, subelf, new_prefix, arhdr->ar_name, 0, NULL); From d5e45df9c24aecf1eefc1e3abfabf53f8d5636bc Mon Sep 17 00:00:00 2001 From: Ryan Keane Date: Wed, 13 Nov 2024 11:46:38 -0800 Subject: [PATCH 104/877] elfutils: Add mirrors.kernel.org as mirrror MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add mirrors.kernel.org as mirror, listed on sourceware mirror sites page. Link: https://sourceware.org/mirrors.html Signed-off-by: Ryan Keane Link: https://github.com/openwrt/openwrt/pull/16886 Signed-off-by: Robert Marko (cherry picked from commit 63caa2b1685ef5d2b4259784085f64cb9e5574a8) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/libs/elfutils/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/libs/elfutils/Makefile b/package/libs/elfutils/Makefile index b8bb50b564c93f..7b31331e0bfbbb 100644 --- a/package/libs/elfutils/Makefile +++ b/package/libs/elfutils/Makefile @@ -11,7 +11,8 @@ PKG_VERSION:=0.192 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 -PKG_SOURCE_URL:=https://sourceware.org/$(PKG_NAME)/ftp/$(PKG_VERSION) +PKG_SOURCE_URL:=https://sourceware.org/$(PKG_NAME)/ftp/$(PKG_VERSION) \ + https://mirrors.kernel.org/sourceware/$(PKG_NAME)/$(PKG_VERSION) PKG_HASH:=616099beae24aba11f9b63d86ca6cc8d566d968b802391334c91df54eab416b4 PKG_MAINTAINER:=Luiz Angelo Daros de Luca From 9591c1631d158dabf529603a490914bbdc3fd6c9 Mon Sep 17 00:00:00 2001 From: Ryan Keane Date: Thu, 7 Nov 2024 22:36:23 -0800 Subject: [PATCH 105/877] elfutils: Backport some patches to fix errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On aarch64 musl gcc 14.x compiler, trying compiling elfutils 0.192 with lto option enabled will cause null-dereference error. Example error message: ... elf_compress.c: In function 'elf_compress': elf_compress.c:675:26: error: potential null pointer dereference [-Werror=null-dereference] 675 | shdr->sh_flags |= SHF_COMPRESSED; | ^ elf_compress_gnu.c: In function 'elf_compress_gnu': elf_compress_gnu.c:127:25: error: potential null pointer dereference [-Werror=null-dereference] 127 | shdr->sh_size = new_size; | ^ ^ ... This is a false postive warning but will abort compilation if gcc has `-Werror` flag. This commit add a patch for this, see the bugzilla report below. This commit backports a series of patches to fix some errors. Add patch: - 007-add-libeu-symbols-to-libelf.patch - 008-fix-autoconf-ENABLE_IMA_VERIFICATION.patch - 009-fix-null-dereference-with-lto.patch Link: https://sourceware.org/bugzilla/show_bug.cgi?id=32311 Signed-off-by: Ryan Keane Link: https://github.com/openwrt/openwrt/pull/16886 Signed-off-by: Robert Marko (cherry picked from commit afffcd09e5f15be53f327a80ee87d391312eb805) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- .../007-add-libeu-symbols-to-libelf.patch | 31 +++ ...fix-autoconf-ENABLE_IMA_VERIFICATION.patch | 24 +++ .../009-fix-null-dereference-with-lto.patch | 193 ++++++++++++++++++ 3 files changed, 248 insertions(+) create mode 100644 package/libs/elfutils/patches/007-add-libeu-symbols-to-libelf.patch create mode 100644 package/libs/elfutils/patches/008-fix-autoconf-ENABLE_IMA_VERIFICATION.patch create mode 100644 package/libs/elfutils/patches/009-fix-null-dereference-with-lto.patch diff --git a/package/libs/elfutils/patches/007-add-libeu-symbols-to-libelf.patch b/package/libs/elfutils/patches/007-add-libeu-symbols-to-libelf.patch new file mode 100644 index 00000000000000..23489b562570e7 --- /dev/null +++ b/package/libs/elfutils/patches/007-add-libeu-symbols-to-libelf.patch @@ -0,0 +1,31 @@ +From f5d6e088f84dd05278c4698a21cbf1ff4569978d Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Tue, 22 Oct 2024 15:03:42 +0200 +Subject: [PATCH] libelf: Add libeu objects to libelf.a static archive + +libelf might use some symbols from libeu.a, specifically the eu-search +wrappers. But we don't ship libeu.a separately. So include the libeu +objects in the libelf.a archive to facilitate static linking. + + * libelf/Makefile.am (libeu_objects): New variable. + (libelf_a_LIBADD): New, add libeu_objects. + +https://sourceware.org/bugzilla/show_bug.cgi?id=32293 + +Signed-off-by: Mark Wielaard +--- + libelf/Makefile.am | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/libelf/Makefile.am ++++ b/libelf/Makefile.am +@@ -122,6 +122,9 @@ libelf.so: $(srcdir)/libelf.map $(libelf + @$(textrel_check) + $(AM_V_at)ln -fs $@ $@.$(VERSION) + ++libeu_objects = $(shell $(AR) t ../lib/libeu.a) ++libelf_a_LIBADD = $(addprefix ../lib/,$(libeu_objects)) ++ + install: install-am libelf.so + $(mkinstalldirs) $(DESTDIR)$(libdir) + $(INSTALL_PROGRAM) libelf.so $(DESTDIR)$(libdir)/libelf-$(PACKAGE_VERSION).so diff --git a/package/libs/elfutils/patches/008-fix-autoconf-ENABLE_IMA_VERIFICATION.patch b/package/libs/elfutils/patches/008-fix-autoconf-ENABLE_IMA_VERIFICATION.patch new file mode 100644 index 00000000000000..e5732d2b0821fd --- /dev/null +++ b/package/libs/elfutils/patches/008-fix-autoconf-ENABLE_IMA_VERIFICATION.patch @@ -0,0 +1,24 @@ +From f3c664d069d81a4872a1ec8241ee709f37c53e9c Mon Sep 17 00:00:00 2001 +From: Aaron Merey +Date: Tue, 29 Oct 2024 14:16:57 -0400 +Subject: [PATCH] configure.ac: Fix ENABLE_IMA_VERIFICATION conditional + +Fix test statement for ENABLE_IMA_VERIFICATION always evalutating to +false due to a missing 'x'. + +Signed-off-by: Aaron Merey +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/configure.ac ++++ b/configure.ac +@@ -895,7 +895,7 @@ AS_IF([test "x$enable_debuginfod" != "xn + AM_CONDITIONAL([DEBUGINFOD],[test "x$enable_debuginfod" = "xyes"]) + AS_IF([test "x$enable_debuginfod_ima_verification" = "xyes"],AC_DEFINE([ENABLE_IMA_VERIFICATION],[1],[Build IMA verification])) + AS_IF([test "x$have_libarchive" = "xyes"],AC_DEFINE([HAVE_LIBARCHIVE],[1],[Define to 1 if libarchive is available])) +-AM_CONDITIONAL([ENABLE_IMA_VERIFICATION],[test "$enable_debuginfod_ima_verification" = "xyes"]) ++AM_CONDITIONAL([ENABLE_IMA_VERIFICATION],[test "x$enable_debuginfod_ima_verification" = "xyes"]) + AM_CONDITIONAL([OLD_LIBMICROHTTPD],[test "x$old_libmicrohttpd" = "xyes"]) + + dnl for /etc/profile.d/elfutils.{csh,sh} diff --git a/package/libs/elfutils/patches/009-fix-null-dereference-with-lto.patch b/package/libs/elfutils/patches/009-fix-null-dereference-with-lto.patch new file mode 100644 index 00000000000000..1179a1e1a01f67 --- /dev/null +++ b/package/libs/elfutils/patches/009-fix-null-dereference-with-lto.patch @@ -0,0 +1,193 @@ +From 8707194a9f2f0b13e53041b03ebfdbdbd2942e43 Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Tue, 5 Nov 2024 23:31:14 +0100 +Subject: [PATCH 1/1] libelf: Only fetch shdr once in elf_compress[_gnu] + +Some compilers assume the second call to elf[32|64]_getshdr can fail +and produce error: potential null pointer dereference. Just store the +result of the first call and reuse (when not NULL). + + * libelf/elf_compress.c (elf_compress): Store getshdr result in + a shdr union var. + * libelf/elf_compress_gnu.c (): Likewise + +https://sourceware.org/bugzilla/show_bug.cgi?id=32311 + +Signed-off-by: Mark Wielaard +--- + libelf/elf_compress.c | 55 +++++++++++++++++++++------------------ + libelf/elf_compress_gnu.c | 45 ++++++++++++++------------------ + 2 files changed, 48 insertions(+), 52 deletions(-) + +--- a/libelf/elf_compress.c ++++ b/libelf/elf_compress.c +@@ -584,25 +584,30 @@ elf_compress (Elf_Scn *scn, int type, un + Elf64_Xword sh_flags; + Elf64_Word sh_type; + Elf64_Xword sh_addralign; ++ union shdr ++ { ++ Elf32_Shdr *s32; ++ Elf64_Shdr *s64; ++ } shdr; + if (elfclass == ELFCLASS32) + { +- Elf32_Shdr *shdr = elf32_getshdr (scn); +- if (shdr == NULL) ++ shdr.s32 = elf32_getshdr (scn); ++ if (shdr.s32 == NULL) + return -1; + +- sh_flags = shdr->sh_flags; +- sh_type = shdr->sh_type; +- sh_addralign = shdr->sh_addralign; ++ sh_flags = shdr.s32->sh_flags; ++ sh_type = shdr.s32->sh_type; ++ sh_addralign = shdr.s32->sh_addralign; + } + else + { +- Elf64_Shdr *shdr = elf64_getshdr (scn); +- if (shdr == NULL) ++ shdr.s64 = elf64_getshdr (scn); ++ if (shdr.s64 == NULL) + return -1; + +- sh_flags = shdr->sh_flags; +- sh_type = shdr->sh_type; +- sh_addralign = shdr->sh_addralign; ++ sh_flags = shdr.s64->sh_flags; ++ sh_type = shdr.s64->sh_type; ++ sh_addralign = shdr.s64->sh_addralign; + } + + if ((sh_flags & SHF_ALLOC) != 0) +@@ -679,17 +684,17 @@ elf_compress (Elf_Scn *scn, int type, un + correctly and ignored when SHF_COMPRESSED is set. */ + if (elfclass == ELFCLASS32) + { +- Elf32_Shdr *shdr = elf32_getshdr (scn); +- shdr->sh_size = new_size; +- shdr->sh_addralign = __libelf_type_align (ELFCLASS32, ELF_T_CHDR); +- shdr->sh_flags |= SHF_COMPRESSED; ++ shdr.s32->sh_size = new_size; ++ shdr.s32->sh_addralign = __libelf_type_align (ELFCLASS32, ++ ELF_T_CHDR); ++ shdr.s32->sh_flags |= SHF_COMPRESSED; + } + else + { +- Elf64_Shdr *shdr = elf64_getshdr (scn); +- shdr->sh_size = new_size; +- shdr->sh_addralign = __libelf_type_align (ELFCLASS64, ELF_T_CHDR); +- shdr->sh_flags |= SHF_COMPRESSED; ++ shdr.s64->sh_size = new_size; ++ shdr.s64->sh_addralign = __libelf_type_align (ELFCLASS64, ++ ELF_T_CHDR); ++ shdr.s64->sh_flags |= SHF_COMPRESSED; + } + + __libelf_reset_rawdata (scn, out_buf, new_size, 1, ELF_T_CHDR); +@@ -731,17 +736,15 @@ elf_compress (Elf_Scn *scn, int type, un + correctly and ignored when SHF_COMPRESSED is set. */ + if (elfclass == ELFCLASS32) + { +- Elf32_Shdr *shdr = elf32_getshdr (scn); +- shdr->sh_size = scn->zdata_size; +- shdr->sh_addralign = scn->zdata_align; +- shdr->sh_flags &= ~SHF_COMPRESSED; ++ shdr.s32->sh_size = scn->zdata_size; ++ shdr.s32->sh_addralign = scn->zdata_align; ++ shdr.s32->sh_flags &= ~SHF_COMPRESSED; + } + else + { +- Elf64_Shdr *shdr = elf64_getshdr (scn); +- shdr->sh_size = scn->zdata_size; +- shdr->sh_addralign = scn->zdata_align; +- shdr->sh_flags &= ~SHF_COMPRESSED; ++ shdr.s64->sh_size = scn->zdata_size; ++ shdr.s64->sh_addralign = scn->zdata_align; ++ shdr.s64->sh_flags &= ~SHF_COMPRESSED; + } + + __libelf_reset_rawdata (scn, scn->zdata_base, +--- a/libelf/elf_compress_gnu.c ++++ b/libelf/elf_compress_gnu.c +@@ -59,25 +59,30 @@ elf_compress_gnu (Elf_Scn *scn, int infl + Elf64_Xword sh_flags; + Elf64_Word sh_type; + Elf64_Xword sh_addralign; ++ union shdr ++ { ++ Elf32_Shdr *s32; ++ Elf64_Shdr *s64; ++ } shdr; + if (elfclass == ELFCLASS32) + { +- Elf32_Shdr *shdr = elf32_getshdr (scn); +- if (shdr == NULL) ++ shdr.s32 = elf32_getshdr (scn); ++ if (shdr.s32 == NULL) + return -1; + +- sh_flags = shdr->sh_flags; +- sh_type = shdr->sh_type; +- sh_addralign = shdr->sh_addralign; ++ sh_flags = shdr.s32->sh_flags; ++ sh_type = shdr.s32->sh_type; ++ sh_addralign = shdr.s32->sh_addralign; + } + else + { +- Elf64_Shdr *shdr = elf64_getshdr (scn); +- if (shdr == NULL) ++ shdr.s64 = elf64_getshdr (scn); ++ if (shdr.s64 == NULL) + return -1; + +- sh_flags = shdr->sh_flags; +- sh_type = shdr->sh_type; +- sh_addralign = shdr->sh_addralign; ++ sh_flags = shdr.s64->sh_flags; ++ sh_type = shdr.s64->sh_type; ++ sh_addralign = shdr.s64->sh_addralign; + } + + /* Allocated sections, or sections that are already are compressed +@@ -122,15 +127,9 @@ elf_compress_gnu (Elf_Scn *scn, int infl + sh_flags won't have a SHF_COMPRESSED hint in the GNU format. + Just adjust the sh_size. */ + if (elfclass == ELFCLASS32) +- { +- Elf32_Shdr *shdr = elf32_getshdr (scn); +- shdr->sh_size = new_size; +- } ++ shdr.s32->sh_size = new_size; + else +- { +- Elf64_Shdr *shdr = elf64_getshdr (scn); +- shdr->sh_size = new_size; +- } ++ shdr.s64->sh_size = new_size; + + __libelf_reset_rawdata (scn, out_buf, new_size, 1, ELF_T_BYTE); + +@@ -187,15 +186,9 @@ elf_compress_gnu (Elf_Scn *scn, int infl + sh_flags won't have a SHF_COMPRESSED hint in the GNU format. + Just adjust the sh_size. */ + if (elfclass == ELFCLASS32) +- { +- Elf32_Shdr *shdr = elf32_getshdr (scn); +- shdr->sh_size = size; +- } ++ shdr.s32->sh_size = size; + else +- { +- Elf64_Shdr *shdr = elf64_getshdr (scn); +- shdr->sh_size = size; +- } ++ shdr.s64->sh_size = size; + + __libelf_reset_rawdata (scn, buf_out, size, sh_addralign, + __libelf_data_type (&ehdr, sh_type, From 1eade612f91587eece6deb350948644975cf8a00 Mon Sep 17 00:00:00 2001 From: Rodrigo Balerdi Date: Tue, 24 Sep 2024 17:43:49 -0300 Subject: [PATCH 106/877] ipq807x: nbg7815: use the standard eMMC sysupgrade code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Note that the old ad-hoc method did not explicitly align backup data to 64 KiB boundaries. Signed-off-by: Rodrigo Balerdi Link: https://github.com/openwrt/openwrt/pull/16505 Signed-off-by: Robert Marko (cherry picked from commit 5583d2318966d5d5dcdbdec2e34b8815d3f6419a) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- target/linux/qualcommax/image/ipq807x.mk | 2 +- .../ipq807x/base-files/lib/upgrade/platform.sh | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/target/linux/qualcommax/image/ipq807x.mk b/target/linux/qualcommax/image/ipq807x.mk index faefb479c24ea7..401f455585d4e5 100644 --- a/target/linux/qualcommax/image/ipq807x.mk +++ b/target/linux/qualcommax/image/ipq807x.mk @@ -446,7 +446,7 @@ define Device/zyxel_nbg7815 DEVICE_MODEL := NBG7815 DEVICE_DTS_CONFIG := config@nbg7815 SOC := ipq8074 - DEVICE_PACKAGES := ipq-wifi-zyxel_nbg7815 kmod-ath11k-pci \ + DEVICE_PACKAGES := kmod-fs-f2fs f2fs-tools ipq-wifi-zyxel_nbg7815 kmod-ath11k-pci \ kmod-bluetooth kmod-hwmon-tmp103 endef TARGET_DEVICES += zyxel_nbg7815 diff --git a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh b/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh index 808acac684a216..f822f6291df50c 100644 --- a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh +++ b/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh @@ -251,14 +251,13 @@ platform_do_upgrade() { [ -z "$config_mtdnum" ] && reboot part_num="$(hexdump -e '1/1 "%01x|"' -n 1 -s 168 -C /dev/mtd$config_mtdnum | cut -f 1 -d "|" | head -n1)" if [ "$part_num" -eq "0" ]; then - kernelname="0:HLOS" - rootfsname="rootfs" - mmc_do_upgrade "$1" + CI_KERNPART="0:HLOS" + CI_ROOTPART="rootfs" else - kernelname="0:HLOS_1" - rootfsname="rootfs_1" - mmc_do_upgrade "$1" + CI_KERNPART="0:HLOS_1" + CI_ROOTPART="rootfs_1" fi + emmc_do_upgrade "$1" ;; *) default_do_upgrade "$1" @@ -268,7 +267,8 @@ platform_do_upgrade() { platform_copy_config() { case "$(board_name)" in - spectrum,sax1v1k) + spectrum,sax1v1k|\ + zyxel,nbg7815) emmc_copy_config ;; esac From 16eb043062f16986879d7ff8f6f9b1f773a4a2fd Mon Sep 17 00:00:00 2001 From: Rodrigo Balerdi Date: Fri, 8 Nov 2024 17:40:03 -0300 Subject: [PATCH 107/877] ipq807x: prpl haze & qnap 301w: use the standard eMMC sysupgrade code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Note that the old ad-hoc method did not explicitly align backup data to 64 KiB boundaries. Also note that the qnap 301w has a 'rootfs_data' partition in the eMMC that is being ignored by fstools during boot, presumably due to a bug. This is why the partition is also ignored in the sysupgrade code and there is no definition of CI_DATAPART="rootfs_data". Signed-off-by: Rodrigo Balerdi Link: https://github.com/openwrt/openwrt/pull/16505 Signed-off-by: Robert Marko (cherry picked from commit fe481c9c47d97ebde1bc3c959924f4f9227c6c16) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- target/linux/qualcommax/image/ipq807x.mk | 4 ++-- .../qualcommax/ipq807x/base-files/lib/upgrade/platform.sh | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/target/linux/qualcommax/image/ipq807x.mk b/target/linux/qualcommax/image/ipq807x.mk index 401f455585d4e5..60af8654593a46 100644 --- a/target/linux/qualcommax/image/ipq807x.mk +++ b/target/linux/qualcommax/image/ipq807x.mk @@ -308,7 +308,7 @@ define Device/prpl_haze DEVICE_DTS_CONFIG := config@hk09 SOC := ipq8072 DEVICE_PACKAGES := ath11k-firmware-qcn9074 ipq-wifi-prpl_haze kmod-ath11k-pci \ - mkf2fs f2fsck kmod-fs-f2fs kmod-leds-lp5562 + kmod-fs-f2fs f2fs-tools kmod-leds-lp5562 endef TARGET_DEVICES += prpl_haze @@ -320,7 +320,7 @@ define Device/qnap_301w DEVICE_DTS_CONFIG := config@hk01 KERNEL_SIZE := 16384k SOC := ipq8072 - DEVICE_PACKAGES := ipq-wifi-qnap_301w + DEVICE_PACKAGES := kmod-fs-f2fs f2fs-tools ipq-wifi-qnap_301w endef TARGET_DEVICES += qnap_301w diff --git a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh b/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh index f822f6291df50c..00289dcfe6999e 100644 --- a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh +++ b/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh @@ -185,9 +185,9 @@ platform_do_upgrade() { ;; prpl,haze|\ qnap,301w) - kernelname="0:HLOS" - rootfsname="rootfs" - mmc_do_upgrade "$1" + CI_KERNPART="0:HLOS" + CI_ROOTPART="rootfs" + emmc_do_upgrade "$1" ;; tplink,eap660hd-v1) tplink_do_upgrade "$1" @@ -267,6 +267,8 @@ platform_do_upgrade() { platform_copy_config() { case "$(board_name)" in + prpl,haze|\ + qnap,301w|\ spectrum,sax1v1k|\ zyxel,nbg7815) emmc_copy_config From b1c01cd4b5d0ab8ad8f254836aa3e3c50688a64d Mon Sep 17 00:00:00 2001 From: Rodrigo Balerdi Date: Fri, 8 Nov 2024 17:45:12 -0300 Subject: [PATCH 108/877] ipq807x: order devices alphabetically MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Alphabetically sort devices in platform.sh Signed-off-by: Rodrigo Balerdi Link: https://github.com/openwrt/openwrt/pull/16505 Signed-off-by: Robert Marko (cherry picked from commit 17f84bba44dbee248b3a79935657a74b21caa280) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- .../qualcommax/ipq807x/base-files/lib/upgrade/platform.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh b/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh index 00289dcfe6999e..70657629fcc53c 100644 --- a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh +++ b/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh @@ -189,9 +189,6 @@ platform_do_upgrade() { CI_ROOTPART="rootfs" emmc_do_upgrade "$1" ;; - tplink,eap660hd-v1) - tplink_do_upgrade "$1" - ;; redmi,ax6|\ xiaomi,ax3600|\ xiaomi,ax9000) @@ -217,6 +214,9 @@ platform_do_upgrade() { CI_DATAPART="rootfs_data" emmc_do_upgrade "$1" ;; + tplink,eap660hd-v1) + tplink_do_upgrade "$1" + ;; yuncore,ax880) active="$(fw_printenv -n active)" if [ "$active" -eq "1" ]; then From 05989f69d8e68051bc2058f0ae3b2e14264a4504 Mon Sep 17 00:00:00 2001 From: Rodrigo Balerdi Date: Fri, 8 Nov 2024 17:40:29 -0300 Subject: [PATCH 109/877] ipq807x: delete unused legacy eMMC sysupgrade code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All ipq807x devices that were using the legacy 'mmc_do_upgrade' eMMC sysupgrade code were ported to the replacement 'emmc_do_upgrade' code. Signed-off-by: Rodrigo Balerdi Link: https://github.com/openwrt/openwrt/pull/16505 Signed-off-by: Robert Marko (cherry picked from commit 491121288eaa9d20f3db8215a4790e8f0ee1f8ca) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- .../ipq807x/base-files/lib/upgrade/mmc.sh | 83 ------------------- 1 file changed, 83 deletions(-) delete mode 100644 target/linux/qualcommax/ipq807x/base-files/lib/upgrade/mmc.sh diff --git a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/mmc.sh b/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/mmc.sh deleted file mode 100644 index 21cd7928e303f4..00000000000000 --- a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/mmc.sh +++ /dev/null @@ -1,83 +0,0 @@ -# -# Copyright (C) 2016 lede-project.org -# - -# this can be used as a generic mmc upgrade script -# just add a device entry in platform.sh, -# define "kernelname" and "rootfsname" and call mmc_do_upgrade -# after the kernel and rootfs flash a loopdev (as overlay) is -# setup on top of the rootfs partition -# for the proper function a padded rootfs image is needed, basically -# append "pad-to 64k" to the image definition -# this is based on the ipq806x zyxel.sh mmc upgrade - -. /lib/functions.sh - -mmc_do_upgrade() { - local tar_file="$1" - local rootfs= - local kernel= - - [ -z "$kernel" ] && kernel=$(find_mmc_part ${kernelname}) - [ -z "$rootfs" ] && rootfs=$(find_mmc_part ${rootfsname}) - - [ -z "$kernel" ] && echo "Upgrade failed: kernel partition not found! Rebooting..." && reboot -f - [ -z "$rootfs" ] && echo "Upgrade failed: rootfs partition not found! Rebooting..." && reboot -f - - mmc_do_flash $tar_file $kernel $rootfs - - return 0 -} - -mmc_do_flash() { - local tar_file=$1 - local kernel=$2 - local rootfs=$3 - - # keep sure its unbound - losetup --detach-all || { - echo Failed to detach all loop devices. Skip this try. - reboot -f - } - - # use the first found directory in the tar archive - local board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$') - board_dir=${board_dir%/} - - echo "flashing kernel to $kernel" - tar xf $tar_file ${board_dir}/kernel -O >$kernel - - echo "flashing rootfs to ${rootfs}" - tar xf $tar_file ${board_dir}/root -O >"${rootfs}" - - # a padded rootfs is needed for overlay fs creation - local offset=$(tar xf $tar_file ${board_dir}/root -O | wc -c) - [ $offset -lt 65536 ] && { - echo Wrong size for rootfs: $offset - sleep 10 - reboot -f - } - - # Mount loop for rootfs_data - local loopdev="$(losetup -f)" - losetup -o $offset $loopdev $rootfs || { - echo "Failed to mount looped rootfs_data." - sleep 10 - reboot -f - } - - echo "Format new rootfs_data at position ${offset}." - mkfs.ext4 -F -L rootfs_data $loopdev - mkdir /tmp/new_root - mount -t ext4 $loopdev /tmp/new_root && { - echo "Saving config to rootfs_data at position ${offset}." - cp -v "$UPGRADE_BACKUP" "/tmp/new_root/$BACKUP_FILE" - umount /tmp/new_root - } - - # Cleanup - losetup -d $loopdev >/dev/null 2>&1 - sync - umount -a - reboot -f -} From abf78dd5d8cdf874b074fc96a8802f3178d9a32a Mon Sep 17 00:00:00 2001 From: Mieczyslaw Nalewaj Date: Sun, 17 Nov 2024 08:40:44 +0100 Subject: [PATCH 110/877] kernel: disable drm-i915 module for x86/geode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Disable drm-i915 module for target x86/geode. Fixes: 77cfe8f ("x86: make i915 as a kmod with required firmware") Signed-off-by: Mieczyslaw Nalewaj Link: https://github.com/openwrt/openwrt/pull/16977 Signed-off-by: Robert Marko (cherry picked from commit 226f74badd61fb1586dd3531835aeaa3bf6fe467) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/kernel/linux/modules/video.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/kernel/linux/modules/video.mk b/package/kernel/linux/modules/video.mk index fc0f038863ceaf..f2fa82fd039c78 100644 --- a/package/kernel/linux/modules/video.mk +++ b/package/kernel/linux/modules/video.mk @@ -441,7 +441,8 @@ $(eval $(call KernelPackage,drm-amdgpu)) define KernelPackage/drm-i915 SUBMENU:=$(VIDEO_MENU) TITLE:=Intel i915 DRM support - DEPENDS:=@TARGET_x86 @DISPLAY_SUPPORT +kmod-backlight +kmod-drm-ttm \ + DEPENDS:=@(TARGET_x86_64||TARGET_x86_generic||TARGET_x86_legacy) \ + @DISPLAY_SUPPORT +kmod-backlight +kmod-drm-ttm \ +kmod-drm-ttm-helper +kmod-drm-kms-helper +kmod-i2c-algo-bit +i915-firmware-dmc \ +kmod-drm-display-helper +kmod-drm-buddy +kmod-acpi-video \ +kmod-drm-exec +kmod-drm-suballoc-helper From dae203bd942d5220bee83eb63a75202e339181ad Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 16 Nov 2024 18:38:42 +0100 Subject: [PATCH 111/877] omnia-eeprom: Mark it nonshared MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This tool was build in the phase 2 build, there the TARGET_mvebu_cortexa9_DEVICE_cznic_turris-omnia dependecy was probably not meat. Mark it as non shared to build it together with the target where this option is set. Signed-off-by: Hauke Mehrtens Link: https://github.com/openwrt/openwrt/pull/16975 Signed-off-by: Robert Marko (cherry picked from commit 371e7bef4046fb3992ecfb92b5b741c22fa3ade6) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/utils/omnia-eeprom/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/package/utils/omnia-eeprom/Makefile b/package/utils/omnia-eeprom/Makefile index 03eb13bbc1d23e..f9e48b28b92556 100644 --- a/package/utils/omnia-eeprom/Makefile +++ b/package/utils/omnia-eeprom/Makefile @@ -15,6 +15,7 @@ PKG_SOURCE_SUBDIR:=$(PKG_NAME)-v$(PKG_VERSION) PKG_SOURCE:=$(PKG_NAME)-v$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://gitlab.nic.cz/turris/omnia-eeprom/-/archive/v$(PKG_VERSION)/ PKG_HASH:=6f949d0b8080adca8bae088774ce615b563ba6ec2807cce97ee6769b4eee7bbf +PKG_FLAGS:=nonshared PKG_MAINTAINER:=Marek Behun PKG_LICENSE:=GPL-2.0-or-later From 2884aded40c946aa1fc721dd2e4e5633afe5c256 Mon Sep 17 00:00:00 2001 From: Mieczyslaw Nalewaj Date: Sat, 16 Nov 2024 17:26:52 +0100 Subject: [PATCH 112/877] kernel: move CONFIG_INTEL_MEI settings to target generic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move settings CONFIG_INTEL_MEI_GSC_PROXY, CONFIG_INTEL_MEI_HDCP and CONFIG_INTEL_MEI_PXP to target generic. Signed-off-by: Mieczyslaw Nalewaj Link: https://github.com/openwrt/openwrt/pull/16971 Signed-off-by: Robert Marko (cherry picked from commit 84665993d6beed8ac2b557f8d3e005a29e3fd09c) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- target/linux/generic/config-6.6 | 3 +++ target/linux/x86/64/config-6.6 | 3 --- target/linux/x86/generic/config-6.6 | 3 --- target/linux/x86/legacy/config-6.6 | 3 --- 4 files changed, 3 insertions(+), 9 deletions(-) diff --git a/target/linux/generic/config-6.6 b/target/linux/generic/config-6.6 index 8b22cc40350841..d88738141470a8 100644 --- a/target/linux/generic/config-6.6 +++ b/target/linux/generic/config-6.6 @@ -2715,7 +2715,10 @@ CONFIG_INPUT_MISC=y # CONFIG_INTEL_IOATDMA is not set # CONFIG_INTEL_ISH_HID is not set # CONFIG_INTEL_MEI is not set +# CONFIG_INTEL_MEI_GSC_PROXY is not set +# CONFIG_INTEL_MEI_HDCP is not set # CONFIG_INTEL_MEI_ME is not set +# CONFIG_INTEL_MEI_PXP is not set # CONFIG_INTEL_MEI_TXE is not set # CONFIG_INTEL_OAKTRAIL is not set # CONFIG_INTEL_PMC_CORE is not set diff --git a/target/linux/x86/64/config-6.6 b/target/linux/x86/64/config-6.6 index 3475e65287288b..1d08d31daa03d8 100644 --- a/target/linux/x86/64/config-6.6 +++ b/target/linux/x86/64/config-6.6 @@ -292,9 +292,6 @@ CONFIG_INTEL_IOMMU_PERF_EVENTS=y # CONFIG_INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON is not set # CONFIG_INTEL_IOMMU_SVM is not set # CONFIG_INTEL_IPS is not set -# CONFIG_INTEL_MEI_GSC_PROXY is not set -# CONFIG_INTEL_MEI_HDCP is not set -# CONFIG_INTEL_MEI_PXP is not set CONFIG_INTEL_PCH_THERMAL=y # CONFIG_INTEL_SAR_INT1092 is not set # CONFIG_INTEL_SCU_PLATFORM is not set diff --git a/target/linux/x86/generic/config-6.6 b/target/linux/x86/generic/config-6.6 index ecbd0aa93ee29a..404e3ac330d5c1 100644 --- a/target/linux/x86/generic/config-6.6 +++ b/target/linux/x86/generic/config-6.6 @@ -211,9 +211,6 @@ CONFIG_INPUT_XEN_KBDDEV_FRONTEND=y CONFIG_INTEL_GTT=y CONFIG_INTEL_IDLE=y # CONFIG_INTEL_IPS is not set -# CONFIG_INTEL_MEI_GSC_PROXY is not set -# CONFIG_INTEL_MEI_HDCP is not set -# CONFIG_INTEL_MEI_PXP is not set CONFIG_INTEL_PCH_THERMAL=y # CONFIG_INTEL_SAR_INT1092 is not set # CONFIG_INTEL_SCU_PLATFORM is not set diff --git a/target/linux/x86/legacy/config-6.6 b/target/linux/x86/legacy/config-6.6 index 10511ff08b384d..bc7e74ac3f0e57 100644 --- a/target/linux/x86/legacy/config-6.6 +++ b/target/linux/x86/legacy/config-6.6 @@ -129,9 +129,6 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 CONFIG_INTEL_GTT=y CONFIG_INTEL_IDLE=y # CONFIG_INTEL_IPS is not set -# CONFIG_INTEL_MEI_GSC_PROXY is not set -# CONFIG_INTEL_MEI_HDCP is not set -# CONFIG_INTEL_MEI_PXP is not set # CONFIG_INTEL_SAR_INT1092 is not set # CONFIG_INTEL_SCU_PLATFORM is not set # CONFIG_INTEL_SOC_DTS_THERMAL is not set From 4b9739a0f1f0a1c1706102b15a93b3289fa3de9e Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sat, 16 Nov 2024 11:01:15 -0800 Subject: [PATCH 113/877] kernel: remove GCC11_NO_ARRAY_BOUNDS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This symbol is no longer present. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/16770 Signed-off-by: Hauke Mehrtens (cherry picked from commit da8abd4a1e86a37ddcd4fa0e6acc5bf8b1b4c70e) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- target/linux/bcm47xx/config-6.6 | 1 - target/linux/bcm4908/config-6.6 | 1 - target/linux/bcm53xx/config-6.6 | 1 - target/linux/imx/config-6.6 | 1 - target/linux/ipq40xx/config-6.6 | 1 - target/linux/ipq806x/config-6.6 | 1 - target/linux/kirkwood/config-6.6 | 1 - target/linux/layerscape/armv7/config-6.6 | 1 - target/linux/loongarch64/config-6.6 | 1 - target/linux/malta/config-6.6 | 1 - target/linux/mediatek/filogic/config-6.6 | 1 - target/linux/mediatek/mt7622/config-6.6 | 1 - target/linux/mediatek/mt7623/config-6.6 | 1 - target/linux/mediatek/mt7629/config-6.6 | 1 - target/linux/mpc85xx/config-6.6 | 1 - target/linux/mvebu/config-6.6 | 1 - target/linux/mxs/config-6.6 | 1 - target/linux/qualcommax/config-6.6 | 1 - target/linux/sifiveu/config-6.6 | 1 - target/linux/starfive/config-6.6 | 1 - target/linux/x86/config-6.6 | 1 - 21 files changed, 21 deletions(-) diff --git a/target/linux/bcm47xx/config-6.6 b/target/linux/bcm47xx/config-6.6 index 3b795941f37c65..dcf98603d7b039 100644 --- a/target/linux/bcm47xx/config-6.6 +++ b/target/linux/bcm47xx/config-6.6 @@ -66,7 +66,6 @@ CONFIG_FS_IOMAP=y CONFIG_FUNCTION_ALIGNMENT=0 CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC11_NO_ARRAY_BOUNDS=y CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y diff --git a/target/linux/bcm4908/config-6.6 b/target/linux/bcm4908/config-6.6 index 0c604a1860f925..10e89cea811cbe 100644 --- a/target/linux/bcm4908/config-6.6 +++ b/target/linux/bcm4908/config-6.6 @@ -94,7 +94,6 @@ CONFIG_FUNCTION_ALIGNMENT_4B=y CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC11_NO_ARRAY_BOUNDS=y CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y CONFIG_GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_ARGS=y CONFIG_GENERIC_ALLOCATOR=y diff --git a/target/linux/bcm53xx/config-6.6 b/target/linux/bcm53xx/config-6.6 index 34dcf86e7b8280..cd62b0df581d3a 100644 --- a/target/linux/bcm53xx/config-6.6 +++ b/target/linux/bcm53xx/config-6.6 @@ -140,7 +140,6 @@ CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y # CONFIG_FW_LOADER_USER_HELPER_FALLBACK is not set -CONFIG_GCC11_NO_ARRAY_BOUNDS=y CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ARCH_TOPOLOGY=y diff --git a/target/linux/imx/config-6.6 b/target/linux/imx/config-6.6 index f70e7e150161c2..75ad42c6df0666 100644 --- a/target/linux/imx/config-6.6 +++ b/target/linux/imx/config-6.6 @@ -194,7 +194,6 @@ CONFIG_FS_MBCACHE=y CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC11_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ARCH_TOPOLOGY=y CONFIG_GENERIC_BUG=y diff --git a/target/linux/ipq40xx/config-6.6 b/target/linux/ipq40xx/config-6.6 index 0ee2f433b1e0da..69c27528942d64 100644 --- a/target/linux/ipq40xx/config-6.6 +++ b/target/linux/ipq40xx/config-6.6 @@ -165,7 +165,6 @@ CONFIG_FIX_EARLYCON_MEM=y CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC11_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_BUG=y CONFIG_GENERIC_CLOCKEVENTS=y diff --git a/target/linux/ipq806x/config-6.6 b/target/linux/ipq806x/config-6.6 index 88ec58e2c959bf..af5ccb11acf90e 100644 --- a/target/linux/ipq806x/config-6.6 +++ b/target/linux/ipq806x/config-6.6 @@ -155,7 +155,6 @@ CONFIG_FIX_EARLYCON_MEM=y CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC11_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_BUG=y CONFIG_GENERIC_CLOCKEVENTS=y diff --git a/target/linux/kirkwood/config-6.6 b/target/linux/kirkwood/config-6.6 index b3320dac1f32b2..c5cfecd4e3a749 100644 --- a/target/linux/kirkwood/config-6.6 +++ b/target/linux/kirkwood/config-6.6 @@ -103,7 +103,6 @@ CONFIG_FUNCTION_ALIGNMENT=0 CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC11_NO_ARRAY_BOUNDS=y CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ATOMIC64=y diff --git a/target/linux/layerscape/armv7/config-6.6 b/target/linux/layerscape/armv7/config-6.6 index ee397fc7c6fb24..0a244a85cdf7e6 100644 --- a/target/linux/layerscape/armv7/config-6.6 +++ b/target/linux/layerscape/armv7/config-6.6 @@ -232,7 +232,6 @@ CONFIG_FW_CACHE=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y # CONFIG_FW_LOADER_USER_HELPER_FALLBACK is not set -CONFIG_GCC11_NO_ARRAY_BOUNDS=y CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ARCH_TOPOLOGY=y diff --git a/target/linux/loongarch64/config-6.6 b/target/linux/loongarch64/config-6.6 index 46a90c1284955f..5cbf1177cd5ddd 100644 --- a/target/linux/loongarch64/config-6.6 +++ b/target/linux/loongarch64/config-6.6 @@ -285,7 +285,6 @@ CONFIG_FW_CACHE=y # CONFIG_FW_DEVLINK_SYNC_STATE_TIMEOUT is not set CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC11_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_BUG=y CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y diff --git a/target/linux/malta/config-6.6 b/target/linux/malta/config-6.6 index 73db6cea21d3c7..f6d9049f4d758b 100644 --- a/target/linux/malta/config-6.6 +++ b/target/linux/malta/config-6.6 @@ -84,7 +84,6 @@ CONFIG_FS_MBCACHE=y CONFIG_FUNCTION_ALIGNMENT=0 CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC11_NO_ARRAY_BOUNDS=y CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y diff --git a/target/linux/mediatek/filogic/config-6.6 b/target/linux/mediatek/filogic/config-6.6 index ba472b6ced78af..936f1009d9a69f 100644 --- a/target/linux/mediatek/filogic/config-6.6 +++ b/target/linux/mediatek/filogic/config-6.6 @@ -168,7 +168,6 @@ CONFIG_FUNCTION_ALIGNMENT_4B=y CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC11_NO_ARRAY_BOUNDS=y CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y CONFIG_GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_ARGS=y CONFIG_GENERIC_ALLOCATOR=y diff --git a/target/linux/mediatek/mt7622/config-6.6 b/target/linux/mediatek/mt7622/config-6.6 index e4a9e4b9cb66e9..9440a7bb280a33 100644 --- a/target/linux/mediatek/mt7622/config-6.6 +++ b/target/linux/mediatek/mt7622/config-6.6 @@ -174,7 +174,6 @@ CONFIG_FUNCTION_ALIGNMENT_4B=y CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC11_NO_ARRAY_BOUNDS=y CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y CONFIG_GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_ARGS=y CONFIG_GENERIC_ALLOCATOR=y diff --git a/target/linux/mediatek/mt7623/config-6.6 b/target/linux/mediatek/mt7623/config-6.6 index d04188f20cd6d0..dc31c230a23b3b 100644 --- a/target/linux/mediatek/mt7623/config-6.6 +++ b/target/linux/mediatek/mt7623/config-6.6 @@ -240,7 +240,6 @@ CONFIG_FWNODE_MDIO=y CONFIG_FW_CACHE=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC11_NO_ARRAY_BOUNDS=y CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_BUG=y diff --git a/target/linux/mediatek/mt7629/config-6.6 b/target/linux/mediatek/mt7629/config-6.6 index 384311dc7107cf..d74e143c106507 100644 --- a/target/linux/mediatek/mt7629/config-6.6 +++ b/target/linux/mediatek/mt7629/config-6.6 @@ -113,7 +113,6 @@ CONFIG_FUNCTION_ALIGNMENT=0 CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC11_NO_ARRAY_BOUNDS=y CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ARCH_TOPOLOGY=y diff --git a/target/linux/mpc85xx/config-6.6 b/target/linux/mpc85xx/config-6.6 index 14d5650fb50746..c5563958a81e7d 100644 --- a/target/linux/mpc85xx/config-6.6 +++ b/target/linux/mpc85xx/config-6.6 @@ -86,7 +86,6 @@ CONFIG_FUNCTION_ALIGNMENT=0 CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC11_NO_ARRAY_BOUNDS=y CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ATOMIC64=y diff --git a/target/linux/mvebu/config-6.6 b/target/linux/mvebu/config-6.6 index a4572d8a896bda..f132884d491d9e 100644 --- a/target/linux/mvebu/config-6.6 +++ b/target/linux/mvebu/config-6.6 @@ -161,7 +161,6 @@ CONFIG_FS_MBCACHE=y CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC11_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ARCH_TOPOLOGY=y CONFIG_GENERIC_BUG=y diff --git a/target/linux/mxs/config-6.6 b/target/linux/mxs/config-6.6 index 76aecd17ff5aeb..b4bc5b3051c44f 100644 --- a/target/linux/mxs/config-6.6 +++ b/target/linux/mxs/config-6.6 @@ -92,7 +92,6 @@ CONFIG_FUNCTION_ALIGNMENT=0 CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC11_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_BUG=y diff --git a/target/linux/qualcommax/config-6.6 b/target/linux/qualcommax/config-6.6 index 1d05868cafd291..ac2494d74913dc 100644 --- a/target/linux/qualcommax/config-6.6 +++ b/target/linux/qualcommax/config-6.6 @@ -151,7 +151,6 @@ CONFIG_FUNCTION_ALIGNMENT_4B=y CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC11_NO_ARRAY_BOUNDS=y CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y CONFIG_GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_ARGS=y CONFIG_GENERIC_ALLOCATOR=y diff --git a/target/linux/sifiveu/config-6.6 b/target/linux/sifiveu/config-6.6 index 2e5474ce2f5f7c..8ed8f766c8cd0a 100644 --- a/target/linux/sifiveu/config-6.6 +++ b/target/linux/sifiveu/config-6.6 @@ -118,7 +118,6 @@ CONFIG_FS_MBCACHE=y CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC11_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ARCH_TOPOLOGY=y CONFIG_GENERIC_BUG=y diff --git a/target/linux/starfive/config-6.6 b/target/linux/starfive/config-6.6 index 8ebced1165c5a6..ef71001663d9e6 100644 --- a/target/linux/starfive/config-6.6 +++ b/target/linux/starfive/config-6.6 @@ -190,7 +190,6 @@ CONFIG_FS_MBCACHE=y CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC11_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ARCH_TOPOLOGY=y CONFIG_GENERIC_BUG=y diff --git a/target/linux/x86/config-6.6 b/target/linux/x86/config-6.6 index 3d1c00513852d4..1a68c589a50be1 100644 --- a/target/linux/x86/config-6.6 +++ b/target/linux/x86/config-6.6 @@ -137,7 +137,6 @@ CONFIG_FUSION_MAX_SGE=128 CONFIG_FUSION_SPI=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC11_NO_ARRAY_BOUNDS=y CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y # CONFIG_GDS_FORCE_MITIGATION is not set CONFIG_GENERIC_ALLOCATOR=y From 7142e35777248710635f0152ccee2fba78325395 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Wed, 2 Oct 2024 15:25:35 -0700 Subject: [PATCH 114/877] kernel: filter out compiler opts from config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These get dynamically set based on compiler version. Not relevant for targets. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/16770 Signed-off-by: Hauke Mehrtens (cherry picked from commit cd92cbddf8c473507a9af290c99f2aef8c368784) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- target/linux/airoha/an7581/config-6.6 | 3 --- target/linux/airoha/en7523/config-6.6 | 3 --- target/linux/apm821xx/config-6.6 | 3 --- target/linux/archs38/config-6.6 | 3 --- target/linux/at91/sam9x/config-6.6 | 3 --- target/linux/at91/sama5/config-6.6 | 3 --- target/linux/at91/sama7/config-6.6 | 3 --- target/linux/ath79/config-6.6 | 3 --- target/linux/bcm27xx/bcm2708/config-6.6 | 3 --- target/linux/bcm27xx/bcm2709/config-6.6 | 3 --- target/linux/bcm27xx/bcm2710/config-6.6 | 3 --- target/linux/bcm27xx/bcm2711/config-6.6 | 3 --- target/linux/bcm27xx/bcm2712/config-6.6 | 3 --- target/linux/bcm47xx/config-6.6 | 2 -- target/linux/bcm4908/config-6.6 | 2 -- target/linux/bcm53xx/config-6.6 | 2 -- target/linux/bmips/bcm6318/config-6.6 | 3 --- target/linux/bmips/bcm63268/config-6.6 | 3 --- target/linux/bmips/bcm6328/config-6.6 | 3 --- target/linux/bmips/bcm6358/config-6.6 | 3 --- target/linux/bmips/bcm6362/config-6.6 | 3 --- target/linux/bmips/bcm6368/config-6.6 | 3 --- target/linux/d1/config-6.6 | 2 -- target/linux/gemini/config-6.6 | 3 --- target/linux/generic/config-filter | 3 +++ target/linux/imx/config-6.6 | 2 -- target/linux/ipq40xx/config-6.6 | 2 -- target/linux/ipq806x/config-6.6 | 2 -- target/linux/ixp4xx/config-6.6 | 3 --- target/linux/kirkwood/config-6.6 | 2 -- target/linux/lantiq/config-6.6 | 3 --- target/linux/layerscape/armv7/config-6.6 | 2 -- target/linux/layerscape/armv8_64b/config-6.6 | 3 --- target/linux/loongarch64/config-6.6 | 2 -- target/linux/malta/config-6.6 | 2 -- target/linux/mediatek/filogic/config-6.6 | 2 -- target/linux/mediatek/mt7622/config-6.6 | 2 -- target/linux/mediatek/mt7623/config-6.6 | 2 -- target/linux/mediatek/mt7629/config-6.6 | 2 -- target/linux/mpc85xx/config-6.6 | 2 -- target/linux/mvebu/config-6.6 | 2 -- target/linux/mxs/config-6.6 | 2 -- target/linux/octeon/config-6.6 | 3 --- target/linux/omap/config-6.6 | 3 --- target/linux/pistachio/config-6.6 | 3 --- target/linux/qoriq/config-6.6 | 3 --- target/linux/qualcommax/config-6.6 | 2 -- target/linux/ramips/mt7620/config-6.6 | 3 --- target/linux/ramips/mt7621/config-6.6 | 3 --- target/linux/ramips/mt76x8/config-6.6 | 3 --- target/linux/ramips/rt288x/config-6.6 | 3 --- target/linux/ramips/rt305x/config-6.6 | 3 --- target/linux/ramips/rt3883/config-6.6 | 3 --- target/linux/rockchip/armv8/config-6.6 | 3 --- target/linux/sifiveu/config-6.6 | 2 -- target/linux/siflower/sf19a2890/config-6.6 | 3 --- target/linux/starfive/config-6.6 | 2 -- target/linux/tegra/config-6.6 | 3 --- target/linux/x86/config-6.6 | 2 -- target/linux/zynq/config-6.6 | 3 --- 60 files changed, 3 insertions(+), 155 deletions(-) diff --git a/target/linux/airoha/an7581/config-6.6 b/target/linux/airoha/an7581/config-6.6 index 5001de9b199472..b26cbeeb33e1fa 100644 --- a/target/linux/airoha/an7581/config-6.6 +++ b/target/linux/airoha/an7581/config-6.6 @@ -111,8 +111,6 @@ CONFIG_CAVIUM_ERRATUM_30115=y CONFIG_CAVIUM_TX2_ERRATUM_219=y CONFIG_CC_HAVE_SHADOW_CALL_STACK=y CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y # CONFIG_CFS_BANDWIDTH is not set CONFIG_CGROUPS=y CONFIG_CGROUP_CPUACCT=y @@ -232,7 +230,6 @@ CONFIG_FUNCTION_ALIGNMENT_4B=y CONFIG_FWNODE_MDIO=y CONFIG_FW_CACHE=y # CONFIG_FW_LOADER_USER_HELPER is not set -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_ARGS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ARCH_TOPOLOGY=y diff --git a/target/linux/airoha/en7523/config-6.6 b/target/linux/airoha/en7523/config-6.6 index ce93f7d9ff6f57..a40b61696a11af 100644 --- a/target/linux/airoha/en7523/config-6.6 +++ b/target/linux/airoha/en7523/config-6.6 @@ -45,8 +45,6 @@ CONFIG_BSD_PROCESS_ACCT=y CONFIG_BSD_PROCESS_ACCT_V3=y CONFIG_CACHE_L2X0=y CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CLONE_BACKWARDS=y CONFIG_CMDLINE="rootfstype=squashfs,jffs2" CONFIG_CMDLINE_FROM_BOOTLOADER=y @@ -102,7 +100,6 @@ CONFIG_FUNCTION_ALIGNMENT=0 CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ARCH_TOPOLOGY=y diff --git a/target/linux/apm821xx/config-6.6 b/target/linux/apm821xx/config-6.6 index 33e586632cd762..a9c9a952c8c50b 100644 --- a/target/linux/apm821xx/config-6.6 +++ b/target/linux/apm821xx/config-6.6 @@ -34,8 +34,6 @@ CONFIG_BOOKE=y CONFIG_BOOKE_OR_40x=y CONFIG_BOOKE_WDT=y # CONFIG_CANYONLANDS is not set -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CLONE_BACKWARDS=y CONFIG_CMDLINE="rootfstype=squashfs noinitrd" CONFIG_CMDLINE_FROM_BOOTLOADER=y @@ -83,7 +81,6 @@ CONFIG_FUNCTION_ALIGNMENT=0 CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_BUG=y diff --git a/target/linux/archs38/config-6.6 b/target/linux/archs38/config-6.6 index 6298ce9e462c5c..dab1b855b9cb5d 100644 --- a/target/linux/archs38/config-6.6 +++ b/target/linux/archs38/config-6.6 @@ -47,8 +47,6 @@ CONFIG_BLK_DEV_RAM_COUNT=16 CONFIG_BLK_DEV_RAM_SIZE=4096 CONFIG_BLK_DEV_SD=y CONFIG_BUFFER_HEAD=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CLK_HSDK=y CONFIG_CLONE_BACKWARDS=y CONFIG_COMMON_CLK=y @@ -103,7 +101,6 @@ CONFIG_FUNCTION_ALIGNMENT=0 CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CSUM=y diff --git a/target/linux/at91/sam9x/config-6.6 b/target/linux/at91/sam9x/config-6.6 index d5cfa5f753933f..2631f0feea15f7 100644 --- a/target/linux/at91/sam9x/config-6.6 +++ b/target/linux/at91/sam9x/config-6.6 @@ -44,8 +44,6 @@ CONFIG_BINFMT_FLAT_ARGVP_ENVP_ON_STACK=y CONFIG_BLK_PM=y CONFIG_BUFFER_HEAD=y CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CLONE_BACKWARDS=y CONFIG_COMMON_CLK=y CONFIG_COMMON_CLK_AT91=y @@ -109,7 +107,6 @@ CONFIG_FWNODE_MDIO=y CONFIG_FW_CACHE=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_BUG=y diff --git a/target/linux/at91/sama5/config-6.6 b/target/linux/at91/sama5/config-6.6 index 04eee7a210f354..d04e10f9e15849 100644 --- a/target/linux/at91/sama5/config-6.6 +++ b/target/linux/at91/sama5/config-6.6 @@ -54,8 +54,6 @@ CONFIG_BLK_PM=y CONFIG_BUFFER_HEAD=y CONFIG_CACHE_L2X0=y CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CLONE_BACKWARDS=y CONFIG_CMA=y CONFIG_CMA_ALIGNMENT=8 @@ -181,7 +179,6 @@ CONFIG_FWNODE_MDIO=y CONFIG_FW_CACHE=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_BUG=y CONFIG_GENERIC_CLOCKEVENTS=y diff --git a/target/linux/at91/sama7/config-6.6 b/target/linux/at91/sama7/config-6.6 index e3455c5e379f27..c69cbdf7671c0e 100644 --- a/target/linux/at91/sama7/config-6.6 +++ b/target/linux/at91/sama7/config-6.6 @@ -45,8 +45,6 @@ CONFIG_BUFFER_HEAD=y # CONFIG_CACHE_L2X0 is not set CONFIG_CAN=y CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CLONE_BACKWARDS=y CONFIG_CMA=y CONFIG_CMA_ALIGNMENT=9 @@ -162,7 +160,6 @@ CONFIG_FUNCTION_ALIGNMENT=0 CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_BUG=y CONFIG_GENERIC_CLOCKEVENTS=y diff --git a/target/linux/ath79/config-6.6 b/target/linux/ath79/config-6.6 index 92057c343c09d1..c43dbfd7194dad 100644 --- a/target/linux/ath79/config-6.6 +++ b/target/linux/ath79/config-6.6 @@ -14,8 +14,6 @@ CONFIG_AT803X_PHY=y CONFIG_ATH79=y CONFIG_ATH79_WDT=y CONFIG_BLK_MQ_PCI=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CEVT_R4K=y CONFIG_CLONE_BACKWARDS=y CONFIG_CMDLINE="rootfstype=squashfs,jffs2" @@ -58,7 +56,6 @@ CONFIG_FUNCTION_ALIGNMENT=0 CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y diff --git a/target/linux/bcm27xx/bcm2708/config-6.6 b/target/linux/bcm27xx/bcm2708/config-6.6 index 4872e44642f8f0..b587b5d7198b2c 100644 --- a/target/linux/bcm27xx/bcm2708/config-6.6 +++ b/target/linux/bcm27xx/bcm2708/config-6.6 @@ -55,8 +55,6 @@ CONFIG_BRCM_CHAR_DRIVERS=y CONFIG_BUFFER_HEAD=y # CONFIG_CACHE_L2X0 is not set CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CLKSRC_MMIO=y CONFIG_CLK_BCM2711_DVP=y CONFIG_CLK_BCM2835=y @@ -172,7 +170,6 @@ CONFIG_FWNODE_MDIO=y CONFIG_FW_CACHE=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_BUG=y CONFIG_GENERIC_CLOCKEVENTS=y diff --git a/target/linux/bcm27xx/bcm2709/config-6.6 b/target/linux/bcm27xx/bcm2709/config-6.6 index 23e93241dfe3f5..4a295d52c86030 100644 --- a/target/linux/bcm27xx/bcm2709/config-6.6 +++ b/target/linux/bcm27xx/bcm2709/config-6.6 @@ -69,8 +69,6 @@ CONFIG_BROADCOM_PHY=y CONFIG_BUFFER_HEAD=y # CONFIG_CACHE_L2X0 is not set CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CLKSRC_MMIO=y CONFIG_CLK_BCM2711_DVP=y CONFIG_CLK_BCM2835=y @@ -211,7 +209,6 @@ CONFIG_FWNODE_MDIO=y CONFIG_FW_CACHE=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ARCH_TOPOLOGY=y CONFIG_GENERIC_BUG=y diff --git a/target/linux/bcm27xx/bcm2710/config-6.6 b/target/linux/bcm27xx/bcm2710/config-6.6 index 5b7d6ae4f1032b..97f2f110b06500 100644 --- a/target/linux/bcm27xx/bcm2710/config-6.6 +++ b/target/linux/bcm27xx/bcm2710/config-6.6 @@ -85,8 +85,6 @@ CONFIG_CAVIUM_ERRATUM_23154=y CONFIG_CAVIUM_ERRATUM_27456=y CONFIG_CC_HAVE_SHADOW_CALL_STACK=y CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CLKSRC_MMIO=y CONFIG_CLK_BCM2711_DVP=y CONFIG_CLK_BCM2835=y @@ -218,7 +216,6 @@ CONFIG_FWNODE_MDIO=y CONFIG_FW_CACHE=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_ARGS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ARCH_TOPOLOGY=y diff --git a/target/linux/bcm27xx/bcm2711/config-6.6 b/target/linux/bcm27xx/bcm2711/config-6.6 index 270763549a199e..f9b74696073042 100644 --- a/target/linux/bcm27xx/bcm2711/config-6.6 +++ b/target/linux/bcm27xx/bcm2711/config-6.6 @@ -84,8 +84,6 @@ CONFIG_CAVIUM_ERRATUM_23154=y CONFIG_CAVIUM_ERRATUM_27456=y CONFIG_CC_HAVE_SHADOW_CALL_STACK=y CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CLKSRC_MMIO=y CONFIG_CLK_BCM2711_DVP=y CONFIG_CLK_BCM2835=y @@ -219,7 +217,6 @@ CONFIG_FWNODE_MDIO=y CONFIG_FW_CACHE=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_ARGS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ARCH_NUMA=y diff --git a/target/linux/bcm27xx/bcm2712/config-6.6 b/target/linux/bcm27xx/bcm2712/config-6.6 index a5eb6c4d0e1f12..5abc41ff681d43 100644 --- a/target/linux/bcm27xx/bcm2712/config-6.6 +++ b/target/linux/bcm27xx/bcm2712/config-6.6 @@ -110,8 +110,6 @@ CONFIG_BUFFER_HEAD=y CONFIG_BUILTIN_RETURN_ADDRESS_STRIPS_PAC=y CONFIG_CC_HAVE_SHADOW_CALL_STACK=y CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CLKSRC_MMIO=y CONFIG_CLK_BCM2711_DVP=y CONFIG_CLK_BCM2835=y @@ -262,7 +260,6 @@ CONFIG_FWNODE_MDIO=y CONFIG_FW_CACHE=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_ARGS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ARCH_NUMA=y diff --git a/target/linux/bcm47xx/config-6.6 b/target/linux/bcm47xx/config-6.6 index dcf98603d7b039..ec549f6e331d86 100644 --- a/target/linux/bcm47xx/config-6.6 +++ b/target/linux/bcm47xx/config-6.6 @@ -27,8 +27,6 @@ CONFIG_BCMA_PFLASH=y CONFIG_BCMA_SFLASH=y # CONFIG_BGMAC_BCMA is not set CONFIG_BLK_MQ_PCI=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CEVT_R4K=y CONFIG_CLONE_BACKWARDS=y CONFIG_CMDLINE="noinitrd console=ttyS0,115200" diff --git a/target/linux/bcm4908/config-6.6 b/target/linux/bcm4908/config-6.6 index 10e89cea811cbe..02eb2f2ce6bcdd 100644 --- a/target/linux/bcm4908/config-6.6 +++ b/target/linux/bcm4908/config-6.6 @@ -49,8 +49,6 @@ CONFIG_BLK_PM=y CONFIG_BUILTIN_RETURN_ADDRESS_STRIPS_PAC=y CONFIG_CC_HAVE_SHADOW_CALL_STACK=y CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CLK_BCM_63XX=y CONFIG_CLONE_BACKWARDS=y CONFIG_CMDLINE="earlycon=bcm63xx_uart,0xff800640 console=ttyS0,115200" diff --git a/target/linux/bcm53xx/config-6.6 b/target/linux/bcm53xx/config-6.6 index cd62b0df581d3a..9e3211801c8971 100644 --- a/target/linux/bcm53xx/config-6.6 +++ b/target/linux/bcm53xx/config-6.6 @@ -73,8 +73,6 @@ CONFIG_BOUNCE=y CONFIG_BROADCOM_PHY=y CONFIG_CACHE_L2X0=y CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK=y CONFIG_CLKSRC_MMIO=y # CONFIG_CLK_BCM_NS2 is not set diff --git a/target/linux/bmips/bcm6318/config-6.6 b/target/linux/bmips/bcm6318/config-6.6 index 665e7f28471042..ae4516cdcc0eb1 100644 --- a/target/linux/bmips/bcm6318/config-6.6 +++ b/target/linux/bmips/bcm6318/config-6.6 @@ -17,8 +17,6 @@ CONFIG_BCM7038_WDT=y CONFIG_BLK_MQ_PCI=y CONFIG_BLK_PM=y CONFIG_BMIPS_GENERIC=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CEVT_R4K=y # CONFIG_CLK_BCM63268_TIMER is not set CONFIG_CLK_BCM_63XX_GATE=y @@ -86,7 +84,6 @@ CONFIG_FWNODE_MDIO=y CONFIG_FW_CFE=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y diff --git a/target/linux/bmips/bcm63268/config-6.6 b/target/linux/bmips/bcm63268/config-6.6 index 8e060fd77c2a8e..e71c70dce94363 100644 --- a/target/linux/bmips/bcm63268/config-6.6 +++ b/target/linux/bmips/bcm63268/config-6.6 @@ -17,8 +17,6 @@ CONFIG_BCM7038_WDT=y CONFIG_BLK_MQ_PCI=y CONFIG_BLK_PM=y CONFIG_BMIPS_GENERIC=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CEVT_R4K=y CONFIG_CLK_BCM63268_TIMER=y CONFIG_CLK_BCM_63XX_GATE=y @@ -87,7 +85,6 @@ CONFIG_FWNODE_MDIO=y CONFIG_FW_CFE=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y diff --git a/target/linux/bmips/bcm6328/config-6.6 b/target/linux/bmips/bcm6328/config-6.6 index 95d0ce6c9e2995..c069c11d9bfa82 100644 --- a/target/linux/bmips/bcm6328/config-6.6 +++ b/target/linux/bmips/bcm6328/config-6.6 @@ -17,8 +17,6 @@ CONFIG_BCM7038_WDT=y CONFIG_BLK_MQ_PCI=y CONFIG_BLK_PM=y CONFIG_BMIPS_GENERIC=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CEVT_R4K=y # CONFIG_CLK_BCM63268_TIMER is not set CONFIG_CLK_BCM_63XX_GATE=y @@ -87,7 +85,6 @@ CONFIG_FWNODE_MDIO=y CONFIG_FW_CFE=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y diff --git a/target/linux/bmips/bcm6358/config-6.6 b/target/linux/bmips/bcm6358/config-6.6 index 8247e65e34b9de..0b3c0dd701fde0 100644 --- a/target/linux/bmips/bcm6358/config-6.6 +++ b/target/linux/bmips/bcm6358/config-6.6 @@ -15,8 +15,6 @@ CONFIG_BCM7038_WDT=y CONFIG_BLK_MQ_PCI=y CONFIG_BLK_PM=y CONFIG_BMIPS_GENERIC=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CEVT_R4K=y # CONFIG_CLK_BCM63268_TIMER is not set CONFIG_CLK_BCM_63XX_GATE=y @@ -84,7 +82,6 @@ CONFIG_FWNODE_MDIO=y CONFIG_FW_CFE=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y diff --git a/target/linux/bmips/bcm6362/config-6.6 b/target/linux/bmips/bcm6362/config-6.6 index c47f72c1b69eb6..5e6a936ab1b702 100644 --- a/target/linux/bmips/bcm6362/config-6.6 +++ b/target/linux/bmips/bcm6362/config-6.6 @@ -17,8 +17,6 @@ CONFIG_BCM7038_WDT=y CONFIG_BLK_MQ_PCI=y CONFIG_BLK_PM=y CONFIG_BMIPS_GENERIC=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CEVT_R4K=y # CONFIG_CLK_BCM63268_TIMER is not set CONFIG_CLK_BCM_63XX_GATE=y @@ -87,7 +85,6 @@ CONFIG_FWNODE_MDIO=y CONFIG_FW_CFE=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y diff --git a/target/linux/bmips/bcm6368/config-6.6 b/target/linux/bmips/bcm6368/config-6.6 index 204b1628a416f1..e214d9a0f15f05 100644 --- a/target/linux/bmips/bcm6368/config-6.6 +++ b/target/linux/bmips/bcm6368/config-6.6 @@ -16,8 +16,6 @@ CONFIG_BCM7038_WDT=y CONFIG_BLK_MQ_PCI=y CONFIG_BLK_PM=y CONFIG_BMIPS_GENERIC=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CEVT_R4K=y # CONFIG_CLK_BCM63268_TIMER is not set CONFIG_CLK_BCM_63XX_GATE=y @@ -86,7 +84,6 @@ CONFIG_FWNODE_MDIO=y CONFIG_FW_CFE=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y diff --git a/target/linux/d1/config-6.6 b/target/linux/d1/config-6.6 index 5a5b4c3d36d379..7330cc0e24473a 100644 --- a/target/linux/d1/config-6.6 +++ b/target/linux/d1/config-6.6 @@ -22,8 +22,6 @@ CONFIG_ASSOCIATIVE_ARRAY=y CONFIG_BLK_DEV_SD=y CONFIG_BLK_MQ_PCI=y CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CLKSRC_MMIO=y CONFIG_CLONE_BACKWARDS=y CONFIG_CLZ_TAB=y diff --git a/target/linux/gemini/config-6.6 b/target/linux/gemini/config-6.6 index a93297a423eba8..2e590540afa95f 100644 --- a/target/linux/gemini/config-6.6 +++ b/target/linux/gemini/config-6.6 @@ -35,8 +35,6 @@ CONFIG_BOUNCE=y CONFIG_BUFFER_HEAD=y CONFIG_CACHESTAT_SYSCALL=y CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CLKSRC_MMIO=y CONFIG_CLONE_BACKWARDS=y CONFIG_CMA=y @@ -187,7 +185,6 @@ CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y # CONFIG_FW_LOADER_USER_HELPER_FALLBACK is not set -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y CONFIG_GEMINI_ETHERNET=y CONFIG_GENERIC_ALLOCATOR=y diff --git a/target/linux/generic/config-filter b/target/linux/generic/config-filter index e72c334ee7af03..274c31ecb0786c 100644 --- a/target/linux/generic/config-filter +++ b/target/linux/generic/config-filter @@ -3,8 +3,11 @@ # CONFIG_ARM64_CONT_.*_SHIFT is not set # CONFIG_AS_.* is not set # CONFIG_CC_(CAN|HAS|IS|VERSION)_.* is not set +# CONFIG_CC_IMPLICIT_FALLTHROUGH is not set +# CONFIG_CC_NO_ARRAY_BOUNDS is not set CONFIG_CLANG_VERSION=.* CONFIG_FRAME_WARN=.* +# CONFIG_GCC10_NO_ARRAY_BOUNDS is not set # CONFIG_GCC_VERSION is not set # CONFIG_HAVE_(?!(ARCH_TIMER|TCM|SMP)).* is not set # CONFIG_INLINE_.* is not set diff --git a/target/linux/imx/config-6.6 b/target/linux/imx/config-6.6 index 75ad42c6df0666..fb841686ff6b36 100644 --- a/target/linux/imx/config-6.6 +++ b/target/linux/imx/config-6.6 @@ -44,8 +44,6 @@ CONFIG_BLK_DEV_SD=y CONFIG_BLK_PM=y CONFIG_CACHE_L2X0=y CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CLKSRC_IMX_GPT=y CONFIG_CLKSRC_MMIO=y # CONFIG_CLK_IMX8MM is not set diff --git a/target/linux/ipq40xx/config-6.6 b/target/linux/ipq40xx/config-6.6 index 69c27528942d64..d1c181cd0d1b2f 100644 --- a/target/linux/ipq40xx/config-6.6 +++ b/target/linux/ipq40xx/config-6.6 @@ -52,8 +52,6 @@ CONFIG_BLK_MQ_PCI=y CONFIG_BOUNCE=y # CONFIG_CACHE_L2X0 is not set CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CLKSRC_QCOM=y CONFIG_CLONE_BACKWARDS=y CONFIG_CMDLINE_PARTITION=y diff --git a/target/linux/ipq806x/config-6.6 b/target/linux/ipq806x/config-6.6 index af5ccb11acf90e..bc3761b2e5950f 100644 --- a/target/linux/ipq806x/config-6.6 +++ b/target/linux/ipq806x/config-6.6 @@ -57,8 +57,6 @@ CONFIG_BLK_MQ_PCI=y CONFIG_BOUNCE=y # CONFIG_CACHE_L2X0 is not set CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CLKSRC_QCOM=y CONFIG_CLONE_BACKWARDS=y CONFIG_CMDLINE_OVERRIDE=y diff --git a/target/linux/ixp4xx/config-6.6 b/target/linux/ixp4xx/config-6.6 index 960012ada45a24..84a72c8d5caa17 100644 --- a/target/linux/ixp4xx/config-6.6 +++ b/target/linux/ixp4xx/config-6.6 @@ -32,8 +32,6 @@ CONFIG_BLK_DEV_SD=y CONFIG_BLK_MQ_PCI=y CONFIG_BUFFER_HEAD=y CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CLKSRC_MMIO=y CONFIG_CLONE_BACKWARDS=y CONFIG_COMMON_CLK=y @@ -88,7 +86,6 @@ CONFIG_FUNCTION_ALIGNMENT=0 CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ATOMIC64=y diff --git a/target/linux/kirkwood/config-6.6 b/target/linux/kirkwood/config-6.6 index c5cfecd4e3a749..751d3e6a1b4608 100644 --- a/target/linux/kirkwood/config-6.6 +++ b/target/linux/kirkwood/config-6.6 @@ -38,8 +38,6 @@ CONFIG_BLK_MQ_PCI=y CONFIG_CACHE_FEROCEON_L2=y # CONFIG_CACHE_FEROCEON_L2_WRITETHROUGH is not set CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CLKSRC_MMIO=y CONFIG_CLONE_BACKWARDS=y CONFIG_COMMON_CLK=y diff --git a/target/linux/lantiq/config-6.6 b/target/linux/lantiq/config-6.6 index 1890d82ff8bb92..2bc5b92ce8ffa4 100644 --- a/target/linux/lantiq/config-6.6 +++ b/target/linux/lantiq/config-6.6 @@ -4,8 +4,6 @@ CONFIG_ARCH_KEEP_MEMBLOCK=y CONFIG_ARCH_MMAP_RND_BITS_MAX=15 CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=15 CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CEVT_R4K=y CONFIG_CLONE_BACKWARDS=y CONFIG_COMPACT_UNEVICTABLE_DEFAULT=1 @@ -44,7 +42,6 @@ CONFIG_FUNCTION_ALIGNMENT=0 CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y diff --git a/target/linux/layerscape/armv7/config-6.6 b/target/linux/layerscape/armv7/config-6.6 index 0a244a85cdf7e6..be8eca1bf71fa4 100644 --- a/target/linux/layerscape/armv7/config-6.6 +++ b/target/linux/layerscape/armv7/config-6.6 @@ -77,8 +77,6 @@ CONFIG_BROADCOM_PHY=y CONFIG_BUFFER_HEAD=y CONFIG_CACHE_L2X0=y CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CDROM=y CONFIG_CHECKPOINT_RESTORE=y CONFIG_CHR_DEV_SG=y diff --git a/target/linux/layerscape/armv8_64b/config-6.6 b/target/linux/layerscape/armv8_64b/config-6.6 index 3c052edb7d010e..55b9d9b934a640 100644 --- a/target/linux/layerscape/armv8_64b/config-6.6 +++ b/target/linux/layerscape/armv8_64b/config-6.6 @@ -110,8 +110,6 @@ CONFIG_CAVIUM_ERRATUM_23154=y CONFIG_CAVIUM_ERRATUM_27456=y CONFIG_CC_HAVE_SHADOW_CALL_STACK=y CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CHECKPOINT_RESTORE=y CONFIG_CHROME_PLATFORMS=y CONFIG_CLK_LS1028A_PLLDIG=y @@ -330,7 +328,6 @@ CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y # CONFIG_FW_LOADER_USER_HELPER_FALLBACK is not set CONFIG_GARP=y -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y CONFIG_GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_ARGS=y CONFIG_GENERIC_ALLOCATOR=y diff --git a/target/linux/loongarch64/config-6.6 b/target/linux/loongarch64/config-6.6 index 5cbf1177cd5ddd..57bc7d5691a3b8 100644 --- a/target/linux/loongarch64/config-6.6 +++ b/target/linux/loongarch64/config-6.6 @@ -93,8 +93,6 @@ CONFIG_BSD_PROCESS_ACCT_V3=y CONFIG_BUFFER_HEAD=y CONFIG_BUG_ON_DATA_CORRUPTION=y CONFIG_CACHESTAT_SYSCALL=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CDROM=y CONFIG_CFS_BANDWIDTH=y CONFIG_CGROUPS=y diff --git a/target/linux/malta/config-6.6 b/target/linux/malta/config-6.6 index f6d9049f4d758b..a635e2c39e9815 100644 --- a/target/linux/malta/config-6.6 +++ b/target/linux/malta/config-6.6 @@ -21,8 +21,6 @@ CONFIG_BOARD_SCACHE=y CONFIG_BOOT_ELF32=y CONFIG_BUFFER_HEAD=y CONFIG_BUILTIN_DTB=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CEVT_R4K=y CONFIG_CLKBLD_I8253=y CONFIG_CLKEVT_I8253=y diff --git a/target/linux/mediatek/filogic/config-6.6 b/target/linux/mediatek/filogic/config-6.6 index 936f1009d9a69f..408ac5483e59c3 100644 --- a/target/linux/mediatek/filogic/config-6.6 +++ b/target/linux/mediatek/filogic/config-6.6 @@ -56,8 +56,6 @@ CONFIG_BUFFER_HEAD=y CONFIG_BUILTIN_RETURN_ADDRESS_STRIPS_PAC=y CONFIG_CC_HAVE_SHADOW_CALL_STACK=y CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CLKSRC_MMIO=y CONFIG_CLONE_BACKWARDS=y CONFIG_CMDLINE_OVERRIDE=y diff --git a/target/linux/mediatek/mt7622/config-6.6 b/target/linux/mediatek/mt7622/config-6.6 index 9440a7bb280a33..ec3be8df9aa574 100644 --- a/target/linux/mediatek/mt7622/config-6.6 +++ b/target/linux/mediatek/mt7622/config-6.6 @@ -56,8 +56,6 @@ CONFIG_BUFFER_HEAD=y CONFIG_BUILTIN_RETURN_ADDRESS_STRIPS_PAC=y CONFIG_CC_HAVE_SHADOW_CALL_STACK=y CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CLKSRC_MMIO=y CONFIG_CLONE_BACKWARDS=y # CONFIG_CMDLINE_OVERRIDE is not set diff --git a/target/linux/mediatek/mt7623/config-6.6 b/target/linux/mediatek/mt7623/config-6.6 index dc31c230a23b3b..6bc92a09dce30e 100644 --- a/target/linux/mediatek/mt7623/config-6.6 +++ b/target/linux/mediatek/mt7623/config-6.6 @@ -52,8 +52,6 @@ CONFIG_BOUNCE=y CONFIG_BUFFER_HEAD=y # CONFIG_CACHE_L2X0 is not set CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CLKSRC_MMIO=y CONFIG_CLONE_BACKWARDS=y CONFIG_CMDLINE="earlyprintk console=ttyS0,115200 rootfstype=squashfs,jffs2" diff --git a/target/linux/mediatek/mt7629/config-6.6 b/target/linux/mediatek/mt7629/config-6.6 index d74e143c106507..9f57bda3e9e7a7 100644 --- a/target/linux/mediatek/mt7629/config-6.6 +++ b/target/linux/mediatek/mt7629/config-6.6 @@ -37,8 +37,6 @@ CONFIG_BSD_PROCESS_ACCT=y CONFIG_BSD_PROCESS_ACCT_V3=y CONFIG_CACHE_L2X0=y CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y # CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_CHR_DEV_SCH=y diff --git a/target/linux/mpc85xx/config-6.6 b/target/linux/mpc85xx/config-6.6 index c5563958a81e7d..132917bf2b6c5b 100644 --- a/target/linux/mpc85xx/config-6.6 +++ b/target/linux/mpc85xx/config-6.6 @@ -29,8 +29,6 @@ CONFIG_BOOKE_WDT=y # CONFIG_BSC9131_RDB is not set # CONFIG_BSC9132_QDS is not set # CONFIG_C293_PCIE is not set -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CLONE_BACKWARDS=y CONFIG_CLZ_TAB=y CONFIG_CMDLINE="console=ttyS0,115200" diff --git a/target/linux/mvebu/config-6.6 b/target/linux/mvebu/config-6.6 index f132884d491d9e..bb29d80c5cf2f1 100644 --- a/target/linux/mvebu/config-6.6 +++ b/target/linux/mvebu/config-6.6 @@ -57,8 +57,6 @@ CONFIG_BOUNCE=y # CONFIG_CACHE_FEROCEON_L2 is not set CONFIG_CACHE_L2X0=y CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK=y CONFIG_CLKSRC_MMIO=y CONFIG_CLONE_BACKWARDS=y diff --git a/target/linux/mxs/config-6.6 b/target/linux/mxs/config-6.6 index b4bc5b3051c44f..b954ea25486579 100644 --- a/target/linux/mxs/config-6.6 +++ b/target/linux/mxs/config-6.6 @@ -32,8 +32,6 @@ CONFIG_BINFMT_FLAT_ARGVP_ENVP_ON_STACK=y CONFIG_BLK_PM=y CONFIG_BUFFER_HEAD=y CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CLKSRC_MMIO=y CONFIG_CLONE_BACKWARDS=y CONFIG_CMDLINE="console=ttyAMA0,115200 root=/dev/mmcblk0p2 rw rootwait" diff --git a/target/linux/octeon/config-6.6 b/target/linux/octeon/config-6.6 index 724361d5ea7cc4..cc2dadbe9c7231 100644 --- a/target/linux/octeon/config-6.6 +++ b/target/linux/octeon/config-6.6 @@ -25,8 +25,6 @@ CONFIG_CAVIUM_OCTEON_LOCK_L2_MEMCPY=y CONFIG_CAVIUM_OCTEON_LOCK_L2_TLB=y CONFIG_CAVIUM_OCTEON_SOC=y CONFIG_CAVIUM_RESERVE32=0 -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CEVT_R4K=y CONFIG_CLONE_BACKWARDS=y # CONFIG_COMMON_CLK is not set @@ -90,7 +88,6 @@ CONFIG_FUNCTION_ALIGNMENT=0 CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y diff --git a/target/linux/omap/config-6.6 b/target/linux/omap/config-6.6 index f85a68f0aad886..5f19df0d8b930e 100644 --- a/target/linux/omap/config-6.6 +++ b/target/linux/omap/config-6.6 @@ -66,8 +66,6 @@ CONFIG_BSD_PROCESS_ACCT=y CONFIG_BUFFER_HEAD=y CONFIG_CACHE_L2X0=y CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CEC_CORE=y # CONFIG_CHARGER_TPS65217 is not set CONFIG_CLKSRC_MMIO=y @@ -244,7 +242,6 @@ CONFIG_FUNCTION_ALIGNMENT=0 CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ARCH_TOPOLOGY=y CONFIG_GENERIC_BUG=y diff --git a/target/linux/pistachio/config-6.6 b/target/linux/pistachio/config-6.6 index 80ff36ebbb364f..69c566a1e877f6 100644 --- a/target/linux/pistachio/config-6.6 +++ b/target/linux/pistachio/config-6.6 @@ -10,8 +10,6 @@ CONFIG_BLK_DEV_SD=y CONFIG_BOARD_SCACHE=y CONFIG_BUFFER_HEAD=y CONFIG_BUILTIN_DTB=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CEVT_R4K=y CONFIG_CLKSRC_MIPS_GIC=y CONFIG_CLKSRC_PISTACHIO=y @@ -102,7 +100,6 @@ CONFIG_FUNCTION_ALIGNMENT=0 CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y diff --git a/target/linux/qoriq/config-6.6 b/target/linux/qoriq/config-6.6 index 750e6c65510227..28ece0679f7888 100644 --- a/target/linux/qoriq/config-6.6 +++ b/target/linux/qoriq/config-6.6 @@ -29,8 +29,6 @@ CONFIG_BOOKE=y CONFIG_BOOKE_OR_40x=y CONFIG_BOOKE_WDT=y CONFIG_BUFFER_HEAD=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CLK_QORIQ=y CONFIG_CLONE_BACKWARDS=y CONFIG_CLZ_TAB=y @@ -148,7 +146,6 @@ CONFIG_FUNCTION_ERROR_INJECTION=y CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_BUG=y CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y diff --git a/target/linux/qualcommax/config-6.6 b/target/linux/qualcommax/config-6.6 index ac2494d74913dc..ac5059682a5cdf 100644 --- a/target/linux/qualcommax/config-6.6 +++ b/target/linux/qualcommax/config-6.6 @@ -65,8 +65,6 @@ CONFIG_BUILTIN_RETURN_ADDRESS_STRIPS_PAC=y CONFIG_CAVIUM_TX2_ERRATUM_219=y CONFIG_CC_HAVE_SHADOW_CALL_STACK=y CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CLONE_BACKWARDS=y CONFIG_COMMON_CLK=y CONFIG_COMMON_CLK_QCOM=y diff --git a/target/linux/ramips/mt7620/config-6.6 b/target/linux/ramips/mt7620/config-6.6 index 2c95b9c960ad00..edd64a642cdd6f 100644 --- a/target/linux/ramips/mt7620/config-6.6 +++ b/target/linux/ramips/mt7620/config-6.6 @@ -6,8 +6,6 @@ CONFIG_ARCH_MMAP_RND_BITS_MAX=15 CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=15 CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_BLK_MQ_PCI=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CEVT_R4K=y CONFIG_CEVT_SYSTICK_QUIRK=y CONFIG_CLKEVT_RT3352=y @@ -60,7 +58,6 @@ CONFIG_FUNCTION_ALIGNMENT=0 CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y diff --git a/target/linux/ramips/mt7621/config-6.6 b/target/linux/ramips/mt7621/config-6.6 index d1ca85aebd42bf..7a3e68ef4594aa 100644 --- a/target/linux/ramips/mt7621/config-6.6 +++ b/target/linux/ramips/mt7621/config-6.6 @@ -7,8 +7,6 @@ CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_AT803X_PHY=y CONFIG_BLK_MQ_PCI=y CONFIG_BOARD_SCACHE=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CEVT_R4K=y CONFIG_CLKSRC_MIPS_GIC=y CONFIG_CLK_MT7621=y @@ -65,7 +63,6 @@ CONFIG_FUNCTION_ALIGNMENT=0 CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y diff --git a/target/linux/ramips/mt76x8/config-6.6 b/target/linux/ramips/mt76x8/config-6.6 index bf57a7a3302d03..31dc4a980f948e 100644 --- a/target/linux/ramips/mt76x8/config-6.6 +++ b/target/linux/ramips/mt76x8/config-6.6 @@ -5,8 +5,6 @@ CONFIG_ARCH_MMAP_RND_BITS_MAX=15 CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=15 CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_BLK_MQ_PCI=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CEVT_R4K=y CONFIG_CEVT_SYSTICK_QUIRK=y CONFIG_CLKEVT_RT3352=y @@ -58,7 +56,6 @@ CONFIG_FUNCTION_ALIGNMENT=0 CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y diff --git a/target/linux/ramips/rt288x/config-6.6 b/target/linux/ramips/rt288x/config-6.6 index 986bd1ef3ef3e9..0c9798b9f36c1c 100644 --- a/target/linux/ramips/rt288x/config-6.6 +++ b/target/linux/ramips/rt288x/config-6.6 @@ -5,8 +5,6 @@ CONFIG_ARCH_MMAP_RND_BITS_MAX=15 CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=15 CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_BLK_MQ_PCI=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CEVT_R4K=y CONFIG_CLK_MTMIPS=y CONFIG_CLONE_BACKWARDS=y @@ -51,7 +49,6 @@ CONFIG_FUNCTION_ALIGNMENT=0 CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y diff --git a/target/linux/ramips/rt305x/config-6.6 b/target/linux/ramips/rt305x/config-6.6 index 9b34b94cff6154..6f7b7ea2a1741a 100644 --- a/target/linux/ramips/rt305x/config-6.6 +++ b/target/linux/ramips/rt305x/config-6.6 @@ -4,8 +4,6 @@ CONFIG_ARCH_KEEP_MEMBLOCK=y CONFIG_ARCH_MMAP_RND_BITS_MAX=15 CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=15 CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CEVT_R4K=y CONFIG_CEVT_SYSTICK_QUIRK=y CONFIG_CLKEVT_RT3352=y @@ -54,7 +52,6 @@ CONFIG_FUNCTION_ALIGNMENT=0 CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y diff --git a/target/linux/ramips/rt3883/config-6.6 b/target/linux/ramips/rt3883/config-6.6 index 7b3f6916ac2ce7..4b768bfb778494 100644 --- a/target/linux/ramips/rt3883/config-6.6 +++ b/target/linux/ramips/rt3883/config-6.6 @@ -6,8 +6,6 @@ CONFIG_ARCH_MMAP_RND_BITS_MAX=15 CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=15 CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_BLK_MQ_PCI=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CEVT_R4K=y CONFIG_CLK_MTMIPS=y CONFIG_CLONE_BACKWARDS=y @@ -54,7 +52,6 @@ CONFIG_FUNCTION_ALIGNMENT=0 CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y diff --git a/target/linux/rockchip/armv8/config-6.6 b/target/linux/rockchip/armv8/config-6.6 index fddc85f9d723a1..56fb2f96a14c02 100644 --- a/target/linux/rockchip/armv8/config-6.6 +++ b/target/linux/rockchip/armv8/config-6.6 @@ -118,8 +118,6 @@ CONFIG_BUFFER_HEAD=y CONFIG_BUILTIN_RETURN_ADDRESS_STRIPS_PAC=y CONFIG_CC_HAVE_SHADOW_CALL_STACK=y CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CHARGER_GPIO=y # CONFIG_CHARGER_RK817 is not set CONFIG_CLKSRC_MMIO=y @@ -259,7 +257,6 @@ CONFIG_FUNCTION_ALIGNMENT_4B=y CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y CONFIG_GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_ARGS=y CONFIG_GENERIC_ALLOCATOR=y diff --git a/target/linux/sifiveu/config-6.6 b/target/linux/sifiveu/config-6.6 index 8ed8f766c8cd0a..595090be19d1e0 100644 --- a/target/linux/sifiveu/config-6.6 +++ b/target/linux/sifiveu/config-6.6 @@ -23,8 +23,6 @@ CONFIG_BLK_DEV_SD=y CONFIG_BLK_MQ_PCI=y CONFIG_CAVIUM_PTP=y CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CLK_ANALOGBITS_WRPLL_CLN28HPC=y CONFIG_CLK_SIFIVE=y CONFIG_CLK_SIFIVE_PRCI=y diff --git a/target/linux/siflower/sf19a2890/config-6.6 b/target/linux/siflower/sf19a2890/config-6.6 index bec75436e00458..2e15ca67d4a5ae 100644 --- a/target/linux/siflower/sf19a2890/config-6.6 +++ b/target/linux/siflower/sf19a2890/config-6.6 @@ -7,8 +7,6 @@ CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARM_AMBA=y CONFIG_BLK_DEV_LOOP=y CONFIG_BOARD_SCACHE=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CEVT_R4K=y CONFIG_CLKSRC_MIPS_GIC=y CONFIG_CLK_SF19A2890=y @@ -69,7 +67,6 @@ CONFIG_FUNCTION_ALIGNMENT=0 CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y diff --git a/target/linux/starfive/config-6.6 b/target/linux/starfive/config-6.6 index ef71001663d9e6..457fa86b9ac95d 100644 --- a/target/linux/starfive/config-6.6 +++ b/target/linux/starfive/config-6.6 @@ -27,8 +27,6 @@ CONFIG_AUXILIARY_BUS=y # CONFIG_AX45MP_L2_CACHE is not set # CONFIG_BT_AICUSB is not set CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CHECKPOINT_RESTORE=y CONFIG_CLKSRC_MMIO=y CONFIG_CLK_ANALOGBITS_WRPLL_CLN28HPC=y diff --git a/target/linux/tegra/config-6.6 b/target/linux/tegra/config-6.6 index 9cecf9f6932a45..a98d81c92da193 100644 --- a/target/linux/tegra/config-6.6 +++ b/target/linux/tegra/config-6.6 @@ -56,8 +56,6 @@ CONFIG_BOUNCE=y CONFIG_BUFFER_HEAD=y CONFIG_CACHE_L2X0=y CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CLKSRC_MMIO=y CONFIG_CLONE_BACKWARDS=y CONFIG_CLZ_TAB=y @@ -210,7 +208,6 @@ CONFIG_FS_MBCACHE=y CONFIG_FUNCTION_ALIGNMENT=0 CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ARCH_TOPOLOGY=y diff --git a/target/linux/x86/config-6.6 b/target/linux/x86/config-6.6 index 1a68c589a50be1..b3d15bc1047494 100644 --- a/target/linux/x86/config-6.6 +++ b/target/linux/x86/config-6.6 @@ -33,8 +33,6 @@ CONFIG_BLK_DEV_SD=y CONFIG_BLK_MQ_PCI=y CONFIG_BOUNCE=y CONFIG_BUFFER_HEAD=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CLKBLD_I8253=y CONFIG_CLKEVT_I8253=y CONFIG_CLKSRC_I8253=y diff --git a/target/linux/zynq/config-6.6 b/target/linux/zynq/config-6.6 index 15716a12cdbc75..69a31d254b7759 100644 --- a/target/linux/zynq/config-6.6 +++ b/target/linux/zynq/config-6.6 @@ -59,8 +59,6 @@ CONFIG_CACHE_L2X0=y CONFIG_CADENCE_TTC_TIMER=y CONFIG_CADENCE_WATCHDOG=y CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK=y CONFIG_CLKSRC_MMIO=y CONFIG_CLKSRC_VERSATILE=y @@ -191,7 +189,6 @@ CONFIG_FWNODE_MDIO=y CONFIG_FW_CACHE=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ARCH_TOPOLOGY=y CONFIG_GENERIC_BUG=y From 908975850dbc0aa3db25c1045f42ec12e23c06df Mon Sep 17 00:00:00 2001 From: Sergey Ponomarev Date: Tue, 28 May 2024 02:50:09 +0300 Subject: [PATCH 115/877] dropbear: use config_get_bool enable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The config_get_bool also works with on/off, yes/no, true/false. Add 'main' section name. This will make it easier to change settings from uci. Add a link to documentation. Signed-off-by: Sergey Ponomarev Link: https://github.com/openwrt/openwrt/pull/15579 Signed-off-by: Hauke Mehrtens (cherry picked from commit 4511fa4b30f73185597990ce563bbf3f96385292) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/network/services/dropbear/Makefile | 2 +- package/network/services/dropbear/files/dropbear.config | 4 +++- package/network/services/dropbear/files/dropbear.init | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/package/network/services/dropbear/Makefile b/package/network/services/dropbear/Makefile index e9f3bd693c617c..1918e7dec6d6ce 100644 --- a/package/network/services/dropbear/Makefile +++ b/package/network/services/dropbear/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=dropbear PKG_VERSION:=2024.85 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:= \ diff --git a/package/network/services/dropbear/files/dropbear.config b/package/network/services/dropbear/files/dropbear.config index 2139ba0bbeaac7..7eb59754490683 100644 --- a/package/network/services/dropbear/files/dropbear.config +++ b/package/network/services/dropbear/files/dropbear.config @@ -1,4 +1,6 @@ -config dropbear +# See https://openwrt.org/docs/guide-user/base-system/dropbear +config dropbear main + option enable '1' option PasswordAuth 'on' option RootPasswordAuth 'on' option Port '22' diff --git a/package/network/services/dropbear/files/dropbear.init b/package/network/services/dropbear/files/dropbear.init index 708fabd3269af2..395237f9bc206a 100755 --- a/package/network/services/dropbear/files/dropbear.init +++ b/package/network/services/dropbear/files/dropbear.init @@ -361,7 +361,7 @@ dropbear_instance() load_interfaces() { local enable - config_get enable "$1" enable 1 + config_get_bool enable "$1" enable 1 [ "${enable}" = "1" ] || return 0 local direct_iface iface From 69eecbef91b831da1c2282ad71495ce3e5be8477 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Sun, 17 Nov 2024 19:22:25 +0100 Subject: [PATCH 116/877] generic: add CONFIG_FB_INTEL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CONFIG_FB_INTEL is now visible on x86 since i915 driver is packaged as kmod now and it stops compilation, so add it to the generic config. Signed-off-by: Robert Marko (cherry picked from commit 57daea682e1c6e6da91f92efed717159f9ffffb0) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- target/linux/generic/config-6.6 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/generic/config-6.6 b/target/linux/generic/config-6.6 index d88738141470a8..9eec780b53ae85 100644 --- a/target/linux/generic/config-6.6 +++ b/target/linux/generic/config-6.6 @@ -1927,6 +1927,7 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" # CONFIG_FB_IBM_GXT4500 is not set # CONFIG_FB_IMSTT is not set # CONFIG_FB_IMX is not set +# CONFIG_FB_INTEL is not set # CONFIG_FB_KYRO is not set # CONFIG_FB_LE80578 is not set # CONFIG_FB_LITTLE_ENDIAN is not set From 57ac0965cf8455c69907eb6be80cdc2695596822 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Mon, 18 Nov 2024 17:15:54 +0100 Subject: [PATCH 117/877] omnia-eeprom: depend only on subtarget MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now that omnia-eeprom is marked nonshared building the cortex-a9 mvebu subtarget will fail with: ERROR: unable to select packages: omnia-eeprom (no such package): required by: world[omnia-eeprom] This is because omnia-eeprom depends on TARGET_mvebu_cortexa9_DEVICE_cznic_turris-omnia which will not be satisfied in buildbots since CONFIG_TARGET_ALL_PROFILES and CONFIG_TARGET_PER_DEVICE_ROOTFS are set in which case CONFIG_TARGET_mvebu_cortexa9_DEVICE_cznic_turris-omnia is not set. So, lets simply depend on the mvebu/cortex-a9 subtarget. Fixes: 371e7bef4046 ("omnia-eeprom: Mark it nonshared") Link: https://github.com/openwrt/openwrt/pull/17007 Signed-off-by: Robert Marko (cherry picked from commit 90de3b277b8e1d121b2f7023578979c6b616167f) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/utils/omnia-eeprom/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/utils/omnia-eeprom/Makefile b/package/utils/omnia-eeprom/Makefile index f9e48b28b92556..9418e93f4492bf 100644 --- a/package/utils/omnia-eeprom/Makefile +++ b/package/utils/omnia-eeprom/Makefile @@ -29,7 +29,7 @@ define Package/omnia-eeprom CATEGORY:=Utilities URL:=https://gitlab.nic.cz/turris/omnia-eeprom TITLE:=CZ.NIC Turris Omnia EEPROM accessing utility - DEPENDS:=@TARGET_mvebu_cortexa9_DEVICE_cznic_turris-omnia +kmod-eeprom-at24 + DEPENDS:=@TARGET_mvebu_cortexa9 +kmod-eeprom-at24 endef define Package/omnia-eeprom/description From 9a09c5444915d5a7ccfb46c46ec8399484de0fb8 Mon Sep 17 00:00:00 2001 From: He Ping Date: Tue, 19 Nov 2024 10:41:42 +0800 Subject: [PATCH 118/877] odhcp6c: update to Git HEAD (2024-09-25) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit b6ae9ffaeb0e odhcp6c: allow to request specific ipv6 prefix Signed-off-by: He Ping Link: https://github.com/openwrt/openwrt/pull/17013 Signed-off-by: Petr Štetiar [hash, commit] (cherry picked from commit b0312c10818f36bc6e61a518bb528d2809562796) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/network/ipv6/odhcp6c/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/network/ipv6/odhcp6c/Makefile b/package/network/ipv6/odhcp6c/Makefile index 894f388945fc50..c16ecfa083c3bf 100644 --- a/package/network/ipv6/odhcp6c/Makefile +++ b/package/network/ipv6/odhcp6c/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=odhcp6c -PKG_RELEASE:=20 +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/odhcp6c.git -PKG_SOURCE_DATE:=2023-05-12 -PKG_SOURCE_VERSION:=bcd283632ac13391aac3ebdd074d1fd832d76fa3 -PKG_MIRROR_HASH:=0c18c578045f9251bd86a5b8fb0518b69c519e83f69907bf76583a2985482508 +PKG_SOURCE_DATE:=2024-09-25 +PKG_SOURCE_VERSION:=b6ae9ffaeb0e18e9fa3d5be62faa8d3c9f340a58 +PKG_MIRROR_HASH:=25499b6a0d403815e6b04869a02d2d5a32582348bff2bc2626559d297425a908 PKG_MAINTAINER:=Hans Dedecker PKG_LICENSE:=GPL-2.0 From 7afbe2259985d189a1e77f1d76f664a813c2ddae Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Wed, 16 Oct 2024 15:17:14 -0700 Subject: [PATCH 119/877] mpc85xx: run make kernel_oldconfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adjusts the default config to modern kernels. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/16847 Signed-off-by: Robert Marko (cherry picked from commit 890d47b60a221328bbf05518eedc35ac5bd922f1) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- target/linux/mpc85xx/config-6.6 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/linux/mpc85xx/config-6.6 b/target/linux/mpc85xx/config-6.6 index 132917bf2b6c5b..30a551e55edfb7 100644 --- a/target/linux/mpc85xx/config-6.6 +++ b/target/linux/mpc85xx/config-6.6 @@ -40,6 +40,7 @@ CONFIG_COMPAT_32BIT_TIME=y # CONFIG_CORENET_GENERIC is not set # CONFIG_CPM2 is not set CONFIG_CPU_BIG_ENDIAN=y +CONFIG_CPU_MITIGATIONS=y # CONFIG_CRYPTO_AES_PPC_SPE is not set CONFIG_CRYPTO_AUTHENC=y CONFIG_CRYPTO_HW=y @@ -71,6 +72,7 @@ CONFIG_EDAC_SUPPORT=y CONFIG_EXCLUSIVE_SYSTEM_RAM=y # CONFIG_FIREBOX_T10 is not set CONFIG_FIXED_PHY=y +CONFIG_FORCE_NR_CPUS=y CONFIG_FSL_EMB_PERFMON=y # CONFIG_FSL_FMAN is not set CONFIG_FSL_LBC=y @@ -84,7 +86,6 @@ CONFIG_FUNCTION_ALIGNMENT=0 CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_BUG=y From ac2d91329ea0c3273e9bd2d6d7bf5092f0d0c23f Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Wed, 16 Oct 2024 15:42:56 -0700 Subject: [PATCH 120/877] mpc85xx: p1010: add missing symbols MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since kernel_oldconfig doesn't work properly with it, I ran that first and then moved all the config symbols to config-6.6 and found the differences. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/16847 Signed-off-by: Robert Marko (cherry picked from commit e9dd6da91661612d2330c2b633f3dd55b93218f8) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- target/linux/mpc85xx/p1010/config-default | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/target/linux/mpc85xx/p1010/config-default b/target/linux/mpc85xx/p1010/config-default index 5a17e38f5c737b..22801b9c2b9d45 100644 --- a/target/linux/mpc85xx/p1010/config-default +++ b/target/linux/mpc85xx/p1010/config-default @@ -1,11 +1,19 @@ CONFIG_BR200_WP=y CONFIG_CMDLINE_OVERRIDE=y +CONFIG_CRC16=y +CONFIG_CRYPTO_DEFLATE=y +CONFIG_CRYPTO_HASH_INFO=y +CONFIG_CRYPTO_LZO=y +CONFIG_CRYPTO_ZSTD=y +CONFIG_DEFAULT_UIMAGE=y CONFIG_FIREBOX_T10=y # CONFIG_FSL_CORENET_CF is not set CONFIG_FSL_IFC=y CONFIG_GPIO_74X164=y +CONFIG_GRO_CELLS=y +CONFIG_LZO_COMPRESS=y +CONFIG_LZO_DECOMPRESS=y CONFIG_MEMORY=y -CONFIG_MTD_CFI=y CONFIG_MTD_NAND_FSL_IFC=y CONFIG_MTD_PHYSMAP=y CONFIG_MTD_SPLIT_TPLINK_FW=y @@ -14,6 +22,7 @@ CONFIG_MTD_UBI=y CONFIG_MTD_UBI_BEB_LIMIT=20 CONFIG_MTD_UBI_BLOCK=y CONFIG_MTD_UBI_WL_THRESHOLD=4096 +CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NET_DEVLINK=y CONFIG_NET_DSA=y CONFIG_NET_DSA_QCA8K=y @@ -27,7 +36,16 @@ CONFIG_REALTEK_PHY=y CONFIG_RED_15W_REV1=y CONFIG_REGMAP=y CONFIG_REGULATOR=y +CONFIG_SGL_ALLOC=y +CONFIG_SPI_BITBANG=y CONFIG_SPI_GPIO=y +CONFIG_SWIOTLB=y CONFIG_TL_WDR4900_V1=y CONFIG_UBIFS_FS=y CONFIG_WS_AP3715I=y +CONFIG_XXHASH=y +CONFIG_ZLIB_DEFLATE=y +CONFIG_ZLIB_INFLATE=y +CONFIG_ZSTD_COMMON=y +CONFIG_ZSTD_COMPRESS=y +CONFIG_ZSTD_DECOMPRESS=y From b17413117d54b9989422aafff7dbcaa398f00172 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Thu, 17 Oct 2024 16:09:17 -0700 Subject: [PATCH 121/877] mpc85xx: p1020: add missing symbols MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since kernel_oldconfig doesn't work properly with it, I ran that first and then moved all the config symbols to config-6.6 and found the differences. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/16847 Signed-off-by: Robert Marko (cherry picked from commit bec8edb6d61eb74e8d7578749560cbb5040f307a) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- target/linux/mpc85xx/p1020/config-default | 29 +++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/target/linux/mpc85xx/p1020/config-default b/target/linux/mpc85xx/p1020/config-default index 66710a9aceb8f0..616979100725ed 100644 --- a/target/linux/mpc85xx/p1020/config-default +++ b/target/linux/mpc85xx/p1020/config-default @@ -1,24 +1,31 @@ -CONFIG_ARCH_HAS_TICK_BROADCAST=y CONFIG_AT803X_PHY=y CONFIG_B53=y CONFIG_B53_MDIO_DRIVER=y CONFIG_BCM_NET_PHYLIB=y CONFIG_BROADCOM_PHY=y CONFIG_CMDLINE_OVERRIDE=y +CONFIG_CONTEXT_TRACKING=y +CONFIG_CONTEXT_TRACKING_IDLE=y CONFIG_CPU_RMAP=y +CONFIG_CRC16=y +CONFIG_CRYPTO_DEFLATE=y +CONFIG_CRYPTO_HASH_INFO=y +CONFIG_CRYPTO_LZO=y +CONFIG_CRYPTO_ZSTD=y +CONFIG_DEFAULT_UIMAGE=y CONFIG_EEPROM_LEGACY=y -# CONFIG_FSL_CORENET_CF is not set CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y CONFIG_GENERIC_TBSYNC=y CONFIG_GPIO_74X164=y # CONFIG_GPIO_MAX77620 is not set CONFIG_GRO_CELLS=y -CONFIG_HAVE_RCU_TABLE_FREE=y CONFIG_HIVEAP_330=y CONFIG_I2C_CHARDEV=y CONFIG_LEDS_LP5521=y CONFIG_LEDS_LP55XX_COMMON=y CONFIG_LOCK_SPIN_ON_OWNER=y +CONFIG_LZO_COMPRESS=y +CONFIG_LZO_DECOMPRESS=y # CONFIG_MAX77620_THERMAL is not set # CONFIG_MAX77620_WATCHDOG is not set CONFIG_MFD_CORE=y @@ -46,16 +53,30 @@ CONFIG_NET_SWITCHDEV=y CONFIG_NR_CPUS=2 CONFIG_PADATA=y CONFIG_PANDA=y +CONFIG_PHYLINK=y +CONFIG_PPC_ZIMAGE_LA3000000=y +CONFIG_QCOM_NET_PHYLIB=y +CONFIG_REGMAP=y +CONFIG_REGMAP_I2C=y CONFIG_REGMAP_IRQ=y CONFIG_REGULATOR=y CONFIG_RFS_ACCEL=y CONFIG_RPS=y -# CONFIG_RTC_DRV_MAX77686 is not set CONFIG_RWSEM_SPIN_ON_OWNER=y +CONFIG_SGL_ALLOC=y CONFIG_SMP=y +CONFIG_SOCK_RX_QUEUE_MAPPING=y +CONFIG_SPI_BITBANG=y CONFIG_SPI_GPIO=y CONFIG_TREE_RCU=y +CONFIG_TREE_SRCU=y CONFIG_UBIFS_FS=y CONFIG_WS_AP3710I=y CONFIG_WS_AP3825I=y CONFIG_XPS=y +CONFIG_XXHASH=y +CONFIG_ZLIB_DEFLATE=y +CONFIG_ZLIB_INFLATE=y +CONFIG_ZSTD_COMMON=y +CONFIG_ZSTD_COMPRESS=y +CONFIG_ZSTD_DECOMPRESS=y From 77de80d9dbe3e6bf68ed5df328ca23ccf3a7f723 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Thu, 17 Oct 2024 16:14:07 -0700 Subject: [PATCH 122/877] mpc85xx: p2020: add missing symbols MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since kernel_oldconfig doesn't work properly with it, I ran that first and then moved all the config symbols to config-6.6 and found the differences. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/16847 Signed-off-by: Robert Marko (cherry picked from commit 22664498ebdd47aad9b15f62edbcaadd851fd62c) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- target/linux/mpc85xx/p2020/config-default | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/target/linux/mpc85xx/p2020/config-default b/target/linux/mpc85xx/p2020/config-default index ff8c8cb9393445..bfdb48959ac69b 100644 --- a/target/linux/mpc85xx/p2020/config-default +++ b/target/linux/mpc85xx/p2020/config-default @@ -1,16 +1,16 @@ CONFIG_BLK_DEV_NVME=y +CONFIG_CONTEXT_TRACKING=y +CONFIG_CONTEXT_TRACKING_IDLE=y CONFIG_CPU_RMAP=y CONFIG_DEFAULT_UIMAGE=y CONFIG_FSL_ULI1575=y CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y CONFIG_GENERIC_IRQ_MIGRATION=y CONFIG_GENERIC_MSI_IRQ=y -CONFIG_GENERIC_MSI_IRQ_DOMAIN=y CONFIG_GENERIC_TBSYNC=y CONFIG_IRQ_DOMAIN_HIERARCHY=y CONFIG_LOCK_SPIN_ON_OWNER=y CONFIG_MAX63XX_WATCHDOG=y -CONFIG_MDIO_DEVRES=y CONFIG_MPC85xx_RDB=y CONFIG_MTD_CFI=y CONFIG_MTD_NAND_FSL_ELBC=y @@ -36,6 +36,7 @@ CONFIG_RPS=y CONFIG_RTC_DRV_DS1307=y CONFIG_RWSEM_SPIN_ON_OWNER=y CONFIG_SMP=y +CONFIG_SOCK_RX_QUEUE_MAPPING=y CONFIG_SWIOTLB=y CONFIG_TARGET_CPU="8540" CONFIG_TARGET_CPU_BOOL=y From f93bba30d7ea704e5948d4c0c79d7e2432b9e82e Mon Sep 17 00:00:00 2001 From: Mikhail Kshevetskiy Date: Fri, 15 Nov 2024 03:17:07 +0300 Subject: [PATCH 123/877] mediatek: fix pwn fan settings for sinovoip bpi-r3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Popular bpi-r3 pwm fans like this one https://www.amazon.com/youyeetoo-Barebone-Fan-BPI-R3-Integrated/dp/B0CCCTY8PS will not work properly with current openwrt-23.05/24.10 firmware. Trying different pwm setting echo $value > /sys/devices/platform/pwm-fan/hwmon/hwmon1/pwm1 I found: pwm1 value fan rotation speed cpu temperature notes ----------------------------------------------------------------- 0 maximal 31.5 Celsius too noisy 40 optimal 35.2 Celsius no noise hearable 95 minimal above 95 does not rotate 55.5 Celsius ----------------------------------------------------------------- At the moment we have following cooling levels: cooling-levels = <255 96 0>; for cpu-active-high, cpu-active-medium and cpu-active-low modes correspondingly. Thus only cpu-active-high and cpu-active-low are usable. I think this is wrong. This patch fixes cpu-active-medium settings for bpi-r3 board. PS: I know, the patch is not ideal as it can break pwm fan for some users. There are some peoples that use handmade cooling solutions, but: * discussed cooler is the only 'official' pwm cooler for bpi-r3 available on the market. * most peoples will use passive cooling available on the market or the discussed cooler. * the pwm-fan dts section was added before the official cooler appears on the market. Thus it should not be a lot of harm from this fix. Signed-off-by: Mikhail Kshevetskiy Link: https://github.com/openwrt/openwrt/pull/16974 Signed-off-by: Robert Marko (cherry picked from commit 3467ea905b40f0df87700a15b716b1f5a4efc955) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- ...96-dts-mt7986a-bpi-r3-pwm-fan-cooling-levels.patch | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 target/linux/mediatek/patches-5.15/196-dts-mt7986a-bpi-r3-pwm-fan-cooling-levels.patch diff --git a/target/linux/mediatek/patches-5.15/196-dts-mt7986a-bpi-r3-pwm-fan-cooling-levels.patch b/target/linux/mediatek/patches-5.15/196-dts-mt7986a-bpi-r3-pwm-fan-cooling-levels.patch new file mode 100644 index 00000000000000..267c654f350426 --- /dev/null +++ b/target/linux/mediatek/patches-5.15/196-dts-mt7986a-bpi-r3-pwm-fan-cooling-levels.patch @@ -0,0 +1,11 @@ +--- a/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts ++++ b/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts +@@ -46,7 +46,7 @@ + compatible = "pwm-fan"; + #cooling-cells = <2>; + /* cooling level (0, 1, 2) - pwm inverted */ +- cooling-levels = <255 96 0>; ++ cooling-levels = <255 40 0>; + pwms = <&pwm 0 10000>; + status = "okay"; + }; From 7a945bf88b99f304a7214e3036aeb52d8bc3cfee Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Thu, 21 Nov 2024 22:04:41 +0100 Subject: [PATCH 124/877] Revert "mediatek: fix pwn fan settings for sinovoip bpi-r3" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 3467ea905b40f0df87700a15b716b1f5a4efc955. I merged it by accident. Signed-off-by: Robert Marko (cherry picked from commit 52b6c9247997e51a97f13bb9e94749bc34e2d52e) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- ...96-dts-mt7986a-bpi-r3-pwm-fan-cooling-levels.patch | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 target/linux/mediatek/patches-5.15/196-dts-mt7986a-bpi-r3-pwm-fan-cooling-levels.patch diff --git a/target/linux/mediatek/patches-5.15/196-dts-mt7986a-bpi-r3-pwm-fan-cooling-levels.patch b/target/linux/mediatek/patches-5.15/196-dts-mt7986a-bpi-r3-pwm-fan-cooling-levels.patch deleted file mode 100644 index 267c654f350426..00000000000000 --- a/target/linux/mediatek/patches-5.15/196-dts-mt7986a-bpi-r3-pwm-fan-cooling-levels.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts -+++ b/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts -@@ -46,7 +46,7 @@ - compatible = "pwm-fan"; - #cooling-cells = <2>; - /* cooling level (0, 1, 2) - pwm inverted */ -- cooling-levels = <255 96 0>; -+ cooling-levels = <255 40 0>; - pwms = <&pwm 0 10000>; - status = "okay"; - }; From 2d3ad3553740f63d4fdee211a1ab4c3e22a9291b Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Fri, 22 Nov 2024 18:12:12 +0800 Subject: [PATCH 125/877] ramips: sync upstream Ralink clock patches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Add sdhc clock for MT7620 and MT76x8 SoCs. 2. Fix clock driver warning for RT2880, RT305x and RT3883. Link: https://lore.kernel.org/all/20240910044024.120009-1-sergio.paracuellos@gmail.com/ Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17037 Signed-off-by: Hauke Mehrtens (cherry picked from commit 7bb99bca3dfd878e6ad950b218c0cb96d36d14f4) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- target/linux/ramips/dts/mt7620a.dtsi | 27 ++-- target/linux/ramips/dts/mt7620n.dtsi | 14 +- target/linux/ramips/dts/mt7628an.dtsi | 23 ++-- target/linux/ramips/dts/rt3883.dtsi | 20 +-- ...-fix-clock-plan-for-Ralink-SoC-RT38.patch} | 15 ++- ...s-fix-clocks-probe-order-in-oldest-r.patch | 124 ++++++++++++++++++ ...s-add-mmc-related-clocks-for-SoCs-MT.patch | 101 ++++++++++++++ 7 files changed, 269 insertions(+), 55 deletions(-) rename target/linux/ramips/patches-6.6/{100-clk-ralink-mtmips-fix-clock-plan-for-Ralink-SoC-RT3883.patch => 002-01-v6.13-clk-ralink-mtmips-fix-clock-plan-for-Ralink-SoC-RT38.patch} (75%) create mode 100644 target/linux/ramips/patches-6.6/002-02-v6.13-clk-ralink-mtmips-fix-clocks-probe-order-in-oldest-r.patch create mode 100644 target/linux/ramips/patches-6.6/002-03-v6.13-clk-ralink-mtmips-add-mmc-related-clocks-for-SoCs-MT.patch diff --git a/target/linux/ramips/dts/mt7620a.dtsi b/target/linux/ramips/dts/mt7620a.dtsi index bcc7f4be3fa967..93b4286193a8e1 100644 --- a/target/linux/ramips/dts/mt7620a.dtsi +++ b/target/linux/ramips/dts/mt7620a.dtsi @@ -32,13 +32,6 @@ compatible = "mti,cpu-interrupt-controller"; }; - mmc_clk: mmc-clock { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = <48000000>; - clock-accuracy = <100>; - }; - mmc_reg_1v8: regulator-1v8 { compatible = "regulator-fixed"; @@ -80,7 +73,7 @@ compatible = "ralink,rt2880-timer"; reg = <0x100 0x20>; - clocks = <&sysc 5>; + clocks = <&sysc 7>; interrupt-parent = <&intc>; interrupts = <1>; @@ -90,7 +83,7 @@ compatible = "ralink,rt2880-wdt"; reg = <0x120 0x10>; - clocks = <&sysc 6>; + clocks = <&sysc 8>; resets = <&sysc 8>; reset-names = "wdt"; @@ -122,7 +115,7 @@ compatible = "ralink,mt7620a-uart", "ralink,rt2880-uart", "ns16550a"; reg = <0x500 0x100>; - clocks = <&sysc 7>; + clocks = <&sysc 9>; resets = <&sysc 12>; @@ -216,7 +209,7 @@ compatible = "ralink,rt2880-i2c"; reg = <0x900 0x100>; - clocks = <&sysc 8>; + clocks = <&sysc 10>; resets = <&sysc 16>; reset-names = "i2c"; @@ -234,7 +227,7 @@ compatible = "mediatek,mt7620-i2s"; reg = <0xa00 0x100>; - clocks = <&sysc 9>; + clocks = <&sysc 11>; resets = <&sysc 17>; reset-names = "i2s"; @@ -256,7 +249,7 @@ compatible = "ralink,rt2880-spi"; reg = <0xb00 0x40>; - clocks = <&sysc 10>; + clocks = <&sysc 12>; resets = <&sysc 18>; reset-names = "spi"; @@ -274,7 +267,7 @@ compatible = "ralink,rt2880-spi"; reg = <0xb40 0x60>; - clocks = <&sysc 11>; + clocks = <&sysc 13>; resets = <&sysc 18>; reset-names = "spi"; @@ -292,7 +285,7 @@ compatible = "ralink,mt7620a-uart", "ralink,rt2880-uart", "ns16550a"; reg = <0xc00 0x100>; - clocks = <&sysc 12>; + clocks = <&sysc 14>; resets = <&sysc 19>; @@ -539,7 +532,7 @@ cap-mmc-highspeed; cap-sd-highspeed; - clocks = <&mmc_clk>, <&mmc_clk>; + clocks = <&sysc 15>, <&sysc 15>; clock-names = "source", "hclk"; disable-wp; @@ -645,7 +638,7 @@ compatible = "ralink,rt7620-wmac", "ralink,rt2880-wmac"; reg = <0x10180000 0x40000>; - clocks = <&sysc 13>; + clocks = <&sysc 16>; interrupt-parent = <&cpuintc>; interrupts = <6>; diff --git a/target/linux/ramips/dts/mt7620n.dtsi b/target/linux/ramips/dts/mt7620n.dtsi index b284119961418a..64dbd0a50ea635 100644 --- a/target/linux/ramips/dts/mt7620n.dtsi +++ b/target/linux/ramips/dts/mt7620n.dtsi @@ -51,7 +51,7 @@ compatible = "ralink,rt2880-timer"; reg = <0x100 0x20>; - clocks = <&sysc 5>; + clocks = <&sysc 7>; interrupt-parent = <&intc>; interrupts = <1>; @@ -61,7 +61,7 @@ compatible = "ralink,rt2880-wdt"; reg = <0x120 0x10>; - clocks = <&sysc 6>; + clocks = <&sysc 8>; resets = <&sysc 8>; reset-names = "wdt"; @@ -171,7 +171,7 @@ compatible = "ralink,rt2880-i2c"; reg = <0x900 0x100>; - clocks = <&sysc 8>; + clocks = <&sysc 10>; resets = <&sysc 16>; reset-names = "i2c"; @@ -189,7 +189,7 @@ compatible = "ralink,rt2880-spi"; reg = <0xb00 0x40>; - clocks = <&sysc 10>; + clocks = <&sysc 12>; resets = <&sysc 18>; reset-names = "spi"; @@ -207,7 +207,7 @@ compatible = "ralink,rt2880-spi"; reg = <0xb40 0x60>; - clocks = <&sysc 11>; + clocks = <&sysc 13>; resets = <&sysc 18>; reset-names = "spi"; @@ -225,7 +225,7 @@ compatible = "ralink,mt7620a-uart", "ralink,rt2880-uart", "ns16550a"; reg = <0xc00 0x100>; - clocks = <&sysc 12>; + clocks = <&sysc 14>; resets = <&sysc 19>; @@ -372,7 +372,7 @@ compatible = "ralink,rt7620-wmac", "ralink,rt2880-wmac"; reg = <0x10180000 0x40000>; - clocks = <&sysc 13>; + clocks = <&sysc 16>; interrupt-parent = <&cpuintc>; interrupts = <6>; diff --git a/target/linux/ramips/dts/mt7628an.dtsi b/target/linux/ramips/dts/mt7628an.dtsi index 445c53081509c1..239211b1e18bf3 100644 --- a/target/linux/ramips/dts/mt7628an.dtsi +++ b/target/linux/ramips/dts/mt7628an.dtsi @@ -30,13 +30,6 @@ compatible = "mti,cpu-interrupt-controller"; }; - mmc_clk: mmc-clock { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = <48000000>; - clock-accuracy = <100>; - }; - mmc_reg_1v8: regulator-1v8 { compatible = "regulator-fixed"; @@ -121,7 +114,7 @@ compatible = "mediatek,mt7621-i2c"; reg = <0x900 0x100>; - clocks = <&sysc 7>; + clocks = <&sysc 9>; clock-names = "i2c"; resets = <&sysc 16>; @@ -140,7 +133,7 @@ compatible = "mediatek,mt7628-i2s"; reg = <0xa00 0x100>; - clocks = <&sysc 8>; + clocks = <&sysc 10>; resets = <&sysc 17>; reset-names = "i2s"; @@ -162,7 +155,7 @@ compatible = "ralink,mt7621-spi"; reg = <0xb00 0x100>; - clocks = <&sysc 9>; + clocks = <&sysc 11>; clock-names = "spi"; resets = <&sysc 18>; @@ -185,7 +178,7 @@ reg-io-width = <4>; no-loopback-test; - clocks = <&sysc 11>; + clocks = <&sysc 13>; resets = <&sysc 12>; @@ -204,7 +197,7 @@ reg-io-width = <4>; no-loopback-test; - clocks = <&sysc 12>; + clocks = <&sysc 14>; resets = <&sysc 19>; @@ -225,7 +218,7 @@ reg-io-width = <4>; no-loopback-test; - clocks = <&sysc 13>; + clocks = <&sysc 15>; resets = <&sysc 20>; @@ -393,7 +386,7 @@ cap-mmc-highspeed; cap-sd-highspeed; - clocks = <&mmc_clk>, <&mmc_clk>; + clocks = <&sysc 16>, <&sysc 16>; clock-names = "source", "hclk"; disable-wp; @@ -516,7 +509,7 @@ compatible = "mediatek,mt7628-wmac"; reg = <0x10300000 0x100000>; - clocks = <&sysc 14>; + clocks = <&sysc 17>; interrupt-parent = <&cpuintc>; interrupts = <6>; diff --git a/target/linux/ramips/dts/rt3883.dtsi b/target/linux/ramips/dts/rt3883.dtsi index 509d1c21e84d36..363b1959b67bf3 100644 --- a/target/linux/ramips/dts/rt3883.dtsi +++ b/target/linux/ramips/dts/rt3883.dtsi @@ -51,7 +51,7 @@ compatible = "ralink,rt2880-timer"; reg = <0x100 0x20>; - clocks = <&sysc 4>; + clocks = <&sysc 5>; interrupt-parent = <&intc>; interrupts = <1>; @@ -61,7 +61,7 @@ compatible = "ralink,rt2880-wdt"; reg = <0x120 0x10>; - clocks = <&sysc 5>; + clocks = <&sysc 6>; resets = <&sysc 8>; reset-names = "wdt"; @@ -93,7 +93,7 @@ compatible = "ralink,rt3883-uart", "ralink,rt2880-uart", "ns16550a"; reg = <0x500 0x100>; - clocks = <&sysc 6>; + clocks = <&sysc 7>; resets = <&sysc 12>; @@ -187,7 +187,7 @@ compatible = "ralink,rt2880-i2c"; reg = <0x900 0x100>; - clocks = <&sysc 7>; + clocks = <&sysc 8>; resets = <&sysc 16>; reset-names = "i2c"; @@ -205,7 +205,7 @@ compatible = "ralink,rt3883-i2s"; reg = <0xa00 0x100>; - clocks = <&sysc 8>; + clocks = <&sysc 9>; resets = <&sysc 17>; reset-names = "i2s"; @@ -229,7 +229,7 @@ #address-cells = <1>; #size-cells = <0>; - clocks = <&sysc 9>; + clocks = <&sysc 10>; resets = <&sysc 18>; reset-names = "spi"; @@ -246,7 +246,7 @@ #address-cells = <1>; #size-cells = <0>; - clocks = <&sysc 10>; + clocks = <&sysc 11>; resets = <&sysc 18>; reset-names = "spi"; @@ -261,7 +261,7 @@ compatible = "ralink,rt3883-uart", "ralink,rt2880-uart", "ns16550a"; reg = <0xc00 0x100>; - clocks = <&sysc 11>; + clocks = <&sysc 12>; resets = <&sysc 19>; @@ -343,7 +343,7 @@ #size-cells = <0>; reg = <0x10100000 0x10000>; - clocks = <&sysc 12>; + clocks = <&sysc 13>; resets = <&sysc 21>; reset-names = "fe"; @@ -463,7 +463,7 @@ compatible = "ralink,rt3883-wmac", "ralink,rt2880-wmac"; reg = <0x10180000 0x40000>; - clocks = <&sysc 13>; + clocks = <&sysc 14>; interrupt-parent = <&cpuintc>; interrupts = <6>; diff --git a/target/linux/ramips/patches-6.6/100-clk-ralink-mtmips-fix-clock-plan-for-Ralink-SoC-RT3883.patch b/target/linux/ramips/patches-6.6/002-01-v6.13-clk-ralink-mtmips-fix-clock-plan-for-Ralink-SoC-RT38.patch similarity index 75% rename from target/linux/ramips/patches-6.6/100-clk-ralink-mtmips-fix-clock-plan-for-Ralink-SoC-RT3883.patch rename to target/linux/ramips/patches-6.6/002-01-v6.13-clk-ralink-mtmips-fix-clock-plan-for-Ralink-SoC-RT38.patch index a3d58b78f6de73..422b6dcfb07799 100644 --- a/target/linux/ramips/patches-6.6/100-clk-ralink-mtmips-fix-clock-plan-for-Ralink-SoC-RT3883.patch +++ b/target/linux/ramips/patches-6.6/002-01-v6.13-clk-ralink-mtmips-fix-clock-plan-for-Ralink-SoC-RT38.patch @@ -1,6 +1,7 @@ -Subject: [PATCH] clk: ralink: mtmips: fix clock plan for Ralink SoC RT3883 -Date: Tue, 6 Aug 2024 16:29:02 +0200 -Message-Id: <20240806142902.224164-1-sergio.paracuellos@gmail.com> +From 33239152305567b3e9bf052f71fd4baecd626341 Mon Sep 17 00:00:00 2001 +From: Sergio Paracuellos +Date: Tue, 10 Sep 2024 06:40:22 +0200 +Subject: [PATCH 1/3] clk: ralink: mtmips: fix clock plan for Ralink SoC RT3883 Clock plan for Ralink SoC RT3883 needs an extra 'periph' clock to properly set some peripherals that has this clock as their parent. When this driver @@ -14,6 +15,8 @@ properly working clock plan for this SoC. Fixes: 6f3b15586eef ("clk: ralink: add clock and reset driver for MTMIPS SoCs") Signed-off-by: Sergio Paracuellos +Link: https://lore.kernel.org/r/20240910044024.120009-2-sergio.paracuellos@gmail.com +Signed-off-by: Stephen Boyd --- drivers/clk/ralink/clk-mtmips.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) @@ -24,7 +27,7 @@ Signed-off-by: Sergio Paracuellos CLK_FIXED("xtal", NULL, 40000000) }; -+static struct mtmips_clk_fixed rt3383_fixed_clocks[] = { ++static struct mtmips_clk_fixed rt3883_fixed_clocks[] = { + CLK_FIXED("xtal", NULL, 40000000), + CLK_FIXED("periph", "xtal", 40000000) +}; @@ -38,8 +41,8 @@ Signed-off-by: Sergio Paracuellos .num_clk_base = ARRAY_SIZE(rt3883_clks_base), - .clk_fixed = rt305x_fixed_clocks, - .num_clk_fixed = ARRAY_SIZE(rt305x_fixed_clocks), -+ .clk_fixed = rt3383_fixed_clocks, -+ .num_clk_fixed = ARRAY_SIZE(rt3383_fixed_clocks), ++ .clk_fixed = rt3883_fixed_clocks, ++ .num_clk_fixed = ARRAY_SIZE(rt3883_fixed_clocks), .clk_factor = NULL, .num_clk_factor = 0, .clk_periph = rt5350_pherip_clks, diff --git a/target/linux/ramips/patches-6.6/002-02-v6.13-clk-ralink-mtmips-fix-clocks-probe-order-in-oldest-r.patch b/target/linux/ramips/patches-6.6/002-02-v6.13-clk-ralink-mtmips-fix-clocks-probe-order-in-oldest-r.patch new file mode 100644 index 00000000000000..3268a18dac704f --- /dev/null +++ b/target/linux/ramips/patches-6.6/002-02-v6.13-clk-ralink-mtmips-fix-clocks-probe-order-in-oldest-r.patch @@ -0,0 +1,124 @@ +From d34db686a3d74bd564bfce2ada15011c556269fc Mon Sep 17 00:00:00 2001 +From: Sergio Paracuellos +Date: Tue, 10 Sep 2024 06:40:23 +0200 +Subject: [PATCH 2/3] clk: ralink: mtmips: fix clocks probe order in oldest + ralink SoCs + +Base clocks are the first in being probed and are real dependencies of the +rest of fixed, factor and peripheral clocks. For old ralink SoCs RT2880, +RT305x and RT3883 'xtal' must be defined first since in any other case, +when fixed clocks are probed they are delayed until 'xtal' is probed so the +following warning appears: + + WARNING: CPU: 0 PID: 0 at drivers/clk/ralink/clk-mtmips.c:499 rt3883_bus_recalc_rate+0x98/0x138 + Modules linked in: + CPU: 0 PID: 0 Comm: swapper Not tainted 6.6.43 #0 + Stack : 805e58d0 00000000 00000004 8004f950 00000000 00000004 00000000 00000000 + 80669c54 80830000 80700000 805ae570 80670068 00000001 80669bf8 00000000 + 00000000 00000000 805ae570 80669b38 00000020 804db7dc 00000000 00000000 + 203a6d6d 80669b78 80669e48 70617773 00000000 805ae570 00000000 00000009 + 00000000 00000001 00000004 00000001 00000000 00000000 83fe43b0 00000000 + ... + Call Trace: + [<800065d0>] show_stack+0x64/0xf4 + [<804bca14>] dump_stack_lvl+0x38/0x60 + [<800218ac>] __warn+0x94/0xe4 + [<8002195c>] warn_slowpath_fmt+0x60/0x94 + [<80259ff8>] rt3883_bus_recalc_rate+0x98/0x138 + [<80254530>] __clk_register+0x568/0x688 + [<80254838>] of_clk_hw_register+0x18/0x2c + [<8070b910>] rt2880_clk_of_clk_init_driver+0x18c/0x594 + [<8070b628>] of_clk_init+0x1c0/0x23c + [<806fc448>] plat_time_init+0x58/0x18c + [<806fdaf0>] time_init+0x10/0x6c + [<806f9bc4>] start_kernel+0x458/0x67c + + ---[ end trace 0000000000000000 ]--- + +When this driver was mainlined we could not find any active users of old +ralink SoCs so we cannot perform any real tests for them. Now, one user +of a Belkin f9k1109 version 1 device which uses RT3883 SoC appeared and +reported some issues in openWRT: +- https://github.com/openwrt/openwrt/issues/16054 + +Thus, define a 'rt2880_xtal_recalc_rate()' just returning the expected +frequency 40Mhz and use it along the old ralink SoCs to have a correct +boot trace with no warnings and a working clock plan from the beggining. + +Fixes: 6f3b15586eef ("clk: ralink: add clock and reset driver for MTMIPS SoCs") +Signed-off-by: Sergio Paracuellos +Link: https://lore.kernel.org/r/20240910044024.120009-3-sergio.paracuellos@gmail.com +Signed-off-by: Stephen Boyd +--- + drivers/clk/ralink/clk-mtmips.c | 21 +++++++++++++-------- + 1 file changed, 13 insertions(+), 8 deletions(-) + +--- a/drivers/clk/ralink/clk-mtmips.c ++++ b/drivers/clk/ralink/clk-mtmips.c +@@ -263,10 +263,6 @@ err_clk_unreg: + .rate = _rate \ + } + +-static struct mtmips_clk_fixed rt305x_fixed_clocks[] = { +- CLK_FIXED("xtal", NULL, 40000000) +-}; +- + static struct mtmips_clk_fixed rt3883_fixed_clocks[] = { + CLK_FIXED("xtal", NULL, 40000000), + CLK_FIXED("periph", "xtal", 40000000) +@@ -371,6 +367,12 @@ static inline struct mtmips_clk *to_mtmi + return container_of(hw, struct mtmips_clk, hw); + } + ++static unsigned long rt2880_xtal_recalc_rate(struct clk_hw *hw, ++ unsigned long parent_rate) ++{ ++ return 40000000; ++} ++ + static unsigned long rt5350_xtal_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) + { +@@ -682,10 +684,12 @@ static unsigned long mt76x8_cpu_recalc_r + } + + static struct mtmips_clk rt2880_clks_base[] = { ++ { CLK_BASE("xtal", NULL, rt2880_xtal_recalc_rate) }, + { CLK_BASE("cpu", "xtal", rt2880_cpu_recalc_rate) } + }; + + static struct mtmips_clk rt305x_clks_base[] = { ++ { CLK_BASE("xtal", NULL, rt2880_xtal_recalc_rate) }, + { CLK_BASE("cpu", "xtal", rt305x_cpu_recalc_rate) } + }; + +@@ -695,6 +699,7 @@ static struct mtmips_clk rt3352_clks_bas + }; + + static struct mtmips_clk rt3883_clks_base[] = { ++ { CLK_BASE("xtal", NULL, rt2880_xtal_recalc_rate) }, + { CLK_BASE("cpu", "xtal", rt3883_cpu_recalc_rate) }, + { CLK_BASE("bus", "cpu", rt3883_bus_recalc_rate) } + }; +@@ -751,8 +756,8 @@ err_clk_unreg: + static const struct mtmips_clk_data rt2880_clk_data = { + .clk_base = rt2880_clks_base, + .num_clk_base = ARRAY_SIZE(rt2880_clks_base), +- .clk_fixed = rt305x_fixed_clocks, +- .num_clk_fixed = ARRAY_SIZE(rt305x_fixed_clocks), ++ .clk_fixed = NULL, ++ .num_clk_fixed = 0, + .clk_factor = rt2880_factor_clocks, + .num_clk_factor = ARRAY_SIZE(rt2880_factor_clocks), + .clk_periph = rt2880_pherip_clks, +@@ -762,8 +767,8 @@ static const struct mtmips_clk_data rt28 + static const struct mtmips_clk_data rt305x_clk_data = { + .clk_base = rt305x_clks_base, + .num_clk_base = ARRAY_SIZE(rt305x_clks_base), +- .clk_fixed = rt305x_fixed_clocks, +- .num_clk_fixed = ARRAY_SIZE(rt305x_fixed_clocks), ++ .clk_fixed = NULL, ++ .num_clk_fixed = 0, + .clk_factor = rt305x_factor_clocks, + .num_clk_factor = ARRAY_SIZE(rt305x_factor_clocks), + .clk_periph = rt305x_pherip_clks, diff --git a/target/linux/ramips/patches-6.6/002-03-v6.13-clk-ralink-mtmips-add-mmc-related-clocks-for-SoCs-MT.patch b/target/linux/ramips/patches-6.6/002-03-v6.13-clk-ralink-mtmips-add-mmc-related-clocks-for-SoCs-MT.patch new file mode 100644 index 00000000000000..b90a19b7ca2548 --- /dev/null +++ b/target/linux/ramips/patches-6.6/002-03-v6.13-clk-ralink-mtmips-add-mmc-related-clocks-for-SoCs-MT.patch @@ -0,0 +1,101 @@ +From 198675bbc03d437fb80a35d781ad13d622d0ff68 Mon Sep 17 00:00:00 2001 +From: Sergio Paracuellos +Date: Tue, 10 Sep 2024 06:40:24 +0200 +Subject: [PATCH 3/3] clk: ralink: mtmips: add mmc related clocks for SoCs + MT7620, MT7628 and MT7688 + +Original architecture clock code from where this driver was derived did not +include nothing related to mmc clocks. OpenWRT people started to use mtk-sd +upstream driver recently and they were forced to use a dts 'fixed-clock' +node with 48 MHz clock: +- https://github.com/openwrt/openwrt/pull/15896 +The proper thing to do to avoid that is to add the mmc related clocks to the +driver to avoid a dts with fixed clocks nodes. The minimal documentation in +the mt7620 programming guide says that there is a BBP_PLL clock of 480 MHz +derived from the 40 MHz XTAL and from there a clock divider by ten produces +the desired SDHC clock of 48 MHz for the mmc. Hence add a fixed clock 'bbppll' +and factor clock 'sdhc' ten divider child to properly set the 'mmc' peripheral +clock with the desired 48 Mhz rate. + +Signed-off-by: Sergio Paracuellos +Link: https://lore.kernel.org/r/20240910044024.120009-4-sergio.paracuellos@gmail.com +Signed-off-by: Stephen Boyd +--- + drivers/clk/ralink/clk-mtmips.c | 30 +++++++++++++++++++++++------- + 1 file changed, 23 insertions(+), 7 deletions(-) + +--- a/drivers/clk/ralink/clk-mtmips.c ++++ b/drivers/clk/ralink/clk-mtmips.c +@@ -207,6 +207,7 @@ static struct mtmips_clk mt7620_pherip_c + { CLK_PERIPH("10000b00.spi", "bus") }, + { CLK_PERIPH("10000b40.spi", "bus") }, + { CLK_PERIPH("10000c00.uartlite", "periph") }, ++ { CLK_PERIPH("10130000.mmc", "sdhc") }, + { CLK_PERIPH("10180000.wmac", "xtal") } + }; + +@@ -220,6 +221,7 @@ static struct mtmips_clk mt76x8_pherip_c + { CLK_PERIPH("10000c00.uart0", "periph") }, + { CLK_PERIPH("10000d00.uart1", "periph") }, + { CLK_PERIPH("10000e00.uart2", "periph") }, ++ { CLK_PERIPH("10130000.mmc", "sdhc") }, + { CLK_PERIPH("10300000.wmac", "xtal") } + }; + +@@ -272,8 +274,13 @@ static struct mtmips_clk_fixed rt3352_fi + CLK_FIXED("periph", "xtal", 40000000) + }; + ++static struct mtmips_clk_fixed mt7620_fixed_clocks[] = { ++ CLK_FIXED("bbppll", "xtal", 480000000) ++}; ++ + static struct mtmips_clk_fixed mt76x8_fixed_clocks[] = { +- CLK_FIXED("pcmi2s", "xtal", 480000000), ++ CLK_FIXED("bbppll", "xtal", 480000000), ++ CLK_FIXED("pcmi2s", "bbppll", 480000000), + CLK_FIXED("periph", "xtal", 40000000) + }; + +@@ -328,6 +335,15 @@ static struct mtmips_clk_factor rt305x_f + CLK_FACTOR("bus", "cpu", 1, 3) + }; + ++static struct mtmips_clk_factor mt7620_factor_clocks[] = { ++ CLK_FACTOR("sdhc", "bbppll", 1, 10) ++}; ++ ++static struct mtmips_clk_factor mt76x8_factor_clocks[] = { ++ CLK_FACTOR("bus", "cpu", 1, 3), ++ CLK_FACTOR("sdhc", "bbppll", 1, 10) ++}; ++ + static int mtmips_register_factor_clocks(struct clk_hw_onecell_data *clk_data, + struct mtmips_clk_priv *priv) + { +@@ -811,10 +827,10 @@ static const struct mtmips_clk_data rt53 + static const struct mtmips_clk_data mt7620_clk_data = { + .clk_base = mt7620_clks_base, + .num_clk_base = ARRAY_SIZE(mt7620_clks_base), +- .clk_fixed = NULL, +- .num_clk_fixed = 0, +- .clk_factor = NULL, +- .num_clk_factor = 0, ++ .clk_fixed = mt7620_fixed_clocks, ++ .num_clk_fixed = ARRAY_SIZE(mt7620_fixed_clocks), ++ .clk_factor = mt7620_factor_clocks, ++ .num_clk_factor = ARRAY_SIZE(mt7620_factor_clocks), + .clk_periph = mt7620_pherip_clks, + .num_clk_periph = ARRAY_SIZE(mt7620_pherip_clks), + }; +@@ -824,8 +840,8 @@ static const struct mtmips_clk_data mt76 + .num_clk_base = ARRAY_SIZE(mt76x8_clks_base), + .clk_fixed = mt76x8_fixed_clocks, + .num_clk_fixed = ARRAY_SIZE(mt76x8_fixed_clocks), +- .clk_factor = rt305x_factor_clocks, +- .num_clk_factor = ARRAY_SIZE(rt305x_factor_clocks), ++ .clk_factor = mt76x8_factor_clocks, ++ .num_clk_factor = ARRAY_SIZE(mt76x8_factor_clocks), + .clk_periph = mt76x8_pherip_clks, + .num_clk_periph = ARRAY_SIZE(mt76x8_pherip_clks), + }; From 8eb07120a24b372f3a3be90fca58893eceeecfbe Mon Sep 17 00:00:00 2001 From: Til Kaiser Date: Fri, 15 Nov 2024 16:49:14 +0100 Subject: [PATCH 126/877] x86: add all ports to the Gowin 1U default network config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit e52c57bb1b30375e0bcc5523db76a672a4a8b4a4 renamed all network ports to match the faceplate of the Gowin 1U Rack Mount Server and added the br-lan bridge for the eth* ports. This commit adds the PoE port to the br-lan bridge and a br-wan bridge for the two SFP ports so that all ports are part of the default network configuration. Signed-off-by: Til Kaiser Link: https://github.com/openwrt/openwrt/pull/16965 Signed-off-by: Hauke Mehrtens (cherry picked from commit 75af6a0d736a696ca726cb44d813791858c29f0c) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- target/linux/x86/base-files/etc/board.d/02_network | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/x86/base-files/etc/board.d/02_network b/target/linux/x86/base-files/etc/board.d/02_network index dc744db05d6315..b3d1855764be11 100644 --- a/target/linux/x86/base-files/etc/board.d/02_network +++ b/target/linux/x86/base-files/etc/board.d/02_network @@ -58,7 +58,7 @@ gowin-solution-co-ltd-gw-mb-u01) ucidef_set_network_device_path_port "sfp2" "$sfp_device/$sfp_port" "0" fi - ucidef_set_interface_lan "eth1 eth2 eth3 eth4" + ucidef_set_interfaces_lan_wan "eth1 eth2 eth3 eth4 poe" "sfp1 sfp2" ;; pc-engines-apu1|pc-engines-apu2|pc-engines-apu3) ucidef_set_interfaces_lan_wan "eth1 eth2" "eth0" From fb4088cdecb6a9e6413ba50ea81e594e2403c430 Mon Sep 17 00:00:00 2001 From: Romanov Danila Date: Mon, 21 Oct 2024 21:34:34 +0300 Subject: [PATCH 127/877] mediatek: change Routerich AX3000 ubi size All new routers are shipped with ubi size 112MB since early September. Bootloader update required (ask vendor , see wiki) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These partitions weren't used: firmware_backup zrsave config2 Signed-off-by: Romanov Danila Link: https://github.com/openwrt/openwrt/pull/16686 Signed-off-by: Hauke Mehrtens (cherry picked from commit d8a9669093359d60f4d6f183b58a22f24cf01731) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- .../mediatek/dts/mt7981b-routerich-ax3000.dts | 20 +------------------ .../base-files/etc/board.d/05_compat-version | 3 +++ target/linux/mediatek/image/filogic.mk | 5 +++++ 3 files changed, 9 insertions(+), 19 deletions(-) diff --git a/target/linux/mediatek/dts/mt7981b-routerich-ax3000.dts b/target/linux/mediatek/dts/mt7981b-routerich-ax3000.dts index dfe44843b9df79..aa6a15ee1d1209 100644 --- a/target/linux/mediatek/dts/mt7981b-routerich-ax3000.dts +++ b/target/linux/mediatek/dts/mt7981b-routerich-ax3000.dts @@ -226,25 +226,7 @@ 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; + reg = <0x580000 0x7000000>; }; }; }; 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 index d0cfd8f0a1232e..9b704b983cb7f0 100644 --- 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 @@ -8,6 +8,9 @@ case "$(board_name)" in bananapi,bpi-r3) ucidef_set_compat_version "1.2" ;; + routerich,ax3000) + ucidef_set_compat_version "1.1" + ;; esac board_config_flush diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 739fd543085c60..cb5c102b1e2b64 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -1173,6 +1173,11 @@ define Device/routerich_ax3000 DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware kmod-usb3 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata SUPPORTED_DEVICES += mediatek,mt7981-spim-snand-rfb + DEVICE_COMPAT_VERSION := 1.1 + DEVICE_COMPAT_MESSAGE := Partition layout has been changed. Bootloader MUST be \ + upgraded to avoid data corruption and getting bricked. \ + Please, contact your vendor and follow the guide: \ + https://openwrt.org/toh/routerich/ax3000#web_ui_method endef TARGET_DEVICES += routerich_ax3000 From 480aed0c729f063e089e186b728fcbd0c69138d7 Mon Sep 17 00:00:00 2001 From: Thomas Richard Date: Thu, 26 Sep 2024 16:10:26 +0200 Subject: [PATCH 128/877] build: add generic build template for optee-os packages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a generic template include/optee-os.mk to build OP-TEE. Signed-off-by: Thomas Richard Link: https://github.com/openwrt/openwrt/pull/16716 Signed-off-by: Hauke Mehrtens (cherry picked from commit dedb90e8f82a179ad67b6eac3b6f8862b9183077) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- include/optee-os.mk | 113 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 include/optee-os.mk diff --git a/include/optee-os.mk b/include/optee-os.mk new file mode 100644 index 00000000000000..396d2406bfac92 --- /dev/null +++ b/include/optee-os.mk @@ -0,0 +1,113 @@ +include $(INCLUDE_DIR)/prereq.mk + +PKG_NAME ?= optee-os + +ifndef PKG_SOURCE_PROTO +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL_FILE:=$(PKG_VERSION).tar.gz +PKG_SOURCE_URL = https://github.com/OP-TEE/optee_os/archive/refs/tags/ +TAR_OPTIONS+= --transform 's/optee_os/$(PKG_NAME)/' +endif + +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:=LICENSE + +PKG_BUILD_PARALLEL ?= 1 + +$(eval $(call TestHostCommand,python3-cryptography, \ + Please install the Python3 cryptography module, \ + $(STAGING_DIR_HOST)/bin/python3 -c 'import cryptography')) + +$(eval $(call TestHostCommand,python3-pyelftools, \ + Please install the Python3 pyelftools module, \ + $(STAGING_DIR_HOST)/bin/python3 -c 'import elftools')) + +export GCC_HONOUR_COPTS=s + +define Package/optee-os/install/default + $(CP) $(patsubst %,$(PKG_BUILD_DIR)/out/arm-plat-$(PLAT)/core/%,$(OPTEE_IMAGE)) $(1)/ +endef + +Package/optee-os/install = $(Package/optee-os/install/default) + +define Optee-os/Init + BUILD_TARGET:= + BUILD_SUBTARGET:= + BUILD_DEVICES:= + NAME:= + DEPENDS:= + HIDDEN:= + DEFAULT:= + VARIANT:=$(1) + PLAT:=$(1) + PLAT_FLAVOR:= + OPTEE_IMAGE:=tee-header_v2.bin tee-pager_v2.bin tee-pageable_v2.bin +endef + +TARGET_DEP = TARGET_$(BUILD_TARGET)$(if $(BUILD_SUBTARGET),_$(BUILD_SUBTARGET)) + +define Build/Optee-os/Target + $(eval $(call Optee-os/Init,$(1))) + $(eval $(call Optee-os/Default,$(1))) + $(eval $(call Optee-os/$(1),$(1))) + + define Package/optee-os-$(1) + SECTION:=boot + CATEGORY:=Boot Loaders + TITLE:=OPTEE-OS for $(NAME) + VARIANT:=$(VARIANT) + DEPENDS:=@!IN_SDK $(DEPENDS) + HIDDEN:=$(HIDDEN) + ifneq ($(BUILD_TARGET),) + DEPENDS += @$(TARGET_DEP) + ifneq ($(BUILD_DEVICES),) + DEFAULT := y if ($(TARGET_DEP)_Default \ + $(patsubst %,|| $(TARGET_DEP)_DEVICE_%,$(BUILD_DEVICES)) \ + $(patsubst %,|| $(patsubst TARGET_%,TARGET_DEVICE_%,$(TARGET_DEP))_DEVICE_%,$(BUILD_DEVICES))) + endif + endif + $(if $(DEFAULT),DEFAULT:=$(DEFAULT)) + URL:=https://optee.readthedocs.io + endef + + define Package/optee-os-$(1)/install + $$(Package/optee-os/install) + endef +endef + +define Build/Configure/Optee-os +endef + +define Build/Compile/Optee-os + +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \ + PATH=$(LINUX_DIR)/scripts/dtc/:$(PATH) \ + CROSS_COMPILE=$(TARGET_CROSS) \ + CROSS_COMPILE_core="$(TARGET_CROSS)" \ + CROSS_COMPILE_ta_arm64="$(TARGET_CROSS)" \ + CROSS_COMPILE_ta_arm32="$(TARGET_CROSS)" \ + $(if $(CONFIG_ARCH_64BIT), CFG_ARM64_core=y CFG_USER_TA_TARGETS=ta_arm64, CFG_ARM32_core=y) \ + PLATFORM="$(PLAT)" \ + PLATFORM_FLAVOR="$(call qstrip,$(PLAT_FLAVOR))" \ + $(OPTEE_MAKE_FLAGS) +endef + +define BuildPackage/Optee-os/Defaults + Build/Configure/Default = $$$$(Build/Configure/Optee-os) + Build/Compile/Default = $$$$(Build/Compile/Optee-os) +endef + +define BuildPackage/Optee-os + $(eval $(call BuildPackage/Optee-os/Defaults)) + $(foreach type,$(if $(DUMP),$(OPTEE_TARGETS),$(BUILD_VARIANT)), \ + $(eval $(call Build/Optee-os/Target,$(type))) + ) + $(eval $(call Build/DefaultTargets)) + $(foreach type,$(if $(DUMP),$(OPTEE_TARGETS),$(BUILD_VARIANT)), \ + $(call BuildPackage,optee-os-$(type)) + ) +endef From c93e7700d40750261341937433becdc3686ae321 Mon Sep 17 00:00:00 2001 From: Thomas Richard Date: Thu, 26 Sep 2024 16:19:35 +0200 Subject: [PATCH 129/877] optee-os-stm32: add OP-TEE for stm32 boards MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add OP-TEE for stm32 boards, with the first being STM32MP135F-DK. Signed-off-by: Thomas Richard Link: https://github.com/openwrt/openwrt/pull/16716 Signed-off-by: Hauke Mehrtens (cherry picked from commit fae25d4001bcbae0bb1ce60b676bd421e97d78fc) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/boot/optee-os-stm32/Makefile | 49 ++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 package/boot/optee-os-stm32/Makefile diff --git a/package/boot/optee-os-stm32/Makefile b/package/boot/optee-os-stm32/Makefile new file mode 100644 index 00000000000000..9e681127e6a1b2 --- /dev/null +++ b/package/boot/optee-os-stm32/Makefile @@ -0,0 +1,49 @@ +# +# Copyright (C) 2024 Bootlin +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_VERSION:=4.3.0 +PKG_RELEASE:=1 + +PKG_HASH:=390b271905c828d6def9fa6a77bbaa425f3b434d733c8eb18f582ccbc6896096 +PKG_MAINTAINER:=Thomas Richard + +OPTEE_USE_INTREE_DTC:=1 + +include $(INCLUDE_DIR)/kernel.mk +include $(INCLUDE_DIR)/optee-os.mk +include $(INCLUDE_DIR)/package.mk + +define Optee-os/Default + BUILD_TARGET:=stm32 +endef + +define Optee-os/stm32mp1 + BUILD_SUBTARGET:=stm32mp1 + PLAT:=stm32mp1 +endef + +define Optee-os/stm32mp135f-dk + $(call Optee-os/stm32mp1) + NAME:=STM32MP135F-DK + PLAT_FLAVOR:=135F_DK +endef + +OPTEE_TARGETS := stm32mp135f-dk + +define Package/optee-os/install/default +endef + +define Build/InstallDev + $(INSTALL_DIR) $(STAGING_DIR_IMAGE) + $(foreach img,$(OPTEE_IMAGE), \ + $(CP) $(PKG_BUILD_DIR)/out/arm-plat-$(PLAT)/core/$(img) $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-$(img); \ + ) +endef + +$(eval $(call BuildPackage/Optee-os)) From fd9de585d7ab82d400ed4091a20a36e20b83160e Mon Sep 17 00:00:00 2001 From: Thomas Richard Date: Thu, 26 Sep 2024 16:24:26 +0200 Subject: [PATCH 130/877] uboot-stm32: add U-Boot for stm32 boards MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add U-Boot for stm32 boards, with the first being STM32MP135F-DK. Signed-off-by: Thomas Richard Link: https://github.com/openwrt/openwrt/pull/16716 Signed-off-by: Hauke Mehrtens (cherry picked from commit ac79ad0757764028a138d0138c8d9aa74420f9ed) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/boot/uboot-stm32/Makefile | 51 +++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 package/boot/uboot-stm32/Makefile diff --git a/package/boot/uboot-stm32/Makefile b/package/boot/uboot-stm32/Makefile new file mode 100644 index 00000000000000..58754aedd5a7c5 --- /dev/null +++ b/package/boot/uboot-stm32/Makefile @@ -0,0 +1,51 @@ +# +# Copyright (C) 2024 Bootlin +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_VERSION:=2024.07 +PKG_RELEASE:=1 + +PKG_HASH:=f591da9ab90ef3d6b3d173766d0ddff90c4ed7330680897486117df390d83c8f +PKG_MAINTAINER:=Thomas Richard + +UBOOT_USE_INTREE_DTC:=1 + +include $(INCLUDE_DIR)/u-boot.mk +include $(INCLUDE_DIR)/package.mk + +define U-Boot/Default + BUILD_TARGET:=stm32 + UBOOT_IMAGE:=u-boot.bin u-boot.dtb +endef + +define U-Boot/stm32mp13 + BUILD_SUBTARGET:=stm32mp1 + UBOOT_CONFIG:=stm32mp13 +endef + +define U-Boot/stm32mp135f-dk + $(call U-Boot/stm32mp13) + NAME:=STM32MP135F-DK + DEVICE_TREE:=stm32mp135f-dk +endef + +UBOOT_TARGETS := stm32mp135f-dk + +UBOOT_MAKE_FLAGS += DEVICE_TREE=$(DEVICE_TREE) + +define Build/InstallDev + $(INSTALL_DIR) $(STAGING_DIR_IMAGE) + $(foreach img,$(UBOOT_IMAGE), \ + $(CP) $(PKG_BUILD_DIR)/$(img) $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-$(img); \ + ) +endef + +define Package/u-boot/install/default +endef + +$(eval $(call BuildPackage/U-Boot)) From d921c2db0b511b89cd9adeb644f4d92a79e419bb Mon Sep 17 00:00:00 2001 From: Thomas Richard Date: Thu, 26 Sep 2024 16:29:41 +0200 Subject: [PATCH 131/877] arm-trusted-firmware-stm32: add ATF for stm32 boards MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add ATF for stm32 boards, with the first being STM32MP135F-DK. Signed-off-by: Thomas Richard Link: https://github.com/openwrt/openwrt/pull/16716 Signed-off-by: Hauke Mehrtens (cherry picked from commit 08dcb73c8d05aa774957422731bfed1b322648d7) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- .../boot/arm-trusted-firmware-stm32/Makefile | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 package/boot/arm-trusted-firmware-stm32/Makefile diff --git a/package/boot/arm-trusted-firmware-stm32/Makefile b/package/boot/arm-trusted-firmware-stm32/Makefile new file mode 100644 index 00000000000000..75a92f15af6a37 --- /dev/null +++ b/package/boot/arm-trusted-firmware-stm32/Makefile @@ -0,0 +1,63 @@ +# +# Copyright (C) 2024 Bootlin +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_VERSION:=2.10 +PKG_RELEASE:=1 + +PKG_HASH:=88215a62291b9ba87da8e50b077741103cdc08fb6c9e1ebd34dfaace746d3201 +PKG_MAINTAINER:=Thomas Richard + +include $(INCLUDE_DIR)/kernel.mk +include $(INCLUDE_DIR)/trusted-firmware-a.mk +include $(INCLUDE_DIR)/package.mk + +define Trusted-Firmware-A/Default + BUILD_TARGET:=stm32 + BUILD_DEVICES:=$(1) + DEPENDS:=+u-boot-$(1) +optee-os-$(1) +endef + +define Trusted-Firmware-A/stm32mp1 + BUILD_SUBTARGET:=stm32mp1 + PLAT:=stm32mp1 + MAKE_ARGS += BL32_EXTRA2=$(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-tee-pageable_v2.bin \ + STM32MP_USB_PROGRAMMER=1 \ + STM32MP1_OPTEE_IN_SYSRAM=1 \ + ARM_ARCH_MAJOR=7 +endef + +define Trusted-Firmware-A/stm32mp135f-dk + $(call Trusted-Firmware-A/stm32mp1) + NAME:=STM32MP135F-DK + DTB_FILE_NAME=stm32mp135f-dk.dtb +endef + +TFA_TARGETS := stm32mp135f-dk + +TFA_MAKE_FLAGS += \ + ARCH=aarch32 AARCH32_SP=optee \ + BL32=$(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-tee-header_v2.bin \ + BL32_EXTRA1=$(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-tee-pager_v2.bin \ + BL33=$(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-u-boot.bin \ + BL33_CFG=$(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-u-boot.dtb \ + DTB_FILE_NAME=$(DTB_FILE_NAME) \ + STM32MP_SDMMC=1 \ + TARGET_BOARD="" \ + $(MAKE_ARGS) \ + all fip + +define Package/trusted-firmware-a/install + $(INSTALL_DIR) $(STAGING_DIR_IMAGE) + $(CP) $(PKG_BUILD_DIR)/build/$(PLAT)/release/tf-a-$(BUILD_VARIANT).stm32 \ + $(STAGING_DIR_IMAGE)/tf-a-$(BUILD_VARIANT).stm32 + $(CP) $(PKG_BUILD_DIR)/build/$(PLAT)/release/fip.bin \ + $(STAGING_DIR_IMAGE)/fip-$(BUILD_VARIANT).bin +endef + +$(eval $(call BuildPackage/Trusted-Firmware-A)) From 911b25d618dab50d84c9881aaedfe98761b006a2 Mon Sep 17 00:00:00 2001 From: Thomas Richard Date: Tue, 24 Sep 2024 18:06:28 +0200 Subject: [PATCH 132/877] mac80211: enable CONFIG_BRCMFMAC_SDIO for stm32 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All stm32 devices use BCM43430 Wi-Fi interface in SDIO mode. Signed-off-by: Thomas Richard Link: https://github.com/openwrt/openwrt/pull/16716 Signed-off-by: Hauke Mehrtens (cherry picked from commit 456e0aad97413816aee41e68b3d3cfdfadc2fd43) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/kernel/mac80211/broadcom.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/package/kernel/mac80211/broadcom.mk b/package/kernel/mac80211/broadcom.mk index a6f42cd19af21b..444d705ab31bfc 100644 --- a/package/kernel/mac80211/broadcom.mk +++ b/package/kernel/mac80211/broadcom.mk @@ -437,6 +437,7 @@ define KernelPackage/brcmfmac/config default y if TARGET_starfive default y if TARGET_rockchip default y if TARGET_sunxi + default y if TARGET_stm32 default n help Enable support for cards attached to an SDIO bus. From c3db0cca0f66d2edb721cf72adb92125abc4a001 Mon Sep 17 00:00:00 2001 From: Thomas Richard Date: Thu, 10 Oct 2024 17:19:38 +0200 Subject: [PATCH 133/877] murata-firmware: add new package MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This package contains firmwares provided by Murata. See https://community.murata.com/. Murata firmwares are used by wifi chip on stm32 boards. Signed-off-by: Thomas Richard Link: https://github.com/openwrt/openwrt/pull/16716 Signed-off-by: Hauke Mehrtens (cherry picked from commit 960f5f94d7cefe89abd41347124fd3f0fbb945ae) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/firmware/murata-firmware/Makefile | 57 +++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 package/firmware/murata-firmware/Makefile diff --git a/package/firmware/murata-firmware/Makefile b/package/firmware/murata-firmware/Makefile new file mode 100644 index 00000000000000..1d9efda576201c --- /dev/null +++ b/package/firmware/murata-firmware/Makefile @@ -0,0 +1,57 @@ +# +# Copyright (C) 2024 Bootlin +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=murata-firmware +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_DATE:=2024-09-12 +PKG_SOURCE_URL:=https://github.com/murata-wireless/cyw-fmac-fw.git +PKG_MIRROR_HASH:=26f8a2df800666daab183b2842e5b3d591b1e5b31769d5429f9d70527f43d152 +PKG_SOURCE_VERSION:=50ac17bb65b2342cd954d49d9bc492709d431c3c + +PKG_MAINTAINER:=Thomas Richard +PKG_LICENSE_FILES:=LICENCE + +include $(INCLUDE_DIR)/package.mk + +define Package/murata-firmware-default + SECTION:=firmware + CATEGORY:=Firmware + URL:=https://community.murata.com/ +endef + +define Build/Compile +endef + +define Package/murata-firmware-43430-sdio + $(Package/murata-firmware-default) + TITLE:=BCM43430 FullMac SDIO firmware + CONFLICTS:=cypress-firmware-43430-sdio +endef + +define Package/murata-firmware-43430-sdio/install + $(INSTALL_DIR) $(1)/lib/firmware/murata + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/cyfmac43430-sdio.bin \ + $(1)/lib/firmware/murata/ + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/cyfmac43430-sdio.1DX.clm_blob \ + $(1)/lib/firmware/murata/ + $(INSTALL_DIR) $(1)/lib/firmware/brcm + $(LN) \ + ../murata/cyfmac43430-sdio.bin \ + $(1)/lib/firmware/brcm/brcmfmac43430-sdio.bin + $(LN) \ + ../murata/cyfmac43430-sdio.1DX.clm_blob \ + $(1)/lib/firmware/brcm/brcmfmac43430-sdio.clm_blob +endef + +$(eval $(call BuildPackage,murata-firmware-43430-sdio)) + From 72bf1db35ce614322526c476ee09d76d652813fa Mon Sep 17 00:00:00 2001 From: Thomas Richard Date: Thu, 10 Oct 2024 17:21:16 +0200 Subject: [PATCH 134/877] murata-nvram: add new package MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This package contains nvram files for Murata's Wi-Fi/Bluetooth modules. Signed-off-by: Thomas Richard Link: https://github.com/openwrt/openwrt/pull/16716 Signed-off-by: Hauke Mehrtens (cherry picked from commit be937952fdf8f78fb45ea001258074ddb45e0891) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/firmware/murata-nvram/Makefile | 48 +++++++++++++++++++ .../files/cyfmac43430-sdio.1DX.stm32.txt | 47 ++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 package/firmware/murata-nvram/Makefile create mode 100755 package/firmware/murata-nvram/files/cyfmac43430-sdio.1DX.stm32.txt diff --git a/package/firmware/murata-nvram/Makefile b/package/firmware/murata-nvram/Makefile new file mode 100644 index 00000000000000..daf382e3bc003d --- /dev/null +++ b/package/firmware/murata-nvram/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2024 Bootlin +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=murata-nvram +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_DATE:=2024-09-28 +PKG_SOURCE_URL:=https://github.com/murata-wireless/cyw-fmac-nvram.git +PKG_MIRROR_HASH:=e2fc6f1f9898edfd67f5495e615882700f03b42a75efa2e3f4e2d524aed0efb8 +PKG_SOURCE_VERSION:=255819aab07572d87576a13329ef9d4c654167aa + +PKG_MAINTAINER:=Thomas Richard +PKG_LICENSE_FILES:=LICENCE.cypress + +include $(INCLUDE_DIR)/package.mk + +define Package/murata-nvram-default + SECTION:=firmware + CATEGORY:=Firmware + URL:=https://community.murata.com/ +endef + +define Build/Compile +endef + +define Package/murata-nvram-43430-sdio + $(Package/murata-nvram-default) + TITLE:=BCM43430 SDIO NVRAM + CONFLICTS:=brcmfmac-nvram-43430-sdio +endef + +define Package/murata-nvram-43430-sdio/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm + $(INSTALL_DATA) ./files/cyfmac43430-sdio.1DX.stm32.txt \ + $(1)/lib/firmware/brcm/ + $(LN) \ + cyfmac43430-sdio.1DX.stm32.txt \ + $(1)/lib/firmware/brcm/brcmfmac43430-sdio.st,stm32mp135f-dk.txt +endef + +$(eval $(call BuildPackage,murata-nvram-43430-sdio)) diff --git a/package/firmware/murata-nvram/files/cyfmac43430-sdio.1DX.stm32.txt b/package/firmware/murata-nvram/files/cyfmac43430-sdio.1DX.stm32.txt new file mode 100755 index 00000000000000..f06abf03808e94 --- /dev/null +++ b/package/firmware/murata-nvram/files/cyfmac43430-sdio.1DX.stm32.txt @@ -0,0 +1,47 @@ +# This NVRAM file is based on cyfmac43430-sdio.1DX.txt, except that the muxenab +# parameter was unset to enable IB IRQ (OOB IRQ is not stable on STM32 +# platforms). +# 2.4 GHz, 20 MHz BW mode +manfid=0x2d0 +prodid=0x0726 +vendid=0x14e4 +devid=0x43e2 +boardtype=0x0726 +boardrev=0x1202 +boardnum=22 +macaddr=00:90:4c:c5:12:38 +sromrev=11 +boardflags=0x00404201 +boardflags3=0x08000000 +xtalfreq=37400 +nocrc=1 +ag0=0 +aa2g=1 +ccode=ALL +#pa0itssit=0x20 +extpagain2g=0 +pa2ga0=-145,6667,-751 +AvVmid_c0=0x0,0xc8 +cckpwroffset0=2 +maxp2ga0=74 +#txpwrbckof=6 +cckbw202gpo=0 +legofdmbw202gpo=0x88888888 +mcsbw202gpo=0xaaaaaaaa +propbw202gpo=0xdd +ofdmdigfilttype=18 +ofdmdigfilttypebe=18 +papdmode=1 +papdvalidtest=1 +pacalidx2g=48 +papdepsoffset=-22 +papdendidx=58 +il0macaddr=00:90:4c:c5:12:38 +wl0id=0x431b +# muxenab defined to enable OOB IRQ. Level sensitive interrupt via WL_HOST_WAKE line. +# muxenab=0x10 +#BT COEX deferral limit setting +#btc_params 8 45000 +#btc_params 10 20000 +#spurconfig=0x3 +# End of NVRAM - do not remove this line # From 956bb0c2a49e3178542ca5e917b0db55c9aff695 Mon Sep 17 00:00:00 2001 From: Thomas Richard Date: Fri, 25 Oct 2024 15:20:38 +0200 Subject: [PATCH 135/877] kernel: package industrialio-hw-consumer driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is needed for the stm32/stm32mp1 subtarget. Signed-off-by: Thomas Richard Link: https://github.com/openwrt/openwrt/pull/16716 Signed-off-by: Hauke Mehrtens (cherry picked from commit ff96bd84ce0bae633007cf0de82d69796cf3508a) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/kernel/linux/modules/iio.mk | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/package/kernel/linux/modules/iio.mk b/package/kernel/linux/modules/iio.mk index e46544b79cc65c..b9bcaad5b20623 100644 --- a/package/kernel/linux/modules/iio.mk +++ b/package/kernel/linux/modules/iio.mk @@ -46,6 +46,23 @@ endef $(eval $(call KernelPackage,iio-kfifo-buf)) +define KernelPackage/industrialio-hw-consumer + TITLE:=Provides a bonding way to an other device in hardware + KCONFIG:=CONFIG_IIO_BUFFER_HW_CONSUMER + FILES:=$(LINUX_DIR)/drivers/iio/buffer/industrialio-hw-consumer.ko + AUTOLOAD:=$(call AutoLoad,55,industrialio-hw-consumer) + $(call AddDepends/iio,+kmod-iio-kfifo-buf) +endef + +define KernelPackage/industrialio-hw-consumer/description + Provides a way to bonding when an IIO device has a direct connection + to another device in hardware. In this case buffers for data transfers + are handled by hardware. +endef + +$(eval $(call KernelPackage,industrialio-hw-consumer)) + + define KernelPackage/industrialio-triggered-buffer TITLE:=Provides helper functions for setting up triggered buffers. DEPENDS:=+kmod-iio-kfifo-buf From 2950e189cebda9c0521c84f86c06aaeb447affe2 Mon Sep 17 00:00:00 2001 From: Thomas Richard Date: Fri, 25 Oct 2024 15:21:57 +0200 Subject: [PATCH 136/877] kernel: package snd-soc-dmic driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is needed for the stm32/stm32mp1 subtarget. Signed-off-by: Thomas Richard Link: https://github.com/openwrt/openwrt/pull/16716 Signed-off-by: Hauke Mehrtens (cherry picked from commit e606366a2e018e0a3b25e3dd4b3a937bb53c70e1) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/kernel/linux/modules/sound.mk | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/package/kernel/linux/modules/sound.mk b/package/kernel/linux/modules/sound.mk index 623f65ac59add1..f3e44e01eee82d 100644 --- a/package/kernel/linux/modules/sound.mk +++ b/package/kernel/linux/modules/sound.mk @@ -314,6 +314,17 @@ endef $(eval $(call KernelPackage,sound-soc-spdif)) +define KernelPackage/sound-soc-dmic + TITLE:=Generic Digital Microphone CODEC + KCONFIG:=CONFIG_SND_SOC_DMIC + FILES:=$(LINUX_DIR)/sound/soc/codecs/snd-soc-dmic.ko + AUTOLOAD:=$(call AutoProbe,snd-soc-dmic) + $(call AddDepends/sound,+kmod-sound-soc-core) +endef + +$(eval $(call KernelPackage,sound-soc-dmic)) + + define KernelPackage/pcspkr DEPENDS:=@TARGET_x86 +kmod-input-core TITLE:=PC speaker support From 0f301db3fff105887d0a373a792dbaccb9cc8593 Mon Sep 17 00:00:00 2001 From: Thomas Richard Date: Fri, 25 Oct 2024 15:23:26 +0200 Subject: [PATCH 137/877] kernel: unset CONFIG_DEVFREQ_THERMAL in kmod-thermal package MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is needed for the stm32/stm32mp1 subtarget. Signed-off-by: Thomas Richard Link: https://github.com/openwrt/openwrt/pull/16716 Signed-off-by: Hauke Mehrtens (cherry picked from commit 6b9df468f05fefa21a8cbce2fdb2e59692b4d246) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/kernel/linux/modules/other.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/package/kernel/linux/modules/other.mk b/package/kernel/linux/modules/other.mk index bbebcf37ec1adb..7b64985fd69e7d 100644 --- a/package/kernel/linux/modules/other.mk +++ b/package/kernel/linux/modules/other.mk @@ -961,6 +961,7 @@ define KernelPackage/thermal CONFIG_THERMAL=y \ CONFIG_THERMAL_OF=y \ CONFIG_CPU_THERMAL=y \ + CONFIG_DEVFREQ_THERMAL=n \ CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y \ CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE=n \ CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE=n \ From 2f99171de308c53d99a01ac35078f506633a2979 Mon Sep 17 00:00:00 2001 From: Thomas Richard Date: Tue, 5 Nov 2024 10:38:49 +0100 Subject: [PATCH 138/877] kernel: package crypto_engine driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is needed for the stm32/stm32mp1 subtarget. Signed-off-by: Thomas Richard Link: https://github.com/openwrt/openwrt/pull/16716 Signed-off-by: Hauke Mehrtens (cherry picked from commit 7bcc68ede36dcc66ec6cdb45c3201e0af0f90708) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/kernel/linux/modules/crypto.mk | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/package/kernel/linux/modules/crypto.mk b/package/kernel/linux/modules/crypto.mk index ce221635470302..2257a36c802cda 100644 --- a/package/kernel/linux/modules/crypto.mk +++ b/package/kernel/linux/modules/crypto.mk @@ -249,6 +249,15 @@ endef $(eval $(call KernelPackage,crypto-echainiv)) +define KernelPackage/crypto-engine + TITLE:=Crypto engine + KCONFIG:=CONFIG_CRYPTO_ENGINE + FILES:=$(LINUX_DIR)/crypto/crypto_engine.ko + AUTOLOAD:=$(call AutoLoad,09,crypto_engine) + $(call AddDepends/crypto, +kmod-crypto-rsa +kmod-crypto-kpp) +endef + +$(eval $(call KernelPackage,crypto-engine)) define KernelPackage/crypto-essiv TITLE:=ESSIV support for block encryption From 27afd9e1ca662724839577cf0815805d6a3971d3 Mon Sep 17 00:00:00 2001 From: Thomas Richard Date: Tue, 5 Nov 2024 10:39:47 +0100 Subject: [PATCH 139/877] kernel: package industrialio-buffer-cb driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is needed for the stm32/stm32mp1 subtarget. Signed-off-by: Thomas Richard Link: https://github.com/openwrt/openwrt/pull/16716 Signed-off-by: Hauke Mehrtens (cherry picked from commit b0adf5e0fdc0d4b449bced9191a95bf08124c1ac) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/kernel/linux/modules/iio.mk | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/package/kernel/linux/modules/iio.mk b/package/kernel/linux/modules/iio.mk index b9bcaad5b20623..e98a6830da0342 100644 --- a/package/kernel/linux/modules/iio.mk +++ b/package/kernel/linux/modules/iio.mk @@ -63,6 +63,21 @@ endef $(eval $(call KernelPackage,industrialio-hw-consumer)) +define KernelPackage/industrialio-buffer-cb + TITLE:=Provides callback buffer used for push in-kernel interfaces + KCONFIG:=CONFIG_IIO_BUFFER_CB + FILES:=$(LINUX_DIR)/drivers/iio/buffer/industrialio-buffer-cb.ko + AUTOLOAD:=$(call AutoLoad,55,industrialio-triggered-buffer-cb) + $(call AddDepends/iio) +endef + +define KernelPackage/industrialio-buffer-cb/description + Should be selected by any drivers that do in-kernel push usage. +endef + +$(eval $(call KernelPackage,industrialio-buffer-cb)) + + define KernelPackage/industrialio-triggered-buffer TITLE:=Provides helper functions for setting up triggered buffers. DEPENDS:=+kmod-iio-kfifo-buf From c584683a7f3c30754e2a2462642b9d81ee570d44 Mon Sep 17 00:00:00 2001 From: Thomas Richard Date: Tue, 5 Nov 2024 11:10:44 +0100 Subject: [PATCH 140/877] kernel: package media controller driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is needed for the stm32/stm32mp1 subtarget. Signed-off-by: Thomas Richard Link: https://github.com/openwrt/openwrt/pull/16716 Signed-off-by: Hauke Mehrtens (cherry picked from commit bb3418f21f7b8fe0dcd335375d183dd2a81772bf) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/kernel/linux/modules/video.mk | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/package/kernel/linux/modules/video.mk b/package/kernel/linux/modules/video.mk index f2fa82fd039c78..486b9b9ab1f0b7 100644 --- a/package/kernel/linux/modules/video.mk +++ b/package/kernel/linux/modules/video.mk @@ -12,6 +12,28 @@ V4L2_DIR=v4l2-core V4L2_USB_DIR=usb V4L2_MEM2MEM_DIR=platform +# +# Media +# +define KernelPackage/media-controller + SUBMENU:=$(VIDEO_MENU) + TITLE:=Media Controller API + KCONFIG:= \ + CONFIG_MEDIA_SUPPORT \ + CONFIG_MEDIA_CONTROLLER=y + FILES:= \ + $(LINUX_DIR)/drivers/media/mc/mc.ko + AUTOLOAD:=$(call AutoProbe,mc) +endef + +define KernelPackage/media-controller/description + Kernel modules for media controller API used to query media devices + internal topology and configure it dynamically. +endef + +$(eval $(call KernelPackage,media-controller)) + + # # Video Display # @@ -601,9 +623,8 @@ $(eval $(call KernelPackage,drm-radeon)) define KernelPackage/video-core SUBMENU:=$(VIDEO_MENU) TITLE=Video4Linux support - DEPENDS:=+PACKAGE_kmod-i2c-core:kmod-i2c-core + DEPENDS:=+PACKAGE_kmod-i2c-core:kmod-i2c-core +kmod-media-controller KCONFIG:= \ - CONFIG_MEDIA_SUPPORT \ CONFIG_MEDIA_CAMERA_SUPPORT=y \ CONFIG_VIDEO_DEV \ CONFIG_V4L_PLATFORM_DRIVERS=y \ From e654d55446a505dd59c1deb1b0a3f87a983dfdf4 Mon Sep 17 00:00:00 2001 From: Thomas Richard Date: Tue, 5 Nov 2024 11:23:36 +0100 Subject: [PATCH 141/877] kernel: add kmod-media-controller dependency for kmod-usb-audio MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The snd-usb-audio drivers uses media controller if media controller is set. So add kmod-media-controller as dependency. Signed-off-by: Thomas Richard Link: https://github.com/openwrt/openwrt/pull/16716 Signed-off-by: Hauke Mehrtens (cherry picked from commit 109592524663ae8bbda47e4ad51a124153a1c903) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/kernel/linux/modules/usb.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/package/kernel/linux/modules/usb.mk b/package/kernel/linux/modules/usb.mk index 458c8c4ba68f86..466c547e8ab2dd 100644 --- a/package/kernel/linux/modules/usb.mk +++ b/package/kernel/linux/modules/usb.mk @@ -576,6 +576,7 @@ define KernelPackage/usb-audio CONFIG_SND_USB_AUDIO $(call AddDepends/usb) $(call AddDepends/sound) + DEPENDS+=kmod-media-controller FILES:= \ $(LINUX_DIR)/sound/usb/snd-usbmidi-lib.ko \ $(LINUX_DIR)/sound/usb/snd-usb-audio.ko From 4eb85c47bddda48aea3e6ee8dd87e5214938f0fa Mon Sep 17 00:00:00 2001 From: Thomas Richard Date: Tue, 5 Nov 2024 11:13:34 +0100 Subject: [PATCH 142/877] kernel: package v4l2-async and v4l2-fwnode drivers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These packages are needed for the stm32/stm32mp1 subtarget. Signed-off-by: Thomas Richard Link: https://github.com/openwrt/openwrt/pull/16716 Signed-off-by: Hauke Mehrtens (cherry picked from commit e109831e07e398cc50839a30a1cf18c4436983f4) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/kernel/linux/modules/video.mk | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/package/kernel/linux/modules/video.mk b/package/kernel/linux/modules/video.mk index 486b9b9ab1f0b7..9bb030bf57fd0d 100644 --- a/package/kernel/linux/modules/video.mk +++ b/package/kernel/linux/modules/video.mk @@ -680,6 +680,25 @@ endef $(eval $(call KernelPackage,video-videobuf2)) +define KernelPackage/video-async + TITLE:=V4L2 ASYNC support + KCONFIG:=CONFIG_V4L2_ASYNC + FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_DIR)/v4l2-async.ko + $(call AddDepends/video) + AUTOLOAD:=$(call AutoProbe,v4l2-async) +endef + +$(eval $(call KernelPackage,video-async)) + +define KernelPackage/video-fwnode + TITLE:=V4L2 FWNODE support + KCONFIG:=CONFIG_V4L2_FWNODE + FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_DIR)/v4l2-fwnode.ko + $(call AddDepends/video,+kmod-video-async) + AUTOLOAD:=$(call AutoProbe,v4l2-fwnode) +endef + +$(eval $(call KernelPackage,video-fwnode)) define KernelPackage/video-cpia2 TITLE:=CPIA2 video driver From 58f4667a37fe0056e844e3baca4accf2b19ab4a2 Mon Sep 17 00:00:00 2001 From: Thomas Richard Date: Thu, 26 Sep 2024 16:55:22 +0200 Subject: [PATCH 143/877] stm32: add new stm32 target MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New stm32 target introduces support for stm32mp1 based devices. For now it includes an initial support of the STM32MP135F-DK device. The specifications bellow only list supported features. Specifications -------------- SOC: STM32MP135FAF7 RAM: 512 MiB Storage: SD Card Ethernet: 2x 100 Mbps Wireless: 2.4GHz Cypress CYW43455 (802.11b/g/n) LEDs: Heartbeat (Blue) Buttons: 1x Reset, 1x User (USER2) USB: 4x 2.0 Type-A Signed-off-by: Thomas Richard Link: https://github.com/openwrt/openwrt/pull/16716 Signed-off-by: Hauke Mehrtens (cherry picked from commit 851e7f77e424f24cda8531330f2d82ebc942c0a4) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- target/linux/stm32/Makefile | 24 + .../stm32/base-files/etc/board.d/02_network | 18 + .../base-files/lib/preinit/79_move_config | 15 + .../stm32/base-files/lib/upgrade/platform.sh | 181 +++ target/linux/stm32/image/Makefile | 63 + target/linux/stm32/image/extlinux.conf | 4 + .../linux/stm32/image/gen_stm32_sdcard_img.sh | 35 + target/linux/stm32/modules.mk | 256 ++++ ...-stm32-use-devm_stmmac_probe_config_.patch | 69 + ...ac-dwmac-stm32-refactor-clock-config.patch | 241 ++++ ...-stm32-Separate-out-external-clock-r.patch | 125 ++ ...-stm32-Separate-out-external-clock-s.patch | 132 ++ ...mac-stm32-Extract-PMCR-configuration.patch | 71 + ...wmac-stm32-Clean-up-the-debug-prints.patch | 83 ++ ...-stm32-Mask-support-for-PMCR-configu.patch | 101 ++ ...-stm32-add-management-of-stm32mp13-f.patch | 94 ++ ...d-ETZPC-as-a-system-bus-for-STM32MP1.patch | 1192 +++++++++++++++++ ...t-ETZPC-as-an-access-controller-for-.patch | 265 ++++ ...d-ethernet1-2-RMII-pins-for-STM32MP1.patch | 126 ++ ...d-ethernet1-and-ethernet2-support-on.patch | 108 ++ ...d-ethernet1-for-STM32MP135F-DK-board.patch | 58 + ...tm32-add-SDIO-in-band-interrupt-mode.patch | 166 +++ ...32-add-pinctrl-and-pinmux-interfaces.patch | 189 +++ ...-Low-Speed-Clock-Output-LSCO-support.patch | 253 ++++ ...c-add-pin-to-provide-LSCO-on-stm32mp.patch | 31 + ...c-add-LSCO-to-WLAN-BT-module-on-stm3.patch | 34 + ...d-support-of-WLAN-BT-on-stm32mp135f-.patch | 84 ++ ...-stm32-add-support-of-phy-supply-pro.patch | 106 ++ ...d-ethernet2-for-STM32MP135F-DK-board.patch | 53 + target/linux/stm32/stm32mp1/config-6.6 | 485 +++++++ target/linux/stm32/stm32mp1/target.mk | 12 + 31 files changed, 4674 insertions(+) create mode 100644 target/linux/stm32/Makefile create mode 100644 target/linux/stm32/base-files/etc/board.d/02_network create mode 100644 target/linux/stm32/base-files/lib/preinit/79_move_config create mode 100644 target/linux/stm32/base-files/lib/upgrade/platform.sh create mode 100644 target/linux/stm32/image/Makefile create mode 100644 target/linux/stm32/image/extlinux.conf create mode 100755 target/linux/stm32/image/gen_stm32_sdcard_img.sh create mode 100644 target/linux/stm32/modules.mk create mode 100644 target/linux/stm32/patches-6.6/001-net-stmmac-dwmac-stm32-use-devm_stmmac_probe_config_.patch create mode 100644 target/linux/stm32/patches-6.6/002-net-stmmac-dwmac-stm32-refactor-clock-config.patch create mode 100644 target/linux/stm32/patches-6.6/003-net-stmmac-dwmac-stm32-Separate-out-external-clock-r.patch create mode 100644 target/linux/stm32/patches-6.6/004-net-stmmac-dwmac-stm32-Separate-out-external-clock-s.patch create mode 100644 target/linux/stm32/patches-6.6/005-net-stmmac-dwmac-stm32-Extract-PMCR-configuration.patch create mode 100644 target/linux/stm32/patches-6.6/006-net-stmmac-dwmac-stm32-Clean-up-the-debug-prints.patch create mode 100644 target/linux/stm32/patches-6.6/007-net-stmmac-dwmac-stm32-Mask-support-for-PMCR-configu.patch create mode 100644 target/linux/stm32/patches-6.6/008-net-stmmac-dwmac-stm32-add-management-of-stm32mp13-f.patch create mode 100644 target/linux/stm32/patches-6.6/009-ARM-dts-stm32-add-ETZPC-as-a-system-bus-for-STM32MP1.patch create mode 100644 target/linux/stm32/patches-6.6/010-ARM-dts-stm32-put-ETZPC-as-an-access-controller-for-.patch create mode 100644 target/linux/stm32/patches-6.6/011-ARM-dts-stm32-add-ethernet1-2-RMII-pins-for-STM32MP1.patch create mode 100644 target/linux/stm32/patches-6.6/012-ARM-dts-stm32-add-ethernet1-and-ethernet2-support-on.patch create mode 100644 target/linux/stm32/patches-6.6/013-ARM-dts-stm32-add-ethernet1-for-STM32MP135F-DK-board.patch create mode 100644 target/linux/stm32/patches-6.6/020-mmc-mmci-stm32-add-SDIO-in-band-interrupt-mode.patch create mode 100644 target/linux/stm32/patches-6.6/030-rtc-stm32-add-pinctrl-and-pinmux-interfaces.patch create mode 100644 target/linux/stm32/patches-6.6/031-rtc-stm32-add-Low-Speed-Clock-Output-LSCO-support.patch create mode 100644 target/linux/stm32/patches-6.6/032-ARM-dts-stm32-rtc-add-pin-to-provide-LSCO-on-stm32mp.patch create mode 100644 target/linux/stm32/patches-6.6/033-ARM-dts-stm32-rtc-add-LSCO-to-WLAN-BT-module-on-stm3.patch create mode 100644 target/linux/stm32/patches-6.6/034-ARM-dts-stm32-add-support-of-WLAN-BT-on-stm32mp135f-.patch create mode 100644 target/linux/stm32/patches-6.6/700-net-stmmac-dwmac-stm32-add-support-of-phy-supply-pro.patch create mode 100644 target/linux/stm32/patches-6.6/900-ARM-dts-stm32-add-ethernet2-for-STM32MP135F-DK-board.patch create mode 100644 target/linux/stm32/stm32mp1/config-6.6 create mode 100644 target/linux/stm32/stm32mp1/target.mk diff --git a/target/linux/stm32/Makefile b/target/linux/stm32/Makefile new file mode 100644 index 00000000000000..3020d0b2b8e5b7 --- /dev/null +++ b/target/linux/stm32/Makefile @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2024 Bootlin +# + +include $(TOPDIR)/rules.mk + +BOARD:=stm32 +BOARDNAME:=STMicroelectronics STM32 +FEATURES:=boot-part emmc ext4 gpio rtc usb +SUBTARGETS:=stm32mp1 +CPU_TYPE:= + +KERNEL_PATCHVER:=6.6 + +include $(INCLUDE_DIR)/target.mk + +DEFAULT_PACKAGES += blockdev kmod-gpio-button-hotplug + +define Target/Description + Build firmware image for STM32 devices +endef + +$(eval $(call BuildTarget)) diff --git a/target/linux/stm32/base-files/etc/board.d/02_network b/target/linux/stm32/base-files/etc/board.d/02_network new file mode 100644 index 00000000000000..a96fada9a4e332 --- /dev/null +++ b/target/linux/stm32/base-files/etc/board.d/02_network @@ -0,0 +1,18 @@ + +. /lib/functions/uci-defaults.sh +. /lib/functions.sh +. /lib/functions/system.sh + +board_config_update + +board=$(board_name) + +case "$board" in +st,stm32mp135f-dk) + ucidef_set_interfaces_lan_wan "eth0" "eth1" + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/stm32/base-files/lib/preinit/79_move_config b/target/linux/stm32/base-files/lib/preinit/79_move_config new file mode 100644 index 00000000000000..bc7db4c7828f6a --- /dev/null +++ b/target/linux/stm32/base-files/lib/preinit/79_move_config @@ -0,0 +1,15 @@ + +move_config() { + . /lib/upgrade/common.sh + . /lib/upgrade/platform.sh + + if export_bootdevice && export_partdevice partdev 4; then + mount -t ext4 -o rw,noatime "/dev/$partdev" /mnt + if [ -f "/mnt/$BACKUP_FILE" ]; then + mv -f "/mnt/$BACKUP_FILE" / + fi + umount /mnt + fi +} + +boot_hook_add preinit_mount_root move_config diff --git a/target/linux/stm32/base-files/lib/upgrade/platform.sh b/target/linux/stm32/base-files/lib/upgrade/platform.sh new file mode 100644 index 00000000000000..4cd88ab6bd383e --- /dev/null +++ b/target/linux/stm32/base-files/lib/upgrade/platform.sh @@ -0,0 +1,181 @@ +REQUIRE_IMAGE_METADATA=1 + +UBOOT_ENV_PART=3 +BOOT_PART=4 +ROOTFS_PART=5 + +RAMFS_COPY_BIN='blockdev' + +export_bootdevice() { + local cmdline uuid blockdev uevent line class + local MAJOR MINOR DEVNAME DEVTYPE + local rootpart="$(cmdline_get_var root)" + + case "$rootpart" in + PARTUUID=????????-????-????-????-??????????0?/PARTNROFF=1 | \ + PARTUUID=????????-????-????-????-??????????05) + uuid="${rootpart#PARTUUID=}" + uuid="${uuid%/PARTNROFF=1}" + uuid="${uuid%0?}00" + for disk in $(find /dev -type b); do + set -- $(dd if=$disk bs=1 skip=568 count=16 2>/dev/null | hexdump -v -e '8/1 "%02x "" "2/1 "%02x""-"6/1 "%02x"') + if [ "$4$3$2$1-$6$5-$8$7-$9" = "$uuid" ]; then + uevent="/sys/class/block/${disk##*/}/uevent" + break + fi + done + ;; + esac + + if [ -e "$uevent" ]; then + while read line; do + export -n "$line" + done < "$uevent" + export BOOTDEV_MAJOR=$MAJOR + export BOOTDEV_MINOR=$MINOR + return 0 + fi + + return 1 +} + +platform_check_image() { + local diskdev partdev diff + + [ "$#" -gt 1 ] && return 1 + + export_bootdevice && export_partdevice diskdev 0 || { + v "platform_check_image: Unable to determine upgrade device" + return 1 + } + + get_partitions "/dev/$diskdev" bootdisk + + v "Extract the 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 + echo "Partition layout has changed. Full image will be written." + ask_bool 0 "Abort" && exit 1 + return 0 + fi +} + +platform_do_upgrade() { + local diskdev partdev diff partlabel + + 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 + + if [ -n "$diff" ]; then + rm -rf /tmp/ubootenv + + if export_partdevice partdev $UBOOT_ENV_PART; then + v "Saving u-boot env (/dev/$partdev) before to write image" + get_image_dd "/dev/$partdev" of=/tmp/ubootenv + fi + + v "Writing image to /dev/$diskdev..." + get_image_dd "$1" of="/dev/$diskdev" conv=fsync + + blockdev --rereadpt "/dev/$diskdev" + + [ -f /tmp/ubootenv ] && { + # iterate over each partition from the image to find the + # u-boot-env partition and restore u-boot env. + while read part start size; do + if export_partdevice partdev $part; then + while read line; do + eval "local l$line" + done < "/sys/class/block/$partdev/uevent" + + [ "$lPARTNAME" = "u-boot-env" ] || continue + + v "Writting u-boot env to /dev/$partdev" + get_image_dd /tmp/ubootenv of="/dev/$partdev" conv=fsync + + return 0 + fi + done < /tmp/partmap.image + } + 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 + # do not erase u-boot env + [ "$part" = "$UBOOT_ENV_PART" ] && continue + + v "Writing image to /dev/$partdev..." + v "Normal partition, doing DD" + get_image_dd "$1" of="/dev/$partdev" ibs=512 obs=1M skip="$start" \ + count="$size" conv=fsync + else + v "Unable to find partition $part device, skipped." + fi + done < /tmp/partmap.image + + if export_partdevice partdev "$BOOT_PART"; then + mount -t ext4 -o rw,noatime "/dev/$partdev" /mnt + local partuuid="$(cmdline_get_var root)" + v "Setting rootfs ${partuuid}" + sed -i "s/PARTUUID=[a-f0-9-]\+/${partuuid}/ig" \ + /mnt/extlinux/extlinux.conf + umount /mnt + fi +} + +platform_copy_config() { + local partdev + + # Iterate over each partition from the image to find the boot partition + # and copy the config tarball. + # The partlabel is used to find the partition. + # An hardcoded partition number cannot be used, as it could be wrong if + # the partition table changed, and the full image was written. + while read part start size; do + # config is copied in the boot partition, as for squashfs image, the + # rootfs partition is not writable. + if export_partdevice partdev "$part"; then + while read line; do + eval "local l$line" + done < "/sys/class/block/$partdev/uevent" + + [ "$lPARTNAME" = "boot" ] || continue + + mount -t ext4 -o rw,noatime "/dev/$partdev" /mnt + cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE" + umount /mnt + return 0 + else + v "ERROR: Unable to find partition to copy config data to" + fi + done < /tmp/partmap.image +} + diff --git a/target/linux/stm32/image/Makefile b/target/linux/stm32/image/Makefile new file mode 100644 index 00000000000000..77c25edaf892ad --- /dev/null +++ b/target/linux/stm32/image/Makefile @@ -0,0 +1,63 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2024 Bootlin +# + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/image.mk + +define Build/boot-img-ext4 + rm -fR $@.boot + mkdir -p $@.boot + $(foreach dts,$(DEVICE_DTS), $(CP) $(KDIR)/image-$(dts).dtb $@.boot/$(dts).dtb;) + $(CP) $(IMAGE_KERNEL) $@.boot/$(KERNEL_IMG) + $(INSTALL_DIR) $@.boot/extlinux + $(CP) ./extlinux.conf $@.boot/extlinux/ + $(SED) 's/@KERNEL@/$(KERNEL_IMG)/' $@.boot/extlinux/extlinux.conf + $(SED) 's/@DEVICE@/$(DEVICE_NAME)/' $@.boot/extlinux/extlinux.conf + $(SED) 's/@DTS@/$(DEVICE_DTS)/' $@.boot/extlinux/extlinux.conf + $(SED) 's/@ROOT@/PARTUUID=$(shell echo $(IMG_PART_DISKGUID) | sed 's/00$$/05/')/' $@.boot/extlinux/extlinux.conf + + make_ext4fs -J -L kernel -l $(CONFIG_TARGET_KERNEL_PARTSIZE)M \ + $(if $(SOURCE_DATE_EPOCH),-T $(SOURCE_DATE_EPOCH)) \ + $@.bootimg $@.boot +endef + +define Build/sdcard-img + GUID=$(IMG_PART_DISKGUID) ./gen_stm32_sdcard_img.sh \ + $@ $(STAGING_DIR_IMAGE)/tf-a-$(DEVICE_NAME).stm32 \ + $(STAGING_DIR_IMAGE)/fip-$(DEVICE_NAME).bin $@.bootimg $(IMAGE_ROOTFS) \ + $(ENV_SIZE) $(CONFIG_TARGET_KERNEL_PARTSIZE) $(CONFIG_TARGET_ROOTFS_PARTSIZE) +endef + +define Device/Default + PROFILES := Default + DEVICE_VENDOR := STMicroelectronics + IMAGES := factory.img.gz sysupgrade.img.gz + IMAGE/factory.img.gz := boot-img-ext4 | sdcard-img | gzip + IMAGE/sysupgrade.img.gz := boot-img-ext4 | sdcard-img | gzip | append-metadata + KERNEL := kernel-bin + KERNEL_NAME := zImage + KERNEL_IMG := zImage + DEVICE_DTS_DIR := $(DTS_DIR)/st + ENV_SIZE := 0x200000 + DEVICE_PACKAGES := kmod-brcmfmac \ + murata-firmware-43430-sdio \ + murata-nvram-43430-sdio \ + wpad-basic-mbedtls \ + kmod-phy-stm32-usbphyc \ + kmod-usb2 \ + kmod-usb-storage \ + kmod-usb-ledtrig-usbport \ + -mtd +endef + +define Device/stm32mp135f-dk + DEVICE_MODEL := STM32MP135F-DK + DEVICE_DTS := stm32mp135f-dk + SUPPORTED_DEVICES := st,stm32mp135f-dk +endef + +TARGET_DEVICES += stm32mp135f-dk + +$(eval $(call BuildImage)) diff --git a/target/linux/stm32/image/extlinux.conf b/target/linux/stm32/image/extlinux.conf new file mode 100644 index 00000000000000..5c7773c2a82792 --- /dev/null +++ b/target/linux/stm32/image/extlinux.conf @@ -0,0 +1,4 @@ +label @DEVICE@-openwrt + kernel /@KERNEL@ + devicetree /@DTS@.dtb + append root=@ROOT@ rootwait diff --git a/target/linux/stm32/image/gen_stm32_sdcard_img.sh b/target/linux/stm32/image/gen_stm32_sdcard_img.sh new file mode 100755 index 00000000000000..9af891694a4531 --- /dev/null +++ b/target/linux/stm32/image/gen_stm32_sdcard_img.sh @@ -0,0 +1,35 @@ +#!/bin/sh +# Copyright (C) 2024 Bootlin + +set -ex +[ $# -eq 8 ] || { + echo "SYNTAX: $0 " + exit 1 +} + +OUTPUT="${1}" +FSBL="${2}" +FIP="${3}" +BOOTFS="${4}" +ROOTFS="${5}" +ENVSIZE="$((${6} / 1024))" +BOOTFSSIZE="${7}" +ROOTFSSIZE="${8}" + +set $(ptgen -o "${OUTPUT}" -g -a 4 -l 2048 -G ${GUID} -N fsbla -p 2M -N fip -p 3M -N u-boot-env -p "${ENVSIZE}" -N boot -p${BOOTFSSIZE}M -N rootfs -p ${ROOTFSSIZE}M) +FSBLAOFFSET="$((${1} / 512))" +FSBLASIZE="$((${2} / 512))" +FIPOFFSET="$((${3} / 512))" +FIPSIZE="$((${4} / 512))" +ENVOFFSET="$((${5} / 512))" +ENVSIZE="$((${6} / 512))" +BOOTFSOFFSET="$((${7} / 512))" +BOOTFSSIZE="$((${8} / 512))" +ROOTFSOFFSET="$((${9} / 512))" +ROOTFSSIZE="$((${10} / 512))" + +dd bs=512 if="${FSBL}" of="${OUTPUT}" seek="${FSBLAOFFSET}" conv=notrunc +dd bs=512 if="${FIP}" of="${OUTPUT}" seek="${FIPOFFSET}" conv=notrunc +dd bs=512 if=/dev/zero of="${OUTPUT}" seek="${ENVOFFSET}" count="${ENVSIZE}" conv=notrunc +dd bs=512 if="${BOOTFS}" of="${OUTPUT}" seek="${BOOTFSOFFSET}" conv=notrunc +dd bs=512 if="${ROOTFS}" of="${OUTPUT}" seek="${ROOTFSOFFSET}" conv=notrunc diff --git a/target/linux/stm32/modules.mk b/target/linux/stm32/modules.mk new file mode 100644 index 00000000000000..baba80baba43aa --- /dev/null +++ b/target/linux/stm32/modules.mk @@ -0,0 +1,256 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2024 Bootlin + +define KernelPackage/phy-stm32-usbphyc + TITLE:=STM32 USB HS PHY Controller driver + DEPENDS:=@TARGET_stm32 + KCONFIG:=CONFIG_PHY_STM32_USBPHYC + FILES:=$(LINUX_DIR)/drivers/phy/st/phy-stm32-usbphyc.ko + AUTOLOAD:=$(call AutoProbe,phy-stm32-usbphyc,) +endef + +define KernelPackage/phy-stm32-usbphyc/description + Kernel module for STM32 USB HS PHY Controller +endef + +$(eval $(call KernelPackage,phy-stm32-usbphyc)) + + +define KernelPackage/bxcan + TITLE:=STM32 Basic Extended CAN (bxCAN) devices + KCONFIG:=CONFIG_CAN_BXCAN + FILES=$(LINUX_DIR)/drivers/net/can/bxcan.ko + AUTOLOAD:=$(call AutoProbe,bxcan) + $(call AddDepends/can,@TARGET_stm32) +endef + +$(eval $(call KernelPackage,bxcan)) + + +define KernelPackage/spi-stm32 + SUBMENU=$(SPI_MENU) + TITLE:=STM32 SPI controller + DEPENDS:=@TARGET_stm32 + KCONFIG:=CONFIG_SPI_STM32 \ + CONFIG_SPI=y \ + CONFIG_SPI_MASTER=y \ + CONFIG_SPI_SLAVE_TIME=n \ + CONFIG_SPI_SLAVE_SYSTEM_CONTROL=n + FILES=$(LINUX_DIR)/drivers/spi/spi-stm32.ko + AUTOLOAD:=$(call AutoProbe,spi-stm32) +endef + +define KernelPackage/spi-stm32/description + SPI driver for STMicroelectronics STM32 SoCs. +endef + +$(eval $(call KernelPackage,spi-stm32)) + + +define KernelPackage/scmi-hwmon + TITLE:=ARM SCMI Sensors + KCONFIG:=CONFIG_SENSORS_ARM_SCMI + FILES:=$(LINUX_DIR)/drivers/hwmon/scmi-hwmon.ko + AUTOLOAD:=$(call AutoProbe,scmi-hwmon) + $(call AddDepends/hwmon,@TARGET_stm32 +kmod-thermal) +endef + +$(eval $(call KernelPackage,scmi-hwmon)) + + +define KernelPackage/stm32-dcmi + TITLE:=STM32 Digital Camera Memory Interface support + KCONFIG:=CONFIG_VIDEO_STM32_DCMI + FILES:=$(LINUX_DIR)/drivers/media/platform/st/stm32/stm32-dcmi.ko + AUTOLOAD:=$(call AutoProbe,stm32-dcmi) + $(call AddDepends/video,@TARGET_stm32 +kmod-video-videobuf2 +kmod-video-dma-contig +kmod-video-async +kmod-video-fwnode) +endef + +$(eval $(call KernelPackage,stm32-dcmi)) + + +define KernelPackage/sound-soc-stm32-sai + TITLE:=STM32 SAI interface (Serial Audio Interface) support + KCONFIG:=CONFIG_SND_SOC_STM32_SAI + FILES:=$(LINUX_DIR)/sound/soc/stm/snd-soc-stm32-sai-sub.ko \ + $(LINUX_DIR)/sound/soc/stm/snd-soc-stm32-sai.ko + AUTOLOAD:=$(call AutoProbe,snd-soc-stm32-sai-sub snd-soc-stm32-sai) + $(call AddDepends/sound,@TARGET_stm32 +kmod-sound-soc-core) +endef + +$(eval $(call KernelPackage,sound-soc-stm32-sai)) + + +define KernelPackage/sound-soc-stm32-i2s + TITLE:=STM32 I2S interface (SPI/I2S block) support + KCONFIG:=CONFIG_SND_SOC_STM32_I2S + FILES:=$(LINUX_DIR)/sound/soc/stm/snd-soc-stm32-i2s.ko + AUTOLOAD:=$(call AutoProbe,snd-soc-stm32-i2s) + $(call AddDepends/sound,@TARGET_stm32 +kmod-sound-soc-core) +endef + +$(eval $(call KernelPackage,sound-soc-stm32-i2s)) + + +define KernelPackage/sound-soc-stm32-spdifrx + TITLE:=STM32 S/PDIF receiver (SPDIFRX) support + KCONFIG:=CONFIG_SND_SOC_STM32_SPDIFRX + FILES:=$(LINUX_DIR)/sound/soc/stm/snd-soc-stm32-spdifrx.ko + AUTOLOAD:=$(call AutoProbe,snd-soc-stm32-spdifrx) + $(call AddDepends/sound,@TARGET_stm32 +kmod-sound-soc-core) +endef + +$(eval $(call KernelPackage,sound-soc-stm32-spdifrx)) + + +define KernelPackage/sound-soc-stm32-dfsdm + TITLE:=SoC Audio support for STM32 DFSDM + KCONFIG:=CONFIG_SND_SOC_STM32_DFSDM + FILES:=$(LINUX_DIR)/sound/soc/stm/stm32_adfsdm.ko + AUTOLOAD:=$(call AutoProbe,stm32_adfsdm) + $(call AddDepends/sound,@TARGET_stm32 +kmod-sound-soc-core +kmod-stm32-dfsdm-adc +kmod-industrialio-buffer-cb) +endef + +$(eval $(call KernelPackage,sound-soc-stm32-dfsdm)) + + +define KernelPackage/stm32-timers + TITLE:=STM32 Timers + DEPENDS:=@TARGET_stm32 +kmod-mfd + KCONFIG:=CONFIG_MFD_STM32_TIMERS + FILES:=$(LINUX_DIR)/drivers/mfd/stm32-timers.ko + AUTOLOAD:=$(call AutoProbe,stm32-timers) +endef + +$(eval $(call KernelPackage,stm32-timers)) + + +define KernelPackage/stm32-timer-trigger + TITLE:=STM32 Timer Trigger + KCONFIG:=CONFIG_IIO_STM32_TIMER_TRIGGER + FILES:=$(LINUX_DIR)/drivers/iio/trigger/stm32-timer-trigger.ko + AUTOLOAD:=$(call AutoProbe,stm32-timer-trigger) + $(call AddDepends/iio,@TARGET_stm32 +kmod-stm32-timers) +endef + +$(eval $(call KernelPackage,stm32-timer-trigger)) + + +define KernelPackage/stm32-adc + TITLE:=STM32 ADC + KCONFIG:=CONFIG_STM32_ADC_CORE \ + CONFIG_STM32_ADC + FILES:=$(LINUX_DIR)/drivers/iio/adc/stm32-adc-core.ko \ + $(LINUX_DIR)/drivers/iio/adc/stm32-adc.ko + AUTOLOAD:=$(call AutoProbe,stm32-adc-core stm32-adc) + $(call AddDepends/iio,@TARGET_stm32 +kmod-stm32-timer-trigger +kmod-industrialio-triggered-buffer) +endef + +$(eval $(call KernelPackage,stm32-adc)) + + +define KernelPackage/stm32-dfsdm-adc + TITLE:=STM32 DFSDM ADC + KCONFIG:=CONFIG_STM32_DFSDM_CORE \ + CONFIG_STM32_DFSDM_ADC + FILES:=$(LINUX_DIR)/drivers/iio/adc/stm32-dfsdm-core.ko \ + $(LINUX_DIR)/drivers/iio/adc/stm32-dfsdm-adc.ko + AUTOLOAD:=$(call AutoProbe,stm32-dfsdm-core stm32-dfsdm-adc) + $(call AddDepends/iio,@TARGET_stm32 +kmod-stm32-timer-trigger +kmod-industrialio-triggered-buffer +kmod-industrialio-hw-consumer) +endef + +$(eval $(call KernelPackage,stm32-dfsdm-adc)) + + +define KernelPackage/scmi-iio + TITLE:=IIO SCMI + KCONFIG=CONFIG_IIO_SCMI + FILES:=$(LINUX_DIR)/drivers/iio/common/scmi_sensors/scmi_iio.ko + AUTOLOAD:=$(call AutoProbe,scmi_iio) + $(call AddDepends/iio,@TARGET_stm32 +kmod-iio-kfifo-buf) +endef + +$(eval $(call KernelPackage,scmi-iio)) + + +define KernelPackage/stm32-dac + TITLE:=STM32 DAC + DEPENDS:=@TARGET_stm32 + KCONFIG:=CONFIG_STM32_DAC_CORE \ + CONFIG_STM32_DAC + FILES:=$(LINUX_DIR)/drivers/iio/dac/stm32-dac-core.ko \ + $(LINUX_DIR)/drivers/iio/dac/stm32-dac.ko + AUTOLOAD:=$(call AutoProbe,stm32-dac-core stm32-dac) + $(call AddDepends/iio,@TARGET_stm32) +endef + +$(eval $(call KernelPackage,stm32-dac)) + + +define KernelPackage/nvmem-stm32-romem + SUBMENU:=$(OTHER_MENU) + TITLE:=STM32 factory-programmed memory support + DEPENDS:=@TARGET_stm32 + KCONFIG:=CONFIG_NVMEM_STM32_ROMEM + FILES:=$(LINUX_DIR)/drivers/nvmem/nvmem_stm32_romem.ko + AUTOLOAD:=$(call AutoProbe,nvmem-stm32-romem) +endef + +$(eval $(call KernelPackage,nvmem-stm32-romem)) + + +define KernelPackage/stm32-crc32 + TITLE:=Support for STM32 crc accelerators + KCONFIG:=CONFIG_CRYPTO_DEV_STM32_CRC \ + CONFIG_CRYPTO_HW=y + FILES:=$(LINUX_DIR)/drivers/crypto/stm32/stm32-crc32.ko + AUTOLOAD:=$(call AutoProbe,stm32-crc32) + $(call AddDepends/crypto,@TARGET_stm32 +kmod-crypto-crc32) +endef + +$(eval $(call KernelPackage,stm32-crc32)) + + +define KernelPackage/stm32-hash + SUBMENU:=$(CRYPTO_MENU) + TITLE:=Support for STM32 hash accelerators + DEPENDS:=@TARGET_stm32 \ + +kmod-crypto-md5 \ + +kmod-crypto-sha1 \ + +kmod-crypto-sha256 \ + +kmod-crypto-sha3 \ + +kmod-crypto-rsa + KCONFIG:=CONFIG_CRYPTO_DEV_STM32_HASH \ + CONFIG_CRYPTO_ENGINE=y \ + FILES:=$(LINUX_DIR)/drivers/crypto/stm32/stm32-hash.ko + AUTOLOAD:=$(call AutoProbe,stm32-hash) +endef + +$(eval $(call KernelPackage,stm32-hash)) + + +define KernelPackage/stm32-cryp + TITLE:=Support for STM32 cryp accelerators + KCONFIG:=CONFIG_CRYPTO_DEV_STM32_CRYP \ + CONFIG_CRYPTO_LIB_DES=y + FILES:=$(LINUX_DIR)/drivers/crypto/stm32/stm32-cryp.ko + AUTOLOAD:=$(call AutoProbe,stm32-cryp) + $(call AddDepends/crypto,@TARGET_stm32 +kmod-crypto-hash +kmod-crypto-des +kmod-crypto-engine) +endef + +$(eval $(call KernelPackage,stm32-cryp)) + + +define KernelPackage/st-thermal + SUBMENU:=$(OTHER_MENU) + TITLE:=Thermal sensors on STMicroelectronics STi series of SoCs + KCONFIG:=CONFIG_ST_THERMAL \ + CONFIG_ST_THERMAL_MEMMAP + DEPENDS:=@TARGET_stm32 +kmod-thermal + FILES:=$(LINUX_DIR)/drivers/thermal/st/st_thermal.ko \ + $(LINUX_DIR)/drivers/thermal/st/st_thermal_memmap.ko + AUTOLOAD:=$(call AutoProbe,st_thermal st_thermal_memmap) +endef + +$(eval $(call KernelPackage,st-thermal)) diff --git a/target/linux/stm32/patches-6.6/001-net-stmmac-dwmac-stm32-use-devm_stmmac_probe_config_.patch b/target/linux/stm32/patches-6.6/001-net-stmmac-dwmac-stm32-use-devm_stmmac_probe_config_.patch new file mode 100644 index 00000000000000..cf192fdef483dd --- /dev/null +++ b/target/linux/stm32/patches-6.6/001-net-stmmac-dwmac-stm32-use-devm_stmmac_probe_config_.patch @@ -0,0 +1,69 @@ +From 1ddced59ac1f7c739f21e930d87b126a30c561bb Mon Sep 17 00:00:00 2001 +From: Jisheng Zhang +Date: Sat, 16 Sep 2023 15:58:23 +0800 +Subject: [PATCH 1/8] net: stmmac: dwmac-stm32: use + devm_stmmac_probe_config_dt() + +Simplify the driver's probe() function by using the devres +variant of stmmac_probe_config_dt(). + +Signed-off-by: Jisheng Zhang +Signed-off-by: David S. Miller +--- + .../net/ethernet/stmicro/stmmac/dwmac-stm32.c | 17 ++++++----------- + 1 file changed, 6 insertions(+), 11 deletions(-) + +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c +@@ -372,21 +372,18 @@ static int stm32_dwmac_probe(struct plat + if (ret) + return ret; + +- plat_dat = stmmac_probe_config_dt(pdev, stmmac_res.mac); ++ plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac); + if (IS_ERR(plat_dat)) + return PTR_ERR(plat_dat); + + dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL); +- if (!dwmac) { +- ret = -ENOMEM; +- goto err_remove_config_dt; +- } ++ if (!dwmac) ++ return -ENOMEM; + + data = of_device_get_match_data(&pdev->dev); + if (!data) { + dev_err(&pdev->dev, "no of match data provided\n"); +- ret = -EINVAL; +- goto err_remove_config_dt; ++ return -EINVAL; + } + + dwmac->ops = data; +@@ -395,14 +392,14 @@ static int stm32_dwmac_probe(struct plat + ret = stm32_dwmac_parse_data(dwmac, &pdev->dev); + if (ret) { + dev_err(&pdev->dev, "Unable to parse OF data\n"); +- goto err_remove_config_dt; ++ return ret; + } + + plat_dat->bsp_priv = dwmac; + + ret = stm32_dwmac_init(plat_dat); + if (ret) +- goto err_remove_config_dt; ++ return ret; + + ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); + if (ret) +@@ -412,8 +409,6 @@ static int stm32_dwmac_probe(struct plat + + err_clk_disable: + stm32_dwmac_clk_disable(dwmac); +-err_remove_config_dt: +- stmmac_remove_config_dt(pdev, plat_dat); + + return ret; + } diff --git a/target/linux/stm32/patches-6.6/002-net-stmmac-dwmac-stm32-refactor-clock-config.patch b/target/linux/stm32/patches-6.6/002-net-stmmac-dwmac-stm32-refactor-clock-config.patch new file mode 100644 index 00000000000000..dd791dab6a0615 --- /dev/null +++ b/target/linux/stm32/patches-6.6/002-net-stmmac-dwmac-stm32-refactor-clock-config.patch @@ -0,0 +1,241 @@ +From 73c350e3fb32e9598b66f61081c7e06a7fba49f8 Mon Sep 17 00:00:00 2001 +From: Ben Wolsieffer +Date: Mon, 9 Oct 2023 10:59:04 -0400 +Subject: [PATCH 2/8] net: stmmac: dwmac-stm32: refactor clock config + +Currently, clock configuration is spread throughout the driver and +partially duplicated for the STM32MP1 and STM32 MCU variants. This makes +it difficult to keep track of which clocks need to be enabled or disabled +in various scenarios. + +This patch adds symmetric stm32_dwmac_clk_enable/disable() functions +that handle all clock configuration, including quirks required while +suspending or resuming. syscfg_clk and clk_eth_ck are not present on +STM32 MCUs, but it is fine to try to configure them anyway since NULL +clocks are ignored. + +Signed-off-by: Ben Wolsieffer +Signed-off-by: David S. Miller +--- + .../net/ethernet/stmicro/stmmac/dwmac-stm32.c | 113 +++++++----------- + 1 file changed, 45 insertions(+), 68 deletions(-) + +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c +@@ -98,7 +98,6 @@ struct stm32_dwmac { + + struct stm32_ops { + int (*set_mode)(struct plat_stmmacenet_data *plat_dat); +- int (*clk_prepare)(struct stm32_dwmac *dwmac, bool prepare); + int (*suspend)(struct stm32_dwmac *dwmac); + void (*resume)(struct stm32_dwmac *dwmac); + int (*parse_data)(struct stm32_dwmac *dwmac, +@@ -107,62 +106,55 @@ struct stm32_ops { + bool clk_rx_enable_in_suspend; + }; + +-static int stm32_dwmac_init(struct plat_stmmacenet_data *plat_dat) ++static int stm32_dwmac_clk_enable(struct stm32_dwmac *dwmac, bool resume) + { +- struct stm32_dwmac *dwmac = plat_dat->bsp_priv; + int ret; + +- if (dwmac->ops->set_mode) { +- ret = dwmac->ops->set_mode(plat_dat); +- if (ret) +- return ret; +- } +- + ret = clk_prepare_enable(dwmac->clk_tx); + if (ret) +- return ret; ++ goto err_clk_tx; + +- if (!dwmac->ops->clk_rx_enable_in_suspend || +- !dwmac->dev->power.is_suspended) { ++ if (!dwmac->ops->clk_rx_enable_in_suspend || !resume) { + ret = clk_prepare_enable(dwmac->clk_rx); +- if (ret) { +- clk_disable_unprepare(dwmac->clk_tx); +- return ret; +- } ++ if (ret) ++ goto err_clk_rx; + } + +- if (dwmac->ops->clk_prepare) { +- ret = dwmac->ops->clk_prepare(dwmac, true); +- if (ret) { +- clk_disable_unprepare(dwmac->clk_rx); +- clk_disable_unprepare(dwmac->clk_tx); +- } ++ ret = clk_prepare_enable(dwmac->syscfg_clk); ++ if (ret) ++ goto err_syscfg_clk; ++ ++ if (dwmac->enable_eth_ck) { ++ ret = clk_prepare_enable(dwmac->clk_eth_ck); ++ if (ret) ++ goto err_clk_eth_ck; + } + + return ret; ++ ++err_clk_eth_ck: ++ clk_disable_unprepare(dwmac->syscfg_clk); ++err_syscfg_clk: ++ if (!dwmac->ops->clk_rx_enable_in_suspend || !resume) ++ clk_disable_unprepare(dwmac->clk_rx); ++err_clk_rx: ++ clk_disable_unprepare(dwmac->clk_tx); ++err_clk_tx: ++ return ret; + } + +-static int stm32mp1_clk_prepare(struct stm32_dwmac *dwmac, bool prepare) ++static int stm32_dwmac_init(struct plat_stmmacenet_data *plat_dat, bool resume) + { +- int ret = 0; ++ struct stm32_dwmac *dwmac = plat_dat->bsp_priv; ++ int ret; + +- if (prepare) { +- ret = clk_prepare_enable(dwmac->syscfg_clk); ++ if (dwmac->ops->set_mode) { ++ ret = dwmac->ops->set_mode(plat_dat); + if (ret) + return ret; +- if (dwmac->enable_eth_ck) { +- ret = clk_prepare_enable(dwmac->clk_eth_ck); +- if (ret) { +- clk_disable_unprepare(dwmac->syscfg_clk); +- return ret; +- } +- } +- } else { +- clk_disable_unprepare(dwmac->syscfg_clk); +- if (dwmac->enable_eth_ck) +- clk_disable_unprepare(dwmac->clk_eth_ck); + } +- return ret; ++ ++ return stm32_dwmac_clk_enable(dwmac, resume); + } + + static int stm32mp1_set_mode(struct plat_stmmacenet_data *plat_dat) +@@ -252,13 +244,15 @@ static int stm32mcu_set_mode(struct plat + dwmac->ops->syscfg_eth_mask, val << 23); + } + +-static void stm32_dwmac_clk_disable(struct stm32_dwmac *dwmac) ++static void stm32_dwmac_clk_disable(struct stm32_dwmac *dwmac, bool suspend) + { + clk_disable_unprepare(dwmac->clk_tx); +- clk_disable_unprepare(dwmac->clk_rx); ++ if (!dwmac->ops->clk_rx_enable_in_suspend || !suspend) ++ clk_disable_unprepare(dwmac->clk_rx); + +- if (dwmac->ops->clk_prepare) +- dwmac->ops->clk_prepare(dwmac, false); ++ clk_disable_unprepare(dwmac->syscfg_clk); ++ if (dwmac->enable_eth_ck) ++ clk_disable_unprepare(dwmac->clk_eth_ck); + } + + static int stm32_dwmac_parse_data(struct stm32_dwmac *dwmac, +@@ -397,7 +391,7 @@ static int stm32_dwmac_probe(struct plat + + plat_dat->bsp_priv = dwmac; + +- ret = stm32_dwmac_init(plat_dat); ++ ret = stm32_dwmac_init(plat_dat, false); + if (ret) + return ret; + +@@ -408,7 +402,7 @@ static int stm32_dwmac_probe(struct plat + return 0; + + err_clk_disable: +- stm32_dwmac_clk_disable(dwmac); ++ stm32_dwmac_clk_disable(dwmac, false); + + return ret; + } +@@ -421,7 +415,7 @@ static void stm32_dwmac_remove(struct pl + + stmmac_dvr_remove(&pdev->dev); + +- stm32_dwmac_clk_disable(priv->plat->bsp_priv); ++ stm32_dwmac_clk_disable(dwmac, false); + + if (dwmac->irq_pwr_wakeup >= 0) { + dev_pm_clear_wake_irq(&pdev->dev); +@@ -431,18 +425,7 @@ static void stm32_dwmac_remove(struct pl + + static int stm32mp1_suspend(struct stm32_dwmac *dwmac) + { +- int ret = 0; +- +- ret = clk_prepare_enable(dwmac->clk_ethstp); +- if (ret) +- return ret; +- +- clk_disable_unprepare(dwmac->clk_tx); +- clk_disable_unprepare(dwmac->syscfg_clk); +- if (dwmac->enable_eth_ck) +- clk_disable_unprepare(dwmac->clk_eth_ck); +- +- return ret; ++ return clk_prepare_enable(dwmac->clk_ethstp); + } + + static void stm32mp1_resume(struct stm32_dwmac *dwmac) +@@ -450,14 +433,6 @@ static void stm32mp1_resume(struct stm32 + clk_disable_unprepare(dwmac->clk_ethstp); + } + +-static int stm32mcu_suspend(struct stm32_dwmac *dwmac) +-{ +- clk_disable_unprepare(dwmac->clk_tx); +- clk_disable_unprepare(dwmac->clk_rx); +- +- return 0; +-} +- + #ifdef CONFIG_PM_SLEEP + static int stm32_dwmac_suspend(struct device *dev) + { +@@ -468,6 +443,10 @@ static int stm32_dwmac_suspend(struct de + int ret; + + ret = stmmac_suspend(dev); ++ if (ret) ++ return ret; ++ ++ stm32_dwmac_clk_disable(dwmac, true); + + if (dwmac->ops->suspend) + ret = dwmac->ops->suspend(dwmac); +@@ -485,7 +464,7 @@ static int stm32_dwmac_resume(struct dev + if (dwmac->ops->resume) + dwmac->ops->resume(dwmac); + +- ret = stm32_dwmac_init(priv->plat); ++ ret = stm32_dwmac_init(priv->plat, true); + if (ret) + return ret; + +@@ -500,13 +479,11 @@ static SIMPLE_DEV_PM_OPS(stm32_dwmac_pm_ + + static struct stm32_ops stm32mcu_dwmac_data = { + .set_mode = stm32mcu_set_mode, +- .suspend = stm32mcu_suspend, + .syscfg_eth_mask = SYSCFG_MCU_ETH_MASK + }; + + static struct stm32_ops stm32mp1_dwmac_data = { + .set_mode = stm32mp1_set_mode, +- .clk_prepare = stm32mp1_clk_prepare, + .suspend = stm32mp1_suspend, + .resume = stm32mp1_resume, + .parse_data = stm32mp1_parse_data, diff --git a/target/linux/stm32/patches-6.6/003-net-stmmac-dwmac-stm32-Separate-out-external-clock-r.patch b/target/linux/stm32/patches-6.6/003-net-stmmac-dwmac-stm32-Separate-out-external-clock-r.patch new file mode 100644 index 00000000000000..bcdd23b4ebf9a6 --- /dev/null +++ b/target/linux/stm32/patches-6.6/003-net-stmmac-dwmac-stm32-Separate-out-external-clock-r.patch @@ -0,0 +1,125 @@ +From 23c08dc4ff28b5ca1aa5ee745a5e9688561e8f6a Mon Sep 17 00:00:00 2001 +From: Marek Vasut +Date: Tue, 11 Jun 2024 10:36:00 +0200 +Subject: [PATCH 3/8] net: stmmac: dwmac-stm32: Separate out external clock + rate validation + +Pull the external clock frequency validation into a separate function, +to avoid conflating it with external clock DT property decoding and +clock mux register configuration. This should make the code easier to +read and understand. + +This does change the code behavior slightly. The clock mux PMCR register +setting now depends solely on the DT properties which configure the clock +mux between external clock and internal RCC generated clock. The mux PMCR +register settings no longer depend on the supplied clock frequency, that +supplied clock frequency is now only validated, and if the clock frequency +is invalid for a mode, it is rejected. + +Previously, the code would switch the PMCR register clock mux to internal +RCC generated clock if external clock couldn't provide suitable frequency, +without checking whether the RCC generated clock frequency is correct. Such +behavior is risky at best, user should have configured their clock correctly +in the first place, so this behavior is removed here. + +Signed-off-by: Marek Vasut +Signed-off-by: Christophe Roullier +Signed-off-by: Paolo Abeni +--- + .../net/ethernet/stmicro/stmmac/dwmac-stm32.c | 51 +++++++++++++++---- + 1 file changed, 41 insertions(+), 10 deletions(-) + +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c +@@ -157,25 +157,54 @@ static int stm32_dwmac_init(struct plat_ + return stm32_dwmac_clk_enable(dwmac, resume); + } + ++static int stm32mp1_validate_ethck_rate(struct plat_stmmacenet_data *plat_dat) ++{ ++ struct stm32_dwmac *dwmac = plat_dat->bsp_priv; ++ const u32 clk_rate = clk_get_rate(dwmac->clk_eth_ck); ++ ++ switch (plat_dat->mac_interface) { ++ case PHY_INTERFACE_MODE_MII: ++ case PHY_INTERFACE_MODE_GMII: ++ if (clk_rate == ETH_CK_F_25M) ++ return 0; ++ break; ++ case PHY_INTERFACE_MODE_RMII: ++ if (clk_rate == ETH_CK_F_25M || clk_rate == ETH_CK_F_50M) ++ return 0; ++ break; ++ case PHY_INTERFACE_MODE_RGMII: ++ case PHY_INTERFACE_MODE_RGMII_ID: ++ case PHY_INTERFACE_MODE_RGMII_RXID: ++ case PHY_INTERFACE_MODE_RGMII_TXID: ++ if (clk_rate == ETH_CK_F_25M || clk_rate == ETH_CK_F_125M) ++ return 0; ++ break; ++ default: ++ break; ++ } ++ ++ dev_err(dwmac->dev, "Mode %s does not match eth-ck frequency %d Hz", ++ phy_modes(plat_dat->mac_interface), clk_rate); ++ return -EINVAL; ++} ++ + static int stm32mp1_set_mode(struct plat_stmmacenet_data *plat_dat) + { + struct stm32_dwmac *dwmac = plat_dat->bsp_priv; +- u32 reg = dwmac->mode_reg, clk_rate; +- int val; ++ u32 reg = dwmac->mode_reg; ++ int val, ret; + +- clk_rate = clk_get_rate(dwmac->clk_eth_ck); + dwmac->enable_eth_ck = false; + switch (plat_dat->mac_interface) { + case PHY_INTERFACE_MODE_MII: +- if (clk_rate == ETH_CK_F_25M && dwmac->ext_phyclk) ++ if (dwmac->ext_phyclk) + dwmac->enable_eth_ck = true; + val = SYSCFG_PMCR_ETH_SEL_MII; + pr_debug("SYSCFG init : PHY_INTERFACE_MODE_MII\n"); + break; + case PHY_INTERFACE_MODE_GMII: + val = SYSCFG_PMCR_ETH_SEL_GMII; +- if (clk_rate == ETH_CK_F_25M && +- (dwmac->eth_clk_sel_reg || dwmac->ext_phyclk)) { ++ if (dwmac->eth_clk_sel_reg || dwmac->ext_phyclk) { + dwmac->enable_eth_ck = true; + val |= SYSCFG_PMCR_ETH_CLK_SEL; + } +@@ -183,8 +212,7 @@ static int stm32mp1_set_mode(struct plat + break; + case PHY_INTERFACE_MODE_RMII: + val = SYSCFG_PMCR_ETH_SEL_RMII; +- if ((clk_rate == ETH_CK_F_25M || clk_rate == ETH_CK_F_50M) && +- (dwmac->eth_ref_clk_sel_reg || dwmac->ext_phyclk)) { ++ if (dwmac->eth_ref_clk_sel_reg || dwmac->ext_phyclk) { + dwmac->enable_eth_ck = true; + val |= SYSCFG_PMCR_ETH_REF_CLK_SEL; + } +@@ -195,8 +223,7 @@ static int stm32mp1_set_mode(struct plat + case PHY_INTERFACE_MODE_RGMII_RXID: + case PHY_INTERFACE_MODE_RGMII_TXID: + val = SYSCFG_PMCR_ETH_SEL_RGMII; +- if ((clk_rate == ETH_CK_F_25M || clk_rate == ETH_CK_F_125M) && +- (dwmac->eth_clk_sel_reg || dwmac->ext_phyclk)) { ++ if (dwmac->eth_clk_sel_reg || dwmac->ext_phyclk) { + dwmac->enable_eth_ck = true; + val |= SYSCFG_PMCR_ETH_CLK_SEL; + } +@@ -209,6 +236,10 @@ static int stm32mp1_set_mode(struct plat + return -EINVAL; + } + ++ ret = stm32mp1_validate_ethck_rate(plat_dat); ++ if (ret) ++ return ret; ++ + /* Need to update PMCCLRR (clear register) */ + regmap_write(dwmac->regmap, reg + SYSCFG_PMCCLRR_OFFSET, + dwmac->ops->syscfg_eth_mask); diff --git a/target/linux/stm32/patches-6.6/004-net-stmmac-dwmac-stm32-Separate-out-external-clock-s.patch b/target/linux/stm32/patches-6.6/004-net-stmmac-dwmac-stm32-Separate-out-external-clock-s.patch new file mode 100644 index 00000000000000..2e8f76158d41a4 --- /dev/null +++ b/target/linux/stm32/patches-6.6/004-net-stmmac-dwmac-stm32-Separate-out-external-clock-s.patch @@ -0,0 +1,132 @@ +From d23ba64e733580db2809e6f6dbf6f093fbd1b91b Mon Sep 17 00:00:00 2001 +From: Marek Vasut +Date: Tue, 11 Jun 2024 10:36:01 +0200 +Subject: [PATCH 4/8] net: stmmac: dwmac-stm32: Separate out external clock + selector + +Pull the external clock selector into a separate function, to avoid +conflating it with external clock rate validation and clock mux +register configuration. This should make the code easier to read and +understand. + +The dwmac->enable_eth_ck variable in the end indicates whether the MAC +clock are supplied by external oscillator (true) or internal RCC clock +IP (false). The dwmac->enable_eth_ck value is set based on multiple DT +properties, some of them deprecated, some of them specific to bus mode. + +The following DT properties and variables are taken into account. In +each case, if the property is present or true, MAC clock is supplied +by external oscillator. +- "st,ext-phyclk", assigned to variable dwmac->ext_phyclk + - Used in any mode (MII/RMII/GMII/RGMII) + - The only non-deprecated DT property of the three +- "st,eth-clk-sel", assigned to variable dwmac->eth_clk_sel_reg + - Valid only in GMII/RGMII mode + - Deprecated property, backward compatibility only +- "st,eth-ref-clk-sel", assigned to variable dwmac->eth_ref_clk_sel_reg + - Valid only in RMII mode + - Deprecated property, backward compatibility only + +The stm32mp1_select_ethck_external() function handles the aforementioned +DT properties and sets dwmac->enable_eth_ck accordingly. + +The stm32mp1_set_mode() is adjusted to call stm32mp1_select_ethck_external() +first and then only use dwmac->enable_eth_ck to determine hardware clock mux +settings. + +No functional change intended. + +Signed-off-by: Marek Vasut +Signed-off-by: Christophe Roullier +Signed-off-by: Paolo Abeni +--- + .../net/ethernet/stmicro/stmmac/dwmac-stm32.c | 50 ++++++++++++++----- + 1 file changed, 38 insertions(+), 12 deletions(-) + +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c +@@ -157,6 +157,37 @@ static int stm32_dwmac_init(struct plat_ + return stm32_dwmac_clk_enable(dwmac, resume); + } + ++static int stm32mp1_select_ethck_external(struct plat_stmmacenet_data *plat_dat) ++{ ++ struct stm32_dwmac *dwmac = plat_dat->bsp_priv; ++ ++ switch (plat_dat->mac_interface) { ++ case PHY_INTERFACE_MODE_MII: ++ dwmac->enable_eth_ck = dwmac->ext_phyclk; ++ return 0; ++ case PHY_INTERFACE_MODE_GMII: ++ dwmac->enable_eth_ck = dwmac->eth_clk_sel_reg || ++ dwmac->ext_phyclk; ++ return 0; ++ case PHY_INTERFACE_MODE_RMII: ++ dwmac->enable_eth_ck = dwmac->eth_ref_clk_sel_reg || ++ dwmac->ext_phyclk; ++ return 0; ++ case PHY_INTERFACE_MODE_RGMII: ++ case PHY_INTERFACE_MODE_RGMII_ID: ++ case PHY_INTERFACE_MODE_RGMII_RXID: ++ case PHY_INTERFACE_MODE_RGMII_TXID: ++ dwmac->enable_eth_ck = dwmac->eth_clk_sel_reg || ++ dwmac->ext_phyclk; ++ return 0; ++ default: ++ dwmac->enable_eth_ck = false; ++ dev_err(dwmac->dev, "Mode %s not supported", ++ phy_modes(plat_dat->mac_interface)); ++ return -EINVAL; ++ } ++} ++ + static int stm32mp1_validate_ethck_rate(struct plat_stmmacenet_data *plat_dat) + { + struct stm32_dwmac *dwmac = plat_dat->bsp_priv; +@@ -194,28 +225,25 @@ static int stm32mp1_set_mode(struct plat + u32 reg = dwmac->mode_reg; + int val, ret; + +- dwmac->enable_eth_ck = false; ++ ret = stm32mp1_select_ethck_external(plat_dat); ++ if (ret) ++ return ret; ++ + switch (plat_dat->mac_interface) { + case PHY_INTERFACE_MODE_MII: +- if (dwmac->ext_phyclk) +- dwmac->enable_eth_ck = true; + val = SYSCFG_PMCR_ETH_SEL_MII; + pr_debug("SYSCFG init : PHY_INTERFACE_MODE_MII\n"); + break; + case PHY_INTERFACE_MODE_GMII: + val = SYSCFG_PMCR_ETH_SEL_GMII; +- if (dwmac->eth_clk_sel_reg || dwmac->ext_phyclk) { +- dwmac->enable_eth_ck = true; ++ if (dwmac->enable_eth_ck) + val |= SYSCFG_PMCR_ETH_CLK_SEL; +- } + pr_debug("SYSCFG init : PHY_INTERFACE_MODE_GMII\n"); + break; + case PHY_INTERFACE_MODE_RMII: + val = SYSCFG_PMCR_ETH_SEL_RMII; +- if (dwmac->eth_ref_clk_sel_reg || dwmac->ext_phyclk) { +- dwmac->enable_eth_ck = true; ++ if (dwmac->enable_eth_ck) + val |= SYSCFG_PMCR_ETH_REF_CLK_SEL; +- } + pr_debug("SYSCFG init : PHY_INTERFACE_MODE_RMII\n"); + break; + case PHY_INTERFACE_MODE_RGMII: +@@ -223,10 +251,8 @@ static int stm32mp1_set_mode(struct plat + case PHY_INTERFACE_MODE_RGMII_RXID: + case PHY_INTERFACE_MODE_RGMII_TXID: + val = SYSCFG_PMCR_ETH_SEL_RGMII; +- if (dwmac->eth_clk_sel_reg || dwmac->ext_phyclk) { +- dwmac->enable_eth_ck = true; ++ if (dwmac->enable_eth_ck) + val |= SYSCFG_PMCR_ETH_CLK_SEL; +- } + pr_debug("SYSCFG init : PHY_INTERFACE_MODE_RGMII\n"); + break; + default: diff --git a/target/linux/stm32/patches-6.6/005-net-stmmac-dwmac-stm32-Extract-PMCR-configuration.patch b/target/linux/stm32/patches-6.6/005-net-stmmac-dwmac-stm32-Extract-PMCR-configuration.patch new file mode 100644 index 00000000000000..b28884df586ef7 --- /dev/null +++ b/target/linux/stm32/patches-6.6/005-net-stmmac-dwmac-stm32-Extract-PMCR-configuration.patch @@ -0,0 +1,71 @@ +From bb7ab910631ee0ade0758a3c4aa8dadc3b6934b6 Mon Sep 17 00:00:00 2001 +From: Marek Vasut +Date: Tue, 11 Jun 2024 10:36:02 +0200 +Subject: [PATCH 5/8] net: stmmac: dwmac-stm32: Extract PMCR configuration + +Pull the PMCR clock mux configuration into a separate function. This is +the final change of three, which moves external clock rate validation, +external clock selector decoding, and clock mux configuration into +separate functions. This should make the code easier to understand. +No functional change intended. + +Signed-off-by: Marek Vasut +Signed-off-by: Christophe Roullier +Signed-off-by: Paolo Abeni +--- + .../net/ethernet/stmicro/stmmac/dwmac-stm32.c | 27 ++++++++++++------- + 1 file changed, 17 insertions(+), 10 deletions(-) + +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c +@@ -219,15 +219,11 @@ static int stm32mp1_validate_ethck_rate( + return -EINVAL; + } + +-static int stm32mp1_set_mode(struct plat_stmmacenet_data *plat_dat) ++static int stm32mp1_configure_pmcr(struct plat_stmmacenet_data *plat_dat) + { + struct stm32_dwmac *dwmac = plat_dat->bsp_priv; + u32 reg = dwmac->mode_reg; +- int val, ret; +- +- ret = stm32mp1_select_ethck_external(plat_dat); +- if (ret) +- return ret; ++ int val; + + switch (plat_dat->mac_interface) { + case PHY_INTERFACE_MODE_MII: +@@ -262,10 +258,6 @@ static int stm32mp1_set_mode(struct plat + return -EINVAL; + } + +- ret = stm32mp1_validate_ethck_rate(plat_dat); +- if (ret) +- return ret; +- + /* Need to update PMCCLRR (clear register) */ + regmap_write(dwmac->regmap, reg + SYSCFG_PMCCLRR_OFFSET, + dwmac->ops->syscfg_eth_mask); +@@ -275,6 +267,21 @@ static int stm32mp1_set_mode(struct plat + dwmac->ops->syscfg_eth_mask, val); + } + ++static int stm32mp1_set_mode(struct plat_stmmacenet_data *plat_dat) ++{ ++ int ret; ++ ++ ret = stm32mp1_select_ethck_external(plat_dat); ++ if (ret) ++ return ret; ++ ++ ret = stm32mp1_validate_ethck_rate(plat_dat); ++ if (ret) ++ return ret; ++ ++ return stm32mp1_configure_pmcr(plat_dat); ++} ++ + static int stm32mcu_set_mode(struct plat_stmmacenet_data *plat_dat) + { + struct stm32_dwmac *dwmac = plat_dat->bsp_priv; diff --git a/target/linux/stm32/patches-6.6/006-net-stmmac-dwmac-stm32-Clean-up-the-debug-prints.patch b/target/linux/stm32/patches-6.6/006-net-stmmac-dwmac-stm32-Clean-up-the-debug-prints.patch new file mode 100644 index 00000000000000..45050ae0775ed6 --- /dev/null +++ b/target/linux/stm32/patches-6.6/006-net-stmmac-dwmac-stm32-Clean-up-the-debug-prints.patch @@ -0,0 +1,83 @@ +From 0476213f50452446fedd1a918b7bc72eb39a4c46 Mon Sep 17 00:00:00 2001 +From: Marek Vasut +Date: Tue, 11 Jun 2024 10:36:03 +0200 +Subject: [PATCH 6/8] net: stmmac: dwmac-stm32: Clean up the debug prints + +Use dev_err()/dev_dbg() and phy_modes() to print PHY mode instead of +pr_debug() and hand-written PHY mode decoding. This way, each debug +print has associated device with it and duplicated mode decoding is +removed. + +Signed-off-by: Marek Vasut +Signed-off-by: Christophe Roullier +Signed-off-by: Paolo Abeni +--- + .../net/ethernet/stmicro/stmmac/dwmac-stm32.c | 18 ++++++++---------- + 1 file changed, 8 insertions(+), 10 deletions(-) + +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c +@@ -228,19 +228,16 @@ static int stm32mp1_configure_pmcr(struc + switch (plat_dat->mac_interface) { + case PHY_INTERFACE_MODE_MII: + val = SYSCFG_PMCR_ETH_SEL_MII; +- pr_debug("SYSCFG init : PHY_INTERFACE_MODE_MII\n"); + break; + case PHY_INTERFACE_MODE_GMII: + val = SYSCFG_PMCR_ETH_SEL_GMII; + if (dwmac->enable_eth_ck) + val |= SYSCFG_PMCR_ETH_CLK_SEL; +- pr_debug("SYSCFG init : PHY_INTERFACE_MODE_GMII\n"); + break; + case PHY_INTERFACE_MODE_RMII: + val = SYSCFG_PMCR_ETH_SEL_RMII; + if (dwmac->enable_eth_ck) + val |= SYSCFG_PMCR_ETH_REF_CLK_SEL; +- pr_debug("SYSCFG init : PHY_INTERFACE_MODE_RMII\n"); + break; + case PHY_INTERFACE_MODE_RGMII: + case PHY_INTERFACE_MODE_RGMII_ID: +@@ -249,15 +246,16 @@ static int stm32mp1_configure_pmcr(struc + val = SYSCFG_PMCR_ETH_SEL_RGMII; + if (dwmac->enable_eth_ck) + val |= SYSCFG_PMCR_ETH_CLK_SEL; +- pr_debug("SYSCFG init : PHY_INTERFACE_MODE_RGMII\n"); + break; + default: +- pr_debug("SYSCFG init : Do not manage %d interface\n", +- plat_dat->mac_interface); ++ dev_err(dwmac->dev, "Mode %s not supported", ++ phy_modes(plat_dat->mac_interface)); + /* Do not manage others interfaces */ + return -EINVAL; + } + ++ dev_dbg(dwmac->dev, "Mode %s", phy_modes(plat_dat->mac_interface)); ++ + /* Need to update PMCCLRR (clear register) */ + regmap_write(dwmac->regmap, reg + SYSCFG_PMCCLRR_OFFSET, + dwmac->ops->syscfg_eth_mask); +@@ -291,19 +289,19 @@ static int stm32mcu_set_mode(struct plat + switch (plat_dat->mac_interface) { + case PHY_INTERFACE_MODE_MII: + val = SYSCFG_MCU_ETH_SEL_MII; +- pr_debug("SYSCFG init : PHY_INTERFACE_MODE_MII\n"); + break; + case PHY_INTERFACE_MODE_RMII: + val = SYSCFG_MCU_ETH_SEL_RMII; +- pr_debug("SYSCFG init : PHY_INTERFACE_MODE_RMII\n"); + break; + default: +- pr_debug("SYSCFG init : Do not manage %d interface\n", +- plat_dat->mac_interface); ++ dev_err(dwmac->dev, "Mode %s not supported", ++ phy_modes(plat_dat->mac_interface)); + /* Do not manage others interfaces */ + return -EINVAL; + } + ++ dev_dbg(dwmac->dev, "Mode %s", phy_modes(plat_dat->mac_interface)); ++ + return regmap_update_bits(dwmac->regmap, reg, + dwmac->ops->syscfg_eth_mask, val << 23); + } diff --git a/target/linux/stm32/patches-6.6/007-net-stmmac-dwmac-stm32-Mask-support-for-PMCR-configu.patch b/target/linux/stm32/patches-6.6/007-net-stmmac-dwmac-stm32-Mask-support-for-PMCR-configu.patch new file mode 100644 index 00000000000000..336378abb34380 --- /dev/null +++ b/target/linux/stm32/patches-6.6/007-net-stmmac-dwmac-stm32-Mask-support-for-PMCR-configu.patch @@ -0,0 +1,101 @@ +From 796669a85c5c4fa80cb8790e9adcccbbd99750e8 Mon Sep 17 00:00:00 2001 +From: Christophe Roullier +Date: Tue, 11 Jun 2024 10:36:05 +0200 +Subject: [PATCH 7/8] net: stmmac: dwmac-stm32: Mask support for PMCR + configuration + +Add possibility to have second argument in syscon property to manage +mask. This mask will be used to address right BITFIELDS of PMCR register. + +Signed-off-by: Christophe Roullier +Reviewed-by: Marek Vasut +Signed-off-by: Paolo Abeni +--- + .../net/ethernet/stmicro/stmmac/dwmac-stm32.c | 28 +++++++++++++------ + 1 file changed, 19 insertions(+), 9 deletions(-) + +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c +@@ -90,6 +90,7 @@ struct stm32_dwmac { + int eth_ref_clk_sel_reg; + int irq_pwr_wakeup; + u32 mode_reg; /* MAC glue-logic mode register */ ++ u32 mode_mask; + struct regmap *regmap; + u32 speed; + const struct stm32_ops *ops; +@@ -102,8 +103,8 @@ struct stm32_ops { + void (*resume)(struct stm32_dwmac *dwmac); + int (*parse_data)(struct stm32_dwmac *dwmac, + struct device *dev); +- u32 syscfg_eth_mask; + bool clk_rx_enable_in_suspend; ++ u32 syscfg_clr_off; + }; + + static int stm32_dwmac_clk_enable(struct stm32_dwmac *dwmac, bool resume) +@@ -256,13 +257,16 @@ static int stm32mp1_configure_pmcr(struc + + dev_dbg(dwmac->dev, "Mode %s", phy_modes(plat_dat->mac_interface)); + ++ /* Shift value at correct ethernet MAC offset in SYSCFG_PMCSETR */ ++ val <<= ffs(dwmac->mode_mask) - ffs(SYSCFG_MP1_ETH_MASK); ++ + /* Need to update PMCCLRR (clear register) */ +- regmap_write(dwmac->regmap, reg + SYSCFG_PMCCLRR_OFFSET, +- dwmac->ops->syscfg_eth_mask); ++ regmap_write(dwmac->regmap, dwmac->ops->syscfg_clr_off, ++ dwmac->mode_mask); + + /* Update PMCSETR (set register) */ + return regmap_update_bits(dwmac->regmap, reg, +- dwmac->ops->syscfg_eth_mask, val); ++ dwmac->mode_mask, val); + } + + static int stm32mp1_set_mode(struct plat_stmmacenet_data *plat_dat) +@@ -303,7 +307,7 @@ static int stm32mcu_set_mode(struct plat + dev_dbg(dwmac->dev, "Mode %s", phy_modes(plat_dat->mac_interface)); + + return regmap_update_bits(dwmac->regmap, reg, +- dwmac->ops->syscfg_eth_mask, val << 23); ++ SYSCFG_MCU_ETH_MASK, val << 23); + } + + static void stm32_dwmac_clk_disable(struct stm32_dwmac *dwmac, bool suspend) +@@ -348,8 +352,15 @@ static int stm32_dwmac_parse_data(struct + return PTR_ERR(dwmac->regmap); + + err = of_property_read_u32_index(np, "st,syscon", 1, &dwmac->mode_reg); +- if (err) ++ if (err) { + dev_err(dev, "Can't get sysconfig mode offset (%d)\n", err); ++ return err; ++ } ++ ++ dwmac->mode_mask = SYSCFG_MP1_ETH_MASK; ++ err = of_property_read_u32_index(np, "st,syscon", 2, &dwmac->mode_mask); ++ if (err) ++ dev_dbg(dev, "Warning sysconfig register mask not set\n"); + + return err; + } +@@ -540,8 +551,7 @@ static SIMPLE_DEV_PM_OPS(stm32_dwmac_pm_ + stm32_dwmac_suspend, stm32_dwmac_resume); + + static struct stm32_ops stm32mcu_dwmac_data = { +- .set_mode = stm32mcu_set_mode, +- .syscfg_eth_mask = SYSCFG_MCU_ETH_MASK ++ .set_mode = stm32mcu_set_mode + }; + + static struct stm32_ops stm32mp1_dwmac_data = { +@@ -549,7 +559,7 @@ static struct stm32_ops stm32mp1_dwmac_d + .suspend = stm32mp1_suspend, + .resume = stm32mp1_resume, + .parse_data = stm32mp1_parse_data, +- .syscfg_eth_mask = SYSCFG_MP1_ETH_MASK, ++ .syscfg_clr_off = 0x44, + .clk_rx_enable_in_suspend = true + }; + diff --git a/target/linux/stm32/patches-6.6/008-net-stmmac-dwmac-stm32-add-management-of-stm32mp13-f.patch b/target/linux/stm32/patches-6.6/008-net-stmmac-dwmac-stm32-add-management-of-stm32mp13-f.patch new file mode 100644 index 00000000000000..c2526019e2c7a9 --- /dev/null +++ b/target/linux/stm32/patches-6.6/008-net-stmmac-dwmac-stm32-add-management-of-stm32mp13-f.patch @@ -0,0 +1,94 @@ +From 8d28aaf5d5dbfd1f452286fa6ac571df0bcf00ad Mon Sep 17 00:00:00 2001 +From: Christophe Roullier +Date: Tue, 11 Jun 2024 10:36:06 +0200 +Subject: [PATCH 8/8] net: stmmac: dwmac-stm32: add management of stm32mp13 for + stm32 + +Add Ethernet support for STM32MP13. +STM32MP13 is STM32 SOC with 2 GMACs instances. +GMAC IP version is SNPS 4.20. +GMAC IP configure with 1 RX and 1 TX queue. +DMA HW capability register supported +RX Checksum Offload Engine supported +TX Checksum insertion supported +Wake-Up On Lan supported +TSO supported + +Signed-off-by: Christophe Roullier +Reviewed-by: Marek Vasut +Signed-off-by: Paolo Abeni +--- + .../net/ethernet/stmicro/stmmac/dwmac-stm32.c | 32 ++++++++++++++++--- + 1 file changed, 28 insertions(+), 4 deletions(-) + +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c +@@ -104,6 +104,7 @@ struct stm32_ops { + int (*parse_data)(struct stm32_dwmac *dwmac, + struct device *dev); + bool clk_rx_enable_in_suspend; ++ bool is_mp13; + u32 syscfg_clr_off; + }; + +@@ -224,11 +225,18 @@ static int stm32mp1_configure_pmcr(struc + { + struct stm32_dwmac *dwmac = plat_dat->bsp_priv; + u32 reg = dwmac->mode_reg; +- int val; ++ int val = 0; + + switch (plat_dat->mac_interface) { + case PHY_INTERFACE_MODE_MII: +- val = SYSCFG_PMCR_ETH_SEL_MII; ++ /* ++ * STM32MP15xx supports both MII and GMII, STM32MP13xx MII only. ++ * SYSCFG_PMCSETR ETH_SELMII is present only on STM32MP15xx and ++ * acts as a selector between 0:GMII and 1:MII. As STM32MP13xx ++ * supports only MII, ETH_SELMII is not present. ++ */ ++ if (!dwmac->ops->is_mp13) /* Select MII mode on STM32MP15xx */ ++ val |= SYSCFG_PMCR_ETH_SEL_MII; + break; + case PHY_INTERFACE_MODE_GMII: + val = SYSCFG_PMCR_ETH_SEL_GMII; +@@ -359,8 +367,12 @@ static int stm32_dwmac_parse_data(struct + + dwmac->mode_mask = SYSCFG_MP1_ETH_MASK; + err = of_property_read_u32_index(np, "st,syscon", 2, &dwmac->mode_mask); +- if (err) +- dev_dbg(dev, "Warning sysconfig register mask not set\n"); ++ if (err) { ++ if (dwmac->ops->is_mp13) ++ dev_err(dev, "Sysconfig register mask must be set (%d)\n", err); ++ else ++ dev_dbg(dev, "Warning sysconfig register mask not set\n"); ++ } + + return err; + } +@@ -560,12 +572,24 @@ static struct stm32_ops stm32mp1_dwmac_d + .resume = stm32mp1_resume, + .parse_data = stm32mp1_parse_data, + .syscfg_clr_off = 0x44, ++ .is_mp13 = false, ++ .clk_rx_enable_in_suspend = true ++}; ++ ++static struct stm32_ops stm32mp13_dwmac_data = { ++ .set_mode = stm32mp1_set_mode, ++ .suspend = stm32mp1_suspend, ++ .resume = stm32mp1_resume, ++ .parse_data = stm32mp1_parse_data, ++ .syscfg_clr_off = 0x08, ++ .is_mp13 = true, + .clk_rx_enable_in_suspend = true + }; + + static const struct of_device_id stm32_dwmac_match[] = { + { .compatible = "st,stm32-dwmac", .data = &stm32mcu_dwmac_data}, + { .compatible = "st,stm32mp1-dwmac", .data = &stm32mp1_dwmac_data}, ++ { .compatible = "st,stm32mp13-dwmac", .data = &stm32mp13_dwmac_data}, + { } + }; + MODULE_DEVICE_TABLE(of, stm32_dwmac_match); diff --git a/target/linux/stm32/patches-6.6/009-ARM-dts-stm32-add-ETZPC-as-a-system-bus-for-STM32MP1.patch b/target/linux/stm32/patches-6.6/009-ARM-dts-stm32-add-ETZPC-as-a-system-bus-for-STM32MP1.patch new file mode 100644 index 00000000000000..f00001bc473daa --- /dev/null +++ b/target/linux/stm32/patches-6.6/009-ARM-dts-stm32-add-ETZPC-as-a-system-bus-for-STM32MP1.patch @@ -0,0 +1,1192 @@ +From d788961c5b25d9d822c4230bfbc536a6736b91ff Mon Sep 17 00:00:00 2001 +From: Gatien Chevallier +Date: Fri, 5 Jan 2024 14:04:03 +0100 +Subject: [PATCH 1/5] ARM: dts: stm32: add ETZPC as a system bus for STM32MP13x + boards + +ETZPC is a firewall controller. Put all peripherals filtered by the +ETZPC as ETZPC subnodes and keep the "simple-bus" compatible for +backward compatibility. + +Signed-off-by: Gatien Chevallier +Signed-off-by: Alexandre Torgue +--- + arch/arm/boot/dts/st/stm32mp131.dtsi | 1020 +++++++++++++------------ + arch/arm/boot/dts/st/stm32mp133.dtsi | 50 +- + arch/arm/boot/dts/st/stm32mp13xc.dtsi | 18 +- + arch/arm/boot/dts/st/stm32mp13xf.dtsi | 18 +- + 4 files changed, 569 insertions(+), 537 deletions(-) + +--- a/arch/arm/boot/dts/st/stm32mp131.dtsi ++++ b/arch/arm/boot/dts/st/stm32mp131.dtsi +@@ -745,340 +745,6 @@ + dma-channels = <16>; + }; + +- adc_2: adc@48004000 { +- compatible = "st,stm32mp13-adc-core"; +- reg = <0x48004000 0x400>; +- interrupts = ; +- clocks = <&rcc ADC2>, <&rcc ADC2_K>; +- clock-names = "bus", "adc"; +- interrupt-controller; +- #interrupt-cells = <1>; +- #address-cells = <1>; +- #size-cells = <0>; +- status = "disabled"; +- +- adc2: adc@0 { +- compatible = "st,stm32mp13-adc"; +- #io-channel-cells = <1>; +- #address-cells = <1>; +- #size-cells = <0>; +- reg = <0x0>; +- interrupt-parent = <&adc_2>; +- interrupts = <0>; +- dmas = <&dmamux1 10 0x400 0x80000001>; +- dma-names = "rx"; +- status = "disabled"; +- +- channel@13 { +- reg = <13>; +- label = "vrefint"; +- }; +- channel@14 { +- reg = <14>; +- label = "vddcore"; +- }; +- channel@16 { +- reg = <16>; +- label = "vddcpu"; +- }; +- channel@17 { +- reg = <17>; +- label = "vddq_ddr"; +- }; +- }; +- }; +- +- usbotg_hs: usb@49000000 { +- compatible = "st,stm32mp15-hsotg", "snps,dwc2"; +- reg = <0x49000000 0x40000>; +- clocks = <&rcc USBO_K>; +- clock-names = "otg"; +- resets = <&rcc USBO_R>; +- reset-names = "dwc2"; +- interrupts = ; +- g-rx-fifo-size = <512>; +- g-np-tx-fifo-size = <32>; +- g-tx-fifo-size = <256 16 16 16 16 16 16 16>; +- dr_mode = "otg"; +- otg-rev = <0x200>; +- usb33d-supply = <&scmi_usb33>; +- status = "disabled"; +- }; +- +- usart1: serial@4c000000 { +- compatible = "st,stm32h7-uart"; +- reg = <0x4c000000 0x400>; +- interrupts-extended = <&exti 26 IRQ_TYPE_LEVEL_HIGH>; +- clocks = <&rcc USART1_K>; +- resets = <&rcc USART1_R>; +- wakeup-source; +- dmas = <&dmamux1 41 0x400 0x5>, +- <&dmamux1 42 0x400 0x1>; +- dma-names = "rx", "tx"; +- status = "disabled"; +- }; +- +- usart2: serial@4c001000 { +- compatible = "st,stm32h7-uart"; +- reg = <0x4c001000 0x400>; +- interrupts-extended = <&exti 27 IRQ_TYPE_LEVEL_HIGH>; +- clocks = <&rcc USART2_K>; +- resets = <&rcc USART2_R>; +- wakeup-source; +- dmas = <&dmamux1 43 0x400 0x5>, +- <&dmamux1 44 0x400 0x1>; +- dma-names = "rx", "tx"; +- status = "disabled"; +- }; +- +- i2s4: audio-controller@4c002000 { +- compatible = "st,stm32h7-i2s"; +- reg = <0x4c002000 0x400>; +- #sound-dai-cells = <0>; +- interrupts = ; +- dmas = <&dmamux1 83 0x400 0x01>, +- <&dmamux1 84 0x400 0x01>; +- dma-names = "rx", "tx"; +- status = "disabled"; +- }; +- +- spi4: spi@4c002000 { +- compatible = "st,stm32h7-spi"; +- reg = <0x4c002000 0x400>; +- interrupts = ; +- clocks = <&rcc SPI4_K>; +- resets = <&rcc SPI4_R>; +- #address-cells = <1>; +- #size-cells = <0>; +- dmas = <&dmamux1 83 0x400 0x01>, +- <&dmamux1 84 0x400 0x01>; +- dma-names = "rx", "tx"; +- status = "disabled"; +- }; +- +- spi5: spi@4c003000 { +- compatible = "st,stm32h7-spi"; +- reg = <0x4c003000 0x400>; +- interrupts = ; +- clocks = <&rcc SPI5_K>; +- resets = <&rcc SPI5_R>; +- #address-cells = <1>; +- #size-cells = <0>; +- dmas = <&dmamux1 85 0x400 0x01>, +- <&dmamux1 86 0x400 0x01>; +- dma-names = "rx", "tx"; +- status = "disabled"; +- }; +- +- i2c3: i2c@4c004000 { +- compatible = "st,stm32mp13-i2c"; +- reg = <0x4c004000 0x400>; +- interrupt-names = "event", "error"; +- interrupts = , +- ; +- clocks = <&rcc I2C3_K>; +- resets = <&rcc I2C3_R>; +- #address-cells = <1>; +- #size-cells = <0>; +- dmas = <&dmamux1 73 0x400 0x1>, +- <&dmamux1 74 0x400 0x1>; +- dma-names = "rx", "tx"; +- st,syscfg-fmp = <&syscfg 0x4 0x4>; +- i2c-analog-filter; +- status = "disabled"; +- }; +- +- i2c4: i2c@4c005000 { +- compatible = "st,stm32mp13-i2c"; +- reg = <0x4c005000 0x400>; +- interrupt-names = "event", "error"; +- interrupts = , +- ; +- clocks = <&rcc I2C4_K>; +- resets = <&rcc I2C4_R>; +- #address-cells = <1>; +- #size-cells = <0>; +- dmas = <&dmamux1 75 0x400 0x1>, +- <&dmamux1 76 0x400 0x1>; +- dma-names = "rx", "tx"; +- st,syscfg-fmp = <&syscfg 0x4 0x8>; +- i2c-analog-filter; +- status = "disabled"; +- }; +- +- i2c5: i2c@4c006000 { +- compatible = "st,stm32mp13-i2c"; +- reg = <0x4c006000 0x400>; +- interrupt-names = "event", "error"; +- interrupts = , +- ; +- clocks = <&rcc I2C5_K>; +- resets = <&rcc I2C5_R>; +- #address-cells = <1>; +- #size-cells = <0>; +- dmas = <&dmamux1 115 0x400 0x1>, +- <&dmamux1 116 0x400 0x1>; +- dma-names = "rx", "tx"; +- st,syscfg-fmp = <&syscfg 0x4 0x10>; +- i2c-analog-filter; +- status = "disabled"; +- }; +- +- timers12: timer@4c007000 { +- #address-cells = <1>; +- #size-cells = <0>; +- compatible = "st,stm32-timers"; +- reg = <0x4c007000 0x400>; +- interrupts = ; +- interrupt-names = "global"; +- clocks = <&rcc TIM12_K>; +- clock-names = "int"; +- status = "disabled"; +- +- pwm { +- compatible = "st,stm32-pwm"; +- #pwm-cells = <3>; +- status = "disabled"; +- }; +- +- timer@11 { +- compatible = "st,stm32h7-timer-trigger"; +- reg = <11>; +- status = "disabled"; +- }; +- }; +- +- timers13: timer@4c008000 { +- #address-cells = <1>; +- #size-cells = <0>; +- compatible = "st,stm32-timers"; +- reg = <0x4c008000 0x400>; +- interrupts = ; +- interrupt-names = "global"; +- clocks = <&rcc TIM13_K>; +- clock-names = "int"; +- status = "disabled"; +- +- pwm { +- compatible = "st,stm32-pwm"; +- #pwm-cells = <3>; +- status = "disabled"; +- }; +- +- timer@12 { +- compatible = "st,stm32h7-timer-trigger"; +- reg = <12>; +- status = "disabled"; +- }; +- }; +- +- timers14: timer@4c009000 { +- #address-cells = <1>; +- #size-cells = <0>; +- compatible = "st,stm32-timers"; +- reg = <0x4c009000 0x400>; +- interrupts = ; +- interrupt-names = "global"; +- clocks = <&rcc TIM14_K>; +- clock-names = "int"; +- status = "disabled"; +- +- pwm { +- compatible = "st,stm32-pwm"; +- #pwm-cells = <3>; +- status = "disabled"; +- }; +- +- timer@13 { +- compatible = "st,stm32h7-timer-trigger"; +- reg = <13>; +- status = "disabled"; +- }; +- }; +- +- timers15: timer@4c00a000 { +- #address-cells = <1>; +- #size-cells = <0>; +- compatible = "st,stm32-timers"; +- reg = <0x4c00a000 0x400>; +- interrupts = ; +- interrupt-names = "global"; +- clocks = <&rcc TIM15_K>; +- clock-names = "int"; +- dmas = <&dmamux1 105 0x400 0x1>, +- <&dmamux1 106 0x400 0x1>, +- <&dmamux1 107 0x400 0x1>, +- <&dmamux1 108 0x400 0x1>; +- dma-names = "ch1", "up", "trig", "com"; +- status = "disabled"; +- +- pwm { +- compatible = "st,stm32-pwm"; +- #pwm-cells = <3>; +- status = "disabled"; +- }; +- +- timer@14 { +- compatible = "st,stm32h7-timer-trigger"; +- reg = <14>; +- status = "disabled"; +- }; +- }; +- +- timers16: timer@4c00b000 { +- #address-cells = <1>; +- #size-cells = <0>; +- compatible = "st,stm32-timers"; +- reg = <0x4c00b000 0x400>; +- interrupts = ; +- interrupt-names = "global"; +- clocks = <&rcc TIM16_K>; +- clock-names = "int"; +- dmas = <&dmamux1 109 0x400 0x1>, +- <&dmamux1 110 0x400 0x1>; +- dma-names = "ch1", "up"; +- status = "disabled"; +- +- pwm { +- compatible = "st,stm32-pwm"; +- #pwm-cells = <3>; +- status = "disabled"; +- }; +- +- timer@15 { +- compatible = "st,stm32h7-timer-trigger"; +- reg = <15>; +- status = "disabled"; +- }; +- }; +- +- timers17: timer@4c00c000 { +- #address-cells = <1>; +- #size-cells = <0>; +- compatible = "st,stm32-timers"; +- reg = <0x4c00c000 0x400>; +- interrupts = ; +- interrupt-names = "global"; +- clocks = <&rcc TIM17_K>; +- clock-names = "int"; +- dmas = <&dmamux1 111 0x400 0x1>, +- <&dmamux1 112 0x400 0x1>; +- dma-names = "ch1", "up"; +- status = "disabled"; +- +- pwm { +- compatible = "st,stm32-pwm"; +- #pwm-cells = <3>; +- status = "disabled"; +- }; +- +- timer@16 { +- compatible = "st,stm32h7-timer-trigger"; +- reg = <16>; +- status = "disabled"; +- }; +- }; +- + rcc: rcc@50000000 { + compatible = "st,stm32mp13-rcc", "syscon"; + reg = <0x50000000 0x1000>; +@@ -1105,69 +771,6 @@ + clocks = <&rcc SYSCFG>; + }; + +- lptimer2: timer@50021000 { +- #address-cells = <1>; +- #size-cells = <0>; +- compatible = "st,stm32-lptimer"; +- reg = <0x50021000 0x400>; +- interrupts-extended = <&exti 48 IRQ_TYPE_LEVEL_HIGH>; +- clocks = <&rcc LPTIM2_K>; +- clock-names = "mux"; +- wakeup-source; +- status = "disabled"; +- +- pwm { +- compatible = "st,stm32-pwm-lp"; +- #pwm-cells = <3>; +- status = "disabled"; +- }; +- +- trigger@1 { +- compatible = "st,stm32-lptimer-trigger"; +- reg = <1>; +- status = "disabled"; +- }; +- +- counter { +- compatible = "st,stm32-lptimer-counter"; +- status = "disabled"; +- }; +- +- timer { +- compatible = "st,stm32-lptimer-timer"; +- status = "disabled"; +- }; +- }; +- +- lptimer3: timer@50022000 { +- #address-cells = <1>; +- #size-cells = <0>; +- compatible = "st,stm32-lptimer"; +- reg = <0x50022000 0x400>; +- interrupts-extended = <&exti 50 IRQ_TYPE_LEVEL_HIGH>; +- clocks = <&rcc LPTIM3_K>; +- clock-names = "mux"; +- wakeup-source; +- status = "disabled"; +- +- pwm { +- compatible = "st,stm32-pwm-lp"; +- #pwm-cells = <3>; +- status = "disabled"; +- }; +- +- trigger@2 { +- compatible = "st,stm32-lptimer-trigger"; +- reg = <2>; +- status = "disabled"; +- }; +- +- timer { +- compatible = "st,stm32-lptimer-timer"; +- status = "disabled"; +- }; +- }; +- + lptimer4: timer@50023000 { + compatible = "st,stm32-lptimer"; + reg = <0x50023000 0x400>; +@@ -1220,79 +823,10 @@ + dma-requests = <48>; + }; + +- fmc: memory-controller@58002000 { +- compatible = "st,stm32mp1-fmc2-ebi"; +- reg = <0x58002000 0x1000>; +- ranges = <0 0 0x60000000 0x04000000>, /* EBI CS 1 */ +- <1 0 0x64000000 0x04000000>, /* EBI CS 2 */ +- <2 0 0x68000000 0x04000000>, /* EBI CS 3 */ +- <3 0 0x6c000000 0x04000000>, /* EBI CS 4 */ +- <4 0 0x80000000 0x10000000>; /* NAND */ +- #address-cells = <2>; +- #size-cells = <1>; +- clocks = <&rcc FMC_K>; +- resets = <&rcc FMC_R>; +- status = "disabled"; +- +- nand-controller@4,0 { +- compatible = "st,stm32mp1-fmc2-nfc"; +- reg = <4 0x00000000 0x1000>, +- <4 0x08010000 0x1000>, +- <4 0x08020000 0x1000>, +- <4 0x01000000 0x1000>, +- <4 0x09010000 0x1000>, +- <4 0x09020000 0x1000>; +- #address-cells = <1>; +- #size-cells = <0>; +- interrupts = ; +- dmas = <&mdma 24 0x2 0x12000a02 0x0 0x0>, +- <&mdma 24 0x2 0x12000a08 0x0 0x0>, +- <&mdma 25 0x2 0x12000a0a 0x0 0x0>; +- dma-names = "tx", "rx", "ecc"; +- status = "disabled"; +- }; +- }; +- +- qspi: spi@58003000 { +- compatible = "st,stm32f469-qspi"; +- reg = <0x58003000 0x1000>, <0x70000000 0x10000000>; +- reg-names = "qspi", "qspi_mm"; +- #address-cells = <1>; +- #size-cells = <0>; +- interrupts = ; +- dmas = <&mdma 26 0x2 0x10100002 0x0 0x0>, +- <&mdma 26 0x2 0x10100008 0x0 0x0>; +- dma-names = "tx", "rx"; +- clocks = <&rcc QSPI_K>; +- resets = <&rcc QSPI_R>; +- status = "disabled"; +- }; +- +- sdmmc1: mmc@58005000 { +- compatible = "st,stm32-sdmmc2", "arm,pl18x", "arm,primecell"; +- arm,primecell-periphid = <0x20253180>; +- reg = <0x58005000 0x1000>, <0x58006000 0x1000>; +- interrupts = ; +- clocks = <&rcc SDMMC1_K>; +- clock-names = "apb_pclk"; +- resets = <&rcc SDMMC1_R>; +- cap-sd-highspeed; +- cap-mmc-highspeed; +- max-frequency = <130000000>; +- status = "disabled"; +- }; +- +- sdmmc2: mmc@58007000 { +- compatible = "st,stm32-sdmmc2", "arm,pl18x", "arm,primecell"; +- arm,primecell-periphid = <0x20253180>; +- reg = <0x58007000 0x1000>, <0x58008000 0x1000>; +- interrupts = ; +- clocks = <&rcc SDMMC2_K>; +- clock-names = "apb_pclk"; +- resets = <&rcc SDMMC2_R>; +- cap-sd-highspeed; +- cap-mmc-highspeed; +- max-frequency = <130000000>; ++ crc1: crc@58009000 { ++ compatible = "st,stm32f7-crc"; ++ reg = <0x58009000 0x400>; ++ clocks = <&rcc CRC1>; + status = "disabled"; + }; + +@@ -1323,29 +857,6 @@ + status = "disabled"; + }; + +- usbphyc: usbphyc@5a006000 { +- #address-cells = <1>; +- #size-cells = <0>; +- #clock-cells = <0>; +- compatible = "st,stm32mp1-usbphyc"; +- reg = <0x5a006000 0x1000>; +- clocks = <&rcc USBPHY_K>; +- resets = <&rcc USBPHY_R>; +- vdda1v1-supply = <&scmi_reg11>; +- vdda1v8-supply = <&scmi_reg18>; +- status = "disabled"; +- +- usbphyc_port0: usb-phy@0 { +- #phy-cells = <0>; +- reg = <0>; +- }; +- +- usbphyc_port1: usb-phy@1 { +- #phy-cells = <1>; +- reg = <1>; +- }; +- }; +- + rtc: rtc@5c004000 { + compatible = "st,stm32mp1-rtc"; + reg = <0x5c004000 0x400>; +@@ -1374,6 +885,529 @@ + }; + }; + ++ etzpc: bus@5c007000 { ++ compatible = "simple-bus"; ++ reg = <0x5c007000 0x400>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ranges; ++ ++ adc_2: adc@48004000 { ++ compatible = "st,stm32mp13-adc-core"; ++ reg = <0x48004000 0x400>; ++ interrupts = ; ++ clocks = <&rcc ADC2>, <&rcc ADC2_K>; ++ clock-names = "bus", "adc"; ++ interrupt-controller; ++ #interrupt-cells = <1>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ ++ adc2: adc@0 { ++ compatible = "st,stm32mp13-adc"; ++ #io-channel-cells = <1>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <0x0>; ++ interrupt-parent = <&adc_2>; ++ interrupts = <0>; ++ dmas = <&dmamux1 10 0x400 0x80000001>; ++ dma-names = "rx"; ++ status = "disabled"; ++ ++ channel@13 { ++ reg = <13>; ++ label = "vrefint"; ++ }; ++ channel@14 { ++ reg = <14>; ++ label = "vddcore"; ++ }; ++ channel@16 { ++ reg = <16>; ++ label = "vddcpu"; ++ }; ++ channel@17 { ++ reg = <17>; ++ label = "vddq_ddr"; ++ }; ++ }; ++ }; ++ ++ usbotg_hs: usb@49000000 { ++ compatible = "st,stm32mp15-hsotg", "snps,dwc2"; ++ reg = <0x49000000 0x40000>; ++ clocks = <&rcc USBO_K>; ++ clock-names = "otg"; ++ resets = <&rcc USBO_R>; ++ reset-names = "dwc2"; ++ interrupts = ; ++ g-rx-fifo-size = <512>; ++ g-np-tx-fifo-size = <32>; ++ g-tx-fifo-size = <256 16 16 16 16 16 16 16>; ++ dr_mode = "otg"; ++ otg-rev = <0x200>; ++ usb33d-supply = <&scmi_usb33>; ++ status = "disabled"; ++ }; ++ ++ usart1: serial@4c000000 { ++ compatible = "st,stm32h7-uart"; ++ reg = <0x4c000000 0x400>; ++ interrupts-extended = <&exti 26 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&rcc USART1_K>; ++ resets = <&rcc USART1_R>; ++ wakeup-source; ++ dmas = <&dmamux1 41 0x400 0x5>, ++ <&dmamux1 42 0x400 0x1>; ++ dma-names = "rx", "tx"; ++ status = "disabled"; ++ }; ++ ++ usart2: serial@4c001000 { ++ compatible = "st,stm32h7-uart"; ++ reg = <0x4c001000 0x400>; ++ interrupts-extended = <&exti 27 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&rcc USART2_K>; ++ resets = <&rcc USART2_R>; ++ wakeup-source; ++ dmas = <&dmamux1 43 0x400 0x5>, ++ <&dmamux1 44 0x400 0x1>; ++ dma-names = "rx", "tx"; ++ status = "disabled"; ++ }; ++ ++ i2s4: audio-controller@4c002000 { ++ compatible = "st,stm32h7-i2s"; ++ reg = <0x4c002000 0x400>; ++ #sound-dai-cells = <0>; ++ interrupts = ; ++ dmas = <&dmamux1 83 0x400 0x01>, ++ <&dmamux1 84 0x400 0x01>; ++ dma-names = "rx", "tx"; ++ status = "disabled"; ++ }; ++ ++ spi4: spi@4c002000 { ++ compatible = "st,stm32h7-spi"; ++ reg = <0x4c002000 0x400>; ++ interrupts = ; ++ clocks = <&rcc SPI4_K>; ++ resets = <&rcc SPI4_R>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ dmas = <&dmamux1 83 0x400 0x01>, ++ <&dmamux1 84 0x400 0x01>; ++ dma-names = "rx", "tx"; ++ status = "disabled"; ++ }; ++ ++ spi5: spi@4c003000 { ++ compatible = "st,stm32h7-spi"; ++ reg = <0x4c003000 0x400>; ++ interrupts = ; ++ clocks = <&rcc SPI5_K>; ++ resets = <&rcc SPI5_R>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ dmas = <&dmamux1 85 0x400 0x01>, ++ <&dmamux1 86 0x400 0x01>; ++ dma-names = "rx", "tx"; ++ status = "disabled"; ++ }; ++ ++ i2c3: i2c@4c004000 { ++ compatible = "st,stm32mp13-i2c"; ++ reg = <0x4c004000 0x400>; ++ interrupt-names = "event", "error"; ++ interrupts = , ++ ; ++ clocks = <&rcc I2C3_K>; ++ resets = <&rcc I2C3_R>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ dmas = <&dmamux1 73 0x400 0x1>, ++ <&dmamux1 74 0x400 0x1>; ++ dma-names = "rx", "tx"; ++ st,syscfg-fmp = <&syscfg 0x4 0x4>; ++ i2c-analog-filter; ++ status = "disabled"; ++ }; ++ ++ i2c4: i2c@4c005000 { ++ compatible = "st,stm32mp13-i2c"; ++ reg = <0x4c005000 0x400>; ++ interrupt-names = "event", "error"; ++ interrupts = , ++ ; ++ clocks = <&rcc I2C4_K>; ++ resets = <&rcc I2C4_R>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ dmas = <&dmamux1 75 0x400 0x1>, ++ <&dmamux1 76 0x400 0x1>; ++ dma-names = "rx", "tx"; ++ st,syscfg-fmp = <&syscfg 0x4 0x8>; ++ i2c-analog-filter; ++ status = "disabled"; ++ }; ++ ++ i2c5: i2c@4c006000 { ++ compatible = "st,stm32mp13-i2c"; ++ reg = <0x4c006000 0x400>; ++ interrupt-names = "event", "error"; ++ interrupts = , ++ ; ++ clocks = <&rcc I2C5_K>; ++ resets = <&rcc I2C5_R>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ dmas = <&dmamux1 115 0x400 0x1>, ++ <&dmamux1 116 0x400 0x1>; ++ dma-names = "rx", "tx"; ++ st,syscfg-fmp = <&syscfg 0x4 0x10>; ++ i2c-analog-filter; ++ status = "disabled"; ++ }; ++ ++ timers12: timer@4c007000 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ compatible = "st,stm32-timers"; ++ reg = <0x4c007000 0x400>; ++ interrupts = ; ++ interrupt-names = "global"; ++ clocks = <&rcc TIM12_K>; ++ clock-names = "int"; ++ status = "disabled"; ++ ++ pwm { ++ compatible = "st,stm32-pwm"; ++ #pwm-cells = <3>; ++ status = "disabled"; ++ }; ++ ++ timer@11 { ++ compatible = "st,stm32h7-timer-trigger"; ++ reg = <11>; ++ status = "disabled"; ++ }; ++ }; ++ ++ timers13: timer@4c008000 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ compatible = "st,stm32-timers"; ++ reg = <0x4c008000 0x400>; ++ interrupts = ; ++ interrupt-names = "global"; ++ clocks = <&rcc TIM13_K>; ++ clock-names = "int"; ++ status = "disabled"; ++ ++ pwm { ++ compatible = "st,stm32-pwm"; ++ #pwm-cells = <3>; ++ status = "disabled"; ++ }; ++ ++ timer@12 { ++ compatible = "st,stm32h7-timer-trigger"; ++ reg = <12>; ++ status = "disabled"; ++ }; ++ }; ++ ++ timers14: timer@4c009000 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ compatible = "st,stm32-timers"; ++ reg = <0x4c009000 0x400>; ++ interrupts = ; ++ interrupt-names = "global"; ++ clocks = <&rcc TIM14_K>; ++ clock-names = "int"; ++ status = "disabled"; ++ ++ pwm { ++ compatible = "st,stm32-pwm"; ++ #pwm-cells = <3>; ++ status = "disabled"; ++ }; ++ ++ timer@13 { ++ compatible = "st,stm32h7-timer-trigger"; ++ reg = <13>; ++ status = "disabled"; ++ }; ++ }; ++ ++ timers15: timer@4c00a000 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ compatible = "st,stm32-timers"; ++ reg = <0x4c00a000 0x400>; ++ interrupts = ; ++ interrupt-names = "global"; ++ clocks = <&rcc TIM15_K>; ++ clock-names = "int"; ++ dmas = <&dmamux1 105 0x400 0x1>, ++ <&dmamux1 106 0x400 0x1>, ++ <&dmamux1 107 0x400 0x1>, ++ <&dmamux1 108 0x400 0x1>; ++ dma-names = "ch1", "up", "trig", "com"; ++ status = "disabled"; ++ ++ pwm { ++ compatible = "st,stm32-pwm"; ++ #pwm-cells = <3>; ++ status = "disabled"; ++ }; ++ ++ timer@14 { ++ compatible = "st,stm32h7-timer-trigger"; ++ reg = <14>; ++ status = "disabled"; ++ }; ++ }; ++ ++ timers16: timer@4c00b000 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ compatible = "st,stm32-timers"; ++ reg = <0x4c00b000 0x400>; ++ interrupts = ; ++ interrupt-names = "global"; ++ clocks = <&rcc TIM16_K>; ++ clock-names = "int"; ++ dmas = <&dmamux1 109 0x400 0x1>, ++ <&dmamux1 110 0x400 0x1>; ++ dma-names = "ch1", "up"; ++ status = "disabled"; ++ ++ pwm { ++ compatible = "st,stm32-pwm"; ++ #pwm-cells = <3>; ++ status = "disabled"; ++ }; ++ ++ timer@15 { ++ compatible = "st,stm32h7-timer-trigger"; ++ reg = <15>; ++ status = "disabled"; ++ }; ++ }; ++ ++ timers17: timer@4c00c000 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ compatible = "st,stm32-timers"; ++ reg = <0x4c00c000 0x400>; ++ interrupts = ; ++ interrupt-names = "global"; ++ clocks = <&rcc TIM17_K>; ++ clock-names = "int"; ++ dmas = <&dmamux1 111 0x400 0x1>, ++ <&dmamux1 112 0x400 0x1>; ++ dma-names = "ch1", "up"; ++ status = "disabled"; ++ ++ pwm { ++ compatible = "st,stm32-pwm"; ++ #pwm-cells = <3>; ++ status = "disabled"; ++ }; ++ ++ timer@16 { ++ compatible = "st,stm32h7-timer-trigger"; ++ reg = <16>; ++ status = "disabled"; ++ }; ++ }; ++ ++ lptimer2: timer@50021000 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ compatible = "st,stm32-lptimer"; ++ reg = <0x50021000 0x400>; ++ interrupts-extended = <&exti 48 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&rcc LPTIM2_K>; ++ clock-names = "mux"; ++ wakeup-source; ++ status = "disabled"; ++ ++ pwm { ++ compatible = "st,stm32-pwm-lp"; ++ #pwm-cells = <3>; ++ status = "disabled"; ++ }; ++ ++ trigger@1 { ++ compatible = "st,stm32-lptimer-trigger"; ++ reg = <1>; ++ status = "disabled"; ++ }; ++ ++ counter { ++ compatible = "st,stm32-lptimer-counter"; ++ status = "disabled"; ++ }; ++ ++ timer { ++ compatible = "st,stm32-lptimer-timer"; ++ status = "disabled"; ++ }; ++ }; ++ ++ lptimer3: timer@50022000 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ compatible = "st,stm32-lptimer"; ++ reg = <0x50022000 0x400>; ++ interrupts-extended = <&exti 50 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&rcc LPTIM3_K>; ++ clock-names = "mux"; ++ wakeup-source; ++ status = "disabled"; ++ ++ pwm { ++ compatible = "st,stm32-pwm-lp"; ++ #pwm-cells = <3>; ++ status = "disabled"; ++ }; ++ ++ trigger@2 { ++ compatible = "st,stm32-lptimer-trigger"; ++ reg = <2>; ++ status = "disabled"; ++ }; ++ ++ timer { ++ compatible = "st,stm32-lptimer-timer"; ++ status = "disabled"; ++ }; ++ }; ++ ++ hash: hash@54003000 { ++ compatible = "st,stm32mp13-hash"; ++ reg = <0x54003000 0x400>; ++ interrupts = ; ++ clocks = <&rcc HASH1>; ++ resets = <&rcc HASH1_R>; ++ dmas = <&mdma 30 0x2 0x1000a02 0x0 0x0>; ++ dma-names = "in"; ++ status = "disabled"; ++ }; ++ ++ rng: rng@54004000 { ++ compatible = "st,stm32mp13-rng"; ++ reg = <0x54004000 0x400>; ++ clocks = <&rcc RNG1_K>; ++ resets = <&rcc RNG1_R>; ++ status = "disabled"; ++ }; ++ ++ fmc: memory-controller@58002000 { ++ compatible = "st,stm32mp1-fmc2-ebi"; ++ reg = <0x58002000 0x1000>; ++ ranges = <0 0 0x60000000 0x04000000>, /* EBI CS 1 */ ++ <1 0 0x64000000 0x04000000>, /* EBI CS 2 */ ++ <2 0 0x68000000 0x04000000>, /* EBI CS 3 */ ++ <3 0 0x6c000000 0x04000000>, /* EBI CS 4 */ ++ <4 0 0x80000000 0x10000000>; /* NAND */ ++ #address-cells = <2>; ++ #size-cells = <1>; ++ clocks = <&rcc FMC_K>; ++ resets = <&rcc FMC_R>; ++ status = "disabled"; ++ ++ nand-controller@4,0 { ++ compatible = "st,stm32mp1-fmc2-nfc"; ++ reg = <4 0x00000000 0x1000>, ++ <4 0x08010000 0x1000>, ++ <4 0x08020000 0x1000>, ++ <4 0x01000000 0x1000>, ++ <4 0x09010000 0x1000>, ++ <4 0x09020000 0x1000>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ interrupts = ; ++ dmas = <&mdma 24 0x2 0x12000a02 0x0 0x0>, ++ <&mdma 24 0x2 0x12000a08 0x0 0x0>, ++ <&mdma 25 0x2 0x12000a0a 0x0 0x0>; ++ dma-names = "tx", "rx", "ecc"; ++ status = "disabled"; ++ }; ++ }; ++ ++ qspi: spi@58003000 { ++ compatible = "st,stm32f469-qspi"; ++ reg = <0x58003000 0x1000>, <0x70000000 0x10000000>; ++ reg-names = "qspi", "qspi_mm"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ interrupts = ; ++ dmas = <&mdma 26 0x2 0x10100002 0x0 0x0>, ++ <&mdma 26 0x2 0x10100008 0x0 0x0>; ++ dma-names = "tx", "rx"; ++ clocks = <&rcc QSPI_K>; ++ resets = <&rcc QSPI_R>; ++ status = "disabled"; ++ }; ++ ++ sdmmc1: mmc@58005000 { ++ compatible = "st,stm32-sdmmc2", "arm,pl18x", "arm,primecell"; ++ arm,primecell-periphid = <0x20253180>; ++ reg = <0x58005000 0x1000>, <0x58006000 0x1000>; ++ interrupts = ; ++ clocks = <&rcc SDMMC1_K>; ++ clock-names = "apb_pclk"; ++ resets = <&rcc SDMMC1_R>; ++ cap-sd-highspeed; ++ cap-mmc-highspeed; ++ max-frequency = <130000000>; ++ status = "disabled"; ++ }; ++ ++ sdmmc2: mmc@58007000 { ++ compatible = "st,stm32-sdmmc2", "arm,pl18x", "arm,primecell"; ++ arm,primecell-periphid = <0x20253180>; ++ reg = <0x58007000 0x1000>, <0x58008000 0x1000>; ++ interrupts = ; ++ clocks = <&rcc SDMMC2_K>; ++ clock-names = "apb_pclk"; ++ resets = <&rcc SDMMC2_R>; ++ cap-sd-highspeed; ++ cap-mmc-highspeed; ++ max-frequency = <130000000>; ++ status = "disabled"; ++ }; ++ ++ usbphyc: usbphyc@5a006000 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ #clock-cells = <0>; ++ compatible = "st,stm32mp1-usbphyc"; ++ reg = <0x5a006000 0x1000>; ++ clocks = <&rcc USBPHY_K>; ++ resets = <&rcc USBPHY_R>; ++ vdda1v1-supply = <&scmi_reg11>; ++ vdda1v8-supply = <&scmi_reg18>; ++ status = "disabled"; ++ ++ usbphyc_port0: usb-phy@0 { ++ #phy-cells = <0>; ++ reg = <0>; ++ }; ++ ++ usbphyc_port1: usb-phy@1 { ++ #phy-cells = <1>; ++ reg = <1>; ++ }; ++ }; ++ }; ++ + /* + * Break node order to solve dependency probe issue between + * pinctrl and exti. +--- a/arch/arm/boot/dts/st/stm32mp133.dtsi ++++ b/arch/arm/boot/dts/st/stm32mp133.dtsi +@@ -33,35 +33,37 @@ + bosch,mram-cfg = <0x1400 0 0 32 0 0 2 2>; + status = "disabled"; + }; ++ }; ++}; ++ ++&etzpc { ++ adc_1: adc@48003000 { ++ compatible = "st,stm32mp13-adc-core"; ++ reg = <0x48003000 0x400>; ++ interrupts = ; ++ clocks = <&rcc ADC1>, <&rcc ADC1_K>; ++ clock-names = "bus", "adc"; ++ interrupt-controller; ++ #interrupt-cells = <1>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; + +- adc_1: adc@48003000 { +- compatible = "st,stm32mp13-adc-core"; +- reg = <0x48003000 0x400>; +- interrupts = ; +- clocks = <&rcc ADC1>, <&rcc ADC1_K>; +- clock-names = "bus", "adc"; +- interrupt-controller; +- #interrupt-cells = <1>; ++ adc1: adc@0 { ++ compatible = "st,stm32mp13-adc"; ++ #io-channel-cells = <1>; + #address-cells = <1>; + #size-cells = <0>; ++ reg = <0x0>; ++ interrupt-parent = <&adc_1>; ++ interrupts = <0>; ++ dmas = <&dmamux1 9 0x400 0x80000001>; ++ dma-names = "rx"; + status = "disabled"; + +- adc1: adc@0 { +- compatible = "st,stm32mp13-adc"; +- #io-channel-cells = <1>; +- #address-cells = <1>; +- #size-cells = <0>; +- reg = <0x0>; +- interrupt-parent = <&adc_1>; +- interrupts = <0>; +- dmas = <&dmamux1 9 0x400 0x80000001>; +- dma-names = "rx"; +- status = "disabled"; +- +- channel@18 { +- reg = <18>; +- label = "vrefint"; +- }; ++ channel@18 { ++ reg = <18>; ++ label = "vrefint"; + }; + }; + }; +--- a/arch/arm/boot/dts/st/stm32mp13xc.dtsi ++++ b/arch/arm/boot/dts/st/stm32mp13xc.dtsi +@@ -4,15 +4,13 @@ + * Author: Alexandre Torgue for STMicroelectronics. + */ + +-/ { +- soc { +- cryp: crypto@54002000 { +- compatible = "st,stm32mp1-cryp"; +- reg = <0x54002000 0x400>; +- interrupts = ; +- clocks = <&rcc CRYP1>; +- resets = <&rcc CRYP1_R>; +- status = "disabled"; +- }; ++&etzpc { ++ cryp: crypto@54002000 { ++ compatible = "st,stm32mp1-cryp"; ++ reg = <0x54002000 0x400>; ++ interrupts = ; ++ clocks = <&rcc CRYP1>; ++ resets = <&rcc CRYP1_R>; ++ status = "disabled"; + }; + }; +--- a/arch/arm/boot/dts/st/stm32mp13xf.dtsi ++++ b/arch/arm/boot/dts/st/stm32mp13xf.dtsi +@@ -4,15 +4,13 @@ + * Author: Alexandre Torgue for STMicroelectronics. + */ + +-/ { +- soc { +- cryp: crypto@54002000 { +- compatible = "st,stm32mp1-cryp"; +- reg = <0x54002000 0x400>; +- interrupts = ; +- clocks = <&rcc CRYP1>; +- resets = <&rcc CRYP1_R>; +- status = "disabled"; +- }; ++&etzpc { ++ cryp: crypto@54002000 { ++ compatible = "st,stm32mp1-cryp"; ++ reg = <0x54002000 0x400>; ++ interrupts = ; ++ clocks = <&rcc CRYP1>; ++ resets = <&rcc CRYP1_R>; ++ status = "disabled"; + }; + }; diff --git a/target/linux/stm32/patches-6.6/010-ARM-dts-stm32-put-ETZPC-as-an-access-controller-for-.patch b/target/linux/stm32/patches-6.6/010-ARM-dts-stm32-put-ETZPC-as-an-access-controller-for-.patch new file mode 100644 index 00000000000000..e6a4eee0571b23 --- /dev/null +++ b/target/linux/stm32/patches-6.6/010-ARM-dts-stm32-put-ETZPC-as-an-access-controller-for-.patch @@ -0,0 +1,265 @@ +From 21ca3d7c59595d76237faebeff4f6a979cf7ae82 Mon Sep 17 00:00:00 2001 +From: Alexandre Torgue +Date: Fri, 5 Apr 2024 13:45:24 +0200 +Subject: [PATCH 2/5] ARM: dts: stm32: put ETZPC as an access controller for + STM32MP13x boards + +Reference ETZPC as an access-control-provider. + +For more information on which peripheral is securable or supports MCU +isolation, please read the STM32MP13 reference manual + +Signed-off-by: Gatien Chevallier +Signed-off-by: Alexandre Torgue +--- + arch/arm/boot/dts/st/stm32mp131.dtsi | 28 ++++++++++++++++++++++++++- + arch/arm/boot/dts/st/stm32mp133.dtsi | 1 + + arch/arm/boot/dts/st/stm32mp13xc.dtsi | 1 + + arch/arm/boot/dts/st/stm32mp13xf.dtsi | 1 + + 4 files changed, 30 insertions(+), 1 deletion(-) + +--- a/arch/arm/boot/dts/st/stm32mp131.dtsi ++++ b/arch/arm/boot/dts/st/stm32mp131.dtsi +@@ -886,10 +886,11 @@ + }; + + etzpc: bus@5c007000 { +- compatible = "simple-bus"; ++ compatible = "st,stm32-etzpc", "simple-bus"; + reg = <0x5c007000 0x400>; + #address-cells = <1>; + #size-cells = <1>; ++ #access-controller-cells = <1>; + ranges; + + adc_2: adc@48004000 { +@@ -902,6 +903,7 @@ + #interrupt-cells = <1>; + #address-cells = <1>; + #size-cells = <0>; ++ access-controllers = <&etzpc 33>; + status = "disabled"; + + adc2: adc@0 { +@@ -949,6 +951,7 @@ + dr_mode = "otg"; + otg-rev = <0x200>; + usb33d-supply = <&scmi_usb33>; ++ access-controllers = <&etzpc 34>; + status = "disabled"; + }; + +@@ -962,6 +965,7 @@ + dmas = <&dmamux1 41 0x400 0x5>, + <&dmamux1 42 0x400 0x1>; + dma-names = "rx", "tx"; ++ access-controllers = <&etzpc 16>; + status = "disabled"; + }; + +@@ -975,6 +979,7 @@ + dmas = <&dmamux1 43 0x400 0x5>, + <&dmamux1 44 0x400 0x1>; + dma-names = "rx", "tx"; ++ access-controllers = <&etzpc 17>; + status = "disabled"; + }; + +@@ -986,6 +991,7 @@ + dmas = <&dmamux1 83 0x400 0x01>, + <&dmamux1 84 0x400 0x01>; + dma-names = "rx", "tx"; ++ access-controllers = <&etzpc 13>; + status = "disabled"; + }; + +@@ -1000,6 +1006,7 @@ + dmas = <&dmamux1 83 0x400 0x01>, + <&dmamux1 84 0x400 0x01>; + dma-names = "rx", "tx"; ++ access-controllers = <&etzpc 18>; + status = "disabled"; + }; + +@@ -1014,6 +1021,7 @@ + dmas = <&dmamux1 85 0x400 0x01>, + <&dmamux1 86 0x400 0x01>; + dma-names = "rx", "tx"; ++ access-controllers = <&etzpc 19>; + status = "disabled"; + }; + +@@ -1032,6 +1040,7 @@ + dma-names = "rx", "tx"; + st,syscfg-fmp = <&syscfg 0x4 0x4>; + i2c-analog-filter; ++ access-controllers = <&etzpc 20>; + status = "disabled"; + }; + +@@ -1050,6 +1059,7 @@ + dma-names = "rx", "tx"; + st,syscfg-fmp = <&syscfg 0x4 0x8>; + i2c-analog-filter; ++ access-controllers = <&etzpc 21>; + status = "disabled"; + }; + +@@ -1068,6 +1078,7 @@ + dma-names = "rx", "tx"; + st,syscfg-fmp = <&syscfg 0x4 0x10>; + i2c-analog-filter; ++ access-controllers = <&etzpc 22>; + status = "disabled"; + }; + +@@ -1080,6 +1091,7 @@ + interrupt-names = "global"; + clocks = <&rcc TIM12_K>; + clock-names = "int"; ++ access-controllers = <&etzpc 23>; + status = "disabled"; + + pwm { +@@ -1104,6 +1116,7 @@ + interrupt-names = "global"; + clocks = <&rcc TIM13_K>; + clock-names = "int"; ++ access-controllers = <&etzpc 24>; + status = "disabled"; + + pwm { +@@ -1128,6 +1141,7 @@ + interrupt-names = "global"; + clocks = <&rcc TIM14_K>; + clock-names = "int"; ++ access-controllers = <&etzpc 25>; + status = "disabled"; + + pwm { +@@ -1157,6 +1171,7 @@ + <&dmamux1 107 0x400 0x1>, + <&dmamux1 108 0x400 0x1>; + dma-names = "ch1", "up", "trig", "com"; ++ access-controllers = <&etzpc 26>; + status = "disabled"; + + pwm { +@@ -1184,6 +1199,7 @@ + dmas = <&dmamux1 109 0x400 0x1>, + <&dmamux1 110 0x400 0x1>; + dma-names = "ch1", "up"; ++ access-controllers = <&etzpc 27>; + status = "disabled"; + + pwm { +@@ -1211,6 +1227,7 @@ + dmas = <&dmamux1 111 0x400 0x1>, + <&dmamux1 112 0x400 0x1>; + dma-names = "ch1", "up"; ++ access-controllers = <&etzpc 28>; + status = "disabled"; + + pwm { +@@ -1235,6 +1252,7 @@ + clocks = <&rcc LPTIM2_K>; + clock-names = "mux"; + wakeup-source; ++ access-controllers = <&etzpc 1>; + status = "disabled"; + + pwm { +@@ -1269,6 +1287,7 @@ + clocks = <&rcc LPTIM3_K>; + clock-names = "mux"; + wakeup-source; ++ access-controllers = <&etzpc 2>; + status = "disabled"; + + pwm { +@@ -1297,6 +1316,7 @@ + resets = <&rcc HASH1_R>; + dmas = <&mdma 30 0x2 0x1000a02 0x0 0x0>; + dma-names = "in"; ++ access-controllers = <&etzpc 41>; + status = "disabled"; + }; + +@@ -1305,6 +1325,7 @@ + reg = <0x54004000 0x400>; + clocks = <&rcc RNG1_K>; + resets = <&rcc RNG1_R>; ++ access-controllers = <&etzpc 40>; + status = "disabled"; + }; + +@@ -1320,6 +1341,7 @@ + #size-cells = <1>; + clocks = <&rcc FMC_K>; + resets = <&rcc FMC_R>; ++ access-controllers = <&etzpc 54>; + status = "disabled"; + + nand-controller@4,0 { +@@ -1353,6 +1375,7 @@ + dma-names = "tx", "rx"; + clocks = <&rcc QSPI_K>; + resets = <&rcc QSPI_R>; ++ access-controllers = <&etzpc 55>; + status = "disabled"; + }; + +@@ -1367,6 +1390,7 @@ + cap-sd-highspeed; + cap-mmc-highspeed; + max-frequency = <130000000>; ++ access-controllers = <&etzpc 50>; + status = "disabled"; + }; + +@@ -1381,6 +1405,7 @@ + cap-sd-highspeed; + cap-mmc-highspeed; + max-frequency = <130000000>; ++ access-controllers = <&etzpc 51>; + status = "disabled"; + }; + +@@ -1394,6 +1419,7 @@ + resets = <&rcc USBPHY_R>; + vdda1v1-supply = <&scmi_reg11>; + vdda1v8-supply = <&scmi_reg18>; ++ access-controllers = <&etzpc 5>; + status = "disabled"; + + usbphyc_port0: usb-phy@0 { +--- a/arch/arm/boot/dts/st/stm32mp133.dtsi ++++ b/arch/arm/boot/dts/st/stm32mp133.dtsi +@@ -47,6 +47,7 @@ + #interrupt-cells = <1>; + #address-cells = <1>; + #size-cells = <0>; ++ access-controllers = <&etzpc 32>; + status = "disabled"; + + adc1: adc@0 { +--- a/arch/arm/boot/dts/st/stm32mp13xc.dtsi ++++ b/arch/arm/boot/dts/st/stm32mp13xc.dtsi +@@ -11,6 +11,7 @@ + interrupts = ; + clocks = <&rcc CRYP1>; + resets = <&rcc CRYP1_R>; ++ access-controllers = <&etzpc 42>; + status = "disabled"; + }; + }; +--- a/arch/arm/boot/dts/st/stm32mp13xf.dtsi ++++ b/arch/arm/boot/dts/st/stm32mp13xf.dtsi +@@ -11,6 +11,7 @@ + interrupts = ; + clocks = <&rcc CRYP1>; + resets = <&rcc CRYP1_R>; ++ access-controllers = <&etzpc 42>; + status = "disabled"; + }; + }; diff --git a/target/linux/stm32/patches-6.6/011-ARM-dts-stm32-add-ethernet1-2-RMII-pins-for-STM32MP1.patch b/target/linux/stm32/patches-6.6/011-ARM-dts-stm32-add-ethernet1-2-RMII-pins-for-STM32MP1.patch new file mode 100644 index 00000000000000..123bde88417e28 --- /dev/null +++ b/target/linux/stm32/patches-6.6/011-ARM-dts-stm32-add-ethernet1-2-RMII-pins-for-STM32MP1.patch @@ -0,0 +1,126 @@ +From b1468a44e0c0f43a06e027efeff4183b3aee0cf7 Mon Sep 17 00:00:00 2001 +From: Christophe Roullier +Date: Mon, 10 Jun 2024 10:03:08 +0200 +Subject: [PATCH 3/5] ARM: dts: stm32: add ethernet1/2 RMII pins for + STM32MP13F-DK board + +Those pins are used for Ethernet 1 and 2 on STM32MP13F-DK board. +ethernet1: RMII with crystal. +ethernet2: RMII without crystal. +Add analog gpio pin configuration ("sleep") to manage power mode on +stm32mp13. + +Signed-off-by: Christophe Roullier +Reviewed-by: Marek Vasut +Signed-off-by: Alexandre Torgue +--- + arch/arm/boot/dts/st/stm32mp13-pinctrl.dtsi | 98 +++++++++++++++++++++ + 1 file changed, 98 insertions(+) + +--- a/arch/arm/boot/dts/st/stm32mp13-pinctrl.dtsi ++++ b/arch/arm/boot/dts/st/stm32mp13-pinctrl.dtsi +@@ -13,6 +13,104 @@ + }; + }; + ++ eth1_rgmii_pins_a: eth1-rgmii-0 { ++ pins1 { ++ pinmux = , /* ETH_RGMII_TXD0 */ ++ , /* ETH_RGMII_TXD1 */ ++ , /* ETH_RGMII_TXD2 */ ++ , /* ETH_RGMII_TXD3 */ ++ , /* ETH_RGMII_TX_CTL */ ++ , /* ETH_RGMII_GTX_CLK */ ++ , /* ETH_MDIO */ ++ ; /* ETH_MDC */ ++ bias-disable; ++ drive-push-pull; ++ slew-rate = <2>; ++ }; ++ ++ pins2 { ++ pinmux = , /* ETH_RGMII_RXD0 */ ++ , /* ETH_RGMII_RXD1 */ ++ , /* ETH_RGMII_RXD2 */ ++ , /* ETH_RGMII_RXD3 */ ++ , /* ETH_RGMII_RX_CTL */ ++ ; /* ETH_RGMII_RX_CLK */ ++ bias-disable; ++ }; ++ ++ }; ++ ++ eth1_rmii_pins_a: eth1-rmii-0 { ++ pins1 { ++ pinmux = , /* ETH_RMII_TXD0 */ ++ , /* ETH_RMII_TXD1 */ ++ , /* ETH_RMII_TX_EN */ ++ , /* ETH_RMII_REF_CLK */ ++ , /* ETH_MDIO */ ++ ; /* ETH_MDC */ ++ bias-disable; ++ drive-push-pull; ++ slew-rate = <1>; ++ }; ++ ++ pins2 { ++ pinmux = , /* ETH_RMII_RXD0 */ ++ , /* ETH_RMII_RXD1 */ ++ ; /* ETH_RMII_CRS_DV */ ++ bias-disable; ++ }; ++ ++ }; ++ ++ eth1_rmii_sleep_pins_a: eth1-rmii-sleep-0 { ++ pins1 { ++ pinmux = , /* ETH_RMII_TXD0 */ ++ , /* ETH_RMII_TXD1 */ ++ , /* ETH_RMII_TX_EN */ ++ , /* ETH_RMII_REF_CLK */ ++ , /* ETH_MDIO */ ++ , /* ETH_MDC */ ++ , /* ETH_RMII_RXD0 */ ++ , /* ETH_RMII_RXD1 */ ++ ; /* ETH_RMII_CRS_DV */ ++ }; ++ }; ++ ++ eth2_rmii_pins_a: eth2-rmii-0 { ++ pins1 { ++ pinmux = , /* ETH_RMII_TXD0 */ ++ , /* ETH_RMII_TXD1 */ ++ , /* ETH_RMII_ETHCK */ ++ , /* ETH_RMII_TX_EN */ ++ , /* ETH_MDIO */ ++ ; /* ETH_MDC */ ++ bias-disable; ++ drive-push-pull; ++ slew-rate = <1>; ++ }; ++ ++ pins2 { ++ pinmux = , /* ETH_RMII_RXD0 */ ++ , /* ETH_RMII_RXD1 */ ++ ; /* ETH_RMII_CRS_DV */ ++ bias-disable; ++ }; ++ }; ++ ++ eth2_rmii_sleep_pins_a: eth2-rmii-sleep-0 { ++ pins1 { ++ pinmux = , /* ETH_RMII_TXD0 */ ++ , /* ETH_RMII_TXD1 */ ++ , /* ETH_RMII_ETHCK */ ++ , /* ETH_RMII_TX_EN */ ++ , /* ETH_MDIO */ ++ , /* ETH_MDC */ ++ , /* ETH_RMII_RXD0 */ ++ , /* ETH_RMII_RXD1 */ ++ ; /* ETH_RMII_CRS_DV */ ++ }; ++ }; ++ + i2c1_pins_a: i2c1-0 { + pins { + pinmux = , /* I2C1_SCL */ diff --git a/target/linux/stm32/patches-6.6/012-ARM-dts-stm32-add-ethernet1-and-ethernet2-support-on.patch b/target/linux/stm32/patches-6.6/012-ARM-dts-stm32-add-ethernet1-and-ethernet2-support-on.patch new file mode 100644 index 00000000000000..947b1413244e33 --- /dev/null +++ b/target/linux/stm32/patches-6.6/012-ARM-dts-stm32-add-ethernet1-and-ethernet2-support-on.patch @@ -0,0 +1,108 @@ +From fcf6ca2da4650d0a7a9cd62c8c72341860931159 Mon Sep 17 00:00:00 2001 +From: Christophe Roullier +Date: Mon, 10 Jun 2024 10:03:07 +0200 +Subject: [PATCH 4/5] ARM: dts: stm32: add ethernet1 and ethernet2 support on + stm32mp13 + +Both instances ethernet based on GMAC SNPS IP on stm32mp13. +GMAC IP version is SNPS 4.20. + +Signed-off-by: Christophe Roullier +Signed-off-by: Alexandre Torgue +--- + arch/arm/boot/dts/st/stm32mp131.dtsi | 38 ++++++++++++++++++++++++++++ + arch/arm/boot/dts/st/stm32mp133.dtsi | 31 +++++++++++++++++++++++ + 2 files changed, 69 insertions(+) + +--- a/arch/arm/boot/dts/st/stm32mp131.dtsi ++++ b/arch/arm/boot/dts/st/stm32mp131.dtsi +@@ -883,6 +883,12 @@ + ts_cal2: calib@5e { + reg = <0x5e 0x2>; + }; ++ ethernet_mac1_address: mac1@e4 { ++ reg = <0xe4 0x6>; ++ }; ++ ethernet_mac2_address: mac2@ea { ++ reg = <0xea 0x6>; ++ }; + }; + + etzpc: bus@5c007000 { +@@ -1409,6 +1415,38 @@ + status = "disabled"; + }; + ++ ethernet1: ethernet@5800a000 { ++ compatible = "st,stm32mp13-dwmac", "snps,dwmac-4.20a"; ++ reg = <0x5800a000 0x2000>; ++ reg-names = "stmmaceth"; ++ interrupts-extended = <&intc GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>, ++ <&exti 68 1>; ++ interrupt-names = "macirq", "eth_wake_irq"; ++ clock-names = "stmmaceth", ++ "mac-clk-tx", ++ "mac-clk-rx", ++ "ethstp", ++ "eth-ck"; ++ clocks = <&rcc ETH1MAC>, ++ <&rcc ETH1TX>, ++ <&rcc ETH1RX>, ++ <&rcc ETH1STP>, ++ <&rcc ETH1CK_K>; ++ st,syscon = <&syscfg 0x4 0xff0000>; ++ snps,mixed-burst; ++ snps,pbl = <2>; ++ snps,axi-config = <&stmmac_axi_config_1>; ++ snps,tso; ++ access-controllers = <&etzpc 48>; ++ status = "disabled"; ++ ++ stmmac_axi_config_1: stmmac-axi-config { ++ snps,blen = <0 0 0 0 16 8 4>; ++ snps,rd_osr_lmt = <0x7>; ++ snps,wr_osr_lmt = <0x7>; ++ }; ++ }; ++ + usbphyc: usbphyc@5a006000 { + #address-cells = <1>; + #size-cells = <0>; +--- a/arch/arm/boot/dts/st/stm32mp133.dtsi ++++ b/arch/arm/boot/dts/st/stm32mp133.dtsi +@@ -68,4 +68,35 @@ + }; + }; + }; ++ ++ ethernet2: ethernet@5800e000 { ++ compatible = "st,stm32mp13-dwmac", "snps,dwmac-4.20a"; ++ reg = <0x5800e000 0x2000>; ++ reg-names = "stmmaceth"; ++ interrupts-extended = <&intc GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>; ++ interrupt-names = "macirq"; ++ clock-names = "stmmaceth", ++ "mac-clk-tx", ++ "mac-clk-rx", ++ "ethstp", ++ "eth-ck"; ++ clocks = <&rcc ETH2MAC>, ++ <&rcc ETH2TX>, ++ <&rcc ETH2RX>, ++ <&rcc ETH2STP>, ++ <&rcc ETH2CK_K>; ++ st,syscon = <&syscfg 0x4 0xff000000>; ++ snps,mixed-burst; ++ snps,pbl = <2>; ++ snps,axi-config = <&stmmac_axi_config_2>; ++ snps,tso; ++ access-controllers = <&etzpc 49>; ++ status = "disabled"; ++ ++ stmmac_axi_config_2: stmmac-axi-config { ++ snps,blen = <0 0 0 0 16 8 4>; ++ snps,rd_osr_lmt = <0x7>; ++ snps,wr_osr_lmt = <0x7>; ++ }; ++ }; + }; diff --git a/target/linux/stm32/patches-6.6/013-ARM-dts-stm32-add-ethernet1-for-STM32MP135F-DK-board.patch b/target/linux/stm32/patches-6.6/013-ARM-dts-stm32-add-ethernet1-for-STM32MP135F-DK-board.patch new file mode 100644 index 00000000000000..79408c5badeb9d --- /dev/null +++ b/target/linux/stm32/patches-6.6/013-ARM-dts-stm32-add-ethernet1-for-STM32MP135F-DK-board.patch @@ -0,0 +1,58 @@ +From b255afeeb33efaa974b1b2454b1f58252d783b67 Mon Sep 17 00:00:00 2001 +From: Christophe Roullier +Date: Mon, 10 Jun 2024 10:03:09 +0200 +Subject: [PATCH 5/5] ARM: dts: stm32: add ethernet1 for STM32MP135F-DK board + +Ethernet1: RMII with crystal +Ethernet2: RMII with no cristal, need "phy-supply" property to work, +today this property was managed by Ethernet glue, but should be present +and managed in PHY node. So I will push second Ethernet in next step. + +PHYs used are SMSC (LAN8742A) + +Signed-off-by: Christophe Roullier +Reviewed-by: Marek Vasut +Signed-off-by: Alexandre Torgue +--- + arch/arm/boot/dts/st/stm32mp135f-dk.dts | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +--- a/arch/arm/boot/dts/st/stm32mp135f-dk.dts ++++ b/arch/arm/boot/dts/st/stm32mp135f-dk.dts +@@ -19,6 +19,7 @@ + compatible = "st,stm32mp135f-dk", "st,stm32mp135"; + + aliases { ++ ethernet0 = ðernet1; + serial0 = &uart4; + serial1 = &usart1; + serial2 = &uart8; +@@ -92,6 +93,28 @@ + }; + }; + }; ++ ++ðernet1 { ++ status = "okay"; ++ pinctrl-0 = <ð1_rmii_pins_a>; ++ pinctrl-1 = <ð1_rmii_sleep_pins_a>; ++ pinctrl-names = "default", "sleep"; ++ phy-mode = "rmii"; ++ phy-handle = <&phy0_eth1>; ++ ++ mdio { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ compatible = "snps,dwmac-mdio"; ++ ++ phy0_eth1: ethernet-phy@0 { ++ compatible = "ethernet-phy-id0007.c131"; ++ reg = <0>; ++ reset-gpios = <&mcp23017 9 GPIO_ACTIVE_LOW>; ++ wakeup-source; ++ }; ++ }; ++}; + + &i2c1 { + pinctrl-names = "default", "sleep"; diff --git a/target/linux/stm32/patches-6.6/020-mmc-mmci-stm32-add-SDIO-in-band-interrupt-mode.patch b/target/linux/stm32/patches-6.6/020-mmc-mmci-stm32-add-SDIO-in-band-interrupt-mode.patch new file mode 100644 index 00000000000000..235efb57168826 --- /dev/null +++ b/target/linux/stm32/patches-6.6/020-mmc-mmci-stm32-add-SDIO-in-band-interrupt-mode.patch @@ -0,0 +1,166 @@ +From 1bcfbfd7c9aa716f61a01682345a1b329f6a6e66 Mon Sep 17 00:00:00 2001 +From: Christophe Kerello +Date: Wed, 8 Nov 2023 15:16:37 +0100 +Subject: [PATCH] mmc: mmci: stm32: add SDIO in-band interrupt mode + +Add the support of SDIO in-band interrupt mode for STM32 and Ux500 +variants. +It allows the SD I/O card to interrupt the host on SDMMC_D1 data line. +It is not enabled by default on Ux500 variant as this is unstable and +Ux500 users should use out-of-band IRQs. + +Signed-off-by: Christophe Kerello +Signed-off-by: Yann Gautier +Reviewed-by: Linus Walleij +Link: https://lore.kernel.org/r/20231108141637.119497-1-yann.gautier@foss.st.com +Signed-off-by: Ulf Hansson +--- + drivers/mmc/host/mmci.c | 69 +++++++++++++++++++++++++++++++++++++++-- + drivers/mmc/host/mmci.h | 2 ++ + 2 files changed, 69 insertions(+), 2 deletions(-) + +--- a/drivers/mmc/host/mmci.c ++++ b/drivers/mmc/host/mmci.c +@@ -272,6 +272,7 @@ static struct variant_data variant_stm32 + .datactrl_mask_sdio = MCI_DPSM_ST_SDIOEN, + .stm32_idmabsize_mask = GENMASK(12, 5), + .stm32_idmabsize_align = BIT(5), ++ .supports_sdio_irq = true, + .busy_timeout = true, + .busy_detect = true, + .busy_detect_flag = MCI_STM32_BUSYD0, +@@ -299,6 +300,7 @@ static struct variant_data variant_stm32 + .datactrl_mask_sdio = MCI_DPSM_ST_SDIOEN, + .stm32_idmabsize_mask = GENMASK(16, 5), + .stm32_idmabsize_align = BIT(5), ++ .supports_sdio_irq = true, + .dma_lli = true, + .busy_timeout = true, + .busy_detect = true, +@@ -327,6 +329,7 @@ static struct variant_data variant_stm32 + .datactrl_mask_sdio = MCI_DPSM_ST_SDIOEN, + .stm32_idmabsize_mask = GENMASK(16, 6), + .stm32_idmabsize_align = BIT(6), ++ .supports_sdio_irq = true, + .dma_lli = true, + .busy_timeout = true, + .busy_detect = true, +@@ -420,8 +423,9 @@ void mmci_write_pwrreg(struct mmci_host + */ + static void mmci_write_datactrlreg(struct mmci_host *host, u32 datactrl) + { +- /* Keep busy mode in DPSM if enabled */ +- datactrl |= host->datactrl_reg & host->variant->busy_dpsm_flag; ++ /* Keep busy mode in DPSM and SDIO mask if enabled */ ++ datactrl |= host->datactrl_reg & (host->variant->busy_dpsm_flag | ++ host->variant->datactrl_mask_sdio); + + if (host->datactrl_reg != datactrl) { + host->datactrl_reg = datactrl; +@@ -1761,6 +1765,25 @@ static irqreturn_t mmci_pio_irq(int irq, + return IRQ_HANDLED; + } + ++static void mmci_write_sdio_irq_bit(struct mmci_host *host, int enable) ++{ ++ void __iomem *base = host->base; ++ u32 mask = readl_relaxed(base + MMCIMASK0); ++ ++ if (enable) ++ writel_relaxed(mask | MCI_ST_SDIOITMASK, base + MMCIMASK0); ++ else ++ writel_relaxed(mask & ~MCI_ST_SDIOITMASK, base + MMCIMASK0); ++} ++ ++static void mmci_signal_sdio_irq(struct mmci_host *host, u32 status) ++{ ++ if (status & MCI_ST_SDIOIT) { ++ mmci_write_sdio_irq_bit(host, 0); ++ sdio_signal_irq(host->mmc); ++ } ++} ++ + /* + * Handle completion of command and data transfers. + */ +@@ -1805,6 +1828,9 @@ static irqreturn_t mmci_irq(int irq, voi + mmci_data_irq(host, host->data, status); + } + ++ if (host->variant->supports_sdio_irq) ++ mmci_signal_sdio_irq(host, status); ++ + /* + * Busy detection has been handled by mmci_cmd_irq() above. + * Clear the status bit to prevent polling in IRQ context. +@@ -2041,6 +2067,35 @@ static int mmci_sig_volt_switch(struct m + return ret; + } + ++static void mmci_enable_sdio_irq(struct mmc_host *mmc, int enable) ++{ ++ struct mmci_host *host = mmc_priv(mmc); ++ unsigned long flags; ++ ++ if (enable) ++ /* Keep the SDIO mode bit if SDIO irqs are enabled */ ++ pm_runtime_get_sync(mmc_dev(mmc)); ++ ++ spin_lock_irqsave(&host->lock, flags); ++ mmci_write_sdio_irq_bit(host, enable); ++ spin_unlock_irqrestore(&host->lock, flags); ++ ++ if (!enable) { ++ pm_runtime_mark_last_busy(mmc_dev(mmc)); ++ pm_runtime_put_autosuspend(mmc_dev(mmc)); ++ } ++} ++ ++static void mmci_ack_sdio_irq(struct mmc_host *mmc) ++{ ++ struct mmci_host *host = mmc_priv(mmc); ++ unsigned long flags; ++ ++ spin_lock_irqsave(&host->lock, flags); ++ mmci_write_sdio_irq_bit(host, 1); ++ spin_unlock_irqrestore(&host->lock, flags); ++} ++ + static struct mmc_host_ops mmci_ops = { + .request = mmci_request, + .pre_req = mmci_pre_request, +@@ -2316,6 +2371,16 @@ static int mmci_probe(struct amba_device + mmc->caps |= MMC_CAP_WAIT_WHILE_BUSY; + } + ++ if (variant->supports_sdio_irq && host->mmc->caps & MMC_CAP_SDIO_IRQ) { ++ mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD; ++ ++ mmci_ops.enable_sdio_irq = mmci_enable_sdio_irq; ++ mmci_ops.ack_sdio_irq = mmci_ack_sdio_irq; ++ ++ mmci_write_datactrlreg(host, ++ host->variant->datactrl_mask_sdio); ++ } ++ + /* Variants with mandatory busy timeout in HW needs R1B responses. */ + if (variant->busy_timeout) + mmc->caps |= MMC_CAP_NEED_RSP_BUSY; +--- a/drivers/mmc/host/mmci.h ++++ b/drivers/mmc/host/mmci.h +@@ -331,6 +331,7 @@ enum mmci_busy_state { + * register. + * @opendrain: bitmask identifying the OPENDRAIN bit inside MMCIPOWER register + * @dma_lli: true if variant has dma link list feature. ++ * @supports_sdio_irq: allow SD I/O card to interrupt the host + * @stm32_idmabsize_mask: stm32 sdmmc idma buffer size. + */ + struct variant_data { +@@ -376,6 +377,7 @@ struct variant_data { + u32 start_err; + u32 opendrain; + u8 dma_lli:1; ++ bool supports_sdio_irq; + u32 stm32_idmabsize_mask; + u32 stm32_idmabsize_align; + void (*init)(struct mmci_host *host); diff --git a/target/linux/stm32/patches-6.6/030-rtc-stm32-add-pinctrl-and-pinmux-interfaces.patch b/target/linux/stm32/patches-6.6/030-rtc-stm32-add-pinctrl-and-pinmux-interfaces.patch new file mode 100644 index 00000000000000..e06ea134c5a1bc --- /dev/null +++ b/target/linux/stm32/patches-6.6/030-rtc-stm32-add-pinctrl-and-pinmux-interfaces.patch @@ -0,0 +1,189 @@ +From c15671ce05a038b8c92a6f1e24b0b850a154ba59 Mon Sep 17 00:00:00 2001 +From: Valentin Caron +Date: Mon, 22 Jul 2024 18:00:20 +0200 +Subject: [PATCH] rtc: stm32: add pinctrl and pinmux interfaces + +STM32 RTC is capable to handle 3 specific pins of the soc. +"out1, out2 and out2_rmp". To handle this, we use pinctrl framework. +There is a single pin per group. + +Signed-off-by: Valentin Caron +Reviewed-by: Linus Walleij +Link: https://lore.kernel.org/r/20240722160022.454226-3-valentin.caron@foss.st.com +Signed-off-by: Alexandre Belloni +--- + drivers/rtc/Kconfig | 5 ++ + drivers/rtc/rtc-stm32.c | 120 ++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 125 insertions(+) + +--- a/drivers/rtc/Kconfig ++++ b/drivers/rtc/Kconfig +@@ -1887,6 +1887,11 @@ config RTC_DRV_STM32 + tristate "STM32 RTC" + select REGMAP_MMIO + depends on ARCH_STM32 || COMPILE_TEST ++ depends on OF ++ depends on PINCTRL ++ select PINMUX ++ select PINCONF ++ select GENERIC_PINCONF + help + If you say yes here you get support for the STM32 On-Chip + Real Time Clock. +--- a/drivers/rtc/rtc-stm32.c ++++ b/drivers/rtc/rtc-stm32.c +@@ -12,6 +12,9 @@ + #include + #include + #include ++#include ++#include ++#include + #include + #include + #include +@@ -94,6 +97,14 @@ + /* STM32 RTC driver time helpers */ + #define SEC_PER_DAY (24 * 60 * 60) + ++/* STM32 RTC pinctrl helpers */ ++#define STM32_RTC_PINMUX(_name, _action, ...) { \ ++ .name = (_name), \ ++ .action = (_action), \ ++ .groups = ((const char *[]){ __VA_ARGS__ }), \ ++ .num_groups = ARRAY_SIZE(((const char *[]){ __VA_ARGS__ })), \ ++} ++ + struct stm32_rtc; + + struct stm32_rtc_registers { +@@ -149,6 +160,106 @@ static void stm32_rtc_wpr_lock(struct st + writel_relaxed(RTC_WPR_WRONG_KEY, rtc->base + regs->wpr); + } + ++enum stm32_rtc_pin_name { ++ NONE, ++ OUT1, ++ OUT2, ++ OUT2_RMP ++}; ++ ++static const struct pinctrl_pin_desc stm32_rtc_pinctrl_pins[] = { ++ PINCTRL_PIN(OUT1, "out1"), ++ PINCTRL_PIN(OUT2, "out2"), ++ PINCTRL_PIN(OUT2_RMP, "out2_rmp"), ++}; ++ ++static int stm32_rtc_pinctrl_get_groups_count(struct pinctrl_dev *pctldev) ++{ ++ return ARRAY_SIZE(stm32_rtc_pinctrl_pins); ++} ++ ++static const char *stm32_rtc_pinctrl_get_group_name(struct pinctrl_dev *pctldev, ++ unsigned int selector) ++{ ++ return stm32_rtc_pinctrl_pins[selector].name; ++} ++ ++static int stm32_rtc_pinctrl_get_group_pins(struct pinctrl_dev *pctldev, ++ unsigned int selector, ++ const unsigned int **pins, ++ unsigned int *num_pins) ++{ ++ *pins = &stm32_rtc_pinctrl_pins[selector].number; ++ *num_pins = 1; ++ return 0; ++} ++ ++static const struct pinctrl_ops stm32_rtc_pinctrl_ops = { ++ .dt_node_to_map = pinconf_generic_dt_node_to_map_all, ++ .dt_free_map = pinconf_generic_dt_free_map, ++ .get_groups_count = stm32_rtc_pinctrl_get_groups_count, ++ .get_group_name = stm32_rtc_pinctrl_get_group_name, ++ .get_group_pins = stm32_rtc_pinctrl_get_group_pins, ++}; ++ ++struct stm32_rtc_pinmux_func { ++ const char *name; ++ const char * const *groups; ++ const unsigned int num_groups; ++ int (*action)(struct pinctrl_dev *pctl_dev, unsigned int pin); ++}; ++ ++static const struct stm32_rtc_pinmux_func stm32_rtc_pinmux_functions[] = { ++}; ++ ++static int stm32_rtc_pinmux_get_functions_count(struct pinctrl_dev *pctldev) ++{ ++ return ARRAY_SIZE(stm32_rtc_pinmux_functions); ++} ++ ++static const char *stm32_rtc_pinmux_get_fname(struct pinctrl_dev *pctldev, unsigned int selector) ++{ ++ return stm32_rtc_pinmux_functions[selector].name; ++} ++ ++static int stm32_rtc_pinmux_get_groups(struct pinctrl_dev *pctldev, unsigned int selector, ++ const char * const **groups, unsigned int * const num_groups) ++{ ++ *groups = stm32_rtc_pinmux_functions[selector].groups; ++ *num_groups = stm32_rtc_pinmux_functions[selector].num_groups; ++ return 0; ++} ++ ++static int stm32_rtc_pinmux_set_mux(struct pinctrl_dev *pctldev, unsigned int selector, ++ unsigned int group) ++{ ++ struct stm32_rtc_pinmux_func selected_func = stm32_rtc_pinmux_functions[selector]; ++ struct pinctrl_pin_desc pin = stm32_rtc_pinctrl_pins[group]; ++ ++ /* Call action */ ++ if (selected_func.action) ++ return selected_func.action(pctldev, pin.number); ++ ++ return -EINVAL; ++} ++ ++static const struct pinmux_ops stm32_rtc_pinmux_ops = { ++ .get_functions_count = stm32_rtc_pinmux_get_functions_count, ++ .get_function_name = stm32_rtc_pinmux_get_fname, ++ .get_function_groups = stm32_rtc_pinmux_get_groups, ++ .set_mux = stm32_rtc_pinmux_set_mux, ++ .strict = true, ++}; ++ ++static struct pinctrl_desc stm32_rtc_pdesc = { ++ .name = DRIVER_NAME, ++ .pins = stm32_rtc_pinctrl_pins, ++ .npins = ARRAY_SIZE(stm32_rtc_pinctrl_pins), ++ .owner = THIS_MODULE, ++ .pctlops = &stm32_rtc_pinctrl_ops, ++ .pmxops = &stm32_rtc_pinmux_ops, ++}; ++ + static int stm32_rtc_enter_init_mode(struct stm32_rtc *rtc) + { + const struct stm32_rtc_registers *regs = &rtc->data->regs; +@@ -723,6 +834,7 @@ static int stm32_rtc_probe(struct platfo + { + struct stm32_rtc *rtc; + const struct stm32_rtc_registers *regs; ++ struct pinctrl_dev *pctl; + int ret; + + rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); +@@ -834,6 +946,14 @@ static int stm32_rtc_probe(struct platfo + goto err; + } + ++ ret = devm_pinctrl_register_and_init(&pdev->dev, &stm32_rtc_pdesc, rtc, &pctl); ++ if (ret) ++ return dev_err_probe(&pdev->dev, ret, "pinctrl register failed"); ++ ++ ret = pinctrl_enable(pctl); ++ if (ret) ++ return dev_err_probe(&pdev->dev, ret, "pinctrl enable failed"); ++ + /* + * If INITS flag is reset (calendar year field set to 0x00), calendar + * must be initialized diff --git a/target/linux/stm32/patches-6.6/031-rtc-stm32-add-Low-Speed-Clock-Output-LSCO-support.patch b/target/linux/stm32/patches-6.6/031-rtc-stm32-add-Low-Speed-Clock-Output-LSCO-support.patch new file mode 100644 index 00000000000000..1ac097457217e5 --- /dev/null +++ b/target/linux/stm32/patches-6.6/031-rtc-stm32-add-Low-Speed-Clock-Output-LSCO-support.patch @@ -0,0 +1,253 @@ +From 229476a4de2e237ebadddca8a82d20afa9298f71 Mon Sep 17 00:00:00 2001 +From: Valentin Caron +Date: Mon, 22 Jul 2024 18:00:21 +0200 +Subject: [PATCH] rtc: stm32: add Low Speed Clock Output (LSCO) support + +RTC is able to output on a pin the "LSE" internal clock. + +STM32 RTC is now registered as a clock provider. +It provides rtc_lsco clock, that means RTC_LSCO is output on either +RTC_OUT1 or RTC_OUT2_RMP, depending on pinmux DT property. +The clock is marked as CLK_IGNORE_UNUSED and CLK_IS_CRITICAL because +RTC_LSCO can be early required by devices needed it to init. + +Add LSCO in pinmux functions. + +Add "stm32_rtc_clean_outs" to disable LSCO. As RTC is part of "backup" +power domain, it is not reset during shutdown or reboot. So force LSCO +disable at probe. + +Co-developed-by: Amelie Delaunay +Signed-off-by: Amelie Delaunay +Signed-off-by: Valentin Caron +Link: https://lore.kernel.org/r/20240722160022.454226-4-valentin.caron@foss.st.com +Signed-off-by: Alexandre Belloni +--- + drivers/rtc/Kconfig | 1 + + drivers/rtc/rtc-stm32.c | 99 +++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 100 insertions(+) + +--- a/drivers/rtc/Kconfig ++++ b/drivers/rtc/Kconfig +@@ -1892,6 +1892,7 @@ config RTC_DRV_STM32 + select PINMUX + select PINCONF + select GENERIC_PINCONF ++ depends on COMMON_CLK + help + If you say yes here you get support for the STM32 On-Chip + Real Time Clock. +--- a/drivers/rtc/rtc-stm32.c ++++ b/drivers/rtc/rtc-stm32.c +@@ -6,6 +6,7 @@ + + #include + #include ++#include + #include + #include + #include +@@ -44,6 +45,10 @@ + #define STM32_RTC_CR_FMT BIT(6) + #define STM32_RTC_CR_ALRAE BIT(8) + #define STM32_RTC_CR_ALRAIE BIT(12) ++#define STM32_RTC_CR_OSEL GENMASK(22, 21) ++#define STM32_RTC_CR_COE BIT(23) ++#define STM32_RTC_CR_TAMPOE BIT(26) ++#define STM32_RTC_CR_OUT2EN BIT(31) + + /* STM32_RTC_ISR/STM32_RTC_ICSR bit fields */ + #define STM32_RTC_ISR_ALRAWF BIT(0) +@@ -80,6 +85,12 @@ + /* STM32_RTC_SR/_SCR bit fields */ + #define STM32_RTC_SR_ALRA BIT(0) + ++/* STM32_RTC_CFGR bit fields */ ++#define STM32_RTC_CFGR_OUT2_RMP BIT(0) ++#define STM32_RTC_CFGR_LSCOEN GENMASK(2, 1) ++#define STM32_RTC_CFGR_LSCOEN_OUT1 1 ++#define STM32_RTC_CFGR_LSCOEN_OUT2_RMP 2 ++ + /* STM32_RTC_VERR bit fields */ + #define STM32_RTC_VERR_MINREV_SHIFT 0 + #define STM32_RTC_VERR_MINREV GENMASK(3, 0) +@@ -117,6 +128,7 @@ struct stm32_rtc_registers { + u16 wpr; + u16 sr; + u16 scr; ++ u16 cfgr; + u16 verr; + }; + +@@ -131,6 +143,7 @@ struct stm32_rtc_data { + bool has_pclk; + bool need_dbp; + bool need_accuracy; ++ bool has_lsco; + }; + + struct stm32_rtc { +@@ -143,6 +156,7 @@ struct stm32_rtc { + struct clk *rtc_ck; + const struct stm32_rtc_data *data; + int irq_alarm; ++ struct clk *clk_lsco; + }; + + static void stm32_rtc_wpr_unlock(struct stm32_rtc *rtc) +@@ -209,7 +223,68 @@ struct stm32_rtc_pinmux_func { + int (*action)(struct pinctrl_dev *pctl_dev, unsigned int pin); + }; + ++static int stm32_rtc_pinmux_lsco_available(struct pinctrl_dev *pctldev, unsigned int pin) ++{ ++ struct stm32_rtc *rtc = pinctrl_dev_get_drvdata(pctldev); ++ struct stm32_rtc_registers regs = rtc->data->regs; ++ unsigned int cr = readl_relaxed(rtc->base + regs.cr); ++ unsigned int cfgr = readl_relaxed(rtc->base + regs.cfgr); ++ unsigned int calib = STM32_RTC_CR_COE; ++ unsigned int tampalrm = STM32_RTC_CR_TAMPOE | STM32_RTC_CR_OSEL; ++ ++ switch (pin) { ++ case OUT1: ++ if ((!(cr & STM32_RTC_CR_OUT2EN) && ++ ((cr & calib) || cr & tampalrm)) || ++ ((cr & calib) && (cr & tampalrm))) ++ return -EBUSY; ++ break; ++ case OUT2_RMP: ++ if ((cr & STM32_RTC_CR_OUT2EN) && ++ (cfgr & STM32_RTC_CFGR_OUT2_RMP) && ++ ((cr & calib) || (cr & tampalrm))) ++ return -EBUSY; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ if (clk_get_rate(rtc->rtc_ck) != 32768) ++ return -ERANGE; ++ ++ return 0; ++} ++ ++static int stm32_rtc_pinmux_action_lsco(struct pinctrl_dev *pctldev, unsigned int pin) ++{ ++ struct stm32_rtc *rtc = pinctrl_dev_get_drvdata(pctldev); ++ struct stm32_rtc_registers regs = rtc->data->regs; ++ struct device *dev = rtc->rtc_dev->dev.parent; ++ u8 lscoen; ++ int ret; ++ ++ if (!rtc->data->has_lsco) ++ return -EPERM; ++ ++ ret = stm32_rtc_pinmux_lsco_available(pctldev, pin); ++ if (ret) ++ return ret; ++ ++ lscoen = (pin == OUT1) ? STM32_RTC_CFGR_LSCOEN_OUT1 : STM32_RTC_CFGR_LSCOEN_OUT2_RMP; ++ ++ rtc->clk_lsco = clk_register_gate(dev, "rtc_lsco", __clk_get_name(rtc->rtc_ck), ++ CLK_IGNORE_UNUSED | CLK_IS_CRITICAL, ++ rtc->base + regs.cfgr, lscoen, 0, NULL); ++ if (IS_ERR(rtc->clk_lsco)) ++ return PTR_ERR(rtc->clk_lsco); ++ ++ of_clk_add_provider(dev->of_node, of_clk_src_simple_get, rtc->clk_lsco); ++ ++ return 0; ++} ++ + static const struct stm32_rtc_pinmux_func stm32_rtc_pinmux_functions[] = { ++ STM32_RTC_PINMUX("lsco", &stm32_rtc_pinmux_action_lsco, "out1", "out2_rmp"), + }; + + static int stm32_rtc_pinmux_get_functions_count(struct pinctrl_dev *pctldev) +@@ -664,6 +739,7 @@ static const struct stm32_rtc_data stm32 + .has_pclk = false, + .need_dbp = true, + .need_accuracy = false, ++ .has_lsco = false, + .regs = { + .tr = 0x00, + .dr = 0x04, +@@ -674,6 +750,7 @@ static const struct stm32_rtc_data stm32 + .wpr = 0x24, + .sr = 0x0C, /* set to ISR offset to ease alarm management */ + .scr = UNDEF_REG, ++ .cfgr = UNDEF_REG, + .verr = UNDEF_REG, + }, + .events = { +@@ -686,6 +763,7 @@ static const struct stm32_rtc_data stm32 + .has_pclk = true, + .need_dbp = true, + .need_accuracy = false, ++ .has_lsco = false, + .regs = { + .tr = 0x00, + .dr = 0x04, +@@ -696,6 +774,7 @@ static const struct stm32_rtc_data stm32 + .wpr = 0x24, + .sr = 0x0C, /* set to ISR offset to ease alarm management */ + .scr = UNDEF_REG, ++ .cfgr = UNDEF_REG, + .verr = UNDEF_REG, + }, + .events = { +@@ -717,6 +796,7 @@ static const struct stm32_rtc_data stm32 + .has_pclk = true, + .need_dbp = false, + .need_accuracy = true, ++ .has_lsco = true, + .regs = { + .tr = 0x00, + .dr = 0x04, +@@ -727,6 +807,7 @@ static const struct stm32_rtc_data stm32 + .wpr = 0x24, + .sr = 0x50, + .scr = 0x5C, ++ .cfgr = 0x60, + .verr = 0x3F4, + }, + .events = { +@@ -743,6 +824,19 @@ static const struct of_device_id stm32_r + }; + MODULE_DEVICE_TABLE(of, stm32_rtc_of_match); + ++static void stm32_rtc_clean_outs(struct stm32_rtc *rtc) ++{ ++ struct stm32_rtc_registers regs = rtc->data->regs; ++ ++ if (regs.cfgr != UNDEF_REG) { ++ unsigned int cfgr = readl_relaxed(rtc->base + regs.cfgr); ++ ++ cfgr &= ~STM32_RTC_CFGR_LSCOEN; ++ cfgr &= ~STM32_RTC_CFGR_OUT2_RMP; ++ writel_relaxed(cfgr, rtc->base + regs.cfgr); ++ } ++} ++ + static int stm32_rtc_init(struct platform_device *pdev, + struct stm32_rtc *rtc) + { +@@ -946,6 +1040,8 @@ static int stm32_rtc_probe(struct platfo + goto err; + } + ++ stm32_rtc_clean_outs(rtc); ++ + ret = devm_pinctrl_register_and_init(&pdev->dev, &stm32_rtc_pdesc, rtc, &pctl); + if (ret) + return dev_err_probe(&pdev->dev, ret, "pinctrl register failed"); +@@ -992,6 +1088,9 @@ static void stm32_rtc_remove(struct plat + const struct stm32_rtc_registers *regs = &rtc->data->regs; + unsigned int cr; + ++ if (!IS_ERR_OR_NULL(rtc->clk_lsco)) ++ clk_unregister_gate(rtc->clk_lsco); ++ + /* Disable interrupts */ + stm32_rtc_wpr_unlock(rtc); + cr = readl_relaxed(rtc->base + regs->cr); diff --git a/target/linux/stm32/patches-6.6/032-ARM-dts-stm32-rtc-add-pin-to-provide-LSCO-on-stm32mp.patch b/target/linux/stm32/patches-6.6/032-ARM-dts-stm32-rtc-add-pin-to-provide-LSCO-on-stm32mp.patch new file mode 100644 index 00000000000000..1d5bedbad37af5 --- /dev/null +++ b/target/linux/stm32/patches-6.6/032-ARM-dts-stm32-rtc-add-pin-to-provide-LSCO-on-stm32mp.patch @@ -0,0 +1,31 @@ +From 92483a156238078562d187f527de6b358cb53a08 Mon Sep 17 00:00:00 2001 +From: Valentin Caron +Date: Tue, 27 Aug 2024 16:04:48 +0200 +Subject: [PATCH] ARM: dts: stm32: rtc, add pin to provide LSCO on + stm32mp13 + +Declare pin for LSCO in stm32-pinctrl provider node to reserve this pin +for RTC OUT2_RMP, in stm32mp13-pinctrl.dtsi. + +Signed-off-by: Valentin Caron +Signed-off-by: Alexandre Torgue +--- + arch/arm/boot/dts/st/stm32mp13-pinctrl.dtsi | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/arch/arm/boot/dts/st/stm32mp13-pinctrl.dtsi ++++ b/arch/arm/boot/dts/st/stm32mp13-pinctrl.dtsi +@@ -212,6 +212,13 @@ + }; + }; + ++ /omit-if-no-ref/ ++ rtc_rsvd_pins_a: rtc-rsvd-0 { ++ pins { ++ pinmux = ; /* RTC_OUT2_RMP */ ++ }; ++ }; ++ + sdmmc1_b4_pins_a: sdmmc1-b4-0 { + pins { + pinmux = , /* SDMMC1_D0 */ diff --git a/target/linux/stm32/patches-6.6/033-ARM-dts-stm32-rtc-add-LSCO-to-WLAN-BT-module-on-stm3.patch b/target/linux/stm32/patches-6.6/033-ARM-dts-stm32-rtc-add-LSCO-to-WLAN-BT-module-on-stm3.patch new file mode 100644 index 00000000000000..ec6a086a7d0b8b --- /dev/null +++ b/target/linux/stm32/patches-6.6/033-ARM-dts-stm32-rtc-add-LSCO-to-WLAN-BT-module-on-stm3.patch @@ -0,0 +1,34 @@ +From d6e424f926397e682fc44a952d5b3a1e34b2cd73 Mon Sep 17 00:00:00 2001 +From: Valentin Caron +Date: Tue, 27 Aug 2024 16:04:50 +0200 +Subject: [PATCH] ARM: dts: stm32: rtc, add LSCO to WLAN/BT module on + stm32mp135f-dk + +On stm32mp135f-dk board, WLAN/BT module LPO_IN pin is wired to +RTC OUT2_RMP pin. + +Provide a pinctrl configuration to enable LSCO on OUT2_RMP. + +Signed-off-by: Valentin Caron +Signed-off-by: Alexandre Torgue +--- + arch/arm/boot/dts/st/stm32mp135f-dk.dts | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/arch/arm/boot/dts/st/stm32mp135f-dk.dts ++++ b/arch/arm/boot/dts/st/stm32mp135f-dk.dts +@@ -184,7 +184,14 @@ + }; + + &rtc { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rtc_rsvd_pins_a>; + status = "okay"; ++ ++ rtc_lsco_pins_a: rtc-lsco-0 { ++ pins = "out2_rmp"; ++ function = "lsco"; ++ }; + }; + + &scmi_regu { diff --git a/target/linux/stm32/patches-6.6/034-ARM-dts-stm32-add-support-of-WLAN-BT-on-stm32mp135f-.patch b/target/linux/stm32/patches-6.6/034-ARM-dts-stm32-add-support-of-WLAN-BT-on-stm32mp135f-.patch new file mode 100644 index 00000000000000..e2b69ac8c77277 --- /dev/null +++ b/target/linux/stm32/patches-6.6/034-ARM-dts-stm32-add-support-of-WLAN-BT-on-stm32mp135f-.patch @@ -0,0 +1,84 @@ +From 6b44fdef4c7ad112e17d7cbd64d7d522a426d6e4 Mon Sep 17 00:00:00 2001 +From: Christophe Roullier +Date: Tue, 27 Aug 2024 16:04:52 +0200 +Subject: [PATCH] ARM: dts: stm32: add support of WLAN/BT on stm32mp135f-dk + +Add support of WLAN/BT Murata Type 1DX module: +- usart2 is used for Bluetooth interface +- sdmmc2 is used for WLAN (sdio) interface + +Signed-off-by: Christophe Roullier +Signed-off-by: Valentin Caron +Signed-off-by: Alexandre Torgue +--- + arch/arm/boot/dts/st/stm32mp135f-dk.dts | 45 +++++++++++++++++++++++++ + 1 file changed, 45 insertions(+) + +--- a/arch/arm/boot/dts/st/stm32mp135f-dk.dts ++++ b/arch/arm/boot/dts/st/stm32mp135f-dk.dts +@@ -67,6 +67,19 @@ + default-state = "off"; + }; + }; ++ ++ v3v3_ao: v3v3-ao { ++ compatible = "regulator-fixed"; ++ regulator-name = "v3v3_ao"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-always-on; ++ }; ++ ++ wifi_pwrseq: wifi-pwrseq { ++ compatible = "mmc-pwrseq-simple"; ++ reset-gpios = <&mcp23017 11 GPIO_ACTIVE_LOW>; ++ }; + }; + + &adc_1 { +@@ -230,6 +243,30 @@ + status = "okay"; + }; + ++/* Wifi */ ++&sdmmc2 { ++ pinctrl-names = "default", "opendrain", "sleep"; ++ pinctrl-0 = <&sdmmc2_b4_pins_a &sdmmc2_clk_pins_a>; ++ pinctrl-1 = <&sdmmc2_b4_od_pins_a &sdmmc2_clk_pins_a>; ++ pinctrl-2 = <&sdmmc2_b4_sleep_pins_a>; ++ non-removable; ++ cap-sdio-irq; ++ st,neg-edge; ++ bus-width = <4>; ++ vmmc-supply = <&v3v3_ao>; ++ mmc-pwrseq = <&wifi_pwrseq>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ brcmf: bcrmf@1 { ++ reg = <1>; ++ compatible = "brcm,bcm4329-fmac"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rtc_lsco_pins_a>; ++ }; ++}; ++ + &spi5 { + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&spi5_pins_a>; +@@ -332,6 +369,14 @@ + pinctrl-2 = <&usart2_idle_pins_a>; + uart-has-rtscts; + status = "okay"; ++ ++ bluetooth { ++ shutdown-gpios = <&mcp23017 13 GPIO_ACTIVE_HIGH>; ++ compatible = "brcm,bcm43438-bt"; ++ max-speed = <3000000>; ++ vbat-supply = <&v3v3_ao>; ++ vddio-supply = <&v3v3_ao>; ++ }; + }; + + &usbh_ehci { diff --git a/target/linux/stm32/patches-6.6/700-net-stmmac-dwmac-stm32-add-support-of-phy-supply-pro.patch b/target/linux/stm32/patches-6.6/700-net-stmmac-dwmac-stm32-add-support-of-phy-supply-pro.patch new file mode 100644 index 00000000000000..57d2a26c1af5b1 --- /dev/null +++ b/target/linux/stm32/patches-6.6/700-net-stmmac-dwmac-stm32-add-support-of-phy-supply-pro.patch @@ -0,0 +1,106 @@ +From 7bfe3404a02923ca3858abf56b18a098b4be33b2 Mon Sep 17 00:00:00 2001 +From: Christophe Roullier +Date: Wed, 10 Nov 2021 17:39:40 +0100 +Subject: [PATCH] net: ethernet: stmmac: stm32: support the phy-supply + regulator binding + +Configure the phy regulator if defined by the "phy-supply" DT phandle. + +Signed-off-by: Christophe Roullier +--- + .../net/ethernet/stmicro/stmmac/dwmac-stm32.c | 51 ++++++++++++++++++- + 1 file changed, 50 insertions(+), 1 deletion(-) + +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c +@@ -14,6 +14,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -92,6 +93,7 @@ struct stm32_dwmac { + u32 mode_reg; /* MAC glue-logic mode register */ + u32 mode_mask; + struct regmap *regmap; ++ struct regulator *regulator; + u32 speed; + const struct stm32_ops *ops; + struct device *dev; +@@ -374,6 +376,16 @@ static int stm32_dwmac_parse_data(struct + dev_dbg(dev, "Warning sysconfig register mask not set\n"); + } + ++ dwmac->regulator = devm_regulator_get_optional(dev, "phy"); ++ if (IS_ERR(dwmac->regulator)) { ++ if (PTR_ERR(dwmac->regulator) == -EPROBE_DEFER) { ++ dev_dbg(dev, "phy regulator is not available yet, deferred probing\n"); ++ return -EPROBE_DEFER; ++ } ++ dev_dbg(dev, "no regulator found\n"); ++ dwmac->regulator = NULL; ++ } ++ + return err; + } + +@@ -439,6 +451,28 @@ static int stm32mp1_parse_data(struct st + return err; + } + ++static int phy_power_on(struct stm32_dwmac *bsp_priv, bool enable) ++{ ++ int ret; ++ struct device *dev = bsp_priv->dev; ++ ++ if (!bsp_priv->regulator) ++ return 0; ++ ++ if (enable) { ++ ret = regulator_enable(bsp_priv->regulator); ++ if (ret) ++ dev_err(dev, "fail to enable phy-supply\n"); ++ } else { ++ ret = regulator_disable(bsp_priv->regulator); ++ if (ret) ++ dev_err(dev, "fail to disable phy-supply\n"); ++ } ++ ++ return 0; ++} ++ ++ + static int stm32_dwmac_probe(struct platform_device *pdev) + { + struct plat_stmmacenet_data *plat_dat; +@@ -480,12 +514,18 @@ static int stm32_dwmac_probe(struct plat + if (ret) + return ret; + +- ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); ++ ret = phy_power_on(plat_dat->bsp_priv, true); + if (ret) + goto err_clk_disable; + ++ ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); ++ if (ret) ++ goto err_gmac_powerdown; ++ + return 0; + ++err_gmac_powerdown: ++ phy_power_on(plat_dat->bsp_priv, false); + err_clk_disable: + stm32_dwmac_clk_disable(dwmac, false); + +@@ -506,6 +546,8 @@ static void stm32_dwmac_remove(struct pl + dev_pm_clear_wake_irq(&pdev->dev); + device_init_wakeup(&pdev->dev, false); + } ++ ++ phy_power_on(priv->plat->bsp_priv, false); + } + + static int stm32mp1_suspend(struct stm32_dwmac *dwmac) diff --git a/target/linux/stm32/patches-6.6/900-ARM-dts-stm32-add-ethernet2-for-STM32MP135F-DK-board.patch b/target/linux/stm32/patches-6.6/900-ARM-dts-stm32-add-ethernet2-for-STM32MP135F-DK-board.patch new file mode 100644 index 00000000000000..48fa446bd86220 --- /dev/null +++ b/target/linux/stm32/patches-6.6/900-ARM-dts-stm32-add-ethernet2-for-STM32MP135F-DK-board.patch @@ -0,0 +1,53 @@ +From 63c84f846ec5b794a6c90a1c5813cdb0ae75daf6 Mon Sep 17 00:00:00 2001 +From: Thomas Richard +Date: Thu, 26 Sep 2024 16:48:52 +0200 +Subject: [PATCH] ARM: dts: stm32: add ethernet2 for STM32MP135F-DK board + +This patch is based on the stm32mp135f-dk devicetree from 6.6 ST kernel. + +Signed-off-by: Thomas Richard +--- + arch/arm/boot/dts/st/stm32mp135f-dk.dts | 25 +++++++++++++++++++++++++ + 1 file changed, 25 insertions(+) + +--- a/arch/arm/boot/dts/st/stm32mp135f-dk.dts ++++ b/arch/arm/boot/dts/st/stm32mp135f-dk.dts +@@ -20,6 +20,7 @@ + + aliases { + ethernet0 = ðernet1; ++ ethernet1 = ðernet2; + serial0 = &uart4; + serial1 = &usart1; + serial2 = &uart8; +@@ -129,6 +130,30 @@ + }; + }; + ++ðernet2 { ++ status = "okay"; ++ pinctrl-0 = <ð2_rmii_pins_a>; ++ pinctrl-1 = <ð2_rmii_sleep_pins_a>; ++ pinctrl-names = "default", "sleep"; ++ phy-mode = "rmii"; ++ phy-handle = <&phy0_eth2>; ++ st,ext-phyclk; ++ phy-supply = <&scmi_v3v3_sw>; ++ ++ mdio1 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ compatible = "snps,dwmac-mdio"; ++ phy0_eth2: ethernet-phy@0 { ++ compatible = "ethernet-phy-id0007.c131"; ++ reset-gpios = <&mcp23017 10 GPIO_ACTIVE_LOW>; ++ reg = <0>; ++ }; ++ }; ++}; ++ ++ ++ + &i2c1 { + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&i2c1_pins_a>; diff --git a/target/linux/stm32/stm32mp1/config-6.6 b/target/linux/stm32/stm32mp1/config-6.6 new file mode 100644 index 00000000000000..946649ef9b9e94 --- /dev/null +++ b/target/linux/stm32/stm32mp1/config-6.6 @@ -0,0 +1,485 @@ +CONFIG_ALIGNMENT_TRAP=y +CONFIG_ARCH_32BIT_OFF_T=y +CONFIG_ARCH_FORCE_MAX_ORDER=12 +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_KEEP_MEMBLOCK=y +CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y +CONFIG_ARCH_MULTIPLATFORM=y +CONFIG_ARCH_MULTI_V6_V7=y +CONFIG_ARCH_MULTI_V7=y +CONFIG_ARCH_OPTIONAL_KERNEL_RWX=y +CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT=y +CONFIG_ARCH_SELECT_MEMORY_MODEL=y +CONFIG_ARCH_SPARSEMEM_ENABLE=y +CONFIG_ARCH_STACKWALK=y +CONFIG_ARCH_STM32=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARM=y +CONFIG_ARM_AMBA=y +CONFIG_ARM_APPENDED_DTB=y +CONFIG_ARM_ARCH_TIMER=y +CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y +CONFIG_ARM_ATAG_DTB_COMPAT=y +CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER=y +CONFIG_ARM_CPU_SUSPEND=y +CONFIG_ARM_ERRATA_430973=y +CONFIG_ARM_ERRATA_643719=y +CONFIG_ARM_ERRATA_720789=y +CONFIG_ARM_ERRATA_754322=y +CONFIG_ARM_ERRATA_754327=y +CONFIG_ARM_ERRATA_764369=y +CONFIG_ARM_ERRATA_775420=y +CONFIG_ARM_ERRATA_798181=y +CONFIG_ARM_ERRATA_814220=y +CONFIG_ARM_GIC=y +CONFIG_ARM_HAS_GROUP_RELOCS=y +# CONFIG_ARM_HIGHBANK_CPUIDLE is not set +CONFIG_ARM_L1_CACHE_SHIFT=6 +CONFIG_ARM_L1_CACHE_SHIFT_6=y +CONFIG_ARM_PATCH_IDIV=y +CONFIG_ARM_PATCH_PHYS_VIRT=y +# CONFIG_ARM_PL172_MPMC is not set +CONFIG_ARM_PSCI=y +CONFIG_ARM_PSCI_CPUIDLE=y +CONFIG_ARM_PSCI_CPUIDLE_DOMAIN=y +CONFIG_ARM_PSCI_FW=y +CONFIG_ARM_SCMI_CPUFREQ=y +CONFIG_ARM_SCMI_HAVE_MSG=y +CONFIG_ARM_SCMI_HAVE_SHMEM=y +CONFIG_ARM_SCMI_HAVE_TRANSPORT=y +# CONFIG_ARM_SCMI_POWER_CONTROL is not set +CONFIG_ARM_SCMI_POWER_DOMAIN=y +CONFIG_ARM_SCMI_PROTOCOL=y +# CONFIG_ARM_SCMI_RAW_MODE_SUPPORT is not set +CONFIG_ARM_SCMI_TRANSPORT_OPTEE=y +CONFIG_ARM_SCMI_TRANSPORT_SMC=y +# CONFIG_ARM_SCMI_TRANSPORT_SMC_ATOMIC_ENABLE is not set +CONFIG_ARM_SMCCC_SOC_ID=y +CONFIG_ARM_SMC_WATCHDOG=y +# CONFIG_ARM_SMMU is not set +CONFIG_ARM_THUMB=y +CONFIG_ARM_THUMBEE=y +CONFIG_ARM_UNWIND=y +CONFIG_ARM_VIRT_EXT=y +CONFIG_AUTO_ZRELADDR=y +CONFIG_BINFMT_FLAT_ARGVP_ENVP_ON_STACK=y +# CONFIG_BLK_DEV_INITRD is not set +CONFIG_BLK_DEV_SD=y +CONFIG_BLK_PM=y +CONFIG_BOUNCE=y +CONFIG_BUFFER_HEAD=y +# CONFIG_CACHE_L2X0 is not set +CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y +CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" +CONFIG_CC_NO_ARRAY_BOUNDS=y +CONFIG_CHR_DEV_SG=y +CONFIG_CLKSRC_MMIO=y +CONFIG_CLKSRC_STM32=y +CONFIG_CLK_ICST=y +CONFIG_CLONE_BACKWARDS=y +CONFIG_CMA=y +CONFIG_CMA_ALIGNMENT=8 +CONFIG_CMA_AREAS=7 +# CONFIG_CMA_DEBUG is not set +# CONFIG_CMA_DEBUGFS is not set +CONFIG_CMA_SIZE_MBYTES=64 +# 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_CMDLINE_PARTITION=y +CONFIG_COMMON_CLK=y +CONFIG_COMMON_CLK_SCMI=y +CONFIG_COMMON_CLK_STM32MP135=y +CONFIG_COMPACT_UNEVICTABLE_DEFAULT=1 +CONFIG_COMPAT_32BIT_TIME=y +CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_CONTEXT_TRACKING=y +CONFIG_CONTEXT_TRACKING_IDLE=y +CONFIG_CONTIG_ALLOC=y +CONFIG_COREDUMP=y +CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y +CONFIG_CPUFREQ_DT=y +CONFIG_CPUFREQ_DT_PLATDEV=y +CONFIG_CPU_32v6K=y +CONFIG_CPU_32v7=y +CONFIG_CPU_ABRT_EV7=y +CONFIG_CPU_CACHE_V7=y +CONFIG_CPU_CACHE_VIPT=y +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_GOV_ATTR_SET=y +CONFIG_CPU_FREQ_GOV_COMMON=y +# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set +CONFIG_CPU_FREQ_GOV_ONDEMAND=y +CONFIG_CPU_FREQ_GOV_PERFORMANCE=y +CONFIG_CPU_FREQ_GOV_POWERSAVE=y +CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y +CONFIG_CPU_FREQ_GOV_USERSPACE=y +CONFIG_CPU_FREQ_STAT=y +CONFIG_CPU_HAS_ASID=y +CONFIG_CPU_IDLE=y +CONFIG_CPU_IDLE_GOV_MENU=y +CONFIG_CPU_IDLE_MULTIPLE_DRIVERS=y +CONFIG_CPU_ISOLATION=y +CONFIG_CPU_LITTLE_ENDIAN=y +CONFIG_CPU_MITIGATIONS=y +CONFIG_CPU_PABRT_V7=y +CONFIG_CPU_PM=y +CONFIG_CPU_RMAP=y +CONFIG_CPU_SPECTRE=y +CONFIG_CPU_THUMB_CAPABLE=y +CONFIG_CPU_TLB_V7=y +CONFIG_CPU_V7=y +CONFIG_CRC16=y +CONFIG_CROSS_MEMORY_ATTACH=y +CONFIG_CRYPTO_CRC32C=y +CONFIG_CRYPTO_DEFLATE=y +CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y +CONFIG_CRYPTO_LIB_GF128MUL=y +CONFIG_CRYPTO_LIB_SHA1=y +CONFIG_CRYPTO_LIB_UTILS=y +CONFIG_CRYPTO_SHA1=y +CONFIG_CURRENT_POINTER_IN_TPIDRURO=y +CONFIG_DCACHE_WORD_ACCESS=y +CONFIG_DEBUG_ALIGN_RODATA=y +CONFIG_DEBUG_INFO=y +CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" +CONFIG_DEVFREQ_GOV_PASSIVE=y +# CONFIG_DEVFREQ_GOV_PERFORMANCE is not set +# CONFIG_DEVFREQ_GOV_POWERSAVE is not set +CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=y +# CONFIG_DEVFREQ_GOV_USERSPACE is not set +CONFIG_DMADEVICES=y +CONFIG_DMA_CMA=y +CONFIG_DMA_ENGINE=y +CONFIG_DMA_OF=y +CONFIG_DMA_OPS=y +CONFIG_DMA_SHARED_BUFFER=y +CONFIG_DMA_VIRTUAL_CHANNELS=y +CONFIG_DNOTIFY=y +CONFIG_DTC=y +CONFIG_DT_IDLE_GENPD=y +CONFIG_DT_IDLE_STATES=y +CONFIG_DUMMY_CONSOLE=y +CONFIG_DWMAC_DWC_QOS_ETH=y +CONFIG_DWMAC_GENERIC=y +CONFIG_DWMAC_STM32=y +CONFIG_DW_DMAC=y +CONFIG_DW_DMAC_CORE=y +CONFIG_EDAC=y +CONFIG_EDAC_ATOMIC_SCRUB=y +# CONFIG_EDAC_DEBUG is not set +CONFIG_EDAC_LEGACY_SYSFS=y +CONFIG_EDAC_SUPPORT=y +CONFIG_ELF_CORE=y +CONFIG_EXCLUSIVE_SYSTEM_RAM=y +CONFIG_EXT4_FS=y +CONFIG_FIXED_PHY=y +CONFIG_FIX_EARLYCON_MEM=y +CONFIG_FREEZER=y +CONFIG_FS_IOMAP=y +CONFIG_FS_MBCACHE=y +CONFIG_FUNCTION_ALIGNMENT=0 +CONFIG_FWNODE_MDIO=y +CONFIG_FW_CACHE=y +# CONFIG_FW_LOADER_USER_HELPER is not set +CONFIG_GCC10_NO_ARRAY_BOUNDS=y +CONFIG_GENERIC_ALLOCATOR=y +CONFIG_GENERIC_ARCH_TOPOLOGY=y +CONFIG_GENERIC_BUG=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y +CONFIG_GENERIC_CPU_AUTOPROBE=y +CONFIG_GENERIC_CPU_VULNERABILITIES=y +CONFIG_GENERIC_EARLY_IOREMAP=y +CONFIG_GENERIC_GETTIMEOFDAY=y +CONFIG_GENERIC_IDLE_POLL_SETUP=y +CONFIG_GENERIC_IRQ_CHIP=y +CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y +CONFIG_GENERIC_IRQ_MIGRATION=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_PCI_IOMAP=y +CONFIG_GENERIC_PHY=y +CONFIG_GENERIC_PINCONF=y +CONFIG_GENERIC_PINCTRL_GROUPS=y +CONFIG_GENERIC_PINMUX_FUNCTIONS=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_GENERIC_VDSO_32=y +CONFIG_GLOB=y +CONFIG_GPIOLIB_IRQCHIP=y +CONFIG_GPIO_CDEV=y +CONFIG_GPIO_GENERIC=y +CONFIG_GPIO_GENERIC_PLATFORM=y +CONFIG_GPIO_SYSCON=y +# CONFIG_GPIO_SYSFS is not set +CONFIG_HARDEN_BRANCH_PREDICTOR=y +CONFIG_HARDIRQS_SW_RESEND=y +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT=y +CONFIG_HAS_IOPORT_MAP=y +CONFIG_HAVE_SMP=y +CONFIG_HIGHMEM=y +CONFIG_HIGHPTE=y +CONFIG_HOTPLUG_CORE_SYNC=y +CONFIG_HOTPLUG_CORE_SYNC_DEAD=y +CONFIG_HOTPLUG_CPU=y +CONFIG_HW_CONSOLE=y +CONFIG_HW_RANDOM=y +CONFIG_HW_RANDOM_OPTEE=y +# CONFIG_HW_RANDOM_STM32 is not set +CONFIG_HZ_FIXED=0 +CONFIG_I2C=y +CONFIG_I2C_BOARDINFO=y +CONFIG_I2C_CHARDEV=y +CONFIG_I2C_COMPAT=y +CONFIG_I2C_DEMUX_PINCTRL=y +CONFIG_I2C_HELPER_AUTO=y +CONFIG_I2C_MUX=y +CONFIG_I2C_MUX_GPIO=y +CONFIG_I2C_MUX_PCA954x=y +CONFIG_I2C_MUX_PINCTRL=y +CONFIG_I2C_SLAVE=y +# CONFIG_I2C_SLAVE_TESTUNIT is not set +CONFIG_I2C_SMBUS=y +# CONFIG_I2C_STM32F4 is not set +CONFIG_I2C_STM32F7=y +CONFIG_INPUT=y +# CONFIG_IOMMUFD is not set +# CONFIG_IOMMU_DEBUGFS is not set +CONFIG_IOMMU_IO_PGTABLE=y +# CONFIG_IOMMU_IO_PGTABLE_ARMV7S is not set +CONFIG_IOMMU_IO_PGTABLE_LPAE=y +# CONFIG_IOMMU_IO_PGTABLE_LPAE_SELFTEST is not set +CONFIG_IOMMU_SUPPORT=y +CONFIG_IRQCHIP=y +CONFIG_IRQSTACKS=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_DOMAIN_HIERARCHY=y +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_IRQ_WORK=y +CONFIG_JBD2=y +CONFIG_KERNEL_GZIP=y +# CONFIG_KERNEL_XZ is not set +CONFIG_KMAP_LOCAL=y +CONFIG_KMAP_LOCAL_NON_LINEAR_PTE_ARRAY=y +# CONFIG_LEDS_BRIGHTNESS_HW_CHANGED is not set +# CONFIG_LEDS_CLASS_MULTICOLOR is not set +CONFIG_LEDS_GPIO=y +CONFIG_LEDS_TRIGGER_CPU=y +CONFIG_LEDS_TRIGGER_ONESHOT=y +CONFIG_LEDS_TRIGGER_TRANSIENT=y +CONFIG_LIBFDT=y +CONFIG_LOCK_DEBUGGING_SUPPORT=y +CONFIG_LOCK_SPIN_ON_OWNER=y +CONFIG_LOG_BUF_SHIFT=16 +# CONFIG_LRU_GEN is not set +CONFIG_LZO_DECOMPRESS=y +CONFIG_MACH_STM32MP13=y +# CONFIG_MACH_STM32MP157 is not set +CONFIG_MAGIC_SYSRQ=y +CONFIG_MAGIC_SYSRQ_SERIAL=y +CONFIG_MDIO_BITBANG=y +CONFIG_MDIO_BUS=y +CONFIG_MDIO_DEVICE=y +CONFIG_MDIO_DEVRES=y +# CONFIG_MDIO_GPIO is not set +CONFIG_MEMORY=y +CONFIG_MEMORY_ISOLATION=y +# CONFIG_MFD_STM32_LPTIMER is not set +# CONFIG_MFD_STM32_TIMERS is not set +CONFIG_MFD_SYSCON=y +CONFIG_MIGHT_HAVE_CACHE_L2X0=y +CONFIG_MIGRATION=y +CONFIG_MMC=y +CONFIG_MMC_ARMMMCI=y +CONFIG_MMC_BLOCK=y +CONFIG_MMC_BLOCK_MINORS=16 +CONFIG_MMC_STM32_SDMMC=y +CONFIG_MMU_LAZY_TLB_REFCOUNT=y +CONFIG_MODULES_USE_ELF_REL=y +CONFIG_MUTEX_SPIN_ON_OWNER=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NEED_SRCU_NMI_SAFE=y +CONFIG_NEON=y +CONFIG_NET_EGRESS=y +CONFIG_NET_FLOW_LIMIT=y +CONFIG_NET_INGRESS=y +CONFIG_NET_PTP_CLASSIFY=y +CONFIG_NET_SELFTESTS=y +CONFIG_NET_XGRESS=y +CONFIG_NO_HZ_COMMON=y +CONFIG_NO_HZ_IDLE=y +CONFIG_NR_CPUS=2 +CONFIG_OF=y +CONFIG_OF_ADDRESS=y +CONFIG_OF_DYNAMIC=y +CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_FLATTREE=y +CONFIG_OF_GPIO=y +CONFIG_OF_IRQ=y +CONFIG_OF_KOBJ=y +CONFIG_OF_MDIO=y +CONFIG_OF_OVERLAY=y +CONFIG_OF_RESOLVE=y +CONFIG_OLD_SIGACTION=y +CONFIG_OLD_SIGSUSPEND3=y +CONFIG_OPTEE=y +CONFIG_PADATA=y +CONFIG_PAGE_OFFSET=0xC0000000 +CONFIG_PAGE_POOL=y +CONFIG_PAGE_POOL_STATS=y +CONFIG_PAGE_SIZE_LESS_THAN_256KB=y +CONFIG_PAGE_SIZE_LESS_THAN_64KB=y +# CONFIG_PANIC_ON_OOPS is not set +CONFIG_PANIC_ON_OOPS_VALUE=0 +CONFIG_PANIC_TIMEOUT=0 +CONFIG_PCPU_DEV_REFCNT=y +CONFIG_PCS_XPCS=y +CONFIG_PERF_USE_VMALLOC=y +CONFIG_PGTABLE_LEVELS=2 +CONFIG_PHYLIB=y +CONFIG_PHYLIB_LEDS=y +CONFIG_PHYLINK=y +# CONFIG_PHY_STM32_USBPHYC is not set +CONFIG_PINCTRL=y +CONFIG_PINCTRL_MCP23S08=y +CONFIG_PINCTRL_MCP23S08_I2C=y +CONFIG_PINCTRL_STM32=y +CONFIG_PINCTRL_STM32MP135=y +# CONFIG_PL353_SMC is not set +CONFIG_PM=y +CONFIG_PM_CLK=y +CONFIG_PM_DEVFREQ=y +CONFIG_PM_DEVFREQ_EVENT=y +CONFIG_PM_GENERIC_DOMAINS=y +CONFIG_PM_GENERIC_DOMAINS_OF=y +CONFIG_PM_GENERIC_DOMAINS_SLEEP=y +CONFIG_PM_OPP=y +CONFIG_PM_SLEEP=y +CONFIG_PM_SLEEP_SMP=y +CONFIG_POSIX_MQUEUE=y +CONFIG_POSIX_MQUEUE_SYSCTL=y +CONFIG_POWER_RESET=y +CONFIG_POWER_RESET_GPIO=y +CONFIG_POWER_RESET_GPIO_RESTART=y +CONFIG_POWER_RESET_SYSCON=y +CONFIG_POWER_RESET_SYSCON_POWEROFF=y +CONFIG_POWER_SUPPLY=y +CONFIG_PPS=y +CONFIG_PREEMPT_NONE_BUILD=y +CONFIG_PRINTK_TIME=y +CONFIG_PTP_1588_CLOCK=y +CONFIG_PTP_1588_CLOCK_OPTIONAL=y +CONFIG_RANDSTRUCT_NONE=y +CONFIG_RAS=y +CONFIG_RATIONAL=y +# CONFIG_RAVE_SP_CORE is not set +CONFIG_REGMAP=y +CONFIG_REGMAP_I2C=y +CONFIG_REGMAP_MMIO=y +CONFIG_REGULATOR=y +CONFIG_REGULATOR_ARM_SCMI=y +CONFIG_REGULATOR_FIXED_VOLTAGE=y +CONFIG_REGULATOR_GPIO=y +# CONFIG_REGULATOR_STM32_BOOSTER is not set +# CONFIG_REGULATOR_STM32_PWR is not set +# CONFIG_REGULATOR_STM32_VREFBUF is not set +CONFIG_RESET_CONTROLLER=y +CONFIG_RESET_SCMI=y +CONFIG_RESET_SIMPLE=y +CONFIG_RFS_ACCEL=y +CONFIG_RPS=y +CONFIG_RTC_CLASS=y +# CONFIG_RTC_DRV_CMOS is not set +# CONFIG_RTC_DRV_OPTEE is not set +CONFIG_RTC_DRV_STM32=y +CONFIG_RTC_I2C_AND_SPI=y +CONFIG_RWSEM_SPIN_ON_OWNER=y +CONFIG_SCSI=y +CONFIG_SCSI_COMMON=y +# CONFIG_SERIAL_8250 is not set +CONFIG_SERIAL_AMBA_PL011=y +CONFIG_SERIAL_AMBA_PL011_CONSOLE=y +CONFIG_SERIAL_DEV_BUS=y +CONFIG_SERIAL_DEV_CTRL_TTYPORT=y +CONFIG_SERIAL_MCTRL_GPIO=y +CONFIG_SERIAL_STM32=y +CONFIG_SERIAL_STM32_CONSOLE=y +CONFIG_SERIO=y +CONFIG_SERIO_LIBPS2=y +CONFIG_SERIO_SERPORT=y +CONFIG_SGL_ALLOC=y +CONFIG_SG_POOL=y +CONFIG_SMP=y +CONFIG_SMP_ON_UP=y +CONFIG_SOCK_RX_QUEUE_MAPPING=y +CONFIG_SOC_BUS=y +CONFIG_SOFTIRQ_ON_OWN_STACK=y +CONFIG_SPARSE_IRQ=y +CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU=y +# CONFIG_SQUASHFS_EMBEDDED is not set +CONFIG_SQUASHFS_FILE_CACHE=y +# CONFIG_SQUASHFS_FILE_DIRECT is not set +CONFIG_SQUASHFS_LZO=y +CONFIG_SQUASHFS_ZLIB=y +CONFIG_STM32_DMA=y +CONFIG_STM32_DMAMUX=y +CONFIG_STM32_EXTI=y +# CONFIG_STM32_FMC2_EBI is not set +CONFIG_STM32_MDMA=y +CONFIG_STM32_WATCHDOG=y +CONFIG_STMMAC_ETH=y +CONFIG_STMMAC_PLATFORM=y +# CONFIG_STRIP_ASM_SYMS is not set +CONFIG_SUSPEND=y +CONFIG_SUSPEND_FREEZER=y +CONFIG_SWPHY=y +CONFIG_SWP_EMULATE=y +CONFIG_SYS_SUPPORTS_APM_EMULATION=y +CONFIG_TEE=y +CONFIG_THREAD_INFO_IN_TASK=y +CONFIG_TICK_CPU_ACCOUNTING=y +CONFIG_TIMER_OF=y +CONFIG_TIMER_PROBE=y +CONFIG_TREE_RCU=y +CONFIG_TREE_SRCU=y +CONFIG_TRUSTED_FOUNDATIONS=y +# CONFIG_UCLAMP_TASK is not set +# CONFIG_UEVENT_HELPER is not set +CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" +CONFIG_UNWINDER_ARM=y +CONFIG_USB_SUPPORT=y +CONFIG_USELIB=y +CONFIG_USE_OF=y +CONFIG_VFP=y +CONFIG_VFPv3=y +CONFIG_VMAP_STACK=y +CONFIG_VM_EVENT_COUNTERS=y +CONFIG_VT=y +CONFIG_VT_CONSOLE=y +CONFIG_VT_CONSOLE_SLEEP=y +CONFIG_VT_HW_CONSOLE_BINDING=y +CONFIG_WATCHDOG_CORE=y +# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set +CONFIG_XPS=y +CONFIG_XZ_DEC_ARM=y +CONFIG_XZ_DEC_ARMTHUMB=y +CONFIG_XZ_DEC_BCJ=y +CONFIG_ZBOOT_ROM_BSS=0x0 +CONFIG_ZBOOT_ROM_TEXT=0x0 +CONFIG_ZLIB_DEFLATE=y +CONFIG_ZLIB_INFLATE=y diff --git a/target/linux/stm32/stm32mp1/target.mk b/target/linux/stm32/stm32mp1/target.mk new file mode 100644 index 00000000000000..c41055d5b52462 --- /dev/null +++ b/target/linux/stm32/stm32mp1/target.mk @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2024 Bootlin +# + +BOARDNAME:=STM32MP1 boards +ARCH:=arm +CPU_TYPE:=cortex-a7 +CPU_SUBTYPE=neon-vfpv4 +FEATURES+=fpu +KERNEL_IMAGES:=zImage + From b2f3713801c22d496791949877e6466864eaaa41 Mon Sep 17 00:00:00 2001 From: Antonio Pastor Date: Sat, 16 Nov 2024 15:09:49 -0500 Subject: [PATCH 144/877] kernel: modules: appletalk: add for Netatalk v4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Netatalk v4 reintroduces AppleTalk and this module is required for layer 3 protocol support. Module was removed in kernel 4.14 for OpenWrt 18.06 (commmit 14a0131, 22/02/2018). At the time nothing used it as Netatalk v3 did not support AppleTalk. Not building ipddp feature/module like it was in the past, as recommended by upstream Netatalk maintainers. Signed-off-by: Antonio Pastor Link: https://github.com/openwrt/openwrt/pull/16979 Signed-off-by: Hauke Mehrtens (cherry picked from commit 5eb25dddb17fa3cf4958e91dfc9fc868c9eb03ac) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/kernel/linux/modules/netsupport.mk | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/package/kernel/linux/modules/netsupport.mk b/package/kernel/linux/modules/netsupport.mk index 9f349d34ee229b..3551a89a9b2e91 100644 --- a/package/kernel/linux/modules/netsupport.mk +++ b/package/kernel/linux/modules/netsupport.mk @@ -42,6 +42,24 @@ endef $(eval $(call KernelPackage,atmtcp)) +define KernelPackage/appletalk + SUBMENU:=$(NETWORK_SUPPORT_MENU) + TITLE:=Appletalk protocol support + KCONFIG:= \ + CONFIG_ATALK \ + CONFIG_DEV_APPLETALK \ + CONFIG_IPDDP=n + FILES:=$(LINUX_DIR)/net/appletalk/appletalk.ko + AUTOLOAD:=$(call AutoLoad,40,appletalk) +endef + +define KernelPackage/appletalk/description + Kernel module for AppleTalk protocol. +endef + +$(eval $(call KernelPackage,appletalk)) + + define KernelPackage/bonding SUBMENU:=$(NETWORK_SUPPORT_MENU) TITLE:=Ethernet bonding driver From 35b7bbf35535aa60997a1d09b3ab15c492f39d59 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Tue, 22 Oct 2024 17:07:44 -0700 Subject: [PATCH 145/877] mxs: run kernel_oldconfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit small change. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/16913 Signed-off-by: Hauke Mehrtens (cherry picked from commit 55644397cd3cb3d8c77d74c9d22872502d091257) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- target/linux/mxs/config-6.6 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/linux/mxs/config-6.6 b/target/linux/mxs/config-6.6 index b954ea25486579..e01e266c0d3fdf 100644 --- a/target/linux/mxs/config-6.6 +++ b/target/linux/mxs/config-6.6 @@ -53,6 +53,7 @@ CONFIG_CPU_IDLE=y CONFIG_CPU_IDLE_GOV_LADDER=y CONFIG_CPU_IDLE_GOV_MENU=y CONFIG_CPU_LITTLE_ENDIAN=y +CONFIG_CPU_MITIGATIONS=y CONFIG_CPU_PABRT_LEGACY=y CONFIG_CPU_PM=y CONFIG_CPU_THUMB_CAPABLE=y @@ -70,6 +71,7 @@ CONFIG_CRYPTO_LIB_GF128MUL=y CONFIG_CRYPTO_LIB_SHA1=y CONFIG_CRYPTO_LIB_UTILS=y CONFIG_DEBUG_ALIGN_RODATA=y +CONFIG_DEBUG_INFO=y CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" CONFIG_DMADEVICES=y CONFIG_DMA_ENGINE=y @@ -84,6 +86,7 @@ CONFIG_EXTCON=y CONFIG_FEC=y CONFIG_FIXED_PHY=y CONFIG_FIX_EARLYCON_MEM=y +CONFIG_FORCE_NR_CPUS=y CONFIG_FS_IOMAP=y CONFIG_FS_MBCACHE=y CONFIG_FUNCTION_ALIGNMENT=0 @@ -206,6 +209,7 @@ CONFIG_PPS=y CONFIG_PREEMPT_NONE_BUILD=y CONFIG_PTP_1588_CLOCK=y CONFIG_PTP_1588_CLOCK_OPTIONAL=y +CONFIG_RANDSTRUCT_NONE=y CONFIG_RATIONAL=y CONFIG_REGULATOR=y CONFIG_REGULATOR_FIXED_VOLTAGE=y @@ -231,6 +235,7 @@ CONFIG_SPI=y CONFIG_SPI_MASTER=y CONFIG_SPI_MXS=y CONFIG_SPLIT_PTLOCK_CPUS=999999 +CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU=y CONFIG_STMP3XXX_RTC_WATCHDOG=y CONFIG_STMP_DEVICE=y CONFIG_SWPHY=y From 1b513604c3bdc4663ab6cb8ea8f850d967c94f7b Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Fri, 18 Oct 2024 19:19:50 -0700 Subject: [PATCH 146/877] mvebu: devm for mutex_init MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's common to avoid calling mutex_destroy when done. It's not correct strictly speaking. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/16753 Signed-off-by: Hauke Mehrtens (cherry picked from commit 6280b4abfbc087157bc233083a67a42bffa31010) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- ...-mfd-Add-a-driver-for-IEI-WT61P803-PUZZLE-MCU.patch | 10 +++++++--- ...-hwmon-Add-the-IEI-WT61P803-PUZZLE-HWMON-driv.patch | 6 ++++-- ...910-drivers-leds-wt61p803-puzzle-improvements.patch | 6 ++++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/target/linux/mvebu/patches-6.6/902-drivers-mfd-Add-a-driver-for-IEI-WT61P803-PUZZLE-MCU.patch b/target/linux/mvebu/patches-6.6/902-drivers-mfd-Add-a-driver-for-IEI-WT61P803-PUZZLE-MCU.patch index 1046b15e4b79dc..2aac515eb192da 100644 --- a/target/linux/mvebu/patches-6.6/902-drivers-mfd-Add-a-driver-for-IEI-WT61P803-PUZZLE-MCU.patch +++ b/target/linux/mvebu/patches-6.6/902-drivers-mfd-Add-a-driver-for-IEI-WT61P803-PUZZLE-MCU.patch @@ -54,7 +54,7 @@ Cc: Robert Marko obj-$(CONFIG_INTEL_SOC_PMIC_BXTWC) += intel_soc_pmic_bxtwc.o --- /dev/null +++ b/drivers/mfd/iei-wt61p803-puzzle.c -@@ -0,0 +1,908 @@ +@@ -0,0 +1,912 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* IEI WT61P803 PUZZLE MCU Driver + * System management microcontroller for fan control, temperature sensor reading, @@ -894,8 +894,12 @@ Cc: Robert Marko + mcu->serdev = serdev; + mcu->dev = dev; + init_completion(&mcu->reply->received); -+ mutex_init(&mcu->reply_lock); -+ mutex_init(&mcu->lock); ++ ret = devm_mutex_init(dev, &mcu->reply_lock); ++ if (ret) ++ return ret; ++ ret = devm_mutex_init(dev, &mcu->lock); ++ if (ret) ++ return ret; + + /* Setup UART interface */ + serdev_device_set_drvdata(serdev, mcu); diff --git a/target/linux/mvebu/patches-6.6/903-drivers-hwmon-Add-the-IEI-WT61P803-PUZZLE-HWMON-driv.patch b/target/linux/mvebu/patches-6.6/903-drivers-hwmon-Add-the-IEI-WT61P803-PUZZLE-HWMON-driv.patch index 983434e66620cf..eca2bb81e48d50 100644 --- a/target/linux/mvebu/patches-6.6/903-drivers-hwmon-Add-the-IEI-WT61P803-PUZZLE-HWMON-driv.patch +++ b/target/linux/mvebu/patches-6.6/903-drivers-hwmon-Add-the-IEI-WT61P803-PUZZLE-HWMON-driv.patch @@ -53,7 +53,7 @@ Cc: Robert Marko obj-$(CONFIG_SENSORS_IBMPOWERNV)+= ibmpowernv.o --- /dev/null +++ b/drivers/hwmon/iei-wt61p803-puzzle-hwmon.c -@@ -0,0 +1,445 @@ +@@ -0,0 +1,447 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* IEI WT61P803 PUZZLE MCU HWMON Driver + * @@ -457,7 +457,9 @@ Cc: Robert Marko + + mcu_hwmon->mcu = mcu; + platform_set_drvdata(pdev, mcu_hwmon); -+ mutex_init(&mcu_hwmon->lock); ++ ret = devm_mutex_init(dev, &mcu_hwmon->lock); ++ if (ret) ++ return ret; + + hwmon_dev = devm_hwmon_device_register_with_info(dev, "iei_wt61p803_puzzle", + mcu_hwmon, diff --git a/target/linux/mvebu/patches-6.6/910-drivers-leds-wt61p803-puzzle-improvements.patch b/target/linux/mvebu/patches-6.6/910-drivers-leds-wt61p803-puzzle-improvements.patch index 150a65498cd3d4..8de403773a0891 100644 --- a/target/linux/mvebu/patches-6.6/910-drivers-leds-wt61p803-puzzle-improvements.patch +++ b/target/linux/mvebu/patches-6.6/910-drivers-leds-wt61p803-puzzle-improvements.patch @@ -47,7 +47,7 @@ ret = iei_wt61p803_puzzle_write_command(priv->mcu, led_power_cmd, sizeof(led_power_cmd), -@@ -90,39 +106,166 @@ static enum led_brightness iei_wt61p803_ +@@ -90,39 +106,168 @@ static enum led_brightness iei_wt61p803_ return led_state; } @@ -194,7 +194,9 @@ + goto put_child_node; + } + -+ mutex_init(&priv->lock); ++ ret = devm_mutex_init(dev, &priv->lock); ++ if (ret) ++ goto put_child_node; + + dev_set_drvdata(dev, priv); + From 50ee6adc5a51fb9764cd0036bfd4af440189860f Mon Sep 17 00:00:00 2001 From: Vaclav Svoboda Date: Mon, 11 Nov 2024 22:34:00 +0100 Subject: [PATCH 147/877] ramips: mt76x8: Add support for Zbtlink ZBT-WE2426-B MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Zbtlink ZBT-WE2426-B is an indoor dual band WiFi router with 4 external non detachable antennas and 5 Fast Ethernet ports. Hardware of ZBT-WE2426-B: - SoC: MT7628AN - RAM: 64 MB (Winbond W9751G6K8-25) - Storage: 8 MB SPI flash (S25FL064K) - Ethernet: 5x 10/100 Mbps LAN1,LAN2,LAN3,LAN4 & WAN - Wireless: 2.4GHz: on SoC (802.11b/g/n) - Wireless: 5GHz: Mediatek MT7612EN (802.11n/ac) - LEDs: 8x - Buttons: 1x reset - USB: 1x 2.0 - MicroSD slot: 1x - Power: 9 VDC, 1 A - Uart: GND TX RX PWR - J1 on the PCB - Board silkscreen: "ZBT-WE2426-C V04" "2018-02-28" "CTT" "13 18" Backup the stock firmware, settings and calibration data: This router comes with PandoraBox OpenWrt firmware, so it is possible to get all MTD partitions using scp. Installation: - Using the bootloader web server. Hold the reset button while turning the power on. Upload the sysupgrade image on http://192.168.1.1. - Using the sysupgrade command in PandoraBox OpenWrt. LEDs: - LAN1,LAN2,LAN3,LAN4,WAN,WLAN2G use GPIO pins of the MT7628AN SoC (GPIOs 43,42,41,40,39,44) - WLAN5G uses pin of MT7612EN. - The POWER LED is directly connected to the VCC. It can be reconnected to the GPIO 37 of the MT7628AN SoC by resoldering SMD resistor on the PCB. Buttons: - The RESET button is connected to the GPIO 38 of the MT7628AN SoC. MAC addresses as verified by OEM firmware: use address source 2g *:b0 factory 0x4 (label) 5g *:b1 factory 0x8004 LAN *:b2 factory 0x28 WAN *:b3 factory 0x2e Signed-off-by: Vaclav Svoboda Link: https://github.com/openwrt/openwrt/pull/16927 Signed-off-by: Hauke Mehrtens (cherry picked from commit 3a9752ea027b8969750c0dd7f89b6afc357dcffa) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- .../dts/mt7628an_zbtlink_zbt-we2426-b.dts | 183 ++++++++++++++++++ target/linux/ramips/image/mt76x8.mk | 8 + .../mt76x8/base-files/etc/board.d/01_leds | 7 + .../mt76x8/base-files/etc/board.d/02_network | 6 +- 4 files changed, 202 insertions(+), 2 deletions(-) create mode 100644 target/linux/ramips/dts/mt7628an_zbtlink_zbt-we2426-b.dts diff --git a/target/linux/ramips/dts/mt7628an_zbtlink_zbt-we2426-b.dts b/target/linux/ramips/dts/mt7628an_zbtlink_zbt-we2426-b.dts new file mode 100644 index 00000000000000..6dfdb2617c36b2 --- /dev/null +++ b/target/linux/ramips/dts/mt7628an_zbtlink_zbt-we2426-b.dts @@ -0,0 +1,183 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7628an.dtsi" + +#include +#include +#include + +/ { + compatible = "zbtlink,zbt-we2426-b", "mediatek,mt7628an-soc"; + model = "Zbtlink ZBT-WE2426-B"; + + aliases { + led-boot = &led_wlan; + led-failsafe = &led_wlan; + led-upgrade = &led_wlan; + label-mac-device = &wmac; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 38 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + }; + + leds { + compatible = "gpio-leds"; + + lan1 { + gpios = <&gpio 43 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <1>; + }; + + lan2 { + gpios = <&gpio 42 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <2>; + }; + + lan3 { + gpios = <&gpio 41 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <3>; + }; + + lan4 { + gpios = <&gpio 40 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <4>; + }; + + wan { + gpios = <&gpio 39 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_WAN; + }; + + led_wlan: wlan2g { + gpios = <&gpio 44 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_WLAN; + linux,default-trigger = "phy0tpt"; + }; + + }; +}; + +&spi0 { + status = "okay"; + + 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 = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x400>; + }; + + eeprom_factory_8000: eeprom@8000 { + reg = <0x8000 0x200>; + }; + + macaddr_factory_28: macaddr@28 { + reg = <0x28 0x6>; + }; + }; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; + }; + }; +}; + +&state_default { + gpio { + groups = "i2s", "refclk", "wdt", "p4led_an", + "p3led_an", "p2led_an", + "p1led_an", "p0led_an", + "wled_an"; + function = "gpio"; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + nvmem-cells = <&eeprom_factory_8000>; + nvmem-cell-names = "eeprom"; + ieee80211-freq-limit = <5000000 6000000>; + + led { + led-sources = <2>; + led-active-low; + }; + }; +}; + +&wmac { + status = "okay"; + + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; +}; + +ðernet { + nvmem-cells = <&macaddr_factory_28>; + nvmem-cell-names = "mac-address"; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&sdhci { + status = "okay"; +}; diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk index 8ad840ddfead64..7e343bf0164fb0 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -1158,6 +1158,14 @@ define Device/zbtlink_zbt-we1226 endef TARGET_DEVICES += zbtlink_zbt-we1226 +define Device/zbtlink_zbt-we2426-b + IMAGE_SIZE := 7872k + DEVICE_VENDOR := Zbtlink + DEVICE_MODEL := ZBT-WE2426-B + DEVICE_PACKAGES := kmod-mt76x2 kmod-usb2 kmod-usb-ohci +endef +TARGET_DEVICES += zbtlink_zbt-we2426-b + define Device/zyxel_keenetic-extra-ii IMAGE_SIZE := 29824k DEVICE_VENDOR := Zyxel diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds index 5ea668de012624..00e5086bb3fea5 100644 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds @@ -186,6 +186,13 @@ zbtlink,zbt-we1226) ucidef_set_led_switch "lan2" "LAN2" "green:lan2" "switch0" "0x02" ucidef_set_led_switch "wan" "WAN" "green:wan" "switch0" "0x10" ;; +zbtlink,zbt-we2426-b) + ucidef_set_led_switch "wan" "wan" "green:wan" "switch0" "0x10" + ucidef_set_led_switch "lan1" "lan1" "green:lan-1" "switch0" "0x01" + ucidef_set_led_switch "lan2" "lan2" "green:lan-2" "switch0" "0x02" + ucidef_set_led_switch "lan3" "lan3" "green:lan-3" "switch0" "0x04" + ucidef_set_led_switch "lan4" "lan4" "green:lan-4" "switch0" "0x08" + ;; zyxel,keenetic-extra-ii) ucidef_set_led_netdev "wifi_led" "wifi" "green:wifi" "wlan0" ucidef_set_led_switch "internet" "internet" "green:internet" "switch0" "0x01" diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network index cb0983b9dc133b..616baa80c055c7 100644 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network @@ -148,7 +148,8 @@ ramips_setup_interfaces() netgear,r6020|\ netgear,r6080|\ netgear,r6120|\ - wavlink,wl-wn531a3) + wavlink,wl-wn531a3|\ + zbtlink,zbt-we2426-b) ucidef_add_switch "switch0" \ "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan" "6@eth0" ;; @@ -244,7 +245,8 @@ ramips_setup_macs() hilink,hlk-7688a|\ wavlink,wl-wn531a3|\ wavlink,wl-wn577a2|\ - wavlink,wl-wn578a2) + wavlink,wl-wn578a2|\ + zbtlink,zbt-we2426-b) wan_mac=$(mtd_get_mac_binary factory 0x2e) label_mac=$(mtd_get_mac_binary factory 0x4) ;; From 1e0f790d2381c3c9bf19471b191fdf42cd454441 Mon Sep 17 00:00:00 2001 From: Tim Noack Date: Mon, 21 Oct 2024 12:21:41 +0000 Subject: [PATCH 148/877] ath79: refactor dts of TP-Link CPE710-v1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is done in preparation of adding support for the CPE710-v2, which uses a similiar device tree. Signed-off-by: Tim Noack Link: https://github.com/openwrt/openwrt/pull/16637 Signed-off-by: Hauke Mehrtens (cherry picked from commit 832cc8ce04122ea726178687b5168187b2465f7f) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- .../ath79/dts/qca9563_tplink_cpe710-v1.dts | 151 +---------------- .../ath79/dts/qca9563_tplink_cpe710.dtsi | 160 ++++++++++++++++++ 2 files changed, 161 insertions(+), 150 deletions(-) create mode 100644 target/linux/ath79/dts/qca9563_tplink_cpe710.dtsi diff --git a/target/linux/ath79/dts/qca9563_tplink_cpe710-v1.dts b/target/linux/ath79/dts/qca9563_tplink_cpe710-v1.dts index 6d1b58f95fae48..31e04232ab6c5a 100644 --- a/target/linux/ath79/dts/qca9563_tplink_cpe710-v1.dts +++ b/target/linux/ath79/dts/qca9563_tplink_cpe710-v1.dts @@ -1,151 +1,13 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -#include "qca956x.dtsi" - -#include -#include -#include +#include "qca9563_tplink_cpe710.dtsi" / { model = "TP-Link CPE710 v1"; compatible = "tplink,cpe710-v1", "qca,qca9563"; - - aliases { - label-mac-device = ð0; - led-boot = &led_lan; - led-failsafe = &led_lan; - led-upgrade = &led_lan; - }; - - leds { - compatible = "gpio-leds"; - - led_lan: lan { - function = LED_FUNCTION_LAN; - color = ; - gpios = <&gpio 5 GPIO_ACTIVE_LOW>; - }; - - wlan5g { - label = "blue:wlan5g"; - gpios = <&gpio 1 GPIO_ACTIVE_LOW>; - linux,default-trigger = "phy0tpt"; - }; - }; - - keys { - compatible = "gpio-keys"; - - reset { - label = "Reset button"; - linux,code = ; - gpios = <&gpio 2 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - }; -}; - -&pcie { - status = "okay"; - - wifi@0,0 { - compatible = "qcom,ath10k"; - reg = <0x0000 0 0 0 0>; - nvmem-cells = <&precal_art_5000>, <&macaddr_info_8>; - nvmem-cell-names = "pre-calibration", "mac-address"; - }; -}; - -&spi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <40000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x000000 0x040000>; - read-only; - }; - - partition@40000 { - label = "u-boot-env"; - reg = <0x040000 0x010000>; - }; - - partition@50000 { - label = "partition-table"; - reg = <0x050000 0x010000>; - read-only; - }; - - info: partition@60000 { - label = "info"; - reg = <0x060000 0x010000>; - read-only; - - nvmem-layout { - compatible = "fixed-layout"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_info_8: macaddr@8 { - reg = <0x8 0x6>; - }; - }; - }; - - partition@70000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x070000 0xf50000>; - }; - - partition@fc0000 { - label = "config"; - reg = <0xfc0000 0x030000>; - read-only; - }; - - partition@ff0000 { - label = "art"; - reg = <0xff0000 0x010000>; - read-only; - - nvmem-layout { - compatible = "fixed-layout"; - #address-cells = <1>; - #size-cells = <1>; - - precal_art_5000: pre-calibration@5000 { - reg = <0x5000 0x2f20>; - }; - }; - }; - }; - }; -}; - -&pinmux { - mdio_pins: mdio_pins { - /* GPIO 10 as MDIO(0x20), GPIO 8 as MDC(0x21) */ - pinctrl-single,bits = <0x8 0x00200021 0x00ff00ff>; - }; }; &mdio0 { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&mdio_pins>; - phy4: ethernet-phy@4 { reg = <4>; reset-gpios = <&gpio 11 GPIO_ACTIVE_LOW>; @@ -153,17 +15,6 @@ }; ð0 { - status = "okay"; - phy-handle = <&phy4>; phy-mode = "sgmii"; - - nvmem-cells = <&macaddr_info_8>; - nvmem-cell-names = "mac-address"; - - qca956x-serdes-fixup; - - gmac-config { - device = <&gmac>; - }; }; diff --git a/target/linux/ath79/dts/qca9563_tplink_cpe710.dtsi b/target/linux/ath79/dts/qca9563_tplink_cpe710.dtsi new file mode 100644 index 00000000000000..9de36f3b6635f5 --- /dev/null +++ b/target/linux/ath79/dts/qca9563_tplink_cpe710.dtsi @@ -0,0 +1,160 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca956x.dtsi" + +#include +#include +#include + +/ { + aliases { + led-boot = &led_lan; + led-failsafe = &led_lan; + led-upgrade = &led_lan; + label-mac-device = ð0; + }; + + leds { + compatible = "gpio-leds"; + + led_lan: lan { + function = LED_FUNCTION_LAN; + color = ; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + }; + + wlan5g { + color = ; + function = LED_FUNCTION_WLAN_5GHZ; + gpios = <&gpio 1 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "Reset button"; + linux,code = ; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; +}; + +&pcie { + status = "okay"; + + wifi@0,0 { + compatible = "qcom,ath10k"; + reg = <0x0000 0 0 0 0>; + nvmem-cells = <&precal_art_5000>, <&macaddr_info_8>; + nvmem-cell-names = "pre-calibration", "mac-address"; + }; +}; + +&spi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <40000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x000000 0x040000>; + read-only; + }; + + partition@40000 { + label = "u-boot-env"; + reg = <0x040000 0x010000>; + read-only; + }; + + partition@50000 { + label = "partition-table"; + reg = <0x050000 0x010000>; + read-only; + }; + + partition@60000 { + label = "info"; + reg = <0x060000 0x010000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_info_8: macaddr@8 { + reg = <0x8 0x6>; + }; + }; + }; + + partition@70000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x070000 0xf50000>; + }; + + partition@fc0000 { + label = "config"; + reg = <0xfc0000 0x030000>; + read-only; + }; + + partition@ff0000 { + label = "art"; + reg = <0xff0000 0x010000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + precal_art_5000: pre-calibration@5000 { + reg = <0x5000 0x2f20>; + }; + }; + }; + }; + }; +}; + +&pinmux { + mdio_pins: mdio_pins { + /* GPIO 10 as MDIO(0x20), GPIO 8 as MDC(0x21) */ + pinctrl-single,bits = <0x8 0x00200021 0x00ff00ff>; + }; +}; + +&mdio0 { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&mdio_pins>; +}; + +ð0 { + status = "okay"; + + nvmem-cells = <&macaddr_info_8>; + nvmem-cell-names = "mac-address"; + + qca956x-serdes-fixup; + + gmac-config { + device = <&gmac>; + }; +}; From 0b4d831886689b55e149e276dbca5b780fb6a00e Mon Sep 17 00:00:00 2001 From: Tim Noack Date: Mon, 21 Oct 2024 12:21:59 +0000 Subject: [PATCH 149/877] ath79: add support for TP-Link CPE710-v2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TP-Link CPE710-v2 is an outdoor wireless CPE for 5 GHz with one Ethernet port based on the AP152 reference board. Compared to the CPE710-v1, the only change observed in hardware is that the mdio address of the ethernet physical changed from 0x4 to 0x0. Specifications: - SoC: QCA9563-AL3A MIPS 74kc @ 775MHz, AHB @ 258MHz - RAM: 128MiB DDR2 @ 650MHz - Flash: 16MiB SPI NOR Based on the GD25Q128 - Wi-Fi 5Ghz: ath10k chip (802.11ac for up to 867Mbps on 5GHz wireless data rate), based on the QCA9896 - Ethernet: one 1GbE port - 23dBi high-gain directional 2×2 MIMO parabolic antenna - Power, LAN, WLAN5G Blue LEDs Flashing instructions: Flash factory image through stock firmware WEB UI or through TFTP To get to TFTP recovery just hold reset button while powering on for around 30-40 seconds and release. Rename factory image to recovery.bin Stock TFTP server IP:192.168.0.100 Stock device TFTP address:192.168.0.254 Signed-off-by: Tim Noack Link: https://github.com/openwrt/openwrt/pull/16637 Signed-off-by: Hauke Mehrtens (cherry picked from commit 5572e0196a93604716ec36ebb8db6737fc6677aa) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- .../ath79/dts/qca9563_tplink_cpe710-v2.dts | 20 +++++++++++++++++++ .../generic/base-files/etc/board.d/01_leds | 3 ++- .../generic/base-files/etc/board.d/02_network | 1 + target/linux/ath79/image/generic-tp-link.mk | 11 ++++++++++ 4 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 target/linux/ath79/dts/qca9563_tplink_cpe710-v2.dts diff --git a/target/linux/ath79/dts/qca9563_tplink_cpe710-v2.dts b/target/linux/ath79/dts/qca9563_tplink_cpe710-v2.dts new file mode 100644 index 00000000000000..fe277fc549d5b5 --- /dev/null +++ b/target/linux/ath79/dts/qca9563_tplink_cpe710-v2.dts @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca9563_tplink_cpe710.dtsi" + +/ { + model = "TP-Link CPE710 v2"; + compatible = "tplink,cpe710-v2", "qca,qca9563"; +}; + +&mdio0 { + phy0: ethernet-phy@0 { + reg = <0>; + reset-gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + }; +}; + +ð0 { + phy-handle = <&phy0>; + phy-mode = "sgmii"; +}; 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 0e5731dd743186..6409adb78ad825 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 @@ -222,7 +222,8 @@ openmesh,mr900-v1|\ openmesh,mr900-v2|\ openmesh,mr1750-v1|\ openmesh,mr1750-v2|\ -tplink,cpe710-v1) +tplink,cpe710-v1|\ +tplink,cpe710-v2) ucidef_set_led_netdev "lan" "LAN" "blue:lan" "eth0" ;; compex,wpj344-16m|\ 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 8f79a3fad8114d..2bd97442d956dc 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 @@ -89,6 +89,7 @@ ath79_setup_interfaces() tplink,cpe610-v1|\ tplink,cpe610-v2|\ tplink,cpe710-v1|\ + tplink,cpe710-v2|\ tplink,eap225-outdoor-v1|\ tplink,eap225-outdoor-v3|\ tplink,eap225-v1|\ diff --git a/target/linux/ath79/image/generic-tp-link.mk b/target/linux/ath79/image/generic-tp-link.mk index 643de76f7c2ba7..c42338db783203 100644 --- a/target/linux/ath79/image/generic-tp-link.mk +++ b/target/linux/ath79/image/generic-tp-link.mk @@ -391,6 +391,17 @@ define Device/tplink_cpe710-v1 endef TARGET_DEVICES += tplink_cpe710-v1 +define Device/tplink_cpe710-v2 + $(Device/tplink-safeloader-uimage) + SOC := qca9563 + IMAGE_SIZE := 15680k + DEVICE_MODEL := CPE710 + DEVICE_VARIANT := v2 + DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca9888-ct + TPLINK_BOARD_ID := CPE710V2 +endef +TARGET_DEVICES += tplink_cpe710-v2 + define Device/tplink-eap2x5 $(Device/tplink-safeloader) LOADER_TYPE := elf From 25973eab22e0f30bcdfd9ff93951136d5eff88ee Mon Sep 17 00:00:00 2001 From: Joerg Bayer Date: Sat, 13 Apr 2024 16:05:24 +0200 Subject: [PATCH 150/877] linux-firmware: Add support for Intel AX411 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for Intel AX411 CNVio2 device. Signed-off-by: Joerg Bayer Link: https://github.com/openwrt/openwrt/pull/15153 [squashed and updated commit description, update to version 89] Signed-off-by: Hauke Mehrtens (cherry picked from commit c89ed7acc897794b06b61f10d8f641ee06fbaacf) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/firmware/linux-firmware/intel.mk | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/package/firmware/linux-firmware/intel.mk b/package/firmware/linux-firmware/intel.mk index 4c9e04cd3d344c..eb5ac29159aecf 100644 --- a/package/firmware/linux-firmware/intel.mk +++ b/package/firmware/linux-firmware/intel.mk @@ -199,6 +199,14 @@ define Package/iwlwifi-firmware-ax210/install endef $(eval $(call BuildPackage,iwlwifi-firmware-ax210)) +Package/iwlwifi-firmware-ax411 = $(call Package/firmware-default,Intel AX411 firmware) +define Package/iwlwifi-firmware-ax411/install + $(INSTALL_DIR) $(1)/lib/firmware + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-so-a0-gf4-a0-89.ucode $(1)/lib/firmware + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-so-a0-gf4-a0.pnvm $(1)/lib/firmware +endef +$(eval $(call BuildPackage,iwlwifi-firmware-ax411)) + Package/iwlwifi-firmware-be200 = $(call Package/firmware-default,Intel BE200 firmware) define Package/iwlwifi-firmware-be200/install $(INSTALL_DIR) $(1)/lib/firmware From a07c241b81542ada0ebd7aaacafcd346a23593b8 Mon Sep 17 00:00:00 2001 From: George Oldfort Date: Mon, 11 Nov 2024 09:25:56 +0100 Subject: [PATCH 151/877] mediatek: split Acer/W6 dts into W6 common dtsi and device specific dts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In order to prepare OpenWrt support for other Acer W6 devices, this commit moves all device tree components that are used by all Acer W6/W6e/W6d/W6m routers from mt7986a-acer-predator-w6.dts to mt7986a-acer-w6-common.dtsi (new file) and includes this dtsi file in mt7986a-acer-predator-w6.dts. Minor changes had to be made to the device tree in order to improve clarity and – notably – to reduce the number of dtc warnings: - replace (obviously wrong) led@ gpio led entities by led- - remove unnecessary (default-state = "off") gpio led statements - rename entity “memory” to “memory@0” - add missing #address-cells and #address-size in /soc/mmc@11230000 - add missing #address-cells and #address-size in /soc/pcie@11280000 - introduce symbols “nvmem” and “swport0” in dtsi (referenced in dts) The changes were checked with `diff -BEZbdtwy --suppress-common-lines ...` (comparing two dts files created using old and new fdt-1 blobs again), see https://github.com/openwrt/openwrt/pull/16861/#issuecomment-2455680020 . This is the first of four commits into which the original commit was split to make reviews easier and more targeted. Signed-off-by: George Oldfort Link: https://github.com/openwrt/openwrt/pull/16861 Signed-off-by: Hauke Mehrtens (cherry picked from commit ce3b36b3d5374709b9b091390cb9053657be17fa) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- .../mediatek/dts/mt7986a-acer-predator-w6.dts | 475 ++---------------- .../mediatek/dts/mt7986a-acer-w6-common.dtsi | 387 ++++++++++++++ 2 files changed, 430 insertions(+), 432 deletions(-) create mode 100644 target/linux/mediatek/dts/mt7986a-acer-w6-common.dtsi diff --git a/target/linux/mediatek/dts/mt7986a-acer-predator-w6.dts b/target/linux/mediatek/dts/mt7986a-acer-predator-w6.dts index c27264a8d2e84c..8c86fd31d85459 100644 --- a/target/linux/mediatek/dts/mt7986a-acer-predator-w6.dts +++ b/target/linux/mediatek/dts/mt7986a-acer-predator-w6.dts @@ -1,11 +1,7 @@ -// SPDX-License-Identifier: (GPL-2.0 OR MIT) +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/; -#include -#include -#include - -#include "mt7986a.dtsi" +#include "mt7986a-acer-w6-common.dtsi" / { model = "Acer Predator W6"; @@ -19,531 +15,146 @@ 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 { + led_status: led-0 { label = "ant0:red"; gpios = <&pio 1 GPIO_ACTIVE_HIGH>; - default-state = "off"; }; - led@1 { + led-1 { label = "ant0:green"; gpios = <&pio 2 GPIO_ACTIVE_HIGH>; - default-state = "off"; }; - led@2 { + led-2 { label = "ant0:blue"; gpios = <&pio 36 GPIO_ACTIVE_HIGH>; - default-state = "off"; }; - led@3 { + led-3 { label = "ant1:red"; gpios = <&pio 35 GPIO_ACTIVE_HIGH>; - default-state = "off"; }; - led@4 { + led-4 { label = "ant1:green"; gpios = <&pio 34 GPIO_ACTIVE_HIGH>; - default-state = "off"; }; - led@5 { + led-5 { label = "ant1:blue"; gpios = <&pio 33 GPIO_ACTIVE_HIGH>; - default-state = "off"; }; - led@6 { + led-6 { label = "ant2:red"; gpios = <&pio 38 GPIO_ACTIVE_HIGH>; - default-state = "off"; }; - led@7 { + led-7 { label = "ant2:green"; gpios = <&pio 37 GPIO_ACTIVE_HIGH>; - default-state = "off"; }; - led@8 { + led-8 { label = "ant2:blue"; gpios = <&pio 26 GPIO_ACTIVE_HIGH>; - default-state = "off"; }; - led@9 { + led-9 { label = "ant3:red"; gpios = <&pio 25 GPIO_ACTIVE_HIGH>; - default-state = "off"; }; - led@10 { + led-10 { label = "ant3:green"; gpios = <&pio 24 GPIO_ACTIVE_HIGH>; - default-state = "off"; }; - led@11 { + led-11 { label = "ant3:blue"; gpios = <&pio 23 GPIO_ACTIVE_HIGH>; - default-state = "off"; }; - led@12 { + led-12 { label = "ant4:red"; gpios = <&pio 28 GPIO_ACTIVE_HIGH>; - default-state = "off"; }; - led@13 { + led-13 { label = "ant4:green"; gpios = <&pio 27 GPIO_ACTIVE_HIGH>; - default-state = "off"; }; - led@14 { + led-14 { label = "ant4:blue"; gpios = <&pio 32 GPIO_ACTIVE_HIGH>; - default-state = "off"; }; - led@15 { + led-15 { label = "ant5:red"; gpios = <&pio 45 GPIO_ACTIVE_HIGH>; - default-state = "off"; }; - led@16 { + led-16 { label = "ant5:green"; gpios = <&pio 44 GPIO_ACTIVE_HIGH>; - default-state = "off"; }; - led@17 { + led-17 { label = "ant5:blue"; gpios = <&pio 43 GPIO_ACTIVE_HIGH>; - default-state = "off"; }; }; - }; -ð { +&ssusb { + vusb33-supply = <®_3p3v>; + vbus-supply = <®_5v>; status = "okay"; +}; - gmac0: mac@0 { - /* LAN */ - compatible = "mediatek,eth-mac"; - reg = <0>; - phy-mode = "2500base-x"; +&nvmem { + eeprom_factory_a0000: eeprom@a0000 { + reg = <0xa0000 0x1000>; + }; +}; - fixed-link { - speed = <2500>; - full-duplex; - pause; - }; +&slot0 { + radio0: mt7915@0,0 { + reg = <0x0000 0 0 0 0>; + nvmem-cells = <&eeprom_factory_a0000>; + nvmem-cell-names = "eeprom"; }; +}; +&usb_phy { + status = "okay"; +}; + +ð { 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 */ + /* LED0: nc ; LED1: nc ; LED2: amber ; LED3: green */ mxl,led-config = <0x0 0x0 0x370 0x80>; }; - - switch: switch@1f { - 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"; - phy-handle = <&swphy0>; - }; - - port@1 { - reg = <1>; - label = "lan1"; - phy-handle = <&swphy1>; - }; - - port@2 { - reg = <2>; - label = "lan2"; - phy-handle = <&swphy2>; - }; - - port@3 { - reg = <3>; - label = "lan3"; - phy-handle = <&swphy3>; - }; - - 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>; - - swphy0: 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 */ - >; - }; - - swphy1: 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 */ - >; - }; - - swphy2: 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 */ - >; - }; - - swphy3: 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 { - nvmem-cells = <&eeprom_factory_0>; - nvmem-cell-names = "eeprom"; - pinctrl-names = "default", "dbdc"; - pinctrl-0 = <&wf_2g_5g_pins>; - pinctrl-1 = <&wf_dbdc_pins>; - status = "okay"; -}; - -&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; - - card@0 { - compatible = "mmc-card"; - reg = <0>; - - block { - compatible = "block-device"; - - partitions { - block-partition-factory { - partname = "factory"; - - nvmem-layout { - compatible = "fixed-layout"; - #address-cells = <1>; - #size-cells = <1>; - - eeprom_factory_0: eeprom@0 { - reg = <0x0 0x1000>; - }; - - eeprom_factory_a0000: eeprom@a0000 { - reg = <0xa0000 0x1000>; - }; - }; - }; - }; - }; - }; -}; - -&pcie { - pinctrl-names = "default"; - pinctrl-0 = <&pcie_pins>; - status = "okay"; - - slot0: pcie@0,0 { - reg = <0x0000 0 0 0 0>; - - radio0: mt7915@0,0 { - reg = <0x0000 0 0 0 0>; - - nvmem-cells = <&eeprom_factory_a0000>; - nvmem-cell-names = "eeprom"; - }; - }; -}; - -&pcie_phy { - status = "okay"; +&swport0 { + label = "game"; }; diff --git a/target/linux/mediatek/dts/mt7986a-acer-w6-common.dtsi b/target/linux/mediatek/dts/mt7986a-acer-w6-common.dtsi new file mode 100644 index 00000000000000..cca03684fb6f79 --- /dev/null +++ b/target/linux/mediatek/dts/mt7986a-acer-w6-common.dtsi @@ -0,0 +1,387 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include +#include +#include + +#include "mt7986a.dtsi" + +/ { + 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@0 { + 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>; + }; + }; +}; + +&watchdog { + 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_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>; + }; + }; +}; + +&trng { + status = "okay"; +}; + +&crypto { + status = "okay"; +}; + +&uart0 { + 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; + #address-cells = <1>; + #size-cells = <0>; + + card@0 { + compatible = "mmc-card"; + reg = <0>; + + block { + compatible = "block-device"; + + partitions { + block-partition-factory { + partname = "factory"; + + nvmem: nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x1000>; + }; + }; + }; + }; + }; + }; +}; + +&pcie { + pinctrl-names = "default"; + pinctrl-0 = <&pcie_pins>; + status = "okay"; + + slot0: pcie@0,0 { + reg = <0x0000 0 0 0 0>; + #address-cells = <0x03>; + #size-cells = <0x02>; + }; +}; + +&pcie_phy { + status = "okay"; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + 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: switch@1f { + compatible = "mediatek,mt7531"; + reg = <31>; + reset-gpios = <&pio 5 GPIO_ACTIVE_HIGH>; + reset-assert-us = <10000>; + reset-deassert-us = <10000>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + swport0: port@0 { + reg = <0>; + phy-handle = <&swphy0>; + }; + + port@1 { + reg = <1>; + label = "lan1"; + phy-handle = <&swphy1>; + }; + + port@2 { + reg = <2>; + label = "lan2"; + phy-handle = <&swphy2>; + }; + + port@3 { + reg = <3>; + label = "lan3"; + phy-handle = <&swphy3>; + }; + + 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>; + + swphy0: 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 */ + >; + }; + + swphy1: 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 */ + >; + }; + + swphy2: 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 */ + >; + }; + + swphy3: 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 { + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; + pinctrl-names = "default", "dbdc"; + pinctrl-0 = <&wf_2g_5g_pins>; + pinctrl-1 = <&wf_dbdc_pins>; + status = "okay"; +}; From fd0f608d66b30be1eef5a1dc4bb61e3540736be3 Mon Sep 17 00:00:00 2001 From: George Oldfort Date: Mon, 11 Nov 2024 10:14:55 +0100 Subject: [PATCH 152/877] mediatek: make use of Acer Predator Connect W6's u-boot environment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In order to prepare OpenWrt support for other Acer W6 devices and to adapt the procedure to read and set mac addresses which other devices of the same target are using (instead of needing an additional script and creating an additional structure in the file system), this commit - reads device mac addresses from u-boot environment - avoids the detour via the file system to set the mac addresses - drops redundant file /lib/preinit/05_extract_factory_data.sh The idea and the implementation were thankfully taken from PR #16410. This is the second of four commits into which the original commit was split to make reviews easier and more targeted. Signed-off-by: George Oldfort Link: https://github.com/openwrt/openwrt/pull/16861 Signed-off-by: Hauke Mehrtens (cherry picked from commit e7aaba2587e57dbd157899f7a2215ec6b7af5f89) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- .../uboot-envtools/files/mediatek_filogic | 15 +++++------ .../filogic/base-files/etc/board.d/02_network | 4 +++ .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 7 +++--- .../lib/preinit/05_extract_factory_data.sh | 25 ------------------- .../base-files/lib/preinit/10_fix_eth_mac.sh | 13 +++++----- 5 files changed, 22 insertions(+), 42 deletions(-) delete mode 100644 target/linux/mediatek/filogic/base-files/lib/preinit/05_extract_factory_data.sh diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index 9de1a4d75ddc96..7571af002094ea 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -49,6 +49,14 @@ xiaomi,redmi-router-ax6000-ubootmod|\ zyxel,ex5601-t0-ubootmod) ubootenv_add_ubi_default ;; +acer,predator-w6|\ +glinet,gl-mt2500|\ +glinet,gl-mt6000|\ +glinet,gl-x3000|\ +glinet,gl-xe3000) + local envdev=$(find_mmc_part "u-boot-env") + ubootenv_add_uci_config "$envdev" "0x0" "0x80000" + ;; asus,rt-ax59u) ubootenv_add_uci_config "/dev/mtd0" "0x100000" "0x20000" "0x20000" ;; @@ -89,13 +97,6 @@ dlink,aquila-pro-ai-m30-a1) gatonetworks,gdsp) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000" ;; -glinet,gl-x3000|\ -glinet,gl-xe3000|\ -glinet,gl-mt2500|\ -glinet,gl-mt6000) - local envdev=$(find_mmc_part "u-boot-env") - ubootenv_add_uci_config "$envdev" "0x0" "0x80000" - ;; glinet,gl-mt3000) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000" ;; 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 fff39006da82bc..2bcead83045912 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 @@ -132,6 +132,10 @@ mediatek_setup_macs() local label_mac="" case $board in + acer,predator-w6) + wan_mac=$(mmc_get_mac_ascii u-boot-env WANMAC) + lan_mac=$(mmc_get_mac_ascii u-boot-env LANMAC) + ;; bananapi,bpi-r3|\ bananapi,bpi-r3-mini|\ bananapi,bpi-r4) 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 3042858353a7cf..f7f00c9a83bd71 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 @@ -18,10 +18,9 @@ case "$board" in [ "$PHYNBR" = "1" ] && macaddr_setbit_la $addr > /sys${DEVPATH}/macaddress ;; 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 + [ "$PHYNBR" = "0" ] && mmc_get_mac_ascii u-boot-env 2gMAC > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && mmc_get_mac_ascii u-boot-env 6gMAC > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "2" ] && mmc_get_mac_ascii u-boot-env 5gMAC > /sys${DEVPATH}/macaddress ;; asus,rt-ax59u) CI_UBIPART="UBI_DEV" 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 deleted file mode 100644 index 87287a7d1c1c98..00000000000000 --- a/target/linux/mediatek/filogic/base-files/lib/preinit/05_extract_factory_data.sh +++ /dev/null @@ -1,25 +0,0 @@ -. /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 0497d7dfa2474f..0d7da89ceaabf5 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 @@ -3,12 +3,13 @@ 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)" + $(mmc_get_mac_ascii u-boot-env WANMAC) + $(mmc_get_mac_ascii u-boot-env LANMAC) + ip link set dev lan1 address "$lan_mac" + ip link set dev lan2 address "$lan_mac" + ip link set dev lan3 address "$lan_mac" + ip link set dev game address "$lan_mac" + ip link set dev eth1 address "$wan_mac" ;; asus,tuf-ax4200|\ asus,tuf-ax6000) From d491100f01aea270557b151a8ead3a82b785eea7 Mon Sep 17 00:00:00 2001 From: George Oldfort Date: Mon, 11 Nov 2024 10:40:45 +0100 Subject: [PATCH 153/877] mediatek: improve device tree for Acer Predator Connect W6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In order to prepare for OpenWrt support other Acer W6 devices and to get a step further to full hardware support for Acer Predator Connect W6, this commit - adjusts the product name ("Acer Predator Connect W6") - updates gpio LED labels to function/color scheme - show router status by using first rgb led instead of it's red color only (blue: booting/failsafe mode; red: sysupgrade; green: running – was: red) - changes switch/eth1 led configuration to reflect RX/TX activity and speed (green: full 1Gbps/2.5Gbps speed; amber: lower speed; blink: RX/TX) - shortens dummy dm-mod.create string in bootargs - enables W6's i2c interface This is the third of four commits into which the original commit was split to make reviews easier and more targeted. Signed-off-by: George Oldfort Link: https://github.com/openwrt/openwrt/pull/16861 Signed-off-by: Hauke Mehrtens (cherry picked from commit d42075dcefa407a03a30663879688475bb912729) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- .../mediatek/dts/mt7986a-acer-predator-w6.dts | 90 +++++++++++++------ .../mediatek/dts/mt7986a-acer-w6-common.dtsi | 47 ++++++---- target/linux/mediatek/image/filogic.mk | 2 +- 3 files changed, 94 insertions(+), 45 deletions(-) diff --git a/target/linux/mediatek/dts/mt7986a-acer-predator-w6.dts b/target/linux/mediatek/dts/mt7986a-acer-predator-w6.dts index 8c86fd31d85459..5002326d70fbce 100644 --- a/target/linux/mediatek/dts/mt7986a-acer-predator-w6.dts +++ b/target/linux/mediatek/dts/mt7986a-acer-predator-w6.dts @@ -4,107 +4,143 @@ #include "mt7986a-acer-w6-common.dtsi" / { - model = "Acer Predator W6"; + model = "Acer Predator Connect 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; + led-boot = &led_status_blue; + led-failsafe = &led_status_blue; + led-running = &led_status_green; + led-upgrade = &led_status_red; }; leds { compatible = "gpio-leds"; - led_status: led-0 { - label = "ant0:red"; + led_status_red: led-0 { + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <0>; gpios = <&pio 1 GPIO_ACTIVE_HIGH>; }; - led-1 { - label = "ant0:green"; + led_status_green: led-1 { + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <0>; gpios = <&pio 2 GPIO_ACTIVE_HIGH>; }; - led-2 { - label = "ant0:blue"; + led_status_blue: led-2 { + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <0>; gpios = <&pio 36 GPIO_ACTIVE_HIGH>; }; led-3 { - label = "ant1:red"; + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <1>; gpios = <&pio 35 GPIO_ACTIVE_HIGH>; }; led-4 { - label = "ant1:green"; + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <1>; gpios = <&pio 34 GPIO_ACTIVE_HIGH>; }; led-5 { - label = "ant1:blue"; + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <1>; gpios = <&pio 33 GPIO_ACTIVE_HIGH>; }; led-6 { - label = "ant2:red"; + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <2>; gpios = <&pio 38 GPIO_ACTIVE_HIGH>; }; led-7 { - label = "ant2:green"; + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <2>; gpios = <&pio 37 GPIO_ACTIVE_HIGH>; }; led-8 { - label = "ant2:blue"; + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <2>; gpios = <&pio 26 GPIO_ACTIVE_HIGH>; }; led-9 { - label = "ant3:red"; + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <3>; gpios = <&pio 25 GPIO_ACTIVE_HIGH>; }; led-10 { - label = "ant3:green"; + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <3>; gpios = <&pio 24 GPIO_ACTIVE_HIGH>; }; led-11 { - label = "ant3:blue"; + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <3>; gpios = <&pio 23 GPIO_ACTIVE_HIGH>; }; led-12 { - label = "ant4:red"; + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <4>; gpios = <&pio 28 GPIO_ACTIVE_HIGH>; }; led-13 { - label = "ant4:green"; + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <4>; gpios = <&pio 27 GPIO_ACTIVE_HIGH>; }; led-14 { - label = "ant4:blue"; + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <4>; gpios = <&pio 32 GPIO_ACTIVE_HIGH>; }; led-15 { - label = "ant5:red"; + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <5>; gpios = <&pio 45 GPIO_ACTIVE_HIGH>; }; led-16 { - label = "ant5:green"; + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <5>; gpios = <&pio 44 GPIO_ACTIVE_HIGH>; }; led-17 { - label = "ant5:blue"; + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <5>; gpios = <&pio 43 GPIO_ACTIVE_HIGH>; }; }; @@ -151,7 +187,7 @@ reset-assert-us = <10000>; reset-deassert-us = <10000>; /* LED0: nc ; LED1: nc ; LED2: amber ; LED3: green */ - mxl,led-config = <0x0 0x0 0x370 0x80>; + mxl,led-config = <0x0 0x0 0x370 0x380>; }; }; diff --git a/target/linux/mediatek/dts/mt7986a-acer-w6-common.dtsi b/target/linux/mediatek/dts/mt7986a-acer-w6-common.dtsi index cca03684fb6f79..03913f04e101cd 100644 --- a/target/linux/mediatek/dts/mt7986a-acer-w6-common.dtsi +++ b/target/linux/mediatek/dts/mt7986a-acer-w6-common.dtsi @@ -9,7 +9,7 @@ / { 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"; + bootargs = "dm-mod.create=\"acer,,,ro,0 1 zero 1 0 0 0\" rootfstype=squashfs,ext4 rootwait root=/dev/mmcblk0p6 fstools_ignore_partname=1"; }; memory@0 { @@ -171,6 +171,13 @@ drive-strength = <4>; }; }; + + i2c_pins: i2c-pins { + mux { + function = "i2c"; + groups = "i2c"; + }; + }; }; &trng { @@ -185,6 +192,12 @@ status = "okay"; }; +&i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c_pins>; + status = "okay"; +}; + &mmc0 { status = "okay"; pinctrl-names = "default", "state_uhs"; @@ -321,13 +334,13 @@ reg = <0>; mediatek,led-config = < - 0x21 0x8009 /* BASIC_CTRL */ + 0x21 0x8008 /* 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 */ + 0x25 0x0003 /* LED0_BLINK_CTRL */ + 0x26 0xc006 /* LED1_ON_CTRL */ + 0x27 0x003c /* LED1_BLINK_CTRL */ >; }; @@ -335,13 +348,13 @@ reg = <1>; mediatek,led-config = < - 0x21 0x8009 /* BASIC_CTRL */ + 0x21 0x8008 /* 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 */ + 0x25 0x0003 /* LED0_BLINK_CTRL */ + 0x26 0xc006 /* LED1_ON_CTRL */ + 0x27 0x003c /* LED1_BLINK_CTRL */ >; }; @@ -349,13 +362,13 @@ reg = <2>; mediatek,led-config = < - 0x21 0x8009 /* BASIC_CTRL */ + 0x21 0x8008 /* 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 */ + 0x25 0x0003 /* LED0_BLINK_CTRL */ + 0x26 0xc006 /* LED1_ON_CTRL */ + 0x27 0x003c /* LED1_BLINK_CTRL */ >; }; @@ -363,13 +376,13 @@ reg = <3>; mediatek,led-config = < - 0x21 0x8009 /* BASIC_CTRL */ + 0x21 0x8008 /* 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 */ + 0x25 0x0003 /* LED0_BLINK_CTRL */ + 0x26 0xc006 /* LED1_ON_CTRL */ + 0x27 0x003c /* LED1_BLINK_CTRL */ >; }; }; diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index cb5c102b1e2b64..838a433bf4a5ac 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -152,7 +152,7 @@ TARGET_DEVICES += acelink_ew-7886cax define Device/acer_predator-w6 DEVICE_VENDOR := Acer - DEVICE_MODEL := Predator W6 + DEVICE_MODEL := Predator Connect W6 DEVICE_DTS := mt7986a-acer-predator-w6 DEVICE_DTS_DIR := ../dts DEVICE_DTS_LOADADDR := 0x47000000 From 60e21548e500cf7c70879073f8ef8d5dbb381f2c Mon Sep 17 00:00:00 2001 From: George Oldfort Date: Mon, 11 Nov 2024 11:18:19 +0100 Subject: [PATCH 154/877] mediatek: add support for Acer Predator W6d and Acer Vero W6m MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds support for two variants of the already supported router Acer Predator Connect W6: The Acer Predator Connect W6d (W6 without 6 GHz wifi) and the Acer Connect Vero W6m (W6 without 2.5G eth1 port, usb3 port, and the 6 on-board gpio RGB LEDs, and with a KTD2026 RGB LED controller instead of the KTD2061 LED controller of the W6/W6d). The device tree for the W6m refers to the KTD202x driver suggested in PR #16860. Patching target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh removes the code repetition in (old) lines 121 to 124 on the occasion. This is the last of four commits into which the original commit was split to make reviews easier and more targeted. Signed-off-by: George Oldfort Link: https://github.com/openwrt/openwrt/pull/16861 Signed-off-by: Hauke Mehrtens (cherry picked from commit 2898d1d1269a841e5bb8673801bd2a04ad120031) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- .../uboot-envtools/files/mediatek_filogic | 2 + .../dts/mt7986a-acer-predator-w6d.dts | 182 ++++++++++++++++++ .../mediatek/dts/mt7986a-acer-vero-w6m.dts | 66 +++++++ .../filogic/base-files/etc/board.d/02_network | 10 +- .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 7 +- .../base-files/lib/preinit/10_fix_eth_mac.sh | 11 +- .../base-files/lib/upgrade/platform.sh | 16 +- target/linux/mediatek/image/filogic.mk | 30 +++ 8 files changed, 312 insertions(+), 12 deletions(-) create mode 100644 target/linux/mediatek/dts/mt7986a-acer-predator-w6d.dts create mode 100644 target/linux/mediatek/dts/mt7986a-acer-vero-w6m.dts diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index 7571af002094ea..b637f4328778a1 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -50,6 +50,8 @@ zyxel,ex5601-t0-ubootmod) ubootenv_add_ubi_default ;; acer,predator-w6|\ +acer,predator-w6d|\ +acer,vero-w6m|\ glinet,gl-mt2500|\ glinet,gl-mt6000|\ glinet,gl-x3000|\ diff --git a/target/linux/mediatek/dts/mt7986a-acer-predator-w6d.dts b/target/linux/mediatek/dts/mt7986a-acer-predator-w6d.dts new file mode 100644 index 00000000000000..b2c35a61974921 --- /dev/null +++ b/target/linux/mediatek/dts/mt7986a-acer-predator-w6d.dts @@ -0,0 +1,182 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include "mt7986a-acer-w6-common.dtsi" + +/ { + model = "Acer Predator Connect W6d"; + compatible = "acer,predator-w6d", "mediatek,mt7986a"; + + aliases { + serial0 = &uart0; + led-boot = &led_status_blue; + led-failsafe = &led_status_blue; + led-running = &led_status_green; + led-upgrade = &led_status_red; + }; + + leds { + compatible = "gpio-leds"; + + led_status_red: led-0 { + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <0>; + gpios = <&pio 1 GPIO_ACTIVE_HIGH>; + }; + + led_status_green: led-1 { + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <0>; + gpios = <&pio 2 GPIO_ACTIVE_HIGH>; + }; + + led_status_blue: led-2 { + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <0>; + gpios = <&pio 36 GPIO_ACTIVE_HIGH>; + }; + + led-3 { + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <1>; + gpios = <&pio 35 GPIO_ACTIVE_HIGH>; + }; + + led-4 { + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <1>; + gpios = <&pio 34 GPIO_ACTIVE_HIGH>; + }; + + led-5 { + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <1>; + gpios = <&pio 33 GPIO_ACTIVE_HIGH>; + }; + + led-6 { + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <2>; + gpios = <&pio 38 GPIO_ACTIVE_HIGH>; + }; + + led-7 { + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <2>; + gpios = <&pio 37 GPIO_ACTIVE_HIGH>; + }; + + led-8 { + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <2>; + gpios = <&pio 26 GPIO_ACTIVE_HIGH>; + }; + + led-9 { + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <3>; + gpios = <&pio 25 GPIO_ACTIVE_HIGH>; + }; + + led-10 { + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <3>; + gpios = <&pio 24 GPIO_ACTIVE_HIGH>; + }; + + led-11 { + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <3>; + gpios = <&pio 23 GPIO_ACTIVE_HIGH>; + }; + + led-12 { + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <4>; + gpios = <&pio 28 GPIO_ACTIVE_HIGH>; + }; + + led-13 { + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <4>; + gpios = <&pio 27 GPIO_ACTIVE_HIGH>; + }; + + led-14 { + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <4>; + gpios = <&pio 32 GPIO_ACTIVE_HIGH>; + }; + + led-15 { + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <5>; + gpios = <&pio 45 GPIO_ACTIVE_HIGH>; + }; + + led-16 { + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <5>; + gpios = <&pio 44 GPIO_ACTIVE_HIGH>; + }; + + led-17 { + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <5>; + gpios = <&pio 43 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&ssusb { + vusb33-supply = <®_3p3v>; + vbus-supply = <®_5v>; + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; + +ð { + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "2500base-x"; + phy-handle = <&phy6>; + }; +}; + +&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 0x380>; + }; +}; + +&swport0 { + label = "game"; +}; diff --git a/target/linux/mediatek/dts/mt7986a-acer-vero-w6m.dts b/target/linux/mediatek/dts/mt7986a-acer-vero-w6m.dts new file mode 100644 index 00000000000000..7927efcb003cae --- /dev/null +++ b/target/linux/mediatek/dts/mt7986a-acer-vero-w6m.dts @@ -0,0 +1,66 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include "mt7986a-acer-w6-common.dtsi" + +/ { + model = "Acer Connect Vero W6m"; + compatible = "acer,vero-w6m", "mediatek,mt7986a"; + + aliases { + serial0 = &uart0; + led-boot = &led_status; + led-failsafe = &led_status; + led-running = &led_status; + led-upgrade = &led_status; + }; +}; + +&i2c0 { + led-controller@30 { + compatible = "kinetic,ktd2026"; + reg = <0x30>; + vin-supply = <®_5v>; + vio-supply = <®_3p3v>; + + led_status: multi-led { + color = ; + function = LED_FUNCTION_STATUS; + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + color = ; + }; + + led@1 { + reg = <1>; + color = ; + }; + + led@2 { + reg = <2>; + color = ; + }; + }; + }; +}; + +&nvmem { + eeprom_factory_a0000: eeprom@a0000 { + reg = <0xa0000 0x1000>; + }; +}; + +&slot0 { + radio0: mt7915@0,0 { + reg = <0x0000 0 0 0 0>; + nvmem-cells = <&eeprom_factory_a0000>; + nvmem-cell-names = "eeprom"; + }; +}; + +&swport0 { + label = "internet"; +}; 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 2bcead83045912..7bfc61a26902a2 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 @@ -18,9 +18,13 @@ mediatek_setup_interfaces() acelink,ew-7886cax) ucidef_set_interface_lan "eth0" "dhcp" ;; - acer,predator-w6) + acer,predator-w6|\ + acer,predator-w6d) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 game" eth1 ;; + acer,vero-w6m) + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" internet + ;; arcadyan,mozart) ucidef_set_interfaces_lan_wan "lan0 eth1" eth2 ;; @@ -132,7 +136,9 @@ mediatek_setup_macs() local label_mac="" case $board in - acer,predator-w6) + acer,predator-w6|\ + acer,predator-w6d|\ + acer,vero-w6m) wan_mac=$(mmc_get_mac_ascii u-boot-env WANMAC) lan_mac=$(mmc_get_mac_ascii u-boot-env LANMAC) ;; 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 f7f00c9a83bd71..f87cc0646edbb2 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 @@ -17,11 +17,16 @@ case "$board" in [ "$PHYNBR" = "0" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_setbit_la $addr > /sys${DEVPATH}/macaddress ;; - acer,predator-w6) + acer,predator-w6|\ + acer,vero-w6m) [ "$PHYNBR" = "0" ] && mmc_get_mac_ascii u-boot-env 2gMAC > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && mmc_get_mac_ascii u-boot-env 6gMAC > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "2" ] && mmc_get_mac_ascii u-boot-env 5gMAC > /sys${DEVPATH}/macaddress ;; + acer,predator-w6d) + [ "$PHYNBR" = "0" ] && mmc_get_mac_ascii u-boot-env 2gMAC > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && mmc_get_mac_ascii u-boot-env 5gMAC > /sys${DEVPATH}/macaddress + ;; asus,rt-ax59u) CI_UBIPART="UBI_DEV" addr=$(mtd_get_mac_binary_ubi "Factory" 0x4) 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 0d7da89ceaabf5..9d279898ac58cd 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,7 +2,8 @@ preinit_set_mac_address() { case $(board_name) in - acer,predator-w6) + acer,predator-w6|\ + acer,predator-w6d) $(mmc_get_mac_ascii u-boot-env WANMAC) $(mmc_get_mac_ascii u-boot-env LANMAC) ip link set dev lan1 address "$lan_mac" @@ -11,6 +12,14 @@ preinit_set_mac_address() { ip link set dev game address "$lan_mac" ip link set dev eth1 address "$wan_mac" ;; + acer,vero-w6m) + wan_mac=$(mmc_get_mac_ascii u-boot-env WANMAC) + lan_mac=$(mmc_get_mac_ascii u-boot-env LANMAC) + ip link set dev lan1 address "$lan_mac" + ip link set dev lan2 address "$lan_mac" + ip link set dev lan3 address "$lan_mac" + ip link set dev internet address "$wan_mac" + ;; 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 cfd77b62d7affb..ce334b2c8eecbb 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -91,7 +91,13 @@ platform_do_upgrade() { fit_do_upgrade "$1" ;; acer,predator-w6|\ + acer,predator-w6d|\ + acer,vero-w6m|\ arcadyan,mozart|\ + glinet,gl-mt2500|\ + glinet,gl-mt6000|\ + glinet,gl-x3000|\ + glinet,gl-xe3000|\ smartrg,sdg-8612|\ smartrg,sdg-8614|\ smartrg,sdg-8622|\ @@ -115,14 +121,6 @@ platform_do_upgrade() { yuncore,ax835) default_do_upgrade "$1" ;; - glinet,gl-mt2500|\ - glinet,gl-mt6000|\ - glinet,gl-x3000|\ - glinet,gl-xe3000) - CI_KERNPART="kernel" - CI_ROOTPART="rootfs" - emmc_do_upgrade "$1" - ;; mercusys,mr90x-v1|\ tplink,re6000xd) CI_UBIPART="ubi0" @@ -204,6 +202,8 @@ platform_copy_config() { fi ;; acer,predator-w6|\ + acer,predator-w6d|\ + acer,vero-w6m|\ arcadyan,mozart|\ glinet,gl-mt2500|\ glinet,gl-mt6000|\ diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 838a433bf4a5ac..072cae0d1f47ed 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -165,6 +165,36 @@ define Device/acer_predator-w6 endef TARGET_DEVICES += acer_predator-w6 +define Device/acer_predator-w6d + DEVICE_VENDOR := Acer + DEVICE_MODEL := Predator Connect W6d + DEVICE_DTS := mt7986a-acer-predator-w6d + DEVICE_DTS_DIR := ../dts + DEVICE_DTS_LOADADDR := 0x47000000 + DEVICE_PACKAGES := kmod-usb3 kmod-mt7915e kmod-mt7916-firmware kmod-mt7986-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-w6d + +define Device/acer_vero-w6m + DEVICE_VENDOR := Acer + DEVICE_MODEL := Connect Vero W6m + DEVICE_DTS := mt7986a-acer-vero-w6m + DEVICE_DTS_DIR := ../dts + DEVICE_DTS_LOADADDR := 0x47000000 + DEVICE_PACKAGES := kmod-leds-ktd202x kmod-mt7915e kmod-mt7916-firmware kmod-mt7986-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_vero-w6m + define Device/adtran_smartrg DEVICE_VENDOR := Adtran DEVICE_DTS_DIR := ../dts From 4779e954fa847c4b376623bc3bdf9651007e8a89 Mon Sep 17 00:00:00 2001 From: David Ignjic Date: Wed, 13 Nov 2024 11:20:27 +0100 Subject: [PATCH 155/877] mediatek: filogic: add support for Cudy WR3000S v1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hardware -------- MediaTek MT7981 WiSoC 256MB DDR3 RAM 128MB SPI-NAND (XMC XM25QH128C) MediaTek MT7981 2x2 DBDC 802.11ax 2T2R (2.4 / 5) UART: 115200 8N1 3.3V MAC: LAN MAC: label mac WAN MAC: label mac + 1 2.4G MAC: label mac 5G MAC: label mac + 1 with LA bit set Installation ------------ 1. Connect to the serial port as described in the "Hardware" section. 2. Power on the device + press reset pin. Keep pressing reset pin to enter the U-Boot shell. 3. Download the OpenWrt initramfs image. Place it on an TFTP server connected to the Cudy LAN ports. Make sure the server is reachable at 192.168.1.88. Rename the image to "cudy3000s.bin" 4. Download and boot the OpenWrt initramfs image. $ tftpboot 0x46000000 cudy3000s.bin; bootm 0x46000000 5. Transfer the OpenWrt sysupgrade image to the device using scp. Install with sysupgrade. Signed-off-by: David Ignjic Link: https://github.com/openwrt/openwrt/pull/16939 Signed-off-by: Hauke Mehrtens (cherry picked from commit faf4b3e0f7a583a8fa1a65b302ac74457e48575f) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- .../mediatek/dts/mt7981b-cudy-wr3000s-v1.dts | 283 ++++++++++++++++++ .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 1 + target/linux/mediatek/image/filogic.mk | 17 ++ 3 files changed, 301 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7981b-cudy-wr3000s-v1.dts diff --git a/target/linux/mediatek/dts/mt7981b-cudy-wr3000s-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-wr3000s-v1.dts new file mode 100644 index 00000000000000..a6439694943352 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-cudy-wr3000s-v1.dts @@ -0,0 +1,283 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/dts-v1/; + +#include + +#include "mt7981.dtsi" + +/ { + model = "Cudy WR3000S v1"; + compatible = "cudy,wr3000s-v1", "mediatek,mt7981-spim-snand-rfb"; + + aliases { + label-mac-device = &gmac0; + led-boot = &led_status; + led-failsafe = &led_status; + led-running = &led_status; + led-upgrade = &led_status; + serial0 = &uart0; + }; + + 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_internet { + function = LED_FUNCTION_WAN_ONLINE; + color = ; + gpios = <&pio 11 GPIO_ACTIVE_LOW>; + }; + + led_wps { + function = LED_FUNCTION_WPS; + color = ; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + }; + + led_wlan2g { + function = LED_FUNCTION_WLAN_2GHZ; + color = ; + gpios = <&pio 6 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + led_wlan5g { + function = LED_FUNCTION_WLAN_5GHZ; + color = ; + gpios = <&pio 7 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + }; +}; + +&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_bdinfo_de00 0>; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; +}; + +&mdio_bus { + switch: switch@1f { + 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: 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-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 = <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>; + }; + }; + }; + + partition@380000 { + label = "bdinfo"; + reg = <0x380000 0x0040000>; + 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@3C0000 { + label = "FIP"; + reg = <0x3C0000 0x0200000>; + read-only; + }; + + partition@580000 { + label = "ubi"; + reg = <0x5C0000 0x4000000>; + compatible = "linux,ubi"; + }; + }; + }; +}; + +&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 = ; + }; + }; +}; + +&switch { + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "wan"; + + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_bdinfo_de00 1>; + }; + + 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@6 { + reg = <6>; + label = "cpu"; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; +}; + +&wifi { + status = "okay"; + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; +}; 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 f87cc0646edbb2..7402bfc71babb8 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 @@ -81,6 +81,7 @@ case "$board" in ;; cudy,ap3000outdoor-v1|\ cudy,m3000-v1|\ + cudy,wr3000s-v1|\ 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/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 072cae0d1f47ed..f366a9b9202a7c 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -667,6 +667,23 @@ define Device/cudy_wr3000-v1 endef TARGET_DEVICES += cudy_wr3000-v1 +define Device/cudy_wr3000s-v1 + DEVICE_VENDOR := Cudy + DEVICE_MODEL := WR3000S + DEVICE_VARIANT := v1 + DEVICE_DTS := mt7981b-cudy-wr3000s-v1 + DEVICE_DTS_DIR := ../dts + SUPPORTED_DEVICES += R59 + 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-mt7915e kmod-mt7981-firmware mt7981-wo-firmware +endef +TARGET_DEVICES += cudy_wr3000s-v1 + define Device/dlink_aquila-pro-ai-m30-a1 DEVICE_VENDOR := D-Link DEVICE_MODEL := AQUILA PRO AI M30 From 005f0867524ff26e62167b1c71208dd05f33cfb5 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 24 Nov 2024 14:39:57 +0100 Subject: [PATCH 156/877] x86: Deactivate kernel options with extra overhead MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Deactivate CONFIG_CONTEXT_TRACKING_USER_FORCE: Force user context tracking: This is a testing feature which should not be activate in production environments according to the Kconfig help. It adds an extra overhead. Deactivate CONFIG_RCU_NOCB_CPU_DEFAULT_ALL: Offload RCU callback processing from all CPUs by default: This option should only be used in aggressive HPC or real-time workloads which we do not have in OpenWrt. For normal workloads it increases the number of context switches. In the default Arch Linux kernel both options are not activated. Fixes: 31111680f6fc ("x86: switch config to a tickless kernel") Link: https://github.com/openwrt/openwrt/pull/17057 Signed-off-by: Hauke Mehrtens (cherry picked from commit ed523454454965da07c9c7a009ae0a3995aa7c33) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- target/linux/x86/config-6.6 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/x86/config-6.6 b/target/linux/x86/config-6.6 index b3d15bc1047494..c416bb6a08dd7b 100644 --- a/target/linux/x86/config-6.6 +++ b/target/linux/x86/config-6.6 @@ -46,7 +46,7 @@ CONFIG_COMPAT_32=y CONFIG_COMPAT_32BIT_TIME=y # CONFIG_COMPAT_VDSO is not set CONFIG_CONSOLE_TRANSLATIONS=y -CONFIG_CONTEXT_TRACKING_USER_FORCE=y +# CONFIG_CONTEXT_TRACKING_USER_FORCE is not set # CONFIG_CPU5_WDT is not set CONFIG_CPU_FREQ=y CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y @@ -334,7 +334,7 @@ CONFIG_PTP_1588_CLOCK_OPTIONAL=y CONFIG_RANDSTRUCT_NONE=y CONFIG_RATIONAL=y CONFIG_RCU_LAZY=y -CONFIG_RCU_NOCB_CPU_DEFAULT_ALL=y +# CONFIG_RCU_NOCB_CPU_DEFAULT_ALL is not set CONFIG_RD_BZIP2=y CONFIG_RD_GZIP=y CONFIG_RETHUNK=y From 2544e03d10fc5e06e9423878bf9d1ab02def5bc2 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 23 Nov 2024 22:32:03 +0100 Subject: [PATCH 157/877] dropbear: bump to 2024.86 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - update dropbear to latest stable 2024.86; for the changes see https://matt.ucc.asn.au/dropbear/CHANGES Link: https://github.com/openwrt/openwrt/pull/17053 Signed-off-by: Hauke Mehrtens (cherry picked from commit a9d3c5b4c9bf910d4b3b42109161b1f6526b76eb) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/network/services/dropbear/Makefile | 6 +++--- .../network/services/dropbear/patches/110-change_user.patch | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package/network/services/dropbear/Makefile b/package/network/services/dropbear/Makefile index 1918e7dec6d6ce..e13b6c2145b716 100644 --- a/package/network/services/dropbear/Makefile +++ b/package/network/services/dropbear/Makefile @@ -8,14 +8,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=dropbear -PKG_VERSION:=2024.85 -PKG_RELEASE:=2 +PKG_VERSION:=2024.86 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:= \ https://matt.ucc.asn.au/dropbear/releases/ \ https://dropbear.nl/mirror/releases/ -PKG_HASH:=86b036c433a69d89ce51ebae335d65c47738ccf90d13e5eb0fea832e556da502 +PKG_HASH:=e78936dffc395f2e0db099321d6be659190966b99712b55c530dd0a1822e0a5e PKG_LICENSE:=MIT PKG_LICENSE_FILES:=LICENSE libtomcrypt/LICENSE libtommath/LICENSE diff --git a/package/network/services/dropbear/patches/110-change_user.patch b/package/network/services/dropbear/patches/110-change_user.patch index 9cb073cf940d46..9ef8f0cfbc4981 100644 --- a/package/network/services/dropbear/patches/110-change_user.patch +++ b/package/network/services/dropbear/patches/110-change_user.patch @@ -1,6 +1,6 @@ --- a/src/svr-chansession.c +++ b/src/svr-chansession.c -@@ -987,12 +987,12 @@ static void execchild(const void *user_d +@@ -984,12 +984,12 @@ static void execchild(const void *user_d /* We can only change uid/gid as root ... */ if (getuid() == 0) { From 888e879d7ffdad46998a1f7570f8c3b642a94eac Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 24 Nov 2024 14:52:22 +0100 Subject: [PATCH 158/877] CI: labeler: Add stm32 target MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a label for changes in the stm32 target. Fixes: 851e7f77e424 ("stm32: add new stm32 target") Link: https://github.com/openwrt/openwrt/pull/17058 Signed-off-by: Hauke Mehrtens (cherry picked from commit eb7aa07a0e23e931579de07e0dbdec735b8e35b2) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- .github/labeler.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/labeler.yml b/.github/labeler.yml index ede4bb5a02fce7..129357df2bf3bc 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -180,6 +180,13 @@ - changed-files: - any-glob-to-any-file: - "target/linux/starfive/**" +"target/stm32": +- changed-files: + - any-glob-to-any-file: + - "target/linux/stm32/**" + - "package/boot/arm-trusted-firmware-stm32/**" + - "package/boot/optee-os-stm32/**" + - "package/boot/uboot-stm32/**" "target/sunxi": - changed-files: - any-glob-to-any-file: From 1b2adb8000244d3488cc83e3f4950ce3dc631544 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 24 Nov 2024 14:53:47 +0100 Subject: [PATCH 159/877] stm32: Remove unnecessary kernel options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These options are filtered out since some weeks, remove them also from the new stm32 target. Fixes: 851e7f77e424 ("stm32: add new stm32 target") Link: https://github.com/openwrt/openwrt/pull/17058 Signed-off-by: Hauke Mehrtens (cherry picked from commit ea2c860225b8bbda98ed0526dc670825866835b6) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- target/linux/stm32/stm32mp1/config-6.6 | 3 --- 1 file changed, 3 deletions(-) diff --git a/target/linux/stm32/stm32mp1/config-6.6 b/target/linux/stm32/stm32mp1/config-6.6 index 946649ef9b9e94..e19abcc7dcc4be 100644 --- a/target/linux/stm32/stm32mp1/config-6.6 +++ b/target/linux/stm32/stm32mp1/config-6.6 @@ -70,8 +70,6 @@ CONFIG_BOUNCE=y CONFIG_BUFFER_HEAD=y # CONFIG_CACHE_L2X0 is not set CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CHR_DEV_SG=y CONFIG_CLKSRC_MMIO=y CONFIG_CLKSRC_STM32=y @@ -189,7 +187,6 @@ CONFIG_FUNCTION_ALIGNMENT=0 CONFIG_FWNODE_MDIO=y CONFIG_FW_CACHE=y # CONFIG_FW_LOADER_USER_HELPER is not set -CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ARCH_TOPOLOGY=y CONFIG_GENERIC_BUG=y From 67269ae51ecd7abfdc761ec9a802092965babe1e Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 24 Nov 2024 14:57:19 +0100 Subject: [PATCH 160/877] kernel: usb: kmod-usb-audio: Fix dependency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change the dependency on the kmod-media-controller from depends to select. Fixes: 109592524663 ("kernel: add kmod-media-controller dependency for kmod-usb-audio") Link: https://github.com/openwrt/openwrt/pull/17058 Signed-off-by: Hauke Mehrtens (cherry picked from commit b7dd70a0d708b7f8fe9f5c95d09013245e3dcb6b) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/kernel/linux/modules/usb.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kernel/linux/modules/usb.mk b/package/kernel/linux/modules/usb.mk index 466c547e8ab2dd..734df050cd6cdc 100644 --- a/package/kernel/linux/modules/usb.mk +++ b/package/kernel/linux/modules/usb.mk @@ -576,7 +576,7 @@ define KernelPackage/usb-audio CONFIG_SND_USB_AUDIO $(call AddDepends/usb) $(call AddDepends/sound) - DEPENDS+=kmod-media-controller + DEPENDS+=+kmod-media-controller FILES:= \ $(LINUX_DIR)/sound/usb/snd-usbmidi-lib.ko \ $(LINUX_DIR)/sound/usb/snd-usb-audio.ko From 0a0950614b7377c23d24999f7d44068e6ee09860 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sun, 3 Nov 2024 12:30:21 +0800 Subject: [PATCH 161/877] ramips: mt76x8: disable unused Ralink systick driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The mt76x8 series SoCs use the MIPS generic systick timer. Sync the upstream Ralink systick driver changes and disable it for mt76x8 target to reduce the kernel size. Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/16844 Signed-off-by: Hauke Mehrtens (cherry picked from commit 0c57510cedeff9caf795930ff86a436aa54bcc6d) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- target/linux/ramips/mt7620/config-6.6 | 2 +- target/linux/ramips/mt76x8/config-6.6 | 6 +- ...ers-ralink-Add-Ralink-System-Tick-Co.patch | 384 ++++++++++++++++++ ...e-to-enable-disable-the-cevt-r4k-irq.patch | 36 +- ...IPS-ralink-add-cpu-frequency-scaling.patch | 35 +- ...-select-illegal-access-driver-by-def.patch | 4 +- target/linux/ramips/rt305x/config-6.6 | 2 +- 7 files changed, 426 insertions(+), 43 deletions(-) create mode 100644 target/linux/ramips/patches-6.6/001-v6.13-clocksource-drivers-ralink-Add-Ralink-System-Tick-Co.patch diff --git a/target/linux/ramips/mt7620/config-6.6 b/target/linux/ramips/mt7620/config-6.6 index edd64a642cdd6f..3e1ef761e029b9 100644 --- a/target/linux/ramips/mt7620/config-6.6 +++ b/target/linux/ramips/mt7620/config-6.6 @@ -8,7 +8,6 @@ CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_BLK_MQ_PCI=y CONFIG_CEVT_R4K=y CONFIG_CEVT_SYSTICK_QUIRK=y -CONFIG_CLKEVT_RT3352=y CONFIG_CLKSRC_MMIO=y CONFIG_CLK_MTMIPS=y CONFIG_CLONE_BACKWARDS=y @@ -180,6 +179,7 @@ CONFIG_PINCTRL_MTK_MTMIPS=y CONFIG_PREEMPT_NONE_BUILD=y CONFIG_PTP_1588_CLOCK_OPTIONAL=y CONFIG_RALINK=y +CONFIG_RALINK_TIMER=y CONFIG_RALINK_WDT=y CONFIG_RANDSTRUCT_NONE=y CONFIG_RATIONAL=y diff --git a/target/linux/ramips/mt76x8/config-6.6 b/target/linux/ramips/mt76x8/config-6.6 index 31dc4a980f948e..f40d18efcce523 100644 --- a/target/linux/ramips/mt76x8/config-6.6 +++ b/target/linux/ramips/mt76x8/config-6.6 @@ -6,9 +6,6 @@ CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=15 CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_BLK_MQ_PCI=y CONFIG_CEVT_R4K=y -CONFIG_CEVT_SYSTICK_QUIRK=y -CONFIG_CLKEVT_RT3352=y -CONFIG_CLKSRC_MMIO=y CONFIG_CLK_MTMIPS=y CONFIG_CLONE_BACKWARDS=y CONFIG_CMDLINE="rootfstype=squashfs,jffs2" @@ -173,6 +170,7 @@ CONFIG_PINCTRL_MTK_MTMIPS=y CONFIG_PREEMPT_NONE_BUILD=y CONFIG_PTP_1588_CLOCK_OPTIONAL=y CONFIG_RALINK=y +# CONFIG_RALINK_TIMER is not set # CONFIG_RALINK_WDT is not set CONFIG_RANDSTRUCT_NONE=y CONFIG_RATIONAL=y @@ -215,8 +213,6 @@ CONFIG_SYS_SUPPORTS_MIPS16=y CONFIG_SYS_SUPPORTS_ZBOOT=y CONFIG_TARGET_ISA_REV=2 CONFIG_TICK_CPU_ACCOUNTING=y -CONFIG_TIMER_OF=y -CONFIG_TIMER_PROBE=y CONFIG_TINY_SRCU=y CONFIG_USB_SUPPORT=y CONFIG_USE_OF=y diff --git a/target/linux/ramips/patches-6.6/001-v6.13-clocksource-drivers-ralink-Add-Ralink-System-Tick-Co.patch b/target/linux/ramips/patches-6.6/001-v6.13-clocksource-drivers-ralink-Add-Ralink-System-Tick-Co.patch new file mode 100644 index 00000000000000..cd2a90826c767d --- /dev/null +++ b/target/linux/ramips/patches-6.6/001-v6.13-clocksource-drivers-ralink-Add-Ralink-System-Tick-Co.patch @@ -0,0 +1,384 @@ +From 57cbfd333c9d65bfab1a06b49c75536ee28dc2ce Mon Sep 17 00:00:00 2001 +From: Sergio Paracuellos +Date: Mon, 28 Oct 2024 21:36:43 +0100 +Subject: clocksource/drivers/ralink: Add Ralink System Tick Counter driver + +System Tick Counter is present on Ralink SoCs RT3352 and MT7620. This +driver has been in 'arch/mips/ralink' directory since the beggining of +Ralink architecture support. However, it can be moved into a more proper +place in 'drivers/clocksource'. Hence add it here adding also support for +compile test targets and reducing LOC in architecture code folder. + +Signed-off-by: Sergio Paracuellos +Link: https://lore.kernel.org/r/20241028203643.191268-2-sergio.paracuellos@gmail.com +Signed-off-by: Daniel Lezcano +--- + arch/mips/ralink/Kconfig | 7 -- + arch/mips/ralink/Makefile | 2 - + arch/mips/ralink/cevt-rt3352.c | 153 ------------------------------------- + drivers/clocksource/Kconfig | 9 +++ + drivers/clocksource/Makefile | 1 + + drivers/clocksource/timer-ralink.c | 150 ++++++++++++++++++++++++++++++++++++ + 6 files changed, 160 insertions(+), 162 deletions(-) + delete mode 100644 arch/mips/ralink/cevt-rt3352.c + create mode 100644 drivers/clocksource/timer-ralink.c + +--- a/arch/mips/ralink/Kconfig ++++ b/arch/mips/ralink/Kconfig +@@ -1,13 +1,6 @@ + # SPDX-License-Identifier: GPL-2.0 + if RALINK + +-config CLKEVT_RT3352 +- bool +- depends on SOC_RT305X || SOC_MT7620 +- default y +- select TIMER_OF +- select CLKSRC_MMIO +- + config RALINK_ILL_ACC + bool + depends on SOC_RT305X +--- a/arch/mips/ralink/Makefile ++++ b/arch/mips/ralink/Makefile +@@ -10,8 +10,6 @@ ifndef CONFIG_MIPS_GIC + obj-y += clk.o timer.o + endif + +-obj-$(CONFIG_CLKEVT_RT3352) += cevt-rt3352.o +- + obj-$(CONFIG_RALINK_ILL_ACC) += ill_acc.o + + obj-$(CONFIG_IRQ_INTC) += irq.o +--- a/arch/mips/ralink/cevt-rt3352.c ++++ /dev/null +@@ -1,153 +0,0 @@ +-/* +- * This file is subject to the terms and conditions of the GNU General Public +- * License. See the file "COPYING" in the main directory of this archive +- * for more details. +- * +- * Copyright (C) 2013 by John Crispin +- */ +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +- +-#define SYSTICK_FREQ (50 * 1000) +- +-#define SYSTICK_CONFIG 0x00 +-#define SYSTICK_COMPARE 0x04 +-#define SYSTICK_COUNT 0x08 +- +-/* route systick irq to mips irq 7 instead of the r4k-timer */ +-#define CFG_EXT_STK_EN 0x2 +-/* enable the counter */ +-#define CFG_CNT_EN 0x1 +- +-struct systick_device { +- void __iomem *membase; +- struct clock_event_device dev; +- int irq_requested; +- int freq_scale; +-}; +- +-static int systick_set_oneshot(struct clock_event_device *evt); +-static int systick_shutdown(struct clock_event_device *evt); +- +-static int systick_next_event(unsigned long delta, +- struct clock_event_device *evt) +-{ +- struct systick_device *sdev; +- u32 count; +- +- sdev = container_of(evt, struct systick_device, dev); +- count = ioread32(sdev->membase + SYSTICK_COUNT); +- count = (count + delta) % SYSTICK_FREQ; +- iowrite32(count, sdev->membase + SYSTICK_COMPARE); +- +- return 0; +-} +- +-static void systick_event_handler(struct clock_event_device *dev) +-{ +- /* noting to do here */ +-} +- +-static irqreturn_t systick_interrupt(int irq, void *dev_id) +-{ +- struct clock_event_device *dev = (struct clock_event_device *) dev_id; +- +- dev->event_handler(dev); +- +- return IRQ_HANDLED; +-} +- +-static struct systick_device systick = { +- .dev = { +- /* +- * cevt-r4k uses 300, make sure systick +- * gets used if available +- */ +- .rating = 310, +- .features = CLOCK_EVT_FEAT_ONESHOT, +- .set_next_event = systick_next_event, +- .set_state_shutdown = systick_shutdown, +- .set_state_oneshot = systick_set_oneshot, +- .event_handler = systick_event_handler, +- }, +-}; +- +-static int systick_shutdown(struct clock_event_device *evt) +-{ +- struct systick_device *sdev; +- +- sdev = container_of(evt, struct systick_device, dev); +- +- if (sdev->irq_requested) +- free_irq(systick.dev.irq, &systick.dev); +- sdev->irq_requested = 0; +- iowrite32(0, systick.membase + SYSTICK_CONFIG); +- +- return 0; +-} +- +-static int systick_set_oneshot(struct clock_event_device *evt) +-{ +- const char *name = systick.dev.name; +- struct systick_device *sdev; +- int irq = systick.dev.irq; +- +- sdev = container_of(evt, struct systick_device, dev); +- +- if (!sdev->irq_requested) { +- if (request_irq(irq, systick_interrupt, +- IRQF_PERCPU | IRQF_TIMER, name, &systick.dev)) +- pr_err("Failed to request irq %d (%s)\n", irq, name); +- } +- sdev->irq_requested = 1; +- iowrite32(CFG_EXT_STK_EN | CFG_CNT_EN, +- systick.membase + SYSTICK_CONFIG); +- +- return 0; +-} +- +-static int __init ralink_systick_init(struct device_node *np) +-{ +- int ret; +- +- systick.membase = of_iomap(np, 0); +- if (!systick.membase) +- return -ENXIO; +- +- systick.dev.name = np->name; +- clockevents_calc_mult_shift(&systick.dev, SYSTICK_FREQ, 60); +- systick.dev.max_delta_ns = clockevent_delta2ns(0x7fff, &systick.dev); +- systick.dev.max_delta_ticks = 0x7fff; +- systick.dev.min_delta_ns = clockevent_delta2ns(0x3, &systick.dev); +- systick.dev.min_delta_ticks = 0x3; +- systick.dev.irq = irq_of_parse_and_map(np, 0); +- if (!systick.dev.irq) { +- pr_err("%pOFn: request_irq failed", np); +- return -EINVAL; +- } +- +- ret = clocksource_mmio_init(systick.membase + SYSTICK_COUNT, np->name, +- SYSTICK_FREQ, 301, 16, +- clocksource_mmio_readl_up); +- if (ret) +- return ret; +- +- clockevents_register_device(&systick.dev); +- +- pr_info("%pOFn: running - mult: %d, shift: %d\n", +- np, systick.dev.mult, systick.dev.shift); +- +- return 0; +-} +- +-TIMER_OF_DECLARE(systick, "ralink,cevt-systick", ralink_systick_init); +--- a/drivers/clocksource/Kconfig ++++ b/drivers/clocksource/Kconfig +@@ -732,4 +732,13 @@ config GOLDFISH_TIMER + help + Support for the timer/counter of goldfish-rtc + ++config RALINK_TIMER ++ bool "Ralink System Tick Counter" ++ depends on SOC_RT305X || SOC_MT7620 || COMPILE_TEST ++ select CLKSRC_MMIO ++ select TIMER_OF ++ help ++ Enables support for system tick counter present on ++ Ralink SoCs RT3352 and MT7620. ++ + endmenu +--- a/drivers/clocksource/Makefile ++++ b/drivers/clocksource/Makefile +@@ -89,3 +89,4 @@ obj-$(CONFIG_MSC313E_TIMER) += timer-ms + obj-$(CONFIG_GOLDFISH_TIMER) += timer-goldfish.o + obj-$(CONFIG_GXP_TIMER) += timer-gxp.o + obj-$(CONFIG_CLKSRC_LOONGSON1_PWM) += timer-loongson1-pwm.o ++obj-$(CONFIG_RALINK_TIMER) += timer-ralink.o +--- /dev/null ++++ b/drivers/clocksource/timer-ralink.c +@@ -0,0 +1,150 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Ralink System Tick Counter driver present on RT3352 and MT7620 SoCs. ++ * ++ * Copyright (C) 2013 by John Crispin ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define SYSTICK_FREQ (50 * 1000) ++ ++#define SYSTICK_CONFIG 0x00 ++#define SYSTICK_COMPARE 0x04 ++#define SYSTICK_COUNT 0x08 ++ ++/* route systick irq to mips irq 7 instead of the r4k-timer */ ++#define CFG_EXT_STK_EN 0x2 ++/* enable the counter */ ++#define CFG_CNT_EN 0x1 ++ ++struct systick_device { ++ void __iomem *membase; ++ struct clock_event_device dev; ++ int irq_requested; ++ int freq_scale; ++}; ++ ++static int systick_set_oneshot(struct clock_event_device *evt); ++static int systick_shutdown(struct clock_event_device *evt); ++ ++static int systick_next_event(unsigned long delta, ++ struct clock_event_device *evt) ++{ ++ struct systick_device *sdev; ++ u32 count; ++ ++ sdev = container_of(evt, struct systick_device, dev); ++ count = ioread32(sdev->membase + SYSTICK_COUNT); ++ count = (count + delta) % SYSTICK_FREQ; ++ iowrite32(count, sdev->membase + SYSTICK_COMPARE); ++ ++ return 0; ++} ++ ++static void systick_event_handler(struct clock_event_device *dev) ++{ ++ /* noting to do here */ ++} ++ ++static irqreturn_t systick_interrupt(int irq, void *dev_id) ++{ ++ struct clock_event_device *dev = (struct clock_event_device *)dev_id; ++ ++ dev->event_handler(dev); ++ ++ return IRQ_HANDLED; ++} ++ ++static struct systick_device systick = { ++ .dev = { ++ /* ++ * cevt-r4k uses 300, make sure systick ++ * gets used if available ++ */ ++ .rating = 310, ++ .features = CLOCK_EVT_FEAT_ONESHOT, ++ .set_next_event = systick_next_event, ++ .set_state_shutdown = systick_shutdown, ++ .set_state_oneshot = systick_set_oneshot, ++ .event_handler = systick_event_handler, ++ }, ++}; ++ ++static int systick_shutdown(struct clock_event_device *evt) ++{ ++ struct systick_device *sdev; ++ ++ sdev = container_of(evt, struct systick_device, dev); ++ ++ if (sdev->irq_requested) ++ free_irq(systick.dev.irq, &systick.dev); ++ sdev->irq_requested = 0; ++ iowrite32(0, systick.membase + SYSTICK_CONFIG); ++ ++ return 0; ++} ++ ++static int systick_set_oneshot(struct clock_event_device *evt) ++{ ++ const char *name = systick.dev.name; ++ struct systick_device *sdev; ++ int irq = systick.dev.irq; ++ ++ sdev = container_of(evt, struct systick_device, dev); ++ ++ if (!sdev->irq_requested) { ++ if (request_irq(irq, systick_interrupt, ++ IRQF_PERCPU | IRQF_TIMER, name, &systick.dev)) ++ pr_err("Failed to request irq %d (%s)\n", irq, name); ++ } ++ sdev->irq_requested = 1; ++ iowrite32(CFG_EXT_STK_EN | CFG_CNT_EN, ++ systick.membase + SYSTICK_CONFIG); ++ ++ return 0; ++} ++ ++static int __init ralink_systick_init(struct device_node *np) ++{ ++ int ret; ++ ++ systick.membase = of_iomap(np, 0); ++ if (!systick.membase) ++ return -ENXIO; ++ ++ systick.dev.name = np->name; ++ clockevents_calc_mult_shift(&systick.dev, SYSTICK_FREQ, 60); ++ systick.dev.max_delta_ns = clockevent_delta2ns(0x7fff, &systick.dev); ++ systick.dev.max_delta_ticks = 0x7fff; ++ systick.dev.min_delta_ns = clockevent_delta2ns(0x3, &systick.dev); ++ systick.dev.min_delta_ticks = 0x3; ++ systick.dev.irq = irq_of_parse_and_map(np, 0); ++ if (!systick.dev.irq) { ++ pr_err("%pOFn: request_irq failed", np); ++ return -EINVAL; ++ } ++ ++ ret = clocksource_mmio_init(systick.membase + SYSTICK_COUNT, np->name, ++ SYSTICK_FREQ, 301, 16, ++ clocksource_mmio_readl_up); ++ if (ret) ++ return ret; ++ ++ clockevents_register_device(&systick.dev); ++ ++ pr_info("%pOFn: running - mult: %d, shift: %d\n", ++ np, systick.dev.mult, systick.dev.shift); ++ ++ return 0; ++} ++ ++TIMER_OF_DECLARE(systick, "ralink,cevt-systick", ralink_systick_init); diff --git a/target/linux/ramips/patches-6.6/311-MIPS-use-set_mode-to-enable-disable-the-cevt-r4k-irq.patch b/target/linux/ramips/patches-6.6/311-MIPS-use-set_mode-to-enable-disable-the-cevt-r4k-irq.patch index 36925b83267cf4..d59a71af88b0a9 100644 --- a/target/linux/ramips/patches-6.6/311-MIPS-use-set_mode-to-enable-disable-the-cevt-r4k-irq.patch +++ b/target/linux/ramips/patches-6.6/311-MIPS-use-set_mode-to-enable-disable-the-cevt-r4k-irq.patch @@ -1,13 +1,11 @@ -From ce3d4a4111a5f7e6b4e74bceae5faa6ce388e8ec Mon Sep 17 00:00:00 2001 From: John Crispin Date: Sun, 14 Jul 2013 23:08:11 +0200 -Subject: [PATCH 05/53] MIPS: use set_mode() to enable/disable the cevt-r4k - irq +Subject: [PATCH 1/2] MIPS: use set_mode() to enable/disable the cevt-r4k irq Signed-off-by: John Crispin --- arch/mips/kernel/cevt-r4k.c | 43 +++++++++++++++++++++++++++++++++++++ - arch/mips/ralink/Kconfig | 5 +++++ + drivers/clocksource/Kconfig | 5 +++++ 2 files changed, 48 insertions(+) --- a/arch/mips/kernel/cevt-r4k.c @@ -96,23 +94,21 @@ Signed-off-by: John Crispin return 0; } ---- a/arch/mips/ralink/Kconfig -+++ b/arch/mips/ralink/Kconfig -@@ -1,12 +1,17 @@ - # SPDX-License-Identifier: GPL-2.0 - if RALINK - +--- a/drivers/clocksource/Kconfig ++++ b/drivers/clocksource/Kconfig +@@ -731,10 +731,15 @@ config GOLDFISH_TIMER + depends on RTC_DRV_GOLDFISH + help + Support for the timer/counter of goldfish-rtc ++ +config CEVT_SYSTICK_QUIRK + bool + default n -+ - config CLKEVT_RT3352 - bool - depends on SOC_RT305X || SOC_MT7620 - default y - select TIMER_OF - select CLKSRC_MMIO -+ select CEVT_SYSTICK_QUIRK - config RALINK_ILL_ACC - bool + config RALINK_TIMER + bool "Ralink System Tick Counter" + depends on SOC_RT305X || SOC_MT7620 || COMPILE_TEST ++ select CEVT_SYSTICK_QUIRK + select CLKSRC_MMIO + select TIMER_OF + help diff --git a/target/linux/ramips/patches-6.6/312-MIPS-ralink-add-cpu-frequency-scaling.patch b/target/linux/ramips/patches-6.6/312-MIPS-ralink-add-cpu-frequency-scaling.patch index 0d70770941ecf8..6acdfff837cca3 100644 --- a/target/linux/ramips/patches-6.6/312-MIPS-ralink-add-cpu-frequency-scaling.patch +++ b/target/linux/ramips/patches-6.6/312-MIPS-ralink-add-cpu-frequency-scaling.patch @@ -1,19 +1,26 @@ -From bd30f19a006fb52bac80c6463c49dd2f4159f4ac Mon Sep 17 00:00:00 2001 From: John Crispin Date: Sun, 28 Jul 2013 16:26:41 +0200 -Subject: [PATCH 06/53] MIPS: ralink: add cpu frequency scaling +Subject: [PATCH 2/2] MIPS: ralink: add cpu frequency scaling This feature will break udelay() and cause the delay loop to have longer delays when the frequency is scaled causing a performance hit. Signed-off-by: John Crispin --- - arch/mips/ralink/cevt-rt3352.c | 38 ++++++++++++++++++++++++++++++++++++++ - 1 file changed, 38 insertions(+) + drivers/clocksource/timer-ralink.c | 117 ++++++++++++++++++++++------- + 1 file changed, 89 insertions(+), 28 deletions(-) ---- a/arch/mips/ralink/cevt-rt3352.c -+++ b/arch/mips/ralink/cevt-rt3352.c -@@ -29,6 +29,10 @@ +--- a/drivers/clocksource/timer-ralink.c ++++ b/drivers/clocksource/timer-ralink.c +@@ -5,6 +5,7 @@ + * Copyright (C) 2013 by John Crispin + */ + ++#include + #include + #include + #include +@@ -26,6 +27,10 @@ /* enable the counter */ #define CFG_CNT_EN 0x1 @@ -24,7 +31,7 @@ Signed-off-by: John Crispin struct systick_device { void __iomem *membase; struct clock_event_device dev; -@@ -36,21 +40,53 @@ struct systick_device { +@@ -33,21 +38,53 @@ struct systick_device { int freq_scale; }; @@ -64,7 +71,7 @@ Signed-off-by: John Crispin +} + static int systick_next_event(unsigned long delta, - struct clock_event_device *evt) + struct clock_event_device *evt) { struct systick_device *sdev; - u32 count; @@ -83,18 +90,18 @@ Signed-off-by: John Crispin } static void systick_event_handler(struct clock_event_device *dev) -@@ -60,20 +96,25 @@ static void systick_event_handler(struct +@@ -57,20 +94,25 @@ static void systick_event_handler(struct static irqreturn_t systick_interrupt(int irq, void *dev_id) { -- struct clock_event_device *dev = (struct clock_event_device *) dev_id; +- struct clock_event_device *dev = (struct clock_event_device *)dev_id; + int ret = 0; + struct clock_event_device *cdev; + struct systick_device *sdev; - dev->event_handler(dev); + if (read_c0_cause() & STATUSF_IP7) { -+ cdev = (struct clock_event_device *) dev_id; ++ cdev = (struct clock_event_device *)dev_id; + sdev = container_of(cdev, struct systick_device, dev); + + /* Clear Count/Compare Interrupt */ @@ -117,7 +124,7 @@ Signed-off-by: John Crispin .features = CLOCK_EVT_FEAT_ONESHOT, .set_next_event = systick_next_event, .set_state_shutdown = systick_shutdown, -@@ -91,7 +132,13 @@ static int systick_shutdown(struct clock +@@ -88,7 +130,13 @@ static int systick_shutdown(struct clock if (sdev->irq_requested) free_irq(systick.dev.irq, &systick.dev); sdev->irq_requested = 0; @@ -132,7 +139,7 @@ Signed-off-by: John Crispin return 0; } -@@ -116,33 +163,46 @@ static int systick_set_oneshot(struct cl +@@ -113,33 +161,46 @@ static int systick_set_oneshot(struct cl return 0; } diff --git a/target/linux/ramips/patches-6.6/316-arch-mips-do-not-select-illegal-access-driver-by-def.patch b/target/linux/ramips/patches-6.6/316-arch-mips-do-not-select-illegal-access-driver-by-def.patch index 1dc54ccf232627..85680416709616 100644 --- a/target/linux/ramips/patches-6.6/316-arch-mips-do-not-select-illegal-access-driver-by-def.patch +++ b/target/linux/ramips/patches-6.6/316-arch-mips-do-not-select-illegal-access-driver-by-def.patch @@ -11,8 +11,8 @@ Signed-off-by: John Crispin --- a/arch/mips/ralink/Kconfig +++ b/arch/mips/ralink/Kconfig -@@ -14,9 +14,9 @@ config CLKEVT_RT3352 - select CEVT_SYSTICK_QUIRK +@@ -2,9 +2,9 @@ + if RALINK config RALINK_ILL_ACC - bool diff --git a/target/linux/ramips/rt305x/config-6.6 b/target/linux/ramips/rt305x/config-6.6 index 6f7b7ea2a1741a..33efcba6332f06 100644 --- a/target/linux/ramips/rt305x/config-6.6 +++ b/target/linux/ramips/rt305x/config-6.6 @@ -6,7 +6,6 @@ CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=15 CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_CEVT_R4K=y CONFIG_CEVT_SYSTICK_QUIRK=y -CONFIG_CLKEVT_RT3352=y CONFIG_CLKSRC_MMIO=y CONFIG_CLK_MTMIPS=y CONFIG_CLONE_BACKWARDS=y @@ -160,6 +159,7 @@ CONFIG_PREEMPT_NONE_BUILD=y CONFIG_PTP_1588_CLOCK_OPTIONAL=y CONFIG_RALINK=y # CONFIG_RALINK_ILL_ACC is not set +CONFIG_RALINK_TIMER=y CONFIG_RALINK_WDT=y CONFIG_RANDSTRUCT_NONE=y CONFIG_RATIONAL=y From fd7b1f60ea8d6a5c9da1dce70fd86231f5599aa6 Mon Sep 17 00:00:00 2001 From: Mauri Sandberg Date: Mon, 28 Oct 2024 22:13:04 +0200 Subject: [PATCH 162/877] ramips: dna_valokuitu-plus-ex400: clean-up image creation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Code cleanup. Simplify and unify how kernel image is passed to Build/dna-bootfs Signed-off-by: Mauri Sandberg Link: https://github.com/openwrt/openwrt/pull/16811 Signed-off-by: Hauke Mehrtens (cherry picked from commit ec839c786ca56c6143257b89f146aeafbb6cfd3a) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- target/linux/ramips/image/mt7621.mk | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 1dc1219d241e46..eb7dacefefb793 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -94,18 +94,9 @@ endef define Build/dna-bootfs mkdir -p $@.ubifs-dir/boot - # populate the boot fs with the dtb and with either initramfs kernel or - # the normal kernel + # populate the boot fs with the dtb and the kernel image $(CP) $(KDIR)/image-$(firstword $(DEVICE_DTS)).dtb $@.ubifs-dir/boot/dtb - - $(if $(findstring with-initrd,$(word 1,$(1))),\ - ( \ - $(CP) $@ $@.ubifs-dir/boot/uImage \ - ) , \ - ( \ - $(CP) $(IMAGE_KERNEL) $@.ubifs-dir/boot/uImage \ - ) \ - ) + $(CP) $@ $@.ubifs-dir/boot/uImage # create ubifs $(STAGING_DIR_HOST)/bin/mkfs.ubifs ${MKUBIFS_OPTS} -r $@.ubifs-dir/ -o $@.new @@ -1060,17 +1051,16 @@ define Device/dna_valokuitu-plus-ex400 IMAGE_SIZE := 117m PAGESIZE := 2048 MKUBIFS_OPTS := --min-io-size=$$(PAGESIZE) --leb-size=124KiB --max-leb-cnt=96 \ - --log-lebs=2 --space-fixup --squash-uids + --log-lebs=2 --space-fixup --squash-uids DEVICE_VENDOR := DNA DEVICE_MODEL := Valokuitu Plus EX400 KERNEL := kernel-bin | lzma | uImage lzma KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | uImage lzma IMAGES += factory.bin IMAGE/factory.bin := append-image-stage initramfs-kernel.bin | \ - dna-bootfs with-initrd | dna-header | \ - append-md5sum-ascii-salted - IMAGE/sysupgrade.bin := dna-bootfs | sysupgrade-tar kernel=$$$$@ | check-size | \ - append-metadata + dna-bootfs | dna-header | append-md5sum-ascii-salted + IMAGE/sysupgrade.bin := append-kernel | dna-bootfs | \ + sysupgrade-tar kernel=$$$$@ | check-size | append-metadata DEVICE_IMG_NAME = $$(DEVICE_IMG_PREFIX)-$$(2) DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615-firmware kmod-usb3 endef From ba95a01cbfd67a7c89c2d95fb2ef21b2e9bdf265 Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Sat, 26 Oct 2024 09:34:43 +0000 Subject: [PATCH 163/877] uboot-mediatek: add Routerich AX3000 support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add U-Boot replacement loader for Routerich AX3000. Signed-off-by: Mikhail Zhilkin Link: https://github.com/openwrt/openwrt/pull/16791 Signed-off-by: Hauke Mehrtens (cherry picked from commit c0581520b1c53fe2fc4a310f916590dcc428474a) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/boot/uboot-mediatek/Makefile | 13 + .../patches/460-add-routerich-ax3000.patch | 362 ++++++++++++++++++ 2 files changed, 375 insertions(+) create mode 100644 package/boot/uboot-mediatek/patches/460-add-routerich-ax3000.patch diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile index d2a03277d4057d..fa314da3998e65 100644 --- a/package/boot/uboot-mediatek/Makefile +++ b/package/boot/uboot-mediatek/Makefile @@ -413,6 +413,18 @@ define U-Boot/mt7981_rfb-snfi DEPENDS:=+trusted-firmware-a-mt7981-snand-ddr3 endef +define U-Boot/mt7981_routerich_ax3000 + NAME:=Routerich AX3000 + BUILD_SUBTARGET:=filogic + BUILD_DEVICES:=routerich_ax3000-ubootmod + UBOOT_CONFIG:=mt7981_routerich_ax3000 + 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 @@ -823,6 +835,7 @@ UBOOT_TARGETS := \ mt7981_rfb-nor \ mt7981_rfb-sd \ mt7981_rfb-snfi \ + mt7981_routerich_ax3000 \ mt7981_qihoo_360t7 \ mt7981_xiaomi_mi-router-ax3000t \ mt7981_xiaomi_mi-router-wr30u \ diff --git a/package/boot/uboot-mediatek/patches/460-add-routerich-ax3000.patch b/package/boot/uboot-mediatek/patches/460-add-routerich-ax3000.patch new file mode 100644 index 00000000000000..9aa31843deaa06 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/460-add-routerich-ax3000.patch @@ -0,0 +1,362 @@ +--- /dev/null ++++ b/configs/mt7981_routerich_ax3000_defconfig +@@ -0,0 +1,107 @@ ++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-routerich_ax3000" ++CONFIG_OF_LIBFDT_OVERLAY=y ++CONFIG_TARGET_MT7981=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_FIT=y ++CONFIG_BOOTDELAY=30 ++CONFIG_AUTOBOOT_KEYED=y ++CONFIG_AUTOBOOT_MENU_SHOW=y ++CONFIG_DEFAULT_FDT_FILE="mediatek/mt7981-routerich_ax3000.dtb" ++CONFIG_LOGLEVEL=7 ++CONFIG_PRE_CONSOLE_BUFFER=y ++CONFIG_LOG=y ++CONFIG_BOARD_LATE_INIT=y ++CONFIG_HUSH_PARSER=y ++CONFIG_SYS_PROMPT="MT7981> " ++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_GPT=y ++CONFIG_CMD_MTD=y ++CONFIG_CMD_PART=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_PXE=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_CMD_UBI=y ++CONFIG_CMD_UBI_RENAME=y ++CONFIG_OF_EMBED=y ++CONFIG_ENV_OVERWRITE=y ++CONFIG_ENV_IS_IN_UBI=y ++CONFIG_SYS_REDUNDAND_ENVIRONMENT=y ++CONFIG_ENV_UBI_PART="ubi" ++CONFIG_ENV_UBI_VOLUME="ubootenv" ++CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2" ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_USE_DEFAULT_ENV_FILE=y ++CONFIG_DEFAULT_ENV_FILE="routerich_ax3000_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_MMC is not set ++CONFIG_MTD=y ++CONFIG_DM_MTD=y ++CONFIG_MTD_SPI_NAND=y ++CONFIG_MTD_UBI_FASTMAP=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_MT7981=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_RAM=y ++CONFIG_DM_SERIAL=y ++CONFIG_MTK_SERIAL=y ++CONFIG_SPI=y ++CONFIG_DM_SPI=y ++CONFIG_MTK_SPIM=y ++CONFIG_ZSTD=y ++CONFIG_HEXDUMP=y ++CONFIG_LMB_MAX_REGIONS=64 +--- /dev/null ++++ b/arch/arm/dts/mt7981-routerich_ax3000.dts +@@ -0,0 +1,187 @@ ++// 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 = "Routerich AX3000"; ++ compatible = "routerich,ax3000", "mediatek,mt7981"; ++ ++ chosen { ++ stdout-path = &uart0; ++ tick-timer = &timer0; ++ }; ++ ++ memory@40000000 { ++ device_type = "memory"; ++ reg = <0x40000000 0x10000000>; ++ }; ++ ++ keys { ++ compatible = "gpio-keys"; ++ ++ button-0 { ++ label = "mesh"; ++ linux,code = ; ++ gpios = <&gpio 1 GPIO_ACTIVE_LOW>; ++ }; ++ ++ button-1 { ++ label = "reset"; ++ linux,code = ; ++ gpios = <&gpio 1 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ led-0 { ++ label = "red:wlan5g"; ++ gpios = <&gpio 5 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-1 { ++ label = "red:wan"; ++ gpios = <&gpio 6 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ led-2 { ++ label = "blue:power"; ++ gpios = <&gpio 7 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-3 { ++ label = "blue:lan1"; ++ gpios = <&gpio 9 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-4 { ++ label = "blue:lan2"; ++ gpios = <&gpio 10 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-5 { ++ label = "blue:lan3"; ++ gpios = <&gpio 11 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-6 { ++ label = "blue:wan"; ++ gpios = <&gpio 12 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-7 { ++ label = "blue:wlan2g"; ++ gpios = <&gpio 34 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-8 { ++ label = "blue:mesh"; ++ gpios = <&gpio 35 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 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 = ; ++ }; ++ }; ++}; ++ ++&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 = "uboot-env-orig"; ++ reg = <0x100000 0x80000>; ++ }; ++ ++ partition@160000 { ++ label = "Factory"; ++ reg = <0x180000 0x200000>; ++ }; ++ ++ partition@380000 { ++ label = "fip"; ++ reg = <0x380000 0x200000>; ++ }; ++ ++ partition@580000 { ++ label = "ubi"; ++ reg = <0x580000 0x7a80000>; ++ }; ++ }; ++ }; ++}; ++ ++&watchdog { ++ status = "disabled"; ++}; +--- /dev/null ++++ b/routerich_ax3000_env +@@ -0,0 +1,58 @@ ++ipaddr=192.168.1.1 ++serverip=192.168.1.254 ++loadaddr=0x46000000 ++console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0 ++bootcmd=run check_buttons ; if pstore check ; then run boot_recovery ; else run boot_ubi ; fi ++bootconf=config-1 ++bootdelay=0 ++bootfile=openwrt-mediatek-filogic-routerich_ax3000-ubootmod-initramfs-recovery.itb ++bootfile_bl2=openwrt-mediatek-filogic-routerich_ax3000-ubootmod-preloader.bin ++bootfile_fip=openwrt-mediatek-filogic-routerich_ax3000-ubootmod-bl31-uboot.fip ++bootfile_upg=openwrt-mediatek-filogic-routerich_ax3000-ubootmod-squashfs-sysupgrade.itb ++bootled_pwr=blue:power ++bootled_rec=blue:power ++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_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 ; 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 ++check_buttons=if button reset ; then run boot_tftp ; fi ++ethaddr_factory=mtd read Factory 0x40080000 0x0 0x20000 && env readmem -b ethaddr 0x40080004 0x6 ; setenv ethaddr_factory ++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 || run ubi_format ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic || 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 && ubi write $loadaddr fit $filesize ++ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize ++_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 c312295b5682295915109300c953c277d3fd420c Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Sat, 26 Oct 2024 09:37:14 +0000 Subject: [PATCH 164/877] mediatek: Routerich AX3000: add OpenWrt U-Boot layout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds OpenWrt U-Boot layout support for Routerich AX3000. The aims: 1. Get open-source U-Boot; 2. Get maximum available free space in OpenWrt. Install ------- 1. Copy OpenWrt ubootmod-bl31-uboot.fip, ubootmod-preloader.bin, to the /tmp folder of the router using scp. 2. Make mtd partitions backups: http://192.168.1.1/cgi-bin/luci/admin/system/flash -> Save mtdblock contents 3. Install kmod-mtd-rw: ``` opkg update && opkg install kmod-mtd-rw ``` 4. Write FIP and preloader: ``` insmod mtd-rw i_want_a_brick=1 mtd unlock BL2 mtd erase BL2 mtd write /tmp/ubootmod-preloader.bin BL2 mtd unlock FIP mtd erase FIP mtd write /tmp/ubootmod-bl31-uboot.fip FIP ``` 5. Copy OpenWrt ubootmod-initramfs-recovery.itb to the tftp server root with IP 192.168.1.254. 6. Reboot router: ``` reboot ``` U-Boot will automatically download from the tftp server and boot OpenWrt initramfs system. 7. Copy OpenWrt ubootmod-squashfs-sysupgrade.itb to the /tmp dir of the router using scp. 8. Run sysupgrade: ``` sysupgrade -n /tmp/squashfs-sysupgrade.itb ``` Recovery -------- 1. Place OpenWrt initramfs-recovery.itb image (with original name) on the tftp server (IP: 192.168.1.254). 2. Press "reset" button and power on the router. After ~10 sec release the button. 3. Use OpenWrt initramfs system for recovery. BL2 and FIP recovery -------------------- Use mtk_uartboot and UART connection if BL2 or FIP in UBI is destroyed: Link: https://github.com/981213/mtk_uartboot Return to stock: ---------------- 1. Copy partition backups (BL2.bin and FIP.bin) to the /tmp dir of the router using scp. 2. Install kmod-mtd-rw: ``` opkg update && opkg install kmod-mtd-rw ``` 3. Restore stock U-Boot and reboot: ``` insmod mtd-rw i_want_a_brick=1 mtd unlock BL2 mtd erase BL2 mtd write /tmp/BL2.bin BL2 mtd unlock FIP mtd erase FIP mtd write /tmp/FIP.bin FIP reboot ``` 4. Open U-Boot web recovery, upload stock firmware image and start upgrade. Link: http://192.168.1.1 Signed-off-by: Mikhail Zhilkin Link: https://github.com/openwrt/openwrt/pull/16791 Signed-off-by: Hauke Mehrtens (cherry picked from commit d413163832df93c321eef3fce8c4f72c350d5308) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- .../uboot-envtools/files/mediatek_filogic | 1 + .../dts/mt7981b-routerich-ax3000-common.dtsi | 302 ++++++++++++++++++ .../dts/mt7981b-routerich-ax3000-ubootmod.dts | 52 +++ .../mediatek/dts/mt7981b-routerich-ax3000.dts | 119 +------ .../filogic/base-files/etc/board.d/01_leds | 3 +- .../filogic/base-files/etc/board.d/02_network | 3 +- .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 1 + .../base-files/lib/upgrade/platform.sh | 1 + target/linux/mediatek/image/filogic.mk | 25 ++ 9 files changed, 400 insertions(+), 107 deletions(-) create mode 100644 target/linux/mediatek/dts/mt7981b-routerich-ax3000-common.dtsi create mode 100644 target/linux/mediatek/dts/mt7981b-routerich-ax3000-ubootmod.dts diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index b637f4328778a1..58db7dad281c0c 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -39,6 +39,7 @@ jcg,q30-pro|\ netcore,n60|\ nokia,ea0326gmp|\ qihoo,360t7|\ +routerich,ax3000-ubootmod|\ tplink,tl-xdr4288|\ tplink,tl-xdr6086|\ tplink,tl-xdr6088|\ diff --git a/target/linux/mediatek/dts/mt7981b-routerich-ax3000-common.dtsi b/target/linux/mediatek/dts/mt7981b-routerich-ax3000-common.dtsi new file mode 100644 index 00000000000000..f0b0b9365b68e3 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-routerich-ax3000-common.dtsi @@ -0,0 +1,302 @@ +// SPDX-License-Identifier: GPL-2.0-only OR MIT + +/dts-v1/; +#include +#include +#include + +#include "mt7981.dtsi" + +/ { + 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: 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: spi_nand@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spi-nand"; + reg = <0>; + + spi-max-frequency = <52000000>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <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>; + + partitions: 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@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; + }; + }; + }; +}; + +&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/dts/mt7981b-routerich-ax3000-ubootmod.dts b/target/linux/mediatek/dts/mt7981b-routerich-ax3000-ubootmod.dts new file mode 100644 index 00000000000000..dfdb78936d8c46 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-routerich-ax3000-ubootmod.dts @@ -0,0 +1,52 @@ +// SPDX-License-Identifier: GPL-2.0-only OR MIT + +#include "mt7981b-routerich-ax3000-common.dtsi" + +/ { + model = "Routerich AX3000 (OpenWrt U-Boot layout)"; + compatible = "routerich,ax3000-ubootmod", "mediatek,mt7981"; +}; + +&chosen { + rootdisk = <&ubi_fit_volume>; +}; + +&partitions { + partition@100000 { + label = "u-boot-env-orig"; + reg = <0x100000 0x80000>; + read-only; + }; + + partition@580000 { + label = "ubi"; + reg = <0x580000 0x7a80000>; + compatible = "linux,ubi"; + + volumes { + ubi_fit_volume: ubi-volume-fit { + volname = "fit"; + }; + + ubi_ubootenv: ubi-volume-ubootenv { + volname = "ubootenv"; + }; + + ubi_ubootenv2: ubi-volume-ubootenv2 { + volname = "ubootenv2"; + }; + }; + }; +}; + +&ubi_ubootenv { + nvmem-layout { + compatible = "u-boot,env-redundant-bool"; + }; +}; + +&ubi_ubootenv2 { + nvmem-layout { + compatible = "u-boot,env-redundant-bool"; + }; +}; diff --git a/target/linux/mediatek/dts/mt7981b-routerich-ax3000.dts b/target/linux/mediatek/dts/mt7981b-routerich-ax3000.dts index aa6a15ee1d1209..c0a10b3fc86bb0 100644 --- a/target/linux/mediatek/dts/mt7981b-routerich-ax3000.dts +++ b/target/linux/mediatek/dts/mt7981b-routerich-ax3000.dts @@ -1,118 +1,27 @@ // SPDX-License-Identifier: GPL-2.0-only OR MIT -/dts-v1/; -#include -#include -#include - -#include "mt7981.dtsi" +#include "mt7981b-routerich-ax3000-common.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"; - }; +&spi { + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; +}; - led-8 { - color = ; - /* LED_FUNCTION_MESH isn't implemented yet */ - function = "mesh"; - gpios = <&pio 35 GPIO_ACTIVE_LOW>; - }; +&partitions { + partition@100000 { + label = "u-boot-env"; + reg = <0x100000 0x80000>; }; - memory { - reg = <0 0x40000000 0 0x10000000>; + partition@580000 { + label = "ubi"; + reg = <0x580000 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 dad5c293dec377..38c4b7525b60e7 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 @@ -75,7 +75,8 @@ openwrt,one) ucidef_set_led_netdev "lanact" "LANACT" "green:lan" "eth1" "rx tx" ucidef_set_led_netdev "lanlink" "LANLINK" "amber:lan" "eth1" "link" ;; -routerich,ax3000) +routerich,ax3000|\ +routerich,ax3000-ubootmod) 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" 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 7bfc61a26902a2..1480dbcbc78c23 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 @@ -34,7 +34,8 @@ mediatek_setup_interfaces() cudy,wr3000-v1|\ jcg,q30-pro|\ qihoo,360t7|\ - routerich,ax3000) + routerich,ax3000|\ + routerich,ax3000-ubootmod) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" wan ;; 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 7402bfc71babb8..5e83a167de9704 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 @@ -158,6 +158,7 @@ case "$board" in [ "$PHYNBR" = "1" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress ;; routerich,ax3000|\ + routerich,ax3000-ubootmod|\ zbtlink,zbt-z8102ax|\ zbtlink,zbt-z8103ax|\ zyxel,ex5601-t0|\ 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 ce334b2c8eecbb..0040ffbb266627 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -80,6 +80,7 @@ platform_do_upgrade() { openwrt,one|\ netcore,n60|\ qihoo,360t7|\ + routerich,ax3000-ubootmod|\ 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 f366a9b9202a7c..672790f1a77698 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -1228,6 +1228,31 @@ define Device/routerich_ax3000 endef TARGET_DEVICES += routerich_ax3000 +define Device/routerich_ax3000-ubootmod + DEVICE_VENDOR := Routerich + DEVICE_MODEL := AX3000 (OpenWrt U-Boot layout) + DEVICE_DTS := mt7981b-routerich-ax3000-ubootmod + 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-mt7915e kmod-mt7981-firmware kmod-usb3 mt7981-wo-firmware + ARTIFACTS := preloader.bin bl31-uboot.fip + ARTIFACT/preloader.bin := mt7981-bl2 spim-nand-ddr3 + ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot routerich_ax3000 +endef +TARGET_DEVICES += routerich_ax3000-ubootmod + define Device/ruijie_rg-x60-pro DEVICE_VENDOR := Ruijie DEVICE_MODEL := RG-X60 Pro From 9e73f794adc8fae59c8ff45aed2d99e4b43cc2d5 Mon Sep 17 00:00:00 2001 From: John Audia Date: Sun, 29 Oct 2023 04:32:21 -0400 Subject: [PATCH 165/877] kernel: enable pressure interface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PSI provides a canonical way to see resource pressure increases as they develop, with pressure metrics for three major resources: memory, CPU, and IO. PSI stats are like barometers that provide fair warning of impending resource shortages, enabling users to take more proactive, granular, and nuanced steps when resources start becoming scarce. References: * https://www.kernel.org/doc/html/latest/accounting/psi.html * https://lwn.net/Articles/759781/ Build system: x86/64 Build-tested: x86/64/AMD Cezanne, flogic/glinet_gl-mt6000 Run-tested: x86/64/AMD Cezanne, flogic/glinet_gl-mt6000 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/13819 Signed-off-by: Hauke Mehrtens (cherry picked from commit eed39d45c2ff901b5327c7ab63c9131166e3140e) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- config/Config-kernel.in | 19 +++++++++++++++++++ target/linux/generic/config-6.6 | 1 + 2 files changed, 20 insertions(+) diff --git a/config/Config-kernel.in b/config/Config-kernel.in index 0fa039db404b78..91678cf2a660c8 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -333,6 +333,25 @@ if KERNEL_TASKSTATS endif +config KERNEL_PSI + bool "Compile the kernel with pressure stall information tracking" + help + Collect metrics that indicate how overcommitted the CPU, memory, + and IO capacity are in the system. + + If you say Y here, the kernel will create /proc/pressure/ with the + pressure statistics files cpu, memory, and io. These will indicate + the share of walltime in which some or all tasks in the system are + delayed due to contention of the respective resource. + + In kernels with cgroup support, cgroups (cgroup2 only) will + have cpu.pressure, memory.pressure, and io.pressure files, + which aggregate pressure stalls for the grouped tasks only. + + For more details see Documentation/accounting/psi.rst. + + Say N if unsure. + config KERNEL_KALLSYMS bool "Compile the kernel with symbol table information" default y if !SMALL_FLASH diff --git a/target/linux/generic/config-6.6 b/target/linux/generic/config-6.6 index 9eec780b53ae85..105dc0d344fa82 100644 --- a/target/linux/generic/config-6.6 +++ b/target/linux/generic/config-6.6 @@ -4758,6 +4758,7 @@ CONFIG_PROC_SYSCTL=y # CONFIG_PSB6970_PHY is not set # CONFIG_PSE_CONTROLLER is not set # CONFIG_PSI is not set +# CONFIG_PSI_DEFAULT_DISABLED is not set # CONFIG_PSTORE is not set # CONFIG_PSTORE_BLK is not set # CONFIG_PSTORE_COMPRESS is not set From 8c616ccf241e934174a83aa9f4efb9c46186a0c4 Mon Sep 17 00:00:00 2001 From: George Oldfort Date: Tue, 26 Nov 2024 06:42:25 +0100 Subject: [PATCH 166/877] mediatek: remove ktd-202x driver filogic image (Aer Vero W6m) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Image build fails with PR #16861 merged while PR #16860 not merged. Removing kmod-leds-ktd202x from filogic.mk will fix the build process. Fixes: 2898d1d1269a ("mediatek: add support for Acer Predator W6d and Acer Vero W6m") Signed-off-by: George Oldfort Link: https://github.com/openwrt/openwrt/pull/17087 Signed-off-by: Hauke Mehrtens (cherry picked from commit 1bdb6d84046ec1c47f28c57651358470ed212ec3) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- 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 672790f1a77698..3a36fbc46b8dcb 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -186,7 +186,7 @@ define Device/acer_vero-w6m DEVICE_DTS := mt7986a-acer-vero-w6m DEVICE_DTS_DIR := ../dts DEVICE_DTS_LOADADDR := 0x47000000 - DEVICE_PACKAGES := kmod-leds-ktd202x kmod-mt7915e kmod-mt7916-firmware kmod-mt7986-firmware mt7986-wo-firmware e2fsprogs f2fsck mkf2fs + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7916-firmware kmod-mt7986-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 7eec852c060cdef0d7d287596ac95799a954430e Mon Sep 17 00:00:00 2001 From: Hannu Nyman Date: Sun, 10 Nov 2024 17:16:51 +0200 Subject: [PATCH 167/877] gdb: Fix description for apk, remove backtick MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove backtick from gdb description text, as that seems to be recognized as a shell action by compilation with apk, causing error. Example from test buildbot: rstrip.sh: /builder/shared-workdir/build/sdk/build_dir/target-aarch64_generic_musl/gdb-15.2/ipkg-aarch64_generic/gdb/usr/bin/gdb: executable bash: -c: line 1: unexpected EOF while looking for matching ``' bash: -c: line 2: syntax error: unexpected end of file make[3]: *** [Makefile:123: /builder/shared-workdir/build/sdk/bin/packages/aarch64_generic/base/gdb-15.2-r1.apk] Error 2 Local compilation: rstrip.sh: /OpenWrt/aarch64/build_dir/target-aarch64_cortex-a53_musl/gdb-15.2/ipkg-aarch64_cortex-a53/gdb/usr/bin/gdb: executable bash: -c: line 1: unexpected EOF while looking for matching ``' make[2]: *** [Makefile:123: /OpenWrt/aarch64/bin/packages/aarch64_cortex-a53/base/gdb-15.2-r1.apk] Error 2 Signed-off-by: Hannu Nyman Link: https://github.com/openwrt/openwrt/pull/16908 Signed-off-by: Hauke Mehrtens (cherry picked from commit adb921c34ff220951a699665bb35dc0e3538b3b2) Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/devel/gdb/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/devel/gdb/Makefile b/package/devel/gdb/Makefile index 366746be87fbaf..7bdc6c83cbe899 100644 --- a/package/devel/gdb/Makefile +++ b/package/devel/gdb/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gdb PKG_VERSION:=15.2 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/gdb @@ -37,7 +37,7 @@ $(call Package/gdb/Default) endef define Package/gdb/description -GDB, the GNU Project debugger, allows you to see what is going on `inside' +GDB, the GNU Project debugger, allows you to see what is going on 'inside' another program while it executes -- or what another program was doing at the moment it crashed. endef From 2c3d036fe7d573eee9874ae9bdeb7c9b3291eebe Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Wed, 27 Nov 2024 00:25:12 +0100 Subject: [PATCH 168/877] config: Mark USE_APK broken MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will hide the USE_APK setting in OpenWrt 24.10 by default. APK is not stable yet and we do not want to support it in OpenWrt 24.10 branch. References: https://openwrt.org/meetings/20241126#release_2410 Signed-off-by: Hauke Mehrtens Signed-off-by: Petr Štetiar [meeting notes ref, config] Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- config/Config-build.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/Config-build.in b/config/Config-build.in index 481be0bb6c55dd..ae44985546b6dd 100644 --- a/config/Config-build.in +++ b/config/Config-build.in @@ -70,7 +70,8 @@ menu "Global build settings" config USE_APK imply PACKAGE_apk-mbedtls - bool "Use APK instead of OPKG to build distribution (EXPERIMENTAL)" + bool "Use APK instead of OPKG to build distribution (BROKEN)" + depends on BROKEN comment "General build options" From 17bdccb4a52049ee06142c0b5fbc2001bc519a3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Wed, 27 Nov 2024 08:32:01 +0000 Subject: [PATCH 169/877] apk: mark package as broken to hide it by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit During the last OpenWrt developer meeting 2024-11-26 it was decided, that 24.10 will be the last release using opkg package manager and thus apk won't be supported, so make it explicit and mark apk package manager as broken. References: https://openwrt.org/meetings/20241126#release_2410 Link: https://github.com/openwrt/openwrt/pull/17097 Signed-off-by: Petr Štetiar --- package/system/apk/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/system/apk/Makefile b/package/system/apk/Makefile index 3e2066e2698f33..8242e12ee92e8b 100644 --- a/package/system/apk/Makefile +++ b/package/system/apk/Makefile @@ -27,7 +27,7 @@ define Package/apk/default SECTION:=base CATEGORY:=Base system TITLE:=apk package manager - DEPENDS:=+zlib + DEPENDS:=@BROKEN +zlib URL:=$(PKG_SOURCE_URL) PROVIDES:=apk endef From de8a1a1e3adfb2085189f2a7de576ca4e6484afe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Wed, 27 Nov 2024 08:39:46 +0000 Subject: [PATCH 170/877] mediatek: filogic: Cudy WR3000S v1: fix CRLF line endings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DTS file for this device seems to be using CRLF line endings, so lets convert them into Unix-style LF. Fixes: faf4b3e0f7a5 ("mediatek: filogic: add support for Cudy WR3000S v1") Link: https://github.com/openwrt/openwrt/pull/17096 Signed-off-by: Petr Štetiar (cherry picked from commit 30ae0b3f1e331646054d8110e931dfaa32f7b414) --- .../mediatek/dts/mt7981b-cudy-wr3000s-v1.dts | 566 +++++++++--------- 1 file changed, 283 insertions(+), 283 deletions(-) diff --git a/target/linux/mediatek/dts/mt7981b-cudy-wr3000s-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-wr3000s-v1.dts index a6439694943352..cf2f79b40770f9 100644 --- a/target/linux/mediatek/dts/mt7981b-cudy-wr3000s-v1.dts +++ b/target/linux/mediatek/dts/mt7981b-cudy-wr3000s-v1.dts @@ -1,283 +1,283 @@ -// SPDX-License-Identifier: (GPL-2.0 OR MIT) - -/dts-v1/; - -#include - -#include "mt7981.dtsi" - -/ { - model = "Cudy WR3000S v1"; - compatible = "cudy,wr3000s-v1", "mediatek,mt7981-spim-snand-rfb"; - - aliases { - label-mac-device = &gmac0; - led-boot = &led_status; - led-failsafe = &led_status; - led-running = &led_status; - led-upgrade = &led_status; - serial0 = &uart0; - }; - - 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_internet { - function = LED_FUNCTION_WAN_ONLINE; - color = ; - gpios = <&pio 11 GPIO_ACTIVE_LOW>; - }; - - led_wps { - function = LED_FUNCTION_WPS; - color = ; - gpios = <&pio 9 GPIO_ACTIVE_LOW>; - }; - - led_wlan2g { - function = LED_FUNCTION_WLAN_2GHZ; - color = ; - gpios = <&pio 6 GPIO_ACTIVE_LOW>; - linux,default-trigger = "phy0tpt"; - }; - - led_wlan5g { - function = LED_FUNCTION_WLAN_5GHZ; - color = ; - gpios = <&pio 7 GPIO_ACTIVE_LOW>; - linux,default-trigger = "phy1tpt"; - }; - }; -}; - -&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_bdinfo_de00 0>; - - fixed-link { - speed = <2500>; - full-duplex; - pause; - }; - }; -}; - -&mdio_bus { - switch: switch@1f { - 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: 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-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 = <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>; - }; - }; - }; - - partition@380000 { - label = "bdinfo"; - reg = <0x380000 0x0040000>; - 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@3C0000 { - label = "FIP"; - reg = <0x3C0000 0x0200000>; - read-only; - }; - - partition@580000 { - label = "ubi"; - reg = <0x5C0000 0x4000000>; - compatible = "linux,ubi"; - }; - }; - }; -}; - -&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 = ; - }; - }; -}; - -&switch { - ports { - #address-cells = <1>; - #size-cells = <0>; - - port@0 { - reg = <0>; - label = "wan"; - - nvmem-cell-names = "mac-address"; - nvmem-cells = <&macaddr_bdinfo_de00 1>; - }; - - 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@6 { - reg = <6>; - label = "cpu"; - ethernet = <&gmac0>; - phy-mode = "2500base-x"; - - fixed-link { - speed = <2500>; - full-duplex; - pause; - }; - }; - }; -}; - -&wifi { - status = "okay"; - nvmem-cells = <&eeprom_factory_0>; - nvmem-cell-names = "eeprom"; -}; +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/dts-v1/; + +#include + +#include "mt7981.dtsi" + +/ { + model = "Cudy WR3000S v1"; + compatible = "cudy,wr3000s-v1", "mediatek,mt7981-spim-snand-rfb"; + + aliases { + label-mac-device = &gmac0; + led-boot = &led_status; + led-failsafe = &led_status; + led-running = &led_status; + led-upgrade = &led_status; + serial0 = &uart0; + }; + + 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_internet { + function = LED_FUNCTION_WAN_ONLINE; + color = ; + gpios = <&pio 11 GPIO_ACTIVE_LOW>; + }; + + led_wps { + function = LED_FUNCTION_WPS; + color = ; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + }; + + led_wlan2g { + function = LED_FUNCTION_WLAN_2GHZ; + color = ; + gpios = <&pio 6 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + led_wlan5g { + function = LED_FUNCTION_WLAN_5GHZ; + color = ; + gpios = <&pio 7 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + }; +}; + +&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_bdinfo_de00 0>; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; +}; + +&mdio_bus { + switch: switch@1f { + 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: 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-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 = <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>; + }; + }; + }; + + partition@380000 { + label = "bdinfo"; + reg = <0x380000 0x0040000>; + 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@3C0000 { + label = "FIP"; + reg = <0x3C0000 0x0200000>; + read-only; + }; + + partition@580000 { + label = "ubi"; + reg = <0x5C0000 0x4000000>; + compatible = "linux,ubi"; + }; + }; + }; +}; + +&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 = ; + }; + }; +}; + +&switch { + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "wan"; + + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_bdinfo_de00 1>; + }; + + 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@6 { + reg = <6>; + label = "cpu"; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; +}; + +&wifi { + status = "okay"; + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; +}; From c981096416737a3029ee92aca61cdeda31f311e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Thu, 28 Nov 2024 16:30:07 +0000 Subject: [PATCH 171/877] tools: ccache update to 4.10.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes since 4.10: * Fixed detection of Fmt version 11 and newer. * Fixed prefix command lookup from PATH. Suggested-by: Jen Wolf Link: https://github.com/openwrt/openwrt/pull/17105 Signed-off-by: Petr Štetiar (cherry picked from commit 08f12283c7436814cdd10d93b5cb913f49acad3e) --- tools/ccache/Makefile | 4 ++-- tools/ccache/patches/100-honour-copts.patch | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/ccache/Makefile b/tools/ccache/Makefile index 47c24a5c98864a..447bc3ea432f04 100644 --- a/tools/ccache/Makefile +++ b/tools/ccache/Makefile @@ -7,11 +7,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ccache -PKG_VERSION:=4.10 +PKG_VERSION:=4.10.2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/ccache/ccache/releases/download/v$(PKG_VERSION) -PKG_HASH:=16972ba62c8499045edc3ae7d7b8a0b419a961567f5ff0f01bf5a44194204775 +PKG_HASH:=108100960bb7e64573ea925af2ee7611701241abb36ce0aae3354528403a7d87 include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/cmake.mk diff --git a/tools/ccache/patches/100-honour-copts.patch b/tools/ccache/patches/100-honour-copts.patch index a40665ea25836c..c07c8ce8eb3a25 100644 --- a/tools/ccache/patches/100-honour-copts.patch +++ b/tools/ccache/patches/100-honour-copts.patch @@ -1,6 +1,6 @@ --- a/src/ccache/ccache.cpp +++ b/src/ccache/ccache.cpp -@@ -1906,6 +1906,7 @@ get_manifest_key(Context& ctx, Hash& has +@@ -1914,6 +1914,7 @@ get_manifest_key(Context& ctx, Hash& has "OBJCPLUS_INCLUDE_PATH", // Clang "CLANG_CONFIG_FILE_SYSTEM_DIR", // Clang "CLANG_CONFIG_FILE_USER_DIR", // Clang From d276b4c91a50aeac14f84284c22bb4938881f64a Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Wed, 27 Nov 2024 10:31:35 +0900 Subject: [PATCH 172/877] Revert "ath79: elecom,wab: use nvmem" This reverts commit 70e41d0205d95386881fa1cdf6ee00f6cca1b3f6. "ethaddr" is stored into the "u-boot-env" (stock: "Config") partition and it's quoted with double-quotations, but that format is not supported by the current NVMEM u-boot-env driver (and mac_pton() function) and the MAC address won't be parsed to byte array. This causes random MAC addresses on the adapters, so revert the above commit. Signed-off-by: INAGAKI Hiroshi Link: https://github.com/openwrt/openwrt/pull/17116 (cherry picked from commit af611bce44d3dcffd47c47f46b95400445498be9) Link: https://github.com/openwrt/openwrt/pull/17117 Signed-off-by: Robert Marko --- target/linux/ath79/dts/qca955x_elecom_wab.dtsi | 17 ++++------------- .../generic/base-files/etc/board.d/02_network | 3 +++ .../etc/hotplug.d/ieee80211/10_fix_wifi_mac | 10 ++++++++++ 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/target/linux/ath79/dts/qca955x_elecom_wab.dtsi b/target/linux/ath79/dts/qca955x_elecom_wab.dtsi index 53bb5b0141254b..43e34c6029182d 100644 --- a/target/linux/ath79/dts/qca955x_elecom_wab.dtsi +++ b/target/linux/ath79/dts/qca955x_elecom_wab.dtsi @@ -8,7 +8,6 @@ / { aliases { - label-mac-device = ð0; led-boot = &led_status; led-failsafe = &led_status; led-upgrade = &led_status; @@ -108,9 +107,6 @@ phy-mode = "rgmii-rxid"; pll-data = <0xae000000 0x80000101 0x80001313>; - nvmem-cells = <&macaddr_uboot_ethaddr 0>; - nvmem-cell-names = "mac-address"; - gmac-config { device = <&gmac>; @@ -148,8 +144,8 @@ wifi@0,0 { compatible = "qcom,ath10k"; reg = <0x0000 0 0 0 0>; - nvmem-cells = <&cal_art_5000>, <&macaddr_uboot_ethaddr 1>; - nvmem-cell-names = "calibration", "mac-address"; + nvmem-cells = <&cal_art_5000>; + nvmem-cell-names = "calibration"; }; }; @@ -173,14 +169,9 @@ }; partition@40000 { - compatible = "u-boot,env"; label = "u-boot-env"; reg = <0x40000 0x10000>; read-only; - - macaddr_uboot_ethaddr: ethaddr { - #nvmem-cell-cells = <1>; - }; }; partition@50000 { @@ -261,6 +252,6 @@ &wmac { status = "okay"; - nvmem-cells = <&cal_art_1000>, <&macaddr_uboot_ethaddr 0>; - nvmem-cell-names = "calibration", "mac-address"; + nvmem-cells = <&cal_art_1000>; + nvmem-cell-names = "calibration"; }; 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 2bd97442d956dc..016bd6bb51b5f5 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 @@ -717,6 +717,9 @@ ath79_setup_macs() lan_mac=$(mtd_get_mac_ascii devdata "lanmac") wan_mac=$(mtd_get_mac_ascii devdata "wanmac") ;; + elecom,wab-i1750-ps|\ + elecom,wab-s1167-ps|\ + elecom,wab-s600-ps|\ engenius,ecb1200|\ engenius,ecb1750) lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr) diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac index 6676e4d509873f..5155d240a825ac 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac @@ -42,6 +42,16 @@ case "$board" in [ "$PHYNBR" -eq 1 ] && \ mtd_get_mac_ascii bdcfg "wlanmac" > /sys${DEVPATH}/macaddress ;; + elecom,wab-i1750-ps|\ + elecom,wab-s1167-ps|\ + elecom,wab-s600-ps) + # set the 5G MAC address (= ethaddr + 1) + [ "$PHYNBR" -eq 0 ] && \ + macaddr_add "$(mtd_get_mac_ascii u-boot-env ethaddr)" 1 > /sys${DEVPATH}/macaddress + # set the 2.4G MAC address (= ethaddr) + [ "$PHYNBR" -eq 1 ] && \ + mtd_get_mac_ascii u-boot-env "ethaddr" > /sys${DEVPATH}/macaddress + ;; engenius,ecb1200|\ engenius,ecb1750) [ "$PHYNBR" -eq 0 ] && \ From 41714984df411788b5b0ceedc950c6981f5ada2e Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Mon, 2 Dec 2024 00:22:08 +0100 Subject: [PATCH 173/877] OpenWrt v24.10.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 581de056c41e3e..83d718aa292d6e 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git;openwrt-24.10 -src-git luci https://git.openwrt.org/project/luci.git;openwrt-24.10 -src-git routing https://git.openwrt.org/feed/routing.git;openwrt-24.10 -src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-24.10 +src-git packages https://git.openwrt.org/feed/packages.git^b5f11b79d2b0538d57103a8da05e7a7a87981ff3 +src-git luci https://git.openwrt.org/project/luci.git^094507c19372268d13679d2e6ad4325e08a333e2 +src-git routing https://git.openwrt.org/feed/routing.git^3f15699240c076d5ee9ed697fa5ef45355423f6f +src-git telephony https://git.openwrt.org/feed/telephony.git^fd605af7143165a2490681ec1752f259873b9147 diff --git a/include/version.mk b/include/version.mk index a6ebe587797707..36ac28a9932de7 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),24.10-SNAPSHOT) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),24.10.0-rc1) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION)) +VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r28158-d276b4c91a) VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO)) -VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/24.10-SNAPSHOT) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/24.10.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 80db993d46b837..f96e4a6a87934d 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/24.10-SNAPSHOT" + default "https://downloads.openwrt.org/releases/24.10.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..e0dae07d3749f0 --- /dev/null +++ b/version @@ -0,0 +1 @@ +r28158-d276b4c91a diff --git a/version.date b/version.date new file mode 100644 index 00000000000000..ce8d81b31b5f7c --- /dev/null +++ b/version.date @@ -0,0 +1 @@ +1732901136 From 5601274444df871dbf8ee3a7eb5d30da7a39c77b Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Mon, 2 Dec 2024 00:22:14 +0100 Subject: [PATCH 174/877] OpenWrt v24.10.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 83d718aa292d6e..581de056c41e3e 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git^b5f11b79d2b0538d57103a8da05e7a7a87981ff3 -src-git luci https://git.openwrt.org/project/luci.git^094507c19372268d13679d2e6ad4325e08a333e2 -src-git routing https://git.openwrt.org/feed/routing.git^3f15699240c076d5ee9ed697fa5ef45355423f6f -src-git telephony https://git.openwrt.org/feed/telephony.git^fd605af7143165a2490681ec1752f259873b9147 +src-git packages https://git.openwrt.org/feed/packages.git;openwrt-24.10 +src-git luci https://git.openwrt.org/project/luci.git;openwrt-24.10 +src-git routing https://git.openwrt.org/feed/routing.git;openwrt-24.10 +src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-24.10 diff --git a/include/version.mk b/include/version.mk index 36ac28a9932de7..a6ebe587797707 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),24.10.0-rc1) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),24.10-SNAPSHOT) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r28158-d276b4c91a) +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/24.10.0-rc1) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/24.10-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 f96e4a6a87934d..80db993d46b837 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/24.10.0-rc1" + default "https://downloads.openwrt.org/releases/24.10-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 e0dae07d3749f0..00000000000000 --- a/version +++ /dev/null @@ -1 +0,0 @@ -r28158-d276b4c91a diff --git a/version.date b/version.date deleted file mode 100644 index ce8d81b31b5f7c..00000000000000 --- a/version.date +++ /dev/null @@ -1 +0,0 @@ -1732901136 From ea17e958b9933aaf3e4a390073025aa226fe91b7 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Tue, 3 Dec 2024 11:30:18 +0100 Subject: [PATCH 175/877] build: Unconditionally append kmod feed for BuildBot Recent changes to BuildBot config moved the kmods to a dedicated directory and dropped them from the packages dir. This was needed as both OPKG and APK gets confused if both entry are present. To fix this, unconditionally append the kmod feed line if CONFIG_BUILDBOT is enabled. Fixes: #17146 Link: https://github.com/openwrt/openwrt/pull/17151 Signed-off-by: Christian Marangi (cherry picked from commit 53ee2e8c0339c1d7ace47b8cf390147b86ea8d1d) --- include/feeds.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/feeds.mk b/include/feeds.mk index 87b1562c3edbf7..c3a47cf5f92252 100644 --- a/include/feeds.mk +++ b/include/feeds.mk @@ -37,7 +37,7 @@ define FeedSourcesAppendOPKG echo 'src/gz %d_core %U/targets/%S/packages'; \ $(strip $(if $(CONFIG_PER_FEED_REPO), \ echo 'src/gz %d_base %U/packages/%A/base'; \ - $(if $(filter %SNAPSHOT-y,$(VERSION_NUMBER)-$(CONFIG_BUILDBOT)), \ + $(if $(CONFIG_BUILDBOT), \ echo 'src/gz %d_kmods %U/targets/%S/kmods/$(LINUX_VERSION)-$(LINUX_RELEASE)-$(LINUX_VERMAGIC)';) \ $(foreach feed,$(FEEDS_AVAILABLE), \ $(if $(CONFIG_FEED_$(feed)), \ @@ -51,7 +51,7 @@ define FeedSourcesAppendAPK echo '%U/targets/%S/packages/packages.adb'; \ $(strip $(if $(CONFIG_PER_FEED_REPO), \ echo '%U/packages/%A/base/packages.adb'; \ - $(if $(filter %SNAPSHOT-y,$(VERSION_NUMBER)-$(CONFIG_BUILDBOT)), \ + $(if $(CONFIG_BUILDBOT), \ echo '%U/targets/%S/kmods/$(LINUX_VERSION)-$(LINUX_RELEASE)-$(LINUX_VERMAGIC)/packages.adb';) \ $(foreach feed,$(FEEDS_AVAILABLE), \ $(if $(CONFIG_FEED_$(feed)), \ From 66e76aa94f0508d63a75fac2739a5bc0edb021ec Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Tue, 3 Dec 2024 22:24:32 +0100 Subject: [PATCH 176/877] OpenWrt v24.10.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 581de056c41e3e..7896cb296591cb 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git;openwrt-24.10 -src-git luci https://git.openwrt.org/project/luci.git;openwrt-24.10 -src-git routing https://git.openwrt.org/feed/routing.git;openwrt-24.10 -src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-24.10 +src-git packages https://git.openwrt.org/feed/packages.git^b5f11b79d2b0538d57103a8da05e7a7a87981ff3 +src-git luci https://git.openwrt.org/project/luci.git^e76155d09484602e2b02e84bb8ffafa4848798f0 +src-git routing https://git.openwrt.org/feed/routing.git^3f15699240c076d5ee9ed697fa5ef45355423f6f +src-git telephony https://git.openwrt.org/feed/telephony.git^fd605af7143165a2490681ec1752f259873b9147 diff --git a/include/version.mk b/include/version.mk index a6ebe587797707..01116d5b7651fc 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),24.10-SNAPSHOT) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),24.10.0-rc2) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION)) +VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r28161-ea17e958b9) VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO)) -VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/24.10-SNAPSHOT) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/24.10.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 80db993d46b837..98ee2f24fd7cb9 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/24.10-SNAPSHOT" + default "https://downloads.openwrt.org/releases/24.10.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..f3e1c7bc231b21 --- /dev/null +++ b/version @@ -0,0 +1 @@ +r28161-ea17e958b9 diff --git a/version.date b/version.date new file mode 100644 index 00000000000000..8de87fb33c0048 --- /dev/null +++ b/version.date @@ -0,0 +1 @@ +1733226068 From c995dd97c76c425d1e187163f32c2b2168f508d2 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Tue, 3 Dec 2024 22:24:36 +0100 Subject: [PATCH 177/877] OpenWrt v24.10.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 7896cb296591cb..581de056c41e3e 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git^b5f11b79d2b0538d57103a8da05e7a7a87981ff3 -src-git luci https://git.openwrt.org/project/luci.git^e76155d09484602e2b02e84bb8ffafa4848798f0 -src-git routing https://git.openwrt.org/feed/routing.git^3f15699240c076d5ee9ed697fa5ef45355423f6f -src-git telephony https://git.openwrt.org/feed/telephony.git^fd605af7143165a2490681ec1752f259873b9147 +src-git packages https://git.openwrt.org/feed/packages.git;openwrt-24.10 +src-git luci https://git.openwrt.org/project/luci.git;openwrt-24.10 +src-git routing https://git.openwrt.org/feed/routing.git;openwrt-24.10 +src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-24.10 diff --git a/include/version.mk b/include/version.mk index 01116d5b7651fc..a6ebe587797707 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),24.10.0-rc2) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),24.10-SNAPSHOT) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r28161-ea17e958b9) +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/24.10.0-rc2) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/24.10-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 98ee2f24fd7cb9..80db993d46b837 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/24.10.0-rc2" + default "https://downloads.openwrt.org/releases/24.10-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 f3e1c7bc231b21..00000000000000 --- a/version +++ /dev/null @@ -1 +0,0 @@ -r28161-ea17e958b9 diff --git a/version.date b/version.date deleted file mode 100644 index 8de87fb33c0048..00000000000000 --- a/version.date +++ /dev/null @@ -1 +0,0 @@ -1733226068 From f483de47677cbe42cd20d51c0d184d0825e247ab Mon Sep 17 00:00:00 2001 From: Bohdan Chubuk Date: Mon, 11 Nov 2024 01:57:31 +0200 Subject: [PATCH 178/877] generic: mtd: spinand: add support for FORESEE F35SQA002G Add support for FORESEE F35SQA002G SPI NAND. Datasheet: https://www.longsys.com/uploads/LM-00006FORESEEF35SQA002GDatasheet_1650183701.pdf Refresh all affected patch with make target/linux/refresh. Signed-off-by: Martin Kurbanov Signed-off-by: Miquel Raynal Signed-off-by: Bohdan Chubuk Link: https://github.com/openwrt/openwrt/pull/16915 (cherry picked from commit 5348e2e81ad9d6cc34bee1511bff7805386205d4) Link: https://github.com/openwrt/openwrt/pull/17188 Signed-off-by: Christian Marangi --- ...d-add-support-for-FORESEE-F35SQA002G.patch | 146 ++++++++++++++++++ ...flip_threshold-to-75-of-ECC-strength.patch | 2 +- ...nd-Add-support-for-Etron-EM73D044VCx.patch | 8 +- .../330-snand-mtk-bmt-support.patch | 6 +- ...Add-support-for-the-Fidelix-FM35X1GA.patch | 12 +- ...and-Add-calibration-support-for-spin.patch | 4 +- ...nor-Add-calibration-support-for-spi-.patch | 2 +- 7 files changed, 163 insertions(+), 17 deletions(-) create mode 100644 target/linux/generic/backport-6.6/411-v6.7-mtd-spinand-add-support-for-FORESEE-F35SQA002G.patch diff --git a/target/linux/generic/backport-6.6/411-v6.7-mtd-spinand-add-support-for-FORESEE-F35SQA002G.patch b/target/linux/generic/backport-6.6/411-v6.7-mtd-spinand-add-support-for-FORESEE-F35SQA002G.patch new file mode 100644 index 00000000000000..90672b99797c3c --- /dev/null +++ b/target/linux/generic/backport-6.6/411-v6.7-mtd-spinand-add-support-for-FORESEE-F35SQA002G.patch @@ -0,0 +1,146 @@ +From 49c8e854869d673df8452f24dfa8989cd0f615a8 Mon Sep 17 00:00:00 2001 +From: Martin Kurbanov +Date: Mon, 2 Oct 2023 17:04:58 +0300 +Subject: [PATCH] mtd: spinand: add support for FORESEE F35SQA002G + +Add support for FORESEE F35SQA002G SPI NAND. +Datasheet: + https://www.longsys.com/uploads/LM-00006FORESEEF35SQA002GDatasheet_1650183701.pdf + +Signed-off-by: Martin Kurbanov +Signed-off-by: Miquel Raynal +Link: https://lore.kernel.org/linux-mtd/20231002140458.147605-1-mmkurbanov@salutedevices.com +--- + drivers/mtd/nand/spi/Makefile | 2 +- + drivers/mtd/nand/spi/core.c | 1 + + drivers/mtd/nand/spi/foresee.c | 95 ++++++++++++++++++++++++++++++++++ + include/linux/mtd/spinand.h | 1 + + 4 files changed, 98 insertions(+), 1 deletion(-) + create mode 100644 drivers/mtd/nand/spi/foresee.c + +--- a/drivers/mtd/nand/spi/Makefile ++++ b/drivers/mtd/nand/spi/Makefile +@@ -1,4 +1,4 @@ + # SPDX-License-Identifier: GPL-2.0 +-spinand-objs := core.o alliancememory.o ato.o esmt.o gigadevice.o macronix.o ++spinand-objs := core.o alliancememory.o ato.o esmt.o foresee.o gigadevice.o macronix.o + spinand-objs += micron.o paragon.o toshiba.o winbond.o xtx.o + obj-$(CONFIG_MTD_SPI_NAND) += spinand.o +--- a/drivers/mtd/nand/spi/core.c ++++ b/drivers/mtd/nand/spi/core.c +@@ -940,6 +940,7 @@ static const struct spinand_manufacturer + &alliancememory_spinand_manufacturer, + &ato_spinand_manufacturer, + &esmt_c8_spinand_manufacturer, ++ &foresee_spinand_manufacturer, + &gigadevice_spinand_manufacturer, + ¯onix_spinand_manufacturer, + µn_spinand_manufacturer, +--- /dev/null ++++ b/drivers/mtd/nand/spi/foresee.c +@@ -0,0 +1,95 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright (c) 2023, SberDevices. All Rights Reserved. ++ * ++ * Author: Martin Kurbanov ++ */ ++ ++#include ++#include ++#include ++ ++#define SPINAND_MFR_FORESEE 0xCD ++ ++static SPINAND_OP_VARIANTS(read_cache_variants, ++ SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0), ++ SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0)); ++ ++static SPINAND_OP_VARIANTS(write_cache_variants, ++ SPINAND_PROG_LOAD_X4(true, 0, NULL, 0), ++ SPINAND_PROG_LOAD(true, 0, NULL, 0)); ++ ++static SPINAND_OP_VARIANTS(update_cache_variants, ++ SPINAND_PROG_LOAD_X4(false, 0, NULL, 0), ++ SPINAND_PROG_LOAD(false, 0, NULL, 0)); ++ ++static int f35sqa002g_ooblayout_ecc(struct mtd_info *mtd, int section, ++ struct mtd_oob_region *region) ++{ ++ return -ERANGE; ++} ++ ++static int f35sqa002g_ooblayout_free(struct mtd_info *mtd, int section, ++ struct mtd_oob_region *region) ++{ ++ if (section) ++ return -ERANGE; ++ ++ /* Reserve 2 bytes for the BBM. */ ++ region->offset = 2; ++ region->length = 62; ++ ++ return 0; ++} ++ ++static const struct mtd_ooblayout_ops f35sqa002g_ooblayout = { ++ .ecc = f35sqa002g_ooblayout_ecc, ++ .free = f35sqa002g_ooblayout_free, ++}; ++ ++static int f35sqa002g_ecc_get_status(struct spinand_device *spinand, u8 status) ++{ ++ struct nand_device *nand = spinand_to_nand(spinand); ++ ++ switch (status & STATUS_ECC_MASK) { ++ case STATUS_ECC_NO_BITFLIPS: ++ return 0; ++ ++ case STATUS_ECC_HAS_BITFLIPS: ++ return nanddev_get_ecc_conf(nand)->strength; ++ ++ default: ++ break; ++ } ++ ++ /* More than 1-bit error was detected in one or more sectors and ++ * cannot be corrected. ++ */ ++ return -EBADMSG; ++} ++ ++static const struct spinand_info foresee_spinand_table[] = { ++ SPINAND_INFO("F35SQA002G", ++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x72, 0x72), ++ NAND_MEMORG(1, 2048, 64, 64, 2048, 40, 1, 1, 1), ++ NAND_ECCREQ(1, 512), ++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants, ++ &write_cache_variants, ++ &update_cache_variants), ++ SPINAND_HAS_QE_BIT, ++ SPINAND_ECCINFO(&f35sqa002g_ooblayout, ++ f35sqa002g_ecc_get_status)), ++}; ++ ++static const struct spinand_manufacturer_ops foresee_spinand_manuf_ops = { ++}; ++ ++const struct spinand_manufacturer foresee_spinand_manufacturer = { ++ .id = SPINAND_MFR_FORESEE, ++ .name = "FORESEE", ++ .chips = foresee_spinand_table, ++ .nchips = ARRAY_SIZE(foresee_spinand_table), ++ .ops = &foresee_spinand_manuf_ops, ++}; +--- a/include/linux/mtd/spinand.h ++++ b/include/linux/mtd/spinand.h +@@ -263,6 +263,7 @@ struct spinand_manufacturer { + extern const struct spinand_manufacturer alliancememory_spinand_manufacturer; + extern const struct spinand_manufacturer ato_spinand_manufacturer; + extern const struct spinand_manufacturer esmt_c8_spinand_manufacturer; ++extern const struct spinand_manufacturer foresee_spinand_manufacturer; + extern const struct spinand_manufacturer gigadevice_spinand_manufacturer; + extern const struct spinand_manufacturer macronix_spinand_manufacturer; + extern const struct spinand_manufacturer micron_spinand_manufacturer; diff --git a/target/linux/generic/pending-6.6/410-mtd-spinand-set-bitflip_threshold-to-75-of-ECC-strength.patch b/target/linux/generic/pending-6.6/410-mtd-spinand-set-bitflip_threshold-to-75-of-ECC-strength.patch index aeac79c02383a3..84c6c4ae13b850 100644 --- a/target/linux/generic/pending-6.6/410-mtd-spinand-set-bitflip_threshold-to-75-of-ECC-strength.patch +++ b/target/linux/generic/pending-6.6/410-mtd-spinand-set-bitflip_threshold-to-75-of-ECC-strength.patch @@ -53,7 +53,7 @@ Signed-off-by: Daniel Golle --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c -@@ -1286,6 +1286,7 @@ static int spinand_init(struct spinand_d +@@ -1287,6 +1287,7 @@ static int spinand_init(struct spinand_d /* Propagate ECC information to mtd_info */ mtd->ecc_strength = nanddev_get_ecc_conf(nand)->strength; mtd->ecc_step_size = nanddev_get_ecc_conf(nand)->step_size; diff --git a/target/linux/generic/pending-6.6/487-mtd-spinand-Add-support-for-Etron-EM73D044VCx.patch b/target/linux/generic/pending-6.6/487-mtd-spinand-Add-support-for-Etron-EM73D044VCx.patch index 8fd136595262da..7a3a0f33adb74a 100644 --- a/target/linux/generic/pending-6.6/487-mtd-spinand-Add-support-for-Etron-EM73D044VCx.patch +++ b/target/linux/generic/pending-6.6/487-mtd-spinand-Add-support-for-Etron-EM73D044VCx.patch @@ -42,9 +42,9 @@ Submitted-by: Daniel Danzberger +++ b/drivers/mtd/nand/spi/Makefile @@ -1,4 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 --spinand-objs := core.o alliancememory.o ato.o esmt.o gigadevice.o macronix.o +-spinand-objs := core.o alliancememory.o ato.o esmt.o foresee.o gigadevice.o macronix.o -spinand-objs += micron.o paragon.o toshiba.o winbond.o xtx.o -+spinand-objs := core.o alliancememory.o ato.o esmt.o etron.o gigadevice.o ++spinand-objs := core.o alliancememory.o ato.o esmt.o etron.o foresee.o gigadevice.o +spinand-objs += macronix.o micron.o paragon.o toshiba.o winbond.o xtx.o obj-$(CONFIG_MTD_SPI_NAND) += spinand.o --- a/drivers/mtd/nand/spi/core.c @@ -54,9 +54,9 @@ Submitted-by: Daniel Danzberger &ato_spinand_manufacturer, &esmt_c8_spinand_manufacturer, + &etron_spinand_manufacturer, + &foresee_spinand_manufacturer, &gigadevice_spinand_manufacturer, ¯onix_spinand_manufacturer, - µn_spinand_manufacturer, --- /dev/null +++ b/drivers/mtd/nand/spi/etron.c @@ -0,0 +1,98 @@ @@ -165,6 +165,6 @@ Submitted-by: Daniel Danzberger extern const struct spinand_manufacturer ato_spinand_manufacturer; extern const struct spinand_manufacturer esmt_c8_spinand_manufacturer; +extern const struct spinand_manufacturer etron_spinand_manufacturer; + extern const struct spinand_manufacturer foresee_spinand_manufacturer; extern const struct spinand_manufacturer gigadevice_spinand_manufacturer; extern const struct spinand_manufacturer macronix_spinand_manufacturer; - extern const struct spinand_manufacturer micron_spinand_manufacturer; diff --git a/target/linux/mediatek/patches-6.6/330-snand-mtk-bmt-support.patch b/target/linux/mediatek/patches-6.6/330-snand-mtk-bmt-support.patch index de8e8806433c60..939ec048555787 100644 --- a/target/linux/mediatek/patches-6.6/330-snand-mtk-bmt-support.patch +++ b/target/linux/mediatek/patches-6.6/330-snand-mtk-bmt-support.patch @@ -8,7 +8,7 @@ static int spinand_read_reg_op(struct spinand_device *spinand, u8 reg, u8 *val) { -@@ -1346,6 +1347,7 @@ static int spinand_probe(struct spi_mem +@@ -1347,6 +1348,7 @@ static int spinand_probe(struct spi_mem if (ret) return ret; @@ -16,7 +16,7 @@ ret = mtd_device_register(mtd, NULL, 0); if (ret) goto err_spinand_cleanup; -@@ -1353,6 +1355,7 @@ static int spinand_probe(struct spi_mem +@@ -1354,6 +1356,7 @@ static int spinand_probe(struct spi_mem return 0; err_spinand_cleanup: @@ -24,7 +24,7 @@ spinand_cleanup(spinand); return ret; -@@ -1371,6 +1374,7 @@ static int spinand_remove(struct spi_mem +@@ -1372,6 +1375,7 @@ static int spinand_remove(struct spi_mem if (ret) return ret; diff --git a/target/linux/mediatek/patches-6.6/340-mtd-spinand-Add-support-for-the-Fidelix-FM35X1GA.patch b/target/linux/mediatek/patches-6.6/340-mtd-spinand-Add-support-for-the-Fidelix-FM35X1GA.patch index 22408b9273dfcc..e06e125c462e2b 100644 --- a/target/linux/mediatek/patches-6.6/340-mtd-spinand-Add-support-for-the-Fidelix-FM35X1GA.patch +++ b/target/linux/mediatek/patches-6.6/340-mtd-spinand-Add-support-for-the-Fidelix-FM35X1GA.patch @@ -18,18 +18,18 @@ Signed-off-by: Davide Fioravanti +++ b/drivers/mtd/nand/spi/Makefile @@ -1,4 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 --spinand-objs := core.o alliancememory.o ato.o esmt.o etron.o gigadevice.o -+spinand-objs := core.o alliancememory.o ato.o esmt.o etron.o fidelix.o gigadevice.o +-spinand-objs := core.o alliancememory.o ato.o esmt.o etron.o foresee.o gigadevice.o ++spinand-objs := core.o alliancememory.o ato.o esmt.o etron.o fidelix.o foresee.o gigadevice.o spinand-objs += macronix.o micron.o paragon.o toshiba.o winbond.o xtx.o obj-$(CONFIG_MTD_SPI_NAND) += spinand.o --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c -@@ -941,6 +941,7 @@ static const struct spinand_manufacturer - &alliancememory_spinand_manufacturer, +@@ -942,6 +942,7 @@ static const struct spinand_manufacturer &ato_spinand_manufacturer, &esmt_c8_spinand_manufacturer, -+ &fidelix_spinand_manufacturer, &etron_spinand_manufacturer, ++ &fidelix_spinand_manufacturer, + &foresee_spinand_manufacturer, &gigadevice_spinand_manufacturer, ¯onix_spinand_manufacturer, --- /dev/null @@ -118,6 +118,6 @@ Signed-off-by: Davide Fioravanti extern const struct spinand_manufacturer esmt_c8_spinand_manufacturer; extern const struct spinand_manufacturer etron_spinand_manufacturer; +extern const struct spinand_manufacturer fidelix_spinand_manufacturer; + extern const struct spinand_manufacturer foresee_spinand_manufacturer; extern const struct spinand_manufacturer gigadevice_spinand_manufacturer; extern const struct spinand_manufacturer macronix_spinand_manufacturer; - extern const struct spinand_manufacturer micron_spinand_manufacturer; diff --git a/target/linux/mediatek/patches-6.6/435-drivers-mtd-spinand-Add-calibration-support-for-spin.patch b/target/linux/mediatek/patches-6.6/435-drivers-mtd-spinand-Add-calibration-support-for-spin.patch index bd8e738a37cc6a..50149fd819608e 100644 --- a/target/linux/mediatek/patches-6.6/435-drivers-mtd-spinand-Add-calibration-support-for-spin.patch +++ b/target/linux/mediatek/patches-6.6/435-drivers-mtd-spinand-Add-calibration-support-for-spin.patch @@ -11,7 +11,7 @@ Signed-off-by: SkyLake.Huang --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c -@@ -979,6 +979,56 @@ static int spinand_manufacturer_match(st +@@ -980,6 +980,56 @@ static int spinand_manufacturer_match(st return -ENOTSUPP; } @@ -68,7 +68,7 @@ Signed-off-by: SkyLake.Huang static int spinand_id_detect(struct spinand_device *spinand) { u8 *id = spinand->id.data; -@@ -1229,6 +1279,10 @@ static int spinand_init(struct spinand_d +@@ -1230,6 +1280,10 @@ static int spinand_init(struct spinand_d if (!spinand->scratchbuf) return -ENOMEM; diff --git a/target/linux/mediatek/patches-6.6/436-drivers-mtd-spi-nor-Add-calibration-support-for-spi-.patch b/target/linux/mediatek/patches-6.6/436-drivers-mtd-spi-nor-Add-calibration-support-for-spi-.patch index 744042ae1aa56e..27c5dfd5d66b66 100644 --- a/target/linux/mediatek/patches-6.6/436-drivers-mtd-spi-nor-Add-calibration-support-for-spi-.patch +++ b/target/linux/mediatek/patches-6.6/436-drivers-mtd-spi-nor-Add-calibration-support-for-spi-.patch @@ -12,7 +12,7 @@ Signed-off-by: SkyLake.Huang --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c -@@ -1020,7 +1020,10 @@ int spinand_cal_read(void *priv, u32 *ad +@@ -1021,7 +1021,10 @@ int spinand_cal_read(void *priv, u32 *ad if (ret) return ret; From 45f9f1551223b516cccbcca1e252e722bb3dbc08 Mon Sep 17 00:00:00 2001 From: Bohdan Chubuk Date: Fri, 6 Dec 2024 00:17:56 +0200 Subject: [PATCH 179/877] generic: mtd: spinand: add support for FORESEE F35SQA001G Add support for FORESEE F35SQA001G SPI NAND. Similar to F35SQA002G, but differs in capacity. Datasheet: - https://cdn.ozdisan.com/ETicaret_Dosya/704795_871495.pdf Tested on Xiaomi AX3000T flashed with OpenWRT. Signed-off-by: Bohdan Chubuk Signed-off-by: Miquel Raynal Link: https://github.com/openwrt/openwrt/pull/16915 (cherry picked from commit 1269a836edc45a42ab1e76dcd20e8cd8325529da) Link: https://github.com/openwrt/openwrt/pull/17188 Signed-off-by: Christian Marangi --- ...d-add-support-for-FORESEE-F35SQA001G.patch | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 target/linux/generic/backport-6.6/412-v6.14-mtd-spinand-add-support-for-FORESEE-F35SQA001G.patch diff --git a/target/linux/generic/backport-6.6/412-v6.14-mtd-spinand-add-support-for-FORESEE-F35SQA001G.patch b/target/linux/generic/backport-6.6/412-v6.14-mtd-spinand-add-support-for-FORESEE-F35SQA001G.patch new file mode 100644 index 00000000000000..84b3b2afee57a0 --- /dev/null +++ b/target/linux/generic/backport-6.6/412-v6.14-mtd-spinand-add-support-for-FORESEE-F35SQA001G.patch @@ -0,0 +1,38 @@ +From ae461cde5c559675fc4c0ba351c7c31ace705f56 Mon Sep 17 00:00:00 2001 +From: Bohdan Chubuk +Date: Sun, 10 Nov 2024 22:50:47 +0200 +Subject: [PATCH] mtd: spinand: add support for FORESEE F35SQA001G + +Add support for FORESEE F35SQA001G SPI NAND. + +Similar to F35SQA002G, but differs in capacity. +Datasheet: + - https://cdn.ozdisan.com/ETicaret_Dosya/704795_871495.pdf + +Tested on Xiaomi AX3000T flashed with OpenWRT. + +Signed-off-by: Bohdan Chubuk +Signed-off-by: Miquel Raynal +--- + drivers/mtd/nand/spi/foresee.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/drivers/mtd/nand/spi/foresee.c ++++ b/drivers/mtd/nand/spi/foresee.c +@@ -81,6 +81,16 @@ static const struct spinand_info foresee + SPINAND_HAS_QE_BIT, + SPINAND_ECCINFO(&f35sqa002g_ooblayout, + f35sqa002g_ecc_get_status)), ++ SPINAND_INFO("F35SQA001G", ++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x71, 0x71), ++ NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1), ++ NAND_ECCREQ(1, 512), ++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants, ++ &write_cache_variants, ++ &update_cache_variants), ++ SPINAND_HAS_QE_BIT, ++ SPINAND_ECCINFO(&f35sqa002g_ooblayout, ++ f35sqa002g_ecc_get_status)), + }; + + static const struct spinand_manufacturer_ops foresee_spinand_manuf_ops = { From 863d1a634e88b6db497622e5f007acca1adad60b Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Sat, 7 Dec 2024 22:08:18 +0100 Subject: [PATCH 180/877] qualcommax: ipq807x: add Netgear DEVICE_VARS Add NETGEAR_BOARD_ID and NETGEAR_HW_ID to DEVICE_VARS as multiple devices set them in their recipes, so without them being added to DEVICE_VARS then simply the value from last recipe that gets evaluated is used and images are generated with the wrong ID-s. Link: https://github.com/openwrt/openwrt/pull/17203 Signed-off-by: Robert Marko (cherry picked from commit 1b6f7ec6794233fbf7c1cf17dcee34053c08fa9c) --- target/linux/qualcommax/image/ipq807x.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/linux/qualcommax/image/ipq807x.mk b/target/linux/qualcommax/image/ipq807x.mk index 60af8654593a46..8ca370f57e686a 100644 --- a/target/linux/qualcommax/image/ipq807x.mk +++ b/target/linux/qualcommax/image/ipq807x.mk @@ -1,3 +1,5 @@ +DEVICE_VARS += NETGEAR_BOARD_ID NETGEAR_HW_ID + define Build/asus-fake-ramdisk rm -rf $(KDIR)/tmp/fakerd dd if=/dev/zero bs=32 count=1 > $(KDIR)/tmp/fakerd From 4bfe5ccd114cfb49f2aa0830cf10a5162c7cd945 Mon Sep 17 00:00:00 2001 From: Marty Jones Date: Mon, 11 Nov 2024 16:52:43 -0500 Subject: [PATCH 181/877] linux-firmware: update to 20241110 linux-firmware update to 20241110 Move WCN6750 firmware to the device-specific subdir git log --no-merges --pretty=oneline --abbrev-commit 20241110...20241017 1dbc4cfa rtl_bt: Update RTL8852BT/RTL8852BE-VT BT USB FW to 0x04D7_63F7 8a976e23 cnm: update chips&media wave521c firmware. 3636204f mediatek MT7920: update bluetooth firmware to 20241104091246 6627b025 linux-firmware: update firmware for MT7920 WiFi device 554c4761 copy-firmware.sh: Run check_whence.py only if in a git repo 1486d9aa cirrus: cs35l56: Add firmware for Cirrus CS35L56 for various Dell laptops c99eeb4d amdgpu: update DMCUB to v9.0.10.0 for DCN351 b6bfff1a rtw89: 8852a: update fw to v0.13.36.2 ddf25515 rtw88: Add firmware v52.14.0 for RTL8812AU dbb219d7 i915: Update Xe2LPD DMC to v2.23 937e463b linux-firmware: update firmware for mediatek bluetooth chip (MT7925) 62ee1c4b linux-firmware: update firmware for MT7925 WiFi device a142ad72 WHENCE: Add sof-tolg for mt8195 fe16af92 linux-firmware: Update firmware file for Intel BlazarI core c69bd749 qcom: Add link for QCS6490 GPU firmware f4f5689f qcom: update gpu firmwares for qcs615 chipset a6f3ab98 cirrus: cs35l56: Update firmware for Cirrus Amps for some HP laptops 048795ee ath11k: move WCN6750 firmware to the device-specific subdir 8a7bde2c xe: Update LNL GSC to v104.0.0.1263 e0ee2f91 i915: Update MTL/ARL GSC to v102.1.15.1926 987607d6 amdgpu: DMCUB updates for various AMDGPU ASICs f9a502ab mediatek: Add sof-tolg for mt8195 1c289f28 i915: Add Xe3LPD DMC c2379c61 cnm: update chips&media wave521c firmware. 71f8f3e0 linux-firmware: Add firmware for Cirrus CS35L41 65c4b9b7 linux-firmware: Update firmware file for Intel BlazarU core 4f397306 Makefile: error out of 'install' if COPYOPTS is set 2f046411 check_whence.py: skip some validation if git ls-files fails feb324e3 qcom: Add Audio firmware for X1E80100 CRD/QCPs 3d45353e amdgpu: DMCUB updates forvarious AMDGPU ASICs c569ca45 brcm: replace NVRAM for Jetson TX1 Signed-off-by: Marty Jones Link: https://github.com/openwrt/openwrt/pull/17079 Signed-off-by: Hauke Mehrtens (cherry picked from commit 24c8f06807181a5fb3a63a74e5ee73d68c6d59f0) --- package/firmware/linux-firmware/Makefile | 4 ++-- package/firmware/linux-firmware/qca_ath11k.mk | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/package/firmware/linux-firmware/Makefile b/package/firmware/linux-firmware/Makefile index de69360aff5232..433ff03a21b032 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:=20241017 +PKG_VERSION:=20241110 PKG_RELEASE:=1 PKG_SOURCE_URL:=@KERNEL/linux/kernel/firmware PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_HASH:=a26c38ef5a83272f2b98ce8bf8ca1865a852a3deea49ce5a8dd804b914351273 +PKG_HASH:=32e6d3eb5c7fcb69fe5d58976c6deafa0d6552719c6e74835064aff049d25bd7 PKG_MAINTAINER:=Felix Fietkau diff --git a/package/firmware/linux-firmware/qca_ath11k.mk b/package/firmware/linux-firmware/qca_ath11k.mk index 3571198d1b666b..9fdd6119488dd9 100644 --- a/package/firmware/linux-firmware/qca_ath11k.mk +++ b/package/firmware/linux-firmware/qca_ath11k.mk @@ -10,7 +10,11 @@ Package/ath11k-firmware-wcn6750 = $(call Package/firmware-default,WCN6750 ath11k define Package/ath11k-firmware-wcn6750/install $(INSTALL_DIR) $(1)/lib/firmware/ath11k/WCN6750/hw1.0 $(INSTALL_DATA) \ - $(PKG_BUILD_DIR)/ath11k/WCN6750/hw1.0/* $(1)/lib/firmware/ath11k/WCN6750/hw1.0/ + $(PKG_BUILD_DIR)/ath11k/WCN6750/hw1.0/board-2.bin $(1)/lib/firmware/ath11k/WCN6750/hw1.0/ + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/ath11k/WCN6750/hw1.0/Notice.txt $(1)/lib/firmware/ath11k/WCN6750/hw1.0/ + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/ath11k/WCN6750/hw1.0/sc7280/wpss.mbn $(1)/lib/firmware/ath11k/WCN6750/hw1.0/ endef $(eval $(call BuildPackage,ath11k-firmware-wcn6750)) From 2b45e9311363fad0c939a4ca1a3c43b14e8c40e5 Mon Sep 17 00:00:00 2001 From: Marty Jones Date: Mon, 11 Nov 2024 17:17:27 -0500 Subject: [PATCH 182/877] linux-firmware: realtek: add RTL8812AU/RTL8821AU firmware This adds firmware support for the RTL8812AU/RTL8821AU USB wireless adapters. Signed-off-by: Marty Jones Link: https://github.com/openwrt/openwrt/pull/17079 Signed-off-by: Hauke Mehrtens (cherry picked from commit c48a48e65889e00df598757cca1f6226ac173e89) --- package/firmware/linux-firmware/realtek.mk | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/package/firmware/linux-firmware/realtek.mk b/package/firmware/linux-firmware/realtek.mk index c2ab1c9d0dee0a..749d93be3e2909 100644 --- a/package/firmware/linux-firmware/realtek.mk +++ b/package/firmware/linux-firmware/realtek.mk @@ -140,6 +140,20 @@ define Package/rtl8761bu-firmware/install endef $(eval $(call BuildPackage,rtl8761bu-firmware)) +Package/rtl8812a-firmware = $(call Package/firmware-default,RealTek RTL8812AU firmware) +define Package/rtl8812a-firmware/install + $(INSTALL_DIR) $(1)/lib/firmware/rtw88 + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtw88/rtw8812a_fw.bin $(1)/lib/firmware/rtw88 +endef +$(eval $(call BuildPackage,rtl8812a-firmware)) + +Package/rtl8821a-firmware = $(call Package/firmware-default,RealTek RTL8821AU firmware) +define Package/rtl8821a-firmware/install + $(INSTALL_DIR) $(1)/lib/firmware/rtw88 + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtw88/rtw8821a_fw.bin $(1)/lib/firmware/rtw88 +endef +$(eval $(call BuildPackage,rtl8821a-firmware)) + Package/rtl8821ae-firmware = $(call Package/firmware-default,RealTek RTL8821AE firmware,,LICENCE.rtlwifi_firmware.txt) define Package/rtl8821ae-firmware/install $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi From 8a4ce69eea25d589f1ed43f3f3d2ba05674e8ef7 Mon Sep 17 00:00:00 2001 From: Marty Jones Date: Mon, 25 Nov 2024 12:58:57 -0500 Subject: [PATCH 183/877] mac80211: realtek: backport support for RTL8812AU/RTL8821AU Backport support for RTL8812AU/RTL8821AU USB adapters Manually backported patch: 045-v6.13-wifi-rtw88-Enable-the-new-RTL8821AU-RTL8812AU-driver Patches from 046 to 051 are pending. Signed-off-by: Marty Jones Link: https://github.com/openwrt/openwrt/pull/17079 [Move BPAUTO_WANT_DEV_COREDUMP to original patch] Signed-off-by: Hauke Mehrtens (cherry picked from commit 36f6d6ddcd67e7e32e2281baf5814ece81fad402) --- ...-rtw88-Set-efuse-ext_lna_5g-fix-typo.patch | 30 + ...upport-USB-3-with-RTL8822CU-RTL8822B.patch | 284 ++ ...fs-support-multiple-adapters-debuggi.patch | 454 +++ ...-wifi-rtw88-select-WANT_DEV_COREDUMP.patch | 25 + ...-Parse-channel-from-IE-to-correct-in.patch | 151 + ...nit-RX-burst-length-according-to-USB.patch | 73 + ...pdate-the-RX-stats-after-every-frame.patch | 31 + ...ifi-rtw88-usb-Support-RX-aggregation.patch | 118 + ...e-USB-RX-aggregation-for-8822c-8822b.patch | 168 + ...n-mac_id-for-vif-sta-and-update-to-T.patch | 231 ++ ...w88-Constify-some-arrays-and-structs.patch | 374 +++ ...-the-RX-descriptor-with-a-single-fun.patch | 560 ++++ ...Fix-the-RX-aggregation-in-USB-3-mode.patch | 70 + ...tor-looping-in-rtw_phy_store_tx_powe.patch | 34 + ...t-the-signal-strength-only-if-it-s-k.patch | 39 + ...ome-definitions-for-RTL8821AU-RTL881.patch | 490 +++ ...-the-HW-features-only-for-some-chips.patch | 93 + ...-Allow-different-C2H-RA-report-sizes.patch | 175 + ...d-the-init-table-parsing-for-RTL8812.patch | 165 + ...-rtw_chip_info.ltecoex_addr-to-be-NU.patch | 58 + ...ach-driver-control-the-power-on-off-.patch | 272 ++ ...e-data-rate-fallback-for-older-chips.patch | 194 ++ ...w88-Make-txagc_remnant_ofdm-an-array.patch | 85 + ...upport-TX-page-sizes-bigger-than-128.patch | 115 + ...-pwr_track_tbl-to-struct-rtw_rfe_def.patch | 297 ++ ...et-pkt_info.ls-for-the-reserved-page.patch | 27 + ...t-beacon-loss-with-chips-other-than-.patch | 63 + ...x-Support-chips-without-a-scoreboard.patch | 66 + ...1a-Regularly-ask-for-BT-info-updates.patch | 67 + ...ifi-rtw88-8812a-Mitigate-beacon-loss.patch | 37 + ...3-wifi-rtw88-Add-rtw8812a_table.-c-h.patch | 2862 +++++++++++++++++ ...3-wifi-rtw88-Add-rtw8821a_table.-c-h.patch | 2395 ++++++++++++++ ...1-v6.13-wifi-rtw88-Add-rtw88xxa.-c-h.patch | 2187 +++++++++++++ ...2-v6.13-wifi-rtw88-Add-rtw8821a.-c-h.patch | 1230 +++++++ ...3-v6.13-wifi-rtw88-Add-rtw8812a.-c-h.patch | 1135 +++++++ ...tw88-Add-rtw8821au.c-and-rtw8812au.c.patch | 80 + ...e-the-new-RTL8821AU-RTL8812AU-driver.patch | 153 + ...u-Add-additional-devices-to-the-USB_.patch | 77 + ...ifi-rtw88-8812au-Add-more-device-IDs.patch | 91 + ...w88-usb-Support-USB-3-with-RTL8812AU.patch | 69 + ...nable-RX-aggregation-for-8821au-8812.patch | 65 + ...8821ae-phy-restore-removed-code-to-f.patch | 32 + ...Add-additional-USB-IDs-for-RTL8812BU.patch | 31 + 43 files changed, 15253 insertions(+) create mode 100644 package/kernel/mac80211/patches/rtl/001-v6.12-wifi-rtw88-Set-efuse-ext_lna_5g-fix-typo.patch create mode 100644 package/kernel/mac80211/patches/rtl/002-v6.12-wifi-rtw88-usb-Support-USB-3-with-RTL8822CU-RTL8822B.patch create mode 100644 package/kernel/mac80211/patches/rtl/004-v6.12-wifi-rtw88-debugfs-support-multiple-adapters-debuggi.patch create mode 100644 package/kernel/mac80211/patches/rtl/005-v6.12-wifi-rtw88-select-WANT_DEV_COREDUMP.patch create mode 100644 package/kernel/mac80211/patches/rtl/008-v6.12-wifi-rtw88-8822c-Parse-channel-from-IE-to-correct-in.patch create mode 100644 package/kernel/mac80211/patches/rtl/010-v6.12-wifi-rtw88-usb-Init-RX-burst-length-according-to-USB.patch create mode 100644 package/kernel/mac80211/patches/rtl/011-v6.12-wifi-rtw88-usb-Update-the-RX-stats-after-every-frame.patch create mode 100644 package/kernel/mac80211/patches/rtl/012-v6.12-wifi-rtw88-usb-Support-RX-aggregation.patch create mode 100644 package/kernel/mac80211/patches/rtl/013-v6.12-wifi-rtw88-Enable-USB-RX-aggregation-for-8822c-8822b.patch create mode 100644 package/kernel/mac80211/patches/rtl/016-v6.12-wifi-rtw88-assign-mac_id-for-vif-sta-and-update-to-T.patch create mode 100644 package/kernel/mac80211/patches/rtl/017-v6.13-wifi-rtw88-Constify-some-arrays-and-structs.patch create mode 100644 package/kernel/mac80211/patches/rtl/019-v6.13-wifi-rtw88-Parse-the-RX-descriptor-with-a-single-fun.patch create mode 100644 package/kernel/mac80211/patches/rtl/020-v6.12-wifi-rtw88-Fix-the-RX-aggregation-in-USB-3-mode.patch create mode 100644 package/kernel/mac80211/patches/rtl/022-v6.13-wifi-rtw88-Refactor-looping-in-rtw_phy_store_tx_powe.patch create mode 100644 package/kernel/mac80211/patches/rtl/023-v6.13-wifi-rtw88-Report-the-signal-strength-only-if-it-s-k.patch create mode 100644 package/kernel/mac80211/patches/rtl/024-v6.13-wifi-rtw88-Add-some-definitions-for-RTL8821AU-RTL881.patch create mode 100644 package/kernel/mac80211/patches/rtl/025-v6.13-wifi-rtw88-Dump-the-HW-features-only-for-some-chips.patch create mode 100644 package/kernel/mac80211/patches/rtl/026-v6.13-wifi-rtw88-Allow-different-C2H-RA-report-sizes.patch create mode 100644 package/kernel/mac80211/patches/rtl/027-v6.13-wifi-rtw88-Extend-the-init-table-parsing-for-RTL8812.patch create mode 100644 package/kernel/mac80211/patches/rtl/028-v6.13-wifi-rtw88-Allow-rtw_chip_info.ltecoex_addr-to-be-NU.patch create mode 100644 package/kernel/mac80211/patches/rtl/029-v6.13-wifi-rtw88-Let-each-driver-control-the-power-on-off-.patch create mode 100644 package/kernel/mac80211/patches/rtl/030-v6.13-wifi-rtw88-Enable-data-rate-fallback-for-older-chips.patch create mode 100644 package/kernel/mac80211/patches/rtl/031-v6.13-wifi-rtw88-Make-txagc_remnant_ofdm-an-array.patch create mode 100644 package/kernel/mac80211/patches/rtl/032-v6.13-wifi-rtw88-Support-TX-page-sizes-bigger-than-128.patch create mode 100644 package/kernel/mac80211/patches/rtl/033-v6.13-wifi-rtw88-Move-pwr_track_tbl-to-struct-rtw_rfe_def.patch create mode 100644 package/kernel/mac80211/patches/rtl/034-v6.13-wifi-rtw88-usb-Set-pkt_info.ls-for-the-reserved-page.patch create mode 100644 package/kernel/mac80211/patches/rtl/035-v6.13-wifi-rtw88-Detect-beacon-loss-with-chips-other-than-.patch create mode 100644 package/kernel/mac80211/patches/rtl/036-v6.13-wifi-rtw88-coex-Support-chips-without-a-scoreboard.patch create mode 100644 package/kernel/mac80211/patches/rtl/037-v6.13-wifi-rtw88-8821a-Regularly-ask-for-BT-info-updates.patch create mode 100644 package/kernel/mac80211/patches/rtl/038-v6.13-wifi-rtw88-8812a-Mitigate-beacon-loss.patch create mode 100644 package/kernel/mac80211/patches/rtl/039-v6.13-wifi-rtw88-Add-rtw8812a_table.-c-h.patch create mode 100644 package/kernel/mac80211/patches/rtl/040-v6.13-wifi-rtw88-Add-rtw8821a_table.-c-h.patch create mode 100644 package/kernel/mac80211/patches/rtl/041-v6.13-wifi-rtw88-Add-rtw88xxa.-c-h.patch create mode 100644 package/kernel/mac80211/patches/rtl/042-v6.13-wifi-rtw88-Add-rtw8821a.-c-h.patch create mode 100644 package/kernel/mac80211/patches/rtl/043-v6.13-wifi-rtw88-Add-rtw8812a.-c-h.patch create mode 100644 package/kernel/mac80211/patches/rtl/044-v6.13-wifi-rtw88-Add-rtw8821au.c-and-rtw8812au.c.patch create mode 100644 package/kernel/mac80211/patches/rtl/045-v6.13-wifi-rtw88-Enable-the-new-RTL8821AU-RTL8812AU-driver.patch create mode 100644 package/kernel/mac80211/patches/rtl/046-wifi-rtw88-8821au-Add-additional-devices-to-the-USB_.patch create mode 100644 package/kernel/mac80211/patches/rtl/047-wifi-rtw88-8812au-Add-more-device-IDs.patch create mode 100644 package/kernel/mac80211/patches/rtl/048-wifi-rtw88-usb-Support-USB-3-with-RTL8812AU.patch create mode 100644 package/kernel/mac80211/patches/rtl/049-wifi-rtw88-usb-Enable-RX-aggregation-for-8821au-8812.patch create mode 100644 package/kernel/mac80211/patches/rtl/050-wifi-rtlwifi-rtl8821ae-phy-restore-removed-code-to-f.patch create mode 100644 package/kernel/mac80211/patches/rtl/051-wifi-rtw88-Add-additional-USB-IDs-for-RTL8812BU.patch diff --git a/package/kernel/mac80211/patches/rtl/001-v6.12-wifi-rtw88-Set-efuse-ext_lna_5g-fix-typo.patch b/package/kernel/mac80211/patches/rtl/001-v6.12-wifi-rtw88-Set-efuse-ext_lna_5g-fix-typo.patch new file mode 100644 index 00000000000000..96a6743c5bc9d0 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/001-v6.12-wifi-rtw88-Set-efuse-ext_lna_5g-fix-typo.patch @@ -0,0 +1,30 @@ +From 8fbcaa308591b91e9037ab6a8d733873b749a70d Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Sat, 6 Jul 2024 01:40:58 +0300 +Subject: [PATCH] wifi: rtw88: Set efuse->ext_lna_5g - fix typo + +efuse->ext_lna_2g is set twice and efuse->ext_lna_5g is not set at all. +Set each one once. + +Nothing uses these members right now. They will be used by the RTL8821AU +and RTL8812AU drivers. + +Signed-off-by: Bitterblue Smith +Acked-by: Ping-Ke Shih +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/8ccc9e13-0d45-417d-8f88-93a0ad294f77@gmail.com +--- + drivers/net/wireless/realtek/rtw88/main.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/realtek/rtw88/main.c ++++ b/drivers/net/wireless/realtek/rtw88/main.c +@@ -2006,7 +2006,7 @@ static int rtw_chip_efuse_info_setup(str + efuse->ext_pa_2g = efuse->pa_type_2g & BIT(4) ? 1 : 0; + efuse->ext_lna_2g = efuse->lna_type_2g & BIT(3) ? 1 : 0; + efuse->ext_pa_5g = efuse->pa_type_5g & BIT(0) ? 1 : 0; +- efuse->ext_lna_2g = efuse->lna_type_5g & BIT(3) ? 1 : 0; ++ efuse->ext_lna_5g = efuse->lna_type_5g & BIT(3) ? 1 : 0; + + if (!is_valid_ether_addr(efuse->addr)) { + eth_random_addr(efuse->addr); diff --git a/package/kernel/mac80211/patches/rtl/002-v6.12-wifi-rtw88-usb-Support-USB-3-with-RTL8822CU-RTL8822B.patch b/package/kernel/mac80211/patches/rtl/002-v6.12-wifi-rtw88-usb-Support-USB-3-with-RTL8822CU-RTL8822B.patch new file mode 100644 index 00000000000000..2faa59d760ee4d --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/002-v6.12-wifi-rtw88-usb-Support-USB-3-with-RTL8822CU-RTL8822B.patch @@ -0,0 +1,284 @@ +From 315c23a64e99552502dd4d18d6ddc073fad9a7c3 Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Thu, 11 Jul 2024 01:11:33 +0300 +Subject: [PATCH] wifi: rtw88: usb: Support USB 3 with RTL8822CU/RTL8822BU + +The Realtek wifi 5 devices which support USB 3 are weird: when first +plugged in, they pretend to be USB 2. The driver needs to send some +commands to the device, which make it disappear and come back as a +USB 3 device. + +Implement the required commands in rtw88. + +When a USB 3 device is plugged into a USB 2 port, rtw88 will try to +switch it to USB 3 mode only once. The device will disappear and come +back still in USB 2 mode, of course. + +Some people experience heavy interference in the 2.4 GHz band in +USB 3 mode, so add a module parameter switch_usb_mode with the +default value 1 to let people disable the switching. + +Signed-off-by: Bitterblue Smith +Acked-by: Ping-Ke Shih +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/77906c62-5674-426f-bde1-1b2a12a0339d@gmail.com +--- + drivers/net/wireless/realtek/rtw88/debug.h | 1 + + drivers/net/wireless/realtek/rtw88/main.h | 2 + + drivers/net/wireless/realtek/rtw88/reg.h | 11 +++ + drivers/net/wireless/realtek/rtw88/rtw8822b.c | 1 + + drivers/net/wireless/realtek/rtw88/rtw8822b.h | 4 +- + drivers/net/wireless/realtek/rtw88/rtw8822c.c | 1 + + drivers/net/wireless/realtek/rtw88/rtw8822c.h | 24 +++--- + drivers/net/wireless/realtek/rtw88/usb.c | 84 +++++++++++++++++++ + 8 files changed, 116 insertions(+), 12 deletions(-) + +--- a/drivers/net/wireless/realtek/rtw88/debug.h ++++ b/drivers/net/wireless/realtek/rtw88/debug.h +@@ -25,6 +25,7 @@ enum rtw_debug_mask { + RTW_DBG_HW_SCAN = 0x00010000, + RTW_DBG_STATE = 0x00020000, + RTW_DBG_SDIO = 0x00040000, ++ RTW_DBG_USB = 0x00080000, + + RTW_DBG_UNEXP = 0x80000000, + RTW_DBG_ALL = 0xffffffff +--- a/drivers/net/wireless/realtek/rtw88/main.h ++++ b/drivers/net/wireless/realtek/rtw88/main.h +@@ -1785,6 +1785,8 @@ struct rtw_efuse { + bool share_ant; + u8 bt_setting; + ++ u8 usb_mode_switch; ++ + struct { + u8 hci; + u8 bw; +--- a/drivers/net/wireless/realtek/rtw88/reg.h ++++ b/drivers/net/wireless/realtek/rtw88/reg.h +@@ -15,6 +15,7 @@ + #define BIT_WLOCK_1C_B6 BIT(5) + #define REG_SYS_PW_CTRL 0x0004 + #define BIT_PFM_WOWL BIT(3) ++#define BIT_APFM_OFFMAC BIT(9) + #define REG_SYS_CLK_CTRL 0x0008 + #define BIT_CPU_CLK_EN BIT(14) + +@@ -133,6 +134,14 @@ + #define REG_PMC_DBG_CTRL1 0xa8 + #define BITS_PMC_BT_IQK_STS GENMASK(22, 21) + ++#define REG_PAD_CTRL2 0x00C4 ++#define BIT_RSM_EN_V1 BIT(16) ++#define BIT_NO_PDN_CHIPOFF_V1 BIT(17) ++#define BIT_MASK_USB23_SW_MODE_V1 GENMASK(19, 18) ++#define BIT_USB3_USB2_TRANSITION BIT(20) ++#define BIT_USB_MODE_U2 1 ++#define BIT_USB_MODE_U3 2 ++ + #define REG_EFUSE_ACCESS 0x00CF + #define EFUSE_ACCESS_ON 0x69 + #define EFUSE_ACCESS_OFF 0x00 +@@ -568,6 +577,8 @@ + #define BIT_WL_SECURITY_CLK BIT(15) + #define BIT_DDMA_EN BIT(8) + ++#define REG_SW_MDIO 0x10C0 ++ + #define REG_H2C_PKT_READADDR 0x10D0 + #define REG_H2C_PKT_WRITEADDR 0x10D4 + #define REG_FW_DBG6 0x10F8 +--- a/drivers/net/wireless/realtek/rtw88/rtw8822b.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8822b.c +@@ -46,6 +46,7 @@ static int rtw8822b_read_efuse(struct rt + + map = (struct rtw8822b_efuse *)log_map; + ++ efuse->usb_mode_switch = u8_get_bits(map->usb_mode, BIT(7)); + efuse->rfe_option = map->rfe_option; + efuse->rf_board_option = map->rf_board_option; + efuse->crystal_cap = map->xtal_k; +--- a/drivers/net/wireless/realtek/rtw88/rtw8822b.h ++++ b/drivers/net/wireless/realtek/rtw88/rtw8822b.h +@@ -72,7 +72,9 @@ struct rtw8822bs_efuse { + + struct rtw8822b_efuse { + __le16 rtl_id; +- u8 res0[0x0e]; ++ u8 res0[4]; ++ u8 usb_mode; ++ u8 res1[0x09]; + + /* power index for four RF paths */ + struct rtw_txpwr_idx txpwr_idx_table[4]; +--- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c +@@ -49,6 +49,7 @@ static int rtw8822c_read_efuse(struct rt + + map = (struct rtw8822c_efuse *)log_map; + ++ efuse->usb_mode_switch = u8_get_bits(map->usb_mode, BIT(7)); + efuse->rfe_option = map->rfe_option; + efuse->rf_board_option = map->rf_board_option; + efuse->crystal_cap = map->xtal_k & XCAP_MASK; +--- a/drivers/net/wireless/realtek/rtw88/rtw8822c.h ++++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.h +@@ -59,16 +59,18 @@ struct rtw8822ce_efuse { + + struct rtw8822c_efuse { + __le16 rtl_id; +- u8 res0[0x0e]; ++ u8 res0[4]; ++ u8 usb_mode; ++ u8 res1[0x09]; + + /* power index for four RF paths */ + struct rtw_txpwr_idx txpwr_idx_table[4]; + + u8 channel_plan; /* 0xb8 */ + u8 xtal_k; +- u8 res1; ++ u8 res2; + u8 iqk_lck; +- u8 res2[5]; /* 0xbc */ ++ u8 res3[5]; /* 0xbc */ + u8 rf_board_option; + u8 rf_feature_option; + u8 rf_bt_setting; +@@ -80,21 +82,21 @@ struct rtw8822c_efuse { + u8 rf_antenna_option; /* 0xc9 */ + u8 rfe_option; + u8 country_code[2]; +- u8 res3[3]; ++ u8 res4[3]; + u8 path_a_thermal; /* 0xd0 */ + u8 path_b_thermal; +- u8 res4[2]; ++ u8 res5[2]; + u8 rx_gain_gap_2g_ofdm; +- u8 res5; +- u8 rx_gain_gap_2g_cck; + u8 res6; +- u8 rx_gain_gap_5gl; ++ u8 rx_gain_gap_2g_cck; + u8 res7; +- u8 rx_gain_gap_5gm; ++ u8 rx_gain_gap_5gl; + u8 res8; +- u8 rx_gain_gap_5gh; ++ u8 rx_gain_gap_5gm; + u8 res9; +- u8 res10[0x42]; ++ u8 rx_gain_gap_5gh; ++ u8 res10; ++ u8 res11[0x42]; + union { + struct rtw8822ce_efuse e; + struct rtw8822cu_efuse u; +--- a/drivers/net/wireless/realtek/rtw88/usb.c ++++ b/drivers/net/wireless/realtek/rtw88/usb.c +@@ -14,6 +14,11 @@ + #include "ps.h" + #include "usb.h" + ++static bool rtw_switch_usb_mode = true; ++module_param_named(switch_usb_mode, rtw_switch_usb_mode, bool, 0644); ++MODULE_PARM_DESC(switch_usb_mode, ++ "Set to N to disable switching to USB 3 mode to avoid potential interference in the 2.4 GHz band (default: Y)"); ++ + #define RTW_USB_MAX_RXQ_LEN 512 + + struct rtw_usb_txcb { +@@ -841,6 +846,77 @@ static void rtw_usb_intf_deinit(struct r + usb_set_intfdata(intf, NULL); + } + ++static int rtw_usb_switch_mode_new(struct rtw_dev *rtwdev) ++{ ++ enum usb_device_speed cur_speed; ++ u8 id = rtwdev->chip->id; ++ bool can_switch; ++ u32 pad_ctrl2; ++ ++ if (rtw_read8(rtwdev, REG_SYS_CFG2 + 3) == 0x20) ++ cur_speed = USB_SPEED_SUPER; ++ else ++ cur_speed = USB_SPEED_HIGH; ++ ++ if (cur_speed == USB_SPEED_SUPER) ++ return 0; ++ ++ pad_ctrl2 = rtw_read32(rtwdev, REG_PAD_CTRL2); ++ ++ can_switch = !!(pad_ctrl2 & (BIT_MASK_USB23_SW_MODE_V1 | ++ BIT_USB3_USB2_TRANSITION)); ++ ++ if (!can_switch) { ++ rtw_dbg(rtwdev, RTW_DBG_USB, ++ "Switching to USB 3 mode unsupported by the chip\n"); ++ return 0; ++ } ++ ++ /* At this point cur_speed is USB_SPEED_HIGH. If we already tried ++ * to switch don't try again - it's a USB 2 port. ++ */ ++ if (u32_get_bits(pad_ctrl2, BIT_MASK_USB23_SW_MODE_V1) == BIT_USB_MODE_U3) ++ return 0; ++ ++ /* Enable IO wrapper timeout */ ++ if (id == RTW_CHIP_TYPE_8822B || id == RTW_CHIP_TYPE_8821C) ++ rtw_write8_clr(rtwdev, REG_SW_MDIO + 3, BIT(0)); ++ ++ u32p_replace_bits(&pad_ctrl2, BIT_USB_MODE_U3, BIT_MASK_USB23_SW_MODE_V1); ++ pad_ctrl2 |= BIT_RSM_EN_V1; ++ ++ rtw_write32(rtwdev, REG_PAD_CTRL2, pad_ctrl2); ++ rtw_write8(rtwdev, REG_PAD_CTRL2 + 1, 4); ++ ++ rtw_write16_set(rtwdev, REG_SYS_PW_CTRL, BIT_APFM_OFFMAC); ++ usleep_range(1000, 1001); ++ rtw_write32_set(rtwdev, REG_PAD_CTRL2, BIT_NO_PDN_CHIPOFF_V1); ++ ++ return 1; ++} ++ ++static int rtw_usb_switch_mode(struct rtw_dev *rtwdev) ++{ ++ u8 id = rtwdev->chip->id; ++ ++ if (id != RTW_CHIP_TYPE_8822C && id != RTW_CHIP_TYPE_8822B) ++ return 0; ++ ++ if (!rtwdev->efuse.usb_mode_switch) { ++ rtw_dbg(rtwdev, RTW_DBG_USB, ++ "Switching to USB 3 mode disabled by chip's efuse\n"); ++ return 0; ++ } ++ ++ if (!rtw_switch_usb_mode) { ++ rtw_dbg(rtwdev, RTW_DBG_USB, ++ "Switching to USB 3 mode disabled by module parameter\n"); ++ return 0; ++ } ++ ++ return rtw_usb_switch_mode_new(rtwdev); ++} ++ + int rtw_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) + { + struct rtw_dev *rtwdev; +@@ -896,6 +972,14 @@ int rtw_usb_probe(struct usb_interface * + goto err_destroy_rxwq; + } + ++ ret = rtw_usb_switch_mode(rtwdev); ++ if (ret) { ++ /* Not a fail, but we do need to skip rtw_register_hw. */ ++ rtw_dbg(rtwdev, RTW_DBG_USB, "switching to USB 3 mode\n"); ++ ret = 0; ++ goto err_destroy_rxwq; ++ } ++ + ret = rtw_register_hw(rtwdev, rtwdev->hw); + if (ret) { + rtw_err(rtwdev, "failed to register hw\n"); diff --git a/package/kernel/mac80211/patches/rtl/004-v6.12-wifi-rtw88-debugfs-support-multiple-adapters-debuggi.patch b/package/kernel/mac80211/patches/rtl/004-v6.12-wifi-rtw88-debugfs-support-multiple-adapters-debuggi.patch new file mode 100644 index 00000000000000..d965fbce927eba --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/004-v6.12-wifi-rtw88-debugfs-support-multiple-adapters-debuggi.patch @@ -0,0 +1,454 @@ +From 8db6c1ca64664ef9b071e6eeb646023ac5b240a8 Mon Sep 17 00:00:00 2001 +From: Ping-Ke Shih +Date: Thu, 18 Jul 2024 14:41:55 +0800 +Subject: [PATCH] wifi: rtw88: debugfs: support multiple adapters debugging + +Originally in order to read partial registers from large area, we write +a range value stored into a static variable and read registers according +to the static variable. + +However, if we install more than one adapters supported by this driver, +the static variables will be overwritten by latter adapters. To resolve +the problem, move the static variables to struct rtw_dev for each adapter. + +With changes, smatch spends too much time to parse rtw_debugfs_init(): + debug.c:1289 rtw_debugfs_init() parse error: turning off implications + after 60 seconds +Move stuffs of adding debugfs entries to three rtw_debugfs_add_xxx() +functions. + +Reported-by: Bitterblue Smith +Closes: https://lore.kernel.org/linux-wireless/cd6a2acf3c2c36d938b40140b52a779516f446a9.camel@realtek.com/T/#m27662022c70d9f893ba96f6c6a8dd8fce2434dfe +Tested-by: Bitterblue Smith +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/20240718064155.38955-1-pkshih@realtek.com +--- + drivers/net/wireless/realtek/rtw88/debug.c | 303 ++++++++++++--------- + drivers/net/wireless/realtek/rtw88/debug.h | 2 + + drivers/net/wireless/realtek/rtw88/main.c | 1 + + drivers/net/wireless/realtek/rtw88/main.h | 3 +- + 4 files changed, 180 insertions(+), 129 deletions(-) + +--- a/drivers/net/wireless/realtek/rtw88/debug.c ++++ b/drivers/net/wireless/realtek/rtw88/debug.c +@@ -43,6 +43,62 @@ struct rtw_debugfs_priv { + }; + }; + ++struct rtw_debugfs { ++ struct rtw_debugfs_priv mac_0; ++ struct rtw_debugfs_priv mac_1; ++ struct rtw_debugfs_priv mac_2; ++ struct rtw_debugfs_priv mac_3; ++ struct rtw_debugfs_priv mac_4; ++ struct rtw_debugfs_priv mac_5; ++ struct rtw_debugfs_priv mac_6; ++ struct rtw_debugfs_priv mac_7; ++ struct rtw_debugfs_priv mac_10; ++ struct rtw_debugfs_priv mac_11; ++ struct rtw_debugfs_priv mac_12; ++ struct rtw_debugfs_priv mac_13; ++ struct rtw_debugfs_priv mac_14; ++ struct rtw_debugfs_priv mac_15; ++ struct rtw_debugfs_priv mac_16; ++ struct rtw_debugfs_priv mac_17; ++ struct rtw_debugfs_priv bb_8; ++ struct rtw_debugfs_priv bb_9; ++ struct rtw_debugfs_priv bb_a; ++ struct rtw_debugfs_priv bb_b; ++ struct rtw_debugfs_priv bb_c; ++ struct rtw_debugfs_priv bb_d; ++ struct rtw_debugfs_priv bb_e; ++ struct rtw_debugfs_priv bb_f; ++ struct rtw_debugfs_priv bb_18; ++ struct rtw_debugfs_priv bb_19; ++ struct rtw_debugfs_priv bb_1a; ++ struct rtw_debugfs_priv bb_1b; ++ struct rtw_debugfs_priv bb_1c; ++ struct rtw_debugfs_priv bb_1d; ++ struct rtw_debugfs_priv bb_1e; ++ struct rtw_debugfs_priv bb_1f; ++ struct rtw_debugfs_priv bb_2c; ++ struct rtw_debugfs_priv bb_2d; ++ struct rtw_debugfs_priv bb_40; ++ struct rtw_debugfs_priv bb_41; ++ struct rtw_debugfs_priv rf_dump; ++ struct rtw_debugfs_priv tx_pwr_tbl; ++ struct rtw_debugfs_priv write_reg; ++ struct rtw_debugfs_priv h2c; ++ struct rtw_debugfs_priv rf_write; ++ struct rtw_debugfs_priv rf_read; ++ struct rtw_debugfs_priv read_reg; ++ struct rtw_debugfs_priv fix_rate; ++ struct rtw_debugfs_priv dump_cam; ++ struct rtw_debugfs_priv rsvd_page; ++ struct rtw_debugfs_priv phy_info; ++ struct rtw_debugfs_priv coex_enable; ++ struct rtw_debugfs_priv coex_info; ++ struct rtw_debugfs_priv edcca_enable; ++ struct rtw_debugfs_priv fw_crash; ++ struct rtw_debugfs_priv force_lowest_basic_rate; ++ struct rtw_debugfs_priv dm_cap; ++}; ++ + static const char * const rtw_dm_cap_strs[] = { + [RTW_DM_CAP_NA] = "NA", + [RTW_DM_CAP_TXGAPK] = "TXGAPK", +@@ -524,7 +580,7 @@ static int rtw_debug_get_bb_page(struct + return 0; + } + +-static int rtw_debug_get_rf_dump(struct seq_file *m, void *v) ++static int rtw_debugfs_get_rf_dump(struct seq_file *m, void *v) + { + struct rtw_debugfs_priv *debugfs_priv = m->private; + struct rtw_dev *rtwdev = debugfs_priv->rtwdev; +@@ -1074,139 +1130,102 @@ static int rtw_debugfs_get_dm_cap(struct + return 0; + } + +-#define rtw_debug_impl_mac(page, addr) \ +-static struct rtw_debugfs_priv rtw_debug_priv_mac_ ##page = { \ ++#define rtw_debug_priv_mac(addr) \ ++{ \ + .cb_read = rtw_debug_get_mac_page, \ + .cb_data = addr, \ + } + +-rtw_debug_impl_mac(0, 0x0000); +-rtw_debug_impl_mac(1, 0x0100); +-rtw_debug_impl_mac(2, 0x0200); +-rtw_debug_impl_mac(3, 0x0300); +-rtw_debug_impl_mac(4, 0x0400); +-rtw_debug_impl_mac(5, 0x0500); +-rtw_debug_impl_mac(6, 0x0600); +-rtw_debug_impl_mac(7, 0x0700); +-rtw_debug_impl_mac(10, 0x1000); +-rtw_debug_impl_mac(11, 0x1100); +-rtw_debug_impl_mac(12, 0x1200); +-rtw_debug_impl_mac(13, 0x1300); +-rtw_debug_impl_mac(14, 0x1400); +-rtw_debug_impl_mac(15, 0x1500); +-rtw_debug_impl_mac(16, 0x1600); +-rtw_debug_impl_mac(17, 0x1700); +- +-#define rtw_debug_impl_bb(page, addr) \ +-static struct rtw_debugfs_priv rtw_debug_priv_bb_ ##page = { \ ++#define rtw_debug_priv_bb(addr) \ ++{ \ + .cb_read = rtw_debug_get_bb_page, \ + .cb_data = addr, \ + } + +-rtw_debug_impl_bb(8, 0x0800); +-rtw_debug_impl_bb(9, 0x0900); +-rtw_debug_impl_bb(a, 0x0a00); +-rtw_debug_impl_bb(b, 0x0b00); +-rtw_debug_impl_bb(c, 0x0c00); +-rtw_debug_impl_bb(d, 0x0d00); +-rtw_debug_impl_bb(e, 0x0e00); +-rtw_debug_impl_bb(f, 0x0f00); +-rtw_debug_impl_bb(18, 0x1800); +-rtw_debug_impl_bb(19, 0x1900); +-rtw_debug_impl_bb(1a, 0x1a00); +-rtw_debug_impl_bb(1b, 0x1b00); +-rtw_debug_impl_bb(1c, 0x1c00); +-rtw_debug_impl_bb(1d, 0x1d00); +-rtw_debug_impl_bb(1e, 0x1e00); +-rtw_debug_impl_bb(1f, 0x1f00); +-rtw_debug_impl_bb(2c, 0x2c00); +-rtw_debug_impl_bb(2d, 0x2d00); +-rtw_debug_impl_bb(40, 0x4000); +-rtw_debug_impl_bb(41, 0x4100); +- +-static struct rtw_debugfs_priv rtw_debug_priv_rf_dump = { +- .cb_read = rtw_debug_get_rf_dump, +-}; +- +-static struct rtw_debugfs_priv rtw_debug_priv_tx_pwr_tbl = { +- .cb_read = rtw_debugfs_get_tx_pwr_tbl, +-}; +- +-static struct rtw_debugfs_priv rtw_debug_priv_write_reg = { +- .cb_write = rtw_debugfs_set_write_reg, +-}; +- +-static struct rtw_debugfs_priv rtw_debug_priv_h2c = { +- .cb_write = rtw_debugfs_set_h2c, +-}; +- +-static struct rtw_debugfs_priv rtw_debug_priv_rf_write = { +- .cb_write = rtw_debugfs_set_rf_write, +-}; +- +-static struct rtw_debugfs_priv rtw_debug_priv_rf_read = { +- .cb_write = rtw_debugfs_set_rf_read, +- .cb_read = rtw_debugfs_get_rf_read, +-}; +- +-static struct rtw_debugfs_priv rtw_debug_priv_read_reg = { +- .cb_write = rtw_debugfs_set_read_reg, +- .cb_read = rtw_debugfs_get_read_reg, +-}; +- +-static struct rtw_debugfs_priv rtw_debug_priv_fix_rate = { +- .cb_write = rtw_debugfs_set_fix_rate, +- .cb_read = rtw_debugfs_get_fix_rate, +-}; +- +-static struct rtw_debugfs_priv rtw_debug_priv_dump_cam = { +- .cb_write = rtw_debugfs_set_single_input, +- .cb_read = rtw_debugfs_get_dump_cam, +-}; +- +-static struct rtw_debugfs_priv rtw_debug_priv_rsvd_page = { +- .cb_write = rtw_debugfs_set_rsvd_page, +- .cb_read = rtw_debugfs_get_rsvd_page, +-}; +- +-static struct rtw_debugfs_priv rtw_debug_priv_phy_info = { +- .cb_read = rtw_debugfs_get_phy_info, +-}; +- +-static struct rtw_debugfs_priv rtw_debug_priv_coex_enable = { +- .cb_write = rtw_debugfs_set_coex_enable, +- .cb_read = rtw_debugfs_get_coex_enable, +-}; +- +-static struct rtw_debugfs_priv rtw_debug_priv_coex_info = { +- .cb_read = rtw_debugfs_get_coex_info, +-}; +- +-static struct rtw_debugfs_priv rtw_debug_priv_edcca_enable = { +- .cb_write = rtw_debugfs_set_edcca_enable, +- .cb_read = rtw_debugfs_get_edcca_enable, +-}; +- +-static struct rtw_debugfs_priv rtw_debug_priv_fw_crash = { +- .cb_write = rtw_debugfs_set_fw_crash, +- .cb_read = rtw_debugfs_get_fw_crash, +-}; +- +-static struct rtw_debugfs_priv rtw_debug_priv_force_lowest_basic_rate = { +- .cb_write = rtw_debugfs_set_force_lowest_basic_rate, +- .cb_read = rtw_debugfs_get_force_lowest_basic_rate, +-}; +- +-static struct rtw_debugfs_priv rtw_debug_priv_dm_cap = { +- .cb_write = rtw_debugfs_set_dm_cap, +- .cb_read = rtw_debugfs_get_dm_cap, ++#define rtw_debug_priv_get(name) \ ++{ \ ++ .cb_read = rtw_debugfs_get_ ##name, \ ++} ++ ++#define rtw_debug_priv_set(name) \ ++{ \ ++ .cb_write = rtw_debugfs_set_ ##name, \ ++} ++ ++#define rtw_debug_priv_set_and_get(name) \ ++{ \ ++ .cb_write = rtw_debugfs_set_ ##name, \ ++ .cb_read = rtw_debugfs_get_ ##name, \ ++} ++ ++#define rtw_debug_priv_set_single_and_get(name) \ ++{ \ ++ .cb_write = rtw_debugfs_set_single_input, \ ++ .cb_read = rtw_debugfs_get_ ##name, \ ++} ++ ++static const struct rtw_debugfs rtw_debugfs_templ = { ++ .mac_0 = rtw_debug_priv_mac(0x0000), ++ .mac_1 = rtw_debug_priv_mac(0x0100), ++ .mac_2 = rtw_debug_priv_mac(0x0200), ++ .mac_3 = rtw_debug_priv_mac(0x0300), ++ .mac_4 = rtw_debug_priv_mac(0x0400), ++ .mac_5 = rtw_debug_priv_mac(0x0500), ++ .mac_6 = rtw_debug_priv_mac(0x0600), ++ .mac_7 = rtw_debug_priv_mac(0x0700), ++ .mac_10 = rtw_debug_priv_mac(0x1000), ++ .mac_11 = rtw_debug_priv_mac(0x1100), ++ .mac_12 = rtw_debug_priv_mac(0x1200), ++ .mac_13 = rtw_debug_priv_mac(0x1300), ++ .mac_14 = rtw_debug_priv_mac(0x1400), ++ .mac_15 = rtw_debug_priv_mac(0x1500), ++ .mac_16 = rtw_debug_priv_mac(0x1600), ++ .mac_17 = rtw_debug_priv_mac(0x1700), ++ .bb_8 = rtw_debug_priv_bb(0x0800), ++ .bb_9 = rtw_debug_priv_bb(0x0900), ++ .bb_a = rtw_debug_priv_bb(0x0a00), ++ .bb_b = rtw_debug_priv_bb(0x0b00), ++ .bb_c = rtw_debug_priv_bb(0x0c00), ++ .bb_d = rtw_debug_priv_bb(0x0d00), ++ .bb_e = rtw_debug_priv_bb(0x0e00), ++ .bb_f = rtw_debug_priv_bb(0x0f00), ++ .bb_18 = rtw_debug_priv_bb(0x1800), ++ .bb_19 = rtw_debug_priv_bb(0x1900), ++ .bb_1a = rtw_debug_priv_bb(0x1a00), ++ .bb_1b = rtw_debug_priv_bb(0x1b00), ++ .bb_1c = rtw_debug_priv_bb(0x1c00), ++ .bb_1d = rtw_debug_priv_bb(0x1d00), ++ .bb_1e = rtw_debug_priv_bb(0x1e00), ++ .bb_1f = rtw_debug_priv_bb(0x1f00), ++ .bb_2c = rtw_debug_priv_bb(0x2c00), ++ .bb_2d = rtw_debug_priv_bb(0x2d00), ++ .bb_40 = rtw_debug_priv_bb(0x4000), ++ .bb_41 = rtw_debug_priv_bb(0x4100), ++ .rf_dump = rtw_debug_priv_get(rf_dump), ++ .tx_pwr_tbl = rtw_debug_priv_get(tx_pwr_tbl), ++ .write_reg = rtw_debug_priv_set(write_reg), ++ .h2c = rtw_debug_priv_set(h2c), ++ .rf_write = rtw_debug_priv_set(rf_write), ++ .rf_read = rtw_debug_priv_set_and_get(rf_read), ++ .read_reg = rtw_debug_priv_set_and_get(read_reg), ++ .fix_rate = rtw_debug_priv_set_and_get(fix_rate), ++ .dump_cam = rtw_debug_priv_set_single_and_get(dump_cam), ++ .rsvd_page = rtw_debug_priv_set_and_get(rsvd_page), ++ .phy_info = rtw_debug_priv_get(phy_info), ++ .coex_enable = rtw_debug_priv_set_and_get(coex_enable), ++ .coex_info = rtw_debug_priv_get(coex_info), ++ .edcca_enable = rtw_debug_priv_set_and_get(edcca_enable), ++ .fw_crash = rtw_debug_priv_set_and_get(fw_crash), ++ .force_lowest_basic_rate = rtw_debug_priv_set_and_get(force_lowest_basic_rate), ++ .dm_cap = rtw_debug_priv_set_and_get(dm_cap), + }; + + #define rtw_debugfs_add_core(name, mode, fopname, parent) \ + do { \ +- rtw_debug_priv_ ##name.rtwdev = rtwdev; \ ++ struct rtw_debugfs_priv *priv = &rtwdev->debugfs->name; \ ++ priv->rtwdev = rtwdev; \ + if (IS_ERR(debugfs_create_file(#name, mode, \ +- parent, &rtw_debug_priv_ ##name,\ ++ parent, priv, \ + &file_ops_ ##fopname))) \ + pr_debug("Unable to initialize debugfs:%s\n", \ + #name); \ +@@ -1219,12 +1238,9 @@ static struct rtw_debugfs_priv rtw_debug + #define rtw_debugfs_add_r(name) \ + rtw_debugfs_add_core(name, S_IFREG | 0444, single_r, debugfs_topdir) + +-void rtw_debugfs_init(struct rtw_dev *rtwdev) ++static ++void rtw_debugfs_add_basic(struct rtw_dev *rtwdev, struct dentry *debugfs_topdir) + { +- struct dentry *debugfs_topdir; +- +- debugfs_topdir = debugfs_create_dir("rtw88", +- rtwdev->hw->wiphy->debugfsdir); + rtw_debugfs_add_w(write_reg); + rtw_debugfs_add_rw(read_reg); + rtw_debugfs_add_w(rf_write); +@@ -1236,6 +1252,17 @@ void rtw_debugfs_init(struct rtw_dev *rt + rtw_debugfs_add_r(coex_info); + rtw_debugfs_add_rw(coex_enable); + rtw_debugfs_add_w(h2c); ++ rtw_debugfs_add_r(rf_dump); ++ rtw_debugfs_add_r(tx_pwr_tbl); ++ rtw_debugfs_add_rw(edcca_enable); ++ rtw_debugfs_add_rw(fw_crash); ++ rtw_debugfs_add_rw(force_lowest_basic_rate); ++ rtw_debugfs_add_rw(dm_cap); ++} ++ ++static ++void rtw_debugfs_add_sec0(struct rtw_dev *rtwdev, struct dentry *debugfs_topdir) ++{ + rtw_debugfs_add_r(mac_0); + rtw_debugfs_add_r(mac_1); + rtw_debugfs_add_r(mac_2); +@@ -1252,6 +1279,11 @@ void rtw_debugfs_init(struct rtw_dev *rt + rtw_debugfs_add_r(bb_d); + rtw_debugfs_add_r(bb_e); + rtw_debugfs_add_r(bb_f); ++} ++ ++static ++void rtw_debugfs_add_sec1(struct rtw_dev *rtwdev, struct dentry *debugfs_topdir) ++{ + rtw_debugfs_add_r(mac_10); + rtw_debugfs_add_r(mac_11); + rtw_debugfs_add_r(mac_12); +@@ -1274,14 +1306,29 @@ void rtw_debugfs_init(struct rtw_dev *rt + rtw_debugfs_add_r(bb_40); + rtw_debugfs_add_r(bb_41); + } +- rtw_debugfs_add_r(rf_dump); +- rtw_debugfs_add_r(tx_pwr_tbl); +- rtw_debugfs_add_rw(edcca_enable); +- rtw_debugfs_add_rw(fw_crash); +- rtw_debugfs_add_rw(force_lowest_basic_rate); +- rtw_debugfs_add_rw(dm_cap); + } + ++void rtw_debugfs_init(struct rtw_dev *rtwdev) ++{ ++ struct dentry *debugfs_topdir; ++ ++ rtwdev->debugfs = kmemdup(&rtw_debugfs_templ, sizeof(rtw_debugfs_templ), ++ GFP_KERNEL); ++ if (!rtwdev->debugfs) ++ return; ++ ++ debugfs_topdir = debugfs_create_dir("rtw88", ++ rtwdev->hw->wiphy->debugfsdir); ++ ++ rtw_debugfs_add_basic(rtwdev, debugfs_topdir); ++ rtw_debugfs_add_sec0(rtwdev, debugfs_topdir); ++ rtw_debugfs_add_sec1(rtwdev, debugfs_topdir); ++} ++ ++void rtw_debugfs_deinit(struct rtw_dev *rtwdev) ++{ ++ kfree(rtwdev->debugfs); ++} + #endif /* CPTCFG_RTW88_DEBUGFS */ + + #ifdef CPTCFG_RTW88_DEBUG +--- a/drivers/net/wireless/realtek/rtw88/debug.h ++++ b/drivers/net/wireless/realtek/rtw88/debug.h +@@ -34,11 +34,13 @@ enum rtw_debug_mask { + #ifdef CPTCFG_RTW88_DEBUGFS + + void rtw_debugfs_init(struct rtw_dev *rtwdev); ++void rtw_debugfs_deinit(struct rtw_dev *rtwdev); + void rtw_debugfs_get_simple_phy_info(struct seq_file *m); + + #else + + static inline void rtw_debugfs_init(struct rtw_dev *rtwdev) {} ++static inline void rtw_debugfs_deinit(struct rtw_dev *rtwdev) {} + + #endif /* CPTCFG_RTW88_DEBUGFS */ + +--- a/drivers/net/wireless/realtek/rtw88/main.c ++++ b/drivers/net/wireless/realtek/rtw88/main.c +@@ -2300,6 +2300,7 @@ void rtw_unregister_hw(struct rtw_dev *r + + ieee80211_unregister_hw(hw); + rtw_unset_supported_band(hw, chip); ++ rtw_debugfs_deinit(rtwdev); + } + EXPORT_SYMBOL(rtw_unregister_hw); + +--- a/drivers/net/wireless/realtek/rtw88/main.h ++++ b/drivers/net/wireless/realtek/rtw88/main.h +@@ -50,6 +50,7 @@ extern const struct ieee80211_ops rtw_op + #define RTW_MAX_CHANNEL_NUM_5G 49 + + struct rtw_dev; ++struct rtw_debugfs; + + enum rtw_hci_type { + RTW_HCI_TYPE_PCIE, +@@ -2053,7 +2054,7 @@ struct rtw_dev { + bool beacon_loss; + struct completion lps_leave_check; + +- struct dentry *debugfs; ++ struct rtw_debugfs *debugfs; + + u8 sta_cnt; + u32 rts_threshold; diff --git a/package/kernel/mac80211/patches/rtl/005-v6.12-wifi-rtw88-select-WANT_DEV_COREDUMP.patch b/package/kernel/mac80211/patches/rtl/005-v6.12-wifi-rtw88-select-WANT_DEV_COREDUMP.patch new file mode 100644 index 00000000000000..6c31b5e848f2f3 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/005-v6.12-wifi-rtw88-select-WANT_DEV_COREDUMP.patch @@ -0,0 +1,25 @@ +From 7e989b0c1e33210c07340bf5228aa83ea52515b5 Mon Sep 17 00:00:00 2001 +From: Zong-Zhe Yang +Date: Thu, 18 Jul 2024 15:06:15 +0800 +Subject: [PATCH] wifi: rtw88: select WANT_DEV_COREDUMP + +We have invoked device coredump when fw crash. +Should select WANT_DEV_COREDUMP by ourselves. + +Signed-off-by: Zong-Zhe Yang +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/20240718070616.42217-1-pkshih@realtek.com +--- + drivers/net/wireless/realtek/rtw88/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/wireless/realtek/rtw88/Kconfig ++++ b/drivers/net/wireless/realtek/rtw88/Kconfig +@@ -14,6 +14,7 @@ if RTW88 + config RTW88_CORE + tristate + depends on m ++ select BPAUTO_WANT_DEV_COREDUMP + + config RTW88_PCI + tristate diff --git a/package/kernel/mac80211/patches/rtl/008-v6.12-wifi-rtw88-8822c-Parse-channel-from-IE-to-correct-in.patch b/package/kernel/mac80211/patches/rtl/008-v6.12-wifi-rtw88-8822c-Parse-channel-from-IE-to-correct-in.patch new file mode 100644 index 00000000000000..a304cd7d0504c2 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/008-v6.12-wifi-rtw88-8822c-Parse-channel-from-IE-to-correct-in.patch @@ -0,0 +1,151 @@ +From 53ed4b25a79aeec5991c2dc579e635b136ef7676 Mon Sep 17 00:00:00 2001 +From: Po-Hao Huang +Date: Wed, 24 Jul 2024 13:05:01 +0800 +Subject: [PATCH] wifi: rtw88: 8822c: Parse channel from IE to correct invalid + hardware reports + +For CCK packets we could get incorrect reports from hardware. +And this causes wrong frequencies being reported. Parse the channel +information from IE if provided by AP to fix this. + +Signed-off-by: Po-Hao Huang +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/20240724050501.7550-1-pkshih@realtek.com +--- + drivers/net/wireless/realtek/rtw88/main.h | 1 + + drivers/net/wireless/realtek/rtw88/pci.c | 1 + + drivers/net/wireless/realtek/rtw88/rtw8822c.c | 7 ++-- + drivers/net/wireless/realtek/rtw88/rx.c | 41 +++++++++++++++++++ + drivers/net/wireless/realtek/rtw88/rx.h | 13 ++++++ + drivers/net/wireless/realtek/rtw88/sdio.c | 1 + + drivers/net/wireless/realtek/rtw88/usb.c | 2 + + 7 files changed, 63 insertions(+), 3 deletions(-) + +--- a/drivers/net/wireless/realtek/rtw88/main.h ++++ b/drivers/net/wireless/realtek/rtw88/main.h +@@ -623,6 +623,7 @@ struct rtw_rx_pkt_stat { + bool crc_err; + bool decrypted; + bool is_c2h; ++ bool channel_invalid; + + s32 signal_power; + u16 pkt_len; +--- a/drivers/net/wireless/realtek/rtw88/pci.c ++++ b/drivers/net/wireless/realtek/rtw88/pci.c +@@ -1088,6 +1088,7 @@ static u32 rtw_pci_rx_napi(struct rtw_de + /* remove rx_desc */ + skb_pull(new, pkt_offset); + ++ rtw_update_rx_freq_for_invalid(rtwdev, new, &rx_status, &pkt_stat); + rtw_rx_stats(rtwdev, pkt_stat.vif, new); + memcpy(new->cb, &rx_status, sizeof(rx_status)); + ieee80211_rx_napi(rtwdev->hw, NULL, new, napi); +--- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c +@@ -2576,9 +2576,10 @@ static void query_phy_status_page0(struc + rx_power[RF_PATH_B] -= 110; + + channel = GET_PHY_STAT_P0_CHANNEL(phy_status); +- if (channel == 0) +- channel = rtwdev->hal.current_channel; +- rtw_set_rx_freq_band(pkt_stat, channel); ++ if (channel != 0) ++ rtw_set_rx_freq_band(pkt_stat, channel); ++ else ++ pkt_stat->channel_invalid = true; + + pkt_stat->rx_power[RF_PATH_A] = rx_power[RF_PATH_A]; + pkt_stat->rx_power[RF_PATH_B] = rx_power[RF_PATH_B]; +--- a/drivers/net/wireless/realtek/rtw88/rx.c ++++ b/drivers/net/wireless/realtek/rtw88/rx.c +@@ -146,6 +146,47 @@ static void rtw_set_rx_freq_by_pktstat(s + rx_status->band = pkt_stat->band; + } + ++void rtw_update_rx_freq_from_ie(struct rtw_dev *rtwdev, struct sk_buff *skb, ++ struct ieee80211_rx_status *rx_status, ++ struct rtw_rx_pkt_stat *pkt_stat) ++{ ++ struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data; ++ int channel = rtwdev->hal.current_channel; ++ size_t hdr_len, ielen; ++ int channel_number; ++ u8 *variable; ++ ++ if (!test_bit(RTW_FLAG_SCANNING, rtwdev->flags)) ++ goto fill_rx_status; ++ ++ if (ieee80211_is_beacon(mgmt->frame_control)) { ++ variable = mgmt->u.beacon.variable; ++ hdr_len = offsetof(struct ieee80211_mgmt, ++ u.beacon.variable); ++ } else if (ieee80211_is_probe_resp(mgmt->frame_control)) { ++ variable = mgmt->u.probe_resp.variable; ++ hdr_len = offsetof(struct ieee80211_mgmt, ++ u.probe_resp.variable); ++ } else { ++ goto fill_rx_status; ++ } ++ ++ if (skb->len > hdr_len) ++ ielen = skb->len - hdr_len; ++ else ++ goto fill_rx_status; ++ ++ channel_number = cfg80211_get_ies_channel_number(variable, ielen, ++ NL80211_BAND_2GHZ); ++ if (channel_number != -1) ++ channel = channel_number; ++ ++fill_rx_status: ++ rtw_set_rx_freq_band(pkt_stat, channel); ++ rtw_set_rx_freq_by_pktstat(pkt_stat, rx_status); ++} ++EXPORT_SYMBOL(rtw_update_rx_freq_from_ie); ++ + void rtw_rx_fill_rx_status(struct rtw_dev *rtwdev, + struct rtw_rx_pkt_stat *pkt_stat, + struct ieee80211_hdr *hdr, +--- a/drivers/net/wireless/realtek/rtw88/rx.h ++++ b/drivers/net/wireless/realtek/rtw88/rx.h +@@ -50,5 +50,18 @@ void rtw_rx_fill_rx_status(struct rtw_de + struct ieee80211_hdr *hdr, + struct ieee80211_rx_status *rx_status, + u8 *phy_status); ++void rtw_update_rx_freq_from_ie(struct rtw_dev *rtwdev, struct sk_buff *skb, ++ struct ieee80211_rx_status *rx_status, ++ struct rtw_rx_pkt_stat *pkt_stat); ++ ++static inline ++void rtw_update_rx_freq_for_invalid(struct rtw_dev *rtwdev, struct sk_buff *skb, ++ struct ieee80211_rx_status *rx_status, ++ struct rtw_rx_pkt_stat *pkt_stat) ++{ ++ if (pkt_stat->channel_invalid) ++ rtw_update_rx_freq_from_ie(rtwdev, skb, rx_status, pkt_stat); ++} ++ + + #endif +--- a/drivers/net/wireless/realtek/rtw88/sdio.c ++++ b/drivers/net/wireless/realtek/rtw88/sdio.c +@@ -948,6 +948,7 @@ static void rtw_sdio_rx_skb(struct rtw_d + skb_put(skb, pkt_stat->pkt_len); + skb_reserve(skb, pkt_offset); + ++ rtw_update_rx_freq_for_invalid(rtwdev, skb, rx_status, pkt_stat); + rtw_rx_stats(rtwdev, pkt_stat->vif, skb); + + ieee80211_rx_irqsafe(rtwdev->hw, skb); +--- a/drivers/net/wireless/realtek/rtw88/usb.c ++++ b/drivers/net/wireless/realtek/rtw88/usb.c +@@ -579,6 +579,8 @@ static void rtw_usb_rx_handler(struct wo + + skb_put(skb, pkt_stat.pkt_len); + skb_reserve(skb, pkt_offset); ++ ++ rtw_update_rx_freq_for_invalid(rtwdev, skb, &rx_status, &pkt_stat); + memcpy(skb->cb, &rx_status, sizeof(rx_status)); + ieee80211_rx_irqsafe(rtwdev->hw, skb); + } diff --git a/package/kernel/mac80211/patches/rtl/010-v6.12-wifi-rtw88-usb-Init-RX-burst-length-according-to-USB.patch b/package/kernel/mac80211/patches/rtl/010-v6.12-wifi-rtw88-usb-Init-RX-burst-length-according-to-USB.patch new file mode 100644 index 00000000000000..191c87ff37adc5 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/010-v6.12-wifi-rtw88-usb-Init-RX-burst-length-according-to-USB.patch @@ -0,0 +1,73 @@ +From fbbd8cb347e25b68d25c4f3871821afc495ee7a9 Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Thu, 8 Aug 2024 01:19:36 +0300 +Subject: [PATCH] wifi: rtw88: usb: Init RX burst length according to USB speed + +This is needed in order to make USB RX aggregation work with RTL8811CU +(and presumably RTL8822BU and RTL8822CU also). + +I don't know what BIT_DMA_BURST_CNT, BIT_DMA_MODE, and BIT_DROP_DATA_EN +are doing. + +Tested with RTL8822CU, RTL8811CU, and RTL8723DU. + +The RX speed is unchanged in my tests. + +Tested-by: Sascha Hauer +Signed-off-by: Bitterblue Smith +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/ac569c6f-7129-4341-b523-901fe10cabff@gmail.com +--- + drivers/net/wireless/realtek/rtw88/reg.h | 6 ++++++ + drivers/net/wireless/realtek/rtw88/usb.c | 23 ++++++++++++++++++++++- + 2 files changed, 28 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/realtek/rtw88/reg.h ++++ b/drivers/net/wireless/realtek/rtw88/reg.h +@@ -322,6 +322,12 @@ + #define REG_RXDMA_DPR 0x028C + #define REG_RXDMA_MODE 0x0290 + #define BIT_DMA_MODE BIT(1) ++#define BIT_DMA_BURST_CNT GENMASK(3, 2) ++#define BIT_DMA_BURST_SIZE GENMASK(5, 4) ++#define BIT_DMA_BURST_SIZE_64 2 ++#define BIT_DMA_BURST_SIZE_512 1 ++#define BIT_DMA_BURST_SIZE_1024 0 ++ + #define REG_RXPKTNUM 0x02B0 + + #define REG_INT_MIG 0x0304 +--- a/drivers/net/wireless/realtek/rtw88/usb.c ++++ b/drivers/net/wireless/realtek/rtw88/usb.c +@@ -720,9 +720,30 @@ static void rtw_usb_link_ps(struct rtw_d + /* empty function for rtw_hci_ops */ + } + ++static void rtw_usb_init_burst_pkt_len(struct rtw_dev *rtwdev) ++{ ++ struct rtw_usb *rtwusb = rtw_get_usb_priv(rtwdev); ++ enum usb_device_speed speed = rtwusb->udev->speed; ++ u8 rxdma, burst_size; ++ ++ rxdma = BIT_DMA_BURST_CNT | BIT_DMA_MODE; ++ ++ if (speed == USB_SPEED_SUPER) ++ burst_size = BIT_DMA_BURST_SIZE_1024; ++ else if (speed == USB_SPEED_HIGH) ++ burst_size = BIT_DMA_BURST_SIZE_512; ++ else ++ burst_size = BIT_DMA_BURST_SIZE_64; ++ ++ u8p_replace_bits(&rxdma, burst_size, BIT_DMA_BURST_SIZE); ++ ++ rtw_write8(rtwdev, REG_RXDMA_MODE, rxdma); ++ rtw_write16_set(rtwdev, REG_TXDMA_OFFSET_CHK, BIT_DROP_DATA_EN); ++} ++ + static void rtw_usb_interface_cfg(struct rtw_dev *rtwdev) + { +- /* empty function for rtw_hci_ops */ ++ rtw_usb_init_burst_pkt_len(rtwdev); + } + + static struct rtw_hci_ops rtw_usb_ops = { diff --git a/package/kernel/mac80211/patches/rtl/011-v6.12-wifi-rtw88-usb-Update-the-RX-stats-after-every-frame.patch b/package/kernel/mac80211/patches/rtl/011-v6.12-wifi-rtw88-usb-Update-the-RX-stats-after-every-frame.patch new file mode 100644 index 00000000000000..f78f43b4647d10 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/011-v6.12-wifi-rtw88-usb-Update-the-RX-stats-after-every-frame.patch @@ -0,0 +1,31 @@ +From 38ea04a79ad0f8cc30bb5e9ad98d665e4ae5060c Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Thu, 8 Aug 2024 01:20:36 +0300 +Subject: [PATCH] wifi: rtw88: usb: Update the RX stats after every frame + +Update the number of received unicast data frames and bytes every time +a frame is received. This is what the PCI and SDIO drivers do. + +This has an influence on the power saving, bluetooth coexistence, and +(in a future patch) the use of RX aggregation. + +Tested with RTL8822CU, RTL8811CU, and RTL8723DU. + +Tested-by: Sascha Hauer +Signed-off-by: Bitterblue Smith +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/75a2ca52-8f01-45c5-926f-d3a68ae3b284@gmail.com +--- + drivers/net/wireless/realtek/rtw88/usb.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/wireless/realtek/rtw88/usb.c ++++ b/drivers/net/wireless/realtek/rtw88/usb.c +@@ -581,6 +581,7 @@ static void rtw_usb_rx_handler(struct wo + skb_reserve(skb, pkt_offset); + + rtw_update_rx_freq_for_invalid(rtwdev, skb, &rx_status, &pkt_stat); ++ rtw_rx_stats(rtwdev, pkt_stat.vif, skb); + memcpy(skb->cb, &rx_status, sizeof(rx_status)); + ieee80211_rx_irqsafe(rtwdev->hw, skb); + } diff --git a/package/kernel/mac80211/patches/rtl/012-v6.12-wifi-rtw88-usb-Support-RX-aggregation.patch b/package/kernel/mac80211/patches/rtl/012-v6.12-wifi-rtw88-usb-Support-RX-aggregation.patch new file mode 100644 index 00000000000000..bc8eac898b24b0 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/012-v6.12-wifi-rtw88-usb-Support-RX-aggregation.patch @@ -0,0 +1,118 @@ +From df3d8f463b1dfc7cb8f4fb52b1b81d290b850d03 Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Thu, 8 Aug 2024 01:21:36 +0300 +Subject: [PATCH] wifi: rtw88: usb: Support RX aggregation + +The chips can be configured to aggregate several frames into a single +USB transfer. Modify rtw_usb_rx_handler() to support this case. + +RX aggregation improves the RX speed of RTL8811CU on certain ARM +systems, like the NanoPi NEO Core2. It also improves the RX speed of +RTL8822CU on some x86_64 systems. + +Currently none of the chips are configured to aggregate frames. + +Tested with RTL8822CU, RTL8811CU, and RTL8723DU. + +Reviewed-by: Sascha Hauer +Tested-by: Sascha Hauer +Signed-off-by: Bitterblue Smith +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/f845826d-de71-492d-9a22-e48c07989a1f@gmail.com +--- + drivers/net/wireless/realtek/rtw88/usb.c | 61 ++++++++++++++++-------- + 1 file changed, 40 insertions(+), 21 deletions(-) + +--- a/drivers/net/wireless/realtek/rtw88/usb.c ++++ b/drivers/net/wireless/realtek/rtw88/usb.c +@@ -546,11 +546,12 @@ static void rtw_usb_rx_handler(struct wo + struct rtw_usb *rtwusb = container_of(work, struct rtw_usb, rx_work); + struct rtw_dev *rtwdev = rtwusb->rtwdev; + const struct rtw_chip_info *chip = rtwdev->chip; +- struct rtw_rx_pkt_stat pkt_stat; ++ u32 pkt_desc_sz = chip->rx_pkt_desc_sz; + struct ieee80211_rx_status rx_status; ++ u32 pkt_offset, next_pkt, urb_len; ++ struct rtw_rx_pkt_stat pkt_stat; ++ struct sk_buff *next_skb; + struct sk_buff *skb; +- u32 pkt_desc_sz = chip->rx_pkt_desc_sz; +- u32 pkt_offset; + u8 *rx_desc; + int limit; + +@@ -559,31 +560,48 @@ static void rtw_usb_rx_handler(struct wo + if (!skb) + break; + +- rx_desc = skb->data; +- chip->ops->query_rx_desc(rtwdev, rx_desc, &pkt_stat, +- &rx_status); +- pkt_offset = pkt_desc_sz + pkt_stat.drv_info_sz + +- pkt_stat.shift; +- +- if (pkt_stat.is_c2h) { +- skb_put(skb, pkt_stat.pkt_len + pkt_offset); +- rtw_fw_c2h_cmd_rx_irqsafe(rtwdev, pkt_offset, skb); +- continue; +- } +- + if (skb_queue_len(&rtwusb->rx_queue) >= RTW_USB_MAX_RXQ_LEN) { + dev_dbg_ratelimited(rtwdev->dev, "failed to get rx_queue, overflow\n"); + dev_kfree_skb_any(skb); + continue; + } + +- skb_put(skb, pkt_stat.pkt_len); +- skb_reserve(skb, pkt_offset); ++ urb_len = skb->len; ++ ++ do { ++ rx_desc = skb->data; ++ chip->ops->query_rx_desc(rtwdev, rx_desc, &pkt_stat, ++ &rx_status); ++ pkt_offset = pkt_desc_sz + pkt_stat.drv_info_sz + ++ pkt_stat.shift; ++ ++ next_pkt = round_up(pkt_stat.pkt_len + pkt_offset, 8); ++ ++ if (urb_len >= next_pkt + pkt_desc_sz) ++ next_skb = skb_clone(skb, GFP_KERNEL); ++ else ++ next_skb = NULL; ++ ++ if (pkt_stat.is_c2h) { ++ skb_trim(skb, pkt_stat.pkt_len + pkt_offset); ++ rtw_fw_c2h_cmd_rx_irqsafe(rtwdev, pkt_offset, skb); ++ } else { ++ skb_pull(skb, pkt_offset); ++ skb_trim(skb, pkt_stat.pkt_len); ++ rtw_update_rx_freq_for_invalid(rtwdev, skb, ++ &rx_status, ++ &pkt_stat); ++ rtw_rx_stats(rtwdev, pkt_stat.vif, skb); ++ memcpy(skb->cb, &rx_status, sizeof(rx_status)); ++ ieee80211_rx_irqsafe(rtwdev->hw, skb); ++ } ++ ++ skb = next_skb; ++ if (skb) ++ skb_pull(skb, next_pkt); + +- rtw_update_rx_freq_for_invalid(rtwdev, skb, &rx_status, &pkt_stat); +- rtw_rx_stats(rtwdev, pkt_stat.vif, skb); +- memcpy(skb->cb, &rx_status, sizeof(rx_status)); +- ieee80211_rx_irqsafe(rtwdev->hw, skb); ++ urb_len -= next_pkt; ++ } while (skb); + } + } + +@@ -627,6 +645,7 @@ static void rtw_usb_read_port_complete(s + if (skb) + dev_kfree_skb_any(skb); + } else { ++ skb_put(skb, urb->actual_length); + skb_queue_tail(&rtwusb->rx_queue, skb); + queue_work(rtwusb->rxwq, &rtwusb->rx_work); + } diff --git a/package/kernel/mac80211/patches/rtl/013-v6.12-wifi-rtw88-Enable-USB-RX-aggregation-for-8822c-8822b.patch b/package/kernel/mac80211/patches/rtl/013-v6.12-wifi-rtw88-Enable-USB-RX-aggregation-for-8822c-8822b.patch new file mode 100644 index 00000000000000..71175324e6da6b --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/013-v6.12-wifi-rtw88-Enable-USB-RX-aggregation-for-8822c-8822b.patch @@ -0,0 +1,168 @@ +From 002a5db9a52a0e7af0fa9a450d31049748435748 Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Thu, 8 Aug 2024 01:23:06 +0300 +Subject: [PATCH] wifi: rtw88: Enable USB RX aggregation for 8822c/8822b/8821c + +Enable USB RX aggregation when there is at least 1 Mbps RX or TX +traffic, otherwise disable it. + +USB RX aggregation improves the RX speed of RTL8811CU on certain ARM +systems, like the NanoPi NEO Core2. Before: 28 Mbps, after: 231 Mbps. + +It also improves the RX speed of RTL8822CU on some x86_64 systems. +Before: ~200 Mbps, after: ~300 Mbps. + +The official drivers for these chips use the same logic for SDIO, but +for some reason the SDIO driver in rtw88 always enables RX aggregation, +so this patch only toggles aggregation for USB devices. + +RTL8703B is likely not found in USB devices, and RTL8723DU doesn't like +aggregation. + +Tested-by: Sascha Hauer +Signed-off-by: Bitterblue Smith +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/b4c0d54c-6755-4b0f-9dd7-f9196fd74b68@gmail.com +--- + drivers/net/wireless/realtek/rtw88/hci.h | 7 ++++ + drivers/net/wireless/realtek/rtw88/main.c | 13 +++++--- + drivers/net/wireless/realtek/rtw88/pci.c | 1 + + drivers/net/wireless/realtek/rtw88/sdio.c | 1 + + drivers/net/wireless/realtek/rtw88/usb.c | 40 +++++++++++++++++++++++ + 5 files changed, 58 insertions(+), 4 deletions(-) + +--- a/drivers/net/wireless/realtek/rtw88/hci.h ++++ b/drivers/net/wireless/realtek/rtw88/hci.h +@@ -18,6 +18,7 @@ struct rtw_hci_ops { + void (*deep_ps)(struct rtw_dev *rtwdev, bool enter); + void (*link_ps)(struct rtw_dev *rtwdev, bool enter); + void (*interface_cfg)(struct rtw_dev *rtwdev); ++ void (*dynamic_rx_agg)(struct rtw_dev *rtwdev, bool enable); + + int (*write_data_rsvd_page)(struct rtw_dev *rtwdev, u8 *buf, u32 size); + int (*write_data_h2c)(struct rtw_dev *rtwdev, u8 *buf, u32 size); +@@ -72,6 +73,12 @@ static inline void rtw_hci_interface_cfg + rtwdev->hci.ops->interface_cfg(rtwdev); + } + ++static inline void rtw_hci_dynamic_rx_agg(struct rtw_dev *rtwdev, bool enable) ++{ ++ if (rtwdev->hci.ops->dynamic_rx_agg) ++ rtwdev->hci.ops->dynamic_rx_agg(rtwdev, enable); ++} ++ + static inline int + rtw_hci_write_data_rsvd_page(struct rtw_dev *rtwdev, u8 *buf, u32 size) + { +--- a/drivers/net/wireless/realtek/rtw88/main.c ++++ b/drivers/net/wireless/realtek/rtw88/main.c +@@ -212,6 +212,7 @@ static void rtw_watch_dog_work(struct wo + struct rtw_traffic_stats *stats = &rtwdev->stats; + struct rtw_watch_dog_iter_data data = {}; + bool busy_traffic = test_bit(RTW_FLAG_BUSY_TRAFFIC, rtwdev->flags); ++ u32 tx_unicast_mbps, rx_unicast_mbps; + bool ps_active; + + mutex_lock(&rtwdev->mutex); +@@ -236,10 +237,11 @@ static void rtw_watch_dog_work(struct wo + else + ps_active = false; + +- ewma_tp_add(&stats->tx_ewma_tp, +- (u32)(stats->tx_unicast >> RTW_TP_SHIFT)); +- ewma_tp_add(&stats->rx_ewma_tp, +- (u32)(stats->rx_unicast >> RTW_TP_SHIFT)); ++ tx_unicast_mbps = stats->tx_unicast >> RTW_TP_SHIFT; ++ rx_unicast_mbps = stats->rx_unicast >> RTW_TP_SHIFT; ++ ++ ewma_tp_add(&stats->tx_ewma_tp, tx_unicast_mbps); ++ ewma_tp_add(&stats->rx_ewma_tp, rx_unicast_mbps); + stats->tx_throughput = ewma_tp_read(&stats->tx_ewma_tp); + stats->rx_throughput = ewma_tp_read(&stats->rx_ewma_tp); + +@@ -259,6 +261,9 @@ static void rtw_watch_dog_work(struct wo + + rtw_phy_dynamic_mechanism(rtwdev); + ++ rtw_hci_dynamic_rx_agg(rtwdev, ++ tx_unicast_mbps >= 1 || rx_unicast_mbps >= 1); ++ + data.rtwdev = rtwdev; + /* rtw_iterate_vifs internally uses an atomic iterator which is needed + * to avoid taking local->iflist_mtx mutex +--- a/drivers/net/wireless/realtek/rtw88/pci.c ++++ b/drivers/net/wireless/realtek/rtw88/pci.c +@@ -1601,6 +1601,7 @@ static struct rtw_hci_ops rtw_pci_ops = + .deep_ps = rtw_pci_deep_ps, + .link_ps = rtw_pci_link_ps, + .interface_cfg = rtw_pci_interface_cfg, ++ .dynamic_rx_agg = NULL, + + .read8 = rtw_pci_read8, + .read16 = rtw_pci_read16, +--- a/drivers/net/wireless/realtek/rtw88/sdio.c ++++ b/drivers/net/wireless/realtek/rtw88/sdio.c +@@ -1157,6 +1157,7 @@ static struct rtw_hci_ops rtw_sdio_ops = + .deep_ps = rtw_sdio_deep_ps, + .link_ps = rtw_sdio_link_ps, + .interface_cfg = rtw_sdio_interface_cfg, ++ .dynamic_rx_agg = NULL, + + .read8 = rtw_sdio_read8, + .read16 = rtw_sdio_read16, +--- a/drivers/net/wireless/realtek/rtw88/usb.c ++++ b/drivers/net/wireless/realtek/rtw88/usb.c +@@ -766,6 +766,45 @@ static void rtw_usb_interface_cfg(struct + rtw_usb_init_burst_pkt_len(rtwdev); + } + ++static void rtw_usb_dynamic_rx_agg_v1(struct rtw_dev *rtwdev, bool enable) ++{ ++ u8 size, timeout; ++ u16 val16; ++ ++ rtw_write32_set(rtwdev, REG_RXDMA_AGG_PG_TH, BIT_EN_PRE_CALC); ++ rtw_write8_set(rtwdev, REG_TXDMA_PQ_MAP, BIT_RXDMA_AGG_EN); ++ rtw_write8_clr(rtwdev, REG_RXDMA_AGG_PG_TH + 3, BIT(7)); ++ ++ if (enable) { ++ size = 0x5; ++ timeout = 0x20; ++ } else { ++ size = 0x0; ++ timeout = 0x1; ++ } ++ val16 = u16_encode_bits(size, BIT_RXDMA_AGG_PG_TH) | ++ u16_encode_bits(timeout, BIT_DMA_AGG_TO_V1); ++ ++ rtw_write16(rtwdev, REG_RXDMA_AGG_PG_TH, val16); ++} ++ ++static void rtw_usb_dynamic_rx_agg(struct rtw_dev *rtwdev, bool enable) ++{ ++ switch (rtwdev->chip->id) { ++ case RTW_CHIP_TYPE_8822C: ++ case RTW_CHIP_TYPE_8822B: ++ case RTW_CHIP_TYPE_8821C: ++ rtw_usb_dynamic_rx_agg_v1(rtwdev, enable); ++ break; ++ case RTW_CHIP_TYPE_8723D: ++ /* Doesn't like aggregation. */ ++ break; ++ case RTW_CHIP_TYPE_8703B: ++ /* Likely not found in USB devices. */ ++ break; ++ } ++} ++ + static struct rtw_hci_ops rtw_usb_ops = { + .tx_write = rtw_usb_tx_write, + .tx_kick_off = rtw_usb_tx_kick_off, +@@ -775,6 +814,7 @@ static struct rtw_hci_ops rtw_usb_ops = + .deep_ps = rtw_usb_deep_ps, + .link_ps = rtw_usb_link_ps, + .interface_cfg = rtw_usb_interface_cfg, ++ .dynamic_rx_agg = rtw_usb_dynamic_rx_agg, + + .write8 = rtw_usb_write8, + .write16 = rtw_usb_write16, diff --git a/package/kernel/mac80211/patches/rtl/016-v6.12-wifi-rtw88-assign-mac_id-for-vif-sta-and-update-to-T.patch b/package/kernel/mac80211/patches/rtl/016-v6.12-wifi-rtw88-assign-mac_id-for-vif-sta-and-update-to-T.patch new file mode 100644 index 00000000000000..ce110c5c90c1a0 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/016-v6.12-wifi-rtw88-assign-mac_id-for-vif-sta-and-update-to-T.patch @@ -0,0 +1,231 @@ +From 902cb7b11f9a7ff07233cc4c626b54c3e4703149 Mon Sep 17 00:00:00 2001 +From: Ping-Ke Shih +Date: Mon, 19 Aug 2024 10:52:48 +0800 +Subject: [PATCH] wifi: rtw88: assign mac_id for vif/sta and update to TX desc + +A mac_id as an instance in firmware has to be assigned for each station +including AP and connected stations. Firmware will use the mac_id to +control TX rate and do statistics. + +Assignment rule is to assign mac_id to each vif when adding vif. +For station mode, sta->mac_id will reuse vif->mac_id. For AP mode, +dynamically allocate an sta->mac_id to a station, and vif->mac_id is +used to send broadcast/multicast packets which are not belong to +a station. For example, + + vif->mac_id sta->mac_id +vif0 (STA mode) 0 0 +vif1 (AP mode) 1 2... + +By the way, remove unused RTW_BC_MC_MACID, which was planed to send +broadcast/multicast packets on fixed mac_id. + +Tested-on RTL8822CE with STA + AP SCC mode. + +Link: https://lore.kernel.org/linux-wireless/e4be0a75-43b2-4ae5-9aab-5c4a88e78097@gmail.com/ +Cc: Bitterblue Smith +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/20240819025248.17939-1-pkshih@realtek.com +--- + drivers/net/wireless/realtek/rtw88/mac80211.c | 13 ++++++-- + drivers/net/wireless/realtek/rtw88/main.c | 30 ++++++++----------- + drivers/net/wireless/realtek/rtw88/main.h | 14 +++++++-- + drivers/net/wireless/realtek/rtw88/tx.c | 11 +++++-- + drivers/net/wireless/realtek/rtw88/tx.h | 1 + + 5 files changed, 44 insertions(+), 25 deletions(-) + +--- a/drivers/net/wireless/realtek/rtw88/mac80211.c ++++ b/drivers/net/wireless/realtek/rtw88/mac80211.c +@@ -167,6 +167,12 @@ static int rtw_ops_add_interface(struct + + mutex_lock(&rtwdev->mutex); + ++ rtwvif->mac_id = rtw_acquire_macid(rtwdev); ++ if (rtwvif->mac_id >= RTW_MAX_MAC_ID_NUM) { ++ mutex_unlock(&rtwdev->mutex); ++ return -ENOSPC; ++ } ++ + port = find_first_zero_bit(rtwdev->hw_port, RTW_PORT_NUM); + if (port >= RTW_PORT_NUM) { + mutex_unlock(&rtwdev->mutex); +@@ -214,7 +220,8 @@ static int rtw_ops_add_interface(struct + + mutex_unlock(&rtwdev->mutex); + +- rtw_dbg(rtwdev, RTW_DBG_STATE, "start vif %pM on port %d\n", vif->addr, rtwvif->port); ++ rtw_dbg(rtwdev, RTW_DBG_STATE, "start vif %pM mac_id %d on port %d\n", ++ vif->addr, rtwvif->mac_id, rtwvif->port); + return 0; + } + +@@ -225,7 +232,8 @@ static void rtw_ops_remove_interface(str + struct rtw_vif *rtwvif = (struct rtw_vif *)vif->drv_priv; + u32 config = 0; + +- rtw_dbg(rtwdev, RTW_DBG_STATE, "stop vif %pM on port %d\n", vif->addr, rtwvif->port); ++ rtw_dbg(rtwdev, RTW_DBG_STATE, "stop vif %pM mac_id %d on port %d\n", ++ vif->addr, rtwvif->mac_id, rtwvif->port); + + mutex_lock(&rtwdev->mutex); + +@@ -242,6 +250,7 @@ static void rtw_ops_remove_interface(str + config |= PORT_SET_BCN_CTRL; + rtw_vif_port_config(rtwdev, rtwvif, config); + clear_bit(rtwvif->port, rtwdev->hw_port); ++ rtw_release_macid(rtwdev, rtwvif->mac_id); + rtw_recalc_lps(rtwdev, NULL); + + mutex_unlock(&rtwdev->mutex); +--- a/drivers/net/wireless/realtek/rtw88/main.c ++++ b/drivers/net/wireless/realtek/rtw88/main.c +@@ -311,17 +311,6 @@ static void rtw_ips_work(struct work_str + mutex_unlock(&rtwdev->mutex); + } + +-static u8 rtw_acquire_macid(struct rtw_dev *rtwdev) +-{ +- unsigned long mac_id; +- +- mac_id = find_first_zero_bit(rtwdev->mac_id_map, RTW_MAX_MAC_ID_NUM); +- if (mac_id < RTW_MAX_MAC_ID_NUM) +- set_bit(mac_id, rtwdev->mac_id_map); +- +- return mac_id; +-} +- + static void rtw_sta_rc_work(struct work_struct *work) + { + struct rtw_sta_info *si = container_of(work, struct rtw_sta_info, +@@ -340,12 +329,14 @@ int rtw_sta_add(struct rtw_dev *rtwdev, + struct rtw_vif *rtwvif = (struct rtw_vif *)vif->drv_priv; + int i; + +- si->mac_id = rtw_acquire_macid(rtwdev); +- if (si->mac_id >= RTW_MAX_MAC_ID_NUM) +- return -ENOSPC; ++ if (vif->type == NL80211_IFTYPE_STATION) { ++ si->mac_id = rtwvif->mac_id; ++ } else { ++ si->mac_id = rtw_acquire_macid(rtwdev); ++ if (si->mac_id >= RTW_MAX_MAC_ID_NUM) ++ return -ENOSPC; ++ } + +- if (vif->type == NL80211_IFTYPE_STATION && vif->cfg.assoc == 0) +- rtwvif->mac_id = si->mac_id; + si->rtwdev = rtwdev; + si->sta = sta; + si->vif = vif; +@@ -370,11 +361,13 @@ void rtw_sta_remove(struct rtw_dev *rtwd + bool fw_exist) + { + struct rtw_sta_info *si = (struct rtw_sta_info *)sta->drv_priv; ++ struct ieee80211_vif *vif = si->vif; + int i; + + cancel_work_sync(&si->rc_work); + +- rtw_release_macid(rtwdev, si->mac_id); ++ if (vif->type != NL80211_IFTYPE_STATION) ++ rtw_release_macid(rtwdev, si->mac_id); + if (fw_exist) + rtw_fw_media_status_report(rtwdev, si->mac_id, false); + +@@ -614,6 +607,8 @@ static void rtw_reset_vif_iter(void *dat + rtw_bf_disassoc(rtwdev, vif, NULL); + rtw_vif_assoc_changed(rtwvif, NULL); + rtw_txq_cleanup(rtwdev, vif->txq); ++ ++ rtw_release_macid(rtwdev, rtwvif->mac_id); + } + + void rtw_fw_recovery(struct rtw_dev *rtwdev) +@@ -2139,7 +2134,6 @@ int rtw_core_init(struct rtw_dev *rtwdev + rtwdev->sec.total_cam_num = 32; + rtwdev->hal.current_channel = 1; + rtwdev->dm_info.fix_rate = U8_MAX; +- set_bit(RTW_BC_MC_MACID, rtwdev->mac_id_map); + + rtw_stats_init(rtwdev); + +--- a/drivers/net/wireless/realtek/rtw88/main.h ++++ b/drivers/net/wireless/realtek/rtw88/main.h +@@ -742,7 +742,6 @@ struct rtw_txq { + unsigned long flags; + }; + +-#define RTW_BC_MC_MACID 1 + DECLARE_EWMA(rssi, 10, 16); + + struct rtw_sta_info { +@@ -805,7 +804,7 @@ struct rtw_bf_info { + struct rtw_vif { + enum rtw_net_type net_type; + u16 aid; +- u8 mac_id; /* for STA mode only */ ++ u8 mac_id; + u8 mac_addr[ETH_ALEN]; + u8 bssid[ETH_ALEN]; + u8 port; +@@ -2131,6 +2130,17 @@ static inline bool rtw_chip_has_tx_stbc( + return rtwdev->chip->tx_stbc; + } + ++static inline u8 rtw_acquire_macid(struct rtw_dev *rtwdev) ++{ ++ unsigned long mac_id; ++ ++ mac_id = find_first_zero_bit(rtwdev->mac_id_map, RTW_MAX_MAC_ID_NUM); ++ if (mac_id < RTW_MAX_MAC_ID_NUM) ++ set_bit(mac_id, rtwdev->mac_id_map); ++ ++ return mac_id; ++} ++ + static inline void rtw_release_macid(struct rtw_dev *rtwdev, u8 mac_id) + { + clear_bit(mac_id, rtwdev->mac_id_map); +--- a/drivers/net/wireless/realtek/rtw88/tx.c ++++ b/drivers/net/wireless/realtek/rtw88/tx.c +@@ -46,7 +46,8 @@ void rtw_tx_fill_tx_desc(struct rtw_tx_p + le32_encode_bits(pkt_info->ls, RTW_TX_DESC_W0_LS) | + le32_encode_bits(pkt_info->dis_qselseq, RTW_TX_DESC_W0_DISQSELSEQ); + +- tx_desc->w1 = le32_encode_bits(pkt_info->qsel, RTW_TX_DESC_W1_QSEL) | ++ tx_desc->w1 = le32_encode_bits(pkt_info->mac_id, RTW_TX_DESC_W1_MACID) | ++ le32_encode_bits(pkt_info->qsel, RTW_TX_DESC_W1_QSEL) | + le32_encode_bits(pkt_info->rate_id, RTW_TX_DESC_W1_RATE_ID) | + le32_encode_bits(pkt_info->sec_type, RTW_TX_DESC_W1_SEC_TYPE) | + le32_encode_bits(pkt_info->pkt_offset, RTW_TX_DESC_W1_PKT_OFFSET) | +@@ -401,14 +402,18 @@ void rtw_tx_pkt_info_update(struct rtw_d + const struct rtw_chip_info *chip = rtwdev->chip; + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; ++ struct ieee80211_vif *vif = info->control.vif; + struct rtw_sta_info *si; +- struct ieee80211_vif *vif = NULL; ++ struct rtw_vif *rtwvif; + __le16 fc = hdr->frame_control; + bool bmc; + + if (sta) { + si = (struct rtw_sta_info *)sta->drv_priv; +- vif = si->vif; ++ pkt_info->mac_id = si->mac_id; ++ } else if (vif) { ++ rtwvif = (struct rtw_vif *)vif->drv_priv; ++ pkt_info->mac_id = rtwvif->mac_id; + } + + if (ieee80211_is_mgmt(fc) || ieee80211_is_nullfunc(fc)) +--- a/drivers/net/wireless/realtek/rtw88/tx.h ++++ b/drivers/net/wireless/realtek/rtw88/tx.h +@@ -27,6 +27,7 @@ struct rtw_tx_desc { + #define RTW_TX_DESC_W0_BMC BIT(24) + #define RTW_TX_DESC_W0_LS BIT(26) + #define RTW_TX_DESC_W0_DISQSELSEQ BIT(31) ++#define RTW_TX_DESC_W1_MACID GENMASK(7, 0) + #define RTW_TX_DESC_W1_QSEL GENMASK(12, 8) + #define RTW_TX_DESC_W1_RATE_ID GENMASK(20, 16) + #define RTW_TX_DESC_W1_SEC_TYPE GENMASK(23, 22) diff --git a/package/kernel/mac80211/patches/rtl/017-v6.13-wifi-rtw88-Constify-some-arrays-and-structs.patch b/package/kernel/mac80211/patches/rtl/017-v6.13-wifi-rtw88-Constify-some-arrays-and-structs.patch new file mode 100644 index 00000000000000..8d2bb9aa7a918c --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/017-v6.13-wifi-rtw88-Constify-some-arrays-and-structs.patch @@ -0,0 +1,374 @@ +From 140403599b74839b0a57c5397b7e8579e5332364 Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Wed, 18 Sep 2024 01:53:55 +0300 +Subject: [PATCH] wifi: rtw88: Constify some arrays and structs + +These are never modified, so make them const: + +card_enable_flow_8703b +card_disable_flow_8703b +rtw8703b_ops + +rtw8723d_ops +card_enable_flow_8723d +card_disable_flow_8723d + +trans_carddis_to_cardemu_8821c +trans_cardemu_to_act_8821c +trans_act_to_cardemu_8821c +trans_cardemu_to_carddis_8821c +card_enable_flow_8821c +card_disable_flow_8821c +rtw8821c_dig +page_table_8821c +rqpn_table_8821c +prioq_addrs_8821c +rtw8821c_ops + +card_enable_flow_8822b +card_disable_flow_8822b +prioq_addrs_8822b +rtw8822b_ops +rtw8822b_edcca_th + +card_enable_flow_8822c +card_disable_flow_8822c +prioq_addrs_8822c +rtw8822c_ops +rtw8822c_edcca_th + +Signed-off-by: Bitterblue Smith +Acked-by: Ping-Ke Shih +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/dae7994f-3491-40de-b537-ebf68df084bb@gmail.com +--- + drivers/net/wireless/realtek/rtw88/fw.c | 2 +- + drivers/net/wireless/realtek/rtw88/mac.c | 4 ++-- + drivers/net/wireless/realtek/rtw88/main.h | 8 +++---- + drivers/net/wireless/realtek/rtw88/phy.c | 2 +- + drivers/net/wireless/realtek/rtw88/rtw8703b.c | 6 ++--- + drivers/net/wireless/realtek/rtw88/rtw8723d.c | 6 ++--- + drivers/net/wireless/realtek/rtw88/rtw8821c.c | 22 +++++++++---------- + drivers/net/wireless/realtek/rtw88/rtw8822b.c | 10 ++++----- + drivers/net/wireless/realtek/rtw88/rtw8822c.c | 10 ++++----- + 9 files changed, 35 insertions(+), 35 deletions(-) + +--- a/drivers/net/wireless/realtek/rtw88/fw.c ++++ b/drivers/net/wireless/realtek/rtw88/fw.c +@@ -267,7 +267,7 @@ static void rtw_fw_scan_result(struct rt + static void rtw_fw_adaptivity_result(struct rtw_dev *rtwdev, u8 *payload, + u8 length) + { +- struct rtw_hw_reg_offset *edcca_th = rtwdev->chip->edcca_th; ++ const struct rtw_hw_reg_offset *edcca_th = rtwdev->chip->edcca_th; + struct rtw_c2h_adaptivity *result = (struct rtw_c2h_adaptivity *)payload; + + rtw_dbg(rtwdev, RTW_DBG_ADAPTIVITY, +--- a/drivers/net/wireless/realtek/rtw88/mac.c ++++ b/drivers/net/wireless/realtek/rtw88/mac.c +@@ -228,7 +228,7 @@ static int rtw_sub_pwr_seq_parser(struct + } + + static int rtw_pwr_seq_parser(struct rtw_dev *rtwdev, +- const struct rtw_pwr_seq_cmd **cmd_seq) ++ const struct rtw_pwr_seq_cmd * const *cmd_seq) + { + u8 cut_mask; + u8 intf_mask; +@@ -271,7 +271,7 @@ static int rtw_pwr_seq_parser(struct rtw + static int rtw_mac_power_switch(struct rtw_dev *rtwdev, bool pwr_on) + { + const struct rtw_chip_info *chip = rtwdev->chip; +- const struct rtw_pwr_seq_cmd **pwr_seq; ++ const struct rtw_pwr_seq_cmd * const *pwr_seq; + u32 imr = 0; + u8 rpwm; + bool cur_pwr; +--- a/drivers/net/wireless/realtek/rtw88/main.h ++++ b/drivers/net/wireless/realtek/rtw88/main.h +@@ -1167,7 +1167,7 @@ enum rtw_fwcd_item { + + /* hardware configuration for each IC */ + struct rtw_chip_info { +- struct rtw_chip_ops *ops; ++ const struct rtw_chip_ops *ops; + u8 id; + + const char *fw_name; +@@ -1209,8 +1209,8 @@ struct rtw_chip_info { + + /* init values */ + u8 sys_func_en; +- const struct rtw_pwr_seq_cmd **pwr_on_seq; +- const struct rtw_pwr_seq_cmd **pwr_off_seq; ++ const struct rtw_pwr_seq_cmd * const *pwr_on_seq; ++ const struct rtw_pwr_seq_cmd * const *pwr_off_seq; + const struct rtw_rqpn *rqpn_table; + const struct rtw_prioq_addrs *prioq_addrs; + const struct rtw_page_table *page_table; +@@ -1242,7 +1242,7 @@ struct rtw_chip_info { + u8 bfer_su_max_num; + u8 bfer_mu_max_num; + +- struct rtw_hw_reg_offset *edcca_th; ++ const struct rtw_hw_reg_offset *edcca_th; + s8 l2h_th_ini_cs; + s8 l2h_th_ini_ad; + +--- a/drivers/net/wireless/realtek/rtw88/phy.c ++++ b/drivers/net/wireless/realtek/rtw88/phy.c +@@ -123,7 +123,7 @@ static void rtw_phy_cck_pd_init(struct r + + void rtw_phy_set_edcca_th(struct rtw_dev *rtwdev, u8 l2h, u8 h2l) + { +- struct rtw_hw_reg_offset *edcca_th = rtwdev->chip->edcca_th; ++ const struct rtw_hw_reg_offset *edcca_th = rtwdev->chip->edcca_th; + + rtw_write32_mask(rtwdev, + edcca_th[EDCCA_TH_L2H_IDX].hw_reg.addr, +--- a/drivers/net/wireless/realtek/rtw88/rtw8703b.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8703b.c +@@ -481,14 +481,14 @@ static const struct rtw_pwr_seq_cmd tran + {TRANS_SEQ_END}, + }; + +-static const struct rtw_pwr_seq_cmd *card_enable_flow_8703b[] = { ++static const struct rtw_pwr_seq_cmd * const card_enable_flow_8703b[] = { + trans_pre_enable_8703b, + trans_carddis_to_cardemu_8703b, + trans_cardemu_to_act_8703b, + NULL + }; + +-static const struct rtw_pwr_seq_cmd *card_disable_flow_8703b[] = { ++static const struct rtw_pwr_seq_cmd * const card_disable_flow_8703b[] = { + trans_act_to_lps_8703b, + trans_act_to_reset_mcu_8703b, + trans_act_to_cardemu_8703b, +@@ -1941,7 +1941,7 @@ static const struct coex_tdma_para tdma_ + { {0x61, 0x08, 0x03, 0x11, 0x11} }, + }; + +-static struct rtw_chip_ops rtw8703b_ops = { ++static const struct rtw_chip_ops rtw8703b_ops = { + .mac_init = rtw8723x_mac_init, + .dump_fw_crash = NULL, + .shutdown = NULL, +--- a/drivers/net/wireless/realtek/rtw88/rtw8723d.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8723d.c +@@ -1430,7 +1430,7 @@ static void rtw8723d_pwr_track(struct rt + dm_info->pwr_trk_triggered = false; + } + +-static struct rtw_chip_ops rtw8723d_ops = { ++static const struct rtw_chip_ops rtw8723d_ops = { + .phy_set_param = rtw8723d_phy_set_param, + .read_efuse = rtw8723x_read_efuse, + .query_rx_desc = rtw8723d_query_rx_desc, +@@ -1788,7 +1788,7 @@ static const struct rtw_pwr_seq_cmd tran + RTW_PWR_CMD_END, 0, 0}, + }; + +-static const struct rtw_pwr_seq_cmd *card_enable_flow_8723d[] = { ++static const struct rtw_pwr_seq_cmd * const card_enable_flow_8723d[] = { + trans_carddis_to_cardemu_8723d, + trans_cardemu_to_act_8723d, + NULL +@@ -2004,7 +2004,7 @@ static const struct rtw_pwr_seq_cmd tran + RTW_PWR_CMD_END, 0, 0}, + }; + +-static const struct rtw_pwr_seq_cmd *card_disable_flow_8723d[] = { ++static const struct rtw_pwr_seq_cmd * const card_disable_flow_8723d[] = { + trans_act_to_lps_8723d, + trans_act_to_pre_carddis_8723d, + trans_act_to_cardemu_8723d, +--- a/drivers/net/wireless/realtek/rtw88/rtw8821c.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8821c.c +@@ -1254,7 +1254,7 @@ static void rtw8821c_fill_txdesc_checksu + fill_txdesc_checksum_common(txdesc, 16); + } + +-static struct rtw_pwr_seq_cmd trans_carddis_to_cardemu_8821c[] = { ++static const struct rtw_pwr_seq_cmd trans_carddis_to_cardemu_8821c[] = { + {0x0086, + RTW_PWR_CUT_ALL_MSK, + RTW_PWR_INTF_SDIO_MSK, +@@ -1292,7 +1292,7 @@ static struct rtw_pwr_seq_cmd trans_card + RTW_PWR_CMD_END, 0, 0}, + }; + +-static struct rtw_pwr_seq_cmd trans_cardemu_to_act_8821c[] = { ++static const struct rtw_pwr_seq_cmd trans_cardemu_to_act_8821c[] = { + {0x0020, + RTW_PWR_CUT_ALL_MSK, + RTW_PWR_INTF_USB_MSK | RTW_PWR_INTF_SDIO_MSK, +@@ -1396,7 +1396,7 @@ static struct rtw_pwr_seq_cmd trans_card + RTW_PWR_CMD_END, 0, 0}, + }; + +-static struct rtw_pwr_seq_cmd trans_act_to_cardemu_8821c[] = { ++static const struct rtw_pwr_seq_cmd trans_act_to_cardemu_8821c[] = { + {0x0093, + RTW_PWR_CUT_ALL_MSK, + RTW_PWR_INTF_ALL_MSK, +@@ -1454,7 +1454,7 @@ static struct rtw_pwr_seq_cmd trans_act_ + RTW_PWR_CMD_END, 0, 0}, + }; + +-static struct rtw_pwr_seq_cmd trans_cardemu_to_carddis_8821c[] = { ++static const struct rtw_pwr_seq_cmd trans_cardemu_to_carddis_8821c[] = { + {0x0007, + RTW_PWR_CUT_ALL_MSK, + RTW_PWR_INTF_USB_MSK | RTW_PWR_INTF_SDIO_MSK, +@@ -1567,13 +1567,13 @@ static struct rtw_pwr_seq_cmd trans_card + RTW_PWR_CMD_END, 0, 0}, + }; + +-static const struct rtw_pwr_seq_cmd *card_enable_flow_8821c[] = { ++static const struct rtw_pwr_seq_cmd * const card_enable_flow_8821c[] = { + trans_carddis_to_cardemu_8821c, + trans_cardemu_to_act_8821c, + NULL + }; + +-static const struct rtw_pwr_seq_cmd *card_disable_flow_8821c[] = { ++static const struct rtw_pwr_seq_cmd * const card_disable_flow_8821c[] = { + trans_act_to_cardemu_8821c, + trans_cardemu_to_carddis_8821c, + NULL +@@ -1629,7 +1629,7 @@ static const struct rtw_rfe_def rtw8821c + [6] = RTW_DEF_RFE(8821c, 0, 0), + }; + +-static struct rtw_hw_reg rtw8821c_dig[] = { ++static const struct rtw_hw_reg rtw8821c_dig[] = { + [0] = { .addr = 0xc50, .mask = 0x7f }, + }; + +@@ -1639,7 +1639,7 @@ static const struct rtw_ltecoex_addr rtw + .rdata = LTECOEX_READ_DATA, + }; + +-static struct rtw_page_table page_table_8821c[] = { ++static const struct rtw_page_table page_table_8821c[] = { + /* not sure what [0] stands for */ + {16, 16, 16, 14, 1}, + {16, 16, 16, 14, 1}, +@@ -1648,7 +1648,7 @@ static struct rtw_page_table page_table_ + {16, 16, 16, 14, 1}, + }; + +-static struct rtw_rqpn rqpn_table_8821c[] = { ++static const struct rtw_rqpn rqpn_table_8821c[] = { + /* not sure what [0] stands for */ + {RTW_DMA_MAPPING_NORMAL, RTW_DMA_MAPPING_NORMAL, + RTW_DMA_MAPPING_LOW, RTW_DMA_MAPPING_LOW, +@@ -1667,7 +1667,7 @@ static struct rtw_rqpn rqpn_table_8821c[ + RTW_DMA_MAPPING_EXTRA, RTW_DMA_MAPPING_HIGH}, + }; + +-static struct rtw_prioq_addrs prioq_addrs_8821c = { ++static const struct rtw_prioq_addrs prioq_addrs_8821c = { + .prio[RTW_DMA_MAPPING_EXTRA] = { + .rsvd = REG_FIFOPAGE_INFO_4, .avail = REG_FIFOPAGE_INFO_4 + 2, + }, +@@ -1683,7 +1683,7 @@ static struct rtw_prioq_addrs prioq_addr + .wsize = true, + }; + +-static struct rtw_chip_ops rtw8821c_ops = { ++static const struct rtw_chip_ops rtw8821c_ops = { + .phy_set_param = rtw8821c_phy_set_param, + .read_efuse = rtw8821c_read_efuse, + .query_rx_desc = rtw8821c_query_rx_desc, +--- a/drivers/net/wireless/realtek/rtw88/rtw8822b.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8822b.c +@@ -1978,13 +1978,13 @@ static const struct rtw_pwr_seq_cmd tran + RTW_PWR_CMD_END, 0, 0}, + }; + +-static const struct rtw_pwr_seq_cmd *card_enable_flow_8822b[] = { ++static const struct rtw_pwr_seq_cmd * const card_enable_flow_8822b[] = { + trans_carddis_to_cardemu_8822b, + trans_cardemu_to_act_8822b, + NULL + }; + +-static const struct rtw_pwr_seq_cmd *card_disable_flow_8822b[] = { ++static const struct rtw_pwr_seq_cmd * const card_disable_flow_8822b[] = { + trans_act_to_cardemu_8822b, + trans_cardemu_to_carddis_8822b, + NULL +@@ -2156,7 +2156,7 @@ static const struct rtw_rqpn rqpn_table_ + RTW_DMA_MAPPING_EXTRA, RTW_DMA_MAPPING_HIGH}, + }; + +-static struct rtw_prioq_addrs prioq_addrs_8822b = { ++static const struct rtw_prioq_addrs prioq_addrs_8822b = { + .prio[RTW_DMA_MAPPING_EXTRA] = { + .rsvd = REG_FIFOPAGE_INFO_4, .avail = REG_FIFOPAGE_INFO_4 + 2, + }, +@@ -2172,7 +2172,7 @@ static struct rtw_prioq_addrs prioq_addr + .wsize = true, + }; + +-static struct rtw_chip_ops rtw8822b_ops = { ++static const struct rtw_chip_ops rtw8822b_ops = { + .phy_set_param = rtw8822b_phy_set_param, + .read_efuse = rtw8822b_read_efuse, + .query_rx_desc = rtw8822b_query_rx_desc, +@@ -2521,7 +2521,7 @@ static const struct rtw_reg_domain coex_ + {0xc50, MASKBYTE0, RTW_REG_DOMAIN_MAC8}, + }; + +-static struct rtw_hw_reg_offset rtw8822b_edcca_th[] = { ++static const struct rtw_hw_reg_offset rtw8822b_edcca_th[] = { + [EDCCA_TH_L2H_IDX] = {{.addr = 0x8a4, .mask = MASKBYTE0}, .offset = 0}, + [EDCCA_TH_H2L_IDX] = {{.addr = 0x8a4, .mask = MASKBYTE1}, .offset = 0}, + }; +--- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c +@@ -4874,13 +4874,13 @@ static const struct rtw_pwr_seq_cmd tran + RTW_PWR_CMD_END, 0, 0}, + }; + +-static const struct rtw_pwr_seq_cmd *card_enable_flow_8822c[] = { ++static const struct rtw_pwr_seq_cmd * const card_enable_flow_8822c[] = { + trans_carddis_to_cardemu_8822c, + trans_cardemu_to_act_8822c, + NULL + }; + +-static const struct rtw_pwr_seq_cmd *card_disable_flow_8822c[] = { ++static const struct rtw_pwr_seq_cmd * const card_disable_flow_8822c[] = { + trans_act_to_cardemu_8822c, + trans_cardemu_to_carddis_8822c, + NULL +@@ -4972,7 +4972,7 @@ static const struct rtw_rqpn rqpn_table_ + RTW_DMA_MAPPING_EXTRA, RTW_DMA_MAPPING_HIGH}, + }; + +-static struct rtw_prioq_addrs prioq_addrs_8822c = { ++static const struct rtw_prioq_addrs prioq_addrs_8822c = { + .prio[RTW_DMA_MAPPING_EXTRA] = { + .rsvd = REG_FIFOPAGE_INFO_4, .avail = REG_FIFOPAGE_INFO_4 + 2, + }, +@@ -4988,7 +4988,7 @@ static struct rtw_prioq_addrs prioq_addr + .wsize = true, + }; + +-static struct rtw_chip_ops rtw8822c_ops = { ++static const struct rtw_chip_ops rtw8822c_ops = { + .phy_set_param = rtw8822c_phy_set_param, + .read_efuse = rtw8822c_read_efuse, + .query_rx_desc = rtw8822c_query_rx_desc, +@@ -5301,7 +5301,7 @@ static const struct rtw_pwr_track_tbl rt + .pwrtrk_2g_ccka_p = rtw8822c_pwrtrk_2g_cck_a_p, + }; + +-static struct rtw_hw_reg_offset rtw8822c_edcca_th[] = { ++static const struct rtw_hw_reg_offset rtw8822c_edcca_th[] = { + [EDCCA_TH_L2H_IDX] = { + {.addr = 0x84c, .mask = MASKBYTE2}, .offset = 0x80 + }, diff --git a/package/kernel/mac80211/patches/rtl/019-v6.13-wifi-rtw88-Parse-the-RX-descriptor-with-a-single-fun.patch b/package/kernel/mac80211/patches/rtl/019-v6.13-wifi-rtw88-Parse-the-RX-descriptor-with-a-single-fun.patch new file mode 100644 index 00000000000000..9828f507b643eb --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/019-v6.13-wifi-rtw88-Parse-the-RX-descriptor-with-a-single-fun.patch @@ -0,0 +1,560 @@ +From bbb6f9be7f99464d5ab7e2f321fa728d33eeec9a Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Fri, 20 Sep 2024 22:27:30 +0300 +Subject: [PATCH] wifi: rtw88: Parse the RX descriptor with a single function + +rtw8703b_query_rx_desc(), rtw8723d_query_rx_desc(), +rtw8821c_query_rx_desc(), rtw8822b_query_rx_desc(), and +rtw8822c_query_rx_desc() are almost identical, so replace them all with +a single function, rtw_rx_query_rx_desc(). + +Also, access the RX descriptor using a struct with __le32 members and +le32_get_bits(). + +Tested with RTL8811CU, RTL8811AU, and RTL8812AU. + +Signed-off-by: Bitterblue Smith +Tested-by: Ping-Ke Shih # RTL8723DE and RTL8822CE +Acked-by: Ping-Ke Shih +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/913f1747-38fc-4409-85a4-57bb9cee506b@gmail.com +--- + drivers/net/wireless/realtek/rtw88/main.h | 5 +- + drivers/net/wireless/realtek/rtw88/pci.c | 2 +- + drivers/net/wireless/realtek/rtw88/rtw8703b.c | 56 +-------------- + drivers/net/wireless/realtek/rtw88/rtw8723d.c | 43 +----------- + drivers/net/wireless/realtek/rtw88/rtw8821c.c | 43 +----------- + drivers/net/wireless/realtek/rtw88/rtw8822b.c | 43 +----------- + drivers/net/wireless/realtek/rtw88/rtw8822c.c | 44 +----------- + drivers/net/wireless/realtek/rtw88/rx.c | 70 +++++++++++++++++-- + drivers/net/wireless/realtek/rtw88/rx.h | 64 ++++++++--------- + drivers/net/wireless/realtek/rtw88/sdio.c | 3 +- + drivers/net/wireless/realtek/rtw88/usb.c | 4 +- + 11 files changed, 106 insertions(+), 271 deletions(-) + +--- a/drivers/net/wireless/realtek/rtw88/main.h ++++ b/drivers/net/wireless/realtek/rtw88/main.h +@@ -848,9 +848,8 @@ struct rtw_chip_ops { + void (*phy_set_param)(struct rtw_dev *rtwdev); + void (*set_channel)(struct rtw_dev *rtwdev, u8 channel, + u8 bandwidth, u8 primary_chan_idx); +- void (*query_rx_desc)(struct rtw_dev *rtwdev, u8 *rx_desc, +- struct rtw_rx_pkt_stat *pkt_stat, +- struct ieee80211_rx_status *rx_status); ++ void (*query_phy_status)(struct rtw_dev *rtwdev, u8 *phy_status, ++ struct rtw_rx_pkt_stat *pkt_stat); + u32 (*read_rf)(struct rtw_dev *rtwdev, enum rtw_rf_path rf_path, + u32 addr, u32 mask); + bool (*write_rf)(struct rtw_dev *rtwdev, enum rtw_rf_path rf_path, +--- a/drivers/net/wireless/realtek/rtw88/pci.c ++++ b/drivers/net/wireless/realtek/rtw88/pci.c +@@ -1065,7 +1065,7 @@ static u32 rtw_pci_rx_napi(struct rtw_de + dma_sync_single_for_cpu(rtwdev->dev, dma, RTK_PCI_RX_BUF_SIZE, + DMA_FROM_DEVICE); + rx_desc = skb->data; +- chip->ops->query_rx_desc(rtwdev, rx_desc, &pkt_stat, &rx_status); ++ rtw_rx_query_rx_desc(rtwdev, rx_desc, &pkt_stat, &rx_status); + + /* offset from rx_desc to payload */ + pkt_offset = pkt_desc_sz + pkt_stat.drv_info_sz + +--- a/drivers/net/wireless/realtek/rtw88/rtw8703b.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8703b.c +@@ -29,9 +29,6 @@ + #define TBTT_PROHIBIT_HOLD_TIME 0x80 + #define TBTT_PROHIBIT_HOLD_TIME_STOP_BCN 0x64 + +-/* raw pkt_stat->drv_info_sz is in unit of 8-bytes */ +-#define RX_DRV_INFO_SZ_UNIT_8703B 8 +- + #define TRANS_SEQ_END \ + 0xFFFF, \ + RTW_PWR_CUT_ALL_MSK, \ +@@ -1032,57 +1029,6 @@ static void query_phy_status(struct rtw_ + query_phy_status_ofdm(rtwdev, phy_status, pkt_stat); + } + +-static void rtw8703b_query_rx_desc(struct rtw_dev *rtwdev, u8 *rx_desc, +- struct rtw_rx_pkt_stat *pkt_stat, +- struct ieee80211_rx_status *rx_status) +-{ +- struct ieee80211_hdr *hdr; +- u32 desc_sz = rtwdev->chip->rx_pkt_desc_sz; +- u8 *phy_status = NULL; +- +- memset(pkt_stat, 0, sizeof(*pkt_stat)); +- +- pkt_stat->phy_status = GET_RX_DESC_PHYST(rx_desc); +- pkt_stat->icv_err = GET_RX_DESC_ICV_ERR(rx_desc); +- pkt_stat->crc_err = GET_RX_DESC_CRC32(rx_desc); +- pkt_stat->decrypted = !GET_RX_DESC_SWDEC(rx_desc) && +- GET_RX_DESC_ENC_TYPE(rx_desc) != RX_DESC_ENC_NONE; +- pkt_stat->is_c2h = GET_RX_DESC_C2H(rx_desc); +- pkt_stat->pkt_len = GET_RX_DESC_PKT_LEN(rx_desc); +- pkt_stat->drv_info_sz = GET_RX_DESC_DRV_INFO_SIZE(rx_desc); +- pkt_stat->shift = GET_RX_DESC_SHIFT(rx_desc); +- pkt_stat->rate = GET_RX_DESC_RX_RATE(rx_desc); +- pkt_stat->cam_id = GET_RX_DESC_MACID(rx_desc); +- pkt_stat->ppdu_cnt = 0; +- pkt_stat->tsf_low = GET_RX_DESC_TSFL(rx_desc); +- +- pkt_stat->drv_info_sz *= RX_DRV_INFO_SZ_UNIT_8703B; +- +- if (pkt_stat->is_c2h) +- return; +- +- hdr = (struct ieee80211_hdr *)(rx_desc + desc_sz + pkt_stat->shift + +- pkt_stat->drv_info_sz); +- +- pkt_stat->bw = GET_RX_DESC_BW(rx_desc); +- +- if (pkt_stat->phy_status) { +- phy_status = rx_desc + desc_sz + pkt_stat->shift; +- query_phy_status(rtwdev, phy_status, pkt_stat); +- } +- +- rtw_rx_fill_rx_status(rtwdev, pkt_stat, hdr, rx_status, phy_status); +- +- /* Rtl8723cs driver checks for size < 14 or size > 8192 and +- * simply drops the packet. Maybe this should go into +- * rtw_rx_fill_rx_status()? +- */ +- if (pkt_stat->pkt_len == 0) { +- rx_status->flag |= RX_FLAG_NO_PSDU; +- rtw_dbg(rtwdev, RTW_DBG_RX, "zero length packet"); +- } +-} +- + #define ADDA_ON_VAL_8703B 0x03c00014 + + static +@@ -1948,7 +1894,7 @@ static const struct rtw_chip_ops rtw8703 + .read_efuse = rtw8703b_read_efuse, + .phy_set_param = rtw8703b_phy_set_param, + .set_channel = rtw8703b_set_channel, +- .query_rx_desc = rtw8703b_query_rx_desc, ++ .query_phy_status = query_phy_status, + .read_rf = rtw_phy_read_rf_sipi, + .write_rf = rtw_phy_write_rf_reg_sipi, + .set_tx_power_index = rtw8723x_set_tx_power_index, +--- a/drivers/net/wireless/realtek/rtw88/rtw8723d.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8723d.c +@@ -227,47 +227,6 @@ static void query_phy_status(struct rtw_ + } + } + +-static void rtw8723d_query_rx_desc(struct rtw_dev *rtwdev, u8 *rx_desc, +- struct rtw_rx_pkt_stat *pkt_stat, +- struct ieee80211_rx_status *rx_status) +-{ +- struct ieee80211_hdr *hdr; +- u32 desc_sz = rtwdev->chip->rx_pkt_desc_sz; +- u8 *phy_status = NULL; +- +- memset(pkt_stat, 0, sizeof(*pkt_stat)); +- +- pkt_stat->phy_status = GET_RX_DESC_PHYST(rx_desc); +- pkt_stat->icv_err = GET_RX_DESC_ICV_ERR(rx_desc); +- pkt_stat->crc_err = GET_RX_DESC_CRC32(rx_desc); +- pkt_stat->decrypted = !GET_RX_DESC_SWDEC(rx_desc) && +- GET_RX_DESC_ENC_TYPE(rx_desc) != RX_DESC_ENC_NONE; +- pkt_stat->is_c2h = GET_RX_DESC_C2H(rx_desc); +- pkt_stat->pkt_len = GET_RX_DESC_PKT_LEN(rx_desc); +- pkt_stat->drv_info_sz = GET_RX_DESC_DRV_INFO_SIZE(rx_desc); +- pkt_stat->shift = GET_RX_DESC_SHIFT(rx_desc); +- pkt_stat->rate = GET_RX_DESC_RX_RATE(rx_desc); +- pkt_stat->cam_id = GET_RX_DESC_MACID(rx_desc); +- pkt_stat->ppdu_cnt = 0; +- pkt_stat->tsf_low = GET_RX_DESC_TSFL(rx_desc); +- +- /* drv_info_sz is in unit of 8-bytes */ +- pkt_stat->drv_info_sz *= 8; +- +- /* c2h cmd pkt's rx/phy status is not interested */ +- if (pkt_stat->is_c2h) +- return; +- +- hdr = (struct ieee80211_hdr *)(rx_desc + desc_sz + pkt_stat->shift + +- pkt_stat->drv_info_sz); +- if (pkt_stat->phy_status) { +- phy_status = rx_desc + desc_sz + pkt_stat->shift; +- query_phy_status(rtwdev, phy_status, pkt_stat); +- } +- +- rtw_rx_fill_rx_status(rtwdev, pkt_stat, hdr, rx_status, phy_status); +-} +- + static bool rtw8723d_check_spur_ov_thres(struct rtw_dev *rtwdev, + u8 channel, u32 thres) + { +@@ -1433,7 +1392,7 @@ static void rtw8723d_pwr_track(struct rt + static const struct rtw_chip_ops rtw8723d_ops = { + .phy_set_param = rtw8723d_phy_set_param, + .read_efuse = rtw8723x_read_efuse, +- .query_rx_desc = rtw8723d_query_rx_desc, ++ .query_phy_status = query_phy_status, + .set_channel = rtw8723d_set_channel, + .mac_init = rtw8723x_mac_init, + .shutdown = rtw8723d_shutdown, +--- a/drivers/net/wireless/realtek/rtw88/rtw8821c.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8821c.c +@@ -679,47 +679,6 @@ static void query_phy_status(struct rtw_ + } + } + +-static void rtw8821c_query_rx_desc(struct rtw_dev *rtwdev, u8 *rx_desc, +- struct rtw_rx_pkt_stat *pkt_stat, +- struct ieee80211_rx_status *rx_status) +-{ +- struct ieee80211_hdr *hdr; +- u32 desc_sz = rtwdev->chip->rx_pkt_desc_sz; +- u8 *phy_status = NULL; +- +- memset(pkt_stat, 0, sizeof(*pkt_stat)); +- +- pkt_stat->phy_status = GET_RX_DESC_PHYST(rx_desc); +- pkt_stat->icv_err = GET_RX_DESC_ICV_ERR(rx_desc); +- pkt_stat->crc_err = GET_RX_DESC_CRC32(rx_desc); +- pkt_stat->decrypted = !GET_RX_DESC_SWDEC(rx_desc) && +- GET_RX_DESC_ENC_TYPE(rx_desc) != RX_DESC_ENC_NONE; +- pkt_stat->is_c2h = GET_RX_DESC_C2H(rx_desc); +- pkt_stat->pkt_len = GET_RX_DESC_PKT_LEN(rx_desc); +- pkt_stat->drv_info_sz = GET_RX_DESC_DRV_INFO_SIZE(rx_desc); +- pkt_stat->shift = GET_RX_DESC_SHIFT(rx_desc); +- pkt_stat->rate = GET_RX_DESC_RX_RATE(rx_desc); +- pkt_stat->cam_id = GET_RX_DESC_MACID(rx_desc); +- pkt_stat->ppdu_cnt = GET_RX_DESC_PPDU_CNT(rx_desc); +- pkt_stat->tsf_low = GET_RX_DESC_TSFL(rx_desc); +- +- /* drv_info_sz is in unit of 8-bytes */ +- pkt_stat->drv_info_sz *= 8; +- +- /* c2h cmd pkt's rx/phy status is not interested */ +- if (pkt_stat->is_c2h) +- return; +- +- hdr = (struct ieee80211_hdr *)(rx_desc + desc_sz + pkt_stat->shift + +- pkt_stat->drv_info_sz); +- if (pkt_stat->phy_status) { +- phy_status = rx_desc + desc_sz + pkt_stat->shift; +- query_phy_status(rtwdev, phy_status, pkt_stat); +- } +- +- rtw_rx_fill_rx_status(rtwdev, pkt_stat, hdr, rx_status, phy_status); +-} +- + static void + rtw8821c_set_tx_power_index_by_rate(struct rtw_dev *rtwdev, u8 path, u8 rs) + { +@@ -1686,7 +1645,7 @@ static const struct rtw_prioq_addrs prio + static const struct rtw_chip_ops rtw8821c_ops = { + .phy_set_param = rtw8821c_phy_set_param, + .read_efuse = rtw8821c_read_efuse, +- .query_rx_desc = rtw8821c_query_rx_desc, ++ .query_phy_status = query_phy_status, + .set_channel = rtw8821c_set_channel, + .mac_init = rtw8821c_mac_init, + .read_rf = rtw_phy_read_rf, +--- a/drivers/net/wireless/realtek/rtw88/rtw8822b.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8822b.c +@@ -934,47 +934,6 @@ static void query_phy_status(struct rtw_ + } + } + +-static void rtw8822b_query_rx_desc(struct rtw_dev *rtwdev, u8 *rx_desc, +- struct rtw_rx_pkt_stat *pkt_stat, +- struct ieee80211_rx_status *rx_status) +-{ +- struct ieee80211_hdr *hdr; +- u32 desc_sz = rtwdev->chip->rx_pkt_desc_sz; +- u8 *phy_status = NULL; +- +- memset(pkt_stat, 0, sizeof(*pkt_stat)); +- +- pkt_stat->phy_status = GET_RX_DESC_PHYST(rx_desc); +- pkt_stat->icv_err = GET_RX_DESC_ICV_ERR(rx_desc); +- pkt_stat->crc_err = GET_RX_DESC_CRC32(rx_desc); +- pkt_stat->decrypted = !GET_RX_DESC_SWDEC(rx_desc) && +- GET_RX_DESC_ENC_TYPE(rx_desc) != RX_DESC_ENC_NONE; +- pkt_stat->is_c2h = GET_RX_DESC_C2H(rx_desc); +- pkt_stat->pkt_len = GET_RX_DESC_PKT_LEN(rx_desc); +- pkt_stat->drv_info_sz = GET_RX_DESC_DRV_INFO_SIZE(rx_desc); +- pkt_stat->shift = GET_RX_DESC_SHIFT(rx_desc); +- pkt_stat->rate = GET_RX_DESC_RX_RATE(rx_desc); +- pkt_stat->cam_id = GET_RX_DESC_MACID(rx_desc); +- pkt_stat->ppdu_cnt = GET_RX_DESC_PPDU_CNT(rx_desc); +- pkt_stat->tsf_low = GET_RX_DESC_TSFL(rx_desc); +- +- /* drv_info_sz is in unit of 8-bytes */ +- pkt_stat->drv_info_sz *= 8; +- +- /* c2h cmd pkt's rx/phy status is not interested */ +- if (pkt_stat->is_c2h) +- return; +- +- hdr = (struct ieee80211_hdr *)(rx_desc + desc_sz + pkt_stat->shift + +- pkt_stat->drv_info_sz); +- if (pkt_stat->phy_status) { +- phy_status = rx_desc + desc_sz + pkt_stat->shift; +- query_phy_status(rtwdev, phy_status, pkt_stat); +- } +- +- rtw_rx_fill_rx_status(rtwdev, pkt_stat, hdr, rx_status, phy_status); +-} +- + static void + rtw8822b_set_tx_power_index_by_rate(struct rtw_dev *rtwdev, u8 path, u8 rs) + { +@@ -2175,7 +2134,7 @@ static const struct rtw_prioq_addrs prio + static const struct rtw_chip_ops rtw8822b_ops = { + .phy_set_param = rtw8822b_phy_set_param, + .read_efuse = rtw8822b_read_efuse, +- .query_rx_desc = rtw8822b_query_rx_desc, ++ .query_phy_status = query_phy_status, + .set_channel = rtw8822b_set_channel, + .mac_init = rtw8822b_mac_init, + .read_rf = rtw_phy_read_rf, +--- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c +@@ -2690,48 +2690,6 @@ static void query_phy_status(struct rtw_ + } + } + +-static void rtw8822c_query_rx_desc(struct rtw_dev *rtwdev, u8 *rx_desc, +- struct rtw_rx_pkt_stat *pkt_stat, +- struct ieee80211_rx_status *rx_status) +-{ +- struct ieee80211_hdr *hdr; +- u32 desc_sz = rtwdev->chip->rx_pkt_desc_sz; +- u8 *phy_status = NULL; +- +- memset(pkt_stat, 0, sizeof(*pkt_stat)); +- +- pkt_stat->phy_status = GET_RX_DESC_PHYST(rx_desc); +- pkt_stat->icv_err = GET_RX_DESC_ICV_ERR(rx_desc); +- pkt_stat->crc_err = GET_RX_DESC_CRC32(rx_desc); +- pkt_stat->decrypted = !GET_RX_DESC_SWDEC(rx_desc) && +- GET_RX_DESC_ENC_TYPE(rx_desc) != RX_DESC_ENC_NONE; +- pkt_stat->is_c2h = GET_RX_DESC_C2H(rx_desc); +- pkt_stat->pkt_len = GET_RX_DESC_PKT_LEN(rx_desc); +- pkt_stat->drv_info_sz = GET_RX_DESC_DRV_INFO_SIZE(rx_desc); +- pkt_stat->shift = GET_RX_DESC_SHIFT(rx_desc); +- pkt_stat->rate = GET_RX_DESC_RX_RATE(rx_desc); +- pkt_stat->cam_id = GET_RX_DESC_MACID(rx_desc); +- pkt_stat->ppdu_cnt = GET_RX_DESC_PPDU_CNT(rx_desc); +- pkt_stat->tsf_low = GET_RX_DESC_TSFL(rx_desc); +- +- /* drv_info_sz is in unit of 8-bytes */ +- pkt_stat->drv_info_sz *= 8; +- +- /* c2h cmd pkt's rx/phy status is not interested */ +- if (pkt_stat->is_c2h) +- return; +- +- hdr = (struct ieee80211_hdr *)(rx_desc + desc_sz + pkt_stat->shift + +- pkt_stat->drv_info_sz); +- pkt_stat->hdr = hdr; +- if (pkt_stat->phy_status) { +- phy_status = rx_desc + desc_sz + pkt_stat->shift; +- query_phy_status(rtwdev, phy_status, pkt_stat); +- } +- +- rtw_rx_fill_rx_status(rtwdev, pkt_stat, hdr, rx_status, phy_status); +-} +- + static void + rtw8822c_set_write_tx_power_ref(struct rtw_dev *rtwdev, u8 *tx_pwr_ref_cck, + u8 *tx_pwr_ref_ofdm) +@@ -4991,7 +4949,7 @@ static const struct rtw_prioq_addrs prio + static const struct rtw_chip_ops rtw8822c_ops = { + .phy_set_param = rtw8822c_phy_set_param, + .read_efuse = rtw8822c_read_efuse, +- .query_rx_desc = rtw8822c_query_rx_desc, ++ .query_phy_status = query_phy_status, + .set_channel = rtw8822c_set_channel, + .mac_init = rtw8822c_mac_init, + .dump_fw_crash = rtw8822c_dump_fw_crash, +--- a/drivers/net/wireless/realtek/rtw88/rx.c ++++ b/drivers/net/wireless/realtek/rtw88/rx.c +@@ -187,11 +187,10 @@ fill_rx_status: + } + EXPORT_SYMBOL(rtw_update_rx_freq_from_ie); + +-void rtw_rx_fill_rx_status(struct rtw_dev *rtwdev, +- struct rtw_rx_pkt_stat *pkt_stat, +- struct ieee80211_hdr *hdr, +- struct ieee80211_rx_status *rx_status, +- u8 *phy_status) ++static void rtw_rx_fill_rx_status(struct rtw_dev *rtwdev, ++ struct rtw_rx_pkt_stat *pkt_stat, ++ struct ieee80211_hdr *hdr, ++ struct ieee80211_rx_status *rx_status) + { + struct ieee80211_hw *hw = rtwdev->hw; + u8 path; +@@ -242,5 +241,64 @@ void rtw_rx_fill_rx_status(struct rtw_de + } + + rtw_rx_addr_match(rtwdev, pkt_stat, hdr); ++ ++ /* Rtl8723cs driver checks for size < 14 or size > 8192 and ++ * simply drops the packet. ++ */ ++ if (rtwdev->chip->id == RTW_CHIP_TYPE_8703B && pkt_stat->pkt_len == 0) { ++ rx_status->flag |= RX_FLAG_NO_PSDU; ++ rtw_dbg(rtwdev, RTW_DBG_RX, "zero length packet"); ++ } ++} ++ ++void rtw_rx_query_rx_desc(struct rtw_dev *rtwdev, void *rx_desc8, ++ struct rtw_rx_pkt_stat *pkt_stat, ++ struct ieee80211_rx_status *rx_status) ++{ ++ u32 desc_sz = rtwdev->chip->rx_pkt_desc_sz; ++ struct rtw_rx_desc *rx_desc = rx_desc8; ++ struct ieee80211_hdr *hdr; ++ u32 enc_type, swdec; ++ void *phy_status; ++ ++ memset(pkt_stat, 0, sizeof(*pkt_stat)); ++ ++ pkt_stat->pkt_len = le32_get_bits(rx_desc->w0, RTW_RX_DESC_W0_PKT_LEN); ++ pkt_stat->crc_err = le32_get_bits(rx_desc->w0, RTW_RX_DESC_W0_CRC32); ++ pkt_stat->icv_err = le32_get_bits(rx_desc->w0, RTW_RX_DESC_W0_ICV_ERR); ++ pkt_stat->drv_info_sz = le32_get_bits(rx_desc->w0, ++ RTW_RX_DESC_W0_DRV_INFO_SIZE); ++ enc_type = le32_get_bits(rx_desc->w0, RTW_RX_DESC_W0_ENC_TYPE); ++ pkt_stat->shift = le32_get_bits(rx_desc->w0, RTW_RX_DESC_W0_SHIFT); ++ pkt_stat->phy_status = le32_get_bits(rx_desc->w0, RTW_RX_DESC_W0_PHYST); ++ swdec = le32_get_bits(rx_desc->w0, RTW_RX_DESC_W0_SWDEC); ++ pkt_stat->decrypted = !swdec && enc_type != RX_DESC_ENC_NONE; ++ ++ pkt_stat->cam_id = le32_get_bits(rx_desc->w1, RTW_RX_DESC_W1_MACID); ++ ++ pkt_stat->is_c2h = le32_get_bits(rx_desc->w2, RTW_RX_DESC_W2_C2H); ++ pkt_stat->ppdu_cnt = le32_get_bits(rx_desc->w2, RTW_RX_DESC_W2_PPDU_CNT); ++ ++ pkt_stat->rate = le32_get_bits(rx_desc->w3, RTW_RX_DESC_W3_RX_RATE); ++ ++ pkt_stat->bw = le32_get_bits(rx_desc->w4, RTW_RX_DESC_W4_BW); ++ ++ pkt_stat->tsf_low = le32_get_bits(rx_desc->w5, RTW_RX_DESC_W5_TSFL); ++ ++ /* drv_info_sz is in unit of 8-bytes */ ++ pkt_stat->drv_info_sz *= 8; ++ ++ /* c2h cmd pkt's rx/phy status is not interested */ ++ if (pkt_stat->is_c2h) ++ return; ++ ++ phy_status = rx_desc8 + desc_sz + pkt_stat->shift; ++ hdr = phy_status + pkt_stat->drv_info_sz; ++ pkt_stat->hdr = hdr; ++ ++ if (pkt_stat->phy_status) ++ rtwdev->chip->ops->query_phy_status(rtwdev, phy_status, pkt_stat); ++ ++ rtw_rx_fill_rx_status(rtwdev, pkt_stat, hdr, rx_status); + } +-EXPORT_SYMBOL(rtw_rx_fill_rx_status); ++EXPORT_SYMBOL(rtw_rx_query_rx_desc); +--- a/drivers/net/wireless/realtek/rtw88/rx.h ++++ b/drivers/net/wireless/realtek/rtw88/rx.h +@@ -14,42 +14,40 @@ enum rtw_rx_desc_enc { + RX_DESC_ENC_WEP104 = 5, + }; + +-#define GET_RX_DESC_PHYST(rxdesc) \ +- le32_get_bits(*((__le32 *)(rxdesc) + 0x00), BIT(26)) +-#define GET_RX_DESC_ICV_ERR(rxdesc) \ +- le32_get_bits(*((__le32 *)(rxdesc) + 0x00), BIT(15)) +-#define GET_RX_DESC_CRC32(rxdesc) \ +- le32_get_bits(*((__le32 *)(rxdesc) + 0x00), BIT(14)) +-#define GET_RX_DESC_SWDEC(rxdesc) \ +- le32_get_bits(*((__le32 *)(rxdesc) + 0x00), BIT(27)) +-#define GET_RX_DESC_C2H(rxdesc) \ +- le32_get_bits(*((__le32 *)(rxdesc) + 0x02), BIT(28)) +-#define GET_RX_DESC_PKT_LEN(rxdesc) \ +- le32_get_bits(*((__le32 *)(rxdesc) + 0x00), GENMASK(13, 0)) +-#define GET_RX_DESC_DRV_INFO_SIZE(rxdesc) \ +- le32_get_bits(*((__le32 *)(rxdesc) + 0x00), GENMASK(19, 16)) +-#define GET_RX_DESC_SHIFT(rxdesc) \ +- le32_get_bits(*((__le32 *)(rxdesc) + 0x00), GENMASK(25, 24)) +-#define GET_RX_DESC_ENC_TYPE(rxdesc) \ +- le32_get_bits(*((__le32 *)(rxdesc) + 0x00), GENMASK(22, 20)) +-#define GET_RX_DESC_RX_RATE(rxdesc) \ +- le32_get_bits(*((__le32 *)(rxdesc) + 0x03), GENMASK(6, 0)) +-#define GET_RX_DESC_MACID(rxdesc) \ +- le32_get_bits(*((__le32 *)(rxdesc) + 0x01), GENMASK(6, 0)) +-#define GET_RX_DESC_PPDU_CNT(rxdesc) \ +- le32_get_bits(*((__le32 *)(rxdesc) + 0x02), GENMASK(30, 29)) +-#define GET_RX_DESC_TSFL(rxdesc) \ +- le32_get_bits(*((__le32 *)(rxdesc) + 0x05), GENMASK(31, 0)) +-#define GET_RX_DESC_BW(rxdesc) \ +- (le32_get_bits(*((__le32 *)(rxdesc) + 0x04), GENMASK(5, 4))) ++struct rtw_rx_desc { ++ __le32 w0; ++ __le32 w1; ++ __le32 w2; ++ __le32 w3; ++ __le32 w4; ++ __le32 w5; ++} __packed; ++ ++#define RTW_RX_DESC_W0_PKT_LEN GENMASK(13, 0) ++#define RTW_RX_DESC_W0_CRC32 BIT(14) ++#define RTW_RX_DESC_W0_ICV_ERR BIT(15) ++#define RTW_RX_DESC_W0_DRV_INFO_SIZE GENMASK(19, 16) ++#define RTW_RX_DESC_W0_ENC_TYPE GENMASK(22, 20) ++#define RTW_RX_DESC_W0_SHIFT GENMASK(25, 24) ++#define RTW_RX_DESC_W0_PHYST BIT(26) ++#define RTW_RX_DESC_W0_SWDEC BIT(27) ++ ++#define RTW_RX_DESC_W1_MACID GENMASK(6, 0) ++ ++#define RTW_RX_DESC_W2_C2H BIT(28) ++#define RTW_RX_DESC_W2_PPDU_CNT GENMASK(30, 29) ++ ++#define RTW_RX_DESC_W3_RX_RATE GENMASK(6, 0) ++ ++#define RTW_RX_DESC_W4_BW GENMASK(5, 4) ++ ++#define RTW_RX_DESC_W5_TSFL GENMASK(31, 0) + + void rtw_rx_stats(struct rtw_dev *rtwdev, struct ieee80211_vif *vif, + struct sk_buff *skb); +-void rtw_rx_fill_rx_status(struct rtw_dev *rtwdev, +- struct rtw_rx_pkt_stat *pkt_stat, +- struct ieee80211_hdr *hdr, +- struct ieee80211_rx_status *rx_status, +- u8 *phy_status); ++void rtw_rx_query_rx_desc(struct rtw_dev *rtwdev, void *rx_desc8, ++ struct rtw_rx_pkt_stat *pkt_stat, ++ struct ieee80211_rx_status *rx_status); + void rtw_update_rx_freq_from_ie(struct rtw_dev *rtwdev, struct sk_buff *skb, + struct ieee80211_rx_status *rx_status, + struct rtw_rx_pkt_stat *pkt_stat); +--- a/drivers/net/wireless/realtek/rtw88/sdio.c ++++ b/drivers/net/wireless/realtek/rtw88/sdio.c +@@ -981,8 +981,7 @@ static void rtw_sdio_rxfifo_recv(struct + + while (true) { + rx_desc = skb->data; +- chip->ops->query_rx_desc(rtwdev, rx_desc, &pkt_stat, +- &rx_status); ++ rtw_rx_query_rx_desc(rtwdev, rx_desc, &pkt_stat, &rx_status); + pkt_offset = pkt_desc_sz + pkt_stat.drv_info_sz + + pkt_stat.shift; + +--- a/drivers/net/wireless/realtek/rtw88/usb.c ++++ b/drivers/net/wireless/realtek/rtw88/usb.c +@@ -570,8 +570,8 @@ static void rtw_usb_rx_handler(struct wo + + do { + rx_desc = skb->data; +- chip->ops->query_rx_desc(rtwdev, rx_desc, &pkt_stat, +- &rx_status); ++ rtw_rx_query_rx_desc(rtwdev, rx_desc, &pkt_stat, ++ &rx_status); + pkt_offset = pkt_desc_sz + pkt_stat.drv_info_sz + + pkt_stat.shift; + diff --git a/package/kernel/mac80211/patches/rtl/020-v6.12-wifi-rtw88-Fix-the-RX-aggregation-in-USB-3-mode.patch b/package/kernel/mac80211/patches/rtl/020-v6.12-wifi-rtw88-Fix-the-RX-aggregation-in-USB-3-mode.patch new file mode 100644 index 00000000000000..174ee10816e6a3 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/020-v6.12-wifi-rtw88-Fix-the-RX-aggregation-in-USB-3-mode.patch @@ -0,0 +1,70 @@ +From 4aefde403da7af30757915e0462d88398c9388c5 Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Tue, 8 Oct 2024 21:44:02 +0300 +Subject: [PATCH] wifi: rtw88: Fix the RX aggregation in USB 3 mode + +RTL8822CU, RTL8822BU, and RTL8821CU don't need BIT_EN_PRE_CALC. +In fact, RTL8822BU in USB 3 mode doesn't pass all the frames to the +driver, resulting in much lower download speed than normal: + +$ iperf3 -c 192.168.0.1 -R +Connecting to host 192.168.0.1, port 5201 +Reverse mode, remote host 192.168.0.1 is sending +[ 5] local 192.168.0.50 port 43062 connected to 192.168.0.1 port 5201 +[ ID] Interval Transfer Bitrate +[ 5] 0.00-1.00 sec 26.9 MBytes 225 Mbits/sec +[ 5] 1.00-2.00 sec 7.50 MBytes 62.9 Mbits/sec +[ 5] 2.00-3.00 sec 8.50 MBytes 71.3 Mbits/sec +[ 5] 3.00-4.00 sec 8.38 MBytes 70.3 Mbits/sec +[ 5] 4.00-5.00 sec 7.75 MBytes 65.0 Mbits/sec +[ 5] 5.00-6.00 sec 8.00 MBytes 67.1 Mbits/sec +[ 5] 6.00-7.00 sec 8.00 MBytes 67.1 Mbits/sec +[ 5] 7.00-8.00 sec 7.75 MBytes 65.0 Mbits/sec +[ 5] 8.00-9.00 sec 7.88 MBytes 66.1 Mbits/sec +[ 5] 9.00-10.00 sec 7.88 MBytes 66.1 Mbits/sec +- - - - - - - - - - - - - - - - - - - - - - - - - +[ ID] Interval Transfer Bitrate Retr +[ 5] 0.00-10.02 sec 102 MBytes 85.1 Mbits/sec 224 sender +[ 5] 0.00-10.00 sec 98.6 MBytes 82.7 Mbits/sec receiver + +Don't set BIT_EN_PRE_CALC. Then the speed is much better: + +% iperf3 -c 192.168.0.1 -R +Connecting to host 192.168.0.1, port 5201 +Reverse mode, remote host 192.168.0.1 is sending +[ 5] local 192.168.0.50 port 39000 connected to 192.168.0.1 port 5201 +[ ID] Interval Transfer Bitrate +[ 5] 0.00-1.00 sec 52.8 MBytes 442 Mbits/sec +[ 5] 1.00-2.00 sec 71.9 MBytes 603 Mbits/sec +[ 5] 2.00-3.00 sec 74.8 MBytes 627 Mbits/sec +[ 5] 3.00-4.00 sec 75.9 MBytes 636 Mbits/sec +[ 5] 4.00-5.00 sec 76.0 MBytes 638 Mbits/sec +[ 5] 5.00-6.00 sec 74.1 MBytes 622 Mbits/sec +[ 5] 6.00-7.00 sec 74.0 MBytes 621 Mbits/sec +[ 5] 7.00-8.00 sec 76.0 MBytes 638 Mbits/sec +[ 5] 8.00-9.00 sec 74.4 MBytes 624 Mbits/sec +[ 5] 9.00-10.00 sec 63.9 MBytes 536 Mbits/sec +- - - - - - - - - - - - - - - - - - - - - - - - - +[ ID] Interval Transfer Bitrate Retr +[ 5] 0.00-10.00 sec 717 MBytes 601 Mbits/sec 24 sender +[ 5] 0.00-10.00 sec 714 MBytes 599 Mbits/sec receiver + +Fixes: 002a5db9a52a ("wifi: rtw88: Enable USB RX aggregation for 8822c/8822b/8821c") +Signed-off-by: Bitterblue Smith +Acked-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://patch.msgid.link/afb94a82-3d18-459e-97fc-1a217608cdf0@gmail.com +--- + drivers/net/wireless/realtek/rtw88/usb.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/net/wireless/realtek/rtw88/usb.c ++++ b/drivers/net/wireless/realtek/rtw88/usb.c +@@ -771,7 +771,6 @@ static void rtw_usb_dynamic_rx_agg_v1(st + u8 size, timeout; + u16 val16; + +- rtw_write32_set(rtwdev, REG_RXDMA_AGG_PG_TH, BIT_EN_PRE_CALC); + rtw_write8_set(rtwdev, REG_TXDMA_PQ_MAP, BIT_RXDMA_AGG_EN); + rtw_write8_clr(rtwdev, REG_RXDMA_AGG_PG_TH + 3, BIT(7)); + diff --git a/package/kernel/mac80211/patches/rtl/022-v6.13-wifi-rtw88-Refactor-looping-in-rtw_phy_store_tx_powe.patch b/package/kernel/mac80211/patches/rtl/022-v6.13-wifi-rtw88-Refactor-looping-in-rtw_phy_store_tx_powe.patch new file mode 100644 index 00000000000000..4f019617d4799f --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/022-v6.13-wifi-rtw88-Refactor-looping-in-rtw_phy_store_tx_powe.patch @@ -0,0 +1,34 @@ +From 7846f0b63562f4db45f712cc7dab091985baf07b Mon Sep 17 00:00:00 2001 +From: Mohammed Anees +Date: Thu, 17 Oct 2024 13:36:38 +0530 +Subject: [PATCH] wifi: rtw88: Refactor looping in + rtw_phy_store_tx_power_by_rate + +The previous implementation included an unnecessary else +condition paired with a continue statement. Since a check +is already performed to determine if the band is either +2G or 5G, the else condition will never be triggered. +We can remove this check. + +Signed-off-by: Mohammed Anees +Acked-by: Ping-Ke Shih +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/20241017080638.13074-1-pvmohammedanees2003@gmail.com +--- + drivers/net/wireless/realtek/rtw88/phy.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +--- a/drivers/net/wireless/realtek/rtw88/phy.c ++++ b/drivers/net/wireless/realtek/rtw88/phy.c +@@ -1470,10 +1470,8 @@ static void rtw_phy_store_tx_power_by_ra + rate = rates[i]; + if (band == PHY_BAND_2G) + hal->tx_pwr_by_rate_offset_2g[rfpath][rate] = offset; +- else if (band == PHY_BAND_5G) +- hal->tx_pwr_by_rate_offset_5g[rfpath][rate] = offset; + else +- continue; ++ hal->tx_pwr_by_rate_offset_5g[rfpath][rate] = offset; + } + } + diff --git a/package/kernel/mac80211/patches/rtl/023-v6.13-wifi-rtw88-Report-the-signal-strength-only-if-it-s-k.patch b/package/kernel/mac80211/patches/rtl/023-v6.13-wifi-rtw88-Report-the-signal-strength-only-if-it-s-k.patch new file mode 100644 index 00000000000000..accbf2b484f7f1 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/023-v6.13-wifi-rtw88-Report-the-signal-strength-only-if-it-s-k.patch @@ -0,0 +1,39 @@ +From 47f754b3f838205f3b25c4839f74801d180995bf Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Tue, 22 Oct 2024 20:20:26 +0300 +Subject: [PATCH] wifi: rtw88: Report the signal strength only if it's known + +RTL8811CU doesn't report the signal strength for many (any?) data +frames. When the signal strength is not known, set +RX_FLAG_NO_SIGNAL_VAL in order to avoid reporting a signal +strength of 0. + +Signed-off-by: Bitterblue Smith +Acked-by: Ping-Ke Shih +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/f7e1e448-2c9b-498f-b8b1-a14dd967d7d3@gmail.com +--- + drivers/net/wireless/realtek/rtw88/rx.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +--- a/drivers/net/wireless/realtek/rtw88/rx.c ++++ b/drivers/net/wireless/realtek/rtw88/rx.c +@@ -234,10 +234,14 @@ static void rtw_rx_fill_rx_status(struct + else + rx_status->bw = RATE_INFO_BW_20; + +- rx_status->signal = pkt_stat->signal_power; +- for (path = 0; path < rtwdev->hal.rf_path_num; path++) { +- rx_status->chains |= BIT(path); +- rx_status->chain_signal[path] = pkt_stat->rx_power[path]; ++ if (pkt_stat->phy_status) { ++ rx_status->signal = pkt_stat->signal_power; ++ for (path = 0; path < rtwdev->hal.rf_path_num; path++) { ++ rx_status->chains |= BIT(path); ++ rx_status->chain_signal[path] = pkt_stat->rx_power[path]; ++ } ++ } else { ++ rx_status->flag |= RX_FLAG_NO_SIGNAL_VAL; + } + + rtw_rx_addr_match(rtwdev, pkt_stat, hdr); diff --git a/package/kernel/mac80211/patches/rtl/024-v6.13-wifi-rtw88-Add-some-definitions-for-RTL8821AU-RTL881.patch b/package/kernel/mac80211/patches/rtl/024-v6.13-wifi-rtw88-Add-some-definitions-for-RTL8821AU-RTL881.patch new file mode 100644 index 00000000000000..bf3d2fe267f4b2 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/024-v6.13-wifi-rtw88-Add-some-definitions-for-RTL8821AU-RTL881.patch @@ -0,0 +1,490 @@ +From d12722830ea4f562e91586927ec21b64d0369544 Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Wed, 23 Oct 2024 17:00:59 +0300 +Subject: [PATCH] wifi: rtw88: Add some definitions for RTL8821AU/RTL8812AU + +Add 8821A and 8812A chip type enums. + +Add cck_high_power member to struct rtw_hal. This will be used to +calculate the RX signal strength of RTL8812AU. + +Add various register definitions which will be used by the new drivers. + +Move some existing register definitions from rtw8821c.h and rtw8822b.h. +They were duplicated in those headers and will also be used by the new +drivers. + +Signed-off-by: Bitterblue Smith +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/9279a9cd-6f86-4dc3-a095-7c36cb9b9d06@gmail.com +--- + drivers/net/wireless/realtek/rtw88/main.h | 3 + + drivers/net/wireless/realtek/rtw88/reg.h | 174 ++++++++++++++++++ + drivers/net/wireless/realtek/rtw88/rtw8821c.h | 24 --- + drivers/net/wireless/realtek/rtw88/rtw8822b.h | 12 -- + 4 files changed, 177 insertions(+), 36 deletions(-) + +--- a/drivers/net/wireless/realtek/rtw88/main.h ++++ b/drivers/net/wireless/realtek/rtw88/main.h +@@ -189,6 +189,8 @@ enum rtw_chip_type { + RTW_CHIP_TYPE_8723D, + RTW_CHIP_TYPE_8821C, + RTW_CHIP_TYPE_8703B, ++ RTW_CHIP_TYPE_8821A, ++ RTW_CHIP_TYPE_8812A, + }; + + enum rtw_tx_queue_type { +@@ -1934,6 +1936,7 @@ struct rtw_hal { + u32 antenna_rx; + u8 bfee_sts_cap; + bool txrx_1ss; ++ bool cck_high_power; + + /* protect tx power section */ + struct mutex tx_power_mutex; +--- a/drivers/net/wireless/realtek/rtw88/reg.h ++++ b/drivers/net/wireless/realtek/rtw88/reg.h +@@ -9,6 +9,7 @@ + #define BIT_FEN_EN_25_1 BIT(13) + #define BIT_FEN_ELDR BIT(12) + #define BIT_FEN_CPUEN BIT(2) ++#define BIT_FEN_USBA BIT(2) + #define BIT_FEN_BB_GLB_RST BIT(1) + #define BIT_FEN_BB_RSTB BIT(0) + #define BIT_R_DIS_PRST BIT(6) +@@ -16,6 +17,10 @@ + #define REG_SYS_PW_CTRL 0x0004 + #define BIT_PFM_WOWL BIT(3) + #define BIT_APFM_OFFMAC BIT(9) ++#define REG_APS_FSMCO 0x0004 ++#define APS_FSMCO_MAC_ENABLE BIT(8) ++#define APS_FSMCO_MAC_OFF BIT(9) ++#define APS_FSMCO_HW_POWERDOWN BIT(15) + #define REG_SYS_CLK_CTRL 0x0008 + #define BIT_CPU_CLK_EN BIT(14) + +@@ -58,6 +63,8 @@ + #define BIT_SHIFT_LDO25_VOLTAGE 4 + #define BIT_LDO25_EN BIT(7) + ++#define REG_ACLK_MON 0x3e ++ + #define REG_GPIO_MUXCFG 0x0040 + #define BIT_FSPI_EN BIT(19) + #define BIT_EN_SIC BIT(12) +@@ -90,6 +97,8 @@ + #define BIT_USB_SUS_DIS BIT(8) + #define BIT_SDIO_PAD_E5 BIT(18) + ++#define REG_RF_B_CTRL 0x76 ++ + #define REG_AFE_CTRL_4 0x0078 + #define BIT_CK320M_AFE_EN BIT(4) + #define BIT_EN_SYN BIT(15) +@@ -134,6 +143,11 @@ + #define REG_PMC_DBG_CTRL1 0xa8 + #define BITS_PMC_BT_IQK_STS GENMASK(22, 21) + ++#define REG_HIMR0 0xb0 ++#define REG_HISR0 0xb4 ++#define REG_HIMR1 0xb8 ++#define REG_HISR1 0xbc ++ + #define REG_PAD_CTRL2 0x00C4 + #define BIT_RSM_EN_V1 BIT(16) + #define BIT_NO_PDN_CHIPOFF_V1 BIT(17) +@@ -185,6 +199,15 @@ + #define MAC_TRX_ENABLE (BIT_HCI_TXDMA_EN | BIT_HCI_RXDMA_EN | BIT_TXDMA_EN | \ + BIT_RXDMA_EN | BIT_PROTOCOL_EN | BIT_SCHEDULE_EN | \ + BIT_MACTXEN | BIT_MACRXEN) ++#define REG_PBP 0x104 ++#define PBP_RX_MASK 0x0f ++#define PBP_TX_MASK 0xf0 ++#define PBP_64 0x0 ++#define PBP_128 0x1 ++#define PBP_256 0x2 ++#define PBP_512 0x3 ++#define PBP_1024 0x4 ++ + #define BIT_SHIFT_TXDMA_VOQ_MAP 4 + #define BIT_MASK_TXDMA_VOQ_MAP 0x3 + #define BIT_TXDMA_VOQ_MAP(x) \ +@@ -256,6 +279,8 @@ + #define REG_HMEBOX1 0x01D4 + #define REG_HMEBOX2 0x01D8 + #define REG_HMEBOX3 0x01DC ++#define REG_LLT_INIT 0x01E0 ++#define BIT_LLT_WRITE_ACCESS BIT(30) + #define REG_HMEBOX0_EX 0x01F0 + #define REG_HMEBOX1_EX 0x01F4 + #define REG_HMEBOX2_EX 0x01F8 +@@ -298,6 +323,7 @@ + + #define REG_AUTO_LLT 0x0224 + #define BIT_AUTO_INIT_LLT BIT(16) ++#define REG_DWBCN1_CTRL 0x0228 + #define REG_RQPN_CTRL_1 0x0228 + #define REG_RQPN_CTRL_2 0x022C + #define BIT_LD_RQPN BIT(31) +@@ -329,6 +355,7 @@ + #define BIT_DMA_BURST_SIZE_1024 0 + + #define REG_RXPKTNUM 0x02B0 ++#define REG_EARLY_MODE_CONTROL 0x02BC + + #define REG_INT_MIG 0x0304 + #define REG_HCI_MIX_CFG 0x03FC +@@ -336,6 +363,7 @@ + + #define REG_BCNQ_INFO 0x0418 + #define BIT_MGQ_CPU_EMPTY BIT(24) ++#define REG_TXPKT_EMPTY 0x041A + #define REG_FWHW_TXQ_CTRL 0x0420 + #define BIT_EN_BCNQ_DL BIT(22) + #define BIT_EN_WR_FREE_TAIL BIT(20) +@@ -362,10 +390,12 @@ + #define REG_AMPDU_MAX_TIME_V1 0x0455 + #define REG_BCNQ1_BDNY_V1 0x0456 + #define REG_AMPDU_MAX_TIME 0x0456 ++#define REG_AMPDU_MAX_LENGTH 0x0458 + #define REG_WMAC_LBK_BF_HD 0x045D + #define REG_TX_HANG_CTRL 0x045E + #define BIT_EN_GNT_BT_AWAKE BIT(3) + #define BIT_EN_EOF_V1 BIT(2) ++#define REG_FAST_EDCA_CTRL 0x0460 + #define REG_DATA_SC 0x0483 + #define REG_ARFR2_V1 0x048C + #define REG_ARFRH2_V1 0x0490 +@@ -390,6 +420,8 @@ + #define REG_PRECNT_CTRL 0x04E5 + #define BIT_BTCCA_CTRL (BIT(0) | BIT(1)) + #define BIT_EN_PRECNT BIT(11) ++#define REG_TX_RPT_CTRL 0x04EC ++#define REG_TX_RPT_TIME 0x04F0 + #define REG_DUMMY_PAGE4_V1 0x04FC + + #define REG_EDCA_VO_PARAM 0x0500 +@@ -400,6 +432,7 @@ + #define BIT_MASK_CWMAX GENMASK(15, 12) + #define BIT_MASK_CWMIN GENMASK(11, 8) + #define BIT_MASK_AIFS GENMASK(7, 0) ++#define REG_BCNTCFG 0x0510 + #define REG_PIFS 0x0512 + #define REG_SIFS 0x0514 + #define BIT_SHIFT_SIFS_OFDM_CTX 8 +@@ -526,6 +559,8 @@ + #define REG_BT_COEX_V2 0x0762 + #define BIT_GNT_BT_POLARITY BIT(12) + #define BIT_LTE_COEX_EN BIT(7) ++#define REG_GNT_BT 0x0765 ++#define BIT_PTA_SW_CTL GENMASK(4, 3) + #define REG_BT_COEX_ENH_INTR_CTRL 0x76E + #define BIT_R_GRANTALL_WLMASK BIT(3) + #define BIT_STATIS_BT_EN BIT(2) +@@ -543,14 +578,43 @@ + #define REG_FPGA0_RFMOD 0x0800 + #define BIT_CCKEN BIT(24) + #define BIT_OFDMEN BIT(25) ++#define REG_CCK_RPT_FORMAT 0x0804 ++#define BIT_CCK_RPT_FORMAT BIT(16) ++#define REG_RXPSEL 0x0808 ++#define BIT_RX_PSEL_RST (BIT(28) | BIT(29)) ++#define REG_TXPSEL 0x080C + #define REG_RX_GAIN_EN 0x081c ++#define REG_CCASEL 0x082C ++#define REG_PDMFTH 0x0830 ++#define REG_BWINDICATION 0x0834 ++#define REG_CCA2ND 0x0838 ++#define REG_L1PKTH 0x0848 ++#define REG_CLKTRK 0x0860 ++#define REG_ADCCLK 0x08AC ++#define REG_HSSI_READ 0x08B0 ++#define REG_FPGA0_XCD_RF_PARA 0x08B4 ++#define REG_RX_MCS_LIMIT 0x08BC ++#define REG_ADC160 0x08C4 ++#define REG_ANTSEL_SW 0x0900 ++#define REG_DAC_RSTB 0x090c ++#define REG_SINGLE_TONE_CONT_TX 0x0914 + + #define REG_RFE_CTRL_E 0x0974 + #define REG_2ND_CCA_CTRL 0x0976 ++#define REG_IQK_COM00 0x0978 ++#define REG_IQK_COM32 0x097c ++#define REG_IQK_COM64 0x0980 ++#define REG_IQK_COM96 0x0984 ++ ++#define REG_FAS 0x09a4 ++#define REG_RXSB 0x0a00 ++#define REG_CCK_RX 0x0a04 ++#define REG_CCK_PD_TH 0x0a0a + + #define REG_CCK0_FAREPORT 0xa2c + #define BIT_CCK0_2RX BIT(18) + #define BIT_CCK0_MRC BIT(22) ++#define REG_FA_CCK 0x0a5c + + #define REG_DIS_DPD 0x0a70 + #define DIS_DPD_MASK GENMASK(9, 0) +@@ -566,13 +630,109 @@ + #define DIS_DPD_RATEVHT2SS_MCS1 BIT(9) + #define DIS_DPD_RATEALL GENMASK(9, 0) + ++#define REG_CNTRST 0x0b58 ++ ++#define REG_3WIRE_SWA 0x0c00 ++#define REG_RX_IQC_AB_A 0x0c10 ++#define REG_TXSCALE_A 0x0c1c ++#define BB_SWING_MASK GENMASK(31, 21) ++#define REG_TX_AGC_A_CCK_11_CCK_1 0xc20 ++#define REG_TX_AGC_A_OFDM18_OFDM6 0xc24 ++#define REG_TX_AGC_A_OFDM54_OFDM24 0xc28 ++#define REG_TX_AGC_A_MCS3_MCS0 0xc2c ++#define REG_TX_AGC_A_MCS7_MCS4 0xc30 ++#define REG_TX_AGC_A_MCS11_MCS8 0xc34 ++#define REG_TX_AGC_A_MCS15_MCS12 0xc38 ++#define REG_TX_AGC_A_NSS1_INDEX3_NSS1_INDEX0 0xc3c ++#define REG_TX_AGC_A_NSS1_INDEX7_NSS1_INDEX4 0xc40 ++#define REG_TX_AGC_A_NSS2_INDEX1_NSS1_INDEX8 0xc44 ++#define REG_TX_AGC_A_NSS2_INDEX5_NSS2_INDEX2 0xc48 ++#define REG_TX_AGC_A_NSS2_INDEX9_NSS2_INDEX6 0xc4c ++#define REG_RXIGI_A 0x0c50 ++#define REG_TX_PWR_TRAINING_A 0x0c54 ++#define REG_CK_MONHA 0x0c5c ++#define REG_AFE_PWR1_A 0x0c60 ++#define REG_AFE_PWR2_A 0x0c64 ++#define REG_RX_WAIT_CCA_TX_CCK_RFON_A 0x0c68 ++#define REG_OFDM0_XA_TX_IQ_IMBALANCE 0x0c80 ++#define REG_OFDM0_A_TX_AFE 0x0c84 ++#define REG_OFDM0_XB_TX_IQ_IMBALANCE 0x0c88 ++#define REG_TSSI_TRK_SW 0x0c8c ++#define REG_LSSI_WRITE_A 0x0c90 ++#define REG_PREDISTA 0x0c90 ++#define REG_TXAGCIDX 0x0c94 ++ ++#define REG_RFE_PINMUX_A 0x0cb0 ++#define REG_RFE_INV_A 0x0cb4 + #define REG_RFE_CTRL8 0x0cb4 + #define BIT_MASK_RFE_SEL89 GENMASK(7, 0) ++#define PTA_CTRL_PIN 0x66 ++#define DPDT_CTRL_PIN 0x77 ++#define RFE_INV_MASK 0x3ff00000 ++#define REG_RFECTL_A 0x0cb8 + #define REG_RFE_INV8 0x0cbd + #define BIT_MASK_RFE_INV89 GENMASK(1, 0) + #define REG_RFE_INV16 0x0cbe + #define BIT_RFE_BUF_EN BIT(3) + ++#define REG_IQK_DPD_CFG 0x0cc4 ++#define REG_CFG_PMPD 0x0cc8 ++#define REG_IQC_Y 0x0ccc ++#define REG_IQC_X 0x0cd4 ++#define REG_INTPO_SETA 0x0ce8 ++ ++#define REG_IQKA_END 0x0d00 ++#define REG_PI_READ_A 0x0d04 ++#define REG_SI_READ_A 0x0d08 ++#define REG_IQKB_END 0x0d40 ++#define REG_PI_READ_B 0x0d44 ++#define REG_SI_READ_B 0x0d48 ++ ++#define REG_3WIRE_SWB 0x0e00 ++#define REG_RX_IQC_AB_B 0x0e10 ++#define REG_TXSCALE_B 0x0e1c ++#define REG_TX_AGC_B_CCK_11_CCK_1 0xe20 ++#define REG_TX_AGC_B_OFDM18_OFDM6 0xe24 ++#define REG_TX_AGC_B_OFDM54_OFDM24 0xe28 ++#define REG_TX_AGC_B_MCS3_MCS0 0xe2c ++#define REG_TX_AGC_B_MCS7_MCS4 0xe30 ++#define REG_TX_AGC_B_MCS11_MCS8 0xe34 ++#define REG_TX_AGC_B_MCS15_MCS12 0xe38 ++#define REG_TX_AGC_B_NSS1_INDEX3_NSS1_INDEX0 0xe3c ++#define REG_TX_AGC_B_NSS1_INDEX7_NSS1_INDEX4 0xe40 ++#define REG_TX_AGC_B_NSS2_INDEX1_NSS1_INDEX8 0xe44 ++#define REG_TX_AGC_B_NSS2_INDEX5_NSS2_INDEX2 0xe48 ++#define REG_TX_AGC_B_NSS2_INDEX9_NSS2_INDEX6 0xe4c ++#define REG_RXIGI_B 0x0e50 ++#define REG_TX_PWR_TRAINING_B 0x0e54 ++#define REG_CK_MONHB 0x0e5c ++#define REG_AFE_PWR1_B 0x0e60 ++#define REG_AFE_PWR2_B 0x0e64 ++#define REG_RX_WAIT_CCA_TX_CCK_RFON_B 0x0e68 ++#define REG_TXTONEB 0x0e80 ++#define REG_RXTONEB 0x0e84 ++#define REG_TXPITMB 0x0e88 ++#define REG_RXPITMB 0x0e8c ++#define REG_LSSI_WRITE_B 0x0e90 ++#define REG_PREDISTB 0x0e90 ++#define REG_INIDLYB 0x0e94 ++#define REG_RFE_PINMUX_B 0x0eb0 ++#define REG_RFE_INV_B 0x0eb4 ++#define REG_RFECTL_B 0x0eb8 ++#define REG_BPBDB 0x0ec4 ++#define REG_PHYTXONB 0x0ec8 ++#define REG_IQKYB 0x0ecc ++#define REG_IQKXB 0x0ed4 ++#define REG_INTPO_SETB 0x0ee8 ++ ++#define REG_CRC_CCK 0x0f04 ++#define REG_CCA_OFDM 0x0f08 ++#define REG_CRC_VHT 0x0f0c ++#define REG_CRC_HT 0x0f10 ++#define REG_CRC_OFDM 0x0f14 ++#define REG_FA_OFDM 0x0f48 ++#define REG_CCA_CCK 0x0fcc ++ + #define REG_ANAPARSW_MAC_0 0x1010 + #define BIT_CF_L_V2 GENMASK(29, 28) + +@@ -709,6 +869,10 @@ + + #define REG_IGN_GNTBT4 0x4160 + ++#define REG_USB_MOD 0xf008 ++#define REG_USB3_RXITV 0xf050 ++#define REG_USB_HRPWM 0xfe58 ++ + #define RF_MODE 0x00 + #define RF_MODOPT 0x01 + #define RF_WLINT 0x01 +@@ -716,7 +880,13 @@ + #define RF_DTXLOK 0x08 + #define RF_CFGCH 0x18 + #define BIT_BAND GENMASK(18, 16) ++#define RF18_BAND_MASK (BIT(16) | BIT(9) | BIT(8)) ++#define RF18_CHANNEL_MASK (MASKBYTE0) ++#define RF18_RFSI_MASK (BIT(18) | BIT(17)) + #define RF_RCK 0x1d ++#define RF_MODE_TABLE_ADDR 0x30 ++#define RF_MODE_TABLE_DATA0 0x31 ++#define RF_MODE_TABLE_DATA1 0x32 + #define RF_LUTWA 0x33 + #define RF_LUTWD1 0x3e + #define RF_LUTWD0 0x3f +@@ -725,10 +895,14 @@ + #define RF_T_METER 0x42 + #define RF_BSPAD 0x54 + #define RF_GAINTX 0x56 ++#define RF_TXMOD 0x58 + #define RF_TXATANK 0x64 ++#define RF_TXA_PREPAD 0x65 + #define RF_TRXIQ 0x66 + #define RF_RXIQGEN 0x8d ++#define RF_RXBB2 0x8f + #define RF_SYN_PFD 0xb0 ++#define RF_LCK 0xb4 + #define RF_XTALX2 0xb8 + #define RF_SYN_CTRL 0xbb + #define RF_MALSEL 0xbe +--- a/drivers/net/wireless/realtek/rtw88/rtw8821c.h ++++ b/drivers/net/wireless/realtek/rtw88/rtw8821c.h +@@ -214,19 +214,10 @@ extern const struct rtw_chip_info rtw882 + #define BIT_FEN_EN BIT(26) + #define REG_INIRTS_RATE_SEL 0x0480 + #define REG_HTSTFWT 0x800 +-#define REG_RXPSEL 0x808 +-#define BIT_RX_PSEL_RST (BIT(28) | BIT(29)) +-#define REG_TXPSEL 0x80c + #define REG_RXCCAMSK 0x814 +-#define REG_CCASEL 0x82c +-#define REG_PDMFTH 0x830 +-#define REG_CCA2ND 0x838 + #define REG_L1WT 0x83c + #define REG_L1PKWT 0x840 + #define REG_MRC 0x850 +-#define REG_CLKTRK 0x860 +-#define REG_ADCCLK 0x8ac +-#define REG_ADC160 0x8c4 + #define REG_ADC40 0x8c8 + #define REG_CHFIR 0x8f0 + #define REG_CDDTXP 0x93c +@@ -234,14 +225,11 @@ extern const struct rtw_chip_info rtw882 + #define REG_ACBB0 0x948 + #define REG_ACBBRXFIR 0x94c + #define REG_ACGG2TBL 0x958 +-#define REG_FAS 0x9a4 +-#define REG_RXSB 0xa00 + #define REG_ADCINI 0xa04 + #define REG_PWRTH 0xa08 + #define REG_CCA_FLTR 0xa20 + #define REG_TXSF2 0xa24 + #define REG_TXSF6 0xa28 +-#define REG_FA_CCK 0xa5c + #define REG_RXDESC 0xa2c + #define REG_ENTXCCK 0xa80 + #define BTG_LNA 0xfc84 +@@ -252,12 +240,8 @@ extern const struct rtw_chip_info rtw882 + #define REG_PWRTH2 0xaa8 + #define REG_CSRATIO 0xaaa + #define REG_TXFILTER 0xaac +-#define REG_CNTRST 0xb58 + #define REG_AGCTR_A 0xc08 +-#define REG_TXSCALE_A 0xc1c + #define REG_TXDFIR 0xc20 +-#define REG_RXIGI_A 0xc50 +-#define REG_TXAGCIDX 0xc94 + #define REG_TRSW 0xca0 + #define REG_RFESEL0 0xcb0 + #define REG_RFESEL8 0xcb4 +@@ -269,14 +253,6 @@ extern const struct rtw_chip_info rtw882 + #define B_WLA_SWITCH BIT(23) + #define REG_RFEINV 0xcbc + #define REG_AGCTR_B 0xe08 +-#define REG_RXIGI_B 0xe50 +-#define REG_CRC_CCK 0xf04 +-#define REG_CRC_OFDM 0xf14 +-#define REG_CRC_HT 0xf10 +-#define REG_CRC_VHT 0xf0c +-#define REG_CCA_OFDM 0xf08 +-#define REG_FA_OFDM 0xf48 +-#define REG_CCA_CCK 0xfcc + #define REG_DMEM_CTRL 0x1080 + #define BIT_WL_RST BIT(16) + #define REG_ANTWT 0x1904 +--- a/drivers/net/wireless/realtek/rtw88/rtw8822b.h ++++ b/drivers/net/wireless/realtek/rtw88/rtw8822b.h +@@ -151,21 +151,12 @@ _rtw_write32s_mask(struct rtw_dev *rtwde + #define RTW8822B_EDCCA_MAX 0x7f + #define RTW8822B_EDCCA_SRC_DEF 1 + #define REG_HTSTFWT 0x800 +-#define REG_RXPSEL 0x808 +-#define BIT_RX_PSEL_RST (BIT(28) | BIT(29)) +-#define REG_TXPSEL 0x80c + #define REG_RXCCAMSK 0x814 +-#define REG_CCASEL 0x82c +-#define REG_PDMFTH 0x830 +-#define REG_CCA2ND 0x838 + #define REG_L1WT 0x83c + #define REG_L1PKWT 0x840 + #define REG_MRC 0x850 +-#define REG_CLKTRK 0x860 + #define REG_EDCCA_POW_MA 0x8a0 + #define BIT_MA_LEVEL GENMASK(1, 0) +-#define REG_ADCCLK 0x8ac +-#define REG_ADC160 0x8c4 + #define REG_ADC40 0x8c8 + #define REG_EDCCA_DECISION 0x8dc + #define BIT_EDCCA_OPTION BIT(5) +@@ -176,7 +167,6 @@ _rtw_write32s_mask(struct rtw_dev *rtwde + #define REG_ACBB0 0x948 + #define REG_ACBBRXFIR 0x94c + #define REG_ACGG2TBL 0x958 +-#define REG_RXSB 0xa00 + #define REG_ADCINI 0xa04 + #define REG_TXSF2 0xa24 + #define REG_TXSF6 0xa28 +@@ -184,14 +174,12 @@ _rtw_write32s_mask(struct rtw_dev *rtwde + #define REG_ENTXCCK 0xa80 + #define REG_AGCTR_A 0xc08 + #define REG_TXDFIR 0xc20 +-#define REG_RXIGI_A 0xc50 + #define REG_TRSW 0xca0 + #define REG_RFESEL0 0xcb0 + #define REG_RFESEL8 0xcb4 + #define REG_RFECTL 0xcb8 + #define REG_RFEINV 0xcbc + #define REG_AGCTR_B 0xe08 +-#define REG_RXIGI_B 0xe50 + #define REG_ANTWT 0x1904 + #define REG_IQKFAILMSK 0x1bf0 + diff --git a/package/kernel/mac80211/patches/rtl/025-v6.13-wifi-rtw88-Dump-the-HW-features-only-for-some-chips.patch b/package/kernel/mac80211/patches/rtl/025-v6.13-wifi-rtw88-Dump-the-HW-features-only-for-some-chips.patch new file mode 100644 index 00000000000000..279e8ba761d226 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/025-v6.13-wifi-rtw88-Dump-the-HW-features-only-for-some-chips.patch @@ -0,0 +1,93 @@ +From 87341ca1eac9a3bac23bd41f6e24f3c93b77452f Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Wed, 23 Oct 2024 17:02:05 +0300 +Subject: [PATCH] wifi: rtw88: Dump the HW features only for some chips + +RTL8821AU and RTL8812AU don't support this. They hit the "failed to read +hw feature report" error. + +Signed-off-by: Bitterblue Smith +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/8becd851-8760-4480-8e8c-c4869ce72507@gmail.com +--- + drivers/net/wireless/realtek/rtw88/main.c | 3 +++ + drivers/net/wireless/realtek/rtw88/main.h | 1 + + drivers/net/wireless/realtek/rtw88/rtw8703b.c | 1 + + drivers/net/wireless/realtek/rtw88/rtw8723d.c | 1 + + drivers/net/wireless/realtek/rtw88/rtw8821c.c | 1 + + drivers/net/wireless/realtek/rtw88/rtw8822b.c | 1 + + drivers/net/wireless/realtek/rtw88/rtw8822c.c | 1 + + 7 files changed, 9 insertions(+) + +--- a/drivers/net/wireless/realtek/rtw88/main.c ++++ b/drivers/net/wireless/realtek/rtw88/main.c +@@ -1917,6 +1917,9 @@ static int rtw_dump_hw_feature(struct rt + u8 bw; + int i; + ++ if (!rtwdev->chip->hw_feature_report) ++ return 0; ++ + id = rtw_read8(rtwdev, REG_C2HEVT); + if (id != C2H_HW_FEATURE_REPORT) { + rtw_err(rtwdev, "failed to read hw feature report\n"); +--- a/drivers/net/wireless/realtek/rtw88/main.h ++++ b/drivers/net/wireless/realtek/rtw88/main.h +@@ -1200,6 +1200,7 @@ struct rtw_chip_info { + const struct rtw_fwcd_segs *fwcd_segs; + + u8 usb_tx_agg_desc_num; ++ bool hw_feature_report; + + u8 default_1ss_tx_path; + +--- a/drivers/net/wireless/realtek/rtw88/rtw8703b.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8703b.c +@@ -1960,6 +1960,7 @@ const struct rtw_chip_info rtw8703b_hw_s + .max_power_index = 0x3f, + .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, + .usb_tx_agg_desc_num = 1, /* Not sure if this chip has USB interface */ ++ .hw_feature_report = true, + + .path_div_supported = false, + .ht_supported = true, +--- a/drivers/net/wireless/realtek/rtw88/rtw8723d.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8723d.c +@@ -2131,6 +2131,7 @@ const struct rtw_chip_info rtw8723d_hw_s + .page_size = TX_PAGE_SIZE, + .dig_min = 0x20, + .usb_tx_agg_desc_num = 1, ++ .hw_feature_report = true, + .ht_supported = true, + .vht_supported = false, + .lps_deep_mode_supported = 0, +--- a/drivers/net/wireless/realtek/rtw88/rtw8821c.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8821c.c +@@ -1968,6 +1968,7 @@ const struct rtw_chip_info rtw8821c_hw_s + .page_size = TX_PAGE_SIZE, + .dig_min = 0x1c, + .usb_tx_agg_desc_num = 3, ++ .hw_feature_report = true, + .ht_supported = true, + .vht_supported = true, + .lps_deep_mode_supported = BIT(LPS_DEEP_MODE_LCLK), +--- a/drivers/net/wireless/realtek/rtw88/rtw8822b.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8822b.c +@@ -2509,6 +2509,7 @@ const struct rtw_chip_info rtw8822b_hw_s + .page_size = TX_PAGE_SIZE, + .dig_min = 0x1c, + .usb_tx_agg_desc_num = 3, ++ .hw_feature_report = true, + .ht_supported = true, + .vht_supported = true, + .lps_deep_mode_supported = BIT(LPS_DEEP_MODE_LCLK), +--- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c +@@ -5329,6 +5329,7 @@ const struct rtw_chip_info rtw8822c_hw_s + .page_size = TX_PAGE_SIZE, + .dig_min = 0x20, + .usb_tx_agg_desc_num = 3, ++ .hw_feature_report = true, + .default_1ss_tx_path = BB_PATH_A, + .path_div_supported = true, + .ht_supported = true, diff --git a/package/kernel/mac80211/patches/rtl/026-v6.13-wifi-rtw88-Allow-different-C2H-RA-report-sizes.patch b/package/kernel/mac80211/patches/rtl/026-v6.13-wifi-rtw88-Allow-different-C2H-RA-report-sizes.patch new file mode 100644 index 00000000000000..0e97febb727031 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/026-v6.13-wifi-rtw88-Allow-different-C2H-RA-report-sizes.patch @@ -0,0 +1,175 @@ +From d9018f4373517d4560ce2ebf12684f77f5fbdad6 Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Wed, 23 Oct 2024 17:06:14 +0300 +Subject: [PATCH] wifi: rtw88: Allow different C2H RA report sizes + +The RTL8821AU and RTL8812AU have smaller RA report size, only 4 bytes. +Avoid the "invalid ra report c2h length" error. + +Also, use a struct and u8_get_bits() to access the RA report C2H. + +Signed-off-by: Bitterblue Smith +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/c3e73c3a-fb2f-4013-9f06-d5274211e282@gmail.com +--- + drivers/net/wireless/realtek/rtw88/fw.c | 21 +++++++++++++------ + drivers/net/wireless/realtek/rtw88/fw.h | 17 +++++++++++---- + drivers/net/wireless/realtek/rtw88/main.h | 1 + + drivers/net/wireless/realtek/rtw88/rtw8703b.c | 1 + + drivers/net/wireless/realtek/rtw88/rtw8723d.c | 1 + + drivers/net/wireless/realtek/rtw88/rtw8821c.c | 1 + + drivers/net/wireless/realtek/rtw88/rtw8822b.c | 1 + + drivers/net/wireless/realtek/rtw88/rtw8822c.c | 1 + + 8 files changed, 34 insertions(+), 10 deletions(-) + +--- a/drivers/net/wireless/realtek/rtw88/fw.c ++++ b/drivers/net/wireless/realtek/rtw88/fw.c +@@ -139,25 +139,30 @@ static u16 get_max_amsdu_len(u32 bit_rat + struct rtw_fw_iter_ra_data { + struct rtw_dev *rtwdev; + u8 *payload; ++ u8 length; + }; + + static void rtw_fw_ra_report_iter(void *data, struct ieee80211_sta *sta) + { + struct rtw_fw_iter_ra_data *ra_data = data; ++ struct rtw_c2h_ra_rpt *ra_rpt = (struct rtw_c2h_ra_rpt *)ra_data->payload; + struct rtw_sta_info *si = (struct rtw_sta_info *)sta->drv_priv; + u8 mac_id, rate, sgi, bw; + u8 mcs, nss; + u32 bit_rate; + +- mac_id = GET_RA_REPORT_MACID(ra_data->payload); ++ mac_id = ra_rpt->mac_id; + if (si->mac_id != mac_id) + return; + + si->ra_report.txrate.flags = 0; + +- rate = GET_RA_REPORT_RATE(ra_data->payload); +- sgi = GET_RA_REPORT_SGI(ra_data->payload); +- bw = GET_RA_REPORT_BW(ra_data->payload); ++ rate = u8_get_bits(ra_rpt->rate_sgi, RTW_C2H_RA_RPT_RATE); ++ sgi = u8_get_bits(ra_rpt->rate_sgi, RTW_C2H_RA_RPT_SGI); ++ if (ra_data->length >= offsetofend(typeof(*ra_rpt), bw)) ++ bw = ra_rpt->bw; ++ else ++ bw = si->bw_mode; + + if (rate < DESC_RATEMCS0) { + si->ra_report.txrate.legacy = rtw_desc_to_bitrate(rate); +@@ -197,14 +202,18 @@ legacy: + static void rtw_fw_ra_report_handle(struct rtw_dev *rtwdev, u8 *payload, + u8 length) + { ++ struct rtw_c2h_ra_rpt *ra_rpt = (struct rtw_c2h_ra_rpt *)payload; + struct rtw_fw_iter_ra_data ra_data; + +- if (WARN(length < 7, "invalid ra report c2h length\n")) ++ if (WARN(length < rtwdev->chip->c2h_ra_report_size, ++ "invalid ra report c2h length %d\n", length)) + return; + +- rtwdev->dm_info.tx_rate = GET_RA_REPORT_RATE(payload); ++ rtwdev->dm_info.tx_rate = u8_get_bits(ra_rpt->rate_sgi, ++ RTW_C2H_RA_RPT_RATE); + ra_data.rtwdev = rtwdev; + ra_data.payload = payload; ++ ra_data.length = length; + rtw_iterate_stas_atomic(rtwdev, rtw_fw_ra_report_iter, &ra_data); + } + +--- a/drivers/net/wireless/realtek/rtw88/fw.h ++++ b/drivers/net/wireless/realtek/rtw88/fw.h +@@ -85,6 +85,19 @@ struct rtw_c2h_adaptivity { + u8 option; + } __packed; + ++struct rtw_c2h_ra_rpt { ++ u8 rate_sgi; ++ u8 mac_id; ++ u8 byte2; ++ u8 status; ++ u8 byte4; ++ u8 ra_ratio; ++ u8 bw; ++} __packed; ++ ++#define RTW_C2H_RA_RPT_RATE GENMASK(6, 0) ++#define RTW_C2H_RA_RPT_SGI BIT(7) ++ + struct rtw_h2c_register { + u32 w0; + u32 w1; +@@ -364,10 +377,6 @@ struct rtw_fw_hdr_legacy { + #define GET_CHAN_SWITCH_CENTRAL_CH(c2h_payload) (c2h_payload[2]) + #define GET_CHAN_SWITCH_ID(c2h_payload) (c2h_payload[3]) + #define GET_CHAN_SWITCH_STATUS(c2h_payload) (c2h_payload[4]) +-#define GET_RA_REPORT_RATE(c2h_payload) (c2h_payload[0] & 0x7f) +-#define GET_RA_REPORT_SGI(c2h_payload) ((c2h_payload[0] & 0x80) >> 7) +-#define GET_RA_REPORT_BW(c2h_payload) (c2h_payload[6]) +-#define GET_RA_REPORT_MACID(c2h_payload) (c2h_payload[1]) + + #define GET_BCN_FILTER_NOTIFY_TYPE(c2h_payload) (c2h_payload[1] & 0xf) + #define GET_BCN_FILTER_NOTIFY_EVENT(c2h_payload) (c2h_payload[1] & 0x10) +--- a/drivers/net/wireless/realtek/rtw88/main.h ++++ b/drivers/net/wireless/realtek/rtw88/main.h +@@ -1201,6 +1201,7 @@ struct rtw_chip_info { + + u8 usb_tx_agg_desc_num; + bool hw_feature_report; ++ u8 c2h_ra_report_size; + + u8 default_1ss_tx_path; + +--- a/drivers/net/wireless/realtek/rtw88/rtw8703b.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8703b.c +@@ -1961,6 +1961,7 @@ const struct rtw_chip_info rtw8703b_hw_s + .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, + .usb_tx_agg_desc_num = 1, /* Not sure if this chip has USB interface */ + .hw_feature_report = true, ++ .c2h_ra_report_size = 7, + + .path_div_supported = false, + .ht_supported = true, +--- a/drivers/net/wireless/realtek/rtw88/rtw8723d.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8723d.c +@@ -2132,6 +2132,7 @@ const struct rtw_chip_info rtw8723d_hw_s + .dig_min = 0x20, + .usb_tx_agg_desc_num = 1, + .hw_feature_report = true, ++ .c2h_ra_report_size = 7, + .ht_supported = true, + .vht_supported = false, + .lps_deep_mode_supported = 0, +--- a/drivers/net/wireless/realtek/rtw88/rtw8821c.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8821c.c +@@ -1969,6 +1969,7 @@ const struct rtw_chip_info rtw8821c_hw_s + .dig_min = 0x1c, + .usb_tx_agg_desc_num = 3, + .hw_feature_report = true, ++ .c2h_ra_report_size = 7, + .ht_supported = true, + .vht_supported = true, + .lps_deep_mode_supported = BIT(LPS_DEEP_MODE_LCLK), +--- a/drivers/net/wireless/realtek/rtw88/rtw8822b.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8822b.c +@@ -2510,6 +2510,7 @@ const struct rtw_chip_info rtw8822b_hw_s + .dig_min = 0x1c, + .usb_tx_agg_desc_num = 3, + .hw_feature_report = true, ++ .c2h_ra_report_size = 7, + .ht_supported = true, + .vht_supported = true, + .lps_deep_mode_supported = BIT(LPS_DEEP_MODE_LCLK), +--- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c +@@ -5330,6 +5330,7 @@ const struct rtw_chip_info rtw8822c_hw_s + .dig_min = 0x20, + .usb_tx_agg_desc_num = 3, + .hw_feature_report = true, ++ .c2h_ra_report_size = 7, + .default_1ss_tx_path = BB_PATH_A, + .path_div_supported = true, + .ht_supported = true, diff --git a/package/kernel/mac80211/patches/rtl/027-v6.13-wifi-rtw88-Extend-the-init-table-parsing-for-RTL8812.patch b/package/kernel/mac80211/patches/rtl/027-v6.13-wifi-rtw88-Extend-the-init-table-parsing-for-RTL8812.patch new file mode 100644 index 00000000000000..aec2e6aaecf6a7 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/027-v6.13-wifi-rtw88-Extend-the-init-table-parsing-for-RTL8812.patch @@ -0,0 +1,165 @@ +From 95a772e30b60e7954d03f3372268722475aa303f Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Wed, 23 Oct 2024 17:08:24 +0300 +Subject: [PATCH] wifi: rtw88: Extend the init table parsing for RTL8812AU + +The chips supported so far only use the first condition, and so the +parsing code ignores the second condition. RTL8812AU's init tables use +the second condition also. Make the parsing code check it. + +Signed-off-by: Bitterblue Smith +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/1bee6b74-6eab-44a3-9f40-794ca006c72d@gmail.com +--- + drivers/net/wireless/realtek/rtw88/main.h | 15 ++++++ + drivers/net/wireless/realtek/rtw88/phy.c | 62 ++++++++++++++++++++--- + 2 files changed, 69 insertions(+), 8 deletions(-) + +--- a/drivers/net/wireless/realtek/rtw88/main.h ++++ b/drivers/net/wireless/realtek/rtw88/main.h +@@ -1835,6 +1835,20 @@ struct rtw_phy_cond { + #define BRANCH_ENDIF 3 + }; + ++struct rtw_phy_cond2 { ++#ifdef __LITTLE_ENDIAN ++ u8 type_glna; ++ u8 type_gpa; ++ u8 type_alna; ++ u8 type_apa; ++#else ++ u8 type_apa; ++ u8 type_alna; ++ u8 type_gpa; ++ u8 type_glna; ++#endif ++}; ++ + struct rtw_fifo_conf { + /* tx fifo information */ + u16 rsvd_boundary; +@@ -1916,6 +1930,7 @@ struct rtw_hal { + u8 oem_id; + u8 pkg_type; + struct rtw_phy_cond phy_cond; ++ struct rtw_phy_cond2 phy_cond2; + bool rfe_btg; + + u8 ps_mode; +--- a/drivers/net/wireless/realtek/rtw88/phy.c ++++ b/drivers/net/wireless/realtek/rtw88/phy.c +@@ -18,7 +18,10 @@ struct phy_cfg_pair { + }; + + union phy_table_tile { +- struct rtw_phy_cond cond; ++ struct { ++ struct rtw_phy_cond cond; ++ struct rtw_phy_cond2 cond2; ++ } __packed; + struct phy_cfg_pair cfg; + }; + +@@ -1041,7 +1044,8 @@ void rtw_phy_setup_phy_cond(struct rtw_d + { + struct rtw_hal *hal = &rtwdev->hal; + struct rtw_efuse *efuse = &rtwdev->efuse; +- struct rtw_phy_cond cond = {0}; ++ struct rtw_phy_cond cond = {}; ++ struct rtw_phy_cond2 cond2 = {}; + + cond.cut = hal->cut_version ? hal->cut_version : 15; + cond.pkg = pkg ? pkg : 15; +@@ -1061,15 +1065,34 @@ void rtw_phy_setup_phy_cond(struct rtw_d + break; + } + ++ if (rtwdev->chip->id == RTW_CHIP_TYPE_8812A || ++ rtwdev->chip->id == RTW_CHIP_TYPE_8821A) { ++ cond.rfe = 0; ++ cond.rfe |= efuse->ext_lna_2g; ++ cond.rfe |= efuse->ext_pa_2g << 1; ++ cond.rfe |= efuse->ext_lna_5g << 2; ++ cond.rfe |= efuse->ext_pa_5g << 3; ++ cond.rfe |= efuse->btcoex << 4; ++ ++ cond2.type_alna = efuse->alna_type; ++ cond2.type_glna = efuse->glna_type; ++ cond2.type_apa = efuse->apa_type; ++ cond2.type_gpa = efuse->gpa_type; ++ } ++ + hal->phy_cond = cond; ++ hal->phy_cond2 = cond2; + +- rtw_dbg(rtwdev, RTW_DBG_PHY, "phy cond=0x%08x\n", *((u32 *)&hal->phy_cond)); ++ rtw_dbg(rtwdev, RTW_DBG_PHY, "phy cond=0x%08x cond2=0x%08x\n", ++ *((u32 *)&hal->phy_cond), *((u32 *)&hal->phy_cond2)); + } + +-static bool check_positive(struct rtw_dev *rtwdev, struct rtw_phy_cond cond) ++static bool check_positive(struct rtw_dev *rtwdev, struct rtw_phy_cond cond, ++ struct rtw_phy_cond2 cond2) + { + struct rtw_hal *hal = &rtwdev->hal; + struct rtw_phy_cond drv_cond = hal->phy_cond; ++ struct rtw_phy_cond2 drv_cond2 = hal->phy_cond2; + + if (cond.cut && cond.cut != drv_cond.cut) + return false; +@@ -1080,8 +1103,29 @@ static bool check_positive(struct rtw_de + if (cond.intf && cond.intf != drv_cond.intf) + return false; + +- if (cond.rfe != drv_cond.rfe) +- return false; ++ if (rtwdev->chip->id == RTW_CHIP_TYPE_8812A || ++ rtwdev->chip->id == RTW_CHIP_TYPE_8821A) { ++ if (!(cond.rfe & 0x0f)) ++ return true; ++ ++ if ((cond.rfe & drv_cond.rfe) != cond.rfe) ++ return false; ++ ++ if ((cond.rfe & BIT(0)) && cond2.type_glna != drv_cond2.type_glna) ++ return false; ++ ++ if ((cond.rfe & BIT(1)) && cond2.type_gpa != drv_cond2.type_gpa) ++ return false; ++ ++ if ((cond.rfe & BIT(2)) && cond2.type_alna != drv_cond2.type_alna) ++ return false; ++ ++ if ((cond.rfe & BIT(3)) && cond2.type_apa != drv_cond2.type_apa) ++ return false; ++ } else { ++ if (cond.rfe != drv_cond.rfe) ++ return false; ++ } + + return true; + } +@@ -1090,7 +1134,8 @@ void rtw_parse_tbl_phy_cond(struct rtw_d + { + const union phy_table_tile *p = tbl->data; + const union phy_table_tile *end = p + tbl->size / 2; +- struct rtw_phy_cond pos_cond = {0}; ++ struct rtw_phy_cond pos_cond = {}; ++ struct rtw_phy_cond2 pos_cond2 = {}; + bool is_matched = true, is_skipped = false; + + BUILD_BUG_ON(sizeof(union phy_table_tile) != sizeof(struct phy_cfg_pair)); +@@ -1109,11 +1154,12 @@ void rtw_parse_tbl_phy_cond(struct rtw_d + case BRANCH_ELIF: + default: + pos_cond = p->cond; ++ pos_cond2 = p->cond2; + break; + } + } else if (p->cond.neg) { + if (!is_skipped) { +- if (check_positive(rtwdev, pos_cond)) { ++ if (check_positive(rtwdev, pos_cond, pos_cond2)) { + is_matched = true; + is_skipped = true; + } else { diff --git a/package/kernel/mac80211/patches/rtl/028-v6.13-wifi-rtw88-Allow-rtw_chip_info.ltecoex_addr-to-be-NU.patch b/package/kernel/mac80211/patches/rtl/028-v6.13-wifi-rtw88-Allow-rtw_chip_info.ltecoex_addr-to-be-NU.patch new file mode 100644 index 00000000000000..5486fb2d25e099 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/028-v6.13-wifi-rtw88-Allow-rtw_chip_info.ltecoex_addr-to-be-NU.patch @@ -0,0 +1,58 @@ +From 7c5bbeba7c36575a3a57ef4be775b2f3fb68c3f9 Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Wed, 23 Oct 2024 17:09:04 +0300 +Subject: [PATCH] wifi: rtw88: Allow rtw_chip_info.ltecoex_addr to be NULL + +RTL8821A doesn't have this. Trying to use it results in error messages, +so don't try if ltecoex_addr is NULL. + +Signed-off-by: Bitterblue Smith +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/d1004817-1760-41d1-9136-3d799757c444@gmail.com +--- + drivers/net/wireless/realtek/rtw88/coex.c | 14 +++++++++++--- + 1 file changed, 11 insertions(+), 3 deletions(-) + +--- a/drivers/net/wireless/realtek/rtw88/coex.c ++++ b/drivers/net/wireless/realtek/rtw88/coex.c +@@ -950,12 +950,18 @@ static void rtw_coex_coex_ctrl_owner(str + + static void rtw_coex_set_gnt_bt(struct rtw_dev *rtwdev, u8 state) + { ++ if (!rtwdev->chip->ltecoex_addr) ++ return; ++ + rtw_coex_write_indirect_reg(rtwdev, LTE_COEX_CTRL, 0xc000, state); + rtw_coex_write_indirect_reg(rtwdev, LTE_COEX_CTRL, 0x0c00, state); + } + + static void rtw_coex_set_gnt_wl(struct rtw_dev *rtwdev, u8 state) + { ++ if (!rtwdev->chip->ltecoex_addr) ++ return; ++ + rtw_coex_write_indirect_reg(rtwdev, LTE_COEX_CTRL, 0x3000, state); + rtw_coex_write_indirect_reg(rtwdev, LTE_COEX_CTRL, 0x0300, state); + } +@@ -3904,7 +3910,7 @@ void rtw_coex_display_coex_info(struct r + u8 sys_lte; + u16 score_board_WB, score_board_BW; + u32 wl_reg_6c0, wl_reg_6c4, wl_reg_6c8, wl_reg_778, wl_reg_6cc; +- u32 lte_coex, bt_coex; ++ u32 lte_coex = 0, bt_coex = 0; + int i; + + score_board_BW = rtw_coex_read_scbd(rtwdev); +@@ -3916,8 +3922,10 @@ void rtw_coex_display_coex_info(struct r + wl_reg_778 = rtw_read8(rtwdev, REG_BT_STAT_CTRL); + + sys_lte = rtw_read8(rtwdev, 0x73); +- lte_coex = rtw_coex_read_indirect_reg(rtwdev, 0x38); +- bt_coex = rtw_coex_read_indirect_reg(rtwdev, 0x54); ++ if (rtwdev->chip->ltecoex_addr) { ++ lte_coex = rtw_coex_read_indirect_reg(rtwdev, 0x38); ++ bt_coex = rtw_coex_read_indirect_reg(rtwdev, 0x54); ++ } + + if (!coex_stat->wl_under_ips && + (!coex_stat->wl_under_lps || coex_stat->wl_force_lps_ctrl) && diff --git a/package/kernel/mac80211/patches/rtl/029-v6.13-wifi-rtw88-Let-each-driver-control-the-power-on-off-.patch b/package/kernel/mac80211/patches/rtl/029-v6.13-wifi-rtw88-Let-each-driver-control-the-power-on-off-.patch new file mode 100644 index 00000000000000..10464b80cd0339 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/029-v6.13-wifi-rtw88-Let-each-driver-control-the-power-on-off-.patch @@ -0,0 +1,272 @@ +From fbb5e1b3637a720c83c91a7b1476ab0429bfc747 Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Wed, 23 Oct 2024 17:09:47 +0300 +Subject: [PATCH] wifi: rtw88: Let each driver control the power on/off process + +RTL8821AU and RTL8812AU have to do some things differently, so let +them have full control. + +The other chips use the same functions as before. + +Signed-off-by: Bitterblue Smith +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/98ab839f-9100-44ae-9551-9af743a4aa3a@gmail.com +--- + drivers/net/wireless/realtek/rtw88/coex.c | 3 +++ + drivers/net/wireless/realtek/rtw88/mac.c | 11 +++++++---- + drivers/net/wireless/realtek/rtw88/mac.h | 3 +++ + drivers/net/wireless/realtek/rtw88/main.c | 13 ++++++++----- + drivers/net/wireless/realtek/rtw88/main.h | 5 +++++ + drivers/net/wireless/realtek/rtw88/rtw8703b.c | 2 ++ + drivers/net/wireless/realtek/rtw88/rtw8723d.c | 2 ++ + drivers/net/wireless/realtek/rtw88/rtw8821c.c | 2 ++ + drivers/net/wireless/realtek/rtw88/rtw8822b.c | 2 ++ + drivers/net/wireless/realtek/rtw88/rtw8822c.c | 2 ++ + 10 files changed, 36 insertions(+), 9 deletions(-) + +--- a/drivers/net/wireless/realtek/rtw88/coex.c ++++ b/drivers/net/wireless/realtek/rtw88/coex.c +@@ -2753,16 +2753,19 @@ void rtw_coex_power_on_setting(struct rt + rtw_write8(rtwdev, 0xff1a, 0x0); + rtw_coex_set_gnt_debug(rtwdev); + } ++EXPORT_SYMBOL(rtw_coex_power_on_setting); + + void rtw_coex_power_off_setting(struct rtw_dev *rtwdev) + { + rtw_write16(rtwdev, REG_WIFI_BT_INFO, BIT_BT_INT_EN); + } ++EXPORT_SYMBOL(rtw_coex_power_off_setting); + + void rtw_coex_init_hw_config(struct rtw_dev *rtwdev, bool wifi_only) + { + __rtw_coex_init_hw_config(rtwdev, wifi_only); + } ++EXPORT_SYMBOL(rtw_coex_init_hw_config); + + void rtw_coex_ips_notify(struct rtw_dev *rtwdev, u8 type) + { +--- a/drivers/net/wireless/realtek/rtw88/mac.c ++++ b/drivers/net/wireless/realtek/rtw88/mac.c +@@ -227,8 +227,8 @@ static int rtw_sub_pwr_seq_parser(struct + return 0; + } + +-static int rtw_pwr_seq_parser(struct rtw_dev *rtwdev, +- const struct rtw_pwr_seq_cmd * const *cmd_seq) ++int rtw_pwr_seq_parser(struct rtw_dev *rtwdev, ++ const struct rtw_pwr_seq_cmd * const *cmd_seq) + { + u8 cut_mask; + u8 intf_mask; +@@ -267,6 +267,7 @@ static int rtw_pwr_seq_parser(struct rtw + + return 0; + } ++EXPORT_SYMBOL(rtw_pwr_seq_parser); + + static int rtw_mac_power_switch(struct rtw_dev *rtwdev, bool pwr_on) + { +@@ -994,6 +995,7 @@ int rtw_download_firmware(struct rtw_dev + + return 0; + } ++EXPORT_SYMBOL(rtw_download_firmware); + + static u32 get_priority_queues(struct rtw_dev *rtwdev, u32 queues) + { +@@ -1127,7 +1129,7 @@ static int txdma_queue_mapping(struct rt + return 0; + } + +-static int set_trx_fifo_info(struct rtw_dev *rtwdev) ++int rtw_set_trx_fifo_info(struct rtw_dev *rtwdev) + { + const struct rtw_chip_info *chip = rtwdev->chip; + struct rtw_fifo_conf *fifo = &rtwdev->fifo; +@@ -1179,6 +1181,7 @@ static int set_trx_fifo_info(struct rtw_ + + return 0; + } ++EXPORT_SYMBOL(rtw_set_trx_fifo_info); + + static int __priority_queue_cfg(struct rtw_dev *rtwdev, + const struct rtw_page_table *pg_tbl, +@@ -1256,7 +1259,7 @@ static int priority_queue_cfg(struct rtw + u16 pubq_num; + int ret; + +- ret = set_trx_fifo_info(rtwdev); ++ ret = rtw_set_trx_fifo_info(rtwdev); + if (ret) + return ret; + +--- a/drivers/net/wireless/realtek/rtw88/mac.h ++++ b/drivers/net/wireless/realtek/rtw88/mac.h +@@ -30,11 +30,14 @@ + + void rtw_set_channel_mac(struct rtw_dev *rtwdev, u8 channel, u8 bw, + u8 primary_ch_idx); ++int rtw_pwr_seq_parser(struct rtw_dev *rtwdev, ++ const struct rtw_pwr_seq_cmd * const *cmd_seq); + int rtw_mac_power_on(struct rtw_dev *rtwdev); + void rtw_mac_power_off(struct rtw_dev *rtwdev); + int rtw_download_firmware(struct rtw_dev *rtwdev, struct rtw_fw_state *fw); + int rtw_mac_init(struct rtw_dev *rtwdev); + void rtw_mac_flush_queues(struct rtw_dev *rtwdev, u32 queues, bool drop); ++int rtw_set_trx_fifo_info(struct rtw_dev *rtwdev); + int rtw_ddma_to_fw_fifo(struct rtw_dev *rtwdev, u32 ocp_src, u32 size); + + static inline void rtw_mac_flush_all_queues(struct rtw_dev *rtwdev, bool drop) +--- a/drivers/net/wireless/realtek/rtw88/main.c ++++ b/drivers/net/wireless/realtek/rtw88/main.c +@@ -1309,7 +1309,7 @@ void rtw_update_sta_info(struct rtw_dev + rtw_fw_send_ra_info(rtwdev, si, reset_ra_mask); + } + +-static int rtw_wait_firmware_completion(struct rtw_dev *rtwdev) ++int rtw_wait_firmware_completion(struct rtw_dev *rtwdev) + { + const struct rtw_chip_info *chip = rtwdev->chip; + struct rtw_fw_state *fw; +@@ -1329,6 +1329,7 @@ static int rtw_wait_firmware_completion( + + return ret; + } ++EXPORT_SYMBOL(rtw_wait_firmware_completion); + + static enum rtw_lps_deep_mode rtw_update_lps_deep_mode(struct rtw_dev *rtwdev, + struct rtw_fw_state *fw) +@@ -1350,7 +1351,7 @@ static enum rtw_lps_deep_mode rtw_update + return LPS_DEEP_MODE_NONE; + } + +-static int rtw_power_on(struct rtw_dev *rtwdev) ++int rtw_power_on(struct rtw_dev *rtwdev) + { + const struct rtw_chip_info *chip = rtwdev->chip; + struct rtw_fw_state *fw = &rtwdev->fw; +@@ -1413,6 +1414,7 @@ err_off: + err: + return ret; + } ++EXPORT_SYMBOL(rtw_power_on); + + void rtw_core_fw_scan_notify(struct rtw_dev *rtwdev, bool start) + { +@@ -1485,7 +1487,7 @@ int rtw_core_start(struct rtw_dev *rtwde + { + int ret; + +- ret = rtw_power_on(rtwdev); ++ ret = rtwdev->chip->ops->power_on(rtwdev); + if (ret) + return ret; + +@@ -1505,12 +1507,13 @@ int rtw_core_start(struct rtw_dev *rtwde + return 0; + } + +-static void rtw_power_off(struct rtw_dev *rtwdev) ++void rtw_power_off(struct rtw_dev *rtwdev) + { + rtw_hci_stop(rtwdev); + rtw_coex_power_off_setting(rtwdev); + rtw_mac_power_off(rtwdev); + } ++EXPORT_SYMBOL(rtw_power_off); + + void rtw_core_stop(struct rtw_dev *rtwdev) + { +@@ -1535,7 +1538,7 @@ void rtw_core_stop(struct rtw_dev *rtwde + + mutex_lock(&rtwdev->mutex); + +- rtw_power_off(rtwdev); ++ rtwdev->chip->ops->power_off(rtwdev); + } + + static void rtw_init_ht_cap(struct rtw_dev *rtwdev, +--- a/drivers/net/wireless/realtek/rtw88/main.h ++++ b/drivers/net/wireless/realtek/rtw88/main.h +@@ -843,6 +843,8 @@ struct rtw_regd { + }; + + struct rtw_chip_ops { ++ int (*power_on)(struct rtw_dev *rtwdev); ++ void (*power_off)(struct rtw_dev *rtwdev); + int (*mac_init)(struct rtw_dev *rtwdev); + int (*dump_fw_crash)(struct rtw_dev *rtwdev); + void (*shutdown)(struct rtw_dev *rtwdev); +@@ -2209,6 +2211,7 @@ void rtw_core_scan_start(struct rtw_dev + void rtw_core_scan_complete(struct rtw_dev *rtwdev, struct ieee80211_vif *vif, + bool hw_scan); + int rtw_core_start(struct rtw_dev *rtwdev); ++void rtw_power_off(struct rtw_dev *rtwdev); + void rtw_core_stop(struct rtw_dev *rtwdev); + int rtw_chip_info_setup(struct rtw_dev *rtwdev); + int rtw_core_init(struct rtw_dev *rtwdev); +@@ -2223,6 +2226,8 @@ int rtw_sta_add(struct rtw_dev *rtwdev, + void rtw_sta_remove(struct rtw_dev *rtwdev, struct ieee80211_sta *sta, + bool fw_exist); + void rtw_fw_recovery(struct rtw_dev *rtwdev); ++int rtw_wait_firmware_completion(struct rtw_dev *rtwdev); ++int rtw_power_on(struct rtw_dev *rtwdev); + void rtw_core_fw_scan_notify(struct rtw_dev *rtwdev, bool start); + int rtw_dump_fw(struct rtw_dev *rtwdev, const u32 ocp_src, u32 size, + u32 fwcd_item); +--- a/drivers/net/wireless/realtek/rtw88/rtw8703b.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8703b.c +@@ -1888,6 +1888,8 @@ static const struct coex_tdma_para tdma_ + }; + + static const struct rtw_chip_ops rtw8703b_ops = { ++ .power_on = rtw_power_on, ++ .power_off = rtw_power_off, + .mac_init = rtw8723x_mac_init, + .dump_fw_crash = NULL, + .shutdown = NULL, +--- a/drivers/net/wireless/realtek/rtw88/rtw8723d.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8723d.c +@@ -1390,6 +1390,8 @@ static void rtw8723d_pwr_track(struct rt + } + + static const struct rtw_chip_ops rtw8723d_ops = { ++ .power_on = rtw_power_on, ++ .power_off = rtw_power_off, + .phy_set_param = rtw8723d_phy_set_param, + .read_efuse = rtw8723x_read_efuse, + .query_phy_status = query_phy_status, +--- a/drivers/net/wireless/realtek/rtw88/rtw8821c.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8821c.c +@@ -1643,6 +1643,8 @@ static const struct rtw_prioq_addrs prio + }; + + static const struct rtw_chip_ops rtw8821c_ops = { ++ .power_on = rtw_power_on, ++ .power_off = rtw_power_off, + .phy_set_param = rtw8821c_phy_set_param, + .read_efuse = rtw8821c_read_efuse, + .query_phy_status = query_phy_status, +--- a/drivers/net/wireless/realtek/rtw88/rtw8822b.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8822b.c +@@ -2132,6 +2132,8 @@ static const struct rtw_prioq_addrs prio + }; + + static const struct rtw_chip_ops rtw8822b_ops = { ++ .power_on = rtw_power_on, ++ .power_off = rtw_power_off, + .phy_set_param = rtw8822b_phy_set_param, + .read_efuse = rtw8822b_read_efuse, + .query_phy_status = query_phy_status, +--- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c +@@ -4947,6 +4947,8 @@ static const struct rtw_prioq_addrs prio + }; + + static const struct rtw_chip_ops rtw8822c_ops = { ++ .power_on = rtw_power_on, ++ .power_off = rtw_power_off, + .phy_set_param = rtw8822c_phy_set_param, + .read_efuse = rtw8822c_read_efuse, + .query_phy_status = query_phy_status, diff --git a/package/kernel/mac80211/patches/rtl/030-v6.13-wifi-rtw88-Enable-data-rate-fallback-for-older-chips.patch b/package/kernel/mac80211/patches/rtl/030-v6.13-wifi-rtw88-Enable-data-rate-fallback-for-older-chips.patch new file mode 100644 index 00000000000000..153c04ee20fd60 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/030-v6.13-wifi-rtw88-Enable-data-rate-fallback-for-older-chips.patch @@ -0,0 +1,194 @@ +From c7706b1173c77185a2ef40c7d1811021566563f3 Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Wed, 23 Oct 2024 17:10:32 +0300 +Subject: [PATCH] wifi: rtw88: Enable data rate fallback for older chips + +RTL8811AU fails to perform the 4-way handshake when the AP is too far +because it transmits the EAPOL frames at MCS9 and when that doesn't +work it retries 48 times with the same rate, to no avail. + +Retrying 48 times with the same rate seems pointless. Set the +appropriate field in the TX descriptor to allow it to use lower rates +when retrying. + +Set it for RTL8723D and RTL8703B because they interpret this field the +same way as RTL8811A. + +The newer RTL8822C, RTL8822B, RTL8821C seem to interpret this field in +the TX descriptor differently, so leave it alone for those chips. + +Tested with RTL8811AU and RTL8723DU. + +Signed-off-by: Bitterblue Smith +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/2b3e3e6f-541b-4a3b-8ca3-65b267e6a95a@gmail.com +--- + drivers/net/wireless/realtek/rtw88/fw.c | 2 +- + drivers/net/wireless/realtek/rtw88/main.h | 1 + + drivers/net/wireless/realtek/rtw88/pci.c | 2 +- + drivers/net/wireless/realtek/rtw88/rtw8703b.c | 1 + + drivers/net/wireless/realtek/rtw88/rtw8723d.c | 1 + + drivers/net/wireless/realtek/rtw88/rtw8821c.c | 1 + + drivers/net/wireless/realtek/rtw88/rtw8822b.c | 1 + + drivers/net/wireless/realtek/rtw88/rtw8822c.c | 1 + + drivers/net/wireless/realtek/rtw88/sdio.c | 2 +- + drivers/net/wireless/realtek/rtw88/tx.c | 6 +++++- + drivers/net/wireless/realtek/rtw88/tx.h | 4 +++- + drivers/net/wireless/realtek/rtw88/usb.c | 4 ++-- + 12 files changed, 19 insertions(+), 7 deletions(-) + +--- a/drivers/net/wireless/realtek/rtw88/fw.c ++++ b/drivers/net/wireless/realtek/rtw88/fw.c +@@ -1290,7 +1290,7 @@ static void rtw_fill_rsvd_page_desc(stru + rtw_tx_rsvd_page_pkt_info_update(rtwdev, &pkt_info, skb, type); + pkt_desc = skb_push(skb, chip->tx_pkt_desc_sz); + memset(pkt_desc, 0, chip->tx_pkt_desc_sz); +- rtw_tx_fill_tx_desc(&pkt_info, skb); ++ rtw_tx_fill_tx_desc(rtwdev, &pkt_info, skb); + } + + static inline u8 rtw_len_to_page(unsigned int len, u8 page_size) +--- a/drivers/net/wireless/realtek/rtw88/main.h ++++ b/drivers/net/wireless/realtek/rtw88/main.h +@@ -1204,6 +1204,7 @@ struct rtw_chip_info { + u8 usb_tx_agg_desc_num; + bool hw_feature_report; + u8 c2h_ra_report_size; ++ bool old_datarate_fb_limit; + + u8 default_1ss_tx_path; + +--- a/drivers/net/wireless/realtek/rtw88/pci.c ++++ b/drivers/net/wireless/realtek/rtw88/pci.c +@@ -824,7 +824,7 @@ static int rtw_pci_tx_write_data(struct + pkt_desc = skb_push(skb, chip->tx_pkt_desc_sz); + memset(pkt_desc, 0, tx_pkt_desc_sz); + pkt_info->qsel = rtw_pci_get_tx_qsel(skb, queue); +- rtw_tx_fill_tx_desc(pkt_info, skb); ++ rtw_tx_fill_tx_desc(rtwdev, pkt_info, skb); + dma = dma_map_single(&rtwpci->pdev->dev, skb->data, skb->len, + DMA_TO_DEVICE); + if (dma_mapping_error(&rtwpci->pdev->dev, dma)) +--- a/drivers/net/wireless/realtek/rtw88/rtw8703b.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8703b.c +@@ -1964,6 +1964,7 @@ const struct rtw_chip_info rtw8703b_hw_s + .usb_tx_agg_desc_num = 1, /* Not sure if this chip has USB interface */ + .hw_feature_report = true, + .c2h_ra_report_size = 7, ++ .old_datarate_fb_limit = true, + + .path_div_supported = false, + .ht_supported = true, +--- a/drivers/net/wireless/realtek/rtw88/rtw8723d.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8723d.c +@@ -2135,6 +2135,7 @@ const struct rtw_chip_info rtw8723d_hw_s + .usb_tx_agg_desc_num = 1, + .hw_feature_report = true, + .c2h_ra_report_size = 7, ++ .old_datarate_fb_limit = true, + .ht_supported = true, + .vht_supported = false, + .lps_deep_mode_supported = 0, +--- a/drivers/net/wireless/realtek/rtw88/rtw8821c.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8821c.c +@@ -1972,6 +1972,7 @@ const struct rtw_chip_info rtw8821c_hw_s + .usb_tx_agg_desc_num = 3, + .hw_feature_report = true, + .c2h_ra_report_size = 7, ++ .old_datarate_fb_limit = false, + .ht_supported = true, + .vht_supported = true, + .lps_deep_mode_supported = BIT(LPS_DEEP_MODE_LCLK), +--- a/drivers/net/wireless/realtek/rtw88/rtw8822b.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8822b.c +@@ -2513,6 +2513,7 @@ const struct rtw_chip_info rtw8822b_hw_s + .usb_tx_agg_desc_num = 3, + .hw_feature_report = true, + .c2h_ra_report_size = 7, ++ .old_datarate_fb_limit = false, + .ht_supported = true, + .vht_supported = true, + .lps_deep_mode_supported = BIT(LPS_DEEP_MODE_LCLK), +--- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c +@@ -5333,6 +5333,7 @@ const struct rtw_chip_info rtw8822c_hw_s + .usb_tx_agg_desc_num = 3, + .hw_feature_report = true, + .c2h_ra_report_size = 7, ++ .old_datarate_fb_limit = false, + .default_1ss_tx_path = BB_PATH_A, + .path_div_supported = true, + .ht_supported = true, +--- a/drivers/net/wireless/realtek/rtw88/sdio.c ++++ b/drivers/net/wireless/realtek/rtw88/sdio.c +@@ -864,7 +864,7 @@ static void rtw_sdio_tx_skb_prepare(stru + + pkt_info->qsel = rtw_sdio_get_tx_qsel(rtwdev, skb, queue); + +- rtw_tx_fill_tx_desc(pkt_info, skb); ++ rtw_tx_fill_tx_desc(rtwdev, pkt_info, skb); + rtw_tx_fill_txdesc_checksum(rtwdev, pkt_info, pkt_desc); + } + +--- a/drivers/net/wireless/realtek/rtw88/tx.c ++++ b/drivers/net/wireless/realtek/rtw88/tx.c +@@ -32,7 +32,8 @@ void rtw_tx_stats(struct rtw_dev *rtwdev + } + } + +-void rtw_tx_fill_tx_desc(struct rtw_tx_pkt_info *pkt_info, struct sk_buff *skb) ++void rtw_tx_fill_tx_desc(struct rtw_dev *rtwdev, ++ struct rtw_tx_pkt_info *pkt_info, struct sk_buff *skb) + { + struct rtw_tx_desc *tx_desc = (struct rtw_tx_desc *)skb->data; + bool more_data = false; +@@ -67,6 +68,9 @@ void rtw_tx_fill_tx_desc(struct rtw_tx_p + + tx_desc->w4 = le32_encode_bits(pkt_info->rate, RTW_TX_DESC_W4_DATARATE); + ++ if (rtwdev->chip->old_datarate_fb_limit) ++ tx_desc->w4 |= le32_encode_bits(0x1f, RTW_TX_DESC_W4_DATARATE_FB_LIMIT); ++ + tx_desc->w5 = le32_encode_bits(pkt_info->short_gi, RTW_TX_DESC_W5_DATA_SHORT) | + le32_encode_bits(pkt_info->bw, RTW_TX_DESC_W5_DATA_BW) | + le32_encode_bits(pkt_info->ldpc, RTW_TX_DESC_W5_DATA_LDPC) | +--- a/drivers/net/wireless/realtek/rtw88/tx.h ++++ b/drivers/net/wireless/realtek/rtw88/tx.h +@@ -44,6 +44,7 @@ struct rtw_tx_desc { + #define RTW_TX_DESC_W3_NAVUSEHDR BIT(15) + #define RTW_TX_DESC_W3_MAX_AGG_NUM GENMASK(21, 17) + #define RTW_TX_DESC_W4_DATARATE GENMASK(6, 0) ++#define RTW_TX_DESC_W4_DATARATE_FB_LIMIT GENMASK(12, 8) + #define RTW_TX_DESC_W4_RTSRATE GENMASK(28, 24) + #define RTW_TX_DESC_W5_DATA_SHORT BIT(4) + #define RTW_TX_DESC_W5_DATA_BW GENMASK(6, 5) +@@ -94,7 +95,8 @@ void rtw_tx_pkt_info_update(struct rtw_d + struct rtw_tx_pkt_info *pkt_info, + struct ieee80211_sta *sta, + struct sk_buff *skb); +-void rtw_tx_fill_tx_desc(struct rtw_tx_pkt_info *pkt_info, struct sk_buff *skb); ++void rtw_tx_fill_tx_desc(struct rtw_dev *rtwdev, ++ struct rtw_tx_pkt_info *pkt_info, struct sk_buff *skb); + void rtw_tx_report_enqueue(struct rtw_dev *rtwdev, struct sk_buff *skb, u8 sn); + void rtw_tx_report_handle(struct rtw_dev *rtwdev, struct sk_buff *skb, int src); + void rtw_tx_rsvd_page_pkt_info_update(struct rtw_dev *rtwdev, +--- a/drivers/net/wireless/realtek/rtw88/usb.c ++++ b/drivers/net/wireless/realtek/rtw88/usb.c +@@ -457,7 +457,7 @@ static int rtw_usb_write_data(struct rtw + skb_put_data(skb, buf, size); + skb_push(skb, chip->tx_pkt_desc_sz); + memset(skb->data, 0, chip->tx_pkt_desc_sz); +- rtw_tx_fill_tx_desc(pkt_info, skb); ++ rtw_tx_fill_tx_desc(rtwdev, pkt_info, skb); + rtw_tx_fill_txdesc_checksum(rtwdev, pkt_info, skb->data); + + ret = rtw_usb_write_port(rtwdev, qsel, skb, +@@ -524,7 +524,7 @@ static int rtw_usb_tx_write(struct rtw_d + pkt_desc = skb_push(skb, chip->tx_pkt_desc_sz); + memset(pkt_desc, 0, chip->tx_pkt_desc_sz); + ep = qsel_to_ep(rtwusb, pkt_info->qsel); +- rtw_tx_fill_tx_desc(pkt_info, skb); ++ rtw_tx_fill_tx_desc(rtwdev, pkt_info, skb); + rtw_tx_fill_txdesc_checksum(rtwdev, pkt_info, skb->data); + tx_data = rtw_usb_get_tx_data(skb); + tx_data->sn = pkt_info->sn; diff --git a/package/kernel/mac80211/patches/rtl/031-v6.13-wifi-rtw88-Make-txagc_remnant_ofdm-an-array.patch b/package/kernel/mac80211/patches/rtl/031-v6.13-wifi-rtw88-Make-txagc_remnant_ofdm-an-array.patch new file mode 100644 index 00000000000000..10fc773b47fe5c --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/031-v6.13-wifi-rtw88-Make-txagc_remnant_ofdm-an-array.patch @@ -0,0 +1,85 @@ +From abb0f19492ba6289ffba6ec1057c0426240958af Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Wed, 23 Oct 2024 17:10:54 +0300 +Subject: [PATCH] wifi: rtw88: Make txagc_remnant_ofdm an array + +txagc_remnant_ofdm member of struct rtw_dm_info should be different for +each RF path, so make it an array of size RTW_RF_PATH_MAX (4). + +Until now all the chips using this had only one RF path, but RTL8812AU +has two, and RTL8814AU has four. + +Signed-off-by: Bitterblue Smith +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/68571ba9-e504-4b2d-bfa1-62f468753649@gmail.com +--- + drivers/net/wireless/realtek/rtw88/main.h | 2 +- + drivers/net/wireless/realtek/rtw88/phy.c | 4 ++-- + drivers/net/wireless/realtek/rtw88/rtw8703b.c | 4 ++-- + drivers/net/wireless/realtek/rtw88/rtw8723d.c | 4 ++-- + 4 files changed, 7 insertions(+), 7 deletions(-) + +--- a/drivers/net/wireless/realtek/rtw88/main.h ++++ b/drivers/net/wireless/realtek/rtw88/main.h +@@ -1715,7 +1715,7 @@ struct rtw_dm_info { + bool pwr_trk_init_trigger; + struct ewma_thermal avg_thermal[RTW_RF_PATH_MAX]; + s8 txagc_remnant_cck; +- s8 txagc_remnant_ofdm; ++ s8 txagc_remnant_ofdm[RTW_RF_PATH_MAX]; + u8 rx_cck_agc_report_type; + + /* backup dack results for each path and I/Q */ +--- a/drivers/net/wireless/realtek/rtw88/phy.c ++++ b/drivers/net/wireless/realtek/rtw88/phy.c +@@ -2169,8 +2169,8 @@ void rtw_get_tx_power_params(struct rtw_ + + *limit = rtw_phy_get_tx_power_limit(rtwdev, band, bw, path, + rate, ch, regd); +- *remnant = (rate <= DESC_RATE11M ? dm_info->txagc_remnant_cck : +- dm_info->txagc_remnant_ofdm); ++ *remnant = rate <= DESC_RATE11M ? dm_info->txagc_remnant_cck : ++ dm_info->txagc_remnant_ofdm[path]; + *sar = rtw_phy_get_tx_power_sar(rtwdev, hal->sar_band, path, rate); + } + +--- a/drivers/net/wireless/realtek/rtw88/rtw8703b.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8703b.c +@@ -637,7 +637,7 @@ static void rtw8703b_pwrtrack_init(struc + dm_info->pwr_trk_init_trigger = true; + dm_info->thermal_meter_k = rtwdev->efuse.thermal_meter_k; + dm_info->txagc_remnant_cck = 0; +- dm_info->txagc_remnant_ofdm = 0; ++ dm_info->txagc_remnant_ofdm[RF_PATH_A] = 0; + } + + static void rtw8703b_phy_set_param(struct rtw_dev *rtwdev) +@@ -1589,7 +1589,7 @@ static void rtw8703b_pwrtrack_set_ofdm_p + { + struct rtw_dm_info *dm_info = &rtwdev->dm_info; + +- dm_info->txagc_remnant_ofdm = txagc_idx; ++ dm_info->txagc_remnant_ofdm[RF_PATH_A] = txagc_idx; + + /* Only path A is calibrated for rtl8703b */ + rtw8703b_set_iqk_matrix(rtwdev, swing_idx, RF_PATH_A); +--- a/drivers/net/wireless/realtek/rtw88/rtw8723d.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8723d.c +@@ -79,7 +79,7 @@ static void rtw8723d_pwrtrack_init(struc + dm_info->pwr_trk_init_trigger = true; + dm_info->thermal_meter_k = rtwdev->efuse.thermal_meter_k; + dm_info->txagc_remnant_cck = 0; +- dm_info->txagc_remnant_ofdm = 0; ++ dm_info->txagc_remnant_ofdm[RF_PATH_A] = 0; + } + + static void rtw8723d_phy_set_param(struct rtw_dev *rtwdev) +@@ -1265,7 +1265,7 @@ static void rtw8723d_pwrtrack_set_ofdm_p + { + struct rtw_dm_info *dm_info = &rtwdev->dm_info; + +- dm_info->txagc_remnant_ofdm = txagc_idx; ++ dm_info->txagc_remnant_ofdm[RF_PATH_A] = txagc_idx; + + rtw8723d_set_iqk_matrix(rtwdev, swing_idx, RF_PATH_A); + rtw8723d_set_iqk_matrix(rtwdev, swing_idx, RF_PATH_B); diff --git a/package/kernel/mac80211/patches/rtl/032-v6.13-wifi-rtw88-Support-TX-page-sizes-bigger-than-128.patch b/package/kernel/mac80211/patches/rtl/032-v6.13-wifi-rtw88-Support-TX-page-sizes-bigger-than-128.patch new file mode 100644 index 00000000000000..7d77e0e67173e7 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/032-v6.13-wifi-rtw88-Support-TX-page-sizes-bigger-than-128.patch @@ -0,0 +1,115 @@ +From 82a617413e8545775ec03a1970809ac5f549ef32 Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Wed, 23 Oct 2024 17:12:06 +0300 +Subject: [PATCH] wifi: rtw88: Support TX page sizes bigger than 128 + +All the chips supported so far have a TX page size of 128 bytes. + +Change the type of the page_size member of struct rtw_chip_info from u8 +to u16 in order to support RTL8821AU (page size of 256 bytes) and +RTL8812AU (page size of 512 bytes). Also change the types of several +related variables and function parameters from u8 to u16. + +The TX page size is used, among other things, to construct the beacon, +null data, QOS null data, and PS poll templates which are uploaded to +the chip's reserved page. Each template needs to be aligned on a +multiple of the TX page size. Power saving can't work if the TX page +size is wrong. + +Signed-off-by: Bitterblue Smith +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/acdefbb1-3daf-4349-9e03-9472754d5f1e@gmail.com +--- + drivers/net/wireless/realtek/rtw88/debug.c | 2 +- + drivers/net/wireless/realtek/rtw88/fw.c | 21 +++++++++++---------- + drivers/net/wireless/realtek/rtw88/mac.c | 2 +- + drivers/net/wireless/realtek/rtw88/main.h | 2 +- + 4 files changed, 14 insertions(+), 13 deletions(-) + +--- a/drivers/net/wireless/realtek/rtw88/debug.c ++++ b/drivers/net/wireless/realtek/rtw88/debug.c +@@ -308,7 +308,7 @@ static int rtw_debugfs_get_rsvd_page(str + { + struct rtw_debugfs_priv *debugfs_priv = m->private; + struct rtw_dev *rtwdev = debugfs_priv->rtwdev; +- u8 page_size = rtwdev->chip->page_size; ++ u16 page_size = rtwdev->chip->page_size; + u32 buf_size = debugfs_priv->rsvd_page.page_num * page_size; + u32 offset = debugfs_priv->rsvd_page.page_offset * page_size; + u8 *buf; +--- a/drivers/net/wireless/realtek/rtw88/fw.c ++++ b/drivers/net/wireless/realtek/rtw88/fw.c +@@ -1293,13 +1293,13 @@ static void rtw_fill_rsvd_page_desc(stru + rtw_tx_fill_tx_desc(rtwdev, &pkt_info, skb); + } + +-static inline u8 rtw_len_to_page(unsigned int len, u8 page_size) ++static inline u8 rtw_len_to_page(unsigned int len, u16 page_size) + { + return DIV_ROUND_UP(len, page_size); + } + +-static void rtw_rsvd_page_list_to_buf(struct rtw_dev *rtwdev, u8 page_size, +- u8 page_margin, u32 page, u8 *buf, ++static void rtw_rsvd_page_list_to_buf(struct rtw_dev *rtwdev, u16 page_size, ++ u16 page_margin, u32 page, u8 *buf, + struct rtw_rsvd_page *rsvd_pkt) + { + struct sk_buff *skb = rsvd_pkt->skb; +@@ -1601,13 +1601,13 @@ static int __rtw_build_rsvd_page_from_v + + static u8 *rtw_build_rsvd_page(struct rtw_dev *rtwdev, u32 *size) + { +- struct ieee80211_hw *hw = rtwdev->hw; + const struct rtw_chip_info *chip = rtwdev->chip; +- struct sk_buff *iter; ++ struct ieee80211_hw *hw = rtwdev->hw; + struct rtw_rsvd_page *rsvd_pkt; +- u32 page = 0; ++ struct sk_buff *iter; ++ u16 page_size, page_margin, tx_desc_sz; + u8 total_page = 0; +- u8 page_size, page_margin, tx_desc_sz; ++ u32 page = 0; + u8 *buf; + int ret; + +@@ -2013,12 +2013,13 @@ static int _rtw_hw_scan_update_probe_req + { + const struct rtw_chip_info *chip = rtwdev->chip; + struct sk_buff *skb, *tmp; +- u8 page_offset = 1, *buf, page_size = chip->page_size; + u16 pg_addr = rtwdev->fifo.rsvd_h2c_info_addr, loc; +- u16 buf_offset = page_size * page_offset; + u8 tx_desc_sz = chip->tx_pkt_desc_sz; +- u8 page_cnt, pages; ++ u16 page_size = chip->page_size; ++ u8 page_offset = 1, *buf; ++ u16 buf_offset = page_size * page_offset; + unsigned int pkt_len; ++ u8 page_cnt, pages; + int ret; + + if (rtw_fw_feature_ext_check(&rtwdev->fw, FW_FEATURE_EXT_OLD_PAGE_NUM)) +--- a/drivers/net/wireless/realtek/rtw88/mac.c ++++ b/drivers/net/wireless/realtek/rtw88/mac.c +@@ -1138,7 +1138,7 @@ int rtw_set_trx_fifo_info(struct rtw_dev + + /* config rsvd page num */ + fifo->rsvd_drv_pg_num = chip->rsvd_drv_pg_num; +- fifo->txff_pg_num = chip->txff_size >> 7; ++ fifo->txff_pg_num = chip->txff_size / chip->page_size; + if (rtw_chip_wcpu_11n(rtwdev)) + fifo->rsvd_pg_num = fifo->rsvd_drv_pg_num; + else +--- a/drivers/net/wireless/realtek/rtw88/main.h ++++ b/drivers/net/wireless/realtek/rtw88/main.h +@@ -1187,7 +1187,7 @@ struct rtw_chip_info { + u32 fw_rxff_size; + u16 rsvd_drv_pg_num; + u8 band; +- u8 page_size; ++ u16 page_size; + u8 csi_buf_pg_num; + u8 dig_max; + u8 dig_min; diff --git a/package/kernel/mac80211/patches/rtl/033-v6.13-wifi-rtw88-Move-pwr_track_tbl-to-struct-rtw_rfe_def.patch b/package/kernel/mac80211/patches/rtl/033-v6.13-wifi-rtw88-Move-pwr_track_tbl-to-struct-rtw_rfe_def.patch new file mode 100644 index 00000000000000..cda3e7a56e0079 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/033-v6.13-wifi-rtw88-Move-pwr_track_tbl-to-struct-rtw_rfe_def.patch @@ -0,0 +1,297 @@ +From 67d915604e6993ff627ac001983a2de63ff71b13 Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Wed, 23 Oct 2024 17:12:39 +0300 +Subject: [PATCH] wifi: rtw88: Move pwr_track_tbl to struct rtw_rfe_def + +RTL8812AU uses one set of TX power tracking tables for RFE 3, and +another set for everything else. + +Move pwr_track_tbl from struct rtw_chip_info to struct rtw_rfe_def in +order to load the right set of tables for each RFE (RF front end) type. + +Signed-off-by: Bitterblue Smith +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/904d0ab1-c046-40cd-a3a3-d4fdcf663c9d@gmail.com +--- + drivers/net/wireless/realtek/rtw88/main.h | 8 ++++--- + drivers/net/wireless/realtek/rtw88/phy.c | 3 ++- + drivers/net/wireless/realtek/rtw88/rtw8703b.c | 12 +++++----- + drivers/net/wireless/realtek/rtw88/rtw8723d.c | 12 +++++----- + drivers/net/wireless/realtek/rtw88/rtw8723x.c | 3 ++- + drivers/net/wireless/realtek/rtw88/rtw8821c.c | 17 +++++++------- + drivers/net/wireless/realtek/rtw88/rtw8822b.c | 15 ++++++------ + drivers/net/wireless/realtek/rtw88/rtw8822c.c | 23 +++++++++---------- + 8 files changed, 47 insertions(+), 46 deletions(-) + +--- a/drivers/net/wireless/realtek/rtw88/main.h ++++ b/drivers/net/wireless/realtek/rtw88/main.h +@@ -1099,17 +1099,20 @@ enum rtw_rfe_fem { + struct rtw_rfe_def { + const struct rtw_table *phy_pg_tbl; + const struct rtw_table *txpwr_lmt_tbl; ++ const struct rtw_pwr_track_tbl *pwr_track_tbl; + const struct rtw_table *agc_btg_tbl; + }; + +-#define RTW_DEF_RFE(chip, bb_pg, pwrlmt) { \ ++#define RTW_DEF_RFE(chip, bb_pg, pwrlmt, track) { \ + .phy_pg_tbl = &rtw ## chip ## _bb_pg_type ## bb_pg ## _tbl, \ + .txpwr_lmt_tbl = &rtw ## chip ## _txpwr_lmt_type ## pwrlmt ## _tbl, \ ++ .pwr_track_tbl = &rtw ## chip ## _pwr_track_type ## track ## _tbl, \ + } + +-#define RTW_DEF_RFE_EXT(chip, bb_pg, pwrlmt, btg) { \ ++#define RTW_DEF_RFE_EXT(chip, bb_pg, pwrlmt, track, btg) { \ + .phy_pg_tbl = &rtw ## chip ## _bb_pg_type ## bb_pg ## _tbl, \ + .txpwr_lmt_tbl = &rtw ## chip ## _txpwr_lmt_type ## pwrlmt ## _tbl, \ ++ .pwr_track_tbl = &rtw ## chip ## _pwr_track_type ## track ## _tbl, \ + .agc_btg_tbl = &rtw ## chip ## _agc_btg_type ## btg ## _tbl, \ + } + +@@ -1243,7 +1246,6 @@ struct rtw_chip_info { + u16 dpd_ratemask; + u8 iqk_threshold; + u8 lck_threshold; +- const struct rtw_pwr_track_tbl *pwr_track_tbl; + + u8 bfer_su_max_num; + u8 bfer_mu_max_num; +--- a/drivers/net/wireless/realtek/rtw88/phy.c ++++ b/drivers/net/wireless/realtek/rtw88/phy.c +@@ -2384,7 +2384,8 @@ void rtw_phy_init_tx_power(struct rtw_de + void rtw_phy_config_swing_table(struct rtw_dev *rtwdev, + struct rtw_swing_table *swing_table) + { +- const struct rtw_pwr_track_tbl *tbl = rtwdev->chip->pwr_track_tbl; ++ const struct rtw_rfe_def *rfe_def = rtw_get_rfe_def(rtwdev); ++ const struct rtw_pwr_track_tbl *tbl = rfe_def->pwr_track_tbl; + u8 channel = rtwdev->hal.current_channel; + + if (IS_CH_2G_BAND(channel)) { +--- a/drivers/net/wireless/realtek/rtw88/rtw8703b.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8703b.c +@@ -493,11 +493,6 @@ static const struct rtw_pwr_seq_cmd * co + NULL + }; + +-static const struct rtw_rfe_def rtw8703b_rfe_defs[] = { +- [0] = { .phy_pg_tbl = &rtw8703b_bb_pg_tbl, +- .txpwr_lmt_tbl = &rtw8703b_txpwr_lmt_tbl,}, +-}; +- + static const struct rtw_page_table page_table_8703b[] = { + {12, 2, 2, 0, 1}, + {12, 2, 2, 0, 1}, +@@ -1818,6 +1813,12 @@ static const struct rtw_pwr_track_tbl rt + .pwrtrk_xtal_p = rtw8703b_pwrtrk_xtal_p, + }; + ++static const struct rtw_rfe_def rtw8703b_rfe_defs[] = { ++ [0] = { .phy_pg_tbl = &rtw8703b_bb_pg_tbl, ++ .txpwr_lmt_tbl = &rtw8703b_txpwr_lmt_tbl, ++ .pwr_track_tbl = &rtw8703b_rtw_pwr_track_tbl, }, ++}; ++ + /* Shared-Antenna Coex Table */ + static const struct coex_table_para table_sant_8703b[] = { + {0xffffffff, 0xffffffff}, /* case-0 */ +@@ -1997,7 +1998,6 @@ const struct rtw_chip_info rtw8703b_hw_s + .rfe_defs_size = ARRAY_SIZE(rtw8703b_rfe_defs), + + .iqk_threshold = 8, +- .pwr_track_tbl = &rtw8703b_rtw_pwr_track_tbl, + + /* WOWLAN firmware exists, but not implemented yet */ + .wow_fw_name = "rtw88/rtw8703b_wow_fw.bin", +--- a/drivers/net/wireless/realtek/rtw88/rtw8723d.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8723d.c +@@ -2020,11 +2020,6 @@ static const struct rtw_intf_phy_para_ta + .n_gen1_para = ARRAY_SIZE(pcie_gen1_param_8723d), + }; + +-static const struct rtw_rfe_def rtw8723d_rfe_defs[] = { +- [0] = { .phy_pg_tbl = &rtw8723d_bb_pg_tbl, +- .txpwr_lmt_tbl = &rtw8723d_txpwr_lmt_tbl,}, +-}; +- + static const u8 rtw8723d_pwrtrk_2gb_n[] = { + 0, 0, 1, 1, 1, 2, 2, 3, 4, 4, 4, 4, 5, 5, 5, + 6, 6, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 10, 10 +@@ -2088,6 +2083,12 @@ static const struct rtw_pwr_track_tbl rt + .pwrtrk_xtal_n = rtw8723d_pwrtrk_xtal_n, + }; + ++static const struct rtw_rfe_def rtw8723d_rfe_defs[] = { ++ [0] = { .phy_pg_tbl = &rtw8723d_bb_pg_tbl, ++ .txpwr_lmt_tbl = &rtw8723d_txpwr_lmt_tbl, ++ .pwr_track_tbl = &rtw8723d_rtw_pwr_track_tbl, }, ++}; ++ + static const struct rtw_reg_domain coex_info_hw_regs_8723d[] = { + {0x948, MASKDWORD, RTW_REG_DOMAIN_MAC32}, + {0x67, BIT(7), RTW_REG_DOMAIN_MAC8}, +@@ -2159,7 +2160,6 @@ const struct rtw_chip_info rtw8723d_hw_s + .rfe_defs = rtw8723d_rfe_defs, + .rfe_defs_size = ARRAY_SIZE(rtw8723d_rfe_defs), + .rx_ldpc = false, +- .pwr_track_tbl = &rtw8723d_rtw_pwr_track_tbl, + .iqk_threshold = 8, + .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, + .max_scan_ie_len = IEEE80211_MAX_DATA_LEN, +--- a/drivers/net/wireless/realtek/rtw88/rtw8723x.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8723x.c +@@ -595,7 +595,8 @@ void __rtw8723x_pwrtrack_set_xtal(struct + u8 delta) + { + struct rtw_dm_info *dm_info = &rtwdev->dm_info; +- const struct rtw_pwr_track_tbl *tbl = rtwdev->chip->pwr_track_tbl; ++ const struct rtw_rfe_def *rfe_def = rtw_get_rfe_def(rtwdev); ++ const struct rtw_pwr_track_tbl *tbl = rfe_def->pwr_track_tbl; + const s8 *pwrtrk_xtal; + s8 xtal_cap; + +--- a/drivers/net/wireless/realtek/rtw88/rtw8821c.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8821c.c +@@ -1581,13 +1581,6 @@ static const struct rtw_intf_phy_para_ta + .n_gen2_para = ARRAY_SIZE(pcie_gen2_param_8821c), + }; + +-static const struct rtw_rfe_def rtw8821c_rfe_defs[] = { +- [0] = RTW_DEF_RFE(8821c, 0, 0), +- [2] = RTW_DEF_RFE_EXT(8821c, 0, 0, 2), +- [4] = RTW_DEF_RFE_EXT(8821c, 0, 0, 2), +- [6] = RTW_DEF_RFE(8821c, 0, 0), +-}; +- + static const struct rtw_hw_reg rtw8821c_dig[] = { + [0] = { .addr = 0xc50, .mask = 0x7f }, + }; +@@ -1899,7 +1892,7 @@ static const u8 rtw8821c_pwrtrk_2g_cck_a + 5, 6, 6, 7, 7, 7, 8, 8, 9, 9, 9, 9, 9, 9 + }; + +-static const struct rtw_pwr_track_tbl rtw8821c_rtw_pwr_track_tbl = { ++static const struct rtw_pwr_track_tbl rtw8821c_pwr_track_type0_tbl = { + .pwrtrk_5gb_n[0] = rtw8821c_pwrtrk_5gb_n[0], + .pwrtrk_5gb_n[1] = rtw8821c_pwrtrk_5gb_n[1], + .pwrtrk_5gb_n[2] = rtw8821c_pwrtrk_5gb_n[2], +@@ -1922,6 +1915,13 @@ static const struct rtw_pwr_track_tbl rt + .pwrtrk_2g_ccka_p = rtw8821c_pwrtrk_2g_cck_a_p, + }; + ++static const struct rtw_rfe_def rtw8821c_rfe_defs[] = { ++ [0] = RTW_DEF_RFE(8821c, 0, 0, 0), ++ [2] = RTW_DEF_RFE_EXT(8821c, 0, 0, 0, 2), ++ [4] = RTW_DEF_RFE_EXT(8821c, 0, 0, 0, 2), ++ [6] = RTW_DEF_RFE(8821c, 0, 0, 0), ++}; ++ + static const struct rtw_reg_domain coex_info_hw_regs_8821c[] = { + {0xCB0, MASKDWORD, RTW_REG_DOMAIN_MAC32}, + {0xCB4, MASKDWORD, RTW_REG_DOMAIN_MAC32}, +@@ -1994,7 +1994,6 @@ const struct rtw_chip_info rtw8821c_hw_s + .rfe_defs = rtw8821c_rfe_defs, + .rfe_defs_size = ARRAY_SIZE(rtw8821c_rfe_defs), + .rx_ldpc = false, +- .pwr_track_tbl = &rtw8821c_rtw_pwr_track_tbl, + .iqk_threshold = 8, + .bfer_su_max_num = 2, + .bfer_mu_max_num = 1, +--- a/drivers/net/wireless/realtek/rtw88/rtw8822b.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8822b.c +@@ -2072,12 +2072,6 @@ static const struct rtw_intf_phy_para_ta + .n_gen2_para = ARRAY_SIZE(pcie_gen2_param_8822b), + }; + +-static const struct rtw_rfe_def rtw8822b_rfe_defs[] = { +- [2] = RTW_DEF_RFE(8822b, 2, 2), +- [3] = RTW_DEF_RFE(8822b, 3, 0), +- [5] = RTW_DEF_RFE(8822b, 5, 5), +-}; +- + static const struct rtw_hw_reg rtw8822b_dig[] = { + [0] = { .addr = 0xc50, .mask = 0x7f }, + [1] = { .addr = 0xe50, .mask = 0x7f }, +@@ -2432,7 +2426,7 @@ static const u8 rtw8822b_pwrtrk_2g_cck_a + 10, 11, 11, 12, 12, 13, 13, 14, 14, 15 + }; + +-static const struct rtw_pwr_track_tbl rtw8822b_rtw_pwr_track_tbl = { ++static const struct rtw_pwr_track_tbl rtw8822b_pwr_track_type0_tbl = { + .pwrtrk_5gb_n[RTW_PWR_TRK_5G_1] = rtw8822b_pwrtrk_5gb_n[RTW_PWR_TRK_5G_1], + .pwrtrk_5gb_n[RTW_PWR_TRK_5G_2] = rtw8822b_pwrtrk_5gb_n[RTW_PWR_TRK_5G_2], + .pwrtrk_5gb_n[RTW_PWR_TRK_5G_3] = rtw8822b_pwrtrk_5gb_n[RTW_PWR_TRK_5G_3], +@@ -2455,6 +2449,12 @@ static const struct rtw_pwr_track_tbl rt + .pwrtrk_2g_ccka_p = rtw8822b_pwrtrk_2g_cck_a_p, + }; + ++static const struct rtw_rfe_def rtw8822b_rfe_defs[] = { ++ [2] = RTW_DEF_RFE(8822b, 2, 2, 0), ++ [3] = RTW_DEF_RFE(8822b, 3, 0, 0), ++ [5] = RTW_DEF_RFE(8822b, 5, 5, 0), ++}; ++ + static const struct rtw_reg_domain coex_info_hw_regs_8822b[] = { + {0xcb0, MASKDWORD, RTW_REG_DOMAIN_MAC32}, + {0xcb4, MASKDWORD, RTW_REG_DOMAIN_MAC32}, +@@ -2535,7 +2535,6 @@ const struct rtw_chip_info rtw8822b_hw_s + .rf_tbl = {&rtw8822b_rf_a_tbl, &rtw8822b_rf_b_tbl}, + .rfe_defs = rtw8822b_rfe_defs, + .rfe_defs_size = ARRAY_SIZE(rtw8822b_rfe_defs), +- .pwr_track_tbl = &rtw8822b_rtw_pwr_track_tbl, + .iqk_threshold = 8, + .bfer_su_max_num = 2, + .bfer_mu_max_num = 1, +--- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c +@@ -4883,16 +4883,6 @@ static const struct rtw_intf_phy_para_ta + .n_gen2_para = ARRAY_SIZE(pcie_gen2_param_8822c), + }; + +-static const struct rtw_rfe_def rtw8822c_rfe_defs[] = { +- [0] = RTW_DEF_RFE(8822c, 0, 0), +- [1] = RTW_DEF_RFE(8822c, 0, 0), +- [2] = RTW_DEF_RFE(8822c, 0, 0), +- [3] = RTW_DEF_RFE(8822c, 0, 0), +- [4] = RTW_DEF_RFE(8822c, 0, 0), +- [5] = RTW_DEF_RFE(8822c, 0, 5), +- [6] = RTW_DEF_RFE(8822c, 0, 0), +-}; +- + static const struct rtw_hw_reg rtw8822c_dig[] = { + [0] = { .addr = 0x1d70, .mask = 0x7f }, + [1] = { .addr = 0x1d70, .mask = 0x7f00 }, +@@ -5238,7 +5228,7 @@ static const u8 rtw8822c_pwrtrk_2g_cck_a + 18, 18, 19, 20, 21, 22, 23, 24, 24, 25 + }; + +-static const struct rtw_pwr_track_tbl rtw8822c_rtw_pwr_track_tbl = { ++static const struct rtw_pwr_track_tbl rtw8822c_pwr_track_type0_tbl = { + .pwrtrk_5gb_n[RTW_PWR_TRK_5G_1] = rtw8822c_pwrtrk_5gb_n[RTW_PWR_TRK_5G_1], + .pwrtrk_5gb_n[RTW_PWR_TRK_5G_2] = rtw8822c_pwrtrk_5gb_n[RTW_PWR_TRK_5G_2], + .pwrtrk_5gb_n[RTW_PWR_TRK_5G_3] = rtw8822c_pwrtrk_5gb_n[RTW_PWR_TRK_5G_3], +@@ -5261,6 +5251,16 @@ static const struct rtw_pwr_track_tbl rt + .pwrtrk_2g_ccka_p = rtw8822c_pwrtrk_2g_cck_a_p, + }; + ++static const struct rtw_rfe_def rtw8822c_rfe_defs[] = { ++ [0] = RTW_DEF_RFE(8822c, 0, 0, 0), ++ [1] = RTW_DEF_RFE(8822c, 0, 0, 0), ++ [2] = RTW_DEF_RFE(8822c, 0, 0, 0), ++ [3] = RTW_DEF_RFE(8822c, 0, 0, 0), ++ [4] = RTW_DEF_RFE(8822c, 0, 0, 0), ++ [5] = RTW_DEF_RFE(8822c, 0, 5, 0), ++ [6] = RTW_DEF_RFE(8822c, 0, 0, 0), ++}; ++ + static const struct rtw_hw_reg_offset rtw8822c_edcca_th[] = { + [EDCCA_TH_L2H_IDX] = { + {.addr = 0x84c, .mask = MASKBYTE2}, .offset = 0x80 +@@ -5360,7 +5360,6 @@ const struct rtw_chip_info rtw8822c_hw_s + .rfe_defs_size = ARRAY_SIZE(rtw8822c_rfe_defs), + .en_dis_dpd = true, + .dpd_ratemask = DIS_DPD_RATEALL, +- .pwr_track_tbl = &rtw8822c_rtw_pwr_track_tbl, + .iqk_threshold = 8, + .lck_threshold = 8, + .bfer_su_max_num = 2, diff --git a/package/kernel/mac80211/patches/rtl/034-v6.13-wifi-rtw88-usb-Set-pkt_info.ls-for-the-reserved-page.patch b/package/kernel/mac80211/patches/rtl/034-v6.13-wifi-rtw88-usb-Set-pkt_info.ls-for-the-reserved-page.patch new file mode 100644 index 00000000000000..7c6e13586080fc --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/034-v6.13-wifi-rtw88-usb-Set-pkt_info.ls-for-the-reserved-page.patch @@ -0,0 +1,27 @@ +From 85bf3041a0ea40a60b5295749268e179f056546a Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Wed, 23 Oct 2024 17:13:10 +0300 +Subject: [PATCH] wifi: rtw88: usb: Set pkt_info.ls for the reserved page + +"ls" meaning "last segment". Without this RTL8812AU can't upload the +reserved page in USB 2 mode. (Somehow it's fine in USB 3 mode.) + +Also tested with RTL8822CU, RTL8812BU, RTL8811CU, RTL8723DU, RTL8811AU. + +Signed-off-by: Bitterblue Smith +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/e443f5d9-4b53-4f64-985c-64313ec80bef@gmail.com +--- + drivers/net/wireless/realtek/rtw88/usb.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/wireless/realtek/rtw88/usb.c ++++ b/drivers/net/wireless/realtek/rtw88/usb.c +@@ -477,6 +477,7 @@ static int rtw_usb_write_data_rsvd_page( + pkt_info.tx_pkt_size = size; + pkt_info.qsel = TX_DESC_QSEL_BEACON; + pkt_info.offset = chip->tx_pkt_desc_sz; ++ pkt_info.ls = true; + + return rtw_usb_write_data(rtwdev, &pkt_info, buf); + } diff --git a/package/kernel/mac80211/patches/rtl/035-v6.13-wifi-rtw88-Detect-beacon-loss-with-chips-other-than-.patch b/package/kernel/mac80211/patches/rtl/035-v6.13-wifi-rtw88-Detect-beacon-loss-with-chips-other-than-.patch new file mode 100644 index 00000000000000..de64f33e43e5b4 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/035-v6.13-wifi-rtw88-Detect-beacon-loss-with-chips-other-than-.patch @@ -0,0 +1,63 @@ +From 57289d30cd2ae315ab9b28213d63d1dbf8570cf3 Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Wed, 23 Oct 2024 17:13:45 +0300 +Subject: [PATCH] wifi: rtw88: Detect beacon loss with chips other than 8822c + +The driver is supposed to avoid entering LPS (power saving) when there +is beacon loss, but only RTL8822C detects the beacon loss (because it +has beacon filtering in the firmware). + +Detect beacon loss with the other chips by checking if we received less +than half the expected number of beacons in the last 2-second interval. + +This gets rid of the occasional "failed to get tx report from firmware" +warnings with RTL8821AU. It may also avoid some disconnections. + +Signed-off-by: Bitterblue Smith +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/f52b2fcf-bf94-48bc-89bd-e55ebc3a2f2d@gmail.com +--- + drivers/net/wireless/realtek/rtw88/main.c | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +--- a/drivers/net/wireless/realtek/rtw88/main.c ++++ b/drivers/net/wireless/realtek/rtw88/main.c +@@ -202,6 +202,21 @@ static void rtw_vif_watch_dog_iter(void + rtwvif->stats.rx_cnt = 0; + } + ++static void rtw_sw_beacon_loss_check(struct rtw_dev *rtwdev, ++ struct rtw_vif *rtwvif, int received_beacons) ++{ ++ int watchdog_delay = 2000000 / 1024; /* TU */ ++ int beacon_int, expected_beacons; ++ ++ if (rtw_fw_feature_check(&rtwdev->fw, FW_FEATURE_BCN_FILTER) || !rtwvif) ++ return; ++ ++ beacon_int = rtwvif_to_vif(rtwvif)->bss_conf.beacon_int; ++ expected_beacons = DIV_ROUND_UP(watchdog_delay, beacon_int); ++ ++ rtwdev->beacon_loss = received_beacons < expected_beacons / 2; ++} ++ + /* process TX/RX statistics periodically for hardware, + * the information helps hardware to enhance performance + */ +@@ -212,6 +227,7 @@ static void rtw_watch_dog_work(struct wo + struct rtw_traffic_stats *stats = &rtwdev->stats; + struct rtw_watch_dog_iter_data data = {}; + bool busy_traffic = test_bit(RTW_FLAG_BUSY_TRAFFIC, rtwdev->flags); ++ int received_beacons = rtwdev->dm_info.cur_pkt_count.num_bcn_pkt; + u32 tx_unicast_mbps, rx_unicast_mbps; + bool ps_active; + +@@ -270,6 +286,8 @@ static void rtw_watch_dog_work(struct wo + */ + rtw_iterate_vifs(rtwdev, rtw_vif_watch_dog_iter, &data); + ++ rtw_sw_beacon_loss_check(rtwdev, data.rtwvif, received_beacons); ++ + /* fw supports only one station associated to enter lps, if there are + * more than two stations associated to the AP, then we can not enter + * lps, because fw does not handle the overlapped beacon interval diff --git a/package/kernel/mac80211/patches/rtl/036-v6.13-wifi-rtw88-coex-Support-chips-without-a-scoreboard.patch b/package/kernel/mac80211/patches/rtl/036-v6.13-wifi-rtw88-coex-Support-chips-without-a-scoreboard.patch new file mode 100644 index 00000000000000..b2fb04fd31c325 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/036-v6.13-wifi-rtw88-coex-Support-chips-without-a-scoreboard.patch @@ -0,0 +1,66 @@ +From b19840afc05121293ae59f017cb9924814eb5d77 Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Wed, 23 Oct 2024 17:14:12 +0300 +Subject: [PATCH] wifi: rtw88: coex: Support chips without a scoreboard + +All the chips currently supported have a "scoreboard": the chip keeps +track of certain things related to bluetooth, for example, whether +bluetooth is active. The information can be read from register 0xaa. + +RTL8821AU doesn't have this. Implement bluetooth activity detection in +rtw_coex_monitor_bt_enable() based on the bluetooth TX/RX counters. + +This is mostly important for RTL8811AU, the version of RTL8821AU without +bluetooth. Without this change, the driver thinks bluetooth is active +and the wifi speeds are low. + +Signed-off-by: Bitterblue Smith +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/5058f23d-2086-42cd-82ad-eef31a348467@gmail.com +--- + drivers/net/wireless/realtek/rtw88/coex.c | 18 ++++++++++++++++++ + drivers/net/wireless/realtek/rtw88/main.h | 1 + + 2 files changed, 19 insertions(+) + +--- a/drivers/net/wireless/realtek/rtw88/coex.c ++++ b/drivers/net/wireless/realtek/rtw88/coex.c +@@ -494,11 +494,29 @@ static void rtw_coex_monitor_bt_enable(s + struct rtw_coex_stat *coex_stat = &coex->stat; + struct rtw_coex_dm *coex_dm = &coex->dm; + bool bt_disabled = false; ++ bool bt_active = true; + u16 score_board; + + if (chip->scbd_support) { + score_board = rtw_coex_read_scbd(rtwdev); + bt_disabled = !(score_board & COEX_SCBD_ONOFF); ++ } else { ++ if (coex_stat->hi_pri_tx == 0 && coex_stat->hi_pri_rx == 0 && ++ coex_stat->lo_pri_tx == 0 && coex_stat->lo_pri_rx == 0) ++ bt_active = false; ++ ++ if (coex_stat->hi_pri_tx == 0xffff && coex_stat->hi_pri_rx == 0xffff && ++ coex_stat->lo_pri_tx == 0xffff && coex_stat->lo_pri_rx == 0xffff) ++ bt_active = false; ++ ++ if (bt_active) { ++ coex_stat->bt_disable_cnt = 0; ++ bt_disabled = false; ++ } else { ++ coex_stat->bt_disable_cnt++; ++ if (coex_stat->bt_disable_cnt >= 10) ++ bt_disabled = true; ++ } + } + + if (coex_stat->bt_disabled != bt_disabled) { +--- a/drivers/net/wireless/realtek/rtw88/main.h ++++ b/drivers/net/wireless/realtek/rtw88/main.h +@@ -1494,6 +1494,7 @@ struct rtw_coex_stat { + u8 bt_hid_slot; + u8 bt_a2dp_bitpool; + u8 bt_iqk_state; ++ u8 bt_disable_cnt; + + u16 wl_beacon_interval; + u8 wl_noisy_level; diff --git a/package/kernel/mac80211/patches/rtl/037-v6.13-wifi-rtw88-8821a-Regularly-ask-for-BT-info-updates.patch b/package/kernel/mac80211/patches/rtl/037-v6.13-wifi-rtw88-8821a-Regularly-ask-for-BT-info-updates.patch new file mode 100644 index 00000000000000..e0e840f0fadfeb --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/037-v6.13-wifi-rtw88-8821a-Regularly-ask-for-BT-info-updates.patch @@ -0,0 +1,67 @@ +From bfcee5ee924fc5f706d20f5dc31586ca47912304 Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Wed, 23 Oct 2024 17:14:45 +0300 +Subject: [PATCH] wifi: rtw88: 8821a: Regularly ask for BT info updates + +The RTL8821AU firmware sends C2H_BT_INFO by itself when bluetooth +headphones are connected, but not when they are disconnected. This leads +to the coexistence code still using the A2DP algorithm long after the +headphones are disconnected, which means the wifi speeds are much lower +than they should be. Work around this by asking for updates every two +seconds if the chip is RTL8821AU. + +Signed-off-by: Bitterblue Smith +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/358acdd2-6aae-46c1-9c66-fcce4e700b96@gmail.com +--- + drivers/net/wireless/realtek/rtw88/coex.c | 2 +- + drivers/net/wireless/realtek/rtw88/coex.h | 11 +++++++++++ + drivers/net/wireless/realtek/rtw88/main.c | 1 + + 3 files changed, 13 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/realtek/rtw88/coex.c ++++ b/drivers/net/wireless/realtek/rtw88/coex.c +@@ -446,7 +446,7 @@ static void rtw_coex_check_rfk(struct rt + } + } + +-static void rtw_coex_query_bt_info(struct rtw_dev *rtwdev) ++void rtw_coex_query_bt_info(struct rtw_dev *rtwdev) + { + struct rtw_coex *coex = &rtwdev->coex; + struct rtw_coex_stat *coex_stat = &coex->stat; +--- a/drivers/net/wireless/realtek/rtw88/coex.h ++++ b/drivers/net/wireless/realtek/rtw88/coex.h +@@ -384,6 +384,7 @@ u32 rtw_coex_read_indirect_reg(struct rt + void rtw_coex_write_indirect_reg(struct rtw_dev *rtwdev, u16 addr, + u32 mask, u32 val); + void rtw_coex_write_scbd(struct rtw_dev *rtwdev, u16 bitpos, bool set); ++void rtw_coex_query_bt_info(struct rtw_dev *rtwdev); + + void rtw_coex_bt_relink_work(struct work_struct *work); + void rtw_coex_bt_reenable_work(struct work_struct *work); +@@ -419,4 +420,14 @@ static inline bool rtw_coex_disabled(str + return coex_stat->bt_disabled; + } + ++static inline void rtw_coex_active_query_bt_info(struct rtw_dev *rtwdev) ++{ ++ /* The RTL8821AU firmware doesn't send C2H_BT_INFO by itself ++ * when bluetooth headphones are disconnected, so we have to ++ * ask for it regularly. ++ */ ++ if (rtwdev->chip->id == RTW_CHIP_TYPE_8821A && rtwdev->efuse.btcoex) ++ rtw_coex_query_bt_info(rtwdev); ++} ++ + #endif +--- a/drivers/net/wireless/realtek/rtw88/main.c ++++ b/drivers/net/wireless/realtek/rtw88/main.c +@@ -274,6 +274,7 @@ static void rtw_watch_dog_work(struct wo + rtw_leave_lps(rtwdev); + rtw_coex_wl_status_check(rtwdev); + rtw_coex_query_bt_hid_list(rtwdev); ++ rtw_coex_active_query_bt_info(rtwdev); + + rtw_phy_dynamic_mechanism(rtwdev); + diff --git a/package/kernel/mac80211/patches/rtl/038-v6.13-wifi-rtw88-8812a-Mitigate-beacon-loss.patch b/package/kernel/mac80211/patches/rtl/038-v6.13-wifi-rtw88-8812a-Mitigate-beacon-loss.patch new file mode 100644 index 00000000000000..f862f80460df36 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/038-v6.13-wifi-rtw88-8812a-Mitigate-beacon-loss.patch @@ -0,0 +1,37 @@ +From f9e0189cbc2d6447dde392944c769546cdf48140 Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Wed, 23 Oct 2024 17:15:13 +0300 +Subject: [PATCH] wifi: rtw88: 8812a: Mitigate beacon loss + +The RTL8812AU has a reception problem, maybe only in the 5 GHz band. +Sometimes, in some positions, it stops receiving anything even though +the distance to the AP is only ~3 meters and there are no obstacles. +Moving it a few centimeters fixes it. + +Switch the initial gain to maximum coverage when there is beacon loss. +This only helps sometimes. This is similar to what the official driver +does. + +Signed-off-by: Bitterblue Smith +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/203f5043-4fe1-4f35-8b8f-d3b6f44e1fd9@gmail.com +--- + drivers/net/wireless/realtek/rtw88/phy.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/drivers/net/wireless/realtek/rtw88/phy.c ++++ b/drivers/net/wireless/realtek/rtw88/phy.c +@@ -530,6 +530,13 @@ static void rtw_phy_dig(struct rtw_dev * + */ + rtw_phy_dig_recorder(dm_info, cur_igi, fa_cnt); + ++ /* Mitigate beacon loss and connectivity issues, mainly (only?) ++ * in the 5 GHz band ++ */ ++ if (rtwdev->chip->id == RTW_CHIP_TYPE_8812A && rtwdev->beacon_loss && ++ linked && dm_info->total_fa_cnt < DIG_PERF_FA_TH_EXTRA_HIGH) ++ cur_igi = DIG_CVRG_MIN; ++ + if (cur_igi != pre_igi) + rtw_phy_dig_write(rtwdev, cur_igi); + } diff --git a/package/kernel/mac80211/patches/rtl/039-v6.13-wifi-rtw88-Add-rtw8812a_table.-c-h.patch b/package/kernel/mac80211/patches/rtl/039-v6.13-wifi-rtw88-Add-rtw8812a_table.-c-h.patch new file mode 100644 index 00000000000000..59a04b4d16b579 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/039-v6.13-wifi-rtw88-Add-rtw8812a_table.-c-h.patch @@ -0,0 +1,2862 @@ +From 528f902ecc0eb8fb766bde519421255729623dd8 Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Wed, 30 Oct 2024 20:24:33 +0200 +Subject: [PATCH] wifi: rtw88: Add rtw8812a_table.{c,h} + +These contain various arrays for initialising RTL8812AU. Also TX power +limits. + +Signed-off-by: Bitterblue Smith +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/086f476c-e832-4867-963c-a64a63252fd6@gmail.com +--- + .../wireless/realtek/rtw88/rtw8812a_table.c | 2812 +++++++++++++++++ + .../wireless/realtek/rtw88/rtw8812a_table.h | 26 + + 2 files changed, 2838 insertions(+) + create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8812a_table.c + create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8812a_table.h + +--- /dev/null ++++ b/drivers/net/wireless/realtek/rtw88/rtw8812a_table.c +@@ -0,0 +1,2812 @@ ++// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause ++/* Copyright(c) 2024 Realtek Corporation ++ */ ++ ++#include "main.h" ++#include "phy.h" ++#include "rtw8812a_table.h" ++ ++static const u32 rtw8812a_mac[] = { ++ 0x010, 0x0000000C, ++ 0x80000200, 0x00000000, 0x40000000, 0x00000000, ++ 0x011, 0x00000066, ++ 0xA0000000, 0x00000000, ++ 0x011, 0x0000005A, ++ 0xB0000000, 0x00000000, ++ 0x025, 0x0000000F, ++ 0x072, 0x00000000, ++ 0x420, 0x00000080, ++ 0x428, 0x0000000A, ++ 0x429, 0x00000010, ++ 0x430, 0x00000000, ++ 0x431, 0x00000000, ++ 0x432, 0x00000000, ++ 0x433, 0x00000001, ++ 0x434, 0x00000002, ++ 0x435, 0x00000003, ++ 0x436, 0x00000005, ++ 0x437, 0x00000007, ++ 0x438, 0x00000000, ++ 0x439, 0x00000000, ++ 0x43A, 0x00000000, ++ 0x43B, 0x00000001, ++ 0x43C, 0x00000002, ++ 0x43D, 0x00000003, ++ 0x43E, 0x00000005, ++ 0x43F, 0x00000007, ++ 0x440, 0x0000005D, ++ 0x441, 0x00000001, ++ 0x442, 0x00000000, ++ 0x444, 0x00000010, ++ 0x445, 0x00000000, ++ 0x446, 0x00000000, ++ 0x447, 0x00000000, ++ 0x448, 0x00000000, ++ 0x449, 0x000000F0, ++ 0x44A, 0x0000000F, ++ 0x44B, 0x0000003E, ++ 0x44C, 0x00000010, ++ 0x44D, 0x00000000, ++ 0x44E, 0x00000000, ++ 0x44F, 0x00000000, ++ 0x450, 0x00000000, ++ 0x451, 0x000000F0, ++ 0x452, 0x0000000F, ++ 0x453, 0x00000000, ++ 0x45B, 0x00000080, ++ 0x460, 0x00000066, ++ 0x461, 0x00000066, ++ 0x4C8, 0x000000FF, ++ 0x4C9, 0x00000008, ++ 0x4CC, 0x000000FF, ++ 0x4CD, 0x000000FF, ++ 0x4CE, 0x00000001, ++ 0x500, 0x00000026, ++ 0x501, 0x000000A2, ++ 0x502, 0x0000002F, ++ 0x503, 0x00000000, ++ 0x504, 0x00000028, ++ 0x505, 0x000000A3, ++ 0x506, 0x0000005E, ++ 0x507, 0x00000000, ++ 0x508, 0x0000002B, ++ 0x509, 0x000000A4, ++ 0x50A, 0x0000005E, ++ 0x50B, 0x00000000, ++ 0x50C, 0x0000004F, ++ 0x50D, 0x000000A4, ++ 0x50E, 0x00000000, ++ 0x50F, 0x00000000, ++ 0x512, 0x0000001C, ++ 0x514, 0x0000000A, ++ 0x516, 0x0000000A, ++ 0x525, 0x0000004F, ++ 0x550, 0x00000010, ++ 0x551, 0x00000010, ++ 0x559, 0x00000002, ++ 0x55C, 0x00000050, ++ 0x55D, 0x000000FF, ++ 0x604, 0x00000009, ++ 0x605, 0x00000030, ++ 0x607, 0x00000003, ++ 0x608, 0x0000000E, ++ 0x609, 0x0000002A, ++ 0x620, 0x000000FF, ++ 0x621, 0x000000FF, ++ 0x622, 0x000000FF, ++ 0x623, 0x000000FF, ++ 0x624, 0x000000FF, ++ 0x625, 0x000000FF, ++ 0x626, 0x000000FF, ++ 0x627, 0x000000FF, ++ 0x638, 0x00000050, ++ 0x63C, 0x0000000A, ++ 0x63D, 0x0000000A, ++ 0x63E, 0x0000000E, ++ 0x63F, 0x0000000E, ++ 0x640, 0x00000080, ++ 0x642, 0x00000040, ++ 0x643, 0x00000000, ++ 0x652, 0x000000C8, ++ 0x66E, 0x00000005, ++ 0x700, 0x00000021, ++ 0x701, 0x00000043, ++ 0x702, 0x00000065, ++ 0x703, 0x00000087, ++ 0x708, 0x00000021, ++ 0x709, 0x00000043, ++ 0x70A, 0x00000065, ++ 0x70B, 0x00000087, ++ 0x718, 0x00000040, ++}; ++ ++RTW_DECL_TABLE_PHY_COND(rtw8812a_mac, rtw_phy_cfg_mac); ++ ++static const u32 rtw8812a_agc[] = { ++ 0x80000001, 0x00000000, 0x40000000, 0x00000000, ++ 0x81C, 0xFC000001, ++ 0x81C, 0xFB020001, ++ 0x81C, 0xFA040001, ++ 0x81C, 0xF9060001, ++ 0x81C, 0xF8080001, ++ 0x81C, 0xF70A0001, ++ 0x81C, 0xF60C0001, ++ 0x81C, 0xF50E0001, ++ 0x81C, 0xF4100001, ++ 0x81C, 0xF3120001, ++ 0x81C, 0xF2140001, ++ 0x81C, 0xF1160001, ++ 0x81C, 0xF0180001, ++ 0x81C, 0xEF1A0001, ++ 0x81C, 0xEE1C0001, ++ 0x81C, 0xED1E0001, ++ 0x81C, 0xEC200001, ++ 0x81C, 0xEB220001, ++ 0x81C, 0xEA240001, ++ 0x81C, 0xCD260001, ++ 0x81C, 0xCC280001, ++ 0x81C, 0xCB2A0001, ++ 0x81C, 0xCA2C0001, ++ 0x81C, 0xC92E0001, ++ 0x81C, 0xC8300001, ++ 0x81C, 0xA6320001, ++ 0x81C, 0xA5340001, ++ 0x81C, 0xA4360001, ++ 0x81C, 0xA3380001, ++ 0x81C, 0xA23A0001, ++ 0x81C, 0x883C0001, ++ 0x81C, 0x873E0001, ++ 0x81C, 0x86400001, ++ 0x81C, 0x85420001, ++ 0x81C, 0x84440001, ++ 0x81C, 0x83460001, ++ 0x81C, 0x82480001, ++ 0x81C, 0x814A0001, ++ 0x81C, 0x484C0001, ++ 0x81C, 0x474E0001, ++ 0x81C, 0x46500001, ++ 0x81C, 0x45520001, ++ 0x81C, 0x44540001, ++ 0x81C, 0x43560001, ++ 0x81C, 0x42580001, ++ 0x81C, 0x415A0001, ++ 0x81C, 0x255C0001, ++ 0x81C, 0x245E0001, ++ 0x81C, 0x23600001, ++ 0x81C, 0x22620001, ++ 0x81C, 0x21640001, ++ 0x81C, 0x21660001, ++ 0x81C, 0x21680001, ++ 0x81C, 0x216A0001, ++ 0x81C, 0x216C0001, ++ 0x81C, 0x216E0001, ++ 0x81C, 0x21700001, ++ 0x81C, 0x21720001, ++ 0x81C, 0x21740001, ++ 0x81C, 0x21760001, ++ 0x81C, 0x21780001, ++ 0x81C, 0x217A0001, ++ 0x81C, 0x217C0001, ++ 0x81C, 0x217E0001, ++ 0x90000001, 0x00000005, 0x40000000, 0x00000000, ++ 0x81C, 0xF9000001, ++ 0x81C, 0xF8020001, ++ 0x81C, 0xF7040001, ++ 0x81C, 0xF6060001, ++ 0x81C, 0xF5080001, ++ 0x81C, 0xF40A0001, ++ 0x81C, 0xF30C0001, ++ 0x81C, 0xF20E0001, ++ 0x81C, 0xF1100001, ++ 0x81C, 0xF0120001, ++ 0x81C, 0xEF140001, ++ 0x81C, 0xEE160001, ++ 0x81C, 0xED180001, ++ 0x81C, 0xEC1A0001, ++ 0x81C, 0xEB1C0001, ++ 0x81C, 0xEA1E0001, ++ 0x81C, 0xCD200001, ++ 0x81C, 0xCC220001, ++ 0x81C, 0xCB240001, ++ 0x81C, 0xCA260001, ++ 0x81C, 0xC9280001, ++ 0x81C, 0xC82A0001, ++ 0x81C, 0xC72C0001, ++ 0x81C, 0xC62E0001, ++ 0x81C, 0xA5300001, ++ 0x81C, 0xA4320001, ++ 0x81C, 0xA3340001, ++ 0x81C, 0xA2360001, ++ 0x81C, 0x88380001, ++ 0x81C, 0x873A0001, ++ 0x81C, 0x863C0001, ++ 0x81C, 0x853E0001, ++ 0x81C, 0x84400001, ++ 0x81C, 0x83420001, ++ 0x81C, 0x82440001, ++ 0x81C, 0x81460001, ++ 0x81C, 0x48480001, ++ 0x81C, 0x474A0001, ++ 0x81C, 0x464C0001, ++ 0x81C, 0x454E0001, ++ 0x81C, 0x44500001, ++ 0x81C, 0x43520001, ++ 0x81C, 0x42540001, ++ 0x81C, 0x41560001, ++ 0x81C, 0x25580001, ++ 0x81C, 0x245A0001, ++ 0x81C, 0x235C0001, ++ 0x81C, 0x225E0001, ++ 0x81C, 0x21600001, ++ 0x81C, 0x21620001, ++ 0x81C, 0x21640001, ++ 0x81C, 0x21660001, ++ 0x81C, 0x21680001, ++ 0x81C, 0x216A0001, ++ 0x81C, 0x236C0001, ++ 0x81C, 0x226E0001, ++ 0x81C, 0x21700001, ++ 0x81C, 0x21720001, ++ 0x81C, 0x21740001, ++ 0x81C, 0x21760001, ++ 0x81C, 0x21780001, ++ 0x81C, 0x217A0001, ++ 0x81C, 0x217C0001, ++ 0x81C, 0x217E0001, ++ 0xA0000000, 0x00000000, ++ 0x81C, 0xFF000001, ++ 0x81C, 0xFF020001, ++ 0x81C, 0xFF040001, ++ 0x81C, 0xFF060001, ++ 0x81C, 0xFF080001, ++ 0x81C, 0xFE0A0001, ++ 0x81C, 0xFD0C0001, ++ 0x81C, 0xFC0E0001, ++ 0x81C, 0xFB100001, ++ 0x81C, 0xFA120001, ++ 0x81C, 0xF9140001, ++ 0x81C, 0xF8160001, ++ 0x81C, 0xF7180001, ++ 0x81C, 0xF61A0001, ++ 0x81C, 0xF51C0001, ++ 0x81C, 0xF41E0001, ++ 0x81C, 0xF3200001, ++ 0x81C, 0xF2220001, ++ 0x81C, 0xF1240001, ++ 0x81C, 0xF0260001, ++ 0x81C, 0xEF280001, ++ 0x81C, 0xEE2A0001, ++ 0x81C, 0xED2C0001, ++ 0x81C, 0xEC2E0001, ++ 0x81C, 0xEB300001, ++ 0x81C, 0xEA320001, ++ 0x81C, 0xE9340001, ++ 0x81C, 0xE8360001, ++ 0x81C, 0xE7380001, ++ 0x81C, 0xE63A0001, ++ 0x81C, 0xE53C0001, ++ 0x81C, 0xC73E0001, ++ 0x81C, 0xC6400001, ++ 0x81C, 0xC5420001, ++ 0x81C, 0xC4440001, ++ 0x81C, 0xC3460001, ++ 0x81C, 0xC2480001, ++ 0x81C, 0xC14A0001, ++ 0x81C, 0xA74C0001, ++ 0x81C, 0xA64E0001, ++ 0x81C, 0xA5500001, ++ 0x81C, 0xA4520001, ++ 0x81C, 0xA3540001, ++ 0x81C, 0xA2560001, ++ 0x81C, 0xA1580001, ++ 0x81C, 0x675A0001, ++ 0x81C, 0x665C0001, ++ 0x81C, 0x655E0001, ++ 0x81C, 0x64600001, ++ 0x81C, 0x63620001, ++ 0x81C, 0x48640001, ++ 0x81C, 0x47660001, ++ 0x81C, 0x46680001, ++ 0x81C, 0x456A0001, ++ 0x81C, 0x446C0001, ++ 0x81C, 0x436E0001, ++ 0x81C, 0x42700001, ++ 0x81C, 0x41720001, ++ 0x81C, 0x41740001, ++ 0x81C, 0x41760001, ++ 0x81C, 0x41780001, ++ 0x81C, 0x417A0001, ++ 0x81C, 0x417C0001, ++ 0x81C, 0x417E0001, ++ 0xB0000000, 0x00000000, ++ 0x80000004, 0x00000000, 0x40000000, 0x00000000, ++ 0x81C, 0xFC800001, ++ 0x81C, 0xFB820001, ++ 0x81C, 0xFA840001, ++ 0x81C, 0xF9860001, ++ 0x81C, 0xF8880001, ++ 0x81C, 0xF78A0001, ++ 0x81C, 0xF68C0001, ++ 0x81C, 0xF58E0001, ++ 0x81C, 0xF4900001, ++ 0x81C, 0xF3920001, ++ 0x81C, 0xF2940001, ++ 0x81C, 0xF1960001, ++ 0x81C, 0xF0980001, ++ 0x81C, 0xEF9A0001, ++ 0x81C, 0xEE9C0001, ++ 0x81C, 0xED9E0001, ++ 0x81C, 0xECA00001, ++ 0x81C, 0xEBA20001, ++ 0x81C, 0xEAA40001, ++ 0x81C, 0xE9A60001, ++ 0x81C, 0xE8A80001, ++ 0x81C, 0xE7AA0001, ++ 0x81C, 0xE6AC0001, ++ 0x81C, 0xE5AE0001, ++ 0x81C, 0xE4B00001, ++ 0x81C, 0xE3B20001, ++ 0x81C, 0xA8B40001, ++ 0x81C, 0xA7B60001, ++ 0x81C, 0xA6B80001, ++ 0x81C, 0xA5BA0001, ++ 0x81C, 0xA4BC0001, ++ 0x81C, 0xA3BE0001, ++ 0x81C, 0xA2C00001, ++ 0x81C, 0xA1C20001, ++ 0x81C, 0x68C40001, ++ 0x81C, 0x67C60001, ++ 0x81C, 0x66C80001, ++ 0x81C, 0x65CA0001, ++ 0x81C, 0x64CC0001, ++ 0x81C, 0x47CE0001, ++ 0x81C, 0x46D00001, ++ 0x81C, 0x45D20001, ++ 0x81C, 0x44D40001, ++ 0x81C, 0x43D60001, ++ 0x81C, 0x42D80001, ++ 0x81C, 0x08DA0001, ++ 0x81C, 0x07DC0001, ++ 0x81C, 0x06DE0001, ++ 0x81C, 0x05E00001, ++ 0x81C, 0x04E20001, ++ 0x81C, 0x03E40001, ++ 0x81C, 0x02E60001, ++ 0x81C, 0x01E80001, ++ 0x81C, 0x01EA0001, ++ 0x81C, 0x01EC0001, ++ 0x81C, 0x01EE0001, ++ 0x81C, 0x01F00001, ++ 0x81C, 0x01F20001, ++ 0x81C, 0x01F40001, ++ 0x81C, 0x01F60001, ++ 0x81C, 0x01F80001, ++ 0x81C, 0x01FA0001, ++ 0x81C, 0x01FC0001, ++ 0x81C, 0x01FE0001, ++ 0xA0000000, 0x00000000, ++ 0x81C, 0xFF800001, ++ 0x81C, 0xFF820001, ++ 0x81C, 0xFF840001, ++ 0x81C, 0xFE860001, ++ 0x81C, 0xFD880001, ++ 0x81C, 0xFC8A0001, ++ 0x81C, 0xFB8C0001, ++ 0x81C, 0xFA8E0001, ++ 0x81C, 0xF9900001, ++ 0x81C, 0xF8920001, ++ 0x81C, 0xF7940001, ++ 0x81C, 0xF6960001, ++ 0x81C, 0xF5980001, ++ 0x81C, 0xF49A0001, ++ 0x81C, 0xF39C0001, ++ 0x81C, 0xF29E0001, ++ 0x81C, 0xF1A00001, ++ 0x81C, 0xF0A20001, ++ 0x81C, 0xEFA40001, ++ 0x81C, 0xEEA60001, ++ 0x81C, 0xEDA80001, ++ 0x81C, 0xECAA0001, ++ 0x81C, 0xEBAC0001, ++ 0x81C, 0xEAAE0001, ++ 0x81C, 0xE9B00001, ++ 0x81C, 0xE8B20001, ++ 0x81C, 0xE7B40001, ++ 0x81C, 0xE6B60001, ++ 0x81C, 0xE5B80001, ++ 0x81C, 0xE4BA0001, ++ 0x81C, 0xE3BC0001, ++ 0x81C, 0xA8BE0001, ++ 0x81C, 0xA7C00001, ++ 0x81C, 0xA6C20001, ++ 0x81C, 0xA5C40001, ++ 0x81C, 0xA4C60001, ++ 0x81C, 0xA3C80001, ++ 0x81C, 0xA2CA0001, ++ 0x81C, 0xA1CC0001, ++ 0x81C, 0x68CE0001, ++ 0x81C, 0x67D00001, ++ 0x81C, 0x66D20001, ++ 0x81C, 0x65D40001, ++ 0x81C, 0x64D60001, ++ 0x81C, 0x47D80001, ++ 0x81C, 0x46DA0001, ++ 0x81C, 0x45DC0001, ++ 0x81C, 0x44DE0001, ++ 0x81C, 0x43E00001, ++ 0x81C, 0x42E20001, ++ 0x81C, 0x08E40001, ++ 0x81C, 0x07E60001, ++ 0x81C, 0x06E80001, ++ 0x81C, 0x05EA0001, ++ 0x81C, 0x04EC0001, ++ 0x81C, 0x03EE0001, ++ 0x81C, 0x02F00001, ++ 0x81C, 0x01F20001, ++ 0x81C, 0x01F40001, ++ 0x81C, 0x01F60001, ++ 0x81C, 0x01F80001, ++ 0x81C, 0x01FA0001, ++ 0x81C, 0x01FC0001, ++ 0x81C, 0x01FE0001, ++ 0xB0000000, 0x00000000, ++ 0xC50, 0x00000022, ++ 0xC50, 0x00000020, ++ 0xE50, 0x00000022, ++ 0xE50, 0x00000020, ++}; ++ ++RTW_DECL_TABLE_PHY_COND(rtw8812a_agc, rtw_phy_cfg_agc); ++ ++static const u32 rtw8812a_agc_diff_lb[] = { ++ 0x80000004, 0x00000000, 0x40000000, 0x00000000, ++ 0x81C, 0x47CE0001, ++ 0x81C, 0x46D00001, ++ 0x81C, 0x45D20001, ++ 0x81C, 0x44D40001, ++ 0x81C, 0x43D60001, ++ 0x81C, 0x42D80001, ++ 0x81C, 0x08DA0001, ++ 0x81C, 0x07DC0001, ++ 0x81C, 0x06DE0001, ++ 0x81C, 0x05E00001, ++ 0x81C, 0x04E20001, ++ 0x81C, 0x03E40001, ++ 0x81C, 0x02E60001, ++ 0xA0000000, 0x00000000, ++ 0x81C, 0x47D80001, ++ 0x81C, 0x46DA0001, ++ 0x81C, 0x45DC0001, ++ 0x81C, 0x44DE0001, ++ 0x81C, 0x43E00001, ++ 0x81C, 0x42E20001, ++ 0x81C, 0x08E40001, ++ 0x81C, 0x07E60001, ++ 0x81C, 0x06E80001, ++ 0x81C, 0x05EA0001, ++ 0x81C, 0x04EC0001, ++ 0x81C, 0x03EE0001, ++ 0x81C, 0x02F00001, ++ 0xB0000000, 0x00000000, ++}; ++ ++RTW_DECL_TABLE_PHY_COND(rtw8812a_agc_diff_lb, rtw_phy_cfg_agc); ++ ++static const u32 rtw8812a_agc_diff_hb[] = { ++ 0x80000004, 0x00000000, 0x40000000, 0x00000000, ++ 0x81C, 0x45CE0001, ++ 0x81C, 0x44D00001, ++ 0x81C, 0x43D20001, ++ 0x81C, 0x42D40001, ++ 0x81C, 0x08D60001, ++ 0x81C, 0x07D80001, ++ 0x81C, 0x06DA0001, ++ 0x81C, 0x05DC0001, ++ 0x81C, 0x04DE0001, ++ 0x81C, 0x03E00001, ++ 0x81C, 0x02E20001, ++ 0x81C, 0x01E40001, ++ 0x81C, 0x01E60001, ++ 0xA0000000, 0x00000000, ++ 0x81C, 0x45D80001, ++ 0x81C, 0x44DA0001, ++ 0x81C, 0x43DC0001, ++ 0x81C, 0x42DE0001, ++ 0x81C, 0x08E00001, ++ 0x81C, 0x07E20001, ++ 0x81C, 0x06E40001, ++ 0x81C, 0x05E60001, ++ 0x81C, 0x04E80001, ++ 0x81C, 0x03EA0001, ++ 0x81C, 0x02EC0001, ++ 0x81C, 0x01EE0001, ++ 0x81C, 0x01F00001, ++ 0xB0000000, 0x00000000, ++}; ++ ++RTW_DECL_TABLE_PHY_COND(rtw8812a_agc_diff_hb, rtw_phy_cfg_agc); ++ ++static const u32 rtw8812a_bb[] = { ++ 0x800, 0x8020D010, ++ 0x804, 0x080112E0, ++ 0x808, 0x0E028233, ++ 0x80C, 0x12131113, ++ 0x810, 0x20101263, ++ 0x814, 0x020C3D10, ++ 0x818, 0x03A00385, ++ 0x820, 0x00000000, ++ 0x824, 0x00030FE0, ++ 0x828, 0x00000000, ++ 0x82C, 0x002083DD, ++ 0x830, 0x2EAAEEB8, ++ 0x834, 0x0037A706, ++ 0x838, 0x06C89B44, ++ 0x83C, 0x0000095B, ++ 0x840, 0xC0000001, ++ 0x844, 0x40003CDE, ++ 0x848, 0x6210FF8B, ++ 0x84C, 0x6CFDFFB8, ++ 0x850, 0x28874706, ++ 0x854, 0x0001520C, ++ 0x858, 0x8060E000, ++ 0x85C, 0x74210168, ++ 0x860, 0x6929C321, ++ 0x864, 0x79727432, ++ 0x868, 0x8CA7A314, ++ 0x86C, 0x338C2878, ++ 0x870, 0x03333333, ++ 0x874, 0x31602C2E, ++ 0x878, 0x00003152, ++ 0x87C, 0x000FC000, ++ 0x8A0, 0x00000013, ++ 0x8A4, 0x7F7F7F7F, ++ 0x8A8, 0xA202033E, ++ 0x8AC, 0x0FF0FA0A, ++ 0x8B0, 0x00000600, ++ 0x8B4, 0x000FC080, ++ 0x8B8, 0x6C10D7FF, ++ 0x8BC, 0x4CA520A3, ++ 0x8C0, 0x27F00020, ++ 0x8C4, 0x00000000, ++ 0x8C8, 0x00012D69, ++ 0x8CC, 0x08248492, ++ 0x8D0, 0x0000B800, ++ 0x8DC, 0x00000000, ++ 0x8D4, 0x940008A0, ++ 0x8D8, 0x290B5612, ++ 0x8F8, 0x400002C0, ++ 0x8FC, 0x00000000, ++ 0x900, 0x00000701, ++ 0x90C, 0x00000000, ++ 0x910, 0x0000FC00, ++ 0x914, 0x00000404, ++ 0x918, 0x1C1028C0, ++ 0x91C, 0x64B11A1C, ++ 0x920, 0xE0767233, ++ 0x924, 0x055AA500, ++ 0x928, 0x00000004, ++ 0x92C, 0xFFFE0000, ++ 0x930, 0xFFFFFFFE, ++ 0x934, 0x001FFFFF, ++ 0x960, 0x00000000, ++ 0x964, 0x00000000, ++ 0x968, 0x00000000, ++ 0x96C, 0x00000000, ++ 0x970, 0x801FFFFF, ++ 0x978, 0x00000000, ++ 0x97C, 0x00000000, ++ 0x980, 0x00000000, ++ 0x984, 0x00000000, ++ 0x988, 0x00000000, ++ 0x990, 0x27100000, ++ 0x994, 0xFFFF0100, ++ 0x998, 0xFFFFFF5C, ++ 0x99C, 0xFFFFFFFF, ++ 0x9A0, 0x000000FF, ++ 0x9A4, 0x00080080, ++ 0x9A8, 0x00000000, ++ 0x9AC, 0x00000000, ++ 0x9B0, 0x81081008, ++ 0x9B4, 0x00000000, ++ 0x9B8, 0x01081008, ++ 0x9BC, 0x01081008, ++ 0x9D0, 0x00000000, ++ 0x9D4, 0x00000000, ++ 0x9D8, 0x00000000, ++ 0x9DC, 0x00000000, ++ 0x9E4, 0x00000003, ++ 0x9E8, 0x000002D5, ++ 0xA00, 0x00D047C8, ++ 0xA04, 0x01FF000C, ++ 0xA08, 0x8C838300, ++ 0xA0C, 0x2E7F000F, ++ 0xA10, 0x9500BB78, ++ 0xA14, 0x11144028, ++ 0xA18, 0x00881117, ++ 0xA1C, 0x89140F00, ++ 0xA20, 0x1A1B0000, ++ 0xA24, 0x090E1217, ++ 0xA28, 0x00000305, ++ 0xA2C, 0x00900000, ++ 0xA70, 0x101FFF00, ++ 0xA74, 0x00000008, ++ 0xA78, 0x00000900, ++ 0xA7C, 0x225B0606, ++ 0xA80, 0x218075B2, ++ 0xA84, 0x001F8C80, ++ 0xB00, 0x03100000, ++ 0xB04, 0x0000B000, ++ 0xB08, 0xAE0201EB, ++ 0xB0C, 0x01003207, ++ 0xB10, 0x00009807, ++ 0xB14, 0x01000000, ++ 0xB18, 0x00000002, ++ 0xB1C, 0x00000002, ++ 0xB20, 0x0000001F, ++ 0xB24, 0x03020100, ++ 0xB28, 0x07060504, ++ 0xB2C, 0x0B0A0908, ++ 0xB30, 0x0F0E0D0C, ++ 0xB34, 0x13121110, ++ 0xB38, 0x17161514, ++ 0xB3C, 0x0000003A, ++ 0xB40, 0x00000000, ++ 0xB44, 0x00000000, ++ 0xB48, 0x13000032, ++ 0xB4C, 0x48080000, ++ 0xB50, 0x00000000, ++ 0xB54, 0x00000000, ++ 0xB58, 0x00000000, ++ 0xB5C, 0x00000000, ++ 0xC00, 0x00000007, ++ 0xC04, 0x00042020, ++ 0xC08, 0x80410231, ++ 0xC0C, 0x00000000, ++ 0xC10, 0x00000100, ++ 0xC14, 0x01000000, ++ 0xC1C, 0x40000003, ++ 0xC20, 0x12121212, ++ 0xC24, 0x12121212, ++ 0xC28, 0x12121212, ++ 0xC2C, 0x12121212, ++ 0xC30, 0x12121212, ++ 0xC34, 0x12121212, ++ 0xC38, 0x12121212, ++ 0xC3C, 0x12121212, ++ 0xC40, 0x12121212, ++ 0xC44, 0x12121212, ++ 0xC48, 0x12121212, ++ 0xC4C, 0x12121212, ++ 0xC50, 0x00000020, ++ 0xC54, 0x0008121C, ++ 0xC58, 0x30000C1C, ++ 0xC5C, 0x00000058, ++ 0xC60, 0x34344443, ++ 0xC64, 0x07003333, ++ 0x80000008, 0x00000000, 0x40000000, 0x00000000, ++ 0xC68, 0x59791979, ++ 0x90000008, 0x05000000, 0x40000000, 0x00000000, ++ 0xC68, 0x59791979, ++ 0x90000002, 0x00000000, 0x40000000, 0x00000000, ++ 0xC68, 0x59791979, ++ 0x90000004, 0x00000000, 0x40000000, 0x00000000, ++ 0xC68, 0x59791979, ++ 0x90000001, 0x00000000, 0x40000000, 0x00000000, ++ 0xC68, 0x59791979, ++ 0x90000001, 0x00000005, 0x40000000, 0x00000000, ++ 0xC68, 0x59791979, ++ 0xA0000000, 0x00000000, ++ 0xC68, 0x59799979, ++ 0xB0000000, 0x00000000, ++ 0xC6C, 0x59795979, ++ 0xC70, 0x19795979, ++ 0xC74, 0x19795979, ++ 0xC78, 0x19791979, ++ 0xC7C, 0x19791979, ++ 0xC80, 0x19791979, ++ 0xC84, 0x19791979, ++ 0xC94, 0x0100005C, ++ 0xC98, 0x00000000, ++ 0xC9C, 0x00000000, ++ 0xCA0, 0x00000029, ++ 0xCA4, 0x08040201, ++ 0xCA8, 0x80402010, ++ 0xCB0, 0x77547777, ++ 0xCB4, 0x00000077, ++ 0xCB8, 0x00508242, ++ 0xE00, 0x00000007, ++ 0xE04, 0x00042020, ++ 0xE08, 0x80410231, ++ 0xE0C, 0x00000000, ++ 0xE10, 0x00000100, ++ 0xE14, 0x01000000, ++ 0xE1C, 0x40000003, ++ 0xE20, 0x12121212, ++ 0xE24, 0x12121212, ++ 0xE28, 0x12121212, ++ 0xE2C, 0x12121212, ++ 0xE30, 0x12121212, ++ 0xE34, 0x12121212, ++ 0xE38, 0x12121212, ++ 0xE3C, 0x12121212, ++ 0xE40, 0x12121212, ++ 0xE44, 0x12121212, ++ 0xE48, 0x12121212, ++ 0xE4C, 0x12121212, ++ 0xE50, 0x00000020, ++ 0xE54, 0x0008121C, ++ 0xE58, 0x30000C1C, ++ 0xE5C, 0x00000058, ++ 0xE60, 0x34344443, ++ 0xE64, 0x07003333, ++ 0xE68, 0x59791979, ++ 0xE6C, 0x59795979, ++ 0xE70, 0x19795979, ++ 0xE74, 0x19795979, ++ 0xE78, 0x19791979, ++ 0xE7C, 0x19791979, ++ 0xE80, 0x19791979, ++ 0xE84, 0x19791979, ++ 0xE94, 0x0100005C, ++ 0xE98, 0x00000000, ++ 0xE9C, 0x00000000, ++ 0xEA0, 0x00000029, ++ 0xEA4, 0x08040201, ++ 0xEA8, 0x80402010, ++ 0xEB0, 0x77547777, ++ 0xEB4, 0x00000077, ++ 0xEB8, 0x00508242, ++}; ++ ++RTW_DECL_TABLE_PHY_COND(rtw8812a_bb, rtw_phy_cfg_bb); ++ ++static const struct rtw_phy_pg_cfg_pair rtw8812a_bb_pg[] = { ++ { 0, 0, 0, 0x00000c20, 0xffffffff, 0x34363840, }, ++ { 0, 0, 0, 0x00000c24, 0xffffffff, 0x42424444, }, ++ { 0, 0, 0, 0x00000c28, 0xffffffff, 0x30323638, }, ++ { 0, 0, 0, 0x00000c2c, 0xffffffff, 0x40424444, }, ++ { 0, 0, 0, 0x00000c30, 0xffffffff, 0x28303236, }, ++ { 0, 0, 1, 0x00000c34, 0xffffffff, 0x38404242, }, ++ { 0, 0, 1, 0x00000c38, 0xffffffff, 0x26283034, }, ++ { 0, 0, 0, 0x00000c3c, 0xffffffff, 0x40424444, }, ++ { 0, 0, 0, 0x00000c40, 0xffffffff, 0x28303236, }, ++ { 0, 0, 0, 0x00000c44, 0xffffffff, 0x42422426, }, ++ { 0, 0, 1, 0x00000c48, 0xffffffff, 0x30343840, }, ++ { 0, 0, 1, 0x00000c4c, 0xffffffff, 0x22242628, }, ++ { 0, 1, 0, 0x00000e20, 0xffffffff, 0x34363840, }, ++ { 0, 1, 0, 0x00000e24, 0xffffffff, 0x42424444, }, ++ { 0, 1, 0, 0x00000e28, 0xffffffff, 0x30323638, }, ++ { 0, 1, 0, 0x00000e2c, 0xffffffff, 0x40424444, }, ++ { 0, 1, 0, 0x00000e30, 0xffffffff, 0x28303236, }, ++ { 0, 1, 1, 0x00000e34, 0xffffffff, 0x38404242, }, ++ { 0, 1, 1, 0x00000e38, 0xffffffff, 0x26283034, }, ++ { 0, 1, 0, 0x00000e3c, 0xffffffff, 0x40424444, }, ++ { 0, 1, 0, 0x00000e40, 0xffffffff, 0x28303236, }, ++ { 0, 1, 0, 0x00000e44, 0xffffffff, 0x42422426, }, ++ { 0, 1, 1, 0x00000e48, 0xffffffff, 0x30343840, }, ++ { 0, 1, 1, 0x00000e4c, 0xffffffff, 0x22242628, }, ++ { 1, 0, 0, 0x00000c24, 0xffffffff, 0x42424444, }, ++ { 1, 0, 0, 0x00000c28, 0xffffffff, 0x30323640, }, ++ { 1, 0, 0, 0x00000c2c, 0xffffffff, 0x40424444, }, ++ { 1, 0, 0, 0x00000c30, 0xffffffff, 0x28303236, }, ++ { 1, 0, 1, 0x00000c34, 0xffffffff, 0x38404242, }, ++ { 1, 0, 1, 0x00000c38, 0xffffffff, 0x26283034, }, ++ { 1, 0, 0, 0x00000c3c, 0xffffffff, 0x40424444, }, ++ { 1, 0, 0, 0x00000c40, 0xffffffff, 0x28303236, }, ++ { 1, 0, 0, 0x00000c44, 0xffffffff, 0x42422426, }, ++ { 1, 0, 1, 0x00000c48, 0xffffffff, 0x30343840, }, ++ { 1, 0, 1, 0x00000c4c, 0xffffffff, 0x22242628, }, ++ { 1, 1, 0, 0x00000e24, 0xffffffff, 0x42424444, }, ++ { 1, 1, 0, 0x00000e28, 0xffffffff, 0x30323640, }, ++ { 1, 1, 0, 0x00000e2c, 0xffffffff, 0x40424444, }, ++ { 1, 1, 0, 0x00000e30, 0xffffffff, 0x28303236, }, ++ { 1, 1, 1, 0x00000e34, 0xffffffff, 0x38404242, }, ++ { 1, 1, 1, 0x00000e38, 0xffffffff, 0x26283034, }, ++ { 1, 1, 0, 0x00000e3c, 0xffffffff, 0x40424444, }, ++ { 1, 1, 0, 0x00000e40, 0xffffffff, 0x28303236, }, ++ { 1, 1, 0, 0x00000e44, 0xffffffff, 0x42422426, }, ++ { 1, 1, 1, 0x00000e48, 0xffffffff, 0x30343840, }, ++ { 1, 1, 1, 0x00000e4c, 0xffffffff, 0x22242628, }, ++}; ++ ++RTW_DECL_TABLE_BB_PG(rtw8812a_bb_pg); ++ ++static const struct rtw_phy_pg_cfg_pair rtw8812a_bb_pg_rfe3[] = { ++ { 0, 0, 0, 0x00000c20, 0xffffffff, 0x34343434, }, ++ { 0, 0, 0, 0x00000c24, 0xffffffff, 0x32323232, }, ++ { 0, 0, 0, 0x00000c28, 0xffffffff, 0x28303232, }, ++ { 0, 0, 0, 0x00000c2c, 0xffffffff, 0x32323232, }, ++ { 0, 0, 0, 0x00000c30, 0xffffffff, 0x28303232, }, ++ { 0, 0, 1, 0x00000c34, 0xffffffff, 0x32323232, }, ++ { 0, 0, 1, 0x00000c38, 0xffffffff, 0x26283032, }, ++ { 0, 0, 0, 0x00000c3c, 0xffffffff, 0x32323232, }, ++ { 0, 0, 0, 0x00000c40, 0xffffffff, 0x28303232, }, ++ { 0, 0, 0, 0x00000c44, 0xffffffff, 0x32322426, }, ++ { 0, 0, 1, 0x00000c48, 0xffffffff, 0x32323232, }, ++ { 0, 0, 1, 0x00000c4c, 0xffffffff, 0x24262830, }, ++ { 0, 1, 0, 0x00000e20, 0xffffffff, 0x34343434, }, ++ { 0, 1, 0, 0x00000e24, 0xffffffff, 0x32323232, }, ++ { 0, 1, 0, 0x00000e28, 0xffffffff, 0x28303232, }, ++ { 0, 1, 0, 0x00000e2c, 0xffffffff, 0x32323232, }, ++ { 0, 1, 0, 0x00000e30, 0xffffffff, 0x28303232, }, ++ { 0, 1, 1, 0x00000e34, 0xffffffff, 0x32323232, }, ++ { 0, 1, 1, 0x00000e38, 0xffffffff, 0x26283032, }, ++ { 0, 1, 0, 0x00000e3c, 0xffffffff, 0x32323232, }, ++ { 0, 1, 0, 0x00000e40, 0xffffffff, 0x28303232, }, ++ { 0, 1, 0, 0x00000e44, 0xffffffff, 0x32322426, }, ++ { 0, 1, 1, 0x00000e48, 0xffffffff, 0x32323232, }, ++ { 0, 1, 1, 0x00000e4c, 0xffffffff, 0x24262830, }, ++ { 1, 0, 0, 0x00000c24, 0xffffffff, 0x32323232, }, ++ { 1, 0, 0, 0x00000c28, 0xffffffff, 0x28303232, }, ++ { 1, 0, 0, 0x00000c2c, 0xffffffff, 0x32323232, }, ++ { 1, 0, 0, 0x00000c30, 0xffffffff, 0x24262830, }, ++ { 1, 0, 1, 0x00000c34, 0xffffffff, 0x32323232, }, ++ { 1, 0, 1, 0x00000c38, 0xffffffff, 0x24262830, }, ++ { 1, 0, 0, 0x00000c3c, 0xffffffff, 0x32323232, }, ++ { 1, 0, 0, 0x00000c40, 0xffffffff, 0x24262830, }, ++ { 1, 0, 0, 0x00000c44, 0xffffffff, 0x32322222, }, ++ { 1, 0, 1, 0x00000c48, 0xffffffff, 0x28303232, }, ++ { 1, 0, 1, 0x00000c4c, 0xffffffff, 0x22222426, }, ++ { 1, 1, 0, 0x00000e24, 0xffffffff, 0x32323232, }, ++ { 1, 1, 0, 0x00000e28, 0xffffffff, 0x28303232, }, ++ { 1, 1, 0, 0x00000e2c, 0xffffffff, 0x32323232, }, ++ { 1, 1, 0, 0x00000e30, 0xffffffff, 0x24262830, }, ++ { 1, 1, 1, 0x00000e34, 0xffffffff, 0x32323232, }, ++ { 1, 1, 1, 0x00000e38, 0xffffffff, 0x24262830, }, ++ { 1, 1, 0, 0x00000e3c, 0xffffffff, 0x32323232, }, ++ { 1, 1, 0, 0x00000e40, 0xffffffff, 0x24262830, }, ++ { 1, 1, 0, 0x00000e44, 0xffffffff, 0x32322222, }, ++ { 1, 1, 1, 0x00000e48, 0xffffffff, 0x28303232, }, ++ { 1, 1, 1, 0x00000e4c, 0xffffffff, 0x22222426, }, ++}; ++ ++RTW_DECL_TABLE_BB_PG(rtw8812a_bb_pg_rfe3); ++ ++static const u32 rtw8812a_rf_a[] = { ++ 0x000, 0x00010000, ++ 0x018, 0x0001712A, ++ 0x056, 0x00051CF2, ++ 0x066, 0x00040000, ++ 0x01E, 0x00080000, ++ 0x089, 0x00000080, ++ 0x80000001, 0x00000000, 0x40000000, 0x00000000, ++ 0x086, 0x00014B3A, ++ 0x90000001, 0x00000005, 0x40000000, 0x00000000, ++ 0x086, 0x00014B3A, ++ 0xA0000000, 0x00000000, ++ 0x086, 0x00014B38, ++ 0xB0000000, 0x00000000, ++ 0x80000004, 0x00000000, 0x40000000, 0x00000000, ++ 0x08B, 0x00080180, ++ 0xA0000000, 0x00000000, ++ 0x08B, 0x00087180, ++ 0xB0000000, 0x00000000, ++ 0x0B1, 0x0001FC1A, ++ 0x0B3, 0x000F0810, ++ 0x0B4, 0x0001A78D, ++ 0x0BA, 0x00086180, ++ 0x018, 0x00000006, ++ 0x0EF, 0x00002000, ++ 0x80000001, 0x00000000, 0x40000000, 0x00000000, ++ 0x03B, 0x0003F218, ++ 0x03B, 0x00030A58, ++ 0x03B, 0x0002FA58, ++ 0x03B, 0x00022590, ++ 0x03B, 0x0001FA50, ++ 0x03B, 0x00010248, ++ 0x03B, 0x00008240, ++ 0x90000001, 0x00000005, 0x40000000, 0x00000000, ++ 0x03B, 0x0003F218, ++ 0x03B, 0x00030A58, ++ 0x03B, 0x0002FA58, ++ 0x03B, 0x00022590, ++ 0x03B, 0x0001FA50, ++ 0x03B, 0x00010248, ++ 0x03B, 0x00008240, ++ 0xA0000000, 0x00000000, ++ 0x03B, 0x00038A58, ++ 0x03B, 0x00037A58, ++ 0x03B, 0x0002A590, ++ 0x03B, 0x00027A50, ++ 0x03B, 0x00018248, ++ 0x03B, 0x00010240, ++ 0x03B, 0x00008240, ++ 0xB0000000, 0x00000000, ++ 0x0EF, 0x00000100, ++ 0x80000002, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0000A4EE, ++ 0x034, 0x00009076, ++ 0x034, 0x00008073, ++ 0x034, 0x00007070, ++ 0x034, 0x0000606D, ++ 0x034, 0x0000506A, ++ 0x034, 0x00004049, ++ 0x034, 0x00003046, ++ 0x034, 0x00002028, ++ 0x034, 0x00001025, ++ 0x034, 0x00000022, ++ 0xA0000000, 0x00000000, ++ 0x034, 0x0000ADF4, ++ 0x034, 0x00009DF1, ++ 0x034, 0x00008DEE, ++ 0x034, 0x00007DEB, ++ 0x034, 0x00006DE8, ++ 0x034, 0x00005DE5, ++ 0x034, 0x00004DE2, ++ 0x034, 0x00003CE6, ++ 0x034, 0x000024E7, ++ 0x034, 0x000014E4, ++ 0x034, 0x000004E1, ++ 0xB0000000, 0x00000000, ++ 0x0EF, 0x00000000, ++ 0x0EF, 0x000020A2, ++ 0x0DF, 0x00000080, ++ 0x035, 0x00000192, ++ 0x035, 0x00008192, ++ 0x035, 0x00010192, ++ 0x036, 0x00000024, ++ 0x036, 0x00008024, ++ 0x036, 0x00010024, ++ 0x036, 0x00018024, ++ 0x0EF, 0x00000000, ++ 0x051, 0x00000C21, ++ 0x052, 0x000006D9, ++ 0x053, 0x000FC649, ++ 0x054, 0x0000017E, ++ 0x0EF, 0x00000002, ++ 0x008, 0x00008400, ++ 0x018, 0x0001712A, ++ 0x0EF, 0x00001000, ++ 0x03A, 0x00000080, ++ 0x03B, 0x0003A02C, ++ 0x03C, 0x00004000, ++ 0x03A, 0x00000400, ++ 0x03B, 0x0003202C, ++ 0x03C, 0x00010000, ++ 0x03A, 0x000000A0, ++ 0x03B, 0x0002B064, ++ 0x03C, 0x00004000, ++ 0x03A, 0x000000D8, ++ 0x03B, 0x00023070, ++ 0x03C, 0x00004000, ++ 0x03A, 0x00000468, ++ 0x03B, 0x0001B870, ++ 0x03C, 0x00010000, ++ 0x03A, 0x00000098, ++ 0x03B, 0x00012085, ++ 0x03C, 0x000E4000, ++ 0x03A, 0x00000418, ++ 0x03B, 0x0000A080, ++ 0x03C, 0x000F0000, ++ 0x03A, 0x00000418, ++ 0x03B, 0x00002080, ++ 0x03C, 0x00010000, ++ 0x03A, 0x00000080, ++ 0x03B, 0x0007A02C, ++ 0x03C, 0x00004000, ++ 0x03A, 0x00000400, ++ 0x03B, 0x0007202C, ++ 0x03C, 0x00010000, ++ 0x03A, 0x000000A0, ++ 0x03B, 0x0006B064, ++ 0x03C, 0x00004000, ++ 0x03A, 0x000000D8, ++ 0x03B, 0x00063070, ++ 0x03C, 0x00004000, ++ 0x03A, 0x00000468, ++ 0x03B, 0x0005B870, ++ 0x03C, 0x00010000, ++ 0x03A, 0x00000098, ++ 0x03B, 0x00052085, ++ 0x03C, 0x000E4000, ++ 0x03A, 0x00000418, ++ 0x03B, 0x0004A080, ++ 0x03C, 0x000F0000, ++ 0x03A, 0x00000418, ++ 0x03B, 0x00042080, ++ 0x03C, 0x00010000, ++ 0x03A, 0x00000080, ++ 0x03B, 0x000BA02C, ++ 0x03C, 0x00004000, ++ 0x03A, 0x00000400, ++ 0x03B, 0x000B202C, ++ 0x03C, 0x00010000, ++ 0x03A, 0x000000A0, ++ 0x03B, 0x000AB064, ++ 0x03C, 0x00004000, ++ 0x03A, 0x000000D8, ++ 0x03B, 0x000A3070, ++ 0x03C, 0x00004000, ++ 0x03A, 0x00000468, ++ 0x03B, 0x0009B870, ++ 0x03C, 0x00010000, ++ 0x03A, 0x00000098, ++ 0x03B, 0x00092085, ++ 0x03C, 0x000E4000, ++ 0x03A, 0x00000418, ++ 0x03B, 0x0008A080, ++ 0x03C, 0x000F0000, ++ 0x03A, 0x00000418, ++ 0x03B, 0x00082080, ++ 0x03C, 0x00010000, ++ 0x0EF, 0x00001100, ++ 0x80000008, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0004A0B2, ++ 0x034, 0x000490AF, ++ 0x034, 0x00048070, ++ 0x034, 0x0004706D, ++ 0x034, 0x00046050, ++ 0x034, 0x0004504D, ++ 0x034, 0x0004404A, ++ 0x034, 0x00043047, ++ 0x034, 0x0004200A, ++ 0x034, 0x00041007, ++ 0x034, 0x00040004, ++ 0x90000008, 0x05000000, 0x40000000, 0x00000000, ++ 0x034, 0x0004A0B2, ++ 0x034, 0x000490AF, ++ 0x034, 0x00048070, ++ 0x034, 0x0004706D, ++ 0x034, 0x0004604D, ++ 0x034, 0x0004504A, ++ 0x034, 0x00044047, ++ 0x034, 0x00043044, ++ 0x034, 0x00042007, ++ 0x034, 0x00041004, ++ 0x034, 0x00040001, ++ 0xA0000000, 0x00000000, ++ 0x034, 0x0004ADF5, ++ 0x034, 0x00049DF2, ++ 0x034, 0x00048DEF, ++ 0x034, 0x00047DEC, ++ 0x034, 0x00046DE9, ++ 0x034, 0x00045DE6, ++ 0x034, 0x00044DE3, ++ 0x034, 0x000438C8, ++ 0x034, 0x000428C5, ++ 0x034, 0x000418C2, ++ 0x034, 0x000408C0, ++ 0xB0000000, 0x00000000, ++ 0x80000008, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0002A0B2, ++ 0x034, 0x000290AF, ++ 0x034, 0x00028070, ++ 0x034, 0x0002706D, ++ 0x034, 0x00026050, ++ 0x034, 0x0002504D, ++ 0x034, 0x0002404A, ++ 0x034, 0x00023047, ++ 0x034, 0x0002200A, ++ 0x034, 0x00021007, ++ 0x034, 0x00020004, ++ 0x90000008, 0x05000000, 0x40000000, 0x00000000, ++ 0x034, 0x0002A0B4, ++ 0x034, 0x000290B1, ++ 0x034, 0x00028072, ++ 0x034, 0x0002706F, ++ 0x034, 0x0002604F, ++ 0x034, 0x0002504C, ++ 0x034, 0x00024049, ++ 0x034, 0x00023046, ++ 0x034, 0x00022009, ++ 0x034, 0x00021006, ++ 0x034, 0x00020003, ++ 0xA0000000, 0x00000000, ++ 0x034, 0x0002ADF5, ++ 0x034, 0x00029DF2, ++ 0x034, 0x00028DEF, ++ 0x034, 0x00027DEC, ++ 0x034, 0x00026DE9, ++ 0x034, 0x00025DE6, ++ 0x034, 0x00024DE3, ++ 0x034, 0x000238C8, ++ 0x034, 0x000228C5, ++ 0x034, 0x000218C2, ++ 0x034, 0x000208C0, ++ 0xB0000000, 0x00000000, ++ 0x80000008, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0000A0B2, ++ 0x034, 0x000090AF, ++ 0x034, 0x00008070, ++ 0x034, 0x0000706D, ++ 0x034, 0x00006050, ++ 0x034, 0x0000504D, ++ 0x034, 0x0000404A, ++ 0x034, 0x00003047, ++ 0x034, 0x0000200A, ++ 0x034, 0x00001007, ++ 0x034, 0x00000004, ++ 0x90000008, 0x05000000, 0x40000000, 0x00000000, ++ 0x034, 0x0000A0B2, ++ 0x034, 0x000090AF, ++ 0x034, 0x00008070, ++ 0x034, 0x0000706D, ++ 0x034, 0x0000604D, ++ 0x034, 0x0000504A, ++ 0x034, 0x00004047, ++ 0x034, 0x00003044, ++ 0x034, 0x00002007, ++ 0x034, 0x00001004, ++ 0x034, 0x00000001, ++ 0xA0000000, 0x00000000, ++ 0x034, 0x0000AFF7, ++ 0x034, 0x00009DF7, ++ 0x034, 0x00008DF4, ++ 0x034, 0x00007DF1, ++ 0x034, 0x00006DEE, ++ 0x034, 0x00005DEB, ++ 0x034, 0x00004DE8, ++ 0x034, 0x000038CC, ++ 0x034, 0x000028C9, ++ 0x034, 0x000018C6, ++ 0x034, 0x000008C3, ++ 0xB0000000, 0x00000000, ++ 0x0EF, 0x00000000, ++ 0x80000008, 0x00000000, 0x40000000, 0x00000000, ++ 0x018, 0x0001712A, ++ 0x0EF, 0x00000040, ++ 0x035, 0x000001D4, ++ 0x035, 0x000081D4, ++ 0x035, 0x000101D4, ++ 0x035, 0x000201B4, ++ 0x035, 0x000281B4, ++ 0x035, 0x000301B4, ++ 0x035, 0x000401B4, ++ 0x035, 0x000481B4, ++ 0x035, 0x000501B4, ++ 0x90000008, 0x05000000, 0x40000000, 0x00000000, ++ 0x018, 0x0001712A, ++ 0x0EF, 0x00000040, ++ 0x035, 0x000001D4, ++ 0x035, 0x000081D4, ++ 0x035, 0x000101D4, ++ 0x035, 0x000201B4, ++ 0x035, 0x000281B4, ++ 0x035, 0x000301B4, ++ 0x035, 0x000401B4, ++ 0x035, 0x000481B4, ++ 0x035, 0x000501B4, ++ 0xA0000000, 0x00000000, ++ 0x018, 0x0001712A, ++ 0x0EF, 0x00000040, ++ 0x035, 0x00000188, ++ 0x035, 0x00008147, ++ 0x035, 0x00010147, ++ 0x035, 0x000201D7, ++ 0x035, 0x000281D7, ++ 0x035, 0x000301D7, ++ 0x035, 0x000401D8, ++ 0x035, 0x000481D8, ++ 0x035, 0x000501D8, ++ 0xB0000000, 0x00000000, ++ 0x0EF, 0x00000000, ++ 0x80000008, 0x00000000, 0x40000000, 0x00000000, ++ 0x018, 0x0001712A, ++ 0x0EF, 0x00000010, ++ 0x036, 0x00004BFB, ++ 0x036, 0x0000CBFB, ++ 0x036, 0x00014BFB, ++ 0x036, 0x0001CBFB, ++ 0x036, 0x00024F4B, ++ 0x036, 0x0002CF4B, ++ 0x036, 0x00034F4B, ++ 0x036, 0x0003CF4B, ++ 0x036, 0x00044F4B, ++ 0x036, 0x0004CF4B, ++ 0x036, 0x00054F4B, ++ 0x036, 0x0005CF4B, ++ 0x90000008, 0x05000000, 0x40000000, 0x00000000, ++ 0x018, 0x0001712A, ++ 0x0EF, 0x00000010, ++ 0x036, 0x00004BFB, ++ 0x036, 0x0000CBFB, ++ 0x036, 0x00014BFB, ++ 0x036, 0x0001CBFB, ++ 0x036, 0x00024F4B, ++ 0x036, 0x0002CF4B, ++ 0x036, 0x00034F4B, ++ 0x036, 0x0003CF4B, ++ 0x036, 0x00044F4B, ++ 0x036, 0x0004CF4B, ++ 0x036, 0x00054F4B, ++ 0x036, 0x0005CF4B, ++ 0xA0000000, 0x00000000, ++ 0x018, 0x0001712A, ++ 0x0EF, 0x00000010, ++ 0x036, 0x00084EB4, ++ 0x036, 0x0008CC35, ++ 0x036, 0x00094C35, ++ 0x036, 0x0009CC35, ++ 0x036, 0x000A4C35, ++ 0x036, 0x000ACC35, ++ 0x036, 0x000B4C35, ++ 0x036, 0x000BCC35, ++ 0x036, 0x000C4C34, ++ 0x036, 0x000CCC35, ++ 0x036, 0x000D4C35, ++ 0x036, 0x000DCC35, ++ 0xB0000000, 0x00000000, ++ 0x0EF, 0x00000000, ++ 0x0EF, 0x00000008, ++ 0x80000008, 0x00000000, 0x40000000, 0x00000000, ++ 0x03C, 0x000002CC, ++ 0x03C, 0x00000522, ++ 0x03C, 0x00000902, ++ 0x90000008, 0x05000000, 0x40000000, 0x00000000, ++ 0x03C, 0x000002CC, ++ 0x03C, 0x00000522, ++ 0x03C, 0x00000902, ++ 0xA0000000, 0x00000000, ++ 0x03C, 0x000002A8, ++ 0x03C, 0x000005A2, ++ 0x03C, 0x00000880, ++ 0xB0000000, 0x00000000, ++ 0x0EF, 0x00000000, ++ 0x018, 0x0001712A, ++ 0x0EF, 0x00000002, ++ 0x0DF, 0x00000080, ++ 0x01F, 0x00000064, ++ 0x80000008, 0x00000000, 0x40000000, 0x00000000, ++ 0x061, 0x000FDD43, ++ 0x062, 0x00038F4B, ++ 0x063, 0x00032117, ++ 0x064, 0x000194AC, ++ 0x065, 0x000931D1, ++ 0x90000008, 0x05000000, 0x40000000, 0x00000000, ++ 0x061, 0x000FDD43, ++ 0x062, 0x00038F4B, ++ 0x063, 0x00032117, ++ 0x064, 0x000194AC, ++ 0x065, 0x000931D2, ++ 0xA0000000, 0x00000000, ++ 0x061, 0x000E5D53, ++ 0x062, 0x00038FCD, ++ 0x063, 0x000114EB, ++ 0x064, 0x000196AC, ++ 0x065, 0x000911D7, ++ 0xB0000000, 0x00000000, ++ 0x008, 0x00008400, ++ 0x01C, 0x000739D2, ++ 0x0B4, 0x0001E78D, ++ 0x018, 0x0001F12A, ++ 0xFFE, 0x00000000, ++ 0xFFE, 0x00000000, ++ 0xFFE, 0x00000000, ++ 0xFFE, 0x00000000, ++ 0x0B4, 0x0001A78D, ++ 0x018, 0x0001712A, ++}; ++ ++RTW_DECL_TABLE_RF_RADIO(rtw8812a_rf_a, A); ++ ++static const u32 rtw8812a_rf_b[] = { ++ 0x056, 0x00051CF2, ++ 0x066, 0x00040000, ++ 0x089, 0x00000080, ++ 0x80000001, 0x00000000, 0x40000000, 0x00000000, ++ 0x086, 0x00014B3A, ++ 0x90000001, 0x00000005, 0x40000000, 0x00000000, ++ 0x086, 0x00014B3A, ++ 0xA0000000, 0x00000000, ++ 0x086, 0x00014B38, ++ 0xB0000000, 0x00000000, ++ 0x80000004, 0x00000000, 0x40000000, 0x00000000, ++ 0x08B, 0x00080180, ++ 0xA0000000, 0x00000000, ++ 0x08B, 0x00087180, ++ 0xB0000000, 0x00000000, ++ 0x018, 0x00000006, ++ 0x0EF, 0x00002000, ++ 0x80000001, 0x00000000, 0x40000000, 0x00000000, ++ 0x03B, 0x0003F218, ++ 0x03B, 0x00030A58, ++ 0x03B, 0x0002FA58, ++ 0x03B, 0x00022590, ++ 0x03B, 0x0001FA50, ++ 0x03B, 0x00010248, ++ 0x03B, 0x00008240, ++ 0x90000001, 0x00000005, 0x40000000, 0x00000000, ++ 0x03B, 0x0003F218, ++ 0x03B, 0x00030A58, ++ 0x03B, 0x0002FA58, ++ 0x03B, 0x00022590, ++ 0x03B, 0x0001FA50, ++ 0x03B, 0x00010248, ++ 0x03B, 0x00008240, ++ 0xA0000000, 0x00000000, ++ 0x03B, 0x00038A58, ++ 0x03B, 0x00037A58, ++ 0x03B, 0x0002A590, ++ 0x03B, 0x00027A50, ++ 0x03B, 0x00018248, ++ 0x03B, 0x00010240, ++ 0x03B, 0x00008240, ++ 0xB0000000, 0x00000000, ++ 0x0EF, 0x00000100, ++ 0x80000002, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0000A4EE, ++ 0x034, 0x00009076, ++ 0x034, 0x00008073, ++ 0x034, 0x00007070, ++ 0x034, 0x0000606D, ++ 0x034, 0x0000506A, ++ 0x034, 0x00004049, ++ 0x034, 0x00003046, ++ 0x034, 0x00002028, ++ 0x034, 0x00001025, ++ 0x034, 0x00000022, ++ 0xA0000000, 0x00000000, ++ 0x034, 0x0000ADF4, ++ 0x034, 0x00009DF1, ++ 0x034, 0x00008DEE, ++ 0x034, 0x00007DEB, ++ 0x034, 0x00006DE8, ++ 0x034, 0x00005DE5, ++ 0x034, 0x00004DE2, ++ 0x034, 0x00003CE6, ++ 0x034, 0x000024E7, ++ 0x034, 0x000014E4, ++ 0x034, 0x000004E1, ++ 0xB0000000, 0x00000000, ++ 0x0EF, 0x00000000, ++ 0x0EF, 0x000020A2, ++ 0x0DF, 0x00000080, ++ 0x035, 0x00000192, ++ 0x035, 0x00008192, ++ 0x035, 0x00010192, ++ 0x036, 0x00000024, ++ 0x036, 0x00008024, ++ 0x036, 0x00010024, ++ 0x036, 0x00018024, ++ 0x0EF, 0x00000000, ++ 0x051, 0x00000C21, ++ 0x052, 0x000006D9, ++ 0x053, 0x000FC649, ++ 0x054, 0x0000017E, ++ 0x0EF, 0x00000002, ++ 0x008, 0x00008400, ++ 0x018, 0x0001712A, ++ 0x0EF, 0x00001000, ++ 0x03A, 0x00000080, ++ 0x03B, 0x0003A02C, ++ 0x03C, 0x00004000, ++ 0x03A, 0x00000400, ++ 0x03B, 0x0003202C, ++ 0x03C, 0x00010000, ++ 0x03A, 0x000000A0, ++ 0x03B, 0x0002B064, ++ 0x03C, 0x00004000, ++ 0x03A, 0x000000D8, ++ 0x03B, 0x00023070, ++ 0x03C, 0x00004000, ++ 0x03A, 0x00000468, ++ 0x03B, 0x0001B870, ++ 0x03C, 0x00010000, ++ 0x03A, 0x00000098, ++ 0x03B, 0x00012085, ++ 0x03C, 0x000E4000, ++ 0x03A, 0x00000418, ++ 0x03B, 0x0000A080, ++ 0x03C, 0x000F0000, ++ 0x03A, 0x00000418, ++ 0x03B, 0x00002080, ++ 0x03C, 0x00010000, ++ 0x03A, 0x00000080, ++ 0x03B, 0x0007A02C, ++ 0x03C, 0x00004000, ++ 0x03A, 0x00000400, ++ 0x03B, 0x0007202C, ++ 0x03C, 0x00010000, ++ 0x03A, 0x000000A0, ++ 0x03B, 0x0006B064, ++ 0x03C, 0x00004000, ++ 0x03A, 0x000000D8, ++ 0x03B, 0x00063070, ++ 0x03C, 0x00004000, ++ 0x03A, 0x00000468, ++ 0x03B, 0x0005B870, ++ 0x03C, 0x00010000, ++ 0x03A, 0x00000098, ++ 0x03B, 0x00052085, ++ 0x03C, 0x000E4000, ++ 0x03A, 0x00000418, ++ 0x03B, 0x0004A080, ++ 0x03C, 0x000F0000, ++ 0x03A, 0x00000418, ++ 0x03B, 0x00042080, ++ 0x03C, 0x00010000, ++ 0x03A, 0x00000080, ++ 0x03B, 0x000BA02C, ++ 0x03C, 0x00004000, ++ 0x03A, 0x00000400, ++ 0x03B, 0x000B202C, ++ 0x03C, 0x00010000, ++ 0x03A, 0x000000A0, ++ 0x03B, 0x000AB064, ++ 0x03C, 0x00004000, ++ 0x03A, 0x000000D8, ++ 0x03B, 0x000A3070, ++ 0x03C, 0x00004000, ++ 0x03A, 0x00000468, ++ 0x03B, 0x0009B870, ++ 0x03C, 0x00010000, ++ 0x03A, 0x00000098, ++ 0x03B, 0x00092085, ++ 0x03C, 0x000E4000, ++ 0x03A, 0x00000418, ++ 0x03B, 0x0008A080, ++ 0x03C, 0x000F0000, ++ 0x03A, 0x00000418, ++ 0x03B, 0x00082080, ++ 0x03C, 0x00010000, ++ 0x0EF, 0x00001100, ++ 0x80000008, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0004A0B2, ++ 0x034, 0x000490AF, ++ 0x034, 0x00048070, ++ 0x034, 0x0004706D, ++ 0x034, 0x00046050, ++ 0x034, 0x0004504D, ++ 0x034, 0x0004404A, ++ 0x034, 0x00043047, ++ 0x034, 0x0004200A, ++ 0x034, 0x00041007, ++ 0x034, 0x00040004, ++ 0x90000008, 0x05000000, 0x40000000, 0x00000000, ++ 0x034, 0x0004A0B1, ++ 0x034, 0x000490AE, ++ 0x034, 0x0004806F, ++ 0x034, 0x0004706C, ++ 0x034, 0x0004604C, ++ 0x034, 0x00045049, ++ 0x034, 0x00044046, ++ 0x034, 0x00043043, ++ 0x034, 0x00042006, ++ 0x034, 0x00041003, ++ 0x034, 0x00040000, ++ 0xA0000000, 0x00000000, ++ 0x034, 0x0004ADF5, ++ 0x034, 0x00049DF2, ++ 0x034, 0x00048DEF, ++ 0x034, 0x00047DEC, ++ 0x034, 0x00046DE9, ++ 0x034, 0x00045DE6, ++ 0x034, 0x00044DE3, ++ 0x034, 0x000438C8, ++ 0x034, 0x000428C5, ++ 0x034, 0x000418C2, ++ 0x034, 0x000408C0, ++ 0xB0000000, 0x00000000, ++ 0x80000008, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0002A0B2, ++ 0x034, 0x000290AF, ++ 0x034, 0x00028070, ++ 0x034, 0x0002706D, ++ 0x034, 0x00026050, ++ 0x034, 0x0002504D, ++ 0x034, 0x0002404A, ++ 0x034, 0x00023047, ++ 0x034, 0x0002200A, ++ 0x034, 0x00021007, ++ 0x034, 0x00020004, ++ 0x90000008, 0x05000000, 0x40000000, 0x00000000, ++ 0x034, 0x0002A0B3, ++ 0x034, 0x000290B0, ++ 0x034, 0x00028071, ++ 0x034, 0x0002706E, ++ 0x034, 0x0002604E, ++ 0x034, 0x0002504B, ++ 0x034, 0x00024048, ++ 0x034, 0x00023045, ++ 0x034, 0x00022008, ++ 0x034, 0x00021005, ++ 0x034, 0x00020002, ++ 0xA0000000, 0x00000000, ++ 0x034, 0x0002ADF5, ++ 0x034, 0x00029DF2, ++ 0x034, 0x00028DEF, ++ 0x034, 0x00027DEC, ++ 0x034, 0x00026DE9, ++ 0x034, 0x00025DE6, ++ 0x034, 0x00024DE3, ++ 0x034, 0x000238C8, ++ 0x034, 0x000228C5, ++ 0x034, 0x000218C2, ++ 0x034, 0x000208C0, ++ 0xB0000000, 0x00000000, ++ 0x80000008, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0000A0B2, ++ 0x034, 0x000090AF, ++ 0x034, 0x00008070, ++ 0x034, 0x0000706D, ++ 0x034, 0x00006050, ++ 0x034, 0x0000504D, ++ 0x034, 0x0000404A, ++ 0x034, 0x00003047, ++ 0x034, 0x0000200A, ++ 0x034, 0x00001007, ++ 0x034, 0x00000004, ++ 0x90000008, 0x05000000, 0x40000000, 0x00000000, ++ 0x034, 0x0000A0B3, ++ 0x034, 0x000090B0, ++ 0x034, 0x00008070, ++ 0x034, 0x0000706D, ++ 0x034, 0x0000604D, ++ 0x034, 0x0000504A, ++ 0x034, 0x00004047, ++ 0x034, 0x00003044, ++ 0x034, 0x00002007, ++ 0x034, 0x00001004, ++ 0x034, 0x00000001, ++ 0xA0000000, 0x00000000, ++ 0x034, 0x0000AFF7, ++ 0x034, 0x00009DF7, ++ 0x034, 0x00008DF4, ++ 0x034, 0x00007DF1, ++ 0x034, 0x00006DEE, ++ 0x034, 0x00005DEB, ++ 0x034, 0x00004DE8, ++ 0x034, 0x000038CC, ++ 0x034, 0x000028C9, ++ 0x034, 0x000018C6, ++ 0x034, 0x000008C3, ++ 0xB0000000, 0x00000000, ++ 0x0EF, 0x00000000, ++ 0x80000008, 0x00000000, 0x40000000, 0x00000000, ++ 0x018, 0x0001712A, ++ 0x0EF, 0x00000040, ++ 0x035, 0x000001C5, ++ 0x035, 0x000081C5, ++ 0x035, 0x000101C5, ++ 0x035, 0x00020174, ++ 0x035, 0x00028174, ++ 0x035, 0x00030174, ++ 0x035, 0x00040185, ++ 0x035, 0x00048185, ++ 0x035, 0x00050185, ++ 0x0EF, 0x00000000, ++ 0x90000008, 0x05000000, 0x40000000, 0x00000000, ++ 0x018, 0x0001712A, ++ 0x0EF, 0x00000040, ++ 0x035, 0x000001C5, ++ 0x035, 0x000081C5, ++ 0x035, 0x000101C5, ++ 0x035, 0x00020174, ++ 0x035, 0x00028174, ++ 0x035, 0x00030174, ++ 0x035, 0x00040185, ++ 0x035, 0x00048185, ++ 0x035, 0x00050185, ++ 0x0EF, 0x00000000, ++ 0xA0000000, 0x00000000, ++ 0x018, 0x0001712A, ++ 0x0EF, 0x00000040, ++ 0x035, 0x00000188, ++ 0x035, 0x00008147, ++ 0x035, 0x00010147, ++ 0x035, 0x000201D7, ++ 0x035, 0x000281D7, ++ 0x035, 0x000301D7, ++ 0x035, 0x000401D8, ++ 0x035, 0x000481D8, ++ 0x035, 0x000501D8, ++ 0x0EF, 0x00000000, ++ 0xB0000000, 0x00000000, ++ 0x80000008, 0x00000000, 0x40000000, 0x00000000, ++ 0x018, 0x0001712A, ++ 0x0EF, 0x00000010, ++ 0x036, 0x00005B8B, ++ 0x036, 0x0000DB8B, ++ 0x036, 0x00015B8B, ++ 0x036, 0x0001DB8B, ++ 0x036, 0x000262DB, ++ 0x036, 0x0002E2DB, ++ 0x036, 0x000362DB, ++ 0x036, 0x0003E2DB, ++ 0x036, 0x0004553B, ++ 0x036, 0x0004D53B, ++ 0x036, 0x0005553B, ++ 0x036, 0x0005D53B, ++ 0x90000008, 0x05000000, 0x40000000, 0x00000000, ++ 0x018, 0x0001712A, ++ 0x0EF, 0x00000010, ++ 0x036, 0x00005B8B, ++ 0x036, 0x0000DB8B, ++ 0x036, 0x00015B8B, ++ 0x036, 0x0001DB8B, ++ 0x036, 0x000262DB, ++ 0x036, 0x0002E2DB, ++ 0x036, 0x000362DB, ++ 0x036, 0x0003E2DB, ++ 0x036, 0x0004553B, ++ 0x036, 0x0004D53B, ++ 0x036, 0x0005553B, ++ 0x036, 0x0005D53B, ++ 0xA0000000, 0x00000000, ++ 0x018, 0x0001712A, ++ 0x0EF, 0x00000010, ++ 0x036, 0x00084EB4, ++ 0x036, 0x0008CC35, ++ 0x036, 0x00094C35, ++ 0x036, 0x0009CC35, ++ 0x036, 0x000A4C35, ++ 0x036, 0x000ACC35, ++ 0x036, 0x000B4C35, ++ 0x036, 0x000BCC35, ++ 0x036, 0x000C4C34, ++ 0x036, 0x000CCC35, ++ 0x036, 0x000D4C35, ++ 0x036, 0x000DCC35, ++ 0xB0000000, 0x00000000, ++ 0x0EF, 0x00000000, ++ 0x0EF, 0x00000008, ++ 0x80000008, 0x00000000, 0x40000000, 0x00000000, ++ 0x03C, 0x000002DC, ++ 0x03C, 0x00000524, ++ 0x03C, 0x00000902, ++ 0x90000008, 0x05000000, 0x40000000, 0x00000000, ++ 0x03C, 0x000002DC, ++ 0x03C, 0x00000524, ++ 0x03C, 0x00000902, ++ 0xA0000000, 0x00000000, ++ 0x03C, 0x000002A8, ++ 0x03C, 0x000005A2, ++ 0x03C, 0x00000880, ++ 0xB0000000, 0x00000000, ++ 0x0EF, 0x00000000, ++ 0x018, 0x0001712A, ++ 0x0EF, 0x00000002, ++ 0x0DF, 0x00000080, ++ 0x80000008, 0x00000000, 0x40000000, 0x00000000, ++ 0x061, 0x000EAC43, ++ 0x062, 0x00038F47, ++ 0x063, 0x00031157, ++ 0x064, 0x0001C4AC, ++ 0x065, 0x000931D1, ++ 0x90000008, 0x05000000, 0x40000000, 0x00000000, ++ 0x061, 0x000EAC43, ++ 0x062, 0x00038F47, ++ 0x063, 0x00031157, ++ 0x064, 0x0001C4AC, ++ 0x065, 0x000931D2, ++ 0x90000002, 0x00000000, 0x40000000, 0x00000000, ++ 0x061, 0x000EAC43, ++ 0x062, 0x00038F47, ++ 0x063, 0x00031157, ++ 0x064, 0x0001C4AC, ++ 0x065, 0x000931D1, ++ 0xA0000000, 0x00000000, ++ 0x061, 0x000E5D53, ++ 0x062, 0x00038FCD, ++ 0x063, 0x000114EB, ++ 0x064, 0x000196AC, ++ 0x065, 0x000911D7, ++ 0xB0000000, 0x00000000, ++ 0x008, 0x00008400, ++}; ++ ++RTW_DECL_TABLE_RF_RADIO(rtw8812a_rf_b, B); ++ ++static const struct rtw_txpwr_lmt_cfg_pair rtw8812a_txpwr_lmt[] = { ++ { 0, 0, 0, 0, 1, 36, }, ++ { 2, 0, 0, 0, 1, 32, }, ++ { 1, 0, 0, 0, 1, 32, }, ++ { 0, 0, 0, 0, 2, 36, }, ++ { 2, 0, 0, 0, 2, 32, }, ++ { 1, 0, 0, 0, 2, 32, }, ++ { 0, 0, 0, 0, 3, 36, }, ++ { 2, 0, 0, 0, 3, 32, }, ++ { 1, 0, 0, 0, 3, 32, }, ++ { 0, 0, 0, 0, 4, 36, }, ++ { 2, 0, 0, 0, 4, 32, }, ++ { 1, 0, 0, 0, 4, 32, }, ++ { 0, 0, 0, 0, 5, 36, }, ++ { 2, 0, 0, 0, 5, 32, }, ++ { 1, 0, 0, 0, 5, 32, }, ++ { 0, 0, 0, 0, 6, 36, }, ++ { 2, 0, 0, 0, 6, 32, }, ++ { 1, 0, 0, 0, 6, 32, }, ++ { 0, 0, 0, 0, 7, 36, }, ++ { 2, 0, 0, 0, 7, 32, }, ++ { 1, 0, 0, 0, 7, 32, }, ++ { 0, 0, 0, 0, 8, 36, }, ++ { 2, 0, 0, 0, 8, 32, }, ++ { 1, 0, 0, 0, 8, 32, }, ++ { 0, 0, 0, 0, 9, 36, }, ++ { 2, 0, 0, 0, 9, 32, }, ++ { 1, 0, 0, 0, 9, 32, }, ++ { 0, 0, 0, 0, 10, 36, }, ++ { 2, 0, 0, 0, 10, 32, }, ++ { 1, 0, 0, 0, 10, 32, }, ++ { 0, 0, 0, 0, 11, 36, }, ++ { 2, 0, 0, 0, 11, 32, }, ++ { 1, 0, 0, 0, 11, 32, }, ++ { 0, 0, 0, 0, 12, 63, }, ++ { 2, 0, 0, 0, 12, 32, }, ++ { 1, 0, 0, 0, 12, 32, }, ++ { 0, 0, 0, 0, 13, 63, }, ++ { 2, 0, 0, 0, 13, 32, }, ++ { 1, 0, 0, 0, 13, 32, }, ++ { 0, 0, 0, 0, 14, 63, }, ++ { 2, 0, 0, 0, 14, 63, }, ++ { 1, 0, 0, 0, 14, 32, }, ++ { 0, 0, 0, 1, 1, 34, }, ++ { 2, 0, 0, 1, 1, 32, }, ++ { 1, 0, 0, 1, 1, 32, }, ++ { 0, 0, 0, 1, 2, 36, }, ++ { 2, 0, 0, 1, 2, 32, }, ++ { 1, 0, 0, 1, 2, 32, }, ++ { 0, 0, 0, 1, 3, 36, }, ++ { 2, 0, 0, 1, 3, 32, }, ++ { 1, 0, 0, 1, 3, 32, }, ++ { 0, 0, 0, 1, 4, 36, }, ++ { 2, 0, 0, 1, 4, 32, }, ++ { 1, 0, 0, 1, 4, 32, }, ++ { 0, 0, 0, 1, 5, 36, }, ++ { 2, 0, 0, 1, 5, 32, }, ++ { 1, 0, 0, 1, 5, 32, }, ++ { 0, 0, 0, 1, 6, 36, }, ++ { 2, 0, 0, 1, 6, 32, }, ++ { 1, 0, 0, 1, 6, 32, }, ++ { 0, 0, 0, 1, 7, 36, }, ++ { 2, 0, 0, 1, 7, 32, }, ++ { 1, 0, 0, 1, 7, 32, }, ++ { 0, 0, 0, 1, 8, 36, }, ++ { 2, 0, 0, 1, 8, 32, }, ++ { 1, 0, 0, 1, 8, 32, }, ++ { 0, 0, 0, 1, 9, 36, }, ++ { 2, 0, 0, 1, 9, 32, }, ++ { 1, 0, 0, 1, 9, 32, }, ++ { 0, 0, 0, 1, 10, 36, }, ++ { 2, 0, 0, 1, 10, 32, }, ++ { 1, 0, 0, 1, 10, 32, }, ++ { 0, 0, 0, 1, 11, 32, }, ++ { 2, 0, 0, 1, 11, 32, }, ++ { 1, 0, 0, 1, 11, 32, }, ++ { 0, 0, 0, 1, 12, 63, }, ++ { 2, 0, 0, 1, 12, 32, }, ++ { 1, 0, 0, 1, 12, 32, }, ++ { 0, 0, 0, 1, 13, 63, }, ++ { 2, 0, 0, 1, 13, 32, }, ++ { 1, 0, 0, 1, 13, 32, }, ++ { 0, 0, 0, 1, 14, 63, }, ++ { 2, 0, 0, 1, 14, 63, }, ++ { 1, 0, 0, 1, 14, 63, }, ++ { 0, 0, 0, 2, 1, 34, }, ++ { 2, 0, 0, 2, 1, 32, }, ++ { 1, 0, 0, 2, 1, 32, }, ++ { 0, 0, 0, 2, 2, 36, }, ++ { 2, 0, 0, 2, 2, 32, }, ++ { 1, 0, 0, 2, 2, 32, }, ++ { 0, 0, 0, 2, 3, 36, }, ++ { 2, 0, 0, 2, 3, 32, }, ++ { 1, 0, 0, 2, 3, 32, }, ++ { 0, 0, 0, 2, 4, 36, }, ++ { 2, 0, 0, 2, 4, 32, }, ++ { 1, 0, 0, 2, 4, 32, }, ++ { 0, 0, 0, 2, 5, 36, }, ++ { 2, 0, 0, 2, 5, 32, }, ++ { 1, 0, 0, 2, 5, 32, }, ++ { 0, 0, 0, 2, 6, 36, }, ++ { 2, 0, 0, 2, 6, 32, }, ++ { 1, 0, 0, 2, 6, 32, }, ++ { 0, 0, 0, 2, 7, 36, }, ++ { 2, 0, 0, 2, 7, 32, }, ++ { 1, 0, 0, 2, 7, 32, }, ++ { 0, 0, 0, 2, 8, 36, }, ++ { 2, 0, 0, 2, 8, 32, }, ++ { 1, 0, 0, 2, 8, 32, }, ++ { 0, 0, 0, 2, 9, 36, }, ++ { 2, 0, 0, 2, 9, 32, }, ++ { 1, 0, 0, 2, 9, 32, }, ++ { 0, 0, 0, 2, 10, 36, }, ++ { 2, 0, 0, 2, 10, 32, }, ++ { 1, 0, 0, 2, 10, 32, }, ++ { 0, 0, 0, 2, 11, 32, }, ++ { 2, 0, 0, 2, 11, 32, }, ++ { 1, 0, 0, 2, 11, 32, }, ++ { 0, 0, 0, 2, 12, 63, }, ++ { 2, 0, 0, 2, 12, 32, }, ++ { 1, 0, 0, 2, 12, 32, }, ++ { 0, 0, 0, 2, 13, 63, }, ++ { 2, 0, 0, 2, 13, 32, }, ++ { 1, 0, 0, 2, 13, 32, }, ++ { 0, 0, 0, 2, 14, 63, }, ++ { 2, 0, 0, 2, 14, 63, }, ++ { 1, 0, 0, 2, 14, 63, }, ++ { 0, 0, 0, 3, 1, 32, }, ++ { 2, 0, 0, 3, 1, 32, }, ++ { 1, 0, 0, 3, 1, 32, }, ++ { 0, 0, 0, 3, 2, 34, }, ++ { 2, 0, 0, 3, 2, 32, }, ++ { 1, 0, 0, 3, 2, 32, }, ++ { 0, 0, 0, 3, 3, 34, }, ++ { 2, 0, 0, 3, 3, 32, }, ++ { 1, 0, 0, 3, 3, 32, }, ++ { 0, 0, 0, 3, 4, 34, }, ++ { 2, 0, 0, 3, 4, 32, }, ++ { 1, 0, 0, 3, 4, 32, }, ++ { 0, 0, 0, 3, 5, 34, }, ++ { 2, 0, 0, 3, 5, 32, }, ++ { 1, 0, 0, 3, 5, 32, }, ++ { 0, 0, 0, 3, 6, 34, }, ++ { 2, 0, 0, 3, 6, 32, }, ++ { 1, 0, 0, 3, 6, 32, }, ++ { 0, 0, 0, 3, 7, 34, }, ++ { 2, 0, 0, 3, 7, 32, }, ++ { 1, 0, 0, 3, 7, 32, }, ++ { 0, 0, 0, 3, 8, 34, }, ++ { 2, 0, 0, 3, 8, 32, }, ++ { 1, 0, 0, 3, 8, 32, }, ++ { 0, 0, 0, 3, 9, 34, }, ++ { 2, 0, 0, 3, 9, 32, }, ++ { 1, 0, 0, 3, 9, 32, }, ++ { 0, 0, 0, 3, 10, 34, }, ++ { 2, 0, 0, 3, 10, 32, }, ++ { 1, 0, 0, 3, 10, 32, }, ++ { 0, 0, 0, 3, 11, 30, }, ++ { 2, 0, 0, 3, 11, 32, }, ++ { 1, 0, 0, 3, 11, 32, }, ++ { 0, 0, 0, 3, 12, 63, }, ++ { 2, 0, 0, 3, 12, 32, }, ++ { 1, 0, 0, 3, 12, 32, }, ++ { 0, 0, 0, 3, 13, 63, }, ++ { 2, 0, 0, 3, 13, 32, }, ++ { 1, 0, 0, 3, 13, 32, }, ++ { 0, 0, 0, 3, 14, 63, }, ++ { 2, 0, 0, 3, 14, 63, }, ++ { 1, 0, 0, 3, 14, 63, }, ++ { 0, 0, 1, 2, 1, 63, }, ++ { 2, 0, 1, 2, 1, 63, }, ++ { 1, 0, 1, 2, 1, 63, }, ++ { 0, 0, 1, 2, 2, 63, }, ++ { 2, 0, 1, 2, 2, 63, }, ++ { 1, 0, 1, 2, 2, 63, }, ++ { 0, 0, 1, 2, 3, 32, }, ++ { 2, 0, 1, 2, 3, 32, }, ++ { 1, 0, 1, 2, 3, 32, }, ++ { 0, 0, 1, 2, 4, 36, }, ++ { 2, 0, 1, 2, 4, 32, }, ++ { 1, 0, 1, 2, 4, 32, }, ++ { 0, 0, 1, 2, 5, 36, }, ++ { 2, 0, 1, 2, 5, 32, }, ++ { 1, 0, 1, 2, 5, 32, }, ++ { 0, 0, 1, 2, 6, 36, }, ++ { 2, 0, 1, 2, 6, 32, }, ++ { 1, 0, 1, 2, 6, 32, }, ++ { 0, 0, 1, 2, 7, 36, }, ++ { 2, 0, 1, 2, 7, 32, }, ++ { 1, 0, 1, 2, 7, 32, }, ++ { 0, 0, 1, 2, 8, 36, }, ++ { 2, 0, 1, 2, 8, 32, }, ++ { 1, 0, 1, 2, 8, 32, }, ++ { 0, 0, 1, 2, 9, 36, }, ++ { 2, 0, 1, 2, 9, 32, }, ++ { 1, 0, 1, 2, 9, 32, }, ++ { 0, 0, 1, 2, 10, 36, }, ++ { 2, 0, 1, 2, 10, 32, }, ++ { 1, 0, 1, 2, 10, 32, }, ++ { 0, 0, 1, 2, 11, 32, }, ++ { 2, 0, 1, 2, 11, 32, }, ++ { 1, 0, 1, 2, 11, 32, }, ++ { 0, 0, 1, 2, 12, 63, }, ++ { 2, 0, 1, 2, 12, 32, }, ++ { 1, 0, 1, 2, 12, 32, }, ++ { 0, 0, 1, 2, 13, 63, }, ++ { 2, 0, 1, 2, 13, 32, }, ++ { 1, 0, 1, 2, 13, 32, }, ++ { 0, 0, 1, 2, 14, 63, }, ++ { 2, 0, 1, 2, 14, 63, }, ++ { 1, 0, 1, 2, 14, 63, }, ++ { 0, 0, 1, 3, 1, 63, }, ++ { 2, 0, 1, 3, 1, 63, }, ++ { 1, 0, 1, 3, 1, 63, }, ++ { 0, 0, 1, 3, 2, 63, }, ++ { 2, 0, 1, 3, 2, 63, }, ++ { 1, 0, 1, 3, 2, 63, }, ++ { 0, 0, 1, 3, 3, 30, }, ++ { 2, 0, 1, 3, 3, 30, }, ++ { 1, 0, 1, 3, 3, 30, }, ++ { 0, 0, 1, 3, 4, 34, }, ++ { 2, 0, 1, 3, 4, 30, }, ++ { 1, 0, 1, 3, 4, 30, }, ++ { 0, 0, 1, 3, 5, 34, }, ++ { 2, 0, 1, 3, 5, 30, }, ++ { 1, 0, 1, 3, 5, 30, }, ++ { 0, 0, 1, 3, 6, 34, }, ++ { 2, 0, 1, 3, 6, 30, }, ++ { 1, 0, 1, 3, 6, 30, }, ++ { 0, 0, 1, 3, 7, 34, }, ++ { 2, 0, 1, 3, 7, 30, }, ++ { 1, 0, 1, 3, 7, 30, }, ++ { 0, 0, 1, 3, 8, 34, }, ++ { 2, 0, 1, 3, 8, 30, }, ++ { 1, 0, 1, 3, 8, 30, }, ++ { 0, 0, 1, 3, 9, 34, }, ++ { 2, 0, 1, 3, 9, 30, }, ++ { 1, 0, 1, 3, 9, 30, }, ++ { 0, 0, 1, 3, 10, 34, }, ++ { 2, 0, 1, 3, 10, 30, }, ++ { 1, 0, 1, 3, 10, 30, }, ++ { 0, 0, 1, 3, 11, 30, }, ++ { 2, 0, 1, 3, 11, 30, }, ++ { 1, 0, 1, 3, 11, 30, }, ++ { 0, 0, 1, 3, 12, 63, }, ++ { 2, 0, 1, 3, 12, 32, }, ++ { 1, 0, 1, 3, 12, 32, }, ++ { 0, 0, 1, 3, 13, 63, }, ++ { 2, 0, 1, 3, 13, 32, }, ++ { 1, 0, 1, 3, 13, 32, }, ++ { 0, 0, 1, 3, 14, 63, }, ++ { 2, 0, 1, 3, 14, 63, }, ++ { 1, 0, 1, 3, 14, 63, }, ++ { 0, 1, 0, 1, 36, 30, }, ++ { 2, 1, 0, 1, 36, 32, }, ++ { 1, 1, 0, 1, 36, 32, }, ++ { 0, 1, 0, 1, 40, 30, }, ++ { 2, 1, 0, 1, 40, 32, }, ++ { 1, 1, 0, 1, 40, 32, }, ++ { 0, 1, 0, 1, 44, 30, }, ++ { 2, 1, 0, 1, 44, 32, }, ++ { 1, 1, 0, 1, 44, 32, }, ++ { 0, 1, 0, 1, 48, 30, }, ++ { 2, 1, 0, 1, 48, 32, }, ++ { 1, 1, 0, 1, 48, 32, }, ++ { 0, 1, 0, 1, 52, 36, }, ++ { 2, 1, 0, 1, 52, 32, }, ++ { 1, 1, 0, 1, 52, 32, }, ++ { 0, 1, 0, 1, 56, 34, }, ++ { 2, 1, 0, 1, 56, 32, }, ++ { 1, 1, 0, 1, 56, 32, }, ++ { 0, 1, 0, 1, 60, 32, }, ++ { 2, 1, 0, 1, 60, 32, }, ++ { 1, 1, 0, 1, 60, 32, }, ++ { 0, 1, 0, 1, 64, 28, }, ++ { 2, 1, 0, 1, 64, 32, }, ++ { 1, 1, 0, 1, 64, 32, }, ++ { 0, 1, 0, 1, 100, 30, }, ++ { 2, 1, 0, 1, 100, 32, }, ++ { 1, 1, 0, 1, 100, 32, }, ++ { 0, 1, 0, 1, 104, 30, }, ++ { 2, 1, 0, 1, 104, 32, }, ++ { 1, 1, 0, 1, 104, 32, }, ++ { 0, 1, 0, 1, 108, 32, }, ++ { 2, 1, 0, 1, 108, 32, }, ++ { 1, 1, 0, 1, 108, 32, }, ++ { 0, 1, 0, 1, 112, 34, }, ++ { 2, 1, 0, 1, 112, 32, }, ++ { 1, 1, 0, 1, 112, 32, }, ++ { 0, 1, 0, 1, 116, 34, }, ++ { 2, 1, 0, 1, 116, 32, }, ++ { 1, 1, 0, 1, 116, 32, }, ++ { 0, 1, 0, 1, 120, 36, }, ++ { 2, 1, 0, 1, 120, 32, }, ++ { 1, 1, 0, 1, 120, 32, }, ++ { 0, 1, 0, 1, 124, 34, }, ++ { 2, 1, 0, 1, 124, 32, }, ++ { 1, 1, 0, 1, 124, 32, }, ++ { 0, 1, 0, 1, 128, 32, }, ++ { 2, 1, 0, 1, 128, 32, }, ++ { 1, 1, 0, 1, 128, 32, }, ++ { 0, 1, 0, 1, 132, 30, }, ++ { 2, 1, 0, 1, 132, 32, }, ++ { 1, 1, 0, 1, 132, 32, }, ++ { 0, 1, 0, 1, 136, 30, }, ++ { 2, 1, 0, 1, 136, 32, }, ++ { 1, 1, 0, 1, 136, 32, }, ++ { 0, 1, 0, 1, 140, 28, }, ++ { 2, 1, 0, 1, 140, 32, }, ++ { 1, 1, 0, 1, 140, 32, }, ++ { 0, 1, 0, 1, 149, 36, }, ++ { 2, 1, 0, 1, 149, 32, }, ++ { 1, 1, 0, 1, 149, 63, }, ++ { 0, 1, 0, 1, 153, 36, }, ++ { 2, 1, 0, 1, 153, 32, }, ++ { 1, 1, 0, 1, 153, 63, }, ++ { 0, 1, 0, 1, 157, 36, }, ++ { 2, 1, 0, 1, 157, 32, }, ++ { 1, 1, 0, 1, 157, 63, }, ++ { 0, 1, 0, 1, 161, 36, }, ++ { 2, 1, 0, 1, 161, 32, }, ++ { 1, 1, 0, 1, 161, 63, }, ++ { 0, 1, 0, 1, 165, 36, }, ++ { 2, 1, 0, 1, 165, 32, }, ++ { 1, 1, 0, 1, 165, 63, }, ++ { 0, 1, 0, 2, 36, 30, }, ++ { 2, 1, 0, 2, 36, 32, }, ++ { 1, 1, 0, 2, 36, 32, }, ++ { 0, 1, 0, 2, 40, 30, }, ++ { 2, 1, 0, 2, 40, 32, }, ++ { 1, 1, 0, 2, 40, 32, }, ++ { 0, 1, 0, 2, 44, 30, }, ++ { 2, 1, 0, 2, 44, 32, }, ++ { 1, 1, 0, 2, 44, 32, }, ++ { 0, 1, 0, 2, 48, 30, }, ++ { 2, 1, 0, 2, 48, 32, }, ++ { 1, 1, 0, 2, 48, 32, }, ++ { 0, 1, 0, 2, 52, 36, }, ++ { 2, 1, 0, 2, 52, 32, }, ++ { 1, 1, 0, 2, 52, 32, }, ++ { 0, 1, 0, 2, 56, 34, }, ++ { 2, 1, 0, 2, 56, 32, }, ++ { 1, 1, 0, 2, 56, 32, }, ++ { 0, 1, 0, 2, 60, 32, }, ++ { 2, 1, 0, 2, 60, 32, }, ++ { 1, 1, 0, 2, 60, 32, }, ++ { 0, 1, 0, 2, 64, 28, }, ++ { 2, 1, 0, 2, 64, 32, }, ++ { 1, 1, 0, 2, 64, 32, }, ++ { 0, 1, 0, 2, 100, 30, }, ++ { 2, 1, 0, 2, 100, 32, }, ++ { 1, 1, 0, 2, 100, 32, }, ++ { 0, 1, 0, 2, 104, 30, }, ++ { 2, 1, 0, 2, 104, 32, }, ++ { 1, 1, 0, 2, 104, 32, }, ++ { 0, 1, 0, 2, 108, 32, }, ++ { 2, 1, 0, 2, 108, 32, }, ++ { 1, 1, 0, 2, 108, 32, }, ++ { 0, 1, 0, 2, 112, 34, }, ++ { 2, 1, 0, 2, 112, 32, }, ++ { 1, 1, 0, 2, 112, 32, }, ++ { 0, 1, 0, 2, 116, 34, }, ++ { 2, 1, 0, 2, 116, 32, }, ++ { 1, 1, 0, 2, 116, 32, }, ++ { 0, 1, 0, 2, 120, 36, }, ++ { 2, 1, 0, 2, 120, 32, }, ++ { 1, 1, 0, 2, 120, 32, }, ++ { 0, 1, 0, 2, 124, 34, }, ++ { 2, 1, 0, 2, 124, 32, }, ++ { 1, 1, 0, 2, 124, 32, }, ++ { 0, 1, 0, 2, 128, 32, }, ++ { 2, 1, 0, 2, 128, 32, }, ++ { 1, 1, 0, 2, 128, 32, }, ++ { 0, 1, 0, 2, 132, 30, }, ++ { 2, 1, 0, 2, 132, 32, }, ++ { 1, 1, 0, 2, 132, 32, }, ++ { 0, 1, 0, 2, 136, 30, }, ++ { 2, 1, 0, 2, 136, 32, }, ++ { 1, 1, 0, 2, 136, 32, }, ++ { 0, 1, 0, 2, 140, 28, }, ++ { 2, 1, 0, 2, 140, 32, }, ++ { 1, 1, 0, 2, 140, 32, }, ++ { 0, 1, 0, 2, 149, 36, }, ++ { 2, 1, 0, 2, 149, 32, }, ++ { 1, 1, 0, 2, 149, 63, }, ++ { 0, 1, 0, 2, 153, 36, }, ++ { 2, 1, 0, 2, 153, 32, }, ++ { 1, 1, 0, 2, 153, 63, }, ++ { 0, 1, 0, 2, 157, 36, }, ++ { 2, 1, 0, 2, 157, 32, }, ++ { 1, 1, 0, 2, 157, 63, }, ++ { 0, 1, 0, 2, 161, 36, }, ++ { 2, 1, 0, 2, 161, 32, }, ++ { 1, 1, 0, 2, 161, 63, }, ++ { 0, 1, 0, 2, 165, 36, }, ++ { 2, 1, 0, 2, 165, 32, }, ++ { 1, 1, 0, 2, 165, 63, }, ++ { 0, 1, 0, 3, 36, 28, }, ++ { 2, 1, 0, 3, 36, 30, }, ++ { 1, 1, 0, 3, 36, 30, }, ++ { 0, 1, 0, 3, 40, 28, }, ++ { 2, 1, 0, 3, 40, 30, }, ++ { 1, 1, 0, 3, 40, 30, }, ++ { 0, 1, 0, 3, 44, 28, }, ++ { 2, 1, 0, 3, 44, 30, }, ++ { 1, 1, 0, 3, 44, 30, }, ++ { 0, 1, 0, 3, 48, 28, }, ++ { 2, 1, 0, 3, 48, 30, }, ++ { 1, 1, 0, 3, 48, 30, }, ++ { 0, 1, 0, 3, 52, 34, }, ++ { 2, 1, 0, 3, 52, 30, }, ++ { 1, 1, 0, 3, 52, 30, }, ++ { 0, 1, 0, 3, 56, 32, }, ++ { 2, 1, 0, 3, 56, 30, }, ++ { 1, 1, 0, 3, 56, 30, }, ++ { 0, 1, 0, 3, 60, 30, }, ++ { 2, 1, 0, 3, 60, 30, }, ++ { 1, 1, 0, 3, 60, 30, }, ++ { 0, 1, 0, 3, 64, 26, }, ++ { 2, 1, 0, 3, 64, 30, }, ++ { 1, 1, 0, 3, 64, 30, }, ++ { 0, 1, 0, 3, 100, 28, }, ++ { 2, 1, 0, 3, 100, 30, }, ++ { 1, 1, 0, 3, 100, 30, }, ++ { 0, 1, 0, 3, 104, 28, }, ++ { 2, 1, 0, 3, 104, 30, }, ++ { 1, 1, 0, 3, 104, 30, }, ++ { 0, 1, 0, 3, 108, 30, }, ++ { 2, 1, 0, 3, 108, 30, }, ++ { 1, 1, 0, 3, 108, 30, }, ++ { 0, 1, 0, 3, 112, 32, }, ++ { 2, 1, 0, 3, 112, 30, }, ++ { 1, 1, 0, 3, 112, 30, }, ++ { 0, 1, 0, 3, 116, 32, }, ++ { 2, 1, 0, 3, 116, 30, }, ++ { 1, 1, 0, 3, 116, 30, }, ++ { 0, 1, 0, 3, 120, 34, }, ++ { 2, 1, 0, 3, 120, 30, }, ++ { 1, 1, 0, 3, 120, 30, }, ++ { 0, 1, 0, 3, 124, 32, }, ++ { 2, 1, 0, 3, 124, 30, }, ++ { 1, 1, 0, 3, 124, 30, }, ++ { 0, 1, 0, 3, 128, 30, }, ++ { 2, 1, 0, 3, 128, 30, }, ++ { 1, 1, 0, 3, 128, 30, }, ++ { 0, 1, 0, 3, 132, 28, }, ++ { 2, 1, 0, 3, 132, 30, }, ++ { 1, 1, 0, 3, 132, 30, }, ++ { 0, 1, 0, 3, 136, 28, }, ++ { 2, 1, 0, 3, 136, 30, }, ++ { 1, 1, 0, 3, 136, 30, }, ++ { 0, 1, 0, 3, 140, 26, }, ++ { 2, 1, 0, 3, 140, 30, }, ++ { 1, 1, 0, 3, 140, 30, }, ++ { 0, 1, 0, 3, 149, 34, }, ++ { 2, 1, 0, 3, 149, 30, }, ++ { 1, 1, 0, 3, 149, 63, }, ++ { 0, 1, 0, 3, 153, 34, }, ++ { 2, 1, 0, 3, 153, 30, }, ++ { 1, 1, 0, 3, 153, 63, }, ++ { 0, 1, 0, 3, 157, 34, }, ++ { 2, 1, 0, 3, 157, 30, }, ++ { 1, 1, 0, 3, 157, 63, }, ++ { 0, 1, 0, 3, 161, 34, }, ++ { 2, 1, 0, 3, 161, 30, }, ++ { 1, 1, 0, 3, 161, 63, }, ++ { 0, 1, 0, 3, 165, 34, }, ++ { 2, 1, 0, 3, 165, 30, }, ++ { 1, 1, 0, 3, 165, 63, }, ++ { 0, 1, 1, 2, 38, 30, }, ++ { 2, 1, 1, 2, 38, 32, }, ++ { 1, 1, 1, 2, 38, 32, }, ++ { 0, 1, 1, 2, 46, 30, }, ++ { 2, 1, 1, 2, 46, 32, }, ++ { 1, 1, 1, 2, 46, 32, }, ++ { 0, 1, 1, 2, 54, 32, }, ++ { 2, 1, 1, 2, 54, 32, }, ++ { 1, 1, 1, 2, 54, 32, }, ++ { 0, 1, 1, 2, 62, 32, }, ++ { 2, 1, 1, 2, 62, 32, }, ++ { 1, 1, 1, 2, 62, 32, }, ++ { 0, 1, 1, 2, 102, 28, }, ++ { 2, 1, 1, 2, 102, 32, }, ++ { 1, 1, 1, 2, 102, 32, }, ++ { 0, 1, 1, 2, 110, 32, }, ++ { 2, 1, 1, 2, 110, 32, }, ++ { 1, 1, 1, 2, 110, 32, }, ++ { 0, 1, 1, 2, 118, 36, }, ++ { 2, 1, 1, 2, 118, 32, }, ++ { 1, 1, 1, 2, 118, 32, }, ++ { 0, 1, 1, 2, 126, 34, }, ++ { 2, 1, 1, 2, 126, 32, }, ++ { 1, 1, 1, 2, 126, 32, }, ++ { 0, 1, 1, 2, 134, 32, }, ++ { 2, 1, 1, 2, 134, 32, }, ++ { 1, 1, 1, 2, 134, 32, }, ++ { 0, 1, 1, 2, 151, 36, }, ++ { 2, 1, 1, 2, 151, 32, }, ++ { 1, 1, 1, 2, 151, 63, }, ++ { 0, 1, 1, 2, 159, 36, }, ++ { 2, 1, 1, 2, 159, 32, }, ++ { 1, 1, 1, 2, 159, 63, }, ++ { 0, 1, 1, 3, 38, 28, }, ++ { 2, 1, 1, 3, 38, 30, }, ++ { 1, 1, 1, 3, 38, 30, }, ++ { 0, 1, 1, 3, 46, 28, }, ++ { 2, 1, 1, 3, 46, 30, }, ++ { 1, 1, 1, 3, 46, 30, }, ++ { 0, 1, 1, 3, 54, 30, }, ++ { 2, 1, 1, 3, 54, 30, }, ++ { 1, 1, 1, 3, 54, 30, }, ++ { 0, 1, 1, 3, 62, 30, }, ++ { 2, 1, 1, 3, 62, 30, }, ++ { 1, 1, 1, 3, 62, 30, }, ++ { 0, 1, 1, 3, 102, 26, }, ++ { 2, 1, 1, 3, 102, 30, }, ++ { 1, 1, 1, 3, 102, 30, }, ++ { 0, 1, 1, 3, 110, 30, }, ++ { 2, 1, 1, 3, 110, 30, }, ++ { 1, 1, 1, 3, 110, 30, }, ++ { 0, 1, 1, 3, 118, 34, }, ++ { 2, 1, 1, 3, 118, 30, }, ++ { 1, 1, 1, 3, 118, 30, }, ++ { 0, 1, 1, 3, 126, 32, }, ++ { 2, 1, 1, 3, 126, 30, }, ++ { 1, 1, 1, 3, 126, 30, }, ++ { 0, 1, 1, 3, 134, 30, }, ++ { 2, 1, 1, 3, 134, 30, }, ++ { 1, 1, 1, 3, 134, 30, }, ++ { 0, 1, 1, 3, 151, 34, }, ++ { 2, 1, 1, 3, 151, 30, }, ++ { 1, 1, 1, 3, 151, 63, }, ++ { 0, 1, 1, 3, 159, 34, }, ++ { 2, 1, 1, 3, 159, 30, }, ++ { 1, 1, 1, 3, 159, 63, }, ++ { 0, 1, 2, 4, 42, 30, }, ++ { 2, 1, 2, 4, 42, 32, }, ++ { 1, 1, 2, 4, 42, 32, }, ++ { 0, 1, 2, 4, 58, 28, }, ++ { 2, 1, 2, 4, 58, 32, }, ++ { 1, 1, 2, 4, 58, 32, }, ++ { 0, 1, 2, 4, 106, 30, }, ++ { 2, 1, 2, 4, 106, 32, }, ++ { 1, 1, 2, 4, 106, 32, }, ++ { 0, 1, 2, 4, 122, 34, }, ++ { 2, 1, 2, 4, 122, 32, }, ++ { 1, 1, 2, 4, 122, 32, }, ++ { 0, 1, 2, 4, 155, 36, }, ++ { 2, 1, 2, 4, 155, 32, }, ++ { 1, 1, 2, 4, 155, 63, }, ++ { 0, 1, 2, 5, 42, 28, }, ++ { 2, 1, 2, 5, 42, 30, }, ++ { 1, 1, 2, 5, 42, 30, }, ++ { 0, 1, 2, 5, 58, 26, }, ++ { 2, 1, 2, 5, 58, 30, }, ++ { 1, 1, 2, 5, 58, 30, }, ++ { 0, 1, 2, 5, 106, 28, }, ++ { 2, 1, 2, 5, 106, 30, }, ++ { 1, 1, 2, 5, 106, 30, }, ++ { 0, 1, 2, 5, 122, 32, }, ++ { 2, 1, 2, 5, 122, 30, }, ++ { 1, 1, 2, 5, 122, 30, }, ++ { 0, 1, 2, 5, 155, 34, }, ++ { 2, 1, 2, 5, 155, 30, }, ++ { 1, 1, 2, 5, 155, 63, }, ++}; ++ ++RTW_DECL_TABLE_TXPWR_LMT(rtw8812a_txpwr_lmt); ++ ++static const struct rtw_pwr_seq_cmd trans_carddis_to_cardemu_8812a[] = { ++ {0x0012, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(0), BIT(0)}, ++ {0x0014, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0x80, 0}, ++ {0x0015, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0x01, 0}, ++ {0x0023, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0x10, 0}, ++ {0x0046, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0xFF, 0x00}, ++ {0x0043, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0xFF, 0x00}, ++ {0x0005, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_PCI_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(2), 0}, ++ {0x0005, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(3), 0}, ++ {0x0003, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(2), BIT(2)}, ++ {0x0301, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_PCI_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0xFF, 0}, ++ {0x0024, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_USB_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(1), BIT(1)}, ++ {0x0028, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_USB_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(3), BIT(3)}, ++ {0xFFFF, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ 0, ++ RTW_PWR_CMD_END, 0, 0}, ++}; ++ ++static const struct rtw_pwr_seq_cmd trans_cardemu_to_act_8812a[] = { ++ {0x0005, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(2), 0}, ++ {0x0006, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_POLLING, BIT(1), BIT(1)}, ++ {0x0005, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_PCI_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(7), 0}, ++ {0x0005, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(3), 0}, ++ {0x0005, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(0), BIT(0)}, ++ {0x0005, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_POLLING, BIT(0), 0}, ++ {0x0024, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_USB_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(1), 0}, ++ {0x0028, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_USB_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(3), 0}, ++ {0xFFFF, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ 0, ++ RTW_PWR_CMD_END, 0, 0}, ++}; ++ ++static const struct rtw_pwr_seq_cmd trans_act_to_lps_8812a[] = { ++ {0x0301, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_PCI_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0xFF, 0xFF}, ++ {0x0522, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0xFF, 0x7F}, ++ {0x05F8, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_POLLING, 0xFF, 0}, ++ {0x05F9, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_POLLING, 0xFF, 0}, ++ {0x05FA, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_POLLING, 0xFF, 0}, ++ {0x05FB, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_POLLING, 0xFF, 0}, ++ {0x0c00, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0xFF, 0x04}, ++ {0x0e00, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0xFF, 0x04}, ++ {0x0002, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(0), 0}, ++ {0x0002, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_DELAY, 0, RTW_PWR_DELAY_US}, ++ {0x0002, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_USB_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(1), 0}, ++ {0x0100, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0xFF, 0x03}, ++ {0x0101, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(1), 0}, ++ {0x0553, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(5), BIT(5)}, ++ {0xFFFF, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ 0, ++ RTW_PWR_CMD_END, 0, 0}, ++}; ++ ++static const struct rtw_pwr_seq_cmd trans_act_to_cardemu_8812a[] = { ++ {0x0c00, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0xFF, 0x04}, ++ {0x0e00, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0xFF, 0x04}, ++ {0x0002, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(0), 0}, ++ {0x0002, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_DELAY, 0, RTW_PWR_DELAY_US}, ++ {0x0002, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_PCI_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(1), 0}, ++ {0x0007, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0xFF, 0x2A}, ++ {0x0008, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_USB_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0x02, 0}, ++ {0x0005, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(1), BIT(1)}, ++ {0x0005, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_POLLING, BIT(1), 0}, ++ {0xFFFF, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ 0, ++ RTW_PWR_CMD_END, 0, 0}, ++}; ++ ++static const struct rtw_pwr_seq_cmd trans_cardemu_to_carddis_8812a[] = { ++ {0x0003, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(2), 0}, ++ {0x0080, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0xFF, 0x05}, ++ {0x0042, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_USB_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0xF0, 0xcc}, ++ {0x0042, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_PCI_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0xF0, 0xEC}, ++ {0x0043, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0xFF, 0x07}, ++ {0x0045, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0xFF, 0x00}, ++ {0x0046, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0xFF, 0xff}, ++ {0x0047, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0xFF, 0}, ++ {0x0014, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0x80, BIT(7)}, ++ {0x0015, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0x01, BIT(0)}, ++ {0x0012, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0x01, 0}, ++ {0x0023, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0x10, BIT(4)}, ++ {0x0008, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_USB_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0x02, 0}, ++ {0x0007, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_USB_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0xFF, 0x20}, ++ {0x001f, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_USB_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(1), 0}, ++ {0x0076, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_USB_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(1), 0}, ++ {0x0005, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(3), BIT(3)}, ++ {0xFFFF, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ 0, ++ RTW_PWR_CMD_END, 0, 0}, ++}; ++ ++const struct rtw_pwr_seq_cmd * const card_enable_flow_8812a[] = { ++ trans_carddis_to_cardemu_8812a, ++ trans_cardemu_to_act_8812a, ++ NULL ++}; ++ ++const struct rtw_pwr_seq_cmd * const enter_lps_flow_8812a[] = { ++ trans_act_to_lps_8812a, ++ NULL ++}; ++ ++const struct rtw_pwr_seq_cmd * const card_disable_flow_8812a[] = { ++ trans_act_to_cardemu_8812a, ++ trans_cardemu_to_carddis_8812a, ++ NULL ++}; ++ ++static const u8 rtw8812a_pwrtrk_5gb_n[][RTW_PWR_TRK_TBL_SZ] = { ++ {0, 1, 1, 2, 2, 3, 4, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, ++ 12, 13, 13, 14, 14, 14, 14, 14, 14}, ++ {0, 1, 1, 2, 2, 3, 4, 4, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, ++ 12, 13, 13, 14, 14, 14, 14, 14, 14}, ++ {0, 1, 1, 2, 2, 3, 4, 5, 6, 6, 7, 8, 8, 9, 10, 10, 11, 11, 12, 12, 13, ++ 13, 14, 14, 15, 16, 16, 16, 16, 16}, ++}; ++ ++static const u8 rtw8812a_pwrtrk_5gb_p[][RTW_PWR_TRK_TBL_SZ] = { ++ {0, 1, 1, 2, 2, 3, 3, 4, 5, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 11, ++ 11, 11, 11, 11, 11, 11, 11, 11, 11}, ++ {0, 1, 1, 2, 3, 3, 4, 5, 5, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 11, ++ 11, 11, 11, 11, 11, 11, 11, 11, 11}, ++ {0, 1, 1, 2, 3, 3, 4, 5, 6, 7, 7, 8, 8, 9, 9, 10, 11, 11, 11, 11, 11, ++ 11, 11, 11, 11, 11, 11, 11, 11, 11}, ++}; ++ ++static const u8 rtw8812a_pwrtrk_5ga_n[][RTW_PWR_TRK_TBL_SZ] = { ++ {0, 1, 1, 2, 2, 3, 4, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, ++ 12, 13, 13, 14, 15, 15, 15, 15, 15}, ++ {0, 1, 1, 2, 2, 3, 4, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, ++ 12, 13, 13, 14, 15, 15, 15, 15, 15}, ++ {0, 1, 1, 2, 2, 3, 4, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, ++ 12, 13, 13, 14, 15, 15, 15, 15, 15}, ++}; ++ ++static const u8 rtw8812a_pwrtrk_5ga_p[][RTW_PWR_TRK_TBL_SZ] = { ++ {0, 1, 1, 2, 2, 3, 4, 5, 6, 7, 7, 8, 8, 9, 10, 11, 11, 11, 11, 11, 11, ++ 11, 11, 11, 11, 11, 11, 11, 11, 11}, ++ {0, 1, 1, 2, 3, 3, 4, 5, 6, 7, 7, 8, 8, 9, 10, 11, 11, 11, 11, 11, 11, ++ 11, 11, 11, 11, 11, 11, 11, 11, 11}, ++ {0, 1, 1, 2, 3, 3, 4, 5, 6, 7, 7, 8, 8, 9, 10, 11, 11, 12, 12, 11, 11, ++ 11, 11, 11, 11, 11, 11, 11, 11, 11}, ++}; ++ ++static const u8 rtw8812a_pwrtrk_2gb_n[] = { ++ 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, ++ 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 11, 11, 11, 11 ++}; ++ ++static const u8 rtw8812a_pwrtrk_2gb_p[] = { ++ 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, ++ 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 ++}; ++ ++static const u8 rtw8812a_pwrtrk_2ga_n[] = { ++ 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, ++ 6, 6, 7, 7, 7, 8, 8, 9, 10, 10, 10, 10, 10, 10 ++}; ++ ++static const u8 rtw8812a_pwrtrk_2ga_p[] = { ++ 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, ++ 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 ++}; ++ ++static const u8 rtw8812a_pwrtrk_2g_cck_b_n[] = { ++ 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, ++ 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 11, 11, 11, 11 ++}; ++ ++static const u8 rtw8812a_pwrtrk_2g_cck_b_p[] = { ++ 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, ++ 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 ++}; ++ ++static const u8 rtw8812a_pwrtrk_2g_cck_a_n[] = { ++ 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, ++ 6, 6, 7, 7, 7, 8, 8, 9, 10, 10, 10, 10, 10, 10 ++}; ++ ++static const u8 rtw8812a_pwrtrk_2g_cck_a_p[] = { ++ 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, ++ 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 ++}; ++ ++const struct rtw_pwr_track_tbl rtw8812a_rtw_pwr_track_tbl = { ++ .pwrtrk_5gb_n[0] = rtw8812a_pwrtrk_5gb_n[0], ++ .pwrtrk_5gb_n[1] = rtw8812a_pwrtrk_5gb_n[1], ++ .pwrtrk_5gb_n[2] = rtw8812a_pwrtrk_5gb_n[2], ++ .pwrtrk_5gb_p[0] = rtw8812a_pwrtrk_5gb_p[0], ++ .pwrtrk_5gb_p[1] = rtw8812a_pwrtrk_5gb_p[1], ++ .pwrtrk_5gb_p[2] = rtw8812a_pwrtrk_5gb_p[2], ++ .pwrtrk_5ga_n[0] = rtw8812a_pwrtrk_5ga_n[0], ++ .pwrtrk_5ga_n[1] = rtw8812a_pwrtrk_5ga_n[1], ++ .pwrtrk_5ga_n[2] = rtw8812a_pwrtrk_5ga_n[2], ++ .pwrtrk_5ga_p[0] = rtw8812a_pwrtrk_5ga_p[0], ++ .pwrtrk_5ga_p[1] = rtw8812a_pwrtrk_5ga_p[1], ++ .pwrtrk_5ga_p[2] = rtw8812a_pwrtrk_5ga_p[2], ++ .pwrtrk_2gb_n = rtw8812a_pwrtrk_2gb_n, ++ .pwrtrk_2gb_p = rtw8812a_pwrtrk_2gb_p, ++ .pwrtrk_2ga_n = rtw8812a_pwrtrk_2ga_n, ++ .pwrtrk_2ga_p = rtw8812a_pwrtrk_2ga_p, ++ .pwrtrk_2g_cckb_n = rtw8812a_pwrtrk_2g_cck_b_n, ++ .pwrtrk_2g_cckb_p = rtw8812a_pwrtrk_2g_cck_b_p, ++ .pwrtrk_2g_ccka_n = rtw8812a_pwrtrk_2g_cck_a_n, ++ .pwrtrk_2g_ccka_p = rtw8812a_pwrtrk_2g_cck_a_p, ++}; ++ ++static const u8 rtw8812a_pwrtrk_rfe3_5gb_n[][RTW_PWR_TRK_TBL_SZ] = { ++ {0, 1, 1, 2, 3, 3, 4, 5, 5, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 12, 13, ++ 13, 14, 15, 16, 16, 17, 17, 18, 18}, ++ {0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 11, ++ 12, 14, 13, 13, 14, 14, 14, 15, 15}, ++ {0, 1, 1, 2, 2, 3, 4, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, ++ 12, 13, 13, 14, 14, 15, 15, 16, 16}, ++}; ++ ++static const u8 rtw8812a_pwrtrk_rfe3_5gb_p[][RTW_PWR_TRK_TBL_SZ] = { ++ {0, 1, 1, 2, 3, 3, 4, 5, 6, 7, 7, 8, 9, 9, 10, 10, 11, 11, 11, 11, 11, ++ 11, 11, 11, 11, 11, 11, 11, 11, 11}, ++ {0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 11, ++ 11, 11, 11, 11, 11, 11, 11, 11, 11}, ++ {0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 6, 6, 7, 7, 8, 9, 10, 10, 11, 11, 11, ++ 11, 11, 11, 11, 11, 11, 11, 11, 11}, ++}; ++ ++static const u8 rtw8812a_pwrtrk_rfe3_5ga_n[][RTW_PWR_TRK_TBL_SZ] = { ++ {0, 1, 1, 2, 3, 3, 4, 5, 5, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, ++ 13, 14, 15, 16, 16, 17, 17, 18, 18}, ++ {0, 1, 1, 2, 3, 3, 4, 4, 5, 6, 6, 7, 7, 8, 9, 9, 10, 10, 11, 11, 12, ++ 12, 13, 13, 14, 15, 16, 16, 17, 17}, ++ {0, 1, 1, 2, 3, 3, 4, 4, 5, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 12, 13, ++ 13, 14, 14, 15, 15, 16, 17, 18, 18}, ++}; ++ ++static const u8 rtw8812a_pwrtrk_rfe3_5ga_p[][RTW_PWR_TRK_TBL_SZ] = { ++ {0, 1, 1, 2, 2, 3, 4, 5, 6, 7, 7, 8, 9, 9, 10, 10, 11, 11, 11, 11, 11, ++ 11, 11, 11, 11, 11, 11, 11, 11, 11}, ++ {0, 1, 2, 3, 4, 4, 5, 5, 6, 7, 7, 8, 9, 9, 10, 11, 11, 11, 11, 11, 11, ++ 11, 11, 11, 11, 11, 11, 11, 11, 11}, ++ {0, 1, 2, 3, 4, 4, 5, 5, 6, 7, 7, 8, 9, 9, 10, 11, 11, 11, 11, 11, 11, ++ 11, 11, 11, 11, 11, 11, 11, 11, 11}, ++}; ++ ++static const u8 rtw8812a_pwrtrk_rfe3_2gb_n[] = { ++ 0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6, 7, ++ 7, 7, 8, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15 ++}; ++ ++static const u8 rtw8812a_pwrtrk_rfe3_2gb_p[] = { ++ 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, ++ 6, 7, 7, 8, 9, 10, 10, 10, 10, 11, 11, 11, 11, 11 ++}; ++ ++static const u8 rtw8812a_pwrtrk_rfe3_2ga_n[] = { ++ 0, 1, 1, 2, 2, 3, 4, 5, 6, 6, 6, 7, 7, 8, 8, 9, ++ 10, 10, 11, 11, 12, 12, 13, 13, 13, 13, 14, 14, 15, 15 ++}; ++ ++static const u8 rtw8812a_pwrtrk_rfe3_2ga_p[] = { ++ 0, 0, 1, 1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, ++ 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 11, 11, 11 ++}; ++ ++static const u8 rtw8812a_pwrtrk_rfe3_2g_cck_b_n[] = { ++ 0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6, 7, ++ 7, 7, 8, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15 ++}; ++ ++static const u8 rtw8812a_pwrtrk_rfe3_2g_cck_b_p[] = { ++ 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, ++ 6, 7, 7, 8, 9, 10, 10, 10, 10, 11, 11, 11, 11, 11 ++}; ++ ++static const u8 rtw8812a_pwrtrk_rfe3_2g_cck_a_n[] = { ++ 0, 1, 1, 2, 2, 3, 4, 5, 6, 6, 6, 7, 7, 8, 8, 9, ++ 10, 10, 11, 11, 12, 12, 13, 13, 13, 13, 14, 14, 15, 15 ++}; ++ ++static const u8 rtw8812a_pwrtrk_rfe3_2g_cck_a_p[] = { ++ 0, 0, 1, 1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, ++ 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 11, 11, 11 ++}; ++ ++const struct rtw_pwr_track_tbl rtw8812a_rtw_pwr_track_rfe3_tbl = { ++ .pwrtrk_5gb_n[0] = rtw8812a_pwrtrk_rfe3_5gb_n[0], ++ .pwrtrk_5gb_n[1] = rtw8812a_pwrtrk_rfe3_5gb_n[1], ++ .pwrtrk_5gb_n[2] = rtw8812a_pwrtrk_rfe3_5gb_n[2], ++ .pwrtrk_5gb_p[0] = rtw8812a_pwrtrk_rfe3_5gb_p[0], ++ .pwrtrk_5gb_p[1] = rtw8812a_pwrtrk_rfe3_5gb_p[1], ++ .pwrtrk_5gb_p[2] = rtw8812a_pwrtrk_rfe3_5gb_p[2], ++ .pwrtrk_5ga_n[0] = rtw8812a_pwrtrk_rfe3_5ga_n[0], ++ .pwrtrk_5ga_n[1] = rtw8812a_pwrtrk_rfe3_5ga_n[1], ++ .pwrtrk_5ga_n[2] = rtw8812a_pwrtrk_rfe3_5ga_n[2], ++ .pwrtrk_5ga_p[0] = rtw8812a_pwrtrk_rfe3_5ga_p[0], ++ .pwrtrk_5ga_p[1] = rtw8812a_pwrtrk_rfe3_5ga_p[1], ++ .pwrtrk_5ga_p[2] = rtw8812a_pwrtrk_rfe3_5ga_p[2], ++ .pwrtrk_2gb_n = rtw8812a_pwrtrk_rfe3_2gb_n, ++ .pwrtrk_2gb_p = rtw8812a_pwrtrk_rfe3_2gb_p, ++ .pwrtrk_2ga_n = rtw8812a_pwrtrk_rfe3_2ga_n, ++ .pwrtrk_2ga_p = rtw8812a_pwrtrk_rfe3_2ga_p, ++ .pwrtrk_2g_cckb_n = rtw8812a_pwrtrk_rfe3_2g_cck_b_n, ++ .pwrtrk_2g_cckb_p = rtw8812a_pwrtrk_rfe3_2g_cck_b_p, ++ .pwrtrk_2g_ccka_n = rtw8812a_pwrtrk_rfe3_2g_cck_a_n, ++ .pwrtrk_2g_ccka_p = rtw8812a_pwrtrk_rfe3_2g_cck_a_p, ++}; +--- /dev/null ++++ b/drivers/net/wireless/realtek/rtw88/rtw8812a_table.h +@@ -0,0 +1,26 @@ ++/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ ++/* Copyright(c) 2024 Realtek Corporation ++ */ ++ ++#ifndef __RTW8812A_TABLE_H__ ++#define __RTW8812A_TABLE_H__ ++ ++extern const struct rtw_table rtw8812a_mac_tbl; ++extern const struct rtw_table rtw8812a_agc_tbl; ++extern const struct rtw_table rtw8812a_agc_diff_lb_tbl; ++extern const struct rtw_table rtw8812a_agc_diff_hb_tbl; ++extern const struct rtw_table rtw8812a_bb_tbl; ++extern const struct rtw_table rtw8812a_bb_pg_tbl; ++extern const struct rtw_table rtw8812a_bb_pg_rfe3_tbl; ++extern const struct rtw_table rtw8812a_rf_a_tbl; ++extern const struct rtw_table rtw8812a_rf_b_tbl; ++extern const struct rtw_table rtw8812a_txpwr_lmt_tbl; ++ ++extern const struct rtw_pwr_seq_cmd * const card_enable_flow_8812a[]; ++extern const struct rtw_pwr_seq_cmd * const enter_lps_flow_8812a[]; ++extern const struct rtw_pwr_seq_cmd * const card_disable_flow_8812a[]; ++ ++extern const struct rtw_pwr_track_tbl rtw8812a_rtw_pwr_track_tbl; ++extern const struct rtw_pwr_track_tbl rtw8812a_rtw_pwr_track_rfe3_tbl; ++ ++#endif diff --git a/package/kernel/mac80211/patches/rtl/040-v6.13-wifi-rtw88-Add-rtw8821a_table.-c-h.patch b/package/kernel/mac80211/patches/rtl/040-v6.13-wifi-rtw88-Add-rtw8821a_table.-c-h.patch new file mode 100644 index 00000000000000..e8ceaba61ea06e --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/040-v6.13-wifi-rtw88-Add-rtw8821a_table.-c-h.patch @@ -0,0 +1,2395 @@ +From 4b81da5cd2b4c7231272216639bacecc818d8b51 Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Wed, 30 Oct 2024 20:25:16 +0200 +Subject: [PATCH] wifi: rtw88: Add rtw8821a_table.{c,h} + +These contain various arrays for initialising RTL8821AU. Also TX power +limits. + +Signed-off-by: Bitterblue Smith +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/087c7260-fcc3-4e22-886b-ac477cad9198@gmail.com +--- + .../wireless/realtek/rtw88/rtw8821a_table.c | 2350 +++++++++++++++++ + .../wireless/realtek/rtw88/rtw8821a_table.h | 21 + + 2 files changed, 2371 insertions(+) + create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8821a_table.c + create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8821a_table.h + +--- /dev/null ++++ b/drivers/net/wireless/realtek/rtw88/rtw8821a_table.c +@@ -0,0 +1,2350 @@ ++// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause ++/* Copyright(c) 2024 Realtek Corporation ++ */ ++ ++#include "main.h" ++#include "phy.h" ++#include "rtw8821a_table.h" ++ ++static const u32 rtw8821a_mac[] = { ++ 0x421, 0x0000000F, ++ 0x428, 0x0000000A, ++ 0x429, 0x00000010, ++ 0x430, 0x00000000, ++ 0x431, 0x00000000, ++ 0x432, 0x00000000, ++ 0x433, 0x00000001, ++ 0x434, 0x00000004, ++ 0x435, 0x00000005, ++ 0x436, 0x00000007, ++ 0x437, 0x00000008, ++ 0x43C, 0x00000004, ++ 0x43D, 0x00000005, ++ 0x43E, 0x00000007, ++ 0x43F, 0x00000008, ++ 0x440, 0x0000005D, ++ 0x441, 0x00000001, ++ 0x442, 0x00000000, ++ 0x444, 0x00000010, ++ 0x445, 0x00000000, ++ 0x446, 0x00000000, ++ 0x447, 0x00000000, ++ 0x448, 0x00000000, ++ 0x449, 0x000000F0, ++ 0x44A, 0x0000000F, ++ 0x44B, 0x0000003E, ++ 0x44C, 0x00000010, ++ 0x44D, 0x00000000, ++ 0x44E, 0x00000000, ++ 0x44F, 0x00000000, ++ 0x450, 0x00000000, ++ 0x451, 0x000000F0, ++ 0x452, 0x0000000F, ++ 0x453, 0x00000000, ++ 0x456, 0x0000005E, ++ 0x460, 0x00000066, ++ 0x461, 0x00000066, ++ 0x4C8, 0x0000003F, ++ 0x4C9, 0x000000FF, ++ 0x4CC, 0x000000FF, ++ 0x4CD, 0x000000FF, ++ 0x4CE, 0x00000001, ++ 0x500, 0x00000026, ++ 0x501, 0x000000A2, ++ 0x502, 0x0000002F, ++ 0x503, 0x00000000, ++ 0x504, 0x00000028, ++ 0x505, 0x000000A3, ++ 0x506, 0x0000005E, ++ 0x507, 0x00000000, ++ 0x508, 0x0000002B, ++ 0x509, 0x000000A4, ++ 0x50A, 0x0000005E, ++ 0x50B, 0x00000000, ++ 0x50C, 0x0000004F, ++ 0x50D, 0x000000A4, ++ 0x50E, 0x00000000, ++ 0x50F, 0x00000000, ++ 0x512, 0x0000001C, ++ 0x514, 0x0000000A, ++ 0x516, 0x0000000A, ++ 0x525, 0x0000004F, ++ 0x550, 0x00000010, ++ 0x551, 0x00000010, ++ 0x559, 0x00000002, ++ 0x55C, 0x00000050, ++ 0x55D, 0x000000FF, ++ 0x605, 0x00000030, ++ 0x607, 0x00000007, ++ 0x608, 0x0000000E, ++ 0x609, 0x0000002A, ++ 0x620, 0x000000FF, ++ 0x621, 0x000000FF, ++ 0x622, 0x000000FF, ++ 0x623, 0x000000FF, ++ 0x624, 0x000000FF, ++ 0x625, 0x000000FF, ++ 0x626, 0x000000FF, ++ 0x627, 0x000000FF, ++ 0x638, 0x00000050, ++ 0x63C, 0x0000000A, ++ 0x63D, 0x0000000A, ++ 0x63E, 0x0000000E, ++ 0x63F, 0x0000000E, ++ 0x640, 0x00000040, ++ 0x642, 0x00000040, ++ 0x643, 0x00000000, ++ 0x652, 0x000000C8, ++ 0x66E, 0x00000005, ++ 0x700, 0x00000021, ++ 0x701, 0x00000043, ++ 0x702, 0x00000065, ++ 0x703, 0x00000087, ++ 0x708, 0x00000021, ++ 0x709, 0x00000043, ++ 0x70A, 0x00000065, ++ 0x70B, 0x00000087, ++ 0x718, 0x00000040, ++}; ++ ++RTW_DECL_TABLE_PHY_COND(rtw8821a_mac, rtw_phy_cfg_mac); ++ ++static const u32 rtw8821a_agc[] = { ++ 0x81C, 0xBF000001, ++ 0x81C, 0xBF020001, ++ 0x81C, 0xBF040001, ++ 0x81C, 0xBF060001, ++ 0x81C, 0xBE080001, ++ 0x81C, 0xBD0A0001, ++ 0x81C, 0xBC0C0001, ++ 0x81C, 0xBA0E0001, ++ 0x81C, 0xB9100001, ++ 0x81C, 0xB8120001, ++ 0x81C, 0xB7140001, ++ 0x81C, 0xB6160001, ++ 0x81C, 0xB5180001, ++ 0x81C, 0xB41A0001, ++ 0x81C, 0xB31C0001, ++ 0x81C, 0xB21E0001, ++ 0x81C, 0xB1200001, ++ 0x81C, 0xB0220001, ++ 0x81C, 0xAF240001, ++ 0x81C, 0xAE260001, ++ 0x81C, 0xAD280001, ++ 0x81C, 0xAC2A0001, ++ 0x81C, 0xAB2C0001, ++ 0x81C, 0xAA2E0001, ++ 0x81C, 0xA9300001, ++ 0x81C, 0xA8320001, ++ 0x81C, 0xA7340001, ++ 0x81C, 0xA6360001, ++ 0x81C, 0xA5380001, ++ 0x81C, 0xA43A0001, ++ 0x81C, 0x683C0001, ++ 0x81C, 0x673E0001, ++ 0x81C, 0x66400001, ++ 0x81C, 0x65420001, ++ 0x81C, 0x64440001, ++ 0x81C, 0x63460001, ++ 0x81C, 0x62480001, ++ 0x81C, 0x614A0001, ++ 0x81C, 0x474C0001, ++ 0x81C, 0x464E0001, ++ 0x81C, 0x45500001, ++ 0x81C, 0x44520001, ++ 0x81C, 0x43540001, ++ 0x81C, 0x42560001, ++ 0x81C, 0x41580001, ++ 0x81C, 0x285A0001, ++ 0x81C, 0x275C0001, ++ 0x81C, 0x265E0001, ++ 0x81C, 0x25600001, ++ 0x81C, 0x24620001, ++ 0x81C, 0x0A640001, ++ 0x81C, 0x09660001, ++ 0x81C, 0x08680001, ++ 0x81C, 0x076A0001, ++ 0x81C, 0x066C0001, ++ 0x81C, 0x056E0001, ++ 0x81C, 0x04700001, ++ 0x81C, 0x03720001, ++ 0x81C, 0x02740001, ++ 0x81C, 0x01760001, ++ 0x81C, 0x01780001, ++ 0x81C, 0x017A0001, ++ 0x81C, 0x017C0001, ++ 0x81C, 0x017E0001, ++ 0x8000020c, 0x00000000, 0x40000000, 0x00000000, ++ 0x81C, 0xFB000101, ++ 0x81C, 0xFA020101, ++ 0x81C, 0xF9040101, ++ 0x81C, 0xF8060101, ++ 0x81C, 0xF7080101, ++ 0x81C, 0xF60A0101, ++ 0x81C, 0xF50C0101, ++ 0x81C, 0xF40E0101, ++ 0x81C, 0xF3100101, ++ 0x81C, 0xF2120101, ++ 0x81C, 0xF1140101, ++ 0x81C, 0xF0160101, ++ 0x81C, 0xEF180101, ++ 0x81C, 0xEE1A0101, ++ 0x81C, 0xED1C0101, ++ 0x81C, 0xEC1E0101, ++ 0x81C, 0xEB200101, ++ 0x81C, 0xEA220101, ++ 0x81C, 0xE9240101, ++ 0x81C, 0xE8260101, ++ 0x81C, 0xE7280101, ++ 0x81C, 0xE62A0101, ++ 0x81C, 0xE52C0101, ++ 0x81C, 0xE42E0101, ++ 0x81C, 0xE3300101, ++ 0x81C, 0xA5320101, ++ 0x81C, 0xA4340101, ++ 0x81C, 0xA3360101, ++ 0x81C, 0x87380101, ++ 0x81C, 0x863A0101, ++ 0x81C, 0x853C0101, ++ 0x81C, 0x843E0101, ++ 0x81C, 0x69400101, ++ 0x81C, 0x68420101, ++ 0x81C, 0x67440101, ++ 0x81C, 0x66460101, ++ 0x81C, 0x49480101, ++ 0x81C, 0x484A0101, ++ 0x81C, 0x474C0101, ++ 0x81C, 0x2A4E0101, ++ 0x81C, 0x29500101, ++ 0x81C, 0x28520101, ++ 0x81C, 0x27540101, ++ 0x81C, 0x26560101, ++ 0x81C, 0x25580101, ++ 0x81C, 0x245A0101, ++ 0x81C, 0x235C0101, ++ 0x81C, 0x055E0101, ++ 0x81C, 0x04600101, ++ 0x81C, 0x03620101, ++ 0x81C, 0x02640101, ++ 0x81C, 0x01660101, ++ 0x81C, 0x01680101, ++ 0x81C, 0x016A0101, ++ 0x81C, 0x016C0101, ++ 0x81C, 0x016E0101, ++ 0x81C, 0x01700101, ++ 0x81C, 0x01720101, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x81C, 0xFB000101, ++ 0x81C, 0xFA020101, ++ 0x81C, 0xF9040101, ++ 0x81C, 0xF8060101, ++ 0x81C, 0xF7080101, ++ 0x81C, 0xF60A0101, ++ 0x81C, 0xF50C0101, ++ 0x81C, 0xF40E0101, ++ 0x81C, 0xF3100101, ++ 0x81C, 0xF2120101, ++ 0x81C, 0xF1140101, ++ 0x81C, 0xF0160101, ++ 0x81C, 0xEF180101, ++ 0x81C, 0xEE1A0101, ++ 0x81C, 0xED1C0101, ++ 0x81C, 0xEC1E0101, ++ 0x81C, 0xEB200101, ++ 0x81C, 0xEA220101, ++ 0x81C, 0xE9240101, ++ 0x81C, 0xE8260101, ++ 0x81C, 0xE7280101, ++ 0x81C, 0xE62A0101, ++ 0x81C, 0xE52C0101, ++ 0x81C, 0xE42E0101, ++ 0x81C, 0xE3300101, ++ 0x81C, 0xA5320101, ++ 0x81C, 0xA4340101, ++ 0x81C, 0xA3360101, ++ 0x81C, 0x87380101, ++ 0x81C, 0x863A0101, ++ 0x81C, 0x853C0101, ++ 0x81C, 0x843E0101, ++ 0x81C, 0x69400101, ++ 0x81C, 0x68420101, ++ 0x81C, 0x67440101, ++ 0x81C, 0x66460101, ++ 0x81C, 0x49480101, ++ 0x81C, 0x484A0101, ++ 0x81C, 0x474C0101, ++ 0x81C, 0x2A4E0101, ++ 0x81C, 0x29500101, ++ 0x81C, 0x28520101, ++ 0x81C, 0x27540101, ++ 0x81C, 0x26560101, ++ 0x81C, 0x25580101, ++ 0x81C, 0x245A0101, ++ 0x81C, 0x235C0101, ++ 0x81C, 0x055E0101, ++ 0x81C, 0x04600101, ++ 0x81C, 0x03620101, ++ 0x81C, 0x02640101, ++ 0x81C, 0x01660101, ++ 0x81C, 0x01680101, ++ 0x81C, 0x016A0101, ++ 0x81C, 0x016C0101, ++ 0x81C, 0x016E0101, ++ 0x81C, 0x01700101, ++ 0x81C, 0x01720101, ++ 0xA0000000, 0x00000000, ++ 0x81C, 0xFF000101, ++ 0x81C, 0xFF020101, ++ 0x81C, 0xFE040101, ++ 0x81C, 0xFD060101, ++ 0x81C, 0xFC080101, ++ 0x81C, 0xFD0A0101, ++ 0x81C, 0xFC0C0101, ++ 0x81C, 0xFB0E0101, ++ 0x81C, 0xFA100101, ++ 0x81C, 0xF9120101, ++ 0x81C, 0xF8140101, ++ 0x81C, 0xF7160101, ++ 0x81C, 0xF6180101, ++ 0x81C, 0xF51A0101, ++ 0x81C, 0xF41C0101, ++ 0x81C, 0xF31E0101, ++ 0x81C, 0xF2200101, ++ 0x81C, 0xF1220101, ++ 0x81C, 0xF0240101, ++ 0x81C, 0xEF260101, ++ 0x81C, 0xEE280101, ++ 0x81C, 0xED2A0101, ++ 0x81C, 0xEC2C0101, ++ 0x81C, 0xEB2E0101, ++ 0x81C, 0xEA300101, ++ 0x81C, 0xE9320101, ++ 0x81C, 0xE8340101, ++ 0x81C, 0xE7360101, ++ 0x81C, 0xE6380101, ++ 0x81C, 0xE53A0101, ++ 0x81C, 0xE43C0101, ++ 0x81C, 0xE33E0101, ++ 0x81C, 0xA5400101, ++ 0x81C, 0xA4420101, ++ 0x81C, 0xA3440101, ++ 0x81C, 0x87460101, ++ 0x81C, 0x86480101, ++ 0x81C, 0x854A0101, ++ 0x81C, 0x844C0101, ++ 0x81C, 0x694E0101, ++ 0x81C, 0x68500101, ++ 0x81C, 0x67520101, ++ 0x81C, 0x66540101, ++ 0x81C, 0x49560101, ++ 0x81C, 0x48580101, ++ 0x81C, 0x475A0101, ++ 0x81C, 0x2A5C0101, ++ 0x81C, 0x295E0101, ++ 0x81C, 0x28600101, ++ 0x81C, 0x27620101, ++ 0x81C, 0x26640101, ++ 0x81C, 0x25660101, ++ 0x81C, 0x24680101, ++ 0x81C, 0x236A0101, ++ 0x81C, 0x056C0101, ++ 0x81C, 0x046E0101, ++ 0x81C, 0x03700101, ++ 0x81C, 0x02720101, ++ 0xB0000000, 0x00000000, ++ 0x81C, 0x01740101, ++ 0x81C, 0x01760101, ++ 0x81C, 0x01780101, ++ 0x81C, 0x017A0101, ++ 0x81C, 0x017C0101, ++ 0x81C, 0x017E0101, ++ 0xC50, 0x00000022, ++ 0xC50, 0x00000020, ++}; ++ ++RTW_DECL_TABLE_PHY_COND(rtw8821a_agc, rtw_phy_cfg_agc); ++ ++static const u32 rtw8821a_bb[] = { ++ 0x800, 0x0020D090, ++ 0x804, 0x080112E0, ++ 0x808, 0x0E028211, ++ 0x80C, 0x92131111, ++ 0x810, 0x20101261, ++ 0x814, 0x020C3D10, ++ 0x818, 0x03A00385, ++ 0x820, 0x00000000, ++ 0x824, 0x00030FE0, ++ 0x828, 0x00000000, ++ 0x82C, 0x002081DD, ++ 0x830, 0x2AAAEEC8, ++ 0x834, 0x0037A706, ++ 0x838, 0x06489B44, ++ 0x83C, 0x0000095B, ++ 0x840, 0xC0000001, ++ 0x844, 0x40003CDE, ++ 0x848, 0x62103F8B, ++ 0x84C, 0x6CFDFFB8, ++ 0x850, 0x28874706, ++ 0x854, 0x0001520C, ++ 0x858, 0x8060E000, ++ 0x85C, 0x74210168, ++ 0x860, 0x6929C321, ++ 0x864, 0x79727432, ++ 0x868, 0x8CA7A314, ++ 0x86C, 0x888C2878, ++ 0x870, 0x08888888, ++ 0x874, 0x31612C2E, ++ 0x878, 0x00000152, ++ 0x87C, 0x000FD000, ++ 0x8A0, 0x00000013, ++ 0x8A4, 0x7F7F7F7F, ++ 0x8A8, 0xA2000338, ++ 0x8AC, 0x0FF0FA0A, ++ 0x8B4, 0x000FC080, ++ 0x8B8, 0x6C10D7FF, ++ 0x8BC, 0x0CA52090, ++ 0x8C0, 0x1BF00020, ++ 0x8C4, 0x00000000, ++ 0x8C8, 0x00013169, ++ 0x8CC, 0x08248492, ++ 0x8D4, 0x940008A0, ++ 0x8D8, 0x290B5612, ++ 0x8F8, 0x400002C0, ++ 0x8FC, 0x00000000, ++ 0x900, 0x00000700, ++ 0x90C, 0x00000000, ++ 0x910, 0x0000FC00, ++ 0x914, 0x00000404, ++ 0x918, 0x1C1028C0, ++ 0x91C, 0x64B11A1C, ++ 0x920, 0xE0767233, ++ 0x924, 0x055AA500, ++ 0x928, 0x00000004, ++ 0x92C, 0xFFFE0000, ++ 0x930, 0xFFFFFFFE, ++ 0x934, 0x001FFFFF, ++ 0x960, 0x00000000, ++ 0x964, 0x00000000, ++ 0x968, 0x00000000, ++ 0x96C, 0x00000000, ++ 0x970, 0x801FFFFF, ++ 0x974, 0x000003FF, ++ 0x978, 0x00000000, ++ 0x97C, 0x00000000, ++ 0x980, 0x00000000, ++ 0x984, 0x00000000, ++ 0x988, 0x00000000, ++ 0x990, 0x27100000, ++ 0x994, 0xFFFF0100, ++ 0x998, 0xFFFFFF5C, ++ 0x99C, 0xFFFFFFFF, ++ 0x9A0, 0x000000FF, ++ 0x9A4, 0x00480080, ++ 0x9A8, 0x00000000, ++ 0x9AC, 0x00000000, ++ 0x9B0, 0x81081008, ++ 0x9B4, 0x01081008, ++ 0x9B8, 0x01081008, ++ 0x9BC, 0x01081008, ++ 0x9D0, 0x00000000, ++ 0x9D4, 0x00000000, ++ 0x9D8, 0x00000000, ++ 0x9DC, 0x00000000, ++ 0x9E0, 0x00005D00, ++ 0x9E4, 0x00000003, ++ 0x9E8, 0x00000001, ++ 0xA00, 0x00D047C8, ++ 0xA04, 0x01FF800C, ++ 0xA08, 0x8C8A8300, ++ 0xA0C, 0x2E68000F, ++ 0xA10, 0x9500BB78, ++ 0xA14, 0x11144028, ++ 0xA18, 0x00881117, ++ 0xA1C, 0x89140F00, ++ 0xA20, 0x1A1B0000, ++ 0xA24, 0x090E1317, ++ 0xA28, 0x00000204, ++ 0xA2C, 0x00900000, ++ 0xA70, 0x101FFF00, ++ 0xA74, 0x00000008, ++ 0xA78, 0x00000900, ++ 0xA7C, 0x225B0606, ++ 0xA80, 0x21805490, ++ 0xA84, 0x001F0000, ++ 0XB00, 0x03100040, ++ 0XB04, 0x0000B000, ++ 0XB08, 0xAE0201EB, ++ 0XB0C, 0x01003207, ++ 0XB10, 0x00009807, ++ 0XB14, 0x01000000, ++ 0XB18, 0x00000002, ++ 0XB1C, 0x00000002, ++ 0XB20, 0x0000001F, ++ 0XB24, 0x03020100, ++ 0XB28, 0x07060504, ++ 0XB2C, 0x0B0A0908, ++ 0XB30, 0x0F0E0D0C, ++ 0XB34, 0x13121110, ++ 0XB38, 0x17161514, ++ 0XB3C, 0x0000003A, ++ 0XB40, 0x00000000, ++ 0XB44, 0x00000000, ++ 0XB48, 0x13000032, ++ 0XB4C, 0x48080000, ++ 0XB50, 0x00000000, ++ 0XB54, 0x00000000, ++ 0XB58, 0x00000000, ++ 0XB5C, 0x00000000, ++ 0xC00, 0x00000007, ++ 0xC04, 0x00042020, ++ 0xC08, 0x80410231, ++ 0xC0C, 0x00000000, ++ 0xC10, 0x00000100, ++ 0xC14, 0x01000000, ++ 0xC1C, 0x40000003, ++ 0xC20, 0x2C2C2C2C, ++ 0xC24, 0x30303030, ++ 0xC28, 0x30303030, ++ 0xC2C, 0x2C2C2C2C, ++ 0xC30, 0x2C2C2C2C, ++ 0xC34, 0x2C2C2C2C, ++ 0xC38, 0x2C2C2C2C, ++ 0xC3C, 0x2A2A2A2A, ++ 0xC40, 0x2A2A2A2A, ++ 0xC44, 0x2A2A2A2A, ++ 0xC48, 0x2A2A2A2A, ++ 0xC4C, 0x2A2A2A2A, ++ 0xC50, 0x00000020, ++ 0xC54, 0x001C1208, ++ 0xC58, 0x30000C1C, ++ 0xC5C, 0x00000058, ++ 0xC60, 0x34344443, ++ 0xC64, 0x07003333, ++ 0xC68, 0x19791979, ++ 0xC6C, 0x19791979, ++ 0xC70, 0x19791979, ++ 0xC74, 0x19791979, ++ 0xC78, 0x19791979, ++ 0xC7C, 0x19791979, ++ 0xC80, 0x19791979, ++ 0xC84, 0x19791979, ++ 0xC94, 0x0100005C, ++ 0xC98, 0x00000000, ++ 0xC9C, 0x00000000, ++ 0xCA0, 0x00000029, ++ 0xCA4, 0x08040201, ++ 0xCA8, 0x80402010, ++ 0xCB0, 0x77775747, ++ 0xCB4, 0x10000077, ++ 0xCB8, 0x00508240, ++}; ++ ++RTW_DECL_TABLE_PHY_COND(rtw8821a_bb, rtw_phy_cfg_bb); ++ ++static const struct rtw_phy_pg_cfg_pair rtw8821a_bb_pg[] = { ++ { 0, 0, 0, 0x00000c20, 0xffffffff, 0x32343638, }, ++ { 0, 0, 0, 0x00000c24, 0xffffffff, 0x36363838, }, ++ { 0, 0, 0, 0x00000c28, 0xffffffff, 0x28303234, }, ++ { 0, 0, 0, 0x00000c2c, 0xffffffff, 0x34363838, }, ++ { 0, 0, 0, 0x00000c30, 0xffffffff, 0x26283032, }, ++ { 0, 0, 0, 0x00000c3c, 0xffffffff, 0x32343636, }, ++ { 0, 0, 0, 0x00000c40, 0xffffffff, 0x24262830, }, ++ { 0, 0, 0, 0x00000c44, 0x0000ffff, 0x00002022, }, ++ { 1, 0, 0, 0x00000c24, 0xffffffff, 0x34343636, }, ++ { 1, 0, 0, 0x00000c28, 0xffffffff, 0x26283032, }, ++ { 1, 0, 0, 0x00000c2c, 0xffffffff, 0x32343636, }, ++ { 1, 0, 0, 0x00000c30, 0xffffffff, 0x24262830, }, ++ { 1, 0, 0, 0x00000c3c, 0xffffffff, 0x32343636, }, ++ { 1, 0, 0, 0x00000c40, 0xffffffff, 0x24262830, }, ++ { 1, 0, 0, 0x00000c44, 0x0000ffff, 0x00002022, }, ++}; ++ ++RTW_DECL_TABLE_BB_PG(rtw8821a_bb_pg); ++ ++static const u32 rtw8821a_rf_a[] = { ++ 0x018, 0x0001712A, ++ 0x056, 0x00051CF2, ++ 0x066, 0x00040000, ++ 0x000, 0x00010000, ++ 0x01E, 0x00080000, ++ 0x082, 0x00000830, ++ 0x083, 0x00021800, ++ 0x084, 0x00028000, ++ 0x085, 0x00048000, ++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, ++ 0x086, 0x0009483A, ++ 0xA0000000, 0x00000000, ++ 0x086, 0x00094838, ++ 0xB0000000, 0x00000000, ++ 0x087, 0x00044980, ++ 0x088, 0x00048000, ++ 0x089, 0x0000D480, ++ 0x08A, 0x00042240, ++ 0x08B, 0x000F0380, ++ 0x08C, 0x00090000, ++ 0x08D, 0x00022852, ++ 0x08E, 0x00065540, ++ 0x08F, 0x00088001, ++ 0x0EF, 0x00020000, ++ 0x03E, 0x00000380, ++ 0x03F, 0x00090018, ++ 0x03E, 0x00020380, ++ 0x03F, 0x000A0018, ++ 0x03E, 0x00040308, ++ 0x03F, 0x000A0018, ++ 0x03E, 0x00060018, ++ 0x03F, 0x000A0018, ++ 0x0EF, 0x00000000, ++ 0x018, 0x0001712A, ++ 0x089, 0x00000080, ++ 0x08B, 0x00080180, ++ 0x0EF, 0x00001000, ++ 0x03A, 0x00000244, ++ 0x03B, 0x00038027, ++ 0x03C, 0x00082000, ++ 0x03A, 0x00000244, ++ 0x03B, 0x00030113, ++ 0x03C, 0x00082000, ++ 0x03A, 0x0000014C, ++ 0x03B, 0x00028027, ++ 0x03C, 0x00082000, ++ 0x03A, 0x000000CC, ++ 0x03B, 0x00027027, ++ 0x03C, 0x00042000, ++ 0x03A, 0x0000014C, ++ 0x03B, 0x0001F913, ++ 0x03C, 0x00042000, ++ 0x03A, 0x0000010C, ++ 0x03B, 0x00017F10, ++ 0x03C, 0x00012000, ++ 0x03A, 0x000000D0, ++ 0x03B, 0x00008027, ++ 0x03C, 0x000CA000, ++ 0x03A, 0x00000244, ++ 0x03B, 0x00078027, ++ 0x03C, 0x00082000, ++ 0x03A, 0x00000244, ++ 0x03B, 0x00070113, ++ 0x03C, 0x00082000, ++ 0x03A, 0x0000014C, ++ 0x03B, 0x00068027, ++ 0x03C, 0x00082000, ++ 0x03A, 0x000000CC, ++ 0x03B, 0x00067027, ++ 0x03C, 0x00042000, ++ 0x03A, 0x0000014C, ++ 0x03B, 0x0005F913, ++ 0x03C, 0x00042000, ++ 0x03A, 0x0000010C, ++ 0x03B, 0x00057F10, ++ 0x03C, 0x00012000, ++ 0x03A, 0x000000D0, ++ 0x03B, 0x00048027, ++ 0x03C, 0x000CA000, ++ 0x03A, 0x00000244, ++ 0x03B, 0x000B8027, ++ 0x03C, 0x00082000, ++ 0x03A, 0x00000244, ++ 0x03B, 0x000B0113, ++ 0x03C, 0x00082000, ++ 0x03A, 0x0000014C, ++ 0x03B, 0x000A8027, ++ 0x03C, 0x00082000, ++ 0x03A, 0x000000CC, ++ 0x03B, 0x000A7027, ++ 0x03C, 0x00042000, ++ 0x03A, 0x0000014C, ++ 0x03B, 0x0009F913, ++ 0x03C, 0x00042000, ++ 0x03A, 0x0000010C, ++ 0x03B, 0x00097F10, ++ 0x03C, 0x00012000, ++ 0x03A, 0x000000D0, ++ 0x03B, 0x00088027, ++ 0x03C, 0x000CA000, ++ 0x0EF, 0x00000000, ++ 0x0EF, 0x00001100, ++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0004ADF3, ++ 0x034, 0x00049DF0, ++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0004ADF3, ++ 0x034, 0x00049DF0, ++ 0x90000210, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0004ADF5, ++ 0x034, 0x00049DF2, ++ 0x9000020c, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0004A0F3, ++ 0x034, 0x000490B1, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0004A0F3, ++ 0x034, 0x000490B1, ++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0004ADF5, ++ 0x034, 0x00049DF2, ++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0004ADF3, ++ 0x034, 0x00049DF0, ++ 0xA0000000, 0x00000000, ++ 0x034, 0x0004ADF7, ++ 0x034, 0x00049DF3, ++ 0xB0000000, 0x00000000, ++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x00048DED, ++ 0x034, 0x00047DEA, ++ 0x034, 0x00046DE7, ++ 0x034, 0x00045CE9, ++ 0x034, 0x00044CE6, ++ 0x034, 0x000438C6, ++ 0x034, 0x00042886, ++ 0x034, 0x00041486, ++ 0x034, 0x00040447, ++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x00048DED, ++ 0x034, 0x00047DEA, ++ 0x034, 0x00046DE7, ++ 0x034, 0x00045CE9, ++ 0x034, 0x00044CE6, ++ 0x034, 0x000438C6, ++ 0x034, 0x00042886, ++ 0x034, 0x00041486, ++ 0x034, 0x00040447, ++ 0x9000020c, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x000480AE, ++ 0x034, 0x000470AB, ++ 0x034, 0x0004608B, ++ 0x034, 0x00045069, ++ 0x034, 0x00044048, ++ 0x034, 0x00043045, ++ 0x034, 0x00042026, ++ 0x034, 0x00041023, ++ 0x034, 0x00040002, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x000480AE, ++ 0x034, 0x000470AB, ++ 0x034, 0x0004608B, ++ 0x034, 0x00045069, ++ 0x034, 0x00044048, ++ 0x034, 0x00043045, ++ 0x034, 0x00042026, ++ 0x034, 0x00041023, ++ 0x034, 0x00040002, ++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x00048DED, ++ 0x034, 0x00047DEA, ++ 0x034, 0x00046DE7, ++ 0x034, 0x00045CE9, ++ 0x034, 0x00044CE6, ++ 0x034, 0x000438C6, ++ 0x034, 0x00042886, ++ 0x034, 0x00041486, ++ 0x034, 0x00040447, ++ 0xA0000000, 0x00000000, ++ 0x034, 0x00048DEF, ++ 0x034, 0x00047DEC, ++ 0x034, 0x00046DE9, ++ 0x034, 0x00045CCB, ++ 0x034, 0x0004488D, ++ 0x034, 0x0004348D, ++ 0x034, 0x0004248A, ++ 0x034, 0x0004108D, ++ 0x034, 0x0004008A, ++ 0xB0000000, 0x00000000, ++ 0x80000210, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0002ADF4, ++ 0x9000020c, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0002A0F3, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0002A0F3, ++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0002ADF4, ++ 0xA0000000, 0x00000000, ++ 0x034, 0x0002ADF7, ++ 0xB0000000, 0x00000000, ++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x00029DF4, ++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x00029DF4, ++ 0x90000210, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x00029DF1, ++ 0x9000020c, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x000290F0, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x000290F0, ++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x00029DF1, ++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x00029DF4, ++ 0xA0000000, 0x00000000, ++ 0x034, 0x00029DF2, ++ 0xB0000000, 0x00000000, ++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x00028DF1, ++ 0x034, 0x00027DEE, ++ 0x034, 0x00026DEB, ++ 0x034, 0x00025CEC, ++ 0x034, 0x00024CE9, ++ 0x034, 0x000238CA, ++ 0x034, 0x00022889, ++ 0x034, 0x00021489, ++ 0x034, 0x0002044A, ++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x00028DF1, ++ 0x034, 0x00027DEE, ++ 0x034, 0x00026DEB, ++ 0x034, 0x00025CEC, ++ 0x034, 0x00024CE9, ++ 0x034, 0x000238CA, ++ 0x034, 0x00022889, ++ 0x034, 0x00021489, ++ 0x034, 0x0002044A, ++ 0x9000020c, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x000280AF, ++ 0x034, 0x000270AC, ++ 0x034, 0x0002608B, ++ 0x034, 0x00025069, ++ 0x034, 0x00024048, ++ 0x034, 0x00023045, ++ 0x034, 0x00022026, ++ 0x034, 0x00021023, ++ 0x034, 0x00020002, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x000280AF, ++ 0x034, 0x000270AC, ++ 0x034, 0x0002608B, ++ 0x034, 0x00025069, ++ 0x034, 0x00024048, ++ 0x034, 0x00023045, ++ 0x034, 0x00022026, ++ 0x034, 0x00021023, ++ 0x034, 0x00020002, ++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x00028DF1, ++ 0x034, 0x00027DEE, ++ 0x034, 0x00026DEB, ++ 0x034, 0x00025CEC, ++ 0x034, 0x00024CE9, ++ 0x034, 0x000238CA, ++ 0x034, 0x00022889, ++ 0x034, 0x00021489, ++ 0x034, 0x0002044A, ++ 0xA0000000, 0x00000000, ++ 0x034, 0x00028DEE, ++ 0x034, 0x00027DEB, ++ 0x034, 0x00026CCD, ++ 0x034, 0x00025CCA, ++ 0x034, 0x0002488C, ++ 0x034, 0x0002384C, ++ 0x034, 0x00022849, ++ 0x034, 0x00021449, ++ 0x034, 0x0002004D, ++ 0xB0000000, 0x00000000, ++ 0x8000020c, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0000A0D7, ++ 0x034, 0x000090D3, ++ 0x034, 0x000080B1, ++ 0x034, 0x000070AE, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0000A0D7, ++ 0x034, 0x000090D3, ++ 0x034, 0x000080B1, ++ 0x034, 0x000070AE, ++ 0xA0000000, 0x00000000, ++ 0x034, 0x0000ADF7, ++ 0x034, 0x00009DF4, ++ 0x034, 0x00008DF1, ++ 0x034, 0x00007DEE, ++ 0xB0000000, 0x00000000, ++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x00006DEB, ++ 0x034, 0x00005CEC, ++ 0x034, 0x00004CE9, ++ 0x034, 0x000038CA, ++ 0x034, 0x00002889, ++ 0x034, 0x00001489, ++ 0x034, 0x0000044A, ++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x00006DEB, ++ 0x034, 0x00005CEC, ++ 0x034, 0x00004CE9, ++ 0x034, 0x000038CA, ++ 0x034, 0x00002889, ++ 0x034, 0x00001489, ++ 0x034, 0x0000044A, ++ 0x9000020c, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0000608D, ++ 0x034, 0x0000506B, ++ 0x034, 0x0000404A, ++ 0x034, 0x00003047, ++ 0x034, 0x00002044, ++ 0x034, 0x00001025, ++ 0x034, 0x00000004, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0000608D, ++ 0x034, 0x0000506B, ++ 0x034, 0x0000404A, ++ 0x034, 0x00003047, ++ 0x034, 0x00002044, ++ 0x034, 0x00001025, ++ 0x034, 0x00000004, ++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x00006DEB, ++ 0x034, 0x00005CEC, ++ 0x034, 0x00004CE9, ++ 0x034, 0x000038CA, ++ 0x034, 0x00002889, ++ 0x034, 0x00001489, ++ 0x034, 0x0000044A, ++ 0xA0000000, 0x00000000, ++ 0x034, 0x00006DCD, ++ 0x034, 0x00005CCD, ++ 0x034, 0x00004CCA, ++ 0x034, 0x0000388C, ++ 0x034, 0x00002888, ++ 0x034, 0x00001488, ++ 0x034, 0x00000486, ++ 0xB0000000, 0x00000000, ++ 0x0EF, 0x00000000, ++ 0x018, 0x0001712A, ++ 0x0EF, 0x00000040, ++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, ++ 0x035, 0x00000187, ++ 0x035, 0x00008187, ++ 0x035, 0x00010187, ++ 0x035, 0x00020188, ++ 0x035, 0x00028188, ++ 0x035, 0x00030188, ++ 0x035, 0x00040188, ++ 0x035, 0x00048188, ++ 0x035, 0x00050188, ++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, ++ 0x035, 0x00000187, ++ 0x035, 0x00008187, ++ 0x035, 0x00010187, ++ 0x035, 0x00020188, ++ 0x035, 0x00028188, ++ 0x035, 0x00030188, ++ 0x035, 0x00040188, ++ 0x035, 0x00048188, ++ 0x035, 0x00050188, ++ 0x90000210, 0x00000000, 0x40000000, 0x00000000, ++ 0x035, 0x00000128, ++ 0x035, 0x00008128, ++ 0x035, 0x00010128, ++ 0x035, 0x000201C8, ++ 0x035, 0x000281C8, ++ 0x035, 0x000301C8, ++ 0x035, 0x000401C8, ++ 0x035, 0x000481C8, ++ 0x035, 0x000501C8, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x035, 0x00000145, ++ 0x035, 0x00008145, ++ 0x035, 0x00010145, ++ 0x035, 0x00020196, ++ 0x035, 0x00028196, ++ 0x035, 0x00030196, ++ 0x035, 0x000401C7, ++ 0x035, 0x000481C7, ++ 0x035, 0x000501C7, ++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, ++ 0x035, 0x00000128, ++ 0x035, 0x00008128, ++ 0x035, 0x00010128, ++ 0x035, 0x000201C8, ++ 0x035, 0x000281C8, ++ 0x035, 0x000301C8, ++ 0x035, 0x000401C8, ++ 0x035, 0x000481C8, ++ 0x035, 0x000501C8, ++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, ++ 0x035, 0x00000187, ++ 0x035, 0x00008187, ++ 0x035, 0x00010187, ++ 0x035, 0x00020188, ++ 0x035, 0x00028188, ++ 0x035, 0x00030188, ++ 0x035, 0x00040188, ++ 0x035, 0x00048188, ++ 0x035, 0x00050188, ++ 0xA0000000, 0x00000000, ++ 0x035, 0x00000145, ++ 0x035, 0x00008145, ++ 0x035, 0x00010145, ++ 0x035, 0x00020196, ++ 0x035, 0x00028196, ++ 0x035, 0x00030196, ++ 0x035, 0x000401C7, ++ 0x035, 0x000481C7, ++ 0x035, 0x000501C7, ++ 0xB0000000, 0x00000000, ++ 0x0EF, 0x00000000, ++ 0x018, 0x0001712A, ++ 0x0EF, 0x00000010, ++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, ++ 0x036, 0x00085733, ++ 0x036, 0x0008D733, ++ 0x036, 0x00095733, ++ 0x036, 0x0009D733, ++ 0x036, 0x000A64B4, ++ 0x036, 0x000AE4B4, ++ 0x036, 0x000B64B4, ++ 0x036, 0x000BE4B4, ++ 0x036, 0x000C64B4, ++ 0x036, 0x000CE4B4, ++ 0x036, 0x000D64B4, ++ 0x036, 0x000DE4B4, ++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, ++ 0x036, 0x00085733, ++ 0x036, 0x0008D733, ++ 0x036, 0x00095733, ++ 0x036, 0x0009D733, ++ 0x036, 0x000A64B4, ++ 0x036, 0x000AE4B4, ++ 0x036, 0x000B64B4, ++ 0x036, 0x000BE4B4, ++ 0x036, 0x000C64B4, ++ 0x036, 0x000CE4B4, ++ 0x036, 0x000D64B4, ++ 0x036, 0x000DE4B4, ++ 0x90000210, 0x00000000, 0x40000000, 0x00000000, ++ 0x036, 0x000063B5, ++ 0x036, 0x0000E3B5, ++ 0x036, 0x000163B5, ++ 0x036, 0x0001E3B5, ++ 0x036, 0x000263B5, ++ 0x036, 0x0002E3B5, ++ 0x036, 0x000363B5, ++ 0x036, 0x0003E3B5, ++ 0x036, 0x000463B5, ++ 0x036, 0x0004E3B5, ++ 0x036, 0x000563B5, ++ 0x036, 0x0005E3B5, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x036, 0x000056B3, ++ 0x036, 0x0000D6B3, ++ 0x036, 0x000156B3, ++ 0x036, 0x0001D6B3, ++ 0x036, 0x00026634, ++ 0x036, 0x0002E634, ++ 0x036, 0x00036634, ++ 0x036, 0x0003E634, ++ 0x036, 0x000467B4, ++ 0x036, 0x0004E7B4, ++ 0x036, 0x000567B4, ++ 0x036, 0x0005E7B4, ++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, ++ 0x036, 0x000063B5, ++ 0x036, 0x0000E3B5, ++ 0x036, 0x000163B5, ++ 0x036, 0x0001E3B5, ++ 0x036, 0x000263B5, ++ 0x036, 0x0002E3B5, ++ 0x036, 0x000363B5, ++ 0x036, 0x0003E3B5, ++ 0x036, 0x000463B5, ++ 0x036, 0x0004E3B5, ++ 0x036, 0x000563B5, ++ 0x036, 0x0005E3B5, ++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, ++ 0x036, 0x00085733, ++ 0x036, 0x0008D733, ++ 0x036, 0x00095733, ++ 0x036, 0x0009D733, ++ 0x036, 0x000A64B4, ++ 0x036, 0x000AE4B4, ++ 0x036, 0x000B64B4, ++ 0x036, 0x000BE4B4, ++ 0x036, 0x000C64B4, ++ 0x036, 0x000CE4B4, ++ 0x036, 0x000D64B4, ++ 0x036, 0x000DE4B4, ++ 0xA0000000, 0x00000000, ++ 0x036, 0x000056B3, ++ 0x036, 0x0000D6B3, ++ 0x036, 0x000156B3, ++ 0x036, 0x0001D6B3, ++ 0x036, 0x00026634, ++ 0x036, 0x0002E634, ++ 0x036, 0x00036634, ++ 0x036, 0x0003E634, ++ 0x036, 0x000467B4, ++ 0x036, 0x0004E7B4, ++ 0x036, 0x000567B4, ++ 0x036, 0x0005E7B4, ++ 0xB0000000, 0x00000000, ++ 0x0EF, 0x00000000, ++ 0x0EF, 0x00000008, ++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, ++ 0x03C, 0x000001C8, ++ 0x03C, 0x00000492, ++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, ++ 0x03C, 0x000001C8, ++ 0x03C, 0x00000492, ++ 0x90000210, 0x00000000, 0x40000000, 0x00000000, ++ 0x03C, 0x000001B6, ++ 0x03C, 0x00000492, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x03C, 0x0000022A, ++ 0x03C, 0x00000594, ++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, ++ 0x03C, 0x000001B6, ++ 0x03C, 0x00000492, ++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, ++ 0x03C, 0x000001C8, ++ 0x03C, 0x00000492, ++ 0xA0000000, 0x00000000, ++ 0x03C, 0x0000022A, ++ 0x03C, 0x00000594, ++ 0xB0000000, 0x00000000, ++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, ++ 0x03C, 0x00000800, ++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, ++ 0x03C, 0x00000800, ++ 0x90000210, 0x00000000, 0x40000000, 0x00000000, ++ 0x03C, 0x00000800, ++ 0x9000020c, 0x00000000, 0x40000000, 0x00000000, ++ 0x03C, 0x00000820, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x03C, 0x00000820, ++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, ++ 0x03C, 0x00000800, ++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, ++ 0x03C, 0x00000800, ++ 0xA0000000, 0x00000000, ++ 0x03C, 0x00000900, ++ 0xB0000000, 0x00000000, ++ 0x0EF, 0x00000000, ++ 0x018, 0x0001712A, ++ 0x0EF, 0x00000002, ++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, ++ 0x008, 0x0004E400, ++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, ++ 0x008, 0x0004E400, ++ 0x90000210, 0x00000000, 0x40000000, 0x00000000, ++ 0x008, 0x00002000, ++ 0x9000020c, 0x00000000, 0x40000000, 0x00000000, ++ 0x008, 0x00002000, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x008, 0x00002000, ++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, ++ 0x008, 0x00002000, ++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, ++ 0x008, 0x0004E400, ++ 0xA0000000, 0x00000000, ++ 0x008, 0x00002000, ++ 0xB0000000, 0x00000000, ++ 0x0EF, 0x00000000, ++ 0x0DF, 0x000000C0, ++ 0x01F, 0x00000064, ++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, ++ 0x058, 0x000A7284, ++ 0x059, 0x000600EC, ++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, ++ 0x058, 0x000A7284, ++ 0x059, 0x000600EC, ++ 0x9000020c, 0x00000000, 0x40000000, 0x00000000, ++ 0x058, 0x00081184, ++ 0x059, 0x0006016C, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x058, 0x00081184, ++ 0x059, 0x0006016C, ++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, ++ 0x058, 0x00081184, ++ 0x059, 0x0006016C, ++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, ++ 0x058, 0x000A7284, ++ 0x059, 0x000600EC, ++ 0xA0000000, 0x00000000, ++ 0x058, 0x00081184, ++ 0x059, 0x0006016C, ++ 0xB0000000, 0x00000000, ++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, ++ 0x061, 0x000E8D73, ++ 0x062, 0x00093FC5, ++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, ++ 0x061, 0x000E8D73, ++ 0x062, 0x00093FC5, ++ 0x90000210, 0x00000000, 0x40000000, 0x00000000, ++ 0x061, 0x000EFD83, ++ 0x062, 0x00093FCC, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x061, 0x000EAD53, ++ 0x062, 0x00093BC4, ++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, ++ 0x061, 0x000EFD83, ++ 0x062, 0x00093FCC, ++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, ++ 0x061, 0x000E8D73, ++ 0x062, 0x00093FC5, ++ 0xA0000000, 0x00000000, ++ 0x061, 0x000EAD53, ++ 0x062, 0x00093BC4, ++ 0xB0000000, 0x00000000, ++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, ++ 0x063, 0x000110E9, ++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, ++ 0x063, 0x000110E9, ++ 0x90000210, 0x00000000, 0x40000000, 0x00000000, ++ 0x063, 0x000110EB, ++ 0x9000020c, 0x00000000, 0x40000000, 0x00000000, ++ 0x063, 0x000110E9, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x063, 0x000110E9, ++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, ++ 0x063, 0x000110EB, ++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, ++ 0x063, 0x000110E9, ++ 0xA0000000, 0x00000000, ++ 0x063, 0x000714E9, ++ 0xB0000000, 0x00000000, ++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, ++ 0x064, 0x0001C27C, ++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, ++ 0x064, 0x0001C27C, ++ 0x90000210, 0x00000000, 0x40000000, 0x00000000, ++ 0x064, 0x0001C27C, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x064, 0x0001C67C, ++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, ++ 0x064, 0x0001C27C, ++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, ++ 0x064, 0x0001C27C, ++ 0xA0000000, 0x00000000, ++ 0x064, 0x0001C67C, ++ 0xB0000000, 0x00000000, ++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, ++ 0x065, 0x00091016, ++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, ++ 0x065, 0x00091016, ++ 0x90000210, 0x00000000, 0x40000000, 0x00000000, ++ 0x065, 0x00093016, ++ 0x9000020c, 0x00000000, 0x40000000, 0x00000000, ++ 0x065, 0x00093015, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x065, 0x00093015, ++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, ++ 0x065, 0x00093016, ++ 0xA0000000, 0x00000000, ++ 0x065, 0x00091016, ++ 0xB0000000, 0x00000000, ++ 0x018, 0x00000006, ++ 0x0EF, 0x00002000, ++ 0x03B, 0x0003824B, ++ 0x03B, 0x0003024B, ++ 0x03B, 0x0002844B, ++ 0x03B, 0x00020F4B, ++ 0x03B, 0x00018F4B, ++ 0x03B, 0x000104B2, ++ 0x03B, 0x00008049, ++ 0x03B, 0x00000148, ++ 0x03B, 0x0007824B, ++ 0x03B, 0x0007024B, ++ 0x03B, 0x0006824B, ++ 0x03B, 0x00060F4B, ++ 0x03B, 0x00058F4B, ++ 0x03B, 0x000504B2, ++ 0x03B, 0x00048049, ++ 0x03B, 0x00040148, ++ 0x0EF, 0x00000000, ++ 0x0EF, 0x00000100, ++ 0x034, 0x0000ADF3, ++ 0x034, 0x00009DF0, ++ 0x034, 0x00008D70, ++ 0x034, 0x00007D6D, ++ 0x034, 0x00006CEE, ++ 0x034, 0x00005CCC, ++ 0x034, 0x000044EC, ++ 0x034, 0x000034AC, ++ 0x034, 0x0000246D, ++ 0x034, 0x0000106F, ++ 0x034, 0x0000006C, ++ 0x0EF, 0x00000000, ++ 0x0ED, 0x00000010, ++ 0x044, 0x0000ADF2, ++ 0x044, 0x00009DEF, ++ 0x044, 0x00008DEC, ++ 0x044, 0x00007DE9, ++ 0x044, 0x00006CEC, ++ 0x044, 0x00005CE9, ++ 0x044, 0x000044EC, ++ 0x044, 0x000034E9, ++ 0x044, 0x0000246C, ++ 0x044, 0x00001469, ++ 0x044, 0x0000006C, ++ 0x0ED, 0x00000000, ++ 0x0ED, 0x00000001, ++ 0x040, 0x00038DA7, ++ 0x040, 0x000300C2, ++ 0x040, 0x000288E2, ++ 0x040, 0x000200B8, ++ 0x040, 0x000188A5, ++ 0x040, 0x00010FBC, ++ 0x040, 0x00008F71, ++ 0x040, 0x00000240, ++ 0x0ED, 0x00000000, ++ 0x0EF, 0x000020A2, ++ 0x0DF, 0x00000080, ++ 0x035, 0x00000120, ++ 0x035, 0x00008120, ++ 0x035, 0x00010120, ++ 0x036, 0x00000085, ++ 0x036, 0x00008085, ++ 0x036, 0x00010085, ++ 0x036, 0x00018085, ++ 0x0EF, 0x00000000, ++ 0x051, 0x00000C31, ++ 0x052, 0x00000622, ++ 0x053, 0x000FC70B, ++ 0x054, 0x0000017E, ++ 0x056, 0x00051DF3, ++ 0x051, 0x00000C01, ++ 0x052, 0x000006D6, ++ 0x053, 0x000FC649, ++ 0x070, 0x00049661, ++ 0x071, 0x0007843E, ++ 0x072, 0x00000382, ++ 0x074, 0x00051400, ++ 0x035, 0x00000160, ++ 0x035, 0x00008160, ++ 0x035, 0x00010160, ++ 0x036, 0x00000124, ++ 0x036, 0x00008124, ++ 0x036, 0x00010124, ++ 0x036, 0x00018124, ++ 0x0ED, 0x0000000C, ++ 0x045, 0x00000140, ++ 0x045, 0x00008140, ++ 0x045, 0x00010140, ++ 0x046, 0x00000124, ++ 0x046, 0x00008124, ++ 0x046, 0x00010124, ++ 0x046, 0x00018124, ++ 0x0DF, 0x00000088, ++ 0x0B3, 0x000F0E18, ++ 0x0B4, 0x0001214C, ++ 0x0B7, 0x0003000C, ++ 0x01C, 0x000539D2, ++ 0x0C4, 0x000AFE00, ++ 0x018, 0x0001F12A, ++ 0xFFE, 0x00000000, ++ 0xFFE, 0x00000000, ++ 0x018, 0x0001712A, ++}; ++ ++RTW_DECL_TABLE_RF_RADIO(rtw8821a_rf_a, A); ++ ++static const struct rtw_txpwr_lmt_cfg_pair rtw8821a_txpwr_lmt[] = { ++ { 0, 0, 0, 0, 1, 32, }, ++ { 2, 0, 0, 0, 1, 28, }, ++ { 1, 0, 0, 0, 1, 32, }, ++ { 0, 0, 0, 0, 2, 32, }, ++ { 2, 0, 0, 0, 2, 28, }, ++ { 1, 0, 0, 0, 2, 32, }, ++ { 0, 0, 0, 0, 3, 36, }, ++ { 2, 0, 0, 0, 3, 28, }, ++ { 1, 0, 0, 0, 3, 32, }, ++ { 0, 0, 0, 0, 4, 36, }, ++ { 2, 0, 0, 0, 4, 28, }, ++ { 1, 0, 0, 0, 4, 32, }, ++ { 0, 0, 0, 0, 5, 36, }, ++ { 2, 0, 0, 0, 5, 28, }, ++ { 1, 0, 0, 0, 5, 32, }, ++ { 0, 0, 0, 0, 6, 36, }, ++ { 2, 0, 0, 0, 6, 28, }, ++ { 1, 0, 0, 0, 6, 32, }, ++ { 0, 0, 0, 0, 7, 36, }, ++ { 2, 0, 0, 0, 7, 28, }, ++ { 1, 0, 0, 0, 7, 32, }, ++ { 0, 0, 0, 0, 8, 36, }, ++ { 2, 0, 0, 0, 8, 28, }, ++ { 1, 0, 0, 0, 8, 32, }, ++ { 0, 0, 0, 0, 9, 32, }, ++ { 2, 0, 0, 0, 9, 28, }, ++ { 1, 0, 0, 0, 9, 32, }, ++ { 0, 0, 0, 0, 10, 32, }, ++ { 2, 0, 0, 0, 10, 28, }, ++ { 1, 0, 0, 0, 10, 32, }, ++ { 0, 0, 0, 0, 11, 32, }, ++ { 2, 0, 0, 0, 11, 28, }, ++ { 1, 0, 0, 0, 11, 32, }, ++ { 0, 0, 0, 0, 12, 28, }, ++ { 2, 0, 0, 0, 12, 28, }, ++ { 1, 0, 0, 0, 12, 32, }, ++ { 0, 0, 0, 0, 13, 26, }, ++ { 2, 0, 0, 0, 13, 28, }, ++ { 1, 0, 0, 0, 13, 32, }, ++ { 0, 0, 0, 0, 14, 63, }, ++ { 2, 0, 0, 0, 14, 63, }, ++ { 1, 0, 0, 0, 14, 32, }, ++ { 0, 0, 0, 1, 1, 30, }, ++ { 2, 0, 0, 1, 1, 30, }, ++ { 1, 0, 0, 1, 1, 32, }, ++ { 0, 0, 0, 1, 2, 30, }, ++ { 2, 0, 0, 1, 2, 32, }, ++ { 1, 0, 0, 1, 2, 32, }, ++ { 0, 0, 0, 1, 3, 32, }, ++ { 2, 0, 0, 1, 3, 32, }, ++ { 1, 0, 0, 1, 3, 32, }, ++ { 0, 0, 0, 1, 4, 32, }, ++ { 2, 0, 0, 1, 4, 32, }, ++ { 1, 0, 0, 1, 4, 32, }, ++ { 0, 0, 0, 1, 5, 32, }, ++ { 2, 0, 0, 1, 5, 32, }, ++ { 1, 0, 0, 1, 5, 32, }, ++ { 0, 0, 0, 1, 6, 32, }, ++ { 2, 0, 0, 1, 6, 32, }, ++ { 1, 0, 0, 1, 6, 32, }, ++ { 0, 0, 0, 1, 7, 32, }, ++ { 2, 0, 0, 1, 7, 32, }, ++ { 1, 0, 0, 1, 7, 32, }, ++ { 0, 0, 0, 1, 8, 32, }, ++ { 2, 0, 0, 1, 8, 32, }, ++ { 1, 0, 0, 1, 8, 32, }, ++ { 0, 0, 0, 1, 9, 30, }, ++ { 2, 0, 0, 1, 9, 32, }, ++ { 1, 0, 0, 1, 9, 32, }, ++ { 0, 0, 0, 1, 10, 30, }, ++ { 2, 0, 0, 1, 10, 32, }, ++ { 1, 0, 0, 1, 10, 32, }, ++ { 0, 0, 0, 1, 11, 30, }, ++ { 2, 0, 0, 1, 11, 32, }, ++ { 1, 0, 0, 1, 11, 32, }, ++ { 0, 0, 0, 1, 12, 26, }, ++ { 2, 0, 0, 1, 12, 32, }, ++ { 1, 0, 0, 1, 12, 32, }, ++ { 0, 0, 0, 1, 13, 24, }, ++ { 2, 0, 0, 1, 13, 30, }, ++ { 1, 0, 0, 1, 13, 32, }, ++ { 0, 0, 0, 1, 14, 63, }, ++ { 2, 0, 0, 1, 14, 63, }, ++ { 1, 0, 0, 1, 14, 63, }, ++ { 0, 0, 0, 2, 1, 26, }, ++ { 2, 0, 0, 2, 1, 26, }, ++ { 1, 0, 0, 2, 1, 32, }, ++ { 0, 0, 0, 2, 2, 26, }, ++ { 2, 0, 0, 2, 2, 32, }, ++ { 1, 0, 0, 2, 2, 32, }, ++ { 0, 0, 0, 2, 3, 32, }, ++ { 2, 0, 0, 2, 3, 32, }, ++ { 1, 0, 0, 2, 3, 32, }, ++ { 0, 0, 0, 2, 4, 32, }, ++ { 2, 0, 0, 2, 4, 32, }, ++ { 1, 0, 0, 2, 4, 32, }, ++ { 0, 0, 0, 2, 5, 32, }, ++ { 2, 0, 0, 2, 5, 32, }, ++ { 1, 0, 0, 2, 5, 32, }, ++ { 0, 0, 0, 2, 6, 32, }, ++ { 2, 0, 0, 2, 6, 32, }, ++ { 1, 0, 0, 2, 6, 32, }, ++ { 0, 0, 0, 2, 7, 32, }, ++ { 2, 0, 0, 2, 7, 32, }, ++ { 1, 0, 0, 2, 7, 32, }, ++ { 0, 0, 0, 2, 8, 32, }, ++ { 2, 0, 0, 2, 8, 32, }, ++ { 1, 0, 0, 2, 8, 32, }, ++ { 0, 0, 0, 2, 9, 26, }, ++ { 2, 0, 0, 2, 9, 32, }, ++ { 1, 0, 0, 2, 9, 32, }, ++ { 0, 0, 0, 2, 10, 26, }, ++ { 2, 0, 0, 2, 10, 32, }, ++ { 1, 0, 0, 2, 10, 32, }, ++ { 0, 0, 0, 2, 11, 26, }, ++ { 2, 0, 0, 2, 11, 32, }, ++ { 1, 0, 0, 2, 11, 32, }, ++ { 0, 0, 0, 2, 12, 26, }, ++ { 2, 0, 0, 2, 12, 32, }, ++ { 1, 0, 0, 2, 12, 32, }, ++ { 0, 0, 0, 2, 13, 24, }, ++ { 2, 0, 0, 2, 13, 26, }, ++ { 1, 0, 0, 2, 13, 32, }, ++ { 0, 0, 0, 2, 14, 63, }, ++ { 2, 0, 0, 2, 14, 63, }, ++ { 1, 0, 0, 2, 14, 63, }, ++ { 0, 0, 0, 3, 1, 30, }, ++ { 2, 0, 0, 3, 1, 32, }, ++ { 1, 0, 0, 3, 1, 32, }, ++ { 0, 0, 0, 3, 2, 32, }, ++ { 2, 0, 0, 3, 2, 32, }, ++ { 1, 0, 0, 3, 2, 32, }, ++ { 0, 0, 0, 3, 3, 32, }, ++ { 2, 0, 0, 3, 3, 32, }, ++ { 1, 0, 0, 3, 3, 32, }, ++ { 0, 0, 0, 3, 4, 32, }, ++ { 2, 0, 0, 3, 4, 32, }, ++ { 1, 0, 0, 3, 4, 32, }, ++ { 0, 0, 0, 3, 5, 32, }, ++ { 2, 0, 0, 3, 5, 32, }, ++ { 1, 0, 0, 3, 5, 32, }, ++ { 0, 0, 0, 3, 6, 32, }, ++ { 2, 0, 0, 3, 6, 32, }, ++ { 1, 0, 0, 3, 6, 32, }, ++ { 0, 0, 0, 3, 7, 32, }, ++ { 2, 0, 0, 3, 7, 32, }, ++ { 1, 0, 0, 3, 7, 32, }, ++ { 0, 0, 0, 3, 8, 32, }, ++ { 2, 0, 0, 3, 8, 32, }, ++ { 1, 0, 0, 3, 8, 32, }, ++ { 0, 0, 0, 3, 9, 32, }, ++ { 2, 0, 0, 3, 9, 32, }, ++ { 1, 0, 0, 3, 9, 32, }, ++ { 0, 0, 0, 3, 10, 32, }, ++ { 2, 0, 0, 3, 10, 32, }, ++ { 1, 0, 0, 3, 10, 32, }, ++ { 0, 0, 0, 3, 11, 30, }, ++ { 2, 0, 0, 3, 11, 32, }, ++ { 1, 0, 0, 3, 11, 32, }, ++ { 0, 0, 0, 3, 12, 63, }, ++ { 2, 0, 0, 3, 12, 32, }, ++ { 1, 0, 0, 3, 12, 32, }, ++ { 0, 0, 0, 3, 13, 63, }, ++ { 2, 0, 0, 3, 13, 32, }, ++ { 1, 0, 0, 3, 13, 32, }, ++ { 0, 0, 0, 3, 14, 63, }, ++ { 2, 0, 0, 3, 14, 63, }, ++ { 1, 0, 0, 3, 14, 63, }, ++ { 0, 0, 1, 2, 1, 63, }, ++ { 2, 0, 1, 2, 1, 63, }, ++ { 1, 0, 1, 2, 1, 63, }, ++ { 0, 0, 1, 2, 2, 63, }, ++ { 2, 0, 1, 2, 2, 63, }, ++ { 1, 0, 1, 2, 2, 63, }, ++ { 0, 0, 1, 2, 3, 26, }, ++ { 2, 0, 1, 2, 3, 26, }, ++ { 1, 0, 1, 2, 3, 32, }, ++ { 0, 0, 1, 2, 4, 26, }, ++ { 2, 0, 1, 2, 4, 32, }, ++ { 1, 0, 1, 2, 4, 32, }, ++ { 0, 0, 1, 2, 5, 26, }, ++ { 2, 0, 1, 2, 5, 32, }, ++ { 1, 0, 1, 2, 5, 32, }, ++ { 0, 0, 1, 2, 6, 32, }, ++ { 2, 0, 1, 2, 6, 32, }, ++ { 1, 0, 1, 2, 6, 32, }, ++ { 0, 0, 1, 2, 7, 32, }, ++ { 2, 0, 1, 2, 7, 32, }, ++ { 1, 0, 1, 2, 7, 32, }, ++ { 0, 0, 1, 2, 8, 32, }, ++ { 2, 0, 1, 2, 8, 32, }, ++ { 1, 0, 1, 2, 8, 32, }, ++ { 0, 0, 1, 2, 9, 26, }, ++ { 2, 0, 1, 2, 9, 32, }, ++ { 1, 0, 1, 2, 9, 32, }, ++ { 0, 0, 1, 2, 10, 24, }, ++ { 2, 0, 1, 2, 10, 32, }, ++ { 1, 0, 1, 2, 10, 32, }, ++ { 0, 0, 1, 2, 11, 22, }, ++ { 2, 0, 1, 2, 11, 26, }, ++ { 1, 0, 1, 2, 11, 32, }, ++ { 0, 0, 1, 2, 12, 63, }, ++ { 2, 0, 1, 2, 12, 63, }, ++ { 1, 0, 1, 2, 12, 63, }, ++ { 0, 0, 1, 2, 13, 63, }, ++ { 2, 0, 1, 2, 13, 63, }, ++ { 1, 0, 1, 2, 13, 63, }, ++ { 0, 0, 1, 2, 14, 63, }, ++ { 2, 0, 1, 2, 14, 63, }, ++ { 1, 0, 1, 2, 14, 63, }, ++ { 0, 0, 1, 3, 1, 63, }, ++ { 2, 0, 1, 3, 1, 63, }, ++ { 1, 0, 1, 3, 1, 63, }, ++ { 0, 0, 1, 3, 2, 63, }, ++ { 2, 0, 1, 3, 2, 63, }, ++ { 1, 0, 1, 3, 2, 63, }, ++ { 0, 0, 1, 3, 3, 30, }, ++ { 2, 0, 1, 3, 3, 30, }, ++ { 1, 0, 1, 3, 3, 30, }, ++ { 0, 0, 1, 3, 4, 32, }, ++ { 2, 0, 1, 3, 4, 30, }, ++ { 1, 0, 1, 3, 4, 30, }, ++ { 0, 0, 1, 3, 5, 32, }, ++ { 2, 0, 1, 3, 5, 30, }, ++ { 1, 0, 1, 3, 5, 30, }, ++ { 0, 0, 1, 3, 6, 32, }, ++ { 2, 0, 1, 3, 6, 30, }, ++ { 1, 0, 1, 3, 6, 30, }, ++ { 0, 0, 1, 3, 7, 32, }, ++ { 2, 0, 1, 3, 7, 30, }, ++ { 1, 0, 1, 3, 7, 30, }, ++ { 0, 0, 1, 3, 8, 32, }, ++ { 2, 0, 1, 3, 8, 30, }, ++ { 1, 0, 1, 3, 8, 30, }, ++ { 0, 0, 1, 3, 9, 32, }, ++ { 2, 0, 1, 3, 9, 30, }, ++ { 1, 0, 1, 3, 9, 30, }, ++ { 0, 0, 1, 3, 10, 32, }, ++ { 2, 0, 1, 3, 10, 30, }, ++ { 1, 0, 1, 3, 10, 30, }, ++ { 0, 0, 1, 3, 11, 30, }, ++ { 2, 0, 1, 3, 11, 30, }, ++ { 1, 0, 1, 3, 11, 30, }, ++ { 0, 0, 1, 3, 12, 63, }, ++ { 2, 0, 1, 3, 12, 32, }, ++ { 1, 0, 1, 3, 12, 32, }, ++ { 0, 0, 1, 3, 13, 63, }, ++ { 2, 0, 1, 3, 13, 32, }, ++ { 1, 0, 1, 3, 13, 32, }, ++ { 0, 0, 1, 3, 14, 63, }, ++ { 2, 0, 1, 3, 14, 63, }, ++ { 1, 0, 1, 3, 14, 63, }, ++ { 0, 1, 0, 1, 36, 32, }, ++ { 2, 1, 0, 1, 36, 30, }, ++ { 1, 1, 0, 1, 36, 30, }, ++ { 0, 1, 0, 1, 40, 32, }, ++ { 2, 1, 0, 1, 40, 30, }, ++ { 1, 1, 0, 1, 40, 30, }, ++ { 0, 1, 0, 1, 44, 32, }, ++ { 2, 1, 0, 1, 44, 30, }, ++ { 1, 1, 0, 1, 44, 30, }, ++ { 0, 1, 0, 1, 48, 32, }, ++ { 2, 1, 0, 1, 48, 30, }, ++ { 1, 1, 0, 1, 48, 30, }, ++ { 0, 1, 0, 1, 52, 32, }, ++ { 2, 1, 0, 1, 52, 30, }, ++ { 1, 1, 0, 1, 52, 30, }, ++ { 0, 1, 0, 1, 56, 32, }, ++ { 2, 1, 0, 1, 56, 30, }, ++ { 1, 1, 0, 1, 56, 30, }, ++ { 0, 1, 0, 1, 60, 32, }, ++ { 2, 1, 0, 1, 60, 30, }, ++ { 1, 1, 0, 1, 60, 30, }, ++ { 0, 1, 0, 1, 64, 32, }, ++ { 2, 1, 0, 1, 64, 30, }, ++ { 1, 1, 0, 1, 64, 30, }, ++ { 0, 1, 0, 1, 100, 32, }, ++ { 2, 1, 0, 1, 100, 30, }, ++ { 1, 1, 0, 1, 100, 30, }, ++ { 0, 1, 0, 1, 104, 32, }, ++ { 2, 1, 0, 1, 104, 30, }, ++ { 1, 1, 0, 1, 104, 30, }, ++ { 0, 1, 0, 1, 108, 32, }, ++ { 2, 1, 0, 1, 108, 30, }, ++ { 1, 1, 0, 1, 108, 30, }, ++ { 0, 1, 0, 1, 112, 32, }, ++ { 2, 1, 0, 1, 112, 30, }, ++ { 1, 1, 0, 1, 112, 30, }, ++ { 0, 1, 0, 1, 116, 32, }, ++ { 2, 1, 0, 1, 116, 30, }, ++ { 1, 1, 0, 1, 116, 30, }, ++ { 0, 1, 0, 1, 120, 32, }, ++ { 2, 1, 0, 1, 120, 30, }, ++ { 1, 1, 0, 1, 120, 30, }, ++ { 0, 1, 0, 1, 124, 32, }, ++ { 2, 1, 0, 1, 124, 30, }, ++ { 1, 1, 0, 1, 124, 30, }, ++ { 0, 1, 0, 1, 128, 32, }, ++ { 2, 1, 0, 1, 128, 30, }, ++ { 1, 1, 0, 1, 128, 30, }, ++ { 0, 1, 0, 1, 132, 32, }, ++ { 2, 1, 0, 1, 132, 30, }, ++ { 1, 1, 0, 1, 132, 30, }, ++ { 0, 1, 0, 1, 136, 32, }, ++ { 2, 1, 0, 1, 136, 30, }, ++ { 1, 1, 0, 1, 136, 30, }, ++ { 0, 1, 0, 1, 140, 32, }, ++ { 2, 1, 0, 1, 140, 30, }, ++ { 1, 1, 0, 1, 140, 30, }, ++ { 0, 1, 0, 1, 149, 32, }, ++ { 2, 1, 0, 1, 149, 30, }, ++ { 1, 1, 0, 1, 149, 63, }, ++ { 0, 1, 0, 1, 153, 32, }, ++ { 2, 1, 0, 1, 153, 30, }, ++ { 1, 1, 0, 1, 153, 63, }, ++ { 0, 1, 0, 1, 157, 32, }, ++ { 2, 1, 0, 1, 157, 30, }, ++ { 1, 1, 0, 1, 157, 63, }, ++ { 0, 1, 0, 1, 161, 32, }, ++ { 2, 1, 0, 1, 161, 30, }, ++ { 1, 1, 0, 1, 161, 63, }, ++ { 0, 1, 0, 1, 165, 32, }, ++ { 2, 1, 0, 1, 165, 30, }, ++ { 1, 1, 0, 1, 165, 63, }, ++ { 0, 1, 0, 2, 36, 32, }, ++ { 2, 1, 0, 2, 36, 30, }, ++ { 1, 1, 0, 2, 36, 30, }, ++ { 0, 1, 0, 2, 40, 32, }, ++ { 2, 1, 0, 2, 40, 30, }, ++ { 1, 1, 0, 2, 40, 30, }, ++ { 0, 1, 0, 2, 44, 32, }, ++ { 2, 1, 0, 2, 44, 30, }, ++ { 1, 1, 0, 2, 44, 30, }, ++ { 0, 1, 0, 2, 48, 32, }, ++ { 2, 1, 0, 2, 48, 30, }, ++ { 1, 1, 0, 2, 48, 30, }, ++ { 0, 1, 0, 2, 52, 32, }, ++ { 2, 1, 0, 2, 52, 30, }, ++ { 1, 1, 0, 2, 52, 30, }, ++ { 0, 1, 0, 2, 56, 32, }, ++ { 2, 1, 0, 2, 56, 30, }, ++ { 1, 1, 0, 2, 56, 30, }, ++ { 0, 1, 0, 2, 60, 32, }, ++ { 2, 1, 0, 2, 60, 30, }, ++ { 1, 1, 0, 2, 60, 30, }, ++ { 0, 1, 0, 2, 64, 32, }, ++ { 2, 1, 0, 2, 64, 30, }, ++ { 1, 1, 0, 2, 64, 30, }, ++ { 0, 1, 0, 2, 100, 32, }, ++ { 2, 1, 0, 2, 100, 30, }, ++ { 1, 1, 0, 2, 100, 30, }, ++ { 0, 1, 0, 2, 104, 32, }, ++ { 2, 1, 0, 2, 104, 30, }, ++ { 1, 1, 0, 2, 104, 30, }, ++ { 0, 1, 0, 2, 108, 32, }, ++ { 2, 1, 0, 2, 108, 30, }, ++ { 1, 1, 0, 2, 108, 30, }, ++ { 0, 1, 0, 2, 112, 32, }, ++ { 2, 1, 0, 2, 112, 30, }, ++ { 1, 1, 0, 2, 112, 30, }, ++ { 0, 1, 0, 2, 116, 32, }, ++ { 2, 1, 0, 2, 116, 30, }, ++ { 1, 1, 0, 2, 116, 30, }, ++ { 0, 1, 0, 2, 120, 32, }, ++ { 2, 1, 0, 2, 120, 30, }, ++ { 1, 1, 0, 2, 120, 30, }, ++ { 0, 1, 0, 2, 124, 32, }, ++ { 2, 1, 0, 2, 124, 30, }, ++ { 1, 1, 0, 2, 124, 30, }, ++ { 0, 1, 0, 2, 128, 32, }, ++ { 2, 1, 0, 2, 128, 30, }, ++ { 1, 1, 0, 2, 128, 30, }, ++ { 0, 1, 0, 2, 132, 32, }, ++ { 2, 1, 0, 2, 132, 30, }, ++ { 1, 1, 0, 2, 132, 30, }, ++ { 0, 1, 0, 2, 136, 32, }, ++ { 2, 1, 0, 2, 136, 30, }, ++ { 1, 1, 0, 2, 136, 30, }, ++ { 0, 1, 0, 2, 140, 32, }, ++ { 2, 1, 0, 2, 140, 30, }, ++ { 1, 1, 0, 2, 140, 30, }, ++ { 0, 1, 0, 2, 149, 32, }, ++ { 2, 1, 0, 2, 149, 30, }, ++ { 1, 1, 0, 2, 149, 63, }, ++ { 0, 1, 0, 2, 153, 32, }, ++ { 2, 1, 0, 2, 153, 30, }, ++ { 1, 1, 0, 2, 153, 63, }, ++ { 0, 1, 0, 2, 157, 32, }, ++ { 2, 1, 0, 2, 157, 30, }, ++ { 1, 1, 0, 2, 157, 63, }, ++ { 0, 1, 0, 2, 161, 32, }, ++ { 2, 1, 0, 2, 161, 30, }, ++ { 1, 1, 0, 2, 161, 63, }, ++ { 0, 1, 0, 2, 165, 32, }, ++ { 2, 1, 0, 2, 165, 30, }, ++ { 1, 1, 0, 2, 165, 63, }, ++ { 0, 1, 0, 3, 36, 28, }, ++ { 2, 1, 0, 3, 36, 30, }, ++ { 1, 1, 0, 3, 36, 30, }, ++ { 0, 1, 0, 3, 40, 28, }, ++ { 2, 1, 0, 3, 40, 30, }, ++ { 1, 1, 0, 3, 40, 30, }, ++ { 0, 1, 0, 3, 44, 28, }, ++ { 2, 1, 0, 3, 44, 30, }, ++ { 1, 1, 0, 3, 44, 30, }, ++ { 0, 1, 0, 3, 48, 28, }, ++ { 2, 1, 0, 3, 48, 30, }, ++ { 1, 1, 0, 3, 48, 30, }, ++ { 0, 1, 0, 3, 52, 34, }, ++ { 2, 1, 0, 3, 52, 30, }, ++ { 1, 1, 0, 3, 52, 30, }, ++ { 0, 1, 0, 3, 56, 32, }, ++ { 2, 1, 0, 3, 56, 30, }, ++ { 1, 1, 0, 3, 56, 30, }, ++ { 0, 1, 0, 3, 60, 30, }, ++ { 2, 1, 0, 3, 60, 30, }, ++ { 1, 1, 0, 3, 60, 30, }, ++ { 0, 1, 0, 3, 64, 26, }, ++ { 2, 1, 0, 3, 64, 30, }, ++ { 1, 1, 0, 3, 64, 30, }, ++ { 0, 1, 0, 3, 100, 28, }, ++ { 2, 1, 0, 3, 100, 30, }, ++ { 1, 1, 0, 3, 100, 30, }, ++ { 0, 1, 0, 3, 104, 28, }, ++ { 2, 1, 0, 3, 104, 30, }, ++ { 1, 1, 0, 3, 104, 30, }, ++ { 0, 1, 0, 3, 108, 30, }, ++ { 2, 1, 0, 3, 108, 30, }, ++ { 1, 1, 0, 3, 108, 30, }, ++ { 0, 1, 0, 3, 112, 32, }, ++ { 2, 1, 0, 3, 112, 30, }, ++ { 1, 1, 0, 3, 112, 30, }, ++ { 0, 1, 0, 3, 116, 32, }, ++ { 2, 1, 0, 3, 116, 30, }, ++ { 1, 1, 0, 3, 116, 30, }, ++ { 0, 1, 0, 3, 120, 34, }, ++ { 2, 1, 0, 3, 120, 30, }, ++ { 1, 1, 0, 3, 120, 30, }, ++ { 0, 1, 0, 3, 124, 32, }, ++ { 2, 1, 0, 3, 124, 30, }, ++ { 1, 1, 0, 3, 124, 30, }, ++ { 0, 1, 0, 3, 128, 30, }, ++ { 2, 1, 0, 3, 128, 30, }, ++ { 1, 1, 0, 3, 128, 30, }, ++ { 0, 1, 0, 3, 132, 28, }, ++ { 2, 1, 0, 3, 132, 30, }, ++ { 1, 1, 0, 3, 132, 30, }, ++ { 0, 1, 0, 3, 136, 28, }, ++ { 2, 1, 0, 3, 136, 30, }, ++ { 1, 1, 0, 3, 136, 30, }, ++ { 0, 1, 0, 3, 140, 26, }, ++ { 2, 1, 0, 3, 140, 30, }, ++ { 1, 1, 0, 3, 140, 30, }, ++ { 0, 1, 0, 3, 149, 34, }, ++ { 2, 1, 0, 3, 149, 30, }, ++ { 1, 1, 0, 3, 149, 63, }, ++ { 0, 1, 0, 3, 153, 34, }, ++ { 2, 1, 0, 3, 153, 30, }, ++ { 1, 1, 0, 3, 153, 63, }, ++ { 0, 1, 0, 3, 157, 34, }, ++ { 2, 1, 0, 3, 157, 30, }, ++ { 1, 1, 0, 3, 157, 63, }, ++ { 0, 1, 0, 3, 161, 34, }, ++ { 2, 1, 0, 3, 161, 30, }, ++ { 1, 1, 0, 3, 161, 63, }, ++ { 0, 1, 0, 3, 165, 34, }, ++ { 2, 1, 0, 3, 165, 30, }, ++ { 1, 1, 0, 3, 165, 63, }, ++ { 0, 1, 1, 2, 38, 26, }, ++ { 2, 1, 1, 2, 38, 30, }, ++ { 1, 1, 1, 2, 38, 30, }, ++ { 0, 1, 1, 2, 46, 32, }, ++ { 2, 1, 1, 2, 46, 30, }, ++ { 1, 1, 1, 2, 46, 30, }, ++ { 0, 1, 1, 2, 54, 32, }, ++ { 2, 1, 1, 2, 54, 30, }, ++ { 1, 1, 1, 2, 54, 30, }, ++ { 0, 1, 1, 2, 62, 24, }, ++ { 2, 1, 1, 2, 62, 30, }, ++ { 1, 1, 1, 2, 62, 30, }, ++ { 0, 1, 1, 2, 102, 24, }, ++ { 2, 1, 1, 2, 102, 30, }, ++ { 1, 1, 1, 2, 102, 30, }, ++ { 0, 1, 1, 2, 110, 32, }, ++ { 2, 1, 1, 2, 110, 30, }, ++ { 1, 1, 1, 2, 110, 30, }, ++ { 0, 1, 1, 2, 118, 32, }, ++ { 2, 1, 1, 2, 118, 30, }, ++ { 1, 1, 1, 2, 118, 30, }, ++ { 0, 1, 1, 2, 126, 32, }, ++ { 2, 1, 1, 2, 126, 30, }, ++ { 1, 1, 1, 2, 126, 30, }, ++ { 0, 1, 1, 2, 134, 32, }, ++ { 2, 1, 1, 2, 134, 30, }, ++ { 1, 1, 1, 2, 134, 30, }, ++ { 0, 1, 1, 2, 151, 30, }, ++ { 2, 1, 1, 2, 151, 30, }, ++ { 1, 1, 1, 2, 151, 63, }, ++ { 0, 1, 1, 2, 159, 32, }, ++ { 2, 1, 1, 2, 159, 30, }, ++ { 1, 1, 1, 2, 159, 63, }, ++ { 0, 1, 1, 3, 38, 28, }, ++ { 2, 1, 1, 3, 38, 30, }, ++ { 1, 1, 1, 3, 38, 30, }, ++ { 0, 1, 1, 3, 46, 28, }, ++ { 2, 1, 1, 3, 46, 30, }, ++ { 1, 1, 1, 3, 46, 30, }, ++ { 0, 1, 1, 3, 54, 30, }, ++ { 2, 1, 1, 3, 54, 30, }, ++ { 1, 1, 1, 3, 54, 30, }, ++ { 0, 1, 1, 3, 62, 30, }, ++ { 2, 1, 1, 3, 62, 30, }, ++ { 1, 1, 1, 3, 62, 30, }, ++ { 0, 1, 1, 3, 102, 26, }, ++ { 2, 1, 1, 3, 102, 30, }, ++ { 1, 1, 1, 3, 102, 30, }, ++ { 0, 1, 1, 3, 110, 30, }, ++ { 2, 1, 1, 3, 110, 30, }, ++ { 1, 1, 1, 3, 110, 30, }, ++ { 0, 1, 1, 3, 118, 34, }, ++ { 2, 1, 1, 3, 118, 30, }, ++ { 1, 1, 1, 3, 118, 30, }, ++ { 0, 1, 1, 3, 126, 32, }, ++ { 2, 1, 1, 3, 126, 30, }, ++ { 1, 1, 1, 3, 126, 30, }, ++ { 0, 1, 1, 3, 134, 30, }, ++ { 2, 1, 1, 3, 134, 30, }, ++ { 1, 1, 1, 3, 134, 30, }, ++ { 0, 1, 1, 3, 151, 34, }, ++ { 2, 1, 1, 3, 151, 30, }, ++ { 1, 1, 1, 3, 151, 63, }, ++ { 0, 1, 1, 3, 159, 34, }, ++ { 2, 1, 1, 3, 159, 30, }, ++ { 1, 1, 1, 3, 159, 63, }, ++ { 0, 1, 2, 4, 42, 22, }, ++ { 2, 1, 2, 4, 42, 30, }, ++ { 1, 1, 2, 4, 42, 30, }, ++ { 0, 1, 2, 4, 58, 20, }, ++ { 2, 1, 2, 4, 58, 30, }, ++ { 1, 1, 2, 4, 58, 30, }, ++ { 0, 1, 2, 4, 106, 20, }, ++ { 2, 1, 2, 4, 106, 30, }, ++ { 1, 1, 2, 4, 106, 30, }, ++ { 0, 1, 2, 4, 122, 20, }, ++ { 2, 1, 2, 4, 122, 30, }, ++ { 1, 1, 2, 4, 122, 30, }, ++ { 0, 1, 2, 4, 155, 28, }, ++ { 2, 1, 2, 4, 155, 30, }, ++ { 1, 1, 2, 4, 155, 63, }, ++ { 0, 1, 2, 5, 42, 28, }, ++ { 2, 1, 2, 5, 42, 30, }, ++ { 1, 1, 2, 5, 42, 30, }, ++ { 0, 1, 2, 5, 58, 26, }, ++ { 2, 1, 2, 5, 58, 30, }, ++ { 1, 1, 2, 5, 58, 30, }, ++ { 0, 1, 2, 5, 106, 28, }, ++ { 2, 1, 2, 5, 106, 30, }, ++ { 1, 1, 2, 5, 106, 30, }, ++ { 0, 1, 2, 5, 122, 32, }, ++ { 2, 1, 2, 5, 122, 30, }, ++ { 1, 1, 2, 5, 122, 30, }, ++ { 0, 1, 2, 5, 155, 34, }, ++ { 2, 1, 2, 5, 155, 30, }, ++ { 1, 1, 2, 5, 155, 63, }, ++}; ++ ++RTW_DECL_TABLE_TXPWR_LMT(rtw8821a_txpwr_lmt); ++ ++static const struct rtw_pwr_seq_cmd trans_carddis_to_cardemu_8821a[] = { ++ {0x0005, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(3) | BIT(7), 0}, ++ {0x0086, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_SDIO_MSK, ++ RTW_PWR_ADDR_SDIO, ++ RTW_PWR_CMD_WRITE, BIT(0), 0}, ++ {0x0086, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_SDIO_MSK, ++ RTW_PWR_ADDR_SDIO, ++ RTW_PWR_CMD_POLLING, BIT(1), BIT(1)}, ++ {0x004A, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_USB_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(0), 0}, ++ {0x0005, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(3) | BIT(4), 0}, ++ {0x0023, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_SDIO_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(4), 0}, ++ {0x0301, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_PCI_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0xFF, 0}, ++ {0xFFFF, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ 0, ++ RTW_PWR_CMD_END, 0, 0}, ++}; ++ ++static const struct rtw_pwr_seq_cmd trans_cardemu_to_act_8821a[] = { ++ {0x0020, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_USB_MSK | RTW_PWR_INTF_SDIO_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(0), BIT(0)}, ++ {0x0067, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_USB_MSK | RTW_PWR_INTF_SDIO_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(4), 0}, ++ {0x0001, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_USB_MSK | RTW_PWR_INTF_SDIO_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_DELAY, 1, RTW_PWR_DELAY_MS}, ++ {0x0000, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_USB_MSK | RTW_PWR_INTF_SDIO_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(5), 0}, ++ {0x0005, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(4) | BIT(3) | BIT(2), 0}, ++ {0x0075, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_PCI_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(0), BIT(0)}, ++ {0x0006, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_POLLING, BIT(1), BIT(1)}, ++ {0x0075, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_PCI_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(0), 0}, ++ {0x0006, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(0), BIT(0)}, ++ {0x0005, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(7), 0}, ++ {0x0005, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(4) | BIT(3), 0}, ++ {0x0005, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(0), BIT(0)}, ++ {0x0005, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_POLLING, BIT(0), 0}, ++ {0x004F, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(0), BIT(0)}, ++ {0x0067, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(5) | BIT(4), BIT(5) | BIT(4)}, ++ {0x0025, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(6), 0}, ++ {0x0049, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(1), BIT(1)}, ++ {0x0063, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(1), BIT(1)}, ++ {0x0062, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(1), 0}, ++ {0x0058, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(0), BIT(0)}, ++ {0x005A, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(1), BIT(1)}, ++ {0x002E, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0xFF, 0x82}, ++ {0x0010, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(6), BIT(6)}, ++ {0xFFFF, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ 0, ++ RTW_PWR_CMD_END, 0, 0}, ++}; ++ ++static const struct rtw_pwr_seq_cmd trans_act_to_lps_8821a[] = { ++ {0x0301, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_PCI_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0xFF, 0xFF}, ++ {0x0522, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0xFF, 0xFF}, ++ {0x05F8, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_POLLING, 0xFF, 0}, ++ {0x05F9, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_POLLING, 0xFF, 0}, ++ {0x05FA, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_POLLING, 0xFF, 0}, ++ {0x05FB, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_POLLING, 0xFF, 0}, ++ {0x0002, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(0), 0}, ++ {0x0002, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_DELAY, 0, RTW_PWR_DELAY_US}, ++ {0x0002, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(1), 0}, ++ {0x0100, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0xFF, 0x03}, ++ {0x0101, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(1), 0}, ++ {0x0093, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_SDIO_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0xFF, 0x00}, ++ {0x0553, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(5), BIT(5)}, ++ {0xFFFF, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ 0, ++ RTW_PWR_CMD_END, 0, 0}, ++}; ++ ++static const struct rtw_pwr_seq_cmd trans_act_to_cardemu_8821a[] = { ++ {0x001F, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0xFF, 0}, ++ {0x004F, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(0), 0}, ++ {0x0049, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(1), 0}, ++ {0x0006, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_USB_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(0), BIT(0)}, ++ {0x0005, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(1), BIT(1)}, ++ {0x0005, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_POLLING, BIT(1), 0}, ++ {0x0000, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_USB_MSK | RTW_PWR_INTF_SDIO_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(5), BIT(5)}, ++ {0x0020, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_USB_MSK | RTW_PWR_INTF_SDIO_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(0), 0}, ++ {0xFFFF, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ 0, ++ RTW_PWR_CMD_END, 0, 0}, ++}; ++ ++static const struct rtw_pwr_seq_cmd trans_cardemu_to_carddis_8821a[] = { ++ {0x0007, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_SDIO_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, 0xFF, 0x20}, ++ {0x0005, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_USB_MSK | RTW_PWR_INTF_SDIO_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(3) | BIT(4), BIT(3)}, ++ {0x0005, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_PCI_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(2), BIT(2)}, ++ {0x004A, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_USB_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(0), 1}, ++ {0x0023, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_SDIO_MSK, ++ RTW_PWR_ADDR_MAC, ++ RTW_PWR_CMD_WRITE, BIT(4), BIT(4)}, ++ {0x0086, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_SDIO_MSK, ++ RTW_PWR_ADDR_SDIO, ++ RTW_PWR_CMD_WRITE, BIT(0), BIT(0)}, ++ {0x0086, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_SDIO_MSK, ++ RTW_PWR_ADDR_SDIO, ++ RTW_PWR_CMD_POLLING, BIT(1), 0}, ++ {0xFFFF, ++ RTW_PWR_CUT_ALL_MSK, ++ RTW_PWR_INTF_ALL_MSK, ++ 0, ++ RTW_PWR_CMD_END, 0, 0}, ++}; ++ ++const struct rtw_pwr_seq_cmd * const card_enable_flow_8821a[] = { ++ trans_carddis_to_cardemu_8821a, ++ trans_cardemu_to_act_8821a, ++ NULL ++}; ++ ++const struct rtw_pwr_seq_cmd * const enter_lps_flow_8821a[] = { ++ trans_act_to_lps_8821a, ++ NULL ++}; ++ ++const struct rtw_pwr_seq_cmd * const card_disable_flow_8821a[] = { ++ trans_act_to_cardemu_8821a, ++ trans_cardemu_to_carddis_8821a, ++ NULL ++}; ++ ++static const u8 rtw8821a_pwrtrk_5gb_n[][RTW_PWR_TRK_TBL_SZ] = { ++ {0, 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, ++ 15, 16, 16, 16, 16, 16, 16, 16, 16}, ++ {0, 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, ++ 15, 16, 16, 16, 16, 16, 16, 16, 16}, ++ {0, 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, ++ 15, 16, 16, 16, 16, 16, 16, 16, 16}, ++}; ++ ++static const u8 rtw8821a_pwrtrk_5gb_p[][RTW_PWR_TRK_TBL_SZ] = { ++ {0, 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, ++ 15, 16, 16, 16, 16, 16, 16, 16, 16}, ++ {0, 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, ++ 15, 16, 16, 16, 16, 16, 16, 16, 16}, ++ {0, 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, ++ 15, 16, 16, 16, 16, 16, 16, 16, 16}, ++}; ++ ++static const u8 rtw8821a_pwrtrk_5ga_n[][RTW_PWR_TRK_TBL_SZ] = { ++ {0, 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, ++ 15, 16, 16, 16, 16, 16, 16, 16, 16}, ++ {0, 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, ++ 15, 16, 16, 16, 16, 16, 16, 16, 16}, ++ {0, 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, ++ 15, 16, 16, 16, 16, 16, 16, 16, 16}, ++}; ++ ++static const u8 rtw8821a_pwrtrk_5ga_p[][RTW_PWR_TRK_TBL_SZ] = { ++ {0, 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, ++ 15, 16, 16, 16, 16, 16, 16, 16, 16}, ++ {0, 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, ++ 15, 16, 16, 16, 16, 16, 16, 16, 16}, ++ {0, 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, ++ 15, 16, 16, 16, 16, 16, 16, 16, 16}, ++}; ++ ++static const u8 rtw8821a_pwrtrk_2gb_n[] = { ++ 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, ++ 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10 ++}; ++ ++static const u8 rtw8821a_pwrtrk_2gb_p[] = { ++ 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, ++ 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, 12, 12 ++}; ++ ++static const u8 rtw8821a_pwrtrk_2ga_n[] = { ++ 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, ++ 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10 ++}; ++ ++static const u8 rtw8821a_pwrtrk_2ga_p[] = { ++ 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, ++ 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, 12, 12 ++}; ++ ++static const u8 rtw8821a_pwrtrk_2g_cck_b_n[] = { ++ 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, ++ 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10 ++}; ++ ++static const u8 rtw8821a_pwrtrk_2g_cck_b_p[] = { ++ 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, ++ 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, 12, 12 ++}; ++ ++static const u8 rtw8821a_pwrtrk_2g_cck_a_n[] = { ++ 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, ++ 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10 ++}; ++ ++static const u8 rtw8821a_pwrtrk_2g_cck_a_p[] = { ++ 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, ++ 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, 12, 12 ++}; ++ ++const struct rtw_pwr_track_tbl rtw8821a_rtw_pwr_track_tbl = { ++ .pwrtrk_5gb_n[0] = rtw8821a_pwrtrk_5gb_n[0], ++ .pwrtrk_5gb_n[1] = rtw8821a_pwrtrk_5gb_n[1], ++ .pwrtrk_5gb_n[2] = rtw8821a_pwrtrk_5gb_n[2], ++ .pwrtrk_5gb_p[0] = rtw8821a_pwrtrk_5gb_p[0], ++ .pwrtrk_5gb_p[1] = rtw8821a_pwrtrk_5gb_p[1], ++ .pwrtrk_5gb_p[2] = rtw8821a_pwrtrk_5gb_p[2], ++ .pwrtrk_5ga_n[0] = rtw8821a_pwrtrk_5ga_n[0], ++ .pwrtrk_5ga_n[1] = rtw8821a_pwrtrk_5ga_n[1], ++ .pwrtrk_5ga_n[2] = rtw8821a_pwrtrk_5ga_n[2], ++ .pwrtrk_5ga_p[0] = rtw8821a_pwrtrk_5ga_p[0], ++ .pwrtrk_5ga_p[1] = rtw8821a_pwrtrk_5ga_p[1], ++ .pwrtrk_5ga_p[2] = rtw8821a_pwrtrk_5ga_p[2], ++ .pwrtrk_2gb_n = rtw8821a_pwrtrk_2gb_n, ++ .pwrtrk_2gb_p = rtw8821a_pwrtrk_2gb_p, ++ .pwrtrk_2ga_n = rtw8821a_pwrtrk_2ga_n, ++ .pwrtrk_2ga_p = rtw8821a_pwrtrk_2ga_p, ++ .pwrtrk_2g_cckb_n = rtw8821a_pwrtrk_2g_cck_b_n, ++ .pwrtrk_2g_cckb_p = rtw8821a_pwrtrk_2g_cck_b_p, ++ .pwrtrk_2g_ccka_n = rtw8821a_pwrtrk_2g_cck_a_n, ++ .pwrtrk_2g_ccka_p = rtw8821a_pwrtrk_2g_cck_a_p, ++}; +--- /dev/null ++++ b/drivers/net/wireless/realtek/rtw88/rtw8821a_table.h +@@ -0,0 +1,21 @@ ++/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ ++/* Copyright(c) 2024 Realtek Corporation ++ */ ++ ++#ifndef __RTW8821A_TABLE_H__ ++#define __RTW8821A_TABLE_H__ ++ ++extern const struct rtw_table rtw8821a_mac_tbl; ++extern const struct rtw_table rtw8821a_agc_tbl; ++extern const struct rtw_table rtw8821a_bb_tbl; ++extern const struct rtw_table rtw8821a_bb_pg_tbl; ++extern const struct rtw_table rtw8821a_rf_a_tbl; ++extern const struct rtw_table rtw8821a_txpwr_lmt_tbl; ++ ++extern const struct rtw_pwr_seq_cmd * const card_enable_flow_8821a[]; ++extern const struct rtw_pwr_seq_cmd * const enter_lps_flow_8821a[]; ++extern const struct rtw_pwr_seq_cmd * const card_disable_flow_8821a[]; ++ ++extern const struct rtw_pwr_track_tbl rtw8821a_rtw_pwr_track_tbl; ++ ++#endif diff --git a/package/kernel/mac80211/patches/rtl/041-v6.13-wifi-rtw88-Add-rtw88xxa.-c-h.patch b/package/kernel/mac80211/patches/rtl/041-v6.13-wifi-rtw88-Add-rtw88xxa.-c-h.patch new file mode 100644 index 00000000000000..79e1deebf795ac --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/041-v6.13-wifi-rtw88-Add-rtw88xxa.-c-h.patch @@ -0,0 +1,2187 @@ +From b870b9d31c9e4e6b20c410e1e017f8c87d4c2ae0 Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Wed, 30 Oct 2024 20:27:39 +0200 +Subject: [PATCH] wifi: rtw88: Add rtw88xxa.{c,h} + +These contain code shared by both RTL8821AU and RTL8812AU chips. + +Signed-off-by: Bitterblue Smith +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/b8590382-a954-412d-a96b-63e360b97acc@gmail.com +--- + drivers/net/wireless/realtek/rtw88/rtw88xxa.c | 1989 +++++++++++++++++ + drivers/net/wireless/realtek/rtw88/rtw88xxa.h | 175 ++ + 2 files changed, 2164 insertions(+) + create mode 100644 drivers/net/wireless/realtek/rtw88/rtw88xxa.c + create mode 100644 drivers/net/wireless/realtek/rtw88/rtw88xxa.h + +--- /dev/null ++++ b/drivers/net/wireless/realtek/rtw88/rtw88xxa.c +@@ -0,0 +1,1989 @@ ++// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause ++/* Copyright(c) 2024 Realtek Corporation ++ */ ++ ++#include ++#include "main.h" ++#include "coex.h" ++#include "phy.h" ++#include "rtw88xxa.h" ++#include "mac.h" ++#include "reg.h" ++#include "sec.h" ++#include "debug.h" ++#include "bf.h" ++#include "efuse.h" ++#include "usb.h" ++ ++void rtw88xxa_efuse_grant(struct rtw_dev *rtwdev, bool on) ++{ ++ if (on) { ++ rtw_write8(rtwdev, REG_EFUSE_ACCESS, EFUSE_ACCESS_ON); ++ ++ rtw_write16_set(rtwdev, REG_SYS_FUNC_EN, BIT_FEN_ELDR); ++ rtw_write16_set(rtwdev, REG_SYS_CLKR, ++ BIT_LOADER_CLK_EN | BIT_ANA8M); ++ } else { ++ rtw_write8(rtwdev, REG_EFUSE_ACCESS, EFUSE_ACCESS_OFF); ++ } ++} ++EXPORT_SYMBOL(rtw88xxa_efuse_grant); ++ ++static void rtw8812a_read_amplifier_type(struct rtw_dev *rtwdev) ++{ ++ struct rtw_efuse *efuse = &rtwdev->efuse; ++ ++ efuse->ext_pa_2g = (efuse->pa_type_2g & BIT(5)) && ++ (efuse->pa_type_2g & BIT(4)); ++ efuse->ext_lna_2g = (efuse->lna_type_2g & BIT(7)) && ++ (efuse->lna_type_2g & BIT(3)); ++ ++ efuse->ext_pa_5g = (efuse->pa_type_5g & BIT(1)) && ++ (efuse->pa_type_5g & BIT(0)); ++ efuse->ext_lna_5g = (efuse->lna_type_5g & BIT(7)) && ++ (efuse->lna_type_5g & BIT(3)); ++ ++ /* For rtw_phy_cond2: */ ++ if (efuse->ext_pa_2g) { ++ u8 ext_type_pa_2g_a = u8_get_bits(efuse->lna_type_2g, BIT(2)); ++ u8 ext_type_pa_2g_b = u8_get_bits(efuse->lna_type_2g, BIT(6)); ++ ++ efuse->gpa_type = (ext_type_pa_2g_b << 2) | ext_type_pa_2g_a; ++ } ++ ++ if (efuse->ext_pa_5g) { ++ u8 ext_type_pa_5g_a = u8_get_bits(efuse->lna_type_5g, BIT(2)); ++ u8 ext_type_pa_5g_b = u8_get_bits(efuse->lna_type_5g, BIT(6)); ++ ++ efuse->apa_type = (ext_type_pa_5g_b << 2) | ext_type_pa_5g_a; ++ } ++ ++ if (efuse->ext_lna_2g) { ++ u8 ext_type_lna_2g_a = u8_get_bits(efuse->lna_type_2g, ++ BIT(1) | BIT(0)); ++ u8 ext_type_lna_2g_b = u8_get_bits(efuse->lna_type_2g, ++ BIT(5) | BIT(4)); ++ ++ efuse->glna_type = (ext_type_lna_2g_b << 2) | ext_type_lna_2g_a; ++ } ++ ++ if (efuse->ext_lna_5g) { ++ u8 ext_type_lna_5g_a = u8_get_bits(efuse->lna_type_5g, ++ BIT(1) | BIT(0)); ++ u8 ext_type_lna_5g_b = u8_get_bits(efuse->lna_type_5g, ++ BIT(5) | BIT(4)); ++ ++ efuse->alna_type = (ext_type_lna_5g_b << 2) | ext_type_lna_5g_a; ++ } ++} ++ ++static void rtw8812a_read_rfe_type(struct rtw_dev *rtwdev, ++ struct rtw88xxa_efuse *map) ++{ ++ struct rtw_efuse *efuse = &rtwdev->efuse; ++ ++ if (map->rfe_option == 0xff) { ++ if (rtwdev->hci.type == RTW_HCI_TYPE_USB) ++ efuse->rfe_option = 0; ++ else if (rtwdev->hci.type == RTW_HCI_TYPE_PCIE) ++ efuse->rfe_option = 2; ++ else ++ efuse->rfe_option = 4; ++ } else if (map->rfe_option & BIT(7)) { ++ if (efuse->ext_lna_5g) { ++ if (efuse->ext_pa_5g) { ++ if (efuse->ext_lna_2g && efuse->ext_pa_2g) ++ efuse->rfe_option = 3; ++ else ++ efuse->rfe_option = 0; ++ } else { ++ efuse->rfe_option = 2; ++ } ++ } else { ++ efuse->rfe_option = 4; ++ } ++ } else { ++ efuse->rfe_option = map->rfe_option & 0x3f; ++ ++ /* Due to other customer already use incorrect EFUSE map for ++ * their product. We need to add workaround to prevent to ++ * modify spec and notify all customer to revise the IC 0xca ++ * content. ++ */ ++ if (efuse->rfe_option == 4 && ++ (efuse->ext_pa_5g || efuse->ext_pa_2g || ++ efuse->ext_lna_5g || efuse->ext_lna_2g)) { ++ if (rtwdev->hci.type == RTW_HCI_TYPE_USB) ++ efuse->rfe_option = 0; ++ else if (rtwdev->hci.type == RTW_HCI_TYPE_PCIE) ++ efuse->rfe_option = 2; ++ } ++ } ++} ++ ++static void rtw88xxa_read_usb_type(struct rtw_dev *rtwdev) ++{ ++ struct rtw_efuse *efuse = &rtwdev->efuse; ++ struct rtw_hal *hal = &rtwdev->hal; ++ u8 antenna = 0; ++ u8 wmode = 0; ++ u8 val8, i; ++ ++ efuse->hw_cap.bw = BIT(RTW_CHANNEL_WIDTH_20) | ++ BIT(RTW_CHANNEL_WIDTH_40) | ++ BIT(RTW_CHANNEL_WIDTH_80); ++ efuse->hw_cap.ptcl = EFUSE_HW_CAP_PTCL_VHT; ++ ++ if (rtwdev->chip->id == RTW_CHIP_TYPE_8821A) ++ efuse->hw_cap.nss = 1; ++ else ++ efuse->hw_cap.nss = 2; ++ ++ if (rtwdev->chip->id == RTW_CHIP_TYPE_8821A) ++ goto print_hw_cap; ++ ++ for (i = 0; i < 2; i++) { ++ rtw_read8_physical_efuse(rtwdev, 1019 - i, &val8); ++ ++ antenna = u8_get_bits(val8, GENMASK(7, 5)); ++ if (antenna) ++ break; ++ antenna = u8_get_bits(val8, GENMASK(3, 1)); ++ if (antenna) ++ break; ++ } ++ ++ for (i = 0; i < 2; i++) { ++ rtw_read8_physical_efuse(rtwdev, 1021 - i, &val8); ++ ++ wmode = u8_get_bits(val8, GENMASK(3, 2)); ++ if (wmode) ++ break; ++ } ++ ++ if (antenna == 1) { ++ rtw_info(rtwdev, "This RTL8812AU says it is 1T1R.\n"); ++ ++ efuse->hw_cap.nss = 1; ++ hal->rf_type = RF_1T1R; ++ hal->rf_path_num = 1; ++ hal->rf_phy_num = 1; ++ hal->antenna_tx = BB_PATH_A; ++ hal->antenna_rx = BB_PATH_A; ++ } else { ++ /* Override rtw_chip_parameter_setup(). It detects 8812au as 1T1R. */ ++ efuse->hw_cap.nss = 2; ++ hal->rf_type = RF_2T2R; ++ hal->rf_path_num = 2; ++ hal->rf_phy_num = 2; ++ hal->antenna_tx = BB_PATH_AB; ++ hal->antenna_rx = BB_PATH_AB; ++ ++ if (antenna == 2 && wmode == 2) { ++ rtw_info(rtwdev, "This RTL8812AU says it can't do VHT.\n"); ++ ++ /* Can't be EFUSE_HW_CAP_IGNORE and can't be ++ * EFUSE_HW_CAP_PTCL_VHT, so make it 1. ++ */ ++ efuse->hw_cap.ptcl = 1; ++ efuse->hw_cap.bw &= ~BIT(RTW_CHANNEL_WIDTH_80); ++ } ++ } ++ ++print_hw_cap: ++ rtw_dbg(rtwdev, RTW_DBG_EFUSE, ++ "hw cap: hci=0x%02x, bw=0x%02x, ptcl=0x%02x, ant_num=%d, nss=%d\n", ++ efuse->hw_cap.hci, efuse->hw_cap.bw, efuse->hw_cap.ptcl, ++ efuse->hw_cap.ant_num, efuse->hw_cap.nss); ++} ++ ++int rtw88xxa_read_efuse(struct rtw_dev *rtwdev, u8 *log_map) ++{ ++ const struct rtw_chip_info *chip = rtwdev->chip; ++ struct rtw_efuse *efuse = &rtwdev->efuse; ++ struct rtw88xxa_efuse *map; ++ int i; ++ ++ if (chip->id == RTW_CHIP_TYPE_8812A) ++ rtwdev->hal.cut_version += 1; ++ ++ if (rtw_dbg_is_enabled(rtwdev, RTW_DBG_EFUSE)) ++ print_hex_dump(KERN_INFO, "", DUMP_PREFIX_OFFSET, 16, 1, ++ log_map, chip->log_efuse_size, true); ++ ++ map = (struct rtw88xxa_efuse *)log_map; ++ ++ efuse->rf_board_option = map->rf_board_option; ++ efuse->crystal_cap = map->xtal_k; ++ if (efuse->crystal_cap == 0xff) ++ efuse->crystal_cap = 0x20; ++ efuse->pa_type_2g = map->pa_type; ++ efuse->pa_type_5g = map->pa_type; ++ efuse->lna_type_2g = map->lna_type_2g; ++ efuse->lna_type_5g = map->lna_type_5g; ++ if (chip->id == RTW_CHIP_TYPE_8812A) { ++ rtw8812a_read_amplifier_type(rtwdev); ++ rtw8812a_read_rfe_type(rtwdev, map); ++ ++ efuse->usb_mode_switch = u8_get_bits(map->usb_mode, BIT(1)); ++ } ++ efuse->channel_plan = map->channel_plan; ++ efuse->country_code[0] = map->country_code[0]; ++ efuse->country_code[1] = map->country_code[1]; ++ efuse->bt_setting = map->rf_bt_setting; ++ efuse->regd = map->rf_board_option & 0x7; ++ efuse->thermal_meter[0] = map->thermal_meter; ++ efuse->thermal_meter[1] = map->thermal_meter; ++ efuse->thermal_meter_k = map->thermal_meter; ++ efuse->tx_bb_swing_setting_2g = map->tx_bb_swing_setting_2g; ++ efuse->tx_bb_swing_setting_5g = map->tx_bb_swing_setting_5g; ++ ++ rtw88xxa_read_usb_type(rtwdev); ++ ++ if (chip->id == RTW_CHIP_TYPE_8821A) ++ efuse->btcoex = rtw_read32_mask(rtwdev, REG_WL_BT_PWR_CTRL, ++ BIT_BT_FUNC_EN); ++ else ++ efuse->btcoex = (map->rf_board_option & 0xe0) == 0x20; ++ efuse->share_ant = !!(efuse->bt_setting & BIT(0)); ++ ++ /* No antenna diversity because it's disabled in the vendor driver */ ++ efuse->ant_div_cfg = 0; ++ ++ efuse->ant_div_type = map->rf_antenna_option; ++ if (efuse->ant_div_type == 0xff) ++ efuse->ant_div_type = 0x3; ++ ++ for (i = 0; i < 4; i++) ++ efuse->txpwr_idx_table[i] = map->txpwr_idx_table[i]; ++ ++ switch (rtw_hci_type(rtwdev)) { ++ case RTW_HCI_TYPE_USB: ++ if (chip->id == RTW_CHIP_TYPE_8821A) ++ ether_addr_copy(efuse->addr, map->rtw8821au.mac_addr); ++ else ++ ether_addr_copy(efuse->addr, map->rtw8812au.mac_addr); ++ break; ++ case RTW_HCI_TYPE_PCIE: ++ case RTW_HCI_TYPE_SDIO: ++ default: ++ /* unsupported now */ ++ return -EOPNOTSUPP; ++ } ++ ++ return 0; ++} ++EXPORT_SYMBOL(rtw88xxa_read_efuse); ++ ++static void rtw88xxa_reset_8051(struct rtw_dev *rtwdev) ++{ ++ const struct rtw_chip_info *chip = rtwdev->chip; ++ u8 val8; ++ ++ /* Reset MCU IO Wrapper */ ++ rtw_write8_clr(rtwdev, REG_RSV_CTRL, BIT(1)); ++ if (chip->id == RTW_CHIP_TYPE_8812A) ++ rtw_write8_clr(rtwdev, REG_RSV_CTRL + 1, BIT(3)); ++ else ++ rtw_write8_clr(rtwdev, REG_RSV_CTRL + 1, BIT(0)); ++ ++ val8 = rtw_read8(rtwdev, REG_SYS_FUNC_EN + 1); ++ rtw_write8(rtwdev, REG_SYS_FUNC_EN + 1, val8 & ~BIT(2)); ++ ++ /* Enable MCU IO Wrapper */ ++ rtw_write8_clr(rtwdev, REG_RSV_CTRL, BIT(1)); ++ if (chip->id == RTW_CHIP_TYPE_8812A) ++ rtw_write8_set(rtwdev, REG_RSV_CTRL + 1, BIT(3)); ++ else ++ rtw_write8_set(rtwdev, REG_RSV_CTRL + 1, BIT(0)); ++ ++ rtw_write8(rtwdev, REG_SYS_FUNC_EN + 1, val8 | BIT(2)); ++} ++ ++/* A lightweight deinit function */ ++static void rtw88xxau_hw_reset(struct rtw_dev *rtwdev) ++{ ++ u8 val8; ++ ++ if (!(rtw_read8(rtwdev, REG_MCUFW_CTRL) & BIT_RAM_DL_SEL)) ++ return; ++ ++ rtw88xxa_reset_8051(rtwdev); ++ rtw_write8(rtwdev, REG_MCUFW_CTRL, 0x00); ++ ++ /* before BB reset should do clock gated */ ++ rtw_write32_set(rtwdev, REG_FPGA0_XCD_RF_PARA, BIT(6)); ++ ++ /* reset BB */ ++ rtw_write8_clr(rtwdev, REG_SYS_FUNC_EN, BIT(0) | BIT(1)); ++ ++ /* reset RF */ ++ rtw_write8(rtwdev, REG_RF_CTRL, 0); ++ ++ /* reset TRX path */ ++ rtw_write16(rtwdev, REG_CR, 0); ++ ++ /* reset MAC, reg0x5[1], auto FSM off */ ++ rtw_write8_set(rtwdev, REG_APS_FSMCO + 1, APS_FSMCO_MAC_OFF >> 8); ++ ++ /* check if reg0x5[1] auto cleared */ ++ if (read_poll_timeout_atomic(rtw_read8, val8, ++ !(val8 & (APS_FSMCO_MAC_OFF >> 8)), ++ 1, 5000, false, ++ rtwdev, REG_APS_FSMCO + 1)) ++ rtw_err(rtwdev, "%s: timed out waiting for 0x5[1]\n", __func__); ++ ++ /* reg0x5[0], auto FSM on */ ++ val8 |= APS_FSMCO_MAC_ENABLE >> 8; ++ rtw_write8(rtwdev, REG_APS_FSMCO + 1, val8); ++ ++ rtw_write8_clr(rtwdev, REG_SYS_FUNC_EN + 1, BIT(4) | BIT(7)); ++ rtw_write8_set(rtwdev, REG_SYS_FUNC_EN + 1, BIT(4) | BIT(7)); ++} ++ ++static int rtw88xxau_init_power_on(struct rtw_dev *rtwdev) ++{ ++ const struct rtw_chip_info *chip = rtwdev->chip; ++ u16 val16; ++ int ret; ++ ++ ret = rtw_pwr_seq_parser(rtwdev, chip->pwr_on_seq); ++ if (ret) { ++ rtw_err(rtwdev, "power on flow failed\n"); ++ return ret; ++ } ++ ++ rtw_write16(rtwdev, REG_CR, 0); ++ val16 = BIT_HCI_TXDMA_EN | BIT_HCI_RXDMA_EN | BIT_TXDMA_EN | ++ BIT_RXDMA_EN | BIT_PROTOCOL_EN | BIT_SCHEDULE_EN | ++ BIT_MAC_SEC_EN | BIT_32K_CAL_TMR_EN; ++ rtw_write16_set(rtwdev, REG_CR, val16); ++ ++ if (chip->id == RTW_CHIP_TYPE_8821A) { ++ if (rtw_read8(rtwdev, REG_SYS_CFG1 + 3) & BIT(0)) ++ rtw_write8_set(rtwdev, REG_LDO_SWR_CTRL, BIT(6)); ++ } ++ ++ return ret; ++} ++ ++static int rtw88xxa_llt_write(struct rtw_dev *rtwdev, u32 address, u32 data) ++{ ++ u32 value = BIT_LLT_WRITE_ACCESS | (address << 8) | data; ++ int count = 0; ++ ++ rtw_write32(rtwdev, REG_LLT_INIT, value); ++ ++ do { ++ if (!rtw_read32_mask(rtwdev, REG_LLT_INIT, BIT(31) | BIT(30))) ++ break; ++ ++ if (count > 20) { ++ rtw_err(rtwdev, "Failed to poll write LLT done at %d!\n", ++ address); ++ return -EBUSY; ++ } ++ } while (++count); ++ ++ return 0; ++} ++ ++static int rtw88xxa_llt_init(struct rtw_dev *rtwdev, u32 boundary) ++{ ++ u32 last_entry = 255; ++ int status = 0; ++ u32 i; ++ ++ for (i = 0; i < boundary - 1; i++) { ++ status = rtw88xxa_llt_write(rtwdev, i, i + 1); ++ if (status) ++ return status; ++ } ++ ++ status = rtw88xxa_llt_write(rtwdev, boundary - 1, 0xFF); ++ if (status) ++ return status; ++ ++ for (i = boundary; i < last_entry; i++) { ++ status = rtw88xxa_llt_write(rtwdev, i, i + 1); ++ if (status) ++ return status; ++ } ++ ++ status = rtw88xxa_llt_write(rtwdev, last_entry, boundary); ++ ++ return status; ++} ++ ++static void rtw88xxau_init_queue_reserved_page(struct rtw_dev *rtwdev) ++{ ++ const struct rtw_chip_info *chip = rtwdev->chip; ++ struct rtw_fifo_conf *fifo = &rtwdev->fifo; ++ const struct rtw_page_table *pg_tbl = NULL; ++ u16 pubq_num; ++ u32 val32; ++ ++ switch (rtw_hci_type(rtwdev)) { ++ case RTW_HCI_TYPE_PCIE: ++ pg_tbl = &chip->page_table[1]; ++ break; ++ case RTW_HCI_TYPE_USB: ++ if (rtwdev->hci.bulkout_num == 2) ++ pg_tbl = &chip->page_table[2]; ++ else if (rtwdev->hci.bulkout_num == 3) ++ pg_tbl = &chip->page_table[3]; ++ else if (rtwdev->hci.bulkout_num == 4) ++ pg_tbl = &chip->page_table[4]; ++ break; ++ case RTW_HCI_TYPE_SDIO: ++ pg_tbl = &chip->page_table[0]; ++ break; ++ default: ++ break; ++ } ++ ++ pubq_num = fifo->acq_pg_num - pg_tbl->hq_num - pg_tbl->lq_num - ++ pg_tbl->nq_num - pg_tbl->exq_num - pg_tbl->gapq_num; ++ ++ val32 = BIT_RQPN_NE(pg_tbl->nq_num, pg_tbl->exq_num); ++ rtw_write32(rtwdev, REG_RQPN_NPQ, val32); ++ ++ val32 = BIT_RQPN_HLP(pg_tbl->hq_num, pg_tbl->lq_num, pubq_num); ++ rtw_write32(rtwdev, REG_RQPN, val32); ++} ++ ++static void rtw88xxau_init_tx_buffer_boundary(struct rtw_dev *rtwdev) ++{ ++ struct rtw_fifo_conf *fifo = &rtwdev->fifo; ++ ++ rtw_write8(rtwdev, REG_BCNQ_BDNY, fifo->rsvd_boundary); ++ rtw_write8(rtwdev, REG_MGQ_BDNY, fifo->rsvd_boundary); ++ rtw_write8(rtwdev, REG_WMAC_LBK_BF_HD, fifo->rsvd_boundary); ++ rtw_write8(rtwdev, REG_TRXFF_BNDY, fifo->rsvd_boundary); ++ rtw_write8(rtwdev, REG_DWBCN0_CTRL + 1, fifo->rsvd_boundary); ++} ++ ++static int rtw88xxau_init_queue_priority(struct rtw_dev *rtwdev) ++{ ++ const struct rtw_chip_info *chip = rtwdev->chip; ++ u8 bulkout_num = rtwdev->hci.bulkout_num; ++ const struct rtw_rqpn *rqpn = NULL; ++ u16 txdma_pq_map; ++ ++ switch (rtw_hci_type(rtwdev)) { ++ case RTW_HCI_TYPE_PCIE: ++ rqpn = &chip->rqpn_table[1]; ++ break; ++ case RTW_HCI_TYPE_USB: ++ if (bulkout_num == 2) ++ rqpn = &chip->rqpn_table[2]; ++ else if (bulkout_num == 3) ++ rqpn = &chip->rqpn_table[3]; ++ else if (bulkout_num == 4) ++ rqpn = &chip->rqpn_table[4]; ++ else ++ return -EINVAL; ++ break; ++ case RTW_HCI_TYPE_SDIO: ++ rqpn = &chip->rqpn_table[0]; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ rtwdev->fifo.rqpn = rqpn; ++ ++ txdma_pq_map = rtw_read16(rtwdev, REG_TXDMA_PQ_MAP) & 0x7; ++ txdma_pq_map |= BIT_TXDMA_HIQ_MAP(rqpn->dma_map_hi); ++ txdma_pq_map |= BIT_TXDMA_MGQ_MAP(rqpn->dma_map_mg); ++ txdma_pq_map |= BIT_TXDMA_BKQ_MAP(rqpn->dma_map_bk); ++ txdma_pq_map |= BIT_TXDMA_BEQ_MAP(rqpn->dma_map_be); ++ txdma_pq_map |= BIT_TXDMA_VIQ_MAP(rqpn->dma_map_vi); ++ txdma_pq_map |= BIT_TXDMA_VOQ_MAP(rqpn->dma_map_vo); ++ rtw_write16(rtwdev, REG_TXDMA_PQ_MAP, txdma_pq_map); ++ ++ /* Packet in Hi Queue Tx immediately (No constraint for ATIM Period). */ ++ if (rtw_hci_type(rtwdev) == RTW_HCI_TYPE_USB && bulkout_num == 4) ++ rtw_write8(rtwdev, REG_HIQ_NO_LMT_EN, 0xff); ++ ++ return 0; ++} ++ ++static void rtw88xxa_init_wmac_setting(struct rtw_dev *rtwdev) ++{ ++ rtw_write16(rtwdev, REG_RXFLTMAP0, 0xffff); ++ rtw_write16(rtwdev, REG_RXFLTMAP1, 0x0400); ++ rtw_write16(rtwdev, REG_RXFLTMAP2, 0xffff); ++ ++ rtw_write32(rtwdev, REG_MAR, 0xffffffff); ++ rtw_write32(rtwdev, REG_MAR + 4, 0xffffffff); ++} ++ ++static void rtw88xxa_init_adaptive_ctrl(struct rtw_dev *rtwdev) ++{ ++ rtw_write32_mask(rtwdev, REG_RRSR, 0xfffff, 0xffff1); ++ rtw_write16(rtwdev, REG_RETRY_LIMIT, 0x3030); ++} ++ ++static void rtw88xxa_init_edca(struct rtw_dev *rtwdev) ++{ ++ rtw_write16(rtwdev, REG_SPEC_SIFS, 0x100a); ++ rtw_write16(rtwdev, REG_MAC_SPEC_SIFS, 0x100a); ++ ++ rtw_write16(rtwdev, REG_SIFS, 0x100a); ++ rtw_write16(rtwdev, REG_SIFS + 2, 0x100a); ++ ++ rtw_write32(rtwdev, REG_EDCA_BE_PARAM, 0x005EA42B); ++ rtw_write32(rtwdev, REG_EDCA_BK_PARAM, 0x0000A44F); ++ rtw_write32(rtwdev, REG_EDCA_VI_PARAM, 0x005EA324); ++ rtw_write32(rtwdev, REG_EDCA_VO_PARAM, 0x002FA226); ++ ++ rtw_write8(rtwdev, REG_USTIME_TSF, 0x50); ++ rtw_write8(rtwdev, REG_USTIME_EDCA, 0x50); ++} ++ ++static void rtw88xxau_tx_aggregation(struct rtw_dev *rtwdev) ++{ ++ const struct rtw_chip_info *chip = rtwdev->chip; ++ ++ rtw_write32_mask(rtwdev, REG_DWBCN0_CTRL, 0xf0, ++ chip->usb_tx_agg_desc_num); ++ ++ if (chip->id == RTW_CHIP_TYPE_8821A) ++ rtw_write8(rtwdev, REG_DWBCN1_CTRL, ++ chip->usb_tx_agg_desc_num << 1); ++} ++ ++static void rtw88xxa_init_beacon_parameters(struct rtw_dev *rtwdev) ++{ ++ u16 val16; ++ ++ val16 = (BIT_DIS_TSF_UDT << 8) | BIT_DIS_TSF_UDT; ++ if (rtwdev->efuse.btcoex) ++ val16 |= BIT_EN_BCN_FUNCTION; ++ rtw_write16(rtwdev, REG_BCN_CTRL, val16); ++ ++ rtw_write32_mask(rtwdev, REG_TBTT_PROHIBIT, 0xfffff, WLAN_TBTT_TIME); ++ rtw_write8(rtwdev, REG_DRVERLYINT, 0x05); ++ rtw_write8(rtwdev, REG_BCNDMATIM, WLAN_BCN_DMA_TIME); ++ rtw_write16(rtwdev, REG_BCNTCFG, 0x4413); ++} ++ ++static void rtw88xxa_phy_bb_config(struct rtw_dev *rtwdev) ++{ ++ u8 val8, crystal_cap; ++ ++ /* power on BB/RF domain */ ++ val8 = rtw_read8(rtwdev, REG_SYS_FUNC_EN); ++ val8 |= BIT_FEN_USBA; ++ rtw_write8(rtwdev, REG_SYS_FUNC_EN, val8); ++ ++ /* toggle BB reset */ ++ val8 |= BIT_FEN_BB_RSTB | BIT_FEN_BB_GLB_RST; ++ rtw_write8(rtwdev, REG_SYS_FUNC_EN, val8); ++ ++ rtw_write8(rtwdev, REG_RF_CTRL, ++ BIT_RF_EN | BIT_RF_RSTB | BIT_RF_SDM_RSTB); ++ rtw_write8(rtwdev, REG_RF_B_CTRL, ++ BIT_RF_EN | BIT_RF_RSTB | BIT_RF_SDM_RSTB); ++ ++ rtw_load_table(rtwdev, rtwdev->chip->bb_tbl); ++ rtw_load_table(rtwdev, rtwdev->chip->agc_tbl); ++ ++ crystal_cap = rtwdev->efuse.crystal_cap & 0x3F; ++ if (rtwdev->chip->id == RTW_CHIP_TYPE_8812A) ++ rtw_write32_mask(rtwdev, REG_AFE_CTRL3, 0x7FF80000, ++ crystal_cap | (crystal_cap << 6)); ++ else ++ rtw_write32_mask(rtwdev, REG_AFE_CTRL3, 0x00FFF000, ++ crystal_cap | (crystal_cap << 6)); ++} ++ ++static void rtw88xxa_phy_rf_config(struct rtw_dev *rtwdev) ++{ ++ u8 rf_path; ++ ++ for (rf_path = 0; rf_path < rtwdev->hal.rf_path_num; rf_path++) ++ rtw_load_table(rtwdev, rtwdev->chip->rf_tbl[rf_path]); ++} ++ ++static void rtw8812a_config_1t(struct rtw_dev *rtwdev) ++{ ++ /* BB OFDM RX Path_A */ ++ rtw_write32_mask(rtwdev, REG_RXPSEL, 0xff, 0x11); ++ ++ /* BB OFDM TX Path_A */ ++ rtw_write32_mask(rtwdev, REG_TXPSEL, MASKLWORD, 0x1111); ++ ++ /* BB CCK R/Rx Path_A */ ++ rtw_write32_mask(rtwdev, REG_CCK_RX, 0x0c000000, 0x0); ++ ++ /* MCS support */ ++ rtw_write32_mask(rtwdev, REG_RX_MCS_LIMIT, 0xc0000060, 0x4); ++ ++ /* RF Path_B HSSI OFF */ ++ rtw_write32_mask(rtwdev, REG_3WIRE_SWB, 0xf, 0x4); ++ ++ /* RF Path_B Power Down */ ++ rtw_write32_mask(rtwdev, REG_LSSI_WRITE_B, MASKDWORD, 0); ++ ++ /* ADDA Path_B OFF */ ++ rtw_write32_mask(rtwdev, REG_AFE_PWR1_B, MASKDWORD, 0); ++ rtw_write32_mask(rtwdev, REG_AFE_PWR2_B, MASKDWORD, 0); ++} ++ ++static const u32 rtw88xxa_txscale_tbl[] = { ++ 0x081, 0x088, 0x090, 0x099, 0x0a2, 0x0ac, 0x0b6, 0x0c0, 0x0cc, 0x0d8, ++ 0x0e5, 0x0f2, 0x101, 0x110, 0x120, 0x131, 0x143, 0x156, 0x16a, 0x180, ++ 0x197, 0x1af, 0x1c8, 0x1e3, 0x200, 0x21e, 0x23e, 0x261, 0x285, 0x2ab, ++ 0x2d3, 0x2fe, 0x32b, 0x35c, 0x38e, 0x3c4, 0x3fe ++}; ++ ++static u32 rtw88xxa_get_bb_swing(struct rtw_dev *rtwdev, u8 band, u8 path) ++{ ++ static const u32 swing2setting[4] = {0x200, 0x16a, 0x101, 0x0b6}; ++ struct rtw_efuse *efuse = &rtwdev->efuse; ++ u8 tx_bb_swing; ++ ++ if (band == RTW_BAND_2G) ++ tx_bb_swing = efuse->tx_bb_swing_setting_2g; ++ else ++ tx_bb_swing = efuse->tx_bb_swing_setting_5g; ++ ++ if (path == RF_PATH_B) ++ tx_bb_swing >>= 2; ++ tx_bb_swing &= 0x3; ++ ++ return swing2setting[tx_bb_swing]; ++} ++ ++static u8 rtw88xxa_get_swing_index(struct rtw_dev *rtwdev) ++{ ++ u32 swing, table_value; ++ u8 i; ++ ++ swing = rtw88xxa_get_bb_swing(rtwdev, rtwdev->hal.current_band_type, ++ RF_PATH_A); ++ ++ for (i = 0; i < ARRAY_SIZE(rtw88xxa_txscale_tbl); i++) { ++ table_value = rtw88xxa_txscale_tbl[i]; ++ if (swing == table_value) ++ return i; ++ } ++ ++ return 24; ++} ++ ++static void rtw88xxa_pwrtrack_init(struct rtw_dev *rtwdev) ++{ ++ struct rtw_dm_info *dm_info = &rtwdev->dm_info; ++ u8 path; ++ ++ dm_info->default_ofdm_index = rtw88xxa_get_swing_index(rtwdev); ++ ++ if (rtwdev->chip->id == RTW_CHIP_TYPE_8821A) ++ dm_info->default_cck_index = 0; ++ else ++ dm_info->default_cck_index = 24; ++ ++ for (path = RF_PATH_A; path < rtwdev->hal.rf_path_num; path++) { ++ ewma_thermal_init(&dm_info->avg_thermal[path]); ++ dm_info->delta_power_index[path] = 0; ++ dm_info->delta_power_index_last[path] = 0; ++ } ++ ++ dm_info->pwr_trk_triggered = false; ++ dm_info->pwr_trk_init_trigger = true; ++ dm_info->thermal_meter_k = rtwdev->efuse.thermal_meter_k; ++} ++ ++void rtw88xxa_power_off(struct rtw_dev *rtwdev, ++ const struct rtw_pwr_seq_cmd *const *enter_lps_flow) ++{ ++ struct rtw_usb *rtwusb = rtw_get_usb_priv(rtwdev); ++ enum usb_device_speed speed = rtwusb->udev->speed; ++ u16 ori_fsmc0; ++ u8 reg_cr; ++ ++ reg_cr = rtw_read8(rtwdev, REG_CR); ++ ++ /* Already powered off */ ++ if (reg_cr == 0 || reg_cr == 0xEA) ++ return; ++ ++ rtw_hci_stop(rtwdev); ++ ++ if (!rtwdev->efuse.btcoex) ++ rtw_write16_clr(rtwdev, REG_GPIO_MUXCFG, BIT_EN_SIC); ++ ++ /* set Reg 0xf008[3:4] to 2'11 to enable U1/U2 Mode in USB3.0. */ ++ if (speed == USB_SPEED_SUPER) ++ rtw_write8_set(rtwdev, REG_USB_MOD, 0x18); ++ ++ rtw_write32(rtwdev, REG_HISR0, 0xffffffff); ++ rtw_write32(rtwdev, REG_HISR1, 0xffffffff); ++ rtw_write32(rtwdev, REG_HIMR0, 0); ++ rtw_write32(rtwdev, REG_HIMR1, 0); ++ ++ if (rtwdev->efuse.btcoex) ++ rtw_coex_power_off_setting(rtwdev); ++ ++ ori_fsmc0 = rtw_read16(rtwdev, REG_APS_FSMCO); ++ rtw_write16(rtwdev, REG_APS_FSMCO, ori_fsmc0 & ~APS_FSMCO_HW_POWERDOWN); ++ ++ /* Stop Tx Report Timer. */ ++ rtw_write8_clr(rtwdev, REG_TX_RPT_CTRL, BIT(1)); ++ ++ /* Stop Rx */ ++ rtw_write8(rtwdev, REG_CR, 0); ++ ++ rtw_pwr_seq_parser(rtwdev, enter_lps_flow); ++ ++ if (rtw_read8(rtwdev, REG_MCUFW_CTRL) & BIT_RAM_DL_SEL) ++ rtw88xxa_reset_8051(rtwdev); ++ ++ rtw_write8_clr(rtwdev, REG_SYS_FUNC_EN + 1, BIT(2)); ++ rtw_write8(rtwdev, REG_MCUFW_CTRL, 0); ++ ++ rtw_pwr_seq_parser(rtwdev, rtwdev->chip->pwr_off_seq); ++ ++ if (ori_fsmc0 & APS_FSMCO_HW_POWERDOWN) ++ rtw_write16_set(rtwdev, REG_APS_FSMCO, APS_FSMCO_HW_POWERDOWN); ++ ++ clear_bit(RTW_FLAG_POWERON, rtwdev->flags); ++} ++EXPORT_SYMBOL(rtw88xxa_power_off); ++ ++static void rtw88xxa_set_channel_bb_swing(struct rtw_dev *rtwdev, u8 band) ++{ ++ rtw_write32_mask(rtwdev, REG_TXSCALE_A, BB_SWING_MASK, ++ rtw88xxa_get_bb_swing(rtwdev, band, RF_PATH_A)); ++ rtw_write32_mask(rtwdev, REG_TXSCALE_B, BB_SWING_MASK, ++ rtw88xxa_get_bb_swing(rtwdev, band, RF_PATH_B)); ++ rtw88xxa_pwrtrack_init(rtwdev); ++} ++ ++static void rtw8821a_set_ext_band_switch(struct rtw_dev *rtwdev, u8 band) ++{ ++ rtw_write32_mask(rtwdev, REG_LED_CFG, BIT_DPDT_SEL_EN, 0); ++ rtw_write32_mask(rtwdev, REG_LED_CFG, BIT_DPDT_WL_SEL, 1); ++ rtw_write32_mask(rtwdev, REG_RFE_INV_A, 0xf, 7); ++ rtw_write32_mask(rtwdev, REG_RFE_INV_A, 0xf0, 7); ++ ++ if (band == RTW_BAND_2G) ++ rtw_write32_mask(rtwdev, REG_RFE_INV_A, BIT(29) | BIT(28), 1); ++ else ++ rtw_write32_mask(rtwdev, REG_RFE_INV_A, BIT(29) | BIT(28), 2); ++} ++ ++static void rtw8821a_phy_set_rfe_reg_24g(struct rtw_dev *rtwdev) ++{ ++ struct rtw_efuse *efuse = &rtwdev->efuse; ++ ++ /* Turn off RF PA and LNA */ ++ ++ /* 0xCB0[15:12] = 0x7 (LNA_On)*/ ++ rtw_write32_mask(rtwdev, REG_RFE_PINMUX_A, 0xF000, 0x7); ++ /* 0xCB0[7:4] = 0x7 (PAPE_A)*/ ++ rtw_write32_mask(rtwdev, REG_RFE_PINMUX_A, 0xF0, 0x7); ++ ++ if (efuse->ext_lna_2g) { ++ /* Turn on 2.4G External LNA */ ++ rtw_write32_mask(rtwdev, REG_RFE_INV_A, BIT(20), 1); ++ rtw_write32_mask(rtwdev, REG_RFE_INV_A, BIT(22), 0); ++ rtw_write32_mask(rtwdev, REG_RFE_PINMUX_A, GENMASK(2, 0), 0x2); ++ rtw_write32_mask(rtwdev, REG_RFE_PINMUX_A, GENMASK(10, 8), 0x2); ++ } else { ++ /* Bypass 2.4G External LNA */ ++ rtw_write32_mask(rtwdev, REG_RFE_INV_A, BIT(20), 0); ++ rtw_write32_mask(rtwdev, REG_RFE_INV_A, BIT(22), 0); ++ rtw_write32_mask(rtwdev, REG_RFE_PINMUX_A, GENMASK(2, 0), 0x7); ++ rtw_write32_mask(rtwdev, REG_RFE_PINMUX_A, GENMASK(10, 8), 0x7); ++ } ++} ++ ++static void rtw8821a_phy_set_rfe_reg_5g(struct rtw_dev *rtwdev) ++{ ++ /* Turn ON RF PA and LNA */ ++ ++ /* 0xCB0[15:12] = 0x7 (LNA_On)*/ ++ rtw_write32_mask(rtwdev, REG_RFE_PINMUX_A, 0xF000, 0x5); ++ /* 0xCB0[7:4] = 0x7 (PAPE_A)*/ ++ rtw_write32_mask(rtwdev, REG_RFE_PINMUX_A, 0xF0, 0x4); ++ ++ /* Bypass 2.4G External LNA */ ++ rtw_write32_mask(rtwdev, REG_RFE_INV_A, BIT(20), 0); ++ rtw_write32_mask(rtwdev, REG_RFE_INV_A, BIT(22), 0); ++ rtw_write32_mask(rtwdev, REG_RFE_PINMUX_A, GENMASK(2, 0), 0x7); ++ rtw_write32_mask(rtwdev, REG_RFE_PINMUX_A, GENMASK(10, 8), 0x7); ++} ++ ++static void rtw8812a_phy_set_rfe_reg_24g(struct rtw_dev *rtwdev) ++{ ++ switch (rtwdev->efuse.rfe_option) { ++ case 0: ++ case 2: ++ rtw_write32(rtwdev, REG_RFE_PINMUX_A, 0x77777777); ++ rtw_write32(rtwdev, REG_RFE_PINMUX_B, 0x77777777); ++ rtw_write32_mask(rtwdev, REG_RFE_INV_A, RFE_INV_MASK, 0x000); ++ rtw_write32_mask(rtwdev, REG_RFE_INV_B, RFE_INV_MASK, 0x000); ++ break; ++ case 1: ++ if (rtwdev->efuse.btcoex) { ++ rtw_write32_mask(rtwdev, REG_RFE_PINMUX_A, 0xffffff, 0x777777); ++ rtw_write32(rtwdev, REG_RFE_PINMUX_B, 0x77777777); ++ rtw_write32_mask(rtwdev, REG_RFE_INV_A, 0x33f00000, 0x000); ++ rtw_write32_mask(rtwdev, REG_RFE_INV_B, RFE_INV_MASK, 0x000); ++ } else { ++ rtw_write32(rtwdev, REG_RFE_PINMUX_A, 0x77777777); ++ rtw_write32(rtwdev, REG_RFE_PINMUX_B, 0x77777777); ++ rtw_write32_mask(rtwdev, REG_RFE_INV_A, RFE_INV_MASK, 0x000); ++ rtw_write32_mask(rtwdev, REG_RFE_INV_B, RFE_INV_MASK, 0x000); ++ } ++ break; ++ case 3: ++ rtw_write32(rtwdev, REG_RFE_PINMUX_A, 0x54337770); ++ rtw_write32(rtwdev, REG_RFE_PINMUX_B, 0x54337770); ++ rtw_write32_mask(rtwdev, REG_RFE_INV_A, RFE_INV_MASK, 0x010); ++ rtw_write32_mask(rtwdev, REG_RFE_INV_B, RFE_INV_MASK, 0x010); ++ rtw_write32_mask(rtwdev, REG_ANTSEL_SW, 0x00000303, 0x1); ++ break; ++ case 4: ++ rtw_write32(rtwdev, REG_RFE_PINMUX_A, 0x77777777); ++ rtw_write32(rtwdev, REG_RFE_PINMUX_B, 0x77777777); ++ rtw_write32_mask(rtwdev, REG_RFE_INV_A, RFE_INV_MASK, 0x001); ++ rtw_write32_mask(rtwdev, REG_RFE_INV_B, RFE_INV_MASK, 0x001); ++ break; ++ case 5: ++ rtw_write8(rtwdev, REG_RFE_PINMUX_A + 2, 0x77); ++ rtw_write32(rtwdev, REG_RFE_PINMUX_B, 0x77777777); ++ rtw_write8_clr(rtwdev, REG_RFE_INV_A + 3, BIT(0)); ++ rtw_write32_mask(rtwdev, REG_RFE_INV_B, RFE_INV_MASK, 0x000); ++ break; ++ case 6: ++ rtw_write32(rtwdev, REG_RFE_PINMUX_A, 0x07772770); ++ rtw_write32(rtwdev, REG_RFE_PINMUX_B, 0x07772770); ++ rtw_write32(rtwdev, REG_RFE_INV_A, 0x00000077); ++ rtw_write32(rtwdev, REG_RFE_INV_B, 0x00000077); ++ break; ++ default: ++ break; ++ } ++} ++ ++static void rtw8812a_phy_set_rfe_reg_5g(struct rtw_dev *rtwdev) ++{ ++ switch (rtwdev->efuse.rfe_option) { ++ case 0: ++ rtw_write32(rtwdev, REG_RFE_PINMUX_A, 0x77337717); ++ rtw_write32(rtwdev, REG_RFE_PINMUX_B, 0x77337717); ++ rtw_write32_mask(rtwdev, REG_RFE_INV_A, RFE_INV_MASK, 0x010); ++ rtw_write32_mask(rtwdev, REG_RFE_INV_B, RFE_INV_MASK, 0x010); ++ break; ++ case 1: ++ if (rtwdev->efuse.btcoex) { ++ rtw_write32_mask(rtwdev, REG_RFE_PINMUX_A, 0xffffff, 0x337717); ++ rtw_write32(rtwdev, REG_RFE_PINMUX_B, 0x77337717); ++ rtw_write32_mask(rtwdev, REG_RFE_INV_A, 0x33f00000, 0x000); ++ rtw_write32_mask(rtwdev, REG_RFE_INV_B, RFE_INV_MASK, 0x000); ++ } else { ++ rtw_write32(rtwdev, REG_RFE_PINMUX_A, 0x77337717); ++ rtw_write32(rtwdev, REG_RFE_PINMUX_B, 0x77337717); ++ rtw_write32_mask(rtwdev, REG_RFE_INV_A, RFE_INV_MASK, 0x000); ++ rtw_write32_mask(rtwdev, REG_RFE_INV_B, RFE_INV_MASK, 0x000); ++ } ++ break; ++ case 2: ++ case 4: ++ rtw_write32(rtwdev, REG_RFE_PINMUX_A, 0x77337777); ++ rtw_write32(rtwdev, REG_RFE_PINMUX_B, 0x77337777); ++ rtw_write32_mask(rtwdev, REG_RFE_INV_A, RFE_INV_MASK, 0x010); ++ rtw_write32_mask(rtwdev, REG_RFE_INV_B, RFE_INV_MASK, 0x010); ++ break; ++ case 3: ++ rtw_write32(rtwdev, REG_RFE_PINMUX_A, 0x54337717); ++ rtw_write32(rtwdev, REG_RFE_PINMUX_B, 0x54337717); ++ rtw_write32_mask(rtwdev, REG_RFE_INV_A, RFE_INV_MASK, 0x010); ++ rtw_write32_mask(rtwdev, REG_RFE_INV_B, RFE_INV_MASK, 0x010); ++ rtw_write32_mask(rtwdev, REG_ANTSEL_SW, 0x00000303, 0x1); ++ break; ++ case 5: ++ rtw_write8(rtwdev, REG_RFE_PINMUX_A + 2, 0x33); ++ rtw_write32(rtwdev, REG_RFE_PINMUX_B, 0x77337777); ++ rtw_write8_set(rtwdev, REG_RFE_INV_A + 3, BIT(0)); ++ rtw_write32_mask(rtwdev, REG_RFE_INV_B, RFE_INV_MASK, 0x010); ++ break; ++ case 6: ++ rtw_write32(rtwdev, REG_RFE_PINMUX_A, 0x07737717); ++ rtw_write32(rtwdev, REG_RFE_PINMUX_B, 0x07737717); ++ rtw_write32(rtwdev, REG_RFE_INV_A, 0x00000077); ++ rtw_write32(rtwdev, REG_RFE_INV_B, 0x00000077); ++ break; ++ default: ++ break; ++ } ++} ++ ++static void rtw88xxa_switch_band(struct rtw_dev *rtwdev, u8 new_band, u8 bw) ++{ ++ const struct rtw_chip_info *chip = rtwdev->chip; ++ u16 basic_rates, reg_41a; ++ ++ /* 8811au one antenna module doesn't support antenna div, so driver must ++ * control antenna band, otherwise one of the band will have issue ++ */ ++ if (chip->id == RTW_CHIP_TYPE_8821A && !rtwdev->efuse.btcoex && ++ rtwdev->efuse.ant_div_cfg == 0) ++ rtw8821a_set_ext_band_switch(rtwdev, new_band); ++ ++ if (new_band == RTW_BAND_2G) { ++ rtw_write32_set(rtwdev, REG_RXPSEL, BIT_RX_PSEL_RST); ++ ++ if (chip->id == RTW_CHIP_TYPE_8821A) { ++ rtw8821a_phy_set_rfe_reg_24g(rtwdev); ++ ++ rtw_write32_mask(rtwdev, REG_TXSCALE_A, 0xf00, 0); ++ } else { ++ rtw_write32_mask(rtwdev, REG_BWINDICATION, 0x3, 0x1); ++ rtw_write32_mask(rtwdev, REG_PDMFTH, GENMASK(17, 13), 0x17); ++ ++ if (bw == RTW_CHANNEL_WIDTH_20 && ++ rtwdev->hal.rf_type == RF_1T1R && ++ !rtwdev->efuse.ext_lna_2g) ++ rtw_write32_mask(rtwdev, REG_PDMFTH, GENMASK(3, 1), 0x02); ++ else ++ rtw_write32_mask(rtwdev, REG_PDMFTH, GENMASK(3, 1), 0x04); ++ ++ rtw_write32_mask(rtwdev, REG_CCASEL, 0x3, 0); ++ ++ rtw8812a_phy_set_rfe_reg_24g(rtwdev); ++ } ++ ++ rtw_write32_mask(rtwdev, REG_TXPSEL, 0xf0, 0x1); ++ rtw_write32_mask(rtwdev, REG_CCK_RX, 0x0f000000, 0x1); ++ ++ basic_rates = BIT(DESC_RATE1M) | BIT(DESC_RATE2M) | ++ BIT(DESC_RATE5_5M) | BIT(DESC_RATE11M) | ++ BIT(DESC_RATE6M) | BIT(DESC_RATE12M) | ++ BIT(DESC_RATE24M); ++ rtw_write32_mask(rtwdev, REG_RRSR, 0xfffff, basic_rates); ++ ++ rtw_write8_clr(rtwdev, REG_CCK_CHECK, BIT_CHECK_CCK_EN); ++ } else { /* RTW_BAND_5G */ ++ if (chip->id == RTW_CHIP_TYPE_8821A) ++ rtw8821a_phy_set_rfe_reg_5g(rtwdev); ++ ++ rtw_write8_set(rtwdev, REG_CCK_CHECK, BIT_CHECK_CCK_EN); ++ ++ read_poll_timeout_atomic(rtw_read16, reg_41a, (reg_41a & 0x30) == 0x30, ++ 50, 2500, false, rtwdev, REG_TXPKT_EMPTY); ++ ++ rtw_write32_set(rtwdev, REG_RXPSEL, BIT_RX_PSEL_RST); ++ ++ if (chip->id == RTW_CHIP_TYPE_8821A) { ++ rtw_write32_mask(rtwdev, REG_TXSCALE_A, 0xf00, 1); ++ } else { ++ rtw_write32_mask(rtwdev, REG_BWINDICATION, 0x3, 0x2); ++ rtw_write32_mask(rtwdev, REG_PDMFTH, GENMASK(17, 13), 0x15); ++ rtw_write32_mask(rtwdev, REG_PDMFTH, GENMASK(3, 1), 0x04); ++ ++ rtw_write32_mask(rtwdev, REG_CCASEL, 0x3, 1); ++ ++ rtw8812a_phy_set_rfe_reg_5g(rtwdev); ++ } ++ ++ rtw_write32_mask(rtwdev, REG_TXPSEL, 0xf0, 0); ++ rtw_write32_mask(rtwdev, REG_CCK_RX, 0x0f000000, 0xf); ++ ++ basic_rates = BIT(DESC_RATE6M) | BIT(DESC_RATE12M) | ++ BIT(DESC_RATE24M); ++ rtw_write32_mask(rtwdev, REG_RRSR, 0xfffff, basic_rates); ++ } ++ ++ rtw88xxa_set_channel_bb_swing(rtwdev, new_band); ++} ++ ++int rtw88xxa_power_on(struct rtw_dev *rtwdev) ++{ ++ struct rtw_usb *rtwusb = rtw_get_usb_priv(rtwdev); ++ const struct rtw_chip_info *chip = rtwdev->chip; ++ struct rtw_efuse *efuse = &rtwdev->efuse; ++ struct rtw_hal *hal = &rtwdev->hal; ++ int ret; ++ ++ if (test_bit(RTW_FLAG_POWERON, rtwdev->flags)) ++ return 0; ++ ++ /* Override rtw_chip_efuse_info_setup() */ ++ if (chip->id == RTW_CHIP_TYPE_8821A) ++ efuse->btcoex = rtw_read32_mask(rtwdev, REG_WL_BT_PWR_CTRL, ++ BIT_BT_FUNC_EN); ++ ++ /* Override rtw_chip_efuse_info_setup() */ ++ if (chip->id == RTW_CHIP_TYPE_8812A) ++ rtw8812a_read_amplifier_type(rtwdev); ++ ++ ret = rtw_hci_setup(rtwdev); ++ if (ret) { ++ rtw_err(rtwdev, "failed to setup hci\n"); ++ goto err; ++ } ++ ++ /* Revise for U2/U3 switch we can not update RF-A/B reset. ++ * Reset after MAC power on to prevent RF R/W error. ++ * Is it a right method? ++ */ ++ if (chip->id == RTW_CHIP_TYPE_8812A) { ++ rtw_write8(rtwdev, REG_RF_CTRL, 5); ++ rtw_write8(rtwdev, REG_RF_CTRL, 7); ++ rtw_write8(rtwdev, REG_RF_B_CTRL, 5); ++ rtw_write8(rtwdev, REG_RF_B_CTRL, 7); ++ } ++ ++ /* If HW didn't go through a complete de-initial procedure, ++ * it probably occurs some problem for double initial ++ * procedure. ++ */ ++ rtw88xxau_hw_reset(rtwdev); ++ ++ ret = rtw88xxau_init_power_on(rtwdev); ++ if (ret) { ++ rtw_err(rtwdev, "failed to power on\n"); ++ goto err; ++ } ++ ++ ret = rtw_set_trx_fifo_info(rtwdev); ++ if (ret) { ++ rtw_err(rtwdev, "failed to set trx fifo info\n"); ++ goto err; ++ } ++ ++ ret = rtw88xxa_llt_init(rtwdev, rtwdev->fifo.rsvd_boundary); ++ if (ret) { ++ rtw_err(rtwdev, "failed to init llt\n"); ++ goto err; ++ } ++ ++ rtw_write32_set(rtwdev, REG_TXDMA_OFFSET_CHK, BIT_DROP_DATA_EN); ++ ++ ret = rtw_wait_firmware_completion(rtwdev); ++ if (ret) { ++ rtw_err(rtwdev, "failed to wait firmware completion\n"); ++ goto err_off; ++ } ++ ++ ret = rtw_download_firmware(rtwdev, &rtwdev->fw); ++ if (ret) { ++ rtw_err(rtwdev, "failed to download firmware\n"); ++ goto err_off; ++ } ++ ++ rtw_write8(rtwdev, REG_HMETFR, 0xf); ++ ++ rtw_load_table(rtwdev, chip->mac_tbl); ++ ++ rtw88xxau_init_queue_reserved_page(rtwdev); ++ rtw88xxau_init_tx_buffer_boundary(rtwdev); ++ rtw88xxau_init_queue_priority(rtwdev); ++ ++ rtw_write16(rtwdev, REG_TRXFF_BNDY + 2, ++ chip->rxff_size - REPORT_BUF - 1); ++ ++ if (chip->id == RTW_CHIP_TYPE_8812A) ++ rtw_write8(rtwdev, REG_PBP, ++ u8_encode_bits(PBP_512, PBP_TX_MASK) | ++ u8_encode_bits(PBP_64, PBP_RX_MASK)); ++ ++ rtw_write8(rtwdev, REG_RX_DRVINFO_SZ, PHY_STATUS_SIZE); ++ ++ rtw_write32(rtwdev, REG_HIMR0, 0); ++ rtw_write32(rtwdev, REG_HIMR1, 0); ++ ++ rtw_write32_mask(rtwdev, REG_CR, 0x30000, 0x2); ++ ++ rtw88xxa_init_wmac_setting(rtwdev); ++ rtw88xxa_init_adaptive_ctrl(rtwdev); ++ rtw88xxa_init_edca(rtwdev); ++ ++ rtw_write8_set(rtwdev, REG_FWHW_TXQ_CTRL, BIT(7)); ++ rtw_write8(rtwdev, REG_ACKTO, 0x80); ++ ++ rtw88xxau_tx_aggregation(rtwdev); ++ ++ rtw88xxa_init_beacon_parameters(rtwdev); ++ rtw_write8(rtwdev, REG_BCN_MAX_ERR, 0xff); ++ ++ rtw_hci_interface_cfg(rtwdev); ++ ++ /* usb3 rx interval */ ++ rtw_write8(rtwdev, REG_USB3_RXITV, 0x01); ++ ++ /* burst length=4, set 0x3400 for burst length=2 */ ++ rtw_write16(rtwdev, REG_RXDMA_STATUS, 0x7400); ++ rtw_write8(rtwdev, REG_RXDMA_STATUS + 1, 0xf5); ++ ++ /* 0x456 = 0x70, sugguested by Zhilin */ ++ if (chip->id == RTW_CHIP_TYPE_8821A) ++ rtw_write8(rtwdev, REG_AMPDU_MAX_TIME, 0x5e); ++ else ++ rtw_write8(rtwdev, REG_AMPDU_MAX_TIME, 0x70); ++ ++ rtw_write32(rtwdev, REG_AMPDU_MAX_LENGTH, 0xffffffff); ++ rtw_write8(rtwdev, REG_USTIME_TSF, 0x50); ++ rtw_write8(rtwdev, REG_USTIME_EDCA, 0x50); ++ ++ if (rtwusb->udev->speed == USB_SPEED_SUPER) ++ /* Disable U1/U2 Mode to avoid 2.5G spur in USB3.0. */ ++ rtw_write8_clr(rtwdev, REG_USB_MOD, BIT(4) | BIT(3)); ++ ++ rtw_write8_set(rtwdev, REG_SINGLE_AMPDU_CTRL, BIT_EN_SINGLE_APMDU); ++ ++ /* for VHT packet length 11K */ ++ rtw_write8(rtwdev, REG_RX_PKT_LIMIT, 0x18); ++ ++ rtw_write8(rtwdev, REG_PIFS, 0x00); ++ ++ if (chip->id == RTW_CHIP_TYPE_8821A) { ++ /* 0x0a0a too small, it can't pass AC logo. change to 0x1f1f */ ++ rtw_write16(rtwdev, REG_MAX_AGGR_NUM, 0x1f1f); ++ rtw_write8(rtwdev, REG_FWHW_TXQ_CTRL, 0x80); ++ rtw_write32(rtwdev, REG_FAST_EDCA_CTRL, 0x03087777); ++ } else { ++ rtw_write16(rtwdev, REG_MAX_AGGR_NUM, 0x1f1f); ++ rtw_write8_clr(rtwdev, REG_FWHW_TXQ_CTRL, BIT(7)); ++ } ++ ++ /* to prevent mac is reseted by bus. */ ++ rtw_write8_set(rtwdev, REG_RSV_CTRL, BIT(5) | BIT(6)); ++ ++ /* ARFB table 9 for 11ac 5G 2SS */ ++ rtw_write32(rtwdev, REG_ARFR0, 0x00000010); ++ rtw_write32(rtwdev, REG_ARFRH0, 0xfffff000); ++ ++ /* ARFB table 10 for 11ac 5G 1SS */ ++ rtw_write32(rtwdev, REG_ARFR1_V1, 0x00000010); ++ rtw_write32(rtwdev, REG_ARFRH1_V1, 0x003ff000); ++ ++ /* ARFB table 11 for 11ac 24G 1SS */ ++ rtw_write32(rtwdev, REG_ARFR2_V1, 0x00000015); ++ rtw_write32(rtwdev, REG_ARFRH2_V1, 0x003ff000); ++ ++ /* ARFB table 12 for 11ac 24G 2SS */ ++ rtw_write32(rtwdev, REG_ARFR3_V1, 0x00000015); ++ rtw_write32(rtwdev, REG_ARFRH3_V1, 0xffcff000); ++ ++ rtw_write8_set(rtwdev, REG_CR, BIT_MACTXEN | BIT_MACRXEN); ++ ++ rtw88xxa_phy_bb_config(rtwdev); ++ rtw88xxa_phy_rf_config(rtwdev); ++ ++ if (chip->id == RTW_CHIP_TYPE_8812A && hal->rf_path_num == 1) ++ rtw8812a_config_1t(rtwdev); ++ ++ rtw88xxa_switch_band(rtwdev, RTW_BAND_2G, RTW_CHANNEL_WIDTH_20); ++ ++ rtw_write32(rtwdev, RTW_SEC_CMD_REG, BIT(31) | BIT(30)); ++ ++ rtw_write8(rtwdev, REG_HWSEQ_CTRL, 0xff); ++ rtw_write32(rtwdev, REG_BAR_MODE_CTRL, 0x0201ffff); ++ rtw_write8(rtwdev, REG_NAV_CTRL + 2, 0); ++ ++ rtw_write8_clr(rtwdev, REG_GPIO_MUXCFG, BIT(5)); ++ ++ rtw_phy_init(rtwdev); ++ ++ rtw88xxa_pwrtrack_init(rtwdev); ++ ++ /* 0x4c6[3] 1: RTS BW = Data BW ++ * 0: RTS BW depends on CCA / secondary CCA result. ++ */ ++ rtw_write8_clr(rtwdev, REG_QUEUE_CTRL, BIT(3)); ++ ++ /* enable Tx report. */ ++ rtw_write8(rtwdev, REG_FWHW_TXQ_CTRL + 1, 0x0f); ++ ++ /* Pretx_en, for WEP/TKIP SEC */ ++ rtw_write8(rtwdev, REG_EARLY_MODE_CONTROL + 3, 0x01); ++ ++ rtw_write16(rtwdev, REG_TX_RPT_TIME, 0x3df0); ++ ++ /* Reset USB mode switch setting */ ++ rtw_write8(rtwdev, REG_SYS_SDIO_CTRL, 0x0); ++ rtw_write8(rtwdev, REG_ACLK_MON, 0x0); ++ ++ rtw_write8(rtwdev, REG_USB_HRPWM, 0); ++ ++ /* ack for xmit mgmt frames. */ ++ rtw_write32_set(rtwdev, REG_FWHW_TXQ_CTRL, BIT(12)); ++ ++ hal->cck_high_power = rtw_read32_mask(rtwdev, REG_CCK_RPT_FORMAT, ++ BIT_CCK_RPT_FORMAT); ++ ++ ret = rtw_hci_start(rtwdev); ++ if (ret) { ++ rtw_err(rtwdev, "failed to start hci\n"); ++ goto err_off; ++ } ++ ++ if (efuse->btcoex) { ++ rtw_coex_power_on_setting(rtwdev); ++ rtw_coex_init_hw_config(rtwdev, false); ++ } ++ ++ set_bit(RTW_FLAG_POWERON, rtwdev->flags); ++ ++ return 0; ++ ++err_off: ++ chip->ops->power_off(rtwdev); ++ ++err: ++ return ret; ++} ++EXPORT_SYMBOL(rtw88xxa_power_on); ++ ++u32 rtw88xxa_phy_read_rf(struct rtw_dev *rtwdev, ++ enum rtw_rf_path rf_path, u32 addr, u32 mask) ++{ ++ static const u32 pi_addr[2] = { REG_3WIRE_SWA, REG_3WIRE_SWB }; ++ static const u32 read_addr[2][2] = { ++ { REG_SI_READ_A, REG_SI_READ_B }, ++ { REG_PI_READ_A, REG_PI_READ_B } ++ }; ++ const struct rtw_chip_info *chip = rtwdev->chip; ++ const struct rtw_hal *hal = &rtwdev->hal; ++ bool set_cca, pi_mode; ++ u32 val; ++ ++ if (rf_path >= hal->rf_phy_num) { ++ rtw_err(rtwdev, "unsupported rf path (%d)\n", rf_path); ++ return INV_RF_DATA; ++ } ++ ++ /* CCA off to avoid reading the wrong value. ++ * Toggling CCA would affect RF 0x0, skip it. ++ */ ++ set_cca = addr != 0x0 && chip->id == RTW_CHIP_TYPE_8812A && ++ hal->cut_version != RTW_CHIP_VER_CUT_C; ++ ++ if (set_cca) ++ rtw_write32_set(rtwdev, REG_CCA2ND, BIT(3)); ++ ++ addr &= 0xff; ++ ++ pi_mode = rtw_read32_mask(rtwdev, pi_addr[rf_path], 0x4); ++ ++ rtw_write32_mask(rtwdev, REG_HSSI_READ, MASKBYTE0, addr); ++ ++ if (chip->id == RTW_CHIP_TYPE_8821A || ++ hal->cut_version == RTW_CHIP_VER_CUT_C) ++ udelay(20); ++ ++ val = rtw_read32_mask(rtwdev, read_addr[pi_mode][rf_path], mask); ++ ++ /* CCA on */ ++ if (set_cca) ++ rtw_write32_clr(rtwdev, REG_CCA2ND, BIT(3)); ++ ++ return val; ++} ++EXPORT_SYMBOL(rtw88xxa_phy_read_rf); ++ ++static void rtw8812a_phy_fix_spur(struct rtw_dev *rtwdev, u8 channel, u8 bw) ++{ ++ /* C cut Item12 ADC FIFO CLOCK */ ++ if (rtwdev->hal.cut_version == RTW_CHIP_VER_CUT_C) { ++ if (bw == RTW_CHANNEL_WIDTH_40 && channel == 11) ++ rtw_write32_mask(rtwdev, REG_ADCCLK, 0xC00, 0x3); ++ else ++ rtw_write32_mask(rtwdev, REG_ADCCLK, 0xC00, 0x2); ++ ++ /* A workaround to resolve 2480Mhz spur by setting ADC clock ++ * as 160M. ++ */ ++ if (bw == RTW_CHANNEL_WIDTH_20 && (channel == 13 || channel == 14)) { ++ rtw_write32_mask(rtwdev, REG_ADCCLK, 0x300, 0x3); ++ rtw_write32_mask(rtwdev, REG_ADC160, BIT(30), 1); ++ } else if (bw == RTW_CHANNEL_WIDTH_40 && channel == 11) { ++ rtw_write32_mask(rtwdev, REG_ADC160, BIT(30), 1); ++ } else if (bw != RTW_CHANNEL_WIDTH_80) { ++ rtw_write32_mask(rtwdev, REG_ADCCLK, 0x300, 0x2); ++ rtw_write32_mask(rtwdev, REG_ADC160, BIT(30), 0); ++ } ++ } else { ++ /* A workaround to resolve 2480Mhz spur by setting ADC clock ++ * as 160M. ++ */ ++ if (bw == RTW_CHANNEL_WIDTH_20 && (channel == 13 || channel == 14)) ++ rtw_write32_mask(rtwdev, REG_ADCCLK, 0x300, 0x3); ++ else if (channel <= 14) /* 2.4G only */ ++ rtw_write32_mask(rtwdev, REG_ADCCLK, 0x300, 0x2); ++ } ++} ++ ++static void rtw88xxa_switch_channel(struct rtw_dev *rtwdev, u8 channel, u8 bw) ++{ ++ struct rtw_hal *hal = &rtwdev->hal; ++ u32 fc_area, rf_mod_ag; ++ u8 path; ++ ++ switch (channel) { ++ case 36 ... 48: ++ fc_area = 0x494; ++ break; ++ case 50 ... 64: ++ fc_area = 0x453; ++ break; ++ case 100 ... 116: ++ fc_area = 0x452; ++ break; ++ default: ++ if (channel >= 118) ++ fc_area = 0x412; ++ else ++ fc_area = 0x96a; ++ break; ++ } ++ ++ rtw_write32_mask(rtwdev, REG_CLKTRK, 0x1ffe0000, fc_area); ++ ++ for (path = 0; path < hal->rf_path_num; path++) { ++ switch (channel) { ++ case 36 ... 64: ++ rf_mod_ag = 0x101; ++ break; ++ case 100 ... 140: ++ rf_mod_ag = 0x301; ++ break; ++ default: ++ if (channel > 140) ++ rf_mod_ag = 0x501; ++ else ++ rf_mod_ag = 0x000; ++ break; ++ } ++ ++ rtw_write_rf(rtwdev, path, RF_CFGCH, ++ RF18_RFSI_MASK | RF18_BAND_MASK, rf_mod_ag); ++ ++ if (rtwdev->chip->id == RTW_CHIP_TYPE_8812A) ++ rtw8812a_phy_fix_spur(rtwdev, channel, bw); ++ ++ rtw_write_rf(rtwdev, path, RF_CFGCH, RF18_CHANNEL_MASK, channel); ++ } ++} ++ ++static void rtw88xxa_set_reg_bw(struct rtw_dev *rtwdev, u8 bw) ++{ ++ u16 val16 = rtw_read16(rtwdev, REG_WMAC_TRXPTCL_CTL); ++ ++ val16 &= ~BIT_RFMOD; ++ if (bw == RTW_CHANNEL_WIDTH_80) ++ val16 |= BIT_RFMOD_80M; ++ else if (bw == RTW_CHANNEL_WIDTH_40) ++ val16 |= BIT_RFMOD_40M; ++ ++ rtw_write16(rtwdev, REG_WMAC_TRXPTCL_CTL, val16); ++} ++ ++static void rtw88xxa_post_set_bw_mode(struct rtw_dev *rtwdev, u8 channel, ++ u8 bw, u8 primary_chan_idx) ++{ ++ struct rtw_hal *hal = &rtwdev->hal; ++ u8 txsc40 = 0, txsc20, txsc; ++ u8 reg_837, l1pkval; ++ ++ rtw88xxa_set_reg_bw(rtwdev, bw); ++ ++ txsc20 = primary_chan_idx; ++ if (bw == RTW_CHANNEL_WIDTH_80) { ++ if (txsc20 == RTW_SC_20_UPPER || txsc20 == RTW_SC_20_UPMOST) ++ txsc40 = RTW_SC_40_UPPER; ++ else ++ txsc40 = RTW_SC_40_LOWER; ++ } ++ ++ txsc = BIT_TXSC_20M(txsc20) | BIT_TXSC_40M(txsc40); ++ rtw_write8(rtwdev, REG_DATA_SC, txsc); ++ ++ reg_837 = rtw_read8(rtwdev, REG_BWINDICATION + 3); ++ ++ switch (bw) { ++ default: ++ case RTW_CHANNEL_WIDTH_20: ++ rtw_write32_mask(rtwdev, REG_ADCCLK, 0x003003C3, 0x00300200); ++ rtw_write32_mask(rtwdev, REG_ADC160, BIT(30), 0); ++ ++ if (hal->rf_type == RF_2T2R) ++ rtw_write32_mask(rtwdev, REG_L1PKTH, 0x03C00000, 7); ++ else ++ rtw_write32_mask(rtwdev, REG_L1PKTH, 0x03C00000, 8); ++ ++ break; ++ case RTW_CHANNEL_WIDTH_40: ++ rtw_write32_mask(rtwdev, REG_ADCCLK, 0x003003C3, 0x00300201); ++ rtw_write32_mask(rtwdev, REG_ADC160, BIT(30), 0); ++ rtw_write32_mask(rtwdev, REG_ADCCLK, 0x3C, txsc); ++ rtw_write32_mask(rtwdev, REG_CCA2ND, 0xf0000000, txsc); ++ ++ if (reg_837 & BIT(2)) { ++ l1pkval = 6; ++ } else { ++ if (hal->rf_type == RF_2T2R) ++ l1pkval = 7; ++ else ++ l1pkval = 8; ++ } ++ ++ rtw_write32_mask(rtwdev, REG_L1PKTH, 0x03C00000, l1pkval); ++ ++ if (txsc == RTW_SC_20_UPPER) ++ rtw_write32_set(rtwdev, REG_RXSB, BIT(4)); ++ else ++ rtw_write32_clr(rtwdev, REG_RXSB, BIT(4)); ++ ++ break; ++ case RTW_CHANNEL_WIDTH_80: ++ rtw_write32_mask(rtwdev, REG_ADCCLK, 0x003003C3, 0x00300202); ++ rtw_write32_mask(rtwdev, REG_ADC160, BIT(30), 1); ++ rtw_write32_mask(rtwdev, REG_ADCCLK, 0x3C, txsc); ++ rtw_write32_mask(rtwdev, REG_CCA2ND, 0xf0000000, txsc); ++ ++ if (reg_837 & BIT(2)) { ++ l1pkval = 5; ++ } else { ++ if (hal->rf_type == RF_2T2R) ++ l1pkval = 6; ++ else ++ l1pkval = 7; ++ } ++ ++ rtw_write32_mask(rtwdev, REG_L1PKTH, 0x03C00000, l1pkval); ++ ++ break; ++ } ++} ++ ++static void rtw88xxa_set_channel_rf(struct rtw_dev *rtwdev, u8 channel, u8 bw) ++{ ++ u8 path; ++ ++ for (path = RF_PATH_A; path < rtwdev->hal.rf_path_num; path++) { ++ switch (bw) { ++ case RTW_CHANNEL_WIDTH_5: ++ case RTW_CHANNEL_WIDTH_10: ++ case RTW_CHANNEL_WIDTH_20: ++ default: ++ rtw_write_rf(rtwdev, path, RF_CFGCH, RF18_BW_MASK, 3); ++ break; ++ case RTW_CHANNEL_WIDTH_40: ++ rtw_write_rf(rtwdev, path, RF_CFGCH, RF18_BW_MASK, 1); ++ break; ++ case RTW_CHANNEL_WIDTH_80: ++ rtw_write_rf(rtwdev, path, RF_CFGCH, RF18_BW_MASK, 0); ++ break; ++ } ++ } ++} ++ ++void rtw88xxa_set_channel(struct rtw_dev *rtwdev, u8 channel, u8 bw, ++ u8 primary_chan_idx) ++{ ++ u8 old_band, new_band; ++ ++ if (rtw_read8(rtwdev, REG_CCK_CHECK) & BIT_CHECK_CCK_EN) ++ old_band = RTW_BAND_5G; ++ else ++ old_band = RTW_BAND_2G; ++ ++ if (channel > 14) ++ new_band = RTW_BAND_5G; ++ else ++ new_band = RTW_BAND_2G; ++ ++ if (new_band != old_band) ++ rtw88xxa_switch_band(rtwdev, new_band, bw); ++ ++ rtw88xxa_switch_channel(rtwdev, channel, bw); ++ ++ rtw88xxa_post_set_bw_mode(rtwdev, channel, bw, primary_chan_idx); ++ ++ if (rtwdev->chip->id == RTW_CHIP_TYPE_8812A) ++ rtw8812a_phy_fix_spur(rtwdev, channel, bw); ++ ++ rtw88xxa_set_channel_rf(rtwdev, channel, bw); ++} ++EXPORT_SYMBOL(rtw88xxa_set_channel); ++ ++void rtw88xxa_query_phy_status(struct rtw_dev *rtwdev, u8 *phy_status, ++ struct rtw_rx_pkt_stat *pkt_stat, ++ s8 (*cck_rx_pwr)(u8 lna_idx, u8 vga_idx)) ++{ ++ struct rtw_dm_info *dm_info = &rtwdev->dm_info; ++ struct rtw_jaguar_phy_status_rpt *rpt; ++ u8 gain[RTW_RF_PATH_MAX], rssi, i; ++ s8 rx_pwr_db, power_a, power_b; ++ const s8 min_rx_power = -120; ++ u8 lna_idx, vga_idx; ++ ++ rpt = (struct rtw_jaguar_phy_status_rpt *)phy_status; ++ ++ if (pkt_stat->rate <= DESC_RATE11M) { ++ lna_idx = le32_get_bits(rpt->w1, RTW_JGRPHY_W1_AGC_RPT_LNA_IDX); ++ vga_idx = le32_get_bits(rpt->w1, RTW_JGRPHY_W1_AGC_RPT_VGA_IDX); ++ ++ rx_pwr_db = cck_rx_pwr(lna_idx, vga_idx); ++ ++ pkt_stat->rx_power[RF_PATH_A] = rx_pwr_db; ++ pkt_stat->rssi = rtw_phy_rf_power_2_rssi(pkt_stat->rx_power, 1); ++ dm_info->rssi[RF_PATH_A] = pkt_stat->rssi; ++ pkt_stat->bw = RTW_CHANNEL_WIDTH_20; ++ pkt_stat->signal_power = rx_pwr_db; ++ } else { /* OFDM rate */ ++ gain[RF_PATH_A] = le32_get_bits(rpt->w0, RTW_JGRPHY_W0_GAIN_A); ++ gain[RF_PATH_B] = le32_get_bits(rpt->w0, RTW_JGRPHY_W0_GAIN_B); ++ ++ for (i = RF_PATH_A; i < rtwdev->hal.rf_path_num; i++) { ++ pkt_stat->rx_power[i] = gain[i] - 110; ++ rssi = rtw_phy_rf_power_2_rssi(&pkt_stat->rx_power[i], 1); ++ dm_info->rssi[i] = rssi; ++ } ++ ++ pkt_stat->rssi = rtw_phy_rf_power_2_rssi(pkt_stat->rx_power, ++ rtwdev->hal.rf_path_num); ++ ++ power_a = pkt_stat->rx_power[RF_PATH_A]; ++ power_b = pkt_stat->rx_power[RF_PATH_B]; ++ if (rtwdev->hal.rf_path_num == 1) ++ power_b = power_a; ++ ++ pkt_stat->signal_power = max3(power_a, power_b, min_rx_power); ++ } ++} ++EXPORT_SYMBOL(rtw88xxa_query_phy_status); ++ ++static void ++rtw88xxa_set_tx_power_index_by_rate(struct rtw_dev *rtwdev, u8 path, ++ u8 rs, u32 *phy_pwr_idx) ++{ ++ static const u32 offset_txagc[2] = { ++ REG_TX_AGC_A_CCK_11_CCK_1, REG_TX_AGC_B_CCK_11_CCK_1 ++ }; ++ u8 rate, rate_idx, pwr_index, shift; ++ struct rtw_hal *hal = &rtwdev->hal; ++ bool write_1ss_mcs9; ++ u32 mask; ++ int j; ++ ++ for (j = 0; j < rtw_rate_size[rs]; j++) { ++ rate = rtw_rate_section[rs][j]; ++ ++ pwr_index = hal->tx_pwr_tbl[path][rate]; ++ ++ shift = rate & 0x3; ++ *phy_pwr_idx |= ((u32)pwr_index << (shift * 8)); ++ ++ write_1ss_mcs9 = rate == DESC_RATEVHT1SS_MCS9 && ++ hal->rf_path_num == 1; ++ ++ if (write_1ss_mcs9) ++ mask = MASKLWORD; ++ else ++ mask = MASKDWORD; ++ ++ if (shift == 0x3 || write_1ss_mcs9) { ++ rate_idx = rate & 0xfc; ++ if (rate >= DESC_RATEVHT1SS_MCS0) ++ rate_idx -= 0x10; ++ ++ rtw_write32_mask(rtwdev, offset_txagc[path] + rate_idx, ++ mask, *phy_pwr_idx); ++ ++ *phy_pwr_idx = 0; ++ } ++ } ++} ++ ++static void rtw88xxa_tx_power_training(struct rtw_dev *rtwdev, u8 bw, ++ u8 channel, u8 path) ++{ ++ static const u32 write_offset[] = { ++ REG_TX_PWR_TRAINING_A, REG_TX_PWR_TRAINING_B, ++ }; ++ u32 power_level, write_data; ++ u8 i; ++ ++ power_level = rtwdev->hal.tx_pwr_tbl[path][DESC_RATEMCS7]; ++ write_data = 0; ++ ++ for (i = 0; i < 3; i++) { ++ if (i == 0) ++ power_level -= 10; ++ else if (i == 1) ++ power_level -= 8; ++ else ++ power_level -= 6; ++ ++ write_data |= max_t(u32, power_level, 2) << (i * 8); ++ } ++ ++ rtw_write32_mask(rtwdev, write_offset[path], 0xffffff, write_data); ++} ++ ++void rtw88xxa_set_tx_power_index(struct rtw_dev *rtwdev) ++{ ++ struct rtw_hal *hal = &rtwdev->hal; ++ u32 phy_pwr_idx = 0; ++ int rs, path; ++ ++ for (path = 0; path < hal->rf_path_num; path++) { ++ for (rs = 0; rs < RTW_RATE_SECTION_MAX; rs++) { ++ if (hal->rf_path_num == 1 && ++ (rs == RTW_RATE_SECTION_HT_2S || ++ rs == RTW_RATE_SECTION_VHT_2S)) ++ continue; ++ ++ if (test_bit(RTW_FLAG_SCANNING, rtwdev->flags) && ++ rs > RTW_RATE_SECTION_OFDM) ++ continue; ++ ++ if (hal->current_band_type == RTW_BAND_5G && ++ rs == RTW_RATE_SECTION_CCK) ++ continue; ++ ++ rtw88xxa_set_tx_power_index_by_rate(rtwdev, path, rs, ++ &phy_pwr_idx); ++ } ++ ++ rtw88xxa_tx_power_training(rtwdev, hal->current_band_width, ++ hal->current_channel, path); ++ } ++} ++EXPORT_SYMBOL(rtw88xxa_set_tx_power_index); ++ ++void rtw88xxa_false_alarm_statistics(struct rtw_dev *rtwdev) ++{ ++ struct rtw_dm_info *dm_info = &rtwdev->dm_info; ++ u32 cck_fa_cnt, ofdm_fa_cnt; ++ u32 crc32_cnt, cca32_cnt; ++ u32 cck_enable; ++ ++ cck_enable = rtw_read32(rtwdev, REG_RXPSEL) & BIT(28); ++ cck_fa_cnt = rtw_read16(rtwdev, REG_FA_CCK); ++ ofdm_fa_cnt = rtw_read16(rtwdev, REG_FA_OFDM); ++ ++ dm_info->cck_fa_cnt = cck_fa_cnt; ++ dm_info->ofdm_fa_cnt = ofdm_fa_cnt; ++ dm_info->total_fa_cnt = ofdm_fa_cnt; ++ if (cck_enable) ++ dm_info->total_fa_cnt += cck_fa_cnt; ++ ++ crc32_cnt = rtw_read32(rtwdev, REG_CRC_CCK); ++ dm_info->cck_ok_cnt = u32_get_bits(crc32_cnt, MASKLWORD); ++ dm_info->cck_err_cnt = u32_get_bits(crc32_cnt, MASKHWORD); ++ ++ crc32_cnt = rtw_read32(rtwdev, REG_CRC_OFDM); ++ dm_info->ofdm_ok_cnt = u32_get_bits(crc32_cnt, MASKLWORD); ++ dm_info->ofdm_err_cnt = u32_get_bits(crc32_cnt, MASKHWORD); ++ ++ crc32_cnt = rtw_read32(rtwdev, REG_CRC_HT); ++ dm_info->ht_ok_cnt = u32_get_bits(crc32_cnt, MASKLWORD); ++ dm_info->ht_err_cnt = u32_get_bits(crc32_cnt, MASKHWORD); ++ ++ crc32_cnt = rtw_read32(rtwdev, REG_CRC_VHT); ++ dm_info->vht_ok_cnt = u32_get_bits(crc32_cnt, MASKLWORD); ++ dm_info->vht_err_cnt = u32_get_bits(crc32_cnt, MASKHWORD); ++ ++ cca32_cnt = rtw_read32(rtwdev, REG_CCA_OFDM); ++ dm_info->ofdm_cca_cnt = u32_get_bits(cca32_cnt, MASKHWORD); ++ dm_info->total_cca_cnt = dm_info->ofdm_cca_cnt; ++ if (cck_enable) { ++ cca32_cnt = rtw_read32(rtwdev, REG_CCA_CCK); ++ dm_info->cck_cca_cnt = u32_get_bits(cca32_cnt, MASKLWORD); ++ dm_info->total_cca_cnt += dm_info->cck_cca_cnt; ++ } ++ ++ rtw_write32_set(rtwdev, REG_FAS, BIT(17)); ++ rtw_write32_clr(rtwdev, REG_FAS, BIT(17)); ++ rtw_write32_clr(rtwdev, REG_CCK0_FAREPORT, BIT(15)); ++ rtw_write32_set(rtwdev, REG_CCK0_FAREPORT, BIT(15)); ++ rtw_write32_set(rtwdev, REG_CNTRST, BIT(0)); ++ rtw_write32_clr(rtwdev, REG_CNTRST, BIT(0)); ++} ++EXPORT_SYMBOL(rtw88xxa_false_alarm_statistics); ++ ++void rtw88xxa_iqk_backup_mac_bb(struct rtw_dev *rtwdev, ++ u32 *macbb_backup, ++ const u32 *backup_macbb_reg, ++ u32 macbb_num) ++{ ++ u32 i; ++ ++ /* [31] = 0 --> Page C */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x0); ++ ++ /* save MACBB default value */ ++ for (i = 0; i < macbb_num; i++) ++ macbb_backup[i] = rtw_read32(rtwdev, backup_macbb_reg[i]); ++} ++EXPORT_SYMBOL(rtw88xxa_iqk_backup_mac_bb); ++ ++void rtw88xxa_iqk_backup_afe(struct rtw_dev *rtwdev, u32 *afe_backup, ++ const u32 *backup_afe_reg, u32 afe_num) ++{ ++ u32 i; ++ ++ /* [31] = 0 --> Page C */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x0); ++ ++ /* Save AFE Parameters */ ++ for (i = 0; i < afe_num; i++) ++ afe_backup[i] = rtw_read32(rtwdev, backup_afe_reg[i]); ++} ++EXPORT_SYMBOL(rtw88xxa_iqk_backup_afe); ++ ++void rtw88xxa_iqk_restore_mac_bb(struct rtw_dev *rtwdev, ++ u32 *macbb_backup, ++ const u32 *backup_macbb_reg, ++ u32 macbb_num) ++{ ++ u32 i; ++ ++ /* [31] = 0 --> Page C */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x0); ++ ++ /* Reload MacBB Parameters */ ++ for (i = 0; i < macbb_num; i++) ++ rtw_write32(rtwdev, backup_macbb_reg[i], macbb_backup[i]); ++} ++EXPORT_SYMBOL(rtw88xxa_iqk_restore_mac_bb); ++ ++void rtw88xxa_iqk_configure_mac(struct rtw_dev *rtwdev) ++{ ++ /* [31] = 0 --> Page C */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x0); ++ ++ rtw_write8(rtwdev, REG_TXPAUSE, 0x3f); ++ rtw_write32_mask(rtwdev, REG_BCN_CTRL, ++ (BIT_EN_BCN_FUNCTION << 8) | BIT_EN_BCN_FUNCTION, 0x0); ++ ++ /* RX ante off */ ++ rtw_write8(rtwdev, REG_RXPSEL, 0x00); ++ ++ /* CCA off */ ++ rtw_write32_mask(rtwdev, REG_CCA2ND, 0xf, 0xc); ++ ++ /* CCK RX path off */ ++ rtw_write8(rtwdev, REG_CCK_RX + 3, 0xf); ++} ++EXPORT_SYMBOL(rtw88xxa_iqk_configure_mac); ++ ++bool rtw88xxa_iqk_finish(int average, int threshold, ++ int *x_temp, int *y_temp, int *x, int *y, ++ bool break_inner, bool break_outer) ++{ ++ bool finish = false; ++ int i, ii, dx, dy; ++ ++ for (i = 0; i < average; i++) { ++ for (ii = i + 1; ii < average; ii++) { ++ dx = abs_diff(x_temp[i] >> 21, x_temp[ii] >> 21); ++ dy = abs_diff(y_temp[i] >> 21, y_temp[ii] >> 21); ++ ++ if (dx < threshold && dy < threshold) { ++ *x = ((x_temp[i] >> 21) + (x_temp[ii] >> 21)); ++ *y = ((y_temp[i] >> 21) + (y_temp[ii] >> 21)); ++ ++ *x /= 2; ++ *y /= 2; ++ ++ finish = true; ++ ++ if (break_inner) ++ break; ++ } ++ } ++ ++ if (finish && break_outer) ++ break; ++ } ++ ++ return finish; ++} ++EXPORT_SYMBOL(rtw88xxa_iqk_finish); ++ ++static void rtw88xxa_pwrtrack_set(struct rtw_dev *rtwdev, u8 tx_rate, u8 path) ++{ ++ static const u32 reg_txscale[2] = { REG_TXSCALE_A, REG_TXSCALE_B }; ++ struct rtw_dm_info *dm_info = &rtwdev->dm_info; ++ u8 cck_swing_idx, ofdm_swing_idx; ++ u8 pwr_tracking_limit; ++ ++ switch (tx_rate) { ++ case DESC_RATE1M ... DESC_RATE11M: ++ pwr_tracking_limit = 32; ++ break; ++ case DESC_RATE6M ... DESC_RATE48M: ++ case DESC_RATEMCS3 ... DESC_RATEMCS4: ++ case DESC_RATEMCS11 ... DESC_RATEMCS12: ++ case DESC_RATEVHT1SS_MCS3 ... DESC_RATEVHT1SS_MCS4: ++ case DESC_RATEVHT2SS_MCS3 ... DESC_RATEVHT2SS_MCS4: ++ pwr_tracking_limit = 30; ++ break; ++ case DESC_RATE54M: ++ case DESC_RATEMCS5 ... DESC_RATEMCS7: ++ case DESC_RATEMCS13 ... DESC_RATEMCS15: ++ case DESC_RATEVHT1SS_MCS5 ... DESC_RATEVHT1SS_MCS6: ++ case DESC_RATEVHT2SS_MCS5 ... DESC_RATEVHT2SS_MCS6: ++ pwr_tracking_limit = 28; ++ break; ++ case DESC_RATEMCS0 ... DESC_RATEMCS2: ++ case DESC_RATEMCS8 ... DESC_RATEMCS10: ++ case DESC_RATEVHT1SS_MCS0 ... DESC_RATEVHT1SS_MCS2: ++ case DESC_RATEVHT2SS_MCS0 ... DESC_RATEVHT2SS_MCS2: ++ pwr_tracking_limit = 34; ++ break; ++ case DESC_RATEVHT1SS_MCS7: ++ case DESC_RATEVHT2SS_MCS7: ++ pwr_tracking_limit = 26; ++ break; ++ default: ++ case DESC_RATEVHT1SS_MCS8: ++ case DESC_RATEVHT2SS_MCS8: ++ pwr_tracking_limit = 24; ++ break; ++ case DESC_RATEVHT1SS_MCS9: ++ case DESC_RATEVHT2SS_MCS9: ++ pwr_tracking_limit = 22; ++ break; ++ } ++ ++ cck_swing_idx = dm_info->delta_power_index[path] + dm_info->default_cck_index; ++ ofdm_swing_idx = dm_info->delta_power_index[path] + dm_info->default_ofdm_index; ++ ++ if (ofdm_swing_idx > pwr_tracking_limit) { ++ if (path == RF_PATH_A) ++ dm_info->txagc_remnant_cck = cck_swing_idx - pwr_tracking_limit; ++ dm_info->txagc_remnant_ofdm[path] = ofdm_swing_idx - pwr_tracking_limit; ++ ++ ofdm_swing_idx = pwr_tracking_limit; ++ } else if (ofdm_swing_idx == 0) { ++ if (path == RF_PATH_A) ++ dm_info->txagc_remnant_cck = cck_swing_idx; ++ dm_info->txagc_remnant_ofdm[path] = ofdm_swing_idx; ++ } else { ++ if (path == RF_PATH_A) ++ dm_info->txagc_remnant_cck = 0; ++ dm_info->txagc_remnant_ofdm[path] = 0; ++ } ++ ++ rtw_write32_mask(rtwdev, reg_txscale[path], GENMASK(31, 21), ++ rtw88xxa_txscale_tbl[ofdm_swing_idx]); ++} ++ ++void rtw88xxa_phy_pwrtrack(struct rtw_dev *rtwdev, ++ void (*do_lck)(struct rtw_dev *rtwdev), ++ void (*do_iqk)(struct rtw_dev *rtwdev)) ++{ ++ struct rtw_dm_info *dm_info = &rtwdev->dm_info; ++ struct rtw_hal *hal = &rtwdev->hal; ++ struct rtw_swing_table swing_table; ++ s8 remnant_pre[RTW_RF_PATH_MAX]; ++ u8 thermal_value, delta, path; ++ bool need_iqk; ++ ++ rtw_phy_config_swing_table(rtwdev, &swing_table); ++ ++ if (rtwdev->efuse.thermal_meter[0] == 0xff) { ++ pr_err_once("efuse thermal meter is 0xff\n"); ++ return; ++ } ++ ++ thermal_value = rtw_read_rf(rtwdev, RF_PATH_A, RF_T_METER, 0xfc00); ++ ++ rtw_phy_pwrtrack_avg(rtwdev, thermal_value, RF_PATH_A); ++ ++ need_iqk = rtw_phy_pwrtrack_need_iqk(rtwdev); ++ ++ if (need_iqk && do_lck) ++ do_lck(rtwdev); ++ ++ if (dm_info->pwr_trk_init_trigger) ++ dm_info->pwr_trk_init_trigger = false; ++ else if (!rtw_phy_pwrtrack_thermal_changed(rtwdev, thermal_value, ++ RF_PATH_A)) ++ goto iqk; ++ ++ delta = rtw_phy_pwrtrack_get_delta(rtwdev, RF_PATH_A); ++ ++ for (path = RF_PATH_A; path < hal->rf_path_num; path++) { ++ remnant_pre[path] = dm_info->txagc_remnant_ofdm[path]; ++ ++ dm_info->delta_power_index[path] = ++ rtw_phy_pwrtrack_get_pwridx(rtwdev, &swing_table, path, ++ RF_PATH_A, delta); ++ ++ if (dm_info->delta_power_index[path] != ++ dm_info->delta_power_index_last[path]) { ++ dm_info->delta_power_index_last[path] = ++ dm_info->delta_power_index[path]; ++ ++ rtw88xxa_pwrtrack_set(rtwdev, dm_info->tx_rate, path); ++ } ++ } ++ ++ for (path = RF_PATH_A; path < hal->rf_path_num; path++) { ++ if (remnant_pre[path] != dm_info->txagc_remnant_ofdm[path]) { ++ rtw_phy_set_tx_power_level(rtwdev, ++ hal->current_channel); ++ break; ++ } ++ } ++ ++iqk: ++ if (need_iqk) ++ do_iqk(rtwdev); ++} ++EXPORT_SYMBOL(rtw88xxa_phy_pwrtrack); ++ ++void rtw88xxa_phy_cck_pd_set(struct rtw_dev *rtwdev, u8 new_lvl) ++{ ++ static const u8 pd[CCK_PD_LV_MAX] = {0x40, 0x83, 0xcd, 0xdd, 0xed}; ++ struct rtw_dm_info *dm_info = &rtwdev->dm_info; ++ ++ /* Override rtw_phy_cck_pd_lv_link(). It implements something ++ * like type 2/3/4. We need type 1 here. ++ */ ++ if (rtw_is_assoc(rtwdev)) { ++ if (dm_info->min_rssi > 60) { ++ new_lvl = CCK_PD_LV3; ++ } else if (dm_info->min_rssi > 35) { ++ new_lvl = CCK_PD_LV2; ++ } else if (dm_info->min_rssi > 20) { ++ if (dm_info->cck_fa_avg > 500) ++ new_lvl = CCK_PD_LV2; ++ else if (dm_info->cck_fa_avg < 250) ++ new_lvl = CCK_PD_LV1; ++ else ++ return; ++ } else { ++ new_lvl = CCK_PD_LV1; ++ } ++ } ++ ++ rtw_dbg(rtwdev, RTW_DBG_PHY, "lv: (%d) -> (%d)\n", ++ dm_info->cck_pd_lv[RTW_CHANNEL_WIDTH_20][RF_PATH_A], new_lvl); ++ ++ if (dm_info->cck_pd_lv[RTW_CHANNEL_WIDTH_20][RF_PATH_A] == new_lvl) ++ return; ++ ++ dm_info->cck_fa_avg = CCK_FA_AVG_RESET; ++ dm_info->cck_pd_lv[RTW_CHANNEL_WIDTH_20][RF_PATH_A] = new_lvl; ++ ++ rtw_write8(rtwdev, REG_CCK_PD_TH, pd[new_lvl]); ++} ++EXPORT_SYMBOL(rtw88xxa_phy_cck_pd_set); ++ ++MODULE_AUTHOR("Realtek Corporation"); ++MODULE_DESCRIPTION("Realtek 802.11ac wireless 8821a/8811a/8812a common code"); ++MODULE_LICENSE("Dual BSD/GPL"); +--- /dev/null ++++ b/drivers/net/wireless/realtek/rtw88/rtw88xxa.h +@@ -0,0 +1,175 @@ ++/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ ++/* Copyright(c) 2024 Realtek Corporation ++ */ ++ ++#ifndef __RTW88XXA_H__ ++#define __RTW88XXA_H__ ++ ++#include ++#include "reg.h" ++ ++struct rtw8821au_efuse { ++ u8 res4[48]; /* 0xd0 */ ++ u8 vid[2]; /* 0x100 */ ++ u8 pid[2]; ++ u8 res8[3]; ++ u8 mac_addr[ETH_ALEN]; /* 0x107 */ ++ u8 res9[243]; ++} __packed; ++ ++struct rtw8812au_efuse { ++ u8 vid[2]; /* 0xd0 */ ++ u8 pid[2]; /* 0xd2 */ ++ u8 res0[3]; ++ u8 mac_addr[ETH_ALEN]; /* 0xd7 */ ++ u8 res1[291]; ++} __packed; ++ ++struct rtw88xxa_efuse { ++ __le16 rtl_id; ++ u8 res0[6]; /* 0x02 */ ++ u8 usb_mode; /* 0x08 */ ++ u8 res1[7]; /* 0x09 */ ++ ++ /* power index for four RF paths */ ++ struct rtw_txpwr_idx txpwr_idx_table[4]; ++ ++ u8 channel_plan; /* 0xb8 */ ++ u8 xtal_k; ++ u8 thermal_meter; ++ u8 iqk_lck; ++ u8 pa_type; /* 0xbc */ ++ u8 lna_type_2g; /* 0xbd */ ++ u8 res2; ++ u8 lna_type_5g; /* 0xbf */ ++ u8 res3; ++ u8 rf_board_option; /* 0xc1 */ ++ u8 rf_feature_option; ++ u8 rf_bt_setting; ++ u8 eeprom_version; ++ u8 eeprom_customer_id; /* 0xc5 */ ++ u8 tx_bb_swing_setting_2g; ++ u8 tx_bb_swing_setting_5g; ++ u8 tx_pwr_calibrate_rate; ++ u8 rf_antenna_option; /* 0xc9 */ ++ u8 rfe_option; ++ u8 country_code[2]; ++ u8 res4[3]; ++ union { ++ struct rtw8821au_efuse rtw8821au; ++ struct rtw8812au_efuse rtw8812au; ++ }; ++} __packed; ++ ++static_assert(sizeof(struct rtw88xxa_efuse) == 512); ++ ++#define WLAN_BCN_DMA_TIME 0x02 ++#define WLAN_TBTT_PROHIBIT 0x04 ++#define WLAN_TBTT_HOLD_TIME 0x064 ++#define WLAN_TBTT_TIME (WLAN_TBTT_PROHIBIT |\ ++ (WLAN_TBTT_HOLD_TIME << BIT_SHIFT_TBTT_HOLD_TIME_AP)) ++ ++struct rtw_jaguar_phy_status_rpt { ++ __le32 w0; ++ __le32 w1; ++ __le32 w2; ++ __le32 w3; ++ __le32 w4; ++ __le32 w5; ++ __le32 w6; ++} __packed; ++ ++#define RTW_JGRPHY_W0_GAIN_A GENMASK(6, 0) ++#define RTW_JGRPHY_W0_TRSW_A BIT(7) ++#define RTW_JGRPHY_W0_GAIN_B GENMASK(14, 8) ++#define RTW_JGRPHY_W0_TRSW_B BIT(15) ++#define RTW_JGRPHY_W0_CHL_NUM GENMASK(25, 16) ++#define RTW_JGRPHY_W0_SUB_CHNL GENMASK(29, 26) ++#define RTW_JGRPHY_W0_R_RFMOD GENMASK(31, 30) ++ ++/* CCK: */ ++#define RTW_JGRPHY_W1_SIG_QUAL GENMASK(7, 0) ++#define RTW_JGRPHY_W1_AGC_RPT_VGA_IDX GENMASK(12, 8) ++#define RTW_JGRPHY_W1_AGC_RPT_LNA_IDX GENMASK(15, 13) ++#define RTW_JGRPHY_W1_BB_POWER GENMASK(23, 16) ++/* OFDM: */ ++#define RTW_JGRPHY_W1_PWDB_ALL GENMASK(7, 0) ++#define RTW_JGRPHY_W1_CFO_SHORT_A GENMASK(15, 8) /* s8 */ ++#define RTW_JGRPHY_W1_CFO_SHORT_B GENMASK(23, 16) /* s8 */ ++#define RTW_JGRPHY_W1_BT_RF_CH_MSB GENMASK(31, 30) ++ ++#define RTW_JGRPHY_W2_ANT_DIV_SW_A BIT(0) ++#define RTW_JGRPHY_W2_ANT_DIV_SW_B BIT(1) ++#define RTW_JGRPHY_W2_BT_RF_CH_LSB GENMASK(7, 2) ++#define RTW_JGRPHY_W2_CFO_TAIL_A GENMASK(15, 8) /* s8 */ ++#define RTW_JGRPHY_W2_CFO_TAIL_B GENMASK(23, 16) /* s8 */ ++#define RTW_JGRPHY_W2_PCTS_MSK_RPT_0 GENMASK(31, 24) ++ ++#define RTW_JGRPHY_W3_PCTS_MSK_RPT_1 GENMASK(7, 0) ++/* Stream 1 and 2 RX EVM: */ ++#define RTW_JGRPHY_W3_RXEVM_1 GENMASK(15, 8) /* s8 */ ++#define RTW_JGRPHY_W3_RXEVM_2 GENMASK(23, 16) /* s8 */ ++#define RTW_JGRPHY_W3_RXSNR_A GENMASK(31, 24) /* s8 */ ++ ++#define RTW_JGRPHY_W4_RXSNR_B GENMASK(7, 0) /* s8 */ ++#define RTW_JGRPHY_W4_PCTS_MSK_RPT_2 GENMASK(21, 8) ++#define RTW_JGRPHY_W4_PCTS_RPT_VALID BIT(22) ++#define RTW_JGRPHY_W4_RXEVM_3 GENMASK(31, 24) /* s8 */ ++ ++#define RTW_JGRPHY_W5_RXEVM_4 GENMASK(7, 0) /* s8 */ ++/* 8812a, stream 1 and 2 CSI: */ ++#define RTW_JGRPHY_W5_CSI_CURRENT_1 GENMASK(15, 8) ++#define RTW_JGRPHY_W5_CSI_CURRENT_2 GENMASK(23, 16) ++/* 8814a: */ ++#define RTW_JGRPHY_W5_RXSNR_C GENMASK(15, 8) /* s8 */ ++#define RTW_JGRPHY_W5_RXSNR_D GENMASK(23, 16) /* s8 */ ++#define RTW_JGRPHY_W5_GAIN_C GENMASK(30, 24) ++#define RTW_JGRPHY_W5_TRSW_C BIT(31) ++ ++#define RTW_JGRPHY_W6_GAIN_D GENMASK(6, 0) ++#define RTW_JGRPHY_W6_TRSW_D BIT(7) ++#define RTW_JGRPHY_W6_SIGEVM GENMASK(15, 8) /* s8 */ ++#define RTW_JGRPHY_W6_ANTIDX_ANTC GENMASK(18, 16) ++#define RTW_JGRPHY_W6_ANTIDX_ANTD GENMASK(21, 19) ++#define RTW_JGRPHY_W6_DPDT_CTRL_KEEP BIT(22) ++#define RTW_JGRPHY_W6_GNT_BT_KEEP BIT(23) ++#define RTW_JGRPHY_W6_ANTIDX_ANTA GENMASK(26, 24) ++#define RTW_JGRPHY_W6_ANTIDX_ANTB GENMASK(29, 27) ++#define RTW_JGRPHY_W6_HW_ANTSW_OCCUR GENMASK(31, 30) ++ ++#define RF18_BW_MASK (BIT(11) | BIT(10)) ++ ++void rtw88xxa_efuse_grant(struct rtw_dev *rtwdev, bool on); ++int rtw88xxa_read_efuse(struct rtw_dev *rtwdev, u8 *log_map); ++void rtw88xxa_power_off(struct rtw_dev *rtwdev, ++ const struct rtw_pwr_seq_cmd *const *enter_lps_flow); ++int rtw88xxa_power_on(struct rtw_dev *rtwdev); ++u32 rtw88xxa_phy_read_rf(struct rtw_dev *rtwdev, ++ enum rtw_rf_path rf_path, u32 addr, u32 mask); ++void rtw88xxa_set_channel(struct rtw_dev *rtwdev, u8 channel, u8 bw, ++ u8 primary_chan_idx); ++void rtw88xxa_query_phy_status(struct rtw_dev *rtwdev, u8 *phy_status, ++ struct rtw_rx_pkt_stat *pkt_stat, ++ s8 (*cck_rx_pwr)(u8 lna_idx, u8 vga_idx)); ++void rtw88xxa_set_tx_power_index(struct rtw_dev *rtwdev); ++void rtw88xxa_false_alarm_statistics(struct rtw_dev *rtwdev); ++void rtw88xxa_iqk_backup_mac_bb(struct rtw_dev *rtwdev, ++ u32 *macbb_backup, ++ const u32 *backup_macbb_reg, ++ u32 macbb_num); ++void rtw88xxa_iqk_backup_afe(struct rtw_dev *rtwdev, u32 *afe_backup, ++ const u32 *backup_afe_reg, u32 afe_num); ++void rtw88xxa_iqk_restore_mac_bb(struct rtw_dev *rtwdev, ++ u32 *macbb_backup, ++ const u32 *backup_macbb_reg, ++ u32 macbb_num); ++void rtw88xxa_iqk_configure_mac(struct rtw_dev *rtwdev); ++bool rtw88xxa_iqk_finish(int average, int threshold, ++ int *x_temp, int *y_temp, int *x, int *y, ++ bool break_inner, bool break_outer); ++void rtw88xxa_phy_pwrtrack(struct rtw_dev *rtwdev, ++ void (*do_lck)(struct rtw_dev *rtwdev), ++ void (*do_iqk)(struct rtw_dev *rtwdev)); ++void rtw88xxa_phy_cck_pd_set(struct rtw_dev *rtwdev, u8 new_lvl); ++ ++#endif diff --git a/package/kernel/mac80211/patches/rtl/042-v6.13-wifi-rtw88-Add-rtw8821a.-c-h.patch b/package/kernel/mac80211/patches/rtl/042-v6.13-wifi-rtw88-Add-rtw8821a.-c-h.patch new file mode 100644 index 00000000000000..dca3f7b275aab6 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/042-v6.13-wifi-rtw88-Add-rtw8821a.-c-h.patch @@ -0,0 +1,1230 @@ +From 32e284a238806d1984ea68cda25f6b09a4053b94 Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Wed, 30 Oct 2024 20:28:15 +0200 +Subject: [PATCH] wifi: rtw88: Add rtw8821a.{c,h} + +These contain code specific to RTL8821AU. + +Signed-off-by: Bitterblue Smith +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/37218648-ada7-4fad-b7bd-d2aee28cefb9@gmail.com +--- + drivers/net/wireless/realtek/rtw88/rtw8821a.c | 1197 +++++++++++++++++ + drivers/net/wireless/realtek/rtw88/rtw8821a.h | 10 + + 2 files changed, 1207 insertions(+) + create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8821a.c + create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8821a.h + +--- /dev/null ++++ b/drivers/net/wireless/realtek/rtw88/rtw8821a.c +@@ -0,0 +1,1197 @@ ++// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause ++/* Copyright(c) 2024 Realtek Corporation ++ */ ++ ++#include "main.h" ++#include "coex.h" ++#include "phy.h" ++#include "reg.h" ++#include "rtw88xxa.h" ++#include "rtw8821a.h" ++#include "rtw8821a_table.h" ++#include "tx.h" ++ ++static void rtw8821a_power_off(struct rtw_dev *rtwdev) ++{ ++ rtw88xxa_power_off(rtwdev, enter_lps_flow_8821a); ++} ++ ++static s8 rtw8821a_cck_rx_pwr(u8 lna_idx, u8 vga_idx) ++{ ++ static const s8 lna_gain_table[] = {15, -1, -17, 0, -30, -38}; ++ s8 rx_pwr_all = 0; ++ s8 lna_gain; ++ ++ switch (lna_idx) { ++ case 5: ++ case 4: ++ case 2: ++ case 1: ++ case 0: ++ lna_gain = lna_gain_table[lna_idx]; ++ rx_pwr_all = lna_gain - 2 * vga_idx; ++ break; ++ default: ++ break; ++ } ++ ++ return rx_pwr_all; ++} ++ ++static void rtw8821a_query_phy_status(struct rtw_dev *rtwdev, u8 *phy_status, ++ struct rtw_rx_pkt_stat *pkt_stat) ++{ ++ rtw88xxa_query_phy_status(rtwdev, phy_status, pkt_stat, ++ rtw8821a_cck_rx_pwr); ++} ++ ++static void rtw8821a_cfg_ldo25(struct rtw_dev *rtwdev, bool enable) ++{ ++} ++ ++#define CAL_NUM_8821A 3 ++#define MACBB_REG_NUM_8821A 8 ++#define AFE_REG_NUM_8821A 4 ++#define RF_REG_NUM_8821A 3 ++ ++static void rtw8821a_iqk_backup_rf(struct rtw_dev *rtwdev, u32 *rfa_backup, ++ const u32 *backup_rf_reg, u32 rf_num) ++{ ++ u32 i; ++ ++ /* [31] = 0 --> Page C */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x0); ++ ++ /* Save RF Parameters */ ++ for (i = 0; i < rf_num; i++) ++ rfa_backup[i] = rtw_read_rf(rtwdev, RF_PATH_A, ++ backup_rf_reg[i], MASKDWORD); ++} ++ ++static void rtw8821a_iqk_restore_rf(struct rtw_dev *rtwdev, ++ const u32 *backup_rf_reg, ++ u32 *RF_backup, u32 rf_reg_num) ++{ ++ u32 i; ++ ++ /* [31] = 0 --> Page C */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x0); ++ ++ for (i = 0; i < rf_reg_num; i++) ++ rtw_write_rf(rtwdev, RF_PATH_A, backup_rf_reg[i], ++ RFREG_MASK, RF_backup[i]); ++} ++ ++static void rtw8821a_iqk_restore_afe(struct rtw_dev *rtwdev, u32 *afe_backup, ++ const u32 *backup_afe_reg, u32 afe_num) ++{ ++ u32 i; ++ ++ /* [31] = 0 --> Page C */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x0); ++ ++ /* Reload AFE Parameters */ ++ for (i = 0; i < afe_num; i++) ++ rtw_write32(rtwdev, backup_afe_reg[i], afe_backup[i]); ++ ++ /* [31] = 1 --> Page C1 */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x1); ++ ++ rtw_write32(rtwdev, REG_OFDM0_XA_TX_IQ_IMBALANCE, 0x0); ++ rtw_write32(rtwdev, REG_OFDM0_A_TX_AFE, 0x0); ++ rtw_write32(rtwdev, REG_OFDM0_XB_TX_IQ_IMBALANCE, 0x0); ++ rtw_write32(rtwdev, REG_TSSI_TRK_SW, 0x3c000000); ++ rtw_write32(rtwdev, REG_LSSI_WRITE_A, 0x00000080); ++ rtw_write32(rtwdev, REG_TXAGCIDX, 0x00000000); ++ rtw_write32(rtwdev, REG_IQK_DPD_CFG, 0x20040000); ++ rtw_write32(rtwdev, REG_CFG_PMPD, 0x20000000); ++ rtw_write32(rtwdev, REG_RFECTL_A, 0x0); ++} ++ ++static void rtw8821a_iqk_rx_fill(struct rtw_dev *rtwdev, ++ unsigned int rx_x, unsigned int rx_y) ++{ ++ /* [31] = 0 --> Page C */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x0); ++ ++ rtw_write32_mask(rtwdev, REG_RX_IQC_AB_A, ++ 0x000003ff, rx_x >> 1); ++ rtw_write32_mask(rtwdev, REG_RX_IQC_AB_A, ++ 0x03ff0000, (rx_y >> 1) & 0x3ff); ++} ++ ++static void rtw8821a_iqk_tx_fill(struct rtw_dev *rtwdev, ++ unsigned int tx_x, unsigned int tx_y) ++{ ++ /* [31] = 1 --> Page C1 */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x1); ++ ++ rtw_write32(rtwdev, REG_LSSI_WRITE_A, 0x00000080); ++ rtw_write32(rtwdev, REG_IQK_DPD_CFG, 0x20040000); ++ rtw_write32(rtwdev, REG_CFG_PMPD, 0x20000000); ++ rtw_write32_mask(rtwdev, REG_IQC_Y, 0x000007ff, tx_y); ++ rtw_write32_mask(rtwdev, REG_IQC_X, 0x000007ff, tx_x); ++} ++ ++static void rtw8821a_iqk_tx_vdf_true(struct rtw_dev *rtwdev, u32 cal, ++ bool *tx0iqkok, ++ int tx_x0[CAL_NUM_8821A], ++ int tx_y0[CAL_NUM_8821A]) ++{ ++ u32 cal_retry, delay_count, iqk_ready, tx_fail; ++ int tx_dt[3], vdf_y[3], vdf_x[3]; ++ int k; ++ ++ for (k = 0; k < 3; k++) { ++ switch (k) { ++ case 0: ++ /* TX_Tone_idx[9:0], TxK_Mask[29] TX_Tone = 16 */ ++ rtw_write32(rtwdev, REG_OFDM0_XA_TX_IQ_IMBALANCE, ++ 0x18008c38); ++ /* RX_Tone_idx[9:0], RxK_Mask[29] */ ++ rtw_write32(rtwdev, REG_OFDM0_A_TX_AFE, 0x38008c38); ++ rtw_write32_mask(rtwdev, REG_INTPO_SETA, BIT(31), 0x0); ++ break; ++ case 1: ++ rtw_write32_mask(rtwdev, REG_OFDM0_XA_TX_IQ_IMBALANCE, ++ BIT(28), 0x0); ++ rtw_write32_mask(rtwdev, REG_OFDM0_A_TX_AFE, ++ BIT(28), 0x0); ++ rtw_write32_mask(rtwdev, REG_INTPO_SETA, BIT(31), 0x0); ++ break; ++ case 2: ++ rtw_dbg(rtwdev, RTW_DBG_RFK, ++ "vdf_y[1] = %x vdf_y[0] = %x\n", ++ vdf_y[1] >> 21 & 0x00007ff, ++ vdf_y[0] >> 21 & 0x00007ff); ++ ++ rtw_dbg(rtwdev, RTW_DBG_RFK, ++ "vdf_x[1] = %x vdf_x[0] = %x\n", ++ vdf_x[1] >> 21 & 0x00007ff, ++ vdf_x[0] >> 21 & 0x00007ff); ++ ++ tx_dt[cal] = (vdf_y[1] >> 20) - (vdf_y[0] >> 20); ++ tx_dt[cal] = (16 * tx_dt[cal]) * 10000 / 15708; ++ tx_dt[cal] = (tx_dt[cal] >> 1) + (tx_dt[cal] & BIT(0)); ++ ++ /* TX_Tone_idx[9:0], TxK_Mask[29] TX_Tone = 16 */ ++ rtw_write32(rtwdev, REG_OFDM0_XA_TX_IQ_IMBALANCE, ++ 0x18008c20); ++ /* RX_Tone_idx[9:0], RxK_Mask[29] */ ++ rtw_write32(rtwdev, REG_OFDM0_A_TX_AFE, 0x38008c20); ++ rtw_write32_mask(rtwdev, REG_INTPO_SETA, BIT(31), 0x1); ++ rtw_write32_mask(rtwdev, REG_INTPO_SETA, 0x3fff0000, ++ tx_dt[cal] & 0x00003fff); ++ break; ++ } ++ ++ rtw_write32(rtwdev, REG_RFECTL_A, 0x00100000); ++ ++ for (cal_retry = 0; cal_retry < 10; cal_retry++) { ++ /* one shot */ ++ rtw_write32(rtwdev, REG_IQK_COM64, 0xfa000000); ++ rtw_write32(rtwdev, REG_IQK_COM64, 0xf8000000); ++ ++ mdelay(10); ++ ++ rtw_write32(rtwdev, REG_RFECTL_A, 0x00000000); ++ ++ for (delay_count = 0; delay_count < 20; delay_count++) { ++ iqk_ready = rtw_read32_mask(rtwdev, ++ REG_IQKA_END, ++ BIT(10)); ++ ++ /* Originally: if (~iqk_ready || delay_count > 20) ++ * that looks like a typo so make it more explicit ++ */ ++ iqk_ready = true; ++ ++ if (iqk_ready) ++ break; ++ ++ mdelay(1); ++ } ++ ++ if (delay_count < 20) { ++ /* ============TXIQK Check============== */ ++ tx_fail = rtw_read32_mask(rtwdev, ++ REG_IQKA_END, ++ BIT(12)); ++ ++ /* Originally: if (~tx_fail) { ++ * It looks like a typo, so make it more explicit. ++ */ ++ tx_fail = false; ++ ++ if (!tx_fail) { ++ rtw_write32(rtwdev, REG_RFECTL_A, ++ 0x02000000); ++ vdf_x[k] = rtw_read32_mask(rtwdev, ++ REG_IQKA_END, ++ 0x07ff0000); ++ vdf_x[k] <<= 21; ++ ++ rtw_write32(rtwdev, REG_RFECTL_A, ++ 0x04000000); ++ vdf_y[k] = rtw_read32_mask(rtwdev, ++ REG_IQKA_END, ++ 0x07ff0000); ++ vdf_y[k] <<= 21; ++ ++ *tx0iqkok = true; ++ break; ++ } ++ ++ rtw_write32_mask(rtwdev, REG_IQC_Y, ++ 0x000007ff, 0x0); ++ rtw_write32_mask(rtwdev, REG_IQC_X, ++ 0x000007ff, 0x200); ++ } ++ ++ *tx0iqkok = false; ++ } ++ } ++ ++ if (k == 3) { ++ tx_x0[cal] = vdf_x[k - 1]; ++ tx_y0[cal] = vdf_y[k - 1]; ++ } ++} ++ ++static void rtw8821a_iqk_tx_vdf_false(struct rtw_dev *rtwdev, u32 cal, ++ bool *tx0iqkok, ++ int tx_x0[CAL_NUM_8821A], ++ int tx_y0[CAL_NUM_8821A]) ++{ ++ u32 cal_retry, delay_count, iqk_ready, tx_fail; ++ ++ /* TX_Tone_idx[9:0], TxK_Mask[29] TX_Tone = 16 */ ++ rtw_write32(rtwdev, REG_OFDM0_XA_TX_IQ_IMBALANCE, 0x18008c10); ++ /* RX_Tone_idx[9:0], RxK_Mask[29] */ ++ rtw_write32(rtwdev, REG_OFDM0_A_TX_AFE, 0x38008c10); ++ rtw_write32(rtwdev, REG_RFECTL_A, 0x00100000); ++ ++ for (cal_retry = 0; cal_retry < 10; cal_retry++) { ++ /* one shot */ ++ rtw_write32(rtwdev, REG_IQK_COM64, 0xfa000000); ++ rtw_write32(rtwdev, REG_IQK_COM64, 0xf8000000); ++ ++ mdelay(10); ++ rtw_write32(rtwdev, REG_RFECTL_A, 0x00000000); ++ ++ for (delay_count = 0; delay_count < 20; delay_count++) { ++ iqk_ready = rtw_read32_mask(rtwdev, REG_IQKA_END, BIT(10)); ++ ++ /* Originally: if (~iqk_ready || delay_count > 20) ++ * that looks like a typo so make it more explicit ++ */ ++ iqk_ready = true; ++ ++ if (iqk_ready) ++ break; ++ ++ mdelay(1); ++ } ++ ++ if (delay_count < 20) { ++ /* ============TXIQK Check============== */ ++ tx_fail = rtw_read32_mask(rtwdev, REG_IQKA_END, BIT(12)); ++ ++ /* Originally: if (~tx_fail) { ++ * It looks like a typo, so make it more explicit. ++ */ ++ tx_fail = false; ++ ++ if (!tx_fail) { ++ rtw_write32(rtwdev, REG_RFECTL_A, 0x02000000); ++ tx_x0[cal] = rtw_read32_mask(rtwdev, REG_IQKA_END, ++ 0x07ff0000); ++ tx_x0[cal] <<= 21; ++ ++ rtw_write32(rtwdev, REG_RFECTL_A, 0x04000000); ++ tx_y0[cal] = rtw_read32_mask(rtwdev, REG_IQKA_END, ++ 0x07ff0000); ++ tx_y0[cal] <<= 21; ++ ++ *tx0iqkok = true; ++ break; ++ } ++ ++ rtw_write32_mask(rtwdev, REG_IQC_Y, 0x000007ff, 0x0); ++ rtw_write32_mask(rtwdev, REG_IQC_X, 0x000007ff, 0x200); ++ } ++ ++ *tx0iqkok = false; ++ } ++} ++ ++static void rtw8821a_iqk_rx(struct rtw_dev *rtwdev, u32 cal, bool *rx0iqkok, ++ int rx_x0[CAL_NUM_8821A], ++ int rx_y0[CAL_NUM_8821A]) ++{ ++ u32 cal_retry, delay_count, iqk_ready, rx_fail; ++ ++ rtw_write32(rtwdev, REG_RFECTL_A, 0x00100000); ++ ++ for (cal_retry = 0; cal_retry < 10; cal_retry++) { ++ /* one shot */ ++ rtw_write32(rtwdev, REG_IQK_COM64, 0xfa000000); ++ rtw_write32(rtwdev, REG_IQK_COM64, 0xf8000000); ++ ++ mdelay(10); ++ ++ rtw_write32(rtwdev, REG_RFECTL_A, 0x00000000); ++ ++ for (delay_count = 0; delay_count < 20; delay_count++) { ++ iqk_ready = rtw_read32_mask(rtwdev, REG_IQKA_END, BIT(10)); ++ ++ /* Originally: if (~iqk_ready || delay_count > 20) ++ * that looks like a typo so make it more explicit ++ */ ++ iqk_ready = true; ++ ++ if (iqk_ready) ++ break; ++ ++ mdelay(1); ++ } ++ ++ if (delay_count < 20) { ++ /* ============RXIQK Check============== */ ++ rx_fail = rtw_read32_mask(rtwdev, REG_IQKA_END, BIT(11)); ++ if (!rx_fail) { ++ rtw_write32(rtwdev, REG_RFECTL_A, 0x06000000); ++ rx_x0[cal] = rtw_read32_mask(rtwdev, REG_IQKA_END, ++ 0x07ff0000); ++ rx_x0[cal] <<= 21; ++ ++ rtw_write32(rtwdev, REG_RFECTL_A, 0x08000000); ++ rx_y0[cal] = rtw_read32_mask(rtwdev, REG_IQKA_END, ++ 0x07ff0000); ++ rx_y0[cal] <<= 21; ++ ++ *rx0iqkok = true; ++ break; ++ } ++ ++ rtw_write32_mask(rtwdev, REG_RX_IQC_AB_A, ++ 0x000003ff, 0x200 >> 1); ++ rtw_write32_mask(rtwdev, REG_RX_IQC_AB_A, ++ 0x03ff0000, 0x0 >> 1); ++ } ++ ++ *rx0iqkok = false; ++ } ++} ++ ++static void rtw8821a_iqk(struct rtw_dev *rtwdev) ++{ ++ int tx_average = 0, rx_average = 0, rx_iqk_loop = 0; ++ const struct rtw_efuse *efuse = &rtwdev->efuse; ++ int tx_x = 0, tx_y = 0, rx_x = 0, rx_y = 0; ++ const struct rtw_hal *hal = &rtwdev->hal; ++ bool tx0iqkok = false, rx0iqkok = false; ++ int rx_x_temp = 0, rx_y_temp = 0; ++ int rx_x0[2][CAL_NUM_8821A]; ++ int rx_y0[2][CAL_NUM_8821A]; ++ int tx_x0[CAL_NUM_8821A]; ++ int tx_y0[CAL_NUM_8821A]; ++ bool rx_finish1 = false; ++ bool rx_finish2 = false; ++ bool vdf_enable; ++ u32 cal; ++ int i; ++ ++ rtw_dbg(rtwdev, RTW_DBG_RFK, ++ "band_width = %d, ext_pa = %d, ext_pa_5g = %d\n", ++ hal->current_band_width, efuse->ext_pa_2g, efuse->ext_pa_5g); ++ ++ vdf_enable = hal->current_band_width == RTW_CHANNEL_WIDTH_80; ++ ++ for (cal = 0; cal < CAL_NUM_8821A; cal++) { ++ /* path-A LOK */ ++ ++ /* [31] = 0 --> Page C */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x0); ++ ++ /* ========path-A AFE all on======== */ ++ /* Port 0 DAC/ADC on */ ++ rtw_write32(rtwdev, REG_AFE_PWR1_A, 0x77777777); ++ rtw_write32(rtwdev, REG_AFE_PWR2_A, 0x77777777); ++ ++ rtw_write32(rtwdev, REG_RX_WAIT_CCA_TX_CCK_RFON_A, 0x19791979); ++ ++ /* hardware 3-wire off */ ++ rtw_write32_mask(rtwdev, REG_3WIRE_SWA, 0xf, 0x4); ++ ++ /* LOK setting */ ++ ++ /* 1. DAC/ADC sampling rate (160 MHz) */ ++ rtw_write32_mask(rtwdev, REG_CK_MONHA, GENMASK(26, 24), 0x7); ++ ++ /* 2. LoK RF setting (at BW = 20M) */ ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_LUTWE, RFREG_MASK, 0x80002); ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_CFGCH, 0x00c00, 0x3); ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_MODE_TABLE_ADDR, RFREG_MASK, ++ 0x20000); ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_MODE_TABLE_DATA0, RFREG_MASK, ++ 0x0003f); ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_MODE_TABLE_DATA1, RFREG_MASK, ++ 0xf3fc3); ++ ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_TXA_PREPAD, RFREG_MASK, ++ 0x931d5); ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_RXBB2, RFREG_MASK, 0x8a001); ++ rtw_write32(rtwdev, REG_DAC_RSTB, 0x00008000); ++ rtw_write32_mask(rtwdev, REG_TXAGCIDX, BIT(0), 0x1); ++ /* TX (X,Y) */ ++ rtw_write32(rtwdev, REG_IQK_COM00, 0x29002000); ++ /* RX (X,Y) */ ++ rtw_write32(rtwdev, REG_IQK_COM32, 0xa9002000); ++ /* [0]:AGC_en, [15]:idac_K_Mask */ ++ rtw_write32(rtwdev, REG_IQK_COM96, 0x00462910); ++ ++ /* [31] = 1 --> Page C1 */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x1); ++ ++ if (efuse->ext_pa_5g) ++ rtw_write32(rtwdev, REG_OFDM0_XB_TX_IQ_IMBALANCE, ++ 0x821403f7); ++ else ++ rtw_write32(rtwdev, REG_OFDM0_XB_TX_IQ_IMBALANCE, ++ 0x821403f4); ++ ++ if (hal->current_band_type == RTW_BAND_5G) ++ rtw_write32(rtwdev, REG_TSSI_TRK_SW, 0x68163e96); ++ else ++ rtw_write32(rtwdev, REG_TSSI_TRK_SW, 0x28163e96); ++ ++ /* TX_Tone_idx[9:0], TxK_Mask[29] TX_Tone = 16 */ ++ rtw_write32(rtwdev, REG_OFDM0_XA_TX_IQ_IMBALANCE, 0x18008c10); ++ /* RX_Tone_idx[9:0], RxK_Mask[29] */ ++ rtw_write32(rtwdev, REG_OFDM0_A_TX_AFE, 0x38008c10); ++ rtw_write32(rtwdev, REG_RFECTL_A, 0x00100000); ++ rtw_write32(rtwdev, REG_IQK_COM64, 0xfa000000); ++ rtw_write32(rtwdev, REG_IQK_COM64, 0xf8000000); ++ ++ mdelay(10); ++ rtw_write32(rtwdev, REG_RFECTL_A, 0x00000000); ++ ++ /* [31] = 0 --> Page C */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x0); ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_TXMOD, 0x7fe00, ++ rtw_read_rf(rtwdev, RF_PATH_A, RF_DTXLOK, 0xffc00)); ++ ++ if (hal->current_band_width == RTW_CHANNEL_WIDTH_40) ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_CFGCH, ++ RF18_BW_MASK, 0x1); ++ else if (hal->current_band_width == RTW_CHANNEL_WIDTH_80) ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_CFGCH, ++ RF18_BW_MASK, 0x0); ++ ++ /* [31] = 1 --> Page C1 */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x1); ++ ++ /* 3. TX RF setting */ ++ /* [31] = 0 --> Page C */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x0); ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_LUTWE, RFREG_MASK, 0x80000); ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_MODE_TABLE_ADDR, RFREG_MASK, ++ 0x20000); ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_MODE_TABLE_DATA0, RFREG_MASK, ++ 0x0003f); ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_MODE_TABLE_DATA1, RFREG_MASK, ++ 0xf3fc3); ++ ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_TXA_PREPAD, RFREG_MASK, 0x931d5); ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_RXBB2, RFREG_MASK, 0x8a001); ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_LUTWE, RFREG_MASK, 0x00000); ++ rtw_write32(rtwdev, REG_DAC_RSTB, 0x00008000); ++ rtw_write32_mask(rtwdev, REG_TXAGCIDX, BIT(0), 0x1); ++ /* TX (X,Y) */ ++ rtw_write32(rtwdev, REG_IQK_COM00, 0x29002000); ++ /* RX (X,Y) */ ++ rtw_write32(rtwdev, REG_IQK_COM32, 0xa9002000); ++ /* [0]:AGC_en, [15]:idac_K_Mask */ ++ rtw_write32(rtwdev, REG_IQK_COM96, 0x0046a910); ++ ++ /* [31] = 1 --> Page C1 */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x1); ++ ++ if (efuse->ext_pa_5g) ++ rtw_write32(rtwdev, REG_OFDM0_XB_TX_IQ_IMBALANCE, ++ 0x821403f7); ++ else ++ rtw_write32(rtwdev, REG_OFDM0_XB_TX_IQ_IMBALANCE, ++ 0x821403e3); ++ ++ if (hal->current_band_type == RTW_BAND_5G) ++ rtw_write32(rtwdev, REG_TSSI_TRK_SW, 0x40163e96); ++ else ++ rtw_write32(rtwdev, REG_TSSI_TRK_SW, 0x00163e96); ++ ++ if (vdf_enable) ++ rtw8821a_iqk_tx_vdf_true(rtwdev, cal, &tx0iqkok, ++ tx_x0, tx_y0); ++ else ++ rtw8821a_iqk_tx_vdf_false(rtwdev, cal, &tx0iqkok, ++ tx_x0, tx_y0); ++ ++ if (!tx0iqkok) ++ break; /* TXK fail, Don't do RXK */ ++ ++ /* ====== RX IQK ====== */ ++ /* [31] = 0 --> Page C */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x0); ++ /* 1. RX RF setting */ ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_LUTWE, RFREG_MASK, 0x80000); ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_MODE_TABLE_ADDR, RFREG_MASK, ++ 0x30000); ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_MODE_TABLE_DATA0, RFREG_MASK, ++ 0x0002f); ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_MODE_TABLE_DATA1, RFREG_MASK, ++ 0xfffbb); ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_RXBB2, RFREG_MASK, 0x88001); ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_TXA_PREPAD, RFREG_MASK, 0x931d8); ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_LUTWE, RFREG_MASK, 0x00000); ++ ++ rtw_write32_mask(rtwdev, REG_IQK_COM00, 0x03FF8000, ++ (tx_x0[cal] >> 21) & 0x000007ff); ++ rtw_write32_mask(rtwdev, REG_IQK_COM00, 0x000007FF, ++ (tx_y0[cal] >> 21) & 0x000007ff); ++ rtw_write32_mask(rtwdev, REG_IQK_COM00, BIT(31), 0x1); ++ rtw_write32_mask(rtwdev, REG_IQK_COM00, BIT(31), 0x0); ++ rtw_write32(rtwdev, REG_DAC_RSTB, 0x00008000); ++ rtw_write32(rtwdev, REG_IQK_COM96, 0x0046a911); ++ ++ /* [31] = 1 --> Page C1 */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x1); ++ ++ /* TX_Tone_idx[9:0], TxK_Mask[29] TX_Tone = 16 */ ++ rtw_write32(rtwdev, REG_OFDM0_XA_TX_IQ_IMBALANCE, 0x38008c10); ++ /* RX_Tone_idx[9:0], RxK_Mask[29] */ ++ rtw_write32(rtwdev, REG_OFDM0_A_TX_AFE, 0x18008c10); ++ rtw_write32(rtwdev, REG_OFDM0_XB_TX_IQ_IMBALANCE, 0x02140119); ++ ++ if (rtw_hci_type(rtwdev) == RTW_HCI_TYPE_PCIE) ++ rx_iqk_loop = 2; /* for 2% fail; */ ++ else ++ rx_iqk_loop = 1; ++ ++ for (i = 0; i < rx_iqk_loop; i++) { ++ if (rtw_hci_type(rtwdev) == RTW_HCI_TYPE_PCIE && i == 0) ++ rtw_write32(rtwdev, REG_TSSI_TRK_SW, 0x28161100); /* Good */ ++ else ++ rtw_write32(rtwdev, REG_TSSI_TRK_SW, 0x28160d00); ++ ++ rtw8821a_iqk_rx(rtwdev, cal, &rx0iqkok, ++ rx_x0[i], rx_y0[i]); ++ } ++ ++ if (tx0iqkok) ++ tx_average++; ++ if (rx0iqkok) ++ rx_average++; ++ } ++ ++ /* FillIQK Result */ ++ ++ if (tx_average == 0) ++ return; ++ ++ for (i = 0; i < tx_average; i++) ++ rtw_dbg(rtwdev, RTW_DBG_RFK, ++ "tx_x0[%d] = %x ;; tx_y0[%d] = %x\n", ++ i, (tx_x0[i] >> 21) & 0x000007ff, ++ i, (tx_y0[i] >> 21) & 0x000007ff); ++ ++ if (rtw88xxa_iqk_finish(tx_average, 3, tx_x0, tx_y0, ++ &tx_x, &tx_y, true, true)) ++ rtw8821a_iqk_tx_fill(rtwdev, tx_x, tx_y); ++ else ++ rtw8821a_iqk_tx_fill(rtwdev, 0x200, 0x0); ++ ++ if (rx_average == 0) ++ return; ++ ++ for (i = 0; i < rx_average; i++) { ++ rtw_dbg(rtwdev, RTW_DBG_RFK, ++ "rx_x0[0][%d] = %x ;; rx_y0[0][%d] = %x\n", ++ i, (rx_x0[0][i] >> 21) & 0x000007ff, ++ i, (rx_y0[0][i] >> 21) & 0x000007ff); ++ ++ if (rx_iqk_loop == 2) ++ rtw_dbg(rtwdev, RTW_DBG_RFK, ++ "rx_x0[1][%d] = %x ;; rx_y0[1][%d] = %x\n", ++ i, (rx_x0[1][i] >> 21) & 0x000007ff, ++ i, (rx_y0[1][i] >> 21) & 0x000007ff); ++ } ++ ++ rx_finish1 = rtw88xxa_iqk_finish(rx_average, 4, rx_x0[0], rx_y0[0], ++ &rx_x_temp, &rx_y_temp, true, true); ++ ++ if (rx_finish1) { ++ rx_x = rx_x_temp; ++ rx_y = rx_y_temp; ++ } ++ ++ if (rx_iqk_loop == 2) { ++ rx_finish2 = rtw88xxa_iqk_finish(rx_average, 4, ++ rx_x0[1], rx_y0[1], ++ &rx_x, &rx_y, true, true); ++ ++ if (rx_finish1 && rx_finish2) { ++ rx_x = (rx_x + rx_x_temp) / 2; ++ rx_y = (rx_y + rx_y_temp) / 2; ++ } ++ } ++ ++ if (rx_finish1 || rx_finish2) ++ rtw8821a_iqk_rx_fill(rtwdev, rx_x, rx_y); ++ else ++ rtw8821a_iqk_rx_fill(rtwdev, 0x200, 0x0); ++} ++ ++static void rtw8821a_do_iqk(struct rtw_dev *rtwdev) ++{ ++ static const u32 backup_macbb_reg[MACBB_REG_NUM_8821A] = { ++ 0x520, 0x550, 0x808, 0xa04, 0x90c, 0xc00, 0x838, 0x82c ++ }; ++ static const u32 backup_afe_reg[AFE_REG_NUM_8821A] = { ++ 0xc5c, 0xc60, 0xc64, 0xc68 ++ }; ++ static const u32 backup_rf_reg[RF_REG_NUM_8821A] = { ++ 0x65, 0x8f, 0x0 ++ }; ++ u32 macbb_backup[MACBB_REG_NUM_8821A]; ++ u32 afe_backup[AFE_REG_NUM_8821A]; ++ u32 rfa_backup[RF_REG_NUM_8821A]; ++ ++ rtw88xxa_iqk_backup_mac_bb(rtwdev, macbb_backup, ++ backup_macbb_reg, MACBB_REG_NUM_8821A); ++ rtw88xxa_iqk_backup_afe(rtwdev, afe_backup, ++ backup_afe_reg, AFE_REG_NUM_8821A); ++ rtw8821a_iqk_backup_rf(rtwdev, rfa_backup, ++ backup_rf_reg, RF_REG_NUM_8821A); ++ ++ rtw88xxa_iqk_configure_mac(rtwdev); ++ ++ rtw8821a_iqk(rtwdev); ++ ++ rtw8821a_iqk_restore_rf(rtwdev, backup_rf_reg, ++ rfa_backup, RF_REG_NUM_8821A); ++ rtw8821a_iqk_restore_afe(rtwdev, afe_backup, ++ backup_afe_reg, AFE_REG_NUM_8821A); ++ rtw88xxa_iqk_restore_mac_bb(rtwdev, macbb_backup, ++ backup_macbb_reg, MACBB_REG_NUM_8821A); ++} ++ ++static void rtw8821a_phy_calibration(struct rtw_dev *rtwdev) ++{ ++ rtw8821a_do_iqk(rtwdev); ++} ++ ++static void rtw8821a_pwr_track(struct rtw_dev *rtwdev) ++{ ++ struct rtw_dm_info *dm_info = &rtwdev->dm_info; ++ ++ if (!dm_info->pwr_trk_triggered) { ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_T_METER, ++ GENMASK(17, 16), 0x03); ++ dm_info->pwr_trk_triggered = true; ++ return; ++ } ++ ++ rtw88xxa_phy_pwrtrack(rtwdev, NULL, rtw8821a_do_iqk); ++ dm_info->pwr_trk_triggered = false; ++} ++ ++static void rtw8821a_fill_txdesc_checksum(struct rtw_dev *rtwdev, ++ struct rtw_tx_pkt_info *pkt_info, ++ u8 *txdesc) ++{ ++ fill_txdesc_checksum_common(txdesc, 16); ++} ++ ++static void rtw8821a_coex_cfg_init(struct rtw_dev *rtwdev) ++{ ++ u8 val8; ++ ++ /* BT report packet sample rate */ ++ rtw_write8_mask(rtwdev, REG_BT_TDMA_TIME, BIT_MASK_SAMPLE_RATE, 0x5); ++ ++ val8 = BIT_STATIS_BT_EN; ++ if (rtwdev->efuse.share_ant) ++ val8 |= BIT_R_GRANTALL_WLMASK; ++ rtw_write8(rtwdev, REG_BT_COEX_ENH_INTR_CTRL, val8); ++ ++ /* enable BT counter statistics */ ++ rtw_write8(rtwdev, REG_BT_STAT_CTRL, 0x3); ++ ++ /* enable PTA */ ++ rtw_write32_set(rtwdev, REG_GPIO_MUXCFG, BIT_BT_PTA_EN); ++} ++ ++static void rtw8821a_coex_cfg_ant_switch(struct rtw_dev *rtwdev, u8 ctrl_type, ++ u8 pos_type) ++{ ++ bool share_ant = rtwdev->efuse.share_ant; ++ struct rtw_coex *coex = &rtwdev->coex; ++ struct rtw_coex_dm *coex_dm = &coex->dm; ++ u32 phase = coex_dm->cur_ant_pos_type; ++ ++ if (!rtwdev->efuse.btcoex) ++ return; ++ ++ switch (phase) { ++ case COEX_SET_ANT_POWERON: ++ case COEX_SET_ANT_INIT: ++ rtw_write32_clr(rtwdev, REG_LED_CFG, BIT_DPDT_SEL_EN); ++ rtw_write32_set(rtwdev, REG_LED_CFG, BIT_DPDT_WL_SEL); ++ rtw_write8_set(rtwdev, REG_GNT_BT, BIT_PTA_SW_CTL); ++ ++ rtw_write8(rtwdev, REG_RFE_CTRL8, ++ share_ant ? PTA_CTRL_PIN : DPDT_CTRL_PIN); ++ rtw_write32_mask(rtwdev, REG_RFE_CTRL8, 0x30000000, 0x1); ++ break; ++ case COEX_SET_ANT_WONLY: ++ rtw_write32_clr(rtwdev, REG_LED_CFG, BIT_DPDT_SEL_EN); ++ rtw_write32_set(rtwdev, REG_LED_CFG, BIT_DPDT_WL_SEL); ++ rtw_write8_clr(rtwdev, REG_GNT_BT, BIT_PTA_SW_CTL); ++ ++ rtw_write8(rtwdev, REG_RFE_CTRL8, DPDT_CTRL_PIN); ++ rtw_write32_mask(rtwdev, REG_RFE_CTRL8, 0x30000000, 0x1); ++ break; ++ case COEX_SET_ANT_2G: ++ rtw_write32_clr(rtwdev, REG_LED_CFG, BIT_DPDT_SEL_EN); ++ rtw_write32_set(rtwdev, REG_LED_CFG, BIT_DPDT_WL_SEL); ++ rtw_write8_clr(rtwdev, REG_GNT_BT, BIT_PTA_SW_CTL); ++ ++ rtw_write8(rtwdev, REG_RFE_CTRL8, ++ share_ant ? PTA_CTRL_PIN : DPDT_CTRL_PIN); ++ rtw_write32_mask(rtwdev, REG_RFE_CTRL8, 0x30000000, 0x1); ++ break; ++ case COEX_SET_ANT_5G: ++ rtw_write32_clr(rtwdev, REG_LED_CFG, BIT_DPDT_SEL_EN); ++ rtw_write32_set(rtwdev, REG_LED_CFG, BIT_DPDT_WL_SEL); ++ rtw_write8_set(rtwdev, REG_GNT_BT, BIT_PTA_SW_CTL); ++ ++ rtw_write8(rtwdev, REG_RFE_CTRL8, DPDT_CTRL_PIN); ++ rtw_write32_mask(rtwdev, REG_RFE_CTRL8, 0x30000000, ++ share_ant ? 0x2 : 0x1); ++ break; ++ case COEX_SET_ANT_WOFF: ++ rtw_write32_clr(rtwdev, REG_LED_CFG, BIT_DPDT_SEL_EN); ++ rtw_write32_clr(rtwdev, REG_LED_CFG, BIT_DPDT_WL_SEL); ++ rtw_write8_set(rtwdev, REG_GNT_BT, BIT_PTA_SW_CTL); ++ ++ rtw_write8(rtwdev, REG_RFE_CTRL8, DPDT_CTRL_PIN); ++ rtw_write32_mask(rtwdev, REG_RFE_CTRL8, 0x30000000, ++ share_ant ? 0x2 : 0x1); ++ break; ++ default: ++ rtw_warn(rtwdev, "%s: not handling phase %d\n", ++ __func__, phase); ++ break; ++ } ++} ++ ++static void rtw8821a_coex_cfg_gnt_fix(struct rtw_dev *rtwdev) ++{ ++} ++ ++static void rtw8821a_coex_cfg_gnt_debug(struct rtw_dev *rtwdev) ++{ ++} ++ ++static void rtw8821a_coex_cfg_rfe_type(struct rtw_dev *rtwdev) ++{ ++ struct rtw_coex *coex = &rtwdev->coex; ++ struct rtw_coex_rfe *coex_rfe = &coex->rfe; ++ ++ coex_rfe->ant_switch_exist = true; ++} ++ ++static void rtw8821a_coex_cfg_wl_tx_power(struct rtw_dev *rtwdev, u8 wl_pwr) ++{ ++ struct rtw_coex *coex = &rtwdev->coex; ++ struct rtw_coex_dm *coex_dm = &coex->dm; ++ struct rtw_efuse *efuse = &rtwdev->efuse; ++ bool share_ant = efuse->share_ant; ++ ++ if (share_ant) ++ return; ++ ++ if (wl_pwr == coex_dm->cur_wl_pwr_lvl) ++ return; ++ ++ coex_dm->cur_wl_pwr_lvl = wl_pwr; ++} ++ ++static void rtw8821a_coex_cfg_wl_rx_gain(struct rtw_dev *rtwdev, bool low_gain) ++{ ++} ++ ++static const struct rtw_chip_ops rtw8821a_ops = { ++ .power_on = rtw88xxa_power_on, ++ .power_off = rtw8821a_power_off, ++ .phy_set_param = NULL, ++ .read_efuse = rtw88xxa_read_efuse, ++ .query_phy_status = rtw8821a_query_phy_status, ++ .set_channel = rtw88xxa_set_channel, ++ .mac_init = NULL, ++ .read_rf = rtw88xxa_phy_read_rf, ++ .write_rf = rtw_phy_write_rf_reg_sipi, ++ .set_antenna = NULL, ++ .set_tx_power_index = rtw88xxa_set_tx_power_index, ++ .cfg_ldo25 = rtw8821a_cfg_ldo25, ++ .efuse_grant = rtw88xxa_efuse_grant, ++ .false_alarm_statistics = rtw88xxa_false_alarm_statistics, ++ .phy_calibration = rtw8821a_phy_calibration, ++ .cck_pd_set = rtw88xxa_phy_cck_pd_set, ++ .pwr_track = rtw8821a_pwr_track, ++ .config_bfee = NULL, ++ .set_gid_table = NULL, ++ .cfg_csi_rate = NULL, ++ .fill_txdesc_checksum = rtw8821a_fill_txdesc_checksum, ++ .coex_set_init = rtw8821a_coex_cfg_init, ++ .coex_set_ant_switch = rtw8821a_coex_cfg_ant_switch, ++ .coex_set_gnt_fix = rtw8821a_coex_cfg_gnt_fix, ++ .coex_set_gnt_debug = rtw8821a_coex_cfg_gnt_debug, ++ .coex_set_rfe_type = rtw8821a_coex_cfg_rfe_type, ++ .coex_set_wl_tx_power = rtw8821a_coex_cfg_wl_tx_power, ++ .coex_set_wl_rx_gain = rtw8821a_coex_cfg_wl_rx_gain, ++}; ++ ++static const struct rtw_page_table page_table_8821a[] = { ++ /* hq_num, nq_num, lq_num, exq_num, gapq_num */ ++ {0, 0, 0, 0, 0}, /* SDIO */ ++ {0, 0, 0, 0, 0}, /* PCI */ ++ {8, 0, 0, 0, 1}, /* 2 bulk out endpoints */ ++ {8, 0, 8, 0, 1}, /* 3 bulk out endpoints */ ++ {8, 0, 8, 4, 1}, /* 4 bulk out endpoints */ ++}; ++ ++static const struct rtw_rqpn rqpn_table_8821a[] = { ++ {RTW_DMA_MAPPING_NORMAL, RTW_DMA_MAPPING_NORMAL, ++ RTW_DMA_MAPPING_LOW, RTW_DMA_MAPPING_LOW, ++ RTW_DMA_MAPPING_EXTRA, RTW_DMA_MAPPING_HIGH}, ++ ++ {RTW_DMA_MAPPING_NORMAL, RTW_DMA_MAPPING_NORMAL, ++ RTW_DMA_MAPPING_LOW, RTW_DMA_MAPPING_LOW, ++ RTW_DMA_MAPPING_EXTRA, RTW_DMA_MAPPING_HIGH}, ++ ++ {RTW_DMA_MAPPING_HIGH, RTW_DMA_MAPPING_HIGH, ++ RTW_DMA_MAPPING_NORMAL, RTW_DMA_MAPPING_NORMAL, ++ RTW_DMA_MAPPING_HIGH, RTW_DMA_MAPPING_HIGH}, ++ ++ {RTW_DMA_MAPPING_HIGH, RTW_DMA_MAPPING_NORMAL, ++ RTW_DMA_MAPPING_LOW, RTW_DMA_MAPPING_LOW, ++ RTW_DMA_MAPPING_HIGH, RTW_DMA_MAPPING_HIGH}, ++ ++ {RTW_DMA_MAPPING_NORMAL, RTW_DMA_MAPPING_NORMAL, ++ RTW_DMA_MAPPING_LOW, RTW_DMA_MAPPING_LOW, ++ RTW_DMA_MAPPING_EXTRA, RTW_DMA_MAPPING_HIGH}, ++}; ++ ++static const struct rtw_prioq_addrs prioq_addrs_8821a = { ++ .prio[RTW_DMA_MAPPING_EXTRA] = { ++ .rsvd = REG_RQPN_NPQ + 2, .avail = REG_RQPN_NPQ + 3, ++ }, ++ .prio[RTW_DMA_MAPPING_LOW] = { ++ .rsvd = REG_RQPN + 1, .avail = REG_FIFOPAGE_CTRL_2 + 1, ++ }, ++ .prio[RTW_DMA_MAPPING_NORMAL] = { ++ .rsvd = REG_RQPN_NPQ, .avail = REG_RQPN_NPQ + 1, ++ }, ++ .prio[RTW_DMA_MAPPING_HIGH] = { ++ .rsvd = REG_RQPN, .avail = REG_FIFOPAGE_CTRL_2, ++ }, ++ .wsize = false, ++}; ++ ++static const struct rtw_hw_reg rtw8821a_dig[] = { ++ [0] = { .addr = REG_RXIGI_A, .mask = 0x7f }, ++}; ++ ++static const struct rtw_rfe_def rtw8821a_rfe_defs[] = { ++ [0] = { .phy_pg_tbl = &rtw8821a_bb_pg_tbl, ++ .txpwr_lmt_tbl = &rtw8821a_txpwr_lmt_tbl, ++ .pwr_track_tbl = &rtw8821a_rtw_pwr_track_tbl, }, ++}; ++ ++/* TODO */ ++/* rssi in percentage % (dbm = % - 100) */ ++static const u8 wl_rssi_step_8821a[] = {101, 45, 101, 40}; ++static const u8 bt_rssi_step_8821a[] = {101, 101, 101, 101}; ++ ++/* table_sant_8821a, table_nsant_8821a, tdma_sant_8821a, and tdma_nsant_8821a ++ * are copied from rtw8821c.c because the 8821au driver's tables are not ++ * compatible with the coex code in rtw88. ++ * ++ * tdma case 112 (A2DP) byte 0 had to be modified from 0x61 to 0x51, ++ * otherwise the firmware gets confused after pausing the music: ++ * rtw_8821au 1-2:1.2: [BTCoex], Bt_info[1], len=7, data=[81 00 0a 01 00 00] ++ * - 81 means PAN (personal area network) when it should be 4x (A2DP) ++ * The music is not smooth with the PAN algorithm. ++ */ ++ ++/* Shared-Antenna Coex Table */ ++static const struct coex_table_para table_sant_8821a[] = { ++ {0x55555555, 0x55555555}, /* case-0 */ ++ {0x55555555, 0x55555555}, ++ {0x66555555, 0x66555555}, ++ {0xaaaaaaaa, 0xaaaaaaaa}, ++ {0x5a5a5a5a, 0x5a5a5a5a}, ++ {0xfafafafa, 0xfafafafa}, /* case-5 */ ++ {0x6a5a5555, 0xaaaaaaaa}, ++ {0x6a5a56aa, 0x6a5a56aa}, ++ {0x6a5a5a5a, 0x6a5a5a5a}, ++ {0x66555555, 0x5a5a5a5a}, ++ {0x66555555, 0x6a5a5a5a}, /* case-10 */ ++ {0x66555555, 0xaaaaaaaa}, ++ {0x66555555, 0x6a5a5aaa}, ++ {0x66555555, 0x6aaa6aaa}, ++ {0x66555555, 0x6a5a5aaa}, ++ {0x66555555, 0xaaaaaaaa}, /* case-15 */ ++ {0xffff55ff, 0xfafafafa}, ++ {0xffff55ff, 0x6afa5afa}, ++ {0xaaffffaa, 0xfafafafa}, ++ {0xaa5555aa, 0x5a5a5a5a}, ++ {0xaa5555aa, 0x6a5a5a5a}, /* case-20 */ ++ {0xaa5555aa, 0xaaaaaaaa}, ++ {0xffffffff, 0x55555555}, ++ {0xffffffff, 0x5a5a5a5a}, ++ {0xffffffff, 0x5a5a5a5a}, ++ {0xffffffff, 0x5a5a5aaa}, /* case-25 */ ++ {0x55555555, 0x5a5a5a5a}, ++ {0x55555555, 0xaaaaaaaa}, ++ {0x66555555, 0x6a5a6a5a}, ++ {0x66556655, 0x66556655}, ++ {0x66556aaa, 0x6a5a6aaa}, /* case-30 */ ++ {0xffffffff, 0x5aaa5aaa}, ++ {0x56555555, 0x5a5a5aaa} ++}; ++ ++/* Non-Shared-Antenna Coex Table */ ++static const struct coex_table_para table_nsant_8821a[] = { ++ {0xffffffff, 0xffffffff}, /* case-100 */ ++ {0xffff55ff, 0xfafafafa}, ++ {0x66555555, 0x66555555}, ++ {0xaaaaaaaa, 0xaaaaaaaa}, ++ {0x5a5a5a5a, 0x5a5a5a5a}, ++ {0xffffffff, 0xffffffff}, /* case-105 */ ++ {0x5afa5afa, 0x5afa5afa}, ++ {0x55555555, 0xfafafafa}, ++ {0x66555555, 0xfafafafa}, ++ {0x66555555, 0x5a5a5a5a}, ++ {0x66555555, 0x6a5a5a5a}, /* case-110 */ ++ {0x66555555, 0xaaaaaaaa}, ++ {0xffff55ff, 0xfafafafa}, ++ {0xffff55ff, 0x5afa5afa}, ++ {0xffff55ff, 0xaaaaaaaa}, ++ {0xffff55ff, 0xffff55ff}, /* case-115 */ ++ {0xaaffffaa, 0x5afa5afa}, ++ {0xaaffffaa, 0xaaaaaaaa}, ++ {0xffffffff, 0xfafafafa}, ++ {0xffff55ff, 0xfafafafa}, ++ {0xffffffff, 0xaaaaaaaa}, /* case-120 */ ++ {0xffff55ff, 0x5afa5afa}, ++ {0xffff55ff, 0x5afa5afa}, ++ {0x55ff55ff, 0x55ff55ff} ++}; ++ ++/* Shared-Antenna TDMA */ ++static const struct coex_tdma_para tdma_sant_8821a[] = { ++ { {0x00, 0x00, 0x00, 0x00, 0x00} }, /* case-0 */ ++ { {0x61, 0x45, 0x03, 0x11, 0x11} }, /* case-1 */ ++ { {0x61, 0x3a, 0x03, 0x11, 0x11} }, ++ { {0x61, 0x35, 0x03, 0x11, 0x11} }, ++ { {0x61, 0x20, 0x03, 0x11, 0x11} }, ++ { {0x61, 0x3a, 0x03, 0x11, 0x11} }, /* case-5 */ ++ { {0x61, 0x45, 0x03, 0x11, 0x10} }, ++ { {0x61, 0x35, 0x03, 0x11, 0x10} }, ++ { {0x61, 0x30, 0x03, 0x11, 0x10} }, ++ { {0x61, 0x20, 0x03, 0x11, 0x10} }, ++ { {0x61, 0x10, 0x03, 0x11, 0x10} }, /* case-10 */ ++ { {0x61, 0x08, 0x03, 0x11, 0x15} }, ++ { {0x61, 0x08, 0x03, 0x10, 0x14} }, ++ { {0x51, 0x08, 0x03, 0x10, 0x54} }, ++ { {0x51, 0x08, 0x03, 0x10, 0x55} }, ++ { {0x51, 0x08, 0x07, 0x10, 0x54} }, /* case-15 */ ++ { {0x51, 0x45, 0x03, 0x10, 0x50} }, ++ { {0x51, 0x3a, 0x03, 0x11, 0x50} }, ++ { {0x51, 0x30, 0x03, 0x10, 0x50} }, ++ { {0x51, 0x21, 0x03, 0x10, 0x50} }, ++ { {0x51, 0x10, 0x03, 0x10, 0x50} }, /* case-20 */ ++ { {0x51, 0x4a, 0x03, 0x10, 0x50} }, ++ { {0x51, 0x08, 0x03, 0x30, 0x54} }, ++ { {0x55, 0x08, 0x03, 0x10, 0x54} }, ++ { {0x65, 0x10, 0x03, 0x11, 0x10} }, ++ { {0x51, 0x10, 0x03, 0x10, 0x51} }, /* case-25 */ ++ { {0x51, 0x21, 0x03, 0x10, 0x50} }, ++ { {0x61, 0x08, 0x03, 0x11, 0x11} } ++}; ++ ++/* Non-Shared-Antenna TDMA */ ++static const struct coex_tdma_para tdma_nsant_8821a[] = { ++ { {0x00, 0x00, 0x00, 0x40, 0x00} }, /* case-100 */ ++ { {0x61, 0x45, 0x03, 0x11, 0x11} }, ++ { {0x61, 0x25, 0x03, 0x11, 0x11} }, ++ { {0x61, 0x35, 0x03, 0x11, 0x11} }, ++ { {0x61, 0x20, 0x03, 0x11, 0x11} }, ++ { {0x61, 0x10, 0x03, 0x11, 0x11} }, /* case-105 */ ++ { {0x61, 0x45, 0x03, 0x11, 0x10} }, ++ { {0x61, 0x30, 0x03, 0x11, 0x10} }, ++ { {0x61, 0x30, 0x03, 0x11, 0x10} }, ++ { {0x61, 0x20, 0x03, 0x11, 0x10} }, ++ { {0x61, 0x10, 0x03, 0x11, 0x10} }, /* case-110 */ ++ { {0x61, 0x10, 0x03, 0x11, 0x11} }, ++ { {0x51, 0x08, 0x03, 0x10, 0x14} }, /* a2dp high rssi */ ++ { {0x51, 0x08, 0x03, 0x10, 0x54} }, /* a2dp not high rssi */ ++ { {0x51, 0x08, 0x03, 0x10, 0x55} }, ++ { {0x51, 0x08, 0x07, 0x10, 0x54} }, /* case-115 */ ++ { {0x51, 0x45, 0x03, 0x10, 0x50} }, ++ { {0x51, 0x3a, 0x03, 0x10, 0x50} }, ++ { {0x51, 0x30, 0x03, 0x10, 0x50} }, ++ { {0x51, 0x21, 0x03, 0x10, 0x50} }, ++ { {0x51, 0x21, 0x03, 0x10, 0x50} }, /* case-120 */ ++ { {0x51, 0x10, 0x03, 0x10, 0x50} } ++}; ++ ++/* TODO */ ++static const struct coex_rf_para rf_para_tx_8821a[] = { ++ {0, 0, false, 7}, /* for normal */ ++ {0, 20, false, 7}, /* for WL-CPT */ ++ {8, 17, true, 4}, ++ {7, 18, true, 4}, ++ {6, 19, true, 4}, ++ {5, 20, true, 4} ++}; ++ ++static const struct coex_rf_para rf_para_rx_8821a[] = { ++ {0, 0, false, 7}, /* for normal */ ++ {0, 20, false, 7}, /* for WL-CPT */ ++ {3, 24, true, 5}, ++ {2, 26, true, 5}, ++ {1, 27, true, 5}, ++ {0, 28, true, 5} ++}; ++ ++static_assert(ARRAY_SIZE(rf_para_tx_8821a) == ARRAY_SIZE(rf_para_rx_8821a)); ++ ++static const struct coex_5g_afh_map afh_5g_8821a[] = { {0, 0, 0} }; ++ ++static const struct rtw_reg_domain coex_info_hw_regs_8821a[] = { ++ {0xCB0, MASKDWORD, RTW_REG_DOMAIN_MAC32}, ++ {0xCB4, MASKDWORD, RTW_REG_DOMAIN_MAC32}, ++ {0xCBA, MASKBYTE0, RTW_REG_DOMAIN_MAC8}, ++ {0, 0, RTW_REG_DOMAIN_NL}, ++ {0x430, MASKDWORD, RTW_REG_DOMAIN_MAC32}, ++ {0x434, MASKDWORD, RTW_REG_DOMAIN_MAC32}, ++ {0x42a, MASKLWORD, RTW_REG_DOMAIN_MAC16}, ++ {0x426, MASKBYTE0, RTW_REG_DOMAIN_MAC8}, ++ {0x45e, BIT(3), RTW_REG_DOMAIN_MAC8}, ++ {0x454, MASKLWORD, RTW_REG_DOMAIN_MAC16}, ++ {0, 0, RTW_REG_DOMAIN_NL}, ++ {0x4c, BIT(24) | BIT(23), RTW_REG_DOMAIN_MAC32}, ++ {0x64, BIT(0), RTW_REG_DOMAIN_MAC8}, ++ {0x4c6, BIT(4), RTW_REG_DOMAIN_MAC8}, ++ {0x40, BIT(5), RTW_REG_DOMAIN_MAC8}, ++ {0x1, RFREG_MASK, RTW_REG_DOMAIN_RF_A}, ++ {0, 0, RTW_REG_DOMAIN_NL}, ++ {0x550, MASKDWORD, RTW_REG_DOMAIN_MAC32}, ++ {0x522, MASKBYTE0, RTW_REG_DOMAIN_MAC8}, ++ {0x953, BIT(1), RTW_REG_DOMAIN_MAC8}, ++ {0xc50, MASKBYTE0, RTW_REG_DOMAIN_MAC8}, ++ {0x60A, MASKBYTE0, RTW_REG_DOMAIN_MAC8}, ++}; ++ ++const struct rtw_chip_info rtw8821a_hw_spec = { ++ .ops = &rtw8821a_ops, ++ .id = RTW_CHIP_TYPE_8821A, ++ .fw_name = "rtw88/rtw8821a_fw.bin", ++ .wlan_cpu = RTW_WCPU_11N, ++ .tx_pkt_desc_sz = 40, ++ .tx_buf_desc_sz = 16, ++ .rx_pkt_desc_sz = 24, ++ .rx_buf_desc_sz = 8, ++ .phy_efuse_size = 512, ++ .log_efuse_size = 512, ++ .ptct_efuse_size = 96 + 1, /* TODO or just 18? */ ++ .txff_size = 65536, ++ .rxff_size = 16128, ++ .rsvd_drv_pg_num = 8, ++ .txgi_factor = 1, ++ .is_pwr_by_rate_dec = true, ++ .max_power_index = 0x3f, ++ .csi_buf_pg_num = 0, ++ .band = RTW_BAND_2G | RTW_BAND_5G, ++ .page_size = 256, ++ .dig_min = 0x20, ++ .ht_supported = true, ++ .vht_supported = true, ++ .lps_deep_mode_supported = 0, ++ .sys_func_en = 0xFD, ++ .pwr_on_seq = card_enable_flow_8821a, ++ .pwr_off_seq = card_disable_flow_8821a, ++ .page_table = page_table_8821a, ++ .rqpn_table = rqpn_table_8821a, ++ .prioq_addrs = &prioq_addrs_8821a, ++ .intf_table = NULL, ++ .dig = rtw8821a_dig, ++ .rf_sipi_addr = {REG_LSSI_WRITE_A, REG_LSSI_WRITE_B}, ++ .ltecoex_addr = NULL, ++ .mac_tbl = &rtw8821a_mac_tbl, ++ .agc_tbl = &rtw8821a_agc_tbl, ++ .bb_tbl = &rtw8821a_bb_tbl, ++ .rf_tbl = {&rtw8821a_rf_a_tbl}, ++ .rfe_defs = rtw8821a_rfe_defs, ++ .rfe_defs_size = ARRAY_SIZE(rtw8821a_rfe_defs), ++ .rx_ldpc = false, ++ .hw_feature_report = false, ++ .c2h_ra_report_size = 4, ++ .old_datarate_fb_limit = true, ++ .usb_tx_agg_desc_num = 6, ++ .iqk_threshold = 8, ++ .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, ++ .max_scan_ie_len = IEEE80211_MAX_DATA_LEN, ++ ++ .coex_para_ver = 20190509, /* glcoex_ver_date_8821a_1ant */ ++ .bt_desired_ver = 0x62, /* But for 2 ant it's 0x5c */ ++ .scbd_support = false, ++ .new_scbd10_def = false, ++ .ble_hid_profile_support = false, ++ .wl_mimo_ps_support = false, ++ .pstdma_type = COEX_PSTDMA_FORCE_LPSOFF, ++ .bt_rssi_type = COEX_BTRSSI_RATIO, ++ .ant_isolation = 10, ++ .rssi_tolerance = 2, ++ .wl_rssi_step = wl_rssi_step_8821a, ++ .bt_rssi_step = bt_rssi_step_8821a, ++ .table_sant_num = ARRAY_SIZE(table_sant_8821a), ++ .table_sant = table_sant_8821a, ++ .table_nsant_num = ARRAY_SIZE(table_nsant_8821a), ++ .table_nsant = table_nsant_8821a, ++ .tdma_sant_num = ARRAY_SIZE(tdma_sant_8821a), ++ .tdma_sant = tdma_sant_8821a, ++ .tdma_nsant_num = ARRAY_SIZE(tdma_nsant_8821a), ++ .tdma_nsant = tdma_nsant_8821a, ++ .wl_rf_para_num = ARRAY_SIZE(rf_para_tx_8821a), ++ .wl_rf_para_tx = rf_para_tx_8821a, ++ .wl_rf_para_rx = rf_para_rx_8821a, ++ .bt_afh_span_bw20 = 0x20, ++ .bt_afh_span_bw40 = 0x30, ++ .afh_5g_num = ARRAY_SIZE(afh_5g_8821a), ++ .afh_5g = afh_5g_8821a, ++ ++ .coex_info_hw_regs_num = ARRAY_SIZE(coex_info_hw_regs_8821a), ++ .coex_info_hw_regs = coex_info_hw_regs_8821a, ++}; ++EXPORT_SYMBOL(rtw8821a_hw_spec); ++ ++MODULE_FIRMWARE("rtw88/rtw8821a_fw.bin"); ++ ++MODULE_AUTHOR("Realtek Corporation"); ++MODULE_DESCRIPTION("Realtek 802.11ac wireless 8821a/8811a driver"); ++MODULE_LICENSE("Dual BSD/GPL"); +--- /dev/null ++++ b/drivers/net/wireless/realtek/rtw88/rtw8821a.h +@@ -0,0 +1,10 @@ ++/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ ++/* Copyright(c) 2024 Realtek Corporation ++ */ ++ ++#ifndef __RTW8821A_H__ ++#define __RTW8821A_H__ ++ ++extern const struct rtw_chip_info rtw8821a_hw_spec; ++ ++#endif diff --git a/package/kernel/mac80211/patches/rtl/043-v6.13-wifi-rtw88-Add-rtw8812a.-c-h.patch b/package/kernel/mac80211/patches/rtl/043-v6.13-wifi-rtw88-Add-rtw8812a.-c-h.patch new file mode 100644 index 00000000000000..610dca037a2367 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/043-v6.13-wifi-rtw88-Add-rtw8812a.-c-h.patch @@ -0,0 +1,1135 @@ +From 4f8ec8927bc292b2a71cd5a253c96ce3c6b2927f Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Wed, 30 Oct 2024 20:28:49 +0200 +Subject: [PATCH] wifi: rtw88: Add rtw8812a.{c,h} + +These contain code specific to RTL8812AU. + +Signed-off-by: Bitterblue Smith +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/a0057683-79eb-4ab2-8f74-11a3bc58adfb@gmail.com +--- + drivers/net/wireless/realtek/rtw88/rtw8812a.c | 1102 +++++++++++++++++ + drivers/net/wireless/realtek/rtw88/rtw8812a.h | 10 + + 2 files changed, 1112 insertions(+) + create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8812a.c + create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8812a.h + +--- /dev/null ++++ b/drivers/net/wireless/realtek/rtw88/rtw8812a.c +@@ -0,0 +1,1102 @@ ++// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause ++/* Copyright(c) 2024 Realtek Corporation ++ */ ++ ++#include "main.h" ++#include "coex.h" ++#include "phy.h" ++#include "reg.h" ++#include "rtw88xxa.h" ++#include "rtw8812a.h" ++#include "rtw8812a_table.h" ++#include "tx.h" ++ ++static void rtw8812a_power_off(struct rtw_dev *rtwdev) ++{ ++ rtw88xxa_power_off(rtwdev, enter_lps_flow_8812a); ++} ++ ++static s8 rtw8812a_cck_rx_pwr(u8 lna_idx, u8 vga_idx) ++{ ++ s8 rx_pwr_all = 0; ++ ++ switch (lna_idx) { ++ case 7: ++ if (vga_idx <= 27) ++ rx_pwr_all = -94 + 2 * (27 - vga_idx); ++ else ++ rx_pwr_all = -94; ++ break; ++ case 6: ++ rx_pwr_all = -42 + 2 * (2 - vga_idx); ++ break; ++ case 5: ++ rx_pwr_all = -36 + 2 * (7 - vga_idx); ++ break; ++ case 4: ++ rx_pwr_all = -30 + 2 * (7 - vga_idx); ++ break; ++ case 3: ++ rx_pwr_all = -18 + 2 * (7 - vga_idx); ++ break; ++ case 2: ++ rx_pwr_all = 2 * (5 - vga_idx); ++ break; ++ case 1: ++ rx_pwr_all = 14 - 2 * vga_idx; ++ break; ++ case 0: ++ rx_pwr_all = 20 - 2 * vga_idx; ++ break; ++ default: ++ break; ++ } ++ ++ return rx_pwr_all; ++} ++ ++static void rtw8812a_query_phy_status(struct rtw_dev *rtwdev, u8 *phy_status, ++ struct rtw_rx_pkt_stat *pkt_stat) ++{ ++ rtw88xxa_query_phy_status(rtwdev, phy_status, pkt_stat, ++ rtw8812a_cck_rx_pwr); ++ ++ if (pkt_stat->rate >= DESC_RATE6M) ++ return; ++ ++ if (rtwdev->hal.cck_high_power) ++ return; ++ ++ if (pkt_stat->rssi >= 80) ++ pkt_stat->rssi = ((pkt_stat->rssi - 80) << 1) + ++ ((pkt_stat->rssi - 80) >> 1) + 80; ++ else if (pkt_stat->rssi <= 78 && pkt_stat->rssi >= 20) ++ pkt_stat->rssi += 3; ++} ++ ++static void rtw8812a_cfg_ldo25(struct rtw_dev *rtwdev, bool enable) ++{ ++} ++ ++static void rtw8812a_do_lck(struct rtw_dev *rtwdev) ++{ ++ u32 cont_tx, lc_cal, i; ++ ++ cont_tx = rtw_read32_mask(rtwdev, REG_SINGLE_TONE_CONT_TX, 0x70000); ++ ++ lc_cal = rtw_read_rf(rtwdev, RF_PATH_A, RF_CFGCH, RFREG_MASK); ++ ++ if (!cont_tx) ++ rtw_write8(rtwdev, REG_TXPAUSE, 0xff); ++ ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_LCK, BIT(14), 1); ++ ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_CFGCH, 0x08000, 1); ++ ++ mdelay(150); ++ ++ for (i = 0; i < 5; i++) { ++ if (rtw_read_rf(rtwdev, RF_PATH_A, RF_CFGCH, 0x08000) != 1) ++ break; ++ ++ mdelay(10); ++ } ++ ++ if (i == 5) ++ rtw_dbg(rtwdev, RTW_DBG_RFK, "LCK timed out\n"); ++ ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_CFGCH, RFREG_MASK, lc_cal); ++ ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_LCK, BIT(14), 0); ++ ++ if (!cont_tx) ++ rtw_write8(rtwdev, REG_TXPAUSE, 0); ++ ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_CFGCH, RFREG_MASK, lc_cal); ++} ++ ++static void rtw8812a_iqk_backup_rf(struct rtw_dev *rtwdev, u32 *rfa_backup, ++ u32 *rfb_backup, const u32 *backup_rf_reg, ++ u32 rf_num) ++{ ++ u32 i; ++ ++ /* [31] = 0 --> Page C */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x0); ++ ++ /* Save RF Parameters */ ++ for (i = 0; i < rf_num; i++) { ++ rfa_backup[i] = rtw_read_rf(rtwdev, RF_PATH_A, ++ backup_rf_reg[i], MASKDWORD); ++ rfb_backup[i] = rtw_read_rf(rtwdev, RF_PATH_B, ++ backup_rf_reg[i], MASKDWORD); ++ } ++} ++ ++static void rtw8812a_iqk_restore_rf(struct rtw_dev *rtwdev, ++ enum rtw_rf_path path, ++ const u32 *backup_rf_reg, ++ u32 *RF_backup, u32 rf_reg_num) ++{ ++ u32 i; ++ ++ /* [31] = 0 --> Page C */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x0); ++ ++ for (i = 0; i < rf_reg_num; i++) ++ rtw_write_rf(rtwdev, path, backup_rf_reg[i], ++ RFREG_MASK, RF_backup[i]); ++ ++ rtw_write_rf(rtwdev, path, RF_LUTWE, RFREG_MASK, 0); ++} ++ ++static void rtw8812a_iqk_restore_afe(struct rtw_dev *rtwdev, u32 *afe_backup, ++ const u32 *backup_afe_reg, u32 afe_num) ++{ ++ u32 i; ++ ++ /* [31] = 0 --> Page C */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x0); ++ ++ /* Reload AFE Parameters */ ++ for (i = 0; i < afe_num; i++) ++ rtw_write32(rtwdev, backup_afe_reg[i], afe_backup[i]); ++ ++ /* [31] = 1 --> Page C1 */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x1); ++ ++ rtw_write32(rtwdev, REG_OFDM0_XA_TX_IQ_IMBALANCE, 0x0); ++ rtw_write32(rtwdev, REG_OFDM0_A_TX_AFE, 0x0); ++ rtw_write32(rtwdev, REG_OFDM0_XB_TX_IQ_IMBALANCE, 0x0); ++ rtw_write32(rtwdev, REG_TSSI_TRK_SW, 0x3c000000); ++ rtw_write32_mask(rtwdev, REG_LSSI_WRITE_A, BIT(7), 1); ++ rtw_write32_mask(rtwdev, REG_IQK_DPD_CFG, BIT(18), 1); ++ rtw_write32_mask(rtwdev, REG_IQK_DPD_CFG, BIT(29), 1); ++ rtw_write32_mask(rtwdev, REG_CFG_PMPD, BIT(29), 1); ++ ++ rtw_write32(rtwdev, REG_TXTONEB, 0x0); ++ rtw_write32(rtwdev, REG_RXTONEB, 0x0); ++ rtw_write32(rtwdev, REG_TXPITMB, 0x0); ++ rtw_write32(rtwdev, REG_RXPITMB, 0x3c000000); ++ rtw_write32_mask(rtwdev, REG_LSSI_WRITE_B, BIT(7), 1); ++ rtw_write32_mask(rtwdev, REG_BPBDB, BIT(18), 1); ++ rtw_write32_mask(rtwdev, REG_BPBDB, BIT(29), 1); ++ rtw_write32_mask(rtwdev, REG_PHYTXONB, BIT(29), 1); ++} ++ ++static void rtw8812a_iqk_rx_fill(struct rtw_dev *rtwdev, enum rtw_rf_path path, ++ unsigned int rx_x, unsigned int rx_y) ++{ ++ switch (path) { ++ case RF_PATH_A: ++ /* [31] = 0 --> Page C */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x0); ++ if (rx_x >> 1 >= 0x112 || ++ (rx_y >> 1 >= 0x12 && rx_y >> 1 <= 0x3ee)) { ++ rtw_write32_mask(rtwdev, REG_RX_IQC_AB_A, ++ 0x000003ff, 0x100); ++ rtw_write32_mask(rtwdev, REG_RX_IQC_AB_A, ++ 0x03ff0000, 0); ++ } else { ++ rtw_write32_mask(rtwdev, REG_RX_IQC_AB_A, ++ 0x000003ff, rx_x >> 1); ++ rtw_write32_mask(rtwdev, REG_RX_IQC_AB_A, ++ 0x03ff0000, rx_y >> 1); ++ } ++ rtw_dbg(rtwdev, RTW_DBG_RFK, ++ "rx_x = %x;;rx_y = %x ====>fill to IQC\n", ++ rx_x >> 1 & 0x000003ff, rx_y >> 1 & 0x000003ff); ++ rtw_dbg(rtwdev, RTW_DBG_RFK, "0xc10 = %x ====>fill to IQC\n", ++ rtw_read32(rtwdev, REG_RX_IQC_AB_A)); ++ break; ++ case RF_PATH_B: ++ /* [31] = 0 --> Page C */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x0); ++ if (rx_x >> 1 >= 0x112 || ++ (rx_y >> 1 >= 0x12 && rx_y >> 1 <= 0x3ee)) { ++ rtw_write32_mask(rtwdev, REG_RX_IQC_AB_B, ++ 0x000003ff, 0x100); ++ rtw_write32_mask(rtwdev, REG_RX_IQC_AB_B, ++ 0x03ff0000, 0); ++ } else { ++ rtw_write32_mask(rtwdev, REG_RX_IQC_AB_B, ++ 0x000003ff, rx_x >> 1); ++ rtw_write32_mask(rtwdev, REG_RX_IQC_AB_B, ++ 0x03ff0000, rx_y >> 1); ++ } ++ rtw_dbg(rtwdev, RTW_DBG_RFK, ++ "rx_x = %x;;rx_y = %x ====>fill to IQC\n", ++ rx_x >> 1 & 0x000003ff, rx_y >> 1 & 0x000003ff); ++ rtw_dbg(rtwdev, RTW_DBG_RFK, "0xe10 = %x====>fill to IQC\n", ++ rtw_read32(rtwdev, REG_RX_IQC_AB_B)); ++ break; ++ default: ++ break; ++ } ++} ++ ++static void rtw8812a_iqk_tx_fill(struct rtw_dev *rtwdev, enum rtw_rf_path path, ++ unsigned int tx_x, unsigned int tx_y) ++{ ++ switch (path) { ++ case RF_PATH_A: ++ /* [31] = 1 --> Page C1 */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x1); ++ rtw_write32_mask(rtwdev, REG_PREDISTA, BIT(7), 0x1); ++ rtw_write32_mask(rtwdev, REG_IQK_DPD_CFG, BIT(18), 0x1); ++ rtw_write32_mask(rtwdev, REG_IQK_DPD_CFG, BIT(29), 0x1); ++ rtw_write32_mask(rtwdev, REG_CFG_PMPD, BIT(29), 0x1); ++ rtw_write32_mask(rtwdev, REG_IQC_Y, 0x000007ff, tx_y); ++ rtw_write32_mask(rtwdev, REG_IQC_X, 0x000007ff, tx_x); ++ rtw_dbg(rtwdev, RTW_DBG_RFK, ++ "tx_x = %x;;tx_y = %x =====> fill to IQC\n", ++ tx_x & 0x000007ff, tx_y & 0x000007ff); ++ rtw_dbg(rtwdev, RTW_DBG_RFK, ++ "0xcd4 = %x;;0xccc = %x ====>fill to IQC\n", ++ rtw_read32_mask(rtwdev, REG_IQC_X, 0x000007ff), ++ rtw_read32_mask(rtwdev, REG_IQC_Y, 0x000007ff)); ++ break; ++ case RF_PATH_B: ++ /* [31] = 1 --> Page C1 */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x1); ++ rtw_write32_mask(rtwdev, REG_PREDISTB, BIT(7), 0x1); ++ rtw_write32_mask(rtwdev, REG_BPBDB, BIT(18), 0x1); ++ rtw_write32_mask(rtwdev, REG_BPBDB, BIT(29), 0x1); ++ rtw_write32_mask(rtwdev, REG_PHYTXONB, BIT(29), 0x1); ++ rtw_write32_mask(rtwdev, REG_IQKYB, 0x000007ff, tx_y); ++ rtw_write32_mask(rtwdev, REG_IQKXB, 0x000007ff, tx_x); ++ rtw_dbg(rtwdev, RTW_DBG_RFK, ++ "tx_x = %x;;tx_y = %x =====> fill to IQC\n", ++ tx_x & 0x000007ff, tx_y & 0x000007ff); ++ rtw_dbg(rtwdev, RTW_DBG_RFK, ++ "0xed4 = %x;;0xecc = %x ====>fill to IQC\n", ++ rtw_read32_mask(rtwdev, REG_IQKXB, 0x000007ff), ++ rtw_read32_mask(rtwdev, REG_IQKYB, 0x000007ff)); ++ break; ++ default: ++ break; ++ } ++} ++ ++static void rtw8812a_iqk(struct rtw_dev *rtwdev) ++{ ++ int tx_x0_temp[10], tx_y0_temp[10], tx_x1_temp[10], tx_y1_temp[10]; ++ int rx_x0_temp[10], rx_y0_temp[10], rx_x1_temp[10], rx_y1_temp[10]; ++ bool iqk0_ready = false, tx0_finish = false, rx0_finish = false; ++ bool iqk1_ready = false, tx1_finish = false, rx1_finish = false; ++ u8 tx0_avg = 0, tx1_avg = 0, rx0_avg = 0, rx1_avg = 0; ++ int tx_x0 = 0, tx_y0 = 0, tx_x1 = 0, tx_y1 = 0; ++ int rx_x0 = 0, rx_y0 = 0, rx_x1 = 0, rx_y1 = 0; ++ struct rtw_efuse *efuse = &rtwdev->efuse; ++ bool tx0_fail = true, rx0_fail = true; ++ bool tx1_fail = true, rx1_fail = true; ++ u8 cal0_retry, cal1_retry; ++ u8 delay_count; ++ ++ /* [31] = 0 --> Page C */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x0); ++ ++ /* ========path-A AFE all on======== */ ++ /* Port 0 DAC/ADC on */ ++ rtw_write32(rtwdev, REG_AFE_PWR1_A, 0x77777777); ++ rtw_write32(rtwdev, REG_AFE_PWR2_A, 0x77777777); ++ ++ /* Port 1 DAC/ADC on */ ++ rtw_write32(rtwdev, REG_AFE_PWR1_B, 0x77777777); ++ rtw_write32(rtwdev, REG_AFE_PWR2_B, 0x77777777); ++ ++ rtw_write32(rtwdev, REG_RX_WAIT_CCA_TX_CCK_RFON_A, 0x19791979); ++ rtw_write32(rtwdev, REG_RX_WAIT_CCA_TX_CCK_RFON_B, 0x19791979); ++ ++ /* hardware 3-wire off */ ++ rtw_write32_mask(rtwdev, REG_3WIRE_SWA, 0xf, 0x4); ++ rtw_write32_mask(rtwdev, REG_3WIRE_SWB, 0xf, 0x4); ++ ++ /* DAC/ADC sampling rate (160 MHz) */ ++ rtw_write32_mask(rtwdev, REG_CK_MONHA, GENMASK(26, 24), 0x7); ++ rtw_write32_mask(rtwdev, REG_CK_MONHB, GENMASK(26, 24), 0x7); ++ ++ /* [31] = 0 --> Page C */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x0); ++ /* ====== path A TX IQK RF setting ====== */ ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_LUTWE, RFREG_MASK, 0x80002); ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_MODE_TABLE_ADDR, RFREG_MASK, 0x20000); ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_MODE_TABLE_DATA0, RFREG_MASK, 0x3fffd); ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_MODE_TABLE_DATA1, RFREG_MASK, 0xfe83f); ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_TXA_PREPAD, RFREG_MASK, 0x931d5); ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_RXBB2, RFREG_MASK, 0x8a001); ++ ++ /* ====== path B TX IQK RF setting ====== */ ++ rtw_write_rf(rtwdev, RF_PATH_B, RF_LUTWE, RFREG_MASK, 0x80002); ++ rtw_write_rf(rtwdev, RF_PATH_B, RF_MODE_TABLE_ADDR, RFREG_MASK, 0x20000); ++ rtw_write_rf(rtwdev, RF_PATH_B, RF_MODE_TABLE_DATA0, RFREG_MASK, 0x3fffd); ++ rtw_write_rf(rtwdev, RF_PATH_B, RF_MODE_TABLE_DATA1, RFREG_MASK, 0xfe83f); ++ rtw_write_rf(rtwdev, RF_PATH_B, RF_TXA_PREPAD, RFREG_MASK, 0x931d5); ++ rtw_write_rf(rtwdev, RF_PATH_B, RF_RXBB2, RFREG_MASK, 0x8a001); ++ ++ rtw_write32(rtwdev, REG_DAC_RSTB, 0x00008000); ++ rtw_write32_mask(rtwdev, REG_TXAGCIDX, BIT(0), 0x1); ++ rtw_write32_mask(rtwdev, REG_INIDLYB, BIT(0), 0x1); ++ rtw_write32(rtwdev, REG_IQK_COM00, 0x29002000); /* TX (X,Y) */ ++ rtw_write32(rtwdev, REG_IQK_COM32, 0xa9002000); /* RX (X,Y) */ ++ rtw_write32(rtwdev, REG_IQK_COM96, 0x00462910); /* [0]:AGC_en, [15]:idac_K_Mask */ ++ /* [31] = 1 --> Page C1 */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x1); ++ ++ if (efuse->ext_pa_5g) { ++ if (efuse->rfe_option == 1) { ++ rtw_write32(rtwdev, REG_OFDM0_XB_TX_IQ_IMBALANCE, 0x821403e3); ++ rtw_write32(rtwdev, REG_TXPITMB, 0x821403e3); ++ } else { ++ rtw_write32(rtwdev, REG_OFDM0_XB_TX_IQ_IMBALANCE, 0x821403f7); ++ rtw_write32(rtwdev, REG_TXPITMB, 0x821403f7); ++ } ++ } else { ++ rtw_write32(rtwdev, REG_OFDM0_XB_TX_IQ_IMBALANCE, 0x821403f1); ++ rtw_write32(rtwdev, REG_TXPITMB, 0x821403f1); ++ } ++ ++ if (rtwdev->hal.current_band_type == RTW_BAND_5G) { ++ rtw_write32(rtwdev, REG_TSSI_TRK_SW, 0x68163e96); ++ rtw_write32(rtwdev, REG_RXPITMB, 0x68163e96); ++ } else { ++ rtw_write32(rtwdev, REG_TSSI_TRK_SW, 0x28163e96); ++ rtw_write32(rtwdev, REG_RXPITMB, 0x28163e96); ++ ++ if (efuse->rfe_option == 3) { ++ if (efuse->ext_pa_2g) ++ rtw_write32(rtwdev, REG_OFDM0_XB_TX_IQ_IMBALANCE, ++ 0x821403e3); ++ else ++ rtw_write32(rtwdev, REG_OFDM0_XB_TX_IQ_IMBALANCE, ++ 0x821403f7); ++ } ++ } ++ ++ /* TX_Tone_idx[9:0], TxK_Mask[29] TX_Tone = 16 */ ++ rtw_write32(rtwdev, REG_OFDM0_XA_TX_IQ_IMBALANCE, 0x18008c10); ++ /* RX_Tone_idx[9:0], RxK_Mask[29] */ ++ rtw_write32(rtwdev, REG_OFDM0_A_TX_AFE, 0x38008c10); ++ rtw_write32(rtwdev, REG_INTPO_SETA, 0x00000000); ++ /* TX_Tone_idx[9:0], TxK_Mask[29] TX_Tone = 16 */ ++ rtw_write32(rtwdev, REG_TXTONEB, 0x18008c10); ++ /* RX_Tone_idx[9:0], RxK_Mask[29] */ ++ rtw_write32(rtwdev, REG_RXTONEB, 0x38008c10); ++ rtw_write32(rtwdev, REG_INTPO_SETB, 0x00000000); ++ ++ cal0_retry = 0; ++ cal1_retry = 0; ++ while (1) { ++ /* one shot */ ++ rtw_write32(rtwdev, REG_RFECTL_A, 0x00100000); ++ rtw_write32(rtwdev, REG_RFECTL_B, 0x00100000); ++ rtw_write32(rtwdev, REG_IQK_COM64, 0xfa000000); ++ rtw_write32(rtwdev, REG_IQK_COM64, 0xf8000000); ++ ++ mdelay(10); ++ ++ rtw_write32(rtwdev, REG_RFECTL_A, 0x00000000); ++ rtw_write32(rtwdev, REG_RFECTL_B, 0x00000000); ++ ++ for (delay_count = 0; delay_count < 20; delay_count++) { ++ if (!tx0_finish) ++ iqk0_ready = rtw_read32_mask(rtwdev, ++ REG_IQKA_END, ++ BIT(10)); ++ if (!tx1_finish) ++ iqk1_ready = rtw_read32_mask(rtwdev, ++ REG_IQKB_END, ++ BIT(10)); ++ if (iqk0_ready && iqk1_ready) ++ break; ++ ++ mdelay(1); ++ } ++ ++ rtw_dbg(rtwdev, RTW_DBG_RFK, "TX delay_count = %d\n", ++ delay_count); ++ ++ if (delay_count < 20) { /* If 20ms No Result, then cal_retry++ */ ++ /* ============TXIQK Check============== */ ++ tx0_fail = rtw_read32_mask(rtwdev, REG_IQKA_END, BIT(12)); ++ tx1_fail = rtw_read32_mask(rtwdev, REG_IQKB_END, BIT(12)); ++ ++ if (!(tx0_fail || tx0_finish)) { ++ rtw_write32(rtwdev, REG_RFECTL_A, 0x02000000); ++ tx_x0_temp[tx0_avg] = rtw_read32_mask(rtwdev, ++ REG_IQKA_END, ++ 0x07ff0000); ++ rtw_write32(rtwdev, REG_RFECTL_A, 0x04000000); ++ tx_y0_temp[tx0_avg] = rtw_read32_mask(rtwdev, ++ REG_IQKA_END, ++ 0x07ff0000); ++ ++ rtw_dbg(rtwdev, RTW_DBG_RFK, ++ "tx_x0[%d] = %x ;; tx_y0[%d] = %x\n", ++ tx0_avg, tx_x0_temp[tx0_avg], ++ tx0_avg, tx_y0_temp[tx0_avg]); ++ ++ tx_x0_temp[tx0_avg] <<= 21; ++ tx_y0_temp[tx0_avg] <<= 21; ++ ++ tx0_avg++; ++ } else { ++ cal0_retry++; ++ if (cal0_retry == 10) ++ break; ++ } ++ ++ if (!(tx1_fail || tx1_finish)) { ++ rtw_write32(rtwdev, REG_RFECTL_B, 0x02000000); ++ tx_x1_temp[tx1_avg] = rtw_read32_mask(rtwdev, ++ REG_IQKB_END, ++ 0x07ff0000); ++ rtw_write32(rtwdev, REG_RFECTL_B, 0x04000000); ++ tx_y1_temp[tx1_avg] = rtw_read32_mask(rtwdev, ++ REG_IQKB_END, ++ 0x07ff0000); ++ ++ rtw_dbg(rtwdev, RTW_DBG_RFK, ++ "tx_x1[%d] = %x ;; tx_y1[%d] = %x\n", ++ tx1_avg, tx_x1_temp[tx1_avg], ++ tx1_avg, tx_y1_temp[tx1_avg]); ++ ++ tx_x1_temp[tx1_avg] <<= 21; ++ tx_y1_temp[tx1_avg] <<= 21; ++ ++ tx1_avg++; ++ } else { ++ cal1_retry++; ++ if (cal1_retry == 10) ++ break; ++ } ++ } else { ++ cal0_retry++; ++ cal1_retry++; ++ ++ rtw_dbg(rtwdev, RTW_DBG_RFK, ++ "delay 20ms TX IQK Not Ready!!!!!\n"); ++ ++ if (cal0_retry == 10) ++ break; ++ } ++ ++ if (tx0_avg >= 2) ++ tx0_finish = rtw88xxa_iqk_finish(tx0_avg, 4, ++ tx_x0_temp, tx_y0_temp, &tx_x0, &tx_y0, ++ false, false); ++ ++ if (tx1_avg >= 2) ++ tx1_finish = rtw88xxa_iqk_finish(tx1_avg, 4, ++ tx_x1_temp, tx_y1_temp, &tx_x1, &tx_y1, ++ false, false); ++ ++ rtw_dbg(rtwdev, RTW_DBG_RFK, ++ "tx0_average = %d, tx1_average = %d\n", ++ tx0_avg, tx1_avg); ++ rtw_dbg(rtwdev, RTW_DBG_RFK, ++ "tx0_finish = %d, tx1_finish = %d\n", ++ tx0_finish, tx1_finish); ++ ++ if (tx0_finish && tx1_finish) ++ break; ++ ++ if ((cal0_retry + tx0_avg) >= 10 || ++ (cal1_retry + tx1_avg) >= 10) ++ break; ++ } ++ ++ rtw_dbg(rtwdev, RTW_DBG_RFK, "TXA_cal_retry = %d\n", cal0_retry); ++ rtw_dbg(rtwdev, RTW_DBG_RFK, "TXB_cal_retry = %d\n", cal1_retry); ++ ++ /* [31] = 0 --> Page C */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x0); ++ /* Load LOK */ ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_TXMOD, 0x7fe00, ++ rtw_read_rf(rtwdev, RF_PATH_A, RF_DTXLOK, 0xffc00)); ++ rtw_write_rf(rtwdev, RF_PATH_B, RF_TXMOD, 0x7fe00, ++ rtw_read_rf(rtwdev, RF_PATH_B, RF_DTXLOK, 0xffc00)); ++ /* [31] = 1 --> Page C1 */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x1); ++ ++ /* [31] = 0 --> Page C */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x0); ++ if (tx0_finish) { ++ /* ====== path A RX IQK RF setting====== */ ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_LUTWE, RFREG_MASK, 0x80000); ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_MODE_TABLE_ADDR, RFREG_MASK, ++ 0x30000); ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_MODE_TABLE_DATA0, RFREG_MASK, ++ 0x3f7ff); ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_MODE_TABLE_DATA1, RFREG_MASK, ++ 0xfe7bf); ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_RXBB2, RFREG_MASK, 0x88001); ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_TXA_PREPAD, RFREG_MASK, 0x931d1); ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_LUTWE, RFREG_MASK, 0x00000); ++ } ++ if (tx1_finish) { ++ /* ====== path B RX IQK RF setting====== */ ++ rtw_write_rf(rtwdev, RF_PATH_B, RF_LUTWE, RFREG_MASK, 0x80000); ++ rtw_write_rf(rtwdev, RF_PATH_B, RF_MODE_TABLE_ADDR, RFREG_MASK, ++ 0x30000); ++ rtw_write_rf(rtwdev, RF_PATH_B, RF_MODE_TABLE_DATA0, RFREG_MASK, ++ 0x3f7ff); ++ rtw_write_rf(rtwdev, RF_PATH_B, RF_MODE_TABLE_DATA1, RFREG_MASK, ++ 0xfe7bf); ++ rtw_write_rf(rtwdev, RF_PATH_B, RF_RXBB2, RFREG_MASK, 0x88001); ++ rtw_write_rf(rtwdev, RF_PATH_B, RF_TXA_PREPAD, RFREG_MASK, 0x931d1); ++ rtw_write_rf(rtwdev, RF_PATH_B, RF_LUTWE, RFREG_MASK, 0x00000); ++ } ++ ++ rtw_write32_mask(rtwdev, REG_IQK_COM00, BIT(31), 0x1); ++ rtw_write32_mask(rtwdev, REG_IQK_COM00, BIT(31), 0x0); ++ rtw_write32(rtwdev, REG_DAC_RSTB, 0x00008000); ++ ++ if (rtwdev->hci.type == RTW_HCI_TYPE_PCIE) ++ rtw_write32(rtwdev, REG_IQK_COM96, 0x0046a911); ++ else ++ rtw_write32(rtwdev, REG_IQK_COM96, 0x0046a890); ++ ++ if (efuse->rfe_option == 1) { ++ rtw_write32(rtwdev, REG_RFE_PINMUX_A, 0x77777717); ++ rtw_write32(rtwdev, REG_RFE_INV_A, 0x00000077); ++ rtw_write32(rtwdev, REG_RFE_PINMUX_B, 0x77777717); ++ rtw_write32(rtwdev, REG_RFE_INV_B, 0x00000077); ++ } else { ++ rtw_write32(rtwdev, REG_RFE_PINMUX_A, 0x77777717); ++ rtw_write32(rtwdev, REG_RFE_INV_A, 0x02000077); ++ rtw_write32(rtwdev, REG_RFE_PINMUX_B, 0x77777717); ++ rtw_write32(rtwdev, REG_RFE_INV_B, 0x02000077); ++ } ++ ++ /* [31] = 1 --> Page C1 */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x1); ++ ++ if (tx0_finish) { ++ /* TX_Tone_idx[9:0], TxK_Mask[29] TX_Tone = 16 */ ++ rtw_write32(rtwdev, REG_OFDM0_XA_TX_IQ_IMBALANCE, 0x38008c10); ++ /* RX_Tone_idx[9:0], RxK_Mask[29] */ ++ rtw_write32(rtwdev, REG_OFDM0_A_TX_AFE, 0x18008c10); ++ rtw_write32(rtwdev, REG_OFDM0_XB_TX_IQ_IMBALANCE, 0x82140119); ++ } ++ if (tx1_finish) { ++ /* TX_Tone_idx[9:0], TxK_Mask[29] TX_Tone = 16 */ ++ rtw_write32(rtwdev, REG_TXTONEB, 0x38008c10); ++ /* RX_Tone_idx[9:0], RxK_Mask[29] */ ++ rtw_write32(rtwdev, REG_RXTONEB, 0x18008c10); ++ rtw_write32(rtwdev, REG_TXPITMB, 0x82140119); ++ } ++ ++ cal0_retry = 0; ++ cal1_retry = 0; ++ while (1) { ++ /* one shot */ ++ /* [31] = 0 --> Page C */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x0); ++ ++ if (tx0_finish) { ++ rtw_write32_mask(rtwdev, REG_IQK_COM00, 0x03FF8000, ++ tx_x0 & 0x000007ff); ++ rtw_write32_mask(rtwdev, REG_IQK_COM00, 0x000007FF, ++ tx_y0 & 0x000007ff); ++ /* [31] = 1 --> Page C1 */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x1); ++ if (efuse->rfe_option == 1) ++ rtw_write32(rtwdev, REG_TSSI_TRK_SW, 0x28161500); ++ else ++ rtw_write32(rtwdev, REG_TSSI_TRK_SW, 0x28160cc0); ++ rtw_write32(rtwdev, REG_RFECTL_A, 0x00300000); ++ rtw_write32(rtwdev, REG_RFECTL_A, 0x00100000); ++ mdelay(5); ++ rtw_write32(rtwdev, REG_TSSI_TRK_SW, 0x3c000000); ++ rtw_write32(rtwdev, REG_RFECTL_A, 0x00000000); ++ } ++ ++ if (tx1_finish) { ++ /* [31] = 0 --> Page C */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x0); ++ rtw_write32_mask(rtwdev, REG_IQK_COM00, 0x03FF8000, ++ tx_x1 & 0x000007ff); ++ rtw_write32_mask(rtwdev, REG_IQK_COM00, 0x000007FF, ++ tx_y1 & 0x000007ff); ++ /* [31] = 1 --> Page C1 */ ++ rtw_write32_mask(rtwdev, REG_CCASEL, BIT(31), 0x1); ++ if (efuse->rfe_option == 1) ++ rtw_write32(rtwdev, REG_RXPITMB, 0x28161500); ++ else ++ rtw_write32(rtwdev, REG_RXPITMB, 0x28160ca0); ++ rtw_write32(rtwdev, REG_RFECTL_B, 0x00300000); ++ rtw_write32(rtwdev, REG_RFECTL_B, 0x00100000); ++ mdelay(5); ++ rtw_write32(rtwdev, REG_RXPITMB, 0x3c000000); ++ rtw_write32(rtwdev, REG_RFECTL_B, 0x00000000); ++ } ++ ++ for (delay_count = 0; delay_count < 20; delay_count++) { ++ if (!rx0_finish && tx0_finish) ++ iqk0_ready = rtw_read32_mask(rtwdev, ++ REG_IQKA_END, ++ BIT(10)); ++ if (!rx1_finish && tx1_finish) ++ iqk1_ready = rtw_read32_mask(rtwdev, ++ REG_IQKB_END, ++ BIT(10)); ++ if (iqk0_ready && iqk1_ready) ++ break; ++ ++ mdelay(1); ++ } ++ ++ rtw_dbg(rtwdev, RTW_DBG_RFK, "RX delay_count = %d\n", ++ delay_count); ++ ++ if (delay_count < 20) { /* If 20ms No Result, then cal_retry++ */ ++ /* ============RXIQK Check============== */ ++ rx0_fail = rtw_read32_mask(rtwdev, REG_IQKA_END, BIT(11)); ++ rx1_fail = rtw_read32_mask(rtwdev, REG_IQKB_END, BIT(11)); ++ ++ if (!(rx0_fail || rx0_finish) && tx0_finish) { ++ rtw_write32(rtwdev, REG_RFECTL_A, 0x06000000); ++ rx_x0_temp[rx0_avg] = rtw_read32_mask(rtwdev, ++ REG_IQKA_END, ++ 0x07ff0000); ++ rtw_write32(rtwdev, REG_RFECTL_A, 0x08000000); ++ rx_y0_temp[rx0_avg] = rtw_read32_mask(rtwdev, ++ REG_IQKA_END, ++ 0x07ff0000); ++ ++ rtw_dbg(rtwdev, RTW_DBG_RFK, ++ "rx_x0[%d] = %x ;; rx_y0[%d] = %x\n", ++ rx0_avg, rx_x0_temp[rx0_avg], ++ rx0_avg, rx_y0_temp[rx0_avg]); ++ ++ rx_x0_temp[rx0_avg] <<= 21; ++ rx_y0_temp[rx0_avg] <<= 21; ++ ++ rx0_avg++; ++ } else { ++ rtw_dbg(rtwdev, RTW_DBG_RFK, ++ "1. RXA_cal_retry = %d\n", cal0_retry); ++ ++ cal0_retry++; ++ if (cal0_retry == 10) ++ break; ++ } ++ ++ if (!(rx1_fail || rx1_finish) && tx1_finish) { ++ rtw_write32(rtwdev, REG_RFECTL_B, 0x06000000); ++ rx_x1_temp[rx1_avg] = rtw_read32_mask(rtwdev, ++ REG_IQKB_END, ++ 0x07ff0000); ++ rtw_write32(rtwdev, REG_RFECTL_B, 0x08000000); ++ rx_y1_temp[rx1_avg] = rtw_read32_mask(rtwdev, ++ REG_IQKB_END, ++ 0x07ff0000); ++ ++ rtw_dbg(rtwdev, RTW_DBG_RFK, ++ "rx_x1[%d] = %x ;; rx_y1[%d] = %x\n", ++ rx1_avg, rx_x1_temp[rx1_avg], ++ rx1_avg, rx_y1_temp[rx1_avg]); ++ ++ rx_x1_temp[rx1_avg] <<= 21; ++ rx_y1_temp[rx1_avg] <<= 21; ++ ++ rx1_avg++; ++ } else { ++ cal1_retry++; ++ if (cal1_retry == 10) ++ break; ++ } ++ } else { ++ rtw_dbg(rtwdev, RTW_DBG_RFK, ++ "2. RXA_cal_retry = %d\n", cal0_retry); ++ ++ cal0_retry++; ++ cal1_retry++; ++ ++ rtw_dbg(rtwdev, RTW_DBG_RFK, ++ "delay 20ms RX IQK Not Ready!!!!!\n"); ++ ++ if (cal0_retry == 10) ++ break; ++ } ++ ++ rtw_dbg(rtwdev, RTW_DBG_RFK, "3. RXA_cal_retry = %d\n", ++ cal0_retry); ++ ++ if (rx0_avg >= 2) ++ rx0_finish = rtw88xxa_iqk_finish(rx0_avg, 4, ++ rx_x0_temp, rx_y0_temp, ++ &rx_x0, &rx_y0, ++ true, false); ++ ++ if (rx1_avg >= 2) ++ rx1_finish = rtw88xxa_iqk_finish(rx1_avg, 4, ++ rx_x1_temp, rx_y1_temp, ++ &rx_x1, &rx_y1, ++ true, false); ++ ++ rtw_dbg(rtwdev, RTW_DBG_RFK, ++ "rx0_average = %d, rx1_average = %d\n", ++ rx0_avg, rx1_avg); ++ rtw_dbg(rtwdev, RTW_DBG_RFK, ++ "rx0_finish = %d, rx1_finish = %d\n", ++ rx0_finish, rx1_finish); ++ ++ if ((rx0_finish || !tx0_finish) && (rx1_finish || !tx1_finish)) ++ break; ++ ++ if ((cal0_retry + rx0_avg) >= 10 || ++ (cal1_retry + rx1_avg) >= 10 || ++ rx0_avg == 3 || rx1_avg == 3) ++ break; ++ } ++ ++ rtw_dbg(rtwdev, RTW_DBG_RFK, "RXA_cal_retry = %d\n", cal0_retry); ++ rtw_dbg(rtwdev, RTW_DBG_RFK, "RXB_cal_retry = %d\n", cal1_retry); ++ ++ /* FillIQK Result */ ++ rtw_dbg(rtwdev, RTW_DBG_RFK, "========Path_A =======\n"); ++ ++ if (tx0_finish) ++ rtw8812a_iqk_tx_fill(rtwdev, RF_PATH_A, tx_x0, tx_y0); ++ else ++ rtw8812a_iqk_tx_fill(rtwdev, RF_PATH_A, 0x200, 0x0); ++ ++ if (rx0_finish) ++ rtw8812a_iqk_rx_fill(rtwdev, RF_PATH_A, rx_x0, rx_y0); ++ else ++ rtw8812a_iqk_rx_fill(rtwdev, RF_PATH_A, 0x200, 0x0); ++ ++ rtw_dbg(rtwdev, RTW_DBG_RFK, "========Path_B =======\n"); ++ ++ if (tx1_finish) ++ rtw8812a_iqk_tx_fill(rtwdev, RF_PATH_B, tx_x1, tx_y1); ++ else ++ rtw8812a_iqk_tx_fill(rtwdev, RF_PATH_B, 0x200, 0x0); ++ ++ if (rx1_finish) ++ rtw8812a_iqk_rx_fill(rtwdev, RF_PATH_B, rx_x1, rx_y1); ++ else ++ rtw8812a_iqk_rx_fill(rtwdev, RF_PATH_B, 0x200, 0x0); ++} ++ ++#define MACBB_REG_NUM_8812A 9 ++#define AFE_REG_NUM_8812A 12 ++#define RF_REG_NUM_8812A 3 ++ ++static void rtw8812a_do_iqk(struct rtw_dev *rtwdev) ++{ ++ static const u32 backup_macbb_reg[MACBB_REG_NUM_8812A] = { ++ 0x520, 0x550, 0x808, 0xa04, 0x90c, 0xc00, 0xe00, 0x838, 0x82c ++ }; ++ static const u32 backup_afe_reg[AFE_REG_NUM_8812A] = { ++ 0xc5c, 0xc60, 0xc64, 0xc68, 0xcb0, 0xcb4, ++ 0xe5c, 0xe60, 0xe64, 0xe68, 0xeb0, 0xeb4 ++ }; ++ static const u32 backup_rf_reg[RF_REG_NUM_8812A] = { ++ 0x65, 0x8f, 0x0 ++ }; ++ u32 macbb_backup[MACBB_REG_NUM_8812A] = {}; ++ u32 afe_backup[AFE_REG_NUM_8812A] = {}; ++ u32 rfa_backup[RF_REG_NUM_8812A] = {}; ++ u32 rfb_backup[RF_REG_NUM_8812A] = {}; ++ u32 reg_cb8, reg_eb8; ++ ++ rtw88xxa_iqk_backup_mac_bb(rtwdev, macbb_backup, ++ backup_macbb_reg, MACBB_REG_NUM_8812A); ++ ++ rtw_write32_set(rtwdev, REG_CCASEL, BIT(31)); ++ reg_cb8 = rtw_read32(rtwdev, REG_RFECTL_A); ++ reg_eb8 = rtw_read32(rtwdev, REG_RFECTL_B); ++ rtw_write32_clr(rtwdev, REG_CCASEL, BIT(31)); ++ ++ rtw88xxa_iqk_backup_afe(rtwdev, afe_backup, ++ backup_afe_reg, AFE_REG_NUM_8812A); ++ rtw8812a_iqk_backup_rf(rtwdev, rfa_backup, rfb_backup, ++ backup_rf_reg, RF_REG_NUM_8812A); ++ ++ rtw88xxa_iqk_configure_mac(rtwdev); ++ ++ rtw8812a_iqk(rtwdev); ++ ++ rtw8812a_iqk_restore_rf(rtwdev, RF_PATH_A, backup_rf_reg, ++ rfa_backup, RF_REG_NUM_8812A); ++ rtw8812a_iqk_restore_rf(rtwdev, RF_PATH_B, backup_rf_reg, ++ rfb_backup, RF_REG_NUM_8812A); ++ ++ rtw8812a_iqk_restore_afe(rtwdev, afe_backup, ++ backup_afe_reg, AFE_REG_NUM_8812A); ++ ++ rtw_write32_set(rtwdev, REG_CCASEL, BIT(31)); ++ rtw_write32(rtwdev, REG_RFECTL_A, reg_cb8); ++ rtw_write32(rtwdev, REG_RFECTL_B, reg_eb8); ++ rtw_write32_clr(rtwdev, REG_CCASEL, BIT(31)); ++ ++ rtw88xxa_iqk_restore_mac_bb(rtwdev, macbb_backup, ++ backup_macbb_reg, MACBB_REG_NUM_8812A); ++} ++ ++static void rtw8812a_phy_calibration(struct rtw_dev *rtwdev) ++{ ++ u8 channel = rtwdev->hal.current_channel; ++ ++ rtw8812a_do_iqk(rtwdev); ++ ++ /* The official driver wants to do this after connecting ++ * but before first writing a new igi (phydm_get_new_igi). ++ * Here seems close enough. ++ */ ++ if (channel >= 36 && channel <= 64) ++ rtw_load_table(rtwdev, &rtw8812a_agc_diff_lb_tbl); ++ else if (channel >= 100) ++ rtw_load_table(rtwdev, &rtw8812a_agc_diff_hb_tbl); ++} ++ ++static void rtw8812a_pwr_track(struct rtw_dev *rtwdev) ++{ ++ struct rtw_dm_info *dm_info = &rtwdev->dm_info; ++ ++ if (!dm_info->pwr_trk_triggered) { ++ rtw_write_rf(rtwdev, RF_PATH_A, RF_T_METER, ++ GENMASK(17, 16), 0x03); ++ dm_info->pwr_trk_triggered = true; ++ return; ++ } ++ ++ rtw88xxa_phy_pwrtrack(rtwdev, rtw8812a_do_lck, rtw8812a_do_iqk); ++ dm_info->pwr_trk_triggered = false; ++} ++ ++static void rtw8812a_fill_txdesc_checksum(struct rtw_dev *rtwdev, ++ struct rtw_tx_pkt_info *pkt_info, ++ u8 *txdesc) ++{ ++ fill_txdesc_checksum_common(txdesc, 16); ++} ++ ++static void rtw8812a_coex_cfg_init(struct rtw_dev *rtwdev) ++{ ++} ++ ++static void rtw8812a_coex_cfg_gnt_fix(struct rtw_dev *rtwdev) ++{ ++} ++ ++static void rtw8821a_coex_cfg_rfe_type(struct rtw_dev *rtwdev) ++{ ++} ++ ++static void rtw8821a_coex_cfg_wl_tx_power(struct rtw_dev *rtwdev, u8 wl_pwr) ++{ ++} ++ ++static void rtw8821a_coex_cfg_wl_rx_gain(struct rtw_dev *rtwdev, bool low_gain) ++{ ++} ++ ++static const struct rtw_chip_ops rtw8812a_ops = { ++ .power_on = rtw88xxa_power_on, ++ .power_off = rtw8812a_power_off, ++ .phy_set_param = NULL, ++ .read_efuse = rtw88xxa_read_efuse, ++ .query_phy_status = rtw8812a_query_phy_status, ++ .set_channel = rtw88xxa_set_channel, ++ .mac_init = NULL, ++ .read_rf = rtw88xxa_phy_read_rf, ++ .write_rf = rtw_phy_write_rf_reg_sipi, ++ .set_antenna = NULL, ++ .set_tx_power_index = rtw88xxa_set_tx_power_index, ++ .cfg_ldo25 = rtw8812a_cfg_ldo25, ++ .efuse_grant = rtw88xxa_efuse_grant, ++ .false_alarm_statistics = rtw88xxa_false_alarm_statistics, ++ .phy_calibration = rtw8812a_phy_calibration, ++ .cck_pd_set = rtw88xxa_phy_cck_pd_set, ++ .pwr_track = rtw8812a_pwr_track, ++ .config_bfee = NULL, ++ .set_gid_table = NULL, ++ .cfg_csi_rate = NULL, ++ .fill_txdesc_checksum = rtw8812a_fill_txdesc_checksum, ++ .coex_set_init = rtw8812a_coex_cfg_init, ++ .coex_set_ant_switch = NULL, ++ .coex_set_gnt_fix = rtw8812a_coex_cfg_gnt_fix, ++ .coex_set_gnt_debug = NULL, ++ .coex_set_rfe_type = rtw8821a_coex_cfg_rfe_type, ++ .coex_set_wl_tx_power = rtw8821a_coex_cfg_wl_tx_power, ++ .coex_set_wl_rx_gain = rtw8821a_coex_cfg_wl_rx_gain, ++}; ++ ++static const struct rtw_page_table page_table_8812a[] = { ++ /* hq_num, nq_num, lq_num, exq_num, gapq_num */ ++ {0, 0, 0, 0, 0}, /* SDIO */ ++ {0, 0, 0, 0, 0}, /* PCI */ ++ {16, 0, 0, 0, 1}, /* 2 bulk out endpoints */ ++ {16, 0, 16, 0, 1}, /* 3 bulk out endpoints */ ++ {16, 0, 16, 0, 1}, /* 4 bulk out endpoints */ ++}; ++ ++static const struct rtw_rqpn rqpn_table_8812a[] = { ++ {RTW_DMA_MAPPING_NORMAL, RTW_DMA_MAPPING_NORMAL, ++ RTW_DMA_MAPPING_LOW, RTW_DMA_MAPPING_LOW, ++ RTW_DMA_MAPPING_EXTRA, RTW_DMA_MAPPING_HIGH}, ++ ++ {RTW_DMA_MAPPING_NORMAL, RTW_DMA_MAPPING_NORMAL, ++ RTW_DMA_MAPPING_LOW, RTW_DMA_MAPPING_LOW, ++ RTW_DMA_MAPPING_EXTRA, RTW_DMA_MAPPING_HIGH}, ++ ++ {RTW_DMA_MAPPING_HIGH, RTW_DMA_MAPPING_HIGH, ++ RTW_DMA_MAPPING_NORMAL, RTW_DMA_MAPPING_NORMAL, ++ RTW_DMA_MAPPING_HIGH, RTW_DMA_MAPPING_HIGH}, ++ ++ {RTW_DMA_MAPPING_HIGH, RTW_DMA_MAPPING_NORMAL, ++ RTW_DMA_MAPPING_LOW, RTW_DMA_MAPPING_LOW, ++ RTW_DMA_MAPPING_HIGH, RTW_DMA_MAPPING_HIGH}, ++ ++ {RTW_DMA_MAPPING_NORMAL, RTW_DMA_MAPPING_NORMAL, ++ RTW_DMA_MAPPING_LOW, RTW_DMA_MAPPING_LOW, ++ RTW_DMA_MAPPING_EXTRA, RTW_DMA_MAPPING_HIGH}, ++}; ++ ++static const struct rtw_prioq_addrs prioq_addrs_8812a = { ++ .prio[RTW_DMA_MAPPING_EXTRA] = { ++ .rsvd = REG_RQPN_NPQ + 2, .avail = REG_RQPN_NPQ + 3, ++ }, ++ .prio[RTW_DMA_MAPPING_LOW] = { ++ .rsvd = REG_RQPN + 1, .avail = REG_FIFOPAGE_CTRL_2 + 1, ++ }, ++ .prio[RTW_DMA_MAPPING_NORMAL] = { ++ .rsvd = REG_RQPN_NPQ, .avail = REG_RQPN_NPQ + 1, ++ }, ++ .prio[RTW_DMA_MAPPING_HIGH] = { ++ .rsvd = REG_RQPN, .avail = REG_FIFOPAGE_CTRL_2, ++ }, ++ .wsize = false, ++}; ++ ++static const struct rtw_hw_reg rtw8812a_dig[] = { ++ [0] = { .addr = REG_RXIGI_A, .mask = 0x7f }, ++ [1] = { .addr = REG_RXIGI_B, .mask = 0x7f }, ++}; ++ ++static const struct rtw_rfe_def rtw8812a_rfe_defs[] = { ++ [0] = { .phy_pg_tbl = &rtw8812a_bb_pg_tbl, ++ .txpwr_lmt_tbl = &rtw8812a_txpwr_lmt_tbl, ++ .pwr_track_tbl = &rtw8812a_rtw_pwr_track_tbl, }, ++ [1] = { .phy_pg_tbl = &rtw8812a_bb_pg_tbl, ++ .txpwr_lmt_tbl = &rtw8812a_txpwr_lmt_tbl, ++ .pwr_track_tbl = &rtw8812a_rtw_pwr_track_tbl, }, ++ [3] = { .phy_pg_tbl = &rtw8812a_bb_pg_rfe3_tbl, ++ .txpwr_lmt_tbl = &rtw8812a_txpwr_lmt_tbl, ++ .pwr_track_tbl = &rtw8812a_rtw_pwr_track_rfe3_tbl, }, ++}; ++ ++static const u8 wl_rssi_step_8812a[] = {101, 45, 101, 40}; ++static const u8 bt_rssi_step_8812a[] = {101, 101, 101, 101}; ++ ++static const struct coex_rf_para rf_para_tx_8812a[] = { ++ {0, 0, false, 7}, /* for normal */ ++ {0, 20, false, 7}, /* for WL-CPT */ ++ {8, 17, true, 4}, ++ {7, 18, true, 4}, ++ {6, 19, true, 4}, ++ {5, 20, true, 4} ++}; ++ ++static const struct coex_rf_para rf_para_rx_8812a[] = { ++ {0, 0, false, 7}, /* for normal */ ++ {0, 20, false, 7}, /* for WL-CPT */ ++ {3, 24, true, 5}, ++ {2, 26, true, 5}, ++ {1, 27, true, 5}, ++ {0, 28, true, 5} ++}; ++ ++static_assert(ARRAY_SIZE(rf_para_tx_8812a) == ARRAY_SIZE(rf_para_rx_8812a)); ++ ++const struct rtw_chip_info rtw8812a_hw_spec = { ++ .ops = &rtw8812a_ops, ++ .id = RTW_CHIP_TYPE_8812A, ++ .fw_name = "rtw88/rtw8812a_fw.bin", ++ .wlan_cpu = RTW_WCPU_11N, ++ .tx_pkt_desc_sz = 40, ++ .tx_buf_desc_sz = 16, ++ .rx_pkt_desc_sz = 24, ++ .rx_buf_desc_sz = 8, ++ .phy_efuse_size = 512, ++ .log_efuse_size = 512, ++ .ptct_efuse_size = 96 + 1, /* TODO or just 18? */ ++ .txff_size = 131072, ++ .rxff_size = 16128, ++ .rsvd_drv_pg_num = 9, ++ .txgi_factor = 1, ++ .is_pwr_by_rate_dec = true, ++ .max_power_index = 0x3f, ++ .csi_buf_pg_num = 0, ++ .band = RTW_BAND_2G | RTW_BAND_5G, ++ .page_size = 512, ++ .dig_min = 0x20, ++ .ht_supported = true, ++ .vht_supported = true, ++ .lps_deep_mode_supported = 0, ++ .sys_func_en = 0xFD, ++ .pwr_on_seq = card_enable_flow_8812a, ++ .pwr_off_seq = card_disable_flow_8812a, ++ .page_table = page_table_8812a, ++ .rqpn_table = rqpn_table_8812a, ++ .prioq_addrs = &prioq_addrs_8812a, ++ .intf_table = NULL, ++ .dig = rtw8812a_dig, ++ .rf_sipi_addr = {REG_LSSI_WRITE_A, REG_LSSI_WRITE_B}, ++ .ltecoex_addr = NULL, ++ .mac_tbl = &rtw8812a_mac_tbl, ++ .agc_tbl = &rtw8812a_agc_tbl, ++ .bb_tbl = &rtw8812a_bb_tbl, ++ .rf_tbl = {&rtw8812a_rf_a_tbl, &rtw8812a_rf_b_tbl}, ++ .rfe_defs = rtw8812a_rfe_defs, ++ .rfe_defs_size = ARRAY_SIZE(rtw8812a_rfe_defs), ++ .rx_ldpc = false, ++ .hw_feature_report = false, ++ .c2h_ra_report_size = 4, ++ .old_datarate_fb_limit = true, ++ .usb_tx_agg_desc_num = 1, ++ .iqk_threshold = 8, ++ .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, ++ .max_scan_ie_len = IEEE80211_MAX_DATA_LEN, ++ ++ .coex_para_ver = 0, /* no coex code in 8812au driver */ ++ .bt_desired_ver = 0, ++ .scbd_support = false, ++ .new_scbd10_def = false, ++ .ble_hid_profile_support = false, ++ .wl_mimo_ps_support = false, ++ .pstdma_type = COEX_PSTDMA_FORCE_LPSOFF, ++ .bt_rssi_type = COEX_BTRSSI_RATIO, ++ .ant_isolation = 15, ++ .rssi_tolerance = 2, ++ .wl_rssi_step = wl_rssi_step_8812a, ++ .bt_rssi_step = bt_rssi_step_8812a, ++ .table_sant_num = 0, ++ .table_sant = NULL, ++ .table_nsant_num = 0, ++ .table_nsant = NULL, ++ .tdma_sant_num = 0, ++ .tdma_sant = NULL, ++ .tdma_nsant_num = 0, ++ .tdma_nsant = NULL, ++ .wl_rf_para_num = ARRAY_SIZE(rf_para_tx_8812a), ++ .wl_rf_para_tx = rf_para_tx_8812a, ++ .wl_rf_para_rx = rf_para_rx_8812a, ++ .bt_afh_span_bw20 = 0x20, ++ .bt_afh_span_bw40 = 0x30, ++ .afh_5g_num = 0, ++ .afh_5g = NULL, ++ .coex_info_hw_regs_num = 0, ++ .coex_info_hw_regs = NULL, ++}; ++EXPORT_SYMBOL(rtw8812a_hw_spec); ++ ++MODULE_FIRMWARE("rtw88/rtw8812a_fw.bin"); ++ ++MODULE_AUTHOR("Realtek Corporation"); ++MODULE_DESCRIPTION("Realtek 802.11ac wireless 8812a driver"); ++MODULE_LICENSE("Dual BSD/GPL"); +--- /dev/null ++++ b/drivers/net/wireless/realtek/rtw88/rtw8812a.h +@@ -0,0 +1,10 @@ ++/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ ++/* Copyright(c) 2024 Realtek Corporation ++ */ ++ ++#ifndef __RTW8812A_H__ ++#define __RTW8812A_H__ ++ ++extern const struct rtw_chip_info rtw8812a_hw_spec; ++ ++#endif diff --git a/package/kernel/mac80211/patches/rtl/044-v6.13-wifi-rtw88-Add-rtw8821au.c-and-rtw8812au.c.patch b/package/kernel/mac80211/patches/rtl/044-v6.13-wifi-rtw88-Add-rtw8821au.c-and-rtw8812au.c.patch new file mode 100644 index 00000000000000..a37f131bab8ffe --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/044-v6.13-wifi-rtw88-Add-rtw8821au.c-and-rtw8812au.c.patch @@ -0,0 +1,80 @@ +From 8f82bb2cfaf7b8992e0e8493cb765138254f87c9 Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Wed, 30 Oct 2024 20:29:28 +0200 +Subject: [PATCH] wifi: rtw88: Add rtw8821au.c and rtw8812au.c + +These are the entry points for the new modules rtw88_8821au +(RTL8821AU/RTL8811AU) and rtw88_8812au (RTL8812AU). + +Signed-off-by: Bitterblue Smith +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/91c495f8-a607-429b-8bc0-5a45d3c1393e@gmail.com +--- + .../net/wireless/realtek/rtw88/rtw8812au.c | 28 +++++++++++++++++++ + .../net/wireless/realtek/rtw88/rtw8821au.c | 28 +++++++++++++++++++ + 2 files changed, 56 insertions(+) + create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8812au.c + create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8821au.c + +--- /dev/null ++++ b/drivers/net/wireless/realtek/rtw88/rtw8812au.c +@@ -0,0 +1,28 @@ ++// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause ++/* Copyright(c) 2024 Realtek Corporation ++ */ ++ ++#include ++#include ++#include "main.h" ++#include "rtw8812a.h" ++#include "usb.h" ++ ++static const struct usb_device_id rtw_8812au_id_table[] = { ++ { USB_DEVICE_AND_INTERFACE_INFO(0x2604, 0x0012, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8812a_hw_spec) }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(usb, rtw_8812au_id_table); ++ ++static struct usb_driver rtw_8812au_driver = { ++ .name = "rtw_8812au", ++ .id_table = rtw_8812au_id_table, ++ .probe = rtw_usb_probe, ++ .disconnect = rtw_usb_disconnect, ++}; ++module_usb_driver(rtw_8812au_driver); ++ ++MODULE_AUTHOR("Bitterblue Smith "); ++MODULE_DESCRIPTION("Realtek 802.11ac wireless 8812au driver"); ++MODULE_LICENSE("Dual BSD/GPL"); +--- /dev/null ++++ b/drivers/net/wireless/realtek/rtw88/rtw8821au.c +@@ -0,0 +1,28 @@ ++// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause ++/* Copyright(c) 2024 Realtek Corporation ++ */ ++ ++#include ++#include ++#include "main.h" ++#include "rtw8821a.h" ++#include "usb.h" ++ ++static const struct usb_device_id rtw_8821au_id_table[] = { ++ { USB_DEVICE_AND_INTERFACE_INFO(0x2357, 0x011e, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8821a_hw_spec) }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(usb, rtw_8821au_id_table); ++ ++static struct usb_driver rtw_8821au_driver = { ++ .name = "rtw_8821au", ++ .id_table = rtw_8821au_id_table, ++ .probe = rtw_usb_probe, ++ .disconnect = rtw_usb_disconnect, ++}; ++module_usb_driver(rtw_8821au_driver); ++ ++MODULE_AUTHOR("Bitterblue Smith "); ++MODULE_DESCRIPTION("Realtek 802.11ac wireless 8821au/8811au driver"); ++MODULE_LICENSE("Dual BSD/GPL"); diff --git a/package/kernel/mac80211/patches/rtl/045-v6.13-wifi-rtw88-Enable-the-new-RTL8821AU-RTL8812AU-driver.patch b/package/kernel/mac80211/patches/rtl/045-v6.13-wifi-rtw88-Enable-the-new-RTL8821AU-RTL8812AU-driver.patch new file mode 100644 index 00000000000000..6a4a2aff6980d7 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/045-v6.13-wifi-rtw88-Enable-the-new-RTL8821AU-RTL8812AU-driver.patch @@ -0,0 +1,153 @@ +From 0e3e8284f8e1bf2fc0f7bf247194efe5cfc568c1 Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Wed, 30 Oct 2024 20:31:28 +0200 +Subject: [PATCH] wifi: rtw88: Enable the new RTL8821AU/RTL8812AU drivers + +These are older Wifi 5 chips. RTL8821AU is 1x1, with or without +Bluetooth. RTL8812AU is 2x2, without Bluetooth. + +Beamforming is not implemented. It looks like these chips need a +different implementation than what is in bf.c. + +Speed tests with RTL8821AU: 137 Mbps download, 144 Mbps upload. +Speed tests with RTL8812AU: 344 Mbps download, 387 Mbps upload. + +Station mode and AP mode were tested. + +Bluetooth coexistence works. I used my Bluetooth headphones for +several days, listening to music and watching videos. There is only +a problem with the wifi speeds with one router: + +With ISP's HG6544C router: +Official driver: 3/5 Mbps. +rtw88: a bit more, but not steady at all. Not enough to watch a 1080p +Youtube video. + +With my D-Link Eagle R32 router running Openwrt, on the same channel: +Official driver: 6/10 Mbps. +rtw88: download starts around 30, climbs to 50 / upload is 10 Mbps. +I can watch a 1080p Youtube video. + +The music doesn't cut out during any speed tests. + +I also tested transferring files to and from my phone. I don't have +other types of Bluetooth devices to test. + +Signed-off-by: Bitterblue Smith +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/0b8e8093-8103-4999-86bf-0055ec52ea64@gmail.com +--- +Kconfig.local | 15 ++++++++ + drivers/net/wireless/realtek/rtw88/Kconfig | 40 ++++++++++++++++++++- + drivers/net/wireless/realtek/rtw88/Makefile | 15 ++++++++ + 3 files changed, 69 insertions(+), 1 deletion(-) + +--- a/Kconfig.local ++++ b/Kconfig.local +@@ -1144,6 +1144,15 @@ config BACKPORTED_RTW88_8723D + config BACKPORTED_RTW88_8821C + tristate + default RTW88_8821C ++config BACKPORTED_RTW88_88XXA ++ tristate ++ default RTW88_88XXA ++config BACKPORTED_RTW88_8821A ++ tristate ++ default RTW88_8821A ++config BACKPORTED_RTW88_8812A ++ tristate ++ default RTW88_8812A + config BACKPORTED_RTW88_8822BE + tristate + default RTW88_8822BE +@@ -1183,6 +1192,12 @@ config BACKPORTED_RTW88_8821CS + config BACKPORTED_RTW88_8821CU + tristate + default RTW88_8821CU ++config BACKPORTED_RTW88_8821AU ++ tristate ++ default RTW88_8821AU ++config BACKPORTED_RTW88_8812AU ++ tristate ++ default RTW88_8812AU + config BACKPORTED_RTW88_DEBUG + tristate + default RTW88_DEBUG +--- a/drivers/net/wireless/realtek/rtw88/Kconfig ++++ b/drivers/net/wireless/realtek/rtw88/Kconfig +@@ -54,6 +54,20 @@ config RTW88_8821C + tristate + depends on m + ++config RTW88_88XXA ++ tristate ++ depends on m ++ ++config RTW88_8821A ++ tristate ++ depends on m ++ select RTW88_88XXA ++ ++config RTW88_8812A ++ tristate ++ depends on m ++ select RTW88_88XXA ++ + config RTW88_8822BE + tristate "Realtek 8822BE PCI wireless network adapter" + depends on m +@@ -213,6 +227,30 @@ config RTW88_8821CU + + 802.11ac USB wireless network adapter + ++config RTW88_8821AU ++ tristate "Realtek 8821AU/8811AU USB wireless network adapter" ++ depends on m ++ depends on USB ++ select RTW88_CORE ++ select RTW88_USB ++ select RTW88_8821A ++ help ++ Select this option will enable support for 8821AU and 8811AU chipset ++ ++ 802.11ac USB wireless network adapter ++ ++config RTW88_8812AU ++ tristate "Realtek 8812AU USB wireless network adapter" ++ depends on m ++ depends on USB ++ select RTW88_CORE ++ select RTW88_USB ++ select RTW88_8812A ++ help ++ Select this option will enable support for 8812AU chipset ++ ++ 802.11ac USB wireless network adapter ++ + config RTW88_DEBUG + bool "Realtek rtw88 debug support" + depends on RTW88_CORE +--- a/drivers/net/wireless/realtek/rtw88/Makefile ++++ b/drivers/net/wireless/realtek/rtw88/Makefile +@@ -77,6 +77,21 @@ rtw88_8821cs-objs := rtw8821cs.o + obj-$(CPTCFG_RTW88_8821CU) += rtw88_8821cu.o + rtw88_8821cu-objs := rtw8821cu.o + ++obj-$(CPTCFG_RTW88_88XXA) += rtw88_88xxa.o ++rtw88_88xxa-objs := rtw88xxa.o ++ ++obj-$(CPTCFG_RTW88_8821A) += rtw88_8821a.o ++rtw88_8821a-objs := rtw8821a.o rtw8821a_table.o ++ ++obj-$(CPTCFG_RTW88_8812A) += rtw88_8812a.o ++rtw88_8812a-objs := rtw8812a.o rtw8812a_table.o ++ ++obj-$(CPTCFG_RTW88_8821AU) += rtw88_8821au.o ++rtw88_8821au-objs := rtw8821au.o ++ ++obj-$(CPTCFG_RTW88_8812AU) += rtw88_8812au.o ++rtw88_8812au-objs := rtw8812au.o ++ + obj-$(CPTCFG_RTW88_PCI) += rtw88_pci.o + rtw88_pci-objs := pci.o + diff --git a/package/kernel/mac80211/patches/rtl/046-wifi-rtw88-8821au-Add-additional-devices-to-the-USB_.patch b/package/kernel/mac80211/patches/rtl/046-wifi-rtw88-8821au-Add-additional-devices-to-the-USB_.patch new file mode 100644 index 00000000000000..a83094b3c3ee2b --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/046-wifi-rtw88-8821au-Add-additional-devices-to-the-USB_.patch @@ -0,0 +1,77 @@ +From ff5a1c94e53c0d24f610c2c30add82f75b728737 Mon Sep 17 00:00:00 2001 +From: Larry Finger +Date: Wed, 6 Nov 2024 15:55:31 +0200 +Subject: [PATCH 1/6] wifi: rtw88: 8821au: Add additional devices to the + USB_DEVICE list + +These are the entries that Nick Morrow provided. From +https://github.com/morrownr/8821au-20210708 + +Signed-off-by: Larry Finger +Signed-off-by: Bitterblue Smith +--- + .../net/wireless/realtek/rtw88/rtw8821au.c | 52 ++++++++++++++++++- + 1 file changed, 51 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/realtek/rtw88/rtw8821au.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8821au.c +@@ -9,8 +9,58 @@ + #include "usb.h" + + static const struct usb_device_id rtw_8821au_id_table[] = { +- { USB_DEVICE_AND_INTERFACE_INFO(0x2357, 0x011e, 0xff, 0xff, 0xff), ++ { USB_DEVICE_AND_INTERFACE_INFO(RTW_USB_VENDOR_ID_REALTEK, 0x0811, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8821a_hw_spec) }, ++ { USB_DEVICE_AND_INTERFACE_INFO(RTW_USB_VENDOR_ID_REALTEK, 0x0820, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8821a_hw_spec) }, ++ { USB_DEVICE_AND_INTERFACE_INFO(RTW_USB_VENDOR_ID_REALTEK, 0x0821, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8821a_hw_spec) }, ++ { USB_DEVICE_AND_INTERFACE_INFO(RTW_USB_VENDOR_ID_REALTEK, 0x8822, 0xff, 0xff, 0xff), + .driver_info = (kernel_ulong_t)&(rtw8821a_hw_spec) }, ++ { USB_DEVICE_AND_INTERFACE_INFO(RTW_USB_VENDOR_ID_REALTEK, 0x0823, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8821a_hw_spec) }, ++ { USB_DEVICE_AND_INTERFACE_INFO(RTW_USB_VENDOR_ID_REALTEK, 0xa811, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8821a_hw_spec) }, ++ { USB_DEVICE_AND_INTERFACE_INFO(0x0411, 0x0242, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8821a_hw_spec) }, /* Buffalo */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x0411, 0x029b, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8821a_hw_spec) }, /* Buffalo */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x04bb, 0x0953, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8821a_hw_spec) }, /* I-O DATA */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x056e, 0x4007, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8821a_hw_spec) }, /* ELECOM */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x056e, 0x400e, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8821a_hw_spec) }, /* ELECOM */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x056e, 0x400f, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8821a_hw_spec) }, /* ELECOM */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x0846, 0x9052, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8821a_hw_spec) }, /* Netgear */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x0e66, 0x0023, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8821a_hw_spec) }, /* HAWKING */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x3314, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8821a_hw_spec) }, /* D-Link */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x3318, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8821a_hw_spec) }, /* D-Link */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x2019, 0xab32, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8821a_hw_spec) }, /* Planex */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x20f4, 0x804b, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8821a_hw_spec) }, /* TRENDnet */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x2357, 0x011e, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8821a_hw_spec) }, /* TP Link */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x2357, 0x011f, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8821a_hw_spec) }, /* TP Link */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x2357, 0x0120, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8821a_hw_spec) }, /* TP Link */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x3823, 0x6249, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8821a_hw_spec) }, /* Obihai */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x7392, 0xa811, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8821a_hw_spec) }, /* Edimax */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x7392, 0xa812, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8821a_hw_spec) }, /* Edimax */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x7392, 0xa813, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8821a_hw_spec) }, /* Edimax */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x7392, 0xb611, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8821a_hw_spec) }, /* Edimax */ + {}, + }; + MODULE_DEVICE_TABLE(usb, rtw_8821au_id_table); diff --git a/package/kernel/mac80211/patches/rtl/047-wifi-rtw88-8812au-Add-more-device-IDs.patch b/package/kernel/mac80211/patches/rtl/047-wifi-rtw88-8812au-Add-more-device-IDs.patch new file mode 100644 index 00000000000000..a93f9219d9fcc2 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/047-wifi-rtw88-8812au-Add-more-device-IDs.patch @@ -0,0 +1,91 @@ +From d21ad2e4edfb64d3f32685607a457576eea3c5cd Mon Sep 17 00:00:00 2001 +From: Nick Morrow +Date: Wed, 6 Nov 2024 15:57:10 +0200 +Subject: [PATCH 2/6] wifi: rtw88: 8812au: Add more device IDs + +From https://github.com/morrownr/8812au-20210820. + +Signed-off-by: Nick Morrow +Signed-off-by: Bitterblue Smith +--- + .../net/wireless/realtek/rtw88/rtw8812au.c | 68 ++++++++++++++++++- + 1 file changed, 67 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/realtek/rtw88/rtw8812au.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8812au.c +@@ -9,8 +9,74 @@ + #include "usb.h" + + static const struct usb_device_id rtw_8812au_id_table[] = { +- { USB_DEVICE_AND_INTERFACE_INFO(0x2604, 0x0012, 0xff, 0xff, 0xff), ++ { USB_DEVICE_AND_INTERFACE_INFO(RTW_USB_VENDOR_ID_REALTEK, 0x8812, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8812a_hw_spec) }, ++ { USB_DEVICE_AND_INTERFACE_INFO(RTW_USB_VENDOR_ID_REALTEK, 0x881a, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8812a_hw_spec) }, ++ { USB_DEVICE_AND_INTERFACE_INFO(RTW_USB_VENDOR_ID_REALTEK, 0x881b, 0xff, 0xff, 0xff), + .driver_info = (kernel_ulong_t)&(rtw8812a_hw_spec) }, ++ { USB_DEVICE_AND_INTERFACE_INFO(RTW_USB_VENDOR_ID_REALTEK, 0x881c, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8812a_hw_spec) }, ++ { USB_DEVICE_AND_INTERFACE_INFO(0x0409, 0x0408, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8812a_hw_spec) }, /* NEC */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x0411, 0x025d, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8812a_hw_spec) }, /* Buffalo */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x04bb, 0x0952, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8812a_hw_spec) }, /* I-O DATA */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x050d, 0x1106, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8812a_hw_spec) }, /* Belkin */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x050d, 0x1109, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8812a_hw_spec) }, /* Belkin */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x0586, 0x3426, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8812a_hw_spec) }, /* ZyXEL */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x0789, 0x016e, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8812a_hw_spec) }, /* Logitec */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x07b8, 0x8812, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8812a_hw_spec) }, /* Abocom */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x0846, 0x9051, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8812a_hw_spec) }, /* Netgear */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x0b05, 0x17d2, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8812a_hw_spec) }, /* ASUS */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x0df6, 0x0074, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8812a_hw_spec) }, /* Sitecom */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x0e66, 0x0022, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8812a_hw_spec) }, /* Hawking */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x1058, 0x0632, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8812a_hw_spec) }, /* WD */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x13b1, 0x003f, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8812a_hw_spec) }, /* Linksys */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x148f, 0x9097, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8812a_hw_spec) }, /* Amped Wireless */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x1740, 0x0100, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8812a_hw_spec) }, /* EnGenius */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x330e, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8812a_hw_spec) }, /* D-Link */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x3313, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8812a_hw_spec) }, /* D-Link */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x3315, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8812a_hw_spec) }, /* D-Link */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x3316, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8812a_hw_spec) }, /* D-Link */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x2019, 0xab30, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8812a_hw_spec) }, /* Planex */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x20f4, 0x805b, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8812a_hw_spec) }, /* TRENDnet */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x2357, 0x0101, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8812a_hw_spec) }, /* TP-Link */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x2357, 0x0103, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8812a_hw_spec) }, /* TP-Link */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x2357, 0x010d, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8812a_hw_spec) }, /* TP-Link */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x2357, 0x010e, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8812a_hw_spec) }, /* TP-Link */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x2357, 0x010f, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8812a_hw_spec) }, /* TP-Link */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x2357, 0x0122, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8812a_hw_spec) }, /* TP-Link */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x2604, 0x0012, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8812a_hw_spec) }, /* Tenda */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x7392, 0xa822, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8812a_hw_spec) }, /* Edimax */ + {}, + }; + MODULE_DEVICE_TABLE(usb, rtw_8812au_id_table); diff --git a/package/kernel/mac80211/patches/rtl/048-wifi-rtw88-usb-Support-USB-3-with-RTL8812AU.patch b/package/kernel/mac80211/patches/rtl/048-wifi-rtw88-usb-Support-USB-3-with-RTL8812AU.patch new file mode 100644 index 00000000000000..2ccefb98939022 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/048-wifi-rtw88-usb-Support-USB-3-with-RTL8812AU.patch @@ -0,0 +1,69 @@ +From 213dfa630285bb0241f3eaeb778db8ff128f10ba Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Fri, 8 Nov 2024 01:41:08 +0200 +Subject: [PATCH 3/6] wifi: rtw88: usb: Support USB 3 with RTL8812AU + +Add the function to automatically switch the RTL8812AU into USB 3 mode. + +Signed-off-by: Bitterblue Smith +--- + drivers/net/wireless/realtek/rtw88/usb.c | 34 ++++++++++++++++++++++-- + 1 file changed, 32 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/realtek/rtw88/usb.c ++++ b/drivers/net/wireless/realtek/rtw88/usb.c +@@ -929,6 +929,32 @@ static void rtw_usb_intf_deinit(struct r + usb_set_intfdata(intf, NULL); + } + ++static int rtw_usb_switch_mode_old(struct rtw_dev *rtwdev) ++{ ++ struct rtw_usb *rtwusb = rtw_get_usb_priv(rtwdev); ++ enum usb_device_speed cur_speed = rtwusb->udev->speed; ++ u8 hci_opt; ++ ++ if (cur_speed == USB_SPEED_HIGH) { ++ hci_opt = rtw_read8(rtwdev, REG_HCI_OPT_CTRL); ++ ++ if ((hci_opt & (BIT(2) | BIT(3))) != BIT(3)) { ++ rtw_write8(rtwdev, REG_HCI_OPT_CTRL, 0x8); ++ rtw_write8(rtwdev, REG_SYS_SDIO_CTRL, 0x2); ++ rtw_write8(rtwdev, REG_ACLK_MON, 0x1); ++ rtw_write8(rtwdev, 0x3d, 0x3); ++ /* usb disconnect */ ++ rtw_write8(rtwdev, REG_SYS_PW_CTRL + 1, 0x80); ++ return 1; ++ } ++ } else if (cur_speed == USB_SPEED_SUPER) { ++ rtw_write8_clr(rtwdev, REG_SYS_SDIO_CTRL, BIT(1)); ++ rtw_write8_clr(rtwdev, REG_ACLK_MON, BIT(0)); ++ } ++ ++ return 0; ++} ++ + static int rtw_usb_switch_mode_new(struct rtw_dev *rtwdev) + { + enum usb_device_speed cur_speed; +@@ -982,7 +1008,8 @@ static int rtw_usb_switch_mode(struct rt + { + u8 id = rtwdev->chip->id; + +- if (id != RTW_CHIP_TYPE_8822C && id != RTW_CHIP_TYPE_8822B) ++ if (id != RTW_CHIP_TYPE_8822C && id != RTW_CHIP_TYPE_8822B && ++ id != RTW_CHIP_TYPE_8812A) + return 0; + + if (!rtwdev->efuse.usb_mode_switch) { +@@ -997,7 +1024,10 @@ static int rtw_usb_switch_mode(struct rt + return 0; + } + +- return rtw_usb_switch_mode_new(rtwdev); ++ if (id == RTW_CHIP_TYPE_8812A) ++ return rtw_usb_switch_mode_old(rtwdev); ++ else /* RTL8822CU, RTL8822BU */ ++ return rtw_usb_switch_mode_new(rtwdev); + } + + int rtw_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) diff --git a/package/kernel/mac80211/patches/rtl/049-wifi-rtw88-usb-Enable-RX-aggregation-for-8821au-8812.patch b/package/kernel/mac80211/patches/rtl/049-wifi-rtw88-usb-Enable-RX-aggregation-for-8821au-8812.patch new file mode 100644 index 00000000000000..00775c0281e99b --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/049-wifi-rtw88-usb-Enable-RX-aggregation-for-8821au-8812.patch @@ -0,0 +1,65 @@ +From 2b38362bd3b8e0a3691f0a8e82444a54f702e384 Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Fri, 8 Nov 2024 01:43:50 +0200 +Subject: [PATCH 4/6] wifi: rtw88: usb: Enable RX aggregation for 8821au/8812au + +USB RX aggregation improves the RX speed on certain ARM systems, like +the NanoPi NEO Core2. With RTL8811AU, before: 30 Mbps, after: 224 Mbps. + +The out-of-tree driver uses aggregation size of 7 in USB 3 mode, but +that doesn't work here. rtw88 advertises support for receiving AMSDU +in AMPDU, so the AP sends larger frames, up to ~5100 bytes. With a size +of 7 RTL8812AU frequently tries to aggregate more frames than will fit +in 32768 bytes. Use a size of 6 instead. + +Signed-off-by: Bitterblue Smith +--- + drivers/net/wireless/realtek/rtw88/usb.c | 30 ++++++++++++++++++++++++ + 1 file changed, 30 insertions(+) + +--- a/drivers/net/wireless/realtek/rtw88/usb.c ++++ b/drivers/net/wireless/realtek/rtw88/usb.c +@@ -788,6 +788,32 @@ static void rtw_usb_dynamic_rx_agg_v1(st + rtw_write16(rtwdev, REG_RXDMA_AGG_PG_TH, val16); + } + ++static void rtw_usb_dynamic_rx_agg_v2(struct rtw_dev *rtwdev, bool enable) ++{ ++ struct rtw_usb *rtwusb = rtw_get_usb_priv(rtwdev); ++ u8 size, timeout; ++ u16 val16; ++ ++ if (rtwusb->udev->speed == USB_SPEED_SUPER) { ++ size = 0x6; ++ timeout = 0x1a; ++ } else { ++ size = 0x5; ++ timeout = 0x20; ++ } ++ ++ if (!enable) { ++ size = 0x0; ++ timeout = 0x1; ++ } ++ ++ val16 = u16_encode_bits(size, BIT_RXDMA_AGG_PG_TH) | ++ u16_encode_bits(timeout, BIT_DMA_AGG_TO_V1); ++ ++ rtw_write16(rtwdev, REG_RXDMA_AGG_PG_TH, val16); ++ rtw_write8_set(rtwdev, REG_TXDMA_PQ_MAP, BIT_RXDMA_AGG_EN); ++} ++ + static void rtw_usb_dynamic_rx_agg(struct rtw_dev *rtwdev, bool enable) + { + switch (rtwdev->chip->id) { +@@ -796,6 +822,10 @@ static void rtw_usb_dynamic_rx_agg(struc + case RTW_CHIP_TYPE_8821C: + rtw_usb_dynamic_rx_agg_v1(rtwdev, enable); + break; ++ case RTW_CHIP_TYPE_8821A: ++ case RTW_CHIP_TYPE_8812A: ++ rtw_usb_dynamic_rx_agg_v2(rtwdev, enable); ++ break; + case RTW_CHIP_TYPE_8723D: + /* Doesn't like aggregation. */ + break; diff --git a/package/kernel/mac80211/patches/rtl/050-wifi-rtlwifi-rtl8821ae-phy-restore-removed-code-to-f.patch b/package/kernel/mac80211/patches/rtl/050-wifi-rtlwifi-rtl8821ae-phy-restore-removed-code-to-f.patch new file mode 100644 index 00000000000000..798a59351f7a0d --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/050-wifi-rtlwifi-rtl8821ae-phy-restore-removed-code-to-f.patch @@ -0,0 +1,32 @@ +From 927dcd0ab53f39ee00a2d1f204b5aac77e28fcf9 Mon Sep 17 00:00:00 2001 +From: Colin Ian King +Date: Wed, 6 Nov 2024 15:46:42 +0000 +Subject: [PATCH 5/6] wifi: rtlwifi: rtl8821ae: phy: restore removed code to + fix infinite loop + +A previous clean-up fix removed the assignment of v2 inside a while loop +that turned it into an infinite loop. Fix this by restoring the assignment +of v2 from array[] so that v2 is updated inside the loop. + +Fixes: cda37445718d ("wifi: rtlwifi: rtl8821ae: phy: remove some useless code") +Signed-off-by: Colin Ian King +Tested-by: Ping-Ke Shih +Reviewed-by: Su Hui +--- + drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c ++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c +@@ -2033,8 +2033,10 @@ static bool _rtl8821ae_phy_config_bb_wit + if (!_rtl8821ae_check_condition(hw, v1)) { + i += 2; /* skip the pair of expression*/ + v2 = array[i+1]; +- while (v2 != 0xDEAD) ++ while (v2 != 0xDEAD) { + i += 3; ++ v2 = array[i + 1]; ++ } + } + } + } diff --git a/package/kernel/mac80211/patches/rtl/051-wifi-rtw88-Add-additional-USB-IDs-for-RTL8812BU.patch b/package/kernel/mac80211/patches/rtl/051-wifi-rtw88-Add-additional-USB-IDs-for-RTL8812BU.patch new file mode 100644 index 00000000000000..e4e26c79751116 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/051-wifi-rtw88-Add-additional-USB-IDs-for-RTL8812BU.patch @@ -0,0 +1,31 @@ +From acadf3a63b39ad03167a633fa3cea8c0fc2ab87f Mon Sep 17 00:00:00 2001 +From: Nick Morrow +Date: Thu, 7 Nov 2024 08:28:46 +0800 +Subject: [PATCH 6/6] wifi: rtw88: Add additional USB IDs for RTL8812BU + +Add three additional USB IDs found in +https://github.com/morrownr/88x2bu-20210702 +to support more RTL8812BU devices. + +Signed-off-by: Nick Morrow +Signed-off-by: Zenm Chen +Signed-off-by: Mikhail Novosyolov +--- + drivers/net/wireless/realtek/rtw88/rtw8822bu.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/net/wireless/realtek/rtw88/rtw8822bu.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8822bu.c +@@ -67,6 +67,12 @@ static const struct usb_device_id rtw_88 + .driver_info = (kernel_ulong_t)&(rtw8822b_hw_spec) }, /* LiteOn */ + { USB_DEVICE_AND_INTERFACE_INFO(0x20f4, 0x808a, 0xff, 0xff, 0xff), + .driver_info = (kernel_ulong_t)&(rtw8822b_hw_spec) }, /* TRENDnet TEW-808UBM */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x20f4, 0x805a, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8822b_hw_spec) }, /* TRENDnet TEW-805UBH */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x056e, 0x4011, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8822b_hw_spec) }, /* ELECOM WDB-867DU3S */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x2c4e, 0x0107, 0xff, 0xff, 0xff), ++ .driver_info = (kernel_ulong_t)&(rtw8822b_hw_spec) }, /* Mercusys MA30H */ + {}, + }; + MODULE_DEVICE_TABLE(usb, rtw_8822bu_id_table); From 1eba94e67b53b803125090c25e7fa3b2a5cfa572 Mon Sep 17 00:00:00 2001 From: Marty Jones Date: Sun, 13 Oct 2024 17:15:53 -0400 Subject: [PATCH 184/877] mac80211: realtek: add RTL8812au/RTL8821au support This adds support for RTL8812au/RTL8821au USB adapters. Run-tested: x86/64/rockchip USB adapters tested: Alfa AWUS036ACS, D-Link DWA-171 A1. Signed-off-by: Marty Jones Link: https://github.com/openwrt/openwrt/pull/17079 Signed-off-by: Hauke Mehrtens (cherry picked from commit ac8d30a645965ad4e1f1ca9b71e49613166b8a29) --- package/kernel/mac80211/realtek.mk | 49 ++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/package/kernel/mac80211/realtek.mk b/package/kernel/mac80211/realtek.mk index 4a6f10cddc51bb..6ac4b1aee9873c 100644 --- a/package/kernel/mac80211/realtek.mk +++ b/package/kernel/mac80211/realtek.mk @@ -4,6 +4,7 @@ PKG_DRIVERS += \ rtl8723bs rtl8821ae rtl8xxxu rtw88 rtw88-pci rtw88-usb rtw88-sdio rtw88-8821c \ rtw88-8822b rtw88-8822c rtw88-8723x rtw88-8723d rtw88-8821ce rtw88-8821cu \ rtw88-8822be rtw88-8822bu rtw88-8822ce rtw88-8822cu rtw88-8723de rtw88-8723ds \ + rtw88-88xxa rtw88-8821a rtw88-8812a rtw88-8821au rtw88-8812au \ rtw88-8723du rtw89 rtw89-pci rtw89-8851be rtw89-8852ae rtw89-8852b-common \ rtw89-8852be rtw89-8852ce rtw89-8922ae @@ -48,6 +49,11 @@ config-$(call config_package,rtw88-8723d) += RTW88_8723D config-$(call config_package,rtw88-8723de) += RTW88_8723DE config-$(call config_package,rtw88-8723ds) += RTW88_8723DS config-$(call config_package,rtw88-8723du) += RTW88_8723DU +config-$(call config_package,rtw88-88xxa) += RTW88_88XXA +config-$(call config_package,rtw88-8821a) += RTW88_8821A +config-$(call config_package,rtw88-8812a) += RTW88_8812A +config-$(call config_package,rtw88-8821au) += RTW88_8821AU +config-$(call config_package,rtw88-8812au) += RTW88_8812AU config-$(CONFIG_PACKAGE_RTW88_DEBUG) += RTW88_DEBUG config-$(CONFIG_PACKAGE_RTW88_DEBUGFS) += RTW88_DEBUGFS @@ -255,6 +261,33 @@ define KernelPackage/rtw88-usb HIDDEN:=1 endef +define KernelPackage/rtw88-88xxa + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8812A/RTL8821A family support + DEPENDS+= +@DRIVER_11AC_SUPPORT +kmod-rtw88-usb + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_88xxa.ko + AUTOLOAD:=$(call AutoProbe,rtw88_88xxa) + HIDDEN:=1 +endef + +define KernelPackage/rtw88-8821a + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8821A family support + DEPENDS+= +kmod-rtw88-88xxa + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8821a.ko + AUTOLOAD:=$(call AutoProbe,rtw88_8821a) + HIDDEN:=1 +endef + +define KernelPackage/rtw88-8812a + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8812A family support + DEPENDS+= +kmod-rtw88-88xxa + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8812a.ko + AUTOLOAD:=$(call AutoProbe,rtw88_8812a) + HIDDEN:=1 +endef + define KernelPackage/rtw88-8821c $(call KernelPackage/mac80211/Default) TITLE:=Realtek RTL8821C family support @@ -300,6 +333,22 @@ define KernelPackage/rtw88-8723d HIDDEN:=1 endef +define KernelPackage/rtw88-8821au + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8821AU support + DEPENDS+= +kmod-rtw88-8821a +rtl8821a-firmware + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8821au.ko + AUTOLOAD:=$(call AutoProbe,rtw88_8821au) +endef + +define KernelPackage/rtw88-8812au + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8812AU support + DEPENDS+= +kmod-rtw88-8812a +rtl8812a-firmware + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8812au.ko + AUTOLOAD:=$(call AutoProbe,rtw88_8812au) +endef + define KernelPackage/rtw88-8821ce $(call KernelPackage/mac80211/Default) TITLE:=Realtek RTL8821CE support From 5afd3daebad3d0e115afbf76574095bfeb82f976 Mon Sep 17 00:00:00 2001 From: Eric Long Date: Mon, 25 Nov 2024 21:26:47 +0800 Subject: [PATCH 185/877] bpftool: turn off libbfd feature in host build libbfd feature is not used when building eBPF program, and it makes bpftool fail to build in a clean environment, since binutils in toolchain have libbfd disabled. Signed-off-by: Eric Long Link: https://github.com/openwrt/openwrt/pull/17073 Signed-off-by: Robert Marko (cherry picked from commit 3d8d81883fb2e607590bcb523587e37e1485b3b8) --- package/network/utils/bpftool/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/network/utils/bpftool/Makefile b/package/network/utils/bpftool/Makefile index f2726d18969090..c6cc92e18d16c4 100644 --- a/package/network/utils/bpftool/Makefile +++ b/package/network/utils/bpftool/Makefile @@ -97,7 +97,7 @@ HOST_MAKE_FLAGS += \ $(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \ check_feat=0 \ feature-clang-bpf-co-re=0 \ - feature-libbfd=1 \ + feature-libbfd=0 \ feature-llvm=0 \ feature-libcap=0 \ feature-disassembler-four-args=1 \ From b9df2d79b657574dcba018816b7ffd492df9ce79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Niesner?= Date: Sat, 7 Dec 2024 17:55:29 +0100 Subject: [PATCH 186/877] mediatek: filogic: prevent faulty mac address assignment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The vendor U-Boot on the Cudy WR3000 assign random mac addresses on boot and set the 'local-mac-address' property which prevents Openwrt from assigning the correct address from evmem. This patch removes the alias for ethernet0 so that U-Boot doesn't add the property. Related to: a55ab9e1343e ("mediatek: filogic: prevent faulty mac address assignment") Fixes: https://github.com/openwrt/openwrt/issues/15587 Signed-off-by: Ondřej Niesner Link: https://github.com/openwrt/openwrt/pull/17201 Signed-off-by: Hauke Mehrtens (cherry picked from commit a498a84393a80de9f828b8465906761896ca4940) --- target/linux/mediatek/dts/mt7981b-cudy-wr3000-v1.dts | 1 - 1 file changed, 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 1ded8b5a687d83..8af8ef401f43ba 100644 --- a/target/linux/mediatek/dts/mt7981b-cudy-wr3000-v1.dts +++ b/target/linux/mediatek/dts/mt7981b-cudy-wr3000-v1.dts @@ -11,7 +11,6 @@ compatible = "cudy,wr3000-v1", "mediatek,mt7981"; aliases { - ethernet0 = &gmac0; label-mac-device = &gmac0; led-boot = &led_status; led-failsafe = &led_status; From d48e499fc1f2722491d9952bd4c3db007d151505 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 8 Dec 2024 16:18:52 +0100 Subject: [PATCH 187/877] mediatek: filogic: Migrate wifi configuration device paths The device path to the devices changed. Migrate the wifi configurations from the old path to the new one. This is needed to migrate Wireless configurations from OpenWrt 23.05 to OpenWrt 24.10. This script is based on these two files: target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/05-wifi-migrate target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/ieee80211/05-wifi-migrate Fixes: 0ef927472148 ("mediatek: filogic: move mt7981 on-SoC blocks to "soc" node in DT") Fixes: https://github.com/openwrt/openwrt/issues/17174 Link: https://github.com/openwrt/openwrt/pull/17210 Signed-off-by: Hauke Mehrtens (cherry picked from commit f8b93e2d12ef01fc565178c71c39470da798155a) --- .../etc/hotplug.d/ieee80211/05-wifi-migrate | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/05-wifi-migrate diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/05-wifi-migrate b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/05-wifi-migrate new file mode 100644 index 00000000000000..ae3bc643cd5d0d --- /dev/null +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/05-wifi-migrate @@ -0,0 +1,63 @@ +#!/bin/sh + +# This must run before 10-wifi-detect + + +[ "${ACTION}" = "add" ] || return + + +. /lib/functions.sh + + +check_radio() +{ + local cfg="$1" to="$2" + + config_get path "$cfg" path + + [ "$path" = "$to" ] && PATH_EXISTS=true +} + +do_migrate_radio() +{ + local cfg="$1" from="$2" to="$3" + + config_get path "$cfg" path + + [ "$path" = "$from" ] || return + + uci set "wireless.${cfg}.path=${to}" + WIRELESS_CHANGED=true + + logger -t wifi-migrate "Updated path of wireless.${cfg} from '${from}' to '${to}'" +} + +migrate_radio() +{ + local from="$1" to="$2" + + config_load wireless + + # Check if there is already a section with the target path: In this case, the system + # was already upgraded to a version without this migration script before; better bail out, + # as we can't be sure we don't break more than we fix. + PATH_EXISTS=false + config_foreach check_radio wifi-device "$to" + $PATH_EXISTS && return + + config_foreach do_migrate_radio wifi-device "$from" "$to" +} + + +WIRELESS_CHANGED=false + +case "$(board_name)" in +*) + migrate_radio 'platform/18000000.wifi' 'platform/soc/18000000.wifi' + migrate_radio 'platform/18000000.wifi+1' 'platform/soc/18000000.wifi+1' + ;; +esac + +$WIRELESS_CHANGED && uci commit wireless + +exit 0 From d79a70542bd9f0348758c9e4ca49adcf3d51f201 Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Sun, 20 Oct 2024 12:20:04 +0000 Subject: [PATCH 188/877] arm-trusted-firmware-mediatek: add mt7986-spim-nand-ddr3 build This commit adds mt7986-spim-nand-ddr3 build required for MERCUSYS MR90X v1. Signed-off-by: Mikhail Zhilkin Link: https://github.com/openwrt/openwrt/pull/16744 (cherry picked from commit 2ea9ede7a8a94bddef599decfe6948c5c20dbfa5) Signed-off-by: Mikhail Zhilkin Link: https://github.com/openwrt/openwrt/pull/17129 Signed-off-by: Hauke Mehrtens --- package/boot/arm-trusted-firmware-mediatek/Makefile | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/package/boot/arm-trusted-firmware-mediatek/Makefile b/package/boot/arm-trusted-firmware-mediatek/Makefile index 3f70f337845150..c8988fa4003719 100644 --- a/package/boot/arm-trusted-firmware-mediatek/Makefile +++ b/package/boot/arm-trusted-firmware-mediatek/Makefile @@ -352,6 +352,15 @@ define Trusted-Firmware-A/mt7986-spim-nand-ddr3 DDR_TYPE:=ddr3 endef +define Trusted-Firmware-A/mt7986-spim-nand-ubi-ddr3 + NAME:=MediaTek MT7986 (SPI-NAND via SPIM using UBI, DDR3) + BOOT_DEVICE:=spim-nand + BUILD_SUBTARGET:=filogic + PLAT:=mt7986 + DDR_TYPE:=ddr3 + USE_UBI:=1 +endef + define Trusted-Firmware-A/mt7988-nor-ddr3 NAME:=MediaTek MT7988 (SPI-NOR, DDR3) BOOT_DEVICE:=nor @@ -531,6 +540,7 @@ TFA_TARGETS:= \ mt7986-sdmmc-ddr3 \ mt7986-snand-ddr3 \ mt7986-spim-nand-ddr3 \ + mt7986-spim-nand-ubi-ddr3 \ mt7986-ram-ddr4 \ mt7986-emmc-ddr4 \ mt7986-nor-ddr4 \ @@ -570,6 +580,7 @@ TFA_MAKE_FLAGS += \ $(if $(RAM_BOOT_UART_DL),RAM_BOOT_UART_DL=1) \ $(if $(USE_UBI),UBI=1 $(if $(findstring mt7622,$(PLAT)),OVERRIDE_UBI_START_ADDR=0x80000)) \ $(if $(USE_UBI),UBI=1 $(if $(findstring mt7981,$(PLAT)),OVERRIDE_UBI_START_ADDR=0x100000)) \ + $(if $(USE_UBI),UBI=1 $(if $(findstring mt7986,$(PLAT)),OVERRIDE_UBI_START_ADDR=0x200000)) \ $(if $(RAM_BOOT_UART_DL),bl2,all) define Package/trusted-firmware-a-ram/install From 24bddf68bd9a5fe670d1664a44a30d42c7784c00 Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Sun, 20 Oct 2024 12:20:51 +0000 Subject: [PATCH 189/877] uboot-mediatek: add MERCUSYS MR90X v1 support Add U-Boot replacement loader for the MERCUSYS MR90X. This is required to increase available flash space in OpenWrt. Signed-off-by: Mikhail Zhilkin Link: https://github.com/openwrt/openwrt/pull/16744 (cherry picked from commit 77cc4b712700e51f5d779e4e7385639fa4e16ca9) Signed-off-by: Mikhail Zhilkin Link: https://github.com/openwrt/openwrt/pull/17129 Signed-off-by: Hauke Mehrtens --- package/boot/uboot-mediatek/Makefile | 13 + .../patches/459-add-mercusys-mr90x-v1.patch | 343 ++++++++++++++++++ 2 files changed, 356 insertions(+) create mode 100644 package/boot/uboot-mediatek/patches/459-add-mercusys-mr90x-v1.patch diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile index fa314da3998e65..8fda29afa6f3db 100644 --- a/package/boot/uboot-mediatek/Makefile +++ b/package/boot/uboot-mediatek/Makefile @@ -570,6 +570,18 @@ define U-Boot/mt7986_jdcloud_re-cp-03 DEPENDS:=+trusted-firmware-a-mt7986-emmc-ddr4 endef +define U-Boot/mt7986_mercusys_mr90x-v1 + NAME:=MERCUSYS MR90X v1 + BUILD_SUBTARGET:=filogic + BUILD_DEVICES:=mercusys_mr90x-v1-ubi + UBOOT_CONFIG:=mt7986_mercusys_mr90x-v1 + UBOOT_IMAGE:=u-boot.fip + BL2_BOOTDEV:=spim-nand-ubi + BL2_SOC:=mt7986 + BL2_DDRTYPE:=ddr3 + DEPENDS:=+trusted-firmware-a-mt7986-spim-nand-ubi-ddr3 +endef + define U-Boot/mt7986_netcore_n60 NAME:=Netcore N60 BUILD_SUBTARGET:=filogic @@ -847,6 +859,7 @@ UBOOT_TARGETS := \ mt7986_bananapi_bpi-r3-mini-snand \ mt7986_glinet_gl-mt6000 \ mt7986_jdcloud_re-cp-03 \ + mt7986_mercusys_mr90x-v1 \ mt7986_netcore_n60 \ mt7986_tplink_tl-xdr4288 \ mt7986_tplink_tl-xdr6086 \ diff --git a/package/boot/uboot-mediatek/patches/459-add-mercusys-mr90x-v1.patch b/package/boot/uboot-mediatek/patches/459-add-mercusys-mr90x-v1.patch new file mode 100644 index 00000000000000..4fae619aa1a2a9 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/459-add-mercusys-mr90x-v1.patch @@ -0,0 +1,343 @@ +--- /dev/null ++++ b/configs/mt7986_mercusys_mr90x-v1_defconfig +@@ -0,0 +1,107 @@ ++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="mt7986b-mercusys_mr90x-v1" ++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_FIT=y ++CONFIG_BOOTDELAY=30 ++CONFIG_AUTOBOOT_KEYED=y ++CONFIG_AUTOBOOT_MENU_SHOW=y ++CONFIG_DEFAULT_FDT_FILE="mediatek/mt7986b-mercusys_mr90x-v1.dtb" ++CONFIG_LOGLEVEL=7 ++CONFIG_PRE_CONSOLE_BUFFER=y ++CONFIG_LOG=y ++CONFIG_BOARD_LATE_INIT=y ++CONFIG_HUSH_PARSER=y ++CONFIG_SYS_PROMPT="MT7986> " ++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_MTD=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_PXE=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_CMD_UBI=y ++CONFIG_CMD_UBI_RENAME=y ++CONFIG_OF_EMBED=y ++CONFIG_ENV_OVERWRITE=y ++CONFIG_ENV_IS_IN_UBI=y ++CONFIG_SYS_REDUNDAND_ENVIRONMENT=y ++CONFIG_ENV_UBI_PART="ubi" ++CONFIG_ENV_UBI_VOLUME="ubootenv" ++CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2" ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_USE_DEFAULT_ENV_FILE=y ++CONFIG_DEFAULT_ENV_FILE="mercusys_mr90x-v1_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_I2C is not set ++# CONFIG_MMC is not set ++CONFIG_LED=y ++CONFIG_LED_BLINK=y ++CONFIG_LED_GPIO=y ++CONFIG_MTD=y ++CONFIG_DM_MTD=y ++CONFIG_MTD_SPI_NAND=y ++CONFIG_MTD_UBI_FASTMAP=y ++CONFIG_PHY_FIXED=y ++CONFIG_MEDIATEK_ETH=y ++CONFIG_PHY=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_RAM=y ++CONFIG_DM_SERIAL=y ++CONFIG_MTK_SERIAL=y ++CONFIG_SPI=y ++CONFIG_DM_SPI=y ++CONFIG_MTK_SPIM=y ++CONFIG_RANDOM_UUID=y ++CONFIG_ZSTD=y ++CONFIG_HEXDUMP=y ++CONFIG_LMB_MAX_REGIONS=64 +--- /dev/null ++++ b/arch/arm/dts/mt7986b-mercusys_mr90x-v1.dts +@@ -0,0 +1,174 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (c) 2024 ++ * Author: Mikhail Zhilkin ++ */ ++ ++/dts-v1/; ++#include "mt7986.dtsi" ++#include ++#include ++ ++/ { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ model = "MERCUSYS MR90X v1"; ++ compatible = "mediatek,mt7986", "mediatek,mt7986-rfb"; ++ ++ chosen { ++ stdout-path = &uart0; ++ tick-timer = &timer0; ++ }; ++ ++ memory@40000000 { ++ device_type = "memory"; ++ reg = <0x40000000 0x20000000>; ++ }; ++ ++ keys { ++ compatible = "gpio-keys"; ++ ++ reset { ++ label = "reset"; ++ linux,code = ; ++ gpios = <&gpio 10 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ led-0 { ++ label = "green:lan2"; ++ gpios = <&gpio 7 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-1 { ++ label = "green:lan1"; ++ gpios = <&gpio 9 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-2 { ++ label = "green:lan0"; ++ gpios = <&gpio 12 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-3 { ++ label = "green:wan"; ++ gpios = <&gpio 13 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-4 { ++ label = "amber:status"; ++ gpios = <&gpio 16 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ led_status_green: led-5 { ++ label = "green:status"; ++ gpios = <&gpio 17 GPIO_ACTIVE_HIGH>; ++ }; ++ }; ++}; ++ ++&uart0 { ++ 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 5 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 = "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 = ; ++ }; ++ }; ++ ++ spic_pins: spi1-pins-func-1 { ++ mux { ++ function = "spi"; ++ groups = "spi1_2"; ++ }; ++ }; ++ ++ uart1_pins: spi1-pins-func-3 { ++ mux { ++ function = "uart"; ++ groups = "uart1_2"; ++ }; ++ }; ++}; ++ ++&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; ++ tick_dly = <2>; ++ sample_sel = <0>; ++ ++ spi_nand@1 { ++ compatible = "spi-nand"; ++ reg = <1>; ++ spi-max-frequency = <20000000>; ++ ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ partition@0 { ++ reg = <0x0 0x100000>; ++ label = "bl2"; ++ }; ++ ++ partition@100000 { ++ reg = <0x100000 0x100000>; ++ label = "factory"; ++ }; ++ ++ partition@200000 { ++ reg = <0x200000 0x7e00000>; ++ label = "ubi"; ++ }; ++ }; ++ }; ++}; ++ ++&watchdog { ++ status = "disabled"; ++}; +--- /dev/null ++++ b/mercusys_mr90x-v1_env +@@ -0,0 +1,53 @@ ++ipaddr=192.168.1.1 ++serverip=192.168.1.254 ++loadaddr=0x46000000 ++console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0 ++bootargs=console=ttyS0,115200n8 console_msg_format=syslog ++bootcmd=run check_buttons ; run boot_production ; run boot_recovery ++bootconf=config-1 ++bootdelay=0 ++bootfile=openwrt-mediatek-filogic-mercusys_mr90x-v1-ubi-initramfs-recovery.itb ++bootfile_bl2=openwrt-mediatek-filogic-mercusys_mr90x-v1-ubi-preloader.bin ++bootfile_fip=openwrt-mediatek-filogic-mercusys_mr90x-v1-ubi-bl31-uboot.fip ++bootfile_upg=openwrt-mediatek-filogic-mercusys_mr90x-v1-ubi-squashfs-sysupgrade.itb ++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.=noboot=1 ; replacevol=1 ; run boot_tftp_production ; noboot= ; replacevol= ; run bootmenu_confirm_return ++bootmenu_5=Load recovery system via TFTP then write to NAND.=noboot=1 ; replacevol=1 ; run boot_tftp_recovery ; noboot= ; 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_default=run led_boot ; run bootcmd ; run boot_recovery ; replacevol=1 ; run boot_tftp_forever ++boot_production=run led_boot ; run ubi_read_production && bootm $loadaddr#$bootconf ++boot_recovery=run led_boot ; run ubi_read_recovery && bootm $loadaddr#$bootconf ++boot_tftp=run led_boot ; tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf ++boot_tftp_forever=run led_boot ; while true ; do run boot_tftp ; sleep 1 ; done ++boot_tftp_production=run led_boot ; tftpboot $loadaddr $bootfile_upg && test $replacevol = 1 && iminfo $loadaddr && run ubi_write_production ; if test $noboot = 1 ; then else bootm $loadaddr#$bootconf ; fi ++boot_tftp_recovery=run led_boot ; tftpboot $loadaddr $bootfile && test $replacevol = 1 && iminfo $loadaddr && run ubi_write_recovery ; if test $noboot = 1 ; then else bootm $loadaddr#$bootconf ; fi ++boot_tftp_write_fip=run led_boot ; tftpboot $loadaddr $bootfile_fip && run ubi_write_fip && run reset_factory ++boot_tftp_write_bl2=run led_boot ; tftpboot $loadaddr $bootfile_bl2 && run snand_write_bl2 ++check_buttons=if button reset ; then run boot_tftp ; fi ++ethaddr_factory=mtd read factory 0x40080000 0x0 0x20000 && env readmem -b ethaddr 0x40088000 0x6 ; setenv ethaddr_factory ++led_boot=led green:status off ; led amber:status on ++reset_factory=mw $loadaddr 0xff 0x1f000 ; ubi write $loadaddr ubootenv 0x1f000 ; ubi write $loadaddr ubootenv2 0x1f000 ; ubi remove rootfs_data ++snand_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr 0x0 0x40000 ++ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x1f000 dynamic ; ubi check ubootenv2 || ubi create ubootenv2 0x1f000 dynamic ++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_fip=run ubi_remove_rootfs ; ubi check fip && ubi remove fip ; ubi create fip $filesize static && ubi write $loadaddr fip $filesize ++ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize ++ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize ++_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv ++_firstboot=setenv _firstboot ; run ethaddr_factory ; run _switch_to_menu ; run _init_env ; bootmenu ++_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 620aa8006450c69b9550ec347c7accddb8ae3a2c Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Sun, 20 Oct 2024 12:21:33 +0000 Subject: [PATCH 190/877] mediatek: MERCUSYS MR90X v1: add OpenWrt U-Boot (UBI) layout This commit adds OpenWrt U-Boot (UBI) layout support for MERCUSYS MR90X v1. Stock U-Boot UBI size: 50 MiB OpenWrt U-boot UBI size: 126 MiB Install ------- 1. Perform steps 1-14 of the OpenWrt installation guide (use OpenWrt initramfs-recovery.itb instead of initramfs-kernel.bin at the step 10, 12 and 14). Link: https://openwrt.org/toh/mercusys/mr90x_v1#installation 2. Make backups: ``` cat /dev/mtd0 > /tmp/boot.bin cat /dev/mtd5 > /tmp/tp_data.bin ``` Copy /tp_data dir content, /tmp/boot.bin and /tmp/tp_data.bin and to your PC using scp. You can also backup the remaining partititons. Copy backups to a safe place, they are required for the next steps and stock firmware recovery. 3. Reboot to OpenWrt initramfs: ``` reboot ``` 4. Copy OpenWrt ubi-bl31-uboot.fip, ubi-preloader.bin, ubi-squashfs-sysupgrade.itb and MT7986_EEPROM.bin, default-mac (from /tp_data backup) to the /tmp folder of the router using scp. 5. Prepare UBI: ``` ubidetach -p /dev/mtd3; ubiformat /dev/mtd3 -y; ubiattach -p /dev/mtd3 ubimkvol /dev/ubi0 -N fip -t static -s 1MiB ubiupdatevol /dev/ubi0_0 /tmp/ubi-bl31-uboot.fip ubimkvol /dev/ubi0 -N ubootenv -s 0x1f000 ubimkvol /dev/ubi0 -N ubootenv2 -s 0x1f000 ``` 6. Install kmod-mtd-rw and unlock partitions: ``` opkg update && opkg install kmod-mtd-rw insmod mtd-rw i_want_a_brick=1 mtd unlock boot mtd unlock bl2 mtd unlock factory ``` 7. Prepare "factory" partition: ``` dd if=/dev/zero bs=$((0x8000)) count=1 | tr '\000' '\377' > /tmp/factory.bin dd if=/tmp/MT7986_EEPROM.bin of=/tmp/factory.bin conv=notrunc dd if=/tmp/default-mac >> /tmp/factory.bin ``` 8. Write "factory" partition: ``` mtd erase factory mtd write /tmp/factory.bin factory ``` 9. Write preloader partition: ``` mtd erase bl2 mtd write /tmp/ubi-preloader.bin bl2 ``` 10. Write OpenWrt sysupgrade image: ``` sysupgrade -n /tmp/ubi-squashfs-sysupgrade.itb ``` Recovery -------- 1. Place OpenWrt initramfs-recovery.itb image (with original name) on the tftp server (IP: 192.168.1.254). 2. Press "reset" button and power on the router. After ~10 sec release the button. 3. Use OpenWrt initramfs system for recovery. BL2 and FIP recovery -------------------- Use mtk_uartboot and UART connetion if BL2 or FIP in UBI is destroyed: Link: https://github.com/981213/mtk_uartboot Link: https://openwrt.org/toh/mercusys/mr90x_v1#serial Return to stock: ---------------- 1. Copy "boot" partition backup (boot.bin) to the /tmp dir of the router using scp. 2. Install kmod-mtd-rw: ``` opkg update && opkg install kmod-mtd-rw ``` 3. Restore stock U-Boot: ``` insmod mtd-rw i_want_a_brick=1 mtd unlock boot mtd erase boot mtd write /tmp/boot.bin boot ``` 4. Erase UBI and reboot: ``` mtd erase ubi reboot ``` 5. Open U-Boot web recovery, upload stock firmware image and start upgrade. Link: http://192.168.1.1 6. Complete steps 1-9 of the OpenWrt installation guide to get root rights. Link: https://openwrt.org/toh/mercusys/mr90x_v1#installation 7. Upload "tp_data" partition backup (tp_data.bin) to the /tmp folder of the router using scp. 8. Restore stock calibrations: ``` mtd write /tmp/tp_data.bin tp_data reboot ``` 9. Perform "factory restore" via stock firmware web interface. Signed-off-by: Mikhail Zhilkin Link: https://github.com/openwrt/openwrt/pull/16744 (cherry picked from commit ee8df790cae843f11f78511dd9ffac7e80a4d707) Signed-off-by: Mikhail Zhilkin Link: https://github.com/openwrt/openwrt/pull/17129 Signed-off-by: Hauke Mehrtens --- .../uboot-envtools/files/mediatek_filogic | 1 + .../dts/mt7986b-mercusys-mr90x-v1-common.dtsi | 252 +++++++++++++++ .../dts/mt7986b-mercusys-mr90x-v1-ubi.dts | 124 ++++++++ .../dts/mt7986b-mercusys-mr90x-v1.dts | 290 ++---------------- .../filogic/base-files/etc/board.d/01_leds | 3 +- .../filogic/base-files/etc/board.d/02_network | 3 +- .../base-files/lib/upgrade/platform.sh | 1 + target/linux/mediatek/image/filogic.mk | 28 ++ 8 files changed, 434 insertions(+), 268 deletions(-) create mode 100644 target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1-common.dtsi create mode 100644 target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1-ubi.dts diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index 58db7dad281c0c..5bde699a47a47d 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -36,6 +36,7 @@ case "$board" in abt,asr3000|\ h3c,magic-nx30-pro|\ jcg,q30-pro|\ +mercusys,mr90x-v1-ubi|\ netcore,n60|\ nokia,ea0326gmp|\ qihoo,360t7|\ diff --git a/target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1-common.dtsi b/target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1-common.dtsi new file mode 100644 index 00000000000000..5522c58af21ed4 --- /dev/null +++ b/target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1-common.dtsi @@ -0,0 +1,252 @@ +// SPDX-License-Identifier: (GL-2.0 OR MIT) + +/dts-v1/; +#include +#include +#include + +#include "mt7986b.dtsi" + +/ { + aliases: aliases { + led-boot = &led_status_green; + led-failsafe = &led_status_green; + led-running = &led_status_green; + led-upgrade = &led_status_green; + + serial0 = &uart0; + }; + + chosen: 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 { + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <2>; + gpios = <&pio 7 GPIO_ACTIVE_LOW>; + }; + + led-1 { + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <1>; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + }; + + led-2 { + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <0>; + gpios = <&pio 12 GPIO_ACTIVE_LOW>; + }; + + led-3 { + color = ; + function = LED_FUNCTION_WAN; + gpios = <&pio 13 GPIO_ACTIVE_LOW>; + }; + + led-4 { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&pio 16 GPIO_ACTIVE_HIGH>; + panic-indicator; + }; + + led_status_green: led-5 { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&pio 17 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&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@1f { + 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-bus-width = <4>; + spi-rx-bus-width = <4>; + + partitions: partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + }; + }; +}; + +&trng { + status = "okay"; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&wf_2g_5g_pins>; + + ieee80211-freq-limit = <2400000 2500000>, <5170000 5835000>; +}; diff --git a/target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1-ubi.dts b/target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1-ubi.dts new file mode 100644 index 00000000000000..cfa195034d6d32 --- /dev/null +++ b/target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1-ubi.dts @@ -0,0 +1,124 @@ +// SPDX-License-Identifier: (GL-2.0 OR MIT) + +#include "mt7986b-mercusys-mr90x-v1-common.dtsi" + +/ { + compatible = "mercusys,mr90x-v1-ubi", "mediatek,mt7986b"; + model = "MERCUSYS MR90X v1 (UBI)"; +}; + +&aliases { + label-mac-device = &gmac0; +}; + +&chosen { + bootargs-append = " root=/dev/fit0 rootwait"; + rootdisk = <&ubi_fit>; +}; + +&gmac0 { + nvmem-cells = <&macaddr_factory_8000 0>; + nvmem-cell-names = "mac-address"; +}; + +&gmac1 { + nvmem-cells = <&macaddr_factory_8000 1>; + nvmem-cell-names = "mac-address"; +}; + +&partitions { + partition@0 { + label = "boot"; + reg = <0x0 0x200000>; + read-only; + + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "bl2"; + reg = <0x0 0x100000>; + read-only; + }; + + partition@100000 { + label = "factory"; + reg = <0x100000 0x100000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x1000>; + }; + + macaddr_factory_8000: macaddr@8000 { + compatible = "mac-base"; + reg = <0x8000 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + }; + + partition@200000 { + compatible = "linux,ubi"; + reg = <0x200000 0x7e00000>; + label = "ubi"; + + volumes { + ubi_fit: ubi-volume-fit { + volname = "fit"; + }; + + ubi_ubootenv: ubi-volume-ubootenv { + volname = "ubootenv"; + }; + + ubi_ubootenv2: ubi-volume-ubootenv2 { + volname = "ubootenv2"; + }; + }; + }; +}; + +&trng { + status = "okay"; +}; + +&uart0 { + status = "okay"; +}; + +&ubi_ubootenv { + nvmem-layout { + compatible = "u-boot,env-redundant-bool"; + }; +}; + +&ubi_ubootenv2 { + nvmem-layout { + compatible = "u-boot,env-redundant-bool"; + }; +}; + +&wifi { + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; + + band@0 { + reg = <0>; + nvmem-cells = <&macaddr_factory_8000 0>; + nvmem-cell-names = "mac-address"; + }; + + band@1 { + reg = <1>; + nvmem-cells = <&macaddr_factory_8000 (-1)>; + nvmem-cell-names = "mac-address"; + }; +}; diff --git a/target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1.dts b/target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1.dts index f0a995820ec1a4..16d890a3933531 100644 --- a/target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1.dts +++ b/target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1.dts @@ -1,286 +1,44 @@ // SPDX-License-Identifier: (GL-2.0 OR MIT) -/dts-v1/; -#include -#include -#include - -#include "mt7986b.dtsi" +#include "mt7986b-mercusys-mr90x-v1-common.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 { - color = ; - function = LED_FUNCTION_LAN; - function-enumerator = <2>; - gpios = <&pio 7 GPIO_ACTIVE_LOW>; - }; - - led-1 { - color = ; - function = LED_FUNCTION_LAN; - function-enumerator = <1>; - gpios = <&pio 9 GPIO_ACTIVE_LOW>; - }; - - led-2 { - color = ; - function = LED_FUNCTION_LAN; - function-enumerator = <0>; - gpios = <&pio 12 GPIO_ACTIVE_LOW>; - }; - - led-3 { - color = ; - function = LED_FUNCTION_WAN; - gpios = <&pio 13 GPIO_ACTIVE_LOW>; - }; - - led-4 { - color = ; - function = LED_FUNCTION_STATUS; - gpios = <&pio 16 GPIO_ACTIVE_HIGH>; - panic-indicator; - }; - - led_status_green: led-5 { - color = ; - function = LED_FUNCTION_STATUS; - gpios = <&pio 17 GPIO_ACTIVE_HIGH>; - }; - }; }; -&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; - }; +&partitions { + partition@0 { + label = "boot"; + reg = <0x0 0x200000>; + read-only; }; - gmac1: mac@1 { - compatible = "mediatek,eth-mac"; - reg = <1>; - phy-handle = <&phy6>; - phy-mode = "2500base-x"; + partition@200000 { + label = "u-boot-env"; + reg = <0x200000 0x100000>; }; - mdio: mdio-bus { - #address-cells = <1>; - #size-cells = <0>; + partition@300000 { + label = "ubi0"; + reg = <0x300000 0x3200000>; }; -}; - -&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>; + partition@3500000 { + label = "ubi1"; + reg = <0x3500000 0x3200000>; + read-only; }; - switch: switch@1f { - compatible = "mediatek,mt7531"; - reg = <31>; - reset-gpios = <&pio 5 GPIO_ACTIVE_HIGH>; + partition@6700000 { + label = "userconfig"; + reg = <0x6700000 0x800000>; + read-only; }; -}; - -&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-bus-width = <4>; - spi-rx-bus-width = <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; - }; - }; + 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 38c4b7525b60e7..64df50eb0a18e8 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 @@ -49,7 +49,8 @@ glinet,gl-xe3000) ucidef_set_led_netdev "wlan2g" "WLAN2G" "green:wifi2g" "phy0-ap0" ucidef_set_led_netdev "wlan5g" "WLAN5G" "green:wifi5g" "phy1-ap0" ;; -mercusys,mr90x-v1) +mercusys,mr90x-v1|\ +mercusys,mr90x-v1-ubi) ucidef_set_led_netdev "lan-0" "lan-0" "green:lan-0" "lan0" "link tx rx" ucidef_set_led_netdev "lan-1" "lan-1" "green:lan-1" "lan1" "link tx rx" ucidef_set_led_netdev "lan-2" "lan-2" "green:lan-2" "lan2" "link tx rx" 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 1480dbcbc78c23..e0158241f9a819 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 @@ -99,7 +99,8 @@ mediatek_setup_interfaces() mediatek,mt7988a-rfb) ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3 eth2" eth1 ;; - mercusys,mr90x-v1) + mercusys,mr90x-v1|\ + mercusys,mr90x-v1-ubi) ucidef_set_interfaces_lan_wan "lan0 lan1 lan2" eth1 ;; smartrg,sdg-8622|\ 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 0040ffbb266627..fb48ffc49f090d 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -76,6 +76,7 @@ platform_do_upgrade() { jdcloud,re-cp-03|\ mediatek,mt7981-rfb|\ mediatek,mt7988a-rfb|\ + mercusys,mr90x-v1-ubi|\ nokia,ea0326gmp|\ openwrt,one|\ netcore,n60|\ diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 3a36fbc46b8dcb..defa3747edaa25 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -1059,6 +1059,34 @@ define Device/mercusys_mr90x-v1 endef TARGET_DEVICES += mercusys_mr90x-v1 +define Device/mercusys_mr90x-v1-ubi + DEVICE_VENDOR := MERCUSYS + DEVICE_MODEL := MR90X v1 (UBI) + DEVICE_DTS := mt7986b-mercusys-mr90x-v1-ubi + DEVICE_DTS_DIR := ../dts + DEVICE_DTC_FLAGS := --pad 4096 + DEVICE_DTS_LOADADDR := 0x43f00000 + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7986-firmware mt7986-wo-firmware + 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-with-rootfs | \ + append-metadata + ARTIFACTS := bl31-uboot.fip preloader.bin + ARTIFACT/bl31-uboot.fip := mt7986-bl31-uboot mercusys_mr90x-v1 + ARTIFACT/preloader.bin := mt7986-bl2 spim-nand-ubi-ddr3 +endef +TARGET_DEVICES += mercusys_mr90x-v1-ubi + define Device/netcore_n60 DEVICE_VENDOR := Netcore DEVICE_MODEL := N60 From 6c664135f982f5b03b4d51c1ee45fe357a06ac27 Mon Sep 17 00:00:00 2001 From: Paul Donald Date: Mon, 25 Nov 2024 15:24:54 +0100 Subject: [PATCH 191/877] netifd: update to Git 768027c5a7640137857f412f554227abd6160cdd (2024-11-27) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 86da5cbcdb9d system-linux: do not pull ifindex/flags from netlink messages on rtnl events cd96f61ba63e proto-shell: fix spurious interface teardowns with host deps a39fe3a8b150 wireless: add support for adding a list of devices for a wifi-iface d29cf707478c iprule: add ipproto property 768027c5a764 system-linux: restore reading flags from netlink messages Signed-off-by: Paul Donald Link: https://github.com/openwrt/openwrt/pull/17074 Signed-off-by: Petr Štetiar (cherry picked from commit f4492b6b1c5373a27c911ad675e96ccf1ce542d2) Link: https://github.com/openwrt/openwrt/pull/17110 Signed-off-by: Hauke Mehrtens --- 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 a4400c9516eca6..82a04adecd9320 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:=2024-11-08 -PKG_SOURCE_VERSION:=34eb11eb6f5c62de480d6192f0ca840093127fee -PKG_MIRROR_HASH:=c4c2bc626426d2cd73c9ece54b22ada6ed6254afa992f51b8725312aca240cfd +PKG_SOURCE_DATE:=2024-11-27 +PKG_SOURCE_VERSION:=768027c5a7640137857f412f554227abd6160cdd +PKG_MIRROR_HASH:=5f74dc10470c64b42caa2d1fda3b80672293cf39676aa5c0b9f8c89880a15270 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 From 28de3ffefa54527831d932cabc9bdcca8adf94e2 Mon Sep 17 00:00:00 2001 From: Andris PE Date: Tue, 26 Mar 2024 21:53:06 +0200 Subject: [PATCH 192/877] netifd: check if /sbin/wifi exists before calling it Avoid harmless error from network script by checking presence of now-optional wifi support script, most notably confusing users of x86 snapshots. Fixes: #14964 Signed-off-by: Andris PE Link: https://github.com/openwrt/openwrt/pull/14986 Signed-off-by: Robert Marko (cherry picked from commit 207bfee855320dc938f39e179b1d2e3b008140cb) --- package/network/config/netifd/Makefile | 2 +- package/network/config/netifd/files/etc/init.d/network | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index 82a04adecd9320..95f1f6f7d11e09 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:=2 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git diff --git a/package/network/config/netifd/files/etc/init.d/network b/package/network/config/netifd/files/etc/init.d/network index dc208c4ce0a1f5..86340b77e53c6e 100755 --- a/package/network/config/netifd/files/etc/init.d/network +++ b/package/network/config/netifd/files/etc/init.d/network @@ -30,12 +30,12 @@ reload_service() { init_switch ubus call network reload || rv=1 - /sbin/wifi reload_legacy + [ -x /sbin/wifi ] && /sbin/wifi reload_legacy return $rv } stop_service() { - /sbin/wifi down + [ -x /sbin/wifi ] && /sbin/wifi down ifdown -a sleep 1 } From aa1241e9794c2c03b74f14fef8530507ee4fc2f7 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Thu, 12 Dec 2024 16:36:50 +0100 Subject: [PATCH 193/877] wifi-scripts: fix failing mesh setup with missing wpa_supplicant The initialization of mesh interfaces currently fail when wpa_supplicant is not installed. This is due to the script calling the wpa_supplicant feature indicator without verifying wpa_supplicant is installed at all. To avoid failing, first check if wpa_supplicant is installed before determining the available featureset. Signed-off-by: David Bauer (cherry picked from commit 1be18c6daad83bc4198dc7aefd9979b7fe8fbfd4) --- .../config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh index 3d953eff74d2fa..ad1a4c86df0439 100755 --- a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh +++ b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh @@ -1017,7 +1017,7 @@ mac80211_setup_vif() { json_get_vars $MP_CONFIG_INT $MP_CONFIG_BOOL $MP_CONFIG_STRING wireless_vif_parse_encryption [ -z "$htmode" ] && htmode="NOHT"; - if wpa_supplicant -vmesh; then + if [ -x /usr/sbin/wpa_supplicant ] && wpa_supplicant -vmesh; then mac80211_setup_supplicant || failed=1 else mac80211_setup_mesh From bf284ed4aff703e4172fe7f27307ac9ba032473b Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sat, 14 Dec 2024 12:11:24 +0800 Subject: [PATCH 194/877] ramips: fix 2.4G wmac eeprom offset for TL-WR902AC v4 The eeprom data offset on 2.4GHz wmac is wrong. It is obvious that this is a copy & paste issue. Suggested-by: @cgm999 on https://github.com/openwrt/openwrt/issues/13969 Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17263 Signed-off-by: Hauke Mehrtens (cherry picked from commit 5a24850de1418510c421d45eb2436bdcb2b243c6) --- target/linux/ramips/dts/mt7628an_tplink_tl-wr902ac-v4.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ramips/dts/mt7628an_tplink_tl-wr902ac-v4.dts b/target/linux/ramips/dts/mt7628an_tplink_tl-wr902ac-v4.dts index 946efb9443e8aa..a2dd4ce5cb8719 100644 --- a/target/linux/ramips/dts/mt7628an_tplink_tl-wr902ac-v4.dts +++ b/target/linux/ramips/dts/mt7628an_tplink_tl-wr902ac-v4.dts @@ -108,7 +108,7 @@ &wmac { status = "okay"; - nvmem-cells = <&eeprom_factory_28000>, <&macaddr_factory_f100 0>; + nvmem-cells = <&eeprom_factory_20000>, <&macaddr_factory_f100 0>; nvmem-cell-names = "eeprom", "mac-address"; }; From 9af0e94fa6f24df57229ea3fce8e0e4247d6fa7f Mon Sep 17 00:00:00 2001 From: John Audia Date: Tue, 10 Dec 2024 00:19:18 +0100 Subject: [PATCH 195/877] kernel: bump 6.6 to 6.6.64 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.64 Manually rebased: generic/hack-6.6/780-usb-net-MeigLink_modem_support.patch bcm27xx/patches-6.6/950-0585-drm-vc4-Introduce-generation-number-enum.patch bcm27xx/patches-6.6/950-0610-drm-vc4-hvs-Support-BCM2712-HVS.patch bcm27xx/patches-6.6/950-0829-vc4-hvs-Add-support-for-D0-register-changes.patch Removed upstreamed: bcm27xx/patches-6.6/950-0597-drm-vc4-hdmi-Avoid-hang-with-debug-registers-when-su.patch[1] bcm27xx/patches-6.6/950-0599-drm-vc4-Fix-dlist-debug-not-resetting-the-next-entry.patch[2] bcm27xx/patches-6.6/950-0600-drm-vc4-Remove-incorrect-limit-from-hvs_dlist-debugf.patch[3] bcm27xx/patches-6.6/950-0708-drm-vc4-Correct-logic-on-stopping-an-HVS-channel.patch[4] ramips/patches-6.6/002-01-v6.13-clk-ralink-mtmips-fix-clock-plan-for-Ralink-SoC-RT38.patch[5] ramips/patches-6.6/002-02-v6.13-clk-ralink-mtmips-fix-clocks-probe-order-in-oldest-r.patch[6] All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.64&id=223ee2567a55e4f80315c768d2969e6a3b9fb23d 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.64&id=8182b5ca19c6f173b6498d1c6d3e4b034b76bbde 3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.64&id=52c1716f65a558174e381360bd88f18dae4be85c 4. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.64&id=9728b508b01a5eeeac79ceb676364c674dd951ac 5. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.64&id=f85a1d06afbcc57ac44176db8f9d7a934979952c 6. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.64&id=fbb13732c6ffa9d58cedafabcd5ce8fd7ef8ae5a Build system: x86/64 Build-tested: x86/64/AMD Cezanne, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Run-tested: x86/64/AMD Cezanne, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Co-authored-by: Mieczyslaw Nalewaj Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/17217 Signed-off-by: Robert Marko Signed-off-by: Hauke Mehrtens (cherry picked from commit 5158e28769cb5e5c6a59bd9a176f55cf2d568742) --- include/kernel-6.6 | 4 +- .../901-snand-mtk-bmt-support.patch | 6 +- ...0-0007-drm-vc4-Add-firmware-kms-mode.patch | 2 +- ...vc4-Add-support-for-gamma-on-BCM2711.patch | 12 +- ...gfs-node-that-dumps-the-vc5-gamma-PW.patch | 4 +- ...vs-Force-modeset-on-gamma-lut-change.patch | 6 +- ...nable-gamma-block-only-when-required.patch | 4 +- ...4-Validate-the-size-of-the-gamma_lut.patch | 2 +- ...e-Keep-fractional-source-coords-insi.patch | 2 +- ...igger-of-dlist-update-on-margins-cha.patch | 2 +- ...s-Skip-DebugFS-Registration-for-FKMS.patch | 2 +- ...mi-Allow-hotplug-detect-to-be-forced.patch | 2 +- ...oid-log-spam-for-audio-start-failure.patch | 2 +- ...4-hvs-Defer-dlist-slots-deallocation.patch | 26 ++-- ...ialize-the-dlist-allocation-list-ent.patch | 2 +- ...-the-dlist-allocation-destruction-to.patch | 4 +- ...roy-dlist-allocations-immediately-wh.patch | 2 +- ...ulate-bpc-based-on-max_requested_bpc.patch | 2 +- ...-vc4-Set-AXI-panic-modes-for-the-HVS.patch | 2 +- ...ecessary-and-harmful-HDMI-RGB-format.patch | 2 +- ...-drm-vc4-Limit-max_bpc-to-8-on-Pi0-3.patch | 4 +- ...0-0039-arm64-setup-Fix-build-warning.patch | 2 +- ...oup-Disable-cgroup-memory-by-default.patch | 8 +- ...8xx-Enable-LEDs-and-auto-negotiation.patch | 6 +- ...all-the-downstream-rpi-sound-card-dr.patch | 2 +- ...78xx-Read-initial-EEE-status-from-DT.patch | 2 +- ...Disable-TCP-Segmentation-Offload-TSO.patch | 2 +- ...e-enabling-of-EEE-into-PHY-init-code.patch | 4 +- ...is7xx-Don-t-spin-if-no-data-received.patch | 2 +- ...e-link-events-to-minimize-poll-storm.patch | 6 +- ...xx-EEE-support-is-now-a-PHY-property.patch | 2 +- ...CS_HIGH-if-GPIO-descriptors-are-used.patch | 4 +- ...dmi-Increase-MAI-fifo-dreq-threshold.patch | 4 +- ...7xx-Read-modem-line-state-at-startup.patch | 2 +- ...5-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch | 6 +- ...-drm-vc4-hdmi-Enable-the-audio-clock.patch | 4 +- ...vs-More-logging-for-dlist-generation.patch | 2 +- ...Print-error-if-we-fail-an-allocation.patch | 4 +- ...vc4-Introduce-generation-number-enum.patch | 53 ++++---- ...switch-statement-to-simplify-vc4_hvs.patch | 2 +- ...switch-statement-to-simplify-enablin.patch | 2 +- ...st-if-the-EOF-interrupts-are-enabled.patch | 10 +- ...-drm-vc4-hvs-Create-hw_init-function.patch | 4 +- ...drm-vc4-hvs-Create-cob_init-function.patch | 6 +- ...592-drm-vc4-hvs-Rename-hvs_regs-list.patch | 2 +- ...plane-Change-ptr0_offset-to-an-array.patch | 2 +- ...ge-prototype-of-__vc4_hvs_alloc-to-p.patch | 8 +- ...id-hang-with-debug-registers-when-su.patch | 40 ------ ...-buffer-offset-out-of-the-vc4_plane_.patch | 2 +- ...t-debug-not-resetting-the-next-entry.patch | 34 ----- ...ncorrect-limit-from-hvs_dlist-debugf.patch | 57 -------- ...ble-SCALER_CONTROL-early-in-HVS-init.patch | 8 +- ...0610-drm-vc4-hvs-Support-BCM2712-HVS.patch | 52 ++++---- ...-0622-drm-vc4-Add-additional-warn_on.patch | 24 ++-- ...e-the-clear-of-SCALER_DISPBKGND_FILL.patch | 2 +- ...ect-logic-on-stopping-an-HVS-channel.patch | 52 -------- ...p-WARN-for-HVS-FIFOs-not-being-empty.patch | 2 +- ...-stale-dlists-if-channel-is-disabled.patch | 6 +- ...dd-hvs_dlist_allocs-debugfs-function.patch | 2 +- ...size-of-the-dlist-allocation-that-wa.patch | 2 +- ...-dlist-alloc-immediately-if-it-never.patch | 4 +- ...x-reading-of-frame-count-on-GEN5-Pi4.patch | 4 +- ...-Add-support-for-D0-register-changes.patch | 27 ++-- ...-to-support-D0-alpha-and-csc-changes.patch | 4 +- ...-vc4_hvs_dlist_free_work-to-only-rea.patch | 2 +- ...ale-dlist-entries-if-allocation-fail.patch | 6 +- ...g_fill-if-there-are-no-planes-enable.patch | 2 +- ...ort-for-per-plane-scaling-filter-sel.patch | 4 +- ...equest-for-min-clocks-when-hdmi-outp.patch | 2 +- ...l-command-line-to-disable-memory-cgr.patch | 8 +- .../generic/hack-6.6/204-module_strip.patch | 12 +- .../generic/hack-6.6/253-ksmbd-config.patch | 2 +- .../780-usb-net-MeigLink_modem_support.patch | 5 +- .../hack-6.6/901-debloat_sock_diag.patch | 4 +- .../generic/hack-6.6/902-debloat_proc.patch | 2 +- .../hack-6.6/920-device_tree_cmdline.patch | 2 +- .../203-kallsyms_uncompressed.patch | 2 +- ...ng-with-source-address-failed-policy.patch | 8 +- ...les-ignore-EOPNOTSUPP-on-flowtable-d.patch | 2 +- .../pending-6.6/920-mangle_bootargs.patch | 2 +- .../900-arm-add-cmdline-override.patch | 2 +- ...nor-Use-1-bit-mode-of-spansion-s25fs.patch | 2 +- ...-Add-support-for-dynamic-calibration.patch | 6 +- .../901-arm-add-cmdline-override.patch | 2 +- .../102-powerpc-add-cmdline-override.patch | 2 +- ...ers-ralink-Add-Ralink-System-Tick-Co.patch | 2 +- ...s-fix-clock-plan-for-Ralink-SoC-RT38.patch | 48 ------- ...s-fix-clocks-probe-order-in-oldest-r.patch | 124 ------------------ ...e-to-enable-disable-the-cevt-r4k-irq.patch | 2 +- .../810-uvc-add-iPassion-iP2970-support.patch | 2 +- ...-clocksource-Add-JH7110-timer-driver.patch | 2 +- ...ET_CONFIG_DEVICE_WAIT_MS-waiting-tim.patch | 2 +- ...-precheck-and-delay-for-CQE-pending-.patch | 2 +- ...ove-performance-usb-using-lowmem-for.patch | 2 +- 94 files changed, 242 insertions(+), 590 deletions(-) delete mode 100644 target/linux/bcm27xx/patches-6.6/950-0597-drm-vc4-hdmi-Avoid-hang-with-debug-registers-when-su.patch delete mode 100644 target/linux/bcm27xx/patches-6.6/950-0599-drm-vc4-Fix-dlist-debug-not-resetting-the-next-entry.patch delete mode 100644 target/linux/bcm27xx/patches-6.6/950-0600-drm-vc4-Remove-incorrect-limit-from-hvs_dlist-debugf.patch delete mode 100644 target/linux/bcm27xx/patches-6.6/950-0708-drm-vc4-Correct-logic-on-stopping-an-HVS-channel.patch delete mode 100644 target/linux/ramips/patches-6.6/002-01-v6.13-clk-ralink-mtmips-fix-clock-plan-for-Ralink-SoC-RT38.patch delete mode 100644 target/linux/ramips/patches-6.6/002-02-v6.13-clk-ralink-mtmips-fix-clocks-probe-order-in-oldest-r.patch diff --git a/include/kernel-6.6 b/include/kernel-6.6 index 0cfe052e651ad1..ddbef67f942d28 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .63 -LINUX_KERNEL_HASH-6.6.63 = d1054ab4803413efe2850f50f1a84349c091631ec50a1cf9e891d1b1f9061835 +LINUX_VERSION-6.6 = .64 +LINUX_KERNEL_HASH-6.6.64 = 065fd93fa6cb422f650fb563f15d3e0107c85009f766405993d795fd39796ab1 diff --git a/target/linux/airoha/patches-6.6/901-snand-mtk-bmt-support.patch b/target/linux/airoha/patches-6.6/901-snand-mtk-bmt-support.patch index de8e8806433c60..939ec048555787 100644 --- a/target/linux/airoha/patches-6.6/901-snand-mtk-bmt-support.patch +++ b/target/linux/airoha/patches-6.6/901-snand-mtk-bmt-support.patch @@ -8,7 +8,7 @@ static int spinand_read_reg_op(struct spinand_device *spinand, u8 reg, u8 *val) { -@@ -1346,6 +1347,7 @@ static int spinand_probe(struct spi_mem +@@ -1347,6 +1348,7 @@ static int spinand_probe(struct spi_mem if (ret) return ret; @@ -16,7 +16,7 @@ ret = mtd_device_register(mtd, NULL, 0); if (ret) goto err_spinand_cleanup; -@@ -1353,6 +1355,7 @@ static int spinand_probe(struct spi_mem +@@ -1354,6 +1356,7 @@ static int spinand_probe(struct spi_mem return 0; err_spinand_cleanup: @@ -24,7 +24,7 @@ spinand_cleanup(spinand); return ret; -@@ -1371,6 +1374,7 @@ static int spinand_remove(struct spi_mem +@@ -1372,6 +1375,7 @@ static int spinand_remove(struct spi_mem if (ret) return ret; diff --git a/target/linux/bcm27xx/patches-6.6/950-0007-drm-vc4-Add-firmware-kms-mode.patch b/target/linux/bcm27xx/patches-6.6/950-0007-drm-vc4-Add-firmware-kms-mode.patch index c755e8143598e1..468420bdee0eac 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0007-drm-vc4-Add-firmware-kms-mode.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0007-drm-vc4-Add-firmware-kms-mode.patch @@ -220,7 +220,7 @@ Signed-off-by: Dave Stevenson struct vc4_hang_state *hang_state; -@@ -963,6 +967,9 @@ extern struct platform_driver vc4_dsi_dr +@@ -964,6 +968,9 @@ extern struct platform_driver vc4_dsi_dr /* vc4_fence.c */ extern const struct dma_fence_ops vc4_fence_ops; diff --git a/target/linux/bcm27xx/patches-6.6/950-0008-drm-vc4-Add-support-for-gamma-on-BCM2711.patch b/target/linux/bcm27xx/patches-6.6/950-0008-drm-vc4-Add-support-for-gamma-on-BCM2711.patch index a4712310f2b7b2..10a09eb2c0c155 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0008-drm-vc4-Add-support-for-gamma-on-BCM2711.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0008-drm-vc4-Add-support-for-gamma-on-BCM2711.patch @@ -83,7 +83,7 @@ Signed-off-by: Maxime Ripard struct drm_device; struct drm_gem_object; -@@ -494,6 +495,17 @@ struct drm_encoder *vc4_find_encoder_by_ +@@ -495,6 +496,17 @@ struct drm_encoder *vc4_find_encoder_by_ return NULL; } @@ -101,7 +101,7 @@ Signed-off-by: Maxime Ripard struct vc4_crtc_data { const char *name; -@@ -538,9 +550,19 @@ struct vc4_crtc { +@@ -539,9 +551,19 @@ struct vc4_crtc { /* Timestamp at start of vblank irq - unaffected by lock delays. */ ktime_t t_vblank; @@ -126,7 +126,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -243,7 +243,8 @@ static void vc4_hvs_lut_load(struct vc4_ +@@ -248,7 +248,8 @@ static void vc4_hvs_lut_load(struct vc4_ static void vc4_hvs_update_gamma_lut(struct vc4_hvs *hvs, struct vc4_crtc *vc4_crtc) { @@ -136,7 +136,7 @@ Signed-off-by: Maxime Ripard struct drm_color_lut *lut = crtc_state->gamma_lut->data; u32 length = drm_color_lut_size(crtc_state->gamma_lut); u32 i; -@@ -257,6 +258,81 @@ static void vc4_hvs_update_gamma_lut(str +@@ -262,6 +263,81 @@ static void vc4_hvs_update_gamma_lut(str vc4_hvs_lut_load(hvs, vc4_crtc); } @@ -218,7 +218,7 @@ Signed-off-by: Maxime Ripard u8 vc4_hvs_get_fifo_frame_count(struct vc4_hvs *hvs, unsigned int fifo) { struct drm_device *drm = &hvs->vc4->base; -@@ -400,7 +476,10 @@ static int vc4_hvs_init_channel(struct v +@@ -405,7 +481,10 @@ static int vc4_hvs_init_channel(struct v /* Reload the LUT, since the SRAMs would have been disabled if * all CRTCs had SCALER_DISPBKGND_GAMMA unset at once. */ @@ -230,7 +230,7 @@ Signed-off-by: Maxime Ripard drm_dev_exit(idx); -@@ -646,7 +725,11 @@ void vc4_hvs_atomic_flush(struct drm_crt +@@ -649,7 +728,11 @@ void vc4_hvs_atomic_flush(struct drm_crt u32 dispbkgndx = HVS_READ(SCALER_DISPBKGNDX(channel)); if (crtc->state->gamma_lut) { diff --git a/target/linux/bcm27xx/patches-6.6/950-0009-drm-vc4-Add-debugfs-node-that-dumps-the-vc5-gamma-PW.patch b/target/linux/bcm27xx/patches-6.6/950-0009-drm-vc4-Add-debugfs-node-that-dumps-the-vc5-gamma-PW.patch index 24d0cd90f6e2f9..863ad82432d5df 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0009-drm-vc4-Add-debugfs-node-that-dumps-the-vc5-gamma-PW.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0009-drm-vc4-Add-debugfs-node-that-dumps-the-vc5-gamma-PW.patch @@ -17,7 +17,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -143,6 +143,85 @@ static int vc4_hvs_debugfs_dlist(struct +@@ -145,6 +145,85 @@ static int vc4_hvs_debugfs_dlist(struct return 0; } @@ -103,7 +103,7 @@ Signed-off-by: Maxime Ripard /* The filter kernel is composed of dwords each containing 3 9-bit * signed integers packed next to each other. */ -@@ -850,11 +929,15 @@ int vc4_hvs_debugfs_init(struct drm_mino +@@ -854,11 +933,15 @@ int vc4_hvs_debugfs_init(struct drm_mino if (!vc4->hvs) return -ENODEV; diff --git a/target/linux/bcm27xx/patches-6.6/950-0010-drm-vc4-hvs-Force-modeset-on-gamma-lut-change.patch b/target/linux/bcm27xx/patches-6.6/950-0010-drm-vc4-hvs-Force-modeset-on-gamma-lut-change.patch index f49122dec27a11..b8847230af0841 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0010-drm-vc4-hvs-Force-modeset-on-gamma-lut-change.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0010-drm-vc4-hvs-Force-modeset-on-gamma-lut-change.patch @@ -45,7 +45,7 @@ Signed-off-by: Maxime Ripard struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc); --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h -@@ -613,6 +613,9 @@ vc4_crtc_to_vc4_pv_data(const struct vc4 +@@ -614,6 +614,9 @@ vc4_crtc_to_vc4_pv_data(const struct vc4 return container_of_const(data, struct vc4_pv_data, base); } @@ -57,7 +57,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -596,6 +596,36 @@ out: +@@ -599,6 +599,36 @@ out: drm_dev_exit(idx); } @@ -94,7 +94,7 @@ Signed-off-by: Maxime Ripard int vc4_hvs_atomic_check(struct drm_crtc *crtc, struct drm_atomic_state *state) { struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc); -@@ -626,7 +656,7 @@ int vc4_hvs_atomic_check(struct drm_crtc +@@ -629,7 +659,7 @@ int vc4_hvs_atomic_check(struct drm_crtc if (ret) return ret; diff --git a/target/linux/bcm27xx/patches-6.6/950-0014-drm-vc4-Enable-gamma-block-only-when-required.patch b/target/linux/bcm27xx/patches-6.6/950-0014-drm-vc4-Enable-gamma-block-only-when-required.patch index 76647cbd48889b..061b37797de7c8 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0014-drm-vc4-Enable-gamma-block-only-when-required.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0014-drm-vc4-Enable-gamma-block-only-when-required.patch @@ -20,7 +20,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -548,8 +548,11 @@ static int vc4_hvs_init_channel(struct v +@@ -553,8 +553,11 @@ static int vc4_hvs_init_channel(struct v dispbkgndx &= ~SCALER_DISPBKGND_GAMMA; dispbkgndx &= ~SCALER_DISPBKGND_INTERLACE; @@ -33,7 +33,7 @@ Signed-off-by: Dave Stevenson (interlace ? SCALER_DISPBKGND_INTERLACE : 0)); /* Reload the LUT, since the SRAMs would have been disabled if -@@ -834,18 +837,25 @@ void vc4_hvs_atomic_flush(struct drm_crt +@@ -837,18 +840,25 @@ void vc4_hvs_atomic_flush(struct drm_crt u32 dispbkgndx = HVS_READ(SCALER_DISPBKGNDX(channel)); if (crtc->state->gamma_lut) { diff --git a/target/linux/bcm27xx/patches-6.6/950-0016-drm-vc4-Validate-the-size-of-the-gamma_lut.patch b/target/linux/bcm27xx/patches-6.6/950-0016-drm-vc4-Validate-the-size-of-the-gamma_lut.patch index fd0823aa136c89..7280b6e30c4a87 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0016-drm-vc4-Validate-the-size-of-the-gamma_lut.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0016-drm-vc4-Validate-the-size-of-the-gamma_lut.patch @@ -13,7 +13,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -614,6 +614,16 @@ static int vc4_hvs_gamma_check(struct dr +@@ -617,6 +617,16 @@ static int vc4_hvs_gamma_check(struct dr if (!crtc_state->color_mgmt_changed) return 0; diff --git a/target/linux/bcm27xx/patches-6.6/950-0020-vc4-drm-vc4_plane-Keep-fractional-source-coords-insi.patch b/target/linux/bcm27xx/patches-6.6/950-0020-vc4-drm-vc4_plane-Keep-fractional-source-coords-insi.patch index 46a72e4ed92cbd..17dd4433e1ac47 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0020-vc4-drm-vc4_plane-Keep-fractional-source-coords-insi.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0020-vc4-drm-vc4_plane-Keep-fractional-source-coords-insi.patch @@ -12,7 +12,7 @@ Signed-off-by: Dom Cobley --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h -@@ -408,7 +408,7 @@ struct vc4_plane_state { +@@ -409,7 +409,7 @@ struct vc4_plane_state { /* Clipped coordinates of the plane on the display. */ int crtc_x, crtc_y, crtc_w, crtc_h; diff --git a/target/linux/bcm27xx/patches-6.6/950-0024-drm-vc4-Force-trigger-of-dlist-update-on-margins-cha.patch b/target/linux/bcm27xx/patches-6.6/950-0024-drm-vc4-Force-trigger-of-dlist-update-on-margins-cha.patch index 9779cd512c0078..06cb7094985b1f 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0024-drm-vc4-Force-trigger-of-dlist-update-on-margins-cha.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0024-drm-vc4-Force-trigger-of-dlist-update-on-margins-cha.patch @@ -42,7 +42,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h -@@ -626,12 +626,7 @@ struct vc4_crtc_state { +@@ -627,12 +627,7 @@ struct vc4_crtc_state { bool txp_armed; unsigned int assigned_channel; diff --git a/target/linux/bcm27xx/patches-6.6/950-0027-drm-vc4-hvs-Skip-DebugFS-Registration-for-FKMS.patch b/target/linux/bcm27xx/patches-6.6/950-0027-drm-vc4-hvs-Skip-DebugFS-Registration-for-FKMS.patch index ba03cfb7b92fc9..fb8abd20caf596 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0027-drm-vc4-hvs-Skip-DebugFS-Registration-for-FKMS.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0027-drm-vc4-hvs-Skip-DebugFS-Registration-for-FKMS.patch @@ -13,7 +13,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -976,6 +976,9 @@ int vc4_hvs_debugfs_init(struct drm_mino +@@ -980,6 +980,9 @@ int vc4_hvs_debugfs_init(struct drm_mino struct vc4_dev *vc4 = to_vc4_dev(drm); struct vc4_hvs *hvs = vc4->hvs; diff --git a/target/linux/bcm27xx/patches-6.6/950-0028-drm-vc4_hdmi-Allow-hotplug-detect-to-be-forced.patch b/target/linux/bcm27xx/patches-6.6/950-0028-drm-vc4_hdmi-Allow-hotplug-detect-to-be-forced.patch index 95b3ec7a248de5..5785fbf667b28b 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0028-drm-vc4_hdmi-Allow-hotplug-detect-to-be-forced.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0028-drm-vc4_hdmi-Allow-hotplug-detect-to-be-forced.patch @@ -45,7 +45,7 @@ Signed-off-by: Dom Cobley static const char * const output_format_str[] = { [VC4_HDMI_OUTPUT_RGB] = "RGB", [VC4_HDMI_OUTPUT_YUV420] = "YUV 4:2:0", -@@ -478,7 +484,9 @@ static int vc4_hdmi_connector_detect_ctx +@@ -482,7 +488,9 @@ static int vc4_hdmi_connector_detect_ctx return connector_status_unknown; } diff --git a/target/linux/bcm27xx/patches-6.6/950-0029-vc4_hdmi-Avoid-log-spam-for-audio-start-failure.patch b/target/linux/bcm27xx/patches-6.6/950-0029-vc4_hdmi-Avoid-log-spam-for-audio-start-failure.patch index 0baf803edf8d5f..a73c5e3163fa5e 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0029-vc4_hdmi-Avoid-log-spam-for-audio-start-failure.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0029-vc4_hdmi-Avoid-log-spam-for-audio-start-failure.patch @@ -30,7 +30,7 @@ Signed-off-by: Dom Cobley --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -2400,7 +2400,7 @@ static int vc4_hdmi_audio_startup(struct +@@ -2404,7 +2404,7 @@ static int vc4_hdmi_audio_startup(struct } if (!vc4_hdmi_audio_can_stream(vc4_hdmi)) { diff --git a/target/linux/bcm27xx/patches-6.6/950-0030-drm-vc4-hvs-Defer-dlist-slots-deallocation.patch b/target/linux/bcm27xx/patches-6.6/950-0030-drm-vc4-hvs-Defer-dlist-slots-deallocation.patch index a53dd1fa637e02..0d052868638180 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0030-drm-vc4-hvs-Defer-dlist-slots-deallocation.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0030-drm-vc4-hvs-Defer-dlist-slots-deallocation.patch @@ -98,7 +98,7 @@ Signed-off-by: Maxime Ripard } --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h -@@ -332,6 +332,9 @@ struct vc4_hvs { +@@ -333,6 +333,9 @@ struct vc4_hvs { struct drm_mm lbm_mm; spinlock_t mm_lock; @@ -108,7 +108,7 @@ Signed-off-by: Maxime Ripard struct drm_mm_node mitchell_netravali_filter; struct debugfs_regset32 regset; -@@ -619,10 +622,16 @@ struct drm_connector *vc4_get_crtc_conne +@@ -620,10 +623,16 @@ struct drm_connector *vc4_get_crtc_conne struct drm_encoder *vc4_get_crtc_encoder(struct drm_crtc *crtc, struct drm_crtc_state *state); @@ -127,7 +127,7 @@ Signed-off-by: Maxime Ripard bool txp_armed; unsigned int assigned_channel; -@@ -1032,6 +1041,8 @@ struct vc4_hvs *__vc4_hvs_alloc(struct v +@@ -1033,6 +1042,8 @@ struct vc4_hvs *__vc4_hvs_alloc(struct v void vc4_hvs_stop_channel(struct vc4_hvs *hvs, unsigned int output); int vc4_hvs_get_fifo_from_output(struct vc4_hvs *hvs, unsigned int output); u8 vc4_hvs_get_fifo_frame_count(struct vc4_hvs *hvs, unsigned int fifo); @@ -138,7 +138,7 @@ Signed-off-by: Maxime Ripard void vc4_hvs_atomic_enable(struct drm_crtc *crtc, struct drm_atomic_state *state); --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -412,6 +412,152 @@ static void vc5_hvs_update_gamma_lut(str +@@ -417,6 +417,152 @@ static void vc5_hvs_update_gamma_lut(str vc5_hvs_lut_load(hvs, vc4_crtc); } @@ -291,7 +291,7 @@ Signed-off-by: Maxime Ripard u8 vc4_hvs_get_fifo_frame_count(struct vc4_hvs *hvs, unsigned int fifo) { struct drm_device *drm = &hvs->vc4->base; -@@ -643,13 +789,12 @@ int vc4_hvs_atomic_check(struct drm_crtc +@@ -646,13 +792,12 @@ int vc4_hvs_atomic_check(struct drm_crtc { struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc); struct vc4_crtc_state *vc4_state = to_vc4_crtc_state(crtc_state); @@ -306,7 +306,7 @@ Signed-off-by: Maxime Ripard /* The pixelvalve can only feed one encoder (and encoders are * 1:1 with connectors.) -@@ -662,12 +807,11 @@ int vc4_hvs_atomic_check(struct drm_crtc +@@ -665,12 +810,11 @@ int vc4_hvs_atomic_check(struct drm_crtc dlist_count++; /* Account for SCALER_CTL0_END. */ @@ -324,7 +324,7 @@ Signed-off-by: Maxime Ripard return vc4_hvs_gamma_check(crtc, state); } -@@ -683,8 +827,9 @@ static void vc4_hvs_install_dlist(struct +@@ -686,8 +830,9 @@ static void vc4_hvs_install_dlist(struct if (!drm_dev_enter(dev, &idx)) return; @@ -335,7 +335,7 @@ Signed-off-by: Maxime Ripard drm_dev_exit(idx); } -@@ -711,8 +856,10 @@ static void vc4_hvs_update_dlist(struct +@@ -714,8 +859,10 @@ static void vc4_hvs_update_dlist(struct spin_unlock_irqrestore(&dev->event_lock, flags); } @@ -347,7 +347,7 @@ Signed-off-by: Maxime Ripard spin_unlock_irqrestore(&vc4_crtc->irq_lock, flags); } -@@ -769,8 +916,7 @@ void vc4_hvs_atomic_flush(struct drm_crt +@@ -772,8 +919,7 @@ void vc4_hvs_atomic_flush(struct drm_crt struct vc4_plane_state *vc4_plane_state; bool debug_dump_regs = false; bool enable_bg_fill = false; @@ -357,7 +357,7 @@ Signed-off-by: Maxime Ripard unsigned int zpos = 0; bool found = false; int idx; -@@ -788,6 +934,9 @@ void vc4_hvs_atomic_flush(struct drm_crt +@@ -791,6 +937,9 @@ void vc4_hvs_atomic_flush(struct drm_crt vc4_hvs_dump_state(hvs); } @@ -367,7 +367,7 @@ Signed-off-by: Maxime Ripard /* Copy all the active planes' dlist contents to the hardware dlist. */ do { found = false; -@@ -821,7 +970,8 @@ void vc4_hvs_atomic_flush(struct drm_crt +@@ -824,7 +973,8 @@ void vc4_hvs_atomic_flush(struct drm_crt writel(SCALER_CTL0_END, dlist_next); dlist_next++; @@ -377,7 +377,7 @@ Signed-off-by: Maxime Ripard if (enable_bg_fill) /* This sets a black background color fill, as is the case -@@ -960,6 +1110,11 @@ static irqreturn_t vc4_hvs_irq_handler(i +@@ -964,6 +1114,11 @@ static irqreturn_t vc4_hvs_irq_handler(i irqret = IRQ_HANDLED; } @@ -389,7 +389,7 @@ Signed-off-by: Maxime Ripard } /* Clear every per-channel interrupt flag. */ -@@ -1014,6 +1169,9 @@ struct vc4_hvs *__vc4_hvs_alloc(struct v +@@ -1018,6 +1173,9 @@ struct vc4_hvs *__vc4_hvs_alloc(struct v spin_lock_init(&hvs->mm_lock); diff --git a/target/linux/bcm27xx/patches-6.6/950-0031-drm-vc4-hvs-Initialize-the-dlist-allocation-list-ent.patch b/target/linux/bcm27xx/patches-6.6/950-0031-drm-vc4-hvs-Initialize-the-dlist-allocation-list-ent.patch index d250dd4e1e15bf..2fd7aa573de881 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0031-drm-vc4-hvs-Initialize-the-dlist-allocation-list-ent.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0031-drm-vc4-hvs-Initialize-the-dlist-allocation-list-ent.patch @@ -19,7 +19,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -452,6 +452,8 @@ vc4_hvs_alloc_dlist_entry(struct vc4_hvs +@@ -457,6 +457,8 @@ vc4_hvs_alloc_dlist_entry(struct vc4_hvs if (!alloc) return ERR_PTR(-ENOMEM); diff --git a/target/linux/bcm27xx/patches-6.6/950-0032-drm-vc4-hvs-Move-the-dlist-allocation-destruction-to.patch b/target/linux/bcm27xx/patches-6.6/950-0032-drm-vc4-hvs-Move-the-dlist-allocation-destruction-to.patch index f6fe9e1a4c20b2..07fb255e66109f 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0032-drm-vc4-hvs-Move-the-dlist-allocation-destruction-to.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0032-drm-vc4-hvs-Move-the-dlist-allocation-destruction-to.patch @@ -14,7 +14,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -466,6 +466,18 @@ vc4_hvs_alloc_dlist_entry(struct vc4_hvs +@@ -471,6 +471,18 @@ vc4_hvs_alloc_dlist_entry(struct vc4_hvs return alloc; } @@ -33,7 +33,7 @@ Signed-off-by: Maxime Ripard void vc4_hvs_mark_dlist_entry_stale(struct vc4_hvs *hvs, struct vc4_hvs_dlist_allocation *alloc) { -@@ -553,9 +565,7 @@ static void vc4_hvs_dlist_free_work(stru +@@ -558,9 +570,7 @@ static void vc4_hvs_dlist_free_work(stru if (!vc4_hvs_frcnt_lte(cur->target_frame_count, frcnt)) continue; diff --git a/target/linux/bcm27xx/patches-6.6/950-0033-drm-vc4-hvs-Destroy-dlist-allocations-immediately-wh.patch b/target/linux/bcm27xx/patches-6.6/950-0033-drm-vc4-hvs-Destroy-dlist-allocations-immediately-wh.patch index 6c8689e169cb46..ecfabf63b92a59 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0033-drm-vc4-hvs-Destroy-dlist-allocations-immediately-wh.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0033-drm-vc4-hvs-Destroy-dlist-allocations-immediately-wh.patch @@ -27,7 +27,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -490,6 +490,18 @@ void vc4_hvs_mark_dlist_entry_stale(stru +@@ -495,6 +495,18 @@ void vc4_hvs_mark_dlist_entry_stale(stru if (!drm_mm_node_allocated(&alloc->mm_node)) return; diff --git a/target/linux/bcm27xx/patches-6.6/950-0035-drm-vc4-Calculate-bpc-based-on-max_requested_bpc.patch b/target/linux/bcm27xx/patches-6.6/950-0035-drm-vc4-Calculate-bpc-based-on-max_requested_bpc.patch index f0fb3eb7d47eee..fbaa2619aa52b2 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0035-drm-vc4-Calculate-bpc-based-on-max_requested_bpc.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0035-drm-vc4-Calculate-bpc-based-on-max_requested_bpc.patch @@ -18,7 +18,7 @@ Signed-off-by: Matthias Reichl --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -2132,7 +2132,7 @@ vc4_hdmi_encoder_compute_config(const st +@@ -2136,7 +2136,7 @@ vc4_hdmi_encoder_compute_config(const st { struct drm_device *dev = vc4_hdmi->connector.dev; struct drm_connector_state *conn_state = &vc4_state->base; diff --git a/target/linux/bcm27xx/patches-6.6/950-0036-drm-vc4-Set-AXI-panic-modes-for-the-HVS.patch b/target/linux/bcm27xx/patches-6.6/950-0036-drm-vc4-Set-AXI-panic-modes-for-the-HVS.patch index 996094739581f7..13015f1f497a47 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0036-drm-vc4-Set-AXI-panic-modes-for-the-HVS.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0036-drm-vc4-Set-AXI-panic-modes-for-the-HVS.patch @@ -19,7 +19,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -1363,6 +1363,17 @@ static int vc4_hvs_bind(struct device *d +@@ -1368,6 +1368,17 @@ static int vc4_hvs_bind(struct device *d dispctrl |= VC4_SET_FIELD(2, SCALER_DISPCTRL_PANIC1); dispctrl |= VC4_SET_FIELD(2, SCALER_DISPCTRL_PANIC2); diff --git a/target/linux/bcm27xx/patches-6.6/950-0037-drm-vc4-drop-unnecessary-and-harmful-HDMI-RGB-format.patch b/target/linux/bcm27xx/patches-6.6/950-0037-drm-vc4-drop-unnecessary-and-harmful-HDMI-RGB-format.patch index b9fba16f695737..18b5b63b547870 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0037-drm-vc4-drop-unnecessary-and-harmful-HDMI-RGB-format.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0037-drm-vc4-drop-unnecessary-and-harmful-HDMI-RGB-format.patch @@ -25,7 +25,7 @@ Signed-off-by: Matthias Reichl --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -1958,9 +1958,6 @@ vc4_hdmi_sink_supports_format_bpc(const +@@ -1962,9 +1962,6 @@ vc4_hdmi_sink_supports_format_bpc(const case VC4_HDMI_OUTPUT_RGB: drm_dbg(dev, "RGB Format, checking the constraints.\n"); diff --git a/target/linux/bcm27xx/patches-6.6/950-0038-drm-vc4-Limit-max_bpc-to-8-on-Pi0-3.patch b/target/linux/bcm27xx/patches-6.6/950-0038-drm-vc4-Limit-max_bpc-to-8-on-Pi0-3.patch index 2b86f419529670..b3b1c3d9e4348c 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0038-drm-vc4-Limit-max_bpc-to-8-on-Pi0-3.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0038-drm-vc4-Limit-max_bpc-to-8-on-Pi0-3.patch @@ -13,7 +13,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -762,7 +762,6 @@ static int vc4_hdmi_connector_init(struc +@@ -766,7 +766,6 @@ static int vc4_hdmi_connector_init(struc drm_connector_attach_colorspace_property(connector); drm_connector_attach_tv_margin_properties(connector); @@ -21,7 +21,7 @@ Signed-off-by: Dave Stevenson connector->polled = (DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT); -@@ -771,8 +770,12 @@ static int vc4_hdmi_connector_init(struc +@@ -775,8 +774,12 @@ static int vc4_hdmi_connector_init(struc connector->doublescan_allowed = 0; connector->stereo_allowed = 1; diff --git a/target/linux/bcm27xx/patches-6.6/950-0039-arm64-setup-Fix-build-warning.patch b/target/linux/bcm27xx/patches-6.6/950-0039-arm64-setup-Fix-build-warning.patch index a53c896daaaf65..75e552a7ef036c 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0039-arm64-setup-Fix-build-warning.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0039-arm64-setup-Fix-build-warning.patch @@ -10,7 +10,7 @@ Signed-off-by: Maxime Ripard --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c -@@ -225,9 +225,9 @@ static void __init request_standard_reso +@@ -229,9 +229,9 @@ static void __init request_standard_reso size_t res_size; kernel_code.start = __pa_symbol(_stext); diff --git a/target/linux/bcm27xx/patches-6.6/950-0065-cgroup-Disable-cgroup-memory-by-default.patch b/target/linux/bcm27xx/patches-6.6/950-0065-cgroup-Disable-cgroup-memory-by-default.patch index 8a06ec387e6ef6..5f2d80b697ce87 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0065-cgroup-Disable-cgroup-memory-by-default.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0065-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 -@@ -6060,6 +6060,9 @@ int __init cgroup_init_early(void) +@@ -6063,6 +6063,9 @@ int __init cgroup_init_early(void) return 0; } @@ -27,7 +27,7 @@ Signed-off-by: Phil Elwell /** * cgroup_init - cgroup initialization * -@@ -6093,6 +6096,12 @@ int __init cgroup_init(void) +@@ -6096,6 +6099,12 @@ int __init cgroup_init(void) cgroup_unlock(); @@ -40,7 +40,7 @@ Signed-off-by: Phil Elwell for_each_subsys(ss, ssid) { if (ss->early_init) { struct cgroup_subsys_state *css = -@@ -6733,6 +6742,10 @@ static int __init cgroup_disable(char *s +@@ -6736,6 +6745,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); -@@ -6751,6 +6764,31 @@ static int __init cgroup_disable(char *s +@@ -6754,6 +6767,31 @@ static int __init cgroup_disable(char *s } __setup("cgroup_disable=", cgroup_disable); diff --git a/target/linux/bcm27xx/patches-6.6/950-0081-lan78xx-Enable-LEDs-and-auto-negotiation.patch b/target/linux/bcm27xx/patches-6.6/950-0081-lan78xx-Enable-LEDs-and-auto-negotiation.patch index 8735b0617017ad..fb248b08892ddb 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0081-lan78xx-Enable-LEDs-and-auto-negotiation.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0081-lan78xx-Enable-LEDs-and-auto-negotiation.patch @@ -14,7 +14,7 @@ Signed-off-by: Phil Elwell --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c -@@ -2883,6 +2883,11 @@ static int lan78xx_reset(struct lan78xx_ +@@ -2884,6 +2884,11 @@ static int lan78xx_reset(struct lan78xx_ int ret; u32 buf; u8 sig; @@ -26,7 +26,7 @@ Signed-off-by: Phil Elwell ret = lan78xx_read_reg(dev, HW_CFG, &buf); if (ret < 0) -@@ -2947,6 +2952,10 @@ static int lan78xx_reset(struct lan78xx_ +@@ -2948,6 +2953,10 @@ static int lan78xx_reset(struct lan78xx_ buf |= HW_CFG_MEF_; @@ -37,7 +37,7 @@ Signed-off-by: Phil Elwell ret = lan78xx_write_reg(dev, HW_CFG, buf); if (ret < 0) return ret; -@@ -3046,6 +3055,9 @@ static int lan78xx_reset(struct lan78xx_ +@@ -3047,6 +3056,9 @@ static int lan78xx_reset(struct lan78xx_ buf |= MAC_CR_AUTO_DUPLEX_ | MAC_CR_AUTO_SPEED_; } } diff --git a/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch b/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch index 395ec0797c15ca..a8a58b58fa64c1 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch @@ -17583,7 +17583,7 @@ Signed-off-by: Phil Elwell * For devices with more than one control interface, we assume the --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c -@@ -2197,6 +2197,8 @@ static const struct usb_audio_quirk_flag +@@ -2212,6 +2212,8 @@ static const struct usb_audio_quirk_flag QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x534d, 0x2109, /* MacroSilicon MS2109 */ QUIRK_FLAG_ALIGN_TRANSFER), diff --git a/target/linux/bcm27xx/patches-6.6/950-0120-lan78xx-Read-initial-EEE-status-from-DT.patch b/target/linux/bcm27xx/patches-6.6/950-0120-lan78xx-Read-initial-EEE-status-from-DT.patch index 296ceae6c70c3a..7aa05b0abc4225 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0120-lan78xx-Read-initial-EEE-status-from-DT.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0120-lan78xx-Read-initial-EEE-status-from-DT.patch @@ -15,7 +15,7 @@ Signed-off-by: Phil Elwell --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c -@@ -3111,6 +3111,22 @@ static int lan78xx_open(struct net_devic +@@ -3112,6 +3112,22 @@ static int lan78xx_open(struct net_devic netif_dbg(dev, ifup, dev->net, "phy initialised successfully"); diff --git a/target/linux/bcm27xx/patches-6.6/950-0125-net-lan78xx-Disable-TCP-Segmentation-Offload-TSO.patch b/target/linux/bcm27xx/patches-6.6/950-0125-net-lan78xx-Disable-TCP-Segmentation-Offload-TSO.patch index 7738bdb8da8688..1b6643508b38cc 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0125-net-lan78xx-Disable-TCP-Segmentation-Offload-TSO.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0125-net-lan78xx-Disable-TCP-Segmentation-Offload-TSO.patch @@ -38,7 +38,7 @@ Signed-off-by: Dave Stevenson static int lan78xx_read_reg(struct lan78xx_net *dev, u32 index, u32 *data) { u32 *buf; -@@ -3471,8 +3480,14 @@ static int lan78xx_bind(struct lan78xx_n +@@ -3472,8 +3481,14 @@ static int lan78xx_bind(struct lan78xx_n if (DEFAULT_RX_CSUM_ENABLE) dev->net->features |= NETIF_F_RXCSUM; diff --git a/target/linux/bcm27xx/patches-6.6/950-0127-lan78xx-Move-enabling-of-EEE-into-PHY-init-code.patch b/target/linux/bcm27xx/patches-6.6/950-0127-lan78xx-Move-enabling-of-EEE-into-PHY-init-code.patch index f73106ab4bd8b4..f98d2c7dd63c18 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0127-lan78xx-Move-enabling-of-EEE-into-PHY-init-code.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0127-lan78xx-Move-enabling-of-EEE-into-PHY-init-code.patch @@ -16,7 +16,7 @@ Signed-off-by: Phil Elwell --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c -@@ -2419,6 +2419,22 @@ static int lan78xx_phy_init(struct lan78 +@@ -2420,6 +2420,22 @@ static int lan78xx_phy_init(struct lan78 mii_adv_to_linkmode_adv_t(fc, mii_adv); linkmode_or(phydev->advertising, fc, phydev->advertising); @@ -39,7 +39,7 @@ Signed-off-by: Phil Elwell if (phydev->mdio.dev.of_node) { u32 reg; int len; -@@ -3120,22 +3136,6 @@ static int lan78xx_open(struct net_devic +@@ -3121,22 +3137,6 @@ static int lan78xx_open(struct net_devic netif_dbg(dev, ifup, dev->net, "phy initialised successfully"); diff --git a/target/linux/bcm27xx/patches-6.6/950-0130-serial-sc16is7xx-Don-t-spin-if-no-data-received.patch b/target/linux/bcm27xx/patches-6.6/950-0130-serial-sc16is7xx-Don-t-spin-if-no-data-received.patch index eceba53aabdaa7..4ef34aeffc0b6a 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0130-serial-sc16is7xx-Don-t-spin-if-no-data-received.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0130-serial-sc16is7xx-Don-t-spin-if-no-data-received.patch @@ -15,7 +15,7 @@ Signed-off-by: Phil Elwell --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c -@@ -773,6 +773,8 @@ static bool sc16is7xx_port_irq(struct sc +@@ -777,6 +777,8 @@ static bool sc16is7xx_port_irq(struct sc if (rxlen) sc16is7xx_handle_rx(port, rxlen, iir); diff --git a/target/linux/bcm27xx/patches-6.6/950-0133-lan78xx-Debounce-link-events-to-minimize-poll-storm.patch b/target/linux/bcm27xx/patches-6.6/950-0133-lan78xx-Debounce-link-events-to-minimize-poll-storm.patch index dc411233dfa2ff..2ca2550acb3823 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0133-lan78xx-Debounce-link-events-to-minimize-poll-storm.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0133-lan78xx-Debounce-link-events-to-minimize-poll-storm.patch @@ -29,7 +29,7 @@ See: https://github.com/raspberrypi/linux/issues/2447 static int lan78xx_read_reg(struct lan78xx_net *dev, u32 index, u32 *data) { u32 *buf; -@@ -4455,7 +4460,13 @@ static int lan78xx_probe(struct usb_inte +@@ -4458,7 +4463,13 @@ static int lan78xx_probe(struct usb_inte if (ret < 0) goto out4; @@ -42,5 +42,5 @@ See: https://github.com/raspberrypi/linux/issues/2447 + netif_notice(dev, probe, netdev, "int urb period %d\n", period); + maxp = usb_maxpacket(dev->udev, dev->pipe_intr); - buf = kmalloc(maxp, GFP_KERNEL); - if (!buf) { + + dev->urb_intr = usb_alloc_urb(0, GFP_KERNEL); diff --git a/target/linux/bcm27xx/patches-6.6/950-0134-lan78xx-EEE-support-is-now-a-PHY-property.patch b/target/linux/bcm27xx/patches-6.6/950-0134-lan78xx-EEE-support-is-now-a-PHY-property.patch index df6c7e687fd7d3..b5e0095d97c01d 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0134-lan78xx-EEE-support-is-now-a-PHY-property.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0134-lan78xx-EEE-support-is-now-a-PHY-property.patch @@ -15,7 +15,7 @@ Signed-off-by: Phil Elwell --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c -@@ -2424,7 +2424,7 @@ static int lan78xx_phy_init(struct lan78 +@@ -2425,7 +2425,7 @@ static int lan78xx_phy_init(struct lan78 mii_adv_to_linkmode_adv_t(fc, mii_adv); linkmode_or(phydev->advertising, fc, phydev->advertising); diff --git a/target/linux/bcm27xx/patches-6.6/950-0204-spi-Force-CS_HIGH-if-GPIO-descriptors-are-used.patch b/target/linux/bcm27xx/patches-6.6/950-0204-spi-Force-CS_HIGH-if-GPIO-descriptors-are-used.patch index 5398d85ef3e23a..7cbbeebf6de146 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0204-spi-Force-CS_HIGH-if-GPIO-descriptors-are-used.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0204-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 -@@ -3740,6 +3740,7 @@ static int spi_set_cs_timing(struct spi_ +@@ -3747,6 +3747,7 @@ static int spi_set_cs_timing(struct spi_ */ int spi_setup(struct spi_device *spi) { @@ -40,7 +40,7 @@ Signed-off-by: Phil Elwell unsigned bad_bits, ugly_bits; int status = 0; -@@ -3760,6 +3761,14 @@ int spi_setup(struct spi_device *spi) +@@ -3767,6 +3768,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/bcm27xx/patches-6.6/950-0468-drm-vc4-hdmi-Increase-MAI-fifo-dreq-threshold.patch b/target/linux/bcm27xx/patches-6.6/950-0468-drm-vc4-hdmi-Increase-MAI-fifo-dreq-threshold.patch index a0c1eba931041b..f43df7ca3f7176 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0468-drm-vc4-hdmi-Increase-MAI-fifo-dreq-threshold.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0468-drm-vc4-hdmi-Increase-MAI-fifo-dreq-threshold.patch @@ -16,7 +16,7 @@ Signed-off-by: Dom Cobley --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -2527,6 +2527,7 @@ static int vc4_hdmi_audio_prepare(struct +@@ -2531,6 +2531,7 @@ static int vc4_hdmi_audio_prepare(struct { struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev); struct drm_device *drm = vc4_hdmi->connector.dev; @@ -24,7 +24,7 @@ Signed-off-by: Dom Cobley struct drm_encoder *encoder = &vc4_hdmi->encoder.base; unsigned int sample_rate = params->sample_rate; unsigned int channels = params->channels; -@@ -2585,11 +2586,18 @@ static int vc4_hdmi_audio_prepare(struct +@@ -2589,11 +2590,18 @@ static int vc4_hdmi_audio_prepare(struct VC4_HDMI_AUDIO_PACKET_CEA_MASK); /* Set the MAI threshold */ diff --git a/target/linux/bcm27xx/patches-6.6/950-0475-serial-sc16is7xx-Read-modem-line-state-at-startup.patch b/target/linux/bcm27xx/patches-6.6/950-0475-serial-sc16is7xx-Read-modem-line-state-at-startup.patch index 08c1bd17ce7293..0149501e777b1c 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0475-serial-sc16is7xx-Read-modem-line-state-at-startup.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0475-serial-sc16is7xx-Read-modem-line-state-at-startup.patch @@ -16,7 +16,7 @@ Signed-off-by: Phil Elwell --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c -@@ -1206,6 +1206,9 @@ static int sc16is7xx_startup(struct uart +@@ -1210,6 +1210,9 @@ static int sc16is7xx_startup(struct uart SC16IS7XX_IER_MSI_BIT; sc16is7xx_port_write(port, SC16IS7XX_IER_REG, val); diff --git a/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch b/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch index f0c75c6bfaf4dc..8d276e1681866f 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch @@ -75,7 +75,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 -@@ -3671,6 +3671,48 @@ static int xhci_align_td(struct xhci_hcd +@@ -3679,6 +3679,48 @@ static int xhci_align_td(struct xhci_hcd return 1; } @@ -124,7 +124,7 @@ Signed-off-by: Jonathan Bell /* This is very similar to what ehci-q.c qtd_fill() does */ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, struct urb *urb, int slot_id, unsigned int ep_index) -@@ -3827,6 +3869,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3835,6 +3877,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd * } check_trb_math(urb, enqd_len); @@ -133,7 +133,7 @@ Signed-off-by: Jonathan Bell giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, start_cycle, start_trb); return 0; -@@ -3962,6 +4006,8 @@ int xhci_queue_ctrl_tx(struct xhci_hcd * +@@ -3970,6 +4014,8 @@ int xhci_queue_ctrl_tx(struct xhci_hcd * /* Event on completion */ field | TRB_IOC | TRB_TYPE(TRB_STATUS) | ep_ring->cycle_state); diff --git a/target/linux/bcm27xx/patches-6.6/950-0578-drm-vc4-hdmi-Enable-the-audio-clock.patch b/target/linux/bcm27xx/patches-6.6/950-0578-drm-vc4-hdmi-Enable-the-audio-clock.patch index 79d040070f068d..ab082c6a1900cb 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0578-drm-vc4-hdmi-Enable-the-audio-clock.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0578-drm-vc4-hdmi-Enable-the-audio-clock.patch @@ -18,7 +18,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -3595,6 +3595,7 @@ static int vc4_hdmi_runtime_suspend(stru +@@ -3599,6 +3599,7 @@ static int vc4_hdmi_runtime_suspend(stru { struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev); @@ -26,7 +26,7 @@ Signed-off-by: Maxime Ripard clk_disable_unprepare(vc4_hdmi->hsm_clock); return 0; -@@ -3627,6 +3628,10 @@ static int vc4_hdmi_runtime_resume(struc +@@ -3631,6 +3632,10 @@ static int vc4_hdmi_runtime_resume(struc goto err_disable_clk; } diff --git a/target/linux/bcm27xx/patches-6.6/950-0580-drm-vc4-hvs-More-logging-for-dlist-generation.patch b/target/linux/bcm27xx/patches-6.6/950-0580-drm-vc4-hvs-More-logging-for-dlist-generation.patch index 6c0a85d703dc09..69b36207c6ad76 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0580-drm-vc4-hvs-More-logging-for-dlist-generation.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0580-drm-vc4-hvs-More-logging-for-dlist-generation.patch @@ -14,7 +14,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -826,11 +826,22 @@ int vc4_hvs_atomic_check(struct drm_crtc +@@ -829,11 +829,22 @@ int vc4_hvs_atomic_check(struct drm_crtc if (hweight32(crtc_state->connector_mask) > 1) return -EINVAL; diff --git a/target/linux/bcm27xx/patches-6.6/950-0581-drm-vc4-hvs-Print-error-if-we-fail-an-allocation.patch b/target/linux/bcm27xx/patches-6.6/950-0581-drm-vc4-hvs-Print-error-if-we-fail-an-allocation.patch index 3b30ea2f479ae3..eeed520f4b2b8d 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0581-drm-vc4-hvs-Print-error-if-we-fail-an-allocation.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0581-drm-vc4-hvs-Print-error-if-we-fail-an-allocation.patch @@ -19,7 +19,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -441,6 +441,8 @@ vc4_hvs_alloc_dlist_entry(struct vc4_hvs +@@ -446,6 +446,8 @@ vc4_hvs_alloc_dlist_entry(struct vc4_hvs unsigned int channel, size_t dlist_count) { @@ -28,7 +28,7 @@ Signed-off-by: Maxime Ripard struct vc4_hvs_dlist_allocation *alloc; unsigned long flags; int ret; -@@ -458,8 +460,10 @@ vc4_hvs_alloc_dlist_entry(struct vc4_hvs +@@ -463,8 +465,10 @@ vc4_hvs_alloc_dlist_entry(struct vc4_hvs ret = drm_mm_insert_node(&hvs->dlist_mm, &alloc->mm_node, dlist_count); spin_unlock_irqrestore(&hvs->mm_lock, flags); diff --git a/target/linux/bcm27xx/patches-6.6/950-0585-drm-vc4-Introduce-generation-number-enum.patch b/target/linux/bcm27xx/patches-6.6/950-0585-drm-vc4-Introduce-generation-number-enum.patch index 0e810a1f4e11ac..8372ae23fec77d 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0585-drm-vc4-Introduce-generation-number-enum.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0585-drm-vc4-Introduce-generation-number-enum.patch @@ -22,7 +22,7 @@ Signed-off-by: Maxime Ripard drivers/gpu/drm/vc4/vc4_drv.h | 7 ++- drivers/gpu/drm/vc4/vc4_gem.c | 24 +++++------ drivers/gpu/drm/vc4/vc4_hdmi.c | 2 +- - drivers/gpu/drm/vc4/vc4_hvs.c | 50 ++++++++++++---------- + drivers/gpu/drm/vc4/vc4_hvs.c | 52 ++++++++++++---------- drivers/gpu/drm/vc4/vc4_irq.c | 10 ++--- drivers/gpu/drm/vc4/vc4_kms.c | 14 +++--- drivers/gpu/drm/vc4/vc4_perfmon.c | 20 ++++----- @@ -31,7 +31,7 @@ Signed-off-by: Maxime Ripard drivers/gpu/drm/vc4/vc4_v3d.c | 10 ++--- drivers/gpu/drm/vc4/vc4_validate.c | 8 ++-- drivers/gpu/drm/vc4/vc4_validate_shaders.c | 2 +- - 16 files changed, 126 insertions(+), 111 deletions(-) + 16 files changed, 127 insertions(+), 112 deletions(-) --- a/drivers/gpu/drm/vc4/tests/vc4_mock.c +++ b/drivers/gpu/drm/vc4/tests/vc4_mock.c @@ -470,7 +470,7 @@ Signed-off-by: Maxime Ripard switch (args->madv) { --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -2586,7 +2586,7 @@ static int vc4_hdmi_audio_prepare(struct +@@ -2590,7 +2590,7 @@ static int vc4_hdmi_audio_prepare(struct VC4_HDMI_AUDIO_PACKET_CEA_MASK); /* Set the MAI threshold */ @@ -481,7 +481,16 @@ Signed-off-by: Maxime Ripard VC4_SET_FIELD(0x10, VC4_HD_MAI_THR_PANICLOW) | --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -416,7 +416,7 @@ static void vc4_hvs_irq_enable_eof(const +@@ -303,7 +303,7 @@ static void vc4_hvs_lut_load(struct vc4_ + if (!drm_dev_enter(drm, &idx)) + return; + +- if (hvs->vc4->is_vc5) ++ if (hvs->vc4->gen == VC4_GEN_5) + return; + + /* The LUT memory is laid out with each HVS channel in order, +@@ -421,7 +421,7 @@ static void vc4_hvs_irq_enable_eof(const unsigned int channel) { struct vc4_dev *vc4 = hvs->vc4; @@ -490,7 +499,7 @@ Signed-off-by: Maxime Ripard SCALER5_DISPCTRL_DSPEIEOF(channel) : SCALER_DISPCTRL_DSPEIEOF(channel); -@@ -428,7 +428,7 @@ static void vc4_hvs_irq_clear_eof(const +@@ -433,7 +433,7 @@ static void vc4_hvs_irq_clear_eof(const unsigned int channel) { struct vc4_dev *vc4 = hvs->vc4; @@ -499,7 +508,7 @@ Signed-off-by: Maxime Ripard SCALER5_DISPCTRL_DSPEIEOF(channel) : SCALER_DISPCTRL_DSPEIEOF(channel); -@@ -620,7 +620,7 @@ int vc4_hvs_get_fifo_from_output(struct +@@ -625,7 +625,7 @@ int vc4_hvs_get_fifo_from_output(struct u32 reg; int ret; @@ -508,7 +517,7 @@ Signed-off-by: Maxime Ripard return output; /* -@@ -701,7 +701,7 @@ static int vc4_hvs_init_channel(struct v +@@ -706,7 +706,7 @@ static int vc4_hvs_init_channel(struct v dispctrl = SCALER_DISPCTRLX_ENABLE; dispbkgndx = HVS_READ(SCALER_DISPBKGNDX(chan)); @@ -517,7 +526,7 @@ Signed-off-by: Maxime Ripard dispctrl |= VC4_SET_FIELD(mode->hdisplay, SCALER_DISPCTRLX_WIDTH) | VC4_SET_FIELD(mode->vdisplay, -@@ -732,7 +732,7 @@ static int vc4_hvs_init_channel(struct v +@@ -737,7 +737,7 @@ static int vc4_hvs_init_channel(struct v /* Reload the LUT, since the SRAMs would have been disabled if * all CRTCs had SCALER_DISPBKGND_GAMMA unset at once. */ @@ -526,7 +535,7 @@ Signed-off-by: Maxime Ripard vc4_hvs_lut_load(hvs, vc4_crtc); else vc5_hvs_lut_load(hvs, vc4_crtc); -@@ -782,7 +782,7 @@ static int vc4_hvs_gamma_check(struct dr +@@ -785,7 +785,7 @@ static int vc4_hvs_gamma_check(struct dr struct drm_device *dev = crtc->dev; struct vc4_dev *vc4 = to_vc4_dev(dev); @@ -535,7 +544,7 @@ Signed-off-by: Maxime Ripard return 0; if (!crtc_state->color_mgmt_changed) -@@ -1036,7 +1036,7 @@ void vc4_hvs_atomic_flush(struct drm_crt +@@ -1039,7 +1039,7 @@ void vc4_hvs_atomic_flush(struct drm_crt u32 dispbkgndx = HVS_READ(SCALER_DISPBKGNDX(channel)); if (crtc->state->gamma_lut) { @@ -544,7 +553,7 @@ Signed-off-by: Maxime Ripard vc4_hvs_update_gamma_lut(hvs, vc4_crtc); dispbkgndx |= SCALER_DISPBKGND_GAMMA; } else { -@@ -1053,7 +1053,7 @@ void vc4_hvs_atomic_flush(struct drm_crt +@@ -1056,7 +1056,7 @@ void vc4_hvs_atomic_flush(struct drm_crt * should already be disabling/enabling the pipeline * when gamma changes. */ @@ -553,7 +562,7 @@ Signed-off-by: Maxime Ripard dispbkgndx &= ~SCALER_DISPBKGND_GAMMA; } HVS_WRITE(SCALER_DISPBKGNDX(channel), dispbkgndx); -@@ -1069,7 +1069,8 @@ void vc4_hvs_atomic_flush(struct drm_crt +@@ -1073,7 +1073,8 @@ exit: void vc4_hvs_mask_underrun(struct vc4_hvs *hvs, int channel) { @@ -563,7 +572,7 @@ Signed-off-by: Maxime Ripard u32 dispctrl; int idx; -@@ -1077,8 +1078,9 @@ void vc4_hvs_mask_underrun(struct vc4_hv +@@ -1081,8 +1082,9 @@ void vc4_hvs_mask_underrun(struct vc4_hv return; dispctrl = HVS_READ(SCALER_DISPCTRL); @@ -575,7 +584,7 @@ Signed-off-by: Maxime Ripard HVS_WRITE(SCALER_DISPCTRL, dispctrl); -@@ -1087,7 +1089,8 @@ void vc4_hvs_mask_underrun(struct vc4_hv +@@ -1091,7 +1093,8 @@ void vc4_hvs_mask_underrun(struct vc4_hv void vc4_hvs_unmask_underrun(struct vc4_hvs *hvs, int channel) { @@ -585,7 +594,7 @@ Signed-off-by: Maxime Ripard u32 dispctrl; int idx; -@@ -1095,8 +1098,9 @@ void vc4_hvs_unmask_underrun(struct vc4_ +@@ -1099,8 +1102,9 @@ void vc4_hvs_unmask_underrun(struct vc4_ return; dispctrl = HVS_READ(SCALER_DISPCTRL); @@ -597,7 +606,7 @@ Signed-off-by: Maxime Ripard HVS_WRITE(SCALER_DISPSTAT, SCALER_DISPSTAT_EUFLOW(channel)); -@@ -1139,8 +1143,10 @@ static irqreturn_t vc4_hvs_irq_handler(i +@@ -1143,8 +1147,10 @@ static irqreturn_t vc4_hvs_irq_handler(i control = HVS_READ(SCALER_DISPCTRL); for (channel = 0; channel < SCALER_CHANNELS_COUNT; channel++) { @@ -610,7 +619,7 @@ Signed-off-by: Maxime Ripard /* Interrupt masking is not always honored, so check it here. */ if (status & SCALER_DISPSTAT_EUFLOW(channel) && control & dspeislur) { -@@ -1176,7 +1182,7 @@ int vc4_hvs_debugfs_init(struct drm_mino +@@ -1180,7 +1186,7 @@ int vc4_hvs_debugfs_init(struct drm_mino if (!vc4->hvs) return -ENODEV; @@ -619,7 +628,7 @@ Signed-off-by: Maxime Ripard debugfs_create_bool("hvs_load_tracker", S_IRUGO | S_IWUSR, minor->debugfs_root, &vc4->load_tracker_enabled); -@@ -1225,7 +1231,7 @@ struct vc4_hvs *__vc4_hvs_alloc(struct v +@@ -1230,7 +1236,7 @@ struct vc4_hvs *__vc4_hvs_alloc(struct v * between planes when they don't overlap on the screen, but * for now we just allocate globally. */ @@ -628,7 +637,7 @@ Signed-off-by: Maxime Ripard /* 48k words of 2x12-bit pixels */ drm_mm_init(&hvs->lbm_mm, 0, 48 * 1024); else -@@ -1259,7 +1265,7 @@ static int vc4_hvs_bind(struct device *d +@@ -1264,7 +1270,7 @@ static int vc4_hvs_bind(struct device *d hvs->regset.regs = hvs_regs; hvs->regset.nregs = ARRAY_SIZE(hvs_regs); @@ -637,7 +646,7 @@ Signed-off-by: Maxime Ripard struct rpi_firmware *firmware; struct device_node *node; unsigned int max_rate; -@@ -1297,7 +1303,7 @@ static int vc4_hvs_bind(struct device *d +@@ -1302,7 +1308,7 @@ static int vc4_hvs_bind(struct device *d } } @@ -646,7 +655,7 @@ Signed-off-by: Maxime Ripard hvs->dlist = hvs->regs + SCALER_DLIST_START; else hvs->dlist = hvs->regs + SCALER5_DLIST_START; -@@ -1338,7 +1344,7 @@ static int vc4_hvs_bind(struct device *d +@@ -1343,7 +1349,7 @@ static int vc4_hvs_bind(struct device *d SCALER_DISPCTRL_DISPEIRQ(1) | SCALER_DISPCTRL_DISPEIRQ(2); @@ -655,7 +664,7 @@ Signed-off-by: Maxime Ripard dispctrl &= ~(SCALER_DISPCTRL_DMAEIRQ | SCALER_DISPCTRL_SLVWREIRQ | SCALER_DISPCTRL_SLVRDEIRQ | -@@ -1393,7 +1399,7 @@ static int vc4_hvs_bind(struct device *d +@@ -1398,7 +1404,7 @@ static int vc4_hvs_bind(struct device *d /* Recompute Composite Output Buffer (COB) allocations for the displays */ diff --git a/target/linux/bcm27xx/patches-6.6/950-0587-drm-vc4-hvs-Use-switch-statement-to-simplify-vc4_hvs.patch b/target/linux/bcm27xx/patches-6.6/950-0587-drm-vc4-hvs-Use-switch-statement-to-simplify-vc4_hvs.patch index e07e120ed098a3..db59ab5d5b4df7 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0587-drm-vc4-hvs-Use-switch-statement-to-simplify-vc4_hvs.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0587-drm-vc4-hvs-Use-switch-statement-to-simplify-vc4_hvs.patch @@ -14,7 +14,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -620,57 +620,63 @@ int vc4_hvs_get_fifo_from_output(struct +@@ -625,57 +625,63 @@ int vc4_hvs_get_fifo_from_output(struct u32 reg; int ret; diff --git a/target/linux/bcm27xx/patches-6.6/950-0588-drm-vc4-hvs-Use-switch-statement-to-simplify-enablin.patch b/target/linux/bcm27xx/patches-6.6/950-0588-drm-vc4-hvs-Use-switch-statement-to-simplify-enablin.patch index 16810d5035d61f..0875383a0280fc 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0588-drm-vc4-hvs-Use-switch-statement-to-simplify-enablin.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0588-drm-vc4-hvs-Use-switch-statement-to-simplify-enablin.patch @@ -15,7 +15,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -416,24 +416,46 @@ static void vc4_hvs_irq_enable_eof(const +@@ -421,24 +421,46 @@ static void vc4_hvs_irq_enable_eof(const unsigned int channel) { struct vc4_dev *vc4 = hvs->vc4; diff --git a/target/linux/bcm27xx/patches-6.6/950-0589-drm-vc4-hvs-Test-if-the-EOF-interrupts-are-enabled.patch b/target/linux/bcm27xx/patches-6.6/950-0589-drm-vc4-hvs-Test-if-the-EOF-interrupts-are-enabled.patch index c16b1c1ca79c27..d8d2037350de02 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0589-drm-vc4-hvs-Test-if-the-EOF-interrupts-are-enabled.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0589-drm-vc4-hvs-Test-if-the-EOF-interrupts-are-enabled.patch @@ -32,7 +32,7 @@ Signed-off-by: Maxime Ripard struct vc4_hvs { struct vc4_dev *vc4; struct platform_device *pdev; -@@ -327,6 +329,10 @@ struct vc4_hvs { +@@ -328,6 +330,10 @@ struct vc4_hvs { struct clk *core_clk; @@ -43,7 +43,7 @@ Signed-off-by: Maxime Ripard unsigned long max_core_rate; /* Memory manager for CRTCs to allocate space in the display -@@ -359,8 +365,6 @@ struct vc4_hvs { +@@ -360,8 +366,6 @@ struct vc4_hvs { bool vc5_hdmi_enable_4096by2160; }; @@ -54,7 +54,7 @@ Signed-off-by: Maxime Ripard unsigned long core_clock_rate; --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -412,11 +412,14 @@ static void vc5_hvs_update_gamma_lut(str +@@ -417,11 +417,14 @@ static void vc5_hvs_update_gamma_lut(str vc5_hvs_lut_load(hvs, vc4_crtc); } @@ -70,7 +70,7 @@ Signed-off-by: Maxime Ripard switch (vc4->gen) { case VC4_GEN_4: HVS_WRITE(SCALER_DISPCTRL, -@@ -433,13 +436,18 @@ static void vc4_hvs_irq_enable_eof(const +@@ -438,13 +441,18 @@ static void vc4_hvs_irq_enable_eof(const default: break; } @@ -90,7 +90,7 @@ Signed-off-by: Maxime Ripard switch (vc4->gen) { case VC4_GEN_4: HVS_WRITE(SCALER_DISPCTRL, -@@ -456,6 +464,8 @@ static void vc4_hvs_irq_clear_eof(const +@@ -461,6 +469,8 @@ static void vc4_hvs_irq_clear_eof(const default: break; } diff --git a/target/linux/bcm27xx/patches-6.6/950-0590-drm-vc4-hvs-Create-hw_init-function.patch b/target/linux/bcm27xx/patches-6.6/950-0590-drm-vc4-hvs-Create-hw_init-function.patch index bd0b8903695d37..7ddac05734135a 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0590-drm-vc4-hvs-Create-hw_init-function.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0590-drm-vc4-hvs-Create-hw_init-function.patch @@ -16,7 +16,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -1281,79 +1281,10 @@ struct vc4_hvs *__vc4_hvs_alloc(struct v +@@ -1286,79 +1286,10 @@ struct vc4_hvs *__vc4_hvs_alloc(struct v return hvs; } @@ -99,7 +99,7 @@ Signed-off-by: Maxime Ripard reg = HVS_READ(SCALER_DISPECTRL); reg &= ~SCALER_DISPECTRL_DSP2_MUX_MASK; -@@ -1435,6 +1366,86 @@ static int vc4_hvs_bind(struct device *d +@@ -1440,6 +1371,86 @@ static int vc4_hvs_bind(struct device *d HVS_WRITE(SCALER_DISPCTRL, dispctrl); diff --git a/target/linux/bcm27xx/patches-6.6/950-0591-drm-vc4-hvs-Create-cob_init-function.patch b/target/linux/bcm27xx/patches-6.6/950-0591-drm-vc4-hvs-Create-cob_init-function.patch index 157a474ce55c6a..6add44807baad2 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0591-drm-vc4-hvs-Create-cob_init-function.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0591-drm-vc4-hvs-Create-cob_init-function.patch @@ -16,7 +16,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -1369,6 +1369,77 @@ static int vc4_hvs_hw_init(struct vc4_hv +@@ -1374,6 +1374,77 @@ static int vc4_hvs_hw_init(struct vc4_hv return 0; } @@ -94,7 +94,7 @@ Signed-off-by: Maxime Ripard static int vc4_hvs_bind(struct device *dev, struct device *master, void *data) { struct platform_device *pdev = to_platform_device(dev); -@@ -1376,7 +1447,6 @@ static int vc4_hvs_bind(struct device *d +@@ -1381,7 +1452,6 @@ static int vc4_hvs_bind(struct device *d struct vc4_dev *vc4 = to_vc4_dev(drm); struct vc4_hvs *hvs = NULL; int ret; @@ -102,7 +102,7 @@ Signed-off-by: Maxime Ripard hvs = __vc4_hvs_alloc(vc4, NULL); if (IS_ERR(hvs)) -@@ -1446,59 +1516,9 @@ static int vc4_hvs_bind(struct device *d +@@ -1451,59 +1521,9 @@ static int vc4_hvs_bind(struct device *d if (ret) return ret; diff --git a/target/linux/bcm27xx/patches-6.6/950-0592-drm-vc4-hvs-Rename-hvs_regs-list.patch b/target/linux/bcm27xx/patches-6.6/950-0592-drm-vc4-hvs-Rename-hvs_regs-list.patch index 6719a445223f75..f354f6acd7f0f8 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0592-drm-vc4-hvs-Rename-hvs_regs-list.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0592-drm-vc4-hvs-Rename-hvs_regs-list.patch @@ -25,7 +25,7 @@ Signed-off-by: Maxime Ripard VC4_REG32(SCALER_DISPCTRL), VC4_REG32(SCALER_DISPSTAT), VC4_REG32(SCALER_DISPID), -@@ -1457,8 +1457,8 @@ static int vc4_hvs_bind(struct device *d +@@ -1462,8 +1462,8 @@ static int vc4_hvs_bind(struct device *d return PTR_ERR(hvs->regs); hvs->regset.base = hvs->regs; diff --git a/target/linux/bcm27xx/patches-6.6/950-0593-drm-vc4-plane-Change-ptr0_offset-to-an-array.patch b/target/linux/bcm27xx/patches-6.6/950-0593-drm-vc4-plane-Change-ptr0_offset-to-an-array.patch index bc72a950217145..4fba060928c598 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0593-drm-vc4-plane-Change-ptr0_offset-to-an-array.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0593-drm-vc4-plane-Change-ptr0_offset-to-an-array.patch @@ -25,7 +25,7 @@ Signed-off-by: Maxime Ripard #include #include #include -@@ -410,7 +411,7 @@ struct vc4_plane_state { +@@ -411,7 +412,7 @@ struct vc4_plane_state { */ u32 pos0_offset; u32 pos2_offset; diff --git a/target/linux/bcm27xx/patches-6.6/950-0595-drm-vc4-hvs-Change-prototype-of-__vc4_hvs_alloc-to-p.patch b/target/linux/bcm27xx/patches-6.6/950-0595-drm-vc4-hvs-Change-prototype-of-__vc4_hvs_alloc-to-p.patch index 90f5d8a9b226af..36c4010b7e9425 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0595-drm-vc4-hvs-Change-prototype-of-__vc4_hvs_alloc-to-p.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0595-drm-vc4-hvs-Change-prototype-of-__vc4_hvs_alloc-to-p.patch @@ -36,7 +36,7 @@ Signed-off-by: Maxime Ripard drm = &vc4->base; --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h -@@ -1047,7 +1047,9 @@ void vc4_irq_reset(struct drm_device *de +@@ -1048,7 +1048,9 @@ void vc4_irq_reset(struct drm_device *de /* vc4_hvs.c */ extern struct platform_driver vc4_hvs_driver; @@ -49,7 +49,7 @@ Signed-off-by: Maxime Ripard u8 vc4_hvs_get_fifo_frame_count(struct vc4_hvs *hvs, unsigned int fifo); --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -1238,7 +1238,9 @@ int vc4_hvs_debugfs_init(struct drm_mino +@@ -1242,7 +1242,9 @@ int vc4_hvs_debugfs_init(struct drm_mino return 0; } @@ -60,7 +60,7 @@ Signed-off-by: Maxime Ripard { struct drm_device *drm = &vc4->base; struct vc4_hvs *hvs; -@@ -1248,6 +1250,7 @@ struct vc4_hvs *__vc4_hvs_alloc(struct v +@@ -1252,6 +1254,7 @@ struct vc4_hvs *__vc4_hvs_alloc(struct v return ERR_PTR(-ENOMEM); hvs->vc4 = vc4; @@ -68,7 +68,7 @@ Signed-off-by: Maxime Ripard hvs->pdev = pdev; spin_lock_init(&hvs->mm_lock); -@@ -1446,16 +1449,17 @@ static int vc4_hvs_bind(struct device *d +@@ -1451,16 +1454,17 @@ static int vc4_hvs_bind(struct device *d struct drm_device *drm = dev_get_drvdata(master); struct vc4_dev *vc4 = to_vc4_dev(drm); struct vc4_hvs *hvs = NULL; diff --git a/target/linux/bcm27xx/patches-6.6/950-0597-drm-vc4-hdmi-Avoid-hang-with-debug-registers-when-su.patch b/target/linux/bcm27xx/patches-6.6/950-0597-drm-vc4-hdmi-Avoid-hang-with-debug-registers-when-su.patch deleted file mode 100644 index 9f58504abb1de1..00000000000000 --- a/target/linux/bcm27xx/patches-6.6/950-0597-drm-vc4-hdmi-Avoid-hang-with-debug-registers-when-su.patch +++ /dev/null @@ -1,40 +0,0 @@ -From db41506f785ad84895a31b01e8bd7c07bceabb3d Mon Sep 17 00:00:00 2001 -From: Dom Cobley -Date: Tue, 5 Sep 2023 19:38:24 +0100 -Subject: [PATCH 0597/1085] drm/vc4: hdmi: Avoid hang with debug registers when - suspended - -Trying to read /sys/kernel/debug/dri/1/hdmi1_regs -when the hdmi is disconnected results in a fatal system hang. - -This is due to the pm suspend code disabling the dvp clock. -That is just a gate of the 108MHz clock in DVP_HT_RPI_MISC_CONFIG, -which results in accesses hanging AXI bus. - -Protect against this. - -Signed-off-by: Dom Cobley ---- - drivers/gpu/drm/vc4/vc4_hdmi.c | 4 ++++ - 1 file changed, 4 insertions(+) - ---- a/drivers/gpu/drm/vc4/vc4_hdmi.c -+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -185,6 +185,8 @@ static int vc4_hdmi_debugfs_regs(struct - if (!drm_dev_enter(drm, &idx)) - return -ENODEV; - -+ WARN_ON(pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev)); -+ - drm_print_regset32(&p, &vc4_hdmi->hdmi_regset); - drm_print_regset32(&p, &vc4_hdmi->hd_regset); - drm_print_regset32(&p, &vc4_hdmi->cec_regset); -@@ -194,6 +196,8 @@ static int vc4_hdmi_debugfs_regs(struct - drm_print_regset32(&p, &vc4_hdmi->ram_regset); - drm_print_regset32(&p, &vc4_hdmi->rm_regset); - -+ pm_runtime_put(&vc4_hdmi->pdev->dev); -+ - drm_dev_exit(idx); - - return 0; diff --git a/target/linux/bcm27xx/patches-6.6/950-0598-drm-vc4-Move-the-buffer-offset-out-of-the-vc4_plane_.patch b/target/linux/bcm27xx/patches-6.6/950-0598-drm-vc4-Move-the-buffer-offset-out-of-the-vc4_plane_.patch index ae069adc59381a..7a63bc65b50bf1 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0598-drm-vc4-Move-the-buffer-offset-out-of-the-vc4_plane_.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0598-drm-vc4-Move-the-buffer-offset-out-of-the-vc4_plane_.patch @@ -23,7 +23,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h -@@ -431,11 +431,6 @@ struct vc4_plane_state { +@@ -432,11 +432,6 @@ struct vc4_plane_state { bool is_unity; bool is_yuv; diff --git a/target/linux/bcm27xx/patches-6.6/950-0599-drm-vc4-Fix-dlist-debug-not-resetting-the-next-entry.patch b/target/linux/bcm27xx/patches-6.6/950-0599-drm-vc4-Fix-dlist-debug-not-resetting-the-next-entry.patch deleted file mode 100644 index bfaecc53caaf33..00000000000000 --- a/target/linux/bcm27xx/patches-6.6/950-0599-drm-vc4-Fix-dlist-debug-not-resetting-the-next-entry.patch +++ /dev/null @@ -1,34 +0,0 @@ -From d64998e5fc5894eb37f142b7259fa3bec091abbc Mon Sep 17 00:00:00 2001 -From: Dave Stevenson -Date: Thu, 24 Aug 2023 15:36:21 +0100 -Subject: [PATCH 0599/1085] drm/vc4: Fix dlist debug not resetting the next - entry pointer - -The debug function to display the dlists didn't reset next_entry_start -when starting each display, so resulting in not stopping the -list at the correct place. - -Signed-off-by: Dave Stevenson ---- - drivers/gpu/drm/vc4/vc4_hvs.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/drivers/gpu/drm/vc4/vc4_hvs.c -+++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -110,7 +110,7 @@ static int vc4_hvs_debugfs_dlist(struct - struct vc4_dev *vc4 = to_vc4_dev(dev); - struct vc4_hvs *hvs = vc4->hvs; - struct drm_printer p = drm_seq_file_printer(m); -- unsigned int next_entry_start = 0; -+ unsigned int next_entry_start; - unsigned int i, j; - u32 dlist_word, dispstat; - -@@ -124,6 +124,7 @@ static int vc4_hvs_debugfs_dlist(struct - } - - drm_printf(&p, "HVS chan %u:\n", i); -+ next_entry_start = 0; - - for (j = HVS_READ(SCALER_DISPLISTX(i)); j < 256; j++) { - dlist_word = readl((u32 __iomem *)vc4->hvs->dlist + j); diff --git a/target/linux/bcm27xx/patches-6.6/950-0600-drm-vc4-Remove-incorrect-limit-from-hvs_dlist-debugf.patch b/target/linux/bcm27xx/patches-6.6/950-0600-drm-vc4-Remove-incorrect-limit-from-hvs_dlist-debugf.patch deleted file mode 100644 index a104d30b5a637a..00000000000000 --- a/target/linux/bcm27xx/patches-6.6/950-0600-drm-vc4-Remove-incorrect-limit-from-hvs_dlist-debugf.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 480184600be75fd78dcff1502092901d32530cc6 Mon Sep 17 00:00:00 2001 -From: Dave Stevenson -Date: Fri, 1 Sep 2023 13:45:08 +0100 -Subject: [PATCH 0600/1085] drm: vc4: Remove incorrect limit from hvs_dlist - debugfs function - -The debugfs function to dump dlists aborted at 256 bytes, -when actually the dlist memory is generally significantly -larger but varies based on SoC. - -We already have the correct limit in __vc4_hvs_alloc, so -store it for use in the debugfs dlist function. - -Signed-off-by: Dave Stevenson ---- - drivers/gpu/drm/vc4/vc4_drv.h | 1 + - drivers/gpu/drm/vc4/vc4_hvs.c | 5 ++++- - 2 files changed, 5 insertions(+), 1 deletion(-) - ---- a/drivers/gpu/drm/vc4/vc4_drv.h -+++ b/drivers/gpu/drm/vc4/vc4_drv.h -@@ -327,6 +327,7 @@ struct vc4_hvs { - struct platform_device *pdev; - void __iomem *regs; - u32 __iomem *dlist; -+ unsigned int dlist_mem_size; - - struct clk *core_clk; - ---- a/drivers/gpu/drm/vc4/vc4_hvs.c -+++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -110,6 +110,7 @@ static int vc4_hvs_debugfs_dlist(struct - struct vc4_dev *vc4 = to_vc4_dev(dev); - struct vc4_hvs *hvs = vc4->hvs; - struct drm_printer p = drm_seq_file_printer(m); -+ unsigned int dlist_mem_size = hvs->dlist_mem_size; - unsigned int next_entry_start; - unsigned int i, j; - u32 dlist_word, dispstat; -@@ -126,7 +127,7 @@ static int vc4_hvs_debugfs_dlist(struct - drm_printf(&p, "HVS chan %u:\n", i); - next_entry_start = 0; - -- for (j = HVS_READ(SCALER_DISPLISTX(i)); j < 256; j++) { -+ for (j = HVS_READ(SCALER_DISPLISTX(i)); j < dlist_mem_size; j++) { - dlist_word = readl((u32 __iomem *)vc4->hvs->dlist + j); - drm_printf(&p, "dlist: %02d: 0x%08x\n", j, - dlist_word); -@@ -1268,6 +1269,8 @@ struct vc4_hvs *__vc4_hvs_alloc(struct v - HVS_BOOTLOADER_DLIST_END, - (SCALER_DLIST_SIZE >> 2) - HVS_BOOTLOADER_DLIST_END); - -+ hvs->dlist_mem_size = dlist_size; -+ - /* Set up the HVS LBM memory manager. We could have some more - * complicated data structure that allowed reuse of LBM areas - * between planes when they don't overlap on the screen, but diff --git a/target/linux/bcm27xx/patches-6.6/950-0602-drm-vc4-Enable-SCALER_CONTROL-early-in-HVS-init.patch b/target/linux/bcm27xx/patches-6.6/950-0602-drm-vc4-Enable-SCALER_CONTROL-early-in-HVS-init.patch index 56cd010972d09c..62406a268b8f6a 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0602-drm-vc4-Enable-SCALER_CONTROL-early-in-HVS-init.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0602-drm-vc4-Enable-SCALER_CONTROL-early-in-HVS-init.patch @@ -15,7 +15,7 @@ Signed-off-by: Tim Gover --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -1293,6 +1293,10 @@ static int vc4_hvs_hw_init(struct vc4_hv +@@ -1294,6 +1294,10 @@ static int vc4_hvs_hw_init(struct vc4_hv struct vc4_dev *vc4 = hvs->vc4; u32 dispctrl, reg; @@ -26,7 +26,7 @@ Signed-off-by: Tim Gover reg = HVS_READ(SCALER_DISPECTRL); reg &= ~SCALER_DISPECTRL_DSP2_MUX_MASK; HVS_WRITE(SCALER_DISPECTRL, -@@ -1314,8 +1318,6 @@ static int vc4_hvs_hw_init(struct vc4_hv +@@ -1315,8 +1319,6 @@ static int vc4_hvs_hw_init(struct vc4_hv reg | VC4_SET_FIELD(3, SCALER_DISPDITHER_DSP5_MUX)); dispctrl = HVS_READ(SCALER_DISPCTRL); @@ -35,7 +35,7 @@ Signed-off-by: Tim Gover dispctrl |= SCALER_DISPCTRL_DISPEIRQ(0) | SCALER_DISPCTRL_DISPEIRQ(1) | SCALER_DISPCTRL_DISPEIRQ(2); -@@ -1511,6 +1513,10 @@ static int vc4_hvs_bind(struct device *d +@@ -1512,6 +1514,10 @@ static int vc4_hvs_bind(struct device *d else hvs->dlist = hvs->regs + SCALER5_DLIST_START; @@ -46,7 +46,7 @@ Signed-off-by: Tim Gover /* Upload filter kernels. We only have the one for now, so we * keep it around for the lifetime of the driver. */ -@@ -1520,10 +1526,6 @@ static int vc4_hvs_bind(struct device *d +@@ -1521,10 +1527,6 @@ static int vc4_hvs_bind(struct device *d if (ret) return ret; diff --git a/target/linux/bcm27xx/patches-6.6/950-0610-drm-vc4-hvs-Support-BCM2712-HVS.patch b/target/linux/bcm27xx/patches-6.6/950-0610-drm-vc4-hvs-Support-BCM2712-HVS.patch index 6065fc6e86b161..9d19b23d95ab71 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0610-drm-vc4-hvs-Support-BCM2712-HVS.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0610-drm-vc4-hvs-Support-BCM2712-HVS.patch @@ -341,7 +341,7 @@ Signed-off-by: Maxime Ripard static int vc5_hvs_debugfs_gamma(struct seq_file *m, void *data) { struct drm_info_node *node = m->private; -@@ -435,6 +558,10 @@ static void vc4_hvs_irq_enable_eof(struc +@@ -438,6 +561,10 @@ static void vc4_hvs_irq_enable_eof(struc SCALER5_DISPCTRL_DSPEIEOF(channel)); break; @@ -352,7 +352,7 @@ Signed-off-by: Maxime Ripard default: break; } -@@ -463,6 +590,10 @@ static void vc4_hvs_irq_clear_eof(struct +@@ -466,6 +593,10 @@ static void vc4_hvs_irq_clear_eof(struct ~SCALER5_DISPCTRL_DSPEIEOF(channel)); break; @@ -363,7 +363,7 @@ Signed-off-by: Maxime Ripard default: break; } -@@ -622,26 +753,32 @@ static void vc4_hvs_dlist_free_work(stru +@@ -625,26 +756,32 @@ static void vc4_hvs_dlist_free_work(stru u8 vc4_hvs_get_fifo_frame_count(struct vc4_hvs *hvs, unsigned int fifo) { @@ -410,7 +410,7 @@ Signed-off-by: Maxime Ripard } drm_dev_exit(idx); -@@ -708,6 +845,23 @@ int vc4_hvs_get_fifo_from_output(struct +@@ -711,6 +848,23 @@ int vc4_hvs_get_fifo_from_output(struct default: return -EPIPE; } @@ -434,7 +434,7 @@ Signed-off-by: Maxime Ripard } return -EPIPE; -@@ -782,7 +936,41 @@ static int vc4_hvs_init_channel(struct v +@@ -785,7 +939,41 @@ static int vc4_hvs_init_channel(struct v return 0; } @@ -477,7 +477,7 @@ Signed-off-by: Maxime Ripard { struct drm_device *drm = &hvs->vc4->base; int idx; -@@ -813,6 +1001,42 @@ out: +@@ -814,6 +1002,42 @@ out: drm_dev_exit(idx); } @@ -520,7 +520,7 @@ Signed-off-by: Maxime Ripard static int vc4_hvs_gamma_check(struct drm_crtc *crtc, struct drm_atomic_state *state) { -@@ -907,8 +1131,14 @@ static void vc4_hvs_install_dlist(struct +@@ -908,8 +1132,14 @@ static void vc4_hvs_install_dlist(struct return; WARN_ON(!vc4_state->mm); @@ -537,7 +537,7 @@ Signed-off-by: Maxime Ripard drm_dev_exit(idx); } -@@ -965,7 +1195,11 @@ void vc4_hvs_atomic_enable(struct drm_cr +@@ -966,7 +1196,11 @@ void vc4_hvs_atomic_enable(struct drm_cr vc4_hvs_install_dlist(crtc); vc4_hvs_update_dlist(crtc); @@ -550,7 +550,7 @@ Signed-off-by: Maxime Ripard } void vc4_hvs_atomic_disable(struct drm_crtc *crtc, -@@ -1052,13 +1286,28 @@ void vc4_hvs_atomic_flush(struct drm_crt +@@ -1053,13 +1287,28 @@ void vc4_hvs_atomic_flush(struct drm_crt WARN_ON(!vc4_state->mm); WARN_ON_ONCE(dlist_next - dlist_start != vc4_state->mm->mm_node.size); @@ -583,7 +583,7 @@ Signed-off-by: Maxime Ripard /* Only update DISPLIST if the CRTC was already running and is not * being disabled. -@@ -1210,6 +1459,27 @@ static irqreturn_t vc4_hvs_irq_handler(i +@@ -1212,6 +1461,27 @@ static irqreturn_t vc4_hvs_irq_handler(i return irqret; } @@ -611,7 +611,7 @@ Signed-off-by: Maxime Ripard int vc4_hvs_debugfs_init(struct drm_minor *minor) { struct drm_device *drm = minor->dev; -@@ -1231,7 +1501,10 @@ int vc4_hvs_debugfs_init(struct drm_mino +@@ -1233,7 +1503,10 @@ int vc4_hvs_debugfs_init(struct drm_mino NULL); } @@ -623,7 +623,7 @@ Signed-off-by: Maxime Ripard drm_debugfs_add_file(drm, "hvs_underrun", vc4_hvs_debugfs_underrun, NULL); -@@ -1246,6 +1519,9 @@ struct vc4_hvs *__vc4_hvs_alloc(struct v +@@ -1248,6 +1521,9 @@ struct vc4_hvs *__vc4_hvs_alloc(struct v { struct drm_device *drm = &vc4->base; struct vc4_hvs *hvs; @@ -633,7 +633,7 @@ Signed-off-by: Maxime Ripard hvs = drmm_kzalloc(drm, sizeof(*hvs), GFP_KERNEL); if (!hvs) -@@ -1260,14 +1536,39 @@ struct vc4_hvs *__vc4_hvs_alloc(struct v +@@ -1262,27 +1538,87 @@ struct vc4_hvs *__vc4_hvs_alloc(struct v INIT_LIST_HEAD(&hvs->stale_dlist_entries); INIT_WORK(&hvs->free_dlist_work, vc4_hvs_dlist_free_work); @@ -642,9 +642,10 @@ Signed-off-by: Maxime Ripard - * our 16K), since we don't want to scramble the screen when - * transitioning from the firmware's boot setup to runtime. - */ +- hvs->dlist_mem_size = (SCALER_DLIST_SIZE >> 2) - HVS_BOOTLOADER_DLIST_END; - drm_mm_init(&hvs->dlist_mm, - HVS_BOOTLOADER_DLIST_END, -- (SCALER_DLIST_SIZE >> 2) - HVS_BOOTLOADER_DLIST_END); +- hvs->dlist_mem_size); + switch (vc4->gen) { + case VC4_GEN_4: + case VC4_GEN_5: @@ -678,10 +679,11 @@ Signed-off-by: Maxime Ripard + } + + drm_mm_init(&hvs->dlist_mm, dlist_start, dlist_size); ++ ++ hvs->dlist_mem_size = dlist_size; - hvs->dlist_mem_size = dlist_size; - -@@ -1276,12 +1577,46 @@ struct vc4_hvs *__vc4_hvs_alloc(struct v + /* Set up the HVS LBM memory manager. We could have some more + * complicated data structure that allowed reuse of LBM areas * between planes when they don't overlap on the screen, but * for now we just allocate globally. */ @@ -732,7 +734,7 @@ Signed-off-by: Maxime Ripard vc4->hvs = hvs; -@@ -1378,10 +1713,124 @@ static int vc4_hvs_hw_init(struct vc4_hv +@@ -1379,10 +1715,124 @@ static int vc4_hvs_hw_init(struct vc4_hv return 0; } @@ -858,7 +860,7 @@ Signed-off-by: Maxime Ripard /* * Recompute Composite Output Buffer (COB) allocations for the -@@ -1442,6 +1891,31 @@ static int vc4_hvs_cob_init(struct vc4_h +@@ -1443,6 +1893,31 @@ static int vc4_hvs_cob_init(struct vc4_h HVS_WRITE(SCALER_DISPBASE0, reg); break; @@ -890,7 +892,7 @@ Signed-off-by: Maxime Ripard default: return -EINVAL; } -@@ -1467,10 +1941,16 @@ static int vc4_hvs_bind(struct device *d +@@ -1468,10 +1943,16 @@ static int vc4_hvs_bind(struct device *d return PTR_ERR(hvs); hvs->regset.base = hvs->regs; @@ -910,7 +912,7 @@ Signed-off-by: Maxime Ripard struct rpi_firmware *firmware; struct device_node *node; unsigned int max_rate; -@@ -1484,12 +1964,20 @@ static int vc4_hvs_bind(struct device *d +@@ -1485,12 +1966,20 @@ static int vc4_hvs_bind(struct device *d if (!firmware) return -EPROBE_DEFER; @@ -932,7 +934,7 @@ Signed-off-by: Maxime Ripard max_rate = rpi_firmware_clk_get_max_rate(firmware, RPI_FIRMWARE_CORE_CLK_ID); rpi_firmware_put(firmware); -@@ -1506,14 +1994,51 @@ static int vc4_hvs_bind(struct device *d +@@ -1507,14 +1996,51 @@ static int vc4_hvs_bind(struct device *d dev_err(&pdev->dev, "Couldn't enable the core clock\n"); return ret; } @@ -988,7 +990,7 @@ Signed-off-by: Maxime Ripard if (ret) return ret; -@@ -1530,10 +2055,12 @@ static int vc4_hvs_bind(struct device *d +@@ -1531,10 +2057,12 @@ static int vc4_hvs_bind(struct device *d if (ret) return ret; @@ -1005,7 +1007,7 @@ Signed-off-by: Maxime Ripard return 0; } -@@ -1558,6 +2085,7 @@ static void vc4_hvs_unbind(struct device +@@ -1559,6 +2087,7 @@ static void vc4_hvs_unbind(struct device drm_mm_remove_node(node); drm_mm_takedown(&vc4->hvs->lbm_mm); @@ -1013,7 +1015,7 @@ Signed-off-by: Maxime Ripard clk_disable_unprepare(hvs->core_clk); vc4->hvs = NULL; -@@ -1580,6 +2108,7 @@ static void vc4_hvs_dev_remove(struct pl +@@ -1581,6 +2110,7 @@ static void vc4_hvs_dev_remove(struct pl static const struct of_device_id vc4_hvs_dt_match[] = { { .compatible = "brcm,bcm2711-hvs" }, diff --git a/target/linux/bcm27xx/patches-6.6/950-0622-drm-vc4-Add-additional-warn_on.patch b/target/linux/bcm27xx/patches-6.6/950-0622-drm-vc4-Add-additional-warn_on.patch index 2fc6f3d033e065..8dd44970f8b9b9 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0622-drm-vc4-Add-additional-warn_on.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0622-drm-vc4-Add-additional-warn_on.patch @@ -32,7 +32,7 @@ Signed-off-by: Maxime Ripard if (!drm_dev_enter(drm, &idx)) return; -@@ -758,6 +761,8 @@ u8 vc4_hvs_get_fifo_frame_count(struct v +@@ -761,6 +764,8 @@ u8 vc4_hvs_get_fifo_frame_count(struct v u8 field = 0; int idx; @@ -41,7 +41,7 @@ Signed-off-by: Maxime Ripard if (!drm_dev_enter(drm, &idx)) return 0; -@@ -791,6 +796,8 @@ int vc4_hvs_get_fifo_from_output(struct +@@ -794,6 +799,8 @@ int vc4_hvs_get_fifo_from_output(struct u32 reg; int ret; @@ -50,7 +50,7 @@ Signed-off-by: Maxime Ripard switch (vc4->gen) { case VC4_GEN_4: return output; -@@ -880,6 +887,8 @@ static int vc4_hvs_init_channel(struct v +@@ -883,6 +890,8 @@ static int vc4_hvs_init_channel(struct v u32 dispctrl; int idx; @@ -59,7 +59,7 @@ Signed-off-by: Maxime Ripard if (!drm_dev_enter(drm, &idx)) return -ENODEV; -@@ -947,6 +956,8 @@ static int vc6_hvs_init_channel(struct v +@@ -950,6 +959,8 @@ static int vc6_hvs_init_channel(struct v u32 disp_ctrl1; int idx; @@ -68,7 +68,7 @@ Signed-off-by: Maxime Ripard if (!drm_dev_enter(drm, &idx)) return -ENODEV; -@@ -972,9 +983,12 @@ static int vc6_hvs_init_channel(struct v +@@ -975,9 +986,12 @@ static int vc6_hvs_init_channel(struct v static void __vc4_hvs_stop_channel(struct vc4_hvs *hvs, unsigned int chan) { @@ -82,7 +82,7 @@ Signed-off-by: Maxime Ripard if (!drm_dev_enter(drm, &idx)) return; -@@ -1007,6 +1021,8 @@ static void __vc6_hvs_stop_channel(struc +@@ -1008,6 +1022,8 @@ static void __vc6_hvs_stop_channel(struc struct drm_device *drm = &vc4->base; int idx; @@ -91,7 +91,7 @@ Signed-off-by: Maxime Ripard if (!drm_dev_enter(drm, &idx)) return; -@@ -1234,6 +1250,8 @@ void vc4_hvs_atomic_flush(struct drm_crt +@@ -1235,6 +1251,8 @@ void vc4_hvs_atomic_flush(struct drm_crt bool found = false; int idx; @@ -100,7 +100,7 @@ Signed-off-by: Maxime Ripard if (!drm_dev_enter(dev, &idx)) { vc4_crtc_send_vblank(crtc); return; -@@ -1324,6 +1342,8 @@ void vc4_hvs_atomic_flush(struct drm_crt +@@ -1325,6 +1343,8 @@ void vc4_hvs_atomic_flush(struct drm_crt if (crtc->state->color_mgmt_changed) { u32 dispbkgndx = HVS_READ(SCALER_DISPBKGNDX(channel)); @@ -109,7 +109,7 @@ Signed-off-by: Maxime Ripard if (crtc->state->gamma_lut) { if (vc4->gen == VC4_GEN_4) { vc4_hvs_update_gamma_lut(hvs, vc4_crtc); -@@ -1363,6 +1383,8 @@ void vc4_hvs_mask_underrun(struct vc4_hv +@@ -1365,6 +1385,8 @@ void vc4_hvs_mask_underrun(struct vc4_hv u32 dispctrl; int idx; @@ -118,7 +118,7 @@ Signed-off-by: Maxime Ripard if (!drm_dev_enter(drm, &idx)) return; -@@ -1383,6 +1405,8 @@ void vc4_hvs_unmask_underrun(struct vc4_ +@@ -1385,6 +1407,8 @@ void vc4_hvs_unmask_underrun(struct vc4_ u32 dispctrl; int idx; @@ -127,7 +127,7 @@ Signed-off-by: Maxime Ripard if (!drm_dev_enter(drm, &idx)) return; -@@ -1417,6 +1441,8 @@ static irqreturn_t vc4_hvs_irq_handler(i +@@ -1419,6 +1443,8 @@ static irqreturn_t vc4_hvs_irq_handler(i u32 status; u32 dspeislur; @@ -136,7 +136,7 @@ Signed-off-by: Maxime Ripard /* * NOTE: We don't need to protect the register access using * drm_dev_enter() there because the interrupt handler lifetime -@@ -1466,6 +1492,8 @@ static irqreturn_t vc6_hvs_eof_irq_handl +@@ -1468,6 +1494,8 @@ static irqreturn_t vc6_hvs_eof_irq_handl struct vc4_hvs *hvs = vc4->hvs; unsigned int i; diff --git a/target/linux/bcm27xx/patches-6.6/950-0655-vc4-drm-Remove-the-clear-of-SCALER_DISPBKGND_FILL.patch b/target/linux/bcm27xx/patches-6.6/950-0655-vc4-drm-Remove-the-clear-of-SCALER_DISPBKGND_FILL.patch index fa57c12cf62878..5b2ac385c16fdf 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0655-vc4-drm-Remove-the-clear-of-SCALER_DISPBKGND_FILL.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0655-vc4-drm-Remove-the-clear-of-SCALER_DISPBKGND_FILL.patch @@ -25,7 +25,7 @@ Signed-off-by: Dom Cobley --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -1304,27 +1304,25 @@ void vc4_hvs_atomic_flush(struct drm_crt +@@ -1305,27 +1305,25 @@ void vc4_hvs_atomic_flush(struct drm_crt WARN_ON(!vc4_state->mm); WARN_ON_ONCE(dlist_next - dlist_start != vc4_state->mm->mm_node.size); diff --git a/target/linux/bcm27xx/patches-6.6/950-0708-drm-vc4-Correct-logic-on-stopping-an-HVS-channel.patch b/target/linux/bcm27xx/patches-6.6/950-0708-drm-vc4-Correct-logic-on-stopping-an-HVS-channel.patch deleted file mode 100644 index 46b5afaa96b7d2..00000000000000 --- a/target/linux/bcm27xx/patches-6.6/950-0708-drm-vc4-Correct-logic-on-stopping-an-HVS-channel.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 48016174777294ea86103946f71e25bb04f647a1 Mon Sep 17 00:00:00 2001 -From: Dave Stevenson -Date: Thu, 26 Oct 2023 17:46:13 +0100 -Subject: [PATCH 0708/1085] drm/vc4: Correct logic on stopping an HVS channel - -When factoring out __vc4_hvs_stop_channel, the logic got inverted from - if (condition) - // stop channel -to - if (condition) - goto out - //stop channel - out: -and also changed the exact register writes used to stop the channel. - -Correct the logic so that the channel is actually stopped, and revert -to the original register writes. - -Fixes: 6d01a106b4c8 ("drm/vc4: crtc: Move HVS init and close to a function") -Signed-off-by: Dave Stevenson ---- - drivers/gpu/drm/vc4/vc4_hvs.c | 10 ++++------ - 1 file changed, 4 insertions(+), 6 deletions(-) - ---- a/drivers/gpu/drm/vc4/vc4_hvs.c -+++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -992,13 +992,11 @@ static void __vc4_hvs_stop_channel(struc - if (!drm_dev_enter(drm, &idx)) - return; - -- if (HVS_READ(SCALER_DISPCTRLX(chan)) & SCALER_DISPCTRLX_ENABLE) -+ if (!(HVS_READ(SCALER_DISPCTRLX(chan)) & SCALER_DISPCTRLX_ENABLE)) - goto out; - -- HVS_WRITE(SCALER_DISPCTRLX(chan), -- HVS_READ(SCALER_DISPCTRLX(chan)) | SCALER_DISPCTRLX_RESET); -- HVS_WRITE(SCALER_DISPCTRLX(chan), -- HVS_READ(SCALER_DISPCTRLX(chan)) & ~SCALER_DISPCTRLX_ENABLE); -+ HVS_WRITE(SCALER_DISPCTRLX(chan), SCALER_DISPCTRLX_RESET); -+ HVS_WRITE(SCALER_DISPCTRLX(chan), 0); - - /* Once we leave, the scaler should be disabled and its fifo empty. */ - WARN_ON_ONCE(HVS_READ(SCALER_DISPCTRLX(chan)) & SCALER_DISPCTRLX_RESET); -@@ -1026,7 +1024,7 @@ static void __vc6_hvs_stop_channel(struc - if (!drm_dev_enter(drm, &idx)) - return; - -- if (HVS_READ(SCALER6_DISPX_CTRL0(chan)) & SCALER6_DISPX_CTRL0_ENB) -+ if (!(HVS_READ(SCALER6_DISPX_CTRL0(chan)) & SCALER6_DISPX_CTRL0_ENB)) - goto out; - - HVS_WRITE(SCALER6_DISPX_CTRL0(chan), diff --git a/target/linux/bcm27xx/patches-6.6/950-0709-drm-vc4-Drop-WARN-for-HVS-FIFOs-not-being-empty.patch b/target/linux/bcm27xx/patches-6.6/950-0709-drm-vc4-Drop-WARN-for-HVS-FIFOs-not-being-empty.patch index 0d4f6a4ea905b6..d43ed3f7d76b31 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0709-drm-vc4-Drop-WARN-for-HVS-FIFOs-not-being-empty.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0709-drm-vc4-Drop-WARN-for-HVS-FIFOs-not-being-empty.patch @@ -17,7 +17,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -1005,10 +1005,6 @@ static void __vc4_hvs_stop_channel(struc +@@ -1008,10 +1008,6 @@ static void __vc4_hvs_stop_channel(struc SCALER_DISPSTATX_MODE) != SCALER_DISPSTATX_MODE_DISABLED); diff --git a/target/linux/bcm27xx/patches-6.6/950-0710-drm-vc4-Free-all-stale-dlists-if-channel-is-disabled.patch b/target/linux/bcm27xx/patches-6.6/950-0710-drm-vc4-Free-all-stale-dlists-if-channel-is-disabled.patch index 53f2684f3be612..6651fac56e1df9 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0710-drm-vc4-Free-all-stale-dlists-if-channel-is-disabled.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0710-drm-vc4-Free-all-stale-dlists-if-channel-is-disabled.patch @@ -36,7 +36,7 @@ Signed-off-by: Dave Stevenson * someone was waiting it. --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -697,7 +697,8 @@ static void vc4_hvs_schedule_dlist_sweep +@@ -700,7 +700,8 @@ static void vc4_hvs_schedule_dlist_sweep if (!list_empty(&hvs->stale_dlist_entries)) queue_work(system_unbound_wq, &hvs->free_dlist_work); @@ -46,7 +46,7 @@ Signed-off-by: Dave Stevenson spin_unlock_irqrestore(&hvs->mm_lock, flags); } -@@ -712,6 +713,27 @@ static bool vc4_hvs_frcnt_lte(u8 cnt1, u +@@ -715,6 +716,27 @@ static bool vc4_hvs_frcnt_lte(u8 cnt1, u return (s8)((cnt1 << 2) - (cnt2 << 2)) <= 0; } @@ -74,7 +74,7 @@ Signed-off-by: Dave Stevenson /* * Some atomic commits (legacy cursor updates, mostly) will not wait for * the next vblank and will just return once the commit has been pushed -@@ -746,7 +768,8 @@ static void vc4_hvs_dlist_free_work(stru +@@ -749,7 +771,8 @@ static void vc4_hvs_dlist_free_work(stru u8 frcnt; frcnt = vc4_hvs_get_fifo_frame_count(hvs, cur->channel); diff --git a/target/linux/bcm27xx/patches-6.6/950-0711-drm-vc4-Add-hvs_dlist_allocs-debugfs-function.patch b/target/linux/bcm27xx/patches-6.6/950-0711-drm-vc4-Add-hvs_dlist_allocs-debugfs-function.patch index e8e93d5e80a88b..d8a60aadbfd0a4 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0711-drm-vc4-Add-hvs_dlist_allocs-debugfs-function.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0711-drm-vc4-Add-hvs_dlist_allocs-debugfs-function.patch @@ -50,7 +50,7 @@ Signed-off-by: Dave Stevenson /* The filter kernel is composed of dwords each containing 3 9-bit * signed integers packed next to each other. */ -@@ -1551,6 +1581,8 @@ int vc4_hvs_debugfs_init(struct drm_mino +@@ -1555,6 +1585,8 @@ int vc4_hvs_debugfs_init(struct drm_mino drm_debugfs_add_file(drm, "hvs_underrun", vc4_hvs_debugfs_underrun, NULL); diff --git a/target/linux/bcm27xx/patches-6.6/950-0712-drm-vc4-Log-the-size-of-the-dlist-allocation-that-wa.patch b/target/linux/bcm27xx/patches-6.6/950-0712-drm-vc4-Log-the-size-of-the-dlist-allocation-that-wa.patch index 484d1e36763b55..65c02feda08c78 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0712-drm-vc4-Log-the-size-of-the-dlist-allocation-that-wa.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0712-drm-vc4-Log-the-size-of-the-dlist-allocation-that-wa.patch @@ -11,7 +11,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -659,7 +659,8 @@ vc4_hvs_alloc_dlist_entry(struct vc4_hvs +@@ -662,7 +662,8 @@ vc4_hvs_alloc_dlist_entry(struct vc4_hvs dlist_count); spin_unlock_irqrestore(&hvs->mm_lock, flags); if (ret) { diff --git a/target/linux/bcm27xx/patches-6.6/950-0740-drm-vc4-Free-the-dlist-alloc-immediately-if-it-never.patch b/target/linux/bcm27xx/patches-6.6/950-0740-drm-vc4-Free-the-dlist-alloc-immediately-if-it-never.patch index dced86878d1eb8..b28ae3c4a1456b 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0740-drm-vc4-Free-the-dlist-alloc-immediately-if-it-never.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0740-drm-vc4-Free-the-dlist-alloc-immediately-if-it-never.patch @@ -33,7 +33,7 @@ Signed-off-by: Dave Stevenson struct vc4_crtc_state { --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -697,8 +697,11 @@ void vc4_hvs_mark_dlist_entry_stale(stru +@@ -700,8 +700,11 @@ void vc4_hvs_mark_dlist_entry_stale(stru * Kunit tests run with a mock device and we consider any hardware * access a test failure. Let's free the dlist allocation right away if * we're running under kunit, we won't risk a dlist corruption anyway. @@ -46,7 +46,7 @@ Signed-off-by: Dave Stevenson spin_lock_irqsave(&hvs->mm_lock, flags); vc4_hvs_free_dlist_entry_locked(hvs, alloc); spin_unlock_irqrestore(&hvs->mm_lock, flags); -@@ -1195,6 +1198,7 @@ static void vc4_hvs_install_dlist(struct +@@ -1198,6 +1201,7 @@ static void vc4_hvs_install_dlist(struct return; WARN_ON(!vc4_state->mm); diff --git a/target/linux/bcm27xx/patches-6.6/950-0810-drm-vc4-Fix-reading-of-frame-count-on-GEN5-Pi4.patch b/target/linux/bcm27xx/patches-6.6/950-0810-drm-vc4-Fix-reading-of-frame-count-on-GEN5-Pi4.patch index 849caa45390bf6..8fdd244a002c73 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0810-drm-vc4-Fix-reading-of-frame-count-on-GEN5-Pi4.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0810-drm-vc4-Fix-reading-of-frame-count-on-GEN5-Pi4.patch @@ -16,7 +16,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -823,10 +823,28 @@ u8 vc4_hvs_get_fifo_frame_count(struct v +@@ -826,10 +826,28 @@ u8 vc4_hvs_get_fifo_frame_count(struct v if (!drm_dev_enter(drm, &idx)) return 0; @@ -47,7 +47,7 @@ Signed-off-by: Dave Stevenson switch (fifo) { case 0: field = VC4_GET_FIELD(HVS_READ(SCALER_DISPSTAT1), -@@ -841,6 +859,7 @@ u8 vc4_hvs_get_fifo_frame_count(struct v +@@ -844,6 +862,7 @@ u8 vc4_hvs_get_fifo_frame_count(struct v SCALER_DISPSTAT2_FRCNT2); break; } diff --git a/target/linux/bcm27xx/patches-6.6/950-0829-vc4-hvs-Add-support-for-D0-register-changes.patch b/target/linux/bcm27xx/patches-6.6/950-0829-vc4-hvs-Add-support-for-D0-register-changes.patch index 3d13a6a09c3928..c8c284a1394c84 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0829-vc4-hvs-Add-support-for-D0-register-changes.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0829-vc4-hvs-Add-support-for-D0-register-changes.patch @@ -169,7 +169,7 @@ Signed-off-by: Dom Cobley next_entry_start = 0; for (j = active_dlist; j < dlist_mem_size; j++) { -@@ -760,7 +819,7 @@ bool vc4_hvs_check_channel_active(struct +@@ -763,7 +822,7 @@ bool vc4_hvs_check_channel_active(struct return 0; if (vc4->gen >= VC4_GEN_6) @@ -178,7 +178,7 @@ Signed-off-by: Dom Cobley else enabled = HVS_READ(SCALER_DISPCTRLX(fifo)) & SCALER_DISPCTRLX_ENABLE; -@@ -825,8 +884,8 @@ u8 vc4_hvs_get_fifo_frame_count(struct v +@@ -828,8 +887,8 @@ u8 vc4_hvs_get_fifo_frame_count(struct v switch (vc4->gen) { case VC4_GEN_6: @@ -189,7 +189,7 @@ Signed-off-by: Dom Cobley break; case VC4_GEN_5: switch (fifo) { -@@ -1037,20 +1096,20 @@ static int vc6_hvs_init_channel(struct v +@@ -1040,20 +1099,20 @@ static int vc6_hvs_init_channel(struct v if (!drm_dev_enter(drm, &idx)) return -ENODEV; @@ -219,12 +219,7 @@ Signed-off-by: Dom Cobley drm_dev_exit(idx); -@@ -1096,18 +1155,18 @@ static void __vc6_hvs_stop_channel(struc - if (!drm_dev_enter(drm, &idx)) - return; - -- if (!(HVS_READ(SCALER6_DISPX_CTRL0(chan)) & SCALER6_DISPX_CTRL0_ENB)) -+ if (!(HVS_READ(SCALER6_DISPX_CTRL0(chan)) & SCALER6(DISPX_CTRL0_ENB))) +@@ -1103,14 +1162,14 @@ static void __vc6_hvs_stop_channel(struc goto out; HVS_WRITE(SCALER6_DISPX_CTRL0(chan), @@ -244,7 +239,7 @@ Signed-off-by: Dom Cobley out: drm_dev_exit(idx); -@@ -1221,8 +1280,8 @@ static void vc4_hvs_install_dlist(struct +@@ -1224,8 +1283,8 @@ static void vc4_hvs_install_dlist(struct if (vc4->gen >= VC4_GEN_6) HVS_WRITE(SCALER6_DISPX_LPTRS(vc4_state->assigned_channel), @@ -255,7 +250,7 @@ Signed-off-by: Dom Cobley else HVS_WRITE(SCALER_DISPLISTX(vc4_state->assigned_channel), vc4_state->mm->mm_node.start); -@@ -1382,11 +1441,11 @@ void vc4_hvs_atomic_flush(struct drm_crt +@@ -1385,11 +1444,11 @@ void vc4_hvs_atomic_flush(struct drm_crt if (enable_bg_fill) HVS_WRITE(SCALER6_DISPX_CTRL1(channel), HVS_READ(SCALER6_DISPX_CTRL1(channel)) | @@ -269,7 +264,7 @@ Signed-off-by: Dom Cobley } else { /* we can actually run with a lower core clock when background * fill is enabled on VC4_GEN_5 so leave it enabled always. -@@ -1656,7 +1715,7 @@ struct vc4_hvs *__vc4_hvs_alloc(struct v +@@ -1660,7 +1719,7 @@ struct vc4_hvs *__vc4_hvs_alloc(struct v * access a register. Use a plausible size then. */ if (!kunit_get_current_test()) @@ -278,7 +273,7 @@ Signed-off-by: Dom Cobley else dlist_size = 4096; -@@ -1890,14 +1949,17 @@ static int vc6_hvs_hw_init(struct vc4_hv +@@ -1894,14 +1953,17 @@ static int vc6_hvs_hw_init(struct vc4_hv const struct vc6_csc_coeff_entry *coeffs; unsigned int i; @@ -300,7 +295,7 @@ Signed-off-by: Dom Cobley for (i = 0; i < 6; i++) { coeffs = &csc_coeffs[i / 3][i % 3]; -@@ -1996,21 +2058,21 @@ static int vc4_hvs_cob_init(struct vc4_h +@@ -2000,21 +2062,21 @@ static int vc4_hvs_cob_init(struct vc4_h reg = 0; top = 3840; @@ -325,7 +320,7 @@ Signed-off-by: Dom Cobley VC4_SET_FIELD(top, SCALER6_DISPX_COB_TOP) | VC4_SET_FIELD(base, SCALER6_DISPX_COB_BASE)); break; -@@ -2041,7 +2103,10 @@ static int vc4_hvs_bind(struct device *d +@@ -2045,7 +2107,10 @@ static int vc4_hvs_bind(struct device *d hvs->regset.base = hvs->regs; @@ -337,7 +332,7 @@ Signed-off-by: Dom Cobley hvs->regset.regs = vc6_hvs_regs; hvs->regset.nregs = ARRAY_SIZE(vc6_hvs_regs); } else { -@@ -2208,6 +2273,7 @@ static void vc4_hvs_dev_remove(struct pl +@@ -2212,6 +2277,7 @@ static void vc4_hvs_dev_remove(struct pl static const struct of_device_id vc4_hvs_dt_match[] = { { .compatible = "brcm,bcm2711-hvs" }, { .compatible = "brcm,bcm2712-hvs" }, diff --git a/target/linux/bcm27xx/patches-6.6/950-0830-vc4-hvs-Updates-to-support-D0-alpha-and-csc-changes.patch b/target/linux/bcm27xx/patches-6.6/950-0830-vc4-hvs-Updates-to-support-D0-alpha-and-csc-changes.patch index d88e6a744cda16..0535f63224f5ff 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0830-vc4-hvs-Updates-to-support-D0-alpha-and-csc-changes.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0830-vc4-hvs-Updates-to-support-D0-alpha-and-csc-changes.patch @@ -16,7 +16,7 @@ Signed-off-by: Dom Cobley --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -1888,6 +1888,17 @@ static int vc4_hvs_hw_init(struct vc4_hv +@@ -1892,6 +1892,17 @@ static int vc4_hvs_hw_init(struct vc4_hv #define CFC1_N_MA_CSC_COEFF_C23(x) (0xa03c + ((x) * 0x3000)) #define CFC1_N_MA_CSC_COEFF_C24(x) (0xa040 + ((x) * 0x3000)) @@ -34,7 +34,7 @@ Signed-off-by: Dom Cobley /* 4 S2.22 multiplication factors, and 1 S9.15 addititive element for each of 3 * output components */ -@@ -1958,31 +1969,43 @@ static int vc6_hvs_hw_init(struct vc4_hv +@@ -1962,31 +1973,43 @@ static int vc6_hvs_hw_init(struct vc4_hv HVS_WRITE(SCALER6(PRI_MAP0), 0xffffffff); HVS_WRITE(SCALER6(PRI_MAP1), 0xffffffff); diff --git a/target/linux/bcm27xx/patches-6.6/950-0836-drm-vc4-Optimise-vc4_hvs_dlist_free_work-to-only-rea.patch b/target/linux/bcm27xx/patches-6.6/950-0836-drm-vc4-Optimise-vc4_hvs_dlist_free_work-to-only-rea.patch index ff589278b6678e..19442e421c35d3 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0836-drm-vc4-Optimise-vc4_hvs_dlist_free_work-to-only-rea.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0836-drm-vc4-Optimise-vc4_hvs_dlist_free_work-to-only-rea.patch @@ -18,7 +18,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -855,14 +855,19 @@ static void vc4_hvs_dlist_free_work(stru +@@ -858,14 +858,19 @@ static void vc4_hvs_dlist_free_work(stru struct vc4_hvs *hvs = container_of(work, struct vc4_hvs, free_dlist_work); struct vc4_hvs_dlist_allocation *cur, *next; unsigned long flags; diff --git a/target/linux/bcm27xx/patches-6.6/950-0837-drm-vc4-Flush-stale-dlist-entries-if-allocation-fail.patch b/target/linux/bcm27xx/patches-6.6/950-0837-drm-vc4-Flush-stale-dlist-entries-if-allocation-fail.patch index 67be70d9a28947..b12ce4c542b3de 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0837-drm-vc4-Flush-stale-dlist-entries-if-allocation-fail.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0837-drm-vc4-Flush-stale-dlist-entries-if-allocation-fail.patch @@ -19,7 +19,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -693,6 +693,9 @@ static void vc4_hvs_irq_clear_eof(struct +@@ -696,6 +696,9 @@ static void vc4_hvs_irq_clear_eof(struct hvs->eof_irq[channel].enabled = false; } @@ -29,7 +29,7 @@ Signed-off-by: Dave Stevenson static struct vc4_hvs_dlist_allocation * vc4_hvs_alloc_dlist_entry(struct vc4_hvs *hvs, unsigned int channel, -@@ -701,6 +704,7 @@ vc4_hvs_alloc_dlist_entry(struct vc4_hvs +@@ -704,6 +707,7 @@ vc4_hvs_alloc_dlist_entry(struct vc4_hvs struct vc4_dev *vc4 = hvs->vc4; struct drm_device *dev = &vc4->base; struct vc4_hvs_dlist_allocation *alloc; @@ -37,7 +37,7 @@ Signed-off-by: Dave Stevenson unsigned long flags; int ret; -@@ -718,9 +722,26 @@ vc4_hvs_alloc_dlist_entry(struct vc4_hvs +@@ -721,9 +725,26 @@ vc4_hvs_alloc_dlist_entry(struct vc4_hvs dlist_count); spin_unlock_irqrestore(&hvs->mm_lock, flags); if (ret) { diff --git a/target/linux/bcm27xx/patches-6.6/950-0989-drm-vc4-Enable-bg_fill-if-there-are-no-planes-enable.patch b/target/linux/bcm27xx/patches-6.6/950-0989-drm-vc4-Enable-bg_fill-if-there-are-no-planes-enable.patch index 10d7f571194fc9..b34cff057eadab 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0989-drm-vc4-Enable-bg_fill-if-there-are-no-planes-enable.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0989-drm-vc4-Enable-bg_fill-if-there-are-no-planes-enable.patch @@ -19,7 +19,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -1400,7 +1400,7 @@ void vc4_hvs_atomic_flush(struct drm_crt +@@ -1403,7 +1403,7 @@ void vc4_hvs_atomic_flush(struct drm_crt struct drm_plane *plane; struct vc4_plane_state *vc4_plane_state; bool debug_dump_regs = false; diff --git a/target/linux/bcm27xx/patches-6.6/950-1257-drm-vc4-Add-support-for-per-plane-scaling-filter-sel.patch b/target/linux/bcm27xx/patches-6.6/950-1257-drm-vc4-Add-support-for-per-plane-scaling-filter-sel.patch index 5b3ae3c9101122..52a13c6508db92 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1257-drm-vc4-Add-support-for-per-plane-scaling-filter-sel.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1257-drm-vc4-Add-support-for-per-plane-scaling-filter-sel.patch @@ -40,7 +40,7 @@ Signed-off-by: Dave Stevenson static int vc4_hvs_upload_linear_kernel(struct vc4_hvs *hvs, struct drm_mm_node *space, -@@ -2255,14 +2258,19 @@ static int vc4_hvs_bind(struct device *d +@@ -2259,14 +2262,19 @@ static int vc4_hvs_bind(struct device *d if (ret) return ret; @@ -62,7 +62,7 @@ Signed-off-by: Dave Stevenson ret = vc4_hvs_cob_init(hvs); if (ret) -@@ -2288,6 +2296,8 @@ static void vc4_hvs_unbind(struct device +@@ -2292,6 +2300,8 @@ static void vc4_hvs_unbind(struct device if (drm_mm_node_allocated(&vc4->hvs->mitchell_netravali_filter)) drm_mm_remove_node(&vc4->hvs->mitchell_netravali_filter); diff --git a/target/linux/bcm27xx/patches-6.6/950-1323-drm-vc4-Remove-request-for-min-clocks-when-hdmi-outp.patch b/target/linux/bcm27xx/patches-6.6/950-1323-drm-vc4-Remove-request-for-min-clocks-when-hdmi-outp.patch index 9f4cf9d0336dab..1a1e3439e5e4e0 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1323-drm-vc4-Remove-request-for-min-clocks-when-hdmi-outp.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1323-drm-vc4-Remove-request-for-min-clocks-when-hdmi-outp.patch @@ -50,7 +50,7 @@ Signed-off-by: Dom Cobley return 0; --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -2308,7 +2308,10 @@ static void vc4_hvs_unbind(struct device +@@ -2312,7 +2312,10 @@ static void vc4_hvs_unbind(struct device drm_mm_remove_node(node); drm_mm_takedown(&vc4->hvs->lbm_mm); diff --git a/target/linux/bcm27xx/patches-6.6/950-1349-cgroup-Use-kernel-command-line-to-disable-memory-cgr.patch b/target/linux/bcm27xx/patches-6.6/950-1349-cgroup-Use-kernel-command-line-to-disable-memory-cgr.patch index 46e0aeaf4ce6f6..61dec89382cff5 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1349-cgroup-Use-kernel-command-line-to-disable-memory-cgr.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1349-cgroup-Use-kernel-command-line-to-disable-memory-cgr.patch @@ -148,7 +148,7 @@ Signed-off-by: Maíra Canal --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c -@@ -6060,9 +6060,6 @@ int __init cgroup_init_early(void) +@@ -6063,9 +6063,6 @@ int __init cgroup_init_early(void) return 0; } @@ -158,7 +158,7 @@ Signed-off-by: Maíra Canal /** * cgroup_init - cgroup initialization * -@@ -6096,12 +6093,6 @@ int __init cgroup_init(void) +@@ -6099,12 +6096,6 @@ int __init cgroup_init(void) cgroup_unlock(); @@ -171,7 +171,7 @@ Signed-off-by: Maíra Canal for_each_subsys(ss, ssid) { if (ss->early_init) { struct cgroup_subsys_state *css = -@@ -6742,10 +6733,6 @@ static int __init cgroup_disable(char *s +@@ -6745,10 +6736,6 @@ static int __init cgroup_disable(char *s strcmp(token, ss->legacy_name)) continue; @@ -182,7 +182,7 @@ Signed-off-by: Maíra Canal static_branch_disable(cgroup_subsys_enabled_key[i]); pr_info("Disabling %s control group subsystem\n", ss->name); -@@ -6779,7 +6766,7 @@ static int __init cgroup_enable(char *st +@@ -6782,7 +6769,7 @@ static int __init cgroup_enable(char *st strcmp(token, ss->legacy_name)) continue; diff --git a/target/linux/generic/hack-6.6/204-module_strip.patch b/target/linux/generic/hack-6.6/204-module_strip.patch index 403ee11513cc54..9eadd2ce16bb58 100644 --- a/target/linux/generic/hack-6.6/204-module_strip.patch +++ b/target/linux/generic/hack-6.6/204-module_strip.patch @@ -141,7 +141,7 @@ Signed-off-by: Felix Fietkau if (err) --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c -@@ -1693,7 +1693,9 @@ static void read_symbols(const char *mod +@@ -1666,7 +1666,9 @@ static void read_symbols(const char *mod symname = remove_dot(info.strtab + sym->st_name); handle_symbol(mod, &info, sym, symname); @@ -151,7 +151,7 @@ Signed-off-by: Felix Fietkau } check_sec_ref(mod, &info); -@@ -1866,8 +1868,10 @@ static void add_header(struct buffer *b, +@@ -1839,8 +1841,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"); @@ -162,7 +162,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"); -@@ -1881,8 +1885,10 @@ static void add_header(struct buffer *b, +@@ -1854,8 +1858,10 @@ static void add_header(struct buffer *b, buf_printf(b, "\t.arch = MODULE_ARCH_INIT,\n"); buf_printf(b, "};\n"); @@ -173,7 +173,7 @@ Signed-off-by: Felix Fietkau buf_printf(b, "\n" -@@ -1890,8 +1896,10 @@ static void add_header(struct buffer *b, +@@ -1863,8 +1869,10 @@ static void add_header(struct buffer *b, "MODULE_INFO(retpoline, \"Y\");\n" "#endif\n"); @@ -184,7 +184,7 @@ Signed-off-by: Felix Fietkau if (strstarts(mod->name, "tools/testing")) buf_printf(b, "\nMODULE_INFO(test, \"Y\");\n"); -@@ -2001,11 +2009,13 @@ static void add_depends(struct buffer *b +@@ -1974,11 +1982,13 @@ static void add_depends(struct buffer *b static void add_srcversion(struct buffer *b, struct module *mod) { @@ -198,7 +198,7 @@ Signed-off-by: Felix Fietkau } static void write_buf(struct buffer *b, const char *fname) -@@ -2088,7 +2098,9 @@ static void write_mod_c_file(struct modu +@@ -2061,7 +2071,9 @@ static void write_mod_c_file(struct modu add_exported_symbols(&buf, mod); add_versions(&buf, mod); add_depends(&buf, mod); diff --git a/target/linux/generic/hack-6.6/253-ksmbd-config.patch b/target/linux/generic/hack-6.6/253-ksmbd-config.patch index 9079c66d420e7f..d54b48895ea369 100644 --- a/target/linux/generic/hack-6.6/253-ksmbd-config.patch +++ b/target/linux/generic/hack-6.6/253-ksmbd-config.patch @@ -10,7 +10,7 @@ Subject: [PATCH] Kconfig: add tristate for OID and ASNI string --- a/init/Kconfig +++ b/init/Kconfig -@@ -1993,7 +1993,7 @@ config PADATA +@@ -2002,7 +2002,7 @@ config PADATA bool config ASN1 diff --git a/target/linux/generic/hack-6.6/780-usb-net-MeigLink_modem_support.patch b/target/linux/generic/hack-6.6/780-usb-net-MeigLink_modem_support.patch index 66c58dba64e42a..cefb9c53e89d61 100644 --- a/target/linux/generic/hack-6.6/780-usb-net-MeigLink_modem_support.patch +++ b/target/linux/generic/hack-6.6/780-usb-net-MeigLink_modem_support.patch @@ -10,7 +10,7 @@ Subject: [PATCH] net/usb/qmi_wwan: add MeigLink modem support --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c -@@ -1084,12 +1084,18 @@ static const struct usb_device_id produc +@@ -1084,6 +1084,11 @@ 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, }, @@ -19,9 +19,10 @@ Subject: [PATCH] net/usb/qmi_wwan: add MeigLink modem support + .driver_info = (unsigned long)&qmi_wwan_info, + }, + + {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0122)}, /* Quectel RG650V */ {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 */ +@@ -1091,6 +1096,7 @@ static const struct usb_device_id produc {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 */ diff --git a/target/linux/generic/hack-6.6/901-debloat_sock_diag.patch b/target/linux/generic/hack-6.6/901-debloat_sock_diag.patch index acf72f4422579e..4b1ea3c5ad932f 100644 --- a/target/linux/generic/hack-6.6/901-debloat_sock_diag.patch +++ b/target/linux/generic/hack-6.6/901-debloat_sock_diag.patch @@ -105,8 +105,8 @@ Signed-off-by: Felix Fietkau #include #include -@@ -21,23 +20,6 @@ static int (*inet_rcv_compat)(struct sk_ - static DEFINE_MUTEX(sock_diag_table_mutex); +@@ -22,23 +21,6 @@ static const struct sock_diag_inet_compa + static struct workqueue_struct *broadcast_wq; -DEFINE_COOKIE(sock_cookie); diff --git a/target/linux/generic/hack-6.6/902-debloat_proc.patch b/target/linux/generic/hack-6.6/902-debloat_proc.patch index 691a60bcc03888..2c3eca2552fc32 100644 --- a/target/linux/generic/hack-6.6/902-debloat_proc.patch +++ b/target/linux/generic/hack-6.6/902-debloat_proc.patch @@ -246,7 +246,7 @@ Signed-off-by: Felix Fietkau &vmalloc_op, --- a/mm/vmstat.c +++ b/mm/vmstat.c -@@ -2135,10 +2135,12 @@ void __init init_mm_internals(void) +@@ -2136,10 +2136,12 @@ void __init init_mm_internals(void) start_shepherd_timer(); #endif #ifdef CONFIG_PROC_FS diff --git a/target/linux/generic/hack-6.6/920-device_tree_cmdline.patch b/target/linux/generic/hack-6.6/920-device_tree_cmdline.patch index 2a43ffb7ad54ef..1d78a9dc4dedc3 100644 --- a/target/linux/generic/hack-6.6/920-device_tree_cmdline.patch +++ b/target/linux/generic/hack-6.6/920-device_tree_cmdline.patch @@ -9,7 +9,7 @@ Subject: [PATCH] of/ftd: add device tree cmdline --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c -@@ -1185,6 +1185,9 @@ int __init early_init_dt_scan_chosen(cha +@@ -1186,6 +1186,9 @@ int __init early_init_dt_scan_chosen(cha p = of_get_flat_dt_prop(node, "bootargs", &l); if (p != NULL && l > 0) strscpy(cmdline, p, min(l, COMMAND_LINE_SIZE)); diff --git a/target/linux/generic/pending-6.6/203-kallsyms_uncompressed.patch b/target/linux/generic/pending-6.6/203-kallsyms_uncompressed.patch index c23811ed3987e4..94b22603d8c261 100644 --- a/target/linux/generic/pending-6.6/203-kallsyms_uncompressed.patch +++ b/target/linux/generic/pending-6.6/203-kallsyms_uncompressed.patch @@ -13,7 +13,7 @@ Signed-off-by: Felix Fietkau --- a/init/Kconfig +++ b/init/Kconfig -@@ -1451,6 +1451,17 @@ config SYSCTL_ARCH_UNALIGN_ALLOW +@@ -1460,6 +1460,17 @@ config SYSCTL_ARCH_UNALIGN_ALLOW the unaligned access emulation. see arch/parisc/kernel/unaligned.c for reference diff --git a/target/linux/generic/pending-6.6/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch b/target/linux/generic/pending-6.6/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch index f754705dc6d140..9cf9117d097122 100644 --- a/target/linux/generic/pending-6.6/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch +++ b/target/linux/generic/pending-6.6/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch @@ -76,7 +76,7 @@ Signed-off-by: Jonas Gorski static inline const char *rtn_type(char *buf, size_t len, unsigned int t) --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c -@@ -180,6 +180,7 @@ static int ipmr_rule_action(struct fib_r +@@ -190,6 +190,7 @@ static int ipmr_rule_action(struct fib_r case FR_ACT_UNREACHABLE: return -ENETUNREACH; case FR_ACT_PROHIBIT: @@ -99,7 +99,7 @@ Signed-off-by: Jonas Gorski tb_id = fib_rule_get_table(rule, arg); --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c -@@ -170,6 +170,8 @@ static int ip6mr_rule_action(struct fib_ +@@ -180,6 +180,8 @@ static int ip6mr_rule_action(struct fib_ return -ENETUNREACH; case FR_ACT_PROHIBIT: return -EACCES; @@ -138,7 +138,7 @@ Signed-off-by: Jonas Gorski static const struct rt6_info ip6_blk_hole_entry_template = { .dst = { .__rcuref = RCUREF_INIT(1), -@@ -1040,6 +1054,7 @@ static const int fib6_prop[RTN_MAX + 1] +@@ -1043,6 +1057,7 @@ static const int fib6_prop[RTN_MAX + 1] [RTN_BLACKHOLE] = -EINVAL, [RTN_UNREACHABLE] = -EHOSTUNREACH, [RTN_PROHIBIT] = -EACCES, @@ -146,7 +146,7 @@ Signed-off-by: Jonas Gorski [RTN_THROW] = -EAGAIN, [RTN_NAT] = -EINVAL, [RTN_XRESOLVE] = -EINVAL, -@@ -1075,6 +1090,10 @@ static void ip6_rt_init_dst_reject(struc +@@ -1078,6 +1093,10 @@ static void ip6_rt_init_dst_reject(struc rt->dst.output = ip6_pkt_prohibit_out; rt->dst.input = ip6_pkt_prohibit; break; diff --git a/target/linux/generic/pending-6.6/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch b/target/linux/generic/pending-6.6/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch index cfa3975c386bff..d13641064063fa 100644 --- a/target/linux/generic/pending-6.6/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch +++ b/target/linux/generic/pending-6.6/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 -@@ -8377,7 +8377,7 @@ static int nft_register_flowtable_net_ho +@@ -8417,7 +8417,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-6.6/920-mangle_bootargs.patch b/target/linux/generic/pending-6.6/920-mangle_bootargs.patch index 1d73cca11e2321..36e7c18324bdfb 100644 --- a/target/linux/generic/pending-6.6/920-mangle_bootargs.patch +++ b/target/linux/generic/pending-6.6/920-mangle_bootargs.patch @@ -13,7 +13,7 @@ Signed-off-by: Imre Kaloz --- a/init/Kconfig +++ b/init/Kconfig -@@ -1811,6 +1811,15 @@ config DEBUG_RSEQ +@@ -1820,6 +1820,15 @@ config DEBUG_RSEQ If unsure, say N. diff --git a/target/linux/ipq806x/patches-6.6/900-arm-add-cmdline-override.patch b/target/linux/ipq806x/patches-6.6/900-arm-add-cmdline-override.patch index f8bd1674b80ab4..7ea3c82ffd4c8a 100644 --- a/target/linux/ipq806x/patches-6.6/900-arm-add-cmdline-override.patch +++ b/target/linux/ipq806x/patches-6.6/900-arm-add-cmdline-override.patch @@ -17,7 +17,7 @@ default "" --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c -@@ -1189,6 +1189,17 @@ int __init early_init_dt_scan_chosen(cha +@@ -1190,6 +1190,17 @@ int __init early_init_dt_scan_chosen(cha if (p != NULL && l > 0) strlcat(cmdline, p, min_t(int, strlen(cmdline) + (int)l, COMMAND_LINE_SIZE)); diff --git a/target/linux/layerscape/patches-6.6/400-LF-20-3-mtd-spi-nor-Use-1-bit-mode-of-spansion-s25fs.patch b/target/linux/layerscape/patches-6.6/400-LF-20-3-mtd-spi-nor-Use-1-bit-mode-of-spansion-s25fs.patch index b85053eba9ea0e..008a146cc97e8b 100644 --- a/target/linux/layerscape/patches-6.6/400-LF-20-3-mtd-spi-nor-Use-1-bit-mode-of-spansion-s25fs.patch +++ b/target/linux/layerscape/patches-6.6/400-LF-20-3-mtd-spi-nor-Use-1-bit-mode-of-spansion-s25fs.patch @@ -15,7 +15,7 @@ Signed-off-by: Kuldeep Singh --- a/drivers/mtd/spi-nor/spansion.c +++ b/drivers/mtd/spi-nor/spansion.c -@@ -798,8 +798,8 @@ static const struct flash_info spansion_ +@@ -799,8 +799,8 @@ static const struct flash_info spansion_ MFR_FLAGS(USE_CLSR) }, { "s25fs512s", INFO6(0x010220, 0x4d0081, 256 * 1024, 256) diff --git a/target/linux/mediatek/patches-6.6/432-drivers-spi-Add-support-for-dynamic-calibration.patch b/target/linux/mediatek/patches-6.6/432-drivers-spi-Add-support-for-dynamic-calibration.patch index 19fe984aa6179b..7ff7b05301aea5 100644 --- a/target/linux/mediatek/patches-6.6/432-drivers-spi-Add-support-for-dynamic-calibration.patch +++ b/target/linux/mediatek/patches-6.6/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 -@@ -1370,6 +1370,70 @@ static int spi_transfer_wait(struct spi_ +@@ -1380,6 +1380,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) -@@ -2215,6 +2279,75 @@ void spi_flush_queue(struct spi_controll +@@ -2225,6 +2289,75 @@ void spi_flush_queue(struct spi_controll /*-------------------------------------------------------------------------*/ #if defined(CONFIG_OF) @@ -158,7 +158,7 @@ Signed-off-by: SkyLake.Huang static void of_spi_parse_dt_cs_delay(struct device_node *nc, struct spi_delay *delay, const char *prop) { -@@ -2354,6 +2487,10 @@ of_register_spi_device(struct spi_contro +@@ -2364,6 +2497,10 @@ of_register_spi_device(struct spi_contro if (rc) goto err_out; diff --git a/target/linux/mediatek/patches-6.6/901-arm-add-cmdline-override.patch b/target/linux/mediatek/patches-6.6/901-arm-add-cmdline-override.patch index 4f4fb9f23e42b6..7b7c905a0f3b60 100644 --- a/target/linux/mediatek/patches-6.6/901-arm-add-cmdline-override.patch +++ b/target/linux/mediatek/patches-6.6/901-arm-add-cmdline-override.patch @@ -17,7 +17,7 @@ default "" --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c -@@ -1189,6 +1189,17 @@ int __init early_init_dt_scan_chosen(cha +@@ -1190,6 +1190,17 @@ int __init early_init_dt_scan_chosen(cha if (p != NULL && l > 0) strlcat(cmdline, p, min_t(int, strlen(cmdline) + (int)l, COMMAND_LINE_SIZE)); diff --git a/target/linux/mpc85xx/patches-6.6/102-powerpc-add-cmdline-override.patch b/target/linux/mpc85xx/patches-6.6/102-powerpc-add-cmdline-override.patch index 1aa7c3dbd340ef..34bb95e4c01e69 100644 --- a/target/linux/mpc85xx/patches-6.6/102-powerpc-add-cmdline-override.patch +++ b/target/linux/mpc85xx/patches-6.6/102-powerpc-add-cmdline-override.patch @@ -17,7 +17,7 @@ help --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c -@@ -1189,6 +1189,17 @@ int __init early_init_dt_scan_chosen(cha +@@ -1190,6 +1190,17 @@ int __init early_init_dt_scan_chosen(cha if (p != NULL && l > 0) strlcat(cmdline, p, min_t(int, strlen(cmdline) + (int)l, COMMAND_LINE_SIZE)); diff --git a/target/linux/ramips/patches-6.6/001-v6.13-clocksource-drivers-ralink-Add-Ralink-System-Tick-Co.patch b/target/linux/ramips/patches-6.6/001-v6.13-clocksource-drivers-ralink-Add-Ralink-System-Tick-Co.patch index cd2a90826c767d..de3438427d787c 100644 --- a/target/linux/ramips/patches-6.6/001-v6.13-clocksource-drivers-ralink-Add-Ralink-System-Tick-Co.patch +++ b/target/linux/ramips/patches-6.6/001-v6.13-clocksource-drivers-ralink-Add-Ralink-System-Tick-Co.patch @@ -208,7 +208,7 @@ Signed-off-by: Daniel Lezcano -TIMER_OF_DECLARE(systick, "ralink,cevt-systick", ralink_systick_init); --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig -@@ -732,4 +732,13 @@ config GOLDFISH_TIMER +@@ -733,4 +733,13 @@ config GOLDFISH_TIMER help Support for the timer/counter of goldfish-rtc diff --git a/target/linux/ramips/patches-6.6/002-01-v6.13-clk-ralink-mtmips-fix-clock-plan-for-Ralink-SoC-RT38.patch b/target/linux/ramips/patches-6.6/002-01-v6.13-clk-ralink-mtmips-fix-clock-plan-for-Ralink-SoC-RT38.patch deleted file mode 100644 index 422b6dcfb07799..00000000000000 --- a/target/linux/ramips/patches-6.6/002-01-v6.13-clk-ralink-mtmips-fix-clock-plan-for-Ralink-SoC-RT38.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 33239152305567b3e9bf052f71fd4baecd626341 Mon Sep 17 00:00:00 2001 -From: Sergio Paracuellos -Date: Tue, 10 Sep 2024 06:40:22 +0200 -Subject: [PATCH 1/3] clk: ralink: mtmips: fix clock plan for Ralink SoC RT3883 - -Clock plan for Ralink SoC RT3883 needs an extra 'periph' clock to properly -set some peripherals that has this clock as their parent. When this driver -was mainlined we could not find any active users of this SoC so we cannot -perform any real tests for it. Now, one user of a Belkin f9k1109 version 1 -device which uses this SoC appear and reported some issues in openWRT: -- https://github.com/openwrt/openwrt/issues/16054 -The peripherals that are wrong are 'uart', 'i2c', 'i2s' and 'uartlite' which -has a not defined 'periph' clock as parent. Hence, introduce it to have a -properly working clock plan for this SoC. - -Fixes: 6f3b15586eef ("clk: ralink: add clock and reset driver for MTMIPS SoCs") -Signed-off-by: Sergio Paracuellos -Link: https://lore.kernel.org/r/20240910044024.120009-2-sergio.paracuellos@gmail.com -Signed-off-by: Stephen Boyd ---- - drivers/clk/ralink/clk-mtmips.c | 9 +++++++-- - 1 file changed, 7 insertions(+), 2 deletions(-) - ---- a/drivers/clk/ralink/clk-mtmips.c -+++ b/drivers/clk/ralink/clk-mtmips.c -@@ -267,6 +267,11 @@ static struct mtmips_clk_fixed rt305x_fi - CLK_FIXED("xtal", NULL, 40000000) - }; - -+static struct mtmips_clk_fixed rt3883_fixed_clocks[] = { -+ CLK_FIXED("xtal", NULL, 40000000), -+ CLK_FIXED("periph", "xtal", 40000000) -+}; -+ - static struct mtmips_clk_fixed rt3352_fixed_clocks[] = { - CLK_FIXED("periph", "xtal", 40000000) - }; -@@ -779,8 +784,8 @@ static const struct mtmips_clk_data rt33 - static const struct mtmips_clk_data rt3883_clk_data = { - .clk_base = rt3883_clks_base, - .num_clk_base = ARRAY_SIZE(rt3883_clks_base), -- .clk_fixed = rt305x_fixed_clocks, -- .num_clk_fixed = ARRAY_SIZE(rt305x_fixed_clocks), -+ .clk_fixed = rt3883_fixed_clocks, -+ .num_clk_fixed = ARRAY_SIZE(rt3883_fixed_clocks), - .clk_factor = NULL, - .num_clk_factor = 0, - .clk_periph = rt5350_pherip_clks, diff --git a/target/linux/ramips/patches-6.6/002-02-v6.13-clk-ralink-mtmips-fix-clocks-probe-order-in-oldest-r.patch b/target/linux/ramips/patches-6.6/002-02-v6.13-clk-ralink-mtmips-fix-clocks-probe-order-in-oldest-r.patch deleted file mode 100644 index 3268a18dac704f..00000000000000 --- a/target/linux/ramips/patches-6.6/002-02-v6.13-clk-ralink-mtmips-fix-clocks-probe-order-in-oldest-r.patch +++ /dev/null @@ -1,124 +0,0 @@ -From d34db686a3d74bd564bfce2ada15011c556269fc Mon Sep 17 00:00:00 2001 -From: Sergio Paracuellos -Date: Tue, 10 Sep 2024 06:40:23 +0200 -Subject: [PATCH 2/3] clk: ralink: mtmips: fix clocks probe order in oldest - ralink SoCs - -Base clocks are the first in being probed and are real dependencies of the -rest of fixed, factor and peripheral clocks. For old ralink SoCs RT2880, -RT305x and RT3883 'xtal' must be defined first since in any other case, -when fixed clocks are probed they are delayed until 'xtal' is probed so the -following warning appears: - - WARNING: CPU: 0 PID: 0 at drivers/clk/ralink/clk-mtmips.c:499 rt3883_bus_recalc_rate+0x98/0x138 - Modules linked in: - CPU: 0 PID: 0 Comm: swapper Not tainted 6.6.43 #0 - Stack : 805e58d0 00000000 00000004 8004f950 00000000 00000004 00000000 00000000 - 80669c54 80830000 80700000 805ae570 80670068 00000001 80669bf8 00000000 - 00000000 00000000 805ae570 80669b38 00000020 804db7dc 00000000 00000000 - 203a6d6d 80669b78 80669e48 70617773 00000000 805ae570 00000000 00000009 - 00000000 00000001 00000004 00000001 00000000 00000000 83fe43b0 00000000 - ... - Call Trace: - [<800065d0>] show_stack+0x64/0xf4 - [<804bca14>] dump_stack_lvl+0x38/0x60 - [<800218ac>] __warn+0x94/0xe4 - [<8002195c>] warn_slowpath_fmt+0x60/0x94 - [<80259ff8>] rt3883_bus_recalc_rate+0x98/0x138 - [<80254530>] __clk_register+0x568/0x688 - [<80254838>] of_clk_hw_register+0x18/0x2c - [<8070b910>] rt2880_clk_of_clk_init_driver+0x18c/0x594 - [<8070b628>] of_clk_init+0x1c0/0x23c - [<806fc448>] plat_time_init+0x58/0x18c - [<806fdaf0>] time_init+0x10/0x6c - [<806f9bc4>] start_kernel+0x458/0x67c - - ---[ end trace 0000000000000000 ]--- - -When this driver was mainlined we could not find any active users of old -ralink SoCs so we cannot perform any real tests for them. Now, one user -of a Belkin f9k1109 version 1 device which uses RT3883 SoC appeared and -reported some issues in openWRT: -- https://github.com/openwrt/openwrt/issues/16054 - -Thus, define a 'rt2880_xtal_recalc_rate()' just returning the expected -frequency 40Mhz and use it along the old ralink SoCs to have a correct -boot trace with no warnings and a working clock plan from the beggining. - -Fixes: 6f3b15586eef ("clk: ralink: add clock and reset driver for MTMIPS SoCs") -Signed-off-by: Sergio Paracuellos -Link: https://lore.kernel.org/r/20240910044024.120009-3-sergio.paracuellos@gmail.com -Signed-off-by: Stephen Boyd ---- - drivers/clk/ralink/clk-mtmips.c | 21 +++++++++++++-------- - 1 file changed, 13 insertions(+), 8 deletions(-) - ---- a/drivers/clk/ralink/clk-mtmips.c -+++ b/drivers/clk/ralink/clk-mtmips.c -@@ -263,10 +263,6 @@ err_clk_unreg: - .rate = _rate \ - } - --static struct mtmips_clk_fixed rt305x_fixed_clocks[] = { -- CLK_FIXED("xtal", NULL, 40000000) --}; -- - static struct mtmips_clk_fixed rt3883_fixed_clocks[] = { - CLK_FIXED("xtal", NULL, 40000000), - CLK_FIXED("periph", "xtal", 40000000) -@@ -371,6 +367,12 @@ static inline struct mtmips_clk *to_mtmi - return container_of(hw, struct mtmips_clk, hw); - } - -+static unsigned long rt2880_xtal_recalc_rate(struct clk_hw *hw, -+ unsigned long parent_rate) -+{ -+ return 40000000; -+} -+ - static unsigned long rt5350_xtal_recalc_rate(struct clk_hw *hw, - unsigned long parent_rate) - { -@@ -682,10 +684,12 @@ static unsigned long mt76x8_cpu_recalc_r - } - - static struct mtmips_clk rt2880_clks_base[] = { -+ { CLK_BASE("xtal", NULL, rt2880_xtal_recalc_rate) }, - { CLK_BASE("cpu", "xtal", rt2880_cpu_recalc_rate) } - }; - - static struct mtmips_clk rt305x_clks_base[] = { -+ { CLK_BASE("xtal", NULL, rt2880_xtal_recalc_rate) }, - { CLK_BASE("cpu", "xtal", rt305x_cpu_recalc_rate) } - }; - -@@ -695,6 +699,7 @@ static struct mtmips_clk rt3352_clks_bas - }; - - static struct mtmips_clk rt3883_clks_base[] = { -+ { CLK_BASE("xtal", NULL, rt2880_xtal_recalc_rate) }, - { CLK_BASE("cpu", "xtal", rt3883_cpu_recalc_rate) }, - { CLK_BASE("bus", "cpu", rt3883_bus_recalc_rate) } - }; -@@ -751,8 +756,8 @@ err_clk_unreg: - static const struct mtmips_clk_data rt2880_clk_data = { - .clk_base = rt2880_clks_base, - .num_clk_base = ARRAY_SIZE(rt2880_clks_base), -- .clk_fixed = rt305x_fixed_clocks, -- .num_clk_fixed = ARRAY_SIZE(rt305x_fixed_clocks), -+ .clk_fixed = NULL, -+ .num_clk_fixed = 0, - .clk_factor = rt2880_factor_clocks, - .num_clk_factor = ARRAY_SIZE(rt2880_factor_clocks), - .clk_periph = rt2880_pherip_clks, -@@ -762,8 +767,8 @@ static const struct mtmips_clk_data rt28 - static const struct mtmips_clk_data rt305x_clk_data = { - .clk_base = rt305x_clks_base, - .num_clk_base = ARRAY_SIZE(rt305x_clks_base), -- .clk_fixed = rt305x_fixed_clocks, -- .num_clk_fixed = ARRAY_SIZE(rt305x_fixed_clocks), -+ .clk_fixed = NULL, -+ .num_clk_fixed = 0, - .clk_factor = rt305x_factor_clocks, - .num_clk_factor = ARRAY_SIZE(rt305x_factor_clocks), - .clk_periph = rt305x_pherip_clks, diff --git a/target/linux/ramips/patches-6.6/311-MIPS-use-set_mode-to-enable-disable-the-cevt-r4k-irq.patch b/target/linux/ramips/patches-6.6/311-MIPS-use-set_mode-to-enable-disable-the-cevt-r4k-irq.patch index d59a71af88b0a9..3162d669e1dd49 100644 --- a/target/linux/ramips/patches-6.6/311-MIPS-use-set_mode-to-enable-disable-the-cevt-r4k-irq.patch +++ b/target/linux/ramips/patches-6.6/311-MIPS-use-set_mode-to-enable-disable-the-cevt-r4k-irq.patch @@ -96,7 +96,7 @@ Signed-off-by: John Crispin } --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig -@@ -731,10 +731,15 @@ config GOLDFISH_TIMER +@@ -732,10 +732,15 @@ config GOLDFISH_TIMER depends on RTC_DRV_GOLDFISH help Support for the timer/counter of goldfish-rtc diff --git a/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch b/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch index 71adf6600f61ce..efc2763880f04e 100644 --- a/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch +++ b/target/linux/ramips/patches-6.6/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 -@@ -3183,6 +3183,18 @@ static const struct usb_device_id uvc_id +@@ -3229,6 +3229,18 @@ static const struct usb_device_id uvc_id .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) }, diff --git a/target/linux/starfive/patches-6.6/0003-clocksource-Add-JH7110-timer-driver.patch b/target/linux/starfive/patches-6.6/0003-clocksource-Add-JH7110-timer-driver.patch index 68b9c38d5bb250..b4398ef146858f 100644 --- a/target/linux/starfive/patches-6.6/0003-clocksource-Add-JH7110-timer-driver.patch +++ b/target/linux/starfive/patches-6.6/0003-clocksource-Add-JH7110-timer-driver.patch @@ -15,7 +15,7 @@ Signed-off-by: Xingyu Wu --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig -@@ -641,6 +641,17 @@ config RISCV_TIMER +@@ -642,6 +642,17 @@ config RISCV_TIMER is accessed via both the SBI and the rdcycle instruction. This is required for all RISC-V systems. diff --git a/target/linux/starfive/patches-6.6/0033-PCI-Add-PCIE_RESET_CONFIG_DEVICE_WAIT_MS-waiting-tim.patch b/target/linux/starfive/patches-6.6/0033-PCI-Add-PCIE_RESET_CONFIG_DEVICE_WAIT_MS-waiting-tim.patch index cc50dfe68e81c9..ff089604681845 100644 --- a/target/linux/starfive/patches-6.6/0033-PCI-Add-PCIE_RESET_CONFIG_DEVICE_WAIT_MS-waiting-tim.patch +++ b/target/linux/starfive/patches-6.6/0033-PCI-Add-PCIE_RESET_CONFIG_DEVICE_WAIT_MS-waiting-tim.patch @@ -30,7 +30,7 @@ Acked-by: Bjorn Helgaas --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h -@@ -19,6 +19,22 @@ +@@ -22,6 +22,22 @@ */ #define PCIE_PME_TO_L2_TIMEOUT_US 10000 diff --git a/target/linux/starfive/patches-6.6/0072-drivers-nvme-Add-precheck-and-delay-for-CQE-pending-.patch b/target/linux/starfive/patches-6.6/0072-drivers-nvme-Add-precheck-and-delay-for-CQE-pending-.patch index d602df9e4c3c10..7b768a9bc5a09f 100644 --- a/target/linux/starfive/patches-6.6/0072-drivers-nvme-Add-precheck-and-delay-for-CQE-pending-.patch +++ b/target/linux/starfive/patches-6.6/0072-drivers-nvme-Add-precheck-and-delay-for-CQE-pending-.patch @@ -22,7 +22,7 @@ Signed-off-by: Kevin.xie #include "trace.h" #include "nvme.h" -@@ -1062,6 +1063,15 @@ static inline int nvme_poll_cq(struct nv +@@ -1058,6 +1059,15 @@ static inline int nvme_poll_cq(struct nv { int found = 0; diff --git a/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch b/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch index 44c6fe6126802f..febc6bac4e8500 100644 --- a/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch +++ b/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch @@ -160,7 +160,7 @@ Signed-off-by: minda.chen } --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c -@@ -3664,7 +3664,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3672,7 +3672,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd * full_len = urb->transfer_buffer_length; /* If we have scatter/gather list, we use it. */ From efcb0ec7138714c76f95a49f42409b89367632c5 Mon Sep 17 00:00:00 2001 From: John Audia Date: Thu, 12 Dec 2024 08:19:59 -0500 Subject: [PATCH 196/877] kernel: bump 6.6 to 6.6.65 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.65 Update to checksum only/no patches required a rebase. Per the changelog, this is a trivial upstream bump with only 4 commits, 2 of which being reverts. Build system: x86/64 Build-tested: x86/64/AMD Cezanne Run-tested: x86/64/AMD Cezanne Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/17217 Signed-off-by: Robert Marko Signed-off-by: Hauke Mehrtens (cherry picked from commit 15e173bf7e873d004d6c665ee81d54a10ce1f868) --- include/kernel-6.6 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/kernel-6.6 b/include/kernel-6.6 index ddbef67f942d28..875c715ba4b6f4 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .64 -LINUX_KERNEL_HASH-6.6.64 = 065fd93fa6cb422f650fb563f15d3e0107c85009f766405993d795fd39796ab1 +LINUX_VERSION-6.6 = .65 +LINUX_KERNEL_HASH-6.6.65 = 7ae1476e8b4c86e7754e581d45d6fbce5932bfefce934758a2907d6d79eca3e0 From 28bde50c1d5236ad890ef2fe3a0e89f731ee4421 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20B=C3=B6hler?= Date: Sun, 24 Nov 2024 19:49:20 +0100 Subject: [PATCH 197/877] ath79: add support for KuWFi N650 CPE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The KuWFi N650 is a 5GHz outdoor wireless bridge based on QCA9563. Specs ===== CPU: QCA9563, 775MHz RAM: 128MiB Flash: 16MiB Wireless: QCA9888 (5GHz only) Ethernet: 2x GBit (via QCA8337), 48V passive PoE Installation ============ From OEM firmware ----------------- The OEM firmware has telnet enabled by default. If not, it can be enabled from the firmware web interface. You need a TFTP server on your computer and the OpenWrt factory image should be available as "n650factory.bin". It is assumed that your computer has the IP 192.168.1.1 and the N650 192.168.1.20 (default IP address). 1. Connect via Telnet to the device and log in with the default credentials "admin:admin" 2. Exploit the limited interface by typing "ps & /bin/sh" 3. Press to start the shell 4. Enter the following commands: $ cd /tmp $ tftp -r n650factory.bin -g 192.168.1.1 $ cat << EOF > /tmp/openwrt.sh IMAGE_NAME="\$1" if [ ! -e \${IMAGE_NAME} ]; then echo "Image file not found: \${IMAGE_NAME}" exit 1 fi . /usr/sbin/common.sh kill_remaining TERM sleep 3 kill_remaining KILL run_ramfs mtd write \${IMAGE_NAME} firmware sleep 2 reboot -f EOF $ chmod +x /tmp/openwrt.sh $ /tmp/openwrt.sh n650factory.bin Once the device reboots, it should load OpenWrt. From UART --------- UART installation is possible since the serial header is already soldered on. The pinout is GND - Tx - Rx - VCC from top to bottom (RJ45 ports are at the bottom). Connect with 115200 8N1. First, boot OpenWrt from TFTP. Enter the following commands in the U-Boot shell, assuming your computer has the IP address 192.168.1.1 and a TFTP server running where the initramfs image is provided as n650.bin: setenv ipaddr 192.168.1.20 setenv serverip 192.168.1.1 tftpboot 0x84000000 n650.bin bootm Once booted, transfer -loader.bin and -sysupgrade.bin images to the device at /tmp. Enter the following commands, replacing the filenames: mtd write /tmp/loader.bin loader sysupgrade /tmp/sysupgrade.bin Reboot and OpenWrt should load from flash. Back to Stock ------------- Back to stock is only possible if you saved a partition backup before installing OpenWrt. Assuming you have fullbackup.bin covering the whole flash, you need to prepare the image as follows: $ dd if=fullbackup.bin of=fwconcat0.bin bs=65536 skip=4 count=212 $ dd if=fullbackup.bin of=loader.bin bs=65536 skip=216 count=1 $ dd if=fullbackup.bin of=fwconcat1.bin bs=65536 skip=217 count=22 $ cat fwconcat0.bin fwconcat1.bin > firmware.bin Transfer firmware.bin and loader.bin to the OpenWrt device. First, flash loader.bin to mtd device loader, then force sysupgrade: $ mtd write loader.bin loader $ sysupgrade -F firmware.bin The reason for the two-step process is the way the flash layout is designed for OpenWrt in contrast to the OEM firmware partition. Signed-off-by: Andreas Böhler Link: https://github.com/openwrt/openwrt/pull/17089 Link: https://github.com/openwrt/openwrt/pull/17247 Signed-off-by: Hauke Mehrtens (cherry picked from commit dde510cf979e896a622b7ed738009910a27de94e) --- target/linux/ath79/dts/qca9563_kuwfi_n650.dts | 178 ++++++++++++++++++ .../generic/base-files/etc/board.d/02_network | 4 + target/linux/ath79/image/generic.mk | 19 ++ 3 files changed, 201 insertions(+) create mode 100644 target/linux/ath79/dts/qca9563_kuwfi_n650.dts diff --git a/target/linux/ath79/dts/qca9563_kuwfi_n650.dts b/target/linux/ath79/dts/qca9563_kuwfi_n650.dts new file mode 100644 index 00000000000000..03801dabb3ed6c --- /dev/null +++ b/target/linux/ath79/dts/qca9563_kuwfi_n650.dts @@ -0,0 +1,178 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca956x.dtsi" + +#include +#include +#include +#include + +/ { + model = "KuWFi N650"; + compatible = "kuwfi,n650", "qca,qca9563"; + + aliases { + label-mac-device = ð0; + led-boot = &led_green; + led-running = &led_green; + led-failsafe = &led_blue; + led-upgrade = &led_blue; + }; + + virtual_flash { + compatible = "mtd-concat"; + devices = <&fwconcat0 &fwconcat1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + reg = <0x0 0x0>; + label = "firmware"; + compatible = "openwrt,uimage", "denx,uimage"; + openwrt,ih-magic = ; + }; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "Reset button"; + linux,code = ; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_blue: blue { + function = LED_FUNCTION_DEBUG; + color = ; + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; + }; + + led_green: green { + function = LED_FUNCTION_POWER; + color = ; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&spi { + 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@0 { + label = "u-boot"; + reg = <0x000000 0x030000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x030000 0x010000>; + }; + + fwconcat0: partition@40000 { + label = "fwconcat0"; + reg = <0x040000 0xd40000>; + }; + + partition@d80000 { + label = "loader"; + reg = <0xd80000 0x10000>; + }; + + fwconcat1: partition@d90000 { + label = "fwconcat1"; + reg = <0xd90000 0x160000>; + }; + + partition@ef0000 { + label = "log"; + reg = <0xef0000 0x0f0000>; + read-only; + }; + + partition@fe0000 { + label = "nvram"; + reg = <0xfe0000 0x010000>; + read-only; + }; + + partition@ff0000 { + label = "art"; + reg = <0xff0000 0x10000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_art_0: macaddr@0 { + compatible = "mac-base"; + reg = <0x0 0x6>; + #nvmem-cell-cells = <1>; + }; + + precal_art_5000: pre-calibration@5000 { + reg = <0x5000 0x2f20>; + }; + }; + }; + }; + }; +}; + +&mdio0 { + status = "okay"; + + phy0: ethernet-phy@0 { + reg = <0>; + phy-mode = "sgmii"; + reset-gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + qca,mib-poll-interval = <500>; + + qca,ar8327-initvals = < + 0x04 0x00080080 /* PORT0 PAD MODE CTRL */ + 0x7c 0x0000007e /* PORT0_STATUS */ + >; + }; +}; + +ð0 { + status = "okay"; + + nvmem-cells = <&macaddr_art_0 0>; + nvmem-cell-names = "mac-address"; + phy-handle = <&phy0>; + phy-mode = "sgmii"; +}; + +&pcie { + status = "okay"; + + wifi@0,0 { + compatible = "pci168c,0056"; + reg = <0x0000 0 0 0 0>; + nvmem-cells = <&precal_art_5000>, <&macaddr_art_0 1>; + nvmem-cell-names = "pre-calibration", "mac-address"; + }; +}; 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 016bd6bb51b5f5..e987d754f0ac42 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 @@ -401,6 +401,10 @@ ath79_setup_interfaces() ucidef_add_switch "switch0" \ "0@eth0" "1:lan:2" "4:lan:1" ;; + kuwfi,n650) + ucidef_add_switch "switch0" \ + "0@eth0" "2:lan:1" "3:lan:2" + ;; letv,lba-047-ch) ucidef_set_interface_wan "eth0" ucidef_add_switch "switch0" \ diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 0173f5cb16180d..92f9bc6cddef5a 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -1963,6 +1963,25 @@ define Device/kuwfi_c910 endef TARGET_DEVICES += kuwfi_c910 +define Device/kuwfi_n650 + $(Device/loader-okli-uimage) + SOC := qca9563 + DEVICE_VENDOR := KuWFi + DEVICE_MODEL := N650 + DEVICE_PACKAGES += kmod-ath10k-ct ath10k-firmware-qca9888-ct + FACTORY_SIZE := 13632k + LOADER_FLASH_OFFS := 0x40000 + KERNEL := kernel-bin | append-dtb | lzma | uImage lzma -M 0x4f4b4c49 + IMAGE_SIZE := 15040k + IMAGES += factory.bin + IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \ + append-rootfs | pad-rootfs | check-size | pad-to 13568k | \ + append-loader-okli-uimage $(1) | pad-to 64k | check-size $$$$(FACTORY_SIZE) + ARTIFACTS := loader.bin + ARTIFACT/loader.bin := append-loader-okli-uimage $(1) | pad-to 64k +endef +TARGET_DEVICES += kuwfi_n650 + define Device/letv_lba-047-ch $(Device/loader-okli-uimage) SOC := qca9531 From 28602452df37f21033e2eabc83cfd6a659d8a4d9 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Thu, 12 Dec 2024 22:40:08 +0800 Subject: [PATCH 198/877] ath79: fix ath9k calibration data size for AR9132 For ath9k NICs older than AR9287, The eeprom size is 0xeb8. Fixes: https://github.com/openwrt/openwrt/issues/17196 Fixes: 74f2df9dbccd ("ath79: mtd-cal-data removals") Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17261 Signed-off-by: Hauke Mehrtens (cherry picked from commit 96eb12e961748373a38738de92f5ef1a87f0cc75) --- target/linux/ath79/dts/ar9132_buffalo_wzr-hp-g300nh.dtsi | 2 +- target/linux/ath79/dts/ar9132_tplink_tl-wa901nd-v2.dts | 2 +- target/linux/ath79/dts/ar9132_tplink_tl-wr1043nd-v1.dts | 2 +- target/linux/ath79/dts/ar9132_tplink_tl-wr941-v2.dts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/target/linux/ath79/dts/ar9132_buffalo_wzr-hp-g300nh.dtsi b/target/linux/ath79/dts/ar9132_buffalo_wzr-hp-g300nh.dtsi index a82546c1c1395e..474d0fa80f74cd 100644 --- a/target/linux/ath79/dts/ar9132_buffalo_wzr-hp-g300nh.dtsi +++ b/target/linux/ath79/dts/ar9132_buffalo_wzr-hp-g300nh.dtsi @@ -145,7 +145,7 @@ #size-cells = <1>; cal_art_11000: calibration@11000 { - reg = <0x11000 0x440>; + reg = <0x11000 0xeb8>; }; macaddr_art_1120c: macaddr@1120c { diff --git a/target/linux/ath79/dts/ar9132_tplink_tl-wa901nd-v2.dts b/target/linux/ath79/dts/ar9132_tplink_tl-wa901nd-v2.dts index ed4ca5297e7f5c..3fcc4073fea630 100644 --- a/target/linux/ath79/dts/ar9132_tplink_tl-wa901nd-v2.dts +++ b/target/linux/ath79/dts/ar9132_tplink_tl-wa901nd-v2.dts @@ -104,7 +104,7 @@ #size-cells = <1>; cal_art_1000: calibration@1000 { - reg = <0x1000 0x440>; + reg = <0x1000 0xeb8>; }; }; }; diff --git a/target/linux/ath79/dts/ar9132_tplink_tl-wr1043nd-v1.dts b/target/linux/ath79/dts/ar9132_tplink_tl-wr1043nd-v1.dts index 8958ddd3a83b3f..847d4d4c47def9 100644 --- a/target/linux/ath79/dts/ar9132_tplink_tl-wr1043nd-v1.dts +++ b/target/linux/ath79/dts/ar9132_tplink_tl-wr1043nd-v1.dts @@ -131,7 +131,7 @@ #size-cells = <1>; cal_art_1000: calibration@1000 { - reg = <0x1000 0x440>; + reg = <0x1000 0xeb8>; }; }; }; diff --git a/target/linux/ath79/dts/ar9132_tplink_tl-wr941-v2.dts b/target/linux/ath79/dts/ar9132_tplink_tl-wr941-v2.dts index d3f189479a8b8e..3ad058e9597350 100644 --- a/target/linux/ath79/dts/ar9132_tplink_tl-wr941-v2.dts +++ b/target/linux/ath79/dts/ar9132_tplink_tl-wr941-v2.dts @@ -153,7 +153,7 @@ #size-cells = <1>; cal_art_1000: calibration@1000 { - reg = <0x1000 0x440>; + reg = <0x1000 0xeb8>; }; }; }; From 6d0d4ce72f0e00a21a2a2430211015eb623cfbfe Mon Sep 17 00:00:00 2001 From: John Audia Date: Sun, 15 Dec 2024 09:30:52 -0500 Subject: [PATCH 199/877] kernel: generic: tg3: Fix DMA allocations on 57766 devices At the request of rsalvaterra, add this patch to fix an issue affecting tg3 ethernet interfaces[1]. 1. https://github.com/openwrt/openwrt/pull/17271#issuecomment-2543836518 Tested-by: Rui Salvaterra Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/17282 Signed-off-by: Hauke Mehrtens (cherry picked from commit a3c484c3b9468a7bd9190b0fee027bb133cee3d5) --- ...Fix-DMA-allocations-on-57766-devices.patch | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 target/linux/generic/pending-6.6/791-tg3-Fix-DMA-allocations-on-57766-devices.patch diff --git a/target/linux/generic/pending-6.6/791-tg3-Fix-DMA-allocations-on-57766-devices.patch b/target/linux/generic/pending-6.6/791-tg3-Fix-DMA-allocations-on-57766-devices.patch new file mode 100644 index 00000000000000..a90d77c9f0440a --- /dev/null +++ b/target/linux/generic/pending-6.6/791-tg3-Fix-DMA-allocations-on-57766-devices.patch @@ -0,0 +1,31 @@ +From f992b15965177e2f280fb6f41f292214f9a6f8d5 Mon Sep 17 00:00:00 2001 +From: Pavan Chebbi +Date: Tue, 10 Dec 2024 03:28:31 -0800 +Subject: [PATCH] tg3: Fix DMA allocations on 57766 devices + +The coherent DMA mask of 31b may not be accepted if +the DMA mask is configured to use higher memories of +64b. Set the DMA mask also to lower 32b for 57766 +devices. + +Fixes: 614f4d166eee ("tg3: Set coherent DMA mask bits to 31 for BCM57766 chipsets") +Reported-By: Rui Salvaterra +Signed-off-by: Pavan Chebbi +--- + drivers/net/ethernet/broadcom/tg3.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/net/ethernet/broadcom/tg3.c ++++ b/drivers/net/ethernet/broadcom/tg3.c +@@ -17731,8 +17731,10 @@ static int tg3_init_one(struct pci_dev * + } else + persist_dma_mask = dma_mask = DMA_BIT_MASK(64); + +- if (tg3_asic_rev(tp) == ASIC_REV_57766) ++ if (tg3_asic_rev(tp) == ASIC_REV_57766) { ++ dma_mask = DMA_BIT_MASK(32); + persist_dma_mask = DMA_BIT_MASK(31); ++ } + + /* Configure DMA attributes. */ + if (dma_mask > DMA_BIT_MASK(32)) { From 6435025f9caddc2ee756d316dab7b1e9a4c3a940 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sat, 14 Dec 2024 14:26:25 -0800 Subject: [PATCH 200/877] ath79: fix tl-wa eth1 mac This is using mac-base and so a 0 needs to be added. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/17274 Signed-off-by: Robert Marko (cherry picked from commit 0634ebed9f74dca6d008b00f9fa00cc1220fa425) --- target/linux/ath79/dts/ar7240_tplink_tl-wa.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ath79/dts/ar7240_tplink_tl-wa.dtsi b/target/linux/ath79/dts/ar7240_tplink_tl-wa.dtsi index 1f46e77423cd24..94d2570c6c1e54 100644 --- a/target/linux/ath79/dts/ar7240_tplink_tl-wa.dtsi +++ b/target/linux/ath79/dts/ar7240_tplink_tl-wa.dtsi @@ -17,7 +17,7 @@ }; ð1 { - nvmem-cells = <&macaddr_uboot_1fc00>; + nvmem-cells = <&macaddr_uboot_1fc00 0>; nvmem-cell-names = "mac-address"; }; From 25268f724baafed4c36c726a4e1923118227eabf Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 16 Dec 2024 13:03:26 +0100 Subject: [PATCH 201/877] unetd: update to Git HEAD (2024-12-16) d22d7db581d5 bpf_skb_utils.h: add missing include to fix build against newer kernel headers bbd3e0eb1419 host: fix peer routes on a node acting as gateway b17164751fc7 unet-tool: add support for generating keys from salt + seed passphrase 041e05870c20 unet-tool: add support for dumping pubkey from signed file b58920d420cb unet-tool: add support for extracting network data from signed bin file f335f5b40b4e unet-cli: add support for generating key from seed 8b1f1d099352 unet-cli: add support for importing networks from signed data 188ba05eadf2 unet-cli: add missing command line help for import 8f15fc306a40 unet-cli: fix add-ssh-host with seed keys 486bc3b86dc2 pex-msg: enable broadcast for global PEX socket e4a24cdfbc1c unet-cli: fix defaults on create Signed-off-by: Felix Fietkau (cherry picked from commit af1740a28b63ecc6683dceb249a1f75af5e9098d) --- 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 018f6b8ea9707e..7b0bd3c6e7bf29 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:=2024-03-31 -PKG_SOURCE_VERSION:=806457664ab6e952a7f4febb82e891f596fe577c -PKG_MIRROR_HASH:=f469d65fd83721a8da0e5253d1ba871a6734233da6f23b631009b17b3af82455 +PKG_SOURCE_DATE:=2024-12-16 +PKG_SOURCE_VERSION:=e4a24cdfbc1cbdb38f1958440f2a06529df1c7f4 +PKG_MIRROR_HASH:=1959170b25be07b06c198bfd1e072b7ed19b930faad0e886acb6b0d719d25ed1 PKG_LICENSE:=GPL-2.0 PKG_MAINTAINER:=Felix Fietkau From acf52fed43264a145541cc305598ebe48bbd9275 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 17 Dec 2024 14:51:18 +0100 Subject: [PATCH 202/877] unetd: add firewall input rule for global port Ensure that peers can be exchanged over any interface Signed-off-by: Felix Fietkau (cherry picked from commit f8a16524c4a4070d61a32f6203ea5e26cea125d4) --- package/network/services/unetd/files/unetd.init | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/package/network/services/unetd/files/unetd.init b/package/network/services/unetd/files/unetd.init index c1124821ee8fa1..7c980e3d0d541b 100644 --- a/package/network/services/unetd/files/unetd.init +++ b/package/network/services/unetd/files/unetd.init @@ -13,5 +13,20 @@ start_service() { procd_set_param command "$PROG" -h /var/run/unetd/hosts -u /var/run/unetd/socket procd_set_param respawn procd_set_param limits core="unlimited" + + procd_open_data + json_add_array firewall + + json_add_object "" + json_add_string type rule + json_add_string proto udp + json_add_string src "*" + json_add_int dest_port 51819 + json_add_string target ACCEPT + json_close_object + + json_close_array + procd_close_data + procd_close_instance } From a964e96289a944e8dedbc6441db61ea10dd7399e Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 17 Dec 2024 20:01:13 +0100 Subject: [PATCH 203/877] netifd: update to Git HEAD (2024-12-17) 058a099f5bc5 interface: fix memleak and reload issue for the zone attribute ea01ed41f321 interface: remove unnecessary NULL checks before free() Signed-off-by: Felix Fietkau (cherry picked from commit 53e312e19313dd738eabed3a4af5fb42a8f9e8fb) --- package/network/config/netifd/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index 95f1f6f7d11e09..c327f061136ba8 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:=2 +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git -PKG_SOURCE_DATE:=2024-11-27 -PKG_SOURCE_VERSION:=768027c5a7640137857f412f554227abd6160cdd -PKG_MIRROR_HASH:=5f74dc10470c64b42caa2d1fda3b80672293cf39676aa5c0b9f8c89880a15270 +PKG_SOURCE_DATE:=2024-12-17 +PKG_SOURCE_VERSION:=ea01ed41f3212ecbe000422f3c122a01b93fe874 +PKG_MIRROR_HASH:=dbaad26c1f9b15d0caff6ccdf80d85b34d96bda72cbd2b1dc188a04136d96c28 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 From e109caeec4e7c43ed2e36b9cc1a519062b917309 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Wed, 11 Dec 2024 12:32:37 +0100 Subject: [PATCH 204/877] procd: update to latest HEAD e2f05de state: set_stdio: chdir back to / in case of failure 30542c9 inittab: Disable implicit controlling TTY. Signed-off-by: John Crispin (cherry picked from commit 2bcc49aef93f454950d425b8de69d230b52cc63c) --- 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 81e133f55bc482..98c66f9656ee1d 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:=56c5f71da3f68036c63ae59d01992785e74027726da5973297895985cd27c215 -PKG_SOURCE_DATE:=2024-11-13 -PKG_SOURCE_VERSION:=7330fa55c5211eb7b3c675d1c7b8281b69b53553 +PKG_MIRROR_HASH:=2c9eb493618e3a695d329cbf7379a165d4c2366a6e00edc63db3271aa059a294 +PKG_SOURCE_DATE:=2024-12-11 +PKG_SOURCE_VERSION:=e2f05deb93949f447d397e8cd3a341bc8e53cd38 CMAKE_INSTALL:=1 PKG_LICENSE:=GPL-2.0 From 5dca1d6a4183f8386ad29d93206ae4730bb6ed7b Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 17 Dec 2024 21:53:36 +0100 Subject: [PATCH 205/877] procd: update to Git HEAD (2024-12-17) 2e206dbe77ec service: add support for triggers on service/instance data changes 735b48728fca service: remove leftover lines from previous commit 32469644a029 service: allow incremental changes to service properties fd01fb852302 service: fix double free bug when dealing with data Signed-off-by: Felix Fietkau (cherry picked from commit 3d900bd055b5d8f07a879c9c8c4f7783d35dd4ba) --- 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 98c66f9656ee1d..88467c2e5922fd 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:=2c9eb493618e3a695d329cbf7379a165d4c2366a6e00edc63db3271aa059a294 -PKG_SOURCE_DATE:=2024-12-11 -PKG_SOURCE_VERSION:=e2f05deb93949f447d397e8cd3a341bc8e53cd38 +PKG_MIRROR_HASH:=99139ce325d73f5b250d115703540acfac3bcdc8ee202f2d3aacf3083042bc70 +PKG_SOURCE_DATE:=2024-12-17 +PKG_SOURCE_VERSION:=fd01fb852302a2683d09ee1c2193d7c51e2b0ba8 CMAKE_INSTALL:=1 PKG_LICENSE:=GPL-2.0 From f760f742097d5317fa4e9e49b58625ceec9aa1a9 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 17 Dec 2024 21:21:37 +0100 Subject: [PATCH 206/877] procd: do not overwrite service data by default Allows a running servie to manage its own data if untouched by the init script Signed-off-by: Felix Fietkau (cherry picked from commit 8c5826b140b6288b9270d232ecda0d540e380d4e) --- package/base-files/files/etc/rc.common | 4 ---- package/system/procd/files/procd.sh | 8 +++++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/package/base-files/files/etc/rc.common b/package/base-files/files/etc/rc.common index d7473038444cb1..abf72ea3372fe8 100755 --- a/package/base-files/files/etc/rc.common +++ b/package/base-files/files/etc/rc.common @@ -100,10 +100,6 @@ service_triggers() { return 0 } -service_data() { - return 0 -} - service_running() { local instance="${1:-*}" diff --git a/package/system/procd/files/procd.sh b/package/system/procd/files/procd.sh index 5dc8ec42b7a4ef..59e002036d9558 100644 --- a/package/system/procd/files/procd.sh +++ b/package/system/procd/files/procd.sh @@ -101,9 +101,11 @@ _procd_close_service() { _procd_open_trigger service_triggers _procd_close_trigger - _procd_open_data - service_data - _procd_close_data + type service_data >/dev/null 2>&1 && { + _procd_open_data + service_data + _procd_close_data + } _procd_ubus_call ${1:-set} } From 6642ee73bc72cf6052510c3320adaf50edd5a3c8 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 17 Dec 2024 21:54:14 +0100 Subject: [PATCH 207/877] procd: add support for reload triggers on data change This can be useful to reload the firewall when procd firewall data changes Signed-off-by: Felix Fietkau (cherry picked from commit 49d92d3e933c45e3684da2fbf0a198d195635581) --- package/system/procd/files/procd.sh | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/package/system/procd/files/procd.sh b/package/system/procd/files/procd.sh index 59e002036d9558..0f9405a2220007 100644 --- a/package/system/procd/files/procd.sh +++ b/package/system/procd/files/procd.sh @@ -308,6 +308,36 @@ _procd_add_reload_interface_trigger() { _procd_close_trigger } +_procd_add_data_trigger() { + json_add_array + _procd_add_array_data "service.data.update" + + json_add_array + _procd_add_array_data "if" + + json_add_array + _procd_add_array_data "eq" "name" "$1" + shift + json_close_array + + json_add_array + _procd_add_array_data "run_script" "$@" + json_close_array + + json_close_array + _procd_add_timeout + json_close_array +} + +_procd_add_reload_data_trigger() { + local script=$(readlink "$initscript") + local name=$(basename ${script:-$initscript}) + + _procd_open_trigger + _procd_add_data_trigger $1 /etc/init.d/$name reload + _procd_close_trigger +} + _procd_add_config_trigger() { json_add_array _procd_add_array_data "$1" @@ -661,6 +691,7 @@ _procd_wrapper \ procd_add_interface_trigger \ procd_add_mount_trigger \ procd_add_reload_trigger \ + procd_add_reload_data_trigger \ procd_add_reload_interface_trigger \ procd_add_action_mount_trigger \ procd_add_reload_mount_trigger \ From cc69be0c13709674d13424726e4ce95e67dd4dac Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 17 Dec 2024 21:57:44 +0100 Subject: [PATCH 208/877] unetd: update to Git HEAD (2024-12-17) 93461ca4c827 unet-cli: only apply defaults on create 3e5766783d5d unet-tool: add support for confirming password 074d3659ca4a unet-cli: confirm password when creating new seed based key bf3488a3807a unet-cli: add add/set-local-host command 9eb57c528461 unet-cli: add support for setting interface zone a0a2d80f3459 ubus: add firewall rules for network port/pex_port via procd Signed-off-by: Felix Fietkau (cherry picked from commit f077e058fd485ab87f0995351a3ddc0a009e4593) --- 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 7b0bd3c6e7bf29..c3875219985848 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:=2024-12-16 -PKG_SOURCE_VERSION:=e4a24cdfbc1cbdb38f1958440f2a06529df1c7f4 -PKG_MIRROR_HASH:=1959170b25be07b06c198bfd1e072b7ed19b930faad0e886acb6b0d719d25ed1 +PKG_SOURCE_DATE:=2024-12-17 +PKG_SOURCE_VERSION:=a0a2d80f3459425182a9f0e665d8ca8eff97c82f +PKG_MIRROR_HASH:=a6f07d91da40152b2af5b5b9d1d67d87a9991943147e47be6921c092ad7b49a3 PKG_LICENSE:=GPL-2.0 PKG_MAINTAINER:=Felix Fietkau From f0ff244c6989dc231d2f66c9ca1b58a3a92d4d6b Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 18 Dec 2024 10:35:21 +0100 Subject: [PATCH 209/877] firewall4: update to Git HEAD (2024-12-18) e00958884416 fw4: do not add physical devices for soft offload dfbcc1cd127c fw4: skip not existing netdev names in flowtable device list 18fc0ead19fa init: use the reload data trigger to reload firewall on procd data changes Fixes: https://github.com/openwrt/openwrt/issues/13410 Signed-off-by: Felix Fietkau (cherry picked from commit 47c75a25cdeed6fda9608d61926799dbd1b1fef3) --- 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 6aacc05e365b45..9b53349275bf2c 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:=2024-05-21 -PKG_SOURCE_VERSION:=4c01d1ebf99e8ecfa69758a9b4f450ecef7b93cd -PKG_MIRROR_HASH:=bbc5622bc03e3b43116fcc86e3fa2d2372bfc07b3a00d2b3a6efac4f7454a403 +PKG_SOURCE_DATE:=2024-12-18 +PKG_SOURCE_VERSION:=18fc0ead19faf06b8ce7ec5be84957278e942dfa +PKG_MIRROR_HASH:=123d1b5d00cdbbfa77813b3eb694d00949171037a0fa26e6d36a75a37066ba48 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC From e40367fa99848b7ca35efd9cd98165558da2aa81 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 19 Dec 2024 06:26:59 +0100 Subject: [PATCH 210/877] hostapd: fix passing radio parameter in wpa_supplicant calls Fixes accessing PHY status in AP+STA configurations Signed-off-by: Felix Fietkau (cherry picked from commit 8943430b9f8046d49842de6b40f9c90fb57fff04) --- package/network/services/hostapd/files/hostapd.uc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/services/hostapd/files/hostapd.uc b/package/network/services/hostapd/files/hostapd.uc index 2d9ce2874901d2..8e70f6b8afe6fe 100644 --- a/package/network/services/hostapd/files/hostapd.uc +++ b/package/network/services/hostapd/files/hostapd.uc @@ -186,7 +186,7 @@ function __iface_pending_next(pending, state, ret, data) pending.call("wpa_supplicant", "phy_status", { phy: phydev.phy, - radio: phydev.radio, + radio: phydev.radio ?? -1, }); return "check_phy"; case "check_phy": @@ -199,7 +199,7 @@ function __iface_pending_next(pending, state, ret, data) } pending.call("wpa_supplicant", "phy_set_state", { phy: phydev.phy, - radio: phydev.radio, + radio: phydev.radio ?? -1, stop: true }); return "wpas_stopped"; @@ -208,7 +208,7 @@ function __iface_pending_next(pending, state, ret, data) hostapd.printf(`hostapd.add_iface failed for phy ${phy} ifname=${bss.ifname}`); pending.call("wpa_supplicant", "phy_set_state", { phy: phydev.phy, - radio: phydev.radio, + radio: phydev.radio ?? -1, stop: false }); return null; From 5a715cdbcdac03f5cdf1c3e89334c37dc8a008a2 Mon Sep 17 00:00:00 2001 From: Florian Maurer Date: Sat, 14 Dec 2024 12:38:28 +0100 Subject: [PATCH 211/877] hostapd: fix call to hostapd reload access to undeclared variable radio In [anonymous function](), file /usr/share/hostap/hostapd.uc, line 830, byte 45: Signed-off-by: Florian Maurer (cherry picked from commit 31e45f62cafbc9361c72d320241e589b31e2b5ed) --- package/network/services/hostapd/files/hostapd.uc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/network/services/hostapd/files/hostapd.uc b/package/network/services/hostapd/files/hostapd.uc index 8e70f6b8afe6fe..30292ce9ae24dc 100644 --- a/package/network/services/hostapd/files/hostapd.uc +++ b/package/network/services/hostapd/files/hostapd.uc @@ -827,7 +827,7 @@ let main_obj = { let phy_list = req.args.phy ? [ phy_name(req.args.phy, req.args.radio) ] : keys(hostapd.data.config); for (let phy_name in phy_list) { let phy = hostapd.data.config[phy_name]; - let config = iface_load_config(phy.phy, radio, phy.orig_file); + let config = iface_load_config(phy.phy, phy.radio_idx, phy.orig_file); iface_set_config(phy_name, config); } From 21549dbf7b1cb97e273d7beeb1955bd4a3f60c76 Mon Sep 17 00:00:00 2001 From: John Audia Date: Sat, 14 Dec 2024 15:02:19 -0500 Subject: [PATCH 212/877] kernel: bump 6.6 to 6.6.66 Update patch set for new release and add required kernel option CONFIG_ZRAM_TRACK_ENTRY_ACTIME to generic config Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.66 Manually rebased: bcm27xx/patches-6.6/950-0092-MMC-added-alternative-MMC-driver.patch bcm53xx/patches-6.6/180-usb-xhci-add-support-for-performing-fake-doorbell.patch starfive/patches-6.6/1000-serial-8250_dw-Add-starfive-jh7100-hsuart-compatible.patch Removed upstreamed: bcm27xx/patches-6.6/950-0029-vc4_hdmi-Avoid-log-spam-for-audio-start-failure.patch[1] All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.66&id=e0388a95736abd1f5f5a94221dd1ac24eacbd4d7 Build system: x86/64 Build-tested: bcm27xx/bcm2712, flogic/glinet_gl-mt6000, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3, x86/64 Run-tested: bcm27xx/bcm2712, flogic/glinet_gl-mt6000, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3, x86/64 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/17271 (cherry picked from commit 28f534d953b1163548610554981763d24fde6d03) Link: https://github.com/openwrt/openwrt/pull/17302 Signed-off-by: Hauke Mehrtens --- include/kernel-6.6 | 4 +- ...eset-controller-support-for-EN7581-S.patch | 2 +- ...e-clock_register-in-hw_init-callback.patch | 2 +- ...clk-en7523-introduce-chip_scu-regmap.patch | 2 +- .../900-unaligned_access_hacks.patch | 4 +- ...oid-log-spam-for-audio-start-failure.patch | 41 ------------------- ...-vc4-Set-AXI-panic-modes-for-the-HVS.patch | 2 +- ...ci-add-quirk-for-host-controllers-th.patch | 2 +- ...Add-cts-event-workaround-DT-property.patch | 2 +- ...092-MMC-added-alternative-MMC-driver.patch | 6 +-- ...all-the-downstream-rpi-sound-card-dr.patch | 2 +- ...hci_fixup_endpoint-for-interval-adju.patch | 2 +- ...ce-quirks-for-Freeway-Airmouse-T3-an.patch | 4 +- ...-Add-a-timing-for-the-Raspberry-Pi-7.patch | 2 +- ...nel-simple-add-Geekworm-MZP280-Panel.patch | 2 +- ...a-introduce-a-customisable-threshold.patch | 2 +- ...mple-Add-Innolux-AT056tN53V1-5.6-VGA.patch | 2 +- ...ci_sync-Add-fallback-bd-address-prop.patch | 4 +- ...-quirks-add-link-TRB-quirk-for-VL805.patch | 6 +-- ...upstream-TRB_FETCH-quirk-on-VL805-ho.patch | 2 +- ...b-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch | 4 +- ...5-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch | 10 ++--- ...wc3-Set-DMA-and-coherent-masks-early.patch | 4 +- ...0-0531-serial-pl011-rp1-uart-support.patch | 4 +- ...vc4-Introduce-generation-number-enum.patch | 2 +- ...-drm-vc4-hvs-Create-hw_init-function.patch | 2 +- ...drm-vc4-hvs-Create-cob_init-function.patch | 6 +-- ...592-drm-vc4-hvs-Rename-hvs_regs-list.patch | 2 +- ...ge-prototype-of-__vc4_hvs_alloc-to-p.patch | 2 +- ...ble-SCALER_CONTROL-early-in-HVS-init.patch | 4 +- ...0610-drm-vc4-hvs-Support-BCM2712-HVS.patch | 16 ++++---- .../950-0757-drm-panel-add-panel-dsi.patch | 4 +- ...-Add-support-for-D0-register-changes.patch | 8 ++-- ...-to-support-D0-alpha-and-csc-changes.patch | 4 +- ...M-pl011-Add-rs485-to-the-RP1-support.patch | 2 +- ...-add-FS-LS-bus-instance-parkmode-dis.patch | 4 +- ...llocate-a-block-for-SD-extension-reg.patch | 4 +- ...ted-write-counts-for-SD-cards-in-CQ-.patch | 2 +- ...th-hci_sync-Fix-crash-on-NULL-parent.patch | 2 +- ...ort-for-per-plane-scaling-filter-sel.patch | 4 +- ...ble-write-caching-on-Samsung-2023-mo.patch | 10 ++--- ...-Also-unregister-pl011_axi_platform_.patch | 2 +- ...equest-for-min-clocks-when-hdmi-outp.patch | 2 +- ...le-cache-on-more-known-bad-Sandisk-c.patch | 2 +- ...MC_QUIRK_BROKEN_ERASE-for-Phison-Int.patch | 2 +- ...erride-of-kernel-s-default-NUMA-poli.patch | 10 ++--- ...support-for-performing-fake-doorbell.patch | 6 +-- ...ansmit-from-devices-with-no-checksum.patch | 2 +- ...169-improve-handling-task-scheduling.patch | 2 +- ...support-for-LED-s-on-RTL8168-RTL8101.patch | 4 +- ...ix-building-with-CONFIG_LEDS_CLASS-m.patch | 2 +- ...-07-v6.9-r8169-simplify-EEE-handling.patch | 4 +- ...-v6.9-r8169-add-support-for-RTL8126A.patch | 4 +- ...ode-by-using-core-provided-pcpu-stat.patch | 4 +- ...-add-LED-support-for-RTL8125-RTL8126.patch | 2 +- ...D-related-deadlock-on-module-removal.patch | 4 +- ...g-conditional-compiling-for-call-to-.patch | 2 +- ...-disable-interrupt-source-RxOverflow.patch | 2 +- ...r8169-add-support-for-RTL8126A-rev.b.patch | 4 +- target/linux/generic/config-6.6 | 1 + .../generic/hack-6.6/259-regmap_dynamic.patch | 2 +- ...-netfilter-add-xt_FLOWOFFLOAD-target.patch | 4 +- .../790-SFP-GE-T-ignore-TX_FAULT.patch | 6 +-- ...vert-driver-core-Set-fw_devlink-on-b.patch | 2 +- .../456-mmc-core-set-card-fwnode_handle.patch | 2 +- ...ow_offload-handle-netdevice-events-f.patch | 6 +-- ...hdog-mediatek-mt7988-add-wdt-support.patch | 4 +- .../810-uvc-add-iPassion-iP2970-support.patch | 2 +- ...sfp-re-probe-modules-on-DEV_UP-event.patch | 2 +- ...14-net-phy-sfp-add-support-for-SMBus.patch | 6 +-- ...c3-add-optional-PHY-interface-clocks.patch | 4 +- ...ove-performance-usb-using-lowmem-for.patch | 8 ++-- ...dd-starfive-jh7100-hsuart-compatible.patch | 8 ++-- 73 files changed, 136 insertions(+), 176 deletions(-) delete mode 100644 target/linux/bcm27xx/patches-6.6/950-0029-vc4_hdmi-Avoid-log-spam-for-audio-start-failure.patch diff --git a/include/kernel-6.6 b/include/kernel-6.6 index 875c715ba4b6f4..1e5dc77de0eb75 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .65 -LINUX_KERNEL_HASH-6.6.65 = 7ae1476e8b4c86e7754e581d45d6fbce5932bfefce934758a2907d6d79eca3e0 +LINUX_VERSION-6.6 = .66 +LINUX_KERNEL_HASH-6.6.66 = 9d757937c4661c2f512c62641b74ef74eff9bb13dc5dbcbaaa108c21152f1e52 diff --git a/target/linux/airoha/patches-6.6/019-01-v6.11-clk-en7523-Add-reset-controller-support-for-EN7581-S.patch b/target/linux/airoha/patches-6.6/019-01-v6.11-clk-en7523-Add-reset-controller-support-for-EN7581-S.patch index f7cc5159eaf5a6..4d9ff9ef9de3e3 100644 --- a/target/linux/airoha/patches-6.6/019-01-v6.11-clk-en7523-Add-reset-controller-support-for-EN7581-S.patch +++ b/target/linux/airoha/patches-6.6/019-01-v6.11-clk-en7523-Add-reset-controller-support-for-EN7581-S.patch @@ -139,7 +139,7 @@ Signed-off-by: Stephen Boyd return PTR_ERR(pb_base); @@ -428,6 +510,95 @@ static void en7523_register_clocks(struc - clk_data->num = EN7523_NUM_CLOCKS; + clk_data->hws[EN7523_CLK_PCIE] = hw; } +static int en7523_reset_update(struct reset_controller_dev *rcdev, diff --git a/target/linux/airoha/patches-6.6/033-02-v6.13-clk-en7523-move-clock_register-in-hw_init-callback.patch b/target/linux/airoha/patches-6.6/033-02-v6.13-clk-en7523-move-clock_register-in-hw_init-callback.patch index f4cfaa2bf9d901..6a76886c1b4856 100644 --- a/target/linux/airoha/patches-6.6/033-02-v6.13-clk-en7523-move-clock_register-in-hw_init-callback.patch +++ b/target/linux/airoha/patches-6.6/033-02-v6.13-clk-en7523-move-clock_register-in-hw_init-callback.patch @@ -51,7 +51,7 @@ Signed-off-by: Stephen Boyd void __iomem *base, void __iomem *np_base) { @@ -449,6 +436,49 @@ static void en7523_register_clocks(struc - clk_data->num = EN7523_NUM_CLOCKS; + clk_data->hws[EN7523_CLK_PCIE] = hw; } +static int en7523_clk_hw_init(struct platform_device *pdev, diff --git a/target/linux/airoha/patches-6.6/033-03-v6.13-clk-en7523-introduce-chip_scu-regmap.patch b/target/linux/airoha/patches-6.6/033-03-v6.13-clk-en7523-introduce-chip_scu-regmap.patch index 6c34ca2fa54808..31966273f0238d 100644 --- a/target/linux/airoha/patches-6.6/033-03-v6.13-clk-en7523-introduce-chip_scu-regmap.patch +++ b/target/linux/airoha/patches-6.6/033-03-v6.13-clk-en7523-introduce-chip_scu-regmap.patch @@ -63,7 +63,7 @@ Signed-off-by: Stephen Boyd val >>= desc->div_shift; val &= (1 << desc->div_bits) - 1; -@@ -416,9 +409,12 @@ static void en7523_register_clocks(struc +@@ -418,9 +411,12 @@ static void en7523_register_clocks(struc for (i = 0; i < ARRAY_SIZE(en7523_base_clks); i++) { const struct en_clk_desc *desc = &en7523_base_clks[i]; diff --git a/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch b/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch index dd57c53a18101a..969cde5ce27901 100644 --- a/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch @@ -259,7 +259,7 @@ SVN-Revision: 35130 #include #include #include -@@ -893,10 +894,10 @@ static void tcp_v6_send_response(const s +@@ -891,10 +892,10 @@ static void tcp_v6_send_response(const s topt = (__be32 *)(t1 + 1); if (tsecr) { @@ -337,7 +337,7 @@ SVN-Revision: 35130 #endif /* _LINUX_TYPES_H */ --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c -@@ -1508,8 +1508,8 @@ struct sk_buff *inet_gro_receive(struct +@@ -1506,8 +1506,8 @@ struct sk_buff *inet_gro_receive(struct goto out; NAPI_GRO_CB(skb)->proto = proto; diff --git a/target/linux/bcm27xx/patches-6.6/950-0029-vc4_hdmi-Avoid-log-spam-for-audio-start-failure.patch b/target/linux/bcm27xx/patches-6.6/950-0029-vc4_hdmi-Avoid-log-spam-for-audio-start-failure.patch deleted file mode 100644 index a73c5e3163fa5e..00000000000000 --- a/target/linux/bcm27xx/patches-6.6/950-0029-vc4_hdmi-Avoid-log-spam-for-audio-start-failure.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 7508b889b8c8058e53ceeec90a1e3cc998897e16 Mon Sep 17 00:00:00 2001 -From: Dom Cobley -Date: Tue, 6 Dec 2022 15:05:56 +0000 -Subject: [PATCH 0029/1085] vc4_hdmi: Avoid log spam for audio start failure - -We regularly get dmesg error reports of: -[ 18.184066] hdmi-audio-codec hdmi-audio-codec.3.auto: ASoC: error at snd_soc_dai_startup on i2s-hifi: -19 -[ 18.184098] MAI: soc_pcm_open() failed (-19) - -Currently I get 30 of these when booting to desktop. -We always say, ignore they are harmless, but removing them would be good. - -A bit of investigation shows, for me, the errors are all generated by second, unused hdmi interface. - -It shows as an alsa device, and pulseaudio attempts to open it (numerous times), generating a kernel -error message each time. - -systemctl --user restart pulseaudio.service generates 6 additional error messages. - -The error messages all come through: -https://github.com/raspberrypi/linux/blob/a009a9c0d79dfec114ee5102ec3d3325a172c952/sound/soc/soc-pcm.c#L39 - -which suggests returning ENOTSUPP, rather that ENODEV will be quiet. And indeed it is. - -Note: earlier kernels do not have the quiet ENOTSUPP, so additional cherry-picks will be needed to backport -Signed-off-by: Dom Cobley ---- - drivers/gpu/drm/vc4/vc4_hdmi.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/gpu/drm/vc4/vc4_hdmi.c -+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -2404,7 +2404,7 @@ static int vc4_hdmi_audio_startup(struct - } - - if (!vc4_hdmi_audio_can_stream(vc4_hdmi)) { -- ret = -ENODEV; -+ ret = -ENOTSUPP; - goto out_dev_exit; - } - diff --git a/target/linux/bcm27xx/patches-6.6/950-0036-drm-vc4-Set-AXI-panic-modes-for-the-HVS.patch b/target/linux/bcm27xx/patches-6.6/950-0036-drm-vc4-Set-AXI-panic-modes-for-the-HVS.patch index 13015f1f497a47..3ecea01fcd56a6 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0036-drm-vc4-Set-AXI-panic-modes-for-the-HVS.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0036-drm-vc4-Set-AXI-panic-modes-for-the-HVS.patch @@ -19,7 +19,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -1368,6 +1368,17 @@ static int vc4_hvs_bind(struct device *d +@@ -1379,6 +1379,17 @@ static int vc4_hvs_bind(struct device *d dispctrl |= VC4_SET_FIELD(2, SCALER_DISPCTRL_PANIC1); dispctrl |= VC4_SET_FIELD(2, SCALER_DISPCTRL_PANIC2); diff --git a/target/linux/bcm27xx/patches-6.6/950-0061-Revert-Revert-xhci-add-quirk-for-host-controllers-th.patch b/target/linux/bcm27xx/patches-6.6/950-0061-Revert-Revert-xhci-add-quirk-for-host-controllers-th.patch index 1135b31d4f6222..f8aa2fe5a74b52 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0061-Revert-Revert-xhci-add-quirk-for-host-controllers-th.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0061-Revert-Revert-xhci-add-quirk-for-host-controllers-th.patch @@ -14,7 +14,7 @@ We don't agree with upstream revert so undo it. --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c -@@ -490,8 +490,10 @@ static void xhci_pci_quirks(struct devic +@@ -480,8 +480,10 @@ static void xhci_pci_quirks(struct devic pdev->device == 0x3432) xhci->quirks |= XHCI_BROKEN_STREAMS; diff --git a/target/linux/bcm27xx/patches-6.6/950-0083-amba_pl011-Add-cts-event-workaround-DT-property.patch b/target/linux/bcm27xx/patches-6.6/950-0083-amba_pl011-Add-cts-event-workaround-DT-property.patch index 58910b861198a3..efee03dc801a74 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0083-amba_pl011-Add-cts-event-workaround-DT-property.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0083-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 -@@ -2808,6 +2808,11 @@ static int pl011_probe(struct amba_devic +@@ -2815,6 +2815,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-6.6/950-0092-MMC-added-alternative-MMC-driver.patch b/target/linux/bcm27xx/patches-6.6/950-0092-MMC-added-alternative-MMC-driver.patch index aebb491f32af30..9b86d0e6a32af2 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0092-MMC-added-alternative-MMC-driver.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0092-MMC-added-alternative-MMC-driver.patch @@ -344,7 +344,7 @@ Signed-off-by: Phil Elwell } --- a/drivers/mmc/core/quirks.h +++ b/drivers/mmc/core/quirks.h -@@ -134,6 +134,14 @@ static const struct mmc_fixup __maybe_un +@@ -143,6 +143,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), @@ -2013,10 +2013,10 @@ Signed-off-by: Phil Elwell sdhci_dumpregs(host); --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h -@@ -296,6 +296,7 @@ struct mmc_card { - #define MMC_QUIRK_BROKEN_SD_DISCARD (1<<14) /* Disable broken SD discard support */ +@@ -297,6 +297,7 @@ struct mmc_card { #define MMC_QUIRK_BROKEN_SD_CACHE (1<<15) /* Disable broken SD cache support */ #define MMC_QUIRK_BROKEN_CACHE_FLUSH (1<<16) /* Don't flush cache until the write has occurred */ + #define MMC_QUIRK_BROKEN_SD_POWEROFF_NOTIFY (1<<17) /* Disable broken SD poweroff notify support */ +#define MMC_QUIRK_ERASE_BROKEN (1<<31) /* Skip erase */ bool written_flag; /* Indicates eMMC has been written since power on */ diff --git a/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch b/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch index a8a58b58fa64c1..6ffc9364da8889 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch @@ -17583,7 +17583,7 @@ Signed-off-by: Phil Elwell * For devices with more than one control interface, we assume the --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c -@@ -2212,6 +2212,8 @@ static const struct usb_audio_quirk_flag +@@ -2233,6 +2233,8 @@ static const struct usb_audio_quirk_flag QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x534d, 0x2109, /* MacroSilicon MS2109 */ QUIRK_FLAG_ALIGN_TRANSFER), diff --git a/target/linux/bcm27xx/patches-6.6/950-0161-xhci-implement-xhci_fixup_endpoint-for-interval-adju.patch b/target/linux/bcm27xx/patches-6.6/950-0161-xhci-implement-xhci_fixup_endpoint-for-interval-adju.patch index f5eea9b47df860..942f47a0a36e08 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0161-xhci-implement-xhci_fixup_endpoint-for-interval-adju.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0161-xhci-implement-xhci_fixup_endpoint-for-interval-adju.patch @@ -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 */ -@@ -5328,6 +5431,7 @@ static const struct hc_driver xhci_hc_dr +@@ -5347,6 +5450,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-6.6/950-0169-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch b/target/linux/bcm27xx/patches-6.6/950-0169-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch index 6e9ca2261bb087..a65d198d21f48f 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0169-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0169-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 -@@ -242,6 +242,9 @@ +@@ -243,6 +243,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 -@@ -1405,6 +1408,9 @@ +@@ -1406,6 +1409,9 @@ #define USB_VENDOR_ID_XIAOMI 0x2717 #define USB_DEVICE_ID_MI_SILENT_MOUSE 0x5014 diff --git a/target/linux/bcm27xx/patches-6.6/950-0301-drm-panel-simple-Add-a-timing-for-the-Raspberry-Pi-7.patch b/target/linux/bcm27xx/patches-6.6/950-0301-drm-panel-simple-Add-a-timing-for-the-Raspberry-Pi-7.patch index d5cee828b07630..e3a07581f82967 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0301-drm-panel-simple-Add-a-timing-for-the-Raspberry-Pi-7.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0301-drm-panel-simple-Add-a-timing-for-the-Raspberry-Pi-7.patch @@ -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 }, -@@ -4427,6 +4452,9 @@ static const struct of_device_id platfor +@@ -4452,6 +4477,9 @@ static const struct of_device_id platfor .compatible = "rocktech,rk043fn48h", .data = &rocktech_rk043fn48h, }, { diff --git a/target/linux/bcm27xx/patches-6.6/950-0343-drm-panel-simple-add-Geekworm-MZP280-Panel.patch b/target/linux/bcm27xx/patches-6.6/950-0343-drm-panel-simple-add-Geekworm-MZP280-Panel.patch index d5a071364a0ee7..49493e67a9cdc6 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0343-drm-panel-simple-add-Geekworm-MZP280-Panel.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0343-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, -@@ -4302,6 +4328,9 @@ static const struct of_device_id platfor +@@ -4327,6 +4353,9 @@ static const struct of_device_id platfor .compatible = "friendlyarm,hd702e", .data = &friendlyarm_hd702e, }, { diff --git a/target/linux/bcm27xx/patches-6.6/950-0359-mm-page_alloc-cma-introduce-a-customisable-threshold.patch b/target/linux/bcm27xx/patches-6.6/950-0359-mm-page_alloc-cma-introduce-a-customisable-threshold.patch index f8baf9befc5b0f..8cf8a05098cb97 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0359-mm-page_alloc-cma-introduce-a-customisable-threshold.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0359-mm-page_alloc-cma-introduce-a-customisable-threshold.patch @@ -48,7 +48,7 @@ Signed-off-by: David Plowman /* * A cached value of the page's pageblock's migratetype, used when the page is * put on a pcplist. Used to avoid the pageblock migratetype lookup when -@@ -2094,12 +2115,13 @@ __rmqueue(struct zone *zone, unsigned in +@@ -2109,12 +2130,13 @@ __rmqueue(struct zone *zone, unsigned in if (IS_ENABLED(CONFIG_CMA)) { /* * Balance movable allocations between regular and CMA areas by diff --git a/target/linux/bcm27xx/patches-6.6/950-0401-drm-panel-simple-Add-Innolux-AT056tN53V1-5.6-VGA.patch b/target/linux/bcm27xx/patches-6.6/950-0401-drm-panel-simple-Add-Innolux-AT056tN53V1-5.6-VGA.patch index d8376a3fe598cc..394109d5658be9 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0401-drm-panel-simple-Add-Innolux-AT056tN53V1-5.6-VGA.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0401-drm-panel-simple-Add-Innolux-AT056tN53V1-5.6-VGA.patch @@ -165,7 +165,7 @@ Signed-off-by: Phil Elwell static const struct drm_display_mode innolux_at070tn92_mode = { .clock = 33333, .hdisplay = 800, -@@ -4352,6 +4384,9 @@ static const struct of_device_id platfor +@@ -4377,6 +4409,9 @@ static const struct of_device_id platfor .compatible = "innolux,at043tn24", .data = &innolux_at043tn24, }, { diff --git a/target/linux/bcm27xx/patches-6.6/950-0441-Bluetooth-hci_sync-Add-fallback-bd-address-prop.patch b/target/linux/bcm27xx/patches-6.6/950-0441-Bluetooth-hci_sync-Add-fallback-bd-address-prop.patch index cc5e3d1dc304b6..3f9d802de3c229 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0441-Bluetooth-hci_sync-Add-fallback-bd-address-prop.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0441-Bluetooth-hci_sync-Add-fallback-bd-address-prop.patch @@ -20,7 +20,7 @@ Signed-off-by: Phil Elwell --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c -@@ -4865,6 +4865,7 @@ static const struct { +@@ -4872,6 +4872,7 @@ static const struct { */ static int hci_dev_setup_sync(struct hci_dev *hdev) { @@ -28,7 +28,7 @@ Signed-off-by: Phil Elwell int ret = 0; bool invalid_bdaddr; size_t i; -@@ -4893,7 +4894,8 @@ static int hci_dev_setup_sync(struct hci +@@ -4900,7 +4901,8 @@ static int hci_dev_setup_sync(struct hci test_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks); if (!ret) { if (test_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks) && diff --git a/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch b/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch index 4a7bfd4f2eb060..93e45b54424fad 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch @@ -24,7 +24,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c -@@ -493,6 +493,7 @@ static void xhci_pci_quirks(struct devic +@@ -483,6 +483,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; @@ -52,9 +52,9 @@ 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 -@@ -1662,6 +1662,9 @@ struct xhci_hcd { - #define XHCI_WRITE_64_HI_LO BIT_ULL(47) +@@ -1663,6 +1663,9 @@ struct xhci_hcd { #define XHCI_CDNS_SCTX_QUIRK BIT_ULL(48) + #define XHCI_ETRON_HOST BIT_ULL(49) +/* Downstream VLI fixes */ +#define XHCI_AVOID_DQ_ON_LINK BIT_ULL(56) diff --git a/target/linux/bcm27xx/patches-6.6/950-0483-usb-xhci-borrow-upstream-TRB_FETCH-quirk-on-VL805-ho.patch b/target/linux/bcm27xx/patches-6.6/950-0483-usb-xhci-borrow-upstream-TRB_FETCH-quirk-on-VL805-ho.patch index e76a413d67f09d..852e6a36735c29 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0483-usb-xhci-borrow-upstream-TRB_FETCH-quirk-on-VL805-ho.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0483-usb-xhci-borrow-upstream-TRB_FETCH-quirk-on-VL805-ho.patch @@ -22,7 +22,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c -@@ -494,6 +494,7 @@ static void xhci_pci_quirks(struct devic +@@ -484,6 +484,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-6.6/950-0484-usb-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch b/target/linux/bcm27xx/patches-6.6/950-0484-usb-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch index 663a2f93233fe7..add65ee641de97 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0484-usb-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0484-usb-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch @@ -90,7 +90,7 @@ Signed-off-by: Jonathan Bell /* Allow 3 retries for everything but isoc, set CErr = 3 */ --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c -@@ -495,6 +495,7 @@ static void xhci_pci_quirks(struct devic +@@ -485,6 +485,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_ZHAOXIN_TRB_FETCH; @@ -100,7 +100,7 @@ Signed-off-by: Jonathan Bell if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1664,6 +1664,7 @@ struct xhci_hcd { +@@ -1665,6 +1665,7 @@ struct xhci_hcd { /* Downstream VLI fixes */ #define XHCI_AVOID_DQ_ON_LINK BIT_ULL(56) diff --git a/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch b/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch index 8d276e1681866f..9c45bd77e9a789 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch @@ -64,7 +64,7 @@ Signed-off-by: Jonathan Bell static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) { struct pci_dev *pdev = to_pci_dev(dev); -@@ -496,6 +508,8 @@ static void xhci_pci_quirks(struct devic +@@ -486,6 +498,8 @@ static void xhci_pci_quirks(struct devic xhci->quirks |= XHCI_AVOID_DQ_ON_LINK; xhci->quirks |= XHCI_ZHAOXIN_TRB_FETCH; xhci->quirks |= XHCI_VLI_SS_BULK_OUT_BUG; @@ -75,7 +75,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 -@@ -3679,6 +3679,48 @@ static int xhci_align_td(struct xhci_hcd +@@ -3674,6 +3674,48 @@ static int xhci_align_td(struct xhci_hcd return 1; } @@ -124,7 +124,7 @@ Signed-off-by: Jonathan Bell /* This is very similar to what ehci-q.c qtd_fill() does */ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, struct urb *urb, int slot_id, unsigned int ep_index) -@@ -3835,6 +3877,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3830,6 +3872,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd * } check_trb_math(urb, enqd_len); @@ -133,7 +133,7 @@ Signed-off-by: Jonathan Bell giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, start_cycle, start_trb); return 0; -@@ -3970,6 +4014,8 @@ int xhci_queue_ctrl_tx(struct xhci_hcd * +@@ -3979,6 +4023,8 @@ int xhci_queue_ctrl_tx(struct xhci_hcd * /* Event on completion */ field | TRB_IOC | TRB_TYPE(TRB_STATUS) | ep_ring->cycle_state); @@ -144,7 +144,7 @@ Signed-off-by: Jonathan Bell return 0; --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1665,6 +1665,7 @@ struct xhci_hcd { +@@ -1666,6 +1666,7 @@ struct xhci_hcd { /* Downstream VLI fixes */ #define XHCI_AVOID_DQ_ON_LINK BIT_ULL(56) #define XHCI_VLI_SS_BULK_OUT_BUG BIT_ULL(57) diff --git a/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch b/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch index 7609657162d259..fe77f212117713 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch @@ -333,7 +333,7 @@ Signed-off-by: Jonathan Bell /* Global Debug LSP MUX Select */ #define DWC3_GDBGLSPMUX_ENDBC BIT(15) /* Host only */ #define DWC3_GDBGLSPMUX_HOSTSELECT(n) ((n) & 0x3fff) -@@ -1061,6 +1064,7 @@ struct dwc3_scratchpad_array { +@@ -1062,6 +1065,7 @@ struct dwc3_scratchpad_array { * @tx_max_burst_prd: max periodic ESS transmit burst size * @tx_fifo_resize_max_num: max number of fifos allocated during txfifo resize * @clear_stall_protocol: endpoint number that requires a delayed status phase @@ -341,7 +341,7 @@ Signed-off-by: Jonathan Bell * @hsphy_interface: "utmi" or "ulpi" * @connected: true when we're connected to a host, false otherwise * @softconnect: true when gadget connect is called, false when disconnect runs -@@ -1298,6 +1302,7 @@ struct dwc3 { +@@ -1299,6 +1303,7 @@ struct dwc3 { u8 tx_max_burst_prd; u8 tx_fifo_resize_max_num; u8 clear_stall_protocol; diff --git a/target/linux/bcm27xx/patches-6.6/950-0531-serial-pl011-rp1-uart-support.patch b/target/linux/bcm27xx/patches-6.6/950-0531-serial-pl011-rp1-uart-support.patch index a36fbd2a597c4c..f916b5709d1cba 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0531-serial-pl011-rp1-uart-support.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0531-serial-pl011-rp1-uart-support.patch @@ -31,7 +31,7 @@ Signed-off-by: Phil Elwell #ifdef CONFIG_ACPI_SPCR_TABLE static const struct vendor_data vendor_qdt_qdf2400_e44 = { .reg_offset = pl011_std_offsets, -@@ -2979,6 +2993,86 @@ static struct platform_driver arm_sbsa_u +@@ -2986,6 +3000,86 @@ static struct platform_driver arm_sbsa_u }, }; @@ -118,7 +118,7 @@ Signed-off-by: Phil Elwell static const struct amba_id pl011_ids[] = { { .id = 0x00041011, -@@ -3012,6 +3106,8 @@ static int __init pl011_init(void) +@@ -3019,6 +3113,8 @@ static int __init pl011_init(void) if (platform_driver_register(&arm_sbsa_uart_platform_driver)) pr_warn("could not register SBSA UART platform driver\n"); diff --git a/target/linux/bcm27xx/patches-6.6/950-0585-drm-vc4-Introduce-generation-number-enum.patch b/target/linux/bcm27xx/patches-6.6/950-0585-drm-vc4-Introduce-generation-number-enum.patch index 8372ae23fec77d..f57aa6d1b79244 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0585-drm-vc4-Introduce-generation-number-enum.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0585-drm-vc4-Introduce-generation-number-enum.patch @@ -664,7 +664,7 @@ Signed-off-by: Maxime Ripard dispctrl &= ~(SCALER_DISPCTRL_DMAEIRQ | SCALER_DISPCTRL_SLVWREIRQ | SCALER_DISPCTRL_SLVRDEIRQ | -@@ -1398,7 +1404,7 @@ static int vc4_hvs_bind(struct device *d +@@ -1409,7 +1415,7 @@ static int vc4_hvs_bind(struct device *d /* Recompute Composite Output Buffer (COB) allocations for the displays */ diff --git a/target/linux/bcm27xx/patches-6.6/950-0590-drm-vc4-hvs-Create-hw_init-function.patch b/target/linux/bcm27xx/patches-6.6/950-0590-drm-vc4-hvs-Create-hw_init-function.patch index 7ddac05734135a..afa95ac2586112 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0590-drm-vc4-hvs-Create-hw_init-function.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0590-drm-vc4-hvs-Create-hw_init-function.patch @@ -99,7 +99,7 @@ Signed-off-by: Maxime Ripard reg = HVS_READ(SCALER_DISPECTRL); reg &= ~SCALER_DISPECTRL_DSP2_MUX_MASK; -@@ -1440,6 +1371,86 @@ static int vc4_hvs_bind(struct device *d +@@ -1451,6 +1382,86 @@ static int vc4_hvs_bind(struct device *d HVS_WRITE(SCALER_DISPCTRL, dispctrl); diff --git a/target/linux/bcm27xx/patches-6.6/950-0591-drm-vc4-hvs-Create-cob_init-function.patch b/target/linux/bcm27xx/patches-6.6/950-0591-drm-vc4-hvs-Create-cob_init-function.patch index 6add44807baad2..00cefef2353917 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0591-drm-vc4-hvs-Create-cob_init-function.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0591-drm-vc4-hvs-Create-cob_init-function.patch @@ -16,7 +16,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -1374,6 +1374,77 @@ static int vc4_hvs_hw_init(struct vc4_hv +@@ -1385,6 +1385,77 @@ static int vc4_hvs_hw_init(struct vc4_hv return 0; } @@ -94,7 +94,7 @@ Signed-off-by: Maxime Ripard static int vc4_hvs_bind(struct device *dev, struct device *master, void *data) { struct platform_device *pdev = to_platform_device(dev); -@@ -1381,7 +1452,6 @@ static int vc4_hvs_bind(struct device *d +@@ -1392,7 +1463,6 @@ static int vc4_hvs_bind(struct device *d struct vc4_dev *vc4 = to_vc4_dev(drm); struct vc4_hvs *hvs = NULL; int ret; @@ -102,7 +102,7 @@ Signed-off-by: Maxime Ripard hvs = __vc4_hvs_alloc(vc4, NULL); if (IS_ERR(hvs)) -@@ -1451,59 +1521,9 @@ static int vc4_hvs_bind(struct device *d +@@ -1462,59 +1532,9 @@ static int vc4_hvs_bind(struct device *d if (ret) return ret; diff --git a/target/linux/bcm27xx/patches-6.6/950-0592-drm-vc4-hvs-Rename-hvs_regs-list.patch b/target/linux/bcm27xx/patches-6.6/950-0592-drm-vc4-hvs-Rename-hvs_regs-list.patch index f354f6acd7f0f8..2ce5289a65414d 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0592-drm-vc4-hvs-Rename-hvs_regs-list.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0592-drm-vc4-hvs-Rename-hvs_regs-list.patch @@ -25,7 +25,7 @@ Signed-off-by: Maxime Ripard VC4_REG32(SCALER_DISPCTRL), VC4_REG32(SCALER_DISPSTAT), VC4_REG32(SCALER_DISPID), -@@ -1462,8 +1462,8 @@ static int vc4_hvs_bind(struct device *d +@@ -1473,8 +1473,8 @@ static int vc4_hvs_bind(struct device *d return PTR_ERR(hvs->regs); hvs->regset.base = hvs->regs; diff --git a/target/linux/bcm27xx/patches-6.6/950-0595-drm-vc4-hvs-Change-prototype-of-__vc4_hvs_alloc-to-p.patch b/target/linux/bcm27xx/patches-6.6/950-0595-drm-vc4-hvs-Change-prototype-of-__vc4_hvs_alloc-to-p.patch index 36c4010b7e9425..e7a63dcfcb5a4b 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0595-drm-vc4-hvs-Change-prototype-of-__vc4_hvs_alloc-to-p.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0595-drm-vc4-hvs-Change-prototype-of-__vc4_hvs_alloc-to-p.patch @@ -68,7 +68,7 @@ Signed-off-by: Maxime Ripard hvs->pdev = pdev; spin_lock_init(&hvs->mm_lock); -@@ -1451,16 +1454,17 @@ static int vc4_hvs_bind(struct device *d +@@ -1462,16 +1465,17 @@ static int vc4_hvs_bind(struct device *d struct drm_device *drm = dev_get_drvdata(master); struct vc4_dev *vc4 = to_vc4_dev(drm); struct vc4_hvs *hvs = NULL; diff --git a/target/linux/bcm27xx/patches-6.6/950-0602-drm-vc4-Enable-SCALER_CONTROL-early-in-HVS-init.patch b/target/linux/bcm27xx/patches-6.6/950-0602-drm-vc4-Enable-SCALER_CONTROL-early-in-HVS-init.patch index 62406a268b8f6a..d694e865722a41 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0602-drm-vc4-Enable-SCALER_CONTROL-early-in-HVS-init.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0602-drm-vc4-Enable-SCALER_CONTROL-early-in-HVS-init.patch @@ -35,7 +35,7 @@ Signed-off-by: Tim Gover dispctrl |= SCALER_DISPCTRL_DISPEIRQ(0) | SCALER_DISPCTRL_DISPEIRQ(1) | SCALER_DISPCTRL_DISPEIRQ(2); -@@ -1512,6 +1514,10 @@ static int vc4_hvs_bind(struct device *d +@@ -1523,6 +1525,10 @@ static int vc4_hvs_bind(struct device *d else hvs->dlist = hvs->regs + SCALER5_DLIST_START; @@ -46,7 +46,7 @@ Signed-off-by: Tim Gover /* Upload filter kernels. We only have the one for now, so we * keep it around for the lifetime of the driver. */ -@@ -1521,10 +1527,6 @@ static int vc4_hvs_bind(struct device *d +@@ -1532,10 +1538,6 @@ static int vc4_hvs_bind(struct device *d if (ret) return ret; diff --git a/target/linux/bcm27xx/patches-6.6/950-0610-drm-vc4-hvs-Support-BCM2712-HVS.patch b/target/linux/bcm27xx/patches-6.6/950-0610-drm-vc4-hvs-Support-BCM2712-HVS.patch index 9d19b23d95ab71..390d445497659f 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0610-drm-vc4-hvs-Support-BCM2712-HVS.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0610-drm-vc4-hvs-Support-BCM2712-HVS.patch @@ -734,7 +734,7 @@ Signed-off-by: Maxime Ripard vc4->hvs = hvs; -@@ -1379,10 +1715,124 @@ static int vc4_hvs_hw_init(struct vc4_hv +@@ -1390,10 +1726,124 @@ static int vc4_hvs_hw_init(struct vc4_hv return 0; } @@ -860,7 +860,7 @@ Signed-off-by: Maxime Ripard /* * Recompute Composite Output Buffer (COB) allocations for the -@@ -1443,6 +1893,31 @@ static int vc4_hvs_cob_init(struct vc4_h +@@ -1454,6 +1904,31 @@ static int vc4_hvs_cob_init(struct vc4_h HVS_WRITE(SCALER_DISPBASE0, reg); break; @@ -892,7 +892,7 @@ Signed-off-by: Maxime Ripard default: return -EINVAL; } -@@ -1468,10 +1943,16 @@ static int vc4_hvs_bind(struct device *d +@@ -1479,10 +1954,16 @@ static int vc4_hvs_bind(struct device *d return PTR_ERR(hvs); hvs->regset.base = hvs->regs; @@ -912,7 +912,7 @@ Signed-off-by: Maxime Ripard struct rpi_firmware *firmware; struct device_node *node; unsigned int max_rate; -@@ -1485,12 +1966,20 @@ static int vc4_hvs_bind(struct device *d +@@ -1496,12 +1977,20 @@ static int vc4_hvs_bind(struct device *d if (!firmware) return -EPROBE_DEFER; @@ -934,7 +934,7 @@ Signed-off-by: Maxime Ripard max_rate = rpi_firmware_clk_get_max_rate(firmware, RPI_FIRMWARE_CORE_CLK_ID); rpi_firmware_put(firmware); -@@ -1507,14 +1996,51 @@ static int vc4_hvs_bind(struct device *d +@@ -1518,14 +2007,51 @@ static int vc4_hvs_bind(struct device *d dev_err(&pdev->dev, "Couldn't enable the core clock\n"); return ret; } @@ -990,7 +990,7 @@ Signed-off-by: Maxime Ripard if (ret) return ret; -@@ -1531,10 +2057,12 @@ static int vc4_hvs_bind(struct device *d +@@ -1542,10 +2068,12 @@ static int vc4_hvs_bind(struct device *d if (ret) return ret; @@ -1007,7 +1007,7 @@ Signed-off-by: Maxime Ripard return 0; } -@@ -1559,6 +2087,7 @@ static void vc4_hvs_unbind(struct device +@@ -1570,6 +2098,7 @@ static void vc4_hvs_unbind(struct device drm_mm_remove_node(node); drm_mm_takedown(&vc4->hvs->lbm_mm); @@ -1015,7 +1015,7 @@ Signed-off-by: Maxime Ripard clk_disable_unprepare(hvs->core_clk); vc4->hvs = NULL; -@@ -1581,6 +2110,7 @@ static void vc4_hvs_dev_remove(struct pl +@@ -1592,6 +2121,7 @@ static void vc4_hvs_dev_remove(struct pl static const struct of_device_id vc4_hvs_dt_match[] = { { .compatible = "brcm,bcm2711-hvs" }, diff --git a/target/linux/bcm27xx/patches-6.6/950-0757-drm-panel-add-panel-dsi.patch b/target/linux/bcm27xx/patches-6.6/950-0757-drm-panel-add-panel-dsi.patch index 989fe3315f7606..4e9ba92a1883ac 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0757-drm-panel-add-panel-dsi.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0757-drm-panel-add-panel-dsi.patch @@ -23,7 +23,7 @@ Signed-off-by: Timon Skerutsch /** * struct panel_desc - Describes a simple panel. -@@ -4875,6 +4876,9 @@ static const struct panel_desc_dsi osd10 +@@ -4903,6 +4904,9 @@ static const struct panel_desc_dsi osd10 .lanes = 4, }; @@ -33,7 +33,7 @@ Signed-off-by: Timon Skerutsch static const struct of_device_id dsi_of_match[] = { { .compatible = "auo,b080uan01", -@@ -4898,20 +4902,137 @@ static const struct of_device_id dsi_of_ +@@ -4926,20 +4930,137 @@ static const struct of_device_id dsi_of_ .compatible = "osddisplays,osd101t2045-53ts", .data = &osd101t2045_53ts }, { diff --git a/target/linux/bcm27xx/patches-6.6/950-0829-vc4-hvs-Add-support-for-D0-register-changes.patch b/target/linux/bcm27xx/patches-6.6/950-0829-vc4-hvs-Add-support-for-D0-register-changes.patch index c8c284a1394c84..82edd649c0ca56 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0829-vc4-hvs-Add-support-for-D0-register-changes.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0829-vc4-hvs-Add-support-for-D0-register-changes.patch @@ -273,7 +273,7 @@ Signed-off-by: Dom Cobley else dlist_size = 4096; -@@ -1894,14 +1953,17 @@ static int vc6_hvs_hw_init(struct vc4_hv +@@ -1905,14 +1964,17 @@ static int vc6_hvs_hw_init(struct vc4_hv const struct vc6_csc_coeff_entry *coeffs; unsigned int i; @@ -295,7 +295,7 @@ Signed-off-by: Dom Cobley for (i = 0; i < 6; i++) { coeffs = &csc_coeffs[i / 3][i % 3]; -@@ -2000,21 +2062,21 @@ static int vc4_hvs_cob_init(struct vc4_h +@@ -2011,21 +2073,21 @@ static int vc4_hvs_cob_init(struct vc4_h reg = 0; top = 3840; @@ -320,7 +320,7 @@ Signed-off-by: Dom Cobley VC4_SET_FIELD(top, SCALER6_DISPX_COB_TOP) | VC4_SET_FIELD(base, SCALER6_DISPX_COB_BASE)); break; -@@ -2045,7 +2107,10 @@ static int vc4_hvs_bind(struct device *d +@@ -2056,7 +2118,10 @@ static int vc4_hvs_bind(struct device *d hvs->regset.base = hvs->regs; @@ -332,7 +332,7 @@ Signed-off-by: Dom Cobley hvs->regset.regs = vc6_hvs_regs; hvs->regset.nregs = ARRAY_SIZE(vc6_hvs_regs); } else { -@@ -2212,6 +2277,7 @@ static void vc4_hvs_dev_remove(struct pl +@@ -2223,6 +2288,7 @@ static void vc4_hvs_dev_remove(struct pl static const struct of_device_id vc4_hvs_dt_match[] = { { .compatible = "brcm,bcm2711-hvs" }, { .compatible = "brcm,bcm2712-hvs" }, diff --git a/target/linux/bcm27xx/patches-6.6/950-0830-vc4-hvs-Updates-to-support-D0-alpha-and-csc-changes.patch b/target/linux/bcm27xx/patches-6.6/950-0830-vc4-hvs-Updates-to-support-D0-alpha-and-csc-changes.patch index 0535f63224f5ff..ec7071c59502eb 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0830-vc4-hvs-Updates-to-support-D0-alpha-and-csc-changes.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0830-vc4-hvs-Updates-to-support-D0-alpha-and-csc-changes.patch @@ -16,7 +16,7 @@ Signed-off-by: Dom Cobley --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -1892,6 +1892,17 @@ static int vc4_hvs_hw_init(struct vc4_hv +@@ -1903,6 +1903,17 @@ static int vc4_hvs_hw_init(struct vc4_hv #define CFC1_N_MA_CSC_COEFF_C23(x) (0xa03c + ((x) * 0x3000)) #define CFC1_N_MA_CSC_COEFF_C24(x) (0xa040 + ((x) * 0x3000)) @@ -34,7 +34,7 @@ Signed-off-by: Dom Cobley /* 4 S2.22 multiplication factors, and 1 S9.15 addititive element for each of 3 * output components */ -@@ -1962,31 +1973,43 @@ static int vc6_hvs_hw_init(struct vc4_hv +@@ -1973,31 +1984,43 @@ static int vc6_hvs_hw_init(struct vc4_hv HVS_WRITE(SCALER6(PRI_MAP0), 0xffffffff); HVS_WRITE(SCALER6(PRI_MAP1), 0xffffffff); diff --git a/target/linux/bcm27xx/patches-6.6/950-0842-ARM-pl011-Add-rs485-to-the-RP1-support.patch b/target/linux/bcm27xx/patches-6.6/950-0842-ARM-pl011-Add-rs485-to-the-RP1-support.patch index ed90f11920fdb5..75cdb63c6a4f47 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0842-ARM-pl011-Add-rs485-to-the-RP1-support.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0842-ARM-pl011-Add-rs485-to-the-RP1-support.patch @@ -13,7 +13,7 @@ Signed-off-by: Phil Elwell --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c -@@ -3033,6 +3033,8 @@ static int pl011_axi_probe(struct platfo +@@ -3040,6 +3040,8 @@ static int pl011_axi_probe(struct platfo uap->port.iotype = vendor->access_32b ? UPIO_MEM32 : UPIO_MEM; uap->port.irq = irq; uap->port.ops = &amba_pl011_pops; diff --git a/target/linux/bcm27xx/patches-6.6/950-0853-drivers-usb-dwc3-add-FS-LS-bus-instance-parkmode-dis.patch b/target/linux/bcm27xx/patches-6.6/950-0853-drivers-usb-dwc3-add-FS-LS-bus-instance-parkmode-dis.patch index 901553cd6cebce..706baccdc722fb 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0853-drivers-usb-dwc3-add-FS-LS-bus-instance-parkmode-dis.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0853-drivers-usb-dwc3-add-FS-LS-bus-instance-parkmode-dis.patch @@ -45,7 +45,7 @@ Signed-off-by: Jonathan Bell #define DWC3_GUCTL1_RESUME_OPMODE_HS_HOST BIT(10) /* Global Status Register */ -@@ -1116,10 +1117,12 @@ struct dwc3_scratchpad_array { +@@ -1117,10 +1118,12 @@ struct dwc3_scratchpad_array { * generation after resume from suspend. * @ulpi_ext_vbus_drv: Set to confiure the upli chip to drives CPEN pin * VBUS with an external supply. @@ -62,7 +62,7 @@ Signed-off-by: Jonathan Bell * @tx_de_emphasis_quirk: set if we enable Tx de-emphasis quirk * @tx_de_emphasis: Tx de-emphasis value * 0 - -6dB de-emphasis -@@ -1346,6 +1349,7 @@ struct dwc3 { +@@ -1347,6 +1350,7 @@ struct dwc3 { unsigned ulpi_ext_vbus_drv:1; unsigned parkmode_disable_ss_quirk:1; unsigned parkmode_disable_hs_quirk:1; diff --git a/target/linux/bcm27xx/patches-6.6/950-0983-drivers-mmc-preallocate-a-block-for-SD-extension-reg.patch b/target/linux/bcm27xx/patches-6.6/950-0983-drivers-mmc-preallocate-a-block-for-SD-extension-reg.patch index 4d90245f364ef8..2d1d317891ce15 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0983-drivers-mmc-preallocate-a-block-for-SD-extension-reg.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0983-drivers-mmc-preallocate-a-block-for-SD-extension-reg.patch @@ -19,7 +19,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c -@@ -264,6 +264,8 @@ static void mmc_release_card(struct devi +@@ -266,6 +266,8 @@ static void mmc_release_card(struct devi sdio_free_common_cis(card); @@ -145,7 +145,7 @@ Signed-off-by: Jonathan Bell --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h -@@ -320,6 +320,7 @@ struct mmc_card { +@@ -321,6 +321,7 @@ struct mmc_card { struct sd_switch_caps sw_caps; /* switch (CMD6) caps */ struct sd_ext_reg ext_power; /* SD extension reg for PM */ struct sd_ext_reg ext_perf; /* SD extension reg for PERF */ diff --git a/target/linux/bcm27xx/patches-6.6/950-1167-mmc-restrict-posted-write-counts-for-SD-cards-in-CQ-.patch b/target/linux/bcm27xx/patches-6.6/950-1167-mmc-restrict-posted-write-counts-for-SD-cards-in-CQ-.patch index 2ba494958ea0bb..b1ddf96311c62a 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1167-mmc-restrict-posted-write-counts-for-SD-cards-in-CQ-.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1167-mmc-restrict-posted-write-counts-for-SD-cards-in-CQ-.patch @@ -146,7 +146,7 @@ Signed-off-by: Jonathan Bell card->ext_perf.fno = fno; --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h -@@ -343,6 +343,8 @@ struct mmc_card { +@@ -344,6 +344,8 @@ struct mmc_card { unsigned int nr_parts; struct workqueue_struct *complete_wq; /* Private workqueue */ diff --git a/target/linux/bcm27xx/patches-6.6/950-1218-Bluetooth-hci_sync-Fix-crash-on-NULL-parent.patch b/target/linux/bcm27xx/patches-6.6/950-1218-Bluetooth-hci_sync-Fix-crash-on-NULL-parent.patch index 3b4c7e65afc17d..223e2df2b7859b 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1218-Bluetooth-hci_sync-Fix-crash-on-NULL-parent.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1218-Bluetooth-hci_sync-Fix-crash-on-NULL-parent.patch @@ -15,7 +15,7 @@ Signed-off-by: Phil Elwell --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c -@@ -4865,7 +4865,8 @@ static const struct { +@@ -4872,7 +4872,8 @@ static const struct { */ static int hci_dev_setup_sync(struct hci_dev *hdev) { diff --git a/target/linux/bcm27xx/patches-6.6/950-1257-drm-vc4-Add-support-for-per-plane-scaling-filter-sel.patch b/target/linux/bcm27xx/patches-6.6/950-1257-drm-vc4-Add-support-for-per-plane-scaling-filter-sel.patch index 52a13c6508db92..e4d2aace93b1db 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1257-drm-vc4-Add-support-for-per-plane-scaling-filter-sel.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1257-drm-vc4-Add-support-for-per-plane-scaling-filter-sel.patch @@ -40,7 +40,7 @@ Signed-off-by: Dave Stevenson static int vc4_hvs_upload_linear_kernel(struct vc4_hvs *hvs, struct drm_mm_node *space, -@@ -2259,14 +2262,19 @@ static int vc4_hvs_bind(struct device *d +@@ -2270,14 +2273,19 @@ static int vc4_hvs_bind(struct device *d if (ret) return ret; @@ -62,7 +62,7 @@ Signed-off-by: Dave Stevenson ret = vc4_hvs_cob_init(hvs); if (ret) -@@ -2292,6 +2300,8 @@ static void vc4_hvs_unbind(struct device +@@ -2303,6 +2311,8 @@ static void vc4_hvs_unbind(struct device if (drm_mm_node_allocated(&vc4->hvs->mitchell_netravali_filter)) drm_mm_remove_node(&vc4->hvs->mitchell_netravali_filter); diff --git a/target/linux/bcm27xx/patches-6.6/950-1260-drivers-mmc-disable-write-caching-on-Samsung-2023-mo.patch b/target/linux/bcm27xx/patches-6.6/950-1260-drivers-mmc-disable-write-caching-on-Samsung-2023-mo.patch index 35607aacafba9e..761e5bea7f6533 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1260-drivers-mmc-disable-write-caching-on-Samsung-2023-mo.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1260-drivers-mmc-disable-write-caching-on-Samsung-2023-mo.patch @@ -20,8 +20,8 @@ Signed-off-by: Jonathan Bell --- a/drivers/mmc/core/card.h +++ b/drivers/mmc/core/card.h -@@ -84,6 +84,7 @@ struct mmc_fixup { - #define CID_MANFID_TOSHIBA 0x11 +@@ -85,6 +85,7 @@ struct mmc_fixup { + #define CID_MANFID_GIGASTONE 0x12 #define CID_MANFID_MICRON 0x13 #define CID_MANFID_SAMSUNG 0x15 +#define CID_MANFID_SAMSUNG_SD 0x1b @@ -30,9 +30,9 @@ Signed-off-by: Jonathan Bell #define CID_MANFID_HYNIX 0x90 --- a/drivers/mmc/core/quirks.h +++ b/drivers/mmc/core/quirks.h -@@ -25,6 +25,14 @@ static const struct mmc_fixup __maybe_un - 0, -1ull, SDIO_ANY_ID, SDIO_ANY_ID, add_quirk_sd, - MMC_QUIRK_BROKEN_SD_CACHE, EXT_CSD_REV_ANY), +@@ -34,6 +34,14 @@ static const struct mmc_fixup __maybe_un + MMC_QUIRK_BROKEN_SD_CACHE | MMC_QUIRK_BROKEN_SD_POWEROFF_NOTIFY, + EXT_CSD_REV_ANY), + /* + * Samsung Pro Plus/EVO Plus/Pro Ultimate SD cards (2023) claim to cache diff --git a/target/linux/bcm27xx/patches-6.6/950-1282-tty-serial-pl011-Also-unregister-pl011_axi_platform_.patch b/target/linux/bcm27xx/patches-6.6/950-1282-tty-serial-pl011-Also-unregister-pl011_axi_platform_.patch index 3a5f9f15c38faa..593d4a1e538468 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1282-tty-serial-pl011-Also-unregister-pl011_axi_platform_.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1282-tty-serial-pl011-Also-unregister-pl011_axi_platform_.patch @@ -12,7 +12,7 @@ Signed-off-by: Dom Cobley --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c -@@ -3122,6 +3122,7 @@ static int __init pl011_init(void) +@@ -3129,6 +3129,7 @@ static int __init pl011_init(void) static void __exit pl011_exit(void) { platform_driver_unregister(&arm_sbsa_uart_platform_driver); diff --git a/target/linux/bcm27xx/patches-6.6/950-1323-drm-vc4-Remove-request-for-min-clocks-when-hdmi-outp.patch b/target/linux/bcm27xx/patches-6.6/950-1323-drm-vc4-Remove-request-for-min-clocks-when-hdmi-outp.patch index 1a1e3439e5e4e0..cde586b126cc0f 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1323-drm-vc4-Remove-request-for-min-clocks-when-hdmi-outp.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1323-drm-vc4-Remove-request-for-min-clocks-when-hdmi-outp.patch @@ -50,7 +50,7 @@ Signed-off-by: Dom Cobley return 0; --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c -@@ -2312,7 +2312,10 @@ static void vc4_hvs_unbind(struct device +@@ -2323,7 +2323,10 @@ static void vc4_hvs_unbind(struct device drm_mm_remove_node(node); drm_mm_takedown(&vc4->hvs->lbm_mm); diff --git a/target/linux/bcm27xx/patches-6.6/950-1333-mmc-quirks-disable-cache-on-more-known-bad-Sandisk-c.patch b/target/linux/bcm27xx/patches-6.6/950-1333-mmc-quirks-disable-cache-on-more-known-bad-Sandisk-c.patch index 109c502e13f6d9..c62b301c22f113 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1333-mmc-quirks-disable-cache-on-more-known-bad-Sandisk-c.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1333-mmc-quirks-disable-cache-on-more-known-bad-Sandisk-c.patch @@ -14,7 +14,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/mmc/core/quirks.h +++ b/drivers/mmc/core/quirks.h -@@ -33,6 +33,18 @@ static const struct mmc_fixup __maybe_un +@@ -42,6 +42,18 @@ static const struct mmc_fixup __maybe_un 0, -1ull, SDIO_ANY_ID, SDIO_ANY_ID, add_quirk_sd, MMC_QUIRK_BROKEN_SD_CACHE, EXT_CSD_REV_ANY), diff --git a/target/linux/bcm27xx/patches-6.6/950-1336-mmc-quirks-add-MMC_QUIRK_BROKEN_ERASE-for-Phison-Int.patch b/target/linux/bcm27xx/patches-6.6/950-1336-mmc-quirks-add-MMC_QUIRK_BROKEN_ERASE-for-Phison-Int.patch index ba61b15ea15773..feb6eaf8ead981 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1336-mmc-quirks-add-MMC_QUIRK_BROKEN_ERASE-for-Phison-Int.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1336-mmc-quirks-add-MMC_QUIRK_BROKEN_ERASE-for-Phison-Int.patch @@ -15,7 +15,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/mmc/core/quirks.h +++ b/drivers/mmc/core/quirks.h -@@ -162,6 +162,15 @@ static const struct mmc_fixup __maybe_un +@@ -171,6 +171,15 @@ static const struct mmc_fixup __maybe_un MMC_FIXUP("SD32G", 0x41, 0x3432, add_quirk, MMC_QUIRK_ERASE_BROKEN), MMC_FIXUP("SD64G", 0x41, 0x3432, add_quirk, MMC_QUIRK_ERASE_BROKEN), diff --git a/target/linux/bcm27xx/patches-6.6/950-1340-mm-numa-Allow-override-of-kernel-s-default-NUMA-poli.patch b/target/linux/bcm27xx/patches-6.6/950-1340-mm-numa-Allow-override-of-kernel-s-default-NUMA-poli.patch index dceb6df45f86da..f2d7a91b77f9ee 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1340-mm-numa-Allow-override-of-kernel-s-default-NUMA-poli.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1340-mm-numa-Allow-override-of-kernel-s-default-NUMA-poli.patch @@ -23,7 +23,7 @@ Signed-off-by: Tvrtko Ursulin --- a/mm/mempolicy.c +++ b/mm/mempolicy.c -@@ -2963,7 +2963,9 @@ void __init numa_policy_init(void) +@@ -2947,7 +2947,9 @@ void __init numa_policy_init(void) /* Reset policy of current process to default */ void numa_default_policy(void) { @@ -34,7 +34,7 @@ Signed-off-by: Tvrtko Ursulin } /* -@@ -2981,7 +2983,6 @@ static const char * const policy_modes[] +@@ -2965,7 +2967,6 @@ static const char * const policy_modes[] }; @@ -42,7 +42,7 @@ Signed-off-by: Tvrtko Ursulin /** * mpol_parse_str - parse string to mempolicy, for tmpfs mpol mount option. * @str: string containing mempolicy to parse -@@ -2994,13 +2995,18 @@ static const char * const policy_modes[] +@@ -2978,13 +2979,18 @@ static const char * const policy_modes[] */ int mpol_parse_str(char *str, struct mempolicy **mpol) { @@ -62,7 +62,7 @@ Signed-off-by: Tvrtko Ursulin if (flags) *flags++ = '\0'; /* terminate mode string */ -@@ -3079,9 +3085,16 @@ int mpol_parse_str(char *str, struct mem +@@ -3063,9 +3069,16 @@ int mpol_parse_str(char *str, struct mem goto out; } @@ -82,7 +82,7 @@ Signed-off-by: Tvrtko Ursulin /* * Save nodes for mpol_to_str() to show the tmpfs mount options -@@ -3114,7 +3127,29 @@ out: +@@ -3098,7 +3111,29 @@ out: *mpol = new; return err; } diff --git a/target/linux/bcm53xx/patches-6.6/180-usb-xhci-add-support-for-performing-fake-doorbell.patch b/target/linux/bcm53xx/patches-6.6/180-usb-xhci-add-support-for-performing-fake-doorbell.patch index 13b6566a8e980f..7ac12a290f6822 100644 --- a/target/linux/bcm53xx/patches-6.6/180-usb-xhci-add-support-for-performing-fake-doorbell.patch +++ b/target/linux/bcm53xx/patches-6.6/180-usb-xhci-add-support-for-performing-fake-doorbell.patch @@ -103,11 +103,11 @@ it on BCM4708 family. if (xhci->quirks & XHCI_NEC_HOST) --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1660,6 +1660,7 @@ struct xhci_hcd { - #define XHCI_ZHAOXIN_HOST BIT_ULL(46) +@@ -1661,6 +1661,7 @@ struct xhci_hcd { #define XHCI_WRITE_64_HI_LO BIT_ULL(47) #define XHCI_CDNS_SCTX_QUIRK BIT_ULL(48) -+#define XHCI_FAKE_DOORBELL BIT_ULL(49) + #define XHCI_ETRON_HOST BIT_ULL(49) ++#define XHCI_FAKE_DOORBELL BIT_ULL(50) unsigned int num_active_eps; unsigned int limit_active_eps; diff --git a/target/linux/generic/backport-6.6/611-01-v6.11-udp-Allow-GSO-transmit-from-devices-with-no-checksum.patch b/target/linux/generic/backport-6.6/611-01-v6.11-udp-Allow-GSO-transmit-from-devices-with-no-checksum.patch index 2f03074bc9ac8f..b9633a87725baf 100644 --- a/target/linux/generic/backport-6.6/611-01-v6.11-udp-Allow-GSO-transmit-from-devices-with-no-checksum.patch +++ b/target/linux/generic/backport-6.6/611-01-v6.11-udp-Allow-GSO-transmit-from-devices-with-no-checksum.patch @@ -82,7 +82,7 @@ Signed-off-by: Jakub Kicinski int delta = sum_truesize - gso_skb->truesize; --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c -@@ -1261,8 +1261,7 @@ static int udp_v6_send_skb(struct sk_buf +@@ -1258,8 +1258,7 @@ static int udp_v6_send_skb(struct sk_buf kfree_skb(skb); return -EINVAL; } diff --git a/target/linux/generic/backport-6.6/780-04-v6.8-r8169-improve-handling-task-scheduling.patch b/target/linux/generic/backport-6.6/780-04-v6.8-r8169-improve-handling-task-scheduling.patch index 757c800533dac3..36ac67375a23b4 100644 --- a/target/linux/generic/backport-6.6/780-04-v6.8-r8169-improve-handling-task-scheduling.patch +++ b/target/linux/generic/backport-6.6/780-04-v6.8-r8169-improve-handling-task-scheduling.patch @@ -29,7 +29,7 @@ Signed-off-by: Jakub Kicinski set_bit(flag, tp->wk.flags); schedule_work(&tp->wk.work); } -@@ -4520,8 +4523,7 @@ static void rtl_task(struct work_struct +@@ -4526,8 +4529,7 @@ static void rtl_task(struct work_struct rtnl_lock(); diff --git a/target/linux/generic/backport-6.6/780-05-v6.8-r8169-add-support-for-LED-s-on-RTL8168-RTL8101.patch b/target/linux/generic/backport-6.6/780-05-v6.8-r8169-add-support-for-LED-s-on-RTL8168-RTL8101.patch index 0504a00df4f87a..ccb8e413fefa42 100644 --- a/target/linux/generic/backport-6.6/780-05-v6.8-r8169-add-support-for-LED-s-on-RTL8168-RTL8101.patch +++ b/target/linux/generic/backport-6.6/780-05-v6.8-r8169-add-support-for-LED-s-on-RTL8168-RTL8101.patch @@ -296,7 +296,7 @@ Signed-off-by: David S. Miller static void r8168fp_adjust_ocp_cmd(struct rtl8169_private *tp, u32 *cmd, int type) { /* based on RTL8168FP_OOBMAC_BASE in vendor driver */ -@@ -5197,6 +5255,7 @@ static int rtl_init_one(struct pci_dev * +@@ -5203,6 +5261,7 @@ static int rtl_init_one(struct pci_dev * raw_spin_lock_init(&tp->cfg9346_usage_lock); raw_spin_lock_init(&tp->config25_lock); raw_spin_lock_init(&tp->mac_ocp_lock); @@ -304,7 +304,7 @@ Signed-off-by: David S. Miller dev->tstats = devm_netdev_alloc_pcpu_stats(&pdev->dev, struct pcpu_sw_netstats); -@@ -5353,6 +5412,12 @@ static int rtl_init_one(struct pci_dev * +@@ -5359,6 +5418,12 @@ static int rtl_init_one(struct pci_dev * if (rc) return rc; diff --git a/target/linux/generic/backport-6.6/780-06-v6.8-r8169-fix-building-with-CONFIG_LEDS_CLASS-m.patch b/target/linux/generic/backport-6.6/780-06-v6.8-r8169-fix-building-with-CONFIG_LEDS_CLASS-m.patch index 1adaf87625e6ce..3860de75700732 100644 --- a/target/linux/generic/backport-6.6/780-06-v6.8-r8169-fix-building-with-CONFIG_LEDS_CLASS-m.patch +++ b/target/linux/generic/backport-6.6/780-06-v6.8-r8169-fix-building-with-CONFIG_LEDS_CLASS-m.patch @@ -59,7 +59,7 @@ Signed-off-by: Jakub Kicinski obj-$(CONFIG_R8169) += r8169.o --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -5412,11 +5412,10 @@ static int rtl_init_one(struct pci_dev * +@@ -5418,11 +5418,10 @@ static int rtl_init_one(struct pci_dev * if (rc) return rc; diff --git a/target/linux/generic/backport-6.6/780-07-v6.9-r8169-simplify-EEE-handling.patch b/target/linux/generic/backport-6.6/780-07-v6.9-r8169-simplify-EEE-handling.patch index c3f94b3aff07aa..0f5f68c68a10d9 100644 --- a/target/linux/generic/backport-6.6/780-07-v6.9-r8169-simplify-EEE-handling.patch +++ b/target/linux/generic/backport-6.6/780-07-v6.9-r8169-simplify-EEE-handling.patch @@ -75,7 +75,7 @@ Signed-off-by: Jakub Kicinski genphy_soft_reset(tp->phydev); } -@@ -5114,7 +5089,9 @@ static int r8169_mdio_register(struct rt +@@ -5120,7 +5095,9 @@ static int r8169_mdio_register(struct rt } tp->phydev->mac_managed_pm = true; @@ -86,7 +86,7 @@ Signed-off-by: Jakub Kicinski phy_support_asym_pause(tp->phydev); /* PHY will be woken up in rtl_open() */ -@@ -5249,7 +5226,6 @@ static int rtl_init_one(struct pci_dev * +@@ -5255,7 +5232,6 @@ static int rtl_init_one(struct pci_dev * tp->dev = dev; tp->pci_dev = pdev; tp->supports_gmii = ent->driver_data == RTL_CFG_NO_GBIT ? 0 : 1; diff --git a/target/linux/generic/backport-6.6/780-08-v6.9-r8169-add-support-for-RTL8126A.patch b/target/linux/generic/backport-6.6/780-08-v6.9-r8169-add-support-for-RTL8126A.patch index 354aacf1cf7c89..210730d6b127ee 100644 --- a/target/linux/generic/backport-6.6/780-08-v6.9-r8169-add-support-for-RTL8126A.patch +++ b/target/linux/generic/backport-6.6/780-08-v6.9-r8169-add-support-for-RTL8126A.patch @@ -311,7 +311,7 @@ Signed-off-by: David S. Miller rtl_enable_rxdvgate(tp); fsleep(2000); break; -@@ -4105,8 +4163,7 @@ static unsigned int rtl_quirk_packet_pad +@@ -4111,8 +4169,7 @@ static unsigned int rtl_quirk_packet_pad switch (tp->mac_version) { case RTL_GIGA_MAC_VER_34: @@ -321,7 +321,7 @@ Signed-off-by: David S. Miller padto = max_t(unsigned int, padto, ETH_ZLEN); break; default: -@@ -5141,7 +5198,7 @@ static void rtl_hw_initialize(struct rtl +@@ -5147,7 +5204,7 @@ static void rtl_hw_initialize(struct rtl case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_48: rtl_hw_init_8168g(tp); break; diff --git a/target/linux/generic/backport-6.6/780-10-v6.9-r8169-simplify-code-by-using-core-provided-pcpu-stat.patch b/target/linux/generic/backport-6.6/780-10-v6.9-r8169-simplify-code-by-using-core-provided-pcpu-stat.patch index c155b11431f87c..959a1b0276d94c 100644 --- a/target/linux/generic/backport-6.6/780-10-v6.9-r8169-simplify-code-by-using-core-provided-pcpu-stat.patch +++ b/target/linux/generic/backport-6.6/780-10-v6.9-r8169-simplify-code-by-using-core-provided-pcpu-stat.patch @@ -16,7 +16,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -5290,11 +5290,6 @@ static int rtl_init_one(struct pci_dev * +@@ -5296,11 +5296,6 @@ static int rtl_init_one(struct pci_dev * raw_spin_lock_init(&tp->mac_ocp_lock); mutex_init(&tp->led_lock); @@ -28,7 +28,7 @@ Signed-off-by: Paolo Abeni /* Get the *optional* external "ether_clk" used on some boards */ tp->clk = devm_clk_get_optional_enabled(&pdev->dev, "ether_clk"); if (IS_ERR(tp->clk)) -@@ -5409,6 +5404,8 @@ static int rtl_init_one(struct pci_dev * +@@ -5415,6 +5410,8 @@ static int rtl_init_one(struct pci_dev * dev->hw_features |= NETIF_F_RXALL; dev->hw_features |= NETIF_F_RXFCS; diff --git a/target/linux/generic/backport-6.6/780-11-v6.9-r8169-add-LED-support-for-RTL8125-RTL8126.patch b/target/linux/generic/backport-6.6/780-11-v6.9-r8169-add-LED-support-for-RTL8125-RTL8126.patch index 1c793f9b1d337a..fa9b4f10620627 100644 --- a/target/linux/generic/backport-6.6/780-11-v6.9-r8169-add-LED-support-for-RTL8125-RTL8126.patch +++ b/target/linux/generic/backport-6.6/780-11-v6.9-r8169-add-LED-support-for-RTL8125-RTL8126.patch @@ -225,7 +225,7 @@ Signed-off-by: Jakub Kicinski void r8169_get_led_name(struct rtl8169_private *tp, int idx, char *buf, int buf_len) { -@@ -5442,10 +5493,12 @@ static int rtl_init_one(struct pci_dev * +@@ -5448,10 +5499,12 @@ static int rtl_init_one(struct pci_dev * if (rc) return rc; diff --git a/target/linux/generic/backport-6.6/780-16-v6.9-r8169-fix-LED-related-deadlock-on-module-removal.patch b/target/linux/generic/backport-6.6/780-16-v6.9-r8169-fix-LED-related-deadlock-on-module-removal.patch index cb031d8f34887a..26290cdef566ab 100644 --- a/target/linux/generic/backport-6.6/780-16-v6.9-r8169-fix-LED-related-deadlock-on-module-removal.patch +++ b/target/linux/generic/backport-6.6/780-16-v6.9-r8169-fix-LED-related-deadlock-on-module-removal.patch @@ -124,7 +124,7 @@ Signed-off-by: David S. Miller u32 ocp_base; }; -@@ -5069,6 +5071,8 @@ static void rtl_remove_one(struct pci_de +@@ -5075,6 +5077,8 @@ static void rtl_remove_one(struct pci_de cancel_work_sync(&tp->wk.work); @@ -133,7 +133,7 @@ Signed-off-by: David S. Miller unregister_netdev(tp->dev); if (tp->dash_type != RTL_DASH_NONE) -@@ -5527,9 +5531,9 @@ static int rtl_init_one(struct pci_dev * +@@ -5533,9 +5537,9 @@ static int rtl_init_one(struct pci_dev * if (IS_ENABLED(CONFIG_R8169_LEDS)) { if (rtl_is_8125(tp)) diff --git a/target/linux/generic/backport-6.6/780-17-v6.9-r8169-add-missing-conditional-compiling-for-call-to-.patch b/target/linux/generic/backport-6.6/780-17-v6.9-r8169-add-missing-conditional-compiling-for-call-to-.patch index 0412c919035f4b..265c715f5e4d56 100644 --- a/target/linux/generic/backport-6.6/780-17-v6.9-r8169-add-missing-conditional-compiling-for-call-to-.patch +++ b/target/linux/generic/backport-6.6/780-17-v6.9-r8169-add-missing-conditional-compiling-for-call-to-.patch @@ -19,7 +19,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -5071,7 +5071,8 @@ static void rtl_remove_one(struct pci_de +@@ -5077,7 +5077,8 @@ static void rtl_remove_one(struct pci_de cancel_work_sync(&tp->wk.work); diff --git a/target/linux/generic/backport-6.6/780-20-v6.11-r8169-disable-interrupt-source-RxOverflow.patch b/target/linux/generic/backport-6.6/780-20-v6.11-r8169-disable-interrupt-source-RxOverflow.patch index fc10a3ff143076..9ded598665af0c 100644 --- a/target/linux/generic/backport-6.6/780-20-v6.11-r8169-disable-interrupt-source-RxOverflow.patch +++ b/target/linux/generic/backport-6.6/780-20-v6.11-r8169-disable-interrupt-source-RxOverflow.patch @@ -18,7 +18,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -5112,12 +5112,10 @@ static void rtl_set_irq_mask(struct rtl8 +@@ -5118,12 +5118,10 @@ static void rtl_set_irq_mask(struct rtl8 tp->irq_mask = RxOK | RxErr | TxOK | TxErr | LinkChg; if (tp->mac_version <= RTL_GIGA_MAC_VER_06) diff --git a/target/linux/generic/backport-6.6/780-22-v6.12-r8169-add-support-for-RTL8126A-rev.b.patch b/target/linux/generic/backport-6.6/780-22-v6.12-r8169-add-support-for-RTL8126A-rev.b.patch index a825627e743919..3360b61fad9834 100644 --- a/target/linux/generic/backport-6.6/780-22-v6.12-r8169-add-support-for-RTL8126A-rev.b.patch +++ b/target/linux/generic/backport-6.6/780-22-v6.12-r8169-add-support-for-RTL8126A-rev.b.patch @@ -215,7 +215,7 @@ Signed-off-by: Jakub Kicinski rtl_enable_rxdvgate(tp); fsleep(2000); break; -@@ -4252,7 +4264,7 @@ static unsigned int rtl_quirk_packet_pad +@@ -4258,7 +4270,7 @@ static unsigned int rtl_quirk_packet_pad switch (tp->mac_version) { case RTL_GIGA_MAC_VER_34: @@ -224,7 +224,7 @@ Signed-off-by: Jakub Kicinski padto = max_t(unsigned int, padto, ETH_ZLEN); break; default: -@@ -5288,7 +5300,7 @@ static void rtl_hw_initialize(struct rtl +@@ -5294,7 +5306,7 @@ static void rtl_hw_initialize(struct rtl case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_48: rtl_hw_init_8168g(tp); break; diff --git a/target/linux/generic/config-6.6 b/target/linux/generic/config-6.6 index 105dc0d344fa82..2ea1b7910388f5 100644 --- a/target/linux/generic/config-6.6 +++ b/target/linux/generic/config-6.6 @@ -7547,6 +7547,7 @@ CONFIG_ZONE_DMA=y # CONFIG_ZRAM_DEF_COMP_ZSTD is not set # CONFIG_ZRAM_MEMORY_TRACKING is not set # CONFIG_ZRAM_MULTI_COMP is not set +# CONFIG_ZRAM_TRACK_ENTRY_ACTIME is not set # CONFIG_ZSMALLOC is not set CONFIG_ZSMALLOC_CHAIN_SIZE=8 # CONFIG_ZSWAP is not set diff --git a/target/linux/generic/hack-6.6/259-regmap_dynamic.patch b/target/linux/generic/hack-6.6/259-regmap_dynamic.patch index cb93c96da60da2..4f6dca7127b8e8 100644 --- a/target/linux/generic/hack-6.6/259-regmap_dynamic.patch +++ b/target/linux/generic/hack-6.6/259-regmap_dynamic.patch @@ -137,7 +137,7 @@ Signed-off-by: Felix Fietkau #include #include #include -@@ -3470,3 +3471,5 @@ static int __init regmap_initcall(void) +@@ -3483,3 +3484,5 @@ static int __init regmap_initcall(void) return 0; } postcore_initcall(regmap_initcall); diff --git a/target/linux/generic/hack-6.6/650-netfilter-add-xt_FLOWOFFLOAD-target.patch b/target/linux/generic/hack-6.6/650-netfilter-add-xt_FLOWOFFLOAD-target.patch index eca611da7e8375..58b37db2fb9ce1 100644 --- a/target/linux/generic/hack-6.6/650-netfilter-add-xt_FLOWOFFLOAD-target.patch +++ b/target/linux/generic/hack-6.6/650-netfilter-add-xt_FLOWOFFLOAD-target.patch @@ -758,7 +758,7 @@ Signed-off-by: Felix Fietkau #include #include #include -@@ -377,8 +376,7 @@ flow_offload_lookup(struct nf_flowtable +@@ -373,8 +372,7 @@ flow_offload_lookup(struct nf_flowtable } EXPORT_SYMBOL_GPL(flow_offload_lookup); @@ -768,7 +768,7 @@ Signed-off-by: Felix Fietkau void (*iter)(struct nf_flowtable *flowtable, struct flow_offload *flow, void *data), void *data) -@@ -439,6 +437,7 @@ static void nf_flow_offload_gc_step(stru +@@ -435,6 +433,7 @@ static void nf_flow_offload_gc_step(stru nf_flow_offload_stats(flow_table, flow); } } diff --git a/target/linux/generic/hack-6.6/790-SFP-GE-T-ignore-TX_FAULT.patch b/target/linux/generic/hack-6.6/790-SFP-GE-T-ignore-TX_FAULT.patch index 7733b45520874c..1d6bc6ee079707 100644 --- a/target/linux/generic/hack-6.6/790-SFP-GE-T-ignore-TX_FAULT.patch +++ b/target/linux/generic/hack-6.6/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 -@@ -471,6 +471,9 @@ static const struct sfp_quirk sfp_quirks +@@ -472,6 +472,9 @@ static const struct sfp_quirk sfp_quirks // FS 2.5G Base-T SFP_QUIRK_M("FS", "SFP-2.5G-T", sfp_quirk_oem_2_5g), @@ -36,7 +36,7 @@ Signed-off-by: Daniel Golle // Lantech 8330-262D-E can operate at 2500base-X, but incorrectly report // 2500MBd NRZ in their EEPROM SFP_QUIRK_M("Lantech", "8330-262D-E", sfp_quirk_2500basex), -@@ -2589,7 +2592,8 @@ static void sfp_sm_main(struct sfp *sfp, +@@ -2590,7 +2593,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, @@ -46,7 +46,7 @@ Signed-off-by: Daniel Golle } else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR) { init_done: /* Create mdiobus and start trying for PHY */ -@@ -2843,10 +2847,12 @@ static void sfp_check_state(struct sfp * +@@ -2844,10 +2848,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/generic/hack-6.6/930-Revert-Revert-Revert-driver-core-Set-fw_devlink-on-b.patch b/target/linux/generic/hack-6.6/930-Revert-Revert-Revert-driver-core-Set-fw_devlink-on-b.patch index 1c5fb11ff540cd..85a19027fda7f6 100644 --- a/target/linux/generic/hack-6.6/930-Revert-Revert-Revert-driver-core-Set-fw_devlink-on-b.patch +++ b/target/linux/generic/hack-6.6/930-Revert-Revert-Revert-driver-core-Set-fw_devlink-on-b.patch @@ -19,7 +19,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/base/core.c +++ b/drivers/base/core.c -@@ -1657,7 +1657,7 @@ static void device_links_purge(struct de +@@ -1658,7 +1658,7 @@ static void device_links_purge(struct de #define FW_DEVLINK_FLAGS_RPM (FW_DEVLINK_FLAGS_ON | \ DL_FLAG_PM_RUNTIME) diff --git a/target/linux/generic/pending-6.6/456-mmc-core-set-card-fwnode_handle.patch b/target/linux/generic/pending-6.6/456-mmc-core-set-card-fwnode_handle.patch index 2ee170d47b855f..323c208e7327b7 100644 --- a/target/linux/generic/pending-6.6/456-mmc-core-set-card-fwnode_handle.patch +++ b/target/linux/generic/pending-6.6/456-mmc-core-set-card-fwnode_handle.patch @@ -12,7 +12,7 @@ Signed-off-by: Daniel Golle --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c -@@ -364,6 +364,8 @@ int mmc_add_card(struct mmc_card *card) +@@ -366,6 +366,8 @@ int mmc_add_card(struct mmc_card *card) mmc_add_card_debugfs(card); card->dev.of_node = mmc_of_find_child_device(card->host, 0); diff --git a/target/linux/generic/pending-6.6/700-netfilter-nft_flow_offload-handle-netdevice-events-f.patch b/target/linux/generic/pending-6.6/700-netfilter-nft_flow_offload-handle-netdevice-events-f.patch index 6b93f47772e13b..750ca29287ab2f 100644 --- a/target/linux/generic/pending-6.6/700-netfilter-nft_flow_offload-handle-netdevice-events-f.patch +++ b/target/linux/generic/pending-6.6/700-netfilter-nft_flow_offload-handle-netdevice-events-f.patch @@ -10,7 +10,7 @@ Signed-off-by: Pablo Neira Ayuso --- a/net/netfilter/nf_flow_table_core.c +++ b/net/netfilter/nf_flow_table_core.c -@@ -662,6 +662,23 @@ static struct pernet_operations nf_flow_ +@@ -658,6 +658,23 @@ static struct pernet_operations nf_flow_ .exit_batch = nf_flow_table_pernet_exit, }; @@ -34,7 +34,7 @@ Signed-off-by: Pablo Neira Ayuso static int __init nf_flow_table_module_init(void) { int ret; -@@ -674,8 +691,14 @@ static int __init nf_flow_table_module_i +@@ -670,8 +687,14 @@ static int __init nf_flow_table_module_i if (ret) goto out_offload; @@ -49,7 +49,7 @@ Signed-off-by: Pablo Neira Ayuso out_offload: unregister_pernet_subsys(&nf_flow_table_net_ops); return ret; -@@ -683,6 +706,7 @@ out_offload: +@@ -679,6 +702,7 @@ out_offload: static void __exit nf_flow_table_module_exit(void) { diff --git a/target/linux/mediatek/patches-6.6/251-v6.8-watchdog-mediatek-mt7988-add-wdt-support.patch b/target/linux/mediatek/patches-6.6/251-v6.8-watchdog-mediatek-mt7988-add-wdt-support.patch index b89b385eeb466f..c399b768b00392 100644 --- a/target/linux/mediatek/patches-6.6/251-v6.8-watchdog-mediatek-mt7988-add-wdt-support.patch +++ b/target/linux/mediatek/patches-6.6/251-v6.8-watchdog-mediatek-mt7988-add-wdt-support.patch @@ -106,7 +106,7 @@ Signed-off-by: Wim Van Sebroeck spin_unlock_irqrestore(&data->lock, flags); return 0; -@@ -406,6 +445,8 @@ static int mtk_wdt_probe(struct platform +@@ -412,6 +451,8 @@ static int mtk_wdt_probe(struct platform wdt_data->toprgu_sw_rst_num); if (err) return err; @@ -115,7 +115,7 @@ Signed-off-by: Wim Van Sebroeck } mtk_wdt->disable_wdt_extrst = -@@ -444,6 +485,7 @@ static const struct of_device_id mtk_wdt +@@ -450,6 +491,7 @@ static const struct of_device_id mtk_wdt { .compatible = "mediatek,mt6589-wdt" }, { .compatible = "mediatek,mt6795-wdt", .data = &mt6795_data }, { .compatible = "mediatek,mt7986-wdt", .data = &mt7986_data }, diff --git a/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch b/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch index efc2763880f04e..c98aaf9442bb7d 100644 --- a/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch +++ b/target/linux/ramips/patches-6.6/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 -@@ -3229,6 +3229,18 @@ static const struct usb_device_id uvc_id +@@ -3249,6 +3249,18 @@ static const struct usb_device_id uvc_id .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) }, diff --git a/target/linux/realtek/patches-6.6/710-net-phy-sfp-re-probe-modules-on-DEV_UP-event.patch b/target/linux/realtek/patches-6.6/710-net-phy-sfp-re-probe-modules-on-DEV_UP-event.patch index d7a232327d8b15..4e1a21aa715017 100644 --- a/target/linux/realtek/patches-6.6/710-net-phy-sfp-re-probe-modules-on-DEV_UP-event.patch +++ b/target/linux/realtek/patches-6.6/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 -@@ -2415,6 +2415,13 @@ static void sfp_sm_module(struct sfp *sf +@@ -2416,6 +2416,13 @@ static void sfp_sm_module(struct sfp *sf return; } diff --git a/target/linux/realtek/patches-6.6/714-net-phy-sfp-add-support-for-SMBus.patch b/target/linux/realtek/patches-6.6/714-net-phy-sfp-add-support-for-SMBus.patch index 06d264d805e347..76e2d765069b55 100644 --- a/target/linux/realtek/patches-6.6/714-net-phy-sfp-add-support-for-SMBus.patch +++ b/target/linux/realtek/patches-6.6/714-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 -@@ -662,10 +662,64 @@ static int sfp_i2c_write(struct sfp *sfp +@@ -663,10 +663,64 @@ static int sfp_i2c_write(struct sfp *sfp return ret == ARRAY_SIZE(msgs) ? len : 0; } @@ -77,7 +77,7 @@ Signed-off-by: Antoine Tenart sfp->i2c = i2c; sfp->read = sfp_i2c_read; -@@ -697,6 +751,29 @@ static int sfp_i2c_mdiobus_create(struct +@@ -698,6 +752,29 @@ static int sfp_i2c_mdiobus_create(struct return 0; } @@ -107,7 +107,7 @@ Signed-off-by: Antoine Tenart static void sfp_i2c_mdiobus_destroy(struct sfp *sfp) { mdiobus_unregister(sfp->i2c_mii); -@@ -1870,8 +1947,15 @@ static void sfp_sm_fault(struct sfp *sfp +@@ -1871,8 +1948,15 @@ static void sfp_sm_fault(struct sfp *sfp static int sfp_sm_add_mdio_bus(struct sfp *sfp) { diff --git a/target/linux/rockchip/patches-6.6/034-v6.7-usb-dwc3-add-optional-PHY-interface-clocks.patch b/target/linux/rockchip/patches-6.6/034-v6.7-usb-dwc3-add-optional-PHY-interface-clocks.patch index 0b9e47da3c9879..00ca1d40139873 100644 --- a/target/linux/rockchip/patches-6.6/034-v6.7-usb-dwc3-add-optional-PHY-interface-clocks.patch +++ b/target/linux/rockchip/patches-6.6/034-v6.7-usb-dwc3-add-optional-PHY-interface-clocks.patch @@ -71,7 +71,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h -@@ -997,6 +997,8 @@ struct dwc3_scratchpad_array { +@@ -998,6 +998,8 @@ struct dwc3_scratchpad_array { * @bus_clk: clock for accessing the registers * @ref_clk: reference clock * @susp_clk: clock used when the SS phy is in low power (S3) state @@ -80,7 +80,7 @@ Signed-off-by: Greg Kroah-Hartman * @reset: reset control * @regs: base address for our registers * @regs_size: address space size -@@ -1169,6 +1171,8 @@ struct dwc3 { +@@ -1170,6 +1172,8 @@ struct dwc3 { struct clk *bus_clk; struct clk *ref_clk; struct clk *susp_clk; diff --git a/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch b/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch index febc6bac4e8500..847b8e20ff49a7 100644 --- a/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch +++ b/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch @@ -160,7 +160,7 @@ Signed-off-by: minda.chen } --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c -@@ -3672,7 +3672,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3667,7 +3667,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd * full_len = urb->transfer_buffer_length; /* If we have scatter/gather list, we use it. */ @@ -277,16 +277,16 @@ Signed-off-by: minda.chen /* There is one xhci_hcd structure per controller */ struct xhci_hcd { struct usb_hcd *main_hcd; -@@ -1661,6 +1668,8 @@ struct xhci_hcd { - #define XHCI_WRITE_64_HI_LO BIT_ULL(47) +@@ -1662,6 +1669,8 @@ struct xhci_hcd { #define XHCI_CDNS_SCTX_QUIRK BIT_ULL(48) + #define XHCI_ETRON_HOST BIT_ULL(49) +#define XHCI_LOCAL_BUFFER BIT_ULL(63) + unsigned int num_active_eps; unsigned int limit_active_eps; struct xhci_port *hw_ports; -@@ -1690,6 +1699,8 @@ struct xhci_hcd { +@@ -1691,6 +1700,8 @@ struct xhci_hcd { struct list_head regset_list; void *dbc; diff --git a/target/linux/starfive/patches-6.6/1000-serial-8250_dw-Add-starfive-jh7100-hsuart-compatible.patch b/target/linux/starfive/patches-6.6/1000-serial-8250_dw-Add-starfive-jh7100-hsuart-compatible.patch index 463c7eb7b667fc..a094e4b5d69187 100644 --- a/target/linux/starfive/patches-6.6/1000-serial-8250_dw-Add-starfive-jh7100-hsuart-compatible.patch +++ b/target/linux/starfive/patches-6.6/1000-serial-8250_dw-Add-starfive-jh7100-hsuart-compatible.patch @@ -15,11 +15,11 @@ Signed-off-by: Emil Renner Berthing --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c -@@ -802,6 +802,7 @@ static const struct of_device_id dw8250_ - { .compatible = "cavium,octeon-3860-uart", .data = &dw8250_octeon_3860_data }, +@@ -803,6 +803,7 @@ static const struct of_device_id dw8250_ { .compatible = "marvell,armada-38x-uart", .data = &dw8250_armada_38x_data }, { .compatible = "renesas,rzn1-uart", .data = &dw8250_renesas_rzn1_data }, -+ { .compatible = "starfive,jh7100-hsuart", .data = &dw8250_starfive_jh7100_data }, - { .compatible = "starfive,jh7100-uart", .data = &dw8250_starfive_jh7100_data }, + { .compatible = "sophgo,sg2044-uart", .data = &dw8250_skip_set_rate_data }, ++ { .compatible = "starfive,jh7100-hsuart", .data = &dw8250_skip_set_rate_data }, + { .compatible = "starfive,jh7100-uart", .data = &dw8250_skip_set_rate_data }, { /* Sentinel */ } }; From 5415fb06d2c691c2ddd1c4ca0b8447991a687e2c Mon Sep 17 00:00:00 2001 From: Andrew MacIntyre Date: Fri, 29 Nov 2024 17:06:02 +1100 Subject: [PATCH 213/877] lantiq/xrx200: move 8M flash devices to a small flash subtarget Images for xrx200 8M flash are either not building due to image size (TD-W8970, TD-W8980) or building such that the available free space in the overlayfs is too little to be useful. To keep images for these devices buildable, move them into a small flash variant of the xrx200 subtarget. As these devices are NOR flash only, remove NAND and UBI references from the kernel config to gain some additional image size reduction. The apparent 8M flash devices Arcadyan VGV7510KW22-brn, Arcadyan VGV7519-brn and Lantiq Easy80920-nor seem to exist in order to create special "factory" installation images for these devices (which actually have larger flash: 16MB for the Arcardyan devices; 64MB for the Lantiq device). As a considerable amount of surgery would appear to be required to the uboot-lantiq package structure to separate the "factory" from the "sysupgrade" device recipes for these devices they remain in the xrx200 target - if factory images aren't now created, 23.05.x factory images should suffice for initial installation. Tested on: Netgear DM200, TP-Link TD-W8980, AVM Fritz7490 (xrx200 subtarget: image build only) Fixes: https://github.com/openwrt/openwrt/issues/16761 Signed-off-by: Andrew MacIntyre Link: https://github.com/openwrt/openwrt/pull/17113 (cherry picked from commit e63326e26a82cb083eec602b3a2f71d4cd8e2ea4) Link: https://github.com/openwrt/openwrt/pull/17303 Signed-off-by: Hauke Mehrtens --- .../lantiq/dsl-vrx200-firmware-xdsl/Makefile | 8 +- package/kernel/lantiq/ltq-atm/Makefile | 2 +- package/kernel/lantiq/ltq-deu/Makefile | 8 +- package/kernel/lantiq/ltq-ptm/Makefile | 10 +-- package/kernel/lantiq/ltq-vdsl-fw/Makefile | 2 +- .../kernel/lantiq/ltq-vdsl-vr9-mei/Makefile | 4 +- package/kernel/lantiq/ltq-vdsl-vr9/Makefile | 2 +- package/kernel/lantiq/ltq-vectoring/Makefile | 4 +- .../network/config/ltq-vdsl-vr9-app/Makefile | 2 +- target/linux/lantiq/Makefile | 2 +- target/linux/lantiq/image/Makefile | 6 ++ target/linux/lantiq/image/tp-link.mk | 28 ------ target/linux/lantiq/image/tp-link_legacy.mk | 46 ++++++++++ target/linux/lantiq/image/vr9.mk | 37 -------- target/linux/lantiq/image/vr9_legacy.mk | 43 ++++++++++ .../xrx200/base-files/etc/board.d/01_leds | 3 - .../xrx200/base-files/etc/board.d/02_network | 22 +---- .../etc/hotplug.d/firmware/12-ath9k-eeprom | 4 - .../etc/uci-defaults/01_led_migration | 2 - .../base-files/etc/board.d/01_leds | 34 ++++++++ .../base-files/etc/board.d/02_network | 75 ++++++++++++++++ .../base-files/etc/board.d/05_compat-version | 18 ++++ .../etc/hotplug.d/firmware/12-ath9k-eeprom | 23 +++++ .../etc/uci-defaults/01_led_migration | 31 +++++++ .../base-files/lib/upgrade/platform.sh | 16 ++++ target/linux/lantiq/xrx200_legacy/config-6.6 | 86 +++++++++++++++++++ .../xrx200_legacy/profiles/00-default.mk | 9 ++ target/linux/lantiq/xrx200_legacy/target.mk | 22 +++++ 28 files changed, 432 insertions(+), 117 deletions(-) create mode 100644 target/linux/lantiq/image/tp-link_legacy.mk create mode 100644 target/linux/lantiq/image/vr9_legacy.mk create mode 100644 target/linux/lantiq/xrx200_legacy/base-files/etc/board.d/01_leds create mode 100644 target/linux/lantiq/xrx200_legacy/base-files/etc/board.d/02_network create mode 100644 target/linux/lantiq/xrx200_legacy/base-files/etc/board.d/05_compat-version create mode 100644 target/linux/lantiq/xrx200_legacy/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom create mode 100644 target/linux/lantiq/xrx200_legacy/base-files/etc/uci-defaults/01_led_migration create mode 100755 target/linux/lantiq/xrx200_legacy/base-files/lib/upgrade/platform.sh create mode 100644 target/linux/lantiq/xrx200_legacy/config-6.6 create mode 100644 target/linux/lantiq/xrx200_legacy/profiles/00-default.mk create mode 100644 target/linux/lantiq/xrx200_legacy/target.mk diff --git a/package/firmware/lantiq/dsl-vrx200-firmware-xdsl/Makefile b/package/firmware/lantiq/dsl-vrx200-firmware-xdsl/Makefile index 37db950beae54f..b6e1d11efc60a6 100644 --- a/package/firmware/lantiq/dsl-vrx200-firmware-xdsl/Makefile +++ b/package/firmware/lantiq/dsl-vrx200-firmware-xdsl/Makefile @@ -40,7 +40,7 @@ define Package/dsl-vrx200-firmware-xdsl-a CATEGORY:=Firmware TITLE:=VRX200 / VR9 CPE xDSL Annex A firmware URL:=http://www.lantiq.com/ - DEPENDS:=@TARGET_lantiq_xrx200 + DEPENDS:=@(TARGET_lantiq_xrx200||TARGET_lantiq_xrx200_legacy) endef define Package/dsl-vrx200-firmware-xdsl-a/description @@ -52,7 +52,7 @@ define Package/dsl-vrx200-firmware-xdsl-b CATEGORY:=Firmware TITLE:=VRX200 / VR9 CPE xDSL Annex B firmware URL:=http://www.lantiq.com/ - DEPENDS:=@TARGET_lantiq_xrx200 + DEPENDS:=@(TARGET_lantiq_xrx200||TARGET_lantiq_xrx200_legacy) endef define Package/dsl-vrx200-firmware-xdsl-b/description @@ -64,7 +64,7 @@ define Package/dsl-vrx200-firmware-xdsl-a-patch CATEGORY:=Firmware TITLE:=VRX200 / VR9 CPE xDSL Annex B to Annex A firmware patch URL:=http://www.lantiq.com/ - DEPENDS:=@TARGET_lantiq_xrx200 +dsl-vrx200-firmware-xdsl-b +bspatch + DEPENDS:=@(TARGET_lantiq_xrx200||TARGET_lantiq_xrx200_legacy) +dsl-vrx200-firmware-xdsl-b +bspatch endef define Package/dsl-vrx200-firmware-xdsl-a-patch/description @@ -76,7 +76,7 @@ define Package/dsl-vrx200-firmware-xdsl-b-patch CATEGORY:=Firmware TITLE:=VRX200 / VR9 CPE xDSL Annex A to Annex B firmware patch URL:=http://www.lantiq.com/ - DEPENDS:=@TARGET_lantiq_xrx200 +dsl-vrx200-firmware-xdsl-a +bspatch + DEPENDS:=@(TARGET_lantiq_xrx200||TARGET_lantiq_xrx200_legacy) +dsl-vrx200-firmware-xdsl-a +bspatch endef define Package/dsl-vrx200-firmware-xdsl-b-patch/description diff --git a/package/kernel/lantiq/ltq-atm/Makefile b/package/kernel/lantiq/ltq-atm/Makefile index b81f3bb2938224..ca19c5052e9b24 100644 --- a/package/kernel/lantiq/ltq-atm/Makefile +++ b/package/kernel/lantiq/ltq-atm/Makefile @@ -33,7 +33,7 @@ endef KernelPackage/ltq-atm-danube=$(call KernelPackage/ltq-atm-template,danube,(TARGET_lantiq_xway||TARGET_lantiq_xway_legacy)) KernelPackage/ltq-atm-ar9=$(call KernelPackage/ltq-atm-template,ar9,TARGET_lantiq_xway) KernelPackage/ltq-atm-ase=$(call KernelPackage/ltq-atm-template,ase,TARGET_lantiq_ase) -KernelPackage/ltq-atm-vr9=$(call KernelPackage/ltq-atm-template,vr9,TARGET_lantiq_xrx200) +KernelPackage/ltq-atm-vr9=$(call KernelPackage/ltq-atm-template,vr9,(TARGET_lantiq_xrx200||TARGET_lantiq_xrx200_legacy)) define Build/Configure endef diff --git a/package/kernel/lantiq/ltq-deu/Makefile b/package/kernel/lantiq/ltq-deu/Makefile index 4e8127afabb986..96414bf186f696 100644 --- a/package/kernel/lantiq/ltq-deu/Makefile +++ b/package/kernel/lantiq/ltq-deu/Makefile @@ -21,14 +21,14 @@ define KernelPackage/ltq-deu-template TITLE:=deu driver for $(1) URL:=http://www.lantiq.com/ VARIANT:=$(1) - DEPENDS:=@TARGET_lantiq_$(2) +kmod-crypto-manager +kmod-crypto-des + DEPENDS:=@$(2) +kmod-crypto-manager +kmod-crypto-des FILES:=$(PKG_BUILD_DIR)/ltq_deu_$(1).ko AUTOLOAD:=$(call AutoProbe,ltq_deu_$(1)) endef -KernelPackage/ltq-deu-danube=$(call KernelPackage/ltq-deu-template,danube,xway) -KernelPackage/ltq-deu-ar9=$(call KernelPackage/ltq-deu-template,ar9,xway) -KernelPackage/ltq-deu-vr9=$(call KernelPackage/ltq-deu-template,vr9,xrx200) +KernelPackage/ltq-deu-danube=$(call KernelPackage/ltq-deu-template,danube,TARGET_lantiq_xway) +KernelPackage/ltq-deu-ar9=$(call KernelPackage/ltq-deu-template,ar9,TARGET_lantiq_xway) +KernelPackage/ltq-deu-vr9=$(call KernelPackage/ltq-deu-template,vr9,(TARGET_lantiq_xrx200||TARGET_lantiq_xrx200_legacy)) define Build/Configure endef diff --git a/package/kernel/lantiq/ltq-ptm/Makefile b/package/kernel/lantiq/ltq-ptm/Makefile index 03b121887470d0..c3ab47c1b3e5fb 100644 --- a/package/kernel/lantiq/ltq-ptm/Makefile +++ b/package/kernel/lantiq/ltq-ptm/Makefile @@ -22,7 +22,7 @@ define KernelPackage/ltq-ptm-template TITLE:=ptm driver for $(1) URL:=http://www.lantiq.com/ VARIANT:=$(1) - DEPENDS:=@TARGET_lantiq_$(2) + DEPENDS:=@$(2) ifeq ($(1),vr9) DEPENDS+= +PACKAGE_kmod-ltq-ptm-$(1):kmod-ltq-vdsl-vr9-mei else @@ -34,10 +34,10 @@ endif FILES:=$(PKG_BUILD_DIR)/ltq_ptm_$(1).ko endef -KernelPackage/ltq-ptm-danube=$(call KernelPackage/ltq-ptm-template,danube,xway) -KernelPackage/ltq-ptm-ar9=$(call KernelPackage/ltq-ptm-template,ar9,xway) -KernelPackage/ltq-ptm-ase=$(call KernelPackage/ltq-ptm-template,ase,ase) -KernelPackage/ltq-ptm-vr9=$(call KernelPackage/ltq-ptm-template,vr9,xrx200) +KernelPackage/ltq-ptm-danube=$(call KernelPackage/ltq-ptm-template,danube,TARGET_lantiq_xway) +KernelPackage/ltq-ptm-ar9=$(call KernelPackage/ltq-ptm-template,ar9,TARGET_lantiq_xway) +KernelPackage/ltq-ptm-ase=$(call KernelPackage/ltq-ptm-template,ase,TARGET_lantiq_ase) +KernelPackage/ltq-ptm-vr9=$(call KernelPackage/ltq-ptm-template,vr9,(TARGET_lantiq_xrx200||TARGET_lantiq_xrx200_legacy)) define Build/Configure endef diff --git a/package/kernel/lantiq/ltq-vdsl-fw/Makefile b/package/kernel/lantiq/ltq-vdsl-fw/Makefile index 88883ffdee0f4a..61833e018c28db 100644 --- a/package/kernel/lantiq/ltq-vdsl-fw/Makefile +++ b/package/kernel/lantiq/ltq-vdsl-fw/Makefile @@ -19,7 +19,7 @@ define Package/ltq-vdsl-vr9-vectoring-fw-installer TITLE:=VDSL2 Vectoring Firmware installer SECTION:=net CATEGORY:=Network - DEPENDS:=@TARGET_lantiq_xrx200 +kmod-ltq-vdsl-vr9 + DEPENDS:=@(TARGET_lantiq_xrx200||TARGET_lantiq_xrx200_legacy) +kmod-ltq-vdsl-vr9 endef define Build/Prepare diff --git a/package/kernel/lantiq/ltq-vdsl-vr9-mei/Makefile b/package/kernel/lantiq/ltq-vdsl-vr9-mei/Makefile index e9c5a681fd0098..9b3dac299feac1 100644 --- a/package/kernel/lantiq/ltq-vdsl-vr9-mei/Makefile +++ b/package/kernel/lantiq/ltq-vdsl-vr9-mei/Makefile @@ -29,7 +29,7 @@ define KernelPackage/ltq-vdsl-vr9-mei TITLE:=mei driver for vdsl SECTION:=sys SUBMENU:=Network Devices - DEPENDS:=@TARGET_lantiq_xrx200 +kmod-ltq-ifxos +kmod-ltq-vectoring + DEPENDS:=@(TARGET_lantiq_xrx200||TARGET_lantiq_xrx200_legacy) +kmod-ltq-ifxos +kmod-ltq-vectoring FILES:=$(PKG_BUILD_DIR)/src/drv_mei_cpe.ko AUTOLOAD:=$(call AutoLoad,50,drv_mei_cpe) endef @@ -44,7 +44,7 @@ define Package/ltq-vdsl-vr9-mei-test CATEGORY:=Network TITLE:=Lantiq mei driver test tool URL:=http://www.lantiq.com/ - DEPENDS:=@TARGET_lantiq_xrx200 + DEPENDS:=@(TARGET_lantiq_xrx200||TARGET_lantiq_xrx200_legacy) endef define Package/ltq-vdsl-vr9-mei-test/description diff --git a/package/kernel/lantiq/ltq-vdsl-vr9/Makefile b/package/kernel/lantiq/ltq-vdsl-vr9/Makefile index ebcb935a739dc4..5a53c050d4bfc0 100644 --- a/package/kernel/lantiq/ltq-vdsl-vr9/Makefile +++ b/package/kernel/lantiq/ltq-vdsl-vr9/Makefile @@ -29,7 +29,7 @@ define KernelPackage/ltq-vdsl-vr9 TITLE:=vdsl driver SECTION:=sys SUBMENU:=Network Devices - DEPENDS:=@TARGET_lantiq_xrx200 +kmod-ltq-vdsl-vr9-mei + DEPENDS:=@(TARGET_lantiq_xrx200||TARGET_lantiq_xrx200_legacy) +kmod-ltq-vdsl-vr9-mei FILES:=$(PKG_BUILD_DIR)/src/drv_dsl_cpe_api.ko AUTOLOAD:=$(call AutoLoad,51,drv_dsl_cpe_api) endef diff --git a/package/kernel/lantiq/ltq-vectoring/Makefile b/package/kernel/lantiq/ltq-vectoring/Makefile index 6076df77428091..ea177942b48c59 100644 --- a/package/kernel/lantiq/ltq-vectoring/Makefile +++ b/package/kernel/lantiq/ltq-vectoring/Makefile @@ -20,7 +20,7 @@ define KernelPackage/ltq-vectoring CATEGORY:=Kernel modules SUBMENU:=Network Devices TITLE:=driver for sending vectoring error samples - DEPENDS:=@TARGET_lantiq_xrx200 + DEPENDS:=@(TARGET_lantiq_xrx200||TARGET_lantiq_xrx200_legacy) FILES:=$(PKG_BUILD_DIR)/$(MAKE_PATH)/ltq_vectoring.ko AUTOLOAD:=$(call AutoLoad,49,ltq_vectoring) endef @@ -38,7 +38,7 @@ define KernelPackage/ltq-vectoring-test CATEGORY:=Kernel modules SUBMENU:=Network Devices TITLE:=driver for testing the vectoring driver - DEPENDS:=@TARGET_lantiq_xrx200 +kmod-ltq-vectoring + DEPENDS:=@(TARGET_lantiq_xrx200||TARGET_lantiq_xrx200_legacy) +kmod-ltq-vectoring FILES:=$(PKG_BUILD_DIR)/$(MAKE_PATH)/ltq_vectoring_test.ko endef diff --git a/package/network/config/ltq-vdsl-vr9-app/Makefile b/package/network/config/ltq-vdsl-vr9-app/Makefile index 51b88231f7e4b8..a73cd4ae62ff74 100644 --- a/package/network/config/ltq-vdsl-vr9-app/Makefile +++ b/package/network/config/ltq-vdsl-vr9-app/Makefile @@ -29,7 +29,7 @@ define Package/ltq-vdsl-vr9-app CATEGORY:=Network TITLE:=Lantiq VDSL userland tool URL:=http://www.lantiq.com/ - DEPENDS:=@TARGET_lantiq_xrx200 +libpthread +librt +ltq-dsl-base +libubox +libubus + DEPENDS:=@(TARGET_lantiq_xrx200||TARGET_lantiq_xrx200_legacy) +libpthread +librt +ltq-dsl-base +libubox +libubus PROVIDES:=ltq-dsl-app endef diff --git a/target/linux/lantiq/Makefile b/target/linux/lantiq/Makefile index 69fa8276e754c2..e7a251a505cc02 100644 --- a/target/linux/lantiq/Makefile +++ b/target/linux/lantiq/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk BOARD:=lantiq BOARDNAME:=Lantiq FEATURES:=squashfs -SUBTARGETS:=xrx200 xway xway_legacy falcon ase +SUBTARGETS:=xrx200 xrx200_legacy xway xway_legacy falcon ase KERNEL_PATCHVER:=6.6 diff --git a/target/linux/lantiq/image/Makefile b/target/linux/lantiq/image/Makefile index 9fdb949392a156..307d47a979e55d 100644 --- a/target/linux/lantiq/image/Makefile +++ b/target/linux/lantiq/image/Makefile @@ -162,6 +162,12 @@ include danube.mk include ar9.mk endif +ifeq ($(SUBTARGET),xrx200_legacy) +DEFAULT_SOC := vr9 +include tp-link_legacy.mk +include vr9_legacy.mk +endif + ifeq ($(SUBTARGET),xrx200) DEFAULT_SOC := vr9 include tp-link.mk diff --git a/target/linux/lantiq/image/tp-link.mk b/target/linux/lantiq/image/tp-link.mk index 751f61589de8cf..c2f5b95dd6a015 100644 --- a/target/linux/lantiq/image/tp-link.mk +++ b/target/linux/lantiq/image/tp-link.mk @@ -17,34 +17,6 @@ define Device/lantiqTpLink check-size | append-metadata endef -define Device/tplink_tdw8970 - $(Device/dsa-migration) - $(Device/lantiqTpLink) - DEVICE_MODEL := TD-W8970 - DEVICE_VARIANT := v1 - TPLINK_FLASHLAYOUT := 8Mltq - TPLINK_HWID := 0x89700001 - TPLINK_HWREV := 1 - IMAGE_SIZE := 7680k - DEVICE_PACKAGES:= kmod-ath9k wpad-basic-mbedtls kmod-usb-dwc2 kmod-usb-ledtrig-usbport - SUPPORTED_DEVICES += TDW8970 -endef -TARGET_DEVICES += tplink_tdw8970 - -define Device/tplink_tdw8980 - $(Device/dsa-migration) - $(Device/lantiqTpLink) - DEVICE_MODEL := TD-W8980 - DEVICE_VARIANT := v1 - TPLINK_FLASHLAYOUT := 8Mltq - TPLINK_HWID := 0x89800001 - TPLINK_HWREV := 14 - IMAGE_SIZE := 7680k - DEVICE_PACKAGES:= kmod-ath9k kmod-owl-loader wpad-basic-mbedtls kmod-usb-dwc2 kmod-usb-ledtrig-usbport - SUPPORTED_DEVICES += TDW8980 -endef -TARGET_DEVICES += tplink_tdw8980 - define Device/tplink_vr200 $(Device/dsa-migration) $(Device/lantiqTpLink) diff --git a/target/linux/lantiq/image/tp-link_legacy.mk b/target/linux/lantiq/image/tp-link_legacy.mk new file mode 100644 index 00000000000000..d9bcd35d10f0de --- /dev/null +++ b/target/linux/lantiq/image/tp-link_legacy.mk @@ -0,0 +1,46 @@ +DEVICE_VARS += TPLINK_FLASHLAYOUT TPLINK_HWID TPLINK_HWREV TPLINK_HWREVADD TPLINK_HVERSION + +define Device/dsa-migration + DEVICE_COMPAT_VERSION := 1.1 + DEVICE_COMPAT_MESSAGE := Config cannot be migrated from swconfig to DSA +endef + +define Device/lantiqTpLink + DEVICE_VENDOR := TP-Link + TPLINK_HWREVADD := 0 + TPLINK_HVERSION := 2 + KERNEL := kernel-bin | append-dtb | lzma + KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | \ + tplink-v2-header -s -V "ver. 1.0" + IMAGES := sysupgrade.bin + IMAGE/sysupgrade.bin := tplink-v2-image -s -V "ver. 1.0" | \ + check-size | append-metadata +endef + +define Device/tplink_tdw8970 + $(Device/dsa-migration) + $(Device/lantiqTpLink) + DEVICE_MODEL := TD-W8970 + DEVICE_VARIANT := v1 + TPLINK_FLASHLAYOUT := 8Mltq + TPLINK_HWID := 0x89700001 + TPLINK_HWREV := 1 + IMAGE_SIZE := 7680k + DEVICE_PACKAGES:= kmod-ath9k wpad-basic-mbedtls kmod-usb-dwc2 kmod-usb-ledtrig-usbport + SUPPORTED_DEVICES += TDW8970 +endef +TARGET_DEVICES += tplink_tdw8970 + +define Device/tplink_tdw8980 + $(Device/dsa-migration) + $(Device/lantiqTpLink) + DEVICE_MODEL := TD-W8980 + DEVICE_VARIANT := v1 + TPLINK_FLASHLAYOUT := 8Mltq + TPLINK_HWID := 0x89800001 + TPLINK_HWREV := 14 + IMAGE_SIZE := 7680k + DEVICE_PACKAGES:= kmod-ath9k kmod-owl-loader wpad-basic-mbedtls kmod-usb-dwc2 kmod-usb-ledtrig-usbport + SUPPORTED_DEVICES += TDW8980 +endef +TARGET_DEVICES += tplink_tdw8980 diff --git a/target/linux/lantiq/image/vr9.mk b/target/linux/lantiq/image/vr9.mk index d4bded9cae7a96..8df8b1ac567a35 100644 --- a/target/linux/lantiq/image/vr9.mk +++ b/target/linux/lantiq/image/vr9.mk @@ -5,17 +5,6 @@ define Device/dsa-migration DEVICE_COMPAT_MESSAGE := Config cannot be migrated from swconfig to DSA endef -define Device/alphanetworks_asl56026 - $(Device/dsa-migration) - DEVICE_VENDOR := Alpha - DEVICE_MODEL := ASL56026 - DEVICE_ALT0_VENDOR := BT Openreach - DEVICE_ALT0_MODEL := ECI VDSL Modem V-2FUb/I - IMAGE_SIZE := 7488k - DEFAULT := n -endef -TARGET_DEVICES += alphanetworks_asl56026 - define Device/arcadyan_arv7519rw22 $(Device/dsa-migration) DEVICE_VENDOR := Arcadyan @@ -33,16 +22,6 @@ define Device/arcadyan_arv7519rw22 endef TARGET_DEVICES += arcadyan_arv7519rw22 -define Device/arcadyan_vg3503j - $(Device/dsa-migration) - DEVICE_VENDOR := BT Openreach - DEVICE_MODEL := ECI VDSL Modem V-2FUb/R - IMAGE_SIZE := 8000k - SUPPORTED_DEVICES += VG3503J - DEFAULT := n -endef -TARGET_DEVICES += arcadyan_vg3503j - define Device/arcadyan_vgv7510kw22-brn $(Device/dsa-migration) $(Device/lantiqBrnImage) @@ -351,22 +330,6 @@ define Device/lantiq_easy80920-nor endef TARGET_DEVICES += lantiq_easy80920-nor -define Device/netgear_dm200 - $(Device/dsa-migration) - DEVICE_VENDOR := NETGEAR - DEVICE_MODEL := DM200 - IMAGES := sysupgrade.bin factory.img - IMAGE/sysupgrade.bin := append-kernel | \ - pad-offset 64k 64 | append-uImage-fakehdr filesystem | \ - pad-offset 64k 64 | append-uImage-fakehdr filesystem | \ - append-rootfs | pad-rootfs | check-size | append-metadata - IMAGE/factory.img := $$(IMAGE/sysupgrade.bin) | netgear-dni - IMAGE_SIZE := 7872k - NETGEAR_BOARD_ID := DM200 - NETGEAR_HW_ID := 29765233+8+0+64+0+0 -endef -TARGET_DEVICES += netgear_dm200 - define Device/zyxel_p-2812hnu-f1 $(Device/dsa-migration) $(Device/NAND) diff --git a/target/linux/lantiq/image/vr9_legacy.mk b/target/linux/lantiq/image/vr9_legacy.mk new file mode 100644 index 00000000000000..814fb515780312 --- /dev/null +++ b/target/linux/lantiq/image/vr9_legacy.mk @@ -0,0 +1,43 @@ +DEVICE_VARS += NETGEAR_BOARD_ID NETGEAR_HW_ID + +define Device/dsa-migration + DEVICE_COMPAT_VERSION := 1.1 + DEVICE_COMPAT_MESSAGE := Config cannot be migrated from swconfig to DSA +endef + +define Device/alphanetworks_asl56026 + $(Device/dsa-migration) + DEVICE_VENDOR := Alpha + DEVICE_MODEL := ASL56026 + DEVICE_ALT0_VENDOR := BT Openreach + DEVICE_ALT0_MODEL := ECI VDSL Modem V-2FUb/I + IMAGE_SIZE := 7488k + DEFAULT := n +endef +TARGET_DEVICES += alphanetworks_asl56026 + +define Device/arcadyan_vg3503j + $(Device/dsa-migration) + DEVICE_VENDOR := BT Openreach + DEVICE_MODEL := ECI VDSL Modem V-2FUb/R + IMAGE_SIZE := 8000k + SUPPORTED_DEVICES += VG3503J + DEFAULT := n +endef +TARGET_DEVICES += arcadyan_vg3503j + +define Device/netgear_dm200 + $(Device/dsa-migration) + DEVICE_VENDOR := NETGEAR + DEVICE_MODEL := DM200 + IMAGES := sysupgrade.bin factory.img + IMAGE/sysupgrade.bin := append-kernel | \ + pad-offset 64k 64 | append-uImage-fakehdr filesystem | \ + pad-offset 64k 64 | append-uImage-fakehdr filesystem | \ + append-rootfs | pad-rootfs | check-size | append-metadata + IMAGE/factory.img := $$(IMAGE/sysupgrade.bin) | netgear-dni + IMAGE_SIZE := 7872k + NETGEAR_BOARD_ID := DM200 + NETGEAR_HW_ID := 29765233+8+0+64+0+0 +endef +TARGET_DEVICES += netgear_dm200 diff --git a/target/linux/lantiq/xrx200/base-files/etc/board.d/01_leds b/target/linux/lantiq/xrx200/base-files/etc/board.d/01_leds index dfc647a43e4b67..815f312dac069e 100644 --- a/target/linux/lantiq/xrx200/base-files/etc/board.d/01_leds +++ b/target/linux/lantiq/xrx200/base-files/etc/board.d/01_leds @@ -64,9 +64,6 @@ buffalo,wbmr-300hpd) ucidef_set_led_switch "lan3" "LAN3" "green:lan3" "switch0" "0x20" ucidef_set_led_default "router" "router" "green:router" "1" ;; -netgear,dm200) - ucidef_set_led_netdev "lan" "lan" "green:lan" "eth0" - ;; esac board_config_flush diff --git a/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network b/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network index 27a3c75edc44c7..6c35c7a4debb18 100644 --- a/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network +++ b/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network @@ -11,10 +11,6 @@ lantiq_setup_interfaces() local board="$1" case "$board" in - alphanetworks,asl56026|\ - arcadyan,vg3503j) - ucidef_set_interface_lan "lan1 lan2" - ;; arcadyan,arv7519rw22) ucidef_set_interface_lan "lan1 lan2 lan3 lan4 lan5" ;; @@ -46,14 +42,11 @@ lantiq_setup_interfaces() avm,fritz7490|\ avm,fritz7490-micron|\ buffalo,wbmr-300hpd|\ - tplink,tdw8970|\ - tplink,tdw8980|\ tplink,vr200|\ tplink,vr200v) ucidef_set_interface_lan "lan1 lan2 lan3 lan4" ;; - avm,fritz7412|\ - netgear,dm200) + avm,fritz7412) ucidef_set_interface_lan "lan" ;; *) @@ -95,14 +88,9 @@ lantiq_setup_macs() local wan_mac="" case "$board" in - alphanetworks,asl56026) - lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr) - wan_mac=$(mtd_get_mac_ascii u-boot-env wanmac) - ;; arcadyan,arv7519rw22) wan_mac=$(macaddr_add "$(mtd_get_mac_binary boardconfig 0x16)" 1) ;; - arcadyan,vg3503j|\ lantiq,easy80920-nand|\ lantiq,easy80920-nor|\ zyxel,p-2812hnu-f1|\ @@ -148,14 +136,6 @@ lantiq_setup_macs() lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr) wan_mac="$lan_mac" ;; - netgear,dm200) - lan_mac=$(mtd_get_mac_binary ART 0x0) - wan_mac=$(macaddr_add "$lan_mac" 1) - ;; - tplink,tdw8970|\ - tplink,tdw8980) - wan_mac=$(macaddr_add "$(mtd_get_mac_binary boardconfig 0xf100)" 1) - ;; tplink,vr200|\ tplink,vr200v) wan_mac=$(macaddr_add "$(mtd_get_mac_binary romfile 0xf100)" 1) diff --git a/target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom b/target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom index eefc39b30b463e..164e2d39caa5b6 100644 --- a/target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom +++ b/target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom @@ -31,10 +31,6 @@ case "$FIRMWARE" in caldata_extract_ubi "caldata" 0x1000 0x1000 ath9k_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary_ubi caldata 0x110c) 2) 0x10c ;; - tplink,tdw8970|\ - tplink,tdw8980) - caldata_extract "boardconfig" 0x21000 0x1000 - ;; *) caldata_die "board $board is not supported yet" ;; diff --git a/target/linux/lantiq/xrx200/base-files/etc/uci-defaults/01_led_migration b/target/linux/lantiq/xrx200/base-files/etc/uci-defaults/01_led_migration index 94f9df78bd559c..e3f6a98149fb44 100644 --- a/target/linux/lantiq/xrx200/base-files/etc/uci-defaults/01_led_migration +++ b/target/linux/lantiq/xrx200/base-files/etc/uci-defaults/01_led_migration @@ -18,9 +18,7 @@ do_internet_led_rename() } case "$(board_name)" in -alphanetworks,asl56026|\ arcadyan,arv7519rw22|\ -arcadyan,vg3503j|\ avm,fritz7360sl|\ bt,homehub-v5a) do_internet_led_rename diff --git a/target/linux/lantiq/xrx200_legacy/base-files/etc/board.d/01_leds b/target/linux/lantiq/xrx200_legacy/base-files/etc/board.d/01_leds new file mode 100644 index 00000000000000..dec22b51b55572 --- /dev/null +++ b/target/linux/lantiq/xrx200_legacy/base-files/etc/board.d/01_leds @@ -0,0 +1,34 @@ +# +# Copyright (C) 2011-2015 OpenWrt.org +# + +. /lib/functions/leds.sh +. /lib/functions/uci-defaults.sh + +board_config_update + +led_wifi="$(get_dt_led wifi)" +[ -n "$led_wifi" ] && ucidef_set_led_wlan "wifi" "wifi" "$led_wifi" "phy0tpt" + +led_dsl="$(get_dt_led dsl)" +[ -n "$led_dsl" ] && { + led_internet="$(get_dt_led internet)" + if [ -n "$led_internet" ]; then + ucidef_set_led_default "dsl" "dsl" "$led_dsl" "0" + ucidef_set_led_netdev "internet" "internet" "$led_internet" "pppoe-wan" + else + ucidef_set_led_netdev "dsl" "dsl" "$led_dsl" "dsl0" + fi +} + +board=$(board_name) + +case "$board" in +netgear,dm200) + ucidef_set_led_netdev "lan" "lan" "green:lan" "eth0" + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/lantiq/xrx200_legacy/base-files/etc/board.d/02_network b/target/linux/lantiq/xrx200_legacy/base-files/etc/board.d/02_network new file mode 100644 index 00000000000000..9088de86b10cbf --- /dev/null +++ b/target/linux/lantiq/xrx200_legacy/base-files/etc/board.d/02_network @@ -0,0 +1,75 @@ +# +# Copyright (C) 2011-2015 OpenWrt.org +# + +. /lib/functions/uci-defaults.sh +. /lib/functions/system.sh +. /lib/functions/lantiq.sh + +lantiq_setup_interfaces() +{ + local board="$1" + + case "$board" in + alphanetworks,asl56026|\ + arcadyan,vg3503j) + ucidef_set_interface_lan "lan1 lan2" + ;; + tplink,tdw8970|\ + tplink,tdw8980) + ucidef_set_interface_lan "lan1 lan2 lan3 lan4" + ;; + netgear,dm200) + ucidef_set_interface_lan "lan" + ;; + *) + ucidef_set_interface_lan 'eth0' + ;; + esac +} + +lantiq_setup_dsl() +{ + local board="$1" + local annex="a" + + lantiq_setup_dsl_helper "$annex" +} + +lantiq_setup_macs() +{ + local board="$1" + local lan_mac="" + local wan_mac="" + + case "$board" in + alphanetworks,asl56026) + lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr) + wan_mac=$(mtd_get_mac_ascii u-boot-env wanmac) + ;; + arcadyan,vg3503j) + lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr) + wan_mac=$(macaddr_add "$lan_mac" 1) + ;; + netgear,dm200) + lan_mac=$(mtd_get_mac_binary ART 0x0) + wan_mac=$(macaddr_add "$lan_mac" 1) + ;; + tplink,tdw8970|\ + tplink,tdw8980) + wan_mac=$(macaddr_add "$(mtd_get_mac_binary boardconfig 0xf100)" 1) + ;; + esac + + [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac" + [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac" +} + +board_config_update +board=$(board_name) +lantiq_setup_interfaces $board +lantiq_setup_dsl $board +lantiq_setup_macs $board +board_config_flush + +exit 0 diff --git a/target/linux/lantiq/xrx200_legacy/base-files/etc/board.d/05_compat-version b/target/linux/lantiq/xrx200_legacy/base-files/etc/board.d/05_compat-version new file mode 100644 index 00000000000000..45bef9385bdd6d --- /dev/null +++ b/target/linux/lantiq/xrx200_legacy/base-files/etc/board.d/05_compat-version @@ -0,0 +1,18 @@ +# +# Copyright (C) 2020 OpenWrt.org +# + +. /lib/functions.sh +. /lib/functions/uci-defaults.sh + +board_config_update + +case "$(board_name)" in + *) + ucidef_set_compat_version "1.1" + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/lantiq/xrx200_legacy/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom b/target/linux/lantiq/xrx200_legacy/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom new file mode 100644 index 00000000000000..c10065d5d5dcc0 --- /dev/null +++ b/target/linux/lantiq/xrx200_legacy/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom @@ -0,0 +1,23 @@ +#!/bin/sh + +[ -e /lib/firmware/$FIRMWARE ] && exit 0 + +. /lib/functions/caldata.sh + +case "$FIRMWARE" in + "ath9k-eeprom-pci-0000:00:0e.0.bin" | \ + "ath9k-eeprom-pci-0000:01:00.0.bin" | \ + "ath9k-eeprom-pci-0000:02:00.0.bin") + board=$(board_name) + + case "$board" in + tplink,tdw8970|\ + tplink,tdw8980) + caldata_extract "boardconfig" 0x21000 0x1000 + ;; + *) + caldata_die "board $board is not supported yet" + ;; + esac + ;; +esac diff --git a/target/linux/lantiq/xrx200_legacy/base-files/etc/uci-defaults/01_led_migration b/target/linux/lantiq/xrx200_legacy/base-files/etc/uci-defaults/01_led_migration new file mode 100644 index 00000000000000..f6f11bc569209e --- /dev/null +++ b/target/linux/lantiq/xrx200_legacy/base-files/etc/uci-defaults/01_led_migration @@ -0,0 +1,31 @@ +# +# Copyright (C) 2013 OpenWrt.org +# + +. /lib/functions/migrations.sh + +do_internet_led_rename() +{ + config_load system + + [ -n $(config_get led_internet name) ] || return + [ -z $(config_get led_dsl name) ] || return + + uci rename system.led_internet=led_dsl + uci set system.led_dsl.name=dsl + + logger -t led-migration "internet led renamed to dsl" +} + +case "$(board_name)" in +alphanetworks,asl56026|\ +arcadyan,vg3503j) + do_internet_led_rename + ;; +esac + +remove_devicename_leds + +migrations_apply system + +exit 0 diff --git a/target/linux/lantiq/xrx200_legacy/base-files/lib/upgrade/platform.sh b/target/linux/lantiq/xrx200_legacy/base-files/lib/upgrade/platform.sh new file mode 100755 index 00000000000000..9a613c43b1a2a3 --- /dev/null +++ b/target/linux/lantiq/xrx200_legacy/base-files/lib/upgrade/platform.sh @@ -0,0 +1,16 @@ +PART_NAME=firmware +REQUIRE_IMAGE_METADATA=1 + +platform_check_image() { + return 0 +} + +platform_do_upgrade() { + local board=$(board_name) + + case "$board" in + *) + default_do_upgrade "$1" + ;; + esac +} diff --git a/target/linux/lantiq/xrx200_legacy/config-6.6 b/target/linux/lantiq/xrx200_legacy/config-6.6 new file mode 100644 index 00000000000000..c8650c4e87f0e4 --- /dev/null +++ b/target/linux/lantiq/xrx200_legacy/config-6.6 @@ -0,0 +1,86 @@ +CONFIG_AT803X_PHY=y +CONFIG_BLK_MQ_PCI=y +CONFIG_CONTEXT_TRACKING=y +CONFIG_CONTEXT_TRACKING_IDLE=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 +CONFIG_CRYPTO_LZO=y +CONFIG_CRYPTO_ZSTD=y +CONFIG_EXTRA_FIRMWARE="lantiq/xrx200_phy11g_a14.bin lantiq/xrx200_phy11g_a22.bin lantiq/xrx200_phy22f_a14.bin lantiq/xrx200_phy22f_a22.bin" +CONFIG_EXTRA_FIRMWARE_DIR="firmware" +CONFIG_GENERIC_ALLOCATOR=y +CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y +CONFIG_GRO_CELLS=y +CONFIG_HWMON=y +CONFIG_HW_RANDOM=y +CONFIG_ICPLUS_PHY=y +CONFIG_IFX_VPE_EXT=y +CONFIG_INPUT=y +CONFIG_INPUT_EVDEV=y +CONFIG_INTEL_XWAY_PHY=y +CONFIG_IRQ_DOMAIN_HIERARCHY=y +# CONFIG_ISDN is not set +CONFIG_LANTIQ_XRX200=y +CONFIG_LZO_COMPRESS=y +CONFIG_LZO_DECOMPRESS=y +CONFIG_MIPS_MT=y +# CONFIG_MIPS_MT_FPAFF is not set +CONFIG_MIPS_MT_SMP=y +CONFIG_MIPS_NR_CPU_NR_MAP=2 +CONFIG_MIPS_PERF_SHARED_TC_COUNTERS=y +CONFIG_MIPS_VPE_APSP_API=y +CONFIG_MIPS_VPE_APSP_API_MT=y +CONFIG_MIPS_VPE_LOADER=y +CONFIG_MIPS_VPE_LOADER_MT=y +CONFIG_MIPS_VPE_LOADER_TOM=y +CONFIG_NEED_SRCU_NMI_SAFE=y +CONFIG_NET_DEVLINK=y +CONFIG_NET_DSA=y +CONFIG_NET_DSA_LANTIQ_GSWIP=y +CONFIG_NET_DSA_TAG_GSWIP=y +CONFIG_NET_FLOW_LIMIT=y +CONFIG_NET_SWITCHDEV=y +CONFIG_NLS=y +CONFIG_NR_CPUS=2 +CONFIG_PADATA=y +CONFIG_PCI=y +CONFIG_PCIEPORTBUS=y +CONFIG_PCIE_LANTIQ=y +CONFIG_PCI_DOMAINS=y +CONFIG_PCI_LANTIQ=y +CONFIG_PHYLINK=y +CONFIG_PHY_LANTIQ_VRX200_PCIE=y +CONFIG_POWER_RESET_GPIO=y +CONFIG_POWER_SUPPLY=y +CONFIG_POWER_SUPPLY_HWMON=y +CONFIG_QCOM_NET_PHYLIB=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_SENSORS_LTQ_CPUTEMP=y +CONFIG_SGL_ALLOC=y +CONFIG_SMP=y +CONFIG_SMP_UP=y +CONFIG_SOCK_RX_QUEUE_MAPPING=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_USB=y +CONFIG_USB_COMMON=y +CONFIG_USB_SUPPORT=y +CONFIG_XPS=y +CONFIG_XXHASH=y +CONFIG_ZLIB_DEFLATE=y +CONFIG_ZLIB_INFLATE=y +CONFIG_ZSTD_COMMON=y +CONFIG_ZSTD_COMPRESS=y +CONFIG_ZSTD_DECOMPRESS=y diff --git a/target/linux/lantiq/xrx200_legacy/profiles/00-default.mk b/target/linux/lantiq/xrx200_legacy/profiles/00-default.mk new file mode 100644 index 00000000000000..26bc8b502b0fea --- /dev/null +++ b/target/linux/lantiq/xrx200_legacy/profiles/00-default.mk @@ -0,0 +1,9 @@ +define Profile/Default + NAME:=Default Profile + PRIORITY:=1 +endef + +define Profile/Default/Description + Default package set compatible with most boards. +endef +$(eval $(call Profile,Default)) diff --git a/target/linux/lantiq/xrx200_legacy/target.mk b/target/linux/lantiq/xrx200_legacy/target.mk new file mode 100644 index 00000000000000..d9a6fff651b4f7 --- /dev/null +++ b/target/linux/lantiq/xrx200_legacy/target.mk @@ -0,0 +1,22 @@ +ARCH:=mips +SUBTARGET:=xrx200_legacy +BOARDNAME:=XRX200 Legacy +FEATURES+=atm ramdisk small_flash +CPU_TYPE:=24kc + +DEFAULT_PACKAGES+=kmod-leds-gpio \ + kmod-gpio-button-hotplug \ + ltq-vdsl-vr9-vectoring-fw-installer \ + kmod-ltq-vdsl-vr9-mei \ + kmod-ltq-vdsl-vr9 \ + kmod-ltq-atm-vr9 \ + kmod-ltq-deu-vr9 \ + kmod-ltq-ptm-vr9 \ + ltq-vdsl-vr9-app \ + dsl-vrx200-firmware-xdsl-a \ + dsl-vrx200-firmware-xdsl-b-patch \ + ppp-mod-pppoa + +define Target/Description + Lantiq XRX200 Legacy for boards with small flash +endef From 9f76cda3781e06e3a59c70f35b6cc6f81da6ce5f Mon Sep 17 00:00:00 2001 From: Isaac de Wolff Date: Sun, 8 Dec 2024 13:52:40 +0100 Subject: [PATCH 214/877] lantiq: grow kernel partition Zyxel P-2812HNU-F1 Change partition table in dts file. Change DEVICE_COMPAT_VERSION Enable automatic build. To take advantage of the bigger kernel partition, the uboot environment has to be changed: setenv nboot 'nand read 0x81000000 0x60000 0x500000; bootm 0x81000000' setenv bootcmd 'run nboot' saveenv Of course you need a u-boot capable of handling this. The u-boot discussed in this forum thread: https://forum.openwrt.org/t/zyxel-p2812hnu-f1-u-boot/100281 should be able to handle kernels up to an uncompressed size of 16MiB. Signed-off-by: Isaac de Wolff Link: https://github.com/openwrt/openwrt/pull/17209 Link: https://github.com/openwrt/openwrt/pull/17300 Signed-off-by: Hauke Mehrtens (cherry picked from commit 0d21cc8a92ea3b2cc94efefd60eae968a4296543) --- .../arch/mips/boot/dts/lantiq/vr9_zyxel_p-2812hnu-f1.dts | 6 +++--- target/linux/lantiq/image/vr9.mk | 7 ++++--- .../lantiq/xrx200/base-files/etc/board.d/05_compat-version | 4 ++++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_zyxel_p-2812hnu-f1.dts b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_zyxel_p-2812hnu-f1.dts index 247b811b4f9427..58a34d6e27c7e2 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_zyxel_p-2812hnu-f1.dts +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_zyxel_p-2812hnu-f1.dts @@ -47,11 +47,11 @@ }; partition@60000 { label = "kernel"; - reg = <0x60000 0x300000>; + reg = <0x60000 0x500000>; }; - partition@360000 { + partition@560000 { label = "ubi"; - reg = <0x360000 0x7ca0000>; + reg = <0x560000 0x7aa0000>; }; }; }; diff --git a/target/linux/lantiq/image/vr9.mk b/target/linux/lantiq/image/vr9.mk index 8df8b1ac567a35..e2608213dc5f4f 100644 --- a/target/linux/lantiq/image/vr9.mk +++ b/target/linux/lantiq/image/vr9.mk @@ -331,16 +331,17 @@ endef TARGET_DEVICES += lantiq_easy80920-nor define Device/zyxel_p-2812hnu-f1 - $(Device/dsa-migration) $(Device/NAND) + DEVICE_COMPAT_VERSION := 2.0 + DEVICE_COMPAT_MESSAGE := kernel and ubi partitions had to be resized. \ + Upgrade manually using initramfs, and change u-boot environment to load 5MiB for uImage. DEVICE_VENDOR := Zyxel DEVICE_MODEL := P-2812HNU DEVICE_VARIANT := F1 BOARD_NAME := P2812HNUF1 DEVICE_PACKAGES := kmod-rt2800-pci wpad-basic-mbedtls kmod-usb-dwc2 kmod-usb-ledtrig-usbport - KERNEL_SIZE := 3072k + KERNEL_SIZE := 5120k SUPPORTED_DEVICES += P2812HNUF1 - DEFAULT := n endef TARGET_DEVICES += zyxel_p-2812hnu-f1 diff --git a/target/linux/lantiq/xrx200/base-files/etc/board.d/05_compat-version b/target/linux/lantiq/xrx200/base-files/etc/board.d/05_compat-version index 45bef9385bdd6d..5690d848744e17 100644 --- a/target/linux/lantiq/xrx200/base-files/etc/board.d/05_compat-version +++ b/target/linux/lantiq/xrx200/base-files/etc/board.d/05_compat-version @@ -8,6 +8,10 @@ board_config_update case "$(board_name)" in + zyxel,p-2812hnu-f1) + ucidef_set_compat_version "2.0" + ;; + *) ucidef_set_compat_version "1.1" ;; From 5289460fd0281f653cb3701e777b6be3fcd43ca4 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Sat, 7 Dec 2024 14:47:29 +0100 Subject: [PATCH 215/877] wifi-scripts: don't fail on unset PSK Don't fail wireless interface bringup on empty PSK set. This is a valid configuration, resulting in a PSK network which can't be connected to. It does not fail the bringup of the hostapd process. Keep failing the interface setup in case a password with invalid length is used. This is also beneficial when intending to configure a PPSK network. It allows to create a network where no PPSK is yet set. Signed-off-by: David Bauer (cherry picked from commit 17a71f0c154cebd2e52cd8407531a9a88c931474) --- package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh b/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh index 817ead71afd063..7d4c41d3b51958 100644 --- a/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh +++ b/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh @@ -697,7 +697,7 @@ hostapd_set_bss_options() { append bss_conf "wpa_psk=$key" "$N" elif [ ${#key} -ge 8 ] && [ ${#key} -le 63 ]; then append bss_conf "wpa_passphrase=$key" "$N" - elif [ -n "$key" ] || [ -z "$wpa_psk_file" ]; then + elif [ -n "$key" ]; then wireless_setup_vif_failed INVALID_WPA_PSK return 1 fi From 8667ca841bc13bfffe233f097143445969a3bbcb Mon Sep 17 00:00:00 2001 From: Marco von Rosenberg Date: Wed, 18 Dec 2024 23:32:42 +0100 Subject: [PATCH 216/877] generic: fix BCM54612E suspend/resume backport patch This backport patch inserted suspend/resume callbacks for the wrong PHY driver. The fixed patch is needed for Huawei AP5030DN to initialize its second PHY. Refresh all affected patch with make target/linux/refresh. Fixes: 06cdc07f8cc7 ("ath79: add support for Huawei AP5030DN") Signed-off-by: Marco von Rosenberg Link: https://github.com/openwrt/openwrt/pull/17312 Signed-off-by: Hauke Mehrtens (cherry picked from commit d7f638bc692a7a81cf13c8ca50c7dc4a73c0fed9) --- ...y-broadcom-split-out-the-BCM54213PE-from-the-BCM54.patch | 4 ++-- .../950-0382-Populate-phy-driver-block-for-BCM54213PE.patch | 2 +- .../734-v6.8-net-phy-bcm54612e-add-suspend-resume.patch | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/target/linux/bcm27xx/patches-6.6/950-0260-phy-broadcom-split-out-the-BCM54213PE-from-the-BCM54.patch b/target/linux/bcm27xx/patches-6.6/950-0260-phy-broadcom-split-out-the-BCM54213PE-from-the-BCM54.patch index 69008c65de0b39..b4133150918860 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0260-phy-broadcom-split-out-the-BCM54213PE-from-the-BCM54.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0260-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); -@@ -1021,7 +1022,7 @@ static struct phy_driver broadcom_driver +@@ -1019,7 +1020,7 @@ static struct phy_driver broadcom_driver .link_change_notify = bcm54xx_link_change_notify, }, { .phy_id = PHY_ID_BCM54210E, @@ -35,7 +35,7 @@ Signed-off-by: Jonathan Bell .name = "Broadcom BCM54210E", /* PHY_GBIT_FEATURES */ .flags = PHY_ALWAYS_CALL_SUSPEND, -@@ -1039,6 +1040,13 @@ static struct phy_driver broadcom_driver +@@ -1037,6 +1038,13 @@ static struct phy_driver broadcom_driver .set_wol = bcm54xx_phy_set_wol, .led_brightness_set = bcm_phy_led_brightness_set, }, { diff --git a/target/linux/bcm27xx/patches-6.6/950-0382-Populate-phy-driver-block-for-BCM54213PE.patch b/target/linux/bcm27xx/patches-6.6/950-0382-Populate-phy-driver-block-for-BCM54213PE.patch index 218743e942ceed..e74d2d361d547f 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0382-Populate-phy-driver-block-for-BCM54213PE.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0382-Populate-phy-driver-block-for-BCM54213PE.patch @@ -16,7 +16,7 @@ Signed-off-by: Jonathan Lemon --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c -@@ -1052,8 +1052,14 @@ static struct phy_driver broadcom_driver +@@ -1050,8 +1050,14 @@ static struct phy_driver broadcom_driver .phy_id_mask = 0xffffffff, .name = "Broadcom BCM54213PE", /* PHY_GBIT_FEATURES */ diff --git a/target/linux/generic/backport-6.6/734-v6.8-net-phy-bcm54612e-add-suspend-resume.patch b/target/linux/generic/backport-6.6/734-v6.8-net-phy-bcm54612e-add-suspend-resume.patch index 28524a3dcf4cd8..12a89dae74a3e3 100644 --- a/target/linux/generic/backport-6.6/734-v6.8-net-phy-bcm54612e-add-suspend-resume.patch +++ b/target/linux/generic/backport-6.6/734-v6.8-net-phy-bcm54612e-add-suspend-resume.patch @@ -16,12 +16,12 @@ Signed-off-by: David S. Miller --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c -@@ -1001,6 +1001,8 @@ static struct phy_driver broadcom_driver - .config_intr = bcm_phy_config_intr, +@@ -1061,6 +1061,8 @@ static struct phy_driver broadcom_driver .handle_interrupt = bcm_phy_handle_interrupt, .link_change_notify = bcm54xx_link_change_notify, + .led_brightness_set = bcm_phy_led_brightness_set, + .suspend = bcm54xx_suspend, + .resume = bcm54xx_resume, }, { - .phy_id = PHY_ID_BCM5421, + .phy_id = PHY_ID_BCM54616S, .phy_id_mask = 0xfffffff0, From dd04edfba271f828b2fa25cfb9f0435ed70f3028 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 21 Dec 2024 01:51:30 +0100 Subject: [PATCH 217/877] OpenWrt v24.10.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 581de056c41e3e..552d32d3056de9 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git;openwrt-24.10 -src-git luci https://git.openwrt.org/project/luci.git;openwrt-24.10 -src-git routing https://git.openwrt.org/feed/routing.git;openwrt-24.10 -src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-24.10 +src-git packages https://git.openwrt.org/feed/packages.git^81d22b35c467bf0b7e75b9840e7bb4b32e4e89d8 +src-git luci https://git.openwrt.org/project/luci.git^f92e07253f22bd492345ae25dce1060b5ea33a98 +src-git routing https://git.openwrt.org/feed/routing.git^84d97e684bcb6a63dbfdfbfd9ec7407192861239 +src-git telephony https://git.openwrt.org/feed/telephony.git^fd605af7143165a2490681ec1752f259873b9147 diff --git a/include/version.mk b/include/version.mk index a6ebe587797707..e93c8f94bea66e 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),24.10-SNAPSHOT) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),24.10.0-rc3) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION)) +VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r28202-8667ca841b) VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO)) -VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/24.10-SNAPSHOT) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/24.10.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 80db993d46b837..8acda5657b0957 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/24.10-SNAPSHOT" + default "https://downloads.openwrt.org/releases/24.10.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..2bf9264a31b891 --- /dev/null +++ b/version @@ -0,0 +1 @@ +r28202-8667ca841b diff --git a/version.date b/version.date new file mode 100644 index 00000000000000..291ab16c99c0b9 --- /dev/null +++ b/version.date @@ -0,0 +1 @@ +1734719793 From 975811921e57a48ceb35135cd89e5944f6784314 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 21 Dec 2024 01:51:34 +0100 Subject: [PATCH 218/877] OpenWrt v24.10.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 552d32d3056de9..581de056c41e3e 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git^81d22b35c467bf0b7e75b9840e7bb4b32e4e89d8 -src-git luci https://git.openwrt.org/project/luci.git^f92e07253f22bd492345ae25dce1060b5ea33a98 -src-git routing https://git.openwrt.org/feed/routing.git^84d97e684bcb6a63dbfdfbfd9ec7407192861239 -src-git telephony https://git.openwrt.org/feed/telephony.git^fd605af7143165a2490681ec1752f259873b9147 +src-git packages https://git.openwrt.org/feed/packages.git;openwrt-24.10 +src-git luci https://git.openwrt.org/project/luci.git;openwrt-24.10 +src-git routing https://git.openwrt.org/feed/routing.git;openwrt-24.10 +src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-24.10 diff --git a/include/version.mk b/include/version.mk index e93c8f94bea66e..a6ebe587797707 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),24.10.0-rc3) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),24.10-SNAPSHOT) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r28202-8667ca841b) +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/24.10.0-rc3) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/24.10-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 8acda5657b0957..80db993d46b837 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/24.10.0-rc3" + default "https://downloads.openwrt.org/releases/24.10-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 2bf9264a31b891..00000000000000 --- a/version +++ /dev/null @@ -1 +0,0 @@ -r28202-8667ca841b diff --git a/version.date b/version.date deleted file mode 100644 index 291ab16c99c0b9..00000000000000 --- a/version.date +++ /dev/null @@ -1 +0,0 @@ -1734719793 From 81c0cf031e06967972aec4c96ccba14e90b8b6c2 Mon Sep 17 00:00:00 2001 From: Eric Fahlgren Date: Tue, 3 Dec 2024 15:17:05 -0800 Subject: [PATCH 219/877] build: d1: add SUPPORTED_DEVICES Include specific SUPPORTED_DEVICES values derived from the .dts file. This makes the generated profiles.json consistent with the 'board_name' from 'ubus call system board'. Specifically, this fixes a bug in the generated profiles.json that breaks the ASU clients when selecting the proper image from a build. See the 'supported_devices' fields here for the incorrect (or incomplete) list: https://downloads.openwrt.org/releases/24.10.0-rc1/targets/d1/generic/profiles.json Links: https://forum.openwrt.org/t/owut-openwrt-upgrade-tool/200035/287 Signed-off-by: Eric Fahlgren Link: https://github.com/openwrt/openwrt/pull/17155 Signed-off-by: Robert Marko (cherry picked from commit 33e23e8922ce7b7e488c85816c4b1084ae3710b0) --- target/linux/d1/image/Makefile | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/target/linux/d1/image/Makefile b/target/linux/d1/image/Makefile index aadf1807e751af..8dca2fb1cb0ee0 100644 --- a/target/linux/d1/image/Makefile +++ b/target/linux/d1/image/Makefile @@ -49,43 +49,47 @@ define Device/FitImage KERNEL_NAME := Image endef -define Device/dongshan_nezha_stu +define Device/100ask_dongshan-nezha-stu $(call Device/Default) DEVICE_VENDOR := Dongshan DEVICE_MODEL := Nezha STU devkit DEVICE_DTS := allwinner/sun20i-d1-dongshan-nezha-stu + SUPPORTED_DEVICES += dongshan_nezha_stu UBOOT := dongshan_nezha_stu endef -TARGET_DEVICES += dongshan_nezha_stu +TARGET_DEVICES += 100ask_dongshan-nezha-stu -define Device/lichee_rv_dock +define Device/sipeed_lichee-rv-dock $(call Device/Default) DEVICE_VENDOR := Sipeed DEVICE_MODEL := LicheePi RV (dock) DEVICE_DTS := allwinner/sun20i-d1-lichee-rv-dock + SUPPORTED_DEVICES += lichee_rv_dock DEVICE_PACKAGES += kmod-rtl8723bs UBOOT := lichee_rv_dock endef -TARGET_DEVICES += lichee_rv_dock +TARGET_DEVICES += sipeed_lichee-rv-dock -define Device/mangopi_mq_pro +define Device/widora_mangopi-mq-pro $(call Device/Default) DEVICE_VENDOR := MangoPi DEVICE_MODEL := MQ Pro DEVICE_DTS := allwinner/sun20i-d1-mangopi-mq-pro + SUPPORTED_DEVICES += mangopi_mq_pro DEVICE_PACKAGES += kmod-rtl8723bs UBOOT := mangopi_mq_pro endef -TARGET_DEVICES += mangopi_mq_pro +TARGET_DEVICES += widora_mangopi-mq-pro -define Device/nezha +define Device/allwinner_d1-nezha $(call Device/Default) DEVICE_VENDOR := Nezha DEVICE_MODEL := D1 DEVICE_DTS := allwinner/sun20i-d1-nezha + SUPPORTED_DEVICES += nezha UBOOT := nezha endef -TARGET_DEVICES += nezha +TARGET_DEVICES += allwinner_d1-nezha define Image/Build $(call Image/Build/$(1),$(1)) From b2a172170cef446d220656464fea5ccf3c6cc69b Mon Sep 17 00:00:00 2001 From: Lorenz Brun Date: Fri, 20 Dec 2024 23:37:01 +0100 Subject: [PATCH 220/877] octeon: enable AT803x PHY driver The AR8035 PHY is used in most Octeon boards supported by OpenWRT (all the Ubiquiti routers at least). To be able to use its PHY-specific functionality (cable testing, LED Control, ...) it should be built on Octeon. It also needs the regulator framework, so enable that as well. These boards are not space-constrained, so this really has no downsides. Tested on an EdgeRouter Lite, cable tests now work with ethtool-full. Signed-off-by: Lorenz Brun Link: https://github.com/openwrt/openwrt/pull/17318 Signed-off-by: Robert Marko (cherry picked from commit 4892ea9a74da8cf934dc534665c3689d2139507b) --- target/linux/octeon/config-6.6 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/linux/octeon/config-6.6 b/target/linux/octeon/config-6.6 index cc2dadbe9c7231..5cae2a8821a3ac 100644 --- a/target/linux/octeon/config-6.6 +++ b/target/linux/octeon/config-6.6 @@ -9,6 +9,7 @@ CONFIG_ARCH_MMAP_RND_BITS_MIN=12 CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=15 CONFIG_ARCH_SPARSEMEM_ENABLE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_AT803X_PHY=y CONFIG_ATA=y CONFIG_BLK_DEV_LOOP=y CONFIG_BLK_DEV_SD=y @@ -216,6 +217,7 @@ CONFIG_QUEUED_RWLOCKS=y CONFIG_QUEUED_SPINLOCKS=y CONFIG_RANDSTRUCT_NONE=y CONFIG_RAS=y +CONFIG_REGULATOR=y CONFIG_REGMAP=y CONFIG_REGMAP_I2C=y CONFIG_RELAY=y From 4111210b27fca26cc9e61764d7fc1764659d3851 Mon Sep 17 00:00:00 2001 From: John Audia Date: Thu, 19 Dec 2024 14:01:20 -0500 Subject: [PATCH 221/877] kernel: bump 6.6 to 6.6.67 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.67 All patches automatically rebased. Build system: x86/64 Build-tested: flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3, x86/64 Run-tested: flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3, x86/64 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/17309 Signed-off-by: Hauke Mehrtens (cherry picked from commit efe9fb084659ba9da4246ebc43435ea147eaf610) --- include/kernel-6.6 | 4 ++-- ...Add-support-for-all-the-downstream-rpi-sound-card-dr.patch | 2 +- ...compiler.h-only-include-asm-rwonce.h-for-kernel-code.patch | 4 ++-- ...netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/kernel-6.6 b/include/kernel-6.6 index 1e5dc77de0eb75..3b76c2be062c65 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .66 -LINUX_KERNEL_HASH-6.6.66 = 9d757937c4661c2f512c62641b74ef74eff9bb13dc5dbcbaaa108c21152f1e52 +LINUX_VERSION-6.6 = .67 +LINUX_KERNEL_HASH-6.6.67 = e41da482ec42a3b0e2b8ed2574c1d327e3dcf95cdf025c55a356b04307113e1a diff --git a/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch b/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch index 6ffc9364da8889..ecb7bffa025a7e 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch @@ -17583,7 +17583,7 @@ Signed-off-by: Phil Elwell * For devices with more than one control interface, we assume the --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c -@@ -2233,6 +2233,8 @@ static const struct usb_audio_quirk_flag +@@ -2247,6 +2247,8 @@ static const struct usb_audio_quirk_flag QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x534d, 0x2109, /* MacroSilicon MS2109 */ QUIRK_FLAG_ALIGN_TRANSFER), diff --git a/target/linux/generic/pending-6.6/100-compiler.h-only-include-asm-rwonce.h-for-kernel-code.patch b/target/linux/generic/pending-6.6/100-compiler.h-only-include-asm-rwonce.h-for-kernel-code.patch index 0844fcd6dbd657..50fcdbaed8108b 100644 --- a/target/linux/generic/pending-6.6/100-compiler.h-only-include-asm-rwonce.h-for-kernel-code.patch +++ b/target/linux/generic/pending-6.6/100-compiler.h-only-include-asm-rwonce.h-for-kernel-code.patch @@ -19,8 +19,8 @@ Signed-off-by: Felix Fietkau + #endif /* __KERNEL__ */ - /* -@@ -243,6 +245,4 @@ static inline void *offset_to_ptr(const + /** +@@ -258,6 +260,4 @@ static inline void *offset_to_ptr(const */ #define prevent_tail_call_optimization() mb() diff --git a/target/linux/generic/pending-6.6/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch b/target/linux/generic/pending-6.6/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch index d13641064063fa..572aad2a3b3dde 100644 --- a/target/linux/generic/pending-6.6/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch +++ b/target/linux/generic/pending-6.6/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 -@@ -8417,7 +8417,7 @@ static int nft_register_flowtable_net_ho +@@ -8421,7 +8421,7 @@ static int nft_register_flowtable_net_ho err = flowtable->data.type->setup(&flowtable->data, hook->ops.dev, FLOW_BLOCK_BIND); From f94c3af8148a2fb975c87fc289c0e208f8ac521a Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 22 Dec 2024 16:41:11 +0100 Subject: [PATCH 222/877] kernel: generic: netfilter: nft_set_hash: unaligned atomic read on struct nft_set_ext Fix kernel panic on some 64 bit architectures. This patch is pending upstream. https://patchwork.ozlabs.org/project/netfilter-devel/patch/20241222100239.336289-1-pablo@netfilter.org/ Fixes: https://github.com/openwrt/openwrt/issues/17336 Link: https://github.com/openwrt/openwrt/pull/17340 Signed-off-by: Hauke Mehrtens (cherry picked from commit 4585d5abd9b77fa9ef794407c5dedcbc4001c869) --- ...t_hash-unaligned-atomic-read-on-stru.patch | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 target/linux/generic/pending-6.6/605-netfilter-nft_set_hash-unaligned-atomic-read-on-stru.patch diff --git a/target/linux/generic/pending-6.6/605-netfilter-nft_set_hash-unaligned-atomic-read-on-stru.patch b/target/linux/generic/pending-6.6/605-netfilter-nft_set_hash-unaligned-atomic-read-on-stru.patch new file mode 100644 index 00000000000000..61e163293e23f1 --- /dev/null +++ b/target/linux/generic/pending-6.6/605-netfilter-nft_set_hash-unaligned-atomic-read-on-stru.patch @@ -0,0 +1,87 @@ +From 113fb8a8d1f27156f58b27ce0fc02af9b3705bf7 Mon Sep 17 00:00:00 2001 +From: Pablo Neira Ayuso +Date: Sun, 22 Dec 2024 11:02:39 +0100 +Subject: [PATCH] netfilter: nft_set_hash: unaligned atomic read on struct + nft_set_ext + +Access to genmask field in struct nft_set_ext results in unaligned +atomic read: + +[ 72.130109] Unable to handle kernel paging request at virtual address ffff0000c2bb708c +[ 72.131036] Mem abort info: +[ 72.131213] ESR = 0x0000000096000021 +[ 72.131446] EC = 0x25: DABT (current EL), IL = 32 bits +[ 72.132209] SET = 0, FnV = 0 +[ 72.133216] EA = 0, S1PTW = 0 +[ 72.134080] FSC = 0x21: alignment fault +[ 72.135593] Data abort info: +[ 72.137194] ISV = 0, ISS = 0x00000021, ISS2 = 0x00000000 +[ 72.142351] CM = 0, WnR = 0, TnD = 0, TagAccess = 0 +[ 72.145989] GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0 +[ 72.150115] swapper pgtable: 4k pages, 48-bit VAs, pgdp=0000000237d27000 +[ 72.154893] [ffff0000c2bb708c] pgd=0000000000000000, p4d=180000023ffff403, pud=180000023f84b403, pmd=180000023f835403, ++pte=0068000102bb7707 +[ 72.163021] Internal error: Oops: 0000000096000021 [#1] SMP +[...] +[ 72.170041] CPU: 7 UID: 0 PID: 54 Comm: kworker/7:0 Tainted: G E 6.13.0-rc3+ #2 +[ 72.170509] Tainted: [E]=UNSIGNED_MODULE +[ 72.170720] Hardware name: QEMU QEMU Virtual Machine, BIOS edk2-stable202302-for-qemu 03/01/2023 +[ 72.171192] Workqueue: events_power_efficient nft_rhash_gc [nf_tables] +[ 72.171552] pstate: 21400005 (nzCv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--) +[ 72.171915] pc : nft_rhash_gc+0x200/0x2d8 [nf_tables] +[ 72.172166] lr : nft_rhash_gc+0x128/0x2d8 [nf_tables] +[ 72.172546] sp : ffff800081f2bce0 +[ 72.172724] x29: ffff800081f2bd40 x28: ffff0000c2bb708c x27: 0000000000000038 +[ 72.173078] x26: ffff0000c6780ef0 x25: ffff0000c643df00 x24: ffff0000c6778f78 +[ 72.173431] x23: 000000000000001a x22: ffff0000c4b1f000 x21: ffff0000c6780f78 +[ 72.173782] x20: ffff0000c2bb70dc x19: ffff0000c2bb7080 x18: 0000000000000000 +[ 72.174135] x17: ffff0000c0a4e1c0 x16: 0000000000003000 x15: 0000ac26d173b978 +[ 72.174485] x14: ffffffffffffffff x13: 0000000000000030 x12: ffff0000c6780ef0 +[ 72.174841] x11: 0000000000000000 x10: ffff800081f2bcf8 x9 : ffff0000c3000000 +[ 72.175193] x8 : 00000000000004be x7 : 0000000000000000 x6 : 0000000000000000 +[ 72.175544] x5 : 0000000000000040 x4 : ffff0000c3000010 x3 : 0000000000000000 +[ 72.175871] x2 : 0000000000003a98 x1 : ffff0000c2bb708c x0 : 0000000000000004 +[ 72.176207] Call trace: +[ 72.176316] nft_rhash_gc+0x200/0x2d8 [nf_tables] (P) +[ 72.176653] process_one_work+0x178/0x3d0 +[ 72.176831] worker_thread+0x200/0x3f0 +[ 72.176995] kthread+0xe8/0xf8 +[ 72.177130] ret_from_fork+0x10/0x20 +[ 72.177289] Code: 54fff984 d503201f d2800080 91003261 (f820303f) +[ 72.177557] ---[ end trace 0000000000000000 ]--- + +Align struct nft_set_ext to word size to address this and +documentation it. + +pahole reports that this increases the size of elements for rhash and +pipapo in 8 bytes on x86_64. + +Fixes: 7ffc7481153b ("netfilter: nft_set_hash: skip duplicated elements pending gc run") +Signed-off-by: Pablo Neira Ayuso +--- + include/net/netfilter/nf_tables.h | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +--- a/include/net/netfilter/nf_tables.h ++++ b/include/net/netfilter/nf_tables.h +@@ -721,15 +721,18 @@ struct nft_set_ext_tmpl { + /** + * struct nft_set_ext - set extensions + * +- * @genmask: generation mask ++ * @genmask: generation mask, but also flags (see NFT_SET_ELEM_DEAD_BIT) + * @offset: offsets of individual extension types + * @data: beginning of extension data ++ * ++ * This structure must be aligned to word size, otherwise atomic bitops ++ * on genmask field can cause aligment failure on some archs. + */ + struct nft_set_ext { + u8 genmask; + u8 offset[NFT_SET_EXT_NUM]; + char data[]; +-}; ++} __aligned(BITS_PER_LONG / 8); + + static inline void nft_set_ext_prepare(struct nft_set_ext_tmpl *tmpl) + { From feb7a2a232ade8803920fc56220b77e4f8114301 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Sun, 20 Feb 2022 19:50:38 +0100 Subject: [PATCH 223/877] realtek: ZyXEL GS1900-48: drop gpio-restart GPIO 5 on the RTL8231 is defined reset the system, but fails to actually do so. This triggers a kernel a number of warnings and backtrace for GPIO pins that can sleep, such as the RTL8231's. Two warnings are emitted by libgpiod, and a third warning by gpio-restart itself after it fails to restart the system: [ 106.654008] ------------[ cut here ]------------ [ 106.659240] WARNING: CPU: 0 PID: 4279 at drivers/gpio/gpiolib.c:3098 gpiod_set_value+0x7c/0x108 [ Stack dump and call trace ] [ 106.826218] ---[ end trace d1de50b401f5a153 ]--- [ 106.962992] ------------[ cut here ]------------ [ 106.968208] WARNING: CPU: 0 PID: 4279 at drivers/gpio/gpiolib.c:3098 gpiod_set_value+0x7c/0x108 [ Stack dump and call trace ] [ 107.136718] ---[ end trace d1de50b401f5a154 ]--- [ 111.087092] ------------[ cut here ]------------ [ 111.092271] WARNING: CPU: 0 PID: 4279 at drivers/power/reset/gpio-restart.c:46 gpio_restart_notify+0xc0/0xdc [ Stack dump and call trace ] [ 111.256629] ---[ end trace d1de50b401f5a155 ]--- By removing gpio-restart from this device, we skip the restart-by-GPIO attempt and rely only on the watchdog for restarts, which is already the de facto behaviour. Signed-off-by: Sander Vanheule (cherry picked from commit 2ada95ccdf85f7ff82000dcf028659eb178ea50f) --- target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts b/target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts index c7ddd8313a3214..f049274889a948 100644 --- a/target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts +++ b/target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts @@ -39,11 +39,6 @@ gpio-controller; }; - gpio-restart { - compatible = "gpio-restart"; - gpios = <&gpio1 5 GPIO_ACTIVE_LOW>; - }; - keys { compatible = "gpio-keys-polled"; poll-interval = <20>; From 654c9732dc3ff6172d87c57b19b3d4cf0e5c0c44 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Sat, 21 Sep 2024 15:09:34 +0200 Subject: [PATCH 224/877] realtek: merge Zyxel GS1900 firmware partitions The dual-boot partition layout for the Zyxel GS1900 switches results in 6.9MB for both kernel and rootfs. Depending on the package selection, this may already leave no space for the user overlay. Merge the two firmware partitions, effectively dropping dual boot support with OpenWrt. This results in a firmware partition of 13.9MB, which should leave some room for the future. To maintain install capabilites on new devices, an image is required that still fits inside the original partition. The initramfs is used as factory install image, so ensure this meets the old size constraints. The factory image can be flashed via the same procedure as vendor images when reverting to stock, can be installed from stock, or can be launched via tftpboot. Link: https://github.com/openwrt/openwrt/issues/16439 Link: https://github.com/openwrt/openwrt/pull/16442 Tested-by: Stijn Segers Signed-off-by: Sander Vanheule (cherry picked from commit 35acdbe9095d81e896a2dfa65e7df871a023b996) --- target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi | 6 +----- target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts | 6 +----- target/linux/realtek/image/common.mk | 8 ++++++-- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi b/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi index 5993c1b798dfcd..b985c4bc8e499d 100644 --- a/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi +++ b/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi @@ -91,14 +91,10 @@ }; partition@b260000 { label = "firmware"; - reg = <0x260000 0x6d0000>; + reg = <0x260000 0xda0000>; compatible = "openwrt,uimage", "denx,uimage"; openwrt,ih-magic = <0x83800000>; }; - partition@930000 { - label = "runtime2"; - reg = <0x930000 0x6d0000>; - }; }; }; }; diff --git a/target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts b/target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts index f049274889a948..9844dc2180ff36 100644 --- a/target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts +++ b/target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts @@ -126,14 +126,10 @@ }; partition@260000 { label = "firmware"; - reg = <0x260000 0x6d0000>; + reg = <0x260000 0xda0000>; compatible = "openwrt,uimage", "denx,uimage"; openwrt,ih-magic = <0x83800000>; }; - partition@930000 { - label = "runtime2"; - reg = <0x930000 0x6d0000>; - }; }; }; }; diff --git a/target/linux/realtek/image/common.mk b/target/linux/realtek/image/common.mk index 27fcea86ece99b..d9647dbc07288e 100644 --- a/target/linux/realtek/image/common.mk +++ b/target/linux/realtek/image/common.mk @@ -57,13 +57,17 @@ define Device/hpe_1920 endef define Device/zyxel_gs1900 + DEVICE_COMPAT_VERSION := 2.0 + DEVICE_COMPAT_MESSAGE := Dual firmware paritition merged due to size constraints. \ + Upgrade requires a new factory install. Regular sysupgrade is not possible. DEVICE_VENDOR := Zyxel - IMAGE_SIZE := 6976k + IMAGE_SIZE := 13952k UIMAGE_MAGIC := 0x83800000 KERNEL_INITRAMFS := \ kernel-bin | \ append-dtb | \ libdeflate-gzip | \ zyxel-vers | \ - uImage gzip + uImage gzip | \ + check-size 6976k endef From d55754ce0dc513e3b4167876a76414f932c52f28 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Mon, 23 Dec 2024 01:49:04 +0100 Subject: [PATCH 225/877] uboot-d1: Adapt BUILD_DEVICES to renamed boards The boards where renamed, but BUILD_DEVICES was not adapted. This variable points to the board name. Without this change the u-boot binaries are not selected in the configuration. Copy the u-boot binaries under the BUILD_DEVICES name as it is expected by the image scripts. Fixes: 33e23e8922ce ("build: d1: add SUPPORTED_DEVICES") Signed-off-by: Hauke Mehrtens (cherry picked from commit af6c1f9497210edf06f2973465fff8563343ad22) --- package/boot/uboot-d1/Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package/boot/uboot-d1/Makefile b/package/boot/uboot-d1/Makefile index 083a219baf6fab..611922443b0800 100644 --- a/package/boot/uboot-d1/Makefile +++ b/package/boot/uboot-d1/Makefile @@ -30,7 +30,7 @@ define U-Boot/dongshan_nezha_stu OPENSBI:=generic DEPENDS:=+opensbi_generic UBOOT_DTS:=sun20i-d1-dongshan-nezha-stu.dtb - BUILD_DEVICES:=dongshan_nezha_stu + BUILD_DEVICES:=100ask_dongshan-nezha-stu endef define U-Boot/lichee_rv_dock @@ -38,7 +38,7 @@ define U-Boot/lichee_rv_dock OPENSBI:=generic DEPENDS:=+opensbi_generic UBOOT_DTS:=sun20i-d1-lichee-rv-dock.dtb - BUILD_DEVICES:=lichee_rv_dock + BUILD_DEVICES:=sipeed_lichee-rv-dock endef define U-Boot/mangopi_mq_pro @@ -46,7 +46,7 @@ define U-Boot/mangopi_mq_pro OPENSBI:=generic DEPENDS:=+opensbi_generic UBOOT_DTS:=sun20i-d1-mangopi-mq-pro.dtb - BUILD_DEVICES:=mangopi_mq_pro + BUILD_DEVICES:=widora_mangopi-mq-pro endef define U-Boot/nezha @@ -54,7 +54,7 @@ define U-Boot/nezha OPENSBI:=generic DEPENDS:=+opensbi_generic UBOOT_DTS:=sun20i-d1-nezha.dtb - BUILD_DEVICES:=nezha + BUILD_DEVICES:=allwinner_d1-nezha endef UBOOT_TARGETS := \ @@ -74,7 +74,7 @@ endef define Build/InstallDev $(INSTALL_DIR) $(STAGING_DIR_IMAGE) $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(DTS_DIR)/$(UBOOT_DTS) $(STAGING_DIR_IMAGE)/$(UBOOT_DTS) - $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(UBOOT_IMAGE) $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-$(UBOOT_IMAGE) + $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(UBOOT_IMAGE) $(STAGING_DIR_IMAGE)/$(BUILD_DEVICES)-$(UBOOT_IMAGE) mkimage -C none -A riscv -T script -d uEnv-$(UENV).txt \ $(STAGING_DIR_IMAGE)/$(BUILD_DEVICES)-boot.scr endef From 1e530e5831f3a0e10576d106236f1fa6f48c39e4 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Mon, 23 Dec 2024 12:40:31 +0100 Subject: [PATCH 226/877] OpenWrt v24.10.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 581de056c41e3e..dcd38d7c19e010 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git;openwrt-24.10 -src-git luci https://git.openwrt.org/project/luci.git;openwrt-24.10 -src-git routing https://git.openwrt.org/feed/routing.git;openwrt-24.10 -src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-24.10 +src-git packages https://git.openwrt.org/feed/packages.git^b9883eb8a2f9efbda000eadc2c679ec811c6be8d +src-git luci https://git.openwrt.org/project/luci.git^779ca1412564844efae93e7f00354bf8afd3ac1e +src-git routing https://git.openwrt.org/feed/routing.git^84d97e684bcb6a63dbfdfbfd9ec7407192861239 +src-git telephony https://git.openwrt.org/feed/telephony.git^fd605af7143165a2490681ec1752f259873b9147 diff --git a/include/version.mk b/include/version.mk index a6ebe587797707..21e9975030524e 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),24.10-SNAPSHOT) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),24.10.0-rc4) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION)) +VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r28211-d55754ce0d) VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO)) -VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/24.10-SNAPSHOT) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/24.10.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 80db993d46b837..6eeab973bb6bae 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/24.10-SNAPSHOT" + default "https://downloads.openwrt.org/releases/24.10.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..4b412541f645c1 --- /dev/null +++ b/version @@ -0,0 +1 @@ +r28211-d55754ce0d diff --git a/version.date b/version.date new file mode 100644 index 00000000000000..2297cc2dc81865 --- /dev/null +++ b/version.date @@ -0,0 +1 @@ +1734915335 From 372afe10f098692b2d21641878e86191160ec2ed Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Mon, 23 Dec 2024 12:40:35 +0100 Subject: [PATCH 227/877] OpenWrt v24.10.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 dcd38d7c19e010..581de056c41e3e 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git^b9883eb8a2f9efbda000eadc2c679ec811c6be8d -src-git luci https://git.openwrt.org/project/luci.git^779ca1412564844efae93e7f00354bf8afd3ac1e -src-git routing https://git.openwrt.org/feed/routing.git^84d97e684bcb6a63dbfdfbfd9ec7407192861239 -src-git telephony https://git.openwrt.org/feed/telephony.git^fd605af7143165a2490681ec1752f259873b9147 +src-git packages https://git.openwrt.org/feed/packages.git;openwrt-24.10 +src-git luci https://git.openwrt.org/project/luci.git;openwrt-24.10 +src-git routing https://git.openwrt.org/feed/routing.git;openwrt-24.10 +src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-24.10 diff --git a/include/version.mk b/include/version.mk index 21e9975030524e..a6ebe587797707 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),24.10.0-rc4) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),24.10-SNAPSHOT) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r28211-d55754ce0d) +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/24.10.0-rc4) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/24.10-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 6eeab973bb6bae..80db993d46b837 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/24.10.0-rc4" + default "https://downloads.openwrt.org/releases/24.10-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 4b412541f645c1..00000000000000 --- a/version +++ /dev/null @@ -1 +0,0 @@ -r28211-d55754ce0d diff --git a/version.date b/version.date deleted file mode 100644 index 2297cc2dc81865..00000000000000 --- a/version.date +++ /dev/null @@ -1 +0,0 @@ -1734915335 From 08f1bde12b3cba2daee556efcf91863e962dce38 Mon Sep 17 00:00:00 2001 From: Florian Maurer Date: Thu, 19 Dec 2024 10:46:40 +0100 Subject: [PATCH 228/877] ipq40xx-generic: EN WS-AP3915i remove BLOCKSIZE from image definition The blocksize was too high, resulting in forgetting the config on sysupgrade It is not needed for SPI-NOR. Signed-off-by: Florian Maurer Link: https://github.com/openwrt/openwrt/pull/17305 Signed-off-by: Robert Marko (cherry picked from commit 24fc5ff2136a10bf0ee9e764ae0404b2928a67ce) --- target/linux/ipq40xx/image/generic.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index d92d0824f9a331..21841f4bf1776c 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -542,7 +542,6 @@ define Device/extreme-networks_ws-ap3915i DEVICE_MODEL := WS-AP3915i IMAGE_SIZE := 30080k SOC := qcom-ipq4029 - BLOCKSIZE := 128k IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | check-size | append-metadata endef TARGET_DEVICES += extreme-networks_ws-ap3915i From f7398101db7a2ddbd037658c74311fad79f9cda3 Mon Sep 17 00:00:00 2001 From: Florian Maurer Date: Thu, 19 Dec 2024 11:49:13 +0100 Subject: [PATCH 229/877] ipq40xx-generic: ws-ap3915i fix macadress set macaddress correctly for board Signed-off-by: Florian Maurer Link: https://github.com/openwrt/openwrt/pull/17305 Signed-off-by: Robert Marko (cherry picked from commit 363f52d067e1852d46ccdc3ab4d12bc2f9d018dd) --- target/linux/ipq40xx/base-files/etc/board.d/02_network | 3 +++ 1 file changed, 3 insertions(+) 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 e3a6e242284012..549e1ac0c96a3e 100644 --- a/target/linux/ipq40xx/base-files/etc/board.d/02_network +++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network @@ -202,6 +202,9 @@ ipq40xx_setup_macs() wan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr) lan_mac=$(macaddr_add "$wan_mac" 1) ;; + extreme-networks,ws-ap3915i) + label_mac="$(mtd_get_mac_ascii CFG1 ethaddr)" + ;; ezviz,cs-w3-wd1200g-eup) label_mac=$(mtd_get_mac_binary "ART" 0x6) ;; From d036b42dd96bc7630a9c8db2dc82704b36b020de Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Mon, 23 Dec 2024 21:57:15 +0800 Subject: [PATCH 230/877] uboot-rockchip: fix build with swig 4.3.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes the following error by backporting upstream update: ``` scripts/dtc/pylibfdt/libfdt_wrap.c: In function ‘_wrap_fdt_next_node’: scripts/dtc/pylibfdt/libfdt_wrap.c:5581:17: error: too few arguments to function ‘SWIG_Python_AppendOutput’ 5581 | resultobj = SWIG_Python_AppendOutput(resultobj, val); | ^~~~~~~~~~~~~~~~~~~~~~~~ ``` Fixes: https://github.com/openwrt/openwrt/issues/17345 Signed-off-by: Tianling Shen Link: https://github.com/openwrt/openwrt/pull/17352 Signed-off-by: Hauke Mehrtens (cherry picked from commit 4e68103c4eb93d3f9b9359742c3c377ee2844943) --- ...libfdt-i_shipped-Use-SWIG_AppendOutp.patch | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 package/boot/uboot-rockchip/patches/002-scripts-dtc-pylibfdt-libfdt-i_shipped-Use-SWIG_AppendOutp.patch diff --git a/package/boot/uboot-rockchip/patches/002-scripts-dtc-pylibfdt-libfdt-i_shipped-Use-SWIG_AppendOutp.patch b/package/boot/uboot-rockchip/patches/002-scripts-dtc-pylibfdt-libfdt-i_shipped-Use-SWIG_AppendOutp.patch new file mode 100644 index 00000000000000..f5beca8d77a1ae --- /dev/null +++ b/package/boot/uboot-rockchip/patches/002-scripts-dtc-pylibfdt-libfdt-i_shipped-Use-SWIG_AppendOutp.patch @@ -0,0 +1,55 @@ +From a63456b9191fae2fe49f4b121e025792022e3950 Mon Sep 17 00:00:00 2001 +From: Markus Volk +Date: Wed, 30 Oct 2024 06:07:16 +0100 +Subject: [PATCH] scripts/dtc/pylibfdt/libfdt.i_shipped: Use SWIG_AppendOutput +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Swig has changed language specific AppendOutput functions. The helper +macro SWIG_AppendOutput remains unchanged. Use that instead +of SWIG_Python_AppendOutput, which would require an extra parameter +since swig 4.3.0. + +/home/flk/poky/build-test/tmp/work/qemux86_64-poky-linux/u-boot/2024.10/git/arch/x86/cpu/u-boot-64.lds +| scripts/dtc/pylibfdt/libfdt_wrap.c: In function ‘_wrap_fdt_next_node’: +| scripts/dtc/pylibfdt/libfdt_wrap.c:5581:17: error: too few arguments to function ‘SWIG_Python_AppendOutput’ +| 5581 | resultobj = SWIG_Python_AppendOutput(resultobj, val); +| | ^~~~~~~~~~~~~~~~~~~~~~~~ + +Signed-off-by: Markus Volk +Reported-by: Rudi Heitbaum +Link: https://github.com/dgibson/dtc/pull/154 +--- + scripts/dtc/pylibfdt/libfdt.i_shipped | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/scripts/dtc/pylibfdt/libfdt.i_shipped ++++ b/scripts/dtc/pylibfdt/libfdt.i_shipped +@@ -1037,7 +1037,7 @@ typedef uint32_t fdt32_t; + fdt_string(fdt1, fdt32_to_cpu($1->nameoff))); + buff = PyByteArray_FromStringAndSize( + (const char *)($1 + 1), fdt32_to_cpu($1->len)); +- resultobj = SWIG_Python_AppendOutput(resultobj, buff); ++ resultobj = SWIG_AppendOutput(resultobj, buff); + } + } + +@@ -1076,7 +1076,7 @@ typedef uint32_t fdt32_t; + + %typemap(argout) int *depth { + PyObject *val = Py_BuildValue("i", *arg$argnum); +- resultobj = SWIG_Python_AppendOutput(resultobj, val); ++ resultobj = SWIG_AppendOutput(resultobj, val); + } + + %apply int *depth { int *depth }; +@@ -1092,7 +1092,7 @@ typedef uint32_t fdt32_t; + if (PyTuple_GET_SIZE(resultobj) == 0) + resultobj = val; + else +- resultobj = SWIG_Python_AppendOutput(resultobj, val); ++ resultobj = SWIG_AppendOutput(resultobj, val); + } + } + From ec49df8692dfdb150c3a6808cf486ce328678d30 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Tue, 24 Dec 2024 09:56:11 +0100 Subject: [PATCH 231/877] realtek: generate compat_version 2.0 for GS1900 The GS1900 images have been updated to have a larger firmware partition, bumping the compatibility version to 2.0. However, since this version is generated on first boot and the default was used, these images still advertised 1.0 after a fresh install. Add a new uci-defaults script that will generate the correct version for all affected Zyxel GS1900 devices. Fixes: 35acdbe9095d ("realtek: merge Zyxel GS1900 firmware partitions") Signed-off-by: Sander Vanheule (cherry picked from commit a25809a474defedbd8f05d628d2c8525d79d549d) --- .../base-files/etc/board.d/05_compat-version | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 target/linux/realtek/base-files/etc/board.d/05_compat-version diff --git a/target/linux/realtek/base-files/etc/board.d/05_compat-version b/target/linux/realtek/base-files/etc/board.d/05_compat-version new file mode 100644 index 00000000000000..5c4ecb9aae363d --- /dev/null +++ b/target/linux/realtek/base-files/etc/board.d/05_compat-version @@ -0,0 +1,28 @@ +# +# Copyright (C) 2020 OpenWrt.org +# + +. /lib/functions.sh +. /lib/functions/uci-defaults.sh + +board_config_update + +case "$(board_name)" in + zyxel,gs1900-8 | \ + zyxel,gs1900-8hp-v1 | \ + zyxel,gs1900-8hp-v2 | \ + zyxel,gs1900-10hp | \ + zyxel,gs1900-16 | \ + zyxel,gs1900-24e | \ + zyxel,gs1900-24ep | \ + zyxel,gs1900-24hp-v1 | \ + zyxel,gs1900-24hp-v2 | \ + zyxel,gs1900-24-v1 | \ + zyxel,gs1900-48) + ucidef_set_compat_version "2.0" + ;; +esac + +board_config_flush + +exit 0 From 45bf30e062204b8eb9b724c43e6273aae2a5e55a Mon Sep 17 00:00:00 2001 From: Kyle Hendry Date: Sat, 16 Nov 2024 18:16:31 -0800 Subject: [PATCH 232/877] bmips: dts: fix pinctrl error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The kernel logs the error "bcm6368_nand 10000200.nand: there is not valid maps for state default" on boot and all nand pins show as UNCLAIMED in sysfs pinmux-pins. bcm6362.dtsi, bcm6368.dtsi and bcm63268.dtsi use the undocumented property group which the driver doesn't understand. This has been documented upstream in commit caf963efd4b0b9ff42ca12e52b8efe277264d35b. Replacing group with pins allows the nand pins to be properly configured. Signed-off-by: Kyle Hendry [add bcm636/bcm6368 and fix commit title] Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit d1e9c50d06a8cb618cb85ab489cbcccaec220636) --- target/linux/bmips/dts/bcm63268.dtsi | 16 ++++++++-------- target/linux/bmips/dts/bcm6362.dtsi | 2 +- target/linux/bmips/dts/bcm6368.dtsi | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/target/linux/bmips/dts/bcm63268.dtsi b/target/linux/bmips/dts/bcm63268.dtsi index d1aed29018e3a0..5a8cb7193f913f 100644 --- a/target/linux/bmips/dts/bcm63268.dtsi +++ b/target/linux/bmips/dts/bcm63268.dtsi @@ -245,7 +245,7 @@ pinctrl_nand: nand-pins { function = "nand"; - group = "nand_grp"; + pins = "nand_grp"; }; pinctrl_gpio35_alt: gpio35_alt-pins { @@ -255,37 +255,37 @@ pinctrl_dectpd: dectpd-pins { function = "dectpd"; - group = "dectpd_grp"; + pins = "dectpd_grp"; }; pinctrl_vdsl_phy_override_0: vdsl_phy_override_0-pins { function = "vdsl_phy_override_0"; - group = "vdsl_phy_override_0_grp"; + pins = "vdsl_phy_override_0_grp"; }; pinctrl_vdsl_phy_override_1: vdsl_phy_override_1-pins { function = "vdsl_phy_override_1"; - group = "vdsl_phy_override_1_grp"; + pins = "vdsl_phy_override_1_grp"; }; pinctrl_vdsl_phy_override_2: vdsl_phy_override_2-pins { function = "vdsl_phy_override_2"; - group = "vdsl_phy_override_2_grp"; + pins = "vdsl_phy_override_2_grp"; }; pinctrl_vdsl_phy_override_3: vdsl_phy_override_3-pins { function = "vdsl_phy_override_3"; - group = "vdsl_phy_override_3_grp"; + pins = "vdsl_phy_override_3_grp"; }; pinctrl_dsl_gpio8: dsl_gpio8-pins { function = "dsl_gpio8"; - group = "dsl_gpio8"; + pins = "dsl_gpio8"; }; pinctrl_dsl_gpio9: dsl_gpio9-pins { function = "dsl_gpio9"; - group = "dsl_gpio9"; + pins = "dsl_gpio9"; }; }; }; diff --git a/target/linux/bmips/dts/bcm6362.dtsi b/target/linux/bmips/dts/bcm6362.dtsi index 1089d89350baa5..5722f6e30c2ebf 100644 --- a/target/linux/bmips/dts/bcm6362.dtsi +++ b/target/linux/bmips/dts/bcm6362.dtsi @@ -320,7 +320,7 @@ pinctrl_nand: nand-pins { function = "nand"; - group = "nand_grp"; + pins = "nand_grp"; }; }; }; diff --git a/target/linux/bmips/dts/bcm6368.dtsi b/target/linux/bmips/dts/bcm6368.dtsi index e50f7a1b0c64aa..a855ab340ac43b 100644 --- a/target/linux/bmips/dts/bcm6368.dtsi +++ b/target/linux/bmips/dts/bcm6368.dtsi @@ -334,7 +334,7 @@ pinctrl_uart1: uart1-pins { function = "uart1"; - group = "uart1_grp"; + pins = "uart1_grp"; }; }; }; From 55d1fe4aa69c7c69085397fd8323d479bca7ae0f Mon Sep 17 00:00:00 2001 From: David Bentham Date: Tue, 22 Oct 2024 10:46:05 +0100 Subject: [PATCH 233/877] mediatek: add Comfast CF-E395AX support by adding an alternative model name both these devices share the board and same config, just different model number Install instructions are the same as the CF-E393AX commit - https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=d8f4453bf2de9fd9baf3d660ed12e0797ff2cfdb Signed-off-by: David Bentham Link: https://github.com/openwrt/openwrt/pull/16389 Signed-off-by: John Crispin (cherry picked from commit 794291bbdf26ad2be7581fc0c921e4d820937c79) --- target/linux/mediatek/image/filogic.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index defa3747edaa25..7b356ec03d2bd4 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -536,6 +536,8 @@ TARGET_DEVICES += cmcc_rax3000m define Device/comfast_cf-e393ax DEVICE_VENDOR := COMFAST DEVICE_MODEL := CF-E393AX + DEVICE_ALT0_VENDOR := COMFAST + DEVICE_ALT0_MODEL := CF-E395AX DEVICE_DTS := mt7981a-comfast-cf-e393ax DEVICE_DTS_DIR := ../dts DEVICE_DTC_FLAGS := --pad 4096 From 738c9e52867b66a5a4fb13c8333f3f61dc0de512 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Wed, 25 Dec 2024 23:59:46 +0100 Subject: [PATCH 234/877] yafut: Mark as nonshared This package is depending on @NAND_SUPPORT which is only set for some targets. Mark it nonshared to build it in the target build process. Fixes: https://github.com/openwrt/openwrt/issues/14714 Link: https://github.com/openwrt/openwrt/pull/17379 Signed-off-by: Hauke Mehrtens (cherry picked from commit d275bcc4bb837240f174a0fe568d00c6a0a282f7) --- package/utils/yafut/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/package/utils/yafut/Makefile b/package/utils/yafut/Makefile index 1e2ec7bc024d87..e3f240f75454df 100644 --- a/package/utils/yafut/Makefile +++ b/package/utils/yafut/Makefile @@ -11,6 +11,7 @@ PKG_SOURCE_VERSION:=38439f8a53d33b14744bc8f938662670b9d3e361 PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:=LICENSE +PKG_FLAGS:=nonshared include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/cmake.mk From 48f9284232d19c7dab95c20159744c93465cd3ad Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Wed, 16 Oct 2024 16:05:40 +0800 Subject: [PATCH 235/877] kernel: crypto: add atmel i2c hw accelerator support Add support for Microchip / Atmel ECC/SHA/RNG hw accelerator. Signed-off-by: Tianling Shen Link: https://github.com/openwrt/openwrt/pull/17253 (cherry picked from commit 9d434a8abf7cb50782aaae41fe2b011b3a9bf489) Link: https://github.com/openwrt/openwrt/pull/17348 Signed-off-by: Hauke Mehrtens --- package/kernel/linux/modules/crypto.mk | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/package/kernel/linux/modules/crypto.mk b/package/kernel/linux/modules/crypto.mk index 2257a36c802cda..78c97121764685 100644 --- a/package/kernel/linux/modules/crypto.mk +++ b/package/kernel/linux/modules/crypto.mk @@ -366,6 +366,26 @@ endef $(eval $(call KernelPackage,crypto-hmac)) +define KernelPackage/crypto-hw-atmel + TITLE:=Microchip / Atmel ECC/SHA/RNG hw accelerator + DEPENDS:=+kmod-i2c-core +kmod-crypto-ecdh +kmod-crypto-sha1 \ + +kmod-crypto-sha256 +kmod-lib-crc16 +kmod-random-core + KCONFIG:= \ + CONFIG_CRYPTO_HW=y \ + CONFIG_CRYPTO_DEV_ATMEL_I2C \ + CONFIG_CRYPTO_DEV_ATMEL_ECC \ + CONFIG_CRYPTO_DEV_ATMEL_SHA204A + FILES:= \ + $(LINUX_DIR)/drivers/crypto/atmel-i2c.ko \ + $(LINUX_DIR)/drivers/crypto/atmel-ecc.ko \ + $(LINUX_DIR)/drivers/crypto/atmel-sha204a.ko + AUTOLOAD:=$(call AutoLoad,09,atmel-i2c atmel-ecc atmel-sha204a) + $(call AddDepends/crypto) +endef + +$(eval $(call KernelPackage,crypto-hw-atmel)) + + define KernelPackage/crypto-hw-ccp TITLE:=AMD Cryptographic Coprocessor DEPENDS:= \ From d9bbed6507c9126bb8977b6e224186a624282ba0 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Wed, 16 Oct 2024 16:05:40 +0800 Subject: [PATCH 236/877] mediatek: update openembed som7981 support The board has been redesigned due to previous hardware bugs (with other reasons maybe). Changes in new board: - Added a gpio beeper - Added a Atmel i2c eeprom - Added a Atmel i2c ECC accelerator - Added a Philips RTC module - Added two RS485 - Removed WPS button - Replaced USB3 port with M.2 B-key for LTE modules - Swapped GbE LEDs gpio Also assigned wifi mac with nvmem binding, added iface setup for failsafe, increased phy assert time for rtl8221b, and updated LED labels. Keeping compatibility for old version is not necessary here as only few samples were sent to those interested in it. Signed-off-by: Tianling Shen Link: https://github.com/openwrt/openwrt/pull/17253 (cherry picked from commit 5a7fb834c7cb53cac7855759ca4165f596f1e4c8) Link: https://github.com/openwrt/openwrt/pull/17348 Signed-off-by: Hauke Mehrtens --- .../lib/preinit/05_set_preinit_iface | 3 +- .../dts/mt7981b-openembed-som7981.dts | 111 ++++++++++++++---- .../filogic/base-files/etc/board.d/01_leds | 4 +- .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 3 - target/linux/mediatek/image/filogic.mk | 5 +- 5 files changed, 99 insertions(+), 27 deletions(-) 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 0deab4248136ec..1025d1f1e1343c 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 @@ -2,7 +2,8 @@ set_preinit_iface() { case $(board_name) in cudy,m3000-v1|\ cudy,tr3000-v1|\ - glinet,gl-mt3000) + glinet,gl-mt3000|\ + openembed,som7981) ip link set eth1 up ifname=eth1 ;; diff --git a/target/linux/mediatek/dts/mt7981b-openembed-som7981.dts b/target/linux/mediatek/dts/mt7981b-openembed-som7981.dts index 0e9dea1ddb0ec1..d5c868567bddfa 100644 --- a/target/linux/mediatek/dts/mt7981b-openembed-som7981.dts +++ b/target/linux/mediatek/dts/mt7981b-openembed-som7981.dts @@ -12,9 +12,10 @@ compatible = "openembed,som7981", "mediatek,mt7981"; aliases { - led-boot = &wlan2g_led; - led-failsafe = &wlan2g_led; - led-upgrade = &wlan2g_led; + led-boot = &act_led; + led-failsafe = &act_led; + led-running = &act_led; + led-upgrade = &act_led; serial0 = &uart0; }; @@ -26,6 +27,11 @@ reg = <0 0x40000000 0 0x40000000>; }; + beeper { + compatible = "gpio-beeper"; + gpios = <&pio 2 GPIO_ACTIVE_HIGH>; + }; + gpio-keys { compatible = "gpio-keys"; @@ -34,12 +40,6 @@ linux,code = ; gpios = <&pio 1 GPIO_ACTIVE_LOW>; }; - - button-wps { - label = "wps"; - linux,code = ; - gpios = <&pio 0 GPIO_ACTIVE_LOW>; - }; }; gpio-leds { @@ -47,28 +47,27 @@ led-0 { function = LED_FUNCTION_LAN; - color = ; + color = ; gpios = <&pio 8 GPIO_ACTIVE_LOW>; }; led-1 { function = LED_FUNCTION_LAN; - color = ; + color = ; gpios = <&pio 13 GPIO_ACTIVE_LOW>; }; - wlan2g_led: led-2 { - function = LED_FUNCTION_WLAN_2GHZ; - color = ; + led-2 { + function = LED_FUNCTION_PANIC; + color = ; gpios = <&pio 34 GPIO_ACTIVE_LOW>; - linux,default-trigger = "phy0tpt"; + panic-indicator; }; - led-3 { - function = LED_FUNCTION_WLAN_5GHZ; + act_led: led-3 { + function = LED_FUNCTION_ACTIVITY; color = ; gpios = <&pio 35 GPIO_ACTIVE_LOW>; - linux,default-trigger = "phy1tpt"; }; }; }; @@ -97,14 +96,38 @@ }; }; +&i2c0 { + clock-frequency = <400000>; + pinctrl-names = "default"; + pinctrl-0 = <&i2c0_pins>; + status = "okay"; + + eeprom@50 { + compatible = "atmel,24c64"; + reg = <0x50>; + page-size = <32>; + }; + + rtc@51 { + compatible = "nxp,pcf8563"; + reg = <0x51>; + #clock-cells = <0>; + }; + + crypto@60 { + compatible = "atmel,atecc508a"; + reg = <0x60>; + }; +}; + &mdio_bus { phy0: ethernet-phy@5 { reg = <5>; compatible = "ethernet-phy-ieee802.3-c45"; phy-mode = "2500base-x"; reset-gpios = <&pio 14 GPIO_ACTIVE_LOW>; - reset-assert-us = <10000>; - reset-deassert-us = <50000>; + reset-assert-us = <15000>; + reset-deassert-us = <68000>; realtek,aldps-enable; }; }; @@ -184,6 +207,13 @@ }; &pio { + i2c0_pins: i2c0-pins { + mux { + function = "i2c"; + groups = "i2c0_1"; + }; + }; + spi0_flash_pins: spi0-pins { mux { function = "spi"; @@ -202,12 +232,45 @@ mediatek,pull-down-adv = <0>; }; }; + + uart1_pins: uart1-pins { + mux { + function = "uart"; + groups = "uart1_3"; + }; + }; + + uart2_pins: uart2-pins { + mux { + function = "uart"; + groups = "uart2_0_tx_rx"; + }; + }; + + wwan_rst_h: wwan-rst-h { + pins = "GPIO_WPS"; + drive-strength = <8>; + mediatek,pull-down-adv = <0>; + output-low; + }; }; &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"; }; @@ -220,8 +283,16 @@ nvmem-cells = <&eeprom_factory_0>; nvmem-cell-names = "eeprom"; status = "okay"; + + band@1 { + reg = <1>; + nvmem-cells = <&macaddr_factory_a 0>; + nvmem-cell-names = "mac-address"; + }; }; &xhci { + pinctrl-names = "default"; + pinctrl-0 = <&wwan_rst_h>; 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 64df50eb0a18e8..168909cf90a499 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 @@ -67,8 +67,8 @@ nokia,ea0326gmp) ucidef_set_led_netdev "wlan" "WLAN" "green:wlan" "phy1-ap0" "link" ;; openembed,som7981) - ucidef_set_led_netdev "lanact" "LANACT" "green:lan" "eth1" "rx tx" - ucidef_set_led_netdev "lanlink" "LANLINK" "amber:lan" "eth1" "link" + ucidef_set_led_netdev "lanact" "LANACT" "amber:lan" "eth1" "rx tx" + ucidef_set_led_netdev "lanlink" "LANLINK" "green:lan" "eth1" "link" ;; openwrt,one) ucidef_set_led_netdev "wanact" "WANACT" "mdio-bus:0f:green:wan" "eth0" "rx tx" 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 5e83a167de9704..4a6e0589a26024 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 @@ -131,9 +131,6 @@ case "$board" in [ "$PHYNBR" = "0" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_add $addr 2 > /sys${DEVPATH}/macaddress ;; - openembed,som7981) - [ "$PHYNBR" = "1" ] && cat /sys/class/net/eth0/address > /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 7b356ec03d2bd4..dd1ee5493de1d5 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -1160,7 +1160,10 @@ define Device/openembed_som7981 DEVICE_MODEL := SOM7981 DEVICE_DTS := mt7981b-openembed-som7981 DEVICE_DTS_DIR := ../dts - DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware kmod-usb3 + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware \ + kmod-crypto-hw-atmel kmod-eeprom-at24 kmod-gpio-beeper kmod-rtc-pcf8563 \ + kmod-usb-net-cdc-mbim kmod-usb-net-qmi-wwan kmod-usb-serial-option \ + kmod-usb3 uqmi UBINIZE_OPTS := -E 5 BLOCKSIZE := 128k PAGESIZE := 2048 From 58291780741694da81f4cab95f6db3a637f5dcc0 Mon Sep 17 00:00:00 2001 From: Joel Low Date: Sat, 14 Dec 2024 21:39:36 +0800 Subject: [PATCH 237/877] netfilter: add kmod-nfnetlink-ct{helper,timeout} Add kmod-nfnetlink-ct{helper,timeout} to allow handling firewall rules in userspace (together with conntrackd). The timeout module allows specifying custom expiration rules. Signed-off-by: Joel Low Link: https://github.com/openwrt/openwrt/pull/17267 (cherry picked from commit 0e2dcfc4f488ecd7acf31e01bd10624d8a273cde) Link: https://github.com/openwrt/openwrt/pull/17358 Signed-off-by: Hauke Mehrtens --- config/Config-kernel.in | 7 +++++ package/kernel/linux/modules/netfilter.mk | 34 +++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/config/Config-kernel.in b/config/Config-kernel.in index 91678cf2a660c8..64c8c63466a75a 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -1239,6 +1239,13 @@ config KERNEL_MPTCP_IPV6 default KERNEL_MPTCP endif +config KERNEL_NF_CONNTRACK_TIMEOUT + bool "Per-connection connection tracking timeout" + default y if !SMALL_FLASH + help + Select this option to enable support for per-connection conntrack timeouts. + Increases the (uncompressed) size of nf_conntrack.ko by ~8kB. + # # NFS related symbols # diff --git a/package/kernel/linux/modules/netfilter.mk b/package/kernel/linux/modules/netfilter.mk index cf66bd8cd8c7ee..30ff35ca6bf211 100644 --- a/package/kernel/linux/modules/netfilter.mk +++ b/package/kernel/linux/modules/netfilter.mk @@ -1048,6 +1048,40 @@ endef $(eval $(call KernelPackage,nfnetlink-queue)) +define KernelPackage/nfnetlink-cthelper + TITLE:=Netfilter User space conntrack helpers + FILES:=$(LINUX_DIR)/net/netfilter/nfnetlink_cthelper.ko + KCONFIG:=CONFIG_NF_CT_NETLINK_HELPER + AUTOLOAD:=$(call AutoProbe,nfnetlink_cthelper) + $(call AddDepends/nfnetlink,+kmod-nfnetlink-queue +kmod-nf-conntrack-netlink) +endef + +define KernelPackage/nfnetlink-cthelper/description + Kernel modules support for a netlink-based connection tracking + userspace helpers interface +endef + +$(eval $(call KernelPackage,nfnetlink-cthelper)) + + +define KernelPackage/nfnetlink-cttimeout + TITLE:=Netfilter conntrack expectation timeout + FILES:=$(LINUX_DIR)/net/netfilter/nfnetlink_cttimeout.ko + KCONFIG:=CONFIG_NF_CT_NETLINK_TIMEOUT + AUTOLOAD:=$(call AutoProbe,nfnetlink_cttimeout) + $(call AddDepends/nfnetlink,+kmod-nf-conntrack +kmod-nf-conntrack-timeout @KERNEL_NF_CONNTRACK_TIMEOUT) +endef + +define KernelPackage/nfnetlink-cttimeout/description + Kernel modules support for a netlink-based connection tracking + userspace timeout interface + + Requires CONFIG_NF_CONNTRACK_TIMEOUT (only enabled for non-small flash devices) +endef + +$(eval $(call KernelPackage,nfnetlink-cttimeout)) + + define KernelPackage/nf-conntrack-netlink TITLE:=Connection tracking netlink interface FILES:=$(LINUX_DIR)/net/netfilter/nf_conntrack_netlink.ko From 7271ee587cd104d30d6d46dd3c623c9d4602bd0c Mon Sep 17 00:00:00 2001 From: Roland Reinl Date: Fri, 13 Dec 2024 18:58:26 +0100 Subject: [PATCH 238/877] mediatek: filogic: Add support for D-Link AQUILA PRO AI M60 Specification: - MT7986 CPU using 2.4GHz and 5GHz WiFi (both AX) - MT7531 switch - 512MB RAM - 128MB NAND flash (MX35LF1GE4AB-Z4I) with two UBI partitions with identical size - 1 multi color LED (red, green, blue, white) connected via GCA230718 (Same as D-Link M30 A1) - 3 buttons (WPS, reset, LED on/off) - 1x 2.5 Gbit WAN port with Maxlinear GPY211C - 4x 1 Gbit LAN ports Disassembly: - There are five screws at the bottom: 2 under the rubber feet, 3 under the label. - After removing the screws, the white plastic part can be shifted out of the blue part. - Be careful because the antennas are mounted on the side and the top of the white part. Serial Interface - The serial interface can be connected to the 4 pin holes next to/under the antenna cables. - Note that there is another set of 4 pin holes on the side of the board, it's not used. - Pins (from front to rear): - 3.3V (do not connect) - TX - RX - GND - Settings: 115200, 8N1 MAC addresses: - MAC address is stored in partition "Odm" at offset 0x81 (for example XX:XX:XX:XX:XX:52) - MAC address on the device label is ODM + 1 (for example XX:XX:XX:XX:XX:53) - WAN MAC is the one from the ODM partition (for example XX:XX:XX:XX:XX:52) - LAN MAC is the one from the ODM partition + 1 (for example XX:XX:XX:XX:XX:53) - WLAN MAC (2.4 GHz) is the one from the ODM partition + 2 (for example (XX:XX:XX:XX:XX:54) - WLAN MAC (5 GHz) is the one from the ODM partition + 5 (for example (XX:XX:XX:XX:XX:57) Flashing via OEM web interface: - Currently not supported because image crypto is not known Flashing via recovery web interface: - This is only working if the first partition is active because recovery images are always flashed to the active partition and OpenWrt can only be executed from the first partition - Use a Chromium based browser, otherwise firmware upgrade might not work - Recovery web interface is accessible via 192.168.200.1 after keeping the reset button pressed during start of the device until the LED blinks red - Upload the recovery image, this will take some time. LED will continue flashing red during the update process - The after flashing, the recovery web interface redirects to http://192.168.0.1. This can be ignored. OpenWrt is accessible via 192.168.1.1 after flashing - If the first partition isn't the active partition, OpenWrt will hang during the boot process. In this case: - Download the recovery image from https://github.com/RolandoMagico/openwrt/releases/tag/M60-Recovery-UBI-Switch (UBI switch image) - Enable recovery web interface again and load the UBI switch image. This image works on the second partition of the M60 - OpenWrt should boot now as expected. After booting, flash the normal OpenWrt sysupgrade image (for example in the OpenWrt web interface) - Flashing a sysupgrade image from the UBI switch image will make the first partition the active partition and from now on, default OpenWrt images can be used Flashing via Initramfs: - Before switching to OpenWrt, ensure that both partitions contain OEM firmware. - This can be achieved by re-flashing the same OEM firmware version again via the OEM web interface. - Flashing via OEM web interface will automatically flash the currently not active partition. - Open router, connect serial interface - Start a TFTP server at 192.168.200.2 and provide the initramfs image there - When starting the router, select "7. Load Image" in U-Boot - Settings for load address, load method can be kept as they are - Specify host and router IP address if you use different ones than the default (Router 192.168.200.1, TFTP server 192.168.200.2) - Enter the file name of the initramfs image - Confirm "Run loaded data now?" question after loading the image with "Y" - OpenWrt initramfs will start now - Before flashing OpenWrt, create a backup of the "ubi" partition. It is required when reverting back to OEM - Flash sysupgrade image to flash, during flashing the U-Boot variable sw_tryactive will be set to 0 - During next boot, U-Boot tries to boot from the ubi partition. If it fails, it will switch to the ubi1 partition Reverting back to OEM: - Boot the initramfs image as described in "Flashing via Initramfs" above - Copy the backed up ubi partition to /tmp (e.g. by using SCP) - Write the backup to the UBI partition: mtd write /tmp/OpenWrt.mtd4.ubi.bin /dev/mtd4 - Reboot the device, OEM firmware will start now Signed-off-by: Roland Reinl Link: https://github.com/openwrt/openwrt/pull/17296 (cherry picked from commit b3ce08e0b6fa6780bf7ee295a1f176c053b1100b) Link: https://github.com/openwrt/openwrt/pull/17363 Signed-off-by: Hauke Mehrtens --- .../uboot-envtools/files/mediatek_filogic | 3 +- .../mt7986a-dlink-aquila-pro-ai-m60-a1.dts | 377 ++++++++++++++++++ .../filogic/base-files/etc/board.d/02_network | 3 +- .../base-files/lib/upgrade/platform.sh | 4 + target/linux/mediatek/image/filogic.mk | 14 + 5 files changed, 399 insertions(+), 2 deletions(-) create mode 100644 target/linux/mediatek/dts/mt7986a-dlink-aquila-pro-ai-m60-a1.dts diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index 5bde699a47a47d..730a28841e9880 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -95,7 +95,8 @@ zbtlink,zbt-z8102ax|\ zbtlink,zbt-z8103ax) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" ;; -dlink,aquila-pro-ai-m30-a1) +dlink,aquila-pro-ai-m30-a1|\ +dlink,aquila-pro-ai-m60-a1) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x40000" "0x40000" ;; gatonetworks,gdsp) diff --git a/target/linux/mediatek/dts/mt7986a-dlink-aquila-pro-ai-m60-a1.dts b/target/linux/mediatek/dts/mt7986a-dlink-aquila-pro-ai-m60-a1.dts new file mode 100644 index 00000000000000..a95c069156e14a --- /dev/null +++ b/target/linux/mediatek/dts/mt7986a-dlink-aquila-pro-ai-m60-a1.dts @@ -0,0 +1,377 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/dts-v1/; +#include +#include +#include + +#include "mt7986a.dtsi" + +/ { + model = "D-Link AQUILA PRO AI M60 A1"; + compatible = "dlink,aquila-pro-ai-m60-a1", "mediatek,mt7986a"; + + aliases { + serial0 = &uart0; + led-boot = &led_status_white; + led-failsafe = &led_status_red; + led-running = &led_status_white; + led-upgrade = &led_status_blue; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory@40000000 { + reg = <0 0x40000000 0 0x20000000>; + }; + + gpio-keys { + compatible = "gpio-keys"; + + button-reset { + label = "reset"; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + button-wps { + label = "wps"; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + button-leds-on-off { + label = "leds-on-off"; + linux,code = ; + gpios = <&pio 47 GPIO_ACTIVE_LOW>; + }; + }; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + nvmem-cells = <&macaddr_odm 1>; + 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-handle = <&phy6>; + nvmem-cells = <&macaddr_odm 0>; + nvmem-cell-names = "mac-address"; + label = "internet"; + }; + + 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>; + + phy6: phy@6 { + compatible = "maxlinear,gpy211", "ethernet-phy-ieee802.3-c45"; + reg = <6>; + phy-mode = "2500base-x"; + }; + + 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>; + 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 { + 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_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>; + }; + }; + + i2c_pins_3_4: i2c-pins-3-4 { + mux { + function = "i2c"; + groups = "i2c"; + }; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi_flash_pins>; + status = "okay"; + + 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>; + + 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 = <0x000000 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>; + }; + }; + }; + + partition@380000 { + label = "FIP"; + reg = <0x380000 0x200000>; + read-only; + }; + + partition@580000 { + label = "ubi"; + reg = <0x580000 0x3200000>; + }; + + partition@3780000 { + label = "ubi1"; + reg = <0x3780000 0x3200000>; + read-only; + }; + + partition@6980000 { + label = "Odm"; + reg = <0x6980000 0x40000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_odm: macaddr@81 { + compatible = "mac-base"; + reg = <0x81 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + + }; + + partition@69c0000 { + label = "Config1"; + reg = <0x69c0000 0x80000>; + read-only; + }; + + partition@6a40000 { + label = "Config2"; + reg = <0x6a40000 0x80000>; + read-only; + }; + + partition@6ac0000 { + label = "Storage"; + reg = <0x6ac0000 0xA00000>; + read-only; + }; + + }; + }; +}; + +&wifi { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&wf_2g_5g_pins>; + + + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; + + band@0 { + /* 2.4 GHz */ + reg = <0>; + nvmem-cells = <&macaddr_odm 2>; + nvmem-cell-names = "mac-address"; + }; + band@1 { + /* 5 GHz */ + reg = <1>; + nvmem-cells = <&macaddr_odm 5>; + nvmem-cell-names = "mac-address"; + }; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&i2c0 { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&i2c_pins_3_4>; + + gca230718@40 { + compatible = "unknown,gca230718"; + reg = <0x40>; + + led_status_red: led@0 { + color = ; + function = LED_FUNCTION_STATUS; + reg = <0>; + }; + + led@1 { + color = ; + function = LED_FUNCTION_STATUS; + reg = <1>; + }; + + led_status_blue: led@2 { + color = ; + function = LED_FUNCTION_STATUS; + reg = <2>; + }; + + led_status_white: led@3 { + color = ; + function = LED_FUNCTION_STATUS; + reg = <3>; + }; + }; +}; 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 e0158241f9a819..31b362c24a2879 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 @@ -87,7 +87,8 @@ mediatek_setup_interfaces() openwrt,one) ucidef_set_interfaces_lan_wan eth1 eth0 ;; - dlink,aquila-pro-ai-m30-a1) + dlink,aquila-pro-ai-m30-a1|\ + dlink,aquila-pro-ai-m60-a1) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" internet ;; mediatek,mt7986a-rfb) 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 fb48ffc49f090d..cf80cb5edce907 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -123,6 +123,10 @@ platform_do_upgrade() { yuncore,ax835) default_do_upgrade "$1" ;; + dlink,aquila-pro-ai-m60-a1) + fw_setenv sw_tryactive 0 + nand_do_upgrade "$1" + ;; mercusys,mr90x-v1|\ tplink,re6000xd) CI_UBIPART="ubi0" diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index dd1ee5493de1d5..ddcf59503aadfa 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -701,6 +701,20 @@ define Device/dlink_aquila-pro-ai-m30-a1 endef TARGET_DEVICES += dlink_aquila-pro-ai-m30-a1 +define Device/dlink_aquila-pro-ai-m60-a1 + DEVICE_VENDOR := D-Link + DEVICE_MODEL := AQUILA PRO AI M60 + DEVICE_VARIANT := A1 + DEVICE_DTS := mt7986a-dlink-aquila-pro-ai-m60-a1 + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-leds-gca230718 kmod-mt7915e kmod-mt7986-firmware mt7986-wo-firmware + IMAGES += recovery.bin + IMAGE_SIZE := 51200k + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + IMAGE/recovery.bin := sysupgrade-tar | pad-to $$(IMAGE_SIZE) | dlink-ai-recovery-header DLK6E8202001 \x30\x6C\x19\x0C \x00\x00\x2C\x00 \x00\x00\x20\x03 \x82\x6E +endef +TARGET_DEVICES += dlink_aquila-pro-ai-m60-a1 + define Device/edgecore_eap111 DEVICE_VENDOR := Edgecore DEVICE_MODEL := EAP111 From db0300cb1b20d600099942333cd49a187592f2e7 Mon Sep 17 00:00:00 2001 From: Edward Chow Date: Tue, 10 Dec 2024 18:36:40 +0800 Subject: [PATCH 239/877] ath79: port buffalo WZR-450HP2 from ar71xx Referencing commit a1837135e04b Hardware -------- SoC: Qualcomm Atheros QCA9558 RAM: 128M DDR2 (Nanya NT5TU64M16HG-AC) FLASH: 128M SPI-NAND (Spansion S34ML01G100TFI00) WLAN: QCA9558 3T3R 802.11 bgn ETH: Qualcomm Atheros QCA8337 UART: 115200 8n1 BUTTON: Reset - WPS - "Router" switch LED: 2x system-LED, 2x wlan-LED, 1x internet-LED, 2x routing-LED LEDs besides the ethernet ports are controlled by the ethernet switch MAC Address: use address(sample 1) source label cc:e1:d5:xx:xx:ed art@macaddr_wan lan cc:e1:d5:xx:xx:ec art@macaddr_lan wan cc:e1:d5:xx:xx:ed $label WiFi4_2G cc:e1:d5:xx:xx:ec art@cal_ath9k Installation from Serial Console ------------ 1. Connect to the serial console. Power up the device and interrupt autoboot when prompted 2. Connect a TFTP server reachable at 192.168.11.10/24 to the ethernet port. Serve the OpenWrt initramfs image as "openwrt.bin" 3. Boot the initramfs image using U-Boot ath> tftpboot 0x84000000 openwrt.bin ath> bootm 0x84000000 4. Copy the OpenWrt sysupgrade image to the device using scp and install it like a normal upgrade (with no need to keeping config since no config from "previous OpenWRT installation" could be kept at all) # sysupgrade -n /path/to/openwrt/sysupgrade.bin Installation from Web Interface ------------ To flash just do a firmware upgrade from the stock firmware (Buffalo branded dd-wrt) with squashfs-factory.bin Signed-off-by: Edward Chow Link: https://github.com/openwrt/openwrt/pull/17227 (cherry picked from commit 42254d3f5fa010466195c167c13f704ba85b3f54) Link: https://github.com/openwrt/openwrt/pull/17359 Signed-off-by: Hauke Mehrtens --- package/boot/uboot-envtools/files/ath79 | 1 + .../ath79/dts/qca9558_buffalo_wzr-450hp2.dts | 179 ++++++++++++++++++ .../generic/base-files/etc/board.d/02_network | 4 + target/linux/ath79/image/generic.mk | 12 ++ 4 files changed, 196 insertions(+) create mode 100644 target/linux/ath79/dts/qca9558_buffalo_wzr-450hp2.dts diff --git a/package/boot/uboot-envtools/files/ath79 b/package/boot/uboot-envtools/files/ath79 index c6d23ce73dcee1..c989e61bd550f4 100644 --- a/package/boot/uboot-envtools/files/ath79 +++ b/package/boot/uboot-envtools/files/ath79 @@ -28,6 +28,7 @@ asus,rt-ac59u-v2|\ asus,zenwifi-cd6n|\ asus,zenwifi-cd6r|\ buffalo,bhr-4grv2|\ +buffalo,wzr-450hp2|\ devolo,magic-2-wifi|\ engenius,eap300-v2|\ engenius,eap350-v1|\ diff --git a/target/linux/ath79/dts/qca9558_buffalo_wzr-450hp2.dts b/target/linux/ath79/dts/qca9558_buffalo_wzr-450hp2.dts new file mode 100644 index 00000000000000..8f19907dfeea9d --- /dev/null +++ b/target/linux/ath79/dts/qca9558_buffalo_wzr-450hp2.dts @@ -0,0 +1,179 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca955x.dtsi" + +#include +#include +#include + +/ { + compatible = "buffalo,wzr-450hp2", "qca,qca9558"; + model = "Buffalo WZR-450HP2/WZR-450HP2D"; + + aliases { + led-boot = &led_status_green; + led-failsafe = &led_status_green; + led-running = &led_status_green; + led-upgrade = &led_status_green; + label-mac-device = ð0; + }; + + leds { + compatible = "gpio-leds"; + + led_status_green: status_green { + function = LED_FUNCTION_STATUS; + color = ; + gpios = <&gpio 20 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + + led_wlan_green: wlan_green { + function = LED_FUNCTION_WLAN; + color = ; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + led_wps_green: wps_green { + function = LED_FUNCTION_WPS; + color = ; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "Reset button"; + linux,code = ; + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + rfkill { + label = "RFKILL button"; + linux,code = ; + gpios = <&gpio 21 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; +}; + +&spi { + 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@0 { + label = "u-boot"; + reg = <0x0 0x40000>; + read-only; + }; + + partition@40000 { + reg = <0x40000 0x10000>; + label = "u-boot-env"; + }; + + partition@50000 { + compatible = "denx,uimage"; + reg = <0x50000 0xf90000>; + label = "firmware"; + }; + + partition@fe0000 { + reg = <0xfe0000 0x10000>; + label = "user_property"; + read-only; + }; + + art: partition@ff0000 { + label = "art"; + reg = <0xff0000 0x10000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_wan: macaddr@0 { + reg = <0x0 0x6>; + }; + + macaddr_lan: macaddr@6 { + reg = <0x6 0x6>; + }; + + cal_ath9k: cal_ath9k@1000 { + reg = <0x1000 0x440>; + }; + }; + }; + }; + }; +}; + +&mdio0 { + status = "okay"; + + phy0: ethernet-phy@0 { + reg = <0>; + + qca,ar8327-initvals = < + 0x04 0x07600000 /* PORT0 PAD MODE CTRL: RGMII, to eth0 */ + 0x0c 0x00080080 /* PORT6 PAD MODE CTRL: SGMII, to eth1 */ + 0x10 0x81000080 /* POWER ON STRAP */ + 0x50 0xcc35cc35 /* LED_CTRL0 */ + 0x54 0xca35ca35 /* LED_CTRL1 */ + 0x58 0xc935c935 /* LED_CTRL2 */ + 0x5c 0x03ffff00 /* LED_CTRL3 */ + 0x7c 0x0000007e /* PORT0_STATUS */ + 0x94 0x0000007e /* PORT6_STATUS */ + >; + }; +}; + +ð0 { + status = "okay"; + + nvmem-cells = <&macaddr_wan>; + nvmem-cell-names = "mac-address"; + phy-handle = <&phy0>; + pll-data = <0x56000000 0x00000101 0x00001616>; + + gmac-config { + device = <&gmac>; + rgmii-enabled = <1>; + }; +}; + +ð1 { + status = "okay"; + + nvmem-cells = <&macaddr_lan>; + nvmem-cell-names = "mac-address"; + pll-data = <0x03000101 0x00000101 0x00001616>; + + fixed-link { + speed = <1000>; + full-duplex; + }; +}; + +&wmac { + status = "okay"; + + nvmem-cells = <&cal_ath9k>; + nvmem-cell-names = "calibration"; +}; 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 e987d754f0ac42..dedbaf05b8014a 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 @@ -213,6 +213,10 @@ ath79_setup_interfaces() ucidef_add_switch "switch0" \ "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth0" ;; + buffalo,wzr-450hp2) + ucidef_add_switch "switch0" \ + "6@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "0@eth0" + ;; buffalo,wzr-600dhp|\ buffalo,wzr-hp-ag300h|\ tplink,archer-c25-v1|\ diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 92f9bc6cddef5a..846a9acd20079b 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -759,6 +759,18 @@ define Device/buffalo_wzr-hp-g450h endef TARGET_DEVICES += buffalo_wzr-hp-g450h +define Device/buffalo_wzr-450hp2 + $(Device/buffalo_common) + SOC := qca9558 + DEVICE_MODEL := WZR-450HP2 + DEVICE_ALT0_VENDOR := Buffalo + DEVICE_ALT0_MODEL := WZR-450HP2D + BUFFALO_PRODUCT := WZR-450HP2 + IMAGE_SIZE := 15936k + SUPPORTED_DEVICES += wzr-450hp2 +endef +TARGET_DEVICES += buffalo_wzr-450hp2 + define Device/comfast_cf-e110n-v2 SOC := qca9533 DEVICE_VENDOR := COMFAST From 4cc1da1e44c28aa153956e179f28b8ee38dc3ac6 Mon Sep 17 00:00:00 2001 From: Rany Hany Date: Fri, 20 Dec 2024 23:58:39 +0000 Subject: [PATCH 240/877] hostapd: add SAE support for wifi-station and optimize PSK file creation Regarding SAE support in wifi-station: Important Note: Unlike PSK wifi-stations, both `mac` and `key` options are required to make it work. With PSK, hostapd used to perform a brute-force match to find which PSK entry to use, but with SAE this is infeasible due to SAE's design. When `mac` is omitted, it will allow any MAC address to use the SAE password if it didn't have a MAC address assigned to it, but this could only be done once. The last wildcard entry would be used. Also, unlike "hostapd: add support for SAE in PPSK option" (commit 913368a), it is not required to set `sae_pwe` to `0`. This gives it a slight advantage over using PPSK that goes beyond not needing RADIUS. Example Configuration: ``` config wifi-vlan option iface default_radio0 option name 999 option vid 999 option network management config wifi-station # Allow user with MAC address 00:11:22:33:44:55 and matching # key "secretadminpass" to access the management network. option iface default_radio0 option vid 999 option mac '00:11:22:33:44:55' option key secretadminpass config wifi-vlan option iface default_radio0 option name 100 option vid 100 option network guest config wifi-station # With SAE, when 'mac' is omitted it will be the fallback in case no # other MAC address matches. It won't be possible for a user that # has a matching MAC to use this network (i.e., 00:11:22:33:44:55 # in this example). option iface default_radio0 option vid 100 option key guestpass ``` Regarding PSK file creation optimization: This patch now conditionally runs `hostapd_set_psk_file` depending on `auth_type`. Previously, `hostapd_set_psk` would always execute `hostapd_set_psk_file`, which would create a new file if `wifi-station` was in use even if PSK was not enabled. This change checks the `auth_type` to ensure that it is appropriate to parse the `wifi-station` entries and create those files. Furthermore, we now only configure `wpa_psk_file` when it is a supported option (i.e., psk or psk-sae is used). Previously, we used to configure it when it was not necessary. While it didn't cause any issues, it would litter `/var/run` with unnecessary files. This patch fixes that case by configuring it depending on the `auth_type`. The new SAE support is aligned with these PSK file changes. Signed-off-by: Rany Hany Link: https://github.com/openwrt/openwrt/pull/17145 Signed-off-by: John Crispin (cherry picked from commit 65a1c666f2eb2511430a9064686b3590e08b1773) Link: https://github.com/openwrt/openwrt/pull/17248 Signed-off-by: Hauke Mehrtens --- .../wifi-scripts/files/lib/netifd/hostapd.sh | 36 +++++++++++++++++-- .../files/lib/netifd/wireless/mac80211.sh | 7 +++- .../network/services/hostapd/files/hostapd.uc | 2 ++ 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh b/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh index 7d4c41d3b51958..d673f5405bd070 100644 --- a/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh +++ b/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh @@ -428,9 +428,36 @@ hostapd_set_psk() { local ifname="$1" rm -f /var/run/hostapd-${ifname}.psk + case "$auth_type" in + psk|psk-sae) ;; + *) return ;; + esac for_each_station hostapd_set_psk_file ${ifname} } +hostapd_set_sae_file() { + local ifname="$1" + local vlan="$2" + local vlan_id="" + + json_get_vars mac vid key + set_default mac "ff:ff:ff:ff:ff:ff" + [ -n "$mac" ] && mac="|mac=$mac" + [ -n "$vid" ] && vlan_id="|vlanid=$vid" + printf '%s%s%s\n' "${key}" "${mac}" "${vlan_id}" >> /var/run/hostapd-${ifname}.sae +} + +hostapd_set_sae() { + local ifname="$1" + + rm -f /var/run/hostapd-${ifname}.sae + case "$auth_type" in + sae|psk-sae) ;; + *) return ;; + esac + for_each_station hostapd_set_sae_file ${ifname} +} + append_iw_roaming_consortium() { [ -n "$1" ] && append bss_conf "roaming_consortium=$1" "$N" } @@ -686,7 +713,7 @@ hostapd_set_bss_options() { wps_not_configured=1 ;; psk|sae|psk-sae) - json_get_vars key wpa_psk_file + json_get_vars key wpa_psk_file sae_password_file if [ "$ppsk" -ne 0 ]; then json_get_vars auth_secret auth_port set_default auth_port 1812 @@ -702,10 +729,15 @@ hostapd_set_bss_options() { return 1 fi [ -z "$wpa_psk_file" ] && set_default wpa_psk_file /var/run/hostapd-$ifname.psk - [ -n "$wpa_psk_file" ] && { + [ -n "$wpa_psk_file" ] && [ "$auth_type" = "psk" -o "$auth_type" = "psk-sae" ] && { [ -e "$wpa_psk_file" ] || touch "$wpa_psk_file" append bss_conf "wpa_psk_file=$wpa_psk_file" "$N" } + [ -z "$sae_password_file" ] && set_default sae_password_file /var/run/hostapd-$ifname.sae + [ -n "$sae_password_file" ] && [ "$auth_type" = "sae" -o "$auth_type" = "psk-sae" ] && { + [ -e "$sae_password_file" ] || touch "$sae_password_file" + append bss_conf "sae_password_file=$sae_password_file" "$N" + } [ "$eapol_version" -ge "1" -a "$eapol_version" -le "2" ] && append bss_conf "eapol_version=$eapol_version" "$N" set_default dynamic_vlan 0 diff --git a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh index ad1a4c86df0439..5837f1c748fdea 100755 --- a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh +++ b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh @@ -668,7 +668,7 @@ mac80211_set_ifname() { mac80211_prepare_vif() { json_select config - json_get_vars ifname mode ssid wds powersave macaddr enable wpa_psk_file vlan_file + json_get_vars ifname mode ssid wds powersave macaddr enable wpa_psk_file sae_password_file vlan_file [ -n "$ifname" ] || { local prefix; @@ -701,7 +701,12 @@ mac80211_prepare_vif() { [ "$mode" == "ap" ] && { + json_select config + wireless_vif_parse_encryption + json_select .. + [ -z "$wpa_psk_file" ] && hostapd_set_psk "$ifname" + [ -z "$sae_password_file" ] && hostapd_set_sae "$ifname" [ -z "$vlan_file" ] && hostapd_set_vlan "$ifname" } diff --git a/package/network/services/hostapd/files/hostapd.uc b/package/network/services/hostapd/files/hostapd.uc index 30292ce9ae24dc..ee2411205984ad 100644 --- a/package/network/services/hostapd/files/hostapd.uc +++ b/package/network/services/hostapd/files/hostapd.uc @@ -10,6 +10,7 @@ hostapd.data.pending_config = {}; hostapd.data.file_fields = { vlan_file: true, wpa_psk_file: true, + sae_password_file: true, accept_mac_file: true, deny_mac_file: true, eap_user_file: true, @@ -364,6 +365,7 @@ function bss_remove_file_fields(config) for (let key in config.hash) new_cfg.hash[key] = config.hash[key]; delete new_cfg.hash.wpa_psk_file; + delete new_cfg.hash.sae_password_file; delete new_cfg.hash.vlan_file; return new_cfg; From 90f84a22b002f1986c32a90b1d2e49b2cef47d55 Mon Sep 17 00:00:00 2001 From: Richard Schneidt Date: Fri, 27 Dec 2024 12:57:34 +0100 Subject: [PATCH 241/877] mvebu: fix Linksys power LED Kernel 6.6 requires LED node names to be prefixed via "led-", otherwise probing the LED will fail, so update our downstream patch adding the LED. Signed-off-by: Richard Schneidt Link: https://github.com/openwrt/openwrt/pull/17330 Signed-off-by: Robert Marko (cherry picked from commit f491001f0c106cd59b9f72f2dbd2ba39a3616de3) --- target/linux/mvebu/patches-6.6/309-linksys-status-led.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/mvebu/patches-6.6/309-linksys-status-led.patch b/target/linux/mvebu/patches-6.6/309-linksys-status-led.patch index 4ad9abc3a1988f..270937a924b240 100644 --- a/target/linux/mvebu/patches-6.6/309-linksys-status-led.patch +++ b/target/linux/mvebu/patches-6.6/309-linksys-status-led.patch @@ -19,7 +19,7 @@ pinctrl-names = "default"; - led-power { -+ led_power: power { ++ led_power: led-power { gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>; default-state = "on"; }; @@ -44,7 +44,7 @@ pinctrl-names = "default"; - led-power { -+ led_power: power { ++ led_power: led-power { label = "mamba:white:power"; gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>; default-state = "on"; From 7cbaa9e81f3ed92bb09702450c777bf95d2bd9da Mon Sep 17 00:00:00 2001 From: Joel Low Date: Fri, 27 Dec 2024 08:13:26 +0800 Subject: [PATCH 242/877] netfilter: fix bogus reference to `kmod-nf-conntrack-timeout` Fix bogus reference to kmod-nf-conntrack-timeout, fixing the warning `WARNING: Makefile 'package/kernel/linux/Makefile' has a dependency on 'kmod-nf-conntrack-timeout', which does not exist`. Fixes: 0e2dcfc4f488 ("netfilter: add kmod-nfnetlink-ct{helper,timeout}") Signed-off-by: Joel Low Link: https://github.com/openwrt/openwrt/pull/17388 Signed-off-by: Robert Marko (cherry picked from commit 74354fb463ba19b25b913a0bd0d8a021655cb2fa) --- 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 30ff35ca6bf211..96531b1e0803a7 100644 --- a/package/kernel/linux/modules/netfilter.mk +++ b/package/kernel/linux/modules/netfilter.mk @@ -1069,7 +1069,7 @@ define KernelPackage/nfnetlink-cttimeout FILES:=$(LINUX_DIR)/net/netfilter/nfnetlink_cttimeout.ko KCONFIG:=CONFIG_NF_CT_NETLINK_TIMEOUT AUTOLOAD:=$(call AutoProbe,nfnetlink_cttimeout) - $(call AddDepends/nfnetlink,+kmod-nf-conntrack +kmod-nf-conntrack-timeout @KERNEL_NF_CONNTRACK_TIMEOUT) + $(call AddDepends/nfnetlink,+kmod-nf-conntrack @KERNEL_NF_CONNTRACK_TIMEOUT) endef define KernelPackage/nfnetlink-cttimeout/description From 47e3413f6bb5be11def3dc9e5a3b2352e71ae553 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Fri, 27 Dec 2024 15:48:19 +0100 Subject: [PATCH 243/877] kernel: add kmod-usb-dwc3-octeon Since 24.10.0, Linux 6.6 is used which includes a reorganisation of Octeon DWC3 glue code. https://lore.kernel.org/all/ZJC3LLpUlatnLdnv@lenoch/ As a result, Octeon devices using this, such as EdgeRouter 4 have a no longer functioning USB stack. Build kmod-usb-dwc3-octeon for Cavium Octeon targets. Issue: https://github.com/openwrt/openwrt/issues/17195 Signed-off-by: Fabian Groffen Link: https://github.com/openwrt/openwrt/pull/17393 Signed-off-by: Robert Marko (cherry picked from commit 9adcf61abb7746919114db4030ea1e1a6fc416eb) --- package/kernel/linux/modules/usb.mk | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/package/kernel/linux/modules/usb.mk b/package/kernel/linux/modules/usb.mk index 734df050cd6cdc..8f934800fc6410 100644 --- a/package/kernel/linux/modules/usb.mk +++ b/package/kernel/linux/modules/usb.mk @@ -519,6 +519,23 @@ endef $(eval $(call KernelPackage,usb-dwc3)) +define KernelPackage/usb-dwc3-octeon + TITLE:=DWC3 Cavium Octeon USB driver + DEPENDS:=@TARGET_octeon +kmod-usb-dwc3 + KCONFIG:= CONFIG_USB_DWC3_OCTEON + FILES:= $(LINUX_DIR)/drivers/usb/dwc3/dwc3-octeon.ko + AUTOLOAD:=$(call AutoProbe,dwc3-octeon,1) + $(call AddDepends/usb) +endef + +define KernelPackage/usb-dwc3-octeon/description + This driver adds support for Cavium Octeon platforms with DesignWare + Core USB3 IP. +endef + +$(eval $(call KernelPackage,usb-dwc3-octeon)) + + define KernelPackage/usb-dwc3-qcom TITLE:=DWC3 Qualcomm USB driver DEPENDS:=@(TARGET_ipq40xx||TARGET_ipq806x||TARGET_qualcommax) +kmod-usb-dwc3 From 5b4a081f472cd97fd13739bb48c32fb015368def Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Fri, 27 Dec 2024 15:52:32 +0100 Subject: [PATCH 244/877] octeon: add kmod-usb-dwc3-octeon to DEFAULT_PACKAGES Since 24.10.0 the Linux kernel needs this to enable the USB stack on Cavium Octeon platforms with DesignWare Core USB3 IP. Issue: https://github.com/openwrt/openwrt/issues/17195 Signed-off-by: Fabian Groffen Link: https://github.com/openwrt/openwrt/pull/17393 Signed-off-by: Robert Marko (cherry picked from commit 0cba20f0820efa9ac7a728206a3bde43719ced6d) --- target/linux/octeon/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/octeon/Makefile b/target/linux/octeon/Makefile index c59b0af6a2fe85..f14f4537b864d4 100644 --- a/target/linux/octeon/Makefile +++ b/target/linux/octeon/Makefile @@ -18,6 +18,6 @@ endef include $(INCLUDE_DIR)/target.mk -DEFAULT_PACKAGES += mkf2fs e2fsprogs +DEFAULT_PACKAGES += mkf2fs e2fsprogs kmod-usb-dwc3-octeon $(eval $(call BuildTarget)) From 76a546a83a68459b88a14b3382a58740daf5bf00 Mon Sep 17 00:00:00 2001 From: Antonio Pastor Date: Fri, 20 Dec 2024 11:28:45 -0500 Subject: [PATCH 245/877] kernel: generic: patch: 802.2+LLC - set transport_header offset Conversion to DSA broke 802.2+LLC+SNAP packet processing. Frames received by napi_complete_done with GRO and DSA have transport_header set two bytes short, or pointing 2 bytes before network_header & skb->data. As snap_rcv expects transport_header to point to SNAP header (OID:PID) after LLC processing advances offset over LLC header (llc_rcv & llc_fixup_skb), code doesn't find a match and packet is dropped. Image built at this commit operates properly: 86dadeba48 - generic: add patch for GPON-ONU-34-20BI quirk Image built at following commit exhibits the issue: 337e36e0ef - ipq806x: convert each device to DSA implementation As issue is LLC specific, to avoid impacting non-LLC traffic, and to follow up on original assumption made on kernel commit fda55eca5a33 ("net: introduce skb_transport_header_was_set()") stating "network stacks usually reset the transport header anyway", llc_fixup_skb to reset and advance the offset. llc_fixup_skb already assumes the LLC header is at skb->data, and by definition SNAP header immediately follows. Signed-off-by: Antonio Pastor Link: https://github.com/openwrt/openwrt/pull/17220 Signed-off-by: Robert Marko (cherry picked from commit da7ab64f1f6d72597a1c8a8bb3b57409227bc635) --- ...2-net-llc-reset-skb-transport_header.patch | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 target/linux/generic/backport-6.6/902-net-llc-reset-skb-transport_header.patch diff --git a/target/linux/generic/backport-6.6/902-net-llc-reset-skb-transport_header.patch b/target/linux/generic/backport-6.6/902-net-llc-reset-skb-transport_header.patch new file mode 100644 index 00000000000000..b1f0b8fce7e34c --- /dev/null +++ b/target/linux/generic/backport-6.6/902-net-llc-reset-skb-transport_header.patch @@ -0,0 +1,52 @@ +From a024e377efed31ecfb39210bed562932321345b3 Mon Sep 17 00:00:00 2001 +From: Antonio Pastor +Date: Tue, 24 Dec 2024 20:07:20 -0500 +Subject: [PATCH] net: llc: reset skb->transport_header + +802.2+LLC+SNAP frames received by napi_complete_done with GRO and DSA +have skb->transport_header set two bytes short, or pointing 2 bytes +before network_header & skb->data. As snap_rcv expects transport_header +to point to SNAP header (OID:PID) after LLC processing advances offset +over LLC header (llc_rcv & llc_fixup_skb), code doesn't find a match +and packet is dropped. + +Between napi_complete_done and snap_rcv, transport_header is not used +until __netif_receive_skb_core, where originally it was being reset. +Commit fda55eca5a33 ("net: introduce skb_transport_header_was_set()") +only does so if not set, on the assumption the value was set correctly +by GRO (and also on assumption that "network stacks usually reset the +transport header anyway"). Afterwards it is moved forward by +llc_fixup_skb. + +Locally generated traffic shows up at __netif_receive_skb_core with no +transport_header set and is processed without issue. On a setup with +GRO but no DSA, transport_header and network_header are both set to +point to skb->data which is also correct. + +As issue is LLC specific, to avoid impacting non-LLC traffic, and to +follow up on original assumption made on previous code change, +llc_fixup_skb to reset the offset after skb pull. llc_fixup_skb +assumes the LLC header is at skb->data, and by definition SNAP header +immediately follows. + +Fixes: fda55eca5a33 ("net: introduce skb_transport_header_was_set()") +Signed-off-by: Antonio Pastor +Reviewed-by: Eric Dumazet +Link: https://patch.msgid.link/20241225010723.2830290-1-antonio.pastor@gmail.com +Signed-off-by: Jakub Kicinski +--- + net/llc/llc_input.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/net/llc/llc_input.c ++++ b/net/llc/llc_input.c +@@ -124,8 +124,8 @@ static inline int llc_fixup_skb(struct s + if (unlikely(!pskb_may_pull(skb, llc_len))) + return 0; + +- skb->transport_header += llc_len; + skb_pull(skb, llc_len); ++ skb_reset_transport_header(skb); + if (skb->protocol == htons(ETH_P_802_2)) { + __be16 pdulen; + s32 data_size; From 3ca3ee60122d804f05e6bb7e05842fa960be9cf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Sat, 28 Dec 2024 12:18:02 +0100 Subject: [PATCH 246/877] bmips: drop macronix nand block protection patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MX30LFxG18AC OTP area access has been fixed upstream: https://github.com/torvalds/linux/commit/e87161321a4081d36c4af95af7f0950137569dfe Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 15b21c474ea1c3f3a15bd06a4783b0a019627984) --- ...evert-macronix-nand-block-protection.patch | 114 ------------------ 1 file changed, 114 deletions(-) delete mode 100644 target/linux/bmips/patches-6.6/210-revert-macronix-nand-block-protection.patch diff --git a/target/linux/bmips/patches-6.6/210-revert-macronix-nand-block-protection.patch b/target/linux/bmips/patches-6.6/210-revert-macronix-nand-block-protection.patch deleted file mode 100644 index 2298c8ea31e17b..00000000000000 --- a/target/linux/bmips/patches-6.6/210-revert-macronix-nand-block-protection.patch +++ /dev/null @@ -1,114 +0,0 @@ -From 5a37811de679bff03e9c5a746f75574910ede964 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= -Date: Wed, 22 Mar 2023 20:52:13 +0100 -Subject: [PATCH] Revert "mtd: rawnand: Macronix: Add support for block - protection" -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This reverts commit 03a539c7a118427a6609a26461358c56ac8f3a06. - -Macronix block protection doesn't seem to be supported on Sercomm H-500s -devices since it hangs the device. - -Signed-off-by: Álvaro Fernández Rojas ---- - drivers/mtd/nand/raw/nand_macronix.c | 72 ---------------------------- - 1 file changed, 72 deletions(-) - ---- a/drivers/mtd/nand/raw/nand_macronix.c -+++ b/drivers/mtd/nand/raw/nand_macronix.c -@@ -13,10 +13,6 @@ - #define MACRONIX_READ_RETRY_BIT BIT(0) - #define MACRONIX_NUM_READ_RETRY_MODES 6 - --#define ONFI_FEATURE_ADDR_MXIC_PROTECTION 0xA0 --#define MXIC_BLOCK_PROTECTION_ALL_LOCK 0x38 --#define MXIC_BLOCK_PROTECTION_ALL_UNLOCK 0x0 -- - #define ONFI_FEATURE_ADDR_MXIC_RANDOMIZER 0xB0 - #define MACRONIX_RANDOMIZER_BIT BIT(1) - #define MACRONIX_RANDOMIZER_ENPGM BIT(0) -@@ -189,73 +185,6 @@ static void macronix_nand_fix_broken_get - ONFI_FEATURE_ADDR_TIMING_MODE, 1); - } - --/* -- * Macronix NAND supports Block Protection by Protectoin(PT) pin; -- * active high at power-on which protects the entire chip even the #WP is -- * disabled. Lock/unlock protection area can be partition according to -- * protection bits, i.e. upper 1/2 locked, upper 1/4 locked and so on. -- */ --static int mxic_nand_lock(struct nand_chip *chip, loff_t ofs, uint64_t len) --{ -- u8 feature[ONFI_SUBFEATURE_PARAM_LEN]; -- int ret; -- -- feature[0] = MXIC_BLOCK_PROTECTION_ALL_LOCK; -- nand_select_target(chip, 0); -- ret = nand_set_features(chip, ONFI_FEATURE_ADDR_MXIC_PROTECTION, -- feature); -- nand_deselect_target(chip); -- if (ret) -- pr_err("%s all blocks failed\n", __func__); -- -- return ret; --} -- --static int mxic_nand_unlock(struct nand_chip *chip, loff_t ofs, uint64_t len) --{ -- u8 feature[ONFI_SUBFEATURE_PARAM_LEN]; -- int ret; -- -- feature[0] = MXIC_BLOCK_PROTECTION_ALL_UNLOCK; -- nand_select_target(chip, 0); -- ret = nand_set_features(chip, ONFI_FEATURE_ADDR_MXIC_PROTECTION, -- feature); -- nand_deselect_target(chip); -- if (ret) -- pr_err("%s all blocks failed\n", __func__); -- -- return ret; --} -- --static void macronix_nand_block_protection_support(struct nand_chip *chip) --{ -- u8 feature[ONFI_SUBFEATURE_PARAM_LEN]; -- int ret; -- -- bitmap_set(chip->parameters.get_feature_list, -- ONFI_FEATURE_ADDR_MXIC_PROTECTION, 1); -- -- feature[0] = MXIC_BLOCK_PROTECTION_ALL_UNLOCK; -- nand_select_target(chip, 0); -- ret = nand_get_features(chip, ONFI_FEATURE_ADDR_MXIC_PROTECTION, -- feature); -- nand_deselect_target(chip); -- if (ret || feature[0] != MXIC_BLOCK_PROTECTION_ALL_LOCK) { -- if (ret) -- pr_err("Block protection check failed\n"); -- -- bitmap_clear(chip->parameters.get_feature_list, -- ONFI_FEATURE_ADDR_MXIC_PROTECTION, 1); -- return; -- } -- -- bitmap_set(chip->parameters.set_feature_list, -- ONFI_FEATURE_ADDR_MXIC_PROTECTION, 1); -- -- chip->ops.lock_area = mxic_nand_lock; -- chip->ops.unlock_area = mxic_nand_unlock; --} -- - static int nand_power_down_op(struct nand_chip *chip) - { - int ret; -@@ -488,7 +417,6 @@ static int macronix_nand_init(struct nan - - macronix_nand_fix_broken_get_timings(chip); - macronix_nand_onfi_init(chip); -- macronix_nand_block_protection_support(chip); - macronix_nand_deep_power_down_support(chip); - macronix_nand_setup_otp(chip); - From f4c5d0e77e39a88404da8d3567b6df0b8002fda0 Mon Sep 17 00:00:00 2001 From: John Audia Date: Thu, 12 Dec 2024 15:33:15 -0500 Subject: [PATCH 247/877] bcm27xx: patches: cherry-pick for RP1 kmods Cherry-pick patches to support building RP1 modules. Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/17233 Signed-off-by: Robert Marko (cherry picked from commit 613dd79d5eabe53f07a7b74cc062d91cfc550403) --- ...1351-mailbox-Add-RP1-mailbox-support.patch | 252 +++ ...rmware-Add-an-RP1-firmware-interface.patch | 421 ++++ .../950-1353-misc-Add-RP1-PIO-driver.patch | 1385 +++++++++++++ ...0-1354-fixup-musc-add-RP1-PIO-driver.patch | 29 + ...0-1355-misc-rp1-pio-Add-an-in-kernel.patch | 1797 +++++++++++++++++ .../950-1356-pwm-Add-pwm-pio-rp1-driver.patch | 299 +++ ...io-Fix-copy-paste-error-in-pio_rp1.h.patch | 25 + .../950-1357-rpi-pio-add-missing.patch | 42 + ...950-1358-misc-rpi-pio-back-port-some.patch | 39 + .../950-1359-misc-rp1-pio-Add-FIFO.patch | 215 ++ ...o-Fix-parameter-checks-wihout-client.patch | 25 + ...misc-rp1-pio-Add-compat_ioctl-method.patch | 91 + ...port-for-Raspberry-Pi-RP1-ethernet-c.patch | 43 + ...t-PLL_SEC_RST-in-rp1_pll_divider_off.patch | 27 + ...ise-the-use-of-the-CLK_IS_CRITICAL-f.patch | 124 ++ ...-Fixup-RP1-ethernet-DT-configuration.patch | 50 + .../950-1427-clk-rp1-Add-RP1_CLK_DMA.patch | 44 + ...1-clk-Remove-CLK_IGNORE_UNUSED-flags.patch | 59 + ...e-clk_sys-for-ethernet-hclk-and-pclk.patch | 45 + ...Link-RP1-DMA-to-the-associated-clock.patch | 24 + ...Add-interlaced-modes-and-PIO-program.patch | 762 +++++++ ...pwm-Improve-PWM_PIO_RP1-dependencies.patch | 22 + ...pwm-Improve-PWM_PIO_RP1-dependencies.patch | 20 + ...i-Fix-optional-dependency-on-RP1_PIO.patch | 99 + ...p1-pio-Support-larger-data-transfers.patch | 127 ++ ...0-1471-fixup-misc-Add-RP1-PIO-driver.patch | 24 + ...-rp1-pio-More-logical-probe-sequence.patch | 81 + ...o-Convert-floats-to-24.8-fixed-point.patch | 92 + ...5-misc-rp1-pio-Minor-cosmetic-tweaks.patch | 42 + ...sc-rp1-pio-Add-in-kernel-DMA-support.patch | 508 +++++ ...-1477-misc-Add-ws2812-pio-rp1-driver.patch | 568 ++++++ ...1478-overlays-Add-ws2812-pio-overlay.patch | 107 + 32 files changed, 7488 insertions(+) create mode 100644 target/linux/bcm27xx/patches-6.6/950-1351-mailbox-Add-RP1-mailbox-support.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1352-firmware-Add-an-RP1-firmware-interface.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1353-misc-Add-RP1-PIO-driver.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1354-fixup-musc-add-RP1-PIO-driver.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1355-misc-rp1-pio-Add-an-in-kernel.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1356-pwm-Add-pwm-pio-rp1-driver.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1357-misc-rp1-pio-Fix-copy-paste-error-in-pio_rp1.h.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1357-rpi-pio-add-missing.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1358-misc-rpi-pio-back-port-some.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1359-misc-rp1-pio-Add-FIFO.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1360-misc-rp1-pio-Fix-parameter-checks-wihout-client.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1394-misc-rp1-pio-Add-compat_ioctl-method.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1423-net-macb-Add-support-for-Raspberry-Pi-RP1-ethernet-c.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1424-rp1-clk-Only-set-PLL_SEC_RST-in-rp1_pll_divider_off.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1425-rp1-clk-Rationalise-the-use-of-the-CLK_IS_CRITICAL-f.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1426-dt-arm64-Fixup-RP1-ethernet-DT-configuration.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1427-clk-rp1-Add-RP1_CLK_DMA.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1428-rp1-clk-Remove-CLK_IGNORE_UNUSED-flags.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1429-dt-rp1-Use-clk_sys-for-ethernet-hclk-and-pclk.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1430-dt-rp1-Link-RP1-DMA-to-the-associated-clock.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1456-drm-rp1-rp1-dpi-Add-interlaced-modes-and-PIO-program.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1457-pwm-Improve-PWM_PIO_RP1-dependencies.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1458-Revert-pwm-Improve-PWM_PIO_RP1-dependencies.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1463-drm-rp1-rp1-dpi-Fix-optional-dependency-on-RP1_PIO.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1468-misc-rp1-pio-Support-larger-data-transfers.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1471-fixup-misc-Add-RP1-PIO-driver.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1473-misc-rp1-pio-More-logical-probe-sequence.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1474-misc-rp1-pio-Convert-floats-to-24.8-fixed-point.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1475-misc-rp1-pio-Minor-cosmetic-tweaks.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1476-misc-rp1-pio-Add-in-kernel-DMA-support.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1477-misc-Add-ws2812-pio-rp1-driver.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1478-overlays-Add-ws2812-pio-overlay.patch diff --git a/target/linux/bcm27xx/patches-6.6/950-1351-mailbox-Add-RP1-mailbox-support.patch b/target/linux/bcm27xx/patches-6.6/950-1351-mailbox-Add-RP1-mailbox-support.patch new file mode 100644 index 00000000000000..23bdb6a8fb0f6f --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1351-mailbox-Add-RP1-mailbox-support.patch @@ -0,0 +1,252 @@ +From 0d58d8cfb6f989f290d983552fcaa116e582e84a Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 31 Oct 2024 17:33:38 +0000 +Subject: [PATCH] mailbox: Add RP1 mailbox support + +The Raspberry Pi RP1 includes 2 M3 cores running firmware. This driver +adds a mailbox communication channel to them via a doorbell and some +shared memory. + +Signed-off-by: Phil Elwell +--- + drivers/mailbox/Kconfig | 9 ++ + drivers/mailbox/Makefile | 2 + + drivers/mailbox/rp1-mailbox.c | 208 ++++++++++++++++++++++++++++++++++ + 3 files changed, 219 insertions(+) + create mode 100644 drivers/mailbox/rp1-mailbox.c + +--- a/drivers/mailbox/Kconfig ++++ b/drivers/mailbox/Kconfig +@@ -295,4 +295,13 @@ config QCOM_IPCC + acts as an interrupt controller for receiving interrupts from clients. + Say Y here if you want to build this driver. + ++config MBOX_RP1 ++ tristate "RP1 Mailbox" ++ depends on MFD_RP1 ++ help ++ An implementation of a mailbox interface to the Raspberry Pi RP1 I/O ++ interface. Although written as a mailbox driver, the hardware only ++ provides an array of 32 doorbells. ++ Say Y here if you want to use the RP1 Mailbox. ++ + endif +--- a/drivers/mailbox/Makefile ++++ b/drivers/mailbox/Makefile +@@ -62,3 +62,5 @@ obj-$(CONFIG_SPRD_MBOX) += sprd-mailbox + obj-$(CONFIG_QCOM_IPCC) += qcom-ipcc.o + + obj-$(CONFIG_APPLE_MAILBOX) += apple-mailbox.o ++ ++obj-$(CONFIG_MBOX_RP1) += rp1-mailbox.o +--- /dev/null ++++ b/drivers/mailbox/rp1-mailbox.c +@@ -0,0 +1,208 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (C) 2023 Raspberry Pi Ltd. ++ * ++ * Parts of this driver are based on: ++ * - bcm2835-mailbox.c ++ * Copyright (C) 2010,2015 Broadcom ++ * Copyright (C) 2013-2014 Lubomir Rintel ++ * Copyright (C) 2013 Craig McGeachie ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* ++ * RP1's PROC_EVENTS register can generate interrupts on the M3 cores (when ++ * enabled). The 32-bit register is treated as 32 events, all of which share a ++ * common interrupt. HOST_EVENTS is the same in the reverse direction. ++ */ ++#define SYSCFG_PROC_EVENTS 0x00000008 ++#define SYSCFG_HOST_EVENTS 0x0000000c ++#define SYSCFG_HOST_EVENT_IRQ_EN 0x00000010 ++#define SYSCFG_HOST_EVENT_IRQ 0x00000014 ++ ++#define HW_SET_BITS 0x00002000 ++#define HW_CLR_BITS 0x00003000 ++ ++#define MAX_CHANS 4 /* 32 is the hardware limit */ ++ ++struct rp1_mbox { ++ void __iomem *regs; ++ unsigned int irq; ++ struct mbox_controller controller; ++}; ++ ++static struct rp1_mbox *rp1_chan_mbox(struct mbox_chan *chan) ++{ ++ return container_of(chan->mbox, struct rp1_mbox, controller); ++} ++ ++static unsigned int rp1_chan_event(struct mbox_chan *chan) ++{ ++ return (unsigned int)(uintptr_t)chan->con_priv; ++} ++ ++static irqreturn_t rp1_mbox_irq(int irq, void *dev_id) ++{ ++ struct rp1_mbox *mbox = dev_id; ++ struct mbox_chan *chan; ++ unsigned int doorbell; ++ unsigned int evs; ++ ++ evs = readl(mbox->regs + SYSCFG_HOST_EVENT_IRQ); ++ writel(evs, mbox->regs + SYSCFG_HOST_EVENTS + HW_CLR_BITS); ++ ++ while (evs) { ++ doorbell = __ffs(evs); ++ chan = &mbox->controller.chans[doorbell]; ++ mbox_chan_received_data(chan, NULL); ++ evs &= ~(1 << doorbell); ++ } ++ return IRQ_HANDLED; ++} ++ ++static int rp1_send_data(struct mbox_chan *chan, void *data) ++{ ++ struct rp1_mbox *mbox = rp1_chan_mbox(chan); ++ unsigned int event = rp1_chan_event(chan); ++ ++ writel(event, mbox->regs + SYSCFG_PROC_EVENTS + HW_SET_BITS); ++ ++ return 0; ++} ++ ++static int rp1_startup(struct mbox_chan *chan) ++{ ++ struct rp1_mbox *mbox = rp1_chan_mbox(chan); ++ unsigned int event = rp1_chan_event(chan); ++ ++ writel(event, mbox->regs + SYSCFG_HOST_EVENT_IRQ_EN + HW_SET_BITS); ++ ++ return 0; ++} ++ ++static void rp1_shutdown(struct mbox_chan *chan) ++{ ++ struct rp1_mbox *mbox = rp1_chan_mbox(chan); ++ unsigned int event = rp1_chan_event(chan); ++ ++ writel(event, mbox->regs + SYSCFG_HOST_EVENT_IRQ_EN + HW_CLR_BITS); ++} ++ ++static bool rp1_last_tx_done(struct mbox_chan *chan) ++{ ++ struct rp1_mbox *mbox = rp1_chan_mbox(chan); ++ unsigned int event = rp1_chan_event(chan); ++ unsigned int evs; ++ ++ evs = readl(mbox->regs + SYSCFG_HOST_EVENT_IRQ); ++ ++ return !(evs & event); ++} ++ ++static const struct mbox_chan_ops rp1_mbox_chan_ops = { ++ .send_data = rp1_send_data, ++ .startup = rp1_startup, ++ .shutdown = rp1_shutdown, ++ .last_tx_done = rp1_last_tx_done ++}; ++ ++static struct mbox_chan *rp1_mbox_xlate(struct mbox_controller *mbox, ++ const struct of_phandle_args *spec) ++{ ++ struct mbox_chan *chan; ++ unsigned int doorbell; ++ ++ if (spec->args_count != 1) ++ return ERR_PTR(-EINVAL); ++ ++ doorbell = spec->args[0]; ++ if (doorbell >= MAX_CHANS) ++ return ERR_PTR(-EINVAL); ++ ++ chan = &mbox->chans[doorbell]; ++ if (chan->con_priv) ++ return ERR_PTR(-EBUSY); ++ ++ chan->con_priv = (void *)(uintptr_t)(1 << doorbell); ++ ++ return chan; ++} ++ ++static int rp1_mbox_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct mbox_chan *chans; ++ struct rp1_mbox *mbox; ++ int ret = 0; ++ ++ mbox = devm_kzalloc(dev, sizeof(*mbox), GFP_KERNEL); ++ if (mbox == NULL) ++ return -ENOMEM; ++ ++ ret = devm_request_irq(dev, platform_get_irq(pdev, 0), ++ rp1_mbox_irq, 0, dev_name(dev), mbox); ++ if (ret) { ++ dev_err(dev, "Failed to register a mailbox IRQ handler: %d\n", ++ ret); ++ return -ENODEV; ++ } ++ ++ mbox->regs = devm_platform_ioremap_resource(pdev, 0); ++ if (IS_ERR(mbox->regs)) { ++ ret = PTR_ERR(mbox->regs); ++ return ret; ++ } ++ ++ chans = devm_kcalloc(dev, MAX_CHANS, sizeof(*chans), GFP_KERNEL); ++ if (!chans) ++ return -ENOMEM; ++ ++ mbox->controller.txdone_poll = true; ++ mbox->controller.txpoll_period = 5; ++ mbox->controller.ops = &rp1_mbox_chan_ops; ++ mbox->controller.of_xlate = &rp1_mbox_xlate; ++ mbox->controller.dev = dev; ++ mbox->controller.num_chans = MAX_CHANS; ++ mbox->controller.chans = chans; ++ ++ ret = devm_mbox_controller_register(dev, &mbox->controller); ++ if (ret) ++ return ret; ++ ++ platform_set_drvdata(pdev, mbox); ++ ++ return 0; ++} ++ ++static const struct of_device_id rp1_mbox_of_match[] = { ++ { .compatible = "raspberrypi,rp1-mbox", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, rp1_mbox_of_match); ++ ++static struct platform_driver rp1_mbox_driver = { ++ .driver = { ++ .name = "rp1-mbox", ++ .of_match_table = rp1_mbox_of_match, ++ }, ++ .probe = rp1_mbox_probe, ++}; ++ ++module_platform_driver(rp1_mbox_driver); ++ ++MODULE_AUTHOR("Phil Elwell "); ++MODULE_DESCRIPTION("RP1 mailbox IPC driver"); ++MODULE_LICENSE("GPL v2"); diff --git a/target/linux/bcm27xx/patches-6.6/950-1352-firmware-Add-an-RP1-firmware-interface.patch b/target/linux/bcm27xx/patches-6.6/950-1352-firmware-Add-an-RP1-firmware-interface.patch new file mode 100644 index 00000000000000..3a9eb03c94607f --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1352-firmware-Add-an-RP1-firmware-interface.patch @@ -0,0 +1,421 @@ +From 67daeadcaa7cee1f4b9df7aa108d199e73f35451 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 31 Oct 2024 17:36:54 +0000 +Subject: [PATCH] firmware: Add an RP1 firmware interface over mbox + +The RP1 firmware runs a simple communications channel over some shared +memory and a mailbox. This driver provides access to that channel. + +Signed-off-by: Phil Elwell +--- + drivers/firmware/Kconfig | 9 + + drivers/firmware/Makefile | 1 + + drivers/firmware/rp1.c | 316 +++++++++++++++++++++++++++++++++++ + include/linux/rp1-firmware.h | 53 ++++++ + 4 files changed, 379 insertions(+) + create mode 100644 drivers/firmware/rp1.c + create mode 100644 include/linux/rp1-firmware.h + +--- a/drivers/firmware/Kconfig ++++ b/drivers/firmware/Kconfig +@@ -153,6 +153,15 @@ config RASPBERRYPI_FIRMWARE + This option enables support for communicating with the firmware on the + Raspberry Pi. + ++config FIRMWARE_RP1 ++ tristate "RP1 Firmware Driver" ++ depends on MBOX_RP1 ++ help ++ The Raspberry Pi RP1 processor presents a firmware ++ interface using shared memory and a mailbox. To enable ++ the driver that communicates with it, say Y. Otherwise, ++ say N. ++ + config FW_CFG_SYSFS + tristate "QEMU fw_cfg device support in sysfs" + depends on SYSFS && (ARM || ARM64 || PARISC || PPC_PMAC || SPARC || X86) +--- a/drivers/firmware/Makefile ++++ b/drivers/firmware/Makefile +@@ -17,6 +17,7 @@ obj-$(CONFIG_ISCSI_IBFT) += iscsi_ibft.o + obj-$(CONFIG_FIRMWARE_MEMMAP) += memmap.o + obj-$(CONFIG_MTK_ADSP_IPC) += mtk-adsp-ipc.o + obj-$(CONFIG_RASPBERRYPI_FIRMWARE) += raspberrypi.o ++obj-$(CONFIG_FIRMWARE_RP1) += rp1.o + obj-$(CONFIG_FW_CFG_SYSFS) += qemu_fw_cfg.o + obj-$(CONFIG_QCOM_SCM) += qcom-scm.o + qcom-scm-objs += qcom_scm.o qcom_scm-smc.o qcom_scm-legacy.o +--- /dev/null ++++ b/drivers/firmware/rp1.c +@@ -0,0 +1,316 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (C) 2023-24 Raspberry Pi Ltd. ++ * ++ * Parts of this driver are based on: ++ * - raspberrypi.c, by Eric Anholt ++ * Copyright (C) 2015 Broadcom ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define RP1_MAILBOX_FIRMWARE 0 ++ ++enum rp1_firmware_ops { ++ MBOX_SUCCESS = 0x0000, ++ GET_FIRMWARE_VERSION = 0x0001, // na -> 160-bit version ++ GET_FEATURE = 0x0002, // FOURCC -> op base (0 == unsupported), op count ++ ++ COMMON_COUNT ++}; ++ ++struct rp1_firmware { ++ struct mbox_client cl; ++ struct mbox_chan *chan; /* The doorbell channel */ ++ uint32_t __iomem *buf; /* The shared buffer */ ++ u32 buf_size; /* The size of the shared buffer */ ++ struct completion c; ++ ++ struct kref consumers; ++}; ++ ++struct rp1_get_feature_resp { ++ uint32_t op_base; ++ uint32_t op_count; ++}; ++ ++static DEFINE_MUTEX(transaction_lock); ++ ++static const struct of_device_id rp1_firmware_of_match[] = { ++ { .compatible = "raspberrypi,rp1-firmware", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, rp1_firmware_of_match); ++ ++static void response_callback(struct mbox_client *cl, void *msg) ++{ ++ struct rp1_firmware *fw = container_of(cl, struct rp1_firmware, cl); ++ ++ complete(&fw->c); ++} ++ ++/* ++ * Sends a request to the RP1 firmware and synchronously waits for the reply. ++ * Returns zero or a positive count of response bytes on success, negative on ++ * error. ++ */ ++ ++int rp1_firmware_message(struct rp1_firmware *fw, uint16_t op, ++ const void *data, unsigned int data_len, ++ void *resp, unsigned int resp_space) ++{ ++ int ret; ++ u32 rc; ++ ++ if (data_len + 4 > fw->buf_size) ++ return -EINVAL; ++ ++ mutex_lock(&transaction_lock); ++ ++ memcpy_toio(&fw->buf[1], data, data_len); ++ writel((op << 16) | data_len, fw->buf); ++ ++ reinit_completion(&fw->c); ++ ret = mbox_send_message(fw->chan, NULL); ++ if (ret >= 0) { ++ if (wait_for_completion_timeout(&fw->c, HZ)) ++ ret = 0; ++ else ++ ret = -ETIMEDOUT; ++ } else { ++ dev_err(fw->cl.dev, "mbox_send_message returned %d\n", ret); ++ } ++ ++ if (ret == 0) { ++ rc = readl(fw->buf); ++ if (rc & 0x80000000) { ++ ret = (int32_t)rc; ++ } else { ++ ret = min(rc, resp_space); ++ memcpy_fromio(resp, &fw->buf[1], ret); ++ } ++ } ++ ++ mutex_unlock(&transaction_lock); ++ ++ return ret; ++} ++EXPORT_SYMBOL_GPL(rp1_firmware_message); ++ ++static void rp1_firmware_delete(struct kref *kref) ++{ ++ struct rp1_firmware *fw = container_of(kref, struct rp1_firmware, consumers); ++ ++ mbox_free_channel(fw->chan); ++ kfree(fw); ++} ++ ++void rp1_firmware_put(struct rp1_firmware *fw) ++{ ++ kref_put(&fw->consumers, rp1_firmware_delete); ++} ++EXPORT_SYMBOL_GPL(rp1_firmware_put); ++ ++int rp1_firmware_get_feature(struct rp1_firmware *fw, uint32_t fourcc, ++ uint32_t *op_base, uint32_t *op_count) ++{ ++ struct rp1_get_feature_resp resp; ++ int ret; ++ ++ memset(&resp, 0, sizeof(resp)); ++ ret = rp1_firmware_message(fw, GET_FEATURE, ++ &fourcc, sizeof(fourcc), ++ &resp, sizeof(resp)); ++ *op_base = resp.op_base; ++ *op_count = resp.op_count; ++ if (ret < 0) ++ return ret; ++ if (ret < sizeof(resp) || !resp.op_base) ++ return -EOPNOTSUPP; ++ return 0; ++} ++EXPORT_SYMBOL_GPL(rp1_firmware_get_feature); ++ ++static void devm_rp1_firmware_put(void *data) ++{ ++ struct rp1_firmware *fw = data; ++ ++ rp1_firmware_put(fw); ++} ++ ++/** ++ * rp1_firmware_get - Get pointer to rp1_firmware structure. ++ * ++ * The reference to rp1_firmware has to be released with rp1_firmware_put(). ++ * ++ * Returns an error pointer on failure. ++ */ ++struct rp1_firmware *rp1_firmware_get(struct device_node *client) ++{ ++ const char *match = rp1_firmware_of_match[0].compatible; ++ struct platform_device *pdev; ++ struct device_node *fwnode; ++ struct rp1_firmware *fw; ++ ++ if (client) { ++ fwnode = of_parse_phandle(client, "firmware", 0); ++ if (!fwnode) ++ fwnode = of_get_parent(client); ++ if (fwnode && !of_device_is_compatible(fwnode, match)) { ++ of_node_put(fwnode); ++ fwnode = NULL; ++ } ++ } ++ ++ if (!fwnode) ++ fwnode = of_find_matching_node(NULL, rp1_firmware_of_match); ++ ++ if (!fwnode) ++ return ERR_PTR(-ENOENT); ++ ++ pdev = of_find_device_by_node(fwnode); ++ of_node_put(fwnode); ++ ++ if (!pdev) ++ return ERR_PTR(-EPROBE_DEFER); ++ ++ fw = platform_get_drvdata(pdev); ++ if (!fw) ++ goto err_defer; ++ ++ if (!kref_get_unless_zero(&fw->consumers)) ++ goto err_defer; ++ ++ put_device(&pdev->dev); ++ ++ return fw; ++ ++err_defer: ++ put_device(&pdev->dev); ++ return ERR_PTR(-EPROBE_DEFER); ++} ++EXPORT_SYMBOL_GPL(rp1_firmware_get); ++ ++/** ++ * devm_rp1_firmware_get - Get pointer to rp1_firmware structure. ++ * @firmware_node: Pointer to the firmware Device Tree node. ++ * ++ * Returns NULL is the firmware device is not ready. ++ */ ++struct rp1_firmware *devm_rp1_firmware_get(struct device *dev, struct device_node *client) ++{ ++ struct rp1_firmware *fw; ++ int ret; ++ ++ fw = rp1_firmware_get(client); ++ if (IS_ERR(fw)) ++ return fw; ++ ++ ret = devm_add_action_or_reset(dev, devm_rp1_firmware_put, fw); ++ if (ret) ++ return ERR_PTR(ret); ++ ++ return fw; ++} ++EXPORT_SYMBOL_GPL(devm_rp1_firmware_get); ++ ++static int rp1_firmware_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct device_node *shmem; ++ struct rp1_firmware *fw; ++ struct resource res; ++ uint32_t version[5]; ++ int ret; ++ ++ shmem = of_parse_phandle(dev->of_node, "shmem", 0); ++ if (!of_device_is_compatible(shmem, "raspberrypi,rp1-shmem")) { ++ of_node_put(shmem); ++ return -ENXIO; ++ } ++ ++ ret = of_address_to_resource(shmem, 0, &res); ++ of_node_put(shmem); ++ if (ret) { ++ dev_err(dev, "failed to get shared memory (%pOF) - %d\n", shmem, ret); ++ return ret; ++ } ++ ++ /* ++ * Memory will be freed by rp1_firmware_delete() once all users have ++ * released their firmware handles. Don't use devm_kzalloc() here. ++ */ ++ fw = kzalloc(sizeof(*fw), GFP_KERNEL); ++ if (!fw) ++ return -ENOMEM; ++ ++ fw->buf_size = resource_size(&res); ++ fw->buf = devm_ioremap(dev, res.start, fw->buf_size); ++ if (!fw->buf) { ++ dev_err(dev, "failed to ioremap shared memory\n"); ++ kfree(fw); ++ return -EADDRNOTAVAIL; ++ } ++ ++ fw->cl.dev = dev; ++ fw->cl.rx_callback = response_callback; ++ fw->cl.tx_block = false; ++ ++ fw->chan = mbox_request_channel(&fw->cl, RP1_MAILBOX_FIRMWARE); ++ if (IS_ERR(fw->chan)) { ++ int ret = PTR_ERR(fw->chan); ++ ++ if (ret != -EPROBE_DEFER) ++ dev_err(dev, "Failed to get mbox channel: %d\n", ret); ++ kfree(fw); ++ return ret; ++ } ++ ++ init_completion(&fw->c); ++ kref_init(&fw->consumers); ++ ++ platform_set_drvdata(pdev, fw); ++ ++ ret = rp1_firmware_message(fw, GET_FIRMWARE_VERSION, ++ NULL, 0, &version, sizeof(version)); ++ if (ret == sizeof(version)) { ++ dev_info(dev, "RP1 Firmware version %08x%08x%08x%08x%08x\n", ++ version[0], version[1], version[2], version[3], version[4]); ++ ret = 0; ++ } else if (ret >= 0) { ++ ret = -EIO; ++ } ++ ++ return ret; ++} ++ ++static int rp1_firmware_remove(struct platform_device *pdev) ++{ ++ struct rp1_firmware *fw = platform_get_drvdata(pdev); ++ ++ rp1_firmware_put(fw); ++ ++ return 0; ++} ++ ++static struct platform_driver rp1_firmware_driver = { ++ .driver = { ++ .name = "rp1-firmware", ++ .of_match_table = rp1_firmware_of_match, ++ }, ++ .probe = rp1_firmware_probe, ++ .remove = rp1_firmware_remove, ++}; ++ ++module_platform_driver(rp1_firmware_driver); ++ ++MODULE_AUTHOR("Phil Elwell "); ++MODULE_DESCRIPTION("RP1 firmware driver"); ++MODULE_LICENSE("GPL v2"); +--- /dev/null ++++ b/include/linux/rp1-firmware.h +@@ -0,0 +1,53 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++/* ++ * Copyright (C) 2023 2023-2024 Raspberry Pi Ltd. ++ */ ++ ++#ifndef __SOC_RP1_FIRMWARE_H__ ++#define __SOC_RP1_FIRMWARE_H__ ++ ++#include ++#include ++ ++#define RP1_FOURCC(s) ((uint32_t)((s[0] << 24) | (s[1] << 16) | (s[2] << 8) | (s[3] << 0))) ++ ++struct rp1_firmware; ++ ++#if IS_ENABLED(CONFIG_FIRMWARE_RP1) ++int rp1_firmware_message(struct rp1_firmware *fw, uint16_t op, ++ const void *data, unsigned int data_len, ++ void *resp, unsigned int resp_space); ++void rp1_firmware_put(struct rp1_firmware *fw); ++struct rp1_firmware *rp1_firmware_get(struct device_node *fwnode); ++struct rp1_firmware *devm_rp1_firmware_get(struct device *dev, struct device_node *fwnode); ++int rp1_firmware_get_feature(struct rp1_firmware *fw, uint32_t fourcc, ++ uint32_t *op_base, uint32_t *op_count); ++#else ++static inline int rp1_firmware_message(struct rp1_firmware *fw, uint16_t op, ++ const void *data, unsigned int data_len, ++ void *resp, unsigned int resp_space) ++{ ++ return -EOPNOTSUPP; ++} ++ ++static inline void rp1_firmware_put(struct rp1_firmware *fw) { } ++ ++static inline struct rp1_firmware *rp1_firmware_get(struct device_node *fwnode) ++{ ++ return NULL; ++} ++ ++static inline struct rp1_firmware *devm_rp1_firmware_get(struct device *dev, ++ struct device_node *fwnode) ++{ ++ return NULL; ++} ++ ++static inline int rp1_firmware_get_feature(struct rp1_firmware *fw, uint32_t fourcc, ++ uint32_t *op_base, uint32_t *op_count) ++{ ++ return -EOPNOTSUPP; ++} ++#endif ++ ++#endif /* __SOC_RP1_FIRMWARE_H__ */ diff --git a/target/linux/bcm27xx/patches-6.6/950-1353-misc-Add-RP1-PIO-driver.patch b/target/linux/bcm27xx/patches-6.6/950-1353-misc-Add-RP1-PIO-driver.patch new file mode 100644 index 00000000000000..521129b919002a --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1353-misc-Add-RP1-PIO-driver.patch @@ -0,0 +1,1385 @@ +From 55fd5c9018e1520d45f08cf08630a493ec7dedea Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 31 Oct 2024 18:26:00 +0000 +Subject: [PATCH] misc: Add RP1 PIO driver + +Provide remote access to the PIO hardware in RP1. There is a single +instance, with 4 state machines. + +Signed-off-by: Phil Elwell +--- + drivers/misc/Kconfig | 8 + + drivers/misc/Makefile | 1 + + drivers/misc/rp1-fw-pio.h | 53 ++ + drivers/misc/rp1-pio.c | 1064 ++++++++++++++++++++++++++++++++ + include/uapi/misc/rp1_pio_if.h | 212 +++++++ + 5 files changed, 1338 insertions(+) + create mode 100644 drivers/misc/rp1-fw-pio.h + create mode 100644 drivers/misc/rp1-pio.c + create mode 100644 include/uapi/misc/rp1_pio_if.h + +--- a/drivers/misc/Kconfig ++++ b/drivers/misc/Kconfig +@@ -17,6 +17,14 @@ config BCM2835_SMI + Driver for enabling and using Broadcom's Secondary/Slow Memory Interface. + Appears as /dev/bcm2835_smi. For ioctl interface see drivers/misc/bcm2835_smi.h + ++config RP1_PIO ++ tristate "Raspberry Pi RP1 PIO driver" ++ select FIRMWARE_RP1 ++ default n ++ help ++ Driver providing control of the Raspberry Pi PIO block, as found in ++ RP1. ++ + config AD525X_DPOT + tristate "Analog Devices Digital Potentiometers" + depends on (I2C || SPI) && SYSFS +--- a/drivers/misc/Makefile ++++ b/drivers/misc/Makefile +@@ -18,6 +18,7 @@ obj-$(CONFIG_TIFM_7XX1) += tifm_7 + obj-$(CONFIG_PHANTOM) += phantom.o + obj-$(CONFIG_QCOM_COINCELL) += qcom-coincell.o + obj-$(CONFIG_QCOM_FASTRPC) += fastrpc.o ++obj-$(CONFIG_RP1_PIO) += rp1-pio.o + obj-$(CONFIG_SENSORS_BH1770) += bh1770glc.o + obj-$(CONFIG_SENSORS_APDS990X) += apds990x.o + obj-$(CONFIG_ENCLOSURE_SERVICES) += enclosure.o +--- /dev/null ++++ b/drivers/misc/rp1-fw-pio.h +@@ -0,0 +1,53 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++/* ++ * Copyright (C) 2023 2023-2024 Raspberry Pi Ltd. ++ */ ++ ++#ifndef __SOC_RP1_FIRMWARE_OPS_H__ ++#define __SOC_RP1_FIRMWARE_OPS_H__ ++ ++#include ++ ++#define FOURCC_PIO RP1_FOURCC("PIO ") ++ ++enum rp1_pio_ops { ++ PIO_CAN_ADD_PROGRAM, // u16 num_instrs, u16 origin -> origin ++ PIO_ADD_PROGRAM, // u16 num_instrs, u16 origin, u16 prog[] -> rc ++ PIO_REMOVE_PROGRAM, // u16 num_instrs, u16 origin ++ PIO_CLEAR_INSTR_MEM, // - ++ ++ PIO_SM_CLAIM, // u16 mask -> sm ++ PIO_SM_UNCLAIM, // u16 mask ++ PIO_SM_IS_CLAIMED, // u16 mask -> claimed ++ ++ PIO_SM_INIT, // u16 sm, u16 initial_pc, u32 sm_config[4] ++ PIO_SM_SET_CONFIG, // u16 sm, u16 rsvd, u32 sm_config[4] ++ PIO_SM_EXEC, // u16 sm, u16 instr, u8 blocking, u8 rsvd ++ PIO_SM_CLEAR_FIFOS, // u16 sm ++ PIO_SM_SET_CLKDIV, // u16 sm, u16 div_int, u8 div_frac, u8 rsvd ++ PIO_SM_SET_PINS, // u16 sm, u16 rsvd, u32 values, u32 mask ++ PIO_SM_SET_PINDIRS, // u16 sm, u16 rsvd, u32 dirs, u32 mask ++ PIO_SM_SET_ENABLED, // u16 mask, u8 enable, u8 rsvd ++ PIO_SM_RESTART, // u16 mask ++ PIO_SM_CLKDIV_RESTART, // u16 mask ++ PIO_SM_ENABLE_SYNC, // u16 mask ++ PIO_SM_PUT, // u16 sm, u8 blocking, u8 rsvd, u32 data ++ PIO_SM_GET, // u16 sm, u8 blocking, u8 rsvd -> u32 data ++ PIO_SM_SET_DMACTRL, // u16 sm, u16 is_tx, u32 ctrl ++ ++ GPIO_INIT, // u16 gpio ++ GPIO_SET_FUNCTION, // u16 gpio, u16 fn ++ GPIO_SET_PULLS, // u16 gpio, u8 up, u8 down ++ GPIO_SET_OUTOVER, // u16 gpio, u16 value ++ GPIO_SET_INOVER, // u16 gpio, u16 value ++ GPIO_SET_OEOVER, // u16 gpio, u16 value ++ GPIO_SET_INPUT_ENABLED, // u16 gpio, u16 value ++ GPIO_SET_DRIVE_STRENGTH, // u16 gpio, u16 value ++ ++ READ_HW, // src address, len -> data bytes ++ WRITE_HW, // dst address, data ++ ++ PIO_COUNT ++}; ++ ++#endif +--- /dev/null ++++ b/drivers/misc/rp1-pio.c +@@ -0,0 +1,1064 @@ ++// SPDX-License-Identifier: GPL-2.0 ++// PIO driver for RP1 ++// ++// Copyright (C) 2023-2024 Raspberry Pi Ltd. ++// ++// Parts of this driver are based on: ++// - vcio.c, by Noralf Trønnes ++// Copyright (C) 2010 Broadcom ++// Copyright (C) 2015 Noralf Trønnes ++// Copyright (C) 2021 Raspberry Pi (Trading) Ltd. ++// - bcm2835_smi.c & bcm2835_smi_dev.c by Luke Wren ++// Copyright (c) 2015 Raspberry Pi (Trading) Ltd. ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "rp1-fw-pio.h" ++ ++#define DRIVER_NAME "rp1-pio" ++ ++#define RP1_PIO_SMS_COUNT 4 ++#define RP1_PIO_INSTR_COUNT 32 ++ ++#define MAX_ARG_SIZE 256 ++ ++#define RP1_PIO_FIFO_TX0 0x00 ++#define RP1_PIO_FIFO_TX1 0x04 ++#define RP1_PIO_FIFO_TX2 0x08 ++#define RP1_PIO_FIFO_TX3 0x0c ++#define RP1_PIO_FIFO_RX0 0x10 ++#define RP1_PIO_FIFO_RX1 0x14 ++#define RP1_PIO_FIFO_RX2 0x18 ++#define RP1_PIO_FIFO_RX3 0x1c ++ ++#define RP1_PIO_DMACTRL_DEFAULT 0x80000104 ++ ++#define HANDLER(_n, _f) \ ++ [_IOC_NR(PIO_IOC_ ## _n)] = { #_n, rp1_pio_ ## _f, _IOC_SIZE(PIO_IOC_ ## _n) } ++ ++ ++#define ROUND_UP(x, y) (((x) + (y) - 1) - (((x) + (y) - 1) % (y))) ++ ++#define DMA_BOUNCE_BUFFER_SIZE 0x1000 ++#define DMA_BOUNCE_BUFFER_COUNT 4 ++ ++struct dma_buf_info { ++ void *buf; ++ dma_addr_t phys; ++ struct scatterlist sgl; ++}; ++ ++struct dma_info { ++ struct semaphore buf_sem; ++ struct dma_chan *chan; ++ size_t buf_size; ++ size_t buf_count; ++ unsigned int head_idx; ++ unsigned int tail_idx; ++ struct dma_buf_info bufs[DMA_BOUNCE_BUFFER_COUNT]; ++}; ++ ++struct rp1_pio_device { ++ struct platform_device *pdev; ++ struct rp1_firmware *fw; ++ uint16_t fw_pio_base; ++ uint16_t fw_pio_count; ++ dev_t dev_num; ++ struct class *dev_class; ++ struct cdev cdev; ++ phys_addr_t phys_addr; ++ uint32_t claimed_sms; ++ uint32_t claimed_dmas; ++ spinlock_t lock; ++ struct mutex instr_mutex; ++ struct dma_info dma_configs[RP1_PIO_SMS_COUNT][RP1_PIO_DIR_COUNT]; ++ uint32_t used_instrs; ++ uint8_t instr_refcounts[RP1_PIO_INSTR_COUNT]; ++ uint16_t instrs[RP1_PIO_INSTR_COUNT]; ++ uint client_count; ++}; ++ ++struct rp1_pio_client { ++ struct rp1_pio_device *pio; ++ uint32_t claimed_sms; ++ uint32_t claimed_instrs; ++ uint32_t claimed_dmas; ++}; ++ ++static struct rp1_pio_device *g_pio; ++ ++static int rp1_pio_message(struct rp1_pio_device *pio, ++ uint16_t op, const void *data, unsigned int data_len) ++{ ++ uint32_t rc; ++ int ret; ++ ++ if (op >= pio->fw_pio_count) ++ return -EOPNOTSUPP; ++ ret = rp1_firmware_message(pio->fw, pio->fw_pio_base + op, ++ data, data_len, ++ &rc, sizeof(rc)); ++ if (ret == 4) ++ ret = rc; ++ return ret; ++} ++ ++static int rp1_pio_message_resp(struct rp1_pio_device *pio, ++ uint16_t op, const void *data, unsigned int data_len, ++ void *resp, void __user *userbuf, unsigned int resp_len) ++{ ++ uint32_t resp_buf[1 + 32]; ++ int ret; ++ ++ if (op >= pio->fw_pio_count) ++ return -EOPNOTSUPP; ++ if (resp_len + 4 >= sizeof(resp_buf)) ++ return -EINVAL; ++ if (!resp && !userbuf) ++ return -EINVAL; ++ ret = rp1_firmware_message(pio->fw, pio->fw_pio_base + op, ++ data, data_len, ++ resp_buf, resp_len + 4); ++ if (ret >= 4 && !resp_buf[0]) { ++ ret -= 4; ++ if (resp) ++ memcpy(resp, &resp_buf[1], ret); ++ else if (copy_to_user(userbuf, &resp_buf[1], ret)) ++ ret = -EFAULT; ++ } else if (ret >= 0) { ++ ret = -EIO; ++ } ++ return ret; ++} ++ ++static int rp1_pio_read_hw(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_pio_device *pio = client->pio; ++ struct rp1_access_hw_args *args = param; ++ ++ return rp1_pio_message_resp(pio, READ_HW, ++ args, 8, NULL, args->data, args->len); ++} ++ ++static int rp1_pio_write_hw(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_pio_device *pio = client->pio; ++ struct rp1_access_hw_args *args = param; ++ uint32_t write_buf[32 + 1]; ++ int len; ++ ++ len = min(args->len, sizeof(write_buf) - 4); ++ write_buf[0] = args->addr; ++ if (copy_from_user(&write_buf[1], args->data, len)) ++ return -EFAULT; ++ return rp1_firmware_message(pio->fw, pio->fw_pio_base + WRITE_HW, ++ write_buf, 4 + len, NULL, 0); ++} ++ ++static int rp1_pio_find_program(struct rp1_pio_device *pio, ++ struct rp1_pio_add_program_args *prog) ++{ ++ uint start, end, prog_size; ++ uint32_t used_mask; ++ uint i; ++ ++ start = (prog->origin != RP1_PIO_ORIGIN_ANY) ? prog->origin : 0; ++ end = (prog->origin != RP1_PIO_ORIGIN_ANY) ? prog->origin : ++ (RP1_PIO_INSTRUCTION_COUNT - prog->num_instrs); ++ prog_size = sizeof(prog->instrs[0]) * prog->num_instrs; ++ used_mask = (uint32_t)(~0) >> (32 - prog->num_instrs); ++ ++ /* Find the best match */ ++ for (i = start; i <= end; i++) { ++ uint32_t mask = used_mask << i; ++ ++ if ((pio->used_instrs & mask) != mask) ++ continue; ++ if (!memcmp(pio->instrs + i, prog->instrs, prog_size)) ++ return i; ++ } ++ ++ return -1; ++} ++ ++static int rp1_pio_can_add_program(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_pio_add_program_args *args = param; ++ struct rp1_pio_device *pio = client->pio; ++ int offset; ++ ++ if (args->num_instrs > RP1_PIO_INSTR_COUNT || ++ ((args->origin != RP1_PIO_ORIGIN_ANY) && ++ (args->origin >= RP1_PIO_INSTR_COUNT || ++ ((args->origin + args->num_instrs) > RP1_PIO_INSTR_COUNT)))) ++ return -EINVAL; ++ ++ mutex_lock(&pio->instr_mutex); ++ offset = rp1_pio_find_program(pio, args); ++ mutex_unlock(&pio->instr_mutex); ++ if (offset >= 0) ++ return offset; ++ ++ /* Don't send the instructions, just the header */ ++ return rp1_pio_message(pio, PIO_CAN_ADD_PROGRAM, args, ++ offsetof(struct rp1_pio_add_program_args, instrs)); ++} ++ ++static int rp1_pio_add_program(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_pio_add_program_args *args = param; ++ struct rp1_pio_device *pio = client->pio; ++ int offset; ++ uint i; ++ ++ if (args->num_instrs > RP1_PIO_INSTR_COUNT || ++ ((args->origin != RP1_PIO_ORIGIN_ANY) && ++ (args->origin >= RP1_PIO_INSTR_COUNT || ++ ((args->origin + args->num_instrs) > RP1_PIO_INSTR_COUNT)))) ++ return -EINVAL; ++ ++ mutex_lock(&pio->instr_mutex); ++ offset = rp1_pio_find_program(pio, args); ++ if (offset < 0) ++ offset = rp1_pio_message(client->pio, PIO_ADD_PROGRAM, args, sizeof(*args)); ++ ++ if (offset >= 0) { ++ uint32_t used_mask; ++ uint prog_size; ++ ++ used_mask = ((uint32_t)(~0) >> (-args->num_instrs & 0x1f)) << offset; ++ prog_size = sizeof(args->instrs[0]) * args->num_instrs; ++ ++ if ((pio->used_instrs & used_mask) != used_mask) { ++ pio->used_instrs |= used_mask; ++ memcpy(pio->instrs + offset, args->instrs, prog_size); ++ } ++ client->claimed_instrs |= used_mask; ++ for (i = 0; i < args->num_instrs; i++) ++ pio->instr_refcounts[offset + i]++; ++ } ++ mutex_unlock(&pio->instr_mutex); ++ return offset; ++} ++ ++static void rp1_pio_remove_instrs(struct rp1_pio_device *pio, uint32_t mask) ++{ ++ struct rp1_pio_remove_program_args args; ++ uint i; ++ ++ mutex_lock(&pio->instr_mutex); ++ args.num_instrs = 0; ++ for (i = 0; ; i++, mask >>= 1) { ++ if ((mask & 1) && pio->instr_refcounts[i] && !--pio->instr_refcounts[i]) { ++ pio->used_instrs &= ~(1 << i); ++ args.num_instrs++; ++ } else if (args.num_instrs) { ++ args.origin = i - args.num_instrs; ++ rp1_pio_message(pio, PIO_REMOVE_PROGRAM, &args, sizeof(args)); ++ args.num_instrs = 0; ++ } ++ if (!mask) ++ break; ++ } ++ mutex_unlock(&pio->instr_mutex); ++} ++ ++static int rp1_pio_remove_program(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_pio_remove_program_args *args = param; ++ uint32_t used_mask; ++ int ret = -ENOENT; ++ ++ if (args->num_instrs > RP1_PIO_INSTR_COUNT || ++ args->origin >= RP1_PIO_INSTR_COUNT || ++ (args->origin + args->num_instrs) > RP1_PIO_INSTR_COUNT) ++ return -EINVAL; ++ ++ used_mask = ((uint32_t)(~0) >> (32 - args->num_instrs)) << args->origin; ++ if ((client->claimed_instrs & used_mask) == used_mask) { ++ client->claimed_instrs &= ~used_mask; ++ rp1_pio_remove_instrs(client->pio, used_mask); ++ ret = 0; ++ } ++ return ret; ++} ++ ++static int rp1_pio_clear_instr_mem(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_pio_device *pio = client->pio; ++ ++ mutex_lock(&pio->instr_mutex); ++ (void)rp1_pio_message(client->pio, PIO_CLEAR_INSTR_MEM, NULL, 0); ++ memset(pio->instr_refcounts, 0, sizeof(pio->instr_refcounts)); ++ pio->used_instrs = 0; ++ client->claimed_instrs = 0; ++ mutex_unlock(&pio->instr_mutex); ++ return 0; ++} ++ ++static int rp1_pio_sm_claim(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_pio_sm_claim_args *args = param; ++ struct rp1_pio_device *pio = client->pio; ++ int ret; ++ ++ mutex_lock(&pio->instr_mutex); ++ ret = rp1_pio_message(client->pio, PIO_SM_CLAIM, args, sizeof(*args)); ++ if (ret >= 0) { ++ if (args->mask) ++ client->claimed_sms |= args->mask; ++ else ++ client->claimed_sms |= (1 << ret); ++ pio->claimed_sms |= client->claimed_sms; ++ } ++ mutex_unlock(&pio->instr_mutex); ++ return ret; ++} ++ ++static int rp1_pio_sm_unclaim(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_pio_sm_claim_args *args = param; ++ struct rp1_pio_device *pio = client->pio; ++ ++ mutex_lock(&pio->instr_mutex); ++ (void)rp1_pio_message(client->pio, PIO_SM_UNCLAIM, args, sizeof(*args)); ++ client->claimed_sms &= ~args->mask; ++ pio->claimed_sms &= ~args->mask; ++ mutex_unlock(&pio->instr_mutex); ++ return 0; ++} ++ ++static int rp1_pio_sm_is_claimed(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_pio_sm_claim_args *args = param; ++ ++ return rp1_pio_message(client->pio, PIO_SM_IS_CLAIMED, args, sizeof(*args)); ++} ++ ++static int rp1_pio_sm_init(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_pio_sm_init_args *args = param; ++ ++ return rp1_pio_message(client->pio, PIO_SM_INIT, args, sizeof(*args)); ++} ++ ++static int rp1_pio_sm_set_config(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_pio_sm_set_config_args *args = param; ++ ++ return rp1_pio_message(client->pio, PIO_SM_SET_CONFIG, args, sizeof(*args)); ++} ++ ++static int rp1_pio_sm_exec(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_pio_sm_exec_args *args = param; ++ ++ return rp1_pio_message(client->pio, PIO_SM_EXEC, args, sizeof(*args)); ++} ++ ++static int rp1_pio_sm_clear_fifos(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_pio_sm_clear_fifos_args *args = param; ++ ++ return rp1_pio_message(client->pio, PIO_SM_CLEAR_FIFOS, args, sizeof(*args)); ++} ++ ++static int rp1_pio_sm_set_clkdiv(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_pio_sm_set_clkdiv_args *args = param; ++ ++ return rp1_pio_message(client->pio, PIO_SM_SET_CLKDIV, args, sizeof(*args)); ++} ++ ++static int rp1_pio_sm_set_pins(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_pio_sm_set_pins_args *args = param; ++ ++ return rp1_pio_message(client->pio, PIO_SM_SET_PINS, args, sizeof(*args)); ++} ++ ++static int rp1_pio_sm_set_pindirs(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_pio_sm_set_pindirs_args *args = param; ++ ++ return rp1_pio_message(client->pio, PIO_SM_SET_PINDIRS, args, sizeof(*args)); ++} ++ ++static int rp1_pio_sm_set_enabled(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_pio_sm_set_enabled_args *args = param; ++ ++ return rp1_pio_message(client->pio, PIO_SM_SET_ENABLED, args, sizeof(*args)); ++} ++ ++static int rp1_pio_sm_restart(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_pio_sm_restart_args *args = param; ++ ++ return rp1_pio_message(client->pio, PIO_SM_RESTART, args, sizeof(*args)); ++} ++ ++static int rp1_pio_sm_clkdiv_restart(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_pio_sm_restart_args *args = param; ++ ++ return rp1_pio_message(client->pio, PIO_SM_CLKDIV_RESTART, args, sizeof(*args)); ++} ++ ++static int rp1_pio_sm_enable_sync(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_pio_sm_enable_sync_args *args = param; ++ ++ return rp1_pio_message(client->pio, PIO_SM_ENABLE_SYNC, args, sizeof(*args)); ++} ++ ++static int rp1_pio_sm_put(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_pio_sm_put_args *args = param; ++ ++ return rp1_pio_message(client->pio, PIO_SM_PUT, args, sizeof(*args)); ++} ++ ++static int rp1_pio_sm_get(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_pio_sm_get_args *args = param; ++ int ret; ++ ++ ret = rp1_pio_message_resp(client->pio, PIO_SM_GET, args, sizeof(*args), ++ &args->data, NULL, sizeof(args->data)); ++ if (ret >= 0) ++ return offsetof(struct rp1_pio_sm_get_args, data) + ret; ++ return ret; ++} ++ ++static int rp1_pio_sm_set_dmactrl(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_pio_sm_set_dmactrl_args *args = param; ++ ++ return rp1_pio_message(client->pio, PIO_SM_SET_DMACTRL, args, sizeof(*args)); ++} ++ ++static int rp1_pio_gpio_init(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_gpio_init_args *args = param; ++ ++ return rp1_pio_message(client->pio, GPIO_INIT, args, sizeof(*args)); ++} ++ ++static int rp1_pio_gpio_set_function(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_gpio_set_function_args *args = param; ++ ++ return rp1_pio_message(client->pio, GPIO_SET_FUNCTION, args, sizeof(*args)); ++} ++ ++static int rp1_pio_gpio_set_pulls(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_gpio_set_pulls_args *args = param; ++ ++ return rp1_pio_message(client->pio, GPIO_SET_PULLS, args, sizeof(*args)); ++} ++ ++static int rp1_pio_gpio_set_outover(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_gpio_set_args *args = param; ++ ++ return rp1_pio_message(client->pio, GPIO_SET_OUTOVER, args, sizeof(*args)); ++} ++ ++static int rp1_pio_gpio_set_inover(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_gpio_set_args *args = param; ++ ++ return rp1_pio_message(client->pio, GPIO_SET_INOVER, args, sizeof(*args)); ++} ++ ++static int rp1_pio_gpio_set_oeover(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_gpio_set_args *args = param; ++ ++ return rp1_pio_message(client->pio, GPIO_SET_OEOVER, args, sizeof(*args)); ++} ++ ++static int rp1_pio_gpio_set_input_enabled(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_gpio_set_args *args = param; ++ ++ return rp1_pio_message(client->pio, GPIO_SET_INPUT_ENABLED, args, sizeof(*args)); ++} ++ ++static int rp1_pio_gpio_set_drive_strength(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_gpio_set_args *args = param; ++ ++ return rp1_pio_message(client->pio, GPIO_SET_DRIVE_STRENGTH, args, sizeof(*args)); ++} ++ ++static void rp1_pio_sm_dma_callback(void *param) ++{ ++ struct dma_info *dma = param; ++ ++ up(&dma->buf_sem); ++} ++ ++static void rp1_pio_sm_dma_free(struct device *dev, struct dma_info *dma) ++{ ++ dmaengine_terminate_all(dma->chan); ++ while (dma->buf_count > 0) { ++ dma->buf_count--; ++ dma_free_coherent(dev, ROUND_UP(dma->buf_size, PAGE_SIZE), ++ dma->bufs[dma->buf_count].buf, dma->bufs[dma->buf_count].phys); ++ } ++ ++ dma_release_channel(dma->chan); ++} ++ ++static int rp1_pio_sm_config_xfer(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_pio_sm_config_xfer_args *args = param; ++ struct rp1_pio_sm_set_dmactrl_args set_dmactrl_args; ++ struct rp1_pio_device *pio = client->pio; ++ struct platform_device *pdev = pio->pdev; ++ struct device *dev = &pdev->dev; ++ struct dma_slave_config config = {}; ++ phys_addr_t fifo_addr; ++ struct dma_info *dma; ++ uint32_t dma_mask; ++ char chan_name[4]; ++ uint buf_size; ++ int ret = 0; ++ ++ if (args->sm >= RP1_PIO_SMS_COUNT || args->dir >= RP1_PIO_DIR_COUNT || ++ !args->buf_size || (args->buf_size & 3) || ++ !args->buf_count || args->buf_count > DMA_BOUNCE_BUFFER_COUNT) ++ return -EINVAL; ++ ++ dma_mask = 1 << (args->sm * 2 + args->dir); ++ ++ dma = &pio->dma_configs[args->sm][args->dir]; ++ ++ spin_lock(&pio->lock); ++ if (pio->claimed_dmas & dma_mask) ++ rp1_pio_sm_dma_free(dev, dma); ++ pio->claimed_dmas |= dma_mask; ++ client->claimed_dmas |= dma_mask; ++ spin_unlock(&pio->lock); ++ ++ dma->buf_size = args->buf_size; ++ /* Round up the allocations */ ++ buf_size = ROUND_UP(args->buf_size, PAGE_SIZE); ++ sema_init(&dma->buf_sem, 0); ++ ++ /* Allocate and configure a DMA channel */ ++ /* Careful - each SM FIFO has its own DREQ value */ ++ chan_name[0] = (args->dir == RP1_PIO_DIR_TO_SM) ? 't' : 'r'; ++ chan_name[1] = 'x'; ++ chan_name[2] = '0' + args->sm; ++ chan_name[3] = '\0'; ++ ++ dma->chan = dma_request_chan(dev, chan_name); ++ if (IS_ERR(dma->chan)) ++ return PTR_ERR(dma->chan); ++ ++ /* Alloc and map bounce buffers */ ++ for (dma->buf_count = 0; dma->buf_count < args->buf_count; dma->buf_count++) { ++ struct dma_buf_info *dbi = &dma->bufs[dma->buf_count]; ++ ++ dbi->buf = dma_alloc_coherent(dma->chan->device->dev, buf_size, ++ &dbi->phys, GFP_KERNEL); ++ if (!dbi->buf) { ++ ret = -ENOMEM; ++ goto err_dma_free; ++ } ++ sg_init_table(&dbi->sgl, 1); ++ sg_dma_address(&dbi->sgl) = dbi->phys; ++ } ++ ++ fifo_addr = pio->phys_addr; ++ fifo_addr += args->sm * (RP1_PIO_FIFO_TX1 - RP1_PIO_FIFO_TX0); ++ fifo_addr += (args->dir == RP1_PIO_DIR_TO_SM) ? RP1_PIO_FIFO_TX0 : RP1_PIO_FIFO_RX0; ++ ++ config.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; ++ config.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; ++ config.src_addr = fifo_addr; ++ config.dst_addr = fifo_addr; ++ config.direction = (args->dir == RP1_PIO_DIR_TO_SM) ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM; ++ ++ ret = dmaengine_slave_config(dma->chan, &config); ++ if (ret) ++ goto err_dma_free; ++ ++ set_dmactrl_args.sm = args->sm; ++ set_dmactrl_args.is_tx = (args->dir == RP1_PIO_DIR_TO_SM); ++ set_dmactrl_args.ctrl = RP1_PIO_DMACTRL_DEFAULT; ++ if (args->dir == RP1_PIO_DIR_FROM_SM) ++ set_dmactrl_args.ctrl = (RP1_PIO_DMACTRL_DEFAULT & ~0x1f) | 1; ++ ++ ret = rp1_pio_sm_set_dmactrl(client, &set_dmactrl_args); ++ if (ret) ++ goto err_dma_free; ++ ++ return 0; ++ ++err_dma_free: ++ rp1_pio_sm_dma_free(dev, dma); ++ ++ spin_lock(&pio->lock); ++ client->claimed_dmas &= ~dma_mask; ++ pio->claimed_dmas &= ~dma_mask; ++ spin_unlock(&pio->lock); ++ ++ return ret; ++} ++ ++static int rp1_pio_sm_tx_user(struct rp1_pio_device *pio, struct dma_info *dma, ++ const void __user *userbuf, size_t bytes) ++{ ++ struct platform_device *pdev = pio->pdev; ++ struct dma_async_tx_descriptor *desc; ++ struct device *dev = &pdev->dev; ++ int ret = 0; ++ ++ // Clean the slate - we're running synchronously ++ dma->head_idx = 0; ++ dma->tail_idx = 0; ++ ++ while (bytes > 0) { ++ size_t copy_bytes = min(bytes, dma->buf_size); ++ struct dma_buf_info *dbi; ++ ++ /* grab the next free buffer, waiting if they're all full */ ++ if (dma->head_idx - dma->tail_idx == dma->buf_count) { ++ if (down_timeout(&dma->buf_sem, ++ msecs_to_jiffies(1000))) { ++ dev_err(dev, "DMA bounce timed out\n"); ++ break; ++ } ++ dma->tail_idx++; ++ } ++ ++ dbi = &dma->bufs[dma->head_idx % dma->buf_count]; ++ ++ sg_dma_len(&dbi->sgl) = copy_bytes; ++ ++ ret = copy_from_user(dbi->buf, userbuf, copy_bytes); ++ if (ret < 0) ++ break; ++ ++ userbuf += copy_bytes; ++ ++ desc = dmaengine_prep_slave_sg(dma->chan, &dbi->sgl, 1, ++ DMA_MEM_TO_DEV, ++ DMA_PREP_INTERRUPT | DMA_CTRL_ACK | ++ DMA_PREP_FENCE); ++ if (!desc) { ++ dev_err(dev, "DMA preparation failedzn"); ++ ret = -EIO; ++ break; ++ } ++ ++ desc->callback = rp1_pio_sm_dma_callback; ++ desc->callback_param = dma; ++ ++ /* Submit the buffer - the callback will kick the semaphore */ ++ ret = dmaengine_submit(desc); ++ if (ret < 0) ++ break; ++ ret = 0; ++ ++ dma_async_issue_pending(dma->chan); ++ ++ dma->head_idx++; ++ bytes -= copy_bytes; ++ } ++ ++ // Block for completion ++ while (dma->tail_idx != dma->head_idx) { ++ if (down_timeout(&dma->buf_sem, msecs_to_jiffies(1000))) { ++ dev_err(dev, "DMA wait timed out\n"); ++ ret = -ETIMEDOUT; ++ break; ++ } ++ dma->tail_idx++; ++ } ++ ++ return ret; ++} ++ ++static int rp1_pio_sm_rx_user(struct rp1_pio_device *pio, struct dma_info *dma, ++ void __user *userbuf, size_t bytes) ++{ ++ struct platform_device *pdev = pio->pdev; ++ struct dma_async_tx_descriptor *desc; ++ struct device *dev = &pdev->dev; ++ int ret = 0; ++ ++ /* Clean the slate - we're running synchronously */ ++ dma->head_idx = 0; ++ dma->tail_idx = 0; ++ ++ while (bytes || dma->tail_idx != dma->head_idx) { ++ size_t copy_bytes = min(bytes, dma->buf_size); ++ struct dma_buf_info *dbi; ++ ++ /* ++ * wait for the next RX to complete if all the buffers are ++ * outstanding or we're finishing up. ++ */ ++ if (!bytes || dma->head_idx - dma->tail_idx == dma->buf_count) { ++ if (down_timeout(&dma->buf_sem, ++ msecs_to_jiffies(1000))) { ++ dev_err(dev, "DMA wait timed out"); ++ ret = -ETIMEDOUT; ++ break; ++ } ++ ++ dbi = &dma->bufs[dma->tail_idx++ % dma->buf_count]; ++ ret = copy_to_user(userbuf, dbi->buf, sg_dma_len(&dbi->sgl)); ++ if (ret < 0) ++ break; ++ userbuf += sg_dma_len(&dbi->sgl); ++ ++ if (!bytes) ++ continue; ++ } ++ ++ dbi = &dma->bufs[dma->head_idx % dma->buf_count]; ++ sg_dma_len(&dbi->sgl) = copy_bytes; ++ desc = dmaengine_prep_slave_sg(dma->chan, &dbi->sgl, 1, ++ DMA_DEV_TO_MEM, ++ DMA_PREP_INTERRUPT | DMA_CTRL_ACK | ++ DMA_PREP_FENCE); ++ if (!desc) { ++ dev_err(dev, "DMA preparation failed"); ++ ret = -EIO; ++ break; ++ } ++ ++ desc->callback = rp1_pio_sm_dma_callback; ++ desc->callback_param = dma; ++ ++ // Submit the buffer - the callback will kick the semaphore ++ ++ ret = dmaengine_submit(desc); ++ if (ret < 0) ++ break; ++ ++ dma_async_issue_pending(dma->chan); ++ ++ dma->head_idx++; ++ bytes -= copy_bytes; ++ } ++ ++ return ret; ++} ++ ++static int rp1_pio_sm_xfer_data(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_pio_sm_xfer_data_args *args = param; ++ struct rp1_pio_device *pio = client->pio; ++ struct dma_info *dma; ++ ++ if (args->sm >= RP1_PIO_SMS_COUNT || args->dir >= RP1_PIO_DIR_COUNT || ++ !args->data_bytes || !args->data) ++ return -EINVAL; ++ ++ dma = &pio->dma_configs[args->sm][args->dir]; ++ ++ if (args->dir == RP1_PIO_DIR_TO_SM) ++ return rp1_pio_sm_tx_user(pio, dma, args->data, args->data_bytes); ++ else ++ return rp1_pio_sm_rx_user(pio, dma, args->data, args->data_bytes); ++} ++ ++struct handler_info { ++ const char *name; ++ int (*func)(struct rp1_pio_client *client, void *param); ++ int argsize; ++} ioctl_handlers[] = { ++ HANDLER(SM_CONFIG_XFER, sm_config_xfer), ++ HANDLER(SM_XFER_DATA, sm_xfer_data), ++ ++ HANDLER(CAN_ADD_PROGRAM, can_add_program), ++ HANDLER(ADD_PROGRAM, add_program), ++ HANDLER(REMOVE_PROGRAM, remove_program), ++ HANDLER(CLEAR_INSTR_MEM, clear_instr_mem), ++ ++ HANDLER(SM_CLAIM, sm_claim), ++ HANDLER(SM_UNCLAIM, sm_unclaim), ++ HANDLER(SM_IS_CLAIMED, sm_is_claimed), ++ ++ HANDLER(SM_INIT, sm_init), ++ HANDLER(SM_SET_CONFIG, sm_set_config), ++ HANDLER(SM_EXEC, sm_exec), ++ HANDLER(SM_CLEAR_FIFOS, sm_clear_fifos), ++ HANDLER(SM_SET_CLKDIV, sm_set_clkdiv), ++ HANDLER(SM_SET_PINS, sm_set_pins), ++ HANDLER(SM_SET_PINDIRS, sm_set_pindirs), ++ HANDLER(SM_SET_ENABLED, sm_set_enabled), ++ HANDLER(SM_RESTART, sm_restart), ++ HANDLER(SM_CLKDIV_RESTART, sm_clkdiv_restart), ++ HANDLER(SM_ENABLE_SYNC, sm_enable_sync), ++ HANDLER(SM_PUT, sm_put), ++ HANDLER(SM_GET, sm_get), ++ HANDLER(SM_SET_DMACTRL, sm_set_dmactrl), ++ ++ HANDLER(GPIO_INIT, gpio_init), ++ HANDLER(GPIO_SET_FUNCTION, gpio_set_function), ++ HANDLER(GPIO_SET_PULLS, gpio_set_pulls), ++ HANDLER(GPIO_SET_OUTOVER, gpio_set_outover), ++ HANDLER(GPIO_SET_INOVER, gpio_set_inover), ++ HANDLER(GPIO_SET_OEOVER, gpio_set_oeover), ++ HANDLER(GPIO_SET_INPUT_ENABLED, gpio_set_input_enabled), ++ HANDLER(GPIO_SET_DRIVE_STRENGTH, gpio_set_drive_strength), ++ ++ HANDLER(READ_HW, read_hw), ++ HANDLER(WRITE_HW, write_hw), ++}; ++ ++static int rp1_pio_open(struct inode *inode, struct file *filp) ++{ ++ struct rp1_pio_device *pio = g_pio; ++ struct rp1_pio_client *client; ++ ++ client = kzalloc(sizeof(*client), GFP_KERNEL); ++ ++ client->pio = pio; ++ filp->private_data = client; ++ ++ return 0; ++} ++ ++static int rp1_pio_release(struct inode *inode, struct file *filp) ++{ ++ struct rp1_pio_client *client = filp->private_data; ++ struct rp1_pio_device *pio = client->pio; ++ uint claimed_dmas = client->claimed_dmas; ++ int i; ++ ++ /* Free any allocated resources */ ++ ++ for (i = 0; claimed_dmas; i++) { ++ uint mask = (1 << i); ++ ++ if (claimed_dmas & mask) { ++ struct dma_info *dma = &pio->dma_configs[i >> 1][i & 1]; ++ ++ claimed_dmas &= ~mask; ++ rp1_pio_sm_dma_free(&pio->pdev->dev, dma); ++ } ++ } ++ ++ spin_lock(&pio->lock); ++ pio->claimed_dmas &= ~client->claimed_dmas; ++ spin_unlock(&pio->lock); ++ ++ if (client->claimed_sms) { ++ struct rp1_pio_sm_set_enabled_args se_args = { ++ .mask = client->claimed_sms, .enable = 0 ++ }; ++ struct rp1_pio_sm_claim_args uc_args = { ++ .mask = client->claimed_sms ++ }; ++ ++ rp1_pio_sm_set_enabled(client, &se_args); ++ rp1_pio_sm_unclaim(client, &uc_args); ++ } ++ ++ if (client->claimed_instrs) ++ rp1_pio_remove_instrs(pio, client->claimed_instrs); ++ ++ /* Reinitialise the SM? */ ++ ++ kfree(client); ++ ++ return 0; ++} ++ ++static long rp1_pio_ioctl(struct file *filp, unsigned int ioctl_num, ++ unsigned long ioctl_param) ++{ ++ struct rp1_pio_client *client = filp->private_data; ++ struct device *dev = &client->pio->pdev->dev; ++ void __user *argp = (void __user *)ioctl_param; ++ int nr = _IOC_NR(ioctl_num); ++ int sz = _IOC_SIZE(ioctl_num); ++ struct handler_info *hdlr = &ioctl_handlers[nr]; ++ uint32_t argbuf[MAX_ARG_SIZE/sizeof(uint32_t)]; ++ int ret; ++ ++ if (nr >= ARRAY_SIZE(ioctl_handlers) || !hdlr->func) { ++ dev_err(dev, "unknown ioctl: %x\n", ioctl_num); ++ return -EOPNOTSUPP; ++ } ++ ++ if (sz != hdlr->argsize) { ++ dev_err(dev, "wrong %s argsize (expected %d, got %d)\n", ++ hdlr->name, hdlr->argsize, sz); ++ return -EINVAL; ++ } ++ ++ if (copy_from_user(argbuf, argp, sz)) ++ return -EFAULT; ++ ++ ret = (hdlr->func)(client, argbuf); ++ dev_dbg(dev, "%s: %s -> %d\n", __func__, hdlr->name, ret); ++ if (ret > 0) { ++ if (copy_to_user(argp, argbuf, ret)) ++ ret = -EFAULT; ++ } ++ ++ return ret; ++} ++ ++const struct file_operations rp1_pio_fops = { ++ .owner = THIS_MODULE, ++ .open = rp1_pio_open, ++ .release = rp1_pio_release, ++ .unlocked_ioctl = rp1_pio_ioctl, ++}; ++ ++static int rp1_pio_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct resource *ioresource; ++ struct rp1_pio_device *pio; ++ struct rp1_firmware *fw; ++ uint32_t op_count = 0; ++ uint32_t op_base = 0; ++ struct device *cdev; ++ char dev_name[16]; ++ void *p; ++ int ret; ++ int i; ++ ++ /* Run-time check for a build-time misconfiguration */ ++ for (i = 0; i < ARRAY_SIZE(ioctl_handlers); i++) { ++ struct handler_info *hdlr = &ioctl_handlers[i]; ++ ++ if (WARN_ON(hdlr->argsize > MAX_ARG_SIZE)) ++ return -EINVAL; ++ } ++ ++ fw = devm_rp1_firmware_get(dev, dev->of_node); ++ if (IS_ERR(fw)) ++ return PTR_ERR(fw); ++ ++ ret = rp1_firmware_get_feature(fw, FOURCC_PIO, &op_base, &op_count); ++ if (ret < 0) ++ return ret; ++ ++ pio = devm_kzalloc(&pdev->dev, sizeof(*pio), GFP_KERNEL); ++ if (!pio) ++ return -ENOMEM; ++ ++ platform_set_drvdata(pdev, pio); ++ pio->fw_pio_base = op_base; ++ pio->fw_pio_count = op_count; ++ pio->pdev = pdev; ++ pio->fw = fw; ++ spin_lock_init(&pio->lock); ++ mutex_init(&pio->instr_mutex); ++ ++ p = devm_platform_get_and_ioremap_resource(pdev, 0, &ioresource); ++ if (IS_ERR(p)) ++ return PTR_ERR(p); ++ ++ pio->phys_addr = ioresource->start; ++ ++ ret = alloc_chrdev_region(&pio->dev_num, 0, 1, DRIVER_NAME); ++ if (ret < 0) { ++ dev_err(dev, "alloc_chrdev_region failed (rc=%d)\n", ret); ++ goto out_err; ++ } ++ ++ cdev_init(&pio->cdev, &rp1_pio_fops); ++ ret = cdev_add(&pio->cdev, pio->dev_num, 1); ++ if (ret) { ++ dev_err(dev, "cdev_add failed (err %d)\n", ret); ++ goto out_unregister; ++ } ++ ++ pio->dev_class = class_create(DRIVER_NAME); ++ if (IS_ERR(pio->dev_class)) { ++ ret = PTR_ERR(pio->dev_class); ++ dev_err(dev, "class_create failed (err %d)\n", ret); ++ goto out_cdev_del; ++ } ++ pdev->id = of_alias_get_id(pdev->dev.of_node, "pio"); ++ if (pdev->id < 0) { ++ dev_err(dev, "alias is missing\n"); ++ return -EINVAL; ++ goto out_class_destroy; ++ } ++ sprintf(dev_name, "pio%d", pdev->id); ++ cdev = device_create(pio->dev_class, NULL, pio->dev_num, NULL, dev_name); ++ if (IS_ERR(cdev)) { ++ ret = PTR_ERR(cdev); ++ dev_err(dev, "%s: device_create failed (err %d)\n", __func__, ret); ++ goto out_class_destroy; ++ } ++ ++ g_pio = pio; ++ ++ dev_info(dev, "Created instance as %s\n", dev_name); ++ return 0; ++ ++out_class_destroy: ++ class_destroy(pio->dev_class); ++ ++out_cdev_del: ++ cdev_del(&pio->cdev); ++ ++out_unregister: ++ unregister_chrdev_region(pio->dev_num, 1); ++ ++out_err: ++ return ret; ++} ++ ++static void rp1_pio_remove(struct platform_device *pdev) ++{ ++ struct rp1_pio_device *pio = platform_get_drvdata(pdev); ++ ++ /* There should be no clients */ ++ ++ if (g_pio == pio) ++ g_pio = NULL; ++} ++ ++static const struct of_device_id rp1_pio_ids[] = { ++ { .compatible = "raspberrypi,rp1-pio" }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, rp1_pio_ids); ++ ++static struct platform_driver rp1_pio_driver = { ++ .driver = { ++ .name = "rp1-pio", ++ .of_match_table = of_match_ptr(rp1_pio_ids), ++ }, ++ .probe = rp1_pio_probe, ++ .remove_new = rp1_pio_remove, ++ .shutdown = rp1_pio_remove, ++}; ++ ++module_platform_driver(rp1_pio_driver); ++ ++MODULE_DESCRIPTION("PIO controller driver for Raspberry Pi RP1"); ++MODULE_AUTHOR("Phil Elwell"); ++MODULE_LICENSE("GPL"); +--- /dev/null ++++ b/include/uapi/misc/rp1_pio_if.h +@@ -0,0 +1,212 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++/* ++ * Copyright (c) 2023-24 Raspberry Pi Ltd. ++ * All rights reserved. ++ */ ++#ifndef _PIO_RP1_IF_H ++#define _PIO_RP1_IF_H ++ ++#include ++ ++#define RP1_PIO_INSTRUCTION_COUNT 32 ++#define RP1_PIO_SM_COUNT 4 ++#define RP1_PIO_GPIO_COUNT 28 ++#define RP1_GPIO_FUNC_PIO 7 ++ ++#define RP1_PIO_ORIGIN_ANY ((uint16_t)(~0)) ++ ++#define RP1_PIO_DIR_TO_SM 0 ++#define RP1_PIO_DIR_FROM_SM 1 ++#define RP1_PIO_DIR_COUNT 2 ++ ++typedef struct { ++ uint32_t clkdiv; ++ uint32_t execctrl; ++ uint32_t shiftctrl; ++ uint32_t pinctrl; ++} rp1_pio_sm_config; ++ ++struct rp1_pio_add_program_args { ++ uint16_t num_instrs; ++ uint16_t origin; ++ uint16_t instrs[RP1_PIO_INSTRUCTION_COUNT]; ++}; ++ ++struct rp1_pio_remove_program_args { ++ uint16_t num_instrs; ++ uint16_t origin; ++}; ++ ++struct rp1_pio_sm_claim_args { ++ uint16_t mask; ++}; ++ ++struct rp1_pio_sm_init_args { ++ uint16_t sm; ++ uint16_t initial_pc; ++ rp1_pio_sm_config config; ++}; ++ ++struct rp1_pio_sm_set_config_args { ++ uint16_t sm; ++ uint16_t rsvd; ++ rp1_pio_sm_config config; ++}; ++ ++struct rp1_pio_sm_exec_args { ++ uint16_t sm; ++ uint16_t instr; ++ uint8_t blocking; ++ uint8_t rsvd; ++}; ++ ++struct rp1_pio_sm_clear_fifos_args { ++ uint16_t sm; ++}; ++ ++struct rp1_pio_sm_set_clkdiv_args { ++ uint16_t sm; ++ uint16_t div_int; ++ uint8_t div_frac; ++ uint8_t rsvd; ++}; ++ ++struct rp1_pio_sm_set_pins_args { ++ uint16_t sm; ++ uint16_t rsvd; ++ uint32_t values; ++ uint32_t mask; ++}; ++ ++struct rp1_pio_sm_set_pindirs_args { ++ uint16_t sm; ++ uint16_t rsvd; ++ uint32_t dirs; ++ uint32_t mask; ++}; ++ ++struct rp1_pio_sm_set_enabled_args { ++ uint16_t mask; ++ uint8_t enable; ++ uint8_t rsvd; ++}; ++ ++struct rp1_pio_sm_restart_args { ++ uint16_t mask; ++}; ++ ++struct rp1_pio_sm_clkdiv_restart_args { ++ uint16_t mask; ++}; ++ ++struct rp1_pio_sm_enable_sync_args { ++ uint16_t mask; ++}; ++ ++struct rp1_pio_sm_put_args { ++ uint16_t sm; ++ uint8_t blocking; ++ uint8_t rsvd; ++ uint32_t data; ++}; ++ ++struct rp1_pio_sm_get_args { ++ uint16_t sm; ++ uint8_t blocking; ++ uint8_t rsvd; ++ uint32_t data; /* IN/OUT */ ++}; ++ ++struct rp1_pio_sm_set_dmactrl_args { ++ uint16_t sm; ++ uint8_t is_tx; ++ uint8_t rsvd; ++ uint32_t ctrl; ++}; ++ ++struct rp1_gpio_init_args { ++ uint16_t gpio; ++}; ++ ++struct rp1_gpio_set_function_args { ++ uint16_t gpio; ++ uint16_t fn; ++}; ++ ++struct rp1_gpio_set_pulls_args { ++ uint16_t gpio; ++ uint8_t up; ++ uint8_t down; ++}; ++ ++struct rp1_gpio_set_args { ++ uint16_t gpio; ++ uint16_t value; ++}; ++ ++struct rp1_pio_sm_config_xfer_args { ++ uint16_t sm; ++ uint16_t dir; ++ uint16_t buf_size; ++ uint16_t buf_count; ++}; ++ ++struct rp1_pio_sm_xfer_data_args { ++ uint16_t sm; ++ uint16_t dir; ++ uint16_t data_bytes; ++ void *data; ++}; ++ ++struct rp1_access_hw_args { ++ uint32_t addr; ++ uint32_t len; ++ void *data; ++}; ++ ++#define PIO_IOC_MAGIC 102 ++ ++#define PIO_IOC_SM_CONFIG_XFER _IOW(PIO_IOC_MAGIC, 0, struct rp1_pio_sm_config_xfer_args) ++#define PIO_IOC_SM_XFER_DATA _IOW(PIO_IOC_MAGIC, 1, struct rp1_pio_sm_xfer_data_args) ++ ++#ifdef CONFIG_COMPAT ++//XXX #define PIO_IOC_SM_XFER_DATA32 _IOW(PIO_IOC_MAGIC, 2, struct pio_sm_xfer_data_args) ++#endif ++ ++#define PIO_IOC_READ_HW _IOW(PIO_IOC_MAGIC, 8, struct rp1_access_hw_args) ++#define PIO_IOC_WRITE_HW _IOW(PIO_IOC_MAGIC, 9, struct rp1_access_hw_args) ++ ++#define PIO_IOC_CAN_ADD_PROGRAM _IOW(PIO_IOC_MAGIC, 10, struct rp1_pio_add_program_args) ++#define PIO_IOC_ADD_PROGRAM _IOW(PIO_IOC_MAGIC, 11, struct rp1_pio_add_program_args) ++#define PIO_IOC_REMOVE_PROGRAM _IOW(PIO_IOC_MAGIC, 12, struct rp1_pio_remove_program_args) ++#define PIO_IOC_CLEAR_INSTR_MEM _IO(PIO_IOC_MAGIC, 13) ++ ++#define PIO_IOC_SM_CLAIM _IOW(PIO_IOC_MAGIC, 20, struct rp1_pio_sm_claim_args) ++#define PIO_IOC_SM_UNCLAIM _IOW(PIO_IOC_MAGIC, 21, struct rp1_pio_sm_claim_args) ++#define PIO_IOC_SM_IS_CLAIMED _IOW(PIO_IOC_MAGIC, 22, struct rp1_pio_sm_claim_args) ++ ++#define PIO_IOC_SM_INIT _IOW(PIO_IOC_MAGIC, 30, struct rp1_pio_sm_init_args) ++#define PIO_IOC_SM_SET_CONFIG _IOW(PIO_IOC_MAGIC, 31, struct rp1_pio_sm_set_config_args) ++#define PIO_IOC_SM_EXEC _IOW(PIO_IOC_MAGIC, 32, struct rp1_pio_sm_exec_args) ++#define PIO_IOC_SM_CLEAR_FIFOS _IOW(PIO_IOC_MAGIC, 33, struct rp1_pio_sm_clear_fifos_args) ++#define PIO_IOC_SM_SET_CLKDIV _IOW(PIO_IOC_MAGIC, 34, struct rp1_pio_sm_set_clkdiv_args) ++#define PIO_IOC_SM_SET_PINS _IOW(PIO_IOC_MAGIC, 35, struct rp1_pio_sm_set_pins_args) ++#define PIO_IOC_SM_SET_PINDIRS _IOW(PIO_IOC_MAGIC, 36, struct rp1_pio_sm_set_pindirs_args) ++#define PIO_IOC_SM_SET_ENABLED _IOW(PIO_IOC_MAGIC, 37, struct rp1_pio_sm_set_enabled_args) ++#define PIO_IOC_SM_RESTART _IOW(PIO_IOC_MAGIC, 38, struct rp1_pio_sm_restart_args) ++#define PIO_IOC_SM_CLKDIV_RESTART _IOW(PIO_IOC_MAGIC, 39, struct rp1_pio_sm_restart_args) ++#define PIO_IOC_SM_ENABLE_SYNC _IOW(PIO_IOC_MAGIC, 40, struct rp1_pio_sm_enable_sync_args) ++#define PIO_IOC_SM_PUT _IOW(PIO_IOC_MAGIC, 41, struct rp1_pio_sm_put_args) ++#define PIO_IOC_SM_GET _IOWR(PIO_IOC_MAGIC, 42, struct rp1_pio_sm_get_args) ++#define PIO_IOC_SM_SET_DMACTRL _IOW(PIO_IOC_MAGIC, 43, struct rp1_pio_sm_set_dmactrl_args) ++ ++#define PIO_IOC_GPIO_INIT _IOW(PIO_IOC_MAGIC, 50, struct rp1_gpio_init_args) ++#define PIO_IOC_GPIO_SET_FUNCTION _IOW(PIO_IOC_MAGIC, 51, struct rp1_gpio_set_function_args) ++#define PIO_IOC_GPIO_SET_PULLS _IOW(PIO_IOC_MAGIC, 52, struct rp1_gpio_set_pulls_args) ++#define PIO_IOC_GPIO_SET_OUTOVER _IOW(PIO_IOC_MAGIC, 53, struct rp1_gpio_set_args) ++#define PIO_IOC_GPIO_SET_INOVER _IOW(PIO_IOC_MAGIC, 54, struct rp1_gpio_set_args) ++#define PIO_IOC_GPIO_SET_OEOVER _IOW(PIO_IOC_MAGIC, 55, struct rp1_gpio_set_args) ++#define PIO_IOC_GPIO_SET_INPUT_ENABLED _IOW(PIO_IOC_MAGIC, 56, struct rp1_gpio_set_args) ++#define PIO_IOC_GPIO_SET_DRIVE_STRENGTH _IOW(PIO_IOC_MAGIC, 57, struct rp1_gpio_set_args) ++ ++#endif diff --git a/target/linux/bcm27xx/patches-6.6/950-1354-fixup-musc-add-RP1-PIO-driver.patch b/target/linux/bcm27xx/patches-6.6/950-1354-fixup-musc-add-RP1-PIO-driver.patch new file mode 100644 index 00000000000000..cd197f7a7b88e0 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1354-fixup-musc-add-RP1-PIO-driver.patch @@ -0,0 +1,29 @@ +From 1b5acd42281ad102b79f4e1794f0a0cccdafda05 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Sat, 16 Nov 2024 16:53:31 +0000 +Subject: [PATCH] fixup! misc: Add RP1 PIO driver + +Signed-off-by: Phil Elwell +--- + include/uapi/misc/rp1_pio_if.h | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +--- a/include/uapi/misc/rp1_pio_if.h ++++ b/include/uapi/misc/rp1_pio_if.h +@@ -1,4 +1,4 @@ +-/* SPDX-License-Identifier: GPL-2.0 */ ++/* SPDX-License-Identifier: GPL-2.0 + WITH Linux-syscall-note */ + /* + * Copyright (c) 2023-24 Raspberry Pi Ltd. + * All rights reserved. +@@ -169,10 +169,6 @@ struct rp1_access_hw_args { + #define PIO_IOC_SM_CONFIG_XFER _IOW(PIO_IOC_MAGIC, 0, struct rp1_pio_sm_config_xfer_args) + #define PIO_IOC_SM_XFER_DATA _IOW(PIO_IOC_MAGIC, 1, struct rp1_pio_sm_xfer_data_args) + +-#ifdef CONFIG_COMPAT +-//XXX #define PIO_IOC_SM_XFER_DATA32 _IOW(PIO_IOC_MAGIC, 2, struct pio_sm_xfer_data_args) +-#endif +- + #define PIO_IOC_READ_HW _IOW(PIO_IOC_MAGIC, 8, struct rp1_access_hw_args) + #define PIO_IOC_WRITE_HW _IOW(PIO_IOC_MAGIC, 9, struct rp1_access_hw_args) + diff --git a/target/linux/bcm27xx/patches-6.6/950-1355-misc-rp1-pio-Add-an-in-kernel.patch b/target/linux/bcm27xx/patches-6.6/950-1355-misc-rp1-pio-Add-an-in-kernel.patch new file mode 100644 index 00000000000000..6accaf000eb503 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1355-misc-rp1-pio-Add-an-in-kernel.patch @@ -0,0 +1,1797 @@ +From 2819a61eb000c207589c97eef9d69a237c6cfdf3 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 8 Nov 2024 09:31:38 +0000 +Subject: [PATCH] misc: rp1-pio: Add an in-kernel API + +The header file linux/pio_rp1.h adds a pico-sdk-like interface to the +RP1 PIO subsystem for other drivers. + +Signed-off-by: Phil Elwell +--- + drivers/misc/rp1-pio.c | 169 ++++-- + include/linux/pio_instructions.h | 481 +++++++++++++++++ + include/linux/pio_rp1.h | 873 +++++++++++++++++++++++++++++++ + 3 files changed, 1474 insertions(+), 49 deletions(-) + create mode 100644 include/linux/pio_instructions.h + create mode 100644 include/linux/pio_rp1.h + +--- a/drivers/misc/rp1-pio.c ++++ b/drivers/misc/rp1-pio.c +@@ -1,15 +1,17 @@ + // SPDX-License-Identifier: GPL-2.0 +-// PIO driver for RP1 +-// +-// Copyright (C) 2023-2024 Raspberry Pi Ltd. +-// +-// Parts of this driver are based on: +-// - vcio.c, by Noralf Trønnes +-// Copyright (C) 2010 Broadcom +-// Copyright (C) 2015 Noralf Trønnes +-// Copyright (C) 2021 Raspberry Pi (Trading) Ltd. +-// - bcm2835_smi.c & bcm2835_smi_dev.c by Luke Wren +-// Copyright (c) 2015 Raspberry Pi (Trading) Ltd. ++/* ++ * PIO driver for RP1 ++ * ++ * Copyright (C) 2023-2024 Raspberry Pi Ltd. ++ * ++ * Parts of this driver are based on: ++ * - vcio.c, by Noralf Trønnes ++ * Copyright (C) 2010 Broadcom ++ * Copyright (C) 2015 Noralf Trønnes ++ * Copyright (C) 2021 Raspberry Pi (Trading) Ltd. ++ * - bcm2835_smi.c & bcm2835_smi_dev.c by Luke Wren ++ * Copyright (c) 2015 Raspberry Pi (Trading) Ltd. ++ */ + + #include + #include +@@ -97,6 +99,7 @@ struct rp1_pio_client { + uint32_t claimed_sms; + uint32_t claimed_instrs; + uint32_t claimed_dmas; ++ int error; + }; + + static struct rp1_pio_device *g_pio; +@@ -195,7 +198,7 @@ static int rp1_pio_find_program(struct r + return -1; + } + +-static int rp1_pio_can_add_program(struct rp1_pio_client *client, void *param) ++int rp1_pio_can_add_program(struct rp1_pio_client *client, void *param) + { + struct rp1_pio_add_program_args *args = param; + struct rp1_pio_device *pio = client->pio; +@@ -217,8 +220,9 @@ static int rp1_pio_can_add_program(struc + return rp1_pio_message(pio, PIO_CAN_ADD_PROGRAM, args, + offsetof(struct rp1_pio_add_program_args, instrs)); + } ++EXPORT_SYMBOL_GPL(rp1_pio_can_add_program); + +-static int rp1_pio_add_program(struct rp1_pio_client *client, void *param) ++int rp1_pio_add_program(struct rp1_pio_client *client, void *param) + { + struct rp1_pio_add_program_args *args = param; + struct rp1_pio_device *pio = client->pio; +@@ -254,6 +258,7 @@ static int rp1_pio_add_program(struct rp + mutex_unlock(&pio->instr_mutex); + return offset; + } ++EXPORT_SYMBOL_GPL(rp1_pio_add_program); + + static void rp1_pio_remove_instrs(struct rp1_pio_device *pio, uint32_t mask) + { +@@ -277,7 +282,7 @@ static void rp1_pio_remove_instrs(struct + mutex_unlock(&pio->instr_mutex); + } + +-static int rp1_pio_remove_program(struct rp1_pio_client *client, void *param) ++int rp1_pio_remove_program(struct rp1_pio_client *client, void *param) + { + struct rp1_pio_remove_program_args *args = param; + uint32_t used_mask; +@@ -296,8 +301,9 @@ static int rp1_pio_remove_program(struct + } + return ret; + } ++EXPORT_SYMBOL_GPL(rp1_pio_remove_program); + +-static int rp1_pio_clear_instr_mem(struct rp1_pio_client *client, void *param) ++int rp1_pio_clear_instr_mem(struct rp1_pio_client *client, void *param) + { + struct rp1_pio_device *pio = client->pio; + +@@ -309,8 +315,9 @@ static int rp1_pio_clear_instr_mem(struc + mutex_unlock(&pio->instr_mutex); + return 0; + } ++EXPORT_SYMBOL_GPL(rp1_pio_clear_instr_mem); + +-static int rp1_pio_sm_claim(struct rp1_pio_client *client, void *param) ++int rp1_pio_sm_claim(struct rp1_pio_client *client, void *param) + { + struct rp1_pio_sm_claim_args *args = param; + struct rp1_pio_device *pio = client->pio; +@@ -328,8 +335,9 @@ static int rp1_pio_sm_claim(struct rp1_p + mutex_unlock(&pio->instr_mutex); + return ret; + } ++EXPORT_SYMBOL_GPL(rp1_pio_sm_claim); + +-static int rp1_pio_sm_unclaim(struct rp1_pio_client *client, void *param) ++int rp1_pio_sm_unclaim(struct rp1_pio_client *client, void *param) + { + struct rp1_pio_sm_claim_args *args = param; + struct rp1_pio_device *pio = client->pio; +@@ -341,99 +349,113 @@ static int rp1_pio_sm_unclaim(struct rp1 + mutex_unlock(&pio->instr_mutex); + return 0; + } ++EXPORT_SYMBOL_GPL(rp1_pio_sm_unclaim); + +-static int rp1_pio_sm_is_claimed(struct rp1_pio_client *client, void *param) ++int rp1_pio_sm_is_claimed(struct rp1_pio_client *client, void *param) + { + struct rp1_pio_sm_claim_args *args = param; + + return rp1_pio_message(client->pio, PIO_SM_IS_CLAIMED, args, sizeof(*args)); + } ++EXPORT_SYMBOL_GPL(rp1_pio_sm_is_claimed); + +-static int rp1_pio_sm_init(struct rp1_pio_client *client, void *param) ++int rp1_pio_sm_init(struct rp1_pio_client *client, void *param) + { + struct rp1_pio_sm_init_args *args = param; + + return rp1_pio_message(client->pio, PIO_SM_INIT, args, sizeof(*args)); + } ++EXPORT_SYMBOL_GPL(rp1_pio_sm_init); + +-static int rp1_pio_sm_set_config(struct rp1_pio_client *client, void *param) ++int rp1_pio_sm_set_config(struct rp1_pio_client *client, void *param) + { + struct rp1_pio_sm_set_config_args *args = param; + + return rp1_pio_message(client->pio, PIO_SM_SET_CONFIG, args, sizeof(*args)); + } ++EXPORT_SYMBOL_GPL(rp1_pio_sm_set_config); + +-static int rp1_pio_sm_exec(struct rp1_pio_client *client, void *param) ++int rp1_pio_sm_exec(struct rp1_pio_client *client, void *param) + { + struct rp1_pio_sm_exec_args *args = param; + + return rp1_pio_message(client->pio, PIO_SM_EXEC, args, sizeof(*args)); + } ++EXPORT_SYMBOL_GPL(rp1_pio_sm_exec); + +-static int rp1_pio_sm_clear_fifos(struct rp1_pio_client *client, void *param) ++int rp1_pio_sm_clear_fifos(struct rp1_pio_client *client, void *param) + { + struct rp1_pio_sm_clear_fifos_args *args = param; + + return rp1_pio_message(client->pio, PIO_SM_CLEAR_FIFOS, args, sizeof(*args)); + } ++EXPORT_SYMBOL_GPL(rp1_pio_sm_clear_fifos); + +-static int rp1_pio_sm_set_clkdiv(struct rp1_pio_client *client, void *param) ++int rp1_pio_sm_set_clkdiv(struct rp1_pio_client *client, void *param) + { + struct rp1_pio_sm_set_clkdiv_args *args = param; + + return rp1_pio_message(client->pio, PIO_SM_SET_CLKDIV, args, sizeof(*args)); + } ++EXPORT_SYMBOL_GPL(rp1_pio_sm_set_clkdiv); + +-static int rp1_pio_sm_set_pins(struct rp1_pio_client *client, void *param) ++int rp1_pio_sm_set_pins(struct rp1_pio_client *client, void *param) + { + struct rp1_pio_sm_set_pins_args *args = param; + + return rp1_pio_message(client->pio, PIO_SM_SET_PINS, args, sizeof(*args)); + } ++EXPORT_SYMBOL_GPL(rp1_pio_sm_set_pins); + +-static int rp1_pio_sm_set_pindirs(struct rp1_pio_client *client, void *param) ++int rp1_pio_sm_set_pindirs(struct rp1_pio_client *client, void *param) + { + struct rp1_pio_sm_set_pindirs_args *args = param; + + return rp1_pio_message(client->pio, PIO_SM_SET_PINDIRS, args, sizeof(*args)); + } ++EXPORT_SYMBOL_GPL(rp1_pio_sm_set_pindirs); + +-static int rp1_pio_sm_set_enabled(struct rp1_pio_client *client, void *param) ++int rp1_pio_sm_set_enabled(struct rp1_pio_client *client, void *param) + { + struct rp1_pio_sm_set_enabled_args *args = param; + + return rp1_pio_message(client->pio, PIO_SM_SET_ENABLED, args, sizeof(*args)); + } ++EXPORT_SYMBOL_GPL(rp1_pio_sm_set_enabled); + +-static int rp1_pio_sm_restart(struct rp1_pio_client *client, void *param) ++int rp1_pio_sm_restart(struct rp1_pio_client *client, void *param) + { + struct rp1_pio_sm_restart_args *args = param; + + return rp1_pio_message(client->pio, PIO_SM_RESTART, args, sizeof(*args)); + } ++EXPORT_SYMBOL_GPL(rp1_pio_sm_restart); + +-static int rp1_pio_sm_clkdiv_restart(struct rp1_pio_client *client, void *param) ++int rp1_pio_sm_clkdiv_restart(struct rp1_pio_client *client, void *param) + { + struct rp1_pio_sm_restart_args *args = param; + + return rp1_pio_message(client->pio, PIO_SM_CLKDIV_RESTART, args, sizeof(*args)); + } ++EXPORT_SYMBOL_GPL(rp1_pio_sm_clkdiv_restart); + +-static int rp1_pio_sm_enable_sync(struct rp1_pio_client *client, void *param) ++int rp1_pio_sm_enable_sync(struct rp1_pio_client *client, void *param) + { + struct rp1_pio_sm_enable_sync_args *args = param; + + return rp1_pio_message(client->pio, PIO_SM_ENABLE_SYNC, args, sizeof(*args)); + } ++EXPORT_SYMBOL_GPL(rp1_pio_sm_enable_sync); + +-static int rp1_pio_sm_put(struct rp1_pio_client *client, void *param) ++int rp1_pio_sm_put(struct rp1_pio_client *client, void *param) + { + struct rp1_pio_sm_put_args *args = param; + + return rp1_pio_message(client->pio, PIO_SM_PUT, args, sizeof(*args)); + } ++EXPORT_SYMBOL_GPL(rp1_pio_sm_put); + +-static int rp1_pio_sm_get(struct rp1_pio_client *client, void *param) ++int rp1_pio_sm_get(struct rp1_pio_client *client, void *param) + { + struct rp1_pio_sm_get_args *args = param; + int ret; +@@ -444,69 +466,79 @@ static int rp1_pio_sm_get(struct rp1_pio + return offsetof(struct rp1_pio_sm_get_args, data) + ret; + return ret; + } ++EXPORT_SYMBOL_GPL(rp1_pio_sm_get); + +-static int rp1_pio_sm_set_dmactrl(struct rp1_pio_client *client, void *param) ++int rp1_pio_sm_set_dmactrl(struct rp1_pio_client *client, void *param) + { + struct rp1_pio_sm_set_dmactrl_args *args = param; + + return rp1_pio_message(client->pio, PIO_SM_SET_DMACTRL, args, sizeof(*args)); + } ++EXPORT_SYMBOL_GPL(rp1_pio_sm_set_dmactrl); + +-static int rp1_pio_gpio_init(struct rp1_pio_client *client, void *param) ++int rp1_pio_gpio_init(struct rp1_pio_client *client, void *param) + { + struct rp1_gpio_init_args *args = param; + + return rp1_pio_message(client->pio, GPIO_INIT, args, sizeof(*args)); + } ++EXPORT_SYMBOL_GPL(rp1_pio_gpio_init); + +-static int rp1_pio_gpio_set_function(struct rp1_pio_client *client, void *param) ++int rp1_pio_gpio_set_function(struct rp1_pio_client *client, void *param) + { + struct rp1_gpio_set_function_args *args = param; + + return rp1_pio_message(client->pio, GPIO_SET_FUNCTION, args, sizeof(*args)); + } ++EXPORT_SYMBOL_GPL(rp1_pio_gpio_set_function); + +-static int rp1_pio_gpio_set_pulls(struct rp1_pio_client *client, void *param) ++int rp1_pio_gpio_set_pulls(struct rp1_pio_client *client, void *param) + { + struct rp1_gpio_set_pulls_args *args = param; + + return rp1_pio_message(client->pio, GPIO_SET_PULLS, args, sizeof(*args)); + } ++EXPORT_SYMBOL_GPL(rp1_pio_gpio_set_pulls); + +-static int rp1_pio_gpio_set_outover(struct rp1_pio_client *client, void *param) ++int rp1_pio_gpio_set_outover(struct rp1_pio_client *client, void *param) + { + struct rp1_gpio_set_args *args = param; + + return rp1_pio_message(client->pio, GPIO_SET_OUTOVER, args, sizeof(*args)); + } ++EXPORT_SYMBOL_GPL(rp1_pio_gpio_set_outover); + +-static int rp1_pio_gpio_set_inover(struct rp1_pio_client *client, void *param) ++int rp1_pio_gpio_set_inover(struct rp1_pio_client *client, void *param) + { + struct rp1_gpio_set_args *args = param; + + return rp1_pio_message(client->pio, GPIO_SET_INOVER, args, sizeof(*args)); + } ++EXPORT_SYMBOL_GPL(rp1_pio_gpio_set_inover); + +-static int rp1_pio_gpio_set_oeover(struct rp1_pio_client *client, void *param) ++int rp1_pio_gpio_set_oeover(struct rp1_pio_client *client, void *param) + { + struct rp1_gpio_set_args *args = param; + + return rp1_pio_message(client->pio, GPIO_SET_OEOVER, args, sizeof(*args)); + } ++EXPORT_SYMBOL_GPL(rp1_pio_gpio_set_oeover); + +-static int rp1_pio_gpio_set_input_enabled(struct rp1_pio_client *client, void *param) ++int rp1_pio_gpio_set_input_enabled(struct rp1_pio_client *client, void *param) + { + struct rp1_gpio_set_args *args = param; + + return rp1_pio_message(client->pio, GPIO_SET_INPUT_ENABLED, args, sizeof(*args)); + } ++EXPORT_SYMBOL_GPL(rp1_pio_gpio_set_input_enabled); + +-static int rp1_pio_gpio_set_drive_strength(struct rp1_pio_client *client, void *param) ++int rp1_pio_gpio_set_drive_strength(struct rp1_pio_client *client, void *param) + { + struct rp1_gpio_set_args *args = param; + + return rp1_pio_message(client->pio, GPIO_SET_DRIVE_STRENGTH, args, sizeof(*args)); + } ++EXPORT_SYMBOL_GPL(rp1_pio_gpio_set_drive_strength); + + static void rp1_pio_sm_dma_callback(void *param) + { +@@ -633,7 +665,7 @@ static int rp1_pio_sm_tx_user(struct rp1 + struct device *dev = &pdev->dev; + int ret = 0; + +- // Clean the slate - we're running synchronously ++ /* Clean the slate - we're running synchronously */ + dma->head_idx = 0; + dma->tail_idx = 0; + +@@ -686,7 +718,7 @@ static int rp1_pio_sm_tx_user(struct rp1 + bytes -= copy_bytes; + } + +- // Block for completion ++ /* Block for completion */ + while (dma->tail_idx != dma->head_idx) { + if (down_timeout(&dma->buf_sem, msecs_to_jiffies(1000))) { + dev_err(dev, "DMA wait timed out\n"); +@@ -830,22 +862,22 @@ struct handler_info { + HANDLER(WRITE_HW, write_hw), + }; + +-static int rp1_pio_open(struct inode *inode, struct file *filp) ++struct rp1_pio_client *pio_open(void) + { +- struct rp1_pio_device *pio = g_pio; + struct rp1_pio_client *client; + + client = kzalloc(sizeof(*client), GFP_KERNEL); ++ if (!client) ++ return ERR_PTR(-ENOMEM); + +- client->pio = pio; +- filp->private_data = client; ++ client->pio = g_pio; + +- return 0; ++ return client; + } ++EXPORT_SYMBOL_GPL(pio_open); + +-static int rp1_pio_release(struct inode *inode, struct file *filp) ++void pio_close(struct rp1_pio_client *client) + { +- struct rp1_pio_client *client = filp->private_data; + struct rp1_pio_device *pio = client->pio; + uint claimed_dmas = client->claimed_dmas; + int i; +@@ -885,6 +917,45 @@ static int rp1_pio_release(struct inode + /* Reinitialise the SM? */ + + kfree(client); ++} ++EXPORT_SYMBOL_GPL(pio_close); ++ ++void pio_set_error(struct rp1_pio_client *client, int err) ++{ ++ client->error = err; ++} ++EXPORT_SYMBOL_GPL(pio_set_error); ++ ++int pio_get_error(const struct rp1_pio_client *client) ++{ ++ return client->error; ++} ++EXPORT_SYMBOL_GPL(pio_get_error); ++ ++void pio_clear_error(struct rp1_pio_client *client) ++{ ++ client->error = 0; ++} ++EXPORT_SYMBOL_GPL(pio_clear_error); ++ ++static int rp1_pio_open(struct inode *inode, struct file *filp) ++{ ++ struct rp1_pio_client *client; ++ ++ client = pio_open(); ++ if (IS_ERR(client)) ++ return PTR_ERR(client); ++ ++ filp->private_data = client; ++ ++ return 0; ++} ++ ++static int rp1_pio_release(struct inode *inode, struct file *filp) ++{ ++ struct rp1_pio_client *client = filp->private_data; ++ ++ pio_close(client); + + return 0; + } +--- /dev/null ++++ b/include/linux/pio_instructions.h +@@ -0,0 +1,481 @@ ++/* SPDX-License-Identifier: BSD-3-Clause */ ++/* ++ * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. ++ */ ++ ++#ifndef _HARDWARE_PIO_INSTRUCTIONS_H ++#define _HARDWARE_PIO_INSTRUCTIONS_H ++ ++/** \brief PIO instruction encoding ++ * \defgroup pio_instructions pio_instructions ++ * \ingroup hardware_pio ++ * ++ * Functions for generating PIO instruction encodings programmatically. In debug builds ++ *`PARAM_ASSERTIONS_ENABLED_PIO_INSTRUCTIONS` can be set to 1 to enable validation of encoding function ++ * parameters. ++ * ++ * For fuller descriptions of the instructions in question see the "RP2040 Datasheet" ++ */ ++ ++// PICO_CONFIG: PARAM_ASSERTIONS_ENABLED_PIO_INSTRUCTIONS, Enable/disable assertions in the PIO instructions, type=bool, default=0, group=pio_instructions ++#ifndef PARAM_ASSERTIONS_ENABLED_PIO_INSTRUCTIONS ++#define PARAM_ASSERTIONS_ENABLED_PIO_INSTRUCTIONS 0 ++#endif ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++enum pio_instr_bits { ++ pio_instr_bits_jmp = 0x0000, ++ pio_instr_bits_wait = 0x2000, ++ pio_instr_bits_in = 0x4000, ++ pio_instr_bits_out = 0x6000, ++ pio_instr_bits_push = 0x8000, ++ pio_instr_bits_pull = 0x8080, ++ pio_instr_bits_mov = 0xa000, ++ pio_instr_bits_irq = 0xc000, ++ pio_instr_bits_set = 0xe000, ++}; ++ ++#ifndef NDEBUG ++#define _PIO_INVALID_IN_SRC 0x08u ++#define _PIO_INVALID_OUT_DEST 0x10u ++#define _PIO_INVALID_SET_DEST 0x20u ++#define _PIO_INVALID_MOV_SRC 0x40u ++#define _PIO_INVALID_MOV_DEST 0x80u ++#else ++#define _PIO_INVALID_IN_SRC 0u ++#define _PIO_INVALID_OUT_DEST 0u ++#define _PIO_INVALID_SET_DEST 0u ++#define _PIO_INVALID_MOV_SRC 0u ++#define _PIO_INVALID_MOV_DEST 0u ++#endif ++ ++/*! \brief Enumeration of values to pass for source/destination args for instruction encoding functions ++ * \ingroup pio_instructions ++ * ++ * \note Not all values are suitable for all functions. Validity is only checked in debug mode when ++ * `PARAM_ASSERTIONS_ENABLED_PIO_INSTRUCTIONS` is 1 ++ */ ++enum pio_src_dest { ++ pio_pins = 0u, ++ pio_x = 1u, ++ pio_y = 2u, ++ pio_null = 3u | _PIO_INVALID_SET_DEST | _PIO_INVALID_MOV_DEST, ++ pio_pindirs = 4u | _PIO_INVALID_IN_SRC | _PIO_INVALID_MOV_SRC | _PIO_INVALID_MOV_DEST, ++ pio_exec_mov = 4u | _PIO_INVALID_IN_SRC | _PIO_INVALID_OUT_DEST | _PIO_INVALID_SET_DEST | _PIO_INVALID_MOV_SRC, ++ pio_status = 5u | _PIO_INVALID_IN_SRC | _PIO_INVALID_OUT_DEST | _PIO_INVALID_SET_DEST | _PIO_INVALID_MOV_DEST, ++ pio_pc = 5u | _PIO_INVALID_IN_SRC | _PIO_INVALID_SET_DEST | _PIO_INVALID_MOV_SRC, ++ pio_isr = 6u | _PIO_INVALID_SET_DEST, ++ pio_osr = 7u | _PIO_INVALID_OUT_DEST | _PIO_INVALID_SET_DEST, ++ pio_exec_out = 7u | _PIO_INVALID_IN_SRC | _PIO_INVALID_SET_DEST | _PIO_INVALID_MOV_SRC | _PIO_INVALID_MOV_DEST, ++}; ++ ++static inline uint _pio_major_instr_bits(uint instr) { ++ return instr & 0xe000u; ++} ++ ++static inline uint _pio_encode_instr_and_args(enum pio_instr_bits instr_bits, uint arg1, uint arg2) { ++ valid_params_if(PIO_INSTRUCTIONS, arg1 <= 0x7); ++#if PARAM_ASSERTIONS_ENABLED(PIO_INSTRUCTIONS) ++ uint32_t major = _pio_major_instr_bits(instr_bits); ++ if (major == pio_instr_bits_in || major == pio_instr_bits_out) { ++ assert(arg2 && arg2 <= 32); ++ } else { ++ assert(arg2 <= 31); ++ } ++#endif ++ return instr_bits | (arg1 << 5u) | (arg2 & 0x1fu); ++} ++ ++static inline uint _pio_encode_instr_and_src_dest(enum pio_instr_bits instr_bits, enum pio_src_dest dest, uint value) { ++ return _pio_encode_instr_and_args(instr_bits, dest & 7u, value); ++} ++ ++/*! \brief Encode just the delay slot bits of an instruction ++ * \ingroup pio_instructions ++ * ++ * \note This function does not return a valid instruction encoding; instead it returns an encoding of the delay ++ * slot suitable for `OR`ing with the result of an encoding function for an actual instruction. Care should be taken when ++ * combining the results of this function with the results of \ref pio_encode_sideset and \ref pio_encode_sideset_opt ++ * as they share the same bits within the instruction encoding. ++ * ++ * \param cycles the number of cycles 0-31 (or less if side set is being used) ++ * \return the delay slot bits to be ORed with an instruction encoding ++ */ ++static inline uint pio_encode_delay(uint cycles) { ++ // note that the maximum cycles will be smaller if sideset_bit_count > 0 ++ valid_params_if(PIO_INSTRUCTIONS, cycles <= 0x1f); ++ return cycles << 8u; ++} ++ ++/*! \brief Encode just the side set bits of an instruction (in non optional side set mode) ++ * \ingroup pio_instructions ++ * ++ * \note This function does not return a valid instruction encoding; instead it returns an encoding of the side set bits ++ * suitable for `OR`ing with the result of an encoding function for an actual instruction. Care should be taken when ++ * combining the results of this function with the results of \ref pio_encode_delay as they share the same bits ++ * within the instruction encoding. ++ * ++ * \param sideset_bit_count number of side set bits as would be specified via `.sideset` in pioasm ++ * \param value the value to sideset on the pins ++ * \return the side set bits to be ORed with an instruction encoding ++ */ ++static inline uint pio_encode_sideset(uint sideset_bit_count, uint value) { ++ valid_params_if(PIO_INSTRUCTIONS, sideset_bit_count >= 1 && sideset_bit_count <= 5); ++ valid_params_if(PIO_INSTRUCTIONS, value <= ((1u << sideset_bit_count) - 1)); ++ return value << (13u - sideset_bit_count); ++} ++ ++/*! \brief Encode just the side set bits of an instruction (in optional -`opt` side set mode) ++ * \ingroup pio_instructions ++ * ++ * \note This function does not return a valid instruction encoding; instead it returns an encoding of the side set bits ++ * suitable for `OR`ing with the result of an encoding function for an actual instruction. Care should be taken when ++ * combining the results of this function with the results of \ref pio_encode_delay as they share the same bits ++ * within the instruction encoding. ++ * ++ * \param sideset_bit_count number of side set bits as would be specified via `.sideset opt` in pioasm ++ * \param value the value to sideset on the pins ++ * \return the side set bits to be ORed with an instruction encoding ++ */ ++static inline uint pio_encode_sideset_opt(uint sideset_bit_count, uint value) { ++ valid_params_if(PIO_INSTRUCTIONS, sideset_bit_count >= 1 && sideset_bit_count <= 4); ++ valid_params_if(PIO_INSTRUCTIONS, value <= ((1u << sideset_bit_count) - 1)); ++ return 0x1000u | value << (12u - sideset_bit_count); ++} ++ ++/*! \brief Encode an unconditional JMP instruction ++ * \ingroup pio_instructions ++ * ++ * This is the equivalent of `JMP ` ++ * ++ * \param addr The target address 0-31 (an absolute address within the PIO instruction memory) ++ * \return The instruction encoding with 0 delay and no side set value ++ * \see pio_encode_delay, pio_encode_sideset, pio_encode_sideset_opt ++ */ ++static inline uint pio_encode_jmp(uint addr) { ++ return _pio_encode_instr_and_args(pio_instr_bits_jmp, 0, addr); ++} ++ ++/*! \brief Encode a conditional JMP if scratch X zero instruction ++ * \ingroup pio_instructions ++ * ++ * This is the equivalent of `JMP !X ` ++ * ++ * \param addr The target address 0-31 (an absolute address within the PIO instruction memory) ++ * \return The instruction encoding with 0 delay and no side set value ++ * \see pio_encode_delay, pio_encode_sideset, pio_encode_sideset_opt ++ */ ++static inline uint pio_encode_jmp_not_x(uint addr) { ++ return _pio_encode_instr_and_args(pio_instr_bits_jmp, 1, addr); ++} ++ ++/*! \brief Encode a conditional JMP if scratch X non-zero (and post-decrement X) instruction ++ * \ingroup pio_instructions ++ * ++ * This is the equivalent of `JMP X-- ` ++ * ++ * \param addr The target address 0-31 (an absolute address within the PIO instruction memory) ++ * \return The instruction encoding with 0 delay and no side set value ++ * \see pio_encode_delay, pio_encode_sideset, pio_encode_sideset_opt ++ */ ++static inline uint pio_encode_jmp_x_dec(uint addr) { ++ return _pio_encode_instr_and_args(pio_instr_bits_jmp, 2, addr); ++} ++ ++/*! \brief Encode a conditional JMP if scratch Y zero instruction ++ * \ingroup pio_instructions ++ * ++ * This is the equivalent of `JMP !Y ` ++ * ++ * \param addr The target address 0-31 (an absolute address within the PIO instruction memory) ++ * \return The instruction encoding with 0 delay and no side set value ++ * \see pio_encode_delay, pio_encode_sideset, pio_encode_sideset_opt ++ */ ++static inline uint pio_encode_jmp_not_y(uint addr) { ++ return _pio_encode_instr_and_args(pio_instr_bits_jmp, 3, addr); ++} ++ ++/*! \brief Encode a conditional JMP if scratch Y non-zero (and post-decrement Y) instruction ++ * \ingroup pio_instructions ++ * ++ * This is the equivalent of `JMP Y-- ` ++ * ++ * \param addr The target address 0-31 (an absolute address within the PIO instruction memory) ++ * \return The instruction encoding with 0 delay and no side set value ++ * \see pio_encode_delay, pio_encode_sideset, pio_encode_sideset_opt ++ */ ++static inline uint pio_encode_jmp_y_dec(uint addr) { ++ return _pio_encode_instr_and_args(pio_instr_bits_jmp, 4, addr); ++} ++ ++/*! \brief Encode a conditional JMP if scratch X not equal scratch Y instruction ++ * \ingroup pio_instructions ++ * ++ * This is the equivalent of `JMP X!=Y ` ++ * ++ * \param addr The target address 0-31 (an absolute address within the PIO instruction memory) ++ * \return The instruction encoding with 0 delay and no side set value ++ * \see pio_encode_delay, pio_encode_sideset, pio_encode_sideset_opt ++ */ ++static inline uint pio_encode_jmp_x_ne_y(uint addr) { ++ return _pio_encode_instr_and_args(pio_instr_bits_jmp, 5, addr); ++} ++ ++/*! \brief Encode a conditional JMP if input pin high instruction ++ * \ingroup pio_instructions ++ * ++ * This is the equivalent of `JMP PIN ` ++ * ++ * \param addr The target address 0-31 (an absolute address within the PIO instruction memory) ++ * \return The instruction encoding with 0 delay and no side set value ++ * \see pio_encode_delay, pio_encode_sideset, pio_encode_sideset_opt ++ */ ++static inline uint pio_encode_jmp_pin(uint addr) { ++ return _pio_encode_instr_and_args(pio_instr_bits_jmp, 6, addr); ++} ++ ++/*! \brief Encode a conditional JMP if output shift register not empty instruction ++ * \ingroup pio_instructions ++ * ++ * This is the equivalent of `JMP !OSRE ` ++ * ++ * \param addr The target address 0-31 (an absolute address within the PIO instruction memory) ++ * \return The instruction encoding with 0 delay and no side set value ++ * \see pio_encode_delay, pio_encode_sideset, pio_encode_sideset_opt ++ */ ++static inline uint pio_encode_jmp_not_osre(uint addr) { ++ return _pio_encode_instr_and_args(pio_instr_bits_jmp, 7, addr); ++} ++ ++static inline uint _pio_encode_irq(bool relative, uint irq) { ++ valid_params_if(PIO_INSTRUCTIONS, irq <= 7); ++ return (relative ? 0x10u : 0x0u) | irq; ++} ++ ++/*! \brief Encode a WAIT for GPIO pin instruction ++ * \ingroup pio_instructions ++ * ++ * This is the equivalent of `WAIT GPIO ` ++ * ++ * \param polarity true for `WAIT 1`, false for `WAIT 0` ++ * \param gpio The real GPIO number 0-31 ++ * \return The instruction encoding with 0 delay and no side set value ++ * \see pio_encode_delay, pio_encode_sideset, pio_encode_sideset_opt ++ */ ++static inline uint pio_encode_wait_gpio(bool polarity, uint gpio) { ++ return _pio_encode_instr_and_args(pio_instr_bits_wait, 0u | (polarity ? 4u : 0u), gpio); ++} ++ ++/*! \brief Encode a WAIT for pin instruction ++ * \ingroup pio_instructions ++ * ++ * This is the equivalent of `WAIT PIN ` ++ * ++ * \param polarity true for `WAIT 1`, false for `WAIT 0` ++ * \param pin The pin number 0-31 relative to the executing SM's input pin mapping ++ * \return The instruction encoding with 0 delay and no side set value ++ * \see pio_encode_delay, pio_encode_sideset, pio_encode_sideset_opt ++ */ ++static inline uint pio_encode_wait_pin(bool polarity, uint pin) { ++ return _pio_encode_instr_and_args(pio_instr_bits_wait, 1u | (polarity ? 4u : 0u), pin); ++} ++ ++/*! \brief Encode a WAIT for IRQ instruction ++ * \ingroup pio_instructions ++ * ++ * This is the equivalent of `WAIT IRQ ` ++ * ++ * \param polarity true for `WAIT 1`, false for `WAIT 0` ++ * \param relative true for a `WAIT IRQ REL`, false for regular `WAIT IRQ ` ++ * \param irq the irq number 0-7 ++ * \return The instruction encoding with 0 delay and no side set value ++ * \see pio_encode_delay, pio_encode_sideset, pio_encode_sideset_opt ++ */ ++static inline uint pio_encode_wait_irq(bool polarity, bool relative, uint irq) { ++ valid_params_if(PIO_INSTRUCTIONS, irq <= 7); ++ return _pio_encode_instr_and_args(pio_instr_bits_wait, 2u | (polarity ? 4u : 0u), _pio_encode_irq(relative, irq)); ++} ++ ++/*! \brief Encode an IN instruction ++ * \ingroup pio_instructions ++ * ++ * This is the equivalent of `IN , ` ++ * ++ * \param src The source to take data from ++ * \param count The number of bits 1-32 ++ * \return The instruction encoding with 0 delay and no side set value ++ * \see pio_encode_delay, pio_encode_sideset, pio_encode_sideset_opt ++ */ ++static inline uint pio_encode_in(enum pio_src_dest src, uint count) { ++ valid_params_if(PIO_INSTRUCTIONS, !(src & _PIO_INVALID_IN_SRC)); ++ return _pio_encode_instr_and_src_dest(pio_instr_bits_in, src, count); ++} ++ ++/*! \brief Encode an OUT instruction ++ * \ingroup pio_instructions ++ * ++ * This is the equivalent of `OUT , ` ++ * ++ * \param dest The destination to write data to ++ * \param count The number of bits 1-32 ++ * \return The instruction encoding with 0 delay and no side set value ++ * \see pio_encode_delay, pio_encode_sideset, pio_encode_sideset_opt ++ */ ++static inline uint pio_encode_out(enum pio_src_dest dest, uint count) { ++ valid_params_if(PIO_INSTRUCTIONS, !(dest & _PIO_INVALID_OUT_DEST)); ++ return _pio_encode_instr_and_src_dest(pio_instr_bits_out, dest, count); ++} ++ ++/*! \brief Encode a PUSH instruction ++ * \ingroup pio_instructions ++ * ++ * This is the equivalent of `PUSH , ` ++ * ++ * \param if_full true for `PUSH IF_FULL ...`, false for `PUSH ...` ++ * \param block true for `PUSH ... BLOCK`, false for `PUSH ...` ++ * \return The instruction encoding with 0 delay and no side set value ++ * \see pio_encode_delay, pio_encode_sideset, pio_encode_sideset_opt ++ */ ++static inline uint pio_encode_push(bool if_full, bool block) { ++ return _pio_encode_instr_and_args(pio_instr_bits_push, (if_full ? 2u : 0u) | (block ? 1u : 0u), 0); ++} ++ ++/*! \brief Encode a PULL instruction ++ * \ingroup pio_instructions ++ * ++ * This is the equivalent of `PULL , ` ++ * ++ * \param if_empty true for `PULL IF_EMPTY ...`, false for `PULL ...` ++ * \param block true for `PULL ... BLOCK`, false for `PULL ...` ++ * \return The instruction encoding with 0 delay and no side set value ++ * \see pio_encode_delay, pio_encode_sideset, pio_encode_sideset_opt ++ */ ++static inline uint pio_encode_pull(bool if_empty, bool block) { ++ return _pio_encode_instr_and_args(pio_instr_bits_pull, (if_empty ? 2u : 0u) | (block ? 1u : 0u), 0); ++} ++ ++/*! \brief Encode a MOV instruction ++ * \ingroup pio_instructions ++ * ++ * This is the equivalent of `MOV , ` ++ * ++ * \param dest The destination to write data to ++ * \param src The source to take data from ++ * \return The instruction encoding with 0 delay and no side set value ++ * \see pio_encode_delay, pio_encode_sideset, pio_encode_sideset_opt ++ */ ++static inline uint pio_encode_mov(enum pio_src_dest dest, enum pio_src_dest src) { ++ valid_params_if(PIO_INSTRUCTIONS, !(dest & _PIO_INVALID_MOV_DEST)); ++ valid_params_if(PIO_INSTRUCTIONS, !(src & _PIO_INVALID_MOV_SRC)); ++ return _pio_encode_instr_and_src_dest(pio_instr_bits_mov, dest, src & 7u); ++} ++ ++/*! \brief Encode a MOV instruction with bit invert ++ * \ingroup pio_instructions ++ * ++ * This is the equivalent of `MOV , ~` ++ * ++ * \param dest The destination to write inverted data to ++ * \param src The source to take data from ++ * \return The instruction encoding with 0 delay and no side set value ++ * \see pio_encode_delay, pio_encode_sideset, pio_encode_sideset_opt ++ */ ++static inline uint pio_encode_mov_not(enum pio_src_dest dest, enum pio_src_dest src) { ++ valid_params_if(PIO_INSTRUCTIONS, !(dest & _PIO_INVALID_MOV_DEST)); ++ valid_params_if(PIO_INSTRUCTIONS, !(src & _PIO_INVALID_MOV_SRC)); ++ return _pio_encode_instr_and_src_dest(pio_instr_bits_mov, dest, (1u << 3u) | (src & 7u)); ++} ++ ++/*! \brief Encode a MOV instruction with bit reverse ++ * \ingroup pio_instructions ++ * ++ * This is the equivalent of `MOV , ::` ++ * ++ * \param dest The destination to write bit reversed data to ++ * \param src The source to take data from ++ * \return The instruction encoding with 0 delay and no side set value ++ * \see pio_encode_delay, pio_encode_sideset, pio_encode_sideset_opt ++ */ ++static inline uint pio_encode_mov_reverse(enum pio_src_dest dest, enum pio_src_dest src) { ++ valid_params_if(PIO_INSTRUCTIONS, !(dest & _PIO_INVALID_MOV_DEST)); ++ valid_params_if(PIO_INSTRUCTIONS, !(src & _PIO_INVALID_MOV_SRC)); ++ return _pio_encode_instr_and_src_dest(pio_instr_bits_mov, dest, (2u << 3u) | (src & 7u)); ++} ++ ++/*! \brief Encode a IRQ SET instruction ++ * \ingroup pio_instructions ++ * ++ * This is the equivalent of `IRQ SET ` ++ * ++ * \param relative true for a `IRQ SET REL`, false for regular `IRQ SET ` ++ * \param irq the irq number 0-7 ++ * \return The instruction encoding with 0 delay and no side set value ++ * \see pio_encode_delay, pio_encode_sideset, pio_encode_sideset_opt ++ */ ++static inline uint pio_encode_irq_set(bool relative, uint irq) { ++ return _pio_encode_instr_and_args(pio_instr_bits_irq, 0, _pio_encode_irq(relative, irq)); ++} ++ ++/*! \brief Encode a IRQ WAIT instruction ++ * \ingroup pio_instructions ++ * ++ * This is the equivalent of `IRQ WAIT ` ++ * ++ * \param relative true for a `IRQ WAIT REL`, false for regular `IRQ WAIT ` ++ * \param irq the irq number 0-7 ++ * \return The instruction encoding with 0 delay and no side set value ++ * \see pio_encode_delay, pio_encode_sideset, pio_encode_sideset_opt ++ */ ++static inline uint pio_encode_irq_wait(bool relative, uint irq) { ++ return _pio_encode_instr_and_args(pio_instr_bits_irq, 1, _pio_encode_irq(relative, irq)); ++} ++ ++/*! \brief Encode a IRQ CLEAR instruction ++ * \ingroup pio_instructions ++ * ++ * This is the equivalent of `IRQ CLEAR ` ++ * ++ * \param relative true for a `IRQ CLEAR REL`, false for regular `IRQ CLEAR ` ++ * \param irq the irq number 0-7 ++ * \return The instruction encoding with 0 delay and no side set value ++ * \see pio_encode_delay, pio_encode_sideset, pio_encode_sideset_opt ++ */ ++static inline uint pio_encode_irq_clear(bool relative, uint irq) { ++ return _pio_encode_instr_and_args(pio_instr_bits_irq, 2, _pio_encode_irq(relative, irq)); ++} ++ ++/*! \brief Encode a SET instruction ++ * \ingroup pio_instructions ++ * ++ * This is the equivalent of `SET , ` ++ * ++ * \param dest The destination to apply the value to ++ * \param value The value 0-31 ++ * \return The instruction encoding with 0 delay and no side set value ++ * \see pio_encode_delay, pio_encode_sideset, pio_encode_sideset_opt ++ */ ++static inline uint pio_encode_set(enum pio_src_dest dest, uint value) { ++ valid_params_if(PIO_INSTRUCTIONS, !(dest & _PIO_INVALID_SET_DEST)); ++ return _pio_encode_instr_and_src_dest(pio_instr_bits_set, dest, value); ++} ++ ++/*! \brief Encode a NOP instruction ++ * \ingroup pio_instructions ++ * ++ * This is the equivalent of `NOP` which is itself encoded as `MOV y, y` ++ * ++ * \return The instruction encoding with 0 delay and no side set value ++ * \see pio_encode_delay, pio_encode_sideset, pio_encode_sideset_opt ++ */ ++static inline uint pio_encode_nop(void) { ++ return pio_encode_mov(pio_y, pio_y); ++} ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif +--- /dev/null ++++ b/include/linux/pio_rp1.h +@@ -0,0 +1,873 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++/* ++ * Copyright (c) 2024 Raspberry Pi Ltd. ++ * All rights reserved. ++ */ ++ ++#ifndef _PIO_RP1_H ++#define _PIO_RP1_H ++ ++#include ++ ++#define PARAM_WARNINGS_ENABLED 1 ++ ++#ifdef DEBUG ++#define PARAM_WARNINGS_ENABLED 1 ++#endif ++ ++#ifndef PARAM_WARNINGS_ENABLED ++#define PARAM_WARNINGS_ENABLED 0 ++#endif ++ ++#define bad_params_if(client, test) \ ++ ({ bool f = (test); if (f) pio_set_error(client, -EINVAL); \ ++ if (f && PARAM_WARNINGS_ENABLED) WARN_ON((test)); \ ++ f; }) ++ ++#ifndef PARAM_ASSERTIONS_ENABLE_ALL ++#define PARAM_ASSERTIONS_ENABLE_ALL 0 ++#endif ++ ++#ifndef PARAM_ASSERTIONS_DISABLE_ALL ++#define PARAM_ASSERTIONS_DISABLE_ALL 0 ++#endif ++ ++#define PARAM_ASSERTIONS_ENABLED(x) \ ++ ((PARAM_ASSERTIONS_ENABLED_ ## x || PARAM_ASSERTIONS_ENABLE_ALL) && \ ++ !PARAM_ASSERTIONS_DISABLE_ALL) ++#define valid_params_if(x, test) ({if (PARAM_ASSERTIONS_ENABLED(x)) WARN_ON(test); }) ++ ++#include ++ ++#define NUM_PIO_STATE_MACHINES 4 ++#define PIO_INSTRUCTION_COUNT 32 ++#define PIO_ORIGIN_ANY ((uint)(~0)) ++#define GPIOS_MASK ((1 << RP1_PIO_GPIO_COUNT) - 1) ++ ++#define PICO_NO_HARDWARE 0 ++ ++#define pio0 pio_open_helper(0) ++ ++#define PROC_PIO_SM0_PINCTRL_OUT_BASE_BITS 0x0000001f ++#define PROC_PIO_SM0_PINCTRL_OUT_BASE_LSB 0 ++#define PROC_PIO_SM0_PINCTRL_OUT_COUNT_BITS 0x03f00000 ++#define PROC_PIO_SM0_PINCTRL_OUT_COUNT_LSB 20 ++#define PROC_PIO_SM0_PINCTRL_SET_BASE_BITS 0x000003e0 ++#define PROC_PIO_SM0_PINCTRL_SET_BASE_LSB 5 ++#define PROC_PIO_SM0_PINCTRL_SET_COUNT_BITS 0x1c000000 ++#define PROC_PIO_SM0_PINCTRL_SET_COUNT_LSB 26 ++#define PROC_PIO_SM0_PINCTRL_IN_BASE_BITS 0x000f8000 ++#define PROC_PIO_SM0_PINCTRL_IN_BASE_LSB 15 ++#define PROC_PIO_SM0_PINCTRL_SIDESET_BASE_BITS 0x00007c00 ++#define PROC_PIO_SM0_PINCTRL_SIDESET_BASE_LSB 10 ++#define PROC_PIO_SM0_PINCTRL_SIDESET_COUNT_BITS 0xe0000000 ++#define PROC_PIO_SM0_PINCTRL_SIDESET_COUNT_LSB 29 ++#define PROC_PIO_SM0_EXECCTRL_SIDE_EN_BITS 0x40000000 ++#define PROC_PIO_SM0_EXECCTRL_SIDE_EN_LSB 30 ++#define PROC_PIO_SM0_EXECCTRL_SIDE_PINDIR_BITS 0x20000000 ++#define PROC_PIO_SM0_EXECCTRL_SIDE_PINDIR_LSB 29 ++#define PROC_PIO_SM0_CLKDIV_INT_LSB 16 ++#define PROC_PIO_SM0_CLKDIV_FRAC_LSB 8 ++#define PROC_PIO_SM0_EXECCTRL_WRAP_TOP_BITS 0x0001f000 ++#define PROC_PIO_SM0_EXECCTRL_WRAP_TOP_LSB 12 ++#define PROC_PIO_SM0_EXECCTRL_WRAP_BOTTOM_BITS 0x00000f80 ++#define PROC_PIO_SM0_EXECCTRL_WRAP_BOTTOM_LSB 7 ++#define PROC_PIO_SM0_EXECCTRL_JMP_PIN_BITS 0x1f000000 ++#define PROC_PIO_SM0_EXECCTRL_JMP_PIN_LSB 24 ++#define PROC_PIO_SM0_SHIFTCTRL_IN_SHIFTDIR_BITS 0x00040000 ++#define PROC_PIO_SM0_SHIFTCTRL_IN_SHIFTDIR_LSB 18 ++#define PROC_PIO_SM0_SHIFTCTRL_AUTOPULL_BITS 0x00020000 ++#define PROC_PIO_SM0_SHIFTCTRL_AUTOPULL_LSB 17 ++#define PROC_PIO_SM0_SHIFTCTRL_AUTOPUSH_BITS 0x00010000 ++#define PROC_PIO_SM0_SHIFTCTRL_AUTOPUSH_LSB 16 ++#define PROC_PIO_SM0_SHIFTCTRL_PUSH_THRESH_BITS 0x01f00000 ++#define PROC_PIO_SM0_SHIFTCTRL_PUSH_THRESH_LSB 20 ++#define PROC_PIO_SM0_SHIFTCTRL_OUT_SHIFTDIR_BITS 0x00080000 ++#define PROC_PIO_SM0_SHIFTCTRL_OUT_SHIFTDIR_LSB 19 ++#define PROC_PIO_SM0_SHIFTCTRL_PULL_THRESH_BITS 0x3e000000 ++#define PROC_PIO_SM0_SHIFTCTRL_PULL_THRESH_LSB 25 ++#define PROC_PIO_SM0_SHIFTCTRL_FJOIN_TX_BITS 0x40000000 ++#define PROC_PIO_SM0_SHIFTCTRL_FJOIN_TX_LSB 30 ++#define PROC_PIO_SM0_SHIFTCTRL_FJOIN_RX_BITS 0x80000000 ++#define PROC_PIO_SM0_SHIFTCTRL_FJOIN_RX_LSB 31 ++#define PROC_PIO_SM0_EXECCTRL_OUT_STICKY_BITS 0x00020000 ++#define PROC_PIO_SM0_EXECCTRL_OUT_STICKY_LSB 17 ++#define PROC_PIO_SM0_EXECCTRL_INLINE_OUT_EN_BITS 0x00040000 ++#define PROC_PIO_SM0_EXECCTRL_INLINE_OUT_EN_LSB 18 ++#define PROC_PIO_SM0_EXECCTRL_OUT_EN_SEL_BITS 0x00f80000 ++#define PROC_PIO_SM0_EXECCTRL_OUT_EN_SEL_LSB 19 ++#define PROC_PIO_SM0_EXECCTRL_STATUS_SEL_BITS 0x00000020 ++#define PROC_PIO_SM0_EXECCTRL_STATUS_SEL_LSB 5 ++#define PROC_PIO_SM0_EXECCTRL_STATUS_N_BITS 0x0000001f ++#define PROC_PIO_SM0_EXECCTRL_STATUS_N_LSB 0 ++ ++enum pio_fifo_join { ++ PIO_FIFO_JOIN_NONE = 0, ++ PIO_FIFO_JOIN_TX = 1, ++ PIO_FIFO_JOIN_RX = 2, ++}; ++ ++enum pio_mov_status_type { ++ STATUS_TX_LESSTHAN = 0, ++ STATUS_RX_LESSTHAN = 1 ++}; ++ ++enum pio_xfer_dir { ++ PIO_DIR_TO_SM, ++ PIO_DIR_FROM_SM, ++ PIO_DIR_COUNT ++}; ++ ++enum clock_index { ++ clk_sys = 5 ++}; ++ ++typedef struct pio_program { ++ const uint16_t *instructions; ++ uint8_t length; ++ int8_t origin; // required instruction memory origin or -1 ++} pio_program_t; ++ ++enum gpio_function { ++ GPIO_FUNC_FSEL0 = 0, ++ GPIO_FUNC_FSEL1 = 1, ++ GPIO_FUNC_FSEL2 = 2, ++ GPIO_FUNC_FSEL3 = 3, ++ GPIO_FUNC_FSEL4 = 4, ++ GPIO_FUNC_FSEL5 = 5, ++ GPIO_FUNC_FSEL6 = 6, ++ GPIO_FUNC_FSEL7 = 7, ++ GPIO_FUNC_FSEL8 = 8, ++ GPIO_FUNC_NULL = 0x1f, ++ ++ // Name a few ++ GPIO_FUNC_SYS_RIO = 5, ++ GPIO_FUNC_PROC_RIO = 6, ++ GPIO_FUNC_PIO = 7, ++}; ++ ++enum gpio_irq_level { ++ GPIO_IRQ_LEVEL_LOW = 0x1u, ++ GPIO_IRQ_LEVEL_HIGH = 0x2u, ++ GPIO_IRQ_EDGE_FALL = 0x4u, ++ GPIO_IRQ_EDGE_RISE = 0x8u, ++}; ++ ++enum gpio_override { ++ GPIO_OVERRIDE_NORMAL = 0, ++ GPIO_OVERRIDE_INVERT = 1, ++ GPIO_OVERRIDE_LOW = 2, ++ GPIO_OVERRIDE_HIGH = 3, ++}; ++enum gpio_slew_rate { ++ GPIO_SLEW_RATE_SLOW = 0, ++ GPIO_SLEW_RATE_FAST = 1 ++}; ++ ++enum gpio_drive_strength { ++ GPIO_DRIVE_STRENGTH_2MA = 0, ++ GPIO_DRIVE_STRENGTH_4MA = 1, ++ GPIO_DRIVE_STRENGTH_8MA = 2, ++ GPIO_DRIVE_STRENGTH_12MA = 3 ++}; ++ ++typedef rp1_pio_sm_config pio_sm_config; ++ ++typedef struct rp1_pio_client *PIO; ++ ++void pio_set_error(struct rp1_pio_client *client, int err); ++int pio_get_error(struct rp1_pio_client *client); ++void pio_clear_error(struct rp1_pio_client *client); ++ ++int rp1_pio_can_add_program(struct rp1_pio_client *client, void *param); ++int rp1_pio_add_program(struct rp1_pio_client *client, void *param); ++int rp1_pio_remove_program(struct rp1_pio_client *client, void *param); ++int rp1_pio_clear_instr_mem(struct rp1_pio_client *client, void *param); ++int rp1_pio_sm_claim(struct rp1_pio_client *client, void *param); ++int rp1_pio_sm_unclaim(struct rp1_pio_client *client, void *param); ++int rp1_pio_sm_is_claimed(struct rp1_pio_client *client, void *param); ++int rp1_pio_sm_init(struct rp1_pio_client *client, void *param); ++int rp1_pio_sm_set_config(struct rp1_pio_client *client, void *param); ++int rp1_pio_sm_exec(struct rp1_pio_client *client, void *param); ++int rp1_pio_sm_clear_fifos(struct rp1_pio_client *client, void *param); ++int rp1_pio_sm_set_clkdiv(struct rp1_pio_client *client, void *param); ++int rp1_pio_sm_set_pins(struct rp1_pio_client *client, void *param); ++int rp1_pio_sm_set_pindirs(struct rp1_pio_client *client, void *param); ++int rp1_pio_sm_set_enabled(struct rp1_pio_client *client, void *param); ++int rp1_pio_sm_restart(struct rp1_pio_client *client, void *param); ++int rp1_pio_sm_clkdiv_restart(struct rp1_pio_client *client, void *param); ++int rp1_pio_sm_enable_sync(struct rp1_pio_client *client, void *param); ++int rp1_pio_sm_put(struct rp1_pio_client *client, void *param); ++int rp1_pio_sm_get(struct rp1_pio_client *client, void *param); ++int rp1_pio_sm_set_dmactrl(struct rp1_pio_client *client, void *param); ++int rp1_pio_gpio_init(struct rp1_pio_client *client, void *param); ++int rp1_pio_gpio_set_function(struct rp1_pio_client *client, void *param); ++int rp1_pio_gpio_set_pulls(struct rp1_pio_client *client, void *param); ++int rp1_pio_gpio_set_outover(struct rp1_pio_client *client, void *param); ++int rp1_pio_gpio_set_inover(struct rp1_pio_client *client, void *param); ++int rp1_pio_gpio_set_oeover(struct rp1_pio_client *client, void *param); ++int rp1_pio_gpio_set_input_enabled(struct rp1_pio_client *client, void *param); ++int rp1_pio_gpio_set_drive_strength(struct rp1_pio_client *client, void *param); ++ ++int pio_init(void); ++PIO pio_open(void); ++void pio_close(PIO pio); ++ ++int pio_sm_config_xfer(PIO pio, uint sm, uint dir, uint buf_size, uint buf_count); ++int pio_sm_xfer_data(PIO pio, uint sm, uint dir, uint data_bytes, void *data); ++ ++static inline bool pio_can_add_program(struct rp1_pio_client *client, ++ const pio_program_t *program) ++{ ++ struct rp1_pio_add_program_args args; ++ ++ if (bad_params_if(client, program->length > PIO_INSTRUCTION_COUNT)) ++ return false; ++ args.origin = (program->origin == -1) ? PIO_ORIGIN_ANY : program->origin; ++ args.num_instrs = program->length; ++ ++ memcpy(args.instrs, program->instructions, args.num_instrs * sizeof(args.instrs[0])); ++ return rp1_pio_can_add_program(client, &args); ++} ++ ++static inline bool pio_can_add_program_at_offset(struct rp1_pio_client *client, ++ const pio_program_t *program, uint offset) ++{ ++ struct rp1_pio_add_program_args args; ++ ++ if (bad_params_if(client, program->length > PIO_INSTRUCTION_COUNT || ++ offset >= PIO_INSTRUCTION_COUNT)) ++ return false; ++ args.origin = offset; ++ args.num_instrs = program->length; ++ ++ memcpy(args.instrs, program->instructions, args.num_instrs * sizeof(args.instrs[0])); ++ return !rp1_pio_can_add_program(client, &args); ++} ++ ++uint pio_add_program(struct rp1_pio_client *client, const pio_program_t *program) ++{ ++ struct rp1_pio_add_program_args args; ++ int offset; ++ ++ if (bad_params_if(client, program->length > PIO_INSTRUCTION_COUNT)) ++ return PIO_ORIGIN_ANY; ++ args.origin = (program->origin == -1) ? PIO_ORIGIN_ANY : program->origin; ++ args.num_instrs = program->length; ++ ++ memcpy(args.instrs, program->instructions, args.num_instrs * sizeof(args.instrs[0])); ++ offset = rp1_pio_add_program(client, &args); ++ return (offset >= 0) ? offset : PIO_ORIGIN_ANY; ++} ++ ++static inline int pio_add_program_at_offset(struct rp1_pio_client *client, ++ const pio_program_t *program, uint offset) ++{ ++ struct rp1_pio_add_program_args args; ++ ++ if (bad_params_if(client, program->length > PIO_INSTRUCTION_COUNT || ++ offset >= PIO_INSTRUCTION_COUNT)) ++ return -EINVAL; ++ args.origin = offset; ++ args.num_instrs = program->length; ++ ++ memcpy(args.instrs, program->instructions, args.num_instrs * sizeof(args.instrs[0])); ++ return rp1_pio_add_program(client, &args); ++} ++ ++static inline int pio_remove_program(struct rp1_pio_client *client, const pio_program_t *program, ++ uint loaded_offset) ++{ ++ struct rp1_pio_remove_program_args args; ++ ++ args.origin = loaded_offset; ++ args.num_instrs = program->length; ++ ++ return rp1_pio_remove_program(client, &args); ++} ++ ++static inline int pio_clear_instruction_memory(struct rp1_pio_client *client) ++{ ++ return rp1_pio_clear_instr_mem(client, NULL); ++} ++ ++static inline int pio_sm_claim(struct rp1_pio_client *client, uint sm) ++{ ++ struct rp1_pio_sm_claim_args args = { .mask = 1 << sm }; ++ ++ if (bad_params_if(client, sm >= NUM_PIO_STATE_MACHINES)) ++ return -EINVAL; ++ ++ return rp1_pio_sm_claim(client, &args); ++} ++ ++static inline int pio_claim_sm_mask(struct rp1_pio_client *client, uint mask) ++{ ++ struct rp1_pio_sm_claim_args args = { .mask = mask }; ++ ++ if (bad_params_if(client, mask >= (1 << NUM_PIO_STATE_MACHINES))) ++ return -EINVAL; ++ ++ return rp1_pio_sm_claim(client, &args); ++} ++ ++static inline int pio_sm_unclaim(struct rp1_pio_client *client, uint sm) ++{ ++ struct rp1_pio_sm_claim_args args = { .mask = 1 << sm }; ++ ++ if (bad_params_if(client, sm >= NUM_PIO_STATE_MACHINES)) ++ return -EINVAL; ++ ++ return rp1_pio_sm_claim(client, &args); ++} ++ ++static inline int pio_claim_unused_sm(struct rp1_pio_client *client, bool required) ++{ ++ struct rp1_pio_sm_claim_args args = { .mask = 0 }; ++ int sm; ++ ++ sm = rp1_pio_sm_claim(client, &args); ++ if (sm < 0 && required) ++ WARN_ON("No PIO state machines are available"); ++ return sm; ++} ++ ++static inline bool pio_sm_is_claimed(struct rp1_pio_client *client, uint sm) ++{ ++ struct rp1_pio_sm_claim_args args = { .mask = (1 << sm) }; ++ ++ if (bad_params_if(client, sm >= NUM_PIO_STATE_MACHINES)) ++ return true; ++ return rp1_pio_sm_is_claimed(client, &args); ++} ++ ++static inline int pio_sm_init(struct rp1_pio_client *client, uint sm, uint initial_pc, ++ const pio_sm_config *config) ++{ ++ struct rp1_pio_sm_init_args args = { .sm = sm, .initial_pc = initial_pc, ++ .config = *config }; ++ ++ if (bad_params_if(client, sm >= NUM_PIO_STATE_MACHINES || ++ initial_pc >= PIO_INSTRUCTION_COUNT)) ++ return -EINVAL; ++ ++ return rp1_pio_sm_init(client, &args); ++} ++ ++static inline int pio_sm_set_config(struct rp1_pio_client *client, uint sm, ++ const pio_sm_config *config) ++{ ++ struct rp1_pio_sm_init_args args = { .sm = sm, .config = *config }; ++ ++ if (bad_params_if(client, sm >= NUM_PIO_STATE_MACHINES)) ++ return -EINVAL; ++ ++ return rp1_pio_sm_set_config(client, &args); ++} ++ ++int pio_sm_exec(struct rp1_pio_client *client, uint sm, uint instr) ++{ ++ struct rp1_pio_sm_exec_args args = { .sm = sm, .instr = instr, .blocking = false }; ++ ++ if (bad_params_if(client, sm >= NUM_PIO_STATE_MACHINES || instr > (uint16_t)~0)) ++ return -EINVAL; ++ ++ return rp1_pio_sm_exec(client, &args); ++} ++ ++int pio_sm_exec_wait_blocking(struct rp1_pio_client *client, uint sm, uint instr) ++{ ++ struct rp1_pio_sm_exec_args args = { .sm = sm, .instr = instr, .blocking = true }; ++ ++ if (bad_params_if(client, sm >= NUM_PIO_STATE_MACHINES || instr > (uint16_t)~0)) ++ return -EINVAL; ++ ++ return rp1_pio_sm_exec(client, &args); ++} ++ ++static inline int pio_sm_clear_fifos(struct rp1_pio_client *client, uint sm) ++{ ++ struct rp1_pio_sm_clear_fifos_args args = { .sm = sm }; ++ ++ if (bad_params_if(client, sm >= NUM_PIO_STATE_MACHINES)) ++ return -EINVAL; ++ return rp1_pio_sm_clear_fifos(client, &args); ++} ++ ++static inline bool pio_calculate_clkdiv_from_float(float div, uint16_t *div_int, ++ uint8_t *div_frac) ++{ ++ if (bad_params_if(NULL, div < 1 || div > 65536)) ++ return false; ++ *div_int = (uint16_t)div; ++ if (*div_int == 0) ++ *div_frac = 0; ++ else ++ *div_frac = (uint8_t)((div - (float)*div_int) * (1u << 8u)); ++ return true; ++} ++ ++static inline int pio_sm_set_clkdiv_int_frac(struct rp1_pio_client *client, uint sm, ++ uint16_t div_int, uint8_t div_frac) ++{ ++ struct rp1_pio_sm_set_clkdiv_args args = { .sm = sm, .div_int = div_int, ++ .div_frac = div_frac }; ++ ++ if (bad_params_if(client, sm >= NUM_PIO_STATE_MACHINES || ++ (div_int == 0 && div_frac != 0))) ++ return -EINVAL; ++ return rp1_pio_sm_set_clkdiv(client, &args); ++} ++ ++static inline int pio_sm_set_clkdiv(struct rp1_pio_client *client, uint sm, float div) ++{ ++ struct rp1_pio_sm_set_clkdiv_args args = { .sm = sm }; ++ ++ if (!pio_calculate_clkdiv_from_float(div, &args.div_int, &args.div_frac)) ++ return -EINVAL; ++ return rp1_pio_sm_set_clkdiv(client, &args); ++} ++ ++static inline int pio_sm_set_pins(struct rp1_pio_client *client, uint sm, uint32_t pin_values) ++{ ++ struct rp1_pio_sm_set_pins_args args = { .sm = sm, .values = pin_values, ++ .mask = GPIOS_MASK }; ++ ++ if (bad_params_if(client, sm >= NUM_PIO_STATE_MACHINES)) ++ return -EINVAL; ++ return rp1_pio_sm_set_pins(client, &args); ++} ++ ++static inline int pio_sm_set_pins_with_mask(struct rp1_pio_client *client, uint sm, ++ uint32_t pin_values, uint32_t pin_mask) ++{ ++ struct rp1_pio_sm_set_pins_args args = { .sm = sm, .values = pin_values, ++ .mask = pin_mask }; ++ ++ if (bad_params_if(client, sm >= NUM_PIO_STATE_MACHINES)) ++ return -EINVAL; ++ return rp1_pio_sm_set_pins(client, &args); ++} ++ ++static inline int pio_sm_set_pindirs_with_mask(struct rp1_pio_client *client, uint sm, ++ uint32_t pin_dirs, uint32_t pin_mask) ++{ ++ struct rp1_pio_sm_set_pindirs_args args = { .sm = sm, .dirs = pin_dirs, ++ .mask = pin_mask }; ++ ++ if (bad_params_if(client, sm >= NUM_PIO_STATE_MACHINES || ++ (pin_dirs & GPIOS_MASK) != pin_dirs || ++ (pin_mask & pin_mask) != pin_mask)) ++ return -EINVAL; ++ return rp1_pio_sm_set_pindirs(client, &args); ++} ++ ++static inline int pio_sm_set_consecutive_pindirs(struct rp1_pio_client *client, uint sm, ++ uint pin_base, uint pin_count, bool is_out) ++{ ++ uint32_t mask = ((1 << pin_count) - 1) << pin_base; ++ struct rp1_pio_sm_set_pindirs_args args = { .sm = sm, .dirs = is_out ? mask : 0, ++ .mask = mask }; ++ ++ if (bad_params_if(client, sm >= NUM_PIO_STATE_MACHINES || ++ pin_base >= RP1_PIO_GPIO_COUNT || ++ pin_count > RP1_PIO_GPIO_COUNT || ++ (pin_base + pin_count) > RP1_PIO_GPIO_COUNT)) ++ return -EINVAL; ++ return rp1_pio_sm_set_pindirs(client, &args); ++} ++ ++static inline int pio_sm_set_enabled(struct rp1_pio_client *client, uint sm, bool enabled) ++{ ++ struct rp1_pio_sm_set_enabled_args args = { .mask = (1 << sm), .enable = enabled }; ++ ++ if (bad_params_if(client, sm >= NUM_PIO_STATE_MACHINES)) ++ return -EINVAL; ++ return rp1_pio_sm_set_enabled(client, &args); ++} ++ ++static inline int pio_set_sm_mask_enabled(struct rp1_pio_client *client, uint32_t mask, ++ bool enabled) ++{ ++ struct rp1_pio_sm_set_enabled_args args = { .mask = mask, .enable = enabled }; ++ ++ if (bad_params_if(client, mask >= (1 << NUM_PIO_STATE_MACHINES))) ++ return -EINVAL; ++ return rp1_pio_sm_set_enabled(client, &args); ++} ++ ++static inline int pio_sm_restart(struct rp1_pio_client *client, uint sm) ++{ ++ struct rp1_pio_sm_restart_args args = { .mask = (1 << sm) }; ++ ++ if (bad_params_if(client, sm >= NUM_PIO_STATE_MACHINES)) ++ return -EINVAL; ++ return rp1_pio_sm_restart(client, &args); ++} ++ ++static inline int pio_restart_sm_mask(struct rp1_pio_client *client, uint32_t mask) ++{ ++ struct rp1_pio_sm_restart_args args = { .mask = (uint16_t)mask }; ++ ++ if (bad_params_if(client, mask >= (1 << NUM_PIO_STATE_MACHINES))) ++ return -EINVAL; ++ return rp1_pio_sm_restart(client, &args); ++} ++ ++static inline int pio_sm_clkdiv_restart(struct rp1_pio_client *client, uint sm) ++{ ++ struct rp1_pio_sm_restart_args args = { .mask = (1 << sm) }; ++ ++ if (bad_params_if(client, sm >= NUM_PIO_STATE_MACHINES)) ++ return -EINVAL; ++ return rp1_pio_sm_clkdiv_restart(client, &args); ++} ++ ++static inline int pio_clkdiv_restart_sm_mask(struct rp1_pio_client *client, uint32_t mask) ++{ ++ struct rp1_pio_sm_restart_args args = { .mask = (uint16_t)mask }; ++ ++ if (bad_params_if(client, mask >= (1 << NUM_PIO_STATE_MACHINES))) ++ return -EINVAL; ++ return rp1_pio_sm_clkdiv_restart(client, &args); ++} ++ ++static inline int pio_enable_sm_in_sync_mask(struct rp1_pio_client *client, uint32_t mask) ++{ ++ struct rp1_pio_sm_enable_sync_args args = { .mask = (uint16_t)mask }; ++ ++ if (bad_params_if(client, mask >= (1 << NUM_PIO_STATE_MACHINES))) ++ return -EINVAL; ++ return rp1_pio_sm_enable_sync(client, &args); ++} ++ ++static inline int pio_sm_set_dmactrl(struct rp1_pio_client *client, uint sm, bool is_tx, ++ uint32_t ctrl) ++{ ++ struct rp1_pio_sm_set_dmactrl_args args = { .sm = sm, .is_tx = is_tx, .ctrl = ctrl }; ++ ++ if (bad_params_if(client, sm >= NUM_PIO_STATE_MACHINES)) ++ return -EINVAL; ++ return rp1_pio_sm_set_dmactrl(client, &args); ++}; ++ ++static inline int pio_sm_put(struct rp1_pio_client *client, uint sm, uint32_t data) ++{ ++ struct rp1_pio_sm_put_args args = { .sm = (uint16_t)sm, .blocking = false, .data = data }; ++ ++ if (bad_params_if(client, sm >= NUM_PIO_STATE_MACHINES)) ++ return -EINVAL; ++ return rp1_pio_sm_put(client, &args); ++} ++ ++static inline int pio_sm_put_blocking(struct rp1_pio_client *client, uint sm, uint32_t data) ++{ ++ struct rp1_pio_sm_put_args args = { .sm = (uint16_t)sm, .blocking = true, .data = data }; ++ ++ if (bad_params_if(client, sm >= NUM_PIO_STATE_MACHINES)) ++ return -EINVAL; ++ return rp1_pio_sm_put(client, &args); ++} ++ ++static inline uint32_t pio_sm_get(struct rp1_pio_client *client, uint sm) ++{ ++ struct rp1_pio_sm_get_args args = { .sm = (uint16_t)sm, .blocking = false }; ++ ++ if (!bad_params_if(client, sm >= NUM_PIO_STATE_MACHINES)) ++ rp1_pio_sm_get(client, &args); ++ return args.data; ++} ++ ++static inline uint32_t pio_sm_get_blocking(struct rp1_pio_client *client, uint sm) ++{ ++ struct rp1_pio_sm_get_args args = { .sm = (uint16_t)sm, .blocking = true }; ++ ++ if (!bad_params_if(client, sm >= NUM_PIO_STATE_MACHINES)) ++ rp1_pio_sm_get(client, &args); ++ return args.data; ++} ++ ++static inline void sm_config_set_out_pins(pio_sm_config *c, uint out_base, uint out_count) ++{ ++ if (bad_params_if(NULL, out_base >= RP1_PIO_GPIO_COUNT || ++ out_count > RP1_PIO_GPIO_COUNT)) ++ return; ++ ++ c->pinctrl = (c->pinctrl & ~(PROC_PIO_SM0_PINCTRL_OUT_BASE_BITS | ++ PROC_PIO_SM0_PINCTRL_OUT_COUNT_BITS)) | ++ (out_base << PROC_PIO_SM0_PINCTRL_OUT_BASE_LSB) | ++ (out_count << PROC_PIO_SM0_PINCTRL_OUT_COUNT_LSB); ++} ++ ++static inline void sm_config_set_set_pins(pio_sm_config *c, uint set_base, uint set_count) ++{ ++ if (bad_params_if(NULL, set_base >= RP1_PIO_GPIO_COUNT || ++ set_count > 5)) ++ return; ++ ++ c->pinctrl = (c->pinctrl & ~(PROC_PIO_SM0_PINCTRL_SET_BASE_BITS | ++ PROC_PIO_SM0_PINCTRL_SET_COUNT_BITS)) | ++ (set_base << PROC_PIO_SM0_PINCTRL_SET_BASE_LSB) | ++ (set_count << PROC_PIO_SM0_PINCTRL_SET_COUNT_LSB); ++} ++ ++ ++static inline void sm_config_set_in_pins(pio_sm_config *c, uint in_base) ++{ ++ if (bad_params_if(NULL, in_base >= RP1_PIO_GPIO_COUNT)) ++ return; ++ ++ c->pinctrl = (c->pinctrl & ~PROC_PIO_SM0_PINCTRL_IN_BASE_BITS) | ++ (in_base << PROC_PIO_SM0_PINCTRL_IN_BASE_LSB); ++} ++ ++static inline void sm_config_set_sideset_pins(pio_sm_config *c, uint sideset_base) ++{ ++ if (bad_params_if(NULL, sideset_base >= RP1_PIO_GPIO_COUNT)) ++ return; ++ ++ c->pinctrl = (c->pinctrl & ~PROC_PIO_SM0_PINCTRL_SIDESET_BASE_BITS) | ++ (sideset_base << PROC_PIO_SM0_PINCTRL_SIDESET_BASE_LSB); ++} ++ ++static inline void sm_config_set_sideset(pio_sm_config *c, uint bit_count, bool optional, ++ bool pindirs) ++{ ++ if (bad_params_if(NULL, bit_count > 5 || ++ (optional && (bit_count == 0)))) ++ return; ++ c->pinctrl = (c->pinctrl & ~PROC_PIO_SM0_PINCTRL_SIDESET_COUNT_BITS) | ++ (bit_count << PROC_PIO_SM0_PINCTRL_SIDESET_COUNT_LSB); ++ ++ c->execctrl = (c->execctrl & ~(PROC_PIO_SM0_EXECCTRL_SIDE_EN_BITS | ++ PROC_PIO_SM0_EXECCTRL_SIDE_PINDIR_BITS)) | ++ (optional << PROC_PIO_SM0_EXECCTRL_SIDE_EN_LSB) | ++ (pindirs << PROC_PIO_SM0_EXECCTRL_SIDE_PINDIR_LSB); ++} ++ ++static inline void sm_config_set_clkdiv_int_frac(pio_sm_config *c, uint16_t div_int, ++ uint8_t div_frac) ++{ ++ if (bad_params_if(NULL, div_int == 0 && div_frac != 0)) ++ return; ++ ++ c->clkdiv = ++ (((uint)div_frac) << PROC_PIO_SM0_CLKDIV_FRAC_LSB) | ++ (((uint)div_int) << PROC_PIO_SM0_CLKDIV_INT_LSB); ++} ++ ++static inline void sm_config_set_clkdiv(pio_sm_config *c, float div) ++{ ++ uint16_t div_int; ++ uint8_t div_frac; ++ ++ pio_calculate_clkdiv_from_float(div, &div_int, &div_frac); ++ sm_config_set_clkdiv_int_frac(c, div_int, div_frac); ++} ++ ++static inline void sm_config_set_wrap(pio_sm_config *c, uint wrap_target, uint wrap) ++{ ++ if (bad_params_if(NULL, wrap >= PIO_INSTRUCTION_COUNT || ++ wrap_target >= PIO_INSTRUCTION_COUNT)) ++ return; ++ ++ c->execctrl = (c->execctrl & ~(PROC_PIO_SM0_EXECCTRL_WRAP_TOP_BITS | ++ PROC_PIO_SM0_EXECCTRL_WRAP_BOTTOM_BITS)) | ++ (wrap_target << PROC_PIO_SM0_EXECCTRL_WRAP_BOTTOM_LSB) | ++ (wrap << PROC_PIO_SM0_EXECCTRL_WRAP_TOP_LSB); ++} ++ ++static inline void sm_config_set_jmp_pin(pio_sm_config *c, uint pin) ++{ ++ if (bad_params_if(NULL, pin >= RP1_PIO_GPIO_COUNT)) ++ return; ++ ++ c->execctrl = (c->execctrl & ~PROC_PIO_SM0_EXECCTRL_JMP_PIN_BITS) | ++ (pin << PROC_PIO_SM0_EXECCTRL_JMP_PIN_LSB); ++} ++ ++static inline void sm_config_set_in_shift(pio_sm_config *c, bool shift_right, bool autopush, ++ uint push_threshold) ++{ ++ if (bad_params_if(NULL, push_threshold > 32)) ++ return; ++ ++ c->shiftctrl = (c->shiftctrl & ++ ~(PROC_PIO_SM0_SHIFTCTRL_IN_SHIFTDIR_BITS | ++ PROC_PIO_SM0_SHIFTCTRL_AUTOPUSH_BITS | ++ PROC_PIO_SM0_SHIFTCTRL_PUSH_THRESH_BITS)) | ++ (shift_right << PROC_PIO_SM0_SHIFTCTRL_IN_SHIFTDIR_LSB) | ++ (autopush << PROC_PIO_SM0_SHIFTCTRL_AUTOPUSH_LSB) | ++ ((push_threshold & 0x1fu) << PROC_PIO_SM0_SHIFTCTRL_PUSH_THRESH_LSB); ++} ++ ++static inline void sm_config_set_out_shift(pio_sm_config *c, bool shift_right, bool autopull, ++ uint pull_threshold) ++{ ++ if (bad_params_if(NULL, pull_threshold > 32)) ++ return; ++ ++ c->shiftctrl = (c->shiftctrl & ++ ~(PROC_PIO_SM0_SHIFTCTRL_OUT_SHIFTDIR_BITS | ++ PROC_PIO_SM0_SHIFTCTRL_AUTOPULL_BITS | ++ PROC_PIO_SM0_SHIFTCTRL_PULL_THRESH_BITS)) | ++ (shift_right << PROC_PIO_SM0_SHIFTCTRL_OUT_SHIFTDIR_LSB) | ++ (autopull << PROC_PIO_SM0_SHIFTCTRL_AUTOPULL_LSB) | ++ ((pull_threshold & 0x1fu) << PROC_PIO_SM0_SHIFTCTRL_PULL_THRESH_LSB); ++} ++ ++static inline void sm_config_set_fifo_join(pio_sm_config *c, enum pio_fifo_join join) ++{ ++ if (bad_params_if(NULL, join != PIO_FIFO_JOIN_NONE && ++ join != PIO_FIFO_JOIN_TX && ++ join != PIO_FIFO_JOIN_RX)) ++ return; ++ ++ c->shiftctrl = (c->shiftctrl & (uint)~(PROC_PIO_SM0_SHIFTCTRL_FJOIN_TX_BITS | ++ PROC_PIO_SM0_SHIFTCTRL_FJOIN_RX_BITS)) | ++ (((uint)join) << PROC_PIO_SM0_SHIFTCTRL_FJOIN_TX_LSB); ++} ++ ++static inline void sm_config_set_out_special(pio_sm_config *c, bool sticky, bool has_enable_pin, ++ uint enable_pin_index) ++{ ++ c->execctrl = (c->execctrl & ++ (uint)~(PROC_PIO_SM0_EXECCTRL_OUT_STICKY_BITS | ++ PROC_PIO_SM0_EXECCTRL_INLINE_OUT_EN_BITS | ++ PROC_PIO_SM0_EXECCTRL_OUT_EN_SEL_BITS)) | ++ (sticky << PROC_PIO_SM0_EXECCTRL_OUT_STICKY_LSB) | ++ (has_enable_pin << PROC_PIO_SM0_EXECCTRL_INLINE_OUT_EN_LSB) | ++ ((enable_pin_index << PROC_PIO_SM0_EXECCTRL_OUT_EN_SEL_LSB) & ++ PROC_PIO_SM0_EXECCTRL_OUT_EN_SEL_BITS); ++} ++ ++static inline void sm_config_set_mov_status(pio_sm_config *c, enum pio_mov_status_type status_sel, ++ uint status_n) ++{ ++ if (bad_params_if(NULL, status_sel != STATUS_TX_LESSTHAN && ++ status_sel != STATUS_RX_LESSTHAN)) ++ return; ++ ++ c->execctrl = (c->execctrl ++ & ~(PROC_PIO_SM0_EXECCTRL_STATUS_SEL_BITS | PROC_PIO_SM0_EXECCTRL_STATUS_N_BITS)) ++ | ((((uint)status_sel) << PROC_PIO_SM0_EXECCTRL_STATUS_SEL_LSB) & ++ PROC_PIO_SM0_EXECCTRL_STATUS_SEL_BITS) ++ | ((status_n << PROC_PIO_SM0_EXECCTRL_STATUS_N_LSB) & ++ PROC_PIO_SM0_EXECCTRL_STATUS_N_BITS); ++} ++ ++static inline pio_sm_config pio_get_default_sm_config(void) ++{ ++ pio_sm_config c = { 0 }; ++ ++ sm_config_set_clkdiv_int_frac(&c, 1, 0); ++ sm_config_set_wrap(&c, 0, 31); ++ sm_config_set_in_shift(&c, true, false, 32); ++ sm_config_set_out_shift(&c, true, false, 32); ++ return c; ++} ++ ++static inline uint32_t clock_get_hz(enum clock_index clk_index) ++{ ++ const uint32_t MHZ = 1000000; ++ ++ if (bad_params_if(NULL, clk_index != clk_sys)) ++ return 0; ++ return 200 * MHZ; ++} ++ ++static inline int pio_gpio_set_function(struct rp1_pio_client *client, uint gpio, ++ enum gpio_function fn) ++{ ++ struct rp1_gpio_set_function_args args = { .gpio = gpio, .fn = fn }; ++ ++ if (bad_params_if(client, gpio >= RP1_PIO_GPIO_COUNT)) ++ return -EINVAL; ++ return rp1_pio_gpio_set_function(client, &args); ++} ++ ++static inline int pio_gpio_init(struct rp1_pio_client *client, uint gpio) ++{ ++ struct rp1_gpio_init_args args = { .gpio = gpio }; ++ int ret; ++ ++ if (bad_params_if(client, gpio >= RP1_PIO_GPIO_COUNT)) ++ return -EINVAL; ++ ret = rp1_pio_gpio_init(client, &args); ++ if (ret) ++ return ret; ++ return pio_gpio_set_function(client, gpio, RP1_GPIO_FUNC_PIO); ++} ++ ++static inline int pio_gpio_set_pulls(struct rp1_pio_client *client, uint gpio, bool up, bool down) ++{ ++ struct rp1_gpio_set_pulls_args args = { .gpio = gpio, .up = up, .down = down }; ++ ++ if (bad_params_if(client, gpio >= RP1_PIO_GPIO_COUNT)) ++ return -EINVAL; ++ return rp1_pio_gpio_set_pulls(client, &args); ++} ++ ++static inline int pio_gpio_set_outover(struct rp1_pio_client *client, uint gpio, uint value) ++{ ++ struct rp1_gpio_set_args args = { .gpio = gpio, .value = value }; ++ ++ if (bad_params_if(client, gpio >= RP1_PIO_GPIO_COUNT)) ++ return -EINVAL; ++ return rp1_pio_gpio_set_outover(client, &args); ++} ++ ++static inline int pio_gpio_set_inover(struct rp1_pio_client *client, uint gpio, uint value) ++{ ++ struct rp1_gpio_set_args args = { .gpio = gpio, .value = value }; ++ ++ if (bad_params_if(client, gpio >= RP1_PIO_GPIO_COUNT)) ++ return -EINVAL; ++ return rp1_pio_gpio_set_inover(client, &args); ++} ++ ++static inline int pio_gpio_set_oeover(struct rp1_pio_client *client, uint gpio, uint value) ++{ ++ struct rp1_gpio_set_args args = { .gpio = gpio, .value = value }; ++ ++ if (bad_params_if(client, gpio >= RP1_PIO_GPIO_COUNT)) ++ return -EINVAL; ++ return rp1_pio_gpio_set_oeover(client, &args); ++} ++ ++static inline int pio_gpio_set_input_enabled(struct rp1_pio_client *client, uint gpio, ++ bool enabled) ++{ ++ struct rp1_gpio_set_args args = { .gpio = gpio, .value = enabled }; ++ ++ if (bad_params_if(client, gpio >= RP1_PIO_GPIO_COUNT)) ++ return -EINVAL; ++ return rp1_pio_gpio_set_input_enabled(client, &args); ++} ++ ++static inline int pio_gpio_set_drive_strength(struct rp1_pio_client *client, uint gpio, ++ enum gpio_drive_strength drive) ++{ ++ struct rp1_gpio_set_args args = { .gpio = gpio, .value = drive }; ++ ++ if (bad_params_if(client, gpio >= RP1_PIO_GPIO_COUNT)) ++ return -EINVAL; ++ return rp1_pio_gpio_set_drive_strength(client, &args); ++} ++ ++static inline int pio_gpio_pull_up(struct rp1_pio_client *client, uint gpio) ++{ ++ return pio_gpio_set_pulls(client, gpio, true, false); ++} ++ ++static inline int pio_gpio_pull_down(struct rp1_pio_client *client, uint gpio) ++{ ++ return pio_gpio_set_pulls(client, gpio, false, true); ++} ++ ++static inline int pio_gpio_disable_pulls(struct rp1_pio_client *client, uint gpio) ++{ ++ return pio_gpio_set_pulls(client, gpio, false, false); ++} ++ ++#endif diff --git a/target/linux/bcm27xx/patches-6.6/950-1356-pwm-Add-pwm-pio-rp1-driver.patch b/target/linux/bcm27xx/patches-6.6/950-1356-pwm-Add-pwm-pio-rp1-driver.patch new file mode 100644 index 00000000000000..3f787de9d93584 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1356-pwm-Add-pwm-pio-rp1-driver.patch @@ -0,0 +1,299 @@ +From 4d20aadc3188ecfb62b309a9924ee9696a94fc33 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 8 Nov 2024 09:37:58 +0000 +Subject: [PATCH] pwm: Add pwm-pio-rp1 driver + +Use the PIO hardware on RP1 to implement a PWM interface. + +Signed-off-by: Phil Elwell +--- + drivers/pwm/Kconfig | 11 ++ + drivers/pwm/Makefile | 1 + + drivers/pwm/pwm-pio-rp1.c | 251 ++++++++++++++++++++++++++++++++++++++ + 3 files changed, 263 insertions(+) + create mode 100644 drivers/pwm/pwm-pio-rp1.c + +--- a/drivers/pwm/Kconfig ++++ b/drivers/pwm/Kconfig +@@ -454,6 +454,17 @@ config PWM_PCA9685 + To compile this driver as a module, choose M here: the module + will be called pwm-pca9685. + ++config PWM_PIO_RP1 ++ tristate "RP1 PIO PWM support" ++ depends on FIRMWARE_RP1 || COMPILE_TEST ++ help ++ This is a PWM framework driver for Raspberry Pi 5, using the PIO ++ hardware of RP1 to provide PWM functionality. Supports up to 4 ++ instances on GPIOs in bank 0. ++ ++ To compile this driver as a module, choose M here: the module ++ will be called pwm-pio-rp1. ++ + config PWM_PXA + tristate "PXA PWM support" + depends on ARCH_PXA || ARCH_MMP || COMPILE_TEST +--- a/drivers/pwm/Makefile ++++ b/drivers/pwm/Makefile +@@ -41,6 +41,7 @@ obj-$(CONFIG_PWM_MXS) += pwm-mxs.o + obj-$(CONFIG_PWM_NTXEC) += pwm-ntxec.o + obj-$(CONFIG_PWM_OMAP_DMTIMER) += pwm-omap-dmtimer.o + obj-$(CONFIG_PWM_PCA9685) += pwm-pca9685.o ++obj-$(CONFIG_PWM_PIO_RP1) += pwm-pio-rp1.o + obj-$(CONFIG_PWM_PXA) += pwm-pxa.o + obj-$(CONFIG_PWM_RASPBERRYPI_POE) += pwm-raspberrypi-poe.o + obj-$(CONFIG_PWM_RP1) += pwm-rp1.o +--- /dev/null ++++ b/drivers/pwm/pwm-pio-rp1.c +@@ -0,0 +1,251 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * Raspberry Pi PIO PWM. ++ * ++ * Copyright (C) 2024 Raspberry Pi Ltd. ++ * ++ * Author: Phil Elwell (phil@raspberrypi.com) ++ * ++ * Based on the pwm-rp1 driver by: ++ * Naushir Patuck ++ * and on the pwm-gpio driver by: ++ * Vincent Whitchurch ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++struct pwm_pio_rp1 { ++ struct pwm_chip chip; ++ struct device *dev; ++ struct gpio_desc *gpiod; ++ struct mutex mutex; ++ PIO pio; ++ uint sm; ++ uint offset; ++ uint gpio; ++ uint32_t period; /* In SM cycles */ ++ uint32_t duty_cycle; /* In SM cycles */ ++ enum pwm_polarity polarity; ++ bool enabled; ++}; ++ ++/* Generated from pwm.pio by pioasm */ ++#define pwm_wrap_target 0 ++#define pwm_wrap 6 ++#define pwm_loop_ticks 3 ++ ++static const uint16_t pwm_program_instructions[] = { ++ // .wrap_target ++ 0x9080, // 0: pull noblock side 0 ++ 0xa027, // 1: mov x, osr ++ 0xa046, // 2: mov y, isr ++ 0x00a5, // 3: jmp x != y, 5 ++ 0x1806, // 4: jmp 6 side 1 ++ 0xa042, // 5: nop ++ 0x0083, // 6: jmp y--, 3 ++ // .wrap ++}; ++ ++static const struct pio_program pwm_program = { ++ .instructions = pwm_program_instructions, ++ .length = 7, ++ .origin = -1, ++}; ++ ++static unsigned int pwm_pio_resolution __read_mostly; ++ ++static inline pio_sm_config pwm_program_get_default_config(uint offset) ++{ ++ pio_sm_config c = pio_get_default_sm_config(); ++ ++ sm_config_set_wrap(&c, offset + pwm_wrap_target, offset + pwm_wrap); ++ sm_config_set_sideset(&c, 2, true, false); ++ return c; ++} ++ ++static inline void pwm_program_init(PIO pio, uint sm, uint offset, uint pin) ++{ ++ pio_gpio_init(pio, pin); ++ ++ pio_sm_set_consecutive_pindirs(pio, sm, pin, 1, true); ++ pio_sm_config c = pwm_program_get_default_config(offset); ++ ++ sm_config_set_sideset_pins(&c, pin); ++ pio_sm_init(pio, sm, offset, &c); ++} ++ ++/* Write `period` to the input shift register - must be disabled */ ++static void pio_pwm_set_period(PIO pio, uint sm, uint32_t period) ++{ ++ pio_sm_put_blocking(pio, sm, period); ++ pio_sm_exec(pio, sm, pio_encode_pull(false, false)); ++ pio_sm_exec(pio, sm, pio_encode_out(pio_isr, 32)); ++} ++ ++/* Write `level` to TX FIFO. State machine will copy this into X. */ ++static void pio_pwm_set_level(PIO pio, uint sm, uint32_t level) ++{ ++ pio_sm_put_blocking(pio, sm, level); ++} ++ ++static int pwm_pio_rp1_apply(struct pwm_chip *chip, struct pwm_device *pwm, ++ const struct pwm_state *state) ++{ ++ struct pwm_pio_rp1 *ppwm = container_of(chip, struct pwm_pio_rp1, chip); ++ uint32_t new_duty_cycle; ++ uint32_t new_period; ++ ++ if (state->duty_cycle && state->duty_cycle < pwm_pio_resolution) ++ return -EINVAL; ++ ++ if (state->duty_cycle != state->period && ++ (state->period - state->duty_cycle < pwm_pio_resolution)) ++ return -EINVAL; ++ ++ new_period = state->period / pwm_pio_resolution; ++ new_duty_cycle = state->duty_cycle / pwm_pio_resolution; ++ ++ mutex_lock(&ppwm->mutex); ++ ++ if ((ppwm->enabled && !state->enabled) || new_period != ppwm->period) { ++ pio_sm_set_enabled(ppwm->pio, ppwm->sm, false); ++ ppwm->enabled = false; ++ } ++ ++ if (new_period != ppwm->period) { ++ pio_pwm_set_period(ppwm->pio, ppwm->sm, new_period); ++ ppwm->period = new_period; ++ } ++ ++ if (state->enabled && new_duty_cycle != ppwm->duty_cycle) { ++ pio_pwm_set_level(ppwm->pio, ppwm->sm, new_duty_cycle); ++ ppwm->duty_cycle = new_duty_cycle; ++ } ++ ++ if (state->polarity != ppwm->polarity) { ++ pio_gpio_set_outover(ppwm->pio, ppwm->gpio, ++ (state->polarity == PWM_POLARITY_INVERSED) ? ++ GPIO_OVERRIDE_INVERT : GPIO_OVERRIDE_NORMAL); ++ ppwm->polarity = state->polarity; ++ } ++ ++ if (!ppwm->enabled && state->enabled) { ++ pio_sm_set_enabled(ppwm->pio, ppwm->sm, true); ++ ppwm->enabled = true; ++ } ++ ++ mutex_unlock(&ppwm->mutex); ++ ++ return 0; ++} ++ ++static const struct pwm_ops pwm_pio_rp1_ops = { ++ .apply = pwm_pio_rp1_apply, ++}; ++ ++static int pwm_pio_rp1_probe(struct platform_device *pdev) ++{ ++ struct device_node *np = pdev->dev.of_node; ++ struct of_phandle_args of_args = { 0 }; ++ struct device *dev = &pdev->dev; ++ struct pwm_pio_rp1 *ppwm; ++ struct pwm_chip *chip; ++ bool is_rp1; ++ ++ ppwm = devm_kzalloc(dev, sizeof(*ppwm), GFP_KERNEL); ++ if (IS_ERR(ppwm)) ++ return PTR_ERR(ppwm); ++ ++ chip = &ppwm->chip; ++ ++ mutex_init(&ppwm->mutex); ++ ++ ppwm->gpiod = devm_gpiod_get(dev, NULL, GPIOD_ASIS); ++ /* Need to check that this is an RP1 GPIO in the first bank, and retrieve the offset */ ++ /* Unfortunately I think this has to be done by parsing the gpios property */ ++ if (IS_ERR(ppwm->gpiod)) ++ return dev_err_probe(dev, PTR_ERR(ppwm->gpiod), ++ "could not get a gpio\n"); ++ ++ /* This really shouldn't fail, given that we have a gpiod */ ++ if (of_parse_phandle_with_args(np, "gpios", "#gpio-cells", 0, &of_args)) ++ return dev_err_probe(dev, -EINVAL, ++ "can't find gpio declaration\n"); ++ ++ is_rp1 = of_device_is_compatible(of_args.np, "raspberrypi,rp1-gpio"); ++ of_node_put(of_args.np); ++ if (!is_rp1 || of_args.args_count != 2) ++ return dev_err_probe(dev, -EINVAL, ++ "not an RP1 gpio\n"); ++ ++ ppwm->gpio = of_args.args[0]; ++ ++ ppwm->pio = pio_open(); ++ if (IS_ERR(ppwm->pio)) ++ return dev_err_probe(dev, PTR_ERR(ppwm->pio), ++ "%pfw: could not open PIO\n", ++ dev_fwnode(dev)); ++ ++ ppwm->sm = pio_claim_unused_sm(ppwm->pio, false); ++ if ((int)ppwm->sm < 0) { ++ pio_close(ppwm->pio); ++ return dev_err_probe(dev, -EBUSY, ++ "%pfw: no free PIO SM\n", ++ dev_fwnode(dev)); ++ } ++ ++ ppwm->offset = pio_add_program(ppwm->pio, &pwm_program); ++ if (ppwm->offset == PIO_ORIGIN_ANY) { ++ pio_close(ppwm->pio); ++ return dev_err_probe(dev, -EBUSY, ++ "%pfw: not enough PIO program space\n", ++ dev_fwnode(dev)); ++ } ++ ++ pwm_program_init(ppwm->pio, ppwm->sm, ppwm->offset, ppwm->gpio); ++ ++ pwm_pio_resolution = (1000u * 1000 * 1000 * pwm_loop_ticks) / clock_get_hz(clk_sys); ++ ++ chip->dev = dev; ++ chip->ops = &pwm_pio_rp1_ops; ++ chip->atomic = true; ++ chip->npwm = 1; ++ ++ platform_set_drvdata(pdev, ppwm); ++ ++ return devm_pwmchip_add(dev, chip); ++} ++ ++static void pwm_pio_rp1_remove(struct platform_device *pdev) ++{ ++ struct pwm_pio_rp1 *ppwm = platform_get_drvdata(pdev); ++ ++ pio_close(ppwm->pio); ++} ++ ++static const struct of_device_id pwm_pio_rp1_dt_ids[] = { ++ { .compatible = "raspberrypi,pwm-pio-rp1" }, ++ { /* sentinel */ } ++}; ++MODULE_DEVICE_TABLE(of, pwm_pio_rp1_dt_ids); ++ ++static struct platform_driver pwm_pio_rp1_driver = { ++ .driver = { ++ .name = "pwm-pio-rp1", ++ .of_match_table = pwm_pio_rp1_dt_ids, ++ }, ++ .probe = pwm_pio_rp1_probe, ++ .remove_new = pwm_pio_rp1_remove, ++}; ++module_platform_driver(pwm_pio_rp1_driver); ++ ++MODULE_DESCRIPTION("PWM PIO RP1 driver"); ++MODULE_AUTHOR("Phil Elwell"); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/bcm27xx/patches-6.6/950-1357-misc-rp1-pio-Fix-copy-paste-error-in-pio_rp1.h.patch b/target/linux/bcm27xx/patches-6.6/950-1357-misc-rp1-pio-Fix-copy-paste-error-in-pio_rp1.h.patch new file mode 100644 index 00000000000000..0746e3c32ba949 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1357-misc-rp1-pio-Fix-copy-paste-error-in-pio_rp1.h.patch @@ -0,0 +1,25 @@ +From 99a0201bb0abc946dc431214b638b2cc6b01dda5 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 25 Nov 2024 16:19:55 +0000 +Subject: [PATCH] misc/rp1-pio: Fix copy/paste error in pio_rp1.h + +As per the subject, there was a copy/paste error that caused +pio_sm_unclaim from a driver to result in a call to +pio_sm_claim. Fix it. + +Signed-off-by: Phil Elwell +--- + include/linux/pio_rp1.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/include/linux/pio_rp1.h ++++ b/include/linux/pio_rp1.h +@@ -318,7 +318,7 @@ static inline int pio_sm_unclaim(struct + if (bad_params_if(client, sm >= NUM_PIO_STATE_MACHINES)) + return -EINVAL; + +- return rp1_pio_sm_claim(client, &args); ++ return rp1_pio_sm_unclaim(client, &args); + } + + static inline int pio_claim_unused_sm(struct rp1_pio_client *client, bool required) diff --git a/target/linux/bcm27xx/patches-6.6/950-1357-rpi-pio-add-missing.patch b/target/linux/bcm27xx/patches-6.6/950-1357-rpi-pio-add-missing.patch new file mode 100644 index 00000000000000..c871fa681f717a --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1357-rpi-pio-add-missing.patch @@ -0,0 +1,42 @@ +From df8a2f6dc114b2c5c7685a069f717f2b06186b74 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 20 Nov 2024 16:23:06 +0000 +Subject: [PATCH] rp1-pio: Add missing 'static inline's + +Avoid some duplicate symbol errors by adding some missing +'static inline' decorations. + +Signed-off-by: Phil Elwell +--- + include/linux/pio_rp1.h | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/include/linux/pio_rp1.h ++++ b/include/linux/pio_rp1.h +@@ -245,7 +245,7 @@ static inline bool pio_can_add_program_a + return !rp1_pio_can_add_program(client, &args); + } + +-uint pio_add_program(struct rp1_pio_client *client, const pio_program_t *program) ++static inline uint pio_add_program(struct rp1_pio_client *client, const pio_program_t *program) + { + struct rp1_pio_add_program_args args; + int offset; +@@ -365,7 +365,7 @@ static inline int pio_sm_set_config(stru + return rp1_pio_sm_set_config(client, &args); + } + +-int pio_sm_exec(struct rp1_pio_client *client, uint sm, uint instr) ++static inline int pio_sm_exec(struct rp1_pio_client *client, uint sm, uint instr) + { + struct rp1_pio_sm_exec_args args = { .sm = sm, .instr = instr, .blocking = false }; + +@@ -375,7 +375,7 @@ int pio_sm_exec(struct rp1_pio_client *c + return rp1_pio_sm_exec(client, &args); + } + +-int pio_sm_exec_wait_blocking(struct rp1_pio_client *client, uint sm, uint instr) ++static inline int pio_sm_exec_wait_blocking(struct rp1_pio_client *client, uint sm, uint instr) + { + struct rp1_pio_sm_exec_args args = { .sm = sm, .instr = instr, .blocking = true }; + diff --git a/target/linux/bcm27xx/patches-6.6/950-1358-misc-rpi-pio-back-port-some.patch b/target/linux/bcm27xx/patches-6.6/950-1358-misc-rpi-pio-back-port-some.patch new file mode 100644 index 00000000000000..92bde521d23d74 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1358-misc-rpi-pio-back-port-some.patch @@ -0,0 +1,39 @@ +From d1f0c94e974a5f26d210b1d13a6ef9543bee4984 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 21 Nov 2024 11:11:48 +0000 +Subject: [PATCH] misc: rp1-pio: Back-port some 6.11 build fixes + +Porting rp1-pio to rpi-6.11.y uncovered a few missing #includes and a +difference of const-ness. Although not needed here, back-porting the +resulting changes makes the driver more "correct" and may prevent a +future merge conflict. + +Signed-off-by: Phil Elwell +--- + drivers/misc/rp1-pio.c | 3 +++ + include/linux/pio_rp1.h | 2 +- + 2 files changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/misc/rp1-pio.c ++++ b/drivers/misc/rp1-pio.c +@@ -22,6 +22,9 @@ + #include + #include + #include ++#include ++#include ++#include + #include + #include + #include +--- a/include/linux/pio_rp1.h ++++ b/include/linux/pio_rp1.h +@@ -176,7 +176,7 @@ typedef rp1_pio_sm_config pio_sm_config; + typedef struct rp1_pio_client *PIO; + + void pio_set_error(struct rp1_pio_client *client, int err); +-int pio_get_error(struct rp1_pio_client *client); ++int pio_get_error(const struct rp1_pio_client *client); + void pio_clear_error(struct rp1_pio_client *client); + + int rp1_pio_can_add_program(struct rp1_pio_client *client, void *param); diff --git a/target/linux/bcm27xx/patches-6.6/950-1359-misc-rp1-pio-Add-FIFO.patch b/target/linux/bcm27xx/patches-6.6/950-1359-misc-rp1-pio-Add-FIFO.patch new file mode 100644 index 00000000000000..fff033f5a6b7df --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1359-misc-rp1-pio-Add-FIFO.patch @@ -0,0 +1,215 @@ +From dd2394360860d15146c96635796a75b05bb32b61 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 19 Nov 2024 09:25:34 +0000 +Subject: [PATCH] misc: rp1-pio: Add FIFO-related methods + +Add support for querying the FIFO status and clearing the TX FIFO. + +Signed-off-by: Phil Elwell +--- + drivers/misc/rp1-fw-pio.h | 3 ++ + drivers/misc/rp1-pio.c | 24 +++++++++ + include/linux/pio_rp1.h | 89 ++++++++++++++++++++++++++++++++++ + include/uapi/misc/rp1_pio_if.h | 13 ++++- + 4 files changed, 128 insertions(+), 1 deletion(-) + +--- a/drivers/misc/rp1-fw-pio.h ++++ b/drivers/misc/rp1-fw-pio.h +@@ -47,6 +47,9 @@ enum rp1_pio_ops { + READ_HW, // src address, len -> data bytes + WRITE_HW, // dst address, data + ++ PIO_SM_FIFO_STATE, // u16 sm, u8 tx -> u16 level, u8 empty, u8 full ++ PIO_SM_DRAIN_TX, // u16 sm ++ + PIO_COUNT + }; + +--- a/drivers/misc/rp1-pio.c ++++ b/drivers/misc/rp1-pio.c +@@ -479,6 +479,28 @@ int rp1_pio_sm_set_dmactrl(struct rp1_pi + } + EXPORT_SYMBOL_GPL(rp1_pio_sm_set_dmactrl); + ++int rp1_pio_sm_fifo_state(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_pio_sm_fifo_state_args *args = param; ++ const int level_offset = offsetof(struct rp1_pio_sm_fifo_state_args, level); ++ int ret; ++ ++ ret = rp1_pio_message_resp(client->pio, PIO_SM_FIFO_STATE, args, sizeof(*args), ++ &args->level, NULL, sizeof(*args) - level_offset); ++ if (ret >= 0) ++ return level_offset + ret; ++ return ret; ++} ++EXPORT_SYMBOL_GPL(rp1_pio_sm_fifo_state); ++ ++int rp1_pio_sm_drain_tx(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_pio_sm_clear_fifos_args *args = param; ++ ++ return rp1_pio_message(client->pio, PIO_SM_DRAIN_TX, args, sizeof(*args)); ++} ++EXPORT_SYMBOL_GPL(rp1_pio_sm_drain_tx); ++ + int rp1_pio_gpio_init(struct rp1_pio_client *client, void *param) + { + struct rp1_gpio_init_args *args = param; +@@ -851,6 +873,8 @@ struct handler_info { + HANDLER(SM_PUT, sm_put), + HANDLER(SM_GET, sm_get), + HANDLER(SM_SET_DMACTRL, sm_set_dmactrl), ++ HANDLER(SM_FIFO_STATE, sm_fifo_state), ++ HANDLER(SM_DRAIN_TX, sm_drain_tx), + + HANDLER(GPIO_INIT, gpio_init), + HANDLER(GPIO_SET_FUNCTION, gpio_set_function), +--- a/include/linux/pio_rp1.h ++++ b/include/linux/pio_rp1.h +@@ -200,6 +200,8 @@ int rp1_pio_sm_enable_sync(struct rp1_pi + int rp1_pio_sm_put(struct rp1_pio_client *client, void *param); + int rp1_pio_sm_get(struct rp1_pio_client *client, void *param); + int rp1_pio_sm_set_dmactrl(struct rp1_pio_client *client, void *param); ++int rp1_pio_sm_fifo_state(struct rp1_pio_client *client, void *param); ++int rp1_pio_sm_drain_tx(struct rp1_pio_client *client, void *param); + int rp1_pio_gpio_init(struct rp1_pio_client *client, void *param); + int rp1_pio_gpio_set_function(struct rp1_pio_client *client, void *param); + int rp1_pio_gpio_set_pulls(struct rp1_pio_client *client, void *param); +@@ -551,6 +553,15 @@ static inline int pio_sm_set_dmactrl(str + return rp1_pio_sm_set_dmactrl(client, &args); + }; + ++static inline int pio_sm_drain_tx_fifo(struct rp1_pio_client *client, uint sm) ++{ ++ struct rp1_pio_sm_clear_fifos_args args = { .sm = sm }; ++ ++ if (bad_params_if(client, sm >= NUM_PIO_STATE_MACHINES)) ++ return -EINVAL; ++ return rp1_pio_sm_drain_tx(client, &args); ++}; ++ + static inline int pio_sm_put(struct rp1_pio_client *client, uint sm, uint32_t data) + { + struct rp1_pio_sm_put_args args = { .sm = (uint16_t)sm, .blocking = false, .data = data }; +@@ -587,6 +598,84 @@ static inline uint32_t pio_sm_get_blocki + return args.data; + } + ++static inline int pio_sm_is_rx_fifo_empty(struct rp1_pio_client *client, uint sm) ++{ ++ struct rp1_pio_sm_fifo_state_args args = { .sm = sm, .tx = false }; ++ int ret; ++ ++ if (bad_params_if(client, sm >= NUM_PIO_STATE_MACHINES)) ++ return -EINVAL; ++ ret = rp1_pio_sm_fifo_state(client, &args); ++ if (ret == sizeof(args)) ++ ret = args.empty; ++ return ret; ++}; ++ ++static inline int pio_sm_is_rx_fifo_full(struct rp1_pio_client *client, uint sm) ++{ ++ struct rp1_pio_sm_fifo_state_args args = { .sm = sm, .tx = false }; ++ int ret; ++ ++ if (bad_params_if(client, sm >= NUM_PIO_STATE_MACHINES)) ++ return -EINVAL; ++ ret = rp1_pio_sm_fifo_state(client, &args); ++ if (ret == sizeof(args)) ++ ret = args.full; ++ return ret; ++}; ++ ++static inline int pio_sm_rx_fifo_level(struct rp1_pio_client *client, uint sm) ++{ ++ struct rp1_pio_sm_fifo_state_args args = { .sm = sm, .tx = false }; ++ int ret; ++ ++ if (bad_params_if(client, sm >= NUM_PIO_STATE_MACHINES)) ++ return -EINVAL; ++ ret = rp1_pio_sm_fifo_state(client, &args); ++ if (ret == sizeof(args)) ++ ret = args.level; ++ return ret; ++}; ++ ++static inline int pio_sm_is_tx_fifo_empty(struct rp1_pio_client *client, uint sm) ++{ ++ struct rp1_pio_sm_fifo_state_args args = { .sm = sm, .tx = true }; ++ int ret; ++ ++ if (bad_params_if(client, sm >= NUM_PIO_STATE_MACHINES)) ++ return -EINVAL; ++ ret = rp1_pio_sm_fifo_state(client, &args); ++ if (ret == sizeof(args)) ++ ret = args.empty; ++ return ret; ++}; ++ ++static inline int pio_sm_is_tx_fifo_full(struct rp1_pio_client *client, uint sm) ++{ ++ struct rp1_pio_sm_fifo_state_args args = { .sm = sm, .tx = true }; ++ int ret; ++ ++ if (bad_params_if(client, sm >= NUM_PIO_STATE_MACHINES)) ++ return -EINVAL; ++ ret = rp1_pio_sm_fifo_state(client, &args); ++ if (ret == sizeof(args)) ++ ret = args.full; ++ return ret; ++}; ++ ++static inline int pio_sm_tx_fifo_level(struct rp1_pio_client *client, uint sm) ++{ ++ struct rp1_pio_sm_fifo_state_args args = { .sm = sm, .tx = true }; ++ int ret; ++ ++ if (bad_params_if(client, sm >= NUM_PIO_STATE_MACHINES)) ++ return -EINVAL; ++ ret = rp1_pio_sm_fifo_state(client, &args); ++ if (ret == sizeof(args)) ++ ret = args.level; ++ return ret; ++}; ++ + static inline void sm_config_set_out_pins(pio_sm_config *c, uint out_base, uint out_count) + { + if (bad_params_if(NULL, out_base >= RP1_PIO_GPIO_COUNT || +--- a/include/uapi/misc/rp1_pio_if.h ++++ b/include/uapi/misc/rp1_pio_if.h +@@ -114,7 +114,7 @@ struct rp1_pio_sm_get_args { + uint16_t sm; + uint8_t blocking; + uint8_t rsvd; +- uint32_t data; /* IN/OUT */ ++ uint32_t data; /* OUT */ + }; + + struct rp1_pio_sm_set_dmactrl_args { +@@ -124,6 +124,15 @@ struct rp1_pio_sm_set_dmactrl_args { + uint32_t ctrl; + }; + ++struct rp1_pio_sm_fifo_state_args { ++ uint16_t sm; ++ uint8_t tx; ++ uint8_t rsvd; ++ uint16_t level; /* OUT */ ++ uint8_t empty; /* OUT */ ++ uint8_t full; /* OUT */ ++}; ++ + struct rp1_gpio_init_args { + uint16_t gpio; + }; +@@ -195,6 +204,8 @@ struct rp1_access_hw_args { + #define PIO_IOC_SM_PUT _IOW(PIO_IOC_MAGIC, 41, struct rp1_pio_sm_put_args) + #define PIO_IOC_SM_GET _IOWR(PIO_IOC_MAGIC, 42, struct rp1_pio_sm_get_args) + #define PIO_IOC_SM_SET_DMACTRL _IOW(PIO_IOC_MAGIC, 43, struct rp1_pio_sm_set_dmactrl_args) ++#define PIO_IOC_SM_FIFO_STATE _IOW(PIO_IOC_MAGIC, 44, struct rp1_pio_sm_fifo_state_args) ++#define PIO_IOC_SM_DRAIN_TX _IOW(PIO_IOC_MAGIC, 45, struct rp1_pio_sm_clear_fifos_args) + + #define PIO_IOC_GPIO_INIT _IOW(PIO_IOC_MAGIC, 50, struct rp1_gpio_init_args) + #define PIO_IOC_GPIO_SET_FUNCTION _IOW(PIO_IOC_MAGIC, 51, struct rp1_gpio_set_function_args) diff --git a/target/linux/bcm27xx/patches-6.6/950-1360-misc-rp1-pio-Fix-parameter-checks-wihout-client.patch b/target/linux/bcm27xx/patches-6.6/950-1360-misc-rp1-pio-Fix-parameter-checks-wihout-client.patch new file mode 100644 index 00000000000000..e68bd175d8199b --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1360-misc-rp1-pio-Fix-parameter-checks-wihout-client.patch @@ -0,0 +1,25 @@ +From 3687701e8d252864f440f91f1aedf8ffd58d6ee6 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 25 Nov 2024 21:51:13 +0000 +Subject: [PATCH] misc: rp1-pio: Fix parameter checks wihout client + +Passing bad parameters to an API call without a pio pointer will cause +a NULL pointer exception when the persistent error is set. Guard +against that. + +Signed-off-by: Phil Elwell +--- + include/linux/pio_rp1.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/include/linux/pio_rp1.h ++++ b/include/linux/pio_rp1.h +@@ -20,7 +20,7 @@ + #endif + + #define bad_params_if(client, test) \ +- ({ bool f = (test); if (f) pio_set_error(client, -EINVAL); \ ++ ({ bool f = (test); if (f && client) pio_set_error(client, -EINVAL); \ + if (f && PARAM_WARNINGS_ENABLED) WARN_ON((test)); \ + f; }) + diff --git a/target/linux/bcm27xx/patches-6.6/950-1394-misc-rp1-pio-Add-compat_ioctl-method.patch b/target/linux/bcm27xx/patches-6.6/950-1394-misc-rp1-pio-Add-compat_ioctl-method.patch new file mode 100644 index 00000000000000..bffa2418a15644 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1394-misc-rp1-pio-Add-compat_ioctl-method.patch @@ -0,0 +1,91 @@ +From b4472d09b1ffdafd8132803ffbec62596e559fd8 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 18 Nov 2024 09:10:52 +0000 +Subject: [PATCH 1394/1482] misc: rp1-pio: Add compat_ioctl method + +Provide a compat_ioctl method, to support running a 64-bit kernel with +a 32-bit userland. + +Signed-off-by: Phil Elwell +--- + drivers/misc/rp1-pio.c | 64 ++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 64 insertions(+) + +--- a/drivers/misc/rp1-pio.c ++++ b/drivers/misc/rp1-pio.c +@@ -1023,11 +1023,75 @@ static long rp1_pio_ioctl(struct file *f + return ret; + } + ++#ifdef CONFIG_COMPAT ++ ++struct rp1_pio_sm_xfer_data_args_compat { ++ uint16_t sm; ++ uint16_t dir; ++ uint16_t data_bytes; ++ compat_uptr_t data; ++}; ++ ++struct rp1_access_hw_args_compat { ++ uint32_t addr; ++ uint32_t len; ++ compat_uptr_t data; ++}; ++ ++#define PIO_IOC_SM_XFER_DATA_COMPAT _IOW(PIO_IOC_MAGIC, 1, struct rp1_pio_sm_xfer_data_args_compat) ++#define PIO_IOC_READ_HW_COMPAT _IOW(PIO_IOC_MAGIC, 8, struct rp1_access_hw_args_compat) ++#define PIO_IOC_WRITE_HW_COMPAT _IOW(PIO_IOC_MAGIC, 9, struct rp1_access_hw_args_compat) ++ ++static long rp1_pio_compat_ioctl(struct file *filp, unsigned int ioctl_num, ++ unsigned long ioctl_param) ++{ ++ struct rp1_pio_client *client = filp->private_data; ++ ++ switch (ioctl_num) { ++ case PIO_IOC_SM_XFER_DATA_COMPAT: ++ { ++ struct rp1_pio_sm_xfer_data_args_compat compat_param; ++ struct rp1_pio_sm_xfer_data_args param; ++ ++ if (copy_from_user(&compat_param, compat_ptr(ioctl_param), sizeof(compat_param))) ++ return -EFAULT; ++ param.sm = compat_param.sm; ++ param.dir = compat_param.dir; ++ param.data_bytes = compat_param.data_bytes; ++ param.data = compat_ptr(compat_param.data); ++ return rp1_pio_sm_xfer_data(client, ¶m); ++ } ++ ++ case PIO_IOC_READ_HW_COMPAT: ++ case PIO_IOC_WRITE_HW_COMPAT: ++ { ++ struct rp1_access_hw_args_compat compat_param; ++ struct rp1_access_hw_args param; ++ ++ if (copy_from_user(&compat_param, compat_ptr(ioctl_param), sizeof(compat_param))) ++ return -EFAULT; ++ param.addr = compat_param.addr; ++ param.len = compat_param.len; ++ param.data = compat_ptr(compat_param.data); ++ if (ioctl_num == PIO_IOC_READ_HW_COMPAT) ++ return rp1_pio_read_hw(client, ¶m); ++ else ++ return rp1_pio_write_hw(client, ¶m); ++ } ++ default: ++ return rp1_pio_ioctl(filp, ioctl_num, ioctl_param); ++ } ++} ++#else ++#define rp1_pio_compat_ioctl NULL ++#endif ++ + const struct file_operations rp1_pio_fops = { + .owner = THIS_MODULE, + .open = rp1_pio_open, + .release = rp1_pio_release, + .unlocked_ioctl = rp1_pio_ioctl, ++ .compat_ioctl = rp1_pio_compat_ioctl, + }; + + static int rp1_pio_probe(struct platform_device *pdev) diff --git a/target/linux/bcm27xx/patches-6.6/950-1423-net-macb-Add-support-for-Raspberry-Pi-RP1-ethernet-c.patch b/target/linux/bcm27xx/patches-6.6/950-1423-net-macb-Add-support-for-Raspberry-Pi-RP1-ethernet-c.patch new file mode 100644 index 00000000000000..3941d69edf035d --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1423-net-macb-Add-support-for-Raspberry-Pi-RP1-ethernet-c.patch @@ -0,0 +1,43 @@ +From f9f0024bd9bf04a58b64bae356be4c04022d23bc Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Mon, 11 Nov 2024 16:40:07 +0000 +Subject: [PATCH 1423/1482] net: macb: Add support for Raspberry Pi RP1 + ethernet controller + +The RP1 chip has the Cadence GEM block, but wants the tx_clock +to always run at 125MHz, in the same way as sama7g5. +Add the relevant configuration. + +Signed-off-by: Dave Stevenson +--- + drivers/net/ethernet/cadence/macb_main.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +--- a/drivers/net/ethernet/cadence/macb_main.c ++++ b/drivers/net/ethernet/cadence/macb_main.c +@@ -5023,6 +5023,17 @@ static const struct macb_config versal_c + .usrio = &macb_default_usrio, + }; + ++static const struct macb_config raspberrypi_rp1_config = { ++ .caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_CLK_HW_CHG | ++ MACB_CAPS_JUMBO | ++ MACB_CAPS_GEM_HAS_PTP, ++ .dma_burst_length = 16, ++ .clk_init = macb_clk_init, ++ .init = macb_init, ++ .usrio = &macb_default_usrio, ++ .jumbo_max_len = 10240, ++}; ++ + static const struct of_device_id macb_dt_ids[] = { + { .compatible = "cdns,at91sam9260-macb", .data = &at91sam9260_config }, + { .compatible = "cdns,macb" }, +@@ -5043,6 +5054,7 @@ static const struct of_device_id macb_dt + { .compatible = "microchip,mpfs-macb", .data = &mpfs_config }, + { .compatible = "microchip,sama7g5-gem", .data = &sama7g5_gem_config }, + { .compatible = "microchip,sama7g5-emac", .data = &sama7g5_emac_config }, ++ { .compatible = "raspberrypi,rp1-gem", .data = &raspberrypi_rp1_config }, + { .compatible = "xlnx,zynqmp-gem", .data = &zynqmp_config}, + { .compatible = "xlnx,zynq-gem", .data = &zynq_config }, + { .compatible = "xlnx,versal-gem", .data = &versal_config}, diff --git a/target/linux/bcm27xx/patches-6.6/950-1424-rp1-clk-Only-set-PLL_SEC_RST-in-rp1_pll_divider_off.patch b/target/linux/bcm27xx/patches-6.6/950-1424-rp1-clk-Only-set-PLL_SEC_RST-in-rp1_pll_divider_off.patch new file mode 100644 index 00000000000000..d3f216d31d0669 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1424-rp1-clk-Only-set-PLL_SEC_RST-in-rp1_pll_divider_off.patch @@ -0,0 +1,27 @@ +From 33c225f622d596034a9261316666089a92aa6834 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Mon, 25 Nov 2024 12:30:06 +0000 +Subject: [PATCH 1424/1482] rp1: clk: Only set PLL_SEC_RST in + rp1_pll_divider_off + +Rather than clearing all the bits in rp1_pll_divider_off +and setting PLL_SEC_RST, retain the status of all the other +bits. + +Signed-off-by: Dave Stevenson +--- + drivers/clk/clk-rp1.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/clk/clk-rp1.c ++++ b/drivers/clk/clk-rp1.c +@@ -927,7 +927,8 @@ static void rp1_pll_divider_off(struct c + const struct rp1_pll_data *data = divider->data; + + spin_lock(&clockman->regs_lock); +- clockman_write(clockman, data->ctrl_reg, PLL_SEC_RST); ++ clockman_write(clockman, data->ctrl_reg, ++ clockman_read(clockman, data->ctrl_reg) | PLL_SEC_RST); + spin_unlock(&clockman->regs_lock); + } + diff --git a/target/linux/bcm27xx/patches-6.6/950-1425-rp1-clk-Rationalise-the-use-of-the-CLK_IS_CRITICAL-f.patch b/target/linux/bcm27xx/patches-6.6/950-1425-rp1-clk-Rationalise-the-use-of-the-CLK_IS_CRITICAL-f.patch new file mode 100644 index 00000000000000..247ae455ac448d --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1425-rp1-clk-Rationalise-the-use-of-the-CLK_IS_CRITICAL-f.patch @@ -0,0 +1,124 @@ +From eb836a6a299322a8e2b9627cccd23c7a76d068ba Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 8 Nov 2024 17:36:13 +0000 +Subject: [PATCH 1425/1482] rp1: clk: Rationalise the use of the + CLK_IS_CRITICAL flag + +The clock setup had been copied from clk-bcm2835 which had to cope +with the firmware having configured clocks, so there were flags +of CLK_IS_CRITICAL and CLK_IGNORE_UNUSED dotted around. + +That isn't the situation with RP1 where only the main PLLs, CLK_SYS, +and CLK_SLOW_SYS are critical, so update the configuration to match. + +Signed-off-by: Dave Stevenson +--- + drivers/clk/clk-rp1.c | 41 ++++++----------------------------------- + 1 file changed, 6 insertions(+), 35 deletions(-) + +--- a/drivers/clk/clk-rp1.c ++++ b/drivers/clk/clk-rp1.c +@@ -1504,8 +1504,6 @@ static const struct clk_ops rp1_varsrc_o + .round_rate = rp1_varsrc_round_rate, + }; + +-static bool rp1_clk_is_claimed(const char *name); +- + static struct clk_hw *rp1_register_pll_core(struct rp1_clockman *clockman, + const void *data) + { +@@ -1521,7 +1519,7 @@ static struct clk_hw *rp1_register_pll_c + init.num_parents = 1; + init.name = pll_core_data->name; + init.ops = &rp1_pll_core_ops; +- init.flags = pll_core_data->flags | CLK_IGNORE_UNUSED | CLK_IS_CRITICAL; ++ init.flags = pll_core_data->flags | CLK_IS_CRITICAL; + + pll_core = kzalloc(sizeof(*pll_core), GFP_KERNEL); + if (!pll_core) +@@ -1554,7 +1552,7 @@ static struct clk_hw *rp1_register_pll(s + init.num_parents = 1; + init.name = pll_data->name; + init.ops = &rp1_pll_ops; +- init.flags = pll_data->flags | CLK_IGNORE_UNUSED | CLK_IS_CRITICAL; ++ init.flags = pll_data->flags | CLK_IGNORE_UNUSED; + + pll = kzalloc(sizeof(*pll), GFP_KERNEL); + if (!pll) +@@ -1635,11 +1633,6 @@ static struct clk_hw *rp1_register_pll_d + divider->div.hw.init = &init; + divider->div.table = pll_sec_div_table; + +- if (!rp1_clk_is_claimed(divider_data->source_pll)) +- init.flags |= CLK_IS_CRITICAL; +- if (!rp1_clk_is_claimed(divider_data->name)) +- divider->div.flags |= CLK_IS_CRITICAL; +- + divider->clockman = clockman; + divider->data = divider_data; + +@@ -1861,6 +1854,8 @@ static const struct rp1_clk_desc clk_des + .max_freq = 200 * MHz, + .fc0_src = FC_NUM(0, 4), + .clk_src_mask = 0x3, ++ /* Always enabled in hardware */ ++ .flags = CLK_IS_CRITICAL, + ), + + [RP1_CLK_SLOW_SYS] = REGISTER_CLK( +@@ -1875,6 +1870,8 @@ static const struct rp1_clk_desc clk_des + .max_freq = 50 * MHz, + .fc0_src = FC_NUM(1, 4), + .clk_src_mask = 0x1, ++ /* Always enabled in hardware */ ++ .flags = CLK_IS_CRITICAL, + ), + + [RP1_CLK_UART] = REGISTER_CLK( +@@ -2394,24 +2391,6 @@ static const struct rp1_clk_desc clk_des + [RP1_CLK_MIPI1_DSI_BYTECLOCK] = REGISTER_VARSRC("clksrc_mipi1_dsi_byteclk"), + }; + +-static bool rp1_clk_claimed[ARRAY_SIZE(clk_desc_array)]; +- +-static bool rp1_clk_is_claimed(const char *name) +-{ +- unsigned int i; +- +- for (i = 0; i < ARRAY_SIZE(clk_desc_array); i++) { +- if (clk_desc_array[i].data) { +- const char *clk_name = *(const char **)(clk_desc_array[i].data); +- +- if (!strcmp(name, clk_name)) +- return rp1_clk_claimed[i]; +- } +- } +- +- return false; +-} +- + static int rp1_clk_probe(struct platform_device *pdev) + { + const struct rp1_clk_desc *desc; +@@ -2422,7 +2401,6 @@ static int rp1_clk_probe(struct platform + const size_t asize = ARRAY_SIZE(clk_desc_array); + u32 chip_id, platform; + unsigned int i; +- u32 clk_id; + int ret; + + clockman = devm_kzalloc(dev, struct_size(clockman, onecell.hws, asize), +@@ -2439,13 +2417,6 @@ static int rp1_clk_probe(struct platform + if (IS_ERR(clockman->regs)) + return PTR_ERR(clockman->regs); + +- memset(rp1_clk_claimed, 0, sizeof(rp1_clk_claimed)); +- for (i = 0; +- !of_property_read_u32_index(pdev->dev.of_node, "claim-clocks", +- i, &clk_id); +- i++) +- rp1_clk_claimed[clk_id] = true; +- + platform_set_drvdata(pdev, clockman); + + clockman->onecell.num = asize; diff --git a/target/linux/bcm27xx/patches-6.6/950-1426-dt-arm64-Fixup-RP1-ethernet-DT-configuration.patch b/target/linux/bcm27xx/patches-6.6/950-1426-dt-arm64-Fixup-RP1-ethernet-DT-configuration.patch new file mode 100644 index 00000000000000..ad6569e99ce50c --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1426-dt-arm64-Fixup-RP1-ethernet-DT-configuration.patch @@ -0,0 +1,50 @@ +From 0b4af929b7125abd3a262577b380c7c81ee9b1c5 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Mon, 11 Nov 2024 15:18:14 +0000 +Subject: [PATCH 1426/1482] dt: arm64: Fixup RP1 ethernet DT configuration + +Configure RP1's ethernet block to do the correct thing. +clk_eth is intended to be fixed at 125MHz, so use a new compatible, +and use assigned-clocks to configure the clock appropriately. + +Signed-off-by: Dave Stevenson +--- + arch/arm64/boot/dts/broadcom/rp1.dtsi | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +--- a/arch/arm64/boot/dts/broadcom/rp1.dtsi ++++ b/arch/arm64/boot/dts/broadcom/rp1.dtsi +@@ -24,6 +24,7 @@ + // RP1_PLL_VIDEO_CORE and dividers are now managed by VEC,DPI drivers + <&rp1_clocks RP1_PLL_SYS>, + <&rp1_clocks RP1_PLL_SYS_SEC>, ++ <&rp1_clocks RP1_CLK_ETH>, + <&rp1_clocks RP1_PLL_AUDIO>, + <&rp1_clocks RP1_PLL_AUDIO_SEC>, + <&rp1_clocks RP1_CLK_SYS>, +@@ -38,6 +39,7 @@ + <1536000000>, // RP1_PLL_AUDIO_CORE + <200000000>, // RP1_PLL_SYS + <125000000>, // RP1_PLL_SYS_SEC ++ <125000000>, // RP1_CLK_ETH + <61440000>, // RP1_PLL_AUDIO + <192000000>, // RP1_PLL_AUDIO_SEC + <200000000>, // RP1_CLK_SYS +@@ -968,12 +970,14 @@ + + rp1_eth: ethernet@100000 { + reg = <0xc0 0x40100000 0x0 0x4000>; +- compatible = "cdns,macb"; ++ compatible = "raspberrypi,rp1-gem", "cdns,macb"; + #address-cells = <1>; + #size-cells = <0>; + interrupts = ; +- clocks = <&macb_pclk &macb_hclk &rp1_clocks RP1_CLK_ETH_TSU>; +- clock-names = "pclk", "hclk", "tsu_clk"; ++ clocks = <&macb_pclk &macb_hclk ++ &rp1_clocks RP1_CLK_ETH_TSU ++ &rp1_clocks RP1_CLK_ETH>; ++ clock-names = "pclk", "hclk", "tsu_clk", "tx_clk"; + phy-mode = "rgmii-id"; + cdns,aw2w-max-pipe = /bits/ 8 <8>; + cdns,ar2r-max-pipe = /bits/ 8 <8>; diff --git a/target/linux/bcm27xx/patches-6.6/950-1427-clk-rp1-Add-RP1_CLK_DMA.patch b/target/linux/bcm27xx/patches-6.6/950-1427-clk-rp1-Add-RP1_CLK_DMA.patch new file mode 100644 index 00000000000000..9026cebaf95b31 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1427-clk-rp1-Add-RP1_CLK_DMA.patch @@ -0,0 +1,44 @@ +From d4e41ed9954fa86c4774f98d393aa401c81a68e7 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Wed, 13 Nov 2024 13:10:27 +0000 +Subject: [PATCH 1427/1482] clk: rp1: Add RP1_CLK_DMA. + +The DMA block has a clock, but wasn't defined in the driver. This +resulted in the parent being disabled as unused, and then DMA +stopped working. + +Signed-off-by: Dave Stevenson +--- + drivers/clk/clk-rp1.c | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) + +--- a/drivers/clk/clk-rp1.c ++++ b/drivers/clk/clk-rp1.c +@@ -1874,6 +1874,27 @@ static const struct rp1_clk_desc clk_des + .flags = CLK_IS_CRITICAL, + ), + ++ [RP1_CLK_DMA] = REGISTER_CLK( ++ .name = "clk_dma", ++ .parents = {"pll_sys_pri_ph", ++ "pll_video", ++ "xosc", ++ "clksrc_gp0", ++ "clksrc_gp1", ++ "clksrc_gp2", ++ "clksrc_gp3", ++ "clksrc_gp4", ++ "clksrc_gp5"}, ++ .num_std_parents = 0, ++ .num_aux_parents = 9, ++ .ctrl_reg = CLK_DMA_CTRL, ++ .div_int_reg = CLK_DMA_DIV_INT, ++ .sel_reg = CLK_DMA_SEL, ++ .div_int_max = DIV_INT_8BIT_MAX, ++ .max_freq = 100 * MHz, ++ .fc0_src = FC_NUM(2, 2), ++ ), ++ + [RP1_CLK_UART] = REGISTER_CLK( + .name = "clk_uart", + .parents = {"pll_sys_pri_ph", diff --git a/target/linux/bcm27xx/patches-6.6/950-1428-rp1-clk-Remove-CLK_IGNORE_UNUSED-flags.patch b/target/linux/bcm27xx/patches-6.6/950-1428-rp1-clk-Remove-CLK_IGNORE_UNUSED-flags.patch new file mode 100644 index 00000000000000..8fa06045a5734c --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1428-rp1-clk-Remove-CLK_IGNORE_UNUSED-flags.patch @@ -0,0 +1,59 @@ +From 9049e4df2c54b5e620f855f66db3a18c9f2e181f Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 8 Nov 2024 17:37:08 +0000 +Subject: [PATCH 1428/1482] rp1: clk: Remove CLK_IGNORE_UNUSED flags + +There should be no issue in disabling the RP1 clocks as long as +the kernel knows about all consumers. + +Signed-off-by: Dave Stevenson +--- + drivers/clk/clk-rp1.c | 9 ++++----- + 1 file changed, 4 insertions(+), 5 deletions(-) + +--- a/drivers/clk/clk-rp1.c ++++ b/drivers/clk/clk-rp1.c +@@ -1552,7 +1552,7 @@ static struct clk_hw *rp1_register_pll(s + init.num_parents = 1; + init.name = pll_data->name; + init.ops = &rp1_pll_ops; +- init.flags = pll_data->flags | CLK_IGNORE_UNUSED; ++ init.flags = pll_data->flags; + + pll = kzalloc(sizeof(*pll), GFP_KERNEL); + if (!pll) +@@ -1586,7 +1586,7 @@ static struct clk_hw *rp1_register_pll_p + init.num_parents = 1; + init.name = ph_data->name; + init.ops = &rp1_pll_ph_ops; +- init.flags = ph_data->flags | CLK_IGNORE_UNUSED; ++ init.flags = ph_data->flags; + + ph = kzalloc(sizeof(*ph), GFP_KERNEL); + if (!ph) +@@ -1619,7 +1619,7 @@ static struct clk_hw *rp1_register_pll_d + init.num_parents = 1; + init.name = divider_data->name; + init.ops = &rp1_pll_divider_ops; +- init.flags = divider_data->flags | CLK_IGNORE_UNUSED; ++ init.flags = divider_data->flags; + + divider = devm_kzalloc(clockman->dev, sizeof(*divider), GFP_KERNEL); + if (!divider) +@@ -1662,7 +1662,7 @@ static struct clk_hw *rp1_register_clock + init.num_parents = + clock_data->num_std_parents + clock_data->num_aux_parents; + init.name = clock_data->name; +- init.flags = clock_data->flags | CLK_IGNORE_UNUSED; ++ init.flags = clock_data->flags; + init.ops = &rp1_clk_ops; + + clock = devm_kzalloc(clockman->dev, sizeof(*clock), GFP_KERNEL); +@@ -1692,7 +1692,6 @@ static struct clk_hw *rp1_register_varsr + init.parent_names = &ref_clock; + init.num_parents = 1; + init.name = name; +- init.flags = CLK_IGNORE_UNUSED; + init.ops = &rp1_varsrc_ops; + + clock = devm_kzalloc(clockman->dev, sizeof(*clock), GFP_KERNEL); diff --git a/target/linux/bcm27xx/patches-6.6/950-1429-dt-rp1-Use-clk_sys-for-ethernet-hclk-and-pclk.patch b/target/linux/bcm27xx/patches-6.6/950-1429-dt-rp1-Use-clk_sys-for-ethernet-hclk-and-pclk.patch new file mode 100644 index 00000000000000..6d0eb133892ba2 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1429-dt-rp1-Use-clk_sys-for-ethernet-hclk-and-pclk.patch @@ -0,0 +1,45 @@ +From 542d0f7f2e9f90fc0f02f8cb141f7c3fbf46081b Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Mon, 11 Nov 2024 17:11:18 +0000 +Subject: [PATCH 1429/1482] dt: rp1: Use clk_sys for ethernet hclk and pclk + +hclk and pclk of the MAC are connected to clk_sys, so define +them as being connected accordingly, rather than having fake +fixed clocks for them. + +Signed-off-by: Dave Stevenson +--- + arch/arm64/boot/dts/broadcom/rp1.dtsi | 15 ++------------- + 1 file changed, 2 insertions(+), 13 deletions(-) + +--- a/arch/arm64/boot/dts/broadcom/rp1.dtsi ++++ b/arch/arm64/boot/dts/broadcom/rp1.dtsi +@@ -974,7 +974,8 @@ + #address-cells = <1>; + #size-cells = <0>; + interrupts = ; +- clocks = <&macb_pclk &macb_hclk ++ clocks = <&rp1_clocks RP1_CLK_SYS ++ &rp1_clocks RP1_CLK_SYS + &rp1_clocks RP1_CLK_ETH_TSU + &rp1_clocks RP1_CLK_ETH>; + clock-names = "pclk", "hclk", "tsu_clk", "tx_clk"; +@@ -1195,18 +1196,6 @@ + clock-output-names = "xosc"; + clock-frequency = <50000000>; + }; +- macb_pclk: macb_pclk { +- compatible = "fixed-clock"; +- #clock-cells = <0>; +- clock-output-names = "pclk"; +- clock-frequency = <200000000>; +- }; +- macb_hclk: macb_hclk { +- compatible = "fixed-clock"; +- #clock-cells = <0>; +- clock-output-names = "hclk"; +- clock-frequency = <200000000>; +- }; + sdio_src: sdio_src { + // 400 MHz on FPGA. PLL sys VCO on asic + compatible = "fixed-clock"; diff --git a/target/linux/bcm27xx/patches-6.6/950-1430-dt-rp1-Link-RP1-DMA-to-the-associated-clock.patch b/target/linux/bcm27xx/patches-6.6/950-1430-dt-rp1-Link-RP1-DMA-to-the-associated-clock.patch new file mode 100644 index 00000000000000..36d4f8b7236e35 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1430-dt-rp1-Link-RP1-DMA-to-the-associated-clock.patch @@ -0,0 +1,24 @@ +From efecbda4014b490e042c7fd090942b32316f9345 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Wed, 13 Nov 2024 13:11:33 +0000 +Subject: [PATCH 1430/1482] dt: rp1: Link RP1 DMA to the associated clock + +This makes the kernel representation of the clock structure +match reality. + +Signed-off-by: Dave Stevenson +--- + arch/arm64/boot/dts/broadcom/rp1.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/arm64/boot/dts/broadcom/rp1.dtsi ++++ b/arch/arm64/boot/dts/broadcom/rp1.dtsi +@@ -1061,7 +1061,7 @@ + reg = <0xc0 0x40188000 0x0 0x1000>; + compatible = "snps,axi-dma-1.01a"; + interrupts = ; +- clocks = <&sdhci_core &rp1_clocks RP1_CLK_SYS>; ++ clocks = <&rp1_clocks RP1_CLK_DMA &rp1_clocks RP1_CLK_SYS>; + clock-names = "core-clk", "cfgr-clk"; + + #dma-cells = <1>; diff --git a/target/linux/bcm27xx/patches-6.6/950-1456-drm-rp1-rp1-dpi-Add-interlaced-modes-and-PIO-program.patch b/target/linux/bcm27xx/patches-6.6/950-1456-drm-rp1-rp1-dpi-Add-interlaced-modes-and-PIO-program.patch new file mode 100644 index 00000000000000..bbaee270c52e68 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1456-drm-rp1-rp1-dpi-Add-interlaced-modes-and-PIO-program.patch @@ -0,0 +1,762 @@ +From 7735dd0736322cff23aff95490bae1d69937a9bf Mon Sep 17 00:00:00 2001 +From: Nick Hollinghurst +Date: Tue, 10 Dec 2024 13:23:09 +0000 +Subject: [PATCH 1456/1482] drm: rp1: rp1-dpi: Add interlaced modes and PIO + program to fix VSYNC + +Implement interlaced modes by wobbling the base pointer and VFP width +for every field. This results in correct pixels but incorrect VSYNC. + +Now use PIO to generate a fixed-up VSYNC by sampling DE and HSYNC. +This requires DPI's DE output to be mapped to GPIO1, which we check. + +When DE is not exposed, the internal fixup is disabled. VSYNC/GPIO2 +becomes a modified signal, designed to help an external device or +PIO program synthesize CSYNC or VSYNC. + +Signed-off-by: Nick Hollinghurst +--- + drivers/gpu/drm/rp1/rp1-dpi/Makefile | 2 +- + drivers/gpu/drm/rp1/rp1-dpi/rp1_dpi.c | 34 ++- + drivers/gpu/drm/rp1/rp1-dpi/rp1_dpi.h | 18 ++ + drivers/gpu/drm/rp1/rp1-dpi/rp1_dpi_hw.c | 253 ++++++++++++++++------ + drivers/gpu/drm/rp1/rp1-dpi/rp1_dpi_pio.c | 225 +++++++++++++++++++ + 5 files changed, 461 insertions(+), 71 deletions(-) + create mode 100644 drivers/gpu/drm/rp1/rp1-dpi/rp1_dpi_pio.c + +--- a/drivers/gpu/drm/rp1/rp1-dpi/Makefile ++++ b/drivers/gpu/drm/rp1/rp1-dpi/Makefile +@@ -1,5 +1,5 @@ + # SPDX-License-Identifier: GPL-2.0-only + +-drm-rp1-dpi-y := rp1_dpi.o rp1_dpi_hw.o rp1_dpi_cfg.o ++drm-rp1-dpi-y := rp1_dpi.o rp1_dpi_hw.o rp1_dpi_cfg.o rp1_dpi_pio.o + + obj-$(CONFIG_DRM_RP1_DPI) += drm-rp1-dpi.o +--- a/drivers/gpu/drm/rp1/rp1-dpi/rp1_dpi.c ++++ b/drivers/gpu/drm/rp1/rp1-dpi/rp1_dpi.c +@@ -80,6 +80,7 @@ static void rp1dpi_pipe_update(struct dr + if (dpi->dpi_running && + fb->format->format != dpi->cur_fmt) { + rp1dpi_hw_stop(dpi); ++ rp1dpi_pio_stop(dpi); + dpi->dpi_running = false; + } + if (!dpi->dpi_running) { +@@ -88,6 +89,7 @@ static void rp1dpi_pipe_update(struct dr + dpi->bus_fmt, + dpi->de_inv, + &pipe->crtc.state->mode); ++ rp1dpi_pio_start(dpi, &pipe->crtc.state->mode); + dpi->dpi_running = true; + } + dpi->cur_fmt = fb->format->format; +@@ -187,6 +189,7 @@ static void rp1dpi_pipe_disable(struct d + drm_crtc_vblank_off(&pipe->crtc); + if (dpi->dpi_running) { + rp1dpi_hw_stop(dpi); ++ rp1dpi_pio_stop(dpi); + dpi->dpi_running = false; + } + clk_disable_unprepare(dpi->clocks[RP1DPI_CLK_DPI]); +@@ -236,6 +239,7 @@ static void rp1dpi_stopall(struct drm_de + if (dpi->dpi_running || rp1dpi_hw_busy(dpi)) { + rp1dpi_hw_stop(dpi); + clk_disable_unprepare(dpi->clocks[RP1DPI_CLK_DPI]); ++ rp1dpi_pio_stop(dpi); + dpi->dpi_running = false; + } + rp1dpi_vidout_poweroff(dpi); +@@ -273,7 +277,7 @@ static int rp1dpi_platform_probe(struct + struct rp1_dpi *dpi; + struct drm_bridge *bridge = NULL; + struct drm_panel *panel; +- int i, ret; ++ int i, j, ret; + + dev_info(dev, __func__); + ret = drm_of_find_panel_or_bridge(pdev->dev.of_node, 0, 0, +@@ -295,6 +299,7 @@ static int rp1dpi_platform_probe(struct + return ret; + } + dpi->pdev = pdev; ++ spin_lock_init(&dpi->hw_lock); + + dpi->bus_fmt = default_bus_fmt; + ret = of_property_read_u32(dev->of_node, "default_bus_fmt", &dpi->bus_fmt); +@@ -332,6 +337,33 @@ static int rp1dpi_platform_probe(struct + if (ret) + goto done_err; + ++ /* Check if PIO can snoop on or override DPI's GPIO1 */ ++ dpi->gpio1_used = false; ++ for (i = 0; !dpi->gpio1_used; i++) { ++ u32 p = 0; ++ const char *str = NULL; ++ struct device_node *np1 = of_parse_phandle(dev->of_node, "pinctrl-0", i); ++ ++ if (!np1) ++ break; ++ ++ if (!of_property_read_string(np1, "function", &str) && !strcmp(str, "dpi")) { ++ for (j = 0; !dpi->gpio1_used; j++) { ++ if (of_property_read_string_index(np1, "pins", j, &str)) ++ break; ++ if (!strcmp(str, "gpio1")) ++ dpi->gpio1_used = true; ++ } ++ for (j = 0; !dpi->gpio1_used; j++) { ++ if (of_property_read_u32_index(np1, "brcm,pins", j, &p)) ++ break; ++ if (p == 1) ++ dpi->gpio1_used = true; ++ } ++ } ++ of_node_put(np1); ++ } ++ + /* Now we have all our resources, finish driver initialization */ + dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)); + init_completion(&dpi->finished); +--- a/drivers/gpu/drm/rp1/rp1-dpi/rp1_dpi.h ++++ b/drivers/gpu/drm/rp1/rp1-dpi/rp1_dpi.h +@@ -46,6 +46,18 @@ struct rp1_dpi { + bool de_inv, clk_inv; + bool dpi_running, pipe_enabled; + struct completion finished; ++ ++ /* Experimental stuff for interlace follows */ ++ struct rp1_pio_client *pio; ++ bool gpio1_used; ++ bool pio_stole_gpio2; ++ ++ spinlock_t hw_lock; /* the following are used in line-match ISR */ ++ dma_addr_t last_dma_addr; ++ u32 last_stride; ++ u32 shorter_front_porch; ++ bool interlaced; ++ bool lower_field_flag; + }; + + /* ---------------------------------------------------------------------- */ +@@ -67,3 +79,9 @@ void rp1dpi_hw_vblank_ctrl(struct rp1_dp + + void rp1dpi_vidout_setup(struct rp1_dpi *dpi, bool drive_negedge); + void rp1dpi_vidout_poweroff(struct rp1_dpi *dpi); ++ ++/* ---------------------------------------------------------------------- */ ++/* PIO control -- we need PIO to generate VSync (from DE) when interlaced */ ++ ++int rp1dpi_pio_start(struct rp1_dpi *dpi, const struct drm_display_mode *mode); ++void rp1dpi_pio_stop(struct rp1_dpi *dpi); +--- a/drivers/gpu/drm/rp1/rp1-dpi/rp1_dpi_hw.c ++++ b/drivers/gpu/drm/rp1/rp1-dpi/rp1_dpi_hw.c +@@ -202,7 +202,7 @@ + // Status + #define DPI_DMA_STATUS 0x3c + +-#define BITS(field, val) (((val) << (field ## _SHIFT)) & (field ## _MASK)) ++#define BITS(field, val) FIELD_PREP((field ## _MASK), val) + + static unsigned int rp1dpi_hw_read(struct rp1_dpi *dpi, unsigned int reg) + { +@@ -231,69 +231,73 @@ struct rp1dpi_ipixfmt { + u32 rgbsz; /* Shifts used for scaling; also (BPP/8-1) */ + }; + +-#define IMASK_RGB(r, g, b) (BITS(DPI_DMA_IMASK_R, r) | \ +- BITS(DPI_DMA_IMASK_G, g) | \ +- BITS(DPI_DMA_IMASK_B, b)) +-#define OMASK_RGB(r, g, b) (BITS(DPI_DMA_OMASK_R, r) | \ +- BITS(DPI_DMA_OMASK_G, g) | \ +- BITS(DPI_DMA_OMASK_B, b)) +-#define ISHIFT_RGB(r, g, b) (BITS(DPI_DMA_SHIFT_IR, r) | \ +- BITS(DPI_DMA_SHIFT_IG, g) | \ +- BITS(DPI_DMA_SHIFT_IB, b)) +-#define OSHIFT_RGB(r, g, b) (BITS(DPI_DMA_SHIFT_OR, r) | \ +- BITS(DPI_DMA_SHIFT_OG, g) | \ +- BITS(DPI_DMA_SHIFT_OB, b)) ++#define IMASK_RGB(r, g, b) (FIELD_PREP_CONST(DPI_DMA_IMASK_R_MASK, r) | \ ++ FIELD_PREP_CONST(DPI_DMA_IMASK_G_MASK, g) | \ ++ FIELD_PREP_CONST(DPI_DMA_IMASK_B_MASK, b)) ++#define OMASK_RGB(r, g, b) (FIELD_PREP_CONST(DPI_DMA_OMASK_R_MASK, r) | \ ++ FIELD_PREP_CONST(DPI_DMA_OMASK_G_MASK, g) | \ ++ FIELD_PREP_CONST(DPI_DMA_OMASK_B_MASK, b)) ++#define ISHIFT_RGB(r, g, b) (FIELD_PREP_CONST(DPI_DMA_SHIFT_IR_MASK, r) | \ ++ FIELD_PREP_CONST(DPI_DMA_SHIFT_IG_MASK, g) | \ ++ FIELD_PREP_CONST(DPI_DMA_SHIFT_IB_MASK, b)) ++#define OSHIFT_RGB(r, g, b) (FIELD_PREP_CONST(DPI_DMA_SHIFT_OR_MASK, r) | \ ++ FIELD_PREP_CONST(DPI_DMA_SHIFT_OG_MASK, g) | \ ++ FIELD_PREP_CONST(DPI_DMA_SHIFT_OB_MASK, b)) + + static const struct rp1dpi_ipixfmt my_formats[] = { + { + .format = DRM_FORMAT_XRGB8888, + .mask = IMASK_RGB(0x3fc, 0x3fc, 0x3fc), + .shift = ISHIFT_RGB(23, 15, 7), +- .rgbsz = BITS(DPI_DMA_RGBSZ_BPP, 3), ++ .rgbsz = FIELD_PREP_CONST(DPI_DMA_RGBSZ_BPP_MASK, 3), + }, + { + .format = DRM_FORMAT_XBGR8888, + .mask = IMASK_RGB(0x3fc, 0x3fc, 0x3fc), + .shift = ISHIFT_RGB(7, 15, 23), +- .rgbsz = BITS(DPI_DMA_RGBSZ_BPP, 3), ++ .rgbsz = FIELD_PREP_CONST(DPI_DMA_RGBSZ_BPP_MASK, 3), + }, + { + .format = DRM_FORMAT_ARGB8888, + .mask = IMASK_RGB(0x3fc, 0x3fc, 0x3fc), + .shift = ISHIFT_RGB(23, 15, 7), +- .rgbsz = BITS(DPI_DMA_RGBSZ_BPP, 3), ++ .rgbsz = FIELD_PREP_CONST(DPI_DMA_RGBSZ_BPP_MASK, 3), + }, + { + .format = DRM_FORMAT_ABGR8888, + .mask = IMASK_RGB(0x3fc, 0x3fc, 0x3fc), + .shift = ISHIFT_RGB(7, 15, 23), +- .rgbsz = BITS(DPI_DMA_RGBSZ_BPP, 3), ++ .rgbsz = FIELD_PREP_CONST(DPI_DMA_RGBSZ_BPP_MASK, 3), + }, + { + .format = DRM_FORMAT_RGB888, + .mask = IMASK_RGB(0x3fc, 0x3fc, 0x3fc), + .shift = ISHIFT_RGB(23, 15, 7), +- .rgbsz = BITS(DPI_DMA_RGBSZ_BPP, 2), ++ .rgbsz = FIELD_PREP_CONST(DPI_DMA_RGBSZ_BPP_MASK, 2), + }, + { + .format = DRM_FORMAT_BGR888, + .mask = IMASK_RGB(0x3fc, 0x3fc, 0x3fc), + .shift = ISHIFT_RGB(7, 15, 23), +- .rgbsz = BITS(DPI_DMA_RGBSZ_BPP, 2), ++ .rgbsz = FIELD_PREP_CONST(DPI_DMA_RGBSZ_BPP_MASK, 2), + }, + { + .format = DRM_FORMAT_RGB565, + .mask = IMASK_RGB(0x3e0, 0x3f0, 0x3e0), + .shift = ISHIFT_RGB(15, 10, 4), +- .rgbsz = BITS(DPI_DMA_RGBSZ_R, 5) | BITS(DPI_DMA_RGBSZ_G, 6) | +- BITS(DPI_DMA_RGBSZ_B, 5) | BITS(DPI_DMA_RGBSZ_BPP, 1), ++ .rgbsz = (FIELD_PREP_CONST(DPI_DMA_RGBSZ_R_MASK, 5) | ++ FIELD_PREP_CONST(DPI_DMA_RGBSZ_G_MASK, 6) | ++ FIELD_PREP_CONST(DPI_DMA_RGBSZ_B_MASK, 5) | ++ FIELD_PREP_CONST(DPI_DMA_RGBSZ_BPP_MASK, 1)), + }, + { + .format = DRM_FORMAT_BGR565, + .mask = IMASK_RGB(0x3e0, 0x3f0, 0x3e0), + .shift = ISHIFT_RGB(4, 10, 15), +- .rgbsz = BITS(DPI_DMA_RGBSZ_R, 5) | BITS(DPI_DMA_RGBSZ_G, 6) | +- BITS(DPI_DMA_RGBSZ_B, 5) | BITS(DPI_DMA_RGBSZ_BPP, 1), ++ .rgbsz = (FIELD_PREP_CONST(DPI_DMA_RGBSZ_R_MASK, 5) | ++ FIELD_PREP_CONST(DPI_DMA_RGBSZ_G_MASK, 6) | ++ FIELD_PREP_CONST(DPI_DMA_RGBSZ_B_MASK, 5) | ++ FIELD_PREP_CONST(DPI_DMA_RGBSZ_BPP_MASK, 1)), + } + }; + +@@ -354,42 +358,26 @@ void rp1dpi_hw_setup(struct rp1_dpi *dpi + u32 in_format, u32 bus_format, bool de_inv, + struct drm_display_mode const *mode) + { +- u32 shift, imask, omask, rgbsz; ++ u32 shift, imask, omask, rgbsz, vctrl; + int i; + +- pr_info("%s: in_fmt=\'%c%c%c%c\' bus_fmt=0x%x mode=%dx%d total=%dx%d %dkHz %cH%cV%cD%cC", +- __func__, in_format, in_format >> 8, in_format >> 16, in_format >> 24, bus_format, +- mode->hdisplay, mode->vdisplay, +- mode->htotal, mode->vtotal, +- mode->clock, +- (mode->flags & DRM_MODE_FLAG_NHSYNC) ? '-' : '+', +- (mode->flags & DRM_MODE_FLAG_NVSYNC) ? '-' : '+', +- de_inv ? '-' : '+', +- dpi->clk_inv ? '-' : '+'); ++ drm_info(&dpi->drm, ++ "in_fmt=\'%c%c%c%c\' bus_fmt=0x%x mode=%dx%d total=%dx%d%s %dkHz %cH%cV%cD%cC", ++ in_format, in_format >> 8, in_format >> 16, in_format >> 24, bus_format, ++ mode->hdisplay, mode->vdisplay, ++ mode->htotal, mode->vtotal, ++ (mode->flags & DRM_MODE_FLAG_INTERLACE) ? "i" : "", ++ mode->clock, ++ (mode->flags & DRM_MODE_FLAG_NHSYNC) ? '-' : '+', ++ (mode->flags & DRM_MODE_FLAG_NVSYNC) ? '-' : '+', ++ de_inv ? '-' : '+', ++ dpi->clk_inv ? '-' : '+'); + + /* + * Configure all DPI/DMA block registers, except base address. + * DMA will not actually start until a FB base address is specified + * using rp1dpi_hw_update(). + */ +- rp1dpi_hw_write(dpi, DPI_DMA_VISIBLE_AREA, +- BITS(DPI_DMA_VISIBLE_AREA_ROWSM1, mode->vdisplay - 1) | +- BITS(DPI_DMA_VISIBLE_AREA_COLSM1, mode->hdisplay - 1)); +- +- rp1dpi_hw_write(dpi, DPI_DMA_SYNC_WIDTH, +- BITS(DPI_DMA_SYNC_WIDTH_ROWSM1, mode->vsync_end - mode->vsync_start - 1) | +- BITS(DPI_DMA_SYNC_WIDTH_COLSM1, mode->hsync_end - mode->hsync_start - 1)); +- +- /* In these registers, "back porch" time includes sync width */ +- rp1dpi_hw_write(dpi, DPI_DMA_BACK_PORCH, +- BITS(DPI_DMA_BACK_PORCH_ROWSM1, mode->vtotal - mode->vsync_start - 1) | +- BITS(DPI_DMA_BACK_PORCH_COLSM1, mode->htotal - mode->hsync_start - 1)); +- +- rp1dpi_hw_write(dpi, DPI_DMA_FRONT_PORCH, +- BITS(DPI_DMA_FRONT_PORCH_ROWSM1, mode->vsync_start - mode->vdisplay - 1) | +- BITS(DPI_DMA_FRONT_PORCH_COLSM1, mode->hsync_start - mode->hdisplay - 1)); +- +- /* Input to output pixel format conversion */ + for (i = 0; i < ARRAY_SIZE(my_formats); ++i) { + if (my_formats[i].format == in_format) + break; +@@ -417,6 +405,89 @@ void rp1dpi_hw_setup(struct rp1_dpi *dpi + BITS(DPI_DMA_QOS_LLEV, 0x8) | + BITS(DPI_DMA_QOS_LQOS, 0x7)); + ++ if (!(mode->flags & DRM_MODE_FLAG_INTERLACE)) { ++ rp1dpi_hw_write(dpi, DPI_DMA_VISIBLE_AREA, ++ BITS(DPI_DMA_VISIBLE_AREA_ROWSM1, mode->vdisplay - 1) | ++ BITS(DPI_DMA_VISIBLE_AREA_COLSM1, mode->hdisplay - 1)); ++ ++ rp1dpi_hw_write(dpi, DPI_DMA_SYNC_WIDTH, ++ BITS(DPI_DMA_SYNC_WIDTH_ROWSM1, ++ mode->vsync_end - mode->vsync_start - 1) | ++ BITS(DPI_DMA_SYNC_WIDTH_COLSM1, ++ mode->hsync_end - mode->hsync_start - 1)); ++ ++ /* In these registers, "back porch" time includes sync width */ ++ rp1dpi_hw_write(dpi, DPI_DMA_BACK_PORCH, ++ BITS(DPI_DMA_BACK_PORCH_ROWSM1, ++ mode->vtotal - mode->vsync_start - 1) | ++ BITS(DPI_DMA_BACK_PORCH_COLSM1, ++ mode->htotal - mode->hsync_start - 1)); ++ ++ rp1dpi_hw_write(dpi, DPI_DMA_FRONT_PORCH, ++ BITS(DPI_DMA_FRONT_PORCH_ROWSM1, ++ mode->vsync_start - mode->vdisplay - 1) | ++ BITS(DPI_DMA_FRONT_PORCH_COLSM1, ++ mode->hsync_start - mode->hdisplay - 1)); ++ ++ vctrl = BITS(DPI_DMA_CONTROL_VSYNC_POL, !!(mode->flags & DRM_MODE_FLAG_NVSYNC)) | ++ BITS(DPI_DMA_CONTROL_VBP_EN, (mode->vtotal != mode->vsync_start)) | ++ BITS(DPI_DMA_CONTROL_VFP_EN, (mode->vsync_start != mode->vdisplay)) | ++ BITS(DPI_DMA_CONTROL_VSYNC_EN, (mode->vsync_end != mode->vsync_start)); ++ ++ dpi->interlaced = false; ++ } else { ++ /* ++ * Experimental interlace support ++ * ++ * RP1 DPI hardware wasn't designed to support interlace, but lets us change ++ * both the VFP line count and the next DMA address while running. That allows ++ * pixel data to be correctly timed for interlace, but VSYNC remains wrong. ++ * ++ * It is necessary to use external hardware (such as PIO) to regenerate VSYNC ++ * based on HSYNC, DE (which *must* both be mapped to GPIOs 1, 3 respectively). ++ * This driver includes a PIO program to do that, when DE is enabled. ++ * ++ * An alternative fixup is to synthesize CSYNC from HSYNC and modified-VSYNC. ++ * We don't implement that here, but to facilitate it, DPI's VSYNC is replaced ++ * by a "helper signal" that pulses low for 1 or 2 scan-lines, starting 2.0 or ++ * 2.5 scan-lines respectively before nominal VSYNC start. ++ */ ++ int vact = mode->vdisplay >> 1; /* visible lines per field. Can't do half-lines */ ++ int vtot0 = mode->vtotal >> 1; /* vtotal should always be odd when interlaced. */ ++ int vfp0 = (mode->vsync_start >= mode->vdisplay + 4) ? ++ ((mode->vsync_start - mode->vdisplay - 2) >> 1) : 1; ++ int vbp = max(0, vtot0 - vact - vfp0); ++ ++ rp1dpi_hw_write(dpi, DPI_DMA_VISIBLE_AREA, ++ BITS(DPI_DMA_VISIBLE_AREA_ROWSM1, vact - 1) | ++ BITS(DPI_DMA_VISIBLE_AREA_COLSM1, mode->hdisplay - 1)); ++ ++ rp1dpi_hw_write(dpi, DPI_DMA_SYNC_WIDTH, ++ BITS(DPI_DMA_SYNC_WIDTH_ROWSM1, vtot0 - 2) | ++ BITS(DPI_DMA_SYNC_WIDTH_COLSM1, ++ mode->hsync_end - mode->hsync_start - 1)); ++ ++ rp1dpi_hw_write(dpi, DPI_DMA_BACK_PORCH, ++ BITS(DPI_DMA_BACK_PORCH_ROWSM1, vbp - 1) | ++ BITS(DPI_DMA_BACK_PORCH_COLSM1, ++ mode->htotal - mode->hsync_start - 1)); ++ ++ dpi->shorter_front_porch = ++ BITS(DPI_DMA_FRONT_PORCH_ROWSM1, vfp0 - 1) | ++ BITS(DPI_DMA_FRONT_PORCH_COLSM1, ++ mode->hsync_start - mode->hdisplay - 1); ++ rp1dpi_hw_write(dpi, DPI_DMA_FRONT_PORCH, dpi->shorter_front_porch); ++ ++ vctrl = BITS(DPI_DMA_CONTROL_VSYNC_POL, 0) | ++ BITS(DPI_DMA_CONTROL_VBP_EN, (vbp > 0)) | ++ BITS(DPI_DMA_CONTROL_VFP_EN, 1) | ++ BITS(DPI_DMA_CONTROL_VSYNC_EN, 1); ++ ++ dpi->interlaced = true; ++ } ++ dpi->lower_field_flag = false; ++ dpi->last_dma_addr = 0; ++ + rp1dpi_hw_write(dpi, DPI_DMA_IRQ_FLAGS, -1); + rp1dpi_hw_vblank_ctrl(dpi, 1); + +@@ -425,49 +496,64 @@ void rp1dpi_hw_setup(struct rp1_dpi *dpi + pr_warn("%s: Unexpectedly busy at start!", __func__); + + rp1dpi_hw_write(dpi, DPI_DMA_CONTROL, ++ vctrl | + BITS(DPI_DMA_CONTROL_ARM, !i) | + BITS(DPI_DMA_CONTROL_AUTO_REPEAT, 1) | + BITS(DPI_DMA_CONTROL_HIGH_WATER, 448) | + BITS(DPI_DMA_CONTROL_DEN_POL, de_inv) | + BITS(DPI_DMA_CONTROL_HSYNC_POL, !!(mode->flags & DRM_MODE_FLAG_NHSYNC)) | +- BITS(DPI_DMA_CONTROL_VSYNC_POL, !!(mode->flags & DRM_MODE_FLAG_NVSYNC)) | +- BITS(DPI_DMA_CONTROL_COLORM, 0) | +- BITS(DPI_DMA_CONTROL_SHUTDN, 0) | + BITS(DPI_DMA_CONTROL_HBP_EN, (mode->htotal != mode->hsync_end)) | + BITS(DPI_DMA_CONTROL_HFP_EN, (mode->hsync_start != mode->hdisplay)) | +- BITS(DPI_DMA_CONTROL_VBP_EN, (mode->vtotal != mode->vsync_end)) | +- BITS(DPI_DMA_CONTROL_VFP_EN, (mode->vsync_start != mode->vdisplay)) | +- BITS(DPI_DMA_CONTROL_HSYNC_EN, (mode->hsync_end != mode->hsync_start)) | +- BITS(DPI_DMA_CONTROL_VSYNC_EN, (mode->vsync_end != mode->vsync_start))); ++ BITS(DPI_DMA_CONTROL_HSYNC_EN, (mode->hsync_end != mode->hsync_start))); + } + + void rp1dpi_hw_update(struct rp1_dpi *dpi, dma_addr_t addr, u32 offset, u32 stride) + { +- u64 a = addr + offset; ++ unsigned long flags; ++ ++ spin_lock_irqsave(&dpi->hw_lock, flags); + + /* + * Update STRIDE, DMAH and DMAL only. When called after rp1dpi_hw_setup(), + * DMA starts immediately; if already running, the buffer will flip at +- * the next vertical sync event. ++ * the next vertical sync event. In interlaced mode, we need to adjust ++ * the address and stride to display only the current field, saving ++ * the original address (so it can be flipped for subsequent fields). + */ ++ addr += offset; ++ dpi->last_dma_addr = addr; ++ dpi->last_stride = stride; ++ if (dpi->interlaced) { ++ if (dpi->lower_field_flag) ++ addr += stride; ++ stride *= 2; ++ } + rp1dpi_hw_write(dpi, DPI_DMA_DMA_STRIDE, stride); +- rp1dpi_hw_write(dpi, DPI_DMA_DMA_ADDR_H, a >> 32); +- rp1dpi_hw_write(dpi, DPI_DMA_DMA_ADDR_L, a & 0xFFFFFFFFu); ++ rp1dpi_hw_write(dpi, DPI_DMA_DMA_ADDR_H, addr >> 32); ++ rp1dpi_hw_write(dpi, DPI_DMA_DMA_ADDR_L, addr & 0xFFFFFFFFu); ++ ++ spin_unlock_irqrestore(&dpi->hw_lock, flags); + } + + void rp1dpi_hw_stop(struct rp1_dpi *dpi) + { + u32 ctrl; ++ unsigned long flags; + + /* +- * Stop DMA by turning off the Auto-Repeat flag, and wait up to 100ms for +- * the current and any queued frame to end. "Force drain" flags are not used, +- * as they seem to prevent DMA from re-starting properly; it's safer to wait. ++ * Stop DMA by turning off Auto-Repeat (and disable S/W field-flip), ++ * then wait up to 100ms for the current and any queued frame to end. ++ * (There is a "force drain" flag, but it can leave DPI in a broken ++ * state which prevents it from restarting; it's safer to wait.) + */ ++ spin_lock_irqsave(&dpi->hw_lock, flags); ++ dpi->last_dma_addr = 0; + reinit_completion(&dpi->finished); + ctrl = rp1dpi_hw_read(dpi, DPI_DMA_CONTROL); + ctrl &= ~(DPI_DMA_CONTROL_ARM_MASK | DPI_DMA_CONTROL_AUTO_REPEAT_MASK); + rp1dpi_hw_write(dpi, DPI_DMA_CONTROL, ctrl); ++ spin_unlock_irqrestore(&dpi->hw_lock, flags); ++ + if (!wait_for_completion_timeout(&dpi->finished, HZ / 10)) + drm_err(&dpi->drm, "%s: timed out waiting for idle\n", __func__); + rp1dpi_hw_write(dpi, DPI_DMA_IRQ_EN, 0); +@@ -476,10 +562,11 @@ void rp1dpi_hw_stop(struct rp1_dpi *dpi) + void rp1dpi_hw_vblank_ctrl(struct rp1_dpi *dpi, int enable) + { + rp1dpi_hw_write(dpi, DPI_DMA_IRQ_EN, +- BITS(DPI_DMA_IRQ_EN_AFIFO_EMPTY, 1) | +- BITS(DPI_DMA_IRQ_EN_UNDERFLOW, 1) | +- BITS(DPI_DMA_IRQ_EN_DMA_READY, !!enable) | +- BITS(DPI_DMA_IRQ_EN_MATCH_LINE, 4095)); ++ BITS(DPI_DMA_IRQ_EN_AFIFO_EMPTY, 1) | ++ BITS(DPI_DMA_IRQ_EN_UNDERFLOW, 1) | ++ BITS(DPI_DMA_IRQ_EN_DMA_READY, !!enable) | ++ BITS(DPI_DMA_IRQ_EN_MATCH, dpi->interlaced) | ++ BITS(DPI_DMA_IRQ_EN_MATCH_LINE, 32)); + } + + irqreturn_t rp1dpi_hw_isr(int irq, void *dev) +@@ -498,7 +585,35 @@ irqreturn_t rp1dpi_hw_isr(int irq, void + drm_crtc_handle_vblank(&dpi->pipe.crtc); + if (u & DPI_DMA_IRQ_FLAGS_AFIFO_EMPTY_MASK) + complete(&dpi->finished); ++ ++ /* ++ * Added for interlace support: We use this mid-frame interrupt to ++ * wobble the VFP between fields, re-submitting the next-buffer address ++ * with an offset to display the opposite field. NB: rp1dpi_hw_update() ++ * may be called at any time, before or after, so locking is needed. ++ * H/W Auto-update is no longer needed (unless this IRQ is lost). ++ */ ++ if ((u & DPI_DMA_IRQ_FLAGS_MATCH_MASK) && dpi->interlaced) { ++ unsigned long flags; ++ dma_addr_t a; ++ ++ spin_lock_irqsave(&dpi->hw_lock, flags); ++ dpi->lower_field_flag = !dpi->lower_field_flag; ++ rp1dpi_hw_write(dpi, DPI_DMA_FRONT_PORCH, ++ dpi->shorter_front_porch + ++ BITS(DPI_DMA_FRONT_PORCH_ROWSM1, ++ dpi->lower_field_flag)); ++ a = dpi->last_dma_addr; ++ if (a) { ++ if (dpi->lower_field_flag) ++ a += dpi->last_stride; ++ rp1dpi_hw_write(dpi, DPI_DMA_DMA_ADDR_H, a >> 32); ++ rp1dpi_hw_write(dpi, DPI_DMA_DMA_ADDR_L, a & 0xFFFFFFFFu); ++ } ++ spin_unlock_irqrestore(&dpi->hw_lock, flags); ++ } + } + } ++ + return u ? IRQ_HANDLED : IRQ_NONE; + } +--- /dev/null ++++ b/drivers/gpu/drm/rp1/rp1-dpi/rp1_dpi_pio.c +@@ -0,0 +1,225 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * PIO code for Raspberry Pi RP1 DPI driver ++ * ++ * Copyright (c) 2024 Raspberry Pi Limited. ++ */ ++ ++/* ++ * Use PIO to fix up VSYNC for interlaced modes. ++ * ++ * For this to work we *require* DPI's pinctrl to enable DE on GPIO1. ++ * PIO can then snoop on HSYNC and DE pins to generate corrected VSYNC. ++ * ++ * Note that corrected VSYNC outputs will not be synchronous to DPICLK, ++ * will lag HSYNC by about 30ns and may suffer up to 5ns of jitter. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "rp1_dpi.h" ++ ++/* ++ * Start a PIO SM to generate an interrupt just after HSYNC onset, then another ++ * after a fixed delay (during which we assume HSYNC will have been deasserted). ++ */ ++ ++static int rp1dpi_pio_start_timer_both(struct rp1_dpi *dpi, u32 flags, u32 tc) ++{ ++ static const u16 instructions[2][5] = { ++ { 0xa022, 0x2083, 0xc001, 0x0043, 0xc001 }, /* posedge */ ++ { 0xa022, 0x2003, 0xc001, 0x0043, 0xc001 }, /* negedge */ ++ }; ++ const struct pio_program prog = { ++ .instructions = instructions[(flags & DRM_MODE_FLAG_NHSYNC) ? 1 : 0], ++ .length = ARRAY_SIZE(instructions[0]), ++ .origin = -1 ++ }; ++ int offset, sm; ++ ++ sm = pio_claim_unused_sm(dpi->pio, true); ++ if (sm < 0) ++ return -EBUSY; ++ ++ offset = pio_add_program(dpi->pio, &prog); ++ if (offset == PIO_ORIGIN_ANY) ++ return -EBUSY; ++ ++ pio_sm_config cfg = pio_get_default_sm_config(); ++ ++ pio_sm_set_enabled(dpi->pio, sm, false); ++ sm_config_set_wrap(&cfg, offset, offset + 4); ++ pio_sm_init(dpi->pio, sm, offset, &cfg); ++ ++ pio_sm_put(dpi->pio, sm, tc - 4); ++ pio_sm_exec(dpi->pio, sm, pio_encode_pull(false, false)); ++ pio_sm_exec(dpi->pio, sm, pio_encode_out(pio_y, 32)); ++ pio_sm_set_enabled(dpi->pio, sm, true); ++ ++ return 0; ++} ++ ++/* ++ * Snoop on DE, HSYNC to count half-lines in the vertical blanking interval ++ * to determine when the VSYNC pulse should start and finish. Then, at a ++ * suitable moment (which should be an odd number of half-lines since the ++ * last active line), sample DE again to detect field phase. ++ * ++ * This version assumes VFP length is within 2..129 half-lines for any field ++ * (one half-line delay is needed to sample DE; we always wait for the next ++ * half-line boundary to improve VSync start accuracy). ++ */ ++ ++static int rp1dpi_pio_vsync_ilace(struct rp1_dpi *dpi, ++ struct drm_display_mode const *mode) ++{ ++ static const int wrap_target = 14; ++ static const int wrap = 26; ++ u16 instructions[] = { /* This is mutable */ ++ 0xa0e6, // 0: mov osr, isr side 0 ; top: rewind parameters ++ 0x2081, // 1: wait 1 gpio, 1 side 0 ; main: while (!DE) wait; ++ 0x2783, // 2: wait 1 gpio, 3 side 0 [7] ; do { @HSync ++ 0xc041, // 3: irq clear 1 side 0 ; flush stale IRQs ++ 0x20c1, // 4: wait 1 irq, 1 side 0 ; @midline ++ 0x00c1, // 5: jmp pin, 1 side 0 ; } while (DE) ++ 0x0007, // 6: jmp 7 side 0 ; ++ 0x6027, // 7: out x, 7 side 0 ; x = VFPlen - 2 ++ 0x000a, // 8: jmp 10 side 0 ; while (x--) { ++ 0x20c1, // 9: wait 1 irq, 1 side 0 ; @halfline ++ 0x0049, // 10: jmp x--, 9 side 0 ; } ++ 0x6021, // 11: out x, 1 side 0 ; test for aligned case ++ 0x003a, // 12: jmp !x, 26 side 0 ; if (!x) goto precise; ++ 0x20c1, // 13: wait 1 irq, 1 side 0 ; @halfline ++ // .wrap_target ; vsjoin: ++ 0xb722, // 14: mov x, y side 1 [7] ; VSYNC=1; x = VSyncLen ++ 0xd041, // 15: irq clear 1 side 1 ; VSYNC=1; flush stale IRQs ++ 0x30c1, // 16: wait 1 irq, 1 side 1 ; VSYNC=1; do { @halfline ++ 0x1050, // 17: jmp x--, 16 side 1 ; VSYNC=1; } while (x--) ++ 0x6028, // 18: out x, 8 side 0 ; VSYNC=0; x = VBPLen ++ 0x0015, // 19: jmp 21 side 0 ; while (x--) { ++ 0x20c1, // 20: wait 1 irq, 1 side 0 ; @halfline ++ 0x0054, // 21: jmp x--, 20 side 0 ; } ++ 0x00c0, // 22: jmp pin, 0 side 0 ; if (DE) reset phase ++ 0x0018, // 23: jmp 24 side 0 ; ++ 0x00e1, // 24: jmp !osre, 1 side 0 ; if (!phase) goto main ++ 0x0000, // 25: jmp 0 side 0 ; goto top ++ 0x2083, // 26: wait 1 gpio, 3 side 0 ; precise: @HSync ++ // .wrap ; goto vsjoin ++ }; ++ struct pio_program prog = { ++ .instructions = instructions, ++ .length = ARRAY_SIZE(instructions), ++ .origin = -1 ++ }; ++ pio_sm_config cfg = pio_get_default_sm_config(); ++ unsigned int i, offset; ++ u32 tc, vfp, vbp; ++ u32 sysclk = clock_get_hz(clk_sys); ++ int sm = pio_claim_unused_sm(dpi->pio, true); ++ ++ if (sm < 0) ++ return -EBUSY; ++ ++ /* Compute mid-line time constant and start the timer SM */ ++ tc = (mode->htotal * (u64)sysclk) / (u64)(2000u * mode->clock); ++ if (rp1dpi_pio_start_timer_both(dpi, mode->flags, tc) < 0) { ++ pio_sm_unclaim(dpi->pio, sm); ++ return -EBUSY; ++ } ++ ++ /* Adapt program code according to DE and Sync polarity; configure program */ ++ pio_sm_set_enabled(dpi->pio, sm, false); ++ if (dpi->de_inv) { ++ instructions[1] ^= 0x0080; ++ instructions[5] = 0x00c7; ++ instructions[6] = 0x0001; ++ instructions[22] = 0x00d8; ++ instructions[23] = 0x0000; ++ } ++ for (i = 0; i < ARRAY_SIZE(instructions); i++) { ++ if (mode->flags & DRM_MODE_FLAG_NVSYNC) ++ instructions[i] ^= 0x1000; ++ if ((mode->flags & DRM_MODE_FLAG_NHSYNC) && (instructions[i] & 0xe07f) == 0x2003) ++ instructions[i] ^= 0x0080; ++ } ++ offset = pio_add_program(dpi->pio, &prog); ++ if (offset == PIO_ORIGIN_ANY) ++ return -EBUSY; ++ ++ /* Configure pins and SM */ ++ dpi->pio_stole_gpio2 = true; ++ sm_config_set_wrap(&cfg, offset + wrap_target, offset + wrap); ++ sm_config_set_sideset(&cfg, 1, false, false); ++ sm_config_set_sideset_pins(&cfg, 2); ++ pio_gpio_init(dpi->pio, 2); ++ sm_config_set_jmp_pin(&cfg, 1); /* "DE" is always GPIO1 */ ++ pio_sm_init(dpi->pio, sm, offset, &cfg); ++ pio_sm_set_consecutive_pindirs(dpi->pio, sm, 2, 1, true); ++ ++ /* Compute vertical times, remembering how we rounded vdisplay, vtotal */ ++ vfp = mode->vsync_start - (mode->vdisplay & ~1); ++ vbp = (mode->vtotal | 1) - mode->vsync_end; ++ if (vfp > 128) { ++ vbp += vfp - 128; ++ vfp = 128; ++ } else if (vfp < 3) { ++ vbp = (vbp > 3 - vfp) ? (vbp - 3 + vfp) : 0; ++ vfp = 3; ++ } ++ ++ pio_sm_put(dpi->pio, sm, ++ (vfp - 2) + ((vfp & 1) << 7) + (vbp << 8) + ++ ((vfp - 3) << 16) + (((~vfp) & 1) << 23) + ((vbp + 1) << 24)); ++ pio_sm_put(dpi->pio, sm, mode->vsync_end - mode->vsync_start - 1); ++ pio_sm_exec(dpi->pio, sm, pio_encode_pull(false, false)); ++ pio_sm_exec(dpi->pio, sm, pio_encode_out(pio_y, 32)); ++ pio_sm_exec(dpi->pio, sm, pio_encode_in(pio_y, 32)); ++ pio_sm_exec(dpi->pio, sm, pio_encode_pull(false, false)); ++ pio_sm_exec(dpi->pio, sm, pio_encode_out(pio_y, 32)); ++ pio_sm_set_enabled(dpi->pio, sm, true); ++ ++ return 0; ++} ++ ++int rp1dpi_pio_start(struct rp1_dpi *dpi, const struct drm_display_mode *mode) ++{ ++ int r; ++ ++ if (!(mode->flags & DRM_MODE_FLAG_INTERLACE) || !dpi->gpio1_used) ++ return 0; ++ ++ if (dpi->pio) ++ pio_close(dpi->pio); ++ ++ dpi->pio = pio_open(); ++ if (IS_ERR(dpi->pio)) { ++ drm_err(&dpi->drm, "Could not open PIO\n"); ++ dpi->pio = NULL; ++ return -ENODEV; ++ } ++ ++ r = rp1dpi_pio_vsync_ilace(dpi, mode); ++ if (r) { ++ drm_err(&dpi->drm, "Failed to initialize PIO\n"); ++ rp1dpi_pio_stop(dpi); ++ } ++ ++ return r; ++} ++ ++void rp1dpi_pio_stop(struct rp1_dpi *dpi) ++{ ++ if (dpi->pio) { ++ if (dpi->pio_stole_gpio2) ++ pio_gpio_set_function(dpi->pio, 2, GPIO_FUNC_FSEL1); ++ pio_close(dpi->pio); ++ dpi->pio_stole_gpio2 = false; ++ dpi->pio = NULL; ++ } ++} diff --git a/target/linux/bcm27xx/patches-6.6/950-1457-pwm-Improve-PWM_PIO_RP1-dependencies.patch b/target/linux/bcm27xx/patches-6.6/950-1457-pwm-Improve-PWM_PIO_RP1-dependencies.patch new file mode 100644 index 00000000000000..357cd05dc88d12 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1457-pwm-Improve-PWM_PIO_RP1-dependencies.patch @@ -0,0 +1,22 @@ +From f85f3509692f966ec32e4db499f7e64dc6b6b952 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 12 Dec 2024 10:09:13 +0000 +Subject: [PATCH 1457/1482] pwm: Improve PWM_PIO_RP1 dependencies + +PWM_PIO_RP1 should select RP1_PIO, as it is useless without it. + +Signed-off-by: Phil Elwell +--- + drivers/pwm/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/pwm/Kconfig ++++ b/drivers/pwm/Kconfig +@@ -457,6 +457,7 @@ config PWM_PCA9685 + config PWM_PIO_RP1 + tristate "RP1 PIO PWM support" + depends on FIRMWARE_RP1 || COMPILE_TEST ++ select RP1_PIO + help + This is a PWM framework driver for Raspberry Pi 5, using the PIO + hardware of RP1 to provide PWM functionality. Supports up to 4 diff --git a/target/linux/bcm27xx/patches-6.6/950-1458-Revert-pwm-Improve-PWM_PIO_RP1-dependencies.patch b/target/linux/bcm27xx/patches-6.6/950-1458-Revert-pwm-Improve-PWM_PIO_RP1-dependencies.patch new file mode 100644 index 00000000000000..eabf3887d14c66 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1458-Revert-pwm-Improve-PWM_PIO_RP1-dependencies.patch @@ -0,0 +1,20 @@ +From 73fb1e979a210094935f4af4c3d6e700fba30c5f Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 12 Dec 2024 10:28:54 +0000 +Subject: [PATCH 1458/1482] Revert "pwm: Improve PWM_PIO_RP1 dependencies" + +This reverts commit f85f3509692f966ec32e4db499f7e64dc6b6b952. +--- + drivers/pwm/Kconfig | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/pwm/Kconfig ++++ b/drivers/pwm/Kconfig +@@ -457,7 +457,6 @@ config PWM_PCA9685 + config PWM_PIO_RP1 + tristate "RP1 PIO PWM support" + depends on FIRMWARE_RP1 || COMPILE_TEST +- select RP1_PIO + help + This is a PWM framework driver for Raspberry Pi 5, using the PIO + hardware of RP1 to provide PWM functionality. Supports up to 4 diff --git a/target/linux/bcm27xx/patches-6.6/950-1463-drm-rp1-rp1-dpi-Fix-optional-dependency-on-RP1_PIO.patch b/target/linux/bcm27xx/patches-6.6/950-1463-drm-rp1-rp1-dpi-Fix-optional-dependency-on-RP1_PIO.patch new file mode 100644 index 00000000000000..52e87daa386ad9 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1463-drm-rp1-rp1-dpi-Fix-optional-dependency-on-RP1_PIO.patch @@ -0,0 +1,99 @@ +From 80533a952218696c0ef1b346bab50dc401e6b74c Mon Sep 17 00:00:00 2001 +From: Nick Hollinghurst +Date: Thu, 12 Dec 2024 11:58:12 +0000 +Subject: [PATCH 1463/1482] drm: rp1: rp1-dpi: Fix optional dependency on + RP1_PIO + +Add optional dependency to Kconfig, and conditionally compile +PIO-dependent code. Add a mode validation function to reject +interlaced modes when RP1_PIO is not present. + +Signed-off-by: Nick Hollinghurst +--- + drivers/gpu/drm/rp1/rp1-dpi/Kconfig | 7 ++++++- + drivers/gpu/drm/rp1/rp1-dpi/rp1_dpi.c | 16 ++++++++++++++++ + drivers/gpu/drm/rp1/rp1-dpi/rp1_dpi_pio.c | 18 +++++++++++++++++- + 3 files changed, 39 insertions(+), 2 deletions(-) + +--- a/drivers/gpu/drm/rp1/rp1-dpi/Kconfig ++++ b/drivers/gpu/drm/rp1/rp1-dpi/Kconfig +@@ -7,5 +7,10 @@ config DRM_RP1_DPI + select DRM_VRAM_HELPER + select DRM_TTM + select DRM_TTM_HELPER ++ depends on RP1_PIO || !RP1_PIO + help +- Choose this option to enable Video Out on RP1 ++ Choose this option to enable DPI output on Raspberry Pi RP1 ++ ++ There is an optional dependency on RP1_PIO, as the PIO block ++ must be used to fix up interlaced sync. Interlaced DPI modes ++ will be unavailable when RP1_PIO is not selected. +--- a/drivers/gpu/drm/rp1/rp1-dpi/rp1_dpi.c ++++ b/drivers/gpu/drm/rp1/rp1-dpi/rp1_dpi.c +@@ -217,12 +217,28 @@ static void rp1dpi_pipe_disable_vblank(s + rp1dpi_hw_vblank_ctrl(dpi, 0); + } + ++static enum drm_mode_status rp1dpi_pipe_mode_valid(struct drm_simple_display_pipe *pipe, ++ const struct drm_display_mode *mode) ++{ ++#if !IS_REACHABLE(CONFIG_RP1_PIO) ++ if (mode->flags & DRM_MODE_FLAG_INTERLACE) ++ return MODE_NO_INTERLACE; ++#endif ++ if (mode->clock < 1000) /* 1 MHz */ ++ return MODE_CLOCK_LOW; ++ if (mode->clock > 200000) /* 200 MHz */ ++ return MODE_CLOCK_HIGH; ++ ++ return MODE_OK; ++} ++ + static const struct drm_simple_display_pipe_funcs rp1dpi_pipe_funcs = { + .enable = rp1dpi_pipe_enable, + .update = rp1dpi_pipe_update, + .disable = rp1dpi_pipe_disable, + .enable_vblank = rp1dpi_pipe_enable_vblank, + .disable_vblank = rp1dpi_pipe_disable_vblank, ++ .mode_valid = rp1dpi_pipe_mode_valid, + }; + + static const struct drm_mode_config_funcs rp1dpi_mode_funcs = { +--- a/drivers/gpu/drm/rp1/rp1-dpi/rp1_dpi_pio.c ++++ b/drivers/gpu/drm/rp1/rp1-dpi/rp1_dpi_pio.c +@@ -18,13 +18,16 @@ + #include + #include + #include +-#include + #include + #include + #include + + #include "rp1_dpi.h" + ++#if IS_REACHABLE(CONFIG_RP1_PIO) ++ ++#include ++ + /* + * Start a PIO SM to generate an interrupt just after HSYNC onset, then another + * after a fixed delay (during which we assume HSYNC will have been deasserted). +@@ -223,3 +226,16 @@ void rp1dpi_pio_stop(struct rp1_dpi *dpi + dpi->pio = NULL; + } + } ++ ++#else /* !IS_REACHABLE(CONFIG_RP1_PIO) */ ++ ++int rp1dpi_pio_start(struct rp1_dpi *dpi, const struct drm_display_mode *mode) ++{ ++ return -ENODEV; ++} ++ ++void rp1dpi_pio_stop(struct rp1_dpi *dpi) ++{ ++} ++ ++#endif diff --git a/target/linux/bcm27xx/patches-6.6/950-1468-misc-rp1-pio-Support-larger-data-transfers.patch b/target/linux/bcm27xx/patches-6.6/950-1468-misc-rp1-pio-Support-larger-data-transfers.patch new file mode 100644 index 00000000000000..828efdb79bc644 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1468-misc-rp1-pio-Support-larger-data-transfers.patch @@ -0,0 +1,127 @@ +From 4b0ca96738bb937529655a0062d60775f47b0f5e Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 16 Dec 2024 23:01:41 +0000 +Subject: [PATCH 1468/1482] misc: rp1-pio: Support larger data transfers + +Add a separate IOCTL for larger transfer with a 32-bit data_bytes +field. + +See: https://github.com/raspberrypi/utils/issues/107 + +Signed-off-by: Phil Elwell +--- + drivers/misc/rp1-pio.c | 43 +++++++++++++++++++++++++++++++--- + include/uapi/misc/rp1_pio_if.h | 8 +++++++ + 2 files changed, 48 insertions(+), 3 deletions(-) + +--- a/drivers/misc/rp1-pio.c ++++ b/drivers/misc/rp1-pio.c +@@ -824,9 +824,9 @@ static int rp1_pio_sm_rx_user(struct rp1 + return ret; + } + +-static int rp1_pio_sm_xfer_data(struct rp1_pio_client *client, void *param) ++static int rp1_pio_sm_xfer_data32(struct rp1_pio_client *client, void *param) + { +- struct rp1_pio_sm_xfer_data_args *args = param; ++ struct rp1_pio_sm_xfer_data32_args *args = param; + struct rp1_pio_device *pio = client->pio; + struct dma_info *dma; + +@@ -842,6 +842,19 @@ static int rp1_pio_sm_xfer_data(struct r + return rp1_pio_sm_rx_user(pio, dma, args->data, args->data_bytes); + } + ++static int rp1_pio_sm_xfer_data(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_pio_sm_xfer_data_args *args = param; ++ struct rp1_pio_sm_xfer_data32_args args32; ++ ++ args32.sm = args->sm; ++ args32.dir = args->dir; ++ args32.data_bytes = args->data_bytes; ++ args32.data = args->data; ++ ++ return rp1_pio_sm_xfer_data32(client, &args32); ++} ++ + struct handler_info { + const char *name; + int (*func)(struct rp1_pio_client *client, void *param); +@@ -849,6 +862,7 @@ struct handler_info { + } ioctl_handlers[] = { + HANDLER(SM_CONFIG_XFER, sm_config_xfer), + HANDLER(SM_XFER_DATA, sm_xfer_data), ++ HANDLER(SM_XFER_DATA32, sm_xfer_data32), + + HANDLER(CAN_ADD_PROGRAM, can_add_program), + HANDLER(ADD_PROGRAM, add_program), +@@ -1032,13 +1046,23 @@ struct rp1_pio_sm_xfer_data_args_compat + compat_uptr_t data; + }; + ++struct rp1_pio_sm_xfer_data32_args_compat { ++ uint16_t sm; ++ uint16_t dir; ++ uint32_t data_bytes; ++ compat_uptr_t data; ++}; ++ + struct rp1_access_hw_args_compat { + uint32_t addr; + uint32_t len; + compat_uptr_t data; + }; + +-#define PIO_IOC_SM_XFER_DATA_COMPAT _IOW(PIO_IOC_MAGIC, 1, struct rp1_pio_sm_xfer_data_args_compat) ++#define PIO_IOC_SM_XFER_DATA_COMPAT \ ++ _IOW(PIO_IOC_MAGIC, 1, struct rp1_pio_sm_xfer_data_args_compat) ++#define PIO_IOC_SM_XFER_DATA32_COMPAT \ ++ _IOW(PIO_IOC_MAGIC, 2, struct rp1_pio_sm_xfer_data32_args_compat) + #define PIO_IOC_READ_HW_COMPAT _IOW(PIO_IOC_MAGIC, 8, struct rp1_access_hw_args_compat) + #define PIO_IOC_WRITE_HW_COMPAT _IOW(PIO_IOC_MAGIC, 9, struct rp1_access_hw_args_compat) + +@@ -1061,6 +1085,19 @@ static long rp1_pio_compat_ioctl(struct + param.data = compat_ptr(compat_param.data); + return rp1_pio_sm_xfer_data(client, ¶m); + } ++ case PIO_IOC_SM_XFER_DATA32_COMPAT: ++ { ++ struct rp1_pio_sm_xfer_data32_args_compat compat_param; ++ struct rp1_pio_sm_xfer_data32_args param; ++ ++ if (copy_from_user(&compat_param, compat_ptr(ioctl_param), sizeof(compat_param))) ++ return -EFAULT; ++ param.sm = compat_param.sm; ++ param.dir = compat_param.dir; ++ param.data_bytes = compat_param.data_bytes; ++ param.data = compat_ptr(compat_param.data); ++ return rp1_pio_sm_xfer_data32(client, ¶m); ++ } + + case PIO_IOC_READ_HW_COMPAT: + case PIO_IOC_WRITE_HW_COMPAT: +--- a/include/uapi/misc/rp1_pio_if.h ++++ b/include/uapi/misc/rp1_pio_if.h +@@ -167,6 +167,13 @@ struct rp1_pio_sm_xfer_data_args { + void *data; + }; + ++struct rp1_pio_sm_xfer_data32_args { ++ uint16_t sm; ++ uint16_t dir; ++ uint32_t data_bytes; ++ void *data; ++}; ++ + struct rp1_access_hw_args { + uint32_t addr; + uint32_t len; +@@ -177,6 +184,7 @@ struct rp1_access_hw_args { + + #define PIO_IOC_SM_CONFIG_XFER _IOW(PIO_IOC_MAGIC, 0, struct rp1_pio_sm_config_xfer_args) + #define PIO_IOC_SM_XFER_DATA _IOW(PIO_IOC_MAGIC, 1, struct rp1_pio_sm_xfer_data_args) ++#define PIO_IOC_SM_XFER_DATA32 _IOW(PIO_IOC_MAGIC, 2, struct rp1_pio_sm_xfer_data32_args) + + #define PIO_IOC_READ_HW _IOW(PIO_IOC_MAGIC, 8, struct rp1_access_hw_args) + #define PIO_IOC_WRITE_HW _IOW(PIO_IOC_MAGIC, 9, struct rp1_access_hw_args) diff --git a/target/linux/bcm27xx/patches-6.6/950-1471-fixup-misc-Add-RP1-PIO-driver.patch b/target/linux/bcm27xx/patches-6.6/950-1471-fixup-misc-Add-RP1-PIO-driver.patch new file mode 100644 index 00000000000000..696c0d918618aa --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1471-fixup-misc-Add-RP1-PIO-driver.patch @@ -0,0 +1,24 @@ +From cd26850713088942ca4f9a248a8bed1f0504a58f Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 19 Dec 2024 15:11:40 +0000 +Subject: [PATCH 1471/1482] fixup! misc: Add RP1 PIO driver + +Change the Kconfig dependencies so that RP1_PIO depends on FIRMWARE_RP1, +rather than selecting it. + +Signed-off-by: Phil Elwell +--- + drivers/misc/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/misc/Kconfig ++++ b/drivers/misc/Kconfig +@@ -19,7 +19,7 @@ config BCM2835_SMI + + config RP1_PIO + tristate "Raspberry Pi RP1 PIO driver" +- select FIRMWARE_RP1 ++ depends on FIRMWARE_RP1 || COMPILE_TEST + default n + help + Driver providing control of the Raspberry Pi PIO block, as found in diff --git a/target/linux/bcm27xx/patches-6.6/950-1473-misc-rp1-pio-More-logical-probe-sequence.patch b/target/linux/bcm27xx/patches-6.6/950-1473-misc-rp1-pio-More-logical-probe-sequence.patch new file mode 100644 index 00000000000000..3204997b6ec04b --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1473-misc-rp1-pio-More-logical-probe-sequence.patch @@ -0,0 +1,81 @@ +From 468b525d45a726e4ba704b33c4eba53de47ac684 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 5 Dec 2024 16:03:39 +0000 +Subject: [PATCH 1473/1482] misc: rp1-pio: More logical probe sequence + +Sort the probe function initialisation into a more logical order. + +Signed-off-by: Phil Elwell +--- + drivers/misc/rp1-pio.c | 31 +++++++++++++++---------------- + 1 file changed, 15 insertions(+), 16 deletions(-) + +--- a/drivers/misc/rp1-pio.c ++++ b/drivers/misc/rp1-pio.c +@@ -1153,6 +1153,10 @@ static int rp1_pio_probe(struct platform + return -EINVAL; + } + ++ pdev->id = of_alias_get_id(pdev->dev.of_node, "pio"); ++ if (pdev->id < 0) ++ return dev_err_probe(dev, pdev->id, "alias is missing\n"); ++ + fw = devm_rp1_firmware_get(dev, dev->of_node); + if (IS_ERR(fw)) + return PTR_ERR(fw); +@@ -1185,31 +1189,26 @@ static int rp1_pio_probe(struct platform + goto out_err; + } + +- cdev_init(&pio->cdev, &rp1_pio_fops); +- ret = cdev_add(&pio->cdev, pio->dev_num, 1); +- if (ret) { +- dev_err(dev, "cdev_add failed (err %d)\n", ret); +- goto out_unregister; +- } +- + pio->dev_class = class_create(DRIVER_NAME); + if (IS_ERR(pio->dev_class)) { + ret = PTR_ERR(pio->dev_class); + dev_err(dev, "class_create failed (err %d)\n", ret); +- goto out_cdev_del; ++ goto out_unregister; + } +- pdev->id = of_alias_get_id(pdev->dev.of_node, "pio"); +- if (pdev->id < 0) { +- dev_err(dev, "alias is missing\n"); +- return -EINVAL; ++ ++ cdev_init(&pio->cdev, &rp1_pio_fops); ++ ret = cdev_add(&pio->cdev, pio->dev_num, 1); ++ if (ret) { ++ dev_err(dev, "cdev_add failed (err %d)\n", ret); + goto out_class_destroy; + } ++ + sprintf(dev_name, "pio%d", pdev->id); + cdev = device_create(pio->dev_class, NULL, pio->dev_num, NULL, dev_name); + if (IS_ERR(cdev)) { + ret = PTR_ERR(cdev); + dev_err(dev, "%s: device_create failed (err %d)\n", __func__, ret); +- goto out_class_destroy; ++ goto out_cdev_del; + } + + g_pio = pio; +@@ -1217,12 +1216,12 @@ static int rp1_pio_probe(struct platform + dev_info(dev, "Created instance as %s\n", dev_name); + return 0; + +-out_class_destroy: +- class_destroy(pio->dev_class); +- + out_cdev_del: + cdev_del(&pio->cdev); + ++out_class_destroy: ++ class_destroy(pio->dev_class); ++ + out_unregister: + unregister_chrdev_region(pio->dev_num, 1); + diff --git a/target/linux/bcm27xx/patches-6.6/950-1474-misc-rp1-pio-Convert-floats-to-24.8-fixed-point.patch b/target/linux/bcm27xx/patches-6.6/950-1474-misc-rp1-pio-Convert-floats-to-24.8-fixed-point.patch new file mode 100644 index 00000000000000..ba997136bd485c --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1474-misc-rp1-pio-Convert-floats-to-24.8-fixed-point.patch @@ -0,0 +1,92 @@ +From 5c07ba20630a629399eaa6583457aca93ff74606 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 9 Dec 2024 09:58:29 +0000 +Subject: [PATCH 1474/1482] misc: rp1-pio: Convert floats to 24.8 fixed point + +Floating point arithmetic is not supported in the kernel, so use fixed +point instead. + +Signed-off-by: Phil Elwell +--- + include/linux/pio_rp1.h | 29 +++++++++++++++++++++-------- + 1 file changed, 21 insertions(+), 8 deletions(-) + +--- a/include/linux/pio_rp1.h ++++ b/include/linux/pio_rp1.h +@@ -171,6 +171,10 @@ enum gpio_drive_strength { + GPIO_DRIVE_STRENGTH_12MA = 3 + }; + ++struct fp24_8 { ++ uint32_t val; ++}; ++ + typedef rp1_pio_sm_config pio_sm_config; + + typedef struct rp1_pio_client *PIO; +@@ -218,6 +222,13 @@ void pio_close(PIO pio); + int pio_sm_config_xfer(PIO pio, uint sm, uint dir, uint buf_size, uint buf_count); + int pio_sm_xfer_data(PIO pio, uint sm, uint dir, uint data_bytes, void *data); + ++static inline struct fp24_8 make_fp24_8(uint mul, uint div) ++{ ++ struct fp24_8 res = { .val = ((unsigned long long)mul << 8) / div }; ++ ++ return res; ++} ++ + static inline bool pio_can_add_program(struct rp1_pio_client *client, + const pio_program_t *program) + { +@@ -396,16 +407,18 @@ static inline int pio_sm_clear_fifos(str + return rp1_pio_sm_clear_fifos(client, &args); + } + +-static inline bool pio_calculate_clkdiv_from_float(float div, uint16_t *div_int, ++static inline bool pio_calculate_clkdiv_from_fp24_8(struct fp24_8 div, uint16_t *div_int, + uint8_t *div_frac) + { +- if (bad_params_if(NULL, div < 1 || div > 65536)) ++ uint inum = (div.val >> 8); ++ ++ if (bad_params_if(NULL, inum < 1 || inum > 65536)) + return false; +- *div_int = (uint16_t)div; ++ *div_int = (uint16_t)inum; + if (*div_int == 0) + *div_frac = 0; + else +- *div_frac = (uint8_t)((div - (float)*div_int) * (1u << 8u)); ++ *div_frac = div.val & 0xff; + return true; + } + +@@ -421,11 +434,11 @@ static inline int pio_sm_set_clkdiv_int_ + return rp1_pio_sm_set_clkdiv(client, &args); + } + +-static inline int pio_sm_set_clkdiv(struct rp1_pio_client *client, uint sm, float div) ++static inline int pio_sm_set_clkdiv(struct rp1_pio_client *client, uint sm, struct fp24_8 div) + { + struct rp1_pio_sm_set_clkdiv_args args = { .sm = sm }; + +- if (!pio_calculate_clkdiv_from_float(div, &args.div_int, &args.div_frac)) ++ if (!pio_calculate_clkdiv_from_fp24_8(div, &args.div_int, &args.div_frac)) + return -EINVAL; + return rp1_pio_sm_set_clkdiv(client, &args); + } +@@ -745,12 +758,12 @@ static inline void sm_config_set_clkdiv_ + (((uint)div_int) << PROC_PIO_SM0_CLKDIV_INT_LSB); + } + +-static inline void sm_config_set_clkdiv(pio_sm_config *c, float div) ++static inline void sm_config_set_clkdiv(pio_sm_config *c, struct fp24_8 div) + { + uint16_t div_int; + uint8_t div_frac; + +- pio_calculate_clkdiv_from_float(div, &div_int, &div_frac); ++ pio_calculate_clkdiv_from_fp24_8(div, &div_int, &div_frac); + sm_config_set_clkdiv_int_frac(c, div_int, div_frac); + } + diff --git a/target/linux/bcm27xx/patches-6.6/950-1475-misc-rp1-pio-Minor-cosmetic-tweaks.patch b/target/linux/bcm27xx/patches-6.6/950-1475-misc-rp1-pio-Minor-cosmetic-tweaks.patch new file mode 100644 index 00000000000000..73cbacb328d2d1 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1475-misc-rp1-pio-Minor-cosmetic-tweaks.patch @@ -0,0 +1,42 @@ +From 75203c6641cfe47dfb817b095430021b0981ff47 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 10 Dec 2024 12:06:14 +0000 +Subject: [PATCH 1475/1482] misc: rp1-pio: Minor cosmetic tweaks + +No functional change. + +Signed-off-by: Phil Elwell +--- + drivers/misc/rp1-pio.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +--- a/drivers/misc/rp1-pio.c ++++ b/drivers/misc/rp1-pio.c +@@ -683,7 +683,7 @@ err_dma_free: + } + + static int rp1_pio_sm_tx_user(struct rp1_pio_device *pio, struct dma_info *dma, +- const void __user *userbuf, size_t bytes) ++ const void __user *userbuf, size_t bytes) + { + struct platform_device *pdev = pio->pdev; + struct dma_async_tx_descriptor *desc; +@@ -757,7 +757,7 @@ static int rp1_pio_sm_tx_user(struct rp1 + } + + static int rp1_pio_sm_rx_user(struct rp1_pio_device *pio, struct dma_info *dma, +- void __user *userbuf, size_t bytes) ++ void __user *userbuf, size_t bytes) + { + struct platform_device *pdev = pio->pdev; + struct dma_async_tx_descriptor *desc; +@@ -809,8 +809,7 @@ static int rp1_pio_sm_rx_user(struct rp1 + desc->callback = rp1_pio_sm_dma_callback; + desc->callback_param = dma; + +- // Submit the buffer - the callback will kick the semaphore +- ++ /* Submit the buffer - the callback will kick the semaphore */ + ret = dmaengine_submit(desc); + if (ret < 0) + break; diff --git a/target/linux/bcm27xx/patches-6.6/950-1476-misc-rp1-pio-Add-in-kernel-DMA-support.patch b/target/linux/bcm27xx/patches-6.6/950-1476-misc-rp1-pio-Add-in-kernel-DMA-support.patch new file mode 100644 index 00000000000000..05c6de2b01a982 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1476-misc-rp1-pio-Add-in-kernel-DMA-support.patch @@ -0,0 +1,508 @@ +From fddd3e9318dbf01fb763b6880021abc558fce8e6 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 12 Dec 2024 17:09:27 +0000 +Subject: [PATCH 1476/1482] misc: rp1-pio: Add in-kernel DMA support + +Add kernel-facing implementations of pio_sm_config_xfer and +pio_xm_xfer_data. + +Signed-off-by: Phil Elwell +--- + drivers/misc/rp1-pio.c | 208 ++++++++++++++++++++++++++++++---------- + include/linux/pio_rp1.h | 60 ++++++++++-- + 2 files changed, 210 insertions(+), 58 deletions(-) + +--- a/drivers/misc/rp1-pio.c ++++ b/drivers/misc/rp1-pio.c +@@ -61,9 +61,15 @@ + #define DMA_BOUNCE_BUFFER_SIZE 0x1000 + #define DMA_BOUNCE_BUFFER_COUNT 4 + ++struct dma_xfer_state { ++ struct dma_info *dma; ++ void (*callback)(void *param); ++ void *callback_param; ++}; ++ + struct dma_buf_info { + void *buf; +- dma_addr_t phys; ++ dma_addr_t dma_addr; + struct scatterlist sgl; + }; + +@@ -572,21 +578,34 @@ static void rp1_pio_sm_dma_callback(void + up(&dma->buf_sem); + } + ++static void rp1_pio_sm_kernel_dma_callback(void *param) ++{ ++ struct dma_xfer_state *dxs = param; ++ ++ dxs->dma->tail_idx++; ++ up(&dxs->dma->buf_sem); ++ ++ dxs->callback(dxs->callback_param); ++ ++ kfree(dxs); ++} ++ + static void rp1_pio_sm_dma_free(struct device *dev, struct dma_info *dma) + { + dmaengine_terminate_all(dma->chan); + while (dma->buf_count > 0) { + dma->buf_count--; + dma_free_coherent(dev, ROUND_UP(dma->buf_size, PAGE_SIZE), +- dma->bufs[dma->buf_count].buf, dma->bufs[dma->buf_count].phys); ++ dma->bufs[dma->buf_count].buf, ++ dma->bufs[dma->buf_count].dma_addr); + } + + dma_release_channel(dma->chan); + } + +-static int rp1_pio_sm_config_xfer(struct rp1_pio_client *client, void *param) ++static int rp1_pio_sm_config_xfer_internal(struct rp1_pio_client *client, uint sm, uint dir, ++ uint buf_size, uint buf_count) + { +- struct rp1_pio_sm_config_xfer_args *args = param; + struct rp1_pio_sm_set_dmactrl_args set_dmactrl_args; + struct rp1_pio_device *pio = client->pio; + struct platform_device *pdev = pio->pdev; +@@ -596,17 +615,18 @@ static int rp1_pio_sm_config_xfer(struct + struct dma_info *dma; + uint32_t dma_mask; + char chan_name[4]; +- uint buf_size; + int ret = 0; + +- if (args->sm >= RP1_PIO_SMS_COUNT || args->dir >= RP1_PIO_DIR_COUNT || +- !args->buf_size || (args->buf_size & 3) || +- !args->buf_count || args->buf_count > DMA_BOUNCE_BUFFER_COUNT) ++ if (sm >= RP1_PIO_SMS_COUNT || dir >= RP1_PIO_DIR_COUNT) ++ return -EINVAL; ++ if ((buf_count || buf_size) && ++ (!buf_size || (buf_size & 3) || ++ !buf_count || buf_count > DMA_BOUNCE_BUFFER_COUNT)) + return -EINVAL; + +- dma_mask = 1 << (args->sm * 2 + args->dir); ++ dma_mask = 1 << (sm * 2 + dir); + +- dma = &pio->dma_configs[args->sm][args->dir]; ++ dma = &pio->dma_configs[sm][dir]; + + spin_lock(&pio->lock); + if (pio->claimed_dmas & dma_mask) +@@ -615,16 +635,16 @@ static int rp1_pio_sm_config_xfer(struct + client->claimed_dmas |= dma_mask; + spin_unlock(&pio->lock); + +- dma->buf_size = args->buf_size; ++ dma->buf_size = buf_size; + /* Round up the allocations */ +- buf_size = ROUND_UP(args->buf_size, PAGE_SIZE); ++ buf_size = ROUND_UP(buf_size, PAGE_SIZE); + sema_init(&dma->buf_sem, 0); + + /* Allocate and configure a DMA channel */ + /* Careful - each SM FIFO has its own DREQ value */ +- chan_name[0] = (args->dir == RP1_PIO_DIR_TO_SM) ? 't' : 'r'; ++ chan_name[0] = (dir == RP1_PIO_DIR_TO_SM) ? 't' : 'r'; + chan_name[1] = 'x'; +- chan_name[2] = '0' + args->sm; ++ chan_name[2] = '0' + sm; + chan_name[3] = '\0'; + + dma->chan = dma_request_chan(dev, chan_name); +@@ -632,37 +652,37 @@ static int rp1_pio_sm_config_xfer(struct + return PTR_ERR(dma->chan); + + /* Alloc and map bounce buffers */ +- for (dma->buf_count = 0; dma->buf_count < args->buf_count; dma->buf_count++) { ++ for (dma->buf_count = 0; dma->buf_count < buf_count; dma->buf_count++) { + struct dma_buf_info *dbi = &dma->bufs[dma->buf_count]; + + dbi->buf = dma_alloc_coherent(dma->chan->device->dev, buf_size, +- &dbi->phys, GFP_KERNEL); ++ &dbi->dma_addr, GFP_KERNEL); + if (!dbi->buf) { + ret = -ENOMEM; + goto err_dma_free; + } + sg_init_table(&dbi->sgl, 1); +- sg_dma_address(&dbi->sgl) = dbi->phys; ++ sg_dma_address(&dbi->sgl) = dbi->dma_addr; + } + + fifo_addr = pio->phys_addr; +- fifo_addr += args->sm * (RP1_PIO_FIFO_TX1 - RP1_PIO_FIFO_TX0); +- fifo_addr += (args->dir == RP1_PIO_DIR_TO_SM) ? RP1_PIO_FIFO_TX0 : RP1_PIO_FIFO_RX0; ++ fifo_addr += sm * (RP1_PIO_FIFO_TX1 - RP1_PIO_FIFO_TX0); ++ fifo_addr += (dir == RP1_PIO_DIR_TO_SM) ? RP1_PIO_FIFO_TX0 : RP1_PIO_FIFO_RX0; + + config.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; + config.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; + config.src_addr = fifo_addr; + config.dst_addr = fifo_addr; +- config.direction = (args->dir == RP1_PIO_DIR_TO_SM) ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM; ++ config.direction = (dir == RP1_PIO_DIR_TO_SM) ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM; + + ret = dmaengine_slave_config(dma->chan, &config); + if (ret) + goto err_dma_free; + +- set_dmactrl_args.sm = args->sm; +- set_dmactrl_args.is_tx = (args->dir == RP1_PIO_DIR_TO_SM); ++ set_dmactrl_args.sm = sm; ++ set_dmactrl_args.is_tx = (dir == RP1_PIO_DIR_TO_SM); + set_dmactrl_args.ctrl = RP1_PIO_DMACTRL_DEFAULT; +- if (args->dir == RP1_PIO_DIR_FROM_SM) ++ if (dir == RP1_PIO_DIR_FROM_SM) + set_dmactrl_args.ctrl = (RP1_PIO_DMACTRL_DEFAULT & ~0x1f) | 1; + + ret = rp1_pio_sm_set_dmactrl(client, &set_dmactrl_args); +@@ -682,6 +702,14 @@ err_dma_free: + return ret; + } + ++static int rp1_pio_sm_config_xfer_user(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_pio_sm_config_xfer_args *args = param; ++ ++ return rp1_pio_sm_config_xfer_internal(client, args->sm, args->dir, ++ args->buf_size, args->buf_count); ++} ++ + static int rp1_pio_sm_tx_user(struct rp1_pio_device *pio, struct dma_info *dma, + const void __user *userbuf, size_t bytes) + { +@@ -723,7 +751,7 @@ static int rp1_pio_sm_tx_user(struct rp1 + DMA_PREP_INTERRUPT | DMA_CTRL_ACK | + DMA_PREP_FENCE); + if (!desc) { +- dev_err(dev, "DMA preparation failedzn"); ++ dev_err(dev, "DMA preparation failed\n"); + ret = -EIO; + break; + } +@@ -779,7 +807,7 @@ static int rp1_pio_sm_rx_user(struct rp1 + if (!bytes || dma->head_idx - dma->tail_idx == dma->buf_count) { + if (down_timeout(&dma->buf_sem, + msecs_to_jiffies(1000))) { +- dev_err(dev, "DMA wait timed out"); ++ dev_err(dev, "DMA wait timed out\n"); + ret = -ETIMEDOUT; + break; + } +@@ -801,7 +829,7 @@ static int rp1_pio_sm_rx_user(struct rp1 + DMA_PREP_INTERRUPT | DMA_CTRL_ACK | + DMA_PREP_FENCE); + if (!desc) { +- dev_err(dev, "DMA preparation failed"); ++ dev_err(dev, "DMA preparation failed\n"); + ret = -EIO; + break; + } +@@ -823,7 +851,7 @@ static int rp1_pio_sm_rx_user(struct rp1 + return ret; + } + +-static int rp1_pio_sm_xfer_data32(struct rp1_pio_client *client, void *param) ++static int rp1_pio_sm_xfer_data32_user(struct rp1_pio_client *client, void *param) + { + struct rp1_pio_sm_xfer_data32_args *args = param; + struct rp1_pio_device *pio = client->pio; +@@ -841,7 +869,7 @@ static int rp1_pio_sm_xfer_data32(struct + return rp1_pio_sm_rx_user(pio, dma, args->data, args->data_bytes); + } + +-static int rp1_pio_sm_xfer_data(struct rp1_pio_client *client, void *param) ++static int rp1_pio_sm_xfer_data_user(struct rp1_pio_client *client, void *param) + { + struct rp1_pio_sm_xfer_data_args *args = param; + struct rp1_pio_sm_xfer_data32_args args32; +@@ -851,17 +879,97 @@ static int rp1_pio_sm_xfer_data(struct r + args32.data_bytes = args->data_bytes; + args32.data = args->data; + +- return rp1_pio_sm_xfer_data32(client, &args32); ++ return rp1_pio_sm_xfer_data32_user(client, &args32); ++} ++ ++int rp1_pio_sm_config_xfer(struct rp1_pio_client *client, uint sm, uint dir, ++ uint buf_size, uint buf_count) ++{ ++ return rp1_pio_sm_config_xfer_internal(client, sm, dir, buf_size, buf_count); ++} ++EXPORT_SYMBOL_GPL(rp1_pio_sm_config_xfer); ++ ++int rp1_pio_sm_xfer_data(struct rp1_pio_client *client, uint sm, uint dir, ++ uint data_bytes, void *data, dma_addr_t dma_addr, ++ void (*callback)(void *param), void *param) ++{ ++ struct rp1_pio_device *pio = client->pio; ++ struct platform_device *pdev = pio->pdev; ++ struct dma_async_tx_descriptor *desc; ++ struct dma_xfer_state *dxs = NULL; ++ struct device *dev = &pdev->dev; ++ struct dma_buf_info *dbi = NULL; ++ struct scatterlist sg; ++ struct dma_info *dma; ++ int ret = 0; ++ ++ if (sm >= RP1_PIO_SMS_COUNT || dir >= RP1_PIO_DIR_COUNT) ++ return -EINVAL; ++ ++ dma = &pio->dma_configs[sm][dir]; ++ ++ if (!dma_addr) { ++ dxs = kmalloc(sizeof(*dxs), GFP_KERNEL); ++ dxs->dma = dma; ++ dxs->callback = callback; ++ dxs->callback_param = param; ++ callback = rp1_pio_sm_kernel_dma_callback; ++ param = dxs; ++ ++ if (!dma->buf_count || data_bytes > dma->buf_size) ++ return -EINVAL; ++ ++ /* Grab a dma buffer */ ++ if (dma->head_idx - dma->tail_idx == dma->buf_count) { ++ if (down_timeout(&dma->buf_sem, msecs_to_jiffies(1000))) { ++ dev_err(dev, "DMA wait timed out\n"); ++ return -ETIMEDOUT; ++ } ++ } ++ ++ dbi = &dma->bufs[dma->head_idx % dma->buf_count]; ++ dma_addr = dbi->dma_addr; ++ ++ if (dir == PIO_DIR_TO_SM) ++ memcpy(dbi->buf, data, data_bytes); ++ } ++ ++ sg_init_table(&sg, 1); ++ sg_dma_address(&sg) = dma_addr; ++ sg_dma_len(&sg) = data_bytes; ++ ++ desc = dmaengine_prep_slave_sg(dma->chan, &sg, 1, ++ (dir == PIO_DIR_TO_SM) ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM, ++ DMA_PREP_INTERRUPT | DMA_CTRL_ACK | ++ DMA_PREP_FENCE); ++ if (!desc) { ++ dev_err(dev, "DMA preparation failed\n"); ++ return -EIO; ++ } ++ ++ desc->callback = callback; ++ desc->callback_param = param; ++ ++ ret = dmaengine_submit(desc); ++ if (ret < 0) { ++ dev_err(dev, "dmaengine_submit failed (%d)\n", ret); ++ return ret; ++ } ++ ++ dma_async_issue_pending(dma->chan); ++ ++ return 0; + } ++EXPORT_SYMBOL_GPL(rp1_pio_sm_xfer_data); + + struct handler_info { + const char *name; + int (*func)(struct rp1_pio_client *client, void *param); + int argsize; + } ioctl_handlers[] = { +- HANDLER(SM_CONFIG_XFER, sm_config_xfer), +- HANDLER(SM_XFER_DATA, sm_xfer_data), +- HANDLER(SM_XFER_DATA32, sm_xfer_data32), ++ HANDLER(SM_CONFIG_XFER, sm_config_xfer_user), ++ HANDLER(SM_XFER_DATA, sm_xfer_data_user), ++ HANDLER(SM_XFER_DATA32, sm_xfer_data32_user), + + HANDLER(CAN_ADD_PROGRAM, can_add_program), + HANDLER(ADD_PROGRAM, add_program), +@@ -902,7 +1010,7 @@ struct handler_info { + HANDLER(WRITE_HW, write_hw), + }; + +-struct rp1_pio_client *pio_open(void) ++struct rp1_pio_client *rp1_pio_open(void) + { + struct rp1_pio_client *client; + +@@ -914,9 +1022,9 @@ struct rp1_pio_client *pio_open(void) + + return client; + } +-EXPORT_SYMBOL_GPL(pio_open); ++EXPORT_SYMBOL_GPL(rp1_pio_open); + +-void pio_close(struct rp1_pio_client *client) ++void rp1_pio_close(struct rp1_pio_client *client) + { + struct rp1_pio_device *pio = client->pio; + uint claimed_dmas = client->claimed_dmas; +@@ -958,31 +1066,31 @@ void pio_close(struct rp1_pio_client *cl + + kfree(client); + } +-EXPORT_SYMBOL_GPL(pio_close); ++EXPORT_SYMBOL_GPL(rp1_pio_close); + +-void pio_set_error(struct rp1_pio_client *client, int err) ++void rp1_pio_set_error(struct rp1_pio_client *client, int err) + { + client->error = err; + } +-EXPORT_SYMBOL_GPL(pio_set_error); ++EXPORT_SYMBOL_GPL(rp1_pio_set_error); + +-int pio_get_error(const struct rp1_pio_client *client) ++int rp1_pio_get_error(const struct rp1_pio_client *client) + { + return client->error; + } +-EXPORT_SYMBOL_GPL(pio_get_error); ++EXPORT_SYMBOL_GPL(rp1_pio_get_error); + +-void pio_clear_error(struct rp1_pio_client *client) ++void rp1_pio_clear_error(struct rp1_pio_client *client) + { + client->error = 0; + } +-EXPORT_SYMBOL_GPL(pio_clear_error); ++EXPORT_SYMBOL_GPL(rp1_pio_clear_error); + +-static int rp1_pio_open(struct inode *inode, struct file *filp) ++static int rp1_pio_file_open(struct inode *inode, struct file *filp) + { + struct rp1_pio_client *client; + +- client = pio_open(); ++ client = rp1_pio_open(); + if (IS_ERR(client)) + return PTR_ERR(client); + +@@ -991,11 +1099,11 @@ static int rp1_pio_open(struct inode *in + return 0; + } + +-static int rp1_pio_release(struct inode *inode, struct file *filp) ++static int rp1_pio_file_release(struct inode *inode, struct file *filp) + { + struct rp1_pio_client *client = filp->private_data; + +- pio_close(client); ++ rp1_pio_close(client); + + return 0; + } +@@ -1082,7 +1190,7 @@ static long rp1_pio_compat_ioctl(struct + param.dir = compat_param.dir; + param.data_bytes = compat_param.data_bytes; + param.data = compat_ptr(compat_param.data); +- return rp1_pio_sm_xfer_data(client, ¶m); ++ return rp1_pio_sm_xfer_data_user(client, ¶m); + } + case PIO_IOC_SM_XFER_DATA32_COMPAT: + { +@@ -1095,7 +1203,7 @@ static long rp1_pio_compat_ioctl(struct + param.dir = compat_param.dir; + param.data_bytes = compat_param.data_bytes; + param.data = compat_ptr(compat_param.data); +- return rp1_pio_sm_xfer_data32(client, ¶m); ++ return rp1_pio_sm_xfer_data32_user(client, ¶m); + } + + case PIO_IOC_READ_HW_COMPAT: +@@ -1124,8 +1232,8 @@ static long rp1_pio_compat_ioctl(struct + + const struct file_operations rp1_pio_fops = { + .owner = THIS_MODULE, +- .open = rp1_pio_open, +- .release = rp1_pio_release, ++ .open = rp1_pio_file_open, ++ .release = rp1_pio_file_release, + .unlocked_ioctl = rp1_pio_ioctl, + .compat_ioctl = rp1_pio_compat_ioctl, + }; +--- a/include/linux/pio_rp1.h ++++ b/include/linux/pio_rp1.h +@@ -179,9 +179,17 @@ typedef rp1_pio_sm_config pio_sm_config; + + typedef struct rp1_pio_client *PIO; + +-void pio_set_error(struct rp1_pio_client *client, int err); +-int pio_get_error(const struct rp1_pio_client *client); +-void pio_clear_error(struct rp1_pio_client *client); ++int rp1_pio_init(void); ++PIO rp1_pio_open(void); ++void rp1_pio_close(struct rp1_pio_client *client); ++void rp1_pio_set_error(struct rp1_pio_client *client, int err); ++int rp1_pio_get_error(const struct rp1_pio_client *client); ++void rp1_pio_clear_error(struct rp1_pio_client *client); ++int rp1_pio_sm_config_xfer(struct rp1_pio_client *client, uint sm, uint dir, ++ uint buf_size, uint buf_count); ++int rp1_pio_sm_xfer_data(struct rp1_pio_client *client, uint sm, uint dir, ++ uint data_bytes, void *data, dma_addr_t dma_addr, ++ void (*callback)(void *param), void *param); + + int rp1_pio_can_add_program(struct rp1_pio_client *client, void *param); + int rp1_pio_add_program(struct rp1_pio_client *client, void *param); +@@ -215,12 +223,48 @@ int rp1_pio_gpio_set_oeover(struct rp1_p + int rp1_pio_gpio_set_input_enabled(struct rp1_pio_client *client, void *param); + int rp1_pio_gpio_set_drive_strength(struct rp1_pio_client *client, void *param); + +-int pio_init(void); +-PIO pio_open(void); +-void pio_close(PIO pio); ++static inline int pio_init(void) ++{ ++ return rp1_pio_init(); ++} ++ ++static inline struct rp1_pio_client *pio_open(void) ++{ ++ return rp1_pio_open(); ++} ++ ++static inline void pio_close(struct rp1_pio_client *client) ++{ ++ rp1_pio_close(client); ++} ++ ++static inline void pio_set_error(struct rp1_pio_client *client, int err) ++{ ++ rp1_pio_set_error(client, err); ++} + +-int pio_sm_config_xfer(PIO pio, uint sm, uint dir, uint buf_size, uint buf_count); +-int pio_sm_xfer_data(PIO pio, uint sm, uint dir, uint data_bytes, void *data); ++static inline int pio_get_error(const struct rp1_pio_client *client) ++{ ++ return rp1_pio_get_error(client); ++} ++ ++static inline void pio_clear_error(struct rp1_pio_client *client) ++{ ++ rp1_pio_clear_error(client); ++} ++ ++static inline int pio_sm_config_xfer(struct rp1_pio_client *client, uint sm, uint dir, ++ uint buf_size, uint buf_count) ++{ ++ return rp1_pio_sm_config_xfer(client, sm, dir, buf_size, buf_count); ++} ++ ++static inline int pio_sm_xfer_data(struct rp1_pio_client *client, uint sm, uint dir, ++ uint data_bytes, void *data, dma_addr_t dma_addr, ++ void (*callback)(void *param), void *param) ++{ ++ return rp1_pio_sm_xfer_data(client, sm, dir, data_bytes, data, dma_addr, callback, param); ++} + + static inline struct fp24_8 make_fp24_8(uint mul, uint div) + { diff --git a/target/linux/bcm27xx/patches-6.6/950-1477-misc-Add-ws2812-pio-rp1-driver.patch b/target/linux/bcm27xx/patches-6.6/950-1477-misc-Add-ws2812-pio-rp1-driver.patch new file mode 100644 index 00000000000000..469a8a9b91a7e2 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1477-misc-Add-ws2812-pio-rp1-driver.patch @@ -0,0 +1,568 @@ +From d6d83ad3d9a3a594909a1ad1c82b735ab711cd12 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 3 Dec 2024 16:09:30 +0000 +Subject: [PATCH 1477/1482] misc: Add ws2812-pio-rp1 driver + +ws2812-pio-rp1 is a PIO-based driver for WS2812 LEDS. It creates a +character device in /dev, the default name of which is /dev/leds, +where is the instance number. The number of LEDS should be set +in the DT overlay, as should whether it is RGB or RGBW, and the default +brightness. + +Write data to the /dev/* entry in a 4 bytes-per-pixel format in RGBW +order: + + RR GG BB WW RR GG BB WW ... + +The white values are ignored unless the rgbw flag is set for the device. + +To change the brightness, write a single byte to offset 0, 255 being +full brightness and 0 being off. + +Signed-off-by: Phil Elwell +--- + drivers/misc/Kconfig | 10 + + drivers/misc/Makefile | 1 + + drivers/misc/ws2812-pio-rp1.c | 507 ++++++++++++++++++++++++++++++++++ + 3 files changed, 518 insertions(+) + create mode 100644 drivers/misc/ws2812-pio-rp1.c + +--- a/drivers/misc/Kconfig ++++ b/drivers/misc/Kconfig +@@ -25,6 +25,16 @@ config RP1_PIO + Driver providing control of the Raspberry Pi PIO block, as found in + RP1. + ++config WS2812_PIO_RP1 ++ tristate "Raspberry Pi PIO-base WS2812 driver" ++ depends on RP1_PIO || COMPILE_TEST ++ default n ++ help ++ Driver for the WS2812 (NeoPixel) LEDs using the RP1 PIO hardware. ++ The driver creates a character device to which rgbw pixels may be ++ written. Single-byte writes to offset 0 set the brightness at ++ runtime. ++ + config AD525X_DPOT + tristate "Analog Devices Digital Potentiometers" + depends on (I2C || SPI) && SYSFS +--- a/drivers/misc/Makefile ++++ b/drivers/misc/Makefile +@@ -19,6 +19,7 @@ obj-$(CONFIG_PHANTOM) += phantom.o + obj-$(CONFIG_QCOM_COINCELL) += qcom-coincell.o + obj-$(CONFIG_QCOM_FASTRPC) += fastrpc.o + obj-$(CONFIG_RP1_PIO) += rp1-pio.o ++obj-$(CONFIG_WS2812_PIO_RP1) += ws2812-pio-rp1.o + obj-$(CONFIG_SENSORS_BH1770) += bh1770glc.o + obj-$(CONFIG_SENSORS_APDS990X) += apds990x.o + obj-$(CONFIG_ENCLOSURE_SERVICES) += enclosure.o +--- /dev/null ++++ b/drivers/misc/ws2812-pio-rp1.c +@@ -0,0 +1,507 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Raspberry Pi PIO-based WS2812 driver ++ * ++ * Copyright (C) 2014-2024 Raspberry Pi Ltd. ++ * ++ * Author: Phil Elwell (phil@raspberrypi.com) ++ * ++ * Based on the ws2812 driver by Gordon Hollingworth ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define DRIVER_NAME "ws2812-pio-rp1" ++#define MAX_INSTANCES 4 ++ ++#define RESET_US 50 ++#define PIXEL_BYTES 4 ++ ++struct ws2812_pio_rp1_state { ++ struct device *dev; ++ struct gpio_desc *gpiod; ++ struct gpio_desc *power_gpiod; ++ uint gpio; ++ PIO pio; ++ uint sm; ++ uint offset; ++ ++ u8 *buffer; ++ u8 *pixbuf; ++ u32 pixbuf_size; ++ u32 write_end; ++ ++ u8 brightness; ++ u32 invert; ++ u32 num_leds; ++ u32 xfer_end_us; ++ bool is_rgbw; ++ struct delayed_work deferred_work; ++ ++ struct completion dma_completion; ++ struct cdev cdev; ++ dev_t dev_num; ++ const char *dev_name; ++}; ++ ++static DEFINE_MUTEX(ws2812_pio_mutex); ++static DEFINE_IDA(ws2812_pio_ida); ++static long ws2812_pio_ref_count; ++static struct class *ws2812_pio_class; ++static dev_t ws2812_pio_dev_num; ++/* ++ * WS2812B gamma correction ++ * GammaE=255*(res/255).^(1/.45) ++ * From: http://rgb-123.com/ws2812-color-output/ ++ */ ++ ++static const u8 ws2812_gamma[] = { ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ++ 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, ++ 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, ++ 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 11, 11, ++ 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, ++ 19, 19, 20, 21, 21, 22, 22, 23, 23, 24, 25, 25, 26, 27, 27, 28, ++ 29, 29, 30, 31, 31, 32, 33, 34, 34, 35, 36, 37, 37, 38, 39, 40, ++ 40, 41, 42, 43, 44, 45, 46, 46, 47, 48, 49, 50, 51, 52, 53, 54, ++ 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, ++ 71, 72, 73, 74, 76, 77, 78, 79, 80, 81, 83, 84, 85, 86, 88, 89, ++ 90, 91, 93, 94, 95, 96, 98, 99, 100, 102, 103, 104, 106, 107, 109, 110, ++ 111, 113, 114, 116, 117, 119, 120, 121, 123, 124, 126, 128, 129, 131, 132, 134, ++ 135, 137, 138, 140, 142, 143, 145, 146, 148, 150, 151, 153, 155, 157, 158, 160, ++ 162, 163, 165, 167, 169, 170, 172, 174, 176, 178, 179, 181, 183, 185, 187, 189, ++ 191, 193, 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, ++ 222, 224, 227, 229, 231, 233, 235, 237, 239, 241, 244, 246, 248, 250, 252, 255 ++}; ++ ++// ------ // ++// ws2812 // ++// ------ // ++ ++#define ws2812_wrap_target 0 ++#define ws2812_wrap 3 ++ ++#define ws2812_T1 3 ++#define ws2812_T2 4 ++#define ws2812_T3 3 ++ ++static const uint16_t ws2812_program_instructions[] = { ++ // .wrap_target ++ 0x6221, // 0: out x, 1 side 0 [2] ++ 0x1223, // 1: jmp !x, 3 side 1 [2] ++ 0x1300, // 2: jmp 0 side 1 [3] ++ 0xa342, // 3: nop side 0 [3] ++ // .wrap ++}; ++ ++static const struct pio_program ws2812_program = { ++ .instructions = ws2812_program_instructions, ++ .length = 4, ++ .origin = -1, ++}; ++ ++static inline pio_sm_config ws2812_program_get_default_config(uint offset) ++{ ++ pio_sm_config c = pio_get_default_sm_config(); ++ ++ sm_config_set_wrap(&c, offset + ws2812_wrap_target, offset + ws2812_wrap); ++ sm_config_set_sideset(&c, 1, false, false); ++ return c; ++} ++ ++static inline void ws2812_program_init(PIO pio, uint sm, uint offset, uint pin, uint freq, ++ bool rgbw) ++{ ++ int cycles_per_bit = ws2812_T1 + ws2812_T2 + ws2812_T3; ++ struct fp24_8 div; ++ pio_sm_config c; ++ ++ pio_gpio_init(pio, pin); ++ pio_sm_set_consecutive_pindirs(pio, sm, pin, 1, true); ++ c = ws2812_program_get_default_config(offset); ++ sm_config_set_sideset_pins(&c, pin); ++ sm_config_set_out_shift(&c, false, true, rgbw ? 32 : 24); ++ sm_config_set_fifo_join(&c, PIO_FIFO_JOIN_TX); ++ div = make_fp24_8(clock_get_hz(clk_sys), freq * cycles_per_bit); ++ sm_config_set_clkdiv(&c, div); ++ pio_sm_init(pio, sm, offset, &c); ++ pio_sm_set_enabled(pio, sm, true); ++} ++ ++static uint8_t ws2812_apply_gamma(uint8_t brightness, uint8_t val) ++{ ++ int bright; ++ ++ if (!val) ++ return 0; ++ bright = (val * brightness) / 255; ++ return ws2812_gamma[bright]; ++} ++ ++static inline uint8_t *rgbw_u32(const struct ws2812_pio_rp1_state *state, ++ uint8_t r, uint8_t g, uint8_t b, uint8_t w, uint8_t *p) ++{ ++ p[0] = ws2812_apply_gamma(state->brightness, w); ++ p[1] = ws2812_apply_gamma(state->brightness, b); ++ p[2] = ws2812_apply_gamma(state->brightness, r); ++ p[3] = ws2812_apply_gamma(state->brightness, g); ++ return p + 4; ++} ++ ++static void ws2812_dma_complete(void *param) ++{ ++ struct ws2812_pio_rp1_state *state = param; ++ ++ complete(&state->dma_completion); ++} ++ ++static void ws2812_update_leds(struct ws2812_pio_rp1_state *state, uint length) ++{ ++ init_completion(&state->dma_completion); ++ if (!pio_sm_xfer_data(state->pio, state->sm, PIO_DIR_TO_SM, length, state->buffer, 0, ++ (void (*)(void *))ws2812_dma_complete, state)) { ++ wait_for_completion(&state->dma_completion); ++ usleep_range(RESET_US, RESET_US + 100); ++ } ++} ++ ++static void ws2812_clear_leds(struct ws2812_pio_rp1_state *state) ++{ ++ uint8_t *p_buffer; ++ uint length; ++ int i; ++ ++ p_buffer = state->buffer; ++ for (i = 0; i < state->num_leds; i++) ++ p_buffer = rgbw_u32(state, 0, 0, 0, 0, p_buffer); ++ ++ length = (void *)p_buffer - (void *)state->buffer; ++ ++ ws2812_update_leds(state, length); ++} ++ ++/* ++ * Function to write the RGB buffer to the WS2812 leds, the input buffer ++ * contains a sequence of up to num_leds RGB32 integers, these are then ++ * gamma-corrected before being sent to the PIO state machine. ++ */ ++ ++static ssize_t ws2812_pio_rp1_write(struct file *filp, const char __user *buf, size_t count, ++ loff_t *ppos) ++{ ++ struct ws2812_pio_rp1_state *state; ++ uint32_t pixbuf_size; ++ unsigned long delay; ++ loff_t pos = *ppos; ++ int err = 0; ++ ++ state = (struct ws2812_pio_rp1_state *)filp->private_data; ++ pixbuf_size = state->pixbuf_size; ++ ++ if (pos > pixbuf_size) ++ return -EFBIG; ++ ++ if (count > pixbuf_size) { ++ err = -EFBIG; ++ count = pixbuf_size; ++ } ++ ++ if (pos + count > pixbuf_size) { ++ if (!err) ++ err = -ENOSPC; ++ ++ count = pixbuf_size - pos; ++ } ++ ++ if (!pos && count == 1) { ++ if (copy_from_user(&state->brightness, buf, 1)) ++ return -EFAULT; ++ } else { ++ if (copy_from_user(state->pixbuf + pos, buf, count)) ++ return -EFAULT; ++ pos += count; ++ state->write_end = (u32)pos; ++ } ++ ++ *ppos = pos; ++ ++ delay = (state->write_end == pixbuf_size) ? 0 : HZ / 20; ++ schedule_delayed_work(&state->deferred_work, delay); ++ ++ return err ? err : count; ++} ++ ++static void ws2812_pio_rp1_deferred_work(struct work_struct *work) ++{ ++ struct ws2812_pio_rp1_state *state = ++ container_of(work, struct ws2812_pio_rp1_state, deferred_work.work); ++ uint8_t *p_buffer; ++ uint32_t *p_rgb; ++ int blank_bytes; ++ uint length; ++ int i; ++ ++ blank_bytes = state->pixbuf_size - state->write_end; ++ if (blank_bytes > 0) ++ memset(state->pixbuf + state->write_end, 0, blank_bytes); ++ ++ p_rgb = (uint32_t *)state->pixbuf; ++ p_buffer = state->buffer; ++ ++ for (i = 0; i < state->num_leds; i++) { ++ uint32_t rgbw_pix = *(p_rgb++); ++ ++ p_buffer = rgbw_u32(state, ++ (uint8_t)(rgbw_pix >> 0), ++ (uint8_t)(rgbw_pix >> 8), ++ (uint8_t)(rgbw_pix >> 16), ++ (uint8_t)(rgbw_pix >> 24), ++ p_buffer); ++ } ++ ++ length = (void *)p_buffer - (void *)state->buffer; ++ ++ ws2812_update_leds(state, length); ++} ++ ++static int ws2812_pio_rp1_open(struct inode *inode, struct file *file) ++{ ++ struct ws2812_pio_rp1_state *state; ++ ++ state = container_of(inode->i_cdev, struct ws2812_pio_rp1_state, cdev); ++ file->private_data = state; ++ ++ return 0; ++} ++ ++const struct file_operations ws2812_pio_rp1_fops = { ++ .owner = THIS_MODULE, ++ .write = ws2812_pio_rp1_write, ++ .open = ws2812_pio_rp1_open, ++}; ++ ++/* ++ * Probe function ++ */ ++static int ws2812_pio_rp1_probe(struct platform_device *pdev) ++{ ++ struct device_node *np = pdev->dev.of_node; ++ struct of_phandle_args of_args = { 0 }; ++ struct ws2812_pio_rp1_state *state; ++ struct device *dev = &pdev->dev; ++ struct device *char_dev; ++ const char *dev_name; ++ uint32_t brightness; ++ bool is_rp1; ++ int minor; ++ int ret; ++ ++ state = devm_kzalloc(dev, sizeof(*state), GFP_KERNEL); ++ if (IS_ERR(state)) ++ return PTR_ERR(state); ++ ++ state->dev = dev; ++ ++ platform_set_drvdata(pdev, state); ++ ++ ret = of_property_read_u32(np, "rpi,num-leds", &state->num_leds); ++ if (ret) ++ return dev_err_probe(dev, ret, "Could not get num-leds\n"); ++ ++ brightness = 255; ++ of_property_read_u32(np, "rpi,brightness", &brightness); ++ state->brightness = min(brightness, 255); ++ ++ state->pixbuf_size = state->num_leds * PIXEL_BYTES; ++ ++ state->is_rgbw = of_property_read_bool(np, "rpi,rgbw"); ++ state->gpiod = devm_gpiod_get(dev, "leds", GPIOD_ASIS); ++ if (IS_ERR(state->gpiod)) ++ return dev_err_probe(dev, PTR_ERR(state->gpiod), ++ "Could not get a gpio\n"); ++ ++ /* This must be an RP1 GPIO in the first bank, and retrieve the offset. */ ++ /* Unfortunately I think this has to be done by parsing the gpios property */ ++ ++ /* This really shouldn't fail, given that we have a gpiod */ ++ if (of_parse_phandle_with_args(np, "leds-gpios", "#gpio-cells", 0, &of_args)) ++ return dev_err_probe(dev, -EINVAL, ++ "Can't find gpio declaration\n"); ++ ++ is_rp1 = of_device_is_compatible(of_args.np, "raspberrypi,rp1-gpio"); ++ of_node_put(of_args.np); ++ if (!is_rp1 || of_args.args_count != 2) ++ return dev_err_probe(dev, -EINVAL, ++ "Not an RP1 gpio\n"); ++ ++ state->gpio = of_args.args[0]; ++ ++ state->pixbuf = devm_kmalloc(dev, state->pixbuf_size, GFP_KERNEL); ++ if (state->pixbuf == NULL) ++ return -ENOMEM; ++ ++ state->buffer = devm_kmalloc(dev, state->num_leds * PIXEL_BYTES, GFP_KERNEL); ++ if (state->buffer == NULL) ++ return -ENOMEM; ++ ++ ret = of_property_read_string(np, "dev-name", &dev_name); ++ if (ret) { ++ pr_err("Failed to read 'dev-name' property\n"); ++ return ret; ++ } ++ ++ state->pio = pio_open(); ++ if (IS_ERR(state->pio)) ++ return dev_err_probe(dev, PTR_ERR(state->pio), ++ "Could not open PIO\n"); ++ ++ state->sm = pio_claim_unused_sm(state->pio, false); ++ if ((int)state->sm < 0) { ++ dev_err(dev, "No free PIO SM\n"); ++ ret = -EBUSY; ++ goto fail_pio; ++ } ++ ++ state->offset = pio_add_program(state->pio, &ws2812_program); ++ if (state->offset == PIO_ORIGIN_ANY) { ++ dev_err(dev, "Not enough PIO program space\n"); ++ ret = -EBUSY; ++ goto fail_pio; ++ } ++ ++ pio_sm_config_xfer(state->pio, state->sm, PIO_DIR_TO_SM, state->num_leds * sizeof(int), 1); ++ ++ pio_sm_clear_fifos(state->pio, state->sm); ++ pio_sm_set_clkdiv(state->pio, state->sm, make_fp24_8(1, 1)); ++ ws2812_program_init(state->pio, state->sm, state->offset, state->gpio, 800000, ++ state->is_rgbw); ++ ++ mutex_lock(&ws2812_pio_mutex); ++ ++ if (!ws2812_pio_ref_count) { ++ ret = alloc_chrdev_region(&ws2812_pio_dev_num, 0, MAX_INSTANCES, DRIVER_NAME); ++ if (ret < 0) { ++ dev_err(dev, "alloc_chrdev_region failed (rc=%d)\n", ret); ++ goto fail_mutex; ++ } ++ ++ ws2812_pio_class = class_create(DRIVER_NAME); ++ if (IS_ERR(ws2812_pio_class)) { ++ pr_err("Unable to create class " DRIVER_NAME "\n"); ++ ret = PTR_ERR(ws2812_pio_class); ++ goto fail_chrdev; ++ } ++ } ++ ++ ws2812_pio_ref_count++; ++ ++ minor = ida_alloc_range(&ws2812_pio_ida, 0, MAX_INSTANCES - 1, GFP_KERNEL); ++ if (minor < 0) { ++ pr_err("No free instances\n"); ++ ret = minor; ++ goto fail_class; ++ ++ } ++ ++ mutex_unlock(&ws2812_pio_mutex); ++ ++ state->dev_num = MKDEV(MAJOR(ws2812_pio_dev_num), minor); ++ state->dev_name = devm_kasprintf(dev, GFP_KERNEL, dev_name, minor); ++ ++ char_dev = device_create(ws2812_pio_class, NULL, state->dev_num, NULL, state->dev_name); ++ ++ if (IS_ERR(char_dev)) { ++ pr_err("Unable to create device %s\n", state->dev_name); ++ ret = PTR_ERR(char_dev); ++ goto fail_ida; ++ } ++ ++ state->cdev.owner = THIS_MODULE; ++ cdev_init(&state->cdev, &ws2812_pio_rp1_fops); ++ ++ ret = cdev_add(&state->cdev, state->dev_num, 1); ++ if (ret) { ++ pr_err("cdev_add failed\n"); ++ goto fail_device; ++ } ++ ++ INIT_DELAYED_WORK(&state->deferred_work, ws2812_pio_rp1_deferred_work); ++ ++ ws2812_clear_leds(state); ++ ++ dev_info(&pdev->dev, "Instantiated %d LEDs on GPIO %d as /dev/%s\n", ++ state->num_leds, state->gpio, state->dev_name); ++ ++ return 0; ++ ++fail_device: ++ device_destroy(ws2812_pio_class, state->dev_num); ++fail_ida: ++ mutex_lock(&ws2812_pio_mutex); ++ ida_free(&ws2812_pio_ida, minor); ++fail_class: ++ ws2812_pio_ref_count--; ++ if (ws2812_pio_ref_count) ++ goto fail_mutex; ++ class_destroy(ws2812_pio_class); ++fail_chrdev: ++ unregister_chrdev_region(ws2812_pio_dev_num, MAX_INSTANCES); ++fail_mutex: ++ mutex_unlock(&ws2812_pio_mutex); ++fail_pio: ++ pio_close(state->pio); ++ ++ return ret; ++} ++ ++static void ws2812_pio_rp1_remove(struct platform_device *pdev) ++{ ++ struct ws2812_pio_rp1_state *state = platform_get_drvdata(pdev); ++ ++ cancel_delayed_work(&state->deferred_work); ++ platform_set_drvdata(pdev, NULL); ++ ++ cdev_del(&state->cdev); ++ device_destroy(ws2812_pio_class, state->dev_num); ++ ++ mutex_lock(&ws2812_pio_mutex); ++ ida_free(&ws2812_pio_ida, MINOR(state->dev_num)); ++ ws2812_pio_ref_count--; ++ if (!ws2812_pio_ref_count) { ++ class_destroy(ws2812_pio_class); ++ unregister_chrdev_region(ws2812_pio_dev_num, MAX_INSTANCES); ++ } ++ mutex_unlock(&ws2812_pio_mutex); ++ ++ pio_close(state->pio); ++} ++ ++static const struct of_device_id ws2812_pio_rp1_match[] = { ++ { .compatible = "raspberrypi,ws2812-pio-rp1" }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, ws2812_pio_rp1_match); ++ ++static struct platform_driver ws2812_pio_rp1_driver = { ++ .driver = { ++ .name = "ws2812-pio-rp1", ++ .of_match_table = ws2812_pio_rp1_match, ++ }, ++ .probe = ws2812_pio_rp1_probe, ++ .remove_new = ws2812_pio_rp1_remove, ++}; ++module_platform_driver(ws2812_pio_rp1_driver); ++ ++MODULE_DESCRIPTION("WS2812 PIO RP1 driver"); ++MODULE_AUTHOR("Phil Elwell"); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/bcm27xx/patches-6.6/950-1478-overlays-Add-ws2812-pio-overlay.patch b/target/linux/bcm27xx/patches-6.6/950-1478-overlays-Add-ws2812-pio-overlay.patch new file mode 100644 index 00000000000000..8e5051f385506c --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1478-overlays-Add-ws2812-pio-overlay.patch @@ -0,0 +1,107 @@ +From 4a8f2b39157825fefc505fe4b94f3a9ce101e170 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 12 Dec 2024 23:23:39 +0000 +Subject: [PATCH 1478/1482] overlays: Add ws2812-pio overlay + +Add an overlay to enable a WS2812 LED driver on a given GPIO. + +Signed-off-by: Phil Elwell +--- + arch/arm/boot/dts/overlays/Makefile | 3 +- + arch/arm/boot/dts/overlays/README | 22 +++++++++ + .../boot/dts/overlays/ws2812-pio-overlay.dts | 46 +++++++++++++++++++ + 3 files changed, 70 insertions(+), 1 deletion(-) + create mode 100644 arch/arm/boot/dts/overlays/ws2812-pio-overlay.dts + +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -337,7 +337,8 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ + waveshare-can-fd-hat-mode-a.dtbo \ + waveshare-can-fd-hat-mode-b.dtbo \ + wittypi.dtbo \ +- wm8960-soundcard.dtbo ++ wm8960-soundcard.dtbo \ ++ ws2812-pio.dtbo + + targets += dtbs dtbs_install + targets += $(dtbo-y) +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -5487,6 +5487,28 @@ Params: alsaname Changes + compatible Changes the codec compatibility + + ++Name: ws2812-pio ++Info: Configures a GPIO pin to drive a string of WS2812 LEDS using pio. It ++ can be enabled on any RP1 GPIO in bank 0 (0-27). Up to 4 are supported, ++ assuming nothing else is using PIO. Pi 5 only. ++Load: dtoverlay=ws2812-pio,= ++Params: brightness Set the initial brightness for the LEDs. The ++ brightness can be changed at runtime by writing ++ a single byte to offset 0 of the device. Note ++ that brightness is a multiplier for the pixel ++ values, and only white pixels can reach the ++ maximum visible brightness. (range 0-255, ++ default 255) ++ dev_name The name for the /dev/ device entry. Note that ++ if the name includes '%d' it will be replaced ++ by the instance number. (default 'leds%d') ++ gpio Output GPIO (0-27, default 4) ++ num_leds Number of LEDs (default 60) ++ rgbw 'rgbw=on' (or 'rgbw') indicates that each pixel ++ includes a white LED as well as the usual red, ++ green and blue. (default 'off') ++ ++ + Troubleshooting + =============== + +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/ws2812-pio-overlay.dts +@@ -0,0 +1,46 @@ ++// SPDX-License-Identifier: GPL-2.0 ++// Device tree overlay for RP1 PIO WS2812 driver. ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2712"; ++ ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ ws2812_pio_pins: ws2812_pio_pins@4 { ++ brcm,pins = <4>; /* gpio 4 */ ++ function = "pio"; ++ bias-disable; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target-path = "/"; ++ __overlay__ { ++ ws2812_pio: ws2812_pio@4 { ++ compatible = "raspberrypi,ws2812-pio-rp1"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&ws2812_pio_pins>; ++ dev-name = "leds%d"; ++ leds-gpios = <&gpio 4 0>; ++ rpi,num-leds = <60>; ++ rpi,brightness = <255>; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ brightness = <&ws2812_pio>, "rpi,brightness:0"; ++ dev_name = <&ws2812_pio>, "dev-name"; ++ gpio = <&ws2812_pio>,"leds-gpios:4", ++ <&ws2812_pio_pins>,"brcm,pins:0", ++ /* modify reg values to allow multiple instantiation */ ++ <&ws2812_pio>,"reg:0", ++ <&ws2812_pio_pins>,"reg:0"; ++ num_leds = <&ws2812_pio>, "rpi,num-leds:0"; ++ rgbw = <&ws2812_pio>, "rpi,rgbw?"; ++ }; ++}; From 17752bd9ce955426a2014fd21edb91fe33651d71 Mon Sep 17 00:00:00 2001 From: John Audia Date: Mon, 16 Dec 2024 13:44:32 -0500 Subject: [PATCH 248/877] kernel: bcm27xx/bcm2712: add RP1 functionality Build in several options RP1-specific features rather than generating additional kmods for them since bcm2712 is unique to RPi5B only. Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/17233 Signed-off-by: Robert Marko (cherry picked from commit 87309edba4dee23dc2ff3a8fb7cfdeb778768f3a) --- target/linux/bcm27xx/bcm2712/config-6.6 | 5 ++++- target/linux/bcm27xx/config-6.6 | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/target/linux/bcm27xx/bcm2712/config-6.6 b/target/linux/bcm27xx/bcm2712/config-6.6 index 5abc41ff681d43..5ed564f5ab9f42 100644 --- a/target/linux/bcm27xx/bcm2712/config-6.6 +++ b/target/linux/bcm27xx/bcm2712/config-6.6 @@ -128,7 +128,7 @@ CONFIG_CMA_SIZE_SEL_MBYTES=y # CONFIG_CMA_SYSFS is not set CONFIG_COMMON_CLK=y CONFIG_COMMON_CLK_RP1=y -# CONFIG_COMMON_CLK_RP1_SDIO is not set +CONFIG_COMMON_CLK_RP1_SDIO=y CONFIG_COMMON_CLK_XGENE=y CONFIG_COMPACT_UNEVICTABLE_DEFAULT=1 # CONFIG_COMPAT_32BIT_TIME is not set @@ -239,6 +239,7 @@ CONFIG_FB_DEVICE=y CONFIG_FB_IOMEM_FOPS=y CONFIG_FB_IOMEM_HELPERS=y CONFIG_FB_SIMPLE=y +CONFIG_FIRMWARE_RP1=y CONFIG_FIXED_PHY=y CONFIG_FIX_EARLYCON_MEM=y CONFIG_FONT_8x16=y @@ -371,6 +372,7 @@ CONFIG_MAGIC_SYSRQ=y CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1f6 CONFIG_MAILBOX=y # CONFIG_MAILBOX_TEST is not set +CONFIG_MBOX_RP1=y CONFIG_MDIO_BCM_UNIMAC=y CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y @@ -534,6 +536,7 @@ CONFIG_RESET_RASPBERRYPI=y CONFIG_RESET_SIMPLE=y CONFIG_RFS_ACCEL=y CONFIG_RODATA_FULL_DEFAULT_ENABLED=y +CONFIG_RP1_PIO=y # CONFIG_RPI_POE_POWER is not set CONFIG_RPS=y CONFIG_RTC_CLASS=y diff --git a/target/linux/bcm27xx/config-6.6 b/target/linux/bcm27xx/config-6.6 index b44aa9f8a9b35d..50ca86f58508d2 100644 --- a/target/linux/bcm27xx/config-6.6 +++ b/target/linux/bcm27xx/config-6.6 @@ -1,6 +1,7 @@ # CONFIG_BACKLIGHT_RPI is not set # CONFIG_BCM2712_MIP is not set # CONFIG_COMMON_CLK_RP1 is not set +# CONFIG_COMMON_CLK_RP1_SDIO is not set # CONFIG_COMMON_CLK_RP1_SDIO is not set # CONFIG_DRM_PANEL_ILITEK_ILI9806E is not set # CONFIG_DRM_PANEL_TPO_Y17P is not set @@ -9,8 +10,10 @@ # CONFIG_DRM_RP1_DSI is not set # CONFIG_DRM_RP1_VEC is not set # CONFIG_FB_RPISENSE is not set +# CONFIG_FIRMWARE_RP1 is not set # CONFIG_GPIO_PWM is not set # CONFIG_INPUT_RASPBERRYPI_BUTTON is not set +# CONFIG_MBOX_RP1 is not set # CONFIG_MEDIA_PCI_HAILO is not set # CONFIG_MFD_PM8921_CORE is not set # CONFIG_MFD_RASPBERRYPI_POE_HAT is not set @@ -19,9 +22,11 @@ # CONFIG_PHY_CADENCE_DP is not set # CONFIG_PINCTRL_BCM2712 is not set # CONFIG_PINCTRL_RP1 is not set +# CONFIG_PWM_PIO_RP1 is not set # CONFIG_PWM_RP1 is not set # CONFIG_RASPBERRYPI_GPIOMEM is not set # CONFIG_REGULATOR_RASPBERRYPI_TOUCHSCREEN_V2 is not set +# CONFIG_RP1_PIO is not set # CONFIG_SENSORS_RP1_ADC is not set # CONFIG_SPI_RP2040_GPIO_BRIDGE is not set # CONFIG_VIDEO_AD5398 is not set @@ -39,3 +44,4 @@ # CONFIG_VIDEO_OV64A40 is not set # CONFIG_VIDEO_RASPBERRYPI_PISP_BE is not set # CONFIG_VIDEO_RP1_CFE is not set +# CONFIG_WS2812_PIO_RP1 is not set From cccc7651ec2593dc7fe31386ff8d30d320319ca0 Mon Sep 17 00:00:00 2001 From: John Audia Date: Wed, 11 Dec 2024 15:06:30 -0500 Subject: [PATCH 249/877] bcm27xx/bcm2712: add RP1 drivers via kmods Add kmods for the following RP1 options that not all users will necessarily need or want compiled in: * Composite video * Display video * LED control * PWM control * Serial video Build system: x86/64 Build-tested: bcm2712/RPi5B Run-tested: bcm2712/RPi5B Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/17233 Signed-off-by: Robert Marko (cherry picked from commit d6c5805db37d42d29e190b7f2dc49ed8e4545e00) --- target/linux/bcm27xx/modules/other.mk | 37 +++++++++++++ target/linux/bcm27xx/modules/video.mk | 78 +++++++++++++++++++++++++++ 2 files changed, 115 insertions(+) diff --git a/target/linux/bcm27xx/modules/other.mk b/target/linux/bcm27xx/modules/other.mk index 99b71d4d695af1..5a690007483971 100644 --- a/target/linux/bcm27xx/modules/other.mk +++ b/target/linux/bcm27xx/modules/other.mk @@ -53,3 +53,40 @@ define KernelPackage/smi-bcm2835-dev/description endef $(eval $(call KernelPackage,smi-bcm2835-dev)) + + +define KernelPackage/pwm-pio-rp1 + SUBMENU:=$(OTHER_MENU) + TITLE:=RP1 PWM support + KCONFIG:=CONFIG_PWM_PIO_RP1 + FILES:=$(LINUX_DIR)/drivers/pwm/pwm-pio-rp1.ko + AUTOLOAD:=$(call AutoLoad,21,pwm-pio-rp1) + DEPENDS:=@TARGET_bcm27xx_bcm2712 +endef + +define KernelPackage/pwm-pio-rp1/description + Enables precise control of PWM signals for tasks like motor control, + LED dimming, and audio signal generation. Leveraging PIO allows for + higher accuracy and flexibility in PWM signal generation compared + to traditional hardware timers. +endef + +$(eval $(call KernelPackage,pwm-pio-rp1)) + + +define KernelPackage/ws2812-pio-rp1 + SUBMENU:=$(OTHER_MENU) + TITLE:=RP1 PIO-base WS2812 driver + KCONFIG:=CONFIG_WS2812_PIO_RP1 + FILES:=$(LINUX_DIR)/drivers/misc/ws2812-pio-rp1.ko + AUTOLOAD:=$(call AutoLoad,21,ws2812-pio-rp1) + DEPENDS:=@TARGET_bcm27xx_bcm2712 +endef + +define KernelPackage/ws2812-pio-rp1/description + Driver for the WS2812 (NeoPixel) LEDs using the RP1 PIO hardware. + The driver creates a character device to which rgbw pixels may be + written. Single-byte writes to offset 0 set the brightness at runtime. +endef + +$(eval $(call KernelPackage,ws2812-pio-rp1)) diff --git a/target/linux/bcm27xx/modules/video.mk b/target/linux/bcm27xx/modules/video.mk index b9af0b3e0f8603..8e2b19bd871165 100644 --- a/target/linux/bcm27xx/modules/video.mk +++ b/target/linux/bcm27xx/modules/video.mk @@ -115,3 +115,81 @@ define KernelPackage/vchiq-mmal-bcm2835/description endef $(eval $(call KernelPackage,vchiq-mmal-bcm2835)) + + +define KernelPackage/drm-rp1-dsi + SUBMENU:=$(VIDEO_MENU) + TITLE:=RP1 Display Serial Interface for Video + KCONFIG:= \ + CONFIG_DRM_RP1_DSI \ + CONFIG_DRM_GEM_DMA_HELPER \ + CONFIG_DRM_KMS_HELPER \ + CONFIG_DRM_MIPI_DSI=y \ + CONFIG_DRM_VRAM_HELPER=n \ + CONFIG_DRM_TTM=n \ + CONFIG_DRM_TTM_HELPER=n \ + CONFIG_GENERIC_PHY_MIPI_DPHY=n \ + CONFIG_DRM_WERROR=n + FILES:=$(LINUX_DIR)/drivers/gpu/drm/rp1/rp1-dsi/drm-rp1-dsi.ko + AUTOLOAD:=$(call AutoLoad,67,drm-rp1-dsi) + DEPENDS:=@TARGET_bcm27xx_bcm2712 +kmod-drm-vc4 +endef + +define KernelPackage/drm-rp1-dsi/description + This module manages the DSI for driving high-resolution LCD panels + such as the official Raspberry Pi displays or other screens that + use the DSI interface. +endef + +$(eval $(call KernelPackage,drm-rp1-dsi)) + + +define KernelPackage/drm-rp1-dpi + SUBMENU:=$(VIDEO_MENU) + TITLE:=RP1 Display Parallel Interface for Video + KCONFIG:= \ + CONFIG_DRM_RP1_DPI \ + CONFIG_DRM_GEM_DMA_HELPER \ + CONFIG_DRM_KMS_HELPER \ + CONFIG_DRM_VRAM_HELPER=n \ + CONFIG_DRM_TTM=n \ + CONFIG_DRM_TTM_HELPER=n + FILES:=$(LINUX_DIR)/drivers/gpu/drm/rp1/rp1-dpi/drm-rp1-dpi.ko + AUTOLOAD:=$(call AutoLoad,67,drm-rp1-dpi) + DEPENDS:=@TARGET_bcm27xx_bcm2712 +kmod-drm-vc4 +endef + +define KernelPackage/drm-rp1-dpi/description + This module is or driving displays using the DPI standard. + Useful for interfacing with custom or low-level LCD panels + that require parallel RGB signals. Provides direct control + over the timing and signal driving of raw LCD panels. + Typically used in maker projects or with non-HDMI displays. +endef + +$(eval $(call KernelPackage,drm-rp1-dpi)) + + +define KernelPackage/drm-rp1-vec + SUBMENU:=$(VIDEO_MENU) + TITLE:=RP1 Display Composite Video + KCONFIG:= \ + CONFIG_DRM_RP1_VEC \ + CONFIG_DRM_GEM_DMA_HELPER \ + CONFIG_DRM_KMS_HELPER \ + CONFIG_DRM_VRAM_HELPER=n \ + CONFIG_DRM_TTM=n \ + CONFIG_DRM_TTM_HELPER=n + FILES:=$(LINUX_DIR)/drivers/gpu/drm/rp1/rp1-vec/drm-rp1-vec.ko + AUTOLOAD:=$(call AutoLoad,67,drm-rp1-vec) + DEPENDS:=@TARGET_bcm27xx_bcm2712 +kmod-drm-vc4 +endef + +define KernelPackage/drm-rp1-vec/description + This module is used for composite video output, which is typically + transmitted through the RCA jack. Primary use is onnecting older + TVs or monitors that rely on analog signals via a composite interface. + Handles standard-definition analog signals in NTSC and PAL. +endef + +$(eval $(call KernelPackage,drm-rp1-vec)) From 3a5584e0dfc99acb5100428eefe0b3a81b9c7211 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Fri, 27 Dec 2024 17:14:40 +0100 Subject: [PATCH 250/877] bcm27xx: pull 6.6 patches from RPi repo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds latest 6.6 patches from the Raspberry Pi repository. These patches were generated from: https://github.com/raspberrypi/linux/commits/rpi-6.6.y/ With the following command: git format-patch -N v6.6.67..HEAD (HEAD -> 811ff707533bcd67cdcd368bbd46223082009b12) Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 692205305db14deeff1a2dc4a6d7f87e19fc418b) --- target/linux/bcm27xx/bcm2708/config-6.6 | 2 + target/linux/bcm27xx/bcm2709/config-6.6 | 2 + target/linux/bcm27xx/bcm2710/config-6.6 | 2 + target/linux/bcm27xx/bcm2711/config-6.6 | 2 + target/linux/bcm27xx/bcm2712/config-6.6 | 2 + target/linux/bcm27xx/config-6.6 | 2 + ...-dts-rp1-Disable-DMA-usage-for-UART0.patch | 34 - ...ia-bcm2835_isp-Cache-LS-table-dmabuf.patch | 141 + .../950-1353-pwm-Add-GPIO-PWM-driver.patch | 330 ++ ...overlay-Add-a-dtoverlay-for-pwm-gpio.patch | 79 + ...Drop-some-numa-options-from-bootargs.patch | 29 + ...ore-broken-Kingston-Canvas-Go-SD-car.patch | 42 + ...snps-dwc3-add-FS-HS-periodic-NAK-pol.patch | 35 + ...d-support-for-setting-NAK-enhancemen.patch | 77 + ...nced-FS-NAK-quirk-for-usb3-controlle.patch | 30 + ...-prevent-a-theoretical-race-on-non-c.patch | 50 + ...midity-dht11-Allow-non-zero-decimals.patch | 32 + ...condition-for-ignoring-a-plane-to-sr.patch | 41 + ...TPZ-scaling-filter-for-1x1-source-im.patch | 59 + ...top-property-to-true-for-writeback-a.patch | 30 + ...366-drm-Increase-plane_mask-to-64bit.patch | 101 + ...-number-of-overlay-planes-from-16-to.patch | 42 + ...-32-overlay-planes-to-writeback-only.patch | 71 + ...DE_TRANSPOSE-option-to-the-DRM-rotat.patch | 47 + ...d-a-rotation-parameter-to-connectors.patch | 164 + ...a-rotation-property-to-the-writeback.patch | 65 + ...w-axi-dmac-Allow-client-chosen-width.patch | 40 + ...Let-the-DMAC-set-the-transfer-widths.patch | 31 + ...011-Request-a-memory-width-of-1-byte.patch | 25 + ...-set-HID-bit-in-streaming-endpoint-c.patch | 56 + ...-Add-options-for-slightly-modifying-.patch | 199 + ...ink-frequency-override-to-imx477-378.patch | 43 + ...dw-axi-dmac-Only-start-idle-channels.patch | 29 + ...382-mailbox-Add-RP1-mailbox-support.patch} | 0 ...an-RP1-firmware-interface-over-mbox.patch} | 0 ...=> 950-1384-misc-Add-RP1-PIO-driver.patch} | 0 ...2-rpi-Add-RP1-firmware-and-mailboxes.patch | 118 + ...s-bcm2712-rpi-Add-the-RP1-PIO-device.patch | 55 + ...8-misc-rp1-pio-Add-an-in-kernel-API.patch} | 0 ...950-1389-pwm-Add-pwm-pio-rp1-driver.patch} | 4 +- ...50-1391-overlays-Add-pwm-pio-overlay.patch | 99 + ...-1392-fixup-misc-Add-RP1-PIO-driver.patch} | 0 ...misc-rp1-pio-Add-compat_ioctl-method.patch | 4 +- ...e-Add-support-for-bus-clear-feature.patch} | 12 +- ...i-Update-Hailo-accelerator-device-dr.patch | 3592 +++++++++++++++++ ...dtoverlays-enable-SPI-CS-active-high.patch | 108 + ...r-updating-the-enable_bg_fill-until-.patch | 64 + ...sc-rp1-pio-Add-FIFO-related-methods.patch} | 4 +- ...Raspberry-Touch-2-rotation-with-over.patch | 31 + ...rp1-pio-Add-missing-static-inline-s.patch} | 6 +- ...pio-Back-port-some-6.11-build-fixes.patch} | 0 ...950-1404-Adding-Pimidi-kernel-module.patch | 1167 ++++++ .../950-1406-Adding-pimidi-overlay.dts.patch | 100 + ...chiq_arm-Add-36-bit-address-support.patch} | 4 +- ...hiq_arm-children-inherit-DMA-config.patch} | 4 +- ..._arm-Usa-a-DMA-pool-for-small-bulks.patch} | 4 +- ...hiq_arm-Add-log_level-module-params.patch} | 4 +- ...a-i2c-imx477-Fix-link-frequency-menu.patch | 25 + ...o-Fix-copy-paste-error-in-pio_rp1.h.patch} | 2 +- ...-Fix-parameter-checks-wihout-client.patch} | 0 ...le-the-different-command-FIFO-widths.patch | 147 + ...For-CM5IO-i2c_csi_dsi-needs-to-be-CA.patch | 30 + ...rpi-cm5-Remove-inaccessible-USB_OC_N.patch | 25 + ...ca7000-replace-URL-with-textual-hint.patch | 33 + ...cdns-macb-Add-compatible-for-Raspber.patch | 24 + ...port-for-Raspberry-Pi-RP1-ethernet-c.patch | 4 +- ...t-PLL_SEC_RST-in-rp1_pll_divider_off.patch | 3 +- ...ise-the-use-of-the-CLK_IS_CRITICAL-f.patch | 3 +- ...-Fixup-RP1-ethernet-DT-configuration.patch | 8 +- .../950-1427-clk-rp1-Add-RP1_CLK_DMA.patch | 2 +- ...1-clk-Remove-CLK_IGNORE_UNUSED-flags.patch | 2 +- ...e-clk_sys-for-ethernet-hclk-and-pclk.patch | 6 +- ...Link-RP1-DMA-to-the-associated-clock.patch | 4 +- ...mware-Add-the-RPI-firmware-UART-APIs.patch | 23 + ...dd-the-Raspberry-Pi-firmware-UART-id.patch | 22 + ...d-a-driver-for-the-RPi-firmware-UART.patch | 630 +++ ...-overlay-for-the-Raspberry-Pi-firmwa.patch | 95 + ...0-1436-ARM-dts-Remove-duplicate-tags.patch | 142 + ...C-clock-frequency-via-i2c_arm_baudra.patch | 25 + ...pci-Disable-Host-Memory-Buffer-usage.patch | 48 + ...-Add-a-driver-for-the-RPi-firmware-U.patch | 23 + ...pi-fw-uart-Demote-debug-log-messages.patch | 28 + ...lays-Add-Arducam-override-for-ov9281.patch | 55 + ...uchscreen-Add-support-for-no-irq-to-.patch | 118 + ...panel-Added-waveshare-13.3inch-panel.patch | 309 ++ ...s-overlays-Added-waveshare-13.3inch-.patch | 46 + ...-kernel-command-line-to-disable-memo.patch | 37 + ...c-ov9282-Correct-the-exposure-offset.patch | 31 + ...4-hvs-Don-t-write-gamma-luts-on-2711.patch | 22 + ...arn-if-no-host-bridge-NUMA-node-info.patch | 29 + ...-Connector-to-allow-interlaced-modes.patch | 25 + ...-kms-dpi-generic-overlay-Add-interla.patch | 34 + ...Add-interlaced-modes-and-PIO-program.patch | 4 +- ...pwm-Improve-PWM_PIO_RP1-dependencies.patch | 22 - ...pwm-Improve-PWM_PIO_RP1-dependencies.patch | 20 - ...no-dac-plus-Fix-volume-limit-locking.patch | 79 + ...ot-allow-24bpp-formats-when-transpos.patch | 30 + ...nector-rotation-has-one-bit-set-in-t.patch | 29 + ...o-piano-dac-plus-Suppress-517-errors.patch | 73 + ...i-Fix-optional-dependency-on-RP1_PIO.patch | 3 +- ...-announce-support-for-SER_RS485_RTS_.patch | 42 + ...verride-for-target-path-on-I2C-overl.patch | 550 +++ ...p1-pio-Support-larger-data-transfers.patch | 2 +- ...Use-continuous-clock-mode-for-ov9281.patch | 34 + ...ys-goodix-Allow-override-i2c-address.patch | 36 + ...0-1471-fixup-misc-Add-RP1-PIO-driver.patch | 2 +- ...-rp1-pio-More-logical-probe-sequence.patch | 2 +- ...o-Convert-floats-to-24.8-fixed-point.patch | 2 +- ...5-misc-rp1-pio-Minor-cosmetic-tweaks.patch | 2 +- ...sc-rp1-pio-Add-in-kernel-DMA-support.patch | 2 +- ...-1477-misc-Add-ws2812-pio-rp1-driver.patch | 2 +- ...1478-overlays-Add-ws2812-pio-overlay.patch | 6 +- ...and-document-i2c_csi_dsi0-parameters.patch | 342 ++ ...d-noanthogs-parameter-to-CM4-and-CM5.patch | 56 + 114 files changed, 10583 insertions(+), 131 deletions(-) delete mode 100644 target/linux/bcm27xx/patches-6.6/950-1267-dts-rp1-Disable-DMA-usage-for-UART0.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1351-drivers-media-bcm2835_isp-Cache-LS-table-dmabuf.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1353-pwm-Add-GPIO-PWM-driver.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1355-dtoverlay-Add-a-dtoverlay-for-pwm-gpio.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1356-dts-2712-Drop-some-numa-options-from-bootargs.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1357-mmc-quirks-add-more-broken-Kingston-Canvas-Go-SD-car.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1358-dt-bindings-usb-snps-dwc3-add-FS-HS-periodic-NAK-pol.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1359-usb-dwc3-core-add-support-for-setting-NAK-enhancemen.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1360-DTS-rp1-set-enhanced-FS-NAK-quirk-for-usb3-controlle.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1361-drivers-usb-xhci-prevent-a-theoretical-race-on-non-c.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1362-iio-humidity-dht11-Allow-non-zero-decimals.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1363-drm-vc4-Correct-condition-for-ignoring-a-plane-to-sr.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1364-drm-vc4-Use-the-TPZ-scaling-filter-for-1x1-source-im.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1365-drm-Set-non-desktop-property-to-true-for-writeback-a.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1366-drm-Increase-plane_mask-to-64bit.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1367-drm-vc4-Increase-number-of-overlay-planes-from-16-to.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1368-drm-vc4-Assign-32-overlay-planes-to-writeback-only.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1369-drm-Add-a-DRM_MODE_TRANSPOSE-option-to-the-DRM-rotat.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1370-drm-Add-a-rotation-parameter-to-connectors.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1371-drm-vc4-txp-Add-a-rotation-property-to-the-writeback.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1372-dmaengine-dw-axi-dmac-Allow-client-chosen-width.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1373-spi-dw-Let-the-DMAC-set-the-transfer-widths.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1374-serial-pl011-Request-a-memory-width-of-1-byte.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1377-drivers-usb-xhci-set-HID-bit-in-streaming-endpoint-c.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1379-media-i2c-imx477-Add-options-for-slightly-modifying-.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1380-dtoverlays-Add-link-frequency-override-to-imx477-378.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1381-dmaengine-dw-axi-dmac-Only-start-idle-channels.patch rename target/linux/bcm27xx/patches-6.6/{950-1351-mailbox-Add-RP1-mailbox-support.patch => 950-1382-mailbox-Add-RP1-mailbox-support.patch} (100%) rename target/linux/bcm27xx/patches-6.6/{950-1352-firmware-Add-an-RP1-firmware-interface.patch => 950-1383-firmware-Add-an-RP1-firmware-interface-over-mbox.patch} (100%) rename target/linux/bcm27xx/patches-6.6/{950-1353-misc-Add-RP1-PIO-driver.patch => 950-1384-misc-Add-RP1-PIO-driver.patch} (100%) create mode 100644 target/linux/bcm27xx/patches-6.6/950-1386-dts-bcm2712-rpi-Add-RP1-firmware-and-mailboxes.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1387-dts-bcm2712-rpi-Add-the-RP1-PIO-device.patch rename target/linux/bcm27xx/patches-6.6/{950-1355-misc-rp1-pio-Add-an-in-kernel.patch => 950-1388-misc-rp1-pio-Add-an-in-kernel-API.patch} (100%) rename target/linux/bcm27xx/patches-6.6/{950-1356-pwm-Add-pwm-pio-rp1-driver.patch => 950-1389-pwm-Add-pwm-pio-rp1-driver.patch} (98%) create mode 100644 target/linux/bcm27xx/patches-6.6/950-1391-overlays-Add-pwm-pio-overlay.patch rename target/linux/bcm27xx/patches-6.6/{950-1354-fixup-musc-add-RP1-PIO-driver.patch => 950-1392-fixup-misc-Add-RP1-PIO-driver.patch} (100%) rename target/linux/bcm27xx/patches-6.6/{950-0998-i2c-designware-Add-support-for-bus-clear-feature.patch => 950-1396-i2c-designware-Add-support-for-bus-clear-feature.patch} (93%) create mode 100644 target/linux/bcm27xx/patches-6.6/950-1397-drivers-media-pci-Update-Hailo-accelerator-device-dr.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1398-dtoverlays-enable-SPI-CS-active-high.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1399-drm-vc4-hvs-Defer-updating-the-enable_bg_fill-until-.patch rename target/linux/bcm27xx/patches-6.6/{950-1359-misc-rp1-pio-Add-FIFO.patch => 950-1400-misc-rp1-pio-Add-FIFO-related-methods.patch} (98%) create mode 100644 target/linux/bcm27xx/patches-6.6/950-1401-overlays-Enable-Raspberry-Touch-2-rotation-with-over.patch rename target/linux/bcm27xx/patches-6.6/{950-1357-rpi-pio-add-missing.patch => 950-1402-rp1-pio-Add-missing-static-inline-s.patch} (88%) rename target/linux/bcm27xx/patches-6.6/{950-1358-misc-rpi-pio-back-port-some.patch => 950-1403-misc-rp1-pio-Back-port-some-6.11-build-fixes.patch} (100%) create mode 100644 target/linux/bcm27xx/patches-6.6/950-1404-Adding-Pimidi-kernel-module.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1406-Adding-pimidi-overlay.dts.patch rename target/linux/bcm27xx/patches-6.6/{950-0297-staging-vchiq_arm-Add-36-bit-address-support.patch => 950-1411-staging-vchiq_arm-Add-36-bit-address-support.patch} (98%) rename target/linux/bcm27xx/patches-6.6/{950-0298-staging-vchiq_arm-children-inherit-DMA-config.patch => 950-1412-staging-vchiq_arm-children-inherit-DMA-config.patch} (87%) rename target/linux/bcm27xx/patches-6.6/{950-0299-staging-vchiq_arm-Usa-a-DMA-pool-for-small-bulks.patch => 950-1413-staging-vchiq_arm-Usa-a-DMA-pool-for-small-bulks.patch} (96%) rename target/linux/bcm27xx/patches-6.6/{950-0365-staging-vchiq_arm-Add-log_level-module-params.patch => 950-1414-staging-vchiq_arm-Add-log_level-module-params.patch} (88%) create mode 100644 target/linux/bcm27xx/patches-6.6/950-1415-media-i2c-imx477-Fix-link-frequency-menu.patch rename target/linux/bcm27xx/patches-6.6/{950-1357-misc-rp1-pio-Fix-copy-paste-error-in-pio_rp1.h.patch => 950-1416-misc-rp1-pio-Fix-copy-paste-error-in-pio_rp1.h.patch} (93%) rename target/linux/bcm27xx/patches-6.6/{950-1360-misc-rp1-pio-Fix-parameter-checks-wihout-client.patch => 950-1417-misc-rp1-pio-Fix-parameter-checks-wihout-client.patch} (100%) create mode 100644 target/linux/bcm27xx/patches-6.6/950-1418-drm-vc4-dsi-Handle-the-different-command-FIFO-widths.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1419-dts-bcm2712-rpi-For-CM5IO-i2c_csi_dsi-needs-to-be-CA.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1420-dts-bcm2712-rpi-cm5-Remove-inaccessible-USB_OC_N.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1421-overlays-qca7000-replace-URL-with-textual-hint.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1422-dt-bindings-net-cdns-macb-Add-compatible-for-Raspber.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1431-raspberrypi-firmware-Add-the-RPI-firmware-UART-APIs.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1432-serial-core-Add-the-Raspberry-Pi-firmware-UART-id.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1433-serial-tty-Add-a-driver-for-the-RPi-firmware-UART.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1435-dtoverlay-Add-an-overlay-for-the-Raspberry-Pi-firmwa.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1436-ARM-dts-Remove-duplicate-tags.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1437-Allow-setting-I-C-clock-frequency-via-i2c_arm_baudra.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1438-nvme-pci-Disable-Host-Memory-Buffer-usage.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1439-fixup-serial-tty-Add-a-driver-for-the-RPi-firmware-U.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1440-serial-rpi-fw-uart-Demote-debug-log-messages.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1441-dtoverlays-Add-Arducam-override-for-ov9281.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1442-drivers-input-touchscreen-Add-support-for-no-irq-to-.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1443-drivers-gpu-drm-panel-Added-waveshare-13.3inch-panel.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1444-arch-arm-boot-dts-overlays-Added-waveshare-13.3inch-.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1445-fixup-cgroup-Use-kernel-command-line-to-disable-memo.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1446-media-i2c-ov9282-Correct-the-exposure-offset.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1451-Revert-drm-vc4-hvs-Don-t-write-gamma-luts-on-2711.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1452-Revert-PCI-Warn-if-no-host-bridge-NUMA-node-info.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1454-drm-bridge-panel-Connector-to-allow-interlaced-modes.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1455-dts-overlays-vc4-kms-dpi-generic-overlay-Add-interla.patch delete mode 100644 target/linux/bcm27xx/patches-6.6/950-1457-pwm-Improve-PWM_PIO_RP1-dependencies.patch delete mode 100644 target/linux/bcm27xx/patches-6.6/950-1458-Revert-pwm-Improve-PWM_PIO_RP1-dependencies.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1459-ASoC-allo-piano-dac-plus-Fix-volume-limit-locking.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1460-drm-vc4-txp-Do-not-allow-24bpp-formats-when-transpos.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1461-drm-Validate-connector-rotation-has-one-bit-set-in-t.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1462-ASoC-allo-piano-dac-plus-Suppress-517-errors.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1464-serial-sc16is7xx-announce-support-for-SER_RS485_RTS_.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1467-dtoverlays-Add-override-for-target-path-on-I2C-overl.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1469-dtoverlays-Use-continuous-clock-mode-for-ov9281.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1470-overlays-goodix-Allow-override-i2c-address.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1480-overlays-Add-and-document-i2c_csi_dsi0-parameters.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1481-dts-Add-noanthogs-parameter-to-CM4-and-CM5.patch diff --git a/target/linux/bcm27xx/bcm2708/config-6.6 b/target/linux/bcm27xx/bcm2708/config-6.6 index b587b5d7198b2c..a8a3cc9af7c806 100644 --- a/target/linux/bcm27xx/bcm2708/config-6.6 +++ b/target/linux/bcm27xx/bcm2708/config-6.6 @@ -314,6 +314,7 @@ CONFIG_PRINTK_TIME=y CONFIG_PTP_1588_CLOCK_OPTIONAL=y CONFIG_PWM=y CONFIG_PWM_BCM2835=y +CONFIG_PWM_GPIO=y CONFIG_PWM_SYSFS=y CONFIG_RANDSTRUCT_NONE=y CONFIG_RASPBERRYPI_FIRMWARE=y @@ -346,6 +347,7 @@ CONFIG_SERIAL_DEV_BUS=y # CONFIG_SERIAL_DEV_CTRL_TTYPORT is not set CONFIG_SERIAL_MCTRL_GPIO=y CONFIG_SERIAL_OF_PLATFORM=y +CONFIG_SERIAL_RPI_FW=y CONFIG_SG_POOL=y CONFIG_SMSC_PHY=y CONFIG_SOFTIRQ_ON_OWN_STACK=y diff --git a/target/linux/bcm27xx/bcm2709/config-6.6 b/target/linux/bcm27xx/bcm2709/config-6.6 index 4a295d52c86030..edcc8f58cc2569 100644 --- a/target/linux/bcm27xx/bcm2709/config-6.6 +++ b/target/linux/bcm27xx/bcm2709/config-6.6 @@ -398,6 +398,7 @@ CONFIG_PTP_1588_CLOCK=y CONFIG_PTP_1588_CLOCK_OPTIONAL=y CONFIG_PWM=y CONFIG_PWM_BCM2835=y +CONFIG_PWM_GPIO=y CONFIG_PWM_SYSFS=y CONFIG_RANDSTRUCT_NONE=y CONFIG_RAS=y @@ -435,6 +436,7 @@ CONFIG_SERIAL_DEV_BUS=y # CONFIG_SERIAL_DEV_CTRL_TTYPORT is not set CONFIG_SERIAL_MCTRL_GPIO=y CONFIG_SERIAL_OF_PLATFORM=y +CONFIG_SERIAL_RPI_FW=y CONFIG_SG_POOL=y CONFIG_SMP=y CONFIG_SMP_ON_UP=y diff --git a/target/linux/bcm27xx/bcm2710/config-6.6 b/target/linux/bcm27xx/bcm2710/config-6.6 index 97f2f110b06500..18a9c26b01d494 100644 --- a/target/linux/bcm27xx/bcm2710/config-6.6 +++ b/target/linux/bcm27xx/bcm2710/config-6.6 @@ -389,6 +389,7 @@ CONFIG_PRINTK_TIME=y CONFIG_PTP_1588_CLOCK_OPTIONAL=y CONFIG_PWM=y CONFIG_PWM_BCM2835=y +CONFIG_PWM_GPIO=y CONFIG_PWM_SYSFS=y CONFIG_QUEUED_RWLOCKS=y CONFIG_QUEUED_SPINLOCKS=y @@ -428,6 +429,7 @@ CONFIG_SERIAL_DEV_BUS=y # CONFIG_SERIAL_DEV_CTRL_TTYPORT is not set CONFIG_SERIAL_MCTRL_GPIO=y CONFIG_SERIAL_OF_PLATFORM=y +CONFIG_SERIAL_RPI_FW=y CONFIG_SG_POOL=y CONFIG_SMP=y CONFIG_SMSC_PHY=y diff --git a/target/linux/bcm27xx/bcm2711/config-6.6 b/target/linux/bcm27xx/bcm2711/config-6.6 index f9b74696073042..a48771b8e70863 100644 --- a/target/linux/bcm27xx/bcm2711/config-6.6 +++ b/target/linux/bcm27xx/bcm2711/config-6.6 @@ -405,6 +405,7 @@ CONFIG_PTP_1588_CLOCK=y CONFIG_PTP_1588_CLOCK_OPTIONAL=y CONFIG_PWM=y CONFIG_PWM_BCM2835=y +CONFIG_PWM_GPIO=y CONFIG_PWM_SYSFS=y CONFIG_QUEUED_RWLOCKS=y CONFIG_QUEUED_SPINLOCKS=y @@ -445,6 +446,7 @@ CONFIG_SERIAL_DEV_BUS=y # CONFIG_SERIAL_DEV_CTRL_TTYPORT is not set CONFIG_SERIAL_MCTRL_GPIO=y CONFIG_SERIAL_OF_PLATFORM=y +CONFIG_SERIAL_RPI_FW=y CONFIG_SG_POOL=y CONFIG_SMP=y CONFIG_SOCK_RX_QUEUE_MAPPING=y diff --git a/target/linux/bcm27xx/bcm2712/config-6.6 b/target/linux/bcm27xx/bcm2712/config-6.6 index 5ed564f5ab9f42..9dac0688df3d11 100644 --- a/target/linux/bcm27xx/bcm2712/config-6.6 +++ b/target/linux/bcm27xx/bcm2712/config-6.6 @@ -513,6 +513,7 @@ CONFIG_PTP_1588_CLOCK_OPTIONAL=y CONFIG_PWM=y CONFIG_PWM_BCM2835=y CONFIG_PWM_BRCMSTB=y +CONFIG_PWM_GPIO=y CONFIG_PWM_RP1=y CONFIG_PWM_SYSFS=y CONFIG_QUEUED_RWLOCKS=y @@ -577,6 +578,7 @@ CONFIG_SPARSEMEM_VMEMMAP=y CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y CONFIG_SPARSE_IRQ=y CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU=y +CONFIG_SRAM=y # CONFIG_STRIP_ASM_SYMS is not set CONFIG_SUSPEND=y CONFIG_SUSPEND_FREEZER=y diff --git a/target/linux/bcm27xx/config-6.6 b/target/linux/bcm27xx/config-6.6 index 50ca86f58508d2..e69dbf5d74584d 100644 --- a/target/linux/bcm27xx/config-6.6 +++ b/target/linux/bcm27xx/config-6.6 @@ -28,6 +28,8 @@ # CONFIG_REGULATOR_RASPBERRYPI_TOUCHSCREEN_V2 is not set # CONFIG_RP1_PIO is not set # CONFIG_SENSORS_RP1_ADC is not set +# CONFIG_SERIAL_RPI_FW is not set +# CONFIG_SND_PIMIDI is not set # CONFIG_SPI_RP2040_GPIO_BRIDGE is not set # CONFIG_VIDEO_AD5398 is not set # CONFIG_VIDEO_ARDUCAM_64MP is not set diff --git a/target/linux/bcm27xx/patches-6.6/950-1267-dts-rp1-Disable-DMA-usage-for-UART0.patch b/target/linux/bcm27xx/patches-6.6/950-1267-dts-rp1-Disable-DMA-usage-for-UART0.patch deleted file mode 100644 index c809c4f10b60f6..00000000000000 --- a/target/linux/bcm27xx/patches-6.6/950-1267-dts-rp1-Disable-DMA-usage-for-UART0.patch +++ /dev/null @@ -1,34 +0,0 @@ -From cc63d552b9aab92fb581dfb08267d5af697f477b Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Wed, 18 Sep 2024 16:45:24 +0100 -Subject: [PATCH 1267/1350] dts: rp1: Disable DMA usage for UART0 - -Some recent DMA changes have led to data loss in UART0 on Pi 5. It also -seems that even prior to these changes there was a problem with aborted -transfers. - -As this is the only RP1 UART configured for DMA, it is better to remove -the DMA usage until it is shown to be reliable. - -Link: https://github.com/raspberrypi/linux/issues/6365 - -Signed-off-by: Phil Elwell ---- - arch/arm64/boot/dts/broadcom/rp1.dtsi | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - ---- a/arch/arm64/boot/dts/broadcom/rp1.dtsi -+++ b/arch/arm64/boot/dts/broadcom/rp1.dtsi -@@ -55,9 +55,9 @@ - interrupts = ; - clocks = <&rp1_clocks RP1_CLK_UART &rp1_clocks RP1_PLL_SYS_PRI_PH>; - clock-names = "uartclk", "apb_pclk"; -- dmas = <&rp1_dma RP1_DMA_UART0_TX>, -- <&rp1_dma RP1_DMA_UART0_RX>; -- dma-names = "tx", "rx"; -+ // dmas = <&rp1_dma RP1_DMA_UART0_TX>, -+ // <&rp1_dma RP1_DMA_UART0_RX>; -+ // dma-names = "tx", "rx"; - pinctrl-names = "default"; - arm,primecell-periphid = <0x00541011>; - uart-has-rtscts; diff --git a/target/linux/bcm27xx/patches-6.6/950-1351-drivers-media-bcm2835_isp-Cache-LS-table-dmabuf.patch b/target/linux/bcm27xx/patches-6.6/950-1351-drivers-media-bcm2835_isp-Cache-LS-table-dmabuf.patch new file mode 100644 index 00000000000000..1f5ed7545b0a5f --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1351-drivers-media-bcm2835_isp-Cache-LS-table-dmabuf.patch @@ -0,0 +1,141 @@ +From 25e6acfe00f589a5989ebd2c8d21a130fb3bf106 Mon Sep 17 00:00:00 2001 +From: Naushir Patuck +Date: Fri, 18 Oct 2024 09:18:10 +0100 +Subject: [PATCH] drivers: media: bcm2835_isp: Cache LS table dmabuf + +Clients such as libcamera do not change the LS table dmabuf on every +frame. In such cases instead of mapping/remapping the same dmabuf on +every frame to send to the firmware, cache the dmabuf once and only +update and remap if the dmabuf has been changed by the userland client. + +Signed-off-by: Naushir Patuck +--- + .../bcm2835-isp/bcm2835-v4l2-isp.c | 77 +++++++++++-------- + 1 file changed, 46 insertions(+), 31 deletions(-) + +--- a/drivers/staging/vc04_services/bcm2835-isp/bcm2835-v4l2-isp.c ++++ b/drivers/staging/vc04_services/bcm2835-isp/bcm2835-v4l2-isp.c +@@ -139,6 +139,8 @@ struct bcm2835_isp_dev { + /* Image pipeline controls. */ + int r_gain; + int b_gain; ++ struct dma_buf *last_ls_dmabuf; ++ struct mmal_parameter_lens_shading_v2 ls; + }; + + struct bcm2835_isp_buffer { +@@ -657,18 +659,18 @@ static void bcm2835_isp_node_stop_stream + atomic_dec(&dev->num_streaming); + /* If all ports disabled, then disable the component */ + if (atomic_read(&dev->num_streaming) == 0) { +- struct bcm2835_isp_lens_shading ls; + /* + * The ISP component on the firmware has a reference to the + * dmabuf handle for the lens shading table. Pass a null handle + * to remove that reference now. + */ +- memset(&ls, 0, sizeof(ls)); ++ memset(&dev->ls, 0, sizeof(dev->ls)); + /* Must set a valid grid size for the FW */ +- ls.grid_cell_size = 16; ++ dev->ls.grid_cell_size = 16; + set_isp_param(&dev->node[0], + MMAL_PARAMETER_LENS_SHADING_OVERRIDE, +- &ls, sizeof(ls)); ++ &dev->ls, sizeof(dev->ls)); ++ dev->last_ls_dmabuf = NULL; + + ret = vchiq_mmal_component_disable(dev->mmal_instance, + dev->component); +@@ -719,6 +721,36 @@ static inline unsigned int get_sizeimage + return (bpl * height * fmt->size_multiplier_x2) >> 1; + } + ++static int map_ls_table(struct bcm2835_isp_dev *dev, struct dma_buf *dmabuf, ++ const struct bcm2835_isp_lens_shading *v4l2_ls) ++{ ++ void *vcsm_handle; ++ int ret; ++ ++ if (IS_ERR_OR_NULL(dmabuf)) ++ return -EINVAL; ++ ++ /* ++ * struct bcm2835_isp_lens_shading and struct ++ * mmal_parameter_lens_shading_v2 match so that we can do a ++ * simple memcpy here. ++ * Only the dmabuf to the actual table needs any manipulation. ++ */ ++ memcpy(&dev->ls, v4l2_ls, sizeof(dev->ls)); ++ ret = vc_sm_cma_import_dmabuf(dmabuf, &vcsm_handle); ++ if (ret) { ++ dma_buf_put(dmabuf); ++ return ret; ++ } ++ ++ dev->ls.mem_handle_table = vc_sm_cma_int_handle(vcsm_handle); ++ dev->last_ls_dmabuf = dmabuf; ++ ++ vc_sm_cma_free(vcsm_handle); ++ ++ return 0; ++} ++ + static int bcm2835_isp_s_ctrl(struct v4l2_ctrl *ctrl) + { + struct bcm2835_isp_dev *dev = +@@ -754,44 +786,27 @@ static int bcm2835_isp_s_ctrl(struct v4l + case V4L2_CID_USER_BCM2835_ISP_LENS_SHADING: + { + struct bcm2835_isp_lens_shading *v4l2_ls; +- struct mmal_parameter_lens_shading_v2 ls; +- struct dma_buf *dmabuf; +- void *vcsm_handle; + + v4l2_ls = (struct bcm2835_isp_lens_shading *)ctrl->p_new.p_u8; +- /* +- * struct bcm2835_isp_lens_shading and struct +- * mmal_parameter_lens_shading_v2 match so that we can do a +- * simple memcpy here. +- * Only the dmabuf to the actual table needs any manipulation. +- */ +- memcpy(&ls, v4l2_ls, sizeof(ls)); ++ struct dma_buf *dmabuf = dma_buf_get(v4l2_ls->dmabuf); + +- dmabuf = dma_buf_get(v4l2_ls->dmabuf); +- if (IS_ERR_OR_NULL(dmabuf)) +- return -EINVAL; +- +- ret = vc_sm_cma_import_dmabuf(dmabuf, &vcsm_handle); +- if (ret) { +- dma_buf_put(dmabuf); +- return -EINVAL; +- } ++ if (dmabuf != dev->last_ls_dmabuf) ++ ret = map_ls_table(dev, dmabuf, v4l2_ls); + +- ls.mem_handle_table = vc_sm_cma_int_handle(vcsm_handle); +- if (ls.mem_handle_table) +- /* The VPU will take a reference on the vcsm handle, ++ if (!ret && dev->ls.mem_handle_table) ++ /* ++ * The VPU will take a reference on the vcsm handle, + * which in turn will retain a reference on the dmabuf. + * This code can therefore safely release all + * references to the buffer. + */ +- ret = set_isp_param(node, +- MMAL_PARAMETER_LENS_SHADING_OVERRIDE, +- &ls, +- sizeof(ls)); ++ ret = ++ set_isp_param(node, ++ MMAL_PARAMETER_LENS_SHADING_OVERRIDE, ++ &dev->ls, sizeof(dev->ls)); + else + ret = -EINVAL; + +- vc_sm_cma_free(vcsm_handle); + dma_buf_put(dmabuf); + break; + } diff --git a/target/linux/bcm27xx/patches-6.6/950-1353-pwm-Add-GPIO-PWM-driver.patch b/target/linux/bcm27xx/patches-6.6/950-1353-pwm-Add-GPIO-PWM-driver.patch new file mode 100644 index 00000000000000..5b89f60bca8fee --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1353-pwm-Add-GPIO-PWM-driver.patch @@ -0,0 +1,330 @@ +From 3ab72fc21ea8576e59f6aad10bd6b1a0eae6e5eb Mon Sep 17 00:00:00 2001 +From: Vincent Whitchurch +Date: Tue, 4 Jun 2024 23:00:41 +0200 +Subject: [PATCH] pwm: Add GPIO PWM driver +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +commit 7f61257cd6e1ad4769b4b819668cab00f68f2556 upstream. + +Add a software PWM which toggles a GPIO from a high-resolution timer. + +This will naturally not be as accurate or as efficient as a hardware +PWM, but it is useful in some cases. I have for example used it for +evaluating LED brightness handling (via leds-pwm) on a board where the +LED was just hooked up to a GPIO, and for a simple verification of the +timer frequency on another platform. + +Since high-resolution timers are used, sleeping GPIO chips are not +supported and are rejected in the probe function. + +Signed-off-by: Vincent Whitchurch +Co-developed-by: Stefan Wahren +Signed-off-by: Stefan Wahren +Co-developed-by: Linus Walleij +Reviewed-by: Andy Shevchenko +Signed-off-by: Linus Walleij +Reviewed-by: Dhruva Gole +Link: https://lore.kernel.org/r/20240604-pwm-gpio-v7-2-6b67cf60db92@linaro.org +Signed-off-by: Uwe Kleine-König +Signed-off-by: Tim Gover + +pwm: Backport pwm-gpio.c to rpi-6.6.y +--- + .../driver-api/gpio/drivers-on-gpio.rst | 7 +- + drivers/pwm/Kconfig | 11 + + drivers/pwm/Makefile | 1 + + drivers/pwm/pwm-gpio.c | 240 ++++++++++++++++++ + 4 files changed, 258 insertions(+), 1 deletion(-) + create mode 100644 drivers/pwm/pwm-gpio.c + +--- a/Documentation/driver-api/gpio/drivers-on-gpio.rst ++++ b/Documentation/driver-api/gpio/drivers-on-gpio.rst +@@ -27,7 +27,12 @@ hardware descriptions such as device tre + to the lines for a more permanent solution of this type. + + - gpio-beeper: drivers/input/misc/gpio-beeper.c is used to provide a beep from +- an external speaker connected to a GPIO line. ++ an external speaker connected to a GPIO line. (If the beep is controlled by ++ off/on, for an actual PWM waveform, see pwm-gpio below.) ++ ++- pwm-gpio: drivers/pwm/pwm-gpio.c is used to toggle a GPIO with a high ++ resolution timer producing a PWM waveform on the GPIO line, as well as ++ Linux high resolution timers can do. + + - extcon-gpio: drivers/extcon/extcon-gpio.c is used when you need to read an + external connector status, such as a headset line for an audio driver or an +--- a/drivers/pwm/Kconfig ++++ b/drivers/pwm/Kconfig +@@ -217,6 +217,17 @@ config PWM_FSL_FTM + To compile this driver as a module, choose M here: the module + will be called pwm-fsl-ftm. + ++config PWM_GPIO ++ tristate "GPIO PWM support" ++ depends on GPIOLIB ++ depends on HIGH_RES_TIMERS ++ help ++ Generic PWM framework driver for software PWM toggling a GPIO pin ++ from kernel high-resolution timers. ++ ++ To compile this driver as a module, choose M here: the module ++ will be called pwm-gpio. ++ + config PWM_HIBVT + tristate "HiSilicon BVT PWM support" + depends on ARCH_HISI || COMPILE_TEST +--- a/drivers/pwm/Makefile ++++ b/drivers/pwm/Makefile +@@ -18,6 +18,7 @@ obj-$(CONFIG_PWM_CROS_EC) += pwm-cros-ec + obj-$(CONFIG_PWM_DWC) += pwm-dwc.o + obj-$(CONFIG_PWM_EP93XX) += pwm-ep93xx.o + obj-$(CONFIG_PWM_FSL_FTM) += pwm-fsl-ftm.o ++obj-$(CONFIG_PWM_GPIO) += pwm-gpio.o + obj-$(CONFIG_PWM_HIBVT) += pwm-hibvt.o + obj-$(CONFIG_PWM_IMG) += pwm-img.o + obj-$(CONFIG_PWM_IMX1) += pwm-imx1.o +--- /dev/null ++++ b/drivers/pwm/pwm-gpio.c +@@ -0,0 +1,240 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * Generic software PWM for modulating GPIOs ++ * ++ * Copyright (C) 2020 Axis Communications AB ++ * Copyright (C) 2020 Nicola Di Lieto ++ * Copyright (C) 2024 Stefan Wahren ++ * Copyright (C) 2024 Linus Walleij ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++struct pwm_gpio { ++ struct hrtimer gpio_timer; ++ struct gpio_desc *gpio; ++ struct pwm_state state; ++ struct pwm_state next_state; ++ ++ /* Protect internal state between pwm_ops and hrtimer */ ++ spinlock_t lock; ++ ++ bool changing; ++ bool running; ++ bool level; ++ struct pwm_chip chip; ++}; ++ ++static void pwm_gpio_round(struct pwm_state *dest, const struct pwm_state *src) ++{ ++ u64 dividend; ++ u32 remainder; ++ ++ *dest = *src; ++ ++ /* Round down to hrtimer resolution */ ++ dividend = dest->period; ++ remainder = do_div(dividend, hrtimer_resolution); ++ dest->period -= remainder; ++ ++ dividend = dest->duty_cycle; ++ remainder = do_div(dividend, hrtimer_resolution); ++ dest->duty_cycle -= remainder; ++} ++ ++static u64 pwm_gpio_toggle(struct pwm_gpio *gpwm, bool level) ++{ ++ const struct pwm_state *state = &gpwm->state; ++ bool invert = state->polarity == PWM_POLARITY_INVERSED; ++ ++ gpwm->level = level; ++ gpiod_set_value(gpwm->gpio, gpwm->level ^ invert); ++ ++ if (!state->duty_cycle || state->duty_cycle == state->period) { ++ gpwm->running = false; ++ return 0; ++ } ++ ++ gpwm->running = true; ++ return level ? state->duty_cycle : state->period - state->duty_cycle; ++} ++ ++static enum hrtimer_restart pwm_gpio_timer(struct hrtimer *gpio_timer) ++{ ++ struct pwm_gpio *gpwm = container_of(gpio_timer, struct pwm_gpio, ++ gpio_timer); ++ u64 next_toggle; ++ bool new_level; ++ ++ guard(spinlock_irqsave)(&gpwm->lock); ++ ++ /* Apply new state at end of current period */ ++ if (!gpwm->level && gpwm->changing) { ++ gpwm->changing = false; ++ gpwm->state = gpwm->next_state; ++ new_level = !!gpwm->state.duty_cycle; ++ } else { ++ new_level = !gpwm->level; ++ } ++ ++ next_toggle = pwm_gpio_toggle(gpwm, new_level); ++ if (next_toggle) ++ hrtimer_forward(gpio_timer, hrtimer_get_expires(gpio_timer), ++ ns_to_ktime(next_toggle)); ++ ++ return next_toggle ? HRTIMER_RESTART : HRTIMER_NORESTART; ++} ++ ++static int pwm_gpio_apply(struct pwm_chip *chip, struct pwm_device *pwm, ++ const struct pwm_state *state) ++{ ++ struct pwm_gpio *gpwm = container_of(chip, struct pwm_gpio, chip); ++ bool invert = state->polarity == PWM_POLARITY_INVERSED; ++ ++ if (state->duty_cycle && state->duty_cycle < hrtimer_resolution) ++ return -EINVAL; ++ ++ if (state->duty_cycle != state->period && ++ (state->period - state->duty_cycle < hrtimer_resolution)) ++ return -EINVAL; ++ ++ if (!state->enabled) { ++ hrtimer_cancel(&gpwm->gpio_timer); ++ } else if (!gpwm->running) { ++ int ret; ++ ++ /* ++ * This just enables the output, but pwm_gpio_toggle() ++ * really starts the duty cycle. ++ */ ++ ret = gpiod_direction_output(gpwm->gpio, invert); ++ if (ret) ++ return ret; ++ } ++ ++ guard(spinlock_irqsave)(&gpwm->lock); ++ ++ if (!state->enabled) { ++ pwm_gpio_round(&gpwm->state, state); ++ gpwm->running = false; ++ gpwm->changing = false; ++ ++ gpiod_set_value(gpwm->gpio, invert); ++ } else if (gpwm->running) { ++ pwm_gpio_round(&gpwm->next_state, state); ++ gpwm->changing = true; ++ } else { ++ unsigned long next_toggle; ++ ++ pwm_gpio_round(&gpwm->state, state); ++ gpwm->changing = false; ++ ++ next_toggle = pwm_gpio_toggle(gpwm, !!state->duty_cycle); ++ if (next_toggle) ++ hrtimer_start(&gpwm->gpio_timer, next_toggle, ++ HRTIMER_MODE_REL); ++ } ++ ++ return 0; ++} ++ ++static int pwm_gpio_get_state(struct pwm_chip *chip, struct pwm_device *pwm, ++ struct pwm_state *state) ++{ ++ struct pwm_gpio *gpwm = container_of(chip, struct pwm_gpio, chip); ++ ++ guard(spinlock_irqsave)(&gpwm->lock); ++ ++ if (gpwm->changing) ++ *state = gpwm->next_state; ++ else ++ *state = gpwm->state; ++ ++ return 0; ++} ++ ++static const struct pwm_ops pwm_gpio_ops = { ++ .apply = pwm_gpio_apply, ++ .get_state = pwm_gpio_get_state, ++}; ++ ++static void pwm_gpio_disable_hrtimer(void *data) ++{ ++ struct pwm_gpio *gpwm = data; ++ ++ hrtimer_cancel(&gpwm->gpio_timer); ++} ++ ++static int pwm_gpio_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct pwm_chip *chip; ++ struct pwm_gpio *gpwm; ++ int ret; ++ ++ gpwm = devm_kzalloc(&pdev->dev, sizeof(*gpwm), GFP_KERNEL); ++ if (IS_ERR(gpwm)) ++ return PTR_ERR(gpwm); ++ ++ chip = &gpwm->chip; ++ ++ spin_lock_init(&gpwm->lock); ++ ++ gpwm->gpio = devm_gpiod_get(dev, NULL, GPIOD_ASIS); ++ if (IS_ERR(gpwm->gpio)) ++ return dev_err_probe(dev, PTR_ERR(gpwm->gpio), ++ "%pfw: could not get gpio\n", ++ dev_fwnode(dev)); ++ ++ if (gpiod_cansleep(gpwm->gpio)) ++ return dev_err_probe(dev, -EINVAL, ++ "%pfw: sleeping GPIO not supported\n", ++ dev_fwnode(dev)); ++ ++ chip->dev = dev; ++ chip->ops = &pwm_gpio_ops; ++ chip->atomic = true; ++ chip->npwm = 1; ++ ++ hrtimer_init(&gpwm->gpio_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); ++ ret = devm_add_action_or_reset(dev, pwm_gpio_disable_hrtimer, gpwm); ++ if (ret) ++ return ret; ++ ++ gpwm->gpio_timer.function = pwm_gpio_timer; ++ ++ return devm_pwmchip_add(dev, chip); ++} ++ ++static const struct of_device_id pwm_gpio_dt_ids[] = { ++ { .compatible = "pwm-gpio" }, ++ { /* sentinel */ } ++}; ++MODULE_DEVICE_TABLE(of, pwm_gpio_dt_ids); ++ ++static struct platform_driver pwm_gpio_driver = { ++ .driver = { ++ .name = "pwm-gpio", ++ .of_match_table = pwm_gpio_dt_ids, ++ }, ++ .probe = pwm_gpio_probe, ++}; ++module_platform_driver(pwm_gpio_driver); ++ ++MODULE_DESCRIPTION("PWM GPIO driver"); ++MODULE_AUTHOR("Vincent Whitchurch"); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/bcm27xx/patches-6.6/950-1355-dtoverlay-Add-a-dtoverlay-for-pwm-gpio.patch b/target/linux/bcm27xx/patches-6.6/950-1355-dtoverlay-Add-a-dtoverlay-for-pwm-gpio.patch new file mode 100644 index 00000000000000..65c6be6f3fd377 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1355-dtoverlay-Add-a-dtoverlay-for-pwm-gpio.patch @@ -0,0 +1,79 @@ +From ff0fe12ab875d587348b6f2b9e73ae928049ebee Mon Sep 17 00:00:00 2001 +From: Tim Gover +Date: Thu, 31 Oct 2024 16:12:54 +0000 +Subject: [PATCH] dtoverlay: Add a dtoverlay for pwm-gpio + +Signed-off-by: Tim Gover +--- + arch/arm/boot/dts/overlays/Makefile | 1 + + arch/arm/boot/dts/overlays/README | 6 +++ + .../boot/dts/overlays/pwm-gpio-overlay.dts | 38 +++++++++++++++++++ + 3 files changed, 45 insertions(+) + create mode 100644 arch/arm/boot/dts/overlays/pwm-gpio-overlay.dts + +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -217,6 +217,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ + proto-codec.dtbo \ + pwm.dtbo \ + pwm-2chan.dtbo \ ++ pwm-gpio.dtbo \ + pwm-ir-tx.dtbo \ + pwm1.dtbo \ + qca7000.dtbo \ +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -3903,6 +3903,12 @@ Params: pin Output p + clock PWM clock frequency (informational) + + ++Name: pwm-gpio ++Info: Configures the software PWM GPIO driver ++Load: dtoverlay=pwm-gpio,= ++Params: gpio Output pin (default 4) ++ ++ + Name: pwm-ir-tx + Info: Use GPIO pin as pwm-assisted infrared transmitter output. + This is an alternative to "gpio-ir-tx". pwm-ir-tx makes use +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pwm-gpio-overlay.dts +@@ -0,0 +1,38 @@ ++// Device tree overlay for software GPIO PWM. ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835"; ++ ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ pwm_gpio_pins: pwm_gpio_pins@4 { ++ brcm,pins = <4>; /* gpio 4 */ ++ brcm,function = <1>; /* output */ ++ brcm,pull = <0>; /* pull-none */ ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target-path = "/"; ++ __overlay__ { ++ pwm_gpio: pwm_gpio@4 { ++ compatible = "pwm-gpio"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pwm_gpio_pins>; ++ gpios = <&gpio 4 0>; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ gpio = <&pwm_gpio>,"gpios:4", ++ <&pwm_gpio_pins>,"brcm,pins:0", ++ /* modify reg values to allow multiple instantiation */ ++ <&pwm_gpio>,"reg:0", ++ <&pwm_gpio_pins>,"reg:0"; ++ }; ++}; diff --git a/target/linux/bcm27xx/patches-6.6/950-1356-dts-2712-Drop-some-numa-options-from-bootargs.patch b/target/linux/bcm27xx/patches-6.6/950-1356-dts-2712-Drop-some-numa-options-from-bootargs.patch new file mode 100644 index 00000000000000..245c575e2df57f --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1356-dts-2712-Drop-some-numa-options-from-bootargs.patch @@ -0,0 +1,29 @@ +From 624eb357e1a16385b3d6171e9194e4c5f8d4fd5f Mon Sep 17 00:00:00 2001 +From: Dom Cobley +Date: Wed, 23 Oct 2024 19:09:18 +0100 +Subject: [PATCH] dts: 2712: Drop some numa options from bootargs + +iommu_dma_numa_policy=interleave is not valid in the current tree +It generates an unknown setting will be passed to usespace warning + +system_heap.max_order=0 is wanted when numa is enabled, but may not +be when it is disabled. + +Add it on firmware side when we know if numa=fake= is used. + +Signed-off-by: Dom Cobley +--- + arch/arm64/boot/dts/broadcom/bcm2712-rpi.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/arm64/boot/dts/broadcom/bcm2712-rpi.dtsi ++++ b/arch/arm64/boot/dts/broadcom/bcm2712-rpi.dtsi +@@ -99,7 +99,7 @@ + + / { + chosen: chosen { +- bootargs = "reboot=w coherent_pool=1M 8250.nr_uarts=1 pci=pcie_bus_safe cgroup_disable=memory numa_policy=interleave iommu_dma_numa_policy=interleave system_heap.max_order=0"; ++ bootargs = "reboot=w coherent_pool=1M 8250.nr_uarts=1 pci=pcie_bus_safe cgroup_disable=memory numa_policy=interleave"; + stdout-path = "serial10:115200n8"; + }; + diff --git a/target/linux/bcm27xx/patches-6.6/950-1357-mmc-quirks-add-more-broken-Kingston-Canvas-Go-SD-car.patch b/target/linux/bcm27xx/patches-6.6/950-1357-mmc-quirks-add-more-broken-Kingston-Canvas-Go-SD-car.patch new file mode 100644 index 00000000000000..ef5a5a5dcb0c17 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1357-mmc-quirks-add-more-broken-Kingston-Canvas-Go-SD-car.patch @@ -0,0 +1,42 @@ +From 74f3ca5e39586ea26201fe6eaf1b9e6793b101b7 Mon Sep 17 00:00:00 2001 +From: Jonathan Bell +Date: Tue, 29 Oct 2024 13:33:21 +0000 +Subject: [PATCH] mmc: quirks: add more broken Kingston Canvas Go! SD card date + ranges + +A user has reported that a card of this model from late 2021 doesn't +work, so extend the date range and make it match on all card sizes. + +Signed-off-by: Jonathan Bell +--- + drivers/mmc/core/quirks.h | 18 +++++++++++++++--- + 1 file changed, 15 insertions(+), 3 deletions(-) + +--- a/drivers/mmc/core/quirks.h ++++ b/drivers/mmc/core/quirks.h +@@ -18,10 +18,22 @@ + static const struct mmc_fixup __maybe_unused mmc_sd_fixups[] = { + /* + * Kingston Canvas Go! Plus microSD cards never finish SD cache flush. +- * This has so far only been observed on cards from 11/2019, while new +- * cards from 2023/05 do not exhibit this behavior. ++ * This has been observed on cards from 2019/11 and 2021/11, while new ++ * cards from 2023/05 and 2024/08 do not exhibit this behavior. + */ +- _FIXUP_EXT("SD64G", CID_MANFID_KINGSTON_SD, 0x5449, 2019, 11, ++ _FIXUP_EXT(CID_NAME_ANY, CID_MANFID_KINGSTON_SD, 0x5449, 2019, CID_MONTH_ANY, ++ 0, -1ull, SDIO_ANY_ID, SDIO_ANY_ID, add_quirk_sd, ++ MMC_QUIRK_BROKEN_SD_CACHE, EXT_CSD_REV_ANY), ++ ++ _FIXUP_EXT(CID_NAME_ANY, CID_MANFID_KINGSTON_SD, 0x5449, 2020, CID_MONTH_ANY, ++ 0, -1ull, SDIO_ANY_ID, SDIO_ANY_ID, add_quirk_sd, ++ MMC_QUIRK_BROKEN_SD_CACHE, EXT_CSD_REV_ANY), ++ ++ _FIXUP_EXT(CID_NAME_ANY, CID_MANFID_KINGSTON_SD, 0x5449, 2021, CID_MONTH_ANY, ++ 0, -1ull, SDIO_ANY_ID, SDIO_ANY_ID, add_quirk_sd, ++ MMC_QUIRK_BROKEN_SD_CACHE, EXT_CSD_REV_ANY), ++ ++ _FIXUP_EXT(CID_NAME_ANY, CID_MANFID_KINGSTON_SD, 0x5449, 2022, CID_MONTH_ANY, + 0, -1ull, SDIO_ANY_ID, SDIO_ANY_ID, add_quirk_sd, + MMC_QUIRK_BROKEN_SD_CACHE, EXT_CSD_REV_ANY), + diff --git a/target/linux/bcm27xx/patches-6.6/950-1358-dt-bindings-usb-snps-dwc3-add-FS-HS-periodic-NAK-pol.patch b/target/linux/bcm27xx/patches-6.6/950-1358-dt-bindings-usb-snps-dwc3-add-FS-HS-periodic-NAK-pol.patch new file mode 100644 index 00000000000000..eaa340f24976a2 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1358-dt-bindings-usb-snps-dwc3-add-FS-HS-periodic-NAK-pol.patch @@ -0,0 +1,35 @@ +From 6c0f34fb0f83741f7f03f6bfd3fcbc89cb2c7cde Mon Sep 17 00:00:00 2001 +From: Jonathan Bell +Date: Wed, 6 Nov 2024 10:26:55 +0000 +Subject: [PATCH] dt-bindings: usb: snps,dwc3: add FS/HS periodic NAK polling + quirk + +Add two quirk properties that control whether or not the controller +issues many more handshakes to FS/HS Async endpoints in a single +(micro)frame. Enabling these can significantly increase throughput for +endpoints that frequently respond with NAKs. + +Signed-off-by: Jonathan Bell +--- + Documentation/devicetree/bindings/usb/snps,dwc3.yaml | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml ++++ b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml +@@ -231,6 +231,16 @@ properties: + description: When set, disable u2mac linestate check during HS transmit + type: boolean + ++ snps,enhanced-nak-fs-quirk: ++ description: ++ When set, the controller schedules many more handshakes to Async FS ++ endpoints, improving throughput when they frequently respond with NAKs. ++ ++ snps,enhanced-nak-hs-quirk: ++ description: ++ When set, the controller schedules many more handshakes to Async HS ++ endpoints, improving throughput when they frequently respond with NAKs. ++ + snps,parkmode-disable-ss-quirk: + description: + When set, disable park mode for all Superspeed bus instances. diff --git a/target/linux/bcm27xx/patches-6.6/950-1359-usb-dwc3-core-add-support-for-setting-NAK-enhancemen.patch b/target/linux/bcm27xx/patches-6.6/950-1359-usb-dwc3-core-add-support-for-setting-NAK-enhancemen.patch new file mode 100644 index 00000000000000..ed7dbb0e6c6d38 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1359-usb-dwc3-core-add-support-for-setting-NAK-enhancemen.patch @@ -0,0 +1,77 @@ +From bb53ca75f9e3631e753f397ccab704a8f975658b Mon Sep 17 00:00:00 2001 +From: Jonathan Bell +Date: Wed, 6 Nov 2024 10:45:24 +0000 +Subject: [PATCH] usb: dwc3: core: add support for setting NAK enhancement bits + for FS/HS + +If a device frequently NAKs, it can exhaust the scheduled handshakes in +a frame. It will then not get polled by the controller until the next +frame interval. This is most noticeable on FS devices as the controller +schedules a small set of transactions only once per full-speed frame. + +Setting the ENH_PER_NAK_FS/LS bits in the GUCTL1 register increases the +number of transactions that can be scheduled to Async (Control/Bulk) +endpoints in the respective frame time. In the FS case, this only +applies to FS devices directly connected to root ports. + +Signed-off-by: Jonathan Bell +--- + drivers/usb/dwc3/core.c | 10 ++++++++++ + drivers/usb/dwc3/core.h | 6 ++++++ + 2 files changed, 16 insertions(+) + +--- a/drivers/usb/dwc3/core.c ++++ b/drivers/usb/dwc3/core.c +@@ -1366,6 +1366,12 @@ static int dwc3_core_init(struct dwc3 *d + if (dwc->dis_tx_ipgap_linecheck_quirk) + reg |= DWC3_GUCTL1_TX_IPGAP_LINECHECK_DIS; + ++ if (dwc->enh_nak_fs_quirk) ++ reg |= DWC3_GUCTL1_NAK_PER_ENH_FS; ++ ++ if (dwc->enh_nak_hs_quirk) ++ reg |= DWC3_GUCTL1_NAK_PER_ENH_HS; ++ + if (dwc->parkmode_disable_ss_quirk) + reg |= DWC3_GUCTL1_PARKMODE_DISABLE_SS; + +@@ -1669,6 +1675,10 @@ static void dwc3_get_properties(struct d + "snps,resume-hs-terminations"); + dwc->ulpi_ext_vbus_drv = device_property_read_bool(dev, + "snps,ulpi-ext-vbus-drv"); ++ dwc->enh_nak_fs_quirk = device_property_read_bool(dev, ++ "snps,enhanced-nak-fs-quirk"); ++ dwc->enh_nak_hs_quirk = device_property_read_bool(dev, ++ "snps,enhanced-nak-hs-quirk"); + dwc->parkmode_disable_ss_quirk = device_property_read_bool(dev, + "snps,parkmode-disable-ss-quirk"); + dwc->parkmode_disable_hs_quirk = device_property_read_bool(dev, +--- a/drivers/usb/dwc3/core.h ++++ b/drivers/usb/dwc3/core.h +@@ -269,6 +269,8 @@ + #define DWC3_GUCTL1_TX_IPGAP_LINECHECK_DIS BIT(28) + #define DWC3_GUCTL1_DEV_FORCE_20_CLK_FOR_30_CLK BIT(26) + #define DWC3_GUCTL1_DEV_L1_EXIT_BY_HW BIT(24) ++#define DWC3_GUCTL1_NAK_PER_ENH_FS BIT(19) ++#define DWC3_GUCTL1_NAK_PER_ENH_HS BIT(18) + #define DWC3_GUCTL1_PARKMODE_DISABLE_SS BIT(17) + #define DWC3_GUCTL1_PARKMODE_DISABLE_HS BIT(16) + #define DWC3_GUCTL1_PARKMODE_DISABLE_FSLS BIT(15) +@@ -1118,6 +1120,8 @@ struct dwc3_scratchpad_array { + * generation after resume from suspend. + * @ulpi_ext_vbus_drv: Set to confiure the upli chip to drives CPEN pin + * VBUS with an external supply. ++ * @enh_nak_fs_quirk: Set to schedule more handshakes to Async FS endpoints. ++ * @enh_nak_hs_quirk: Set to schedule more handshakes to Async HS endpoints. + * @parkmode_disable_ss_quirk: If set, disable park mode feature for all + * Superspeed instances. + * @parkmode_disable_hs_quirk: If set, disable park mode feature for all +@@ -1348,6 +1352,8 @@ struct dwc3 { + unsigned dis_tx_ipgap_linecheck_quirk:1; + unsigned resume_hs_terminations:1; + unsigned ulpi_ext_vbus_drv:1; ++ unsigned enh_nak_fs_quirk:1; ++ unsigned enh_nak_hs_quirk:1; + unsigned parkmode_disable_ss_quirk:1; + unsigned parkmode_disable_hs_quirk:1; + unsigned parkmode_disable_fsls_quirk:1; diff --git a/target/linux/bcm27xx/patches-6.6/950-1360-DTS-rp1-set-enhanced-FS-NAK-quirk-for-usb3-controlle.patch b/target/linux/bcm27xx/patches-6.6/950-1360-DTS-rp1-set-enhanced-FS-NAK-quirk-for-usb3-controlle.patch new file mode 100644 index 00000000000000..a305dc13fd1da8 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1360-DTS-rp1-set-enhanced-FS-NAK-quirk-for-usb3-controlle.patch @@ -0,0 +1,30 @@ +From 803757627b48bdad9530b50053321fdea6dfcab4 Mon Sep 17 00:00:00 2001 +From: Jonathan Bell +Date: Wed, 6 Nov 2024 10:54:58 +0000 +Subject: [PATCH] DTS: rp1: set enhanced FS NAK quirk for usb3 controllers + +There seem to be only benefits, and no downsides. + +Signed-off-by: Jonathan Bell +--- + arch/arm64/boot/dts/broadcom/rp1.dtsi | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/arch/arm64/boot/dts/broadcom/rp1.dtsi ++++ b/arch/arm64/boot/dts/broadcom/rp1.dtsi +@@ -1077,6 +1077,7 @@ + usb3-lpm-capable; + snps,axi-pipe-limit = /bits/ 8 <8>; + snps,dis_rxdet_inp3_quirk; ++ snps,enhanced-nak-fs-quirk; + snps,parkmode-disable-ss-quirk; + snps,parkmode-disable-hs-quirk; + snps,parkmode-disable-fsls-quirk; +@@ -1093,6 +1094,7 @@ + usb3-lpm-capable; + snps,axi-pipe-limit = /bits/ 8 <8>; + snps,dis_rxdet_inp3_quirk; ++ snps,enhanced-nak-fs-quirk; + snps,parkmode-disable-ss-quirk; + snps,parkmode-disable-hs-quirk; + snps,parkmode-disable-fsls-quirk; diff --git a/target/linux/bcm27xx/patches-6.6/950-1361-drivers-usb-xhci-prevent-a-theoretical-race-on-non-c.patch b/target/linux/bcm27xx/patches-6.6/950-1361-drivers-usb-xhci-prevent-a-theoretical-race-on-non-c.patch new file mode 100644 index 00000000000000..d3ea1041c2a47b --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1361-drivers-usb-xhci-prevent-a-theoretical-race-on-non-c.patch @@ -0,0 +1,50 @@ +From e9e852af347ae3ccee4e7abb01f9ef91387980f9 Mon Sep 17 00:00:00 2001 +From: Jonathan Bell +Date: Wed, 6 Nov 2024 11:07:55 +0000 +Subject: [PATCH] drivers: usb: xhci: prevent a theoretical race on + non-coherent platforms + +For platforms that have xHCI controllers attached over PCIe, and +non-coherent routes to main memory, a theoretical race exists between +posting new TRBs to a ring, and writing to the doorbell register. + +In a contended system, write traffic from the CPU may be stalled before +the memory controller, whereas the CPU to Endpoint route is separate +and not likely to be contended. Similarly, the DMA route from the +endpoint to main memory may be separate and uncontended. + +Therefore the xHCI can receive a doorbell write and find a stale view +of a transfer ring. In cases where only a single TRB is ping-ponged at +a time, this can cause the endpoint to not get polled at all. + +Adding a readl() before the write forces a round-trip transaction +across PCIe, definitively serialising the CPU along the PCI +producer-consumer ordering rules. + +Signed-off-by: Jonathan Bell +--- + drivers/usb/host/xhci-ring.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +--- a/drivers/usb/host/xhci-ring.c ++++ b/drivers/usb/host/xhci-ring.c +@@ -505,6 +505,19 @@ void xhci_ring_ep_doorbell(struct xhci_h + + trace_xhci_ring_ep_doorbell(slot_id, DB_VALUE(ep_index, stream_id)); + ++ /* ++ * For non-coherent systems with PCIe DMA (such as Pi 4, Pi 5) there ++ * is a theoretical race between the TRB write and barrier, which ++ * is reported complete as soon as the write leaves the CPU domain, ++ * the doorbell write, which may be reported as complete by the RC ++ * at some arbitrary point, and the visibility of new TRBs in system ++ * RAM by the endpoint DMA engine. ++ * ++ * This read before the write positively serialises the CPU state ++ * by incurring a round-trip across the link. ++ */ ++ readl(db_addr); ++ + writel(DB_VALUE(ep_index, stream_id), db_addr); + /* flush the write */ + readl(db_addr); diff --git a/target/linux/bcm27xx/patches-6.6/950-1362-iio-humidity-dht11-Allow-non-zero-decimals.patch b/target/linux/bcm27xx/patches-6.6/950-1362-iio-humidity-dht11-Allow-non-zero-decimals.patch new file mode 100644 index 00000000000000..19935d0ea59500 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1362-iio-humidity-dht11-Allow-non-zero-decimals.patch @@ -0,0 +1,32 @@ +From ce65ed02cb6707ae5c9f3a304f5b0124f4eed559 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 4 Nov 2024 14:10:53 +0000 +Subject: [PATCH] iio: humidity: dht11: Allow non-zero decimals + +The DHT11 datasheet is pretty cryptic, but it does suggest that after +each integer value (humidity and temperature) there are "decimal" +values. Validate these as integers in the range 0-9 and treat them as +tenths of a unit. + +Link: https://github.com/raspberrypi/linux/issues/6220 + +Signed-off-by: Phil Elwell +--- + drivers/iio/humidity/dht11.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/iio/humidity/dht11.c ++++ b/drivers/iio/humidity/dht11.c +@@ -152,9 +152,9 @@ static int dht11_decode(struct dht11 *dh + dht11->temperature = (((temp_int & 0x7f) << 8) + temp_dec) * + ((temp_int & 0x80) ? -100 : 100); + dht11->humidity = ((hum_int << 8) + hum_dec) * 100; +- } else if (temp_dec == 0 && hum_dec == 0) { /* DHT11 */ +- dht11->temperature = temp_int * 1000; +- dht11->humidity = hum_int * 1000; ++ } else if (temp_dec < 10 && hum_dec < 10) { /* DHT11 */ ++ dht11->temperature = temp_int * 1000 + temp_dec * 100; ++ dht11->humidity = hum_int * 1000 + hum_dec * 100; + } else { + dev_err(dht11->dev, + "Don't know how to decode data: %d %d %d %d\n", diff --git a/target/linux/bcm27xx/patches-6.6/950-1363-drm-vc4-Correct-condition-for-ignoring-a-plane-to-sr.patch b/target/linux/bcm27xx/patches-6.6/950-1363-drm-vc4-Correct-condition-for-ignoring-a-plane-to-sr.patch new file mode 100644 index 00000000000000..9b018248a501e7 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1363-drm-vc4-Correct-condition-for-ignoring-a-plane-to-sr.patch @@ -0,0 +1,41 @@ +From c3393ac1098d1f191e37eed73bf366ebc88ac4ee Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Wed, 11 Sep 2024 14:49:05 +0100 +Subject: [PATCH] drm/vc4: Correct condition for ignoring a plane to src rect + =0, not <1.0 + +The logic for dropping a plane less than zero didn't account for the +possibility that a plane could be being upscaled with a src_rect with +width/height < 1 pixel, but not 0 subpixels. + +Check for not 0 subpixels, not < 1, in both vc4 and vc6 paths. + +Fixes: dac616899f87 ("drm/vc4: Drop planes that have 0 destination size") +Fixes: f73b18eb0d48 ("drm/vc4: Drop planes that are completely off-screen") +Signed-off-by: Dave Stevenson +--- + drivers/gpu/drm/vc4/vc4_plane.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/drivers/gpu/drm/vc4/vc4_plane.c ++++ b/drivers/gpu/drm/vc4/vc4_plane.c +@@ -1160,7 +1160,8 @@ static int vc4_plane_mode_set(struct drm + width = vc4_state->src_w[0] >> 16; + height = vc4_state->src_h[0] >> 16; + +- if (!width || !height || !vc4_state->crtc_w || !vc4_state->crtc_h) { ++ if (!vc4_state->src_w[0] || !vc4_state->src_h[0] || ++ !vc4_state->crtc_w || !vc4_state->crtc_h) { + /* 0 source size probably means the plane is offscreen */ + vc4_state->dlist_initialized = 1; + return 0; +@@ -1698,7 +1699,8 @@ static int vc6_plane_mode_set(struct drm + width = vc4_state->src_w[0] >> 16; + height = vc4_state->src_h[0] >> 16; + +- if (!width || !height || !vc4_state->crtc_w || !vc4_state->crtc_h) { ++ if (!vc4_state->src_w[0] || !vc4_state->src_h[0] || ++ !vc4_state->crtc_w || !vc4_state->crtc_h) { + /* 0 source size probably means the plane is offscreen. + * 0 destination size is a redundant plane. + */ diff --git a/target/linux/bcm27xx/patches-6.6/950-1364-drm-vc4-Use-the-TPZ-scaling-filter-for-1x1-source-im.patch b/target/linux/bcm27xx/patches-6.6/950-1364-drm-vc4-Use-the-TPZ-scaling-filter-for-1x1-source-im.patch new file mode 100644 index 00000000000000..5a7b3e4c1ef289 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1364-drm-vc4-Use-the-TPZ-scaling-filter-for-1x1-source-im.patch @@ -0,0 +1,59 @@ +From ca621585c573cae54dc1235d90822e8bcef2f73d Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Wed, 11 Sep 2024 15:23:33 +0100 +Subject: [PATCH] drm/vc4: Use the TPZ scaling filter for 1x1 source images + +The documentation says that the TPZ filter can not upscale, +and requesting a scaling factor > 1:1 will output the original +image in the top left, and repeat the right/bottom most pixels +thereafter. +That fits perfectly with upscaling a 1x1 image which is done +a fair amount by some compositors to give solid colour, and it +saves a large amount of LBM (TPZ is based on src size, whilst +PPF is based on dest size). + +Select TPZ filter for images with source rectangle <=1. + +Signed-off-by: Dave Stevenson +--- + drivers/gpu/drm/vc4/vc4_plane.c | 21 +++++++++++++++------ + 1 file changed, 15 insertions(+), 6 deletions(-) + +--- a/drivers/gpu/drm/vc4/vc4_plane.c ++++ b/drivers/gpu/drm/vc4/vc4_plane.c +@@ -265,7 +265,11 @@ static enum vc4_scaling_mode vc4_get_sca + { + if (dst == src >> 16) + return VC4_SCALING_NONE; +- if (3 * dst >= 2 * (src >> 16)) ++ ++ if (src <= (1 << 16)) ++ /* Source rectangle <= 1 pixel can use TPZ for resize/upscale */ ++ return VC4_SCALING_TPZ; ++ else if (3 * dst >= 2 * (src >> 16)) + return VC4_SCALING_PPF; + else + return VC4_SCALING_TPZ; +@@ -560,12 +564,17 @@ static void vc4_write_tpz(struct vc4_pla + + WARN_ON_ONCE(vc4->gen > VC4_GEN_6); + +- scale = src / dst; ++ if ((dst << 16) < src) { ++ scale = src / dst; + +- /* The specs note that while the reciprocal would be defined +- * as (1<<32)/scale, ~0 is close enough. +- */ +- recip = ~0 / scale; ++ /* The specs note that while the reciprocal would be defined ++ * as (1<<32)/scale, ~0 is close enough. ++ */ ++ recip = ~0 / scale; ++ } else { ++ scale = (1 << 16) + 1; ++ recip = (1 << 16) - 1; ++ } + + vc4_dlist_write(vc4_state, + /* diff --git a/target/linux/bcm27xx/patches-6.6/950-1365-drm-Set-non-desktop-property-to-true-for-writeback-a.patch b/target/linux/bcm27xx/patches-6.6/950-1365-drm-Set-non-desktop-property-to-true-for-writeback-a.patch new file mode 100644 index 00000000000000..e8f52cbc43e035 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1365-drm-Set-non-desktop-property-to-true-for-writeback-a.patch @@ -0,0 +1,30 @@ +From 68b0ff3549148e614e1733d773cee8e689c763c6 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Tue, 20 Aug 2024 16:25:10 +0100 +Subject: [PATCH] drm: Set non-desktop property to true for writeback and + virtual connectors + +The non-desktop property "Indicates the output should be ignored for +purposes of displaying a standard desktop environment or console." + +That sounds like it should be true for all writeback and virtual +connectors as you shouldn't render a desktop to them, so set it +by default. + +Signed-off-by: Dave Stevenson +--- + drivers/gpu/drm/drm_connector.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/gpu/drm/drm_connector.c ++++ b/drivers/gpu/drm/drm_connector.c +@@ -361,7 +361,8 @@ static int __drm_connector_init(struct d + + drm_object_attach_property(&connector->base, + config->non_desktop_property, +- 0); ++ (connector_type != DRM_MODE_CONNECTOR_VIRTUAL && ++ connector_type != DRM_MODE_CONNECTOR_WRITEBACK) ? 0 : 1; + drm_object_attach_property(&connector->base, + config->tile_property, + 0); diff --git a/target/linux/bcm27xx/patches-6.6/950-1366-drm-Increase-plane_mask-to-64bit.patch b/target/linux/bcm27xx/patches-6.6/950-1366-drm-Increase-plane_mask-to-64bit.patch new file mode 100644 index 00000000000000..e27058d44cea69 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1366-drm-Increase-plane_mask-to-64bit.patch @@ -0,0 +1,101 @@ +From 8181e682d6f4ef209845ec24f0a1eb37764d6731 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 21 Oct 2022 14:26:12 +0100 +Subject: [PATCH] drm: Increase plane_mask to 64bit. + +The limit of 32 planes per DRM device is dictated by the use +of planes_mask returning a u32. + +Change to a u64 such that 64 planes can be supported by a device. + +Signed-off-by: Dave Stevenson +--- + drivers/gpu/drm/drm_atomic.c | 2 +- + drivers/gpu/drm/drm_framebuffer.c | 2 +- + drivers/gpu/drm/drm_mode_config.c | 2 +- + drivers/gpu/drm/drm_plane.c | 2 +- + drivers/gpu/drm/imx/ipuv3/ipuv3-crtc.c | 2 +- + include/drm/drm_crtc.h | 2 +- + include/drm/drm_plane.h | 4 ++-- + 7 files changed, 8 insertions(+), 8 deletions(-) + +--- a/drivers/gpu/drm/drm_atomic.c ++++ b/drivers/gpu/drm/drm_atomic.c +@@ -451,7 +451,7 @@ static void drm_atomic_crtc_print_state( + drm_printf(p, "\tactive_changed=%d\n", state->active_changed); + drm_printf(p, "\tconnectors_changed=%d\n", state->connectors_changed); + drm_printf(p, "\tcolor_mgmt_changed=%d\n", state->color_mgmt_changed); +- drm_printf(p, "\tplane_mask=%x\n", state->plane_mask); ++ drm_printf(p, "\tplane_mask=%llx\n", state->plane_mask); + drm_printf(p, "\tconnector_mask=%x\n", state->connector_mask); + drm_printf(p, "\tencoder_mask=%x\n", state->encoder_mask); + drm_printf(p, "\tmode: " DRM_MODE_FMT "\n", DRM_MODE_ARG(&state->mode)); +--- a/drivers/gpu/drm/drm_framebuffer.c ++++ b/drivers/gpu/drm/drm_framebuffer.c +@@ -959,7 +959,7 @@ static int atomic_remove_fb(struct drm_f + struct drm_connector *conn __maybe_unused; + struct drm_connector_state *conn_state; + int i, ret; +- unsigned plane_mask; ++ u64 plane_mask; + bool disable_crtcs = false; + + retry_disable: +--- a/drivers/gpu/drm/drm_mode_config.c ++++ b/drivers/gpu/drm/drm_mode_config.c +@@ -636,7 +636,7 @@ void drm_mode_config_validate(struct drm + struct drm_encoder *encoder; + struct drm_crtc *crtc; + struct drm_plane *plane; +- u32 primary_with_crtc = 0, cursor_with_crtc = 0; ++ u64 primary_with_crtc = 0, cursor_with_crtc = 0; + unsigned int num_primary = 0; + + if (!drm_core_check_feature(dev, DRIVER_MODESET)) +--- a/drivers/gpu/drm/drm_plane.c ++++ b/drivers/gpu/drm/drm_plane.c +@@ -249,7 +249,7 @@ static int __drm_universal_plane_init(st + int ret; + + /* plane index is used with 32bit bitmasks */ +- if (WARN_ON(config->num_total_plane >= 32)) ++ if (WARN_ON(config->num_total_plane >= 64)) + return -EINVAL; + + /* +--- a/drivers/gpu/drm/imx/ipuv3/ipuv3-crtc.c ++++ b/drivers/gpu/drm/imx/ipuv3/ipuv3-crtc.c +@@ -230,7 +230,7 @@ static int ipu_crtc_atomic_check(struct + { + struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, + crtc); +- u32 primary_plane_mask = drm_plane_mask(crtc->primary); ++ u64 primary_plane_mask = drm_plane_mask(crtc->primary); + + if (crtc_state->active && (primary_plane_mask & crtc_state->plane_mask) == 0) + return -EINVAL; +--- a/include/drm/drm_crtc.h ++++ b/include/drm/drm_crtc.h +@@ -192,7 +192,7 @@ struct drm_crtc_state { + * @plane_mask: Bitmask of drm_plane_mask(plane) of planes attached to + * this CRTC. + */ +- u32 plane_mask; ++ u64 plane_mask; + + /** + * @connector_mask: Bitmask of drm_connector_mask(connector) of +--- a/include/drm/drm_plane.h ++++ b/include/drm/drm_plane.h +@@ -915,9 +915,9 @@ static inline unsigned int drm_plane_ind + * drm_plane_mask - find the mask of a registered plane + * @plane: plane to find mask for + */ +-static inline u32 drm_plane_mask(const struct drm_plane *plane) ++static inline u64 drm_plane_mask(const struct drm_plane *plane) + { +- return 1 << drm_plane_index(plane); ++ return 1ULL << drm_plane_index(plane); + } + + struct drm_plane * drm_plane_from_index(struct drm_device *dev, int idx); diff --git a/target/linux/bcm27xx/patches-6.6/950-1367-drm-vc4-Increase-number-of-overlay-planes-from-16-to.patch b/target/linux/bcm27xx/patches-6.6/950-1367-drm-vc4-Increase-number-of-overlay-planes-from-16-to.patch new file mode 100644 index 00000000000000..6eae6fc2ac2b25 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1367-drm-vc4-Increase-number-of-overlay-planes-from-16-to.patch @@ -0,0 +1,42 @@ +From 5dc4cef7d7fcda4ea59b9e456a835fa54336af6b Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 21 Oct 2022 14:27:45 +0100 +Subject: [PATCH] drm/vc4: Increase number of overlay planes from 16 to 48 + +The HVS can accept an arbitrary number of planes, provided +that the overall pixel read load is within limits, and +the display list can fit into the dlist memory. + +Now that DRM will support 64 planes per device, increase +the number of overlay planes from 16 to 48 so that the +dlist complexity can be increased (eg 4x4 video wall on +each of 3 displays). + +Signed-off-by: Dave Stevenson +--- + drivers/gpu/drm/drm_connector.c | 2 +- + drivers/gpu/drm/vc4/vc4_plane.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/gpu/drm/drm_connector.c ++++ b/drivers/gpu/drm/drm_connector.c +@@ -362,7 +362,7 @@ static int __drm_connector_init(struct d + drm_object_attach_property(&connector->base, + config->non_desktop_property, + (connector_type != DRM_MODE_CONNECTOR_VIRTUAL && +- connector_type != DRM_MODE_CONNECTOR_WRITEBACK) ? 0 : 1; ++ connector_type != DRM_MODE_CONNECTOR_WRITEBACK) ? 0 : 1); + drm_object_attach_property(&connector->base, + config->tile_property, + 0); +--- a/drivers/gpu/drm/vc4/vc4_plane.c ++++ b/drivers/gpu/drm/vc4/vc4_plane.c +@@ -2517,7 +2517,7 @@ struct drm_plane *vc4_plane_init(struct + return plane; + } + +-#define VC4_NUM_OVERLAY_PLANES 16 ++#define VC4_NUM_OVERLAY_PLANES 48 + + int vc4_plane_create_additional_planes(struct drm_device *drm) + { diff --git a/target/linux/bcm27xx/patches-6.6/950-1368-drm-vc4-Assign-32-overlay-planes-to-writeback-only.patch b/target/linux/bcm27xx/patches-6.6/950-1368-drm-vc4-Assign-32-overlay-planes-to-writeback-only.patch new file mode 100644 index 00000000000000..40eff3cc1ffd80 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1368-drm-vc4-Assign-32-overlay-planes-to-writeback-only.patch @@ -0,0 +1,71 @@ +From dd340cb082a020fbd42b794493ffd063dd8e15b4 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Tue, 15 Aug 2023 15:44:34 +0100 +Subject: [PATCH] drm/vc4: Assign 32 overlay planes to writeback only + +Instead of having 48 generic overlay planes, assign 32 to the +writeback connector so that there is no ambiguity in wlroots +when trying to find a plane for composition using the writeback +connector vs display. + +Signed-off-by: Dave Stevenson +--- + drivers/gpu/drm/vc4/vc4_plane.c | 34 +++++++++++++++++++++++++++++++-- + 1 file changed, 32 insertions(+), 2 deletions(-) + +--- a/drivers/gpu/drm/vc4/vc4_plane.c ++++ b/drivers/gpu/drm/vc4/vc4_plane.c +@@ -2517,13 +2517,28 @@ struct drm_plane *vc4_plane_init(struct + return plane; + } + +-#define VC4_NUM_OVERLAY_PLANES 48 ++#define VC4_NUM_OVERLAY_PLANES 16 ++#define VC4_NUM_TXP_OVERLAY_PLANES 32 + + int vc4_plane_create_additional_planes(struct drm_device *drm) + { + struct drm_plane *cursor_plane; + struct drm_crtc *crtc; + unsigned int i; ++ struct drm_crtc *txp_crtc; ++ uint32_t non_txp_crtc_mask; ++ ++ drm_for_each_crtc(crtc, drm) { ++ struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc); ++ ++ if (vc4_crtc->feeds_txp) { ++ txp_crtc = crtc; ++ break; ++ } ++ } ++ ++ non_txp_crtc_mask = GENMASK(drm->mode_config.num_crtc - 1, 0) - ++ drm_crtc_mask(txp_crtc); + + /* Set up some arbitrary number of planes. We're not limited + * by a set number of physical registers, just the space in +@@ -2537,7 +2552,22 @@ int vc4_plane_create_additional_planes(s + for (i = 0; i < VC4_NUM_OVERLAY_PLANES; i++) { + struct drm_plane *plane = + vc4_plane_init(drm, DRM_PLANE_TYPE_OVERLAY, +- GENMASK(drm->mode_config.num_crtc - 1, 0)); ++ non_txp_crtc_mask); ++ ++ if (IS_ERR(plane)) ++ continue; ++ ++ /* Create zpos property. Max of all the overlays + 1 primary + ++ * 1 cursor plane on a crtc. ++ */ ++ drm_plane_create_zpos_property(plane, i + 1, 1, ++ VC4_NUM_OVERLAY_PLANES + 1); ++ } ++ ++ for (i = 0; i < VC4_NUM_TXP_OVERLAY_PLANES; i++) { ++ struct drm_plane *plane = ++ vc4_plane_init(drm, DRM_PLANE_TYPE_OVERLAY, ++ drm_crtc_mask(txp_crtc)); + + if (IS_ERR(plane)) + continue; diff --git a/target/linux/bcm27xx/patches-6.6/950-1369-drm-Add-a-DRM_MODE_TRANSPOSE-option-to-the-DRM-rotat.patch b/target/linux/bcm27xx/patches-6.6/950-1369-drm-Add-a-DRM_MODE_TRANSPOSE-option-to-the-DRM-rotat.patch new file mode 100644 index 00000000000000..ccda8b05c2d1b3 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1369-drm-Add-a-DRM_MODE_TRANSPOSE-option-to-the-DRM-rotat.patch @@ -0,0 +1,47 @@ +From b3b3d12cf0734318a0fed0b33e13d714188369db Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Tue, 22 Oct 2024 17:17:31 +0100 +Subject: [PATCH] drm: Add a DRM_MODE_TRANSPOSE option to the DRM rotation + property + +Some hardware will implement transpose as a rotation operation, +which when combined with X and Y reflect can result in a rotation, +but is a discrete operation in its own right. + +Add an option for transpose only. + +Signed-off-by: Dave Stevenson +--- + drivers/gpu/drm/drm_blend.c | 3 +++ + include/uapi/drm/drm_mode.h | 1 + + 2 files changed, 4 insertions(+) + +--- a/drivers/gpu/drm/drm_blend.c ++++ b/drivers/gpu/drm/drm_blend.c +@@ -263,6 +263,8 @@ EXPORT_SYMBOL(drm_plane_create_alpha_pro + * "reflect-x" + * DRM_MODE_REFLECT_Y: + * "reflect-y" ++ * DRM_MODE_TRANSPOSE: ++ * "transpose" + * + * Rotation is the specified amount in degrees in counter clockwise direction, + * the X and Y axis are within the source rectangle, i.e. the X/Y axis before +@@ -280,6 +282,7 @@ int drm_plane_create_rotation_property(s + { __builtin_ffs(DRM_MODE_ROTATE_270) - 1, "rotate-270" }, + { __builtin_ffs(DRM_MODE_REFLECT_X) - 1, "reflect-x" }, + { __builtin_ffs(DRM_MODE_REFLECT_Y) - 1, "reflect-y" }, ++ { __builtin_ffs(DRM_MODE_TRANSPOSE) - 1, "transpose" }, + }; + struct drm_property *prop; + +--- a/include/uapi/drm/drm_mode.h ++++ b/include/uapi/drm/drm_mode.h +@@ -203,6 +203,7 @@ extern "C" { + */ + #define DRM_MODE_REFLECT_X (1<<4) + #define DRM_MODE_REFLECT_Y (1<<5) ++#define DRM_MODE_TRANSPOSE (1<<6) + + /* + * DRM_MODE_REFLECT_MASK diff --git a/target/linux/bcm27xx/patches-6.6/950-1370-drm-Add-a-rotation-parameter-to-connectors.patch b/target/linux/bcm27xx/patches-6.6/950-1370-drm-Add-a-rotation-parameter-to-connectors.patch new file mode 100644 index 00000000000000..e803a7732f068e --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1370-drm-Add-a-rotation-parameter-to-connectors.patch @@ -0,0 +1,164 @@ +From 8fec3ff870499256f2c18fe7983f6ed3fea4faaf Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Tue, 22 Oct 2024 17:22:40 +0100 +Subject: [PATCH] drm: Add a rotation parameter to connectors. + +Some connectors, particularly writeback, can implement flip +or transpose operations as writing back to memory. + +Add a connector rotation property to control this. + +Signed-off-by: Dave Stevenson +--- + drivers/gpu/drm/drm_atomic_uapi.c | 4 +++ + drivers/gpu/drm/drm_blend.c | 50 ++++++++++++++++++++++++------- + include/drm/drm_blend.h | 5 ++++ + include/drm/drm_connector.h | 11 +++++++ + 4 files changed, 60 insertions(+), 10 deletions(-) + +--- a/drivers/gpu/drm/drm_atomic_uapi.c ++++ b/drivers/gpu/drm/drm_atomic_uapi.c +@@ -811,6 +811,8 @@ static int drm_atomic_connector_set_prop + state->max_requested_bpc = val; + } else if (property == connector->privacy_screen_sw_state_property) { + state->privacy_screen_sw_state = val; ++ } else if (property == connector->rotation_property) { ++ state->rotation = val; + } else if (connector->funcs->atomic_set_property) { + return connector->funcs->atomic_set_property(connector, + state, property, val); +@@ -900,6 +902,8 @@ drm_atomic_connector_get_property(struct + *val = state->max_requested_bpc; + } else if (property == connector->privacy_screen_sw_state_property) { + *val = state->privacy_screen_sw_state; ++ } else if (property == connector->rotation_property) { ++ *val = state->rotation; + } else if (connector->funcs->atomic_get_property) { + return connector->funcs->atomic_get_property(connector, + state, property, val); +--- a/drivers/gpu/drm/drm_blend.c ++++ b/drivers/gpu/drm/drm_blend.c +@@ -235,6 +235,16 @@ int drm_plane_create_alpha_property(stru + } + EXPORT_SYMBOL(drm_plane_create_alpha_property); + ++static const struct drm_prop_enum_list drm_rotate_props[] = { ++ { __builtin_ffs(DRM_MODE_ROTATE_0) - 1, "rotate-0" }, ++ { __builtin_ffs(DRM_MODE_ROTATE_90) - 1, "rotate-90" }, ++ { __builtin_ffs(DRM_MODE_ROTATE_180) - 1, "rotate-180" }, ++ { __builtin_ffs(DRM_MODE_ROTATE_270) - 1, "rotate-270" }, ++ { __builtin_ffs(DRM_MODE_REFLECT_X) - 1, "reflect-x" }, ++ { __builtin_ffs(DRM_MODE_REFLECT_Y) - 1, "reflect-y" }, ++ { __builtin_ffs(DRM_MODE_TRANSPOSE) - 1, "transpose" }, ++}; ++ + /** + * drm_plane_create_rotation_property - create a new rotation property + * @plane: drm plane +@@ -275,15 +285,6 @@ int drm_plane_create_rotation_property(s + unsigned int rotation, + unsigned int supported_rotations) + { +- static const struct drm_prop_enum_list props[] = { +- { __builtin_ffs(DRM_MODE_ROTATE_0) - 1, "rotate-0" }, +- { __builtin_ffs(DRM_MODE_ROTATE_90) - 1, "rotate-90" }, +- { __builtin_ffs(DRM_MODE_ROTATE_180) - 1, "rotate-180" }, +- { __builtin_ffs(DRM_MODE_ROTATE_270) - 1, "rotate-270" }, +- { __builtin_ffs(DRM_MODE_REFLECT_X) - 1, "reflect-x" }, +- { __builtin_ffs(DRM_MODE_REFLECT_Y) - 1, "reflect-y" }, +- { __builtin_ffs(DRM_MODE_TRANSPOSE) - 1, "transpose" }, +- }; + struct drm_property *prop; + + WARN_ON((supported_rotations & DRM_MODE_ROTATE_MASK) == 0); +@@ -291,7 +292,8 @@ int drm_plane_create_rotation_property(s + WARN_ON(rotation & ~supported_rotations); + + prop = drm_property_create_bitmask(plane->dev, 0, "rotation", +- props, ARRAY_SIZE(props), ++ drm_rotate_props, ++ ARRAY_SIZE(drm_rotate_props), + supported_rotations); + if (!prop) + return -ENOMEM; +@@ -307,6 +309,34 @@ int drm_plane_create_rotation_property(s + } + EXPORT_SYMBOL(drm_plane_create_rotation_property); + ++int drm_connector_create_rotation_property(struct drm_connector *conn, ++ unsigned int rotation, ++ unsigned int supported_rotations) ++{ ++ struct drm_property *prop; ++ ++ WARN_ON((supported_rotations & DRM_MODE_ROTATE_MASK) == 0); ++ WARN_ON(!is_power_of_2(rotation & DRM_MODE_ROTATE_MASK)); ++ WARN_ON(rotation & ~supported_rotations); ++ ++ prop = drm_property_create_bitmask(conn->dev, 0, "rotation", ++ drm_rotate_props, ++ ARRAY_SIZE(drm_rotate_props), ++ supported_rotations); ++ if (!prop) ++ return -ENOMEM; ++ ++ drm_object_attach_property(&conn->base, prop, rotation); ++ ++ if (conn->state) ++ conn->state->rotation = rotation; ++ ++ conn->rotation_property = prop; ++ ++ return 0; ++} ++EXPORT_SYMBOL(drm_connector_create_rotation_property); ++ + /** + * drm_rotation_simplify() - Try to simplify the rotation + * @rotation: Rotation to be simplified +--- a/include/drm/drm_blend.h ++++ b/include/drm/drm_blend.h +@@ -34,6 +34,7 @@ + struct drm_device; + struct drm_atomic_state; + struct drm_plane; ++struct drm_connector; + + static inline bool drm_rotation_90_or_270(unsigned int rotation) + { +@@ -58,4 +59,8 @@ int drm_atomic_normalize_zpos(struct drm + struct drm_atomic_state *state); + int drm_plane_create_blend_mode_property(struct drm_plane *plane, + unsigned int supported_modes); ++ ++int drm_connector_create_rotation_property(struct drm_connector *conn, ++ unsigned int rotation, ++ unsigned int supported_rotations); + #endif +--- a/include/drm/drm_connector.h ++++ b/include/drm/drm_connector.h +@@ -1029,6 +1029,11 @@ struct drm_connector_state { + * DRM blob property for HDR output metadata + */ + struct drm_property_blob *hdr_output_metadata; ++ ++ /** ++ * @rotation: Connector property to rotate the maximum output image. ++ */ ++ u32 rotation; + }; + + /** +@@ -1696,6 +1701,12 @@ struct drm_connector { + */ + struct drm_property *privacy_screen_hw_state_property; + ++ /** ++ * @rotation_property: Optional DRM property controlling rotation of the ++ * output. ++ */ ++ struct drm_property *rotation_property; ++ + #define DRM_CONNECTOR_POLL_HPD (1 << 0) + #define DRM_CONNECTOR_POLL_CONNECT (1 << 1) + #define DRM_CONNECTOR_POLL_DISCONNECT (1 << 2) diff --git a/target/linux/bcm27xx/patches-6.6/950-1371-drm-vc4-txp-Add-a-rotation-property-to-the-writeback.patch b/target/linux/bcm27xx/patches-6.6/950-1371-drm-vc4-txp-Add-a-rotation-property-to-the-writeback.patch new file mode 100644 index 00000000000000..b0e5566ac13f7e --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1371-drm-vc4-txp-Add-a-rotation-property-to-the-writeback.patch @@ -0,0 +1,65 @@ +From 8346446098032c62d1de891a97c7f62264b18f81 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Wed, 14 Aug 2024 16:41:07 +0100 +Subject: [PATCH] drm/vc4: txp: Add a rotation property to the writeback + connector + +The txp block can implement transpose as it writes out the image +data, so expose that through the new connector rotation property. + +Signed-off-by: Dave Stevenson +--- + drivers/gpu/drm/vc4/vc4_txp.c | 21 +++++++++++++++++---- + 1 file changed, 17 insertions(+), 4 deletions(-) + +--- a/drivers/gpu/drm/vc4/vc4_txp.c ++++ b/drivers/gpu/drm/vc4/vc4_txp.c +@@ -15,6 +15,7 @@ + + #include + #include ++#include + #include + #include + #include +@@ -259,10 +260,15 @@ static int vc4_txp_connector_atomic_chec + crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc); + + fb = conn_state->writeback_job->fb; +- if (fb->width != crtc_state->mode.hdisplay || +- fb->height != crtc_state->mode.vdisplay) { +- DRM_DEBUG_KMS("Invalid framebuffer size %ux%u\n", +- fb->width, fb->height); ++ if ((conn_state->rotation == DRM_MODE_ROTATE_0 && ++ fb->width != crtc_state->mode.hdisplay && ++ fb->height != crtc_state->mode.vdisplay) || ++ (conn_state->rotation == (DRM_MODE_ROTATE_0 | DRM_MODE_TRANSPOSE) && ++ fb->width != crtc_state->mode.vdisplay && ++ fb->height != crtc_state->mode.hdisplay)) { ++ DRM_DEBUG_KMS("Invalid framebuffer size %ux%u vs mode %ux%u\n", ++ fb->width, fb->height, ++ crtc_state->mode.hdisplay, crtc_state->mode.vdisplay); + return -EINVAL; + } + +@@ -330,6 +336,9 @@ static void vc4_txp_connector_atomic_com + */ + ctrl |= TXP_ALPHA_INVERT; + ++ if (conn_state->rotation & DRM_MODE_TRANSPOSE) ++ ctrl |= TXP_TRANSPOSE; ++ + if (!drm_dev_enter(drm, &idx)) + return; + +@@ -608,6 +617,10 @@ static int vc4_txp_bind(struct device *d + if (ret) + return ret; + ++ drm_connector_create_rotation_property(&txp->connector.base, DRM_MODE_ROTATE_0, ++ DRM_MODE_ROTATE_0 | ++ DRM_MODE_TRANSPOSE); ++ + ret = devm_request_irq(dev, irq, vc4_txp_interrupt, 0, + dev_name(dev), txp); + if (ret) diff --git a/target/linux/bcm27xx/patches-6.6/950-1372-dmaengine-dw-axi-dmac-Allow-client-chosen-width.patch b/target/linux/bcm27xx/patches-6.6/950-1372-dmaengine-dw-axi-dmac-Allow-client-chosen-width.patch new file mode 100644 index 00000000000000..90688668b874de --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1372-dmaengine-dw-axi-dmac-Allow-client-chosen-width.patch @@ -0,0 +1,40 @@ +From a2fa911d90495762047c05dec4241308ae61ca36 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 19 Sep 2024 18:05:00 +0100 +Subject: [PATCH] dmaengine: dw-axi-dmac: Allow client-chosen width + +For devices where transfer lengths are not known upfront, there is a +danger when the destination is wider than the source that partial words +can be lost at the end of a transfer. Ideally the controller would be +able to flush the residue, but it can't - it's not even possible to tell +that there is any. + +Instead, allow the client driver to avoid the problem by setting a +smaller width. + +Signed-off-by: Phil Elwell +--- + drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +--- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c ++++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c +@@ -724,6 +724,18 @@ static int dw_axi_dma_set_hw_desc(struct + case DMA_DEV_TO_MEM: + reg_burst_msize = axi_dma_encode_msize(chan->config.src_maxburst); + reg_width = __ffs(chan->config.src_addr_width); ++ /* ++ * For devices where transfer lengths are not known upfront, ++ * there is a danger when the destination is wider than the ++ * source that partial words can be lost at the end of a transfer. ++ * Ideally the controller would be able to flush the residue, but ++ * it can't - it's not even possible to tell that there is any. ++ * Instead, allow the client driver to avoid the problem by setting ++ * a smaller width. ++ */ ++ if (chan->config.dst_addr_width && ++ (chan->config.dst_addr_width < mem_width)) ++ mem_width = chan->config.dst_addr_width; + device_addr = phys_to_dma(chan->chip->dev, chan->config.src_addr); + ctllo = reg_width << CH_CTL_L_SRC_WIDTH_POS | + mem_width << CH_CTL_L_DST_WIDTH_POS | diff --git a/target/linux/bcm27xx/patches-6.6/950-1373-spi-dw-Let-the-DMAC-set-the-transfer-widths.patch b/target/linux/bcm27xx/patches-6.6/950-1373-spi-dw-Let-the-DMAC-set-the-transfer-widths.patch new file mode 100644 index 00000000000000..786af04036a3b6 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1373-spi-dw-Let-the-DMAC-set-the-transfer-widths.patch @@ -0,0 +1,31 @@ +From 5cf7209c294a58029984880d4858e2d3c7e46a3c Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 19 Sep 2024 18:12:12 +0100 +Subject: [PATCH] spi: dw: Let the DMAC set the transfer widths + +SPI transfers are of defined length, unlike some UART traffic, so it is +safe to let the DMA controller choose a suitable memory width. + +Signed-off-by: Phil Elwell +--- + drivers/spi/spi-dw-dma.c | 2 -- + 1 file changed, 2 deletions(-) + +--- a/drivers/spi/spi-dw-dma.c ++++ b/drivers/spi/spi-dw-dma.c +@@ -330,7 +330,6 @@ static int dw_spi_dma_config_tx(struct d + txconf.direction = DMA_MEM_TO_DEV; + txconf.dst_addr = dws->dma_addr; + txconf.dst_maxburst = dws->txburst; +- txconf.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; + txconf.dst_addr_width = dw_spi_dma_convert_width(dws->n_bytes); + txconf.device_fc = false; + +@@ -431,7 +430,6 @@ static int dw_spi_dma_config_rx(struct d + rxconf.direction = DMA_DEV_TO_MEM; + rxconf.src_addr = dws->dma_addr; + rxconf.src_maxburst = dws->rxburst; +- rxconf.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; + rxconf.src_addr_width = dw_spi_dma_convert_width(dws->n_bytes); + rxconf.device_fc = false; + diff --git a/target/linux/bcm27xx/patches-6.6/950-1374-serial-pl011-Request-a-memory-width-of-1-byte.patch b/target/linux/bcm27xx/patches-6.6/950-1374-serial-pl011-Request-a-memory-width-of-1-byte.patch new file mode 100644 index 00000000000000..860d35b2f3639d --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1374-serial-pl011-Request-a-memory-width-of-1-byte.patch @@ -0,0 +1,25 @@ +From 8894298105f4cb41dfa41e0b0d3c40c3f7b92c44 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 19 Sep 2024 18:22:24 +0100 +Subject: [PATCH] serial: pl011: Request a memory width of 1 byte + +In order to avoid losing residue bytes when a receive is terminated +early, set the destination width to single bytes. + +Link: https://github.com/raspberrypi/linux/issues/6365 + +Signed-off-by: Phil Elwell +--- + drivers/tty/serial/amba-pl011.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/tty/serial/amba-pl011.c ++++ b/drivers/tty/serial/amba-pl011.c +@@ -468,6 +468,7 @@ static void pl011_dma_probe(struct uart_ + .src_addr = uap->port.mapbase + + pl011_reg_to_offset(uap, REG_DR), + .src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE, ++ .dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE, + .direction = DMA_DEV_TO_MEM, + .src_maxburst = uap->fifosize >> 2, + .device_fc = false, diff --git a/target/linux/bcm27xx/patches-6.6/950-1377-drivers-usb-xhci-set-HID-bit-in-streaming-endpoint-c.patch b/target/linux/bcm27xx/patches-6.6/950-1377-drivers-usb-xhci-set-HID-bit-in-streaming-endpoint-c.patch new file mode 100644 index 00000000000000..230537f50565d9 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1377-drivers-usb-xhci-set-HID-bit-in-streaming-endpoint-c.patch @@ -0,0 +1,56 @@ +From 66aef6ce3557edd9d58d794e4a800c5be49ca0e7 Mon Sep 17 00:00:00 2001 +From: Jonathan Bell +Date: Mon, 11 Nov 2024 10:30:38 +0000 +Subject: [PATCH] drivers: usb: xhci: set HID bit in streaming endpoint + contexts + +The xHC may commence Host Initiated Data Moves for streaming endpoints - +see USB3.2 spec s8.12.1.4.2.4. However, this behaviour is typically +counterproductive as the submission of UAS URBs in {Status, Data, +Command} order and 1 outstanding IO per stream ID means the device never +enters Move Data after a HIMD for Status or Data stages with the same +stream ID. For OUT transfers this is especially inefficient as the host +will start transmitting multiple bulk packets as a burst, all of which +get NAKed by the device - wasting bandwidth. + +Also, some buggy UAS adapters don't properly handle the EP flow control +state this creates - e.g. RTL9210. + +Set Host Initiated Data Move Disable to always defer stream selection to +the device. xHC implementations may treat this field as "don't care, +forced to 1" anyway - xHCI 1.2 s4.12.1. + +Signed-off-by: Jonathan Bell +--- + drivers/usb/host/xhci-mem.c | 8 ++++++++ + drivers/usb/host/xhci.h | 2 ++ + 2 files changed, 10 insertions(+) + +--- a/drivers/usb/host/xhci-mem.c ++++ b/drivers/usb/host/xhci-mem.c +@@ -716,6 +716,14 @@ void xhci_setup_streams_ep_input_ctx(str + ep_ctx->ep_info &= cpu_to_le32(~EP_MAXPSTREAMS_MASK); + ep_ctx->ep_info |= cpu_to_le32(EP_MAXPSTREAMS(max_primary_streams) + | EP_HAS_LSA); ++ ++ /* ++ * Set Host Initiated Data Move Disable to always defer stream ++ * selection to the device. xHC implementations may treat this ++ * field as "don't care, forced to 1" anyway - xHCI 1.2 s4.12.1. ++ */ ++ ep_ctx->ep_info2 |= EP_HID; ++ + ep_ctx->deq = cpu_to_le64(stream_info->ctx_array_dma); + } + +--- a/drivers/usb/host/xhci.h ++++ b/drivers/usb/host/xhci.h +@@ -492,6 +492,8 @@ struct xhci_ep_ctx { + #define CTX_TO_EP_MAXPSTREAMS(p) (((p) & EP_MAXPSTREAMS_MASK) >> 10) + /* Endpoint is set up with a Linear Stream Array (vs. Secondary Stream Array) */ + #define EP_HAS_LSA (1 << 15) ++/* Host initiated data move disable in info2 */ ++#define EP_HID (1 << 7) + /* hosts with LEC=1 use bits 31:24 as ESIT high bits. */ + #define CTX_TO_MAX_ESIT_PAYLOAD_HI(p) (((p) >> 24) & 0xff) + diff --git a/target/linux/bcm27xx/patches-6.6/950-1379-media-i2c-imx477-Add-options-for-slightly-modifying-.patch b/target/linux/bcm27xx/patches-6.6/950-1379-media-i2c-imx477-Add-options-for-slightly-modifying-.patch new file mode 100644 index 00000000000000..ee060519576c89 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1379-media-i2c-imx477-Add-options-for-slightly-modifying-.patch @@ -0,0 +1,199 @@ +From 35e50ee3d66e014d869f0d7a3468bef964d26d32 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Thu, 14 Nov 2024 13:14:02 +0000 +Subject: [PATCH] media: i2c: imx477: Add options for slightly modifying the + link freq + +The default link frequency of 450MHz has been noted to interfere +with GPS if they are in close proximty. +Add the option for 453 and 456MHz to move the signal slightly out +of the band. (447MHz can not be offered as corruption is then observed +on the 133x992 10bit mode). + +Signed-off-by: Dave Stevenson + +fixup imx477 gps +--- + drivers/media/i2c/imx477.c | 86 +++++++++++++++++++++++++++++--------- + 1 file changed, 67 insertions(+), 19 deletions(-) + +--- a/drivers/media/i2c/imx477.c ++++ b/drivers/media/i2c/imx477.c +@@ -164,8 +164,48 @@ struct imx477_mode { + struct imx477_reg_list reg_list; + }; + +-static const s64 imx477_link_freq_menu[] = { +- IMX477_DEFAULT_LINK_FREQ, ++/* Link frequency setup */ ++enum { ++ IMX477_LINK_FREQ_450MHZ, ++ IMX477_LINK_FREQ_453MHZ, ++ IMX477_LINK_FREQ_456MHZ, ++}; ++ ++static const s64 link_freqs[] = { ++ [IMX477_LINK_FREQ_450MHZ] = 450000000, ++ [IMX477_LINK_FREQ_453MHZ] = 453000000, ++ [IMX477_LINK_FREQ_456MHZ] = 456000000, ++}; ++ ++/* 450MHz is the nominal "default" link frequency */ ++static const struct imx477_reg link_450Mhz_regs[] = { ++ {0x030E, 0x00}, ++ {0x030F, 0x96}, ++}; ++ ++static const struct imx477_reg link_453Mhz_regs[] = { ++ {0x030E, 0x00}, ++ {0x030F, 0x97}, ++}; ++ ++static const struct imx477_reg link_456Mhz_regs[] = { ++ {0x030E, 0x00}, ++ {0x030F, 0x98}, ++}; ++ ++static const struct imx477_reg_list link_freq_regs[] = { ++ [IMX477_LINK_FREQ_450MHZ] = { ++ .regs = link_450Mhz_regs, ++ .num_of_regs = ARRAY_SIZE(link_450Mhz_regs) ++ }, ++ [IMX477_LINK_FREQ_453MHZ] = { ++ .regs = link_453Mhz_regs, ++ .num_of_regs = ARRAY_SIZE(link_453Mhz_regs) ++ }, ++ [IMX477_LINK_FREQ_456MHZ] = { ++ .regs = link_456Mhz_regs, ++ .num_of_regs = ARRAY_SIZE(link_456Mhz_regs) ++ }, + }; + + static const struct imx477_reg mode_common_regs[] = { +@@ -558,8 +598,6 @@ static const struct imx477_reg mode_4056 + {0x0309, 0x0c}, + {0x030b, 0x02}, + {0x030d, 0x02}, +- {0x030e, 0x00}, +- {0x030f, 0x96}, + {0x0310, 0x01}, + {0x0820, 0x07}, + {0x0821, 0x08}, +@@ -659,8 +697,6 @@ static const struct imx477_reg mode_2028 + {0x0309, 0x0c}, + {0x030b, 0x02}, + {0x030d, 0x02}, +- {0x030e, 0x00}, +- {0x030f, 0x96}, + {0x0310, 0x01}, + {0x0820, 0x07}, + {0x0821, 0x08}, +@@ -760,8 +796,6 @@ static const struct imx477_reg mode_2028 + {0x0309, 0x0c}, + {0x030b, 0x02}, + {0x030d, 0x02}, +- {0x030e, 0x00}, +- {0x030f, 0x96}, + {0x0310, 0x01}, + {0x0820, 0x07}, + {0x0821, 0x08}, +@@ -890,8 +924,6 @@ static const struct imx477_reg mode_1332 + {0x0309, 0x0a}, + {0x030b, 0x02}, + {0x030d, 0x02}, +- {0x030e, 0x00}, +- {0x030f, 0x96}, + {0x0310, 0x01}, + {0x0820, 0x07}, + {0x0821, 0x08}, +@@ -1121,6 +1153,8 @@ struct imx477 { + struct v4l2_ctrl *vblank; + struct v4l2_ctrl *hblank; + ++ unsigned int link_freq_idx; ++ + /* Current mode */ + const struct imx477_mode *mode; + +@@ -1712,7 +1746,7 @@ static int imx477_get_selection(struct v + static int imx477_start_streaming(struct imx477 *imx477) + { + struct i2c_client *client = v4l2_get_subdevdata(&imx477->sd); +- const struct imx477_reg_list *reg_list; ++ const struct imx477_reg_list *reg_list, *freq_regs; + const struct imx477_reg_list *extra_regs; + int ret, tm; + +@@ -1725,6 +1759,13 @@ static int imx477_start_streaming(struct + extra_regs->num_of_regs); + } + ++ if (!ret) { ++ /* Update the link frequency registers */ ++ freq_regs = &link_freq_regs[imx477->link_freq_idx]; ++ ret = imx477_write_regs(imx477, freq_regs->regs, ++ freq_regs->num_of_regs); ++ } ++ + if (ret) { + dev_err(&client->dev, "%s failed to set common settings\n", + __func__); +@@ -2010,9 +2051,8 @@ static int imx477_init_controls(struct i + /* LINK_FREQ is also read only */ + imx477->link_freq = + v4l2_ctrl_new_int_menu(ctrl_hdlr, &imx477_ctrl_ops, +- V4L2_CID_LINK_FREQ, +- ARRAY_SIZE(imx477_link_freq_menu) - 1, 0, +- imx477_link_freq_menu); ++ V4L2_CID_LINK_FREQ, 1, 0, ++ &link_freqs[imx477->link_freq_idx]); + if (imx477->link_freq) + imx477->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY; + +@@ -2110,13 +2150,14 @@ static void imx477_free_controls(struct + mutex_destroy(&imx477->mutex); + } + +-static int imx477_check_hwcfg(struct device *dev) ++static int imx477_check_hwcfg(struct device *dev, struct imx477 *imx477) + { + struct fwnode_handle *endpoint; + struct v4l2_fwnode_endpoint ep_cfg = { + .bus_type = V4L2_MBUS_CSI2_DPHY + }; + int ret = -EINVAL; ++ int i; + + endpoint = fwnode_graph_get_next_endpoint(dev_fwnode(dev), NULL); + if (!endpoint) { +@@ -2141,11 +2182,18 @@ static int imx477_check_hwcfg(struct dev + goto error_out; + } + +- if (ep_cfg.nr_of_link_frequencies != 1 || +- ep_cfg.link_frequencies[0] != IMX477_DEFAULT_LINK_FREQ) { ++ for (i = 0; i < ARRAY_SIZE(link_freqs); i++) { ++ if (link_freqs[i] == ep_cfg.link_frequencies[0]) { ++ imx477->link_freq_idx = i; ++ break; ++ } ++ } ++ ++ if (i == ARRAY_SIZE(link_freqs)) { + dev_err(dev, "Link frequency not supported: %lld\n", + ep_cfg.link_frequencies[0]); +- goto error_out; ++ ret = -EINVAL; ++ goto error_out; + } + + ret = 0; +@@ -2206,7 +2254,7 @@ static int imx477_probe(struct i2c_clien + (const struct imx477_compatible_data *)match->data; + + /* Check the hardware configuration in device tree */ +- if (imx477_check_hwcfg(dev)) ++ if (imx477_check_hwcfg(dev, imx477)) + return -EINVAL; + + /* Default the trigger mode from OF to -1, which means invalid */ diff --git a/target/linux/bcm27xx/patches-6.6/950-1380-dtoverlays-Add-link-frequency-override-to-imx477-378.patch b/target/linux/bcm27xx/patches-6.6/950-1380-dtoverlays-Add-link-frequency-override-to-imx477-378.patch new file mode 100644 index 00000000000000..47d3d392004a6d --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1380-dtoverlays-Add-link-frequency-override-to-imx477-378.patch @@ -0,0 +1,43 @@ +From 7e253a062d5a14de13ccfb410570975099c238be Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Thu, 14 Nov 2024 13:15:24 +0000 +Subject: [PATCH] dtoverlays: Add link-frequency override to imx477/378 overlay + +Copy of the imx708 change. + +Signed-off-by: Dave Stevenson +--- + arch/arm/boot/dts/overlays/README | 4 ++++ + arch/arm/boot/dts/overlays/imx477_378-overlay.dtsi | 1 + + 2 files changed, 5 insertions(+) + +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -2780,6 +2780,8 @@ Params: rotation Mounting + camera clamping I/Os such as XVS to 0V. + sync-source Configure as vsync source + sync-sink Configure as vsync sink ++ link-frequency Allowable link frequency values to use in Hz: ++ 450000000 (default), 453000000, 456000000. + + + Name: imx462 +@@ -2822,6 +2824,8 @@ Params: rotation Mounting + camera clamping I/Os such as XVS to 0V. + sync-source Configure as vsync source + sync-sink Configure as vsync sink ++ link-frequency Allowable link frequency values to use in Hz: ++ 450000000 (default), 453000000, 456000000. + + + Name: imx500 +--- a/arch/arm/boot/dts/overlays/imx477_378-overlay.dtsi ++++ b/arch/arm/boot/dts/overlays/imx477_378-overlay.dtsi +@@ -80,6 +80,7 @@ + <&cam_node>, "clocks:0=",<&cam0_clk>, + <&cam_node>, "VANA-supply:0=",<&cam0_reg>; + always-on = <0>, "+99"; ++ link-frequency = <&cam_endpoint>,"link-frequencies#0"; + }; + }; + diff --git a/target/linux/bcm27xx/patches-6.6/950-1381-dmaengine-dw-axi-dmac-Only-start-idle-channels.patch b/target/linux/bcm27xx/patches-6.6/950-1381-dmaengine-dw-axi-dmac-Only-start-idle-channels.patch new file mode 100644 index 00000000000000..81b7f805f3323b --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1381-dmaengine-dw-axi-dmac-Only-start-idle-channels.patch @@ -0,0 +1,29 @@ +From 59a8855b51c1d8acf37d3c80f34782d71f474617 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 13 Nov 2024 10:37:22 +0000 +Subject: [PATCH] dmaengine: dw-axi-dmac: Only start idle channels + +Attempting to start a non-idle channel causes an error message to be +logged, and is inefficient. Test for emptiness of the desc_issued list +before doing so. + +Signed-off-by: Phil Elwell +--- + drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c ++++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c +@@ -536,9 +536,11 @@ static void dma_chan_issue_pending(struc + { + struct axi_dma_chan *chan = dchan_to_axi_dma_chan(dchan); + unsigned long flags; ++ bool was_empty; + + spin_lock_irqsave(&chan->vc.lock, flags); +- if (vchan_issue_pending(&chan->vc)) ++ was_empty = list_empty(&chan->vc.desc_issued); ++ if (vchan_issue_pending(&chan->vc) && was_empty) + axi_chan_start_first_queued(chan); + spin_unlock_irqrestore(&chan->vc.lock, flags); + } diff --git a/target/linux/bcm27xx/patches-6.6/950-1351-mailbox-Add-RP1-mailbox-support.patch b/target/linux/bcm27xx/patches-6.6/950-1382-mailbox-Add-RP1-mailbox-support.patch similarity index 100% rename from target/linux/bcm27xx/patches-6.6/950-1351-mailbox-Add-RP1-mailbox-support.patch rename to target/linux/bcm27xx/patches-6.6/950-1382-mailbox-Add-RP1-mailbox-support.patch diff --git a/target/linux/bcm27xx/patches-6.6/950-1352-firmware-Add-an-RP1-firmware-interface.patch b/target/linux/bcm27xx/patches-6.6/950-1383-firmware-Add-an-RP1-firmware-interface-over-mbox.patch similarity index 100% rename from target/linux/bcm27xx/patches-6.6/950-1352-firmware-Add-an-RP1-firmware-interface.patch rename to target/linux/bcm27xx/patches-6.6/950-1383-firmware-Add-an-RP1-firmware-interface-over-mbox.patch diff --git a/target/linux/bcm27xx/patches-6.6/950-1353-misc-Add-RP1-PIO-driver.patch b/target/linux/bcm27xx/patches-6.6/950-1384-misc-Add-RP1-PIO-driver.patch similarity index 100% rename from target/linux/bcm27xx/patches-6.6/950-1353-misc-Add-RP1-PIO-driver.patch rename to target/linux/bcm27xx/patches-6.6/950-1384-misc-Add-RP1-PIO-driver.patch diff --git a/target/linux/bcm27xx/patches-6.6/950-1386-dts-bcm2712-rpi-Add-RP1-firmware-and-mailboxes.patch b/target/linux/bcm27xx/patches-6.6/950-1386-dts-bcm2712-rpi-Add-RP1-firmware-and-mailboxes.patch new file mode 100644 index 00000000000000..2afb809e5e9746 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1386-dts-bcm2712-rpi-Add-RP1-firmware-and-mailboxes.patch @@ -0,0 +1,118 @@ +From 0b76dec8dfba8c1a4793dff0c86bf73d088a812e Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 1 Nov 2024 09:12:01 +0000 +Subject: [PATCH] dts: bcm2712-rpi: Add RP1 firmware and mailboxes + +Declare the communications channel to RP1. + +Signed-off-by: Phil Elwell +--- + .../boot/dts/broadcom/bcm2712-rpi-5-b.dts | 4 +-- + .../boot/dts/broadcom/bcm2712-rpi-cm5.dtsi | 4 +-- + arch/arm64/boot/dts/broadcom/bcm2712-rpi.dtsi | 4 +++ + arch/arm64/boot/dts/broadcom/rp1.dtsi | 27 +++++++++++++++++++ + 4 files changed, 35 insertions(+), 4 deletions(-) + +--- a/arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts ++++ b/arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts +@@ -195,7 +195,7 @@ i2c_rp1boot: &_i2c3 { }; + // This is the RP1 peripheral space + ranges = <0xc0 0x40000000 + 0x02000000 0x00 0x00000000 +- 0x00 0x00400000>; ++ 0x00 0x00410000>; + + dma-ranges = + // inbound RP1 1x_xxxxxxxx -> PCIe 1x_xxxxxxxx +@@ -207,7 +207,7 @@ i2c_rp1boot: &_i2c3 { }; + // This allows the RP1 DMA controller to address RP1 hardware + <0xc0 0x40000000 + 0x02000000 0x0 0x00000000 +- 0x0 0x00400000>, ++ 0x0 0x00410000>, + + // inbound RP1 0x_xxxxxxxx -> PCIe 1x_xxxxxxxx + <0x00 0x00000000 +--- a/arch/arm64/boot/dts/broadcom/bcm2712-rpi-cm5.dtsi ++++ b/arch/arm64/boot/dts/broadcom/bcm2712-rpi-cm5.dtsi +@@ -176,7 +176,7 @@ i2c_rp1boot: &_i2c3 { }; + // This is the RP1 peripheral space + ranges = <0xc0 0x40000000 + 0x02000000 0x00 0x00000000 +- 0x00 0x00400000>; ++ 0x00 0x00410000>; + + dma-ranges = + // inbound RP1 1x_xxxxxxxx -> PCIe 1x_xxxxxxxx +@@ -188,7 +188,7 @@ i2c_rp1boot: &_i2c3 { }; + // This allows the RP1 DMA controller to address RP1 hardware + <0xc0 0x40000000 + 0x02000000 0x0 0x00000000 +- 0x0 0x00400000>, ++ 0x0 0x00410000>, + + // inbound RP1 0x_xxxxxxxx -> PCIe 1x_xxxxxxxx + <0x00 0x00000000 +--- a/arch/arm64/boot/dts/broadcom/bcm2712-rpi.dtsi ++++ b/arch/arm64/boot/dts/broadcom/bcm2712-rpi.dtsi +@@ -294,6 +294,10 @@ pciex4: &pcie2 { }; + status = "okay"; + }; + ++&rp1_mbox { ++ status = "okay"; ++}; ++ + /* Add some gpiomem nodes to make the devices accessible to userspace. + * /dev/gpiomem should expose the registers for the interface with DT alias + * gpio. +--- a/arch/arm64/boot/dts/broadcom/rp1.dtsi ++++ b/arch/arm64/boot/dts/broadcom/rp1.dtsi +@@ -13,6 +13,14 @@ + + // ranges and dma-ranges must be provided by the includer + ++ rp1_mbox: mailbox@8000 { ++ compatible = "raspberrypi,rp1-mbox"; ++ status = "disabled"; ++ reg = <0xc0 0x40008000 0x0 0x4000>; // SYSCFG ++ interrupts = ; ++ #mbox-cells = <1>; ++ }; ++ + rp1_clocks: clocks@18000 { + compatible = "raspberrypi,rp1-clocks"; + #clock-cells = <1>; +@@ -1183,6 +1191,19 @@ + assigned-clocks = <&rp1_clocks RP1_CLK_DPI>; + assigned-clock-parents = <&rp1_clocks RP1_PLL_VIDEO>; + }; ++ ++ sram: sram@400000 { ++ compatible = "mmio-sram"; ++ reg = <0xc0 0x40400000 0x0 0x10000>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ranges = <0 0xc0 0x40400000 0x10000>; ++ ++ rp1_fw_shmem: shmem@ff00 { ++ compatible = "raspberrypi,rp1-shmem"; ++ reg = <0xff00 0x100>; // firmware mailbox buffer ++ }; ++ }; + }; + }; + +@@ -1281,6 +1302,12 @@ + }; + + / { ++ rp1_firmware: rp1_firmware { ++ compatible = "raspberrypi,rp1-firmware", "simple-mfd"; ++ mboxes = <&rp1_mbox 0>; ++ shmem = <&rp1_fw_shmem>; ++ }; ++ + rp1_vdd_3v3: rp1_vdd_3v3 { + compatible = "regulator-fixed"; + regulator-name = "vdd-3v3"; diff --git a/target/linux/bcm27xx/patches-6.6/950-1387-dts-bcm2712-rpi-Add-the-RP1-PIO-device.patch b/target/linux/bcm27xx/patches-6.6/950-1387-dts-bcm2712-rpi-Add-the-RP1-PIO-device.patch new file mode 100644 index 00000000000000..29e54277c05531 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1387-dts-bcm2712-rpi-Add-the-RP1-PIO-device.patch @@ -0,0 +1,55 @@ +From 3e3c1b9922b22d362a4a9133361597ac80b974bb Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 1 Nov 2024 09:13:53 +0000 +Subject: [PATCH] dts: bcm2712-rpi: Add the RP1 PIO device + +Declare the device that proxies RP1's PIO hardware. + +Signed-off-by: Phil Elwell +--- + arch/arm64/boot/dts/broadcom/bcm2712-rpi.dtsi | 5 +++++ + arch/arm64/boot/dts/broadcom/rp1.dtsi | 12 ++++++++++++ + 2 files changed, 17 insertions(+) + +--- a/arch/arm64/boot/dts/broadcom/bcm2712-rpi.dtsi ++++ b/arch/arm64/boot/dts/broadcom/bcm2712-rpi.dtsi +@@ -97,6 +97,10 @@ + }; + }; + ++pio: &rp1_pio { ++ status = "okay"; ++}; ++ + / { + chosen: chosen { + bootargs = "reboot=w coherent_pool=1M 8250.nr_uarts=1 pci=pcie_bus_safe cgroup_disable=memory numa_policy=interleave"; +@@ -129,6 +133,7 @@ + i2c12 = &i2c_rp1boot; + mailbox = &mailbox; + mmc0 = &sdio1; ++ pio0 = &pio; + serial0 = &uart0; + serial1 = &uart1; + serial10 = &uart10; +--- a/arch/arm64/boot/dts/broadcom/rp1.dtsi ++++ b/arch/arm64/boot/dts/broadcom/rp1.dtsi +@@ -1028,6 +1028,18 @@ + status = "disabled"; + }; + ++ rp1_pio: pio@178000 { ++ reg = <0xc0 0x40178000 0x0 0x20>; ++ compatible = "raspberrypi,rp1-pio"; ++ firmware = <&rp1_firmware>; ++ dmas = <&rp1_dma RP1_DMA_PIO_CH0_TX>, <&rp1_dma RP1_DMA_PIO_CH0_RX>, ++ <&rp1_dma RP1_DMA_PIO_CH1_TX>, <&rp1_dma RP1_DMA_PIO_CH1_RX>, ++ <&rp1_dma RP1_DMA_PIO_CH2_TX>, <&rp1_dma RP1_DMA_PIO_CH2_RX>, ++ <&rp1_dma RP1_DMA_PIO_CH3_TX>, <&rp1_dma RP1_DMA_PIO_CH3_RX>; ++ dma-names = "tx0", "rx0", "tx1", "rx1", "tx2", "rx2", "tx3", "rx3"; ++ status = "disabled"; ++ }; ++ + rp1_mmc0: mmc@180000 { + reg = <0xc0 0x40180000 0x0 0x100>; + compatible = "raspberrypi,rp1-dwcmshc"; diff --git a/target/linux/bcm27xx/patches-6.6/950-1355-misc-rp1-pio-Add-an-in-kernel.patch b/target/linux/bcm27xx/patches-6.6/950-1388-misc-rp1-pio-Add-an-in-kernel-API.patch similarity index 100% rename from target/linux/bcm27xx/patches-6.6/950-1355-misc-rp1-pio-Add-an-in-kernel.patch rename to target/linux/bcm27xx/patches-6.6/950-1388-misc-rp1-pio-Add-an-in-kernel-API.patch diff --git a/target/linux/bcm27xx/patches-6.6/950-1356-pwm-Add-pwm-pio-rp1-driver.patch b/target/linux/bcm27xx/patches-6.6/950-1389-pwm-Add-pwm-pio-rp1-driver.patch similarity index 98% rename from target/linux/bcm27xx/patches-6.6/950-1356-pwm-Add-pwm-pio-rp1-driver.patch rename to target/linux/bcm27xx/patches-6.6/950-1389-pwm-Add-pwm-pio-rp1-driver.patch index 3f787de9d93584..9eed5f568d4824 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1356-pwm-Add-pwm-pio-rp1-driver.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1389-pwm-Add-pwm-pio-rp1-driver.patch @@ -15,7 +15,7 @@ Signed-off-by: Phil Elwell --- a/drivers/pwm/Kconfig +++ b/drivers/pwm/Kconfig -@@ -454,6 +454,17 @@ config PWM_PCA9685 +@@ -465,6 +465,17 @@ config PWM_PCA9685 To compile this driver as a module, choose M here: the module will be called pwm-pca9685. @@ -35,7 +35,7 @@ Signed-off-by: Phil Elwell depends on ARCH_PXA || ARCH_MMP || COMPILE_TEST --- a/drivers/pwm/Makefile +++ b/drivers/pwm/Makefile -@@ -41,6 +41,7 @@ obj-$(CONFIG_PWM_MXS) += pwm-mxs.o +@@ -42,6 +42,7 @@ obj-$(CONFIG_PWM_MXS) += pwm-mxs.o obj-$(CONFIG_PWM_NTXEC) += pwm-ntxec.o obj-$(CONFIG_PWM_OMAP_DMTIMER) += pwm-omap-dmtimer.o obj-$(CONFIG_PWM_PCA9685) += pwm-pca9685.o diff --git a/target/linux/bcm27xx/patches-6.6/950-1391-overlays-Add-pwm-pio-overlay.patch b/target/linux/bcm27xx/patches-6.6/950-1391-overlays-Add-pwm-pio-overlay.patch new file mode 100644 index 00000000000000..bd6d633319964e --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1391-overlays-Add-pwm-pio-overlay.patch @@ -0,0 +1,99 @@ +From ba7e2e3d03a432acbc338c6c03e46dcd97cfa1b3 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 7 Nov 2024 11:41:33 +0000 +Subject: [PATCH] overlays: Add pwm-pio overlay + +Add an overlay to enable a single-channel PIO-assisted PWM interface on any +header pin. + +Signed-off-by: Phil Elwell +--- + arch/arm/boot/dts/overlays/Makefile | 1 + + arch/arm/boot/dts/overlays/README | 8 ++++ + arch/arm/boot/dts/overlays/overlay_map.dts | 4 ++ + .../arm/boot/dts/overlays/pwm-pio-overlay.dts | 39 +++++++++++++++++++ + 4 files changed, 52 insertions(+) + create mode 100644 arch/arm/boot/dts/overlays/pwm-pio-overlay.dts + +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -219,6 +219,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ + pwm-2chan.dtbo \ + pwm-gpio.dtbo \ + pwm-ir-tx.dtbo \ ++ pwm-pio.dtbo \ + pwm1.dtbo \ + qca7000.dtbo \ + qca7000-uart0.dtbo \ +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -3926,6 +3926,14 @@ Params: gpio_pin Output G + func Pin function (default 2 = Alt5) + + ++Name: pwm-pio ++Info: Configures a GPIO pin as PIO-assisted PWM output. Unlike hardware PWM, ++ this can be used on any RP1 GPIO in bank 0 (0-27). Up to 4 are ++ supported, assuming nothing else is using PIO. Pi 5 only. ++Load: dtoverlay=pwm-pio,= ++Params: gpio Output GPIO (0-27, default 4) ++ ++ + Name: pwm1 + Info: Configures one or two PWM channel on PWM1 (BCM2711 only) + N.B.: +--- a/arch/arm/boot/dts/overlays/overlay_map.dts ++++ b/arch/arm/boot/dts/overlays/overlay_map.dts +@@ -240,6 +240,10 @@ + bcm2712; + }; + ++ pwm-pio { ++ bcm2712; ++ }; ++ + pwm1 { + bcm2711; + }; +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pwm-pio-overlay.dts +@@ -0,0 +1,39 @@ ++// SPDX-License-Identifier: GPL-2.0 ++// Device tree overlay for RP1 PIO PWM. ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2712"; ++ ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ pwm_pio_pins: pwm_pio_pins@4 { ++ brcm,pins = <4>; /* gpio 4 */ ++ function = "pio"; ++ bias-disable; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target-path = "/"; ++ __overlay__ { ++ pwm_pio: pwm_pio@4 { ++ compatible = "raspberrypi,pwm-pio-rp1"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pwm_pio_pins>; ++ gpios = <&gpio 4 0>; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ gpio = <&pwm_pio>,"gpios:4", ++ <&pwm_pio_pins>,"brcm,pins:0", ++ /* modify reg values to allow multiple instantiation */ ++ <&pwm_pio>,"reg:0", ++ <&pwm_pio_pins>,"reg:0"; ++ }; ++}; diff --git a/target/linux/bcm27xx/patches-6.6/950-1354-fixup-musc-add-RP1-PIO-driver.patch b/target/linux/bcm27xx/patches-6.6/950-1392-fixup-misc-Add-RP1-PIO-driver.patch similarity index 100% rename from target/linux/bcm27xx/patches-6.6/950-1354-fixup-musc-add-RP1-PIO-driver.patch rename to target/linux/bcm27xx/patches-6.6/950-1392-fixup-misc-Add-RP1-PIO-driver.patch diff --git a/target/linux/bcm27xx/patches-6.6/950-1394-misc-rp1-pio-Add-compat_ioctl-method.patch b/target/linux/bcm27xx/patches-6.6/950-1394-misc-rp1-pio-Add-compat_ioctl-method.patch index bffa2418a15644..6862a74e21450b 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1394-misc-rp1-pio-Add-compat_ioctl-method.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1394-misc-rp1-pio-Add-compat_ioctl-method.patch @@ -1,7 +1,7 @@ From b4472d09b1ffdafd8132803ffbec62596e559fd8 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 18 Nov 2024 09:10:52 +0000 -Subject: [PATCH 1394/1482] misc: rp1-pio: Add compat_ioctl method +Subject: [PATCH] misc: rp1-pio: Add compat_ioctl method Provide a compat_ioctl method, to support running a 64-bit kernel with a 32-bit userland. @@ -13,7 +13,7 @@ Signed-off-by: Phil Elwell --- a/drivers/misc/rp1-pio.c +++ b/drivers/misc/rp1-pio.c -@@ -1023,11 +1023,75 @@ static long rp1_pio_ioctl(struct file *f +@@ -996,11 +996,75 @@ static long rp1_pio_ioctl(struct file *f return ret; } diff --git a/target/linux/bcm27xx/patches-6.6/950-0998-i2c-designware-Add-support-for-bus-clear-feature.patch b/target/linux/bcm27xx/patches-6.6/950-1396-i2c-designware-Add-support-for-bus-clear-feature.patch similarity index 93% rename from target/linux/bcm27xx/patches-6.6/950-0998-i2c-designware-Add-support-for-bus-clear-feature.patch rename to target/linux/bcm27xx/patches-6.6/950-1396-i2c-designware-Add-support-for-bus-clear-feature.patch index 691484d46e02c8..bc20db253afc53 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0998-i2c-designware-Add-support-for-bus-clear-feature.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1396-i2c-designware-Add-support-for-bus-clear-feature.patch @@ -1,7 +1,7 @@ -From 24cb07b0c0724a22e474d12e7c2d5b834bf3b076 Mon Sep 17 00:00:00 2001 +From 0e4968617aad7d0f88e0a630499202eaae407a19 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 26 Mar 2024 15:57:46 +0000 -Subject: [PATCH 0998/1085] i2c: designware: Add support for bus clear feature +Subject: [PATCH] i2c: designware: Add support for bus clear feature Newer versions of the DesignWare I2C block support the detection of stuck signals, and a mechanism to recover from them. Add the required @@ -108,7 +108,7 @@ Signed-off-by: Phil Elwell DW_IC_TX_ABRT_10ADDR1_NOACK | \ --- a/drivers/i2c/busses/i2c-designware-master.c +++ b/drivers/i2c/busses/i2c-designware-master.c -@@ -212,6 +212,7 @@ static int i2c_dw_set_timings_master(str +@@ -215,6 +215,7 @@ static int i2c_dw_set_timings_master(str */ static int i2c_dw_init_master(struct dw_i2c_dev *dev) { @@ -116,7 +116,7 @@ Signed-off-by: Phil Elwell int ret; ret = i2c_dw_acquire_lock(dev); -@@ -235,6 +236,17 @@ static int i2c_dw_init_master(struct dw_ +@@ -238,6 +239,17 @@ static int i2c_dw_init_master(struct dw_ regmap_write(dev->map, DW_IC_HS_SCL_LCNT, dev->hs_lcnt); } @@ -134,7 +134,7 @@ Signed-off-by: Phil Elwell /* Write SDA hold time if supported */ if (dev->sda_hold_time) regmap_write(dev->map, DW_IC_SDA_HOLD, dev->sda_hold_time); -@@ -1071,6 +1083,7 @@ int i2c_dw_probe_master(struct dw_i2c_de +@@ -1074,6 +1086,7 @@ int i2c_dw_probe_master(struct dw_i2c_de struct i2c_adapter *adap = &dev->adapter; unsigned long irq_flags; unsigned int ic_con; @@ -142,7 +142,7 @@ Signed-off-by: Phil Elwell int ret; init_completion(&dev->cmd_complete); -@@ -1106,7 +1119,11 @@ int i2c_dw_probe_master(struct dw_i2c_de +@@ -1109,7 +1122,11 @@ int i2c_dw_probe_master(struct dw_i2c_de if (ret) return ret; diff --git a/target/linux/bcm27xx/patches-6.6/950-1397-drivers-media-pci-Update-Hailo-accelerator-device-dr.patch b/target/linux/bcm27xx/patches-6.6/950-1397-drivers-media-pci-Update-Hailo-accelerator-device-dr.patch new file mode 100644 index 00000000000000..3ad28d688669e8 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1397-drivers-media-pci-Update-Hailo-accelerator-device-dr.patch @@ -0,0 +1,3592 @@ +From 32511f035b086bca254d8adab234cef3541492b4 Mon Sep 17 00:00:00 2001 +From: Naushir Patuck +Date: Thu, 17 Oct 2024 11:37:29 +0100 +Subject: [PATCH] drivers: media: pci: Update Hailo accelerator device driver + to v4.19 + +Sourced from https://github.com/hailo-ai/hailort-drivers/ + +Signed-off-by: Naushir Patuck +--- + drivers/media/pci/hailo/Makefile | 4 +- + drivers/media/pci/hailo/common/fw_operation.c | 50 ++- + drivers/media/pci/hailo/common/fw_operation.h | 8 +- + .../media/pci/hailo/common/fw_validation.c | 10 +- + .../media/pci/hailo/common/fw_validation.h | 7 +- + .../pci/hailo/common/hailo_ioctl_common.h | 28 +- + .../media/pci/hailo/common/hailo_resource.c | 23 +- + .../media/pci/hailo/common/hailo_resource.h | 2 +- + drivers/media/pci/hailo/common/pcie_common.c | 380 +++++++++--------- + drivers/media/pci/hailo/common/pcie_common.h | 38 +- + drivers/media/pci/hailo/common/soc_structs.h | 79 ++++ + drivers/media/pci/hailo/common/utils.h | 23 +- + drivers/media/pci/hailo/common/vdma_common.c | 93 +++-- + drivers/media/pci/hailo/common/vdma_common.h | 22 +- + drivers/media/pci/hailo/src/fops.c | 284 ++----------- + drivers/media/pci/hailo/src/fops.h | 5 +- + drivers/media/pci/hailo/src/nnc.c | 299 ++++++++++++++ + drivers/media/pci/hailo/src/nnc.h | 22 + + drivers/media/pci/hailo/src/pci_soc_ioctl.c | 155 ------- + drivers/media/pci/hailo/src/pcie.c | 166 +++----- + drivers/media/pci/hailo/src/pcie.h | 26 +- + drivers/media/pci/hailo/src/soc.c | 244 +++++++++++ + .../pci/hailo/src/{pci_soc_ioctl.h => soc.h} | 13 +- + drivers/media/pci/hailo/src/sysfs.c | 2 +- + drivers/media/pci/hailo/src/sysfs.h | 2 +- + drivers/media/pci/hailo/src/utils.c | 26 -- + drivers/media/pci/hailo/utils/compact.h | 2 +- + drivers/media/pci/hailo/utils/fw_common.h | 2 +- + .../pci/hailo/utils/integrated_nnc_utils.c | 10 +- + .../pci/hailo/utils/integrated_nnc_utils.h | 2 +- + drivers/media/pci/hailo/utils/logs.c | 2 +- + drivers/media/pci/hailo/utils/logs.h | 2 +- + drivers/media/pci/hailo/vdma/ioctl.c | 18 +- + drivers/media/pci/hailo/vdma/ioctl.h | 6 +- + drivers/media/pci/hailo/vdma/memory.c | 12 +- + drivers/media/pci/hailo/vdma/memory.h | 2 +- + drivers/media/pci/hailo/vdma/vdma.c | 39 +- + drivers/media/pci/hailo/vdma/vdma.h | 5 +- + 38 files changed, 1224 insertions(+), 889 deletions(-) + create mode 100644 drivers/media/pci/hailo/common/soc_structs.h + create mode 100644 drivers/media/pci/hailo/src/nnc.c + create mode 100644 drivers/media/pci/hailo/src/nnc.h + delete mode 100755 drivers/media/pci/hailo/src/pci_soc_ioctl.c + create mode 100644 drivers/media/pci/hailo/src/soc.c + rename drivers/media/pci/hailo/src/{pci_soc_ioctl.h => soc.h} (53%) + mode change 100755 => 100644 + delete mode 100644 drivers/media/pci/hailo/src/utils.c + +--- a/drivers/media/pci/hailo/Makefile ++++ b/drivers/media/pci/hailo/Makefile +@@ -8,9 +8,9 @@ obj-$(CONFIG_MEDIA_PCI_HAILO) := hailo_p + + hailo_pci-objs += src/pcie.o + hailo_pci-objs += src/fops.o +-hailo_pci-objs += src/utils.o + hailo_pci-objs += src/sysfs.o +-hailo_pci-objs += src/pci_soc_ioctl.o ++hailo_pci-objs += src/nnc.o ++hailo_pci-objs += src/soc.o + + hailo_pci-objs += $(COMMON_SRC_DIRECTORY)/fw_validation.o + hailo_pci-objs += $(COMMON_SRC_DIRECTORY)/fw_operation.o +--- a/drivers/media/pci/hailo/common/fw_operation.c ++++ b/drivers/media/pci/hailo/common/fw_operation.c +@@ -1,7 +1,7 @@ + // SPDX-License-Identifier: MIT + /** +- * Copyright (c) 2022 Hailo Technologies Ltd. All rights reserved. +-**/ ++ * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. ++ **/ + + #include "fw_operation.h" + +@@ -15,7 +15,10 @@ typedef struct { + u32 chip_offset; + } FW_DEBUG_BUFFER_HEADER_t; + +-#define DEBUG_BUFFER_DATA_SIZE (DEBUG_BUFFER_TOTAL_SIZE - sizeof(FW_DEBUG_BUFFER_HEADER_t)) ++#define DEBUG_BUFFER_DATA_SIZE (DEBUG_BUFFER_TOTAL_SIZE - sizeof(FW_DEBUG_BUFFER_HEADER_t)) ++#define PCIE_D2H_NOTIFICATION_SRAM_OFFSET (0x640 + 0x640) ++#define PCIE_APP_CPU_DEBUG_OFFSET (8*1024) ++#define PCIE_CORE_CPU_DEBUG_OFFSET (PCIE_APP_CPU_DEBUG_OFFSET + DEBUG_BUFFER_TOTAL_SIZE) + + int hailo_read_firmware_notification(struct hailo_resource *resource, struct hailo_d2h_notification *notification) + { +@@ -35,6 +38,21 @@ int hailo_read_firmware_notification(str + return 0; + } + ++int hailo_pcie_read_firmware_notification(struct hailo_resource *resource, ++ struct hailo_d2h_notification *notification) ++{ ++ struct hailo_resource notification_resource; ++ ++ if (PCIE_D2H_NOTIFICATION_SRAM_OFFSET > resource->size) { ++ return -EINVAL; ++ } ++ ++ notification_resource.address = resource->address + PCIE_D2H_NOTIFICATION_SRAM_OFFSET, ++ notification_resource.size = sizeof(struct hailo_d2h_notification); ++ ++ return hailo_read_firmware_notification(¬ification_resource, notification); ++} ++ + static inline size_t calculate_log_ready_to_read(FW_DEBUG_BUFFER_HEADER_t *header) + { + size_t ready_to_read = 0; +@@ -100,4 +118,30 @@ long hailo_read_firmware_log(struct hail + + params->read_bytes = ready_to_read; + return 0; ++} ++ ++long hailo_pcie_read_firmware_log(struct hailo_resource *resource, struct hailo_read_log_params *params) ++{ ++ long err = 0; ++ struct hailo_resource log_resource = {resource->address, DEBUG_BUFFER_TOTAL_SIZE}; ++ ++ if (HAILO_CPU_ID_CPU0 == params->cpu_id) { ++ log_resource.address += PCIE_APP_CPU_DEBUG_OFFSET; ++ } else if (HAILO_CPU_ID_CPU1 == params->cpu_id) { ++ log_resource.address += PCIE_CORE_CPU_DEBUG_OFFSET; ++ } else { ++ return -EINVAL; ++ } ++ ++ if (0 == params->buffer_size) { ++ params->read_bytes = 0; ++ return 0; ++ } ++ ++ err = hailo_read_firmware_log(&log_resource, params); ++ if (0 != err) { ++ return err; ++ } ++ ++ return 0; + } +\ No newline at end of file +--- a/drivers/media/pci/hailo/common/fw_operation.h ++++ b/drivers/media/pci/hailo/common/fw_operation.h +@@ -1,7 +1,7 @@ + // SPDX-License-Identifier: MIT + /** +- * Copyright (c) 2022 Hailo Technologies Ltd. All rights reserved. +-**/ ++ * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. ++ **/ + + #ifndef _HAILO_COMMON_FIRMWARE_OPERATION_H_ + #define _HAILO_COMMON_FIRMWARE_OPERATION_H_ +@@ -16,8 +16,12 @@ extern "C" { + + int hailo_read_firmware_notification(struct hailo_resource *resource, struct hailo_d2h_notification *notification); + ++int hailo_pcie_read_firmware_notification(struct hailo_resource *resource, struct hailo_d2h_notification *notification); ++ + long hailo_read_firmware_log(struct hailo_resource *fw_logger_resource, struct hailo_read_log_params *params); + ++long hailo_pcie_read_firmware_log(struct hailo_resource *resource, struct hailo_read_log_params *params); ++ + #ifdef __cplusplus + } + #endif +--- a/drivers/media/pci/hailo/common/fw_validation.c ++++ b/drivers/media/pci/hailo/common/fw_validation.c +@@ -1,6 +1,6 @@ + // SPDX-License-Identifier: MIT + /** +- * Copyright (c) 2019-2022 Hailo Technologies Ltd. All rights reserved. ++ * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. + **/ + + #include "fw_validation.h" +@@ -85,15 +85,15 @@ exit: + } + + int FW_VALIDATION__validate_cert_header(uintptr_t firmware_base_address, +- size_t firmware_size, u32 *outer_consumed_firmware_offset, secure_boot_certificate_t **out_firmware_cert) ++ size_t firmware_size, u32 *outer_consumed_firmware_offset, secure_boot_certificate_header_t **out_firmware_cert) + { + +- secure_boot_certificate_t *firmware_cert = NULL; ++ secure_boot_certificate_header_t *firmware_cert = NULL; + int err = -EINVAL; + u32 consumed_firmware_offset = *outer_consumed_firmware_offset; + +- firmware_cert = (secure_boot_certificate_t *) (firmware_base_address + consumed_firmware_offset); +- CONSUME_FIRMWARE(sizeof(secure_boot_certificate_t), -EINVAL); ++ firmware_cert = (secure_boot_certificate_header_t *) (firmware_base_address + consumed_firmware_offset); ++ CONSUME_FIRMWARE(sizeof(secure_boot_certificate_header_t), -EINVAL); + + if ((MAXIMUM_FIRMWARE_CERT_KEY_SIZE < firmware_cert->key_size) || + (MAXIMUM_FIRMWARE_CERT_CONTENT_SIZE < firmware_cert->content_size)) { +--- a/drivers/media/pci/hailo/common/fw_validation.h ++++ b/drivers/media/pci/hailo/common/fw_validation.h +@@ -1,6 +1,6 @@ + // SPDX-License-Identifier: MIT + /** +- * Copyright (c) 2019-2022 Hailo Technologies Ltd. All rights reserved. ++ * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. + **/ + + #ifndef PCIE_COMMON_FIRMWARE_HEADER_UTILS_H_ +@@ -44,8 +44,7 @@ typedef struct { + typedef struct { + u32 key_size; + u32 content_size; +- u8 certificates_data[0]; +-} secure_boot_certificate_t; ++} secure_boot_certificate_header_t; + + #ifdef _MSC_VER + #pragma warning(pop) +@@ -60,6 +59,6 @@ int FW_VALIDATION__validate_fw_header(ui + firmware_header_t **out_firmware_header, enum hailo_board_type board_type); + + int FW_VALIDATION__validate_cert_header(uintptr_t firmware_base_address, +- size_t firmware_size, u32 *outer_consumed_firmware_offset, secure_boot_certificate_t **out_firmware_cert); ++ size_t firmware_size, u32 *outer_consumed_firmware_offset, secure_boot_certificate_header_t **out_firmware_cert); + + #endif +\ No newline at end of file +--- a/drivers/media/pci/hailo/common/hailo_ioctl_common.h ++++ b/drivers/media/pci/hailo/common/hailo_ioctl_common.h +@@ -1,13 +1,13 @@ + // SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) AND MIT + /** +- * Copyright (c) 2019-2022 Hailo Technologies Ltd. All rights reserved. ++ * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. + **/ + + #ifndef _HAILO_IOCTL_COMMON_H_ + #define _HAILO_IOCTL_COMMON_H_ + + #define HAILO_DRV_VER_MAJOR 4 +-#define HAILO_DRV_VER_MINOR 18 ++#define HAILO_DRV_VER_MINOR 19 + #define HAILO_DRV_VER_REVISION 0 + + #define _STRINGIFY_EXPANDED( x ) #x +@@ -17,10 +17,11 @@ + + // This value is not easily changeable. + // For example: the channel interrupts ioctls assume we have up to 32 channels +-#define MAX_VDMA_CHANNELS_PER_ENGINE (32) +-#define MAX_VDMA_ENGINES (3) +-#define SIZE_OF_VDMA_DESCRIPTOR (16) +-#define VDMA_DEST_CHANNELS_START (16) ++#define MAX_VDMA_CHANNELS_PER_ENGINE (32) ++#define VDMA_CHANNELS_PER_ENGINE_PER_DIRECTION (16) ++#define MAX_VDMA_ENGINES (3) ++#define SIZE_OF_VDMA_DESCRIPTOR (16) ++#define VDMA_DEST_CHANNELS_START (16) + + #define HAILO_VDMA_MAX_ONGOING_TRANSFERS (128) + #define HAILO_VDMA_MAX_ONGOING_TRANSFERS_MASK (HAILO_VDMA_MAX_ONGOING_TRANSFERS - 1) +@@ -37,8 +38,8 @@ + #define FW_ACCESS_APP_CPU_CONTROL_MASK (1 << FW_ACCESS_CONTROL_INTERRUPT_SHIFT) + #define FW_ACCESS_DRIVER_SHUTDOWN_SHIFT (2) + #define FW_ACCESS_DRIVER_SHUTDOWN_MASK (1 << FW_ACCESS_DRIVER_SHUTDOWN_SHIFT) +-#define FW_ACCESS_SOC_CONNECT_SHIFT (3) +-#define FW_ACCESS_SOC_CONNECT_MASK (1 << FW_ACCESS_SOC_CONNECT_SHIFT) ++#define FW_ACCESS_SOC_CONTROL_SHIFT (3) ++#define FW_ACCESS_SOC_CONTROL_MASK (1 << FW_ACCESS_SOC_CONTROL_SHIFT) + + #define INVALID_VDMA_CHANNEL (0xff) + +@@ -245,6 +246,12 @@ struct hailo_desc_list_release_params { + uintptr_t desc_handle; // in + }; + ++struct hailo_write_action_list_params { ++ uint8_t *data; // in ++ size_t size; // in ++ uint64_t dma_address; // out ++}; ++ + /* structure used in ioctl HAILO_DESC_LIST_BIND_VDMA_BUFFER */ + struct hailo_desc_list_program_params { + size_t buffer_handle; // in +@@ -508,6 +515,7 @@ struct hailo_vdma_launch_transfer_params + + /* structure used in ioctl HAILO_SOC_CONNECT */ + struct hailo_soc_connect_params { ++ uint16_t port_number; // in + uint8_t input_channel_index; // out + uint8_t output_channel_index; // out + uintptr_t input_desc_handle; // in +@@ -522,6 +530,7 @@ struct hailo_soc_close_params { + + /* structure used in ioctl HAILO_PCI_EP_ACCEPT */ + struct hailo_pci_ep_accept_params { ++ uint16_t port_number; // in + uint8_t input_channel_index; // out + uint8_t output_channel_index; // out + uintptr_t input_desc_handle; // in +@@ -562,6 +571,7 @@ struct tCompatibleHailoIoctlData + struct hailo_soc_close_params SocCloseParams; + struct hailo_pci_ep_accept_params AcceptParams; + struct hailo_pci_ep_close_params PciEpCloseParams; ++ struct hailo_write_action_list_params WriteActionListParams; + } Buffer; + }; + #endif // _MSC_VER +@@ -632,6 +642,7 @@ enum hailo_nnc_ioctl_code { + HAILO_DISABLE_NOTIFICATION_CODE, + HAILO_READ_LOG_CODE, + HAILO_RESET_NN_CORE_CODE, ++ HAILO_WRITE_ACTION_LIST_CODE, + + // Must be last + HAILO_NNC_IOCTL_MAX_NR +@@ -642,6 +653,7 @@ enum hailo_nnc_ioctl_code { + #define HAILO_DISABLE_NOTIFICATION _IO_(HAILO_NNC_IOCTL_MAGIC, HAILO_DISABLE_NOTIFICATION_CODE) + #define HAILO_READ_LOG _IOWR_(HAILO_NNC_IOCTL_MAGIC, HAILO_READ_LOG_CODE, struct hailo_read_log_params) + #define HAILO_RESET_NN_CORE _IO_(HAILO_NNC_IOCTL_MAGIC, HAILO_RESET_NN_CORE_CODE) ++#define HAILO_WRITE_ACTION_LIST _IOW_(HAILO_NNC_IOCTL_MAGIC, HAILO_WRITE_ACTION_LIST_CODE, struct hailo_write_action_list_params) + + enum hailo_soc_ioctl_code { + HAILO_SOC_IOCTL_CONNECT_CODE, +--- a/drivers/media/pci/hailo/common/hailo_resource.c ++++ b/drivers/media/pci/hailo/common/hailo_resource.c +@@ -1,24 +1,31 @@ + // SPDX-License-Identifier: MIT + /** +- * Copyright (c) 2019-2022 Hailo Technologies Ltd. All rights reserved. ++ * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. + **/ + + #include "hailo_resource.h" + ++#include "utils.h" ++ + #include + #include + #include + #include + ++#define ALIGN_TO_32_BIT(addr) ((addr) & (~((uintptr_t)0x3))) + + u8 hailo_resource_read8(struct hailo_resource *resource, size_t offset) + { +- return ioread8((u8*)resource->address + offset); ++ u32 val = ioread32((u8*)ALIGN_TO_32_BIT(resource->address + offset)); ++ u64 offset_in_bits = BITS_IN_BYTE * ((resource->address + offset) - ALIGN_TO_32_BIT(resource->address + offset)); ++ return (u8)READ_BITS_AT_OFFSET(BYTE_SIZE * BITS_IN_BYTE, offset_in_bits, val); + } + + u16 hailo_resource_read16(struct hailo_resource *resource, size_t offset) + { +- return ioread16((u8*)resource->address + offset); ++ u32 val = ioread32((u8*)ALIGN_TO_32_BIT(resource->address + offset)); ++ u64 offset_in_bits = BITS_IN_BYTE * ((resource->address + offset) - ALIGN_TO_32_BIT(resource->address + offset)); ++ return (u16)READ_BITS_AT_OFFSET(WORD_SIZE * BITS_IN_BYTE, offset_in_bits, val); + } + + u32 hailo_resource_read32(struct hailo_resource *resource, size_t offset) +@@ -28,12 +35,18 @@ u32 hailo_resource_read32(struct hailo_r + + void hailo_resource_write8(struct hailo_resource *resource, size_t offset, u8 value) + { +- iowrite8(value, (u8*)resource->address + offset); ++ u32 initial_val = ioread32((u8*)ALIGN_TO_32_BIT(resource->address + offset)); ++ u64 offset_in_bits = BITS_IN_BYTE * ((resource->address + offset) - ALIGN_TO_32_BIT(resource->address + offset)); ++ iowrite32(WRITE_BITS_AT_OFFSET(BYTE_SIZE * BITS_IN_BYTE, offset_in_bits, initial_val, value), ++ (u8*)ALIGN_TO_32_BIT(resource->address + offset)); + } + + void hailo_resource_write16(struct hailo_resource *resource, size_t offset, u16 value) + { +- iowrite16(value, (u8*)resource->address + offset); ++ u32 initial_val = ioread32((u8*)ALIGN_TO_32_BIT(resource->address + offset)); ++ u64 offset_in_bits = BITS_IN_BYTE * ((resource->address + offset) - ALIGN_TO_32_BIT(resource->address + offset)); ++ iowrite32(WRITE_BITS_AT_OFFSET(WORD_SIZE * BITS_IN_BYTE, offset_in_bits, initial_val, value), ++ (u8*)ALIGN_TO_32_BIT(resource->address + offset)); + } + + void hailo_resource_write32(struct hailo_resource *resource, size_t offset, u32 value) +--- a/drivers/media/pci/hailo/common/hailo_resource.h ++++ b/drivers/media/pci/hailo/common/hailo_resource.h +@@ -1,6 +1,6 @@ + // SPDX-License-Identifier: MIT + /** +- * Copyright (c) 2019-2022 Hailo Technologies Ltd. All rights reserved. ++ * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. + **/ + + #ifndef _HAILO_COMMON_HAILO_RESOURCE_H_ +--- a/drivers/media/pci/hailo/common/pcie_common.c ++++ b/drivers/media/pci/hailo/common/pcie_common.c +@@ -1,10 +1,11 @@ + // SPDX-License-Identifier: MIT + /** +- * Copyright (c) 2019-2022 Hailo Technologies Ltd. All rights reserved. ++ * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. + **/ + + #include "pcie_common.h" + #include "fw_operation.h" ++#include "soc_structs.h" + + #include + #include +@@ -35,10 +36,6 @@ + #define FIRMWARE_LOAD_WAIT_MAX_RETRIES (100) + #define FIRMWARE_LOAD_SLEEP_MS (50) + +-#define PCIE_APP_CPU_DEBUG_OFFSET (8*1024) +-#define PCIE_CORE_CPU_DEBUG_OFFSET (PCIE_APP_CPU_DEBUG_OFFSET + DEBUG_BUFFER_TOTAL_SIZE) +- +-#define PCIE_D2H_NOTIFICATION_SRAM_OFFSET (0x640 + 0x640) + #define PCIE_REQUEST_SIZE_OFFSET (0x640) + + #define PCIE_CONFIG_VENDOR_OFFSET (0x0098) +@@ -59,7 +56,6 @@ struct hailo_fw_addresses { + u32 app_fw_code_ram_base; + u32 boot_key_cert; + u32 boot_cont_cert; +- u32 boot_fw_trigger; + u32 core_code_ram_base; + u32 core_fw_header; + u32 atr0_trsl_addr1; +@@ -69,13 +65,11 @@ struct hailo_fw_addresses { + + struct loading_stage { + const struct hailo_file_batch *batch; ++ u32 trigger_address; + }; + + struct hailo_board_compatibility { + struct hailo_fw_addresses fw_addresses; +- const char *fw_filename; +- const struct hailo_config_constants board_cfg; +- const struct hailo_config_constants fw_cfg; + const struct loading_stage stages[MAX_LOADING_STAGES]; + }; + +@@ -85,28 +79,32 @@ static const struct hailo_file_batch hai + .address = 0xA0000, + .max_size = 0x8004, + .is_mandatory = true, +- .has_header = false ++ .has_header = false, ++ .has_core = false + }, + { + .filename = "hailo/hailo10h/u-boot.dtb.signed", + .address = 0xA8004, + .max_size = 0x20000, + .is_mandatory = true, +- .has_header = false ++ .has_header = false, ++ .has_core = false + }, + { + .filename = "hailo/hailo10h/scu_fw.bin", + .address = 0x20000, + .max_size = 0x40000, + .is_mandatory = true, +- .has_header = true ++ .has_header = true, ++ .has_core = false + }, + { + .filename = NULL, + .address = 0x00, + .max_size = 0x00, + .is_mandatory = false, +- .has_header = false ++ .has_header = false, ++ .has_core = false + } + }; + +@@ -116,36 +114,140 @@ static const struct hailo_file_batch hai + .address = 0x85000000, + .max_size = 0x1000000, + .is_mandatory = true, +- .has_header = false ++ .has_header = false, ++ .has_core = false + }, + { + .filename = "hailo/hailo10h/u-boot-tfa.itb", + .address = 0x86000000, + .max_size = 0x1000000, + .is_mandatory = true, +- .has_header = false ++ .has_header = false, ++ .has_core = false + }, + { + .filename = "hailo/hailo10h/fitImage", + .address = 0x87000000, + .max_size = 0x1000000, + .is_mandatory = true, +- .has_header = false ++ .has_header = false, ++ .has_core = false + }, + { + .filename = "hailo/hailo10h/core-image-minimal-hailo10-m2.ext4.gz", + .address = 0x88000000, + .max_size = 0x20000000, // Max size 512MB + .is_mandatory = true, +- .has_header = false ++ .has_header = false, ++ .has_core = false + }, + }; + ++// If loading linux from EMMC - only need few files from second batch (u-boot-spl.bin and u-boot-tfa.itb) ++static const struct hailo_file_batch hailo10h_files_stg2_linux_in_emmc[] = { ++ { ++ .filename = "hailo/hailo10h/u-boot-spl.bin", ++ .address = 0x85000000, ++ .max_size = 0x1000000, ++ .is_mandatory = true, ++ .has_header = false, ++ .has_core = false ++ }, ++ { ++ .filename = "hailo/hailo10h/u-boot-tfa.itb", ++ .address = 0x86000000, ++ .max_size = 0x1000000, ++ .is_mandatory = true, ++ .has_header = false, ++ .has_core = false ++ }, ++ { ++ .filename = NULL, ++ .address = 0x00, ++ .max_size = 0x00, ++ .is_mandatory = false, ++ .has_header = false, ++ .has_core = false ++ }, ++}; ++ ++static const struct hailo_file_batch hailo8_files_stg1[] = { ++ { ++ .filename = "hailo/hailo8_fw.4.19.0.bin", ++ .address = 0x20000, ++ .max_size = 0x50000, ++ .is_mandatory = true, ++ .has_header = true, ++ .has_core = true ++ }, ++ { ++ .filename = "hailo/hailo8_board_cfg.bin", ++ .address = 0x60001000, ++ .max_size = PCIE_HAILO8_BOARD_CFG_MAX_SIZE, ++ .is_mandatory = false, ++ .has_header = false, ++ .has_core = false ++ }, ++ { ++ .filename = "hailo/hailo8_fw_cfg.bin", ++ .address = 0x60001500, ++ .max_size = PCIE_HAILO8_FW_CFG_MAX_SIZE, ++ .is_mandatory = false, ++ .has_header = false, ++ .has_core = false ++ }, ++ { ++ .filename = NULL, ++ .address = 0x00, ++ .max_size = 0x00, ++ .is_mandatory = false, ++ .has_header = false, ++ .has_core = false ++ } ++}; ++ ++static const struct hailo_file_batch hailo10h_legacy_files_stg1[] = { ++ { ++ .filename = "hailo/hailo15_fw.bin", ++ .address = 0x20000, ++ .max_size = 0x100000, ++ .is_mandatory = true, ++ .has_header = true, ++ .has_core = true ++ }, ++ { ++ .filename = NULL, ++ .address = 0x00, ++ .max_size = 0x00, ++ .is_mandatory = false, ++ .has_header = false, ++ .has_core = false ++ } ++}; ++ ++static const struct hailo_file_batch pluto_files_stg1[] = { ++ { ++ .filename = "hailo/pluto_fw.bin", ++ .address = 0x20000, ++ .max_size = 0x100000, ++ .is_mandatory = true, ++ .has_header = true, ++ .has_core = true ++ }, ++ { ++ .filename = NULL, ++ .address = 0x00, ++ .max_size = 0x00, ++ .is_mandatory = false, ++ .has_header = false, ++ .has_core = false ++ } ++}; ++ + static const struct hailo_board_compatibility compat[HAILO_BOARD_TYPE_COUNT] = { + [HAILO_BOARD_TYPE_HAILO8] = { + .fw_addresses = { + .boot_fw_header = 0xE0030, +- .boot_fw_trigger = 0xE0980, + .boot_key_cert = 0xE0048, + .boot_cont_cert = 0xE0390, + .app_fw_code_ram_base = 0x60000, +@@ -155,22 +257,16 @@ static const struct hailo_board_compatib + .raise_ready_offset = 0x1684, + .boot_status = 0xe0000, + }, +- .fw_filename = "hailo/hailo8_fw.bin", +- .board_cfg = { +- .filename = "hailo/hailo8_board_cfg.bin", +- .address = 0x60001000, +- .max_size = PCIE_HAILO8_BOARD_CFG_MAX_SIZE, +- }, +- .fw_cfg = { +- .filename = "hailo/hailo8_fw_cfg.bin", +- .address = 0x60001500, +- .max_size = PCIE_HAILO8_FW_CFG_MAX_SIZE, ++ .stages = { ++ { ++ .batch = hailo8_files_stg1, ++ .trigger_address = 0xE0980 ++ }, + }, + }, + [HAILO_BOARD_TYPE_HAILO10H_LEGACY] = { + .fw_addresses = { + .boot_fw_header = 0x88000, +- .boot_fw_trigger = 0x88c98, + .boot_key_cert = 0x88018, + .boot_cont_cert = 0x886a8, + .app_fw_code_ram_base = 0x20000, +@@ -180,22 +276,16 @@ static const struct hailo_board_compatib + .raise_ready_offset = 0x1754, + .boot_status = 0x80000, + }, +- .fw_filename = "hailo/hailo15_fw.bin", +- .board_cfg = { +- .filename = NULL, +- .address = 0, +- .max_size = 0, +- }, +- .fw_cfg = { +- .filename = NULL, +- .address = 0, +- .max_size = 0, ++ .stages = { ++ { ++ .batch = hailo10h_legacy_files_stg1, ++ .trigger_address = 0x88c98 ++ }, + }, + }, + [HAILO_BOARD_TYPE_HAILO10H] = { + .fw_addresses = { + .boot_fw_header = 0x88000, +- .boot_fw_trigger = 0x88c98, + .boot_key_cert = 0x88018, + .boot_cont_cert = 0x886a8, + .app_fw_code_ram_base = 0x20000, +@@ -205,23 +295,18 @@ static const struct hailo_board_compatib + .raise_ready_offset = 0x1754, + .boot_status = 0x80000, + }, +- .fw_filename = NULL, +- .board_cfg = { +- .filename = NULL, +- .address = 0, +- .max_size = 0, +- }, +- .fw_cfg = { +- .filename = NULL, +- .address = 0, +- .max_size = 0, +- }, + .stages = { + { + .batch = hailo10h_files_stg1, ++ .trigger_address = 0x88c98 + }, + { + .batch = hailo10h_files_stg2, ++ .trigger_address = 0x84000000 ++ }, ++ { ++ .batch = hailo10h_files_stg2_linux_in_emmc, ++ .trigger_address = 0x84000000 + }, + }, + }, +@@ -230,7 +315,6 @@ static const struct hailo_board_compatib + [HAILO_BOARD_TYPE_PLUTO] = { + .fw_addresses = { + .boot_fw_header = 0x88000, +- .boot_fw_trigger = 0x88c98, + .boot_key_cert = 0x88018, + .boot_cont_cert = 0x886a8, + .app_fw_code_ram_base = 0x20000, +@@ -241,16 +325,11 @@ static const struct hailo_board_compatib + .raise_ready_offset = 0x174c, + .boot_status = 0x80000, + }, +- .fw_filename = "hailo/pluto_fw.bin", +- .board_cfg = { +- .filename = NULL, +- .address = 0, +- .max_size = 0, +- }, +- .fw_cfg = { +- .filename = NULL, +- .address = 0, +- .max_size = 0, ++ .stages = { ++ { ++ .batch = pluto_files_stg1, ++ .trigger_address = 0x88c98 ++ }, + }, + } + }; +@@ -340,21 +419,6 @@ void hailo_pcie_write_firmware_driver_sh + hailo_resource_write32(&resources->fw_access, fw_addresses->raise_ready_offset, fw_access_value); + } + +-int hailo_pcie_read_firmware_notification(struct hailo_pcie_resources *resources, +- struct hailo_d2h_notification *notification) +-{ +- struct hailo_resource notification_resource; +- +- if (PCIE_D2H_NOTIFICATION_SRAM_OFFSET > resources->fw_access.size) { +- return -EINVAL; +- } +- +- notification_resource.address = resources->fw_access.address + PCIE_D2H_NOTIFICATION_SRAM_OFFSET, +- notification_resource.size = sizeof(struct hailo_d2h_notification); +- +- return hailo_read_firmware_notification(¬ification_resource, notification); +-} +- + int hailo_pcie_configure_atr_table(struct hailo_resource *bridge_config, u64 trsl_addr, u32 atr_index) + { + size_t offset = 0; +@@ -388,7 +452,7 @@ static void write_memory_chunk(struct ha + u32 ATR_INDEX = 0; + BUG_ON(dest_offset + len > (u32)resources->fw_access.size); + +- (void)hailo_pcie_configure_atr_table(&resources->config, (u64)dest, ATR_INDEX); ++ (void)hailo_pcie_configure_atr_table(&resources->config, dest, ATR_INDEX); + (void)hailo_resource_write_buffer(&resources->fw_access, dest_offset, len, src); + } + +@@ -398,13 +462,13 @@ static void read_memory_chunk( + u32 ATR_INDEX = 0; + BUG_ON(src_offset + len > (u32)resources->fw_access.size); + +- (void)hailo_pcie_configure_atr_table(&resources->config, (u64)src, ATR_INDEX); ++ (void)hailo_pcie_configure_atr_table(&resources->config, src, ATR_INDEX); + (void)hailo_resource_read_buffer(&resources->fw_access, src_offset, len, dest); + } + + // Note: this function modify the device ATR table (that is also used by the firmware for control and vdma). + // Use with caution, and restore the original atr if needed. +-void write_memory(struct hailo_pcie_resources *resources, hailo_ptr_t dest, const void *src, u32 len) ++static void write_memory(struct hailo_pcie_resources *resources, hailo_ptr_t dest, const void *src, u32 len) + { + struct hailo_atr_config previous_atr = {0}; + hailo_ptr_t base_address = (dest & ~ATR_TABLE_SIZE_MASK); +@@ -417,8 +481,8 @@ void write_memory(struct hailo_pcie_reso + + if (base_address != dest) { + // Data is not aligned, write the first chunk +- chunk_len = min(base_address + ATR_TABLE_SIZE - dest, len); +- write_memory_chunk(resources, base_address, dest - base_address, src, chunk_len); ++ chunk_len = min((u32)(base_address + ATR_TABLE_SIZE - dest), len); ++ write_memory_chunk(resources, base_address, (u32)(dest - base_address), src, chunk_len); + offset += chunk_len; + } + +@@ -447,8 +511,8 @@ static void read_memory(struct hailo_pci + + if (base_address != src) { + // Data is not aligned, write the first chunk +- chunk_len = min(base_address + ATR_TABLE_SIZE - src, len); +- read_memory_chunk(resources, base_address, src - base_address, dest, chunk_len); ++ chunk_len = min((u32)(base_address + ATR_TABLE_SIZE - src), len); ++ read_memory_chunk(resources, base_address, (u32)(src - base_address), dest, chunk_len); + offset += chunk_len; + } + +@@ -463,12 +527,12 @@ static void read_memory(struct hailo_pci + } + + static void hailo_write_app_firmware(struct hailo_pcie_resources *resources, firmware_header_t *fw_header, +- secure_boot_certificate_t *fw_cert) ++ secure_boot_certificate_header_t *fw_cert) + { + const struct hailo_fw_addresses *fw_addresses = &(compat[resources->board_type].fw_addresses); +- void *fw_code = (void*)((u8*)fw_header + sizeof(firmware_header_t)); +- void *key_data = &fw_cert->certificates_data[0]; +- void *content_data = &fw_cert->certificates_data[fw_cert->key_size]; ++ u8 *fw_code = ((u8*)fw_header + sizeof(firmware_header_t)); ++ u8 *key_data = ((u8*)fw_cert + sizeof(secure_boot_certificate_header_t)); ++ u8 *content_data = key_data + fw_cert->key_size; + + write_memory(resources, fw_addresses->boot_fw_header, fw_header, sizeof(firmware_header_t)); + +@@ -487,13 +551,11 @@ static void hailo_write_core_firmware(st + write_memory(resources, fw_addresses->core_fw_header, fw_header, sizeof(firmware_header_t)); + } + +-void hailo_trigger_firmware_boot(struct hailo_pcie_resources *resources) ++void hailo_trigger_firmware_boot(struct hailo_pcie_resources *resources, u32 address) + { +- const struct hailo_fw_addresses *fw_addresses = &(compat[resources->board_type].fw_addresses); + u32 pcie_finished = 1; + +- write_memory(resources, fw_addresses->boot_fw_trigger, +- (void*)&pcie_finished, sizeof(pcie_finished)); ++ write_memory(resources, address, (void*)&pcie_finished, sizeof(pcie_finished)); + } + + u32 hailo_get_boot_status(struct hailo_pcie_resources *resources) +@@ -501,8 +563,7 @@ u32 hailo_get_boot_status(struct hailo_p + u32 boot_status = 0; + const struct hailo_fw_addresses *fw_addresses = &(compat[resources->board_type].fw_addresses); + +- read_memory(resources, fw_addresses->boot_status, +- &boot_status, sizeof(boot_status)); ++ read_memory(resources, fw_addresses->boot_status, &boot_status, sizeof(boot_status)); + + return boot_status; + } +@@ -517,11 +578,11 @@ u32 hailo_get_boot_status(struct hailo_p + */ + static int FW_VALIDATION__validate_fw_headers(uintptr_t firmware_base_address, size_t firmware_size, + firmware_header_t **out_app_firmware_header, firmware_header_t **out_core_firmware_header, +- secure_boot_certificate_t **out_firmware_cert, enum hailo_board_type board_type) ++ secure_boot_certificate_header_t **out_firmware_cert, enum hailo_board_type board_type) + { + firmware_header_t *app_firmware_header = NULL; + firmware_header_t *core_firmware_header = NULL; +- secure_boot_certificate_t *firmware_cert = NULL; ++ secure_boot_certificate_header_t *firmware_cert = NULL; + int err = -EINVAL; + u32 consumed_firmware_offset = 0; + +@@ -571,25 +632,25 @@ exit: + return err; + } + +-static int write_single_file(struct hailo_pcie_resources *resources, const struct hailo_file_batch *files_batch, struct device *dev) ++static int write_single_file(struct hailo_pcie_resources *resources, const struct hailo_file_batch *file_info, struct device *dev) + { + const struct firmware *firmware = NULL; + firmware_header_t *app_firmware_header = NULL; +- secure_boot_certificate_t *firmware_cert = NULL; ++ secure_boot_certificate_header_t *firmware_cert = NULL; + firmware_header_t *core_firmware_header = NULL; + int err = 0; + +- err = request_firmware_direct(&firmware, files_batch->filename, dev); ++ err = request_firmware_direct(&firmware, file_info->filename, dev); + if (err < 0) { + return err; + } + +- if (firmware->size > files_batch->max_size) { ++ if (firmware->size > file_info->max_size) { + release_firmware(firmware); + return -EFBIG; + } + +- if (files_batch->has_header) { ++ if (file_info->has_header) { + err = FW_VALIDATION__validate_fw_headers((uintptr_t)firmware->data, firmware->size, + &app_firmware_header, &core_firmware_header, &firmware_cert, resources->board_type); + if (err < 0) { +@@ -598,8 +659,11 @@ static int write_single_file(struct hail + } + + hailo_write_app_firmware(resources, app_firmware_header, firmware_cert); ++ if (file_info->has_core) { ++ hailo_write_core_firmware(resources, core_firmware_header); ++ } + } else { +- write_memory(resources, files_batch->address, (void*)firmware->data, firmware->size); ++ write_memory(resources, file_info->address, (void*)firmware->data, firmware->size); + } + + release_firmware(firmware); +@@ -632,31 +696,13 @@ int hailo_pcie_write_firmware_batch(stru + dev_notice(dev, "File %s written successfully\n", files_batch[file_index].filename); + } + +- return 0; +-} +- +-int hailo_pcie_write_firmware(struct hailo_pcie_resources *resources, const void *fw_data, size_t fw_size) +-{ +- firmware_header_t *app_firmware_header = NULL; +- secure_boot_certificate_t *firmware_cert = NULL; +- firmware_header_t *core_firmware_header = NULL; +- +- int err = FW_VALIDATION__validate_fw_headers((uintptr_t)fw_data, fw_size, +- &app_firmware_header, &core_firmware_header, &firmware_cert, resources->board_type); +- if (err < 0) { +- return err; +- } +- +- hailo_write_app_firmware(resources, app_firmware_header, firmware_cert); +- hailo_write_core_firmware(resources, core_firmware_header); +- +- hailo_trigger_firmware_boot(resources); ++ hailo_trigger_firmware_boot(resources, compat[resources->board_type].stages[stage].trigger_address); + + return 0; + } + + // TODO: HRT-14147 - remove this function +-bool hailo_pcie_is_device_ready_for_boot(struct hailo_pcie_resources *resources) ++static bool hailo_pcie_is_device_ready_for_boot(struct hailo_pcie_resources *resources) + { + return hailo_get_boot_status(resources) == BOOT_STATUS_UNINITIALIZED; + } +@@ -691,32 +737,6 @@ bool hailo_pcie_wait_for_firmware(struct + return false; + } + +-int hailo_pcie_write_config_common(struct hailo_pcie_resources *resources, const void* config_data, +- const size_t config_size, const struct hailo_config_constants *config_consts) +-{ +- if (config_size > config_consts->max_size) { +- return -EINVAL; +- } +- +- write_memory(resources, config_consts->address, config_data, (u32)config_size); +- return 0; +-} +- +-const struct hailo_config_constants* hailo_pcie_get_board_config_constants(const enum hailo_board_type board_type) { +- BUG_ON(board_type >= HAILO_BOARD_TYPE_COUNT || board_type < 0); +- return &compat[board_type].board_cfg; +-} +- +-const struct hailo_config_constants* hailo_pcie_get_user_config_constants(const enum hailo_board_type board_type) { +- BUG_ON(board_type >= HAILO_BOARD_TYPE_COUNT || board_type < 0); +- return &compat[board_type].fw_cfg; +-} +- +-const char* hailo_pcie_get_fw_filename(const enum hailo_board_type board_type) { +- BUG_ON(board_type >= HAILO_BOARD_TYPE_COUNT || board_type < 0); +- return compat[board_type].fw_filename; +-} +- + void hailo_pcie_update_channel_interrupts_mask(struct hailo_pcie_resources* resources, u32 channels_bitmap) + { + size_t i = 0; +@@ -745,7 +765,7 @@ void hailo_pcie_enable_interrupts(struct + hailo_resource_write32(&resources->config, BCS_SOURCE_INTERRUPT_PER_CHANNEL, 0xFFFFFFFF); + + mask |= (BCS_ISTATUS_HOST_FW_IRQ_CONTROL_MASK | BCS_ISTATUS_HOST_FW_IRQ_NOTIFICATION | +- BCS_ISTATUS_HOST_DRIVER_DOWN | BCS_ISTATUS_SOC_CONNECT_ACCEPTED); ++ BCS_ISTATUS_HOST_DRIVER_DOWN | BCS_ISTATUS_SOC_CONNECT_ACCEPTED | BCS_ISTATUS_SOC_CLOSED_IRQ); + hailo_resource_write32(&resources->config, BSC_IMASK_HOST, mask); + } + +@@ -754,45 +774,15 @@ void hailo_pcie_disable_interrupts(struc + hailo_resource_write32(&resources->config, BSC_IMASK_HOST, 0); + } + +-long hailo_pcie_read_firmware_log(struct hailo_pcie_resources *resources, struct hailo_read_log_params *params) +-{ +- long err = 0; +- struct hailo_resource log_resource = {resources->fw_access.address, DEBUG_BUFFER_TOTAL_SIZE}; +- +- if (HAILO_CPU_ID_CPU0 == params->cpu_id) { +- log_resource.address += PCIE_APP_CPU_DEBUG_OFFSET; +- } else if (HAILO_CPU_ID_CPU1 == params->cpu_id) { +- log_resource.address += PCIE_CORE_CPU_DEBUG_OFFSET; +- } else { +- return -EINVAL; +- } +- +- if (0 == params->buffer_size) { +- params->read_bytes = 0; +- return 0; +- } +- +- err = hailo_read_firmware_log(&log_resource, params); +- if (0 != err) { +- return err; +- } +- +- return 0; +-} +- + static int direct_memory_transfer(struct hailo_pcie_resources *resources, + struct hailo_memory_transfer_params *params) + { +- if (params->address > U32_MAX) { +- return -EFAULT; +- } +- + switch (params->transfer_direction) { + case TRANSFER_READ: +- read_memory(resources, (u32)params->address, params->buffer, (u32)params->count); ++ read_memory(resources, params->address, params->buffer, (u32)params->count); + break; + case TRANSFER_WRITE: +- write_memory(resources, (u32)params->address, params->buffer, (u32)params->count); ++ write_memory(resources, params->address, params->buffer, (u32)params->count); + break; + default: + return -EINVAL; +@@ -845,16 +835,18 @@ int hailo_set_device_type(struct hailo_p + return 0; + } + +-// On PCIe, just return the address +-static u64 encode_dma_address(dma_addr_t dma_address, u8 channel_id) ++// On PCIe, just return the start address ++u64 hailo_pcie_encode_desc_dma_address_range(dma_addr_t dma_address_start, dma_addr_t dma_address_end, u32 step, u8 channel_id) + { + (void)channel_id; +- return (u64)dma_address; ++ (void)dma_address_end; ++ (void)step; ++ return (u64)dma_address_start; + } + + struct hailo_vdma_hw hailo_pcie_vdma_hw = { + .hw_ops = { +- .encode_desc_dma_address = encode_dma_address ++ .encode_desc_dma_address_range = hailo_pcie_encode_desc_dma_address_range, + }, + .ddr_data_id = HAILO_PCIE_HOST_DMA_DATA_ID, + .device_interrupts_bitmask = HAILO_PCIE_DMA_DEVICE_INTERRUPTS_BITMASK, +@@ -862,11 +854,19 @@ struct hailo_vdma_hw hailo_pcie_vdma_hw + .src_channels_bitmask = HAILO_PCIE_DMA_SRC_CHANNELS_BITMASK, + }; + +-void hailo_soc_write_soc_connect(struct hailo_pcie_resources *resources) ++void hailo_pcie_soc_write_request(struct hailo_pcie_resources *resources, ++ const struct hailo_pcie_soc_request *request) + { + const struct hailo_fw_addresses *fw_addresses = &(compat[resources->board_type].fw_addresses); +- const u32 soc_connect_value = FW_ACCESS_SOC_CONNECT_MASK; ++ BUILD_BUG_ON_MSG((sizeof(*request) % sizeof(u32)) != 0, "Request must be a multiple of 4 bytes"); + +- // Write shutdown flag to FW +- hailo_resource_write32(&resources->fw_access, fw_addresses->raise_ready_offset, soc_connect_value); +-} +\ No newline at end of file ++ hailo_resource_write_buffer(&resources->fw_access, 0, sizeof(*request), (void*)request); ++ hailo_resource_write32(&resources->fw_access, fw_addresses->raise_ready_offset, FW_ACCESS_SOC_CONTROL_MASK); ++} ++ ++void hailo_pcie_soc_read_response(struct hailo_pcie_resources *resources, ++ struct hailo_pcie_soc_response *response) ++{ ++ BUILD_BUG_ON_MSG((sizeof(*response) % sizeof(u32)) != 0, "Request must be a multiple of 4 bytes"); ++ hailo_resource_read_buffer(&resources->fw_access, 0, sizeof(*response), response); ++} +--- a/drivers/media/pci/hailo/common/pcie_common.h ++++ b/drivers/media/pci/hailo/common/pcie_common.h +@@ -1,6 +1,6 @@ + // SPDX-License-Identifier: MIT + /** +- * Copyright (c) 2019-2022 Hailo Technologies Ltd. All rights reserved. ++ * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. + **/ + + #ifndef _HAILO_COMMON_PCIE_COMMON_H_ +@@ -12,6 +12,7 @@ + #include "fw_operation.h" + #include "utils.h" + #include "vdma_common.h" ++#include "soc_structs.h" + + #include + #include +@@ -21,6 +22,7 @@ + #define BCS_ISTATUS_HOST_FW_IRQ_NOTIFICATION (0x02000000) + #define BCS_ISTATUS_HOST_DRIVER_DOWN (0x08000000) + #define BCS_ISTATUS_SOC_CONNECT_ACCEPTED (0x10000000) ++#define BCS_ISTATUS_SOC_CLOSED_IRQ (0x20000000) + #define BCS_ISTATUS_HOST_VDMA_SRC_IRQ_MASK (0x000000FF) + #define BCS_ISTATUS_HOST_VDMA_DEST_IRQ_MASK (0x0000FF00) + +@@ -42,7 +44,7 @@ + #define PCI_DEVICE_ID_HAILO_HAILO15 0x45C4 + #define PCI_DEVICE_ID_HAILO_PLUTO 0x43a2 + +-typedef u32 hailo_ptr_t; ++typedef u64 hailo_ptr_t; + + struct hailo_pcie_resources { + struct hailo_resource config; // BAR0 +@@ -63,7 +65,8 @@ struct hailo_atr_config { + enum loading_stages { + FIRST_STAGE = 0, + SECOND_STAGE = 1, +- MAX_LOADING_STAGES = 2 ++ SECOND_STAGE_LINUX_IN_EMMC = 2, ++ MAX_LOADING_STAGES = 3 + }; + + enum hailo_pcie_interrupt_masks { +@@ -71,6 +74,7 @@ enum hailo_pcie_interrupt_masks { + FW_NOTIFICATION = BCS_ISTATUS_HOST_FW_IRQ_NOTIFICATION, + DRIVER_DOWN = BCS_ISTATUS_HOST_DRIVER_DOWN, + SOC_CONNECT_ACCEPTED = BCS_ISTATUS_SOC_CONNECT_ACCEPTED, ++ SOC_CLOSED_IRQ = BCS_ISTATUS_SOC_CLOSED_IRQ, + VDMA_SRC_IRQ_MASK = BCS_ISTATUS_HOST_VDMA_SRC_IRQ_MASK, + VDMA_DEST_IRQ_MASK = BCS_ISTATUS_HOST_VDMA_DEST_IRQ_MASK + }; +@@ -80,18 +84,13 @@ struct hailo_pcie_interrupt_source { + u32 vdma_channels_bitmap; + }; + +-struct hailo_config_constants { +- const char *filename; +- u32 address; +- size_t max_size; +-}; +- + struct hailo_file_batch { + const char *filename; + u32 address; + size_t max_size; + bool is_mandatory; + bool has_header; ++ bool has_core; + }; + + // TODO: HRT-6144 - Align Windows/Linux to QNX +@@ -130,27 +129,15 @@ void hailo_pcie_disable_interrupts(struc + int hailo_pcie_write_firmware_control(struct hailo_pcie_resources *resources, const struct hailo_fw_control *command); + int hailo_pcie_read_firmware_control(struct hailo_pcie_resources *resources, struct hailo_fw_control *command); + +-int hailo_pcie_write_firmware(struct hailo_pcie_resources *resources, const void *fw_data, size_t fw_size); + int hailo_pcie_write_firmware_batch(struct device *dev, struct hailo_pcie_resources *resources, u32 stage); + bool hailo_pcie_is_firmware_loaded(struct hailo_pcie_resources *resources); + bool hailo_pcie_wait_for_firmware(struct hailo_pcie_resources *resources); + +-int hailo_pcie_read_firmware_notification(struct hailo_pcie_resources *resources, +- struct hailo_d2h_notification *notification); +- +-int hailo_pcie_write_config_common(struct hailo_pcie_resources *resources, const void* config_data, +- const size_t config_size, const struct hailo_config_constants *config_consts); +-const struct hailo_config_constants* hailo_pcie_get_board_config_constants(const enum hailo_board_type board_type); +-const struct hailo_config_constants* hailo_pcie_get_user_config_constants(const enum hailo_board_type board_type); +-const char* hailo_pcie_get_fw_filename(const enum hailo_board_type board_type); +- +-long hailo_pcie_read_firmware_log(struct hailo_pcie_resources *resources, struct hailo_read_log_params *params); + int hailo_pcie_memory_transfer(struct hailo_pcie_resources *resources, struct hailo_memory_transfer_params *params); + + bool hailo_pcie_is_device_connected(struct hailo_pcie_resources *resources); + void hailo_pcie_write_firmware_driver_shutdown(struct hailo_pcie_resources *resources); +-void write_memory(struct hailo_pcie_resources *resources, hailo_ptr_t dest, const void *src, u32 len); +-void hailo_trigger_firmware_boot(struct hailo_pcie_resources *resources); ++void hailo_trigger_firmware_boot(struct hailo_pcie_resources *resources, u32 address); + + int hailo_set_device_type(struct hailo_pcie_resources *resources); + +@@ -159,7 +146,12 @@ u32 hailo_get_boot_status(struct hailo_p + int hailo_pcie_configure_atr_table(struct hailo_resource *bridge_config, u64 trsl_addr, u32 atr_index); + void hailo_pcie_read_atr_table(struct hailo_resource *bridge_config, struct hailo_atr_config *atr, u32 atr_index); + +-void hailo_soc_write_soc_connect(struct hailo_pcie_resources *resources); ++u64 hailo_pcie_encode_desc_dma_address_range(dma_addr_t dma_address_start, dma_addr_t dma_address_end, u32 step, u8 channel_id); ++ ++void hailo_pcie_soc_write_request(struct hailo_pcie_resources *resources, ++ const struct hailo_pcie_soc_request *request); ++void hailo_pcie_soc_read_response(struct hailo_pcie_resources *resources, ++ struct hailo_pcie_soc_response *response); + + #ifdef __cplusplus + } +--- /dev/null ++++ b/drivers/media/pci/hailo/common/soc_structs.h +@@ -0,0 +1,79 @@ ++// SPDX-License-Identifier: MIT ++/** ++ * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. ++ **/ ++/** ++ * Contains definitions for pcie soc to pcie ep communication ++ */ ++ ++#ifndef __HAILO_COMMON_SOC_STRUCTS__ ++#define __HAILO_COMMON_SOC_STRUCTS__ ++ ++#include ++ ++#pragma pack(push, 1) ++ ++struct hailo_pcie_soc_connect_request { ++ u16 port; ++}; ++ ++struct hailo_pcie_soc_connect_response { ++ u8 input_channel_index; ++ u8 output_channel_index; ++}; ++ ++ ++struct hailo_pcie_soc_close_request { ++ u32 channels_bitmap; ++}; ++ ++struct hailo_pcie_soc_close_response { ++ u8 reserved; ++}; ++ ++enum hailo_pcie_soc_control_code { ++ // Start from big initial value to ensure the right code was used (using 0 ++ // as initiale may cause confusion if the code was not set correctly). ++ HAILO_PCIE_SOC_CONTROL_CODE_CONNECT = 0x100, ++ HAILO_PCIE_SOC_CONTROL_CODE_CLOSE, ++ HAILO_PCIE_SOC_CONTROL_CODE_INVALID, ++}; ++ ++#define HAILO_PCIE_SOC_MAX_REQUEST_SIZE_BYTES (16) ++#define HAILO_PCIE_SOC_MAX_RESPONSE_SIZE_BYTES (16) ++ ++// IRQ to signal the PCIe that the EP was closed/released ++#define PCI_EP_SOC_CLOSED_IRQ (0x00000020) ++#define PCI_EP_SOC_CONNECT_RESPONSE (0x00000010) ++ ++struct hailo_pcie_soc_request { ++ u32 control_code; ++ union { ++ struct hailo_pcie_soc_connect_request connect; ++ struct hailo_pcie_soc_close_request close; ++ u8 pad[HAILO_PCIE_SOC_MAX_REQUEST_SIZE_BYTES]; ++ }; ++}; ++ ++struct hailo_pcie_soc_response { ++ u32 control_code; ++ s32 status; ++ union { ++ struct hailo_pcie_soc_connect_response connect; ++ struct hailo_pcie_soc_close_response close; ++ u8 pad[HAILO_PCIE_SOC_MAX_RESPONSE_SIZE_BYTES]; ++ }; ++}; ++ ++#pragma pack(pop) ++ ++// Compile time validate function. Don't need to call it. ++static inline void __validate_soc_struct_sizes(void) ++{ ++ BUILD_BUG_ON_MSG(sizeof(struct hailo_pcie_soc_request) != ++ sizeof(u32) + HAILO_PCIE_SOC_MAX_REQUEST_SIZE_BYTES, "Invalid request size"); ++ BUILD_BUG_ON_MSG(sizeof(struct hailo_pcie_soc_response) != ++ sizeof(u32) + sizeof(s32) + HAILO_PCIE_SOC_MAX_RESPONSE_SIZE_BYTES, "Invalid response size"); ++} ++ ++#endif /* __HAILO_COMMON_SOC_STRUCTS__ */ +\ No newline at end of file +--- a/drivers/media/pci/hailo/common/utils.h ++++ b/drivers/media/pci/hailo/common/utils.h +@@ -1,6 +1,6 @@ + // SPDX-License-Identifier: MIT + /** +- * Copyright (c) 2019-2022 Hailo Technologies Ltd. All rights reserved. ++ * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. + **/ + + #ifndef _HAILO_DRIVER_UTILS_H_ +@@ -8,6 +8,11 @@ + + #include + ++#define DWORD_SIZE (4) ++#define WORD_SIZE (2) ++#define BYTE_SIZE (1) ++#define BITS_IN_BYTE (8) ++ + #define hailo_clear_bit(bit, pval) { *(pval) &= ~(1 << bit); } + #define hailo_test_bit(pos,var_addr) ((*var_addr) & (1<<(pos))) + +@@ -50,6 +55,22 @@ static inline uint8_t ceil_log2(uint32_t + return result; + } + ++// Gets the nearest power of 2 >= value, for any value <= MAX_POWER_OF_2_VALUE. Otherwise POWER_OF_2_ERROR is returned. ++#define MAX_POWER_OF_2_VALUE (0x80000000) ++#define POWER_OF_2_ERROR ((uint32_t)-1) ++static inline uint32_t get_nearest_powerof_2(uint32_t value) ++{ ++ uint32_t power_of_2 = 1; ++ if (value > MAX_POWER_OF_2_VALUE) { ++ return POWER_OF_2_ERROR; ++ } ++ ++ while (value > power_of_2) { ++ power_of_2 <<= 1; ++ } ++ return power_of_2; ++} ++ + #ifndef DIV_ROUND_UP + #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) + #endif +--- a/drivers/media/pci/hailo/common/vdma_common.c ++++ b/drivers/media/pci/hailo/common/vdma_common.c +@@ -1,6 +1,6 @@ + // SPDX-License-Identifier: MIT + /** +- * Copyright (c) 2019-2022 Hailo Technologies Ltd. All rights reserved. ++ * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. + **/ + + #include "vdma_common.h" +@@ -62,11 +62,6 @@ + #define VDMA_CHANNEL_NUM_PROCESSED_MASK ((1 << VDMA_CHANNEL_NUM_PROCESSED_WIDTH) - 1) + #define VDMA_CHANNEL_NUM_ONGOING_MASK VDMA_CHANNEL_NUM_PROCESSED_MASK + +-#define DWORD_SIZE (4) +-#define WORD_SIZE (2) +-#define BYTE_SIZE (1) +-#define BITS_IN_BYTE (8) +- + #define TIMESTAMPS_CIRC_SPACE(timestamp_list) \ + CIRC_SPACE((timestamp_list).head, (timestamp_list).tail, CHANNEL_IRQ_TIMESTAMPS_SIZE) + #define TIMESTAMPS_CIRC_CNT(timestamp_list) \ +@@ -150,7 +145,7 @@ static bool validate_last_desc_status(st + return true; + } + +-void hailo_vdma_program_descriptor(struct hailo_vdma_descriptor *descriptor, u64 dma_address, size_t page_size, ++static void hailo_vdma_program_descriptor(struct hailo_vdma_descriptor *descriptor, u64 dma_address, size_t page_size, + u8 data_id) + { + descriptor->PageSize_DescControl = (u32)((page_size << DESCRIPTOR_PAGE_SIZE_SHIFT) + +@@ -174,33 +169,45 @@ static int program_descriptors_in_chunk( + u32 max_desc_index, + u8 channel_id) + { +- const u32 desc_per_chunk = DIV_ROUND_UP(chunk_size, desc_list->desc_page_size); ++ const u16 page_size = desc_list->desc_page_size; ++ const u8 ddr_data_id = vdma_hw->ddr_data_id; ++ const u32 descs_to_program = DIV_ROUND_UP(chunk_size, page_size); ++ const u32 starting_desc_index = desc_index; ++ const u32 residue_size = chunk_size % page_size; + struct hailo_vdma_descriptor *dma_desc = NULL; +- u16 size_to_program = 0; +- u32 index = 0; + u64 encoded_addr = 0; + +- for (index = 0; index < desc_per_chunk; index++) { +- if (desc_index > max_desc_index) { +- return -ERANGE; +- } +- +- encoded_addr = vdma_hw->hw_ops.encode_desc_dma_address(chunk_addr, channel_id); +- if (INVALID_VDMA_ADDRESS == encoded_addr) { +- return -EFAULT; +- } ++ if (descs_to_program == 0) { ++ // Nothing to program ++ return 0; ++ } + +- dma_desc = &desc_list->desc_list[desc_index % desc_list->desc_count]; +- size_to_program = chunk_size > desc_list->desc_page_size ? +- desc_list->desc_page_size : (u16)chunk_size; +- hailo_vdma_program_descriptor(dma_desc, encoded_addr, size_to_program, vdma_hw->ddr_data_id); ++ // We iterate through descriptors [desc_index, desc_index + descs_to_program) ++ if (desc_index + descs_to_program > max_desc_index + 1) { ++ return -ERANGE; ++ } + +- chunk_addr += size_to_program; +- chunk_size -= size_to_program; +- desc_index++; ++ encoded_addr = vdma_hw->hw_ops.encode_desc_dma_address_range(chunk_addr, chunk_addr + chunk_size, page_size, channel_id); ++ if (INVALID_VDMA_ADDRESS == encoded_addr) { ++ return -EFAULT; + } + +- return (int)desc_per_chunk; ++ // Program all descriptors except the last one ++ for (desc_index = starting_desc_index; desc_index < starting_desc_index + descs_to_program - 1; desc_index++) { ++ // 'desc_index & desc_list_len_mask' is used instead of modulo; see hailo_vdma_descriptors_list documentation. ++ hailo_vdma_program_descriptor( ++ &desc_list->desc_list[desc_index & desc_list->desc_count_mask], ++ encoded_addr, page_size, ddr_data_id); ++ encoded_addr += page_size; ++ } ++ ++ // Handle the last descriptor outside of the loop ++ // 'desc_index & desc_list_len_mask' is used instead of modulo; see hailo_vdma_descriptors_list documentation. ++ dma_desc = &desc_list->desc_list[desc_index & desc_list->desc_count_mask]; ++ hailo_vdma_program_descriptor(dma_desc, encoded_addr, ++ (residue_size == 0) ? page_size : (u16)residue_size, ddr_data_id); ++ ++ return (int)descs_to_program; + } + + static unsigned long get_interrupts_bitmask(struct hailo_vdma_hw *vdma_hw, +@@ -236,11 +243,11 @@ static int bind_and_program_descriptors_ + { + const u8 channel_id = get_channel_id(channel_index); + int desc_programmed = 0; ++ int descs_programmed_in_chunk = 0; + u32 max_desc_index = 0; + u32 chunk_size = 0; + struct scatterlist *sg_entry = NULL; + unsigned int i = 0; +- int ret = 0; + size_t buffer_current_offset = 0; + dma_addr_t chunk_start_addr = 0; + u32 program_size = buffer->size; +@@ -272,14 +279,14 @@ static int bind_and_program_descriptors_ + (u32)(sg_dma_len(sg_entry)); + chunk_size = min((u32)program_size, chunk_size); + +- ret = program_descriptors_in_chunk(vdma_hw, chunk_start_addr, chunk_size, desc_list, ++ descs_programmed_in_chunk = program_descriptors_in_chunk(vdma_hw, chunk_start_addr, chunk_size, desc_list, + starting_desc, max_desc_index, channel_id); +- if (ret < 0) { +- return ret; ++ if (descs_programmed_in_chunk < 0) { ++ return descs_programmed_in_chunk; + } + +- desc_programmed += ret; +- starting_desc = starting_desc + ret; ++ desc_programmed += descs_programmed_in_chunk; ++ starting_desc = starting_desc + descs_programmed_in_chunk; + program_size -= chunk_size; + buffer_current_offset += sg_dma_len(sg_entry); + } +@@ -583,21 +590,23 @@ void hailo_vdma_engine_disable_channels( + engine->enabled_channels &= ~bitmap; + + for_each_vdma_channel(engine, channel, channel_index) { +- channel_state_init(&channel->state); ++ if (hailo_test_bit(channel_index, &bitmap)) { ++ channel_state_init(&channel->state); + +- while (ONGOING_TRANSFERS_CIRC_CNT(channel->ongoing_transfers) > 0) { +- struct hailo_ongoing_transfer transfer; +- ongoing_transfer_pop(channel, &transfer); +- +- if (channel->last_desc_list == NULL) { +- pr_err("Channel %d has ongoing transfers but no desc list\n", channel->index); +- continue; ++ while (ONGOING_TRANSFERS_CIRC_CNT(channel->ongoing_transfers) > 0) { ++ struct hailo_ongoing_transfer transfer; ++ ongoing_transfer_pop(channel, &transfer); ++ ++ if (channel->last_desc_list == NULL) { ++ pr_err("Channel %d has ongoing transfers but no desc list\n", channel->index); ++ continue; ++ } ++ ++ clear_dirty_descs(channel, &transfer); + } + +- clear_dirty_descs(channel, &transfer); ++ channel->last_desc_list = NULL; + } +- +- channel->last_desc_list = NULL; + } + } + +--- a/drivers/media/pci/hailo/common/vdma_common.h ++++ b/drivers/media/pci/hailo/common/vdma_common.h +@@ -1,6 +1,6 @@ + // SPDX-License-Identifier: MIT + /** +- * Copyright (c) 2019-2022 Hailo Technologies Ltd. All rights reserved. ++ * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. + **/ + + #ifndef _HAILO_COMMON_VDMA_COMMON_H_ +@@ -30,7 +30,13 @@ struct hailo_vdma_descriptor { + + struct hailo_vdma_descriptors_list { + struct hailo_vdma_descriptor *desc_list; +- u32 desc_count; // Must be power of 2 if is_circular is set. ++ // Must be power of 2 if is_circular is set. ++ u32 desc_count; ++ // The nearest power of 2 to desc_count (including desc_count), minus 1. ++ // * If the list is circular, then 'index & desc_count_mask' can be used instead of modulo. ++ // * Otherwise, we can't wrap around the list anyway. However, for any index < desc_count, 'index & desc_count_mask' ++ // will return the same value. ++ u32 desc_count_mask; + u16 desc_page_size; + bool is_circular; + }; +@@ -113,9 +119,10 @@ struct hailo_vdma_engine { + }; + + struct hailo_vdma_hw_ops { +- // Accepts some dma_addr_t mapped to the device and encodes it using +- // hw specific encode. returns INVALID_VDMA_ADDRESS on failure. +- u64 (*encode_desc_dma_address)(dma_addr_t dma_address, u8 channel_id); ++ // Accepts start, end and step of an address range (of type dma_addr_t). ++ // Returns the encoded base address or INVALID_VDMA_ADDRESS if the range/step is invalid. ++ // All addresses in the range of [returned_addr, returned_addr + step, returned_addr + 2*step, ..., dma_address_end) are valid. ++ u64 (*encode_desc_dma_address_range)(dma_addr_t dma_address_start, dma_addr_t dma_address_end, u32 step, u8 channel_id); + }; + + struct hailo_vdma_hw { +@@ -136,12 +143,9 @@ struct hailo_vdma_hw { + for (index = 0, element = &array[index]; index < size; index++, element = &array[index]) + + #define for_each_vdma_channel(engine, channel, channel_index) \ +- _for_each_element_array(engine->channels, MAX_VDMA_CHANNELS_PER_ENGINE, \ ++ _for_each_element_array((engine)->channels, MAX_VDMA_CHANNELS_PER_ENGINE, \ + channel, channel_index) + +-void hailo_vdma_program_descriptor(struct hailo_vdma_descriptor *descriptor, u64 dma_address, size_t page_size, +- u8 data_id); +- + /** + * Program the given descriptors list to map the given buffer. + * +--- a/drivers/media/pci/hailo/src/fops.c ++++ b/drivers/media/pci/hailo/src/fops.c +@@ -1,6 +1,6 @@ + // SPDX-License-Identifier: GPL-2.0 + /** +- * Copyright (c) 2019-2022 Hailo Technologies Ltd. All rights reserved. ++ * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. + **/ + + #include +@@ -19,14 +19,14 @@ + #include + #endif + +-#include "utils.h" + #include "fops.h" + #include "vdma_common.h" + #include "utils/logs.h" + #include "vdma/memory.h" + #include "vdma/ioctl.h" + #include "utils/compact.h" +-#include "pci_soc_ioctl.h" ++#include "nnc.h" ++#include "soc.h" + + + #if LINUX_VERSION_CODE >= KERNEL_VERSION( 4, 13, 0 ) +@@ -48,13 +48,6 @@ + // On pcie driver there is only one dma engine + #define DEFAULT_VDMA_ENGINE_INDEX (0) + +-#if !defined(HAILO_EMULATOR) +-#define DEFAULT_SHUTDOWN_TIMEOUT_MS (5) +-#else /* !defined(HAILO_EMULATOR) */ +-#define DEFAULT_SHUTDOWN_TIMEOUT_MS (1000) +-#endif /* !defined(HAILO_EMULATOR) */ +- +-static long hailo_add_notification_wait(struct hailo_pcie_board *board, struct file *filp); + + static struct hailo_file_context *create_file_context(struct hailo_pcie_board *board, struct file *filp) + { +@@ -124,7 +117,7 @@ int hailo_pcie_fops_open(struct inode *i + + previous_power_state = pBoard->pDev->current_state; + if (PCI_D0 != previous_power_state) { +- hailo_info(pBoard, "Waking up board"); ++ hailo_info(pBoard, "Waking up board change state from %d to PCI_D0\n", previous_power_state); + err = pci_set_power_state(pBoard->pDev, PCI_D0); + if (err < 0) { + hailo_err(pBoard, "Failed waking up board %d", err); +@@ -148,7 +141,11 @@ int hailo_pcie_fops_open(struct inode *i + interrupts_enabled_by_filp = true; + } + +- err = hailo_add_notification_wait(pBoard, filp); ++ if (pBoard->pcie_resources.accelerator_type == HAILO_ACCELERATOR_TYPE_NNC) { ++ err = hailo_nnc_file_context_init(pBoard, context); ++ } else { ++ err = hailo_soc_file_context_init(pBoard, context); ++ } + if (err < 0) { + goto l_release_irq; + } +@@ -166,6 +163,7 @@ l_release_irq: + + l_revert_power_state: + if (pBoard->pDev->current_state != previous_power_state) { ++ hailo_info(pBoard, "Power changing state from %d to %d\n", previous_power_state, pBoard->pDev->current_state); + if (pci_set_power_state(pBoard->pDev, previous_power_state) < 0) { + hailo_err(pBoard, "Failed setting power state back to %d\n", (int)previous_power_state); + } +@@ -180,34 +178,6 @@ l_exit: + return err; + } + +-int hailo_pcie_driver_down(struct hailo_pcie_board *board) +-{ +- long completion_result = 0; +- int err = 0; +- +- reinit_completion(&board->driver_down.reset_completed); +- +- hailo_pcie_write_firmware_driver_shutdown(&board->pcie_resources); +- +- // Wait for response +- completion_result = +- wait_for_completion_timeout(&board->driver_down.reset_completed, msecs_to_jiffies(DEFAULT_SHUTDOWN_TIMEOUT_MS)); +- if (completion_result <= 0) { +- if (0 == completion_result) { +- hailo_err(board, "hailo_pcie_driver_down, timeout waiting for shutdown response (timeout_ms=%d)\n", DEFAULT_SHUTDOWN_TIMEOUT_MS); +- err = -ETIMEDOUT; +- } else { +- hailo_info(board, "hailo_pcie_driver_down, wait for completion failed with err=%ld (process was interrupted or killed)\n", +- completion_result); +- err = completion_result; +- } +- goto l_exit; +- } +- +-l_exit: +- return err; +-} +- + int hailo_pcie_fops_release(struct inode *inode, struct file *filp) + { + struct hailo_pcie_board *board = (struct hailo_pcie_board *)filp->private_data; +@@ -234,12 +204,10 @@ int hailo_pcie_fops_release(struct inode + hailo_err(board, "Invalid file context\n"); + } + +- hailo_pcie_clear_notification_wait_list(board, filp); +- +- if (filp == board->vdma.used_by_filp) { +- if (hailo_pcie_driver_down(board)) { +- hailo_err(board, "Failed sending FW shutdown event"); +- } ++ if (board->pcie_resources.accelerator_type == HAILO_ACCELERATOR_TYPE_NNC) { ++ hailo_nnc_file_context_finalize(board, context); ++ } else { ++ hailo_soc_file_context_finalize(board, context); + } + + hailo_vdma_file_context_finalize(&context->vdma_context, &board->vdma, filp); +@@ -250,6 +218,7 @@ int hailo_pcie_fops_release(struct inode + hailo_disable_interrupts(board); + + if (power_mode_enabled()) { ++ hailo_info(board, "Power change state to PCI_D3hot\n"); + if (board->pDev && pci_set_power_state(board->pDev, PCI_D3hot) < 0) { + hailo_err(board, "Failed setting power state to D3hot"); + } +@@ -301,44 +270,23 @@ static long hailo_memory_transfer_ioctl( + return err; + } + +-static long hailo_read_log_ioctl(struct hailo_pcie_board *pBoard, unsigned long arg) +-{ +- long err = 0; +- struct hailo_read_log_params params; +- +- if (copy_from_user(¶ms, (void __user*)arg, sizeof(params))) { +- hailo_err(pBoard, "HAILO_READ_LOG, copy_from_user fail\n"); +- return -ENOMEM; +- } +- +- if (0 > (err = hailo_pcie_read_firmware_log(&pBoard->pcie_resources, ¶ms))) { +- hailo_err(pBoard, "HAILO_READ_LOG, reading from log failed with error: %ld \n", err); +- return err; +- } +- +- if (copy_to_user((void*)arg, ¶ms, sizeof(params))) { +- return -ENOMEM; +- } +- +- return 0; +-} +- + static void firmware_notification_irq_handler(struct hailo_pcie_board *board) + { + struct hailo_notification_wait *notif_wait_cursor = NULL; + int err = 0; + unsigned long irq_saved_flags = 0; + +- spin_lock_irqsave(&board->notification_read_spinlock, irq_saved_flags); +- err = hailo_pcie_read_firmware_notification(&board->pcie_resources, &board->notification_cache); +- spin_unlock_irqrestore(&board->notification_read_spinlock, irq_saved_flags); ++ spin_lock_irqsave(&board->nnc.notification_read_spinlock, irq_saved_flags); ++ err = hailo_pcie_read_firmware_notification(&board->pcie_resources.fw_access, &board->nnc.notification_cache); ++ spin_unlock_irqrestore(&board->nnc.notification_read_spinlock, irq_saved_flags); + + if (err < 0) { + hailo_err(board, "Failed reading firmware notification"); + } + else { ++ // TODO: HRT-14502 move interrupt handling to nnc + rcu_read_lock(); +- list_for_each_entry_rcu(notif_wait_cursor, &board->notification_wait_list, notification_wait_list) ++ list_for_each_entry_rcu(notif_wait_cursor, &board->nnc.notification_wait_list, notification_wait_list) + { + complete(¬if_wait_cursor->notification_completion); + } +@@ -374,7 +322,7 @@ irqreturn_t hailo_irqhandler(int irq, vo + + // wake fw_control if needed + if (irq_source.interrupt_bitmask & FW_CONTROL) { +- complete(&board->fw_control.completion); ++ complete(&board->nnc.fw_control.completion); + } + + // wake driver_down if needed +@@ -392,7 +340,14 @@ irqreturn_t hailo_irqhandler(int irq, vo + } + + if (irq_source.interrupt_bitmask & SOC_CONNECT_ACCEPTED) { +- complete_all(&board->soc_connect_accepted); ++ complete_all(&board->soc.control_resp_ready); ++ } ++ ++ if (irq_source.interrupt_bitmask & SOC_CLOSED_IRQ) { ++ hailo_info(board, "hailo_irqhandler - SOC_CLOSED_IRQ\n"); ++ // always use bitmap=0xFFFFFFFF - it is ok to wake all interrupts since each handler will check if the stream was aborted or not. ++ hailo_vdma_wakeup_interrupts(&board->vdma, &board->vdma.vdma_engines[DEFAULT_VDMA_ENGINE_INDEX], ++ 0xFFFFFFFF); + } + + if (0 != irq_source.vdma_channels_bitmap) { +@@ -404,170 +359,11 @@ irqreturn_t hailo_irqhandler(int irq, vo + return return_value; + } + +-static long hailo_get_notification_wait_thread(struct hailo_pcie_board *pBoard, struct file *filp, +- struct hailo_notification_wait **current_waiting_thread) +-{ +- struct hailo_notification_wait *cursor = NULL; +- // note: safe to access without rcu because the notification_wait_list is closed only on file release +- list_for_each_entry(cursor, &pBoard->notification_wait_list, notification_wait_list) +- { +- if ((current->tgid == cursor->tgid) && (filp == cursor->filp)) { +- *current_waiting_thread = cursor; +- return 0; +- } +- } +- +- return -EFAULT; +-} +- +-static long hailo_add_notification_wait(struct hailo_pcie_board *board, struct file *filp) +-{ +- struct hailo_notification_wait *new_notification_wait = NULL; +- if (!(new_notification_wait = kmalloc(sizeof(*new_notification_wait), GFP_KERNEL))) { +- hailo_err(board, "Failed to allocate notification wait structure.\n"); +- return -ENOMEM; +- } +- new_notification_wait->tgid = current->tgid; +- new_notification_wait->filp = filp; +- new_notification_wait->is_disabled = false; +- init_completion(&new_notification_wait->notification_completion); +- list_add_rcu(&new_notification_wait->notification_wait_list, &board->notification_wait_list); +- return 0; +-} +- +-static long hailo_read_notification_ioctl(struct hailo_pcie_board *pBoard, unsigned long arg, struct file *filp, +- bool* should_up_board_mutex) +-{ +- long err = 0; +- struct hailo_notification_wait *current_waiting_thread = NULL; +- struct hailo_d2h_notification *notification = &pBoard->notification_to_user; +- unsigned long irq_saved_flags; +- +- err = hailo_get_notification_wait_thread(pBoard, filp, ¤t_waiting_thread); +- if (0 != err) { +- goto l_exit; +- } +- up(&pBoard->mutex); +- +- if (0 > (err = wait_for_completion_interruptible(¤t_waiting_thread->notification_completion))) { +- hailo_info(pBoard, +- "HAILO_READ_NOTIFICATION - wait_for_completion_interruptible error. err=%ld. tgid=%d (process was interrupted or killed)\n", +- err, current_waiting_thread->tgid); +- *should_up_board_mutex = false; +- goto l_exit; +- } +- +- if (down_interruptible(&pBoard->mutex)) { +- hailo_info(pBoard, "HAILO_READ_NOTIFICATION - down_interruptible error (process was interrupted or killed)\n"); +- *should_up_board_mutex = false; +- err = -ERESTARTSYS; +- goto l_exit; +- } +- +- // Check if was disabled +- if (current_waiting_thread->is_disabled) { +- hailo_info(pBoard, "HAILO_READ_NOTIFICATION, can't find notification wait for tgid=%d\n", current->tgid); +- err = -EINVAL; +- goto l_exit; +- } +- +- reinit_completion(¤t_waiting_thread->notification_completion); +- +- spin_lock_irqsave(&pBoard->notification_read_spinlock, irq_saved_flags); +- notification->buffer_len = pBoard->notification_cache.buffer_len; +- memcpy(notification->buffer, pBoard->notification_cache.buffer, notification->buffer_len); +- spin_unlock_irqrestore(&pBoard->notification_read_spinlock, irq_saved_flags); +- +- if (copy_to_user((void __user*)arg, notification, sizeof(*notification))) { +- hailo_err(pBoard, "HAILO_READ_NOTIFICATION copy_to_user fail\n"); +- err = -ENOMEM; +- goto l_exit; +- } +- +-l_exit: +- return err; +-} +- +-static long hailo_disable_notification(struct hailo_pcie_board *pBoard, struct file *filp) +-{ +- struct hailo_notification_wait *cursor = NULL; +- +- hailo_info(pBoard, "HAILO_DISABLE_NOTIFICATION: disable notification"); +- rcu_read_lock(); +- list_for_each_entry_rcu(cursor, &pBoard->notification_wait_list, notification_wait_list) { +- if ((current->tgid == cursor->tgid) && (filp == cursor->filp)) { +- cursor->is_disabled = true; +- complete(&cursor->notification_completion); +- break; +- } +- } +- rcu_read_unlock(); +- +- return 0; +-} +- +-static int hailo_fw_control(struct hailo_pcie_board *pBoard, unsigned long arg, bool* should_up_board_mutex) +-{ +- struct hailo_fw_control *command = &pBoard->fw_control.command; +- long completion_result = 0; +- int err = 0; +- +- up(&pBoard->mutex); +- *should_up_board_mutex = false; +- +- if (down_interruptible(&pBoard->fw_control.mutex)) { +- hailo_info(pBoard, "hailo_fw_control down_interruptible fail tgid:%d (process was interrupted or killed)\n", current->tgid); +- return -ERESTARTSYS; +- } +- +- if (copy_from_user(command, (void __user*)arg, sizeof(*command))) { +- hailo_err(pBoard, "hailo_fw_control, copy_from_user fail\n"); +- err = -ENOMEM; +- goto l_exit; +- } +- +- reinit_completion(&pBoard->fw_control.completion); +- +- err = hailo_pcie_write_firmware_control(&pBoard->pcie_resources, command); +- if (err < 0) { +- hailo_err(pBoard, "Failed writing fw control to pcie\n"); +- goto l_exit; +- } +- +- // Wait for response +- completion_result = wait_for_completion_interruptible_timeout(&pBoard->fw_control.completion, msecs_to_jiffies(command->timeout_ms)); +- if (completion_result <= 0) { +- if (0 == completion_result) { +- hailo_err(pBoard, "hailo_fw_control, timeout waiting for control (timeout_ms=%d)\n", command->timeout_ms); +- err = -ETIMEDOUT; +- } else { +- hailo_info(pBoard, "hailo_fw_control, wait for completion failed with err=%ld (process was interrupted or killed)\n", completion_result); +- err = -EINTR; +- } +- goto l_exit; +- } +- +- err = hailo_pcie_read_firmware_control(&pBoard->pcie_resources, command); +- if (err < 0) { +- hailo_err(pBoard, "Failed reading fw control from pcie\n"); +- goto l_exit; +- } +- +- if (copy_to_user((void __user*)arg, command, sizeof(*command))) { +- hailo_err(pBoard, "hailo_fw_control, copy_to_user fail\n"); +- err = -ENOMEM; +- goto l_exit; +- } +- +-l_exit: +- up(&pBoard->fw_control.mutex); +- return err; +-} +- + static long hailo_query_device_properties(struct hailo_pcie_board *board, unsigned long arg) + { + struct hailo_device_properties props = { + .desc_max_page_size = board->desc_max_page_size, ++ .board_type = board->pcie_resources.board_type, + .allocation_mode = board->allocation_mode, + .dma_type = HAILO_DMA_TYPE_PCIE, + .dma_engines_count = board->vdma.vdma_engines_count, +@@ -618,24 +414,6 @@ static long hailo_general_ioctl(struct h + } + } + +-static long hailo_nnc_ioctl(struct hailo_pcie_board *board, unsigned int cmd, unsigned long arg, +- struct file *filp, bool *should_up_board_mutex) +-{ +- switch (cmd) { +- case HAILO_FW_CONTROL: +- return hailo_fw_control(board, arg, should_up_board_mutex); +- case HAILO_READ_NOTIFICATION: +- return hailo_read_notification_ioctl(board, arg, filp, should_up_board_mutex); +- case HAILO_DISABLE_NOTIFICATION: +- return hailo_disable_notification(board, filp); +- case HAILO_READ_LOG: +- return hailo_read_log_ioctl(board, arg); +- default: +- hailo_err(board, "Invalid nnc ioctl code 0x%x (nr: %d)\n", cmd, _IOC_NR(cmd)); +- return -ENOTTY; +- } +-} +- + long hailo_pcie_fops_unlockedioctl(struct file* filp, unsigned int cmd, unsigned long arg) + { + long err = 0; +@@ -694,7 +472,7 @@ long hailo_pcie_fops_unlockedioctl(struc + hailo_err(board, "Ioctl %d is not supported on this accelerator type\n", _IOC_TYPE(cmd)); + err = -EINVAL; + } else { +- err = hailo_soc_ioctl(board, &context->vdma_context, &board->vdma, cmd, arg); ++ err = hailo_soc_ioctl(board, context, &board->vdma, cmd, arg); + } + break; + case HAILO_NNC_IOCTL_MAGIC: +--- a/drivers/media/pci/hailo/src/fops.h ++++ b/drivers/media/pci/hailo/src/fops.h +@@ -1,16 +1,17 @@ + // SPDX-License-Identifier: GPL-2.0 + /** +- * Copyright (c) 2019-2022 Hailo Technologies Ltd. All rights reserved. ++ * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. + **/ + + #ifndef _HAILO_PCI_FOPS_H_ + #define _HAILO_PCI_FOPS_H_ + ++#include "pcie.h" ++ + int hailo_pcie_fops_open(struct inode* inode, struct file* filp); + int hailo_pcie_fops_release(struct inode* inode, struct file* filp); + long hailo_pcie_fops_unlockedioctl(struct file* filp, unsigned int cmd, unsigned long arg); + int hailo_pcie_fops_mmap(struct file* filp, struct vm_area_struct *vma); +-int hailo_pcie_driver_down(struct hailo_pcie_board *board); + void hailo_pcie_ep_init(struct hailo_pcie_board *board); + + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) +--- /dev/null ++++ b/drivers/media/pci/hailo/src/nnc.c +@@ -0,0 +1,299 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/** ++ * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. ++ **/ ++/** ++ * A Hailo PCIe NNC device is a device contains a NNC (neural network core) and some basic FW. ++ * The device supports sending controls, receiving notification and reading the FW log. ++ */ ++ ++#include "nnc.h" ++#include "hailo_ioctl_common.h" ++ ++#include "utils/logs.h" ++#include "utils/compact.h" ++ ++#include ++ ++#if !defined(HAILO_EMULATOR) ++#define DEFAULT_SHUTDOWN_TIMEOUT_MS (5) ++#else /* !defined(HAILO_EMULATOR) */ ++#define DEFAULT_SHUTDOWN_TIMEOUT_MS (1000) ++#endif /* !defined(HAILO_EMULATOR) */ ++ ++void hailo_nnc_init(struct hailo_pcie_nnc *nnc) ++{ ++ sema_init(&nnc->fw_control.mutex, 1); ++ spin_lock_init(&nnc->notification_read_spinlock); ++ init_completion(&nnc->fw_control.completion); ++ INIT_LIST_HEAD(&nnc->notification_wait_list); ++ memset(&nnc->notification_cache, 0, sizeof(nnc->notification_cache)); ++} ++ ++void hailo_nnc_finalize(struct hailo_pcie_nnc *nnc) ++{ ++ struct hailo_notification_wait *cursor = NULL; ++ ++ // Lock rcu_read_lock and send notification_completion to wake anyone waiting on the notification_wait_list when removed ++ rcu_read_lock(); ++ list_for_each_entry_rcu(cursor, &nnc->notification_wait_list, notification_wait_list) { ++ cursor->is_disabled = true; ++ complete(&cursor->notification_completion); ++ } ++ rcu_read_unlock(); ++} ++ ++static int hailo_fw_control(struct hailo_pcie_board *board, unsigned long arg, bool* should_up_board_mutex) ++{ ++ struct hailo_fw_control *command = &board->nnc.fw_control.command; ++ long completion_result = 0; ++ int err = 0; ++ ++ up(&board->mutex); ++ *should_up_board_mutex = false; ++ ++ if (down_interruptible(&board->nnc.fw_control.mutex)) { ++ hailo_info(board, "hailo_fw_control down_interruptible fail tgid:%d (process was interrupted or killed)\n", current->tgid); ++ return -ERESTARTSYS; ++ } ++ ++ if (copy_from_user(command, (void __user*)arg, sizeof(*command))) { ++ hailo_err(board, "hailo_fw_control, copy_from_user fail\n"); ++ err = -ENOMEM; ++ goto l_exit; ++ } ++ ++ reinit_completion(&board->nnc.fw_control.completion); ++ ++ err = hailo_pcie_write_firmware_control(&board->pcie_resources, command); ++ if (err < 0) { ++ hailo_err(board, "Failed writing fw control to pcie\n"); ++ goto l_exit; ++ } ++ ++ // Wait for response ++ completion_result = wait_for_completion_interruptible_timeout(&board->nnc.fw_control.completion, msecs_to_jiffies(command->timeout_ms)); ++ if (completion_result <= 0) { ++ if (0 == completion_result) { ++ hailo_err(board, "hailo_fw_control, timeout waiting for control (timeout_ms=%d)\n", command->timeout_ms); ++ err = -ETIMEDOUT; ++ } else { ++ hailo_info(board, "hailo_fw_control, wait for completion failed with err=%ld (process was interrupted or killed)\n", completion_result); ++ err = -EINTR; ++ } ++ goto l_exit; ++ } ++ ++ err = hailo_pcie_read_firmware_control(&board->pcie_resources, command); ++ if (err < 0) { ++ hailo_err(board, "Failed reading fw control from pcie\n"); ++ goto l_exit; ++ } ++ ++ if (copy_to_user((void __user*)arg, command, sizeof(*command))) { ++ hailo_err(board, "hailo_fw_control, copy_to_user fail\n"); ++ err = -ENOMEM; ++ goto l_exit; ++ } ++ ++l_exit: ++ up(&board->nnc.fw_control.mutex); ++ return err; ++} ++ ++static long hailo_get_notification_wait_thread(struct hailo_pcie_board *board, struct file *filp, ++ struct hailo_notification_wait **current_waiting_thread) ++{ ++ struct hailo_notification_wait *cursor = NULL; ++ // note: safe to access without rcu because the notification_wait_list is closed only on file release ++ list_for_each_entry(cursor, &board->nnc.notification_wait_list, notification_wait_list) ++ { ++ if ((current->tgid == cursor->tgid) && (filp == cursor->filp)) { ++ *current_waiting_thread = cursor; ++ return 0; ++ } ++ } ++ ++ return -EFAULT; ++} ++ ++static long hailo_read_notification_ioctl(struct hailo_pcie_board *board, unsigned long arg, struct file *filp, ++ bool* should_up_board_mutex) ++{ ++ long err = 0; ++ struct hailo_notification_wait *current_waiting_thread = NULL; ++ struct hailo_d2h_notification *notification = &board->nnc.notification_to_user; ++ unsigned long irq_saved_flags; ++ ++ err = hailo_get_notification_wait_thread(board, filp, ¤t_waiting_thread); ++ if (0 != err) { ++ goto l_exit; ++ } ++ up(&board->mutex); ++ ++ if (0 > (err = wait_for_completion_interruptible(¤t_waiting_thread->notification_completion))) { ++ hailo_info(board, ++ "HAILO_READ_NOTIFICATION - wait_for_completion_interruptible error. err=%ld. tgid=%d (process was interrupted or killed)\n", ++ err, current_waiting_thread->tgid); ++ *should_up_board_mutex = false; ++ goto l_exit; ++ } ++ ++ if (down_interruptible(&board->mutex)) { ++ hailo_info(board, "HAILO_READ_NOTIFICATION - down_interruptible error (process was interrupted or killed)\n"); ++ *should_up_board_mutex = false; ++ err = -ERESTARTSYS; ++ goto l_exit; ++ } ++ ++ // Check if was disabled ++ if (current_waiting_thread->is_disabled) { ++ hailo_info(board, "HAILO_READ_NOTIFICATION, can't find notification wait for tgid=%d\n", current->tgid); ++ err = -EINVAL; ++ goto l_exit; ++ } ++ ++ reinit_completion(¤t_waiting_thread->notification_completion); ++ ++ spin_lock_irqsave(&board->nnc.notification_read_spinlock, irq_saved_flags); ++ notification->buffer_len = board->nnc.notification_cache.buffer_len; ++ memcpy(notification->buffer, board->nnc.notification_cache.buffer, notification->buffer_len); ++ spin_unlock_irqrestore(&board->nnc.notification_read_spinlock, irq_saved_flags); ++ ++ if (copy_to_user((void __user*)arg, notification, sizeof(*notification))) { ++ hailo_err(board, "HAILO_READ_NOTIFICATION copy_to_user fail\n"); ++ err = -ENOMEM; ++ goto l_exit; ++ } ++ ++l_exit: ++ return err; ++} ++ ++static long hailo_disable_notification(struct hailo_pcie_board *board, struct file *filp) ++{ ++ struct hailo_notification_wait *cursor = NULL; ++ ++ hailo_info(board, "HAILO_DISABLE_NOTIFICATION: disable notification"); ++ rcu_read_lock(); ++ list_for_each_entry_rcu(cursor, &board->nnc.notification_wait_list, notification_wait_list) { ++ if ((current->tgid == cursor->tgid) && (filp == cursor->filp)) { ++ cursor->is_disabled = true; ++ complete(&cursor->notification_completion); ++ break; ++ } ++ } ++ rcu_read_unlock(); ++ ++ return 0; ++} ++ ++static long hailo_read_log_ioctl(struct hailo_pcie_board *board, unsigned long arg) ++{ ++ long err = 0; ++ struct hailo_read_log_params params; ++ ++ if (copy_from_user(¶ms, (void __user*)arg, sizeof(params))) { ++ hailo_err(board, "HAILO_READ_LOG, copy_from_user fail\n"); ++ return -ENOMEM; ++ } ++ ++ if (0 > (err = hailo_pcie_read_firmware_log(&board->pcie_resources.fw_access, ¶ms))) { ++ hailo_err(board, "HAILO_READ_LOG, reading from log failed with error: %ld \n", err); ++ return err; ++ } ++ ++ if (copy_to_user((void*)arg, ¶ms, sizeof(params))) { ++ return -ENOMEM; ++ } ++ ++ return 0; ++} ++ ++long hailo_nnc_ioctl(struct hailo_pcie_board *board, unsigned int cmd, unsigned long arg, ++ struct file *filp, bool *should_up_board_mutex) ++{ ++ switch (cmd) { ++ case HAILO_FW_CONTROL: ++ return hailo_fw_control(board, arg, should_up_board_mutex); ++ case HAILO_READ_NOTIFICATION: ++ return hailo_read_notification_ioctl(board, arg, filp, should_up_board_mutex); ++ case HAILO_DISABLE_NOTIFICATION: ++ return hailo_disable_notification(board, filp); ++ case HAILO_READ_LOG: ++ return hailo_read_log_ioctl(board, arg); ++ default: ++ hailo_err(board, "Invalid nnc ioctl code 0x%x (nr: %d)\n", cmd, _IOC_NR(cmd)); ++ return -ENOTTY; ++ } ++} ++ ++ ++static int add_notification_wait(struct hailo_pcie_board *board, struct file *filp) ++{ ++ struct hailo_notification_wait *wait = kmalloc(sizeof(*wait), GFP_KERNEL); ++ if (!wait) { ++ hailo_err(board, "Failed to allocate notification wait structure.\n"); ++ return -ENOMEM; ++ } ++ wait->tgid = current->tgid; ++ wait->filp = filp; ++ wait->is_disabled = false; ++ init_completion(&wait->notification_completion); ++ list_add_rcu(&wait->notification_wait_list, &board->nnc.notification_wait_list); ++ return 0; ++} ++ ++int hailo_nnc_file_context_init(struct hailo_pcie_board *board, struct hailo_file_context *context) ++{ ++ return add_notification_wait(board, context->filp); ++} ++ ++static void clear_notification_wait_list(struct hailo_pcie_board *board, struct file *filp) ++{ ++ struct hailo_notification_wait *cur = NULL, *next = NULL; ++ list_for_each_entry_safe(cur, next, &board->nnc.notification_wait_list, notification_wait_list) { ++ if (cur->filp == filp) { ++ list_del_rcu(&cur->notification_wait_list); ++ synchronize_rcu(); ++ kfree(cur); ++ } ++ } ++} ++ ++int hailo_nnc_driver_down(struct hailo_pcie_board *board) ++{ ++ long completion_result = 0; ++ int err = 0; ++ ++ reinit_completion(&board->driver_down.reset_completed); ++ ++ hailo_pcie_write_firmware_driver_shutdown(&board->pcie_resources); ++ ++ // Wait for response ++ completion_result = ++ wait_for_completion_timeout(&board->driver_down.reset_completed, msecs_to_jiffies(DEFAULT_SHUTDOWN_TIMEOUT_MS)); ++ if (completion_result <= 0) { ++ if (0 == completion_result) { ++ hailo_err(board, "hailo_nnc_driver_down, timeout waiting for shutdown response (timeout_ms=%d)\n", DEFAULT_SHUTDOWN_TIMEOUT_MS); ++ err = -ETIMEDOUT; ++ } else { ++ hailo_info(board, "hailo_nnc_driver_down, wait for completion failed with err=%ld (process was interrupted or killed)\n", ++ completion_result); ++ err = completion_result; ++ } ++ goto l_exit; ++ } ++ ++l_exit: ++ return err; ++} ++ ++void hailo_nnc_file_context_finalize(struct hailo_pcie_board *board, struct hailo_file_context *context) ++{ ++ clear_notification_wait_list(board, context->filp); ++ ++ if (context->filp == board->vdma.used_by_filp) { ++ hailo_nnc_driver_down(board); ++ } ++} +\ No newline at end of file +--- /dev/null ++++ b/drivers/media/pci/hailo/src/nnc.h +@@ -0,0 +1,22 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/** ++ * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. ++ **/ ++ ++#ifndef _HAILO_PCI_NNC_H_ ++#define _HAILO_PCI_NNC_H_ ++ ++#include "pcie.h" ++ ++void hailo_nnc_init(struct hailo_pcie_nnc *nnc); ++void hailo_nnc_finalize(struct hailo_pcie_nnc *nnc); ++ ++long hailo_nnc_ioctl(struct hailo_pcie_board *board, unsigned int cmd, unsigned long arg, ++ struct file *filp, bool *should_up_board_mutex); ++ ++int hailo_nnc_file_context_init(struct hailo_pcie_board *board, struct hailo_file_context *context); ++void hailo_nnc_file_context_finalize(struct hailo_pcie_board *board, struct hailo_file_context *context); ++ ++int hailo_nnc_driver_down(struct hailo_pcie_board *board); ++ ++#endif /* _HAILO_PCI_NNC_H_ */ +\ No newline at end of file +--- a/drivers/media/pci/hailo/src/pci_soc_ioctl.c ++++ /dev/null +@@ -1,155 +0,0 @@ +-// SPDX-License-Identifier: GPL-2.0 +-/** +- * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. +- **/ +-#include "pci_soc_ioctl.h" +- +-#include "utils.h" +-#include "vdma_common.h" +-#include "utils/logs.h" +-#include "vdma/memory.h" +- +-#define PCI_SOC_VDMA_ENGINE_INDEX (0) +-#define PCI_SOC_WAIT_FOR_CONNECT_TIMEOUT_MS (10000) +- +-long hailo_soc_ioctl(struct hailo_pcie_board *board, struct hailo_vdma_file_context *context, +- struct hailo_vdma_controller *controller, unsigned int cmd, unsigned long arg) +-{ +- switch (cmd) { +- case HAILO_SOC_CONNECT: +- return hailo_soc_connect_ioctl(board, context, controller, arg); +- case HAILO_SOC_CLOSE: +- return hailo_soc_close_ioctl(board, controller, arg); +- default: +- hailo_err(board, "Invalid pcie EP ioctl code 0x%x (nr: %d)\n", cmd, _IOC_NR(cmd)); +- return -ENOTTY; +- } +-} +- +-long hailo_soc_connect_ioctl(struct hailo_pcie_board *board, struct hailo_vdma_file_context *context, +- struct hailo_vdma_controller *controller, unsigned long arg) +-{ +- struct hailo_soc_connect_params params; +- struct hailo_vdma_channel *input_channel = NULL; +- struct hailo_vdma_channel *output_channel = NULL; +- struct hailo_vdma_engine *vdma_engine = NULL; +- struct hailo_descriptors_list_buffer *input_descriptors_buffer = NULL; +- struct hailo_descriptors_list_buffer *output_descriptors_buffer = NULL; +- uint8_t depth = 0; +- int err = 0; +- long completion_result = 0; +- +- if (copy_from_user(¶ms, (void *)arg, sizeof(params))) { +- hailo_err(board, "copy_from_user fail\n"); +- return -ENOMEM; +- } +- +- // TODO: have pci_ep choose the channel indexes the soc will use - for now use 0 and 16 +- params.input_channel_index = 0; +- params.output_channel_index = 16; +- +- reinit_completion(&board->soc_connect_accepted); +- hailo_soc_write_soc_connect(&board->pcie_resources); +- +- // Wait for completion +- completion_result = wait_for_completion_interruptible_timeout(&board->soc_connect_accepted, +- msecs_to_jiffies(PCI_SOC_WAIT_FOR_CONNECT_TIMEOUT_MS)); +- if (0 > completion_result) { +- if (0 == completion_result) { +- hailo_err(board, "Timeout waiting for connect to be accepted (timeout_ms=%d)\n", PCI_SOC_WAIT_FOR_CONNECT_TIMEOUT_MS); +- return -ETIMEDOUT; +- } else { +- hailo_info(board, "soc connect failed with err=%ld (process was interrupted or killed)\n", +- completion_result); +- return -EINTR; +- } +- } +- +- vdma_engine = &controller->vdma_engines[PCI_SOC_VDMA_ENGINE_INDEX]; +- input_channel = &vdma_engine->channels[params.input_channel_index]; +- output_channel = &vdma_engine->channels[params.output_channel_index]; +- +- input_descriptors_buffer = hailo_vdma_find_descriptors_buffer(context, params.input_desc_handle); +- output_descriptors_buffer = hailo_vdma_find_descriptors_buffer(context, params.output_desc_handle); +- if (NULL == input_descriptors_buffer || NULL == output_descriptors_buffer) { +- hailo_dev_err(&board->pDev->dev, "input / output descriptors buffer not found \n"); +- return -EINVAL; +- } +- +- // Make sure channels that we are accepting are not already enabled +- if (0 != (vdma_engine->enabled_channels & params.input_channel_index) || +- 0 != (vdma_engine->enabled_channels & params.output_channel_index)) { +- hailo_dev_err(&board->pDev->dev, "Trying to accept already enabled channels\n"); +- return -EINVAL; +- } +- +- if (!is_powerof2((size_t)input_descriptors_buffer->desc_list.desc_count) || +- !is_powerof2((size_t)output_descriptors_buffer->desc_list.desc_count)) { +- hailo_dev_err(&board->pDev->dev, "Invalid desc list size\n"); +- return -EINVAL; +- } +- +- // configure and start input channel +- depth = ceil_log2(input_descriptors_buffer->desc_list.desc_count); +- // DMA Direction is only to get channel index - so +- err = hailo_vdma_start_channel(input_channel->host_regs, input_descriptors_buffer->dma_address, depth, +- board->vdma.hw->ddr_data_id); +- if (err < 0) { +- hailo_dev_err(&board->pDev->dev, "Error starting vdma input channel index %u\n", params.input_channel_index); +- return -EINVAL; +- } +- +- // configure and start output channel +- depth = ceil_log2(output_descriptors_buffer->desc_list.desc_count); +- // DMA Direction is only to get channel index - so +- err = hailo_vdma_start_channel(output_channel->host_regs, output_descriptors_buffer->dma_address, depth, +- board->vdma.hw->ddr_data_id); +- if (err < 0) { +- hailo_dev_err(&board->pDev->dev, "Error starting vdma output channel index %u\n", params.output_channel_index); +- // Close input channel +- hailo_vdma_stop_channel(input_channel->host_regs); +- return -EINVAL; +- } +- +- if (copy_to_user((void *)arg, ¶ms, sizeof(params))) { +- hailo_dev_err(&board->pDev->dev, "copy_to_user fail\n"); +- return -ENOMEM; +- } +- +- return 0; +-} +- +-long hailo_soc_close_ioctl(struct hailo_pcie_board *board, struct hailo_vdma_controller *controller, unsigned long arg) +-{ +- struct hailo_soc_close_params params; +- struct hailo_vdma_channel *input_channel = NULL; +- struct hailo_vdma_channel *output_channel = NULL; +- struct hailo_vdma_engine *vdma_engine = NULL; +- +- if (copy_from_user(¶ms, (void *)arg, sizeof(params))) { +- hailo_dev_err(&board->pDev->dev, "copy_from_user fail\n"); +- return -ENOMEM; +- } +- +- vdma_engine = &controller->vdma_engines[PCI_SOC_VDMA_ENGINE_INDEX]; +- +- if (!hailo_check_channel_index(params.input_channel_index, controller->hw->src_channels_bitmask, true)) { +- hailo_dev_err(&board->pDev->dev, "Invalid input channel index %u\n", params.input_channel_index); +- return -EINVAL; +- } +- +- if (!hailo_check_channel_index(params.output_channel_index, controller->hw->src_channels_bitmask, false)) { +- hailo_dev_err(&board->pDev->dev, "Invalid output channel index %u\n", params.output_channel_index); +- return -EINVAL; +- } +- +- input_channel = &vdma_engine->channels[params.input_channel_index]; +- output_channel = &vdma_engine->channels[params.output_channel_index]; +- +- // Close channels +- hailo_vdma_stop_channel(input_channel->host_regs); +- hailo_vdma_stop_channel(output_channel->host_regs); +- +- hailo_pcie_write_firmware_driver_shutdown(&board->pcie_resources); +- return 0; +-} +\ No newline at end of file +--- a/drivers/media/pci/hailo/src/pcie.c ++++ b/drivers/media/pci/hailo/src/pcie.c +@@ -1,6 +1,6 @@ + // SPDX-License-Identifier: GPL-2.0 + /** +- * Copyright (c) 2019-2022 Hailo Technologies Ltd. All rights reserved. ++ * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. + **/ + + #include +@@ -22,6 +22,8 @@ + + #include "hailo_ioctl_common.h" + #include "pcie.h" ++#include "nnc.h" ++#include "soc.h" + #include "fops.h" + #include "sysfs.h" + #include "utils/logs.h" +@@ -40,11 +42,12 @@ enum hailo_allocate_driver_buffer_driver + HAILO_FORCE_BUFFER_FROM_DRIVER = 2, + }; + +-//Debug flag ++// Debug flag + static int force_desc_page_size = 0; + static bool g_is_power_mode_enabled = true; + static int force_allocation_from_driver = HAILO_NO_FORCE_BUFFER; + static bool force_hailo15_legacy_mode = false; ++static bool force_boot_linux_from_eemc = false; + + #define DEVICE_NODE_NAME "hailo" + static int char_major = 0; +@@ -206,7 +209,7 @@ static int hailo_pcie_disable_aspm(struc + /* Double-check ASPM control. If not disabled by the above, the + * BIOS is preventing that from happening (or CONFIG_PCIEASPM is + * not enabled); override by writing PCI config space directly. +- */ ++ */ + err = pcie_capability_read_word(pdev, PCI_EXP_LNKCTL, &pdev_aspmc); + if (err < 0) { + hailo_err(board, "Couldn't read LNKCTL capability\n"); +@@ -288,101 +291,59 @@ static void hailo_pcie_remove_board(stru + up(&g_hailo_add_board_mutex); + } + +-static int hailo_write_config(struct hailo_pcie_resources *resources, struct device *dev, +- const struct hailo_config_constants *config_consts) +-{ +- const struct firmware *config = NULL; +- int err = 0; +- +- if (NULL == config_consts->filename) { +- // Config not supported for platform +- return 0; +- } +- +- err = request_firmware_direct(&config, config_consts->filename, dev); +- if (err < 0) { +- hailo_dev_info(dev, "Config %s not found\n", config_consts->filename); +- return 0; +- } +- +- hailo_dev_notice(dev, "Writing config %s\n", config_consts->filename); +- +- err = hailo_pcie_write_config_common(resources, config->data, config->size, config_consts); +- if (err < 0) { +- if (-EINVAL == err) { +- hailo_dev_warn(dev, "Config size %zu is bigger than max %zu\n", config->size, config_consts->max_size); +- } +- release_firmware(config); +- return err; +- } +- +- release_firmware(config); +- return 0; +-} +- + static bool wait_for_firmware_completion(struct completion *fw_load_completion) + { + return (0 != wait_for_completion_timeout(fw_load_completion, msecs_to_jiffies(FIRMWARE_WAIT_TIMEOUT_MS))); + } + +-static int hailo_load_firmware(struct hailo_pcie_resources *resources, ++static int hailo_load_soc_firmware(struct hailo_pcie_resources *resources, + struct device *dev, struct completion *fw_load_completion) + { +- const struct firmware *firmware = NULL; +- int err = 0; + u32 boot_status = 0; ++ int err = 0; ++ u32 second_stage = force_boot_linux_from_eemc ? SECOND_STAGE_LINUX_IN_EMMC : SECOND_STAGE; + + if (hailo_pcie_is_firmware_loaded(resources)) { +- hailo_dev_warn(dev, "Firmware was already loaded\n"); ++ hailo_dev_warn(dev, "Firmware batch was already loaded\n"); + return 0; + } + +- reinit_completion(fw_load_completion); +- +- err = hailo_write_config(resources, dev, hailo_pcie_get_board_config_constants(resources->board_type)); +- if (err < 0) { +- hailo_dev_err(dev, "Failed writing board config"); +- return err; +- } ++ init_completion(fw_load_completion); + +- err = hailo_write_config(resources, dev, hailo_pcie_get_user_config_constants(resources->board_type)); ++ err = hailo_pcie_write_firmware_batch(dev, resources, FIRST_STAGE); + if (err < 0) { +- hailo_dev_err(dev, "Failed writing fw config"); ++ hailo_dev_err(dev, "Failed writing firmware files. err %d\n", err); + return err; + } + +- // read firmware file +- err = request_firmware_direct(&firmware, hailo_pcie_get_fw_filename(resources->board_type), dev); +- if (err < 0) { +- hailo_dev_warn(dev, "Firmware file not found (/lib/firmware/%s), please upload the firmware manually \n", +- hailo_pcie_get_fw_filename(resources->board_type)); +- return 0; ++ if (!wait_for_firmware_completion(fw_load_completion)) { ++ boot_status = hailo_get_boot_status(resources); ++ hailo_dev_err(dev, "Timeout waiting for firmware file, boot status %u\n", boot_status); ++ return -ETIMEDOUT; + } ++ reinit_completion(fw_load_completion); + +- err = hailo_pcie_write_firmware(resources, firmware->data, firmware->size); ++ err = hailo_pcie_write_firmware_batch(dev, resources, second_stage); + if (err < 0) { +- hailo_dev_err(dev, "Failed writing firmware. err %d\n", err); +- release_firmware(firmware); ++ hailo_dev_err(dev, "Failed writing firmware files. err %d\n", err); + return err; + } + +- release_firmware(firmware); +- + if (!wait_for_firmware_completion(fw_load_completion)) { + boot_status = hailo_get_boot_status(resources); + hailo_dev_err(dev, "Timeout waiting for firmware file, boot status %u\n", boot_status); + return -ETIMEDOUT; + } + +- hailo_dev_notice(dev, "Firmware was loaded successfully\n"); ++ hailo_dev_notice(dev, "Firmware Batch loaded successfully\n"); ++ + return 0; + } + +-static int hailo_load_firmware_batch(struct hailo_pcie_resources *resources, ++static int hailo_load_nnc_firmware(struct hailo_pcie_resources *resources, + struct device *dev, struct completion *fw_load_completion) + { + u32 boot_status = 0; +- u32 pcie_finished = 1; + int err = 0; + + if (hailo_pcie_is_firmware_loaded(resources)) { +@@ -398,31 +359,13 @@ static int hailo_load_firmware_batch(str + return err; + } + +- hailo_trigger_firmware_boot(resources); +- + if (!wait_for_firmware_completion(fw_load_completion)) { + boot_status = hailo_get_boot_status(resources); + hailo_dev_err(dev, "Timeout waiting for firmware file, boot status %u\n", boot_status); + return -ETIMEDOUT; + } +- reinit_completion(fw_load_completion); + +- err = hailo_pcie_write_firmware_batch(dev, resources, SECOND_STAGE); +- if (err < 0) { +- hailo_dev_err(dev, "Failed writing firmware files. err %d\n", err); +- return err; +- } +- +- // TODO: HRT-13838 - Remove, move address to compat, make write_memory static +- write_memory(resources, 0x84000000, (void*)&pcie_finished, sizeof(pcie_finished)); +- +- if (!wait_for_firmware_completion(fw_load_completion)) { +- boot_status = hailo_get_boot_status(resources); +- hailo_dev_err(dev, "Timeout waiting for firmware file, boot status %u\n", boot_status); +- return -ETIMEDOUT; +- } +- +- hailo_dev_notice(dev, "Firmware Batch loaded successfully\n"); ++ hailo_dev_notice(dev, "Firmware loaded successfully\n"); + + return 0; + } +@@ -439,15 +382,13 @@ static int hailo_activate_board(struct h + return err; + } + +- switch (board->pcie_resources.board_type) { +- case HAILO_BOARD_TYPE_HAILO10H: +- err = hailo_load_firmware_batch(&board->pcie_resources, &board->pDev->dev, ++ switch (board->pcie_resources.accelerator_type) { ++ case HAILO_ACCELERATOR_TYPE_SOC: ++ err = hailo_load_soc_firmware(&board->pcie_resources, &board->pDev->dev, + &board->fw_loaded_completion); + break; +- case HAILO_BOARD_TYPE_HAILO10H_LEGACY: +- case HAILO_BOARD_TYPE_PLUTO: +- case HAILO_BOARD_TYPE_HAILO8: +- err = hailo_load_firmware(&board->pcie_resources, &board->pDev->dev, ++ case HAILO_ACCELERATOR_TYPE_NNC: ++ err = hailo_load_nnc_firmware(&board->pcie_resources, &board->pDev->dev, + &board->fw_loaded_completion); + break; + default: +@@ -464,6 +405,7 @@ static int hailo_activate_board(struct h + + if (power_mode_enabled()) { + // Setting the device to low power state, until the user opens the device ++ hailo_info(board, "Power change state to PCI_D3hot\n"); + err = pci_set_power_state(board->pDev, PCI_D3hot); + if (err < 0) { + hailo_err(board, "Set power state failed %d\n", err); +@@ -755,21 +697,17 @@ static int hailo_pcie_probe(struct pci_d + + pBoard->interrupts_enabled = false; + init_completion(&pBoard->fw_loaded_completion); +- init_completion(&pBoard->soc_connect_accepted); + + sema_init(&pBoard->mutex, 1); + atomic_set(&pBoard->ref_count, 0); + INIT_LIST_HEAD(&pBoard->open_files_list); + +- sema_init(&pBoard->fw_control.mutex, 1); +- spin_lock_init(&pBoard->notification_read_spinlock); +- init_completion(&pBoard->fw_control.completion); ++ // Init both soc and nnc, since the interrupts are shared. ++ hailo_nnc_init(&pBoard->nnc); ++ hailo_soc_init(&pBoard->soc); + + init_completion(&pBoard->driver_down.reset_completed); + +- INIT_LIST_HEAD(&pBoard->notification_wait_list); +- +- memset(&pBoard->notification_cache, 0, sizeof(pBoard->notification_cache)); + memset(&pBoard->memory_transfer_params, 0, sizeof(pBoard->memory_transfer_params)); + + err = hailo_pcie_vdma_controller_init(&pBoard->vdma, &pBoard->pDev->dev, +@@ -832,7 +770,6 @@ probe_exit: + static void hailo_pcie_remove(struct pci_dev* pDev) + { + struct hailo_pcie_board* pBoard = (struct hailo_pcie_board*) pci_get_drvdata(pDev); +- struct hailo_notification_wait *cursor = NULL; + + pci_notice(pDev, "Remove: Releasing board\n"); + +@@ -864,13 +801,7 @@ static void hailo_pcie_remove(struct pci + + pci_set_drvdata(pDev, NULL); + +- // Lock rcu_read_lock and send notification_completion to wake anyone waiting on the notification_wait_list when removed +- rcu_read_lock(); +- list_for_each_entry_rcu(cursor, &pBoard->notification_wait_list, notification_wait_list) { +- cursor->is_disabled = true; +- complete(&cursor->notification_completion); +- } +- rcu_read_unlock(); ++ hailo_nnc_finalize(&pBoard->nnc); + + up(&pBoard->mutex); + +@@ -889,6 +820,15 @@ static void hailo_pcie_remove(struct pci + + } + ++inline int driver_down(struct hailo_pcie_board *board) ++{ ++ if (board->pcie_resources.accelerator_type == HAILO_ACCELERATOR_TYPE_NNC) { ++ return hailo_nnc_driver_down(board); ++ } else { ++ return hailo_soc_driver_down(board); ++ } ++} ++ + #ifdef CONFIG_PM_SLEEP + static int hailo_pcie_suspend(struct device *dev) + { +@@ -899,17 +839,16 @@ static int hailo_pcie_suspend(struct dev + // lock board to wait for any pending operations + down(&board->mutex); + +- // Disable all interrupts. All interrupts from Hailo chip would be masked. +- hailo_disable_interrupts(board); +- +- // Close all vDMA channels + if (board->vdma.used_by_filp != NULL) { +- err = hailo_pcie_driver_down(board); ++ err = driver_down(board); + if (err < 0) { + dev_notice(dev, "Error while trying to call FW to close vdma channels\n"); + } + } + ++ // Disable all interrupts. All interrupts from Hailo chip would be masked. ++ hailo_disable_interrupts(board); ++ + // Un validate all activae file contexts so every new action would return error to the user. + list_for_each_entry(cur, &board->open_files_list, open_files_list) { + cur->is_valid = false; +@@ -919,8 +858,8 @@ static int hailo_pcie_suspend(struct dev + up(&board->mutex); + + dev_notice(dev, "PM's suspend\n"); +- // Continue system suspend +- return err; ++ // Success Oriented - Continue system suspend even in case of error (otherwise system will not suspend correctly) ++ return 0; + } + + static int hailo_pcie_resume(struct device *dev) +@@ -930,10 +869,10 @@ static int hailo_pcie_resume(struct devi + + if ((err = hailo_activate_board(board)) < 0) { + dev_err(dev, "Failed activating board %d\n", err); +- return err; + } + + dev_notice(dev, "PM's resume\n"); ++ // Success Oriented - Continue system resume even in case of error (otherwise system will not suspend correctly) + return 0; + } + #endif /* CONFIG_PM_SLEEP */ +@@ -954,7 +893,7 @@ static void hailo_pci_reset_prepare(stru + down(&board->mutex); + if (board->vdma.used_by_filp != NULL) { + // Try to close all vDMA channels before reset +- err = hailo_pcie_driver_down(board); ++ err = driver_down(board); + if (err < 0) { + pci_err(pdev, "Error while trying to call FW to close vdma channels (errno %d)\n", err); + } +@@ -1088,6 +1027,9 @@ MODULE_PARM_DESC(force_desc_page_size, " + module_param(force_hailo15_legacy_mode, bool, S_IRUGO); + MODULE_PARM_DESC(force_hailo15_legacy_mode, "Forces work with Hailo15 in legacy mode(relevant for emulators)"); + ++module_param(force_boot_linux_from_eemc, bool, S_IRUGO); ++MODULE_PARM_DESC(force_boot_linux_from_eemc, "Boot the linux image from eemc (Requires special Image)"); ++ + MODULE_AUTHOR("Hailo Technologies Ltd."); + MODULE_DESCRIPTION("Hailo PCIe driver"); + MODULE_LICENSE("GPL v2"); +--- a/drivers/media/pci/hailo/src/pcie.h ++++ b/drivers/media/pci/hailo/src/pcie.h +@@ -1,6 +1,6 @@ + // SPDX-License-Identifier: GPL-2.0 + /** +- * Copyright (c) 2019-2022 Hailo Technologies Ltd. All rights reserved. ++ * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. + **/ + + #ifndef _HAILO_PCI_PCIE_H_ +@@ -41,6 +41,19 @@ struct hailo_fw_boot { + }; + + ++struct hailo_pcie_nnc { ++ struct hailo_fw_control_info fw_control; ++ ++ spinlock_t notification_read_spinlock; ++ struct list_head notification_wait_list; ++ struct hailo_d2h_notification notification_cache; ++ struct hailo_d2h_notification notification_to_user; ++}; ++ ++struct hailo_pcie_soc { ++ struct completion control_resp_ready; ++}; ++ + // Context for each open file handle + // TODO: store board and use as actual context + struct hailo_file_context { +@@ -48,6 +61,7 @@ struct hailo_file_context { + struct file *filp; + struct hailo_vdma_file_context vdma_context; + bool is_valid; ++ u32 soc_used_channels_bitmap; + }; + + struct hailo_pcie_board { +@@ -57,21 +71,17 @@ struct hailo_pcie_board { + atomic_t ref_count; + struct list_head open_files_list; + struct hailo_pcie_resources pcie_resources; +- struct hailo_fw_control_info fw_control; ++ struct hailo_pcie_nnc nnc; ++ struct hailo_pcie_soc soc; + struct hailo_pcie_driver_down_info driver_down; + struct semaphore mutex; + struct hailo_vdma_controller vdma; +- spinlock_t notification_read_spinlock; +- struct list_head notification_wait_list; +- struct hailo_d2h_notification notification_cache; +- struct hailo_d2h_notification notification_to_user; ++ + struct hailo_memory_transfer_params memory_transfer_params; + u32 desc_max_page_size; + enum hailo_allocation_mode allocation_mode; + struct completion fw_loaded_completion; + bool interrupts_enabled; +- // Only needed in accelerator type soc +- struct completion soc_connect_accepted; + }; + + bool power_mode_enabled(void); +--- /dev/null ++++ b/drivers/media/pci/hailo/src/soc.c +@@ -0,0 +1,244 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/** ++ * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. ++ **/ ++/** ++ * A Hailo PCIe NNC device is a device contains a full SoC over PCIe. The SoC contains NNC (neural network core) and ++ * some application processor (pci_ep). ++ */ ++ ++#include "soc.h" ++ ++#include "vdma_common.h" ++#include "utils/logs.h" ++#include "vdma/memory.h" ++ ++#include ++ ++#define PCI_SOC_VDMA_ENGINE_INDEX (0) ++#define PCI_SOC_CONTROL_CONNECT_TIMEOUT_MS (1000) ++#define PCI_SOC_INPUT_CHANNEL_BITMASK (0x000000FF) ++ ++void hailo_soc_init(struct hailo_pcie_soc *soc) ++{ ++ init_completion(&soc->control_resp_ready); ++} ++ ++long hailo_soc_ioctl(struct hailo_pcie_board *board, struct hailo_file_context *context, ++ struct hailo_vdma_controller *controller, unsigned int cmd, unsigned long arg) ++{ ++ switch (cmd) { ++ case HAILO_SOC_CONNECT: ++ return hailo_soc_connect_ioctl(board, context, controller, arg); ++ case HAILO_SOC_CLOSE: ++ return hailo_soc_close_ioctl(board, controller, context, arg); ++ default: ++ hailo_err(board, "Invalid pcie EP ioctl code 0x%x (nr: %d)\n", cmd, _IOC_NR(cmd)); ++ return -ENOTTY; ++ } ++} ++ ++static int soc_control(struct hailo_pcie_board *board, ++ const struct hailo_pcie_soc_request *request, ++ struct hailo_pcie_soc_response *response) ++{ ++ int ret = 0; ++ reinit_completion(&board->soc.control_resp_ready); ++ ++ hailo_pcie_soc_write_request(&board->pcie_resources, request); ++ ++ ret = wait_for_completion_interruptible_timeout(&board->soc.control_resp_ready, ++ msecs_to_jiffies(PCI_SOC_CONTROL_CONNECT_TIMEOUT_MS)); ++ if (ret <= 0) { ++ if (0 == ret) { ++ hailo_err(board, "Timeout waiting for soc control (timeout_ms=%d)\n", PCI_SOC_CONTROL_CONNECT_TIMEOUT_MS); ++ return -ETIMEDOUT; ++ } else { ++ hailo_info(board, "soc control failed with err=%d (process was interrupted or killed)\n", ++ ret); ++ return ret; ++ } ++ } ++ ++ hailo_pcie_soc_read_response(&board->pcie_resources, response); ++ ++ if (response->status < 0) { ++ hailo_err(board, "soc control failed with status=%d\n", response->status); ++ return response->status; ++ } ++ ++ if (response->control_code != request->control_code) { ++ hailo_err(board, "Invalid response control code %d (expected %d)\n", ++ response->control_code, request->control_code); ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++long hailo_soc_connect_ioctl(struct hailo_pcie_board *board, struct hailo_file_context *context, ++ struct hailo_vdma_controller *controller, unsigned long arg) ++{ ++ struct hailo_pcie_soc_request request = {0}; ++ struct hailo_pcie_soc_response response = {0}; ++ struct hailo_soc_connect_params params; ++ struct hailo_vdma_channel *input_channel = NULL; ++ struct hailo_vdma_channel *output_channel = NULL; ++ struct hailo_vdma_engine *vdma_engine = &controller->vdma_engines[PCI_SOC_VDMA_ENGINE_INDEX]; ++ struct hailo_descriptors_list_buffer *input_descriptors_buffer = NULL; ++ struct hailo_descriptors_list_buffer *output_descriptors_buffer = NULL; ++ uint8_t depth = 0; ++ int err = 0; ++ ++ if (copy_from_user(¶ms, (void *)arg, sizeof(params))) { ++ hailo_err(board, "copy_from_user fail\n"); ++ return -ENOMEM; ++ } ++ ++ request = (struct hailo_pcie_soc_request) { ++ .control_code = HAILO_PCIE_SOC_CONTROL_CODE_CONNECT, ++ .connect = { ++ .port = params.port_number ++ } ++ }; ++ err = soc_control(board, &request, &response); ++ if (err < 0) { ++ return err; ++ } ++ ++ params.input_channel_index = response.connect.input_channel_index; ++ params.output_channel_index = response.connect.output_channel_index; ++ ++ if (!hailo_check_channel_index(params.input_channel_index, controller->hw->src_channels_bitmask, true)) { ++ hailo_dev_err(&board->pDev->dev, "Invalid input channel index %u\n", params.input_channel_index); ++ return -EINVAL; ++ } ++ ++ if (!hailo_check_channel_index(params.output_channel_index, controller->hw->src_channels_bitmask, false)) { ++ hailo_dev_err(&board->pDev->dev, "Invalid output channel index %u\n", params.output_channel_index); ++ return -EINVAL; ++ } ++ ++ input_channel = &vdma_engine->channels[params.input_channel_index]; ++ output_channel = &vdma_engine->channels[params.output_channel_index]; ++ ++ input_descriptors_buffer = hailo_vdma_find_descriptors_buffer(&context->vdma_context, params.input_desc_handle); ++ output_descriptors_buffer = hailo_vdma_find_descriptors_buffer(&context->vdma_context, params.output_desc_handle); ++ if (NULL == input_descriptors_buffer || NULL == output_descriptors_buffer) { ++ hailo_dev_err(&board->pDev->dev, "input / output descriptors buffer not found \n"); ++ return -EINVAL; ++ } ++ ++ if (!is_powerof2((size_t)input_descriptors_buffer->desc_list.desc_count) || ++ !is_powerof2((size_t)output_descriptors_buffer->desc_list.desc_count)) { ++ hailo_dev_err(&board->pDev->dev, "Invalid desc list size\n"); ++ return -EINVAL; ++ } ++ ++ // configure and start input channel ++ depth = ceil_log2(input_descriptors_buffer->desc_list.desc_count); ++ // DMA Direction is only to get channel index - so ++ err = hailo_vdma_start_channel(input_channel->host_regs, input_descriptors_buffer->dma_address, depth, ++ board->vdma.hw->ddr_data_id); ++ if (err < 0) { ++ hailo_dev_err(&board->pDev->dev, "Error starting vdma input channel index %u\n", params.input_channel_index); ++ return -EINVAL; ++ } ++ ++ // Store the input channels state in bitmap (open) ++ hailo_set_bit(params.input_channel_index, &context->soc_used_channels_bitmap); ++ ++ // configure and start output channel ++ depth = ceil_log2(output_descriptors_buffer->desc_list.desc_count); ++ // DMA Direction is only to get channel index - so ++ err = hailo_vdma_start_channel(output_channel->host_regs, output_descriptors_buffer->dma_address, depth, ++ board->vdma.hw->ddr_data_id); ++ if (err < 0) { ++ hailo_dev_err(&board->pDev->dev, "Error starting vdma output channel index %u\n", params.output_channel_index); ++ // Close input channel ++ hailo_vdma_stop_channel(input_channel->host_regs); ++ return -EINVAL; ++ } ++ ++ // Store the output channels state in bitmap (open) ++ hailo_set_bit(params.output_channel_index, &context->soc_used_channels_bitmap); ++ ++ if (copy_to_user((void *)arg, ¶ms, sizeof(params))) { ++ hailo_dev_err(&board->pDev->dev, "copy_to_user fail\n"); ++ return -ENOMEM; ++ } ++ ++ return 0; ++} ++ ++static int close_channels(struct hailo_pcie_board *board, u32 channels_bitmap) ++{ ++ struct hailo_pcie_soc_request request = {0}; ++ struct hailo_pcie_soc_response response = {0}; ++ struct hailo_vdma_engine *engine = &board->vdma.vdma_engines[PCI_SOC_VDMA_ENGINE_INDEX]; ++ struct hailo_vdma_channel *channel = NULL; ++ u8 channel_index = 0; ++ ++ hailo_info(board, "Closing channels bitmap 0x%x\n", channels_bitmap); ++ for_each_vdma_channel(engine, channel, channel_index) { ++ if (hailo_test_bit(channel_index, &channels_bitmap)) { ++ hailo_vdma_stop_channel(channel->host_regs); ++ } ++ } ++ ++ request = (struct hailo_pcie_soc_request) { ++ .control_code = HAILO_PCIE_SOC_CONTROL_CODE_CLOSE, ++ .close = { ++ .channels_bitmap = channels_bitmap ++ } ++ }; ++ return soc_control(board, &request, &response); ++} ++ ++long hailo_soc_close_ioctl(struct hailo_pcie_board *board, struct hailo_vdma_controller *controller, ++ struct hailo_file_context *context, unsigned long arg) ++{ ++ struct hailo_soc_close_params params; ++ u32 channels_bitmap = 0; ++ int err = 0; ++ ++ if (copy_from_user(¶ms, (void *)arg, sizeof(params))) { ++ hailo_dev_err(&board->pDev->dev, "copy_from_user fail\n"); ++ return -ENOMEM; ++ } ++ ++ // TOOD: check channels are connected ++ ++ channels_bitmap = (1 << params.input_channel_index) | (1 << params.output_channel_index); ++ ++ err = close_channels(board, channels_bitmap); ++ if (0 != err) { ++ hailo_dev_err(&board->pDev->dev, "Error closing channels\n"); ++ return err; ++ } ++ ++ // Store the channel state in bitmap (closed) ++ hailo_clear_bit(params.input_channel_index, &context->soc_used_channels_bitmap); ++ hailo_clear_bit(params.output_channel_index, &context->soc_used_channels_bitmap); ++ ++ return err; ++} ++ ++int hailo_soc_file_context_init(struct hailo_pcie_board *board, struct hailo_file_context *context) ++{ ++ // Nothing to init yet ++ return 0; ++} ++ ++void hailo_soc_file_context_finalize(struct hailo_pcie_board *board, struct hailo_file_context *context) ++{ ++ // close only channels connected by this (by bitmap) ++ if (context->soc_used_channels_bitmap != 0) { ++ close_channels(board, context->soc_used_channels_bitmap); ++ } ++} ++ ++int hailo_soc_driver_down(struct hailo_pcie_board *board) ++{ ++ return close_channels(board, 0xFFFFFFFF); ++} +\ No newline at end of file +--- a/drivers/media/pci/hailo/src/pci_soc_ioctl.h ++++ /dev/null +@@ -1,19 +0,0 @@ +-// SPDX-License-Identifier: GPL-2.0 +-/** +- * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. +- **/ +- +-#ifndef _HAILO_PCI_SOC_IOCTL_H_ +-#define _HAILO_PCI_SOC_IOCTL_H_ +- +-#include "vdma/ioctl.h" +-#include "pcie.h" +- +- +-long hailo_soc_ioctl(struct hailo_pcie_board *board, struct hailo_vdma_file_context *context, +- struct hailo_vdma_controller *controller, unsigned int cmd, unsigned long arg); +-long hailo_soc_connect_ioctl(struct hailo_pcie_board *board, struct hailo_vdma_file_context *context, +- struct hailo_vdma_controller *controller, unsigned long arg); +-long hailo_soc_close_ioctl(struct hailo_pcie_board *board, struct hailo_vdma_controller *controller, unsigned long arg); +- +-#endif // _HAILO_PCI_SOC_IOCTL_H_ +\ No newline at end of file +--- /dev/null ++++ b/drivers/media/pci/hailo/src/soc.h +@@ -0,0 +1,26 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/** ++ * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. ++ **/ ++ ++#ifndef _HAILO_PCI_SOC_IOCTL_H_ ++#define _HAILO_PCI_SOC_IOCTL_H_ ++ ++#include "vdma/ioctl.h" ++#include "pcie.h" ++ ++ ++void hailo_soc_init(struct hailo_pcie_soc *soc); ++ ++long hailo_soc_ioctl(struct hailo_pcie_board *board, struct hailo_file_context *context, ++ struct hailo_vdma_controller *controller, unsigned int cmd, unsigned long arg); ++long hailo_soc_connect_ioctl(struct hailo_pcie_board *board, struct hailo_file_context *context, ++ struct hailo_vdma_controller *controller, unsigned long arg); ++long hailo_soc_close_ioctl(struct hailo_pcie_board *board, struct hailo_vdma_controller *controller, struct hailo_file_context *context, unsigned long arg); ++ ++int hailo_soc_file_context_init(struct hailo_pcie_board *board, struct hailo_file_context *context); ++void hailo_soc_file_context_finalize(struct hailo_pcie_board *board, struct hailo_file_context *context); ++ ++int hailo_soc_driver_down(struct hailo_pcie_board *board); ++ ++#endif // _HAILO_PCI_SOC_IOCTL_H_ +\ No newline at end of file +--- a/drivers/media/pci/hailo/src/sysfs.c ++++ b/drivers/media/pci/hailo/src/sysfs.c +@@ -1,6 +1,6 @@ + // SPDX-License-Identifier: GPL-2.0 + /** +- * Copyright (c) 2019-2022 Hailo Technologies Ltd. All rights reserved. ++ * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. + **/ + + #include "sysfs.h" +--- a/drivers/media/pci/hailo/src/sysfs.h ++++ b/drivers/media/pci/hailo/src/sysfs.h +@@ -1,6 +1,6 @@ + // SPDX-License-Identifier: GPL-2.0 + /** +- * Copyright (c) 2019-2022 Hailo Technologies Ltd. All rights reserved. ++ * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. + **/ + + #ifndef _HAILO_PCI_SYSFS_H_ +--- a/drivers/media/pci/hailo/src/utils.c ++++ /dev/null +@@ -1,26 +0,0 @@ +-// SPDX-License-Identifier: GPL-2.0 +-/** +- * Copyright (c) 2019-2022 Hailo Technologies Ltd. All rights reserved. +- **/ +- +-#include +-#include +-#include +-#include +- +-#include "pcie.h" +-#include "utils.h" +-#include "utils/logs.h" +- +- +-void hailo_pcie_clear_notification_wait_list(struct hailo_pcie_board *pBoard, struct file *filp) +-{ +- struct hailo_notification_wait *cur = NULL, *next = NULL; +- list_for_each_entry_safe(cur, next, &pBoard->notification_wait_list, notification_wait_list) { +- if (cur->filp == filp) { +- list_del_rcu(&cur->notification_wait_list); +- synchronize_rcu(); +- kfree(cur); +- } +- } +-} +--- a/drivers/media/pci/hailo/utils/compact.h ++++ b/drivers/media/pci/hailo/utils/compact.h +@@ -1,6 +1,6 @@ + // SPDX-License-Identifier: GPL-2.0 + /** +- * Copyright (c) 2019-2022 Hailo Technologies Ltd. All rights reserved. ++ * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. + **/ + + #ifndef _HAILO_PCI_COMPACT_H_ +--- a/drivers/media/pci/hailo/utils/fw_common.h ++++ b/drivers/media/pci/hailo/utils/fw_common.h +@@ -1,6 +1,6 @@ + // SPDX-License-Identifier: GPL-2.0 + /** +- * Copyright (c) 2019-2022 Hailo Technologies Ltd. All rights reserved. ++ * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. + **/ + + #ifndef _HAILO_LINUX_COMMON_H_ +--- a/drivers/media/pci/hailo/utils/integrated_nnc_utils.c ++++ b/drivers/media/pci/hailo/utils/integrated_nnc_utils.c +@@ -1,6 +1,6 @@ + // SPDX-License-Identifier: GPL-2.0 + /** +- * Copyright (c) 2019-2022 Hailo Technologies Ltd. All rights reserved. ++ * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. + **/ + + #include "integrated_nnc_utils.h" +@@ -43,11 +43,19 @@ int hailo_ioremap_shmem(struct platform_ + void __iomem * remap_ptr; + + shmem = of_parse_phandle(pdev->dev.of_node, "shmem", index); ++ if (!shmem) { ++ hailo_dev_err(&pdev->dev, "Failed to find shmem node index: %d in device tree\n", index); ++ return -ENODEV; ++ } ++ + ret = of_address_to_resource(shmem, 0, &res); + if (ret) { + hailo_dev_err(&pdev->dev, "hailo_ioremap_shmem, failed to get memory (index: %d)\n", index); ++ of_node_put(shmem); + return ret; + } ++ ++ // Decrement the refcount of the node + of_node_put(shmem); + + remap_ptr = devm_ioremap(&pdev->dev, res.start, resource_size(&res)); +--- a/drivers/media/pci/hailo/utils/integrated_nnc_utils.h ++++ b/drivers/media/pci/hailo/utils/integrated_nnc_utils.h +@@ -1,6 +1,6 @@ + // SPDX-License-Identifier: GPL-2.0 + /** +- * Copyright (c) 2019-2022 Hailo Technologies Ltd. All rights reserved. ++ * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. + **/ + + #ifndef _INTEGRATED_NNC_UTILS_H_ +--- a/drivers/media/pci/hailo/utils/logs.c ++++ b/drivers/media/pci/hailo/utils/logs.c +@@ -1,6 +1,6 @@ + // SPDX-License-Identifier: GPL-2.0 + /** +- * Copyright (c) 2019-2022 Hailo Technologies Ltd. All rights reserved. ++ * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. + **/ + + #include "logs.h" +--- a/drivers/media/pci/hailo/utils/logs.h ++++ b/drivers/media/pci/hailo/utils/logs.h +@@ -1,6 +1,6 @@ + // SPDX-License-Identifier: GPL-2.0 + /** +- * Copyright (c) 2019-2022 Hailo Technologies Ltd. All rights reserved. ++ * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. + **/ + + #ifndef _COMMON_LOGS_H_ +--- a/drivers/media/pci/hailo/vdma/ioctl.c ++++ b/drivers/media/pci/hailo/vdma/ioctl.c +@@ -1,6 +1,6 @@ + // SPDX-License-Identifier: GPL-2.0 + /** +- * Copyright (c) 2019-2022 Hailo Technologies Ltd. All rights reserved. ++ * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. + **/ + + #include "ioctl.h" +@@ -12,7 +12,7 @@ + #include + + +-long hailo_vdma_enable_channels_ioctl(struct hailo_vdma_controller *controller, unsigned long arg) ++long hailo_vdma_enable_channels_ioctl(struct hailo_vdma_controller *controller, unsigned long arg, struct hailo_vdma_file_context *context) + { + struct hailo_vdma_enable_channels_params input; + struct hailo_vdma_engine *engine = NULL; +@@ -40,12 +40,15 @@ long hailo_vdma_enable_channels_ioctl(st + hailo_vdma_update_interrupts_mask(controller, engine_index); + hailo_dev_info(controller->dev, "Enabled interrupts for engine %u, channels bitmap 0x%x\n", + engine_index, channels_bitmap); ++ ++ // Update the context with the enabled channels bitmap ++ context->enabled_channels_bitmap[engine_index] |= channels_bitmap; + } + + return 0; + } + +-long hailo_vdma_disable_channels_ioctl(struct hailo_vdma_controller *controller, unsigned long arg) ++long hailo_vdma_disable_channels_ioctl(struct hailo_vdma_controller *controller, unsigned long arg, struct hailo_vdma_file_context *context) + { + struct hailo_vdma_disable_channels_params input; + struct hailo_vdma_engine *engine = NULL; +@@ -77,6 +80,9 @@ long hailo_vdma_disable_channels_ioctl(s + + hailo_dev_info(controller->dev, "Disabled channels for engine %u, bitmap 0x%x\n", + engine_index, channels_bitmap); ++ ++ // Update the context with the disabled channels bitmap ++ context->enabled_channels_bitmap[engine_index] &= ~channels_bitmap; + } + + // Wake up threads waiting +@@ -204,7 +210,7 @@ long hailo_vdma_buffer_map_ioctl(struct + return -EFAULT; + } + +- hailo_dev_info(controller->dev, "address %lx tgid %d size: %zu\n", ++ hailo_dev_dbg(controller->dev, "address %lx tgid %d size: %zu\n", + buf_info.user_address, current->tgid, buf_info.size); + + direction = get_dma_direction(buf_info.data_direction); +@@ -231,7 +237,7 @@ long hailo_vdma_buffer_map_ioctl(struct + } + + list_add(&mapped_buffer->mapped_user_buffer_list, &context->mapped_user_buffer_list); +- hailo_dev_info(controller->dev, "buffer %lx (handle %zu) is mapped\n", ++ hailo_dev_dbg(controller->dev, "buffer %lx (handle %zu) is mapped\n", + buf_info.user_address, buf_info.mapped_handle); + return 0; + } +@@ -247,7 +253,7 @@ long hailo_vdma_buffer_unmap_ioctl(struc + return -EFAULT; + } + +- hailo_dev_info(controller->dev, "unmap user buffer handle %zu\n", buffer_unmap_params.mapped_handle); ++ hailo_dev_dbg(controller->dev, "unmap user buffer handle %zu\n", buffer_unmap_params.mapped_handle); + + mapped_buffer = hailo_vdma_find_mapped_user_buffer(context, buffer_unmap_params.mapped_handle); + if (mapped_buffer == NULL) { +--- a/drivers/media/pci/hailo/vdma/ioctl.h ++++ b/drivers/media/pci/hailo/vdma/ioctl.h +@@ -1,6 +1,6 @@ + // SPDX-License-Identifier: GPL-2.0 + /** +- * Copyright (c) 2019-2022 Hailo Technologies Ltd. All rights reserved. ++ * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. + **/ + + #ifndef _HAILO_VDMA_IOCTL_H_ +@@ -8,8 +8,8 @@ + + #include "vdma/vdma.h" + +-long hailo_vdma_enable_channels_ioctl(struct hailo_vdma_controller *controller, unsigned long arg); +-long hailo_vdma_disable_channels_ioctl(struct hailo_vdma_controller *controller, unsigned long arg); ++long hailo_vdma_enable_channels_ioctl(struct hailo_vdma_controller *controller, unsigned long arg, struct hailo_vdma_file_context *context); ++long hailo_vdma_disable_channels_ioctl(struct hailo_vdma_controller *controller, unsigned long arg, struct hailo_vdma_file_context *context); + long hailo_vdma_interrupts_wait_ioctl(struct hailo_vdma_controller *controller, unsigned long arg, + struct semaphore *mutex, bool *should_up_board_mutex); + +--- a/drivers/media/pci/hailo/vdma/memory.c ++++ b/drivers/media/pci/hailo/vdma/memory.c +@@ -1,11 +1,12 @@ + // SPDX-License-Identifier: GPL-2.0 + /** +- * Copyright (c) 2019-2022 Hailo Technologies Ltd. All rights reserved. ++ * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. + **/ + + #define pr_fmt(fmt) "hailo: " fmt + + #include "memory.h" ++#include "utils.h" + #include "utils/compact.h" + + #include +@@ -316,6 +317,11 @@ int hailo_desc_list_create(struct device + size_t buffer_size = 0; + const u64 align = VDMA_DESCRIPTOR_LIST_ALIGN; //First addr must be aligned on 64 KB (from the VDMA registers documentation) + ++ if (MAX_POWER_OF_2_VALUE < descriptors_count) { ++ dev_err(dev, "Invalid descriptors count %u\n", descriptors_count); ++ return -EINVAL; ++ } ++ + buffer_size = descriptors_count * sizeof(struct hailo_vdma_descriptor); + buffer_size = ALIGN(buffer_size, align); + +@@ -323,7 +329,7 @@ int hailo_desc_list_create(struct device + &descriptors->dma_address, GFP_KERNEL | __GFP_ZERO); + if (descriptors->kernel_address == NULL) { + dev_err(dev, "Failed to allocate descriptors list, desc_count 0x%x, buffer_size 0x%zx, This failure means there is not a sufficient amount of CMA memory " +- "(contiguous physical memory), This usually is caused by lack of general system memory. Please check you have sufficent memory.\n", ++ "(contiguous physical memory), This usually is caused by lack of general system memory. Please check you have sufficient memory.\n", + descriptors_count, buffer_size); + return -ENOMEM; + } +@@ -333,6 +339,8 @@ int hailo_desc_list_create(struct device + + descriptors->desc_list.desc_list = descriptors->kernel_address; + descriptors->desc_list.desc_count = descriptors_count; ++ // No need to check the return value of get_nearest_powerof_2 because we already checked the input ++ descriptors->desc_list.desc_count_mask = is_circular ? (descriptors_count - 1) : (get_nearest_powerof_2(descriptors_count) - 1); + descriptors->desc_list.desc_page_size = desc_page_size; + descriptors->desc_list.is_circular = is_circular; + +--- a/drivers/media/pci/hailo/vdma/memory.h ++++ b/drivers/media/pci/hailo/vdma/memory.h +@@ -1,6 +1,6 @@ + // SPDX-License-Identifier: GPL-2.0 + /** +- * Copyright (c) 2019-2022 Hailo Technologies Ltd. All rights reserved. ++ * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. + **/ + /** + * vDMA memory utility (including allocation and mappings) +--- a/drivers/media/pci/hailo/vdma/vdma.c ++++ b/drivers/media/pci/hailo/vdma/vdma.c +@@ -1,6 +1,6 @@ + // SPDX-License-Identifier: GPL-2.0 + /** +- * Copyright (c) 2019-2022 Hailo Technologies Ltd. All rights reserved. ++ * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. + **/ + + #define pr_fmt(fmt) "hailo: " fmt +@@ -105,6 +105,9 @@ void hailo_vdma_file_context_init(struct + INIT_LIST_HEAD(&context->descriptors_buffer_list); + INIT_LIST_HEAD(&context->vdma_low_memory_buffer_list); + INIT_LIST_HEAD(&context->continuous_buffer_list); ++ ++ BUILD_BUG_ON_MSG(MAX_VDMA_CHANNELS_PER_ENGINE > sizeof(context->enabled_channels_bitmap[0]) * BITS_IN_BYTE, ++ "Unexpected amount of VDMA channels per engine"); + } + + void hailo_vdma_update_interrupts_mask(struct hailo_vdma_controller *controller, +@@ -119,21 +122,22 @@ void hailo_vdma_file_context_finalize(st + { + size_t engine_index = 0; + struct hailo_vdma_engine *engine = NULL; +- const u32 channels_bitmap = 0xFFFFFFFF; // disable all channel interrupts + unsigned long irq_saved_flags = 0; + // In case of FLR, the vdma registers will be NULL + const bool is_device_up = (NULL != controller->dev); + +- if (filp == controller->used_by_filp) { +- for_each_vdma_engine(controller, engine, engine_index) { +- hailo_vdma_engine_disable_channels(engine, channels_bitmap); ++ for_each_vdma_engine(controller, engine, engine_index) { ++ if (context->enabled_channels_bitmap[engine_index]) { ++ hailo_dev_info(controller->dev, "Disabling channels for engine %zu, channels bitmap 0x%x\n", engine_index, ++ context->enabled_channels_bitmap[engine_index]); ++ hailo_vdma_engine_disable_channels(engine, context->enabled_channels_bitmap[engine_index]); + + if (is_device_up) { + hailo_vdma_update_interrupts_mask(controller, engine_index); + } + + spin_lock_irqsave(&controller->interrupts_lock, irq_saved_flags); +- hailo_vdma_engine_clear_channel_interrupts(engine, channels_bitmap); ++ hailo_vdma_engine_clear_channel_interrupts(engine, context->enabled_channels_bitmap[engine_index]); + spin_unlock_irqrestore(&controller->interrupts_lock, irq_saved_flags); + } + } +@@ -148,10 +152,21 @@ void hailo_vdma_file_context_finalize(st + } + } + ++void hailo_vdma_wakeup_interrupts(struct hailo_vdma_controller *controller, struct hailo_vdma_engine *engine, ++ u32 channels_bitmap) ++{ ++ unsigned long irq_saved_flags = 0; ++ ++ spin_lock_irqsave(&controller->interrupts_lock, irq_saved_flags); ++ hailo_vdma_engine_set_channel_interrupts(engine, channels_bitmap); ++ spin_unlock_irqrestore(&controller->interrupts_lock, irq_saved_flags); ++ ++ wake_up_interruptible_all(&controller->interrupts_wq); ++} ++ + void hailo_vdma_irq_handler(struct hailo_vdma_controller *controller, + size_t engine_index, u32 channels_bitmap) + { +- unsigned long irq_saved_flags = 0; + struct hailo_vdma_engine *engine = NULL; + + BUG_ON(engine_index >= controller->vdma_engines_count); +@@ -159,11 +174,7 @@ void hailo_vdma_irq_handler(struct hailo + + hailo_vdma_engine_push_timestamps(engine, channels_bitmap); + +- spin_lock_irqsave(&controller->interrupts_lock, irq_saved_flags); +- hailo_vdma_engine_set_channel_interrupts(engine, channels_bitmap); +- spin_unlock_irqrestore(&controller->interrupts_lock, irq_saved_flags); +- +- wake_up_interruptible_all(&controller->interrupts_wq); ++ hailo_vdma_wakeup_interrupts(controller, engine, channels_bitmap); + } + + long hailo_vdma_ioctl(struct hailo_vdma_file_context *context, struct hailo_vdma_controller *controller, +@@ -171,9 +182,9 @@ long hailo_vdma_ioctl(struct hailo_vdma_ + { + switch (cmd) { + case HAILO_VDMA_ENABLE_CHANNELS: +- return hailo_vdma_enable_channels_ioctl(controller, arg); ++ return hailo_vdma_enable_channels_ioctl(controller, arg, context); + case HAILO_VDMA_DISABLE_CHANNELS: +- return hailo_vdma_disable_channels_ioctl(controller, arg); ++ return hailo_vdma_disable_channels_ioctl(controller, arg, context); + case HAILO_VDMA_INTERRUPTS_WAIT: + return hailo_vdma_interrupts_wait_ioctl(controller, arg, mutex, should_up_board_mutex); + case HAILO_VDMA_INTERRUPTS_READ_TIMESTAMPS: +--- a/drivers/media/pci/hailo/vdma/vdma.h ++++ b/drivers/media/pci/hailo/vdma/vdma.h +@@ -1,6 +1,6 @@ + // SPDX-License-Identifier: GPL-2.0 + /** +- * Copyright (c) 2019-2022 Hailo Technologies Ltd. All rights reserved. ++ * Copyright (c) 2019-2024 Hailo Technologies Ltd. All rights reserved. + **/ + /** + * Hailo vdma engine definitions +@@ -130,6 +130,7 @@ struct hailo_vdma_file_context { + struct list_head descriptors_buffer_list; + struct list_head vdma_low_memory_buffer_list; + struct list_head continuous_buffer_list; ++ u32 enabled_channels_bitmap[MAX_VDMA_ENGINES]; + }; + + +@@ -145,6 +146,8 @@ void hailo_vdma_file_context_init(struct + void hailo_vdma_file_context_finalize(struct hailo_vdma_file_context *context, + struct hailo_vdma_controller *controller, struct file *filp); + ++void hailo_vdma_wakeup_interrupts(struct hailo_vdma_controller *controller, struct hailo_vdma_engine *engine, ++ u32 channels_bitmap); + void hailo_vdma_irq_handler(struct hailo_vdma_controller *controller, size_t engine_index, + u32 channels_bitmap); + diff --git a/target/linux/bcm27xx/patches-6.6/950-1398-dtoverlays-enable-SPI-CS-active-high.patch b/target/linux/bcm27xx/patches-6.6/950-1398-dtoverlays-enable-SPI-CS-active-high.patch new file mode 100644 index 00000000000000..ecd26a78b8324c --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1398-dtoverlays-enable-SPI-CS-active-high.patch @@ -0,0 +1,108 @@ +From dbf12796d1368286672529d7b03f81066a8c36f3 Mon Sep 17 00:00:00 2001 +From: Iker Pedrosa +Date: Mon, 18 Nov 2024 10:55:33 +0100 +Subject: [PATCH] dtoverlays: enable SPI CS active-high + +The documentation isn't very clear explaining how to enable SPI CS +active-high and it takes a long time to understand it. Adding a specific +overlay as a simple example on how to invert this signal can help +understand the solution. + +Link: https://forums.raspberrypi.com/viewtopic.php?t=378222 +Signed-off-by: Iker Pedrosa +--- + arch/arm/boot/dts/overlays/Makefile | 1 + + arch/arm/boot/dts/overlays/README | 8 +++ + .../overlays/spi0-1cs-inverted-overlay.dts | 59 +++++++++++++++++++ + 3 files changed, 68 insertions(+) + create mode 100644 arch/arm/boot/dts/overlays/spi0-1cs-inverted-overlay.dts + +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -259,6 +259,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ + spi-rtc.dtbo \ + spi0-0cs.dtbo \ + spi0-1cs.dtbo \ ++ spi0-1cs-inverted.dtbo \ + spi0-2cs.dtbo \ + spi1-1cs.dtbo \ + spi1-2cs.dtbo \ +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -4438,6 +4438,14 @@ Params: cs0_pin GPIO pin + it for other uses. + + ++Name: spi0-1cs-inverted ++Info: Only use one CS pin for SPI0 and set to active-high ++Load: dtoverlay=spi0-1cs-inverted,= ++Params: cs0_pin GPIO pin for CS0 (default 8) ++ no_miso Don't claim and use the MISO pin (9), freeing ++ it for other uses. ++ ++ + Name: spi0-2cs + Info: Change the CS pins for SPI0 + Load: dtoverlay=spi0-2cs,= +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi0-1cs-inverted-overlay.dts +@@ -0,0 +1,59 @@ ++/dts-v1/; ++/plugin/; ++ ++/* ++ * There are some devices that need an inverted Chip Select (CS) to select the ++ * device signal, as an example the AZDelivery 12864 display. That means that ++ * the CS polarity is active-high. To invert the CS signal the DT needs to set ++ * the cs-gpio to GPIO_ACTIVE_HIGH (0) in the controller and set the ++ * spi-cs-high in the peripheral property. On top of that, since this is a ++ * display the DT also needs to specify the write-only property. ++*/ ++ ++#include ++ ++/ { ++ compatible = "brcm,bcm2835"; ++ ++ fragment@0 { ++ target = <&spi0_cs_pins>; ++ frag0: __overlay__ { ++ brcm,pins = <8>; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spi0>; ++ frag1: __overlay__ { ++ cs-gpios = <&gpio 8 GPIO_ACTIVE_HIGH>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&spi0_pins>; ++ __dormant__ { ++ brcm,pins = <10 11>; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&spidev0>; ++ __overlay__ { ++ spi-cs-high; ++ }; ++ }; ++ ++ __overrides__ { ++ cs0_pin = <&frag0>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ no_miso = <0>,"=3"; ++ }; ++}; diff --git a/target/linux/bcm27xx/patches-6.6/950-1399-drm-vc4-hvs-Defer-updating-the-enable_bg_fill-until-.patch b/target/linux/bcm27xx/patches-6.6/950-1399-drm-vc4-hvs-Defer-updating-the-enable_bg_fill-until-.patch new file mode 100644 index 00000000000000..8f8af00c9fb9ec --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1399-drm-vc4-hvs-Defer-updating-the-enable_bg_fill-until-.patch @@ -0,0 +1,64 @@ +From 57b528e557890f25e010b6bc7356b5a716c79db2 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Tue, 12 Nov 2024 17:58:52 +0000 +Subject: [PATCH] drm/vc4: hvs: Defer updating the enable_bg_fill until vblank + +The register to enable/disable background fill was being set +from atomic flush, however that will be applied immediately and +can be a while before the vblank. If it was required for the +current frame but not for the next one, that can result in +corruption for part of the current frame. + +Store the state in vc4_hvs, and update it on vblank. + +Signed-off-by: Dave Stevenson +--- + drivers/gpu/drm/vc4/vc4_drv.h | 2 ++ + drivers/gpu/drm/vc4/vc4_hvs.c | 18 ++++++++++-------- + 2 files changed, 12 insertions(+), 8 deletions(-) + +--- a/drivers/gpu/drm/vc4/vc4_drv.h ++++ b/drivers/gpu/drm/vc4/vc4_drv.h +@@ -339,6 +339,8 @@ struct vc4_hvs { + unsigned int enabled: 1; + } eof_irq[HVS_NUM_CHANNELS]; + ++ bool bg_fill[HVS_NUM_CHANNELS]; ++ + unsigned long max_core_rate; + + /* Memory manager for CRTCs to allocate space in the display +--- a/drivers/gpu/drm/vc4/vc4_hvs.c ++++ b/drivers/gpu/drm/vc4/vc4_hvs.c +@@ -1470,14 +1470,7 @@ void vc4_hvs_atomic_flush(struct drm_crt + /* This sets a black background color fill, as is the case + * with other DRM drivers. + */ +- if (enable_bg_fill) +- HVS_WRITE(SCALER6_DISPX_CTRL1(channel), +- HVS_READ(SCALER6_DISPX_CTRL1(channel)) | +- SCALER6(DISPX_CTRL1_BGENB)); +- else +- HVS_WRITE(SCALER6_DISPX_CTRL1(channel), +- HVS_READ(SCALER6_DISPX_CTRL1(channel)) & +- ~SCALER6(DISPX_CTRL1_BGENB)); ++ hvs->bg_fill[channel] = enable_bg_fill; + } else { + /* we can actually run with a lower core clock when background + * fill is enabled on VC4_GEN_5 so leave it enabled always. +@@ -1662,6 +1655,15 @@ static irqreturn_t vc6_hvs_eof_irq_handl + if (hvs->eof_irq[i].desc != irq) + continue; + ++ if (hvs->bg_fill[i]) ++ HVS_WRITE(SCALER6_DISPX_CTRL1(i), ++ HVS_READ(SCALER6_DISPX_CTRL1(i)) | ++ SCALER6(DISPX_CTRL1_BGENB)); ++ else ++ HVS_WRITE(SCALER6_DISPX_CTRL1(i), ++ HVS_READ(SCALER6_DISPX_CTRL1(i)) & ++ ~SCALER6(DISPX_CTRL1_BGENB)); ++ + vc4_hvs_schedule_dlist_sweep(hvs, i); + return IRQ_HANDLED; + } diff --git a/target/linux/bcm27xx/patches-6.6/950-1359-misc-rp1-pio-Add-FIFO.patch b/target/linux/bcm27xx/patches-6.6/950-1400-misc-rp1-pio-Add-FIFO-related-methods.patch similarity index 98% rename from target/linux/bcm27xx/patches-6.6/950-1359-misc-rp1-pio-Add-FIFO.patch rename to target/linux/bcm27xx/patches-6.6/950-1400-misc-rp1-pio-Add-FIFO-related-methods.patch index fff033f5a6b7df..da21526c21c217 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1359-misc-rp1-pio-Add-FIFO.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1400-misc-rp1-pio-Add-FIFO-related-methods.patch @@ -27,7 +27,7 @@ Signed-off-by: Phil Elwell --- a/drivers/misc/rp1-pio.c +++ b/drivers/misc/rp1-pio.c -@@ -479,6 +479,28 @@ int rp1_pio_sm_set_dmactrl(struct rp1_pi +@@ -476,6 +476,28 @@ int rp1_pio_sm_set_dmactrl(struct rp1_pi } EXPORT_SYMBOL_GPL(rp1_pio_sm_set_dmactrl); @@ -56,7 +56,7 @@ Signed-off-by: Phil Elwell int rp1_pio_gpio_init(struct rp1_pio_client *client, void *param) { struct rp1_gpio_init_args *args = param; -@@ -851,6 +873,8 @@ struct handler_info { +@@ -848,6 +870,8 @@ struct handler_info { HANDLER(SM_PUT, sm_put), HANDLER(SM_GET, sm_get), HANDLER(SM_SET_DMACTRL, sm_set_dmactrl), diff --git a/target/linux/bcm27xx/patches-6.6/950-1401-overlays-Enable-Raspberry-Touch-2-rotation-with-over.patch b/target/linux/bcm27xx/patches-6.6/950-1401-overlays-Enable-Raspberry-Touch-2-rotation-with-over.patch new file mode 100644 index 00000000000000..1a709577ebf3f0 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1401-overlays-Enable-Raspberry-Touch-2-rotation-with-over.patch @@ -0,0 +1,31 @@ +From fa6ad4bcad4e8db18493a4af640b4b5c95434e70 Mon Sep 17 00:00:00 2001 +From: Just a nerd <157698061+foonerd@users.noreply.github.com> +Date: Wed, 20 Nov 2024 14:08:48 +0000 +Subject: [PATCH] overlays: Enable Raspberry Touch 2 rotation with overlay + +See: https://github.com/raspberrypi/linux/pull/6480 +Signed-off-by: foonerd +--- + arch/arm/boot/dts/overlays/README | 1 + + arch/arm/boot/dts/overlays/vc4-kms-dsi-ili9881-7inch-overlay.dts | 1 + + 2 files changed, 2 insertions(+) + +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -5249,6 +5249,7 @@ Params: sizex Touchscr + invy Touchscreen inverted y axis + swapxy Touchscreen swapped x y axis + disable_touch Disables the touch screen overlay driver ++ rotation Display rotation {0,90,180,270} (default 0) + dsi0 Use DSI0 and i2c_csi_dsi0 (rather than + the default DSI1 and i2c_csi_dsi). + +--- a/arch/arm/boot/dts/overlays/vc4-kms-dsi-ili9881-7inch-overlay.dts ++++ b/arch/arm/boot/dts/overlays/vc4-kms-dsi-ili9881-7inch-overlay.dts +@@ -118,5 +118,6 @@ + invy = <0>, "+11"; + swapxy = <>911>,"touchscreen-swapped-x-y?"; + disable_touch = <>911>, "status=disabled"; ++ rotation = <&dsi_panel>, "rotation:0"; + }; + }; diff --git a/target/linux/bcm27xx/patches-6.6/950-1357-rpi-pio-add-missing.patch b/target/linux/bcm27xx/patches-6.6/950-1402-rp1-pio-Add-missing-static-inline-s.patch similarity index 88% rename from target/linux/bcm27xx/patches-6.6/950-1357-rpi-pio-add-missing.patch rename to target/linux/bcm27xx/patches-6.6/950-1402-rp1-pio-Add-missing-static-inline-s.patch index c871fa681f717a..643e83b314ac2d 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1357-rpi-pio-add-missing.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1402-rp1-pio-Add-missing-static-inline-s.patch @@ -13,7 +13,7 @@ Signed-off-by: Phil Elwell --- a/include/linux/pio_rp1.h +++ b/include/linux/pio_rp1.h -@@ -245,7 +245,7 @@ static inline bool pio_can_add_program_a +@@ -247,7 +247,7 @@ static inline bool pio_can_add_program_a return !rp1_pio_can_add_program(client, &args); } @@ -22,7 +22,7 @@ Signed-off-by: Phil Elwell { struct rp1_pio_add_program_args args; int offset; -@@ -365,7 +365,7 @@ static inline int pio_sm_set_config(stru +@@ -367,7 +367,7 @@ static inline int pio_sm_set_config(stru return rp1_pio_sm_set_config(client, &args); } @@ -31,7 +31,7 @@ Signed-off-by: Phil Elwell { struct rp1_pio_sm_exec_args args = { .sm = sm, .instr = instr, .blocking = false }; -@@ -375,7 +375,7 @@ int pio_sm_exec(struct rp1_pio_client *c +@@ -377,7 +377,7 @@ int pio_sm_exec(struct rp1_pio_client *c return rp1_pio_sm_exec(client, &args); } diff --git a/target/linux/bcm27xx/patches-6.6/950-1358-misc-rpi-pio-back-port-some.patch b/target/linux/bcm27xx/patches-6.6/950-1403-misc-rp1-pio-Back-port-some-6.11-build-fixes.patch similarity index 100% rename from target/linux/bcm27xx/patches-6.6/950-1358-misc-rpi-pio-back-port-some.patch rename to target/linux/bcm27xx/patches-6.6/950-1403-misc-rp1-pio-Back-port-some-6.11-build-fixes.patch diff --git a/target/linux/bcm27xx/patches-6.6/950-1404-Adding-Pimidi-kernel-module.patch b/target/linux/bcm27xx/patches-6.6/950-1404-Adding-Pimidi-kernel-module.patch new file mode 100644 index 00000000000000..fd46f25c202ac6 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1404-Adding-Pimidi-kernel-module.patch @@ -0,0 +1,1167 @@ +From 8a6f640708627ac8ebf79f88793038933f169198 Mon Sep 17 00:00:00 2001 +From: Giedrius +Date: Thu, 21 Nov 2024 08:04:02 +0000 +Subject: [PATCH] Adding Pimidi kernel module. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Giedrius Trainavičius +--- + sound/drivers/Kconfig | 10 + + sound/drivers/Makefile | 2 + + sound/drivers/pimidi.c | 1113 ++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 1125 insertions(+) + create mode 100644 sound/drivers/pimidi.c + +--- a/sound/drivers/Kconfig ++++ b/sound/drivers/Kconfig +@@ -263,4 +263,14 @@ config SND_AC97_POWER_SAVE_DEFAULT + + See SND_AC97_POWER_SAVE for more details. + ++config SND_PIMIDI ++ tristate "Pimidi driver" ++ depends on SND_SEQUENCER && CRC8 ++ select SND_RAWMIDI ++ help ++ Say Y here to include support for Blokas Pimidi. ++ ++ To compile this driver as a module, choose M here: the module ++ will be called snd-pimidi. ++ + endif # SND_DRIVERS +--- a/sound/drivers/Makefile ++++ b/sound/drivers/Makefile +@@ -9,6 +9,7 @@ snd-aloop-objs := aloop.o + snd-mtpav-objs := mtpav.o + snd-mts64-objs := mts64.o + snd-pcmtest-objs := pcmtest.o ++snd-pimidi-objs := pimidi.o + snd-portman2x4-objs := portman2x4.o + snd-serial-u16550-objs := serial-u16550.o + snd-serial-generic-objs := serial-generic.o +@@ -23,6 +24,7 @@ obj-$(CONFIG_SND_SERIAL_U16550) += snd-s + obj-$(CONFIG_SND_SERIAL_GENERIC) += snd-serial-generic.o + obj-$(CONFIG_SND_MTPAV) += snd-mtpav.o + obj-$(CONFIG_SND_MTS64) += snd-mts64.o ++obj-$(CONFIG_SND_PIMIDI) += snd-pimidi.o + obj-$(CONFIG_SND_PORTMAN2X4) += snd-portman2x4.o + + obj-$(CONFIG_SND) += opl3/ opl4/ mpu401/ vx/ pcsp/ +--- /dev/null ++++ b/sound/drivers/pimidi.c +@@ -0,0 +1,1113 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * Pimidi Linux kernel module. ++ * Copyright (C) 2017-2024 Vilniaus Blokas UAB, https://blokas.io/ ++ * ++ * 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; version 2 of the ++ * License. ++ * ++ * This program 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. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++ ++#define PIMIDI_LOG_IMPL(instance, log_func, msg, ...) log_func("pimidi(%s)[%c]: " msg "\n", \ ++ __func__, (instance) ? (instance)->d + '0' : 'G', ## __VA_ARGS__) ++ ++#ifdef PIMIDI_DEBUG ++# define printd(instance, ...) PIMIDI_LOG_IMPL(instance, pr_alert, __VA_ARGS__) ++# define printd_rl(instance, ...) PIMIDI_LOG_IMPL(instance, pr_alert_ratelimited, __VA_ARGS__) ++# define printd_g(...) printd((struct pimidi_instance *)NULL, __VA_ARGS__) ++#else ++# define printd(instance, ...) do {} while (0) ++# define printd_rl(instance, ...) do {} while (0) ++# define printd_g(...) do {} while (0) ++#endif ++ ++#define printe(instance, ...) PIMIDI_LOG_IMPL(instance, pr_err, __VA_ARGS__) ++#define printe_rl(instance, ...) PIMIDI_LOG_IMPL(instance, pr_err_ratelimited, __VA_ARGS__) ++#define printi(instance, ...) PIMIDI_LOG_IMPL(instance, pr_info, __VA_ARGS__) ++#define printw(instance, ...) PIMIDI_LOG_IMPL(instance, pr_warn, __VA_ARGS__) ++#define printw_rl(instance, ...) PIMIDI_LOG_IMPL(instance, pr_warn_ratelimited, __VA_ARGS__) ++ ++#define printe_g(...) printe((struct pimidi_instance *)NULL, __VA_ARGS__) ++#define printi_g(...) printi((struct pimidi_instance *)NULL, __VA_ARGS__) ++ ++DECLARE_CRC8_TABLE(pimidi_crc8_table); ++enum { PIMIDI_CRC8_POLYNOMIAL = 0x83 }; ++enum { PIMIDI_MAX_DEVICES = 4 }; ++enum { PIMIDI_MAX_PACKET_SIZE = 17 }; ++enum { PIMIDI_PORTS = 2 }; ++ ++struct pimidi_shared { ++ // lock protects the shared reset_gpio and devices list. ++ struct mutex lock; ++ struct gpio_desc *reset_gpio; ++ struct workqueue_struct *work_queue; ++ struct list_head devices; ++}; ++ ++static struct pimidi_shared pimidi_global = { ++ .devices = LIST_HEAD_INIT(pimidi_global.devices), ++}; ++ ++struct pimidi_version_t { ++ u8 hwrev; ++ u8 major; ++ u8 minor; ++ u8 build; ++}; ++ ++enum { PIMIDI_IN_FIFO_SIZE = 4096 }; ++ ++struct pimidi_midi_port { ++ // in_lock protects the input substream. ++ struct mutex in_lock; ++ // out_lock protects the output substream. ++ struct mutex out_lock; ++ DECLARE_KFIFO(in_fifo, uint8_t, PIMIDI_IN_FIFO_SIZE); ++ unsigned int last_output_at; ++ unsigned int output_buffer_used_in_millibytes; ++ struct work_struct in_handler; ++ struct delayed_work out_handler; ++ unsigned long enabled_streams; ++ unsigned int tx_cnt; ++ unsigned int rx_cnt; ++}; ++ ++struct pimidi_instance { ++ struct list_head list; ++ struct i2c_client *i2c_client; ++ struct pimidi_version_t version; ++ char serial[11]; ++ char d; ++ struct gpio_desc *data_ready_gpio; ++ ++ struct work_struct drdy_handler; ++ ++ // comm_lock serializes I2C communication. ++ struct mutex comm_lock; ++ char *rx_buf; ++ size_t rx_len; ++ int rx_status; ++ struct completion *rx_completion; ++ ++ struct snd_rawmidi *rawmidi; ++ struct pimidi_midi_port midi_port[PIMIDI_PORTS]; ++ bool stopping; ++}; ++ ++static struct snd_rawmidi_substream *pimidi_find_substream(struct snd_rawmidi *rawmidi, ++ int stream, ++ int number ++ ) ++{ ++ struct snd_rawmidi_substream *substream; ++ ++ list_for_each_entry(substream, &rawmidi->streams[stream].substreams, list) { ++ if (substream->number == number) ++ return substream; ++ } ++ return NULL; ++} ++ ++static void pimidi_midi_in_handler(struct pimidi_instance *instance, int port) ++{ ++ int i, n, err; ++ ++ printd(instance, "(%d)", port); ++ ++ struct pimidi_midi_port *midi_port = &instance->midi_port[port]; ++ ++ if (!test_bit(SNDRV_RAWMIDI_STREAM_INPUT, &midi_port->enabled_streams)) { ++ printd(instance, "Input not enabled for %d", port); ++ return; ++ } ++ ++ u8 data[512]; ++ ++ n = kfifo_out_peek(&midi_port->in_fifo, data, sizeof(data)); ++ printd(instance, "Peeked %d MIDI bytes", n); ++ ++ mutex_lock(&midi_port->in_lock); ++ struct snd_rawmidi_substream *substream = ++ pimidi_find_substream(instance->rawmidi, ++ SNDRV_RAWMIDI_STREAM_INPUT, ++ port); ++ ++ err = snd_rawmidi_receive(substream, data, n); ++ if (err > 0) ++ midi_port->rx_cnt += err; ++ mutex_unlock(&midi_port->in_lock); ++ ++ for (i = 0; i < err; ++i) ++ kfifo_skip(&midi_port->in_fifo); ++ ++ if (n != err) ++ printw_rl(instance, ++ "Not all MIDI data consumed for port %d: %d / %d", port, err, n); ++ ++ if (!kfifo_is_empty(&midi_port->in_fifo) && !instance->stopping) ++ queue_work(pimidi_global.work_queue, &midi_port->in_handler); ++ ++ printd(instance, "Done"); ++} ++ ++static void pimidi_midi_in_handler_0(struct work_struct *work) ++{ ++ pimidi_midi_in_handler(container_of(work, struct pimidi_instance, midi_port[0].in_handler), ++ 0); ++} ++ ++static void pimidi_midi_in_handler_1(struct work_struct *work) ++{ ++ pimidi_midi_in_handler(container_of(work, struct pimidi_instance, midi_port[1].in_handler), ++ 1); ++} ++ ++static void pimidi_midi_out_handler(struct pimidi_instance *instance, int port) ++{ ++ printd(instance, "(%d)", port); ++ if (!test_bit(SNDRV_RAWMIDI_STREAM_OUTPUT, &instance->midi_port[port].enabled_streams)) { ++ printd(instance, "Output not enabled for %d", port); ++ return; ++ } ++ ++ struct pimidi_midi_port *midi_port = &instance->midi_port[port]; ++ ++ struct snd_rawmidi_substream *substream = ++ pimidi_find_substream(instance->rawmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, port); ++ ++ mutex_lock(&midi_port->out_lock); ++ ++ enum { MIDI_MILLI_BYTES_PER_JIFFY = 3125000 / HZ }; ++ enum { MIDI_MAX_OUTPUT_BUFFER_SIZE_IN_MILLIBYTES = ++ (512 - PIMIDI_MAX_PACKET_SIZE - 1) * 1000 }; ++ ++ unsigned int now = jiffies; ++ unsigned int millibytes_became_available = ++ (MIDI_MILLI_BYTES_PER_JIFFY) * (now - midi_port->last_output_at); ++ ++ midi_port->output_buffer_used_in_millibytes = ++ midi_port->output_buffer_used_in_millibytes <= ++ millibytes_became_available ? 0 : midi_port->output_buffer_used_in_millibytes - ++ millibytes_became_available; ++ ++ unsigned int output_buffer_available = ++ (MIDI_MAX_OUTPUT_BUFFER_SIZE_IN_MILLIBYTES ++ - midi_port->output_buffer_used_in_millibytes) ++ / 1000; ++ ++ u8 buffer[PIMIDI_MAX_PACKET_SIZE]; ++ int n, batch, err; ++ ++ for (batch = 0; batch < 3; ++batch) { ++ if (output_buffer_available == 0) ++ printd(instance, "Buffer full"); ++ ++ printd(instance, "Buffer available: %u (%u +%u, %u -> %u, dt %u) (%u) @ %u", ++ output_buffer_available, midi_port->output_buffer_used_in_millibytes, ++ millibytes_became_available, midi_port->last_output_at, now, ++ now - midi_port->last_output_at, midi_port->tx_cnt, HZ); ++ midi_port->last_output_at = now; ++ ++ n = output_buffer_available ++ ? snd_rawmidi_transmit_peek(substream, buffer + 1, ++ min(output_buffer_available, ++ sizeof(buffer) - 2)) ++ : 0; ++ if (n > 0) { ++ printd(instance, "Peeked: %d", n); ++ snd_rawmidi_transmit_ack(substream, n); ++ ++ buffer[0] = (port << 4) | n; ++ buffer[n + 1] = ~crc8(pimidi_crc8_table, buffer, n + 1, CRC8_INIT_VALUE); ++ ++#ifdef PIMIDI_DEBUG ++ pr_debug("%s[%d]: Sending %d bytes:", __func__, instance->d, n + 2); ++ int i; ++ ++ for (i = 0; i < n + 2; ++i) ++ pr_cont(" %02x", buffer[i]); ++ ++ pr_cont("\n"); ++#endif ++ mutex_lock(&instance->comm_lock); ++ err = i2c_master_send(instance->i2c_client, buffer, n + 2); ++ mutex_unlock(&instance->comm_lock); ++ ++ if (err < 0) { ++ printe(instance, ++ "Error occurred when sending MIDI data over I2C! (%d)", ++ err); ++ goto cleanup; ++ } ++ ++ midi_port->tx_cnt += n; ++ midi_port->output_buffer_used_in_millibytes += n * 1000; ++ output_buffer_available -= n; ++ } else if (n < 0) { ++ err = n; ++ printe(instance, "snd_rawmidi_transmit_peek returned error %d!", err); ++ goto cleanup; ++ } else { ++ break; ++ } ++ } ++ ++ printd(instance, "Checking if empty %p", substream); ++ if (!snd_rawmidi_transmit_empty(substream) && !instance->stopping) { ++ unsigned int delay = 1; ++ ++ if (output_buffer_available == 0) ++ delay = 125000 / MIDI_MILLI_BYTES_PER_JIFFY; ++ printd(instance, "Queue more work after %u jiffies", delay); ++ mod_delayed_work(pimidi_global.work_queue, &midi_port->out_handler, delay); ++ } ++ ++cleanup: ++ mutex_unlock(&midi_port->out_lock); ++ printd(instance, "Done"); ++} ++ ++static void pimidi_midi_out_handler_0(struct work_struct *work) ++{ ++ pimidi_midi_out_handler(container_of(work, struct pimidi_instance, ++ midi_port[0].out_handler.work), 0); ++} ++ ++static void pimidi_midi_out_handler_1(struct work_struct *work) ++{ ++ pimidi_midi_out_handler(container_of(work, struct pimidi_instance, ++ midi_port[1].out_handler.work), 1); ++} ++ ++static void pimidi_midi_output_trigger(struct snd_rawmidi_substream *substream, int up) ++{ ++ struct pimidi_instance *instance = substream->rmidi->private_data; ++ ++ printd(instance, "(%d, %d, %d)", substream->stream, substream->number, up); ++ ++ if (up == 0) { ++ clear_bit(substream->stream, ++ &instance->midi_port[substream->number].enabled_streams); ++ } else { ++ set_bit(substream->stream, ++ &instance->midi_port[substream->number].enabled_streams); ++ if (!delayed_work_pending(&instance->midi_port[substream->number].out_handler)) { ++ printd(instance, "Queueing work"); ++ queue_delayed_work(pimidi_global.work_queue, ++ &instance->midi_port[substream->number].out_handler, 0); ++ } ++ } ++} ++ ++static void pimidi_midi_output_drain(struct snd_rawmidi_substream *substream) ++{ ++ struct pimidi_instance *instance = substream->rmidi->private_data; ++ ++ printd(instance, "(%d, %d)", substream->stream, substream->number); ++ ++ printd(instance, "Begin draining!"); ++ ++ queue_delayed_work(pimidi_global.work_queue, ++ &instance->midi_port[substream->number].out_handler, 0); ++ ++ unsigned long deadline = jiffies + 5 * HZ; ++ ++ do { ++ printd(instance, "Before flush"); ++ while (delayed_work_pending(&instance->midi_port[substream->number].out_handler)) ++ flush_delayed_work(&instance->midi_port[substream->number].out_handler); ++ printd(instance, "Flushed"); ++ } while (!snd_rawmidi_transmit_empty(substream) && time_before(jiffies, deadline)); ++ ++ printd(instance, "Done!"); ++} ++ ++static int pimidi_midi_output_close(struct snd_rawmidi_substream *substream) ++{ ++ struct pimidi_instance *instance = substream->rmidi->private_data; ++ struct pimidi_midi_port *midi_port = &instance->midi_port[substream->number]; ++ ++ mutex_lock(&midi_port->out_lock); ++ clear_bit(substream->stream, &midi_port->enabled_streams); ++ mutex_unlock(&midi_port->out_lock); ++ return 0; ++} ++ ++static int pimidi_midi_input_close(struct snd_rawmidi_substream *substream) ++{ ++ struct pimidi_instance *instance = substream->rmidi->private_data; ++ struct pimidi_midi_port *midi_port = &instance->midi_port[substream->number]; ++ ++ mutex_lock(&midi_port->in_lock); ++ clear_bit(substream->stream, &midi_port->enabled_streams); ++ mutex_unlock(&midi_port->in_lock); ++ return 0; ++} ++ ++static void pimidi_midi_input_trigger(struct snd_rawmidi_substream *substream, int up) ++{ ++ struct pimidi_instance *instance = substream->rmidi->private_data; ++ ++ printd(instance, "(%d, %d, %d)", substream->stream, substream->number, up); ++ ++ if (up == 0) { ++ clear_bit(substream->stream, ++ &instance->midi_port[substream->number].enabled_streams); ++ cancel_work_sync(&instance->midi_port[substream->number].in_handler); ++ } else { ++ set_bit(substream->stream, ++ &instance->midi_port[substream->number].enabled_streams); ++ if (!instance->stopping) ++ queue_work(pimidi_global.work_queue, ++ &instance->midi_port[substream->number].in_handler); ++ } ++} ++ ++static void pimidi_get_port_info(struct snd_rawmidi *rmidi, int number, ++ struct snd_seq_port_info *seq_port_info) ++{ ++ printd_g("%p, %d, %p", rmidi, number, seq_port_info); ++ seq_port_info->type = ++ SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC | ++ SNDRV_SEQ_PORT_TYPE_HARDWARE | ++ SNDRV_SEQ_PORT_TYPE_PORT; ++ strscpy(seq_port_info->name, number == 0 ? "a" : "b", ++ sizeof(seq_port_info->name)); ++ seq_port_info->midi_voices = 0; ++} ++ ++static const struct snd_rawmidi_global_ops pimidi_midi_ops = { ++ .get_port_info = pimidi_get_port_info, ++}; ++ ++static int pimidi_midi_open(struct snd_rawmidi_substream *substream) ++{ ++ printd_g("(%p) stream=%d number=%d", substream, substream->stream, substream->number); ++ return 0; ++} ++ ++static const struct snd_rawmidi_ops pimidi_midi_output_ops = { ++ .open = pimidi_midi_open, ++ .close = pimidi_midi_output_close, ++ .trigger = pimidi_midi_output_trigger, ++ .drain = pimidi_midi_output_drain, ++}; ++ ++static const struct snd_rawmidi_ops pimidi_midi_input_ops = { ++ .open = pimidi_midi_open, ++ .close = pimidi_midi_input_close, ++ .trigger = pimidi_midi_input_trigger, ++}; ++ ++static int pimidi_register(struct pimidi_instance *instance) ++{ ++ int err = 0; ++ ++ mutex_lock(&pimidi_global.lock); ++ printd(instance, "Registering..."); ++ if (!pimidi_global.reset_gpio) { ++ printd_g("Getting reset pin."); ++ pimidi_global.reset_gpio = gpiod_get(&instance->i2c_client->dev, "reset", ++ GPIOD_OUT_LOW); ++ if (IS_ERR(pimidi_global.reset_gpio)) { ++ err = PTR_ERR(pimidi_global.reset_gpio); ++ printe_g("gpiod_get failed: %d", err); ++ pimidi_global.reset_gpio = NULL; ++ mutex_unlock(&pimidi_global.lock); ++ return err; ++ } ++ } ++ list_add_tail(&instance->list, &pimidi_global.devices); ++ mutex_unlock(&pimidi_global.lock); ++ return err; ++} ++ ++static void pimidi_unregister(struct pimidi_instance *instance) ++{ ++ mutex_lock(&pimidi_global.lock); ++ printd(instance, "Unregistering..."); ++ list_del(&instance->list); ++ if (list_empty(&pimidi_global.devices)) { ++ printd_g("Releasing reset pin"); ++ gpiod_put(pimidi_global.reset_gpio); ++ pimidi_global.reset_gpio = NULL; ++ } ++ mutex_unlock(&pimidi_global.lock); ++} ++ ++static void pimidi_perform_reset(void) ++{ ++ mutex_lock(&pimidi_global.lock); ++ ++ printd_g("Performing reset."); ++ ++ struct list_head *p; ++ ++ list_for_each(p, &pimidi_global.devices) { ++ struct pimidi_instance *instance = list_entry(p, struct pimidi_instance, list); ++ ++ printd(instance, "Pausing..."); ++ instance->stopping = true; ++ disable_irq(instance->i2c_client->irq); ++ cancel_work(&instance->drdy_handler); ++ ++ int i; ++ ++ for (i = 0; i < PIMIDI_PORTS; ++i) { ++ cancel_work(&instance->midi_port[i].in_handler); ++ cancel_delayed_work(&instance->midi_port[i].out_handler); ++ } ++ ++ drain_workqueue(pimidi_global.work_queue); ++ } ++ ++ printd_g("Reset = low"); ++ gpiod_set_value(pimidi_global.reset_gpio, 1); ++ ++ list_for_each(p, &pimidi_global.devices) { ++ struct pimidi_instance *instance = list_entry(p, struct pimidi_instance, list); ++ ++ if (gpiod_is_active_low(instance->data_ready_gpio)) ++ gpiod_toggle_active_low(instance->data_ready_gpio); ++ gpiod_direction_output(instance->data_ready_gpio, 1); ++ printd(instance, "DRDY high"); ++ } ++ ++ usleep_range(1000, 5000); ++ printd_g("Reset = high"); ++ gpiod_set_value(pimidi_global.reset_gpio, 0); ++ msleep(30); ++ ++ int i; ++ ++ for (i = 0; i < PIMIDI_MAX_DEVICES; ++i) { ++ usleep_range(1000, 3000); ++ list_for_each(p, &pimidi_global.devices) { ++ struct pimidi_instance *instance = list_entry(p, struct pimidi_instance, ++ list); ++ ++ if (instance->d < i) ++ continue; ++ printd(instance, "DRDY -> %d", !gpiod_get_value(instance->data_ready_gpio)); ++ gpiod_set_value(instance->data_ready_gpio, ++ !gpiod_get_value(instance->data_ready_gpio)); ++ } ++ } ++ usleep_range(16000, 20000); ++ ++ list_for_each(p, &pimidi_global.devices) { ++ struct pimidi_instance *instance = list_entry(p, struct pimidi_instance, list); ++ ++ if (!gpiod_is_active_low(instance->data_ready_gpio)) ++ gpiod_toggle_active_low(instance->data_ready_gpio); ++ ++ printd(instance, "DRDY input"); ++ gpiod_direction_input(instance->data_ready_gpio); ++ ++ printd(instance, "Resume..."); ++ instance->stopping = false; ++ enable_irq(instance->i2c_client->irq); ++ } ++ ++ printd_g("Reset done."); ++ usleep_range(16000, 20000); ++ ++ mutex_unlock(&pimidi_global.lock); ++} ++ ++static int pimidi_read_version(struct pimidi_version_t *version, struct pimidi_instance *instance) ++{ ++ memset(version, 0, sizeof(*version)); ++ ++ const char cmd[4] = { 0xb2, 0x01, 0x01, 0x95 }; ++ ++ char result[9]; ++ ++ memset(result, 0, sizeof(result)); ++ ++ DECLARE_COMPLETION_ONSTACK(done); ++ ++ mutex_lock(&instance->comm_lock); ++ int err = i2c_master_send(instance->i2c_client, cmd, sizeof(cmd)); ++ ++ if (err < 0) { ++ mutex_unlock(&instance->comm_lock); ++ return err; ++ } ++ instance->rx_buf = result; ++ instance->rx_len = sizeof(result); ++ instance->rx_completion = &done; ++ mutex_unlock(&instance->comm_lock); ++ ++ printd(instance, "Waiting for drdy"); ++ wait_for_completion_io_timeout(&done, msecs_to_jiffies(1000u)); ++ printd(instance, "Done waiting"); ++ ++ if (!completion_done(&done)) { ++ mutex_lock(&instance->comm_lock); ++ instance->rx_buf = NULL; ++ instance->rx_len = 0; ++ instance->rx_status = -ETIMEDOUT; ++ instance->rx_completion = NULL; ++ mutex_unlock(&instance->comm_lock); ++ return -ETIMEDOUT; ++ } ++ ++ if (CRC8_GOOD_VALUE(pimidi_crc8_table) != crc8(pimidi_crc8_table, result, sizeof(result), ++ CRC8_INIT_VALUE)) ++ return -EIO; ++ ++ const char expected[4] = { 0xb7, 0x81, 0x01, 0x00 }; ++ ++ if (memcmp(result, expected, sizeof(expected)) != 0) ++ return -EPROTO; ++ ++ u32 v = ntohl(*(uint32_t *)(result + 4)); ++ ++ version->hwrev = v >> 24; ++ version->major = (v & 0x00ff0000) >> 16; ++ version->minor = (v & 0x0000ff00) >> 8; ++ version->build = v & 0x000000ff; ++ ++ return 0; ++} ++ ++static int pimidi_read_serial(char serial[11], struct pimidi_instance *instance) ++{ ++ memset(serial, 0, sizeof(char[11])); ++ ++ const char cmd[4] = { 0xb2, 0x03, 0x04, 0x97 }; ++ ++ char result[PIMIDI_MAX_PACKET_SIZE]; ++ ++ memset(result, 0, sizeof(result)); ++ ++ DECLARE_COMPLETION_ONSTACK(done); ++ ++ mutex_lock(&instance->comm_lock); ++ int err = i2c_master_send(instance->i2c_client, cmd, sizeof(cmd)); ++ ++ if (err < 0) { ++ mutex_unlock(&instance->comm_lock); ++ return err; ++ } ++ instance->rx_buf = result; ++ instance->rx_len = sizeof(result); ++ instance->rx_completion = &done; ++ mutex_unlock(&instance->comm_lock); ++ ++ printd(instance, "Waiting for drdy"); ++ wait_for_completion_io_timeout(&done, msecs_to_jiffies(1000u)); ++ printd(instance, "Done waiting"); ++ ++ if (!completion_done(&done)) { ++ mutex_lock(&instance->comm_lock); ++ instance->rx_buf = NULL; ++ instance->rx_len = 0; ++ instance->rx_status = -ETIMEDOUT; ++ instance->rx_completion = NULL; ++ mutex_unlock(&instance->comm_lock); ++ printe(instance, "Timed out"); ++ return -ETIMEDOUT; ++ } ++ ++ if (CRC8_GOOD_VALUE(pimidi_crc8_table) != crc8(pimidi_crc8_table, result, ++ (result[0] & 0x0f) + 2, CRC8_INIT_VALUE)) ++ return -EIO; ++ ++ const char expected[4] = { 0xbd, 0x83, 0x04, 0x0a }; ++ ++ if (memcmp(result, expected, sizeof(expected)) != 0) { ++ printe(instance, "Unexpected response: %02x %02x %02x %02x", result[0], result[1], ++ result[2], result[3]); ++ return -EPROTO; ++ } ++ ++ memcpy(serial, result + 4, 10); ++ ++ if (strspn(serial, "\xff") == 10) ++ strscpy(serial, "(unset)", 8); ++ ++ return 0; ++} ++ ++static void pimidi_handle_midi_data(struct pimidi_instance *instance, int port, const uint8_t *data, ++ unsigned int n) ++{ ++ printd(instance, "Handling MIDI data for port %d (%u bytes)", port, n); ++ if (n == 0) ++ return; ++ ++ struct pimidi_midi_port *midi_port = &instance->midi_port[port]; ++ ++ kfifo_in(&midi_port->in_fifo, data, n); ++ ++ if (!instance->stopping) ++ queue_work(pimidi_global.work_queue, &midi_port->in_handler); ++ ++ printd(instance, "Done"); ++} ++ ++static void pimidi_drdy_continue(struct pimidi_instance *instance) ++{ ++ if (instance->stopping) { ++ printd(instance, "Refusing to queue work / enable IRQ due to stopping."); ++ return; ++ } ++ ++ if (gpiod_get_value(instance->data_ready_gpio)) { ++ printd_rl(instance, "Queue work due to DRDY line still low"); ++ queue_work(pimidi_global.work_queue, &instance->drdy_handler); ++ } else { ++ printd_rl(instance, "Enabling irq for more data"); ++ enable_irq(gpiod_to_irq(instance->data_ready_gpio)); ++ } ++} ++ ++static void pimidi_drdy_handler(struct work_struct *work) ++{ ++ struct pimidi_instance *instance = container_of(work, struct pimidi_instance, drdy_handler); ++ ++ printd(instance, "(%p)", work); ++ ++ mutex_lock(&instance->comm_lock); ++ if (!instance->rx_completion) { ++ u8 data[PIMIDI_MAX_PACKET_SIZE]; ++ int n = i2c_master_recv(instance->i2c_client, data, 3); ++ ++ if (n < 0) { ++ printe(instance, "Error reading from device: %d", n); ++ mutex_unlock(&instance->comm_lock); ++ pimidi_drdy_continue(instance); ++ return; ++ } ++ ++ if (data[0] == 0xfe) { ++ printe_rl(instance, "Invalid packet 0x%02x 0x%02x 0x%02x", data[0], data[1], ++ data[2]); ++ mutex_unlock(&instance->comm_lock); ++ pimidi_drdy_continue(instance); ++ return; ++ } ++ ++ int len = (data[0] & 0x0f) + 2; ++ ++ if (len > n) { ++ printd(instance, "Need %d more bytes", len - n); ++ int err = i2c_master_recv(instance->i2c_client, data + n, len - n); ++ ++ if (err < 0) { ++ printe(instance, "Error reading remainder from device: %d", err); ++ mutex_unlock(&instance->comm_lock); ++ pimidi_drdy_continue(instance); ++ return; ++#ifdef PIMIDI_DEBUG ++ } else { ++ pr_debug("Recv_2:"); ++ int i; ++ ++ for (i = n; i < len; ++i) ++ pr_cont(" %02x", data[i]); ++ pr_cont("\n"); ++#endif ++ } ++ } ++ ++ if (CRC8_GOOD_VALUE(pimidi_crc8_table) == crc8(pimidi_crc8_table, data, len, ++ CRC8_INIT_VALUE)) { ++ switch (data[0] & 0xf0) { ++ case 0x00: ++ pimidi_handle_midi_data(instance, 0, data + 1, len - 2); ++ break; ++ case 0x10: ++ pimidi_handle_midi_data(instance, 1, data + 1, len - 2); ++ break; ++ default: ++ printd(instance, "Unhandled command %02x", data[0]); ++ break; ++ } ++ } else { ++ printe(instance, "I2C rx corruption detected."); ++ pr_info("Packet [%d]:", len); ++ int i; ++ ++ for (i = 0; i < len; ++i) ++ pr_cont(" %02x", data[i]); ++ pr_cont("\n"); ++ } ++ ++ mutex_unlock(&instance->comm_lock); ++ } else { ++ printd(instance, "Completing drdy"); ++ instance->rx_status = i2c_master_recv(instance->i2c_client, instance->rx_buf, 3); ++ printd(instance, "Recv_1 %02x %02x %02x", instance->rx_buf[0], instance->rx_buf[1], ++ instance->rx_buf[2]); ++ if (instance->rx_len > 3 && instance->rx_status == 3) { ++ instance->rx_status = i2c_master_recv(instance->i2c_client, ++ instance->rx_buf + 3, ++ instance->rx_len - 3); ++ if (instance->rx_status >= 0) ++ instance->rx_status += 3; ++#ifdef PIMIDI_DEBUG ++ pr_debug("Recv_2:"); ++ int i; ++ ++ for (i = 3; i < instance->rx_len; ++i) ++ pr_cont(" %02x", instance->rx_buf[i]); ++ pr_cont("\n"); ++#endif ++ } ++ struct completion *done = instance->rx_completion; ++ ++ instance->rx_buf = NULL; ++ instance->rx_len = 0; ++ instance->rx_completion = NULL; ++ complete_all(done); ++ mutex_unlock(&instance->comm_lock); ++ } ++ ++ pimidi_drdy_continue(instance); ++} ++ ++static irqreturn_t pimidi_drdy_interrupt_handler(int irq, void *dev_id) ++{ ++ struct pimidi_instance *instance = (struct pimidi_instance *)dev_id; ++ ++ if (instance->stopping) { ++ printd(instance, "DRDY interrupt, but stopping, ignoring..."); ++ return IRQ_HANDLED; ++ } ++ ++ printd(instance, "DRDY interrupt, masking"); ++ disable_irq_nosync(irq); ++ ++ printd(instance, "Queue work due to DRDY interrupt"); ++ queue_work(pimidi_global.work_queue, &instance->drdy_handler); ++ ++ return IRQ_HANDLED; ++} ++ ++static void pimidi_proc_stat_show(struct snd_info_entry *entry, struct snd_info_buffer *buffer) ++{ ++ const unsigned int *d = entry->private_data; ++ ++ snd_iprintf(buffer, "%u\n", *d); ++} ++ ++static void pimidi_proc_serial_show(struct snd_info_entry *entry, struct snd_info_buffer *buffer) ++{ ++ struct pimidi_instance *instance = entry->private_data; ++ ++ snd_iprintf(buffer, "%s\n", instance->serial); ++} ++ ++static void pimidi_proc_version_show(struct snd_info_entry *entry, struct snd_info_buffer *buffer) ++{ ++ struct pimidi_instance *instance = entry->private_data; ++ ++ snd_iprintf(buffer, "%u.%u.%u\n", instance->version.major, instance->version.minor, ++ instance->version.build); ++} ++ ++static void pimidi_proc_hwrev_show(struct snd_info_entry *entry, struct snd_info_buffer *buffer) ++{ ++ struct pimidi_instance *instance = entry->private_data; ++ ++ snd_iprintf(buffer, "%u\n", instance->version.hwrev); ++} ++ ++static int pimidi_i2c_probe(struct i2c_client *client) ++{ ++ struct snd_card *card = NULL; ++ int err, d, i; ++ ++ d = client->addr - 0x20; ++ ++ if (d < 0 || d >= 8) { ++ printe_g("Unexpected device address: %d", client->addr); ++ err = -EINVAL; ++ goto finalize; ++ } ++ ++ err = snd_card_new(&client->dev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1, THIS_MODULE, ++ sizeof(struct pimidi_instance), &card); ++ ++ if (err) { ++ printe_g("snd_card_new failed: %d", err); ++ return err; ++ } ++ ++ struct pimidi_instance *instance = (struct pimidi_instance *)card->private_data; ++ ++ instance->i2c_client = client; ++ instance->d = d; ++ ++ struct snd_rawmidi *rawmidi; ++ ++ err = snd_rawmidi_new(card, card->shortname, 0, 2, 2, &rawmidi); ++ if (err < 0) { ++ printe(instance, "snd_rawmidi_new failed: %d", err); ++ goto finalize; ++ } ++ ++ instance->rawmidi = rawmidi; ++ strscpy(rawmidi->name, "pimidi", sizeof(rawmidi->name)); ++ ++ rawmidi->info_flags = ++ SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT | SNDRV_RAWMIDI_INFO_DUPLEX; ++ rawmidi->private_data = instance; ++ rawmidi->ops = &pimidi_midi_ops; ++ ++ snd_rawmidi_set_ops(rawmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &pimidi_midi_output_ops); ++ snd_rawmidi_set_ops(rawmidi, SNDRV_RAWMIDI_STREAM_INPUT, &pimidi_midi_input_ops); ++ ++ instance->data_ready_gpio = devm_gpiod_get(&client->dev, "data-ready", GPIOD_OUT_HIGH); ++ if (IS_ERR(instance->data_ready_gpio)) { ++ err = PTR_ERR(instance->data_ready_gpio); ++ printe(instance, "devm_gpiod_get failed: %d", err); ++ goto finalize; ++ } ++ ++ err = pimidi_register(instance); ++ if (err < 0) { ++ printe(instance, "pimidi_register failed: %d", err); ++ goto finalize; ++ } ++ ++ pimidi_perform_reset(); ++ ++ INIT_WORK(&instance->drdy_handler, pimidi_drdy_handler); ++ mutex_init(&instance->comm_lock); ++ ++ err = devm_request_irq(&client->dev, client->irq, pimidi_drdy_interrupt_handler, ++ IRQF_SHARED | IRQF_TRIGGER_LOW, "data_ready_int", instance); ++ ++ if (err != 0) { ++ printe(instance, "data_available IRQ request failed! %d", err); ++ goto finalize; ++ } ++ ++ err = pimidi_read_version(&instance->version, instance); ++ if (err < 0) { ++ printe(instance, "pimidi_read_version failed: %d", err); ++ goto finalize; ++ } ++ ++ err = pimidi_read_serial(instance->serial, instance); ++ if (err < 0) { ++ printe(instance, "pimidi_read_serial failed: %d", err); ++ goto finalize; ++ } else if (instance->serial[0] != 'P' || instance->serial[1] != 'M' || ++ strlen(instance->serial) != 10) { ++ printe(instance, "Unexpected serial number: %s", instance->serial); ++ err = -EIO; ++ goto finalize; ++ } ++ ++ printi(instance, "pimidi%d hw:%d version %u.%u.%u-%u, serial %s", ++ d, ++ card->number, ++ instance->version.major, ++ instance->version.minor, ++ instance->version.build, ++ instance->version.hwrev, ++ instance->serial ++ ); ++ ++ strscpy(card->driver, "snd-pimidi", sizeof(card->driver)); ++ snprintf(card->shortname, sizeof(card->shortname), "pimidi%d", d); ++ snprintf(card->longname, sizeof(card->longname), "pimidi%d %s", d, instance->serial); ++ snprintf(card->id, sizeof(card->id), "pimidi%d", d); ++ ++ snprintf(pimidi_find_substream(rawmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, 0)->name, ++ 10u, "pimidi%d-a", d); ++ snprintf(pimidi_find_substream(rawmidi, SNDRV_RAWMIDI_STREAM_INPUT, 0)->name, ++ 10u, "pimidi%d-a", d); ++ snprintf(pimidi_find_substream(rawmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, 1)->name, ++ 10u, "pimidi%d-b", d); ++ snprintf(pimidi_find_substream(rawmidi, SNDRV_RAWMIDI_STREAM_INPUT, 1)->name, ++ 10u, "pimidi%d-b", d); ++ ++ err = snd_card_ro_proc_new(card, "a-tx", &instance->midi_port[0].tx_cnt, ++ pimidi_proc_stat_show); ++ err = snd_card_ro_proc_new(card, "a-rx", &instance->midi_port[0].rx_cnt, ++ pimidi_proc_stat_show); ++ err = snd_card_ro_proc_new(card, "b-tx", &instance->midi_port[1].tx_cnt, ++ pimidi_proc_stat_show); ++ err = snd_card_ro_proc_new(card, "b-rx", &instance->midi_port[1].rx_cnt, ++ pimidi_proc_stat_show); ++ err = snd_card_ro_proc_new(card, "serial", instance, pimidi_proc_serial_show); ++ err = snd_card_ro_proc_new(card, "version", instance, pimidi_proc_version_show); ++ err = snd_card_ro_proc_new(card, "hwrev", instance, pimidi_proc_hwrev_show); ++ if (err < 0) { ++ printe(instance, "snd_card_ro_proc_new failed: %d", err); ++ goto finalize; ++ } ++ ++ err = snd_card_register(card); ++ if (err < 0) { ++ printe(instance, "snd_card_register failed: %d", err); ++ goto finalize; ++ } ++ ++finalize: ++ if (err) { ++ instance->stopping = true; ++ cancel_work_sync(&instance->drdy_handler); ++ mutex_destroy(&instance->comm_lock); ++ pimidi_unregister(instance); ++ snd_card_free(card); ++ return err; ++ } ++ ++ for (i = 0; i < PIMIDI_PORTS; ++i) { ++ struct pimidi_midi_port *port = &instance->midi_port[i]; ++ ++ mutex_init(&port->in_lock); ++ mutex_init(&port->out_lock); ++ INIT_WORK(&port->in_handler, ++ i == 0 ? pimidi_midi_in_handler_0 : pimidi_midi_in_handler_1); ++ INIT_DELAYED_WORK(&port->out_handler, ++ i == 0 ? pimidi_midi_out_handler_0 : pimidi_midi_out_handler_1); ++ INIT_KFIFO(port->in_fifo); ++ port->last_output_at = jiffies; ++ } ++ ++ i2c_set_clientdata(client, card); ++ return 0; ++} ++ ++static void pimidi_i2c_remove(struct i2c_client *client) ++{ ++ printd_g("(%p)", client); ++ ++ int i; ++ struct snd_card *card = i2c_get_clientdata(client); ++ ++ if (card) { ++ printi_g("Unloading hw:%d %s", card->number, card->longname); ++ struct pimidi_instance *instance = (struct pimidi_instance *)card->private_data; ++ ++ instance->stopping = true; ++ i2c_set_clientdata(client, NULL); ++ devm_free_irq(&client->dev, client->irq, instance); ++ cancel_work_sync(&instance->drdy_handler); ++ ++ for (i = 0; i < PIMIDI_PORTS; ++i) { ++ cancel_work_sync(&instance->midi_port[i].in_handler); ++ cancel_delayed_work_sync(&instance->midi_port[i].out_handler); ++ mutex_destroy(&instance->midi_port[i].out_lock); ++ mutex_destroy(&instance->midi_port[i].in_lock); ++ kfifo_free(&instance->midi_port[i].in_fifo); ++ } ++ ++ mutex_destroy(&instance->comm_lock); ++ pimidi_unregister(instance); ++ snd_card_free(card); ++ } ++} ++ ++static const struct i2c_device_id pimidi_i2c_ids[] = { ++ { "pimidi", 0 }, ++ {} ++}; ++MODULE_DEVICE_TABLE(i2c, pimidi_i2c_ids); ++ ++static const struct of_device_id pimidi_i2c_dt_ids[] = { ++ { .compatible = "blokaslabs,pimidi", }, ++ {} ++}; ++MODULE_DEVICE_TABLE(of, pimidi_i2c_dt_ids); ++ ++static struct i2c_driver pimidi_i2c_driver = { ++ .driver = { ++ .name = "pimidi", ++ .owner = THIS_MODULE, ++ .of_match_table = of_match_ptr(pimidi_i2c_dt_ids), ++ }, ++ .probe = pimidi_i2c_probe, ++ .remove = pimidi_i2c_remove, ++ .id_table = pimidi_i2c_ids, ++}; ++ ++int pimidi_module_init(void) ++{ ++ int err = 0; ++ ++ mutex_init(&pimidi_global.lock); ++ ++ INIT_LIST_HEAD(&pimidi_global.devices); ++ ++ pimidi_global.work_queue = create_singlethread_workqueue("pimidi"); ++ if (!pimidi_global.work_queue) { ++ err = -ENOMEM; ++ goto cleanup; ++ } ++ ++ err = i2c_add_driver(&pimidi_i2c_driver); ++ if (err < 0) ++ goto cleanup; ++ ++ crc8_populate_msb(pimidi_crc8_table, PIMIDI_CRC8_POLYNOMIAL); ++ ++ return 0; ++ ++cleanup: ++ mutex_destroy(&pimidi_global.lock); ++ return err; ++} ++ ++void pimidi_module_exit(void) ++{ ++ i2c_del_driver(&pimidi_i2c_driver); ++ mutex_lock(&pimidi_global.lock); ++ if (pimidi_global.reset_gpio) { ++ gpiod_put(pimidi_global.reset_gpio); ++ pimidi_global.reset_gpio = NULL; ++ } ++ mutex_unlock(&pimidi_global.lock); ++ ++ destroy_workqueue(pimidi_global.work_queue); ++ pimidi_global.work_queue = NULL; ++ ++ mutex_destroy(&pimidi_global.lock); ++} ++ ++module_init(pimidi_module_init); ++module_exit(pimidi_module_exit); ++ ++MODULE_AUTHOR("Giedrius Trainavi\xc4\x8dius "); ++MODULE_DESCRIPTION("MIDI driver for Blokas Pimidi, https://blokas.io/"); ++MODULE_LICENSE("GPL"); ++ ++/* vim: set ts=8 sw=8 noexpandtab: */ diff --git a/target/linux/bcm27xx/patches-6.6/950-1406-Adding-pimidi-overlay.dts.patch b/target/linux/bcm27xx/patches-6.6/950-1406-Adding-pimidi-overlay.dts.patch new file mode 100644 index 00000000000000..ab46dbdb98cea4 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1406-Adding-pimidi-overlay.dts.patch @@ -0,0 +1,100 @@ +From 75ab92b077602734458f0a77e19a3599be29b93b Mon Sep 17 00:00:00 2001 +From: Giedrius +Date: Thu, 21 Nov 2024 08:05:49 +0000 +Subject: [PATCH] Adding pimidi-overlay.dts +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Giedrius Trainavičius +--- + arch/arm/boot/dts/overlays/Makefile | 1 + + arch/arm/boot/dts/overlays/README | 8 +++ + arch/arm/boot/dts/overlays/pimidi-overlay.dts | 54 +++++++++++++++++++ + 3 files changed, 63 insertions(+) + create mode 100644 arch/arm/boot/dts/overlays/pimidi-overlay.dts + +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -203,6 +203,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ + pifi-dac-zero.dtbo \ + pifi-mini-210.dtbo \ + piglow.dtbo \ ++ pimidi.dtbo \ + pineboards-hat-ai.dtbo \ + pineboards-hatdrive-poe-plus.dtbo \ + piscreen.dtbo \ +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -3701,6 +3701,14 @@ Load: dtoverlay=piglow + Params: + + ++Name: pimidi ++Info: Configures the Blokas Labs Pimidi card ++Load: dtoverlay=pimidi,= ++Params: sel The position used for the sel rotary switch. ++ Each unit in the stack must be set on a unique ++ position. If param is omitted, sel=0 is assumed. ++ ++ + Name: pineboards-hat-ai + Info: Pineboards Hat Ai! overlay for the Google Coral Edge TPU + Load: dtoverlay=pineboards-hat-ai +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pimidi-overlay.dts +@@ -0,0 +1,54 @@ ++/* ++ * Pimidi Linux kernel module. ++ * Copyright (C) 2017-2024 Vilniaus Blokas UAB, https://blokas.io/ ++ * ++ * 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; version 2 of the ++ * License. ++ * ++ * This program 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. ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++#include ++#include ++ ++/ { ++ compatible = "brcm,bcm2835"; ++ ++ fragment@0 { ++ target = <&i2c_arm>; ++ __overlay__ { ++ status = "okay"; ++ clock-frequency=<1000000>; ++ ++ pimidi_ctrl: pimidi_ctrl@20 { ++ compatible = "blokaslabs,pimidi"; ++ ++ reg = <0x20>; ++ status = "okay"; ++ ++ interrupt-parent = <&gpio>; ++ interrupts = <23 IRQ_TYPE_LEVEL_LOW>; ++ interrupt-names = "data_ready"; ++ interrupt-controller; ++ #interrupt-cells = <2>; ++ ++ data-ready-gpios = <&gpio 23 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; ++ reset-gpios = <&gpio 22 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ sel = <&pimidi_ctrl>,"reg:0{0=0x20,1=0x21,2=0x22,3=0x23}", ++ <&pimidi_ctrl>,"data-ready-gpios:4{0=23,1=5,2=6,3=27}", ++ <&pimidi_ctrl>,"interrupts:0{0=23,1=5,2=6,3=27}"; ++ }; ++}; diff --git a/target/linux/bcm27xx/patches-6.6/950-0297-staging-vchiq_arm-Add-36-bit-address-support.patch b/target/linux/bcm27xx/patches-6.6/950-1411-staging-vchiq_arm-Add-36-bit-address-support.patch similarity index 98% rename from target/linux/bcm27xx/patches-6.6/950-0297-staging-vchiq_arm-Add-36-bit-address-support.patch rename to target/linux/bcm27xx/patches-6.6/950-1411-staging-vchiq_arm-Add-36-bit-address-support.patch index 11147d9fd9615a..871b2769b10232 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0297-staging-vchiq_arm-Add-36-bit-address-support.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1411-staging-vchiq_arm-Add-36-bit-address-support.patch @@ -1,7 +1,7 @@ -From fc5ed9d9bf0411523220bab60304da6d23257a64 Mon Sep 17 00:00:00 2001 +From a1e4b72997dc3ef423b6f510bfead470475750d4 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 1 Nov 2018 17:31:37 +0000 -Subject: [PATCH 0297/1085] staging: vchiq_arm: Add 36-bit address support +Subject: [PATCH] staging: vchiq_arm: Add 36-bit address support Conditional on a new compatible string, change the pagelist encoding such that the top 24 bits are the pfn, leaving 8 bits for run length diff --git a/target/linux/bcm27xx/patches-6.6/950-0298-staging-vchiq_arm-children-inherit-DMA-config.patch b/target/linux/bcm27xx/patches-6.6/950-1412-staging-vchiq_arm-children-inherit-DMA-config.patch similarity index 87% rename from target/linux/bcm27xx/patches-6.6/950-0298-staging-vchiq_arm-children-inherit-DMA-config.patch rename to target/linux/bcm27xx/patches-6.6/950-1412-staging-vchiq_arm-children-inherit-DMA-config.patch index 87bea65fc76523..df93f3a0c4a30c 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0298-staging-vchiq_arm-children-inherit-DMA-config.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1412-staging-vchiq_arm-children-inherit-DMA-config.patch @@ -1,7 +1,7 @@ -From d4712f611e6d60dd9cf09df581f5df6fad6a2207 Mon Sep 17 00:00:00 2001 +From 1129091b2d95273d930acf2926a569b90512a248 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 21 Jul 2020 17:34:09 +0100 -Subject: [PATCH 0298/1085] staging: vchiq_arm: children inherit DMA config +Subject: [PATCH] staging: vchiq_arm: children inherit DMA config Although it is no longer necessary for vchiq's children to have a different DMA configuration to the parent, they do still need to diff --git a/target/linux/bcm27xx/patches-6.6/950-0299-staging-vchiq_arm-Usa-a-DMA-pool-for-small-bulks.patch b/target/linux/bcm27xx/patches-6.6/950-1413-staging-vchiq_arm-Usa-a-DMA-pool-for-small-bulks.patch similarity index 96% rename from target/linux/bcm27xx/patches-6.6/950-0299-staging-vchiq_arm-Usa-a-DMA-pool-for-small-bulks.patch rename to target/linux/bcm27xx/patches-6.6/950-1413-staging-vchiq_arm-Usa-a-DMA-pool-for-small-bulks.patch index 162d333c6127e8..7120123ecfe6fb 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0299-staging-vchiq_arm-Usa-a-DMA-pool-for-small-bulks.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1413-staging-vchiq_arm-Usa-a-DMA-pool-for-small-bulks.patch @@ -1,7 +1,7 @@ -From 9f328c347fc9a5495b8383aa2bae1d3bc242a2ab Mon Sep 17 00:00:00 2001 +From 2d26a598ceceaea8a6837146c741eb742bbd4baa Mon Sep 17 00:00:00 2001 From: detule Date: Tue, 2 Oct 2018 04:10:08 -0400 -Subject: [PATCH 0299/1085] staging: vchiq_arm: Usa a DMA pool for small bulks +Subject: [PATCH] staging: vchiq_arm: Usa a DMA pool for small bulks During a bulk transfer we request a DMA allocation to hold the scatter-gather list. Most of the time, this allocation is small diff --git a/target/linux/bcm27xx/patches-6.6/950-0365-staging-vchiq_arm-Add-log_level-module-params.patch b/target/linux/bcm27xx/patches-6.6/950-1414-staging-vchiq_arm-Add-log_level-module-params.patch similarity index 88% rename from target/linux/bcm27xx/patches-6.6/950-0365-staging-vchiq_arm-Add-log_level-module-params.patch rename to target/linux/bcm27xx/patches-6.6/950-1414-staging-vchiq_arm-Add-log_level-module-params.patch index 51815f26193816..d85765bc32827b 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0365-staging-vchiq_arm-Add-log_level-module-params.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1414-staging-vchiq_arm-Add-log_level-module-params.patch @@ -1,7 +1,7 @@ -From 79f24f7454a416fed9106c75ea9b3be480465dda Mon Sep 17 00:00:00 2001 +From 5b29221e96d1ba60a78d5c804a20fa35a6d0517a Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 29 Apr 2022 09:19:10 +0100 -Subject: [PATCH 0365/1085] staging: vchiq_arm: Add log_level module params +Subject: [PATCH] staging: vchiq_arm: Add log_level module params Add module parameters to control the logging levels for the various vchiq logging categories. diff --git a/target/linux/bcm27xx/patches-6.6/950-1415-media-i2c-imx477-Fix-link-frequency-menu.patch b/target/linux/bcm27xx/patches-6.6/950-1415-media-i2c-imx477-Fix-link-frequency-menu.patch new file mode 100644 index 00000000000000..9b5b0e47d6b808 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1415-media-i2c-imx477-Fix-link-frequency-menu.patch @@ -0,0 +1,25 @@ +From 8691544f688bd3ae9b6db0845a75ce230fc9e90f Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Thu, 21 Nov 2024 15:54:58 +0000 +Subject: [PATCH] media: i2c: imx477: Fix link frequency menu + +"media: i2c: imx477: Add options for slightly modifying the link freq" +created a link frequency menu with 2 items in instead of one. +Correct this. + +Signed-off-by: Dave Stevenson +--- + drivers/media/i2c/imx477.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/media/i2c/imx477.c ++++ b/drivers/media/i2c/imx477.c +@@ -2051,7 +2051,7 @@ static int imx477_init_controls(struct i + /* LINK_FREQ is also read only */ + imx477->link_freq = + v4l2_ctrl_new_int_menu(ctrl_hdlr, &imx477_ctrl_ops, +- V4L2_CID_LINK_FREQ, 1, 0, ++ V4L2_CID_LINK_FREQ, 0, 0, + &link_freqs[imx477->link_freq_idx]); + if (imx477->link_freq) + imx477->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY; diff --git a/target/linux/bcm27xx/patches-6.6/950-1357-misc-rp1-pio-Fix-copy-paste-error-in-pio_rp1.h.patch b/target/linux/bcm27xx/patches-6.6/950-1416-misc-rp1-pio-Fix-copy-paste-error-in-pio_rp1.h.patch similarity index 93% rename from target/linux/bcm27xx/patches-6.6/950-1357-misc-rp1-pio-Fix-copy-paste-error-in-pio_rp1.h.patch rename to target/linux/bcm27xx/patches-6.6/950-1416-misc-rp1-pio-Fix-copy-paste-error-in-pio_rp1.h.patch index 0746e3c32ba949..cf13be0a048160 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1357-misc-rp1-pio-Fix-copy-paste-error-in-pio_rp1.h.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1416-misc-rp1-pio-Fix-copy-paste-error-in-pio_rp1.h.patch @@ -14,7 +14,7 @@ Signed-off-by: Phil Elwell --- a/include/linux/pio_rp1.h +++ b/include/linux/pio_rp1.h -@@ -318,7 +318,7 @@ static inline int pio_sm_unclaim(struct +@@ -320,7 +320,7 @@ static inline int pio_sm_unclaim(struct if (bad_params_if(client, sm >= NUM_PIO_STATE_MACHINES)) return -EINVAL; diff --git a/target/linux/bcm27xx/patches-6.6/950-1360-misc-rp1-pio-Fix-parameter-checks-wihout-client.patch b/target/linux/bcm27xx/patches-6.6/950-1417-misc-rp1-pio-Fix-parameter-checks-wihout-client.patch similarity index 100% rename from target/linux/bcm27xx/patches-6.6/950-1360-misc-rp1-pio-Fix-parameter-checks-wihout-client.patch rename to target/linux/bcm27xx/patches-6.6/950-1417-misc-rp1-pio-Fix-parameter-checks-wihout-client.patch diff --git a/target/linux/bcm27xx/patches-6.6/950-1418-drm-vc4-dsi-Handle-the-different-command-FIFO-widths.patch b/target/linux/bcm27xx/patches-6.6/950-1418-drm-vc4-dsi-Handle-the-different-command-FIFO-widths.patch new file mode 100644 index 00000000000000..5e50af70df4770 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1418-drm-vc4-dsi-Handle-the-different-command-FIFO-widths.patch @@ -0,0 +1,147 @@ +From 008c93b47b9b965368eb5bbfbef60b816931e0ab Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Wed, 20 Nov 2024 13:58:08 +0000 +Subject: [PATCH] drm: vc4: dsi: Handle the different command FIFO widths + +DSI0 and DSI1 have different widths for the command FIFO (24bit +vs 32bit), but the driver was assuming the 32bit width of DSI1 +in all cases. +DSI0 also wants the data packed as 24bit big endian, so the +formatting code needs updating. + +Handle the difference via the variant structure. + +Signed-off-by: Dave Stevenson +--- + drivers/gpu/drm/vc4/vc4_dsi.c | 64 ++++++++++++++++++++++++----------- + 1 file changed, 44 insertions(+), 20 deletions(-) + +--- a/drivers/gpu/drm/vc4/vc4_dsi.c ++++ b/drivers/gpu/drm/vc4/vc4_dsi.c +@@ -44,7 +44,6 @@ + + #define DSI_CMD_FIFO_DEPTH 16 + #define DSI_PIX_FIFO_DEPTH 256 +-#define DSI_PIX_FIFO_WIDTH 4 + + #define DSI0_CTRL 0x00 + +@@ -170,11 +169,15 @@ + #define DSI1_DISP1_CTRL 0x2c + /* Format of the data written to TXPKT_PIX_FIFO. */ + # define DSI_DISP1_PFORMAT_MASK VC4_MASK(2, 1) +-# define DSI_DISP1_PFORMAT_SHIFT 1 +-# define DSI_DISP1_PFORMAT_16BIT 0 +-# define DSI_DISP1_PFORMAT_24BIT 1 +-# define DSI_DISP1_PFORMAT_32BIT_LE 2 +-# define DSI_DISP1_PFORMAT_32BIT_BE 3 ++# define DSI1_DISP1_PFORMAT_SHIFT 1 ++# define DSI0_DISP1_PFORMAT_16BIT 0 ++# define DSI0_DISP1_PFORMAT_16BIT_ADJ 1 ++# define DSI0_DISP1_PFORMAT_24BIT 2 ++# define DSI0_DISP1_PFORMAT_32BIT_LE 3 /* NB Invalid, but required for macros to work */ ++# define DSI1_DISP1_PFORMAT_16BIT 0 ++# define DSI1_DISP1_PFORMAT_24BIT 1 ++# define DSI1_DISP1_PFORMAT_32BIT_LE 2 ++# define DSI1_DISP1_PFORMAT_32BIT_BE 3 + + /* DISP1 is always command mode. */ + # define DSI_DISP1_ENABLE BIT(0) +@@ -553,6 +556,7 @@ struct vc4_dsi_variant { + unsigned int port; + + bool broken_axi_workaround; ++ unsigned int cmd_fifo_width; + + const char *debugfs_name; + const struct debugfs_reg32 *regs; +@@ -1151,10 +1155,16 @@ static void vc4_dsi_bridge_pre_enable(st + /* Set up DISP1 for transferring long command payloads through + * the pixfifo. + */ +- DSI_PORT_WRITE(DISP1_CTRL, +- VC4_SET_FIELD(DSI_DISP1_PFORMAT_32BIT_LE, +- DSI_DISP1_PFORMAT) | +- DSI_DISP1_ENABLE); ++ if (dsi->variant->cmd_fifo_width == 4) ++ DSI_PORT_WRITE(DISP1_CTRL, ++ VC4_SET_FIELD(DSI_PORT_BIT(DISP1_PFORMAT_32BIT_LE), ++ DSI_DISP1_PFORMAT) | ++ DSI_DISP1_ENABLE); ++ else ++ DSI_PORT_WRITE(DISP1_CTRL, ++ VC4_SET_FIELD(DSI_PORT_BIT(DISP1_PFORMAT_24BIT), ++ DSI_DISP1_PFORMAT) | ++ DSI_DISP1_ENABLE); + + /* Bring AFE out of reset. */ + DSI_PORT_WRITE(PHY_AFEC0, +@@ -1235,9 +1245,9 @@ static ssize_t vc4_dsi_transfer(struct v + pix_fifo_len = 0; + } else { + cmd_fifo_len = (packet.payload_length % +- DSI_PIX_FIFO_WIDTH); ++ dsi->variant->cmd_fifo_width); + pix_fifo_len = ((packet.payload_length - cmd_fifo_len) / +- DSI_PIX_FIFO_WIDTH); ++ dsi->variant->cmd_fifo_width); + } + + WARN_ON_ONCE(pix_fifo_len >= DSI_PIX_FIFO_DEPTH); +@@ -1255,14 +1265,25 @@ static ssize_t vc4_dsi_transfer(struct v + + for (i = 0; i < cmd_fifo_len; i++) + DSI_PORT_WRITE(TXPKT_CMD_FIFO, packet.payload[i]); +- for (i = 0; i < pix_fifo_len; i++) { +- const u8 *pix = packet.payload + cmd_fifo_len + i * 4; ++ if (dsi->variant->cmd_fifo_width == 4) { ++ for (i = 0; i < pix_fifo_len; i++) { ++ const u8 *pix = packet.payload + cmd_fifo_len + i * 4; ++ ++ DSI_PORT_WRITE(TXPKT_PIX_FIFO, ++ pix[0] | ++ pix[1] << 8 | ++ pix[2] << 16 | ++ pix[3] << 24); ++ } ++ } else { ++ for (i = 0; i < pix_fifo_len; i++) { ++ const u8 *pix = packet.payload + cmd_fifo_len + i * 3; + +- DSI_PORT_WRITE(TXPKT_PIX_FIFO, +- pix[0] | +- pix[1] << 8 | +- pix[2] << 16 | +- pix[3] << 24); ++ DSI_PORT_WRITE(TXPKT_PIX_FIFO, ++ pix[2] | ++ pix[1] << 8 | ++ pix[0] << 16); ++ } + } + + if (msg->flags & MIPI_DSI_MSG_USE_LPM) +@@ -1516,6 +1537,7 @@ static const struct drm_encoder_funcs vc + + static const struct vc4_dsi_variant bcm2711_dsi1_variant = { + .port = 1, ++ .cmd_fifo_width = 4, + .debugfs_name = "dsi1_regs", + .regs = dsi1_regs, + .nregs = ARRAY_SIZE(dsi1_regs), +@@ -1523,6 +1545,7 @@ static const struct vc4_dsi_variant bcm2 + + static const struct vc4_dsi_variant bcm2835_dsi0_variant = { + .port = 0, ++ .cmd_fifo_width = 3, + .debugfs_name = "dsi0_regs", + .regs = dsi0_regs, + .nregs = ARRAY_SIZE(dsi0_regs), +@@ -1530,6 +1553,7 @@ static const struct vc4_dsi_variant bcm2 + + static const struct vc4_dsi_variant bcm2835_dsi1_variant = { + .port = 1, ++ .cmd_fifo_width = 4, + .broken_axi_workaround = true, + .debugfs_name = "dsi1_regs", + .regs = dsi1_regs, diff --git a/target/linux/bcm27xx/patches-6.6/950-1419-dts-bcm2712-rpi-For-CM5IO-i2c_csi_dsi-needs-to-be-CA.patch b/target/linux/bcm27xx/patches-6.6/950-1419-dts-bcm2712-rpi-For-CM5IO-i2c_csi_dsi-needs-to-be-CA.patch new file mode 100644 index 00000000000000..0aab1043b597b5 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1419-dts-bcm2712-rpi-For-CM5IO-i2c_csi_dsi-needs-to-be-CA.patch @@ -0,0 +1,30 @@ +From eafaa6015fc0ed676f6115905e7c4145d23f5b7d Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Tue, 26 Nov 2024 15:53:24 +0000 +Subject: [PATCH] dts: bcm2712-rpi: For CM5IO, i2c_csi_dsi needs to be + CAM/DISP1 + +Noted setting up a display on CM5IO. Add +"dtoverlay=vc4-kms-dsi-ili7881-7inch" fails as it tries to +find the regulator/backlight/touch on i2c_csi_dsi, which pointed +at i2c_csi_dsi0 by default. + +Adding the dsi0 override updated to point at dsi0, and pointed +the i2c at i2c_csi_dsi0, which all works. + +The default with i2c_csi_dsi needs to be consistent in using +dsi1/csi1 and the corresponding i2c interface (i2c_csi_dsi1). + +Signed-off-by: Dave Stevenson +--- + arch/arm64/boot/dts/broadcom/bcm2712-rpi-cm5io.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/arm64/boot/dts/broadcom/bcm2712-rpi-cm5io.dtsi ++++ b/arch/arm64/boot/dts/broadcom/bcm2712-rpi-cm5io.dtsi +@@ -11,4 +11,4 @@ i2c_csi_dsi0: &i2c6 { // Note: This is f + symlink = "i2c-6"; + }; + +-i2c_csi_dsi: &i2c_csi_dsi0 { }; // The connector that needs no jumper to enable ++i2c_csi_dsi: &i2c_csi_dsi1 { }; // The connector that needs no jumper to enable diff --git a/target/linux/bcm27xx/patches-6.6/950-1420-dts-bcm2712-rpi-cm5-Remove-inaccessible-USB_OC_N.patch b/target/linux/bcm27xx/patches-6.6/950-1420-dts-bcm2712-rpi-cm5-Remove-inaccessible-USB_OC_N.patch new file mode 100644 index 00000000000000..e2a01216a3eae9 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1420-dts-bcm2712-rpi-cm5-Remove-inaccessible-USB_OC_N.patch @@ -0,0 +1,25 @@ +From d128c123754e9dd03ad72c16851a1652331d6da1 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 27 Nov 2024 10:24:47 +0000 +Subject: [PATCH] dts: bcm2712-rpi-cm5: Remove inaccessible USB_OC_N + +Although VBUS_EN on GPIO42 appears on the CM5's 100-way headers, +USB_OC_N on GPIO43 does not. Remove the signal name to avoid further +confusion and disappointment. + +Signed-off-by: Phil Elwell +--- + arch/arm64/boot/dts/broadcom/bcm2712-rpi-cm5.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/arm64/boot/dts/broadcom/bcm2712-rpi-cm5.dtsi ++++ b/arch/arm64/boot/dts/broadcom/bcm2712-rpi-cm5.dtsi +@@ -718,7 +718,7 @@ spi10_cs_pins: &spi10_cs_gpio1 {}; + "-", // GPIO40 + "-", // GPIO41 + "USB_VBUS_EN", // GPIO42 +- "USB_OC_N", // GPIO43 ++ "-", // GPIO43 + "RP1_STAT_LED", // GPIO44 + "FAN_PWM", // GPIO45 + "-", // GPIO46 diff --git a/target/linux/bcm27xx/patches-6.6/950-1421-overlays-qca7000-replace-URL-with-textual-hint.patch b/target/linux/bcm27xx/patches-6.6/950-1421-overlays-qca7000-replace-URL-with-textual-hint.patch new file mode 100644 index 00000000000000..8cdb2504a106c5 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1421-overlays-qca7000-replace-URL-with-textual-hint.patch @@ -0,0 +1,33 @@ +From 77389e715039b1feac9c6261727600892cc12fdb Mon Sep 17 00:00:00 2001 +From: Michael Heimpold +Date: Fri, 29 Nov 2024 14:10:04 +0100 +Subject: [PATCH] overlays: qca7000: replace URL with textual hint + +The deep link into the website is not that stable, so let's +replace it with a textual description where to find the +product information. + +Signed-off-by: Michael Heimpold +--- + arch/arm/boot/dts/overlays/qca7000-overlay.dts | 2 +- + arch/arm/boot/dts/overlays/qca7000-uart0-overlay.dts | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/arch/arm/boot/dts/overlays/qca7000-overlay.dts ++++ b/arch/arm/boot/dts/overlays/qca7000-overlay.dts +@@ -1,5 +1,5 @@ + // Overlay for the Qualcomm Atheros QCA7000 on PLC Stamp micro EVK +-// Visit: https://chargebyte.com/products/evaluation-tools/plc-stamp-micro-2-evaluation-board for details ++// Visit: https://chargebyte.com -> Controllers & Modules -> Evaluation Tools -> PLC Stamp Micro 2 Evaluation Board for details + + /dts-v1/; + /plugin/; +--- a/arch/arm/boot/dts/overlays/qca7000-uart0-overlay.dts ++++ b/arch/arm/boot/dts/overlays/qca7000-uart0-overlay.dts +@@ -1,5 +1,5 @@ + // Overlay for the Qualcomm Atheros QCA7000 on PLC Stamp micro EVK +-// Visit: https://in-tech-smartcharging.com/products/evaluation-tools/plc-stamp-micro-2-evaluation-board for details ++// Visit: https://chargebyte.com -> Controllers & Modules -> Evaluation Tools -> PLC Stamp Micro 2 Evaluation Board for details + + /dts-v1/; + /plugin/; diff --git a/target/linux/bcm27xx/patches-6.6/950-1422-dt-bindings-net-cdns-macb-Add-compatible-for-Raspber.patch b/target/linux/bcm27xx/patches-6.6/950-1422-dt-bindings-net-cdns-macb-Add-compatible-for-Raspber.patch new file mode 100644 index 00000000000000..1364b4f713cde9 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1422-dt-bindings-net-cdns-macb-Add-compatible-for-Raspber.patch @@ -0,0 +1,24 @@ +From 178f1c2747c3920723242f26ba290785d45bffae Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Mon, 11 Nov 2024 16:38:01 +0000 +Subject: [PATCH] dt-bindings: net: cdns,macb: Add compatible for Raspberry Pi + RP1 + +The Raspberry Pi RP1 chip has the Cadence GEM ethernet +controller, so add a compatible string for it. + +Signed-off-by: Dave Stevenson +--- + Documentation/devicetree/bindings/net/cdns,macb.yaml | 1 + + 1 file changed, 1 insertion(+) + +--- a/Documentation/devicetree/bindings/net/cdns,macb.yaml ++++ b/Documentation/devicetree/bindings/net/cdns,macb.yaml +@@ -54,6 +54,7 @@ properties: + - cdns,np4-macb # NP4 SoC devices + - microchip,sama7g5-emac # Microchip SAMA7G5 ethernet interface + - microchip,sama7g5-gem # Microchip SAMA7G5 gigabit ethernet interface ++ - raspberrypi,rp1-gem # Raspberry Pi RP1 gigabit ethernet interface + - sifive,fu540-c000-gem # SiFive FU540-C000 SoC + - cdns,emac # Generic + - cdns,gem # Generic diff --git a/target/linux/bcm27xx/patches-6.6/950-1423-net-macb-Add-support-for-Raspberry-Pi-RP1-ethernet-c.patch b/target/linux/bcm27xx/patches-6.6/950-1423-net-macb-Add-support-for-Raspberry-Pi-RP1-ethernet-c.patch index 3941d69edf035d..6a9b7b36bd4075 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1423-net-macb-Add-support-for-Raspberry-Pi-RP1-ethernet-c.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1423-net-macb-Add-support-for-Raspberry-Pi-RP1-ethernet-c.patch @@ -1,8 +1,8 @@ From f9f0024bd9bf04a58b64bae356be4c04022d23bc Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Mon, 11 Nov 2024 16:40:07 +0000 -Subject: [PATCH 1423/1482] net: macb: Add support for Raspberry Pi RP1 - ethernet controller +Subject: [PATCH] net: macb: Add support for Raspberry Pi RP1 ethernet + controller The RP1 chip has the Cadence GEM block, but wants the tx_clock to always run at 125MHz, in the same way as sama7g5. diff --git a/target/linux/bcm27xx/patches-6.6/950-1424-rp1-clk-Only-set-PLL_SEC_RST-in-rp1_pll_divider_off.patch b/target/linux/bcm27xx/patches-6.6/950-1424-rp1-clk-Only-set-PLL_SEC_RST-in-rp1_pll_divider_off.patch index d3f216d31d0669..91d836f71cabbe 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1424-rp1-clk-Only-set-PLL_SEC_RST-in-rp1_pll_divider_off.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1424-rp1-clk-Only-set-PLL_SEC_RST-in-rp1_pll_divider_off.patch @@ -1,8 +1,7 @@ From 33c225f622d596034a9261316666089a92aa6834 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Mon, 25 Nov 2024 12:30:06 +0000 -Subject: [PATCH 1424/1482] rp1: clk: Only set PLL_SEC_RST in - rp1_pll_divider_off +Subject: [PATCH] rp1: clk: Only set PLL_SEC_RST in rp1_pll_divider_off Rather than clearing all the bits in rp1_pll_divider_off and setting PLL_SEC_RST, retain the status of all the other diff --git a/target/linux/bcm27xx/patches-6.6/950-1425-rp1-clk-Rationalise-the-use-of-the-CLK_IS_CRITICAL-f.patch b/target/linux/bcm27xx/patches-6.6/950-1425-rp1-clk-Rationalise-the-use-of-the-CLK_IS_CRITICAL-f.patch index 247ae455ac448d..3f4850c8990d10 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1425-rp1-clk-Rationalise-the-use-of-the-CLK_IS_CRITICAL-f.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1425-rp1-clk-Rationalise-the-use-of-the-CLK_IS_CRITICAL-f.patch @@ -1,8 +1,7 @@ From eb836a6a299322a8e2b9627cccd23c7a76d068ba Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Fri, 8 Nov 2024 17:36:13 +0000 -Subject: [PATCH 1425/1482] rp1: clk: Rationalise the use of the - CLK_IS_CRITICAL flag +Subject: [PATCH] rp1: clk: Rationalise the use of the CLK_IS_CRITICAL flag The clock setup had been copied from clk-bcm2835 which had to cope with the firmware having configured clocks, so there were flags diff --git a/target/linux/bcm27xx/patches-6.6/950-1426-dt-arm64-Fixup-RP1-ethernet-DT-configuration.patch b/target/linux/bcm27xx/patches-6.6/950-1426-dt-arm64-Fixup-RP1-ethernet-DT-configuration.patch index ad6569e99ce50c..f213d8def67c51 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1426-dt-arm64-Fixup-RP1-ethernet-DT-configuration.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1426-dt-arm64-Fixup-RP1-ethernet-DT-configuration.patch @@ -1,7 +1,7 @@ From 0b4af929b7125abd3a262577b380c7c81ee9b1c5 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Mon, 11 Nov 2024 15:18:14 +0000 -Subject: [PATCH 1426/1482] dt: arm64: Fixup RP1 ethernet DT configuration +Subject: [PATCH] dt: arm64: Fixup RP1 ethernet DT configuration Configure RP1's ethernet block to do the correct thing. clk_eth is intended to be fixed at 125MHz, so use a new compatible, @@ -14,7 +14,7 @@ Signed-off-by: Dave Stevenson --- a/arch/arm64/boot/dts/broadcom/rp1.dtsi +++ b/arch/arm64/boot/dts/broadcom/rp1.dtsi -@@ -24,6 +24,7 @@ +@@ -32,6 +32,7 @@ // RP1_PLL_VIDEO_CORE and dividers are now managed by VEC,DPI drivers <&rp1_clocks RP1_PLL_SYS>, <&rp1_clocks RP1_PLL_SYS_SEC>, @@ -22,7 +22,7 @@ Signed-off-by: Dave Stevenson <&rp1_clocks RP1_PLL_AUDIO>, <&rp1_clocks RP1_PLL_AUDIO_SEC>, <&rp1_clocks RP1_CLK_SYS>, -@@ -38,6 +39,7 @@ +@@ -46,6 +47,7 @@ <1536000000>, // RP1_PLL_AUDIO_CORE <200000000>, // RP1_PLL_SYS <125000000>, // RP1_PLL_SYS_SEC @@ -30,7 +30,7 @@ Signed-off-by: Dave Stevenson <61440000>, // RP1_PLL_AUDIO <192000000>, // RP1_PLL_AUDIO_SEC <200000000>, // RP1_CLK_SYS -@@ -968,12 +970,14 @@ +@@ -976,12 +978,14 @@ rp1_eth: ethernet@100000 { reg = <0xc0 0x40100000 0x0 0x4000>; diff --git a/target/linux/bcm27xx/patches-6.6/950-1427-clk-rp1-Add-RP1_CLK_DMA.patch b/target/linux/bcm27xx/patches-6.6/950-1427-clk-rp1-Add-RP1_CLK_DMA.patch index 9026cebaf95b31..b13becd187125b 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1427-clk-rp1-Add-RP1_CLK_DMA.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1427-clk-rp1-Add-RP1_CLK_DMA.patch @@ -1,7 +1,7 @@ From d4e41ed9954fa86c4774f98d393aa401c81a68e7 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Wed, 13 Nov 2024 13:10:27 +0000 -Subject: [PATCH 1427/1482] clk: rp1: Add RP1_CLK_DMA. +Subject: [PATCH] clk: rp1: Add RP1_CLK_DMA. The DMA block has a clock, but wasn't defined in the driver. This resulted in the parent being disabled as unused, and then DMA diff --git a/target/linux/bcm27xx/patches-6.6/950-1428-rp1-clk-Remove-CLK_IGNORE_UNUSED-flags.patch b/target/linux/bcm27xx/patches-6.6/950-1428-rp1-clk-Remove-CLK_IGNORE_UNUSED-flags.patch index 8fa06045a5734c..662a2485dd151b 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1428-rp1-clk-Remove-CLK_IGNORE_UNUSED-flags.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1428-rp1-clk-Remove-CLK_IGNORE_UNUSED-flags.patch @@ -1,7 +1,7 @@ From 9049e4df2c54b5e620f855f66db3a18c9f2e181f Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Fri, 8 Nov 2024 17:37:08 +0000 -Subject: [PATCH 1428/1482] rp1: clk: Remove CLK_IGNORE_UNUSED flags +Subject: [PATCH] rp1: clk: Remove CLK_IGNORE_UNUSED flags There should be no issue in disabling the RP1 clocks as long as the kernel knows about all consumers. diff --git a/target/linux/bcm27xx/patches-6.6/950-1429-dt-rp1-Use-clk_sys-for-ethernet-hclk-and-pclk.patch b/target/linux/bcm27xx/patches-6.6/950-1429-dt-rp1-Use-clk_sys-for-ethernet-hclk-and-pclk.patch index 6d0eb133892ba2..937b1257175c34 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1429-dt-rp1-Use-clk_sys-for-ethernet-hclk-and-pclk.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1429-dt-rp1-Use-clk_sys-for-ethernet-hclk-and-pclk.patch @@ -1,7 +1,7 @@ From 542d0f7f2e9f90fc0f02f8cb141f7c3fbf46081b Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Mon, 11 Nov 2024 17:11:18 +0000 -Subject: [PATCH 1429/1482] dt: rp1: Use clk_sys for ethernet hclk and pclk +Subject: [PATCH] dt: rp1: Use clk_sys for ethernet hclk and pclk hclk and pclk of the MAC are connected to clk_sys, so define them as being connected accordingly, rather than having fake @@ -14,7 +14,7 @@ Signed-off-by: Dave Stevenson --- a/arch/arm64/boot/dts/broadcom/rp1.dtsi +++ b/arch/arm64/boot/dts/broadcom/rp1.dtsi -@@ -974,7 +974,8 @@ +@@ -982,7 +982,8 @@ #address-cells = <1>; #size-cells = <0>; interrupts = ; @@ -24,7 +24,7 @@ Signed-off-by: Dave Stevenson &rp1_clocks RP1_CLK_ETH_TSU &rp1_clocks RP1_CLK_ETH>; clock-names = "pclk", "hclk", "tsu_clk", "tx_clk"; -@@ -1195,18 +1196,6 @@ +@@ -1230,18 +1231,6 @@ clock-output-names = "xosc"; clock-frequency = <50000000>; }; diff --git a/target/linux/bcm27xx/patches-6.6/950-1430-dt-rp1-Link-RP1-DMA-to-the-associated-clock.patch b/target/linux/bcm27xx/patches-6.6/950-1430-dt-rp1-Link-RP1-DMA-to-the-associated-clock.patch index 36d4f8b7236e35..623fcc6cc362ed 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1430-dt-rp1-Link-RP1-DMA-to-the-associated-clock.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1430-dt-rp1-Link-RP1-DMA-to-the-associated-clock.patch @@ -1,7 +1,7 @@ From efecbda4014b490e042c7fd090942b32316f9345 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Wed, 13 Nov 2024 13:11:33 +0000 -Subject: [PATCH 1430/1482] dt: rp1: Link RP1 DMA to the associated clock +Subject: [PATCH] dt: rp1: Link RP1 DMA to the associated clock This makes the kernel representation of the clock structure match reality. @@ -13,7 +13,7 @@ Signed-off-by: Dave Stevenson --- a/arch/arm64/boot/dts/broadcom/rp1.dtsi +++ b/arch/arm64/boot/dts/broadcom/rp1.dtsi -@@ -1061,7 +1061,7 @@ +@@ -1081,7 +1081,7 @@ reg = <0xc0 0x40188000 0x0 0x1000>; compatible = "snps,axi-dma-1.01a"; interrupts = ; diff --git a/target/linux/bcm27xx/patches-6.6/950-1431-raspberrypi-firmware-Add-the-RPI-firmware-UART-APIs.patch b/target/linux/bcm27xx/patches-6.6/950-1431-raspberrypi-firmware-Add-the-RPI-firmware-UART-APIs.patch new file mode 100644 index 00000000000000..7e518bff1cc8cf --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1431-raspberrypi-firmware-Add-the-RPI-firmware-UART-APIs.patch @@ -0,0 +1,23 @@ +From eb035f3ad7da1324d310ef83b42398f47d5bafe7 Mon Sep 17 00:00:00 2001 +From: Tim Gover +Date: Fri, 1 Nov 2024 19:42:17 +0000 +Subject: [PATCH] raspberrypi-firmware: Add the RPI firmware UART APIs + +Add VideoCore mailbox definitions for the new RPi firmware UART. + +Signed-off-by: Tim Gover +--- + include/soc/bcm2835/raspberrypi-firmware.h | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/include/soc/bcm2835/raspberrypi-firmware.h ++++ b/include/soc/bcm2835/raspberrypi-firmware.h +@@ -98,6 +98,8 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_GET_REBOOT_FLAGS = 0x00030064, + RPI_FIRMWARE_SET_REBOOT_FLAGS = 0x00038064, + RPI_FIRMWARE_NOTIFY_DISPLAY_DONE = 0x00030066, ++ RPI_FIRMWARE_GET_SW_UART = 0x0003008a, ++ RPI_FIRMWARE_SET_SW_UART = 0x0003808a, + + /* Dispmanx TAGS */ + RPI_FIRMWARE_FRAMEBUFFER_ALLOCATE = 0x00040001, diff --git a/target/linux/bcm27xx/patches-6.6/950-1432-serial-core-Add-the-Raspberry-Pi-firmware-UART-id.patch b/target/linux/bcm27xx/patches-6.6/950-1432-serial-core-Add-the-Raspberry-Pi-firmware-UART-id.patch new file mode 100644 index 00000000000000..5767f407fe0f6c --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1432-serial-core-Add-the-Raspberry-Pi-firmware-UART-id.patch @@ -0,0 +1,22 @@ +From b8a0e563fd181205565a0edaaebc82b1abf0c5be Mon Sep 17 00:00:00 2001 +From: Tim Gover +Date: Fri, 1 Nov 2024 19:43:21 +0000 +Subject: [PATCH] serial: core: Add the Raspberry Pi firmware UART id + +Assign a new serial core number for the RPi firmware UART. + +Signed-off-by: Tim Gover +--- + include/uapi/linux/serial_core.h | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/include/uapi/linux/serial_core.h ++++ b/include/uapi/linux/serial_core.h +@@ -245,4 +245,7 @@ + /* Sunplus UART */ + #define PORT_SUNPLUS 123 + ++/* RPi firmware UART */ ++#define PORT_RPI_FW 124 ++ + #endif /* _UAPILINUX_SERIAL_CORE_H */ diff --git a/target/linux/bcm27xx/patches-6.6/950-1433-serial-tty-Add-a-driver-for-the-RPi-firmware-UART.patch b/target/linux/bcm27xx/patches-6.6/950-1433-serial-tty-Add-a-driver-for-the-RPi-firmware-UART.patch new file mode 100644 index 00000000000000..f26c1bee860b9f --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1433-serial-tty-Add-a-driver-for-the-RPi-firmware-UART.patch @@ -0,0 +1,630 @@ +From 2548d954d78bca44c5cf430f8ea6de7c771312d7 Mon Sep 17 00:00:00 2001 +From: Tim Gover +Date: Wed, 28 Aug 2024 09:46:50 +0100 +Subject: [PATCH] serial: tty: Add a driver for the RPi firmware UART + +On Raspberry Pi 4 and earlier models the firmware provides +a low speed (up to 115200 baud) bit-bashed UART on arbitrary +GPIOs using the second VPU core. + +The firmware driver is designed to support 19200 baud. Higher +rates up to 115200 seem to work but there may be more jitter. + +This can be useful for debug or managing additional low +speed peripherals if the hardware PL011 and 8250 hardware +UARTs are already used for console / bluetooth. + +The firmware driver requires a fixed core clock frequency +and also requires the VPU PWM audio driver to be disabled +(dtparam=audio=off) + +Runtime configuration is handled via the vc-mailbox APIs +with the FIFO buffers being allocated in uncached VPU +addressable memory. The FIFO pointers are stored in spare +VideoCore multi-core sync registers in order to reduce the number +of uncached SDRAM accesses thereby reducing jitter. + +Signed-off-by: Tim Gover +--- + drivers/tty/serial/Kconfig | 11 + + drivers/tty/serial/Makefile | 1 + + drivers/tty/serial/rpi-fw-uart.c | 563 +++++++++++++++++++++++++++++++ + 3 files changed, 575 insertions(+) + create mode 100644 drivers/tty/serial/rpi-fw-uart.c + +--- a/drivers/tty/serial/Kconfig ++++ b/drivers/tty/serial/Kconfig +@@ -1578,6 +1578,17 @@ config SERIAL_NUVOTON_MA35D1_CONSOLE + but you can alter that using a kernel command line option such as + "console=ttyNVTx". + ++config SERIAL_RPI_FW ++ tristate "Raspberry Pi Firmware software UART support" ++ depends on ARM_AMBA || COMPILE_TEST ++ select SERIAL_CORE ++ help ++ This selects the Raspberry Pi firmware UART. This is a bit-bashed ++ implementation running on the Raspbery Pi VPU core. ++ This is not supported on Raspberry Pi 5 or newer platforms. ++ ++ If unsure, say N. ++ + endmenu + + config SERIAL_MCTRL_GPIO +--- a/drivers/tty/serial/Makefile ++++ b/drivers/tty/serial/Makefile +@@ -88,6 +88,7 @@ obj-$(CONFIG_SERIAL_MILBEAUT_USIO) += mi + obj-$(CONFIG_SERIAL_SIFIVE) += sifive.o + obj-$(CONFIG_SERIAL_LITEUART) += liteuart.o + obj-$(CONFIG_SERIAL_SUNPLUS) += sunplus-uart.o ++obj-$(CONFIG_SERIAL_RPI_FW) += rpi-fw-uart.o + + # GPIOLIB helpers for modem control lines + obj-$(CONFIG_SERIAL_MCTRL_GPIO) += serial_mctrl_gpio.o +--- /dev/null ++++ b/drivers/tty/serial/rpi-fw-uart.c +@@ -0,0 +1,563 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (c) 2024, Raspberry Pi Ltd. All rights reserved. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define RPI_FW_UART_RX_FIFO_RD 0xb0 ++#define RPI_FW_UART_RX_FIFO_WR 0xb4 ++#define RPI_FW_UART_TX_FIFO_RD 0xb8 ++#define RPI_FW_UART_TX_FIFO_WR 0xbc ++ ++#define RPI_FW_UART_FIFO_SIZE 32 ++#define RPI_FW_UART_FIFO_SIZE_MASK (RPI_FW_UART_FIFO_SIZE - 1) ++ ++#define RPI_FW_UART_MIN_VERSION 3 ++ ++struct rpi_fw_uart_params { ++ u32 start; ++ u32 baud; ++ u32 data_bits; ++ u32 stop_bits; ++ u32 gpio_rx; ++ u32 gpio_tx; ++ u32 flags; ++ u32 fifosize; ++ u32 rx_buffer; ++ u32 tx_buffer; ++ u32 version; ++ u32 fifo_reg_base; ++}; ++ ++struct rpi_fw_uart { ++ struct uart_driver driver; ++ struct uart_port port; ++ struct rpi_firmware *firmware; ++ struct gpio_desc *rx_gpiod; ++ struct gpio_desc *tx_gpiod; ++ unsigned int rx_gpio; ++ unsigned int tx_gpio; ++ unsigned int baud; ++ unsigned int data_bits; ++ unsigned int stop_bits; ++ unsigned char __iomem *base; ++ size_t dma_buffer_size; ++ ++ struct hrtimer trigger_start_rx; ++ ktime_t rx_poll_delay; ++ void *rx_buffer; ++ dma_addr_t rx_buffer_dma_addr; ++ int rx_stop; ++ ++ void *tx_buffer; ++ dma_addr_t tx_buffer_dma_addr; ++}; ++ ++static unsigned int rpi_fw_uart_tx_is_full(struct uart_port *port) ++{ ++ struct rpi_fw_uart *rfu = container_of(port, struct rpi_fw_uart, port); ++ u32 rd, wr; ++ ++ rd = readl(rfu->base + RPI_FW_UART_TX_FIFO_RD); ++ wr = readl(rfu->base + RPI_FW_UART_TX_FIFO_WR); ++ return ((wr + 1) & RPI_FW_UART_FIFO_SIZE_MASK) == rd; ++} ++ ++static unsigned int rpi_fw_uart_tx_is_empty(struct uart_port *port) ++{ ++ struct rpi_fw_uart *rfu = container_of(port, struct rpi_fw_uart, port); ++ u32 rd, wr; ++ ++ if (!rfu->tx_buffer) ++ return 1; ++ ++ rd = readl(rfu->base + RPI_FW_UART_TX_FIFO_RD); ++ wr = readl(rfu->base + RPI_FW_UART_TX_FIFO_WR); ++ ++ return rd == wr; ++} ++ ++unsigned int rpi_fw_uart_rx_is_empty(struct uart_port *port) ++{ ++ struct rpi_fw_uart *rfu = container_of(port, struct rpi_fw_uart, port); ++ u32 rd, wr; ++ ++ if (!rfu->rx_buffer) ++ return 1; ++ ++ rd = readl(rfu->base + RPI_FW_UART_RX_FIFO_RD); ++ wr = readl(rfu->base + RPI_FW_UART_RX_FIFO_WR); ++ ++ return rd == wr; ++} ++ ++static unsigned int rpi_fw_uart_tx_empty(struct uart_port *port) ++{ ++ return rpi_fw_uart_tx_is_empty(port) ? TIOCSER_TEMT : 0; ++} ++ ++static void rpi_fw_uart_set_mctrl(struct uart_port *port, unsigned int mctrl) ++{ ++ /* ++ * No hardware flow control, firmware automatically configures ++ * TX to output high and RX to input low. ++ */ ++ dev_dbg(port->dev, "%s mctrl %u\n", __func__, mctrl); ++} ++ ++static unsigned int rpi_fw_uart_get_mctrl(struct uart_port *port) ++{ ++ /* No hardware flow control */ ++ return TIOCM_CTS; ++} ++ ++static void rpi_fw_uart_stop(struct uart_port *port) ++{ ++ struct rpi_fw_uart_params msg = {.start = 0}; ++ struct rpi_fw_uart *rfu = container_of(port, struct rpi_fw_uart, port); ++ ++ hrtimer_cancel(&rfu->trigger_start_rx); ++ ++ if (rpi_firmware_property(rfu->firmware, ++ RPI_FIRMWARE_SET_SW_UART, ++ &msg, sizeof(msg))) ++ dev_warn(port->dev, ++ "Failed to shutdown rpi-fw uart. Firmware not configured?"); ++} ++ ++static void rpi_fw_uart_stop_tx(struct uart_port *port) ++{ ++ /* No supported by the current firmware APIs. */ ++} ++ ++static void rpi_fw_uart_stop_rx(struct uart_port *port) ++{ ++ struct rpi_fw_uart *rfu = container_of(port, struct rpi_fw_uart, port); ++ ++ rfu->rx_stop = 1; ++} ++ ++static unsigned int rpi_fw_write(struct uart_port *port, const char *s, ++ unsigned int count) ++{ ++ struct rpi_fw_uart *rfu = container_of(port, struct rpi_fw_uart, port); ++ u8 *out = rfu->tx_buffer; ++ unsigned int consumed = 0; ++ ++ while (consumed < count && !rpi_fw_uart_tx_is_full(port)) { ++ u32 wp = readl(rfu->base + RPI_FW_UART_TX_FIFO_WR) ++ & RPI_FW_UART_FIFO_SIZE_MASK; ++ out[wp] = s[consumed++]; ++ wp = (wp + 1) & RPI_FW_UART_FIFO_SIZE_MASK; ++ writel(wp, rfu->base + RPI_FW_UART_TX_FIFO_WR); ++ } ++ return consumed; ++} ++ ++/* Called with port.lock taken */ ++static void rpi_fw_uart_start_tx(struct uart_port *port) ++{ ++ struct circ_buf *xmit; ++ ++ xmit = &port->state->xmit; ++ for (;;) { ++ unsigned int consumed; ++ unsigned long count = CIRC_CNT_TO_END(xmit->head, xmit->tail, ++ UART_XMIT_SIZE); ++ if (!count) ++ break; ++ ++ consumed = rpi_fw_write(port, &xmit->buf[xmit->tail], count); ++ uart_xmit_advance(port, consumed); ++ } ++ uart_write_wakeup(port); ++} ++ ++/* Called with port.lock taken */ ++static void rpi_fw_uart_start_rx(struct uart_port *port) ++{ ++ struct tty_port *tty_port = &port->state->port; ++ struct rpi_fw_uart *rfu = container_of(port, struct rpi_fw_uart, port); ++ int count = 0; ++ ++ /* ++ * RX is polled, read up to a full buffer of data before trying again ++ * so that this can be interrupted if the firmware is filling the ++ * buffer too fast ++ */ ++ while (!rpi_fw_uart_rx_is_empty(port) && count < port->fifosize) { ++ const u8 *in = rfu->rx_buffer; ++ u32 rp = readl(rfu->base + RPI_FW_UART_RX_FIFO_RD) ++ & RPI_FW_UART_FIFO_SIZE_MASK; ++ ++ tty_insert_flip_char(tty_port, in[rp], TTY_NORMAL); ++ rp = (rp + 1) & RPI_FW_UART_FIFO_SIZE_MASK; ++ writel(rp, rfu->base + RPI_FW_UART_RX_FIFO_RD); ++ count++; ++ } ++ if (count) ++ tty_flip_buffer_push(tty_port); ++} ++ ++static enum hrtimer_restart rpi_fw_uart_trigger_rx(struct hrtimer *t) ++{ ++ unsigned long flags; ++ struct rpi_fw_uart *rfu = container_of(t, struct rpi_fw_uart, ++ trigger_start_rx); ++ ++ spin_lock_irqsave(&rfu->port.lock, flags); ++ if (rfu->rx_stop) { ++ spin_unlock_irqrestore(&rfu->port.lock, flags); ++ return HRTIMER_NORESTART; ++ } ++ ++ rpi_fw_uart_start_rx(&rfu->port); ++ spin_unlock_irqrestore(&rfu->port.lock, flags); ++ hrtimer_forward_now(t, rfu->rx_poll_delay); ++ return HRTIMER_RESTART; ++} ++ ++static void rpi_fw_uart_break_ctl(struct uart_port *port, int ctl) ++{ ++ dev_dbg(port->dev, "%s ctl %d\n", __func__, ctl); ++} ++ ++static int rpi_fw_uart_configure(struct uart_port *port) ++{ ++ struct rpi_fw_uart *rfu = container_of(port, struct rpi_fw_uart, port); ++ struct rpi_fw_uart_params msg; ++ unsigned long flags; ++ int rc; ++ ++ rpi_fw_uart_stop(port); ++ ++ memset(&msg, 0, sizeof(msg)); ++ msg.start = 1; ++ msg.gpio_rx = rfu->rx_gpio; ++ msg.gpio_tx = rfu->tx_gpio; ++ msg.data_bits = rfu->data_bits; ++ msg.stop_bits = rfu->stop_bits; ++ msg.baud = rfu->baud; ++ msg.fifosize = RPI_FW_UART_FIFO_SIZE; ++ msg.rx_buffer = (u32) rfu->rx_buffer_dma_addr; ++ msg.tx_buffer = (u32) rfu->tx_buffer_dma_addr; ++ ++ rfu->rx_poll_delay = ms_to_ktime(50); ++ ++ /* ++ * Reconfigures the firmware UART with the new settings. On the first ++ * call retrieve the addresses of the FIFO buffers. The buffers are ++ * allocated at startup and are not de-allocated. ++ * NB rpi_firmware_property can block ++ */ ++ rc = rpi_firmware_property(rfu->firmware, ++ RPI_FIRMWARE_SET_SW_UART, ++ &msg, sizeof(msg)); ++ if (rc) ++ goto fail; ++ ++ rc = rpi_firmware_property(rfu->firmware, ++ RPI_FIRMWARE_GET_SW_UART, ++ &msg, sizeof(msg)); ++ if (rc) ++ goto fail; ++ ++ dev_dbg(port->dev, "version %08x, reg addr %x\n", msg.version, ++ msg.fifo_reg_base); ++ ++ dev_info(port->dev, "started %d baud %u data %u stop %u rx %u tx %u flags %u fifosize %u\n", ++ msg.start, msg.baud, msg.data_bits, msg.stop_bits, ++ msg.gpio_rx, msg.gpio_tx, msg.flags, msg.fifosize); ++ ++ if (msg.fifosize != port->fifosize) { ++ dev_err(port->dev, "Expected fifo size %u actual %u", ++ port->fifosize, msg.fifosize); ++ rc = -EINVAL; ++ goto fail; ++ } ++ ++ if (!msg.start) { ++ dev_err(port->dev, "Firmware service not running\n"); ++ rc = -EINVAL; ++ } ++ ++ spin_lock_irqsave(&rfu->port.lock, flags); ++ rfu->rx_stop = 0; ++ hrtimer_start(&rfu->trigger_start_rx, ++ rfu->rx_poll_delay, HRTIMER_MODE_REL); ++ spin_unlock_irqrestore(&rfu->port.lock, flags); ++ return 0; ++fail: ++ dev_err(port->dev, "Failed to configure rpi-fw uart. Firmware not configured?"); ++ return rc; ++} ++ ++static void rpi_fw_uart_free_buffers(struct uart_port *port) ++{ ++ struct rpi_fw_uart *rfu = container_of(port, struct rpi_fw_uart, port); ++ ++ if (rfu->rx_buffer) ++ dma_free_coherent(port->dev, rfu->dma_buffer_size, ++ rfu->rx_buffer, GFP_ATOMIC); ++ ++ if (rfu->tx_buffer) ++ dma_free_coherent(port->dev, rfu->dma_buffer_size, ++ rfu->tx_buffer, GFP_ATOMIC); ++ ++ rfu->rx_buffer = NULL; ++ rfu->tx_buffer = NULL; ++ rfu->rx_buffer_dma_addr = 0; ++ rfu->tx_buffer_dma_addr = 0; ++} ++ ++static int rpi_fw_uart_alloc_buffers(struct uart_port *port) ++{ ++ struct rpi_fw_uart *rfu = container_of(port, struct rpi_fw_uart, port); ++ ++ if (rfu->tx_buffer) ++ return 0; ++ ++ rfu->dma_buffer_size = PAGE_ALIGN(RPI_FW_UART_FIFO_SIZE); ++ ++ rfu->rx_buffer = dma_alloc_coherent(port->dev, rfu->dma_buffer_size, ++ &rfu->rx_buffer_dma_addr, GFP_ATOMIC); ++ ++ if (!rfu->rx_buffer) ++ goto alloc_fail; ++ ++ rfu->tx_buffer = dma_alloc_coherent(port->dev, rfu->dma_buffer_size, ++ &rfu->tx_buffer_dma_addr, GFP_ATOMIC); ++ ++ if (!rfu->tx_buffer) ++ goto alloc_fail; ++ ++ dev_dbg(port->dev, "alloc-buffers %p %x %p %x\n", ++ rfu->rx_buffer, (u32) rfu->rx_buffer_dma_addr, ++ rfu->tx_buffer, (u32) rfu->tx_buffer_dma_addr); ++ return 0; ++ ++alloc_fail: ++ dev_err(port->dev, "%s uart buffer allocation failed\n", __func__); ++ rpi_fw_uart_free_buffers(port); ++ return -ENOMEM; ++} ++ ++static int rpi_fw_uart_startup(struct uart_port *port) ++{ ++ int rc; ++ ++ rc = rpi_fw_uart_alloc_buffers(port); ++ if (rc) ++ dev_err(port->dev, "Failed to start\n"); ++ return rc; ++} ++ ++static void rpi_fw_uart_shutdown(struct uart_port *port) ++{ ++ rpi_fw_uart_stop(port); ++ rpi_fw_uart_free_buffers(port); ++} ++ ++static void rpi_fw_uart_set_termios(struct uart_port *port, ++ struct ktermios *new, ++ const struct ktermios *old) ++{ ++ struct rpi_fw_uart *rfu = ++ container_of(port, struct rpi_fw_uart, port); ++ rfu->baud = uart_get_baud_rate(port, new, old, 50, 115200); ++ rfu->stop_bits = (new->c_cflag & CSTOPB) ? 2 : 1; ++ ++ rpi_fw_uart_configure(port); ++} ++ ++static const struct uart_ops rpi_fw_uart_ops = { ++ .tx_empty = rpi_fw_uart_tx_empty, ++ .set_mctrl = rpi_fw_uart_set_mctrl, ++ .get_mctrl = rpi_fw_uart_get_mctrl, ++ .stop_rx = rpi_fw_uart_stop_rx, ++ .stop_tx = rpi_fw_uart_stop_tx, ++ .start_tx = rpi_fw_uart_start_tx, ++ .break_ctl = rpi_fw_uart_break_ctl, ++ .startup = rpi_fw_uart_startup, ++ .shutdown = rpi_fw_uart_shutdown, ++ .set_termios = rpi_fw_uart_set_termios, ++}; ++ ++static int rpi_fw_uart_get_gpio_offset(struct device *dev, const char *name) ++{ ++ struct of_phandle_args of_args = { 0 }; ++ bool is_bcm28xx; ++ ++ /* This really shouldn't fail, given that we have a gpiod */ ++ if (of_parse_phandle_with_args(dev->of_node, name, "#gpio-cells", 0, &of_args)) ++ return dev_err_probe(dev, -EINVAL, "can't find gpio declaration\n"); ++ ++ is_bcm28xx = of_device_is_compatible(of_args.np, "brcm,bcm2835-gpio") || ++ of_device_is_compatible(of_args.np, "brcm,bcm2711-gpio"); ++ of_node_put(of_args.np); ++ if (!is_bcm28xx || of_args.args_count != 2) ++ return dev_err_probe(dev, -EINVAL, "not a BCM28xx gpio\n"); ++ ++ return of_args.args[0]; ++} ++ ++static int rpi_fw_uart_probe(struct platform_device *pdev) ++{ ++ struct device_node *firmware_node; ++ struct device *dev = &pdev->dev; ++ struct rpi_firmware *firmware; ++ struct uart_port *port; ++ struct rpi_fw_uart *rfu; ++ struct rpi_fw_uart_params msg; ++ int version_major; ++ int err; ++ ++ dev_dbg(dev, "%s of_node %p\n", __func__, dev->of_node); ++ ++ /* ++ * We can be probed either through the an old-fashioned ++ * platform device registration or through a DT node that is a ++ * child of the firmware node. Handle both cases. ++ */ ++ if (dev->of_node) ++ firmware_node = of_parse_phandle(dev->of_node, "firmware", 0); ++ else ++ firmware_node = of_find_compatible_node(NULL, NULL, ++ "raspberrypi,bcm2835-firmware"); ++ if (!firmware_node) { ++ dev_err(dev, "Missing firmware node\n"); ++ return -ENOENT; ++ } ++ ++ firmware = devm_rpi_firmware_get(dev, firmware_node); ++ of_node_put(firmware_node); ++ if (!firmware) ++ return -EPROBE_DEFER; ++ ++ rfu = devm_kzalloc(dev, sizeof(*rfu), GFP_KERNEL); ++ if (!rfu) ++ return -ENOMEM; ++ ++ rfu->firmware = firmware; ++ ++ err = rpi_firmware_property(rfu->firmware, RPI_FIRMWARE_GET_SW_UART, ++ &msg, sizeof(msg)); ++ if (err) { ++ dev_err(dev, "VC firmware does not support rpi-fw-uart\n"); ++ return err; ++ } ++ ++ version_major = msg.version >> 16; ++ if (msg.version < RPI_FW_UART_MIN_VERSION) { ++ dev_err(dev, "rpi-fw-uart fw version %d is too old min version %d\n", ++ version_major, RPI_FW_UART_MIN_VERSION); ++ return -EINVAL; ++ } ++ ++ rfu->rx_gpiod = devm_gpiod_get(dev, "rx", GPIOD_IN); ++ if (IS_ERR(rfu->rx_gpiod)) ++ return PTR_ERR(rfu->rx_gpiod); ++ ++ rfu->tx_gpiod = devm_gpiod_get(dev, "tx", GPIOD_OUT_HIGH); ++ if (IS_ERR(rfu->tx_gpiod)) ++ return PTR_ERR(rfu->tx_gpiod); ++ ++ rfu->rx_gpio = rpi_fw_uart_get_gpio_offset(dev, "rx-gpios"); ++ if (rfu->rx_gpio < 0) ++ return rfu->rx_gpio; ++ rfu->tx_gpio = rpi_fw_uart_get_gpio_offset(dev, "tx-gpios"); ++ if (rfu->tx_gpio < 0) ++ return rfu->tx_gpio; ++ ++ rfu->base = devm_platform_ioremap_resource(pdev, 0); ++ if (IS_ERR(rfu->base)) ++ return PTR_ERR(rfu->base); ++ ++ /* setup the driver */ ++ rfu->driver.owner = THIS_MODULE; ++ rfu->driver.driver_name = "ttyRFU"; ++ rfu->driver.dev_name = "ttyRFU"; ++ rfu->driver.nr = 1; ++ rfu->data_bits = 8; ++ ++ /* RX is polled */ ++ hrtimer_init(&rfu->trigger_start_rx, CLOCK_MONOTONIC, HRTIMER_MODE_REL); ++ rfu->trigger_start_rx.function = rpi_fw_uart_trigger_rx; ++ ++ err = uart_register_driver(&rfu->driver); ++ if (err) { ++ dev_err(dev, "failed to register UART driver: %d\n", ++ err); ++ return err; ++ } ++ ++ /* setup the port */ ++ port = &rfu->port; ++ spin_lock_init(&port->lock); ++ port->dev = &pdev->dev; ++ port->type = PORT_RPI_FW; ++ port->ops = &rpi_fw_uart_ops; ++ port->fifosize = RPI_FW_UART_FIFO_SIZE; ++ port->iotype = UPIO_MEM; ++ port->flags = UPF_BOOT_AUTOCONF; ++ port->private_data = rfu; ++ ++ err = uart_add_one_port(&rfu->driver, port); ++ if (err) { ++ dev_err(dev, "failed to add UART port: %d\n", err); ++ goto unregister_uart; ++ } ++ platform_set_drvdata(pdev, rfu); ++ ++ dev_info(dev, "version %d.%d gpios tx %u rx %u\n", ++ msg.version >> 16, msg.version & 0xffff, ++ rfu->tx_gpio, rfu->rx_gpio); ++ return 0; ++ ++unregister_uart: ++ uart_unregister_driver(&rfu->driver); ++ ++ return err; ++} ++ ++static int rpi_fw_uart_remove(struct platform_device *pdev) ++{ ++ struct rpi_fw_uart *rfu = platform_get_drvdata(pdev); ++ ++ uart_remove_one_port(&rfu->driver, &rfu->port); ++ uart_unregister_driver(&rfu->driver); ++ ++ return 0; ++} ++ ++static const struct of_device_id rpi_fw_match[] = { ++ { .compatible = "raspberrypi,firmware-uart" }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, rpi_fw_match); ++ ++static struct platform_driver rpi_fw_driver = { ++ .driver = { ++ .name = "rpi_fw-uart", ++ .of_match_table = rpi_fw_match, ++ }, ++ .probe = rpi_fw_uart_probe, ++ .remove = rpi_fw_uart_remove, ++}; ++module_platform_driver(rpi_fw_driver); ++ ++MODULE_AUTHOR("Tim Gover "); ++MODULE_LICENSE("GPL"); ++MODULE_DESCRIPTION("Raspberry Pi Firmware Software UART driver"); diff --git a/target/linux/bcm27xx/patches-6.6/950-1435-dtoverlay-Add-an-overlay-for-the-Raspberry-Pi-firmwa.patch b/target/linux/bcm27xx/patches-6.6/950-1435-dtoverlay-Add-an-overlay-for-the-Raspberry-Pi-firmwa.patch new file mode 100644 index 00000000000000..0e4b3e37475211 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1435-dtoverlay-Add-an-overlay-for-the-Raspberry-Pi-firmwa.patch @@ -0,0 +1,95 @@ +From b6b126861062020fb50859c5af71d8846ce43d7c Mon Sep 17 00:00:00 2001 +From: Tim Gover +Date: Mon, 4 Nov 2024 13:44:10 +0000 +Subject: [PATCH] dtoverlay: Add an overlay for the Raspberry Pi firmware UART + +Add a device-tree overlay to configure the GPIOs for the +Raspberry Pi firmware UART. + +Example config.txt +dtoverlay=rpi-fw-uart,txd0_pin=20,rxd0_pin=21 + +Signed-off-by: Phil Elwell +Signed-off-by: Tim Gover +--- + arch/arm/boot/dts/overlays/Makefile | 1 + + arch/arm/boot/dts/overlays/README | 12 ++++++ + .../boot/dts/overlays/rpi-fw-uart-overlay.dts | 41 +++++++++++++++++++ + 3 files changed, 54 insertions(+) + create mode 100644 arch/arm/boot/dts/overlays/rpi-fw-uart-overlay.dts + +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -233,6 +233,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ + rpi-dacpro.dtbo \ + rpi-digiampplus.dtbo \ + rpi-ft5406.dtbo \ ++ rpi-fw-uart.dtbo \ + rpi-poe.dtbo \ + rpi-poe-plus.dtbo \ + rpi-sense.dtbo \ +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -4141,6 +4141,18 @@ Params: touchscreen-size-x Touchscr + touchscreen-swapped-x-y Swap X and Y cordinates (default 0); + + ++Name: rpi-fw-uart ++Info: Configures the firmware software UART driver. ++ This driver requires exclusive usage of the second VPU core. The ++ following config.txt entries should be set when this driver is used. ++ dtparam=audio=off ++ isp_use_vpu0=1 ++Load: dtoverlay=rpi-fw-uart,[=] ++Params: txd0_pin GPIO pin for TXD0 (any free - default 20) ++ ++ rxd0_pin GPIO pin for RXD0 (any free - default 21) ++ ++ + Name: rpi-poe + Info: Raspberry Pi PoE HAT fan + Load: dtoverlay=rpi-poe,[=] +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rpi-fw-uart-overlay.dts +@@ -0,0 +1,41 @@ ++// SPDX-License-Identifier: GPL-2.0 ++// Overlay for the Raspberry Pi Firmware UART driver ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2835"; ++ ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ rpi_fw_uart_pins: rpi_fw_uart_pins@4 { ++ brcm,pins = <20 21>; ++ brcm,function = <1 0>; /* output input */ ++ brcm,pull = <0 2>; /* none pull-up */ ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&soc>; ++ __overlay__ { ++ rpi_fw_uart: rpi_fw_uart@7e000000 { ++ compatible = "raspberrypi,firmware-uart"; ++ reg = <0x7e000000 0x100>; /* VideoCore MS sync regs */ ++ firmware = <&firmware>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rpi_fw_uart_pins>; ++ tx-gpios = <&gpio 20 0>; ++ rx-gpios = <&gpio 21 0>; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ txd0_pin = <&rpi_fw_uart>,"tx-gpios:4", ++ <&rpi_fw_uart_pins>, "brcm,pins:0"; ++ rxd0_pin = <&rpi_fw_uart>,"rx-gpios:4", ++ <&rpi_fw_uart_pins>, "brcm,pins:4"; ++ }; ++}; diff --git a/target/linux/bcm27xx/patches-6.6/950-1436-ARM-dts-Remove-duplicate-tags.patch b/target/linux/bcm27xx/patches-6.6/950-1436-ARM-dts-Remove-duplicate-tags.patch new file mode 100644 index 00000000000000..7829a4b753dbe4 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1436-ARM-dts-Remove-duplicate-tags.patch @@ -0,0 +1,142 @@ +From 1993b453dc4a62378e90d91e9e0006a6c085f38a Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 18 Sep 2024 10:23:41 +0100 +Subject: [PATCH] ARM: dts: Remove duplicate tags + +A dts file should have exactly one /dts-v1/ tag, and overlays should +also have one /plugin/ tag. Through careless inclusion of other files, +some Device Trees and overlays end up with duplicated tags - this +commit removes them. + +The change is largely cosmetic, unless using an old version of dtc. + +Signed-off-by: Phil Elwell +--- + arch/arm/boot/dts/broadcom/bcm2711-rpi-400.dts | 1 - + arch/arm/boot/dts/overlays/i2c-sensor-common.dtsi | 3 --- + arch/arm/boot/dts/overlays/imx290_327-overlay.dtsi | 2 -- + arch/arm/boot/dts/overlays/pisound-pi5-overlay.dts | 3 --- + arch/arm/boot/dts/overlays/vc4-fkms-v3d-overlay.dts | 3 --- + arch/arm/boot/dts/overlays/vc4-fkms-v3d-pi4-overlay.dts | 3 --- + arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts | 3 --- + arch/arm/boot/dts/overlays/vc4-kms-v3d-pi4-overlay.dts | 3 --- + arch/arm/boot/dts/overlays/w1-gpio-pi5-overlay.dts | 3 --- + arch/arm/boot/dts/overlays/w1-gpio-pullup-pi5-overlay.dts | 3 --- + arch/arm64/boot/dts/broadcom/bcm2712-rpi-cm5l.dtsi | 1 - + 11 files changed, 28 deletions(-) + +--- a/arch/arm/boot/dts/broadcom/bcm2711-rpi-400.dts ++++ b/arch/arm/boot/dts/broadcom/bcm2711-rpi-400.dts +@@ -1,5 +1,4 @@ + // SPDX-License-Identifier: GPL-2.0 +-/dts-v1/; + #include "bcm2711-rpi-4-b.dts" + + / { +--- a/arch/arm/boot/dts/overlays/i2c-sensor-common.dtsi ++++ b/arch/arm/boot/dts/overlays/i2c-sensor-common.dtsi +@@ -1,7 +1,4 @@ + // Definitions for I2C based sensors using the Industrial IO or HWMON interface. +-/dts-v1/; +-/plugin/; +- + #include + + / { +--- a/arch/arm/boot/dts/overlays/imx290_327-overlay.dtsi ++++ b/arch/arm/boot/dts/overlays/imx290_327-overlay.dtsi +@@ -1,8 +1,6 @@ + // SPDX-License-Identifier: GPL-2.0-only + // Partial definitions for IMX290 or IMX327 camera module on VC I2C bus + // The compatible string should be set in an overlay that then includes this one +-/dts-v1/; +-/plugin/; + + #include + +--- a/arch/arm/boot/dts/overlays/pisound-pi5-overlay.dts ++++ b/arch/arm/boot/dts/overlays/pisound-pi5-overlay.dts +@@ -17,9 +17,6 @@ + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +-/dts-v1/; +-/plugin/; +- + #include "pisound-overlay.dts" + + &pisound_spi { +--- a/arch/arm/boot/dts/overlays/vc4-fkms-v3d-overlay.dts ++++ b/arch/arm/boot/dts/overlays/vc4-fkms-v3d-overlay.dts +@@ -2,9 +2,6 @@ + * vc4-fkms-v3d-overlay.dts + */ + +-/dts-v1/; +-/plugin/; +- + #include "cma-overlay.dts" + + / { +--- a/arch/arm/boot/dts/overlays/vc4-fkms-v3d-pi4-overlay.dts ++++ b/arch/arm/boot/dts/overlays/vc4-fkms-v3d-pi4-overlay.dts +@@ -2,9 +2,6 @@ + * vc4-fkms-v3d-overlay.dts + */ + +-/dts-v1/; +-/plugin/; +- + #include "cma-overlay.dts" + + &frag0 { +--- a/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts ++++ b/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts +@@ -2,9 +2,6 @@ + * vc4-kms-v3d-overlay.dts + */ + +-/dts-v1/; +-/plugin/; +- + #include + + #include "cma-overlay.dts" +--- a/arch/arm/boot/dts/overlays/vc4-kms-v3d-pi4-overlay.dts ++++ b/arch/arm/boot/dts/overlays/vc4-kms-v3d-pi4-overlay.dts +@@ -2,9 +2,6 @@ + * vc4-kms-v3d-pi4-overlay.dts + */ + +-/dts-v1/; +-/plugin/; +- + #include + + #include "cma-overlay.dts" +--- a/arch/arm/boot/dts/overlays/w1-gpio-pi5-overlay.dts ++++ b/arch/arm/boot/dts/overlays/w1-gpio-pi5-overlay.dts +@@ -1,6 +1,3 @@ +-/dts-v1/; +-/plugin/; +- + #include "w1-gpio-overlay.dts" + + / { +--- a/arch/arm/boot/dts/overlays/w1-gpio-pullup-pi5-overlay.dts ++++ b/arch/arm/boot/dts/overlays/w1-gpio-pullup-pi5-overlay.dts +@@ -1,6 +1,3 @@ +-/dts-v1/; +-/plugin/; +- + #include "w1-gpio-pullup-overlay.dts" + + / { +--- a/arch/arm64/boot/dts/broadcom/bcm2712-rpi-cm5l.dtsi ++++ b/arch/arm64/boot/dts/broadcom/bcm2712-rpi-cm5l.dtsi +@@ -1,5 +1,4 @@ + // SPDX-License-Identifier: GPL-2.0 +-/dts-v1/; + + #include "bcm2712-rpi-cm5.dtsi" + diff --git a/target/linux/bcm27xx/patches-6.6/950-1437-Allow-setting-I-C-clock-frequency-via-i2c_arm_baudra.patch b/target/linux/bcm27xx/patches-6.6/950-1437-Allow-setting-I-C-clock-frequency-via-i2c_arm_baudra.patch new file mode 100644 index 00000000000000..1d14a0bfec6bfb --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1437-Allow-setting-I-C-clock-frequency-via-i2c_arm_baudra.patch @@ -0,0 +1,25 @@ +From e33702e5e5fe9fef6ec967961e2e5e1c2285ba36 Mon Sep 17 00:00:00 2001 +From: gtrainavicius +Date: Wed, 4 Dec 2024 11:18:14 +0200 +Subject: [PATCH] =?UTF-8?q?Allow=20setting=20I=C2=B2C=20clock=20frequency?= + =?UTF-8?q?=20via=20i2c=5Farm=5Fbaudrate=20dtparam=20when=20using=20pimidi?= + =?UTF-8?q?=20overlay.?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This change removes the forced 1MHz clock frequency, so it can be overridden using `i2c_arm_baudrate`. +--- + arch/arm/boot/dts/overlays/pimidi-overlay.dts | 1 - + 1 file changed, 1 deletion(-) + +--- a/arch/arm/boot/dts/overlays/pimidi-overlay.dts ++++ b/arch/arm/boot/dts/overlays/pimidi-overlay.dts +@@ -26,7 +26,6 @@ + target = <&i2c_arm>; + __overlay__ { + status = "okay"; +- clock-frequency=<1000000>; + + pimidi_ctrl: pimidi_ctrl@20 { + compatible = "blokaslabs,pimidi"; diff --git a/target/linux/bcm27xx/patches-6.6/950-1438-nvme-pci-Disable-Host-Memory-Buffer-usage.patch b/target/linux/bcm27xx/patches-6.6/950-1438-nvme-pci-Disable-Host-Memory-Buffer-usage.patch new file mode 100644 index 00000000000000..4f1ea9249c65a8 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1438-nvme-pci-Disable-Host-Memory-Buffer-usage.patch @@ -0,0 +1,48 @@ +From fda47c026dee7acd975ee2c0f7a440d4038cfaa3 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 3 Dec 2024 15:57:01 +0000 +Subject: [PATCH] nvme-pci: Disable Host Memory Buffer usage + +Some NVME drives seem to request significant amounts of DMA coherent +memory - enough to exhaust our standard 64MB CMA allocation. + +Try disabling the feature to see what effect it has - drives should +continue to function without it. + +Link: https://github.com/raspberrypi/linux/issues/6504 + +Signed-off-by: Phil Elwell +--- + drivers/nvme/host/pci.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/nvme/host/pci.c ++++ b/drivers/nvme/host/pci.c +@@ -1932,6 +1932,7 @@ static void nvme_free_host_mem(struct nv + dev->nr_host_mem_descs = 0; + } + ++#if 0 + static int __nvme_alloc_host_mem(struct nvme_dev *dev, u64 preferred, + u32 chunk_size) + { +@@ -2000,9 +2001,11 @@ out: + dev->host_mem_descs = NULL; + return -ENOMEM; + } ++#endif + + static int nvme_alloc_host_mem(struct nvme_dev *dev, u64 min, u64 preferred) + { ++#if 0 + u64 min_chunk = min_t(u64, preferred, PAGE_SIZE * MAX_ORDER_NR_PAGES); + u64 hmminds = max_t(u32, dev->ctrl.hmminds * 4096, PAGE_SIZE * 2); + u64 chunk_size; +@@ -2015,6 +2018,7 @@ static int nvme_alloc_host_mem(struct nv + nvme_free_host_mem(dev); + } + } ++#endif + + return -ENOMEM; + } diff --git a/target/linux/bcm27xx/patches-6.6/950-1439-fixup-serial-tty-Add-a-driver-for-the-RPi-firmware-U.patch b/target/linux/bcm27xx/patches-6.6/950-1439-fixup-serial-tty-Add-a-driver-for-the-RPi-firmware-U.patch new file mode 100644 index 00000000000000..0f18dc4a8d9815 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1439-fixup-serial-tty-Add-a-driver-for-the-RPi-firmware-U.patch @@ -0,0 +1,23 @@ +From 0313a0961b685973f7833017479a277e3a4c05a4 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 4 Dec 2024 14:40:59 +0000 +Subject: [PATCH] fixup! serial: tty: Add a driver for the RPi firmware UART + +Make SERIAL_RPI_FW depend on RASPBERRYPI_FIRMWARE. + +Signed-off-by: Phil Elwell +--- + drivers/tty/serial/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/tty/serial/Kconfig ++++ b/drivers/tty/serial/Kconfig +@@ -1580,7 +1580,7 @@ config SERIAL_NUVOTON_MA35D1_CONSOLE + + config SERIAL_RPI_FW + tristate "Raspberry Pi Firmware software UART support" +- depends on ARM_AMBA || COMPILE_TEST ++ depends on RASPBERRYPI_FIRMWARE || COMPILE_TEST + select SERIAL_CORE + help + This selects the Raspberry Pi firmware UART. This is a bit-bashed diff --git a/target/linux/bcm27xx/patches-6.6/950-1440-serial-rpi-fw-uart-Demote-debug-log-messages.patch b/target/linux/bcm27xx/patches-6.6/950-1440-serial-rpi-fw-uart-Demote-debug-log-messages.patch new file mode 100644 index 00000000000000..271f743286a4b8 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1440-serial-rpi-fw-uart-Demote-debug-log-messages.patch @@ -0,0 +1,28 @@ +From 0a5be0fe6ba3a981508421131def7eab55d6d75c Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 5 Dec 2024 12:08:23 +0000 +Subject: [PATCH] serial: rpi-fw-uart: Demote debug log messages + +A dev_info call in rpi_fw_uart_configure causes kernel log output every +time one opens the UART. Demote it to dev_dbg. + +Signed-off-by: Phil Elwell +--- + drivers/tty/serial/rpi-fw-uart.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/tty/serial/rpi-fw-uart.c ++++ b/drivers/tty/serial/rpi-fw-uart.c +@@ -277,9 +277,9 @@ static int rpi_fw_uart_configure(struct + dev_dbg(port->dev, "version %08x, reg addr %x\n", msg.version, + msg.fifo_reg_base); + +- dev_info(port->dev, "started %d baud %u data %u stop %u rx %u tx %u flags %u fifosize %u\n", +- msg.start, msg.baud, msg.data_bits, msg.stop_bits, +- msg.gpio_rx, msg.gpio_tx, msg.flags, msg.fifosize); ++ dev_dbg(port->dev, "started %d baud %u data %u stop %u rx %u tx %u flags %u fifosize %u\n", ++ msg.start, msg.baud, msg.data_bits, msg.stop_bits, ++ msg.gpio_rx, msg.gpio_tx, msg.flags, msg.fifosize); + + if (msg.fifosize != port->fifosize) { + dev_err(port->dev, "Expected fifo size %u actual %u", diff --git a/target/linux/bcm27xx/patches-6.6/950-1441-dtoverlays-Add-Arducam-override-for-ov9281.patch b/target/linux/bcm27xx/patches-6.6/950-1441-dtoverlays-Add-Arducam-override-for-ov9281.patch new file mode 100644 index 00000000000000..354ff961fe098c --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1441-dtoverlays-Add-Arducam-override-for-ov9281.patch @@ -0,0 +1,55 @@ +From 02dee262a9c7295ea514e9db7b9aa4b239922cb3 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Mon, 2 Dec 2024 15:41:21 +0000 +Subject: [PATCH] dtoverlays: Add Arducam override for ov9281 + +The Arducam module is slow starting up, so add an override +to slow the regulator down. +https://forums.raspberrypi.com/viewtopic.php?t=380236 + +Signed-off-by: Dave Stevenson +--- + arch/arm/boot/dts/overlays/README | 2 ++ + arch/arm/boot/dts/overlays/ov9281-overlay.dts | 13 ++++++++++++- + 2 files changed, 14 insertions(+), 1 deletion(-) + +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -3538,6 +3538,8 @@ Params: rotation Mounting + configuring the sensor (default on) + cam0 Adopt the default configuration for CAM0 on a + Compute Module (CSI0, i2c_vc, and cam0_reg). ++ arducam Slow down the regulator for slow Arducam ++ modules. + + + Name: papirus +--- a/arch/arm/boot/dts/overlays/ov9281-overlay.dts ++++ b/arch/arm/boot/dts/overlays/ov9281-overlay.dts +@@ -57,6 +57,14 @@ + }; + }; + ++ reg_frag: fragment@5 { ++ target = <&cam1_reg>; ++ __dormant__ { ++ startup-delay-us = <20000>; ++ off-on-delay-us = <30000>; ++ }; ++ }; ++ + __overrides__ { + rotation = <&cam_node>,"rotation:0"; + orientation = <&cam_node>,"orientation:0"; +@@ -65,7 +73,10 @@ + <&csi_frag>, "target:0=",<&csi0>, + <&clk_frag>, "target:0=",<&cam0_clk>, + <&cam_node>, "clocks:0=",<&cam0_clk>, +- <&cam_node>, "avdd-supply:0=",<&cam0_reg>; ++ <&cam_node>, "avdd-supply:0=",<&cam0_reg>, ++ <®_frag>, "target:0=",<&cam0_reg>; ++ arducam = <0>, "+5"; ++ + }; + }; + diff --git a/target/linux/bcm27xx/patches-6.6/950-1442-drivers-input-touchscreen-Add-support-for-no-irq-to-.patch b/target/linux/bcm27xx/patches-6.6/950-1442-drivers-input-touchscreen-Add-support-for-no-irq-to-.patch new file mode 100644 index 00000000000000..d13982e9badb36 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1442-drivers-input-touchscreen-Add-support-for-no-irq-to-.patch @@ -0,0 +1,118 @@ +From 97638920f1a40e2e0cab363d1e03837ff50c5478 Mon Sep 17 00:00:00 2001 +From: eng33 +Date: Thu, 5 Dec 2024 17:19:23 +0800 +Subject: [PATCH] drivers:input:touchscreen: Add support for no irq to ili210x + driver + +Signed-off-by: eng33 +--- + drivers/input/touchscreen/ili210x.c | 63 ++++++++++++++++++++++++----- + 1 file changed, 52 insertions(+), 11 deletions(-) + +--- a/drivers/input/touchscreen/ili210x.c ++++ b/drivers/input/touchscreen/ili210x.c +@@ -67,6 +67,8 @@ struct ili210x { + u8 version_proto[2]; + u8 ic_mode[2]; + bool stop; ++ struct timer_list poll_timer; ++ struct work_struct poll_work; + }; + + static int ili210x_read_reg(struct i2c_client *client, +@@ -360,6 +362,34 @@ static irqreturn_t ili210x_irq(int irq, + return IRQ_HANDLED; + } + ++static void ili210x_poll_work(struct work_struct *work) ++{ ++ struct ili210x *priv = container_of(work, struct ili210x, poll_work); ++ struct i2c_client *client = priv->client; ++ const struct ili2xxx_chip *chip = priv->chip; ++ u8 touchdata[ILI210X_DATA_SIZE] = { 0 }; ++ bool touch; ++ int error; ++ ++ error = chip->get_touch_data(client, touchdata); ++ if (error) { ++ dev_err(&client->dev, "Unable to get touch data: %d\n", error); ++ return; ++ } ++ ++ touch = ili210x_report_events(priv, touchdata); ++} ++ ++static void ili210x_poll_timer_callback(struct timer_list *t) ++{ ++ struct ili210x *priv = from_timer(priv, t, poll_timer); ++ ++ schedule_work(&priv->poll_work); ++ ++ if (!priv->stop) ++ mod_timer(&priv->poll_timer, jiffies + msecs_to_jiffies(ILI2XXX_POLL_PERIOD)); ++} ++ + static int ili251x_firmware_update_resolution(struct device *dev) + { + struct i2c_client *client = to_i2c_client(dev); +@@ -945,11 +975,6 @@ static int ili210x_i2c_probe(struct i2c_ + return -ENODEV; + } + +- if (client->irq <= 0) { +- dev_err(dev, "No IRQ!\n"); +- return -EINVAL; +- } +- + reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(reset_gpio)) + return PTR_ERR(reset_gpio); +@@ -1001,12 +1026,17 @@ static int ili210x_i2c_probe(struct i2c_ + return error; + } + +- error = devm_request_threaded_irq(dev, client->irq, NULL, ili210x_irq, +- IRQF_ONESHOT, client->name, priv); +- if (error) { +- dev_err(dev, "Unable to request touchscreen IRQ, err: %d\n", +- error); +- return error; ++ if (client->irq) { ++ error = devm_request_threaded_irq(dev, client->irq, NULL, ili210x_irq, ++ IRQF_ONESHOT, client->name, priv); ++ if (error) { ++ dev_err(dev, "Unable to request touchscreen IRQ, err: %d\n", error); ++ return error; ++ } ++ } else { ++ timer_setup(&priv->poll_timer, ili210x_poll_timer_callback, 0); ++ mod_timer(&priv->poll_timer, jiffies + msecs_to_jiffies(ILI2XXX_POLL_PERIOD)); ++ INIT_WORK(&priv->poll_work, ili210x_poll_work); + } + + error = devm_add_action_or_reset(dev, ili210x_stop, priv); +@@ -1029,6 +1059,16 @@ static int ili210x_i2c_probe(struct i2c_ + return 0; + } + ++static void ili210x_i2c_remove(struct i2c_client *client) ++{ ++ struct ili210x *tsdata = i2c_get_clientdata(client); ++ ++ if (!client->irq) { ++ del_timer(&tsdata->poll_timer); ++ cancel_work_sync(&tsdata->poll_work); ++ } ++} ++ + static const struct i2c_device_id ili210x_i2c_id[] = { + { "ili210x", (long)&ili210x_chip }, + { "ili2117", (long)&ili211x_chip }, +@@ -1054,6 +1094,7 @@ static struct i2c_driver ili210x_ts_driv + }, + .id_table = ili210x_i2c_id, + .probe = ili210x_i2c_probe, ++ .remove = ili210x_i2c_remove, + }; + + module_i2c_driver(ili210x_ts_driver); diff --git a/target/linux/bcm27xx/patches-6.6/950-1443-drivers-gpu-drm-panel-Added-waveshare-13.3inch-panel.patch b/target/linux/bcm27xx/patches-6.6/950-1443-drivers-gpu-drm-panel-Added-waveshare-13.3inch-panel.patch new file mode 100644 index 00000000000000..c6861c6a54c4ca --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1443-drivers-gpu-drm-panel-Added-waveshare-13.3inch-panel.patch @@ -0,0 +1,309 @@ +From 4a89fda8f73df89e009a6188ef07ab97b1d03c7f Mon Sep 17 00:00:00 2001 +From: eng33 +Date: Thu, 5 Dec 2024 17:20:22 +0800 +Subject: [PATCH] drivers:gpu:drm:panel: Added waveshare 13.3inch panel(support + 2/4lane) + +Signed-off-by: eng33 +--- + drivers/gpu/drm/panel/panel-waveshare-dsi.c | 155 +++++++++++++++++--- + 1 file changed, 138 insertions(+), 17 deletions(-) + +--- a/drivers/gpu/drm/panel/panel-waveshare-dsi.c ++++ b/drivers/gpu/drm/panel/panel-waveshare-dsi.c +@@ -32,6 +32,12 @@ struct ws_panel { + enum drm_panel_orientation orientation; + }; + ++struct ws_panel_data { ++ const struct drm_display_mode *mode; ++ int lanes; ++ unsigned long mode_flags; ++}; ++ + /* 2.8inch 480x640 + * https://www.waveshare.com/product/raspberry-pi/displays/2.8inch-dsi-lcd.htm + */ +@@ -47,6 +53,12 @@ static const struct drm_display_mode ws_ + .vtotal = 640 + 150 + 50 + 150, + }; + ++static const struct ws_panel_data ws_panel_2_8_data = { ++ .mode = &ws_panel_2_8_mode, ++ .lanes = 2, ++ .mode_flags = MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS, ++}; ++ + /* 3.4inch 800x800 Round + * https://www.waveshare.com/product/displays/lcd-oled/3.4inch-dsi-lcd-c.htm + */ +@@ -62,6 +74,12 @@ static const struct drm_display_mode ws_ + .vtotal = 800 + 8 + 4 + 16, + }; + ++static const struct ws_panel_data ws_panel_3_4_data = { ++ .mode = &ws_panel_3_4_mode, ++ .lanes = 2, ++ .mode_flags = MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS, ++}; ++ + /* 4.0inch 480x800 + * https://www.waveshare.com/product/raspberry-pi/displays/4inch-dsi-lcd.htm + */ +@@ -77,6 +95,12 @@ static const struct drm_display_mode ws_ + .vtotal = 800 + 20 + 100 + 20, + }; + ++static const struct ws_panel_data ws_panel_4_0_data = { ++ .mode = &ws_panel_4_0_mode, ++ .lanes = 2, ++ .mode_flags = MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS, ++}; ++ + /* 7.0inch C 1024x600 + * https://www.waveshare.com/product/raspberry-pi/displays/lcd-oled/7inch-dsi-lcd-c-with-case-a.htm + */ +@@ -92,6 +116,12 @@ static const struct drm_display_mode ws_ + .vtotal = 600 + 10 + 10 + 10, + }; + ++static const struct ws_panel_data ws_panel_7_0_c_data = { ++ .mode = &ws_panel_7_0_c_mode, ++ .lanes = 2, ++ .mode_flags = MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS, ++}; ++ + /* 7.9inch 400x1280 + * https://www.waveshare.com/product/raspberry-pi/displays/7.9inch-dsi-lcd.htm + */ +@@ -107,6 +137,12 @@ static const struct drm_display_mode ws_ + .vtotal = 1280 + 20 + 10 + 20, + }; + ++static const struct ws_panel_data ws_panel_7_9_data = { ++ .mode = &ws_panel_7_9_mode, ++ .lanes = 2, ++ .mode_flags = MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS, ++}; ++ + /* 8.0inch or 10.1inch 1280x800 + * https://www.waveshare.com/product/raspberry-pi/displays/8inch-dsi-lcd-c.htm + * https://www.waveshare.com/product/raspberry-pi/displays/10.1inch-dsi-lcd-c.htm +@@ -123,6 +159,12 @@ static const struct drm_display_mode ws_ + .vtotal = 800 + 40 + 48 + 40, + }; + ++static const struct ws_panel_data ws_panel_10_1_data = { ++ .mode = &ws_panel_10_1_mode, ++ .lanes = 2, ++ .mode_flags = MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS, ++}; ++ + /* 11.9inch 320x1480 + * https://www.waveshare.com/product/raspberry-pi/displays/11.9inch-dsi-lcd.htm + */ +@@ -138,6 +180,12 @@ static const struct drm_display_mode ws_ + .vtotal = 1480 + 60 + 60 + 60, + }; + ++static const struct ws_panel_data ws_panel_11_9_data = { ++ .mode = &ws_panel_11_9_mode, ++ .lanes = 2, ++ .mode_flags = MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS, ++}; ++ + static const struct drm_display_mode ws_panel_4_mode = { + .clock = 50000, + .hdisplay = 720, +@@ -150,6 +198,12 @@ static const struct drm_display_mode ws_ + .vtotal = 720 + 8 + 4 + 16, + }; + ++static const struct ws_panel_data ws_panel_4_data = { ++ .mode = &ws_panel_4_mode, ++ .lanes = 2, ++ .mode_flags = MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS, ++}; ++ + /* 5.0inch 720x1280 + * https://www.waveshare.com/5inch-dsi-lcd-d.htm + */ +@@ -165,6 +219,12 @@ static const struct drm_display_mode ws_ + .vtotal = 1280 + 20 + 20 + 20, + }; + ++static const struct ws_panel_data ws_panel_5_0_data = { ++ .mode = &ws_panel_5_0_mode, ++ .lanes = 2, ++ .mode_flags = MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS, ++}; ++ + /* 6.25inch 720x1560 + * https://www.waveshare.com/6.25inch-dsi-lcd.htm + */ +@@ -180,6 +240,12 @@ static const struct drm_display_mode ws_ + .vtotal = 1560 + 20 + 20 + 20, + }; + ++static const struct ws_panel_data ws_panel_6_25_data = { ++ .mode = &ws_panel_6_25_mode, ++ .lanes = 2, ++ .mode_flags = MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS, ++}; ++ + /* 8.8inch 480x1920 + * https://www.waveshare.com/8.8inch-dsi-lcd.htm + */ +@@ -195,6 +261,48 @@ static const struct drm_display_mode ws_ + .vtotal = 1920 + 20 + 20 + 20, + }; + ++static const struct ws_panel_data ws_panel_8_8_data = { ++ .mode = &ws_panel_8_8_mode, ++ .lanes = 2, ++ .mode_flags = MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS, ++}; ++ ++static const struct drm_display_mode ws_panel_13_3_4lane_mode = { ++ .clock = 148500, ++ .hdisplay = 1920, ++ .hsync_start = 1920 + 88, ++ .hsync_end = 1920 + 88 + 44, ++ .htotal = 1920 + 88 + 44 + 148, ++ .vdisplay = 1080, ++ .vsync_start = 1080 + 4, ++ .vsync_end = 1080 + 4 + 5, ++ .vtotal = 1080 + 4 + 5 + 36, ++}; ++ ++static const struct ws_panel_data ws_panel_13_3_4lane_data = { ++ .mode = &ws_panel_13_3_4lane_mode, ++ .lanes = 4, ++ .mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_LPM, ++}; ++ ++static const struct drm_display_mode ws_panel_13_3_2lane_mode = { ++ .clock = 83333, ++ .hdisplay = 1920, ++ .hsync_start = 1920 + 88, ++ .hsync_end = 1920 + 88 + 44, ++ .htotal = 1920 + 88 + 44 + 148, ++ .vdisplay = 1080, ++ .vsync_start = 1080 + 4, ++ .vsync_end = 1080 + 4 + 5, ++ .vtotal = 1080 + 4 + 5 + 36, ++}; ++ ++static const struct ws_panel_data ws_panel_13_3_2lane_data = { ++ .mode = &ws_panel_13_3_2lane_mode, ++ .lanes = 2, ++ .mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_LPM, ++}; ++ + static struct ws_panel *panel_to_ts(struct drm_panel *panel) + { + return container_of(panel, struct ws_panel, base); +@@ -232,7 +340,10 @@ static int ws_panel_enable(struct drm_pa + { + struct ws_panel *ts = panel_to_ts(panel); + +- ws_panel_i2c_write(ts, 0xad, 0x01); ++ if (ts->mode == &ws_panel_13_3_2lane_mode) ++ ws_panel_i2c_write(ts, 0xad, 0x02); ++ else ++ ws_panel_i2c_write(ts, 0xad, 0x01); + + return 0; + } +@@ -328,13 +439,18 @@ static int ws_panel_probe(struct i2c_cli + .channel = 0, + .node = NULL, + }; ++ const struct ws_panel_data *_ws_panel_data; + int ret; + + ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL); + if (!ts) + return -ENOMEM; + +- ts->mode = of_device_get_match_data(dev); ++ _ws_panel_data = of_device_get_match_data(dev); ++ if (!_ws_panel_data) ++ return -EINVAL; ++ ++ ts->mode = _ws_panel_data->mode; + if (!ts->mode) + return -EINVAL; + +@@ -396,10 +512,9 @@ static int ws_panel_probe(struct i2c_cli + */ + drm_panel_add(&ts->base); + +- ts->dsi->mode_flags = MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO | +- MIPI_DSI_CLOCK_NON_CONTINUOUS; ++ ts->dsi->mode_flags = _ws_panel_data->mode_flags; + ts->dsi->format = MIPI_DSI_FMT_RGB888; +- ts->dsi->lanes = 2; ++ ts->dsi->lanes = _ws_panel_data->lanes; + + ret = devm_mipi_dsi_attach(dev, ts->dsi); + +@@ -432,40 +547,46 @@ static void ws_panel_shutdown(struct i2c + static const struct of_device_id ws_panel_of_ids[] = { + { + .compatible = "waveshare,2.8inch-panel", +- .data = &ws_panel_2_8_mode, ++ .data = &ws_panel_2_8_data, + }, { + .compatible = "waveshare,3.4inch-panel", +- .data = &ws_panel_3_4_mode, ++ .data = &ws_panel_3_4_data, + }, { + .compatible = "waveshare,4.0inch-panel", +- .data = &ws_panel_4_0_mode, ++ .data = &ws_panel_4_0_data, + }, { + .compatible = "waveshare,7.0inch-c-panel", +- .data = &ws_panel_7_0_c_mode, ++ .data = &ws_panel_7_0_c_data, + }, { + .compatible = "waveshare,7.9inch-panel", +- .data = &ws_panel_7_9_mode, ++ .data = &ws_panel_7_9_data, + }, { + .compatible = "waveshare,8.0inch-panel", +- .data = &ws_panel_10_1_mode, ++ .data = &ws_panel_10_1_data, + }, { + .compatible = "waveshare,10.1inch-panel", +- .data = &ws_panel_10_1_mode, ++ .data = &ws_panel_10_1_data, + }, { + .compatible = "waveshare,11.9inch-panel", +- .data = &ws_panel_11_9_mode, ++ .data = &ws_panel_11_9_data, + }, { + .compatible = "waveshare,4inch-panel", +- .data = &ws_panel_4_mode, ++ .data = &ws_panel_4_data, + }, { + .compatible = "waveshare,5.0inch-panel", +- .data = &ws_panel_5_0_mode, ++ .data = &ws_panel_5_0_data, + }, { + .compatible = "waveshare,6.25inch-panel", +- .data = &ws_panel_6_25_mode, ++ .data = &ws_panel_6_25_data, + }, { + .compatible = "waveshare,8.8inch-panel", +- .data = &ws_panel_8_8_mode, ++ .data = &ws_panel_8_8_data, ++ }, { ++ .compatible = "waveshare,13.3inch-4lane-panel", ++ .data = &ws_panel_13_3_4lane_data, ++ }, { ++ .compatible = "waveshare,13.3inch-2lane-panel", ++ .data = &ws_panel_13_3_2lane_data, + }, { + /* sentinel */ + } diff --git a/target/linux/bcm27xx/patches-6.6/950-1444-arch-arm-boot-dts-overlays-Added-waveshare-13.3inch-.patch b/target/linux/bcm27xx/patches-6.6/950-1444-arch-arm-boot-dts-overlays-Added-waveshare-13.3inch-.patch new file mode 100644 index 00000000000000..1d144bf2ca6bb7 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1444-arch-arm-boot-dts-overlays-Added-waveshare-13.3inch-.patch @@ -0,0 +1,46 @@ +From e442e5c1ab6bff5b5460b4fc949beb72aaf77970 Mon Sep 17 00:00:00 2001 +From: eng33 +Date: Thu, 5 Dec 2024 18:11:26 +0800 +Subject: [PATCH] arch:arm:boot:dts:overlays: Added waveshare 13.3inch panel + support + +Signed-off-by: eng33 +--- + arch/arm/boot/dts/overlays/README | 2 ++ + .../dts/overlays/vc4-kms-dsi-waveshare-panel-overlay.dts | 7 +++++++ + 2 files changed, 9 insertions(+) + +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -5338,6 +5338,8 @@ Params: 2_8_inch 2.8" 480 + 8_0_inch 8.0" 1280x800 + 10_1_inch 10.1" 1280x800 + 11_9_inch 11.9" 320x1480 ++ 13_3_inch_4lane 13.3" 1920x1080 4lane ++ 13_3_inch_2lane 13.3" 1920x1080 2lane + i2c1 Use i2c-1 with jumper wires from GPIOs 2&3 + disable_touch Disable the touch controller + rotation Set the panel orientation property +--- a/arch/arm/boot/dts/overlays/vc4-kms-dsi-waveshare-panel-overlay.dts ++++ b/arch/arm/boot/dts/overlays/vc4-kms-dsi-waveshare-panel-overlay.dts +@@ -51,6 +51,11 @@ + reg = <0x14>; + compatible = "goodix,gt911"; + }; ++ ++ touch2: ilitek@41 { ++ compatible = "ilitek,ili251x"; ++ reg = <0x41>; ++ }; + }; + }; + +@@ -120,6 +125,8 @@ + <&touch>, "touchscreen-inverted-x?", + <&touch>, "touchscreen-inverted-y?"; + 8_8_inch = <&panel>, "compatible=waveshare,8.8inch-panel"; ++ 13_3_inch_4lane = <&panel>, "compatible=waveshare,13.3inch-4lane-panel"; ++ 13_3_inch_2lane = <&panel>, "compatible=waveshare,13.3inch-2lane-panel"; + i2c1 = <&i2c_frag>, "target:0=",<&i2c1>, + <0>, "-3-4+5"; + disable_touch = <&touch>, "status=disabled"; diff --git a/target/linux/bcm27xx/patches-6.6/950-1445-fixup-cgroup-Use-kernel-command-line-to-disable-memo.patch b/target/linux/bcm27xx/patches-6.6/950-1445-fixup-cgroup-Use-kernel-command-line-to-disable-memo.patch new file mode 100644 index 00000000000000..8c4a1c3a3e88ba --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1445-fixup-cgroup-Use-kernel-command-line-to-disable-memo.patch @@ -0,0 +1,37 @@ +From 166dfc4399643681f2e4277bf7b7407e926861e5 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 9 Dec 2024 14:58:16 +0000 +Subject: [PATCH] fixup! cgroup: Use kernel command line to disable memory + cgroup + +cgroup features are distinct from cgroup subsystems - handle them +correctly. + +Signed-off-by: Phil Elwell +--- + kernel/cgroup/cgroup.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +--- a/kernel/cgroup/cgroup.c ++++ b/kernel/cgroup/cgroup.c +@@ -6769,11 +6769,19 @@ static int __init cgroup_enable(char *st + strcmp(token, ss->legacy_name)) + continue; + +- cgroup_feature_disable_mask &= ~(1 << i); + static_branch_enable(cgroup_subsys_enabled_key[i]); + pr_info("Enabling %s control group subsystem\n", + ss->name); + } ++ ++ for (i = 0; i < OPT_FEATURE_COUNT; i++) { ++ if (strcmp(token, cgroup_opt_feature_names[i])) ++ continue; ++ cgroup_feature_disable_mask &= ~(1 << i); ++ pr_info("Enabling %s control group feature\n", ++ cgroup_opt_feature_names[i]); ++ break; ++ } + } + return 1; + } diff --git a/target/linux/bcm27xx/patches-6.6/950-1446-media-i2c-ov9282-Correct-the-exposure-offset.patch b/target/linux/bcm27xx/patches-6.6/950-1446-media-i2c-ov9282-Correct-the-exposure-offset.patch new file mode 100644 index 00000000000000..f673f547dd8639 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1446-media-i2c-ov9282-Correct-the-exposure-offset.patch @@ -0,0 +1,31 @@ +From e23afbf2c7aae9264322eee8e5c72ca1887606df Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Mon, 9 Dec 2024 10:43:18 +0000 +Subject: [PATCH] media: i2c: ov9282: Correct the exposure offset + +The datasheet lists that "Maximum exposure time is frame +length -25 row periods, where frame length is set by +registers {0x380E, 0x380F}". +However this driver had OV9282_EXPOSURE_OFFSET set to 12 +which allowed that restriction to be violated, and would +result in very under-exposed images. + +Correct the offset. + +Fixes: 14ea315bbeb7 ("media: i2c: Add ov9282 camera sensor driver") +Signed-off-by: Dave Stevenson +--- + drivers/media/i2c/ov9282.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/media/i2c/ov9282.c ++++ b/drivers/media/i2c/ov9282.c +@@ -40,7 +40,7 @@ + /* Exposure control */ + #define OV9282_REG_EXPOSURE 0x3500 + #define OV9282_EXPOSURE_MIN 1 +-#define OV9282_EXPOSURE_OFFSET 12 ++#define OV9282_EXPOSURE_OFFSET 25 + #define OV9282_EXPOSURE_STEP 1 + #define OV9282_EXPOSURE_DEFAULT 0x0282 + diff --git a/target/linux/bcm27xx/patches-6.6/950-1451-Revert-drm-vc4-hvs-Don-t-write-gamma-luts-on-2711.patch b/target/linux/bcm27xx/patches-6.6/950-1451-Revert-drm-vc4-hvs-Don-t-write-gamma-luts-on-2711.patch new file mode 100644 index 00000000000000..e222ea886a3572 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1451-Revert-drm-vc4-hvs-Don-t-write-gamma-luts-on-2711.patch @@ -0,0 +1,22 @@ +From 448a2db3990534810b45d3e4202df96ab2dc5815 Mon Sep 17 00:00:00 2001 +From: Dom Cobley +Date: Tue, 10 Dec 2024 15:28:28 +0000 +Subject: [PATCH] Revert "drm/vc4: hvs: Don't write gamma luts on 2711" + +This reverts commit 40c77e93cfdda320f47fc1a00a76ce466d20e976. +--- + drivers/gpu/drm/vc4/vc4_hvs.c | 3 --- + 1 file changed, 3 deletions(-) + +--- a/drivers/gpu/drm/vc4/vc4_hvs.c ++++ b/drivers/gpu/drm/vc4/vc4_hvs.c +@@ -521,9 +521,6 @@ static void vc4_hvs_lut_load(struct vc4_ + if (!drm_dev_enter(drm, &idx)) + return; + +- if (hvs->vc4->gen == VC4_GEN_5) +- return; +- + /* The LUT memory is laid out with each HVS channel in order, + * each of which takes 256 writes for R, 256 for G, then 256 + * for B. diff --git a/target/linux/bcm27xx/patches-6.6/950-1452-Revert-PCI-Warn-if-no-host-bridge-NUMA-node-info.patch b/target/linux/bcm27xx/patches-6.6/950-1452-Revert-PCI-Warn-if-no-host-bridge-NUMA-node-info.patch new file mode 100644 index 00000000000000..5aa88661c3ea05 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1452-Revert-PCI-Warn-if-no-host-bridge-NUMA-node-info.patch @@ -0,0 +1,29 @@ +From 746662562995125ef7fb2c294300b0bd061b1251 Mon Sep 17 00:00:00 2001 +From: Dom Cobley +Date: Tue, 10 Dec 2024 16:39:31 +0000 +Subject: [PATCH] Revert "PCI: Warn if no host bridge NUMA node info" + +This warning doesn't mean anyting on our platform and +the warning causes confusion. + +See: https://forums.raspberrypi.com/viewtopic.php?p=2276125#p2276125 + +This reverts commit ad5086108b9f0361929aa9a79cf959ab5681d249. + +Signed-off-by: Dom Cobley +--- + drivers/pci/probe.c | 3 --- + 1 file changed, 3 deletions(-) + +--- a/drivers/pci/probe.c ++++ b/drivers/pci/probe.c +@@ -968,9 +968,6 @@ static int pci_register_host_bridge(stru + else + pr_info("PCI host bridge to bus %s\n", name); + +- if (nr_node_ids > 1 && pcibus_to_node(bus) == NUMA_NO_NODE) +- dev_warn(&bus->dev, "Unknown NUMA node; performance will be reduced\n"); +- + /* Coalesce contiguous windows */ + resource_list_for_each_entry_safe(window, n, &resources) { + if (list_is_last(&window->node, &resources)) diff --git a/target/linux/bcm27xx/patches-6.6/950-1454-drm-bridge-panel-Connector-to-allow-interlaced-modes.patch b/target/linux/bcm27xx/patches-6.6/950-1454-drm-bridge-panel-Connector-to-allow-interlaced-modes.patch new file mode 100644 index 00000000000000..9e4ba2a75acb31 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1454-drm-bridge-panel-Connector-to-allow-interlaced-modes.patch @@ -0,0 +1,25 @@ +From 7d294fbff4863e53a64685335b30aed9604cae49 Mon Sep 17 00:00:00 2001 +From: Nick Hollinghurst +Date: Tue, 19 Nov 2024 16:11:32 +0000 +Subject: [PATCH] drm: bridge: panel: Connector to allow interlaced modes + +When initialized from panel_bridge_attach(), connector should +allow interlaced modes rather than invariably rejecting them, +so that other components can validate them. + +Signed-off-by: Nick Hollinghurst +--- + drivers/gpu/drm/bridge/panel.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/gpu/drm/bridge/panel.c ++++ b/drivers/gpu/drm/bridge/panel.c +@@ -82,6 +82,8 @@ static int panel_bridge_attach(struct dr + return ret; + } + ++ connector->interlace_allowed = true; ++ + drm_panel_bridge_set_orientation(connector, bridge); + + drm_connector_attach_encoder(&panel_bridge->connector, diff --git a/target/linux/bcm27xx/patches-6.6/950-1455-dts-overlays-vc4-kms-dpi-generic-overlay-Add-interla.patch b/target/linux/bcm27xx/patches-6.6/950-1455-dts-overlays-vc4-kms-dpi-generic-overlay-Add-interla.patch new file mode 100644 index 00000000000000..1d9792305c0a4a --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1455-dts-overlays-vc4-kms-dpi-generic-overlay-Add-interla.patch @@ -0,0 +1,34 @@ +From 2b0acbe8fd008e09a904b7a3c796a2dc79bf10ea Mon Sep 17 00:00:00 2001 +From: Nick Hollinghurst +Date: Tue, 19 Nov 2024 16:17:40 +0000 +Subject: [PATCH] dts: overlays: vc4-kms-dpi-generic-overlay: Add "interlaced" + property + +Almost no DPI hardware supports it, but it's useful for RP1 video out. + +Signed-off-by: Nick Hollinghurst +--- + arch/arm/boot/dts/overlays/README | 1 + + arch/arm/boot/dts/overlays/vc4-kms-dpi-generic-overlay.dts | 1 + + 2 files changed, 2 insertions(+) + +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -5099,6 +5099,7 @@ Params: clock-frequency Display + vsync-invert Vertical sync active low + de-invert Data Enable active low + pixclk-invert Negative edge pixel clock ++ interlaced Use an interlaced mode (where supported) + width-mm Define the screen width in mm + height-mm Define the screen height in mm + rgb565 Change to RGB565 output on GPIOs 0-19 +--- a/arch/arm/boot/dts/overlays/vc4-kms-dpi-generic-overlay.dts ++++ b/arch/arm/boot/dts/overlays/vc4-kms-dpi-generic-overlay.dts +@@ -59,6 +59,7 @@ + vsync-invert = <&timing>, "vsync-active:0=0"; + de-invert = <&timing>, "de-active:0=0"; + pixclk-invert = <&timing>, "pixelclk-active:0=0"; ++ interlaced = <&timing>, "interlaced?"; + + width-mm = <&panel_generic>, "width-mm:0"; + height-mm = <&panel_generic>, "height-mm:0"; diff --git a/target/linux/bcm27xx/patches-6.6/950-1456-drm-rp1-rp1-dpi-Add-interlaced-modes-and-PIO-program.patch b/target/linux/bcm27xx/patches-6.6/950-1456-drm-rp1-rp1-dpi-Add-interlaced-modes-and-PIO-program.patch index bbaee270c52e68..e78ee378a46cae 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1456-drm-rp1-rp1-dpi-Add-interlaced-modes-and-PIO-program.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1456-drm-rp1-rp1-dpi-Add-interlaced-modes-and-PIO-program.patch @@ -1,8 +1,8 @@ From 7735dd0736322cff23aff95490bae1d69937a9bf Mon Sep 17 00:00:00 2001 From: Nick Hollinghurst Date: Tue, 10 Dec 2024 13:23:09 +0000 -Subject: [PATCH 1456/1482] drm: rp1: rp1-dpi: Add interlaced modes and PIO - program to fix VSYNC +Subject: [PATCH] drm: rp1: rp1-dpi: Add interlaced modes and PIO program to + fix VSYNC Implement interlaced modes by wobbling the base pointer and VFP width for every field. This results in correct pixels but incorrect VSYNC. diff --git a/target/linux/bcm27xx/patches-6.6/950-1457-pwm-Improve-PWM_PIO_RP1-dependencies.patch b/target/linux/bcm27xx/patches-6.6/950-1457-pwm-Improve-PWM_PIO_RP1-dependencies.patch deleted file mode 100644 index 357cd05dc88d12..00000000000000 --- a/target/linux/bcm27xx/patches-6.6/950-1457-pwm-Improve-PWM_PIO_RP1-dependencies.patch +++ /dev/null @@ -1,22 +0,0 @@ -From f85f3509692f966ec32e4db499f7e64dc6b6b952 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Thu, 12 Dec 2024 10:09:13 +0000 -Subject: [PATCH 1457/1482] pwm: Improve PWM_PIO_RP1 dependencies - -PWM_PIO_RP1 should select RP1_PIO, as it is useless without it. - -Signed-off-by: Phil Elwell ---- - drivers/pwm/Kconfig | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/pwm/Kconfig -+++ b/drivers/pwm/Kconfig -@@ -457,6 +457,7 @@ config PWM_PCA9685 - config PWM_PIO_RP1 - tristate "RP1 PIO PWM support" - depends on FIRMWARE_RP1 || COMPILE_TEST -+ select RP1_PIO - help - This is a PWM framework driver for Raspberry Pi 5, using the PIO - hardware of RP1 to provide PWM functionality. Supports up to 4 diff --git a/target/linux/bcm27xx/patches-6.6/950-1458-Revert-pwm-Improve-PWM_PIO_RP1-dependencies.patch b/target/linux/bcm27xx/patches-6.6/950-1458-Revert-pwm-Improve-PWM_PIO_RP1-dependencies.patch deleted file mode 100644 index eabf3887d14c66..00000000000000 --- a/target/linux/bcm27xx/patches-6.6/950-1458-Revert-pwm-Improve-PWM_PIO_RP1-dependencies.patch +++ /dev/null @@ -1,20 +0,0 @@ -From 73fb1e979a210094935f4af4c3d6e700fba30c5f Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Thu, 12 Dec 2024 10:28:54 +0000 -Subject: [PATCH 1458/1482] Revert "pwm: Improve PWM_PIO_RP1 dependencies" - -This reverts commit f85f3509692f966ec32e4db499f7e64dc6b6b952. ---- - drivers/pwm/Kconfig | 1 - - 1 file changed, 1 deletion(-) - ---- a/drivers/pwm/Kconfig -+++ b/drivers/pwm/Kconfig -@@ -457,7 +457,6 @@ config PWM_PCA9685 - config PWM_PIO_RP1 - tristate "RP1 PIO PWM support" - depends on FIRMWARE_RP1 || COMPILE_TEST -- select RP1_PIO - help - This is a PWM framework driver for Raspberry Pi 5, using the PIO - hardware of RP1 to provide PWM functionality. Supports up to 4 diff --git a/target/linux/bcm27xx/patches-6.6/950-1459-ASoC-allo-piano-dac-plus-Fix-volume-limit-locking.patch b/target/linux/bcm27xx/patches-6.6/950-1459-ASoC-allo-piano-dac-plus-Fix-volume-limit-locking.patch new file mode 100644 index 00000000000000..8e279df6883e58 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1459-ASoC-allo-piano-dac-plus-Fix-volume-limit-locking.patch @@ -0,0 +1,79 @@ +From ac0cd73932aa1e371ffaf0b974855ed3cd22937f Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 11 Dec 2024 13:47:30 +0000 +Subject: [PATCH] ASoC: allo-piano-dac-plus: Fix volume limit locking + +Calling snd_soc_limit_volume from within a kcontrol put handler seems +to cause a deadlock as it attempts to claim a write lock that is already +held. Call snd_soc_limit_volume from the main initialisation code +instead, to avoid the recursive locking. + +See: https://github.com/raspberrypi/linux/issues/6527 + +Signed-off-by: Phil Elwell +--- + sound/soc/bcm/allo-piano-dac-plus.c | 32 +++++++++++++---------------- + 1 file changed, 14 insertions(+), 18 deletions(-) + +--- a/sound/soc/bcm/allo-piano-dac-plus.c ++++ b/sound/soc/bcm/allo-piano-dac-plus.c +@@ -452,14 +452,6 @@ static int pcm512x_set_reg_sub(struct sn + + rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[0]); + +- if (digital_gain_0db_limit) { +- ret = snd_soc_limit_volume(card, "Subwoofer Playback Volume", +- 207); +- if (ret < 0) +- dev_warn(card->dev, "Failed to set volume limit: %d\n", +- ret); +- } +- + // When in Dual Mono, Sub vol control should not set anything. + if (glb_ptr->dual_mode != 1) { //Not in Dual Mono mode + +@@ -562,14 +554,6 @@ static int pcm512x_set_reg_master(struct + + rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[0]); + +- if (digital_gain_0db_limit) { +- ret = snd_soc_limit_volume(card, "Master Playback Volume", +- 207); +- if (ret < 0) +- dev_warn(card->dev, "Failed to set volume limit: %d\n", +- ret); +- } +- + if (glb_ptr->dual_mode == 1) { //in Dual Mono Mode + + ret = snd_soc_component_write(asoc_rtd_to_codec(rtd, 0)->component, +@@ -750,6 +734,18 @@ static int snd_allo_piano_dac_init(struc + if (digital_gain_0db_limit) { + int ret; + ++ ret = snd_soc_limit_volume(card, "Master Playback Volume", ++ 207); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to set master volume limit: %d\n", ++ ret); ++ ++ ret = snd_soc_limit_volume(card, "Subwoofer Playback Volume", ++ 207); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to set subwoofer volume limit: %d\n", ++ ret); ++ + //Set volume limit on both dacs + for (i = 0; i < ARRAY_SIZE(codec_ctl_pfx); i++) { + char cname[256]; +@@ -757,8 +753,8 @@ static int snd_allo_piano_dac_init(struc + sprintf(cname, "%s %s", codec_ctl_pfx[i], codec_ctl_name[0]); + ret = snd_soc_limit_volume(card, cname, 207); + if (ret < 0) +- dev_warn(card->dev, "Failed to set volume limit: %d\n", +- ret); ++ dev_warn(card->dev, "Failed to set %s volume limit: %d\n", ++ cname, ret); + } + } + diff --git a/target/linux/bcm27xx/patches-6.6/950-1460-drm-vc4-txp-Do-not-allow-24bpp-formats-when-transpos.patch b/target/linux/bcm27xx/patches-6.6/950-1460-drm-vc4-txp-Do-not-allow-24bpp-formats-when-transpos.patch new file mode 100644 index 00000000000000..93de0f99a49c42 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1460-drm-vc4-txp-Do-not-allow-24bpp-formats-when-transpos.patch @@ -0,0 +1,30 @@ +From af4ab4fb77dfc697c8ae068b18f27de1ee5d609f Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Wed, 11 Dec 2024 16:30:43 +0000 +Subject: [PATCH] drm: vc4: txp: Do not allow 24bpp formats when transposing + +The hardware doesn't support transposing to 24bpp (RGB888/BGR888) +formats. There's no way to advertise this through DRM, so block +it from atomic_check instead. + +Signed-off-by: Dave Stevenson +--- + drivers/gpu/drm/vc4/vc4_txp.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/drivers/gpu/drm/vc4/vc4_txp.c ++++ b/drivers/gpu/drm/vc4/vc4_txp.c +@@ -272,6 +272,13 @@ static int vc4_txp_connector_atomic_chec + return -EINVAL; + } + ++ if (conn_state->rotation & DRM_MODE_TRANSPOSE && ++ (fb->format->format == DRM_FORMAT_RGB888 || ++ fb->format->format == DRM_FORMAT_BGR888)) { ++ DRM_DEBUG_KMS("24bpp formats not supported when transposing\n"); ++ return -EINVAL; ++ } ++ + for (i = 0; i < ARRAY_SIZE(drm_fmts); i++) { + if (fb->format->format == drm_fmts[i]) + break; diff --git a/target/linux/bcm27xx/patches-6.6/950-1461-drm-Validate-connector-rotation-has-one-bit-set-in-t.patch b/target/linux/bcm27xx/patches-6.6/950-1461-drm-Validate-connector-rotation-has-one-bit-set-in-t.patch new file mode 100644 index 00000000000000..2a6115981a3d8f --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1461-drm-Validate-connector-rotation-has-one-bit-set-in-t.patch @@ -0,0 +1,29 @@ +From 0b216b3988e5b7035cd5ed8a9910eacbb3420ce0 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Thu, 12 Dec 2024 11:59:52 +0000 +Subject: [PATCH] drm: Validate connector rotation has one bit set in the + rotation property + +Copy the same validation logic as from the plane rotation property. + +Fixes: 8fec3ff87049 ("drm: Add a rotation parameter to connectors.") +Signed-off-by: Dave Stevenson +--- + drivers/gpu/drm/drm_atomic_uapi.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/gpu/drm/drm_atomic_uapi.c ++++ b/drivers/gpu/drm/drm_atomic_uapi.c +@@ -812,6 +812,12 @@ static int drm_atomic_connector_set_prop + } else if (property == connector->privacy_screen_sw_state_property) { + state->privacy_screen_sw_state = val; + } else if (property == connector->rotation_property) { ++ if (!is_power_of_2(val & DRM_MODE_ROTATE_MASK)) { ++ drm_dbg_atomic(connector->dev, ++ "[CONNECTOR:%d:%s] bad rotation bitmask: 0x%llx\n", ++ connector->base.id, connector->name, val); ++ return -EINVAL; ++ } + state->rotation = val; + } else if (connector->funcs->atomic_set_property) { + return connector->funcs->atomic_set_property(connector, diff --git a/target/linux/bcm27xx/patches-6.6/950-1462-ASoC-allo-piano-dac-plus-Suppress-517-errors.patch b/target/linux/bcm27xx/patches-6.6/950-1462-ASoC-allo-piano-dac-plus-Suppress-517-errors.patch new file mode 100644 index 00000000000000..67bce02817ffda --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1462-ASoC-allo-piano-dac-plus-Suppress-517-errors.patch @@ -0,0 +1,73 @@ +From 61494a7aa2ea887fa1cd1399a8db1317c87f661b Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 12 Dec 2024 13:05:41 +0000 +Subject: [PATCH] ASoC: allo-piano-dac-plus: Suppress -517 errors + +Use dev_err_probe to simplify the code and suppress EPROBE_DEFER errors. + +Signed-off-by: Phil Elwell +--- + sound/soc/bcm/allo-piano-dac-plus.c | 37 ++++++++--------------------- + 1 file changed, 10 insertions(+), 27 deletions(-) + +--- a/sound/soc/bcm/allo-piano-dac-plus.c ++++ b/sound/soc/bcm/allo-piano-dac-plus.c +@@ -974,48 +974,31 @@ static int snd_allo_piano_dac_probe(stru + + allo_piano_2_1_codecs[0].of_node = + of_parse_phandle(pdev->dev.of_node, "audio-codec", 0); +- if (!allo_piano_2_1_codecs[0].of_node) { +- dev_err(&pdev->dev, +- "Property 'audio-codec' missing or invalid\n"); +- return -EINVAL; +- } +- + allo_piano_2_1_codecs[1].of_node = + of_parse_phandle(pdev->dev.of_node, "audio-codec", 1); +- if (!allo_piano_2_1_codecs[1].of_node) { +- dev_err(&pdev->dev, ++ if (!allo_piano_2_1_codecs[0].of_node || !allo_piano_2_1_codecs[1].of_node) ++ return dev_err_probe(&pdev->dev, -EINVAL, + "Property 'audio-codec' missing or invalid\n"); +- return -EINVAL; +- } + + mute_gpio[0] = devm_gpiod_get_optional(&pdev->dev, "mute1", + GPIOD_OUT_LOW); +- if (IS_ERR(mute_gpio[0])) { +- ret = PTR_ERR(mute_gpio[0]); +- dev_err(&pdev->dev, +- "failed to get mute1 gpio6: %d\n", ret); +- return ret; +- } ++ if (IS_ERR(mute_gpio[0])) ++ return dev_err_probe(&pdev->dev, PTR_ERR(mute_gpio[0]), ++ "failed to get mute1 gpio\n"); + + mute_gpio[1] = devm_gpiod_get_optional(&pdev->dev, "mute2", + GPIOD_OUT_LOW); +- if (IS_ERR(mute_gpio[1])) { +- ret = PTR_ERR(mute_gpio[1]); +- dev_err(&pdev->dev, +- "failed to get mute2 gpio25: %d\n", ret); +- return ret; +- } ++ if (IS_ERR(mute_gpio[1])) ++ return dev_err_probe(&pdev->dev, PTR_ERR(mute_gpio[1]), ++ "failed to get mute2 gpio\n"); + + if (mute_gpio[0] && mute_gpio[1]) + snd_allo_piano_dac.set_bias_level = + snd_allo_piano_set_bias_level; + + ret = snd_soc_register_card(&snd_allo_piano_dac); +- if (ret < 0) { +- dev_err(&pdev->dev, +- "snd_soc_register_card() failed: %d\n", ret); +- return ret; +- } ++ if (ret < 0) ++ return dev_err_probe(&pdev->dev, ret, "snd_soc_register_card() failed\n"); + + if ((mute_gpio[0]) && (mute_gpio[1])) + snd_allo_piano_gpio_mute(&snd_allo_piano_dac); diff --git a/target/linux/bcm27xx/patches-6.6/950-1463-drm-rp1-rp1-dpi-Fix-optional-dependency-on-RP1_PIO.patch b/target/linux/bcm27xx/patches-6.6/950-1463-drm-rp1-rp1-dpi-Fix-optional-dependency-on-RP1_PIO.patch index 52e87daa386ad9..13c735eb4e66f9 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1463-drm-rp1-rp1-dpi-Fix-optional-dependency-on-RP1_PIO.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1463-drm-rp1-rp1-dpi-Fix-optional-dependency-on-RP1_PIO.patch @@ -1,8 +1,7 @@ From 80533a952218696c0ef1b346bab50dc401e6b74c Mon Sep 17 00:00:00 2001 From: Nick Hollinghurst Date: Thu, 12 Dec 2024 11:58:12 +0000 -Subject: [PATCH 1463/1482] drm: rp1: rp1-dpi: Fix optional dependency on - RP1_PIO +Subject: [PATCH] drm: rp1: rp1-dpi: Fix optional dependency on RP1_PIO Add optional dependency to Kconfig, and conditionally compile PIO-dependent code. Add a mode validation function to reject diff --git a/target/linux/bcm27xx/patches-6.6/950-1464-serial-sc16is7xx-announce-support-for-SER_RS485_RTS_.patch b/target/linux/bcm27xx/patches-6.6/950-1464-serial-sc16is7xx-announce-support-for-SER_RS485_RTS_.patch new file mode 100644 index 00000000000000..f78402d0c52d8c --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1464-serial-sc16is7xx-announce-support-for-SER_RS485_RTS_.patch @@ -0,0 +1,42 @@ +From 694247173f2e136196d7cb3a392c84cda65674d2 Mon Sep 17 00:00:00 2001 +From: Hugo Villeneuve +Date: Mon, 7 Oct 2024 12:27:15 -0400 +Subject: [PATCH] serial: sc16is7xx: announce support for SER_RS485_RTS_ON_SEND + +commit 068d35a7be65fa3bca4bba21c269bfe0b39158a6 upstream. + +When specifying flag SER_RS485_RTS_ON_SEND in RS485 configuration, +we get the following warning after commit 4afeced55baa ("serial: core: +fix sanitizing check for RTS settings"): + + invalid RTS setting, using RTS_AFTER_SEND instead + +This results in SER_RS485_RTS_AFTER_SEND being set and the +driver always write to the register field SC16IS7XX_EFCR_RTS_INVERT_BIT, +which breaks some hardware using these chips. + +The hardware supports both RTS_ON_SEND and RTS_AFTER_SEND modes, so fix +this by announcing support for RTS_ON_SEND. + +Signed-off-by: Hugo Villeneuve +Suggested-by: Konstantin Pugin +Link: https://lore.kernel.org/lkml/20240422133219.2710061-2-ria.freelander@gmail.com +Reviewed-by: Andy Shevchenko +Tested-by: Hugo Villeneuve +Link: https://lore.kernel.org/r/20241007162716.3122912-1-hugo@hugovil.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/tty/serial/sc16is7xx.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/tty/serial/sc16is7xx.c ++++ b/drivers/tty/serial/sc16is7xx.c +@@ -1457,7 +1457,7 @@ static int sc16is7xx_setup_mctrl_ports(s + } + + static const struct serial_rs485 sc16is7xx_rs485_supported = { +- .flags = SER_RS485_ENABLED | SER_RS485_RTS_AFTER_SEND, ++ .flags = SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND | SER_RS485_RTS_AFTER_SEND, + .delay_rts_before_send = 1, + .delay_rts_after_send = 1, /* Not supported but keep returning -EINVAL */ + }; diff --git a/target/linux/bcm27xx/patches-6.6/950-1467-dtoverlays-Add-override-for-target-path-on-I2C-overl.patch b/target/linux/bcm27xx/patches-6.6/950-1467-dtoverlays-Add-override-for-target-path-on-I2C-overl.patch new file mode 100644 index 00000000000000..d5f72d1c9226e7 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1467-dtoverlays-Add-override-for-target-path-on-I2C-overl.patch @@ -0,0 +1,550 @@ +From b75fd2a9385e1358fa82218184e73513f9a5e57f Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Mon, 16 Dec 2024 15:11:08 +0000 +Subject: [PATCH] dtoverlays: Add override for target-path on I2C overlays + +To allow for attaching any of the standard overlays to a +bitbashed i2c-gpio bus, allow specifying the target path for +the overlay. + +Suggested by: +https://forums.raspberrypi.com/viewtopic.php?t=381059 + +Example: +dtoverlay=i2c-gpio,i2c_gpio_sda=10,i2c_gpio_scl=11 +dtoverlay=mcp23017,i2c-path=/i2c@0 +dtoverlay=i2c-gpio,i2c_gpio_sda=12,i2c_gpio_scl=13,bus=3 +dtoverlay=mcp23017,i2c-path=/i2c@3 + +Signed-off-by: Dave Stevenson +--- + arch/arm/boot/dts/overlays/README | 59 +++++++++++++++++++ + .../arm/boot/dts/overlays/ads1115-overlay.dts | 2 + + .../boot/dts/overlays/edt-ft5406-overlay.dts | 3 + + arch/arm/boot/dts/overlays/goodix-overlay.dts | 4 +- + .../dts/overlays/hd44780-i2c-lcd-overlay.dts | 4 +- + .../arm/boot/dts/overlays/i2c-fan-overlay.dts | 2 + + .../arm/boot/dts/overlays/i2c-mux-overlay.dts | 2 + + .../dts/overlays/i2c-pwm-pca9685a-overlay.dts | 2 + + .../arm/boot/dts/overlays/i2c-rtc-overlay.dts | 2 + + .../boot/dts/overlays/i2c-sensor-overlay.dts | 2 + + .../boot/dts/overlays/ilitek251x-overlay.dts | 4 +- + .../boot/dts/overlays/mcp23017-overlay.dts | 2 + + .../arm/boot/dts/overlays/pca953x-overlay.dts | 30 +++++++++- + .../arm/boot/dts/overlays/pcf857x-overlay.dts | 30 +++++++++- + .../dts/overlays/sc16is750-i2c-overlay.dts | 30 +++++++++- + .../dts/overlays/sc16is752-i2c-overlay.dts | 30 +++++++++- + 16 files changed, 201 insertions(+), 7 deletions(-) + +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -555,6 +555,7 @@ Params: addr I2C bus + overlay - BCM2711 only) + i2c6 Choose the I2C6 bus (configure with the i2c6 + overlay - BCM2711 only) ++ i2c-path Override I2C path to allow for i2c-gpio buses + + Channel parameters can be set for each enabled channel. + A maximum of 4 channels can be enabled (letters a thru d). +@@ -1238,6 +1239,7 @@ Params: sizex Touchscr + addr Sets the address for the touch controller. Note + that the device must be configured to use the + specified address. ++ i2c-path Override I2C path to allow for i2c-gpio buses + + + Name: enc28j60 +@@ -1439,6 +1441,7 @@ Info: Enables I2C connected Goodix gt9 + Load: dtoverlay=goodix,= + Params: interrupt GPIO used for interrupt (default 4) + reset GPIO used for reset (default 17) ++ i2c-path Override I2C path to allow for i2c-gpio buses + + + Name: googlevoicehat-soundcard +@@ -1730,6 +1733,7 @@ Params: addr I2C addr + display_height Height of the display in characters (default 2) + + display_width Width of the display in characters (default 16) ++ i2c-path Override I2C path to allow for i2c-gpio buses + + + Name: hd44780-lcd +@@ -2095,6 +2099,8 @@ Params: addr Sets the + i2c6 Choose the I2C6 bus (configure with the i2c6 + overlay - BCM2711 only) + ++ i2c-path Override I2C path to allow for i2c-gpio buses ++ + minpwm PWM setting for the fan when the SoC is below + mintemp (range 0-255. default 0) + maxpwm PWM setting for the fan when the SoC is above +@@ -2165,6 +2171,8 @@ Params: pca9542 Select t + i2c6 Choose the I2C6 bus (configure with the i2c6 + overlay - BCM2711 only) + ++ i2c-path Override I2C path to allow for i2c-gpio buses ++ + disconnect_on_idle Force the mux to disconnect all child buses + after every transaction. + +@@ -2186,6 +2194,7 @@ Params: addr I2C addr + overlay - BCM2711 only) + i2c6 Choose the I2C6 bus (configure with the i2c6 + overlay - BCM2711 only) ++ i2c-path Override I2C path to allow for i2c-gpio buses + + + Name: i2c-rtc +@@ -2255,6 +2264,8 @@ Params: abx80x Select o + i2c6 Choose the I2C6 bus (configure with the i2c6 + overlay - BCM2711 only) + ++ i2c-path Override I2C path to allow for i2c-gpio buses ++ + addr Sets the address for the RTC. Note that the + device must be configured to use the specified + address. +@@ -2519,6 +2530,8 @@ Params: addr Set the + i2c6 Choose the I2C6 bus (configure with the i2c6 + overlay - BCM2711 only) + ++ i2c-path Override I2C path to allow for i2c-gpio buses ++ + + Name: i2c0 + Info: Change i2c0 pin usage. Not all pin combinations are usable on all +@@ -2661,6 +2674,7 @@ Params: interrupt GPIO use + touchscreen (in pixels) + sizey Touchscreen size y, vertical resolution of + touchscreen (in pixels) ++ i2c-path Override I2C path to allow for i2c-gpio buses + + + Name: imx219 +@@ -3138,6 +3152,7 @@ Params: gpiopin Gpio pin + overlay - BCM2711 only) + i2c6 Choose the I2C6 bus (configure with the i2c6 + overlay - BCM2711 only) ++ i2c-path Override I2C path to allow for i2c-gpio buses + + + Name: mcp23s17 +@@ -3587,6 +3602,17 @@ Params: addr I2C addr + cat9554 Select the Onnn CAT9554 (8 bit) + pca9654 Select the Onnn PCA9654 (8 bit) + xra1202 Select the Exar XRA1202 (8 bit) ++ i2c0 Choose the I2C0 bus on GPIOs 0&1 ++ i2c_csi_dsi Choose the I2C0 bus on GPIOs 44&45 ++ i2c3 Choose the I2C3 bus (configure with the i2c3 ++ overlay - BCM2711 only) ++ i2c4 Choose the I2C3 bus (configure with the i2c3 ++ overlay - BCM2711 only) ++ i2c5 Choose the I2C5 bus (configure with the i2c4 ++ overlay - BCM2711 only) ++ i2c6 Choose the I2C6 bus (configure with the i2c6 ++ overlay - BCM2711 only) ++ i2c-path Override I2C path to allow for i2c-gpio buses + + + Name: pcf857x +@@ -3598,6 +3624,17 @@ Params: addr I2C addr + pcf8574a Select the NXP PCF8574A (8 bit) + pcf8575 Select the NXP PCF8575 (16 bit) + pca8574 Select the NXP PCA8574 (8 bit) ++ i2c0 Choose the I2C0 bus on GPIOs 0&1 ++ i2c_csi_dsi Choose the I2C0 bus on GPIOs 44&45 ++ i2c3 Choose the I2C3 bus (configure with the i2c3 ++ overlay - BCM2711 only) ++ i2c4 Choose the I2C3 bus (configure with the i2c3 ++ overlay - BCM2711 only) ++ i2c5 Choose the I2C5 bus (configure with the i2c4 ++ overlay - BCM2711 only) ++ i2c6 Choose the I2C6 bus (configure with the i2c6 ++ overlay - BCM2711 only) ++ i2c-path Override I2C path to allow for i2c-gpio buses + + + Name: pcie-32bit-dma +@@ -4257,6 +4294,17 @@ Load: dtoverlay=sc16is750-i2c,= + Params: int_pin GPIO used for IRQ (default 24) + addr Address (default 0x48) + xtal On-board crystal frequency (default 14745600) ++ i2c0 Choose the I2C0 bus on GPIOs 0&1 ++ i2c_csi_dsi Choose the I2C0 bus on GPIOs 44&45 ++ i2c3 Choose the I2C3 bus (configure with the i2c3 ++ overlay - BCM2711 only) ++ i2c4 Choose the I2C4 bus (configure with the i2c4 ++ overlay - BCM2711 only) ++ i2c5 Choose the I2C5 bus (configure with the i2c5 ++ overlay - BCM2711 only) ++ i2c6 Choose the I2C6 bus (configure with the i2c6 ++ overlay - BCM2711 only) ++ i2c-path Override I2C path to allow for i2c-gpio buses + + + Name: sc16is750-spi0 +@@ -4275,6 +4323,17 @@ Load: dtoverlay=sc16is752-i2c,= + Params: int_pin GPIO used for IRQ (default 24) + addr Address (default 0x48) + xtal On-board crystal frequency (default 14745600) ++ i2c0 Choose the I2C0 bus on GPIOs 0&1 ++ i2c_csi_dsi Choose the I2C0 bus on GPIOs 44&45 ++ i2c3 Choose the I2C3 bus (configure with the i2c3 ++ overlay - BCM2711 only) ++ i2c4 Choose the I2C4 bus (configure with the i2c4 ++ overlay - BCM2711 only) ++ i2c5 Choose the I2C5 bus (configure with the i2c5 ++ overlay - BCM2711 only) ++ i2c6 Choose the I2C6 bus (configure with the i2c6 ++ overlay - BCM2711 only) ++ i2c-path Override I2C path to allow for i2c-gpio buses + + + Name: sc16is752-spi0 +--- a/arch/arm/boot/dts/overlays/ads1115-overlay.dts ++++ b/arch/arm/boot/dts/overlays/ads1115-overlay.dts +@@ -131,5 +131,7 @@ + <&frag100>, "target-path=i2c5"; + i2c6 = <&frag100>, "target?=0", + <&frag100>, "target-path=i2c6"; ++ i2c-path = <&frag100>, "target?=0", ++ <&frag100>, "target-path"; + }; + }; +--- a/arch/arm/boot/dts/overlays/edt-ft5406-overlay.dts ++++ b/arch/arm/boot/dts/overlays/edt-ft5406-overlay.dts +@@ -41,6 +41,9 @@ + i2c6 = <&ts_i2c_frag>, "target?=0", + <&ts_i2c_frag>, "target-path=i2c6", + <0>,"-0-1"; ++ i2c-path = <&ts_i2c_frag>, "target?=0", ++ <&ts_i2c_frag>, "target-path", ++ <0>,"-0-1"; + addr = <&ft5406>,"reg:0"; + }; + }; +--- a/arch/arm/boot/dts/overlays/goodix-overlay.dts ++++ b/arch/arm/boot/dts/overlays/goodix-overlay.dts +@@ -16,7 +16,7 @@ + }; + }; + +- fragment@1 { ++ i2c_frag: fragment@1 { + target = <&i2c1>; + __overlay__ { + #address-cells = <1>; +@@ -42,5 +42,7 @@ + <>9271>,"irq-gpios:4"; + reset = <&goodix_pins>,"brcm,pins:4", + <>9271>,"reset-gpios:4"; ++ i2c-path = <&i2c_frag>, "target?=0", ++ <&i2c_frag>, "target-path"; + }; + }; +--- a/arch/arm/boot/dts/overlays/hd44780-i2c-lcd-overlay.dts ++++ b/arch/arm/boot/dts/overlays/hd44780-i2c-lcd-overlay.dts +@@ -4,7 +4,7 @@ + / { + compatible = "brcm,bcm2835"; + +- fragment@0 { ++ i2c_frag: fragment@0 { + target = <&i2c_arm>; + __overlay__ { + status = "okay"; +@@ -52,6 +52,8 @@ + display_height = <&lcd_screen>,"display-height-chars:0"; + display_width = <&lcd_screen>,"display-width-chars:0"; + addr = <&pcf857x>,"reg:0"; ++ i2c-path = <&i2c_frag>, "target?=0", ++ <&i2c_frag>, "target-path"; + }; + + }; +--- a/arch/arm/boot/dts/overlays/i2c-fan-overlay.dts ++++ b/arch/arm/boot/dts/overlays/i2c-fan-overlay.dts +@@ -93,6 +93,8 @@ + <&frag100>, "target-path=i2c5"; + i2c6 = <&frag100>, "target?=0", + <&frag100>, "target-path=i2c6"; ++ i2c-path = <&frag100>, "target?=0", ++ <&frag100>, "target-path"; + addr = <&emc2301>,"reg:0"; + minpwm = <&emc2301>,"emc2305,pwm-min.0"; + maxpwm = <&emc2301>,"emc2305,pwm-max.0"; +--- a/arch/arm/boot/dts/overlays/i2c-mux-overlay.dts ++++ b/arch/arm/boot/dts/overlays/i2c-mux-overlay.dts +@@ -175,6 +175,8 @@ + <&frag100>, "target-path=i2c5"; + i2c6 = <&frag100>, "target?=0", + <&frag100>, "target-path=i2c6"; ++ i2c-path = <&frag100>, "target?=0", ++ <&frag100>, "target-path"; + disconnect_on_idle = + <&pca9542>,"idle-state:0=", , + <&pca9545>,"idle-state:0=", , +--- a/arch/arm/boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts ++++ b/arch/arm/boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts +@@ -57,5 +57,7 @@ + <&frag100>, "target-path=i2c5"; + i2c6 = <&frag100>, "target?=0", + <&frag100>, "target-path=i2c6"; ++ i2c-path = <&frag100>, "target?=0", ++ <&frag100>, "target-path"; + }; + }; +--- a/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts ++++ b/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts +@@ -38,5 +38,7 @@ + <&frag100>, "target-path=i2c5"; + i2c6 = <&frag100>, "target?=0", + <&frag100>, "target-path=i2c6"; ++ i2c-path = <&frag100>, "target?=0", ++ <&frag100>, "target-path"; + }; + }; +--- a/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts ++++ b/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts +@@ -38,5 +38,7 @@ + <&frag100>, "target-path=i2c5"; + i2c6 = <&frag100>, "target?=0", + <&frag100>, "target-path=i2c6"; ++ i2c-path = <&frag100>, "target?=0", ++ <&frag100>, "target-path"; + }; + }; +--- a/arch/arm/boot/dts/overlays/ilitek251x-overlay.dts ++++ b/arch/arm/boot/dts/overlays/ilitek251x-overlay.dts +@@ -16,7 +16,7 @@ + }; + }; + +- fragment@1 { ++ frag1: fragment@1 { + target = <&i2c1>; + __overlay__ { + #address-cells = <1>; +@@ -41,5 +41,7 @@ + <&ili251x>,"interrupts:0"; + sizex = <&ili251x>,"touchscreen-size-x:0"; + sizey = <&ili251x>,"touchscreen-size-y:0"; ++ i2c-path = <&frag1>, "target?=0", ++ <&frag1>, "target-path"; + }; + }; +--- a/arch/arm/boot/dts/overlays/mcp23017-overlay.dts ++++ b/arch/arm/boot/dts/overlays/mcp23017-overlay.dts +@@ -98,6 +98,8 @@ + <&frag100>, "target-path=i2c5"; + i2c6 = <&frag100>, "target?=0", + <&frag100>, "target-path=i2c6"; ++ i2c-path = <&frag100>, "target?=0", ++ <&frag100>, "target-path"; + }; + }; + +--- a/arch/arm/boot/dts/overlays/pca953x-overlay.dts ++++ b/arch/arm/boot/dts/overlays/pca953x-overlay.dts +@@ -5,7 +5,7 @@ + /{ + compatible = "brcm,bcm2835"; + +- fragment@0 { ++ frag0: fragment@0 { + target = <&i2c_arm>; + __overlay__ { + #address-cells = <1>; +@@ -204,6 +204,20 @@ + }; + }; + ++ fragment@100 { ++ target = <&i2c0if>; ++ __dormant__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@101 { ++ target = <&i2c0mux>; ++ __dormant__ { ++ status = "okay"; ++ }; ++ }; ++ + __overrides__ { + addr = <&pca>,"reg:0"; + pca6416 = <0>, "+1"; +@@ -236,5 +250,19 @@ + cat9554 = <0>, "+28"; + pca9654 = <0>, "+29"; + xra1202 = <0>, "+30"; ++ i2c0 = <&frag0>, "target:0=",<&i2c0>, ++ <0>,"+100+101"; ++ i2c_csi_dsi = <&frag0>, "target:0=",<&i2c_csi_dsi>, ++ <0>,"+100+101"; ++ i2c3 = <&frag0>, "target?=0", ++ <&frag0>, "target-path=i2c3"; ++ i2c4 = <&frag0>, "target?=0", ++ <&frag0>, "target-path=i2c4"; ++ i2c5 = <&frag0>, "target?=0", ++ <&frag0>, "target-path=i2c5"; ++ i2c6 = <&frag0>, "target?=0", ++ <&frag0>, "target-path=i2c6"; ++ i2c-path = <&frag0>, "target?=0", ++ <&frag0>, "target-path"; + }; + }; +--- a/arch/arm/boot/dts/overlays/pcf857x-overlay.dts ++++ b/arch/arm/boot/dts/overlays/pcf857x-overlay.dts +@@ -6,7 +6,7 @@ + / { + compatible = "brcm,bcm2835"; + +- fragment@0 { ++ frag0: fragment@0 { + target = <&i2c_arm>; + __overlay__ { + #address-cells = <1>; +@@ -22,11 +22,39 @@ + }; + }; + ++ fragment@100 { ++ target = <&i2c0if>; ++ __dormant__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@101 { ++ target = <&i2c0mux>; ++ __dormant__ { ++ status = "okay"; ++ }; ++ }; ++ + __overrides__ { + pcf8574 = <&pcf857x>,"compatible=nxp,pcf8574", <&pcf857x>,"reg:0=0x20"; + pcf8574a = <&pcf857x>,"compatible=nxp,pcf8574a", <&pcf857x>,"reg:0=0x38"; + pcf8575 = <&pcf857x>,"compatible=nxp,pcf8575", <&pcf857x>,"reg:0=0x20"; + pca8574 = <&pcf857x>,"compatible=nxp,pca8574", <&pcf857x>,"reg:0=0x20"; + addr = <&pcf857x>,"reg:0"; ++ i2c0 = <&frag0>, "target:0=",<&i2c0>, ++ <0>,"+100+101"; ++ i2c_csi_dsi = <&frag0>, "target:0=",<&i2c_csi_dsi>, ++ <0>,"+100+101"; ++ i2c3 = <&frag0>, "target?=0", ++ <&frag0>, "target-path=i2c3"; ++ i2c4 = <&frag0>, "target?=0", ++ <&frag0>, "target-path=i2c4"; ++ i2c5 = <&frag0>, "target?=0", ++ <&frag0>, "target-path=i2c5"; ++ i2c6 = <&frag0>, "target?=0", ++ <&frag0>, "target-path=i2c6"; ++ i2c-path = <&frag0>, "target?=0", ++ <&frag0>, "target-path"; + }; + }; +--- a/arch/arm/boot/dts/overlays/sc16is750-i2c-overlay.dts ++++ b/arch/arm/boot/dts/overlays/sc16is750-i2c-overlay.dts +@@ -4,7 +4,7 @@ + / { + compatible = "brcm,bcm2835"; + +- fragment@0 { ++ frag0: fragment@0 { + target = <&i2c_arm>; + __overlay__ { + #address-cells = <1>; +@@ -48,10 +48,38 @@ + }; + }; + ++ fragment@100 { ++ target = <&i2c0if>; ++ __dormant__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@101 { ++ target = <&i2c0mux>; ++ __dormant__ { ++ status = "okay"; ++ }; ++ }; ++ + __overrides__ { + int_pin = <&sc16is750>,"interrupts:0", <&int_pins>,"brcm,pins:0", + <&int_pins>,"reg:0"; + addr = <&sc16is750>,"reg:0", <&sc16is750_clk>,"name"; + xtal = <&sc16is750_clk>,"clock-frequency:0"; ++ i2c0 = <&frag0>, "target:0=",<&i2c0>, ++ <0>,"+100+101"; ++ i2c_csi_dsi = <&frag0>, "target:0=",<&i2c_csi_dsi>, ++ <0>,"+100+101"; ++ i2c3 = <&frag0>, "target?=0", ++ <&frag0>, "target-path=i2c3"; ++ i2c4 = <&frag0>, "target?=0", ++ <&frag0>, "target-path=i2c4"; ++ i2c5 = <&frag0>, "target?=0", ++ <&frag0>, "target-path=i2c5"; ++ i2c6 = <&frag0>, "target?=0", ++ <&frag0>, "target-path=i2c6"; ++ i2c-path = <&frag0>, "target?=0", ++ <&frag0>, "target-path"; + }; + }; +--- a/arch/arm/boot/dts/overlays/sc16is752-i2c-overlay.dts ++++ b/arch/arm/boot/dts/overlays/sc16is752-i2c-overlay.dts +@@ -4,7 +4,7 @@ + / { + compatible = "brcm,bcm2835"; + +- fragment@0 { ++ frag0: fragment@0 { + target = <&i2c_arm>; + __overlay__ { + #address-cells = <1>; +@@ -48,10 +48,38 @@ + }; + }; + ++ fragment@100 { ++ target = <&i2c0if>; ++ __dormant__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@101 { ++ target = <&i2c0mux>; ++ __dormant__ { ++ status = "okay"; ++ }; ++ }; ++ + __overrides__ { + int_pin = <&sc16is752>,"interrupts:0", <&int_pins>,"brcm,pins:0", + <&int_pins>,"reg:0"; + addr = <&sc16is752>,"reg:0",<&sc16is752_clk>,"name"; + xtal = <&sc16is752_clk>,"clock-frequency:0"; ++ i2c0 = <&frag0>, "target:0=",<&i2c0>, ++ <0>,"+100+101"; ++ i2c_csi_dsi = <&frag0>, "target:0=",<&i2c_csi_dsi>, ++ <0>,"+100+101"; ++ i2c3 = <&frag0>, "target?=0", ++ <&frag0>, "target-path=i2c3"; ++ i2c4 = <&frag0>, "target?=0", ++ <&frag0>, "target-path=i2c4"; ++ i2c5 = <&frag0>, "target?=0", ++ <&frag0>, "target-path=i2c5"; ++ i2c6 = <&frag0>, "target?=0", ++ <&frag0>, "target-path=i2c6"; ++ i2c-path = <&frag0>, "target?=0", ++ <&frag0>, "target-path"; + }; + }; diff --git a/target/linux/bcm27xx/patches-6.6/950-1468-misc-rp1-pio-Support-larger-data-transfers.patch b/target/linux/bcm27xx/patches-6.6/950-1468-misc-rp1-pio-Support-larger-data-transfers.patch index 828efdb79bc644..3183fb580e3fce 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1468-misc-rp1-pio-Support-larger-data-transfers.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1468-misc-rp1-pio-Support-larger-data-transfers.patch @@ -1,7 +1,7 @@ From 4b0ca96738bb937529655a0062d60775f47b0f5e Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 16 Dec 2024 23:01:41 +0000 -Subject: [PATCH 1468/1482] misc: rp1-pio: Support larger data transfers +Subject: [PATCH] misc: rp1-pio: Support larger data transfers Add a separate IOCTL for larger transfer with a 32-bit data_bytes field. diff --git a/target/linux/bcm27xx/patches-6.6/950-1469-dtoverlays-Use-continuous-clock-mode-for-ov9281.patch b/target/linux/bcm27xx/patches-6.6/950-1469-dtoverlays-Use-continuous-clock-mode-for-ov9281.patch new file mode 100644 index 00000000000000..c59e72eb139465 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1469-dtoverlays-Use-continuous-clock-mode-for-ov9281.patch @@ -0,0 +1,34 @@ +From a4a4d7f9183bae11d81616346038e9efaba2fce1 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Mon, 16 Dec 2024 19:15:52 +0000 +Subject: [PATCH] dtoverlays: Use continuous clock mode for ov9281 + +This increases the maximum frame rate from 247 to 260fps in +10-bit mode. + +Signed-off-by: Dave Stevenson +--- + arch/arm/boot/dts/overlays/ov9281-overlay.dts | 1 - + arch/arm/boot/dts/overlays/ov9281.dtsi | 1 - + 2 files changed, 2 deletions(-) + +--- a/arch/arm/boot/dts/overlays/ov9281-overlay.dts ++++ b/arch/arm/boot/dts/overlays/ov9281-overlay.dts +@@ -29,7 +29,6 @@ + csi_ep: endpoint { + remote-endpoint = <&cam_endpoint>; + data-lanes = <1 2>; +- clock-noncontinuous; + }; + }; + }; +--- a/arch/arm/boot/dts/overlays/ov9281.dtsi ++++ b/arch/arm/boot/dts/overlays/ov9281.dtsi +@@ -19,7 +19,6 @@ cam_node: ov9281@60 { + cam_endpoint: endpoint { + clock-lanes = <0>; + data-lanes = <1 2>; +- clock-noncontinuous; + link-frequencies = + /bits/ 64 <400000000>; + }; diff --git a/target/linux/bcm27xx/patches-6.6/950-1470-overlays-goodix-Allow-override-i2c-address.patch b/target/linux/bcm27xx/patches-6.6/950-1470-overlays-goodix-Allow-override-i2c-address.patch new file mode 100644 index 00000000000000..508896b3bda4ff --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1470-overlays-goodix-Allow-override-i2c-address.patch @@ -0,0 +1,36 @@ +From 62085522016ee2dadbe8668a6a97919770020817 Mon Sep 17 00:00:00 2001 +From: Renjaya Raga Zenta +Date: Wed, 18 Dec 2024 16:44:32 +0700 +Subject: [PATCH] overlays: goodix: Allow override i2c address + +Some Goodix devices e.g. gt911 use address 0x5d instead of 0x14. +So, make the address overridable. + +Signed-off-by: Renjaya Raga Zenta +--- + arch/arm/boot/dts/overlays/README | 3 ++- + arch/arm/boot/dts/overlays/goodix-overlay.dts | 1 + + 2 files changed, 3 insertions(+), 1 deletion(-) + +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -1439,7 +1439,8 @@ Name: goodix + Info: Enables I2C connected Goodix gt9271 multiple touch controller using + GPIOs 4 and 17 (pins 7 and 11 on GPIO header) for interrupt and reset. + Load: dtoverlay=goodix,= +-Params: interrupt GPIO used for interrupt (default 4) ++Params: addr I2C address (default 0x14) ++ interrupt GPIO used for interrupt (default 4) + reset GPIO used for reset (default 17) + i2c-path Override I2C path to allow for i2c-gpio buses + +--- a/arch/arm/boot/dts/overlays/goodix-overlay.dts ++++ b/arch/arm/boot/dts/overlays/goodix-overlay.dts +@@ -37,6 +37,7 @@ + }; + + __overrides__ { ++ addr = <>9271>,"reg:0"; + interrupt = <&goodix_pins>,"brcm,pins:0", + <>9271>,"interrupts:0", + <>9271>,"irq-gpios:4"; diff --git a/target/linux/bcm27xx/patches-6.6/950-1471-fixup-misc-Add-RP1-PIO-driver.patch b/target/linux/bcm27xx/patches-6.6/950-1471-fixup-misc-Add-RP1-PIO-driver.patch index 696c0d918618aa..5adc2a69c76ddc 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1471-fixup-misc-Add-RP1-PIO-driver.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1471-fixup-misc-Add-RP1-PIO-driver.patch @@ -1,7 +1,7 @@ From cd26850713088942ca4f9a248a8bed1f0504a58f Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 19 Dec 2024 15:11:40 +0000 -Subject: [PATCH 1471/1482] fixup! misc: Add RP1 PIO driver +Subject: [PATCH] fixup! misc: Add RP1 PIO driver Change the Kconfig dependencies so that RP1_PIO depends on FIRMWARE_RP1, rather than selecting it. diff --git a/target/linux/bcm27xx/patches-6.6/950-1473-misc-rp1-pio-More-logical-probe-sequence.patch b/target/linux/bcm27xx/patches-6.6/950-1473-misc-rp1-pio-More-logical-probe-sequence.patch index 3204997b6ec04b..b67b0290105cd1 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1473-misc-rp1-pio-More-logical-probe-sequence.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1473-misc-rp1-pio-More-logical-probe-sequence.patch @@ -1,7 +1,7 @@ From 468b525d45a726e4ba704b33c4eba53de47ac684 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 5 Dec 2024 16:03:39 +0000 -Subject: [PATCH 1473/1482] misc: rp1-pio: More logical probe sequence +Subject: [PATCH] misc: rp1-pio: More logical probe sequence Sort the probe function initialisation into a more logical order. diff --git a/target/linux/bcm27xx/patches-6.6/950-1474-misc-rp1-pio-Convert-floats-to-24.8-fixed-point.patch b/target/linux/bcm27xx/patches-6.6/950-1474-misc-rp1-pio-Convert-floats-to-24.8-fixed-point.patch index ba997136bd485c..d843f1f913a7ca 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1474-misc-rp1-pio-Convert-floats-to-24.8-fixed-point.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1474-misc-rp1-pio-Convert-floats-to-24.8-fixed-point.patch @@ -1,7 +1,7 @@ From 5c07ba20630a629399eaa6583457aca93ff74606 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 9 Dec 2024 09:58:29 +0000 -Subject: [PATCH 1474/1482] misc: rp1-pio: Convert floats to 24.8 fixed point +Subject: [PATCH] misc: rp1-pio: Convert floats to 24.8 fixed point Floating point arithmetic is not supported in the kernel, so use fixed point instead. diff --git a/target/linux/bcm27xx/patches-6.6/950-1475-misc-rp1-pio-Minor-cosmetic-tweaks.patch b/target/linux/bcm27xx/patches-6.6/950-1475-misc-rp1-pio-Minor-cosmetic-tweaks.patch index 73cbacb328d2d1..439698d3ef3091 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1475-misc-rp1-pio-Minor-cosmetic-tweaks.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1475-misc-rp1-pio-Minor-cosmetic-tweaks.patch @@ -1,7 +1,7 @@ From 75203c6641cfe47dfb817b095430021b0981ff47 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 10 Dec 2024 12:06:14 +0000 -Subject: [PATCH 1475/1482] misc: rp1-pio: Minor cosmetic tweaks +Subject: [PATCH] misc: rp1-pio: Minor cosmetic tweaks No functional change. diff --git a/target/linux/bcm27xx/patches-6.6/950-1476-misc-rp1-pio-Add-in-kernel-DMA-support.patch b/target/linux/bcm27xx/patches-6.6/950-1476-misc-rp1-pio-Add-in-kernel-DMA-support.patch index 05c6de2b01a982..facfb23c95ce29 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1476-misc-rp1-pio-Add-in-kernel-DMA-support.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1476-misc-rp1-pio-Add-in-kernel-DMA-support.patch @@ -1,7 +1,7 @@ From fddd3e9318dbf01fb763b6880021abc558fce8e6 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 12 Dec 2024 17:09:27 +0000 -Subject: [PATCH 1476/1482] misc: rp1-pio: Add in-kernel DMA support +Subject: [PATCH] misc: rp1-pio: Add in-kernel DMA support Add kernel-facing implementations of pio_sm_config_xfer and pio_xm_xfer_data. diff --git a/target/linux/bcm27xx/patches-6.6/950-1477-misc-Add-ws2812-pio-rp1-driver.patch b/target/linux/bcm27xx/patches-6.6/950-1477-misc-Add-ws2812-pio-rp1-driver.patch index 469a8a9b91a7e2..b50bdea197e14a 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1477-misc-Add-ws2812-pio-rp1-driver.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1477-misc-Add-ws2812-pio-rp1-driver.patch @@ -1,7 +1,7 @@ From d6d83ad3d9a3a594909a1ad1c82b735ab711cd12 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 3 Dec 2024 16:09:30 +0000 -Subject: [PATCH 1477/1482] misc: Add ws2812-pio-rp1 driver +Subject: [PATCH] misc: Add ws2812-pio-rp1 driver ws2812-pio-rp1 is a PIO-based driver for WS2812 LEDS. It creates a character device in /dev, the default name of which is /dev/leds, diff --git a/target/linux/bcm27xx/patches-6.6/950-1478-overlays-Add-ws2812-pio-overlay.patch b/target/linux/bcm27xx/patches-6.6/950-1478-overlays-Add-ws2812-pio-overlay.patch index 8e5051f385506c..ab98fa139f9a9e 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1478-overlays-Add-ws2812-pio-overlay.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1478-overlays-Add-ws2812-pio-overlay.patch @@ -1,7 +1,7 @@ From 4a8f2b39157825fefc505fe4b94f3a9ce101e170 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 12 Dec 2024 23:23:39 +0000 -Subject: [PATCH 1478/1482] overlays: Add ws2812-pio overlay +Subject: [PATCH] overlays: Add ws2812-pio overlay Add an overlay to enable a WS2812 LED driver on a given GPIO. @@ -15,7 +15,7 @@ Signed-off-by: Phil Elwell --- a/arch/arm/boot/dts/overlays/Makefile +++ b/arch/arm/boot/dts/overlays/Makefile -@@ -337,7 +337,8 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ +@@ -342,7 +342,8 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ waveshare-can-fd-hat-mode-a.dtbo \ waveshare-can-fd-hat-mode-b.dtbo \ wittypi.dtbo \ @@ -27,7 +27,7 @@ Signed-off-by: Phil Elwell targets += $(dtbo-y) --- a/arch/arm/boot/dts/overlays/README +++ b/arch/arm/boot/dts/overlays/README -@@ -5487,6 +5487,28 @@ Params: alsaname Changes +@@ -5599,6 +5599,28 @@ Params: alsaname Changes compatible Changes the codec compatibility diff --git a/target/linux/bcm27xx/patches-6.6/950-1480-overlays-Add-and-document-i2c_csi_dsi0-parameters.patch b/target/linux/bcm27xx/patches-6.6/950-1480-overlays-Add-and-document-i2c_csi_dsi0-parameters.patch new file mode 100644 index 00000000000000..ab0f051136fb2c --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1480-overlays-Add-and-document-i2c_csi_dsi0-parameters.patch @@ -0,0 +1,342 @@ +From 489570796a5789f849683fc3fb034c55cb13e4c6 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 19 Dec 2024 17:13:17 +0000 +Subject: [PATCH] overlays: Add and document i2c_csi_dsi0 parameters + +Add "i2c_csi_dsi0" parameters to overlays that already have an +"i2c_csi_dsi" parameter. + +The I2C bus and GPIO mapping of i2c_csi_dsi and i2c_csi_dsi0 varies +between platforms. Document the associations against the dtparams +"i2c_csi_dsi" and "i2c_csi_dsi0" - run "dtparam -h i2c_csi_dsi" +and "dtparam -h i2c_csi_dsi0" to read it. + +Signed-off-by: Phil Elwell +--- + arch/arm/boot/dts/overlays/README | 103 ++++++++++++++++-- + .../arm/boot/dts/overlays/ads1115-overlay.dts | 2 + + .../arm/boot/dts/overlays/i2c-fan-overlay.dts | 2 + + .../arm/boot/dts/overlays/i2c-mux-overlay.dts | 2 + + .../dts/overlays/i2c-pwm-pca9685a-overlay.dts | 2 + + .../arm/boot/dts/overlays/i2c-rtc-overlay.dts | 2 + + .../boot/dts/overlays/i2c-sensor-overlay.dts | 2 + + .../boot/dts/overlays/mcp23017-overlay.dts | 2 + + .../arm/boot/dts/overlays/pca953x-overlay.dts | 2 + + .../arm/boot/dts/overlays/pcf857x-overlay.dts | 2 + + .../dts/overlays/sc16is750-i2c-overlay.dts | 2 + + .../dts/overlays/sc16is752-i2c-overlay.dts | 2 + + 12 files changed, 113 insertions(+), 12 deletions(-) + +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -301,10 +301,31 @@ Params: + i2c_baudrate An alias for i2c_arm_baudrate + + i2c_csi_dsi Set to "on" to enable the i2c_csi_dsi interface ++ The I2C bus and GPIOs are platform specific: ++ B rev 1: ++ i2c-1 on 2 & 3 ++ B rev 2, B+, CM, Zero, Zero W, 2B, CM2, CM3, ++ CM4S: ++ i2c-0 on 28 & 29 ++ 3B, 3B+, Zero 2W, 4B, 400, CM4: ++ i2c-0 on 44 & 45 ++ 5, 500: ++ i2c-11/i2c-4 on 40 & 41 ++ CM5 on CM5IO: ++ i2c-0 on 0 & 1 ++ CM5 on CM4IO: ++ i2c-10/i2c-6 on 38 & 39 + + i2c_csi_dsi0 Set to "on" to enable the i2c_csi_dsi0 interface ++ The I2C bus and GPIOs are platform specific: ++ B rev 1 & 2, B+, CM, Zero, Zero W, 2B, CM2, ++ CM3, CM4S, 3B, 3B+, Zero 2W, 4B, 400, CM4, ++ CM5 on CM4IO: ++ i2c-0 on 0 & 1 ++ 5, 500, CM5 on CM5IO: ++ i2c-10/i2c-6 on 38 & 39 + +- i2c_csi_dsi1 Set to "on" to enable the i2c_csi_dsi1 interface ++ i2c_csi_dsi1 A Pi 5 family-specific alias for i2c_csi_dsi. + + i2c_vc Set to "on" to enable the i2c interface + usually reserved for the VideoCore processor +@@ -546,7 +567,12 @@ Params: addr I2C bus + Amplifier for this channel. (Default 1 sets the + full scale of the channel to 4.096 Volts) + i2c0 Choose the I2C0 bus on GPIOs 0&1 +- i2c_csi_dsi Choose the I2C0 bus on GPIOs 44&45 ++ i2c_csi_dsi Choose the I2C bus connected to the main ++ camera/display connector. ++ See "dtparam -h i2c_csi_dsi" for details. ++ i2c_csi_dsi0 Choose the I2C bus connected to the second ++ camera/display connector, if present. ++ See "dtparam -h i2c_csi_dsi0" for details. + i2c3 Choose the I2C3 bus (configure with the i2c3 + overlay - BCM2711 only) + i2c4 Choose the I2C4 bus (configure with the i2c4 +@@ -2086,7 +2112,13 @@ Params: addr Sets the + + i2c0 Choose the I2C0 bus on GPIOs 0&1 + +- i2c_csi_dsi Choose the I2C0 bus on GPIOs 44&45 ++ i2c_csi_dsi Choose the I2C bus connected to the main ++ camera/display connector. ++ See "dtparam -h i2c_csi_dsi" for details. ++ ++ i2c_csi_dsi0 Choose the I2C bus connected to the second ++ camera/display connector, if present. ++ See "dtparam -h i2c_csi_dsi0" for details. + + i2c3 Choose the I2C3 bus (configure with the i2c3 + overlay - BCM2711 only) +@@ -2158,7 +2190,13 @@ Params: pca9542 Select t + + i2c0 Choose the I2C0 bus on GPIOs 0&1 + +- i2c_csi_dsi Choose the I2C0 bus on GPIOs 44&45 ++ i2c_csi_dsi Choose the I2C bus connected to the main ++ camera/display connector. ++ See "dtparam -h i2c_csi_dsi" for details. ++ ++ i2c_csi_dsi0 Choose the I2C bus connected to the second ++ camera/display connector, if present. ++ See "dtparam -h i2c_csi_dsi0" for details. + + i2c3 Choose the I2C3 bus (configure with the i2c3 + overlay - BCM2711 only) +@@ -2186,7 +2224,12 @@ Info: Adds support for an NXP PCA9685A + Load: dtoverlay=i2c-pwm-pca9685a,= + Params: addr I2C address of PCA9685A (default 0x40) + i2c0 Choose the I2C0 bus on GPIOs 0&1 +- i2c_csi_dsi Choose the I2C0 bus on GPIOs 44&45 ++ i2c_csi_dsi Choose the I2C bus connected to the main ++ camera/display connector. ++ See "dtparam -h i2c_csi_dsi" for details. ++ i2c_csi_dsi0 Choose the I2C bus connected to the second ++ camera/display connector, if present. ++ See "dtparam -h i2c_csi_dsi0" for details. + i2c3 Choose the I2C3 bus (configure with the i2c3 + overlay - BCM2711 only) + i2c4 Choose the I2C3 bus (configure with the i2c3 +@@ -2251,7 +2294,13 @@ Params: abx80x Select o + + i2c0 Choose the I2C0 bus on GPIOs 0&1 + +- i2c_csi_dsi Choose the I2C0 bus on GPIOs 44&45 ++ i2c_csi_dsi Choose the I2C bus connected to the main ++ camera/display connector. ++ See "dtparam -h i2c_csi_dsi" for details. ++ ++ i2c_csi_dsi0 Choose the I2C bus connected to the second ++ camera/display connector, if present. ++ See "dtparam -h i2c_csi_dsi0" for details. + + i2c3 Choose the I2C3 bus (configure with the i2c3 + overlay - BCM2711 only) +@@ -2517,7 +2566,12 @@ Params: addr Set the + + i2c0 Choose the I2C0 bus on GPIOs 0&1 + +- i2c_csi_dsi Choose the I2C0 bus on GPIOs 44&45 ++ i2c_csi_dsi Choose the I2C bus connected to the main ++ camera/display connector. ++ See "dtparam -h i2c_csi_dsi" for details. ++ i2c_csi_dsi0 Choose the I2C bus connected to the second ++ camera/display connector, if present. ++ See "dtparam -h i2c_csi_dsi0" for details. + + i2c3 Choose the I2C3 bus (configure with the i2c3 + overlay - BCM2711 only) +@@ -3144,7 +3198,12 @@ Params: gpiopin Gpio pin + mcp23008 Configure an MCP23008 instead. + noints Disable the interrupt GPIO line. + i2c0 Choose the I2C0 bus on GPIOs 0&1 +- i2c_csi_dsi Choose the I2C0 bus on GPIOs 44&45 ++ i2c_csi_dsi Choose the I2C bus connected to the main ++ camera/display connector. ++ See "dtparam -h i2c_csi_dsi" for details. ++ i2c_csi_dsi0 Choose the I2C bus connected to the second ++ camera/display connector, if present. ++ See "dtparam -h i2c_csi_dsi0" for details. + i2c3 Choose the I2C3 bus (configure with the i2c3 + overlay - BCM2711 only) + i2c4 Choose the I2C4 bus (configure with the i2c4 +@@ -3604,7 +3663,12 @@ Params: addr I2C addr + pca9654 Select the Onnn PCA9654 (8 bit) + xra1202 Select the Exar XRA1202 (8 bit) + i2c0 Choose the I2C0 bus on GPIOs 0&1 +- i2c_csi_dsi Choose the I2C0 bus on GPIOs 44&45 ++ i2c_csi_dsi Choose the I2C bus connected to the main ++ camera/display connector. ++ See "dtparam -h i2c_csi_dsi" for details. ++ i2c_csi_dsi0 Choose the I2C bus connected to the second ++ camera/display connector, if present. ++ See "dtparam -h i2c_csi_dsi0" for details. + i2c3 Choose the I2C3 bus (configure with the i2c3 + overlay - BCM2711 only) + i2c4 Choose the I2C3 bus (configure with the i2c3 +@@ -3626,7 +3690,12 @@ Params: addr I2C addr + pcf8575 Select the NXP PCF8575 (16 bit) + pca8574 Select the NXP PCA8574 (8 bit) + i2c0 Choose the I2C0 bus on GPIOs 0&1 +- i2c_csi_dsi Choose the I2C0 bus on GPIOs 44&45 ++ i2c_csi_dsi Choose the I2C bus connected to the main ++ camera/display connector. ++ See "dtparam -h i2c_csi_dsi" for details. ++ i2c_csi_dsi0 Choose the I2C bus connected to the second ++ camera/display connector, if present. ++ See "dtparam -h i2c_csi_dsi0" for details. + i2c3 Choose the I2C3 bus (configure with the i2c3 + overlay - BCM2711 only) + i2c4 Choose the I2C3 bus (configure with the i2c3 +@@ -4296,7 +4365,12 @@ Params: int_pin GPIO use + addr Address (default 0x48) + xtal On-board crystal frequency (default 14745600) + i2c0 Choose the I2C0 bus on GPIOs 0&1 +- i2c_csi_dsi Choose the I2C0 bus on GPIOs 44&45 ++ i2c_csi_dsi Choose the I2C bus connected to the main ++ camera/display connector. ++ See "dtparam -h i2c_csi_dsi" for details. ++ i2c_csi_dsi0 Choose the I2C bus connected to the second ++ camera/display connector, if present. ++ See "dtparam -h i2c_csi_dsi0" for details. + i2c3 Choose the I2C3 bus (configure with the i2c3 + overlay - BCM2711 only) + i2c4 Choose the I2C4 bus (configure with the i2c4 +@@ -4325,7 +4399,12 @@ Params: int_pin GPIO use + addr Address (default 0x48) + xtal On-board crystal frequency (default 14745600) + i2c0 Choose the I2C0 bus on GPIOs 0&1 +- i2c_csi_dsi Choose the I2C0 bus on GPIOs 44&45 ++ i2c_csi_dsi Choose the I2C bus connected to the main ++ camera/display connector. ++ See "dtparam -h i2c_csi_dsi" for details. ++ i2c_csi_dsi0 Choose the I2C bus connected to the second ++ camera/display connector, if present. ++ See "dtparam -h i2c_csi_dsi0" for details. + i2c3 Choose the I2C3 bus (configure with the i2c3 + overlay - BCM2711 only) + i2c4 Choose the I2C4 bus (configure with the i2c4 +--- a/arch/arm/boot/dts/overlays/ads1115-overlay.dts ++++ b/arch/arm/boot/dts/overlays/ads1115-overlay.dts +@@ -123,6 +123,8 @@ + i2c0 = <&frag100>, "target:0=",<&i2c0>; + i2c_csi_dsi = <&frag100>, "target:0=",<&i2c_csi_dsi>, + <0>,"+101+102"; ++ i2c_csi_dsi0 = <&frag100>, "target:0=",<&i2c_csi_dsi0>, ++ <0>,"+101+102"; + i2c3 = <&frag100>, "target?=0", + <&frag100>, "target-path=i2c3"; + i2c4 = <&frag100>, "target?=0", +--- a/arch/arm/boot/dts/overlays/i2c-fan-overlay.dts ++++ b/arch/arm/boot/dts/overlays/i2c-fan-overlay.dts +@@ -85,6 +85,8 @@ + i2c0 = <&frag100>,"target:0=",<&i2c0>; + i2c_csi_dsi = <&frag100>,"target:0=",<&i2c_csi_dsi>, + <0>,"+101+102"; ++ i2c_csi_dsi0 = <&frag100>, "target:0=",<&i2c_csi_dsi0>, ++ <0>,"+101+102"; + i2c3 = <&frag100>, "target?=0", + <&frag100>, "target-path=i2c3"; + i2c4 = <&frag100>, "target?=0", +--- a/arch/arm/boot/dts/overlays/i2c-mux-overlay.dts ++++ b/arch/arm/boot/dts/overlays/i2c-mux-overlay.dts +@@ -167,6 +167,8 @@ + <0>,"+101+102"; + i2c_csi_dsi = <&frag100>, "target:0=",<&i2c_csi_dsi>, + <0>,"+101+102"; ++ i2c_csi_dsi0 = <&frag100>, "target:0=",<&i2c_csi_dsi0>, ++ <0>,"+101+102"; + i2c3 = <&frag100>, "target?=0", + <&frag100>, "target-path=i2c3"; + i2c4 = <&frag100>, "target?=0", +--- a/arch/arm/boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts ++++ b/arch/arm/boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts +@@ -49,6 +49,8 @@ + <0>,"+101+102"; + i2c_csi_dsi = <&frag100>, "target:0=",<&i2c_csi_dsi>, + <0>,"+101+102"; ++ i2c_csi_dsi0 = <&frag100>, "target:0=",<&i2c_csi_dsi0>, ++ <0>,"+101+102"; + i2c3 = <&frag100>, "target?=0", + <&frag100>, "target-path=i2c3"; + i2c4 = <&frag100>, "target?=0", +--- a/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts ++++ b/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts +@@ -30,6 +30,8 @@ + i2c0 = <&frag100>, "target:0=",<&i2c0>; + i2c_csi_dsi = <&frag100>, "target:0=",<&i2c_csi_dsi>, + <0>,"+101+102"; ++ i2c_csi_dsi0 = <&frag100>, "target:0=",<&i2c_csi_dsi0>, ++ <0>,"+101+102"; + i2c3 = <&frag100>, "target?=0", + <&frag100>, "target-path=i2c3"; + i2c4 = <&frag100>, "target?=0", +--- a/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts ++++ b/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts +@@ -30,6 +30,8 @@ + i2c0 = <&frag100>, "target:0=",<&i2c0>; + i2c_csi_dsi = <&frag100>, "target:0=",<&i2c_csi_dsi>, + <0>,"+101+102"; ++ i2c_csi_dsi0 = <&frag100>, "target:0=",<&i2c_csi_dsi0>, ++ <0>,"+101+102"; + i2c3 = <&frag100>, "target?=0", + <&frag100>, "target-path=i2c3"; + i2c4 = <&frag100>, "target?=0", +--- a/arch/arm/boot/dts/overlays/mcp23017-overlay.dts ++++ b/arch/arm/boot/dts/overlays/mcp23017-overlay.dts +@@ -90,6 +90,8 @@ + i2c0 = <&frag100>, "target:0=",<&i2c0>; + i2c_csi_dsi = <&frag100>, "target:0=",<&i2c_csi_dsi>, + <0>,"+101+102"; ++ i2c_csi_dsi0 = <&frag100>, "target:0=",<&i2c_csi_dsi0>, ++ <0>,"+101+102"; + i2c3 = <&frag100>, "target?=0", + <&frag100>, "target-path=i2c3"; + i2c4 = <&frag100>, "target?=0", +--- a/arch/arm/boot/dts/overlays/pca953x-overlay.dts ++++ b/arch/arm/boot/dts/overlays/pca953x-overlay.dts +@@ -254,6 +254,8 @@ + <0>,"+100+101"; + i2c_csi_dsi = <&frag0>, "target:0=",<&i2c_csi_dsi>, + <0>,"+100+101"; ++ i2c_csi_dsi0 = <&frag0>, "target:0=",<&i2c_csi_dsi0>, ++ <0>,"+100+101"; + i2c3 = <&frag0>, "target?=0", + <&frag0>, "target-path=i2c3"; + i2c4 = <&frag0>, "target?=0", +--- a/arch/arm/boot/dts/overlays/pcf857x-overlay.dts ++++ b/arch/arm/boot/dts/overlays/pcf857x-overlay.dts +@@ -46,6 +46,8 @@ + <0>,"+100+101"; + i2c_csi_dsi = <&frag0>, "target:0=",<&i2c_csi_dsi>, + <0>,"+100+101"; ++ i2c_csi_dsi0 = <&frag0>, "target:0=",<&i2c_csi_dsi0>, ++ <0>,"+100+101"; + i2c3 = <&frag0>, "target?=0", + <&frag0>, "target-path=i2c3"; + i2c4 = <&frag0>, "target?=0", +--- a/arch/arm/boot/dts/overlays/sc16is750-i2c-overlay.dts ++++ b/arch/arm/boot/dts/overlays/sc16is750-i2c-overlay.dts +@@ -71,6 +71,8 @@ + <0>,"+100+101"; + i2c_csi_dsi = <&frag0>, "target:0=",<&i2c_csi_dsi>, + <0>,"+100+101"; ++ i2c_csi_dsi0 = <&frag0>, "target:0=",<&i2c_csi_dsi0>, ++ <0>,"+100+101"; + i2c3 = <&frag0>, "target?=0", + <&frag0>, "target-path=i2c3"; + i2c4 = <&frag0>, "target?=0", +--- a/arch/arm/boot/dts/overlays/sc16is752-i2c-overlay.dts ++++ b/arch/arm/boot/dts/overlays/sc16is752-i2c-overlay.dts +@@ -71,6 +71,8 @@ + <0>,"+100+101"; + i2c_csi_dsi = <&frag0>, "target:0=",<&i2c_csi_dsi>, + <0>,"+100+101"; ++ i2c_csi_dsi0 = <&frag0>, "target:0=",<&i2c_csi_dsi0>, ++ <0>,"+100+101"; + i2c3 = <&frag0>, "target?=0", + <&frag0>, "target-path=i2c3"; + i2c4 = <&frag0>, "target?=0", diff --git a/target/linux/bcm27xx/patches-6.6/950-1481-dts-Add-noanthogs-parameter-to-CM4-and-CM5.patch b/target/linux/bcm27xx/patches-6.6/950-1481-dts-Add-noanthogs-parameter-to-CM4-and-CM5.patch new file mode 100644 index 00000000000000..483031057c5079 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1481-dts-Add-noanthogs-parameter-to-CM4-and-CM5.patch @@ -0,0 +1,56 @@ +From 147ddfdaf626fe5484596235bba8bdc6dcfde501 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 20 Dec 2024 15:08:52 +0000 +Subject: [PATCH] dts: Add noanthogs parameter to CM4 and CM5 + +By default, the antenna selection on CM4 and CM5 is fixed at boot time, +with the dtparams ant1, ant2 and noant selecting which should be +enabled. Add a new dtparam - noanthogs - which leaves the GPIOs free +to be controlled at runtime by the OS. + +N.B. Using this parameter without suitable OS support will leave both +antennae disabled, resulting in attenuated WiFi and Bluetooth signals. + +Signed-off-by: Phil Elwell +--- + arch/arm/boot/dts/broadcom/bcm2711-rpi-cm4.dts | 2 ++ + arch/arm/boot/dts/overlays/README | 6 ++++++ + arch/arm64/boot/dts/broadcom/bcm2712-rpi-cm5.dtsi | 2 ++ + 3 files changed, 10 insertions(+) + +--- a/arch/arm/boot/dts/broadcom/bcm2711-rpi-cm4.dts ++++ b/arch/arm/boot/dts/broadcom/bcm2711-rpi-cm4.dts +@@ -493,6 +493,8 @@ i2c_csi_dsi0: &i2c0 { + <&ant1>, "output-low?=on", + <&ant2>, "output-high?=off", + <&ant2>, "output-low?=on"; ++ noanthogs = <&ant1>,"status=disabled", ++ <&ant2>, "status=disabled"; + + pcie_tperst_clk_ms = <&pcie0>,"brcm,tperst-clk-ms:0"; + }; +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -153,6 +153,12 @@ Params: + + noant Disable both antennas. CM4/5 only. + ++ noanthogs Disable the GPIO hogs on the antenna controls ++ so they can be controlled at runtime. Note that ++ using this parameter without suitable OS ++ support will result in attenuated WiFi and ++ Bluetooth signals. CM4/5 only. ++ + audio Set to "on" to enable the onboard ALSA audio + interface (default "off") + +--- a/arch/arm64/boot/dts/broadcom/bcm2712-rpi-cm5.dtsi ++++ b/arch/arm64/boot/dts/broadcom/bcm2712-rpi-cm5.dtsi +@@ -750,5 +750,7 @@ spi10_cs_pins: &spi10_cs_gpio1 {}; + <&ant1>, "output-low?=on", + <&ant2>, "output-high?=off", + <&ant2>, "output-low?=on"; ++ noanthogs = <&ant1>,"status=disabled", ++ <&ant2>, "status=disabled"; + }; + }; From 4b4f319931cf241aaa0ecb51b3a68d4e0bf738f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Sat, 28 Dec 2024 16:01:34 +0100 Subject: [PATCH 251/877] Revert "bmips: drop macronix nand block protection patch" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 15b21c474ea1c3f3a15bd06a4783b0a019627984. The issue seems to appear spuriously. Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 84ca1c28f7f7729130b56a9a353460e11e071f9a) --- ...evert-macronix-nand-block-protection.patch | 114 ++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 target/linux/bmips/patches-6.6/210-revert-macronix-nand-block-protection.patch diff --git a/target/linux/bmips/patches-6.6/210-revert-macronix-nand-block-protection.patch b/target/linux/bmips/patches-6.6/210-revert-macronix-nand-block-protection.patch new file mode 100644 index 00000000000000..2298c8ea31e17b --- /dev/null +++ b/target/linux/bmips/patches-6.6/210-revert-macronix-nand-block-protection.patch @@ -0,0 +1,114 @@ +From 5a37811de679bff03e9c5a746f75574910ede964 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= +Date: Wed, 22 Mar 2023 20:52:13 +0100 +Subject: [PATCH] Revert "mtd: rawnand: Macronix: Add support for block + protection" +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This reverts commit 03a539c7a118427a6609a26461358c56ac8f3a06. + +Macronix block protection doesn't seem to be supported on Sercomm H-500s +devices since it hangs the device. + +Signed-off-by: Álvaro Fernández Rojas +--- + drivers/mtd/nand/raw/nand_macronix.c | 72 ---------------------------- + 1 file changed, 72 deletions(-) + +--- a/drivers/mtd/nand/raw/nand_macronix.c ++++ b/drivers/mtd/nand/raw/nand_macronix.c +@@ -13,10 +13,6 @@ + #define MACRONIX_READ_RETRY_BIT BIT(0) + #define MACRONIX_NUM_READ_RETRY_MODES 6 + +-#define ONFI_FEATURE_ADDR_MXIC_PROTECTION 0xA0 +-#define MXIC_BLOCK_PROTECTION_ALL_LOCK 0x38 +-#define MXIC_BLOCK_PROTECTION_ALL_UNLOCK 0x0 +- + #define ONFI_FEATURE_ADDR_MXIC_RANDOMIZER 0xB0 + #define MACRONIX_RANDOMIZER_BIT BIT(1) + #define MACRONIX_RANDOMIZER_ENPGM BIT(0) +@@ -189,73 +185,6 @@ static void macronix_nand_fix_broken_get + ONFI_FEATURE_ADDR_TIMING_MODE, 1); + } + +-/* +- * Macronix NAND supports Block Protection by Protectoin(PT) pin; +- * active high at power-on which protects the entire chip even the #WP is +- * disabled. Lock/unlock protection area can be partition according to +- * protection bits, i.e. upper 1/2 locked, upper 1/4 locked and so on. +- */ +-static int mxic_nand_lock(struct nand_chip *chip, loff_t ofs, uint64_t len) +-{ +- u8 feature[ONFI_SUBFEATURE_PARAM_LEN]; +- int ret; +- +- feature[0] = MXIC_BLOCK_PROTECTION_ALL_LOCK; +- nand_select_target(chip, 0); +- ret = nand_set_features(chip, ONFI_FEATURE_ADDR_MXIC_PROTECTION, +- feature); +- nand_deselect_target(chip); +- if (ret) +- pr_err("%s all blocks failed\n", __func__); +- +- return ret; +-} +- +-static int mxic_nand_unlock(struct nand_chip *chip, loff_t ofs, uint64_t len) +-{ +- u8 feature[ONFI_SUBFEATURE_PARAM_LEN]; +- int ret; +- +- feature[0] = MXIC_BLOCK_PROTECTION_ALL_UNLOCK; +- nand_select_target(chip, 0); +- ret = nand_set_features(chip, ONFI_FEATURE_ADDR_MXIC_PROTECTION, +- feature); +- nand_deselect_target(chip); +- if (ret) +- pr_err("%s all blocks failed\n", __func__); +- +- return ret; +-} +- +-static void macronix_nand_block_protection_support(struct nand_chip *chip) +-{ +- u8 feature[ONFI_SUBFEATURE_PARAM_LEN]; +- int ret; +- +- bitmap_set(chip->parameters.get_feature_list, +- ONFI_FEATURE_ADDR_MXIC_PROTECTION, 1); +- +- feature[0] = MXIC_BLOCK_PROTECTION_ALL_UNLOCK; +- nand_select_target(chip, 0); +- ret = nand_get_features(chip, ONFI_FEATURE_ADDR_MXIC_PROTECTION, +- feature); +- nand_deselect_target(chip); +- if (ret || feature[0] != MXIC_BLOCK_PROTECTION_ALL_LOCK) { +- if (ret) +- pr_err("Block protection check failed\n"); +- +- bitmap_clear(chip->parameters.get_feature_list, +- ONFI_FEATURE_ADDR_MXIC_PROTECTION, 1); +- return; +- } +- +- bitmap_set(chip->parameters.set_feature_list, +- ONFI_FEATURE_ADDR_MXIC_PROTECTION, 1); +- +- chip->ops.lock_area = mxic_nand_lock; +- chip->ops.unlock_area = mxic_nand_unlock; +-} +- + static int nand_power_down_op(struct nand_chip *chip) + { + int ret; +@@ -488,7 +417,6 @@ static int macronix_nand_init(struct nan + + macronix_nand_fix_broken_get_timings(chip); + macronix_nand_onfi_init(chip); +- macronix_nand_block_protection_support(chip); + macronix_nand_deep_power_down_support(chip); + macronix_nand_setup_otp(chip); + From 684223c4a43387e73f01b42c6ce1343a7774b9cf Mon Sep 17 00:00:00 2001 From: Kyle Hendry Date: Sun, 24 Nov 2024 11:29:33 -0800 Subject: [PATCH 252/877] bmips: pinctrl-bcm63268: add gpio function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Right now there's no way to know what state CFE will leave the pinctrl registers in, so they should be explicitly set by linux on boot. This patch adds a gpio configuration for drivers that need it, i.e. gpio-leds. Signed-off-by: Kyle Hendry [improve patch and fix warnings] Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit e44daa4fa5ab8d7ad8e23f61fac0286417fdd5e7) --- ...0-pinctrl-bcm63268-add-gpio-function.patch | 260 ++++++++++++++++++ 1 file changed, 260 insertions(+) create mode 100644 target/linux/bmips/patches-6.6/110-pinctrl-bcm63268-add-gpio-function.patch diff --git a/target/linux/bmips/patches-6.6/110-pinctrl-bcm63268-add-gpio-function.patch b/target/linux/bmips/patches-6.6/110-pinctrl-bcm63268-add-gpio-function.patch new file mode 100644 index 00000000000000..afd4aa87168d32 --- /dev/null +++ b/target/linux/bmips/patches-6.6/110-pinctrl-bcm63268-add-gpio-function.patch @@ -0,0 +1,260 @@ +From patchwork Tue Dec 24 10:36:45 2024 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +X-Patchwork-Submitter: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= + +X-Patchwork-Id: 2027352 +Return-Path: + +X-Original-To: incoming@patchwork.ozlabs.org +Delivered-To: patchwork-incoming@legolas.ozlabs.org +Authentication-Results: legolas.ozlabs.org; + dkim=pass (2048-bit key; + unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 + header.s=20230601 header.b=UahONGdE; + dkim-atps=neutral +Authentication-Results: legolas.ozlabs.org; + spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org + (client-ip=2604:1380:45d1:ec00::1; helo=ny.mirrors.kernel.org; + envelope-from=linux-gpio+bounces-14196-incoming=patchwork.ozlabs.org@vger.kernel.org; + receiver=patchwork.ozlabs.org) +Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org + [IPv6:2604:1380:45d1:ec00::1]) + (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) + key-exchange X25519 server-signature ECDSA (secp384r1)) + (No client certificate requested) + by legolas.ozlabs.org (Postfix) with ESMTPS id 4YHWfw1qmwz1yRt + for ; Tue, 24 Dec 2024 21:42:16 +1100 (AEDT) +Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) + (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) + (No client certificate requested) + by ny.mirrors.kernel.org (Postfix) with ESMTPS id C1409161D8A + for ; Tue, 24 Dec 2024 10:37:04 +0000 (UTC) +Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) + by smtp.subspace.kernel.org (Postfix) with ESMTP id C7E791B4132; + Tue, 24 Dec 2024 10:36:55 +0000 (UTC) +Authentication-Results: smtp.subspace.kernel.org; + dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com + header.b="UahONGdE" +X-Original-To: linux-gpio@vger.kernel.org +Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com + [209.85.221.53]) + (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) + (No client certificate requested) + by smtp.subspace.kernel.org (Postfix) with ESMTPS id D319C156F54; + Tue, 24 Dec 2024 10:36:53 +0000 (UTC) +Authentication-Results: smtp.subspace.kernel.org; + arc=none smtp.client-ip=209.85.221.53 +ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; + t=1735036615; cv=none; + b=PEr2vZNz4kb5F2BBGJpTRVGs1Sp8DsmivUP7NnKOWY8KgRPxzLf347SrUxfe6CzXLRpkbCWVoCYMXckrj9poJHbYkU+/I53Nl72IMCm3umwEzLBU+DBhEYh9gmJ1E+IPV+A8Zrs6umt4+Y7IMFxaZA+O2c13TX+AQwjWhRutDPw= +ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; + s=arc-20240116; t=1735036615; c=relaxed/simple; + bh=dXQRhQVd1Zyosn15/gUbEta/P7NJqalhPImmU9urz+Y=; + h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: + MIME-Version:Content-Type; + b=Gb5/JI8lf48IhgVAoC7Sh3vHpBSJCe3+dnVZG4qlAQp3DZVyr+TWYice/Redmrl8JkjoE273hxZ6hFSvJlzF9EclMz0e7k977iOmuQon+N5YlhtfDL94suzV5P9sfXwYvtVjZwnr7aqkRr3w3ihchOawYmk3dg3505bUebInQnk= +ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; + dmarc=pass (p=none dis=none) header.from=gmail.com; + spf=pass smtp.mailfrom=gmail.com; + dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com + header.b=UahONGdE; arc=none smtp.client-ip=209.85.221.53 +Authentication-Results: smtp.subspace.kernel.org; + dmarc=pass (p=none dis=none) header.from=gmail.com +Authentication-Results: smtp.subspace.kernel.org; + spf=pass smtp.mailfrom=gmail.com +Received: by mail-wr1-f53.google.com with SMTP id + ffacd0b85a97d-3862d161947so2420686f8f.3; + Tue, 24 Dec 2024 02:36:53 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=gmail.com; s=20230601; t=1735036612; x=1735641412; + darn=vger.kernel.org; + h=content-transfer-encoding:mime-version:references:in-reply-to + :message-id:date:subject:cc:to:from:from:to:cc:subject:date + :message-id:reply-to; + bh=sMhk1A5we+Q0WqaTiBzTXNhUdePPFx1uKEyCWbVNvYc=; + b=UahONGdExN2DP5PBiZ87j1+mGkDzwCd+MCQpZmUblrKP7GD0KfO4OV/GKtEfTO1sYK + pH+O3hs+yDawgBghqREytfRP390tCBpz+65UNn6GkBDU2iptaRDiGcn1nKnPYpkd3P6X + 0zVyYKneAQ/sAcE/VjH0I7HWuyARq5PtnKMegYi8dZmpFXux+gaBjgnSsjPuOyR/xWxN + RP1C9BDzN3NqeptC5oSsG5eB2Rs5niHvJoSbGuKVBPipP+k6qu88w4bfhTIponae1bt1 + gpUV23UfNa49ChxKv0ivW7QfFky1P30da1oXtQsNS0FVVVrHlWJhhivVT7Fuf2g6dgDh + fgTw== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20230601; t=1735036612; x=1735641412; + h=content-transfer-encoding:mime-version:references:in-reply-to + :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc + :subject:date:message-id:reply-to; + bh=sMhk1A5we+Q0WqaTiBzTXNhUdePPFx1uKEyCWbVNvYc=; + b=btRSTKjTHUEx37dhjkiEkJmdS2tVqBjs7UEaMq1bUwXvN7mwvBDdqJz6RW8W2xFdh6 + m/cDdd2Ao9FpXD5R4SBkvIZQPd95+LaDjw6iz7msVP0dvjc1qTTEqlgKHl3ibs8U7Jro + +1nitU/Nl1I5VSgWSRx0in3pH/aD/dSfNPutLktI7IeegBU6dfXrVXaTsFofys1UjBk/ + bOdQRBEsG+X3rHrNTNuVwLewIwk0RwRp6KT6hlaF7bGdhl1UPuG+AMK7PAFUP4e2D5OK + QmBE6ayI4XOeRQHFCbGG2OUvddtktA8BQzwr28+DwYWADQQiKCuy0UJBtW0DmzaxKr7F + gCIw== +X-Forwarded-Encrypted: i=1; + AJvYcCVHVB9BqpG5+V+fo4vdtCQHh3nIKV69RT+IPj0tFJoUTpQdG+vPR4Iqt7ktLVoMBVXhtsD0DAuZpXFa@vger.kernel.org, + AJvYcCXtcLMfobpgZfmtjLs1KKQ2YT3EaF+0+Mdt7kFCJbskk1e1IbXmjE8SiwRlPc7Xop8LBdifPZoTR1ZCl6PN@vger.kernel.org +X-Gm-Message-State: AOJu0YwqZ5qOpBs+2cK9ou/rHf3nhKSpv1sOAgh/R/uVc6pFB2dqDkjp + okaKt94cn3iBf/E0yr+jvP84miiyWBjHOiwUifpj2I+eg2/hRbLe +X-Gm-Gg: ASbGnctb0LTvTOtGESMAhgeg3r7sjorwh3VXs5dZZezH+8LeYUD4c6SPFEXxiNeIZAv + NZLn9cN6bKQLaVX9lTUF2nNmqijrn8WPhaSpeqeSNnZdNpdoDTqTuYpEhY0y+72yNiTqhDFtbyr + OhCPhYE5VV+HKOekEluViF9bHOmkGhpUmBXyGOQmHPxEnDdZINMAMYHxUBC8E4nuG8p/hyD7dPD + iHXkaNnmD4NjYqjgTyxSACjy6eWinXEuukXXHZVbbJY9nJ4wVWI +X-Google-Smtp-Source: + AGHT+IEbrRmLj2uKOuyl6xkrJtxDUC1KVwEPA3dNsbU/+R2F0ZKZu/sQbMNvRjB6t41GnHxO0mDDAQ== +X-Received: by 2002:a05:6000:4023:b0:385:f220:f788 with SMTP id + ffacd0b85a97d-38a223fd77bmr14541441f8f.48.1735036611884; + Tue, 24 Dec 2024 02:36:51 -0800 (PST) +Received: from skynet.lan ([213.99.205.117]) + by smtp.gmail.com with ESMTPSA id + ffacd0b85a97d-38a1c89e1a1sm13645138f8f.69.2024.12.24.02.36.51 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Tue, 24 Dec 2024 02:36:51 -0800 (PST) +From: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= +To: linus.walleij@linaro.org, + kylehendrydev@gmail.com, + linux-gpio@vger.kernel.org, + linux-kernel@vger.kernel.org +Cc: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= +Subject: [PATCH v2] pinctrl: bcm63268: add gpio function +Date: Tue, 24 Dec 2024 11:36:45 +0100 +Message-Id: <20241224103645.1709996-1-noltari@gmail.com> +X-Mailer: git-send-email 2.39.5 +In-Reply-To: <20241207223335.17535-1-kylehendrydev@gmail.com> +References: <20241207223335.17535-1-kylehendrydev@gmail.com> +Precedence: bulk +X-Mailing-List: linux-gpio@vger.kernel.org +List-Id: +List-Subscribe: +List-Unsubscribe: +MIME-Version: 1.0 + +From: Kyle Hendry + +There is no guarantee that the bootloader will leave the pin configuration +in a known default state, so pinctrl needs to be explicitly set in some +cases. This patch adds a gpio function for drivers that need it, i.e. +gpio-leds. + +Signed-off-by: Kyle Hendry +Signed-off-by: Álvaro Fernández Rojas +--- + drivers/pinctrl/bcm/pinctrl-bcm63268.c | 71 +++++++++++++++++++++++++- + 1 file changed, 70 insertions(+), 1 deletion(-) + +--- a/drivers/pinctrl/bcm/pinctrl-bcm63268.c ++++ b/drivers/pinctrl/bcm/pinctrl-bcm63268.c +@@ -34,6 +34,7 @@ + #define BCM63268_BASEMODE_VDSL_PHY_3 BIT(9) /* GPIOs 26/27 */ + + enum bcm63268_pinctrl_reg { ++ BCM63268_NONE, + BCM63268_LEDCTRL, + BCM63268_MODE, + BCM63268_CTRL, +@@ -242,6 +243,61 @@ static struct pingroup bcm63268_groups[] + BCM_PIN_GROUP(vdsl_phy3_grp), + }; + ++static const char * const gpio_groups[] = { ++ "gpio0", ++ "gpio1", ++ "gpio2", ++ "gpio3", ++ "gpio4", ++ "gpio5", ++ "gpio6", ++ "gpio7", ++ "gpio8", ++ "gpio9", ++ "gpio10", ++ "gpio11", ++ "gpio12", ++ "gpio13", ++ "gpio14", ++ "gpio15", ++ "gpio16", ++ "gpio17", ++ "gpio18", ++ "gpio19", ++ "gpio20", ++ "gpio21", ++ "gpio22", ++ "gpio23", ++ "gpio24", ++ "gpio25", ++ "gpio26", ++ "gpio27", ++ "gpio28", ++ "gpio29", ++ "gpio30", ++ "gpio31", ++ "gpio32", ++ "gpio33", ++ "gpio34", ++ "gpio35", ++ "gpio36", ++ "gpio37", ++ "gpio38", ++ "gpio39", ++ "gpio40", ++ "gpio41", ++ "gpio42", ++ "gpio43", ++ "gpio44", ++ "gpio45", ++ "gpio46", ++ "gpio47", ++ "gpio48", ++ "gpio49", ++ "gpio50", ++ "gpio51", ++}; ++ + static const char * const led_groups[] = { + "gpio0", + "gpio1", +@@ -394,6 +450,14 @@ static const char * const vdsl_phy_overr + "vdsl_phy_override_3_grp", + }; + ++#define BCM63268_GPIO_FUN(n) \ ++ { \ ++ .name = #n, \ ++ .groups = n##_groups, \ ++ .num_groups = ARRAY_SIZE(n##_groups), \ ++ .reg = BCM63268_NONE, \ ++ } ++ + #define BCM63268_LED_FUN(n) \ + { \ + .name = #n, \ +@@ -428,6 +492,7 @@ static const char * const vdsl_phy_overr + } + + static const struct bcm63268_function bcm63268_funcs[] = { ++ BCM63268_GPIO_FUN(gpio), + BCM63268_LED_FUN(led), + BCM63268_MODE_FUN(serial_led_clk), + BCM63268_MODE_FUN(serial_led_data), +@@ -542,6 +607,9 @@ static int bcm63268_pinctrl_set_mux(stru + bcm63268_set_gpio(pc, pg->pins[i]); + + switch (f->reg) { ++ case BCM63268_NONE: ++ reg = 0; ++ break; + case BCM63268_LEDCTRL: + reg = BCM63268_LED_REG; + mask = BIT(pg->pins[0]); +@@ -567,7 +635,8 @@ static int bcm63268_pinctrl_set_mux(stru + return -EINVAL; + } + +- regmap_update_bits(pc->regs, reg, mask, val); ++ if (reg) ++ regmap_update_bits(pc->regs, reg, mask, val); + + return 0; + } From d1dd5b23014c7288a7ceff6d4fb64444f2acac22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Sat, 28 Dec 2024 09:15:50 +0100 Subject: [PATCH 253/877] bcm27xx-gpu-fw: update to v1.20241126 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Full changelog: https://github.com/raspberrypi/firmware/compare/1.20241008...1.20241126 Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 5bc2d3267d8108e1afc14be96b870fdd4079047d) --- package/kernel/bcm27xx-gpu-fw/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/kernel/bcm27xx-gpu-fw/Makefile b/package/kernel/bcm27xx-gpu-fw/Makefile index 0b8f5781e5499f..d4b3424b91ea12 100644 --- a/package/kernel/bcm27xx-gpu-fw/Makefile +++ b/package/kernel/bcm27xx-gpu-fw/Makefile @@ -2,13 +2,13 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=bcm27xx-gpu-fw -PKG_VERSION:=2024.10.08 +PKG_VERSION:=2024.11.26 PKG_VERSION_REAL:=1.$(subst .,,$(PKG_VERSION)) -PKG_RELEASE:=2 +PKG_RELEASE:=1 PKG_SOURCE:=raspi-firmware_$(PKG_VERSION_REAL).orig.tar.xz PKG_SOURCE_URL:=https://github.com/raspberrypi/firmware/releases/download/$(PKG_VERSION_REAL) -PKG_HASH:=11e7bedcd0f52729bbc82ae8de3cb3f52eb4ae3d6bdb3e11fbfdbea9c4a2b1c3 +PKG_HASH:=020dbcdbb30af5942a62fc3eb355449aba45276b67e864dee2522ff53fd936e6 PKG_FLAGS:=nonshared From dad450b11561c647987a718f9dad07b4d17616ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Sat, 28 Dec 2024 09:44:36 +0100 Subject: [PATCH 254/877] bcm27xx-utils: update to latest version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Full changelog: raspberrypi/utils@6a2a6be...0c02957 Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 80189a0350698cebecefefff426b1d05ec628b71) --- package/utils/bcm27xx-utils/Makefile | 6 ++--- .../patches/0002-cmake-disable-piolib.patch | 24 +++++++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 package/utils/bcm27xx-utils/patches/0002-cmake-disable-piolib.patch diff --git a/package/utils/bcm27xx-utils/Makefile b/package/utils/bcm27xx-utils/Makefile index 8f5d91da8f1357..42a7f856888810 100644 --- a/package/utils/bcm27xx-utils/Makefile +++ b/package/utils/bcm27xx-utils/Makefile @@ -3,13 +3,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=bcm27xx-utils -PKG_VERSION:=2024.10.25 +PKG_VERSION:=2024.12.19 PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/raspberrypi/utils.git -PKG_SOURCE_VERSION:=6a2a6becebbc38fde34a94386457ac8210f9119b -PKG_MIRROR_HASH:=a775c7ffb9fac2d798ec8e0a4c7707eb7133cbc9c4418a1cf9434f87c42c01bb +PKG_SOURCE_VERSION:=0c02957911da1c661be201236c4f2a2be1778b3e +PKG_MIRROR_HASH:=8bc87c929726a13d3d3e16157033d13f78a1f85d548db131c45c3a4cbdd1e402 PKG_FLAGS:=nonshared PKG_BUILD_FLAGS:=no-lto diff --git a/package/utils/bcm27xx-utils/patches/0002-cmake-disable-piolib.patch b/package/utils/bcm27xx-utils/patches/0002-cmake-disable-piolib.patch new file mode 100644 index 00000000000000..37f8a3a7e7ba9c --- /dev/null +++ b/package/utils/bcm27xx-utils/patches/0002-cmake-disable-piolib.patch @@ -0,0 +1,24 @@ +From 5249e68da31d11e0beaf9fd76a6d17ac04198b26 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= +Date: Sat, 28 Dec 2024 09:42:00 +0100 +Subject: [PATCH] cmake: disable piolib +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Álvaro Fernández Rojas +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -10,7 +10,7 @@ add_subdirectory(otpset) + add_subdirectory(overlaycheck) + add_subdirectory(ovmerge) + add_subdirectory(pinctrl) +-add_subdirectory(piolib) ++# add_subdirectory(piolib) + add_subdirectory(raspinfo) + add_subdirectory(vcgencmd) + add_subdirectory(vclog) From 9a0a05d52abf1f16037baf39004ce1307042f1e0 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 28 Dec 2024 22:46:19 +0100 Subject: [PATCH 255/877] busybox: fix LTO compiler flags When doing LTO builds, the target related CFLAGS need to be passed to the linker, so that they are considered for target code generation. Pass TARGET_CFLAGS in EXTRA_LDFLAGS to ensure that this is handled properly. Fixes: #17200 Signed-off-by: Felix Fietkau (cherry picked from commit e6ce868c3a6f843f2c14498d0174011c8713a8bd) --- package/utils/busybox/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile index 4ef470df755890..7d302bd159f09f 100644 --- a/package/utils/busybox/Makefile +++ b/package/utils/busybox/Makefile @@ -111,7 +111,7 @@ endif MAKE_VARS := MAKE_FLAGS += \ EXTRA_CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \ - EXTRA_LDFLAGS="$(TARGET_LDFLAGS)" \ + EXTRA_LDFLAGS="$(TARGET_LDFLAGS) $(TARGET_CFLAGS)" \ LDLIBS="$(LDLIBS)" \ LD="$(TARGET_CC)" \ SKIP_STRIP=y From 1eff73790644fd21da61f7064d6eecae32e4d64b Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Sat, 28 Dec 2024 20:53:12 +0100 Subject: [PATCH 256/877] ipq40xx: orbi: add ethernet0 alias Netgear Orbi devices rely on ethernet0 alias to be present to U-Boot will populate the MAC. This fixes the random MAC on each boot after the ethernet0 alias was dropped from the SoC DTSI. Fixes: cd9c7211241e ("ipq40xx: 6.1: use latest DSA and ethernet patches") Fixes: #17384 Link: https://github.com/openwrt/openwrt/pull/17414 Signed-off-by: Robert Marko (cherry picked from commit 9ea174c7bf64ec34e96871ce223d7a597ca80d26) --- .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-orbi.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-orbi.dtsi b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-orbi.dtsi index 0418176066dc7e..e3024ed663d254 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-orbi.dtsi +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-orbi.dtsi @@ -12,6 +12,7 @@ led-failsafe = &led_status_red; led-running = &led_status_green; led-upgrade = &led_status_blue; + ethernet0 = &gmac; label-mac-device = &gmac; }; From 67e070c11baad0226c14af09e1add03f945b6fc7 Mon Sep 17 00:00:00 2001 From: John Audia Date: Fri, 27 Dec 2024 08:57:52 -0500 Subject: [PATCH 257/877] kernel: bump 6.6 to 6.6.68 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.68 All patches automatically rebased. Build system: x86/64 Build-tested: flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3, x86/64 Run-tested: flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3, x86/64 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/17394 Signed-off-by: Nick Hainke (cherry picked from commit 1aae1dfaf2a1c85aa5bc3faf7e75ff132ab31f95) --- include/kernel-6.6 | 4 ++-- ...t-stmmac-move-TX-timer-arm-after-DMA-enable.patch | 12 ++++++------ .../780-usb-net-MeigLink_modem_support.patch | 4 ++-- target/linux/generic/hack-6.6/902-debloat_proc.patch | 2 +- .../patches-6.6/1009-net-stmmac-use-GFP_DMA32.patch | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/kernel-6.6 b/include/kernel-6.6 index 3b76c2be062c65..c2805b4540bce0 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .67 -LINUX_KERNEL_HASH-6.6.67 = e41da482ec42a3b0e2b8ed2574c1d327e3dcf95cdf025c55a356b04307113e1a +LINUX_VERSION-6.6 = .68 +LINUX_KERNEL_HASH-6.6.68 = 283ff410e3f352ceed161ae30c0020301326059db03e86efcb384d46ac5840e2 diff --git a/target/linux/generic/backport-6.6/771-v6.7-02-net-stmmac-move-TX-timer-arm-after-DMA-enable.patch b/target/linux/generic/backport-6.6/771-v6.7-02-net-stmmac-move-TX-timer-arm-after-DMA-enable.patch index bd61343e0eed3a..c1f2fa9589a8f0 100644 --- a/target/linux/generic/backport-6.6/771-v6.7-02-net-stmmac-move-TX-timer-arm-after-DMA-enable.patch +++ b/target/linux/generic/backport-6.6/771-v6.7-02-net-stmmac-move-TX-timer-arm-after-DMA-enable.patch @@ -42,7 +42,7 @@ Signed-off-by: Paolo Abeni u64_stats_update_begin(&txq_stats->napi_syncp); u64_stats_add(&txq_stats->napi.tx_packets, tx_packets); -@@ -5603,6 +5607,7 @@ static int stmmac_napi_poll_tx(struct na +@@ -5604,6 +5608,7 @@ static int stmmac_napi_poll_tx(struct na container_of(napi, struct stmmac_channel, tx_napi); struct stmmac_priv *priv = ch->priv_data; struct stmmac_txq_stats *txq_stats; @@ -50,7 +50,7 @@ Signed-off-by: Paolo Abeni u32 chan = ch->index; int work_done; -@@ -5611,7 +5616,7 @@ static int stmmac_napi_poll_tx(struct na +@@ -5612,7 +5617,7 @@ static int stmmac_napi_poll_tx(struct na u64_stats_inc(&txq_stats->napi.poll); u64_stats_update_end(&txq_stats->napi_syncp); @@ -59,7 +59,7 @@ Signed-off-by: Paolo Abeni work_done = min(work_done, budget); if (work_done < budget && napi_complete_done(napi, work_done)) { -@@ -5622,6 +5627,10 @@ static int stmmac_napi_poll_tx(struct na +@@ -5623,6 +5628,10 @@ static int stmmac_napi_poll_tx(struct na spin_unlock_irqrestore(&ch->lock, flags); } @@ -70,7 +70,7 @@ Signed-off-by: Paolo Abeni return work_done; } -@@ -5630,6 +5639,7 @@ static int stmmac_napi_poll_rxtx(struct +@@ -5631,6 +5640,7 @@ static int stmmac_napi_poll_rxtx(struct struct stmmac_channel *ch = container_of(napi, struct stmmac_channel, rxtx_napi); struct stmmac_priv *priv = ch->priv_data; @@ -78,7 +78,7 @@ Signed-off-by: Paolo Abeni int rx_done, tx_done, rxtx_done; struct stmmac_rxq_stats *rxq_stats; struct stmmac_txq_stats *txq_stats; -@@ -5645,7 +5655,7 @@ static int stmmac_napi_poll_rxtx(struct +@@ -5646,7 +5656,7 @@ static int stmmac_napi_poll_rxtx(struct u64_stats_inc(&txq_stats->napi.poll); u64_stats_update_end(&txq_stats->napi_syncp); @@ -87,7 +87,7 @@ Signed-off-by: Paolo Abeni tx_done = min(tx_done, budget); rx_done = stmmac_rx_zc(priv, budget, chan); -@@ -5670,6 +5680,10 @@ static int stmmac_napi_poll_rxtx(struct +@@ -5671,6 +5681,10 @@ static int stmmac_napi_poll_rxtx(struct spin_unlock_irqrestore(&ch->lock, flags); } diff --git a/target/linux/generic/hack-6.6/780-usb-net-MeigLink_modem_support.patch b/target/linux/generic/hack-6.6/780-usb-net-MeigLink_modem_support.patch index cefb9c53e89d61..222633058aae68 100644 --- a/target/linux/generic/hack-6.6/780-usb-net-MeigLink_modem_support.patch +++ b/target/linux/generic/hack-6.6/780-usb-net-MeigLink_modem_support.patch @@ -44,7 +44,7 @@ Subject: [PATCH] net/usb/qmi_wwan: add MeigLink modem support #define QUECTEL_VENDOR_ID 0x2c7c /* These Quectel products use Quectel's vendor ID */ -@@ -1160,6 +1165,11 @@ static const struct usb_device_id option +@@ -1162,6 +1167,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) }, @@ -56,7 +56,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), -@@ -1201,6 +1211,11 @@ static const struct usb_device_id option +@@ -1203,6 +1213,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-6.6/902-debloat_proc.patch b/target/linux/generic/hack-6.6/902-debloat_proc.patch index 2c3eca2552fc32..54985070076907 100644 --- a/target/linux/generic/hack-6.6/902-debloat_proc.patch +++ b/target/linux/generic/hack-6.6/902-debloat_proc.patch @@ -235,7 +235,7 @@ Signed-off-by: Felix Fietkau if (!pe) --- a/mm/vmalloc.c +++ b/mm/vmalloc.c -@@ -4448,6 +4448,8 @@ static const struct seq_operations vmall +@@ -4450,6 +4450,8 @@ static const struct seq_operations vmall static int __init proc_vmalloc_init(void) { diff --git a/target/linux/starfive/patches-6.6/1009-net-stmmac-use-GFP_DMA32.patch b/target/linux/starfive/patches-6.6/1009-net-stmmac-use-GFP_DMA32.patch index 3191b1d9e328d9..f93917b563a36b 100644 --- a/target/linux/starfive/patches-6.6/1009-net-stmmac-use-GFP_DMA32.patch +++ b/target/linux/starfive/patches-6.6/1009-net-stmmac-use-GFP_DMA32.patch @@ -19,7 +19,7 @@ Signed-off-by: Matteo Croce if (priv->dma_cap.host_dma_width <= 32) gfp |= GFP_DMA32; -@@ -4686,7 +4686,7 @@ static inline void stmmac_rx_refill(stru +@@ -4687,7 +4687,7 @@ static inline void stmmac_rx_refill(stru struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[queue]; int dirty = stmmac_rx_dirty(priv, queue); unsigned int entry = rx_q->dirty_rx; From 1f94fa16d8bbaad017d9b91de13a54455cd8ca89 Mon Sep 17 00:00:00 2001 From: Evan Jobling Date: Sat, 14 Sep 2024 02:31:09 +0000 Subject: [PATCH 258/877] realtek: rtl838x: refactor hpe_1920-24g dts The HPE JG924A, JG925A and JG926A share the same base. Prepare base device for adding the PoE enabled switch support. Signed-off-by: Evan Jobling Signed-off-by: Fabian Groffen Link: https://github.com/openwrt/openwrt/pull/17436 Signed-off-by: Sander Vanheule (cherry picked from commit 41b49a157ad0162c39ab94529d110aa3a3e3e266) --- .../realtek/dts/rtl8382_hpe_1920-24g.dts | 62 +---------------- .../realtek/dts/rtl8382_hpe_1920-24g.dtsi | 68 +++++++++++++++++++ 2 files changed, 69 insertions(+), 61 deletions(-) create mode 100644 target/linux/realtek/dts/rtl8382_hpe_1920-24g.dtsi diff --git a/target/linux/realtek/dts/rtl8382_hpe_1920-24g.dts b/target/linux/realtek/dts/rtl8382_hpe_1920-24g.dts index 61781c708e288d..cc92b144b5e48e 100644 --- a/target/linux/realtek/dts/rtl8382_hpe_1920-24g.dts +++ b/target/linux/realtek/dts/rtl8382_hpe_1920-24g.dts @@ -1,68 +1,8 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -#include "rtl8382_hpe_1920.dtsi" +#include "rtl8382_hpe_1920-24g.dtsi" / { compatible = "hpe,1920-24g", "realtek,rtl838x-soc"; model = "HPE 1920-24G (JG924A)"; }; - -&mdio { - EXTERNAL_PHY(0) - EXTERNAL_PHY(1) - EXTERNAL_PHY(2) - EXTERNAL_PHY(3) - EXTERNAL_PHY(4) - EXTERNAL_PHY(5) - EXTERNAL_PHY(6) - EXTERNAL_PHY(7) -}; - -&switch0 { - ports { - #address-cells = <1>; - #size-cells = <0>; - - SWITCH_PORT(0, 1, qsgmii) - SWITCH_PORT(1, 2, qsgmii) - SWITCH_PORT(2, 3, qsgmii) - SWITCH_PORT(3, 4, qsgmii) - SWITCH_PORT(4, 5, qsgmii) - SWITCH_PORT(5, 6, qsgmii) - SWITCH_PORT(6, 7, qsgmii) - SWITCH_PORT(7, 8, qsgmii) - - SWITCH_PORT(8, 9, internal) - SWITCH_PORT(9, 10, internal) - SWITCH_PORT(10, 11, internal) - SWITCH_PORT(11, 12, internal) - SWITCH_PORT(12, 13, internal) - SWITCH_PORT(13, 14, internal) - SWITCH_PORT(14, 15, internal) - SWITCH_PORT(15, 16, internal) - - SWITCH_PORT(16, 17, qsgmii) - SWITCH_PORT(17, 18, qsgmii) - SWITCH_PORT(18, 19, qsgmii) - SWITCH_PORT(19, 20, qsgmii) - SWITCH_PORT(20, 21, qsgmii) - SWITCH_PORT(21, 22, qsgmii) - SWITCH_PORT(22, 23, qsgmii) - SWITCH_PORT(23, 24, qsgmii) - - SWITCH_PORT(24, 25, qsgmii) - SWITCH_PORT(25, 26, qsgmii) - SWITCH_PORT(26, 27, qsgmii) - SWITCH_PORT(27, 28, qsgmii) - - port@28 { - ethernet = <ðernet0>; - reg = <28>; - phy-mode = "internal"; - fixed-link { - speed = <1000>; - full-duplex; - }; - }; - }; -}; diff --git a/target/linux/realtek/dts/rtl8382_hpe_1920-24g.dtsi b/target/linux/realtek/dts/rtl8382_hpe_1920-24g.dtsi new file mode 100644 index 00000000000000..61781c708e288d --- /dev/null +++ b/target/linux/realtek/dts/rtl8382_hpe_1920-24g.dtsi @@ -0,0 +1,68 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "rtl8382_hpe_1920.dtsi" + +/ { + compatible = "hpe,1920-24g", "realtek,rtl838x-soc"; + model = "HPE 1920-24G (JG924A)"; +}; + +&mdio { + EXTERNAL_PHY(0) + EXTERNAL_PHY(1) + EXTERNAL_PHY(2) + EXTERNAL_PHY(3) + EXTERNAL_PHY(4) + EXTERNAL_PHY(5) + EXTERNAL_PHY(6) + EXTERNAL_PHY(7) +}; + +&switch0 { + ports { + #address-cells = <1>; + #size-cells = <0>; + + SWITCH_PORT(0, 1, qsgmii) + SWITCH_PORT(1, 2, qsgmii) + SWITCH_PORT(2, 3, qsgmii) + SWITCH_PORT(3, 4, qsgmii) + SWITCH_PORT(4, 5, qsgmii) + SWITCH_PORT(5, 6, qsgmii) + SWITCH_PORT(6, 7, qsgmii) + SWITCH_PORT(7, 8, qsgmii) + + SWITCH_PORT(8, 9, internal) + SWITCH_PORT(9, 10, internal) + SWITCH_PORT(10, 11, internal) + SWITCH_PORT(11, 12, internal) + SWITCH_PORT(12, 13, internal) + SWITCH_PORT(13, 14, internal) + SWITCH_PORT(14, 15, internal) + SWITCH_PORT(15, 16, internal) + + SWITCH_PORT(16, 17, qsgmii) + SWITCH_PORT(17, 18, qsgmii) + SWITCH_PORT(18, 19, qsgmii) + SWITCH_PORT(19, 20, qsgmii) + SWITCH_PORT(20, 21, qsgmii) + SWITCH_PORT(21, 22, qsgmii) + SWITCH_PORT(22, 23, qsgmii) + SWITCH_PORT(23, 24, qsgmii) + + SWITCH_PORT(24, 25, qsgmii) + SWITCH_PORT(25, 26, qsgmii) + SWITCH_PORT(26, 27, qsgmii) + SWITCH_PORT(27, 28, qsgmii) + + port@28 { + ethernet = <ðernet0>; + reg = <28>; + phy-mode = "internal"; + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + }; +}; From 11275bec82a33de336e57a52d068f71859c8468c Mon Sep 17 00:00:00 2001 From: Evan Jobling Date: Sat, 14 Sep 2024 02:43:35 +0000 Subject: [PATCH 259/877] realtek: add support for HPE 1920-24G-PoE-370w Hardware information: --------------------- The HPE 1920-24G-PoE+ (370W) (JG926A) is a switch that is part of the 1920 family wich 370W nominal PoE+ support. Common with HPE 1920-24G: - RTL8382 SoC - 24 Gigabit RJ45 ports (built-in RTL8218B, 2 external RTL8218D) - 4 SFP ports (external RTL8214FC) - RJ45 RS232 port on front panel - 32 MiB NOR Flash - 128 MiB DDR3 DRAM - PT7A7514 watchdog HPE 1920-24G-PoE+ (370W): - PoE chip - 3 fans (40mm) 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 '370' 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' config port option enable '1' option id '9' option name 'lan16' option poe_plus '1' option priority '2' config port option enable '1' option id '10' option name 'lan15' option poe_plus '1' option priority '2' config port option enable '1' option id '11' option name 'lan14' option poe_plus '1' option priority '2' config port option enable '1' option id '12' option name 'lan13' option poe_plus '1' option priority '2' config port option enable '1' option id '13' option name 'lan12' option poe_plus '1' option priority '2' config port option enable '1' option id '14' option name 'lan11' option poe_plus '1' option priority '2' config port option enable '1' option id '15' option name 'lan10' option poe_plus '1' option priority '2' config port option enable '1' option id '16' option name 'lan9' option poe_plus '1' option priority '2' config port option enable '1' option id '17' option name 'lan24' option poe_plus '1' option priority '2' config port option enable '1' option id '18' option name 'lan23' option poe_plus '1' option priority '2' config port option enable '1' option id '19' option name 'lan22' option poe_plus '1' option priority '2' config port option enable '1' option id '20' option name 'lan21' option poe_plus '1' option priority '2' config port option enable '1' option id '21' option name 'lan20' option poe_plus '1' option priority '2' config port option enable '1' option id '22' option name 'lan19' option poe_plus '1' option priority '2' config port option enable '1' option id '23' option name 'lan18' option poe_plus '1' option priority '2' config port option enable '1' option id '24' option name 'lan17' option poe_plus '1' option priority '2' Signed-off-by: Evan Jobling Signed-off-by: Fabian Groffen Link: https://github.com/openwrt/openwrt/pull/17436 [fix space indentation in DTS] Signed-off-by: Sander Vanheule (cherry picked from commit c8ea1aa970bf5a0275e3b0b7da777e804821ddcd) --- .../linux/realtek/base-files/etc/board.d/02_network | 4 ++++ .../realtek/base-files/etc/board.d/03_gpio_switches | 3 ++- .../realtek/dts/rtl8382_hpe_1920-24g-poe-370w.dts | 12 ++++++++++++ target/linux/realtek/image/rtl838x.mk | 9 +++++++++ 4 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-370w.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 5073dbcc31e90b..750a20081497b1 100644 --- a/target/linux/realtek/base-files/etc/board.d/02_network +++ b/target/linux/realtek/base-files/etc/board.d/02_network @@ -36,6 +36,7 @@ hpe,1920-8g-poe-65w|\ hpe,1920-8g-poe-180w|\ hpe,1920-16g|\ hpe,1920-24g|\ +hpe,1920-24g-poe-370w|\) hpe,1920-48g|\ hpe,1920-48g-poe) label_mac=$(mtd_get_mac_binary factory 0x68) @@ -95,6 +96,9 @@ hpe,1920-8g-poe-65w) hpe,1920-8g-poe-180w) ucidef_set_poe 180 "$(filter_port_list_reverse "$lan_list" "lan9 lan10")" ;; +hpe,1920-24g-poe-370w) + ucidef_set_poe 370 "$(filter_port_list_reverse "$lan_list" "lan25 lan26 lan27 lan28")" + ;; hpe,1920-48g-poe) ucidef_set_poe 370 "lan8 lan7 lan6 lan5 lan4 lan3 lan2 lan1 lan16 lan15 lan14 lan13 lan12 lan11 lan10 lan9 lan24 lan23 lan22 lan21 lan20 lan19 lan18 lan17 lan32 lan31 lan30 lan29 lan28 lan27 lan26 lan25 lan40 lan39 lan38 lan37 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 1e49d89c64a241..684d7f795eae90 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,8 @@ board_config_update board=$(board_name) case "$board" in -hpe,1920-8g-poe-180w) +hpe,1920-8g-poe-180w|\ +hpe,1920-24g-poe-370w) ucidef_add_gpio_switch "fan_ctrl" "Fan control" "456" "0" ;; esac diff --git a/target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-370w.dts b/target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-370w.dts new file mode 100644 index 00000000000000..ccdcf71d1bddb1 --- /dev/null +++ b/target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-370w.dts @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "rtl8382_hpe_1920-24g.dtsi" + +/ { + compatible = "hpe,1920-24g-poe-370w", "realtek,rtl838x-soc"; + model = "HPE 1920-24G-PoE+ 370W (JG926A)"; +}; + +&uart1 { + status = "okay"; +}; diff --git a/target/linux/realtek/image/rtl838x.mk b/target/linux/realtek/image/rtl838x.mk index 01397af9310c74..d694f5b308faff 100644 --- a/target/linux/realtek/image/rtl838x.mk +++ b/target/linux/realtek/image/rtl838x.mk @@ -144,6 +144,15 @@ define Device/hpe_1920-24g endef TARGET_DEVICES += hpe_1920-24g +define Device/hpe_1920-24g-poe-370w + $(Device/hpe_1920) + SOC := rtl8382 + DEVICE_MODEL := 1920-24G-PoE+ 370W (JG926A) + DEVICE_PACKAGES += realtek-poe + H3C_DEVICE_ID := 0x00010029 +endef +TARGET_DEVICES += hpe_1920-24g-poe-370w + define Device/inaba_aml2-17gp SOC := rtl8382 IMAGE_SIZE := 13504k From b66773aac34bf3066efc3c8f1a11c3baf1b2fcda Mon Sep 17 00:00:00 2001 From: Tony Ambardar Date: Sat, 7 Dec 2024 19:39:11 -0800 Subject: [PATCH 260/877] libbpf: Update to v1.5.0 Update to the latest upstream release to include recent improvements and bugfixes, including support for handling BPF objects of either endianness. Link: https://github.com/libbpf/libbpf/releases/tag/v1.5.0 Signed-off-by: Tony Ambardar Link: https://github.com/openwrt/openwrt/pull/17404 (cherry picked from commit 6a6ae41d4b960131f86f10a4609a0082bcd0ebb7) Link: https://github.com/openwrt/openwrt/pull/17418 Signed-off-by: Nick Hainke --- package/libs/libbpf/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/libs/libbpf/Makefile b/package/libs/libbpf/Makefile index 89fe730a98adfe..4d918e7bbfd8f0 100644 --- a/package/libs/libbpf/Makefile +++ b/package/libs/libbpf/Makefile @@ -8,11 +8,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libbpf -PKG_VERSION:=1.4.6 +PKG_VERSION:=1.5.0 PKG_RELEASE:=1 PKG_SOURCE_URL:=https://github.com/libbpf/libbpf -PKG_MIRROR_HASH:=0d0d70750c8e45baba19f8cc065771e5d842a90f3ad1637003cae6887dabf11e +PKG_MIRROR_HASH:=7699fcfa89bf0f6e756c4555fbd3fdb8cbcfcc770e5944aebdd0e9244031f022 PKG_SOURCE_PROTO:=git PKG_SOURCE_VERSION:=v$(PKG_VERSION) PKG_ABI_VERSION:=$(firstword $(subst .,$(space),$(PKG_VERSION))) From 7a0b76cf0f37fa46488d5f996c0635d3ab818b2c Mon Sep 17 00:00:00 2001 From: Tony Ambardar Date: Sat, 7 Dec 2024 19:49:49 -0800 Subject: [PATCH 261/877] bpftool: Update to v7.5.0 Update to the latest upstream release to include recent improvements and bugfixes, and simplify use of PKG_SOURCE_VERSION. This version supports BPF objects of either endianness, allowing for introspection, linking and skeleton creation, and enables cross-compiling modern BPF applications for targets with non-native byteorder. Link: https://github.com/libbpf/bpftool/releases/tag/v7.5.0 Signed-off-by: Tony Ambardar Link: https://github.com/openwrt/openwrt/pull/17404 (cherry picked from commit 5bcad34154757bfaca1c787b1e9c72f4b1a52e37) Link: https://github.com/openwrt/openwrt/pull/17418 Signed-off-by: Nick Hainke --- package/network/utils/bpftool/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/utils/bpftool/Makefile b/package/network/utils/bpftool/Makefile index c6cc92e18d16c4..b2fdfc16325e06 100644 --- a/package/network/utils/bpftool/Makefile +++ b/package/network/utils/bpftool/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=bpftool -PKG_VERSION:=7.4.0 +PKG_VERSION:=7.5.0 PKG_RELEASE:=1 PKG_SOURCE_URL:=https://github.com/libbpf/bpftool -PKG_MIRROR_HASH:=18e22f72e67ff402b5ecaf314445f25c40bfe23299cb783b5834a496297c51ed +PKG_MIRROR_HASH:=1da7c08959e7819772145774322ffd876f3180065be1c3759336dca98ac9f666 PKG_SOURCE_PROTO:=git -PKG_SOURCE_VERSION:=v7.4.0 +PKG_SOURCE_VERSION:=v$(PKG_VERSION) PKG_MAINTAINER:=Tony Ambardar From 32981677bd0ce5aed9df1d7e9f49d6f2b5578298 Mon Sep 17 00:00:00 2001 From: Tony Ambardar Date: Sat, 7 Dec 2024 20:00:43 -0800 Subject: [PATCH 262/877] tools/dwarves: update to v1.28 Update to the latest upstream version and refresh local patches. Release Notes: https://lore.kernel.org/bpf/Z1RcnB8WD8wZphcr@x1/ Signed-off-by: Tony Ambardar Link: https://github.com/openwrt/openwrt/pull/17404 (cherry picked from commit 45187cbad04a3cd3336a489b6c2b08ae5b446e5d) Link: https://github.com/openwrt/openwrt/pull/17418 Signed-off-by: Nick Hainke --- tools/dwarves/Makefile | 4 ++-- tools/dwarves/patches/100-reproducible-builds.patch | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/dwarves/Makefile b/tools/dwarves/Makefile index bcb16dd3da36b1..53461267767afb 100644 --- a/tools/dwarves/Makefile +++ b/tools/dwarves/Makefile @@ -3,12 +3,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=dwarves -PKG_VERSION:=1.27 +PKG_VERSION:=1.28 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://fedorapeople.org/~acme/dwarves/ -PKG_HASH:=ef7f21f1c6016896d03a01f05cab225151f9068e19cc8cddc6e754b2b5cbe279 +PKG_HASH:=826efc0fc9237d3c1e9c01553ea387a8cb46e8dc119ff863889043f4ed54b2ae PKG_MAINTAINER:=Tony Ambardar PKG_LICENSE:=GPL-2.0-only diff --git a/tools/dwarves/patches/100-reproducible-builds.patch b/tools/dwarves/patches/100-reproducible-builds.patch index 15bddd56457a38..d8cbd114c61e48 100644 --- a/tools/dwarves/patches/100-reproducible-builds.patch +++ b/tools/dwarves/patches/100-reproducible-builds.patch @@ -1,6 +1,6 @@ --- a/pahole.c +++ b/pahole.c -@@ -3723,6 +3723,9 @@ int main(int argc, char *argv[]) +@@ -3681,6 +3681,9 @@ int main(int argc, char *argv[]) goto out; } From a2b1aaee80cbd9e9731709f4ce5e4bdc5cc5c17e Mon Sep 17 00:00:00 2001 From: James Sweeney Date: Wed, 1 Jan 2025 08:47:28 -0500 Subject: [PATCH 263/877] realtek: add support for HPE 1920-24G PoE-180W (JG925A) Hardware information: (largely copied from 11275be) --------------------- The HPE 1920-24G-PoE+ (180W) (JG925A) is a switch that is part of the 1920 family which has 180W nominal PoE+ support. Common with HPE 1920-24G: - RTL8382 SoC - 24 Gigabit RJ45 ports (built-in RTL8218B, 2 external RTL8218D) - 4 SFP ports (external RTL8214FC) - RJ45 RS232 port on front panel - 32 MiB NOR Flash - 128 MiB DDR3 DRAM - PT7A7514 watchdog HPE 1920-24G-PoE+ (180W): - PoE chip - 2 fans (40mm) 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 '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' config port option enable '1' option id '9' option name 'lan16' option poe_plus '1' option priority '2' config port option enable '1' option id '10' option name 'lan15' option poe_plus '1' option priority '2' config port option enable '1' option id '11' option name 'lan14' option poe_plus '1' option priority '2' config port option enable '1' option id '12' option name 'lan13' option poe_plus '1' option priority '2' config port option enable '1' option id '13' option name 'lan12' option poe_plus '1' option priority '2' config port option enable '1' option id '14' option name 'lan11' option poe_plus '1' option priority '2' config port option enable '1' option id '15' option name 'lan10' option poe_plus '1' option priority '2' config port option enable '1' option id '16' option name 'lan9' option poe_plus '1' option priority '2' config port option enable '1' option id '17' option name 'lan24' option poe_plus '1' option priority '2' config port option enable '1' option id '18' option name 'lan23' option poe_plus '1' option priority '2' config port option enable '1' option id '19' option name 'lan22' option poe_plus '1' option priority '2' config port option enable '1' option id '20' option name 'lan21' option poe_plus '1' option priority '2' config port option enable '1' option id '21' option name 'lan20' option poe_plus '1' option priority '2' config port option enable '1' option id '22' option name 'lan19' option poe_plus '1' option priority '2' config port option enable '1' option id '23' option name 'lan18' option poe_plus '1' option priority '2' config port option enable '1' option id '24' option name 'lan17' option poe_plus '1' option priority '2' Signed-off-by: James Sweeney Link: https://github.com/openwrt/openwrt/pull/17444 Signed-off-by: Sander Vanheule (cherry picked from commit b948c1e39b9e69e26e8caabf86c2d0bb9ac4efa6) --- .../linux/realtek/base-files/etc/board.d/02_network | 3 +++ .../realtek/base-files/etc/board.d/03_gpio_switches | 1 + .../realtek/dts/rtl8382_hpe_1920-24g-poe-180w.dts | 12 ++++++++++++ target/linux/realtek/image/rtl838x.mk | 9 +++++++++ 4 files changed, 25 insertions(+) create mode 100644 target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-180w.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 750a20081497b1..a73944107ae884 100644 --- a/target/linux/realtek/base-files/etc/board.d/02_network +++ b/target/linux/realtek/base-files/etc/board.d/02_network @@ -96,6 +96,9 @@ hpe,1920-8g-poe-65w) hpe,1920-8g-poe-180w) ucidef_set_poe 180 "$(filter_port_list_reverse "$lan_list" "lan9 lan10")" ;; +hpe,1920-24g-poe-180w) + ucidef_set_poe 180 "$(filter_port_list_reverse "$lan_list" "lan25 lan26 lan27 lan28")" + ;; hpe,1920-24g-poe-370w) ucidef_set_poe 370 "$(filter_port_list_reverse "$lan_list" "lan25 lan26 lan27 lan28")" ;; 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 684d7f795eae90..c869153e4ca407 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 @@ -7,6 +7,7 @@ board=$(board_name) case "$board" in hpe,1920-8g-poe-180w|\ +hpe,1920-24g-poe-180w|\ hpe,1920-24g-poe-370w) ucidef_add_gpio_switch "fan_ctrl" "Fan control" "456" "0" ;; diff --git a/target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-180w.dts b/target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-180w.dts new file mode 100644 index 00000000000000..4783cec15ca18e --- /dev/null +++ b/target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-180w.dts @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "rtl8382_hpe_1920-24g.dtsi" + +/ { + compatible = "hpe,1920-24g-poe-180w", "realtek,rtl838x-soc"; + model = "HPE 1920-24G-PoE+ 180W (JG925A)"; +}; + +&uart1 { + status = "okay"; +}; diff --git a/target/linux/realtek/image/rtl838x.mk b/target/linux/realtek/image/rtl838x.mk index d694f5b308faff..866659ad141210 100644 --- a/target/linux/realtek/image/rtl838x.mk +++ b/target/linux/realtek/image/rtl838x.mk @@ -144,6 +144,15 @@ define Device/hpe_1920-24g endef TARGET_DEVICES += hpe_1920-24g +define Device/hpe_1920-24g-poe-180w + $(Device/hpe_1920) + SOC := rtl8382 + DEVICE_MODEL := 1920-24G-PoE+ 180W (JG925A) + DEVICE_PACKAGES += realtek-poe + H3C_DEVICE_ID := 0x00010028 +endef +TARGET_DEVICES += hpe_1920-24g-poe-180w + define Device/hpe_1920-24g-poe-370w $(Device/hpe_1920) SOC := rtl8382 From 812046971e3e69428f48bc85a4d64d9e0fab5dd6 Mon Sep 17 00:00:00 2001 From: Roland Reinl Date: Mon, 30 Dec 2024 08:54:56 +0100 Subject: [PATCH 264/877] mediatek: Fix primary MAC of D-Link M60 During port to gluon, I saw that the primary mac is not correct. Updated DTS accordingly. Signed-off-by: Roland Reinl Link: https://github.com/openwrt/openwrt/pull/17429 (cherry picked from commit 616621120bf2ba460b99d6c814b629a01be8a5d0) Link: https://github.com/openwrt/openwrt/pull/17449 Signed-off-by: Hauke Mehrtens --- target/linux/mediatek/dts/mt7986a-dlink-aquila-pro-ai-m60-a1.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/mediatek/dts/mt7986a-dlink-aquila-pro-ai-m60-a1.dts b/target/linux/mediatek/dts/mt7986a-dlink-aquila-pro-ai-m60-a1.dts index a95c069156e14a..e805554a134b7a 100644 --- a/target/linux/mediatek/dts/mt7986a-dlink-aquila-pro-ai-m60-a1.dts +++ b/target/linux/mediatek/dts/mt7986a-dlink-aquila-pro-ai-m60-a1.dts @@ -17,6 +17,7 @@ led-failsafe = &led_status_red; led-running = &led_status_white; led-upgrade = &led_status_blue; + label-mac-device = &gmac0; }; chosen { From a9ddc7432abae1105d9f2385d13edd931d48720b Mon Sep 17 00:00:00 2001 From: George Oldfort Date: Tue, 26 Nov 2024 15:04:45 +0100 Subject: [PATCH 265/877] generic: backport support for KTD2026/7 rgb(w) led controller This commit adds the Linux kernel mainline driver "leds-ktd202x" for the KinetIC KTD2026 and KTD2027 RGB/RBGW controller with I2C interface that was introduced in kernel version 6.7, last changed in mainline on 2024-05-31. At least the Acer Connect Vero W6m (a variant of the Acer Predator Connect W6 without 2.5G eth1 port, usb3 port, and the 6 on-board gpio RGB LEDs) is equipped with a KTD2026 (and a single RGB LED attached to it used by the stock firmware as status LED), and maybe other router devices also are. Signed-off-by: George Oldfort Link: https://github.com/openwrt/openwrt/pull/16860 Signed-off-by: Hauke Mehrtens (cherry picked from commit 56d97fff55f3d384eeb00b021c43fecb380a5bdd) --- package/kernel/linux/modules/leds.mk | 18 + .../860-v6.7-leds-add-ktd202x-driver.patch | 682 ++++++++++++++++++ ...get-device-properties-through-fwnode.patch | 221 ++++++ ...x-i2c-id-tables-for-ktd2026-and-2027.patch | 49 ++ ...eds-ktd202x-initialize-mutex-earlier.patch | 62 ++ 5 files changed, 1032 insertions(+) create mode 100644 target/linux/generic/backport-6.6/860-v6.7-leds-add-ktd202x-driver.patch create mode 100644 target/linux/generic/backport-6.6/861-v6.10-leds-rgb-leds-ktd202x-get-device-properties-through-fwnode.patch create mode 100644 target/linux/generic/backport-6.6/862-v6.10-leds-rgb-leds-ktd202x-i2c-id-tables-for-ktd2026-and-2027.patch create mode 100644 target/linux/generic/backport-6.6/863-v6.10-leds-rgb-leds-ktd202x-initialize-mutex-earlier.patch diff --git a/package/kernel/linux/modules/leds.mk b/package/kernel/linux/modules/leds.mk index 8b24cb0ef88e94..0c42895bb2f3c9 100644 --- a/package/kernel/linux/modules/leds.mk +++ b/package/kernel/linux/modules/leds.mk @@ -147,6 +147,24 @@ endef $(eval $(call KernelPackage,leds-apu)) +define KernelPackage/leds-ktd202x + SUBMENU:=LED modules + TITLE:=LED support for KTD202x Chips + DEPENDS:=+kmod-i2c-core +kmod-regmap-i2c + KCONFIG:=CONFIG_LEDS_KTD202X + FILES:= $(LINUX_DIR)/drivers/leds/rgb/leds-ktd202x.ko + AUTOLOAD:=$(call AutoProbe,leds-ktd202x,1) +endef + +define KernelPackage/leds-ktd202x/description + This option enables support for the Kinetic KTD2026/KTD2027 + RGB/White LED driver found in different BQ mobile phones. + It is a 3 or 4 channel LED driver programmed via an I2C interface. +endef + +$(eval $(call KernelPackage,leds-ktd202x)) + + define KernelPackage/leds-mlxcpld SUBMENU:=$(LEDS_MENU) TITLE:=LED support for the Mellanox boards diff --git a/target/linux/generic/backport-6.6/860-v6.7-leds-add-ktd202x-driver.patch b/target/linux/generic/backport-6.6/860-v6.7-leds-add-ktd202x-driver.patch new file mode 100644 index 00000000000000..fb767c5d9998be --- /dev/null +++ b/target/linux/generic/backport-6.6/860-v6.7-leds-add-ktd202x-driver.patch @@ -0,0 +1,682 @@ +From 0ebdb7210943eb345992bea9892adbd15a206193 Mon Sep 17 00:00:00 2001 +From: André Apitzsch +Date: Mon, 2 Oct 2023 18:48:28 +0200 +Subject: leds: Add ktd202x driver +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This commit adds support for Kinetic KTD2026/7 RGB/White LED driver. + +Signed-off-by: André Apitzsch +Link: https://lore.kernel.org/r/20231002-ktd202x-v6-2-26be8eefeb88@apitzsch.eu +Signed-off-by: Lee Jones +--- + drivers/leds/rgb/Kconfig | 13 + + drivers/leds/rgb/Makefile | 1 + + drivers/leds/rgb/leds-ktd202x.c | 625 ++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 639 insertions(+) + create mode 100644 drivers/leds/rgb/leds-ktd202x.c + +(limited to 'drivers/leds/rgb') + +--- a/drivers/leds/rgb/Kconfig ++++ b/drivers/leds/rgb/Kconfig +@@ -14,6 +14,19 @@ config LEDS_GROUP_MULTICOLOR + To compile this driver as a module, choose M here: the module + will be called leds-group-multicolor. + ++config LEDS_KTD202X ++ tristate "LED support for KTD202x Chips" ++ depends on I2C ++ depends on OF ++ select REGMAP_I2C ++ help ++ This option enables support for the Kinetic KTD2026/KTD2027 ++ RGB/White LED driver found in different BQ mobile phones. ++ It is a 3 or 4 channel LED driver programmed via an I2C interface. ++ ++ To compile this driver as a module, choose M here: the module ++ will be called leds-ktd202x. ++ + config LEDS_PWM_MULTICOLOR + tristate "PWM driven multi-color LED Support" + depends on PWM +--- a/drivers/leds/rgb/Makefile ++++ b/drivers/leds/rgb/Makefile +@@ -1,6 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + + obj-$(CONFIG_LEDS_GROUP_MULTICOLOR) += leds-group-multicolor.o ++obj-$(CONFIG_LEDS_KTD202X) += leds-ktd202x.o + obj-$(CONFIG_LEDS_PWM_MULTICOLOR) += leds-pwm-multicolor.o + obj-$(CONFIG_LEDS_QCOM_LPG) += leds-qcom-lpg.o + obj-$(CONFIG_LEDS_MT6370_RGB) += leds-mt6370-rgb.o +--- /dev/null ++++ b/drivers/leds/rgb/leds-ktd202x.c +@@ -0,0 +1,625 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later ++/* ++ * Kinetic KTD2026/7 RGB/White LED driver with I2C interface ++ * ++ * Copyright 2023 André Apitzsch ++ * ++ * Datasheet: https://www.kinet-ic.com/uploads/KTD2026-7-04h.pdf ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define KTD2026_NUM_LEDS 3 ++#define KTD2027_NUM_LEDS 4 ++#define KTD202X_MAX_LEDS 4 ++ ++/* Register bank */ ++#define KTD202X_REG_RESET_CONTROL 0x00 ++#define KTD202X_REG_FLASH_PERIOD 0x01 ++#define KTD202X_REG_PWM1_TIMER 0x02 ++#define KTD202X_REG_PWM2_TIMER 0x03 ++#define KTD202X_REG_CHANNEL_CTRL 0x04 ++#define KTD202X_REG_TRISE_FALL 0x05 ++#define KTD202X_REG_LED_IOUT(x) (0x06 + (x)) ++ ++/* Register 0 */ ++#define KTD202X_TIMER_SLOT_CONTROL_TSLOT1 0x00 ++#define KTD202X_TIMER_SLOT_CONTROL_TSLOT2 0x01 ++#define KTD202X_TIMER_SLOT_CONTROL_TSLOT3 0x02 ++#define KTD202X_TIMER_SLOT_CONTROL_TSLOT4 0x03 ++#define KTD202X_RSTR_RESET 0x07 ++ ++#define KTD202X_ENABLE_CTRL_WAKE 0x00 /* SCL High & SDA High */ ++#define KTD202X_ENABLE_CTRL_SLEEP 0x08 /* SCL High & SDA Toggling */ ++ ++#define KTD202X_TRISE_FALL_SCALE_NORMAL 0x00 ++#define KTD202X_TRISE_FALL_SCALE_SLOW_X2 0x20 ++#define KTD202X_TRISE_FALL_SCALE_SLOW_X4 0x40 ++#define KTD202X_TRISE_FALL_SCALE_FAST_X8 0x60 ++ ++/* Register 1 */ ++#define KTD202X_FLASH_PERIOD_256_MS_LOG_RAMP 0x00 ++ ++/* Register 2-3 */ ++#define KTD202X_FLASH_ON_TIME_0_4_PERCENT 0x01 ++ ++/* Register 4 */ ++#define KTD202X_CHANNEL_CTRL_MASK(x) (BIT(2 * (x)) | BIT(2 * (x) + 1)) ++#define KTD202X_CHANNEL_CTRL_OFF 0x00 ++#define KTD202X_CHANNEL_CTRL_ON(x) BIT(2 * (x)) ++#define KTD202X_CHANNEL_CTRL_PWM1(x) BIT(2 * (x) + 1) ++#define KTD202X_CHANNEL_CTRL_PWM2(x) (BIT(2 * (x)) | BIT(2 * (x) + 1)) ++ ++/* Register 5 */ ++#define KTD202X_RAMP_TIMES_2_MS 0x00 ++ ++/* Register 6-9 */ ++#define KTD202X_LED_CURRENT_10_mA 0x4f ++ ++#define KTD202X_FLASH_PERIOD_MIN_MS 256 ++#define KTD202X_FLASH_PERIOD_STEP_MS 128 ++#define KTD202X_FLASH_PERIOD_MAX_STEPS 126 ++#define KTD202X_FLASH_ON_MAX 256 ++ ++#define KTD202X_MAX_BRIGHTNESS 192 ++ ++static const struct reg_default ktd202x_reg_defaults[] = { ++ { KTD202X_REG_RESET_CONTROL, KTD202X_TIMER_SLOT_CONTROL_TSLOT1 | ++ KTD202X_ENABLE_CTRL_WAKE | KTD202X_TRISE_FALL_SCALE_NORMAL }, ++ { KTD202X_REG_FLASH_PERIOD, KTD202X_FLASH_PERIOD_256_MS_LOG_RAMP }, ++ { KTD202X_REG_PWM1_TIMER, KTD202X_FLASH_ON_TIME_0_4_PERCENT }, ++ { KTD202X_REG_PWM2_TIMER, KTD202X_FLASH_ON_TIME_0_4_PERCENT }, ++ { KTD202X_REG_CHANNEL_CTRL, KTD202X_CHANNEL_CTRL_OFF }, ++ { KTD202X_REG_TRISE_FALL, KTD202X_RAMP_TIMES_2_MS }, ++ { KTD202X_REG_LED_IOUT(0), KTD202X_LED_CURRENT_10_mA }, ++ { KTD202X_REG_LED_IOUT(1), KTD202X_LED_CURRENT_10_mA }, ++ { KTD202X_REG_LED_IOUT(2), KTD202X_LED_CURRENT_10_mA }, ++ { KTD202X_REG_LED_IOUT(3), KTD202X_LED_CURRENT_10_mA }, ++}; ++ ++struct ktd202x_led { ++ struct ktd202x *chip; ++ union { ++ struct led_classdev cdev; ++ struct led_classdev_mc mcdev; ++ }; ++ u32 index; ++}; ++ ++struct ktd202x { ++ struct mutex mutex; ++ struct regulator_bulk_data regulators[2]; ++ struct device *dev; ++ struct regmap *regmap; ++ bool enabled; ++ int num_leds; ++ struct ktd202x_led leds[] __counted_by(num_leds); ++}; ++ ++static int ktd202x_chip_disable(struct ktd202x *chip) ++{ ++ int ret; ++ ++ if (!chip->enabled) ++ return 0; ++ ++ regmap_write(chip->regmap, KTD202X_REG_RESET_CONTROL, KTD202X_ENABLE_CTRL_SLEEP); ++ ++ ret = regulator_bulk_disable(ARRAY_SIZE(chip->regulators), chip->regulators); ++ if (ret) { ++ dev_err(chip->dev, "Failed to disable regulators: %d\n", ret); ++ return ret; ++ } ++ ++ chip->enabled = false; ++ return 0; ++} ++ ++static int ktd202x_chip_enable(struct ktd202x *chip) ++{ ++ int ret; ++ ++ if (chip->enabled) ++ return 0; ++ ++ ret = regulator_bulk_enable(ARRAY_SIZE(chip->regulators), chip->regulators); ++ if (ret) { ++ dev_err(chip->dev, "Failed to enable regulators: %d\n", ret); ++ return ret; ++ } ++ chip->enabled = true; ++ ++ ret = regmap_write(chip->regmap, KTD202X_REG_RESET_CONTROL, KTD202X_ENABLE_CTRL_WAKE); ++ ++ if (ret) { ++ dev_err(chip->dev, "Failed to enable the chip: %d\n", ret); ++ ktd202x_chip_disable(chip); ++ } ++ ++ return ret; ++} ++ ++static bool ktd202x_chip_in_use(struct ktd202x *chip) ++{ ++ int i; ++ ++ for (i = 0; i < chip->num_leds; i++) { ++ if (chip->leds[i].cdev.brightness) ++ return true; ++ } ++ ++ return false; ++} ++ ++static int ktd202x_brightness_set(struct ktd202x_led *led, ++ struct mc_subled *subleds, ++ unsigned int num_channels) ++{ ++ bool mode_blink = false; ++ int channel; ++ int state; ++ int ret; ++ int i; ++ ++ if (ktd202x_chip_in_use(led->chip)) { ++ ret = ktd202x_chip_enable(led->chip); ++ if (ret) ++ return ret; ++ } ++ ++ ret = regmap_read(led->chip->regmap, KTD202X_REG_CHANNEL_CTRL, &state); ++ if (ret) ++ return ret; ++ ++ /* ++ * In multicolor case, assume blink mode if PWM is set for at least one ++ * channel because another channel cannot be in state ON at the same time ++ */ ++ for (i = 0; i < num_channels; i++) { ++ int channel_state; ++ ++ channel = subleds[i].channel; ++ channel_state = (state >> 2 * channel) & KTD202X_CHANNEL_CTRL_MASK(0); ++ if (channel_state == KTD202X_CHANNEL_CTRL_OFF) ++ continue; ++ mode_blink = channel_state == KTD202X_CHANNEL_CTRL_PWM1(0); ++ break; ++ } ++ ++ for (i = 0; i < num_channels; i++) { ++ enum led_brightness brightness; ++ int mode; ++ ++ brightness = subleds[i].brightness; ++ channel = subleds[i].channel; ++ ++ if (brightness) { ++ /* Register expects brightness between 0 and MAX_BRIGHTNESS - 1 */ ++ ret = regmap_write(led->chip->regmap, KTD202X_REG_LED_IOUT(channel), ++ brightness - 1); ++ if (ret) ++ return ret; ++ ++ if (mode_blink) ++ mode = KTD202X_CHANNEL_CTRL_PWM1(channel); ++ else ++ mode = KTD202X_CHANNEL_CTRL_ON(channel); ++ } else { ++ mode = KTD202X_CHANNEL_CTRL_OFF; ++ } ++ ret = regmap_update_bits(led->chip->regmap, KTD202X_REG_CHANNEL_CTRL, ++ KTD202X_CHANNEL_CTRL_MASK(channel), mode); ++ if (ret) ++ return ret; ++ } ++ ++ if (!ktd202x_chip_in_use(led->chip)) ++ return ktd202x_chip_disable(led->chip); ++ ++ return 0; ++} ++ ++static int ktd202x_brightness_single_set(struct led_classdev *cdev, ++ enum led_brightness value) ++{ ++ struct ktd202x_led *led = container_of(cdev, struct ktd202x_led, cdev); ++ struct mc_subled info; ++ int ret; ++ ++ cdev->brightness = value; ++ ++ mutex_lock(&led->chip->mutex); ++ ++ info.brightness = value; ++ info.channel = led->index; ++ ret = ktd202x_brightness_set(led, &info, 1); ++ ++ mutex_unlock(&led->chip->mutex); ++ ++ return ret; ++} ++ ++static int ktd202x_brightness_mc_set(struct led_classdev *cdev, ++ enum led_brightness value) ++{ ++ struct led_classdev_mc *mc = lcdev_to_mccdev(cdev); ++ struct ktd202x_led *led = container_of(mc, struct ktd202x_led, mcdev); ++ int ret; ++ ++ cdev->brightness = value; ++ ++ mutex_lock(&led->chip->mutex); ++ ++ led_mc_calc_color_components(mc, value); ++ ret = ktd202x_brightness_set(led, mc->subled_info, mc->num_colors); ++ ++ mutex_unlock(&led->chip->mutex); ++ ++ return ret; ++} ++ ++static int ktd202x_blink_set(struct ktd202x_led *led, unsigned long *delay_on, ++ unsigned long *delay_off, struct mc_subled *subleds, ++ unsigned int num_channels) ++{ ++ unsigned long delay_total_ms; ++ int ret, num_steps, on; ++ u8 ctrl_mask = 0; ++ u8 ctrl_pwm1 = 0; ++ u8 ctrl_on = 0; ++ int i; ++ ++ mutex_lock(&led->chip->mutex); ++ ++ for (i = 0; i < num_channels; i++) { ++ int channel = subleds[i].channel; ++ ++ ctrl_mask |= KTD202X_CHANNEL_CTRL_MASK(channel); ++ ctrl_on |= KTD202X_CHANNEL_CTRL_ON(channel); ++ ctrl_pwm1 |= KTD202X_CHANNEL_CTRL_PWM1(channel); ++ } ++ ++ /* Never off - brightness is already set, disable blinking */ ++ if (!*delay_off) { ++ ret = regmap_update_bits(led->chip->regmap, KTD202X_REG_CHANNEL_CTRL, ++ ctrl_mask, ctrl_on); ++ goto out; ++ } ++ ++ /* Convert into values the HW will understand. */ ++ ++ /* Integer representation of time of flash period */ ++ num_steps = (*delay_on + *delay_off - KTD202X_FLASH_PERIOD_MIN_MS) / ++ KTD202X_FLASH_PERIOD_STEP_MS; ++ num_steps = clamp(num_steps, 0, KTD202X_FLASH_PERIOD_MAX_STEPS); ++ ++ /* Integer representation of percentage of LED ON time */ ++ on = (*delay_on * KTD202X_FLASH_ON_MAX) / (*delay_on + *delay_off); ++ ++ /* Actually used delay_{on,off} values */ ++ delay_total_ms = num_steps * KTD202X_FLASH_PERIOD_STEP_MS + KTD202X_FLASH_PERIOD_MIN_MS; ++ *delay_on = (delay_total_ms * on) / KTD202X_FLASH_ON_MAX; ++ *delay_off = delay_total_ms - *delay_on; ++ ++ /* Set timings */ ++ ret = regmap_write(led->chip->regmap, KTD202X_REG_FLASH_PERIOD, num_steps); ++ if (ret) ++ goto out; ++ ++ ret = regmap_write(led->chip->regmap, KTD202X_REG_PWM1_TIMER, on); ++ if (ret) ++ goto out; ++ ++ ret = regmap_update_bits(led->chip->regmap, KTD202X_REG_CHANNEL_CTRL, ++ ctrl_mask, ctrl_pwm1); ++out: ++ mutex_unlock(&led->chip->mutex); ++ return ret; ++} ++ ++static int ktd202x_blink_single_set(struct led_classdev *cdev, ++ unsigned long *delay_on, ++ unsigned long *delay_off) ++{ ++ struct ktd202x_led *led = container_of(cdev, struct ktd202x_led, cdev); ++ struct mc_subled info; ++ int ret; ++ ++ if (!cdev->brightness) { ++ ret = ktd202x_brightness_single_set(cdev, KTD202X_MAX_BRIGHTNESS); ++ if (ret) ++ return ret; ++ } ++ ++ /* If no blink specified, default to 1 Hz. */ ++ if (!*delay_off && !*delay_on) { ++ *delay_off = 500; ++ *delay_on = 500; ++ } ++ ++ /* Never on - just set to off */ ++ if (!*delay_on) ++ return ktd202x_brightness_single_set(cdev, LED_OFF); ++ ++ info.channel = led->index; ++ ++ return ktd202x_blink_set(led, delay_on, delay_off, &info, 1); ++} ++ ++static int ktd202x_blink_mc_set(struct led_classdev *cdev, ++ unsigned long *delay_on, ++ unsigned long *delay_off) ++{ ++ struct led_classdev_mc *mc = lcdev_to_mccdev(cdev); ++ struct ktd202x_led *led = container_of(mc, struct ktd202x_led, mcdev); ++ int ret; ++ ++ if (!cdev->brightness) { ++ ret = ktd202x_brightness_mc_set(cdev, KTD202X_MAX_BRIGHTNESS); ++ if (ret) ++ return ret; ++ } ++ ++ /* If no blink specified, default to 1 Hz. */ ++ if (!*delay_off && !*delay_on) { ++ *delay_off = 500; ++ *delay_on = 500; ++ } ++ ++ /* Never on - just set to off */ ++ if (!*delay_on) ++ return ktd202x_brightness_mc_set(cdev, LED_OFF); ++ ++ return ktd202x_blink_set(led, delay_on, delay_off, mc->subled_info, ++ mc->num_colors); ++} ++ ++static int ktd202x_setup_led_rgb(struct ktd202x *chip, struct device_node *np, ++ struct ktd202x_led *led, struct led_init_data *init_data) ++{ ++ struct led_classdev *cdev; ++ struct device_node *child; ++ struct mc_subled *info; ++ int num_channels; ++ int i = 0; ++ ++ num_channels = of_get_available_child_count(np); ++ if (!num_channels || num_channels > chip->num_leds) ++ return -EINVAL; ++ ++ info = devm_kcalloc(chip->dev, num_channels, sizeof(*info), GFP_KERNEL); ++ if (!info) ++ return -ENOMEM; ++ ++ for_each_available_child_of_node(np, child) { ++ u32 mono_color; ++ u32 reg; ++ int ret; ++ ++ ret = of_property_read_u32(child, "reg", ®); ++ if (ret != 0 || reg >= chip->num_leds) { ++ dev_err(chip->dev, "invalid 'reg' of %pOFn\n", child); ++ of_node_put(child); ++ return -EINVAL; ++ } ++ ++ ret = of_property_read_u32(child, "color", &mono_color); ++ if (ret < 0 && ret != -EINVAL) { ++ dev_err(chip->dev, "failed to parse 'color' of %pOF\n", child); ++ of_node_put(child); ++ return ret; ++ } ++ ++ info[i].color_index = mono_color; ++ info[i].channel = reg; ++ info[i].intensity = KTD202X_MAX_BRIGHTNESS; ++ i++; ++ } ++ ++ led->mcdev.subled_info = info; ++ led->mcdev.num_colors = num_channels; ++ ++ cdev = &led->mcdev.led_cdev; ++ cdev->brightness_set_blocking = ktd202x_brightness_mc_set; ++ cdev->blink_set = ktd202x_blink_mc_set; ++ ++ return devm_led_classdev_multicolor_register_ext(chip->dev, &led->mcdev, init_data); ++} ++ ++static int ktd202x_setup_led_single(struct ktd202x *chip, struct device_node *np, ++ struct ktd202x_led *led, struct led_init_data *init_data) ++{ ++ struct led_classdev *cdev; ++ u32 reg; ++ int ret; ++ ++ ret = of_property_read_u32(np, "reg", ®); ++ if (ret != 0 || reg >= chip->num_leds) { ++ dev_err(chip->dev, "invalid 'reg' of %pOFn\n", np); ++ return -EINVAL; ++ } ++ led->index = reg; ++ ++ cdev = &led->cdev; ++ cdev->brightness_set_blocking = ktd202x_brightness_single_set; ++ cdev->blink_set = ktd202x_blink_single_set; ++ ++ return devm_led_classdev_register_ext(chip->dev, &led->cdev, init_data); ++} ++ ++static int ktd202x_add_led(struct ktd202x *chip, struct device_node *np, unsigned int index) ++{ ++ struct ktd202x_led *led = &chip->leds[index]; ++ struct led_init_data init_data = {}; ++ struct led_classdev *cdev; ++ u32 color; ++ int ret; ++ ++ /* Color property is optional in single color case */ ++ ret = of_property_read_u32(np, "color", &color); ++ if (ret < 0 && ret != -EINVAL) { ++ dev_err(chip->dev, "failed to parse 'color' of %pOF\n", np); ++ return ret; ++ } ++ ++ led->chip = chip; ++ init_data.fwnode = of_fwnode_handle(np); ++ ++ if (color == LED_COLOR_ID_RGB) { ++ cdev = &led->mcdev.led_cdev; ++ ret = ktd202x_setup_led_rgb(chip, np, led, &init_data); ++ } else { ++ cdev = &led->cdev; ++ ret = ktd202x_setup_led_single(chip, np, led, &init_data); ++ } ++ ++ if (ret) { ++ dev_err(chip->dev, "unable to register %s\n", cdev->name); ++ return ret; ++ } ++ ++ cdev->max_brightness = KTD202X_MAX_BRIGHTNESS; ++ ++ return 0; ++} ++ ++static int ktd202x_probe_dt(struct ktd202x *chip) ++{ ++ struct device_node *np = dev_of_node(chip->dev), *child; ++ int count; ++ int i = 0; ++ ++ chip->num_leds = (int)(unsigned long)of_device_get_match_data(chip->dev); ++ ++ count = of_get_available_child_count(np); ++ if (!count || count > chip->num_leds) ++ return -EINVAL; ++ ++ regmap_write(chip->regmap, KTD202X_REG_RESET_CONTROL, KTD202X_RSTR_RESET); ++ ++ /* Allow the device to execute the complete reset */ ++ usleep_range(200, 300); ++ ++ for_each_available_child_of_node(np, child) { ++ int ret = ktd202x_add_led(chip, child, i); ++ ++ if (ret) { ++ of_node_put(child); ++ return ret; ++ } ++ i++; ++ } ++ ++ return 0; ++} ++ ++static const struct regmap_config ktd202x_regmap_config = { ++ .reg_bits = 8, ++ .val_bits = 8, ++ .max_register = 0x09, ++ .cache_type = REGCACHE_FLAT, ++ .reg_defaults = ktd202x_reg_defaults, ++ .num_reg_defaults = ARRAY_SIZE(ktd202x_reg_defaults), ++}; ++ ++static int ktd202x_probe(struct i2c_client *client) ++{ ++ struct device *dev = &client->dev; ++ struct ktd202x *chip; ++ int count; ++ int ret; ++ ++ count = device_get_child_node_count(dev); ++ if (!count || count > KTD202X_MAX_LEDS) ++ return dev_err_probe(dev, -EINVAL, "Incorrect number of leds (%d)", count); ++ ++ chip = devm_kzalloc(dev, struct_size(chip, leds, count), GFP_KERNEL); ++ if (!chip) ++ return -ENOMEM; ++ ++ chip->dev = dev; ++ i2c_set_clientdata(client, chip); ++ ++ chip->regmap = devm_regmap_init_i2c(client, &ktd202x_regmap_config); ++ if (IS_ERR(chip->regmap)) { ++ ret = dev_err_probe(dev, PTR_ERR(chip->regmap), ++ "Failed to allocate register map.\n"); ++ return ret; ++ } ++ ++ chip->regulators[0].supply = "vin"; ++ chip->regulators[1].supply = "vio"; ++ ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(chip->regulators), chip->regulators); ++ if (ret < 0) { ++ dev_err_probe(dev, ret, "Failed to request regulators.\n"); ++ return ret; ++ } ++ ++ ret = regulator_bulk_enable(ARRAY_SIZE(chip->regulators), chip->regulators); ++ if (ret) { ++ dev_err_probe(dev, ret, "Failed to enable regulators.\n"); ++ return ret; ++ } ++ ++ ret = ktd202x_probe_dt(chip); ++ if (ret < 0) { ++ regulator_bulk_disable(ARRAY_SIZE(chip->regulators), chip->regulators); ++ return ret; ++ } ++ ++ ret = regulator_bulk_disable(ARRAY_SIZE(chip->regulators), chip->regulators); ++ if (ret) { ++ dev_err_probe(dev, ret, "Failed to disable regulators.\n"); ++ return ret; ++ } ++ ++ mutex_init(&chip->mutex); ++ ++ return 0; ++} ++ ++static void ktd202x_remove(struct i2c_client *client) ++{ ++ struct ktd202x *chip = i2c_get_clientdata(client); ++ ++ ktd202x_chip_disable(chip); ++ ++ mutex_destroy(&chip->mutex); ++} ++ ++static void ktd202x_shutdown(struct i2c_client *client) ++{ ++ struct ktd202x *chip = i2c_get_clientdata(client); ++ ++ /* Reset registers to make sure all LEDs are off before shutdown */ ++ regmap_write(chip->regmap, KTD202X_REG_RESET_CONTROL, KTD202X_RSTR_RESET); ++} ++ ++static const struct of_device_id ktd202x_match_table[] = { ++ { .compatible = "kinetic,ktd2026", .data = (void *)KTD2026_NUM_LEDS }, ++ { .compatible = "kinetic,ktd2027", .data = (void *)KTD2027_NUM_LEDS }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, ktd202x_match_table); ++ ++static struct i2c_driver ktd202x_driver = { ++ .driver = { ++ .name = "leds-ktd202x", ++ .of_match_table = ktd202x_match_table, ++ }, ++ .probe = ktd202x_probe, ++ .remove = ktd202x_remove, ++ .shutdown = ktd202x_shutdown, ++}; ++module_i2c_driver(ktd202x_driver); ++ ++MODULE_AUTHOR("André Apitzsch "); ++MODULE_DESCRIPTION("Kinetic KTD2026/7 LED driver"); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/backport-6.6/861-v6.10-leds-rgb-leds-ktd202x-get-device-properties-through-fwnode.patch b/target/linux/generic/backport-6.6/861-v6.10-leds-rgb-leds-ktd202x-get-device-properties-through-fwnode.patch new file mode 100644 index 00000000000000..92b20c3b9c2ea2 --- /dev/null +++ b/target/linux/generic/backport-6.6/861-v6.10-leds-rgb-leds-ktd202x-get-device-properties-through-fwnode.patch @@ -0,0 +1,221 @@ +From f14aa5ea415b8add245e976bfab96a12986c6843 Mon Sep 17 00:00:00 2001 +From: Kate Hsuan +Date: Fri, 31 May 2024 13:41:19 +0200 +Subject: leds: rgb: leds-ktd202x: Get device properties through fwnode to + support ACPI +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This LED controller is installed on a Xiaomi pad2 and it is an x86 +platform. The original driver is based on the device tree and can't be +used for this ACPI based system. This patch migrated the driver to use +fwnode to access the properties. Moreover, the fwnode API supports the +device tree so this work won't affect the original implementations. + +Signed-off-by: Kate Hsuan +Tested-by: André Apitzsch # on BQ Aquaris M5 +Reviewed-by: Hans de Goede +Reviewed-by: Andy Shevchenko +Signed-off-by: Hans de Goede +Link: https://lore.kernel.org/r/20240531114124.45346-2-hdegoede@redhat.com +Signed-off-by: Lee Jones +--- + drivers/leds/rgb/Kconfig | 1 - + drivers/leds/rgb/leds-ktd202x.c | 64 ++++++++++++++++++++++------------------- + 2 files changed, 34 insertions(+), 31 deletions(-) + +(limited to 'drivers/leds/rgb') + +--- a/drivers/leds/rgb/Kconfig ++++ b/drivers/leds/rgb/Kconfig +@@ -17,7 +17,6 @@ config LEDS_GROUP_MULTICOLOR + config LEDS_KTD202X + tristate "LED support for KTD202x Chips" + depends on I2C +- depends on OF + select REGMAP_I2C + help + This option enables support for the Kinetic KTD2026/KTD2027 +--- a/drivers/leds/rgb/leds-ktd202x.c ++++ b/drivers/leds/rgb/leds-ktd202x.c +@@ -99,7 +99,7 @@ struct ktd202x { + struct device *dev; + struct regmap *regmap; + bool enabled; +- int num_leds; ++ unsigned long num_leds; + struct ktd202x_led leds[] __counted_by(num_leds); + }; + +@@ -381,16 +381,19 @@ static int ktd202x_blink_mc_set(struct l + mc->num_colors); + } + +-static int ktd202x_setup_led_rgb(struct ktd202x *chip, struct device_node *np, ++static int ktd202x_setup_led_rgb(struct ktd202x *chip, struct fwnode_handle *fwnode, + struct ktd202x_led *led, struct led_init_data *init_data) + { ++ struct fwnode_handle *child; + struct led_classdev *cdev; +- struct device_node *child; + struct mc_subled *info; + int num_channels; + int i = 0; + +- num_channels = of_get_available_child_count(np); ++ num_channels = 0; ++ fwnode_for_each_available_child_node(fwnode, child) ++ num_channels++; ++ + if (!num_channels || num_channels > chip->num_leds) + return -EINVAL; + +@@ -398,22 +401,22 @@ static int ktd202x_setup_led_rgb(struct + if (!info) + return -ENOMEM; + +- for_each_available_child_of_node(np, child) { ++ fwnode_for_each_available_child_node(fwnode, child) { + u32 mono_color; + u32 reg; + int ret; + +- ret = of_property_read_u32(child, "reg", ®); ++ ret = fwnode_property_read_u32(child, "reg", ®); + if (ret != 0 || reg >= chip->num_leds) { +- dev_err(chip->dev, "invalid 'reg' of %pOFn\n", child); +- of_node_put(child); +- return -EINVAL; ++ dev_err(chip->dev, "invalid 'reg' of %pfw\n", child); ++ fwnode_handle_put(child); ++ return ret; + } + +- ret = of_property_read_u32(child, "color", &mono_color); ++ ret = fwnode_property_read_u32(child, "color", &mono_color); + if (ret < 0 && ret != -EINVAL) { +- dev_err(chip->dev, "failed to parse 'color' of %pOF\n", child); +- of_node_put(child); ++ dev_err(chip->dev, "failed to parse 'color' of %pfw\n", child); ++ fwnode_handle_put(child); + return ret; + } + +@@ -433,16 +436,16 @@ static int ktd202x_setup_led_rgb(struct + return devm_led_classdev_multicolor_register_ext(chip->dev, &led->mcdev, init_data); + } + +-static int ktd202x_setup_led_single(struct ktd202x *chip, struct device_node *np, ++static int ktd202x_setup_led_single(struct ktd202x *chip, struct fwnode_handle *fwnode, + struct ktd202x_led *led, struct led_init_data *init_data) + { + struct led_classdev *cdev; + u32 reg; + int ret; + +- ret = of_property_read_u32(np, "reg", ®); ++ ret = fwnode_property_read_u32(fwnode, "reg", ®); + if (ret != 0 || reg >= chip->num_leds) { +- dev_err(chip->dev, "invalid 'reg' of %pOFn\n", np); ++ dev_err(chip->dev, "invalid 'reg' of %pfw\n", fwnode); + return -EINVAL; + } + led->index = reg; +@@ -454,7 +457,7 @@ static int ktd202x_setup_led_single(stru + return devm_led_classdev_register_ext(chip->dev, &led->cdev, init_data); + } + +-static int ktd202x_add_led(struct ktd202x *chip, struct device_node *np, unsigned int index) ++static int ktd202x_add_led(struct ktd202x *chip, struct fwnode_handle *fwnode, unsigned int index) + { + struct ktd202x_led *led = &chip->leds[index]; + struct led_init_data init_data = {}; +@@ -463,21 +466,21 @@ static int ktd202x_add_led(struct ktd202 + int ret; + + /* Color property is optional in single color case */ +- ret = of_property_read_u32(np, "color", &color); ++ ret = fwnode_property_read_u32(fwnode, "color", &color); + if (ret < 0 && ret != -EINVAL) { +- dev_err(chip->dev, "failed to parse 'color' of %pOF\n", np); ++ dev_err(chip->dev, "failed to parse 'color' of %pfw\n", fwnode); + return ret; + } + + led->chip = chip; +- init_data.fwnode = of_fwnode_handle(np); ++ init_data.fwnode = fwnode; + + if (color == LED_COLOR_ID_RGB) { + cdev = &led->mcdev.led_cdev; +- ret = ktd202x_setup_led_rgb(chip, np, led, &init_data); ++ ret = ktd202x_setup_led_rgb(chip, fwnode, led, &init_data); + } else { + cdev = &led->cdev; +- ret = ktd202x_setup_led_single(chip, np, led, &init_data); ++ ret = ktd202x_setup_led_single(chip, fwnode, led, &init_data); + } + + if (ret) { +@@ -490,15 +493,14 @@ static int ktd202x_add_led(struct ktd202 + return 0; + } + +-static int ktd202x_probe_dt(struct ktd202x *chip) ++static int ktd202x_probe_fw(struct ktd202x *chip) + { +- struct device_node *np = dev_of_node(chip->dev), *child; ++ struct fwnode_handle *child; ++ struct device *dev = chip->dev; + int count; + int i = 0; + +- chip->num_leds = (int)(unsigned long)of_device_get_match_data(chip->dev); +- +- count = of_get_available_child_count(np); ++ count = device_get_child_node_count(dev); + if (!count || count > chip->num_leds) + return -EINVAL; + +@@ -507,11 +509,11 @@ static int ktd202x_probe_dt(struct ktd20 + /* Allow the device to execute the complete reset */ + usleep_range(200, 300); + +- for_each_available_child_of_node(np, child) { ++ device_for_each_child_node(dev, child) { + int ret = ktd202x_add_led(chip, child, i); + + if (ret) { +- of_node_put(child); ++ fwnode_handle_put(child); + return ret; + } + i++; +@@ -554,6 +556,8 @@ static int ktd202x_probe(struct i2c_clie + return ret; + } + ++ chip->num_leds = (unsigned long)i2c_get_match_data(client); ++ + chip->regulators[0].supply = "vin"; + chip->regulators[1].supply = "vio"; + ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(chip->regulators), chip->regulators); +@@ -568,7 +572,7 @@ static int ktd202x_probe(struct i2c_clie + return ret; + } + +- ret = ktd202x_probe_dt(chip); ++ ret = ktd202x_probe_fw(chip); + if (ret < 0) { + regulator_bulk_disable(ARRAY_SIZE(chip->regulators), chip->regulators); + return ret; +@@ -605,7 +609,7 @@ static void ktd202x_shutdown(struct i2c_ + static const struct of_device_id ktd202x_match_table[] = { + { .compatible = "kinetic,ktd2026", .data = (void *)KTD2026_NUM_LEDS }, + { .compatible = "kinetic,ktd2027", .data = (void *)KTD2027_NUM_LEDS }, +- {}, ++ {} + }; + MODULE_DEVICE_TABLE(of, ktd202x_match_table); + diff --git a/target/linux/generic/backport-6.6/862-v6.10-leds-rgb-leds-ktd202x-i2c-id-tables-for-ktd2026-and-2027.patch b/target/linux/generic/backport-6.6/862-v6.10-leds-rgb-leds-ktd202x-i2c-id-tables-for-ktd2026-and-2027.patch new file mode 100644 index 00000000000000..223ccd8f50c764 --- /dev/null +++ b/target/linux/generic/backport-6.6/862-v6.10-leds-rgb-leds-ktd202x-i2c-id-tables-for-ktd2026-and-2027.patch @@ -0,0 +1,49 @@ +From 75bd07aef47e1a984229e6ec702e8b9aee0226e4 Mon Sep 17 00:00:00 2001 +From: Kate Hsuan +Date: Fri, 31 May 2024 13:41:20 +0200 +Subject: leds: rgb: leds-ktd202x: I2C ID tables for KTD2026 and 2027 + +Add an i2c_device_id id_table to match manually instantiated +(non device-tree / ACPI instantiated) KTD202x controllers as +found on some x86 boards. + +This table shows the maximum support LED channel for KTD2026 +(three LEDs) and KTD-2027 (4 LEDs). + +Link: https://www.kinet-ic.com/uploads/KTD2026-7-04h.pdf +Signed-off-by: Kate Hsuan +Reviewed-by: Hans de Goede +Reviewed-by: Andy Shevchenko +Signed-off-by: Hans de Goede +Link: https://lore.kernel.org/r/20240531114124.45346-3-hdegoede@redhat.com +Signed-off-by: Lee Jones +--- + drivers/leds/rgb/leds-ktd202x.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +(limited to 'drivers/leds/rgb') + +--- a/drivers/leds/rgb/leds-ktd202x.c ++++ b/drivers/leds/rgb/leds-ktd202x.c +@@ -606,6 +606,13 @@ static void ktd202x_shutdown(struct i2c_ + regmap_write(chip->regmap, KTD202X_REG_RESET_CONTROL, KTD202X_RSTR_RESET); + } + ++static const struct i2c_device_id ktd202x_id[] = { ++ {"ktd2026", KTD2026_NUM_LEDS}, ++ {"ktd2027", KTD2027_NUM_LEDS}, ++ {} ++}; ++MODULE_DEVICE_TABLE(i2c, ktd202x_id); ++ + static const struct of_device_id ktd202x_match_table[] = { + { .compatible = "kinetic,ktd2026", .data = (void *)KTD2026_NUM_LEDS }, + { .compatible = "kinetic,ktd2027", .data = (void *)KTD2027_NUM_LEDS }, +@@ -621,6 +628,7 @@ static struct i2c_driver ktd202x_driver + .probe = ktd202x_probe, + .remove = ktd202x_remove, + .shutdown = ktd202x_shutdown, ++ .id_table = ktd202x_id, + }; + module_i2c_driver(ktd202x_driver); + diff --git a/target/linux/generic/backport-6.6/863-v6.10-leds-rgb-leds-ktd202x-initialize-mutex-earlier.patch b/target/linux/generic/backport-6.6/863-v6.10-leds-rgb-leds-ktd202x-initialize-mutex-earlier.patch new file mode 100644 index 00000000000000..533b0f0e170749 --- /dev/null +++ b/target/linux/generic/backport-6.6/863-v6.10-leds-rgb-leds-ktd202x-initialize-mutex-earlier.patch @@ -0,0 +1,62 @@ +From e1b08c6f5b92d408a9fcc1030a340caeb9852250 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Fri, 31 May 2024 13:41:21 +0200 +Subject: leds: rgb: leds-ktd202x: Initialize mutex earlier + +The mutex must be initialized before the LED class device is registered +otherwise there is a race where it may get used before it is initialized: + + DEBUG_LOCKS_WARN_ON(lock->magic != lock) + WARNING: CPU: 2 PID: 2045 at kernel/locking/mutex.c:587 __mutex_lock + ... + RIP: 0010:__mutex_lock+0x7db/0xc10 + ... + set_brightness_delayed_set_brightness.part.0+0x17/0x60 + set_brightness_delayed+0xf1/0x100 + process_one_work+0x222/0x5a0 + +Move the mutex_init() call earlier to avoid this race condition and +switch to devm_mutex_init() to avoid the need to add error-exit +cleanup to probe() if probe() fails later on. + +Signed-off-by: Hans de Goede +Reviewed-by: Andy Shevchenko +Link: https://lore.kernel.org/r/20240531114124.45346-4-hdegoede@redhat.com +Signed-off-by: Lee Jones +--- + drivers/leds/rgb/leds-ktd202x.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +(limited to 'drivers/leds/rgb') + +--- a/drivers/leds/rgb/leds-ktd202x.c ++++ b/drivers/leds/rgb/leds-ktd202x.c +@@ -556,6 +556,10 @@ static int ktd202x_probe(struct i2c_clie + return ret; + } + ++ ret = devm_mutex_init(dev, &chip->mutex); ++ if (ret) ++ return ret; ++ + chip->num_leds = (unsigned long)i2c_get_match_data(client); + + chip->regulators[0].supply = "vin"; +@@ -584,8 +588,6 @@ static int ktd202x_probe(struct i2c_clie + return ret; + } + +- mutex_init(&chip->mutex); +- + return 0; + } + +@@ -594,8 +596,6 @@ static void ktd202x_remove(struct i2c_cl + struct ktd202x *chip = i2c_get_clientdata(client); + + ktd202x_chip_disable(chip); +- +- mutex_destroy(&chip->mutex); + } + + static void ktd202x_shutdown(struct i2c_client *client) From 35e02b31c0c6019b5e0716cad78f5e66ebd574b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Fri, 27 Dec 2024 17:34:39 +0100 Subject: [PATCH 266/877] generic: add missing CONFIG_LEDS_KTD202X symbol MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit 56d97fff55f3 backported leds-ktd202x from upstream but didn't add the generic config symbol. Fixes: 56d97fff55f3 ("generic: backport support for KTD2026/7 rgb(w) led controller") Signed-off-by: Álvaro Fernández Rojas Link: https://github.com/openwrt/openwrt/pull/17396 Signed-off-by: Robert Marko (cherry picked from commit c846f48f6a1d7167ea4f55e5ce2cf4f1e27c8fe2) --- target/linux/generic/config-6.6 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/generic/config-6.6 b/target/linux/generic/config-6.6 index 2ea1b7910388f5..c8ebee70278022 100644 --- a/target/linux/generic/config-6.6 +++ b/target/linux/generic/config-6.6 @@ -3052,6 +3052,7 @@ CONFIG_LEDS_CLASS_MULTICOLOR=y # CONFIG_LEDS_INTEL_SS4200 is not set # CONFIG_LEDS_IS31FL319X is not set # CONFIG_LEDS_IS31FL32XX is not set +# CONFIG_LEDS_KTD202X is not set # CONFIG_LEDS_LM3530 is not set # CONFIG_LEDS_LM3532 is not set # CONFIG_LEDS_LM355x is not set From b80de63e9fcc4c91520a4d04e3e7a9c8ed5556cb Mon Sep 17 00:00:00 2001 From: George Oldfort Date: Tue, 26 Nov 2024 15:14:56 +0100 Subject: [PATCH 267/877] mediatek: filogic: add KTD2026/7 driver to Acer Connect Vero W6m This commit adds kmod-leds-ktd202x to the OpenWrt image for the device "Acer Connect Vero W6m" which is equipped with one KTD2026 controlling the device's status LED via I2C. Signed-off-by: George Oldfort Link: https://github.com/openwrt/openwrt/pull/16860 Signed-off-by: Hauke Mehrtens (cherry picked from commit e44180d45cc4aa24d2d8df55de49b3627ea4d168) --- 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 ddcf59503aadfa..c1a3eff6c72662 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -186,7 +186,7 @@ define Device/acer_vero-w6m DEVICE_DTS := mt7986a-acer-vero-w6m DEVICE_DTS_DIR := ../dts DEVICE_DTS_LOADADDR := 0x47000000 - DEVICE_PACKAGES := kmod-mt7915e kmod-mt7916-firmware kmod-mt7986-firmware mt7986-wo-firmware e2fsprogs f2fsck mkf2fs + DEVICE_PACKAGES := kmod-leds-ktd202x kmod-mt7915e kmod-mt7916-firmware kmod-mt7986-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 f91d8e9f37dd77b6dd4b0ea2e3d3c34f8dc3f2a3 Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Fri, 20 Dec 2024 22:30:01 +0800 Subject: [PATCH 268/877] trusted-firmware-a.mk: fix release download URL The URL of trusted-firmware-a is no longer available for downloading release: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/ curl: (22) The requested URL returned error: 401 Unauthorized So we switch to the GitHub mirror repository to download. Signed-off-by: Chukun Pan Link: https://github.com/openwrt/openwrt/pull/17360 Signed-off-by: Robert Marko (cherry picked from commit 4b6eb631e18b3ccccada91d5bccbb684e6ccc5a4) --- include/trusted-firmware-a.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/trusted-firmware-a.mk b/include/trusted-firmware-a.mk index e469dae9840087..40c9023f1def7b 100644 --- a/include/trusted-firmware-a.mk +++ b/include/trusted-firmware-a.mk @@ -3,7 +3,7 @@ PKG_CPE_ID ?= cpe:/a:arm:trusted_firmware-a ifndef PKG_SOURCE_PROTO PKG_SOURCE = trusted-firmware-a-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/snapshot +PKG_SOURCE_URL:=https://codeload.github.com/TrustedFirmware-A/trusted-firmware-a/tar.gz/v$(PKG_VERSION)? endif PKG_BUILD_DIR = $(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) From 36f7db978a5fd2f84d3351a2e4148106cb1af282 Mon Sep 17 00:00:00 2001 From: Jonathan Sturges Date: Thu, 26 Dec 2024 21:47:40 -0500 Subject: [PATCH 269/877] ramips: mt7621: enable lzma-loader for Amped Wireless ALLY Switch to using loader-kernel to accommodate larger image sizes that are problematic for many mt7621 uboots. Signed-off-by: Jonathan Sturges Link: https://github.com/openwrt/openwrt/pull/17389 Signed-off-by: Hauke Mehrtens (cherry picked from commit f8a8a2c5c7ff1efe289d846a890d3361757c231f) --- target/linux/ramips/image/mt7621.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index eb7dacefefb793..9c6efb8f1c7bb7 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -294,11 +294,11 @@ TARGET_DEVICES += alfa-network_quad-e4g define Device/ampedwireless_ally_common $(Device/nand) + $(Device/uimage-lzma-loader) DEVICE_VENDOR := Amped Wireless DEVICE_PACKAGES := kmod-mt7615-firmware IMAGE_SIZE := 32768k - KERNEL_INITRAMFS := $(KERNEL_DTB) | uImage lzma -n 'flashable-initramfs' |\ - edimax-header -s CSYS -m RN68 -f 0x001c0000 -S 0x01100000 + KERNEL_INITRAMFS := $$(KERNEL) | edimax-header -s CSYS -m RN68 -f 0x001c0000 -S 0x01100000 endef define Device/ampedwireless_ally-r1900k From d5f01971f728c6eb9ec7745c0040bd673c824add Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Thu, 2 Jan 2025 09:31:44 +0100 Subject: [PATCH 270/877] realtek: drop extraneous ')' in 02_network The extraneous closing parenthesis inside the case matching breaks syntax of the network initialization script 02_network. /bin/board_detect: /etc/board.d/02_network: line 40: syntax error: unexpected newline (expecting ")") Remove this character so board init is functional again. Fixes: c8ea1aa970bf ("realtek: add support for HPE 1920-24G-PoE-370w") Signed-off-by: Sander Vanheule (cherry picked from commit a3391d871d3f14f5de2081e23eda08986abc2b9b) --- target/linux/realtek/base-files/etc/board.d/02_network | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 a73944107ae884..12fb33d85e07ed 100644 --- a/target/linux/realtek/base-files/etc/board.d/02_network +++ b/target/linux/realtek/base-files/etc/board.d/02_network @@ -36,7 +36,7 @@ hpe,1920-8g-poe-65w|\ hpe,1920-8g-poe-180w|\ hpe,1920-16g|\ hpe,1920-24g|\ -hpe,1920-24g-poe-370w|\) +hpe,1920-24g-poe-370w|\ hpe,1920-48g|\ hpe,1920-48g-poe) label_mac=$(mtd_get_mac_binary factory 0x68) From 369d2f3bf998644136a16aa526351ddc36742c32 Mon Sep 17 00:00:00 2001 From: James Sweeney Date: Thu, 2 Jan 2025 08:06:09 -0500 Subject: [PATCH 271/877] realtek: add 1920-24g-poe-180w to mac address Add 1920-24g-poe-180w to the mac address retrieval part of 02_network to properly set the device's port MAC addresses. This piece was missed when this device was added. Fixes: b948c1e39b9e ("realtek: add support for HPE 1920-24G PoE-180W (JG925A)") Link: https://github.com/openwrt/openwrt/pull/17460 Signed-off-by: James Sweeney (cherry picked from commit 0b54029a6e96bb2ce484f316be3870cc2617de30) --- target/linux/realtek/base-files/etc/board.d/02_network | 1 + 1 file changed, 1 insertion(+) 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 12fb33d85e07ed..1255ee8b9e1c65 100644 --- a/target/linux/realtek/base-files/etc/board.d/02_network +++ b/target/linux/realtek/base-files/etc/board.d/02_network @@ -36,6 +36,7 @@ hpe,1920-8g-poe-65w|\ hpe,1920-8g-poe-180w|\ hpe,1920-16g|\ hpe,1920-24g|\ +hpe,1920-24g-poe-180w|\ hpe,1920-24g-poe-370w|\ hpe,1920-48g|\ hpe,1920-48g-poe) From 5330f620854731cb1c5d44043cfa444b4af78f87 Mon Sep 17 00:00:00 2001 From: Georgi Valkov Date: Thu, 12 Dec 2024 11:05:15 +0200 Subject: [PATCH 272/877] mac80211: refresh patch for ath12k refresh the following patch for ath12k 001-wifi-ath12k-add-11d-scan-offload-support-and-handle-country-code-for-WCN7850.patch Signed-off-by: Georgi Valkov Link: https://github.com/openwrt/openwrt/pull/17246 Signed-off-by: John Crispin (cherry picked from commit fb17914f65a430555b908929682d8b36d6e31b12) --- ...-and-handle-country-code-for-WCN7850.patch | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/package/kernel/mac80211/patches/ath12k/001-wifi-ath12k-add-11d-scan-offload-support-and-handle-country-code-for-WCN7850.patch b/package/kernel/mac80211/patches/ath12k/001-wifi-ath12k-add-11d-scan-offload-support-and-handle-country-code-for-WCN7850.patch index d370db104713a0..f368ccd2727fad 100644 --- a/package/kernel/mac80211/patches/ath12k/001-wifi-ath12k-add-11d-scan-offload-support-and-handle-country-code-for-WCN7850.patch +++ b/package/kernel/mac80211/patches/ath12k/001-wifi-ath12k-add-11d-scan-offload-support-and-handle-country-code-for-WCN7850.patch @@ -121,7 +121,7 @@ Acked-by: Jeff Johnson }; static __le32 ath12k_wmi_tlv_hdr(u32 cmd, u32 len) -@@ -2363,7 +2365,10 @@ int ath12k_wmi_send_scan_start_cmd(struc +@@ -2364,7 +2366,10 @@ int ath12k_wmi_send_scan_start_cmd(struc cmd->scan_id = cpu_to_le32(arg->scan_id); cmd->scan_req_id = cpu_to_le32(arg->scan_req_id); cmd->vdev_id = cpu_to_le32(arg->vdev_id); @@ -133,7 +133,7 @@ Acked-by: Jeff Johnson cmd->notify_scan_events = cpu_to_le32(arg->notify_scan_events); ath12k_wmi_copy_scan_event_cntrl_flags(cmd, arg); -@@ -3083,6 +3088,110 @@ out: +@@ -3084,6 +3089,110 @@ out: return ret; } @@ -244,7 +244,7 @@ Acked-by: Jeff Johnson int ath12k_wmi_send_twt_enable_cmd(struct ath12k *ar, u32 pdev_id) { -@@ -5668,6 +5777,50 @@ static void ath12k_wmi_op_ep_tx_credits( +@@ -5669,6 +5778,50 @@ static void ath12k_wmi_op_ep_tx_credits( wake_up(&ab->wmi_ab.tx_credits_wq); } @@ -295,7 +295,7 @@ Acked-by: Jeff Johnson static void ath12k_wmi_htc_tx_complete(struct ath12k_base *ab, struct sk_buff *skb) { -@@ -7269,6 +7422,9 @@ static void ath12k_wmi_op_rx(struct ath1 +@@ -7270,6 +7423,9 @@ static void ath12k_wmi_op_rx(struct ath1 case WMI_GTK_OFFLOAD_STATUS_EVENTID: ath12k_wmi_gtk_offload_status_event(ab, skb); break; @@ -307,7 +307,7 @@ Acked-by: Jeff Johnson ath12k_dbg(ab, ATH12K_DBG_WMI, "Unknown eventid: 0x%x\n", id); --- a/drivers/net/wireless/ath/ath12k/wmi.h +++ b/drivers/net/wireless/ath/ath12k/wmi.h -@@ -3859,6 +3859,28 @@ struct wmi_init_country_cmd { +@@ -3860,6 +3860,28 @@ struct wmi_init_country_cmd { } cc_info; } __packed; @@ -336,7 +336,7 @@ Acked-by: Jeff Johnson struct wmi_delba_send_cmd { __le32 tlv_header; __le32 vdev_id; -@@ -3944,6 +3966,16 @@ struct ath12k_wmi_eht_rate_set_params { +@@ -3945,6 +3967,16 @@ struct ath12k_wmi_eht_rate_set_params { #define MAX_6G_REG_RULES 5 #define REG_US_5G_NUM_REG_RULES 4 @@ -353,7 +353,7 @@ Acked-by: Jeff Johnson enum wmi_start_event_param { WMI_VDEV_START_RESP_EVENT = 0, WMI_VDEV_RESTART_RESP_EVENT, -@@ -5546,11 +5578,17 @@ int ath12k_wmi_send_bcn_offload_control_ +@@ -5547,11 +5579,17 @@ int ath12k_wmi_send_bcn_offload_control_ u32 vdev_id, u32 bcn_ctrl_op); int ath12k_wmi_send_init_country_cmd(struct ath12k *ar, struct ath12k_wmi_init_country_arg *arg); @@ -485,7 +485,7 @@ Acked-by: Jeff Johnson u32 fw_crash_counter; --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c -@@ -2947,6 +2947,11 @@ static void ath12k_bss_assoc(struct ath1 +@@ -2946,6 +2946,11 @@ static void ath12k_bss_assoc(struct ath1 if (ret) ath12k_warn(ar->ab, "failed to set vdev %i OBSS PD parameters: %d\n", arvif->vdev_id, ret); @@ -497,7 +497,7 @@ Acked-by: Jeff Johnson } static void ath12k_bss_disassoc(struct ath12k *ar, -@@ -3522,7 +3527,7 @@ void __ath12k_mac_scan_finish(struct ath +@@ -3521,7 +3526,7 @@ void __ath12k_mac_scan_finish(struct ath ar->scan_channel = NULL; ar->scan.roc_freq = 0; cancel_delayed_work(&ar->scan.timeout); @@ -506,7 +506,7 @@ Acked-by: Jeff Johnson break; } } -@@ -3783,7 +3788,12 @@ scan: +@@ -3782,7 +3787,12 @@ scan: ret = ath12k_start_scan(ar, &arg); if (ret) { @@ -520,7 +520,7 @@ Acked-by: Jeff Johnson spin_lock_bh(&ar->data_lock); ar->scan.state = ATH12K_SCAN_IDLE; spin_unlock_bh(&ar->data_lock); -@@ -3802,6 +3812,11 @@ exit: +@@ -3801,6 +3811,11 @@ exit: mutex_unlock(&ar->conf_mutex); @@ -532,7 +532,7 @@ Acked-by: Jeff Johnson return ret; } -@@ -5986,7 +6001,7 @@ static int ath12k_mac_start(struct ath12 +@@ -5985,7 +6000,7 @@ static int ath12k_mac_start(struct ath12 /* TODO: Do we need to enable ANI? */ @@ -541,7 +541,7 @@ Acked-by: Jeff Johnson ar->num_started_vdevs = 0; ar->num_created_vdevs = 0; -@@ -6166,6 +6181,9 @@ static void ath12k_mac_stop(struct ath12 +@@ -6165,6 +6180,9 @@ static void ath12k_mac_stop(struct ath12 cancel_delayed_work_sync(&ar->scan.timeout); cancel_work_sync(&ar->regd_update_work); cancel_work_sync(&ar->ab->rfkill_work); @@ -551,7 +551,7 @@ Acked-by: Jeff Johnson spin_lock_bh(&ar->data_lock); list_for_each_entry_safe(ppdu_stats, tmp, &ar->ppdu_stats_info, list) { -@@ -6412,6 +6430,117 @@ static void ath12k_mac_op_update_vif_off +@@ -6411,6 +6429,117 @@ static void ath12k_mac_op_update_vif_off ath12k_mac_update_vif_offload(arvif); } @@ -669,7 +669,7 @@ Acked-by: Jeff Johnson static int ath12k_mac_vdev_create(struct ath12k *ar, struct ieee80211_vif *vif) { struct ath12k_hw *ah = ar->ah; -@@ -6526,6 +6655,7 @@ static int ath12k_mac_vdev_create(struct +@@ -6525,6 +6654,7 @@ static int ath12k_mac_vdev_create(struct arvif->vdev_id, ret); goto err_peer_del; } @@ -677,7 +677,7 @@ Acked-by: Jeff Johnson break; case WMI_VDEV_TYPE_STA: param_id = WMI_STA_PS_PARAM_RX_WAKE_POLICY; -@@ -6564,6 +6694,13 @@ static int ath12k_mac_vdev_create(struct +@@ -6563,6 +6693,13 @@ static int ath12k_mac_vdev_create(struct arvif->vdev_id, ret); goto err_peer_del; } @@ -691,7 +691,7 @@ Acked-by: Jeff Johnson break; default: break; -@@ -6904,6 +7041,11 @@ static void ath12k_mac_op_remove_interfa +@@ -6903,6 +7040,11 @@ static void ath12k_mac_op_remove_interfa ath12k_dbg(ab, ATH12K_DBG_MAC, "mac remove interface (vdev %d)\n", arvif->vdev_id); @@ -703,7 +703,7 @@ Acked-by: Jeff Johnson if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { ret = ath12k_peer_delete(ar, arvif->vdev_id, vif->addr); if (ret) -@@ -7744,6 +7886,14 @@ ath12k_mac_op_unassign_vif_chanctx(struc +@@ -7743,6 +7885,14 @@ ath12k_mac_op_unassign_vif_chanctx(struc ar->num_started_vdevs == 1 && ar->monitor_vdev_created) ath12k_mac_monitor_stop(ar); @@ -718,7 +718,7 @@ Acked-by: Jeff Johnson mutex_unlock(&ar->conf_mutex); } -@@ -8282,6 +8432,14 @@ ath12k_mac_op_reconfig_complete(struct i +@@ -8281,6 +8431,14 @@ ath12k_mac_op_reconfig_complete(struct i ath12k_warn(ar->ab, "pdev %d successfully recovered\n", ar->pdev->pdev_id); @@ -733,7 +733,7 @@ Acked-by: Jeff Johnson if (ab->is_reset) { recovery_count = atomic_inc_return(&ab->recovery_count); -@@ -9331,6 +9489,9 @@ static void ath12k_mac_setup(struct ath1 +@@ -9330,6 +9488,9 @@ static void ath12k_mac_setup(struct ath1 INIT_WORK(&ar->wmi_mgmt_tx_work, ath12k_mgmt_over_wmi_tx_work); skb_queue_head_init(&ar->wmi_mgmt_tx_queue); From 3bd2962c3d487227e3435b2cdadda5e917361a3c Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 26 Dec 2024 09:41:22 +0100 Subject: [PATCH 273/877] mac80211: update to version 6.12.6 - drop patches accepted upstream - include build fixes in the tarball - based on https://github.com/nbd168/backports commit 410656ef04d2 Signed-off-by: Felix Fietkau (cherry picked from commit a85059438f2caed0d01a87fce9b8bd5bed134bb2) --- package/kernel/mac80211/Makefile | 4 +- ...add_platform_eeprom_support_to_ath5k.patch | 6 +- ...-and-handle-country-code-for-WCN7850.patch | 56 +-- .../patches/ath5k/432-ath5k_add_pciids.patch | 11 - ...erpret-requested-txpower-in-EIRP-dom.patch | 4 +- ...power-reduction-for-US-regulatory-do.patch | 2 +- ...-in-driver-tables-with-country-codes.patch | 4 +- .../build/070-remove-broken-wext-select.patch | 10 - .../build/120-headers_version_fix.patch | 14 - .../patches/build/140-trace_backport.patch | 18 +- .../210-wireless_netns_local_backport.patch | 44 ++ ...=> 220-brcmfmac_usb_driver_backport.patch} | 0 ...-init_vqs-build-error-on-kernel-6.6.patch} | 0 ...t_allns-build-error-on-kernel-6.6.59.patch | 169 ------- ...700-mwl8k-missing-pci-id-for-WNR854T.patch | 2 +- ...crease-the-global-limit-up-to-4-SSID.patch | 2 +- ...940-mwl8k_init_devices_synchronously.patch | 4 +- ...ringified-name-of-command-in-error-l.patch | 10 +- ...-rtw88-Set-efuse-ext_lna_5g-fix-typo.patch | 30 -- ...upport-USB-3-with-RTL8822CU-RTL8822B.patch | 284 ----------- ...fs-support-multiple-adapters-debuggi.patch | 454 ------------------ ...-wifi-rtw88-select-WANT_DEV_COREDUMP.patch | 25 - ...-Parse-channel-from-IE-to-correct-in.patch | 151 ------ ...nit-RX-burst-length-according-to-USB.patch | 73 --- ...pdate-the-RX-stats-after-every-frame.patch | 31 -- ...ifi-rtw88-usb-Support-RX-aggregation.patch | 118 ----- ...e-USB-RX-aggregation-for-8822c-8822b.patch | 168 ------- ...n-mac_id-for-vif-sta-and-update-to-T.patch | 231 --------- ...-the-RX-descriptor-with-a-single-fun.patch | 2 +- ...Fix-the-RX-aggregation-in-USB-3-mode.patch | 70 --- ...e-data-rate-fallback-for-older-chips.patch | 4 +- ...et-pkt_info.ls-for-the-reserved-page.patch | 2 +- ...w88-usb-Support-USB-3-with-RTL8812AU.patch | 6 +- ...nable-RX-aggregation-for-8821au-8812.patch | 4 +- .../patches/subsys/130-disable_auto_vif.patch | 2 +- .../patches/subsys/220-allow-ibss-mixed.patch | 2 +- ...race-period-for-DFS-available-after-.patch | 6 +- ...dd-AQL-support-for-broadcast-packets.patch | 2 +- ...-not-pass-a-stopped-vif-to-the-drive.patch | 24 - ...1-add-option-for-vif-allowed-radios.patch} | 12 +- ...troduce-EHT-rate-support-in-AQL-airt.patch | 233 --------- ...eck-radio-iface-combination-for-mult.patch | 122 ----- ...-vif-radio-mask-to-limit-ibss-scan-.patch} | 8 +- ...et-correct-chandef-when-starting-CAC.patch | 64 --- ...-vif-radio-mask-to-limit-chanctx-an.patch} | 8 +- ...0211-move-radar-detect-work-to-sdata.patch | 136 ------ ...1-remove-status-ampdu_delimiter_crc.patch} | 0 ...-net_device-to-.set_monitor_channel.patch} | 2 +- ...move-label-usage-in-ieee80211_start_.patch | 50 -- ...-flag-to-opt-out-of-virtual-monitor.patch} | 24 +- ...k-rdev_end_cac-trace-event-from-wiph.patch | 42 -- ...i-cfg80211-add-monitor-SKIP_TX-flag.patch} | 0 ...ve-DFS-related-members-to-links-in-w.patch | 309 ------------ ...37-wifi-cfg80211-handle-DFS-per-link.patch | 435 ----------------- ...-support-for-the-monitor-SKIP_TX-fl.patch} | 2 +- ...38-wifi-mac80211-handle-DFS-per-link.patch | 134 ------ ...80211-refactor-ieee80211_rx_monitor.patch} | 0 ...-mac80211-use-proper-link-ID-for-DFS.patch | 168 ------- ...ter-on-monitor-interfaces-based-on-.patch} | 0 ...report-per-wiphy-radio-antenna-mask.patch} | 0 ...ndle-ieee80211_radar_detected-for-ML.patch | 360 -------------- ...-vif-addr-when-switching-from-monit.patch} | 0 ...ip-non-uploaded-keys-in-ieee80211_it.patch | 79 --- ...x-incorrect-timing-to-initialize-sta.patch | 32 -- ...ee80211_i-Fix-memory-corruption-bug-.patch | 53 -- ...ix-user-power-when-emulating-chanctx.patch | 24 - ...80211-Add-wiphy_delayed_work_pending.patch | 83 ---- ...nvert-color-collision-detection-to-w.patch | 148 ------ 68 files changed, 143 insertions(+), 4434 deletions(-) delete mode 100644 package/kernel/mac80211/patches/ath5k/432-ath5k_add_pciids.patch delete mode 100644 package/kernel/mac80211/patches/build/070-remove-broken-wext-select.patch delete mode 100644 package/kernel/mac80211/patches/build/120-headers_version_fix.patch create mode 100644 package/kernel/mac80211/patches/build/210-wireless_netns_local_backport.patch rename package/kernel/mac80211/patches/build/{230-brcmfmac_usb_driver_backport.patch => 220-brcmfmac_usb_driver_backport.patch} (100%) rename package/kernel/mac80211/patches/build/{235-fix-init_vqs-build-error-on-kernel-6.6.patch => 230-fix-init_vqs-build-error-on-kernel-6.6.patch} (100%) delete mode 100644 package/kernel/mac80211/patches/build/236-fix-genlmsg_multicast_allns-build-error-on-kernel-6.6.59.patch delete mode 100644 package/kernel/mac80211/patches/rtl/001-v6.12-wifi-rtw88-Set-efuse-ext_lna_5g-fix-typo.patch delete mode 100644 package/kernel/mac80211/patches/rtl/002-v6.12-wifi-rtw88-usb-Support-USB-3-with-RTL8822CU-RTL8822B.patch delete mode 100644 package/kernel/mac80211/patches/rtl/004-v6.12-wifi-rtw88-debugfs-support-multiple-adapters-debuggi.patch delete mode 100644 package/kernel/mac80211/patches/rtl/005-v6.12-wifi-rtw88-select-WANT_DEV_COREDUMP.patch delete mode 100644 package/kernel/mac80211/patches/rtl/008-v6.12-wifi-rtw88-8822c-Parse-channel-from-IE-to-correct-in.patch delete mode 100644 package/kernel/mac80211/patches/rtl/010-v6.12-wifi-rtw88-usb-Init-RX-burst-length-according-to-USB.patch delete mode 100644 package/kernel/mac80211/patches/rtl/011-v6.12-wifi-rtw88-usb-Update-the-RX-stats-after-every-frame.patch delete mode 100644 package/kernel/mac80211/patches/rtl/012-v6.12-wifi-rtw88-usb-Support-RX-aggregation.patch delete mode 100644 package/kernel/mac80211/patches/rtl/013-v6.12-wifi-rtw88-Enable-USB-RX-aggregation-for-8822c-8822b.patch delete mode 100644 package/kernel/mac80211/patches/rtl/016-v6.12-wifi-rtw88-assign-mac_id-for-vif-sta-and-update-to-T.patch delete mode 100644 package/kernel/mac80211/patches/rtl/020-v6.12-wifi-rtw88-Fix-the-RX-aggregation-in-USB-3-mode.patch delete mode 100644 package/kernel/mac80211/patches/subsys/321-wifi-mac80211-do-not-pass-a-stopped-vif-to-the-drive.patch rename package/kernel/mac80211/patches/subsys/{350-wifi-cfg80211-add-option-for-vif-allowed-radios.patch => 330-wifi-cfg80211-add-option-for-vif-allowed-radios.patch} (96%) delete mode 100644 package/kernel/mac80211/patches/subsys/330-wifi-mac80211-introduce-EHT-rate-support-in-AQL-airt.patch delete mode 100644 package/kernel/mac80211/patches/subsys/331-wifi-cfg80211-check-radio-iface-combination-for-mult.patch rename package/kernel/mac80211/patches/subsys/{351-wifi-mac80211-use-vif-radio-mask-to-limit-ibss-scan-.patch => 331-wifi-mac80211-use-vif-radio-mask-to-limit-ibss-scan-.patch} (88%) delete mode 100644 package/kernel/mac80211/patches/subsys/332-wifi-cfg80211-Set-correct-chandef-when-starting-CAC.patch rename package/kernel/mac80211/patches/subsys/{352-wifi-mac80211-use-vif-radio-mask-to-limit-chanctx-an.patch => 332-wifi-mac80211-use-vif-radio-mask-to-limit-chanctx-an.patch} (86%) delete mode 100644 package/kernel/mac80211/patches/subsys/333-Revert-wifi-mac80211-move-radar-detect-work-to-sdata.patch rename package/kernel/mac80211/patches/subsys/{353-wifi-mac80211-remove-status-ampdu_delimiter_crc.patch => 333-wifi-mac80211-remove-status-ampdu_delimiter_crc.patch} (100%) rename package/kernel/mac80211/patches/subsys/{354-wifi-cfg80211-pass-net_device-to-.set_monitor_channel.patch => 334-wifi-cfg80211-pass-net_device-to-.set_monitor_channel.patch} (98%) delete mode 100644 package/kernel/mac80211/patches/subsys/334-wifi-mac80211-remove-label-usage-in-ieee80211_start_.patch rename package/kernel/mac80211/patches/subsys/{355-wifi-mac80211-add-flag-to-opt-out-of-virtual-monitor.patch => 335-wifi-mac80211-add-flag-to-opt-out-of-virtual-monitor.patch} (93%) delete mode 100644 package/kernel/mac80211/patches/subsys/335-wifi-trace-unlink-rdev_end_cac-trace-event-from-wiph.patch rename package/kernel/mac80211/patches/subsys/{356-wifi-cfg80211-add-monitor-SKIP_TX-flag.patch => 336-wifi-cfg80211-add-monitor-SKIP_TX-flag.patch} (100%) delete mode 100644 package/kernel/mac80211/patches/subsys/336-wifi-cfg80211-move-DFS-related-members-to-links-in-w.patch delete mode 100644 package/kernel/mac80211/patches/subsys/337-wifi-cfg80211-handle-DFS-per-link.patch rename package/kernel/mac80211/patches/subsys/{357-wifi-mac80211-add-support-for-the-monitor-SKIP_TX-fl.patch => 337-wifi-mac80211-add-support-for-the-monitor-SKIP_TX-fl.patch} (97%) delete mode 100644 package/kernel/mac80211/patches/subsys/338-wifi-mac80211-handle-DFS-per-link.patch rename package/kernel/mac80211/patches/subsys/{358-wifi-mac80211-refactor-ieee80211_rx_monitor.patch => 338-wifi-mac80211-refactor-ieee80211_rx_monitor.patch} (100%) delete mode 100644 package/kernel/mac80211/patches/subsys/339-wifi-cfg80211-mac80211-use-proper-link-ID-for-DFS.patch rename package/kernel/mac80211/patches/subsys/{359-wifi-mac80211-filter-on-monitor-interfaces-based-on-.patch => 339-wifi-mac80211-filter-on-monitor-interfaces-based-on-.patch} (100%) rename package/kernel/mac80211/patches/subsys/{360-wifi-cfg80211-report-per-wiphy-radio-antenna-mask.patch => 340-wifi-cfg80211-report-per-wiphy-radio-antenna-mask.patch} (100%) delete mode 100644 package/kernel/mac80211/patches/subsys/340-wifi-mac80211-handle-ieee80211_radar_detected-for-ML.patch rename package/kernel/mac80211/patches/subsys/{361-wifi-mac80211-fix-vif-addr-when-switching-from-monit.patch => 341-wifi-mac80211-fix-vif-addr-when-switching-from-monit.patch} (100%) delete mode 100644 package/kernel/mac80211/patches/subsys/341-wifi-mac80211-skip-non-uploaded-keys-in-ieee80211_it.patch delete mode 100644 package/kernel/mac80211/patches/subsys/362-wifi-mac80211-fix-incorrect-timing-to-initialize-sta.patch delete mode 100644 package/kernel/mac80211/patches/subsys/363-wifi-mac80211-ieee80211_i-Fix-memory-corruption-bug-.patch delete mode 100644 package/kernel/mac80211/patches/subsys/364-mac80211-fix-user-power-when-emulating-chanctx.patch delete mode 100644 package/kernel/mac80211/patches/subsys/365-wifi-cfg80211-Add-wiphy_delayed_work_pending.patch delete mode 100644 package/kernel/mac80211/patches/subsys/366-wifi-mac80211-Convert-color-collision-detection-to-w.patch diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index 22cd0e97b41770..f924d3468476a3 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -10,13 +10,13 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 -PKG_VERSION:=6.11.2 +PKG_VERSION:=6.12.6 PKG_RELEASE:=1 PKG_LICENSE:=GPL-2.0-only PKG_LICENSE_FILES:=COPYING PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources/ -PKG_HASH:=700ea5abef8dde9e3c6df2acd32ff443da735d773d56db9a80269e2237549b34 +PKG_HASH:=28ec39425a1b3270e1422d92a8131a6a3d8919cc13e8ee250c315e55d922ba68 PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(if $(BUILD_VARIANT),$(PKG_NAME)-$(BUILD_VARIANT)/)backports-$(PKG_VERSION) diff --git a/package/kernel/mac80211/patches/ath/431-add_platform_eeprom_support_to_ath5k.patch b/package/kernel/mac80211/patches/ath/431-add_platform_eeprom_support_to_ath5k.patch index c762aa6d643fc6..abadadf856c731 100644 --- a/package/kernel/mac80211/patches/ath/431-add_platform_eeprom_support_to_ath5k.patch +++ b/package/kernel/mac80211/patches/ath/431-add_platform_eeprom_support_to_ath5k.patch @@ -8,7 +8,7 @@ #include "../ath.h" #include "ath5k.h" #include "debug.h" -@@ -71,7 +72,7 @@ static void ath5k_pci_read_cachesize(str +@@ -73,7 +74,7 @@ static void ath5k_pci_read_cachesize(str } /* @@ -17,7 +17,7 @@ */ static bool ath5k_pci_eeprom_read(struct ath_common *common, u32 offset, u16 *data) -@@ -79,6 +80,19 @@ ath5k_pci_eeprom_read(struct ath_common +@@ -81,6 +82,19 @@ ath5k_pci_eeprom_read(struct ath_common struct ath5k_hw *ah = common->ah; u32 status, timeout; @@ -37,7 +37,7 @@ /* * Initialize EEPROM access */ -@@ -122,6 +136,16 @@ static int ath5k_pci_eeprom_read_mac(str +@@ -124,6 +138,16 @@ static int ath5k_pci_eeprom_read_mac(str u16 data; int octet; diff --git a/package/kernel/mac80211/patches/ath12k/001-wifi-ath12k-add-11d-scan-offload-support-and-handle-country-code-for-WCN7850.patch b/package/kernel/mac80211/patches/ath12k/001-wifi-ath12k-add-11d-scan-offload-support-and-handle-country-code-for-WCN7850.patch index f368ccd2727fad..caa4e20f971a0c 100644 --- a/package/kernel/mac80211/patches/ath12k/001-wifi-ath12k-add-11d-scan-offload-support-and-handle-country-code-for-WCN7850.patch +++ b/package/kernel/mac80211/patches/ath12k/001-wifi-ath12k-add-11d-scan-offload-support-and-handle-country-code-for-WCN7850.patch @@ -451,7 +451,7 @@ Acked-by: Jeff Johnson enum ath12k_dev_flags { ATH12K_CAC_RUNNING, ATH12K_FLAG_CRASH_FLUSH, -@@ -313,6 +319,8 @@ struct ath12k_vif_iter { +@@ -319,6 +325,8 @@ struct ath12k_vif_iter { #define ATH12K_RX_RATE_TABLE_11AX_NUM 576 #define ATH12K_RX_RATE_TABLE_NUM 320 @@ -460,7 +460,7 @@ Acked-by: Jeff Johnson struct ath12k_rx_peer_rate_stats { u64 ht_mcs_count[HAL_RX_MAX_MCS_HT + 1]; u64 vht_mcs_count[HAL_RX_MAX_MCS_VHT + 1]; -@@ -648,6 +656,13 @@ struct ath12k { +@@ -654,6 +662,13 @@ struct ath12k { u32 freq_low; u32 freq_high; @@ -474,7 +474,7 @@ Acked-by: Jeff Johnson bool nlo_enabled; }; -@@ -880,6 +895,8 @@ struct ath12k_base { +@@ -886,6 +901,8 @@ struct ath12k_base { /* continuous recovery fail count */ atomic_t fail_cont_count; unsigned long reset_fail_timeout; @@ -485,7 +485,7 @@ Acked-by: Jeff Johnson u32 fw_crash_counter; --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c -@@ -2946,6 +2946,11 @@ static void ath12k_bss_assoc(struct ath1 +@@ -2949,6 +2949,11 @@ static void ath12k_bss_assoc(struct ath1 if (ret) ath12k_warn(ar->ab, "failed to set vdev %i OBSS PD parameters: %d\n", arvif->vdev_id, ret); @@ -497,7 +497,7 @@ Acked-by: Jeff Johnson } static void ath12k_bss_disassoc(struct ath12k *ar, -@@ -3521,7 +3526,7 @@ void __ath12k_mac_scan_finish(struct ath +@@ -3524,7 +3529,7 @@ void __ath12k_mac_scan_finish(struct ath ar->scan_channel = NULL; ar->scan.roc_freq = 0; cancel_delayed_work(&ar->scan.timeout); @@ -506,9 +506,9 @@ Acked-by: Jeff Johnson break; } } -@@ -3782,7 +3787,12 @@ scan: +@@ -3790,7 +3795,12 @@ scan: - ret = ath12k_start_scan(ar, &arg); + ret = ath12k_start_scan(ar, arg); if (ret) { - ath12k_warn(ar->ab, "failed to start hw scan: %d\n", ret); + if (ret == -EBUSY) @@ -520,7 +520,7 @@ Acked-by: Jeff Johnson spin_lock_bh(&ar->data_lock); ar->scan.state = ATH12K_SCAN_IDLE; spin_unlock_bh(&ar->data_lock); -@@ -3801,6 +3811,11 @@ exit: +@@ -3810,6 +3820,11 @@ exit: mutex_unlock(&ar->conf_mutex); @@ -532,7 +532,7 @@ Acked-by: Jeff Johnson return ret; } -@@ -5985,7 +6000,7 @@ static int ath12k_mac_start(struct ath12 +@@ -5994,7 +6009,7 @@ static int ath12k_mac_start(struct ath12 /* TODO: Do we need to enable ANI? */ @@ -541,7 +541,7 @@ Acked-by: Jeff Johnson ar->num_started_vdevs = 0; ar->num_created_vdevs = 0; -@@ -6165,6 +6180,9 @@ static void ath12k_mac_stop(struct ath12 +@@ -6174,6 +6189,9 @@ static void ath12k_mac_stop(struct ath12 cancel_delayed_work_sync(&ar->scan.timeout); cancel_work_sync(&ar->regd_update_work); cancel_work_sync(&ar->ab->rfkill_work); @@ -551,7 +551,7 @@ Acked-by: Jeff Johnson spin_lock_bh(&ar->data_lock); list_for_each_entry_safe(ppdu_stats, tmp, &ar->ppdu_stats_info, list) { -@@ -6411,6 +6429,117 @@ static void ath12k_mac_op_update_vif_off +@@ -6420,6 +6438,117 @@ static void ath12k_mac_op_update_vif_off ath12k_mac_update_vif_offload(arvif); } @@ -669,7 +669,7 @@ Acked-by: Jeff Johnson static int ath12k_mac_vdev_create(struct ath12k *ar, struct ieee80211_vif *vif) { struct ath12k_hw *ah = ar->ah; -@@ -6525,6 +6654,7 @@ static int ath12k_mac_vdev_create(struct +@@ -6534,6 +6663,7 @@ static int ath12k_mac_vdev_create(struct arvif->vdev_id, ret); goto err_peer_del; } @@ -677,7 +677,7 @@ Acked-by: Jeff Johnson break; case WMI_VDEV_TYPE_STA: param_id = WMI_STA_PS_PARAM_RX_WAKE_POLICY; -@@ -6563,6 +6693,13 @@ static int ath12k_mac_vdev_create(struct +@@ -6572,6 +6702,13 @@ static int ath12k_mac_vdev_create(struct arvif->vdev_id, ret); goto err_peer_del; } @@ -691,7 +691,7 @@ Acked-by: Jeff Johnson break; default: break; -@@ -6903,6 +7040,11 @@ static void ath12k_mac_op_remove_interfa +@@ -6912,6 +7049,11 @@ static void ath12k_mac_op_remove_interfa ath12k_dbg(ab, ATH12K_DBG_MAC, "mac remove interface (vdev %d)\n", arvif->vdev_id); @@ -703,7 +703,7 @@ Acked-by: Jeff Johnson if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { ret = ath12k_peer_delete(ar, arvif->vdev_id, vif->addr); if (ret) -@@ -7743,6 +7885,14 @@ ath12k_mac_op_unassign_vif_chanctx(struc +@@ -7752,6 +7894,14 @@ ath12k_mac_op_unassign_vif_chanctx(struc ar->num_started_vdevs == 1 && ar->monitor_vdev_created) ath12k_mac_monitor_stop(ar); @@ -718,7 +718,7 @@ Acked-by: Jeff Johnson mutex_unlock(&ar->conf_mutex); } -@@ -8281,6 +8431,14 @@ ath12k_mac_op_reconfig_complete(struct i +@@ -8290,6 +8440,14 @@ ath12k_mac_op_reconfig_complete(struct i ath12k_warn(ar->ab, "pdev %d successfully recovered\n", ar->pdev->pdev_id); @@ -733,7 +733,7 @@ Acked-by: Jeff Johnson if (ab->is_reset) { recovery_count = atomic_inc_return(&ab->recovery_count); -@@ -9330,6 +9488,9 @@ static void ath12k_mac_setup(struct ath1 +@@ -9339,6 +9497,9 @@ static void ath12k_mac_setup(struct ath1 INIT_WORK(&ar->wmi_mgmt_tx_work, ath12k_mgmt_over_wmi_tx_work); skb_queue_head_init(&ar->wmi_mgmt_tx_queue); @@ -888,36 +888,36 @@ Acked-by: Jeff Johnson #endif --- a/drivers/net/wireless/ath/ath12k/hw.c +++ b/drivers/net/wireless/ath/ath12k/hw.c -@@ -926,6 +926,7 @@ static const struct ath12k_hw_params ath - .supports_dynamic_smps_6ghz = true, - +@@ -928,6 +928,7 @@ static const struct ath12k_hw_params ath .iova_mask = 0, + + .supports_aspm = false, + .current_cc_support = false, }, { .name = "wcn7850 hw2.0", -@@ -1004,6 +1005,7 @@ static const struct ath12k_hw_params ath - .supports_dynamic_smps_6ghz = false, - +@@ -1008,6 +1009,7 @@ static const struct ath12k_hw_params ath .iova_mask = ATH12K_PCIE_MAX_PAYLOAD_SIZE - 1, + + .supports_aspm = true, + .current_cc_support = true, }, { .name = "qcn9274 hw2.0", -@@ -1078,6 +1080,7 @@ static const struct ath12k_hw_params ath - .supports_dynamic_smps_6ghz = true, - +@@ -1084,6 +1086,7 @@ static const struct ath12k_hw_params ath .iova_mask = 0, + + .supports_aspm = false, + .current_cc_support = false, }, }; --- a/drivers/net/wireless/ath/ath12k/hw.h +++ b/drivers/net/wireless/ath/ath12k/hw.h -@@ -189,6 +189,7 @@ struct ath12k_hw_params { - bool tcl_ring_retry:1; +@@ -190,6 +190,7 @@ struct ath12k_hw_params { bool reoq_lut_support:1; bool supports_shadow_regs:1; + bool supports_aspm:1; + bool current_cc_support:1; u32 num_tcl_banks; diff --git a/package/kernel/mac80211/patches/ath5k/432-ath5k_add_pciids.patch b/package/kernel/mac80211/patches/ath5k/432-ath5k_add_pciids.patch deleted file mode 100644 index bd0e6707a5513b..00000000000000 --- a/package/kernel/mac80211/patches/ath5k/432-ath5k_add_pciids.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/drivers/net/wireless/ath/ath5k/pci.c -+++ b/drivers/net/wireless/ath/ath5k/pci.c -@@ -47,6 +47,8 @@ static const struct pci_device_id ath5k_ - { PCI_VDEVICE(ATHEROS, 0x001b) }, /* 5413 Eagle */ - { PCI_VDEVICE(ATHEROS, 0x001c) }, /* PCI-E cards */ - { PCI_VDEVICE(ATHEROS, 0x001d) }, /* 2417 Nala */ -+ { PCI_VDEVICE(ATHEROS, 0xff16) }, /* 2413,2414 sx76x on lantiq_danube */ -+ { PCI_VDEVICE(ATHEROS, 0xff1a) }, /* 2417 arv45xx on lantiq_danube */ - { PCI_VDEVICE(ATHEROS, 0xff1b) }, /* AR5BXB63 */ - { 0 } - }; diff --git a/package/kernel/mac80211/patches/ath9k/356-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch b/package/kernel/mac80211/patches/ath9k/356-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch index 385eea0116df2f..9016da963b35f1 100644 --- a/package/kernel/mac80211/patches/ath9k/356-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch +++ b/package/kernel/mac80211/patches/ath9k/356-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch @@ -8,7 +8,7 @@ This reverts commit 71f5137bf010c6faffab50c0ec15374c59c4a411. --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -2977,7 +2977,8 @@ void ath9k_hw_apply_txpower(struct ath_h +@@ -2975,7 +2975,8 @@ void ath9k_hw_apply_txpower(struct ath_h { struct ath_regulatory *reg = ath9k_hw_regulatory(ah); struct ieee80211_channel *channel; @@ -18,7 +18,7 @@ This reverts commit 71f5137bf010c6faffab50c0ec15374c59c4a411. u16 ctl = NO_CTL; if (!chan) -@@ -2989,9 +2990,14 @@ void ath9k_hw_apply_txpower(struct ath_h +@@ -2987,9 +2988,14 @@ void ath9k_hw_apply_txpower(struct ath_h channel = chan->chan; chan_pwr = min_t(int, channel->max_power * 2, MAX_COMBINED_POWER); new_pwr = min_t(int, chan_pwr, reg->power_limit); diff --git a/package/kernel/mac80211/patches/ath9k/365-ath9k-adjust-tx-power-reduction-for-US-regulatory-do.patch b/package/kernel/mac80211/patches/ath9k/365-ath9k-adjust-tx-power-reduction-for-US-regulatory-do.patch index 0c3edc1260ff90..5e5f3e4f10242e 100644 --- a/package/kernel/mac80211/patches/ath9k/365-ath9k-adjust-tx-power-reduction-for-US-regulatory-do.patch +++ b/package/kernel/mac80211/patches/ath9k/365-ath9k-adjust-tx-power-reduction-for-US-regulatory-do.patch @@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -2996,6 +2996,10 @@ void ath9k_hw_apply_txpower(struct ath_h +@@ -2994,6 +2994,10 @@ void ath9k_hw_apply_txpower(struct ath_h if (ant_gain > max_gain) ant_reduction = ant_gain - max_gain; diff --git a/package/kernel/mac80211/patches/brcm/863-brcmfmac-add-in-driver-tables-with-country-codes.patch b/package/kernel/mac80211/patches/brcm/863-brcmfmac-add-in-driver-tables-with-country-codes.patch index 25f0d254c0da64..1f0609e3488887 100644 --- a/package/kernel/mac80211/patches/brcm/863-brcmfmac-add-in-driver-tables-with-country-codes.patch +++ b/package/kernel/mac80211/patches/brcm/863-brcmfmac-add-in-driver-tables-with-country-codes.patch @@ -49,9 +49,9 @@ Signed-off-by: Rafał Miłecki void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, struct brcmf_mp_device *settings) { -@@ -114,6 +144,8 @@ void brcmf_of_probe(struct device *dev, - of_node_put(root); +@@ -113,6 +143,8 @@ void brcmf_of_probe(struct device *dev, } + of_node_put(root); + brcmf_of_probe_cc(dev, settings); + diff --git a/package/kernel/mac80211/patches/build/070-remove-broken-wext-select.patch b/package/kernel/mac80211/patches/build/070-remove-broken-wext-select.patch deleted file mode 100644 index 121b7faad93795..00000000000000 --- a/package/kernel/mac80211/patches/build/070-remove-broken-wext-select.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/drivers/staging/rtl8723bs/Kconfig -+++ b/drivers/staging/rtl8723bs/Kconfig -@@ -5,7 +5,6 @@ config RTL8723BS - depends on m - depends on WLAN && MMC && CFG80211 - depends on m -- select CFG80211_WEXT - depends on CRYPTO - select BPAUTO_CRYPTO_LIB_ARC4 - help diff --git a/package/kernel/mac80211/patches/build/120-headers_version_fix.patch b/package/kernel/mac80211/patches/build/120-headers_version_fix.patch deleted file mode 100644 index 29f500a4d069b4..00000000000000 --- a/package/kernel/mac80211/patches/build/120-headers_version_fix.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/backport-include/net/dropreason.h -+++ b/backport-include/net/dropreason.h -@@ -3,10 +3,9 @@ - - #include - -+#include - #if LINUX_VERSION_IS_GEQ(6,0,0) - #include_next --#else --#include - #endif - - #if LINUX_VERSION_IS_LESS(6,4,0) diff --git a/package/kernel/mac80211/patches/build/140-trace_backport.patch b/package/kernel/mac80211/patches/build/140-trace_backport.patch index 00ee47e1a46392..8b77b7e83d9f0b 100644 --- a/package/kernel/mac80211/patches/build/140-trace_backport.patch +++ b/package/kernel/mac80211/patches/build/140-trace_backport.patch @@ -1,6 +1,6 @@ --- a/drivers/bus/mhi/host/trace.h +++ b/drivers/bus/mhi/host/trace.h -@@ -103,7 +103,7 @@ TRACE_EVENT(mhi_gen_tre, +@@ -104,7 +104,7 @@ TRACE_EVENT(mhi_gen_tre, ), TP_fast_assign( @@ -8,8 +8,8 @@ + __assign_str(name, mhi_cntrl->mhi_dev->name); __entry->ch_num = mhi_chan->chan; __entry->wp = mhi_tre; - __entry->tre_ptr = mhi_tre->ptr; -@@ -131,7 +131,7 @@ TRACE_EVENT(mhi_intvec_states, + __entry->tre_ptr = le64_to_cpu(mhi_tre->ptr); +@@ -132,7 +132,7 @@ TRACE_EVENT(mhi_intvec_states, ), TP_fast_assign( @@ -18,7 +18,7 @@ __entry->local_ee = mhi_cntrl->ee; __entry->state = mhi_cntrl->dev_state; __entry->dev_ee = dev_ee; -@@ -158,7 +158,7 @@ TRACE_EVENT(mhi_tryset_pm_state, +@@ -159,7 +159,7 @@ TRACE_EVENT(mhi_tryset_pm_state, ), TP_fast_assign( @@ -27,16 +27,16 @@ if (pm_state) pm_state = __fls(pm_state); __entry->pm_state = pm_state; -@@ -184,7 +184,7 @@ DECLARE_EVENT_CLASS(mhi_process_event_ri +@@ -185,7 +185,7 @@ DECLARE_EVENT_CLASS(mhi_process_event_ri ), TP_fast_assign( - __assign_str(name); + __assign_str(name, mhi_cntrl->mhi_dev->name); __entry->rp = rp; - __entry->ptr = rp->ptr; - __entry->dword0 = rp->dword[0]; -@@ -226,7 +226,7 @@ DECLARE_EVENT_CLASS(mhi_update_channel_s + __entry->ptr = le64_to_cpu(rp->ptr); + __entry->dword0 = le32_to_cpu(rp->dword[0]); +@@ -227,7 +227,7 @@ DECLARE_EVENT_CLASS(mhi_update_channel_s ), TP_fast_assign( @@ -45,7 +45,7 @@ __entry->ch_num = mhi_chan->chan; __entry->state = state; __entry->reason = reason; -@@ -265,7 +265,7 @@ TRACE_EVENT(mhi_pm_st_transition, +@@ -266,7 +266,7 @@ TRACE_EVENT(mhi_pm_st_transition, ), TP_fast_assign( diff --git a/package/kernel/mac80211/patches/build/210-wireless_netns_local_backport.patch b/package/kernel/mac80211/patches/build/210-wireless_netns_local_backport.patch new file mode 100644 index 00000000000000..9b0e95e8453c0a --- /dev/null +++ b/package/kernel/mac80211/patches/build/210-wireless_netns_local_backport.patch @@ -0,0 +1,44 @@ +--- a/net/wireless/core.c ++++ b/net/wireless/core.c +@@ -165,11 +165,15 @@ int cfg80211_switch_netns(struct cfg8021 + list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) { + if (!wdev->netdev) + continue; ++#if LINUX_VERSION_IS_GEQ(6,12,0) + wdev->netdev->netns_local = false; ++#endif + err = dev_change_net_namespace(wdev->netdev, net, "wlan%d"); + if (err) + break; ++#if LINUX_VERSION_IS_GEQ(6,12,0) + wdev->netdev->netns_local = true; ++#endif + } + + if (err) { +@@ -181,11 +185,15 @@ int cfg80211_switch_netns(struct cfg8021 + list) { + if (!wdev->netdev) + continue; ++#if LINUX_VERSION_IS_GEQ(6,12,0) + wdev->netdev->netns_local = false; ++#endif + err = dev_change_net_namespace(wdev->netdev, net, + "wlan%d"); + WARN_ON(err); ++#if LINUX_VERSION_IS_GEQ(6,12,0) + wdev->netdev->netns_local = true; ++#endif + } + + return err; +@@ -1518,7 +1526,9 @@ static int cfg80211_netdev_notifier_call + SET_NETDEV_DEVTYPE(dev, &wiphy_type); + wdev->netdev = dev; + /* can only change netns with wiphy */ ++#if LINUX_VERSION_IS_GEQ(6,12,0) + dev->netns_local = true; ++#endif + + cfg80211_init_wdev(wdev); + break; diff --git a/package/kernel/mac80211/patches/build/230-brcmfmac_usb_driver_backport.patch b/package/kernel/mac80211/patches/build/220-brcmfmac_usb_driver_backport.patch similarity index 100% rename from package/kernel/mac80211/patches/build/230-brcmfmac_usb_driver_backport.patch rename to package/kernel/mac80211/patches/build/220-brcmfmac_usb_driver_backport.patch diff --git a/package/kernel/mac80211/patches/build/235-fix-init_vqs-build-error-on-kernel-6.6.patch b/package/kernel/mac80211/patches/build/230-fix-init_vqs-build-error-on-kernel-6.6.patch similarity index 100% rename from package/kernel/mac80211/patches/build/235-fix-init_vqs-build-error-on-kernel-6.6.patch rename to package/kernel/mac80211/patches/build/230-fix-init_vqs-build-error-on-kernel-6.6.patch diff --git a/package/kernel/mac80211/patches/build/236-fix-genlmsg_multicast_allns-build-error-on-kernel-6.6.59.patch b/package/kernel/mac80211/patches/build/236-fix-genlmsg_multicast_allns-build-error-on-kernel-6.6.59.patch deleted file mode 100644 index 905bf8dfc17634..00000000000000 --- a/package/kernel/mac80211/patches/build/236-fix-genlmsg_multicast_allns-build-error-on-kernel-6.6.59.patch +++ /dev/null @@ -1,169 +0,0 @@ -From e0f83d268974dab0361d11904dfc9acec53f96a6 Mon Sep 17 00:00:00 2001 -From: Eric Dumazet -Date: Fri, 11 Oct 2024 17:12:17 +0000 -Subject: [PATCH] genetlink: hold RCU in genlmsg_mcast() - -[ Upstream commit 56440d7ec28d60f8da3bfa09062b3368ff9b16db ] - -While running net selftests with CONFIG_PROVE_RCU_LIST=y I saw -one lockdep splat [1]. - -genlmsg_mcast() uses for_each_net_rcu(), and must therefore hold RCU. - -Instead of letting all callers guard genlmsg_multicast_allns() -with a rcu_read_lock()/rcu_read_unlock() pair, do it in genlmsg_mcast(). - -This also means the @flags parameter is useless, we need to always use -GFP_ATOMIC. - -[1] -[10882.424136] ============================= -[10882.424166] WARNING: suspicious RCU usage -[10882.424309] 6.12.0-rc2-virtme #1156 Not tainted -[10882.424400] ----------------------------- -[10882.424423] net/netlink/genetlink.c:1940 RCU-list traversed in non-reader section!! -[10882.424469] -other info that might help us debug this: - -[10882.424500] -rcu_scheduler_active = 2, debug_locks = 1 -[10882.424744] 2 locks held by ip/15677: -[10882.424791] #0: ffffffffb6b491b0 (cb_lock){++++}-{3:3}, at: genl_rcv (net/netlink/genetlink.c:1219) -[10882.426334] #1: ffffffffb6b49248 (genl_mutex){+.+.}-{3:3}, at: genl_rcv_msg (net/netlink/genetlink.c:61 net/netlink/genetlink.c:57 net/netlink/genetlink.c:1209) -[10882.426465] -stack backtrace: -[10882.426805] CPU: 14 UID: 0 PID: 15677 Comm: ip Not tainted 6.12.0-rc2-virtme #1156 -[10882.426919] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 -[10882.427046] Call Trace: -[10882.427131] -[10882.427244] dump_stack_lvl (lib/dump_stack.c:123) -[10882.427335] lockdep_rcu_suspicious (kernel/locking/lockdep.c:6822) -[10882.427387] genlmsg_multicast_allns (net/netlink/genetlink.c:1940 (discriminator 7) net/netlink/genetlink.c:1977 (discriminator 7)) -[10882.427436] l2tp_tunnel_notify.constprop.0 (net/l2tp/l2tp_netlink.c:119) l2tp_netlink -[10882.427683] l2tp_nl_cmd_tunnel_create (net/l2tp/l2tp_netlink.c:253) l2tp_netlink -[10882.427748] genl_family_rcv_msg_doit (net/netlink/genetlink.c:1115) -[10882.427834] genl_rcv_msg (net/netlink/genetlink.c:1195 net/netlink/genetlink.c:1210) -[10882.427877] ? __pfx_l2tp_nl_cmd_tunnel_create (net/l2tp/l2tp_netlink.c:186) l2tp_netlink -[10882.427927] ? __pfx_genl_rcv_msg (net/netlink/genetlink.c:1201) -[10882.427959] netlink_rcv_skb (net/netlink/af_netlink.c:2551) -[10882.428069] genl_rcv (net/netlink/genetlink.c:1220) -[10882.428095] netlink_unicast (net/netlink/af_netlink.c:1332 net/netlink/af_netlink.c:1357) -[10882.428140] netlink_sendmsg (net/netlink/af_netlink.c:1901) -[10882.428210] ____sys_sendmsg (net/socket.c:729 (discriminator 1) net/socket.c:744 (discriminator 1) net/socket.c:2607 (discriminator 1)) - -Fixes: 33f72e6f0c67 ("l2tp : multicast notification to the registered listeners") -Signed-off-by: Eric Dumazet -Cc: James Chapman -Cc: Tom Parkin -Cc: Johannes Berg -Link: https://patch.msgid.link/20241011171217.3166614-1-edumazet@google.com -Signed-off-by: Jakub Kicinski -Signed-off-by: Sasha Levin ---- - drivers/target/target_core_user.c | 2 +- - include/net/genetlink.h | 3 +-- - net/l2tp/l2tp_netlink.c | 4 ++-- - net/netlink/genetlink.c | 28 ++++++++++++++-------------- - net/wireless/nl80211.c | 8 ++------ - 5 files changed, 20 insertions(+), 25 deletions(-) - ---- a/backport-include/net/genetlink.h -+++ b/backport-include/net/genetlink.h -@@ -150,7 +150,7 @@ int genlmsg_multicast(const struct genl_ - #define genlmsg_multicast_allns LINUX_BACKPORT(genlmsg_multicast_allns) - int backport_genlmsg_multicast_allns(const struct genl_family *family, - struct sk_buff *skb, u32 portid, -- unsigned int group, gfp_t flags); -+ unsigned int group); - - #define genl_family_attrbuf LINUX_BACKPORT(genl_family_attrbuf) - static inline struct nlattr **genl_family_attrbuf(struct genl_family *family) ---- a/compat/backport-genetlink.c -+++ b/compat/backport-genetlink.c -@@ -198,23 +198,23 @@ int genlmsg_multicast(const struct genl_ - } - EXPORT_SYMBOL_GPL(genlmsg_multicast); - --static int genlmsg_mcast(struct sk_buff *skb, u32 portid, unsigned long group, -- gfp_t flags) -+static int genlmsg_mcast(struct sk_buff *skb, u32 portid, unsigned long group) - { - struct sk_buff *tmp; - struct net *net, *prev = NULL; - bool delivered = false; - int err; - -+ rcu_read_lock(); - for_each_net_rcu(net) { - if (prev) { -- tmp = skb_clone(skb, flags); -+ tmp = skb_clone(skb, GFP_ATOMIC); - if (!tmp) { - err = -ENOMEM; - goto error; - } - err = nlmsg_multicast(prev->genl_sock, tmp, -- portid, group, flags); -+ portid, group, GFP_ATOMIC); - if (!err) - delivered = true; - else if (err != -ESRCH) -@@ -223,25 +223,29 @@ static int genlmsg_mcast(struct sk_buff - - prev = net; - } -+ err = nlmsg_multicast(prev->genl_sock, skb, portid, group, GFP_ATOMIC); -+ -+ rcu_read_unlock(); - -- err = nlmsg_multicast(prev->genl_sock, skb, portid, group, flags); - if (!err) - delivered = true; - else if (err != -ESRCH) - return err; - return delivered ? 0 : -ESRCH; - error: -+ rcu_read_unlock(); -+ - kfree_skb(skb); - return err; - } - - int backport_genlmsg_multicast_allns(const struct genl_family *family, - struct sk_buff *skb, u32 portid, -- unsigned int group, gfp_t flags) -+ unsigned int group) - { - group = __backport_genl_group(family, group); - if (group == INVALID_GROUP) - return -EINVAL; -- return genlmsg_mcast(skb, portid, group, flags); -+ return genlmsg_mcast(skb, portid, group); - } - EXPORT_SYMBOL_GPL(backport_genlmsg_multicast_allns); ---- a/net/wireless/nl80211.c -+++ b/net/wireless/nl80211.c -@@ -17956,10 +17956,8 @@ void nl80211_common_reg_change_event(enu - - genlmsg_end(msg, hdr); - -- rcu_read_lock(); - genlmsg_multicast_allns(&nl80211_fam, msg, 0, -- NL80211_MCGRP_REGULATORY, GFP_ATOMIC); -- rcu_read_unlock(); -+ NL80211_MCGRP_REGULATORY); - - return; - -@@ -18692,10 +18690,8 @@ void nl80211_send_beacon_hint_event(stru - - genlmsg_end(msg, hdr); - -- rcu_read_lock(); - genlmsg_multicast_allns(&nl80211_fam, msg, 0, -- NL80211_MCGRP_REGULATORY, GFP_ATOMIC); -- rcu_read_unlock(); -+ NL80211_MCGRP_REGULATORY); - - return; - diff --git a/package/kernel/mac80211/patches/mwl/700-mwl8k-missing-pci-id-for-WNR854T.patch b/package/kernel/mac80211/patches/mwl/700-mwl8k-missing-pci-id-for-WNR854T.patch index c3324f4289f8af..cfb7dcf7386bf5 100644 --- a/package/kernel/mac80211/patches/mwl/700-mwl8k-missing-pci-id-for-WNR854T.patch +++ b/package/kernel/mac80211/patches/mwl/700-mwl8k-missing-pci-id-for-WNR854T.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/marvell/mwl8k.c +++ b/drivers/net/wireless/marvell/mwl8k.c -@@ -5709,6 +5709,7 @@ MODULE_FIRMWARE("mwl8k/fmimage_8366.fw") +@@ -5712,6 +5712,7 @@ MODULE_FIRMWARE("mwl8k/fmimage_8366.fw") MODULE_FIRMWARE(MWL8K_8366_AP_FW(MWL8K_8366_AP_FW_API)); static const struct pci_device_id mwl8k_pci_id_table[] = { diff --git a/package/kernel/mac80211/patches/mwl/900-mwifiex-increase-the-global-limit-up-to-4-SSID.patch b/package/kernel/mac80211/patches/mwl/900-mwifiex-increase-the-global-limit-up-to-4-SSID.patch index caa139a2c6eae9..484b37bfcc53d5 100644 --- a/package/kernel/mac80211/patches/mwl/900-mwifiex-increase-the-global-limit-up-to-4-SSID.patch +++ b/package/kernel/mac80211/patches/mwl/900-mwifiex-increase-the-global-limit-up-to-4-SSID.patch @@ -30,7 +30,7 @@ the card-specific structure. #define MWIFIEX_DMA_ALIGN_SZ 64 #define MWIFIEX_RX_HEADROOM 64 -@@ -100,7 +100,7 @@ +@@ -123,7 +123,7 @@ #define MWIFIEX_RATE_INDEX_OFDM0 4 #define MWIFIEX_MAX_STA_NUM 3 diff --git a/package/kernel/mac80211/patches/mwl/940-mwl8k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/mwl/940-mwl8k_init_devices_synchronously.patch index 062b0600d0c8d4..d09cfac448ccfd 100644 --- a/package/kernel/mac80211/patches/mwl/940-mwl8k_init_devices_synchronously.patch +++ b/package/kernel/mac80211/patches/mwl/940-mwl8k_init_devices_synchronously.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/marvell/mwl8k.c +++ b/drivers/net/wireless/marvell/mwl8k.c -@@ -6295,6 +6295,8 @@ static int mwl8k_probe(struct pci_dev *p +@@ -6298,6 +6298,8 @@ static int mwl8k_probe(struct pci_dev *p priv->running_bsses = 0; @@ -9,7 +9,7 @@ return rc; err_stop_firmware: -@@ -6328,8 +6330,6 @@ static void mwl8k_remove(struct pci_dev +@@ -6331,8 +6333,6 @@ static void mwl8k_remove(struct pci_dev return; priv = hw->priv; diff --git a/package/kernel/mac80211/patches/mwl/950-mwifiex-Print-stringified-name-of-command-in-error-l.patch b/package/kernel/mac80211/patches/mwl/950-mwifiex-Print-stringified-name-of-command-in-error-l.patch index a7ecabde8296a6..93a213265c641c 100644 --- a/package/kernel/mac80211/patches/mwl/950-mwifiex-Print-stringified-name-of-command-in-error-l.patch +++ b/package/kernel/mac80211/patches/mwl/950-mwifiex-Print-stringified-name-of-command-in-error-l.patch @@ -116,7 +116,7 @@ Signed-off-by: Pali Rohár mwifiex_recycle_cmd_node(adapter, cmd_node); queue_work(adapter->workqueue, &adapter->main_work); return -1; -@@ -653,8 +732,8 @@ int mwifiex_send_cmd(struct mwifiex_priv +@@ -655,8 +734,8 @@ int mwifiex_send_cmd(struct mwifiex_priv /* Return error, since the command preparation failed */ if (ret) { mwifiex_dbg(adapter, ERROR, @@ -127,7 +127,7 @@ Signed-off-by: Pali Rohár mwifiex_insert_cmd_to_free_q(adapter, cmd_node); return -1; } -@@ -902,8 +981,9 @@ int mwifiex_process_cmdresp(struct mwifi +@@ -904,8 +983,9 @@ int mwifiex_process_cmdresp(struct mwifi if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING) { if (ret) { mwifiex_dbg(adapter, ERROR, @@ -139,7 +139,7 @@ Signed-off-by: Pali Rohár mwifiex_init_fw_complete(adapter); return -1; } else if (adapter->last_init_cmd == cmdresp_no) -@@ -1265,8 +1345,8 @@ mwifiex_process_sleep_confirm_resp(struc +@@ -1287,8 +1367,8 @@ mwifiex_process_sleep_confirm_resp(struc if (command != HostCmd_CMD_802_11_PS_MODE_ENH) { mwifiex_dbg(adapter, ERROR, @@ -152,7 +152,7 @@ Signed-off-by: Pali Rohár --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h -@@ -1084,6 +1084,8 @@ void mwifiex_cancel_all_pending_cmd(stru +@@ -1100,6 +1100,8 @@ void mwifiex_cancel_all_pending_cmd(stru void mwifiex_cancel_pending_scan_cmd(struct mwifiex_adapter *adapter); void mwifiex_cancel_scan(struct mwifiex_adapter *adapter); @@ -177,7 +177,7 @@ Signed-off-by: Pali Rohár adapter->cmd_wait_q.status = -1; --- a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c +++ b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c -@@ -802,7 +802,8 @@ int mwifiex_uap_prepare_cmd(struct mwifi +@@ -964,7 +964,8 @@ int mwifiex_uap_prepare_cmd(struct mwifi break; default: mwifiex_dbg(priv->adapter, ERROR, diff --git a/package/kernel/mac80211/patches/rtl/001-v6.12-wifi-rtw88-Set-efuse-ext_lna_5g-fix-typo.patch b/package/kernel/mac80211/patches/rtl/001-v6.12-wifi-rtw88-Set-efuse-ext_lna_5g-fix-typo.patch deleted file mode 100644 index 96a6743c5bc9d0..00000000000000 --- a/package/kernel/mac80211/patches/rtl/001-v6.12-wifi-rtw88-Set-efuse-ext_lna_5g-fix-typo.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 8fbcaa308591b91e9037ab6a8d733873b749a70d Mon Sep 17 00:00:00 2001 -From: Bitterblue Smith -Date: Sat, 6 Jul 2024 01:40:58 +0300 -Subject: [PATCH] wifi: rtw88: Set efuse->ext_lna_5g - fix typo - -efuse->ext_lna_2g is set twice and efuse->ext_lna_5g is not set at all. -Set each one once. - -Nothing uses these members right now. They will be used by the RTL8821AU -and RTL8812AU drivers. - -Signed-off-by: Bitterblue Smith -Acked-by: Ping-Ke Shih -Signed-off-by: Ping-Ke Shih -Link: https://patch.msgid.link/8ccc9e13-0d45-417d-8f88-93a0ad294f77@gmail.com ---- - drivers/net/wireless/realtek/rtw88/main.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/realtek/rtw88/main.c -+++ b/drivers/net/wireless/realtek/rtw88/main.c -@@ -2006,7 +2006,7 @@ static int rtw_chip_efuse_info_setup(str - efuse->ext_pa_2g = efuse->pa_type_2g & BIT(4) ? 1 : 0; - efuse->ext_lna_2g = efuse->lna_type_2g & BIT(3) ? 1 : 0; - efuse->ext_pa_5g = efuse->pa_type_5g & BIT(0) ? 1 : 0; -- efuse->ext_lna_2g = efuse->lna_type_5g & BIT(3) ? 1 : 0; -+ efuse->ext_lna_5g = efuse->lna_type_5g & BIT(3) ? 1 : 0; - - if (!is_valid_ether_addr(efuse->addr)) { - eth_random_addr(efuse->addr); diff --git a/package/kernel/mac80211/patches/rtl/002-v6.12-wifi-rtw88-usb-Support-USB-3-with-RTL8822CU-RTL8822B.patch b/package/kernel/mac80211/patches/rtl/002-v6.12-wifi-rtw88-usb-Support-USB-3-with-RTL8822CU-RTL8822B.patch deleted file mode 100644 index 2faa59d760ee4d..00000000000000 --- a/package/kernel/mac80211/patches/rtl/002-v6.12-wifi-rtw88-usb-Support-USB-3-with-RTL8822CU-RTL8822B.patch +++ /dev/null @@ -1,284 +0,0 @@ -From 315c23a64e99552502dd4d18d6ddc073fad9a7c3 Mon Sep 17 00:00:00 2001 -From: Bitterblue Smith -Date: Thu, 11 Jul 2024 01:11:33 +0300 -Subject: [PATCH] wifi: rtw88: usb: Support USB 3 with RTL8822CU/RTL8822BU - -The Realtek wifi 5 devices which support USB 3 are weird: when first -plugged in, they pretend to be USB 2. The driver needs to send some -commands to the device, which make it disappear and come back as a -USB 3 device. - -Implement the required commands in rtw88. - -When a USB 3 device is plugged into a USB 2 port, rtw88 will try to -switch it to USB 3 mode only once. The device will disappear and come -back still in USB 2 mode, of course. - -Some people experience heavy interference in the 2.4 GHz band in -USB 3 mode, so add a module parameter switch_usb_mode with the -default value 1 to let people disable the switching. - -Signed-off-by: Bitterblue Smith -Acked-by: Ping-Ke Shih -Signed-off-by: Ping-Ke Shih -Link: https://patch.msgid.link/77906c62-5674-426f-bde1-1b2a12a0339d@gmail.com ---- - drivers/net/wireless/realtek/rtw88/debug.h | 1 + - drivers/net/wireless/realtek/rtw88/main.h | 2 + - drivers/net/wireless/realtek/rtw88/reg.h | 11 +++ - drivers/net/wireless/realtek/rtw88/rtw8822b.c | 1 + - drivers/net/wireless/realtek/rtw88/rtw8822b.h | 4 +- - drivers/net/wireless/realtek/rtw88/rtw8822c.c | 1 + - drivers/net/wireless/realtek/rtw88/rtw8822c.h | 24 +++--- - drivers/net/wireless/realtek/rtw88/usb.c | 84 +++++++++++++++++++ - 8 files changed, 116 insertions(+), 12 deletions(-) - ---- a/drivers/net/wireless/realtek/rtw88/debug.h -+++ b/drivers/net/wireless/realtek/rtw88/debug.h -@@ -25,6 +25,7 @@ enum rtw_debug_mask { - RTW_DBG_HW_SCAN = 0x00010000, - RTW_DBG_STATE = 0x00020000, - RTW_DBG_SDIO = 0x00040000, -+ RTW_DBG_USB = 0x00080000, - - RTW_DBG_UNEXP = 0x80000000, - RTW_DBG_ALL = 0xffffffff ---- a/drivers/net/wireless/realtek/rtw88/main.h -+++ b/drivers/net/wireless/realtek/rtw88/main.h -@@ -1785,6 +1785,8 @@ struct rtw_efuse { - bool share_ant; - u8 bt_setting; - -+ u8 usb_mode_switch; -+ - struct { - u8 hci; - u8 bw; ---- a/drivers/net/wireless/realtek/rtw88/reg.h -+++ b/drivers/net/wireless/realtek/rtw88/reg.h -@@ -15,6 +15,7 @@ - #define BIT_WLOCK_1C_B6 BIT(5) - #define REG_SYS_PW_CTRL 0x0004 - #define BIT_PFM_WOWL BIT(3) -+#define BIT_APFM_OFFMAC BIT(9) - #define REG_SYS_CLK_CTRL 0x0008 - #define BIT_CPU_CLK_EN BIT(14) - -@@ -133,6 +134,14 @@ - #define REG_PMC_DBG_CTRL1 0xa8 - #define BITS_PMC_BT_IQK_STS GENMASK(22, 21) - -+#define REG_PAD_CTRL2 0x00C4 -+#define BIT_RSM_EN_V1 BIT(16) -+#define BIT_NO_PDN_CHIPOFF_V1 BIT(17) -+#define BIT_MASK_USB23_SW_MODE_V1 GENMASK(19, 18) -+#define BIT_USB3_USB2_TRANSITION BIT(20) -+#define BIT_USB_MODE_U2 1 -+#define BIT_USB_MODE_U3 2 -+ - #define REG_EFUSE_ACCESS 0x00CF - #define EFUSE_ACCESS_ON 0x69 - #define EFUSE_ACCESS_OFF 0x00 -@@ -568,6 +577,8 @@ - #define BIT_WL_SECURITY_CLK BIT(15) - #define BIT_DDMA_EN BIT(8) - -+#define REG_SW_MDIO 0x10C0 -+ - #define REG_H2C_PKT_READADDR 0x10D0 - #define REG_H2C_PKT_WRITEADDR 0x10D4 - #define REG_FW_DBG6 0x10F8 ---- a/drivers/net/wireless/realtek/rtw88/rtw8822b.c -+++ b/drivers/net/wireless/realtek/rtw88/rtw8822b.c -@@ -46,6 +46,7 @@ static int rtw8822b_read_efuse(struct rt - - map = (struct rtw8822b_efuse *)log_map; - -+ efuse->usb_mode_switch = u8_get_bits(map->usb_mode, BIT(7)); - efuse->rfe_option = map->rfe_option; - efuse->rf_board_option = map->rf_board_option; - efuse->crystal_cap = map->xtal_k; ---- a/drivers/net/wireless/realtek/rtw88/rtw8822b.h -+++ b/drivers/net/wireless/realtek/rtw88/rtw8822b.h -@@ -72,7 +72,9 @@ struct rtw8822bs_efuse { - - struct rtw8822b_efuse { - __le16 rtl_id; -- u8 res0[0x0e]; -+ u8 res0[4]; -+ u8 usb_mode; -+ u8 res1[0x09]; - - /* power index for four RF paths */ - struct rtw_txpwr_idx txpwr_idx_table[4]; ---- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c -+++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c -@@ -49,6 +49,7 @@ static int rtw8822c_read_efuse(struct rt - - map = (struct rtw8822c_efuse *)log_map; - -+ efuse->usb_mode_switch = u8_get_bits(map->usb_mode, BIT(7)); - efuse->rfe_option = map->rfe_option; - efuse->rf_board_option = map->rf_board_option; - efuse->crystal_cap = map->xtal_k & XCAP_MASK; ---- a/drivers/net/wireless/realtek/rtw88/rtw8822c.h -+++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.h -@@ -59,16 +59,18 @@ struct rtw8822ce_efuse { - - struct rtw8822c_efuse { - __le16 rtl_id; -- u8 res0[0x0e]; -+ u8 res0[4]; -+ u8 usb_mode; -+ u8 res1[0x09]; - - /* power index for four RF paths */ - struct rtw_txpwr_idx txpwr_idx_table[4]; - - u8 channel_plan; /* 0xb8 */ - u8 xtal_k; -- u8 res1; -+ u8 res2; - u8 iqk_lck; -- u8 res2[5]; /* 0xbc */ -+ u8 res3[5]; /* 0xbc */ - u8 rf_board_option; - u8 rf_feature_option; - u8 rf_bt_setting; -@@ -80,21 +82,21 @@ struct rtw8822c_efuse { - u8 rf_antenna_option; /* 0xc9 */ - u8 rfe_option; - u8 country_code[2]; -- u8 res3[3]; -+ u8 res4[3]; - u8 path_a_thermal; /* 0xd0 */ - u8 path_b_thermal; -- u8 res4[2]; -+ u8 res5[2]; - u8 rx_gain_gap_2g_ofdm; -- u8 res5; -- u8 rx_gain_gap_2g_cck; - u8 res6; -- u8 rx_gain_gap_5gl; -+ u8 rx_gain_gap_2g_cck; - u8 res7; -- u8 rx_gain_gap_5gm; -+ u8 rx_gain_gap_5gl; - u8 res8; -- u8 rx_gain_gap_5gh; -+ u8 rx_gain_gap_5gm; - u8 res9; -- u8 res10[0x42]; -+ u8 rx_gain_gap_5gh; -+ u8 res10; -+ u8 res11[0x42]; - union { - struct rtw8822ce_efuse e; - struct rtw8822cu_efuse u; ---- a/drivers/net/wireless/realtek/rtw88/usb.c -+++ b/drivers/net/wireless/realtek/rtw88/usb.c -@@ -14,6 +14,11 @@ - #include "ps.h" - #include "usb.h" - -+static bool rtw_switch_usb_mode = true; -+module_param_named(switch_usb_mode, rtw_switch_usb_mode, bool, 0644); -+MODULE_PARM_DESC(switch_usb_mode, -+ "Set to N to disable switching to USB 3 mode to avoid potential interference in the 2.4 GHz band (default: Y)"); -+ - #define RTW_USB_MAX_RXQ_LEN 512 - - struct rtw_usb_txcb { -@@ -841,6 +846,77 @@ static void rtw_usb_intf_deinit(struct r - usb_set_intfdata(intf, NULL); - } - -+static int rtw_usb_switch_mode_new(struct rtw_dev *rtwdev) -+{ -+ enum usb_device_speed cur_speed; -+ u8 id = rtwdev->chip->id; -+ bool can_switch; -+ u32 pad_ctrl2; -+ -+ if (rtw_read8(rtwdev, REG_SYS_CFG2 + 3) == 0x20) -+ cur_speed = USB_SPEED_SUPER; -+ else -+ cur_speed = USB_SPEED_HIGH; -+ -+ if (cur_speed == USB_SPEED_SUPER) -+ return 0; -+ -+ pad_ctrl2 = rtw_read32(rtwdev, REG_PAD_CTRL2); -+ -+ can_switch = !!(pad_ctrl2 & (BIT_MASK_USB23_SW_MODE_V1 | -+ BIT_USB3_USB2_TRANSITION)); -+ -+ if (!can_switch) { -+ rtw_dbg(rtwdev, RTW_DBG_USB, -+ "Switching to USB 3 mode unsupported by the chip\n"); -+ return 0; -+ } -+ -+ /* At this point cur_speed is USB_SPEED_HIGH. If we already tried -+ * to switch don't try again - it's a USB 2 port. -+ */ -+ if (u32_get_bits(pad_ctrl2, BIT_MASK_USB23_SW_MODE_V1) == BIT_USB_MODE_U3) -+ return 0; -+ -+ /* Enable IO wrapper timeout */ -+ if (id == RTW_CHIP_TYPE_8822B || id == RTW_CHIP_TYPE_8821C) -+ rtw_write8_clr(rtwdev, REG_SW_MDIO + 3, BIT(0)); -+ -+ u32p_replace_bits(&pad_ctrl2, BIT_USB_MODE_U3, BIT_MASK_USB23_SW_MODE_V1); -+ pad_ctrl2 |= BIT_RSM_EN_V1; -+ -+ rtw_write32(rtwdev, REG_PAD_CTRL2, pad_ctrl2); -+ rtw_write8(rtwdev, REG_PAD_CTRL2 + 1, 4); -+ -+ rtw_write16_set(rtwdev, REG_SYS_PW_CTRL, BIT_APFM_OFFMAC); -+ usleep_range(1000, 1001); -+ rtw_write32_set(rtwdev, REG_PAD_CTRL2, BIT_NO_PDN_CHIPOFF_V1); -+ -+ return 1; -+} -+ -+static int rtw_usb_switch_mode(struct rtw_dev *rtwdev) -+{ -+ u8 id = rtwdev->chip->id; -+ -+ if (id != RTW_CHIP_TYPE_8822C && id != RTW_CHIP_TYPE_8822B) -+ return 0; -+ -+ if (!rtwdev->efuse.usb_mode_switch) { -+ rtw_dbg(rtwdev, RTW_DBG_USB, -+ "Switching to USB 3 mode disabled by chip's efuse\n"); -+ return 0; -+ } -+ -+ if (!rtw_switch_usb_mode) { -+ rtw_dbg(rtwdev, RTW_DBG_USB, -+ "Switching to USB 3 mode disabled by module parameter\n"); -+ return 0; -+ } -+ -+ return rtw_usb_switch_mode_new(rtwdev); -+} -+ - int rtw_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) - { - struct rtw_dev *rtwdev; -@@ -896,6 +972,14 @@ int rtw_usb_probe(struct usb_interface * - goto err_destroy_rxwq; - } - -+ ret = rtw_usb_switch_mode(rtwdev); -+ if (ret) { -+ /* Not a fail, but we do need to skip rtw_register_hw. */ -+ rtw_dbg(rtwdev, RTW_DBG_USB, "switching to USB 3 mode\n"); -+ ret = 0; -+ goto err_destroy_rxwq; -+ } -+ - ret = rtw_register_hw(rtwdev, rtwdev->hw); - if (ret) { - rtw_err(rtwdev, "failed to register hw\n"); diff --git a/package/kernel/mac80211/patches/rtl/004-v6.12-wifi-rtw88-debugfs-support-multiple-adapters-debuggi.patch b/package/kernel/mac80211/patches/rtl/004-v6.12-wifi-rtw88-debugfs-support-multiple-adapters-debuggi.patch deleted file mode 100644 index d965fbce927eba..00000000000000 --- a/package/kernel/mac80211/patches/rtl/004-v6.12-wifi-rtw88-debugfs-support-multiple-adapters-debuggi.patch +++ /dev/null @@ -1,454 +0,0 @@ -From 8db6c1ca64664ef9b071e6eeb646023ac5b240a8 Mon Sep 17 00:00:00 2001 -From: Ping-Ke Shih -Date: Thu, 18 Jul 2024 14:41:55 +0800 -Subject: [PATCH] wifi: rtw88: debugfs: support multiple adapters debugging - -Originally in order to read partial registers from large area, we write -a range value stored into a static variable and read registers according -to the static variable. - -However, if we install more than one adapters supported by this driver, -the static variables will be overwritten by latter adapters. To resolve -the problem, move the static variables to struct rtw_dev for each adapter. - -With changes, smatch spends too much time to parse rtw_debugfs_init(): - debug.c:1289 rtw_debugfs_init() parse error: turning off implications - after 60 seconds -Move stuffs of adding debugfs entries to three rtw_debugfs_add_xxx() -functions. - -Reported-by: Bitterblue Smith -Closes: https://lore.kernel.org/linux-wireless/cd6a2acf3c2c36d938b40140b52a779516f446a9.camel@realtek.com/T/#m27662022c70d9f893ba96f6c6a8dd8fce2434dfe -Tested-by: Bitterblue Smith -Signed-off-by: Ping-Ke Shih -Link: https://patch.msgid.link/20240718064155.38955-1-pkshih@realtek.com ---- - drivers/net/wireless/realtek/rtw88/debug.c | 303 ++++++++++++--------- - drivers/net/wireless/realtek/rtw88/debug.h | 2 + - drivers/net/wireless/realtek/rtw88/main.c | 1 + - drivers/net/wireless/realtek/rtw88/main.h | 3 +- - 4 files changed, 180 insertions(+), 129 deletions(-) - ---- a/drivers/net/wireless/realtek/rtw88/debug.c -+++ b/drivers/net/wireless/realtek/rtw88/debug.c -@@ -43,6 +43,62 @@ struct rtw_debugfs_priv { - }; - }; - -+struct rtw_debugfs { -+ struct rtw_debugfs_priv mac_0; -+ struct rtw_debugfs_priv mac_1; -+ struct rtw_debugfs_priv mac_2; -+ struct rtw_debugfs_priv mac_3; -+ struct rtw_debugfs_priv mac_4; -+ struct rtw_debugfs_priv mac_5; -+ struct rtw_debugfs_priv mac_6; -+ struct rtw_debugfs_priv mac_7; -+ struct rtw_debugfs_priv mac_10; -+ struct rtw_debugfs_priv mac_11; -+ struct rtw_debugfs_priv mac_12; -+ struct rtw_debugfs_priv mac_13; -+ struct rtw_debugfs_priv mac_14; -+ struct rtw_debugfs_priv mac_15; -+ struct rtw_debugfs_priv mac_16; -+ struct rtw_debugfs_priv mac_17; -+ struct rtw_debugfs_priv bb_8; -+ struct rtw_debugfs_priv bb_9; -+ struct rtw_debugfs_priv bb_a; -+ struct rtw_debugfs_priv bb_b; -+ struct rtw_debugfs_priv bb_c; -+ struct rtw_debugfs_priv bb_d; -+ struct rtw_debugfs_priv bb_e; -+ struct rtw_debugfs_priv bb_f; -+ struct rtw_debugfs_priv bb_18; -+ struct rtw_debugfs_priv bb_19; -+ struct rtw_debugfs_priv bb_1a; -+ struct rtw_debugfs_priv bb_1b; -+ struct rtw_debugfs_priv bb_1c; -+ struct rtw_debugfs_priv bb_1d; -+ struct rtw_debugfs_priv bb_1e; -+ struct rtw_debugfs_priv bb_1f; -+ struct rtw_debugfs_priv bb_2c; -+ struct rtw_debugfs_priv bb_2d; -+ struct rtw_debugfs_priv bb_40; -+ struct rtw_debugfs_priv bb_41; -+ struct rtw_debugfs_priv rf_dump; -+ struct rtw_debugfs_priv tx_pwr_tbl; -+ struct rtw_debugfs_priv write_reg; -+ struct rtw_debugfs_priv h2c; -+ struct rtw_debugfs_priv rf_write; -+ struct rtw_debugfs_priv rf_read; -+ struct rtw_debugfs_priv read_reg; -+ struct rtw_debugfs_priv fix_rate; -+ struct rtw_debugfs_priv dump_cam; -+ struct rtw_debugfs_priv rsvd_page; -+ struct rtw_debugfs_priv phy_info; -+ struct rtw_debugfs_priv coex_enable; -+ struct rtw_debugfs_priv coex_info; -+ struct rtw_debugfs_priv edcca_enable; -+ struct rtw_debugfs_priv fw_crash; -+ struct rtw_debugfs_priv force_lowest_basic_rate; -+ struct rtw_debugfs_priv dm_cap; -+}; -+ - static const char * const rtw_dm_cap_strs[] = { - [RTW_DM_CAP_NA] = "NA", - [RTW_DM_CAP_TXGAPK] = "TXGAPK", -@@ -524,7 +580,7 @@ static int rtw_debug_get_bb_page(struct - return 0; - } - --static int rtw_debug_get_rf_dump(struct seq_file *m, void *v) -+static int rtw_debugfs_get_rf_dump(struct seq_file *m, void *v) - { - struct rtw_debugfs_priv *debugfs_priv = m->private; - struct rtw_dev *rtwdev = debugfs_priv->rtwdev; -@@ -1074,139 +1130,102 @@ static int rtw_debugfs_get_dm_cap(struct - return 0; - } - --#define rtw_debug_impl_mac(page, addr) \ --static struct rtw_debugfs_priv rtw_debug_priv_mac_ ##page = { \ -+#define rtw_debug_priv_mac(addr) \ -+{ \ - .cb_read = rtw_debug_get_mac_page, \ - .cb_data = addr, \ - } - --rtw_debug_impl_mac(0, 0x0000); --rtw_debug_impl_mac(1, 0x0100); --rtw_debug_impl_mac(2, 0x0200); --rtw_debug_impl_mac(3, 0x0300); --rtw_debug_impl_mac(4, 0x0400); --rtw_debug_impl_mac(5, 0x0500); --rtw_debug_impl_mac(6, 0x0600); --rtw_debug_impl_mac(7, 0x0700); --rtw_debug_impl_mac(10, 0x1000); --rtw_debug_impl_mac(11, 0x1100); --rtw_debug_impl_mac(12, 0x1200); --rtw_debug_impl_mac(13, 0x1300); --rtw_debug_impl_mac(14, 0x1400); --rtw_debug_impl_mac(15, 0x1500); --rtw_debug_impl_mac(16, 0x1600); --rtw_debug_impl_mac(17, 0x1700); -- --#define rtw_debug_impl_bb(page, addr) \ --static struct rtw_debugfs_priv rtw_debug_priv_bb_ ##page = { \ -+#define rtw_debug_priv_bb(addr) \ -+{ \ - .cb_read = rtw_debug_get_bb_page, \ - .cb_data = addr, \ - } - --rtw_debug_impl_bb(8, 0x0800); --rtw_debug_impl_bb(9, 0x0900); --rtw_debug_impl_bb(a, 0x0a00); --rtw_debug_impl_bb(b, 0x0b00); --rtw_debug_impl_bb(c, 0x0c00); --rtw_debug_impl_bb(d, 0x0d00); --rtw_debug_impl_bb(e, 0x0e00); --rtw_debug_impl_bb(f, 0x0f00); --rtw_debug_impl_bb(18, 0x1800); --rtw_debug_impl_bb(19, 0x1900); --rtw_debug_impl_bb(1a, 0x1a00); --rtw_debug_impl_bb(1b, 0x1b00); --rtw_debug_impl_bb(1c, 0x1c00); --rtw_debug_impl_bb(1d, 0x1d00); --rtw_debug_impl_bb(1e, 0x1e00); --rtw_debug_impl_bb(1f, 0x1f00); --rtw_debug_impl_bb(2c, 0x2c00); --rtw_debug_impl_bb(2d, 0x2d00); --rtw_debug_impl_bb(40, 0x4000); --rtw_debug_impl_bb(41, 0x4100); -- --static struct rtw_debugfs_priv rtw_debug_priv_rf_dump = { -- .cb_read = rtw_debug_get_rf_dump, --}; -- --static struct rtw_debugfs_priv rtw_debug_priv_tx_pwr_tbl = { -- .cb_read = rtw_debugfs_get_tx_pwr_tbl, --}; -- --static struct rtw_debugfs_priv rtw_debug_priv_write_reg = { -- .cb_write = rtw_debugfs_set_write_reg, --}; -- --static struct rtw_debugfs_priv rtw_debug_priv_h2c = { -- .cb_write = rtw_debugfs_set_h2c, --}; -- --static struct rtw_debugfs_priv rtw_debug_priv_rf_write = { -- .cb_write = rtw_debugfs_set_rf_write, --}; -- --static struct rtw_debugfs_priv rtw_debug_priv_rf_read = { -- .cb_write = rtw_debugfs_set_rf_read, -- .cb_read = rtw_debugfs_get_rf_read, --}; -- --static struct rtw_debugfs_priv rtw_debug_priv_read_reg = { -- .cb_write = rtw_debugfs_set_read_reg, -- .cb_read = rtw_debugfs_get_read_reg, --}; -- --static struct rtw_debugfs_priv rtw_debug_priv_fix_rate = { -- .cb_write = rtw_debugfs_set_fix_rate, -- .cb_read = rtw_debugfs_get_fix_rate, --}; -- --static struct rtw_debugfs_priv rtw_debug_priv_dump_cam = { -- .cb_write = rtw_debugfs_set_single_input, -- .cb_read = rtw_debugfs_get_dump_cam, --}; -- --static struct rtw_debugfs_priv rtw_debug_priv_rsvd_page = { -- .cb_write = rtw_debugfs_set_rsvd_page, -- .cb_read = rtw_debugfs_get_rsvd_page, --}; -- --static struct rtw_debugfs_priv rtw_debug_priv_phy_info = { -- .cb_read = rtw_debugfs_get_phy_info, --}; -- --static struct rtw_debugfs_priv rtw_debug_priv_coex_enable = { -- .cb_write = rtw_debugfs_set_coex_enable, -- .cb_read = rtw_debugfs_get_coex_enable, --}; -- --static struct rtw_debugfs_priv rtw_debug_priv_coex_info = { -- .cb_read = rtw_debugfs_get_coex_info, --}; -- --static struct rtw_debugfs_priv rtw_debug_priv_edcca_enable = { -- .cb_write = rtw_debugfs_set_edcca_enable, -- .cb_read = rtw_debugfs_get_edcca_enable, --}; -- --static struct rtw_debugfs_priv rtw_debug_priv_fw_crash = { -- .cb_write = rtw_debugfs_set_fw_crash, -- .cb_read = rtw_debugfs_get_fw_crash, --}; -- --static struct rtw_debugfs_priv rtw_debug_priv_force_lowest_basic_rate = { -- .cb_write = rtw_debugfs_set_force_lowest_basic_rate, -- .cb_read = rtw_debugfs_get_force_lowest_basic_rate, --}; -- --static struct rtw_debugfs_priv rtw_debug_priv_dm_cap = { -- .cb_write = rtw_debugfs_set_dm_cap, -- .cb_read = rtw_debugfs_get_dm_cap, -+#define rtw_debug_priv_get(name) \ -+{ \ -+ .cb_read = rtw_debugfs_get_ ##name, \ -+} -+ -+#define rtw_debug_priv_set(name) \ -+{ \ -+ .cb_write = rtw_debugfs_set_ ##name, \ -+} -+ -+#define rtw_debug_priv_set_and_get(name) \ -+{ \ -+ .cb_write = rtw_debugfs_set_ ##name, \ -+ .cb_read = rtw_debugfs_get_ ##name, \ -+} -+ -+#define rtw_debug_priv_set_single_and_get(name) \ -+{ \ -+ .cb_write = rtw_debugfs_set_single_input, \ -+ .cb_read = rtw_debugfs_get_ ##name, \ -+} -+ -+static const struct rtw_debugfs rtw_debugfs_templ = { -+ .mac_0 = rtw_debug_priv_mac(0x0000), -+ .mac_1 = rtw_debug_priv_mac(0x0100), -+ .mac_2 = rtw_debug_priv_mac(0x0200), -+ .mac_3 = rtw_debug_priv_mac(0x0300), -+ .mac_4 = rtw_debug_priv_mac(0x0400), -+ .mac_5 = rtw_debug_priv_mac(0x0500), -+ .mac_6 = rtw_debug_priv_mac(0x0600), -+ .mac_7 = rtw_debug_priv_mac(0x0700), -+ .mac_10 = rtw_debug_priv_mac(0x1000), -+ .mac_11 = rtw_debug_priv_mac(0x1100), -+ .mac_12 = rtw_debug_priv_mac(0x1200), -+ .mac_13 = rtw_debug_priv_mac(0x1300), -+ .mac_14 = rtw_debug_priv_mac(0x1400), -+ .mac_15 = rtw_debug_priv_mac(0x1500), -+ .mac_16 = rtw_debug_priv_mac(0x1600), -+ .mac_17 = rtw_debug_priv_mac(0x1700), -+ .bb_8 = rtw_debug_priv_bb(0x0800), -+ .bb_9 = rtw_debug_priv_bb(0x0900), -+ .bb_a = rtw_debug_priv_bb(0x0a00), -+ .bb_b = rtw_debug_priv_bb(0x0b00), -+ .bb_c = rtw_debug_priv_bb(0x0c00), -+ .bb_d = rtw_debug_priv_bb(0x0d00), -+ .bb_e = rtw_debug_priv_bb(0x0e00), -+ .bb_f = rtw_debug_priv_bb(0x0f00), -+ .bb_18 = rtw_debug_priv_bb(0x1800), -+ .bb_19 = rtw_debug_priv_bb(0x1900), -+ .bb_1a = rtw_debug_priv_bb(0x1a00), -+ .bb_1b = rtw_debug_priv_bb(0x1b00), -+ .bb_1c = rtw_debug_priv_bb(0x1c00), -+ .bb_1d = rtw_debug_priv_bb(0x1d00), -+ .bb_1e = rtw_debug_priv_bb(0x1e00), -+ .bb_1f = rtw_debug_priv_bb(0x1f00), -+ .bb_2c = rtw_debug_priv_bb(0x2c00), -+ .bb_2d = rtw_debug_priv_bb(0x2d00), -+ .bb_40 = rtw_debug_priv_bb(0x4000), -+ .bb_41 = rtw_debug_priv_bb(0x4100), -+ .rf_dump = rtw_debug_priv_get(rf_dump), -+ .tx_pwr_tbl = rtw_debug_priv_get(tx_pwr_tbl), -+ .write_reg = rtw_debug_priv_set(write_reg), -+ .h2c = rtw_debug_priv_set(h2c), -+ .rf_write = rtw_debug_priv_set(rf_write), -+ .rf_read = rtw_debug_priv_set_and_get(rf_read), -+ .read_reg = rtw_debug_priv_set_and_get(read_reg), -+ .fix_rate = rtw_debug_priv_set_and_get(fix_rate), -+ .dump_cam = rtw_debug_priv_set_single_and_get(dump_cam), -+ .rsvd_page = rtw_debug_priv_set_and_get(rsvd_page), -+ .phy_info = rtw_debug_priv_get(phy_info), -+ .coex_enable = rtw_debug_priv_set_and_get(coex_enable), -+ .coex_info = rtw_debug_priv_get(coex_info), -+ .edcca_enable = rtw_debug_priv_set_and_get(edcca_enable), -+ .fw_crash = rtw_debug_priv_set_and_get(fw_crash), -+ .force_lowest_basic_rate = rtw_debug_priv_set_and_get(force_lowest_basic_rate), -+ .dm_cap = rtw_debug_priv_set_and_get(dm_cap), - }; - - #define rtw_debugfs_add_core(name, mode, fopname, parent) \ - do { \ -- rtw_debug_priv_ ##name.rtwdev = rtwdev; \ -+ struct rtw_debugfs_priv *priv = &rtwdev->debugfs->name; \ -+ priv->rtwdev = rtwdev; \ - if (IS_ERR(debugfs_create_file(#name, mode, \ -- parent, &rtw_debug_priv_ ##name,\ -+ parent, priv, \ - &file_ops_ ##fopname))) \ - pr_debug("Unable to initialize debugfs:%s\n", \ - #name); \ -@@ -1219,12 +1238,9 @@ static struct rtw_debugfs_priv rtw_debug - #define rtw_debugfs_add_r(name) \ - rtw_debugfs_add_core(name, S_IFREG | 0444, single_r, debugfs_topdir) - --void rtw_debugfs_init(struct rtw_dev *rtwdev) -+static -+void rtw_debugfs_add_basic(struct rtw_dev *rtwdev, struct dentry *debugfs_topdir) - { -- struct dentry *debugfs_topdir; -- -- debugfs_topdir = debugfs_create_dir("rtw88", -- rtwdev->hw->wiphy->debugfsdir); - rtw_debugfs_add_w(write_reg); - rtw_debugfs_add_rw(read_reg); - rtw_debugfs_add_w(rf_write); -@@ -1236,6 +1252,17 @@ void rtw_debugfs_init(struct rtw_dev *rt - rtw_debugfs_add_r(coex_info); - rtw_debugfs_add_rw(coex_enable); - rtw_debugfs_add_w(h2c); -+ rtw_debugfs_add_r(rf_dump); -+ rtw_debugfs_add_r(tx_pwr_tbl); -+ rtw_debugfs_add_rw(edcca_enable); -+ rtw_debugfs_add_rw(fw_crash); -+ rtw_debugfs_add_rw(force_lowest_basic_rate); -+ rtw_debugfs_add_rw(dm_cap); -+} -+ -+static -+void rtw_debugfs_add_sec0(struct rtw_dev *rtwdev, struct dentry *debugfs_topdir) -+{ - rtw_debugfs_add_r(mac_0); - rtw_debugfs_add_r(mac_1); - rtw_debugfs_add_r(mac_2); -@@ -1252,6 +1279,11 @@ void rtw_debugfs_init(struct rtw_dev *rt - rtw_debugfs_add_r(bb_d); - rtw_debugfs_add_r(bb_e); - rtw_debugfs_add_r(bb_f); -+} -+ -+static -+void rtw_debugfs_add_sec1(struct rtw_dev *rtwdev, struct dentry *debugfs_topdir) -+{ - rtw_debugfs_add_r(mac_10); - rtw_debugfs_add_r(mac_11); - rtw_debugfs_add_r(mac_12); -@@ -1274,14 +1306,29 @@ void rtw_debugfs_init(struct rtw_dev *rt - rtw_debugfs_add_r(bb_40); - rtw_debugfs_add_r(bb_41); - } -- rtw_debugfs_add_r(rf_dump); -- rtw_debugfs_add_r(tx_pwr_tbl); -- rtw_debugfs_add_rw(edcca_enable); -- rtw_debugfs_add_rw(fw_crash); -- rtw_debugfs_add_rw(force_lowest_basic_rate); -- rtw_debugfs_add_rw(dm_cap); - } - -+void rtw_debugfs_init(struct rtw_dev *rtwdev) -+{ -+ struct dentry *debugfs_topdir; -+ -+ rtwdev->debugfs = kmemdup(&rtw_debugfs_templ, sizeof(rtw_debugfs_templ), -+ GFP_KERNEL); -+ if (!rtwdev->debugfs) -+ return; -+ -+ debugfs_topdir = debugfs_create_dir("rtw88", -+ rtwdev->hw->wiphy->debugfsdir); -+ -+ rtw_debugfs_add_basic(rtwdev, debugfs_topdir); -+ rtw_debugfs_add_sec0(rtwdev, debugfs_topdir); -+ rtw_debugfs_add_sec1(rtwdev, debugfs_topdir); -+} -+ -+void rtw_debugfs_deinit(struct rtw_dev *rtwdev) -+{ -+ kfree(rtwdev->debugfs); -+} - #endif /* CPTCFG_RTW88_DEBUGFS */ - - #ifdef CPTCFG_RTW88_DEBUG ---- a/drivers/net/wireless/realtek/rtw88/debug.h -+++ b/drivers/net/wireless/realtek/rtw88/debug.h -@@ -34,11 +34,13 @@ enum rtw_debug_mask { - #ifdef CPTCFG_RTW88_DEBUGFS - - void rtw_debugfs_init(struct rtw_dev *rtwdev); -+void rtw_debugfs_deinit(struct rtw_dev *rtwdev); - void rtw_debugfs_get_simple_phy_info(struct seq_file *m); - - #else - - static inline void rtw_debugfs_init(struct rtw_dev *rtwdev) {} -+static inline void rtw_debugfs_deinit(struct rtw_dev *rtwdev) {} - - #endif /* CPTCFG_RTW88_DEBUGFS */ - ---- a/drivers/net/wireless/realtek/rtw88/main.c -+++ b/drivers/net/wireless/realtek/rtw88/main.c -@@ -2300,6 +2300,7 @@ void rtw_unregister_hw(struct rtw_dev *r - - ieee80211_unregister_hw(hw); - rtw_unset_supported_band(hw, chip); -+ rtw_debugfs_deinit(rtwdev); - } - EXPORT_SYMBOL(rtw_unregister_hw); - ---- a/drivers/net/wireless/realtek/rtw88/main.h -+++ b/drivers/net/wireless/realtek/rtw88/main.h -@@ -50,6 +50,7 @@ extern const struct ieee80211_ops rtw_op - #define RTW_MAX_CHANNEL_NUM_5G 49 - - struct rtw_dev; -+struct rtw_debugfs; - - enum rtw_hci_type { - RTW_HCI_TYPE_PCIE, -@@ -2053,7 +2054,7 @@ struct rtw_dev { - bool beacon_loss; - struct completion lps_leave_check; - -- struct dentry *debugfs; -+ struct rtw_debugfs *debugfs; - - u8 sta_cnt; - u32 rts_threshold; diff --git a/package/kernel/mac80211/patches/rtl/005-v6.12-wifi-rtw88-select-WANT_DEV_COREDUMP.patch b/package/kernel/mac80211/patches/rtl/005-v6.12-wifi-rtw88-select-WANT_DEV_COREDUMP.patch deleted file mode 100644 index 6c31b5e848f2f3..00000000000000 --- a/package/kernel/mac80211/patches/rtl/005-v6.12-wifi-rtw88-select-WANT_DEV_COREDUMP.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 7e989b0c1e33210c07340bf5228aa83ea52515b5 Mon Sep 17 00:00:00 2001 -From: Zong-Zhe Yang -Date: Thu, 18 Jul 2024 15:06:15 +0800 -Subject: [PATCH] wifi: rtw88: select WANT_DEV_COREDUMP - -We have invoked device coredump when fw crash. -Should select WANT_DEV_COREDUMP by ourselves. - -Signed-off-by: Zong-Zhe Yang -Signed-off-by: Ping-Ke Shih -Link: https://patch.msgid.link/20240718070616.42217-1-pkshih@realtek.com ---- - drivers/net/wireless/realtek/rtw88/Kconfig | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/net/wireless/realtek/rtw88/Kconfig -+++ b/drivers/net/wireless/realtek/rtw88/Kconfig -@@ -14,6 +14,7 @@ if RTW88 - config RTW88_CORE - tristate - depends on m -+ select BPAUTO_WANT_DEV_COREDUMP - - config RTW88_PCI - tristate diff --git a/package/kernel/mac80211/patches/rtl/008-v6.12-wifi-rtw88-8822c-Parse-channel-from-IE-to-correct-in.patch b/package/kernel/mac80211/patches/rtl/008-v6.12-wifi-rtw88-8822c-Parse-channel-from-IE-to-correct-in.patch deleted file mode 100644 index a304cd7d0504c2..00000000000000 --- a/package/kernel/mac80211/patches/rtl/008-v6.12-wifi-rtw88-8822c-Parse-channel-from-IE-to-correct-in.patch +++ /dev/null @@ -1,151 +0,0 @@ -From 53ed4b25a79aeec5991c2dc579e635b136ef7676 Mon Sep 17 00:00:00 2001 -From: Po-Hao Huang -Date: Wed, 24 Jul 2024 13:05:01 +0800 -Subject: [PATCH] wifi: rtw88: 8822c: Parse channel from IE to correct invalid - hardware reports - -For CCK packets we could get incorrect reports from hardware. -And this causes wrong frequencies being reported. Parse the channel -information from IE if provided by AP to fix this. - -Signed-off-by: Po-Hao Huang -Signed-off-by: Ping-Ke Shih -Link: https://patch.msgid.link/20240724050501.7550-1-pkshih@realtek.com ---- - drivers/net/wireless/realtek/rtw88/main.h | 1 + - drivers/net/wireless/realtek/rtw88/pci.c | 1 + - drivers/net/wireless/realtek/rtw88/rtw8822c.c | 7 ++-- - drivers/net/wireless/realtek/rtw88/rx.c | 41 +++++++++++++++++++ - drivers/net/wireless/realtek/rtw88/rx.h | 13 ++++++ - drivers/net/wireless/realtek/rtw88/sdio.c | 1 + - drivers/net/wireless/realtek/rtw88/usb.c | 2 + - 7 files changed, 63 insertions(+), 3 deletions(-) - ---- a/drivers/net/wireless/realtek/rtw88/main.h -+++ b/drivers/net/wireless/realtek/rtw88/main.h -@@ -623,6 +623,7 @@ struct rtw_rx_pkt_stat { - bool crc_err; - bool decrypted; - bool is_c2h; -+ bool channel_invalid; - - s32 signal_power; - u16 pkt_len; ---- a/drivers/net/wireless/realtek/rtw88/pci.c -+++ b/drivers/net/wireless/realtek/rtw88/pci.c -@@ -1088,6 +1088,7 @@ static u32 rtw_pci_rx_napi(struct rtw_de - /* remove rx_desc */ - skb_pull(new, pkt_offset); - -+ rtw_update_rx_freq_for_invalid(rtwdev, new, &rx_status, &pkt_stat); - rtw_rx_stats(rtwdev, pkt_stat.vif, new); - memcpy(new->cb, &rx_status, sizeof(rx_status)); - ieee80211_rx_napi(rtwdev->hw, NULL, new, napi); ---- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c -+++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c -@@ -2576,9 +2576,10 @@ static void query_phy_status_page0(struc - rx_power[RF_PATH_B] -= 110; - - channel = GET_PHY_STAT_P0_CHANNEL(phy_status); -- if (channel == 0) -- channel = rtwdev->hal.current_channel; -- rtw_set_rx_freq_band(pkt_stat, channel); -+ if (channel != 0) -+ rtw_set_rx_freq_band(pkt_stat, channel); -+ else -+ pkt_stat->channel_invalid = true; - - pkt_stat->rx_power[RF_PATH_A] = rx_power[RF_PATH_A]; - pkt_stat->rx_power[RF_PATH_B] = rx_power[RF_PATH_B]; ---- a/drivers/net/wireless/realtek/rtw88/rx.c -+++ b/drivers/net/wireless/realtek/rtw88/rx.c -@@ -146,6 +146,47 @@ static void rtw_set_rx_freq_by_pktstat(s - rx_status->band = pkt_stat->band; - } - -+void rtw_update_rx_freq_from_ie(struct rtw_dev *rtwdev, struct sk_buff *skb, -+ struct ieee80211_rx_status *rx_status, -+ struct rtw_rx_pkt_stat *pkt_stat) -+{ -+ struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data; -+ int channel = rtwdev->hal.current_channel; -+ size_t hdr_len, ielen; -+ int channel_number; -+ u8 *variable; -+ -+ if (!test_bit(RTW_FLAG_SCANNING, rtwdev->flags)) -+ goto fill_rx_status; -+ -+ if (ieee80211_is_beacon(mgmt->frame_control)) { -+ variable = mgmt->u.beacon.variable; -+ hdr_len = offsetof(struct ieee80211_mgmt, -+ u.beacon.variable); -+ } else if (ieee80211_is_probe_resp(mgmt->frame_control)) { -+ variable = mgmt->u.probe_resp.variable; -+ hdr_len = offsetof(struct ieee80211_mgmt, -+ u.probe_resp.variable); -+ } else { -+ goto fill_rx_status; -+ } -+ -+ if (skb->len > hdr_len) -+ ielen = skb->len - hdr_len; -+ else -+ goto fill_rx_status; -+ -+ channel_number = cfg80211_get_ies_channel_number(variable, ielen, -+ NL80211_BAND_2GHZ); -+ if (channel_number != -1) -+ channel = channel_number; -+ -+fill_rx_status: -+ rtw_set_rx_freq_band(pkt_stat, channel); -+ rtw_set_rx_freq_by_pktstat(pkt_stat, rx_status); -+} -+EXPORT_SYMBOL(rtw_update_rx_freq_from_ie); -+ - void rtw_rx_fill_rx_status(struct rtw_dev *rtwdev, - struct rtw_rx_pkt_stat *pkt_stat, - struct ieee80211_hdr *hdr, ---- a/drivers/net/wireless/realtek/rtw88/rx.h -+++ b/drivers/net/wireless/realtek/rtw88/rx.h -@@ -50,5 +50,18 @@ void rtw_rx_fill_rx_status(struct rtw_de - struct ieee80211_hdr *hdr, - struct ieee80211_rx_status *rx_status, - u8 *phy_status); -+void rtw_update_rx_freq_from_ie(struct rtw_dev *rtwdev, struct sk_buff *skb, -+ struct ieee80211_rx_status *rx_status, -+ struct rtw_rx_pkt_stat *pkt_stat); -+ -+static inline -+void rtw_update_rx_freq_for_invalid(struct rtw_dev *rtwdev, struct sk_buff *skb, -+ struct ieee80211_rx_status *rx_status, -+ struct rtw_rx_pkt_stat *pkt_stat) -+{ -+ if (pkt_stat->channel_invalid) -+ rtw_update_rx_freq_from_ie(rtwdev, skb, rx_status, pkt_stat); -+} -+ - - #endif ---- a/drivers/net/wireless/realtek/rtw88/sdio.c -+++ b/drivers/net/wireless/realtek/rtw88/sdio.c -@@ -948,6 +948,7 @@ static void rtw_sdio_rx_skb(struct rtw_d - skb_put(skb, pkt_stat->pkt_len); - skb_reserve(skb, pkt_offset); - -+ rtw_update_rx_freq_for_invalid(rtwdev, skb, rx_status, pkt_stat); - rtw_rx_stats(rtwdev, pkt_stat->vif, skb); - - ieee80211_rx_irqsafe(rtwdev->hw, skb); ---- a/drivers/net/wireless/realtek/rtw88/usb.c -+++ b/drivers/net/wireless/realtek/rtw88/usb.c -@@ -579,6 +579,8 @@ static void rtw_usb_rx_handler(struct wo - - skb_put(skb, pkt_stat.pkt_len); - skb_reserve(skb, pkt_offset); -+ -+ rtw_update_rx_freq_for_invalid(rtwdev, skb, &rx_status, &pkt_stat); - memcpy(skb->cb, &rx_status, sizeof(rx_status)); - ieee80211_rx_irqsafe(rtwdev->hw, skb); - } diff --git a/package/kernel/mac80211/patches/rtl/010-v6.12-wifi-rtw88-usb-Init-RX-burst-length-according-to-USB.patch b/package/kernel/mac80211/patches/rtl/010-v6.12-wifi-rtw88-usb-Init-RX-burst-length-according-to-USB.patch deleted file mode 100644 index 191c87ff37adc5..00000000000000 --- a/package/kernel/mac80211/patches/rtl/010-v6.12-wifi-rtw88-usb-Init-RX-burst-length-according-to-USB.patch +++ /dev/null @@ -1,73 +0,0 @@ -From fbbd8cb347e25b68d25c4f3871821afc495ee7a9 Mon Sep 17 00:00:00 2001 -From: Bitterblue Smith -Date: Thu, 8 Aug 2024 01:19:36 +0300 -Subject: [PATCH] wifi: rtw88: usb: Init RX burst length according to USB speed - -This is needed in order to make USB RX aggregation work with RTL8811CU -(and presumably RTL8822BU and RTL8822CU also). - -I don't know what BIT_DMA_BURST_CNT, BIT_DMA_MODE, and BIT_DROP_DATA_EN -are doing. - -Tested with RTL8822CU, RTL8811CU, and RTL8723DU. - -The RX speed is unchanged in my tests. - -Tested-by: Sascha Hauer -Signed-off-by: Bitterblue Smith -Signed-off-by: Ping-Ke Shih -Link: https://patch.msgid.link/ac569c6f-7129-4341-b523-901fe10cabff@gmail.com ---- - drivers/net/wireless/realtek/rtw88/reg.h | 6 ++++++ - drivers/net/wireless/realtek/rtw88/usb.c | 23 ++++++++++++++++++++++- - 2 files changed, 28 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/realtek/rtw88/reg.h -+++ b/drivers/net/wireless/realtek/rtw88/reg.h -@@ -322,6 +322,12 @@ - #define REG_RXDMA_DPR 0x028C - #define REG_RXDMA_MODE 0x0290 - #define BIT_DMA_MODE BIT(1) -+#define BIT_DMA_BURST_CNT GENMASK(3, 2) -+#define BIT_DMA_BURST_SIZE GENMASK(5, 4) -+#define BIT_DMA_BURST_SIZE_64 2 -+#define BIT_DMA_BURST_SIZE_512 1 -+#define BIT_DMA_BURST_SIZE_1024 0 -+ - #define REG_RXPKTNUM 0x02B0 - - #define REG_INT_MIG 0x0304 ---- a/drivers/net/wireless/realtek/rtw88/usb.c -+++ b/drivers/net/wireless/realtek/rtw88/usb.c -@@ -720,9 +720,30 @@ static void rtw_usb_link_ps(struct rtw_d - /* empty function for rtw_hci_ops */ - } - -+static void rtw_usb_init_burst_pkt_len(struct rtw_dev *rtwdev) -+{ -+ struct rtw_usb *rtwusb = rtw_get_usb_priv(rtwdev); -+ enum usb_device_speed speed = rtwusb->udev->speed; -+ u8 rxdma, burst_size; -+ -+ rxdma = BIT_DMA_BURST_CNT | BIT_DMA_MODE; -+ -+ if (speed == USB_SPEED_SUPER) -+ burst_size = BIT_DMA_BURST_SIZE_1024; -+ else if (speed == USB_SPEED_HIGH) -+ burst_size = BIT_DMA_BURST_SIZE_512; -+ else -+ burst_size = BIT_DMA_BURST_SIZE_64; -+ -+ u8p_replace_bits(&rxdma, burst_size, BIT_DMA_BURST_SIZE); -+ -+ rtw_write8(rtwdev, REG_RXDMA_MODE, rxdma); -+ rtw_write16_set(rtwdev, REG_TXDMA_OFFSET_CHK, BIT_DROP_DATA_EN); -+} -+ - static void rtw_usb_interface_cfg(struct rtw_dev *rtwdev) - { -- /* empty function for rtw_hci_ops */ -+ rtw_usb_init_burst_pkt_len(rtwdev); - } - - static struct rtw_hci_ops rtw_usb_ops = { diff --git a/package/kernel/mac80211/patches/rtl/011-v6.12-wifi-rtw88-usb-Update-the-RX-stats-after-every-frame.patch b/package/kernel/mac80211/patches/rtl/011-v6.12-wifi-rtw88-usb-Update-the-RX-stats-after-every-frame.patch deleted file mode 100644 index f78f43b4647d10..00000000000000 --- a/package/kernel/mac80211/patches/rtl/011-v6.12-wifi-rtw88-usb-Update-the-RX-stats-after-every-frame.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 38ea04a79ad0f8cc30bb5e9ad98d665e4ae5060c Mon Sep 17 00:00:00 2001 -From: Bitterblue Smith -Date: Thu, 8 Aug 2024 01:20:36 +0300 -Subject: [PATCH] wifi: rtw88: usb: Update the RX stats after every frame - -Update the number of received unicast data frames and bytes every time -a frame is received. This is what the PCI and SDIO drivers do. - -This has an influence on the power saving, bluetooth coexistence, and -(in a future patch) the use of RX aggregation. - -Tested with RTL8822CU, RTL8811CU, and RTL8723DU. - -Tested-by: Sascha Hauer -Signed-off-by: Bitterblue Smith -Signed-off-by: Ping-Ke Shih -Link: https://patch.msgid.link/75a2ca52-8f01-45c5-926f-d3a68ae3b284@gmail.com ---- - drivers/net/wireless/realtek/rtw88/usb.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/net/wireless/realtek/rtw88/usb.c -+++ b/drivers/net/wireless/realtek/rtw88/usb.c -@@ -581,6 +581,7 @@ static void rtw_usb_rx_handler(struct wo - skb_reserve(skb, pkt_offset); - - rtw_update_rx_freq_for_invalid(rtwdev, skb, &rx_status, &pkt_stat); -+ rtw_rx_stats(rtwdev, pkt_stat.vif, skb); - memcpy(skb->cb, &rx_status, sizeof(rx_status)); - ieee80211_rx_irqsafe(rtwdev->hw, skb); - } diff --git a/package/kernel/mac80211/patches/rtl/012-v6.12-wifi-rtw88-usb-Support-RX-aggregation.patch b/package/kernel/mac80211/patches/rtl/012-v6.12-wifi-rtw88-usb-Support-RX-aggregation.patch deleted file mode 100644 index bc8eac898b24b0..00000000000000 --- a/package/kernel/mac80211/patches/rtl/012-v6.12-wifi-rtw88-usb-Support-RX-aggregation.patch +++ /dev/null @@ -1,118 +0,0 @@ -From df3d8f463b1dfc7cb8f4fb52b1b81d290b850d03 Mon Sep 17 00:00:00 2001 -From: Bitterblue Smith -Date: Thu, 8 Aug 2024 01:21:36 +0300 -Subject: [PATCH] wifi: rtw88: usb: Support RX aggregation - -The chips can be configured to aggregate several frames into a single -USB transfer. Modify rtw_usb_rx_handler() to support this case. - -RX aggregation improves the RX speed of RTL8811CU on certain ARM -systems, like the NanoPi NEO Core2. It also improves the RX speed of -RTL8822CU on some x86_64 systems. - -Currently none of the chips are configured to aggregate frames. - -Tested with RTL8822CU, RTL8811CU, and RTL8723DU. - -Reviewed-by: Sascha Hauer -Tested-by: Sascha Hauer -Signed-off-by: Bitterblue Smith -Signed-off-by: Ping-Ke Shih -Link: https://patch.msgid.link/f845826d-de71-492d-9a22-e48c07989a1f@gmail.com ---- - drivers/net/wireless/realtek/rtw88/usb.c | 61 ++++++++++++++++-------- - 1 file changed, 40 insertions(+), 21 deletions(-) - ---- a/drivers/net/wireless/realtek/rtw88/usb.c -+++ b/drivers/net/wireless/realtek/rtw88/usb.c -@@ -546,11 +546,12 @@ static void rtw_usb_rx_handler(struct wo - struct rtw_usb *rtwusb = container_of(work, struct rtw_usb, rx_work); - struct rtw_dev *rtwdev = rtwusb->rtwdev; - const struct rtw_chip_info *chip = rtwdev->chip; -- struct rtw_rx_pkt_stat pkt_stat; -+ u32 pkt_desc_sz = chip->rx_pkt_desc_sz; - struct ieee80211_rx_status rx_status; -+ u32 pkt_offset, next_pkt, urb_len; -+ struct rtw_rx_pkt_stat pkt_stat; -+ struct sk_buff *next_skb; - struct sk_buff *skb; -- u32 pkt_desc_sz = chip->rx_pkt_desc_sz; -- u32 pkt_offset; - u8 *rx_desc; - int limit; - -@@ -559,31 +560,48 @@ static void rtw_usb_rx_handler(struct wo - if (!skb) - break; - -- rx_desc = skb->data; -- chip->ops->query_rx_desc(rtwdev, rx_desc, &pkt_stat, -- &rx_status); -- pkt_offset = pkt_desc_sz + pkt_stat.drv_info_sz + -- pkt_stat.shift; -- -- if (pkt_stat.is_c2h) { -- skb_put(skb, pkt_stat.pkt_len + pkt_offset); -- rtw_fw_c2h_cmd_rx_irqsafe(rtwdev, pkt_offset, skb); -- continue; -- } -- - if (skb_queue_len(&rtwusb->rx_queue) >= RTW_USB_MAX_RXQ_LEN) { - dev_dbg_ratelimited(rtwdev->dev, "failed to get rx_queue, overflow\n"); - dev_kfree_skb_any(skb); - continue; - } - -- skb_put(skb, pkt_stat.pkt_len); -- skb_reserve(skb, pkt_offset); -+ urb_len = skb->len; -+ -+ do { -+ rx_desc = skb->data; -+ chip->ops->query_rx_desc(rtwdev, rx_desc, &pkt_stat, -+ &rx_status); -+ pkt_offset = pkt_desc_sz + pkt_stat.drv_info_sz + -+ pkt_stat.shift; -+ -+ next_pkt = round_up(pkt_stat.pkt_len + pkt_offset, 8); -+ -+ if (urb_len >= next_pkt + pkt_desc_sz) -+ next_skb = skb_clone(skb, GFP_KERNEL); -+ else -+ next_skb = NULL; -+ -+ if (pkt_stat.is_c2h) { -+ skb_trim(skb, pkt_stat.pkt_len + pkt_offset); -+ rtw_fw_c2h_cmd_rx_irqsafe(rtwdev, pkt_offset, skb); -+ } else { -+ skb_pull(skb, pkt_offset); -+ skb_trim(skb, pkt_stat.pkt_len); -+ rtw_update_rx_freq_for_invalid(rtwdev, skb, -+ &rx_status, -+ &pkt_stat); -+ rtw_rx_stats(rtwdev, pkt_stat.vif, skb); -+ memcpy(skb->cb, &rx_status, sizeof(rx_status)); -+ ieee80211_rx_irqsafe(rtwdev->hw, skb); -+ } -+ -+ skb = next_skb; -+ if (skb) -+ skb_pull(skb, next_pkt); - -- rtw_update_rx_freq_for_invalid(rtwdev, skb, &rx_status, &pkt_stat); -- rtw_rx_stats(rtwdev, pkt_stat.vif, skb); -- memcpy(skb->cb, &rx_status, sizeof(rx_status)); -- ieee80211_rx_irqsafe(rtwdev->hw, skb); -+ urb_len -= next_pkt; -+ } while (skb); - } - } - -@@ -627,6 +645,7 @@ static void rtw_usb_read_port_complete(s - if (skb) - dev_kfree_skb_any(skb); - } else { -+ skb_put(skb, urb->actual_length); - skb_queue_tail(&rtwusb->rx_queue, skb); - queue_work(rtwusb->rxwq, &rtwusb->rx_work); - } diff --git a/package/kernel/mac80211/patches/rtl/013-v6.12-wifi-rtw88-Enable-USB-RX-aggregation-for-8822c-8822b.patch b/package/kernel/mac80211/patches/rtl/013-v6.12-wifi-rtw88-Enable-USB-RX-aggregation-for-8822c-8822b.patch deleted file mode 100644 index 71175324e6da6b..00000000000000 --- a/package/kernel/mac80211/patches/rtl/013-v6.12-wifi-rtw88-Enable-USB-RX-aggregation-for-8822c-8822b.patch +++ /dev/null @@ -1,168 +0,0 @@ -From 002a5db9a52a0e7af0fa9a450d31049748435748 Mon Sep 17 00:00:00 2001 -From: Bitterblue Smith -Date: Thu, 8 Aug 2024 01:23:06 +0300 -Subject: [PATCH] wifi: rtw88: Enable USB RX aggregation for 8822c/8822b/8821c - -Enable USB RX aggregation when there is at least 1 Mbps RX or TX -traffic, otherwise disable it. - -USB RX aggregation improves the RX speed of RTL8811CU on certain ARM -systems, like the NanoPi NEO Core2. Before: 28 Mbps, after: 231 Mbps. - -It also improves the RX speed of RTL8822CU on some x86_64 systems. -Before: ~200 Mbps, after: ~300 Mbps. - -The official drivers for these chips use the same logic for SDIO, but -for some reason the SDIO driver in rtw88 always enables RX aggregation, -so this patch only toggles aggregation for USB devices. - -RTL8703B is likely not found in USB devices, and RTL8723DU doesn't like -aggregation. - -Tested-by: Sascha Hauer -Signed-off-by: Bitterblue Smith -Signed-off-by: Ping-Ke Shih -Link: https://patch.msgid.link/b4c0d54c-6755-4b0f-9dd7-f9196fd74b68@gmail.com ---- - drivers/net/wireless/realtek/rtw88/hci.h | 7 ++++ - drivers/net/wireless/realtek/rtw88/main.c | 13 +++++--- - drivers/net/wireless/realtek/rtw88/pci.c | 1 + - drivers/net/wireless/realtek/rtw88/sdio.c | 1 + - drivers/net/wireless/realtek/rtw88/usb.c | 40 +++++++++++++++++++++++ - 5 files changed, 58 insertions(+), 4 deletions(-) - ---- a/drivers/net/wireless/realtek/rtw88/hci.h -+++ b/drivers/net/wireless/realtek/rtw88/hci.h -@@ -18,6 +18,7 @@ struct rtw_hci_ops { - void (*deep_ps)(struct rtw_dev *rtwdev, bool enter); - void (*link_ps)(struct rtw_dev *rtwdev, bool enter); - void (*interface_cfg)(struct rtw_dev *rtwdev); -+ void (*dynamic_rx_agg)(struct rtw_dev *rtwdev, bool enable); - - int (*write_data_rsvd_page)(struct rtw_dev *rtwdev, u8 *buf, u32 size); - int (*write_data_h2c)(struct rtw_dev *rtwdev, u8 *buf, u32 size); -@@ -72,6 +73,12 @@ static inline void rtw_hci_interface_cfg - rtwdev->hci.ops->interface_cfg(rtwdev); - } - -+static inline void rtw_hci_dynamic_rx_agg(struct rtw_dev *rtwdev, bool enable) -+{ -+ if (rtwdev->hci.ops->dynamic_rx_agg) -+ rtwdev->hci.ops->dynamic_rx_agg(rtwdev, enable); -+} -+ - static inline int - rtw_hci_write_data_rsvd_page(struct rtw_dev *rtwdev, u8 *buf, u32 size) - { ---- a/drivers/net/wireless/realtek/rtw88/main.c -+++ b/drivers/net/wireless/realtek/rtw88/main.c -@@ -212,6 +212,7 @@ static void rtw_watch_dog_work(struct wo - struct rtw_traffic_stats *stats = &rtwdev->stats; - struct rtw_watch_dog_iter_data data = {}; - bool busy_traffic = test_bit(RTW_FLAG_BUSY_TRAFFIC, rtwdev->flags); -+ u32 tx_unicast_mbps, rx_unicast_mbps; - bool ps_active; - - mutex_lock(&rtwdev->mutex); -@@ -236,10 +237,11 @@ static void rtw_watch_dog_work(struct wo - else - ps_active = false; - -- ewma_tp_add(&stats->tx_ewma_tp, -- (u32)(stats->tx_unicast >> RTW_TP_SHIFT)); -- ewma_tp_add(&stats->rx_ewma_tp, -- (u32)(stats->rx_unicast >> RTW_TP_SHIFT)); -+ tx_unicast_mbps = stats->tx_unicast >> RTW_TP_SHIFT; -+ rx_unicast_mbps = stats->rx_unicast >> RTW_TP_SHIFT; -+ -+ ewma_tp_add(&stats->tx_ewma_tp, tx_unicast_mbps); -+ ewma_tp_add(&stats->rx_ewma_tp, rx_unicast_mbps); - stats->tx_throughput = ewma_tp_read(&stats->tx_ewma_tp); - stats->rx_throughput = ewma_tp_read(&stats->rx_ewma_tp); - -@@ -259,6 +261,9 @@ static void rtw_watch_dog_work(struct wo - - rtw_phy_dynamic_mechanism(rtwdev); - -+ rtw_hci_dynamic_rx_agg(rtwdev, -+ tx_unicast_mbps >= 1 || rx_unicast_mbps >= 1); -+ - data.rtwdev = rtwdev; - /* rtw_iterate_vifs internally uses an atomic iterator which is needed - * to avoid taking local->iflist_mtx mutex ---- a/drivers/net/wireless/realtek/rtw88/pci.c -+++ b/drivers/net/wireless/realtek/rtw88/pci.c -@@ -1601,6 +1601,7 @@ static struct rtw_hci_ops rtw_pci_ops = - .deep_ps = rtw_pci_deep_ps, - .link_ps = rtw_pci_link_ps, - .interface_cfg = rtw_pci_interface_cfg, -+ .dynamic_rx_agg = NULL, - - .read8 = rtw_pci_read8, - .read16 = rtw_pci_read16, ---- a/drivers/net/wireless/realtek/rtw88/sdio.c -+++ b/drivers/net/wireless/realtek/rtw88/sdio.c -@@ -1157,6 +1157,7 @@ static struct rtw_hci_ops rtw_sdio_ops = - .deep_ps = rtw_sdio_deep_ps, - .link_ps = rtw_sdio_link_ps, - .interface_cfg = rtw_sdio_interface_cfg, -+ .dynamic_rx_agg = NULL, - - .read8 = rtw_sdio_read8, - .read16 = rtw_sdio_read16, ---- a/drivers/net/wireless/realtek/rtw88/usb.c -+++ b/drivers/net/wireless/realtek/rtw88/usb.c -@@ -766,6 +766,45 @@ static void rtw_usb_interface_cfg(struct - rtw_usb_init_burst_pkt_len(rtwdev); - } - -+static void rtw_usb_dynamic_rx_agg_v1(struct rtw_dev *rtwdev, bool enable) -+{ -+ u8 size, timeout; -+ u16 val16; -+ -+ rtw_write32_set(rtwdev, REG_RXDMA_AGG_PG_TH, BIT_EN_PRE_CALC); -+ rtw_write8_set(rtwdev, REG_TXDMA_PQ_MAP, BIT_RXDMA_AGG_EN); -+ rtw_write8_clr(rtwdev, REG_RXDMA_AGG_PG_TH + 3, BIT(7)); -+ -+ if (enable) { -+ size = 0x5; -+ timeout = 0x20; -+ } else { -+ size = 0x0; -+ timeout = 0x1; -+ } -+ val16 = u16_encode_bits(size, BIT_RXDMA_AGG_PG_TH) | -+ u16_encode_bits(timeout, BIT_DMA_AGG_TO_V1); -+ -+ rtw_write16(rtwdev, REG_RXDMA_AGG_PG_TH, val16); -+} -+ -+static void rtw_usb_dynamic_rx_agg(struct rtw_dev *rtwdev, bool enable) -+{ -+ switch (rtwdev->chip->id) { -+ case RTW_CHIP_TYPE_8822C: -+ case RTW_CHIP_TYPE_8822B: -+ case RTW_CHIP_TYPE_8821C: -+ rtw_usb_dynamic_rx_agg_v1(rtwdev, enable); -+ break; -+ case RTW_CHIP_TYPE_8723D: -+ /* Doesn't like aggregation. */ -+ break; -+ case RTW_CHIP_TYPE_8703B: -+ /* Likely not found in USB devices. */ -+ break; -+ } -+} -+ - static struct rtw_hci_ops rtw_usb_ops = { - .tx_write = rtw_usb_tx_write, - .tx_kick_off = rtw_usb_tx_kick_off, -@@ -775,6 +814,7 @@ static struct rtw_hci_ops rtw_usb_ops = - .deep_ps = rtw_usb_deep_ps, - .link_ps = rtw_usb_link_ps, - .interface_cfg = rtw_usb_interface_cfg, -+ .dynamic_rx_agg = rtw_usb_dynamic_rx_agg, - - .write8 = rtw_usb_write8, - .write16 = rtw_usb_write16, diff --git a/package/kernel/mac80211/patches/rtl/016-v6.12-wifi-rtw88-assign-mac_id-for-vif-sta-and-update-to-T.patch b/package/kernel/mac80211/patches/rtl/016-v6.12-wifi-rtw88-assign-mac_id-for-vif-sta-and-update-to-T.patch deleted file mode 100644 index ce110c5c90c1a0..00000000000000 --- a/package/kernel/mac80211/patches/rtl/016-v6.12-wifi-rtw88-assign-mac_id-for-vif-sta-and-update-to-T.patch +++ /dev/null @@ -1,231 +0,0 @@ -From 902cb7b11f9a7ff07233cc4c626b54c3e4703149 Mon Sep 17 00:00:00 2001 -From: Ping-Ke Shih -Date: Mon, 19 Aug 2024 10:52:48 +0800 -Subject: [PATCH] wifi: rtw88: assign mac_id for vif/sta and update to TX desc - -A mac_id as an instance in firmware has to be assigned for each station -including AP and connected stations. Firmware will use the mac_id to -control TX rate and do statistics. - -Assignment rule is to assign mac_id to each vif when adding vif. -For station mode, sta->mac_id will reuse vif->mac_id. For AP mode, -dynamically allocate an sta->mac_id to a station, and vif->mac_id is -used to send broadcast/multicast packets which are not belong to -a station. For example, - - vif->mac_id sta->mac_id -vif0 (STA mode) 0 0 -vif1 (AP mode) 1 2... - -By the way, remove unused RTW_BC_MC_MACID, which was planed to send -broadcast/multicast packets on fixed mac_id. - -Tested-on RTL8822CE with STA + AP SCC mode. - -Link: https://lore.kernel.org/linux-wireless/e4be0a75-43b2-4ae5-9aab-5c4a88e78097@gmail.com/ -Cc: Bitterblue Smith -Signed-off-by: Ping-Ke Shih -Link: https://patch.msgid.link/20240819025248.17939-1-pkshih@realtek.com ---- - drivers/net/wireless/realtek/rtw88/mac80211.c | 13 ++++++-- - drivers/net/wireless/realtek/rtw88/main.c | 30 ++++++++----------- - drivers/net/wireless/realtek/rtw88/main.h | 14 +++++++-- - drivers/net/wireless/realtek/rtw88/tx.c | 11 +++++-- - drivers/net/wireless/realtek/rtw88/tx.h | 1 + - 5 files changed, 44 insertions(+), 25 deletions(-) - ---- a/drivers/net/wireless/realtek/rtw88/mac80211.c -+++ b/drivers/net/wireless/realtek/rtw88/mac80211.c -@@ -167,6 +167,12 @@ static int rtw_ops_add_interface(struct - - mutex_lock(&rtwdev->mutex); - -+ rtwvif->mac_id = rtw_acquire_macid(rtwdev); -+ if (rtwvif->mac_id >= RTW_MAX_MAC_ID_NUM) { -+ mutex_unlock(&rtwdev->mutex); -+ return -ENOSPC; -+ } -+ - port = find_first_zero_bit(rtwdev->hw_port, RTW_PORT_NUM); - if (port >= RTW_PORT_NUM) { - mutex_unlock(&rtwdev->mutex); -@@ -214,7 +220,8 @@ static int rtw_ops_add_interface(struct - - mutex_unlock(&rtwdev->mutex); - -- rtw_dbg(rtwdev, RTW_DBG_STATE, "start vif %pM on port %d\n", vif->addr, rtwvif->port); -+ rtw_dbg(rtwdev, RTW_DBG_STATE, "start vif %pM mac_id %d on port %d\n", -+ vif->addr, rtwvif->mac_id, rtwvif->port); - return 0; - } - -@@ -225,7 +232,8 @@ static void rtw_ops_remove_interface(str - struct rtw_vif *rtwvif = (struct rtw_vif *)vif->drv_priv; - u32 config = 0; - -- rtw_dbg(rtwdev, RTW_DBG_STATE, "stop vif %pM on port %d\n", vif->addr, rtwvif->port); -+ rtw_dbg(rtwdev, RTW_DBG_STATE, "stop vif %pM mac_id %d on port %d\n", -+ vif->addr, rtwvif->mac_id, rtwvif->port); - - mutex_lock(&rtwdev->mutex); - -@@ -242,6 +250,7 @@ static void rtw_ops_remove_interface(str - config |= PORT_SET_BCN_CTRL; - rtw_vif_port_config(rtwdev, rtwvif, config); - clear_bit(rtwvif->port, rtwdev->hw_port); -+ rtw_release_macid(rtwdev, rtwvif->mac_id); - rtw_recalc_lps(rtwdev, NULL); - - mutex_unlock(&rtwdev->mutex); ---- a/drivers/net/wireless/realtek/rtw88/main.c -+++ b/drivers/net/wireless/realtek/rtw88/main.c -@@ -311,17 +311,6 @@ static void rtw_ips_work(struct work_str - mutex_unlock(&rtwdev->mutex); - } - --static u8 rtw_acquire_macid(struct rtw_dev *rtwdev) --{ -- unsigned long mac_id; -- -- mac_id = find_first_zero_bit(rtwdev->mac_id_map, RTW_MAX_MAC_ID_NUM); -- if (mac_id < RTW_MAX_MAC_ID_NUM) -- set_bit(mac_id, rtwdev->mac_id_map); -- -- return mac_id; --} -- - static void rtw_sta_rc_work(struct work_struct *work) - { - struct rtw_sta_info *si = container_of(work, struct rtw_sta_info, -@@ -340,12 +329,14 @@ int rtw_sta_add(struct rtw_dev *rtwdev, - struct rtw_vif *rtwvif = (struct rtw_vif *)vif->drv_priv; - int i; - -- si->mac_id = rtw_acquire_macid(rtwdev); -- if (si->mac_id >= RTW_MAX_MAC_ID_NUM) -- return -ENOSPC; -+ if (vif->type == NL80211_IFTYPE_STATION) { -+ si->mac_id = rtwvif->mac_id; -+ } else { -+ si->mac_id = rtw_acquire_macid(rtwdev); -+ if (si->mac_id >= RTW_MAX_MAC_ID_NUM) -+ return -ENOSPC; -+ } - -- if (vif->type == NL80211_IFTYPE_STATION && vif->cfg.assoc == 0) -- rtwvif->mac_id = si->mac_id; - si->rtwdev = rtwdev; - si->sta = sta; - si->vif = vif; -@@ -370,11 +361,13 @@ void rtw_sta_remove(struct rtw_dev *rtwd - bool fw_exist) - { - struct rtw_sta_info *si = (struct rtw_sta_info *)sta->drv_priv; -+ struct ieee80211_vif *vif = si->vif; - int i; - - cancel_work_sync(&si->rc_work); - -- rtw_release_macid(rtwdev, si->mac_id); -+ if (vif->type != NL80211_IFTYPE_STATION) -+ rtw_release_macid(rtwdev, si->mac_id); - if (fw_exist) - rtw_fw_media_status_report(rtwdev, si->mac_id, false); - -@@ -614,6 +607,8 @@ static void rtw_reset_vif_iter(void *dat - rtw_bf_disassoc(rtwdev, vif, NULL); - rtw_vif_assoc_changed(rtwvif, NULL); - rtw_txq_cleanup(rtwdev, vif->txq); -+ -+ rtw_release_macid(rtwdev, rtwvif->mac_id); - } - - void rtw_fw_recovery(struct rtw_dev *rtwdev) -@@ -2139,7 +2134,6 @@ int rtw_core_init(struct rtw_dev *rtwdev - rtwdev->sec.total_cam_num = 32; - rtwdev->hal.current_channel = 1; - rtwdev->dm_info.fix_rate = U8_MAX; -- set_bit(RTW_BC_MC_MACID, rtwdev->mac_id_map); - - rtw_stats_init(rtwdev); - ---- a/drivers/net/wireless/realtek/rtw88/main.h -+++ b/drivers/net/wireless/realtek/rtw88/main.h -@@ -742,7 +742,6 @@ struct rtw_txq { - unsigned long flags; - }; - --#define RTW_BC_MC_MACID 1 - DECLARE_EWMA(rssi, 10, 16); - - struct rtw_sta_info { -@@ -805,7 +804,7 @@ struct rtw_bf_info { - struct rtw_vif { - enum rtw_net_type net_type; - u16 aid; -- u8 mac_id; /* for STA mode only */ -+ u8 mac_id; - u8 mac_addr[ETH_ALEN]; - u8 bssid[ETH_ALEN]; - u8 port; -@@ -2131,6 +2130,17 @@ static inline bool rtw_chip_has_tx_stbc( - return rtwdev->chip->tx_stbc; - } - -+static inline u8 rtw_acquire_macid(struct rtw_dev *rtwdev) -+{ -+ unsigned long mac_id; -+ -+ mac_id = find_first_zero_bit(rtwdev->mac_id_map, RTW_MAX_MAC_ID_NUM); -+ if (mac_id < RTW_MAX_MAC_ID_NUM) -+ set_bit(mac_id, rtwdev->mac_id_map); -+ -+ return mac_id; -+} -+ - static inline void rtw_release_macid(struct rtw_dev *rtwdev, u8 mac_id) - { - clear_bit(mac_id, rtwdev->mac_id_map); ---- a/drivers/net/wireless/realtek/rtw88/tx.c -+++ b/drivers/net/wireless/realtek/rtw88/tx.c -@@ -46,7 +46,8 @@ void rtw_tx_fill_tx_desc(struct rtw_tx_p - le32_encode_bits(pkt_info->ls, RTW_TX_DESC_W0_LS) | - le32_encode_bits(pkt_info->dis_qselseq, RTW_TX_DESC_W0_DISQSELSEQ); - -- tx_desc->w1 = le32_encode_bits(pkt_info->qsel, RTW_TX_DESC_W1_QSEL) | -+ tx_desc->w1 = le32_encode_bits(pkt_info->mac_id, RTW_TX_DESC_W1_MACID) | -+ le32_encode_bits(pkt_info->qsel, RTW_TX_DESC_W1_QSEL) | - le32_encode_bits(pkt_info->rate_id, RTW_TX_DESC_W1_RATE_ID) | - le32_encode_bits(pkt_info->sec_type, RTW_TX_DESC_W1_SEC_TYPE) | - le32_encode_bits(pkt_info->pkt_offset, RTW_TX_DESC_W1_PKT_OFFSET) | -@@ -401,14 +402,18 @@ void rtw_tx_pkt_info_update(struct rtw_d - const struct rtw_chip_info *chip = rtwdev->chip; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; -+ struct ieee80211_vif *vif = info->control.vif; - struct rtw_sta_info *si; -- struct ieee80211_vif *vif = NULL; -+ struct rtw_vif *rtwvif; - __le16 fc = hdr->frame_control; - bool bmc; - - if (sta) { - si = (struct rtw_sta_info *)sta->drv_priv; -- vif = si->vif; -+ pkt_info->mac_id = si->mac_id; -+ } else if (vif) { -+ rtwvif = (struct rtw_vif *)vif->drv_priv; -+ pkt_info->mac_id = rtwvif->mac_id; - } - - if (ieee80211_is_mgmt(fc) || ieee80211_is_nullfunc(fc)) ---- a/drivers/net/wireless/realtek/rtw88/tx.h -+++ b/drivers/net/wireless/realtek/rtw88/tx.h -@@ -27,6 +27,7 @@ struct rtw_tx_desc { - #define RTW_TX_DESC_W0_BMC BIT(24) - #define RTW_TX_DESC_W0_LS BIT(26) - #define RTW_TX_DESC_W0_DISQSELSEQ BIT(31) -+#define RTW_TX_DESC_W1_MACID GENMASK(7, 0) - #define RTW_TX_DESC_W1_QSEL GENMASK(12, 8) - #define RTW_TX_DESC_W1_RATE_ID GENMASK(20, 16) - #define RTW_TX_DESC_W1_SEC_TYPE GENMASK(23, 22) diff --git a/package/kernel/mac80211/patches/rtl/019-v6.13-wifi-rtw88-Parse-the-RX-descriptor-with-a-single-fun.patch b/package/kernel/mac80211/patches/rtl/019-v6.13-wifi-rtw88-Parse-the-RX-descriptor-with-a-single-fun.patch index 9828f507b643eb..4a32831ea3e31d 100644 --- a/package/kernel/mac80211/patches/rtl/019-v6.13-wifi-rtw88-Parse-the-RX-descriptor-with-a-single-fun.patch +++ b/package/kernel/mac80211/patches/rtl/019-v6.13-wifi-rtw88-Parse-the-RX-descriptor-with-a-single-fun.patch @@ -547,7 +547,7 @@ Link: https://patch.msgid.link/913f1747-38fc-4409-85a4-57bb9cee506b@gmail.com --- a/drivers/net/wireless/realtek/rtw88/usb.c +++ b/drivers/net/wireless/realtek/rtw88/usb.c -@@ -570,8 +570,8 @@ static void rtw_usb_rx_handler(struct wo +@@ -571,8 +571,8 @@ static void rtw_usb_rx_handler(struct wo do { rx_desc = skb->data; diff --git a/package/kernel/mac80211/patches/rtl/020-v6.12-wifi-rtw88-Fix-the-RX-aggregation-in-USB-3-mode.patch b/package/kernel/mac80211/patches/rtl/020-v6.12-wifi-rtw88-Fix-the-RX-aggregation-in-USB-3-mode.patch deleted file mode 100644 index 174ee10816e6a3..00000000000000 --- a/package/kernel/mac80211/patches/rtl/020-v6.12-wifi-rtw88-Fix-the-RX-aggregation-in-USB-3-mode.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 4aefde403da7af30757915e0462d88398c9388c5 Mon Sep 17 00:00:00 2001 -From: Bitterblue Smith -Date: Tue, 8 Oct 2024 21:44:02 +0300 -Subject: [PATCH] wifi: rtw88: Fix the RX aggregation in USB 3 mode - -RTL8822CU, RTL8822BU, and RTL8821CU don't need BIT_EN_PRE_CALC. -In fact, RTL8822BU in USB 3 mode doesn't pass all the frames to the -driver, resulting in much lower download speed than normal: - -$ iperf3 -c 192.168.0.1 -R -Connecting to host 192.168.0.1, port 5201 -Reverse mode, remote host 192.168.0.1 is sending -[ 5] local 192.168.0.50 port 43062 connected to 192.168.0.1 port 5201 -[ ID] Interval Transfer Bitrate -[ 5] 0.00-1.00 sec 26.9 MBytes 225 Mbits/sec -[ 5] 1.00-2.00 sec 7.50 MBytes 62.9 Mbits/sec -[ 5] 2.00-3.00 sec 8.50 MBytes 71.3 Mbits/sec -[ 5] 3.00-4.00 sec 8.38 MBytes 70.3 Mbits/sec -[ 5] 4.00-5.00 sec 7.75 MBytes 65.0 Mbits/sec -[ 5] 5.00-6.00 sec 8.00 MBytes 67.1 Mbits/sec -[ 5] 6.00-7.00 sec 8.00 MBytes 67.1 Mbits/sec -[ 5] 7.00-8.00 sec 7.75 MBytes 65.0 Mbits/sec -[ 5] 8.00-9.00 sec 7.88 MBytes 66.1 Mbits/sec -[ 5] 9.00-10.00 sec 7.88 MBytes 66.1 Mbits/sec -- - - - - - - - - - - - - - - - - - - - - - - - - -[ ID] Interval Transfer Bitrate Retr -[ 5] 0.00-10.02 sec 102 MBytes 85.1 Mbits/sec 224 sender -[ 5] 0.00-10.00 sec 98.6 MBytes 82.7 Mbits/sec receiver - -Don't set BIT_EN_PRE_CALC. Then the speed is much better: - -% iperf3 -c 192.168.0.1 -R -Connecting to host 192.168.0.1, port 5201 -Reverse mode, remote host 192.168.0.1 is sending -[ 5] local 192.168.0.50 port 39000 connected to 192.168.0.1 port 5201 -[ ID] Interval Transfer Bitrate -[ 5] 0.00-1.00 sec 52.8 MBytes 442 Mbits/sec -[ 5] 1.00-2.00 sec 71.9 MBytes 603 Mbits/sec -[ 5] 2.00-3.00 sec 74.8 MBytes 627 Mbits/sec -[ 5] 3.00-4.00 sec 75.9 MBytes 636 Mbits/sec -[ 5] 4.00-5.00 sec 76.0 MBytes 638 Mbits/sec -[ 5] 5.00-6.00 sec 74.1 MBytes 622 Mbits/sec -[ 5] 6.00-7.00 sec 74.0 MBytes 621 Mbits/sec -[ 5] 7.00-8.00 sec 76.0 MBytes 638 Mbits/sec -[ 5] 8.00-9.00 sec 74.4 MBytes 624 Mbits/sec -[ 5] 9.00-10.00 sec 63.9 MBytes 536 Mbits/sec -- - - - - - - - - - - - - - - - - - - - - - - - - -[ ID] Interval Transfer Bitrate Retr -[ 5] 0.00-10.00 sec 717 MBytes 601 Mbits/sec 24 sender -[ 5] 0.00-10.00 sec 714 MBytes 599 Mbits/sec receiver - -Fixes: 002a5db9a52a ("wifi: rtw88: Enable USB RX aggregation for 8822c/8822b/8821c") -Signed-off-by: Bitterblue Smith -Acked-by: Ping-Ke Shih -Signed-off-by: Kalle Valo -Link: https://patch.msgid.link/afb94a82-3d18-459e-97fc-1a217608cdf0@gmail.com ---- - drivers/net/wireless/realtek/rtw88/usb.c | 1 - - 1 file changed, 1 deletion(-) - ---- a/drivers/net/wireless/realtek/rtw88/usb.c -+++ b/drivers/net/wireless/realtek/rtw88/usb.c -@@ -771,7 +771,6 @@ static void rtw_usb_dynamic_rx_agg_v1(st - u8 size, timeout; - u16 val16; - -- rtw_write32_set(rtwdev, REG_RXDMA_AGG_PG_TH, BIT_EN_PRE_CALC); - rtw_write8_set(rtwdev, REG_TXDMA_PQ_MAP, BIT_RXDMA_AGG_EN); - rtw_write8_clr(rtwdev, REG_RXDMA_AGG_PG_TH + 3, BIT(7)); - diff --git a/package/kernel/mac80211/patches/rtl/030-v6.13-wifi-rtw88-Enable-data-rate-fallback-for-older-chips.patch b/package/kernel/mac80211/patches/rtl/030-v6.13-wifi-rtw88-Enable-data-rate-fallback-for-older-chips.patch index 153c04ee20fd60..944985edc97ad5 100644 --- a/package/kernel/mac80211/patches/rtl/030-v6.13-wifi-rtw88-Enable-data-rate-fallback-for-older-chips.patch +++ b/package/kernel/mac80211/patches/rtl/030-v6.13-wifi-rtw88-Enable-data-rate-fallback-for-older-chips.patch @@ -174,7 +174,7 @@ Link: https://patch.msgid.link/2b3e3e6f-541b-4a3b-8ca3-65b267e6a95a@gmail.com void rtw_tx_rsvd_page_pkt_info_update(struct rtw_dev *rtwdev, --- a/drivers/net/wireless/realtek/rtw88/usb.c +++ b/drivers/net/wireless/realtek/rtw88/usb.c -@@ -457,7 +457,7 @@ static int rtw_usb_write_data(struct rtw +@@ -458,7 +458,7 @@ static int rtw_usb_write_data(struct rtw skb_put_data(skb, buf, size); skb_push(skb, chip->tx_pkt_desc_sz); memset(skb->data, 0, chip->tx_pkt_desc_sz); @@ -183,7 +183,7 @@ Link: https://patch.msgid.link/2b3e3e6f-541b-4a3b-8ca3-65b267e6a95a@gmail.com rtw_tx_fill_txdesc_checksum(rtwdev, pkt_info, skb->data); ret = rtw_usb_write_port(rtwdev, qsel, skb, -@@ -524,7 +524,7 @@ static int rtw_usb_tx_write(struct rtw_d +@@ -525,7 +525,7 @@ static int rtw_usb_tx_write(struct rtw_d pkt_desc = skb_push(skb, chip->tx_pkt_desc_sz); memset(pkt_desc, 0, chip->tx_pkt_desc_sz); ep = qsel_to_ep(rtwusb, pkt_info->qsel); diff --git a/package/kernel/mac80211/patches/rtl/034-v6.13-wifi-rtw88-usb-Set-pkt_info.ls-for-the-reserved-page.patch b/package/kernel/mac80211/patches/rtl/034-v6.13-wifi-rtw88-usb-Set-pkt_info.ls-for-the-reserved-page.patch index 7c6e13586080fc..67d7d230f4ee7b 100644 --- a/package/kernel/mac80211/patches/rtl/034-v6.13-wifi-rtw88-usb-Set-pkt_info.ls-for-the-reserved-page.patch +++ b/package/kernel/mac80211/patches/rtl/034-v6.13-wifi-rtw88-usb-Set-pkt_info.ls-for-the-reserved-page.patch @@ -17,7 +17,7 @@ Link: https://patch.msgid.link/e443f5d9-4b53-4f64-985c-64313ec80bef@gmail.com --- a/drivers/net/wireless/realtek/rtw88/usb.c +++ b/drivers/net/wireless/realtek/rtw88/usb.c -@@ -477,6 +477,7 @@ static int rtw_usb_write_data_rsvd_page( +@@ -478,6 +478,7 @@ static int rtw_usb_write_data_rsvd_page( pkt_info.tx_pkt_size = size; pkt_info.qsel = TX_DESC_QSEL_BEACON; pkt_info.offset = chip->tx_pkt_desc_sz; diff --git a/package/kernel/mac80211/patches/rtl/048-wifi-rtw88-usb-Support-USB-3-with-RTL8812AU.patch b/package/kernel/mac80211/patches/rtl/048-wifi-rtw88-usb-Support-USB-3-with-RTL8812AU.patch index 2ccefb98939022..33ca91d77d8c2f 100644 --- a/package/kernel/mac80211/patches/rtl/048-wifi-rtw88-usb-Support-USB-3-with-RTL8812AU.patch +++ b/package/kernel/mac80211/patches/rtl/048-wifi-rtw88-usb-Support-USB-3-with-RTL8812AU.patch @@ -12,7 +12,7 @@ Signed-off-by: Bitterblue Smith --- a/drivers/net/wireless/realtek/rtw88/usb.c +++ b/drivers/net/wireless/realtek/rtw88/usb.c -@@ -929,6 +929,32 @@ static void rtw_usb_intf_deinit(struct r +@@ -930,6 +930,32 @@ static void rtw_usb_intf_deinit(struct r usb_set_intfdata(intf, NULL); } @@ -45,7 +45,7 @@ Signed-off-by: Bitterblue Smith static int rtw_usb_switch_mode_new(struct rtw_dev *rtwdev) { enum usb_device_speed cur_speed; -@@ -982,7 +1008,8 @@ static int rtw_usb_switch_mode(struct rt +@@ -983,7 +1009,8 @@ static int rtw_usb_switch_mode(struct rt { u8 id = rtwdev->chip->id; @@ -55,7 +55,7 @@ Signed-off-by: Bitterblue Smith return 0; if (!rtwdev->efuse.usb_mode_switch) { -@@ -997,7 +1024,10 @@ static int rtw_usb_switch_mode(struct rt +@@ -998,7 +1025,10 @@ static int rtw_usb_switch_mode(struct rt return 0; } diff --git a/package/kernel/mac80211/patches/rtl/049-wifi-rtw88-usb-Enable-RX-aggregation-for-8821au-8812.patch b/package/kernel/mac80211/patches/rtl/049-wifi-rtw88-usb-Enable-RX-aggregation-for-8821au-8812.patch index 00775c0281e99b..d4c3ef3495702a 100644 --- a/package/kernel/mac80211/patches/rtl/049-wifi-rtw88-usb-Enable-RX-aggregation-for-8821au-8812.patch +++ b/package/kernel/mac80211/patches/rtl/049-wifi-rtw88-usb-Enable-RX-aggregation-for-8821au-8812.patch @@ -19,7 +19,7 @@ Signed-off-by: Bitterblue Smith --- a/drivers/net/wireless/realtek/rtw88/usb.c +++ b/drivers/net/wireless/realtek/rtw88/usb.c -@@ -788,6 +788,32 @@ static void rtw_usb_dynamic_rx_agg_v1(st +@@ -789,6 +789,32 @@ static void rtw_usb_dynamic_rx_agg_v1(st rtw_write16(rtwdev, REG_RXDMA_AGG_PG_TH, val16); } @@ -52,7 +52,7 @@ Signed-off-by: Bitterblue Smith static void rtw_usb_dynamic_rx_agg(struct rtw_dev *rtwdev, bool enable) { switch (rtwdev->chip->id) { -@@ -796,6 +822,10 @@ static void rtw_usb_dynamic_rx_agg(struc +@@ -797,6 +823,10 @@ static void rtw_usb_dynamic_rx_agg(struc case RTW_CHIP_TYPE_8821C: rtw_usb_dynamic_rx_agg_v1(rtwdev, enable); break; diff --git a/package/kernel/mac80211/patches/subsys/130-disable_auto_vif.patch b/package/kernel/mac80211/patches/subsys/130-disable_auto_vif.patch index eea165ccca9bf9..c9496b5e709cd3 100644 --- a/package/kernel/mac80211/patches/subsys/130-disable_auto_vif.patch +++ b/package/kernel/mac80211/patches/subsys/130-disable_auto_vif.patch @@ -1,6 +1,6 @@ --- a/net/mac80211/main.c +++ b/net/mac80211/main.c -@@ -1581,24 +1581,6 @@ int ieee80211_register_hw(struct ieee802 +@@ -1583,24 +1583,6 @@ int ieee80211_register_hw(struct ieee802 ieee80211_check_wbrf_support(local); diff --git a/package/kernel/mac80211/patches/subsys/220-allow-ibss-mixed.patch b/package/kernel/mac80211/patches/subsys/220-allow-ibss-mixed.patch index 55376362a5b41c..378ca275f5ba80 100644 --- a/package/kernel/mac80211/patches/subsys/220-allow-ibss-mixed.patch +++ b/package/kernel/mac80211/patches/subsys/220-allow-ibss-mixed.patch @@ -16,7 +16,7 @@ and we should ignore this. --- a/net/wireless/core.c +++ b/net/wireless/core.c -@@ -654,21 +654,6 @@ static int wiphy_verify_combinations(str +@@ -678,21 +678,6 @@ int wiphy_verify_iface_combinations(stru c->limits[j].max > 1)) return -EINVAL; diff --git a/package/kernel/mac80211/patches/subsys/310-cfg80211-allow-grace-period-for-DFS-available-after-.patch b/package/kernel/mac80211/patches/subsys/310-cfg80211-allow-grace-period-for-DFS-available-after-.patch index 7e9be59e044348..c86b836f2f5616 100644 --- a/package/kernel/mac80211/patches/subsys/310-cfg80211-allow-grace-period-for-DFS-available-after-.patch +++ b/package/kernel/mac80211/patches/subsys/310-cfg80211-allow-grace-period-for-DFS-available-after-.patch @@ -113,7 +113,7 @@ Signed-off-by: Felix Fietkau { --- a/net/wireless/core.h +++ b/net/wireless/core.h -@@ -467,6 +467,8 @@ void cfg80211_set_dfs_state(struct wiphy +@@ -475,6 +475,8 @@ void cfg80211_set_dfs_state(struct wiphy enum nl80211_dfs_state dfs_state); void cfg80211_dfs_channels_update_work(struct work_struct *work); @@ -124,7 +124,7 @@ Signed-off-by: Felix Fietkau --- a/net/wireless/mlme.c +++ b/net/wireless/mlme.c -@@ -1037,6 +1037,8 @@ void cfg80211_dfs_channels_update_work(s +@@ -1031,6 +1031,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; @@ -133,7 +133,7 @@ Signed-off-by: Felix Fietkau } else { if (regulatory_pre_cac_allowed(wiphy) || cfg80211_any_wiphy_oper_chan(wiphy, c)) -@@ -1044,11 +1046,10 @@ void cfg80211_dfs_channels_update_work(s +@@ -1038,11 +1040,10 @@ void cfg80211_dfs_channels_update_work(s time_dfs_update = REG_PRE_CAC_EXPIRY_GRACE_MS; radar_event = NL80211_RADAR_PRE_CAC_EXPIRED; diff --git a/package/kernel/mac80211/patches/subsys/320-mac80211-add-AQL-support-for-broadcast-packets.patch b/package/kernel/mac80211/patches/subsys/320-mac80211-add-AQL-support-for-broadcast-packets.patch index c03f40d9b4f5c2..9513dc14bc34da 100644 --- a/package/kernel/mac80211/patches/subsys/320-mac80211-add-AQL-support-for-broadcast-packets.patch +++ b/package/kernel/mac80211/patches/subsys/320-mac80211-add-AQL-support-for-broadcast-packets.patch @@ -85,7 +85,7 @@ Signed-off-by: Felix Fietkau const struct ieee80211_ops *ops; --- a/net/mac80211/main.c +++ b/net/mac80211/main.c -@@ -952,6 +952,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ +@@ -954,6 +954,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ spin_lock_init(&local->rx_path_lock); spin_lock_init(&local->queue_stop_reason_lock); diff --git a/package/kernel/mac80211/patches/subsys/321-wifi-mac80211-do-not-pass-a-stopped-vif-to-the-drive.patch b/package/kernel/mac80211/patches/subsys/321-wifi-mac80211-do-not-pass-a-stopped-vif-to-the-drive.patch deleted file mode 100644 index f48fa38e5e96ab..00000000000000 --- a/package/kernel/mac80211/patches/subsys/321-wifi-mac80211-do-not-pass-a-stopped-vif-to-the-drive.patch +++ /dev/null @@ -1,24 +0,0 @@ -From: Felix Fietkau -Date: Wed, 2 Oct 2024 11:45:35 +0200 -Subject: [PATCH] wifi: mac80211: do not pass a stopped vif to the driver in - .get_txpower - -Avoid potentially crashing in the driver because of uninitialized private data - -Fixes: 5b3dc42b1b0d ("mac80211: add support for driver tx power reporting") -Cc: stable@vger.kernel.org -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -3134,7 +3134,8 @@ static int ieee80211_get_tx_power(struct - struct ieee80211_local *local = wiphy_priv(wiphy); - struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev); - -- if (local->ops->get_txpower) -+ if (local->ops->get_txpower && -+ (sdata->flags & IEEE80211_SDATA_IN_DRIVER)) - return drv_get_txpower(local, sdata, dbm); - - if (local->emulate_chanctx) diff --git a/package/kernel/mac80211/patches/subsys/350-wifi-cfg80211-add-option-for-vif-allowed-radios.patch b/package/kernel/mac80211/patches/subsys/330-wifi-cfg80211-add-option-for-vif-allowed-radios.patch similarity index 96% rename from package/kernel/mac80211/patches/subsys/350-wifi-cfg80211-add-option-for-vif-allowed-radios.patch rename to package/kernel/mac80211/patches/subsys/330-wifi-cfg80211-add-option-for-vif-allowed-radios.patch index d5b42f3a3a519d..3b09c46f28a554 100644 --- a/package/kernel/mac80211/patches/subsys/350-wifi-cfg80211-add-option-for-vif-allowed-radios.patch +++ b/package/kernel/mac80211/patches/subsys/330-wifi-cfg80211-add-option-for-vif-allowed-radios.patch @@ -23,15 +23,15 @@ Signed-off-by: Felix Fietkau --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h -@@ -6227,6 +6227,7 @@ enum ieee80211_ap_reg_power { +@@ -6271,6 +6271,7 @@ enum ieee80211_ap_reg_power { * entered. - * @links[].cac_time_ms: CAC time in ms + * @links.cac_time_ms: CAC time in ms * @valid_links: bitmap describing what elements of @links are valid + * @radio_mask: Bitmask of radios that this interface is allowed to operate on. */ struct wireless_dev { struct wiphy *wiphy; -@@ -6339,6 +6340,8 @@ struct wireless_dev { +@@ -6383,6 +6384,8 @@ struct wireless_dev { unsigned int cac_time_ms; } links[IEEE80211_MLD_MAX_NUM_LINKS]; u16 valid_links; @@ -40,7 +40,7 @@ Signed-off-by: Felix Fietkau }; static inline const u8 *wdev_address(struct wireless_dev *wdev) -@@ -6525,6 +6528,17 @@ bool cfg80211_radio_chandef_valid(const +@@ -6569,6 +6572,17 @@ bool cfg80211_radio_chandef_valid(const const struct cfg80211_chan_def *chandef); /** @@ -246,7 +246,7 @@ Signed-off-by: Felix Fietkau continue; for (i = 0; i < rdev_req->n_channels; i++) { -@@ -3490,9 +3491,12 @@ int cfg80211_wext_siwscan(struct net_dev +@@ -3519,9 +3520,12 @@ int cfg80211_wext_siwscan(struct net_dev continue; for (j = 0; j < wiphy->bands[band]->n_channels; j++) { @@ -298,7 +298,7 @@ Signed-off-by: Felix Fietkau +EXPORT_SYMBOL(cfg80211_wdev_channel_allowed); --- a/net/wireless/core.c +++ b/net/wireless/core.c -@@ -1415,6 +1415,8 @@ void cfg80211_init_wdev(struct wireless_ +@@ -1424,6 +1424,8 @@ void cfg80211_init_wdev(struct wireless_ /* allow mac80211 to determine the timeout */ wdev->ps_timeout = -1; diff --git a/package/kernel/mac80211/patches/subsys/330-wifi-mac80211-introduce-EHT-rate-support-in-AQL-airt.patch b/package/kernel/mac80211/patches/subsys/330-wifi-mac80211-introduce-EHT-rate-support-in-AQL-airt.patch deleted file mode 100644 index 0a3c8ec53b21a3..00000000000000 --- a/package/kernel/mac80211/patches/subsys/330-wifi-mac80211-introduce-EHT-rate-support-in-AQL-airt.patch +++ /dev/null @@ -1,233 +0,0 @@ -From: Ming Yen Hsieh -Date: Wed, 4 Sep 2024 19:12:56 +0800 -Subject: [PATCH] wifi: mac80211: introduce EHT rate support in AQL airtime - -Add definitions related to EHT mode and airtime calculation -according to the 802.11BE_D4.0. - -Co-developed-by: Bo Jiao -Signed-off-by: Bo Jiao -Signed-off-by: Deren Wu -Signed-off-by: Quan Zhou -Signed-off-by: Ming Yen Hsieh -Link: https://patch.msgid.link/20240904111256.11734-1-mingyen.hsieh@mediatek.com -Signed-off-by: Johannes Berg ---- - ---- a/net/mac80211/airtime.c -+++ b/net/mac80211/airtime.c -@@ -55,10 +55,21 @@ - #define HE_DURATION_S(shift, streams, gi, bps) \ - (HE_DURATION(streams, gi, bps) >> shift) - -+/* gi in HE/EHT is identical. It matches enum nl80211_eht_gi as well */ -+#define EHT_GI_08 HE_GI_08 -+#define EHT_GI_16 HE_GI_16 -+#define EHT_GI_32 HE_GI_32 -+ -+#define EHT_DURATION(streams, gi, bps) \ -+ HE_DURATION(streams, gi, bps) -+#define EHT_DURATION_S(shift, streams, gi, bps) \ -+ HE_DURATION_S(shift, streams, gi, bps) -+ - #define BW_20 0 - #define BW_40 1 - #define BW_80 2 - #define BW_160 3 -+#define BW_320 4 - - /* - * Define group sort order: HT40 -> SGI -> #streams -@@ -68,17 +79,26 @@ - #define IEEE80211_VHT_STREAM_GROUPS 8 /* BW(=4) * SGI(=2) */ - - #define IEEE80211_HE_MAX_STREAMS 8 -+#define IEEE80211_HE_STREAM_GROUPS 12 /* BW(=4) * GI(=3) */ -+ -+#define IEEE80211_EHT_MAX_STREAMS 8 -+#define IEEE80211_EHT_STREAM_GROUPS 15 /* BW(=5) * GI(=3) */ - - #define IEEE80211_HT_GROUPS_NB (IEEE80211_MAX_STREAMS * \ - IEEE80211_HT_STREAM_GROUPS) - #define IEEE80211_VHT_GROUPS_NB (IEEE80211_MAX_STREAMS * \ - IEEE80211_VHT_STREAM_GROUPS) -+#define IEEE80211_HE_GROUPS_NB (IEEE80211_HE_MAX_STREAMS * \ -+ IEEE80211_HE_STREAM_GROUPS) -+#define IEEE80211_EHT_GROUPS_NB (IEEE80211_EHT_MAX_STREAMS * \ -+ IEEE80211_EHT_STREAM_GROUPS) - - #define IEEE80211_HT_GROUP_0 0 - #define IEEE80211_VHT_GROUP_0 (IEEE80211_HT_GROUP_0 + IEEE80211_HT_GROUPS_NB) - #define IEEE80211_HE_GROUP_0 (IEEE80211_VHT_GROUP_0 + IEEE80211_VHT_GROUPS_NB) -+#define IEEE80211_EHT_GROUP_0 (IEEE80211_HE_GROUP_0 + IEEE80211_HE_GROUPS_NB) - --#define MCS_GROUP_RATES 12 -+#define MCS_GROUP_RATES 14 - - #define HT_GROUP_IDX(_streams, _sgi, _ht40) \ - IEEE80211_HT_GROUP_0 + \ -@@ -203,6 +223,69 @@ - #define HE_GROUP(_streams, _gi, _bw) \ - __HE_GROUP(_streams, _gi, _bw, \ - HE_GROUP_SHIFT(_streams, _gi, _bw)) -+ -+#define EHT_BW2VBPS(_bw, r5, r4, r3, r2, r1) \ -+ ((_bw) == BW_320 ? r5 : BW2VBPS(_bw, r4, r3, r2, r1)) -+ -+#define EHT_GROUP_IDX(_streams, _gi, _bw) \ -+ (IEEE80211_EHT_GROUP_0 + \ -+ IEEE80211_EHT_MAX_STREAMS * 3 * (_bw) + \ -+ IEEE80211_EHT_MAX_STREAMS * (_gi) + \ -+ (_streams) - 1) -+ -+#define __EHT_GROUP(_streams, _gi, _bw, _s) \ -+ [EHT_GROUP_IDX(_streams, _gi, _bw)] = { \ -+ .shift = _s, \ -+ .duration = { \ -+ EHT_DURATION_S(_s, _streams, _gi, \ -+ EHT_BW2VBPS(_bw, 1960, 980, 490, 234, 117)), \ -+ EHT_DURATION_S(_s, _streams, _gi, \ -+ EHT_BW2VBPS(_bw, 3920, 1960, 980, 468, 234)), \ -+ EHT_DURATION_S(_s, _streams, _gi, \ -+ EHT_BW2VBPS(_bw, 5880, 2937, 1470, 702, 351)), \ -+ EHT_DURATION_S(_s, _streams, _gi, \ -+ EHT_BW2VBPS(_bw, 7840, 3920, 1960, 936, 468)), \ -+ EHT_DURATION_S(_s, _streams, _gi, \ -+ EHT_BW2VBPS(_bw, 11760, 5880, 2940, 1404, 702)), \ -+ EHT_DURATION_S(_s, _streams, _gi, \ -+ EHT_BW2VBPS(_bw, 15680, 7840, 3920, 1872, 936)), \ -+ EHT_DURATION_S(_s, _streams, _gi, \ -+ EHT_BW2VBPS(_bw, 17640, 8820, 4410, 2106, 1053)), \ -+ EHT_DURATION_S(_s, _streams, _gi, \ -+ EHT_BW2VBPS(_bw, 19600, 9800, 4900, 2340, 1170)), \ -+ EHT_DURATION_S(_s, _streams, _gi, \ -+ EHT_BW2VBPS(_bw, 23520, 11760, 5880, 2808, 1404)), \ -+ EHT_DURATION_S(_s, _streams, _gi, \ -+ EHT_BW2VBPS(_bw, 26133, 13066, 6533, 3120, 1560)), \ -+ EHT_DURATION_S(_s, _streams, _gi, \ -+ EHT_BW2VBPS(_bw, 29400, 14700, 7350, 3510, 1755)), \ -+ EHT_DURATION_S(_s, _streams, _gi, \ -+ EHT_BW2VBPS(_bw, 32666, 16333, 8166, 3900, 1950)), \ -+ EHT_DURATION_S(_s, _streams, _gi, \ -+ EHT_BW2VBPS(_bw, 35280, 17640, 8820, 4212, 2106)), \ -+ EHT_DURATION_S(_s, _streams, _gi, \ -+ EHT_BW2VBPS(_bw, 39200, 19600, 9800, 4680, 2340)) \ -+ } \ -+} -+ -+#define EHT_GROUP_SHIFT(_streams, _gi, _bw) \ -+ GROUP_SHIFT(EHT_DURATION(_streams, _gi, \ -+ EHT_BW2VBPS(_bw, 1960, 980, 490, 234, 117))) -+ -+#define EHT_GROUP(_streams, _gi, _bw) \ -+ __EHT_GROUP(_streams, _gi, _bw, \ -+ EHT_GROUP_SHIFT(_streams, _gi, _bw)) -+ -+#define EHT_GROUP_RANGE(_gi, _bw) \ -+ EHT_GROUP(1, _gi, _bw), \ -+ EHT_GROUP(2, _gi, _bw), \ -+ EHT_GROUP(3, _gi, _bw), \ -+ EHT_GROUP(4, _gi, _bw), \ -+ EHT_GROUP(5, _gi, _bw), \ -+ EHT_GROUP(6, _gi, _bw), \ -+ EHT_GROUP(7, _gi, _bw), \ -+ EHT_GROUP(8, _gi, _bw) -+ - struct mcs_group { - u8 shift; - u16 duration[MCS_GROUP_RATES]; -@@ -376,6 +459,26 @@ static const struct mcs_group airtime_mc - HE_GROUP(6, HE_GI_32, BW_160), - HE_GROUP(7, HE_GI_32, BW_160), - HE_GROUP(8, HE_GI_32, BW_160), -+ -+ EHT_GROUP_RANGE(EHT_GI_08, BW_20), -+ EHT_GROUP_RANGE(EHT_GI_16, BW_20), -+ EHT_GROUP_RANGE(EHT_GI_32, BW_20), -+ -+ EHT_GROUP_RANGE(EHT_GI_08, BW_40), -+ EHT_GROUP_RANGE(EHT_GI_16, BW_40), -+ EHT_GROUP_RANGE(EHT_GI_32, BW_40), -+ -+ EHT_GROUP_RANGE(EHT_GI_08, BW_80), -+ EHT_GROUP_RANGE(EHT_GI_16, BW_80), -+ EHT_GROUP_RANGE(EHT_GI_32, BW_80), -+ -+ EHT_GROUP_RANGE(EHT_GI_08, BW_160), -+ EHT_GROUP_RANGE(EHT_GI_16, BW_160), -+ EHT_GROUP_RANGE(EHT_GI_32, BW_160), -+ -+ EHT_GROUP_RANGE(EHT_GI_08, BW_320), -+ EHT_GROUP_RANGE(EHT_GI_16, BW_320), -+ EHT_GROUP_RANGE(EHT_GI_32, BW_320), - }; - - static u32 -@@ -422,6 +525,9 @@ static u32 ieee80211_get_rate_duration(s - case RATE_INFO_BW_160: - bw = BW_160; - break; -+ case RATE_INFO_BW_320: -+ bw = BW_320; -+ break; - default: - WARN_ON_ONCE(1); - return 0; -@@ -443,14 +549,27 @@ static u32 ieee80211_get_rate_duration(s - idx = status->rate_idx; - group = HE_GROUP_IDX(streams, status->he_gi, bw); - break; -+ case RX_ENC_EHT: -+ streams = status->nss; -+ idx = status->rate_idx; -+ group = EHT_GROUP_IDX(streams, status->eht.gi, bw); -+ break; - default: - WARN_ON_ONCE(1); - return 0; - } - -- if (WARN_ON_ONCE((status->encoding != RX_ENC_HE && streams > 4) || -- (status->encoding == RX_ENC_HE && streams > 8))) -- return 0; -+ switch (status->encoding) { -+ case RX_ENC_EHT: -+ case RX_ENC_HE: -+ if (WARN_ON_ONCE(streams > 8)) -+ return 0; -+ break; -+ default: -+ if (WARN_ON_ONCE(streams > 4)) -+ return 0; -+ break; -+ } - - if (idx >= MCS_GROUP_RATES) - return 0; -@@ -517,7 +636,9 @@ static bool ieee80211_fill_rate_info(str - stat->nss = ri->nss; - stat->rate_idx = ri->mcs; - -- if (ri->flags & RATE_INFO_FLAGS_HE_MCS) -+ if (ri->flags & RATE_INFO_FLAGS_EHT_MCS) -+ stat->encoding = RX_ENC_EHT; -+ else if (ri->flags & RATE_INFO_FLAGS_HE_MCS) - stat->encoding = RX_ENC_HE; - else if (ri->flags & RATE_INFO_FLAGS_VHT_MCS) - stat->encoding = RX_ENC_VHT; -@@ -529,7 +650,14 @@ static bool ieee80211_fill_rate_info(str - if (ri->flags & RATE_INFO_FLAGS_SHORT_GI) - stat->enc_flags |= RX_ENC_FLAG_SHORT_GI; - -- stat->he_gi = ri->he_gi; -+ switch (stat->encoding) { -+ case RX_ENC_EHT: -+ stat->eht.gi = ri->eht_gi; -+ break; -+ default: -+ stat->he_gi = ri->he_gi; -+ break; -+ } - - if (stat->encoding != RX_ENC_LEGACY) - return true; diff --git a/package/kernel/mac80211/patches/subsys/331-wifi-cfg80211-check-radio-iface-combination-for-mult.patch b/package/kernel/mac80211/patches/subsys/331-wifi-cfg80211-check-radio-iface-combination-for-mult.patch deleted file mode 100644 index 76c351aa831f59..00000000000000 --- a/package/kernel/mac80211/patches/subsys/331-wifi-cfg80211-check-radio-iface-combination-for-mult.patch +++ /dev/null @@ -1,122 +0,0 @@ -From: Karthikeyan Periyasamy -Date: Tue, 17 Sep 2024 19:32:39 +0530 -Subject: [PATCH] wifi: cfg80211: check radio iface combination for multi radio - per wiphy - -Currently, wiphy_verify_combinations() fails for the multi-radio per wiphy -due to the condition check on new global interface combination that DFS -only works on one channel. In a multi-radio scenario, new global interface -combination encompasses the capabilities of all radio combinations, so it -supports more than one channel with DFS. For multi-radio per wiphy, -interface combination verification needs to be performed for radio specific -interface combinations. This is necessary as the new global interface -combination combines the capabilities of all radio combinations. - -Fixes: a01b1e9f9955 ("wifi: mac80211: add support for DFS with multiple radios") -Signed-off-by: Karthikeyan Periyasamy ---- - ---- a/net/wireless/core.c -+++ b/net/wireless/core.c -@@ -599,16 +599,20 @@ use_default_name: - } - EXPORT_SYMBOL(wiphy_new_nm); - --static int wiphy_verify_combinations(struct wiphy *wiphy) -+static -+int wiphy_verify_iface_combinations(struct wiphy *wiphy, -+ const struct ieee80211_iface_combination *iface_comb, -+ int n_iface_comb, -+ bool combined_radio) - { - const struct ieee80211_iface_combination *c; - int i, j; - -- for (i = 0; i < wiphy->n_iface_combinations; i++) { -+ for (i = 0; i < n_iface_comb; i++) { - u32 cnt = 0; - u16 all_iftypes = 0; - -- c = &wiphy->iface_combinations[i]; -+ c = &iface_comb[i]; - - /* - * Combinations with just one interface aren't real, -@@ -621,9 +625,13 @@ static int wiphy_verify_combinations(str - if (WARN_ON(!c->num_different_channels)) - return -EINVAL; - -- /* DFS only works on one channel. */ -- if (WARN_ON(c->radar_detect_widths && -- (c->num_different_channels > 1))) -+ /* DFS only works on one channel. Avoid this check -+ * for multi-radio global combination, since it hold -+ * the capabilities of all radio combinations. -+ */ -+ if (!combined_radio && -+ WARN_ON(c->radar_detect_widths && -+ c->num_different_channels > 1)) - return -EINVAL; - - if (WARN_ON(!c->n_limits)) -@@ -644,13 +652,21 @@ static int wiphy_verify_combinations(str - if (WARN_ON(wiphy->software_iftypes & types)) - return -EINVAL; - -- /* Only a single P2P_DEVICE can be allowed */ -- if (WARN_ON(types & BIT(NL80211_IFTYPE_P2P_DEVICE) && -+ /* Only a single P2P_DEVICE can be allowed, avoid this -+ * check for multi-radio global combination, since it -+ * hold the capabilities of all radio combinations. -+ */ -+ if (!combined_radio && -+ WARN_ON(types & BIT(NL80211_IFTYPE_P2P_DEVICE) && - c->limits[j].max > 1)) - return -EINVAL; - -- /* Only a single NAN can be allowed */ -- if (WARN_ON(types & BIT(NL80211_IFTYPE_NAN) && -+ /* Only a single NAN can be allowed, avoid this -+ * check for multi-radio global combination, since it -+ * hold the capabilities of all radio combinations. -+ */ -+ if (!combined_radio && -+ WARN_ON(types & BIT(NL80211_IFTYPE_NAN) && - c->limits[j].max > 1)) - return -EINVAL; - -@@ -674,6 +690,34 @@ static int wiphy_verify_combinations(str - return 0; - } - -+static int wiphy_verify_combinations(struct wiphy *wiphy) -+{ -+ int i, ret; -+ bool combined_radio = false; -+ -+ if (wiphy->n_radio) { -+ for (i = 0; i < wiphy->n_radio; i++) { -+ const struct wiphy_radio *radio = &wiphy->radio[i]; -+ -+ ret = wiphy_verify_iface_combinations(wiphy, -+ radio->iface_combinations, -+ radio->n_iface_combinations, -+ false); -+ if (ret) -+ return ret; -+ } -+ -+ combined_radio = true; -+ } -+ -+ ret = wiphy_verify_iface_combinations(wiphy, -+ wiphy->iface_combinations, -+ wiphy->n_iface_combinations, -+ combined_radio); -+ -+ return ret; -+} -+ - int wiphy_register(struct wiphy *wiphy) - { - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); diff --git a/package/kernel/mac80211/patches/subsys/351-wifi-mac80211-use-vif-radio-mask-to-limit-ibss-scan-.patch b/package/kernel/mac80211/patches/subsys/331-wifi-mac80211-use-vif-radio-mask-to-limit-ibss-scan-.patch similarity index 88% rename from package/kernel/mac80211/patches/subsys/351-wifi-mac80211-use-vif-radio-mask-to-limit-ibss-scan-.patch rename to package/kernel/mac80211/patches/subsys/331-wifi-mac80211-use-vif-radio-mask-to-limit-ibss-scan-.patch index 7363c3873f6a2e..779857fe88ac1d 100644 --- a/package/kernel/mac80211/patches/subsys/351-wifi-mac80211-use-vif-radio-mask-to-limit-ibss-scan-.patch +++ b/package/kernel/mac80211/patches/subsys/331-wifi-mac80211-use-vif-radio-mask-to-limit-ibss-scan-.patch @@ -10,7 +10,7 @@ Signed-off-by: Felix Fietkau --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c -@@ -1178,14 +1178,14 @@ int ieee80211_request_ibss_scan(struct i +@@ -1176,14 +1176,14 @@ int ieee80211_request_ibss_scan(struct i unsigned int n_channels) { struct ieee80211_local *local = sdata->local; @@ -27,7 +27,7 @@ Signed-off-by: Felix Fietkau /* fill internal scan request */ if (!channels) { -@@ -1202,7 +1202,9 @@ int ieee80211_request_ibss_scan(struct i +@@ -1200,7 +1200,9 @@ int ieee80211_request_ibss_scan(struct i &local->hw.wiphy->bands[band]->channels[i]; if (tmp_ch->flags & (IEEE80211_CHAN_NO_IR | @@ -38,7 +38,7 @@ Signed-off-by: Felix Fietkau continue; local->int_scan_req->channels[n_ch] = tmp_ch; -@@ -1211,21 +1213,23 @@ int ieee80211_request_ibss_scan(struct i +@@ -1209,21 +1211,23 @@ int ieee80211_request_ibss_scan(struct i } if (WARN_ON_ONCE(n_ch == 0)) @@ -66,7 +66,7 @@ Signed-off-by: Felix Fietkau local->int_scan_req->n_channels = n_ch; } -@@ -1235,9 +1239,7 @@ int ieee80211_request_ibss_scan(struct i +@@ -1233,9 +1237,7 @@ int ieee80211_request_ibss_scan(struct i memcpy(local->int_scan_req->ssids[0].ssid, ssid, IEEE80211_MAX_SSID_LEN); local->int_scan_req->ssids[0].ssid_len = ssid_len; diff --git a/package/kernel/mac80211/patches/subsys/332-wifi-cfg80211-Set-correct-chandef-when-starting-CAC.patch b/package/kernel/mac80211/patches/subsys/332-wifi-cfg80211-Set-correct-chandef-when-starting-CAC.patch deleted file mode 100644 index 72a3510aacfff1..00000000000000 --- a/package/kernel/mac80211/patches/subsys/332-wifi-cfg80211-Set-correct-chandef-when-starting-CAC.patch +++ /dev/null @@ -1,64 +0,0 @@ -From: Issam Hamdi -Date: Fri, 16 Aug 2024 16:24:18 +0200 -Subject: [PATCH] wifi: cfg80211: Set correct chandef when starting CAC - -When starting CAC in a mode other than AP mode, it return a -"WARNING: CPU: 0 PID: 63 at cfg80211_chandef_dfs_usable+0x20/0xaf [cfg80211]" -caused by the chandef.chan being null at the end of CAC. - -Solution: Ensure the channel definition is set for the different modes -when starting CAC to avoid getting a NULL 'chan' at the end of CAC. - - Call Trace: - ? show_regs.part.0+0x14/0x16 - ? __warn+0x67/0xc0 - ? cfg80211_chandef_dfs_usable+0x20/0xaf [cfg80211] - ? report_bug+0xa7/0x130 - ? exc_overflow+0x30/0x30 - ? handle_bug+0x27/0x50 - ? exc_invalid_op+0x18/0x60 - ? handle_exception+0xf6/0xf6 - ? exc_overflow+0x30/0x30 - ? cfg80211_chandef_dfs_usable+0x20/0xaf [cfg80211] - ? exc_overflow+0x30/0x30 - ? cfg80211_chandef_dfs_usable+0x20/0xaf [cfg80211] - ? regulatory_propagate_dfs_state.cold+0x1b/0x4c [cfg80211] - ? cfg80211_propagate_cac_done_wk+0x1a/0x30 [cfg80211] - ? process_one_work+0x165/0x280 - ? worker_thread+0x120/0x3f0 - ? kthread+0xc2/0xf0 - ? process_one_work+0x280/0x280 - ? kthread_complete_and_exit+0x20/0x20 - ? ret_from_fork+0x19/0x24 - -Reported-by: Kretschmer Mathias -Signed-off-by: Issam Hamdi -Link: https://patch.msgid.link/20240816142418.3381951-1-ih@simonwunderlich.de -[shorten subject, remove OCB, reorder cases to match previous list] -Signed-off-by: Johannes Berg ---- - ---- a/net/wireless/nl80211.c -+++ b/net/wireless/nl80211.c -@@ -10144,7 +10144,20 @@ static int nl80211_start_radar_detection - - err = rdev_start_radar_detection(rdev, dev, &chandef, cac_time_ms); - if (!err) { -- wdev->links[0].ap.chandef = chandef; -+ switch (wdev->iftype) { -+ case NL80211_IFTYPE_AP: -+ case NL80211_IFTYPE_P2P_GO: -+ wdev->links[0].ap.chandef = chandef; -+ break; -+ case NL80211_IFTYPE_ADHOC: -+ wdev->u.ibss.chandef = chandef; -+ break; -+ case NL80211_IFTYPE_MESH_POINT: -+ wdev->u.mesh.chandef = chandef; -+ break; -+ default: -+ break; -+ } - wdev->cac_started = true; - wdev->cac_start_time = jiffies; - wdev->cac_time_ms = cac_time_ms; diff --git a/package/kernel/mac80211/patches/subsys/352-wifi-mac80211-use-vif-radio-mask-to-limit-chanctx-an.patch b/package/kernel/mac80211/patches/subsys/332-wifi-mac80211-use-vif-radio-mask-to-limit-chanctx-an.patch similarity index 86% rename from package/kernel/mac80211/patches/subsys/352-wifi-mac80211-use-vif-radio-mask-to-limit-chanctx-an.patch rename to package/kernel/mac80211/patches/subsys/332-wifi-mac80211-use-vif-radio-mask-to-limit-chanctx-an.patch index ac3d1011489a1b..0c8c894eaaaf8d 100644 --- a/package/kernel/mac80211/patches/subsys/352-wifi-mac80211-use-vif-radio-mask-to-limit-chanctx-an.patch +++ b/package/kernel/mac80211/patches/subsys/332-wifi-mac80211-use-vif-radio-mask-to-limit-chanctx-an.patch @@ -9,7 +9,7 @@ Signed-off-by: Felix Fietkau --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c -@@ -1167,7 +1167,7 @@ ieee80211_replace_chanctx(struct ieee802 +@@ -1169,7 +1169,7 @@ ieee80211_replace_chanctx(struct ieee802 static bool ieee80211_find_available_radio(struct ieee80211_local *local, const struct ieee80211_chan_req *chanreq, @@ -18,7 +18,7 @@ Signed-off-by: Felix Fietkau { struct wiphy *wiphy = local->hw.wiphy; const struct wiphy_radio *radio; -@@ -1178,6 +1178,9 @@ ieee80211_find_available_radio(struct ie +@@ -1180,6 +1180,9 @@ ieee80211_find_available_radio(struct ie return true; for (i = 0; i < wiphy->n_radio; i++) { @@ -28,7 +28,7 @@ Signed-off-by: Felix Fietkau radio = &wiphy->radio[i]; if (!cfg80211_radio_chandef_valid(radio, &chanreq->oper)) continue; -@@ -1211,7 +1214,9 @@ int ieee80211_link_reserve_chanctx(struc +@@ -1213,7 +1216,9 @@ int ieee80211_link_reserve_chanctx(struc new_ctx = ieee80211_find_reservation_chanctx(local, chanreq, mode); if (!new_ctx) { if (ieee80211_can_create_new_chanctx(local, -1) && @@ -39,7 +39,7 @@ Signed-off-by: Felix Fietkau new_ctx = ieee80211_new_chanctx(local, chanreq, mode, false, radio_idx); else -@@ -1881,7 +1886,9 @@ int _ieee80211_link_use_channel(struct i +@@ -1883,7 +1888,9 @@ int _ieee80211_link_use_channel(struct i /* Note: context is now reserved */ if (ctx) reserved = true; diff --git a/package/kernel/mac80211/patches/subsys/333-Revert-wifi-mac80211-move-radar-detect-work-to-sdata.patch b/package/kernel/mac80211/patches/subsys/333-Revert-wifi-mac80211-move-radar-detect-work-to-sdata.patch deleted file mode 100644 index d12df8f53ea8b6..00000000000000 --- a/package/kernel/mac80211/patches/subsys/333-Revert-wifi-mac80211-move-radar-detect-work-to-sdata.patch +++ /dev/null @@ -1,136 +0,0 @@ -From: Aditya Kumar Singh -Date: Fri, 6 Sep 2024 12:14:19 +0530 -Subject: [PATCH] Revert "wifi: mac80211: move radar detect work to sdata" -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This reverts commit ce9e660ef32e ("wifi: mac80211: move radar detect work to sdata"). - -To enable radar detection with MLO, it’s essential to handle it on a -per-link basis. This is because when using MLO, multiple links may already -be active and beaconing. In this scenario, another link should be able to -initiate a radar detection. Also, if underlying links are associated with -different hardware devices but grouped together for MLO, they could -potentially start radar detection simultaneously. Therefore, it makes -sense to manage radar detection settings separately for each link by moving -them back to a per-link data structure. - -Signed-off-by: Aditya Kumar Singh -Link: https://patch.msgid.link/20240906064426.2101315-2-quic_adisi@quicinc.com -Signed-off-by: Johannes Berg ---- - ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -1658,7 +1658,7 @@ static int ieee80211_stop_ap(struct wiph - - if (sdata->wdev.cac_started) { - chandef = link_conf->chanreq.oper; -- wiphy_delayed_work_cancel(wiphy, &sdata->dfs_cac_timer_work); -+ wiphy_delayed_work_cancel(wiphy, &link->dfs_cac_timer_work); - cfg80211_cac_event(sdata->dev, &chandef, - NL80211_RADAR_CAC_ABORTED, - GFP_KERNEL); -@@ -3482,7 +3482,7 @@ static int ieee80211_start_radar_detecti - if (err) - goto out_unlock; - -- wiphy_delayed_work_queue(wiphy, &sdata->dfs_cac_timer_work, -+ wiphy_delayed_work_queue(wiphy, &sdata->deflink.dfs_cac_timer_work, - msecs_to_jiffies(cac_time_ms)); - - out_unlock: -@@ -3499,7 +3499,7 @@ static void ieee80211_end_cac(struct wip - - list_for_each_entry(sdata, &local->interfaces, list) { - wiphy_delayed_work_cancel(wiphy, -- &sdata->dfs_cac_timer_work); -+ &sdata->deflink.dfs_cac_timer_work); - - if (sdata->wdev.cac_started) { - ieee80211_link_release_channel(&sdata->deflink); ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -1069,6 +1069,7 @@ struct ieee80211_link_data { - int ap_power_level; /* in dBm */ - - bool radar_required; -+ struct wiphy_delayed_work dfs_cac_timer_work; - - union { - struct ieee80211_link_data_managed mgd; -@@ -1167,8 +1168,6 @@ struct ieee80211_sub_if_data { - struct ieee80211_link_data deflink; - struct ieee80211_link_data __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS]; - -- struct wiphy_delayed_work dfs_cac_timer_work; -- - /* for ieee80211_set_active_links_async() */ - struct wiphy_work activate_links_work; - u16 desired_active_links; ---- a/net/mac80211/iface.c -+++ b/net/mac80211/iface.c -@@ -551,7 +551,7 @@ static void ieee80211_do_stop(struct iee - wiphy_work_cancel(local->hw.wiphy, - &sdata->deflink.color_change_finalize_work); - wiphy_delayed_work_cancel(local->hw.wiphy, -- &sdata->dfs_cac_timer_work); -+ &sdata->deflink.dfs_cac_timer_work); - - if (sdata->wdev.cac_started) { - chandef = sdata->vif.bss_conf.chanreq.oper; -@@ -1744,8 +1744,6 @@ static void ieee80211_setup_sdata(struct - wiphy_work_init(&sdata->work, ieee80211_iface_work); - wiphy_work_init(&sdata->activate_links_work, - ieee80211_activate_links_work); -- wiphy_delayed_work_init(&sdata->dfs_cac_timer_work, -- ieee80211_dfs_cac_timer_work); - - switch (type) { - case NL80211_IFTYPE_P2P_GO: ---- a/net/mac80211/link.c -+++ b/net/mac80211/link.c -@@ -45,6 +45,8 @@ void ieee80211_link_init(struct ieee8021 - ieee80211_color_collision_detection_work); - INIT_LIST_HEAD(&link->assigned_chanctx_list); - INIT_LIST_HEAD(&link->reserved_chanctx_list); -+ wiphy_delayed_work_init(&link->dfs_cac_timer_work, -+ ieee80211_dfs_cac_timer_work); - - if (!deflink) { - switch (sdata->vif.type) { ---- a/net/mac80211/mlme.c -+++ b/net/mac80211/mlme.c -@@ -3031,15 +3031,16 @@ void ieee80211_dynamic_ps_timer(struct t - - void ieee80211_dfs_cac_timer_work(struct wiphy *wiphy, struct wiphy_work *work) - { -- struct ieee80211_sub_if_data *sdata = -- container_of(work, struct ieee80211_sub_if_data, -+ struct ieee80211_link_data *link = -+ container_of(work, struct ieee80211_link_data, - dfs_cac_timer_work.work); -- struct cfg80211_chan_def chandef = sdata->vif.bss_conf.chanreq.oper; -+ struct cfg80211_chan_def chandef = link->conf->chanreq.oper; -+ struct ieee80211_sub_if_data *sdata = link->sdata; - - lockdep_assert_wiphy(sdata->local->hw.wiphy); - - if (sdata->wdev.cac_started) { -- ieee80211_link_release_channel(&sdata->deflink); -+ ieee80211_link_release_channel(link); - cfg80211_cac_event(sdata->dev, &chandef, - NL80211_RADAR_CAC_FINISHED, - GFP_KERNEL); ---- a/net/mac80211/util.c -+++ b/net/mac80211/util.c -@@ -3460,7 +3460,7 @@ void ieee80211_dfs_cac_cancel(struct iee - - list_for_each_entry(sdata, &local->interfaces, list) { - wiphy_delayed_work_cancel(local->hw.wiphy, -- &sdata->dfs_cac_timer_work); -+ &sdata->deflink.dfs_cac_timer_work); - - if (sdata->wdev.cac_started) { - chandef = sdata->vif.bss_conf.chanreq.oper; diff --git a/package/kernel/mac80211/patches/subsys/353-wifi-mac80211-remove-status-ampdu_delimiter_crc.patch b/package/kernel/mac80211/patches/subsys/333-wifi-mac80211-remove-status-ampdu_delimiter_crc.patch similarity index 100% rename from package/kernel/mac80211/patches/subsys/353-wifi-mac80211-remove-status-ampdu_delimiter_crc.patch rename to package/kernel/mac80211/patches/subsys/333-wifi-mac80211-remove-status-ampdu_delimiter_crc.patch diff --git a/package/kernel/mac80211/patches/subsys/354-wifi-cfg80211-pass-net_device-to-.set_monitor_channel.patch b/package/kernel/mac80211/patches/subsys/334-wifi-cfg80211-pass-net_device-to-.set_monitor_channel.patch similarity index 98% rename from package/kernel/mac80211/patches/subsys/354-wifi-cfg80211-pass-net_device-to-.set_monitor_channel.patch rename to package/kernel/mac80211/patches/subsys/334-wifi-cfg80211-pass-net_device-to-.set_monitor_channel.patch index c2a915963c2de6..ef8a36a9af7ae5 100644 --- a/package/kernel/mac80211/patches/subsys/354-wifi-cfg80211-pass-net_device-to-.set_monitor_channel.patch +++ b/package/kernel/mac80211/patches/subsys/334-wifi-cfg80211-pass-net_device-to-.set_monitor_channel.patch @@ -88,7 +88,7 @@ Signed-off-by: Felix Fietkau bool cfg80211_any_usable_channels(struct wiphy *wiphy, --- a/net/wireless/core.h +++ b/net/wireless/core.h -@@ -510,6 +510,7 @@ static inline unsigned int elapsed_jiffi +@@ -518,6 +518,7 @@ static inline unsigned int elapsed_jiffi } int cfg80211_set_monitor_channel(struct cfg80211_registered_device *rdev, diff --git a/package/kernel/mac80211/patches/subsys/334-wifi-mac80211-remove-label-usage-in-ieee80211_start_.patch b/package/kernel/mac80211/patches/subsys/334-wifi-mac80211-remove-label-usage-in-ieee80211_start_.patch deleted file mode 100644 index 329b6454628073..00000000000000 --- a/package/kernel/mac80211/patches/subsys/334-wifi-mac80211-remove-label-usage-in-ieee80211_start_.patch +++ /dev/null @@ -1,50 +0,0 @@ -From: Aditya Kumar Singh -Date: Fri, 6 Sep 2024 12:14:20 +0530 -Subject: [PATCH] wifi: mac80211: remove label usage in - ieee80211_start_radar_detection() - -After locks rework [1], ieee80211_start_radar_detection() function is no -longer acquiring any lock as such explicitly. Hence, it is not unlocking -anything as well. However, label "out_unlock" is still used which creates -confusion. Also, now there is no need of goto label as such. - -Get rid of the goto logic and use direct return statements. - -[1]: https://lore.kernel.org/all/20230828135928.b1c6efffe9ad.I4aec875e25abc9ef0b5ad1e70b5747fd483fbd3c@changeid/ - -Signed-off-by: Aditya Kumar Singh -Link: https://patch.msgid.link/20240906064426.2101315-3-quic_adisi@quicinc.com -Signed-off-by: Johannes Berg ---- - ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -3468,10 +3468,8 @@ static int ieee80211_start_radar_detecti - - lockdep_assert_wiphy(local->hw.wiphy); - -- if (!list_empty(&local->roc_list) || local->scanning) { -- err = -EBUSY; -- goto out_unlock; -- } -+ if (!list_empty(&local->roc_list) || local->scanning) -+ return -EBUSY; - - /* whatever, but channel contexts should not complain about that one */ - sdata->deflink.smps_mode = IEEE80211_SMPS_OFF; -@@ -3480,13 +3478,12 @@ static int ieee80211_start_radar_detecti - err = ieee80211_link_use_channel(&sdata->deflink, &chanreq, - IEEE80211_CHANCTX_SHARED); - if (err) -- goto out_unlock; -+ return err; - - wiphy_delayed_work_queue(wiphy, &sdata->deflink.dfs_cac_timer_work, - msecs_to_jiffies(cac_time_ms)); - -- out_unlock: -- return err; -+ return 0; - } - - static void ieee80211_end_cac(struct wiphy *wiphy, diff --git a/package/kernel/mac80211/patches/subsys/355-wifi-mac80211-add-flag-to-opt-out-of-virtual-monitor.patch b/package/kernel/mac80211/patches/subsys/335-wifi-mac80211-add-flag-to-opt-out-of-virtual-monitor.patch similarity index 93% rename from package/kernel/mac80211/patches/subsys/355-wifi-mac80211-add-flag-to-opt-out-of-virtual-monitor.patch rename to package/kernel/mac80211/patches/subsys/335-wifi-mac80211-add-flag-to-opt-out-of-virtual-monitor.patch index 2510cb0dbe95f1..604abfd43fc74d 100644 --- a/package/kernel/mac80211/patches/subsys/355-wifi-mac80211-add-flag-to-opt-out-of-virtual-monitor.patch +++ b/package/kernel/mac80211/patches/subsys/335-wifi-mac80211-add-flag-to-opt-out-of-virtual-monitor.patch @@ -95,7 +95,7 @@ Signed-off-by: Felix Fietkau if (ret) return ret; done: -@@ -3049,7 +3057,8 @@ static int ieee80211_set_tx_power(struct +@@ -3050,7 +3058,8 @@ static int ieee80211_set_tx_power(struct if (wdev) { sdata = IEEE80211_WDEV_TO_SUB_IF(wdev); @@ -105,7 +105,7 @@ Signed-off-by: Felix Fietkau if (!ieee80211_hw_check(&local->hw, WANT_MONITOR_VIF)) return -EOPNOTSUPP; -@@ -3097,7 +3106,8 @@ static int ieee80211_set_tx_power(struct +@@ -3098,7 +3107,8 @@ static int ieee80211_set_tx_power(struct } list_for_each_entry(sdata, &local->interfaces, list) { @@ -115,7 +115,7 @@ Signed-off-by: Felix Fietkau has_monitor = true; continue; } -@@ -3107,7 +3117,8 @@ static int ieee80211_set_tx_power(struct +@@ -3108,7 +3118,8 @@ static int ieee80211_set_tx_power(struct sdata->vif.bss_conf.txpower_type = txp_type; } list_for_each_entry(sdata, &local->interfaces, list) { @@ -125,7 +125,7 @@ Signed-off-by: Felix Fietkau continue; ieee80211_recalc_txpower(sdata, update_txp_type); } -@@ -4299,7 +4310,8 @@ static int ieee80211_cfg_get_channel(str +@@ -4303,7 +4314,8 @@ static int ieee80211_cfg_get_channel(str if (chanctx_conf) { *chandef = link->conf->chanreq.oper; ret = 0; @@ -137,7 +137,7 @@ Signed-off-by: Felix Fietkau *chandef = local->monitor_chanreq.oper; --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c -@@ -337,6 +337,10 @@ ieee80211_get_chanctx_max_required_bw(st +@@ -339,6 +339,10 @@ ieee80211_get_chanctx_max_required_bw(st case NL80211_IFTYPE_P2P_DEVICE: case NL80211_IFTYPE_NAN: continue; @@ -148,7 +148,7 @@ Signed-off-by: Felix Fietkau case NL80211_IFTYPE_ADHOC: case NL80211_IFTYPE_MESH_POINT: case NL80211_IFTYPE_OCB: -@@ -345,7 +349,6 @@ ieee80211_get_chanctx_max_required_bw(st +@@ -347,7 +351,6 @@ ieee80211_get_chanctx_max_required_bw(st case NL80211_IFTYPE_WDS: case NL80211_IFTYPE_UNSPECIFIED: case NUM_NL80211_IFTYPES: @@ -156,7 +156,7 @@ Signed-off-by: Felix Fietkau case NL80211_IFTYPE_P2P_CLIENT: case NL80211_IFTYPE_P2P_GO: WARN_ON_ONCE(1); -@@ -954,6 +957,10 @@ void ieee80211_recalc_smps_chanctx(struc +@@ -956,6 +959,10 @@ void ieee80211_recalc_smps_chanctx(struc if (!link->sdata->u.mgd.associated) continue; break; @@ -167,7 +167,7 @@ Signed-off-by: Felix Fietkau case NL80211_IFTYPE_AP: case NL80211_IFTYPE_ADHOC: case NL80211_IFTYPE_MESH_POINT: -@@ -966,6 +973,11 @@ void ieee80211_recalc_smps_chanctx(struc +@@ -968,6 +975,11 @@ void ieee80211_recalc_smps_chanctx(struc if (rcu_access_pointer(link->conf->chanctx_conf) != &chanctx->conf) continue; @@ -296,8 +296,8 @@ Signed-off-by: Felix Fietkau } --- a/net/mac80211/util.c +++ b/net/mac80211/util.c -@@ -754,7 +754,8 @@ static void __iterate_interfaces(struct - list_for_each_entry_rcu(sdata, &local->interfaces, list) { +@@ -739,7 +739,8 @@ static void __iterate_interfaces(struct + lockdep_is_held(&local->hw.wiphy->mtx)) { switch (sdata->vif.type) { case NL80211_IFTYPE_MONITOR: - if (!(sdata->u.mntr.flags & MONITOR_FLAG_ACTIVE)) @@ -306,7 +306,7 @@ Signed-off-by: Felix Fietkau continue; break; case NL80211_IFTYPE_AP_VLAN: -@@ -1857,8 +1858,10 @@ int ieee80211_reconfig(struct ieee80211_ +@@ -1856,8 +1857,10 @@ int ieee80211_reconfig(struct ieee80211_ } list_for_each_entry(sdata, &local->interfaces, list) { @@ -318,7 +318,7 @@ Signed-off-by: Felix Fietkau ieee80211_sdata_running(sdata)) { res = drv_add_interface(local, sdata); if (WARN_ON(res)) -@@ -1871,11 +1874,14 @@ int ieee80211_reconfig(struct ieee80211_ +@@ -1870,11 +1873,14 @@ int ieee80211_reconfig(struct ieee80211_ */ if (res) { list_for_each_entry_continue_reverse(sdata, &local->interfaces, diff --git a/package/kernel/mac80211/patches/subsys/335-wifi-trace-unlink-rdev_end_cac-trace-event-from-wiph.patch b/package/kernel/mac80211/patches/subsys/335-wifi-trace-unlink-rdev_end_cac-trace-event-from-wiph.patch deleted file mode 100644 index 98bc0c26fdb8f2..00000000000000 --- a/package/kernel/mac80211/patches/subsys/335-wifi-trace-unlink-rdev_end_cac-trace-event-from-wiph.patch +++ /dev/null @@ -1,42 +0,0 @@ -From: Aditya Kumar Singh -Date: Fri, 6 Sep 2024 12:14:21 +0530 -Subject: [PATCH] wifi: trace: unlink rdev_end_cac trace event from - wiphy_netdev_evt class - -rdev_end_cac trace event is linked with wiphy_netdev_evt event class. -There is no option to pass link ID currently to wiphy_netdev_evt class. -A subsequent change would pass link ID to rdev_end_cac event and hence -it can no longer derive the event class from wiphy_netdev_evt. - -Therefore, unlink rdev_end_cac event from wiphy_netdev_evt and define it's -own independent trace event. Link ID would be passed in subsequent change. - -Signed-off-by: Aditya Kumar Singh -Link: https://patch.msgid.link/20240906064426.2101315-4-quic_adisi@quicinc.com -Signed-off-by: Johannes Berg ---- - ---- a/net/wireless/trace.h -+++ b/net/wireless/trace.h -@@ -805,9 +805,18 @@ DEFINE_EVENT(wiphy_netdev_evt, rdev_flus - TP_ARGS(wiphy, netdev) - ); - --DEFINE_EVENT(wiphy_netdev_evt, rdev_end_cac, -- TP_PROTO(struct wiphy *wiphy, struct net_device *netdev), -- TP_ARGS(wiphy, netdev) -+TRACE_EVENT(rdev_end_cac, -+ TP_PROTO(struct wiphy *wiphy, struct net_device *netdev), -+ TP_ARGS(wiphy, netdev), -+ TP_STRUCT__entry( -+ WIPHY_ENTRY -+ NETDEV_ENTRY -+ ), -+ TP_fast_assign( -+ WIPHY_ASSIGN; -+ NETDEV_ASSIGN; -+ ), -+ TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT, WIPHY_PR_ARG, NETDEV_PR_ARG) - ); - - DECLARE_EVENT_CLASS(station_add_change, diff --git a/package/kernel/mac80211/patches/subsys/356-wifi-cfg80211-add-monitor-SKIP_TX-flag.patch b/package/kernel/mac80211/patches/subsys/336-wifi-cfg80211-add-monitor-SKIP_TX-flag.patch similarity index 100% rename from package/kernel/mac80211/patches/subsys/356-wifi-cfg80211-add-monitor-SKIP_TX-flag.patch rename to package/kernel/mac80211/patches/subsys/336-wifi-cfg80211-add-monitor-SKIP_TX-flag.patch diff --git a/package/kernel/mac80211/patches/subsys/336-wifi-cfg80211-move-DFS-related-members-to-links-in-w.patch b/package/kernel/mac80211/patches/subsys/336-wifi-cfg80211-move-DFS-related-members-to-links-in-w.patch deleted file mode 100644 index 95dac04de5e411..00000000000000 --- a/package/kernel/mac80211/patches/subsys/336-wifi-cfg80211-move-DFS-related-members-to-links-in-w.patch +++ /dev/null @@ -1,309 +0,0 @@ -From: Aditya Kumar Singh -Date: Fri, 6 Sep 2024 12:14:22 +0530 -Subject: [PATCH] wifi: cfg80211: move DFS related members to links[] in - wireless_dev - -A few members related to DFS handling are currently under per wireless -device data structure. However, in order to support DFS with MLO, there is -a need to have them on a per-link manner. - -Hence, as a preliminary step, move members cac_started, cac_start_time -and cac_time_ms to be on a per-link basis. - -Since currently, link ID is not known at all places, use default value of -0 for now. - -Signed-off-by: Aditya Kumar Singh -Link: https://patch.msgid.link/20240906064426.2101315-5-quic_adisi@quicinc.com -Signed-off-by: Johannes Berg ---- - ---- a/drivers/net/wireless/marvell/mwifiex/11h.c -+++ b/drivers/net/wireless/marvell/mwifiex/11h.c -@@ -117,7 +117,7 @@ void mwifiex_dfs_cac_work_queue(struct w - dfs_cac_work); - - chandef = priv->dfs_chandef; -- if (priv->wdev.cac_started) { -+ if (priv->wdev.links[0].cac_started) { - mwifiex_dbg(priv->adapter, MSG, - "CAC timer finished; No radar detected\n"); - cfg80211_cac_event(priv->netdev, &chandef, -@@ -174,7 +174,7 @@ int mwifiex_stop_radar_detection(struct - */ - void mwifiex_abort_cac(struct mwifiex_private *priv) - { -- if (priv->wdev.cac_started) { -+ if (priv->wdev.links[0].cac_started) { - if (mwifiex_stop_radar_detection(priv, &priv->dfs_chandef)) - mwifiex_dbg(priv->adapter, ERROR, - "failed to stop CAC in FW\n"); ---- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c -+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c -@@ -1880,7 +1880,7 @@ mwifiex_cfg80211_del_station(struct wiph - struct mwifiex_sta_node *sta_node; - u8 deauth_mac[ETH_ALEN]; - -- if (!priv->bss_started && priv->wdev.cac_started) { -+ if (!priv->bss_started && priv->wdev.links[0].cac_started) { - mwifiex_dbg(priv->adapter, INFO, "%s: abort CAC!\n", __func__); - mwifiex_abort_cac(priv); - } -@@ -3978,7 +3978,7 @@ mwifiex_cfg80211_channel_switch(struct w - return -EBUSY; - } - -- if (priv->wdev.cac_started) -+ if (priv->wdev.links[0].cac_started) - return -EBUSY; - - if (cfg80211_chandef_identical(¶ms->chandef, ---- a/drivers/net/wireless/quantenna/qtnfmac/event.c -+++ b/drivers/net/wireless/quantenna/qtnfmac/event.c -@@ -520,21 +520,21 @@ static int qtnf_event_handle_radar(struc - cfg80211_radar_event(wiphy, &chandef, GFP_KERNEL); - break; - case QLINK_RADAR_CAC_FINISHED: -- if (!vif->wdev.cac_started) -+ if (!vif->wdev.links[0].cac_started) - break; - - cfg80211_cac_event(vif->netdev, &chandef, - NL80211_RADAR_CAC_FINISHED, GFP_KERNEL); - break; - case QLINK_RADAR_CAC_ABORTED: -- if (!vif->wdev.cac_started) -+ if (!vif->wdev.links[0].cac_started) - break; - - cfg80211_cac_event(vif->netdev, &chandef, - NL80211_RADAR_CAC_ABORTED, GFP_KERNEL); - break; - case QLINK_RADAR_CAC_STARTED: -- if (vif->wdev.cac_started) -+ if (vif->wdev.links[0].cac_started) - break; - - if (!wiphy_ext_feature_isset(wiphy, ---- a/include/net/cfg80211.h -+++ b/include/net/cfg80211.h -@@ -6198,9 +6198,6 @@ enum ieee80211_ap_reg_power { - * @address: The address for this device, valid only if @netdev is %NULL - * @is_running: true if this is a non-netdev device that has been started, e.g. - * the P2P Device. -- * @cac_started: true if DFS channel availability check has been started -- * @cac_start_time: timestamp (jiffies) when the dfs state was entered. -- * @cac_time_ms: CAC time in ms - * @ps: powersave mode is enabled - * @ps_timeout: dynamic powersave timeout - * @ap_unexpected_nlportid: (private) netlink port ID of application -@@ -6224,6 +6221,11 @@ enum ieee80211_ap_reg_power { - * unprotected beacon report - * @links: array of %IEEE80211_MLD_MAX_NUM_LINKS elements containing @addr - * @ap and @client for each link -+ * @links[].cac_started: true if DFS channel availability check has been -+ * started -+ * @links[].cac_start_time: timestamp (jiffies) when the dfs state was -+ * entered. -+ * @links[].cac_time_ms: CAC time in ms - * @valid_links: bitmap describing what elements of @links are valid - */ - struct wireless_dev { -@@ -6265,11 +6267,6 @@ struct wireless_dev { - u32 owner_nlportid; - bool nl_owner_dead; - -- /* FIXME: need to rework radar detection for MLO */ -- bool cac_started; -- unsigned long cac_start_time; -- unsigned int cac_time_ms; -- - #ifdef CPTCFG_CFG80211_WEXT - /* wext data */ - struct { -@@ -6336,6 +6333,10 @@ struct wireless_dev { - struct cfg80211_internal_bss *current_bss; - } client; - }; -+ -+ bool cac_started; -+ unsigned long cac_start_time; -+ unsigned int cac_time_ms; - } links[IEEE80211_MLD_MAX_NUM_LINKS]; - u16 valid_links; - }; ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -1656,7 +1656,7 @@ static int ieee80211_stop_ap(struct wiph - ieee80211_link_info_change_notify(sdata, link, - BSS_CHANGED_BEACON_ENABLED); - -- if (sdata->wdev.cac_started) { -+ if (sdata->wdev.links[0].cac_started) { - chandef = link_conf->chanreq.oper; - wiphy_delayed_work_cancel(wiphy, &link->dfs_cac_timer_work); - cfg80211_cac_event(sdata->dev, &chandef, -@@ -3498,9 +3498,9 @@ static void ieee80211_end_cac(struct wip - wiphy_delayed_work_cancel(wiphy, - &sdata->deflink.dfs_cac_timer_work); - -- if (sdata->wdev.cac_started) { -+ if (sdata->wdev.links[0].cac_started) { - ieee80211_link_release_channel(&sdata->deflink); -- sdata->wdev.cac_started = false; -+ sdata->wdev.links[0].cac_started = false; - } - } - } -@@ -3955,7 +3955,7 @@ __ieee80211_channel_switch(struct wiphy - if (!list_empty(&local->roc_list) || local->scanning) - return -EBUSY; - -- if (sdata->wdev.cac_started) -+ if (sdata->wdev.links[0].cac_started) - return -EBUSY; - - if (WARN_ON(link_id >= IEEE80211_MLD_MAX_NUM_LINKS)) ---- a/net/mac80211/iface.c -+++ b/net/mac80211/iface.c -@@ -553,7 +553,7 @@ static void ieee80211_do_stop(struct iee - wiphy_delayed_work_cancel(local->hw.wiphy, - &sdata->deflink.dfs_cac_timer_work); - -- if (sdata->wdev.cac_started) { -+ if (sdata->wdev.links[0].cac_started) { - chandef = sdata->vif.bss_conf.chanreq.oper; - WARN_ON(local->suspended); - ieee80211_link_release_channel(&sdata->deflink); ---- a/net/mac80211/mlme.c -+++ b/net/mac80211/mlme.c -@@ -3039,7 +3039,7 @@ void ieee80211_dfs_cac_timer_work(struct - - lockdep_assert_wiphy(sdata->local->hw.wiphy); - -- if (sdata->wdev.cac_started) { -+ if (sdata->wdev.links[0].cac_started) { - ieee80211_link_release_channel(link); - cfg80211_cac_event(sdata->dev, &chandef, - NL80211_RADAR_CAC_FINISHED, ---- a/net/mac80211/scan.c -+++ b/net/mac80211/scan.c -@@ -585,7 +585,7 @@ static bool __ieee80211_can_leave_ch(str - return false; - - list_for_each_entry(sdata_iter, &local->interfaces, list) { -- if (sdata_iter->wdev.cac_started) -+ if (sdata_iter->wdev.links[0].cac_started) - return false; - } - ---- a/net/mac80211/util.c -+++ b/net/mac80211/util.c -@@ -3462,7 +3462,7 @@ void ieee80211_dfs_cac_cancel(struct iee - wiphy_delayed_work_cancel(local->hw.wiphy, - &sdata->deflink.dfs_cac_timer_work); - -- if (sdata->wdev.cac_started) { -+ if (sdata->wdev.links[0].cac_started) { - chandef = sdata->vif.bss_conf.chanreq.oper; - ieee80211_link_release_channel(&sdata->deflink); - cfg80211_cac_event(sdata->dev, ---- a/net/wireless/ibss.c -+++ b/net/wireless/ibss.c -@@ -94,7 +94,7 @@ int __cfg80211_join_ibss(struct cfg80211 - - lockdep_assert_held(&rdev->wiphy.mtx); - -- if (wdev->cac_started) -+ if (wdev->links[0].cac_started) - return -EBUSY; - - if (wdev->u.ibss.ssid_len) ---- a/net/wireless/mesh.c -+++ b/net/wireless/mesh.c -@@ -127,7 +127,7 @@ int __cfg80211_join_mesh(struct cfg80211 - if (!rdev->ops->join_mesh) - return -EOPNOTSUPP; - -- if (wdev->cac_started) -+ if (wdev->links[0].cac_started) - return -EBUSY; - - if (!setup->chandef.chan) { ---- a/net/wireless/mlme.c -+++ b/net/wireless/mlme.c -@@ -1124,13 +1124,14 @@ void cfg80211_cac_event(struct net_devic - - trace_cfg80211_cac_event(netdev, event); - -- if (WARN_ON(!wdev->cac_started && event != NL80211_RADAR_CAC_STARTED)) -+ if (WARN_ON(!wdev->links[0].cac_started && -+ event != NL80211_RADAR_CAC_STARTED)) - return; - - switch (event) { - case NL80211_RADAR_CAC_FINISHED: -- timeout = wdev->cac_start_time + -- msecs_to_jiffies(wdev->cac_time_ms); -+ timeout = wdev->links[0].cac_start_time + -+ msecs_to_jiffies(wdev->links[0].cac_time_ms); - WARN_ON(!time_after_eq(jiffies, timeout)); - cfg80211_set_dfs_state(wiphy, chandef, NL80211_DFS_AVAILABLE); - memcpy(&rdev->cac_done_chandef, chandef, -@@ -1139,10 +1140,10 @@ void cfg80211_cac_event(struct net_devic - cfg80211_sched_dfs_chan_update(rdev); - fallthrough; - case NL80211_RADAR_CAC_ABORTED: -- wdev->cac_started = false; -+ wdev->links[0].cac_started = false; - break; - case NL80211_RADAR_CAC_STARTED: -- wdev->cac_started = true; -+ wdev->links[0].cac_started = true; - break; - default: - WARN_ON(1); ---- a/net/wireless/nl80211.c -+++ b/net/wireless/nl80211.c -@@ -6066,7 +6066,7 @@ static int nl80211_start_ap(struct sk_bu - if (!rdev->ops->start_ap) - return -EOPNOTSUPP; - -- if (wdev->cac_started) -+ if (wdev->links[0].cac_started) - return -EBUSY; - - if (wdev->links[link_id].ap.beacon_interval) -@@ -10122,7 +10122,7 @@ static int nl80211_start_radar_detection - goto unlock; - } - -- if (cfg80211_beaconing_iface_active(wdev) || wdev->cac_started) { -+ if (cfg80211_beaconing_iface_active(wdev) || wdev->links[0].cac_started) { - err = -EBUSY; - goto unlock; - } -@@ -10158,9 +10158,9 @@ static int nl80211_start_radar_detection - default: - break; - } -- wdev->cac_started = true; -- wdev->cac_start_time = jiffies; -- wdev->cac_time_ms = cac_time_ms; -+ wdev->links[0].cac_started = true; -+ wdev->links[0].cac_start_time = jiffies; -+ wdev->links[0].cac_time_ms = cac_time_ms; - } - unlock: - wiphy_unlock(wiphy); ---- a/net/wireless/reg.c -+++ b/net/wireless/reg.c -@@ -4241,7 +4241,7 @@ static void cfg80211_check_and_end_cac(s - list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) { - struct cfg80211_chan_def *chandef; - -- if (!wdev->cac_started) -+ if (!wdev->links[0].cac_started) - continue; - - /* FIXME: radar detection is tied to link 0 for now */ diff --git a/package/kernel/mac80211/patches/subsys/337-wifi-cfg80211-handle-DFS-per-link.patch b/package/kernel/mac80211/patches/subsys/337-wifi-cfg80211-handle-DFS-per-link.patch deleted file mode 100644 index a4e0333642ae5b..00000000000000 --- a/package/kernel/mac80211/patches/subsys/337-wifi-cfg80211-handle-DFS-per-link.patch +++ /dev/null @@ -1,435 +0,0 @@ -From: Aditya Kumar Singh -Date: Fri, 6 Sep 2024 12:14:23 +0530 -Subject: [PATCH] wifi: cfg80211: handle DFS per link - -Currently, during starting a radar detection, no link id information is -parsed and passed down. In order to support starting radar detection -during Multi Link Operation, it is required to pass link id as well. - -Add changes to first parse and then pass link id in the start radar -detection path. - -Additionally, update notification APIs to allow drivers/mac80211 to -pass the link ID. - -However, everything is handled at link 0 only until all API's are ready to -handle it per link. - -Signed-off-by: Aditya Kumar Singh -Link: https://patch.msgid.link/20240906064426.2101315-6-quic_adisi@quicinc.com -Signed-off-by: Johannes Berg ---- - ---- a/drivers/net/wireless/marvell/mwifiex/11h.c -+++ b/drivers/net/wireless/marvell/mwifiex/11h.c -@@ -122,7 +122,7 @@ void mwifiex_dfs_cac_work_queue(struct w - "CAC timer finished; No radar detected\n"); - cfg80211_cac_event(priv->netdev, &chandef, - NL80211_RADAR_CAC_FINISHED, -- GFP_KERNEL); -+ GFP_KERNEL, 0); - } - } - -@@ -182,7 +182,8 @@ void mwifiex_abort_cac(struct mwifiex_pr - "Aborting delayed work for CAC.\n"); - cancel_delayed_work_sync(&priv->dfs_cac_work); - cfg80211_cac_event(priv->netdev, &priv->dfs_chandef, -- NL80211_RADAR_CAC_ABORTED, GFP_KERNEL); -+ NL80211_RADAR_CAC_ABORTED, GFP_KERNEL, -+ 0); - } - } - -@@ -221,7 +222,7 @@ int mwifiex_11h_handle_chanrpt_ready(str - cfg80211_cac_event(priv->netdev, - &priv->dfs_chandef, - NL80211_RADAR_DETECTED, -- GFP_KERNEL); -+ GFP_KERNEL, 0); - } - break; - default: ---- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c -+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c -@@ -4145,7 +4145,7 @@ static int - mwifiex_cfg80211_start_radar_detection(struct wiphy *wiphy, - struct net_device *dev, - struct cfg80211_chan_def *chandef, -- u32 cac_time_ms) -+ u32 cac_time_ms, int link_id) - { - struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); - struct mwifiex_radar_params radar_params; ---- a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c -+++ b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c -@@ -837,7 +837,7 @@ static int qtnf_channel_switch(struct wi - static int qtnf_start_radar_detection(struct wiphy *wiphy, - struct net_device *ndev, - struct cfg80211_chan_def *chandef, -- u32 cac_time_ms) -+ u32 cac_time_ms, int link_id) - { - struct qtnf_vif *vif = qtnf_netdev_get_priv(ndev); - int ret; ---- a/drivers/net/wireless/quantenna/qtnfmac/event.c -+++ b/drivers/net/wireless/quantenna/qtnfmac/event.c -@@ -524,14 +524,14 @@ static int qtnf_event_handle_radar(struc - break; - - cfg80211_cac_event(vif->netdev, &chandef, -- NL80211_RADAR_CAC_FINISHED, GFP_KERNEL); -+ NL80211_RADAR_CAC_FINISHED, GFP_KERNEL, 0); - break; - case QLINK_RADAR_CAC_ABORTED: - if (!vif->wdev.links[0].cac_started) - break; - - cfg80211_cac_event(vif->netdev, &chandef, -- NL80211_RADAR_CAC_ABORTED, GFP_KERNEL); -+ NL80211_RADAR_CAC_ABORTED, GFP_KERNEL, 0); - break; - case QLINK_RADAR_CAC_STARTED: - if (vif->wdev.links[0].cac_started) -@@ -542,7 +542,7 @@ static int qtnf_event_handle_radar(struc - break; - - cfg80211_cac_event(vif->netdev, &chandef, -- NL80211_RADAR_CAC_STARTED, GFP_KERNEL); -+ NL80211_RADAR_CAC_STARTED, GFP_KERNEL, 0); - break; - default: - pr_warn("%s: unhandled radar event %u\n", ---- a/include/net/cfg80211.h -+++ b/include/net/cfg80211.h -@@ -4841,9 +4841,9 @@ struct cfg80211_ops { - int (*start_radar_detection)(struct wiphy *wiphy, - struct net_device *dev, - struct cfg80211_chan_def *chandef, -- u32 cac_time_ms); -+ u32 cac_time_ms, int link_id); - void (*end_cac)(struct wiphy *wiphy, -- struct net_device *dev); -+ struct net_device *dev, unsigned int link_id); - int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_update_ft_ies_params *ftie); - int (*crit_proto_start)(struct wiphy *wiphy, -@@ -8745,6 +8745,7 @@ void cfg80211_sta_opmode_change_notify(s - * @chandef: chandef for the current channel - * @event: type of event - * @gfp: context flags -+ * @link_id: valid link_id for MLO operation or 0 otherwise. - * - * This function is called when a Channel availability check (CAC) is finished - * or aborted. This must be called to notify the completion of a CAC process, -@@ -8752,7 +8753,8 @@ void cfg80211_sta_opmode_change_notify(s - */ - void cfg80211_cac_event(struct net_device *netdev, - const struct cfg80211_chan_def *chandef, -- enum nl80211_radar_event event, gfp_t gfp); -+ enum nl80211_radar_event event, gfp_t gfp, -+ unsigned int link_id); - - /** - * cfg80211_background_cac_abort - Channel Availability Check offchan abort event ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -1661,7 +1661,7 @@ static int ieee80211_stop_ap(struct wiph - wiphy_delayed_work_cancel(wiphy, &link->dfs_cac_timer_work); - cfg80211_cac_event(sdata->dev, &chandef, - NL80211_RADAR_CAC_ABORTED, -- GFP_KERNEL); -+ GFP_KERNEL, 0); - } - - drv_stop_ap(sdata->local, sdata, link_conf); -@@ -3459,7 +3459,7 @@ static int ieee80211_set_bitrate_mask(st - static int ieee80211_start_radar_detection(struct wiphy *wiphy, - struct net_device *dev, - struct cfg80211_chan_def *chandef, -- u32 cac_time_ms) -+ u32 cac_time_ms, int link_id) - { - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - struct ieee80211_chan_req chanreq = { .oper = *chandef }; -@@ -3487,7 +3487,7 @@ static int ieee80211_start_radar_detecti - } - - static void ieee80211_end_cac(struct wiphy *wiphy, -- struct net_device *dev) -+ struct net_device *dev, unsigned int link_id) - { - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - struct ieee80211_local *local = sdata->local; ---- a/net/mac80211/iface.c -+++ b/net/mac80211/iface.c -@@ -559,7 +559,7 @@ static void ieee80211_do_stop(struct iee - ieee80211_link_release_channel(&sdata->deflink); - cfg80211_cac_event(sdata->dev, &chandef, - NL80211_RADAR_CAC_ABORTED, -- GFP_KERNEL); -+ GFP_KERNEL, 0); - } - - if (sdata->vif.type == NL80211_IFTYPE_AP) { ---- a/net/mac80211/mlme.c -+++ b/net/mac80211/mlme.c -@@ -3043,7 +3043,7 @@ void ieee80211_dfs_cac_timer_work(struct - ieee80211_link_release_channel(link); - cfg80211_cac_event(sdata->dev, &chandef, - NL80211_RADAR_CAC_FINISHED, -- GFP_KERNEL); -+ GFP_KERNEL, 0); - } - } - ---- a/net/mac80211/util.c -+++ b/net/mac80211/util.c -@@ -3468,7 +3468,7 @@ void ieee80211_dfs_cac_cancel(struct iee - cfg80211_cac_event(sdata->dev, - &chandef, - NL80211_RADAR_CAC_ABORTED, -- GFP_KERNEL); -+ GFP_KERNEL, 0); - } - } - } ---- a/net/wireless/mlme.c -+++ b/net/wireless/mlme.c -@@ -1111,18 +1111,19 @@ EXPORT_SYMBOL(__cfg80211_radar_event); - - void cfg80211_cac_event(struct net_device *netdev, - const struct cfg80211_chan_def *chandef, -- enum nl80211_radar_event event, gfp_t gfp) -+ enum nl80211_radar_event event, gfp_t gfp, -+ unsigned int link_id) - { - struct wireless_dev *wdev = netdev->ieee80211_ptr; - struct wiphy *wiphy = wdev->wiphy; - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); - unsigned long timeout; - -- /* not yet supported */ -- if (wdev->valid_links) -+ if (WARN_ON(wdev->valid_links && -+ !(wdev->valid_links & BIT(link_id)))) - return; - -- trace_cfg80211_cac_event(netdev, event); -+ trace_cfg80211_cac_event(netdev, event, link_id); - - if (WARN_ON(!wdev->links[0].cac_started && - event != NL80211_RADAR_CAC_STARTED)) ---- a/net/wireless/nl80211.c -+++ b/net/wireless/nl80211.c -@@ -10122,7 +10122,20 @@ static int nl80211_start_radar_detection - goto unlock; - } - -- if (cfg80211_beaconing_iface_active(wdev) || wdev->links[0].cac_started) { -+ if (cfg80211_beaconing_iface_active(wdev)) { -+ /* During MLO other link(s) can beacon, only the current link -+ * can not already beacon -+ */ -+ if (wdev->valid_links && -+ !wdev->links[0].ap.beacon_interval) { -+ /* nothing */ -+ } else { -+ err = -EBUSY; -+ goto unlock; -+ } -+ } -+ -+ if (wdev->links[0].cac_started) { - err = -EBUSY; - goto unlock; - } -@@ -10142,7 +10155,8 @@ static int nl80211_start_radar_detection - if (WARN_ON(!cac_time_ms)) - cac_time_ms = IEEE80211_DFS_MIN_CAC_TIME_MS; - -- err = rdev_start_radar_detection(rdev, dev, &chandef, cac_time_ms); -+ err = rdev_start_radar_detection(rdev, dev, &chandef, cac_time_ms, -+ 0); - if (!err) { - switch (wdev->iftype) { - case NL80211_IFTYPE_AP: -@@ -16512,10 +16526,10 @@ nl80211_set_ttlm(struct sk_buff *skb, st - SELECTOR(__sel, NETDEV_UP_NOTMX, \ - NL80211_FLAG_NEED_NETDEV_UP | \ - NL80211_FLAG_NO_WIPHY_MTX) \ -- SELECTOR(__sel, NETDEV_UP_NOTMX_NOMLO, \ -+ SELECTOR(__sel, NETDEV_UP_NOTMX_MLO, \ - NL80211_FLAG_NEED_NETDEV_UP | \ - NL80211_FLAG_NO_WIPHY_MTX | \ -- NL80211_FLAG_MLO_UNSUPPORTED) \ -+ NL80211_FLAG_MLO_VALID_LINK_ID) \ - SELECTOR(__sel, NETDEV_UP_CLEAR, \ - NL80211_FLAG_NEED_NETDEV_UP | \ - NL80211_FLAG_CLEAR_SKB) \ -@@ -17410,7 +17424,7 @@ static const struct genl_small_ops nl802 - .flags = GENL_UNS_ADMIN_PERM, - .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NO_WIPHY_MTX | -- NL80211_FLAG_MLO_UNSUPPORTED), -+ NL80211_FLAG_MLO_VALID_LINK_ID), - }, - { - .cmd = NL80211_CMD_GET_PROTOCOL_FEATURES, ---- a/net/wireless/rdev-ops.h -+++ b/net/wireless/rdev-ops.h -@@ -1200,26 +1200,27 @@ static inline int - rdev_start_radar_detection(struct cfg80211_registered_device *rdev, - struct net_device *dev, - struct cfg80211_chan_def *chandef, -- u32 cac_time_ms) -+ u32 cac_time_ms, int link_id) - { - int ret = -EOPNOTSUPP; - - trace_rdev_start_radar_detection(&rdev->wiphy, dev, chandef, -- cac_time_ms); -+ cac_time_ms, link_id); - if (rdev->ops->start_radar_detection) - ret = rdev->ops->start_radar_detection(&rdev->wiphy, dev, -- chandef, cac_time_ms); -+ chandef, cac_time_ms, -+ link_id); - trace_rdev_return_int(&rdev->wiphy, ret); - return ret; - } - - static inline void - rdev_end_cac(struct cfg80211_registered_device *rdev, -- struct net_device *dev) -+ struct net_device *dev, unsigned int link_id) - { -- trace_rdev_end_cac(&rdev->wiphy, dev); -+ trace_rdev_end_cac(&rdev->wiphy, dev, link_id); - if (rdev->ops->end_cac) -- rdev->ops->end_cac(&rdev->wiphy, dev); -+ rdev->ops->end_cac(&rdev->wiphy, dev, link_id); - trace_rdev_return_void(&rdev->wiphy); - } - ---- a/net/wireless/reg.c -+++ b/net/wireless/reg.c -@@ -4229,6 +4229,8 @@ EXPORT_SYMBOL(regulatory_pre_cac_allowed - static void cfg80211_check_and_end_cac(struct cfg80211_registered_device *rdev) - { - struct wireless_dev *wdev; -+ unsigned int link_id; -+ - /* If we finished CAC or received radar, we should end any - * CAC running on the same channels. - * the check !cfg80211_chandef_dfs_usable contain 2 options: -@@ -4241,16 +4243,17 @@ static void cfg80211_check_and_end_cac(s - list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) { - struct cfg80211_chan_def *chandef; - -- if (!wdev->links[0].cac_started) -- continue; -+ for_each_valid_link(wdev, link_id) { -+ if (!wdev->links[link_id].cac_started) -+ continue; - -- /* FIXME: radar detection is tied to link 0 for now */ -- chandef = wdev_chandef(wdev, 0); -- if (!chandef) -- continue; -+ chandef = wdev_chandef(wdev, link_id); -+ if (!chandef) -+ continue; - -- if (!cfg80211_chandef_dfs_usable(&rdev->wiphy, chandef)) -- rdev_end_cac(rdev, wdev->netdev); -+ if (!cfg80211_chandef_dfs_usable(&rdev->wiphy, chandef)) -+ rdev_end_cac(rdev, wdev->netdev, link_id); -+ } - } - } - ---- a/net/wireless/trace.h -+++ b/net/wireless/trace.h -@@ -806,17 +806,21 @@ DEFINE_EVENT(wiphy_netdev_evt, rdev_flus - ); - - TRACE_EVENT(rdev_end_cac, -- TP_PROTO(struct wiphy *wiphy, struct net_device *netdev), -- TP_ARGS(wiphy, netdev), -+ TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, -+ unsigned int link_id), -+ TP_ARGS(wiphy, netdev, link_id), - TP_STRUCT__entry( - WIPHY_ENTRY - NETDEV_ENTRY -+ __field(unsigned int, link_id) - ), - TP_fast_assign( - WIPHY_ASSIGN; - NETDEV_ASSIGN; -+ __entry->link_id = link_id; - ), -- TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT, WIPHY_PR_ARG, NETDEV_PR_ARG) -+ TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", link_id: %d", -+ WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->link_id) - ); - - DECLARE_EVENT_CLASS(station_add_change, -@@ -2661,24 +2665,26 @@ TRACE_EVENT(rdev_external_auth, - TRACE_EVENT(rdev_start_radar_detection, - TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, - struct cfg80211_chan_def *chandef, -- u32 cac_time_ms), -- TP_ARGS(wiphy, netdev, chandef, cac_time_ms), -+ u32 cac_time_ms, int link_id), -+ TP_ARGS(wiphy, netdev, chandef, cac_time_ms, link_id), - TP_STRUCT__entry( - WIPHY_ENTRY - NETDEV_ENTRY - CHAN_DEF_ENTRY - __field(u32, cac_time_ms) -+ __field(int, link_id) - ), - TP_fast_assign( - WIPHY_ASSIGN; - NETDEV_ASSIGN; - CHAN_DEF_ASSIGN(chandef); - __entry->cac_time_ms = cac_time_ms; -+ __entry->link_id = link_id; - ), - TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", " CHAN_DEF_PR_FMT -- ", cac_time_ms=%u", -+ ", cac_time_ms=%u, link_id=%d", - WIPHY_PR_ARG, NETDEV_PR_ARG, CHAN_DEF_PR_ARG, -- __entry->cac_time_ms) -+ __entry->cac_time_ms, __entry->link_id) - ); - - TRACE_EVENT(rdev_set_mcast_rate, -@@ -3492,18 +3498,21 @@ TRACE_EVENT(cfg80211_radar_event, - ); - - TRACE_EVENT(cfg80211_cac_event, -- TP_PROTO(struct net_device *netdev, enum nl80211_radar_event evt), -- TP_ARGS(netdev, evt), -+ TP_PROTO(struct net_device *netdev, enum nl80211_radar_event evt, -+ unsigned int link_id), -+ TP_ARGS(netdev, evt, link_id), - TP_STRUCT__entry( - NETDEV_ENTRY - __field(enum nl80211_radar_event, evt) -+ __field(unsigned int, link_id) - ), - TP_fast_assign( - NETDEV_ASSIGN; - __entry->evt = evt; -+ __entry->link_id = link_id; - ), -- TP_printk(NETDEV_PR_FMT ", event: %d", -- NETDEV_PR_ARG, __entry->evt) -+ TP_printk(NETDEV_PR_FMT ", event: %d, link_id=%u", -+ NETDEV_PR_ARG, __entry->evt, __entry->link_id) - ); - - DECLARE_EVENT_CLASS(cfg80211_rx_evt, diff --git a/package/kernel/mac80211/patches/subsys/357-wifi-mac80211-add-support-for-the-monitor-SKIP_TX-fl.patch b/package/kernel/mac80211/patches/subsys/337-wifi-mac80211-add-support-for-the-monitor-SKIP_TX-fl.patch similarity index 97% rename from package/kernel/mac80211/patches/subsys/357-wifi-mac80211-add-support-for-the-monitor-SKIP_TX-fl.patch rename to package/kernel/mac80211/patches/subsys/337-wifi-mac80211-add-support-for-the-monitor-SKIP_TX-fl.patch index e62c15c19d16c9..d9e484eebaaf83 100644 --- a/package/kernel/mac80211/patches/subsys/357-wifi-mac80211-add-support-for-the-monitor-SKIP_TX-fl.patch +++ b/package/kernel/mac80211/patches/subsys/337-wifi-mac80211-add-support-for-the-monitor-SKIP_TX-fl.patch @@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h -@@ -1374,7 +1374,7 @@ struct ieee80211_local { +@@ -1373,7 +1373,7 @@ struct ieee80211_local { spinlock_t queue_stop_reason_lock; int open_count; diff --git a/package/kernel/mac80211/patches/subsys/338-wifi-mac80211-handle-DFS-per-link.patch b/package/kernel/mac80211/patches/subsys/338-wifi-mac80211-handle-DFS-per-link.patch deleted file mode 100644 index 388c0575c88582..00000000000000 --- a/package/kernel/mac80211/patches/subsys/338-wifi-mac80211-handle-DFS-per-link.patch +++ /dev/null @@ -1,134 +0,0 @@ -From: Aditya Kumar Singh -Date: Fri, 6 Sep 2024 12:14:24 +0530 -Subject: [PATCH] wifi: mac80211: handle DFS per link - -In order to support DFS with MLO, handle the link ID now passed from -cfg80211, adjust the code to do everything per link and call the -notifications to cfg80211 correctly. - -Signed-off-by: Aditya Kumar Singh -Link: https://patch.msgid.link/20240906064426.2101315-7-quic_adisi@quicinc.com -Signed-off-by: Johannes Berg ---- - ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -3464,6 +3464,7 @@ static int ieee80211_start_radar_detecti - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - struct ieee80211_chan_req chanreq = { .oper = *chandef }; - struct ieee80211_local *local = sdata->local; -+ struct ieee80211_link_data *link_data; - int err; - - lockdep_assert_wiphy(local->hw.wiphy); -@@ -3471,16 +3472,20 @@ static int ieee80211_start_radar_detecti - if (!list_empty(&local->roc_list) || local->scanning) - return -EBUSY; - -+ link_data = sdata_dereference(sdata->link[link_id], sdata); -+ if (!link_data) -+ return -ENOLINK; -+ - /* whatever, but channel contexts should not complain about that one */ -- sdata->deflink.smps_mode = IEEE80211_SMPS_OFF; -- sdata->deflink.needed_rx_chains = local->rx_chains; -+ link_data->smps_mode = IEEE80211_SMPS_OFF; -+ link_data->needed_rx_chains = local->rx_chains; - -- err = ieee80211_link_use_channel(&sdata->deflink, &chanreq, -+ err = ieee80211_link_use_channel(link_data, &chanreq, - IEEE80211_CHANCTX_SHARED); - if (err) - return err; - -- wiphy_delayed_work_queue(wiphy, &sdata->deflink.dfs_cac_timer_work, -+ wiphy_delayed_work_queue(wiphy, &link_data->dfs_cac_timer_work, - msecs_to_jiffies(cac_time_ms)); - - return 0; -@@ -3491,16 +3496,21 @@ static void ieee80211_end_cac(struct wip - { - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - struct ieee80211_local *local = sdata->local; -+ struct ieee80211_link_data *link_data; - - lockdep_assert_wiphy(local->hw.wiphy); - - list_for_each_entry(sdata, &local->interfaces, list) { -+ link_data = sdata_dereference(sdata->link[link_id], sdata); -+ if (!link_data) -+ continue; -+ - wiphy_delayed_work_cancel(wiphy, -- &sdata->deflink.dfs_cac_timer_work); -+ &link_data->dfs_cac_timer_work); - -- if (sdata->wdev.links[0].cac_started) { -- ieee80211_link_release_channel(&sdata->deflink); -- sdata->wdev.links[0].cac_started = false; -+ if (sdata->wdev.links[link_id].cac_started) { -+ ieee80211_link_release_channel(link_data); -+ sdata->wdev.links[link_id].cac_started = false; - } - } - } ---- a/net/mac80211/link.c -+++ b/net/mac80211/link.c -@@ -77,6 +77,16 @@ void ieee80211_link_stop(struct ieee8021 - &link->color_change_finalize_work); - wiphy_work_cancel(link->sdata->local->hw.wiphy, - &link->csa.finalize_work); -+ -+ if (link->sdata->wdev.links[link->link_id].cac_started) { -+ wiphy_delayed_work_cancel(link->sdata->local->hw.wiphy, -+ &link->dfs_cac_timer_work); -+ cfg80211_cac_event(link->sdata->dev, -+ &link->conf->chanreq.oper, -+ NL80211_RADAR_CAC_ABORTED, -+ GFP_KERNEL, link->link_id); -+ } -+ - ieee80211_link_release_channel(link); - } - ---- a/net/mac80211/util.c -+++ b/net/mac80211/util.c -@@ -3455,20 +3455,30 @@ void ieee80211_dfs_cac_cancel(struct iee - { - struct ieee80211_sub_if_data *sdata; - struct cfg80211_chan_def chandef; -+ struct ieee80211_link_data *link; -+ unsigned int link_id; - - lockdep_assert_wiphy(local->hw.wiphy); - - list_for_each_entry(sdata, &local->interfaces, list) { -- wiphy_delayed_work_cancel(local->hw.wiphy, -- &sdata->deflink.dfs_cac_timer_work); -+ for (link_id = 0; link_id < IEEE80211_MLD_MAX_NUM_LINKS; -+ link_id++) { -+ link = sdata_dereference(sdata->link[link_id], -+ sdata); -+ if (!link) -+ continue; - -- if (sdata->wdev.links[0].cac_started) { -- chandef = sdata->vif.bss_conf.chanreq.oper; -- ieee80211_link_release_channel(&sdata->deflink); -- cfg80211_cac_event(sdata->dev, -- &chandef, -+ wiphy_delayed_work_cancel(local->hw.wiphy, -+ &link->dfs_cac_timer_work); -+ -+ if (!sdata->wdev.links[link_id].cac_started) -+ continue; -+ -+ chandef = link->conf->chanreq.oper; -+ ieee80211_link_release_channel(link); -+ cfg80211_cac_event(sdata->dev, &chandef, - NL80211_RADAR_CAC_ABORTED, -- GFP_KERNEL, 0); -+ GFP_KERNEL, link_id); - } - } - } diff --git a/package/kernel/mac80211/patches/subsys/358-wifi-mac80211-refactor-ieee80211_rx_monitor.patch b/package/kernel/mac80211/patches/subsys/338-wifi-mac80211-refactor-ieee80211_rx_monitor.patch similarity index 100% rename from package/kernel/mac80211/patches/subsys/358-wifi-mac80211-refactor-ieee80211_rx_monitor.patch rename to package/kernel/mac80211/patches/subsys/338-wifi-mac80211-refactor-ieee80211_rx_monitor.patch diff --git a/package/kernel/mac80211/patches/subsys/339-wifi-cfg80211-mac80211-use-proper-link-ID-for-DFS.patch b/package/kernel/mac80211/patches/subsys/339-wifi-cfg80211-mac80211-use-proper-link-ID-for-DFS.patch deleted file mode 100644 index 53079b6cf629e0..00000000000000 --- a/package/kernel/mac80211/patches/subsys/339-wifi-cfg80211-mac80211-use-proper-link-ID-for-DFS.patch +++ /dev/null @@ -1,168 +0,0 @@ -From: Aditya Kumar Singh -Date: Fri, 6 Sep 2024 12:14:25 +0530 -Subject: [PATCH] wifi: cfg80211/mac80211: use proper link ID for DFS - -Now that all APIs have support to handle DFS per link, use proper link ID -instead of 0. - -Signed-off-by: Aditya Kumar Singh -Link: https://patch.msgid.link/20240906064426.2101315-8-quic_adisi@quicinc.com -Signed-off-by: Johannes Berg ---- - ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -1656,12 +1656,12 @@ static int ieee80211_stop_ap(struct wiph - ieee80211_link_info_change_notify(sdata, link, - BSS_CHANGED_BEACON_ENABLED); - -- if (sdata->wdev.links[0].cac_started) { -+ if (sdata->wdev.links[link_id].cac_started) { - chandef = link_conf->chanreq.oper; - wiphy_delayed_work_cancel(wiphy, &link->dfs_cac_timer_work); - cfg80211_cac_event(sdata->dev, &chandef, - NL80211_RADAR_CAC_ABORTED, -- GFP_KERNEL, 0); -+ GFP_KERNEL, link_id); - } - - drv_stop_ap(sdata->local, sdata, link_conf); -@@ -3965,7 +3965,7 @@ __ieee80211_channel_switch(struct wiphy - if (!list_empty(&local->roc_list) || local->scanning) - return -EBUSY; - -- if (sdata->wdev.links[0].cac_started) -+ if (sdata->wdev.links[link_id].cac_started) - return -EBUSY; - - if (WARN_ON(link_id >= IEEE80211_MLD_MAX_NUM_LINKS)) ---- a/net/mac80211/mlme.c -+++ b/net/mac80211/mlme.c -@@ -3039,11 +3039,11 @@ void ieee80211_dfs_cac_timer_work(struct - - lockdep_assert_wiphy(sdata->local->hw.wiphy); - -- if (sdata->wdev.links[0].cac_started) { -+ if (sdata->wdev.links[link->link_id].cac_started) { - ieee80211_link_release_channel(link); - cfg80211_cac_event(sdata->dev, &chandef, - NL80211_RADAR_CAC_FINISHED, -- GFP_KERNEL, 0); -+ GFP_KERNEL, link->link_id); - } - } - ---- a/net/mac80211/scan.c -+++ b/net/mac80211/scan.c -@@ -575,6 +575,7 @@ static bool __ieee80211_can_leave_ch(str - { - struct ieee80211_local *local = sdata->local; - struct ieee80211_sub_if_data *sdata_iter; -+ unsigned int link_id; - - lockdep_assert_wiphy(local->hw.wiphy); - -@@ -585,8 +586,9 @@ static bool __ieee80211_can_leave_ch(str - return false; - - list_for_each_entry(sdata_iter, &local->interfaces, list) { -- if (sdata_iter->wdev.links[0].cac_started) -- return false; -+ for_each_valid_link(&sdata_iter->wdev, link_id) -+ if (sdata_iter->wdev.links[link_id].cac_started) -+ return false; - } - - return true; ---- a/net/wireless/mlme.c -+++ b/net/wireless/mlme.c -@@ -1125,14 +1125,14 @@ void cfg80211_cac_event(struct net_devic - - trace_cfg80211_cac_event(netdev, event, link_id); - -- if (WARN_ON(!wdev->links[0].cac_started && -+ if (WARN_ON(!wdev->links[link_id].cac_started && - event != NL80211_RADAR_CAC_STARTED)) - return; - - switch (event) { - case NL80211_RADAR_CAC_FINISHED: -- timeout = wdev->links[0].cac_start_time + -- msecs_to_jiffies(wdev->links[0].cac_time_ms); -+ timeout = wdev->links[link_id].cac_start_time + -+ msecs_to_jiffies(wdev->links[link_id].cac_time_ms); - WARN_ON(!time_after_eq(jiffies, timeout)); - cfg80211_set_dfs_state(wiphy, chandef, NL80211_DFS_AVAILABLE); - memcpy(&rdev->cac_done_chandef, chandef, -@@ -1141,10 +1141,10 @@ void cfg80211_cac_event(struct net_devic - cfg80211_sched_dfs_chan_update(rdev); - fallthrough; - case NL80211_RADAR_CAC_ABORTED: -- wdev->links[0].cac_started = false; -+ wdev->links[link_id].cac_started = false; - break; - case NL80211_RADAR_CAC_STARTED: -- wdev->links[0].cac_started = true; -+ wdev->links[link_id].cac_started = true; - break; - default: - WARN_ON(1); ---- a/net/wireless/nl80211.c -+++ b/net/wireless/nl80211.c -@@ -6066,7 +6066,7 @@ static int nl80211_start_ap(struct sk_bu - if (!rdev->ops->start_ap) - return -EOPNOTSUPP; - -- if (wdev->links[0].cac_started) -+ if (wdev->links[link_id].cac_started) - return -EBUSY; - - if (wdev->links[link_id].ap.beacon_interval) -@@ -10073,6 +10073,7 @@ static int nl80211_start_radar_detection - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - struct wireless_dev *wdev = dev->ieee80211_ptr; -+ int link_id = nl80211_link_id(info->attrs); - struct wiphy *wiphy = wdev->wiphy; - struct cfg80211_chan_def chandef; - enum nl80211_dfs_regions dfs_region; -@@ -10127,7 +10128,7 @@ static int nl80211_start_radar_detection - * can not already beacon - */ - if (wdev->valid_links && -- !wdev->links[0].ap.beacon_interval) { -+ !wdev->links[link_id].ap.beacon_interval) { - /* nothing */ - } else { - err = -EBUSY; -@@ -10135,7 +10136,7 @@ static int nl80211_start_radar_detection - } - } - -- if (wdev->links[0].cac_started) { -+ if (wdev->links[link_id].cac_started) { - err = -EBUSY; - goto unlock; - } -@@ -10156,7 +10157,7 @@ static int nl80211_start_radar_detection - cac_time_ms = IEEE80211_DFS_MIN_CAC_TIME_MS; - - err = rdev_start_radar_detection(rdev, dev, &chandef, cac_time_ms, -- 0); -+ link_id); - if (!err) { - switch (wdev->iftype) { - case NL80211_IFTYPE_AP: -@@ -10172,9 +10173,9 @@ static int nl80211_start_radar_detection - default: - break; - } -- wdev->links[0].cac_started = true; -- wdev->links[0].cac_start_time = jiffies; -- wdev->links[0].cac_time_ms = cac_time_ms; -+ wdev->links[link_id].cac_started = true; -+ wdev->links[link_id].cac_start_time = jiffies; -+ wdev->links[link_id].cac_time_ms = cac_time_ms; - } - unlock: - wiphy_unlock(wiphy); diff --git a/package/kernel/mac80211/patches/subsys/359-wifi-mac80211-filter-on-monitor-interfaces-based-on-.patch b/package/kernel/mac80211/patches/subsys/339-wifi-mac80211-filter-on-monitor-interfaces-based-on-.patch similarity index 100% rename from package/kernel/mac80211/patches/subsys/359-wifi-mac80211-filter-on-monitor-interfaces-based-on-.patch rename to package/kernel/mac80211/patches/subsys/339-wifi-mac80211-filter-on-monitor-interfaces-based-on-.patch diff --git a/package/kernel/mac80211/patches/subsys/360-wifi-cfg80211-report-per-wiphy-radio-antenna-mask.patch b/package/kernel/mac80211/patches/subsys/340-wifi-cfg80211-report-per-wiphy-radio-antenna-mask.patch similarity index 100% rename from package/kernel/mac80211/patches/subsys/360-wifi-cfg80211-report-per-wiphy-radio-antenna-mask.patch rename to package/kernel/mac80211/patches/subsys/340-wifi-cfg80211-report-per-wiphy-radio-antenna-mask.patch diff --git a/package/kernel/mac80211/patches/subsys/340-wifi-mac80211-handle-ieee80211_radar_detected-for-ML.patch b/package/kernel/mac80211/patches/subsys/340-wifi-mac80211-handle-ieee80211_radar_detected-for-ML.patch deleted file mode 100644 index 3f64864bd41f2e..00000000000000 --- a/package/kernel/mac80211/patches/subsys/340-wifi-mac80211-handle-ieee80211_radar_detected-for-ML.patch +++ /dev/null @@ -1,360 +0,0 @@ -From: Aditya Kumar Singh -Date: Fri, 6 Sep 2024 12:14:26 +0530 -Subject: [PATCH] wifi: mac80211: handle ieee80211_radar_detected() for MLO - -Currently DFS works under assumption there could be only one channel -context in the hardware. Hence, drivers just calls the function -ieee80211_radar_detected() passing the hardware structure. However, with -MLO, this obviously will not work since number of channel contexts will be -more than one and hence drivers would need to pass the channel information -as well on which the radar is detected. - -Also, when radar is detected in one of the links, other link's CAC should -not be cancelled. - -Hence, in order to support DFS with MLO, do the following changes - - * Add channel context conf pointer as an argument to the function - ieee80211_radar_detected(). During MLO, drivers would have to pass on - which channel context conf radar is detected. Otherwise, drivers could - just pass NULL. - * ieee80211_radar_detected() will iterate over all channel contexts - present and - * if channel context conf is passed, only mark that as radar - detected - * if NULL is passed, then mark all channel contexts as radar - detected - * Then as usual, schedule the radar detected work. - * In the worker, go over all the contexts again and for all such context - which is marked with radar detected, cancel the ongoing CAC by calling - ieee80211_dfs_cac_cancel() and then notify cfg80211 via - cfg80211_radar_event(). - * To cancel the CAC, pass the channel context as well where radar is - detected to ieee80211_dfs_cac_cancel(). This ensures that CAC is - canceled only on the links using the provided context, leaving other - links unaffected. - -This would also help in scenarios where there is split phy 5 GHz radio, -which is capable of DFS channels in both lower and upper band. In this -case, simultaneous radars can be detected. - -Signed-off-by: Aditya Kumar Singh -Link: https://patch.msgid.link/20240906064426.2101315-9-quic_adisi@quicinc.com -Signed-off-by: Johannes Berg ---- - ---- a/drivers/net/wireless/ath/ath10k/debug.c -+++ b/drivers/net/wireless/ath/ath10k/debug.c -@@ -3,7 +3,7 @@ - * Copyright (c) 2005-2011 Atheros Communications Inc. - * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. - * Copyright (c) 2018, The Linux Foundation. All rights reserved. -- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. -+ * Copyright (c) 2022, 2024 Qualcomm Innovation Center, Inc. All rights reserved. - */ - - #include -@@ -1774,7 +1774,7 @@ static ssize_t ath10k_write_simulate_rad - if (!arvif->is_started) - return -EINVAL; - -- ieee80211_radar_detected(ar->hw); -+ ieee80211_radar_detected(ar->hw, NULL); - - return count; - } ---- a/drivers/net/wireless/ath/ath10k/mac.c -+++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -1437,7 +1437,7 @@ static void ath10k_recalc_radar_detectio - * by indicating that radar was detected. - */ - ath10k_warn(ar, "failed to start CAC: %d\n", ret); -- ieee80211_radar_detected(ar->hw); -+ ieee80211_radar_detected(ar->hw, NULL); - } - } - ---- a/drivers/net/wireless/ath/ath10k/wmi.c -+++ b/drivers/net/wireless/ath/ath10k/wmi.c -@@ -3990,7 +3990,7 @@ static void ath10k_radar_detected(struct - if (ar->dfs_block_radar_events) - ath10k_info(ar, "DFS Radar detected, but ignored as requested\n"); - else -- ieee80211_radar_detected(ar->hw); -+ ieee80211_radar_detected(ar->hw, NULL); - } - - static void ath10k_radar_confirmation_work(struct work_struct *work) ---- a/drivers/net/wireless/ath/ath11k/wmi.c -+++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -8358,7 +8358,7 @@ ath11k_wmi_pdev_dfs_radar_detected_event - if (ar->dfs_block_radar_events) - ath11k_info(ab, "DFS Radar detected, but ignored as requested\n"); - else -- ieee80211_radar_detected(ar->hw); -+ ieee80211_radar_detected(ar->hw, NULL); - - exit: - rcu_read_unlock(); ---- a/drivers/net/wireless/ath/ath12k/wmi.c -+++ b/drivers/net/wireless/ath/ath12k/wmi.c -@@ -6789,7 +6789,7 @@ ath12k_wmi_pdev_dfs_radar_detected_event - if (ar->dfs_block_radar_events) - ath12k_info(ab, "DFS Radar detected, but ignored as requested\n"); - else -- ieee80211_radar_detected(ath12k_ar_to_hw(ar)); -+ ieee80211_radar_detected(ath12k_ar_to_hw(ar), NULL); - - exit: - rcu_read_unlock(); ---- a/drivers/net/wireless/ath/ath9k/dfs.c -+++ b/drivers/net/wireless/ath/ath9k/dfs.c -@@ -280,7 +280,7 @@ ath9k_dfs_process_radar_pulse(struct ath - if (!pd->add_pulse(pd, pe, NULL)) - return; - DFS_STAT_INC(sc, radar_detected); -- ieee80211_radar_detected(sc->hw); -+ ieee80211_radar_detected(sc->hw, NULL); - } - - /* ---- a/drivers/net/wireless/ath/ath9k/dfs_debug.c -+++ b/drivers/net/wireless/ath/ath9k/dfs_debug.c -@@ -116,7 +116,7 @@ static ssize_t write_file_simulate_radar - { - struct ath_softc *sc = file->private_data; - -- ieee80211_radar_detected(sc->hw); -+ ieee80211_radar_detected(sc->hw, NULL); - - return count; - } ---- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c -+++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c -@@ -394,7 +394,7 @@ mt7615_mcu_rx_radar_detected(struct mt76 - if (mt76_phy_dfs_state(mphy) < MT_DFS_STATE_CAC) - return; - -- ieee80211_radar_detected(mphy->hw); -+ ieee80211_radar_detected(mphy->hw, NULL); - dev->hw_pattern++; - } - ---- a/drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c -+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c -@@ -630,7 +630,7 @@ static void mt76x02_dfs_tasklet(struct t - radar_detected = mt76x02_dfs_check_detection(dev); - if (radar_detected) { - /* sw detector rx radar pattern */ -- ieee80211_radar_detected(dev->mt76.hw); -+ ieee80211_radar_detected(dev->mt76.hw, NULL); - mt76x02_dfs_detector_reset(dev); - - return; -@@ -658,7 +658,7 @@ static void mt76x02_dfs_tasklet(struct t - - /* hw detector rx radar pattern */ - dfs_pd->stats[i].hw_pattern++; -- ieee80211_radar_detected(dev->mt76.hw); -+ ieee80211_radar_detected(dev->mt76.hw, NULL); - mt76x02_dfs_detector_reset(dev); - - return; ---- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c -+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c -@@ -293,7 +293,7 @@ mt7915_mcu_rx_radar_detected(struct mt79 - &dev->rdd2_chandef, - GFP_ATOMIC); - else -- ieee80211_radar_detected(mphy->hw); -+ ieee80211_radar_detected(mphy->hw, NULL); - dev->hw_pattern++; - } - ---- a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c -+++ b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c -@@ -371,7 +371,7 @@ mt7996_mcu_rx_radar_detected(struct mt79 - &dev->rdd2_chandef, - GFP_ATOMIC); - else -- ieee80211_radar_detected(mphy->hw); -+ ieee80211_radar_detected(mphy->hw, NULL); - dev->hw_pattern++; - } - ---- a/drivers/net/wireless/ti/wl18xx/event.c -+++ b/drivers/net/wireless/ti/wl18xx/event.c -@@ -142,7 +142,7 @@ int wl18xx_process_mailbox_events(struct - wl18xx_radar_type_decode(mbox->radar_type)); - - if (!wl->radar_debug_mode) -- ieee80211_radar_detected(wl->hw); -+ ieee80211_radar_detected(wl->hw, NULL); - } - - if (vector & PERIODIC_SCAN_REPORT_EVENT_ID) { ---- a/drivers/net/wireless/virtual/mac80211_hwsim.c -+++ b/drivers/net/wireless/virtual/mac80211_hwsim.c -@@ -1146,7 +1146,7 @@ static int hwsim_write_simulate_radar(vo - { - struct mac80211_hwsim_data *data = dat; - -- ieee80211_radar_detected(data->hw); -+ ieee80211_radar_detected(data->hw, NULL); - - return 0; - } ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -6717,8 +6717,11 @@ void ieee80211_cqm_beacon_loss_notify(st - * ieee80211_radar_detected - inform that a radar was detected - * - * @hw: pointer as obtained from ieee80211_alloc_hw() -+ * @chanctx_conf: Channel context on which radar is detected. Mandatory to -+ * pass a valid pointer during MLO. For non-MLO %NULL can be passed - */ --void ieee80211_radar_detected(struct ieee80211_hw *hw); -+void ieee80211_radar_detected(struct ieee80211_hw *hw, -+ struct ieee80211_chanctx_conf *chanctx_conf); - - /** - * ieee80211_chswitch_done - Complete channel switch process ---- a/net/mac80211/chan.c -+++ b/net/mac80211/chan.c -@@ -681,6 +681,7 @@ ieee80211_alloc_chanctx(struct ieee80211 - ctx->mode = mode; - ctx->conf.radar_enabled = false; - ctx->conf.radio_idx = radio_idx; -+ ctx->radar_detected = false; - _ieee80211_recalc_chanctx_min_def(local, ctx, NULL, false); - - return ctx; ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -895,6 +895,8 @@ struct ieee80211_chanctx { - struct ieee80211_chan_req req; - - struct ieee80211_chanctx_conf conf; -+ -+ bool radar_detected; - }; - - struct mac80211_qos_map { -@@ -2632,7 +2634,8 @@ void ieee80211_recalc_chanctx_min_def(st - bool ieee80211_is_radar_required(struct ieee80211_local *local); - - void ieee80211_dfs_cac_timer_work(struct wiphy *wiphy, struct wiphy_work *work); --void ieee80211_dfs_cac_cancel(struct ieee80211_local *local); -+void ieee80211_dfs_cac_cancel(struct ieee80211_local *local, -+ struct ieee80211_chanctx *chanctx); - void ieee80211_dfs_radar_detected_work(struct wiphy *wiphy, - struct wiphy_work *work); - int ieee80211_send_action_csa(struct ieee80211_sub_if_data *sdata, ---- a/net/mac80211/pm.c -+++ b/net/mac80211/pm.c -@@ -32,7 +32,7 @@ int __ieee80211_suspend(struct ieee80211 - - ieee80211_scan_cancel(local); - -- ieee80211_dfs_cac_cancel(local); -+ ieee80211_dfs_cac_cancel(local, NULL); - - ieee80211_roc_purge(local, NULL); - ---- a/net/mac80211/util.c -+++ b/net/mac80211/util.c -@@ -3451,11 +3451,16 @@ u64 ieee80211_calculate_rx_timestamp(str - return ts; - } - --void ieee80211_dfs_cac_cancel(struct ieee80211_local *local) -+/* Cancel CAC for the interfaces under the specified @local. If @ctx is -+ * also provided, only the interfaces using that ctx will be canceled. -+ */ -+void ieee80211_dfs_cac_cancel(struct ieee80211_local *local, -+ struct ieee80211_chanctx *ctx) - { - struct ieee80211_sub_if_data *sdata; - struct cfg80211_chan_def chandef; - struct ieee80211_link_data *link; -+ struct ieee80211_chanctx_conf *chanctx_conf; - unsigned int link_id; - - lockdep_assert_wiphy(local->hw.wiphy); -@@ -3468,6 +3473,11 @@ void ieee80211_dfs_cac_cancel(struct iee - if (!link) - continue; - -+ chanctx_conf = sdata_dereference(link->conf->chanctx_conf, -+ sdata); -+ if (ctx && &ctx->conf != chanctx_conf) -+ continue; -+ - wiphy_delayed_work_cancel(local->hw.wiphy, - &link->dfs_cac_timer_work); - -@@ -3488,9 +3498,8 @@ void ieee80211_dfs_radar_detected_work(s - { - struct ieee80211_local *local = - container_of(work, struct ieee80211_local, radar_detected_work); -- struct cfg80211_chan_def chandef = local->hw.conf.chandef; -+ struct cfg80211_chan_def chandef; - struct ieee80211_chanctx *ctx; -- int num_chanctx = 0; - - lockdep_assert_wiphy(local->hw.wiphy); - -@@ -3498,25 +3507,46 @@ void ieee80211_dfs_radar_detected_work(s - if (ctx->replace_state == IEEE80211_CHANCTX_REPLACES_OTHER) - continue; - -- num_chanctx++; -+ if (!ctx->radar_detected) -+ continue; -+ -+ ctx->radar_detected = false; -+ - chandef = ctx->conf.def; -+ -+ ieee80211_dfs_cac_cancel(local, ctx); -+ cfg80211_radar_event(local->hw.wiphy, &chandef, GFP_KERNEL); - } -+} - -- ieee80211_dfs_cac_cancel(local); -+static void -+ieee80211_radar_mark_chan_ctx_iterator(struct ieee80211_hw *hw, -+ struct ieee80211_chanctx_conf *chanctx_conf, -+ void *data) -+{ -+ struct ieee80211_chanctx *ctx = -+ container_of(chanctx_conf, struct ieee80211_chanctx, -+ conf); - -- if (num_chanctx > 1) -- /* XXX: multi-channel is not supported yet */ -- WARN_ON(1); -- else -- cfg80211_radar_event(local->hw.wiphy, &chandef, GFP_KERNEL); -+ if (ctx->replace_state == IEEE80211_CHANCTX_REPLACES_OTHER) -+ return; -+ -+ if (data && data != chanctx_conf) -+ return; -+ -+ ctx->radar_detected = true; - } - --void ieee80211_radar_detected(struct ieee80211_hw *hw) -+void ieee80211_radar_detected(struct ieee80211_hw *hw, -+ struct ieee80211_chanctx_conf *chanctx_conf) - { - struct ieee80211_local *local = hw_to_local(hw); - - trace_api_radar_detected(local); - -+ ieee80211_iter_chan_contexts_atomic(hw, ieee80211_radar_mark_chan_ctx_iterator, -+ chanctx_conf); -+ - wiphy_work_queue(hw->wiphy, &local->radar_detected_work); - } - EXPORT_SYMBOL(ieee80211_radar_detected); diff --git a/package/kernel/mac80211/patches/subsys/361-wifi-mac80211-fix-vif-addr-when-switching-from-monit.patch b/package/kernel/mac80211/patches/subsys/341-wifi-mac80211-fix-vif-addr-when-switching-from-monit.patch similarity index 100% rename from package/kernel/mac80211/patches/subsys/361-wifi-mac80211-fix-vif-addr-when-switching-from-monit.patch rename to package/kernel/mac80211/patches/subsys/341-wifi-mac80211-fix-vif-addr-when-switching-from-monit.patch diff --git a/package/kernel/mac80211/patches/subsys/341-wifi-mac80211-skip-non-uploaded-keys-in-ieee80211_it.patch b/package/kernel/mac80211/patches/subsys/341-wifi-mac80211-skip-non-uploaded-keys-in-ieee80211_it.patch deleted file mode 100644 index b426d68c326fd0..00000000000000 --- a/package/kernel/mac80211/patches/subsys/341-wifi-mac80211-skip-non-uploaded-keys-in-ieee80211_it.patch +++ /dev/null @@ -1,79 +0,0 @@ -From: Felix Fietkau -Date: Sun, 6 Oct 2024 17:34:08 +0200 -Subject: [PATCH] wifi: mac80211: skip non-uploaded keys in ieee80211_iter_keys - -Sync iterator conditions with ieee80211_iter_keys_rcu. - -Fixes: 830af02f24fb ("mac80211: allow driver to iterate keys") -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/key.c -+++ b/net/mac80211/key.c -@@ -987,6 +987,26 @@ void ieee80211_reenable_keys(struct ieee - } - } - -+static void -+ieee80211_key_iter(struct ieee80211_hw *hw, -+ struct ieee80211_vif *vif, -+ struct ieee80211_key *key, -+ void (*iter)(struct ieee80211_hw *hw, -+ struct ieee80211_vif *vif, -+ struct ieee80211_sta *sta, -+ struct ieee80211_key_conf *key, -+ void *data), -+ void *iter_data) -+{ -+ /* skip keys of station in removal process */ -+ if (key->sta && key->sta->removed) -+ return; -+ if (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) -+ return; -+ iter(hw, vif, key->sta ? &key->sta->sta : NULL, -+ &key->conf, iter_data); -+} -+ - void ieee80211_iter_keys(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - void (*iter)(struct ieee80211_hw *hw, -@@ -1005,16 +1025,13 @@ void ieee80211_iter_keys(struct ieee8021 - if (vif) { - sdata = vif_to_sdata(vif); - list_for_each_entry_safe(key, tmp, &sdata->key_list, list) -- iter(hw, &sdata->vif, -- key->sta ? &key->sta->sta : NULL, -- &key->conf, iter_data); -+ ieee80211_key_iter(hw, vif, key, iter, iter_data); - } else { - list_for_each_entry(sdata, &local->interfaces, list) - list_for_each_entry_safe(key, tmp, - &sdata->key_list, list) -- iter(hw, &sdata->vif, -- key->sta ? &key->sta->sta : NULL, -- &key->conf, iter_data); -+ ieee80211_key_iter(hw, &sdata->vif, key, -+ iter, iter_data); - } - } - EXPORT_SYMBOL(ieee80211_iter_keys); -@@ -1031,17 +1048,8 @@ _ieee80211_iter_keys_rcu(struct ieee8021 - { - struct ieee80211_key *key; - -- list_for_each_entry_rcu(key, &sdata->key_list, list) { -- /* skip keys of station in removal process */ -- if (key->sta && key->sta->removed) -- continue; -- if (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) -- continue; -- -- iter(hw, &sdata->vif, -- key->sta ? &key->sta->sta : NULL, -- &key->conf, iter_data); -- } -+ list_for_each_entry_rcu(key, &sdata->key_list, list) -+ ieee80211_key_iter(hw, &sdata->vif, key, iter, iter_data); - } - - void ieee80211_iter_keys_rcu(struct ieee80211_hw *hw, diff --git a/package/kernel/mac80211/patches/subsys/362-wifi-mac80211-fix-incorrect-timing-to-initialize-sta.patch b/package/kernel/mac80211/patches/subsys/362-wifi-mac80211-fix-incorrect-timing-to-initialize-sta.patch deleted file mode 100644 index 94e51afd859529..00000000000000 --- a/package/kernel/mac80211/patches/subsys/362-wifi-mac80211-fix-incorrect-timing-to-initialize-sta.patch +++ /dev/null @@ -1,32 +0,0 @@ -From: Benjamin Lin -Date: Mon, 18 Nov 2024 16:07:22 +0800 -Subject: [PATCH] wifi: mac80211: fix incorrect timing to initialize - station NSS capability - -Station's spatial streaming capability should be initialized before -handling VHT OMN, because the handling requires the capability information. - -Fixes: a8bca3e9371d ("wifi: mac80211: track capability/opmode NSS separately") -Signed-off-by: Benjamin Lin ---- - ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -1914,6 +1914,8 @@ static int sta_link_apply_parameters(str - params->eht_capa_len, - link_sta); - -+ ieee80211_sta_init_nss(link_sta); -+ - if (params->opmode_notif_used) { - /* returned value is only needed for rc update, but the - * rc isn't initialized here yet, so ignore it -@@ -1923,8 +1925,6 @@ static int sta_link_apply_parameters(str - sband->band); - } - -- ieee80211_sta_init_nss(link_sta); -- - return 0; - } - diff --git a/package/kernel/mac80211/patches/subsys/363-wifi-mac80211-ieee80211_i-Fix-memory-corruption-bug-.patch b/package/kernel/mac80211/patches/subsys/363-wifi-mac80211-ieee80211_i-Fix-memory-corruption-bug-.patch deleted file mode 100644 index dcdb89cd4a6542..00000000000000 --- a/package/kernel/mac80211/patches/subsys/363-wifi-mac80211-ieee80211_i-Fix-memory-corruption-bug-.patch +++ /dev/null @@ -1,53 +0,0 @@ -From: "Gustavo A. R. Silva" -Date: Fri, 25 Oct 2024 16:05:50 -0600 -Subject: [PATCH] wifi: mac80211: ieee80211_i: Fix memory corruption bug in - struct ieee80211_chanctx - -Move the `struct ieee80211_chanctx_conf conf` to the end of -`struct ieee80211_chanctx` and fix a memory corruption bug -triggered e.g. in `hwsim_set_chanctx_magic()`: `radar_detected` -is being overwritten when `cp->magic = HWSIM_CHANCTX_MAGIC;` -See the function call sequence below: - -drv_add_chanctx(... struct ieee80211_chanctx *ctx) -> - local->ops->add_chanctx(&local->hw, &ctx->conf) -> - mac80211_hwsim_add_chanctx(... struct ieee80211_chanctx_conf *ctx) -> - hwsim_set_chanctx_magic(ctx) - -This also happens in a number of other drivers. - -Also, add a code comment to try to prevent people from introducing -new members after `struct ieee80211_chanctx_conf conf`. Notice that -`struct ieee80211_chanctx_conf` is a flexible structure --a structure -that contains a flexible-array member, so it should always be at -the end of any other containing structures. - -This change also fixes 50 of the following warnings: - -net/mac80211/ieee80211_i.h:895:39: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] - --Wflex-array-member-not-at-end was introduced in GCC-14, and we are -getting ready to enable it, globally. - -Fixes: bca8bc0399ac ("wifi: mac80211: handle ieee80211_radar_detected() for MLO") -Signed-off-by: Gustavo A. R. Silva -Link: https://patch.msgid.link/ZxwWPrncTeSi1UTq@kspp -[also refer to other drivers in commit message] -Signed-off-by: Johannes Berg ---- - ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -894,9 +894,10 @@ struct ieee80211_chanctx { - /* temporary data for search algorithm etc. */ - struct ieee80211_chan_req req; - -- struct ieee80211_chanctx_conf conf; -- - bool radar_detected; -+ -+ /* MUST be last - ends in a flexible-array member. */ -+ struct ieee80211_chanctx_conf conf; - }; - - struct mac80211_qos_map { diff --git a/package/kernel/mac80211/patches/subsys/364-mac80211-fix-user-power-when-emulating-chanctx.patch b/package/kernel/mac80211/patches/subsys/364-mac80211-fix-user-power-when-emulating-chanctx.patch deleted file mode 100644 index 15db2c54e4d4e2..00000000000000 --- a/package/kernel/mac80211/patches/subsys/364-mac80211-fix-user-power-when-emulating-chanctx.patch +++ /dev/null @@ -1,24 +0,0 @@ -From: Ben Greear -Date: Thu, 10 Oct 2024 13:39:54 -0700 -Subject: [PATCH] mac80211: fix user-power when emulating chanctx - -ieee80211_calc_hw_conf_chan was ignoring the configured -user_txpower. If it is set, use it to potentially decrease -txpower as requested. - -Signed-off-by: Ben Greear -Link: https://patch.msgid.link/20241010203954.1219686-1-greearb@candelatech.com -Signed-off-by: Johannes Berg ---- - ---- a/net/mac80211/main.c -+++ b/net/mac80211/main.c -@@ -167,6 +167,8 @@ static u32 ieee80211_calc_hw_conf_chan(s - } - - power = ieee80211_chandef_max_power(&chandef); -+ if (local->user_power_level != IEEE80211_UNSET_POWER_LEVEL) -+ power = min(local->user_power_level, power); - - rcu_read_lock(); - list_for_each_entry_rcu(sdata, &local->interfaces, list) { diff --git a/package/kernel/mac80211/patches/subsys/365-wifi-cfg80211-Add-wiphy_delayed_work_pending.patch b/package/kernel/mac80211/patches/subsys/365-wifi-cfg80211-Add-wiphy_delayed_work_pending.patch deleted file mode 100644 index 981cc2433b3563..00000000000000 --- a/package/kernel/mac80211/patches/subsys/365-wifi-cfg80211-Add-wiphy_delayed_work_pending.patch +++ /dev/null @@ -1,83 +0,0 @@ -From: Remi Pommarel -Date: Tue, 24 Sep 2024 21:28:04 +0200 -Subject: [PATCH] wifi: cfg80211: Add wiphy_delayed_work_pending() - -Add wiphy_delayed_work_pending() to check if any delayed work timer is -pending, that can be used to be sure that wiphy_delayed_work_queue() -won't postpone an already pending delayed work. - -Signed-off-by: Remi Pommarel -Link: https://patch.msgid.link/20240924192805.13859-2-repk@triplefau.lt -[fix return value kernel-doc] -Signed-off-by: Johannes Berg ---- - ---- a/include/net/cfg80211.h -+++ b/include/net/cfg80211.h -@@ -6141,6 +6141,50 @@ void wiphy_delayed_work_flush(struct wip - struct wiphy_delayed_work *dwork); - - /** -+ * wiphy_delayed_work_pending - Find out whether a wiphy delayable -+ * work item is currently pending. -+ * -+ * @wiphy: the wiphy, for debug purposes -+ * @dwork: the delayed work in question -+ * -+ * Return: true if timer is pending, false otherwise -+ * -+ * How wiphy_delayed_work_queue() works is by setting a timer which -+ * when it expires calls wiphy_work_queue() to queue the wiphy work. -+ * Because wiphy_delayed_work_queue() uses mod_timer(), if it is -+ * called twice and the second call happens before the first call -+ * deadline, the work will rescheduled for the second deadline and -+ * won't run before that. -+ * -+ * wiphy_delayed_work_pending() can be used to detect if calling -+ * wiphy_work_delayed_work_queue() would start a new work schedule -+ * or delayed a previous one. As seen below it cannot be used to -+ * detect precisely if the work has finished to execute nor if it -+ * is currently executing. -+ * -+ * CPU0 CPU1 -+ * wiphy_delayed_work_queue(wk) -+ * mod_timer(wk->timer) -+ * wiphy_delayed_work_pending(wk) -> true -+ * -+ * [...] -+ * expire_timers(wk->timer) -+ * detach_timer(wk->timer) -+ * wiphy_delayed_work_pending(wk) -> false -+ * wk->timer->function() | -+ * wiphy_work_queue(wk) | delayed work pending -+ * list_add_tail() | returns false but -+ * queue_work(cfg80211_wiphy_work) | wk->func() has not -+ * | been run yet -+ * [...] | -+ * cfg80211_wiphy_work() | -+ * wk->func() V -+ * -+ */ -+bool wiphy_delayed_work_pending(struct wiphy *wiphy, -+ struct wiphy_delayed_work *dwork); -+ -+/** - * enum ieee80211_ap_reg_power - regulatory power for an Access Point - * - * @IEEE80211_REG_UNSET_AP: Access Point has no regulatory power mode ---- a/net/wireless/core.c -+++ b/net/wireless/core.c -@@ -1735,6 +1735,13 @@ void wiphy_delayed_work_flush(struct wip - } - EXPORT_SYMBOL_GPL(wiphy_delayed_work_flush); - -+bool wiphy_delayed_work_pending(struct wiphy *wiphy, -+ struct wiphy_delayed_work *dwork) -+{ -+ return timer_pending(&dwork->timer); -+} -+EXPORT_SYMBOL_GPL(wiphy_delayed_work_pending); -+ - static int __init cfg80211_init(void) - { - int err; diff --git a/package/kernel/mac80211/patches/subsys/366-wifi-mac80211-Convert-color-collision-detection-to-w.patch b/package/kernel/mac80211/patches/subsys/366-wifi-mac80211-Convert-color-collision-detection-to-w.patch deleted file mode 100644 index ae72441c468819..00000000000000 --- a/package/kernel/mac80211/patches/subsys/366-wifi-mac80211-Convert-color-collision-detection-to-w.patch +++ /dev/null @@ -1,148 +0,0 @@ -From: Remi Pommarel -Date: Tue, 24 Sep 2024 21:28:05 +0200 -Subject: [PATCH] wifi: mac80211: Convert color collision detection to wiphy - work - -Call to ieee80211_color_collision_detection_work() needs wiphy lock to -be held (see lockdep assert in cfg80211_bss_color_notify()). Not locking -wiphy causes the following lockdep error: - - WARNING: CPU: 2 PID: 42 at net/wireless/nl80211.c:19505 cfg80211_bss_color_notify+0x1a4/0x25c - Modules linked in: - CPU: 2 PID: 42 Comm: kworker/u8:3 Tainted: G W 6.4.0-02327-g36c6cb260481 #1048 - Hardware name: - Workqueue: phy1 ieee80211_color_collision_detection_work - pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) - pc : cfg80211_bss_color_notify+0x1a4/0x25c - lr : cfg80211_bss_color_notify+0x1a0/0x25c - sp : ffff000002947d00 - x29: ffff000002947d00 x28: ffff800008e1a000 x27: ffff000002bd4705 - x26: ffff00000d034000 x25: ffff80000903cf40 x24: 0000000000000000 - x23: ffff00000cb70720 x22: 0000000000800000 x21: ffff800008dfb008 - x20: 000000000000008d x19: ffff00000d035fa8 x18: 0000000000000010 - x17: 0000000000000001 x16: 000003564b1ce96a x15: 000d69696d057970 - x14: 000000000000003b x13: 0000000000000001 x12: 0000000000040000 - x11: 0000000000000001 x10: ffff80000978f9c0 x9 : ffff0000028d3174 - x8 : ffff800008e30000 x7 : 0000000000000000 x6 : 0000000000000028 - x5 : 000000000002f498 x4 : ffff00000d034a80 x3 : 0000000000800000 - x2 : ffff800016143000 x1 : 0000000000000000 x0 : 0000000000000000 - Call trace: - cfg80211_bss_color_notify+0x1a4/0x25c - ieee80211_color_collision_detection_work+0x20/0x118 - process_one_work+0x294/0x554 - worker_thread+0x70/0x440 - kthread+0xf4/0xf8 - ret_from_fork+0x10/0x20 - irq event stamp: 77372 - hardirqs last enabled at (77371): [] _raw_spin_unlock_irq+0x2c/0x4c - hardirqs last disabled at (77372): [] el1_dbg+0x20/0x48 - softirqs last enabled at (77350): [] batadv_send_outstanding_bcast_packet+0xb8/0x120 - softirqs last disabled at (77348): [] batadv_send_outstanding_bcast_packet+0x80/0x120 - -The wiphy lock cannot be taken directly from color collision detection -delayed work (ieee80211_color_collision_detection_work()) because this -work is cancel_delayed_work_sync() under this wiphy lock causing a -potential deadlock( see [0] for details). - -To fix that ieee80211_color_collision_detection_work() could be -converted to a wiphy work and cancel_delayed_work_sync() can be simply -replaced by wiphy_delayed_work_cancel() serving the same purpose under -wiphy lock. - -This could potentially fix [1]. - -[0]: https://lore.kernel.org/linux-wireless/D4A40Q44OAY2.W3SIF6UEPBUN@freebox.fr/ -[1]: https://lore.kernel.org/lkml/000000000000612f290618eee3e5@google.com/ - -Reported-by: Nicolas Escande -Signed-off-by: Remi Pommarel -Link: https://patch.msgid.link/20240924192805.13859-3-repk@triplefau.lt -Signed-off-by: Johannes Berg ---- - ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -4836,12 +4836,12 @@ void ieee80211_color_change_finalize_wor - ieee80211_color_change_finalize(link); - } - --void ieee80211_color_collision_detection_work(struct work_struct *work) -+void ieee80211_color_collision_detection_work(struct wiphy *wiphy, -+ struct wiphy_work *work) - { -- struct delayed_work *delayed_work = to_delayed_work(work); - struct ieee80211_link_data *link = -- container_of(delayed_work, struct ieee80211_link_data, -- color_collision_detect_work); -+ container_of(work, struct ieee80211_link_data, -+ color_collision_detect_work.work); - struct ieee80211_sub_if_data *sdata = link->sdata; - - cfg80211_obss_color_collision_notify(sdata->dev, link->color_bitmap, -@@ -4894,7 +4894,8 @@ ieee80211_obss_color_collision_notify(st - return; - } - -- if (delayed_work_pending(&link->color_collision_detect_work)) { -+ if (wiphy_delayed_work_pending(sdata->local->hw.wiphy, -+ &link->color_collision_detect_work)) { - rcu_read_unlock(); - return; - } -@@ -4903,9 +4904,9 @@ ieee80211_obss_color_collision_notify(st - /* queue the color collision detection event every 500 ms in order to - * avoid sending too much netlink messages to userspace. - */ -- ieee80211_queue_delayed_work(&sdata->local->hw, -- &link->color_collision_detect_work, -- msecs_to_jiffies(500)); -+ wiphy_delayed_work_queue(sdata->local->hw.wiphy, -+ &link->color_collision_detect_work, -+ msecs_to_jiffies(500)); - - rcu_read_unlock(); - } ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -1056,7 +1056,7 @@ struct ieee80211_link_data { - } csa; - - struct wiphy_work color_change_finalize_work; -- struct delayed_work color_collision_detect_work; -+ struct wiphy_delayed_work color_collision_detect_work; - u64 color_bitmap; - - /* context reservation -- protected with wiphy mutex */ -@@ -2010,7 +2010,8 @@ int ieee80211_channel_switch(struct wiph - /* color change handling */ - void ieee80211_color_change_finalize_work(struct wiphy *wiphy, - struct wiphy_work *work); --void ieee80211_color_collision_detection_work(struct work_struct *work); -+void ieee80211_color_collision_detection_work(struct wiphy *wiphy, -+ struct wiphy_work *work); - - /* interface handling */ - #define MAC80211_SUPPORTED_FEATURES_TX (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | \ ---- a/net/mac80211/link.c -+++ b/net/mac80211/link.c -@@ -41,8 +41,8 @@ void ieee80211_link_init(struct ieee8021 - ieee80211_csa_finalize_work); - wiphy_work_init(&link->color_change_finalize_work, - ieee80211_color_change_finalize_work); -- INIT_DELAYED_WORK(&link->color_collision_detect_work, -- ieee80211_color_collision_detection_work); -+ wiphy_delayed_work_init(&link->color_collision_detect_work, -+ ieee80211_color_collision_detection_work); - INIT_LIST_HEAD(&link->assigned_chanctx_list); - INIT_LIST_HEAD(&link->reserved_chanctx_list); - wiphy_delayed_work_init(&link->dfs_cac_timer_work, -@@ -72,7 +72,8 @@ void ieee80211_link_stop(struct ieee8021 - if (link->sdata->vif.type == NL80211_IFTYPE_STATION) - ieee80211_mgd_stop_link(link); - -- cancel_delayed_work_sync(&link->color_collision_detect_work); -+ wiphy_delayed_work_cancel(link->sdata->local->hw.wiphy, -+ &link->color_collision_detect_work); - wiphy_work_cancel(link->sdata->local->hw.wiphy, - &link->color_change_finalize_work); - wiphy_work_cancel(link->sdata->local->hw.wiphy, From 3ad92b68f1c51855069d9b3c63b1e76a109e8444 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 30 Dec 2024 21:27:46 +0100 Subject: [PATCH 274/877] mt76: update to Git HEAD (2024-12-30) 109114146f9c mt76: only enable tx worker after setting the channel 5fe42ec88fd1 mt76: mt7915: ensure that only one sta entry is active per mac address 1884f568ba02 wifi: mt76: do not add wcid entries to sta poll list during MCU reset 71fa9124d107 wifi: mt76: mt7996: fix NULL pointer dereference in mt7996_mcu_sta_bfer_he eb85bb3fd5bf wifi: mt76: mt7915: fix eifs value on older chipsets 83e4d4a82e65 wifi: mt76: introduce mt792x_config_mac_addr_list routine b47e20b440ae wifi: mt76: mt7925: fix NULL deref check in mt7925_change_vif_links 3e3c484726f3 wifi: mt76: mt7925: fix wrong band_idx setting when enable sniffer mode 3f1401a0f035 wifi: mt76: mt7925: fix get wrong chip cap from incorrect pointer eede99f524e8 wifi: mt76: mt7925: fix the invalid ip address for arp offload c99e4d51b340 wifi: mt76: mt7996: fix overflows seen when writing limit attributes af983b2543ed wifi: mt76: mt7915: fix overflows seen when writing limit attributes af494e2dcc94 wifi: mt76: mt7915: exclude tx backoff time from airtime 6f6a1f7cb381 wifi: mt76: mt7996: exclude tx backoff time from airtime 7f65b1b28b4c wifi: mt76: connac: Extend mt76_connac_mcu_uni_add_dev for MLO 1b5e6abc2e7a wifi: mt76: mt7925: Fix incorrect MLD address in bss_mld_tlv for MLO support 72b4688b3912 wifi: mt76: mt7925: Fix incorrect WCID assignment for MLO 6bd2c044e67a wifi: mt76: mt7925: Fix incorrect WCID phy_idx assignment 1c04e9693466 wifi: mt76: mt7925: fix wrong parameter for related cmd of chan info 01e02947bdbf wifi: mt76: mt7925: Fix CNM Timeout with Single Active Link in MLO b90b1a1dc71b wifi: mt76: mt7925: Enhance mt7925_mac_link_bss_add to support MLO 53ec7a551f17 wifi: mt76: Enhance mt7925_mac_link_sta_add to support MLO 3c99ef40e0e7 wifi: mt76: mt7925: Update mt7925_mcu_sta_update for BC in ASSOC state 285efc6afaec wifi: mt76: mt7925: Update mt792x_rx_get_wcid for per-link STA e5c0d1289e6c wifi: mt76: mt7925: Update mt7925_unassign_vif_chanctx for per-link BSS 67dcd5c888c4 wifi: mt76: mt7925: Update secondary link PS flow fd4d6f87072f wifi: mt76: mt7925: Init secondary link PM state 6d972b5b9d6a wifi: mt76: mt7925: Update mt7925_mcu_uni_[tx,rx]_ba for MLO 3acc6cbb9556 wifi: mt76: mt7925: Cleanup MLO settings post-disconnection 0aab0c61ce92 wifi: mt76: mt7925: Properly handle responses for commands with events 15bead1b0041 wifi: mt76: do not hold queue lock during initial rx buffer alloc 732044a949d5 wifi: mt76: mt7925: config the dwell time by firmware 9ba311ec6afa wifi: mt76: mt7921: introduce CSA support 5d12c7404c22 wifi: mt76: mt7921: add rfkill_poll for hardware rfkill ef965d408b79 wifi: mt76: mt7925: replace zero-length array with flexible-array member f8563589c72d wifi: mt76: mt7921u: Add VID/PID for TP-Link TXE50UH Signed-off-by: Felix Fietkau (cherry picked from commit bff5260d7b2f706f6d32acbb4fbe5f10d7acca5c) --- 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 b5cdc765729975..d7fd80d331b1e0 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:=2024-10-28 -PKG_SOURCE_VERSION:=c246fa545119abe5097682316700f13c91399042 -PKG_MIRROR_HASH:=ff59d9588e6b114be8fe08013b55da975bc6bb4219b97b6fedb72246e9337c18 +PKG_SOURCE_DATE:=2024-12-30 +PKG_SOURCE_VERSION:=f8563589c72d93c35f9316c65de361061b785699 +PKG_MIRROR_HASH:=aba3906b44d7dc952add8786ab46a27512d04efbd3e6a7a40526707a2ff87445 PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 From 85d1d03cab4068c7a36e9bc9a0aa9e0e93325657 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 3 Jan 2025 11:06:08 +0100 Subject: [PATCH 275/877] mt76: update to Git HEAD (2025-01-03) 46715044ecd2 wifi: mt76: mt7996: implement driver specific get_txpower function 959a2d40007f wifi: mt76: mt7996: initialize phy txpower Signed-off-by: Felix Fietkau (cherry picked from commit 65aff89f641f6adccac80ee73b02b99a904739d5) --- 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 d7fd80d331b1e0..d603b6215fd943 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:=2024-12-30 -PKG_SOURCE_VERSION:=f8563589c72d93c35f9316c65de361061b785699 -PKG_MIRROR_HASH:=aba3906b44d7dc952add8786ab46a27512d04efbd3e6a7a40526707a2ff87445 +PKG_SOURCE_DATE:=2025-01-03 +PKG_SOURCE_VERSION:=959a2d40007f502d9465b8aede79e761f875abd3 +PKG_MIRROR_HASH:=a00a26a4685c053a639a95657804b09d0d4a1452744647871070beb6332b7c3a PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 From 83afb428b089aa46e05744935aa25358a67a8b23 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 11 Nov 2024 19:52:14 +0100 Subject: [PATCH 276/877] build: remove broken dependency of metadata on toplevel .config variables Instead of relying on .config symbols for metadata, alter the DEFAULT variable of affected packages. Fixes enabling opkg vs apk among others. Signed-off-by: Felix Fietkau (cherry picked from commit 44598c233dd9a676bc34666968f33f8b9ff4dd0c) --- include/target.mk | 40 ++-------------------------------- package/system/apk/Makefile | 1 + package/system/opkg/Makefile | 1 + package/system/procd/Makefile | 3 +++ package/utils/busybox/Makefile | 2 ++ 5 files changed, 9 insertions(+), 38 deletions(-) diff --git a/include/target.mk b/include/target.mk index 0108bced99c963..02ea68b15c8121 100644 --- a/include/target.mk +++ b/include/target.mk @@ -90,45 +90,9 @@ else endif endif -ifneq ($(DUMP),) - # Parse generic config that might be set before a .config is generated to modify the - # default package configuration - # Keep DYNAMIC_DEF_PKG_CONF in sync with toplevel.mk to reflect the same configs - DYNAMIC_DEF_PKG_CONF := CONFIG_USE_APK CONFIG_SELINUX CONFIG_SMALL_FLASH CONFIG_SECCOMP - $(foreach config, $(DYNAMIC_DEF_PKG_CONF), \ - $(eval $(config) := $(shell grep "$(config)=y" $(TOPDIR)/.config 2>/dev/null)) \ - ) - # The config options that are enabled by default and where other default - # packages depends on needs to be set if they are missing in the .config. - ifeq ($(shell grep "CONFIG_SECCOMP" $(TOPDIR)/.config 2>/dev/null),) - ifeq ($(filter $(BOARD), uml),) - ifneq ($(filter $(ARCH), aarch64 arm armeb mips mipsel mips64 mips64el i386 powerpc x86_64),) - CONFIG_SECCOMP := y - endif - endif - endif -endif - -ifneq ($(CONFIG_USE_APK),) -DEFAULT_PACKAGES+=apk-mbedtls -else -DEFAULT_PACKAGES+=opkg -endif - -ifneq ($(CONFIG_SELINUX),) -DEFAULT_PACKAGES+=busybox-selinux procd-selinux -else -DEFAULT_PACKAGES+=busybox procd -endif - # include ujail on systems with enough storage -ifeq ($(CONFIG_SMALL_FLASH),) -DEFAULT_PACKAGES+=procd-ujail -endif - -# include seccomp ld-preload hooks if kernel supports it -ifneq ($(CONFIG_SECCOMP),) -DEFAULT_PACKAGES+=procd-seccomp +ifeq ($(filter small_flash,$(FEATURES)),) + DEFAULT_PACKAGES+=procd-ujail endif # Add device specific packages (here below to allow device type set from subtarget) diff --git a/package/system/apk/Makefile b/package/system/apk/Makefile index 8242e12ee92e8b..7176d64ef22b15 100644 --- a/package/system/apk/Makefile +++ b/package/system/apk/Makefile @@ -36,6 +36,7 @@ define Package/apk-mbedtls $(Package/apk/default) TITLE += (mbedtls) DEPENDS +=+libmbedtls + DEFAULT:=y if USE_APK VARIANT:=mbedtls DEFAULT_VARIANT:=1 CONFLICTS:=apk-openssl diff --git a/package/system/opkg/Makefile b/package/system/opkg/Makefile index 9fea969ae96e0b..e7c45e3523135a 100644 --- a/package/system/opkg/Makefile +++ b/package/system/opkg/Makefile @@ -39,6 +39,7 @@ define Package/opkg CATEGORY:=Base system TITLE:=opkg package manager DEPENDS:=+uclient-fetch +libpthread +libubox + DEFAULT:=y if !USE_APK URL:=$(PKG_SOURCE_URL) MENU:=1 endef diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile index 88467c2e5922fd..ec47047f4f2e4e 100644 --- a/package/system/procd/Makefile +++ b/package/system/procd/Makefile @@ -50,6 +50,7 @@ define Package/procd $(call Package/procd/Default) VARIANT:=default CONFLICTS:=procd-selinux + DEFAULT:=y if !SELINUX endef define Package/procd-selinux @@ -58,6 +59,7 @@ define Package/procd-selinux TITLE += with SELinux support PROVIDES:=procd VARIANT:=selinux + DEFAULT:=y if SELINUX endef define Package/procd-ujail @@ -73,6 +75,7 @@ define Package/procd-seccomp CATEGORY:=Base system DEPENDS:=@SECCOMP +libubox +libblobmsg-json TITLE:=OpenWrt process seccomp helper + utrace + DEFAULT:=y if SECCOMP endef define Package/uxc diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile index 7d302bd159f09f..4faa12b791cb56 100644 --- a/package/utils/busybox/Makefile +++ b/package/utils/busybox/Makefile @@ -56,6 +56,7 @@ define Package/busybox $(call Package/busybox/Default) CONFLICTS:=busybox-selinux VARIANT:=default + DEFAULT:=y if !SELINUX endef define Package/busybox-selinux @@ -64,6 +65,7 @@ define Package/busybox-selinux DEPENDS += +libselinux VARIANT:=selinux PROVIDES:=busybox + DEFAULT:=y if SELINUX endef define Package/busybox/description From f97e729f8c7b978f0b18986bcaa496e1be336778 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 13 Nov 2024 07:04:31 +0100 Subject: [PATCH 277/877] build: fix including busybox, procd and apk/opkg in imagebuilder Since the image builder pulls package lists from metadata directly, add procd and busybox as depdendencies to base-files. As for the package manager itself, since it can be disabled it needs to be added directly in the image builder makefile Fixes: 44598c233dd9 ("build: remove broken dependency of metadata on toplevel .config variables") Signed-off-by: Felix Fietkau (cherry picked from commit 4c65359af49b6ccecd98987f842db5eba985f64b) --- package/base-files/Makefile | 6 +++++- package/system/procd/Makefile | 3 --- package/utils/busybox/Makefile | 2 -- target/imagebuilder/files/Makefile | 5 +++++ 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/package/base-files/Makefile b/package/base-files/Makefile index 4bcb4882d733c4..7ac4ea557f9f10 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -39,7 +39,11 @@ endif define Package/base-files SECTION:=base CATEGORY:=Base system - DEPENDS:=+netifd +libc +jsonfilter +SIGNED_PACKAGES:usign +SIGNED_PACKAGES:openwrt-keyring +NAND_SUPPORT:ubi-utils +fstools +fwtool + DEPENDS:= \ + +netifd +libc +jsonfilter +SIGNED_PACKAGES:usign +SIGNED_PACKAGES:openwrt-keyring \ + +NAND_SUPPORT:ubi-utils +fstools +fwtool \ + +SELINUX:procd-selinux +!SELINUX:procd +SECCOMP:procd-seccomp \ + +SELINUX:busybox-selinux +!SELINUX:busybox TITLE:=Base filesystem for OpenWrt URL:=http://openwrt.org/ VERSION:=$(PKG_RELEASE)~$(lastword $(subst -, ,$(REVISION))) diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile index ec47047f4f2e4e..88467c2e5922fd 100644 --- a/package/system/procd/Makefile +++ b/package/system/procd/Makefile @@ -50,7 +50,6 @@ define Package/procd $(call Package/procd/Default) VARIANT:=default CONFLICTS:=procd-selinux - DEFAULT:=y if !SELINUX endef define Package/procd-selinux @@ -59,7 +58,6 @@ define Package/procd-selinux TITLE += with SELinux support PROVIDES:=procd VARIANT:=selinux - DEFAULT:=y if SELINUX endef define Package/procd-ujail @@ -75,7 +73,6 @@ define Package/procd-seccomp CATEGORY:=Base system DEPENDS:=@SECCOMP +libubox +libblobmsg-json TITLE:=OpenWrt process seccomp helper + utrace - DEFAULT:=y if SECCOMP endef define Package/uxc diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile index 4faa12b791cb56..7d302bd159f09f 100644 --- a/package/utils/busybox/Makefile +++ b/package/utils/busybox/Makefile @@ -56,7 +56,6 @@ define Package/busybox $(call Package/busybox/Default) CONFLICTS:=busybox-selinux VARIANT:=default - DEFAULT:=y if !SELINUX endef define Package/busybox-selinux @@ -65,7 +64,6 @@ define Package/busybox-selinux DEPENDS += +libselinux VARIANT:=selinux PROVIDES:=busybox - DEFAULT:=y if SELINUX endef define Package/busybox/description diff --git a/target/imagebuilder/files/Makefile b/target/imagebuilder/files/Makefile index 54bc6128407289..811e8f14e5fbf4 100644 --- a/target/imagebuilder/files/Makefile +++ b/target/imagebuilder/files/Makefile @@ -138,6 +138,11 @@ _call_info: FORCE echo 'Available Profiles:' echo; $(PROFILE_LIST) +ifneq ($(CONFIG_USE_APK),) + DEFAULT_PACKAGES += apk-mbedtls +else + DEFAULT_PACKAGES += opkg +endif 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)) From c22410e7a9cdd409f7515416a1e4a3e094822b8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Sun, 17 Nov 2024 05:13:27 +0000 Subject: [PATCH 278/877] imagebuilder: move handling of DEFAULT_PACKAGES into shareable place MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It seems, that handling of DEFAULT_PACKAGES is needed in more places, so lets move it into dedicated include file so it can be easily shared. Signed-off-by: Petr Štetiar Link: https://github.com/openwrt/openwrt/pull/16986 Signed-off-by: Robert Marko (cherry picked from commit 40be892a020e37869cdc188cd9a09bb7dc0a6872) --- include/default-packages.mk | 5 +++++ target/imagebuilder/files/Makefile | 1 + 2 files changed, 6 insertions(+) create mode 100644 include/default-packages.mk diff --git a/include/default-packages.mk b/include/default-packages.mk new file mode 100644 index 00000000000000..c964e92a033aec --- /dev/null +++ b/include/default-packages.mk @@ -0,0 +1,5 @@ +ifneq ($(CONFIG_USE_APK),) + DEFAULT_PACKAGES += apk-mbedtls +else + DEFAULT_PACKAGES += opkg +endif diff --git a/target/imagebuilder/files/Makefile b/target/imagebuilder/files/Makefile index 811e8f14e5fbf4..e9e08fb2765b0e 100644 --- a/target/imagebuilder/files/Makefile +++ b/target/imagebuilder/files/Makefile @@ -26,6 +26,7 @@ include $(INCLUDE_DIR)/debug.mk include $(INCLUDE_DIR)/depends.mk include $(INCLUDE_DIR)/rootfs.mk +include $(INCLUDE_DIR)/default-packages.mk include $(INCLUDE_DIR)/version.mk export REVISION export SOURCE_DATE_EPOCH From 19db092082e676e8193a5bbe77f2bb62853fd8f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Sun, 17 Nov 2024 05:15:13 +0000 Subject: [PATCH 279/877] linux: fix missing default packages in profiles.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Robert reported, that in firmware images generated by ASU, there is `apk` package manager missing after the commit 44598c233dd9 ("build: remove broken dependency of metadata on toplevel .config variables"). That is happening, because apk got removed from `default_packages` list in `profiles.json`, which is being generated by `json_overview_image_info` Make target, which uses `scripts/json_overview_image_info.py` helper script, which gets the information from `DEFAULT_PACKAGES` Make variable. So lets fix it by providing `DEFAULT_PACKAGES` variable when its needed. The reason why we didn't added those packages as a dependency to base-files like any other packages, was to allow disabling them (in order to save space). Fixes: #16969 Fixes: openwrt/asu/issues/1084 Fixes: 44598c233dd9 ("build: remove broken dependency of metadata on toplevel .config variables") Reported-by: Robert Marko Signed-off-by: Petr Štetiar Link: https://github.com/openwrt/openwrt/pull/16986 Signed-off-by: Robert Marko (cherry picked from commit 90f0be8521a8608b0932c1ccb747c0ef1a085910) --- target/linux/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/Makefile b/target/linux/Makefile index eaf31982229677..f1e20abf046b03 100644 --- a/target/linux/Makefile +++ b/target/linux/Makefile @@ -4,6 +4,7 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/target.mk +include $(INCLUDE_DIR)/default-packages.mk export TARGET_BUILD=1 From 933ae0699ae61b1e841c08ffe41aa7eea0ca673d Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 2 Dec 2024 12:27:35 +0100 Subject: [PATCH 280/877] build: remove targetinfo invalidation based on .config Target info no longer depends on config settings Signed-off-by: Felix Fietkau (cherry picked from commit 3b661cfcf9158a3dc5be6f7e1e1340339c9423b5) --- include/toplevel.mk | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/include/toplevel.mk b/include/toplevel.mk index e5f5e0fecd8de4..092dff786c9922 100644 --- a/include/toplevel.mk +++ b/include/toplevel.mk @@ -75,22 +75,7 @@ endif _ignore = $(foreach p,$(IGNORE_PACKAGES),--ignore $(p)) -# Config that will invalidate the .targetinfo as they will affect -# DEFAULT_PACKAGES. -# Keep DYNAMIC_DEF_PKG_CONF in sync with target.mk to reflect the same configs -DYNAMIC_DEF_PKG_CONF := CONFIG_USE_APK CONFIG_SELINUX CONFIG_SMALL_FLASH CONFIG_SECCOMP -check-dynamic-def-pkg: FORCE - @+DEF_PKG_CONFS=""; \ - if [ -f $(TOPDIR)/.config ]; then \ - for config in $(DYNAMIC_DEF_PKG_CONF); do \ - DEF_PKG_CONFS="$$DEF_PKG_CONFS "$$(grep "$$config"=y $(TOPDIR)/.config); \ - done; \ - fi; \ - [ ! -f tmp/.packagedynamicdefault ] || OLD_DEF_PKG_CONFS=$$(cat tmp/.packagedynamicdefault); \ - [ "$$DEF_PKG_CONFS" = "$$OLD_DEF_PKG_CONFS" ] || rm -rf tmp/info/.targetinfo*; \ - mkdir -p tmp && echo "$$DEF_PKG_CONFS" > tmp/.packagedynamicdefault; - -prepare-tmpinfo: check-dynamic-def-pkg FORCE +prepare-tmpinfo: FORCE @+$(MAKE) -r -s $(STAGING_DIR_HOST)/.prereq-build $(PREP_MK) mkdir -p tmp/info feeds [ -e $(TOPDIR)/feeds/base ] || ln -sf $(TOPDIR)/package $(TOPDIR)/feeds/base From 184d1c93cbe47e70c8bb4b01ddf7dc9152a58e23 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Sat, 23 Nov 2024 14:29:49 +0100 Subject: [PATCH 281/877] config: rename SECCOMP to USE_SECCOMP It seems that we have some kind of a symbol name conflict which causes CONFIG_SECCOMP to always be read as y. Unfortunatelly, I could not figure out what is causing this, but simply renaming SECCOMP to USE_SECCOMP seems to properly work and leaves the symbol unset unless arch dependencies are satisfied. This fixes qoriq and others that dont support seccomp from failing due to procd-seccomp package being selected to get included but it cannot be built for them: ERROR: unable to select packages: procd-seccomp (no such package): required by: base-files-1637~52b6c92479[procd-seccomp] Fixes: 4c65359af49b ("build: fix including busybox, procd and apk/opkg in imagebuilder") Link: https://github.com/openwrt/openwrt/pull/17048 Signed-off-by: Robert Marko (cherry picked from commit a48ec449ccab0069e84a72837bf06ba543e53aec) --- config/Config-build.in | 2 +- package/base-files/Makefile | 2 +- package/system/procd/Makefile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/Config-build.in b/config/Config-build.in index ae44985546b6dd..08acae63d3b24e 100644 --- a/config/Config-build.in +++ b/config/Config-build.in @@ -423,7 +423,7 @@ menu "Global build settings" endchoice - config SECCOMP + config USE_SECCOMP bool "Enable SECCOMP" select KERNEL_SECCOMP select PACKAGE_procd-seccomp diff --git a/package/base-files/Makefile b/package/base-files/Makefile index 7ac4ea557f9f10..c78c073699f2dc 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -42,7 +42,7 @@ define Package/base-files DEPENDS:= \ +netifd +libc +jsonfilter +SIGNED_PACKAGES:usign +SIGNED_PACKAGES:openwrt-keyring \ +NAND_SUPPORT:ubi-utils +fstools +fwtool \ - +SELINUX:procd-selinux +!SELINUX:procd +SECCOMP:procd-seccomp \ + +SELINUX:procd-selinux +!SELINUX:procd +USE_SECCOMP:procd-seccomp \ +SELINUX:busybox-selinux +!SELINUX:busybox TITLE:=Base filesystem for OpenWrt URL:=http://openwrt.org/ diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile index 88467c2e5922fd..7a2276a46d1967 100644 --- a/package/system/procd/Makefile +++ b/package/system/procd/Makefile @@ -71,7 +71,7 @@ endef define Package/procd-seccomp SECTION:=base CATEGORY:=Base system - DEPENDS:=@SECCOMP +libubox +libblobmsg-json + DEPENDS:=@USE_SECCOMP +libubox +libblobmsg-json TITLE:=OpenWrt process seccomp helper + utrace endef From efebdf077cb21b76124f492d048b84c4e63c1e2c Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 2 Jan 2025 14:08:36 +0100 Subject: [PATCH 282/877] ubus: update to Git HEAD (2025-01-02) d996988ae55b libubus: close file descriptor after sending it from a request afa57cce0aff libubus: add support for using channels Signed-off-by: Felix Fietkau (cherry picked from commit f0df6e3a4a4996eca917fa17591b8f1d483dfa30) --- 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 bef5e622d7067f..9a807852a250b1 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:=2024-10-20 -PKG_SOURCE_VERSION:=252a9b0c1774790fb9c25735d5a09c27dba895db -PKG_MIRROR_HASH:=72c21f02710d2314447670f1f1ea1833d2961f65fea3f9f94c060dda7c9d5914 +PKG_SOURCE_DATE:=2025-01-02 +PKG_SOURCE_VERSION:=afa57cce0aff82f4a7a0e509d4387ebc23dd3be7 +PKG_MIRROR_HASH:=a0b3c1961f5f49d31c34a44576ce44538c3ee97bfce97f86f732d7ecc1df9798 PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE)) CMAKE_INSTALL:=1 From 9b9622271e1da65ae0693868124471386f76999a Mon Sep 17 00:00:00 2001 From: Florian Maurer Date: Fri, 3 Jan 2025 13:28:42 +0100 Subject: [PATCH 283/877] ipq40xx: fix label MAC address for FritzBox 7520/7530 The MAC address of the GMAC is contained inside the CWMP-Account number on the label. Similar fix as to the 4040 in b22d382ae4eaa1af42930115d91855f402314cac Link #13240 Signed-off-by: Florian Maurer Link: https://github.com/openwrt/openwrt/pull/17467 Signed-off-by: Robert Marko (cherry picked from commit b2b6955f80d05a8cec69f8497df8bed44cf3c64d) --- .../arch/arm/boot/dts/qcom/qcom-ipq4019-fritzbox-7530.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzbox-7530.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzbox-7530.dts index 2344ae7bf89583..4f6cafb8853861 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzbox-7530.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzbox-7530.dts @@ -19,6 +19,7 @@ led-failsafe = &info_red; led-running = &power_green; led-upgrade = &info_red; + label-mac-device = &gmac; }; soc { From bbfebf85273cf8e7c99fa9d1e40c7fa6b5602390 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 3 Jan 2025 20:22:13 +0100 Subject: [PATCH 284/877] kernel: add workaround for page_pool_release warnings defer_list skbs held by NAPI can block releasing page pools. Work around this by scheduling rx softirq on all CPUs while trying to release a page pool. Signed-off-by: Felix Fietkau (cherry picked from commit 2b70b32aef9e8e1ff275872d551c610368079911) --- ...y-to-free-deferred-skbs-while-waitin.patch | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 target/linux/generic/hack-6.6/610-net-page_pool-try-to-free-deferred-skbs-while-waitin.patch diff --git a/target/linux/generic/hack-6.6/610-net-page_pool-try-to-free-deferred-skbs-while-waitin.patch b/target/linux/generic/hack-6.6/610-net-page_pool-try-to-free-deferred-skbs-while-waitin.patch new file mode 100644 index 00000000000000..36c28b94f60e75 --- /dev/null +++ b/target/linux/generic/hack-6.6/610-net-page_pool-try-to-free-deferred-skbs-while-waitin.patch @@ -0,0 +1,43 @@ +From: Felix Fietkau +Date: Fri, 3 Jan 2025 19:29:00 +0100 +Subject: [PATCH] net: page_pool: try to free deferred skbs while waiting for + pool release + +The NAPI defer list can accumulate no longer used skbs, which can be reused +during alloc. If this happens on a CPU that otherwise does not do any +rx softirq processing, skbs can be held indefinitely, causing warnings +on releasing page pools. +Deal with this by scheduling rx softirq on all CPUs. + +Patch by Lorenzo Bianconi + +Signed-off-by: Felix Fietkau +--- + +--- a/net/core/page_pool.c ++++ b/net/core/page_pool.c +@@ -862,12 +862,23 @@ static void page_pool_release_retry(stru + { + struct delayed_work *dwq = to_delayed_work(wq); + struct page_pool *pool = container_of(dwq, typeof(*pool), release_dw); +- int inflight; ++ int cpu, inflight; + + inflight = page_pool_release(pool); + if (!inflight) + return; + ++ /* Run NET_RX_SOFTIRQ in order to free pending skbs in softnet_data ++ * defer_list that can stay in the list until we have enough queued ++ * traffic. ++ */ ++ for_each_online_cpu(cpu) { ++ struct softnet_data *sd = &per_cpu(softnet_data, cpu); ++ ++ if (!cmpxchg(&sd->defer_ipi_scheduled, 0, 1)) ++ smp_call_function_single_async(cpu, &sd->defer_csd); ++ } ++ + /* Periodic warning */ + if (time_after_eq(jiffies, pool->defer_warn)) { + int sec = (s32)((u32)jiffies - (u32)pool->defer_start) / HZ; From 09fcac8bc079edb20eabda857544022e115973a9 Mon Sep 17 00:00:00 2001 From: John Audia Date: Thu, 2 Jan 2025 06:34:15 -0500 Subject: [PATCH 285/877] kernel: bump 6.6 to 6.6.69 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.69 All patches automatically rebased. Build system: x86/64 Build-tested: bcm27xx/bcm2712, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Run-tested: bcm27xx/bcm2712, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/17459 Signed-off-by: Nick Hainke (cherry picked from commit 89b2356b8c2fd420b49bacaa865fb9bd24173ecc) --- include/kernel-6.6 | 4 ++-- ...dwc3-Set-DMA-and-coherent-masks-early.patch | 8 ++++---- ...chdog-mediatek-mt7988-add-wdt-support.patch | 18 +++++++++--------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/kernel-6.6 b/include/kernel-6.6 index c2805b4540bce0..6cee9d1e8cb034 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .68 -LINUX_KERNEL_HASH-6.6.68 = 283ff410e3f352ceed161ae30c0020301326059db03e86efcb384d46ac5840e2 +LINUX_VERSION-6.6 = .69 +LINUX_KERNEL_HASH-6.6.69 = 9c6305567b75d99514cde6eb9de39973f3d5c857a75bd9dcdfca57041f8d4f34 diff --git a/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch b/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch index fe77f212117713..551bfccc7508e1 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch @@ -68,7 +68,7 @@ Signed-off-by: Jonathan Bell select SOC_BRCMSTB if ARCH_BRCMSTB --- a/drivers/phy/broadcom/phy-brcm-usb-init-synopsys.c +++ b/drivers/phy/broadcom/phy-brcm-usb-init-synopsys.c -@@ -335,6 +335,36 @@ static void usb_init_common_7216(struct +@@ -341,6 +341,36 @@ static void usb_init_common_7216(struct usb_init_common(params); } @@ -105,7 +105,7 @@ Signed-off-by: Jonathan Bell static void usb_init_xhci(struct brcm_usb_init_params *params) { pr_debug("%s\n", __func__); -@@ -380,6 +410,18 @@ static void usb_uninit_common_7211b0(str +@@ -386,6 +416,18 @@ static void usb_uninit_common_7211b0(str } @@ -124,7 +124,7 @@ Signed-off-by: Jonathan Bell static void usb_uninit_xhci(struct brcm_usb_init_params *params) { -@@ -434,6 +476,16 @@ static const struct brcm_usb_init_ops bc +@@ -440,6 +482,16 @@ static const struct brcm_usb_init_ops bc .set_dual_select = usb_set_dual_select, }; @@ -141,7 +141,7 @@ Signed-off-by: Jonathan Bell void brcm_usb_dvr_init_7216(struct brcm_usb_init_params *params) { -@@ -451,3 +503,10 @@ void brcm_usb_dvr_init_7211b0(struct brc +@@ -457,3 +509,10 @@ void brcm_usb_dvr_init_7211b0(struct brc params->family_name = "7211"; params->ops = &bcm7211b0_ops; } diff --git a/target/linux/mediatek/patches-6.6/251-v6.8-watchdog-mediatek-mt7988-add-wdt-support.patch b/target/linux/mediatek/patches-6.6/251-v6.8-watchdog-mediatek-mt7988-add-wdt-support.patch index c399b768b00392..984034125ca471 100644 --- a/target/linux/mediatek/patches-6.6/251-v6.8-watchdog-mediatek-mt7988-add-wdt-support.patch +++ b/target/linux/mediatek/patches-6.6/251-v6.8-watchdog-mediatek-mt7988-add-wdt-support.patch @@ -18,7 +18,7 @@ Signed-off-by: Wim Van Sebroeck --- a/drivers/watchdog/mtk_wdt.c +++ b/drivers/watchdog/mtk_wdt.c -@@ -58,9 +58,13 @@ +@@ -59,9 +59,13 @@ #define WDT_SWSYSRST 0x18U #define WDT_SWSYS_RST_KEY 0x88000000 @@ -32,7 +32,7 @@ Signed-off-by: Wim Van Sebroeck static bool nowayout = WATCHDOG_NOWAYOUT; static unsigned int timeout; -@@ -71,10 +75,12 @@ struct mtk_wdt_dev { +@@ -72,10 +76,12 @@ struct mtk_wdt_dev { struct reset_controller_dev rcdev; bool disable_wdt_extrst; bool reset_by_toprgu; @@ -45,7 +45,7 @@ Signed-off-by: Wim Van Sebroeck }; static const struct mtk_wdt_data mt2712_data = { -@@ -89,6 +95,11 @@ static const struct mtk_wdt_data mt7986_ +@@ -94,6 +100,11 @@ static const struct mtk_wdt_data mt7986_ .toprgu_sw_rst_num = MT7986_TOPRGU_SW_RST_NUM, }; @@ -57,7 +57,7 @@ Signed-off-by: Wim Van Sebroeck static const struct mtk_wdt_data mt8183_data = { .toprgu_sw_rst_num = MT8183_TOPRGU_SW_RST_NUM, }; -@@ -109,6 +120,28 @@ static const struct mtk_wdt_data mt8195_ +@@ -114,6 +125,28 @@ static const struct mtk_wdt_data mt8195_ .toprgu_sw_rst_num = MT8195_TOPRGU_SW_RST_NUM, }; @@ -86,7 +86,7 @@ Signed-off-by: Wim Van Sebroeck static int toprgu_reset_update(struct reset_controller_dev *rcdev, unsigned long id, bool assert) { -@@ -119,6 +152,9 @@ static int toprgu_reset_update(struct re +@@ -124,6 +157,9 @@ static int toprgu_reset_update(struct re spin_lock_irqsave(&data->lock, flags); @@ -96,7 +96,7 @@ Signed-off-by: Wim Van Sebroeck tmp = readl(data->wdt_base + WDT_SWSYSRST); if (assert) tmp |= BIT(id); -@@ -127,6 +163,9 @@ static int toprgu_reset_update(struct re +@@ -132,6 +168,9 @@ static int toprgu_reset_update(struct re tmp |= WDT_SWSYS_RST_KEY; writel(tmp, data->wdt_base + WDT_SWSYSRST); @@ -106,7 +106,7 @@ Signed-off-by: Wim Van Sebroeck spin_unlock_irqrestore(&data->lock, flags); return 0; -@@ -412,6 +451,8 @@ static int mtk_wdt_probe(struct platform +@@ -417,6 +456,8 @@ static int mtk_wdt_probe(struct platform wdt_data->toprgu_sw_rst_num); if (err) return err; @@ -115,8 +115,8 @@ Signed-off-by: Wim Van Sebroeck } mtk_wdt->disable_wdt_extrst = -@@ -450,6 +491,7 @@ static const struct of_device_id mtk_wdt - { .compatible = "mediatek,mt6589-wdt" }, +@@ -456,6 +497,7 @@ static const struct of_device_id mtk_wdt + { .compatible = "mediatek,mt6735-wdt", .data = &mt6735_data }, { .compatible = "mediatek,mt6795-wdt", .data = &mt6795_data }, { .compatible = "mediatek,mt7986-wdt", .data = &mt7986_data }, + { .compatible = "mediatek,mt7988-wdt", .data = &mt7988_data }, From 14722242af819cdb168968c00dd6fda4303b0b3e Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Fri, 3 Jan 2025 20:37:41 +0800 Subject: [PATCH 286/877] rockchip: fix phy reset on rk356x The commit 7160820d742a ("phy: rockchip: naneng-combphy: fix phy reset") was backported to kernel 6.6 branch by upstream, however the correspond dtsi fixes was not, resulting the following error: ``` [ 0.225521] rockchip-naneng-combphy fe830000.phy: error -ENOENT: failed to get phy reset [ 0.227467] rockchip-naneng-combphy fe840000.phy: error -ENOENT: failed to get phy reset ``` So backport the dtsi fixes here manually. Fixes: 89b2356b8c2f ("kernel: bump 6.6 to 6.6.69") Signed-off-by: Tianling Shen Link: https://github.com/openwrt/openwrt/pull/17468 Signed-off-by: Robert Marko (cherry picked from commit 8a477bafb4637e3499f69f569133039ce060559e) --- ...dd-reset-names-for-combphy-on-rk3568.patch | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 target/linux/rockchip/patches-6.6/016-v6.13-arm64-dts-rockchip-add-reset-names-for-combphy-on-rk3568.patch diff --git a/target/linux/rockchip/patches-6.6/016-v6.13-arm64-dts-rockchip-add-reset-names-for-combphy-on-rk3568.patch b/target/linux/rockchip/patches-6.6/016-v6.13-arm64-dts-rockchip-add-reset-names-for-combphy-on-rk3568.patch new file mode 100644 index 00000000000000..7a8f86a46fdd82 --- /dev/null +++ b/target/linux/rockchip/patches-6.6/016-v6.13-arm64-dts-rockchip-add-reset-names-for-combphy-on-rk3568.patch @@ -0,0 +1,44 @@ +From 8b9c12757f919157752646faf3821abf2b7d2a64 Mon Sep 17 00:00:00 2001 +From: Chukun Pan +Date: Fri, 22 Nov 2024 15:30:05 +0800 +Subject: [PATCH] arm64: dts: rockchip: add reset-names for combphy on rk3568 + +The reset-names of combphy are missing, add it. + +Signed-off-by: Chukun Pan +Fixes: fd3ac6e80497 ("dt-bindings: phy: rockchip: rk3588 has two reset lines") +Link: https://lore.kernel.org/r/20241122073006.99309-1-amadeus@jmu.edu.cn +Signed-off-by: Heiko Stuebner +--- + arch/arm64/boot/dts/rockchip/rk3568.dtsi | 1 + + arch/arm64/boot/dts/rockchip/rk356x-base.dtsi | 2 ++ + 2 files changed, 3 insertions(+) + +--- a/arch/arm64/boot/dts/rockchip/rk3568.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3568.dtsi +@@ -223,6 +223,7 @@ + assigned-clocks = <&pmucru CLK_PCIEPHY0_REF>; + assigned-clock-rates = <100000000>; + resets = <&cru SRST_PIPEPHY0>; ++ reset-names = "phy"; + rockchip,pipe-grf = <&pipegrf>; + rockchip,pipe-phy-grf = <&pipe_phy_grf0>; + #phy-cells = <1>; +--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi +@@ -1747,6 +1747,7 @@ + assigned-clocks = <&pmucru CLK_PCIEPHY1_REF>; + assigned-clock-rates = <100000000>; + resets = <&cru SRST_PIPEPHY1>; ++ reset-names = "phy"; + rockchip,pipe-grf = <&pipegrf>; + rockchip,pipe-phy-grf = <&pipe_phy_grf1>; + #phy-cells = <1>; +@@ -1763,6 +1764,7 @@ + assigned-clocks = <&pmucru CLK_PCIEPHY2_REF>; + assigned-clock-rates = <100000000>; + resets = <&cru SRST_PIPEPHY2>; ++ reset-names = "phy"; + rockchip,pipe-grf = <&pipegrf>; + rockchip,pipe-phy-grf = <&pipe_phy_grf2>; + #phy-cells = <1>; From 43e1b47d70b4b7d43564b17f0e40346a2d26de30 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 22 Dec 2024 17:47:34 +0100 Subject: [PATCH 287/877] procd: update to Git HEAD (2024-12-22) 42d3937 jail/seccomp: add support for loongarch64 Link: https://github.com/openwrt/openwrt/pull/17335 Signed-off-by: Hauke Mehrtens (cherry picked from commit f69fc4c413357ab2e981f11eacd6101b6a59ab34) --- 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 7a2276a46d1967..65cc0ad9f65f74 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:=99139ce325d73f5b250d115703540acfac3bcdc8ee202f2d3aacf3083042bc70 -PKG_SOURCE_DATE:=2024-12-17 -PKG_SOURCE_VERSION:=fd01fb852302a2683d09ee1c2193d7c51e2b0ba8 +PKG_MIRROR_HASH:=41dbb5352eff931ecc78c4ce9a081645c26a7fb8dc57cdd6521a2f8d3a142567 +PKG_SOURCE_DATE:=2024-12-22 +PKG_SOURCE_VERSION:=42d3937654508b04da64969f9d764ac2ec411904 CMAKE_INSTALL:=1 PKG_LICENSE:=GPL-2.0 From 993ade9eb3cbc3e1a6aa2faa02220343a04eb725 Mon Sep 17 00:00:00 2001 From: Weijie Gao Date: Sun, 22 Dec 2024 18:32:54 +0800 Subject: [PATCH 288/877] config: enable SECCOMP support for loongarch64 Make USE_SECCOMP selectable for loongarch64 Signed-off-by: Weijie Gao Link: https://github.com/openwrt/openwrt/pull/17335 Signed-off-by: Hauke Mehrtens (cherry picked from commit b6b6148d7d19f7081551491192e161f46cb0bdb8) --- config/Config-build.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/Config-build.in b/config/Config-build.in index 08acae63d3b24e..a9e968f944e787 100644 --- a/config/Config-build.in +++ b/config/Config-build.in @@ -427,7 +427,7 @@ menu "Global build settings" bool "Enable SECCOMP" select KERNEL_SECCOMP select PACKAGE_procd-seccomp - depends on (aarch64 || arm || armeb || mips || mipsel || mips64 || mips64el || i386 || powerpc || x86_64) + depends on (aarch64 || arm || armeb || mips || mipsel || mips64 || mips64el || i386 || loongarch64 || powerpc || x86_64) depends on !TARGET_uml default y help From cf887640a39b7823fa3e047bf1d3b7b98abd1fef Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 22 Dec 2024 17:33:21 +0100 Subject: [PATCH 289/877] mbedtls: Deactivate ARIA block cipher by default The ARIA block cipher is pretty uncommon in TLS, deactivate it for now. This saves some space and reduces the possible variations and attack vectors of mbedtls. ARIA support was deactivated in OpenWrt 23.05 by default. Link: https://github.com/openwrt/openwrt/pull/17342 Signed-off-by: Hauke Mehrtens (cherry picked from commit 3c0ef48bc82cb11edd0b4fdbc4beaa3f95708967) --- package/libs/mbedtls/Config.in | 4 ++++ package/libs/mbedtls/Makefile | 1 + 2 files changed, 5 insertions(+) diff --git a/package/libs/mbedtls/Config.in b/package/libs/mbedtls/Config.in index 51f8bcbbdd36a0..0a760ed2cb80d6 100644 --- a/package/libs/mbedtls/Config.in +++ b/package/libs/mbedtls/Config.in @@ -8,6 +8,10 @@ config MBEDTLS_AES_C bool "MBEDTLS_AES_C" default y +config MBEDTLS_ARIA_C + bool "MBEDTLS_ARIA_C" + default n + config MBEDTLS_CAMELLIA_C bool "MBEDTLS_CAMELLIA_C" default n diff --git a/package/libs/mbedtls/Makefile b/package/libs/mbedtls/Makefile index 2efdf86cd207f9..f5bff13324884e 100644 --- a/package/libs/mbedtls/Makefile +++ b/package/libs/mbedtls/Makefile @@ -37,6 +37,7 @@ MBEDTLS_BUILD_OPTS_CURVES= \ MBEDTLS_BUILD_OPTS_CIPHERS= \ CONFIG_MBEDTLS_AES_C \ + CONFIG_MBEDTLS_ARIA_C \ CONFIG_MBEDTLS_CAMELLIA_C \ CONFIG_MBEDTLS_CCM_C \ CONFIG_MBEDTLS_CMAC_C \ From 111c62a06ab550c47b5d3fe759687ae4f7f1a580 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Sat, 4 Jan 2025 00:46:00 +0100 Subject: [PATCH 290/877] rockchip: refresh patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit 8a477bafb4637e3499f69f569133039ce060559e backported an upstream patch without refreshing the patches. Fixes: 8a477bafb463 ("rockchip: fix phy reset on rk356x") Signed-off-by: Álvaro Fernández Rojas Link: https://github.com/openwrt/openwrt/pull/17474 Signed-off-by: Robert Marko (cherry picked from commit 484f670ed3d41e44375bfa7f8892e660d3c8c26a) --- .../301-arm64-dts-rockchip-add-DT-entry-for-RNG-to-RK3568.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/rockchip/patches-6.6/301-arm64-dts-rockchip-add-DT-entry-for-RNG-to-RK3568.patch b/target/linux/rockchip/patches-6.6/301-arm64-dts-rockchip-add-DT-entry-for-RNG-to-RK3568.patch index 130bf6723cce9f..6ba8002c756f23 100644 --- a/target/linux/rockchip/patches-6.6/301-arm64-dts-rockchip-add-DT-entry-for-RNG-to-RK3568.patch +++ b/target/linux/rockchip/patches-6.6/301-arm64-dts-rockchip-add-DT-entry-for-RNG-to-RK3568.patch @@ -14,7 +14,7 @@ Signed-off-by: Daniel Golle --- a/arch/arm64/boot/dts/rockchip/rk3568.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3568.dtsi -@@ -257,6 +257,13 @@ +@@ -258,6 +258,13 @@ }; }; From 56b19f0d5095fd69739805620a3da64569620277 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Mon, 30 Dec 2024 01:01:33 +0100 Subject: [PATCH 291/877] generic: 6.6: backport upstream Realtek PHY patches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 8989bad54113 net: phy: realtek: add RTL8125D-internal PHY f87a17ed3b51 net: phy: realtek: merge the drivers for internal NBase-T PHY's Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit fedb1f86b50986a962c899d7406566d991e030ee) --- ...merge-the-drivers-for-internal-NBase.patch | 136 ++++++++++++++++++ ...hy-realtek-add-RTL8125D-internal-PHY.patch | 29 ++++ ...-use-genphy_soft_reset-for-2.5G-PHYs.patch | 18 +-- ...sable-SGMII-in-band-AN-for-2-5G-PHYs.patch | 4 +- ...make-sure-paged-read-is-protected-by.patch | 2 +- ...-phy-realtek-introduce-rtl822x_probe.patch | 14 +- ...tek-detect-early-version-of-RTL8221B.patch | 4 +- ...ealtek-support-interrupt-of-RTL8221B.patch | 10 +- 8 files changed, 191 insertions(+), 26 deletions(-) create mode 100644 target/linux/generic/backport-6.6/781-18-v6.13-net-phy-realtek-merge-the-drivers-for-internal-NBase.patch create mode 100644 target/linux/generic/backport-6.6/781-19-v6.13-net-phy-realtek-add-RTL8125D-internal-PHY.patch diff --git a/target/linux/generic/backport-6.6/781-18-v6.13-net-phy-realtek-merge-the-drivers-for-internal-NBase.patch b/target/linux/generic/backport-6.6/781-18-v6.13-net-phy-realtek-merge-the-drivers-for-internal-NBase.patch new file mode 100644 index 00000000000000..771f60df91c524 --- /dev/null +++ b/target/linux/generic/backport-6.6/781-18-v6.13-net-phy-realtek-merge-the-drivers-for-internal-NBase.patch @@ -0,0 +1,136 @@ +From f87a17ed3b51fba4dfdd8f8b643b5423a85fc551 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Tue, 15 Oct 2024 07:47:14 +0200 +Subject: [PATCH] net: phy: realtek: merge the drivers for internal NBase-T + PHY's + +The Realtek RTL8125/RTL8126 NBase-T MAC/PHY chips have internal PHY's +which are register-compatible, at least for the registers we use here. +So let's use just one PHY driver to support all of them. +These internal PHY's exist also as external C45 PHY's, but on the +internal PHY's no access to MMD registers is possible. This can be +used to differentiate between the internal and external version. + +As a side effect the drivers for two now external-only drivers don't +require read_mmd/write_mmd hooks any longer. + +Signed-off-by: Heiner Kallweit +Link: https://patch.msgid.link/c57081a6-811f-4571-ab35-34f4ca6de9af@gmail.com +Signed-off-by: Paolo Abeni +--- + drivers/net/phy/realtek.c | 53 +++++++++++++++++++++++++++++++-------- + 1 file changed, 43 insertions(+), 10 deletions(-) + +--- a/drivers/net/phy/realtek.c ++++ b/drivers/net/phy/realtek.c +@@ -95,6 +95,7 @@ + + #define RTL_GENERIC_PHYID 0x001cc800 + #define RTL_8211FVD_PHYID 0x001cc878 ++#define RTL_8221B 0x001cc840 + #define RTL_8221B_VB_CG 0x001cc849 + #define RTL_8221B_VN_CG 0x001cc84a + #define RTL_8251B 0x001cc862 +@@ -1077,6 +1078,23 @@ static bool rtlgen_supports_2_5gbps(stru + return val >= 0 && val & MDIO_PMA_SPEED_2_5G; + } + ++/* On internal PHY's MMD reads over C22 always return 0. ++ * Check a MMD register which is known to be non-zero. ++ */ ++static bool rtlgen_supports_mmd(struct phy_device *phydev) ++{ ++ int val; ++ ++ phy_lock_mdio_bus(phydev); ++ __phy_write(phydev, MII_MMD_CTRL, MDIO_MMD_PCS); ++ __phy_write(phydev, MII_MMD_DATA, MDIO_PCS_EEE_ABLE); ++ __phy_write(phydev, MII_MMD_CTRL, MDIO_MMD_PCS | MII_MMD_CTRL_NOINCR); ++ val = __phy_read(phydev, MII_MMD_DATA); ++ phy_unlock_mdio_bus(phydev); ++ ++ return val > 0; ++} ++ + static int rtlgen_match_phy_device(struct phy_device *phydev) + { + return phydev->phy_id == RTL_GENERIC_PHYID && +@@ -1086,7 +1104,8 @@ static int rtlgen_match_phy_device(struc + static int rtl8226_match_phy_device(struct phy_device *phydev) + { + return phydev->phy_id == RTL_GENERIC_PHYID && +- rtlgen_supports_2_5gbps(phydev); ++ rtlgen_supports_2_5gbps(phydev) && ++ rtlgen_supports_mmd(phydev); + } + + static int rtlgen_is_c45_match(struct phy_device *phydev, unsigned int id, +@@ -1098,6 +1117,11 @@ static int rtlgen_is_c45_match(struct ph + return !is_c45 && (id == phydev->phy_id); + } + ++static int rtl8221b_match_phy_device(struct phy_device *phydev) ++{ ++ return phydev->phy_id == RTL_8221B && rtlgen_supports_mmd(phydev); ++} ++ + static int rtl8221b_vb_cg_c22_match_phy_device(struct phy_device *phydev) + { + return rtlgen_is_c45_match(phydev, RTL_8221B_VB_CG, false); +@@ -1118,9 +1142,21 @@ static int rtl8221b_vn_cg_c45_match_phy_ + return rtlgen_is_c45_match(phydev, RTL_8221B_VN_CG, true); + } + +-static int rtl8251b_c22_match_phy_device(struct phy_device *phydev) ++static int rtl_internal_nbaset_match_phy_device(struct phy_device *phydev) + { +- return rtlgen_is_c45_match(phydev, RTL_8251B, false); ++ if (phydev->is_c45) ++ return false; ++ ++ switch (phydev->phy_id) { ++ case RTL_GENERIC_PHYID: ++ case RTL_8221B: ++ case RTL_8251B: ++ break; ++ default: ++ return false; ++ } ++ ++ return rtlgen_supports_2_5gbps(phydev) && !rtlgen_supports_mmd(phydev); + } + + static int rtl8251b_c45_match_phy_device(struct phy_device *phydev) +@@ -1382,10 +1418,8 @@ static struct phy_driver realtek_drvs[] + .resume = rtlgen_resume, + .read_page = rtl821x_read_page, + .write_page = rtl821x_write_page, +- .read_mmd = rtl822x_read_mmd, +- .write_mmd = rtl822x_write_mmd, + }, { +- PHY_ID_MATCH_EXACT(0x001cc840), ++ .match_phy_device = rtl8221b_match_phy_device, + .name = "RTL8226B_RTL8221B 2.5Gbps PHY", + .get_features = rtl822x_get_features, + .config_aneg = rtl822x_config_aneg, +@@ -1396,8 +1430,6 @@ static struct phy_driver realtek_drvs[] + .resume = rtlgen_resume, + .read_page = rtl821x_read_page, + .write_page = rtl821x_write_page, +- .read_mmd = rtl822x_read_mmd, +- .write_mmd = rtl822x_write_mmd, + }, { + PHY_ID_MATCH_EXACT(0x001cc838), + .name = "RTL8226-CG 2.5Gbps PHY", +@@ -1475,8 +1507,9 @@ static struct phy_driver realtek_drvs[] + .read_page = rtl821x_read_page, + .write_page = rtl821x_write_page, + }, { +- .match_phy_device = rtl8251b_c22_match_phy_device, +- .name = "RTL8126A-internal 5Gbps PHY", ++ .match_phy_device = rtl_internal_nbaset_match_phy_device, ++ .name = "Realtek Internal NBASE-T PHY", ++ .flags = PHY_IS_INTERNAL, + .get_features = rtl822x_get_features, + .config_aneg = rtl822x_config_aneg, + .read_status = rtl822x_read_status, diff --git a/target/linux/generic/backport-6.6/781-19-v6.13-net-phy-realtek-add-RTL8125D-internal-PHY.patch b/target/linux/generic/backport-6.6/781-19-v6.13-net-phy-realtek-add-RTL8125D-internal-PHY.patch new file mode 100644 index 00000000000000..4b9b9e8d48b3ff --- /dev/null +++ b/target/linux/generic/backport-6.6/781-19-v6.13-net-phy-realtek-add-RTL8125D-internal-PHY.patch @@ -0,0 +1,29 @@ +From 8989bad541133c43550bff2b80edbe37b8fb9659 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Thu, 17 Oct 2024 18:01:13 +0200 +Subject: [PATCH] net: phy: realtek: add RTL8125D-internal PHY + +The first boards show up with Realtek's RTL8125D. This MAC/PHY chip +comes with an integrated 2.5Gbps PHY with ID 0x001cc841. It's not +clear yet whether there's an external version of this PHY and how +Realtek calls it, therefore use the numeric id for now. + +Link: https://lore.kernel.org/netdev/2ada65e1-5dfa-456c-9334-2bc51272e9da@gmail.com/T/ +Signed-off-by: Heiner Kallweit +Message-ID: <7d2924de-053b-44d2-a479-870dc3878170@gmail.com> +Reviewed-by: Andrew Lunn +Signed-off-by: Andrew Lunn +--- + drivers/net/phy/realtek.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/phy/realtek.c ++++ b/drivers/net/phy/realtek.c +@@ -1151,6 +1151,7 @@ static int rtl_internal_nbaset_match_phy + case RTL_GENERIC_PHYID: + case RTL_8221B: + case RTL_8251B: ++ case 0x001cc841: + break; + default: + return false; diff --git a/target/linux/generic/pending-6.6/720-01-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch b/target/linux/generic/pending-6.6/720-01-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch index 2b77b6e02f9881..8de57707a267c4 100644 --- a/target/linux/generic/pending-6.6/720-01-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch +++ b/target/linux/generic/pending-6.6/720-01-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch @@ -15,7 +15,7 @@ Signed-off-by: Daniel Golle --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c -@@ -1375,6 +1375,7 @@ static struct phy_driver realtek_drvs[] +@@ -1412,6 +1412,7 @@ static struct phy_driver realtek_drvs[] }, { .name = "RTL8226 2.5Gbps PHY", .match_phy_device = rtl8226_match_phy_device, @@ -23,15 +23,15 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, -@@ -1387,6 +1388,7 @@ static struct phy_driver realtek_drvs[] +@@ -1422,6 +1423,7 @@ static struct phy_driver realtek_drvs[] }, { - PHY_ID_MATCH_EXACT(0x001cc840), + .match_phy_device = rtl8221b_match_phy_device, .name = "RTL8226B_RTL8221B 2.5Gbps PHY", + .soft_reset = genphy_soft_reset, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .config_init = rtl822xb_config_init, -@@ -1401,6 +1403,7 @@ static struct phy_driver realtek_drvs[] +@@ -1434,6 +1436,7 @@ static struct phy_driver realtek_drvs[] }, { PHY_ID_MATCH_EXACT(0x001cc838), .name = "RTL8226-CG 2.5Gbps PHY", @@ -39,7 +39,7 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, -@@ -1411,6 +1414,7 @@ static struct phy_driver realtek_drvs[] +@@ -1444,6 +1447,7 @@ static struct phy_driver realtek_drvs[] }, { PHY_ID_MATCH_EXACT(0x001cc848), .name = "RTL8226B-CG_RTL8221B-CG 2.5Gbps PHY", @@ -47,7 +47,7 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .config_init = rtl822xb_config_init, -@@ -1423,6 +1427,7 @@ static struct phy_driver realtek_drvs[] +@@ -1456,6 +1460,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c22_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C22)", @@ -55,7 +55,7 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .config_init = rtl822xb_config_init, -@@ -1435,6 +1440,7 @@ static struct phy_driver realtek_drvs[] +@@ -1468,6 +1473,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c45_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C45)", @@ -63,7 +63,7 @@ Signed-off-by: Daniel Golle .config_init = rtl822xb_config_init, .get_rate_matching = rtl822xb_get_rate_matching, .get_features = rtl822x_c45_get_features, -@@ -1445,6 +1451,7 @@ static struct phy_driver realtek_drvs[] +@@ -1478,6 +1484,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c22_match_phy_device, .name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)", @@ -71,7 +71,7 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .config_init = rtl822xb_config_init, -@@ -1457,6 +1464,7 @@ static struct phy_driver realtek_drvs[] +@@ -1490,6 +1497,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c45_match_phy_device, .name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)", diff --git a/target/linux/generic/pending-6.6/720-02-net-phy-realtek-disable-SGMII-in-band-AN-for-2-5G-PHYs.patch b/target/linux/generic/pending-6.6/720-02-net-phy-realtek-disable-SGMII-in-band-AN-for-2-5G-PHYs.patch index cbef74d317b0e5..7e48c16515db8e 100644 --- a/target/linux/generic/pending-6.6/720-02-net-phy-realtek-disable-SGMII-in-band-AN-for-2-5G-PHYs.patch +++ b/target/linux/generic/pending-6.6/720-02-net-phy-realtek-disable-SGMII-in-band-AN-for-2-5G-PHYs.patch @@ -20,7 +20,7 @@ Signed-off-by: Daniel Golle --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c -@@ -814,8 +814,8 @@ static int rtl822x_write_mmd(struct phy_ +@@ -815,8 +815,8 @@ static int rtl822x_write_mmd(struct phy_ static int rtl822xb_config_init(struct phy_device *phydev) { bool has_2500, has_sgmii; @@ -30,7 +30,7 @@ Signed-off-by: Daniel Golle has_2500 = test_bit(PHY_INTERFACE_MODE_2500BASEX, phydev->host_interfaces) || -@@ -865,7 +865,29 @@ static int rtl822xb_config_init(struct p +@@ -866,7 +866,29 @@ static int rtl822xb_config_init(struct p if (ret < 0) return ret; diff --git a/target/linux/generic/pending-6.6/720-03-net-phy-realtek-make-sure-paged-read-is-protected-by.patch b/target/linux/generic/pending-6.6/720-03-net-phy-realtek-make-sure-paged-read-is-protected-by.patch index 216fa918e1f670..722ec02cdceff0 100644 --- a/target/linux/generic/pending-6.6/720-03-net-phy-realtek-make-sure-paged-read-is-protected-by.patch +++ b/target/linux/generic/pending-6.6/720-03-net-phy-realtek-make-sure-paged-read-is-protected-by.patch @@ -18,7 +18,7 @@ Signed-off-by: Daniel Golle --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c -@@ -1092,9 +1092,11 @@ static bool rtlgen_supports_2_5gbps(stru +@@ -1093,9 +1093,11 @@ static bool rtlgen_supports_2_5gbps(stru { int val; diff --git a/target/linux/generic/pending-6.6/720-04-net-phy-realtek-introduce-rtl822x_probe.patch b/target/linux/generic/pending-6.6/720-04-net-phy-realtek-introduce-rtl822x_probe.patch index 08c13f34e44097..1b9cdada6dbe3b 100644 --- a/target/linux/generic/pending-6.6/720-04-net-phy-realtek-introduce-rtl822x_probe.patch +++ b/target/linux/generic/pending-6.6/720-04-net-phy-realtek-introduce-rtl822x_probe.patch @@ -24,7 +24,7 @@ Signed-off-by: Daniel Golle #define RTL8366RB_POWER_SAVE 0x15 #define RTL8366RB_POWER_SAVE_ON BIT(12) -@@ -1152,6 +1156,25 @@ static int rtl8251b_c45_match_phy_device +@@ -1189,6 +1193,25 @@ static int rtl8251b_c45_match_phy_device return rtlgen_is_c45_match(phydev, RTL_8251B, true); } @@ -50,7 +50,7 @@ Signed-off-by: Daniel Golle static int rtlgen_resume(struct phy_device *phydev) { int ret = genphy_resume(phydev); -@@ -1427,6 +1450,7 @@ static struct phy_driver realtek_drvs[] +@@ -1460,6 +1483,7 @@ static struct phy_driver realtek_drvs[] }, { PHY_ID_MATCH_EXACT(0x001cc838), .name = "RTL8226-CG 2.5Gbps PHY", @@ -58,7 +58,7 @@ Signed-off-by: Daniel Golle .soft_reset = genphy_soft_reset, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, -@@ -1438,6 +1462,7 @@ static struct phy_driver realtek_drvs[] +@@ -1471,6 +1495,7 @@ static struct phy_driver realtek_drvs[] }, { PHY_ID_MATCH_EXACT(0x001cc848), .name = "RTL8226B-CG_RTL8221B-CG 2.5Gbps PHY", @@ -66,7 +66,7 @@ Signed-off-by: Daniel Golle .soft_reset = genphy_soft_reset, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, -@@ -1451,6 +1476,7 @@ static struct phy_driver realtek_drvs[] +@@ -1484,6 +1509,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c22_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C22)", @@ -74,7 +74,7 @@ Signed-off-by: Daniel Golle .soft_reset = genphy_soft_reset, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, -@@ -1464,6 +1490,7 @@ static struct phy_driver realtek_drvs[] +@@ -1497,6 +1523,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c45_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C45)", @@ -82,7 +82,7 @@ Signed-off-by: Daniel Golle .soft_reset = genphy_soft_reset, .config_init = rtl822xb_config_init, .get_rate_matching = rtl822xb_get_rate_matching, -@@ -1475,6 +1502,7 @@ static struct phy_driver realtek_drvs[] +@@ -1508,6 +1535,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c22_match_phy_device, .name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)", @@ -90,7 +90,7 @@ Signed-off-by: Daniel Golle .soft_reset = genphy_soft_reset, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, -@@ -1488,6 +1516,7 @@ static struct phy_driver realtek_drvs[] +@@ -1521,6 +1549,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c45_match_phy_device, .name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)", diff --git a/target/linux/generic/pending-6.6/720-05-net-phy-realtek-detect-early-version-of-RTL8221B.patch b/target/linux/generic/pending-6.6/720-05-net-phy-realtek-detect-early-version-of-RTL8221B.patch index 6938552d14df12..63ffd0a0c9303e 100644 --- a/target/linux/generic/pending-6.6/720-05-net-phy-realtek-detect-early-version-of-RTL8221B.patch +++ b/target/linux/generic/pending-6.6/720-05-net-phy-realtek-detect-early-version-of-RTL8221B.patch @@ -14,7 +14,7 @@ Signed-off-by: Daniel Golle Signed-off-by: Mieczyslaw Nalewaj --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c -@@ -1120,10 +1120,32 @@ static int rtl8226_match_phy_device(stru +@@ -1139,10 +1139,32 @@ static int rtl8226_match_phy_device(stru static int rtlgen_is_c45_match(struct phy_device *phydev, unsigned int id, bool is_c45) { @@ -49,4 +49,4 @@ Signed-off-by: Mieczyslaw Nalewaj + } } - static int rtl8221b_vb_cg_c22_match_phy_device(struct phy_device *phydev) + static int rtl8221b_match_phy_device(struct phy_device *phydev) diff --git a/target/linux/generic/pending-6.6/720-06-net-phy-realtek-support-interrupt-of-RTL8221B.patch b/target/linux/generic/pending-6.6/720-06-net-phy-realtek-support-interrupt-of-RTL8221B.patch index a796b8f011d5fb..c9e15fb4630945 100644 --- a/target/linux/generic/pending-6.6/720-06-net-phy-realtek-support-interrupt-of-RTL8221B.patch +++ b/target/linux/generic/pending-6.6/720-06-net-phy-realtek-support-interrupt-of-RTL8221B.patch @@ -12,7 +12,7 @@ Signed-off-by: Jianhui Zhao --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c -@@ -1332,6 +1332,51 @@ static irqreturn_t rtl9000a_handle_inter +@@ -1369,6 +1369,51 @@ static irqreturn_t rtl9000a_handle_inter return IRQ_HANDLED; } @@ -64,7 +64,7 @@ Signed-off-by: Jianhui Zhao static struct phy_driver realtek_drvs[] = { { PHY_ID_MATCH_EXACT(0x00008201), -@@ -1498,6 +1543,8 @@ static struct phy_driver realtek_drvs[] +@@ -1531,6 +1576,8 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c22_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C22)", @@ -73,7 +73,7 @@ Signed-off-by: Jianhui Zhao .probe = rtl822x_probe, .soft_reset = genphy_soft_reset, .get_features = rtl822x_get_features, -@@ -1512,6 +1559,8 @@ static struct phy_driver realtek_drvs[] +@@ -1545,6 +1592,8 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c45_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C45)", @@ -82,7 +82,7 @@ Signed-off-by: Jianhui Zhao .probe = rtl822x_probe, .soft_reset = genphy_soft_reset, .config_init = rtl822xb_config_init, -@@ -1524,6 +1573,8 @@ static struct phy_driver realtek_drvs[] +@@ -1557,6 +1606,8 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c22_match_phy_device, .name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)", @@ -91,7 +91,7 @@ Signed-off-by: Jianhui Zhao .probe = rtl822x_probe, .soft_reset = genphy_soft_reset, .get_features = rtl822x_get_features, -@@ -1538,6 +1589,8 @@ static struct phy_driver realtek_drvs[] +@@ -1571,6 +1622,8 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c45_match_phy_device, .name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)", From 56b2d856a245fbfc64496c50cc66c0205888ea5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Mon, 30 Dec 2024 01:01:33 +0100 Subject: [PATCH 292/877] generic: 6.6: backport upstream r8169 patches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 7a3bcd39ae1f r8169: use helper r8169_mod_reg8_cond to simplify rtl_jumbo_config e3e9e9039fa6 r8169: align WAKE_PHY handling with r8125/r8126 vendor drivers 330dc2297c82 r8169: improve rtl_set_d3_pll_down c507e96b5763 r8169: improve __rtl8169_set_wol 83cb4b470c66 r8169: remove leftover locks after reverted change 2cd02f2fdd8a r8169: improve initialization of RSS registers on RTL8125/RTL8126 a3d8520e6a19 r8169: align RTL8126 EEE config with vendor driver 4af2f60bf737 r8169: align RTL8125/RTL8126 PHY config with vendor driver eb90f876b796 r8169: align RTL8125 EEE config with vendor driver b8bd8c44a266 r8169: fix inconsistent indenting in rtl8169_get_eth_mac_stats f75d1fbe7809 r8169: add support for RTL8125D c4e64095c00c r8169: enable EEE at 2.5G per default on RTL8125B d64113c6bb5e r8169: remove rtl_dash_loop_wait_high/low 1c105bacb160 r8169: avoid duplicated messages if loading firmware fails and switch to warn level ac48430368c1 r8169: don't take RTNL lock in rtl_task() e3fc5139bd8f r8169: implement additional ethtool stats ops b8bf38440ba9 r8169: enable SG/TSO on selected chip versions per default 854d71c555df r8169: remove original workaround for RTL8125 broken rx issue 1ffcc8d41306 r8169: add support for the temperature sensor being available from RTL8125B The following patches require backporting additional linux patches: e2015942e90a r8169: replace custom flag with disable_work() et al e340bff27e63 r8169: copy vendor driver 2.5G/5G EEE advertisement constraints Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 0eeba04a16fb72b13d90973ef8ba95f0549f973e) --- package/kernel/linux/modules/netdevices.mk | 2 +- ...t-for-the-temperature-sensor-being-a.patch | 83 ++++++++++ ...ginal-workaround-for-RTL8125-broken-.patch | 33 ++++ ...TSO-on-selected-chip-versions-per-de.patch | 52 +++++++ ...plement-additional-ethtool-stats-ops.patch | 130 ++++++++++++++++ ...169-don-t-take-RTNL-lock-in-rtl_task.patch | 50 ++++++ ...icated-messages-if-loading-firmware-.patch | 41 +++++ ...9-remove-rtl_dash_loop_wait_high-low.patch | 82 ++++++++++ ...-EEE-at-2.5G-per-default-on-RTL8125B.patch | 28 ++++ ...v6.13-r8169-add-support-for-RTL8125D.patch | 143 ++++++++++++++++++ ...istent-indenting-in-rtl8169_get_eth_.patch | 30 ++++ ...TL8125-EEE-config-with-vendor-driver.patch | 49 ++++++ ...125-RTL8126-PHY-config-with-vendor-d.patch | 46 ++++++ ...TL8126-EEE-config-with-vendor-driver.patch | 25 +++ ...itialization-of-RSS-registers-on-RTL.patch | 38 +++++ ...leftover-locks-after-reverted-change.patch | 113 ++++++++++++++ ...6.13-r8169-improve-__rtl8169_set_wol.patch | 108 +++++++++++++ ...13-r8169-improve-rtl_set_d3_pll_down.patch | 44 ++++++ ..._PHY-handling-with-r8125-r8126-vendo.patch | 29 ++++ ...-r8169_mod_reg8_cond-to-simplify-rtl.patch | 117 ++++++++++++++ 20 files changed, 1242 insertions(+), 1 deletion(-) create mode 100644 target/linux/generic/backport-6.6/780-24-v6.13-r8169-add-support-for-the-temperature-sensor-being-a.patch create mode 100644 target/linux/generic/backport-6.6/780-25-v6.13-r8169-remove-original-workaround-for-RTL8125-broken-.patch create mode 100644 target/linux/generic/backport-6.6/780-26-v6.13-r8169-enable-SG-TSO-on-selected-chip-versions-per-de.patch create mode 100644 target/linux/generic/backport-6.6/780-27-v6.13-r8169-implement-additional-ethtool-stats-ops.patch create mode 100644 target/linux/generic/backport-6.6/780-28-v6.13-r8169-don-t-take-RTNL-lock-in-rtl_task.patch create mode 100644 target/linux/generic/backport-6.6/780-30-v6.13-r8169-avoid-duplicated-messages-if-loading-firmware-.patch create mode 100644 target/linux/generic/backport-6.6/780-31-v6.13-r8169-remove-rtl_dash_loop_wait_high-low.patch create mode 100644 target/linux/generic/backport-6.6/780-32-v6.13-r8169-enable-EEE-at-2.5G-per-default-on-RTL8125B.patch create mode 100644 target/linux/generic/backport-6.6/780-33-v6.13-r8169-add-support-for-RTL8125D.patch create mode 100644 target/linux/generic/backport-6.6/780-34-v6.13-r8169-fix-inconsistent-indenting-in-rtl8169_get_eth_.patch create mode 100644 target/linux/generic/backport-6.6/780-35-v6.13-r8169-align-RTL8125-EEE-config-with-vendor-driver.patch create mode 100644 target/linux/generic/backport-6.6/780-36-v6.13-r8169-align-RTL8125-RTL8126-PHY-config-with-vendor-d.patch create mode 100644 target/linux/generic/backport-6.6/780-37-v6.13-r8169-align-RTL8126-EEE-config-with-vendor-driver.patch create mode 100644 target/linux/generic/backport-6.6/780-38-v6.13-r8169-improve-initialization-of-RSS-registers-on-RTL.patch create mode 100644 target/linux/generic/backport-6.6/780-39-v6.13-r8169-remove-leftover-locks-after-reverted-change.patch create mode 100644 target/linux/generic/backport-6.6/780-40-v6.13-r8169-improve-__rtl8169_set_wol.patch create mode 100644 target/linux/generic/backport-6.6/780-41-v6.13-r8169-improve-rtl_set_d3_pll_down.patch create mode 100644 target/linux/generic/backport-6.6/780-42-v6.13-r8169-align-WAKE_PHY-handling-with-r8125-r8126-vendo.patch create mode 100644 target/linux/generic/backport-6.6/780-43-v6.13-r8169-use-helper-r8169_mod_reg8_cond-to-simplify-rtl.patch diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk index cd24fb3ecbc996..ee9654761bbc5a 100644 --- a/package/kernel/linux/modules/netdevices.mk +++ b/package/kernel/linux/modules/netdevices.mk @@ -953,7 +953,7 @@ $(eval $(call KernelPackage,8139cp)) define KernelPackage/r8169 SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=RealTek RTL-8169 PCI Gigabit Ethernet Adapter kernel support - DEPENDS:=@PCI_SUPPORT +kmod-mii +r8169-firmware +kmod-phy-realtek +kmod-mdio-devres + DEPENDS:=@PCI_SUPPORT +kmod-mii +r8169-firmware +kmod-phy-realtek +kmod-mdio-devres +kmod-hwmon-core KCONFIG:= \ CONFIG_R8169 \ CONFIG_R8169_LEDS=y diff --git a/target/linux/generic/backport-6.6/780-24-v6.13-r8169-add-support-for-the-temperature-sensor-being-a.patch b/target/linux/generic/backport-6.6/780-24-v6.13-r8169-add-support-for-the-temperature-sensor-being-a.patch new file mode 100644 index 00000000000000..2403da5d55519f --- /dev/null +++ b/target/linux/generic/backport-6.6/780-24-v6.13-r8169-add-support-for-the-temperature-sensor-being-a.patch @@ -0,0 +1,83 @@ +From 1ffcc8d41306fd2e5f140b276820714a26a11cc4 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Mon, 7 Oct 2024 20:34:12 +0200 +Subject: [PATCH] r8169: add support for the temperature sensor being available + from RTL8125B + +This adds support for the temperature sensor being available from +RTL8125B. Register information was taken from r8125 vendor driver. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/realtek/r8169_main.c | 44 +++++++++++++++++++++++ + 1 file changed, 44 insertions(+) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -16,6 +16,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -5373,6 +5374,43 @@ static bool rtl_aspm_is_safe(struct rtl8 + return false; + } + ++static umode_t r8169_hwmon_is_visible(const void *drvdata, ++ enum hwmon_sensor_types type, ++ u32 attr, int channel) ++{ ++ return 0444; ++} ++ ++static int r8169_hwmon_read(struct device *dev, enum hwmon_sensor_types type, ++ u32 attr, int channel, long *val) ++{ ++ struct rtl8169_private *tp = dev_get_drvdata(dev); ++ int val_raw; ++ ++ val_raw = phy_read_paged(tp->phydev, 0xbd8, 0x12) & 0x3ff; ++ if (val_raw >= 512) ++ val_raw -= 1024; ++ ++ *val = 1000 * val_raw / 2; ++ ++ return 0; ++} ++ ++static const struct hwmon_ops r8169_hwmon_ops = { ++ .is_visible = r8169_hwmon_is_visible, ++ .read = r8169_hwmon_read, ++}; ++ ++static const struct hwmon_channel_info * const r8169_hwmon_info[] = { ++ HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT), ++ NULL ++}; ++ ++static const struct hwmon_chip_info r8169_hwmon_chip_info = { ++ .ops = &r8169_hwmon_ops, ++ .info = r8169_hwmon_info, ++}; ++ + static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) + { + struct rtl8169_private *tp; +@@ -5547,6 +5585,12 @@ static int rtl_init_one(struct pci_dev * + if (rc) + return rc; + ++ /* The temperature sensor is available from RTl8125B */ ++ if (IS_REACHABLE(CONFIG_HWMON) && tp->mac_version >= RTL_GIGA_MAC_VER_63) ++ /* ignore errors */ ++ devm_hwmon_device_register_with_info(&pdev->dev, "nic_temp", tp, ++ &r8169_hwmon_chip_info, ++ NULL); + rc = register_netdev(dev); + if (rc) + return rc; diff --git a/target/linux/generic/backport-6.6/780-25-v6.13-r8169-remove-original-workaround-for-RTL8125-broken-.patch b/target/linux/generic/backport-6.6/780-25-v6.13-r8169-remove-original-workaround-for-RTL8125-broken-.patch new file mode 100644 index 00000000000000..8c6e6d8dc41bb8 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-25-v6.13-r8169-remove-original-workaround-for-RTL8125-broken-.patch @@ -0,0 +1,33 @@ +From 854d71c555dfc3383c1fde7d9989b6046e21093d Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Wed, 9 Oct 2024 07:48:05 +0200 +Subject: [PATCH] r8169: remove original workaround for RTL8125 broken rx issue + +Now that we have b9c7ac4fe22c ("r8169: disable ALDPS per default for +RTL8125"), the first attempt to fix the issue shouldn't be needed +any longer. So let's effectively revert 621735f59064 ("r8169: fix +rare issue with broken rx after link-down on RTL8125") and see +whether anybody complains. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Link: https://patch.msgid.link/382d8c88-cbce-400f-ad62-fda0181c7e38@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169_main.c | 4 ---- + 1 file changed, 4 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -4779,11 +4779,7 @@ static void r8169_phylink_handler(struct + if (netif_carrier_ok(ndev)) { + rtl_link_chg_patch(tp); + pm_request_resume(d); +- netif_wake_queue(tp->dev); + } else { +- /* In few cases rx is broken after link-down otherwise */ +- if (rtl_is_8125(tp)) +- rtl_schedule_task(tp, RTL_FLAG_TASK_RESET_NO_QUEUE_WAKE); + pm_runtime_idle(d); + } + diff --git a/target/linux/generic/backport-6.6/780-26-v6.13-r8169-enable-SG-TSO-on-selected-chip-versions-per-de.patch b/target/linux/generic/backport-6.6/780-26-v6.13-r8169-enable-SG-TSO-on-selected-chip-versions-per-de.patch new file mode 100644 index 00000000000000..dc05299628eda5 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-26-v6.13-r8169-enable-SG-TSO-on-selected-chip-versions-per-de.patch @@ -0,0 +1,52 @@ +From b8bf38440ba94e8ed8e2ae55c5dfb0276d30e843 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Thu, 10 Oct 2024 12:58:02 +0200 +Subject: [PATCH] r8169: enable SG/TSO on selected chip versions per default + +Due to problem reports in the past SG and TSO/TSO6 are disabled per +default. It's not fully clear which chip versions are affected, so we +may impact also users of unaffected chip versions, unless they know +how to use ethtool for enabling SG/TSO/TSO6. +Vendor drivers r8168/r8125 enable SG/TSO/TSO6 for selected chip +versions per default, I'd interpret this as confirmation that these +chip versions are unaffected. So let's do the same here. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/realtek/r8169_main.c | 16 +++++++++++----- + 1 file changed, 11 insertions(+), 5 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -5529,11 +5529,6 @@ static int rtl_init_one(struct pci_dev * + + dev->features |= dev->hw_features; + +- /* There has been a number of reports that using SG/TSO results in +- * tx timeouts. However for a lot of people SG/TSO works fine. +- * Therefore disable both features by default, but allow users to +- * enable them. Use at own risk! +- */ + if (rtl_chip_supports_csum_v2(tp)) { + dev->hw_features |= NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6; + netif_set_tso_max_size(dev, RTL_GSO_MAX_SIZE_V2); +@@ -5544,6 +5539,17 @@ static int rtl_init_one(struct pci_dev * + netif_set_tso_max_segs(dev, RTL_GSO_MAX_SEGS_V1); + } + ++ /* There has been a number of reports that using SG/TSO results in ++ * tx timeouts. However for a lot of people SG/TSO works fine. ++ * It's not fully clear which chip versions are affected. Vendor ++ * drivers enable SG/TSO for certain chip versions per default, ++ * let's mimic this here. On other chip versions users can ++ * use ethtool to enable SG/TSO, use at own risk! ++ */ ++ if (tp->mac_version >= RTL_GIGA_MAC_VER_46 && ++ tp->mac_version != RTL_GIGA_MAC_VER_61) ++ dev->features |= dev->hw_features; ++ + dev->hw_features |= NETIF_F_RXALL; + dev->hw_features |= NETIF_F_RXFCS; + diff --git a/target/linux/generic/backport-6.6/780-27-v6.13-r8169-implement-additional-ethtool-stats-ops.patch b/target/linux/generic/backport-6.6/780-27-v6.13-r8169-implement-additional-ethtool-stats-ops.patch new file mode 100644 index 00000000000000..faab0df7f400e2 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-27-v6.13-r8169-implement-additional-ethtool-stats-ops.patch @@ -0,0 +1,130 @@ +From e3fc5139bd8ffaa1498adc21be4e8ecbc6aed508 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Sun, 13 Oct 2024 11:17:39 +0200 +Subject: [PATCH] r8169: implement additional ethtool stats ops + +This adds support for ethtool standard statistics, and makes use of the +extended hardware statistics being available from RTl8125. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Link: https://patch.msgid.link/58e0da73-a7dd-4be3-82ae-d5b3f9069bde@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169_main.c | 82 +++++++++++++++++++++++ + 1 file changed, 82 insertions(+) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -2162,6 +2162,19 @@ static void rtl8169_get_ringparam(struct + data->tx_pending = NUM_TX_DESC; + } + ++static void rtl8169_get_pause_stats(struct net_device *dev, ++ struct ethtool_pause_stats *pause_stats) ++{ ++ struct rtl8169_private *tp = netdev_priv(dev); ++ ++ if (!rtl_is_8125(tp)) ++ return; ++ ++ rtl8169_update_counters(tp); ++ pause_stats->tx_pause_frames = le32_to_cpu(tp->counters->tx_pause_on); ++ pause_stats->rx_pause_frames = le32_to_cpu(tp->counters->rx_pause_on); ++} ++ + static void rtl8169_get_pauseparam(struct net_device *dev, + struct ethtool_pauseparam *data) + { +@@ -2188,6 +2201,69 @@ static int rtl8169_set_pauseparam(struct + return 0; + } + ++static void rtl8169_get_eth_mac_stats(struct net_device *dev, ++ struct ethtool_eth_mac_stats *mac_stats) ++{ ++ struct rtl8169_private *tp = netdev_priv(dev); ++ ++ rtl8169_update_counters(tp); ++ ++ mac_stats->FramesTransmittedOK = ++ le64_to_cpu(tp->counters->tx_packets); ++ mac_stats->SingleCollisionFrames = ++ le32_to_cpu(tp->counters->tx_one_collision); ++ mac_stats->MultipleCollisionFrames = ++ le32_to_cpu(tp->counters->tx_multi_collision); ++ mac_stats->FramesReceivedOK = ++ le64_to_cpu(tp->counters->rx_packets); ++ mac_stats->AlignmentErrors = ++ le16_to_cpu(tp->counters->align_errors); ++ mac_stats->FramesLostDueToIntMACXmitError = ++ le64_to_cpu(tp->counters->tx_errors); ++ mac_stats->BroadcastFramesReceivedOK = ++ le64_to_cpu(tp->counters->rx_broadcast); ++ mac_stats->MulticastFramesReceivedOK = ++ le32_to_cpu(tp->counters->rx_multicast); ++ ++ if (!rtl_is_8125(tp)) ++ return; ++ ++ mac_stats->AlignmentErrors = ++ le32_to_cpu(tp->counters->align_errors32); ++ mac_stats->OctetsTransmittedOK = ++ le64_to_cpu(tp->counters->tx_octets); ++ mac_stats->LateCollisions = ++ le32_to_cpu(tp->counters->tx_late_collision); ++ mac_stats->FramesAbortedDueToXSColls = ++ le32_to_cpu(tp->counters->tx_aborted32); ++ mac_stats->OctetsReceivedOK = ++ le64_to_cpu(tp->counters->rx_octets); ++ mac_stats->FramesLostDueToIntMACRcvError = ++ le32_to_cpu(tp->counters->rx_mac_error); ++ mac_stats->MulticastFramesXmittedOK = ++ le64_to_cpu(tp->counters->tx_multicast64); ++ mac_stats->BroadcastFramesXmittedOK = ++ le64_to_cpu(tp->counters->tx_broadcast64); ++ mac_stats->MulticastFramesReceivedOK = ++ le64_to_cpu(tp->counters->rx_multicast64); ++ mac_stats->FrameTooLongErrors = ++ le32_to_cpu(tp->counters->rx_frame_too_long); ++} ++ ++static void rtl8169_get_eth_ctrl_stats(struct net_device *dev, ++ struct ethtool_eth_ctrl_stats *ctrl_stats) ++{ ++ struct rtl8169_private *tp = netdev_priv(dev); ++ ++ if (!rtl_is_8125(tp)) ++ return; ++ ++ rtl8169_update_counters(tp); ++ ++ ctrl_stats->UnsupportedOpcodesReceived = ++ le32_to_cpu(tp->counters->rx_unknown_opcode); ++} ++ + static const struct ethtool_ops rtl8169_ethtool_ops = { + .supported_coalesce_params = ETHTOOL_COALESCE_USECS | + ETHTOOL_COALESCE_MAX_FRAMES, +@@ -2209,8 +2285,11 @@ static const struct ethtool_ops rtl8169_ + .get_link_ksettings = phy_ethtool_get_link_ksettings, + .set_link_ksettings = phy_ethtool_set_link_ksettings, + .get_ringparam = rtl8169_get_ringparam, ++ .get_pause_stats = rtl8169_get_pause_stats, + .get_pauseparam = rtl8169_get_pauseparam, + .set_pauseparam = rtl8169_set_pauseparam, ++ .get_eth_mac_stats = rtl8169_get_eth_mac_stats, ++ .get_eth_ctrl_stats = rtl8169_get_eth_ctrl_stats, + }; + + static enum mac_version rtl8169_get_mac_version(u16 xid, bool gmii) +@@ -3895,6 +3974,9 @@ static void rtl_hw_start_8125(struct rtl + break; + } + ++ /* enable extended tally counter */ ++ r8168_mac_ocp_modify(tp, 0xea84, 0, BIT(1) | BIT(0)); ++ + rtl_hw_config(tp); + } + diff --git a/target/linux/generic/backport-6.6/780-28-v6.13-r8169-don-t-take-RTNL-lock-in-rtl_task.patch b/target/linux/generic/backport-6.6/780-28-v6.13-r8169-don-t-take-RTNL-lock-in-rtl_task.patch new file mode 100644 index 00000000000000..38b5035441f039 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-28-v6.13-r8169-don-t-take-RTNL-lock-in-rtl_task.patch @@ -0,0 +1,50 @@ +From ac48430368c1a4f4e6c2fa92243b4b93fd25bee4 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Wed, 16 Oct 2024 22:05:57 +0200 +Subject: [PATCH] r8169: don't take RTNL lock in rtl_task() + +There's not really a benefit here in taking the RTNL lock. The task +handler does exception handling only, so we're in trouble anyway when +we come here, and there's no need to protect against e.g. a parallel +ethtool call. +A benefit of removing the RTNL lock here is that we now can +synchronously cancel the workqueue from a context holding the RTNL mutex. + +Signed-off-by: Heiner Kallweit +Signed-off-by: Andrew Lunn +--- + drivers/net/ethernet/realtek/r8169_main.c | 8 ++------ + 1 file changed, 2 insertions(+), 6 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -4802,10 +4802,8 @@ static void rtl_task(struct work_struct + container_of(work, struct rtl8169_private, wk.work); + int ret; + +- rtnl_lock(); +- + if (!test_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags)) +- goto out_unlock; ++ return; + + if (test_and_clear_bit(RTL_FLAG_TASK_TX_TIMEOUT, tp->wk.flags)) { + /* if chip isn't accessible, reset bus to revive it */ +@@ -4814,7 +4812,7 @@ static void rtl_task(struct work_struct + if (ret < 0) { + netdev_err(tp->dev, "Can't reset secondary PCI bus, detach NIC\n"); + netif_device_detach(tp->dev); +- goto out_unlock; ++ return; + } + } + +@@ -4833,8 +4831,6 @@ reset: + } else if (test_and_clear_bit(RTL_FLAG_TASK_RESET_NO_QUEUE_WAKE, tp->wk.flags)) { + rtl_reset_work(tp); + } +-out_unlock: +- rtnl_unlock(); + } + + static int rtl8169_poll(struct napi_struct *napi, int budget) diff --git a/target/linux/generic/backport-6.6/780-30-v6.13-r8169-avoid-duplicated-messages-if-loading-firmware-.patch b/target/linux/generic/backport-6.6/780-30-v6.13-r8169-avoid-duplicated-messages-if-loading-firmware-.patch new file mode 100644 index 00000000000000..6430d32252b125 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-30-v6.13-r8169-avoid-duplicated-messages-if-loading-firmware-.patch @@ -0,0 +1,41 @@ +From 1c105bacb160b5918e917ab811552b7be69fc69c Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Wed, 16 Oct 2024 22:29:39 +0200 +Subject: [PATCH] r8169: avoid duplicated messages if loading firmware fails + and switch to warn level + +In case of a problem with firmware loading we inform at the driver level, +in addition the firmware load code itself issues warnings. Therefore +switch to firmware_request_nowarn() to avoid duplicated error messages. +In addition switch to warn level because the firmware is optional and +typically just fixes compatibility issues. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Message-ID: +Signed-off-by: Andrew Lunn +--- + drivers/net/ethernet/realtek/r8169_firmware.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169_firmware.c ++++ b/drivers/net/ethernet/realtek/r8169_firmware.c +@@ -215,7 +215,7 @@ int rtl_fw_request_firmware(struct rtl_f + { + int rc; + +- rc = request_firmware(&rtl_fw->fw, rtl_fw->fw_name, rtl_fw->dev); ++ rc = firmware_request_nowarn(&rtl_fw->fw, rtl_fw->fw_name, rtl_fw->dev); + if (rc < 0) + goto out; + +@@ -227,7 +227,7 @@ int rtl_fw_request_firmware(struct rtl_f + + return 0; + out: +- dev_err(rtl_fw->dev, "Unable to load firmware %s (%d)\n", +- rtl_fw->fw_name, rc); ++ dev_warn(rtl_fw->dev, "Unable to load firmware %s (%d)\n", ++ rtl_fw->fw_name, rc); + return rc; + } diff --git a/target/linux/generic/backport-6.6/780-31-v6.13-r8169-remove-rtl_dash_loop_wait_high-low.patch b/target/linux/generic/backport-6.6/780-31-v6.13-r8169-remove-rtl_dash_loop_wait_high-low.patch new file mode 100644 index 00000000000000..4792e371b6316b --- /dev/null +++ b/target/linux/generic/backport-6.6/780-31-v6.13-r8169-remove-rtl_dash_loop_wait_high-low.patch @@ -0,0 +1,82 @@ +From d64113c6bb5ea5a70b7c9c3a6bcadef307638187 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Wed, 16 Oct 2024 22:31:10 +0200 +Subject: [PATCH] r8169: remove rtl_dash_loop_wait_high/low + +Remove rtl_dash_loop_wait_high/low to simplify the code. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Message-ID: +Signed-off-by: Andrew Lunn +--- + drivers/net/ethernet/realtek/r8169_main.c | 35 ++++++----------------- + 1 file changed, 8 insertions(+), 27 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -1347,40 +1347,19 @@ static void rtl8168ep_stop_cmac(struct r + RTL_W8(tp, IBCR0, RTL_R8(tp, IBCR0) & ~0x01); + } + +-static void rtl_dash_loop_wait(struct rtl8169_private *tp, +- const struct rtl_cond *c, +- unsigned long usecs, int n, bool high) +-{ +- if (!tp->dash_enabled) +- return; +- rtl_loop_wait(tp, c, usecs, n, high); +-} +- +-static void rtl_dash_loop_wait_high(struct rtl8169_private *tp, +- const struct rtl_cond *c, +- unsigned long d, int n) +-{ +- rtl_dash_loop_wait(tp, c, d, n, true); +-} +- +-static void rtl_dash_loop_wait_low(struct rtl8169_private *tp, +- const struct rtl_cond *c, +- unsigned long d, int n) +-{ +- rtl_dash_loop_wait(tp, c, d, n, false); +-} +- + static void rtl8168dp_driver_start(struct rtl8169_private *tp) + { + r8168dp_oob_notify(tp, OOB_CMD_DRIVER_START); +- rtl_dash_loop_wait_high(tp, &rtl_dp_ocp_read_cond, 10000, 10); ++ if (tp->dash_enabled) ++ rtl_loop_wait_high(tp, &rtl_dp_ocp_read_cond, 10000, 10); + } + + static void rtl8168ep_driver_start(struct rtl8169_private *tp) + { + r8168ep_ocp_write(tp, 0x01, 0x180, OOB_CMD_DRIVER_START); + r8168ep_ocp_write(tp, 0x01, 0x30, r8168ep_ocp_read(tp, 0x30) | 0x01); +- rtl_dash_loop_wait_high(tp, &rtl_ep_ocp_read_cond, 10000, 30); ++ if (tp->dash_enabled) ++ rtl_loop_wait_high(tp, &rtl_ep_ocp_read_cond, 10000, 30); + } + + static void rtl8168_driver_start(struct rtl8169_private *tp) +@@ -1394,7 +1373,8 @@ static void rtl8168_driver_start(struct + static void rtl8168dp_driver_stop(struct rtl8169_private *tp) + { + r8168dp_oob_notify(tp, OOB_CMD_DRIVER_STOP); +- rtl_dash_loop_wait_low(tp, &rtl_dp_ocp_read_cond, 10000, 10); ++ if (tp->dash_enabled) ++ rtl_loop_wait_low(tp, &rtl_dp_ocp_read_cond, 10000, 10); + } + + static void rtl8168ep_driver_stop(struct rtl8169_private *tp) +@@ -1402,7 +1382,8 @@ static void rtl8168ep_driver_stop(struct + rtl8168ep_stop_cmac(tp); + r8168ep_ocp_write(tp, 0x01, 0x180, OOB_CMD_DRIVER_STOP); + r8168ep_ocp_write(tp, 0x01, 0x30, r8168ep_ocp_read(tp, 0x30) | 0x01); +- rtl_dash_loop_wait_low(tp, &rtl_ep_ocp_read_cond, 10000, 10); ++ if (tp->dash_enabled) ++ rtl_loop_wait_low(tp, &rtl_ep_ocp_read_cond, 10000, 10); + } + + static void rtl8168_driver_stop(struct rtl8169_private *tp) diff --git a/target/linux/generic/backport-6.6/780-32-v6.13-r8169-enable-EEE-at-2.5G-per-default-on-RTL8125B.patch b/target/linux/generic/backport-6.6/780-32-v6.13-r8169-enable-EEE-at-2.5G-per-default-on-RTL8125B.patch new file mode 100644 index 00000000000000..4ec06cc6019526 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-32-v6.13-r8169-enable-EEE-at-2.5G-per-default-on-RTL8125B.patch @@ -0,0 +1,28 @@ +From c4e64095c00cb2de413cd6b90be047c273bcd491 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Thu, 17 Oct 2024 22:27:44 +0200 +Subject: [PATCH] r8169: enable EEE at 2.5G per default on RTL8125B + +Register a6d/12 is shadowing register MDIO_AN_EEE_ADV2. So this line +disables advertisement of EEE at 2.5G. Latest vendor driver r8125 +doesn't do this (any longer?), so this mode seems to be safe. +EEE saves quite some energy, therefore enable this mode per default. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Message-ID: <95dd5a0c-09ea-4847-94d9-b7aa3063e8ff@gmail.com> +Signed-off-by: Andrew Lunn +--- + drivers/net/ethernet/realtek/r8169_phy_config.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/net/ethernet/realtek/r8169_phy_config.c ++++ b/drivers/net/ethernet/realtek/r8169_phy_config.c +@@ -99,7 +99,6 @@ static void rtl8125a_config_eee_phy(stru + + static void rtl8125b_config_eee_phy(struct phy_device *phydev) + { +- phy_modify_paged(phydev, 0xa6d, 0x12, 0x0001, 0x0000); + phy_modify_paged(phydev, 0xa6d, 0x14, 0x0010, 0x0000); + phy_modify_paged(phydev, 0xa42, 0x14, 0x0080, 0x0000); + phy_modify_paged(phydev, 0xa4a, 0x11, 0x0200, 0x0000); diff --git a/target/linux/generic/backport-6.6/780-33-v6.13-r8169-add-support-for-RTL8125D.patch b/target/linux/generic/backport-6.6/780-33-v6.13-r8169-add-support-for-RTL8125D.patch new file mode 100644 index 00000000000000..81058e5e9f7641 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-33-v6.13-r8169-add-support-for-RTL8125D.patch @@ -0,0 +1,143 @@ +From f75d1fbe7809bc5ed134204b920fd9e2fc5db1df Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Thu, 24 Oct 2024 22:42:33 +0200 +Subject: [PATCH] r8169: add support for RTL8125D + +This adds support for new chip version RTL8125D, which can be found on +boards like Gigabyte X870E AORUS ELITE WIFI7. Firmware rtl8125d-1.fw +for this chip version is available in linux-firmware already. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Link: https://patch.msgid.link/d0306912-e88e-4c25-8b5d-545ae8834c0c@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169.h | 1 + + drivers/net/ethernet/realtek/r8169_main.c | 23 +++++++++++++------ + .../net/ethernet/realtek/r8169_phy_config.c | 10 ++++++++ + 3 files changed, 27 insertions(+), 7 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169.h ++++ b/drivers/net/ethernet/realtek/r8169.h +@@ -68,6 +68,7 @@ enum mac_version { + /* support for RTL_GIGA_MAC_VER_60 has been removed */ + RTL_GIGA_MAC_VER_61, + RTL_GIGA_MAC_VER_63, ++ RTL_GIGA_MAC_VER_64, + RTL_GIGA_MAC_VER_65, + RTL_GIGA_MAC_VER_66, + RTL_GIGA_MAC_NONE +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -56,6 +56,7 @@ + #define FIRMWARE_8107E_2 "rtl_nic/rtl8107e-2.fw" + #define FIRMWARE_8125A_3 "rtl_nic/rtl8125a-3.fw" + #define FIRMWARE_8125B_2 "rtl_nic/rtl8125b-2.fw" ++#define FIRMWARE_8125D_1 "rtl_nic/rtl8125d-1.fw" + #define FIRMWARE_8126A_2 "rtl_nic/rtl8126a-2.fw" + #define FIRMWARE_8126A_3 "rtl_nic/rtl8126a-3.fw" + +@@ -139,6 +140,7 @@ static const struct { + [RTL_GIGA_MAC_VER_61] = {"RTL8125A", FIRMWARE_8125A_3}, + /* reserve 62 for CFG_METHOD_4 in the vendor driver */ + [RTL_GIGA_MAC_VER_63] = {"RTL8125B", FIRMWARE_8125B_2}, ++ [RTL_GIGA_MAC_VER_64] = {"RTL8125D", FIRMWARE_8125D_1}, + [RTL_GIGA_MAC_VER_65] = {"RTL8126A", FIRMWARE_8126A_2}, + [RTL_GIGA_MAC_VER_66] = {"RTL8126A", FIRMWARE_8126A_3}, + }; +@@ -708,6 +710,7 @@ MODULE_FIRMWARE(FIRMWARE_8168FP_3); + MODULE_FIRMWARE(FIRMWARE_8107E_2); + MODULE_FIRMWARE(FIRMWARE_8125A_3); + MODULE_FIRMWARE(FIRMWARE_8125B_2); ++MODULE_FIRMWARE(FIRMWARE_8125D_1); + MODULE_FIRMWARE(FIRMWARE_8126A_2); + MODULE_FIRMWARE(FIRMWARE_8126A_3); + +@@ -2080,10 +2083,7 @@ static void rtl_set_eee_txidle_timer(str + tp->tx_lpi_timer = timer_val; + r8168_mac_ocp_write(tp, 0xe048, timer_val); + break; +- case RTL_GIGA_MAC_VER_61: +- case RTL_GIGA_MAC_VER_63: +- case RTL_GIGA_MAC_VER_65: +- case RTL_GIGA_MAC_VER_66: ++ case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_66: + tp->tx_lpi_timer = timer_val; + RTL_W16(tp, EEE_TXIDLE_TIMER_8125, timer_val); + break; +@@ -2295,6 +2295,9 @@ static enum mac_version rtl8169_get_mac_ + { 0x7cf, 0x64a, RTL_GIGA_MAC_VER_66 }, + { 0x7cf, 0x649, RTL_GIGA_MAC_VER_65 }, + ++ /* 8125D family. */ ++ { 0x7cf, 0x688, RTL_GIGA_MAC_VER_64 }, ++ + /* 8125B family. */ + { 0x7cf, 0x641, RTL_GIGA_MAC_VER_63 }, + +@@ -2562,9 +2565,7 @@ static void rtl_init_rxcfg(struct rtl816 + case RTL_GIGA_MAC_VER_61: + RTL_W32(tp, RxConfig, RX_FETCH_DFLT_8125 | RX_DMA_BURST); + break; +- case RTL_GIGA_MAC_VER_63: +- case RTL_GIGA_MAC_VER_65: +- case RTL_GIGA_MAC_VER_66: ++ case RTL_GIGA_MAC_VER_63 ... RTL_GIGA_MAC_VER_66: + RTL_W32(tp, RxConfig, RX_FETCH_DFLT_8125 | RX_DMA_BURST | + RX_PAUSE_SLOT_ON); + break; +@@ -3876,6 +3877,12 @@ static void rtl_hw_start_8125b(struct rt + rtl_hw_start_8125_common(tp); + } + ++static void rtl_hw_start_8125d(struct rtl8169_private *tp) ++{ ++ rtl_set_def_aspm_entry_latency(tp); ++ rtl_hw_start_8125_common(tp); ++} ++ + static void rtl_hw_start_8126a(struct rtl8169_private *tp) + { + rtl_set_def_aspm_entry_latency(tp); +@@ -3924,6 +3931,7 @@ static void rtl_hw_config(struct rtl8169 + [RTL_GIGA_MAC_VER_53] = rtl_hw_start_8117, + [RTL_GIGA_MAC_VER_61] = rtl_hw_start_8125a_2, + [RTL_GIGA_MAC_VER_63] = rtl_hw_start_8125b, ++ [RTL_GIGA_MAC_VER_64] = rtl_hw_start_8125d, + [RTL_GIGA_MAC_VER_65] = rtl_hw_start_8126a, + [RTL_GIGA_MAC_VER_66] = rtl_hw_start_8126a, + }; +@@ -3941,6 +3949,7 @@ static void rtl_hw_start_8125(struct rtl + /* disable interrupt coalescing */ + switch (tp->mac_version) { + case RTL_GIGA_MAC_VER_61: ++ case RTL_GIGA_MAC_VER_64: + for (i = 0xa00; i < 0xb00; i += 4) + RTL_W32(tp, i, 0); + break; +--- a/drivers/net/ethernet/realtek/r8169_phy_config.c ++++ b/drivers/net/ethernet/realtek/r8169_phy_config.c +@@ -1103,6 +1103,15 @@ static void rtl8125b_hw_phy_config(struc + rtl8125b_config_eee_phy(phydev); + } + ++static void rtl8125d_hw_phy_config(struct rtl8169_private *tp, ++ struct phy_device *phydev) ++{ ++ r8169_apply_firmware(tp); ++ rtl8125_legacy_force_mode(phydev); ++ rtl8168g_disable_aldps(phydev); ++ rtl8125b_config_eee_phy(phydev); ++} ++ + static void rtl8126a_hw_phy_config(struct rtl8169_private *tp, + struct phy_device *phydev) + { +@@ -1159,6 +1168,7 @@ void r8169_hw_phy_config(struct rtl8169_ + [RTL_GIGA_MAC_VER_53] = rtl8117_hw_phy_config, + [RTL_GIGA_MAC_VER_61] = rtl8125a_2_hw_phy_config, + [RTL_GIGA_MAC_VER_63] = rtl8125b_hw_phy_config, ++ [RTL_GIGA_MAC_VER_64] = rtl8125d_hw_phy_config, + [RTL_GIGA_MAC_VER_65] = rtl8126a_hw_phy_config, + [RTL_GIGA_MAC_VER_66] = rtl8126a_hw_phy_config, + }; diff --git a/target/linux/generic/backport-6.6/780-34-v6.13-r8169-fix-inconsistent-indenting-in-rtl8169_get_eth_.patch b/target/linux/generic/backport-6.6/780-34-v6.13-r8169-fix-inconsistent-indenting-in-rtl8169_get_eth_.patch new file mode 100644 index 00000000000000..721e51ebf056e9 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-34-v6.13-r8169-fix-inconsistent-indenting-in-rtl8169_get_eth_.patch @@ -0,0 +1,30 @@ +From b8bd8c44a266c9a7dcb907eab10fbb119e3f6494 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Thu, 24 Oct 2024 22:48:59 +0200 +Subject: [PATCH] r8169: fix inconsistent indenting in + rtl8169_get_eth_mac_stats + +This fixes an inconsistent indenting introduced with e3fc5139bd8f +("r8169: implement additional ethtool stats ops"). + +Reported-by: kernel test robot +Closes: https://lore.kernel.org/oe-kbuild-all/202410220413.1gAxIJ4t-lkp@intel.com/ +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Link: https://patch.msgid.link/20fd6f39-3c1b-4af0-9adc-7d1f49728fad@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169_main.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -2227,7 +2227,7 @@ static void rtl8169_get_eth_mac_stats(st + le64_to_cpu(tp->counters->tx_broadcast64); + mac_stats->MulticastFramesReceivedOK = + le64_to_cpu(tp->counters->rx_multicast64); +- mac_stats->FrameTooLongErrors = ++ mac_stats->FrameTooLongErrors = + le32_to_cpu(tp->counters->rx_frame_too_long); + } + diff --git a/target/linux/generic/backport-6.6/780-35-v6.13-r8169-align-RTL8125-EEE-config-with-vendor-driver.patch b/target/linux/generic/backport-6.6/780-35-v6.13-r8169-align-RTL8125-EEE-config-with-vendor-driver.patch new file mode 100644 index 00000000000000..de2be0165c26e6 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-35-v6.13-r8169-align-RTL8125-EEE-config-with-vendor-driver.patch @@ -0,0 +1,49 @@ +From eb90f876b7961d702d7fc549e14614860f531e60 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Thu, 31 Oct 2024 22:42:52 +0100 +Subject: [PATCH] r8169: align RTL8125 EEE config with vendor driver + +Align the EEE config for RTL8125A/RTL8125B with vendor driver r8125. +This should help to avoid compatibility issues. + +Signed-off-by: Heiner Kallweit +Link: https://patch.msgid.link/044c925e-8669-4b98-87df-95b4056f4f5f@gmail.com +Signed-off-by: Jakub Kicinski +--- + .../net/ethernet/realtek/r8169_phy_config.c | 18 ++++++++++++------ + 1 file changed, 12 insertions(+), 6 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169_phy_config.c ++++ b/drivers/net/ethernet/realtek/r8169_phy_config.c +@@ -89,19 +89,25 @@ static void rtl8168h_config_eee_phy(stru + phy_modify_paged(phydev, 0xa42, 0x14, 0x0000, 0x0080); + } + +-static void rtl8125a_config_eee_phy(struct phy_device *phydev) ++static void rtl8125_common_config_eee_phy(struct phy_device *phydev) + { +- rtl8168h_config_eee_phy(phydev); ++ phy_modify_paged(phydev, 0xa6d, 0x14, 0x0010, 0x0000); ++ phy_modify_paged(phydev, 0xa42, 0x14, 0x0080, 0x0000); ++ phy_modify_paged(phydev, 0xa4a, 0x11, 0x0200, 0x0000); ++} + ++static void rtl8125a_config_eee_phy(struct phy_device *phydev) ++{ ++ rtl8168g_config_eee_phy(phydev); ++ /* disable EEE at 2.5Gbps */ + phy_modify_paged(phydev, 0xa6d, 0x12, 0x0001, 0x0000); +- phy_modify_paged(phydev, 0xa6d, 0x14, 0x0010, 0x0000); ++ rtl8125_common_config_eee_phy(phydev); + } + + static void rtl8125b_config_eee_phy(struct phy_device *phydev) + { +- phy_modify_paged(phydev, 0xa6d, 0x14, 0x0010, 0x0000); +- phy_modify_paged(phydev, 0xa42, 0x14, 0x0080, 0x0000); +- phy_modify_paged(phydev, 0xa4a, 0x11, 0x0200, 0x0000); ++ rtl8168g_config_eee_phy(phydev); ++ rtl8125_common_config_eee_phy(phydev); + } + + static void rtl8169s_hw_phy_config(struct rtl8169_private *tp, diff --git a/target/linux/generic/backport-6.6/780-36-v6.13-r8169-align-RTL8125-RTL8126-PHY-config-with-vendor-d.patch b/target/linux/generic/backport-6.6/780-36-v6.13-r8169-align-RTL8125-RTL8126-PHY-config-with-vendor-d.patch new file mode 100644 index 00000000000000..a546c426b4905a --- /dev/null +++ b/target/linux/generic/backport-6.6/780-36-v6.13-r8169-align-RTL8125-RTL8126-PHY-config-with-vendor-d.patch @@ -0,0 +1,46 @@ +From 4af2f60bf7378bd5c92b15a528d8c6c7d02bed6c Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Thu, 31 Oct 2024 22:43:45 +0100 +Subject: [PATCH] r8169: align RTL8125/RTL8126 PHY config with vendor driver + +This aligns some parameters with vendor driver r8125/r8126 to avoid +compatibility issues. Note that for RTL8125B there's no functional +change, just the open-coded version of the function is replaced. + +Signed-off-by: Heiner Kallweit +Link: https://patch.msgid.link/a8a9d896-fbe6-41f2-bf87-666567d3cdb3@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169_phy_config.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/drivers/net/ethernet/realtek/r8169_phy_config.c ++++ b/drivers/net/ethernet/realtek/r8169_phy_config.c +@@ -1073,8 +1073,8 @@ static void rtl8125b_hw_phy_config(struc + struct phy_device *phydev) + { + r8169_apply_firmware(tp); ++ rtl8168g_enable_gphy_10m(phydev); + +- phy_modify_paged(phydev, 0xa44, 0x11, 0x0000, 0x0800); + phy_modify_paged(phydev, 0xac4, 0x13, 0x00f0, 0x0090); + phy_modify_paged(phydev, 0xad3, 0x10, 0x0003, 0x0001); + +@@ -1113,6 +1113,7 @@ static void rtl8125d_hw_phy_config(struc + struct phy_device *phydev) + { + r8169_apply_firmware(tp); ++ rtl8168g_enable_gphy_10m(phydev); + rtl8125_legacy_force_mode(phydev); + rtl8168g_disable_aldps(phydev); + rtl8125b_config_eee_phy(phydev); +@@ -1122,6 +1123,9 @@ static void rtl8126a_hw_phy_config(struc + struct phy_device *phydev) + { + r8169_apply_firmware(tp); ++ rtl8168g_enable_gphy_10m(phydev); ++ rtl8125_legacy_force_mode(phydev); ++ rtl8168g_disable_aldps(phydev); + } + + void r8169_hw_phy_config(struct rtl8169_private *tp, struct phy_device *phydev, diff --git a/target/linux/generic/backport-6.6/780-37-v6.13-r8169-align-RTL8126-EEE-config-with-vendor-driver.patch b/target/linux/generic/backport-6.6/780-37-v6.13-r8169-align-RTL8126-EEE-config-with-vendor-driver.patch new file mode 100644 index 00000000000000..36c8041c94e60e --- /dev/null +++ b/target/linux/generic/backport-6.6/780-37-v6.13-r8169-align-RTL8126-EEE-config-with-vendor-driver.patch @@ -0,0 +1,25 @@ +From a3d8520e6a19ab018da6c7fc22512c913697a829 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Thu, 31 Oct 2024 22:44:36 +0100 +Subject: [PATCH] r8169: align RTL8126 EEE config with vendor driver + +Align the EEE config for RTL8126A with vendor driver r8126 to avoid +compatibility issues. + +Signed-off-by: Heiner Kallweit +Link: https://patch.msgid.link/71e4859e-4cd0-4b6b-b7fa-621d7721992f@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169_phy_config.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/ethernet/realtek/r8169_phy_config.c ++++ b/drivers/net/ethernet/realtek/r8169_phy_config.c +@@ -1126,6 +1126,7 @@ static void rtl8126a_hw_phy_config(struc + rtl8168g_enable_gphy_10m(phydev); + rtl8125_legacy_force_mode(phydev); + rtl8168g_disable_aldps(phydev); ++ rtl8125_common_config_eee_phy(phydev); + } + + void r8169_hw_phy_config(struct rtl8169_private *tp, struct phy_device *phydev, diff --git a/target/linux/generic/backport-6.6/780-38-v6.13-r8169-improve-initialization-of-RSS-registers-on-RTL.patch b/target/linux/generic/backport-6.6/780-38-v6.13-r8169-improve-initialization-of-RSS-registers-on-RTL.patch new file mode 100644 index 00000000000000..8cb79c82cf3a37 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-38-v6.13-r8169-improve-initialization-of-RSS-registers-on-RTL.patch @@ -0,0 +1,38 @@ +From 2cd02f2fdd8a92e5b6b85ff64eab0fc549b30c07 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Sat, 2 Nov 2024 14:49:01 +0100 +Subject: [PATCH] r8169: improve initialization of RSS registers on + RTL8125/RTL8126 + +Replace the register addresses with the names used in r8125/r8126 +vendor driver, and consider that RSS_CTRL_8125 is a 32 bit register. + +Signed-off-by: Heiner Kallweit +Link: https://patch.msgid.link/3bf2f340-b369-4174-97bf-fd38d4217492@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169_main.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -347,6 +347,8 @@ enum rtl8125_registers { + TxPoll_8125 = 0x90, + LEDSEL3 = 0x96, + MAC0_BKP = 0x19e0, ++ RSS_CTRL_8125 = 0x4500, ++ Q_NUM_CTRL_8125 = 0x4800, + EEE_TXIDLE_TIMER_8125 = 0x6048, + }; + +@@ -3770,8 +3772,8 @@ static void rtl_hw_start_8125_common(str + rtl_pcie_state_l2l3_disable(tp); + + RTL_W16(tp, 0x382, 0x221b); +- RTL_W8(tp, 0x4500, 0); +- RTL_W16(tp, 0x4800, 0); ++ RTL_W32(tp, RSS_CTRL_8125, 0); ++ RTL_W16(tp, Q_NUM_CTRL_8125, 0); + + /* disable UPS */ + r8168_mac_ocp_modify(tp, 0xd40a, 0x0010, 0x0000); diff --git a/target/linux/generic/backport-6.6/780-39-v6.13-r8169-remove-leftover-locks-after-reverted-change.patch b/target/linux/generic/backport-6.6/780-39-v6.13-r8169-remove-leftover-locks-after-reverted-change.patch new file mode 100644 index 00000000000000..20c42955e36d46 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-39-v6.13-r8169-remove-leftover-locks-after-reverted-change.patch @@ -0,0 +1,113 @@ +From 83cb4b470c66b37b19a347a35cea01e0cbdd258d Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Mon, 4 Nov 2024 23:16:20 +0100 +Subject: [PATCH] r8169: remove leftover locks after reverted change + +After e31a9fedc7d8 ("Revert "r8169: disable ASPM during NAPI poll"") +these locks aren't needed any longer. + +Signed-off-by: Heiner Kallweit +Link: https://patch.msgid.link/680f2606-ac7d-4ced-8694-e5033855da9b@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169_main.c | 29 ++--------------------- + 1 file changed, 2 insertions(+), 27 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -663,13 +663,9 @@ struct rtl8169_private { + struct work_struct work; + } wk; + +- raw_spinlock_t config25_lock; + raw_spinlock_t mac_ocp_lock; + struct mutex led_lock; /* serialize LED ctrl RMW access */ + +- raw_spinlock_t cfg9346_usage_lock; +- int cfg9346_usage_count; +- + unsigned supports_gmii:1; + unsigned aspm_manageable:1; + unsigned dash_enabled:1; +@@ -723,22 +719,12 @@ static inline struct device *tp_to_dev(s + + static void rtl_lock_config_regs(struct rtl8169_private *tp) + { +- unsigned long flags; +- +- raw_spin_lock_irqsave(&tp->cfg9346_usage_lock, flags); +- if (!--tp->cfg9346_usage_count) +- RTL_W8(tp, Cfg9346, Cfg9346_Lock); +- raw_spin_unlock_irqrestore(&tp->cfg9346_usage_lock, flags); ++ RTL_W8(tp, Cfg9346, Cfg9346_Lock); + } + + static void rtl_unlock_config_regs(struct rtl8169_private *tp) + { +- unsigned long flags; +- +- raw_spin_lock_irqsave(&tp->cfg9346_usage_lock, flags); +- if (!tp->cfg9346_usage_count++) +- RTL_W8(tp, Cfg9346, Cfg9346_Unlock); +- raw_spin_unlock_irqrestore(&tp->cfg9346_usage_lock, flags); ++ RTL_W8(tp, Cfg9346, Cfg9346_Unlock); + } + + static void rtl_pci_commit(struct rtl8169_private *tp) +@@ -749,24 +735,18 @@ static void rtl_pci_commit(struct rtl816 + + static void rtl_mod_config2(struct rtl8169_private *tp, u8 clear, u8 set) + { +- unsigned long flags; + u8 val; + +- raw_spin_lock_irqsave(&tp->config25_lock, flags); + val = RTL_R8(tp, Config2); + RTL_W8(tp, Config2, (val & ~clear) | set); +- raw_spin_unlock_irqrestore(&tp->config25_lock, flags); + } + + static void rtl_mod_config5(struct rtl8169_private *tp, u8 clear, u8 set) + { +- unsigned long flags; + u8 val; + +- raw_spin_lock_irqsave(&tp->config25_lock, flags); + val = RTL_R8(tp, Config5); + RTL_W8(tp, Config5, (val & ~clear) | set); +- raw_spin_unlock_irqrestore(&tp->config25_lock, flags); + } + + static bool rtl_is_8125(struct rtl8169_private *tp) +@@ -1572,7 +1552,6 @@ static void __rtl8169_set_wol(struct rtl + { WAKE_MAGIC, Config3, MagicPacket } + }; + unsigned int i, tmp = ARRAY_SIZE(cfg); +- unsigned long flags; + u8 options; + + rtl_unlock_config_regs(tp); +@@ -1591,14 +1570,12 @@ static void __rtl8169_set_wol(struct rtl + r8168_mac_ocp_modify(tp, 0xc0b6, BIT(0), 0); + } + +- raw_spin_lock_irqsave(&tp->config25_lock, flags); + for (i = 0; i < tmp; i++) { + options = RTL_R8(tp, cfg[i].reg) & ~cfg[i].mask; + if (wolopts & cfg[i].opt) + options |= cfg[i].mask; + RTL_W8(tp, cfg[i].reg, options); + } +- raw_spin_unlock_irqrestore(&tp->config25_lock, flags); + + switch (tp->mac_version) { + case RTL_GIGA_MAC_VER_02 ... RTL_GIGA_MAC_VER_06: +@@ -5498,8 +5475,6 @@ static int rtl_init_one(struct pci_dev * + tp->supports_gmii = ent->driver_data == RTL_CFG_NO_GBIT ? 0 : 1; + tp->ocp_base = OCP_STD_PHY_BASE; + +- raw_spin_lock_init(&tp->cfg9346_usage_lock); +- raw_spin_lock_init(&tp->config25_lock); + raw_spin_lock_init(&tp->mac_ocp_lock); + mutex_init(&tp->led_lock); + diff --git a/target/linux/generic/backport-6.6/780-40-v6.13-r8169-improve-__rtl8169_set_wol.patch b/target/linux/generic/backport-6.6/780-40-v6.13-r8169-improve-__rtl8169_set_wol.patch new file mode 100644 index 00000000000000..8c88c078f29f57 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-40-v6.13-r8169-improve-__rtl8169_set_wol.patch @@ -0,0 +1,108 @@ +From c507e96b5763b36b63ad50ad804341f72ea000e4 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Wed, 6 Nov 2024 17:55:45 +0100 +Subject: [PATCH] r8169: improve __rtl8169_set_wol + +Add helper r8169_mod_reg8_cond() what allows to significantly simplify +__rtl8169_set_wol(). + +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Link: https://patch.msgid.link/697b197a-8eac-40c6-8847-27093cacec36@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169_main.c | 55 ++++++++++------------- + 1 file changed, 24 insertions(+), 31 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -749,6 +749,20 @@ static void rtl_mod_config5(struct rtl81 + RTL_W8(tp, Config5, (val & ~clear) | set); + } + ++static void r8169_mod_reg8_cond(struct rtl8169_private *tp, int reg, ++ u8 bits, bool cond) ++{ ++ u8 val, old_val; ++ ++ old_val = RTL_R8(tp, reg); ++ if (cond) ++ val = old_val | bits; ++ else ++ val = old_val & ~bits; ++ if (val != old_val) ++ RTL_W8(tp, reg, val); ++} ++ + static bool rtl_is_8125(struct rtl8169_private *tp) + { + return tp->mac_version >= RTL_GIGA_MAC_VER_61; +@@ -1539,58 +1553,37 @@ static void rtl8169_get_wol(struct net_d + + static void __rtl8169_set_wol(struct rtl8169_private *tp, u32 wolopts) + { +- static const struct { +- u32 opt; +- u16 reg; +- u8 mask; +- } cfg[] = { +- { WAKE_PHY, Config3, LinkUp }, +- { WAKE_UCAST, Config5, UWF }, +- { WAKE_BCAST, Config5, BWF }, +- { WAKE_MCAST, Config5, MWF }, +- { WAKE_ANY, Config5, LanWake }, +- { WAKE_MAGIC, Config3, MagicPacket } +- }; +- unsigned int i, tmp = ARRAY_SIZE(cfg); +- u8 options; +- + rtl_unlock_config_regs(tp); + + if (rtl_is_8168evl_up(tp)) { +- tmp--; + if (wolopts & WAKE_MAGIC) + rtl_eri_set_bits(tp, 0x0dc, MagicPacket_v2); + else + rtl_eri_clear_bits(tp, 0x0dc, MagicPacket_v2); + } else if (rtl_is_8125(tp)) { +- tmp--; + if (wolopts & WAKE_MAGIC) + r8168_mac_ocp_modify(tp, 0xc0b6, 0, BIT(0)); + else + r8168_mac_ocp_modify(tp, 0xc0b6, BIT(0), 0); ++ } else { ++ r8169_mod_reg8_cond(tp, Config3, MagicPacket, ++ wolopts & WAKE_MAGIC); + } + +- for (i = 0; i < tmp; i++) { +- options = RTL_R8(tp, cfg[i].reg) & ~cfg[i].mask; +- if (wolopts & cfg[i].opt) +- options |= cfg[i].mask; +- RTL_W8(tp, cfg[i].reg, options); +- } ++ r8169_mod_reg8_cond(tp, Config3, LinkUp, wolopts & WAKE_PHY); ++ r8169_mod_reg8_cond(tp, Config5, UWF, wolopts & WAKE_UCAST); ++ r8169_mod_reg8_cond(tp, Config5, BWF, wolopts & WAKE_BCAST); ++ r8169_mod_reg8_cond(tp, Config5, MWF, wolopts & WAKE_MCAST); ++ r8169_mod_reg8_cond(tp, Config5, LanWake, wolopts); + + switch (tp->mac_version) { + case RTL_GIGA_MAC_VER_02 ... RTL_GIGA_MAC_VER_06: +- options = RTL_R8(tp, Config1) & ~PMEnable; +- if (wolopts) +- options |= PMEnable; +- RTL_W8(tp, Config1, options); ++ r8169_mod_reg8_cond(tp, Config1, PMEnable, wolopts); + break; + case RTL_GIGA_MAC_VER_34: + case RTL_GIGA_MAC_VER_37: + case RTL_GIGA_MAC_VER_39 ... RTL_GIGA_MAC_VER_66: +- if (wolopts) +- rtl_mod_config2(tp, 0, PME_SIGNAL); +- else +- rtl_mod_config2(tp, PME_SIGNAL, 0); ++ r8169_mod_reg8_cond(tp, Config2, PME_SIGNAL, wolopts); + break; + default: + break; diff --git a/target/linux/generic/backport-6.6/780-41-v6.13-r8169-improve-rtl_set_d3_pll_down.patch b/target/linux/generic/backport-6.6/780-41-v6.13-r8169-improve-rtl_set_d3_pll_down.patch new file mode 100644 index 00000000000000..e7626173102023 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-41-v6.13-r8169-improve-rtl_set_d3_pll_down.patch @@ -0,0 +1,44 @@ +From 330dc2297c82953dff402e0b4176a5383a618538 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Wed, 6 Nov 2024 17:56:28 +0100 +Subject: [PATCH] r8169: improve rtl_set_d3_pll_down + +Make use of new helper r8169_mod_reg8_cond() and move from a switch() +to an if() clause. Benefit is that we don't have to touch this piece of +code each time support for a new chip version is added. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Link: https://patch.msgid.link/e1ccdb85-a4ed-4800-89c2-89770ff06452@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169_main.c | 18 +++++------------- + 1 file changed, 5 insertions(+), 13 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -1432,19 +1432,11 @@ static enum rtl_dash_type rtl_get_dash_t + + static void rtl_set_d3_pll_down(struct rtl8169_private *tp, bool enable) + { +- switch (tp->mac_version) { +- case RTL_GIGA_MAC_VER_25 ... RTL_GIGA_MAC_VER_26: +- case RTL_GIGA_MAC_VER_29 ... RTL_GIGA_MAC_VER_30: +- case RTL_GIGA_MAC_VER_32 ... RTL_GIGA_MAC_VER_37: +- case RTL_GIGA_MAC_VER_39 ... RTL_GIGA_MAC_VER_66: +- if (enable) +- RTL_W8(tp, PMCH, RTL_R8(tp, PMCH) & ~D3_NO_PLL_DOWN); +- else +- RTL_W8(tp, PMCH, RTL_R8(tp, PMCH) | D3_NO_PLL_DOWN); +- break; +- default: +- break; +- } ++ if (tp->mac_version >= RTL_GIGA_MAC_VER_25 && ++ tp->mac_version != RTL_GIGA_MAC_VER_28 && ++ tp->mac_version != RTL_GIGA_MAC_VER_31 && ++ tp->mac_version != RTL_GIGA_MAC_VER_38) ++ r8169_mod_reg8_cond(tp, PMCH, D3_NO_PLL_DOWN, !enable); + } + + static void rtl_reset_packet_filter(struct rtl8169_private *tp) diff --git a/target/linux/generic/backport-6.6/780-42-v6.13-r8169-align-WAKE_PHY-handling-with-r8125-r8126-vendo.patch b/target/linux/generic/backport-6.6/780-42-v6.13-r8169-align-WAKE_PHY-handling-with-r8125-r8126-vendo.patch new file mode 100644 index 00000000000000..de86c2f6cd064e --- /dev/null +++ b/target/linux/generic/backport-6.6/780-42-v6.13-r8169-align-WAKE_PHY-handling-with-r8125-r8126-vendo.patch @@ -0,0 +1,29 @@ +From e3e9e9039fa6ae885c7d5c954d7b9f105fa23e8f Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Wed, 6 Nov 2024 17:57:08 +0100 +Subject: [PATCH] r8169: align WAKE_PHY handling with r8125/r8126 vendor + drivers + +Vendor drivers r8125/r8126 apply this additional magic setting when +enabling WAKE_PHY, so do the same here. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Link: https://patch.msgid.link/51130715-45be-4db5-abb7-05d87e1f5df9@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169_main.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -1563,6 +1563,9 @@ static void __rtl8169_set_wol(struct rtl + } + + r8169_mod_reg8_cond(tp, Config3, LinkUp, wolopts & WAKE_PHY); ++ if (rtl_is_8125(tp)) ++ r8168_mac_ocp_modify(tp, 0xe0c6, 0x3f, ++ wolopts & WAKE_PHY ? 0x13 : 0); + r8169_mod_reg8_cond(tp, Config5, UWF, wolopts & WAKE_UCAST); + r8169_mod_reg8_cond(tp, Config5, BWF, wolopts & WAKE_BCAST); + r8169_mod_reg8_cond(tp, Config5, MWF, wolopts & WAKE_MCAST); diff --git a/target/linux/generic/backport-6.6/780-43-v6.13-r8169-use-helper-r8169_mod_reg8_cond-to-simplify-rtl.patch b/target/linux/generic/backport-6.6/780-43-v6.13-r8169-use-helper-r8169_mod_reg8_cond-to-simplify-rtl.patch new file mode 100644 index 00000000000000..5bcf06098a88ee --- /dev/null +++ b/target/linux/generic/backport-6.6/780-43-v6.13-r8169-use-helper-r8169_mod_reg8_cond-to-simplify-rtl.patch @@ -0,0 +1,117 @@ +From 7a3bcd39ae1f0e3ab896d9df62339ab4297a0bfd Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Sat, 9 Nov 2024 23:12:12 +0100 +Subject: [PATCH] r8169: use helper r8169_mod_reg8_cond to simplify + rtl_jumbo_config + +Use recently added helper r8169_mod_reg8_cond() to simplify jumbo +mode configuration. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Link: https://patch.msgid.link/3df1d484-a02e-46e7-8f75-db5b428e422e@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169_main.c | 77 ++++------------------- + 1 file changed, 11 insertions(+), 66 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -2547,86 +2547,31 @@ static void rtl8169_init_ring_indexes(st + tp->dirty_tx = tp->cur_tx = tp->cur_rx = 0; + } + +-static void r8168c_hw_jumbo_enable(struct rtl8169_private *tp) +-{ +- RTL_W8(tp, Config3, RTL_R8(tp, Config3) | Jumbo_En0); +- RTL_W8(tp, Config4, RTL_R8(tp, Config4) | Jumbo_En1); +-} +- +-static void r8168c_hw_jumbo_disable(struct rtl8169_private *tp) +-{ +- RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Jumbo_En0); +- RTL_W8(tp, Config4, RTL_R8(tp, Config4) & ~Jumbo_En1); +-} +- +-static void r8168dp_hw_jumbo_enable(struct rtl8169_private *tp) +-{ +- RTL_W8(tp, Config3, RTL_R8(tp, Config3) | Jumbo_En0); +-} +- +-static void r8168dp_hw_jumbo_disable(struct rtl8169_private *tp) +-{ +- RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Jumbo_En0); +-} +- +-static void r8168e_hw_jumbo_enable(struct rtl8169_private *tp) +-{ +- RTL_W8(tp, MaxTxPacketSize, 0x24); +- RTL_W8(tp, Config3, RTL_R8(tp, Config3) | Jumbo_En0); +- RTL_W8(tp, Config4, RTL_R8(tp, Config4) | 0x01); +-} +- +-static void r8168e_hw_jumbo_disable(struct rtl8169_private *tp) +-{ +- RTL_W8(tp, MaxTxPacketSize, 0x3f); +- RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Jumbo_En0); +- RTL_W8(tp, Config4, RTL_R8(tp, Config4) & ~0x01); +-} +- +-static void r8168b_1_hw_jumbo_enable(struct rtl8169_private *tp) +-{ +- RTL_W8(tp, Config4, RTL_R8(tp, Config4) | (1 << 0)); +-} +- +-static void r8168b_1_hw_jumbo_disable(struct rtl8169_private *tp) +-{ +- RTL_W8(tp, Config4, RTL_R8(tp, Config4) & ~(1 << 0)); +-} +- + static void rtl_jumbo_config(struct rtl8169_private *tp) + { + bool jumbo = tp->dev->mtu > ETH_DATA_LEN; + int readrq = 4096; + ++ if (jumbo && tp->mac_version >= RTL_GIGA_MAC_VER_17 && ++ tp->mac_version <= RTL_GIGA_MAC_VER_26) ++ readrq = 512; ++ + rtl_unlock_config_regs(tp); + switch (tp->mac_version) { + case RTL_GIGA_MAC_VER_17: +- if (jumbo) { +- readrq = 512; +- r8168b_1_hw_jumbo_enable(tp); +- } else { +- r8168b_1_hw_jumbo_disable(tp); +- } ++ r8169_mod_reg8_cond(tp, Config4, BIT(0), jumbo); + break; + case RTL_GIGA_MAC_VER_18 ... RTL_GIGA_MAC_VER_26: +- if (jumbo) { +- readrq = 512; +- r8168c_hw_jumbo_enable(tp); +- } else { +- r8168c_hw_jumbo_disable(tp); +- } ++ r8169_mod_reg8_cond(tp, Config3, Jumbo_En0, jumbo); ++ r8169_mod_reg8_cond(tp, Config4, Jumbo_En1, jumbo); + break; + case RTL_GIGA_MAC_VER_28: +- if (jumbo) +- r8168dp_hw_jumbo_enable(tp); +- else +- r8168dp_hw_jumbo_disable(tp); ++ r8169_mod_reg8_cond(tp, Config3, Jumbo_En0, jumbo); + break; + case RTL_GIGA_MAC_VER_31 ... RTL_GIGA_MAC_VER_33: +- if (jumbo) +- r8168e_hw_jumbo_enable(tp); +- else +- r8168e_hw_jumbo_disable(tp); ++ RTL_W8(tp, MaxTxPacketSize, jumbo ? 0x24 : 0x3f); ++ r8169_mod_reg8_cond(tp, Config3, Jumbo_En0, jumbo); ++ r8169_mod_reg8_cond(tp, Config4, BIT(0), jumbo); + break; + default: + break; From 6ba1f831c7a20288eb0bf16767fc5a26f30cc8eb Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 4 Jan 2025 11:54:22 +0100 Subject: [PATCH 293/877] mt76: update to Git HEAD (2025-01-04) 35bcf68a6297 wifi: mt76: scan: fix setting tx_info fields 4d8d6e2e7710 wifi: mt76: scan: set vif offchannel link for scanning/roc e354436db440 wifi: mt76: mt7996: use the correct vif link for scanning/roc Signed-off-by: Felix Fietkau (cherry picked from commit f11bc4f201e3a4ffec8c1e2083124ebda60dd763) --- 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 d603b6215fd943..7bc030a9df3ce2 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:=2025-01-03 -PKG_SOURCE_VERSION:=959a2d40007f502d9465b8aede79e761f875abd3 -PKG_MIRROR_HASH:=a00a26a4685c053a639a95657804b09d0d4a1452744647871070beb6332b7c3a +PKG_SOURCE_DATE:=2025-01-04 +PKG_SOURCE_VERSION:=e354436db4402552bcb0cbe9abab2a46fb1ad31c +PKG_MIRROR_HASH:=7e3894e1f2641e172f87be1ae0cc6adda318d989350ebd53500a7df02f0afd8f PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 From 2f60e7f00629bb12b066c06fee6b67664776b475 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 4 Jan 2025 11:52:50 +0100 Subject: [PATCH 294/877] wifi-scripts: fix setting tx power on some drivers On some drivers, setting the tx power on the interface is not enough. Set it for the phy as well. Fixes: 04fb05914ea7 ("wifi-scripts: add multi-radio config support") Signed-off-by: Felix Fietkau (cherry picked from commit b795e5cbcffc54e858bc8d3bde0031a2ca32377e) --- .../wifi-scripts/files/lib/netifd/wireless/mac80211.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh index 5837f1c748fdea..42d7bc66d00282 100755 --- a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh +++ b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh @@ -1203,6 +1203,14 @@ drv_mac80211_setup() { wdev_tool "$phy$phy_suffix" set_config "$(json_dump)" $active_ifnames json_set_namespace "$prev" + [ -z "$phy_suffix" ] && { + if [ -n "$txpower" ]; then + iw phy "$phy" set txpower fixed "${txpower%%.*}00" + else + iw phy "$phy" set txpower auto + fi + } + for_each_interface "ap sta adhoc mesh monitor" mac80211_set_vif_txpower wireless_set_up } From 7a112661d5f0c35805392fdfd59574e023cd6f09 Mon Sep 17 00:00:00 2001 From: John Audia Date: Thu, 2 Jan 2025 07:50:26 -0500 Subject: [PATCH 295/877] bcm27xx/bcm2712: Fix-up RP1 modules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Correct a few mistakes around dependencies and naming and unset CONFIG_FIRMWARE_RP1 in RPi5B's config and instead of a builtin, build it as a module. Without this change, there are two entries for rp1.ko in /lib/modules/$(uname -r)/modules.builtin due to how we strip the leading directories when we generate it. See: package/kernel/linux/Makefile around line 63. % grep rp1.ko /lib/modules/$(uname -r)/modules.builtin pwm-rp1.ko clk-rp1.ko rp1.ko rp1.ko The kernel log gets spammed with tons of superfluous warnings as a results of the double entry: daemon.warn modprobe: found duplicate builtin module rp1 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/17461 Signed-off-by: Robert Marko Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit f105d1a9a9739267fb25612d039c392a397775bd) --- target/linux/bcm27xx/bcm2712/config-6.6 | 8 +-- target/linux/bcm27xx/modules/hwmon.mk | 19 +++++++ target/linux/bcm27xx/modules/other.mk | 70 ++++++++++++++++++++++++- target/linux/bcm27xx/modules/video.mk | 2 +- 4 files changed, 92 insertions(+), 7 deletions(-) diff --git a/target/linux/bcm27xx/bcm2712/config-6.6 b/target/linux/bcm27xx/bcm2712/config-6.6 index 9dac0688df3d11..749c569a541335 100644 --- a/target/linux/bcm27xx/bcm2712/config-6.6 +++ b/target/linux/bcm27xx/bcm2712/config-6.6 @@ -239,7 +239,7 @@ CONFIG_FB_DEVICE=y CONFIG_FB_IOMEM_FOPS=y CONFIG_FB_IOMEM_HELPERS=y CONFIG_FB_SIMPLE=y -CONFIG_FIRMWARE_RP1=y +# CONFIG_FIRMWARE_RP1 is not set CONFIG_FIXED_PHY=y CONFIG_FIX_EARLYCON_MEM=y CONFIG_FONT_8x16=y @@ -372,7 +372,7 @@ CONFIG_MAGIC_SYSRQ=y CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1f6 CONFIG_MAILBOX=y # CONFIG_MAILBOX_TEST is not set -CONFIG_MBOX_RP1=y +# CONFIG_MBOX_RP1 is not set CONFIG_MDIO_BCM_UNIMAC=y CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y @@ -537,7 +537,7 @@ CONFIG_RESET_RASPBERRYPI=y CONFIG_RESET_SIMPLE=y CONFIG_RFS_ACCEL=y CONFIG_RODATA_FULL_DEFAULT_ENABLED=y -CONFIG_RP1_PIO=y +# CONFIG_RP1_PIO is not set # CONFIG_RPI_POE_POWER is not set CONFIG_RPS=y CONFIG_RTC_CLASS=y @@ -550,7 +550,7 @@ CONFIG_SCSI_COMMON=y # CONFIG_SCSI_LOWLEVEL is not set # CONFIG_SCSI_PROC_FS is not set CONFIG_SENSORS_RASPBERRYPI_HWMON=y -CONFIG_SENSORS_RP1_ADC=y +# CONFIG_SENSORS_RP1_ADC is not set CONFIG_SERIAL_8250_BCM2835AUX=y CONFIG_SERIAL_8250_BCM7271=y # CONFIG_SERIAL_8250_DMA is not set diff --git a/target/linux/bcm27xx/modules/hwmon.mk b/target/linux/bcm27xx/modules/hwmon.mk index 0f1547cd4f802c..db8ba30f875a4d 100644 --- a/target/linux/bcm27xx/modules/hwmon.mk +++ b/target/linux/bcm27xx/modules/hwmon.mk @@ -2,6 +2,23 @@ # # Copyright (C) 2019 OpenWrt.org +define KernelPackage/rp1-adc + SUBMENU:=$(OTHER_MENU) + TITLE:=RP1 ADC and temperature sensor driver + KCONFIG:=CONFIG_SENSORS_RP1_ADC + FILES:=$(LINUX_DIR)/drivers/hwmon/rp1-adc.ko + AUTOLOAD:=$(call AutoLoad,21,rp1-adc) + DEPENDS:=@TARGET_bcm27xx_bcm2712 +endef + +define KernelPackage/rp1-adc/description + Kernel module for RP1 silicon providing ADC and + temperature monitoring. +endef + +$(eval $(call KernelPackage,rp1-adc)) + + define KernelPackage/hwmon-raspberrypi TITLE:=Raspberry Pi voltage monitor KCONFIG:=CONFIG_SENSORS_RASPBERRYPI_HWMON @@ -15,3 +32,5 @@ define KernelPackage/hwmon-raspberrypi/description endef $(eval $(call KernelPackage,hwmon-raspberrypi)) + + diff --git a/target/linux/bcm27xx/modules/other.mk b/target/linux/bcm27xx/modules/other.mk index 5a690007483971..099ce3ce14db88 100644 --- a/target/linux/bcm27xx/modules/other.mk +++ b/target/linux/bcm27xx/modules/other.mk @@ -55,13 +55,46 @@ endef $(eval $(call KernelPackage,smi-bcm2835-dev)) +define KernelPackage/rp1 + SUBMENU:=$(OTHER_MENU) + TITLE:=RP1 firmware + KCONFIG:=CONFIG_FIRMWARE_RP1 + FILES:=$(LINUX_DIR)/drivers/firmware/rp1.ko + AUTOLOAD:=$(call AutoLoad,21,rp1) + DEPENDS:=@TARGET_bcm27xx_bcm2712 +endef + +define KernelPackage/rp1/description + This driver provides a firmware interface to the RP1 processor using shared + memory and a mailbox. +endef + +$(eval $(call KernelPackage,rp1)) + + +define KernelPackage/rp1-pio + SUBMENU:=$(OTHER_MENU) + TITLE:=RP1 PIO block support + KCONFIG:=CONFIG_RP1_PIO + FILES:=$(LINUX_DIR)/drivers/misc/rp1-pio.ko + AUTOLOAD:=$(call AutoLoad,21,rp1-pio) + DEPENDS:=@TARGET_bcm27xx_bcm2712 +kmod-rp1 +endef + +define KernelPackage/rp1-pio/description + Driver providing control of the Raspberry Pi PIO block, as found in RP1 +endef + +$(eval $(call KernelPackage,rp1-pio)) + + define KernelPackage/pwm-pio-rp1 SUBMENU:=$(OTHER_MENU) TITLE:=RP1 PWM support KCONFIG:=CONFIG_PWM_PIO_RP1 FILES:=$(LINUX_DIR)/drivers/pwm/pwm-pio-rp1.ko AUTOLOAD:=$(call AutoLoad,21,pwm-pio-rp1) - DEPENDS:=@TARGET_bcm27xx_bcm2712 + DEPENDS:=@TARGET_bcm27xx_bcm2712 +kmod-rp1-pio endef define KernelPackage/pwm-pio-rp1/description @@ -80,7 +113,7 @@ define KernelPackage/ws2812-pio-rp1 KCONFIG:=CONFIG_WS2812_PIO_RP1 FILES:=$(LINUX_DIR)/drivers/misc/ws2812-pio-rp1.ko AUTOLOAD:=$(call AutoLoad,21,ws2812-pio-rp1) - DEPENDS:=@TARGET_bcm27xx_bcm2712 + DEPENDS:=@TARGET_bcm27xx_bcm2712 +kmod-rp1-pio endef define KernelPackage/ws2812-pio-rp1/description @@ -90,3 +123,36 @@ define KernelPackage/ws2812-pio-rp1/description endef $(eval $(call KernelPackage,ws2812-pio-rp1)) + + +define KernelPackage/rp1-mailbox + SUBMENU:=$(OTHER_MENU) + TITLE:=RP1 mailbox IPC driver + KCONFIG:=CONFIG_MBOX_RP1 + FILES:=$(LINUX_DIR)/drivers/mailbox/rp1-mailbox.ko + AUTOLOAD:=$(call AutoLoad,21,rp1-mailbox) + DEPENDS:=@TARGET_bcm27xx_bcm2712 +endef + +define KernelPackage/rp1-mailbox/description + This is a RP1 mailbox IPC driver. +endef + +$(eval $(call KernelPackage,rp1-mailbox)) + + +define KernelPackage/rp1-pio + SUBMENU:=$(OTHER_MENU) + TITLE:=RP1 PIO driver + KCONFIG:=CONFIG_RP1_PIO + FILES:=$(LINUX_DIR)/drivers/misc/rp1-pio.ko + AUTOLOAD:=$(call AutoLoad,21,rp1-pio) + DEPENDS:=@TARGET_bcm27xx_bcm2712 +kmod-rp1 +endef + +define KernelPackage/rp1-pio/description + Driver for the RP1 PIO. +endef + +$(eval $(call KernelPackage,rp1-pio)) + diff --git a/target/linux/bcm27xx/modules/video.mk b/target/linux/bcm27xx/modules/video.mk index 8e2b19bd871165..f8b39c71c4497c 100644 --- a/target/linux/bcm27xx/modules/video.mk +++ b/target/linux/bcm27xx/modules/video.mk @@ -156,7 +156,7 @@ define KernelPackage/drm-rp1-dpi CONFIG_DRM_TTM_HELPER=n FILES:=$(LINUX_DIR)/drivers/gpu/drm/rp1/rp1-dpi/drm-rp1-dpi.ko AUTOLOAD:=$(call AutoLoad,67,drm-rp1-dpi) - DEPENDS:=@TARGET_bcm27xx_bcm2712 +kmod-drm-vc4 + DEPENDS:=@TARGET_bcm27xx_bcm2712 +kmod-drm-vc4 +kmod-rp1-pio endef define KernelPackage/drm-rp1-dpi/description From 767ad6492139c151e22f7ef61f8d66f454cca849 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Mon, 23 Dec 2024 19:07:13 +0800 Subject: [PATCH 296/877] rockchip: backport recent rk3588 clk updates Backport recent rk3588 clk updates from upstream, including one bug fix. Signed-off-by: Tianling Shen Link: https://github.com/openwrt/openwrt/pull/17349 (cherry picked from commit 8ad02ca2f8477b1cfdc5ea6124fae60c07687aa1) Link: https://github.com/openwrt/openwrt/pull/17466 Signed-off-by: Hauke Mehrtens --- ...chip-Add-new-pll-type-pll_rk3588_ddr.patch | 51 +++++++++++++++ ...clk-rockchip-rk3588-drop-unused-code.patch | 65 +++++++++++++++++++ ...chip-fix-finding-of-maximum-clock-ID.patch | 29 +++++++++ 3 files changed, 145 insertions(+) create mode 100644 target/linux/rockchip/patches-6.6/030-09-v6.12-clk-rockchip-Add-new-pll-type-pll_rk3588_ddr.patch create mode 100644 target/linux/rockchip/patches-6.6/030-10-v6.12-clk-rockchip-rk3588-drop-unused-code.patch create mode 100644 target/linux/rockchip/patches-6.6/030-11-v6.13-clk-rockchip-fix-finding-of-maximum-clock-ID.patch diff --git a/target/linux/rockchip/patches-6.6/030-09-v6.12-clk-rockchip-Add-new-pll-type-pll_rk3588_ddr.patch b/target/linux/rockchip/patches-6.6/030-09-v6.12-clk-rockchip-Add-new-pll-type-pll_rk3588_ddr.patch new file mode 100644 index 00000000000000..0d68f687faf8d1 --- /dev/null +++ b/target/linux/rockchip/patches-6.6/030-09-v6.12-clk-rockchip-Add-new-pll-type-pll_rk3588_ddr.patch @@ -0,0 +1,51 @@ +From e781bffc296766b55dbd048890d558655031e8d1 Mon Sep 17 00:00:00 2001 +From: Elaine Zhang +Date: Wed, 28 Aug 2024 15:42:52 +0000 +Subject: [PATCH] clk: rockchip: Add new pll type pll_rk3588_ddr + +That PLL type is similar to the other rk3588 pll types but the actual +rate is twice the configured rate. +Therefore, the returned calculated rate must be multiplied by two. + +Signed-off-by: Elaine Zhang +Signed-off-by: Detlev Casanova +Acked-by: Dragan Simic +Link: https://lore.kernel.org/r/0102019199a76ec4-9d5846d4-d76a-4e69-a241-c88c2983d607-000000@eu-west-1.amazonses.com +Signed-off-by: Heiko Stuebner +--- + drivers/clk/rockchip/clk-pll.c | 6 +++++- + drivers/clk/rockchip/clk.h | 1 + + 2 files changed, 6 insertions(+), 1 deletion(-) + +--- a/drivers/clk/rockchip/clk-pll.c ++++ b/drivers/clk/rockchip/clk-pll.c +@@ -914,7 +914,10 @@ static unsigned long rockchip_rk3588_pll + } + rate64 = rate64 >> cur.s; + +- return (unsigned long)rate64; ++ if (pll->type == pll_rk3588_ddr) ++ return (unsigned long)rate64 * 2; ++ else ++ return (unsigned long)rate64; + } + + static int rockchip_rk3588_pll_set_params(struct rockchip_clk_pll *pll, +@@ -1167,6 +1170,7 @@ struct clk *rockchip_clk_register_pll(st + break; + case pll_rk3588: + case pll_rk3588_core: ++ case pll_rk3588_ddr: + if (!pll->rate_table) + init.ops = &rockchip_rk3588_pll_clk_norate_ops; + else +--- a/drivers/clk/rockchip/clk.h ++++ b/drivers/clk/rockchip/clk.h +@@ -287,6 +287,7 @@ enum rockchip_pll_type { + pll_rk3399, + pll_rk3588, + pll_rk3588_core, ++ pll_rk3588_ddr, + }; + + #define RK3036_PLL_RATE(_rate, _refdiv, _fbdiv, _postdiv1, \ diff --git a/target/linux/rockchip/patches-6.6/030-10-v6.12-clk-rockchip-rk3588-drop-unused-code.patch b/target/linux/rockchip/patches-6.6/030-10-v6.12-clk-rockchip-rk3588-drop-unused-code.patch new file mode 100644 index 00000000000000..0164bf26e579cc --- /dev/null +++ b/target/linux/rockchip/patches-6.6/030-10-v6.12-clk-rockchip-rk3588-drop-unused-code.patch @@ -0,0 +1,65 @@ +From 2e7b3daa8cb1ebd17e6a7f417ef5e6553203035c Mon Sep 17 00:00:00 2001 +From: Sebastian Reichel +Date: Mon, 25 Mar 2024 20:33:32 +0100 +Subject: [PATCH] clk: rockchip: rk3588: drop unused code + +All clocks are registered early using CLK_OF_DECLARE(), which marks +the DT node as processed. For the processed DT node the probe routine +is never called. Thus this whole code is never executed. This could +be "fixed" by using CLK_OF_DECLARE_DRIVER, which avoids marking the +DT node as processed. But then the probe routine would re-register +all the clocks by calling rk3588_clk_init() again. + +Signed-off-by: Sebastian Reichel +Link: https://lore.kernel.org/r/20240325193609.237182-2-sebastian.reichel@collabora.com +Signed-off-by: Heiko Stuebner +--- + drivers/clk/rockchip/clk-rk3588.c | 40 ------------------------------- + 1 file changed, 40 deletions(-) + +--- a/drivers/clk/rockchip/clk-rk3588.c ++++ b/drivers/clk/rockchip/clk-rk3588.c +@@ -2502,43 +2502,3 @@ static void __init rk3588_clk_init(struc + } + + CLK_OF_DECLARE(rk3588_cru, "rockchip,rk3588-cru", rk3588_clk_init); +- +-struct clk_rk3588_inits { +- void (*inits)(struct device_node *np); +-}; +- +-static const struct clk_rk3588_inits clk_3588_cru_init = { +- .inits = rk3588_clk_init, +-}; +- +-static const struct of_device_id clk_rk3588_match_table[] = { +- { +- .compatible = "rockchip,rk3588-cru", +- .data = &clk_3588_cru_init, +- }, +- { } +-}; +- +-static int __init clk_rk3588_probe(struct platform_device *pdev) +-{ +- const struct clk_rk3588_inits *init_data; +- struct device *dev = &pdev->dev; +- +- init_data = device_get_match_data(dev); +- if (!init_data) +- return -EINVAL; +- +- if (init_data->inits) +- init_data->inits(dev->of_node); +- +- return 0; +-} +- +-static struct platform_driver clk_rk3588_driver = { +- .driver = { +- .name = "clk-rk3588", +- .of_match_table = clk_rk3588_match_table, +- .suppress_bind_attrs = true, +- }, +-}; +-builtin_platform_driver_probe(clk_rk3588_driver, clk_rk3588_probe); diff --git a/target/linux/rockchip/patches-6.6/030-11-v6.13-clk-rockchip-fix-finding-of-maximum-clock-ID.patch b/target/linux/rockchip/patches-6.6/030-11-v6.13-clk-rockchip-fix-finding-of-maximum-clock-ID.patch new file mode 100644 index 00000000000000..912c2c77780bf0 --- /dev/null +++ b/target/linux/rockchip/patches-6.6/030-11-v6.13-clk-rockchip-fix-finding-of-maximum-clock-ID.patch @@ -0,0 +1,29 @@ +From ad1081a0da2744141d12e94ff816ac91feb871ca Mon Sep 17 00:00:00 2001 +From: Yao Zi +Date: Thu, 12 Sep 2024 13:32:05 +0000 +Subject: [PATCH] clk: rockchip: fix finding of maximum clock ID + +If an ID of a branch's child is greater than current maximum, we should +set new maximum to the child's ID, instead of its parent's. + +Fixes: 2dc66a5ab2c6 ("clk: rockchip: rk3588: fix CLK_NR_CLKS usage") +Signed-off-by: Yao Zi +Link: https://lore.kernel.org/r/20240912133204.29089-2-ziyao@disroot.org +Reviewed-by: Sebastian Reichel +Reviewed-by: Heiko Stuebner +Signed-off-by: Stephen Boyd +--- + drivers/clk/rockchip/clk.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/clk/rockchip/clk.c ++++ b/drivers/clk/rockchip/clk.c +@@ -439,7 +439,7 @@ unsigned long rockchip_clk_find_max_clk_ + if (list->id > max) + max = list->id; + if (list->child && list->child->id > max) +- max = list->id; ++ max = list->child->id; + } + + return max; From 096e3f26efd880dca202422804124e10dbffd648 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Mon, 23 Dec 2024 21:13:24 +0800 Subject: [PATCH 297/877] rockchip: enable USB3 port on NanoPC T6 Enable the USB3 port on FriendlyELEC NanoPC-T6. Signed-off-by: Tianling Shen Link: https://github.com/openwrt/openwrt/pull/17349 (cherry picked from commit 6881b48dc603e25320a14e11c5e1797321891b76) Link: https://github.com/openwrt/openwrt/pull/17466 Signed-off-by: Hauke Mehrtens --- ...ts-rockchip-enable-USB3-on-NanoPC-T6.patch | 87 +++++++++++++++++++ ...ckchip-lower-mmc-speed-for-nanopc-t6.patch | 2 +- 2 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 target/linux/rockchip/patches-6.6/055-16-v6.13-arm64-dts-rockchip-enable-USB3-on-NanoPC-T6.patch diff --git a/target/linux/rockchip/patches-6.6/055-16-v6.13-arm64-dts-rockchip-enable-USB3-on-NanoPC-T6.patch b/target/linux/rockchip/patches-6.6/055-16-v6.13-arm64-dts-rockchip-enable-USB3-on-NanoPC-T6.patch new file mode 100644 index 00000000000000..d3aa8b9cc3e346 --- /dev/null +++ b/target/linux/rockchip/patches-6.6/055-16-v6.13-arm64-dts-rockchip-enable-USB3-on-NanoPC-T6.patch @@ -0,0 +1,87 @@ +From a6ae420439dc47a58550a6e61e596e9dd1562caf Mon Sep 17 00:00:00 2001 +From: Rick Wertenbroek +Date: Wed, 6 Nov 2024 14:03:13 +0100 +Subject: [PATCH] arm64: dts: rockchip: enable USB3 on NanoPC-T6 + +Enable the USB3 port on FriendlyELEC NanoPC-T6. + +Signed-off-by: Rick Wertenbroek +Link: https://lore.kernel.org/r/20241106130314.1289055-1-rick.wertenbroek@gmail.com +Signed-off-by: Heiko Stuebner +--- + .../boot/dts/rockchip/rk3588-nanopc-t6.dtsi | 36 +++++++++++++++++++ + 1 file changed, 36 insertions(+) + +--- a/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi +@@ -160,6 +160,20 @@ + vin-supply = <&vcc5v0_sys>; + }; + ++ vbus5v0_usb: vbus5v0-usb-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio4 RK_PB0 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&usb5v_pwren>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-name = "vbus5v0_usb"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ vin-supply = <&vcc5v0_sys>; ++ }; ++ + vcc3v3_pcie2x1l0: vcc3v3-pcie2x1l0-regulator { + compatible = "regulator-fixed"; + enable-active-high; +@@ -577,6 +591,10 @@ + rockchip,pins = <1 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + ++ usb5v_pwren: usb5v_pwren { ++ rockchip,pins = <4 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ + usbc0_int: usbc0-int { + rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO &pcfg_pull_up>; + }; +@@ -976,6 +994,14 @@ + status = "okay"; + }; + ++&u2phy1 { ++ status = "okay"; ++}; ++ ++&u2phy1_otg { ++ status = "okay"; ++}; ++ + &u2phy2_host { + status = "okay"; + }; +@@ -1015,6 +1041,11 @@ + }; + }; + ++&usbdp_phy1 { ++ phy-supply = <&vbus5v0_usb>; ++ status = "okay"; ++}; ++ + &usb_host0_ehci { + status = "okay"; + }; +@@ -1035,6 +1066,11 @@ + }; + }; + ++&usb_host1_xhci { ++ dr_mode = "host"; ++ status = "okay"; ++}; ++ + &usb_host1_ehci { + status = "okay"; + }; diff --git a/target/linux/rockchip/patches-6.6/121-arm64-dts-rockchip-lower-mmc-speed-for-nanopc-t6.patch b/target/linux/rockchip/patches-6.6/121-arm64-dts-rockchip-lower-mmc-speed-for-nanopc-t6.patch index bbcff0179068bb..1b76fac103a7d5 100644 --- a/target/linux/rockchip/patches-6.6/121-arm64-dts-rockchip-lower-mmc-speed-for-nanopc-t6.patch +++ b/target/linux/rockchip/patches-6.6/121-arm64-dts-rockchip-lower-mmc-speed-for-nanopc-t6.patch @@ -1,6 +1,6 @@ --- a/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi -@@ -616,7 +616,7 @@ +@@ -634,7 +634,7 @@ disable-wp; no-mmc; no-sdio; From fe8812ab967f03498b689fd5ece5b2cea03659dc Mon Sep 17 00:00:00 2001 From: John Audia Date: Sat, 4 Jan 2025 16:36:20 +0100 Subject: [PATCH 298/877] bcm27xx: remove duplicated kmod-rp1-pio package MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit f105d1a9a9739267fb25612d039c392a397775bd added a duplicated kmod-rp1-pio package. Also remove unneeded blank lines added by the same commit. Fixes: f105d1a9a973 ("bcm27xx/bcm2712: Fix-up RP1 modules") Signed-off-by: John Audia Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit d5669c040beb0fa29e6916049941f0e76ce07460) --- target/linux/bcm27xx/modules/hwmon.mk | 2 -- target/linux/bcm27xx/modules/other.mk | 17 ----------------- 2 files changed, 19 deletions(-) diff --git a/target/linux/bcm27xx/modules/hwmon.mk b/target/linux/bcm27xx/modules/hwmon.mk index db8ba30f875a4d..320b11708f9221 100644 --- a/target/linux/bcm27xx/modules/hwmon.mk +++ b/target/linux/bcm27xx/modules/hwmon.mk @@ -32,5 +32,3 @@ define KernelPackage/hwmon-raspberrypi/description endef $(eval $(call KernelPackage,hwmon-raspberrypi)) - - diff --git a/target/linux/bcm27xx/modules/other.mk b/target/linux/bcm27xx/modules/other.mk index 099ce3ce14db88..7ec35c95f0b21c 100644 --- a/target/linux/bcm27xx/modules/other.mk +++ b/target/linux/bcm27xx/modules/other.mk @@ -139,20 +139,3 @@ define KernelPackage/rp1-mailbox/description endef $(eval $(call KernelPackage,rp1-mailbox)) - - -define KernelPackage/rp1-pio - SUBMENU:=$(OTHER_MENU) - TITLE:=RP1 PIO driver - KCONFIG:=CONFIG_RP1_PIO - FILES:=$(LINUX_DIR)/drivers/misc/rp1-pio.ko - AUTOLOAD:=$(call AutoLoad,21,rp1-pio) - DEPENDS:=@TARGET_bcm27xx_bcm2712 +kmod-rp1 -endef - -define KernelPackage/rp1-pio/description - Driver for the RP1 PIO. -endef - -$(eval $(call KernelPackage,rp1-pio)) - From cc733e7e2a2da29ca90fba8ca91bb3752a6c9b65 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 25 Dec 2024 20:33:23 +0800 Subject: [PATCH 299/877] ramips: mt762{0,8}: reduce default MMC clock to 24 MHz The upstream mtk-sd driver did not perform specific timing optimization for MT762x series SoC, hence the SDHC peripheral of some boards cannot run at too high frequency. Reduce the maximum clock frequency to fix the mmc read/write error. Closes: https://github.com/openwrt/openwrt/issues/17364 Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17375 Signed-off-by: Hauke Mehrtens (cherry picked from commit de0c143742517d401c4730137f092be8fb7e882a) --- target/linux/ramips/dts/mt7620a.dtsi | 2 +- target/linux/ramips/dts/mt7620a_hiwifi_hc5861.dts | 4 ---- target/linux/ramips/dts/mt7628an.dtsi | 2 +- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/target/linux/ramips/dts/mt7620a.dtsi b/target/linux/ramips/dts/mt7620a.dtsi index 93b4286193a8e1..0555674802c0a3 100644 --- a/target/linux/ramips/dts/mt7620a.dtsi +++ b/target/linux/ramips/dts/mt7620a.dtsi @@ -540,7 +540,7 @@ interrupt-parent = <&intc>; interrupts = <14>; - max-frequency = <48000000>; + max-frequency = <24000000>; pinctrl-names = "default", "state_uhs"; pinctrl-0 = <&sdhci_pins>; diff --git a/target/linux/ramips/dts/mt7620a_hiwifi_hc5861.dts b/target/linux/ramips/dts/mt7620a_hiwifi_hc5861.dts index 29aff9958a8797..2cb7017972e206 100644 --- a/target/linux/ramips/dts/mt7620a_hiwifi_hc5861.dts +++ b/target/linux/ramips/dts/mt7620a_hiwifi_hc5861.dts @@ -108,10 +108,6 @@ }; }; -&sdhci { - max-frequency = <24000000>; -}; - &wmac { pinctrl-names = "default", "pa_gpio"; pinctrl-0 = <&pa_pins>; diff --git a/target/linux/ramips/dts/mt7628an.dtsi b/target/linux/ramips/dts/mt7628an.dtsi index 239211b1e18bf3..79763332b8bf58 100644 --- a/target/linux/ramips/dts/mt7628an.dtsi +++ b/target/linux/ramips/dts/mt7628an.dtsi @@ -394,7 +394,7 @@ interrupt-parent = <&intc>; interrupts = <14>; - max-frequency = <48000000>; + max-frequency = <24000000>; pinctrl-names = "default", "state_uhs"; pinctrl-0 = <&sdxc_pins>; From 4d9b06c571e201287817ab7af2500469b9ca7621 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sat, 13 Jul 2024 11:32:45 +0800 Subject: [PATCH 300/877] ramips: mmc-mtk: add more vendor driver register init values In the MTK vendor driver, mt762x SDXC registers MSDC_PATCH_BIT and MSDC_PATCH_BIT1 have different init values than upstream driver. These magical values should have some help for the stability. Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17446 Signed-off-by: Hauke Mehrtens (cherry picked from commit f70cdfd682a87c9de942f9251fb5a0caaf43f7cf) --- ...tialize-pad-delay-and-drive-strength.patch | 53 +++++++++++++++---- 1 file changed, 44 insertions(+), 9 deletions(-) diff --git a/target/linux/ramips/patches-6.6/831-mmc-mtk-sd-initialize-pad-delay-and-drive-strength.patch b/target/linux/ramips/patches-6.6/831-mmc-mtk-sd-initialize-pad-delay-and-drive-strength.patch index 1d5c6dcd40cc0a..c3d13932ef33a3 100644 --- a/target/linux/ramips/patches-6.6/831-mmc-mtk-sd-initialize-pad-delay-and-drive-strength.patch +++ b/target/linux/ramips/patches-6.6/831-mmc-mtk-sd-initialize-pad-delay-and-drive-strength.patch @@ -4,6 +4,8 @@ Subject: [PATCH] mmc: mtk-sd: initialize the pad and tune registers Signed-off-by: Shiji Yang --- + drivers/mmc/host/mtk-sd.c | 26 +++++++++++++++++++++++--- + 1 file changed, 23 insertions(+), 3 deletions(-) --- a/drivers/mmc/host/mtk-sd.c +++ b/drivers/mmc/host/mtk-sd.c @@ -20,19 +22,52 @@ Signed-off-by: Shiji Yang #define PAD_DS_TUNE 0x188 #define PAD_CMD_TUNE 0x18c #define EMMC51_CFG0 0x204 -@@ -1795,6 +1799,16 @@ static void msdc_init_hw(struct msdc_hos +@@ -400,6 +404,7 @@ struct mtk_mmc_compatible { + bool enhance_rx; + bool support_64g; + bool use_internal_cd; ++ bool legacy_mt762x; /* for mt7620, mt7621 and mt76x8 */ + }; + + struct msdc_tune_para { +@@ -537,6 +542,7 @@ static const struct mtk_mmc_compatible m + .stop_clk_fix = false, + .enhance_rx = false, + .use_internal_cd = true, ++ .legacy_mt762x = true, + }; + + static const struct mtk_mmc_compatible mt7622_compat = { +@@ -1729,9 +1735,11 @@ static void msdc_init_hw(struct msdc_hos + } + writel(0, host->base + MSDC_IOCON); + sdr_set_field(host->base + MSDC_IOCON, MSDC_IOCON_DDLSEL, 0); +- writel(0x403c0046, host->base + MSDC_PATCH_BIT); +- sdr_set_field(host->base + MSDC_PATCH_BIT, MSDC_CKGEN_MSDC_DLY_SEL, 1); +- writel(0xffff4089, host->base + MSDC_PATCH_BIT1); ++ if(!host->dev_comp->legacy_mt762x) { ++ writel(0x403c0046, host->base + MSDC_PATCH_BIT); ++ sdr_set_field(host->base + MSDC_PATCH_BIT, MSDC_CKGEN_MSDC_DLY_SEL, 1); ++ writel(0xffff4089, host->base + MSDC_PATCH_BIT1); ++ } + sdr_set_bits(host->base + EMMC50_CFG0, EMMC50_CFG_CFCSTS_SEL); + + if (host->dev_comp->stop_clk_fix) { +@@ -1795,6 +1803,18 @@ static void msdc_init_hw(struct msdc_hos MSDC_PAD_TUNE_RXDLYSEL); } -+ /* Set pins drive strength */ -+ writel(0x000d0044, host->base + MSDC_PAD_CTRL0); -+ writel(0x000e0044, host->base + MSDC_PAD_CTRL1); -+ writel(0x000e0044, host->base + MSDC_PAD_CTRL2); ++ if (host->dev_comp->legacy_mt762x) { ++ /* Set pins drive strength */ ++ writel(0x000d0044, host->base + MSDC_PAD_CTRL0); ++ writel(0x000e0044, host->base + MSDC_PAD_CTRL1); ++ writel(0x000e0044, host->base + MSDC_PAD_CTRL2); + -+ /* Set pad delay */ -+ writel(0x84101010, host->base + MSDC_PAD_TUNE); -+ writel(0x10101010, host->base + MSDC_PAD_TUNE0); -+ writel(0x10101010, host->base + MSDC_PAD_TUNE1); ++ /* Set pad delay */ ++ writel(0x84101010, host->base + MSDC_PAD_TUNE); ++ writel(0x10101010, host->base + MSDC_PAD_TUNE0); ++ writel(0x10101010, host->base + MSDC_PAD_TUNE1); ++ } + if (mmc->caps2 & MMC_CAP2_NO_SDIO) { sdr_clr_bits(host->base + SDC_CFG, SDC_CFG_SDIO); From f81f707c0595bb990ea579a7edd4dd0d2723ba0b Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 1 Jan 2025 16:06:38 +0800 Subject: [PATCH 301/877] ramips: add back SDXC card reader support for HiWiFi HC5x61A After adding the correct package and pin group configurations, the SDXC card slot can now function properly. Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17446 Signed-off-by: Hauke Mehrtens (cherry picked from commit cea4aae0a921d71407d11957502f8cc3b652be21) --- .../ramips/dts/mt7628an_hiwifi_hc5661a.dts | 20 ++++++++++++++++++- .../ramips/dts/mt7628an_hiwifi_hc5761a.dts | 18 ++++++++++++++++- target/linux/ramips/image/mt76x8.mk | 3 ++- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/target/linux/ramips/dts/mt7628an_hiwifi_hc5661a.dts b/target/linux/ramips/dts/mt7628an_hiwifi_hc5661a.dts index 9e4068ce8c7241..52cd3afac89a3f 100644 --- a/target/linux/ramips/dts/mt7628an_hiwifi_hc5661a.dts +++ b/target/linux/ramips/dts/mt7628an_hiwifi_hc5661a.dts @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + #include "mt7628an_hiwifi_hc5x61a.dtsi" / { @@ -25,9 +27,25 @@ }; }; +&pinctrl { + ephy-analog; + + sdxc_router_mode: sdxc_router_mode { + groups = "esd", "gpio", "i2c", "sdmode", "uart1"; + function = "gpio"; + }; +}; + +&sdhci { + status = "okay"; + + pinctrl-0 = <&sdxc_router_mode>; + pinctrl-1 = <&sdxc_router_mode>; +}; + &state_default { gpio { - groups = "i2c", "refclk", "wdt", "wled_an"; + groups = "i2s", "refclk", "wdt", "wled_an"; function = "gpio"; }; }; diff --git a/target/linux/ramips/dts/mt7628an_hiwifi_hc5761a.dts b/target/linux/ramips/dts/mt7628an_hiwifi_hc5761a.dts index 5ec041c8048e98..940df6e19a7a8b 100644 --- a/target/linux/ramips/dts/mt7628an_hiwifi_hc5761a.dts +++ b/target/linux/ramips/dts/mt7628an_hiwifi_hc5761a.dts @@ -44,9 +44,25 @@ }; }; +&pinctrl { + ephy-analog; + + sdxc_router_mode: sdxc_router_mode { + groups = "esd", "gpio", "i2c", "sdmode", "uart1"; + function = "gpio"; + }; +}; + +&sdhci { + status = "okay"; + + pinctrl-0 = <&sdxc_router_mode>; + pinctrl-1 = <&sdxc_router_mode>; +}; + &state_default { gpio { - groups = "i2c", "refclk", "wdt", "p2led_an", "p3led_an", "wled_an"; + groups = "i2s", "refclk", "wdt", "p2led_an", "p3led_an", "wled_an"; function = "gpio"; }; }; diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk index 7e343bf0164fb0..953dfeb50f91d5 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -289,6 +289,7 @@ define Device/hiwifi_hc5661a IMAGE_SIZE := 15808k DEVICE_VENDOR := HiWiFi DEVICE_MODEL := HC5661A + DEVICE_PACKAGES := kmod-mmc-mtk SUPPORTED_DEVICES += hc5661a endef TARGET_DEVICES += hiwifi_hc5661a @@ -297,7 +298,7 @@ define Device/hiwifi_hc5761a IMAGE_SIZE := 15808k DEVICE_VENDOR := HiWiFi DEVICE_MODEL := HC5761A - DEVICE_PACKAGES := kmod-mt76x0e kmod-usb2 kmod-usb-ohci + DEVICE_PACKAGES := kmod-mmc-mtk kmod-mt76x0e kmod-usb2 kmod-usb-ohci endef TARGET_DEVICES += hiwifi_hc5761a From f311c9754c359736481ac2a3285ba16352da46d8 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 1 Jan 2025 16:16:29 +0800 Subject: [PATCH 302/877] ramips: fix SDXC function for mt76x8 one eth port devices There are only 5 devices in mt76x8 sub-target selected the MTK SDXC driver package. And they are all single ethernet port routers or dev boards: * LinkIt Smart 7688 * Onion Omega2+ * RAVPower RP-WD009 * VoCore VoCore2 * VoCore VoCore2-Lite For these devices, they are using the ephy p1 - p4 as the SDXC IO pins. Therefore, these GPIO pads must be configured in "digital" IO mode. Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17446 Signed-off-by: Hauke Mehrtens (cherry picked from commit f5996ae947c88461029060d74ace6a85a30dd9fd) --- .../mt7628an_mediatek_linkit-smart-7688.dts | 19 +++++++++++++++ .../ramips/dts/mt7628an_onion_omega2.dtsi | 19 +++++++++++++++ .../ramips/dts/mt7628an_ravpower_rp-wd009.dts | 19 +++++++++++++++ .../ramips/dts/mt7628an_vocore_vocore2.dtsi | 23 +++++++++++++++++++ 4 files changed, 80 insertions(+) diff --git a/target/linux/ramips/dts/mt7628an_mediatek_linkit-smart-7688.dts b/target/linux/ramips/dts/mt7628an_mediatek_linkit-smart-7688.dts index 34ef15eca0b722..fab70dc7b7fc9b 100644 --- a/target/linux/ramips/dts/mt7628an_mediatek_linkit-smart-7688.dts +++ b/target/linux/ramips/dts/mt7628an_mediatek_linkit-smart-7688.dts @@ -168,8 +168,27 @@ nvmem-cell-names = "mac-address"; }; +&pinctrl { + ephy-digital; + + sdxc_iot_mode: sdxc_iot_mode { + esd { + groups = "esd"; + function = "iot"; + }; + + sdxc { + groups = "sdmode"; + function = "sdxc"; + }; + }; +}; + &sdhci { status = "okay"; + + pinctrl-0 = <&sdxc_iot_mode>; + pinctrl-1 = <&sdxc_iot_mode>; cd-inverted; }; diff --git a/target/linux/ramips/dts/mt7628an_onion_omega2.dtsi b/target/linux/ramips/dts/mt7628an_onion_omega2.dtsi index d279cbcfb8e81a..2d45e0385f125b 100644 --- a/target/linux/ramips/dts/mt7628an_onion_omega2.dtsi +++ b/target/linux/ramips/dts/mt7628an_onion_omega2.dtsi @@ -170,8 +170,27 @@ nvmem-cell-names = "mac-address"; }; +&pinctrl { + ephy-digital; + + sdxc_iot_mode: sdxc_iot_mode { + esd { + groups = "esd"; + function = "iot"; + }; + + sdxc { + groups = "sdmode"; + function = "sdxc"; + }; + }; +}; + &sdhci { status = "okay"; + + pinctrl-0 = <&sdxc_iot_mode>; + pinctrl-1 = <&sdxc_iot_mode>; }; &wmac { diff --git a/target/linux/ramips/dts/mt7628an_ravpower_rp-wd009.dts b/target/linux/ramips/dts/mt7628an_ravpower_rp-wd009.dts index 607787f68e13fd..71c77d7ae671a0 100644 --- a/target/linux/ramips/dts/mt7628an_ravpower_rp-wd009.dts +++ b/target/linux/ramips/dts/mt7628an_ravpower_rp-wd009.dts @@ -84,6 +84,22 @@ }; }; +&pinctrl { + ephy-digital; + + sdxc_iot_mode: sdxc_iot_mode { + esd { + groups = "esd"; + function = "iot"; + }; + + sdxc { + groups = "sdmode"; + function = "sdxc"; + }; + }; +}; + &state_default { gpio { groups = "uart1", "wled_an", "p0led_an", "p2led_an", "p3led_an", @@ -94,6 +110,9 @@ &sdhci { status = "okay"; + + pinctrl-0 = <&sdxc_iot_mode>; + pinctrl-1 = <&sdxc_iot_mode>; }; &i2c { diff --git a/target/linux/ramips/dts/mt7628an_vocore_vocore2.dtsi b/target/linux/ramips/dts/mt7628an_vocore_vocore2.dtsi index 4982d8bccc9d7e..da2026ec7d30c3 100644 --- a/target/linux/ramips/dts/mt7628an_vocore_vocore2.dtsi +++ b/target/linux/ramips/dts/mt7628an_vocore_vocore2.dtsi @@ -68,6 +68,22 @@ }; }; +&pinctrl { + ephy-digital; + + sdxc_iot_mode: sdxc_iot_mode { + esd { + groups = "esd"; + function = "iot"; + }; + + sdxc { + groups = "sdmode"; + function = "sdxc"; + }; + }; +}; + &state_default { gpio { groups = "wled_an", "refclk", "wdt"; @@ -75,6 +91,13 @@ }; }; +&sdhci { + status = "okay"; + + pinctrl-0 = <&sdxc_iot_mode>; + pinctrl-1 = <&sdxc_iot_mode>; +}; + &wmac { status = "okay"; From 09378395cd9322fa80974488c4a616257f9582be Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 1 Jan 2025 16:17:08 +0800 Subject: [PATCH 303/877] ramips: make package kmod-sdhci-mt7620 conflict with kmod-mmc-mtk These two packages are SDXC drivers for Mediatek mt762x series SoCs. One is upstream implementation, and the other is downstream driver. Installing them together will result in conflicts. Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17446 Signed-off-by: Hauke Mehrtens (cherry picked from commit 0764e3008228bbdafb5e4a9837fe9efec7e138a0) --- target/linux/ramips/modules.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ramips/modules.mk b/target/linux/ramips/modules.mk index ced479dc93e9cb..175ba94eff988b 100644 --- a/target/linux/ramips/modules.mk +++ b/target/linux/ramips/modules.mk @@ -47,6 +47,7 @@ $(eval $(call KernelPackage,pwm-mediatek-ramips)) define KernelPackage/sdhci-mt7620 SUBMENU:=Other modules TITLE:=MT7620 SDCI + CONFLICTS:=kmod-mmc-mtk DEPENDS:=@(TARGET_ramips_mt7620||TARGET_ramips_mt76x8||TARGET_ramips_mt7621) +kmod-mmc KCONFIG:= \ CONFIG_MTK_MMC \ From 976bfe61e0dbec27fd103b531a32d6853cba3ba4 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 1 Jan 2025 16:17:53 +0800 Subject: [PATCH 304/877] ramips: mtk-mmc: remove nt76x8 pinctrl hack Now we can set the mt76x8 SDXC pinmux in device tree. Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17446 Signed-off-by: Hauke Mehrtens (cherry picked from commit b4a9f85c1394f13806fc2f51f5f6f23494773d7e) --- target/linux/ramips/files/drivers/mmc/host/mtk-mmc/sd.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/target/linux/ramips/files/drivers/mmc/host/mtk-mmc/sd.c b/target/linux/ramips/files/drivers/mmc/host/mtk-mmc/sd.c index df95900a26ed27..a9c242bfd36840 100644 --- a/target/linux/ramips/files/drivers/mmc/host/mtk-mmc/sd.c +++ b/target/linux/ramips/files/drivers/mmc/host/mtk-mmc/sd.c @@ -2210,12 +2210,6 @@ static int msdc_drv_probe(struct platform_device *pdev) struct msdc_hw *hw; int ret; - //FIXME: this should be done by pinconf and not by the sd driver - if ((ralink_soc == MT762X_SOC_MT7688 || - ralink_soc == MT762X_SOC_MT7628AN) && - (!(rt_sysc_r32(0x60) & BIT(15)))) - rt_sysc_m32(0xf << 17, 0xf << 17, 0x3c); - hw = &msdc0_hw; if (of_property_read_bool(pdev->dev.of_node, "mtk,wp-en")) From d543a9ae66b81d6d4f5ca9908087c8412f4ce026 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sun, 22 Dec 2024 00:30:43 +0800 Subject: [PATCH 305/877] uboot-mediatek: fix Routerich AX3000 support patch It seems that the original patch has been manually modified. The newly added line number is incorrect. Fixes: c0581520b1c5 ("uboot-mediatek: add Routerich AX3000 support") Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17338 Signed-off-by: Hauke Mehrtens (cherry picked from commit 9f97e39a9336e279be7ea1c00c4221ec3f448457) --- .../boot/uboot-mediatek/patches/460-add-routerich-ax3000.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/boot/uboot-mediatek/patches/460-add-routerich-ax3000.patch b/package/boot/uboot-mediatek/patches/460-add-routerich-ax3000.patch index 9aa31843deaa06..f33ca076330d1c 100644 --- a/package/boot/uboot-mediatek/patches/460-add-routerich-ax3000.patch +++ b/package/boot/uboot-mediatek/patches/460-add-routerich-ax3000.patch @@ -1,6 +1,6 @@ --- /dev/null +++ b/configs/mt7981_routerich_ax3000_defconfig -@@ -0,0 +1,107 @@ +@@ -0,0 +1,108 @@ +CONFIG_ARM=y +CONFIG_SYS_HAS_NONCACHED_MEMORY=y +CONFIG_POSITION_INDEPENDENT=y From b0261c3861afff7438cb7be4735d2fccb12a74bc Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sun, 22 Dec 2024 00:31:06 +0800 Subject: [PATCH 306/877] uboot-mediatek: add missing LED command for OpenWrt One The u-boot LED command "led_loop_done" is missing from the OpenWrt One NAND flash u-boot. Copy it from the OpenWrt One NOR flash u-boot default environment to fix this issue. Fixes: https://github.com/openwrt/openwrt/issues/17310 Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17338 Signed-off-by: Hauke Mehrtens (cherry picked from commit 5ef71eaafd4e128ec3708a66b5633214427da373) --- package/boot/uboot-mediatek/patches/453-add-openwrt-one.patch | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/boot/uboot-mediatek/patches/453-add-openwrt-one.patch b/package/boot/uboot-mediatek/patches/453-add-openwrt-one.patch index cf5f79f5841996..1968f66953d8fe 100644 --- a/package/boot/uboot-mediatek/patches/453-add-openwrt-one.patch +++ b/package/boot/uboot-mediatek/patches/453-add-openwrt-one.patch @@ -519,7 +519,7 @@ +_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver" --- /dev/null +++ b/openwrt-one-spi-nand_env -@@ -0,0 +1,60 @@ +@@ -0,0 +1,61 @@ +ethaddr_factory=mtd read factory 0x46000000 0x0 0x20000 && env readmem -b ethaddr 0x4600002a 0x6 ; setenv ethaddr_factory +ipaddr=192.168.11.11 +serverip=192.168.11.23 @@ -561,6 +561,7 @@ +check_buttons=if button front ; then run boot_recovery ; run boot_tftp ; run led_loop_error ; else if button back ; then ; run usb_recover ; run led_loop_error ; fi ; fi +led_boot=led green on ; led white on ; led red on +led_done=led green on ; led white off ; led red off ++led_loop_done=led white off ; led green on ; echo done ; while true ; do sleep 1 ; done +led_loop_error=led white off ; led green off ; while true ; do led red on ; sleep 1 ; led red off ; sleep 1 ; done +led_start=led white on ; led green off ; led red off +preboot=run led_boot From 676dfd1363fbfc1b92331aa293672f8af9770a02 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Fri, 13 Dec 2024 13:30:38 +0800 Subject: [PATCH 307/877] base-files: enable get_mac_ascii() to handle redundant strings The function get_mac_ascii() will fail when there are two or more same MAC address variable names in the mtd partition. Only retain the first variable to workaround this rare situation. Fixes: https://github.com/openwrt/openwrt/issues/17236 Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17262 Signed-off-by: Hauke Mehrtens (cherry picked from commit 3410ad2f40c085e5db7a71f6ae4b80734826a1e3) --- package/base-files/files/lib/functions/system.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/base-files/files/lib/functions/system.sh b/package/base-files/files/lib/functions/system.sh index 048e32f0e16414..aaeb75f26164af 100644 --- a/package/base-files/files/lib/functions/system.sh +++ b/package/base-files/files/lib/functions/system.sh @@ -66,7 +66,7 @@ get_mac_ascii() { local key="$2" local mac_dirty - mac_dirty=$(strings "$part" | sed -n 's/^'"$key"'=//p') + mac_dirty=$(strings "$part" | sed -n 's/^'"$key"'=//p' | head -n 1) # "canonicalize" mac [ -n "$mac_dirty" ] && macaddr_canonicalize "$mac_dirty" From 8b5f3ee940793be326aa1c3398c9fe017f18e73a Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Mon, 16 Dec 2024 15:09:50 +0800 Subject: [PATCH 308/877] base-files: strip space and tab characters from ASCII mac address Spaces and tabs are widely used in variable definitions. We have to remove them to ensure that get_mac_ascii() works properly. Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17262 Signed-off-by: Hauke Mehrtens (cherry picked from commit 551e04f3c9c063d885ca7a91db36f27f684a3a5c) --- package/base-files/files/lib/functions/system.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/base-files/files/lib/functions/system.sh b/package/base-files/files/lib/functions/system.sh index aaeb75f26164af..f43281b5dceb07 100644 --- a/package/base-files/files/lib/functions/system.sh +++ b/package/base-files/files/lib/functions/system.sh @@ -66,7 +66,7 @@ get_mac_ascii() { local key="$2" local mac_dirty - mac_dirty=$(strings "$part" | sed -n 's/^'"$key"'=//p' | head -n 1) + mac_dirty=$(strings "$part" | tr -d ' \t' | sed -n 's/^'"$key"'=//p' | head -n 1) # "canonicalize" mac [ -n "$mac_dirty" ] && macaddr_canonicalize "$mac_dirty" From deb0f28b5e05307926c77752ff87c24f4d674d38 Mon Sep 17 00:00:00 2001 From: Aleksander Jan Bajkowski Date: Fri, 3 Jan 2025 19:59:22 +0100 Subject: [PATCH 309/877] lantiq: xrx200: add support for lan3 and lan4 on AVM 5490/5491 On the AVM 5490/5491, lan1, lan2 and wan ports are connected directly to the internal GSWIP switch. The lan3 and lan4 ports are connected via an external QCA8334 switch. This commit adds the missing entries in dts and adds the driver module. Signed-off-by: Aleksander Jan Bajkowski Link: https://github.com/openwrt/openwrt/pull/17473 Signed-off-by: Hauke Mehrtens (cherry picked from commit 14be320291e0c00a1291ad8bd220fd37b12ba138) --- .../boot/dts/lantiq/vr9_avm_fritz5490.dtsi | 66 +++++++++++++++++++ target/linux/lantiq/image/vr9.mk | 4 +- .../xrx200/base-files/etc/board.d/02_network | 6 +- 3 files changed, 70 insertions(+), 6 deletions(-) diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz5490.dtsi b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz5490.dtsi index b38ac9f8b84a7d..2ba8e680b486f5 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz5490.dtsi +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz5490.dtsi @@ -46,6 +46,61 @@ phy9: ethernet-phy@9 { reg = <0x09>; }; + + switch@0 { + compatible = "qca,qca8334"; + #address-cells = <1>; + #size-cells = <0>; + + reset-gpios = <&gpio 44 GPIO_ACTIVE_LOW>; + reg = <0>; + + dsa,member = <1 0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + ethernet = <&rgmii0>; + phy-mode = "rgmii-txid"; + tx-internal-delay-ps = <3000>; + + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + + port@2 { + reg = <2>; + label = "lan3"; + phy-mode = "internal"; + phy-handle = <&phy_port2>; + }; + + port@3 { + reg = <3>; + label = "lan4"; + phy-mode = "internal"; + phy-handle = <&phy_port3>; + }; + }; + + mdio { + #address-cells = <1>; + #size-cells = <0>; + + phy_port2: phy@1 { + reg = <1>; + }; + + phy_port3: phy@2 { + reg = <2>; + }; + }; + }; }; &gswip_ports { @@ -56,6 +111,17 @@ phy-handle = <&phy6>; }; + rgmii0: port@1 { + reg = <1>; + label = "sw0"; + phy-mode = "rgmii"; + + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + port@2 { reg = <2>; label = "lan2"; diff --git a/target/linux/lantiq/image/vr9.mk b/target/linux/lantiq/image/vr9.mk index e2608213dc5f4f..48a372f4768a2b 100644 --- a/target/linux/lantiq/image/vr9.mk +++ b/target/linux/lantiq/image/vr9.mk @@ -177,7 +177,7 @@ define Device/avm_fritz5490 DEVICE_VARIANT := Other NAND KERNEL_SIZE := 4096k IMAGE_SIZE := 49152k - DEVICE_PACKAGES := kmod-usb3 fritz-tffs \ + DEVICE_PACKAGES := kmod-dsa-qca8k kmod-phy-qca83xx kmod-usb3 fritz-tffs \ -ltq-vdsl-vr9-vectoring-fw-installer -kmod-ltq-vdsl-vr9-mei \ -kmod-ltq-vdsl-vr9 -kmod-ltq-atm-vr9 -kmod-ltq-ptm-vr9 \ -ltq-vdsl-vr9-app -kmod-owl-loader \ @@ -195,7 +195,7 @@ define Device/avm_fritz5490-micron DEVICE_VARIANT := Micron NAND KERNEL_SIZE := 4096k IMAGE_SIZE := 49152k - DEVICE_PACKAGES := kmod-usb3 fritz-tffs \ + DEVICE_PACKAGES := kmod-dsa-qca8k kmod-phy-qca83xx kmod-usb3 fritz-tffs \ -ltq-vdsl-vr9-vectoring-fw-installer -kmod-ltq-vdsl-vr9-mei \ -kmod-ltq-vdsl-vr9 -kmod-ltq-atm-vr9 -kmod-ltq-ptm-vr9 \ -ltq-vdsl-vr9-app -kmod-owl-loader \ diff --git a/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network b/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network index 6c35c7a4debb18..8c2cdb12af51f7 100644 --- a/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network +++ b/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network @@ -14,15 +14,13 @@ lantiq_setup_interfaces() arcadyan,arv7519rw22) ucidef_set_interface_lan "lan1 lan2 lan3 lan4 lan5" ;; - avm,fritz5490|\ - avm,fritz5490-micron) - ucidef_set_interfaces_lan_wan "lan1 lan2" "wan" - ;; arcadyan,vgv7510kw22-brn|\ arcadyan,vgv7510kw22-nor|\ arcadyan,vgv7519-brn|\ arcadyan,vgv7519-nor|\ arcadyan,vrv9510kwac23|\ + avm,fritz5490|\ + avm,fritz5490-micron|\ bt,homehub-v5a|\ lantiq,easy80920-nand|\ lantiq,easy80920-nor|\ From 3d0ed57b16bf093f9ca94436b4710da48393b746 Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Sat, 28 Dec 2024 19:07:09 +0900 Subject: [PATCH 310/877] mediatek: append metadata to factory-uboot.bin for WSR devices Append metadata to factory-uboot.bin image to pass the image verification on sysupgrade. Signed-off-by: INAGAKI Hiroshi Link: https://github.com/openwrt/openwrt/pull/17408 Signed-off-by: Hauke Mehrtens (cherry picked from commit a06a2ef89db03fac2cbd950304e5b507da9deb1e) --- target/linux/mediatek/image/mt7622.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk index 9f5fdc86888521..faf1b20e4ac47a 100644 --- a/target/linux/mediatek/image/mt7622.mk +++ b/target/linux/mediatek/image/mt7622.mk @@ -123,7 +123,7 @@ define Device/buffalo_wsr 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 + buffalo-trx $$$$(BUFFALO_TRX_MAGIC) $$$$@ $(KDIR)/ubi_mark | append-metadata IMAGE/sysupgrade.bin := \ buffalo-trx $$$$(BUFFALO_TRX_MAGIC) $(KDIR)/tmp/$$(DEVICE_NAME).null | \ sysupgrade-tar kernel=$$$$@ | append-metadata From e80b7a63f18120620a534db598dd0d96df38a5e1 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Sat, 28 Dec 2024 00:13:37 +0100 Subject: [PATCH 311/877] ixp4xx: Break out mv88e6060 DSA switch to package Just one of the devices uses the Marvell MV88E6060 DSA switch so break this out from the generic kernel config and into a package selected only by that single device and probed at boot instead. The big win is from being able to drop the dsa_core (~600KB) kernel module out of the common kernel on devices with no DSA switch. Signed-off-by: Linus Walleij (cherry picked from commit 2456a2fd7f72d6afcee4ac9c2eccb312d0b1d36d) --- package/kernel/linux/modules/netdevices.mk | 17 +++++++++++++++++ target/linux/ixp4xx/config-6.6 | 3 --- target/linux/ixp4xx/image/Makefile | 2 +- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk index ee9654761bbc5a..247f3782d5b832 100644 --- a/package/kernel/linux/modules/netdevices.mk +++ b/package/kernel/linux/modules/netdevices.mk @@ -575,6 +575,23 @@ endef $(eval $(call KernelPackage,dsa-b53-mdio)) +define KernelPackage/dsa-mv88e6060 + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Marvell MV88E6060 DSA Switch + DEPENDS:=+kmod-dsa +kmod-phy-marvell + KCONFIG:=CONFIG_NET_DSA_TAG_TRAILER \ + CONFIG_NET_DSA_MV88E6060 + FILES:= \ + $(LINUX_DIR)/drivers/net/dsa/mv88e6060.ko \ + $(LINUX_DIR)/net/dsa/tag_trailer.ko + AUTOLOAD:=$(call AutoLoad,41,mv88e6060,1) +endef + +define KernelPackage/dsa-mv88e6060/description + Kernel modules for MV88E6060 DSA switches +endef + +$(eval $(call KernelPackage,dsa-mv88e6060)) define KernelPackage/dsa-tag-dsa SUBMENU:=$(NETWORK_DEVICES_MENU) diff --git a/target/linux/ixp4xx/config-6.6 b/target/linux/ixp4xx/config-6.6 index 84a72c8d5caa17..c0211c940b29cd 100644 --- a/target/linux/ixp4xx/config-6.6 +++ b/target/linux/ixp4xx/config-6.6 @@ -168,9 +168,6 @@ CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NEED_KUSER_HELPERS=y CONFIG_NEED_PER_CPU_KM=y CONFIG_NET_DEVLINK=y -CONFIG_NET_DSA=y -CONFIG_NET_DSA_MV88E6060=y -CONFIG_NET_DSA_TAG_TRAILER=y CONFIG_NET_EGRESS=y CONFIG_NET_INGRESS=y CONFIG_NET_PTP_CLASSIFY=y diff --git a/target/linux/ixp4xx/image/Makefile b/target/linux/ixp4xx/image/Makefile index ace533e50f0605..c33eddee8aa8fe 100644 --- a/target/linux/ixp4xx/image/Makefile +++ b/target/linux/ixp4xx/image/Makefile @@ -128,7 +128,7 @@ define Device/usrobotics_usr8200 DEVICE_VENDOR := USRobotics DEVICE_MODEL := USR8200 # USB2 is compiled in and needs no package - DEVICE_PACKAGES := ixp4xx-microcode-ethernet kmod-rtc-r7301 kmod-firewire kmod-firewire-ohci + DEVICE_PACKAGES := ixp4xx-microcode-ethernet kmod-rtc-r7301 kmod-firewire kmod-firewire-ohci kmod-dsa-mv88e6060 DEVICE_DTS := intel-ixp42x-usrobotics-usr8200 KERNEL := kernel-bin | append-dtb IMAGES := kernel.bin rootfs.bin From 8931d617dd0dd5e59394be8befabd38d492c2945 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Thu, 2 Jan 2025 15:44:45 +0100 Subject: [PATCH 312/877] ath79: Push MV88E6060 DSA switch into package We can use a package for the MV88E6060 DSA switch on the single ath79 device that uses it, saving around 600 KB of memory on all other devices (for the DSA infrastructure, mainly). As far as I can see the TP-Link TL WR941 v2 is the only device using MV88E6060 and the only device with a DSA switch overall. However the ath79 people should look at this so I'm not mistaken. Signed-off-by: Linus Walleij Link: https://patchwork.ozlabs.org/project/openwrt/patch/20250102-ath79-mv88e6060-module-v1-1-c2a8e31e72fc@linaro.org/ Signed-off-by: Hauke Mehrtens (cherry picked from commit e7419381fdd43a49e7583a786ce2d9c2ed1b4afe) --- target/linux/ath79/image/tiny-tp-link.mk | 1 + target/linux/ath79/tiny/config-default | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/target/linux/ath79/image/tiny-tp-link.mk b/target/linux/ath79/image/tiny-tp-link.mk index 93cbc7d148cfd3..70c3ab4c7b5d54 100644 --- a/target/linux/ath79/image/tiny-tp-link.mk +++ b/target/linux/ath79/image/tiny-tp-link.mk @@ -481,6 +481,7 @@ define Device/tplink_tl-wr941-v2 $(Device/tplink-4m) SOC := ar9132 DEVICE_MODEL := TL-WR941ND + DEVICE_PACKAGES := kmod-dsa-mv88e6060 DEVICE_VARIANT := v2/v3 DEVICE_ALT0_VENDOR := TP-Link DEVICE_ALT0_MODEL := TL-WR941N diff --git a/target/linux/ath79/tiny/config-default b/target/linux/ath79/tiny/config-default index e47260df82056f..38fbe1b5228be3 100644 --- a/target/linux/ath79/tiny/config-default +++ b/target/linux/ath79/tiny/config-default @@ -1,9 +1,6 @@ CONFIG_GRO_CELLS=y CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y CONFIG_NET_DEVLINK=y -CONFIG_NET_DSA=y -CONFIG_NET_DSA_MV88E6060=y -CONFIG_NET_DSA_TAG_TRAILER=y CONFIG_NET_SWITCHDEV=y CONFIG_NVMEM_SYSFS=y CONFIG_NVMEM_U_BOOT_ENV=y From e63d289bbd2f394538ee08fb51ba9f2326b57275 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Wed, 1 Jan 2025 22:18:05 +0100 Subject: [PATCH 313/877] realtek: trim default package selection Images for certain devices are staring to become too large, as some device only have 6MB available in their vendor partition layout for the initial install. This is especially pressing for bootloaders only supporting gzip compression. Drop some packages from DEFAULT_PACKAGES that aren't strictly required for a factory install. The user can always install more packages later using opkg/apk, or via a sysupgrade to a custom build. firewall4 is kept to ensure the most recent firewall package is selected in builds including LuCI. ethtool is kept as a frequently used diagnostics tool. Link: https://github.com/openwrt/openwrt/pull/17450 Signed-off-by: Sander Vanheule (cherry picked from commit c9ae39b2d156ff893d88a7d75b9044aac2fdd8d0) --- target/linux/realtek/Makefile | 5 ----- 1 file changed, 5 deletions(-) diff --git a/target/linux/realtek/Makefile b/target/linux/realtek/Makefile index 2614b148c4dd54..6cdd32a9d81481 100644 --- a/target/linux/realtek/Makefile +++ b/target/linux/realtek/Makefile @@ -20,13 +20,8 @@ include $(INCLUDE_DIR)/target.mk DEFAULT_PACKAGES += \ ethtool \ firewall4 \ - ip-bridge \ - ip-full \ kmod-gpio-button-hotplug \ - kmod-nft-offload \ - nftables \ odhcp6c \ - tc-bpf \ uboot-envtools \ From 5679b7aef6c65e1996bded86d734206c8f34c6ca Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 25 Dec 2024 19:39:29 +0800 Subject: [PATCH 314/877] mac80211: rt2x00: some improvements for rt2800 generic 1. Respect the rt2800 hardware TX queue index. 2. Increase the watchdog sampling frequency. Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/16845 Signed-off-by: Hauke Mehrtens (cherry picked from commit 70733c6093ee1e2fae12fdff97425270ea733dae) --- ...spect-rt2800-hardware-TX-queue-index.patch | 257 ++++++++++++++++++ ...ease-the-watchdog-sampling-frequency.patch | 74 +++++ ...t-support-for-external-LNA-on-MT7620.patch | 4 +- ...-differentiate-based-on-SoC-CHIP_VER.patch | 22 +- 4 files changed, 344 insertions(+), 13 deletions(-) create mode 100644 package/kernel/mac80211/patches/rt2x00/620-01-rt2x00-respect-rt2800-hardware-TX-queue-index.patch create mode 100644 package/kernel/mac80211/patches/rt2x00/620-02-rt2x00-increase-the-watchdog-sampling-frequency.patch diff --git a/package/kernel/mac80211/patches/rt2x00/620-01-rt2x00-respect-rt2800-hardware-TX-queue-index.patch b/package/kernel/mac80211/patches/rt2x00/620-01-rt2x00-respect-rt2800-hardware-TX-queue-index.patch new file mode 100644 index 00000000000000..e2c75979dfec2a --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/620-01-rt2x00-respect-rt2800-hardware-TX-queue-index.patch @@ -0,0 +1,257 @@ +From 654653e718f6c55c6f29fd94cc8152a92c8166ac Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Tue, 24 Dec 2024 08:36:32 +0800 +Subject: [PATCH 1/2] rt2x00: respect the rt2800 hardware TX queue index + +The Ralink TX queue register index is different from the Linux +IEEE80211 queue id definition. Their conversion table is as follows: + +Queue IEEE80211 Ralink +AC_VO 0 3 +AC_VI 1 2 +AC_BE 2 0 +AC_BK 3 1 + +The TX queues are still functioning properly under the current +configuration. I don't have evidence, but I believe there should +be some differences in the internal hardware implementation of +different TX queues, e.g. interrupt priority. so it's better to +respect the queue index defined by the Ralink when we construct +the TX rings and descriptors. + +And the more important thing is that we are using the wrong queue +index to calculate the register offset and mask in .conf_tx(), +which resulted in writing incorrect AIFSN, CWMAX, CWMIN and TXOP +values for all TX queues. This patch introduces a index conversion +table to fix these parameters. + +Signed-off-by: Shiji Yang +--- + drivers/net/wireless/ralink/rt2x00/rt2800.h | 24 ++++++------ + .../net/wireless/ralink/rt2x00/rt2800lib.c | 20 +++++++--- + .../net/wireless/ralink/rt2x00/rt2800mmio.c | 38 ++++++++++--------- + .../net/wireless/ralink/rt2x00/rt2x00queue.h | 20 ++++++++++ + 4 files changed, 67 insertions(+), 35 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h +@@ -379,10 +379,10 @@ + + /* + * WMM_AIFSN_CFG: Aifsn for each EDCA AC +- * AIFSN0: AC_VO +- * AIFSN1: AC_VI +- * AIFSN2: AC_BE +- * AIFSN3: AC_BK ++ * AIFSN0: AC_BE ++ * AIFSN1: AC_BK ++ * AIFSN2: AC_VI ++ * AIFSN3: AC_VO + */ + #define WMM_AIFSN_CFG 0x0214 + #define WMM_AIFSN_CFG_AIFSN0 FIELD32(0x0000000f) +@@ -392,10 +392,10 @@ + + /* + * WMM_CWMIN_CSR: CWmin for each EDCA AC +- * CWMIN0: AC_VO +- * CWMIN1: AC_VI +- * CWMIN2: AC_BE +- * CWMIN3: AC_BK ++ * CWMIN0: AC_BE ++ * CWMIN1: AC_BK ++ * CWMIN2: AC_VI ++ * CWMIN3: AC_VO + */ + #define WMM_CWMIN_CFG 0x0218 + #define WMM_CWMIN_CFG_CWMIN0 FIELD32(0x0000000f) +@@ -405,10 +405,10 @@ + + /* + * WMM_CWMAX_CSR: CWmax for each EDCA AC +- * CWMAX0: AC_VO +- * CWMAX1: AC_VI +- * CWMAX2: AC_BE +- * CWMAX3: AC_BK ++ * CWMAX0: AC_BE ++ * CWMAX1: AC_BK ++ * CWMAX2: AC_VI ++ * CWMAX3: AC_VO + */ + #define WMM_CWMAX_CFG 0x021c + #define WMM_CWMAX_CFG_CWMAX0 FIELD32(0x0000000f) +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -835,7 +835,8 @@ void rt2800_write_tx_data(struct queue_e + txdesc->key_idx : txdesc->u.ht.wcid); + rt2x00_set_field32(&word, TXWI_W1_MPDU_TOTAL_BYTE_COUNT, + txdesc->length); +- rt2x00_set_field32(&word, TXWI_W1_PACKETID_QUEUE, entry->queue->qid); ++ rt2x00_set_field32(&word, TXWI_W1_PACKETID_QUEUE, ++ rt2x00_ac_to_hwq(entry->queue->qid)); + rt2x00_set_field32(&word, TXWI_W1_PACKETID_ENTRY, (entry->entry_idx % 3) + 1); + rt2x00_desc_write(txwi, 1, word); + +@@ -1125,6 +1126,12 @@ void rt2800_txdone(struct rt2x00_dev *rt + u32 reg; + u8 qid; + bool match; ++ static const u8 rt2ac[] = { ++ IEEE80211_AC_BE, ++ IEEE80211_AC_BK, ++ IEEE80211_AC_VI, ++ IEEE80211_AC_VO, ++ }; + + while (quota-- > 0 && kfifo_get(&rt2x00dev->txstatus_fifo, ®)) { + /* +@@ -1132,6 +1139,8 @@ void rt2800_txdone(struct rt2x00_dev *rt + * guaranteed to be one of the TX QIDs . + */ + qid = rt2x00_get_field32(reg, TX_STA_FIFO_PID_QUEUE); ++ /* Convert Ralink hardware queue index to IEEE80211 queue id. */ ++ qid = rt2ac[qid]; + queue = rt2x00queue_get_tx_queue(rt2x00dev, qid); + + if (unlikely(rt2x00queue_empty(queue))) { +@@ -12188,8 +12197,9 @@ int rt2800_conf_tx(struct ieee80211_hw * + queue = rt2x00queue_get_tx_queue(rt2x00dev, queue_idx); + + /* Update WMM TXOP register */ +- offset = WMM_TXOP0_CFG + (sizeof(u32) * (!!(queue_idx & 2))); +- field.bit_offset = (queue_idx & 1) * 16; ++ offset = WMM_TXOP0_CFG + ++ (sizeof(u32) * (!!(rt2x00_ac_to_hwq(queue_idx) & 2))); ++ field.bit_offset = (rt2x00_ac_to_hwq(queue_idx) & 1) * 16; + field.bit_mask = 0xffff << field.bit_offset; + + reg = rt2800_register_read(rt2x00dev, offset); +@@ -12197,7 +12207,7 @@ int rt2800_conf_tx(struct ieee80211_hw * + rt2800_register_write(rt2x00dev, offset, reg); + + /* Update WMM registers */ +- field.bit_offset = queue_idx * 4; ++ field.bit_offset = rt2x00_ac_to_hwq(queue_idx) * 4; + field.bit_mask = 0xf << field.bit_offset; + + reg = rt2800_register_read(rt2x00dev, WMM_AIFSN_CFG); +@@ -12213,7 +12223,7 @@ int rt2800_conf_tx(struct ieee80211_hw * + rt2800_register_write(rt2x00dev, WMM_CWMAX_CFG, reg); + + /* Update EDCA registers */ +- offset = EDCA_AC0_CFG + (sizeof(u32) * queue_idx); ++ offset = EDCA_AC0_CFG + (sizeof(u32) * rt2x00_ac_to_hwq(queue_idx)); + + reg = rt2800_register_read(rt2x00dev, offset); + rt2x00_set_field32(®, EDCA_AC0_CFG_TX_OP, queue->txop); +--- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c +@@ -35,7 +35,7 @@ unsigned int rt2800mmio_get_dma_done(str + case QID_AC_VI: + case QID_AC_BE: + case QID_AC_BK: +- qid = queue->qid; ++ qid = rt2x00_ac_to_hwq(queue->qid); + idx = rt2x00mmio_register_read(rt2x00dev, TX_DTX_IDX(qid)); + break; + case QID_MGMT: +@@ -456,6 +456,7 @@ void rt2800mmio_kick_queue(struct data_q + { + struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; + struct queue_entry *entry; ++ u8 qid; + + switch (queue->qid) { + case QID_AC_VO: +@@ -464,7 +465,8 @@ void rt2800mmio_kick_queue(struct data_q + case QID_AC_BK: + WARN_ON_ONCE(rt2x00queue_empty(queue)); + entry = rt2x00queue_get_entry(queue, Q_INDEX); +- rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX(queue->qid), ++ qid = rt2x00_ac_to_hwq(queue->qid); ++ rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX(qid), + entry->entry_idx); + hrtimer_start(&rt2x00dev->txstatus_timer, + TXSTATUS_TIMEOUT, HRTIMER_MODE_REL); +@@ -666,36 +668,36 @@ int rt2800mmio_init_queues(struct rt2x00 + * Initialize registers. + */ + entry_priv = rt2x00dev->tx[0].entries[0].priv_data; +- rt2x00mmio_register_write(rt2x00dev, TX_BASE_PTR0, ++ rt2x00mmio_register_write(rt2x00dev, TX_BASE_PTR3, + entry_priv->desc_dma); +- rt2x00mmio_register_write(rt2x00dev, TX_MAX_CNT0, ++ rt2x00mmio_register_write(rt2x00dev, TX_MAX_CNT3, + rt2x00dev->tx[0].limit); +- rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX0, 0); +- rt2x00mmio_register_write(rt2x00dev, TX_DTX_IDX0, 0); ++ rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX3, 0); ++ rt2x00mmio_register_write(rt2x00dev, TX_DTX_IDX3, 0); + + entry_priv = rt2x00dev->tx[1].entries[0].priv_data; +- rt2x00mmio_register_write(rt2x00dev, TX_BASE_PTR1, ++ rt2x00mmio_register_write(rt2x00dev, TX_BASE_PTR2, + entry_priv->desc_dma); +- rt2x00mmio_register_write(rt2x00dev, TX_MAX_CNT1, ++ rt2x00mmio_register_write(rt2x00dev, TX_MAX_CNT2, + rt2x00dev->tx[1].limit); +- rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX1, 0); +- rt2x00mmio_register_write(rt2x00dev, TX_DTX_IDX1, 0); ++ rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX2, 0); ++ rt2x00mmio_register_write(rt2x00dev, TX_DTX_IDX2, 0); + + entry_priv = rt2x00dev->tx[2].entries[0].priv_data; +- rt2x00mmio_register_write(rt2x00dev, TX_BASE_PTR2, ++ rt2x00mmio_register_write(rt2x00dev, TX_BASE_PTR0, + entry_priv->desc_dma); +- rt2x00mmio_register_write(rt2x00dev, TX_MAX_CNT2, ++ rt2x00mmio_register_write(rt2x00dev, TX_MAX_CNT0, + rt2x00dev->tx[2].limit); +- rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX2, 0); +- rt2x00mmio_register_write(rt2x00dev, TX_DTX_IDX2, 0); ++ rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX0, 0); ++ rt2x00mmio_register_write(rt2x00dev, TX_DTX_IDX0, 0); + + entry_priv = rt2x00dev->tx[3].entries[0].priv_data; +- rt2x00mmio_register_write(rt2x00dev, TX_BASE_PTR3, ++ rt2x00mmio_register_write(rt2x00dev, TX_BASE_PTR1, + entry_priv->desc_dma); +- rt2x00mmio_register_write(rt2x00dev, TX_MAX_CNT3, ++ rt2x00mmio_register_write(rt2x00dev, TX_MAX_CNT1, + rt2x00dev->tx[3].limit); +- rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX3, 0); +- rt2x00mmio_register_write(rt2x00dev, TX_DTX_IDX3, 0); ++ rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX1, 0); ++ rt2x00mmio_register_write(rt2x00dev, TX_DTX_IDX1, 0); + + rt2x00mmio_register_write(rt2x00dev, TX_BASE_PTR4, 0); + rt2x00mmio_register_write(rt2x00dev, TX_MAX_CNT4, 0); +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.h +@@ -57,6 +57,26 @@ enum data_queue_qid { + }; + + /** ++ * rt2x00_ac_to_hwq - Convert IEEE80211 queue id to Ralink hardware ++ * queue register index. ++ * @ac: TX queue id. ++ */ ++static inline u8 rt2x00_ac_to_hwq(enum data_queue_qid ac) ++{ ++ static const u8 ralink_queue_map[] = { ++ [IEEE80211_AC_BE] = 0, ++ [IEEE80211_AC_BK] = 1, ++ [IEEE80211_AC_VI] = 2, ++ [IEEE80211_AC_VO] = 3, ++ }; ++ ++ if (unlikely(ac >= IEEE80211_NUM_ACS)) ++ return ac; ++ ++ return ralink_queue_map[ac]; ++} ++ ++/** + * enum skb_frame_desc_flags: Flags for &struct skb_frame_desc + * + * @SKBDESC_DMA_MAPPED_RX: &skb_dma field has been mapped for RX diff --git a/package/kernel/mac80211/patches/rt2x00/620-02-rt2x00-increase-the-watchdog-sampling-frequency.patch b/package/kernel/mac80211/patches/rt2x00/620-02-rt2x00-increase-the-watchdog-sampling-frequency.patch new file mode 100644 index 00000000000000..c60d2ad54a93fe --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/620-02-rt2x00-increase-the-watchdog-sampling-frequency.patch @@ -0,0 +1,74 @@ +From aec50d1a30349759de0ac535f54c3441bf7ebef7 Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Sun, 22 Dec 2024 17:06:59 +0800 +Subject: [PATCH 2/2] rt2x00: increase the watchdog sampling frequency + +Increase the sampling frequency of the watchdog when the hung +counter reaches the threshold to avoid some unnecessary resets. + +Signed-off-by: Shiji Yang +--- + .../net/wireless/ralink/rt2x00/rt2800lib.c | 45 +++++++++++++------ + 1 file changed, 32 insertions(+), 13 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -1320,26 +1320,45 @@ static bool rt2800_watchdog_hung(struct + return true; + } + ++static inline bool check_dma_busy_rx(u32 reg_cfg, u32 reg_int) ++{ ++ return (rt2x00_get_field32(reg_cfg, WPDMA_GLO_CFG_RX_DMA_BUSY) && ++ rt2x00_get_field32(reg_int, INT_SOURCE_CSR_RX_COHERENT)); ++} ++ ++static inline bool check_dma_busy_tx(u32 reg_cfg, u32 reg_int) ++{ ++ return (rt2x00_get_field32(reg_cfg, WPDMA_GLO_CFG_TX_DMA_BUSY) && ++ rt2x00_get_field32(reg_int, INT_SOURCE_CSR_TX_COHERENT)); ++} ++ + static bool rt2800_watchdog_dma_busy(struct rt2x00_dev *rt2x00dev) + { + bool busy_rx, busy_tx; + u32 reg_cfg = rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG); + u32 reg_int = rt2800_register_read(rt2x00dev, INT_SOURCE_CSR); + +- if (rt2x00_get_field32(reg_cfg, WPDMA_GLO_CFG_RX_DMA_BUSY) && +- rt2x00_get_field32(reg_int, INT_SOURCE_CSR_RX_COHERENT)) +- rt2x00dev->rxdma_busy++; +- else +- rt2x00dev->rxdma_busy = 0; +- +- if (rt2x00_get_field32(reg_cfg, WPDMA_GLO_CFG_TX_DMA_BUSY) && +- rt2x00_get_field32(reg_int, INT_SOURCE_CSR_TX_COHERENT)) +- rt2x00dev->txdma_busy++; +- else +- rt2x00dev->txdma_busy = 0; ++ rt2x00dev->rxdma_busy = check_dma_busy_rx(reg_cfg, reg_int) ? ++ rt2x00dev->rxdma_busy + 1 : 0; ++ rt2x00dev->txdma_busy = check_dma_busy_tx(reg_cfg, reg_int) ? ++ rt2x00dev->txdma_busy + 1 : 0; ++ ++ if (rt2x00dev->rxdma_busy > 25 || rt2x00dev->txdma_busy > 25) { ++ int cnt; ++ for (cnt = 0; cnt < 10; cnt++) { ++ msleep(5); ++ reg_cfg = rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG); ++ reg_int = rt2800_register_read(rt2x00dev, INT_SOURCE_CSR); ++ ++ if (!check_dma_busy_rx(reg_cfg, reg_int)) ++ rt2x00dev->rxdma_busy = 0; ++ if (!check_dma_busy_tx(reg_cfg, reg_int)) ++ rt2x00dev->txdma_busy = 0; ++ } ++ } + +- busy_rx = rt2x00dev->rxdma_busy > 30; +- busy_tx = rt2x00dev->txdma_busy > 30; ++ busy_rx = rt2x00dev->rxdma_busy > 40; ++ busy_tx = rt2x00dev->txdma_busy > 40; + + if (!busy_rx && !busy_tx) + return false; diff --git a/package/kernel/mac80211/patches/rt2x00/994-rt2x00-import-support-for-external-LNA-on-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/994-rt2x00-import-support-for-external-LNA-on-MT7620.patch index bb3f8197020b81..869879178fba72 100644 --- a/package/kernel/mac80211/patches/rt2x00/994-rt2x00-import-support-for-external-LNA-on-MT7620.patch +++ b/package/kernel/mac80211/patches/rt2x00/994-rt2x00-import-support-for-external-LNA-on-MT7620.patch @@ -52,7 +52,7 @@ Signed-off-by: Daniel Golle static const unsigned int rt2800_eeprom_map[EEPROM_WORD_COUNT] = { [EEPROM_CHIP_ID] = 0x0000, [EEPROM_VERSION] = 0x0001, -@@ -10404,8 +10422,10 @@ static void rt2800_calibration_rt6352(st +@@ -10432,8 +10450,10 @@ static void rt2800_calibration_rt6352(st u32 reg; if (rt2x00_has_cap_external_pa(rt2x00dev) || @@ -64,7 +64,7 @@ Signed-off-by: Daniel Golle rt2800_r_calibration(rt2x00dev); rt2800_rf_self_txdc_cal(rt2x00dev); -@@ -10423,6 +10443,8 @@ static void rt2800_calibration_rt6352(st +@@ -10451,6 +10471,8 @@ static void rt2800_calibration_rt6352(st !rt2x00_has_cap_external_lna_bg(rt2x00dev)) return; diff --git a/package/kernel/mac80211/patches/rt2x00/996-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch b/package/kernel/mac80211/patches/rt2x00/996-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch index 4c07a105906957..df7f9927af067b 100644 --- a/package/kernel/mac80211/patches/rt2x00/996-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch +++ b/package/kernel/mac80211/patches/rt2x00/996-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch @@ -14,7 +14,7 @@ */ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -3836,14 +3836,16 @@ static void rt2800_config_channel_rf7620 +@@ -3864,14 +3864,16 @@ static void rt2800_config_channel_rf7620 rt2x00_set_field8(&rfcsr, RFCSR19_K, rf->rf4); rt2800_rfcsr_write(rt2x00dev, 19, rfcsr); @@ -39,7 +39,7 @@ rfcsr = rt2800_rfcsr_read(rt2x00dev, 1); rt2x00_set_field8(&rfcsr, RFCSR1_TX2_EN_MT7620, -@@ -3877,18 +3879,23 @@ static void rt2800_config_channel_rf7620 +@@ -3905,18 +3907,23 @@ static void rt2800_config_channel_rf7620 rt2800_rfcsr_write_dccal(rt2x00dev, 59, 0x20); } @@ -73,7 +73,7 @@ if (!test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags)) { if (conf_is_ht40(conf)) { -@@ -4002,25 +4009,29 @@ static void rt2800_config_alc_rt6352(str +@@ -4030,25 +4037,29 @@ static void rt2800_config_alc_rt6352(str if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY))) rt2x00_warn(rt2x00dev, "RF busy while configuring ALC\n"); @@ -121,7 +121,7 @@ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, mac_sys_ctrl); rt2800_vco_calibration(rt2x00dev); -@@ -4513,7 +4524,8 @@ static void rt2800_config_channel(struct +@@ -4541,7 +4552,8 @@ static void rt2800_config_channel(struct if (rt2x00_rt(rt2x00dev, RT6352)) { /* BBP for GLRT BW */ bbp = conf_is_ht40(conf) ? @@ -131,7 +131,7 @@ 0x15 : 0x1a; rt2800_bbp_glrt_write(rt2x00dev, 141, bbp); -@@ -6017,18 +6029,33 @@ static int rt2800_init_registers(struct +@@ -6045,18 +6057,33 @@ static int rt2800_init_registers(struct } else if (rt2x00_rt(rt2x00dev, RT5350)) { rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404); } else if (rt2x00_rt(rt2x00dev, RT6352)) { @@ -177,7 +177,7 @@ reg = rt2800_register_read(rt2x00dev, TX_ALC_CFG_1); rt2x00_set_field32(®, TX_ALC_CFG_1_ROS_BUSY_EN, 0); rt2800_register_write(rt2x00dev, TX_ALC_CFG_1, reg); -@@ -7141,14 +7168,16 @@ static void rt2800_init_bbp_6352(struct +@@ -7169,14 +7196,16 @@ static void rt2800_init_bbp_6352(struct rt2800_bbp_write(rt2x00dev, 188, 0x00); rt2800_bbp_write(rt2x00dev, 189, 0x00); @@ -202,7 +202,7 @@ /* BBP for G band GLRT function (BBP_128 ~ BBP_221) */ rt2800_bbp_glrt_write(rt2x00dev, 0, 0x00); -@@ -10378,6 +10407,9 @@ static void rt2800_restore_rf_bbp_rt6352 +@@ -10406,6 +10435,9 @@ static void rt2800_restore_rf_bbp_rt6352 rt2800_register_write(rt2x00dev, RF_BYPASS3, 0x0); } @@ -212,7 +212,7 @@ if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x16); rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x23); -@@ -10455,6 +10487,9 @@ static void rt2800_calibration_rt6352(st +@@ -10483,6 +10515,9 @@ static void rt2800_calibration_rt6352(st rt2800_register_write(rt2x00dev, RF_BYPASS3, reg); } @@ -222,7 +222,7 @@ if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x66); rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x20); -@@ -10545,31 +10580,36 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10573,31 +10608,36 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write(rt2x00dev, 42, 0x5B); rt2800_rfcsr_write(rt2x00dev, 43, 0x00); @@ -284,7 +284,7 @@ /* Initialize RF channel register to default value */ rt2800_rfcsr_write_chanreg(rt2x00dev, 0, 0x03); -@@ -10635,63 +10675,71 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10663,63 +10703,71 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_bank(rt2x00dev, 6, 45, 0xC5); @@ -411,7 +411,7 @@ /* Initialize RF DC calibration register to default value */ rt2800_rfcsr_write_dccal(rt2x00dev, 0, 0x47); -@@ -10754,12 +10802,17 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10782,12 +10830,17 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_dccal(rt2x00dev, 62, 0x00); rt2800_rfcsr_write_dccal(rt2x00dev, 63, 0x00); From b8c53881db18abd666624e854b54133831021f3c Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 25 Dec 2024 19:39:29 +0800 Subject: [PATCH 315/877] mac80211: rt2x00: some improvements for mt7620 This patch contains some performance and stability improvements for MT7620: 1. Always calibrate MT7620 when switching channel. 2. Rework link tuner for MT7620. 3. Correct MT7620 SDM mode register value. 4. Fix register operation on RXIQ calibration. 5. Fix TX_PIN_CFG and TX_ALC_VGA3 init values. Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/16845 Signed-off-by: Hauke Mehrtens (cherry picked from commit 5d583901657bdfbbf9fad77d9247872427aa5c99) --- ...librate-MT7620-when-switching-channe.patch | 77 +++++++++++++++++++ ...-rt2x00-rework-link-tuner-for-MT7620.patch | 48 ++++++++++++ ...rrect-MT7620-SDM-mode-register-value.patch | 25 ++++++ ...gister-operation-on-RXIQ-calibration.patch | 60 +++++++++++++++ ...t-support-for-external-LNA-on-MT7620.patch | 10 +-- ...-differentiate-based-on-SoC-CHIP_VER.patch | 25 +++--- 6 files changed, 228 insertions(+), 17 deletions(-) create mode 100644 package/kernel/mac80211/patches/rt2x00/621-01-rt2x00-always-calibrate-MT7620-when-switching-channe.patch create mode 100644 package/kernel/mac80211/patches/rt2x00/621-02-rt2x00-rework-link-tuner-for-MT7620.patch create mode 100644 package/kernel/mac80211/patches/rt2x00/621-03-rt2x00-correct-MT7620-SDM-mode-register-value.patch create mode 100644 package/kernel/mac80211/patches/rt2x00/621-04-rt2x00-fix-register-operation-on-RXIQ-calibration.patch diff --git a/package/kernel/mac80211/patches/rt2x00/621-01-rt2x00-always-calibrate-MT7620-when-switching-channe.patch b/package/kernel/mac80211/patches/rt2x00/621-01-rt2x00-always-calibrate-MT7620-when-switching-channe.patch new file mode 100644 index 00000000000000..e66fbd43694cae --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/621-01-rt2x00-always-calibrate-MT7620-when-switching-channe.patch @@ -0,0 +1,77 @@ +From 2c5aad0f9990724cce48e0a53b66bc0438e4603d Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Sun, 22 Dec 2024 17:06:59 +0800 +Subject: [PATCH 1/4] rt2x00: always calibrate MT7620 when switching channel + +Perform calibration work after each channel switching operation. +This should help improve the rx/tx signal strength for MT7620. + +Signed-off-by: Shiji Yang +--- + .../net/wireless/ralink/rt2x00/rt2800lib.c | 24 ++++++++++++++----- + 1 file changed, 18 insertions(+), 6 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -5704,6 +5704,9 @@ static void rt2800_config_ps(struct rt2x + } + } + ++static void rt2800_calibration_rt6352_stage1(struct rt2x00_dev *rt2x00dev); ++static void rt2800_calibration_rt6352_stage2(struct rt2x00_dev *rt2x00dev); ++ + void rt2800_config(struct rt2x00_dev *rt2x00dev, + struct rt2x00lib_conf *libconf, + const unsigned int flags) +@@ -5718,10 +5721,18 @@ void rt2800_config(struct rt2x00_dev *rt + */ + rt2800_update_survey(rt2x00dev); + ++ if (rt2x00_rt(rt2x00dev, RT6352) && ++ !test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags)) ++ rt2800_calibration_rt6352_stage1(rt2x00dev); ++ + rt2800_config_channel(rt2x00dev, libconf->conf, + &libconf->rf, &libconf->channel); + rt2800_config_txpower(rt2x00dev, libconf->conf->chandef.chan, + libconf->conf->power_level); ++ ++ if (rt2x00_rt(rt2x00dev, RT6352) && ++ !test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags)) ++ rt2800_calibration_rt6352_stage2(rt2x00dev); + } + if (flags & IEEE80211_CONF_CHANGE_POWER) + rt2800_config_txpower(rt2x00dev, libconf->conf->chandef.chan, +@@ -10427,15 +10438,19 @@ static void rt2800_restore_rf_bbp_rt6352 + } + } + +-static void rt2800_calibration_rt6352(struct rt2x00_dev *rt2x00dev) ++static void rt2800_calibration_rt6352_stage1(struct rt2x00_dev *rt2x00dev) + { +- u32 reg; +- + if (rt2x00_has_cap_external_pa(rt2x00dev) || + rt2x00_has_cap_external_lna_bg(rt2x00dev)) + rt2800_restore_rf_bbp_rt6352(rt2x00dev); + + rt2800_r_calibration(rt2x00dev); ++} ++ ++static void rt2800_calibration_rt6352_stage2(struct rt2x00_dev *rt2x00dev) ++{ ++ u32 reg; ++ + rt2800_rf_self_txdc_cal(rt2x00dev); + rt2800_rxdcoc_calibration(rt2x00dev); + rt2800_bw_filter_calibration(rt2x00dev, true); +@@ -10766,9 +10781,6 @@ static void rt2800_init_rfcsr_6352(struc + + rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00); + rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C); +- +- /* Do calibration and init PA/LNA */ +- rt2800_calibration_rt6352(rt2x00dev); + } + + static void rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) diff --git a/package/kernel/mac80211/patches/rt2x00/621-02-rt2x00-rework-link-tuner-for-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/621-02-rt2x00-rework-link-tuner-for-MT7620.patch new file mode 100644 index 00000000000000..f7e7a8e5ffad9a --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/621-02-rt2x00-rework-link-tuner-for-MT7620.patch @@ -0,0 +1,48 @@ +From aaa57924324c1ee77afa5e3effc95cc86158ddcc Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Sun, 22 Dec 2024 17:06:59 +0800 +Subject: [PATCH 2/4] rt2x00: rework link tuner for MT7620 + +Correct the VGC gain value for MT7620 and only do gain calibration +for supported devices. + +Signed-off-by: Shiji Yang +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -5561,6 +5561,9 @@ static void rt2800_config_txpower(struct + + void rt2800_gain_calibration(struct rt2x00_dev *rt2x00dev) + { ++ if (rt2x00_rt(rt2x00dev, RT6352)) ++ return; ++ + rt2800_config_txpower(rt2x00dev, rt2x00dev->hw->conf.chandef.chan, + rt2x00dev->tx_power); + } +@@ -5773,9 +5776,10 @@ static u8 rt2800_get_default_vgc(struct + rt2x00_rt(rt2x00dev, RT3593) || + rt2x00_rt(rt2x00dev, RT5390) || + rt2x00_rt(rt2x00dev, RT5392) || +- rt2x00_rt(rt2x00dev, RT5592) || +- rt2x00_rt(rt2x00dev, RT6352)) ++ rt2x00_rt(rt2x00dev, RT5592)) + vgc = 0x1c + (2 * rt2x00dev->lna_gain); ++ else if(rt2x00_rt(rt2x00dev, RT6352)) ++ vgc = 0x04 + (2 * rt2x00dev->lna_gain); + else + vgc = 0x2e + rt2x00dev->lna_gain; + } else { /* 5GHZ band */ +@@ -5828,7 +5832,8 @@ void rt2800_link_tuner(struct rt2x00_dev + { + u8 vgc; + +- if (rt2x00_rt_rev(rt2x00dev, RT2860, REV_RT2860C)) ++ if (rt2x00_rt_rev(rt2x00dev, RT2860, REV_RT2860C) || ++ rt2x00_rt(rt2x00dev, RT6352)) + return; + + /* When RSSI is better than a certain threshold, increase VGC diff --git a/package/kernel/mac80211/patches/rt2x00/621-03-rt2x00-correct-MT7620-SDM-mode-register-value.patch b/package/kernel/mac80211/patches/rt2x00/621-03-rt2x00-correct-MT7620-SDM-mode-register-value.patch new file mode 100644 index 00000000000000..7c376df197a011 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/621-03-rt2x00-correct-MT7620-SDM-mode-register-value.patch @@ -0,0 +1,25 @@ +From b672507ca9f06bb17213036b16bc4f5c5bc65357 Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Sun, 22 Dec 2024 17:06:59 +0800 +Subject: [PATCH 3/4] rt2x00: correct MT7620 SDM mode register value + +rt2x00_set_field8() is a mask writing function. If we want to set +the BIT(7) for the SDM mode register here, we only need to fill "4" +in the mask. + +Signed-off-by: Shiji Yang +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -3848,7 +3848,7 @@ static void rt2800_config_channel_rf7620 + + /* Default: XO=20MHz , SDM mode */ + rfcsr = rt2800_rfcsr_read(rt2x00dev, 16); +- rt2x00_set_field8(&rfcsr, RFCSR16_SDM_MODE_MT7620, 0x80); ++ rt2x00_set_field8(&rfcsr, RFCSR16_SDM_MODE_MT7620, 4); + rt2800_rfcsr_write(rt2x00dev, 16, rfcsr); + + rfcsr = rt2800_rfcsr_read(rt2x00dev, 21); diff --git a/package/kernel/mac80211/patches/rt2x00/621-04-rt2x00-fix-register-operation-on-RXIQ-calibration.patch b/package/kernel/mac80211/patches/rt2x00/621-04-rt2x00-fix-register-operation-on-RXIQ-calibration.patch new file mode 100644 index 00000000000000..aa6f9c437c6447 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/621-04-rt2x00-fix-register-operation-on-RXIQ-calibration.patch @@ -0,0 +1,60 @@ +From 2585ada646e4dcf152ab813a24d667e6903105f4 Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Sun, 22 Dec 2024 17:06:59 +0800 +Subject: [PATCH 4/4] rt2x00: fix register operation on RXIQ calibration + +In rt2800_rxiq_calibration(), some variables are overwritten +before being used. Based on the values of the relevant registers +in other functions, I believe the correct operation should be +bit mask writing. + +Signed-off-by: Shiji Yang +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -8846,7 +8846,7 @@ static void rt2800_rxiq_calibration(stru + rt2x00_warn(rt2x00dev, "Timeout waiting for MAC status in RXIQ calibration\n"); + + bbpval = bbp4 & (~0x18); +- bbpval = bbp4 | 0x00; ++ bbpval = bbpval | 0x00; + rt2800_bbp_write(rt2x00dev, 4, bbpval); + + bbpval = rt2800_bbp_read(rt2x00dev, 21); +@@ -8928,13 +8928,13 @@ static void rt2800_rxiq_calibration(stru + for (ch_idx = 0; ch_idx < 2; ch_idx = ch_idx + 1) { + if (ch_idx == 0) { + rfval = rfb0r1 & (~0x3); +- rfval = rfb0r1 | 0x1; ++ rfval = rfval | 0x1; + rt2800_rfcsr_write_bank(rt2x00dev, 0, 1, rfval); + rfval = rfb0r2 & (~0x33); +- rfval = rfb0r2 | 0x11; ++ rfval = rfval | 0x11; + rt2800_rfcsr_write_bank(rt2x00dev, 0, 2, rfval); + rfval = rfb0r42 & (~0x50); +- rfval = rfb0r42 | 0x10; ++ rfval = rfval | 0x10; + rt2800_rfcsr_write_bank(rt2x00dev, 0, 42, rfval); + + rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00001006); +@@ -8947,13 +8947,13 @@ static void rt2800_rxiq_calibration(stru + rt2800_bbp_dcoc_write(rt2x00dev, 1, 0x00); + } else { + rfval = rfb0r1 & (~0x3); +- rfval = rfb0r1 | 0x2; ++ rfval = rfval | 0x2; + rt2800_rfcsr_write_bank(rt2x00dev, 0, 1, rfval); + rfval = rfb0r2 & (~0x33); +- rfval = rfb0r2 | 0x22; ++ rfval = rfval | 0x22; + rt2800_rfcsr_write_bank(rt2x00dev, 0, 2, rfval); + rfval = rfb0r42 & (~0x50); +- rfval = rfb0r42 | 0x40; ++ rfval = rfval | 0x40; + rt2800_rfcsr_write_bank(rt2x00dev, 0, 42, rfval); + + rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00002006); diff --git a/package/kernel/mac80211/patches/rt2x00/994-rt2x00-import-support-for-external-LNA-on-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/994-rt2x00-import-support-for-external-LNA-on-MT7620.patch index 869879178fba72..9d15d181d72fb4 100644 --- a/package/kernel/mac80211/patches/rt2x00/994-rt2x00-import-support-for-external-LNA-on-MT7620.patch +++ b/package/kernel/mac80211/patches/rt2x00/994-rt2x00-import-support-for-external-LNA-on-MT7620.patch @@ -52,9 +52,9 @@ Signed-off-by: Daniel Golle static const unsigned int rt2800_eeprom_map[EEPROM_WORD_COUNT] = { [EEPROM_CHIP_ID] = 0x0000, [EEPROM_VERSION] = 0x0001, -@@ -10432,8 +10450,10 @@ static void rt2800_calibration_rt6352(st - u32 reg; - +@@ -10446,8 +10464,10 @@ static void rt2800_restore_rf_bbp_rt6352 + static void rt2800_calibration_rt6352_stage1(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)) { @@ -63,8 +63,8 @@ Signed-off-by: Daniel Golle + } rt2800_r_calibration(rt2x00dev); - rt2800_rf_self_txdc_cal(rt2x00dev); -@@ -10451,6 +10471,8 @@ static void rt2800_calibration_rt6352(st + } +@@ -10471,6 +10491,8 @@ static void rt2800_calibration_rt6352_st !rt2x00_has_cap_external_lna_bg(rt2x00dev)) return; diff --git a/package/kernel/mac80211/patches/rt2x00/996-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch b/package/kernel/mac80211/patches/rt2x00/996-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch index df7f9927af067b..f4cc0443224a48 100644 --- a/package/kernel/mac80211/patches/rt2x00/996-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch +++ b/package/kernel/mac80211/patches/rt2x00/996-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch @@ -20,7 +20,7 @@ - /* Default: XO=20MHz , SDM mode */ - rfcsr = rt2800_rfcsr_read(rt2x00dev, 16); -- rt2x00_set_field8(&rfcsr, RFCSR16_SDM_MODE_MT7620, 0x80); +- rt2x00_set_field8(&rfcsr, RFCSR16_SDM_MODE_MT7620, 4); - rt2800_rfcsr_write(rt2x00dev, 16, rfcsr); - - rfcsr = rt2800_rfcsr_read(rt2x00dev, 21); @@ -29,7 +29,7 @@ + if (rt2800_hw_get_chipver(rt2x00dev) > 1) { + /* Default: XO=20MHz , SDM mode */ + rfcsr = rt2800_rfcsr_read(rt2x00dev, 16); -+ rt2x00_set_field8(&rfcsr, RFCSR16_SDM_MODE_MT7620, 0x80); ++ rt2x00_set_field8(&rfcsr, RFCSR16_SDM_MODE_MT7620, 4); + rt2800_rfcsr_write(rt2x00dev, 16, rfcsr); + + rfcsr = rt2800_rfcsr_read(rt2x00dev, 21); @@ -131,7 +131,7 @@ 0x15 : 0x1a; rt2800_bbp_glrt_write(rt2x00dev, 141, bbp); -@@ -6045,18 +6057,33 @@ static int rt2800_init_registers(struct +@@ -6061,18 +6073,34 @@ static int rt2800_init_registers(struct } else if (rt2x00_rt(rt2x00dev, RT5350)) { rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404); } else if (rt2x00_rt(rt2x00dev, RT6352)) { @@ -162,7 +162,8 @@ + rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000401); + rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x000C0001); + rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000); -+ rt2800_register_write(rt2x00dev, TX_ALC_VGA3, 0x00000000); ++ rt2800_register_write(rt2x00dev, TX_PIN_CFG, 0x00150f0f); ++ rt2800_register_write(rt2x00dev, TX_ALC_VGA3, 0x06060606); + rt2800_register_write(rt2x00dev, TX0_BB_GAIN_ATTEN, 0x0); + rt2800_register_write(rt2x00dev, TX1_BB_GAIN_ATTEN, 0x0); + rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, @@ -177,7 +178,7 @@ reg = rt2800_register_read(rt2x00dev, TX_ALC_CFG_1); rt2x00_set_field32(®, TX_ALC_CFG_1_ROS_BUSY_EN, 0); rt2800_register_write(rt2x00dev, TX_ALC_CFG_1, reg); -@@ -7169,14 +7196,16 @@ static void rt2800_init_bbp_6352(struct +@@ -7185,14 +7213,16 @@ static void rt2800_init_bbp_6352(struct rt2800_bbp_write(rt2x00dev, 188, 0x00); rt2800_bbp_write(rt2x00dev, 189, 0x00); @@ -202,7 +203,7 @@ /* BBP for G band GLRT function (BBP_128 ~ BBP_221) */ rt2800_bbp_glrt_write(rt2x00dev, 0, 0x00); -@@ -10406,6 +10435,9 @@ static void rt2800_restore_rf_bbp_rt6352 +@@ -10422,6 +10452,9 @@ static void rt2800_restore_rf_bbp_rt6352 rt2800_register_write(rt2x00dev, RF_BYPASS3, 0x0); } @@ -212,7 +213,7 @@ if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x16); rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x23); -@@ -10483,6 +10515,9 @@ static void rt2800_calibration_rt6352(st +@@ -10503,6 +10536,9 @@ static void rt2800_calibration_rt6352_st rt2800_register_write(rt2x00dev, RF_BYPASS3, reg); } @@ -222,7 +223,7 @@ if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x66); rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x20); -@@ -10573,31 +10608,36 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10593,31 +10629,36 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write(rt2x00dev, 42, 0x5B); rt2800_rfcsr_write(rt2x00dev, 43, 0x00); @@ -284,7 +285,7 @@ /* Initialize RF channel register to default value */ rt2800_rfcsr_write_chanreg(rt2x00dev, 0, 0x03); -@@ -10663,63 +10703,71 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10683,63 +10724,71 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_bank(rt2x00dev, 6, 45, 0xC5); @@ -411,7 +412,7 @@ /* Initialize RF DC calibration register to default value */ rt2800_rfcsr_write_dccal(rt2x00dev, 0, 0x47); -@@ -10782,12 +10830,17 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10802,12 +10851,17 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_dccal(rt2x00dev, 62, 0x00); rt2800_rfcsr_write_dccal(rt2x00dev, 63, 0x00); @@ -431,6 +432,6 @@ + rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00); + rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C); + } + } - /* Do calibration and init PA/LNA */ - rt2800_calibration_rt6352(rt2x00dev); + static void rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) From 785ea040ec956877d42df46ffa0c91e65fb4ba3c Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 25 Dec 2024 19:39:29 +0800 Subject: [PATCH 316/877] mac80211: rt2x00: some improvements for rt5592 This patch contains some performance and stability improvements for RT5592: 1. Fix RFCSR register init values for RT5592. 2. Fix BBP register init values for RT5592. Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/16845 Signed-off-by: Hauke Mehrtens (cherry picked from commit 59557ca19a460d8ad70991f63616d1ad0dfe9823) --- ...FCSR-register-init-values-for-RT5592.patch | 230 ++++++++++++++++++ ...-BBP-register-init-values-for-RT5592.patch | 119 +++++++++ ...t-support-for-external-LNA-on-MT7620.patch | 4 +- ...-differentiate-based-on-SoC-CHIP_VER.patch | 22 +- 4 files changed, 362 insertions(+), 13 deletions(-) create mode 100644 package/kernel/mac80211/patches/rt2x00/622-01-rt2x00-fix-RFCSR-register-init-values-for-RT5592.patch create mode 100644 package/kernel/mac80211/patches/rt2x00/622-02-rt2x00-fix-BBP-register-init-values-for-RT5592.patch diff --git a/package/kernel/mac80211/patches/rt2x00/622-01-rt2x00-fix-RFCSR-register-init-values-for-RT5592.patch b/package/kernel/mac80211/patches/rt2x00/622-01-rt2x00-fix-RFCSR-register-init-values-for-RT5592.patch new file mode 100644 index 00000000000000..15d1601eef1f8d --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/622-01-rt2x00-fix-RFCSR-register-init-values-for-RT5592.patch @@ -0,0 +1,230 @@ +From b48887d5de9921d0ff9e88068e3cd555a383d702 Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Sun, 22 Dec 2024 17:06:59 +0800 +Subject: [PATCH 1/2] rt2x00: fix RFCSR register init values for RT5592 + +Based on Raink proprietary driver 2.7.1.5, correct the initial +values of some RFCSR registers for RT5592. + +Signed-off-by: Shiji Yang +--- + .../net/wireless/ralink/rt2x00/rt2800lib.c | 122 ++++++++---------- + 1 file changed, 53 insertions(+), 69 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -3576,9 +3576,8 @@ static void rt2800_config_channel_rf55xx + + /* TODO RF27 <- tssi */ + +- rfcsr = rf->channel <= 10 ? 0x07 : 0x06; +- rt2800_rfcsr_write(rt2x00dev, 23, rfcsr); +- rt2800_rfcsr_write(rt2x00dev, 59, rfcsr); ++ rt2800_rfcsr_write(rt2x00dev, 23, rf->channel <= 10 ? 0x08 : 0x07); ++ rt2800_rfcsr_write(rt2x00dev, 59, rf->channel <= 4 ? 0x06 : 0x04); + + if (is_11b) { + /* CCK */ +@@ -3599,7 +3598,7 @@ static void rt2800_config_channel_rf55xx + power_bound = POWER_BOUND; + ep_reg = 0x2; + } else { +- rt2800_rfcsr_write(rt2x00dev, 10, 0x97); ++ rt2800_rfcsr_write(rt2x00dev, 10, 0x95); + /* FIMXE: RF11 overwrite */ + rt2800_rfcsr_write(rt2x00dev, 11, 0x40); + rt2800_rfcsr_write(rt2x00dev, 25, 0xBF); +@@ -3608,13 +3607,15 @@ static void rt2800_config_channel_rf55xx + rt2800_rfcsr_write(rt2x00dev, 37, 0x04); + rt2800_rfcsr_write(rt2x00dev, 38, 0x85); + rt2800_rfcsr_write(rt2x00dev, 40, 0x42); +- rt2800_rfcsr_write(rt2x00dev, 41, 0xBB); ++ rt2800_rfcsr_write(rt2x00dev, 41, 0xAB); + rt2800_rfcsr_write(rt2x00dev, 42, 0xD7); +- rt2800_rfcsr_write(rt2x00dev, 45, 0x41); ++ rt2800_rfcsr_write(rt2x00dev, 45, 0x01); + rt2800_rfcsr_write(rt2x00dev, 48, 0x00); + rt2800_rfcsr_write(rt2x00dev, 57, 0x77); ++ rt2800_rfcsr_write(rt2x00dev, 58, 0x19); + rt2800_rfcsr_write(rt2x00dev, 60, 0x05); + rt2800_rfcsr_write(rt2x00dev, 61, 0x01); ++ rt2800_rfcsr_write(rt2x00dev, 62, 0x19); + + /* TODO RF27 <- tssi */ + +@@ -3623,82 +3624,59 @@ static void rt2800_config_channel_rf55xx + rt2800_rfcsr_write(rt2x00dev, 12, 0x2E); + rt2800_rfcsr_write(rt2x00dev, 13, 0x22); + rt2800_rfcsr_write(rt2x00dev, 22, 0x60); +- rt2800_rfcsr_write(rt2x00dev, 23, 0x7F); +- if (rf->channel <= 50) +- rt2800_rfcsr_write(rt2x00dev, 24, 0x09); +- else if (rf->channel >= 52) +- rt2800_rfcsr_write(rt2x00dev, 24, 0x07); ++ rt2800_rfcsr_write(rt2x00dev, 23, 0x7E); ++ rt2800_rfcsr_write(rt2x00dev, 24, 0x07); + rt2800_rfcsr_write(rt2x00dev, 39, 0x1C); + rt2800_rfcsr_write(rt2x00dev, 43, 0x5B); +- rt2800_rfcsr_write(rt2x00dev, 44, 0X40); + rt2800_rfcsr_write(rt2x00dev, 46, 0X00); +- rt2800_rfcsr_write(rt2x00dev, 51, 0xFE); +- rt2800_rfcsr_write(rt2x00dev, 52, 0x0C); +- rt2800_rfcsr_write(rt2x00dev, 54, 0xF8); ++ rt2800_rfcsr_write(rt2x00dev, 51, 0xFD); ++ rt2800_rfcsr_write(rt2x00dev, 52, 0x0E); ++ rt2800_rfcsr_write(rt2x00dev, 55, 0x04); ++ rt2800_rfcsr_write(rt2x00dev, 56, 0xBB); ++ rt2800_rfcsr_write(rt2x00dev, 59, 0x7C); ++ + if (rf->channel <= 50) { +- rt2800_rfcsr_write(rt2x00dev, 55, 0x06), +- rt2800_rfcsr_write(rt2x00dev, 56, 0xD3); ++ rt2800_rfcsr_write(rt2x00dev, 44, 0X32); ++ rt2800_rfcsr_write(rt2x00dev, 54, 0xF9); + } else if (rf->channel >= 52) { +- rt2800_rfcsr_write(rt2x00dev, 55, 0x04); +- rt2800_rfcsr_write(rt2x00dev, 56, 0xBB); ++ rt2800_rfcsr_write(rt2x00dev, 44, 0X2A); ++ rt2800_rfcsr_write(rt2x00dev, 54, 0xF8); + } +- +- rt2800_rfcsr_write(rt2x00dev, 58, 0x15); +- rt2800_rfcsr_write(rt2x00dev, 59, 0x7F); +- rt2800_rfcsr_write(rt2x00dev, 62, 0x15); +- + } else if (rf->channel >= 100 && rf->channel <= 165) { +- + rt2800_rfcsr_write(rt2x00dev, 12, 0x0E); + rt2800_rfcsr_write(rt2x00dev, 13, 0x42); + rt2800_rfcsr_write(rt2x00dev, 22, 0x40); +- if (rf->channel <= 153) { +- rt2800_rfcsr_write(rt2x00dev, 23, 0x3C); +- rt2800_rfcsr_write(rt2x00dev, 24, 0x06); +- } else if (rf->channel >= 155) { +- rt2800_rfcsr_write(rt2x00dev, 23, 0x38); +- rt2800_rfcsr_write(rt2x00dev, 24, 0x05); +- } ++ rt2800_rfcsr_write(rt2x00dev, 52, 0x06); ++ rt2800_rfcsr_write(rt2x00dev, 55, 0x01); ++ + if (rf->channel <= 138) { ++ rt2800_rfcsr_write(rt2x00dev, 23, 0x7C); + rt2800_rfcsr_write(rt2x00dev, 39, 0x1A); + rt2800_rfcsr_write(rt2x00dev, 43, 0x3B); +- rt2800_rfcsr_write(rt2x00dev, 44, 0x20); + rt2800_rfcsr_write(rt2x00dev, 46, 0x18); +- } else if (rf->channel >= 140) { ++ } else { ++ rt2800_rfcsr_write(rt2x00dev, 23, 0x78); + rt2800_rfcsr_write(rt2x00dev, 39, 0x18); + rt2800_rfcsr_write(rt2x00dev, 43, 0x1B); +- rt2800_rfcsr_write(rt2x00dev, 44, 0x10); + rt2800_rfcsr_write(rt2x00dev, 46, 0X08); + } +- if (rf->channel <= 124) +- rt2800_rfcsr_write(rt2x00dev, 51, 0xFC); +- else if (rf->channel >= 126) +- rt2800_rfcsr_write(rt2x00dev, 51, 0xEC); +- if (rf->channel <= 138) +- rt2800_rfcsr_write(rt2x00dev, 52, 0x06); +- else if (rf->channel >= 140) +- rt2800_rfcsr_write(rt2x00dev, 52, 0x06); +- rt2800_rfcsr_write(rt2x00dev, 54, 0xEB); +- if (rf->channel <= 138) +- rt2800_rfcsr_write(rt2x00dev, 55, 0x01); +- else if (rf->channel >= 140) +- rt2800_rfcsr_write(rt2x00dev, 55, 0x00); +- if (rf->channel <= 128) +- rt2800_rfcsr_write(rt2x00dev, 56, 0xBB); +- else if (rf->channel >= 130) +- rt2800_rfcsr_write(rt2x00dev, 56, 0xAB); +- if (rf->channel <= 116) +- rt2800_rfcsr_write(rt2x00dev, 58, 0x1D); +- else if (rf->channel >= 118) +- rt2800_rfcsr_write(rt2x00dev, 58, 0x15); +- if (rf->channel <= 138) +- rt2800_rfcsr_write(rt2x00dev, 59, 0x3F); +- else if (rf->channel >= 140) +- rt2800_rfcsr_write(rt2x00dev, 59, 0x7C); +- if (rf->channel <= 116) +- rt2800_rfcsr_write(rt2x00dev, 62, 0x1D); +- else if (rf->channel >= 118) +- rt2800_rfcsr_write(rt2x00dev, 62, 0x15); ++ ++ if (rf->channel <= 114) { ++ rt2800_rfcsr_write(rt2x00dev, 24, 0x02); ++ rt2800_rfcsr_write(rt2x00dev, 44, 0x1A); ++ rt2800_rfcsr_write(rt2x00dev, 54, 0xEA); ++ rt2800_rfcsr_write(rt2x00dev, 56, 0xB3); ++ } else { ++ rt2800_rfcsr_write(rt2x00dev, 24, 0x03); ++ rt2800_rfcsr_write(rt2x00dev, 44, 0x0A); ++ rt2800_rfcsr_write(rt2x00dev, 54, 0xF9); ++ rt2800_rfcsr_write(rt2x00dev, 56, 0x9B); ++ } ++ ++ rt2800_rfcsr_write(rt2x00dev, 51, rf->channel <= 124 ? 0xFC : 0xEC); ++ rt2800_rfcsr_write(rt2x00dev, 58, rf->channel <= 116 ? 0x1D : 0x15); ++ rfcsr = (rf->channel >= 116 && rf->channel <= 138) ? 0x7E : 0x7C; ++ rt2800_rfcsr_write(rt2x00dev, 59, rfcsr); + } + + power_bound = POWER_BOUND_5G; +@@ -3710,7 +3688,7 @@ static void rt2800_config_channel_rf55xx + rt2x00_set_field8(&rfcsr, RFCSR49_TX, power_bound); + else + rt2x00_set_field8(&rfcsr, RFCSR49_TX, info->default_power1); +- if (is_type_ep) ++ if (!is_type_ep) + rt2x00_set_field8(&rfcsr, RFCSR49_EP, ep_reg); + rt2800_rfcsr_write(rt2x00dev, 49, rfcsr); + +@@ -3719,7 +3697,7 @@ static void rt2800_config_channel_rf55xx + rt2x00_set_field8(&rfcsr, RFCSR50_TX, power_bound); + else + rt2x00_set_field8(&rfcsr, RFCSR50_TX, info->default_power2); +- if (is_type_ep) ++ if (!is_type_ep) + rt2x00_set_field8(&rfcsr, RFCSR50_EP, ep_reg); + rt2800_rfcsr_write(rt2x00dev, 50, rfcsr); + +@@ -3740,7 +3718,6 @@ static void rt2800_config_channel_rf55xx + rt2x00_set_field8(&rfcsr, RFCSR1_RX2_PD, 0); + + rt2800_rfcsr_write(rt2x00dev, 1, rfcsr); +- rt2800_rfcsr_write(rt2x00dev, 6, 0xe4); + + if (conf_is_ht40(conf)) + rt2800_rfcsr_write(rt2x00dev, 30, 0x16); +@@ -8505,12 +8482,15 @@ static void rt2800_init_rfcsr_5392(struc + + static void rt2800_init_rfcsr_5592(struct rt2x00_dev *rt2x00dev) + { ++ u16 eeprom; ++ + rt2800_rf_init_calibration(rt2x00dev, 30); + + rt2800_rfcsr_write(rt2x00dev, 1, 0x3F); ++ rt2800_rfcsr_write(rt2x00dev, 2, 0x80); + rt2800_rfcsr_write(rt2x00dev, 3, 0x08); + rt2800_rfcsr_write(rt2x00dev, 5, 0x10); +- rt2800_rfcsr_write(rt2x00dev, 6, 0xE4); ++ rt2800_rfcsr_write(rt2x00dev, 6, 0xE0); + rt2800_rfcsr_write(rt2x00dev, 7, 0x00); + rt2800_rfcsr_write(rt2x00dev, 14, 0x00); + rt2800_rfcsr_write(rt2x00dev, 15, 0x00); +@@ -8526,9 +8506,13 @@ static void rt2800_init_rfcsr_5592(struc + rt2800_rfcsr_write(rt2x00dev, 34, 0x07); + rt2800_rfcsr_write(rt2x00dev, 35, 0x12); + rt2800_rfcsr_write(rt2x00dev, 47, 0x0C); +- rt2800_rfcsr_write(rt2x00dev, 53, 0x22); ++ rt2800_rfcsr_write(rt2x00dev, 53, 0x44); + rt2800_rfcsr_write(rt2x00dev, 63, 0x07); + ++ eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF2); ++ if (!rt2x00_get_field16(eeprom, EEPROM_NIC_CONF2_CRYSTAL)) ++ rt2800_rfcsr_write(rt2x00dev, 6, 0xE4); ++ + rt2800_rfcsr_write(rt2x00dev, 2, 0x80); + msleep(1); + diff --git a/package/kernel/mac80211/patches/rt2x00/622-02-rt2x00-fix-BBP-register-init-values-for-RT5592.patch b/package/kernel/mac80211/patches/rt2x00/622-02-rt2x00-fix-BBP-register-init-values-for-RT5592.patch new file mode 100644 index 00000000000000..19d1951b7b51d8 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/622-02-rt2x00-fix-BBP-register-init-values-for-RT5592.patch @@ -0,0 +1,119 @@ +From 1847d817df5585f9d957d16ed2a56ceb41cf6df7 Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Sun, 22 Dec 2024 17:06:59 +0800 +Subject: [PATCH 2/2] rt2x00: fix BBP register init values for RT5592 + +Based on Raink proprietary driver 2.7.1.5, correct the initial +values of some BBP registers for RT5592. + +Signed-off-by: Shiji Yang +--- + .../net/wireless/ralink/rt2x00/rt2800lib.c | 32 +++++++++---------- + 1 file changed, 15 insertions(+), 17 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -3746,6 +3746,7 @@ static void rt2800_config_channel_rf55xx + rt2800_bbp_write(rt2x00dev, 80, (rf->channel <= 14) ? 0x0E : 0x08); + rt2800_bbp_write(rt2x00dev, 81, (rf->channel <= 14) ? 0x3A : 0x38); + rt2800_bbp_write(rt2x00dev, 82, (rf->channel <= 14) ? 0x62 : 0x92); ++ rt2800_bbp_write(rt2x00dev, 95, (rf->channel <= 14) ? 0x9A : 0x1A); + + /* GLRT band configuration */ + rt2800_bbp_write(rt2x00dev, 195, 128); +@@ -3758,7 +3759,7 @@ static void rt2800_config_channel_rf55xx + rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x32 : 0x20); + rt2800_bbp_write(rt2x00dev, 195, 133); + rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x28 : 0x7F); +- rt2800_bbp_write(rt2x00dev, 195, 124); ++ rt2800_bbp_write(rt2x00dev, 195, 134); + rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x19 : 0x7F); + } + +@@ -4304,7 +4305,8 @@ static void rt2800_config_channel(struct + rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain); + rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain); + rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain); +- if (rt2x00_rt(rt2x00dev, RT6352)) ++ if (rt2x00_rt(rt2x00dev, RT5592) || ++ rt2x00_rt(rt2x00dev, RT6352)) + rt2800_bbp_write(rt2x00dev, 86, 0x38); + else + rt2800_bbp_write(rt2x00dev, 86, 0); +@@ -4313,6 +4315,7 @@ static void rt2800_config_channel(struct + if (rf->channel <= 14) { + if (!rt2x00_rt(rt2x00dev, RT5390) && + !rt2x00_rt(rt2x00dev, RT5392) && ++ !rt2x00_rt(rt2x00dev, RT5592) && + !rt2x00_rt(rt2x00dev, RT6352)) { + if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { + rt2800_bbp_write(rt2x00dev, 82, 0x62); +@@ -4336,17 +4339,20 @@ static void rt2800_config_channel(struct + else if (rt2x00_rt(rt2x00dev, RT3593) || + rt2x00_rt(rt2x00dev, RT3883)) + rt2800_bbp_write(rt2x00dev, 82, 0x82); +- else if (!rt2x00_rt(rt2x00dev, RT6352)) ++ else if (!rt2x00_rt(rt2x00dev, RT5592) && ++ !rt2x00_rt(rt2x00dev, RT6352)) + rt2800_bbp_write(rt2x00dev, 82, 0xf2); + + if (rt2x00_rt(rt2x00dev, RT3593) || + rt2x00_rt(rt2x00dev, RT3883)) + rt2800_bbp_write(rt2x00dev, 83, 0x9a); + +- if (rt2x00_has_cap_external_lna_a(rt2x00dev)) +- rt2800_bbp_write(rt2x00dev, 75, 0x46); +- else +- rt2800_bbp_write(rt2x00dev, 75, 0x50); ++ if (!rt2x00_rt(rt2x00dev, RT5592)) { ++ if (rt2x00_has_cap_external_lna_a(rt2x00dev)) ++ rt2800_bbp_write(rt2x00dev, 75, 0x46); ++ else ++ rt2800_bbp_write(rt2x00dev, 75, 0x50); ++ } + } + + reg = rt2800_register_read(rt2x00dev, TX_BAND_CFG); +@@ -5783,12 +5789,10 @@ static inline void rt2800_set_vgc(struct + if (rt2x00_rt(rt2x00dev, RT3572) || + rt2x00_rt(rt2x00dev, RT3593) || + rt2x00_rt(rt2x00dev, RT3883) || ++ rt2x00_rt(rt2x00dev, RT5592) || + rt2x00_rt(rt2x00dev, RT6352)) { + rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, + vgc_level); +- } else if (rt2x00_rt(rt2x00dev, RT5592)) { +- rt2800_bbp_write(rt2x00dev, 83, qual->rssi > -65 ? 0x4a : 0x7a); +- rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, vgc_level); + } else { + rt2800_bbp_write(rt2x00dev, 66, vgc_level); + } +@@ -7016,7 +7020,6 @@ static void rt2800_init_bbp_5592(struct + rt2800_bbp_write(rt2x00dev, 88, 0x90); + rt2800_bbp_write(rt2x00dev, 91, 0x04); + rt2800_bbp_write(rt2x00dev, 92, 0x02); +- rt2800_bbp_write(rt2x00dev, 95, 0x9a); + rt2800_bbp_write(rt2x00dev, 98, 0x12); + rt2800_bbp_write(rt2x00dev, 103, 0xC0); + rt2800_bbp_write(rt2x00dev, 104, 0x92); +@@ -7027,6 +7030,7 @@ static void rt2800_init_bbp_5592(struct + rt2800_bbp_write(rt2x00dev, 134, 0xD0); + rt2800_bbp_write(rt2x00dev, 135, 0xF6); + rt2800_bbp_write(rt2x00dev, 137, 0x0F); ++ rt2800_bbp_write(rt2x00dev, 148, 0x84); + + /* Initialize GLRT (Generalized Likehood Radio Test) */ + rt2800_init_bbp_5592_glrt(rt2x00dev); +@@ -7051,12 +7055,6 @@ static void rt2800_init_bbp_5592(struct + rt2x00_set_field8(&value, BBP254_BIT7, 1); + rt2800_bbp_write(rt2x00dev, 254, value); + } +- +- rt2800_init_freq_calibration(rt2x00dev); +- +- rt2800_bbp_write(rt2x00dev, 84, 0x19); +- if (rt2x00_rt_rev_gte(rt2x00dev, RT5592, REV_RT5592C)) +- rt2800_bbp_write(rt2x00dev, 103, 0xc0); + } + + static void rt2800_init_bbp_6352(struct rt2x00_dev *rt2x00dev) diff --git a/package/kernel/mac80211/patches/rt2x00/994-rt2x00-import-support-for-external-LNA-on-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/994-rt2x00-import-support-for-external-LNA-on-MT7620.patch index 9d15d181d72fb4..88a72fd03ec31b 100644 --- a/package/kernel/mac80211/patches/rt2x00/994-rt2x00-import-support-for-external-LNA-on-MT7620.patch +++ b/package/kernel/mac80211/patches/rt2x00/994-rt2x00-import-support-for-external-LNA-on-MT7620.patch @@ -52,7 +52,7 @@ Signed-off-by: Daniel Golle static const unsigned int rt2800_eeprom_map[EEPROM_WORD_COUNT] = { [EEPROM_CHIP_ID] = 0x0000, [EEPROM_VERSION] = 0x0001, -@@ -10446,8 +10464,10 @@ static void rt2800_restore_rf_bbp_rt6352 +@@ -10428,8 +10446,10 @@ static void rt2800_restore_rf_bbp_rt6352 static void rt2800_calibration_rt6352_stage1(struct rt2x00_dev *rt2x00dev) { if (rt2x00_has_cap_external_pa(rt2x00dev) || @@ -64,7 +64,7 @@ Signed-off-by: Daniel Golle rt2800_r_calibration(rt2x00dev); } -@@ -10471,6 +10491,8 @@ static void rt2800_calibration_rt6352_st +@@ -10453,6 +10473,8 @@ static void rt2800_calibration_rt6352_st !rt2x00_has_cap_external_lna_bg(rt2x00dev)) return; diff --git a/package/kernel/mac80211/patches/rt2x00/996-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch b/package/kernel/mac80211/patches/rt2x00/996-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch index f4cc0443224a48..eb0237a389381e 100644 --- a/package/kernel/mac80211/patches/rt2x00/996-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch +++ b/package/kernel/mac80211/patches/rt2x00/996-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch @@ -14,7 +14,7 @@ */ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -3864,14 +3864,16 @@ static void rt2800_config_channel_rf7620 +@@ -3842,14 +3842,16 @@ static void rt2800_config_channel_rf7620 rt2x00_set_field8(&rfcsr, RFCSR19_K, rf->rf4); rt2800_rfcsr_write(rt2x00dev, 19, rfcsr); @@ -39,7 +39,7 @@ rfcsr = rt2800_rfcsr_read(rt2x00dev, 1); rt2x00_set_field8(&rfcsr, RFCSR1_TX2_EN_MT7620, -@@ -3905,18 +3907,23 @@ static void rt2800_config_channel_rf7620 +@@ -3883,18 +3885,23 @@ static void rt2800_config_channel_rf7620 rt2800_rfcsr_write_dccal(rt2x00dev, 59, 0x20); } @@ -73,7 +73,7 @@ if (!test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags)) { if (conf_is_ht40(conf)) { -@@ -4030,25 +4037,29 @@ static void rt2800_config_alc_rt6352(str +@@ -4008,25 +4015,29 @@ static void rt2800_config_alc_rt6352(str if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY))) rt2x00_warn(rt2x00dev, "RF busy while configuring ALC\n"); @@ -121,7 +121,7 @@ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, mac_sys_ctrl); rt2800_vco_calibration(rt2x00dev); -@@ -4541,7 +4552,8 @@ static void rt2800_config_channel(struct +@@ -4524,7 +4535,8 @@ static void rt2800_config_channel(struct if (rt2x00_rt(rt2x00dev, RT6352)) { /* BBP for GLRT BW */ bbp = conf_is_ht40(conf) ? @@ -131,7 +131,7 @@ 0x15 : 0x1a; rt2800_bbp_glrt_write(rt2x00dev, 141, bbp); -@@ -6061,18 +6073,34 @@ static int rt2800_init_registers(struct +@@ -6042,18 +6054,34 @@ static int rt2800_init_registers(struct } else if (rt2x00_rt(rt2x00dev, RT5350)) { rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404); } else if (rt2x00_rt(rt2x00dev, RT6352)) { @@ -178,7 +178,7 @@ reg = rt2800_register_read(rt2x00dev, TX_ALC_CFG_1); rt2x00_set_field32(®, TX_ALC_CFG_1_ROS_BUSY_EN, 0); rt2800_register_write(rt2x00dev, TX_ALC_CFG_1, reg); -@@ -7185,14 +7213,16 @@ static void rt2800_init_bbp_6352(struct +@@ -7160,14 +7188,16 @@ static void rt2800_init_bbp_6352(struct rt2800_bbp_write(rt2x00dev, 188, 0x00); rt2800_bbp_write(rt2x00dev, 189, 0x00); @@ -203,7 +203,7 @@ /* BBP for G band GLRT function (BBP_128 ~ BBP_221) */ rt2800_bbp_glrt_write(rt2x00dev, 0, 0x00); -@@ -10422,6 +10452,9 @@ static void rt2800_restore_rf_bbp_rt6352 +@@ -10404,6 +10434,9 @@ static void rt2800_restore_rf_bbp_rt6352 rt2800_register_write(rt2x00dev, RF_BYPASS3, 0x0); } @@ -213,7 +213,7 @@ if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x16); rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x23); -@@ -10503,6 +10536,9 @@ static void rt2800_calibration_rt6352_st +@@ -10485,6 +10518,9 @@ static void rt2800_calibration_rt6352_st rt2800_register_write(rt2x00dev, RF_BYPASS3, reg); } @@ -223,7 +223,7 @@ if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x66); rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x20); -@@ -10593,31 +10629,36 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10575,31 +10611,36 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write(rt2x00dev, 42, 0x5B); rt2800_rfcsr_write(rt2x00dev, 43, 0x00); @@ -285,7 +285,7 @@ /* Initialize RF channel register to default value */ rt2800_rfcsr_write_chanreg(rt2x00dev, 0, 0x03); -@@ -10683,63 +10724,71 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10665,63 +10706,71 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_bank(rt2x00dev, 6, 45, 0xC5); @@ -412,7 +412,7 @@ /* Initialize RF DC calibration register to default value */ rt2800_rfcsr_write_dccal(rt2x00dev, 0, 0x47); -@@ -10802,12 +10851,17 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10784,12 +10833,17 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_dccal(rt2x00dev, 62, 0x00); rt2800_rfcsr_write_dccal(rt2x00dev, 63, 0x00); From d92fc99360f0e8c5e8974fdc53d398c107a53072 Mon Sep 17 00:00:00 2001 From: Roland Reinl Date: Wed, 18 Dec 2024 15:45:37 +0100 Subject: [PATCH 317/877] mediatek: Fix U-Boot variables handling for D-Link M30 A1 I think I implemented the U-Boot handling incorrectly on M30 (saw the issue while porting M60 to OpenWrt). Maybe someone with more U-Boot experience can have a look at it. What I understood until now: Before flashing, `sw_tryactive` must be set to 0 because OpenWrt runs on partition 0 During reset after flashing, U-Boot executes the following line: `boot_rd_auto_sw_img=if itest.s ${sw_tryactive} == 2; then run boot_by_part; else run boot_by_tryactive; fi` As `sw_tryactive` was set to 0 before flashing, `boot_by_tryactive` will be executed: `boot_by_tryactive=if itest.s ${sw_tryactive} == 0; then setenv sw_tryactive 2; setenv sw_active 1; saveenv; run ub0; else setenv sw_tryactive 2; setenv sw_active 2; saveenv; run ub1; fi` As `sw_tryactive` was set to 0 before flashing, `sw_active` will be set to 1 and `ub0` will be executed: `ub0=setenv bootpart 0; mtkboardboot; run ub0to1; uip main; reset` If the OpenWrt boot is successful, `ub0to1` and `uip` main will never be executed. Only in case OpenWrt cannot be loaded, `mtkboardboot` will return and the fallback `ub0to1` is executed. Conclusion: It's sufficient to set `sw_tryacitve` to 0 before flashing, the added code in `target/linux/mediatek/filogic/base-files/etc/init.d/bootcount` is useless. In the worst case (/proc/cmdline doesn't contain `bootpart=ubi0` as expected), the bootpart variable would be set to 1 and causes starting the firmware from the second partition instead of the one on the first partition. Signed-off-by: Roland Reinl Link: https://github.com/openwrt/openwrt/pull/17298 Signed-off-by: Hauke Mehrtens (cherry picked from commit 70610a5240a94648e178713f091435bd0ba158d3) --- .../linux/mediatek/filogic/base-files/etc/init.d/bootcount | 7 ------- .../mediatek/filogic/base-files/lib/upgrade/platform.sh | 1 + 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/target/linux/mediatek/filogic/base-files/etc/init.d/bootcount b/target/linux/mediatek/filogic/base-files/etc/init.d/bootcount index e186589f281bcd..c52d004c639cd8 100755 --- a/target/linux/mediatek/filogic/base-files/etc/init.d/bootcount +++ b/target/linux/mediatek/filogic/base-files/etc/init.d/bootcount @@ -5,13 +5,6 @@ START=99 boot() { case $(board_name) in - dlink,aquila-pro-ai-m30-a1) - if grep -q bootpart=ubi0 /proc/cmdline; then - fw_setenv bootpart 0 - else - fw_setenv bootpart 1 - fi - ;; zyxel,ex5700-telenor) fw_setenv uboot_bootcount 0 ;; 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 cf80cb5edce907..2ad92b2f5600b7 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -123,6 +123,7 @@ platform_do_upgrade() { yuncore,ax835) default_do_upgrade "$1" ;; + dlink,aquila-pro-ai-m30-a1|\ dlink,aquila-pro-ai-m60-a1) fw_setenv sw_tryactive 0 nand_do_upgrade "$1" From 6dacba30a75b0ac8a65115f78808a97abbb34939 Mon Sep 17 00:00:00 2001 From: Maxim Anisimov Date: Tue, 10 Dec 2024 16:37:02 +0300 Subject: [PATCH 318/877] mediatek/filogic: add support for Cudy AP3000 v1 Hardware: SoC: MT7981b RAM: 512 MB Flash: 256 MB SPI NAND Ethernet: 1x2.5Gbps (rtl8221b) WiFi: 2x2 MT7981 Button: Reset LED: 1x multicolor Installation ------------ At the moment, firmware installation is only possible via a transition firmware. It's can be requested from the manufacturer by email to support@cudy.com Signed-off-by: Maxim Anisimov Link: https://github.com/openwrt/openwrt/pull/17225 Signed-off-by: Hauke Mehrtens (cherry picked from commit 6992d6e51af34603de099d7bbe9d7e848f109e22) --- .../mediatek/dts/mt7981b-cudy-ap3000-v1.dts | 218 ++++++++++++++++++ .../filogic/base-files/etc/board.d/02_network | 1 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 9 +- target/linux/mediatek/image/filogic.mk | 17 ++ 4 files changed, 239 insertions(+), 6 deletions(-) create mode 100644 target/linux/mediatek/dts/mt7981b-cudy-ap3000-v1.dts diff --git a/target/linux/mediatek/dts/mt7981b-cudy-ap3000-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-ap3000-v1.dts new file mode 100644 index 00000000000000..bd6c15225b4d9f --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-cudy-ap3000-v1.dts @@ -0,0 +1,218 @@ +// SPDX-License-Identifier: GPL-2.0-only OR MIT + +/dts-v1/; + +#include "mt7981.dtsi" + +/ { + model = "Cudy AP3000 v1"; + compatible = "cudy,ap3000-v1", "mediatek,mt7981"; + + aliases { + label-mac-device = &gmac0; + led-boot = &status_led; + led-failsafe = &status_led; + led-running = &status_led; + led-upgrade = &status_led; + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + gpio-keys { + compatible = "gpio-keys"; + + button-reset { + label = "reset"; + linux,code = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + led-0 { + color = ; + function = LED_FUNCTION_WLAN_2GHZ; + gpios = <&pio 4 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + led-1 { + color = ; + function = LED_FUNCTION_WLAN_5GHZ; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + + status_led: led-2 { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&pio 11 GPIO_ACTIVE_LOW>; + }; + }; + + watchdog { + compatible = "linux,wdt-gpio"; + gpios = <&pio 6 GPIO_ACTIVE_HIGH>; + hw_algo = "level"; + hw_margin_ms = <10000>; + always-running; + }; +}; + +&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-handle = <&phy1>; + phy-mode = "2500base-x"; + + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_bdinfo_de00 0>; + }; +}; + +&mdio_bus { + phy1: phy@1 { + reg = <1>; + interrupt-parent = <&pio>; + interrupts = <38 IRQ_TYPE_LEVEL_LOW>; + reset-gpios = <&pio 39 GPIO_ACTIVE_LOW>; + reset-assert-us = <100000>; + reset-deassert-us = <100000>; + }; +}; + +&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>; + status = "okay"; + + /* ESMT F50L2G41XA (256M) */ + 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 { + 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>; + }; + }; + }; + + partition@380000 { + label = "bdinfo"; + reg = <0x380000 0x40000>; + 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@3C0000 { + label = "fip"; + reg = <0x3C0000 0x200000>; + read-only; + }; + + partition@5C0000 { + label = "ubi"; + reg = <0x5C0000 0x4000000>; + }; + }; + }; +}; + +&wifi { + nvmem-cell-names = "eeprom"; + nvmem-cells = <&eeprom_factory_0>; + 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 31b362c24a2879..b9c149d072172e 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 @@ -71,6 +71,7 @@ mediatek_setup_interfaces() ucidef_set_interfaces_lan_wan "lan1" eth1 ;; cudy,ap3000outdoor-v1|\ + cudy,ap3000-v1|\ cudy,re3000-v1|\ netgear,wax220|\ ubnt,unifi-6-plus|\ 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 4a6e0589a26024..6ee525e8d0c4cd 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 @@ -73,14 +73,11 @@ case "$board" in addr=$(mtd_get_mac_binary "Factory" 0x8000) [ "$PHYNBR" = "1" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress ;; - cudy,tr3000-v1|\ - 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,ap3000outdoor-v1|\ + cudy,ap3000-v1|\ cudy,m3000-v1|\ + cudy,re3000-v1|\ + cudy,tr3000-v1|\ cudy,wr3000s-v1|\ cudy,wr3000-v1) addr=$(mtd_get_mac_binary bdinfo 0xde00) diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index c1a3eff6c72662..d8d35954b00cd8 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -592,6 +592,23 @@ define Device/cudy_ap3000outdoor-v1 endef TARGET_DEVICES += cudy_ap3000outdoor-v1 +define Device/cudy_ap3000-v1 + DEVICE_VENDOR := Cudy + DEVICE_MODEL := AP3000 + DEVICE_VARIANT := v1 + DEVICE_DTS := mt7981b-cudy-ap3000-v1 + DEVICE_DTS_DIR := ../dts + SUPPORTED_DEVICES += R49 + 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-mt7915e kmod-mt7981-firmware mt7981-wo-firmware +endef +TARGET_DEVICES += cudy_ap3000-v1 + define Device/cudy_m3000-v1 DEVICE_VENDOR := Cudy DEVICE_MODEL := M3000 From 3d17274ca80938c375651f878db883f8a534f65d Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Mon, 6 Jan 2025 01:24:03 +0100 Subject: [PATCH 319/877] OpenWrt v24.10.0-rc5: 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 581de056c41e3e..4bc784e68bd9f8 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git;openwrt-24.10 -src-git luci https://git.openwrt.org/project/luci.git;openwrt-24.10 -src-git routing https://git.openwrt.org/feed/routing.git;openwrt-24.10 -src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-24.10 +src-git packages https://git.openwrt.org/feed/packages.git^c84e022ee9fae5884a7c698746bfac4d74a12a2d +src-git luci https://git.openwrt.org/project/luci.git^65c86ed3244f5ad3dc5fdfca93f40b20ab2f550c +src-git routing https://git.openwrt.org/feed/routing.git^84d97e684bcb6a63dbfdfbfd9ec7407192861239 +src-git telephony https://git.openwrt.org/feed/telephony.git^fd605af7143165a2490681ec1752f259873b9147 diff --git a/include/version.mk b/include/version.mk index a6ebe587797707..37ad97a1f6a572 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),24.10-SNAPSHOT) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),24.10.0-rc5) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION)) +VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r28304-6dacba30a7) VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO)) -VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/24.10-SNAPSHOT) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/24.10.0-rc5) 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 80db993d46b837..b2a42f8f74a6de 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/24.10-SNAPSHOT" + default "https://downloads.openwrt.org/releases/24.10.0-rc5" 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..98cb8f83bab7a9 --- /dev/null +++ b/version @@ -0,0 +1 @@ +r28304-6dacba30a7 diff --git a/version.date b/version.date new file mode 100644 index 00000000000000..751ec8b464e0da --- /dev/null +++ b/version.date @@ -0,0 +1 @@ +1736026537 From 50dcebeb8ad712922853bacb34212129cdf7f94b Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Mon, 6 Jan 2025 01:24:07 +0100 Subject: [PATCH 320/877] OpenWrt v24.10.0-rc5: 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 4bc784e68bd9f8..581de056c41e3e 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git^c84e022ee9fae5884a7c698746bfac4d74a12a2d -src-git luci https://git.openwrt.org/project/luci.git^65c86ed3244f5ad3dc5fdfca93f40b20ab2f550c -src-git routing https://git.openwrt.org/feed/routing.git^84d97e684bcb6a63dbfdfbfd9ec7407192861239 -src-git telephony https://git.openwrt.org/feed/telephony.git^fd605af7143165a2490681ec1752f259873b9147 +src-git packages https://git.openwrt.org/feed/packages.git;openwrt-24.10 +src-git luci https://git.openwrt.org/project/luci.git;openwrt-24.10 +src-git routing https://git.openwrt.org/feed/routing.git;openwrt-24.10 +src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-24.10 diff --git a/include/version.mk b/include/version.mk index 37ad97a1f6a572..a6ebe587797707 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),24.10.0-rc5) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),24.10-SNAPSHOT) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r28304-6dacba30a7) +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/24.10.0-rc5) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/24.10-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 b2a42f8f74a6de..80db993d46b837 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/24.10.0-rc5" + default "https://downloads.openwrt.org/releases/24.10-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 98cb8f83bab7a9..00000000000000 --- a/version +++ /dev/null @@ -1 +0,0 @@ -r28304-6dacba30a7 diff --git a/version.date b/version.date deleted file mode 100644 index 751ec8b464e0da..00000000000000 --- a/version.date +++ /dev/null @@ -1 +0,0 @@ -1736026537 From 0c52c9d6fc53ebe0834b3945c5d58277752d9648 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Fri, 3 Jan 2025 21:46:13 +0100 Subject: [PATCH 321/877] ath79: reset ETH switch for AR9344 According to datasheet, on AR9344 the switch and switch analog need to be reset first before initiating a full reset. Resetting these systems fixes spurious reset hangs on Atheros AR9344 SoCs. Link: https://github.com/freifunk-gluon/gluon/issues/2904 Signed-off-by: David Bauer (cherry picked from commit 916af73fc388d638b1a717a2411792e0680dd8e6) --- ...et-ath79-reset-ETH-switch-for-AR9344.patch | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 target/linux/ath79/patches-6.6/101-reset-ath79-reset-ETH-switch-for-AR9344.patch diff --git a/target/linux/ath79/patches-6.6/101-reset-ath79-reset-ETH-switch-for-AR9344.patch b/target/linux/ath79/patches-6.6/101-reset-ath79-reset-ETH-switch-for-AR9344.patch new file mode 100644 index 00000000000000..dcac5be58b37c1 --- /dev/null +++ b/target/linux/ath79/patches-6.6/101-reset-ath79-reset-ETH-switch-for-AR9344.patch @@ -0,0 +1,104 @@ +From: David Bauer +Date: Tue, 2 Jan 2025 19:22:40 +0100 +Subject: [PATCH] reset: ath79: reset ETH switch for AR9344 + +According to datasheet, on AR9344 the switch and switch analog need to +be reset first before initiating a full reset. + +Resetting these systems fixes spurious reset hangs on Atheros AR9344 +SoCs. + +Link: https://github.com/freifunk-gluon/gluon/issues/2904 + +Signed-off-by: David Bauer + +--- a/drivers/reset/reset-ath79.c ++++ b/drivers/reset/reset-ath79.c +@@ -12,8 +12,11 @@ + #include + #include + #include ++#include ++#include + + struct ath79_reset { ++ struct platform_device *pdev; + struct reset_controller_dev rcdev; + struct notifier_block restart_nb; + void __iomem *base; +@@ -21,16 +24,13 @@ struct ath79_reset { + }; + + #define FULL_CHIP_RESET 24 ++#define ETH_SWITCH_RESET 8 ++#define ETH_SWITCH_ARESET 12 + +-static int ath79_reset_update(struct reset_controller_dev *rcdev, ++static void __ath79_reset_update_unlocked(struct ath79_reset *ath79_reset, + unsigned long id, bool assert) + { +- struct ath79_reset *ath79_reset = +- container_of(rcdev, struct ath79_reset, rcdev); +- unsigned long flags; + u32 val; +- +- spin_lock_irqsave(&ath79_reset->lock, flags); + val = readl(ath79_reset->base); + if (assert) + val |= BIT(id); +@@ -39,6 +39,17 @@ static int ath79_reset_update(struct res + writel(val, ath79_reset->base); + /* Flush cache */ + readl(ath79_reset->base); ++} ++ ++static int ath79_reset_update(struct reset_controller_dev *rcdev, ++ unsigned long id, bool assert) ++{ ++ struct ath79_reset *ath79_reset = ++ container_of(rcdev, struct ath79_reset, rcdev); ++ unsigned long flags; ++ ++ spin_lock_irqsave(&ath79_reset->lock, flags); ++ __ath79_reset_update_unlocked(ath79_reset, id, assert); + spin_unlock_irqrestore(&ath79_reset->lock, flags); + + return 0; +@@ -79,8 +90,27 @@ static int ath79_reset_restart_handler(s + { + struct ath79_reset *ath79_reset = + container_of(nb, struct ath79_reset, restart_nb); ++ unsigned long flags; + +- ath79_reset_assert(&ath79_reset->rcdev, FULL_CHIP_RESET); ++ spin_lock_irqsave(&ath79_reset->lock, flags); ++ ++ if (of_device_is_compatible(ath79_reset->pdev->dev.of_node, "qca,ar9340-reset")) { ++ /** ++ * AR9344 has been observed to hang on reboot in rare cases. ++ * ++ * Datasheet states to reset the ETH switch systems before asserting ++ * full chip reset. See page 111 of the AR9344 datasheet. ++ */ ++ __ath79_reset_update_unlocked(ath79_reset, ETH_SWITCH_RESET, true); ++ mdelay(10); ++ __ath79_reset_update_unlocked(ath79_reset, ETH_SWITCH_ARESET, true); ++ mdelay(10); ++ } ++ ++ __ath79_reset_update_unlocked(ath79_reset, FULL_CHIP_RESET, true); ++ mdelay(10); ++ ++ spin_unlock_irqrestore(&ath79_reset->lock, flags); + + return NOTIFY_DONE; + } +@@ -95,6 +125,8 @@ static int ath79_reset_probe(struct plat + if (!ath79_reset) + return -ENOMEM; + ++ ath79_reset->pdev = pdev; ++ + ath79_reset->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(ath79_reset->base)) + return PTR_ERR(ath79_reset->base); From c06d4df9748aea84b9a4ffcbe51b2e6fff94de1e Mon Sep 17 00:00:00 2001 From: David Bauer Date: Sun, 22 Dec 2024 02:56:12 +0100 Subject: [PATCH 322/877] mac80211: set basic-rate for mesh interfaces Basic rates were not set for mesh-interfaces, resulting in the undesired behavior where 11s frames might be sent with a rate which was not configured. Depending on the driver, the basic rate might also be used to determine the beacon rate configured to the chip. One such example are MediaTek MT7915 platforms. Signed-off-by: David Bauer (cherry picked from commit 3ec7f3a512a27f8ca6402954ad2a997176103b4b) --- .../wifi-scripts/files/lib/netifd/wireless/mac80211.sh | 6 ++++++ .../config/wifi-scripts/files/usr/share/hostap/wdev.uc | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh index 42d7bc66d00282..368885246a73b1 100755 --- a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh +++ b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh @@ -846,6 +846,11 @@ mac80211_setup_mesh() { [ -n "$mcast_rate" ] && wpa_supplicant_add_rate mcval "$mcast_rate" [ -n "$mesh_id" ] && ssid="$mesh_id" + brstr= + for br in $basic_rate_list; do + wpa_supplicant_add_rate brstr "$br" + done + local prev json_set_namespace wdev_uc prev @@ -856,6 +861,7 @@ mac80211_setup_mesh() { json_add_string freq "$freq" json_add_string htmode "$iw_htmode" [ -n "$mcval" ] && json_add_string mcast-rate "$mcval" + [ -n "$brstr" ] && json_add_string basic-rates "$brstr" json_add_int beacon-interval "$beacon_int" mac80211_add_mesh_params diff --git a/package/network/config/wifi-scripts/files/usr/share/hostap/wdev.uc b/package/network/config/wifi-scripts/files/usr/share/hostap/wdev.uc index d836a930fc4f9a..166e9403dfce72 100644 --- a/package/network/config/wifi-scripts/files/usr/share/hostap/wdev.uc +++ b/package/network/config/wifi-scripts/files/usr/share/hostap/wdev.uc @@ -45,7 +45,7 @@ function iface_start(wdev) system(cmd); } else if (wdev.mode == "mesh") { let cmd = [ "iw", "dev", ifname, "mesh", "join", wdev.ssid, "freq", wdev.freq, htmode ]; - for (let key in [ "mcast-rate", "beacon-interval" ]) + for (let key in [ "basic-rates", "mcast-rate", "beacon-interval" ]) if (wdev[key]) push(cmd, key, wdev[key]); system(cmd); From 3c8b23fad882cb3313b54a2667646ff17c694d98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Wed, 8 Jan 2025 17:56:16 +0100 Subject: [PATCH 323/877] generic: add gpio-regmap request/free ops patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch is needed on bmips since it fixes issues with GPIOs not being properly configured due to gpio_request_enable not being called on bcm63xx devices. Therefore we can now drop the bcm63268 gpio function patch. Backported from f5b1d340be9488af71e6522c3f10f1ebd1a35446 with the exception of the realtek patch removal. Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit f5b1d340be9488af71e6522c3f10f1ebd1a35446) --- ...0-pinctrl-bcm63268-add-gpio-function.patch | 260 ------------------ ...-regmap-Use-generic-request-free-ops.patch | 131 +++++++++ 2 files changed, 131 insertions(+), 260 deletions(-) delete mode 100644 target/linux/bmips/patches-6.6/110-pinctrl-bcm63268-add-gpio-function.patch create mode 100644 target/linux/generic/pending-6.6/821-gpio-regmap-Use-generic-request-free-ops.patch diff --git a/target/linux/bmips/patches-6.6/110-pinctrl-bcm63268-add-gpio-function.patch b/target/linux/bmips/patches-6.6/110-pinctrl-bcm63268-add-gpio-function.patch deleted file mode 100644 index afd4aa87168d32..00000000000000 --- a/target/linux/bmips/patches-6.6/110-pinctrl-bcm63268-add-gpio-function.patch +++ /dev/null @@ -1,260 +0,0 @@ -From patchwork Tue Dec 24 10:36:45 2024 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 8bit -X-Patchwork-Submitter: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= - -X-Patchwork-Id: 2027352 -Return-Path: - -X-Original-To: incoming@patchwork.ozlabs.org -Delivered-To: patchwork-incoming@legolas.ozlabs.org -Authentication-Results: legolas.ozlabs.org; - dkim=pass (2048-bit key; - unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 - header.s=20230601 header.b=UahONGdE; - dkim-atps=neutral -Authentication-Results: legolas.ozlabs.org; - spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org - (client-ip=2604:1380:45d1:ec00::1; helo=ny.mirrors.kernel.org; - envelope-from=linux-gpio+bounces-14196-incoming=patchwork.ozlabs.org@vger.kernel.org; - receiver=patchwork.ozlabs.org) -Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org - [IPv6:2604:1380:45d1:ec00::1]) - (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) - key-exchange X25519 server-signature ECDSA (secp384r1)) - (No client certificate requested) - by legolas.ozlabs.org (Postfix) with ESMTPS id 4YHWfw1qmwz1yRt - for ; Tue, 24 Dec 2024 21:42:16 +1100 (AEDT) -Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) - (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) - (No client certificate requested) - by ny.mirrors.kernel.org (Postfix) with ESMTPS id C1409161D8A - for ; Tue, 24 Dec 2024 10:37:04 +0000 (UTC) -Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) - by smtp.subspace.kernel.org (Postfix) with ESMTP id C7E791B4132; - Tue, 24 Dec 2024 10:36:55 +0000 (UTC) -Authentication-Results: smtp.subspace.kernel.org; - dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com - header.b="UahONGdE" -X-Original-To: linux-gpio@vger.kernel.org -Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com - [209.85.221.53]) - (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) - (No client certificate requested) - by smtp.subspace.kernel.org (Postfix) with ESMTPS id D319C156F54; - Tue, 24 Dec 2024 10:36:53 +0000 (UTC) -Authentication-Results: smtp.subspace.kernel.org; - arc=none smtp.client-ip=209.85.221.53 -ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; - t=1735036615; cv=none; - b=PEr2vZNz4kb5F2BBGJpTRVGs1Sp8DsmivUP7NnKOWY8KgRPxzLf347SrUxfe6CzXLRpkbCWVoCYMXckrj9poJHbYkU+/I53Nl72IMCm3umwEzLBU+DBhEYh9gmJ1E+IPV+A8Zrs6umt4+Y7IMFxaZA+O2c13TX+AQwjWhRutDPw= -ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; - s=arc-20240116; t=1735036615; c=relaxed/simple; - bh=dXQRhQVd1Zyosn15/gUbEta/P7NJqalhPImmU9urz+Y=; - h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: - MIME-Version:Content-Type; - b=Gb5/JI8lf48IhgVAoC7Sh3vHpBSJCe3+dnVZG4qlAQp3DZVyr+TWYice/Redmrl8JkjoE273hxZ6hFSvJlzF9EclMz0e7k977iOmuQon+N5YlhtfDL94suzV5P9sfXwYvtVjZwnr7aqkRr3w3ihchOawYmk3dg3505bUebInQnk= -ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; - dmarc=pass (p=none dis=none) header.from=gmail.com; - spf=pass smtp.mailfrom=gmail.com; - dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com - header.b=UahONGdE; arc=none smtp.client-ip=209.85.221.53 -Authentication-Results: smtp.subspace.kernel.org; - dmarc=pass (p=none dis=none) header.from=gmail.com -Authentication-Results: smtp.subspace.kernel.org; - spf=pass smtp.mailfrom=gmail.com -Received: by mail-wr1-f53.google.com with SMTP id - ffacd0b85a97d-3862d161947so2420686f8f.3; - Tue, 24 Dec 2024 02:36:53 -0800 (PST) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=gmail.com; s=20230601; t=1735036612; x=1735641412; - darn=vger.kernel.org; - h=content-transfer-encoding:mime-version:references:in-reply-to - :message-id:date:subject:cc:to:from:from:to:cc:subject:date - :message-id:reply-to; - bh=sMhk1A5we+Q0WqaTiBzTXNhUdePPFx1uKEyCWbVNvYc=; - b=UahONGdExN2DP5PBiZ87j1+mGkDzwCd+MCQpZmUblrKP7GD0KfO4OV/GKtEfTO1sYK - pH+O3hs+yDawgBghqREytfRP390tCBpz+65UNn6GkBDU2iptaRDiGcn1nKnPYpkd3P6X - 0zVyYKneAQ/sAcE/VjH0I7HWuyARq5PtnKMegYi8dZmpFXux+gaBjgnSsjPuOyR/xWxN - RP1C9BDzN3NqeptC5oSsG5eB2Rs5niHvJoSbGuKVBPipP+k6qu88w4bfhTIponae1bt1 - gpUV23UfNa49ChxKv0ivW7QfFky1P30da1oXtQsNS0FVVVrHlWJhhivVT7Fuf2g6dgDh - fgTw== -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20230601; t=1735036612; x=1735641412; - h=content-transfer-encoding:mime-version:references:in-reply-to - :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc - :subject:date:message-id:reply-to; - bh=sMhk1A5we+Q0WqaTiBzTXNhUdePPFx1uKEyCWbVNvYc=; - b=btRSTKjTHUEx37dhjkiEkJmdS2tVqBjs7UEaMq1bUwXvN7mwvBDdqJz6RW8W2xFdh6 - m/cDdd2Ao9FpXD5R4SBkvIZQPd95+LaDjw6iz7msVP0dvjc1qTTEqlgKHl3ibs8U7Jro - +1nitU/Nl1I5VSgWSRx0in3pH/aD/dSfNPutLktI7IeegBU6dfXrVXaTsFofys1UjBk/ - bOdQRBEsG+X3rHrNTNuVwLewIwk0RwRp6KT6hlaF7bGdhl1UPuG+AMK7PAFUP4e2D5OK - QmBE6ayI4XOeRQHFCbGG2OUvddtktA8BQzwr28+DwYWADQQiKCuy0UJBtW0DmzaxKr7F - gCIw== -X-Forwarded-Encrypted: i=1; - AJvYcCVHVB9BqpG5+V+fo4vdtCQHh3nIKV69RT+IPj0tFJoUTpQdG+vPR4Iqt7ktLVoMBVXhtsD0DAuZpXFa@vger.kernel.org, - AJvYcCXtcLMfobpgZfmtjLs1KKQ2YT3EaF+0+Mdt7kFCJbskk1e1IbXmjE8SiwRlPc7Xop8LBdifPZoTR1ZCl6PN@vger.kernel.org -X-Gm-Message-State: AOJu0YwqZ5qOpBs+2cK9ou/rHf3nhKSpv1sOAgh/R/uVc6pFB2dqDkjp - okaKt94cn3iBf/E0yr+jvP84miiyWBjHOiwUifpj2I+eg2/hRbLe -X-Gm-Gg: ASbGnctb0LTvTOtGESMAhgeg3r7sjorwh3VXs5dZZezH+8LeYUD4c6SPFEXxiNeIZAv - NZLn9cN6bKQLaVX9lTUF2nNmqijrn8WPhaSpeqeSNnZdNpdoDTqTuYpEhY0y+72yNiTqhDFtbyr - OhCPhYE5VV+HKOekEluViF9bHOmkGhpUmBXyGOQmHPxEnDdZINMAMYHxUBC8E4nuG8p/hyD7dPD - iHXkaNnmD4NjYqjgTyxSACjy6eWinXEuukXXHZVbbJY9nJ4wVWI -X-Google-Smtp-Source: - AGHT+IEbrRmLj2uKOuyl6xkrJtxDUC1KVwEPA3dNsbU/+R2F0ZKZu/sQbMNvRjB6t41GnHxO0mDDAQ== -X-Received: by 2002:a05:6000:4023:b0:385:f220:f788 with SMTP id - ffacd0b85a97d-38a223fd77bmr14541441f8f.48.1735036611884; - Tue, 24 Dec 2024 02:36:51 -0800 (PST) -Received: from skynet.lan ([213.99.205.117]) - by smtp.gmail.com with ESMTPSA id - ffacd0b85a97d-38a1c89e1a1sm13645138f8f.69.2024.12.24.02.36.51 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Tue, 24 Dec 2024 02:36:51 -0800 (PST) -From: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= -To: linus.walleij@linaro.org, - kylehendrydev@gmail.com, - linux-gpio@vger.kernel.org, - linux-kernel@vger.kernel.org -Cc: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= -Subject: [PATCH v2] pinctrl: bcm63268: add gpio function -Date: Tue, 24 Dec 2024 11:36:45 +0100 -Message-Id: <20241224103645.1709996-1-noltari@gmail.com> -X-Mailer: git-send-email 2.39.5 -In-Reply-To: <20241207223335.17535-1-kylehendrydev@gmail.com> -References: <20241207223335.17535-1-kylehendrydev@gmail.com> -Precedence: bulk -X-Mailing-List: linux-gpio@vger.kernel.org -List-Id: -List-Subscribe: -List-Unsubscribe: -MIME-Version: 1.0 - -From: Kyle Hendry - -There is no guarantee that the bootloader will leave the pin configuration -in a known default state, so pinctrl needs to be explicitly set in some -cases. This patch adds a gpio function for drivers that need it, i.e. -gpio-leds. - -Signed-off-by: Kyle Hendry -Signed-off-by: Álvaro Fernández Rojas ---- - drivers/pinctrl/bcm/pinctrl-bcm63268.c | 71 +++++++++++++++++++++++++- - 1 file changed, 70 insertions(+), 1 deletion(-) - ---- a/drivers/pinctrl/bcm/pinctrl-bcm63268.c -+++ b/drivers/pinctrl/bcm/pinctrl-bcm63268.c -@@ -34,6 +34,7 @@ - #define BCM63268_BASEMODE_VDSL_PHY_3 BIT(9) /* GPIOs 26/27 */ - - enum bcm63268_pinctrl_reg { -+ BCM63268_NONE, - BCM63268_LEDCTRL, - BCM63268_MODE, - BCM63268_CTRL, -@@ -242,6 +243,61 @@ static struct pingroup bcm63268_groups[] - BCM_PIN_GROUP(vdsl_phy3_grp), - }; - -+static const char * const gpio_groups[] = { -+ "gpio0", -+ "gpio1", -+ "gpio2", -+ "gpio3", -+ "gpio4", -+ "gpio5", -+ "gpio6", -+ "gpio7", -+ "gpio8", -+ "gpio9", -+ "gpio10", -+ "gpio11", -+ "gpio12", -+ "gpio13", -+ "gpio14", -+ "gpio15", -+ "gpio16", -+ "gpio17", -+ "gpio18", -+ "gpio19", -+ "gpio20", -+ "gpio21", -+ "gpio22", -+ "gpio23", -+ "gpio24", -+ "gpio25", -+ "gpio26", -+ "gpio27", -+ "gpio28", -+ "gpio29", -+ "gpio30", -+ "gpio31", -+ "gpio32", -+ "gpio33", -+ "gpio34", -+ "gpio35", -+ "gpio36", -+ "gpio37", -+ "gpio38", -+ "gpio39", -+ "gpio40", -+ "gpio41", -+ "gpio42", -+ "gpio43", -+ "gpio44", -+ "gpio45", -+ "gpio46", -+ "gpio47", -+ "gpio48", -+ "gpio49", -+ "gpio50", -+ "gpio51", -+}; -+ - static const char * const led_groups[] = { - "gpio0", - "gpio1", -@@ -394,6 +450,14 @@ static const char * const vdsl_phy_overr - "vdsl_phy_override_3_grp", - }; - -+#define BCM63268_GPIO_FUN(n) \ -+ { \ -+ .name = #n, \ -+ .groups = n##_groups, \ -+ .num_groups = ARRAY_SIZE(n##_groups), \ -+ .reg = BCM63268_NONE, \ -+ } -+ - #define BCM63268_LED_FUN(n) \ - { \ - .name = #n, \ -@@ -428,6 +492,7 @@ static const char * const vdsl_phy_overr - } - - static const struct bcm63268_function bcm63268_funcs[] = { -+ BCM63268_GPIO_FUN(gpio), - BCM63268_LED_FUN(led), - BCM63268_MODE_FUN(serial_led_clk), - BCM63268_MODE_FUN(serial_led_data), -@@ -542,6 +607,9 @@ static int bcm63268_pinctrl_set_mux(stru - bcm63268_set_gpio(pc, pg->pins[i]); - - switch (f->reg) { -+ case BCM63268_NONE: -+ reg = 0; -+ break; - case BCM63268_LEDCTRL: - reg = BCM63268_LED_REG; - mask = BIT(pg->pins[0]); -@@ -567,7 +635,8 @@ static int bcm63268_pinctrl_set_mux(stru - return -EINVAL; - } - -- regmap_update_bits(pc->regs, reg, mask, val); -+ if (reg) -+ regmap_update_bits(pc->regs, reg, mask, val); - - return 0; - } diff --git a/target/linux/generic/pending-6.6/821-gpio-regmap-Use-generic-request-free-ops.patch b/target/linux/generic/pending-6.6/821-gpio-regmap-Use-generic-request-free-ops.patch new file mode 100644 index 00000000000000..344a5b1c5a7482 --- /dev/null +++ b/target/linux/generic/pending-6.6/821-gpio-regmap-Use-generic-request-free-ops.patch @@ -0,0 +1,131 @@ +From patchwork Tue Jan 7 20:16:20 2025 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +X-Patchwork-Submitter: Sander Vanheule +X-Patchwork-Id: 2031059 +Return-Path: + +X-Original-To: incoming@patchwork.ozlabs.org +Delivered-To: patchwork-incoming@legolas.ozlabs.org +Authentication-Results: legolas.ozlabs.org; + dkim=pass (2048-bit key; + secure) header.d=svanheule.net header.i=@svanheule.net header.a=rsa-sha256 + header.s=mail1707 header.b=YjCvLC2H; + dkim-atps=neutral +Authentication-Results: legolas.ozlabs.org; + spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org + (client-ip=2604:1380:4601:e00::3; helo=am.mirrors.kernel.org; + envelope-from=linux-gpio+bounces-14582-incoming=patchwork.ozlabs.org@vger.kernel.org; + receiver=patchwork.ozlabs.org) +Received: from am.mirrors.kernel.org (am.mirrors.kernel.org + [IPv6:2604:1380:4601:e00::3]) + (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) + key-exchange X25519 server-signature ECDSA (secp384r1)) + (No client certificate requested) + by legolas.ozlabs.org (Postfix) with ESMTPS id 4YSMxB3WwSz1yPG + for ; Wed, 8 Jan 2025 07:25:18 +1100 (AEDT) +Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) + (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) + (No client certificate requested) + by am.mirrors.kernel.org (Postfix) with ESMTPS id A7B811887AD1 + for ; Tue, 7 Jan 2025 20:25:19 +0000 (UTC) +Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) + by smtp.subspace.kernel.org (Postfix) with ESMTP id C09A21F63FE; + Tue, 7 Jan 2025 20:25:11 +0000 (UTC) +Authentication-Results: smtp.subspace.kernel.org; + dkim=pass (2048-bit key) header.d=svanheule.net header.i=@svanheule.net + header.b="YjCvLC2H" +X-Original-To: linux-gpio@vger.kernel.org +Received: from polaris.svanheule.net (polaris.svanheule.net [84.16.241.116]) + (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) + (No client certificate requested) + by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8DD631DF97A + for ; Tue, 7 Jan 2025 20:25:07 +0000 (UTC) +Authentication-Results: smtp.subspace.kernel.org; + arc=none smtp.client-ip=84.16.241.116 +ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; + t=1736281511; cv=none; + b=Xe/s+ul4S/+nhYxSMqUWJ/GXKP+J7uJo6tFw/w5bTXcmGxkbpCXTLOiTNXAhv8PMhTfsLYSQes6VF8dzDXaJxL4c8SlQsPNfGH/PqecmSvFMbZTz1XbjP9mBUCvX9lxCH8CSRavkuPuYdhss3a56TgaFzi9GifUSHCsHGs7+xk0= +ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; + s=arc-20240116; t=1736281511; c=relaxed/simple; + bh=31kjLyaoVOzIAs1m+zMi59Ia2jUwYW56Jp1YE6hLflg=; + h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; + b=q7miNkZBtMq3dcxL5HMjUpP3EFdQ7/xU/WnWIFVl6MK4rszqphqvaziMOK6avsn+UA5pAx2JJV8bDY8LfNhiVWwZtPfxbikjjZFm1HYlCDWmGudasM0b//K3/On625L4iqFWmVmLUdEdhvwIkJKSL4wTfN0OMz27EI272o5ygLg= +ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; + dmarc=pass (p=none dis=none) header.from=svanheule.net; + spf=pass smtp.mailfrom=svanheule.net; + dkim=pass (2048-bit key) header.d=svanheule.net header.i=@svanheule.net + header.b=YjCvLC2H; arc=none smtp.client-ip=84.16.241.116 +Authentication-Results: smtp.subspace.kernel.org; + dmarc=pass (p=none dis=none) header.from=svanheule.net +Authentication-Results: smtp.subspace.kernel.org; + spf=pass smtp.mailfrom=svanheule.net +Received: from terra.vega.svanheule.net (unknown [94.110.49.146]) + (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) + key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest + SHA256) + (No client certificate requested) + (Authenticated sender: sander@svanheule.net) + by polaris.svanheule.net (Postfix) with ESMTPSA id 1E18459A0D6; + Tue, 7 Jan 2025 21:17:02 +0100 (CET) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svanheule.net; + s=mail1707; t=1736281022; + h=from:from:reply-to:subject:subject:date:date:message-id:message-id: + to:to:cc:cc:mime-version:mime-version:content-type:content-type: + content-transfer-encoding:content-transfer-encoding; + bh=yNGIiTe7uonx3NZIc6+B7LVjvR8RnIV2zq++EO7NLhg=; + b=YjCvLC2HqArIGWGFkNYmh+oloGi7ZFo7WZGlTbxuHqrQVJ6mLNoLCTCkPkX1EJWEQyNysD + Jj+7tBnAYyCrJ0NuSTD9CPW1+KwKP4wlvWpBUlayCdUJyU4rzjqmlYAI5vJ1UX8FOnvEpn + KeWjgjbeMI6dvIE7ATPFkDvMrDxR9KSEe/1pfzY3E5jh1T8tcnTRMQKTll7hSUBN63dVfJ + U7wnHRLvwx8ESIjrHDKOlsSohmV6lyQTrgEeE2RCM6SpZPNoSpPVjTinF1kPuMHNWHV+Th + 6eDOblXxt859JECDowM0NjF87XJqjgph22+A1WUV4iaePO4GIWo9DQ3KhP/Pyg== +From: Sander Vanheule +To: Michael Walle , + Linus Walleij , + Bartosz Golaszewski , + linux-gpio@vger.kernel.org, + linux-kernel@vger.kernel.org +Cc: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= , + jonas.gorski@gmail.com, kylehendrydev@gmail.com, + florian.fainelli@broadcom.com, Sander Vanheule +Subject: [PATCH] gpio: regmap: Use generic request/free ops +Date: Tue, 7 Jan 2025 21:16:20 +0100 +Message-ID: <20250107201621.12467-1-sander@svanheule.net> +X-Mailer: git-send-email 2.47.1 +Precedence: bulk +X-Mailing-List: linux-gpio@vger.kernel.org +List-Id: +List-Subscribe: +List-Unsubscribe: +MIME-Version: 1.0 + +Set the gpiochip request and free ops to the generic implementations. +This way a user can provide a gpio-ranges property defined for a pinmux, +easing muxing of gpio functions. Provided that the pin controller +implementents the pinmux op .gpio_request_enable(), pins will +automatically be muxed to their GPIO function when requested. + +Signed-off-by: Sander Vanheule +Acked-by: Michael Walle +--- +Álvaro has submitted a similar patch today. My implementation's impact +is more limited, but I hadn't gotten around to submitting it yet. + +For the original (short) discussion, see: +https://lore.kernel.org/linux-gpio/20250107102735.317446-1-noltari@gmail.com/T/#t + + drivers/gpio/gpio-regmap.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/gpio/gpio-regmap.c ++++ b/drivers/gpio/gpio-regmap.c +@@ -262,6 +262,8 @@ struct gpio_regmap *gpio_regmap_register + chip->label = config->label ?: dev_name(config->parent); + chip->can_sleep = regmap_might_sleep(config->regmap); + ++ chip->request = gpiochip_generic_request; ++ chip->free = gpiochip_generic_free; + chip->get = gpio_regmap_get; + if (gpio->reg_set_base && gpio->reg_clr_base) + chip->set = gpio_regmap_set_with_clear; From 66229e2093f3247adaf2d7b62bf90df8254f8959 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 31 Dec 2024 12:23:53 +0100 Subject: [PATCH 324/877] ipq40xx: dts: add ethernet0 alias for all devices Updating the driver patches for ipq40xx (correctly) removed the ethernet0 alias from qcom-ipq4019.dtsi; however, on some devices this alias is needed for the bootloader to set MAC addresses in the FDT. As it is unknown which devices actually need the alias, simply add it to all devices trees for now that enable the &gmac now to avoid regressions from previous OpenWrt releases. The additional alias should not cause any issues even when it is not needed. A TODO comment is added to the same Device Trees to document that the alias may not be needed (hopefully preventing it from being copied unnecessarily to newly added devices in the future). The following devices are known to need the alias for correct MAC address assignment, so no TODO comment is added: - FRITZ!Box 4040 - FRITZ!Box 7530 Fixes: cd9c7211241e ("ipq40xx: 6.1: use latest DSA and ethernet patches") Signed-off-by: Matthias Schiffer Link: https://github.com/openwrt/openwrt/pull/17442 Signed-off-by: Robert Marko (cherry picked from commit d09dd75fbd1314ec5f3571511195da4012d7a51a) --- .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-a42.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4018-ap120c-ac.dts | 2 ++ .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-cap-ac.dts | 2 ++ .../arm/boot/dts/qcom/qcom-ipq4018-cs-w3-wd1200g-eup.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4018-dap-2610.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4018-ea6350v3.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4018-eap1300.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4018-ex61x0v2.dtsi | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4018-fritzbox-4040.dts | 1 + .../arch/arm/boot/dts/qcom/qcom-ipq4018-gl-a1300.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4018-gl-ap1300.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4018-hap-ac2.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4018-jalapeno.dtsi | 2 ++ .../arm/boot/dts/qcom/qcom-ipq4018-magic-2-wifi-next.dts | 5 +++++ .../arch/arm/boot/dts/qcom/qcom-ipq4018-mf287_common.dtsi | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4018-nbg6617.dts | 2 ++ .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-pa1200.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4018-rt-ac58u.dts | 2 ++ .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4018-sxtsq-5-ac.dts | 2 ++ .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wac510.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4018-wap-ac.dtsi | 2 ++ .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-whw01.dts | 2 ++ .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wr-1.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4018-wrtq-329acn.dts | 5 +++++ .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-a62.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4019-cm520-79f.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4019-e2600ac-c1.dts | 5 +++++ .../arch/arm/boot/dts/qcom/qcom-ipq4019-e2600ac-c2.dts | 5 +++++ .../arch/arm/boot/dts/qcom/qcom-ipq4019-fritzbox-7530.dts | 1 + .../arm/boot/dts/qcom/qcom-ipq4019-fritzrepeater-1200.dts | 2 ++ .../arm/boot/dts/qcom/qcom-ipq4019-fritzrepeater-3000.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4019-gl-b2200.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4019-habanero-dvk.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4019-hap-ac3-lte6-kit.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4019-hap-ac3.dts | 2 ++ .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-lbr20.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4019-lhgg-60ad.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4019-map-ac2200.dts | 2 ++ .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf18a.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4019-mf282plus.dts | 2 ++ .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf286d.dts | 2 ++ .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf289f.dts | 2 ++ .../arm/boot/dts/qcom/qcom-ipq4019-ncp-hg100-cellular.dts | 2 ++ .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-pa2200.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4019-r619ac.dtsi | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4019-rt-ac42u.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4019-rtl30vw.dts | 2 ++ .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-whw03.dtsi | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4019-wia3300-20.dts | 2 ++ .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-wifi.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4019-wtr-m2133hp.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4019-xx8300.dtsi | 5 +++++ .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4028-wpj428.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4029-ap-303h.dts | 2 ++ .../arm/boot/dts/qcom/qcom-ipq4029-aruba-glenmorangie.dtsi | 5 +++++ .../arch/arm/boot/dts/qcom/qcom-ipq4029-gl-b1300.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4029-insect-common.dtsi | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4029-ws-ap3915i.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4029-ws-ap391x.dts | 2 ++ .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq40x9-dr40x9.dts | 5 +++++ 61 files changed, 141 insertions(+) diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-a42.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-a42.dts index c117a905388a6e..6d1babf00e96c8 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-a42.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-a42.dts @@ -52,6 +52,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_status_green; led-failsafe = &led_status_green; led-running = &led_status_green; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-ap120c-ac.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-ap120c-ac.dts index f2e2ed3f7f6c7d..83b4addb796617 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-ap120c-ac.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-ap120c-ac.dts @@ -15,6 +15,8 @@ led-failsafe = &status; led-running = &status; led-upgrade = &status; + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; ethernet1 = &swport5; }; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-cap-ac.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-cap-ac.dts index b061428bb34f58..f2690a095d9bac 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-cap-ac.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-cap-ac.dts @@ -21,6 +21,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_user; led-failsafe = &led_user; led-running = &led_user; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-cs-w3-wd1200g-eup.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-cs-w3-wd1200g-eup.dts index 8d09bfd0b7acf0..469a6ca7576db3 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-cs-w3-wd1200g-eup.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-cs-w3-wd1200g-eup.dts @@ -11,6 +11,8 @@ compatible = "ezviz,cs-w3-wd1200g-eup"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_status_green; led-failsafe = &led_status_red; led-running = &led_status_blue; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-dap-2610.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-dap-2610.dts index df5d9331a1e856..69164540cd4eef 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-dap-2610.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-dap-2610.dts @@ -11,6 +11,8 @@ compatible = "dlink,dap-2610"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_red; led-failsafe = &led_red; led-running = &led_green; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-ea6350v3.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-ea6350v3.dts index e80a54024450c1..6cace3b88f05cb 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-ea6350v3.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-ea6350v3.dts @@ -11,6 +11,8 @@ compatible = "linksys,ea6350v3"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &power; led-failsafe = &power; led-running = &power; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-eap1300.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-eap1300.dts index 52a96eae980184..5bd5180efd2ec6 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-eap1300.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-eap1300.dts @@ -41,6 +41,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &power; led-failsafe = &power; led-running = &power; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-ex61x0v2.dtsi b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-ex61x0v2.dtsi index ca064837c86e18..a13fc71987339a 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-ex61x0v2.dtsi +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-ex61x0v2.dtsi @@ -46,6 +46,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &power_amber; led-failsafe = &power_amber; led-running = &power_green; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-fritzbox-4040.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-fritzbox-4040.dts index b3617eb45eeed0..6aef86ad26f46b 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-fritzbox-4040.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-fritzbox-4040.dts @@ -11,6 +11,7 @@ compatible = "avm,fritzbox-4040"; aliases { + ethernet0 = &gmac; led-boot = &power; led-failsafe = &flash; led-running = &power; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-gl-a1300.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-gl-a1300.dts index d8b4300a5205bf..4293191b075852 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-gl-a1300.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-gl-a1300.dts @@ -11,6 +11,8 @@ compatible = "glinet,gl-a1300", "qcom,ipq4019"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_run; led-failsafe = &led_run; led-running = &led_run; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-gl-ap1300.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-gl-ap1300.dts index bb197c27427773..4ed8a82af6fe3b 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-gl-ap1300.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-gl-ap1300.dts @@ -11,6 +11,8 @@ compatible = "glinet,gl-ap1300"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_power; led-failsafe = &led_power; led-running = &led_power; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-hap-ac2.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-hap-ac2.dts index 07ad4d3d5209ba..d91725dfb7b9e9 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-hap-ac2.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-hap-ac2.dts @@ -21,6 +21,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_user; led-failsafe = &led_user; led-running = &led_user; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-jalapeno.dtsi b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-jalapeno.dtsi index 9828b4b34efdbc..fcacb98cb9b55e 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-jalapeno.dtsi +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-jalapeno.dtsi @@ -8,6 +8,8 @@ / { aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; ethernet1 = &swport5; }; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-magic-2-wifi-next.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-magic-2-wifi-next.dts index 293bf3d20a0f1a..5deb9ba3de2522 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-magic-2-wifi-next.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-magic-2-wifi-next.dts @@ -9,6 +9,11 @@ model = "devolo Magic 2 WiFi next"; compatible = "devolo,magic-2-wifi-next"; + aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; + }; + memory { device_type = "memory"; reg = <0x80000000 0x10000000>; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-mf287_common.dtsi b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-mf287_common.dtsi index bf2fc0e37e2e59..c19262497d7674 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-mf287_common.dtsi +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-mf287_common.dtsi @@ -11,6 +11,8 @@ / { aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_status; led-failsafe = &led_status; led-running = &led_status; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-nbg6617.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-nbg6617.dts index 957ccb306c705f..2b79169c0df08e 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-nbg6617.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-nbg6617.dts @@ -21,6 +21,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &power; led-failsafe = &power; led-running = &power; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-pa1200.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-pa1200.dts index a353c7f9f3d0d4..8040bb494b1934 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-pa1200.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-pa1200.dts @@ -52,6 +52,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_status_purple; led-failsafe = &led_status_yellow; led-running = &led_status_cyan; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rt-ac58u.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rt-ac58u.dts index e58b3378d5743b..946b3b3038f14c 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rt-ac58u.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rt-ac58u.dts @@ -16,6 +16,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_power; led-failsafe = &led_power; led-running = &led_power; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts index ea2102f7d6a7ef..56d920a6ddeae7 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts @@ -7,6 +7,8 @@ compatible = "teltonika,rutx50"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_rssi0; led-failsafe = &led_rssi0; led-running = &led_rssi0; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-sxtsq-5-ac.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-sxtsq-5-ac.dts index 23e9457f029d0c..d434145278c177 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-sxtsq-5-ac.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-sxtsq-5-ac.dts @@ -21,6 +21,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_user; led-failsafe = &led_user; led-running = &led_user; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wac510.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wac510.dts index 8515f3c0347877..982ceef044e759 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wac510.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wac510.dts @@ -16,6 +16,8 @@ led-failsafe = &led_power_amber; led-running = &led_power_green; led-upgrade = &led_power_amber; + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; ethernet1 = &swport5; }; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wap-ac.dtsi b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wap-ac.dtsi index 2b357a1f03335f..f8b458f9f7953f 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wap-ac.dtsi +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wap-ac.dtsi @@ -18,6 +18,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_user; led-failsafe = &led_user; led-running = &led_user; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-whw01.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-whw01.dts index 1f26db586905ef..fe6e8626ea8989 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-whw01.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-whw01.dts @@ -10,6 +10,8 @@ compatible = "linksys,whw01"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; serial0 = &blsp1_uart1; led-boot = &led_system_blue; led-running = &led_system_blue; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wr-1.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wr-1.dts index dd56cb215e8e0e..990eb70daae853 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wr-1.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wr-1.dts @@ -11,6 +11,8 @@ compatible = "pakedge,wr-1"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; label-mac-device = &gmac; led-boot = &led_power; led-failsafe = &led_power; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wrtq-329acn.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wrtq-329acn.dts index fc5a7a94aa3cd3..7c8e81de330399 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wrtq-329acn.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wrtq-329acn.dts @@ -9,6 +9,11 @@ model = "Luma Home WRTQ-329ACN"; compatible = "luma,wrtq-329acn"; + aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; + }; + i2c-gpio { compatible = "i2c-gpio"; sda-gpios = <&tlmm 1 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-a62.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-a62.dts index d8249236f04009..79242a42e43c50 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-a62.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-a62.dts @@ -52,6 +52,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_status_green; led-failsafe = &led_status_green; led-running = &led_status_green; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-cm520-79f.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-cm520-79f.dts index 3569d6e53ab712..3346fc8098f6d6 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-cm520-79f.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-cm520-79f.dts @@ -11,6 +11,8 @@ compatible = "mobipromo,cm520-79f"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_sys; led-failsafe = &led_sys; led-running = &led_sys; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-e2600ac-c1.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-e2600ac-c1.dts index 243d19fb033da8..00fc918ccfc2d8 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-e2600ac-c1.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-e2600ac-c1.dts @@ -11,6 +11,11 @@ / { model = "Qxwlan E2600AC c1"; compatible = "qxwlan,e2600ac-c1"; + + aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; + }; }; &blsp1_spi1 { diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-e2600ac-c2.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-e2600ac-c2.dts index e065ef0168016d..c2c602114f8983 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-e2600ac-c2.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-e2600ac-c2.dts @@ -11,6 +11,11 @@ / { model = "Qxwlan E2600AC c2"; compatible = "qxwlan,e2600ac-c2"; + + aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; + }; }; &blsp1_spi1 { diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzbox-7530.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzbox-7530.dts index 4f6cafb8853861..39905d4342ddf6 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzbox-7530.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzbox-7530.dts @@ -15,6 +15,7 @@ }; aliases { + ethernet0 = &gmac; led-boot = &power_green; led-failsafe = &info_red; led-running = &power_green; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzrepeater-1200.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzrepeater-1200.dts index 106c8031e31d52..e60cd42778d496 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzrepeater-1200.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzrepeater-1200.dts @@ -11,6 +11,8 @@ compatible = "avm,fritzrepeater-1200"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &power_green; led-failsafe = &power_red; led-running = &power_green; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzrepeater-3000.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzrepeater-3000.dts index e8daef63f1456e..f720be6d03bcf9 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzrepeater-3000.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzrepeater-3000.dts @@ -11,6 +11,8 @@ compatible = "avm,fritzrepeater-3000"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &power_led; led-failsafe = &power_led; led-running = &power_led; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-gl-b2200.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-gl-b2200.dts index 89ba523e57dc41..33400170c85427 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-gl-b2200.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-gl-b2200.dts @@ -20,6 +20,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; ethernet1 = &swport4; }; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-habanero-dvk.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-habanero-dvk.dts index 94be4d976e26a7..d792599f1a2ae1 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-habanero-dvk.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-habanero-dvk.dts @@ -12,6 +12,8 @@ compatible = "8dev,habanero-dvk"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_status; led-failsafe = &led_status; led-running = &led_status; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-hap-ac3-lte6-kit.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-hap-ac3-lte6-kit.dts index b1a04012fb2a80..881abc23dbe3ec 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-hap-ac3-lte6-kit.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-hap-ac3-lte6-kit.dts @@ -21,6 +21,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_status_blue; led-failsafe = &led_status_red; led-running = &led_status_blue; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-hap-ac3.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-hap-ac3.dts index 4a3a323b5ffc5b..bd7f1b5cb982d1 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-hap-ac3.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-hap-ac3.dts @@ -21,6 +21,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_status_blue; led-failsafe = &led_status_red; led-running = &led_status_blue; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-lbr20.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-lbr20.dts index 4e5497cbc30c20..09d9a8f3ddf675 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-lbr20.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-lbr20.dts @@ -15,6 +15,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_backlight_white; led-failsafe = &led_status_green; led-running = &led_status_green; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-lhgg-60ad.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-lhgg-60ad.dts index a5b55ff421f4dc..b042329bc7b135 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-lhgg-60ad.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-lhgg-60ad.dts @@ -35,6 +35,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &user; led-failsafe = &user; led-running = &user; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-map-ac2200.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-map-ac2200.dts index 7ec3c6a9ae7c8c..e3a5ad7be5c095 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-map-ac2200.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-map-ac2200.dts @@ -15,6 +15,8 @@ led-failsafe = &led_red0; led-running = &led_blue0; led-upgrade = &led_red0; + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; ethernet1 = &swport4; }; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf18a.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf18a.dts index 7c0260ec3c531d..3eaa75b520b747 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf18a.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf18a.dts @@ -14,6 +14,8 @@ compatible = "zte,mf18a"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_power; led-failsafe = &led_power; led-running = &led_power; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf282plus.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf282plus.dts index a4606dd21cbde9..80a729e96328cc 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf282plus.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf282plus.dts @@ -13,6 +13,8 @@ compatible = "zte,mf282plus"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_internal; led-failsafe = &led_internal; led-running = &led_internal; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf286d.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf286d.dts index 06d65b8944160e..91cf49b1b0065e 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf286d.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf286d.dts @@ -12,6 +12,8 @@ compatible = "zte,mf286d"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_internal; led-failsafe = &led_internal; led-running = &led_internal; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf289f.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf289f.dts index f5a985b6d1692f..f03717be33093d 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf289f.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf289f.dts @@ -13,6 +13,8 @@ compatible = "zte,mf289f"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_status; led-failsafe = &led_status; led-running = &led_status; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-ncp-hg100-cellular.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-ncp-hg100-cellular.dts index e115c211aab0e2..4bef4994990ba3 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-ncp-hg100-cellular.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-ncp-hg100-cellular.dts @@ -12,6 +12,8 @@ compatible = "sony,ncp-hg100-cellular"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_cloud_green; led-failsafe = &led_cloud_red; led-running = &led_cloud_green; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-pa2200.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-pa2200.dts index f87ab074162b48..f4c64d6b0615c6 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-pa2200.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-pa2200.dts @@ -44,6 +44,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_power_orange; led-failsafe = &led_status_blue; led-running = &led_power_orange; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-r619ac.dtsi b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-r619ac.dtsi index 0463c61236e80f..5ebbaa90ade009 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-r619ac.dtsi +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-r619ac.dtsi @@ -12,6 +12,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_sys; led-failsafe = &led_sys; led-running = &led_sys; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-rt-ac42u.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-rt-ac42u.dts index 3cd8997a92597e..48b2e43d18ee3a 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-rt-ac42u.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-rt-ac42u.dts @@ -16,6 +16,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_power; led-failsafe = &led_power; led-running = &led_power; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-rtl30vw.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-rtl30vw.dts index 7a13241b661f9e..593b3959fc14d8 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-rtl30vw.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-rtl30vw.dts @@ -14,6 +14,8 @@ compatible = "cellc,rtl30vw"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_power_blue; led-failsafe = &led_power_red; led-running = &led_power_blue; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-whw03.dtsi b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-whw03.dtsi index 54e3cc7818c183..cb12381022c0fa 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-whw03.dtsi +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-whw03.dtsi @@ -8,6 +8,8 @@ / { aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_blue; led-failsafe = &led_red; led-running = &led_blue; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-wia3300-20.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-wia3300-20.dts index 644329419d97a9..887762bd232ab3 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-wia3300-20.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-wia3300-20.dts @@ -11,6 +11,8 @@ model = "SKSpruce WIA3300-20"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; label-mac-device = &gmac; led-boot = &led_status_red; led-failsafe = &led_status_lime; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-wifi.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-wifi.dts index f2e39c87aef43e..c6113e7aab0fab 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-wifi.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-wifi.dts @@ -14,6 +14,8 @@ compatible = "google,wifi", "google,gale-v2", "qcom,ipq4019"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; label-mac-device = &gmac0; led-boot = &led0_blue; led-failsafe = &led0_red; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-wtr-m2133hp.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-wtr-m2133hp.dts index ab985dfce160e0..c892bf0c5bef4c 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-wtr-m2133hp.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-wtr-m2133hp.dts @@ -29,6 +29,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_power_blue; led-failsafe = &led_power_orange; led-running = &led_power_white; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-xx8300.dtsi b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-xx8300.dtsi index 0673dc0241657f..3bcc5c3cec269f 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-xx8300.dtsi +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-xx8300.dtsi @@ -26,6 +26,11 @@ }; + aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; + }; + soc { tcsr@1949000 { compatible = "qcom,tcsr"; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4028-wpj428.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4028-wpj428.dts index 517d691d10552b..fd7878b47a0905 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4028-wpj428.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4028-wpj428.dts @@ -73,6 +73,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &status; led-failsafe = &status; led-upgrade = &status; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-ap-303h.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-ap-303h.dts index 62270272662934..1cb1b9d5dd9991 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-ap-303h.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-ap-303h.dts @@ -10,6 +10,8 @@ compatible = "aruba,ap-303h"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_system_green; led-failsafe = &led_system_red; led-running = &led_system_green; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-aruba-glenmorangie.dtsi b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-aruba-glenmorangie.dtsi index 7f8f9be7956790..520ccdfd1cc3ae 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-aruba-glenmorangie.dtsi +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-aruba-glenmorangie.dtsi @@ -6,6 +6,11 @@ #include / { + aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; + }; + memory { device_type = "memory"; reg = <0x80000000 0x10000000>; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-gl-b1300.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-gl-b1300.dts index dfb639e2bbb2ea..2aea68d5205a1b 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-gl-b1300.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-gl-b1300.dts @@ -25,6 +25,8 @@ compatible = "glinet,gl-b1300"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &power; led-failsafe = &power; led-running = &power; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-insect-common.dtsi b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-insect-common.dtsi index 8286e1899f8c75..9d2f7ce1bc205a 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-insect-common.dtsi +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-insect-common.dtsi @@ -20,6 +20,8 @@ / { aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &status_green; led-failsafe = &status_red; led-running = &status_green; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-ws-ap3915i.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-ws-ap3915i.dts index 48e0bb903e5450..533ff388a9fbf0 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-ws-ap3915i.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-ws-ap3915i.dts @@ -10,6 +10,8 @@ compatible = "extreme-networks,ws-ap3915i"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_system_green; led-failsafe = &led_system_amber; led-running = &led_system_green; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-ws-ap391x.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-ws-ap391x.dts index 1eb6ea2eb895b0..1fe8f8536a53bc 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-ws-ap391x.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-ws-ap391x.dts @@ -10,6 +10,8 @@ compatible = "extreme-networks,ws-ap391x"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_system_green; led-failsafe = &led_system_red; led-running = &led_system_green; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq40x9-dr40x9.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq40x9-dr40x9.dts index 271a97209255a4..177e38ad833bf8 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq40x9-dr40x9.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq40x9-dr40x9.dts @@ -9,6 +9,11 @@ model = "Wallystech DR40X9"; compatible = "wallys,dr40x9"; + aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; + }; + chosen { bootargs-append = " ubi.mtd=ubi root=/dev/ubiblock0_1"; }; From 38d79aca0eb22218b5dcc2ada98cde4bb734bc9c Mon Sep 17 00:00:00 2001 From: Florian Maurer Date: Thu, 9 Jan 2025 00:46:18 +0100 Subject: [PATCH 325/877] ipq40xx: fix label MAC address for Linksys WHW03 v2 The label MAC address is written inside the case of the whw03 v2 at the bottom. Similar fix as to the 4040 in b22d382ae4eaa1af42930115d91855f402314cac Signed-off-by: Florian Maurer Link: https://github.com/openwrt/openwrt/pull/17535 Signed-off-by: Robert Marko (cherry picked from commit c113982706989c76c69e94e15abce0d316e97f6b) --- .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-whw03.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-whw03.dtsi b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-whw03.dtsi index cb12381022c0fa..6c9eaadd77078d 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-whw03.dtsi +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-whw03.dtsi @@ -8,12 +8,12 @@ / { aliases { - // TODO: Verify if the ethernet0 alias is needed ethernet0 = &gmac; led-boot = &led_blue; led-failsafe = &led_red; led-running = &led_blue; led-upgrade = &led_red; + label-mac-device = &gmac; }; soc { From 98bcdd191db406a2ca1c458c1252a6d4a0169d22 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Tue, 3 Dec 2024 13:29:37 -0800 Subject: [PATCH 326/877] lantiq: use regulator for USB GPIO One is already present. The other one can be implemented in terms of the PHY. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/17250 Signed-off-by: John Crispin Link: https://github.com/openwrt/openwrt/pull/17512 Signed-off-by: Robert Marko --- .../mips/boot/dts/lantiq/ar9_zte_h201l.dts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/ar9_zte_h201l.dts b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/ar9_zte_h201l.dts index a0e3664b6dbcd2..3e8cbcf84bc91c 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/ar9_zte_h201l.dts +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/ar9_zte_h201l.dts @@ -96,11 +96,6 @@ gpio-export,output = <1>; gpios = <&gpio 38 GPIO_ACTIVE_HIGH>; }; - usb { - gpio-export,name = "usb"; - gpio-export,output = <1>; - gpios = <&gpio 28 GPIO_ACTIVE_HIGH>; - }; wifi { gpio-export,name = "wifi"; gpio-export,output = <1>; @@ -108,6 +103,18 @@ }; }; + usb_phy: regulator-usb-phy { + compatible = "regulator-fixed"; + + regulator-name = "USB_PHY"; + + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + + gpios = <&gpio 28 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; + usb_vbus: regulator-usb-vbus { compatible = "regulator-fixed"; @@ -166,6 +173,7 @@ &usb_phy0 { status = "okay"; + phy-supply = <&usb_phy>; }; From 7111d847870870e8f297c4e3ccafa632f56c8acb Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Mon, 16 Dec 2024 15:07:50 -0800 Subject: [PATCH 327/877] lantiq: use nvmem for fritz73x0 These units use AR9287, which has a calibration size of 3d8. Also fixed compatible string to the proper one to indicate AR9287. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/17278 Signed-off-by: Hauke Mehrtens Link: https://github.com/openwrt/openwrt/pull/17512 Signed-off-by: Robert Marko --- .../arch/mips/boot/dts/lantiq/ar9_avm_fritz7312.dts | 9 +++++++-- .../arch/mips/boot/dts/lantiq/ar9_avm_fritz7320.dts | 9 +++++++-- .../base-files/etc/hotplug.d/firmware/12-ath9k-eeprom | 3 --- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/ar9_avm_fritz7312.dts b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/ar9_avm_fritz7312.dts index 9ea6c3929cb7c7..ba6c48704893bd 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/ar9_avm_fritz7312.dts +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/ar9_avm_fritz7312.dts @@ -136,6 +136,10 @@ #address-cells = <1>; #size-cells = <1>; + cal_ath9k_cal_985: calibration@985 { + reg = <0x985 0x3d8>; + }; + macaddr_ath9k_cal_a91: macaddr@a91 { compatible = "mac-base"; reg = <0xa91 0x6>; @@ -180,8 +184,9 @@ reset-gpios = <&gpio 21 GPIO_ACTIVE_LOW>; wifi@0,0 { - compatible = "pci0,0"; + compatible = "pci168c,002d"; reg = <0x7000 0 0 0 0>; - qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:00:0e.0.bin */ + nvmem-cells = <&cal_ath9k_cal_985>; + nvmem-cell-names = "calibration"; }; }; diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/ar9_avm_fritz7320.dts b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/ar9_avm_fritz7320.dts index 953a8ccbf740ac..c09d3879b4209b 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/ar9_avm_fritz7320.dts +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/ar9_avm_fritz7320.dts @@ -163,6 +163,10 @@ #address-cells = <1>; #size-cells = <1>; + cal_ath9k_cal_985: calibration@985 { + reg = <0x985 0x3d8>; + }; + macaddr_ath9k_cal_a91: macaddr@a91 { compatible = "mac-base"; reg = <0xa91 0x6>; @@ -206,9 +210,10 @@ reset-gpios = <&gpio 21 GPIO_ACTIVE_LOW>; wifi@0,0 { - compatible = "pci0,0"; + compatible = "pci168c,002d"; reg = <0x7000 0 0 0 0>; - qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:00:0e.0.bin */ + nvmem-cells = <&cal_ath9k_cal_985>; + nvmem-cell-names = "calibration"; }; }; diff --git a/target/linux/lantiq/xway/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom b/target/linux/lantiq/xway/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom index 98bb9af6947a29..91eb3f16806ce3 100644 --- a/target/linux/lantiq/xway/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom +++ b/target/linux/lantiq/xway/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom @@ -45,9 +45,6 @@ case "$FIRMWARE" in caldata_extract "calibration" 0xf000 0x1000 ath9k_patch_mac_crc $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) 2) 0x20c ;; - avm,fritz7312|avm,fritz7320) - caldata_extract "urlader" 0x985 0x1000 - ;; *) caldata_die "board $board is not supported yet" ;; From 92ccaacb295693f8f03fe815b574f15a753a1d15 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Mon, 16 Dec 2024 15:42:19 -0800 Subject: [PATCH 328/877] lantiq: use nvmem for fritz 736x Two use AR9287 and one AR9381. Both have different calibration sizes. Move differences out of wifi node to make it clearer what's what. qca,no-eeprom needs to stay for 7362sl as there's no nvmem equivalent for caldata_extract_reverse Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/17278 Signed-off-by: Hauke Mehrtens Link: https://github.com/openwrt/openwrt/pull/17512 Signed-off-by: Robert Marko --- .../arch/mips/boot/dts/lantiq/vr9_avm_fritz7360-v2.dts | 4 ++-- .../arch/mips/boot/dts/lantiq/vr9_avm_fritz7360sl.dts | 10 ++++++++++ .../arch/mips/boot/dts/lantiq/vr9_avm_fritz7362sl.dts | 5 +++++ .../arch/mips/boot/dts/lantiq/vr9_avm_fritz736x.dtsi | 4 +--- .../base-files/etc/hotplug.d/firmware/12-ath9k-eeprom | 3 --- 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7360-v2.dts b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7360-v2.dts index cc15324b56e08b..1b4140506291e9 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7360-v2.dts +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7360-v2.dts @@ -49,7 +49,7 @@ #size-cells = <1>; cal_urlader_985: cal@985 { - reg = <0x985 0x440>; + reg = <0x985 0x3d8>; }; macaddr_urlader_a91: macaddr@a91 { @@ -94,7 +94,7 @@ }; &wifi { - /delete-property/ qca,no-eeprom; + compatible = "pci168c,002e"; nvmem-cells = <&cal_urlader_985>; nvmem-cell-names = "calibration"; }; diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7360sl.dts b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7360sl.dts index cbe6c14c991fdc..9301b049cae9b6 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7360sl.dts +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7360sl.dts @@ -49,6 +49,10 @@ #address-cells = <1>; #size-cells = <1>; + cal_urlader_985: cal@985 { + reg = <0x985 0x3d8>; + }; + macaddr_urlader_a91: macaddr@a91 { compatible = "mac-base"; reg = <0xa91 0x6>; @@ -89,3 +93,9 @@ &phy1 { reset-gpios = <&gpio 44 GPIO_ACTIVE_LOW>; }; + +&wifi { + compatible = "pci168c,002e"; + nvmem-cells = <&cal_urlader_985>; + nvmem-cell-names = "calibration"; +}; diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7362sl.dts b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7362sl.dts index 7929bde6cfe68b..e1334fa3064bc9 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7362sl.dts +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7362sl.dts @@ -127,3 +127,8 @@ &phy1 { reset-gpios = <&gpio 44 GPIO_ACTIVE_LOW>; }; + +&wifi { + compatible = "pci168c,0030"; + qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:01:00.0.bin */ +}; diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz736x.dtsi b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz736x.dtsi index e7fc9a4f55b7b4..cc0c97da89c01f 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz736x.dtsi +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz736x.dtsi @@ -155,10 +155,8 @@ #address-cells = <2>; device_type = "pci"; - wifi: wifi@168c,002e { - compatible = "pci168c,002e"; + wifi: wifi@0,0 { reg = <0 0 0 0 0>; - qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:01:00.0.bin */ }; }; }; diff --git a/target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom b/target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom index 164e2d39caa5b6..936181c6935210 100644 --- a/target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom +++ b/target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom @@ -19,9 +19,6 @@ case "$FIRMWARE" in avm,fritz3390) caldata_extract_reverse "urlader" 0x2546 0x440 ;; - avm,fritz7360sl) - caldata_extract "urlader" 0x985 0x1000 - ;; avm,fritz7412|\ avm,fritz7430) /usr/bin/fritz_cal_extract -i 1 -s 0x1e000 -e 0x207 -l 5120 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader") || \ From baa656193958bbb21ae0cf1decdc87c0f89a4f9b Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Mon, 16 Dec 2024 15:19:35 -0800 Subject: [PATCH 329/877] lantiq: use nvmem for tplink tdw89x0 These two devices use different wifi chips and as a result, different calibration sizes. Move the differences out of dtsi. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/16555 Link: https://github.com/openwrt/openwrt/pull/17512 Signed-off-by: Robert Marko --- .../boot/dts/lantiq/vr9_tplink_tdw8970.dts | 12 ++++++++++ .../boot/dts/lantiq/vr9_tplink_tdw8980.dts | 12 ++++++++++ .../boot/dts/lantiq/vr9_tplink_tdw89x0.dtsi | 10 +++----- .../etc/hotplug.d/firmware/12-ath9k-eeprom | 23 ------------------- 4 files changed, 27 insertions(+), 30 deletions(-) delete mode 100644 target/linux/lantiq/xrx200_legacy/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_tplink_tdw8970.dts b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_tplink_tdw8970.dts index 1ac6440744306f..4bd70b528ca3bf 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_tplink_tdw8970.dts +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_tplink_tdw8970.dts @@ -4,3 +4,15 @@ compatible = "tplink,tdw8970", "tplink,tdw89x0", "lantiq,xway", "lantiq,vr9"; model = "TP-LINK TD-W8970"; }; + +&boardconfig { + cal_boardconfig_21000: calibration@21000 { + reg = <0x21000 0x440>; + }; +}; + +&ath9k { + compatible = "pci168c,0030"; + nvmem-cells = <&macaddr_ath9k_cal_f100 2>, <&cal_boardconfig_21000>; + nvmem-cell-names = "mac-address", "calibration"; +}; diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_tplink_tdw8980.dts b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_tplink_tdw8980.dts index 8221e0d5c5200f..a3fd6423364be5 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_tplink_tdw8980.dts +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_tplink_tdw8980.dts @@ -27,3 +27,15 @@ reset-gpios = <&gpio 21 GPIO_ACTIVE_LOW>; }; + +&boardconfig { + cal_boardconfig_21000: calibration@21000 { + reg = <0x21000 0x3d8>; + }; +}; + +&ath9k { + compatible = "pci168c,002e"; + nvmem-cells = <&macaddr_ath9k_cal_f100 2>, <&cal_boardconfig_21000>; + nvmem-cell-names = "mac-address", "calibration"; +}; diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_tplink_tdw89x0.dtsi b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_tplink_tdw89x0.dtsi index c3e69f18fa209d..be9c8063b452d8 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_tplink_tdw89x0.dtsi +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_tplink_tdw89x0.dtsi @@ -200,15 +200,11 @@ #address-cells = <3>; device_type = "pci"; - ath9k: wifi@168c,002e { - compatible = "pci168c,002e"; + ath9k: wifi@0,0 { reg = <0 0 0 0 0>; #gpio-cells = <2>; gpio-controller; - qca,no-eeprom; ieee80211-freq-limit = <2402000 2482000>; - nvmem-cells = <&macaddr_ath9k_cal_f100 2>; - nvmem-cell-names = "mac-address"; }; }; }; @@ -244,12 +240,12 @@ read-only; }; - ath9k_cal: partition@7d0000 { + partition@7d0000 { reg = <0x7d0000 0x30000>; label = "boardconfig"; read-only; - nvmem-layout { + boardconfig: nvmem-layout { compatible = "fixed-layout"; #address-cells = <1>; #size-cells = <1>; diff --git a/target/linux/lantiq/xrx200_legacy/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom b/target/linux/lantiq/xrx200_legacy/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom deleted file mode 100644 index c10065d5d5dcc0..00000000000000 --- a/target/linux/lantiq/xrx200_legacy/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -[ -e /lib/firmware/$FIRMWARE ] && exit 0 - -. /lib/functions/caldata.sh - -case "$FIRMWARE" in - "ath9k-eeprom-pci-0000:00:0e.0.bin" | \ - "ath9k-eeprom-pci-0000:01:00.0.bin" | \ - "ath9k-eeprom-pci-0000:02:00.0.bin") - board=$(board_name) - - case "$board" in - tplink,tdw8970|\ - tplink,tdw8980) - caldata_extract "boardconfig" 0x21000 0x1000 - ;; - *) - caldata_die "board $board is not supported yet" - ;; - esac - ;; -esac From 165b9e439387e949561dd7b1f03e07615e252618 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Mon, 30 Sep 2024 16:38:22 -0700 Subject: [PATCH 330/877] lantiq: fritz7430: fix PCI ID This platform has a bogus PCI ID for the chip. Correct it in DTS. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/16555 Link: https://github.com/openwrt/openwrt/pull/17512 Signed-off-by: Robert Marko --- .../files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7430.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7430.dts b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7430.dts index a0af4dff328eb9..7604248cb7929f 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7430.dts +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7430.dts @@ -173,8 +173,8 @@ #address-cells = <3>; device_type = "pci"; - wifi@168c,abcd { - compatible = "pci168c,abcd"; + wifi@0,0 { + compatible = "pci168c,0030"; reg = <0 0 0 0 0>; qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:01:00.0.bin */ }; From 44d6d062686fc8d63ed6b37d37e06075c109f385 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mustafa=20Can=20Elmac=C4=B1?= Date: Thu, 26 Dec 2024 12:50:55 +0300 Subject: [PATCH 331/877] lantiq: Remove legacy LED migration script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This script was rendered obsolete after xrx200 target switched to DSA and breaking config migration from old releases to 22.03. Signed-off-by: Mustafa Can Elmacı Link: https://github.com/openwrt/openwrt/pull/17383 Link: https://github.com/openwrt/openwrt/pull/17512 Signed-off-by: Robert Marko --- .../etc/uci-defaults/01_led_migration | 32 ------------------- .../etc/uci-defaults/01_led_migration | 31 ------------------ 2 files changed, 63 deletions(-) delete mode 100644 target/linux/lantiq/xrx200/base-files/etc/uci-defaults/01_led_migration delete mode 100644 target/linux/lantiq/xrx200_legacy/base-files/etc/uci-defaults/01_led_migration diff --git a/target/linux/lantiq/xrx200/base-files/etc/uci-defaults/01_led_migration b/target/linux/lantiq/xrx200/base-files/etc/uci-defaults/01_led_migration deleted file mode 100644 index e3f6a98149fb44..00000000000000 --- a/target/linux/lantiq/xrx200/base-files/etc/uci-defaults/01_led_migration +++ /dev/null @@ -1,32 +0,0 @@ -# -# Copyright (C) 2013 OpenWrt.org -# - -. /lib/functions/migrations.sh - -do_internet_led_rename() -{ - config_load system - - [ -n $(config_get led_internet name) ] || return - [ -z $(config_get led_dsl name) ] || return - - uci rename system.led_internet=led_dsl - uci set system.led_dsl.name=dsl - - logger -t led-migration "internet led renamed to dsl" -} - -case "$(board_name)" in -arcadyan,arv7519rw22|\ -avm,fritz7360sl|\ -bt,homehub-v5a) - do_internet_led_rename - ;; -esac - -remove_devicename_leds - -migrations_apply system - -exit 0 diff --git a/target/linux/lantiq/xrx200_legacy/base-files/etc/uci-defaults/01_led_migration b/target/linux/lantiq/xrx200_legacy/base-files/etc/uci-defaults/01_led_migration deleted file mode 100644 index f6f11bc569209e..00000000000000 --- a/target/linux/lantiq/xrx200_legacy/base-files/etc/uci-defaults/01_led_migration +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright (C) 2013 OpenWrt.org -# - -. /lib/functions/migrations.sh - -do_internet_led_rename() -{ - config_load system - - [ -n $(config_get led_internet name) ] || return - [ -z $(config_get led_dsl name) ] || return - - uci rename system.led_internet=led_dsl - uci set system.led_dsl.name=dsl - - logger -t led-migration "internet led renamed to dsl" -} - -case "$(board_name)" in -alphanetworks,asl56026|\ -arcadyan,vg3503j) - do_internet_led_rename - ;; -esac - -remove_devicename_leds - -migrations_apply system - -exit 0 From 3ee8355f2f09281395fd667c5134ad13e21391a0 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 10 Jan 2025 14:14:45 +0100 Subject: [PATCH 332/877] airoha: an7581: enable MMC and PCI and refresh config Enable MMC and PCI config symbol and refresh config for Airoha AN7581. Signed-off-by: Christian Marangi (cherry picked from commit 73d368868c9dd2facfdf3f58533ee6310b2a665c) --- target/linux/airoha/an7581/config-6.6 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/target/linux/airoha/an7581/config-6.6 b/target/linux/airoha/an7581/config-6.6 index b26cbeeb33e1fa..f80bf49f8c1190 100644 --- a/target/linux/airoha/an7581/config-6.6 +++ b/target/linux/airoha/an7581/config-6.6 @@ -131,6 +131,8 @@ CONFIG_COMPAT_32BIT_TIME=y CONFIG_CONTEXT_TRACKING=y CONFIG_CONTEXT_TRACKING_IDLE=y CONFIG_COREDUMP=y +CONFIG_CPUFREQ_DT=y +CONFIG_CPUFREQ_DT_PLATDEV=y CONFIG_CPUSETS=y CONFIG_CPU_FREQ=y CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y @@ -190,8 +192,6 @@ CONFIG_CRYPTO_SHA512=y CONFIG_CRYPTO_ZSTD=y CONFIG_DCACHE_WORD_ACCESS=y CONFIG_DEBUG_BUGVERBOSE=y -# CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT is not set -CONFIG_DEBUG_INFO_NONE=y CONFIG_DEBUG_MISC=y CONFIG_DEVMEM=y CONFIG_DMADEVICES=y @@ -351,6 +351,10 @@ CONFIG_MDIO_DEVRES=y # CONFIG_MEMCG is not set CONFIG_MFD_SYSCON=y CONFIG_MIGRATION=y +CONFIG_MMC=y +CONFIG_MMC_BLOCK=y +CONFIG_MMC_CQHCI=y +CONFIG_MMC_MTK=y CONFIG_MMU_LAZY_TLB_REFCOUNT=y CONFIG_MODULES_TREE_LOOKUP=y CONFIG_MODULES_USE_ELF_RELA=y @@ -433,7 +437,8 @@ CONFIG_PCIEASPM_PERFORMANCE=y # CONFIG_PCIEASPM_POWERSAVE is not set # CONFIG_PCIEASPM_POWER_SUPERSAVE is not set CONFIG_PCIEPORTBUS=y -# CONFIG_PCIE_MEDIATEK is not set +CONFIG_PCIE_MEDIATEK=y +CONFIG_PCIE_MEDIATEK_GEN3=y CONFIG_PCIE_PME=y CONFIG_PCI_DOMAINS=y CONFIG_PCI_DOMAINS_GENERIC=y From b315f4ebfebf7d163a769320c18a83adff65ed84 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 10 Jan 2025 14:15:31 +0100 Subject: [PATCH 333/877] airoha: an7581: replace BUS clock patch with upstream version Replace BUS clock patch with upstream version with related tag as it got approved and merged. Signed-off-by: Christian Marangi (cherry picked from commit 07b49ce87660a0448c0535b481b330e1bd333a8c) --- ...3-clk-en7523-Fix-wrong-BUS-clock-for-EN7581.patch} | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) rename target/linux/airoha/patches-6.6/{109-clk-en7523-Fix-wrong-BUS-clock-for-EN7581.patch => 035-v6.13-clk-en7523-Fix-wrong-BUS-clock-for-EN7581.patch} (82%) diff --git a/target/linux/airoha/patches-6.6/109-clk-en7523-Fix-wrong-BUS-clock-for-EN7581.patch b/target/linux/airoha/patches-6.6/035-v6.13-clk-en7523-Fix-wrong-BUS-clock-for-EN7581.patch similarity index 82% rename from target/linux/airoha/patches-6.6/109-clk-en7523-Fix-wrong-BUS-clock-for-EN7581.patch rename to target/linux/airoha/patches-6.6/035-v6.13-clk-en7523-Fix-wrong-BUS-clock-for-EN7581.patch index 01a5fd0c876075..89b970f8bb6ba6 100644 --- a/target/linux/airoha/patches-6.6/109-clk-en7523-Fix-wrong-BUS-clock-for-EN7581.patch +++ b/target/linux/airoha/patches-6.6/035-v6.13-clk-en7523-Fix-wrong-BUS-clock-for-EN7581.patch @@ -1,12 +1,12 @@ -From 6d74b9e6d3bb07f50b22b9ea047b84a83aba185c Mon Sep 17 00:00:00 2001 +From 2eb75f86d52565367211c51334d15fe672633085 Mon Sep 17 00:00:00 2001 From: Christian Marangi -Date: Thu, 17 Oct 2024 19:26:24 +0200 +Date: Sat, 16 Nov 2024 11:56:53 +0100 Subject: [PATCH] clk: en7523: Fix wrong BUS clock for EN7581 The Documentation for EN7581 had a typo and still referenced the EN7523 BUS base source frequency. This was in conflict with a different page in -the Documentration that state that the BUS runs at 300MHz (600MHz source with -divisor set to 2) and the actual watchdog that tick at half the BUS +the Documentration that state that the BUS runs at 300MHz (600MHz source +with divisor set to 2) and the actual watchdog that tick at half the BUS clock (150MHz). This was verified with the watchdog by timing the seconds that the system takes to reboot (due too watchdog) and by operating on different values of the BUS divisor. @@ -18,6 +18,9 @@ This was also confirmed by Airoha. Cc: stable@vger.kernel.org Fixes: 66bc47326ce2 ("clk: en7523: Add EN7581 support") Signed-off-by: Christian Marangi +Link: https://lore.kernel.org/r/20241116105710.19748-1-ansuelsmth@gmail.com +Acked-by: Lorenzo Bianconi +Signed-off-by: Stephen Boyd --- drivers/clk/clk-en7523.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) From ce926ee32feb4f0c172e6f0f5c04e4f12d419959 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 10 Jan 2025 14:16:46 +0100 Subject: [PATCH 334/877] airoha: an7581: backport 2 fix for airoha ethernet driver Backport 2 fix for airoha ethernet driver merged upstream. Signed-off-by: Christian Marangi (cherry picked from commit b4ae5378d403aa263ba5ec26ccc333ab0de81cff) --- ...ypo-in-REG_CDM2_FWD_CFG-configuratio.patch | 35 ++++++ ...iroha-Fix-error-path-in-airoha_probe.patch | 102 ++++++++++++++++++ 2 files changed, 137 insertions(+) create mode 100644 target/linux/airoha/patches-6.6/036-v6.13-net-airoha-Fix-typo-in-REG_CDM2_FWD_CFG-configuratio.patch create mode 100644 target/linux/airoha/patches-6.6/037-v6.14-net-airoha-Fix-error-path-in-airoha_probe.patch diff --git a/target/linux/airoha/patches-6.6/036-v6.13-net-airoha-Fix-typo-in-REG_CDM2_FWD_CFG-configuratio.patch b/target/linux/airoha/patches-6.6/036-v6.13-net-airoha-Fix-typo-in-REG_CDM2_FWD_CFG-configuratio.patch new file mode 100644 index 00000000000000..a71197150f4807 --- /dev/null +++ b/target/linux/airoha/patches-6.6/036-v6.13-net-airoha-Fix-typo-in-REG_CDM2_FWD_CFG-configuratio.patch @@ -0,0 +1,35 @@ +From 30d9d8f6a2d7e44a9f91737dd409dbc87ac6f6b7 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Tue, 15 Oct 2024 09:58:09 +0200 +Subject: [PATCH] net: airoha: Fix typo in REG_CDM2_FWD_CFG configuration + +Fix typo in airoha_fe_init routine configuring CDM2_OAM_QSEL_MASK field +of REG_CDM2_FWD_CFG register. +This bug is not introducing any user visible problem since Frame Engine +CDM2 port is used just by the second QDMA block and we currently enable +just QDMA1 block connected to the MT7530 dsa switch via CDM1 port. + +Introduced by commit 23020f049327 ("net: airoha: Introduce ethernet +support for EN7581 SoC") + +Reported-by: ChihWei Cheng +Signed-off-by: Lorenzo Bianconi +Reviewed-by: Simon Horman +Message-ID: <20241015-airoha-eth-cdm2-fixes-v1-1-9dc6993286c3@kernel.org> +Signed-off-by: Andrew Lunn +--- + drivers/net/ethernet/mediatek/airoha_eth.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/net/ethernet/mediatek/airoha_eth.c ++++ b/drivers/net/ethernet/mediatek/airoha_eth.c +@@ -1369,7 +1369,8 @@ static int airoha_fe_init(struct airoha_ + airoha_fe_set(eth, REG_GDM_MISC_CFG, + GDM2_RDM_ACK_WAIT_PREF_MASK | + GDM2_CHN_VLD_MODE_MASK); +- airoha_fe_rmw(eth, REG_CDM2_FWD_CFG, CDM2_OAM_QSEL_MASK, 15); ++ airoha_fe_rmw(eth, REG_CDM2_FWD_CFG, CDM2_OAM_QSEL_MASK, ++ FIELD_PREP(CDM2_OAM_QSEL_MASK, 15)); + + /* init fragment and assemble Force Port */ + /* NPU Core-3, NPU Bridge Channel-3 */ diff --git a/target/linux/airoha/patches-6.6/037-v6.14-net-airoha-Fix-error-path-in-airoha_probe.patch b/target/linux/airoha/patches-6.6/037-v6.14-net-airoha-Fix-error-path-in-airoha_probe.patch new file mode 100644 index 00000000000000..9499c1541a1302 --- /dev/null +++ b/target/linux/airoha/patches-6.6/037-v6.14-net-airoha-Fix-error-path-in-airoha_probe.patch @@ -0,0 +1,102 @@ +From 0c7469ee718e1dd929f52bfb142a7f6fb68f0765 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Mon, 16 Dec 2024 18:47:33 +0100 +Subject: [PATCH] net: airoha: Fix error path in airoha_probe() + +Do not run napi_disable() if airoha_hw_init() fails since Tx/Rx napi +has not been started yet. In order to fix the issue, introduce +airoha_qdma_stop_napi routine and remove napi_disable in +airoha_hw_cleanup(). + +Fixes: 23020f049327 ("net: airoha: Introduce ethernet support for EN7581 SoC") +Reviewed-by: Michal Swiatkowski +Signed-off-by: Lorenzo Bianconi +Link: https://patch.msgid.link/20241216-airoha_probe-error-path-fix-v2-1-6b10e04e9a5c@kernel.org +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/mediatek/airoha_eth.c | 33 ++++++++++++++++------ + 1 file changed, 25 insertions(+), 8 deletions(-) + +--- a/drivers/net/ethernet/mediatek/airoha_eth.c ++++ b/drivers/net/ethernet/mediatek/airoha_eth.c +@@ -2139,17 +2139,14 @@ static void airoha_hw_cleanup(struct air + if (!qdma->q_rx[i].ndesc) + continue; + +- napi_disable(&qdma->q_rx[i].napi); + netif_napi_del(&qdma->q_rx[i].napi); + airoha_qdma_cleanup_rx_queue(&qdma->q_rx[i]); + if (qdma->q_rx[i].page_pool) + page_pool_destroy(qdma->q_rx[i].page_pool); + } + +- for (i = 0; i < ARRAY_SIZE(qdma->q_tx_irq); i++) { +- napi_disable(&qdma->q_tx_irq[i].napi); ++ for (i = 0; i < ARRAY_SIZE(qdma->q_tx_irq); i++) + netif_napi_del(&qdma->q_tx_irq[i].napi); +- } + + for (i = 0; i < ARRAY_SIZE(qdma->q_tx); i++) { + if (!qdma->q_tx[i].ndesc) +@@ -2174,6 +2171,21 @@ static void airoha_qdma_start_napi(struc + } + } + ++static void airoha_qdma_stop_napi(struct airoha_qdma *qdma) ++{ ++ int i; ++ ++ for (i = 0; i < ARRAY_SIZE(qdma->q_tx_irq); i++) ++ napi_disable(&qdma->q_tx_irq[i].napi); ++ ++ for (i = 0; i < ARRAY_SIZE(qdma->q_rx); i++) { ++ if (!qdma->q_rx[i].ndesc) ++ continue; ++ ++ napi_disable(&qdma->q_rx[i].napi); ++ } ++} ++ + static void airoha_update_hw_stats(struct airoha_gdm_port *port) + { + struct airoha_eth *eth = port->qdma->eth; +@@ -2731,7 +2743,7 @@ static int airoha_probe(struct platform_ + + err = airoha_hw_init(pdev, eth); + if (err) +- goto error; ++ goto error_hw_cleanup; + + for (i = 0; i < ARRAY_SIZE(eth->qdma); i++) + airoha_qdma_start_napi(ð->qdma[i]); +@@ -2746,13 +2758,16 @@ static int airoha_probe(struct platform_ + err = airoha_alloc_gdm_port(eth, np); + if (err) { + of_node_put(np); +- goto error; ++ goto error_napi_stop; + } + } + + return 0; + +-error: ++error_napi_stop: ++ for (i = 0; i < ARRAY_SIZE(eth->qdma); i++) ++ airoha_qdma_stop_napi(ð->qdma[i]); ++error_hw_cleanup: + for (i = 0; i < ARRAY_SIZE(eth->qdma); i++) + airoha_hw_cleanup(ð->qdma[i]); + +@@ -2773,8 +2788,10 @@ static void airoha_remove(struct platfor + struct airoha_eth *eth = platform_get_drvdata(pdev); + int i; + +- for (i = 0; i < ARRAY_SIZE(eth->qdma); i++) ++ for (i = 0; i < ARRAY_SIZE(eth->qdma); i++) { ++ airoha_qdma_stop_napi(ð->qdma[i]); + airoha_hw_cleanup(ð->qdma[i]); ++ } + + for (i = 0; i < ARRAY_SIZE(eth->ports); i++) { + struct airoha_gdm_port *port = eth->ports[i]; From 5c679f56ebcf4692d62c35b46a20b6e4edc2e18f Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 10 Jan 2025 14:22:31 +0100 Subject: [PATCH 335/877] airoha: an7581: backport patch to support ETS and HTB sched Backport patch to support ETS and HTB scheduler for airoha ethernet driver. Signed-off-by: Christian Marangi (cherry picked from commit 3ec3ea5316ceebae260f4d170c6e1c3a19864438) --- ...e-Tx-drop-capability-for-each-Tx-DMA.patch | 27 ++ ...-Introduce-ndo_select_queue-callback.patch | 86 ++++ ...airoha-Add-sched-ETS-offload-support.patch | 292 ++++++++++++++ ...airoha-Add-sched-HTB-offload-support.patch | 371 ++++++++++++++++++ 4 files changed, 776 insertions(+) create mode 100644 target/linux/airoha/patches-6.6/038-01-v6.14-net-airoha-Enable-Tx-drop-capability-for-each-Tx-DMA.patch create mode 100644 target/linux/airoha/patches-6.6/038-02-v6.14-net-airoha-Introduce-ndo_select_queue-callback.patch create mode 100644 target/linux/airoha/patches-6.6/038-03-v6.14-net-airoha-Add-sched-ETS-offload-support.patch create mode 100644 target/linux/airoha/patches-6.6/038-04-v6.14-net-airoha-Add-sched-HTB-offload-support.patch diff --git a/target/linux/airoha/patches-6.6/038-01-v6.14-net-airoha-Enable-Tx-drop-capability-for-each-Tx-DMA.patch b/target/linux/airoha/patches-6.6/038-01-v6.14-net-airoha-Enable-Tx-drop-capability-for-each-Tx-DMA.patch new file mode 100644 index 00000000000000..c8681aace5b556 --- /dev/null +++ b/target/linux/airoha/patches-6.6/038-01-v6.14-net-airoha-Enable-Tx-drop-capability-for-each-Tx-DMA.patch @@ -0,0 +1,27 @@ +From 5f795590380476f1c9b7ed0ac945c9b0269dc23a Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Fri, 3 Jan 2025 13:17:02 +0100 +Subject: [PATCH 1/4] net: airoha: Enable Tx drop capability for each Tx DMA + ring + +This is a preliminary patch in order to enable hw Qdisc offloading. + +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Paolo Abeni +--- + drivers/net/ethernet/mediatek/airoha_eth.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/net/ethernet/mediatek/airoha_eth.c ++++ b/drivers/net/ethernet/mediatek/airoha_eth.c +@@ -1790,6 +1790,10 @@ static int airoha_qdma_init_tx_queue(str + WRITE_ONCE(q->desc[i].ctrl, cpu_to_le32(val)); + } + ++ /* xmit ring drop default setting */ ++ airoha_qdma_set(qdma, REG_TX_RING_BLOCKING(qid), ++ TX_RING_IRQ_BLOCKING_TX_DROP_EN_MASK); ++ + airoha_qdma_wr(qdma, REG_TX_RING_BASE(qid), dma_addr); + airoha_qdma_rmw(qdma, REG_TX_CPU_IDX(qid), TX_RING_CPU_IDX_MASK, + FIELD_PREP(TX_RING_CPU_IDX_MASK, q->head)); diff --git a/target/linux/airoha/patches-6.6/038-02-v6.14-net-airoha-Introduce-ndo_select_queue-callback.patch b/target/linux/airoha/patches-6.6/038-02-v6.14-net-airoha-Introduce-ndo_select_queue-callback.patch new file mode 100644 index 00000000000000..75743bdd347b26 --- /dev/null +++ b/target/linux/airoha/patches-6.6/038-02-v6.14-net-airoha-Introduce-ndo_select_queue-callback.patch @@ -0,0 +1,86 @@ +From 2b288b81560b94958cd68bbe54673e55a1730c95 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Fri, 3 Jan 2025 13:17:03 +0100 +Subject: [PATCH 2/4] net: airoha: Introduce ndo_select_queue callback + +Airoha EN7581 SoC supports 32 Tx DMA rings used to feed packets to QoS +channels. Each channels supports 8 QoS queues where the user can apply +QoS scheduling policies. In a similar way, the user can configure hw +rate shaping for each QoS channel. +Introduce ndo_select_queue callback in order to select the tx queue +based on QoS channel and QoS queue. In particular, for dsa device select +QoS channel according to the dsa user port index, rely on port id +otherwise. Select QoS queue based on the skb priority. + +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Paolo Abeni +--- + drivers/net/ethernet/mediatek/airoha_eth.c | 30 ++++++++++++++++++++-- + 1 file changed, 28 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/mediatek/airoha_eth.c ++++ b/drivers/net/ethernet/mediatek/airoha_eth.c +@@ -23,6 +23,8 @@ + #define AIROHA_MAX_NUM_XSI_RSTS 5 + #define AIROHA_MAX_MTU 2000 + #define AIROHA_MAX_PACKET_SIZE 2048 ++#define AIROHA_NUM_QOS_CHANNELS 4 ++#define AIROHA_NUM_QOS_QUEUES 8 + #define AIROHA_NUM_TX_RING 32 + #define AIROHA_NUM_RX_RING 32 + #define AIROHA_FE_MC_MAX_VLAN_TABLE 64 +@@ -2422,21 +2424,44 @@ static void airoha_dev_get_stats64(struc + } while (u64_stats_fetch_retry(&port->stats.syncp, start)); + } + ++static u16 airoha_dev_select_queue(struct net_device *dev, struct sk_buff *skb, ++ struct net_device *sb_dev) ++{ ++ struct airoha_gdm_port *port = netdev_priv(dev); ++ int queue, channel; ++ ++ /* For dsa device select QoS channel according to the dsa user port ++ * index, rely on port id otherwise. Select QoS queue based on the ++ * skb priority. ++ */ ++ channel = netdev_uses_dsa(dev) ? skb_get_queue_mapping(skb) : port->id; ++ channel = channel % AIROHA_NUM_QOS_CHANNELS; ++ queue = (skb->priority - 1) % AIROHA_NUM_QOS_QUEUES; /* QoS queue */ ++ queue = channel * AIROHA_NUM_QOS_QUEUES + queue; ++ ++ return queue < dev->num_tx_queues ? queue : 0; ++} ++ + static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb, + struct net_device *dev) + { + struct skb_shared_info *sinfo = skb_shinfo(skb); + struct airoha_gdm_port *port = netdev_priv(dev); +- u32 msg0 = 0, msg1, len = skb_headlen(skb); +- int i, qid = skb_get_queue_mapping(skb); ++ u32 msg0, msg1, len = skb_headlen(skb); + struct airoha_qdma *qdma = port->qdma; + u32 nr_frags = 1 + sinfo->nr_frags; + struct netdev_queue *txq; + struct airoha_queue *q; + void *data = skb->data; ++ int i, qid; + u16 index; + u8 fport; + ++ qid = skb_get_queue_mapping(skb) % ARRAY_SIZE(qdma->q_tx); ++ msg0 = FIELD_PREP(QDMA_ETH_TXMSG_CHAN_MASK, ++ qid / AIROHA_NUM_QOS_QUEUES) | ++ FIELD_PREP(QDMA_ETH_TXMSG_QUEUE_MASK, ++ qid % AIROHA_NUM_QOS_QUEUES); + if (skb->ip_summed == CHECKSUM_PARTIAL) + msg0 |= FIELD_PREP(QDMA_ETH_TXMSG_TCO_MASK, 1) | + FIELD_PREP(QDMA_ETH_TXMSG_UCO_MASK, 1) | +@@ -2610,6 +2635,7 @@ static const struct net_device_ops airoh + .ndo_init = airoha_dev_init, + .ndo_open = airoha_dev_open, + .ndo_stop = airoha_dev_stop, ++ .ndo_select_queue = airoha_dev_select_queue, + .ndo_start_xmit = airoha_dev_xmit, + .ndo_get_stats64 = airoha_dev_get_stats64, + .ndo_set_mac_address = airoha_dev_set_macaddr, diff --git a/target/linux/airoha/patches-6.6/038-03-v6.14-net-airoha-Add-sched-ETS-offload-support.patch b/target/linux/airoha/patches-6.6/038-03-v6.14-net-airoha-Add-sched-ETS-offload-support.patch new file mode 100644 index 00000000000000..ad5e0e5c2a63b1 --- /dev/null +++ b/target/linux/airoha/patches-6.6/038-03-v6.14-net-airoha-Add-sched-ETS-offload-support.patch @@ -0,0 +1,292 @@ +From 20bf7d07c956e5c7a22d3076c599cbb7a6054917 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Fri, 3 Jan 2025 13:17:04 +0100 +Subject: [PATCH 3/4] net: airoha: Add sched ETS offload support + +Introduce support for ETS Qdisc offload available on the Airoha EN7581 +ethernet controller. In order to be effective, ETS Qdisc must configured +as leaf of a HTB Qdisc (HTB Qdisc offload will be added in the following +patch). ETS Qdisc available on EN7581 ethernet controller supports at +most 8 concurrent bands (QoS queues). We can enable an ETS Qdisc for +each available QoS channel. + +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Paolo Abeni +--- + drivers/net/ethernet/mediatek/airoha_eth.c | 196 ++++++++++++++++++++- + 1 file changed, 195 insertions(+), 1 deletion(-) + +--- a/drivers/net/ethernet/mediatek/airoha_eth.c ++++ b/drivers/net/ethernet/mediatek/airoha_eth.c +@@ -15,6 +15,7 @@ + #include + #include + #include ++#include + #include + + #define AIROHA_MAX_NUM_GDM_PORTS 1 +@@ -543,9 +544,24 @@ + #define INGRESS_SLOW_TICK_RATIO_MASK GENMASK(29, 16) + #define INGRESS_FAST_TICK_MASK GENMASK(15, 0) + ++#define REG_QUEUE_CLOSE_CFG(_n) (0x00a0 + ((_n) & 0xfc)) ++#define TXQ_DISABLE_CHAN_QUEUE_MASK(_n, _m) BIT((_m) + (((_n) & 0x3) << 3)) ++ + #define REG_TXQ_DIS_CFG_BASE(_n) ((_n) ? 0x20a0 : 0x00a0) + #define REG_TXQ_DIS_CFG(_n, _m) (REG_TXQ_DIS_CFG_BASE((_n)) + (_m) << 2) + ++#define REG_CNTR_CFG(_n) (0x0400 + ((_n) << 3)) ++#define CNTR_EN_MASK BIT(31) ++#define CNTR_ALL_CHAN_EN_MASK BIT(30) ++#define CNTR_ALL_QUEUE_EN_MASK BIT(29) ++#define CNTR_ALL_DSCP_RING_EN_MASK BIT(28) ++#define CNTR_SRC_MASK GENMASK(27, 24) ++#define CNTR_DSCP_RING_MASK GENMASK(20, 16) ++#define CNTR_CHAN_MASK GENMASK(7, 3) ++#define CNTR_QUEUE_MASK GENMASK(2, 0) ++ ++#define REG_CNTR_VAL(_n) (0x0404 + ((_n) << 3)) ++ + #define REG_LMGR_INIT_CFG 0x1000 + #define LMGR_INIT_START BIT(31) + #define LMGR_SRAM_MODE_MASK BIT(30) +@@ -571,9 +587,19 @@ + #define TWRR_WEIGHT_SCALE_MASK BIT(31) + #define TWRR_WEIGHT_BASE_MASK BIT(3) + ++#define REG_TXWRR_WEIGHT_CFG 0x1024 ++#define TWRR_RW_CMD_MASK BIT(31) ++#define TWRR_RW_CMD_DONE BIT(30) ++#define TWRR_CHAN_IDX_MASK GENMASK(23, 19) ++#define TWRR_QUEUE_IDX_MASK GENMASK(18, 16) ++#define TWRR_VALUE_MASK GENMASK(15, 0) ++ + #define REG_PSE_BUF_USAGE_CFG 0x1028 + #define PSE_BUF_ESTIMATE_EN_MASK BIT(29) + ++#define REG_CHAN_QOS_MODE(_n) (0x1040 + ((_n) << 2)) ++#define CHAN_QOS_MODE_MASK(_n) GENMASK(2 + ((_n) << 2), (_n) << 2) ++ + #define REG_GLB_TRTCM_CFG 0x1080 + #define GLB_TRTCM_EN_MASK BIT(31) + #define GLB_TRTCM_MODE_MASK BIT(30) +@@ -722,6 +748,17 @@ enum { + FE_PSE_PORT_DROP = 0xf, + }; + ++enum tx_sched_mode { ++ TC_SCH_WRR8, ++ TC_SCH_SP, ++ TC_SCH_WRR7, ++ TC_SCH_WRR6, ++ TC_SCH_WRR5, ++ TC_SCH_WRR4, ++ TC_SCH_WRR3, ++ TC_SCH_WRR2, ++}; ++ + struct airoha_queue_entry { + union { + void *buf; +@@ -812,6 +849,10 @@ struct airoha_gdm_port { + int id; + + struct airoha_hw_stats stats; ++ ++ /* qos stats counters */ ++ u64 cpu_tx_packets; ++ u64 fwd_tx_packets; + }; + + struct airoha_eth { +@@ -1962,6 +2003,27 @@ static void airoha_qdma_init_qos(struct + FIELD_PREP(SLA_SLOW_TICK_RATIO_MASK, 40)); + } + ++static void airoha_qdma_init_qos_stats(struct airoha_qdma *qdma) ++{ ++ int i; ++ ++ for (i = 0; i < AIROHA_NUM_QOS_CHANNELS; i++) { ++ /* Tx-cpu transferred count */ ++ airoha_qdma_wr(qdma, REG_CNTR_VAL(i << 1), 0); ++ airoha_qdma_wr(qdma, REG_CNTR_CFG(i << 1), ++ CNTR_EN_MASK | CNTR_ALL_QUEUE_EN_MASK | ++ CNTR_ALL_DSCP_RING_EN_MASK | ++ FIELD_PREP(CNTR_CHAN_MASK, i)); ++ /* Tx-fwd transferred count */ ++ airoha_qdma_wr(qdma, REG_CNTR_VAL((i << 1) + 1), 0); ++ airoha_qdma_wr(qdma, REG_CNTR_CFG(i << 1), ++ CNTR_EN_MASK | CNTR_ALL_QUEUE_EN_MASK | ++ CNTR_ALL_DSCP_RING_EN_MASK | ++ FIELD_PREP(CNTR_SRC_MASK, 1) | ++ FIELD_PREP(CNTR_CHAN_MASK, i)); ++ } ++} ++ + static int airoha_qdma_hw_init(struct airoha_qdma *qdma) + { + int i; +@@ -2012,6 +2074,7 @@ static int airoha_qdma_hw_init(struct ai + + airoha_qdma_set(qdma, REG_TXQ_CNGST_CFG, + TXQ_CNGST_DROP_EN | TXQ_CNGST_DEI_DROP_EN); ++ airoha_qdma_init_qos_stats(qdma); + + return 0; + } +@@ -2631,6 +2694,135 @@ airoha_ethtool_get_rmon_stats(struct net + } while (u64_stats_fetch_retry(&port->stats.syncp, start)); + } + ++static int airoha_qdma_set_chan_tx_sched(struct airoha_gdm_port *port, ++ int channel, enum tx_sched_mode mode, ++ const u16 *weights, u8 n_weights) ++{ ++ int i; ++ ++ for (i = 0; i < AIROHA_NUM_TX_RING; i++) ++ airoha_qdma_clear(port->qdma, REG_QUEUE_CLOSE_CFG(channel), ++ TXQ_DISABLE_CHAN_QUEUE_MASK(channel, i)); ++ ++ for (i = 0; i < n_weights; i++) { ++ u32 status; ++ int err; ++ ++ airoha_qdma_wr(port->qdma, REG_TXWRR_WEIGHT_CFG, ++ TWRR_RW_CMD_MASK | ++ FIELD_PREP(TWRR_CHAN_IDX_MASK, channel) | ++ FIELD_PREP(TWRR_QUEUE_IDX_MASK, i) | ++ FIELD_PREP(TWRR_VALUE_MASK, weights[i])); ++ err = read_poll_timeout(airoha_qdma_rr, status, ++ status & TWRR_RW_CMD_DONE, ++ USEC_PER_MSEC, 10 * USEC_PER_MSEC, ++ true, port->qdma, ++ REG_TXWRR_WEIGHT_CFG); ++ if (err) ++ return err; ++ } ++ ++ airoha_qdma_rmw(port->qdma, REG_CHAN_QOS_MODE(channel >> 3), ++ CHAN_QOS_MODE_MASK(channel), ++ mode << __ffs(CHAN_QOS_MODE_MASK(channel))); ++ ++ return 0; ++} ++ ++static int airoha_qdma_set_tx_prio_sched(struct airoha_gdm_port *port, ++ int channel) ++{ ++ static const u16 w[AIROHA_NUM_QOS_QUEUES] = {}; ++ ++ return airoha_qdma_set_chan_tx_sched(port, channel, TC_SCH_SP, w, ++ ARRAY_SIZE(w)); ++} ++ ++static int airoha_qdma_set_tx_ets_sched(struct airoha_gdm_port *port, ++ int channel, ++ struct tc_ets_qopt_offload *opt) ++{ ++ struct tc_ets_qopt_offload_replace_params *p = &opt->replace_params; ++ enum tx_sched_mode mode = TC_SCH_SP; ++ u16 w[AIROHA_NUM_QOS_QUEUES] = {}; ++ int i, nstrict = 0; ++ ++ if (p->bands > AIROHA_NUM_QOS_QUEUES) ++ return -EINVAL; ++ ++ for (i = 0; i < p->bands; i++) { ++ if (!p->quanta[i]) ++ nstrict++; ++ } ++ ++ /* this configuration is not supported by the hw */ ++ if (nstrict == AIROHA_NUM_QOS_QUEUES - 1) ++ return -EINVAL; ++ ++ for (i = 0; i < p->bands - nstrict; i++) ++ w[i] = p->weights[nstrict + i]; ++ ++ if (!nstrict) ++ mode = TC_SCH_WRR8; ++ else if (nstrict < AIROHA_NUM_QOS_QUEUES - 1) ++ mode = nstrict + 1; ++ ++ return airoha_qdma_set_chan_tx_sched(port, channel, mode, w, ++ ARRAY_SIZE(w)); ++} ++ ++static int airoha_qdma_get_tx_ets_stats(struct airoha_gdm_port *port, ++ int channel, ++ struct tc_ets_qopt_offload *opt) ++{ ++ u64 cpu_tx_packets = airoha_qdma_rr(port->qdma, ++ REG_CNTR_VAL(channel << 1)); ++ u64 fwd_tx_packets = airoha_qdma_rr(port->qdma, ++ REG_CNTR_VAL((channel << 1) + 1)); ++ u64 tx_packets = (cpu_tx_packets - port->cpu_tx_packets) + ++ (fwd_tx_packets - port->fwd_tx_packets); ++ _bstats_update(opt->stats.bstats, 0, tx_packets); ++ ++ port->cpu_tx_packets = cpu_tx_packets; ++ port->fwd_tx_packets = fwd_tx_packets; ++ ++ return 0; ++} ++ ++static int airoha_tc_setup_qdisc_ets(struct airoha_gdm_port *port, ++ struct tc_ets_qopt_offload *opt) ++{ ++ int channel = TC_H_MAJ(opt->handle) >> 16; ++ ++ if (opt->parent == TC_H_ROOT) ++ return -EINVAL; ++ ++ switch (opt->command) { ++ case TC_ETS_REPLACE: ++ return airoha_qdma_set_tx_ets_sched(port, channel, opt); ++ case TC_ETS_DESTROY: ++ /* PRIO is default qdisc scheduler */ ++ return airoha_qdma_set_tx_prio_sched(port, channel); ++ case TC_ETS_STATS: ++ return airoha_qdma_get_tx_ets_stats(port, channel, opt); ++ default: ++ return -EOPNOTSUPP; ++ } ++} ++ ++static int airoha_dev_tc_setup(struct net_device *dev, enum tc_setup_type type, ++ void *type_data) ++{ ++ struct airoha_gdm_port *port = netdev_priv(dev); ++ ++ switch (type) { ++ case TC_SETUP_QDISC_ETS: ++ return airoha_tc_setup_qdisc_ets(port, type_data); ++ default: ++ return -EOPNOTSUPP; ++ } ++} ++ + static const struct net_device_ops airoha_netdev_ops = { + .ndo_init = airoha_dev_init, + .ndo_open = airoha_dev_open, +@@ -2639,6 +2831,7 @@ static const struct net_device_ops airoh + .ndo_start_xmit = airoha_dev_xmit, + .ndo_get_stats64 = airoha_dev_get_stats64, + .ndo_set_mac_address = airoha_dev_set_macaddr, ++ .ndo_setup_tc = airoha_dev_tc_setup, + }; + + static const struct ethtool_ops airoha_ethtool_ops = { +@@ -2688,7 +2881,8 @@ static int airoha_alloc_gdm_port(struct + dev->watchdog_timeo = 5 * HZ; + dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_RXCSUM | + NETIF_F_TSO6 | NETIF_F_IPV6_CSUM | +- NETIF_F_SG | NETIF_F_TSO; ++ NETIF_F_SG | NETIF_F_TSO | ++ NETIF_F_HW_TC; + dev->features |= dev->hw_features; + dev->dev.of_node = np; + dev->irq = qdma->irq; diff --git a/target/linux/airoha/patches-6.6/038-04-v6.14-net-airoha-Add-sched-HTB-offload-support.patch b/target/linux/airoha/patches-6.6/038-04-v6.14-net-airoha-Add-sched-HTB-offload-support.patch new file mode 100644 index 00000000000000..1239b174e51c1a --- /dev/null +++ b/target/linux/airoha/patches-6.6/038-04-v6.14-net-airoha-Add-sched-HTB-offload-support.patch @@ -0,0 +1,371 @@ +From ef1ca9271313b4ea7b03de69576aacef1e78f381 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Fri, 3 Jan 2025 13:17:05 +0100 +Subject: [PATCH 4/4] net: airoha: Add sched HTB offload support + +Introduce support for HTB Qdisc offload available in the Airoha EN7581 +ethernet controller. EN7581 can offload only one level of HTB leafs. +Each HTB leaf represents a QoS channel supported by EN7581 SoC. +The typical use-case is creating a HTB leaf for QoS channel to rate +limit the egress traffic and attach an ETS Qdisc to each HTB leaf in +order to enforce traffic prioritization. + +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Paolo Abeni +--- + drivers/net/ethernet/mediatek/airoha_eth.c | 288 ++++++++++++++++++++- + 1 file changed, 287 insertions(+), 1 deletion(-) + +--- a/drivers/net/ethernet/mediatek/airoha_eth.c ++++ b/drivers/net/ethernet/mediatek/airoha_eth.c +@@ -28,6 +28,8 @@ + #define AIROHA_NUM_QOS_QUEUES 8 + #define AIROHA_NUM_TX_RING 32 + #define AIROHA_NUM_RX_RING 32 ++#define AIROHA_NUM_NETDEV_TX_RINGS (AIROHA_NUM_TX_RING + \ ++ AIROHA_NUM_QOS_CHANNELS) + #define AIROHA_FE_MC_MAX_VLAN_TABLE 64 + #define AIROHA_FE_MC_MAX_VLAN_PORT 16 + #define AIROHA_NUM_TX_IRQ 2 +@@ -43,6 +45,9 @@ + #define PSE_RSV_PAGES 128 + #define PSE_QUEUE_RSV_PAGES 64 + ++#define QDMA_METER_IDX(_n) ((_n) & 0xff) ++#define QDMA_METER_GROUP(_n) (((_n) >> 8) & 0x3) ++ + /* FE */ + #define PSE_BASE 0x0100 + #define CSR_IFC_BASE 0x0200 +@@ -583,6 +588,17 @@ + #define EGRESS_SLOW_TICK_RATIO_MASK GENMASK(29, 16) + #define EGRESS_FAST_TICK_MASK GENMASK(15, 0) + ++#define TRTCM_PARAM_RW_MASK BIT(31) ++#define TRTCM_PARAM_RW_DONE_MASK BIT(30) ++#define TRTCM_PARAM_TYPE_MASK GENMASK(29, 28) ++#define TRTCM_METER_GROUP_MASK GENMASK(27, 26) ++#define TRTCM_PARAM_INDEX_MASK GENMASK(23, 17) ++#define TRTCM_PARAM_RATE_TYPE_MASK BIT(16) ++ ++#define REG_TRTCM_CFG_PARAM(_n) ((_n) + 0x4) ++#define REG_TRTCM_DATA_LOW(_n) ((_n) + 0x8) ++#define REG_TRTCM_DATA_HIGH(_n) ((_n) + 0xc) ++ + #define REG_TXWRR_MODE_CFG 0x1020 + #define TWRR_WEIGHT_SCALE_MASK BIT(31) + #define TWRR_WEIGHT_BASE_MASK BIT(3) +@@ -759,6 +775,29 @@ enum tx_sched_mode { + TC_SCH_WRR2, + }; + ++enum trtcm_param_type { ++ TRTCM_MISC_MODE, /* meter_en, pps_mode, tick_sel */ ++ TRTCM_TOKEN_RATE_MODE, ++ TRTCM_BUCKETSIZE_SHIFT_MODE, ++ TRTCM_BUCKET_COUNTER_MODE, ++}; ++ ++enum trtcm_mode_type { ++ TRTCM_COMMIT_MODE, ++ TRTCM_PEAK_MODE, ++}; ++ ++enum trtcm_param { ++ TRTCM_TICK_SEL = BIT(0), ++ TRTCM_PKT_MODE = BIT(1), ++ TRTCM_METER_MODE = BIT(2), ++}; ++ ++#define MIN_TOKEN_SIZE 4096 ++#define MAX_TOKEN_SIZE_OFFSET 17 ++#define TRTCM_TOKEN_RATE_MASK GENMASK(23, 6) ++#define TRTCM_TOKEN_RATE_FRACTION_MASK GENMASK(5, 0) ++ + struct airoha_queue_entry { + union { + void *buf; +@@ -850,6 +889,8 @@ struct airoha_gdm_port { + + struct airoha_hw_stats stats; + ++ DECLARE_BITMAP(qos_sq_bmap, AIROHA_NUM_QOS_CHANNELS); ++ + /* qos stats counters */ + u64 cpu_tx_packets; + u64 fwd_tx_packets; +@@ -2810,6 +2851,243 @@ static int airoha_tc_setup_qdisc_ets(str + } + } + ++static int airoha_qdma_get_trtcm_param(struct airoha_qdma *qdma, int channel, ++ u32 addr, enum trtcm_param_type param, ++ enum trtcm_mode_type mode, ++ u32 *val_low, u32 *val_high) ++{ ++ u32 idx = QDMA_METER_IDX(channel), group = QDMA_METER_GROUP(channel); ++ u32 val, config = FIELD_PREP(TRTCM_PARAM_TYPE_MASK, param) | ++ FIELD_PREP(TRTCM_METER_GROUP_MASK, group) | ++ FIELD_PREP(TRTCM_PARAM_INDEX_MASK, idx) | ++ FIELD_PREP(TRTCM_PARAM_RATE_TYPE_MASK, mode); ++ ++ airoha_qdma_wr(qdma, REG_TRTCM_CFG_PARAM(addr), config); ++ if (read_poll_timeout(airoha_qdma_rr, val, ++ val & TRTCM_PARAM_RW_DONE_MASK, ++ USEC_PER_MSEC, 10 * USEC_PER_MSEC, true, ++ qdma, REG_TRTCM_CFG_PARAM(addr))) ++ return -ETIMEDOUT; ++ ++ *val_low = airoha_qdma_rr(qdma, REG_TRTCM_DATA_LOW(addr)); ++ if (val_high) ++ *val_high = airoha_qdma_rr(qdma, REG_TRTCM_DATA_HIGH(addr)); ++ ++ return 0; ++} ++ ++static int airoha_qdma_set_trtcm_param(struct airoha_qdma *qdma, int channel, ++ u32 addr, enum trtcm_param_type param, ++ enum trtcm_mode_type mode, u32 val) ++{ ++ u32 idx = QDMA_METER_IDX(channel), group = QDMA_METER_GROUP(channel); ++ u32 config = TRTCM_PARAM_RW_MASK | ++ FIELD_PREP(TRTCM_PARAM_TYPE_MASK, param) | ++ FIELD_PREP(TRTCM_METER_GROUP_MASK, group) | ++ FIELD_PREP(TRTCM_PARAM_INDEX_MASK, idx) | ++ FIELD_PREP(TRTCM_PARAM_RATE_TYPE_MASK, mode); ++ ++ airoha_qdma_wr(qdma, REG_TRTCM_DATA_LOW(addr), val); ++ airoha_qdma_wr(qdma, REG_TRTCM_CFG_PARAM(addr), config); ++ ++ return read_poll_timeout(airoha_qdma_rr, val, ++ val & TRTCM_PARAM_RW_DONE_MASK, ++ USEC_PER_MSEC, 10 * USEC_PER_MSEC, true, ++ qdma, REG_TRTCM_CFG_PARAM(addr)); ++} ++ ++static int airoha_qdma_set_trtcm_config(struct airoha_qdma *qdma, int channel, ++ u32 addr, enum trtcm_mode_type mode, ++ bool enable, u32 enable_mask) ++{ ++ u32 val; ++ ++ if (airoha_qdma_get_trtcm_param(qdma, channel, addr, TRTCM_MISC_MODE, ++ mode, &val, NULL)) ++ return -EINVAL; ++ ++ val = enable ? val | enable_mask : val & ~enable_mask; ++ ++ return airoha_qdma_set_trtcm_param(qdma, channel, addr, TRTCM_MISC_MODE, ++ mode, val); ++} ++ ++static int airoha_qdma_set_trtcm_token_bucket(struct airoha_qdma *qdma, ++ int channel, u32 addr, ++ enum trtcm_mode_type mode, ++ u32 rate_val, u32 bucket_size) ++{ ++ u32 val, config, tick, unit, rate, rate_frac; ++ int err; ++ ++ if (airoha_qdma_get_trtcm_param(qdma, channel, addr, TRTCM_MISC_MODE, ++ mode, &config, NULL)) ++ return -EINVAL; ++ ++ val = airoha_qdma_rr(qdma, addr); ++ tick = FIELD_GET(INGRESS_FAST_TICK_MASK, val); ++ if (config & TRTCM_TICK_SEL) ++ tick *= FIELD_GET(INGRESS_SLOW_TICK_RATIO_MASK, val); ++ if (!tick) ++ return -EINVAL; ++ ++ unit = (config & TRTCM_PKT_MODE) ? 1000000 / tick : 8000 / tick; ++ if (!unit) ++ return -EINVAL; ++ ++ rate = rate_val / unit; ++ rate_frac = rate_val % unit; ++ rate_frac = FIELD_PREP(TRTCM_TOKEN_RATE_MASK, rate_frac) / unit; ++ rate = FIELD_PREP(TRTCM_TOKEN_RATE_MASK, rate) | ++ FIELD_PREP(TRTCM_TOKEN_RATE_FRACTION_MASK, rate_frac); ++ ++ err = airoha_qdma_set_trtcm_param(qdma, channel, addr, ++ TRTCM_TOKEN_RATE_MODE, mode, rate); ++ if (err) ++ return err; ++ ++ val = max_t(u32, bucket_size, MIN_TOKEN_SIZE); ++ val = min_t(u32, __fls(val), MAX_TOKEN_SIZE_OFFSET); ++ ++ return airoha_qdma_set_trtcm_param(qdma, channel, addr, ++ TRTCM_BUCKETSIZE_SHIFT_MODE, ++ mode, val); ++} ++ ++static int airoha_qdma_set_tx_rate_limit(struct airoha_gdm_port *port, ++ int channel, u32 rate, ++ u32 bucket_size) ++{ ++ int i, err; ++ ++ for (i = 0; i <= TRTCM_PEAK_MODE; i++) { ++ err = airoha_qdma_set_trtcm_config(port->qdma, channel, ++ REG_EGRESS_TRTCM_CFG, i, ++ !!rate, TRTCM_METER_MODE); ++ if (err) ++ return err; ++ ++ err = airoha_qdma_set_trtcm_token_bucket(port->qdma, channel, ++ REG_EGRESS_TRTCM_CFG, ++ i, rate, bucket_size); ++ if (err) ++ return err; ++ } ++ ++ return 0; ++} ++ ++static int airoha_tc_htb_alloc_leaf_queue(struct airoha_gdm_port *port, ++ struct tc_htb_qopt_offload *opt) ++{ ++ u32 channel = TC_H_MIN(opt->classid) % AIROHA_NUM_QOS_CHANNELS; ++ u32 rate = div_u64(opt->rate, 1000) << 3; /* kbps */ ++ struct net_device *dev = port->dev; ++ int num_tx_queues = dev->real_num_tx_queues; ++ int err; ++ ++ if (opt->parent_classid != TC_HTB_CLASSID_ROOT) { ++ NL_SET_ERR_MSG_MOD(opt->extack, "invalid parent classid"); ++ return -EINVAL; ++ } ++ ++ err = airoha_qdma_set_tx_rate_limit(port, channel, rate, opt->quantum); ++ if (err) { ++ NL_SET_ERR_MSG_MOD(opt->extack, ++ "failed configuring htb offload"); ++ return err; ++ } ++ ++ if (opt->command == TC_HTB_NODE_MODIFY) ++ return 0; ++ ++ err = netif_set_real_num_tx_queues(dev, num_tx_queues + 1); ++ if (err) { ++ airoha_qdma_set_tx_rate_limit(port, channel, 0, opt->quantum); ++ NL_SET_ERR_MSG_MOD(opt->extack, ++ "failed setting real_num_tx_queues"); ++ return err; ++ } ++ ++ set_bit(channel, port->qos_sq_bmap); ++ opt->qid = AIROHA_NUM_TX_RING + channel; ++ ++ return 0; ++} ++ ++static void airoha_tc_remove_htb_queue(struct airoha_gdm_port *port, int queue) ++{ ++ struct net_device *dev = port->dev; ++ ++ netif_set_real_num_tx_queues(dev, dev->real_num_tx_queues - 1); ++ airoha_qdma_set_tx_rate_limit(port, queue + 1, 0, 0); ++ clear_bit(queue, port->qos_sq_bmap); ++} ++ ++static int airoha_tc_htb_delete_leaf_queue(struct airoha_gdm_port *port, ++ struct tc_htb_qopt_offload *opt) ++{ ++ u32 channel = TC_H_MIN(opt->classid) % AIROHA_NUM_QOS_CHANNELS; ++ ++ if (!test_bit(channel, port->qos_sq_bmap)) { ++ NL_SET_ERR_MSG_MOD(opt->extack, "invalid queue id"); ++ return -EINVAL; ++ } ++ ++ airoha_tc_remove_htb_queue(port, channel); ++ ++ return 0; ++} ++ ++static int airoha_tc_htb_destroy(struct airoha_gdm_port *port) ++{ ++ int q; ++ ++ for_each_set_bit(q, port->qos_sq_bmap, AIROHA_NUM_QOS_CHANNELS) ++ airoha_tc_remove_htb_queue(port, q); ++ ++ return 0; ++} ++ ++static int airoha_tc_get_htb_get_leaf_queue(struct airoha_gdm_port *port, ++ struct tc_htb_qopt_offload *opt) ++{ ++ u32 channel = TC_H_MIN(opt->classid) % AIROHA_NUM_QOS_CHANNELS; ++ ++ if (!test_bit(channel, port->qos_sq_bmap)) { ++ NL_SET_ERR_MSG_MOD(opt->extack, "invalid queue id"); ++ return -EINVAL; ++ } ++ ++ opt->qid = channel; ++ ++ return 0; ++} ++ ++static int airoha_tc_setup_qdisc_htb(struct airoha_gdm_port *port, ++ struct tc_htb_qopt_offload *opt) ++{ ++ switch (opt->command) { ++ case TC_HTB_CREATE: ++ break; ++ case TC_HTB_DESTROY: ++ return airoha_tc_htb_destroy(port); ++ case TC_HTB_NODE_MODIFY: ++ case TC_HTB_LEAF_ALLOC_QUEUE: ++ return airoha_tc_htb_alloc_leaf_queue(port, opt); ++ case TC_HTB_LEAF_DEL: ++ case TC_HTB_LEAF_DEL_LAST: ++ case TC_HTB_LEAF_DEL_LAST_FORCE: ++ return airoha_tc_htb_delete_leaf_queue(port, opt); ++ case TC_HTB_LEAF_QUERY_QUEUE: ++ return airoha_tc_get_htb_get_leaf_queue(port, opt); ++ default: ++ return -EOPNOTSUPP; ++ } ++ ++ return 0; ++} ++ + static int airoha_dev_tc_setup(struct net_device *dev, enum tc_setup_type type, + void *type_data) + { +@@ -2818,6 +3096,8 @@ static int airoha_dev_tc_setup(struct ne + switch (type) { + case TC_SETUP_QDISC_ETS: + return airoha_tc_setup_qdisc_ets(port, type_data); ++ case TC_SETUP_QDISC_HTB: ++ return airoha_tc_setup_qdisc_htb(port, type_data); + default: + return -EOPNOTSUPP; + } +@@ -2868,7 +3148,8 @@ static int airoha_alloc_gdm_port(struct + } + + dev = devm_alloc_etherdev_mqs(eth->dev, sizeof(*port), +- AIROHA_NUM_TX_RING, AIROHA_NUM_RX_RING); ++ AIROHA_NUM_NETDEV_TX_RINGS, ++ AIROHA_NUM_RX_RING); + if (!dev) { + dev_err(eth->dev, "alloc_etherdev failed\n"); + return -ENOMEM; +@@ -2888,6 +3169,11 @@ static int airoha_alloc_gdm_port(struct + dev->irq = qdma->irq; + SET_NETDEV_DEV(dev, eth->dev); + ++ /* reserve hw queues for HTB offloading */ ++ err = netif_set_real_num_tx_queues(dev, AIROHA_NUM_TX_RING); ++ if (err) ++ return err; ++ + err = of_get_ethdev_address(np, dev); + if (err) { + if (err == -EPROBE_DEFER) From 74b8a296cbe8e6fa373bedea005ebfb3befeafb9 Mon Sep 17 00:00:00 2001 From: Lorenzo Bianconi Date: Sat, 4 Jan 2025 15:46:57 +0100 Subject: [PATCH 336/877] kernel: modules: Add ETS Qdisc scheduler to sched KernelPackage Add ETS Qdisch scheduler to kernel package modules. Signed-off-by: Lorenzo Bianconi [ add commit description ] Signed-off-by: Christian Marangi (cherry picked from commit 7e237f190225c0bcba0f5374632d0508f11398a8) --- package/kernel/linux/modules/netsupport.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/kernel/linux/modules/netsupport.mk b/package/kernel/linux/modules/netsupport.mk index 3551a89a9b2e91..06ef82328091bd 100644 --- a/package/kernel/linux/modules/netsupport.mk +++ b/package/kernel/linux/modules/netsupport.mk @@ -1026,7 +1026,7 @@ endef $(eval $(call KernelPackage,bpf-test)) -SCHED_MODULES_EXTRA = sch_codel sch_gred sch_multiq sch_sfq sch_teql sch_fq act_pedit act_simple act_skbmod act_csum em_cmp em_nbyte em_meta em_text +SCHED_MODULES_EXTRA = sch_codel sch_gred sch_multiq sch_sfq sch_teql sch_fq sch_ets act_pedit act_simple act_skbmod act_csum em_cmp em_nbyte em_meta em_text SCHED_FILES_EXTRA = $(foreach mod,$(SCHED_MODULES_EXTRA),$(LINUX_DIR)/net/sched/$(mod).ko) define KernelPackage/sched @@ -1040,6 +1040,7 @@ define KernelPackage/sched CONFIG_NET_SCH_SFQ \ CONFIG_NET_SCH_TEQL \ CONFIG_NET_SCH_FQ \ + CONFIG_NET_SCH_ETS \ CONFIG_NET_ACT_PEDIT \ CONFIG_NET_ACT_SIMP \ CONFIG_NET_ACT_SKBMOD \ From 6b4fcc55a9b73fbbcbf68484dd35b1cb78873496 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 10 Jan 2025 14:27:07 +0100 Subject: [PATCH 337/877] airoha: an7581: add patch fixing support for MMC Add patch fixing support for MMC. Additional clock are needed for MMC to work and some small fixup to make the Mediatek MMC driver on Airoha SoC. Signed-off-by: Christian Marangi (cherry picked from commit be5a9ff24b9c3b7d1b5bf508b84a35be9f9b3ea9) --- ...k-clock-handling-for-different-clock.patch | 82 +++++++++++ ...ck-drop-NUM_CLOCKS-define-for-EN7581.patch | 23 +++ ...ngs-clock-add-ID-for-eMMC-for-EN7581.patch | 23 +++ ...en7523-Add-clock-for-eMMC-for-EN7581.patch | 39 +++++ ...k-sd-add-support-for-AN7581-MMC-Host.patch | 138 ++++++++++++++++++ 5 files changed, 305 insertions(+) create mode 100644 target/linux/airoha/patches-6.6/110-01-clk-en7523-Rework-clock-handling-for-different-clock.patch create mode 100644 target/linux/airoha/patches-6.6/110-02-dt-bindings-clock-drop-NUM_CLOCKS-define-for-EN7581.patch create mode 100644 target/linux/airoha/patches-6.6/110-03-dt-bindings-clock-add-ID-for-eMMC-for-EN7581.patch create mode 100644 target/linux/airoha/patches-6.6/110-04-clk-en7523-Add-clock-for-eMMC-for-EN7581.patch create mode 100644 target/linux/airoha/patches-6.6/111-mmc-mtk-sd-add-support-for-AN7581-MMC-Host.patch diff --git a/target/linux/airoha/patches-6.6/110-01-clk-en7523-Rework-clock-handling-for-different-clock.patch b/target/linux/airoha/patches-6.6/110-01-clk-en7523-Rework-clock-handling-for-different-clock.patch new file mode 100644 index 00000000000000..7333ebbdf2607e --- /dev/null +++ b/target/linux/airoha/patches-6.6/110-01-clk-en7523-Rework-clock-handling-for-different-clock.patch @@ -0,0 +1,82 @@ +From 04cd09990fdc3106d9fc4c47dda100e521d62a43 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Wed, 18 Dec 2024 10:03:45 +0100 +Subject: [PATCH 1/4] clk: en7523: Rework clock handling for different clock + numbers + +Airoha EN7581 SoC have additional clock compared to EN7523 but current +driver permits to only support up to EN7523 clock numbers. + +To handle this, rework the clock handling and permit to declare the +clocks number in match_data and alloca clk_data based on the compatible +match_data. + +Signed-off-by: Christian Marangi +--- + drivers/clk/clk-en7523.c | 14 ++++++++------ + 1 file changed, 8 insertions(+), 6 deletions(-) + +--- a/drivers/clk/clk-en7523.c ++++ b/drivers/clk/clk-en7523.c +@@ -75,6 +75,7 @@ struct en_rst_data { + }; + + struct en_clk_soc_data { ++ u32 num_clocks; + const struct clk_ops pcie_ops; + int (*hw_init)(struct platform_device *pdev, + struct clk_hw_onecell_data *clk_data); +@@ -525,8 +526,6 @@ static void en7523_register_clocks(struc + + hw = en7523_register_pcie_clk(dev, np_base); + clk_data->hws[EN7523_CLK_PCIE] = hw; +- +- clk_data->num = EN7523_NUM_CLOCKS; + } + + static int en7523_clk_hw_init(struct platform_device *pdev, +@@ -587,8 +586,6 @@ static void en7581_register_clocks(struc + + hw = en7523_register_pcie_clk(dev, base); + clk_data->hws[EN7523_CLK_PCIE] = hw; +- +- clk_data->num = EN7523_NUM_CLOCKS; + } + + static int en7523_reset_update(struct reset_controller_dev *rcdev, +@@ -702,21 +699,24 @@ static int en7523_clk_probe(struct platf + struct clk_hw_onecell_data *clk_data; + int r; + ++ soc_data = device_get_match_data(&pdev->dev); ++ + clk_data = devm_kzalloc(&pdev->dev, +- struct_size(clk_data, hws, EN7523_NUM_CLOCKS), ++ struct_size(clk_data, hws, soc_data->num_clocks), + GFP_KERNEL); + if (!clk_data) + return -ENOMEM; + +- soc_data = device_get_match_data(&pdev->dev); + r = soc_data->hw_init(pdev, clk_data); + if (r) + return r; + ++ clk_data->num = soc_data->num_clocks; + return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data); + } + + static const struct en_clk_soc_data en7523_data = { ++ .num_clocks = ARRAY_SIZE(en7523_base_clks) + 1, + .pcie_ops = { + .is_enabled = en7523_pci_is_enabled, + .prepare = en7523_pci_prepare, +@@ -726,6 +726,8 @@ static const struct en_clk_soc_data en75 + }; + + static const struct en_clk_soc_data en7581_data = { ++ /* We increment num_clocks by 1 to account for additional PCIe clock */ ++ .num_clocks = ARRAY_SIZE(en7581_base_clks) + 1, + .pcie_ops = { + .is_enabled = en7581_pci_is_enabled, + .enable = en7581_pci_enable, diff --git a/target/linux/airoha/patches-6.6/110-02-dt-bindings-clock-drop-NUM_CLOCKS-define-for-EN7581.patch b/target/linux/airoha/patches-6.6/110-02-dt-bindings-clock-drop-NUM_CLOCKS-define-for-EN7581.patch new file mode 100644 index 00000000000000..e858d8b77d4c3b --- /dev/null +++ b/target/linux/airoha/patches-6.6/110-02-dt-bindings-clock-drop-NUM_CLOCKS-define-for-EN7581.patch @@ -0,0 +1,23 @@ +From 8fc9b68ee448d0e687d4dc52ec95bf367eb04caa Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Thu, 19 Dec 2024 13:13:37 +0100 +Subject: [PATCH 2/4] dt-bindings: clock: drop NUM_CLOCKS define for EN7581 + +Drop NUM_CLOCKS define for EN7581 include. This is not a binding and +should not be placed here. Value is derived internally in the user +driver. + +Signed-off-by: Christian Marangi +--- + include/dt-bindings/clock/en7523-clk.h | 2 -- + 1 file changed, 2 deletions(-) + +--- a/include/dt-bindings/clock/en7523-clk.h ++++ b/include/dt-bindings/clock/en7523-clk.h +@@ -12,6 +12,4 @@ + #define EN7523_CLK_CRYPTO 6 + #define EN7523_CLK_PCIE 7 + +-#define EN7523_NUM_CLOCKS 8 +- + #endif /* _DT_BINDINGS_CLOCK_AIROHA_EN7523_H_ */ diff --git a/target/linux/airoha/patches-6.6/110-03-dt-bindings-clock-add-ID-for-eMMC-for-EN7581.patch b/target/linux/airoha/patches-6.6/110-03-dt-bindings-clock-add-ID-for-eMMC-for-EN7581.patch new file mode 100644 index 00000000000000..7bc987f4203679 --- /dev/null +++ b/target/linux/airoha/patches-6.6/110-03-dt-bindings-clock-add-ID-for-eMMC-for-EN7581.patch @@ -0,0 +1,23 @@ +From 238436f998c551688695d26ecdcd2ea4d51190b1 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Wed, 11 Dec 2024 12:22:37 +0100 +Subject: [PATCH 3/4] dt-bindings: clock: add ID for eMMC for EN7581 + +Add ID for eMMC for EN7581. This is to control clock selection of eMMC +between 200MHz and 150MHz. + +Signed-off-by: Christian Marangi +Acked-by: Conor Dooley +--- + include/dt-bindings/clock/en7523-clk.h | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/include/dt-bindings/clock/en7523-clk.h ++++ b/include/dt-bindings/clock/en7523-clk.h +@@ -12,4 +12,6 @@ + #define EN7523_CLK_CRYPTO 6 + #define EN7523_CLK_PCIE 7 + ++#define EN7581_CLK_EMMC 8 ++ + #endif /* _DT_BINDINGS_CLOCK_AIROHA_EN7523_H_ */ diff --git a/target/linux/airoha/patches-6.6/110-04-clk-en7523-Add-clock-for-eMMC-for-EN7581.patch b/target/linux/airoha/patches-6.6/110-04-clk-en7523-Add-clock-for-eMMC-for-EN7581.patch new file mode 100644 index 00000000000000..64d53391769ab1 --- /dev/null +++ b/target/linux/airoha/patches-6.6/110-04-clk-en7523-Add-clock-for-eMMC-for-EN7581.patch @@ -0,0 +1,39 @@ +From 4fc22765b3888cf6575015b904718bfd36d1f49c Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Wed, 11 Dec 2024 12:22:38 +0100 +Subject: [PATCH 4/4] clk: en7523: Add clock for eMMC for EN7581 + +Add clock for eMMC for EN7581. This is used to give info of the current +eMMC source clock and to switch it from 200MHz or 150MHz. + +Signed-off-by: Christian Marangi +--- + drivers/clk/clk-en7523.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/drivers/clk/clk-en7523.c ++++ b/drivers/clk/clk-en7523.c +@@ -91,6 +91,7 @@ static const u32 emi7581_base[] = { 5400 + static const u32 bus7581_base[] = { 600000000, 540000000 }; + static const u32 npu7581_base[] = { 800000000, 750000000, 720000000, 600000000 }; + static const u32 crypto_base[] = { 540000000, 480000000 }; ++static const u32 emmc7581_base[] = { 200000000, 150000000 }; + + static const struct en_clk_desc en7523_base_clks[] = { + { +@@ -281,6 +282,15 @@ static const struct en_clk_desc en7581_b + .base_shift = 0, + .base_values = crypto_base, + .n_base_values = ARRAY_SIZE(crypto_base), ++ }, { ++ .id = EN7581_CLK_EMMC, ++ .name = "emmc", ++ ++ .base_reg = REG_CRYPTO_CLKSRC2, ++ .base_bits = 1, ++ .base_shift = 12, ++ .base_values = emmc7581_base, ++ .n_base_values = ARRAY_SIZE(emmc7581_base), + } + }; + diff --git a/target/linux/airoha/patches-6.6/111-mmc-mtk-sd-add-support-for-AN7581-MMC-Host.patch b/target/linux/airoha/patches-6.6/111-mmc-mtk-sd-add-support-for-AN7581-MMC-Host.patch new file mode 100644 index 00000000000000..24c4dbde786584 --- /dev/null +++ b/target/linux/airoha/patches-6.6/111-mmc-mtk-sd-add-support-for-AN7581-MMC-Host.patch @@ -0,0 +1,138 @@ +From f38f16925e1aa7cc71f63d3d52997b1c98cd7781 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Wed, 11 Dec 2024 11:27:10 +0100 +Subject: [PATCH 4/4] mmc: mtk-sd: add support for AN7581 MMC Host + +Add support for AN7581 MMC Host. The MMC Host controller is based on +mt7622 with the difference of not having regulator supply and state_uhs +pins and hclk clock. + +Some minor fixes are applied to check if the state_uhs pins are defined +and make hclk optional for the new airoha compatible. + +Signed-off-by: Christian Marangi +--- + drivers/mmc/host/mtk-sd.c | 55 ++++++++++++++++++++++++++++++++------- + 1 file changed, 46 insertions(+), 9 deletions(-) + +--- a/drivers/mmc/host/mtk-sd.c ++++ b/drivers/mmc/host/mtk-sd.c +@@ -615,6 +615,19 @@ static const struct mtk_mmc_compatible m + .stop_clk_fix = true, + }; + ++static const struct mtk_mmc_compatible an7581_compat = { ++ .clk_div_bits = 12, ++ .recheck_sdio_irq = true, ++ .hs400_tune = false, ++ .pad_tune_reg = MSDC_PAD_TUNE0, ++ .async_fifo = true, ++ .data_tune = true, ++ .busy_check = true, ++ .stop_clk_fix = true, ++ .enhance_rx = true, ++ .support_64g = false, ++}; ++ + static const struct of_device_id msdc_of_ids[] = { + { .compatible = "mediatek,mt2701-mmc", .data = &mt2701_compat}, + { .compatible = "mediatek,mt2712-mmc", .data = &mt2712_compat}, +@@ -627,7 +640,7 @@ static const struct of_device_id msdc_of + { .compatible = "mediatek,mt8173-mmc", .data = &mt8173_compat}, + { .compatible = "mediatek,mt8183-mmc", .data = &mt8183_compat}, + { .compatible = "mediatek,mt8516-mmc", .data = &mt8516_compat}, +- ++ { .compatible = "airoha,an7581-mmc", .data = &an7581_compat}, + {} + }; + MODULE_DEVICE_TABLE(of, msdc_of_ids); +@@ -1479,6 +1492,10 @@ static int msdc_ops_switch_volt(struct m + struct msdc_host *host = mmc_priv(mmc); + int ret; + ++ /* Skip setting supply if not supported */ ++ if (!mmc->supply.vqmmc) ++ return 0; ++ + if (!IS_ERR(mmc->supply.vqmmc)) { + if (ios->signal_voltage != MMC_SIGNAL_VOLTAGE_330 && + ios->signal_voltage != MMC_SIGNAL_VOLTAGE_180) { +@@ -1578,7 +1595,9 @@ static void msdc_enable_sdio_irq(struct + dev_dbg(host->dev, "SDIO eint irq: %d!\n", host->eint_irq); + } + +- pinctrl_select_state(host->pinctrl, host->pins_uhs); ++ /* Skip setting uhs pins if not supported */ ++ if (host->pins_uhs) ++ pinctrl_select_state(host->pinctrl, host->pins_uhs); + } else { + dev_pm_clear_wake_irq(host->dev); + } +@@ -1886,6 +1905,10 @@ static void msdc_ops_set_ios(struct mmc_ + + msdc_set_buswidth(host, ios->bus_width); + ++ /* Skip regulator if not supported */ ++ if (!mmc->supply.vmmc) ++ goto skip_regulator; ++ + /* Suspend/Resume will do power off/on */ + switch (ios->power_mode) { + case MMC_POWER_UP: +@@ -1921,6 +1944,7 @@ static void msdc_ops_set_ios(struct mmc_ + break; + } + ++skip_regulator: + if (host->mclk != ios->clock || host->timing != ios->timing) + msdc_set_mclk(host, ios->timing, ios->clock); + } +@@ -2617,9 +2641,12 @@ static int msdc_of_clock_parse(struct pl + if (IS_ERR(host->src_clk)) + return PTR_ERR(host->src_clk); + +- host->h_clk = devm_clk_get(&pdev->dev, "hclk"); +- if (IS_ERR(host->h_clk)) +- return PTR_ERR(host->h_clk); ++ /* AN7581 SoC doesn't have hclk */ ++ if (!device_is_compatible(&pdev->dev, "airoha,an7581-mmc")) { ++ host->h_clk = devm_clk_get(&pdev->dev, "hclk"); ++ if (IS_ERR(host->h_clk)) ++ return PTR_ERR(host->h_clk); ++ } + + host->bus_clk = devm_clk_get_optional(&pdev->dev, "bus_clk"); + if (IS_ERR(host->bus_clk)) +@@ -2740,11 +2767,14 @@ static int msdc_drv_probe(struct platfor + goto host_free; + } + +- host->pins_uhs = pinctrl_lookup_state(host->pinctrl, "state_uhs"); +- if (IS_ERR(host->pins_uhs)) { +- ret = PTR_ERR(host->pins_uhs); +- dev_err(&pdev->dev, "Cannot find pinctrl uhs!\n"); +- goto host_free; ++ /* AN7581 doesn't have state_uhs pins */ ++ if (!device_is_compatible(&pdev->dev, "airoha,an7581-mmc")) { ++ host->pins_uhs = pinctrl_lookup_state(host->pinctrl, "state_uhs"); ++ if (IS_ERR(host->pins_uhs)) { ++ ret = PTR_ERR(host->pins_uhs); ++ dev_err(&pdev->dev, "Cannot find pinctrl uhs!\n"); ++ goto host_free; ++ } + } + + /* Support for SDIO eint irq ? */ +@@ -2825,6 +2855,12 @@ static int msdc_drv_probe(struct platfor + dev_err(&pdev->dev, "Cannot ungate clocks!\n"); + goto release_mem; + } ++ ++ /* AN7581 without regulator require tune to OCR values */ ++ if (device_is_compatible(&pdev->dev, "airoha,an7581-mmc") && ++ !mmc->ocr_avail) ++ mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; ++ + msdc_init_hw(host); + + if (mmc->caps2 & MMC_CAP2_CQE) { From 99689859f0eb9ddf68bb41d6f4dec5aa42783e54 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 10 Jan 2025 14:28:20 +0100 Subject: [PATCH 338/877] airoha: an7581: add pending patch to fix PCI Add pending patch to fix PCIe missing register. Signed-off-by: Christian Marangi (cherry picked from commit 77329b7d8d870897d85270a4e806ec0d04396685) --- ...3-configure-PBUS_CSR-registers-for-E.patch | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 target/linux/airoha/patches-6.6/112-PCI-mediatek-gen3-configure-PBUS_CSR-registers-for-E.patch diff --git a/target/linux/airoha/patches-6.6/112-PCI-mediatek-gen3-configure-PBUS_CSR-registers-for-E.patch b/target/linux/airoha/patches-6.6/112-PCI-mediatek-gen3-configure-PBUS_CSR-registers-for-E.patch new file mode 100644 index 00000000000000..d896e1aee3ffa8 --- /dev/null +++ b/target/linux/airoha/patches-6.6/112-PCI-mediatek-gen3-configure-PBUS_CSR-registers-for-E.patch @@ -0,0 +1,83 @@ +From 2285d3b428c7d8f1c4fda2fb995e7e46a05350e0 Mon Sep 17 00:00:00 2001 +Message-ID: <2285d3b428c7d8f1c4fda2fb995e7e46a05350e0.1736324542.git.lorenzo@kernel.org> +In-Reply-To: <0c0ae72f5c84c5a29495337b254ac3cc2d5c16bb.1736324541.git.lorenzo@kernel.org> +References: <0c0ae72f5c84c5a29495337b254ac3cc2d5c16bb.1736324541.git.lorenzo@kernel.org> +From: Lorenzo Bianconi +Date: Tue, 3 Sep 2024 23:14:02 +0200 +Subject: [PATCH 2/2] PCI: mediatek-gen3: configure PBUS_CSR registers for + EN7581 SoC + +Configure PBus base address and address mask in order to allow the hw +detecting if a given address is on PCIE0, PCIE1 or PCIE2. + +Signed-off-by: Lorenzo Bianconi +--- + drivers/pci/controller/pcie-mediatek-gen3.c | 29 ++++++++++++++++++++- + 1 file changed, 28 insertions(+), 1 deletion(-) + +--- a/drivers/pci/controller/pcie-mediatek-gen3.c ++++ b/drivers/pci/controller/pcie-mediatek-gen3.c +@@ -15,6 +15,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -24,6 +25,7 @@ + #include + #include + #include ++#include + #include + + #include "../pci.h" +@@ -120,6 +122,13 @@ + + #define MAX_NUM_PHY_RESETS 3 + ++#define PCIE_EN7581_PBUS_ADDR(_n) (0x00 + ((_n) << 3)) ++#define PCIE_EN7581_PBUS_ADDR_MASK(_n) (0x04 + ((_n) << 3)) ++#define PCIE_EN7581_PBUS_BASE_ADDR(_n) \ ++ ((_n) == 2 ? 0x28000000 : \ ++ (_n) == 1 ? 0x24000000 : 0x20000000) ++#define PCIE_EN7581_PBUS_BASE_ADDR_MASK GENMASK(31, 26) ++ + /* Time in ms needed to complete PCIe reset on EN7581 SoC */ + #define PCIE_EN7581_RESET_TIME_MS 100 + +@@ -871,7 +880,8 @@ static int mtk_pcie_parse_port(struct mt + static int mtk_pcie_en7581_power_up(struct mtk_gen3_pcie *pcie) + { + struct device *dev = pcie->dev; +- int err; ++ struct regmap *map; ++ int err, slot; + u32 val; + + /* +@@ -880,6 +890,23 @@ static int mtk_pcie_en7581_power_up(stru + */ + mdelay(PCIE_EN7581_RESET_TIME_MS); + ++ map = syscon_regmap_lookup_by_compatible("airoha,en7581-pbus-csr"); ++ if (IS_ERR(map)) ++ return PTR_ERR(map); ++ ++ /* ++ * Configure PBus base address and address mask in order to allow the ++ * hw detecting if a given address is on PCIE0, PCIE1 or PCIE2. ++ */ ++ slot = of_get_pci_domain_nr(dev->of_node); ++ if (slot < 0) ++ return slot; ++ ++ regmap_write(map, PCIE_EN7581_PBUS_ADDR(slot), ++ PCIE_EN7581_PBUS_BASE_ADDR(slot)); ++ regmap_write(map, PCIE_EN7581_PBUS_ADDR_MASK(slot), ++ PCIE_EN7581_PBUS_BASE_ADDR_MASK); ++ + err = phy_init(pcie->phy); + if (err) { + dev_err(dev, "failed to initialize PHY\n"); From 9a18304344075383c2e5b406a0f2126909a516e3 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 10 Jan 2025 14:29:02 +0100 Subject: [PATCH 339/877] airoha: an7581: add pending patch for ETS qdisc on ethernet driver Add pending patch for ETS qdisc on Airoha ethernet driver. Signed-off-by: Christian Marangi (cherry picked from commit 53bc7633317a7da9bf7ef440ed3da39404cf146e) --- ...-channel-configuration-for-ETS-Qdisc.patch | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 target/linux/airoha/patches-6.6/113-net-airoha-Fix-channel-configuration-for-ETS-Qdisc.patch diff --git a/target/linux/airoha/patches-6.6/113-net-airoha-Fix-channel-configuration-for-ETS-Qdisc.patch b/target/linux/airoha/patches-6.6/113-net-airoha-Fix-channel-configuration-for-ETS-Qdisc.patch new file mode 100644 index 00000000000000..5bd7487b9f2b83 --- /dev/null +++ b/target/linux/airoha/patches-6.6/113-net-airoha-Fix-channel-configuration-for-ETS-Qdisc.patch @@ -0,0 +1,104 @@ +From patchwork Tue Jan 7 22:26:28 2025 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Lorenzo Bianconi +X-Patchwork-Id: 13929634 +X-Patchwork-Delegate: kuba@kernel.org +Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org + [10.30.226.201]) + (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) + (No client certificate requested) + by smtp.subspace.kernel.org (Postfix) with ESMTPS id A82271A3035 + for ; Tue, 7 Jan 2025 22:27:02 +0000 (UTC) +Authentication-Results: smtp.subspace.kernel.org; + arc=none smtp.client-ip=10.30.226.201 +ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; + t=1736288822; cv=none; + b=XZhiaYPBxLiUvOxWeE7zfuFI3fOmu5SLoHdLPFXNXBtvmZWWIohKA8AeGI37v/l+0Du9JwGRKMkb19v/IxDJtMXkyTJXHHKYhXWaNFpj/pFRk9C4WsIa29OCqanfA+yXUQLJyGVopMLsxfcbzznozIANWbaO0NVBHyZZSH9eaYU= +ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; + s=arc-20240116; t=1736288822; c=relaxed/simple; + bh=/BuvRwLGk+7by7QeOu7n+QgJ5Sk03TO9WCsGbgTs3sE=; + h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; + b=jHXwJfD+6o5WvM5xaeL35BI6hshOViNtg+mSqf5q8jH9l3k6FctngCkEYdxJzcYaw9aEEigC8/FZiHoPrIXGyJA29kTWkYSjj7rtagL1aSIWPGAuSJaaAUv2Bj8jxUmIlJxb23wTleEv/Pwnz+1oSf3yZ7g46h9gv4RZaU8yySg= +ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; + dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org + header.b=Gx3FMrdJ; arc=none smtp.client-ip=10.30.226.201 +Authentication-Results: smtp.subspace.kernel.org; + dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org + header.b="Gx3FMrdJ" +Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1A57C4CED6; + Tue, 7 Jan 2025 22:27:01 +0000 (UTC) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; + s=k20201202; t=1736288822; + bh=/BuvRwLGk+7by7QeOu7n+QgJ5Sk03TO9WCsGbgTs3sE=; + h=From:Date:Subject:To:Cc:From; + b=Gx3FMrdJH+xaen2jSRnu523A40ZOBBFaj896IwBv1PeosUm+eiUCx+K3Qz9CAisX0 + Bj4ohheTiHZDQHZelhKF3ZFTfVQUyYiLiard4x5QdylW2YZA0cpwJe64TMf7CsHbrT + NHCF7nrJPJUwOhDoS/YVdeTw/bb9DlM95aKGSfyH0cy7Kdmjz55No3Im9bCSKcgyaX + Y/lcRZglFjbLyiC3LS06AtM0KOyhUxQKrH+ZWpx5E/sdOEj3SRTJ/I+K8o3m75Kzsn + wKRft5pBwfhGEIrJXrFR4f73QwnxJ6eSUrfjYV8k4mFQpH3nB0hKLi2DpvYPim5dj/ + ADsdcP6QPwokg== +From: Lorenzo Bianconi +Date: Tue, 07 Jan 2025 23:26:28 +0100 +Subject: [PATCH net-next] net: airoha: Fix channel configuration for ETS + Qdisc +Precedence: bulk +X-Mailing-List: netdev@vger.kernel.org +List-Id: +List-Subscribe: +List-Unsubscribe: +MIME-Version: 1.0 +Message-Id: <20250107-airoha-ets-fix-chan-v1-1-97f66ed3a068@kernel.org> +X-B4-Tracking: v=1; b=H4sIABOqfWcC/x2MSwqAMAwFryJZG6ifVvAq4qLUaLNRaUSE0rsbX + Q5v3mQQSkwCY5Uh0c3Cx67Q1BWE6PeNkBdlaE1rTWMG9JyO6JEuwZUf/CSkzobgw+AW14M+z0S + 6/dVpLuUFNrlCSGUAAAA= +X-Change-ID: 20250107-airoha-ets-fix-chan-e35ccac76d64 +To: Felix Fietkau , Sean Wang , + Mark Lee , Andrew Lunn , + "David S. Miller" , Eric Dumazet , + Jakub Kicinski , Paolo Abeni , + Matthias Brugger , + AngeloGioacchino Del Regno +Cc: linux-arm-kernel@lists.infradead.org, + linux-mediatek@lists.infradead.org, netdev@vger.kernel.org, + Lorenzo Bianconi +X-Mailer: b4 0.14.2 +X-Patchwork-Delegate: kuba@kernel.org + +Limit ETS QoS channel to AIROHA_NUM_QOS_CHANNELS in +airoha_tc_setup_qdisc_ets() in order to align the configured channel to +the value set in airoha_dev_select_queue(). + +Fixes: 20bf7d07c956 ("net: airoha: Add sched ETS offload support") +Signed-off-by: Lorenzo Bianconi +Reviewed-by: Michal Swiatkowski +--- + drivers/net/ethernet/mediatek/airoha_eth.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + + +--- +base-commit: a1942da8a38717ddd9b4c132f59e1657c85c1432 +change-id: 20250107-airoha-ets-fix-chan-e35ccac76d64 + +Best regards, + +--- a/drivers/net/ethernet/mediatek/airoha_eth.c ++++ b/drivers/net/ethernet/mediatek/airoha_eth.c +@@ -2833,11 +2833,14 @@ static int airoha_qdma_get_tx_ets_stats( + static int airoha_tc_setup_qdisc_ets(struct airoha_gdm_port *port, + struct tc_ets_qopt_offload *opt) + { +- int channel = TC_H_MAJ(opt->handle) >> 16; ++ int channel; + + if (opt->parent == TC_H_ROOT) + return -EINVAL; + ++ channel = TC_H_MAJ(opt->handle) >> 16; ++ channel = channel % AIROHA_NUM_QOS_CHANNELS; ++ + switch (opt->command) { + case TC_ETS_REPLACE: + return airoha_qdma_set_tx_ets_sched(port, channel, opt); From 90c29d2c04407f3269c299eaa239c3be283981c9 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 10 Jan 2025 14:53:04 +0100 Subject: [PATCH 340/877] airoha: an7581: replace cpufreq patch with new version Replace cpufreq patch with new version requested upstream. Signed-off-by: Christian Marangi (cherry picked from commit 506955735075241d3467d632cae7ed5f10e21c2f) --- ...oha-Add-Airoha-CPU-PM-Domain-support.patch | 201 ++++++++++++++ ...roha-Add-EN7581-CPUFreq-SMCCC-driver.patch | 253 ++++++++++++++++++ ...airoha-Add-EN7581-Cpufreq-SMC-driver.patch | 247 ----------------- 3 files changed, 454 insertions(+), 247 deletions(-) create mode 100644 target/linux/airoha/patches-6.6/100-01-pmdomain-airoha-Add-Airoha-CPU-PM-Domain-support.patch create mode 100644 target/linux/airoha/patches-6.6/100-02-cpufreq-airoha-Add-EN7581-CPUFreq-SMCCC-driver.patch delete mode 100644 target/linux/airoha/patches-6.6/100-cpufreq-airoha-Add-EN7581-Cpufreq-SMC-driver.patch diff --git a/target/linux/airoha/patches-6.6/100-01-pmdomain-airoha-Add-Airoha-CPU-PM-Domain-support.patch b/target/linux/airoha/patches-6.6/100-01-pmdomain-airoha-Add-Airoha-CPU-PM-Domain-support.patch new file mode 100644 index 00000000000000..52d3f40b36983b --- /dev/null +++ b/target/linux/airoha/patches-6.6/100-01-pmdomain-airoha-Add-Airoha-CPU-PM-Domain-support.patch @@ -0,0 +1,201 @@ +From 76e4e6ce9aaae897f80e375345bf0095e1b09ff2 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Sat, 4 Jan 2025 19:03:09 +0100 +Subject: [PATCH v9 1/2] pmdomain: airoha: Add Airoha CPU PM Domain support + +Add Airoha CPU PM Domain support to control frequency and power of CPU +present on Airoha EN7581 SoC. + +Frequency and power can be controlled with the use of the SMC command by +passing the performance state. The driver also expose a read-only clock +that expose the current CPU frequency with SMC command. + +Signed-off-by: Christian Marangi +--- +Changes v9: +- Fix compile error targetting wrong branch (remove_new change) +Changes v8: +- Add this patch +- Use SMC invoke instead of 1.2 + + drivers/pmdomain/mediatek/Kconfig | 11 ++ + drivers/pmdomain/mediatek/Makefile | 1 + + .../pmdomain/mediatek/airoha-cpu-pmdomain.c | 144 ++++++++++++++++++ + 3 files changed, 156 insertions(+) + create mode 100644 drivers/pmdomain/mediatek/airoha-cpu-pmdomain.c + +--- a/drivers/soc/mediatek/Kconfig ++++ b/drivers/soc/mediatek/Kconfig +@@ -72,6 +72,17 @@ config MTK_SCPSYS_PM_DOMAINS + Control Processor System (SCPSYS) has several power management related + tasks in the system. + ++config AIROHA_CPU_PM_DOMAIN ++ tristate "Airoha CPU power domain" ++ default ARCH_AIROHA ++ depends on PM ++ select PM_GENERIC_DOMAINS ++ help ++ Say y here to enable CPU power domain support for Airoha SoC. ++ ++ CPU frequency and power is controlled by ATF with SMC command to ++ set performance states. ++ + config MTK_MMSYS + tristate "MediaTek MMSYS Support" + default ARCH_MEDIATEK +--- a/drivers/pmdomain/mediatek/Makefile ++++ b/drivers/pmdomain/mediatek/Makefile +@@ -1,3 +1,4 @@ + # SPDX-License-Identifier: GPL-2.0-only + obj-$(CONFIG_MTK_SCPSYS) += mtk-scpsys.o + obj-$(CONFIG_MTK_SCPSYS_PM_DOMAINS) += mtk-pm-domains.o ++obj-$(CONFIG_AIROHA_CPU_PM_DOMAIN) += airoha-cpu-pmdomain.o +--- /dev/null ++++ b/drivers/pmdomain/mediatek/airoha-cpu-pmdomain.c +@@ -0,0 +1,145 @@ ++// SPDX-License-Identifier: GPL-2.0 ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define AIROHA_SIP_AVS_HANDLE 0x82000301 ++#define AIROHA_AVS_OP_BASE 0xddddddd0 ++#define AIROHA_AVS_OP_MASK GENMASK(1, 0) ++#define AIROHA_AVS_OP_FREQ_DYN_ADJ (AIROHA_AVS_OP_BASE | \ ++ FIELD_PREP(AIROHA_AVS_OP_MASK, 0x1)) ++#define AIROHA_AVS_OP_GET_FREQ (AIROHA_AVS_OP_BASE | \ ++ FIELD_PREP(AIROHA_AVS_OP_MASK, 0x2)) ++ ++struct airoha_cpu_pmdomain_priv { ++ struct clk_hw hw; ++ struct generic_pm_domain pd; ++}; ++ ++static long airoha_cpu_pmdomain_clk_round(struct clk_hw *hw, unsigned long rate, ++ unsigned long *parent_rate) ++{ ++ return rate; ++} ++ ++static unsigned long airoha_cpu_pmdomain_clk_get(struct clk_hw *hw, ++ unsigned long parent_rate) ++{ ++ struct arm_smccc_res res; ++ ++ arm_smccc_1_1_invoke(AIROHA_SIP_AVS_HANDLE, AIROHA_AVS_OP_GET_FREQ, ++ 0, 0, 0, 0, 0, 0, &res); ++ ++ /* SMCCC returns freq in MHz */ ++ return (int)(res.a0 * 1000 * 1000); ++} ++ ++/* Airoha CPU clk SMCC is always enabled */ ++static int airoha_cpu_pmdomain_clk_is_enabled(struct clk_hw *hw) ++{ ++ return true; ++} ++ ++static const struct clk_ops airoha_cpu_pmdomain_clk_ops = { ++ .recalc_rate = airoha_cpu_pmdomain_clk_get, ++ .is_enabled = airoha_cpu_pmdomain_clk_is_enabled, ++ .round_rate = airoha_cpu_pmdomain_clk_round, ++}; ++ ++static int airoha_cpu_pmdomain_set_performance_state(struct generic_pm_domain *domain, ++ unsigned int state) ++{ ++ struct arm_smccc_res res; ++ ++ arm_smccc_1_1_invoke(AIROHA_SIP_AVS_HANDLE, AIROHA_AVS_OP_FREQ_DYN_ADJ, ++ 0, state, 0, 0, 0, 0, &res); ++ ++ /* SMC signal correct apply by unsetting BIT 0 */ ++ return res.a0 & BIT(0) ? -EINVAL : 0; ++} ++ ++static int airoha_cpu_pmdomain_probe(struct platform_device *pdev) ++{ ++ struct airoha_cpu_pmdomain_priv *priv; ++ struct device *dev = &pdev->dev; ++ struct clk_init_data init = { }; ++ struct generic_pm_domain *pd; ++ struct clk_hw *hw; ++ int ret; ++ ++ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; ++ ++ /* Init and register a get-only clk for Cpufreq */ ++ init.name = "cpu"; ++ init.ops = &airoha_cpu_pmdomain_clk_ops; ++ /* Clock with no set_rate, can't cache */ ++ init.flags = CLK_GET_RATE_NOCACHE; ++ ++ hw = &priv->hw; ++ hw->init = &init; ++ ret = devm_clk_hw_register(dev, hw); ++ if (ret) ++ return ret; ++ ++ ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, hw); ++ if (ret) ++ return ret; ++ ++ /* Init and register a PD for CPU */ ++ pd = &priv->pd; ++ pd->name = "cpu_pd"; ++ pd->flags = GENPD_FLAG_ALWAYS_ON; ++ pd->set_performance_state = airoha_cpu_pmdomain_set_performance_state; ++ ++ ret = pm_genpd_init(pd, NULL, false); ++ if (ret) ++ return ret; ++ ++ ret = of_genpd_add_provider_simple(dev->of_node, pd); ++ if (ret) ++ goto err_add_provider; ++ ++ platform_set_drvdata(pdev, priv); ++ ++ return 0; ++ ++err_add_provider: ++ pm_genpd_remove(pd); ++ ++ return ret; ++} ++ ++static void airoha_cpu_pmdomain_remove(struct platform_device *pdev) ++{ ++ struct airoha_cpu_pmdomain_priv *priv = platform_get_drvdata(pdev); ++ ++ of_genpd_del_provider(pdev->dev.of_node); ++ pm_genpd_remove(&priv->pd); ++} ++ ++static const struct of_device_id airoha_cpu_pmdomain_of_match[] = { ++ { .compatible = "airoha,en7581-cpufreq" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, airoha_cpu_pmdomain_of_match); ++ ++static struct platform_driver airoha_cpu_pmdomain_driver = { ++ .probe = airoha_cpu_pmdomain_probe, ++ .remove_new = airoha_cpu_pmdomain_remove, ++ .driver = { ++ .name = "airoha-cpu-pmdomain", ++ .of_match_table = airoha_cpu_pmdomain_of_match, ++ }, ++}; ++module_platform_driver(airoha_cpu_pmdomain_driver); ++ ++MODULE_AUTHOR("Christian Marangi "); ++MODULE_DESCRIPTION("CPU PM domain driver for Airoha SoCs"); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/airoha/patches-6.6/100-02-cpufreq-airoha-Add-EN7581-CPUFreq-SMCCC-driver.patch b/target/linux/airoha/patches-6.6/100-02-cpufreq-airoha-Add-EN7581-CPUFreq-SMCCC-driver.patch new file mode 100644 index 00000000000000..6a2e54f4d1abc7 --- /dev/null +++ b/target/linux/airoha/patches-6.6/100-02-cpufreq-airoha-Add-EN7581-CPUFreq-SMCCC-driver.patch @@ -0,0 +1,253 @@ +From fa27cb99b297a1a9c0a5824afe5a670e424fff61 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Wed, 16 Oct 2024 18:00:57 +0200 +Subject: [PATCH v9 2/2] cpufreq: airoha: Add EN7581 CPUFreq SMCCC driver + +Add simple CPU Freq driver for Airoha EN7581 SoC that control CPU +frequency scaling with SMC APIs and register a generic "cpufreq-dt" +device. + +All CPU share the same frequency and can't be controlled independently. +CPU frequency is controlled by the attached PM domain. + +Add SoC compatible to cpufreq-dt-plat block list as a dedicated cpufreq +driver is needed with OPP v2 nodes declared in DTS. + +Signed-off-by: Christian Marangi +--- +Changes v9: +- Fix compile error targetting wrong branch (remove_new change and new PM OPs) +Changes v8: +- Split in dedicated PM domain driver +Changes v7: +- No changes +Changes v6: +- Improve Kconfig depends logic +- Select PM (PM_GENERIC_DOMAINS depends on it) +- Drop (int) cast for +Changes v5: +- Rename cpu_pd to perf for power domain name +- Use remove instead of remove_new +Changes v4: +- Rework to clk-only + PM set_performance_state implementation +Changes v3: +- Adapt to new cpufreq-dt APIs +- Register cpufreq-dt instead of custom freq driver +Changes v2: +- Fix kernel bot error with missing slab.h and bitfield.h header +- Limit COMPILE_TEST to ARM64 due to smcc 1.2 + + drivers/cpufreq/Kconfig.arm | 8 ++ + drivers/cpufreq/Makefile | 1 + + drivers/cpufreq/airoha-cpufreq.c | 152 +++++++++++++++++++++++++++ + drivers/cpufreq/cpufreq-dt-platdev.c | 2 + + 4 files changed, 163 insertions(+) + create mode 100644 drivers/cpufreq/airoha-cpufreq.c + +--- a/drivers/cpufreq/Kconfig.arm ++++ b/drivers/cpufreq/Kconfig.arm +@@ -41,6 +41,14 @@ config ARM_ALLWINNER_SUN50I_CPUFREQ_NVME + To compile this driver as a module, choose M here: the + module will be called sun50i-cpufreq-nvmem. + ++config ARM_AIROHA_SOC_CPUFREQ ++ tristate "Airoha EN7581 SoC CPUFreq support" ++ depends on ARCH_AIROHA || COMPILE_TEST ++ select PM_OPP ++ default ARCH_AIROHA ++ help ++ This adds the CPUFreq driver for Airoha EN7581 SoCs. ++ + config ARM_APPLE_SOC_CPUFREQ + tristate "Apple Silicon SoC CPUFreq support" + depends on ARCH_APPLE || (COMPILE_TEST && 64BIT) +--- a/drivers/cpufreq/Makefile ++++ b/drivers/cpufreq/Makefile +@@ -52,6 +52,7 @@ obj-$(CONFIG_X86_AMD_FREQ_SENSITIVITY) + + + ################################################################################## + # ARM SoC drivers ++obj-$(CONFIG_ARM_AIROHA_SOC_CPUFREQ) += airoha-cpufreq.o + obj-$(CONFIG_ARM_APPLE_SOC_CPUFREQ) += apple-soc-cpufreq.o + obj-$(CONFIG_ARM_ARMADA_37XX_CPUFREQ) += armada-37xx-cpufreq.o + obj-$(CONFIG_ARM_ARMADA_8K_CPUFREQ) += armada-8k-cpufreq.o +--- /dev/null ++++ b/drivers/cpufreq/airoha-cpufreq.c +@@ -0,0 +1,166 @@ ++// SPDX-License-Identifier: GPL-2.0 ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "cpufreq-dt.h" ++ ++struct airoha_cpufreq_priv { ++ int opp_token; ++ struct device **virt_devs; ++ struct platform_device *cpufreq_dt; ++}; ++ ++static struct platform_device *cpufreq_pdev; ++ ++/* NOP function to disable OPP from setting clock */ ++static int airoha_cpufreq_config_clks_nop(struct device *dev, ++ struct opp_table *opp_table, ++ struct dev_pm_opp *old_opp, ++ struct dev_pm_opp *opp, ++ void *data, bool scaling_down) ++{ ++ return 0; ++} ++ ++static const char * const airoha_cpufreq_clk_names[] = { "cpu", NULL }; ++static const char * const airoha_cpufreq_genpd_names[] = { "cpu_pd", NULL }; ++ ++static int airoha_cpufreq_probe(struct platform_device *pdev) ++{ ++ struct dev_pm_opp_config config = { }; ++ struct platform_device *cpufreq_dt; ++ struct airoha_cpufreq_priv *priv; ++ struct device *dev = &pdev->dev; ++ struct device **virt_devs = NULL; ++ struct device *cpu_dev; ++ int ret; ++ ++ /* CPUs refer to the same OPP table */ ++ cpu_dev = get_cpu_device(0); ++ if (!cpu_dev) ++ return -ENODEV; ++ ++ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; ++ ++ config.clk_names = airoha_cpufreq_clk_names; ++ config.config_clks = airoha_cpufreq_config_clks_nop; ++ config.genpd_names = airoha_cpufreq_genpd_names; ++ config.virt_devs = &virt_devs; ++ ++ priv->opp_token = dev_pm_opp_set_config(cpu_dev, &config); ++ if (priv->opp_token < 0) ++ return dev_err_probe(dev, priv->opp_token, "Failed to set OPP config\n"); ++ ++ /* Set Attached PM for OPP ACTIVE */ ++ if (virt_devs) { ++ const char * const *name = airoha_cpufreq_genpd_names; ++ int i, j; ++ ++ for (i = 0; *name; i++, name++) { ++ ret = pm_runtime_resume_and_get(virt_devs[i]); ++ if (ret) { ++ dev_err(cpu_dev, "failed to resume %s: %d\n", ++ *name, ret); ++ ++ /* Rollback previous PM runtime calls */ ++ name = config.genpd_names; ++ for (j = 0; *name && j < i; j++, name++) ++ pm_runtime_put(virt_devs[j]); ++ ++ goto err_register_cpufreq; ++ } ++ } ++ priv->virt_devs = virt_devs; ++ } ++ ++ cpufreq_dt = platform_device_register_simple("cpufreq-dt", -1, NULL, 0); ++ ret = PTR_ERR_OR_ZERO(cpufreq_dt); ++ if (ret) { ++ dev_err(dev, "failed to create cpufreq-dt device: %d\n", ret); ++ goto err_register_cpufreq; ++ } ++ ++ priv->cpufreq_dt = cpufreq_dt; ++ platform_set_drvdata(pdev, priv); ++ ++ return 0; ++ ++err_register_cpufreq: ++ dev_pm_opp_clear_config(priv->opp_token); ++ ++ return ret; ++} ++ ++static void airoha_cpufreq_remove(struct platform_device *pdev) ++{ ++ struct airoha_cpufreq_priv *priv = platform_get_drvdata(pdev); ++ const char * const *name = airoha_cpufreq_genpd_names; ++ int i; ++ ++ platform_device_unregister(priv->cpufreq_dt); ++ ++ dev_pm_opp_clear_config(priv->opp_token); ++ ++ for (i = 0; *name; i++, name++) ++ pm_runtime_put(priv->virt_devs[i]); ++} ++ ++static struct platform_driver airoha_cpufreq_driver = { ++ .probe = airoha_cpufreq_probe, ++ .remove_new = airoha_cpufreq_remove, ++ .driver = { ++ .name = "airoha-cpufreq", ++ }, ++}; ++ ++static const struct of_device_id airoha_cpufreq_match_list[] __initconst = { ++ { .compatible = "airoha,en7581" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, airoha_cpufreq_match_list); ++ ++static int __init airoha_cpufreq_init(void) ++{ ++ struct device_node *np = of_find_node_by_path("/"); ++ const struct of_device_id *match; ++ int ret; ++ ++ if (!np) ++ return -ENODEV; ++ ++ match = of_match_node(airoha_cpufreq_match_list, np); ++ of_node_put(np); ++ if (!match) ++ return -ENODEV; ++ ++ ret = platform_driver_register(&airoha_cpufreq_driver); ++ if (unlikely(ret < 0)) ++ return ret; ++ ++ cpufreq_pdev = platform_device_register_data(NULL, "airoha-cpufreq", ++ -1, match, sizeof(*match)); ++ ret = PTR_ERR_OR_ZERO(cpufreq_pdev); ++ if (ret) ++ platform_driver_unregister(&airoha_cpufreq_driver); ++ ++ return ret; ++} ++module_init(airoha_cpufreq_init); ++ ++static void __exit airoha_cpufreq_exit(void) ++{ ++ platform_device_unregister(cpufreq_pdev); ++ platform_driver_unregister(&airoha_cpufreq_driver); ++} ++module_exit(airoha_cpufreq_exit); ++ ++MODULE_AUTHOR("Christian Marangi "); ++MODULE_DESCRIPTION("CPUfreq driver for Airoha SoCs"); ++MODULE_LICENSE("GPL"); +--- a/drivers/cpufreq/cpufreq-dt-platdev.c ++++ b/drivers/cpufreq/cpufreq-dt-platdev.c +@@ -103,6 +103,8 @@ static const struct of_device_id allowli + * platforms using "operating-points-v2" property. + */ + static const struct of_device_id blocklist[] __initconst = { ++ { .compatible = "airoha,en7581", }, ++ + { .compatible = "allwinner,sun50i-h6", }, + + { .compatible = "apple,arm-platform", }, diff --git a/target/linux/airoha/patches-6.6/100-cpufreq-airoha-Add-EN7581-Cpufreq-SMC-driver.patch b/target/linux/airoha/patches-6.6/100-cpufreq-airoha-Add-EN7581-Cpufreq-SMC-driver.patch deleted file mode 100644 index 0276a4ee8114cb..00000000000000 --- a/target/linux/airoha/patches-6.6/100-cpufreq-airoha-Add-EN7581-Cpufreq-SMC-driver.patch +++ /dev/null @@ -1,247 +0,0 @@ -From 5296da64f77ef6c809b715cdecf308977a08acb9 Mon Sep 17 00:00:00 2001 -From: Christian Marangi -Date: Wed, 16 Oct 2024 18:00:57 +0200 -Subject: [PATCH] cpufreq: airoha: Add EN7581 Cpufreq SMC driver - -Add simple Cpufreq driver for Airoha EN7581 SoC that control CPU -frequency scaling with SMC APIs. - -All CPU share the same frequency and can't be controlled independently. -Current shared CPU frequency is returned by the related SMC command. - -Add SoC compatible to cpufreq-dt-plat block list as a dedicated cpufreq -driver is needed with OPP v2 nodes declared in DTS. - -Signed-off-by: Christian Marangi ---- - drivers/cpufreq/Kconfig.arm | 8 ++ - drivers/cpufreq/Makefile | 1 + - drivers/cpufreq/airoha-cpufreq.c | 183 +++++++++++++++++++++++++++ - drivers/cpufreq/cpufreq-dt-platdev.c | 2 + - 4 files changed, 194 insertions(+) - create mode 100644 drivers/cpufreq/airoha-cpufreq.c - ---- a/drivers/cpufreq/Kconfig.arm -+++ b/drivers/cpufreq/Kconfig.arm -@@ -41,6 +41,14 @@ config ARM_ALLWINNER_SUN50I_CPUFREQ_NVME - To compile this driver as a module, choose M here: the - module will be called sun50i-cpufreq-nvmem. - -+config ARM_AIROHA_SOC_CPUFREQ -+ tristate "Airoha EN7581 SoC CPUFreq support" -+ depends on ARCH_AIROHA || COMPILE_TEST -+ select PM_OPP -+ default ARCH_AIROHA -+ help -+ This adds the CPUFreq driver for Airoha EN7581 SoCs. -+ - config ARM_APPLE_SOC_CPUFREQ - tristate "Apple Silicon SoC CPUFreq support" - depends on ARCH_APPLE || (COMPILE_TEST && 64BIT) ---- a/drivers/cpufreq/Makefile -+++ b/drivers/cpufreq/Makefile -@@ -52,6 +52,7 @@ obj-$(CONFIG_X86_AMD_FREQ_SENSITIVITY) + - - ################################################################################## - # ARM SoC drivers -+obj-$(CONFIG_ARM_AIROHA_SOC_CPUFREQ) += airoha-cpufreq.o - obj-$(CONFIG_ARM_APPLE_SOC_CPUFREQ) += apple-soc-cpufreq.o - obj-$(CONFIG_ARM_ARMADA_37XX_CPUFREQ) += armada-37xx-cpufreq.o - obj-$(CONFIG_ARM_ARMADA_8K_CPUFREQ) += armada-8k-cpufreq.o ---- /dev/null -+++ b/drivers/cpufreq/airoha-cpufreq.c -@@ -0,0 +1,183 @@ -+// SPDX-License-Identifier: GPL-2.0 -+ -+#include -+#include -+#include -+ -+#define AIROHA_SIP_AVS_HANDLE 0x82000301 -+#define AIROHA_AVS_OP_BASE 0xddddddd0 -+#define AIROHA_AVS_OP_MASK GENMASK(1, 0) -+#define AIROHA_AVS_OP_FREQ_DYN_ADJ (AIROHA_AVS_OP_BASE | \ -+ FIELD_PREP(AIROHA_AVS_OP_MASK, 0x1)) -+#define AIROHA_AVS_OP_GET_FREQ (AIROHA_AVS_OP_BASE | \ -+ FIELD_PREP(AIROHA_AVS_OP_MASK, 0x2)) -+ -+struct airoha_cpufreq_priv { -+ struct list_head list; -+ -+ cpumask_var_t cpus; -+ struct device *cpu_dev; -+ struct cpufreq_frequency_table *freq_table; -+}; -+ -+static LIST_HEAD(priv_list); -+ -+static unsigned int airoha_cpufreq_get(unsigned int cpu) -+{ -+ const struct arm_smccc_1_2_regs args = { -+ .a0 = AIROHA_SIP_AVS_HANDLE, -+ .a1 = AIROHA_AVS_OP_GET_FREQ, -+ }; -+ struct arm_smccc_1_2_regs res; -+ -+ arm_smccc_1_2_smc(&args, &res); -+ -+ return (int)(res.a0 * 1000); -+} -+ -+static int airoha_cpufreq_set_target(struct cpufreq_policy *policy, unsigned int index) -+{ -+ const struct arm_smccc_1_2_regs args = { -+ .a0 = AIROHA_SIP_AVS_HANDLE, -+ .a1 = AIROHA_AVS_OP_FREQ_DYN_ADJ, -+ .a3 = index, -+ }; -+ struct arm_smccc_1_2_regs res; -+ -+ arm_smccc_1_2_smc(&args, &res); -+ -+ /* SMC signal correct apply by unsetting BIT 0 */ -+ return res.a0 & BIT(0) ? -EINVAL : 0; -+} -+ -+static struct airoha_cpufreq_priv *airoha_cpufreq_find_data(int cpu) -+{ -+ struct airoha_cpufreq_priv *priv; -+ -+ list_for_each_entry(priv, &priv_list, list) { -+ if (cpumask_test_cpu(cpu, priv->cpus)) -+ return priv; -+ } -+ -+ return NULL; -+} -+ -+static int airoha_cpufreq_init(struct cpufreq_policy *policy) -+{ -+ struct airoha_cpufreq_priv *priv; -+ struct device *cpu_dev; -+ -+ priv = airoha_cpufreq_find_data(policy->cpu); -+ if (!priv) -+ return -ENODEV; -+ -+ cpu_dev = priv->cpu_dev; -+ cpumask_copy(policy->cpus, priv->cpus); -+ policy->driver_data = priv; -+ policy->freq_table = priv->freq_table; -+ -+ return 0; -+} -+ -+static struct cpufreq_driver airoha_cpufreq_driver = { -+ .flags = CPUFREQ_NEED_INITIAL_FREQ_CHECK | -+ CPUFREQ_IS_COOLING_DEV, -+ .verify = cpufreq_generic_frequency_table_verify, -+ .target_index = airoha_cpufreq_set_target, -+ .get = airoha_cpufreq_get, -+ .init = airoha_cpufreq_init, -+ .attr = cpufreq_generic_attr, -+ .name = "airoha-cpufreq", -+}; -+ -+static int airoha_cpufreq_driver_init_cpu(int cpu) -+{ -+ struct airoha_cpufreq_priv *priv; -+ struct device *cpu_dev; -+ int ret; -+ -+ cpu_dev = get_cpu_device(cpu); -+ if (!cpu_dev) -+ return -EPROBE_DEFER; -+ -+ priv = kzalloc(sizeof(*priv), GFP_KERNEL); -+ if (!priv) -+ return -ENOMEM; -+ -+ if (!zalloc_cpumask_var(&priv->cpus, GFP_KERNEL)) -+ return -ENOMEM; -+ -+ cpumask_set_cpu(cpu, priv->cpus); -+ priv->cpu_dev = cpu_dev; -+ -+ ret = dev_pm_opp_of_get_sharing_cpus(cpu_dev, priv->cpus); -+ if (ret) -+ goto err; -+ -+ ret = dev_pm_opp_of_cpumask_add_table(priv->cpus); -+ if (ret) -+ goto err; -+ -+ ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &priv->freq_table); -+ if (ret) -+ goto err; -+ -+ list_add(&priv->list, &priv_list); -+ -+ return 0; -+ -+err: -+ dev_pm_opp_of_cpumask_remove_table(priv->cpus); -+ free_cpumask_var(priv->cpus); -+ -+ return ret; -+} -+ -+static void airoha_cpufreq_release(void) -+{ -+ struct airoha_cpufreq_priv *priv, *tmp; -+ -+ list_for_each_entry_safe(priv, tmp, &priv_list, list) { -+ dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &priv->freq_table); -+ dev_pm_opp_of_cpumask_remove_table(priv->cpus); -+ free_cpumask_var(priv->cpus); -+ list_del(&priv->list); -+ kfree(priv); -+ } -+} -+ -+static int __init airoha_cpufreq_driver_probe(void) -+{ -+ int cpu, ret; -+ -+ if (!of_machine_is_compatible("airoha,en7581")) -+ return -ENODEV; -+ -+ for_each_possible_cpu(cpu) { -+ ret = airoha_cpufreq_driver_init_cpu(cpu); -+ if (ret) -+ goto err; -+ } -+ -+ ret = cpufreq_register_driver(&airoha_cpufreq_driver); -+ if (ret) -+ goto err; -+ -+ return 0; -+ -+err: -+ airoha_cpufreq_release(); -+ return ret; -+} -+module_init(airoha_cpufreq_driver_probe); -+ -+static void __exit airoha_cpufreq_driver_remove(void) -+{ -+ cpufreq_unregister_driver(&airoha_cpufreq_driver); -+ airoha_cpufreq_release(); -+} -+module_exit(airoha_cpufreq_driver_remove); -+ -+MODULE_AUTHOR("Christian Marangi "); -+MODULE_DESCRIPTION("CPUfreq driver for Airoha SoCs"); -+MODULE_LICENSE("GPL"); ---- a/drivers/cpufreq/cpufreq-dt-platdev.c -+++ b/drivers/cpufreq/cpufreq-dt-platdev.c -@@ -103,6 +103,8 @@ static const struct of_device_id allowli - * platforms using "operating-points-v2" property. - */ - static const struct of_device_id blocklist[] __initconst = { -+ { .compatible = "airoha,en7581", }, -+ - { .compatible = "allwinner,sun50i-h6", }, - - { .compatible = "apple,arm-platform", }, From e620694876d4ced3214522d9d959362d07cea9a8 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 10 Jan 2025 14:53:49 +0100 Subject: [PATCH 341/877] airoha: an7581: refresh DTS with changes for cpufreq, MTD and MMC Refresh DTS with required changes for cpufreq, MTD and MMC. While at it also fix wrong speed for MAC. Signed-off-by: Christian Marangi (cherry picked from commit 17b0d1379a3cd4a2e2dbefa7d0f9bc281269f97e) --- target/linux/airoha/dts/an7581-evb.dts | 31 ++++--- target/linux/airoha/dts/an7581.dtsi | 118 +++++++++++++++++++++++-- 2 files changed, 127 insertions(+), 22 deletions(-) diff --git a/target/linux/airoha/dts/an7581-evb.dts b/target/linux/airoha/dts/an7581-evb.dts index 3cf531a29c4401..9e88bc8a77b3ea 100644 --- a/target/linux/airoha/dts/an7581-evb.dts +++ b/target/linux/airoha/dts/an7581-evb.dts @@ -150,35 +150,40 @@ &spi_nand { partitions { - compatible = "airoha,fixed-partitions"; + compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; bootloader@0 { label = "bootloader"; reg = <0x00000000 0x00080000>; + read-only; }; - tclinux@80000 { + art@200000 { + label = "art"; + reg = <0x00200000 0x00400000>; + }; + + tclinux@600000 { label = "tclinux"; - compatible = "denx,fit"; - reg = <0x00080000 0x02800000>; + reg = <0x00600000 0x03200000>; }; - tclinux_slave@2880000 { - label = "tclinux_slave"; - reg = <0x02880000 0x02800000>; + tclinux_slave@3800000 { + label = "tclinux_alt"; + reg = <0x03800000 0x03200000>; }; - rootfs_data@5080000 { + rootfs_data@6a00000 { label = "rootfs_data"; - reg = <0x5080000 0x00800000>; + reg = <0x06a00000 0x01400000>; }; - art@ffffffff { - compatible = "airoha,dynamic-art"; - label = "art"; - reg = <0xffffffff 0x00300000>; + reserved_bmt@7e00000 { + label = "reserved_bmt"; + reg = <0x07e00000 0x00200000>; + read-only; }; }; }; diff --git a/target/linux/airoha/dts/an7581.dtsi b/target/linux/airoha/dts/an7581.dtsi index 8abd736875c585..820ab0bfa8fb41 100644 --- a/target/linux/airoha/dts/an7581.dtsi +++ b/target/linux/airoha/dts/an7581.dtsi @@ -78,7 +78,10 @@ reg = <0x0>; operating-points-v2 = <&cpu_opp_table>; enable-method = "psci"; - clock-frequency = <80000000>; + clocks = <&cpufreq>; + clock-names = "cpu"; + power-domains = <&cpufreq>; + power-domain-names = "cpu_pd"; next-level-cache = <&l2>; #cooling-cells = <2>; }; @@ -89,7 +92,10 @@ reg = <0x1>; operating-points-v2 = <&cpu_opp_table>; enable-method = "psci"; - clock-frequency = <80000000>; + clocks = <&cpufreq>; + clock-names = "cpu"; + power-domains = <&cpufreq>; + power-domain-names = "cpu_pd"; next-level-cache = <&l2>; #cooling-cells = <2>; }; @@ -100,7 +106,10 @@ reg = <0x2>; operating-points-v2 = <&cpu_opp_table>; enable-method = "psci"; - clock-frequency = <80000000>; + clocks = <&cpufreq>; + clock-names = "cpu"; + power-domains = <&cpufreq>; + power-domain-names = "cpu_pd"; next-level-cache = <&l2>; #cooling-cells = <2>; }; @@ -111,7 +120,10 @@ reg = <0x3>; operating-points-v2 = <&cpu_opp_table>; enable-method = "psci"; - clock-frequency = <80000000>; + clocks = <&cpufreq>; + clock-names = "cpu"; + power-domains = <&cpufreq>; + power-domain-names = "cpu_pd"; next-level-cache = <&l2>; #cooling-cells = <2>; }; @@ -125,68 +137,156 @@ }; }; + cpufreq: cpufreq { + compatible = "airoha,en7581-cpufreq"; + + operating-points-v2 = <&cpu_smcc_opp_table>; + + #power-domain-cells = <0>; + #clock-cells = <0>; + }; + cpu_opp_table: opp-table { compatible = "operating-points-v2"; opp-shared; opp-500000000 { opp-hz = /bits/ 64 <500000000>; + required-opps = <&smcc_opp0>; }; opp-550000000 { opp-hz = /bits/ 64 <550000000>; + required-opps = <&smcc_opp1>; }; opp-600000000 { opp-hz = /bits/ 64 <600000000>; + required-opps = <&smcc_opp2>; }; opp-650000000 { opp-hz = /bits/ 64 <650000000>; + required-opps = <&smcc_opp3>; }; opp-7000000000 { opp-hz = /bits/ 64 <700000000>; + required-opps = <&smcc_opp4>; }; opp-7500000000 { opp-hz = /bits/ 64 <750000000>; + required-opps = <&smcc_opp5>; }; opp-8000000000 { opp-hz = /bits/ 64 <800000000>; + required-opps = <&smcc_opp6>; }; opp-8500000000 { opp-hz = /bits/ 64 <850000000>; + required-opps = <&smcc_opp7>; }; opp-9000000000 { opp-hz = /bits/ 64 <900000000>; + required-opps = <&smcc_opp8>; }; opp-9500000000 { opp-hz = /bits/ 64 <950000000>; + required-opps = <&smcc_opp9>; }; opp-10000000000 { opp-hz = /bits/ 64 <1000000000>; + required-opps = <&smcc_opp10>; }; opp-10500000000 { opp-hz = /bits/ 64 <1050000000>; + required-opps = <&smcc_opp11>; }; opp-11000000000 { opp-hz = /bits/ 64 <1100000000>; + required-opps = <&smcc_opp12>; }; opp-11500000000 { opp-hz = /bits/ 64 <1150000000>; + required-opps = <&smcc_opp13>; }; opp-12000000000 { opp-hz = /bits/ 64 <1200000000>; + required-opps = <&smcc_opp14>; + }; + }; + + cpu_smcc_opp_table: opp-table-cpu-smcc { + compatible = "operating-points-v2"; + + smcc_opp0: opp0 { + opp-level = <0>; + }; + + smcc_opp1: opp1 { + opp-level = <1>; + }; + + smcc_opp2: opp2 { + opp-level = <2>; + }; + + smcc_opp3: opp3 { + opp-level = <3>; + }; + + smcc_opp4: opp4 { + opp-level = <4>; + }; + + smcc_opp5: opp5 { + opp-level = <5>; + }; + + smcc_opp6: opp6 { + opp-level = <6>; + }; + + smcc_opp7: opp7 { + opp-level = <7>; + }; + + smcc_opp8: opp8 { + opp-level = <8>; + }; + + smcc_opp9: opp9 { + opp-level = <9>; + }; + + smcc_opp10: opp10 { + opp-level = <10>; + }; + + smcc_opp11: opp11 { + opp-level = <11>; + }; + + smcc_opp12: opp12 { + opp-level = <12>; + }; + + smcc_opp13: opp13 { + opp-level = <13>; + }; + + smcc_opp14: opp14 { + opp-level = <14>; }; }; @@ -431,16 +531,16 @@ spi-max-frequency = <50000000>; spi-tx-bus-width = <1>; spi-rx-bus-width = <2>; - airoha,bmt; }; }; mmc0: mmc@1fa0e000 { - compatible = "mediatek,mt7622-mmc"; + compatible = "airoha,an7581-mmc"; reg = <0x0 0x1fa0e000 0x0 0x1000>, <0x0 0x1fa0c000 0x0 0x60>; interrupts = ; - bus-width = <4>; + clocks = <&scuclk EN7581_CLK_EMMC>; + clock-names = "source"; bus-width = <4>; max-frequency = <52000000>; disable-wp; cap-mmc-highspeed; @@ -587,7 +687,7 @@ status = "disabled"; fixed-link { - speed = <1000>; + speed = <10000>; full-duplex; pause; }; @@ -648,7 +748,7 @@ phy-mode = "internal"; fixed-link { - speed = <1000>; + speed = <10000>; full-duplex; pause; }; From e9d80cdb6c8d6e56d11e6946e90d9f1dfe364672 Mon Sep 17 00:00:00 2001 From: Kien Truong Date: Sat, 11 Jan 2025 12:20:12 +0700 Subject: [PATCH 342/877] rockchip: disable kernel preemption This setting is more suitable for device running OpenWRT. Most OpenWRT targets are already default to this configuration, and it has shown better performance in VPN (wireguard). Fix: #17454 Signed-off-by: Kien Truong Link: https://github.com/openwrt/openwrt/pull/17575 Signed-off-by: Robert Marko (cherry picked from commit 1c178f364454c5b73eb453fa0b101ae2f6454d4c) --- target/linux/rockchip/armv8/config-6.6 | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/target/linux/rockchip/armv8/config-6.6 b/target/linux/rockchip/armv8/config-6.6 index 56fb2f96a14c02..68eed3e5f9b332 100644 --- a/target/linux/rockchip/armv8/config-6.6 +++ b/target/linux/rockchip/armv8/config-6.6 @@ -530,12 +530,7 @@ CONFIG_POWER_RESET=y CONFIG_POWER_SUPPLY=y CONFIG_POWER_SUPPLY_HWMON=y CONFIG_PPS=y -CONFIG_PREEMPT=y -CONFIG_PREEMPTION=y -CONFIG_PREEMPT_BUILD=y -CONFIG_PREEMPT_COUNT=y -# CONFIG_PREEMPT_NONE is not set -CONFIG_PREEMPT_RCU=y +CONFIG_PREEMPT_NONE_BUILD=y CONFIG_PRINTK_TIME=y CONFIG_PROC_PAGE_MONITOR=y CONFIG_PROC_VMCORE=y From 220860ef4c06b310baa427c8889f0a0fb33e4cbe Mon Sep 17 00:00:00 2001 From: John Audia Date: Thu, 9 Jan 2025 08:54:54 -0500 Subject: [PATCH 343/877] kernel: bump 6.6 to 6.6.70 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.70 Removed upstreamed: generic/backport-6.6/902-net-llc-reset-skb-transport_header.patch[1] generic/pending-6.6/605-netfilter-nft_set_hash-unaligned-atomic-read-on-stru.patch[2] All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.70&id=0c896816aa193e6459fc947747e5753c06b395b9 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.70&id=4f49349c1963e507aa37c1ec05178faeb0103959 Build system: x86/64 Build-tested: bcm27xx/bcm2712, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Run-tested: bcm27xx/bcm2712, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/17545 Signed-off-by: Robert Marko (cherry picked from commit efafd7d47f8fa26a9f99283605c9324a833ef852) --- include/kernel-6.6 | 4 +- ...mt7621-Add-Airoha-EN7581-i2c-support.patch | 2 +- ...tend-guard-with-spinlock_bh-variants.patch | 12 +-- ...ci-add-quirk-for-host-controllers-th.patch | 4 +- ...all-the-downstream-rpi-sound-card-dr.patch | 2 +- ...hci_fixup_endpoint-for-interval-adju.patch | 4 +- ...und-for-bogus-SET_DEQ_PENDING-endpoi.patch | 2 +- ...d-add-the-endpoint-context-in-xhci_f.patch | 2 +- ...ore-event-ring-segment-table-entries.patch | 2 +- ...-quirks-add-link-TRB-quirk-for-VL805.patch | 4 +- ...b-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch | 2 +- ...5-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch | 8 +- ...wc3-Set-DMA-and-coherent-masks-early.patch | 4 +- ...-add-FS-LS-bus-instance-parkmode-dis.patch | 4 +- ...n-Maintain-TLB-coherency-in-LRU-code.patch | 2 +- ...d-support-for-setting-NAK-enhancemen.patch | 4 +- ...-prevent-a-theoretical-race-on-non-c.patch | 2 +- ...support-for-performing-fake-doorbell.patch | 6 +- ...tional-threaded-NAPI-wakeup-based-on.patch | 6 +- ...-to-use-SMP-threads-for-backlog-NAPI.patch | 22 ++--- ...klog-NAPI-to-clean-up-the-defer_list.patch | 2 +- ...-net-Rename-rps_lock-to-backlog_lock.patch | 18 ++-- ...-net-Make-USO-depend-on-CSUM-offload.patch | 6 +- ...64-if-device-if-driver-is-configured.patch | 2 +- ...-create-a-dummy-net_device-allocator.patch | 6 +- ...t-introduce-napi_is_scheduled-helper.patch | 2 +- ...et-free_netdev-exit-earlier-if-dummy.patch | 2 +- ...2-net-llc-reset-skb-transport_header.patch | 52 ----------- .../hack-6.6/901-debloat_sock_diag.patch | 2 +- .../generic/hack-6.6/902-debloat_proc.patch | 2 +- ...t_hash-unaligned-atomic-read-on-stru.patch | 87 ------------------- .../pending-6.6/630-packet_socket_type.patch | 16 ++-- ..._F_GSO_FRAGLIST-from-NETIF_F_GSO_SOF.patch | 2 +- ...PS-lantiq-add-FALC-ON-i2c-bus-master.patch | 2 +- .../810-uvc-add-iPassion-iP2970-support.patch | 2 +- .../825-i2c-MIPS-adds-ralink-I2C-driver.patch | 2 +- .../310-add-i2c-rtl9300-support.patch | 2 +- ...c3-add-optional-PHY-interface-clocks.patch | 4 +- ...ove-performance-usb-using-lowmem-for.patch | 16 ++-- 39 files changed, 93 insertions(+), 232 deletions(-) delete mode 100644 target/linux/generic/backport-6.6/902-net-llc-reset-skb-transport_header.patch delete mode 100644 target/linux/generic/pending-6.6/605-netfilter-nft_set_hash-unaligned-atomic-read-on-stru.patch diff --git a/include/kernel-6.6 b/include/kernel-6.6 index 6cee9d1e8cb034..1cda04d0c587ef 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .69 -LINUX_KERNEL_HASH-6.6.69 = 9c6305567b75d99514cde6eb9de39973f3d5c857a75bd9dcdfca57041f8d4f34 +LINUX_VERSION-6.6 = .70 +LINUX_KERNEL_HASH-6.6.70 = 84d23ee07fb26febbcb6d1295ba15efdc67ac382b4137b2c8853146c10fd2f97 diff --git a/target/linux/airoha/patches-6.6/002-v6.11-i2c-mt7621-Add-Airoha-EN7581-i2c-support.patch b/target/linux/airoha/patches-6.6/002-v6.11-i2c-mt7621-Add-Airoha-EN7581-i2c-support.patch index 25eb475e214187..46c376e343d1b7 100644 --- a/target/linux/airoha/patches-6.6/002-v6.11-i2c-mt7621-Add-Airoha-EN7581-i2c-support.patch +++ b/target/linux/airoha/patches-6.6/002-v6.11-i2c-mt7621-Add-Airoha-EN7581-i2c-support.patch @@ -16,7 +16,7 @@ Signed-off-by: Andi Shyti --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig -@@ -839,7 +839,7 @@ config I2C_MT65XX +@@ -841,7 +841,7 @@ config I2C_MT65XX config I2C_MT7621 tristate "MT7621/MT7628 I2C Controller" diff --git a/target/linux/airoha/patches-6.6/200-spinlock-extend-guard-with-spinlock_bh-variants.patch b/target/linux/airoha/patches-6.6/200-spinlock-extend-guard-with-spinlock_bh-variants.patch index e613b69f81f304..d4905d5fff6fa1 100644 --- a/target/linux/airoha/patches-6.6/200-spinlock-extend-guard-with-spinlock_bh-variants.patch +++ b/target/linux/airoha/patches-6.6/200-spinlock-extend-guard-with-spinlock_bh-variants.patch @@ -12,9 +12,9 @@ Signed-off-by: Christian Marangi --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h -@@ -515,6 +515,10 @@ DEFINE_LOCK_GUARD_1(raw_spinlock_irq, ra - raw_spin_lock_irq(_T->lock), - raw_spin_unlock_irq(_T->lock)) +@@ -519,6 +519,10 @@ DEFINE_LOCK_GUARD_1(raw_spinlock_irq, ra + + DEFINE_LOCK_GUARD_1_COND(raw_spinlock_irq, _try, raw_spin_trylock_irq(_T->lock)) +DEFINE_LOCK_GUARD_1(raw_spinlock_bh, raw_spinlock_t, + raw_spin_lock_bh(_T->lock), @@ -23,9 +23,9 @@ Signed-off-by: Christian Marangi DEFINE_LOCK_GUARD_1(raw_spinlock_irqsave, raw_spinlock_t, raw_spin_lock_irqsave(_T->lock, _T->flags), raw_spin_unlock_irqrestore(_T->lock, _T->flags), -@@ -528,6 +532,10 @@ DEFINE_LOCK_GUARD_1(spinlock_irq, spinlo - spin_lock_irq(_T->lock), - spin_unlock_irq(_T->lock)) +@@ -540,6 +544,10 @@ DEFINE_LOCK_GUARD_1(spinlock_irq, spinlo + DEFINE_LOCK_GUARD_1_COND(spinlock_irq, _try, + spin_trylock_irq(_T->lock)) +DEFINE_LOCK_GUARD_1(spinlock_bh, spinlock_t, + spin_lock_bh(_T->lock), diff --git a/target/linux/bcm27xx/patches-6.6/950-0061-Revert-Revert-xhci-add-quirk-for-host-controllers-th.patch b/target/linux/bcm27xx/patches-6.6/950-0061-Revert-Revert-xhci-add-quirk-for-host-controllers-th.patch index f8aa2fe5a74b52..7dc38f06117884 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0061-Revert-Revert-xhci-add-quirk-for-host-controllers-th.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0061-Revert-Revert-xhci-add-quirk-for-host-controllers-th.patch @@ -28,7 +28,7 @@ We don't agree with upstream revert so undo it. pdev->device == PCI_DEVICE_ID_ASMEDIA_1042_XHCI) { --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c -@@ -633,8 +633,11 @@ static int xhci_move_dequeue_past_td(str +@@ -634,8 +634,11 @@ static int xhci_move_dequeue_past_td(str struct xhci_ring *ep_ring; struct xhci_command *cmd; struct xhci_segment *new_seg; @@ -40,7 +40,7 @@ We don't agree with upstream revert so undo it. dma_addr_t addr; u64 hw_dequeue; bool cycle_found = false; -@@ -672,7 +675,27 @@ static int xhci_move_dequeue_past_td(str +@@ -673,7 +676,27 @@ static int xhci_move_dequeue_past_td(str hw_dequeue = xhci_get_hw_deq(xhci, dev, ep_index, stream_id); new_seg = ep_ring->deq_seg; new_deq = ep_ring->dequeue; diff --git a/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch b/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch index ecb7bffa025a7e..fe0e2275f10c34 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch @@ -17583,7 +17583,7 @@ Signed-off-by: Phil Elwell * For devices with more than one control interface, we assume the --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c -@@ -2247,6 +2247,8 @@ static const struct usb_audio_quirk_flag +@@ -2249,6 +2249,8 @@ static const struct usb_audio_quirk_flag QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x534d, 0x2109, /* MacroSilicon MS2109 */ QUIRK_FLAG_ALIGN_TRANSFER), diff --git a/target/linux/bcm27xx/patches-6.6/950-0161-xhci-implement-xhci_fixup_endpoint-for-interval-adju.patch b/target/linux/bcm27xx/patches-6.6/950-0161-xhci-implement-xhci_fixup_endpoint-for-interval-adju.patch index 942f47a0a36e08..157fedf27080a8 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0161-xhci-implement-xhci_fixup_endpoint-for-interval-adju.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0161-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 -@@ -1497,6 +1497,109 @@ command_cleanup: +@@ -1498,6 +1498,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 */ -@@ -5347,6 +5450,7 @@ static const struct hc_driver xhci_hc_dr +@@ -5360,6 +5463,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-6.6/950-0162-usb-xhci-workaround-for-bogus-SET_DEQ_PENDING-endpoi.patch b/target/linux/bcm27xx/patches-6.6/950-0162-usb-xhci-workaround-for-bogus-SET_DEQ_PENDING-endpoi.patch index 32681a1bc4b041..bae92863652b54 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0162-usb-xhci-workaround-for-bogus-SET_DEQ_PENDING-endpoi.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0162-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 -@@ -738,9 +738,9 @@ deq_found: +@@ -739,9 +739,9 @@ deq_found: } if ((ep->ep_state & SET_DEQ_PENDING)) { diff --git a/target/linux/bcm27xx/patches-6.6/950-0163-usb-xhci-drop-and-add-the-endpoint-context-in-xhci_f.patch b/target/linux/bcm27xx/patches-6.6/950-0163-usb-xhci-drop-and-add-the-endpoint-context-in-xhci_f.patch index 1e5bb6059d2762..70401f6e7b5aef 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0163-usb-xhci-drop-and-add-the-endpoint-context-in-xhci_f.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0163-usb-xhci-drop-and-add-the-endpoint-context-in-xhci_f.patch @@ -19,7 +19,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c -@@ -1586,7 +1586,7 @@ static void xhci_fixup_endpoint(struct u +@@ -1587,7 +1587,7 @@ static void xhci_fixup_endpoint(struct u return; } ctrl_ctx->add_flags = xhci_get_endpoint_flag_from_index(ep_index); diff --git a/target/linux/bcm27xx/patches-6.6/950-0481-xhci-Use-more-event-ring-segment-table-entries.patch b/target/linux/bcm27xx/patches-6.6/950-0481-xhci-Use-more-event-ring-segment-table-entries.patch index ff8c9223b5f5ba..874725601c1dc7 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0481-xhci-Use-more-event-ring-segment-table-entries.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0481-xhci-Use-more-event-ring-segment-table-entries.patch @@ -52,7 +52,7 @@ Signed-off-by: Jonathan Bell erst_base = xhci_read_64(xhci, &ir->ir_set->erst_base); --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1425,8 +1425,9 @@ struct urb_priv { +@@ -1426,8 +1426,9 @@ struct urb_priv { * Each segment table entry is 4*32bits long. 1K seems like an ok size: * (1K bytes * 8bytes/bit) / (4*32 bits) = 64 segment entries in the table, * meaning 64 ring segments. diff --git a/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch b/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch index 93e45b54424fad..55479438800104 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch @@ -34,7 +34,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 -@@ -728,6 +728,15 @@ static int xhci_move_dequeue_past_td(str +@@ -729,6 +729,15 @@ static int xhci_move_dequeue_past_td(str } while (!cycle_found || !td_last_trb_found); deq_found: @@ -52,7 +52,7 @@ 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 -@@ -1663,6 +1663,9 @@ struct xhci_hcd { +@@ -1664,6 +1664,9 @@ struct xhci_hcd { #define XHCI_CDNS_SCTX_QUIRK BIT_ULL(48) #define XHCI_ETRON_HOST BIT_ULL(49) diff --git a/target/linux/bcm27xx/patches-6.6/950-0484-usb-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch b/target/linux/bcm27xx/patches-6.6/950-0484-usb-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch index add65ee641de97..a1e8f9ed222348 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0484-usb-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0484-usb-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch @@ -100,7 +100,7 @@ Signed-off-by: Jonathan Bell if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1665,6 +1665,7 @@ struct xhci_hcd { +@@ -1666,6 +1666,7 @@ struct xhci_hcd { /* Downstream VLI fixes */ #define XHCI_AVOID_DQ_ON_LINK BIT_ULL(56) diff --git a/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch b/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch index 9c45bd77e9a789..26abb99fe6ff92 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch @@ -75,7 +75,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 -@@ -3674,6 +3674,48 @@ static int xhci_align_td(struct xhci_hcd +@@ -3714,6 +3714,48 @@ static int xhci_align_td(struct xhci_hcd return 1; } @@ -124,7 +124,7 @@ Signed-off-by: Jonathan Bell /* This is very similar to what ehci-q.c qtd_fill() does */ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, struct urb *urb, int slot_id, unsigned int ep_index) -@@ -3830,6 +3872,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3870,6 +3912,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd * } check_trb_math(urb, enqd_len); @@ -133,7 +133,7 @@ Signed-off-by: Jonathan Bell giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, start_cycle, start_trb); return 0; -@@ -3979,6 +4023,8 @@ int xhci_queue_ctrl_tx(struct xhci_hcd * +@@ -4019,6 +4063,8 @@ int xhci_queue_ctrl_tx(struct xhci_hcd * /* Event on completion */ field | TRB_IOC | TRB_TYPE(TRB_STATUS) | ep_ring->cycle_state); @@ -144,7 +144,7 @@ Signed-off-by: Jonathan Bell return 0; --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1666,6 +1666,7 @@ struct xhci_hcd { +@@ -1667,6 +1667,7 @@ struct xhci_hcd { /* Downstream VLI fixes */ #define XHCI_AVOID_DQ_ON_LINK BIT_ULL(56) #define XHCI_VLI_SS_BULK_OUT_BUG BIT_ULL(57) diff --git a/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch b/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch index 551bfccc7508e1..2448bd942a9cce 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch @@ -333,7 +333,7 @@ Signed-off-by: Jonathan Bell /* Global Debug LSP MUX Select */ #define DWC3_GDBGLSPMUX_ENDBC BIT(15) /* Host only */ #define DWC3_GDBGLSPMUX_HOSTSELECT(n) ((n) & 0x3fff) -@@ -1062,6 +1065,7 @@ struct dwc3_scratchpad_array { +@@ -1066,6 +1069,7 @@ struct dwc3_scratchpad_array { * @tx_max_burst_prd: max periodic ESS transmit burst size * @tx_fifo_resize_max_num: max number of fifos allocated during txfifo resize * @clear_stall_protocol: endpoint number that requires a delayed status phase @@ -341,7 +341,7 @@ Signed-off-by: Jonathan Bell * @hsphy_interface: "utmi" or "ulpi" * @connected: true when we're connected to a host, false otherwise * @softconnect: true when gadget connect is called, false when disconnect runs -@@ -1299,6 +1303,7 @@ struct dwc3 { +@@ -1303,6 +1307,7 @@ struct dwc3 { u8 tx_max_burst_prd; u8 tx_fifo_resize_max_num; u8 clear_stall_protocol; diff --git a/target/linux/bcm27xx/patches-6.6/950-0853-drivers-usb-dwc3-add-FS-LS-bus-instance-parkmode-dis.patch b/target/linux/bcm27xx/patches-6.6/950-0853-drivers-usb-dwc3-add-FS-LS-bus-instance-parkmode-dis.patch index 706baccdc722fb..6eb5e5697f70dc 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0853-drivers-usb-dwc3-add-FS-LS-bus-instance-parkmode-dis.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0853-drivers-usb-dwc3-add-FS-LS-bus-instance-parkmode-dis.patch @@ -45,7 +45,7 @@ Signed-off-by: Jonathan Bell #define DWC3_GUCTL1_RESUME_OPMODE_HS_HOST BIT(10) /* Global Status Register */ -@@ -1117,10 +1118,12 @@ struct dwc3_scratchpad_array { +@@ -1121,10 +1122,12 @@ struct dwc3_scratchpad_array { * generation after resume from suspend. * @ulpi_ext_vbus_drv: Set to confiure the upli chip to drives CPEN pin * VBUS with an external supply. @@ -62,7 +62,7 @@ Signed-off-by: Jonathan Bell * @tx_de_emphasis_quirk: set if we enable Tx de-emphasis quirk * @tx_de_emphasis: Tx de-emphasis value * 0 - -6dB de-emphasis -@@ -1347,6 +1350,7 @@ struct dwc3 { +@@ -1351,6 +1354,7 @@ struct dwc3 { unsigned ulpi_ext_vbus_drv:1; unsigned parkmode_disable_ss_quirk:1; unsigned parkmode_disable_hs_quirk:1; diff --git a/target/linux/bcm27xx/patches-6.6/950-1261-mm-vmscan-Maintain-TLB-coherency-in-LRU-code.patch b/target/linux/bcm27xx/patches-6.6/950-1261-mm-vmscan-Maintain-TLB-coherency-in-LRU-code.patch index 70ece97505c72f..3c60865aa7fbf2 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1261-mm-vmscan-Maintain-TLB-coherency-in-LRU-code.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1261-mm-vmscan-Maintain-TLB-coherency-in-LRU-code.patch @@ -16,7 +16,7 @@ Signed-off-by: Phil Elwell --- a/mm/vmscan.c +++ b/mm/vmscan.c -@@ -4716,7 +4716,7 @@ void lru_gen_look_around(struct page_vma +@@ -4723,7 +4723,7 @@ void lru_gen_look_around(struct page_vma if (!folio) continue; diff --git a/target/linux/bcm27xx/patches-6.6/950-1359-usb-dwc3-core-add-support-for-setting-NAK-enhancemen.patch b/target/linux/bcm27xx/patches-6.6/950-1359-usb-dwc3-core-add-support-for-setting-NAK-enhancemen.patch index ed7dbb0e6c6d38..cb4f6deb39383a 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1359-usb-dwc3-core-add-support-for-setting-NAK-enhancemen.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1359-usb-dwc3-core-add-support-for-setting-NAK-enhancemen.patch @@ -57,7 +57,7 @@ Signed-off-by: Jonathan Bell #define DWC3_GUCTL1_PARKMODE_DISABLE_SS BIT(17) #define DWC3_GUCTL1_PARKMODE_DISABLE_HS BIT(16) #define DWC3_GUCTL1_PARKMODE_DISABLE_FSLS BIT(15) -@@ -1118,6 +1120,8 @@ struct dwc3_scratchpad_array { +@@ -1122,6 +1124,8 @@ struct dwc3_scratchpad_array { * generation after resume from suspend. * @ulpi_ext_vbus_drv: Set to confiure the upli chip to drives CPEN pin * VBUS with an external supply. @@ -66,7 +66,7 @@ Signed-off-by: Jonathan Bell * @parkmode_disable_ss_quirk: If set, disable park mode feature for all * Superspeed instances. * @parkmode_disable_hs_quirk: If set, disable park mode feature for all -@@ -1348,6 +1352,8 @@ struct dwc3 { +@@ -1352,6 +1356,8 @@ struct dwc3 { unsigned dis_tx_ipgap_linecheck_quirk:1; unsigned resume_hs_terminations:1; unsigned ulpi_ext_vbus_drv:1; diff --git a/target/linux/bcm27xx/patches-6.6/950-1361-drivers-usb-xhci-prevent-a-theoretical-race-on-non-c.patch b/target/linux/bcm27xx/patches-6.6/950-1361-drivers-usb-xhci-prevent-a-theoretical-race-on-non-c.patch index d3ea1041c2a47b..c2f37a0fc1fdd1 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1361-drivers-usb-xhci-prevent-a-theoretical-race-on-non-c.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1361-drivers-usb-xhci-prevent-a-theoretical-race-on-non-c.patch @@ -28,7 +28,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c -@@ -505,6 +505,19 @@ void xhci_ring_ep_doorbell(struct xhci_h +@@ -506,6 +506,19 @@ void xhci_ring_ep_doorbell(struct xhci_h trace_xhci_ring_ep_doorbell(slot_id, DB_VALUE(ep_index, stream_id)); diff --git a/target/linux/bcm53xx/patches-6.6/180-usb-xhci-add-support-for-performing-fake-doorbell.patch b/target/linux/bcm53xx/patches-6.6/180-usb-xhci-add-support-for-performing-fake-doorbell.patch index 7ac12a290f6822..aef84351482e95 100644 --- a/target/linux/bcm53xx/patches-6.6/180-usb-xhci-add-support-for-performing-fake-doorbell.patch +++ b/target/linux/bcm53xx/patches-6.6/180-usb-xhci-add-support-for-performing-fake-doorbell.patch @@ -35,7 +35,7 @@ it on BCM4708 family. /* called during probe() after chip reset completes */ --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c -@@ -161,6 +161,49 @@ int xhci_start(struct xhci_hcd *xhci) +@@ -162,6 +162,49 @@ int xhci_start(struct xhci_hcd *xhci) return ret; } @@ -85,7 +85,7 @@ it on BCM4708 family. /* * Reset a halted HC. * -@@ -480,6 +523,15 @@ static int xhci_run_finished(struct xhci +@@ -481,6 +524,15 @@ static int xhci_run_finished(struct xhci return -ENODEV; } @@ -103,7 +103,7 @@ it on BCM4708 family. if (xhci->quirks & XHCI_NEC_HOST) --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1661,6 +1661,7 @@ struct xhci_hcd { +@@ -1662,6 +1662,7 @@ struct xhci_hcd { #define XHCI_WRITE_64_HI_LO BIT_ULL(47) #define XHCI_CDNS_SCTX_QUIRK BIT_ULL(48) #define XHCI_ETRON_HOST BIT_ULL(49) diff --git a/target/linux/generic/backport-6.6/600-v6.10-net-Remove-conditional-threaded-NAPI-wakeup-based-on.patch b/target/linux/generic/backport-6.6/600-v6.10-net-Remove-conditional-threaded-NAPI-wakeup-based-on.patch index 6ee4716c5cd095..a6164c82389f0d 100644 --- a/target/linux/generic/backport-6.6/600-v6.10-net-Remove-conditional-threaded-NAPI-wakeup-based-on.patch +++ b/target/linux/generic/backport-6.6/600-v6.10-net-Remove-conditional-threaded-NAPI-wakeup-based-on.patch @@ -32,7 +32,7 @@ Signed-off-by: Paolo Abeni --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -4481,13 +4481,7 @@ static inline void ____napi_schedule(str +@@ -4483,13 +4483,7 @@ static inline void ____napi_schedule(str */ thread = READ_ONCE(napi->thread); if (thread) { @@ -47,7 +47,7 @@ Signed-off-by: Paolo Abeni wake_up_process(thread); return; } -@@ -6643,8 +6637,6 @@ static int napi_poll(struct napi_struct +@@ -6645,8 +6639,6 @@ static int napi_poll(struct napi_struct static int napi_thread_wait(struct napi_struct *napi) { @@ -56,7 +56,7 @@ Signed-off-by: Paolo Abeni set_current_state(TASK_INTERRUPTIBLE); while (!kthread_should_stop()) { -@@ -6653,15 +6645,13 @@ static int napi_thread_wait(struct napi_ +@@ -6655,15 +6647,13 @@ static int napi_thread_wait(struct napi_ * Testing SCHED bit is not enough because SCHED bit might be * set by some other busy poll thread or by napi_disable(). */ diff --git a/target/linux/generic/backport-6.6/601-v6.10-net-Allow-to-use-SMP-threads-for-backlog-NAPI.patch b/target/linux/generic/backport-6.6/601-v6.10-net-Allow-to-use-SMP-threads-for-backlog-NAPI.patch index 8c0b41f37b33ff..b3729e8b6c0a5d 100644 --- a/target/linux/generic/backport-6.6/601-v6.10-net-Allow-to-use-SMP-threads-for-backlog-NAPI.patch +++ b/target/linux/generic/backport-6.6/601-v6.10-net-Allow-to-use-SMP-threads-for-backlog-NAPI.patch @@ -108,7 +108,7 @@ Signed-off-by: Paolo Abeni static inline void rps_lock_irqsave(struct softnet_data *sd, unsigned long *flags) { -@@ -4449,6 +4475,7 @@ EXPORT_SYMBOL(__dev_direct_xmit); +@@ -4451,6 +4477,7 @@ EXPORT_SYMBOL(__dev_direct_xmit); /************************************************************************* * Receiver routines *************************************************************************/ @@ -116,7 +116,7 @@ Signed-off-by: Paolo Abeni int netdev_max_backlog __read_mostly = 1000; EXPORT_SYMBOL(netdev_max_backlog); -@@ -4481,12 +4508,16 @@ static inline void ____napi_schedule(str +@@ -4483,12 +4510,16 @@ static inline void ____napi_schedule(str */ thread = READ_ONCE(napi->thread); if (thread) { @@ -133,7 +133,7 @@ Signed-off-by: Paolo Abeni list_add_tail(&napi->poll_list, &sd->poll_list); WRITE_ONCE(napi->list_owner, smp_processor_id()); /* If not called from net_rx_action() -@@ -4732,6 +4763,11 @@ static void napi_schedule_rps(struct sof +@@ -4734,6 +4765,11 @@ static void napi_schedule_rps(struct sof #ifdef CONFIG_RPS if (sd != mysd) { @@ -145,7 +145,7 @@ Signed-off-by: Paolo Abeni sd->rps_ipi_next = mysd->rps_ipi_list; mysd->rps_ipi_list = sd; -@@ -5955,7 +5991,7 @@ static void net_rps_action_and_irq_enabl +@@ -5957,7 +5993,7 @@ static void net_rps_action_and_irq_enabl #ifdef CONFIG_RPS struct softnet_data *remsd = sd->rps_ipi_list; @@ -154,7 +154,7 @@ Signed-off-by: Paolo Abeni sd->rps_ipi_list = NULL; local_irq_enable(); -@@ -5970,7 +6006,7 @@ static void net_rps_action_and_irq_enabl +@@ -5972,7 +6008,7 @@ static void net_rps_action_and_irq_enabl static bool sd_has_rps_ipi_waiting(struct softnet_data *sd) { #ifdef CONFIG_RPS @@ -163,7 +163,7 @@ Signed-off-by: Paolo Abeni #else return false; #endif -@@ -6014,7 +6050,7 @@ static int process_backlog(struct napi_s +@@ -6016,7 +6052,7 @@ 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. */ @@ -172,7 +172,7 @@ Signed-off-by: Paolo Abeni again = false; } else { skb_queue_splice_tail_init(&sd->input_pkt_queue, -@@ -6680,43 +6716,48 @@ static void skb_defer_free_flush(struct +@@ -6682,43 +6718,48 @@ static void skb_defer_free_flush(struct } } @@ -250,7 +250,7 @@ Signed-off-by: Paolo Abeni return 0; } -@@ -11297,7 +11338,7 @@ static int dev_cpu_dead(unsigned int old +@@ -11299,7 +11340,7 @@ static int dev_cpu_dead(unsigned int old list_del_init(&napi->poll_list); if (napi->poll == process_backlog) @@ -259,7 +259,7 @@ Signed-off-by: Paolo Abeni else ____napi_schedule(sd, napi); } -@@ -11305,12 +11346,14 @@ static int dev_cpu_dead(unsigned int old +@@ -11307,12 +11348,14 @@ static int dev_cpu_dead(unsigned int old raise_softirq_irqoff(NET_TX_SOFTIRQ); local_irq_enable(); @@ -278,7 +278,7 @@ Signed-off-by: Paolo Abeni /* Process offline CPU's input_pkt_queue */ while ((skb = __skb_dequeue(&oldsd->process_queue))) { -@@ -11573,6 +11616,38 @@ static struct pernet_operations __net_in +@@ -11575,6 +11618,38 @@ static struct pernet_operations __net_in * */ @@ -317,7 +317,7 @@ Signed-off-by: Paolo Abeni /* * This is called single threaded during boot, so no need * to take the rtnl semaphore. -@@ -11623,7 +11698,10 @@ static int __init net_dev_init(void) +@@ -11625,7 +11700,10 @@ static int __init net_dev_init(void) init_gro_hash(&sd->backlog); sd->backlog.poll = process_backlog; sd->backlog.weight = weight_p; diff --git a/target/linux/generic/backport-6.6/602-v6.10-net-Use-backlog-NAPI-to-clean-up-the-defer_list.patch b/target/linux/generic/backport-6.6/602-v6.10-net-Use-backlog-NAPI-to-clean-up-the-defer_list.patch index 3fcc72e589532c..82b83552d37b81 100644 --- a/target/linux/generic/backport-6.6/602-v6.10-net-Use-backlog-NAPI-to-clean-up-the-defer_list.patch +++ b/target/linux/generic/backport-6.6/602-v6.10-net-Use-backlog-NAPI-to-clean-up-the-defer_list.patch @@ -82,7 +82,7 @@ Signed-off-by: Paolo Abeni spin_unlock_irq(&sd->input_pkt_queue.lock); else if (!IS_ENABLED(CONFIG_PREEMPT_RT)) local_irq_enable(); -@@ -4782,6 +4782,23 @@ static void napi_schedule_rps(struct sof +@@ -4784,6 +4784,23 @@ static void napi_schedule_rps(struct sof __napi_schedule_irqoff(&mysd->backlog); } diff --git a/target/linux/generic/backport-6.6/603-v6.10-net-Rename-rps_lock-to-backlog_lock.patch b/target/linux/generic/backport-6.6/603-v6.10-net-Rename-rps_lock-to-backlog_lock.patch index 056bd5686eaff1..a6199cd2500efb 100644 --- a/target/linux/generic/backport-6.6/603-v6.10-net-Rename-rps_lock-to-backlog_lock.patch +++ b/target/linux/generic/backport-6.6/603-v6.10-net-Rename-rps_lock-to-backlog_lock.patch @@ -67,7 +67,7 @@ Signed-off-by: Paolo Abeni { if (IS_ENABLED(CONFIG_RPS) || use_backlog_threads()) spin_unlock_irq(&sd->input_pkt_queue.lock); -@@ -4787,12 +4787,12 @@ void kick_defer_list_purge(struct softne +@@ -4789,12 +4789,12 @@ void kick_defer_list_purge(struct softne unsigned long flags; if (use_backlog_threads()) { @@ -82,7 +82,7 @@ Signed-off-by: Paolo Abeni } else if (!cmpxchg(&sd->defer_ipi_scheduled, 0, 1)) { smp_call_function_single_async(cpu, &sd->defer_csd); -@@ -4854,7 +4854,7 @@ static int enqueue_to_backlog(struct sk_ +@@ -4856,7 +4856,7 @@ static int enqueue_to_backlog(struct sk_ reason = SKB_DROP_REASON_NOT_SPECIFIED; sd = &per_cpu(softnet_data, cpu); @@ -91,7 +91,7 @@ Signed-off-by: Paolo Abeni if (!netif_running(skb->dev)) goto drop; qlen = skb_queue_len(&sd->input_pkt_queue); -@@ -4863,7 +4863,7 @@ static int enqueue_to_backlog(struct sk_ +@@ -4865,7 +4865,7 @@ static int enqueue_to_backlog(struct sk_ enqueue: __skb_queue_tail(&sd->input_pkt_queue, skb); input_queue_tail_incr_save(sd, qtail); @@ -100,7 +100,7 @@ Signed-off-by: Paolo Abeni return NET_RX_SUCCESS; } -@@ -4878,7 +4878,7 @@ enqueue: +@@ -4880,7 +4880,7 @@ enqueue: drop: sd->dropped++; @@ -109,7 +109,7 @@ Signed-off-by: Paolo Abeni dev_core_stats_rx_dropped_inc(skb->dev); kfree_skb_reason(skb, reason); -@@ -5909,7 +5909,7 @@ static void flush_backlog(struct work_st +@@ -5911,7 +5911,7 @@ static void flush_backlog(struct work_st local_bh_disable(); sd = this_cpu_ptr(&softnet_data); @@ -118,7 +118,7 @@ Signed-off-by: Paolo Abeni skb_queue_walk_safe(&sd->input_pkt_queue, skb, tmp) { if (skb->dev->reg_state == NETREG_UNREGISTERING) { __skb_unlink(skb, &sd->input_pkt_queue); -@@ -5917,7 +5917,7 @@ static void flush_backlog(struct work_st +@@ -5919,7 +5919,7 @@ static void flush_backlog(struct work_st input_queue_head_incr(sd); } } @@ -127,7 +127,7 @@ Signed-off-by: Paolo Abeni skb_queue_walk_safe(&sd->process_queue, skb, tmp) { if (skb->dev->reg_state == NETREG_UNREGISTERING) { -@@ -5935,14 +5935,14 @@ static bool flush_required(int cpu) +@@ -5937,14 +5937,14 @@ static bool flush_required(int cpu) struct softnet_data *sd = &per_cpu(softnet_data, cpu); bool do_flush; @@ -144,7 +144,7 @@ Signed-off-by: Paolo Abeni return do_flush; #endif -@@ -6057,7 +6057,7 @@ static int process_backlog(struct napi_s +@@ -6059,7 +6059,7 @@ static int process_backlog(struct napi_s } @@ -153,7 +153,7 @@ Signed-off-by: Paolo Abeni if (skb_queue_empty(&sd->input_pkt_queue)) { /* * Inline a custom version of __napi_complete(). -@@ -6073,7 +6073,7 @@ static int process_backlog(struct napi_s +@@ -6075,7 +6075,7 @@ static int process_backlog(struct napi_s skb_queue_splice_tail_init(&sd->input_pkt_queue, &sd->process_queue); } diff --git a/target/linux/generic/backport-6.6/611-02-v6.11-net-Make-USO-depend-on-CSUM-offload.patch b/target/linux/generic/backport-6.6/611-02-v6.11-net-Make-USO-depend-on-CSUM-offload.patch index 42aff7f0afc1ee..6b5272d583f97d 100644 --- a/target/linux/generic/backport-6.6/611-02-v6.11-net-Make-USO-depend-on-CSUM-offload.patch +++ b/target/linux/generic/backport-6.6/611-02-v6.11-net-Make-USO-depend-on-CSUM-offload.patch @@ -20,7 +20,7 @@ Signed-off-by: Jakub Kicinski --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -9759,6 +9759,15 @@ static void netdev_sync_lower_features(s +@@ -9761,6 +9761,15 @@ static void netdev_sync_lower_features(s } } @@ -36,7 +36,7 @@ Signed-off-by: Jakub Kicinski static netdev_features_t netdev_fix_features(struct net_device *dev, netdev_features_t features) { -@@ -9840,15 +9849,9 @@ static netdev_features_t netdev_fix_feat +@@ -9842,15 +9851,9 @@ static netdev_features_t netdev_fix_feat features &= ~NETIF_F_LRO; } @@ -55,7 +55,7 @@ Signed-off-by: Jakub Kicinski } if ((features & NETIF_F_HW_TLS_RX) && !(features & NETIF_F_RXCSUM)) { -@@ -9856,6 +9859,11 @@ static netdev_features_t netdev_fix_feat +@@ -9858,6 +9861,11 @@ static netdev_features_t netdev_fix_feat features &= ~NETIF_F_HW_TLS_RX; } diff --git a/target/linux/generic/backport-6.6/612-v6.9-net-get-stats64-if-device-if-driver-is-configured.patch b/target/linux/generic/backport-6.6/612-v6.9-net-get-stats64-if-device-if-driver-is-configured.patch index d72882dbb6829b..8f2c26d6543344 100644 --- a/target/linux/generic/backport-6.6/612-v6.9-net-get-stats64-if-device-if-driver-is-configured.patch +++ b/target/linux/generic/backport-6.6/612-v6.9-net-get-stats64-if-device-if-driver-is-configured.patch @@ -18,7 +18,7 @@ Signed-off-by: Paolo Abeni --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -10666,6 +10666,8 @@ struct rtnl_link_stats64 *dev_get_stats( +@@ -10668,6 +10668,8 @@ struct rtnl_link_stats64 *dev_get_stats( ops->ndo_get_stats64(dev, storage); } else if (ops->ndo_get_stats) { netdev_stats_to_stats64(storage, ops->ndo_get_stats(dev)); diff --git a/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch b/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch index 3f48a8c34a9338..c8b4ccc3004f72 100644 --- a/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch +++ b/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch @@ -49,7 +49,7 @@ Signed-off-by: David S. Miller unsigned char name_assign_type, --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -10353,25 +10353,12 @@ err_free_name: +@@ -10355,25 +10355,12 @@ err_free_name: } EXPORT_SYMBOL(register_netdevice); @@ -79,7 +79,7 @@ Signed-off-by: David S. Miller /* make sure we BUG if trying to hit standard * register/unregister code path */ -@@ -10391,12 +10378,32 @@ int init_dummy_netdev(struct net_device +@@ -10393,12 +10380,32 @@ int init_dummy_netdev(struct net_device * because users of this 'device' dont need to change * its refcount. */ @@ -113,7 +113,7 @@ Signed-off-by: David S. Miller /** * register_netdev - register a network device * @dev: device to register -@@ -10990,6 +10997,19 @@ void free_netdev(struct net_device *dev) +@@ -10992,6 +10999,19 @@ void free_netdev(struct net_device *dev) EXPORT_SYMBOL(free_netdev); /** diff --git a/target/linux/generic/backport-6.6/770-net-introduce-napi_is_scheduled-helper.patch b/target/linux/generic/backport-6.6/770-net-introduce-napi_is_scheduled-helper.patch index d7b2b275067fb8..2bf136e18a3206 100644 --- a/target/linux/generic/backport-6.6/770-net-introduce-napi_is_scheduled-helper.patch +++ b/target/linux/generic/backport-6.6/770-net-introduce-napi_is_scheduled-helper.patch @@ -85,7 +85,7 @@ Signed-off-by: Paolo Abeni /** --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -6610,7 +6610,7 @@ static int __napi_poll(struct napi_struc +@@ -6612,7 +6612,7 @@ static int __napi_poll(struct napi_struc * accidentally calling ->poll() when NAPI is not scheduled. */ work = 0; diff --git a/target/linux/generic/backport-6.6/900-v6.11-net-free_netdev-exit-earlier-if-dummy.patch b/target/linux/generic/backport-6.6/900-v6.11-net-free_netdev-exit-earlier-if-dummy.patch index 21db87419ee970..5f7210812fb998 100644 --- a/target/linux/generic/backport-6.6/900-v6.11-net-free_netdev-exit-earlier-if-dummy.patch +++ b/target/linux/generic/backport-6.6/900-v6.11-net-free_netdev-exit-earlier-if-dummy.patch @@ -23,7 +23,7 @@ Signed-off-by: David S. Miller --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -10983,7 +10983,8 @@ void free_netdev(struct net_device *dev) +@@ -10985,7 +10985,8 @@ void free_netdev(struct net_device *dev) dev->xdp_bulkq = NULL; /* Compatibility with error handling in drivers */ diff --git a/target/linux/generic/backport-6.6/902-net-llc-reset-skb-transport_header.patch b/target/linux/generic/backport-6.6/902-net-llc-reset-skb-transport_header.patch deleted file mode 100644 index b1f0b8fce7e34c..00000000000000 --- a/target/linux/generic/backport-6.6/902-net-llc-reset-skb-transport_header.patch +++ /dev/null @@ -1,52 +0,0 @@ -From a024e377efed31ecfb39210bed562932321345b3 Mon Sep 17 00:00:00 2001 -From: Antonio Pastor -Date: Tue, 24 Dec 2024 20:07:20 -0500 -Subject: [PATCH] net: llc: reset skb->transport_header - -802.2+LLC+SNAP frames received by napi_complete_done with GRO and DSA -have skb->transport_header set two bytes short, or pointing 2 bytes -before network_header & skb->data. As snap_rcv expects transport_header -to point to SNAP header (OID:PID) after LLC processing advances offset -over LLC header (llc_rcv & llc_fixup_skb), code doesn't find a match -and packet is dropped. - -Between napi_complete_done and snap_rcv, transport_header is not used -until __netif_receive_skb_core, where originally it was being reset. -Commit fda55eca5a33 ("net: introduce skb_transport_header_was_set()") -only does so if not set, on the assumption the value was set correctly -by GRO (and also on assumption that "network stacks usually reset the -transport header anyway"). Afterwards it is moved forward by -llc_fixup_skb. - -Locally generated traffic shows up at __netif_receive_skb_core with no -transport_header set and is processed without issue. On a setup with -GRO but no DSA, transport_header and network_header are both set to -point to skb->data which is also correct. - -As issue is LLC specific, to avoid impacting non-LLC traffic, and to -follow up on original assumption made on previous code change, -llc_fixup_skb to reset the offset after skb pull. llc_fixup_skb -assumes the LLC header is at skb->data, and by definition SNAP header -immediately follows. - -Fixes: fda55eca5a33 ("net: introduce skb_transport_header_was_set()") -Signed-off-by: Antonio Pastor -Reviewed-by: Eric Dumazet -Link: https://patch.msgid.link/20241225010723.2830290-1-antonio.pastor@gmail.com -Signed-off-by: Jakub Kicinski ---- - net/llc/llc_input.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/net/llc/llc_input.c -+++ b/net/llc/llc_input.c -@@ -124,8 +124,8 @@ static inline int llc_fixup_skb(struct s - if (unlikely(!pskb_may_pull(skb, llc_len))) - return 0; - -- skb->transport_header += llc_len; - skb_pull(skb, llc_len); -+ skb_reset_transport_header(skb); - if (skb->protocol == htons(ETH_P_802_2)) { - __be16 pdulen; - s32 data_size; diff --git a/target/linux/generic/hack-6.6/901-debloat_sock_diag.patch b/target/linux/generic/hack-6.6/901-debloat_sock_diag.patch index 4b1ea3c5ad932f..c0ba6c008e83e5 100644 --- a/target/linux/generic/hack-6.6/901-debloat_sock_diag.patch +++ b/target/linux/generic/hack-6.6/901-debloat_sock_diag.patch @@ -83,7 +83,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 *, -@@ -2239,9 +2256,11 @@ static void __sk_free(struct sock *sk) +@@ -2242,9 +2259,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-6.6/902-debloat_proc.patch b/target/linux/generic/hack-6.6/902-debloat_proc.patch index 54985070076907..8a2f3330abf9fc 100644 --- a/target/linux/generic/hack-6.6/902-debloat_proc.patch +++ b/target/linux/generic/hack-6.6/902-debloat_proc.patch @@ -330,7 +330,7 @@ Signed-off-by: Felix Fietkau --- a/net/core/sock.c +++ b/net/core/sock.c -@@ -4140,6 +4140,8 @@ static __net_initdata struct pernet_oper +@@ -4143,6 +4143,8 @@ static __net_initdata struct pernet_oper static int __init proto_init(void) { diff --git a/target/linux/generic/pending-6.6/605-netfilter-nft_set_hash-unaligned-atomic-read-on-stru.patch b/target/linux/generic/pending-6.6/605-netfilter-nft_set_hash-unaligned-atomic-read-on-stru.patch deleted file mode 100644 index 61e163293e23f1..00000000000000 --- a/target/linux/generic/pending-6.6/605-netfilter-nft_set_hash-unaligned-atomic-read-on-stru.patch +++ /dev/null @@ -1,87 +0,0 @@ -From 113fb8a8d1f27156f58b27ce0fc02af9b3705bf7 Mon Sep 17 00:00:00 2001 -From: Pablo Neira Ayuso -Date: Sun, 22 Dec 2024 11:02:39 +0100 -Subject: [PATCH] netfilter: nft_set_hash: unaligned atomic read on struct - nft_set_ext - -Access to genmask field in struct nft_set_ext results in unaligned -atomic read: - -[ 72.130109] Unable to handle kernel paging request at virtual address ffff0000c2bb708c -[ 72.131036] Mem abort info: -[ 72.131213] ESR = 0x0000000096000021 -[ 72.131446] EC = 0x25: DABT (current EL), IL = 32 bits -[ 72.132209] SET = 0, FnV = 0 -[ 72.133216] EA = 0, S1PTW = 0 -[ 72.134080] FSC = 0x21: alignment fault -[ 72.135593] Data abort info: -[ 72.137194] ISV = 0, ISS = 0x00000021, ISS2 = 0x00000000 -[ 72.142351] CM = 0, WnR = 0, TnD = 0, TagAccess = 0 -[ 72.145989] GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0 -[ 72.150115] swapper pgtable: 4k pages, 48-bit VAs, pgdp=0000000237d27000 -[ 72.154893] [ffff0000c2bb708c] pgd=0000000000000000, p4d=180000023ffff403, pud=180000023f84b403, pmd=180000023f835403, -+pte=0068000102bb7707 -[ 72.163021] Internal error: Oops: 0000000096000021 [#1] SMP -[...] -[ 72.170041] CPU: 7 UID: 0 PID: 54 Comm: kworker/7:0 Tainted: G E 6.13.0-rc3+ #2 -[ 72.170509] Tainted: [E]=UNSIGNED_MODULE -[ 72.170720] Hardware name: QEMU QEMU Virtual Machine, BIOS edk2-stable202302-for-qemu 03/01/2023 -[ 72.171192] Workqueue: events_power_efficient nft_rhash_gc [nf_tables] -[ 72.171552] pstate: 21400005 (nzCv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--) -[ 72.171915] pc : nft_rhash_gc+0x200/0x2d8 [nf_tables] -[ 72.172166] lr : nft_rhash_gc+0x128/0x2d8 [nf_tables] -[ 72.172546] sp : ffff800081f2bce0 -[ 72.172724] x29: ffff800081f2bd40 x28: ffff0000c2bb708c x27: 0000000000000038 -[ 72.173078] x26: ffff0000c6780ef0 x25: ffff0000c643df00 x24: ffff0000c6778f78 -[ 72.173431] x23: 000000000000001a x22: ffff0000c4b1f000 x21: ffff0000c6780f78 -[ 72.173782] x20: ffff0000c2bb70dc x19: ffff0000c2bb7080 x18: 0000000000000000 -[ 72.174135] x17: ffff0000c0a4e1c0 x16: 0000000000003000 x15: 0000ac26d173b978 -[ 72.174485] x14: ffffffffffffffff x13: 0000000000000030 x12: ffff0000c6780ef0 -[ 72.174841] x11: 0000000000000000 x10: ffff800081f2bcf8 x9 : ffff0000c3000000 -[ 72.175193] x8 : 00000000000004be x7 : 0000000000000000 x6 : 0000000000000000 -[ 72.175544] x5 : 0000000000000040 x4 : ffff0000c3000010 x3 : 0000000000000000 -[ 72.175871] x2 : 0000000000003a98 x1 : ffff0000c2bb708c x0 : 0000000000000004 -[ 72.176207] Call trace: -[ 72.176316] nft_rhash_gc+0x200/0x2d8 [nf_tables] (P) -[ 72.176653] process_one_work+0x178/0x3d0 -[ 72.176831] worker_thread+0x200/0x3f0 -[ 72.176995] kthread+0xe8/0xf8 -[ 72.177130] ret_from_fork+0x10/0x20 -[ 72.177289] Code: 54fff984 d503201f d2800080 91003261 (f820303f) -[ 72.177557] ---[ end trace 0000000000000000 ]--- - -Align struct nft_set_ext to word size to address this and -documentation it. - -pahole reports that this increases the size of elements for rhash and -pipapo in 8 bytes on x86_64. - -Fixes: 7ffc7481153b ("netfilter: nft_set_hash: skip duplicated elements pending gc run") -Signed-off-by: Pablo Neira Ayuso ---- - include/net/netfilter/nf_tables.h | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - ---- a/include/net/netfilter/nf_tables.h -+++ b/include/net/netfilter/nf_tables.h -@@ -721,15 +721,18 @@ struct nft_set_ext_tmpl { - /** - * struct nft_set_ext - set extensions - * -- * @genmask: generation mask -+ * @genmask: generation mask, but also flags (see NFT_SET_ELEM_DEAD_BIT) - * @offset: offsets of individual extension types - * @data: beginning of extension data -+ * -+ * This structure must be aligned to word size, otherwise atomic bitops -+ * on genmask field can cause aligment failure on some archs. - */ - struct nft_set_ext { - u8 genmask; - u8 offset[NFT_SET_EXT_NUM]; - char data[]; --}; -+} __aligned(BITS_PER_LONG / 8); - - static inline void nft_set_ext_prepare(struct nft_set_ext_tmpl *tmpl) - { diff --git a/target/linux/generic/pending-6.6/630-packet_socket_type.patch b/target/linux/generic/pending-6.6/630-packet_socket_type.patch index 2b753efa6736cd..f5c15756c5eab9 100644 --- a/target/linux/generic/pending-6.6/630-packet_socket_type.patch +++ b/target/linux/generic/pending-6.6/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 -@@ -1925,6 +1925,7 @@ static int packet_rcv_spkt(struct sk_buf +@@ -1911,6 +1911,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 -@@ -1932,6 +1933,7 @@ static int packet_rcv_spkt(struct sk_buf +@@ -1918,6 +1919,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 -@@ -1944,7 +1946,7 @@ static int packet_rcv_spkt(struct sk_buf +@@ -1930,7 +1932,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))) -@@ -2190,12 +2192,12 @@ static int packet_rcv(struct sk_buff *sk +@@ -2176,12 +2178,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; -@@ -2322,12 +2324,12 @@ static int tpacket_rcv(struct sk_buff *s +@@ -2308,12 +2310,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; -@@ -3451,6 +3453,7 @@ static int packet_create(struct net *net +@@ -3437,6 +3439,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; -@@ -4118,6 +4121,16 @@ packet_setsockopt(struct socket *sock, i +@@ -4104,6 +4107,16 @@ packet_setsockopt(struct socket *sock, i packet_sock_flag_set(po, PACKET_SOCK_QDISC_BYPASS, val); return 0; } @@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau default: return -ENOPROTOOPT; } -@@ -4177,6 +4190,13 @@ static int packet_getsockopt(struct sock +@@ -4163,6 +4176,13 @@ static int packet_getsockopt(struct sock case PACKET_VNET_HDR_SZ: val = READ_ONCE(po->vnet_hdr_sz); break; diff --git a/target/linux/generic/pending-6.6/681-net-remove-NETIF_F_GSO_FRAGLIST-from-NETIF_F_GSO_SOF.patch b/target/linux/generic/pending-6.6/681-net-remove-NETIF_F_GSO_FRAGLIST-from-NETIF_F_GSO_SOF.patch index 97e321bfec13e9..58ccff247fb5c5 100644 --- a/target/linux/generic/pending-6.6/681-net-remove-NETIF_F_GSO_FRAGLIST-from-NETIF_F_GSO_SOF.patch +++ b/target/linux/generic/pending-6.6/681-net-remove-NETIF_F_GSO_FRAGLIST-from-NETIF_F_GSO_SOF.patch @@ -96,7 +96,7 @@ Signed-off-by: Felix Fietkau return features; --- a/net/core/sock.c +++ b/net/core/sock.c -@@ -2441,7 +2441,7 @@ void sk_setup_caps(struct sock *sk, stru +@@ -2444,7 +2444,7 @@ void sk_setup_caps(struct sock *sk, stru if (sk_is_tcp(sk)) sk->sk_route_caps |= NETIF_F_GSO; if (sk->sk_route_caps & NETIF_F_GSO) diff --git a/target/linux/lantiq/patches-6.6/0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch b/target/linux/lantiq/patches-6.6/0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch index 1f2f5139d60a13..73eb59f1664d21 100644 --- a/target/linux/lantiq/patches-6.6/0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch +++ b/target/linux/lantiq/patches-6.6/0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch @@ -18,7 +18,7 @@ Signed-off-by: John Crispin --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig -@@ -817,6 +817,16 @@ config I2C_MICROCHIP_CORE +@@ -819,6 +819,16 @@ config I2C_MICROCHIP_CORE This driver can also be built as a module. If so, the module will be called i2c-microchip-core. diff --git a/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch b/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch index c98aaf9442bb7d..a01911b1f4eb96 100644 --- a/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch +++ b/target/linux/ramips/patches-6.6/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 -@@ -3249,6 +3249,18 @@ static const struct usb_device_id uvc_id +@@ -3271,6 +3271,18 @@ static const struct usb_device_id uvc_id .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) }, diff --git a/target/linux/ramips/patches-6.6/825-i2c-MIPS-adds-ralink-I2C-driver.patch b/target/linux/ramips/patches-6.6/825-i2c-MIPS-adds-ralink-I2C-driver.patch index c8cfb784ce5b32..9755eeb777dc5b 100644 --- a/target/linux/ramips/patches-6.6/825-i2c-MIPS-adds-ralink-I2C-driver.patch +++ b/target/linux/ramips/patches-6.6/825-i2c-MIPS-adds-ralink-I2C-driver.patch @@ -45,7 +45,7 @@ Signed-off-by: John Crispin +}; --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig -@@ -1021,6 +1021,11 @@ config I2C_RK3X +@@ -1023,6 +1023,11 @@ config I2C_RK3X This driver can also be built as a module. If so, the module will be called i2c-rk3x. diff --git a/target/linux/realtek/patches-6.6/310-add-i2c-rtl9300-support.patch b/target/linux/realtek/patches-6.6/310-add-i2c-rtl9300-support.patch index 71df91bdacb7a7..9eaed95d0df74c 100644 --- a/target/linux/realtek/patches-6.6/310-add-i2c-rtl9300-support.patch +++ b/target/linux/realtek/patches-6.6/310-add-i2c-rtl9300-support.patch @@ -17,7 +17,7 @@ Submitted-by: Birger Koblitz --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig -@@ -1021,6 +1021,16 @@ config I2C_RK3X +@@ -1023,6 +1023,16 @@ config I2C_RK3X This driver can also be built as a module. If so, the module will be called i2c-rk3x. diff --git a/target/linux/rockchip/patches-6.6/034-v6.7-usb-dwc3-add-optional-PHY-interface-clocks.patch b/target/linux/rockchip/patches-6.6/034-v6.7-usb-dwc3-add-optional-PHY-interface-clocks.patch index 00ca1d40139873..d38d260ef17d74 100644 --- a/target/linux/rockchip/patches-6.6/034-v6.7-usb-dwc3-add-optional-PHY-interface-clocks.patch +++ b/target/linux/rockchip/patches-6.6/034-v6.7-usb-dwc3-add-optional-PHY-interface-clocks.patch @@ -71,7 +71,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h -@@ -998,6 +998,8 @@ struct dwc3_scratchpad_array { +@@ -1002,6 +1002,8 @@ struct dwc3_scratchpad_array { * @bus_clk: clock for accessing the registers * @ref_clk: reference clock * @susp_clk: clock used when the SS phy is in low power (S3) state @@ -80,7 +80,7 @@ Signed-off-by: Greg Kroah-Hartman * @reset: reset control * @regs: base address for our registers * @regs_size: address space size -@@ -1170,6 +1172,8 @@ struct dwc3 { +@@ -1174,6 +1176,8 @@ struct dwc3 { struct clk *bus_clk; struct clk *ref_clk; struct clk *susp_clk; diff --git a/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch b/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch index 847b8e20ff49a7..4c1dfabd9e992b 100644 --- a/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch +++ b/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch @@ -160,7 +160,7 @@ Signed-off-by: minda.chen } --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c -@@ -3667,7 +3667,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3707,7 +3707,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd * full_len = urb->transfer_buffer_length; /* If we have scatter/gather list, we use it. */ @@ -172,7 +172,7 @@ Signed-off-by: minda.chen addr = (u64) sg_dma_address(sg); --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c -@@ -18,6 +18,8 @@ +@@ -19,6 +19,8 @@ #include #include #include @@ -181,7 +181,7 @@ Signed-off-by: minda.chen #include "xhci.h" #include "xhci-trace.h" -@@ -1285,6 +1287,55 @@ static void xhci_unmap_temp_buf(struct u +@@ -1286,6 +1288,55 @@ static void xhci_unmap_temp_buf(struct u urb->transfer_buffer = NULL; } @@ -237,7 +237,7 @@ Signed-off-by: minda.chen /* * Bypass the DMA mapping if URB is suitable for Immediate Transfer (IDT), * we'll copy the actual data into the TRB address register. This is limited to -@@ -1305,9 +1356,11 @@ static int xhci_map_urb_for_dma(struct u +@@ -1306,9 +1357,11 @@ static int xhci_map_urb_for_dma(struct u if (xhci_urb_temp_buffer_required(hcd, urb)) return xhci_map_temp_buffer(hcd, urb); } @@ -249,7 +249,7 @@ Signed-off-by: minda.chen static void xhci_unmap_urb_for_dma(struct usb_hcd *hcd, struct urb *urb) { struct xhci_hcd *xhci; -@@ -1320,8 +1373,10 @@ static void xhci_unmap_urb_for_dma(struc +@@ -1321,8 +1374,10 @@ static void xhci_unmap_urb_for_dma(struc if ((xhci->quirks & XHCI_SG_TRB_CACHE_SIZE_QUIRK) && unmap_temp_buf) xhci_unmap_temp_buf(hcd, urb); @@ -263,7 +263,7 @@ Signed-off-by: minda.chen /** --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1508,6 +1508,13 @@ struct xhci_hub { +@@ -1509,6 +1509,13 @@ struct xhci_hub { u8 min_rev; }; @@ -277,7 +277,7 @@ Signed-off-by: minda.chen /* There is one xhci_hcd structure per controller */ struct xhci_hcd { struct usb_hcd *main_hcd; -@@ -1662,6 +1669,8 @@ struct xhci_hcd { +@@ -1663,6 +1670,8 @@ struct xhci_hcd { #define XHCI_CDNS_SCTX_QUIRK BIT_ULL(48) #define XHCI_ETRON_HOST BIT_ULL(49) @@ -286,7 +286,7 @@ Signed-off-by: minda.chen unsigned int num_active_eps; unsigned int limit_active_eps; struct xhci_port *hw_ports; -@@ -1691,6 +1700,8 @@ struct xhci_hcd { +@@ -1692,6 +1701,8 @@ struct xhci_hcd { struct list_head regset_list; void *dbc; From ff529e81370420d0a709877df60c7b49f32f971d Mon Sep 17 00:00:00 2001 From: John Audia Date: Fri, 10 Jan 2025 16:01:56 -0500 Subject: [PATCH 344/877] kernel: bump 6.6 to 6.6.71 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.71 Manually rebased: airoha/patches-6.6/110-01-clk-en7523-Rework-clock-handling-for-different-clock.patch airoha/patches-6.6/111-mmc-mtk-sd-add-support-for-AN7581-MMC-Host.patch All other patches automatically rebased. Build system: x86/64 Build-tested: bcm27xx/bcm2712 Run-tested: bcm27xx/bcm2712 Signed-off-by: John Audia [ fix manually rebased patch ] Link: https://github.com/openwrt/openwrt/pull/17568 Signed-off-by: Christian Marangi (cherry picked from commit 3f87c5ac4221deb37d4c3e730e692eef8f9c9ffe) --- include/kernel-6.6 | 4 ++-- ...Rework-clock-handling-for-different-clock.patch | 14 +++++++------- ...mc-mtk-sd-add-support-for-AN7581-MMC-Host.patch | 14 ++++++-------- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/include/kernel-6.6 b/include/kernel-6.6 index 1cda04d0c587ef..f034d0754cca75 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .70 -LINUX_KERNEL_HASH-6.6.70 = 84d23ee07fb26febbcb6d1295ba15efdc67ac382b4137b2c8853146c10fd2f97 +LINUX_VERSION-6.6 = .71 +LINUX_KERNEL_HASH-6.6.71 = 219715ba2dcfa6539fba09ad3f9212772f3507189eb60d77f8e89b06c32e724e diff --git a/target/linux/airoha/patches-6.6/110-01-clk-en7523-Rework-clock-handling-for-different-clock.patch b/target/linux/airoha/patches-6.6/110-01-clk-en7523-Rework-clock-handling-for-different-clock.patch index 7333ebbdf2607e..187715a5cc3302 100644 --- a/target/linux/airoha/patches-6.6/110-01-clk-en7523-Rework-clock-handling-for-different-clock.patch +++ b/target/linux/airoha/patches-6.6/110-01-clk-en7523-Rework-clock-handling-for-different-clock.patch @@ -26,15 +26,15 @@ Signed-off-by: Christian Marangi const struct clk_ops pcie_ops; int (*hw_init)(struct platform_device *pdev, struct clk_hw_onecell_data *clk_data); -@@ -525,8 +526,6 @@ static void en7523_register_clocks(struc +@@ -504,8 +505,6 @@ static void en7523_register_clocks(struc + u32 rate; + int i; - hw = en7523_register_pcie_clk(dev, np_base); - clk_data->hws[EN7523_CLK_PCIE] = hw; -- - clk_data->num = EN7523_NUM_CLOCKS; - } - - static int en7523_clk_hw_init(struct platform_device *pdev, +- + for (i = 0; i < ARRAY_SIZE(en7523_base_clks); i++) { + const struct en_clk_desc *desc = &en7523_base_clks[i]; + u32 reg = desc->div_reg ? desc->div_reg : desc->base_reg; @@ -587,8 +586,6 @@ static void en7581_register_clocks(struc hw = en7523_register_pcie_clk(dev, base); diff --git a/target/linux/airoha/patches-6.6/111-mmc-mtk-sd-add-support-for-AN7581-MMC-Host.patch b/target/linux/airoha/patches-6.6/111-mmc-mtk-sd-add-support-for-AN7581-MMC-Host.patch index 24c4dbde786584..d116bb9ee05462 100644 --- a/target/linux/airoha/patches-6.6/111-mmc-mtk-sd-add-support-for-AN7581-MMC-Host.patch +++ b/target/linux/airoha/patches-6.6/111-mmc-mtk-sd-add-support-for-AN7581-MMC-Host.patch @@ -103,29 +103,27 @@ Signed-off-by: Christian Marangi host->bus_clk = devm_clk_get_optional(&pdev->dev, "bus_clk"); if (IS_ERR(host->bus_clk)) -@@ -2740,11 +2767,14 @@ static int msdc_drv_probe(struct platfor - goto host_free; +@@ -2731,10 +2758,13 @@ static int msdc_drv_probe(struct platfor + return PTR_ERR(host->pins_default); } - host->pins_uhs = pinctrl_lookup_state(host->pinctrl, "state_uhs"); - if (IS_ERR(host->pins_uhs)) { -- ret = PTR_ERR(host->pins_uhs); - dev_err(&pdev->dev, "Cannot find pinctrl uhs!\n"); -- goto host_free; +- return PTR_ERR(host->pins_uhs); + /* AN7581 doesn't have state_uhs pins */ + if (!device_is_compatible(&pdev->dev, "airoha,an7581-mmc")) { + host->pins_uhs = pinctrl_lookup_state(host->pinctrl, "state_uhs"); + if (IS_ERR(host->pins_uhs)) { -+ ret = PTR_ERR(host->pins_uhs); + dev_err(&pdev->dev, "Cannot find pinctrl uhs!\n"); -+ goto host_free; ++ return PTR_ERR(host->pins_uhs); + } } /* Support for SDIO eint irq ? */ -@@ -2825,6 +2855,12 @@ static int msdc_drv_probe(struct platfor +@@ -2815,6 +2845,12 @@ static int msdc_drv_probe(struct platfor dev_err(&pdev->dev, "Cannot ungate clocks!\n"); - goto release_mem; + goto release_clk; } + + /* AN7581 without regulator require tune to OCR values */ From 6c0707a59dc3f3927d63ae2fc68d6a3e13b0eabd Mon Sep 17 00:00:00 2001 From: Aleksander Jan Bajkowski Date: Sat, 11 Jan 2025 17:04:33 +0100 Subject: [PATCH 345/877] lantiq: xrx200_legacy: add alternative names for TP-Link TD-W9980(B) The TP-Link TD-W9980(B) shares the same hardware with the TP-Link TD-W8980. The only difference is that the TD-W8980 does not support VDSL. This is a software limitation and once the software is changed, both work equally supporting VDSL. This commit adds alternative names for devices so they can be easily found in the firmware selector. Signed-off-by: Aleksander Jan Bajkowski Link: https://github.com/openwrt/openwrt/pull/17583 Signed-off-by: Hauke Mehrtens (cherry picked from commit b2b4ce15322c75bda0cae6fb2160a74270185831) --- target/linux/lantiq/image/tp-link_legacy.mk | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/target/linux/lantiq/image/tp-link_legacy.mk b/target/linux/lantiq/image/tp-link_legacy.mk index d9bcd35d10f0de..19a81bd8274a1b 100644 --- a/target/linux/lantiq/image/tp-link_legacy.mk +++ b/target/linux/lantiq/image/tp-link_legacy.mk @@ -36,6 +36,12 @@ define Device/tplink_tdw8980 $(Device/lantiqTpLink) DEVICE_MODEL := TD-W8980 DEVICE_VARIANT := v1 + DEVICE_ALT0_VENDOR := TP-LINK + DEVICE_ALT0_MODEL := TD-W9980 + DEVICE_ALT0_VARIANT := v1 + DEVICE_ALT1_VENDOR := TP-LINK + DEVICE_ALT1_MODEL := TD-W9980B + DEVICE_ALT1_VARIANT := v1 TPLINK_FLASHLAYOUT := 8Mltq TPLINK_HWID := 0x89800001 TPLINK_HWREV := 14 From afbe72d293126312b12f1776855093eb8c5198dd Mon Sep 17 00:00:00 2001 From: Aleksander Jan Bajkowski Date: Sat, 11 Jan 2025 17:10:42 +0100 Subject: [PATCH 346/877] lantiq: xrx200: add alternative names for Plusnet Hub One and BT Business Hub 5A The Plusnet Hub One and BT Business Hub 5A have the same hardware as the BT Home Hub 5A. This commit adds alternative names so that both devices can be easily found in the firmware selector. Signed-off-by: Aleksander Jan Bajkowski Link: https://github.com/openwrt/openwrt/pull/17583 Signed-off-by: Hauke Mehrtens (cherry picked from commit 1b045a7c13aeb141e0c069aaf5fc38989eee11cf) --- target/linux/lantiq/image/vr9.mk | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/linux/lantiq/image/vr9.mk b/target/linux/lantiq/image/vr9.mk index 48a372f4768a2b..05999e408dea8a 100644 --- a/target/linux/lantiq/image/vr9.mk +++ b/target/linux/lantiq/image/vr9.mk @@ -292,6 +292,11 @@ define Device/bt_homehub-v5a DEVICE_VENDOR := British Telecom (BT) DEVICE_MODEL := Home Hub 5 DEVICE_VARIANT := Type A + DEVICE_ALT0_VENDOR := British Telecom (BT) + DEVICE_ALT0_MODEL := Business Hub 5 + DEVICE_ALT0_VARIANT := Type A + DEVICE_ALT1_VENDOR := Plusnet + DEVICE_ALT1_MODEL := Hub One BOARD_NAME := BTHOMEHUBV5A DEVICE_PACKAGES := kmod-ath9k kmod-owl-loader \ kmod-ath10k-ct ath10k-firmware-qca988x-ct wpad-basic-mbedtls kmod-usb-dwc2 From 773bb31bab5f202e5d47f27e23fccbe0ff9bf012 Mon Sep 17 00:00:00 2001 From: Aleksander Jan Bajkowski Date: Sat, 11 Jan 2025 16:34:46 +0100 Subject: [PATCH 347/877] lantiq: xway_legacy: refresh config This was done by executing these command: $ make kernel_oldconfig CONFIG_TARGET=subtarget Signed-off-by: Aleksander Jan Bajkowski Link: https://github.com/openwrt/openwrt/pull/17581 Signed-off-by: Hauke Mehrtens (cherry picked from commit 524e22b4c71366be86493ca3ee7a16ff92d52288) --- target/linux/lantiq/xrx200_legacy/config-6.6 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/lantiq/xrx200_legacy/config-6.6 b/target/linux/lantiq/xrx200_legacy/config-6.6 index c8650c4e87f0e4..166a2cde067b65 100644 --- a/target/linux/lantiq/xrx200_legacy/config-6.6 +++ b/target/linux/lantiq/xrx200_legacy/config-6.6 @@ -7,7 +7,6 @@ CONFIG_CPU_MIPSR2_IRQ_VI=y CONFIG_CPU_RMAP=y CONFIG_CRC16=y CONFIG_CRYPTO_DEFLATE=y -CONFIG_CRYPTO_HASH_INFO=y CONFIG_CRYPTO_LZO=y CONFIG_CRYPTO_ZSTD=y CONFIG_EXTRA_FIRMWARE="lantiq/xrx200_phy11g_a14.bin lantiq/xrx200_phy11g_a22.bin lantiq/xrx200_phy22f_a14.bin lantiq/xrx200_phy22f_a22.bin" @@ -47,6 +46,7 @@ CONFIG_NET_SWITCHDEV=y CONFIG_NLS=y CONFIG_NR_CPUS=2 CONFIG_PADATA=y +CONFIG_PAHOLE_HAS_LANG_EXCLUDE=y CONFIG_PCI=y CONFIG_PCIEPORTBUS=y CONFIG_PCIE_LANTIQ=y From 3b4a84d05f2215b0cde7c434d45cfb7fb7206a2d Mon Sep 17 00:00:00 2001 From: Aleksander Jan Bajkowski Date: Sat, 11 Jan 2025 16:37:47 +0100 Subject: [PATCH 348/877] lantiq: xrx200_legacy: disable unused phy drivers Subtarget xrx200_legacy supports only a few devices. They all use the integrated Lantiq GSWIP switch and lantiq xway PHYs. The atheros and icplus PHYs can be safely disabled. Switches used by individual devices are listed below. Device Switch PHY Alpha ASL56026 Lantiq GSWIP int. switch Arcadyan VG3503J Lantiq GSWIP int. switch Netgear DM200 Lantiq GSWIP int. switch TP-LINK TD-W8970 Lantiq GSWIP Lantiq PEF7071V TP-Link TD-W8980 Lantiq GSWIP Lantiq PEF7071V Reduces uncompressed kernel size by 16 kB. Signed-off-by: Aleksander Jan Bajkowski Link: https://github.com/openwrt/openwrt/pull/17581 Signed-off-by: Hauke Mehrtens (cherry picked from commit 517b9c1cdcd357fd84c7f27bd2886f235f3ec946) --- target/linux/lantiq/xrx200_legacy/config-6.6 | 3 --- 1 file changed, 3 deletions(-) diff --git a/target/linux/lantiq/xrx200_legacy/config-6.6 b/target/linux/lantiq/xrx200_legacy/config-6.6 index 166a2cde067b65..9bb65cff07de51 100644 --- a/target/linux/lantiq/xrx200_legacy/config-6.6 +++ b/target/linux/lantiq/xrx200_legacy/config-6.6 @@ -1,4 +1,3 @@ -CONFIG_AT803X_PHY=y CONFIG_BLK_MQ_PCI=y CONFIG_CONTEXT_TRACKING=y CONFIG_CONTEXT_TRACKING_IDLE=y @@ -16,7 +15,6 @@ CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y CONFIG_GRO_CELLS=y CONFIG_HWMON=y CONFIG_HW_RANDOM=y -CONFIG_ICPLUS_PHY=y CONFIG_IFX_VPE_EXT=y CONFIG_INPUT=y CONFIG_INPUT_EVDEV=y @@ -57,7 +55,6 @@ CONFIG_PHY_LANTIQ_VRX200_PCIE=y CONFIG_POWER_RESET_GPIO=y CONFIG_POWER_SUPPLY=y CONFIG_POWER_SUPPLY_HWMON=y -CONFIG_QCOM_NET_PHYLIB=y CONFIG_QUEUED_RWLOCKS=y CONFIG_QUEUED_SPINLOCKS=y CONFIG_REGULATOR=y From 93bcec7b6c4a372b21790d21dfc29c562a25ff4f Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Sat, 4 Jan 2025 19:51:48 +0100 Subject: [PATCH 349/877] apm821xx: fixes WNDAP620 + WNDAP660 sysupgrade failures OpenWRT on the WNDAP6x0 refuses to sysupgrade to itself due to a compat_version imbalance. The Image is generated with version 2.0, but the uci-defaults says that it needs to be at 3.0 for the device. Fix this by downgrading WNDAP6x0 05_fix-compat-version's values back to 2.0 so it matches what we use. Fixes: 5815884c3a2a ("apm821xx: migrate to DSA") Signed-off-by: Christian Lamparter (cherry picked from commit e9415be4ad3cacbbd6e65fee5213baf3eaf9e07a) --- .../base-files/etc/uci-defaults/05_fix-compat-version | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/target/linux/apm821xx/base-files/etc/uci-defaults/05_fix-compat-version b/target/linux/apm821xx/base-files/etc/uci-defaults/05_fix-compat-version index 00d3954e5f481b..11af63c9e7ce28 100644 --- a/target/linux/apm821xx/base-files/etc/uci-defaults/05_fix-compat-version +++ b/target/linux/apm821xx/base-files/etc/uci-defaults/05_fix-compat-version @@ -2,12 +2,15 @@ case "$(board_name)" in meraki,mx60|\ -netgear,wndap620|\ -netgear,wndap660|\ netgear,wndr4700) uci set system.@system[0].compat_version="3.0" uci commit system ;; +netgear,wndap620|\ +netgear,wndap660) + uci set system.@system[0].compat_version="2.0" + uci commit system + ;; esac exit 0 From 6e06e1c0b1cb5ac08167773131901259b889e722 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Sun, 8 Dec 2024 04:08:38 +0100 Subject: [PATCH 350/877] ath79: teltonika-rut230: fix typo in "green:signal-strength4" LED It's missing a hyphen present in every other LED from the set. Set it to "green:signal-strength-4". Signed-off-by: Lech Perczak Link: https://github.com/openwrt/openwrt/pull/17503 Signed-off-by: Hauke Mehrtens (cherry picked from commit d04f41e092294789b5add6816bb3b3bd7570a30d) --- target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts b/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts index c2c54b466295cb..192a7d2a045b36 100644 --- a/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts +++ b/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts @@ -68,7 +68,7 @@ }; signal-strength-4 { - label = "green:signal-strength4"; + label = "green:signal-strength-4"; gpios = <&gpio 27 GPIO_ACTIVE_HIGH>; }; From 7d597f87096e05f8e53e7cd90cc6c2da6abdf72e Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Mon, 6 Jan 2025 17:31:44 +0100 Subject: [PATCH 351/877] ath79: teltonika-rut230: fix failsafe boot without SIM tray Due to "SIM present" input defaulting to "button" type, it is interpreted as such when booting, and causes the system to enter failsafe, if the tray is missing. Similarly to rfkill switch on TP-Link WDR4300 and Archer C7, make it EV_SW instead, to stop it from interfering with the boot process. Signed-off-by: Lech Perczak Link: https://github.com/openwrt/openwrt/pull/17503 Signed-off-by: Hauke Mehrtens (cherry picked from commit 7b9ca01109827368deb68b7d8217643b78b87cb9) --- target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts b/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts index 192a7d2a045b36..73a6cc52ca59cd 100644 --- a/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts +++ b/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts @@ -36,6 +36,7 @@ sim-tray { label = "sim-tray"; + linux,input-type = ; linux,code = ; gpios = <&gpio 20 GPIO_ACTIVE_LOW>; debounce-interval = <60>; From 767339066e9fc3a2232e9d2881469797cbf7ba8b Mon Sep 17 00:00:00 2001 From: Rany Hany Date: Sun, 12 Jan 2025 22:41:48 +0000 Subject: [PATCH 352/877] hostapd: backport upstream patch to fix setting BSS color MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without this patch, we get the following error: Mon Dec 23 11:35:44 2024 daemon.err hostapd: nl80211: kernel reports: integer out of range As updating hostapd would be too complex and requires further testing, we backport this simple upstream fix instead. Fixes: https://github.com/openwrt/openwrt/issues/16680 Signed-off-by: Rany Hany Link: https://github.com/openwrt/openwrt/pull/17590 Signed-off-by: Petr Štetiar (cherry picked from commit 5ce1af9539da667f62dc3cb426f9ec36e53fb54e) Link: https://github.com/openwrt/openwrt/pull/17591 Signed-off-by: Robert Marko --- package/network/services/hostapd/Makefile | 2 +- .../803-hostapd-fix-80211be-build.patch | 2 +- ...learing-up-settings-for-color-switch.patch | 28 +++++++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 package/network/services/hostapd/patches/804-hostapd-Fix-clearing-up-settings-for-color-switch.patch diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index 16dfbff2b06d5c..8753782012e5a3 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:=1 +PKG_RELEASE:=2 PKG_SOURCE_URL:=https://w1.fi/hostap.git PKG_SOURCE_PROTO:=git diff --git a/package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch b/package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch index cbd6298d9d36c5..f197b71bd7b934 100644 --- a/package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch +++ b/package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch @@ -25,7 +25,7 @@ + --- a/src/ap/sta_info.h +++ b/src/ap/sta_info.h -@@ -408,23 +408,8 @@ int ap_sta_re_add(struct hostapd_data *h +@@ -409,23 +409,8 @@ int ap_sta_re_add(struct hostapd_data *h void ap_free_sta_pasn(struct hostapd_data *hapd, struct sta_info *sta); diff --git a/package/network/services/hostapd/patches/804-hostapd-Fix-clearing-up-settings-for-color-switch.patch b/package/network/services/hostapd/patches/804-hostapd-Fix-clearing-up-settings-for-color-switch.patch new file mode 100644 index 00000000000000..87d68911c79d71 --- /dev/null +++ b/package/network/services/hostapd/patches/804-hostapd-Fix-clearing-up-settings-for-color-switch.patch @@ -0,0 +1,28 @@ +From 161327f91d956771996c96ea1b6e4e1cb8dc074c Mon Sep 17 00:00:00 2001 +From: Stone Zhang +Date: Mon, 14 Oct 2024 18:47:32 +0800 +Subject: [PATCH] hostapd: Fix clearing up settings for color switch + +Settings for color switch (struct cca_settings settings) +is used without zero clearing, which causes the member +settings->ubpr->unsol_bcast_probe_resp_intervalettings +to be a random value. It is againsts the NLA policy of +NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_INT and causes +BSS color switch failure. + +Fixes: 654d2395dddf ("BSS coloring: Handling of collision events and triggering CCA") +Signed-off-by: Stone Zhang +--- + src/ap/hostapd.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/src/ap/hostapd.c ++++ b/src/ap/hostapd.c +@@ -4813,6 +4813,7 @@ static void hostapd_switch_color_timeout + struct cca_settings settings; + int ret; + ++ os_memset(&settings, 0, sizeof(settings)); + hostapd_cleanup_cca_params(bss); + bss->cca_color = r; + bss->cca_count = 10; From 68bf4844a1cbc9f404f6e93b70a2657e74f1dce9 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Wed, 1 Jan 2025 20:05:20 +0100 Subject: [PATCH 353/877] realtek: debounce reset key for Zyxel GS1900 When the reset button is next to the SFP cages, I2C operations on the modules might cause interference on the button's GPIO line. Add a debounce-interval of 5 times the poll-interval to ensure the line is actually stable for some time and not just glitching. This squashes commit 4357f32d41eb ("realtek: debounce reset key for Zyxel GS1900") and commit 777c6106ed4e ("realtek: move debounce-interval to correct node"). Signed-off-by: Sander Vanheule --- target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi | 1 + target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi b/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi index b985c4bc8e499d..3889fe8859a7e3 100644 --- a/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi +++ b/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi @@ -26,6 +26,7 @@ label = "reset"; gpios = <&gpio1 3 GPIO_ACTIVE_LOW>; linux,code = ; + debounce-interval = <100>; }; }; diff --git a/target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts b/target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts index 9844dc2180ff36..a1e0a6d06d8233 100644 --- a/target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts +++ b/target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts @@ -43,10 +43,11 @@ compatible = "gpio-keys-polled"; poll-interval = <20>; - mode { + reset { label = "reset"; gpios = <&gpio1 3 GPIO_ACTIVE_LOW>; linux,code = ; + debounce-interval = <100>; }; }; From f719c8552723f0525ce76ba44a75e45ecbe2e7a9 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 14 Jan 2025 13:48:23 +0100 Subject: [PATCH 354/877] mt76: update to Git HEAD (2025-01-14) cf4e709e493a wifi: mt76: mt7996: fix crash in mt7996_set_radar_background 4c786fa52bb2 wifi: mt76: mt7915: fix register mapping 849923df3dde wifi: mt76: mt7996: fix register mapping 6be1dc9a1c79 wifi: mt76: mt7925: fix the unfinished command of regd_notifier before suspend d33ea3cab72b wifi: mt76: mt7925: fix CLC command timeout when suspend/resume 5aacd0d73c80 wifi: mt76: mt7925: add handler to hif suspend/resume event e86e97e45397 wifi: mt76: mt7925e: fix too long of wifi resume time e43df6bf4892 wifi: mt76: mt7996: fix thermal sparse warning 02f453d8dfc8 wifi: mt76: fix survey regression 7279e3f3c3e0 wifi: mt76: mt7925: fix unused-but-set warning 49c0bd66da3b wifi: mt76: mt7996: fix unused-but-set variable 2c068c96382e wifi: mt76: fix crash in mt76_switch_vif_chanctx 731070da2c2a wifi: mt76: mt7996: add max mpdu len capability 99d8ed164a96 wifi: mt76: mt7996: fix the capability of reception of EHT MU PPDU 32ee924831ba wifi: mt76: mt7996: fix HE Phy capability 9b588c7fb333 wifi: mt76: mt7996: fix incorrect indexing of MIB FW event 46798905cf5a wifi: mt76: connac: adjust phy capabilities based on band constraints 5c50f6f7dafe wifi: mt76: mt7996: fix definition of tx descriptor 9cdb62dc084f wifi: mt76: mt7996: fix ldpc setting 8c6cb2f97fe0 wifi: mt76: mt7996: fix beacon command during disabling 8e4f72b682e9 wifi: mt76: mt7996: add implicit beamforming support for mt7992 Signed-off-by: Felix Fietkau (cherry picked from commit 3963dab0302ae29cbf2acf28f26c1432e4ddf1a5) --- 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 7bc030a9df3ce2..cd168f49bcc0dd 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:=2025-01-04 -PKG_SOURCE_VERSION:=e354436db4402552bcb0cbe9abab2a46fb1ad31c -PKG_MIRROR_HASH:=7e3894e1f2641e172f87be1ae0cc6adda318d989350ebd53500a7df02f0afd8f +PKG_SOURCE_DATE:=2025-01-14 +PKG_SOURCE_VERSION:=8e4f72b682e9070108536507c5e2720b18c3816d +PKG_MIRROR_HASH:=fa8c5a2ece9e7287605910d9f906b601711c7863613addaadd666f9e3858a9e7 PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 From 06340650c5d056dd542b6c8cbcfa87cb4f9d9b27 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 4 Dec 2024 11:59:14 +0100 Subject: [PATCH 355/877] wifi-scripts: add option to set per-device ifname prefix Simplifies setting ifname to a different pattern for all affected interfaces. Signed-off-by: Felix Fietkau (cherry picked from commit a9ff3ba24b9466d9c06b9a9e1c2e9672bdd9f6f9) --- .../files/lib/netifd/wireless/mac80211.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh index 368885246a73b1..4bf452d2f6347c 100755 --- a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh +++ b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh @@ -29,6 +29,7 @@ drv_mac80211_init_device_config() { config_add_string path phy 'macaddr:macaddr' config_add_string tx_burst config_add_string distance + config_add_string ifname_prefix config_add_int radio beacon_int chanbw frag rts config_add_int rxantenna txantenna txpower min_tx_power config_add_int num_global_macaddr multiple_bssid @@ -660,9 +661,9 @@ mac80211_check_ap() { } mac80211_set_ifname() { - local phy="$1" - local prefix="$2" - eval "ifname=\"$phy-$prefix\${idx_$prefix:-0}\"; idx_$prefix=\$((\${idx_$prefix:-0 } + 1))" + local prefix="$1" + local type="$2" + eval "ifname=\"$prefix$type\${idx_$type:-0}\"; idx_$type=\$((\${idx_$type:-0 } + 1))" } mac80211_prepare_vif() { @@ -679,7 +680,7 @@ mac80211_prepare_vif() { monitor) prefix=mon;; esac - mac80211_set_ifname "$phy$vif_phy_suffix" "$prefix" + mac80211_set_ifname "$ifname_prefix" "$prefix" } append active_ifnames "$ifname" @@ -1116,7 +1117,8 @@ drv_mac80211_setup() { txpower \ rxantenna txantenna \ frag rts beacon_int:100 htmode \ - num_global_macaddr:1 multiple_bssid + num_global_macaddr:1 multiple_bssid \ + ifname_prefix json_get_values basic_rate_list basic_rate json_get_values scan_list scan_list json_select .. @@ -1135,6 +1137,8 @@ drv_mac80211_setup() { return 1 } + set_default ifname_prefix "$phy$vif_phy_suffix-" + local wdev local cwdev local found From e20047e5d4f369f1e25787d95996109b0f3933e4 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 9 Dec 2024 19:19:46 +0100 Subject: [PATCH 356/877] hostapd: fix processing mbssid config option Do not strip the first character from the field name Signed-off-by: Felix Fietkau (cherry picked from commit 59dd9cddf9e72d1f9b4ff7e01ae32d2fa99259d9) --- package/network/services/hostapd/files/hostapd.uc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package/network/services/hostapd/files/hostapd.uc b/package/network/services/hostapd/files/hostapd.uc index ee2411205984ad..771108ace8ca4e 100644 --- a/package/network/services/hostapd/files/hostapd.uc +++ b/package/network/services/hostapd/files/hostapd.uc @@ -747,9 +747,10 @@ function iface_load_config(phy, radio, filename) continue; } - if (val[0] == "#num_global_macaddr" || - val[0] == "mbssid") + if (val[0] == "#num_global_macaddr") config[substr(val[0], 1)] = int(val[1]); + else if (val[0] == "mbssid") + config[val[0]] = int(val[1]); push(config.radio.data, line); } From ea80aa938fc56a14b2fccecec41457aeee9e1647 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 9 Dec 2024 20:09:15 +0100 Subject: [PATCH 357/877] wifi-scripts: add macaddr_base wifi-device option This can be used to configure the base mac address from which all interface mac addresses are derived Signed-off-by: Felix Fietkau (cherry picked from commit 00860e485b2ef82c1fafc8e011f3a8965e317bca) --- .../files/lib/netifd/wireless/mac80211.sh | 9 ++++++--- .../wifi-scripts/files/usr/share/hostap/common.uc | 4 +++- package/network/services/hostapd/files/hostapd.uc | 3 +++ .../network/services/hostapd/files/wpa_supplicant.uc | 11 ++++++++--- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh index 4bf452d2f6347c..52c36a8c926835 100755 --- a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh +++ b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh @@ -30,6 +30,7 @@ drv_mac80211_init_device_config() { config_add_string tx_burst config_add_string distance config_add_string ifname_prefix + config_add_string macaddr_base config_add_int radio beacon_int chanbw frag rts config_add_int rxantenna txantenna txpower min_tx_power config_add_int num_global_macaddr multiple_bssid @@ -530,6 +531,7 @@ ${hostapd_noscan:+noscan=1} ${tx_burst:+tx_queue_data2_burst=$tx_burst} ${multiple_bssid:+mbssid=$multiple_bssid} #num_global_macaddr=$num_global_macaddr +#macaddr_base=$macaddr_base $base_cfg EOF @@ -577,7 +579,7 @@ mac80211_generate_mac() { local phy="$1" local id="${macidx:-0}" - wdev_tool "$phy$phy_suffix" get_macaddr id=$id num_global=$num_global_macaddr mbssid=${multiple_bssid:-0} + wdev_tool "$phy$phy_suffix" get_macaddr id=$id num_global=$num_global_macaddr mbssid=${multiple_bssid:-0} macaddr_base=${macaddr_base} } get_board_phy_name() ( @@ -945,6 +947,7 @@ wpa_supplicant_set_config() { json_add_string phy "$phy" json_add_int radio "$radio" json_add_int num_global_macaddr "$num_global_macaddr" + json_add_string macaddr_base "$macaddr_base" json_add_boolean defer 1 local data="$(json_dump)" @@ -991,7 +994,7 @@ wpa_supplicant_start() { [ -n "$wpa_supp_init" ] || return 0 - ubus_call wpa_supplicant config_set '{ "phy": "'"$phy"'", "radio": '"$radio"', "num_global_macaddr": '"$num_global_macaddr"' }' > /dev/null + ubus_call wpa_supplicant config_set '{ "phy": "'"$phy"'", "radio": '"$radio"', "num_global_macaddr": '"$num_global_macaddr"', "macaddr_base": "'"$macaddr_base"'" }' > /dev/null } mac80211_setup_supplicant() { @@ -1118,7 +1121,7 @@ drv_mac80211_setup() { rxantenna txantenna \ frag rts beacon_int:100 htmode \ num_global_macaddr:1 multiple_bssid \ - ifname_prefix + ifname_prefix macaddr_base json_get_values basic_rate_list basic_rate json_get_values scan_list scan_list json_select .. diff --git a/package/network/config/wifi-scripts/files/usr/share/hostap/common.uc b/package/network/config/wifi-scripts/files/usr/share/hostap/common.uc index c6bfb62ef3c5d0..fd28b664725dc2 100644 --- a/package/network/config/wifi-scripts/files/usr/share/hostap/common.uc +++ b/package/network/config/wifi-scripts/files/usr/share/hostap/common.uc @@ -213,7 +213,9 @@ const phy_proto = { if (!base_mask) return null; - if (base_mask == "00:00:00:00:00:00" && + if (data.macaddr_base) + base_addr = data.macaddr_base; + else if (base_mask == "00:00:00:00:00:00" && (radio_idx > 0 || idx >= num_global)) { let addrs = split(phy_sysfs_file(phy, "addresses"), "\n"); diff --git a/package/network/services/hostapd/files/hostapd.uc b/package/network/services/hostapd/files/hostapd.uc index 771108ace8ca4e..f4f479c0f672e8 100644 --- a/package/network/services/hostapd/files/hostapd.uc +++ b/package/network/services/hostapd/files/hostapd.uc @@ -279,6 +279,7 @@ function iface_macaddr_init(phydev, config, macaddr_list) { let macaddr_data = { num_global: config.num_global_macaddr ?? 1, + macaddr_base: config.macaddr_base, mbssid: config.mbssid ?? 0, }; @@ -749,6 +750,8 @@ function iface_load_config(phy, radio, filename) if (val[0] == "#num_global_macaddr") config[substr(val[0], 1)] = int(val[1]); + else if (val[0] == "#macaddr_base") + config[substr(val[0], 1)] = val[1]; else if (val[0] == "mbssid") config[val[0]] = int(val[1]); diff --git a/package/network/services/hostapd/files/wpa_supplicant.uc b/package/network/services/hostapd/files/wpa_supplicant.uc index fbea27628e341d..f288121e9d4b03 100644 --- a/package/network/services/hostapd/files/wpa_supplicant.uc +++ b/package/network/services/hostapd/files/wpa_supplicant.uc @@ -68,7 +68,7 @@ function prepare_config(config, radio) return { config }; } -function set_config(config_name, phy_name, radio, num_global_macaddr, config_list) +function set_config(config_name, phy_name, radio, num_global_macaddr, macaddr_base, config_list) { let phy = wpas.data.config[config_name]; @@ -83,6 +83,7 @@ function set_config(config_name, phy_name, radio, num_global_macaddr, config_lis phy.radio = radio; phy.num_global_macaddr = num_global_macaddr; + phy.macaddr_base = macaddr_base; let values = []; for (let config in config_list) @@ -106,7 +107,10 @@ function start_pending(phy_name) } let macaddr_list = wpas.data.macaddr_list[phy_name]; - phydev.macaddr_init(macaddr_list, { num_global: phy.num_global_macaddr }); + phydev.macaddr_init(macaddr_list, { + num_global: phy.num_global_macaddr, + macaddr_base: phy.macaddr_base, + }); for (let ifname in phy.data) iface_start(phydev, phy.data[ifname]); @@ -210,6 +214,7 @@ let main_obj = { phy: "", radio: 0, num_global_macaddr: 0, + macaddr_base: "", config: [], defer: true, }, @@ -221,7 +226,7 @@ let main_obj = { wpas.printf(`Set new config for phy ${phy}`); try { if (req.args.config) - set_config(phy, req.args.phy, req.args.radio, req.args.num_global_macaddr, req.args.config); + set_config(phy, req.args.phy, req.args.radio, req.args.num_global_macaddr, req.args.macaddr_base, req.args.config); if (!req.args.defer) start_pending(phy); From 3d99cdd3773fa295e61bf50f181359f5a4ebfeff Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 19 Nov 2024 14:08:38 +0100 Subject: [PATCH 358/877] wifi-scripts: remove leftover legacy (non-netifd) wifi script support cfg80211 is the only supported wireless API Signed-off-by: Felix Fietkau (cherry picked from commit d1275392916522d664e710752c517246540cbf73) --- .../config/wifi-scripts/files/sbin/wifi | 180 ------------------ 1 file changed, 180 deletions(-) diff --git a/package/network/config/wifi-scripts/files/sbin/wifi b/package/network/config/wifi-scripts/files/sbin/wifi index f937dba7e6d92d..c70723560b767d 100755 --- a/package/network/config/wifi-scripts/files/sbin/wifi +++ b/package/network/config/wifi-scripts/files/sbin/wifi @@ -37,135 +37,22 @@ wifi_isup() { return 0 } -find_net_config() {( - local vif="$1" - local cfg - local ifname - - config_get cfg "$vif" network - - [ -z "$cfg" ] && { - include /lib/network - scan_interfaces - - config_get ifname "$vif" ifname - - cfg="$(find_config "$ifname")" - } - [ -z "$cfg" ] && return 0 - echo "$cfg" -)} - - -bridge_interface() {( - local cfg="$1" - [ -z "$cfg" ] && return 0 - - include /lib/network - scan_interfaces - - for cfg in $cfg; do - config_get iftype "$cfg" type - [ "$iftype" = bridge ] && config_get "$cfg" ifname - prepare_interface_bridge "$cfg" - return $? - done -)} - -prepare_key_wep() { - local key="$1" - local hex=1 - - echo -n "$key" | grep -qE "[^a-fA-F0-9]" && hex=0 - [ "${#key}" -eq 10 -a $hex -eq 1 ] || \ - [ "${#key}" -eq 26 -a $hex -eq 1 ] || { - [ "${key:0:2}" = "s:" ] && key="${key#s:}" - key="$(echo -n "$key" | hexdump -ve '1/1 "%02x" ""')" - } - echo "$key" -} - -wifi_fixup_hwmode() { - local device="$1" - local default="$2" - local hwmode hwmode_11n - - config_get channel "$device" channel - config_get hwmode "$device" hwmode - case "$hwmode" in - 11bg) hwmode=bg;; - 11a) hwmode=a;; - 11ad) hwmode=ad;; - 11b) hwmode=b;; - 11g) hwmode=g;; - 11n*) - hwmode_11n="${hwmode##11n}" - case "$hwmode_11n" in - a|g) ;; - default) hwmode_11n="$default" - esac - config_set "$device" hwmode_11n "$hwmode_11n" - ;; - *) - hwmode= - if [ "${channel:-0}" -gt 0 ]; then - if [ "${channel:-0}" -gt 14 ]; then - hwmode=a - else - hwmode=g - fi - else - hwmode="$default" - fi - ;; - esac - config_set "$device" hwmode "$hwmode" -} - -_wifi_updown() { - for device in ${2:-$DEVICES}; do ( - config_get disabled "$device" disabled - [ "$disabled" = "1" ] && { - echo "'$device' is disabled" - set disable - } - config_get iftype "$device" type - if eval "type ${1}_$iftype" 2>/dev/null >/dev/null; then - eval "scan_$iftype '$device'" - eval "${1}_$iftype '$device'" || echo "$device($iftype): ${1} failed" - elif [ ! -f /lib/netifd/wireless/$iftype.sh ]; then - echo "$device($iftype): Interface type not supported" - fi - ); done -} - wifi_updown() { cmd=down [ enable = "$1" ] && { - _wifi_updown disable "$2" ubus_wifi_cmd "$cmd" "$2" ubus call network reload - scan_wifi cmd=up } [ reconf = "$1" ] && { ubus call network reload - scan_wifi cmd=reconf } ubus_wifi_cmd "$cmd" "$2" - _wifi_updown "$@" -} - -wifi_reload_legacy() { - _wifi_updown "disable" "$1" - scan_wifi - _wifi_updown "enable" "$1" } wifi_reload() { ubus call network reload - wifi_reload_legacy } wifi_detect_notice() { @@ -189,75 +76,9 @@ wifi_config() { ); done } -start_net() {( - local iface="$1" - local config="$2" - local vifmac="$3" - - [ -f "/var/run/$iface.pid" ] && kill "$(cat /var/run/${iface}.pid)" 2>/dev/null - [ -z "$config" ] || { - include /lib/network - scan_interfaces - for config in $config; do - setup_interface "$iface" "$config" "" "$vifmac" - done - } -)} - -set_wifi_up() { - local cfg="$1" - local ifname="$2" - uci_set_state wireless "$cfg" up 1 - uci_set_state wireless "$cfg" ifname "$ifname" -} - -set_wifi_down() { - local cfg="$1" - local vifs vif vifstr - - [ -f "/var/run/wifi-${cfg}.pid" ] && - kill "$(cat "/var/run/wifi-${cfg}.pid")" 2>/dev/null - uci_revert_state wireless "$cfg" - config_get vifs "$cfg" vifs - for vif in $vifs; do - uci_revert_state wireless "$vif" - done -} - -scan_wifi() { - local cfgfile="$1" - DEVICES= - config_cb() { - local type="$1" - local section="$2" - - # section start - case "$type" in - wifi-device) - append DEVICES "$section" - config_set "$section" vifs "" - config_set "$section" ht_capab "" - ;; - esac - - # section end - config_get TYPE "$CONFIG_SECTION" TYPE - case "$TYPE" in - wifi-iface) - config_get device "$CONFIG_SECTION" device - config_get vifs "$device" vifs - append vifs "$CONFIG_SECTION" - config_set "$device" vifs "$vifs" - ;; - esac - } - config_load "${cfgfile:-wireless}" -} - DEVICES= DRIVERS= include /lib/wifi -scan_wifi case "$1" in down) wifi_updown "disable" "$2";; @@ -266,7 +87,6 @@ case "$1" in status) ubus_wifi_cmd "status" "$2";; isup) wifi_isup "$2"; exit $?;; reload) wifi_reload "$2";; - reload_legacy) wifi_reload_legacy "$2";; --help|help) usage;; reconf) wifi_updown "reconf" "$2";; ''|up) wifi_updown "enable" "$2";; From 93cdb10411bb6aca61f78506bd90e93c16b85064 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Tue, 7 Jan 2025 11:43:36 +0100 Subject: [PATCH 359/877] wifi-scripts: allow per-IF mesh basic rate selection Bringing up a mesh interface using wpa_supplicant already supports a per-VIF basic rate selection. Add the same ability when creating a mesh VIF without wpa_supplicant. Signed-off-by: David Bauer (cherry picked from commit 3deeb7805f69f54b9ab20c0e12f8dd916fec4de1) --- .../wifi-scripts/files/lib/netifd/wireless/mac80211.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh index 52c36a8c926835..b4aa19bf526ec2 100755 --- a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh +++ b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh @@ -844,13 +844,19 @@ mac80211_setup_adhoc() { mac80211_setup_mesh() { json_get_vars ssid mesh_id mcast_rate + json_get_values iface_basic_rate_list basic_rate mcval= [ -n "$mcast_rate" ] && wpa_supplicant_add_rate mcval "$mcast_rate" [ -n "$mesh_id" ] && ssid="$mesh_id" + br_list="$basic_rate_list" + if [ -n "$iface_basic_rate_list" ]; then + br_list="$iface_basic_rate_list" + fi + brstr= - for br in $basic_rate_list; do + for br in $br_list; do wpa_supplicant_add_rate brstr "$br" done From e7cd87e72dae24d473b16b0748e83ebbd4ae76e6 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 15 Jan 2025 21:46:53 +0100 Subject: [PATCH 360/877] netifd: fix napi process name matching in packet steering script Fixes CPU usage imbalance on some devices using threaded NAPI Signed-off-by: Felix Fietkau (cherry picked from commit 67a4aeef6c63e5836bd6b82faf6cc15934869efb) --- .../config/netifd/files/usr/libexec/network/packet-steering.uc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/network/config/netifd/files/usr/libexec/network/packet-steering.uc b/package/network/config/netifd/files/usr/libexec/network/packet-steering.uc index a578e288791d7d..b2229e5d793b41 100755 --- a/package/network/config/netifd/files/usr/libexec/network/packet-steering.uc +++ b/package/network/config/netifd/files/usr/libexec/network/packet-steering.uc @@ -87,7 +87,7 @@ function set_netdev_cpu(dev, cpu) { function task_device_match(name, device) { - let napi_match = match(name, /napi\/([^-+])-\d+/); + let napi_match = match(name, /napi\/([^-]*)-\d+/); if (!napi_match) napi_match = match(name, /mt76-tx (phy\d+)/); if (napi_match && From 7555fb02ecfd341376db0adfedd2fded3450d7c8 Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Thu, 22 Jun 2023 23:36:28 +0000 Subject: [PATCH 361/877] armsr: change image names to 'combined-efi' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit luci-app-attendedsysupgrade expects images to be named 'combined-efi' when the system is using EFI images. This came about as x86 has 'combined' images for legacy (BIOS) boot and 'combined-efi' for EFI systems. armsr images were originally named 'combined' only as there was no 'legacy' image type. To avoid special handling in the attendedsysupgrade code, name EFI images consistent with other targets. Signed-off-by: Mathew McBride Link: https://github.com/openwrt/luci/pull/6430 Link: https://github.com/openwrt/openwrt/pull/12963 Signed-off-by: Petr Štetiar (cherry picked from commit c9ebd4fb30773ca55cc2da6b2c1962046a2e0fff) --- target/linux/armsr/README | 4 ++-- target/linux/armsr/image/Makefile | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/target/linux/armsr/README b/target/linux/armsr/README index b4b9012826a2ca..04f01f8e305228 100644 --- a/target/linux/armsr/README +++ b/target/linux/armsr/README @@ -49,7 +49,7 @@ With a EDKII or U-Boot binary for the QEMU ARM virtual machines, you can use the images in EFI mode: 32-bit: -gunzip -c bin/targets/armsr/armv7/openwrt-armsr-armv7-generic-ext4-combined.img.gz > openwrt-arm-32.img +gunzip -c bin/targets/armsr/armv7/openwrt-armsr-armv7-generic-ext4-combined-efi.img.gz > openwrt-arm-32.img qemu-system-arm -nographic \ -cpu cortex-a15 -machine virt \ -bios bin/targets/armsr/armv7/u-boot-qemu_armv7/u-boot.bin \ @@ -60,7 +60,7 @@ qemu-system-arm -nographic \ -netdev user,id=testwan -net nic,netdev=testwan 64-bit: -gunzip -c bin/targets/armsr/armv8/openwrt-armsr-armv8-generic-ext4-combined.img.gz > openwrt-arm-64.img +gunzip -c bin/targets/armsr/armv8/openwrt-armsr-armv8-generic-ext4-combined-efi.img.gz > openwrt-arm-64.img qemu-system-aarch64 -nographic \ -cpu cortex-a53 -machine virt \ -bios bin/targets/armsr/armv8/u-boot-qemu_armv8/u-boot.bin \ diff --git a/target/linux/armsr/image/Makefile b/target/linux/armsr/image/Makefile index 09c37beeec43ec..b34c1f16e79844 100644 --- a/target/linux/armsr/image/Makefile +++ b/target/linux/armsr/image/Makefile @@ -74,18 +74,18 @@ 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 - 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 + IMAGE/combined-efi.img := grub-config efi | combined efi | grub-install efi | append-metadata + IMAGE/combined-efi.img.gz := grub-config efi | combined efi | grub-install efi | gzip | append-metadata + IMAGE/combined-efi.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 + IMAGES-y += combined-efi.img.gz else IMAGES-y := rootfs.img - IMAGES-y += combined.img + IMAGES-y += combined-efi.img endif ifeq ($(CONFIG_VMDK_IMAGES),y) - IMAGES-y += combined.vmdk + IMAGES-y += combined-efi.vmdk endif KERNEL := kernel-bin KERNEL_INSTALL := 1 From 6acf90758db5c7d3a6451c06192f7345acc30995 Mon Sep 17 00:00:00 2001 From: Robert Senderek Date: Fri, 22 Nov 2024 00:05:39 +0100 Subject: [PATCH 362/877] mvebu: Add support for WD Cloud Mirror Gen2 Hardware -------- Marvell Armada 385 (MV88F6820) 512B RAM 256MB NAND (Hynix H27U2G8F2CTR) 1x 1Gbit 2x USB 3.0 2x SATA-III UART: 115200 8N1 3.3V RTC Weltrend MCU WT6703F connected via UART1 for Power LED / PWM Fan / hw reset / WoL Installation ------------ Connect UART 3.3V adapter to JP2 pins: 1-RX / 2-GND / 5-TX Use USB2.0 FAT32 pendrive with openwrt-mvebu-cortexa9-wd_cloud-mirror-gen2-initramfs-kernel.bin 1. stop boot by pressing 1 2. usb start 3. fatload usb 0:1 0x02000000 openwrt-mvebu-cortexa9-wd_cloud-mirror-gen2-initramfs-kernel.bin;bootm 0x02000000 - 4. do backup mtd1 mtd3 5. use sysupgrade Or tftp 1. stop boot by pressing 1 2. setenv ethact egiga2;setenv serverip 192.168.11.114;setenv ipaddr 192.168.11.113 3. tftpboot 0x02000000 openwrt-mvebu-cortexa9-wd_cloud-mirror-gen2-initramfs-kernel.bin; bootm 0x02000000 - 4. do backup mtd1 mtd3 5. use sysupgrade or Evgeny Kolesnikov method from his failed PR 2040 - Using original firmware's network settings obtain SSH access to the device. - Put *-image-cfs-factory.bin and *-uImage-factory.bin images into device's /tmp directory. - Write kernel (uImage) image 'flash_eraseall /dev/mtd1 && nandwrite --markbad -p /dev/mtd1 /tmp/*-uImage-factory.bin'. - Write rootfs (image-cfs) image 'ubiformat /dev/mtd3 -f /tmp/*-image.cfs-factory.bin -y'. - Reboot the device. Installation (upgrade): Use *-sysupgrade.bin in a usual way. Weltrend MCU control is done via uart1 19200 stty -F /dev/ttyS1 raw speed 19200 stty -F /dev/ttyS1 raw speed 19200 PWM Fan Control off: 00 echo -n -e '\xfa\x02\x00\x00\x00\x00\xfb' > /dev/ttyS1 slow: 5F echo -n -e '\xfa\x02\x00\x5f\x00\x00\xfb' > /dev/ttyS1 max: FF echo -n -e '\xfa\x02\x00\xff\x00\x00\xfb' > /dev/ttyS1 Power LED Control Blue echo -n -e '\xfa\x26\x00\x11\x00\x01\xfb' > /dev/ttyS1 Red echo -n -e '\xfa\x26\x00\x14\x00\x01\xfb' > /dev/ttyS1 Orange echo -n -e '\xfa\x26\x00\x12\x00\x01\xfb' > /dev/ttyS1 more here: https://github.com/c-MM/mcm-daemon/blob/master/mcm.h Signed-off-by: Robert Senderek Link: https://github.com/openwrt/openwrt/pull/17046 (cherry picked from commit 8fb805aa1f25b69b7849c8b1ce787ed47b16d123) Link: https://github.com/openwrt/openwrt/pull/17589 Signed-off-by: Hauke Mehrtens --- .../base-files/etc/board.d/02_network | 9 +- .../base-files/lib/upgrade/platform.sh | 3 +- .../armada-385-wd_cloud-mirror-gen2.dts | 368 ++++++++++++++++++ target/linux/mvebu/image/cortexa9.mk | 17 + 4 files changed, 395 insertions(+), 2 deletions(-) create mode 100644 target/linux/mvebu/files-6.6/arch/arm/boot/dts/marvell/armada-385-wd_cloud-mirror-gen2.dts diff --git a/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network b/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network index 680af1ce673730..8cf1c0e4261c6a 100644 --- a/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network +++ b/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network @@ -13,7 +13,8 @@ mvebu_setup_interfaces() case "$board" in ctera,c200-v2|\ - synology,ds213j) + synology,ds213j|\ + wd,cloud-mirror-gen2) ucidef_set_interface_lan "eth0" "dhcp" ;; cznic,turris-omnia) @@ -94,6 +95,12 @@ mvebu_setup_macs() lan_mac=$label_mac wan_mac=$label_mac ;; + wd,cloud-mirror-gen2) + # mac address is on ubi "config" or ubi "reserve2" in text file. + # ubi "reserve2" /dev/mtd7 is twice small and only contains basic OEM factory info + label_mac=$(macaddr_canonicalize $(strings /dev/mtd7|grep -E '([0-9A-F]{2}[:])')) + lan_mac=$label_mac + ;; esac [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac diff --git a/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh b/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh index 70678622d34a28..13d8e77c93cc6a 100755 --- a/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh +++ b/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh @@ -31,7 +31,8 @@ platform_do_upgrade() { CI_ROOT_UBIPART=ubi nand_do_upgrade "$1" ;; - buffalo,ls421de) + buffalo,ls421de|\ + wd,cloud-mirror-gen2) nand_do_upgrade "$1" ;; ctera,c200-v2) diff --git a/target/linux/mvebu/files-6.6/arch/arm/boot/dts/marvell/armada-385-wd_cloud-mirror-gen2.dts b/target/linux/mvebu/files-6.6/arch/arm/boot/dts/marvell/armada-385-wd_cloud-mirror-gen2.dts new file mode 100644 index 00000000000000..50936e72adfa2f --- /dev/null +++ b/target/linux/mvebu/files-6.6/arch/arm/boot/dts/marvell/armada-385-wd_cloud-mirror-gen2.dts @@ -0,0 +1,368 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Device Tree file for Western Digital My Cloud Mirror Gen 2 + * (BWVZ/Grand Teton) + * + * Copyright (C) 2020 + * + * Based on the code from: + * + * Copyright (C) 2019 Evgeny Kolesnikov + * Copyright (C) 2016 Martin Mueller + * Copyright (C) 2013 Gregory CLEMENT + * Copyright (C) 2014 Thomas Petazzoni + * + */ + +/dts-v1/; +#include +#include +#include +#include "armada-385.dtsi" + +/ { + model = "WD MyCloud Mirror Gen 2 (BWVZ/Grand Teton)"; + compatible = "wd,cloud-mirror-gen2", "marvell,armada385", "marvell,armada380"; + + aliases { + led-boot = &led_boot; + led-failsafe = &led_boot; + led-upgrade = &led_boot; + }; + + chosen { + stdout-path = "serial0:115200n8"; + append-rootblock = "nullparameter="; /* override the bootloader args */ + }; + + memory { + device_type = "memory"; + reg = <0x00000000 0x20000000>; /* 512 MB */ + }; + + soc { + ranges = ; + + internal-regs { + timer@c200 { + status = "okay"; + }; + + i2c0: i2c@11000 { + status = "okay"; + clock-frequency = <100000>; + }; + + i2c1: i2c@11100 { + status = "okay"; + clock-frequency = <100000>; + }; + + serial@12000 { + status = "okay"; + }; + + /* Connected to Welltrend 6703F-OG240WT MCU + * which controls power, fan and other things + */ + serial@12100 { + status = "okay"; + }; + + pinctrl@18000 { + /* use only one pin for UART1, as mpp20 is used by sata0 */ + uart1_pins: uart-pins-1 { + marvell,pins = "mpp19"; + marvell,function = "ua1"; + }; + + xhci0_vbus_pins: xhci0-vbus-pins { + marvell,pins = "mpp26"; + marvell,function = "gpio"; + }; + + xhci1_vbus_pins: xhci1-vbus-pins { + marvell,pins = "mpp27"; + marvell,function = "gpio"; + }; + + sata0_pins: sata-pins-0 { + marvell,pins = "mpp55"; + marvell,function = "sata0"; + }; + + sata1_pins: sata-pins-1 { + marvell,pins = "mpp56"; + marvell,function = "sata1"; + }; + + sata_leds: sata-leds { + marvell,pins = "mpp43", "mpp52", "mpp53", "mpp54"; + marvell,function = "gpio"; + }; + + btn_pins: btn-pins { + marvell,pins = "mpp50"; + marvell,function = "gpio"; + }; + }; + + usb@58000 { + status = "okay"; + }; + + phy: mdio@72004 { + phy0: ethernet-phy@0 { + /* Init ETH LEDs */ + marvell,reg-init = <3 16 0 0x101e>; + reg = <0>; + }; + }; + + sata@a8000 { + status = "okay"; + }; + + nand-controller@d0000 { + status = "okay"; + + nand: nand@0 { + reg = <0>; + label = "pxa3xx_nand-0"; + nand-rb = <0>; + marvell,nand-keep-config; + #marvell,nand-enable-arbiter; //optional + nand-on-flash-bbt; + nand-ecc-strength = <4>; + nand-ecc-step-size = <512>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@00000000 { + label = "U-Boot"; + reg = <0x00000000 0x00500000>; /* 5 MB */ + read-only; + }; + + partition@00500000 { + label = "kernel"; + reg = <0x00500000 0x00500000>; /* 5 MB */ + }; + + partition@00a00000 { + label = "uRamdisk"; + reg = <0x00a00000 0x00500000>; /* 5 MB */ + read-only; + }; + + partition@00f00000 { + label = "ubi"; + reg = <0x00f00000 0x0b900000>; /* 185 MB */ + }; + + partition@c800000 { + label = "rescue fw"; + reg = <0x0c800000 0x00f00000>; /* 15 MB */ + read-only; + }; + + partition@d70000 { + label = "config"; + reg = <0x0d700000 0x01400000>; /* 20 MB */ + read-only; + }; + + partition@eb00000 { + label = "reserve1"; + reg = <0x0eb00000 0x00a00000>; /* 10 MB */ + read-only; + }; + + partition@f500000 { + label = "reserve2"; + reg = <0x0f500000 0x00a00000>; /* 10 MB */ + read-only; + }; + }; + }; + }; + + usb3@f0000 { + usb-phy = <&usb3_0_phy>; + status = "okay"; + }; + + usb3@f8000 { + usb-phy = <&usb3_1_phy>; + status = "okay"; + }; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&sata_leds>; + + led_boot: s1red { + label = "red:hdd1"; + gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>; + }; + s2red { + label = "red:hdd2"; + gpios = <&gpio1 20 GPIO_ACTIVE_HIGH>; + }; + s1blue { + label = "blue:hdd1"; + gpios = <&gpio1 21 GPIO_ACTIVE_LOW>; + linux,default-trigger = "ata1"; + }; + s2blue { + label = "blue:hdd2"; + gpios = <&gpio1 22 GPIO_ACTIVE_LOW>; + linux,default-trigger = "ata2"; + }; + }; + + gpio-keys { + compatible = "gpio-keys"; + pinctrl-names = "default"; + pinctrl-0 = <&btn_pins>; + + reset { + label = "reset"; + linux,code = ; // Restart=0x198, Power=0x116 + gpios = <&gpio1 18 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + wakeup-source; + }; + }; + + usb3_0_phy: usb3_0_phy { + compatible = "usb-nop-xceiv"; + vcc-supply = <®_usb3_0_vbus>; + }; + + usb3_1_phy: usb3_1_phy { + compatible = "usb-nop-xceiv"; + vcc-supply = <®_usb3_1_vbus>; + }; + + reg_usb3_0_vbus: usb3-vbus0 { + compatible = "regulator-fixed"; + regulator-name = "usb3-vbus0"; + pinctrl-names = "default"; + pinctrl-0 = <&xhci0_vbus_pins>; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + enable-active-high; + regulator-always-on; + gpio = <&gpio0 26 GPIO_ACTIVE_HIGH>; + }; + + reg_usb3_1_vbus: usb3-vbus1 { + compatible = "regulator-fixed"; + regulator-name = "usb3-vbus1"; + pinctrl-names = "default"; + pinctrl-0 = <&xhci1_vbus_pins>; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + enable-active-high; + regulator-always-on; + gpio = <&gpio0 27 GPIO_ACTIVE_HIGH>; + }; + + reg_sata0: pwr-sata0 { + compatible = "regulator-fixed"; + regulator-name = "pwr_en_sata0"; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + enable-active-high; + regulator-boot-on; + gpio = <&gpio1 23 GPIO_ACTIVE_HIGH>; + }; + + reg_5v_sata0: v5-sata0 { + compatible = "regulator-fixed"; + regulator-name = "v5.0-sata0"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <®_sata0>; + }; + + reg_12v_sata0: v12-sata0 { + compatible = "regulator-fixed"; + regulator-name = "v12.0-sata0"; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + vin-supply = <®_sata0>; + }; + + reg_sata1: pwr-sata1 { + compatible = "regulator-fixed"; + regulator-name = "pwr_en_sata1"; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + enable-active-high; + regulator-boot-on; + gpio = <&gpio1 24 GPIO_ACTIVE_HIGH>; + }; + + reg_5v_sata1: v5-sata1 { + compatible = "regulator-fixed"; + regulator-name = "v5.0-sata1"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <®_sata1>; + }; + + reg_12v_sata1: v12-sata1 { + compatible = "regulator-fixed"; + regulator-name = "v12.0-sata1"; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + vin-supply = <®_sata1>; + }; +}; + +&bm { + status = "okay"; +}; + +&bm_bppi { + status = "okay"; +}; + +ð2 { + status = "okay"; + phy = <&phy0>; + phy-mode = "sgmii"; + buffer-manager = <&bm>; + bm,pool-long = <0>; + bm,pool-short = <1>; +}; + +&ahci0 { + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + + sata-port@0 { + reg = <0>; + target-supply = <®_sata0>; + #thermal-sensor-cells = <0>; + }; + + sata-port@1 { + reg = <1>; + target-supply = <®_sata1>; + #thermal-sensor-cells = <1>; + }; +}; diff --git a/target/linux/mvebu/image/cortexa9.mk b/target/linux/mvebu/image/cortexa9.mk index 4a41f2c1029c33..d572264866b72e 100644 --- a/target/linux/mvebu/image/cortexa9.mk +++ b/target/linux/mvebu/image/cortexa9.mk @@ -448,3 +448,20 @@ define Device/synology_ds213j -ppp -kmod-nft-offload -dnsmasq -odhcpd-ipv6only endef TARGET_DEVICES += synology_ds213j + +define Device/wd_cloud-mirror-gen2 + $(Device/NAND-128K) + DEVICE_VENDOR := Western Digital + DEVICE_MODEL := MyCloud Mirror Gen 2 (BWVZ/Grand Teton) + DEVICE_PACKAGES += -uboot-envtools coreutils-stty mkf2fs e2fsprogs \ + partx-utils kmod-hwmon-drivetemp -ppp -kmod-nft-offload -dnsmasq \ + -odhcpd-ipv6only + DEVICE_DTS := armada-385-wd_cloud-mirror-gen2 + KERNEL_SIZE := 5120k + KERNEL := kernel-bin | append-dtb | uImage none + KERNEL_INITRAMFS := kernel-bin | append-dtb | uImage none + IMAGES += image-cfs-factory.bin uImage-factory.bin + IMAGE/image-cfs-factory.bin := append-ubi + IMAGE/uImage-factory.bin := append-kernel +endef +TARGET_DEVICES += wd_cloud-mirror-gen2 From 99a855121c74974123558fd0ebad7888242c88af Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Mon, 13 Jan 2025 23:56:09 +0100 Subject: [PATCH 363/877] mvebu: WD Cloud Mirror Gen2: Remove stty dependency The package coreutils-stty is not part of the OpenWrt main packages. A board can not depend on it. Remove the dependency to fix a build problem seen in the build bots. Fixes: 8fb805aa1f25 ("mvebu: Add support for WD Cloud Mirror Gen2") (cherry picked from commit 717f62d256ccb52549a24c256615b28440ed1a86) Link: https://github.com/openwrt/openwrt/pull/17589 Signed-off-by: Hauke Mehrtens --- target/linux/mvebu/image/cortexa9.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/mvebu/image/cortexa9.mk b/target/linux/mvebu/image/cortexa9.mk index d572264866b72e..b5f89aec20c977 100644 --- a/target/linux/mvebu/image/cortexa9.mk +++ b/target/linux/mvebu/image/cortexa9.mk @@ -453,7 +453,7 @@ define Device/wd_cloud-mirror-gen2 $(Device/NAND-128K) DEVICE_VENDOR := Western Digital DEVICE_MODEL := MyCloud Mirror Gen 2 (BWVZ/Grand Teton) - DEVICE_PACKAGES += -uboot-envtools coreutils-stty mkf2fs e2fsprogs \ + DEVICE_PACKAGES += -uboot-envtools mkf2fs e2fsprogs \ partx-utils kmod-hwmon-drivetemp -ppp -kmod-nft-offload -dnsmasq \ -odhcpd-ipv6only DEVICE_DTS := armada-385-wd_cloud-mirror-gen2 From 27520027e10e9d247e822e5c52a8bb294267ecd9 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 16 Jan 2025 12:35:47 +0100 Subject: [PATCH 364/877] netifd: improve packet steering on ipq40xx (and possibly others) Some platforms a single ethernet device for all ports with multiple rx rings and NAPI threading enabled. In this case, the steering script was limiting performance by keeping all NAPI threads assigned to the same CPU. Fix this by assigning each rx queue and the corresponding NAPI task separately. Additionally, if the number of rx queues is at least as big as the number of CPUs, skip weight based assignment and distribute the load across all CPUs directly. Fixes: https://github.com/openwrt/openwrt/issues/17611 Signed-off-by: Felix Fietkau (cherry picked from commit acce25b789d40f2d88a2326a7d9921bd1743fe54) --- .../usr/libexec/network/packet-steering.uc | 51 +++++++++++++++++-- 1 file changed, 47 insertions(+), 4 deletions(-) diff --git a/package/network/config/netifd/files/usr/libexec/network/packet-steering.uc b/package/network/config/netifd/files/usr/libexec/network/packet-steering.uc index b2229e5d793b41..34df46d18ef5d8 100755 --- a/package/network/config/netifd/files/usr/libexec/network/packet-steering.uc +++ b/package/network/config/netifd/files/usr/libexec/network/packet-steering.uc @@ -65,8 +65,9 @@ function cpu_mask(cpu) return sprintf("%x", mask); } -function set_netdev_cpu(dev, cpu) { - let queues = glob(`/sys/class/net/${dev}/queues/rx-*/rps_cpus`); +function set_netdev_cpu(dev, cpu, rx_queue) { + rx_queue ??= "rx-*"; + let queues = glob(`/sys/class/net/${dev}/queues/${rx_queue}/rps_cpus`); let val = cpu_mask(cpu); if (disable) val = 0; @@ -76,7 +77,7 @@ function set_netdev_cpu(dev, cpu) { if (!do_nothing) writefile(queue, `${val}`); } - queues = glob(`/sys/class/net/${dev}/queues/rx-*/rps_flow_cnt`); + queues = glob(`/sys/class/net/${dev}/queues/${rx_queue}/rps_flow_cnt`); for (let queue in queues) { if (debug || do_nothing) warn(`echo ${local_flows} > ${queue}\n`); @@ -160,6 +161,9 @@ for (let dev in netdevs) { netdev: [], phy: [], tasks: [], + rx_tasks: [], + rx_queues: map(glob(`/sys/class/net/${dev}/queues/rx-*/rps_cpus`), + (v) => basename(dirname(v))), }; } @@ -187,11 +191,51 @@ for (let path in glob("/proc/*/exe")) { continue; push(dev.tasks, pid); + + let napi_match = match(name, /napi\/([^-]*)-(\d+)/); + if (napi_match && napi_match[2] > 0) + push(dev.rx_tasks, pid); break; } } +function assign_dev_queues_cpu(dev) { + let num = length(dev.rx_queues); + if (num < length(dev.rx_tasks)) + num = length(dev.rx_tasks); + + for (let i = 0; i < num; i++) { + let cpu; + + let task = dev.rx_tasks[i]; + if (num >= length(cpus)) + cpu = i % length(cpus); + else if (task) + cpu = get_next_cpu(napi_weight); + else + cpu = -1; + set_task_cpu(task, cpu); + + let rxq = dev.rx_queues[i]; + if (!rxq) + continue; + + if (num >= length(cpus)) + cpu = (i + 1) % length(cpus); + else if (all_cpus) + cpu = -1; + else + cpu = get_next_cpu(napi_weight, cpu); + for (let netdev in dev.netdev) + set_netdev_cpu(netdev, cpu, rxq); + } +} + function assign_dev_cpu(dev) { + if (length(dev.rx_queues) > 1 && + length(dev.rx_tasks) > 1) + return assign_dev_queues_cpu(dev); + if (length(dev.tasks) > 0) { let cpu = dev.napi_cpu = get_next_cpu(napi_weight); for (let task in dev.tasks) @@ -204,7 +248,6 @@ function assign_dev_cpu(dev) { cpu = -1; else cpu = get_next_cpu(rx_weight, dev.napi_cpu); - dev.rx_cpu = cpu; for (let netdev in dev.netdev) set_netdev_cpu(netdev, cpu); } From e6cae783a4a8336e919c305e97e47ed1a58b43ca Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 16 Jan 2025 19:32:51 +0100 Subject: [PATCH 365/877] mediatek: remove obsolete base-files scripts Signed-off-by: Felix Fietkau (cherry picked from commit 48e1427ffa867bddc822a463af862b9dacc5bde8) --- .../base-files/etc/hotplug.d/iface/99-mtk-lro | 14 -------------- .../base-files/lib/preinit/06_set_rps_sock_flow | 6 ------ 2 files changed, 20 deletions(-) delete mode 100755 target/linux/mediatek/base-files/etc/hotplug.d/iface/99-mtk-lro delete mode 100644 target/linux/mediatek/base-files/lib/preinit/06_set_rps_sock_flow diff --git a/target/linux/mediatek/base-files/etc/hotplug.d/iface/99-mtk-lro b/target/linux/mediatek/base-files/etc/hotplug.d/iface/99-mtk-lro deleted file mode 100755 index 9a2ffaeed870eb..00000000000000 --- a/target/linux/mediatek/base-files/etc/hotplug.d/iface/99-mtk-lro +++ /dev/null @@ -1,14 +0,0 @@ -[ ifup = "$ACTION" ] && { - [ -n "$DEVICE" ] && { - if [ "$INTERFACE" == "lan" ]; then - if [ -f /usr/sbin/ethtool ]; then - ifname=eth0 - lan_ip=`uci -q get network.lan.ipaddr` - ethdrv=`ethtool -i $ifname | grep mtk_soc_eth` - [ -n "$ethdrv" ] && { - ethtool -N $ifname flow-type tcp4 dst-ip $lan_ip loc 0 - } - fi - fi - } -} diff --git a/target/linux/mediatek/base-files/lib/preinit/06_set_rps_sock_flow b/target/linux/mediatek/base-files/lib/preinit/06_set_rps_sock_flow deleted file mode 100644 index 49b1dd1ca6fb9d..00000000000000 --- a/target/linux/mediatek/base-files/lib/preinit/06_set_rps_sock_flow +++ /dev/null @@ -1,6 +0,0 @@ -set_rps_sock_flow() { - echo 1024 > /proc/sys/net/core/rps_sock_flow_entries -} - -boot_hook_add preinit_main set_rps_sock_flow - From c7716f363e032c1c105a44c86805e6a7642150cc Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Wed, 27 Nov 2024 22:20:54 +0100 Subject: [PATCH 366/877] uci: update to Git HEAD (2024-11-26) 10f7996ec294 file: Ignore config file with '.' in name Signed-off-by: Christian Marangi (cherry picked from commit 3929ef4c21844189d5db8d14e7e6dc6ba983d571) --- 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 c8f661c68434f8..6b902a9c24f9d3 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-08-10 -PKG_SOURCE_VERSION:=5781664d5087ccc4b5ab58505883231212dbedbc -PKG_MIRROR_HASH:=0ca4a29c077e85a7cfe69916c3ceb2bee98662b6268befc3c02519939647f984 +PKG_SOURCE_DATE:=2024-11-26 +PKG_SOURCE_VERSION:=10f7996ec29449915640acca5d65b592365a4b14 +PKG_MIRROR_HASH:=8556add0dd77b85a5702faa94feb811606390c045d7f5004317a4ab3e07f773b PKG_LICENSE:=LGPL-2.1 PKG_LICENSE_FILES:= From 6d3fdebe3ceebf3a93263e2b2420e422e1f98ee0 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 17 Jan 2025 11:26:09 +0100 Subject: [PATCH 367/877] uci: update to Git HEAD (2025-01-17) fb3c2343b17b add support for an override config directory Signed-off-by: Felix Fietkau (cherry picked from commit 44c877f1973b923a2032ce9d880f496a2b077ef6) --- package/system/uci/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/system/uci/Makefile b/package/system/uci/Makefile index 6b902a9c24f9d3..a253b43938f9f8 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:=2024-11-26 -PKG_SOURCE_VERSION:=10f7996ec29449915640acca5d65b592365a4b14 -PKG_MIRROR_HASH:=8556add0dd77b85a5702faa94feb811606390c045d7f5004317a4ab3e07f773b +PKG_SOURCE_DATE:=2025-01-17 +PKG_SOURCE_VERSION:=fb3c2343b17b759b175f11aec5b3fbb1cf48bbc3 +PKG_MIRROR_HASH:=c9302f4a1cb400134cb9fc0622fb6a04bbe8c55bcc83ec454caadb1e62f3257e PKG_LICENSE:=LGPL-2.1 PKG_LICENSE_FILES:= @@ -33,7 +33,7 @@ define Package/libuci CATEGORY:=Libraries TITLE:=C library for the Unified Configuration Interface (UCI) DEPENDS:=+libubox - ABI_VERSION:=20130104 + ABI_VERSION:=20250117 endef define Package/uci From fedf53650a8bba747282f967f543e1cb7940c092 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 17 Jan 2025 22:04:19 +0100 Subject: [PATCH 368/877] airoha: an7581: backport ETS patch for Airoha ethernet Backport ETS patch for Airoha ethernet and refresh affected patches. Signed-off-by: Christian Marangi (cherry picked from commit 67635578fd19d0576c54bbe722a9664e8a6ab2a6) --- ...net-airoha-Enforce-ETS-Qdisc-priomap.patch | 53 +++++++++++++++++++ ...-channel-configuration-for-ETS-Qdisc.patch | 2 +- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 target/linux/airoha/patches-6.6/039-v6.14-net-airoha-Enforce-ETS-Qdisc-priomap.patch diff --git a/target/linux/airoha/patches-6.6/039-v6.14-net-airoha-Enforce-ETS-Qdisc-priomap.patch b/target/linux/airoha/patches-6.6/039-v6.14-net-airoha-Enforce-ETS-Qdisc-priomap.patch new file mode 100644 index 00000000000000..2753972070227a --- /dev/null +++ b/target/linux/airoha/patches-6.6/039-v6.14-net-airoha-Enforce-ETS-Qdisc-priomap.patch @@ -0,0 +1,53 @@ +From b56e4d660a9688ff83f5cbdc6e3ea063352d0d79 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Sun, 12 Jan 2025 19:32:45 +0100 +Subject: [PATCH] net: airoha: Enforce ETS Qdisc priomap + +EN7581 SoC supports fixed QoS band priority where WRR queues have lowest +priorities with respect to SP ones. +E.g: WRR0, WRR1, .., WRRm, SP0, SP1, .., SPn + +Enforce ETS Qdisc priomap according to the hw capabilities. + +Suggested-by: Davide Caratti +Signed-off-by: Lorenzo Bianconi +Reviewed-by: Davide Caratti +Link: https://patch.msgid.link/20250112-airoha_ets_priomap-v1-1-fb616de159ba@kernel.org +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/mediatek/airoha_eth.c | 17 +++++++++++++++-- + 1 file changed, 15 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/mediatek/airoha_eth.c ++++ b/drivers/net/ethernet/mediatek/airoha_eth.c +@@ -2786,7 +2786,7 @@ static int airoha_qdma_set_tx_ets_sched( + struct tc_ets_qopt_offload_replace_params *p = &opt->replace_params; + enum tx_sched_mode mode = TC_SCH_SP; + u16 w[AIROHA_NUM_QOS_QUEUES] = {}; +- int i, nstrict = 0; ++ int i, nstrict = 0, nwrr, qidx; + + if (p->bands > AIROHA_NUM_QOS_QUEUES) + return -EINVAL; +@@ -2800,7 +2800,20 @@ static int airoha_qdma_set_tx_ets_sched( + if (nstrict == AIROHA_NUM_QOS_QUEUES - 1) + return -EINVAL; + +- for (i = 0; i < p->bands - nstrict; i++) ++ /* EN7581 SoC supports fixed QoS band priority where WRR queues have ++ * lowest priorities with respect to SP ones. ++ * e.g: WRR0, WRR1, .., WRRm, SP0, SP1, .., SPn ++ */ ++ nwrr = p->bands - nstrict; ++ qidx = nstrict && nwrr ? nstrict : 0; ++ for (i = 1; i <= p->bands; i++) { ++ if (p->priomap[i % AIROHA_NUM_QOS_QUEUES] != qidx) ++ return -EINVAL; ++ ++ qidx = i == nwrr ? 0 : qidx + 1; ++ } ++ ++ for (i = 0; i < nwrr; i++) + w[i] = p->weights[nstrict + i]; + + if (!nstrict) diff --git a/target/linux/airoha/patches-6.6/113-net-airoha-Fix-channel-configuration-for-ETS-Qdisc.patch b/target/linux/airoha/patches-6.6/113-net-airoha-Fix-channel-configuration-for-ETS-Qdisc.patch index 5bd7487b9f2b83..e98fdad065e59e 100644 --- a/target/linux/airoha/patches-6.6/113-net-airoha-Fix-channel-configuration-for-ETS-Qdisc.patch +++ b/target/linux/airoha/patches-6.6/113-net-airoha-Fix-channel-configuration-for-ETS-Qdisc.patch @@ -86,7 +86,7 @@ Best regards, --- a/drivers/net/ethernet/mediatek/airoha_eth.c +++ b/drivers/net/ethernet/mediatek/airoha_eth.c -@@ -2833,11 +2833,14 @@ static int airoha_qdma_get_tx_ets_stats( +@@ -2846,11 +2846,14 @@ static int airoha_qdma_get_tx_ets_stats( static int airoha_tc_setup_qdisc_ets(struct airoha_gdm_port *port, struct tc_ets_qopt_offload *opt) { From 0f45601ccd1b44ba4ed7873e15933ec00565b796 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 17 Jan 2025 22:09:05 +0100 Subject: [PATCH 369/877] airoha: an7581: add pending PCI patch Add pending PCI patch that should correctly fix mediatek driver with Airoha SoC. Signed-off-by: Christian Marangi (cherry picked from commit f22febae1a6b7c654eaf09ed02c0d0017be6d73a) --- ...3-Rely-on-clk_bulk_prepare_enable-in.patch | 58 ++++++++ ...3-Move-reset-assert-callbacks-in-.po.patch | 89 ++++++++++++ ...3-Add-comment-about-initialization-o.patch | 38 +++++ ...3-Move-reset-delay-in-mtk_pcie_en758.patch | 62 +++++++++ ...3-Rely-on-msleep-in-mtk_pcie_en7581_.patch | 44 ++++++ ...3-Avoid-PCIe-resetting-via-PERST-for.patch | 131 ++++++++++++++++++ ...-Configure-PBUS_CSR-registers-for-E.patch} | 28 ++-- ...3-Remove-mac_reset-assert-leftover-f.patch | 26 ++++ 8 files changed, 461 insertions(+), 15 deletions(-) create mode 100644 target/linux/airoha/patches-6.6/401-PCI-mediatek-gen3-Rely-on-clk_bulk_prepare_enable-in.patch create mode 100644 target/linux/airoha/patches-6.6/402-PCI-mediatek-gen3-Move-reset-assert-callbacks-in-.po.patch create mode 100644 target/linux/airoha/patches-6.6/403-PCI-mediatek-gen3-Add-comment-about-initialization-o.patch create mode 100644 target/linux/airoha/patches-6.6/404-PCI-mediatek-gen3-Move-reset-delay-in-mtk_pcie_en758.patch create mode 100644 target/linux/airoha/patches-6.6/405-PCI-mediatek-gen3-Rely-on-msleep-in-mtk_pcie_en7581_.patch create mode 100644 target/linux/airoha/patches-6.6/406-PCI-mediatek-gen3-Avoid-PCIe-resetting-via-PERST-for.patch rename target/linux/airoha/patches-6.6/{112-PCI-mediatek-gen3-configure-PBUS_CSR-registers-for-E.patch => 407-PCI-mediatek-gen3-Configure-PBUS_CSR-registers-for-E.patch} (74%) create mode 100644 target/linux/airoha/patches-6.6/408-PCI-mediatek-gen3-Remove-mac_reset-assert-leftover-f.patch diff --git a/target/linux/airoha/patches-6.6/401-PCI-mediatek-gen3-Rely-on-clk_bulk_prepare_enable-in.patch b/target/linux/airoha/patches-6.6/401-PCI-mediatek-gen3-Rely-on-clk_bulk_prepare_enable-in.patch new file mode 100644 index 00000000000000..e1ba4cbac2b27c --- /dev/null +++ b/target/linux/airoha/patches-6.6/401-PCI-mediatek-gen3-Rely-on-clk_bulk_prepare_enable-in.patch @@ -0,0 +1,58 @@ +From 0e7a622da17da0042294860cdb7a2fac091d25b1 Mon Sep 17 00:00:00 2001 +Message-ID: <0e7a622da17da0042294860cdb7a2fac091d25b1.1736960708.git.lorenzo@kernel.org> +From: Lorenzo Bianconi +Date: Wed, 8 Jan 2025 10:50:40 +0100 +Subject: [PATCH 1/6] PCI: mediatek-gen3: Rely on clk_bulk_prepare_enable() in + mtk_pcie_en7581_power_up() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Replace clk_bulk_prepare() and clk_bulk_enable() with +clk_bulk_prepare_enable() in mtk_pcie_en7581_power_up() routine. + +Link: https://lore.kernel.org/r/20250108-pcie-en7581-fixes-v6-1-21ac939a3b9b@kernel.org +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Krzysztof Wilczyński +Reviewed-by: AngeloGioacchino Del Regno +Reviewed-by: Manivannan Sadhasivam +--- + drivers/pci/controller/pcie-mediatek-gen3.c | 14 +++----------- + 1 file changed, 3 insertions(+), 11 deletions(-) + +--- a/drivers/pci/controller/pcie-mediatek-gen3.c ++++ b/drivers/pci/controller/pcie-mediatek-gen3.c +@@ -907,12 +907,6 @@ static int mtk_pcie_en7581_power_up(stru + pm_runtime_enable(dev); + pm_runtime_get_sync(dev); + +- err = clk_bulk_prepare(pcie->num_clks, pcie->clks); +- if (err) { +- dev_err(dev, "failed to prepare clock\n"); +- goto err_clk_prepare; +- } +- + val = FIELD_PREP(PCIE_VAL_LN0_DOWNSTREAM, 0x47) | + FIELD_PREP(PCIE_VAL_LN1_DOWNSTREAM, 0x47) | + FIELD_PREP(PCIE_VAL_LN0_UPSTREAM, 0x41) | +@@ -925,17 +919,15 @@ static int mtk_pcie_en7581_power_up(stru + FIELD_PREP(PCIE_K_FINETUNE_MAX, 0xf); + writel_relaxed(val, pcie->base + PCIE_PIPE4_PIE8_REG); + +- err = clk_bulk_enable(pcie->num_clks, pcie->clks); ++ err = clk_bulk_prepare_enable(pcie->num_clks, pcie->clks); + if (err) { + dev_err(dev, "failed to prepare clock\n"); +- goto err_clk_enable; ++ goto err_clk_prepare_enable; + } + + return 0; + +-err_clk_enable: +- clk_bulk_unprepare(pcie->num_clks, pcie->clks); +-err_clk_prepare: ++err_clk_prepare_enable: + pm_runtime_put_sync(dev); + pm_runtime_disable(dev); + reset_control_bulk_assert(pcie->soc->phy_resets.num_resets, pcie->phy_resets); diff --git a/target/linux/airoha/patches-6.6/402-PCI-mediatek-gen3-Move-reset-assert-callbacks-in-.po.patch b/target/linux/airoha/patches-6.6/402-PCI-mediatek-gen3-Move-reset-assert-callbacks-in-.po.patch new file mode 100644 index 00000000000000..de2b20195c2546 --- /dev/null +++ b/target/linux/airoha/patches-6.6/402-PCI-mediatek-gen3-Move-reset-assert-callbacks-in-.po.patch @@ -0,0 +1,89 @@ +From e4c7dfd953f7618f0ccb70d87c1629634f306fab Mon Sep 17 00:00:00 2001 +Message-ID: +In-Reply-To: <0e7a622da17da0042294860cdb7a2fac091d25b1.1736960708.git.lorenzo@kernel.org> +References: <0e7a622da17da0042294860cdb7a2fac091d25b1.1736960708.git.lorenzo@kernel.org> +From: Lorenzo Bianconi +Date: Wed, 8 Jan 2025 10:50:41 +0100 +Subject: [PATCH 2/6] PCI: mediatek-gen3: Move reset/assert callbacks in + .power_up() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +In order to make the code more readable, the reset_control_bulk_assert() +function for PHY reset lines is moved to make it pair with +reset_control_bulk_deassert() in mtk_pcie_power_up() and +mtk_pcie_en7581_power_up(). The same change is done for +reset_control_assert() used to assert MAC reset line. + +Introduce PCIE_MTK_RESET_TIME_US macro for the time needed to +complete PCIe reset on MediaTek controller. + +Link: https://lore.kernel.org/r/20250108-pcie-en7581-fixes-v6-2-21ac939a3b9b@kernel.org +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Krzysztof Wilczyński +Reviewed-by: AngeloGioacchino Del Regno +Reviewed-by: Manivannan Sadhasivam +--- + drivers/pci/controller/pcie-mediatek-gen3.c | 28 +++++++++++++-------- + 1 file changed, 18 insertions(+), 10 deletions(-) + +--- a/drivers/pci/controller/pcie-mediatek-gen3.c ++++ b/drivers/pci/controller/pcie-mediatek-gen3.c +@@ -120,6 +120,8 @@ + + #define MAX_NUM_PHY_RESETS 3 + ++#define PCIE_MTK_RESET_TIME_US 10 ++ + /* Time in ms needed to complete PCIe reset on EN7581 SoC */ + #define PCIE_EN7581_RESET_TIME_MS 100 + +@@ -875,9 +877,14 @@ static int mtk_pcie_en7581_power_up(stru + u32 val; + + /* +- * Wait for the time needed to complete the bulk assert in +- * mtk_pcie_setup for EN7581 SoC. ++ * The controller may have been left out of reset by the bootloader ++ * so make sure that we get a clean start by asserting resets here. + */ ++ reset_control_bulk_assert(pcie->soc->phy_resets.num_resets, ++ pcie->phy_resets); ++ reset_control_assert(pcie->mac_reset); ++ ++ /* Wait for the time needed to complete the reset lines assert. */ + mdelay(PCIE_EN7581_RESET_TIME_MS); + + err = phy_init(pcie->phy); +@@ -944,6 +951,15 @@ static int mtk_pcie_power_up(struct mtk_ + struct device *dev = pcie->dev; + int err; + ++ /* ++ * The controller may have been left out of reset by the bootloader ++ * so make sure that we get a clean start by asserting resets here. ++ */ ++ reset_control_bulk_assert(pcie->soc->phy_resets.num_resets, ++ pcie->phy_resets); ++ reset_control_assert(pcie->mac_reset); ++ usleep_range(PCIE_MTK_RESET_TIME_US, 2 * PCIE_MTK_RESET_TIME_US); ++ + /* PHY power on and enable pipe clock */ + err = reset_control_bulk_deassert(pcie->soc->phy_resets.num_resets, pcie->phy_resets); + if (err) { +@@ -1016,14 +1032,6 @@ static int mtk_pcie_setup(struct mtk_gen + * counter since the bulk is shared. + */ + reset_control_bulk_deassert(pcie->soc->phy_resets.num_resets, pcie->phy_resets); +- /* +- * The controller may have been left out of reset by the bootloader +- * so make sure that we get a clean start by asserting resets here. +- */ +- reset_control_bulk_assert(pcie->soc->phy_resets.num_resets, pcie->phy_resets); +- +- reset_control_assert(pcie->mac_reset); +- usleep_range(10, 20); + + /* Don't touch the hardware registers before power up */ + err = pcie->soc->power_up(pcie); diff --git a/target/linux/airoha/patches-6.6/403-PCI-mediatek-gen3-Add-comment-about-initialization-o.patch b/target/linux/airoha/patches-6.6/403-PCI-mediatek-gen3-Add-comment-about-initialization-o.patch new file mode 100644 index 00000000000000..c8165ced635fa4 --- /dev/null +++ b/target/linux/airoha/patches-6.6/403-PCI-mediatek-gen3-Add-comment-about-initialization-o.patch @@ -0,0 +1,38 @@ +From 0c9d2d2ef0d916b490a9222ed20ff4616fca876d Mon Sep 17 00:00:00 2001 +Message-ID: <0c9d2d2ef0d916b490a9222ed20ff4616fca876d.1736960708.git.lorenzo@kernel.org> +In-Reply-To: <0e7a622da17da0042294860cdb7a2fac091d25b1.1736960708.git.lorenzo@kernel.org> +References: <0e7a622da17da0042294860cdb7a2fac091d25b1.1736960708.git.lorenzo@kernel.org> +From: Lorenzo Bianconi +Date: Wed, 8 Jan 2025 10:50:42 +0100 +Subject: [PATCH 3/6] PCI: mediatek-gen3: Add comment about initialization + order in mtk_pcie_en7581_power_up() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add a comment in mtk_pcie_en7581_power_up() to clarify, unlike the other +MediaTek Gen3 controllers, the Airoha EN7581 requires PHY initialization +and power-on before PHY reset deassert. + +Link: https://lore.kernel.org/r/20250108-pcie-en7581-fixes-v6-3-21ac939a3b9b@kernel.org +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Krzysztof Wilczyński +Reviewed-by: Manivannan Sadhasivam +Reviewed-by: AngeloGioacchino Del Regno +--- + drivers/pci/controller/pcie-mediatek-gen3.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/pci/controller/pcie-mediatek-gen3.c ++++ b/drivers/pci/controller/pcie-mediatek-gen3.c +@@ -887,6 +887,10 @@ static int mtk_pcie_en7581_power_up(stru + /* Wait for the time needed to complete the reset lines assert. */ + mdelay(PCIE_EN7581_RESET_TIME_MS); + ++ /* ++ * Unlike the other MediaTek Gen3 controllers, the Airoha EN7581 ++ * requires PHY initialization and power-on before PHY reset deassert. ++ */ + err = phy_init(pcie->phy); + if (err) { + dev_err(dev, "failed to initialize PHY\n"); diff --git a/target/linux/airoha/patches-6.6/404-PCI-mediatek-gen3-Move-reset-delay-in-mtk_pcie_en758.patch b/target/linux/airoha/patches-6.6/404-PCI-mediatek-gen3-Move-reset-delay-in-mtk_pcie_en758.patch new file mode 100644 index 00000000000000..cf8e1f473b69c9 --- /dev/null +++ b/target/linux/airoha/patches-6.6/404-PCI-mediatek-gen3-Move-reset-delay-in-mtk_pcie_en758.patch @@ -0,0 +1,62 @@ +From 90d4e466c9ea2010f33880a36317a8486ccbe082 Mon Sep 17 00:00:00 2001 +Message-ID: <90d4e466c9ea2010f33880a36317a8486ccbe082.1736960708.git.lorenzo@kernel.org> +In-Reply-To: <0e7a622da17da0042294860cdb7a2fac091d25b1.1736960708.git.lorenzo@kernel.org> +References: <0e7a622da17da0042294860cdb7a2fac091d25b1.1736960708.git.lorenzo@kernel.org> +From: Lorenzo Bianconi +Date: Wed, 8 Jan 2025 10:50:43 +0100 +Subject: [PATCH 4/6] PCI: mediatek-gen3: Move reset delay in + mtk_pcie_en7581_power_up() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Airoha EN7581 has a hw bug asserting/releasing PCIE_PE_RSTB signal +causing occasional PCIe link down issues. In order to overcome the +problem, PCIe block is reset using REG_PCI_CONTROL (0x88) and +REG_RESET_CONTROL (0x834) registers available in the clock module +running clk_bulk_prepare_enable() in mtk_pcie_en7581_power_up(). + +In order to make the code more readable, move the wait for the time +needed to complete the PCIe reset from en7581_pci_enable() to +mtk_pcie_en7581_power_up(). + +Reduce reset timeout from 250ms to the standard PCIE_T_PVPERL_MS value +(100ms) since it has no impact on the driver behavior. + +Link: https://lore.kernel.org/r/20250108-pcie-en7581-fixes-v6-4-21ac939a3b9b@kernel.org +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Krzysztof Wilczyński +Reviewed-by: AngeloGioacchino Del Regno +Reviewed-by: Manivannan Sadhasivam +Acked-by: Stephen Boyd +--- + drivers/clk/clk-en7523.c | 1 - + drivers/pci/controller/pcie-mediatek-gen3.c | 7 +++++++ + 2 files changed, 7 insertions(+), 1 deletion(-) + +--- a/drivers/clk/clk-en7523.c ++++ b/drivers/clk/clk-en7523.c +@@ -489,7 +489,6 @@ static int en7581_pci_enable(struct clk_ + REG_PCI_CONTROL_PERSTOUT; + val = readl(np_base + REG_PCI_CONTROL); + writel(val | mask, np_base + REG_PCI_CONTROL); +- msleep(250); + + return 0; + } +--- a/drivers/pci/controller/pcie-mediatek-gen3.c ++++ b/drivers/pci/controller/pcie-mediatek-gen3.c +@@ -936,6 +936,13 @@ static int mtk_pcie_en7581_power_up(stru + goto err_clk_prepare_enable; + } + ++ /* ++ * Airoha EN7581 performs PCIe reset via clk callbacks since it has a ++ * hw issue with PCIE_PE_RSTB signal. Add wait for the time needed to ++ * complete the PCIe reset. ++ */ ++ msleep(PCIE_T_PVPERL_MS); ++ + return 0; + + err_clk_prepare_enable: diff --git a/target/linux/airoha/patches-6.6/405-PCI-mediatek-gen3-Rely-on-msleep-in-mtk_pcie_en7581_.patch b/target/linux/airoha/patches-6.6/405-PCI-mediatek-gen3-Rely-on-msleep-in-mtk_pcie_en7581_.patch new file mode 100644 index 00000000000000..cbd28e19f1ea1c --- /dev/null +++ b/target/linux/airoha/patches-6.6/405-PCI-mediatek-gen3-Rely-on-msleep-in-mtk_pcie_en7581_.patch @@ -0,0 +1,44 @@ +From c98bee18d0a094e37100c85effe5e161418f8644 Mon Sep 17 00:00:00 2001 +Message-ID: +In-Reply-To: <0e7a622da17da0042294860cdb7a2fac091d25b1.1736960708.git.lorenzo@kernel.org> +References: <0e7a622da17da0042294860cdb7a2fac091d25b1.1736960708.git.lorenzo@kernel.org> +From: Lorenzo Bianconi +Date: Wed, 8 Jan 2025 10:50:44 +0100 +Subject: [PATCH 5/6] PCI: mediatek-gen3: Rely on msleep() in + mtk_pcie_en7581_power_up() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Since mtk_pcie_en7581_power_up() runs in non-atomic context, rely on +msleep() routine instead of mdelay(). + +Link: https://lore.kernel.org/r/20250108-pcie-en7581-fixes-v6-5-21ac939a3b9b@kernel.org +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Krzysztof Wilczyński +Reviewed-by: AngeloGioacchino Del Regno +Reviewed-by: Manivannan Sadhasivam +--- + drivers/pci/controller/pcie-mediatek-gen3.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/pci/controller/pcie-mediatek-gen3.c ++++ b/drivers/pci/controller/pcie-mediatek-gen3.c +@@ -885,7 +885,7 @@ static int mtk_pcie_en7581_power_up(stru + reset_control_assert(pcie->mac_reset); + + /* Wait for the time needed to complete the reset lines assert. */ +- mdelay(PCIE_EN7581_RESET_TIME_MS); ++ msleep(PCIE_EN7581_RESET_TIME_MS); + + /* + * Unlike the other MediaTek Gen3 controllers, the Airoha EN7581 +@@ -913,7 +913,7 @@ static int mtk_pcie_en7581_power_up(stru + * Wait for the time needed to complete the bulk de-assert above. + * This time is specific for EN7581 SoC. + */ +- mdelay(PCIE_EN7581_RESET_TIME_MS); ++ msleep(PCIE_EN7581_RESET_TIME_MS); + + pm_runtime_enable(dev); + pm_runtime_get_sync(dev); diff --git a/target/linux/airoha/patches-6.6/406-PCI-mediatek-gen3-Avoid-PCIe-resetting-via-PERST-for.patch b/target/linux/airoha/patches-6.6/406-PCI-mediatek-gen3-Avoid-PCIe-resetting-via-PERST-for.patch new file mode 100644 index 00000000000000..cdc6e353aa2290 --- /dev/null +++ b/target/linux/airoha/patches-6.6/406-PCI-mediatek-gen3-Avoid-PCIe-resetting-via-PERST-for.patch @@ -0,0 +1,131 @@ +From 491cb9c5084790aafa02e843349492c284373231 Mon Sep 17 00:00:00 2001 +Message-ID: <491cb9c5084790aafa02e843349492c284373231.1736960708.git.lorenzo@kernel.org> +In-Reply-To: <0e7a622da17da0042294860cdb7a2fac091d25b1.1736960708.git.lorenzo@kernel.org> +References: <0e7a622da17da0042294860cdb7a2fac091d25b1.1736960708.git.lorenzo@kernel.org> +From: Lorenzo Bianconi +Date: Thu, 9 Jan 2025 00:30:45 +0100 +Subject: [PATCH 6/6] PCI: mediatek-gen3: Avoid PCIe resetting via PERST# for + Airoha EN7581 SoC +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Airoha EN7581 has a hw bug asserting/releasing PERST# signal causing +occasional PCIe link down issues. In order to overcome the problem, +PERST# signal is not asserted/released during device probe or +suspend/resume phase and the PCIe block is reset using +en7523_reset_assert() and en7581_pci_enable(). + +Introduce flags field in the mtk_gen3_pcie_pdata struct in order to +specify per-SoC capabilities. + +Link: https://lore.kernel.org/r/20250109-pcie-en7581-rst-fix-v4-1-4a45c89fb143@kernel.org +Tested-by: Hui Ma +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Krzysztof Wilczyński +--- + drivers/pci/controller/pcie-mediatek-gen3.c | 59 ++++++++++++++------- + 1 file changed, 41 insertions(+), 18 deletions(-) + +--- a/drivers/pci/controller/pcie-mediatek-gen3.c ++++ b/drivers/pci/controller/pcie-mediatek-gen3.c +@@ -127,10 +127,18 @@ + + struct mtk_gen3_pcie; + ++enum mtk_gen3_pcie_flags { ++ SKIP_PCIE_RSTB = BIT(0), /* Skip PERST# assertion during device ++ * probing or suspend/resume phase to ++ * avoid hw bugs/issues. ++ */ ++}; ++ + /** + * struct mtk_gen3_pcie_pdata - differentiate between host generations + * @power_up: pcie power_up callback + * @phy_resets: phy reset lines SoC data. ++ * @flags: pcie device flags. + */ + struct mtk_gen3_pcie_pdata { + int (*power_up)(struct mtk_gen3_pcie *pcie); +@@ -138,6 +146,7 @@ struct mtk_gen3_pcie_pdata { + const char *id[MAX_NUM_PHY_RESETS]; + int num_resets; + } phy_resets; ++ u32 flags; + }; + + /** +@@ -404,22 +413,33 @@ static int mtk_pcie_startup_port(struct + val |= PCIE_DISABLE_DVFSRC_VLT_REQ; + writel_relaxed(val, pcie->base + PCIE_MISC_CTRL_REG); + +- /* Assert all reset signals */ +- val = readl_relaxed(pcie->base + PCIE_RST_CTRL_REG); +- val |= PCIE_MAC_RSTB | PCIE_PHY_RSTB | PCIE_BRG_RSTB | PCIE_PE_RSTB; +- writel_relaxed(val, pcie->base + PCIE_RST_CTRL_REG); +- + /* +- * Described in PCIe CEM specification sections 2.2 (PERST# Signal) +- * and 2.2.1 (Initial Power-Up (G3 to S0)). +- * The deassertion of PERST# should be delayed 100ms (TPVPERL) +- * for the power and clock to become stable. ++ * Airoha EN7581 has a hw bug asserting/releasing PCIE_PE_RSTB signal ++ * causing occasional PCIe link down. In order to overcome the issue, ++ * PCIE_RSTB signals are not asserted/released at this stage and the ++ * PCIe block is reset using en7523_reset_assert() and ++ * en7581_pci_enable(). + */ +- msleep(100); +- +- /* De-assert reset signals */ +- val &= ~(PCIE_MAC_RSTB | PCIE_PHY_RSTB | PCIE_BRG_RSTB | PCIE_PE_RSTB); +- writel_relaxed(val, pcie->base + PCIE_RST_CTRL_REG); ++ if (!(pcie->soc->flags & SKIP_PCIE_RSTB)) { ++ /* Assert all reset signals */ ++ val = readl_relaxed(pcie->base + PCIE_RST_CTRL_REG); ++ val |= PCIE_MAC_RSTB | PCIE_PHY_RSTB | PCIE_BRG_RSTB | ++ PCIE_PE_RSTB; ++ writel_relaxed(val, pcie->base + PCIE_RST_CTRL_REG); ++ ++ /* ++ * Described in PCIe CEM specification revision 6.0. ++ * ++ * The deassertion of PERST# should be delayed 100ms (TPVPERL) ++ * for the power and clock to become stable. ++ */ ++ msleep(PCIE_T_PVPERL_MS); ++ ++ /* De-assert reset signals */ ++ val &= ~(PCIE_MAC_RSTB | PCIE_PHY_RSTB | PCIE_BRG_RSTB | ++ PCIE_PE_RSTB); ++ writel_relaxed(val, pcie->base + PCIE_RST_CTRL_REG); ++ } + + /* Check if the link is up or not */ + err = readl_poll_timeout(pcie->base + PCIE_LINK_STATUS_REG, val, +@@ -1178,10 +1198,12 @@ static int mtk_pcie_suspend_noirq(struct + return err; + } + +- /* Pull down the PERST# pin */ +- val = readl_relaxed(pcie->base + PCIE_RST_CTRL_REG); +- val |= PCIE_PE_RSTB; +- writel_relaxed(val, pcie->base + PCIE_RST_CTRL_REG); ++ if (!(pcie->soc->flags & SKIP_PCIE_RSTB)) { ++ /* Assert the PERST# pin */ ++ val = readl_relaxed(pcie->base + PCIE_RST_CTRL_REG); ++ val |= PCIE_PE_RSTB; ++ writel_relaxed(val, pcie->base + PCIE_RST_CTRL_REG); ++ } + + dev_dbg(pcie->dev, "entered L2 states successfully"); + +@@ -1232,6 +1254,7 @@ static const struct mtk_gen3_pcie_pdata + .id[2] = "phy-lane2", + .num_resets = 3, + }, ++ .flags = SKIP_PCIE_RSTB, + }; + + static const struct of_device_id mtk_pcie_of_match[] = { diff --git a/target/linux/airoha/patches-6.6/112-PCI-mediatek-gen3-configure-PBUS_CSR-registers-for-E.patch b/target/linux/airoha/patches-6.6/407-PCI-mediatek-gen3-Configure-PBUS_CSR-registers-for-E.patch similarity index 74% rename from target/linux/airoha/patches-6.6/112-PCI-mediatek-gen3-configure-PBUS_CSR-registers-for-E.patch rename to target/linux/airoha/patches-6.6/407-PCI-mediatek-gen3-Configure-PBUS_CSR-registers-for-E.patch index d896e1aee3ffa8..49b8752dcafecd 100644 --- a/target/linux/airoha/patches-6.6/112-PCI-mediatek-gen3-configure-PBUS_CSR-registers-for-E.patch +++ b/target/linux/airoha/patches-6.6/407-PCI-mediatek-gen3-Configure-PBUS_CSR-registers-for-E.patch @@ -1,11 +1,9 @@ -From 2285d3b428c7d8f1c4fda2fb995e7e46a05350e0 Mon Sep 17 00:00:00 2001 -Message-ID: <2285d3b428c7d8f1c4fda2fb995e7e46a05350e0.1736324542.git.lorenzo@kernel.org> -In-Reply-To: <0c0ae72f5c84c5a29495337b254ac3cc2d5c16bb.1736324541.git.lorenzo@kernel.org> -References: <0c0ae72f5c84c5a29495337b254ac3cc2d5c16bb.1736324541.git.lorenzo@kernel.org> +From ca4217f3117dceb2d01e179d02031a8758404624 Mon Sep 17 00:00:00 2001 +Message-ID: From: Lorenzo Bianconi Date: Tue, 3 Sep 2024 23:14:02 +0200 -Subject: [PATCH 2/2] PCI: mediatek-gen3: configure PBUS_CSR registers for - EN7581 SoC +Subject: [PATCH] PCI: mediatek-gen3: Configure PBUS_CSR registers for EN7581 + SoC Configure PBus base address and address mask in order to allow the hw detecting if a given address is on PCIE0, PCIE1 or PCIE2. @@ -33,9 +31,9 @@ Signed-off-by: Lorenzo Bianconi #include #include "../pci.h" -@@ -120,6 +122,13 @@ +@@ -122,6 +124,13 @@ - #define MAX_NUM_PHY_RESETS 3 + #define PCIE_MTK_RESET_TIME_US 10 +#define PCIE_EN7581_PBUS_ADDR(_n) (0x00 + ((_n) << 3)) +#define PCIE_EN7581_PBUS_ADDR_MASK(_n) (0x04 + ((_n) << 3)) @@ -47,7 +45,7 @@ Signed-off-by: Lorenzo Bianconi /* Time in ms needed to complete PCIe reset on EN7581 SoC */ #define PCIE_EN7581_RESET_TIME_MS 100 -@@ -871,7 +880,8 @@ static int mtk_pcie_parse_port(struct mt +@@ -893,7 +902,8 @@ static int mtk_pcie_parse_port(struct mt static int mtk_pcie_en7581_power_up(struct mtk_gen3_pcie *pcie) { struct device *dev = pcie->dev; @@ -57,9 +55,9 @@ Signed-off-by: Lorenzo Bianconi u32 val; /* -@@ -880,6 +890,23 @@ static int mtk_pcie_en7581_power_up(stru - */ - mdelay(PCIE_EN7581_RESET_TIME_MS); +@@ -907,6 +917,23 @@ static int mtk_pcie_en7581_power_up(stru + /* Wait for the time needed to complete the reset lines assert. */ + msleep(PCIE_EN7581_RESET_TIME_MS); + map = syscon_regmap_lookup_by_compatible("airoha,en7581-pbus-csr"); + if (IS_ERR(map)) @@ -78,6 +76,6 @@ Signed-off-by: Lorenzo Bianconi + regmap_write(map, PCIE_EN7581_PBUS_ADDR_MASK(slot), + PCIE_EN7581_PBUS_BASE_ADDR_MASK); + - err = phy_init(pcie->phy); - if (err) { - dev_err(dev, "failed to initialize PHY\n"); + /* + * Unlike the other MediaTek Gen3 controllers, the Airoha EN7581 + * requires PHY initialization and power-on before PHY reset deassert. diff --git a/target/linux/airoha/patches-6.6/408-PCI-mediatek-gen3-Remove-mac_reset-assert-leftover-f.patch b/target/linux/airoha/patches-6.6/408-PCI-mediatek-gen3-Remove-mac_reset-assert-leftover-f.patch new file mode 100644 index 00000000000000..f1512a95cfbe24 --- /dev/null +++ b/target/linux/airoha/patches-6.6/408-PCI-mediatek-gen3-Remove-mac_reset-assert-leftover-f.patch @@ -0,0 +1,26 @@ +From c4defe43ce17a87e6341d126ba736d9f7ebdc541 Mon Sep 17 00:00:00 2001 +Message-ID: +From: Lorenzo Bianconi +Date: Wed, 15 Jan 2025 18:36:26 +0100 +Subject: [PATCH] PCI: mediatek-gen3: Remove mac_reset assert leftover for + Airoha EN7581 SoC. + +Remove a leftover assert for mac_reset line in mtk_pcie_en7581_power_up(). +This is not armful since EN7581 does not requires mac_reset and +mac_reset is not defined in EN7581 device tree. + +Signed-off-by: Lorenzo Bianconi +--- + drivers/pci/controller/pcie-mediatek-gen3.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/pci/controller/pcie-mediatek-gen3.c ++++ b/drivers/pci/controller/pcie-mediatek-gen3.c +@@ -912,7 +912,6 @@ static int mtk_pcie_en7581_power_up(stru + */ + reset_control_bulk_assert(pcie->soc->phy_resets.num_resets, + pcie->phy_resets); +- reset_control_assert(pcie->mac_reset); + + /* Wait for the time needed to complete the reset lines assert. */ + msleep(PCIE_EN7581_RESET_TIME_MS); From 3078b4e51b1f4cc74237234c5d613ff05be3f2cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Fri, 17 Jan 2025 09:38:30 +0100 Subject: [PATCH 370/877] generic: r8169: remove reverted temperature sensor patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The patch adding temperature sensor support for r8169 has been removed upstream and the functionality will be added to Realtek PHY instead: https://github.com/torvalds/linux/commit/1f691a1fc4bef1c5cf5f503e14e1a22fc37c97e3 Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 0de9999a7819acf74f6adeaa27be363cf72409ab) --- package/kernel/linux/modules/netdevices.mk | 2 +- ...t-for-the-temperature-sensor-being-a.patch | 83 ------------------- ...ginal-workaround-for-RTL8125-broken-.patch | 2 +- ...TSO-on-selected-chip-versions-per-de.patch | 4 +- ...plement-additional-ethtool-stats-ops.patch | 8 +- ...169-don-t-take-RTNL-lock-in-rtl_task.patch | 6 +- ...9-remove-rtl_dash_loop_wait_high-low.patch | 6 +- ...v6.13-r8169-add-support-for-RTL8125D.patch | 18 ++-- ...istent-indenting-in-rtl8169_get_eth_.patch | 2 +- ...itialization-of-RSS-registers-on-RTL.patch | 4 +- ...leftover-locks-after-reverted-change.patch | 12 +-- ...6.13-r8169-improve-__rtl8169_set_wol.patch | 4 +- ...13-r8169-improve-rtl_set_d3_pll_down.patch | 2 +- ..._PHY-handling-with-r8125-r8126-vendo.patch | 2 +- ...-r8169_mod_reg8_cond-to-simplify-rtl.patch | 2 +- 15 files changed, 37 insertions(+), 120 deletions(-) delete mode 100644 target/linux/generic/backport-6.6/780-24-v6.13-r8169-add-support-for-the-temperature-sensor-being-a.patch diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk index 247f3782d5b832..a72ca1d89b3d25 100644 --- a/package/kernel/linux/modules/netdevices.mk +++ b/package/kernel/linux/modules/netdevices.mk @@ -970,7 +970,7 @@ $(eval $(call KernelPackage,8139cp)) define KernelPackage/r8169 SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=RealTek RTL-8169 PCI Gigabit Ethernet Adapter kernel support - DEPENDS:=@PCI_SUPPORT +kmod-mii +r8169-firmware +kmod-phy-realtek +kmod-mdio-devres +kmod-hwmon-core + DEPENDS:=@PCI_SUPPORT +kmod-mii +r8169-firmware +kmod-phy-realtek +kmod-mdio-devres KCONFIG:= \ CONFIG_R8169 \ CONFIG_R8169_LEDS=y diff --git a/target/linux/generic/backport-6.6/780-24-v6.13-r8169-add-support-for-the-temperature-sensor-being-a.patch b/target/linux/generic/backport-6.6/780-24-v6.13-r8169-add-support-for-the-temperature-sensor-being-a.patch deleted file mode 100644 index 2403da5d55519f..00000000000000 --- a/target/linux/generic/backport-6.6/780-24-v6.13-r8169-add-support-for-the-temperature-sensor-being-a.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 1ffcc8d41306fd2e5f140b276820714a26a11cc4 Mon Sep 17 00:00:00 2001 -From: Heiner Kallweit -Date: Mon, 7 Oct 2024 20:34:12 +0200 -Subject: [PATCH] r8169: add support for the temperature sensor being available - from RTL8125B - -This adds support for the temperature sensor being available from -RTL8125B. Register information was taken from r8125 vendor driver. - -Signed-off-by: Heiner Kallweit -Reviewed-by: Simon Horman -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/realtek/r8169_main.c | 44 +++++++++++++++++++++++ - 1 file changed, 44 insertions(+) - ---- a/drivers/net/ethernet/realtek/r8169_main.c -+++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -16,6 +16,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -5373,6 +5374,43 @@ static bool rtl_aspm_is_safe(struct rtl8 - return false; - } - -+static umode_t r8169_hwmon_is_visible(const void *drvdata, -+ enum hwmon_sensor_types type, -+ u32 attr, int channel) -+{ -+ return 0444; -+} -+ -+static int r8169_hwmon_read(struct device *dev, enum hwmon_sensor_types type, -+ u32 attr, int channel, long *val) -+{ -+ struct rtl8169_private *tp = dev_get_drvdata(dev); -+ int val_raw; -+ -+ val_raw = phy_read_paged(tp->phydev, 0xbd8, 0x12) & 0x3ff; -+ if (val_raw >= 512) -+ val_raw -= 1024; -+ -+ *val = 1000 * val_raw / 2; -+ -+ return 0; -+} -+ -+static const struct hwmon_ops r8169_hwmon_ops = { -+ .is_visible = r8169_hwmon_is_visible, -+ .read = r8169_hwmon_read, -+}; -+ -+static const struct hwmon_channel_info * const r8169_hwmon_info[] = { -+ HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT), -+ NULL -+}; -+ -+static const struct hwmon_chip_info r8169_hwmon_chip_info = { -+ .ops = &r8169_hwmon_ops, -+ .info = r8169_hwmon_info, -+}; -+ - static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) - { - struct rtl8169_private *tp; -@@ -5547,6 +5585,12 @@ static int rtl_init_one(struct pci_dev * - if (rc) - return rc; - -+ /* The temperature sensor is available from RTl8125B */ -+ if (IS_REACHABLE(CONFIG_HWMON) && tp->mac_version >= RTL_GIGA_MAC_VER_63) -+ /* ignore errors */ -+ devm_hwmon_device_register_with_info(&pdev->dev, "nic_temp", tp, -+ &r8169_hwmon_chip_info, -+ NULL); - rc = register_netdev(dev); - if (rc) - return rc; diff --git a/target/linux/generic/backport-6.6/780-25-v6.13-r8169-remove-original-workaround-for-RTL8125-broken-.patch b/target/linux/generic/backport-6.6/780-25-v6.13-r8169-remove-original-workaround-for-RTL8125-broken-.patch index 8c6e6d8dc41bb8..dbf66bb81e8a2c 100644 --- a/target/linux/generic/backport-6.6/780-25-v6.13-r8169-remove-original-workaround-for-RTL8125-broken-.patch +++ b/target/linux/generic/backport-6.6/780-25-v6.13-r8169-remove-original-workaround-for-RTL8125-broken-.patch @@ -19,7 +19,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -4779,11 +4779,7 @@ static void r8169_phylink_handler(struct +@@ -4778,11 +4778,7 @@ static void r8169_phylink_handler(struct if (netif_carrier_ok(ndev)) { rtl_link_chg_patch(tp); pm_request_resume(d); diff --git a/target/linux/generic/backport-6.6/780-26-v6.13-r8169-enable-SG-TSO-on-selected-chip-versions-per-de.patch b/target/linux/generic/backport-6.6/780-26-v6.13-r8169-enable-SG-TSO-on-selected-chip-versions-per-de.patch index dc05299628eda5..4b00eba62239e7 100644 --- a/target/linux/generic/backport-6.6/780-26-v6.13-r8169-enable-SG-TSO-on-selected-chip-versions-per-de.patch +++ b/target/linux/generic/backport-6.6/780-26-v6.13-r8169-enable-SG-TSO-on-selected-chip-versions-per-de.patch @@ -20,7 +20,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -5529,11 +5529,6 @@ static int rtl_init_one(struct pci_dev * +@@ -5491,11 +5491,6 @@ static int rtl_init_one(struct pci_dev * dev->features |= dev->hw_features; @@ -32,7 +32,7 @@ Signed-off-by: David S. Miller if (rtl_chip_supports_csum_v2(tp)) { dev->hw_features |= NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6; netif_set_tso_max_size(dev, RTL_GSO_MAX_SIZE_V2); -@@ -5544,6 +5539,17 @@ static int rtl_init_one(struct pci_dev * +@@ -5506,6 +5501,17 @@ static int rtl_init_one(struct pci_dev * netif_set_tso_max_segs(dev, RTL_GSO_MAX_SEGS_V1); } diff --git a/target/linux/generic/backport-6.6/780-27-v6.13-r8169-implement-additional-ethtool-stats-ops.patch b/target/linux/generic/backport-6.6/780-27-v6.13-r8169-implement-additional-ethtool-stats-ops.patch index faab0df7f400e2..29c8527b1cb95d 100644 --- a/target/linux/generic/backport-6.6/780-27-v6.13-r8169-implement-additional-ethtool-stats-ops.patch +++ b/target/linux/generic/backport-6.6/780-27-v6.13-r8169-implement-additional-ethtool-stats-ops.patch @@ -16,7 +16,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -2162,6 +2162,19 @@ static void rtl8169_get_ringparam(struct +@@ -2161,6 +2161,19 @@ static void rtl8169_get_ringparam(struct data->tx_pending = NUM_TX_DESC; } @@ -36,7 +36,7 @@ Signed-off-by: Jakub Kicinski static void rtl8169_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam *data) { -@@ -2188,6 +2201,69 @@ static int rtl8169_set_pauseparam(struct +@@ -2187,6 +2200,69 @@ static int rtl8169_set_pauseparam(struct return 0; } @@ -106,7 +106,7 @@ Signed-off-by: Jakub Kicinski static const struct ethtool_ops rtl8169_ethtool_ops = { .supported_coalesce_params = ETHTOOL_COALESCE_USECS | ETHTOOL_COALESCE_MAX_FRAMES, -@@ -2209,8 +2285,11 @@ static const struct ethtool_ops rtl8169_ +@@ -2208,8 +2284,11 @@ static const struct ethtool_ops rtl8169_ .get_link_ksettings = phy_ethtool_get_link_ksettings, .set_link_ksettings = phy_ethtool_set_link_ksettings, .get_ringparam = rtl8169_get_ringparam, @@ -118,7 +118,7 @@ Signed-off-by: Jakub Kicinski }; static enum mac_version rtl8169_get_mac_version(u16 xid, bool gmii) -@@ -3895,6 +3974,9 @@ static void rtl_hw_start_8125(struct rtl +@@ -3894,6 +3973,9 @@ static void rtl_hw_start_8125(struct rtl break; } diff --git a/target/linux/generic/backport-6.6/780-28-v6.13-r8169-don-t-take-RTNL-lock-in-rtl_task.patch b/target/linux/generic/backport-6.6/780-28-v6.13-r8169-don-t-take-RTNL-lock-in-rtl_task.patch index 38b5035441f039..3e495e19defbdd 100644 --- a/target/linux/generic/backport-6.6/780-28-v6.13-r8169-don-t-take-RTNL-lock-in-rtl_task.patch +++ b/target/linux/generic/backport-6.6/780-28-v6.13-r8169-don-t-take-RTNL-lock-in-rtl_task.patch @@ -18,7 +18,7 @@ Signed-off-by: Andrew Lunn --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -4802,10 +4802,8 @@ static void rtl_task(struct work_struct +@@ -4801,10 +4801,8 @@ static void rtl_task(struct work_struct container_of(work, struct rtl8169_private, wk.work); int ret; @@ -30,7 +30,7 @@ Signed-off-by: Andrew Lunn if (test_and_clear_bit(RTL_FLAG_TASK_TX_TIMEOUT, tp->wk.flags)) { /* if chip isn't accessible, reset bus to revive it */ -@@ -4814,7 +4812,7 @@ static void rtl_task(struct work_struct +@@ -4813,7 +4811,7 @@ static void rtl_task(struct work_struct if (ret < 0) { netdev_err(tp->dev, "Can't reset secondary PCI bus, detach NIC\n"); netif_device_detach(tp->dev); @@ -39,7 +39,7 @@ Signed-off-by: Andrew Lunn } } -@@ -4833,8 +4831,6 @@ reset: +@@ -4832,8 +4830,6 @@ reset: } else if (test_and_clear_bit(RTL_FLAG_TASK_RESET_NO_QUEUE_WAKE, tp->wk.flags)) { rtl_reset_work(tp); } diff --git a/target/linux/generic/backport-6.6/780-31-v6.13-r8169-remove-rtl_dash_loop_wait_high-low.patch b/target/linux/generic/backport-6.6/780-31-v6.13-r8169-remove-rtl_dash_loop_wait_high-low.patch index 4792e371b6316b..0c0e80c92dc197 100644 --- a/target/linux/generic/backport-6.6/780-31-v6.13-r8169-remove-rtl_dash_loop_wait_high-low.patch +++ b/target/linux/generic/backport-6.6/780-31-v6.13-r8169-remove-rtl_dash_loop_wait_high-low.patch @@ -15,7 +15,7 @@ Signed-off-by: Andrew Lunn --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -1347,40 +1347,19 @@ static void rtl8168ep_stop_cmac(struct r +@@ -1346,40 +1346,19 @@ static void rtl8168ep_stop_cmac(struct r RTL_W8(tp, IBCR0, RTL_R8(tp, IBCR0) & ~0x01); } @@ -60,7 +60,7 @@ Signed-off-by: Andrew Lunn } static void rtl8168_driver_start(struct rtl8169_private *tp) -@@ -1394,7 +1373,8 @@ static void rtl8168_driver_start(struct +@@ -1393,7 +1372,8 @@ static void rtl8168_driver_start(struct static void rtl8168dp_driver_stop(struct rtl8169_private *tp) { r8168dp_oob_notify(tp, OOB_CMD_DRIVER_STOP); @@ -70,7 +70,7 @@ Signed-off-by: Andrew Lunn } static void rtl8168ep_driver_stop(struct rtl8169_private *tp) -@@ -1402,7 +1382,8 @@ static void rtl8168ep_driver_stop(struct +@@ -1401,7 +1381,8 @@ static void rtl8168ep_driver_stop(struct rtl8168ep_stop_cmac(tp); r8168ep_ocp_write(tp, 0x01, 0x180, OOB_CMD_DRIVER_STOP); r8168ep_ocp_write(tp, 0x01, 0x30, r8168ep_ocp_read(tp, 0x30) | 0x01); diff --git a/target/linux/generic/backport-6.6/780-33-v6.13-r8169-add-support-for-RTL8125D.patch b/target/linux/generic/backport-6.6/780-33-v6.13-r8169-add-support-for-RTL8125D.patch index 81058e5e9f7641..687ed445dafb0e 100644 --- a/target/linux/generic/backport-6.6/780-33-v6.13-r8169-add-support-for-RTL8125D.patch +++ b/target/linux/generic/backport-6.6/780-33-v6.13-r8169-add-support-for-RTL8125D.patch @@ -29,7 +29,7 @@ Signed-off-by: Jakub Kicinski RTL_GIGA_MAC_NONE --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -56,6 +56,7 @@ +@@ -55,6 +55,7 @@ #define FIRMWARE_8107E_2 "rtl_nic/rtl8107e-2.fw" #define FIRMWARE_8125A_3 "rtl_nic/rtl8125a-3.fw" #define FIRMWARE_8125B_2 "rtl_nic/rtl8125b-2.fw" @@ -37,7 +37,7 @@ Signed-off-by: Jakub Kicinski #define FIRMWARE_8126A_2 "rtl_nic/rtl8126a-2.fw" #define FIRMWARE_8126A_3 "rtl_nic/rtl8126a-3.fw" -@@ -139,6 +140,7 @@ static const struct { +@@ -138,6 +139,7 @@ static const struct { [RTL_GIGA_MAC_VER_61] = {"RTL8125A", FIRMWARE_8125A_3}, /* reserve 62 for CFG_METHOD_4 in the vendor driver */ [RTL_GIGA_MAC_VER_63] = {"RTL8125B", FIRMWARE_8125B_2}, @@ -45,7 +45,7 @@ Signed-off-by: Jakub Kicinski [RTL_GIGA_MAC_VER_65] = {"RTL8126A", FIRMWARE_8126A_2}, [RTL_GIGA_MAC_VER_66] = {"RTL8126A", FIRMWARE_8126A_3}, }; -@@ -708,6 +710,7 @@ MODULE_FIRMWARE(FIRMWARE_8168FP_3); +@@ -707,6 +709,7 @@ MODULE_FIRMWARE(FIRMWARE_8168FP_3); MODULE_FIRMWARE(FIRMWARE_8107E_2); MODULE_FIRMWARE(FIRMWARE_8125A_3); MODULE_FIRMWARE(FIRMWARE_8125B_2); @@ -53,7 +53,7 @@ Signed-off-by: Jakub Kicinski MODULE_FIRMWARE(FIRMWARE_8126A_2); MODULE_FIRMWARE(FIRMWARE_8126A_3); -@@ -2080,10 +2083,7 @@ static void rtl_set_eee_txidle_timer(str +@@ -2079,10 +2082,7 @@ static void rtl_set_eee_txidle_timer(str tp->tx_lpi_timer = timer_val; r8168_mac_ocp_write(tp, 0xe048, timer_val); break; @@ -65,7 +65,7 @@ Signed-off-by: Jakub Kicinski tp->tx_lpi_timer = timer_val; RTL_W16(tp, EEE_TXIDLE_TIMER_8125, timer_val); break; -@@ -2295,6 +2295,9 @@ static enum mac_version rtl8169_get_mac_ +@@ -2294,6 +2294,9 @@ static enum mac_version rtl8169_get_mac_ { 0x7cf, 0x64a, RTL_GIGA_MAC_VER_66 }, { 0x7cf, 0x649, RTL_GIGA_MAC_VER_65 }, @@ -75,7 +75,7 @@ Signed-off-by: Jakub Kicinski /* 8125B family. */ { 0x7cf, 0x641, RTL_GIGA_MAC_VER_63 }, -@@ -2562,9 +2565,7 @@ static void rtl_init_rxcfg(struct rtl816 +@@ -2561,9 +2564,7 @@ static void rtl_init_rxcfg(struct rtl816 case RTL_GIGA_MAC_VER_61: RTL_W32(tp, RxConfig, RX_FETCH_DFLT_8125 | RX_DMA_BURST); break; @@ -86,7 +86,7 @@ Signed-off-by: Jakub Kicinski RTL_W32(tp, RxConfig, RX_FETCH_DFLT_8125 | RX_DMA_BURST | RX_PAUSE_SLOT_ON); break; -@@ -3876,6 +3877,12 @@ static void rtl_hw_start_8125b(struct rt +@@ -3875,6 +3876,12 @@ static void rtl_hw_start_8125b(struct rt rtl_hw_start_8125_common(tp); } @@ -99,7 +99,7 @@ Signed-off-by: Jakub Kicinski static void rtl_hw_start_8126a(struct rtl8169_private *tp) { rtl_set_def_aspm_entry_latency(tp); -@@ -3924,6 +3931,7 @@ static void rtl_hw_config(struct rtl8169 +@@ -3923,6 +3930,7 @@ static void rtl_hw_config(struct rtl8169 [RTL_GIGA_MAC_VER_53] = rtl_hw_start_8117, [RTL_GIGA_MAC_VER_61] = rtl_hw_start_8125a_2, [RTL_GIGA_MAC_VER_63] = rtl_hw_start_8125b, @@ -107,7 +107,7 @@ Signed-off-by: Jakub Kicinski [RTL_GIGA_MAC_VER_65] = rtl_hw_start_8126a, [RTL_GIGA_MAC_VER_66] = rtl_hw_start_8126a, }; -@@ -3941,6 +3949,7 @@ static void rtl_hw_start_8125(struct rtl +@@ -3940,6 +3948,7 @@ static void rtl_hw_start_8125(struct rtl /* disable interrupt coalescing */ switch (tp->mac_version) { case RTL_GIGA_MAC_VER_61: diff --git a/target/linux/generic/backport-6.6/780-34-v6.13-r8169-fix-inconsistent-indenting-in-rtl8169_get_eth_.patch b/target/linux/generic/backport-6.6/780-34-v6.13-r8169-fix-inconsistent-indenting-in-rtl8169_get_eth_.patch index 721e51ebf056e9..2f65f066af1287 100644 --- a/target/linux/generic/backport-6.6/780-34-v6.13-r8169-fix-inconsistent-indenting-in-rtl8169_get_eth_.patch +++ b/target/linux/generic/backport-6.6/780-34-v6.13-r8169-fix-inconsistent-indenting-in-rtl8169_get_eth_.patch @@ -19,7 +19,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -2227,7 +2227,7 @@ static void rtl8169_get_eth_mac_stats(st +@@ -2226,7 +2226,7 @@ static void rtl8169_get_eth_mac_stats(st le64_to_cpu(tp->counters->tx_broadcast64); mac_stats->MulticastFramesReceivedOK = le64_to_cpu(tp->counters->rx_multicast64); diff --git a/target/linux/generic/backport-6.6/780-38-v6.13-r8169-improve-initialization-of-RSS-registers-on-RTL.patch b/target/linux/generic/backport-6.6/780-38-v6.13-r8169-improve-initialization-of-RSS-registers-on-RTL.patch index 8cb79c82cf3a37..c2f6d755a5cb21 100644 --- a/target/linux/generic/backport-6.6/780-38-v6.13-r8169-improve-initialization-of-RSS-registers-on-RTL.patch +++ b/target/linux/generic/backport-6.6/780-38-v6.13-r8169-improve-initialization-of-RSS-registers-on-RTL.patch @@ -16,7 +16,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -347,6 +347,8 @@ enum rtl8125_registers { +@@ -346,6 +346,8 @@ enum rtl8125_registers { TxPoll_8125 = 0x90, LEDSEL3 = 0x96, MAC0_BKP = 0x19e0, @@ -25,7 +25,7 @@ Signed-off-by: Jakub Kicinski EEE_TXIDLE_TIMER_8125 = 0x6048, }; -@@ -3770,8 +3772,8 @@ static void rtl_hw_start_8125_common(str +@@ -3769,8 +3771,8 @@ static void rtl_hw_start_8125_common(str rtl_pcie_state_l2l3_disable(tp); RTL_W16(tp, 0x382, 0x221b); diff --git a/target/linux/generic/backport-6.6/780-39-v6.13-r8169-remove-leftover-locks-after-reverted-change.patch b/target/linux/generic/backport-6.6/780-39-v6.13-r8169-remove-leftover-locks-after-reverted-change.patch index 20c42955e36d46..c3e93989016214 100644 --- a/target/linux/generic/backport-6.6/780-39-v6.13-r8169-remove-leftover-locks-after-reverted-change.patch +++ b/target/linux/generic/backport-6.6/780-39-v6.13-r8169-remove-leftover-locks-after-reverted-change.patch @@ -15,7 +15,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -663,13 +663,9 @@ struct rtl8169_private { +@@ -662,13 +662,9 @@ struct rtl8169_private { struct work_struct work; } wk; @@ -29,7 +29,7 @@ Signed-off-by: Jakub Kicinski unsigned supports_gmii:1; unsigned aspm_manageable:1; unsigned dash_enabled:1; -@@ -723,22 +719,12 @@ static inline struct device *tp_to_dev(s +@@ -722,22 +718,12 @@ static inline struct device *tp_to_dev(s static void rtl_lock_config_regs(struct rtl8169_private *tp) { @@ -54,7 +54,7 @@ Signed-off-by: Jakub Kicinski } static void rtl_pci_commit(struct rtl8169_private *tp) -@@ -749,24 +735,18 @@ static void rtl_pci_commit(struct rtl816 +@@ -748,24 +734,18 @@ static void rtl_pci_commit(struct rtl816 static void rtl_mod_config2(struct rtl8169_private *tp, u8 clear, u8 set) { @@ -79,7 +79,7 @@ Signed-off-by: Jakub Kicinski } static bool rtl_is_8125(struct rtl8169_private *tp) -@@ -1572,7 +1552,6 @@ static void __rtl8169_set_wol(struct rtl +@@ -1571,7 +1551,6 @@ static void __rtl8169_set_wol(struct rtl { WAKE_MAGIC, Config3, MagicPacket } }; unsigned int i, tmp = ARRAY_SIZE(cfg); @@ -87,7 +87,7 @@ Signed-off-by: Jakub Kicinski u8 options; rtl_unlock_config_regs(tp); -@@ -1591,14 +1570,12 @@ static void __rtl8169_set_wol(struct rtl +@@ -1590,14 +1569,12 @@ static void __rtl8169_set_wol(struct rtl r8168_mac_ocp_modify(tp, 0xc0b6, BIT(0), 0); } @@ -102,7 +102,7 @@ Signed-off-by: Jakub Kicinski switch (tp->mac_version) { case RTL_GIGA_MAC_VER_02 ... RTL_GIGA_MAC_VER_06: -@@ -5498,8 +5475,6 @@ static int rtl_init_one(struct pci_dev * +@@ -5460,8 +5437,6 @@ static int rtl_init_one(struct pci_dev * tp->supports_gmii = ent->driver_data == RTL_CFG_NO_GBIT ? 0 : 1; tp->ocp_base = OCP_STD_PHY_BASE; diff --git a/target/linux/generic/backport-6.6/780-40-v6.13-r8169-improve-__rtl8169_set_wol.patch b/target/linux/generic/backport-6.6/780-40-v6.13-r8169-improve-__rtl8169_set_wol.patch index 8c88c078f29f57..e468d637c93815 100644 --- a/target/linux/generic/backport-6.6/780-40-v6.13-r8169-improve-__rtl8169_set_wol.patch +++ b/target/linux/generic/backport-6.6/780-40-v6.13-r8169-improve-__rtl8169_set_wol.patch @@ -16,7 +16,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -749,6 +749,20 @@ static void rtl_mod_config5(struct rtl81 +@@ -748,6 +748,20 @@ static void rtl_mod_config5(struct rtl81 RTL_W8(tp, Config5, (val & ~clear) | set); } @@ -37,7 +37,7 @@ Signed-off-by: Jakub Kicinski static bool rtl_is_8125(struct rtl8169_private *tp) { return tp->mac_version >= RTL_GIGA_MAC_VER_61; -@@ -1539,58 +1553,37 @@ static void rtl8169_get_wol(struct net_d +@@ -1538,58 +1552,37 @@ static void rtl8169_get_wol(struct net_d static void __rtl8169_set_wol(struct rtl8169_private *tp, u32 wolopts) { diff --git a/target/linux/generic/backport-6.6/780-41-v6.13-r8169-improve-rtl_set_d3_pll_down.patch b/target/linux/generic/backport-6.6/780-41-v6.13-r8169-improve-rtl_set_d3_pll_down.patch index e7626173102023..aeafebb2140500 100644 --- a/target/linux/generic/backport-6.6/780-41-v6.13-r8169-improve-rtl_set_d3_pll_down.patch +++ b/target/linux/generic/backport-6.6/780-41-v6.13-r8169-improve-rtl_set_d3_pll_down.patch @@ -17,7 +17,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -1432,19 +1432,11 @@ static enum rtl_dash_type rtl_get_dash_t +@@ -1431,19 +1431,11 @@ static enum rtl_dash_type rtl_get_dash_t static void rtl_set_d3_pll_down(struct rtl8169_private *tp, bool enable) { diff --git a/target/linux/generic/backport-6.6/780-42-v6.13-r8169-align-WAKE_PHY-handling-with-r8125-r8126-vendo.patch b/target/linux/generic/backport-6.6/780-42-v6.13-r8169-align-WAKE_PHY-handling-with-r8125-r8126-vendo.patch index de86c2f6cd064e..26c362dd6ca260 100644 --- a/target/linux/generic/backport-6.6/780-42-v6.13-r8169-align-WAKE_PHY-handling-with-r8125-r8126-vendo.patch +++ b/target/linux/generic/backport-6.6/780-42-v6.13-r8169-align-WAKE_PHY-handling-with-r8125-r8126-vendo.patch @@ -17,7 +17,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -1563,6 +1563,9 @@ static void __rtl8169_set_wol(struct rtl +@@ -1562,6 +1562,9 @@ static void __rtl8169_set_wol(struct rtl } r8169_mod_reg8_cond(tp, Config3, LinkUp, wolopts & WAKE_PHY); diff --git a/target/linux/generic/backport-6.6/780-43-v6.13-r8169-use-helper-r8169_mod_reg8_cond-to-simplify-rtl.patch b/target/linux/generic/backport-6.6/780-43-v6.13-r8169-use-helper-r8169_mod_reg8_cond-to-simplify-rtl.patch index 5bcf06098a88ee..bdeb46eeb85146 100644 --- a/target/linux/generic/backport-6.6/780-43-v6.13-r8169-use-helper-r8169_mod_reg8_cond-to-simplify-rtl.patch +++ b/target/linux/generic/backport-6.6/780-43-v6.13-r8169-use-helper-r8169_mod_reg8_cond-to-simplify-rtl.patch @@ -17,7 +17,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -2547,86 +2547,31 @@ static void rtl8169_init_ring_indexes(st +@@ -2546,86 +2546,31 @@ static void rtl8169_init_ring_indexes(st tp->dirty_tx = tp->cur_tx = tp->cur_rx = 0; } From 7cace002baaf5dc91c9c716c99597fcd65b30b61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Fri, 17 Jan 2025 09:56:34 +0100 Subject: [PATCH 371/877] generic: backport Realtek PHY patches from upstream MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds patches for the temperature sensor on RTL822x. Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit d7e82c78d7a2a84404198dab8faf8e142939eb05) --- package/kernel/linux/modules/netdevices.mk | 7 +- ...add-support-for-reading-MDIO_MMD_VEN.patch | 47 + ...ltek-PHY-driver-to-its-own-subdirect.patch | 3249 +++++++++++++++++ ...add-hwmon-support-for-temp-sensor-on.patch | 180 + ...-use-genphy_soft_reset-for-2.5G-PHYs.patch | 22 +- ...sable-SGMII-in-band-AN-for-2-5G-PHYs.patch | 10 +- ...make-sure-paged-read-is-protected-by.patch | 8 +- ...-phy-realtek-introduce-rtl822x_probe.patch | 36 +- ...tek-detect-early-version-of-RTL8221B.patch | 6 +- ...ealtek-support-interrupt-of-RTL8221B.patch | 24 +- .../500-gsw-rtl8367s-mt7622-support.patch | 4 +- .../735-net-phy-realtek-rtl8261n.patch | 8 +- .../realtek/patches-6.6/720-add-rtl-phy.patch | 8 +- 13 files changed, 3543 insertions(+), 66 deletions(-) create mode 100644 target/linux/generic/backport-6.6/781-20-v6.14-net-phy-realtek-add-support-for-reading-MDIO_MMD_VEN.patch create mode 100644 target/linux/generic/backport-6.6/781-21-v6.14-net-phy-move-realtek-PHY-driver-to-its-own-subdirect.patch create mode 100644 target/linux/generic/backport-6.6/781-22-v6.14-net-phy-realtek-add-hwmon-support-for-temp-sensor-on.patch diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk index a72ca1d89b3d25..4cfda093ca0427 100644 --- a/package/kernel/linux/modules/netdevices.mk +++ b/package/kernel/linux/modules/netdevices.mk @@ -447,9 +447,10 @@ $(eval $(call KernelPackage,phy-micrel)) define KernelPackage/phy-realtek SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Realtek Ethernet PHY driver - KCONFIG:=CONFIG_REALTEK_PHY - DEPENDS:=+kmod-libphy - FILES:=$(LINUX_DIR)/drivers/net/phy/realtek.ko + KCONFIG:=CONFIG_REALTEK_PHY \ + CONFIG_REALTEK_PHY_HWMON=y + DEPENDS:=+kmod-libphy +kmod-hwmon-core + FILES:=$(LINUX_DIR)/drivers/net/phy/realtek/realtek.ko AUTOLOAD:=$(call AutoLoad,18,realtek,1) endef diff --git a/target/linux/generic/backport-6.6/781-20-v6.14-net-phy-realtek-add-support-for-reading-MDIO_MMD_VEN.patch b/target/linux/generic/backport-6.6/781-20-v6.14-net-phy-realtek-add-support-for-reading-MDIO_MMD_VEN.patch new file mode 100644 index 00000000000000..2add672f441a9d --- /dev/null +++ b/target/linux/generic/backport-6.6/781-20-v6.14-net-phy-realtek-add-support-for-reading-MDIO_MMD_VEN.patch @@ -0,0 +1,47 @@ +From 3d483a10327f38595f714f9f9e9dde43a622cb0f Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Sat, 11 Jan 2025 21:49:31 +0100 +Subject: [PATCH] net: phy: realtek: add support for reading MDIO_MMD_VEND2 + regs on RTL8125/RTL8126 + +RTL8125/RTL8126 don't support MMD access to the internal PHY, but +provide a mechanism to access at least all MDIO_MMD_VEND2 registers. +By exposing this mechanism standard MMD access functions can be used +to access the MDIO_MMD_VEND2 registers. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Andrew Lunn +Link: https://patch.msgid.link/e821b302-5fe6-49ab-aabd-05da500581c0@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/phy/realtek.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +--- a/drivers/net/phy/realtek.c ++++ b/drivers/net/phy/realtek.c +@@ -736,7 +736,11 @@ static int rtlgen_read_mmd(struct phy_de + { + int ret; + +- if (devnum == MDIO_MMD_PCS && regnum == MDIO_PCS_EEE_ABLE) { ++ if (devnum == MDIO_MMD_VEND2) { ++ rtl821x_write_page(phydev, regnum >> 4); ++ ret = __phy_read(phydev, 0x10 + ((regnum & 0xf) >> 1)); ++ rtl821x_write_page(phydev, 0); ++ } else if (devnum == MDIO_MMD_PCS && regnum == MDIO_PCS_EEE_ABLE) { + rtl821x_write_page(phydev, 0xa5c); + ret = __phy_read(phydev, 0x12); + rtl821x_write_page(phydev, 0); +@@ -760,7 +764,11 @@ static int rtlgen_write_mmd(struct phy_d + { + int ret; + +- if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV) { ++ if (devnum == MDIO_MMD_VEND2) { ++ rtl821x_write_page(phydev, regnum >> 4); ++ ret = __phy_write(phydev, 0x10 + ((regnum & 0xf) >> 1), val); ++ rtl821x_write_page(phydev, 0); ++ } else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV) { + rtl821x_write_page(phydev, 0xa5d); + ret = __phy_write(phydev, 0x10, val); + rtl821x_write_page(phydev, 0); diff --git a/target/linux/generic/backport-6.6/781-21-v6.14-net-phy-move-realtek-PHY-driver-to-its-own-subdirect.patch b/target/linux/generic/backport-6.6/781-21-v6.14-net-phy-move-realtek-PHY-driver-to-its-own-subdirect.patch new file mode 100644 index 00000000000000..b410ab8a32bcc0 --- /dev/null +++ b/target/linux/generic/backport-6.6/781-21-v6.14-net-phy-move-realtek-PHY-driver-to-its-own-subdirect.patch @@ -0,0 +1,3249 @@ +From 1416a9b2ba710d31954131c06d46f298e340aa2c Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Sat, 11 Jan 2025 21:50:19 +0100 +Subject: [PATCH] net: phy: move realtek PHY driver to its own subdirectory + +In preparation of adding a source file with hwmon support, move the +Realtek PHY driver to its own subdirectory and rename realtek.c to +realtek_main.c. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Andrew Lunn +Link: https://patch.msgid.link/c566551b-c915-4e34-9b33-129a6ddd6e4c@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/phy/Kconfig | 5 +---- + drivers/net/phy/Makefile | 2 +- + drivers/net/phy/realtek/Kconfig | 5 +++++ + drivers/net/phy/realtek/Makefile | 3 +++ + drivers/net/phy/{realtek.c => realtek/realtek_main.c} | 0 + 5 files changed, 10 insertions(+), 5 deletions(-) + create mode 100644 drivers/net/phy/realtek/Kconfig + create mode 100644 drivers/net/phy/realtek/Makefile + rename drivers/net/phy/{realtek.c => realtek/realtek_main.c} (100%) + +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -325,10 +325,7 @@ config QSEMI_PHY + help + Currently supports the qs6612 + +-config REALTEK_PHY +- tristate "Realtek PHYs" +- help +- Supports the Realtek 821x PHY. ++source "drivers/net/phy/realtek/Kconfig" + + config RENESAS_PHY + tristate "Renesas PHYs" +--- a/drivers/net/phy/Makefile ++++ b/drivers/net/phy/Makefile +@@ -83,7 +83,7 @@ obj-$(CONFIG_NXP_CBTX_PHY) += nxp-cbtx.o + obj-$(CONFIG_NXP_TJA11XX_PHY) += nxp-tja11xx.o + obj-y += qcom/ + obj-$(CONFIG_QSEMI_PHY) += qsemi.o +-obj-$(CONFIG_REALTEK_PHY) += realtek.o ++obj-$(CONFIG_REALTEK_PHY) += realtek/ + obj-$(CONFIG_RENESAS_PHY) += uPD60620.o + obj-$(CONFIG_ROCKCHIP_PHY) += rockchip.o + obj-$(CONFIG_SMSC_PHY) += smsc.o +--- /dev/null ++++ b/drivers/net/phy/realtek/Kconfig +@@ -0,0 +1,5 @@ ++# SPDX-License-Identifier: GPL-2.0-only ++config REALTEK_PHY ++ tristate "Realtek PHYs" ++ help ++ Currently supports RTL821x/RTL822x and fast ethernet PHYs +--- /dev/null ++++ b/drivers/net/phy/realtek/Makefile +@@ -0,0 +1,3 @@ ++# SPDX-License-Identifier: GPL-2.0 ++realtek-y += realtek_main.o ++obj-$(CONFIG_REALTEK_PHY) += realtek.o +--- a/drivers/net/phy/realtek.c ++++ /dev/null +@@ -1,1590 +0,0 @@ +-// SPDX-License-Identifier: GPL-2.0+ +-/* drivers/net/phy/realtek.c +- * +- * Driver for Realtek PHYs +- * +- * Author: Johnson Leung +- * +- * Copyright (c) 2004 Freescale Semiconductor, Inc. +- */ +-#include +-#include +-#include +-#include +-#include +-#include +- +-#define RTL821x_PHYSR 0x11 +-#define RTL821x_PHYSR_DUPLEX BIT(13) +-#define RTL821x_PHYSR_SPEED GENMASK(15, 14) +- +-#define RTL821x_INER 0x12 +-#define RTL8211B_INER_INIT 0x6400 +-#define RTL8211E_INER_LINK_STATUS BIT(10) +-#define RTL8211F_INER_LINK_STATUS BIT(4) +- +-#define RTL821x_INSR 0x13 +- +-#define RTL821x_EXT_PAGE_SELECT 0x1e +-#define RTL821x_PAGE_SELECT 0x1f +- +-#define RTL8211F_PHYCR1 0x18 +-#define RTL8211F_PHYCR2 0x19 +-#define RTL8211F_INSR 0x1d +- +-#define RTL8211F_LEDCR 0x10 +-#define RTL8211F_LEDCR_MODE BIT(15) +-#define RTL8211F_LEDCR_ACT_TXRX BIT(4) +-#define RTL8211F_LEDCR_LINK_1000 BIT(3) +-#define RTL8211F_LEDCR_LINK_100 BIT(1) +-#define RTL8211F_LEDCR_LINK_10 BIT(0) +-#define RTL8211F_LEDCR_MASK GENMASK(4, 0) +-#define RTL8211F_LEDCR_SHIFT 5 +- +-#define RTL8211F_TX_DELAY BIT(8) +-#define RTL8211F_RX_DELAY BIT(3) +- +-#define RTL8211F_ALDPS_PLL_OFF BIT(1) +-#define RTL8211F_ALDPS_ENABLE BIT(2) +-#define RTL8211F_ALDPS_XTAL_OFF BIT(12) +- +-#define RTL8211E_CTRL_DELAY BIT(13) +-#define RTL8211E_TX_DELAY BIT(12) +-#define RTL8211E_RX_DELAY BIT(11) +- +-#define RTL8211F_CLKOUT_EN BIT(0) +- +-#define RTL8201F_ISR 0x1e +-#define RTL8201F_ISR_ANERR BIT(15) +-#define RTL8201F_ISR_DUPLEX BIT(13) +-#define RTL8201F_ISR_LINK BIT(11) +-#define RTL8201F_ISR_MASK (RTL8201F_ISR_ANERR | \ +- RTL8201F_ISR_DUPLEX | \ +- RTL8201F_ISR_LINK) +-#define RTL8201F_IER 0x13 +- +-#define RTL822X_VND1_SERDES_OPTION 0x697a +-#define RTL822X_VND1_SERDES_OPTION_MODE_MASK GENMASK(5, 0) +-#define RTL822X_VND1_SERDES_OPTION_MODE_2500BASEX_SGMII 0 +-#define RTL822X_VND1_SERDES_OPTION_MODE_2500BASEX 2 +- +-#define RTL822X_VND1_SERDES_CTRL3 0x7580 +-#define RTL822X_VND1_SERDES_CTRL3_MODE_MASK GENMASK(5, 0) +-#define RTL822X_VND1_SERDES_CTRL3_MODE_SGMII 0x02 +-#define RTL822X_VND1_SERDES_CTRL3_MODE_2500BASEX 0x16 +- +-/* RTL822X_VND2_XXXXX registers are only accessible when phydev->is_c45 +- * is set, they cannot be accessed by C45-over-C22. +- */ +-#define RTL822X_VND2_GBCR 0xa412 +- +-#define RTL822X_VND2_GANLPAR 0xa414 +- +-#define RTL8366RB_POWER_SAVE 0x15 +-#define RTL8366RB_POWER_SAVE_ON BIT(12) +- +-#define RTL9000A_GINMR 0x14 +-#define RTL9000A_GINMR_LINK_STATUS BIT(4) +- +-#define RTL_VND2_PHYSR 0xa434 +-#define RTL_VND2_PHYSR_DUPLEX BIT(3) +-#define RTL_VND2_PHYSR_SPEEDL GENMASK(5, 4) +-#define RTL_VND2_PHYSR_SPEEDH GENMASK(10, 9) +-#define RTL_VND2_PHYSR_MASTER BIT(11) +-#define RTL_VND2_PHYSR_SPEED_MASK (RTL_VND2_PHYSR_SPEEDL | RTL_VND2_PHYSR_SPEEDH) +- +-#define RTL_GENERIC_PHYID 0x001cc800 +-#define RTL_8211FVD_PHYID 0x001cc878 +-#define RTL_8221B 0x001cc840 +-#define RTL_8221B_VB_CG 0x001cc849 +-#define RTL_8221B_VN_CG 0x001cc84a +-#define RTL_8251B 0x001cc862 +- +-#define RTL8211F_LED_COUNT 3 +- +-MODULE_DESCRIPTION("Realtek PHY driver"); +-MODULE_AUTHOR("Johnson Leung"); +-MODULE_LICENSE("GPL"); +- +-struct rtl821x_priv { +- u16 phycr1; +- u16 phycr2; +- bool has_phycr2; +- struct clk *clk; +-}; +- +-static int rtl821x_read_page(struct phy_device *phydev) +-{ +- return __phy_read(phydev, RTL821x_PAGE_SELECT); +-} +- +-static int rtl821x_write_page(struct phy_device *phydev, int page) +-{ +- return __phy_write(phydev, RTL821x_PAGE_SELECT, page); +-} +- +-static int rtl821x_probe(struct phy_device *phydev) +-{ +- struct device *dev = &phydev->mdio.dev; +- struct rtl821x_priv *priv; +- u32 phy_id = phydev->drv->phy_id; +- int ret; +- +- priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); +- if (!priv) +- return -ENOMEM; +- +- priv->clk = devm_clk_get_optional_enabled(dev, NULL); +- if (IS_ERR(priv->clk)) +- return dev_err_probe(dev, PTR_ERR(priv->clk), +- "failed to get phy clock\n"); +- +- ret = phy_read_paged(phydev, 0xa43, RTL8211F_PHYCR1); +- if (ret < 0) +- return ret; +- +- priv->phycr1 = ret & (RTL8211F_ALDPS_PLL_OFF | RTL8211F_ALDPS_ENABLE | RTL8211F_ALDPS_XTAL_OFF); +- if (of_property_read_bool(dev->of_node, "realtek,aldps-enable")) +- priv->phycr1 |= RTL8211F_ALDPS_PLL_OFF | RTL8211F_ALDPS_ENABLE | RTL8211F_ALDPS_XTAL_OFF; +- +- priv->has_phycr2 = !(phy_id == RTL_8211FVD_PHYID); +- if (priv->has_phycr2) { +- ret = phy_read_paged(phydev, 0xa43, RTL8211F_PHYCR2); +- if (ret < 0) +- return ret; +- +- priv->phycr2 = ret & RTL8211F_CLKOUT_EN; +- if (of_property_read_bool(dev->of_node, "realtek,clkout-disable")) +- priv->phycr2 &= ~RTL8211F_CLKOUT_EN; +- } +- +- phydev->priv = priv; +- +- return 0; +-} +- +-static int rtl8201_ack_interrupt(struct phy_device *phydev) +-{ +- int err; +- +- err = phy_read(phydev, RTL8201F_ISR); +- +- return (err < 0) ? err : 0; +-} +- +-static int rtl821x_ack_interrupt(struct phy_device *phydev) +-{ +- int err; +- +- err = phy_read(phydev, RTL821x_INSR); +- +- return (err < 0) ? err : 0; +-} +- +-static int rtl8211f_ack_interrupt(struct phy_device *phydev) +-{ +- int err; +- +- err = phy_read_paged(phydev, 0xa43, RTL8211F_INSR); +- +- return (err < 0) ? err : 0; +-} +- +-static int rtl8201_config_intr(struct phy_device *phydev) +-{ +- u16 val; +- int err; +- +- if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { +- err = rtl8201_ack_interrupt(phydev); +- if (err) +- return err; +- +- val = BIT(13) | BIT(12) | BIT(11); +- err = phy_write_paged(phydev, 0x7, RTL8201F_IER, val); +- } else { +- val = 0; +- err = phy_write_paged(phydev, 0x7, RTL8201F_IER, val); +- if (err) +- return err; +- +- err = rtl8201_ack_interrupt(phydev); +- } +- +- return err; +-} +- +-static int rtl8211b_config_intr(struct phy_device *phydev) +-{ +- int err; +- +- if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { +- err = rtl821x_ack_interrupt(phydev); +- if (err) +- return err; +- +- err = phy_write(phydev, RTL821x_INER, +- RTL8211B_INER_INIT); +- } else { +- err = phy_write(phydev, RTL821x_INER, 0); +- if (err) +- return err; +- +- err = rtl821x_ack_interrupt(phydev); +- } +- +- return err; +-} +- +-static int rtl8211e_config_intr(struct phy_device *phydev) +-{ +- int err; +- +- if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { +- err = rtl821x_ack_interrupt(phydev); +- if (err) +- return err; +- +- err = phy_write(phydev, RTL821x_INER, +- RTL8211E_INER_LINK_STATUS); +- } else { +- err = phy_write(phydev, RTL821x_INER, 0); +- if (err) +- return err; +- +- err = rtl821x_ack_interrupt(phydev); +- } +- +- return err; +-} +- +-static int rtl8211f_config_intr(struct phy_device *phydev) +-{ +- u16 val; +- int err; +- +- if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { +- err = rtl8211f_ack_interrupt(phydev); +- if (err) +- return err; +- +- val = RTL8211F_INER_LINK_STATUS; +- err = phy_write_paged(phydev, 0xa42, RTL821x_INER, val); +- } else { +- val = 0; +- err = phy_write_paged(phydev, 0xa42, RTL821x_INER, val); +- if (err) +- return err; +- +- err = rtl8211f_ack_interrupt(phydev); +- } +- +- return err; +-} +- +-static irqreturn_t rtl8201_handle_interrupt(struct phy_device *phydev) +-{ +- int irq_status; +- +- irq_status = phy_read(phydev, RTL8201F_ISR); +- if (irq_status < 0) { +- phy_error(phydev); +- return IRQ_NONE; +- } +- +- if (!(irq_status & RTL8201F_ISR_MASK)) +- return IRQ_NONE; +- +- phy_trigger_machine(phydev); +- +- return IRQ_HANDLED; +-} +- +-static irqreturn_t rtl821x_handle_interrupt(struct phy_device *phydev) +-{ +- int irq_status, irq_enabled; +- +- irq_status = phy_read(phydev, RTL821x_INSR); +- if (irq_status < 0) { +- phy_error(phydev); +- return IRQ_NONE; +- } +- +- irq_enabled = phy_read(phydev, RTL821x_INER); +- if (irq_enabled < 0) { +- phy_error(phydev); +- return IRQ_NONE; +- } +- +- if (!(irq_status & irq_enabled)) +- return IRQ_NONE; +- +- phy_trigger_machine(phydev); +- +- return IRQ_HANDLED; +-} +- +-static irqreturn_t rtl8211f_handle_interrupt(struct phy_device *phydev) +-{ +- int irq_status; +- +- irq_status = phy_read_paged(phydev, 0xa43, RTL8211F_INSR); +- if (irq_status < 0) { +- phy_error(phydev); +- return IRQ_NONE; +- } +- +- if (!(irq_status & RTL8211F_INER_LINK_STATUS)) +- return IRQ_NONE; +- +- phy_trigger_machine(phydev); +- +- return IRQ_HANDLED; +-} +- +-static int rtl8211_config_aneg(struct phy_device *phydev) +-{ +- int ret; +- +- ret = genphy_config_aneg(phydev); +- if (ret < 0) +- return ret; +- +- /* Quirk was copied from vendor driver. Unfortunately it includes no +- * description of the magic numbers. +- */ +- if (phydev->speed == SPEED_100 && phydev->autoneg == AUTONEG_DISABLE) { +- phy_write(phydev, 0x17, 0x2138); +- phy_write(phydev, 0x0e, 0x0260); +- } else { +- phy_write(phydev, 0x17, 0x2108); +- phy_write(phydev, 0x0e, 0x0000); +- } +- +- return 0; +-} +- +-static int rtl8211c_config_init(struct phy_device *phydev) +-{ +- /* RTL8211C has an issue when operating in Gigabit slave mode */ +- return phy_set_bits(phydev, MII_CTRL1000, +- CTL1000_ENABLE_MASTER | CTL1000_AS_MASTER); +-} +- +-static int rtl8211f_config_init(struct phy_device *phydev) +-{ +- struct rtl821x_priv *priv = phydev->priv; +- struct device *dev = &phydev->mdio.dev; +- u16 val_txdly, val_rxdly; +- int ret; +- +- ret = phy_modify_paged_changed(phydev, 0xa43, RTL8211F_PHYCR1, +- RTL8211F_ALDPS_PLL_OFF | RTL8211F_ALDPS_ENABLE | RTL8211F_ALDPS_XTAL_OFF, +- priv->phycr1); +- if (ret < 0) { +- dev_err(dev, "aldps mode configuration failed: %pe\n", +- ERR_PTR(ret)); +- return ret; +- } +- +- switch (phydev->interface) { +- case PHY_INTERFACE_MODE_RGMII: +- val_txdly = 0; +- val_rxdly = 0; +- break; +- +- case PHY_INTERFACE_MODE_RGMII_RXID: +- val_txdly = 0; +- val_rxdly = RTL8211F_RX_DELAY; +- break; +- +- case PHY_INTERFACE_MODE_RGMII_TXID: +- val_txdly = RTL8211F_TX_DELAY; +- val_rxdly = 0; +- break; +- +- case PHY_INTERFACE_MODE_RGMII_ID: +- val_txdly = RTL8211F_TX_DELAY; +- val_rxdly = RTL8211F_RX_DELAY; +- break; +- +- default: /* the rest of the modes imply leaving delay as is. */ +- return 0; +- } +- +- ret = phy_modify_paged_changed(phydev, 0xd08, 0x11, RTL8211F_TX_DELAY, +- val_txdly); +- if (ret < 0) { +- dev_err(dev, "Failed to update the TX delay register\n"); +- return ret; +- } else if (ret) { +- dev_dbg(dev, +- "%s 2ns TX delay (and changing the value from pin-strapping RXD1 or the bootloader)\n", +- val_txdly ? "Enabling" : "Disabling"); +- } else { +- dev_dbg(dev, +- "2ns TX delay was already %s (by pin-strapping RXD1 or bootloader configuration)\n", +- val_txdly ? "enabled" : "disabled"); +- } +- +- ret = phy_modify_paged_changed(phydev, 0xd08, 0x15, RTL8211F_RX_DELAY, +- val_rxdly); +- if (ret < 0) { +- dev_err(dev, "Failed to update the RX delay register\n"); +- return ret; +- } else if (ret) { +- dev_dbg(dev, +- "%s 2ns RX delay (and changing the value from pin-strapping RXD0 or the bootloader)\n", +- val_rxdly ? "Enabling" : "Disabling"); +- } else { +- dev_dbg(dev, +- "2ns RX delay was already %s (by pin-strapping RXD0 or bootloader configuration)\n", +- val_rxdly ? "enabled" : "disabled"); +- } +- +- if (priv->has_phycr2) { +- ret = phy_modify_paged(phydev, 0xa43, RTL8211F_PHYCR2, +- RTL8211F_CLKOUT_EN, priv->phycr2); +- if (ret < 0) { +- dev_err(dev, "clkout configuration failed: %pe\n", +- ERR_PTR(ret)); +- return ret; +- } +- +- return genphy_soft_reset(phydev); +- } +- +- return 0; +-} +- +-static int rtl821x_suspend(struct phy_device *phydev) +-{ +- struct rtl821x_priv *priv = phydev->priv; +- int ret = 0; +- +- if (!phydev->wol_enabled) { +- ret = genphy_suspend(phydev); +- +- if (ret) +- return ret; +- +- clk_disable_unprepare(priv->clk); +- } +- +- return ret; +-} +- +-static int rtl821x_resume(struct phy_device *phydev) +-{ +- struct rtl821x_priv *priv = phydev->priv; +- int ret; +- +- if (!phydev->wol_enabled) +- clk_prepare_enable(priv->clk); +- +- ret = genphy_resume(phydev); +- if (ret < 0) +- return ret; +- +- msleep(20); +- +- return 0; +-} +- +-static int rtl8211f_led_hw_is_supported(struct phy_device *phydev, u8 index, +- unsigned long rules) +-{ +- const unsigned long mask = BIT(TRIGGER_NETDEV_LINK_10) | +- BIT(TRIGGER_NETDEV_LINK_100) | +- BIT(TRIGGER_NETDEV_LINK_1000) | +- BIT(TRIGGER_NETDEV_RX) | +- BIT(TRIGGER_NETDEV_TX); +- +- /* The RTL8211F PHY supports these LED settings on up to three LEDs: +- * - Link: Configurable subset of 10/100/1000 link rates +- * - Active: Blink on activity, RX or TX is not differentiated +- * The Active option has two modes, A and B: +- * - A: Link and Active indication at configurable, but matching, +- * subset of 10/100/1000 link rates +- * - B: Link indication at configurable subset of 10/100/1000 link +- * rates and Active indication always at all three 10+100+1000 +- * link rates. +- * This code currently uses mode B only. +- */ +- +- if (index >= RTL8211F_LED_COUNT) +- return -EINVAL; +- +- /* Filter out any other unsupported triggers. */ +- if (rules & ~mask) +- return -EOPNOTSUPP; +- +- /* RX and TX are not differentiated, either both are set or not set. */ +- if (!(rules & BIT(TRIGGER_NETDEV_RX)) ^ !(rules & BIT(TRIGGER_NETDEV_TX))) +- return -EOPNOTSUPP; +- +- return 0; +-} +- +-static int rtl8211f_led_hw_control_get(struct phy_device *phydev, u8 index, +- unsigned long *rules) +-{ +- int val; +- +- if (index >= RTL8211F_LED_COUNT) +- return -EINVAL; +- +- val = phy_read_paged(phydev, 0xd04, RTL8211F_LEDCR); +- if (val < 0) +- return val; +- +- val >>= RTL8211F_LEDCR_SHIFT * index; +- val &= RTL8211F_LEDCR_MASK; +- +- if (val & RTL8211F_LEDCR_LINK_10) +- set_bit(TRIGGER_NETDEV_LINK_10, rules); +- +- if (val & RTL8211F_LEDCR_LINK_100) +- set_bit(TRIGGER_NETDEV_LINK_100, rules); +- +- if (val & RTL8211F_LEDCR_LINK_1000) +- set_bit(TRIGGER_NETDEV_LINK_1000, rules); +- +- if (val & RTL8211F_LEDCR_ACT_TXRX) { +- set_bit(TRIGGER_NETDEV_RX, rules); +- set_bit(TRIGGER_NETDEV_TX, rules); +- } +- +- return 0; +-} +- +-static int rtl8211f_led_hw_control_set(struct phy_device *phydev, u8 index, +- unsigned long rules) +-{ +- const u16 mask = RTL8211F_LEDCR_MASK << (RTL8211F_LEDCR_SHIFT * index); +- u16 reg = 0; +- +- if (index >= RTL8211F_LED_COUNT) +- return -EINVAL; +- +- if (test_bit(TRIGGER_NETDEV_LINK_10, &rules)) +- reg |= RTL8211F_LEDCR_LINK_10; +- +- if (test_bit(TRIGGER_NETDEV_LINK_100, &rules)) +- reg |= RTL8211F_LEDCR_LINK_100; +- +- if (test_bit(TRIGGER_NETDEV_LINK_1000, &rules)) +- reg |= RTL8211F_LEDCR_LINK_1000; +- +- if (test_bit(TRIGGER_NETDEV_RX, &rules) || +- test_bit(TRIGGER_NETDEV_TX, &rules)) { +- reg |= RTL8211F_LEDCR_ACT_TXRX; +- } +- +- reg <<= RTL8211F_LEDCR_SHIFT * index; +- reg |= RTL8211F_LEDCR_MODE; /* Mode B */ +- +- return phy_modify_paged(phydev, 0xd04, RTL8211F_LEDCR, mask, reg); +-} +- +-static int rtl8211e_config_init(struct phy_device *phydev) +-{ +- int ret = 0, oldpage; +- u16 val; +- +- /* enable TX/RX delay for rgmii-* modes, and disable them for rgmii. */ +- switch (phydev->interface) { +- case PHY_INTERFACE_MODE_RGMII: +- val = RTL8211E_CTRL_DELAY | 0; +- break; +- case PHY_INTERFACE_MODE_RGMII_ID: +- val = RTL8211E_CTRL_DELAY | RTL8211E_TX_DELAY | RTL8211E_RX_DELAY; +- break; +- case PHY_INTERFACE_MODE_RGMII_RXID: +- val = RTL8211E_CTRL_DELAY | RTL8211E_RX_DELAY; +- break; +- case PHY_INTERFACE_MODE_RGMII_TXID: +- val = RTL8211E_CTRL_DELAY | RTL8211E_TX_DELAY; +- break; +- default: /* the rest of the modes imply leaving delays as is. */ +- return 0; +- } +- +- /* According to a sample driver there is a 0x1c config register on the +- * 0xa4 extension page (0x7) layout. It can be used to disable/enable +- * the RX/TX delays otherwise controlled by RXDLY/TXDLY pins. +- * The configuration register definition: +- * 14 = reserved +- * 13 = Force Tx RX Delay controlled by bit12 bit11, +- * 12 = RX Delay, 11 = TX Delay +- * 10:0 = Test && debug settings reserved by realtek +- */ +- oldpage = phy_select_page(phydev, 0x7); +- if (oldpage < 0) +- goto err_restore_page; +- +- ret = __phy_write(phydev, RTL821x_EXT_PAGE_SELECT, 0xa4); +- if (ret) +- goto err_restore_page; +- +- ret = __phy_modify(phydev, 0x1c, RTL8211E_CTRL_DELAY +- | RTL8211E_TX_DELAY | RTL8211E_RX_DELAY, +- val); +- +-err_restore_page: +- return phy_restore_page(phydev, oldpage, ret); +-} +- +-static int rtl8211b_suspend(struct phy_device *phydev) +-{ +- phy_write(phydev, MII_MMD_DATA, BIT(9)); +- +- return genphy_suspend(phydev); +-} +- +-static int rtl8211b_resume(struct phy_device *phydev) +-{ +- phy_write(phydev, MII_MMD_DATA, 0); +- +- return genphy_resume(phydev); +-} +- +-static int rtl8366rb_config_init(struct phy_device *phydev) +-{ +- int ret; +- +- ret = phy_set_bits(phydev, RTL8366RB_POWER_SAVE, +- RTL8366RB_POWER_SAVE_ON); +- if (ret) { +- dev_err(&phydev->mdio.dev, +- "error enabling power management\n"); +- } +- +- return ret; +-} +- +-/* get actual speed to cover the downshift case */ +-static void rtlgen_decode_physr(struct phy_device *phydev, int val) +-{ +- /* bit 3 +- * 0: Half Duplex +- * 1: Full Duplex +- */ +- if (val & RTL_VND2_PHYSR_DUPLEX) +- phydev->duplex = DUPLEX_FULL; +- else +- phydev->duplex = DUPLEX_HALF; +- +- switch (val & RTL_VND2_PHYSR_SPEED_MASK) { +- case 0x0000: +- phydev->speed = SPEED_10; +- break; +- case 0x0010: +- phydev->speed = SPEED_100; +- break; +- case 0x0020: +- phydev->speed = SPEED_1000; +- break; +- case 0x0200: +- phydev->speed = SPEED_10000; +- break; +- case 0x0210: +- phydev->speed = SPEED_2500; +- break; +- case 0x0220: +- phydev->speed = SPEED_5000; +- break; +- default: +- break; +- } +- +- /* bit 11 +- * 0: Slave Mode +- * 1: Master Mode +- */ +- if (phydev->speed >= 1000) { +- if (val & RTL_VND2_PHYSR_MASTER) +- phydev->master_slave_state = MASTER_SLAVE_STATE_MASTER; +- else +- phydev->master_slave_state = MASTER_SLAVE_STATE_SLAVE; +- } else { +- phydev->master_slave_state = MASTER_SLAVE_STATE_UNSUPPORTED; +- } +-} +- +-static int rtlgen_read_status(struct phy_device *phydev) +-{ +- int ret, val; +- +- ret = genphy_read_status(phydev); +- if (ret < 0) +- return ret; +- +- if (!phydev->link) +- return 0; +- +- val = phy_read_paged(phydev, 0xa43, 0x12); +- if (val < 0) +- return val; +- +- rtlgen_decode_physr(phydev, val); +- +- return 0; +-} +- +-static int rtlgen_read_mmd(struct phy_device *phydev, int devnum, u16 regnum) +-{ +- int ret; +- +- if (devnum == MDIO_MMD_VEND2) { +- rtl821x_write_page(phydev, regnum >> 4); +- ret = __phy_read(phydev, 0x10 + ((regnum & 0xf) >> 1)); +- rtl821x_write_page(phydev, 0); +- } else if (devnum == MDIO_MMD_PCS && regnum == MDIO_PCS_EEE_ABLE) { +- rtl821x_write_page(phydev, 0xa5c); +- ret = __phy_read(phydev, 0x12); +- rtl821x_write_page(phydev, 0); +- } else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV) { +- rtl821x_write_page(phydev, 0xa5d); +- ret = __phy_read(phydev, 0x10); +- rtl821x_write_page(phydev, 0); +- } else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_LPABLE) { +- rtl821x_write_page(phydev, 0xa5d); +- ret = __phy_read(phydev, 0x11); +- rtl821x_write_page(phydev, 0); +- } else { +- ret = -EOPNOTSUPP; +- } +- +- return ret; +-} +- +-static int rtlgen_write_mmd(struct phy_device *phydev, int devnum, u16 regnum, +- u16 val) +-{ +- int ret; +- +- if (devnum == MDIO_MMD_VEND2) { +- rtl821x_write_page(phydev, regnum >> 4); +- ret = __phy_write(phydev, 0x10 + ((regnum & 0xf) >> 1), val); +- rtl821x_write_page(phydev, 0); +- } else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV) { +- rtl821x_write_page(phydev, 0xa5d); +- ret = __phy_write(phydev, 0x10, val); +- rtl821x_write_page(phydev, 0); +- } else { +- ret = -EOPNOTSUPP; +- } +- +- return ret; +-} +- +-static int rtl822x_read_mmd(struct phy_device *phydev, int devnum, u16 regnum) +-{ +- int ret = rtlgen_read_mmd(phydev, devnum, regnum); +- +- if (ret != -EOPNOTSUPP) +- return ret; +- +- if (devnum == MDIO_MMD_PCS && regnum == MDIO_PCS_EEE_ABLE2) { +- rtl821x_write_page(phydev, 0xa6e); +- ret = __phy_read(phydev, 0x16); +- rtl821x_write_page(phydev, 0); +- } else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV2) { +- rtl821x_write_page(phydev, 0xa6d); +- ret = __phy_read(phydev, 0x12); +- rtl821x_write_page(phydev, 0); +- } else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_LPABLE2) { +- rtl821x_write_page(phydev, 0xa6d); +- ret = __phy_read(phydev, 0x10); +- rtl821x_write_page(phydev, 0); +- } +- +- return ret; +-} +- +-static int rtl822x_write_mmd(struct phy_device *phydev, int devnum, u16 regnum, +- u16 val) +-{ +- int ret = rtlgen_write_mmd(phydev, devnum, regnum, val); +- +- if (ret != -EOPNOTSUPP) +- return ret; +- +- if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV2) { +- rtl821x_write_page(phydev, 0xa6d); +- ret = __phy_write(phydev, 0x12, val); +- rtl821x_write_page(phydev, 0); +- } +- +- return ret; +-} +- +-static int rtl822xb_config_init(struct phy_device *phydev) +-{ +- bool has_2500, has_sgmii; +- u16 mode; +- int ret; +- +- has_2500 = test_bit(PHY_INTERFACE_MODE_2500BASEX, +- phydev->host_interfaces) || +- phydev->interface == PHY_INTERFACE_MODE_2500BASEX; +- +- has_sgmii = test_bit(PHY_INTERFACE_MODE_SGMII, +- phydev->host_interfaces) || +- phydev->interface == PHY_INTERFACE_MODE_SGMII; +- +- /* fill in possible interfaces */ +- __assign_bit(PHY_INTERFACE_MODE_2500BASEX, phydev->possible_interfaces, +- has_2500); +- __assign_bit(PHY_INTERFACE_MODE_SGMII, phydev->possible_interfaces, +- has_sgmii); +- +- if (!has_2500 && !has_sgmii) +- return 0; +- +- /* determine SerDes option mode */ +- if (has_2500 && !has_sgmii) { +- mode = RTL822X_VND1_SERDES_OPTION_MODE_2500BASEX; +- phydev->rate_matching = RATE_MATCH_PAUSE; +- } else { +- mode = RTL822X_VND1_SERDES_OPTION_MODE_2500BASEX_SGMII; +- phydev->rate_matching = RATE_MATCH_NONE; +- } +- +- /* the following sequence with magic numbers sets up the SerDes +- * option mode +- */ +- ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x75f3, 0); +- if (ret < 0) +- return ret; +- +- ret = phy_modify_mmd_changed(phydev, MDIO_MMD_VEND1, +- RTL822X_VND1_SERDES_OPTION, +- RTL822X_VND1_SERDES_OPTION_MODE_MASK, +- mode); +- if (ret < 0) +- return ret; +- +- ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x6a04, 0x0503); +- if (ret < 0) +- return ret; +- +- ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x6f10, 0xd455); +- if (ret < 0) +- return ret; +- +- return phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x6f11, 0x8020); +-} +- +-static int rtl822xb_get_rate_matching(struct phy_device *phydev, +- phy_interface_t iface) +-{ +- int val; +- +- /* Only rate matching at 2500base-x */ +- if (iface != PHY_INTERFACE_MODE_2500BASEX) +- return RATE_MATCH_NONE; +- +- val = phy_read_mmd(phydev, MDIO_MMD_VEND1, RTL822X_VND1_SERDES_OPTION); +- if (val < 0) +- return val; +- +- if ((val & RTL822X_VND1_SERDES_OPTION_MODE_MASK) == +- RTL822X_VND1_SERDES_OPTION_MODE_2500BASEX) +- return RATE_MATCH_PAUSE; +- +- /* RTL822X_VND1_SERDES_OPTION_MODE_2500BASEX_SGMII */ +- return RATE_MATCH_NONE; +-} +- +-static int rtl822x_get_features(struct phy_device *phydev) +-{ +- int val; +- +- val = phy_read_paged(phydev, 0xa61, 0x13); +- if (val < 0) +- return val; +- +- linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, +- phydev->supported, val & MDIO_PMA_SPEED_2_5G); +- linkmode_mod_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT, +- phydev->supported, val & MDIO_PMA_SPEED_5G); +- linkmode_mod_bit(ETHTOOL_LINK_MODE_10000baseT_Full_BIT, +- phydev->supported, val & MDIO_SPEED_10G); +- +- return genphy_read_abilities(phydev); +-} +- +-static int rtl822x_config_aneg(struct phy_device *phydev) +-{ +- int ret = 0; +- +- if (phydev->autoneg == AUTONEG_ENABLE) { +- u16 adv = linkmode_adv_to_mii_10gbt_adv_t(phydev->advertising); +- +- ret = phy_modify_paged_changed(phydev, 0xa5d, 0x12, +- MDIO_AN_10GBT_CTRL_ADV2_5G | +- MDIO_AN_10GBT_CTRL_ADV5G, +- adv); +- if (ret < 0) +- return ret; +- } +- +- return __genphy_config_aneg(phydev, ret); +-} +- +-static void rtl822xb_update_interface(struct phy_device *phydev) +-{ +- int val; +- +- if (!phydev->link) +- return; +- +- /* Change interface according to serdes mode */ +- val = phy_read_mmd(phydev, MDIO_MMD_VEND1, RTL822X_VND1_SERDES_CTRL3); +- if (val < 0) +- return; +- +- switch (val & RTL822X_VND1_SERDES_CTRL3_MODE_MASK) { +- case RTL822X_VND1_SERDES_CTRL3_MODE_2500BASEX: +- phydev->interface = PHY_INTERFACE_MODE_2500BASEX; +- break; +- case RTL822X_VND1_SERDES_CTRL3_MODE_SGMII: +- phydev->interface = PHY_INTERFACE_MODE_SGMII; +- break; +- } +-} +- +-static int rtl822x_read_status(struct phy_device *phydev) +-{ +- int lpadv, ret; +- +- ret = rtlgen_read_status(phydev); +- if (ret < 0) +- return ret; +- +- if (phydev->autoneg == AUTONEG_DISABLE || +- !phydev->autoneg_complete) { +- mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising, 0); +- return 0; +- } +- +- lpadv = phy_read_paged(phydev, 0xa5d, 0x13); +- if (lpadv < 0) +- return lpadv; +- +- mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising, lpadv); +- +- return 0; +-} +- +-static int rtl822xb_read_status(struct phy_device *phydev) +-{ +- int ret; +- +- ret = rtl822x_read_status(phydev); +- if (ret < 0) +- return ret; +- +- rtl822xb_update_interface(phydev); +- +- return 0; +-} +- +-static int rtl822x_c45_get_features(struct phy_device *phydev) +-{ +- linkmode_set_bit(ETHTOOL_LINK_MODE_TP_BIT, +- phydev->supported); +- +- return genphy_c45_pma_read_abilities(phydev); +-} +- +-static int rtl822x_c45_config_aneg(struct phy_device *phydev) +-{ +- bool changed = false; +- int ret, val; +- +- 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; +- +- val = linkmode_adv_to_mii_ctrl1000_t(phydev->advertising); +- +- /* Vendor register as C45 has no standardized support for 1000BaseT */ +- ret = phy_modify_mmd_changed(phydev, MDIO_MMD_VEND2, RTL822X_VND2_GBCR, +- ADVERTISE_1000FULL, val); +- if (ret < 0) +- return ret; +- if (ret > 0) +- changed = true; +- +- return genphy_c45_check_and_restart_aneg(phydev, changed); +-} +- +-static int rtl822x_c45_read_status(struct phy_device *phydev) +-{ +- int ret, val; +- +- ret = genphy_c45_read_status(phydev); +- if (ret < 0) +- return ret; +- +- if (phydev->autoneg == AUTONEG_DISABLE || +- !genphy_c45_aneg_done(phydev)) +- mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, 0); +- +- /* Vendor register as C45 has no standardized support for 1000BaseT */ +- if (phydev->autoneg == AUTONEG_ENABLE) { +- val = phy_read_mmd(phydev, MDIO_MMD_VEND2, +- RTL822X_VND2_GANLPAR); +- if (val < 0) +- return val; +- +- mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, val); +- } +- +- if (!phydev->link) +- return 0; +- +- /* Read actual speed from vendor register. */ +- val = phy_read_mmd(phydev, MDIO_MMD_VEND2, RTL_VND2_PHYSR); +- if (val < 0) +- return val; +- +- rtlgen_decode_physr(phydev, val); +- +- return 0; +-} +- +-static int rtl822xb_c45_read_status(struct phy_device *phydev) +-{ +- int ret; +- +- ret = rtl822x_c45_read_status(phydev); +- if (ret < 0) +- return ret; +- +- rtl822xb_update_interface(phydev); +- +- return 0; +-} +- +-static bool rtlgen_supports_2_5gbps(struct phy_device *phydev) +-{ +- int val; +- +- phy_write(phydev, RTL821x_PAGE_SELECT, 0xa61); +- val = phy_read(phydev, 0x13); +- phy_write(phydev, RTL821x_PAGE_SELECT, 0); +- +- return val >= 0 && val & MDIO_PMA_SPEED_2_5G; +-} +- +-/* On internal PHY's MMD reads over C22 always return 0. +- * Check a MMD register which is known to be non-zero. +- */ +-static bool rtlgen_supports_mmd(struct phy_device *phydev) +-{ +- int val; +- +- phy_lock_mdio_bus(phydev); +- __phy_write(phydev, MII_MMD_CTRL, MDIO_MMD_PCS); +- __phy_write(phydev, MII_MMD_DATA, MDIO_PCS_EEE_ABLE); +- __phy_write(phydev, MII_MMD_CTRL, MDIO_MMD_PCS | MII_MMD_CTRL_NOINCR); +- val = __phy_read(phydev, MII_MMD_DATA); +- phy_unlock_mdio_bus(phydev); +- +- return val > 0; +-} +- +-static int rtlgen_match_phy_device(struct phy_device *phydev) +-{ +- return phydev->phy_id == RTL_GENERIC_PHYID && +- !rtlgen_supports_2_5gbps(phydev); +-} +- +-static int rtl8226_match_phy_device(struct phy_device *phydev) +-{ +- return phydev->phy_id == RTL_GENERIC_PHYID && +- rtlgen_supports_2_5gbps(phydev) && +- rtlgen_supports_mmd(phydev); +-} +- +-static int rtlgen_is_c45_match(struct phy_device *phydev, unsigned int id, +- bool is_c45) +-{ +- if (phydev->is_c45) +- return is_c45 && (id == phydev->c45_ids.device_ids[1]); +- else +- return !is_c45 && (id == phydev->phy_id); +-} +- +-static int rtl8221b_match_phy_device(struct phy_device *phydev) +-{ +- return phydev->phy_id == RTL_8221B && rtlgen_supports_mmd(phydev); +-} +- +-static int rtl8221b_vb_cg_c22_match_phy_device(struct phy_device *phydev) +-{ +- return rtlgen_is_c45_match(phydev, RTL_8221B_VB_CG, false); +-} +- +-static int rtl8221b_vb_cg_c45_match_phy_device(struct phy_device *phydev) +-{ +- return rtlgen_is_c45_match(phydev, RTL_8221B_VB_CG, true); +-} +- +-static int rtl8221b_vn_cg_c22_match_phy_device(struct phy_device *phydev) +-{ +- return rtlgen_is_c45_match(phydev, RTL_8221B_VN_CG, false); +-} +- +-static int rtl8221b_vn_cg_c45_match_phy_device(struct phy_device *phydev) +-{ +- return rtlgen_is_c45_match(phydev, RTL_8221B_VN_CG, true); +-} +- +-static int rtl_internal_nbaset_match_phy_device(struct phy_device *phydev) +-{ +- if (phydev->is_c45) +- return false; +- +- switch (phydev->phy_id) { +- case RTL_GENERIC_PHYID: +- case RTL_8221B: +- case RTL_8251B: +- case 0x001cc841: +- break; +- default: +- return false; +- } +- +- return rtlgen_supports_2_5gbps(phydev) && !rtlgen_supports_mmd(phydev); +-} +- +-static int rtl8251b_c45_match_phy_device(struct phy_device *phydev) +-{ +- return rtlgen_is_c45_match(phydev, RTL_8251B, true); +-} +- +-static int rtlgen_resume(struct phy_device *phydev) +-{ +- int ret = genphy_resume(phydev); +- +- /* Internal PHY's from RTL8168h up may not be instantly ready */ +- msleep(20); +- +- return ret; +-} +- +-static int rtlgen_c45_resume(struct phy_device *phydev) +-{ +- int ret = genphy_c45_pma_resume(phydev); +- +- msleep(20); +- +- return ret; +-} +- +-static int rtl9000a_config_init(struct phy_device *phydev) +-{ +- phydev->autoneg = AUTONEG_DISABLE; +- phydev->speed = SPEED_100; +- phydev->duplex = DUPLEX_FULL; +- +- return 0; +-} +- +-static int rtl9000a_config_aneg(struct phy_device *phydev) +-{ +- int ret; +- u16 ctl = 0; +- +- switch (phydev->master_slave_set) { +- case MASTER_SLAVE_CFG_MASTER_FORCE: +- ctl |= CTL1000_AS_MASTER; +- break; +- case MASTER_SLAVE_CFG_SLAVE_FORCE: +- break; +- case MASTER_SLAVE_CFG_UNKNOWN: +- case MASTER_SLAVE_CFG_UNSUPPORTED: +- return 0; +- default: +- phydev_warn(phydev, "Unsupported Master/Slave mode\n"); +- return -EOPNOTSUPP; +- } +- +- ret = phy_modify_changed(phydev, MII_CTRL1000, CTL1000_AS_MASTER, ctl); +- if (ret == 1) +- ret = genphy_soft_reset(phydev); +- +- return ret; +-} +- +-static int rtl9000a_read_status(struct phy_device *phydev) +-{ +- int ret; +- +- phydev->master_slave_get = MASTER_SLAVE_CFG_UNKNOWN; +- phydev->master_slave_state = MASTER_SLAVE_STATE_UNKNOWN; +- +- ret = genphy_update_link(phydev); +- if (ret) +- return ret; +- +- ret = phy_read(phydev, MII_CTRL1000); +- if (ret < 0) +- return ret; +- if (ret & CTL1000_AS_MASTER) +- phydev->master_slave_get = MASTER_SLAVE_CFG_MASTER_FORCE; +- else +- phydev->master_slave_get = MASTER_SLAVE_CFG_SLAVE_FORCE; +- +- ret = phy_read(phydev, MII_STAT1000); +- if (ret < 0) +- return ret; +- if (ret & LPA_1000MSRES) +- phydev->master_slave_state = MASTER_SLAVE_STATE_MASTER; +- else +- phydev->master_slave_state = MASTER_SLAVE_STATE_SLAVE; +- +- return 0; +-} +- +-static int rtl9000a_ack_interrupt(struct phy_device *phydev) +-{ +- int err; +- +- err = phy_read(phydev, RTL8211F_INSR); +- +- return (err < 0) ? err : 0; +-} +- +-static int rtl9000a_config_intr(struct phy_device *phydev) +-{ +- u16 val; +- int err; +- +- if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { +- err = rtl9000a_ack_interrupt(phydev); +- if (err) +- return err; +- +- val = (u16)~RTL9000A_GINMR_LINK_STATUS; +- err = phy_write_paged(phydev, 0xa42, RTL9000A_GINMR, val); +- } else { +- val = ~0; +- err = phy_write_paged(phydev, 0xa42, RTL9000A_GINMR, val); +- if (err) +- return err; +- +- err = rtl9000a_ack_interrupt(phydev); +- } +- +- return phy_write_paged(phydev, 0xa42, RTL9000A_GINMR, val); +-} +- +-static irqreturn_t rtl9000a_handle_interrupt(struct phy_device *phydev) +-{ +- int irq_status; +- +- irq_status = phy_read(phydev, RTL8211F_INSR); +- if (irq_status < 0) { +- phy_error(phydev); +- return IRQ_NONE; +- } +- +- if (!(irq_status & RTL8211F_INER_LINK_STATUS)) +- return IRQ_NONE; +- +- phy_trigger_machine(phydev); +- +- return IRQ_HANDLED; +-} +- +-static struct phy_driver realtek_drvs[] = { +- { +- PHY_ID_MATCH_EXACT(0x00008201), +- .name = "RTL8201CP Ethernet", +- .read_page = rtl821x_read_page, +- .write_page = rtl821x_write_page, +- }, { +- PHY_ID_MATCH_EXACT(0x001cc816), +- .name = "RTL8201F Fast Ethernet", +- .config_intr = &rtl8201_config_intr, +- .handle_interrupt = rtl8201_handle_interrupt, +- .suspend = genphy_suspend, +- .resume = genphy_resume, +- .read_page = rtl821x_read_page, +- .write_page = rtl821x_write_page, +- }, { +- PHY_ID_MATCH_MODEL(0x001cc880), +- .name = "RTL8208 Fast Ethernet", +- .read_mmd = genphy_read_mmd_unsupported, +- .write_mmd = genphy_write_mmd_unsupported, +- .suspend = genphy_suspend, +- .resume = genphy_resume, +- .read_page = rtl821x_read_page, +- .write_page = rtl821x_write_page, +- }, { +- PHY_ID_MATCH_EXACT(0x001cc910), +- .name = "RTL8211 Gigabit Ethernet", +- .config_aneg = rtl8211_config_aneg, +- .read_mmd = &genphy_read_mmd_unsupported, +- .write_mmd = &genphy_write_mmd_unsupported, +- .read_page = rtl821x_read_page, +- .write_page = rtl821x_write_page, +- }, { +- PHY_ID_MATCH_EXACT(0x001cc912), +- .name = "RTL8211B Gigabit Ethernet", +- .config_intr = &rtl8211b_config_intr, +- .handle_interrupt = rtl821x_handle_interrupt, +- .read_mmd = &genphy_read_mmd_unsupported, +- .write_mmd = &genphy_write_mmd_unsupported, +- .suspend = rtl8211b_suspend, +- .resume = rtl8211b_resume, +- .read_page = rtl821x_read_page, +- .write_page = rtl821x_write_page, +- }, { +- PHY_ID_MATCH_EXACT(0x001cc913), +- .name = "RTL8211C Gigabit Ethernet", +- .config_init = rtl8211c_config_init, +- .read_mmd = &genphy_read_mmd_unsupported, +- .write_mmd = &genphy_write_mmd_unsupported, +- .read_page = rtl821x_read_page, +- .write_page = rtl821x_write_page, +- }, { +- PHY_ID_MATCH_EXACT(0x001cc914), +- .name = "RTL8211DN Gigabit Ethernet", +- .config_intr = rtl8211e_config_intr, +- .handle_interrupt = rtl821x_handle_interrupt, +- .suspend = genphy_suspend, +- .resume = genphy_resume, +- .read_page = rtl821x_read_page, +- .write_page = rtl821x_write_page, +- }, { +- PHY_ID_MATCH_EXACT(0x001cc915), +- .name = "RTL8211E Gigabit Ethernet", +- .config_init = &rtl8211e_config_init, +- .config_intr = &rtl8211e_config_intr, +- .handle_interrupt = rtl821x_handle_interrupt, +- .suspend = genphy_suspend, +- .resume = genphy_resume, +- .read_page = rtl821x_read_page, +- .write_page = rtl821x_write_page, +- }, { +- PHY_ID_MATCH_EXACT(0x001cc916), +- .name = "RTL8211F Gigabit Ethernet", +- .probe = rtl821x_probe, +- .config_init = &rtl8211f_config_init, +- .read_status = rtlgen_read_status, +- .config_intr = &rtl8211f_config_intr, +- .handle_interrupt = rtl8211f_handle_interrupt, +- .suspend = rtl821x_suspend, +- .resume = rtl821x_resume, +- .read_page = rtl821x_read_page, +- .write_page = rtl821x_write_page, +- .flags = PHY_ALWAYS_CALL_SUSPEND, +- .led_hw_is_supported = rtl8211f_led_hw_is_supported, +- .led_hw_control_get = rtl8211f_led_hw_control_get, +- .led_hw_control_set = rtl8211f_led_hw_control_set, +- }, { +- PHY_ID_MATCH_EXACT(RTL_8211FVD_PHYID), +- .name = "RTL8211F-VD Gigabit Ethernet", +- .probe = rtl821x_probe, +- .config_init = &rtl8211f_config_init, +- .read_status = rtlgen_read_status, +- .config_intr = &rtl8211f_config_intr, +- .handle_interrupt = rtl8211f_handle_interrupt, +- .suspend = rtl821x_suspend, +- .resume = rtl821x_resume, +- .read_page = rtl821x_read_page, +- .write_page = rtl821x_write_page, +- .flags = PHY_ALWAYS_CALL_SUSPEND, +- }, { +- .name = "Generic FE-GE Realtek PHY", +- .match_phy_device = rtlgen_match_phy_device, +- .read_status = rtlgen_read_status, +- .suspend = genphy_suspend, +- .resume = rtlgen_resume, +- .read_page = rtl821x_read_page, +- .write_page = rtl821x_write_page, +- .read_mmd = rtlgen_read_mmd, +- .write_mmd = rtlgen_write_mmd, +- }, { +- .name = "RTL8226 2.5Gbps PHY", +- .match_phy_device = rtl8226_match_phy_device, +- .get_features = rtl822x_get_features, +- .config_aneg = rtl822x_config_aneg, +- .read_status = rtl822x_read_status, +- .suspend = genphy_suspend, +- .resume = rtlgen_resume, +- .read_page = rtl821x_read_page, +- .write_page = rtl821x_write_page, +- }, { +- .match_phy_device = rtl8221b_match_phy_device, +- .name = "RTL8226B_RTL8221B 2.5Gbps PHY", +- .get_features = rtl822x_get_features, +- .config_aneg = rtl822x_config_aneg, +- .config_init = rtl822xb_config_init, +- .get_rate_matching = rtl822xb_get_rate_matching, +- .read_status = rtl822xb_read_status, +- .suspend = genphy_suspend, +- .resume = rtlgen_resume, +- .read_page = rtl821x_read_page, +- .write_page = rtl821x_write_page, +- }, { +- PHY_ID_MATCH_EXACT(0x001cc838), +- .name = "RTL8226-CG 2.5Gbps PHY", +- .get_features = rtl822x_get_features, +- .config_aneg = rtl822x_config_aneg, +- .read_status = rtl822x_read_status, +- .suspend = genphy_suspend, +- .resume = rtlgen_resume, +- .read_page = rtl821x_read_page, +- .write_page = rtl821x_write_page, +- }, { +- PHY_ID_MATCH_EXACT(0x001cc848), +- .name = "RTL8226B-CG_RTL8221B-CG 2.5Gbps PHY", +- .get_features = rtl822x_get_features, +- .config_aneg = rtl822x_config_aneg, +- .config_init = rtl822xb_config_init, +- .get_rate_matching = rtl822xb_get_rate_matching, +- .read_status = rtl822xb_read_status, +- .suspend = genphy_suspend, +- .resume = rtlgen_resume, +- .read_page = rtl821x_read_page, +- .write_page = rtl821x_write_page, +- }, { +- .match_phy_device = rtl8221b_vb_cg_c22_match_phy_device, +- .name = "RTL8221B-VB-CG 2.5Gbps PHY (C22)", +- .get_features = rtl822x_get_features, +- .config_aneg = rtl822x_config_aneg, +- .config_init = rtl822xb_config_init, +- .get_rate_matching = rtl822xb_get_rate_matching, +- .read_status = rtl822xb_read_status, +- .suspend = genphy_suspend, +- .resume = rtlgen_resume, +- .read_page = rtl821x_read_page, +- .write_page = rtl821x_write_page, +- }, { +- .match_phy_device = rtl8221b_vb_cg_c45_match_phy_device, +- .name = "RTL8221B-VB-CG 2.5Gbps PHY (C45)", +- .config_init = rtl822xb_config_init, +- .get_rate_matching = rtl822xb_get_rate_matching, +- .get_features = rtl822x_c45_get_features, +- .config_aneg = rtl822x_c45_config_aneg, +- .read_status = rtl822xb_c45_read_status, +- .suspend = genphy_c45_pma_suspend, +- .resume = rtlgen_c45_resume, +- }, { +- .match_phy_device = rtl8221b_vn_cg_c22_match_phy_device, +- .name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)", +- .get_features = rtl822x_get_features, +- .config_aneg = rtl822x_config_aneg, +- .config_init = rtl822xb_config_init, +- .get_rate_matching = rtl822xb_get_rate_matching, +- .read_status = rtl822xb_read_status, +- .suspend = genphy_suspend, +- .resume = rtlgen_resume, +- .read_page = rtl821x_read_page, +- .write_page = rtl821x_write_page, +- }, { +- .match_phy_device = rtl8221b_vn_cg_c45_match_phy_device, +- .name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)", +- .config_init = rtl822xb_config_init, +- .get_rate_matching = rtl822xb_get_rate_matching, +- .get_features = rtl822x_c45_get_features, +- .config_aneg = rtl822x_c45_config_aneg, +- .read_status = rtl822xb_c45_read_status, +- .suspend = genphy_c45_pma_suspend, +- .resume = rtlgen_c45_resume, +- }, { +- .match_phy_device = rtl8251b_c45_match_phy_device, +- .name = "RTL8251B 5Gbps PHY", +- .get_features = rtl822x_get_features, +- .config_aneg = rtl822x_config_aneg, +- .read_status = rtl822x_read_status, +- .suspend = genphy_suspend, +- .resume = rtlgen_resume, +- .read_page = rtl821x_read_page, +- .write_page = rtl821x_write_page, +- }, { +- .match_phy_device = rtl_internal_nbaset_match_phy_device, +- .name = "Realtek Internal NBASE-T PHY", +- .flags = PHY_IS_INTERNAL, +- .get_features = rtl822x_get_features, +- .config_aneg = rtl822x_config_aneg, +- .read_status = rtl822x_read_status, +- .suspend = genphy_suspend, +- .resume = rtlgen_resume, +- .read_page = rtl821x_read_page, +- .write_page = rtl821x_write_page, +- .read_mmd = rtl822x_read_mmd, +- .write_mmd = rtl822x_write_mmd, +- }, { +- PHY_ID_MATCH_EXACT(0x001ccad0), +- .name = "RTL8224 2.5Gbps PHY", +- .get_features = rtl822x_c45_get_features, +- .config_aneg = rtl822x_c45_config_aneg, +- .read_status = rtl822x_c45_read_status, +- .suspend = genphy_c45_pma_suspend, +- .resume = rtlgen_c45_resume, +- }, { +- PHY_ID_MATCH_EXACT(0x001cc961), +- .name = "RTL8366RB Gigabit Ethernet", +- .config_init = &rtl8366rb_config_init, +- /* These interrupts are handled by the irq controller +- * embedded inside the RTL8366RB, they get unmasked when the +- * irq is requested and ACKed by reading the status register, +- * which is done by the irqchip code. +- */ +- .config_intr = genphy_no_config_intr, +- .handle_interrupt = genphy_handle_interrupt_no_ack, +- .suspend = genphy_suspend, +- .resume = genphy_resume, +- }, { +- PHY_ID_MATCH_EXACT(0x001ccb00), +- .name = "RTL9000AA_RTL9000AN Ethernet", +- .features = PHY_BASIC_T1_FEATURES, +- .config_init = rtl9000a_config_init, +- .config_aneg = rtl9000a_config_aneg, +- .read_status = rtl9000a_read_status, +- .config_intr = rtl9000a_config_intr, +- .handle_interrupt = rtl9000a_handle_interrupt, +- .suspend = genphy_suspend, +- .resume = genphy_resume, +- .read_page = rtl821x_read_page, +- .write_page = rtl821x_write_page, +- }, { +- PHY_ID_MATCH_EXACT(0x001cc942), +- .name = "RTL8365MB-VC Gigabit Ethernet", +- /* Interrupt handling analogous to RTL8366RB */ +- .config_intr = genphy_no_config_intr, +- .handle_interrupt = genphy_handle_interrupt_no_ack, +- .suspend = genphy_suspend, +- .resume = genphy_resume, +- }, { +- PHY_ID_MATCH_EXACT(0x001cc960), +- .name = "RTL8366S Gigabit Ethernet", +- .suspend = genphy_suspend, +- .resume = genphy_resume, +- .read_mmd = genphy_read_mmd_unsupported, +- .write_mmd = genphy_write_mmd_unsupported, +- }, +-}; +- +-module_phy_driver(realtek_drvs); +- +-static const struct mdio_device_id __maybe_unused realtek_tbl[] = { +- { PHY_ID_MATCH_VENDOR(0x001cc800) }, +- { } +-}; +- +-MODULE_DEVICE_TABLE(mdio, realtek_tbl); +--- /dev/null ++++ b/drivers/net/phy/realtek/realtek_main.c +@@ -0,0 +1,1590 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* drivers/net/phy/realtek.c ++ * ++ * Driver for Realtek PHYs ++ * ++ * Author: Johnson Leung ++ * ++ * Copyright (c) 2004 Freescale Semiconductor, Inc. ++ */ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define RTL821x_PHYSR 0x11 ++#define RTL821x_PHYSR_DUPLEX BIT(13) ++#define RTL821x_PHYSR_SPEED GENMASK(15, 14) ++ ++#define RTL821x_INER 0x12 ++#define RTL8211B_INER_INIT 0x6400 ++#define RTL8211E_INER_LINK_STATUS BIT(10) ++#define RTL8211F_INER_LINK_STATUS BIT(4) ++ ++#define RTL821x_INSR 0x13 ++ ++#define RTL821x_EXT_PAGE_SELECT 0x1e ++#define RTL821x_PAGE_SELECT 0x1f ++ ++#define RTL8211F_PHYCR1 0x18 ++#define RTL8211F_PHYCR2 0x19 ++#define RTL8211F_INSR 0x1d ++ ++#define RTL8211F_LEDCR 0x10 ++#define RTL8211F_LEDCR_MODE BIT(15) ++#define RTL8211F_LEDCR_ACT_TXRX BIT(4) ++#define RTL8211F_LEDCR_LINK_1000 BIT(3) ++#define RTL8211F_LEDCR_LINK_100 BIT(1) ++#define RTL8211F_LEDCR_LINK_10 BIT(0) ++#define RTL8211F_LEDCR_MASK GENMASK(4, 0) ++#define RTL8211F_LEDCR_SHIFT 5 ++ ++#define RTL8211F_TX_DELAY BIT(8) ++#define RTL8211F_RX_DELAY BIT(3) ++ ++#define RTL8211F_ALDPS_PLL_OFF BIT(1) ++#define RTL8211F_ALDPS_ENABLE BIT(2) ++#define RTL8211F_ALDPS_XTAL_OFF BIT(12) ++ ++#define RTL8211E_CTRL_DELAY BIT(13) ++#define RTL8211E_TX_DELAY BIT(12) ++#define RTL8211E_RX_DELAY BIT(11) ++ ++#define RTL8211F_CLKOUT_EN BIT(0) ++ ++#define RTL8201F_ISR 0x1e ++#define RTL8201F_ISR_ANERR BIT(15) ++#define RTL8201F_ISR_DUPLEX BIT(13) ++#define RTL8201F_ISR_LINK BIT(11) ++#define RTL8201F_ISR_MASK (RTL8201F_ISR_ANERR | \ ++ RTL8201F_ISR_DUPLEX | \ ++ RTL8201F_ISR_LINK) ++#define RTL8201F_IER 0x13 ++ ++#define RTL822X_VND1_SERDES_OPTION 0x697a ++#define RTL822X_VND1_SERDES_OPTION_MODE_MASK GENMASK(5, 0) ++#define RTL822X_VND1_SERDES_OPTION_MODE_2500BASEX_SGMII 0 ++#define RTL822X_VND1_SERDES_OPTION_MODE_2500BASEX 2 ++ ++#define RTL822X_VND1_SERDES_CTRL3 0x7580 ++#define RTL822X_VND1_SERDES_CTRL3_MODE_MASK GENMASK(5, 0) ++#define RTL822X_VND1_SERDES_CTRL3_MODE_SGMII 0x02 ++#define RTL822X_VND1_SERDES_CTRL3_MODE_2500BASEX 0x16 ++ ++/* RTL822X_VND2_XXXXX registers are only accessible when phydev->is_c45 ++ * is set, they cannot be accessed by C45-over-C22. ++ */ ++#define RTL822X_VND2_GBCR 0xa412 ++ ++#define RTL822X_VND2_GANLPAR 0xa414 ++ ++#define RTL8366RB_POWER_SAVE 0x15 ++#define RTL8366RB_POWER_SAVE_ON BIT(12) ++ ++#define RTL9000A_GINMR 0x14 ++#define RTL9000A_GINMR_LINK_STATUS BIT(4) ++ ++#define RTL_VND2_PHYSR 0xa434 ++#define RTL_VND2_PHYSR_DUPLEX BIT(3) ++#define RTL_VND2_PHYSR_SPEEDL GENMASK(5, 4) ++#define RTL_VND2_PHYSR_SPEEDH GENMASK(10, 9) ++#define RTL_VND2_PHYSR_MASTER BIT(11) ++#define RTL_VND2_PHYSR_SPEED_MASK (RTL_VND2_PHYSR_SPEEDL | RTL_VND2_PHYSR_SPEEDH) ++ ++#define RTL_GENERIC_PHYID 0x001cc800 ++#define RTL_8211FVD_PHYID 0x001cc878 ++#define RTL_8221B 0x001cc840 ++#define RTL_8221B_VB_CG 0x001cc849 ++#define RTL_8221B_VN_CG 0x001cc84a ++#define RTL_8251B 0x001cc862 ++ ++#define RTL8211F_LED_COUNT 3 ++ ++MODULE_DESCRIPTION("Realtek PHY driver"); ++MODULE_AUTHOR("Johnson Leung"); ++MODULE_LICENSE("GPL"); ++ ++struct rtl821x_priv { ++ u16 phycr1; ++ u16 phycr2; ++ bool has_phycr2; ++ struct clk *clk; ++}; ++ ++static int rtl821x_read_page(struct phy_device *phydev) ++{ ++ return __phy_read(phydev, RTL821x_PAGE_SELECT); ++} ++ ++static int rtl821x_write_page(struct phy_device *phydev, int page) ++{ ++ return __phy_write(phydev, RTL821x_PAGE_SELECT, page); ++} ++ ++static int rtl821x_probe(struct phy_device *phydev) ++{ ++ struct device *dev = &phydev->mdio.dev; ++ struct rtl821x_priv *priv; ++ u32 phy_id = phydev->drv->phy_id; ++ int ret; ++ ++ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; ++ ++ priv->clk = devm_clk_get_optional_enabled(dev, NULL); ++ if (IS_ERR(priv->clk)) ++ return dev_err_probe(dev, PTR_ERR(priv->clk), ++ "failed to get phy clock\n"); ++ ++ ret = phy_read_paged(phydev, 0xa43, RTL8211F_PHYCR1); ++ if (ret < 0) ++ return ret; ++ ++ priv->phycr1 = ret & (RTL8211F_ALDPS_PLL_OFF | RTL8211F_ALDPS_ENABLE | RTL8211F_ALDPS_XTAL_OFF); ++ if (of_property_read_bool(dev->of_node, "realtek,aldps-enable")) ++ priv->phycr1 |= RTL8211F_ALDPS_PLL_OFF | RTL8211F_ALDPS_ENABLE | RTL8211F_ALDPS_XTAL_OFF; ++ ++ priv->has_phycr2 = !(phy_id == RTL_8211FVD_PHYID); ++ if (priv->has_phycr2) { ++ ret = phy_read_paged(phydev, 0xa43, RTL8211F_PHYCR2); ++ if (ret < 0) ++ return ret; ++ ++ priv->phycr2 = ret & RTL8211F_CLKOUT_EN; ++ if (of_property_read_bool(dev->of_node, "realtek,clkout-disable")) ++ priv->phycr2 &= ~RTL8211F_CLKOUT_EN; ++ } ++ ++ phydev->priv = priv; ++ ++ return 0; ++} ++ ++static int rtl8201_ack_interrupt(struct phy_device *phydev) ++{ ++ int err; ++ ++ err = phy_read(phydev, RTL8201F_ISR); ++ ++ return (err < 0) ? err : 0; ++} ++ ++static int rtl821x_ack_interrupt(struct phy_device *phydev) ++{ ++ int err; ++ ++ err = phy_read(phydev, RTL821x_INSR); ++ ++ return (err < 0) ? err : 0; ++} ++ ++static int rtl8211f_ack_interrupt(struct phy_device *phydev) ++{ ++ int err; ++ ++ err = phy_read_paged(phydev, 0xa43, RTL8211F_INSR); ++ ++ return (err < 0) ? err : 0; ++} ++ ++static int rtl8201_config_intr(struct phy_device *phydev) ++{ ++ u16 val; ++ int err; ++ ++ if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { ++ err = rtl8201_ack_interrupt(phydev); ++ if (err) ++ return err; ++ ++ val = BIT(13) | BIT(12) | BIT(11); ++ err = phy_write_paged(phydev, 0x7, RTL8201F_IER, val); ++ } else { ++ val = 0; ++ err = phy_write_paged(phydev, 0x7, RTL8201F_IER, val); ++ if (err) ++ return err; ++ ++ err = rtl8201_ack_interrupt(phydev); ++ } ++ ++ return err; ++} ++ ++static int rtl8211b_config_intr(struct phy_device *phydev) ++{ ++ int err; ++ ++ if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { ++ err = rtl821x_ack_interrupt(phydev); ++ if (err) ++ return err; ++ ++ err = phy_write(phydev, RTL821x_INER, ++ RTL8211B_INER_INIT); ++ } else { ++ err = phy_write(phydev, RTL821x_INER, 0); ++ if (err) ++ return err; ++ ++ err = rtl821x_ack_interrupt(phydev); ++ } ++ ++ return err; ++} ++ ++static int rtl8211e_config_intr(struct phy_device *phydev) ++{ ++ int err; ++ ++ if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { ++ err = rtl821x_ack_interrupt(phydev); ++ if (err) ++ return err; ++ ++ err = phy_write(phydev, RTL821x_INER, ++ RTL8211E_INER_LINK_STATUS); ++ } else { ++ err = phy_write(phydev, RTL821x_INER, 0); ++ if (err) ++ return err; ++ ++ err = rtl821x_ack_interrupt(phydev); ++ } ++ ++ return err; ++} ++ ++static int rtl8211f_config_intr(struct phy_device *phydev) ++{ ++ u16 val; ++ int err; ++ ++ if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { ++ err = rtl8211f_ack_interrupt(phydev); ++ if (err) ++ return err; ++ ++ val = RTL8211F_INER_LINK_STATUS; ++ err = phy_write_paged(phydev, 0xa42, RTL821x_INER, val); ++ } else { ++ val = 0; ++ err = phy_write_paged(phydev, 0xa42, RTL821x_INER, val); ++ if (err) ++ return err; ++ ++ err = rtl8211f_ack_interrupt(phydev); ++ } ++ ++ return err; ++} ++ ++static irqreturn_t rtl8201_handle_interrupt(struct phy_device *phydev) ++{ ++ int irq_status; ++ ++ irq_status = phy_read(phydev, RTL8201F_ISR); ++ if (irq_status < 0) { ++ phy_error(phydev); ++ return IRQ_NONE; ++ } ++ ++ if (!(irq_status & RTL8201F_ISR_MASK)) ++ return IRQ_NONE; ++ ++ phy_trigger_machine(phydev); ++ ++ return IRQ_HANDLED; ++} ++ ++static irqreturn_t rtl821x_handle_interrupt(struct phy_device *phydev) ++{ ++ int irq_status, irq_enabled; ++ ++ irq_status = phy_read(phydev, RTL821x_INSR); ++ if (irq_status < 0) { ++ phy_error(phydev); ++ return IRQ_NONE; ++ } ++ ++ irq_enabled = phy_read(phydev, RTL821x_INER); ++ if (irq_enabled < 0) { ++ phy_error(phydev); ++ return IRQ_NONE; ++ } ++ ++ if (!(irq_status & irq_enabled)) ++ return IRQ_NONE; ++ ++ phy_trigger_machine(phydev); ++ ++ return IRQ_HANDLED; ++} ++ ++static irqreturn_t rtl8211f_handle_interrupt(struct phy_device *phydev) ++{ ++ int irq_status; ++ ++ irq_status = phy_read_paged(phydev, 0xa43, RTL8211F_INSR); ++ if (irq_status < 0) { ++ phy_error(phydev); ++ return IRQ_NONE; ++ } ++ ++ if (!(irq_status & RTL8211F_INER_LINK_STATUS)) ++ return IRQ_NONE; ++ ++ phy_trigger_machine(phydev); ++ ++ return IRQ_HANDLED; ++} ++ ++static int rtl8211_config_aneg(struct phy_device *phydev) ++{ ++ int ret; ++ ++ ret = genphy_config_aneg(phydev); ++ if (ret < 0) ++ return ret; ++ ++ /* Quirk was copied from vendor driver. Unfortunately it includes no ++ * description of the magic numbers. ++ */ ++ if (phydev->speed == SPEED_100 && phydev->autoneg == AUTONEG_DISABLE) { ++ phy_write(phydev, 0x17, 0x2138); ++ phy_write(phydev, 0x0e, 0x0260); ++ } else { ++ phy_write(phydev, 0x17, 0x2108); ++ phy_write(phydev, 0x0e, 0x0000); ++ } ++ ++ return 0; ++} ++ ++static int rtl8211c_config_init(struct phy_device *phydev) ++{ ++ /* RTL8211C has an issue when operating in Gigabit slave mode */ ++ return phy_set_bits(phydev, MII_CTRL1000, ++ CTL1000_ENABLE_MASTER | CTL1000_AS_MASTER); ++} ++ ++static int rtl8211f_config_init(struct phy_device *phydev) ++{ ++ struct rtl821x_priv *priv = phydev->priv; ++ struct device *dev = &phydev->mdio.dev; ++ u16 val_txdly, val_rxdly; ++ int ret; ++ ++ ret = phy_modify_paged_changed(phydev, 0xa43, RTL8211F_PHYCR1, ++ RTL8211F_ALDPS_PLL_OFF | RTL8211F_ALDPS_ENABLE | RTL8211F_ALDPS_XTAL_OFF, ++ priv->phycr1); ++ if (ret < 0) { ++ dev_err(dev, "aldps mode configuration failed: %pe\n", ++ ERR_PTR(ret)); ++ return ret; ++ } ++ ++ switch (phydev->interface) { ++ case PHY_INTERFACE_MODE_RGMII: ++ val_txdly = 0; ++ val_rxdly = 0; ++ break; ++ ++ case PHY_INTERFACE_MODE_RGMII_RXID: ++ val_txdly = 0; ++ val_rxdly = RTL8211F_RX_DELAY; ++ break; ++ ++ case PHY_INTERFACE_MODE_RGMII_TXID: ++ val_txdly = RTL8211F_TX_DELAY; ++ val_rxdly = 0; ++ break; ++ ++ case PHY_INTERFACE_MODE_RGMII_ID: ++ val_txdly = RTL8211F_TX_DELAY; ++ val_rxdly = RTL8211F_RX_DELAY; ++ break; ++ ++ default: /* the rest of the modes imply leaving delay as is. */ ++ return 0; ++ } ++ ++ ret = phy_modify_paged_changed(phydev, 0xd08, 0x11, RTL8211F_TX_DELAY, ++ val_txdly); ++ if (ret < 0) { ++ dev_err(dev, "Failed to update the TX delay register\n"); ++ return ret; ++ } else if (ret) { ++ dev_dbg(dev, ++ "%s 2ns TX delay (and changing the value from pin-strapping RXD1 or the bootloader)\n", ++ val_txdly ? "Enabling" : "Disabling"); ++ } else { ++ dev_dbg(dev, ++ "2ns TX delay was already %s (by pin-strapping RXD1 or bootloader configuration)\n", ++ val_txdly ? "enabled" : "disabled"); ++ } ++ ++ ret = phy_modify_paged_changed(phydev, 0xd08, 0x15, RTL8211F_RX_DELAY, ++ val_rxdly); ++ if (ret < 0) { ++ dev_err(dev, "Failed to update the RX delay register\n"); ++ return ret; ++ } else if (ret) { ++ dev_dbg(dev, ++ "%s 2ns RX delay (and changing the value from pin-strapping RXD0 or the bootloader)\n", ++ val_rxdly ? "Enabling" : "Disabling"); ++ } else { ++ dev_dbg(dev, ++ "2ns RX delay was already %s (by pin-strapping RXD0 or bootloader configuration)\n", ++ val_rxdly ? "enabled" : "disabled"); ++ } ++ ++ if (priv->has_phycr2) { ++ ret = phy_modify_paged(phydev, 0xa43, RTL8211F_PHYCR2, ++ RTL8211F_CLKOUT_EN, priv->phycr2); ++ if (ret < 0) { ++ dev_err(dev, "clkout configuration failed: %pe\n", ++ ERR_PTR(ret)); ++ return ret; ++ } ++ ++ return genphy_soft_reset(phydev); ++ } ++ ++ return 0; ++} ++ ++static int rtl821x_suspend(struct phy_device *phydev) ++{ ++ struct rtl821x_priv *priv = phydev->priv; ++ int ret = 0; ++ ++ if (!phydev->wol_enabled) { ++ ret = genphy_suspend(phydev); ++ ++ if (ret) ++ return ret; ++ ++ clk_disable_unprepare(priv->clk); ++ } ++ ++ return ret; ++} ++ ++static int rtl821x_resume(struct phy_device *phydev) ++{ ++ struct rtl821x_priv *priv = phydev->priv; ++ int ret; ++ ++ if (!phydev->wol_enabled) ++ clk_prepare_enable(priv->clk); ++ ++ ret = genphy_resume(phydev); ++ if (ret < 0) ++ return ret; ++ ++ msleep(20); ++ ++ return 0; ++} ++ ++static int rtl8211f_led_hw_is_supported(struct phy_device *phydev, u8 index, ++ unsigned long rules) ++{ ++ const unsigned long mask = BIT(TRIGGER_NETDEV_LINK_10) | ++ BIT(TRIGGER_NETDEV_LINK_100) | ++ BIT(TRIGGER_NETDEV_LINK_1000) | ++ BIT(TRIGGER_NETDEV_RX) | ++ BIT(TRIGGER_NETDEV_TX); ++ ++ /* The RTL8211F PHY supports these LED settings on up to three LEDs: ++ * - Link: Configurable subset of 10/100/1000 link rates ++ * - Active: Blink on activity, RX or TX is not differentiated ++ * The Active option has two modes, A and B: ++ * - A: Link and Active indication at configurable, but matching, ++ * subset of 10/100/1000 link rates ++ * - B: Link indication at configurable subset of 10/100/1000 link ++ * rates and Active indication always at all three 10+100+1000 ++ * link rates. ++ * This code currently uses mode B only. ++ */ ++ ++ if (index >= RTL8211F_LED_COUNT) ++ return -EINVAL; ++ ++ /* Filter out any other unsupported triggers. */ ++ if (rules & ~mask) ++ return -EOPNOTSUPP; ++ ++ /* RX and TX are not differentiated, either both are set or not set. */ ++ if (!(rules & BIT(TRIGGER_NETDEV_RX)) ^ !(rules & BIT(TRIGGER_NETDEV_TX))) ++ return -EOPNOTSUPP; ++ ++ return 0; ++} ++ ++static int rtl8211f_led_hw_control_get(struct phy_device *phydev, u8 index, ++ unsigned long *rules) ++{ ++ int val; ++ ++ if (index >= RTL8211F_LED_COUNT) ++ return -EINVAL; ++ ++ val = phy_read_paged(phydev, 0xd04, RTL8211F_LEDCR); ++ if (val < 0) ++ return val; ++ ++ val >>= RTL8211F_LEDCR_SHIFT * index; ++ val &= RTL8211F_LEDCR_MASK; ++ ++ if (val & RTL8211F_LEDCR_LINK_10) ++ set_bit(TRIGGER_NETDEV_LINK_10, rules); ++ ++ if (val & RTL8211F_LEDCR_LINK_100) ++ set_bit(TRIGGER_NETDEV_LINK_100, rules); ++ ++ if (val & RTL8211F_LEDCR_LINK_1000) ++ set_bit(TRIGGER_NETDEV_LINK_1000, rules); ++ ++ if (val & RTL8211F_LEDCR_ACT_TXRX) { ++ set_bit(TRIGGER_NETDEV_RX, rules); ++ set_bit(TRIGGER_NETDEV_TX, rules); ++ } ++ ++ return 0; ++} ++ ++static int rtl8211f_led_hw_control_set(struct phy_device *phydev, u8 index, ++ unsigned long rules) ++{ ++ const u16 mask = RTL8211F_LEDCR_MASK << (RTL8211F_LEDCR_SHIFT * index); ++ u16 reg = 0; ++ ++ if (index >= RTL8211F_LED_COUNT) ++ return -EINVAL; ++ ++ if (test_bit(TRIGGER_NETDEV_LINK_10, &rules)) ++ reg |= RTL8211F_LEDCR_LINK_10; ++ ++ if (test_bit(TRIGGER_NETDEV_LINK_100, &rules)) ++ reg |= RTL8211F_LEDCR_LINK_100; ++ ++ if (test_bit(TRIGGER_NETDEV_LINK_1000, &rules)) ++ reg |= RTL8211F_LEDCR_LINK_1000; ++ ++ if (test_bit(TRIGGER_NETDEV_RX, &rules) || ++ test_bit(TRIGGER_NETDEV_TX, &rules)) { ++ reg |= RTL8211F_LEDCR_ACT_TXRX; ++ } ++ ++ reg <<= RTL8211F_LEDCR_SHIFT * index; ++ reg |= RTL8211F_LEDCR_MODE; /* Mode B */ ++ ++ return phy_modify_paged(phydev, 0xd04, RTL8211F_LEDCR, mask, reg); ++} ++ ++static int rtl8211e_config_init(struct phy_device *phydev) ++{ ++ int ret = 0, oldpage; ++ u16 val; ++ ++ /* enable TX/RX delay for rgmii-* modes, and disable them for rgmii. */ ++ switch (phydev->interface) { ++ case PHY_INTERFACE_MODE_RGMII: ++ val = RTL8211E_CTRL_DELAY | 0; ++ break; ++ case PHY_INTERFACE_MODE_RGMII_ID: ++ val = RTL8211E_CTRL_DELAY | RTL8211E_TX_DELAY | RTL8211E_RX_DELAY; ++ break; ++ case PHY_INTERFACE_MODE_RGMII_RXID: ++ val = RTL8211E_CTRL_DELAY | RTL8211E_RX_DELAY; ++ break; ++ case PHY_INTERFACE_MODE_RGMII_TXID: ++ val = RTL8211E_CTRL_DELAY | RTL8211E_TX_DELAY; ++ break; ++ default: /* the rest of the modes imply leaving delays as is. */ ++ return 0; ++ } ++ ++ /* According to a sample driver there is a 0x1c config register on the ++ * 0xa4 extension page (0x7) layout. It can be used to disable/enable ++ * the RX/TX delays otherwise controlled by RXDLY/TXDLY pins. ++ * The configuration register definition: ++ * 14 = reserved ++ * 13 = Force Tx RX Delay controlled by bit12 bit11, ++ * 12 = RX Delay, 11 = TX Delay ++ * 10:0 = Test && debug settings reserved by realtek ++ */ ++ oldpage = phy_select_page(phydev, 0x7); ++ if (oldpage < 0) ++ goto err_restore_page; ++ ++ ret = __phy_write(phydev, RTL821x_EXT_PAGE_SELECT, 0xa4); ++ if (ret) ++ goto err_restore_page; ++ ++ ret = __phy_modify(phydev, 0x1c, RTL8211E_CTRL_DELAY ++ | RTL8211E_TX_DELAY | RTL8211E_RX_DELAY, ++ val); ++ ++err_restore_page: ++ return phy_restore_page(phydev, oldpage, ret); ++} ++ ++static int rtl8211b_suspend(struct phy_device *phydev) ++{ ++ phy_write(phydev, MII_MMD_DATA, BIT(9)); ++ ++ return genphy_suspend(phydev); ++} ++ ++static int rtl8211b_resume(struct phy_device *phydev) ++{ ++ phy_write(phydev, MII_MMD_DATA, 0); ++ ++ return genphy_resume(phydev); ++} ++ ++static int rtl8366rb_config_init(struct phy_device *phydev) ++{ ++ int ret; ++ ++ ret = phy_set_bits(phydev, RTL8366RB_POWER_SAVE, ++ RTL8366RB_POWER_SAVE_ON); ++ if (ret) { ++ dev_err(&phydev->mdio.dev, ++ "error enabling power management\n"); ++ } ++ ++ return ret; ++} ++ ++/* get actual speed to cover the downshift case */ ++static void rtlgen_decode_physr(struct phy_device *phydev, int val) ++{ ++ /* bit 3 ++ * 0: Half Duplex ++ * 1: Full Duplex ++ */ ++ if (val & RTL_VND2_PHYSR_DUPLEX) ++ phydev->duplex = DUPLEX_FULL; ++ else ++ phydev->duplex = DUPLEX_HALF; ++ ++ switch (val & RTL_VND2_PHYSR_SPEED_MASK) { ++ case 0x0000: ++ phydev->speed = SPEED_10; ++ break; ++ case 0x0010: ++ phydev->speed = SPEED_100; ++ break; ++ case 0x0020: ++ phydev->speed = SPEED_1000; ++ break; ++ case 0x0200: ++ phydev->speed = SPEED_10000; ++ break; ++ case 0x0210: ++ phydev->speed = SPEED_2500; ++ break; ++ case 0x0220: ++ phydev->speed = SPEED_5000; ++ break; ++ default: ++ break; ++ } ++ ++ /* bit 11 ++ * 0: Slave Mode ++ * 1: Master Mode ++ */ ++ if (phydev->speed >= 1000) { ++ if (val & RTL_VND2_PHYSR_MASTER) ++ phydev->master_slave_state = MASTER_SLAVE_STATE_MASTER; ++ else ++ phydev->master_slave_state = MASTER_SLAVE_STATE_SLAVE; ++ } else { ++ phydev->master_slave_state = MASTER_SLAVE_STATE_UNSUPPORTED; ++ } ++} ++ ++static int rtlgen_read_status(struct phy_device *phydev) ++{ ++ int ret, val; ++ ++ ret = genphy_read_status(phydev); ++ if (ret < 0) ++ return ret; ++ ++ if (!phydev->link) ++ return 0; ++ ++ val = phy_read_paged(phydev, 0xa43, 0x12); ++ if (val < 0) ++ return val; ++ ++ rtlgen_decode_physr(phydev, val); ++ ++ return 0; ++} ++ ++static int rtlgen_read_mmd(struct phy_device *phydev, int devnum, u16 regnum) ++{ ++ int ret; ++ ++ if (devnum == MDIO_MMD_VEND2) { ++ rtl821x_write_page(phydev, regnum >> 4); ++ ret = __phy_read(phydev, 0x10 + ((regnum & 0xf) >> 1)); ++ rtl821x_write_page(phydev, 0); ++ } else if (devnum == MDIO_MMD_PCS && regnum == MDIO_PCS_EEE_ABLE) { ++ rtl821x_write_page(phydev, 0xa5c); ++ ret = __phy_read(phydev, 0x12); ++ rtl821x_write_page(phydev, 0); ++ } else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV) { ++ rtl821x_write_page(phydev, 0xa5d); ++ ret = __phy_read(phydev, 0x10); ++ rtl821x_write_page(phydev, 0); ++ } else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_LPABLE) { ++ rtl821x_write_page(phydev, 0xa5d); ++ ret = __phy_read(phydev, 0x11); ++ rtl821x_write_page(phydev, 0); ++ } else { ++ ret = -EOPNOTSUPP; ++ } ++ ++ return ret; ++} ++ ++static int rtlgen_write_mmd(struct phy_device *phydev, int devnum, u16 regnum, ++ u16 val) ++{ ++ int ret; ++ ++ if (devnum == MDIO_MMD_VEND2) { ++ rtl821x_write_page(phydev, regnum >> 4); ++ ret = __phy_write(phydev, 0x10 + ((regnum & 0xf) >> 1), val); ++ rtl821x_write_page(phydev, 0); ++ } else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV) { ++ rtl821x_write_page(phydev, 0xa5d); ++ ret = __phy_write(phydev, 0x10, val); ++ rtl821x_write_page(phydev, 0); ++ } else { ++ ret = -EOPNOTSUPP; ++ } ++ ++ return ret; ++} ++ ++static int rtl822x_read_mmd(struct phy_device *phydev, int devnum, u16 regnum) ++{ ++ int ret = rtlgen_read_mmd(phydev, devnum, regnum); ++ ++ if (ret != -EOPNOTSUPP) ++ return ret; ++ ++ if (devnum == MDIO_MMD_PCS && regnum == MDIO_PCS_EEE_ABLE2) { ++ rtl821x_write_page(phydev, 0xa6e); ++ ret = __phy_read(phydev, 0x16); ++ rtl821x_write_page(phydev, 0); ++ } else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV2) { ++ rtl821x_write_page(phydev, 0xa6d); ++ ret = __phy_read(phydev, 0x12); ++ rtl821x_write_page(phydev, 0); ++ } else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_LPABLE2) { ++ rtl821x_write_page(phydev, 0xa6d); ++ ret = __phy_read(phydev, 0x10); ++ rtl821x_write_page(phydev, 0); ++ } ++ ++ return ret; ++} ++ ++static int rtl822x_write_mmd(struct phy_device *phydev, int devnum, u16 regnum, ++ u16 val) ++{ ++ int ret = rtlgen_write_mmd(phydev, devnum, regnum, val); ++ ++ if (ret != -EOPNOTSUPP) ++ return ret; ++ ++ if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV2) { ++ rtl821x_write_page(phydev, 0xa6d); ++ ret = __phy_write(phydev, 0x12, val); ++ rtl821x_write_page(phydev, 0); ++ } ++ ++ return ret; ++} ++ ++static int rtl822xb_config_init(struct phy_device *phydev) ++{ ++ bool has_2500, has_sgmii; ++ u16 mode; ++ int ret; ++ ++ has_2500 = test_bit(PHY_INTERFACE_MODE_2500BASEX, ++ phydev->host_interfaces) || ++ phydev->interface == PHY_INTERFACE_MODE_2500BASEX; ++ ++ has_sgmii = test_bit(PHY_INTERFACE_MODE_SGMII, ++ phydev->host_interfaces) || ++ phydev->interface == PHY_INTERFACE_MODE_SGMII; ++ ++ /* fill in possible interfaces */ ++ __assign_bit(PHY_INTERFACE_MODE_2500BASEX, phydev->possible_interfaces, ++ has_2500); ++ __assign_bit(PHY_INTERFACE_MODE_SGMII, phydev->possible_interfaces, ++ has_sgmii); ++ ++ if (!has_2500 && !has_sgmii) ++ return 0; ++ ++ /* determine SerDes option mode */ ++ if (has_2500 && !has_sgmii) { ++ mode = RTL822X_VND1_SERDES_OPTION_MODE_2500BASEX; ++ phydev->rate_matching = RATE_MATCH_PAUSE; ++ } else { ++ mode = RTL822X_VND1_SERDES_OPTION_MODE_2500BASEX_SGMII; ++ phydev->rate_matching = RATE_MATCH_NONE; ++ } ++ ++ /* the following sequence with magic numbers sets up the SerDes ++ * option mode ++ */ ++ ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x75f3, 0); ++ if (ret < 0) ++ return ret; ++ ++ ret = phy_modify_mmd_changed(phydev, MDIO_MMD_VEND1, ++ RTL822X_VND1_SERDES_OPTION, ++ RTL822X_VND1_SERDES_OPTION_MODE_MASK, ++ mode); ++ if (ret < 0) ++ return ret; ++ ++ ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x6a04, 0x0503); ++ if (ret < 0) ++ return ret; ++ ++ ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x6f10, 0xd455); ++ if (ret < 0) ++ return ret; ++ ++ return phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x6f11, 0x8020); ++} ++ ++static int rtl822xb_get_rate_matching(struct phy_device *phydev, ++ phy_interface_t iface) ++{ ++ int val; ++ ++ /* Only rate matching at 2500base-x */ ++ if (iface != PHY_INTERFACE_MODE_2500BASEX) ++ return RATE_MATCH_NONE; ++ ++ val = phy_read_mmd(phydev, MDIO_MMD_VEND1, RTL822X_VND1_SERDES_OPTION); ++ if (val < 0) ++ return val; ++ ++ if ((val & RTL822X_VND1_SERDES_OPTION_MODE_MASK) == ++ RTL822X_VND1_SERDES_OPTION_MODE_2500BASEX) ++ return RATE_MATCH_PAUSE; ++ ++ /* RTL822X_VND1_SERDES_OPTION_MODE_2500BASEX_SGMII */ ++ return RATE_MATCH_NONE; ++} ++ ++static int rtl822x_get_features(struct phy_device *phydev) ++{ ++ int val; ++ ++ val = phy_read_paged(phydev, 0xa61, 0x13); ++ if (val < 0) ++ return val; ++ ++ linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, ++ phydev->supported, val & MDIO_PMA_SPEED_2_5G); ++ linkmode_mod_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT, ++ phydev->supported, val & MDIO_PMA_SPEED_5G); ++ linkmode_mod_bit(ETHTOOL_LINK_MODE_10000baseT_Full_BIT, ++ phydev->supported, val & MDIO_SPEED_10G); ++ ++ return genphy_read_abilities(phydev); ++} ++ ++static int rtl822x_config_aneg(struct phy_device *phydev) ++{ ++ int ret = 0; ++ ++ if (phydev->autoneg == AUTONEG_ENABLE) { ++ u16 adv = linkmode_adv_to_mii_10gbt_adv_t(phydev->advertising); ++ ++ ret = phy_modify_paged_changed(phydev, 0xa5d, 0x12, ++ MDIO_AN_10GBT_CTRL_ADV2_5G | ++ MDIO_AN_10GBT_CTRL_ADV5G, ++ adv); ++ if (ret < 0) ++ return ret; ++ } ++ ++ return __genphy_config_aneg(phydev, ret); ++} ++ ++static void rtl822xb_update_interface(struct phy_device *phydev) ++{ ++ int val; ++ ++ if (!phydev->link) ++ return; ++ ++ /* Change interface according to serdes mode */ ++ val = phy_read_mmd(phydev, MDIO_MMD_VEND1, RTL822X_VND1_SERDES_CTRL3); ++ if (val < 0) ++ return; ++ ++ switch (val & RTL822X_VND1_SERDES_CTRL3_MODE_MASK) { ++ case RTL822X_VND1_SERDES_CTRL3_MODE_2500BASEX: ++ phydev->interface = PHY_INTERFACE_MODE_2500BASEX; ++ break; ++ case RTL822X_VND1_SERDES_CTRL3_MODE_SGMII: ++ phydev->interface = PHY_INTERFACE_MODE_SGMII; ++ break; ++ } ++} ++ ++static int rtl822x_read_status(struct phy_device *phydev) ++{ ++ int lpadv, ret; ++ ++ ret = rtlgen_read_status(phydev); ++ if (ret < 0) ++ return ret; ++ ++ if (phydev->autoneg == AUTONEG_DISABLE || ++ !phydev->autoneg_complete) { ++ mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising, 0); ++ return 0; ++ } ++ ++ lpadv = phy_read_paged(phydev, 0xa5d, 0x13); ++ if (lpadv < 0) ++ return lpadv; ++ ++ mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising, lpadv); ++ ++ return 0; ++} ++ ++static int rtl822xb_read_status(struct phy_device *phydev) ++{ ++ int ret; ++ ++ ret = rtl822x_read_status(phydev); ++ if (ret < 0) ++ return ret; ++ ++ rtl822xb_update_interface(phydev); ++ ++ return 0; ++} ++ ++static int rtl822x_c45_get_features(struct phy_device *phydev) ++{ ++ linkmode_set_bit(ETHTOOL_LINK_MODE_TP_BIT, ++ phydev->supported); ++ ++ return genphy_c45_pma_read_abilities(phydev); ++} ++ ++static int rtl822x_c45_config_aneg(struct phy_device *phydev) ++{ ++ bool changed = false; ++ int ret, val; ++ ++ 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; ++ ++ val = linkmode_adv_to_mii_ctrl1000_t(phydev->advertising); ++ ++ /* Vendor register as C45 has no standardized support for 1000BaseT */ ++ ret = phy_modify_mmd_changed(phydev, MDIO_MMD_VEND2, RTL822X_VND2_GBCR, ++ ADVERTISE_1000FULL, val); ++ if (ret < 0) ++ return ret; ++ if (ret > 0) ++ changed = true; ++ ++ return genphy_c45_check_and_restart_aneg(phydev, changed); ++} ++ ++static int rtl822x_c45_read_status(struct phy_device *phydev) ++{ ++ int ret, val; ++ ++ ret = genphy_c45_read_status(phydev); ++ if (ret < 0) ++ return ret; ++ ++ if (phydev->autoneg == AUTONEG_DISABLE || ++ !genphy_c45_aneg_done(phydev)) ++ mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, 0); ++ ++ /* Vendor register as C45 has no standardized support for 1000BaseT */ ++ if (phydev->autoneg == AUTONEG_ENABLE) { ++ val = phy_read_mmd(phydev, MDIO_MMD_VEND2, ++ RTL822X_VND2_GANLPAR); ++ if (val < 0) ++ return val; ++ ++ mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, val); ++ } ++ ++ if (!phydev->link) ++ return 0; ++ ++ /* Read actual speed from vendor register. */ ++ val = phy_read_mmd(phydev, MDIO_MMD_VEND2, RTL_VND2_PHYSR); ++ if (val < 0) ++ return val; ++ ++ rtlgen_decode_physr(phydev, val); ++ ++ return 0; ++} ++ ++static int rtl822xb_c45_read_status(struct phy_device *phydev) ++{ ++ int ret; ++ ++ ret = rtl822x_c45_read_status(phydev); ++ if (ret < 0) ++ return ret; ++ ++ rtl822xb_update_interface(phydev); ++ ++ return 0; ++} ++ ++static bool rtlgen_supports_2_5gbps(struct phy_device *phydev) ++{ ++ int val; ++ ++ phy_write(phydev, RTL821x_PAGE_SELECT, 0xa61); ++ val = phy_read(phydev, 0x13); ++ phy_write(phydev, RTL821x_PAGE_SELECT, 0); ++ ++ return val >= 0 && val & MDIO_PMA_SPEED_2_5G; ++} ++ ++/* On internal PHY's MMD reads over C22 always return 0. ++ * Check a MMD register which is known to be non-zero. ++ */ ++static bool rtlgen_supports_mmd(struct phy_device *phydev) ++{ ++ int val; ++ ++ phy_lock_mdio_bus(phydev); ++ __phy_write(phydev, MII_MMD_CTRL, MDIO_MMD_PCS); ++ __phy_write(phydev, MII_MMD_DATA, MDIO_PCS_EEE_ABLE); ++ __phy_write(phydev, MII_MMD_CTRL, MDIO_MMD_PCS | MII_MMD_CTRL_NOINCR); ++ val = __phy_read(phydev, MII_MMD_DATA); ++ phy_unlock_mdio_bus(phydev); ++ ++ return val > 0; ++} ++ ++static int rtlgen_match_phy_device(struct phy_device *phydev) ++{ ++ return phydev->phy_id == RTL_GENERIC_PHYID && ++ !rtlgen_supports_2_5gbps(phydev); ++} ++ ++static int rtl8226_match_phy_device(struct phy_device *phydev) ++{ ++ return phydev->phy_id == RTL_GENERIC_PHYID && ++ rtlgen_supports_2_5gbps(phydev) && ++ rtlgen_supports_mmd(phydev); ++} ++ ++static int rtlgen_is_c45_match(struct phy_device *phydev, unsigned int id, ++ bool is_c45) ++{ ++ if (phydev->is_c45) ++ return is_c45 && (id == phydev->c45_ids.device_ids[1]); ++ else ++ return !is_c45 && (id == phydev->phy_id); ++} ++ ++static int rtl8221b_match_phy_device(struct phy_device *phydev) ++{ ++ return phydev->phy_id == RTL_8221B && rtlgen_supports_mmd(phydev); ++} ++ ++static int rtl8221b_vb_cg_c22_match_phy_device(struct phy_device *phydev) ++{ ++ return rtlgen_is_c45_match(phydev, RTL_8221B_VB_CG, false); ++} ++ ++static int rtl8221b_vb_cg_c45_match_phy_device(struct phy_device *phydev) ++{ ++ return rtlgen_is_c45_match(phydev, RTL_8221B_VB_CG, true); ++} ++ ++static int rtl8221b_vn_cg_c22_match_phy_device(struct phy_device *phydev) ++{ ++ return rtlgen_is_c45_match(phydev, RTL_8221B_VN_CG, false); ++} ++ ++static int rtl8221b_vn_cg_c45_match_phy_device(struct phy_device *phydev) ++{ ++ return rtlgen_is_c45_match(phydev, RTL_8221B_VN_CG, true); ++} ++ ++static int rtl_internal_nbaset_match_phy_device(struct phy_device *phydev) ++{ ++ if (phydev->is_c45) ++ return false; ++ ++ switch (phydev->phy_id) { ++ case RTL_GENERIC_PHYID: ++ case RTL_8221B: ++ case RTL_8251B: ++ case 0x001cc841: ++ break; ++ default: ++ return false; ++ } ++ ++ return rtlgen_supports_2_5gbps(phydev) && !rtlgen_supports_mmd(phydev); ++} ++ ++static int rtl8251b_c45_match_phy_device(struct phy_device *phydev) ++{ ++ return rtlgen_is_c45_match(phydev, RTL_8251B, true); ++} ++ ++static int rtlgen_resume(struct phy_device *phydev) ++{ ++ int ret = genphy_resume(phydev); ++ ++ /* Internal PHY's from RTL8168h up may not be instantly ready */ ++ msleep(20); ++ ++ return ret; ++} ++ ++static int rtlgen_c45_resume(struct phy_device *phydev) ++{ ++ int ret = genphy_c45_pma_resume(phydev); ++ ++ msleep(20); ++ ++ return ret; ++} ++ ++static int rtl9000a_config_init(struct phy_device *phydev) ++{ ++ phydev->autoneg = AUTONEG_DISABLE; ++ phydev->speed = SPEED_100; ++ phydev->duplex = DUPLEX_FULL; ++ ++ return 0; ++} ++ ++static int rtl9000a_config_aneg(struct phy_device *phydev) ++{ ++ int ret; ++ u16 ctl = 0; ++ ++ switch (phydev->master_slave_set) { ++ case MASTER_SLAVE_CFG_MASTER_FORCE: ++ ctl |= CTL1000_AS_MASTER; ++ break; ++ case MASTER_SLAVE_CFG_SLAVE_FORCE: ++ break; ++ case MASTER_SLAVE_CFG_UNKNOWN: ++ case MASTER_SLAVE_CFG_UNSUPPORTED: ++ return 0; ++ default: ++ phydev_warn(phydev, "Unsupported Master/Slave mode\n"); ++ return -EOPNOTSUPP; ++ } ++ ++ ret = phy_modify_changed(phydev, MII_CTRL1000, CTL1000_AS_MASTER, ctl); ++ if (ret == 1) ++ ret = genphy_soft_reset(phydev); ++ ++ return ret; ++} ++ ++static int rtl9000a_read_status(struct phy_device *phydev) ++{ ++ int ret; ++ ++ phydev->master_slave_get = MASTER_SLAVE_CFG_UNKNOWN; ++ phydev->master_slave_state = MASTER_SLAVE_STATE_UNKNOWN; ++ ++ ret = genphy_update_link(phydev); ++ if (ret) ++ return ret; ++ ++ ret = phy_read(phydev, MII_CTRL1000); ++ if (ret < 0) ++ return ret; ++ if (ret & CTL1000_AS_MASTER) ++ phydev->master_slave_get = MASTER_SLAVE_CFG_MASTER_FORCE; ++ else ++ phydev->master_slave_get = MASTER_SLAVE_CFG_SLAVE_FORCE; ++ ++ ret = phy_read(phydev, MII_STAT1000); ++ if (ret < 0) ++ return ret; ++ if (ret & LPA_1000MSRES) ++ phydev->master_slave_state = MASTER_SLAVE_STATE_MASTER; ++ else ++ phydev->master_slave_state = MASTER_SLAVE_STATE_SLAVE; ++ ++ return 0; ++} ++ ++static int rtl9000a_ack_interrupt(struct phy_device *phydev) ++{ ++ int err; ++ ++ err = phy_read(phydev, RTL8211F_INSR); ++ ++ return (err < 0) ? err : 0; ++} ++ ++static int rtl9000a_config_intr(struct phy_device *phydev) ++{ ++ u16 val; ++ int err; ++ ++ if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { ++ err = rtl9000a_ack_interrupt(phydev); ++ if (err) ++ return err; ++ ++ val = (u16)~RTL9000A_GINMR_LINK_STATUS; ++ err = phy_write_paged(phydev, 0xa42, RTL9000A_GINMR, val); ++ } else { ++ val = ~0; ++ err = phy_write_paged(phydev, 0xa42, RTL9000A_GINMR, val); ++ if (err) ++ return err; ++ ++ err = rtl9000a_ack_interrupt(phydev); ++ } ++ ++ return phy_write_paged(phydev, 0xa42, RTL9000A_GINMR, val); ++} ++ ++static irqreturn_t rtl9000a_handle_interrupt(struct phy_device *phydev) ++{ ++ int irq_status; ++ ++ irq_status = phy_read(phydev, RTL8211F_INSR); ++ if (irq_status < 0) { ++ phy_error(phydev); ++ return IRQ_NONE; ++ } ++ ++ if (!(irq_status & RTL8211F_INER_LINK_STATUS)) ++ return IRQ_NONE; ++ ++ phy_trigger_machine(phydev); ++ ++ return IRQ_HANDLED; ++} ++ ++static struct phy_driver realtek_drvs[] = { ++ { ++ PHY_ID_MATCH_EXACT(0x00008201), ++ .name = "RTL8201CP Ethernet", ++ .read_page = rtl821x_read_page, ++ .write_page = rtl821x_write_page, ++ }, { ++ PHY_ID_MATCH_EXACT(0x001cc816), ++ .name = "RTL8201F Fast Ethernet", ++ .config_intr = &rtl8201_config_intr, ++ .handle_interrupt = rtl8201_handle_interrupt, ++ .suspend = genphy_suspend, ++ .resume = genphy_resume, ++ .read_page = rtl821x_read_page, ++ .write_page = rtl821x_write_page, ++ }, { ++ PHY_ID_MATCH_MODEL(0x001cc880), ++ .name = "RTL8208 Fast Ethernet", ++ .read_mmd = genphy_read_mmd_unsupported, ++ .write_mmd = genphy_write_mmd_unsupported, ++ .suspend = genphy_suspend, ++ .resume = genphy_resume, ++ .read_page = rtl821x_read_page, ++ .write_page = rtl821x_write_page, ++ }, { ++ PHY_ID_MATCH_EXACT(0x001cc910), ++ .name = "RTL8211 Gigabit Ethernet", ++ .config_aneg = rtl8211_config_aneg, ++ .read_mmd = &genphy_read_mmd_unsupported, ++ .write_mmd = &genphy_write_mmd_unsupported, ++ .read_page = rtl821x_read_page, ++ .write_page = rtl821x_write_page, ++ }, { ++ PHY_ID_MATCH_EXACT(0x001cc912), ++ .name = "RTL8211B Gigabit Ethernet", ++ .config_intr = &rtl8211b_config_intr, ++ .handle_interrupt = rtl821x_handle_interrupt, ++ .read_mmd = &genphy_read_mmd_unsupported, ++ .write_mmd = &genphy_write_mmd_unsupported, ++ .suspend = rtl8211b_suspend, ++ .resume = rtl8211b_resume, ++ .read_page = rtl821x_read_page, ++ .write_page = rtl821x_write_page, ++ }, { ++ PHY_ID_MATCH_EXACT(0x001cc913), ++ .name = "RTL8211C Gigabit Ethernet", ++ .config_init = rtl8211c_config_init, ++ .read_mmd = &genphy_read_mmd_unsupported, ++ .write_mmd = &genphy_write_mmd_unsupported, ++ .read_page = rtl821x_read_page, ++ .write_page = rtl821x_write_page, ++ }, { ++ PHY_ID_MATCH_EXACT(0x001cc914), ++ .name = "RTL8211DN Gigabit Ethernet", ++ .config_intr = rtl8211e_config_intr, ++ .handle_interrupt = rtl821x_handle_interrupt, ++ .suspend = genphy_suspend, ++ .resume = genphy_resume, ++ .read_page = rtl821x_read_page, ++ .write_page = rtl821x_write_page, ++ }, { ++ PHY_ID_MATCH_EXACT(0x001cc915), ++ .name = "RTL8211E Gigabit Ethernet", ++ .config_init = &rtl8211e_config_init, ++ .config_intr = &rtl8211e_config_intr, ++ .handle_interrupt = rtl821x_handle_interrupt, ++ .suspend = genphy_suspend, ++ .resume = genphy_resume, ++ .read_page = rtl821x_read_page, ++ .write_page = rtl821x_write_page, ++ }, { ++ PHY_ID_MATCH_EXACT(0x001cc916), ++ .name = "RTL8211F Gigabit Ethernet", ++ .probe = rtl821x_probe, ++ .config_init = &rtl8211f_config_init, ++ .read_status = rtlgen_read_status, ++ .config_intr = &rtl8211f_config_intr, ++ .handle_interrupt = rtl8211f_handle_interrupt, ++ .suspend = rtl821x_suspend, ++ .resume = rtl821x_resume, ++ .read_page = rtl821x_read_page, ++ .write_page = rtl821x_write_page, ++ .flags = PHY_ALWAYS_CALL_SUSPEND, ++ .led_hw_is_supported = rtl8211f_led_hw_is_supported, ++ .led_hw_control_get = rtl8211f_led_hw_control_get, ++ .led_hw_control_set = rtl8211f_led_hw_control_set, ++ }, { ++ PHY_ID_MATCH_EXACT(RTL_8211FVD_PHYID), ++ .name = "RTL8211F-VD Gigabit Ethernet", ++ .probe = rtl821x_probe, ++ .config_init = &rtl8211f_config_init, ++ .read_status = rtlgen_read_status, ++ .config_intr = &rtl8211f_config_intr, ++ .handle_interrupt = rtl8211f_handle_interrupt, ++ .suspend = rtl821x_suspend, ++ .resume = rtl821x_resume, ++ .read_page = rtl821x_read_page, ++ .write_page = rtl821x_write_page, ++ .flags = PHY_ALWAYS_CALL_SUSPEND, ++ }, { ++ .name = "Generic FE-GE Realtek PHY", ++ .match_phy_device = rtlgen_match_phy_device, ++ .read_status = rtlgen_read_status, ++ .suspend = genphy_suspend, ++ .resume = rtlgen_resume, ++ .read_page = rtl821x_read_page, ++ .write_page = rtl821x_write_page, ++ .read_mmd = rtlgen_read_mmd, ++ .write_mmd = rtlgen_write_mmd, ++ }, { ++ .name = "RTL8226 2.5Gbps PHY", ++ .match_phy_device = rtl8226_match_phy_device, ++ .get_features = rtl822x_get_features, ++ .config_aneg = rtl822x_config_aneg, ++ .read_status = rtl822x_read_status, ++ .suspend = genphy_suspend, ++ .resume = rtlgen_resume, ++ .read_page = rtl821x_read_page, ++ .write_page = rtl821x_write_page, ++ }, { ++ .match_phy_device = rtl8221b_match_phy_device, ++ .name = "RTL8226B_RTL8221B 2.5Gbps PHY", ++ .get_features = rtl822x_get_features, ++ .config_aneg = rtl822x_config_aneg, ++ .config_init = rtl822xb_config_init, ++ .get_rate_matching = rtl822xb_get_rate_matching, ++ .read_status = rtl822xb_read_status, ++ .suspend = genphy_suspend, ++ .resume = rtlgen_resume, ++ .read_page = rtl821x_read_page, ++ .write_page = rtl821x_write_page, ++ }, { ++ PHY_ID_MATCH_EXACT(0x001cc838), ++ .name = "RTL8226-CG 2.5Gbps PHY", ++ .get_features = rtl822x_get_features, ++ .config_aneg = rtl822x_config_aneg, ++ .read_status = rtl822x_read_status, ++ .suspend = genphy_suspend, ++ .resume = rtlgen_resume, ++ .read_page = rtl821x_read_page, ++ .write_page = rtl821x_write_page, ++ }, { ++ PHY_ID_MATCH_EXACT(0x001cc848), ++ .name = "RTL8226B-CG_RTL8221B-CG 2.5Gbps PHY", ++ .get_features = rtl822x_get_features, ++ .config_aneg = rtl822x_config_aneg, ++ .config_init = rtl822xb_config_init, ++ .get_rate_matching = rtl822xb_get_rate_matching, ++ .read_status = rtl822xb_read_status, ++ .suspend = genphy_suspend, ++ .resume = rtlgen_resume, ++ .read_page = rtl821x_read_page, ++ .write_page = rtl821x_write_page, ++ }, { ++ .match_phy_device = rtl8221b_vb_cg_c22_match_phy_device, ++ .name = "RTL8221B-VB-CG 2.5Gbps PHY (C22)", ++ .get_features = rtl822x_get_features, ++ .config_aneg = rtl822x_config_aneg, ++ .config_init = rtl822xb_config_init, ++ .get_rate_matching = rtl822xb_get_rate_matching, ++ .read_status = rtl822xb_read_status, ++ .suspend = genphy_suspend, ++ .resume = rtlgen_resume, ++ .read_page = rtl821x_read_page, ++ .write_page = rtl821x_write_page, ++ }, { ++ .match_phy_device = rtl8221b_vb_cg_c45_match_phy_device, ++ .name = "RTL8221B-VB-CG 2.5Gbps PHY (C45)", ++ .config_init = rtl822xb_config_init, ++ .get_rate_matching = rtl822xb_get_rate_matching, ++ .get_features = rtl822x_c45_get_features, ++ .config_aneg = rtl822x_c45_config_aneg, ++ .read_status = rtl822xb_c45_read_status, ++ .suspend = genphy_c45_pma_suspend, ++ .resume = rtlgen_c45_resume, ++ }, { ++ .match_phy_device = rtl8221b_vn_cg_c22_match_phy_device, ++ .name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)", ++ .get_features = rtl822x_get_features, ++ .config_aneg = rtl822x_config_aneg, ++ .config_init = rtl822xb_config_init, ++ .get_rate_matching = rtl822xb_get_rate_matching, ++ .read_status = rtl822xb_read_status, ++ .suspend = genphy_suspend, ++ .resume = rtlgen_resume, ++ .read_page = rtl821x_read_page, ++ .write_page = rtl821x_write_page, ++ }, { ++ .match_phy_device = rtl8221b_vn_cg_c45_match_phy_device, ++ .name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)", ++ .config_init = rtl822xb_config_init, ++ .get_rate_matching = rtl822xb_get_rate_matching, ++ .get_features = rtl822x_c45_get_features, ++ .config_aneg = rtl822x_c45_config_aneg, ++ .read_status = rtl822xb_c45_read_status, ++ .suspend = genphy_c45_pma_suspend, ++ .resume = rtlgen_c45_resume, ++ }, { ++ .match_phy_device = rtl8251b_c45_match_phy_device, ++ .name = "RTL8251B 5Gbps PHY", ++ .get_features = rtl822x_get_features, ++ .config_aneg = rtl822x_config_aneg, ++ .read_status = rtl822x_read_status, ++ .suspend = genphy_suspend, ++ .resume = rtlgen_resume, ++ .read_page = rtl821x_read_page, ++ .write_page = rtl821x_write_page, ++ }, { ++ .match_phy_device = rtl_internal_nbaset_match_phy_device, ++ .name = "Realtek Internal NBASE-T PHY", ++ .flags = PHY_IS_INTERNAL, ++ .get_features = rtl822x_get_features, ++ .config_aneg = rtl822x_config_aneg, ++ .read_status = rtl822x_read_status, ++ .suspend = genphy_suspend, ++ .resume = rtlgen_resume, ++ .read_page = rtl821x_read_page, ++ .write_page = rtl821x_write_page, ++ .read_mmd = rtl822x_read_mmd, ++ .write_mmd = rtl822x_write_mmd, ++ }, { ++ PHY_ID_MATCH_EXACT(0x001ccad0), ++ .name = "RTL8224 2.5Gbps PHY", ++ .get_features = rtl822x_c45_get_features, ++ .config_aneg = rtl822x_c45_config_aneg, ++ .read_status = rtl822x_c45_read_status, ++ .suspend = genphy_c45_pma_suspend, ++ .resume = rtlgen_c45_resume, ++ }, { ++ PHY_ID_MATCH_EXACT(0x001cc961), ++ .name = "RTL8366RB Gigabit Ethernet", ++ .config_init = &rtl8366rb_config_init, ++ /* These interrupts are handled by the irq controller ++ * embedded inside the RTL8366RB, they get unmasked when the ++ * irq is requested and ACKed by reading the status register, ++ * which is done by the irqchip code. ++ */ ++ .config_intr = genphy_no_config_intr, ++ .handle_interrupt = genphy_handle_interrupt_no_ack, ++ .suspend = genphy_suspend, ++ .resume = genphy_resume, ++ }, { ++ PHY_ID_MATCH_EXACT(0x001ccb00), ++ .name = "RTL9000AA_RTL9000AN Ethernet", ++ .features = PHY_BASIC_T1_FEATURES, ++ .config_init = rtl9000a_config_init, ++ .config_aneg = rtl9000a_config_aneg, ++ .read_status = rtl9000a_read_status, ++ .config_intr = rtl9000a_config_intr, ++ .handle_interrupt = rtl9000a_handle_interrupt, ++ .suspend = genphy_suspend, ++ .resume = genphy_resume, ++ .read_page = rtl821x_read_page, ++ .write_page = rtl821x_write_page, ++ }, { ++ PHY_ID_MATCH_EXACT(0x001cc942), ++ .name = "RTL8365MB-VC Gigabit Ethernet", ++ /* Interrupt handling analogous to RTL8366RB */ ++ .config_intr = genphy_no_config_intr, ++ .handle_interrupt = genphy_handle_interrupt_no_ack, ++ .suspend = genphy_suspend, ++ .resume = genphy_resume, ++ }, { ++ PHY_ID_MATCH_EXACT(0x001cc960), ++ .name = "RTL8366S Gigabit Ethernet", ++ .suspend = genphy_suspend, ++ .resume = genphy_resume, ++ .read_mmd = genphy_read_mmd_unsupported, ++ .write_mmd = genphy_write_mmd_unsupported, ++ }, ++}; ++ ++module_phy_driver(realtek_drvs); ++ ++static const struct mdio_device_id __maybe_unused realtek_tbl[] = { ++ { PHY_ID_MATCH_VENDOR(0x001cc800) }, ++ { } ++}; ++ ++MODULE_DEVICE_TABLE(mdio, realtek_tbl); diff --git a/target/linux/generic/backport-6.6/781-22-v6.14-net-phy-realtek-add-hwmon-support-for-temp-sensor-on.patch b/target/linux/generic/backport-6.6/781-22-v6.14-net-phy-realtek-add-hwmon-support-for-temp-sensor-on.patch new file mode 100644 index 00000000000000..4c1e2f06240407 --- /dev/null +++ b/target/linux/generic/backport-6.6/781-22-v6.14-net-phy-realtek-add-hwmon-support-for-temp-sensor-on.patch @@ -0,0 +1,180 @@ +From 33700ca45b7d2e1655d4cad95e25671e8a94e2f0 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Sat, 11 Jan 2025 21:51:24 +0100 +Subject: [PATCH] net: phy: realtek: add hwmon support for temp sensor on + RTL822x + +This adds hwmon support for the temperature sensor on RTL822x. +It's available on the standalone versions of the PHY's, and on +the integrated PHY's in RTL8125B/RTL8125D/RTL8126. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Andrew Lunn +Link: https://patch.msgid.link/ad6bfe9f-6375-4a00-84b4-bfb38a21bd71@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/phy/realtek/Kconfig | 6 ++ + drivers/net/phy/realtek/Makefile | 1 + + drivers/net/phy/realtek/realtek.h | 10 ++++ + drivers/net/phy/realtek/realtek_hwmon.c | 79 +++++++++++++++++++++++++ + drivers/net/phy/realtek/realtek_main.c | 12 ++++ + 5 files changed, 108 insertions(+) + create mode 100644 drivers/net/phy/realtek/realtek.h + create mode 100644 drivers/net/phy/realtek/realtek_hwmon.c + +--- a/drivers/net/phy/realtek/Kconfig ++++ b/drivers/net/phy/realtek/Kconfig +@@ -3,3 +3,9 @@ config REALTEK_PHY + tristate "Realtek PHYs" + help + Currently supports RTL821x/RTL822x and fast ethernet PHYs ++ ++config REALTEK_PHY_HWMON ++ def_bool REALTEK_PHY && HWMON ++ depends on !(REALTEK_PHY=y && HWMON=m) ++ help ++ Optional hwmon support for the temperature sensor +--- a/drivers/net/phy/realtek/Makefile ++++ b/drivers/net/phy/realtek/Makefile +@@ -1,3 +1,4 @@ + # SPDX-License-Identifier: GPL-2.0 + realtek-y += realtek_main.o ++realtek-$(CONFIG_REALTEK_PHY_HWMON) += realtek_hwmon.o + obj-$(CONFIG_REALTEK_PHY) += realtek.o +--- /dev/null ++++ b/drivers/net/phy/realtek/realtek.h +@@ -0,0 +1,10 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++ ++#ifndef REALTEK_H ++#define REALTEK_H ++ ++#include ++ ++int rtl822x_hwmon_init(struct phy_device *phydev); ++ ++#endif /* REALTEK_H */ +--- /dev/null ++++ b/drivers/net/phy/realtek/realtek_hwmon.c +@@ -0,0 +1,86 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * HWMON support for Realtek PHY's ++ * ++ * Author: Heiner Kallweit ++ */ ++ ++#include ++#include ++ ++#include "realtek.h" ++ ++#define RTL822X_VND2_TSALRM 0xa662 ++#define RTL822X_VND2_TSRR 0xbd84 ++#define RTL822X_VND2_TSSR 0xb54c ++ ++static umode_t rtl822x_hwmon_is_visible(const void *drvdata, ++ enum hwmon_sensor_types type, ++ u32 attr, int channel) ++{ ++ return 0444; ++} ++ ++static int rtl822x_hwmon_get_temp(int raw) ++{ ++ if (raw >= 512) ++ raw -= 1024; ++ ++ return 1000 * raw / 2; ++} ++ ++static int rtl822x_hwmon_read(struct device *dev, enum hwmon_sensor_types type, ++ u32 attr, int channel, long *val) ++{ ++ struct phy_device *phydev = dev_get_drvdata(dev); ++ int raw; ++ ++ switch (attr) { ++ case hwmon_temp_input: ++ raw = phy_read_mmd(phydev, MDIO_MMD_VEND2, RTL822X_VND2_TSRR) & 0x3ff; ++ *val = rtl822x_hwmon_get_temp(raw); ++ break; ++ case hwmon_temp_max: ++ /* Chip reduces speed to 1G if threshold is exceeded */ ++ raw = phy_read_mmd(phydev, MDIO_MMD_VEND2, RTL822X_VND2_TSSR) >> 6; ++ *val = rtl822x_hwmon_get_temp(raw); ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++static const struct hwmon_ops rtl822x_hwmon_ops = { ++ .is_visible = rtl822x_hwmon_is_visible, ++ .read = rtl822x_hwmon_read, ++}; ++ ++static const struct hwmon_channel_info * const rtl822x_hwmon_info[] = { ++ HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT | HWMON_T_MAX), ++ NULL ++}; ++ ++static const struct hwmon_chip_info rtl822x_hwmon_chip_info = { ++ .ops = &rtl822x_hwmon_ops, ++ .info = rtl822x_hwmon_info, ++}; ++ ++int rtl822x_hwmon_init(struct phy_device *phydev) ++{ ++ struct device *hwdev, *dev = &phydev->mdio.dev; ++ const char *name; ++ ++ /* Ensure over-temp alarm is reset. */ ++ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2, RTL822X_VND2_TSALRM, 3); ++ ++ name = devm_hwmon_sanitize_name(dev, dev_name(dev)); ++ if (IS_ERR(name)) ++ return PTR_ERR(name); ++ ++ hwdev = devm_hwmon_device_register_with_info(dev, name, phydev, ++ &rtl822x_hwmon_chip_info, ++ NULL); ++ return PTR_ERR_OR_ZERO(hwdev); ++} +--- a/drivers/net/phy/realtek/realtek_main.c ++++ b/drivers/net/phy/realtek/realtek_main.c +@@ -14,6 +14,8 @@ + #include + #include + ++#include "realtek.h" ++ + #define RTL821x_PHYSR 0x11 + #define RTL821x_PHYSR_DUPLEX BIT(13) + #define RTL821x_PHYSR_SPEED GENMASK(15, 14) +@@ -820,6 +822,15 @@ static int rtl822x_write_mmd(struct phy_ + return ret; + } + ++static int rtl822x_probe(struct phy_device *phydev) ++{ ++ if (IS_ENABLED(CONFIG_REALTEK_PHY_HWMON) && ++ phydev->phy_id != RTL_GENERIC_PHYID) ++ return rtl822x_hwmon_init(phydev); ++ ++ return 0; ++} ++ + static int rtl822xb_config_init(struct phy_device *phydev) + { + bool has_2500, has_sgmii; +@@ -1519,6 +1530,7 @@ static struct phy_driver realtek_drvs[] + .match_phy_device = rtl_internal_nbaset_match_phy_device, + .name = "Realtek Internal NBASE-T PHY", + .flags = PHY_IS_INTERNAL, ++ .probe = rtl822x_probe, + .get_features = rtl822x_get_features, + .config_aneg = rtl822x_config_aneg, + .read_status = rtl822x_read_status, diff --git a/target/linux/generic/pending-6.6/720-01-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch b/target/linux/generic/pending-6.6/720-01-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch index 8de57707a267c4..52ffc7a0f96d42 100644 --- a/target/linux/generic/pending-6.6/720-01-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch +++ b/target/linux/generic/pending-6.6/720-01-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch @@ -10,12 +10,12 @@ the PHY. Reported-by: Yevhen Kolomeiko Signed-off-by: Daniel Golle --- - drivers/net/phy/realtek.c | 6 ++++++ + drivers/net/phy/realtek/realtek_main.c | 6 ++++++ 1 file changed, 6 insertions(+) ---- a/drivers/net/phy/realtek.c -+++ b/drivers/net/phy/realtek.c -@@ -1412,6 +1412,7 @@ static struct phy_driver realtek_drvs[] +--- a/drivers/net/phy/realtek/realtek_main.c ++++ b/drivers/net/phy/realtek/realtek_main.c +@@ -1431,6 +1431,7 @@ static struct phy_driver realtek_drvs[] }, { .name = "RTL8226 2.5Gbps PHY", .match_phy_device = rtl8226_match_phy_device, @@ -23,7 +23,7 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, -@@ -1422,6 +1423,7 @@ static struct phy_driver realtek_drvs[] +@@ -1441,6 +1442,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_match_phy_device, .name = "RTL8226B_RTL8221B 2.5Gbps PHY", @@ -31,7 +31,7 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .config_init = rtl822xb_config_init, -@@ -1434,6 +1436,7 @@ static struct phy_driver realtek_drvs[] +@@ -1453,6 +1455,7 @@ static struct phy_driver realtek_drvs[] }, { PHY_ID_MATCH_EXACT(0x001cc838), .name = "RTL8226-CG 2.5Gbps PHY", @@ -39,7 +39,7 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, -@@ -1444,6 +1447,7 @@ static struct phy_driver realtek_drvs[] +@@ -1463,6 +1466,7 @@ static struct phy_driver realtek_drvs[] }, { PHY_ID_MATCH_EXACT(0x001cc848), .name = "RTL8226B-CG_RTL8221B-CG 2.5Gbps PHY", @@ -47,7 +47,7 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .config_init = rtl822xb_config_init, -@@ -1456,6 +1460,7 @@ static struct phy_driver realtek_drvs[] +@@ -1475,6 +1479,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c22_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C22)", @@ -55,7 +55,7 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .config_init = rtl822xb_config_init, -@@ -1468,6 +1473,7 @@ static struct phy_driver realtek_drvs[] +@@ -1487,6 +1492,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c45_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C45)", @@ -63,7 +63,7 @@ Signed-off-by: Daniel Golle .config_init = rtl822xb_config_init, .get_rate_matching = rtl822xb_get_rate_matching, .get_features = rtl822x_c45_get_features, -@@ -1478,6 +1484,7 @@ static struct phy_driver realtek_drvs[] +@@ -1497,6 +1503,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c22_match_phy_device, .name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)", @@ -71,7 +71,7 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .config_init = rtl822xb_config_init, -@@ -1490,6 +1497,7 @@ static struct phy_driver realtek_drvs[] +@@ -1509,6 +1516,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c45_match_phy_device, .name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)", diff --git a/target/linux/generic/pending-6.6/720-02-net-phy-realtek-disable-SGMII-in-band-AN-for-2-5G-PHYs.patch b/target/linux/generic/pending-6.6/720-02-net-phy-realtek-disable-SGMII-in-band-AN-for-2-5G-PHYs.patch index 7e48c16515db8e..edc03b55758ef1 100644 --- a/target/linux/generic/pending-6.6/720-02-net-phy-realtek-disable-SGMII-in-band-AN-for-2-5G-PHYs.patch +++ b/target/linux/generic/pending-6.6/720-02-net-phy-realtek-disable-SGMII-in-band-AN-for-2-5G-PHYs.patch @@ -15,12 +15,12 @@ Reported-by: Yevhen Kolomeiko Tested-by: Yevhen Kolomeiko Signed-off-by: Daniel Golle --- - drivers/net/phy/realtek.c | 27 +++++++++++++++++++++++++-- + drivers/net/phy/realtek/realtek_main.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) ---- a/drivers/net/phy/realtek.c -+++ b/drivers/net/phy/realtek.c -@@ -815,8 +815,8 @@ static int rtl822x_write_mmd(struct phy_ +--- a/drivers/net/phy/realtek/realtek_main.c ++++ b/drivers/net/phy/realtek/realtek_main.c +@@ -834,8 +834,8 @@ static int rtl822x_probe(struct phy_devi static int rtl822xb_config_init(struct phy_device *phydev) { bool has_2500, has_sgmii; @@ -30,7 +30,7 @@ Signed-off-by: Daniel Golle has_2500 = test_bit(PHY_INTERFACE_MODE_2500BASEX, phydev->host_interfaces) || -@@ -866,7 +866,29 @@ static int rtl822xb_config_init(struct p +@@ -885,7 +885,29 @@ static int rtl822xb_config_init(struct p if (ret < 0) return ret; diff --git a/target/linux/generic/pending-6.6/720-03-net-phy-realtek-make-sure-paged-read-is-protected-by.patch b/target/linux/generic/pending-6.6/720-03-net-phy-realtek-make-sure-paged-read-is-protected-by.patch index 722ec02cdceff0..3a3d0525050e27 100644 --- a/target/linux/generic/pending-6.6/720-03-net-phy-realtek-make-sure-paged-read-is-protected-by.patch +++ b/target/linux/generic/pending-6.6/720-03-net-phy-realtek-make-sure-paged-read-is-protected-by.patch @@ -13,12 +13,12 @@ rtl821x_write_page instead of 3 individually locked MDIO bus operations. Signed-off-by: Daniel Golle --- - drivers/net/phy/realtek.c | 8 +++++--- + drivers/net/phy/realtek/realtek_main.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) ---- a/drivers/net/phy/realtek.c -+++ b/drivers/net/phy/realtek.c -@@ -1093,9 +1093,11 @@ static bool rtlgen_supports_2_5gbps(stru +--- a/drivers/net/phy/realtek/realtek_main.c ++++ b/drivers/net/phy/realtek/realtek_main.c +@@ -1112,9 +1112,11 @@ static bool rtlgen_supports_2_5gbps(stru { int val; diff --git a/target/linux/generic/pending-6.6/720-04-net-phy-realtek-introduce-rtl822x_probe.patch b/target/linux/generic/pending-6.6/720-04-net-phy-realtek-introduce-rtl822x_probe.patch index 1b9cdada6dbe3b..42873e7bdf8be7 100644 --- a/target/linux/generic/pending-6.6/720-04-net-phy-realtek-introduce-rtl822x_probe.patch +++ b/target/linux/generic/pending-6.6/720-04-net-phy-realtek-introduce-rtl822x_probe.patch @@ -8,12 +8,12 @@ just like for RTL821x 1GE PHYs. Signed-off-by: Daniel Golle --- - drivers/net/phy/realtek.c | 11 +++++++++++ + drivers/net/phy/realtek/realtek_main.c | 11 +++++++++++ 1 file changed, 11 insertions(+) ---- a/drivers/net/phy/realtek.c -+++ b/drivers/net/phy/realtek.c -@@ -80,6 +80,10 @@ +--- a/drivers/net/phy/realtek/realtek_main.c ++++ b/drivers/net/phy/realtek/realtek_main.c +@@ -82,6 +82,10 @@ #define RTL822X_VND2_GANLPAR 0xa414 @@ -24,11 +24,11 @@ Signed-off-by: Daniel Golle #define RTL8366RB_POWER_SAVE 0x15 #define RTL8366RB_POWER_SAVE_ON BIT(12) -@@ -1189,6 +1193,25 @@ static int rtl8251b_c45_match_phy_device +@@ -1208,6 +1212,25 @@ static int rtl8251b_c45_match_phy_device return rtlgen_is_c45_match(phydev, RTL_8251B, true); } -+static int rtl822x_probe(struct phy_device *phydev) ++static int rtl822x_aldps_probe(struct phy_device *phydev) +{ + struct device *dev = &phydev->mdio.dev; + int val; @@ -50,51 +50,51 @@ Signed-off-by: Daniel Golle static int rtlgen_resume(struct phy_device *phydev) { int ret = genphy_resume(phydev); -@@ -1460,6 +1483,7 @@ static struct phy_driver realtek_drvs[] +@@ -1479,6 +1502,7 @@ static struct phy_driver realtek_drvs[] }, { PHY_ID_MATCH_EXACT(0x001cc838), .name = "RTL8226-CG 2.5Gbps PHY", -+ .probe = rtl822x_probe, ++ .probe = rtl822x_aldps_probe, .soft_reset = genphy_soft_reset, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, -@@ -1471,6 +1495,7 @@ static struct phy_driver realtek_drvs[] +@@ -1490,6 +1514,7 @@ static struct phy_driver realtek_drvs[] }, { PHY_ID_MATCH_EXACT(0x001cc848), .name = "RTL8226B-CG_RTL8221B-CG 2.5Gbps PHY", -+ .probe = rtl822x_probe, ++ .probe = rtl822x_aldps_probe, .soft_reset = genphy_soft_reset, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, -@@ -1484,6 +1509,7 @@ static struct phy_driver realtek_drvs[] +@@ -1503,6 +1528,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c22_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C22)", -+ .probe = rtl822x_probe, ++ .probe = rtl822x_aldps_probe, .soft_reset = genphy_soft_reset, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, -@@ -1497,6 +1523,7 @@ static struct phy_driver realtek_drvs[] +@@ -1516,6 +1542,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c45_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C45)", -+ .probe = rtl822x_probe, ++ .probe = rtl822x_aldps_probe, .soft_reset = genphy_soft_reset, .config_init = rtl822xb_config_init, .get_rate_matching = rtl822xb_get_rate_matching, -@@ -1508,6 +1535,7 @@ static struct phy_driver realtek_drvs[] +@@ -1527,6 +1554,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c22_match_phy_device, .name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)", -+ .probe = rtl822x_probe, ++ .probe = rtl822x_aldps_probe, .soft_reset = genphy_soft_reset, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, -@@ -1521,6 +1549,7 @@ static struct phy_driver realtek_drvs[] +@@ -1540,6 +1568,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c45_match_phy_device, .name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)", -+ .probe = rtl822x_probe, ++ .probe = rtl822x_aldps_probe, .soft_reset = genphy_soft_reset, .config_init = rtl822xb_config_init, .get_rate_matching = rtl822xb_get_rate_matching, diff --git a/target/linux/generic/pending-6.6/720-05-net-phy-realtek-detect-early-version-of-RTL8221B.patch b/target/linux/generic/pending-6.6/720-05-net-phy-realtek-detect-early-version-of-RTL8221B.patch index 63ffd0a0c9303e..39c1929b5f60e0 100644 --- a/target/linux/generic/pending-6.6/720-05-net-phy-realtek-detect-early-version-of-RTL8221B.patch +++ b/target/linux/generic/pending-6.6/720-05-net-phy-realtek-detect-early-version-of-RTL8221B.patch @@ -12,9 +12,9 @@ over the implemented MMDs. Signed-off-by: Daniel Golle [forward-port by @namiltd] Signed-off-by: Mieczyslaw Nalewaj ---- a/drivers/net/phy/realtek.c -+++ b/drivers/net/phy/realtek.c -@@ -1139,10 +1139,32 @@ static int rtl8226_match_phy_device(stru +--- a/drivers/net/phy/realtek/realtek_main.c ++++ b/drivers/net/phy/realtek/realtek_main.c +@@ -1158,10 +1158,32 @@ static int rtl8226_match_phy_device(stru static int rtlgen_is_c45_match(struct phy_device *phydev, unsigned int id, bool is_c45) { diff --git a/target/linux/generic/pending-6.6/720-06-net-phy-realtek-support-interrupt-of-RTL8221B.patch b/target/linux/generic/pending-6.6/720-06-net-phy-realtek-support-interrupt-of-RTL8221B.patch index c9e15fb4630945..1ab2fe7618dd4a 100644 --- a/target/linux/generic/pending-6.6/720-06-net-phy-realtek-support-interrupt-of-RTL8221B.patch +++ b/target/linux/generic/pending-6.6/720-06-net-phy-realtek-support-interrupt-of-RTL8221B.patch @@ -7,12 +7,12 @@ This commit introduces interrupt support for RTL8221B. Signed-off-by: Jianhui Zhao --- - drivers/net/phy/realtek.c | 47 +++++++++++++++++++++++++++++++++++++++ + drivers/net/phy/realtek/realtek_main.c | 47 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) ---- a/drivers/net/phy/realtek.c -+++ b/drivers/net/phy/realtek.c -@@ -1369,6 +1369,51 @@ static irqreturn_t rtl9000a_handle_inter +--- a/drivers/net/phy/realtek/realtek_main.c ++++ b/drivers/net/phy/realtek/realtek_main.c +@@ -1388,6 +1388,51 @@ static irqreturn_t rtl9000a_handle_inter return IRQ_HANDLED; } @@ -64,39 +64,39 @@ Signed-off-by: Jianhui Zhao static struct phy_driver realtek_drvs[] = { { PHY_ID_MATCH_EXACT(0x00008201), -@@ -1531,6 +1576,8 @@ static struct phy_driver realtek_drvs[] +@@ -1550,6 +1595,8 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c22_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C22)", + .config_intr = rtl8221b_config_intr, + .handle_interrupt = rtl8221b_handle_interrupt, - .probe = rtl822x_probe, + .probe = rtl822x_aldps_probe, .soft_reset = genphy_soft_reset, .get_features = rtl822x_get_features, -@@ -1545,6 +1592,8 @@ static struct phy_driver realtek_drvs[] +@@ -1564,6 +1611,8 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c45_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C45)", + .config_intr = rtl8221b_config_intr, + .handle_interrupt = rtl8221b_handle_interrupt, - .probe = rtl822x_probe, + .probe = rtl822x_aldps_probe, .soft_reset = genphy_soft_reset, .config_init = rtl822xb_config_init, -@@ -1557,6 +1606,8 @@ static struct phy_driver realtek_drvs[] +@@ -1576,6 +1625,8 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c22_match_phy_device, .name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)", + .config_intr = rtl8221b_config_intr, + .handle_interrupt = rtl8221b_handle_interrupt, - .probe = rtl822x_probe, + .probe = rtl822x_aldps_probe, .soft_reset = genphy_soft_reset, .get_features = rtl822x_get_features, -@@ -1571,6 +1622,8 @@ static struct phy_driver realtek_drvs[] +@@ -1590,6 +1641,8 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c45_match_phy_device, .name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)", + .config_intr = rtl8221b_config_intr, + .handle_interrupt = rtl8221b_handle_interrupt, - .probe = rtl822x_probe, + .probe = rtl822x_aldps_probe, .soft_reset = genphy_soft_reset, .config_init = rtl822xb_config_init, diff --git a/target/linux/mediatek/patches-6.6/500-gsw-rtl8367s-mt7622-support.patch b/target/linux/mediatek/patches-6.6/500-gsw-rtl8367s-mt7622-support.patch index 73f735828f110d..bb7e7be6d24307 100644 --- a/target/linux/mediatek/patches-6.6/500-gsw-rtl8367s-mt7622-support.patch +++ b/target/linux/mediatek/patches-6.6/500-gsw-rtl8367s-mt7622-support.patch @@ -1,6 +1,6 @@ --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -419,6 +419,12 @@ config ROCKCHIP_PHY +@@ -416,6 +416,12 @@ config ROCKCHIP_PHY help Currently supports the integrated Ethernet PHY. @@ -16,7 +16,7 @@ --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile @@ -102,6 +102,7 @@ obj-$(CONFIG_QSEMI_PHY) += qsemi.o - obj-$(CONFIG_REALTEK_PHY) += realtek.o + obj-$(CONFIG_REALTEK_PHY) += realtek/ obj-$(CONFIG_RENESAS_PHY) += uPD60620.o obj-$(CONFIG_ROCKCHIP_PHY) += rockchip.o +obj-$(CONFIG_RTL8367S_GSW) += rtk/ diff --git a/target/linux/mediatek/patches-6.6/735-net-phy-realtek-rtl8261n.patch b/target/linux/mediatek/patches-6.6/735-net-phy-realtek-rtl8261n.patch index 40771202c56528..676bd7c093d24c 100644 --- a/target/linux/mediatek/patches-6.6/735-net-phy-realtek-rtl8261n.patch +++ b/target/linux/mediatek/patches-6.6/735-net-phy-realtek-rtl8261n.patch @@ -1,8 +1,8 @@ --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -399,6 +399,8 @@ config REALTEK_PHY - help - Supports the Realtek 821x PHY. +@@ -396,6 +396,8 @@ config QSEMI_PHY + + source "drivers/net/phy/realtek/Kconfig" +source "drivers/net/phy/rtl8261n/Kconfig" + @@ -14,7 +14,7 @@ @@ -100,6 +100,7 @@ obj-$(CONFIG_NXP_TJA11XX_PHY) += nxp-tja obj-y += qcom/ obj-$(CONFIG_QSEMI_PHY) += qsemi.o - obj-$(CONFIG_REALTEK_PHY) += realtek.o + obj-$(CONFIG_REALTEK_PHY) += realtek/ +obj-y += rtl8261n/ obj-$(CONFIG_RENESAS_PHY) += uPD60620.o obj-$(CONFIG_ROCKCHIP_PHY) += rockchip.o diff --git a/target/linux/realtek/patches-6.6/720-add-rtl-phy.patch b/target/linux/realtek/patches-6.6/720-add-rtl-phy.patch index 43d4a7d4fccf51..4d6866db24f8c0 100644 --- a/target/linux/realtek/patches-6.6/720-add-rtl-phy.patch +++ b/target/linux/realtek/patches-6.6/720-add-rtl-phy.patch @@ -14,9 +14,9 @@ Submitted-by: Birger Koblitz --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -410,6 +410,12 @@ config REALTEK_PHY - help - Supports the Realtek 821x PHY. +@@ -407,6 +407,12 @@ config QSEMI_PHY + + source "drivers/net/phy/realtek/Kconfig" +config REALTEK_SOC_PHY + tristate "Realtek SoC PHYs" @@ -32,7 +32,7 @@ Submitted-by: Birger Koblitz @@ -100,6 +100,7 @@ obj-$(CONFIG_NXP_TJA11XX_PHY) += nxp-tja obj-y += qcom/ obj-$(CONFIG_QSEMI_PHY) += qsemi.o - obj-$(CONFIG_REALTEK_PHY) += realtek.o + obj-$(CONFIG_REALTEK_PHY) += realtek/ +obj-$(CONFIG_REALTEK_SOC_PHY) += rtl83xx-phy.o obj-$(CONFIG_RENESAS_PHY) += uPD60620.o obj-$(CONFIG_ROCKCHIP_PHY) += rockchip.o From 1019df4af919ad0c8ec8aa2b23830eb0fbdd7d62 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Thu, 16 Jan 2025 20:11:43 +0000 Subject: [PATCH 372/877] generic: add pending patches for RealTek Ethernet PHYs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Import patches to fix several issues with status reporting of RealTek 2.5G PHYs. Signed-off-by: Daniel Golle Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 41c164d32bedb6b27ad1fd022dec6d25338db6d6) --- ...clear-1000Base-T-lpa-bits-if-link-is.patch | 78 +++++++++++++++++++ ...clear-master_slave_state-if-link-is-.patch | 61 +++++++++++++++ ...always-clear-10gbase-t-link-partner-.patch | 67 ++++++++++++++++ 3 files changed, 206 insertions(+) create mode 100644 target/linux/generic/pending-6.6/721-net-phy-realtek-clear-1000Base-T-lpa-bits-if-link-is.patch create mode 100644 target/linux/generic/pending-6.6/722-net-phy-realtek-clear-master_slave_state-if-link-is-.patch create mode 100644 target/linux/generic/pending-6.6/723-net-phy-realtek-always-clear-10gbase-t-link-partner-.patch diff --git a/target/linux/generic/pending-6.6/721-net-phy-realtek-clear-1000Base-T-lpa-bits-if-link-is.patch b/target/linux/generic/pending-6.6/721-net-phy-realtek-clear-1000Base-T-lpa-bits-if-link-is.patch new file mode 100644 index 00000000000000..5bc77ed3b83db1 --- /dev/null +++ b/target/linux/generic/pending-6.6/721-net-phy-realtek-clear-1000Base-T-lpa-bits-if-link-is.patch @@ -0,0 +1,78 @@ +From patchwork Wed Jan 15 14:43:35 2025 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Daniel Golle +X-Patchwork-Id: 13940510 +X-Patchwork-Delegate: kuba@kernel.org +Date: Wed, 15 Jan 2025 14:43:35 +0000 +From: Daniel Golle +To: Andrew Lunn , Heiner Kallweit , + Russell King , + "David S. Miller" , + Eric Dumazet , + Jakub Kicinski , Paolo Abeni , + Daniel Golle , + "Russell King (Oracle)" , + netdev@vger.kernel.org, linux-kernel@vger.kernel.org +Subject: [PATCH net 1/3] net: phy: realtek: clear 1000Base-T lpa if link is + down +Message-ID: + <67e38eee4c46b921938fb33f5bc86c8979b9aa33.1736951652.git.daniel@makrotopia.org> +References: +Precedence: bulk +X-Mailing-List: netdev@vger.kernel.org +List-Id: +List-Subscribe: +List-Unsubscribe: +MIME-Version: 1.0 +Content-Disposition: inline +In-Reply-To: +X-Patchwork-Delegate: kuba@kernel.org + +Only read 1000Base-T link partner advertisement if autonegotiation has +completed and otherwise 1000Base-T link partner advertisement bits. + +This fixes bogus 1000Base-T link partner advertisement after link goes +down (eg. by disconnecting the wire). +Fixes: 5cb409b3960e ("net: phy: realtek: clear 1000Base-T link partner advertisement") +Signed-off-by: Daniel Golle +Reviewed-by: Michal Swiatkowski +--- + drivers/net/phy/realtek/realtek_main.c | 19 ++++++++----------- + 1 file changed, 8 insertions(+), 11 deletions(-) + +--- a/drivers/net/phy/realtek/realtek_main.c ++++ b/drivers/net/phy/realtek/realtek_main.c +@@ -1068,23 +1068,20 @@ static int rtl822x_c45_read_status(struc + { + int ret, val; + +- ret = genphy_c45_read_status(phydev); +- if (ret < 0) +- return ret; +- +- if (phydev->autoneg == AUTONEG_DISABLE || +- !genphy_c45_aneg_done(phydev)) +- mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, 0); +- + /* Vendor register as C45 has no standardized support for 1000BaseT */ +- if (phydev->autoneg == AUTONEG_ENABLE) { ++ if (phydev->autoneg == AUTONEG_ENABLE && genphy_c45_aneg_done(phydev)) { + val = phy_read_mmd(phydev, MDIO_MMD_VEND2, + RTL822X_VND2_GANLPAR); + if (val < 0) + return val; +- +- mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, val); ++ } else { ++ val = 0; + } ++ mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, val); ++ ++ ret = genphy_c45_read_status(phydev); ++ if (ret < 0) ++ return ret; + + if (!phydev->link) + return 0; diff --git a/target/linux/generic/pending-6.6/722-net-phy-realtek-clear-master_slave_state-if-link-is-.patch b/target/linux/generic/pending-6.6/722-net-phy-realtek-clear-master_slave_state-if-link-is-.patch new file mode 100644 index 00000000000000..b7e5f8b58fb012 --- /dev/null +++ b/target/linux/generic/pending-6.6/722-net-phy-realtek-clear-master_slave_state-if-link-is-.patch @@ -0,0 +1,61 @@ +From patchwork Wed Jan 15 14:43:43 2025 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Daniel Golle +X-Patchwork-Id: 13940511 +X-Patchwork-Delegate: kuba@kernel.org +Date: Wed, 15 Jan 2025 14:43:43 +0000 +From: Daniel Golle +To: Andrew Lunn , Heiner Kallweit , + Russell King , + "David S. Miller" , + Eric Dumazet , + Jakub Kicinski , Paolo Abeni , + Daniel Golle , + "Russell King (Oracle)" , + netdev@vger.kernel.org, linux-kernel@vger.kernel.org +Subject: [PATCH net 2/3] net: phy: realtek: clear master_slave_state if link + is down +Message-ID: + <2155887c3a665e4132a034df1e9cfdeec0ae48c9.1736951652.git.daniel@makrotopia.org> +References: +Precedence: bulk +X-Mailing-List: netdev@vger.kernel.org +List-Id: +List-Subscribe: +List-Unsubscribe: +MIME-Version: 1.0 +Content-Disposition: inline +In-Reply-To: +X-Patchwork-Delegate: kuba@kernel.org + +rtlgen_decode_physr() which sets master_slave_state isn't called in case +the link is down and other than rtlgen_read_status(), +rtl822x_c45_read_status() doesn't implicitely clear master_slave_state. + +Avoid stale master_slave_state by always setting it to +MASTER_SLAVE_STATE_UNKNOWN in rtl822x_c45_read_status() in case the link +is down. + +Fixes: 081c9c0265c9 ("net: phy: realtek: read duplex and gbit master from PHYSR register") +Signed-off-by: Daniel Golle +Reviewed-by: Michal Swiatkowski +--- + drivers/net/phy/realtek/realtek_main.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/net/phy/realtek/realtek_main.c ++++ b/drivers/net/phy/realtek/realtek_main.c +@@ -1083,8 +1083,10 @@ static int rtl822x_c45_read_status(struc + if (ret < 0) + return ret; + +- if (!phydev->link) ++ if (!phydev->link) { ++ phydev->master_slave_state = MASTER_SLAVE_STATE_UNKNOWN; + return 0; ++ } + + /* Read actual speed from vendor register. */ + val = phy_read_mmd(phydev, MDIO_MMD_VEND2, RTL_VND2_PHYSR); diff --git a/target/linux/generic/pending-6.6/723-net-phy-realtek-always-clear-10gbase-t-link-partner-.patch b/target/linux/generic/pending-6.6/723-net-phy-realtek-always-clear-10gbase-t-link-partner-.patch new file mode 100644 index 00000000000000..23947c2200ed9d --- /dev/null +++ b/target/linux/generic/pending-6.6/723-net-phy-realtek-always-clear-10gbase-t-link-partner-.patch @@ -0,0 +1,67 @@ +From patchwork Wed Jan 15 14:45:00 2025 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Daniel Golle +X-Patchwork-Id: 13940519 +X-Patchwork-Delegate: kuba@kernel.org +Date: Wed, 15 Jan 2025 14:45:00 +0000 +From: Daniel Golle +To: Andrew Lunn , Heiner Kallweit , + Russell King , + "David S. Miller" , + Eric Dumazet , + Jakub Kicinski , Paolo Abeni , + Daniel Golle , + "Russell King (Oracle)" , + netdev@vger.kernel.org, linux-kernel@vger.kernel.org +Subject: [PATCH net 3/3] net: phy: realtek: always clear NBase-T lpa +Message-ID: + <566d4771d68a1e18d2d48860e25891e468e26551.1736951652.git.daniel@makrotopia.org> +References: +Precedence: bulk +X-Mailing-List: netdev@vger.kernel.org +List-Id: +List-Subscribe: +List-Unsubscribe: +MIME-Version: 1.0 +Content-Disposition: inline +In-Reply-To: +X-Patchwork-Delegate: kuba@kernel.org + +Clear NBase-T link partner advertisement before calling +rtlgen_read_status() to avoid phy_resolve_aneg_linkmode() wrongly +setting speed and duplex. + +This fixes bogus 2.5G/5G/10G link partner advertisement and thus +speed and duplex being set by phy_resolve_aneg_linkmode() due to stale +NBase-T lpa. + +Fixes: 68d5cd09e891 ("net: phy: realtek: change order of calls in C22 read_status()") +Signed-off-by: Daniel Golle +Reviewed-by: Michal Swiatkowski +--- + drivers/net/phy/realtek/realtek_main.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/net/phy/realtek/realtek_main.c ++++ b/drivers/net/phy/realtek/realtek_main.c +@@ -997,15 +997,15 @@ static int rtl822x_read_status(struct ph + { + int lpadv, ret; + ++ mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising, 0); ++ + ret = rtlgen_read_status(phydev); + if (ret < 0) + return ret; + + if (phydev->autoneg == AUTONEG_DISABLE || +- !phydev->autoneg_complete) { +- mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising, 0); ++ !phydev->autoneg_complete) + return 0; +- } + + lpadv = phy_read_paged(phydev, 0xa5d, 0x13); + if (lpadv < 0) From 4daf540df3e74d19fc5c34e4e87376a1209e6af9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Fri, 17 Jan 2025 13:45:11 +0100 Subject: [PATCH 373/877] generic: backport pending Realtek PHY patches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These patches have been accepted, so we can move them from pending to backported. Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 7924acdd63490aa436bf114d290cb56cd4eba008) --- ...clear-1000Base-T-lpa-if-link-is-down.patch | 52 +++++++++++++ ...clear-master_slave_state-if-link-is-.patch | 35 +++++++++ ...phy-realtek-always-clear-NBase-T-lpa.patch | 42 ++++++++++ ...dd-support-for-reading-MDIO_MMD_VEN.patch} | 0 ...tek-PHY-driver-to-its-own-subdirect.patch} | 62 +++++++-------- ...dd-hwmon-support-for-temp-sensor-on.patch} | 2 +- ...-use-genphy_soft_reset-for-2.5G-PHYs.patch | 16 ++-- ...make-sure-paged-read-is-protected-by.patch | 2 +- ...-phy-realtek-introduce-rtl822x_probe.patch | 14 ++-- ...tek-detect-early-version-of-RTL8221B.patch | 2 +- ...ealtek-support-interrupt-of-RTL8221B.patch | 10 +-- ...clear-1000Base-T-lpa-bits-if-link-is.patch | 78 ------------------- ...clear-master_slave_state-if-link-is-.patch | 61 --------------- ...always-clear-10gbase-t-link-partner-.patch | 67 ---------------- 14 files changed, 182 insertions(+), 261 deletions(-) create mode 100644 target/linux/generic/backport-6.6/781-20-v6.13-net-phy-realtek-clear-1000Base-T-lpa-if-link-is-down.patch create mode 100644 target/linux/generic/backport-6.6/781-21-v6.13-net-phy-realtek-clear-master_slave_state-if-link-is-.patch create mode 100644 target/linux/generic/backport-6.6/781-22-v6.13-net-phy-realtek-always-clear-NBase-T-lpa.patch rename target/linux/generic/backport-6.6/{781-20-v6.14-net-phy-realtek-add-support-for-reading-MDIO_MMD_VEN.patch => 781-23-v6.14-net-phy-realtek-add-support-for-reading-MDIO_MMD_VEN.patch} (100%) rename target/linux/generic/backport-6.6/{781-21-v6.14-net-phy-move-realtek-PHY-driver-to-its-own-subdirect.patch => 781-24-v6.14-net-phy-move-realtek-PHY-driver-to-its-own-subdirect.patch} (99%) rename target/linux/generic/backport-6.6/{781-22-v6.14-net-phy-realtek-add-hwmon-support-for-temp-sensor-on.patch => 781-25-v6.14-net-phy-realtek-add-hwmon-support-for-temp-sensor-on.patch} (98%) delete mode 100644 target/linux/generic/pending-6.6/721-net-phy-realtek-clear-1000Base-T-lpa-bits-if-link-is.patch delete mode 100644 target/linux/generic/pending-6.6/722-net-phy-realtek-clear-master_slave_state-if-link-is-.patch delete mode 100644 target/linux/generic/pending-6.6/723-net-phy-realtek-always-clear-10gbase-t-link-partner-.patch diff --git a/target/linux/generic/backport-6.6/781-20-v6.13-net-phy-realtek-clear-1000Base-T-lpa-if-link-is-down.patch b/target/linux/generic/backport-6.6/781-20-v6.13-net-phy-realtek-clear-1000Base-T-lpa-if-link-is-down.patch new file mode 100644 index 00000000000000..3e9631e4a313f9 --- /dev/null +++ b/target/linux/generic/backport-6.6/781-20-v6.13-net-phy-realtek-clear-1000Base-T-lpa-if-link-is-down.patch @@ -0,0 +1,52 @@ +From 34d5a86ff7bbe225fba3ad91f9b4dc85fb408e18 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Wed, 15 Jan 2025 14:43:35 +0000 +Subject: [PATCH] net: phy: realtek: clear 1000Base-T lpa if link is down + +Only read 1000Base-T link partner advertisement if autonegotiation has +completed and otherwise 1000Base-T link partner advertisement bits. + +This fixes bogus 1000Base-T link partner advertisement after link goes +down (eg. by disconnecting the wire). +Fixes: 5cb409b3960e ("net: phy: realtek: clear 1000Base-T link partner advertisement") +Signed-off-by: Daniel Golle +Reviewed-by: Michal Swiatkowski +Signed-off-by: David S. Miller +--- + drivers/net/phy/realtek.c | 19 ++++++++----------- + 1 file changed, 8 insertions(+), 11 deletions(-) + +--- a/drivers/net/phy/realtek.c ++++ b/drivers/net/phy/realtek.c +@@ -1023,23 +1023,20 @@ static int rtl822x_c45_read_status(struc + { + int ret, val; + +- ret = genphy_c45_read_status(phydev); +- if (ret < 0) +- return ret; +- +- if (phydev->autoneg == AUTONEG_DISABLE || +- !genphy_c45_aneg_done(phydev)) +- mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, 0); +- + /* Vendor register as C45 has no standardized support for 1000BaseT */ +- if (phydev->autoneg == AUTONEG_ENABLE) { ++ if (phydev->autoneg == AUTONEG_ENABLE && genphy_c45_aneg_done(phydev)) { + val = phy_read_mmd(phydev, MDIO_MMD_VEND2, + RTL822X_VND2_GANLPAR); + if (val < 0) + return val; +- +- mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, val); ++ } else { ++ val = 0; + } ++ mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, val); ++ ++ ret = genphy_c45_read_status(phydev); ++ if (ret < 0) ++ return ret; + + if (!phydev->link) + return 0; diff --git a/target/linux/generic/backport-6.6/781-21-v6.13-net-phy-realtek-clear-master_slave_state-if-link-is-.patch b/target/linux/generic/backport-6.6/781-21-v6.13-net-phy-realtek-clear-master_slave_state-if-link-is-.patch new file mode 100644 index 00000000000000..778602d3e5b501 --- /dev/null +++ b/target/linux/generic/backport-6.6/781-21-v6.13-net-phy-realtek-clear-master_slave_state-if-link-is-.patch @@ -0,0 +1,35 @@ +From ea8318cb33e593bbfc59d637eae45a69732c5387 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Wed, 15 Jan 2025 14:43:43 +0000 +Subject: [PATCH] net: phy: realtek: clear master_slave_state if link is down + +rtlgen_decode_physr() which sets master_slave_state isn't called in case +the link is down and other than rtlgen_read_status(), +rtl822x_c45_read_status() doesn't implicitely clear master_slave_state. + +Avoid stale master_slave_state by always setting it to +MASTER_SLAVE_STATE_UNKNOWN in rtl822x_c45_read_status() in case the link +is down. + +Fixes: 081c9c0265c9 ("net: phy: realtek: read duplex and gbit master from PHYSR register") +Signed-off-by: Daniel Golle +Reviewed-by: Michal Swiatkowski +Signed-off-by: David S. Miller +--- + drivers/net/phy/realtek.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/net/phy/realtek.c ++++ b/drivers/net/phy/realtek.c +@@ -1038,8 +1038,10 @@ static int rtl822x_c45_read_status(struc + if (ret < 0) + return ret; + +- if (!phydev->link) ++ if (!phydev->link) { ++ phydev->master_slave_state = MASTER_SLAVE_STATE_UNKNOWN; + return 0; ++ } + + /* Read actual speed from vendor register. */ + val = phy_read_mmd(phydev, MDIO_MMD_VEND2, RTL_VND2_PHYSR); diff --git a/target/linux/generic/backport-6.6/781-22-v6.13-net-phy-realtek-always-clear-NBase-T-lpa.patch b/target/linux/generic/backport-6.6/781-22-v6.13-net-phy-realtek-always-clear-NBase-T-lpa.patch new file mode 100644 index 00000000000000..d365ed0ad24761 --- /dev/null +++ b/target/linux/generic/backport-6.6/781-22-v6.13-net-phy-realtek-always-clear-NBase-T-lpa.patch @@ -0,0 +1,42 @@ +From d3eb58549842c60ed46f37da7f4da969e3d6ecd3 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Wed, 15 Jan 2025 14:45:00 +0000 +Subject: [PATCH] net: phy: realtek: always clear NBase-T lpa + +Clear NBase-T link partner advertisement before calling +rtlgen_read_status() to avoid phy_resolve_aneg_linkmode() wrongly +setting speed and duplex. + +This fixes bogus 2.5G/5G/10G link partner advertisement and thus +speed and duplex being set by phy_resolve_aneg_linkmode() due to stale +NBase-T lpa. + +Fixes: 68d5cd09e891 ("net: phy: realtek: change order of calls in C22 read_status()") +Signed-off-by: Daniel Golle +Reviewed-by: Michal Swiatkowski +Signed-off-by: David S. Miller +--- + drivers/net/phy/realtek.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/net/phy/realtek.c ++++ b/drivers/net/phy/realtek.c +@@ -952,15 +952,15 @@ static int rtl822x_read_status(struct ph + { + int lpadv, ret; + ++ mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising, 0); ++ + ret = rtlgen_read_status(phydev); + if (ret < 0) + return ret; + + if (phydev->autoneg == AUTONEG_DISABLE || +- !phydev->autoneg_complete) { +- mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising, 0); ++ !phydev->autoneg_complete) + return 0; +- } + + lpadv = phy_read_paged(phydev, 0xa5d, 0x13); + if (lpadv < 0) diff --git a/target/linux/generic/backport-6.6/781-20-v6.14-net-phy-realtek-add-support-for-reading-MDIO_MMD_VEN.patch b/target/linux/generic/backport-6.6/781-23-v6.14-net-phy-realtek-add-support-for-reading-MDIO_MMD_VEN.patch similarity index 100% rename from target/linux/generic/backport-6.6/781-20-v6.14-net-phy-realtek-add-support-for-reading-MDIO_MMD_VEN.patch rename to target/linux/generic/backport-6.6/781-23-v6.14-net-phy-realtek-add-support-for-reading-MDIO_MMD_VEN.patch diff --git a/target/linux/generic/backport-6.6/781-21-v6.14-net-phy-move-realtek-PHY-driver-to-its-own-subdirect.patch b/target/linux/generic/backport-6.6/781-24-v6.14-net-phy-move-realtek-PHY-driver-to-its-own-subdirect.patch similarity index 99% rename from target/linux/generic/backport-6.6/781-21-v6.14-net-phy-move-realtek-PHY-driver-to-its-own-subdirect.patch rename to target/linux/generic/backport-6.6/781-24-v6.14-net-phy-move-realtek-PHY-driver-to-its-own-subdirect.patch index b410ab8a32bcc0..e66d724a981f66 100644 --- a/target/linux/generic/backport-6.6/781-21-v6.14-net-phy-move-realtek-PHY-driver-to-its-own-subdirect.patch +++ b/target/linux/generic/backport-6.6/781-24-v6.14-net-phy-move-realtek-PHY-driver-to-its-own-subdirect.patch @@ -63,7 +63,7 @@ Signed-off-by: Jakub Kicinski +obj-$(CONFIG_REALTEK_PHY) += realtek.o --- a/drivers/net/phy/realtek.c +++ /dev/null -@@ -1,1590 +0,0 @@ +@@ -1,1589 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* drivers/net/phy/realtek.c - * @@ -1026,15 +1026,15 @@ Signed-off-by: Jakub Kicinski -{ - int lpadv, ret; - +- mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising, 0); +- - ret = rtlgen_read_status(phydev); - if (ret < 0) - return ret; - - if (phydev->autoneg == AUTONEG_DISABLE || -- !phydev->autoneg_complete) { -- mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising, 0); +- !phydev->autoneg_complete) - return 0; -- } - - lpadv = phy_read_paged(phydev, 0xa5d, 0x13); - if (lpadv < 0) @@ -1097,26 +1097,25 @@ Signed-off-by: Jakub Kicinski -{ - int ret, val; - -- ret = genphy_c45_read_status(phydev); -- if (ret < 0) -- return ret; -- -- if (phydev->autoneg == AUTONEG_DISABLE || -- !genphy_c45_aneg_done(phydev)) -- mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, 0); -- - /* Vendor register as C45 has no standardized support for 1000BaseT */ -- if (phydev->autoneg == AUTONEG_ENABLE) { +- if (phydev->autoneg == AUTONEG_ENABLE && genphy_c45_aneg_done(phydev)) { - val = phy_read_mmd(phydev, MDIO_MMD_VEND2, - RTL822X_VND2_GANLPAR); - if (val < 0) - return val; -- -- mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, val); +- } else { +- val = 0; - } +- mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, val); - -- if (!phydev->link) +- ret = genphy_c45_read_status(phydev); +- if (ret < 0) +- return ret; +- +- if (!phydev->link) { +- phydev->master_slave_state = MASTER_SLAVE_STATE_UNKNOWN; - return 0; +- } - - /* Read actual speed from vendor register. */ - val = phy_read_mmd(phydev, MDIO_MMD_VEND2, RTL_VND2_PHYSR); @@ -1656,7 +1655,7 @@ Signed-off-by: Jakub Kicinski -MODULE_DEVICE_TABLE(mdio, realtek_tbl); --- /dev/null +++ b/drivers/net/phy/realtek/realtek_main.c -@@ -0,0 +1,1590 @@ +@@ -0,0 +1,1589 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* drivers/net/phy/realtek.c + * @@ -2619,15 +2618,15 @@ Signed-off-by: Jakub Kicinski +{ + int lpadv, ret; + ++ mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising, 0); ++ + ret = rtlgen_read_status(phydev); + if (ret < 0) + return ret; + + if (phydev->autoneg == AUTONEG_DISABLE || -+ !phydev->autoneg_complete) { -+ mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising, 0); ++ !phydev->autoneg_complete) + return 0; -+ } + + lpadv = phy_read_paged(phydev, 0xa5d, 0x13); + if (lpadv < 0) @@ -2690,26 +2689,25 @@ Signed-off-by: Jakub Kicinski +{ + int ret, val; + -+ ret = genphy_c45_read_status(phydev); -+ if (ret < 0) -+ return ret; -+ -+ if (phydev->autoneg == AUTONEG_DISABLE || -+ !genphy_c45_aneg_done(phydev)) -+ mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, 0); -+ + /* Vendor register as C45 has no standardized support for 1000BaseT */ -+ if (phydev->autoneg == AUTONEG_ENABLE) { ++ if (phydev->autoneg == AUTONEG_ENABLE && genphy_c45_aneg_done(phydev)) { + val = phy_read_mmd(phydev, MDIO_MMD_VEND2, + RTL822X_VND2_GANLPAR); + if (val < 0) + return val; -+ -+ mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, val); ++ } else { ++ val = 0; + } ++ mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, val); + -+ if (!phydev->link) ++ ret = genphy_c45_read_status(phydev); ++ if (ret < 0) ++ return ret; ++ ++ if (!phydev->link) { ++ phydev->master_slave_state = MASTER_SLAVE_STATE_UNKNOWN; + return 0; ++ } + + /* Read actual speed from vendor register. */ + val = phy_read_mmd(phydev, MDIO_MMD_VEND2, RTL_VND2_PHYSR); diff --git a/target/linux/generic/backport-6.6/781-22-v6.14-net-phy-realtek-add-hwmon-support-for-temp-sensor-on.patch b/target/linux/generic/backport-6.6/781-25-v6.14-net-phy-realtek-add-hwmon-support-for-temp-sensor-on.patch similarity index 98% rename from target/linux/generic/backport-6.6/781-22-v6.14-net-phy-realtek-add-hwmon-support-for-temp-sensor-on.patch rename to target/linux/generic/backport-6.6/781-25-v6.14-net-phy-realtek-add-hwmon-support-for-temp-sensor-on.patch index 4c1e2f06240407..7c1fe542672ba8 100644 --- a/target/linux/generic/backport-6.6/781-22-v6.14-net-phy-realtek-add-hwmon-support-for-temp-sensor-on.patch +++ b/target/linux/generic/backport-6.6/781-25-v6.14-net-phy-realtek-add-hwmon-support-for-temp-sensor-on.patch @@ -170,7 +170,7 @@ Signed-off-by: Jakub Kicinski static int rtl822xb_config_init(struct phy_device *phydev) { bool has_2500, has_sgmii; -@@ -1519,6 +1530,7 @@ static struct phy_driver realtek_drvs[] +@@ -1518,6 +1529,7 @@ static struct phy_driver realtek_drvs[] .match_phy_device = rtl_internal_nbaset_match_phy_device, .name = "Realtek Internal NBASE-T PHY", .flags = PHY_IS_INTERNAL, diff --git a/target/linux/generic/pending-6.6/720-01-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch b/target/linux/generic/pending-6.6/720-01-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch index 52ffc7a0f96d42..3f43412648f46a 100644 --- a/target/linux/generic/pending-6.6/720-01-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch +++ b/target/linux/generic/pending-6.6/720-01-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch @@ -15,7 +15,7 @@ Signed-off-by: Daniel Golle --- a/drivers/net/phy/realtek/realtek_main.c +++ b/drivers/net/phy/realtek/realtek_main.c -@@ -1431,6 +1431,7 @@ static struct phy_driver realtek_drvs[] +@@ -1430,6 +1430,7 @@ static struct phy_driver realtek_drvs[] }, { .name = "RTL8226 2.5Gbps PHY", .match_phy_device = rtl8226_match_phy_device, @@ -23,7 +23,7 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, -@@ -1441,6 +1442,7 @@ static struct phy_driver realtek_drvs[] +@@ -1440,6 +1441,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_match_phy_device, .name = "RTL8226B_RTL8221B 2.5Gbps PHY", @@ -31,7 +31,7 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .config_init = rtl822xb_config_init, -@@ -1453,6 +1455,7 @@ static struct phy_driver realtek_drvs[] +@@ -1452,6 +1454,7 @@ static struct phy_driver realtek_drvs[] }, { PHY_ID_MATCH_EXACT(0x001cc838), .name = "RTL8226-CG 2.5Gbps PHY", @@ -39,7 +39,7 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, -@@ -1463,6 +1466,7 @@ static struct phy_driver realtek_drvs[] +@@ -1462,6 +1465,7 @@ static struct phy_driver realtek_drvs[] }, { PHY_ID_MATCH_EXACT(0x001cc848), .name = "RTL8226B-CG_RTL8221B-CG 2.5Gbps PHY", @@ -47,7 +47,7 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .config_init = rtl822xb_config_init, -@@ -1475,6 +1479,7 @@ static struct phy_driver realtek_drvs[] +@@ -1474,6 +1478,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c22_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C22)", @@ -55,7 +55,7 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .config_init = rtl822xb_config_init, -@@ -1487,6 +1492,7 @@ static struct phy_driver realtek_drvs[] +@@ -1486,6 +1491,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c45_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C45)", @@ -63,7 +63,7 @@ Signed-off-by: Daniel Golle .config_init = rtl822xb_config_init, .get_rate_matching = rtl822xb_get_rate_matching, .get_features = rtl822x_c45_get_features, -@@ -1497,6 +1503,7 @@ static struct phy_driver realtek_drvs[] +@@ -1496,6 +1502,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c22_match_phy_device, .name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)", @@ -71,7 +71,7 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .config_init = rtl822xb_config_init, -@@ -1509,6 +1516,7 @@ static struct phy_driver realtek_drvs[] +@@ -1508,6 +1515,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c45_match_phy_device, .name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)", diff --git a/target/linux/generic/pending-6.6/720-03-net-phy-realtek-make-sure-paged-read-is-protected-by.patch b/target/linux/generic/pending-6.6/720-03-net-phy-realtek-make-sure-paged-read-is-protected-by.patch index 3a3d0525050e27..d5f80d1c919d42 100644 --- a/target/linux/generic/pending-6.6/720-03-net-phy-realtek-make-sure-paged-read-is-protected-by.patch +++ b/target/linux/generic/pending-6.6/720-03-net-phy-realtek-make-sure-paged-read-is-protected-by.patch @@ -18,7 +18,7 @@ Signed-off-by: Daniel Golle --- a/drivers/net/phy/realtek/realtek_main.c +++ b/drivers/net/phy/realtek/realtek_main.c -@@ -1112,9 +1112,11 @@ static bool rtlgen_supports_2_5gbps(stru +@@ -1111,9 +1111,11 @@ static bool rtlgen_supports_2_5gbps(stru { int val; diff --git a/target/linux/generic/pending-6.6/720-04-net-phy-realtek-introduce-rtl822x_probe.patch b/target/linux/generic/pending-6.6/720-04-net-phy-realtek-introduce-rtl822x_probe.patch index 42873e7bdf8be7..b73e6c6443c5e7 100644 --- a/target/linux/generic/pending-6.6/720-04-net-phy-realtek-introduce-rtl822x_probe.patch +++ b/target/linux/generic/pending-6.6/720-04-net-phy-realtek-introduce-rtl822x_probe.patch @@ -24,7 +24,7 @@ Signed-off-by: Daniel Golle #define RTL8366RB_POWER_SAVE 0x15 #define RTL8366RB_POWER_SAVE_ON BIT(12) -@@ -1208,6 +1212,25 @@ static int rtl8251b_c45_match_phy_device +@@ -1207,6 +1211,25 @@ static int rtl8251b_c45_match_phy_device return rtlgen_is_c45_match(phydev, RTL_8251B, true); } @@ -50,7 +50,7 @@ Signed-off-by: Daniel Golle static int rtlgen_resume(struct phy_device *phydev) { int ret = genphy_resume(phydev); -@@ -1479,6 +1502,7 @@ static struct phy_driver realtek_drvs[] +@@ -1478,6 +1501,7 @@ static struct phy_driver realtek_drvs[] }, { PHY_ID_MATCH_EXACT(0x001cc838), .name = "RTL8226-CG 2.5Gbps PHY", @@ -58,7 +58,7 @@ Signed-off-by: Daniel Golle .soft_reset = genphy_soft_reset, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, -@@ -1490,6 +1514,7 @@ static struct phy_driver realtek_drvs[] +@@ -1489,6 +1513,7 @@ static struct phy_driver realtek_drvs[] }, { PHY_ID_MATCH_EXACT(0x001cc848), .name = "RTL8226B-CG_RTL8221B-CG 2.5Gbps PHY", @@ -66,7 +66,7 @@ Signed-off-by: Daniel Golle .soft_reset = genphy_soft_reset, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, -@@ -1503,6 +1528,7 @@ static struct phy_driver realtek_drvs[] +@@ -1502,6 +1527,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c22_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C22)", @@ -74,7 +74,7 @@ Signed-off-by: Daniel Golle .soft_reset = genphy_soft_reset, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, -@@ -1516,6 +1542,7 @@ static struct phy_driver realtek_drvs[] +@@ -1515,6 +1541,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c45_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C45)", @@ -82,7 +82,7 @@ Signed-off-by: Daniel Golle .soft_reset = genphy_soft_reset, .config_init = rtl822xb_config_init, .get_rate_matching = rtl822xb_get_rate_matching, -@@ -1527,6 +1554,7 @@ static struct phy_driver realtek_drvs[] +@@ -1526,6 +1553,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c22_match_phy_device, .name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)", @@ -90,7 +90,7 @@ Signed-off-by: Daniel Golle .soft_reset = genphy_soft_reset, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, -@@ -1540,6 +1568,7 @@ static struct phy_driver realtek_drvs[] +@@ -1539,6 +1567,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c45_match_phy_device, .name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)", diff --git a/target/linux/generic/pending-6.6/720-05-net-phy-realtek-detect-early-version-of-RTL8221B.patch b/target/linux/generic/pending-6.6/720-05-net-phy-realtek-detect-early-version-of-RTL8221B.patch index 39c1929b5f60e0..22c271c3eb25f9 100644 --- a/target/linux/generic/pending-6.6/720-05-net-phy-realtek-detect-early-version-of-RTL8221B.patch +++ b/target/linux/generic/pending-6.6/720-05-net-phy-realtek-detect-early-version-of-RTL8221B.patch @@ -14,7 +14,7 @@ Signed-off-by: Daniel Golle Signed-off-by: Mieczyslaw Nalewaj --- a/drivers/net/phy/realtek/realtek_main.c +++ b/drivers/net/phy/realtek/realtek_main.c -@@ -1158,10 +1158,32 @@ static int rtl8226_match_phy_device(stru +@@ -1157,10 +1157,32 @@ static int rtl8226_match_phy_device(stru static int rtlgen_is_c45_match(struct phy_device *phydev, unsigned int id, bool is_c45) { diff --git a/target/linux/generic/pending-6.6/720-06-net-phy-realtek-support-interrupt-of-RTL8221B.patch b/target/linux/generic/pending-6.6/720-06-net-phy-realtek-support-interrupt-of-RTL8221B.patch index 1ab2fe7618dd4a..c855a211e8ffd9 100644 --- a/target/linux/generic/pending-6.6/720-06-net-phy-realtek-support-interrupt-of-RTL8221B.patch +++ b/target/linux/generic/pending-6.6/720-06-net-phy-realtek-support-interrupt-of-RTL8221B.patch @@ -12,7 +12,7 @@ Signed-off-by: Jianhui Zhao --- a/drivers/net/phy/realtek/realtek_main.c +++ b/drivers/net/phy/realtek/realtek_main.c -@@ -1388,6 +1388,51 @@ static irqreturn_t rtl9000a_handle_inter +@@ -1387,6 +1387,51 @@ static irqreturn_t rtl9000a_handle_inter return IRQ_HANDLED; } @@ -64,7 +64,7 @@ Signed-off-by: Jianhui Zhao static struct phy_driver realtek_drvs[] = { { PHY_ID_MATCH_EXACT(0x00008201), -@@ -1550,6 +1595,8 @@ static struct phy_driver realtek_drvs[] +@@ -1549,6 +1594,8 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c22_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C22)", @@ -73,7 +73,7 @@ Signed-off-by: Jianhui Zhao .probe = rtl822x_aldps_probe, .soft_reset = genphy_soft_reset, .get_features = rtl822x_get_features, -@@ -1564,6 +1611,8 @@ static struct phy_driver realtek_drvs[] +@@ -1563,6 +1610,8 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c45_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C45)", @@ -82,7 +82,7 @@ Signed-off-by: Jianhui Zhao .probe = rtl822x_aldps_probe, .soft_reset = genphy_soft_reset, .config_init = rtl822xb_config_init, -@@ -1576,6 +1625,8 @@ static struct phy_driver realtek_drvs[] +@@ -1575,6 +1624,8 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c22_match_phy_device, .name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)", @@ -91,7 +91,7 @@ Signed-off-by: Jianhui Zhao .probe = rtl822x_aldps_probe, .soft_reset = genphy_soft_reset, .get_features = rtl822x_get_features, -@@ -1590,6 +1641,8 @@ static struct phy_driver realtek_drvs[] +@@ -1589,6 +1640,8 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c45_match_phy_device, .name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)", diff --git a/target/linux/generic/pending-6.6/721-net-phy-realtek-clear-1000Base-T-lpa-bits-if-link-is.patch b/target/linux/generic/pending-6.6/721-net-phy-realtek-clear-1000Base-T-lpa-bits-if-link-is.patch deleted file mode 100644 index 5bc77ed3b83db1..00000000000000 --- a/target/linux/generic/pending-6.6/721-net-phy-realtek-clear-1000Base-T-lpa-bits-if-link-is.patch +++ /dev/null @@ -1,78 +0,0 @@ -From patchwork Wed Jan 15 14:43:35 2025 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Daniel Golle -X-Patchwork-Id: 13940510 -X-Patchwork-Delegate: kuba@kernel.org -Date: Wed, 15 Jan 2025 14:43:35 +0000 -From: Daniel Golle -To: Andrew Lunn , Heiner Kallweit , - Russell King , - "David S. Miller" , - Eric Dumazet , - Jakub Kicinski , Paolo Abeni , - Daniel Golle , - "Russell King (Oracle)" , - netdev@vger.kernel.org, linux-kernel@vger.kernel.org -Subject: [PATCH net 1/3] net: phy: realtek: clear 1000Base-T lpa if link is - down -Message-ID: - <67e38eee4c46b921938fb33f5bc86c8979b9aa33.1736951652.git.daniel@makrotopia.org> -References: -Precedence: bulk -X-Mailing-List: netdev@vger.kernel.org -List-Id: -List-Subscribe: -List-Unsubscribe: -MIME-Version: 1.0 -Content-Disposition: inline -In-Reply-To: -X-Patchwork-Delegate: kuba@kernel.org - -Only read 1000Base-T link partner advertisement if autonegotiation has -completed and otherwise 1000Base-T link partner advertisement bits. - -This fixes bogus 1000Base-T link partner advertisement after link goes -down (eg. by disconnecting the wire). -Fixes: 5cb409b3960e ("net: phy: realtek: clear 1000Base-T link partner advertisement") -Signed-off-by: Daniel Golle -Reviewed-by: Michal Swiatkowski ---- - drivers/net/phy/realtek/realtek_main.c | 19 ++++++++----------- - 1 file changed, 8 insertions(+), 11 deletions(-) - ---- a/drivers/net/phy/realtek/realtek_main.c -+++ b/drivers/net/phy/realtek/realtek_main.c -@@ -1068,23 +1068,20 @@ static int rtl822x_c45_read_status(struc - { - int ret, val; - -- ret = genphy_c45_read_status(phydev); -- if (ret < 0) -- return ret; -- -- if (phydev->autoneg == AUTONEG_DISABLE || -- !genphy_c45_aneg_done(phydev)) -- mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, 0); -- - /* Vendor register as C45 has no standardized support for 1000BaseT */ -- if (phydev->autoneg == AUTONEG_ENABLE) { -+ if (phydev->autoneg == AUTONEG_ENABLE && genphy_c45_aneg_done(phydev)) { - val = phy_read_mmd(phydev, MDIO_MMD_VEND2, - RTL822X_VND2_GANLPAR); - if (val < 0) - return val; -- -- mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, val); -+ } else { -+ val = 0; - } -+ mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, val); -+ -+ ret = genphy_c45_read_status(phydev); -+ if (ret < 0) -+ return ret; - - if (!phydev->link) - return 0; diff --git a/target/linux/generic/pending-6.6/722-net-phy-realtek-clear-master_slave_state-if-link-is-.patch b/target/linux/generic/pending-6.6/722-net-phy-realtek-clear-master_slave_state-if-link-is-.patch deleted file mode 100644 index b7e5f8b58fb012..00000000000000 --- a/target/linux/generic/pending-6.6/722-net-phy-realtek-clear-master_slave_state-if-link-is-.patch +++ /dev/null @@ -1,61 +0,0 @@ -From patchwork Wed Jan 15 14:43:43 2025 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Daniel Golle -X-Patchwork-Id: 13940511 -X-Patchwork-Delegate: kuba@kernel.org -Date: Wed, 15 Jan 2025 14:43:43 +0000 -From: Daniel Golle -To: Andrew Lunn , Heiner Kallweit , - Russell King , - "David S. Miller" , - Eric Dumazet , - Jakub Kicinski , Paolo Abeni , - Daniel Golle , - "Russell King (Oracle)" , - netdev@vger.kernel.org, linux-kernel@vger.kernel.org -Subject: [PATCH net 2/3] net: phy: realtek: clear master_slave_state if link - is down -Message-ID: - <2155887c3a665e4132a034df1e9cfdeec0ae48c9.1736951652.git.daniel@makrotopia.org> -References: -Precedence: bulk -X-Mailing-List: netdev@vger.kernel.org -List-Id: -List-Subscribe: -List-Unsubscribe: -MIME-Version: 1.0 -Content-Disposition: inline -In-Reply-To: -X-Patchwork-Delegate: kuba@kernel.org - -rtlgen_decode_physr() which sets master_slave_state isn't called in case -the link is down and other than rtlgen_read_status(), -rtl822x_c45_read_status() doesn't implicitely clear master_slave_state. - -Avoid stale master_slave_state by always setting it to -MASTER_SLAVE_STATE_UNKNOWN in rtl822x_c45_read_status() in case the link -is down. - -Fixes: 081c9c0265c9 ("net: phy: realtek: read duplex and gbit master from PHYSR register") -Signed-off-by: Daniel Golle -Reviewed-by: Michal Swiatkowski ---- - drivers/net/phy/realtek/realtek_main.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - ---- a/drivers/net/phy/realtek/realtek_main.c -+++ b/drivers/net/phy/realtek/realtek_main.c -@@ -1083,8 +1083,10 @@ static int rtl822x_c45_read_status(struc - if (ret < 0) - return ret; - -- if (!phydev->link) -+ if (!phydev->link) { -+ phydev->master_slave_state = MASTER_SLAVE_STATE_UNKNOWN; - return 0; -+ } - - /* Read actual speed from vendor register. */ - val = phy_read_mmd(phydev, MDIO_MMD_VEND2, RTL_VND2_PHYSR); diff --git a/target/linux/generic/pending-6.6/723-net-phy-realtek-always-clear-10gbase-t-link-partner-.patch b/target/linux/generic/pending-6.6/723-net-phy-realtek-always-clear-10gbase-t-link-partner-.patch deleted file mode 100644 index 23947c2200ed9d..00000000000000 --- a/target/linux/generic/pending-6.6/723-net-phy-realtek-always-clear-10gbase-t-link-partner-.patch +++ /dev/null @@ -1,67 +0,0 @@ -From patchwork Wed Jan 15 14:45:00 2025 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Daniel Golle -X-Patchwork-Id: 13940519 -X-Patchwork-Delegate: kuba@kernel.org -Date: Wed, 15 Jan 2025 14:45:00 +0000 -From: Daniel Golle -To: Andrew Lunn , Heiner Kallweit , - Russell King , - "David S. Miller" , - Eric Dumazet , - Jakub Kicinski , Paolo Abeni , - Daniel Golle , - "Russell King (Oracle)" , - netdev@vger.kernel.org, linux-kernel@vger.kernel.org -Subject: [PATCH net 3/3] net: phy: realtek: always clear NBase-T lpa -Message-ID: - <566d4771d68a1e18d2d48860e25891e468e26551.1736951652.git.daniel@makrotopia.org> -References: -Precedence: bulk -X-Mailing-List: netdev@vger.kernel.org -List-Id: -List-Subscribe: -List-Unsubscribe: -MIME-Version: 1.0 -Content-Disposition: inline -In-Reply-To: -X-Patchwork-Delegate: kuba@kernel.org - -Clear NBase-T link partner advertisement before calling -rtlgen_read_status() to avoid phy_resolve_aneg_linkmode() wrongly -setting speed and duplex. - -This fixes bogus 2.5G/5G/10G link partner advertisement and thus -speed and duplex being set by phy_resolve_aneg_linkmode() due to stale -NBase-T lpa. - -Fixes: 68d5cd09e891 ("net: phy: realtek: change order of calls in C22 read_status()") -Signed-off-by: Daniel Golle -Reviewed-by: Michal Swiatkowski ---- - drivers/net/phy/realtek/realtek_main.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - ---- a/drivers/net/phy/realtek/realtek_main.c -+++ b/drivers/net/phy/realtek/realtek_main.c -@@ -997,15 +997,15 @@ static int rtl822x_read_status(struct ph - { - int lpadv, ret; - -+ mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising, 0); -+ - ret = rtlgen_read_status(phydev); - if (ret < 0) - return ret; - - if (phydev->autoneg == AUTONEG_DISABLE || -- !phydev->autoneg_complete) { -- mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising, 0); -+ !phydev->autoneg_complete) - return 0; -- } - - lpadv = phy_read_paged(phydev, 0xa5d, 0x13); - if (lpadv < 0) From a1c781675a16d26eebb70fc3410ef6b8728c109c Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Sat, 18 Jan 2025 12:25:01 +0100 Subject: [PATCH 374/877] qualcommax: dl-wrx36: fix 2.5G port LED-s Currently, 2.5G port LED-s on Dynalink are incorrectly configured and thus they will light up all of the time. So, lets fix this by: 1. Current green LED is actually yellow, change the color 2. Fix its polarity as its actually active-low 3. The yellow LED that was registered as being connected to LED_1 pin on the PHY is not actually connected at all, so remove it. 4. The actual green LED is connected to LED_2 on the PHY so add it. Fixes: 75ad5c24142a ("qualcommax: switch to qca8081 upstream PHY driver") Fixes: #14502 Link: https://github.com/openwrt/openwrt/pull/17656 Signed-off-by: Robert Marko (cherry picked from commit 2d077913cd53cad33123c8a9bf6da8a1c5576c69) --- .../files/arch/arm64/boot/dts/qcom/ipq8072-dl-wrx36.dts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-dl-wrx36.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-dl-wrx36.dts index c5c089c00f7dd4..d25bc90153c433 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-dl-wrx36.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-dl-wrx36.dts @@ -178,14 +178,15 @@ led@0 { reg = <0>; - color = ; + color = ; function = LED_FUNCTION_WAN; default-state = "keep"; + active-low; }; - led@1 { - reg = <1>; - color = ; + led@2 { + reg = <2>; + color = ; function = LED_FUNCTION_WAN; default-state = "keep"; }; From 3207fe66369c11349243cc5a5575ec769f799698 Mon Sep 17 00:00:00 2001 From: Luis Mita Date: Wed, 8 Jan 2025 18:10:04 -0400 Subject: [PATCH 375/877] ramips: mt7621: add support for Confiabits MT7621 v1 Hardware: - SoC: MediaTek MT7621DAT - Flash: 16 MiB cFeon - RAM: 128 MiB MT7621DAT - WLAN: 2.4 GHz (MT7603EN), 5 GHz (MT7613BEN 802.11ac) - Ethernet: 1x 10/100/1000 Mbps WAN, 3x 10/100/1000 LAN (MT7621DAT) - Buttons: 1 Reset button, 1 WPS button - LEDs: 5x Green (POWER/WAN/2.4G/5G/WPS), 1x Red (WAN) - Serial console: unpopulated header, 57600 8n1 - Power: 12 VDC, 1 A MAC: LAN MAC: label mac (eeprom@4) WAN MAC: label mac (eeprom@4) 2.4G MAC: label mac (eeprom@4) 5G MAC: label mac + 1 (eeprom@8004) 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 Link: https://github.com/openwrt/openwrt/pull/17534 (cherry picked from commit 1c5ca24da6cd727f4fcb8edbe00fa66543a6c678) Link: https://github.com/openwrt/openwrt/pull/17653 Signed-off-by: Hauke Mehrtens --- .../dts/mt7621_confiabits_mt7621-v1.dts | 215 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 12 + .../mt7621/base-files/etc/board.d/01_leds | 7 +- .../mt7621/base-files/etc/board.d/02_network | 1 + 4 files changed, 232 insertions(+), 3 deletions(-) create mode 100644 target/linux/ramips/dts/mt7621_confiabits_mt7621-v1.dts diff --git a/target/linux/ramips/dts/mt7621_confiabits_mt7621-v1.dts b/target/linux/ramips/dts/mt7621_confiabits_mt7621-v1.dts new file mode 100644 index 00000000000000..858747ecada399 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_confiabits_mt7621-v1.dts @@ -0,0 +1,215 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include +#include + +/ { + compatible = "confiabits,mt7621-v1", "mediatek,mt7621-soc"; + model = "Confiabits MT7621 v1"; + + aliases { + led-boot = &led_power_green; + led-failsafe = &led_power_green; + led-running = &led_power_green; + led-upgrade = &led_power_green; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + keys { + compatible = "gpio-keys"; + + button-wps { + label = "wps"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + linux,code = ; + }; + + button-reset { + label = "reset"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_power_green: led-power-green { + color = ; + function = LED_FUNCTION_POWER; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + }; + + led-wan-red { + color = ; + function = LED_FUNCTION_WAN; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + + led-wlan5 { + color = ; + function = LED_FUNCTION_WLAN_5GHZ; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + + led-wps { + color = ; + function = LED_FUNCTION_WPS; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + + led-wlan24 { + color = ; + function = LED_FUNCTION_WLAN_2GHZ; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + led-wan-green { + color = ; + function = LED_FUNCTION_WAN; + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <40000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + partition@40000 { + label = "radio"; + reg = <0x40000 0x10000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_radio_0: eeprom@0 { + reg = <0x0 0x400>; + }; + + eeprom_radio_8000: eeprom@8000 { + reg = <0x8000 0x4da8>; + }; + + macaddr_radio_4: macaddr@4 { + reg = <0x4 0x6>; + }; + + macaddr_radio_8004: macaddr@8004 { + reg = <0x8004 0x6>; + }; + }; + }; + + partition@50000 { + label = "firmware"; + compatible = "denx,uimage"; + reg = <0x50000 0xfb0000>; + }; + }; + }; +}; + +&gmac0 { + nvmem-cells = <&macaddr_radio_4>; + nvmem-cell-names = "mac-address"; +}; + +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_radio_4>; + nvmem-cell-names = "mac-address"; +}; + +ðphy4 { + /delete-property/ interrupts; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + ieee80211-freq-limit = <2400000 2500000>; + + nvmem-cells = <&eeprom_radio_0>; + nvmem-cell-names = "eeprom"; + }; +}; + +&pcie1 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + ieee80211-freq-limit = <5000000 6000000>; + + nvmem-cells = <&eeprom_radio_8000>; + nvmem-cell-names = "eeprom"; + }; +}; + +&state_default { + gpio { + groups = "i2c", "jtag", "wdt"; + function = "gpio"; + }; +}; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "lan1"; + }; + + port@1 { + status = "okay"; + label = "lan2"; + }; + + port@2 { + status = "okay"; + label = "lan3"; + }; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 9c6efb8f1c7bb7..68fc03d99876bd 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -673,6 +673,18 @@ define Device/comfast_cf-ew72-v2 endef TARGET_DEVICES += comfast_cf-ew72-v2 +define Device/confiabits_mt7621-v1 + $(Device/dsa-migration) + $(Device/uimage-lzma-loader) + IMAGE_SIZE := 16064k + DEVICE_VENDOR := Confiabits + DEVICE_MODEL := MT7621 + DEVICE_VARIANT := v1 + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7663-firmware-ap \ + -uboot-envtools +endef +TARGET_DEVICES += confiabits_mt7621-v1 + define Device/cudy_m1800 $(Device/dsa-migration) DEVICE_VENDOR := Cudy 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 9a77b1b1bc4a65..d9ac110fbee2d1 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 @@ -58,6 +58,10 @@ wifire,s1500-nbn) belkin,rt1800) ucidef_set_led_netdev "wan" "wan" "white:wan" "wan" ;; +confiabits,mt7621-v1|\ +netis,n6) + ucidef_set_led_netdev "wan" "wan" "green:wan" "wan" "link tx rx" + ;; cudy,wr2100) ucidef_set_led_netdev "lan1" "lan1" "green:lan1" "lan1" ucidef_set_led_netdev "lan2" "lan2" "green:lan2" "lan2" @@ -188,9 +192,6 @@ netgear,r7450) netgear,wax202) ucidef_set_led_netdev "internet" "Internet" "green:net" "wan" ;; -netis,n6) - ucidef_set_led_netdev "wan" "wan" "green:wan" "wan" "link tx rx" - ;; oraybox,x3a) ucidef_set_led_netdev "wan" "wan link" "red:status" "wan" ucidef_set_led_netdev "lan" "lan link" "green:status" "br-lan" 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 c780443c1c58de..f40e9616d019e2 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 @@ -13,6 +13,7 @@ ramips_setup_interfaces() asus,rt-ax53u|\ buffalo,wsr-2533dhpl2|\ buffalo,wsr-2533dhpls|\ + confiabits,mt7621-v1|\ gehua,ghl-r-001|\ h3c,tx1800-plus|\ h3c,tx1801-plus|\ From f31ab2abef2f4ef36d5c4ee38b97adfbec43a2b9 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Tue, 7 May 2024 20:44:27 +0200 Subject: [PATCH 376/877] ipq4019: patch initialization of Lantiq DSL on FritzBox 7530. Some VRX518 modems fail to initialize properly with the error message "dc_ep_clk_on failed". As a result, the DSL data path doesn't work. This hack, which is based on code from the FRITZ!Box 7530 GPL archive, fixes the issue. It changes the PCIe vendor/device ID to values matching a Lantiq SoC. It also appears to emulate a Lantiq CPU ID register for connected PCIe devices, by remapping the matching address area to a specially crafted buffer using the address translation unit. A dedicated compatible is created to activate this in the device tree, so this shouldn't affect any devices other than FRITZ!Box 7530/7520. Original investigation was done in https://github.com/janh/openwrt/commit/59f52125178146a9dc44290c11c63e5e029e8044 which used the "avm,host_magic" property to enabled the patch. Signed-off-by: Christian Marangi Signed-off-by: Florian Maurer Link: https://github.com/openwrt/openwrt/pull/17622 Signed-off-by: Robert Marko (cherry picked from commit 676dcb1b2cf84142a61d51a15e7a8e1bdc937c23) --- ...-PCI-dwc-Add-host_post_init-callback.patch | 42 +++++ ...ASPM-for-platforms-supporting-1.9.0-.patch | 102 +++++++++++ .../dts/qcom/qcom-ipq4019-fritzbox-7530.dts | 1 + ...ck-compatible-for-ipq4019-Lantiq-DSL.patch | 166 ++++++++++++++++++ 4 files changed, 311 insertions(+) create mode 100644 target/linux/generic/backport-6.6/870-v6.7-01-PCI-dwc-Add-host_post_init-callback.patch create mode 100644 target/linux/generic/backport-6.6/870-v6.7-02-PCI-qcom-Enable-ASPM-for-platforms-supporting-1.9.0-.patch create mode 100644 target/linux/ipq40xx/patches-6.6/900-PCI-qcom-add-hack-compatible-for-ipq4019-Lantiq-DSL.patch diff --git a/target/linux/generic/backport-6.6/870-v6.7-01-PCI-dwc-Add-host_post_init-callback.patch b/target/linux/generic/backport-6.6/870-v6.7-01-PCI-dwc-Add-host_post_init-callback.patch new file mode 100644 index 00000000000000..d70c65225efbcc --- /dev/null +++ b/target/linux/generic/backport-6.6/870-v6.7-01-PCI-dwc-Add-host_post_init-callback.patch @@ -0,0 +1,42 @@ +From a78794562fcb2659c976388b1285eddda97e9954 Mon Sep 17 00:00:00 2001 +From: Manivannan Sadhasivam +Date: Tue, 10 Oct 2023 21:29:13 +0530 +Subject: [PATCH] PCI: dwc: Add host_post_init() callback +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This callback can be used by the platform drivers to do configuration +once all the devices are scanned. Like changing LNKCTL of all downstream +devices to enable ASPM etc... + +Link: https://lore.kernel.org/linux-pci/20231010155914.9516-2-manivannan.sadhasivam@linaro.org +Signed-off-by: Manivannan Sadhasivam +Signed-off-by: Krzysztof Wilczyński +--- + drivers/pci/controller/dwc/pcie-designware-host.c | 3 +++ + drivers/pci/controller/dwc/pcie-designware.h | 1 + + 2 files changed, 4 insertions(+) + +--- a/drivers/pci/controller/dwc/pcie-designware-host.c ++++ b/drivers/pci/controller/dwc/pcie-designware-host.c +@@ -502,6 +502,9 @@ int dw_pcie_host_init(struct dw_pcie_rp + if (ret) + goto err_stop_link; + ++ if (pp->ops->host_post_init) ++ pp->ops->host_post_init(pp); ++ + return 0; + + err_stop_link: +--- a/drivers/pci/controller/dwc/pcie-designware.h ++++ b/drivers/pci/controller/dwc/pcie-designware.h +@@ -301,6 +301,7 @@ enum dw_pcie_ltssm { + struct dw_pcie_host_ops { + int (*host_init)(struct dw_pcie_rp *pp); + void (*host_deinit)(struct dw_pcie_rp *pp); ++ void (*host_post_init)(struct dw_pcie_rp *pp); + int (*msi_host_init)(struct dw_pcie_rp *pp); + void (*pme_turn_off)(struct dw_pcie_rp *pp); + }; diff --git a/target/linux/generic/backport-6.6/870-v6.7-02-PCI-qcom-Enable-ASPM-for-platforms-supporting-1.9.0-.patch b/target/linux/generic/backport-6.6/870-v6.7-02-PCI-qcom-Enable-ASPM-for-platforms-supporting-1.9.0-.patch new file mode 100644 index 00000000000000..7fdede52f49661 --- /dev/null +++ b/target/linux/generic/backport-6.6/870-v6.7-02-PCI-qcom-Enable-ASPM-for-platforms-supporting-1.9.0-.patch @@ -0,0 +1,102 @@ +From 9f4f3dfad8cf08208fbb78b1b9cbf957c12618b9 Mon Sep 17 00:00:00 2001 +From: Manivannan Sadhasivam +Date: Tue, 10 Oct 2023 21:29:14 +0530 +Subject: [PATCH] PCI: qcom: Enable ASPM for platforms supporting 1.9.0 ops +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +ASPM is supported by Qcom host controllers/bridges on most of the recent +platforms and so the devices tested so far. But for enabling ASPM by +default (without using Kconfig, kernel command-line or sysfs), BIOS has +to enable ASPM on both host bridge and downstream devices during boot. + +Unfortunately, none of the BIOS available on Qcom platforms enables +ASPM. Due to this, the platforms making use of Qcom SoCs draw high power +during runtime. + +To fix this power draw issue, users have to enable ASPM using Kconfig, +kernel command-line, sysfs or the BIOS has to start enabling ASPM. + +The latter may happen in the future, but that won't address the issue on +current platforms. Also, asking users to enable a feature to get the power +management right would provide an unpleasant out-of-the-box experience. + +So the apt solution is to enable ASPM in the controller driver itself. And +this is being accomplished by calling pci_enable_link_state() in the newly +introduced host_post_init() callback for all the devices connected to the +bus. This function enables all supported link low power states for both +host bridge and the downstream devices. + +Due to limited testing, ASPM is only enabled for platforms making use of +ops_1_9_0 callbacks. + +[kwilczynski: commit log] +Link: https://lore.kernel.org/linux-pci/20231010155914.9516-3-manivannan.sadhasivam@linaro.org +Signed-off-by: Manivannan Sadhasivam +Signed-off-by: Krzysztof Wilczyński +--- + drivers/pci/controller/dwc/pcie-qcom.c | 28 ++++++++++++++++++++++++++ + 1 file changed, 28 insertions(+) + +--- a/drivers/pci/controller/dwc/pcie-qcom.c ++++ b/drivers/pci/controller/dwc/pcie-qcom.c +@@ -222,6 +222,7 @@ struct qcom_pcie_ops { + int (*get_resources)(struct qcom_pcie *pcie); + int (*init)(struct qcom_pcie *pcie); + int (*post_init)(struct qcom_pcie *pcie); ++ void (*host_post_init)(struct qcom_pcie *pcie); + void (*deinit)(struct qcom_pcie *pcie); + void (*ltssm_enable)(struct qcom_pcie *pcie); + int (*config_sid)(struct qcom_pcie *pcie); +@@ -966,6 +967,22 @@ static int qcom_pcie_post_init_2_7_0(str + return 0; + } + ++static int qcom_pcie_enable_aspm(struct pci_dev *pdev, void *userdata) ++{ ++ /* Downstream devices need to be in D0 state before enabling PCI PM substates */ ++ pci_set_power_state(pdev, PCI_D0); ++ pci_enable_link_state(pdev, PCIE_LINK_STATE_ALL); ++ ++ return 0; ++} ++ ++static void qcom_pcie_host_post_init_2_7_0(struct qcom_pcie *pcie) ++{ ++ struct dw_pcie_rp *pp = &pcie->pci->pp; ++ ++ pci_walk_bus(pp->bridge->bus, qcom_pcie_enable_aspm, NULL); ++} ++ + static void qcom_pcie_deinit_2_7_0(struct qcom_pcie *pcie) + { + struct qcom_pcie_resources_2_7_0 *res = &pcie->res.v2_7_0; +@@ -1224,9 +1241,19 @@ static void qcom_pcie_host_deinit(struct + pcie->cfg->ops->deinit(pcie); + } + ++static void qcom_pcie_host_post_init(struct dw_pcie_rp *pp) ++{ ++ struct dw_pcie *pci = to_dw_pcie_from_pp(pp); ++ struct qcom_pcie *pcie = to_qcom_pcie(pci); ++ ++ if (pcie->cfg->ops->host_post_init) ++ pcie->cfg->ops->host_post_init(pcie); ++} ++ + static const struct dw_pcie_host_ops qcom_pcie_dw_ops = { + .host_init = qcom_pcie_host_init, + .host_deinit = qcom_pcie_host_deinit, ++ .host_post_init = qcom_pcie_host_post_init, + }; + + /* Qcom IP rev.: 2.1.0 Synopsys IP rev.: 4.01a */ +@@ -1288,6 +1315,7 @@ static const struct qcom_pcie_ops ops_1_ + .get_resources = qcom_pcie_get_resources_2_7_0, + .init = qcom_pcie_init_2_7_0, + .post_init = qcom_pcie_post_init_2_7_0, ++ .host_post_init = qcom_pcie_host_post_init_2_7_0, + .deinit = qcom_pcie_deinit_2_7_0, + .ltssm_enable = qcom_pcie_2_3_2_ltssm_enable, + .config_sid = qcom_pcie_config_sid_1_9_0, diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzbox-7530.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzbox-7530.dts index 39905d4342ddf6..8566c7c337eba1 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzbox-7530.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzbox-7530.dts @@ -307,6 +307,7 @@ }; &pcie0 { + compatible = "qcom,pcie-ipq4019-lantiq-hack"; status = "okay"; perst-gpio = <&tlmm 38 GPIO_ACTIVE_LOW>; diff --git a/target/linux/ipq40xx/patches-6.6/900-PCI-qcom-add-hack-compatible-for-ipq4019-Lantiq-DSL.patch b/target/linux/ipq40xx/patches-6.6/900-PCI-qcom-add-hack-compatible-for-ipq4019-Lantiq-DSL.patch new file mode 100644 index 00000000000000..af10fd57049d22 --- /dev/null +++ b/target/linux/ipq40xx/patches-6.6/900-PCI-qcom-add-hack-compatible-for-ipq4019-Lantiq-DSL.patch @@ -0,0 +1,166 @@ +From f4f03dca92b45616ef0325051fdc7627c16fdd62 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Tue, 7 May 2024 20:21:17 +0200 +Subject: [PATCH] PCI: qcom: add hack compatible for ipq4019 Lantiq DSL + +Add hack compatible for ipq4019 Lantiq DSL + +This change the PCIe vendor/device ID to the values from Lantiq +GRX500 SoCs. We also program the ATU to fake the CPU ID as a Lantiq CPU +by providing to the Lantiq firmware custom crafted value in the address +the firmware would expect the CPU ID to be readable. + +Signed-off-by: Christian Marangi +Signed-off-by: Florian Maurer +--- + drivers/pci/controller/dwc/pcie-qcom.c | 94 +++++++++++++++++++++++++- + 1 file changed, 93 insertions(+), 1 deletion(-) + +--- a/drivers/pci/controller/dwc/pcie-qcom.c ++++ b/drivers/pci/controller/dwc/pcie-qcom.c +@@ -184,11 +184,24 @@ struct qcom_pcie_resources_2_3_3 { + + #define QCOM_PCIE_2_4_0_MAX_CLOCKS 4 + #define QCOM_PCIE_2_4_0_MAX_RESETS 12 ++/* ++ * This value is the manufacturer ID of Lantiq. The address where ++ * it will be visible for the PCIe device matches the location of ++ * CPU ID registers on Lantiq SocS (MPS base address is 0x1f107000). ++ */ ++#define QCOM_PCIE_2_4_0_CPU_ID_BASE_REG 0x1f107000 ++#define QCOM_PCIE_2_4_0_CPU_ID_REG 0x340 ++#define QCOM_PCIE_2_4_0_CPU_ID_REG_OFFSET (QCOM_PCIE_2_4_0_CPU_ID_REG / sizeof(u32)) ++#define QCOM_PCIE_2_4_0_CPU_ID_REG_VAL (0x389 << 5) ++#define QCOM_PCIE_2_4_0_GRX500_VENDOR_ID 0x1bef ++#define QCOM_PCIE_2_4_0_GRX500_DEVICE_ID 0x0030 + struct qcom_pcie_resources_2_4_0 { + struct clk_bulk_data clks[QCOM_PCIE_2_4_0_MAX_CLOCKS]; + int num_clks; + struct reset_control_bulk_data resets[QCOM_PCIE_2_4_0_MAX_RESETS]; + int num_resets; ++ void *lantiq_hack_virt; ++ dma_addr_t lantiq_hack_phys; + }; + + #define QCOM_PCIE_2_7_0_MAX_CLOCKS 15 +@@ -629,12 +642,65 @@ static int qcom_pcie_post_init_2_3_2(str + return 0; + } + ++static void qcom_pcie_host_post_init_2_3_2_lantiq_hack(struct qcom_pcie *pcie) ++{ ++ struct qcom_pcie_resources_2_4_0 *res = &pcie->res.v2_4_0; ++ struct dw_pcie *pci = pcie->pci; ++ struct dw_pcie_rp *pp = &pci->pp; ++ struct device *dev = pci->dev; ++ struct resource_entry *entry; ++ int ret, index = 0; ++ u64 addr, phys; ++ u32 *val; ++ ++ res->lantiq_hack_virt = dma_alloc_coherent(dev, SZ_4K, ++ &res->lantiq_hack_phys, ++ GFP_ATOMIC); ++ if (!res->lantiq_hack_virt) { ++ dev_err(dev, "failed to allocate DMA for lantiq hack\n"); ++ return; ++ } ++ ++ /* Fake Lantiq CPU ID register */ ++ val = (u32 *)res->lantiq_hack_virt; ++ val[QCOM_PCIE_2_4_0_CPU_ID_REG_OFFSET] = QCOM_PCIE_2_4_0_CPU_ID_REG_VAL; ++ ++ /* Increment index based on used iATU */ ++ resource_list_for_each_entry(entry, &pp->bridge->dma_ranges) ++ if (resource_type(entry->res) == IORESOURCE_MEM) ++ index++; ++ ++ /* Check if there is space for an additional iATU */ ++ if (index >= pci->num_ib_windows) { ++ dev_err(dev, "No inbound iATU window available for magic\n"); ++ return; ++ } ++ ++ addr = QCOM_PCIE_2_4_0_CPU_ID_BASE_REG; ++ phys = res->lantiq_hack_phys; ++ ++ /* Make it visible to PCIe devices using address translation unit */ ++ ret = dw_pcie_prog_inbound_atu(pci, index, PCIE_ATU_TYPE_MEM, ++ phys, addr, SZ_4K); ++ if (ret) { ++ dev_err(dev, "timeout waiting for IATU for lantiq hack: %d\n", ret); ++ return; ++ } ++ ++ /* Set vendor/device ID of GRX500 PCIe host */ ++ dw_pcie_dbi_ro_wr_en(pci); ++ dw_pcie_writew_dbi(pci, PCI_VENDOR_ID, QCOM_PCIE_2_4_0_GRX500_VENDOR_ID); ++ dw_pcie_writew_dbi(pci, PCI_DEVICE_ID, QCOM_PCIE_2_4_0_GRX500_DEVICE_ID); ++ dw_pcie_dbi_ro_wr_dis(pci); ++} ++ + static int qcom_pcie_get_resources_2_4_0(struct qcom_pcie *pcie) + { + struct qcom_pcie_resources_2_4_0 *res = &pcie->res.v2_4_0; + struct dw_pcie *pci = pcie->pci; + struct device *dev = pci->dev; +- bool is_ipq = of_device_is_compatible(dev->of_node, "qcom,pcie-ipq4019"); ++ bool is_ipq = of_device_is_compatible(dev->of_node, "qcom,pcie-ipq4019") || ++ of_device_is_compatible(dev->of_node, "qcom,pcie-ipq4019-lantiq-hack"); + int ret; + + res->clks[0].id = "aux"; +@@ -679,6 +745,17 @@ static void qcom_pcie_deinit_2_4_0(struc + clk_bulk_disable_unprepare(res->num_clks, res->clks); + } + ++static void qcom_pcie_deinit_2_4_0_lantiq_hack(struct qcom_pcie *pcie) ++{ ++ struct qcom_pcie_resources_2_4_0 *res = &pcie->res.v2_4_0; ++ struct dw_pcie *pci = pcie->pci; ++ struct device *dev = pci->dev; ++ ++ dma_free_coherent(dev, SZ_4K, res->lantiq_hack_virt, res->lantiq_hack_phys); ++ ++ qcom_pcie_deinit_2_4_0(pcie); ++} ++ + static int qcom_pcie_init_2_4_0(struct qcom_pcie *pcie) + { + struct qcom_pcie_resources_2_4_0 *res = &pcie->res.v2_4_0; +@@ -1292,6 +1369,16 @@ static const struct qcom_pcie_ops ops_2_ + .ltssm_enable = qcom_pcie_2_3_2_ltssm_enable, + }; + ++/* Qcom IP rev.: 2.4.0 Synopsys IP rev.: 4.20a Lantiq DSL Hack */ ++static const struct qcom_pcie_ops ops_2_4_0_lantiq_hack = { ++ .get_resources = qcom_pcie_get_resources_2_4_0, ++ .init = qcom_pcie_init_2_4_0, ++ .post_init = qcom_pcie_post_init_2_3_2, ++ .host_post_init = qcom_pcie_host_post_init_2_3_2_lantiq_hack, ++ .deinit = qcom_pcie_deinit_2_4_0_lantiq_hack, ++ .ltssm_enable = qcom_pcie_2_3_2_ltssm_enable, ++}; ++ + /* Qcom IP rev.: 2.3.3 Synopsys IP rev.: 4.30a */ + static const struct qcom_pcie_ops ops_2_3_3 = { + .get_resources = qcom_pcie_get_resources_2_3_3, +@@ -1354,6 +1441,10 @@ static const struct qcom_pcie_cfg cfg_2_ + .ops = &ops_2_4_0, + }; + ++static const struct qcom_pcie_cfg cfg_2_4_0_lantiq_hack = { ++ .ops = &ops_2_4_0_lantiq_hack, ++}; ++ + static const struct qcom_pcie_cfg cfg_2_7_0 = { + .ops = &ops_2_7_0, + }; +@@ -1641,6 +1732,7 @@ static const struct of_device_id qcom_pc + { .compatible = "qcom,pcie-apq8064", .data = &cfg_2_1_0 }, + { .compatible = "qcom,pcie-apq8084", .data = &cfg_1_0_0 }, + { .compatible = "qcom,pcie-ipq4019", .data = &cfg_2_4_0 }, ++ { .compatible = "qcom,pcie-ipq4019-lantiq-hack", .data = &cfg_2_4_0_lantiq_hack }, + { .compatible = "qcom,pcie-ipq6018", .data = &cfg_2_9_0 }, + { .compatible = "qcom,pcie-ipq8064", .data = &cfg_2_1_0 }, + { .compatible = "qcom,pcie-ipq8064-v2", .data = &cfg_2_1_0 }, From 0aaf4fe5a424928b62362e5101a6801968805c27 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Fri, 17 Jan 2025 20:51:38 +0100 Subject: [PATCH 377/877] Revert "ath79: reset ETH switch for AR9344" This reverts commit 916af73fc388d638b1a717a2411792e0680dd8e6. It was reported this change did not fix the reboot issues on AR9344. Signed-off-by: David Bauer (cherry picked from commit 937b5a3e0017f4f39c0f7727a910d2df78fc4ce9) --- ...et-ath79-reset-ETH-switch-for-AR9344.patch | 104 ------------------ 1 file changed, 104 deletions(-) delete mode 100644 target/linux/ath79/patches-6.6/101-reset-ath79-reset-ETH-switch-for-AR9344.patch diff --git a/target/linux/ath79/patches-6.6/101-reset-ath79-reset-ETH-switch-for-AR9344.patch b/target/linux/ath79/patches-6.6/101-reset-ath79-reset-ETH-switch-for-AR9344.patch deleted file mode 100644 index dcac5be58b37c1..00000000000000 --- a/target/linux/ath79/patches-6.6/101-reset-ath79-reset-ETH-switch-for-AR9344.patch +++ /dev/null @@ -1,104 +0,0 @@ -From: David Bauer -Date: Tue, 2 Jan 2025 19:22:40 +0100 -Subject: [PATCH] reset: ath79: reset ETH switch for AR9344 - -According to datasheet, on AR9344 the switch and switch analog need to -be reset first before initiating a full reset. - -Resetting these systems fixes spurious reset hangs on Atheros AR9344 -SoCs. - -Link: https://github.com/freifunk-gluon/gluon/issues/2904 - -Signed-off-by: David Bauer - ---- a/drivers/reset/reset-ath79.c -+++ b/drivers/reset/reset-ath79.c -@@ -12,8 +12,11 @@ - #include - #include - #include -+#include -+#include - - struct ath79_reset { -+ struct platform_device *pdev; - struct reset_controller_dev rcdev; - struct notifier_block restart_nb; - void __iomem *base; -@@ -21,16 +24,13 @@ struct ath79_reset { - }; - - #define FULL_CHIP_RESET 24 -+#define ETH_SWITCH_RESET 8 -+#define ETH_SWITCH_ARESET 12 - --static int ath79_reset_update(struct reset_controller_dev *rcdev, -+static void __ath79_reset_update_unlocked(struct ath79_reset *ath79_reset, - unsigned long id, bool assert) - { -- struct ath79_reset *ath79_reset = -- container_of(rcdev, struct ath79_reset, rcdev); -- unsigned long flags; - u32 val; -- -- spin_lock_irqsave(&ath79_reset->lock, flags); - val = readl(ath79_reset->base); - if (assert) - val |= BIT(id); -@@ -39,6 +39,17 @@ static int ath79_reset_update(struct res - writel(val, ath79_reset->base); - /* Flush cache */ - readl(ath79_reset->base); -+} -+ -+static int ath79_reset_update(struct reset_controller_dev *rcdev, -+ unsigned long id, bool assert) -+{ -+ struct ath79_reset *ath79_reset = -+ container_of(rcdev, struct ath79_reset, rcdev); -+ unsigned long flags; -+ -+ spin_lock_irqsave(&ath79_reset->lock, flags); -+ __ath79_reset_update_unlocked(ath79_reset, id, assert); - spin_unlock_irqrestore(&ath79_reset->lock, flags); - - return 0; -@@ -79,8 +90,27 @@ static int ath79_reset_restart_handler(s - { - struct ath79_reset *ath79_reset = - container_of(nb, struct ath79_reset, restart_nb); -+ unsigned long flags; - -- ath79_reset_assert(&ath79_reset->rcdev, FULL_CHIP_RESET); -+ spin_lock_irqsave(&ath79_reset->lock, flags); -+ -+ if (of_device_is_compatible(ath79_reset->pdev->dev.of_node, "qca,ar9340-reset")) { -+ /** -+ * AR9344 has been observed to hang on reboot in rare cases. -+ * -+ * Datasheet states to reset the ETH switch systems before asserting -+ * full chip reset. See page 111 of the AR9344 datasheet. -+ */ -+ __ath79_reset_update_unlocked(ath79_reset, ETH_SWITCH_RESET, true); -+ mdelay(10); -+ __ath79_reset_update_unlocked(ath79_reset, ETH_SWITCH_ARESET, true); -+ mdelay(10); -+ } -+ -+ __ath79_reset_update_unlocked(ath79_reset, FULL_CHIP_RESET, true); -+ mdelay(10); -+ -+ spin_unlock_irqrestore(&ath79_reset->lock, flags); - - return NOTIFY_DONE; - } -@@ -95,6 +125,8 @@ static int ath79_reset_probe(struct plat - if (!ath79_reset) - return -ENOMEM; - -+ ath79_reset->pdev = pdev; -+ - ath79_reset->base = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(ath79_reset->base)) - return PTR_ERR(ath79_reset->base); From 1e079d790ab3eb2d82990c4d547d6ce2635a25f7 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Fri, 3 Jan 2025 21:46:13 +0100 Subject: [PATCH 378/877] ath79: add extended AR9344 reset sequence According to datasheet, on AR9344 the switch and switch analog need to be reset first before initiating a full reset. Resetting these systems fixes spurious reset hangs on Atheros AR9344 SoCs. Link: https://github.com/freifunk-gluon/gluon/issues/2904 Signed-off-by: David Bauer (cherry picked from commit 144af32b47be6181f01815762159dff863f4616b) --- ...et-ath79-reset-ETH-switch-for-AR9344.patch | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 target/linux/ath79/patches-6.6/101-reset-ath79-reset-ETH-switch-for-AR9344.patch diff --git a/target/linux/ath79/patches-6.6/101-reset-ath79-reset-ETH-switch-for-AR9344.patch b/target/linux/ath79/patches-6.6/101-reset-ath79-reset-ETH-switch-for-AR9344.patch new file mode 100644 index 00000000000000..5d9daf1c1ce681 --- /dev/null +++ b/target/linux/ath79/patches-6.6/101-reset-ath79-reset-ETH-switch-for-AR9344.patch @@ -0,0 +1,105 @@ +From: David Bauer +Date: Tue, 2 Jan 2025 19:22:40 +0100 +Subject: [PATCH] reset: ath79: reset ETH switch for AR9344 + +According to datasheet, on AR9344 the switch and switch analog need to +be reset first before initiating a full reset. + +Resetting these systems fixes spurious reset hangs on Atheros AR9344 +SoCs. + +Link: https://github.com/freifunk-gluon/gluon/issues/2904 + +Signed-off-by: David Bauer + +--- a/drivers/reset/reset-ath79.c ++++ b/drivers/reset/reset-ath79.c +@@ -12,8 +12,11 @@ + #include + #include + #include ++#include ++#include + + struct ath79_reset { ++ struct platform_device *pdev; + struct reset_controller_dev rcdev; + struct notifier_block restart_nb; + void __iomem *base; +@@ -21,16 +24,13 @@ struct ath79_reset { + }; + + #define FULL_CHIP_RESET 24 ++#define ETH_SWITCH_RESET 8 ++#define ETH_SWITCH_ARESET 12 + +-static int ath79_reset_update(struct reset_controller_dev *rcdev, ++static void __ath79_reset_update_unlocked(struct ath79_reset *ath79_reset, + unsigned long id, bool assert) + { +- struct ath79_reset *ath79_reset = +- container_of(rcdev, struct ath79_reset, rcdev); +- unsigned long flags; + u32 val; +- +- spin_lock_irqsave(&ath79_reset->lock, flags); + val = readl(ath79_reset->base); + if (assert) + val |= BIT(id); +@@ -39,6 +39,17 @@ static int ath79_reset_update(struct res + writel(val, ath79_reset->base); + /* Flush cache */ + readl(ath79_reset->base); ++} ++ ++static int ath79_reset_update(struct reset_controller_dev *rcdev, ++ unsigned long id, bool assert) ++{ ++ struct ath79_reset *ath79_reset = ++ container_of(rcdev, struct ath79_reset, rcdev); ++ unsigned long flags; ++ ++ spin_lock_irqsave(&ath79_reset->lock, flags); ++ __ath79_reset_update_unlocked(ath79_reset, id, assert); + spin_unlock_irqrestore(&ath79_reset->lock, flags); + + return 0; +@@ -79,8 +90,28 @@ static int ath79_reset_restart_handler(s + { + struct ath79_reset *ath79_reset = + container_of(nb, struct ath79_reset, restart_nb); ++ unsigned long flags; + +- ath79_reset_assert(&ath79_reset->rcdev, FULL_CHIP_RESET); ++ spin_lock_irqsave(&ath79_reset->lock, flags); ++ ++ if (of_device_is_compatible(ath79_reset->pdev->dev.of_node, "qca,ar9340-reset")) { ++ /** ++ * AR9344 has been observed to hang on reboot in rare cases. ++ * ++ * Datasheet states to reset the ETH switch systems before asserting ++ * full chip reset. See page 111 of the AR9344 datasheet. ++ */ ++ __ath79_reset_update_unlocked(ath79_reset, ETH_SWITCH_RESET, true); ++ mdelay(1); ++ __ath79_reset_update_unlocked(ath79_reset, ETH_SWITCH_ARESET, true); ++ mdelay(1); ++ __ath79_reset_update_unlocked(ath79_reset, FULL_CHIP_RESET, true); ++ mdelay(10); ++ } else { ++ __ath79_reset_update_unlocked(ath79_reset, FULL_CHIP_RESET, true); ++ } ++ ++ spin_unlock_irqrestore(&ath79_reset->lock, flags); + + return NOTIFY_DONE; + } +@@ -95,6 +126,8 @@ static int ath79_reset_probe(struct plat + if (!ath79_reset) + return -ENOMEM; + ++ ath79_reset->pdev = pdev; ++ + ath79_reset->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(ath79_reset->base)) + return PTR_ERR(ath79_reset->base); From 61dabbbfe3bfba7f2a780b0160341c1b6e3a027a Mon Sep 17 00:00:00 2001 From: Dustin Gathmann Date: Wed, 15 Jan 2025 15:55:29 +0100 Subject: [PATCH 379/877] lantiq: fritz_cal_extract with reverse option for AVM FritzBox 7430 This implementation of fritz_cal_extract can also retrieve firmware data stored in reverse byte order, as found in the AVM 7430 device. This is done by intermediate storage in a buffer presumably large enough to hold the complete data set. Currently, this buffer size is 128kB + 1kB (some extra space for skipped data). In the usual case of "forward" data, this implementation should behave like the original implementation in all common cases. limit [-l] will determine the amount of data read and size of buffer allocated. However, if you are reading reversed data or didn't set a limit, the buffer may be too small to hold all data. In this case, you can choose a higher limit [-l] to enforce a sufficient buffer size. Signed-off-by: Dustin Gathmann Link: https://github.com/openwrt/openwrt/pull/15501 Signed-off-by: Robert Marko (cherry picked from commit b2cac2a9785ada7c30388349f5d9a9bdcff2e730) --- .../utils/fritz-tools/src/fritz_cal_extract.c | 142 +++++++++++++----- .../etc/hotplug.d/firmware/12-ath9k-eeprom | 7 +- 2 files changed, 111 insertions(+), 38 deletions(-) diff --git a/package/utils/fritz-tools/src/fritz_cal_extract.c b/package/utils/fritz-tools/src/fritz_cal_extract.c index 9899cd53c33e5d..c4547bc7e05d26 100644 --- a/package/utils/fritz-tools/src/fritz_cal_extract.c +++ b/package/utils/fritz-tools/src/fritz_cal_extract.c @@ -8,6 +8,9 @@ * that is Not copyrighted -- provided to the public domain * Version 1.4 11 December 2005 Mark Adler * + * Modifications to also handle calibration data in reversed byte order + * (c) 2024 by . + * * 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 @@ -28,31 +31,54 @@ #include #include #include +#include #include #include #include #include "zlib.h" #define CHUNK 1024 +#define DEFAULT_BUFFERSIZE (129 * 1024) + +#define MIN(a,b) (((a)<(b))?(a):(b)) -static inline size_t special_min(size_t a, size_t b) +/* Reverse byte order in data buffer. + * 'top' is position of last valid data byte = (datasize - 1) + */ +static void buffer_reverse(unsigned char *data, unsigned int top) { - return a == 0 ? b : (a < b ? a : b); + register unsigned char swapbyte; + const unsigned int center = top / 2; + + for (unsigned int bottom = 0; bottom < center; ++bottom, --top) { + swapbyte = data[bottom]; + data[bottom] = data[top]; + data[top] = swapbyte; + } } -/* Decompress from file source to file dest until stream ends or EOF. - inf() returns Z_OK on success, Z_MEM_ERROR if memory could not be - allocated for processing, Z_DATA_ERROR if the deflate data is - invalid or incomplete, Z_VERSION_ERROR if the version of zlib.h and - the version of the library linked do not match, or Z_ERRNO if there - is an error reading or writing the files. */ -static int inf(FILE *source, FILE *dest, size_t limit, size_t skip) +/* Decompress from file source to data buffer until stream ends + * or *limit bytes have been written to buffer. + * + * On call, 'limit' must reference a variable containing the intended + * number of bytes to retrieve (must be <= allocated buffer size). + * + * Return values (success): + * Z_END_STREAM if complete data was retrieved (*limit == size of complete data), + * or Z_OK if data was retrieved up to limit (*limit == original value). + * + * Return values (failure): + * Z_MEM_ERROR if memory could not be allocated for processing, + * Z_DATA_ERROR if the deflate data is invalid or incomplete, + * Z_VERSION_ERROR if the version of zlib.h and the version of the + * library linked do not match, or + * Z_ERRNO if there is an error reading or writing the files. + */ +static int inflate_to_buffer(FILE *source, unsigned char *buf, size_t *limit) { int ret; - size_t have; z_stream strm; unsigned char in[CHUNK]; - unsigned char out[CHUNK]; /* allocate inflate state */ strm.zalloc = Z_NULL; @@ -64,6 +90,10 @@ static int inf(FILE *source, FILE *dest, size_t limit, size_t skip) if (ret != Z_OK) return ret; + /* set data buffer as stream output */ + strm.avail_out = *limit; + strm.next_out = buf; + /* decompress until deflate stream ends or end of file */ do { strm.avail_in = fread(in, 1, CHUNK, source); @@ -75,35 +105,28 @@ static int inf(FILE *source, FILE *dest, size_t limit, size_t skip) break; strm.next_in = in; - /* run inflate() on input until output buffer not full */ - do { - strm.avail_out = CHUNK; - strm.next_out = out; - ret = inflate(&strm, Z_NO_FLUSH); - assert(ret != Z_STREAM_ERROR); /* state not clobbered */ - switch (ret) { + /* run inflate(), fill data buffer with all available output */ + ret = inflate(&strm, Z_FINISH); + assert(ret != Z_STREAM_ERROR); /* state not clobbered */ + + switch (ret) { case Z_NEED_DICT: ret = Z_DATA_ERROR; /* and fall through */ case Z_DATA_ERROR: case Z_MEM_ERROR: (void)inflateEnd(&strm); return ret; - } - have = special_min(limit, CHUNK - strm.avail_out) - skip; - if (fwrite(&out[skip], have, 1, dest) != 1 || ferror(dest)) { - (void)inflateEnd(&strm); - return Z_ERRNO; - } - skip = 0; - limit -= have; - } while (strm.avail_out == 0 && limit > 0); + } + /* done when inflate() says it's done or limit reached */ + } while (ret != Z_STREAM_END && strm.avail_out > 0); - /* done when inflate() says it's done */ - } while (ret != Z_STREAM_END && limit > 0); + /* set limit to end of retrieved data */ + assert(strm.total_out <= *limit); + *limit = strm.total_out; /* clean up and return */ (void)inflateEnd(&strm); - return (limit == 0 ? Z_OK : (ret == Z_STREAM_END ? Z_OK : Z_DATA_ERROR)); + return (ret == Z_STREAM_END ? Z_STREAM_END : (strm.avail_out == 0 ? Z_OK : Z_DATA_ERROR)); } /* report a zlib or i/o error */ @@ -140,7 +163,8 @@ static unsigned int get_num(char *str) static void usage(void) { - fprintf(stderr, "Usage: fritz_cal_extract [-s seek offset] [-i skip] [-o output file] [-l limit] [infile] -e entry_id\n" + fprintf(stderr, "Usage: fritz_cal_extract -e entry_id [-s seek offset] [-l limit]\n" + "\t[-r reverse extracted data] [-i skip n bytes] [-o output file] [infile]\n" "Finds and extracts zlib compressed calibration data in the EVA loader\n"); exit(EXIT_FAILURE); } @@ -154,15 +178,18 @@ struct cal_entry { int main(int argc, char **argv) { struct cal_entry cal = { .len = 0 }; + unsigned char *buf = NULL; FILE *in = stdin; FILE *out = stdout; + size_t datasize = DEFAULT_BUFFERSIZE; size_t limit = 0, skip = 0; int initial_offset = 0; int entry = -1; + bool reversed = false, limit_was_set = true; int ret; int opt; - while ((opt = getopt(argc, argv, "s:e:o:l:i:")) != -1) { + while ((opt = getopt(argc, argv, "s:e:o:l:i:r")) != -1) { switch (opt) { case 's': initial_offset = (int)get_num(optarg); @@ -199,6 +226,9 @@ int main(int argc, char **argv) goto out_bad; } break; + case 'r': + reversed = true; + break; default: /* '?' */ usage(); } @@ -243,11 +273,50 @@ int main(int argc, char **argv) goto out_bad; } - ret = inf(in, out, limit, skip); - if (ret == Z_OK) - goto out; + /* Set boundaries. Only keep default datasize if we need complete data + * for reversal and didn't set a higher limit. */ + if (!limit) { + limit_was_set = false; + limit = datasize - skip; + } + datasize = (reversed && datasize >= limit + skip) ? datasize : (limit + skip); + + /* Create data buffer. */ + buf = malloc(datasize); + assert(buf != NULL); + + ret = inflate_to_buffer(in, buf, &datasize); + + if ((reversed || !limit_was_set) && ret != Z_STREAM_END) { /* didn't read to stream end */ + fprintf(stderr, "Failed: Data exceeds buffer size of %u. Refusing to reverse" + " or store incomplete data." + " Use a higher limit [-l] to increase buffer size.\n", + (unsigned int) datasize); + goto out_bad; + } + + ret = (ret == Z_STREAM_END) ? Z_OK : ret; /* normalize return value */ + if (ret != Z_OK) { + zerr(ret); + goto out_bad; + } + + if (reversed) + buffer_reverse(buf, datasize - 1); + + if (datasize <= skip) { + fprintf(stderr, "Failed to skip %u bytes, total data size is %u!\n", + (unsigned int)skip, (unsigned int)datasize); + goto out_bad; + } + + limit = MIN(limit, datasize - skip); + if (fwrite(&buf[skip], limit, 1, out) != 1 || ferror(out)) { + fprintf(stderr, "Failed to write data buffer to output file"); + goto out_bad; + } - zerr(ret); + goto out; out_bad: ret = EXIT_FAILURE; @@ -257,5 +326,6 @@ int main(int argc, char **argv) fclose(in); if (out) fclose(out); + free(buf); return ret; } diff --git a/target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom b/target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom index 936181c6935210..cb3fef91687534 100644 --- a/target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom +++ b/target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom @@ -19,11 +19,14 @@ case "$FIRMWARE" in avm,fritz3390) caldata_extract_reverse "urlader" 0x2546 0x440 ;; - avm,fritz7412|\ - avm,fritz7430) + avm,fritz7412) /usr/bin/fritz_cal_extract -i 1 -s 0x1e000 -e 0x207 -l 5120 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader") || \ /usr/bin/fritz_cal_extract -i 1 -s 0x1e800 -e 0x207 -l 5120 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader") ;; + avm,fritz7430) + /usr/bin/fritz_cal_extract -r -i 4 -s 0x1e000 -e 0x207 -l 5120 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader") || \ + /usr/bin/fritz_cal_extract -r -i 4 -s 0x1e800 -e 0x207 -l 5120 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader") + ;; bt,homehub-v5a) caldata_extract_ubi "caldata" 0x1000 0x1000 ath9k_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary_ubi caldata 0x110c) 2) 0x10c From a252c56b4b0e452930cce99a8769616755ab630d Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Mon, 20 Jan 2025 13:08:38 +0100 Subject: [PATCH 380/877] fritz-tools: increase PKG_RELEASE Increase PKG_RELEASE as follow-up for ("lantiq: fritz_cal_extract with reverse option for AVM FritzBox 7430"). Signed-off-by: Robert Marko (cherry picked from commit 4a8717b5e76edbc8e1f63122f8b05685e0b779db) --- package/utils/fritz-tools/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/utils/fritz-tools/Makefile b/package/utils/fritz-tools/Makefile index 6e20b56ff8a7ca..b43fe20e9e7555 100644 --- a/package/utils/fritz-tools/Makefile +++ b/package/utils/fritz-tools/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=fritz-tools -PKG_RELEASE:=2 +PKG_RELEASE:=3 CMAKE_INSTALL:=1 include $(INCLUDE_DIR)/package.mk From 96ff9c3353b70f2b025a6fedb32bd99e458cff05 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Mon, 20 Jan 2025 17:14:47 +0100 Subject: [PATCH 381/877] kernel: fix rootfs initramfs not updating on subsequent single build There is currently a problem where the rootfs in an initramfs image for single target build is not updated on subsequent run. This is caused by a bug introduced in d78dec3e19e3 ("kernel: copy kernel build dir on Per-Device Initramfs compilation") where the initramfs_data.cpio rm was moved to PrepareConfigPerRootfs. This caused the side effect of dropping the rm call for single target build making the kernel reusing the previous generated initramfs_data.cpio. To correctly handle this, restore the original location of this call right after the touch /init call. This way the kernel will always regenerate the initramfs embedded rootfs ALSO for single target build. Fixes: d78dec3e19e3 ("kernel: copy kernel build dir on Per-Device Initramfs compilation") Signed-off-by: Christian Marangi (cherry picked from commit 334c649a8d9b191c0282f9104b3997b090628f56) --- 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 f94ed3323051f2..cbe415abe64ab9 100644 --- a/include/kernel-defaults.mk +++ b/include/kernel-defaults.mk @@ -175,7 +175,6 @@ define Kernel/PrepareConfigPerRootfs [ ! -d "$(1)" ] || rm -rf $(1); \ mkdir $(1) && $(CP) -T $(LINUX_DIR) $(1); \ touch $(1)/.config; \ - rm -rf $(1)/usr/initramfs_data.cpio*; \ } endef @@ -190,6 +189,7 @@ define Kernel/CompileImage/Initramfs $(call Kernel/Configure/Initramfs,$(if $(1),$(1),$(TARGET_DIR)),$(LINUX_DIR)$(2)); \ $(CP) $(GENERIC_PLATFORM_DIR)/other-files/init $(if $(1),$(1),$(TARGET_DIR))/init; \ $(if $(SOURCE_DATE_EPOCH),touch -hcd "@$(SOURCE_DATE_EPOCH)" $(if $(1),$(1),$(TARGET_DIR)) $(if $(1),$(1),$(TARGET_DIR))/init;) \ + rm -rf $(LINUX_DIR)$(2)/usr/initramfs_data.cpio*; \ $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE), \ $(call locked,{ \ $(if $(call qstrip,$(CONFIG_EXTERNAL_CPIO)), \ From 40115d519cd226889c7ec01d261ac87ccafe6b75 Mon Sep 17 00:00:00 2001 From: Aleksander Jan Bajkowski Date: Wed, 15 Jan 2025 19:21:24 +0100 Subject: [PATCH 382/877] mediatek: EX5601-T0 add Zyxel EX5601-T1 and T-56 alias Define EX5601-T1 and T-56 as alternative name, to explicitly show the device is supported using existing image. EX5601-T1 does not have the option to switch between WAN/SFP port. The switch port is hardwired to the WAN port. The Zyxel T-56 is the odido-branded version of the EX5601-T1. Signed-off-by: Aleksander Jan Bajkowski Link: https://github.com/openwrt/openwrt/pull/17615 Signed-off-by: Hauke Mehrtens (cherry picked from commit 3d63a41ffab69cb6f49c14cff99c3c3a84899363) --- target/linux/mediatek/image/filogic.mk | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index d8d35954b00cd8..135a954400cb95 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -1628,6 +1628,10 @@ TARGET_DEVICES += zbtlink_zbt-z8103ax define Device/zyxel_ex5601-t0-stock DEVICE_VENDOR := Zyxel DEVICE_MODEL := EX5601-T0 + DEVICE_ALT0_VENDOR := Zyxel + DEVICE_ALT0_MODEL := EX5601-T1 + DEVICE_ALT1_VENDOR := Zyxel + DEVICE_ALT1_MODEL := T-56 DEVICE_VARIANT := (stock layout) DEVICE_DTS := mt7986a-zyxel-ex5601-t0-stock DEVICE_DTS_DIR := ../dts @@ -1651,6 +1655,10 @@ TARGET_DEVICES += zyxel_ex5601-t0-stock define Device/zyxel_ex5601-t0-ubootmod DEVICE_VENDOR := Zyxel DEVICE_MODEL := EX5601-T0 + DEVICE_ALT0_VENDOR := Zyxel + DEVICE_ALT0_MODEL := EX5601-T1 + DEVICE_ALT1_VENDOR := Zyxel + DEVICE_ALT1_MODEL := T-56 DEVICE_VARIANT := (OpenWrt U-Boot layout) DEVICE_DTS := mt7986a-zyxel-ex5601-t0-ubootmod DEVICE_DTS_DIR := ../dts From eb82b2cbcb1bd351ec83dd8ca0f36d4dcb138095 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Wed, 20 Nov 2024 03:45:21 +0100 Subject: [PATCH 383/877] ath79: lzma-loader: expose LZMA_TEXT_ADDRESS configuration again initramfs for some devices grew so big, that it can't be loaded within the previous 32MB RAM limit. Make the LZMA_TEXT_ADDRESS configurable per-target once again, to fix it for bigger devices, while maintaining compatibility with previous ones. Signed-off-by: Lech Perczak Link: https://github.com/openwrt/openwrt/pull/17616 Signed-off-by: Hauke Mehrtens (cherry picked from commit 6720958659d226e71dca49657202e0502bb059bd) --- target/linux/ath79/image/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/linux/ath79/image/Makefile b/target/linux/ath79/image/Makefile index 5647200b4ba04c..1918a8a4318dfb 100644 --- a/target/linux/ath79/image/Makefile +++ b/target/linux/ath79/image/Makefile @@ -4,7 +4,7 @@ include $(INCLUDE_DIR)/image.mk KERNEL_LOADADDR = 0x80060000 DEVICE_VARS += LOADER_FLASH_OFFS LOADER_TYPE -DEVICE_VARS += LOADER_FLASH_MAX LOADER_KERNEL_MAGIC +DEVICE_VARS += LOADER_FLASH_MAX LOADER_KERNEL_MAGIC LZMA_TEXT_START DEVICE_VARS += NETGEAR_BOARD_ID NETGEAR_HW_ID DEVICE_VARS += RAS_BOARD RAS_ROOTFS_SIZE RAS_VERSION DEVICE_VARS += SEAMA_SIGNATURE SEAMA_MTDBLOCK @@ -14,6 +14,7 @@ define Build/loader-common $(MAKE) -C lzma-loader \ PKG_BUILD_DIR="$@.src" \ TARGET_DIR="$(dir $@)" LOADER_NAME="$(notdir $@)" \ + LZMA_TEXT_START=$(LZMA_TEXT_START) \ $(1) compile loader.$(LOADER_TYPE) mv "$@.$(LOADER_TYPE)" "$@" rm -rf $@.src @@ -74,6 +75,7 @@ define Device/Default LOADER_FLASH_MAX := LOADER_FLASH_OFFS := LOADER_TYPE := + LZMA_TEXT_START := 0x81800000 COMPILE := IMAGES := sysupgrade.bin IMAGE/sysupgrade.bin = append-kernel | pad-to $$$$(BLOCKSIZE) | \ From baa0fc8e042969afa575c4fd4fd4ce9bac8cd96f Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Wed, 20 Nov 2024 03:45:46 +0100 Subject: [PATCH 384/877] ath79: zte-mf28x-common: fix initramfs execution Now that LZMA_TEXT_START is configurable per-target once again, move the target above 32MB boundary for ZTE MF28* devices. Signed-off-by: Lech Perczak Link: https://github.com/openwrt/openwrt/pull/17616 Signed-off-by: Hauke Mehrtens (cherry picked from commit 32c6b9064ac7fc62cead37b1bc7d46ffba598c71) --- target/linux/ath79/image/nand.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/linux/ath79/image/nand.mk b/target/linux/ath79/image/nand.mk index d3c1120aa23ca0..e8494da15da7e3 100644 --- a/target/linux/ath79/image/nand.mk +++ b/target/linux/ath79/image/nand.mk @@ -442,6 +442,10 @@ define Device/zte_mf28x_common DEVICE_PACKAGES := kmod-usb2 kmod-ath10k-ct BLOCKSIZE := 128k PAGESIZE := 2048 + LOADER_TYPE := bin + LZMA_TEXT_START := 0x82800000 + KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | uImage none + KERNEL_INITRAMFS := $$(KERNEL) KERNEL_SIZE := 4096k IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef From 3f4c175851a5abb416f8d18eab20f98c014b8bf1 Mon Sep 17 00:00:00 2001 From: Florian Maurer Date: Thu, 16 Jan 2025 09:29:55 +0100 Subject: [PATCH 385/877] mediatek-filogic: fix wax220 wifi leds The WAX220 does have a 2.4GHz and 5GHz wifi led, which was set to trigger on netdev before. This commit changes this to trigger on activity of the respective radio Signed-off-by: Florian Maurer Link: https://github.com/openwrt/openwrt/pull/17627 Signed-off-by: Hauke Mehrtens (cherry picked from commit 99431e315039d7f9689b21a8aa220adadf52a886) --- target/linux/mediatek/dts/mt7986b-netgear-wax220.dts | 2 ++ target/linux/mediatek/filogic/base-files/etc/board.d/01_leds | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/mediatek/dts/mt7986b-netgear-wax220.dts b/target/linux/mediatek/dts/mt7986b-netgear-wax220.dts index 6e51d884702358..9537afba898aed 100644 --- a/target/linux/mediatek/dts/mt7986b-netgear-wax220.dts +++ b/target/linux/mediatek/dts/mt7986b-netgear-wax220.dts @@ -67,6 +67,7 @@ wlan2g_blue { gpios = <&pio 1 GPIO_ACTIVE_LOW>; label = "blue:wlan2g"; + linux,default-trigger = "phy0tpt"; }; lan_green { @@ -84,6 +85,7 @@ wlan5g_blue { gpios = <&pio 2 GPIO_ACTIVE_LOW>; label = "blue:wlan5g"; + linux,default-trigger = "phy1tpt"; }; }; }; 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 168909cf90a499..5048e9bb8f8b4d 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 @@ -58,8 +58,6 @@ mercusys,mr90x-v1-ubi) ;; 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" ;; nokia,ea0326gmp) ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth1" "link" From f9df8a90c8a44814df78e25bbda254a79f9d3785 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 20 Jan 2025 22:16:37 +0100 Subject: [PATCH 386/877] uci: update to Git HEAD (2025-01-20) 047b2efc1348 CMakeLists.txt: bump minimum cmake version 16ff0badbde7 CMakeLists: add support for including ABIVERSION in the library version number Signed-off-by: Felix Fietkau (cherry picked from commit e046f8c318618162fcdd768c4a9eadd53c239629) --- package/system/uci/Makefile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/package/system/uci/Makefile b/package/system/uci/Makefile index a253b43938f9f8..6e4d8da97c755e 100644 --- a/package/system/uci/Makefile +++ b/package/system/uci/Makefile @@ -13,9 +13,10 @@ PKG_RELEASE:=1 PKG_SOURCE_URL=$(PROJECT_GIT)/project/uci.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2025-01-17 -PKG_SOURCE_VERSION:=fb3c2343b17b759b175f11aec5b3fbb1cf48bbc3 -PKG_MIRROR_HASH:=c9302f4a1cb400134cb9fc0622fb6a04bbe8c55bcc83ec454caadb1e62f3257e +PKG_SOURCE_DATE:=2025-01-20 +PKG_SOURCE_VERSION:=16ff0badbde7e17ec3bd1f827ffe45922956cf86 +PKG_MIRROR_HASH:=e91ee4a2c0baaafe1d8ccd5321de70a8412a50323b0b27bbc7ad145e77018a22 +PKG_ABI_VERSION:=20250120 PKG_LICENSE:=LGPL-2.1 PKG_LICENSE_FILES:= @@ -33,7 +34,7 @@ define Package/libuci CATEGORY:=Libraries TITLE:=C library for the Unified Configuration Interface (UCI) DEPENDS:=+libubox - ABI_VERSION:=20250117 + ABI_VERSION:=$(PKG_ABI_VERSION) endef define Package/uci @@ -55,11 +56,12 @@ TARGET_LDFLAGS += -L$(STAGING_DIR)/usr/lib CMAKE_OPTIONS += \ -DLUAPATH=/usr/lib/lua \ + -DABIVERSION=$(PKG_ABI_VERSION) \ $(if $(DEBUG),-DUCI_DEBUG=ON) define Package/libuci/install $(INSTALL_DIR) $(1)/lib - $(CP) $(PKG_BUILD_DIR)/libuci.so* $(1)/lib/ + $(CP) $(PKG_BUILD_DIR)/libuci.so.* $(1)/lib/ endef define Package/libuci-lua/install From 6c628bfddcfe2f0e2cf5c367cfbaba1a434116bf Mon Sep 17 00:00:00 2001 From: Raylynn Knight Date: Sat, 11 Jan 2025 00:19:59 -0500 Subject: [PATCH 387/877] d1: Use correct module for devices with wifi Devices with wifi (LicheePi RV and MangoPi MQ Pro) were using the wrong module. Also wpad was missing to enable using the WiFi. Signed-off-by: Raylynn Knight Link: https://github.com/openwrt/openwrt/pull/17576 Signed-off-by: Hauke Mehrtens Signed-off-by: Zoltan HERPAI (cherry picked from commit 8a17bae722a62954269f29dc48025e88c919dc24) --- target/linux/d1/base-files/etc/board.d/02_network | 4 ++++ target/linux/d1/image/Makefile | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/target/linux/d1/base-files/etc/board.d/02_network b/target/linux/d1/base-files/etc/board.d/02_network index df48b431af5e2c..dc61e4bde51460 100644 --- a/target/linux/d1/base-files/etc/board.d/02_network +++ b/target/linux/d1/base-files/etc/board.d/02_network @@ -8,6 +8,10 @@ board_config_update case "$(board_name)" in +sipeed,lichee-rv-dock |\ +widora,mangopi-mq-pro) + ucidef_set_interface_lan "wlan0" + ;; *) ucidef_set_interface_lan 'eth0' ;; diff --git a/target/linux/d1/image/Makefile b/target/linux/d1/image/Makefile index 8dca2fb1cb0ee0..ea41e65c760e09 100644 --- a/target/linux/d1/image/Makefile +++ b/target/linux/d1/image/Makefile @@ -65,7 +65,7 @@ define Device/sipeed_lichee-rv-dock DEVICE_MODEL := LicheePi RV (dock) DEVICE_DTS := allwinner/sun20i-d1-lichee-rv-dock SUPPORTED_DEVICES += lichee_rv_dock - DEVICE_PACKAGES += kmod-rtl8723bs + DEVICE_PACKAGES += kmod-rtw88-8723ds wpad-basic-mbedtls UBOOT := lichee_rv_dock endef TARGET_DEVICES += sipeed_lichee-rv-dock @@ -76,7 +76,7 @@ define Device/widora_mangopi-mq-pro DEVICE_MODEL := MQ Pro DEVICE_DTS := allwinner/sun20i-d1-mangopi-mq-pro SUPPORTED_DEVICES += mangopi_mq_pro - DEVICE_PACKAGES += kmod-rtl8723bs + DEVICE_PACKAGES += kmod-rtw88-8723ds wpad-basic-mbedtls UBOOT := mangopi_mq_pro endef TARGET_DEVICES += widora_mangopi-mq-pro From 592e56c0649fc138b844c40aadeda7e856b060d4 Mon Sep 17 00:00:00 2001 From: Sebastian Pflieger Date: Thu, 9 Jan 2025 18:16:04 +0100 Subject: [PATCH 388/877] lldpd: bump version to 1.0.18 Changes (breaking): - Remove support for building 802.3bt TLVs (broken). Fix: - Fix memory leaks in EDP/FDP decoding when receiving some TLVs twice. - Do not set interface description continuously. - Use a different Netlink socket for changes and queries. Signed-off-by: Sebastian Pflieger Link: https://github.com/openwrt/openwrt/pull/17570 Signed-off-by: Robert Marko (cherry picked from commit a18385041eaeaf6d98ab79a30ce5fba4e712b765) --- 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 f34cd28faac965..b21ca76c5e13d2 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.17 +PKG_VERSION:=1.0.18 PKG_RELEASE:=5 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/lldpd/lldpd/releases/download/$(PKG_VERSION)/ -PKG_HASH:=89ae691a4917ac9e0ec3b8b2c1e634cc402d43b804f98850c73bd1c7df380882 +PKG_HASH:=38cd319aa02ab61d9a2ad130e22f906795ccca9ac73a0a0d9dac19ca99a8a870 PKG_MAINTAINER:=Stijn Tintel PKG_LICENSE:=ISC From dc81243e87fd305959ca25fa78e3a11b8ebfc0bc Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Tue, 14 Jan 2025 09:37:33 +0100 Subject: [PATCH 389/877] lldpd: reset PKG_RELEASE lldpd was updated, so reset PKG_RELEASE after the PKG_VERSION update. Signed-off-by: Robert Marko (cherry picked from commit abbec429b40f149f9c5a99a64ee7bf4e804fbb7d) --- package/network/services/lldpd/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/network/services/lldpd/Makefile b/package/network/services/lldpd/Makefile index b21ca76c5e13d2..6be9723a9b4e17 100644 --- a/package/network/services/lldpd/Makefile +++ b/package/network/services/lldpd/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=lldpd PKG_VERSION:=1.0.18 -PKG_RELEASE:=5 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/lldpd/lldpd/releases/download/$(PKG_VERSION)/ From c8c1156e9dda1b72d525d442d76d819737b79d87 Mon Sep 17 00:00:00 2001 From: Sebastian Pflieger Date: Thu, 9 Jan 2025 18:10:38 +0100 Subject: [PATCH 390/877] lldpd: fix config for build without LLDP-MED The lldp_class and lldp_location config option are only valid when compiled with LLDP-MED support. If not they will cause lldpd not to start. Signed-off-by: Sebastian Pflieger Link: https://github.com/openwrt/openwrt/pull/17571 Signed-off-by: Robert Marko (cherry picked from commit 2c22d7c3a4a7edcce1af656c8cddb1ab163e3d02) --- package/network/services/lldpd/Makefile | 4 +++- package/network/services/lldpd/files/lldpd.init | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/package/network/services/lldpd/Makefile b/package/network/services/lldpd/Makefile index 6be9723a9b4e17..3fbd0bf4f93ae8 100644 --- a/package/network/services/lldpd/Makefile +++ b/package/network/services/lldpd/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=lldpd PKG_VERSION:=1.0.18 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/lldpd/lldpd/releases/download/$(PKG_VERSION)/ @@ -90,6 +90,8 @@ endif ifneq ($(CONFIG_LLDPD_WITH_LLDPMED),y) sed -i -e 's/CONFIG_LLDPD_WITH_LLDPMED=y/CONFIG_LLDPD_WITH_LLDPMED=n/g' $(1)/etc/init.d/lldpd sed -i -e '/agentxsocket/d' $(1)/etc/config/lldpd + sed -i -e '/lldp_class/d' $(1)/etc/config/lldpd + sed -i -e '/lldp_location/d' $(1)/etc/config/lldpd endif endef diff --git a/package/network/services/lldpd/files/lldpd.init b/package/network/services/lldpd/files/lldpd.init index 3922b676b52e69..6c1c184bfa10a6 100644 --- a/package/network/services/lldpd/files/lldpd.init +++ b/package/network/services/lldpd/files/lldpd.init @@ -39,7 +39,6 @@ get_config_restart_hash() { config_load 'lldpd' - config_get v 'config' 'lldp_class'; append _string "$v" "," if [ "$CONFIG_LLDPD_WITH_SNMP" = "y" ]; then config_get v 'config' 'agentxsocket'; append _string "$v" "," fi @@ -49,6 +48,7 @@ get_config_restart_hash() { config_get_bool v 'config' 'lldp_no_version'; append _string "$v" "," if [ "$CONFIG_LLDPD_WITH_LLDPMED" = "y" ]; then config_get_bool v 'config' 'lldpmed_no_inventory'; append _string "$v" "," + config_get v 'config' 'lldp_class'; append _string "$v" "," fi config_get_bool v 'config' 'enable_lldp' 1; append _string "$v" "," config_get_bool v 'config' 'force_lldp'; append _string "$v" "," @@ -243,10 +243,10 @@ start_service() { config_get_bool enable_edp 'config' 'enable_edp' 0 config_get_bool force_edp 'config' 'force_edp' 0 fi - config_get lldp_class 'config' 'lldp_class' config_get_bool lldp_no_version 'config' 'lldp_no_version' 0 if [ "$CONFIG_LLDPD_WITH_LLDPMED" = "y" ]; then config_get_bool lldpmed_no_inventory 'config' 'lldpmed_no_inventory' 0 + config_get lldp_class 'config' 'lldp_class' fi config_get_bool readonly_mode 'config' 'readonly_mode' 0 if [ "$CONFIG_LLDPD_WITH_SNMP" = "y" ]; then From b957ee982ae1a38aeeeee44baf4c6e8d2c239978 Mon Sep 17 00:00:00 2001 From: Florian Maurer Date: Wed, 15 Jan 2025 21:31:47 +0100 Subject: [PATCH 391/877] lantiq: xrx200: fb7430 set correct label-mac the CWMP account mac is correctly set on the lan device but was not correctly as label-mac Signed-off-by: Florian Maurer Link: https://github.com/openwrt/openwrt/pull/17618 Signed-off-by: Hauke Mehrtens (cherry picked from commit f9813f41b2e9fccb644ae149eabe575fbae12fa3) --- target/linux/lantiq/xrx200/base-files/etc/board.d/02_network | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network b/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network index 8c2cdb12af51f7..bf907578970cdb 100644 --- a/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network +++ b/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network @@ -125,6 +125,7 @@ lantiq_setup_macs() tffsdev=$(find_mtd_chardev "nand-tffs") lan_mac=$(/usr/bin/fritz_tffs_nand -d $tffsdev -n maca -o) wan_mac=$(/usr/bin/fritz_tffs_nand -d $tffsdev -n macdsl -o) + label_mac=$lan_mac ;; bt,homehub-v5a) lan_mac=$(mtd_get_mac_binary_ubi caldata 0x110c) @@ -142,6 +143,7 @@ lantiq_setup_macs() [ -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 4081bc3f6cb61df7b9608d6bdc0a103ab0c06d35 Mon Sep 17 00:00:00 2001 From: John Audia Date: Fri, 17 Jan 2025 08:25:17 -0500 Subject: [PATCH 392/877] kernel: bump 6.6 to 6.6.72 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.72 Dropped to due being superseded by upstream patch: mediatek/patches-6.6/870-drm-mediatek-only-touch-DISP_REG_OVL_PITCH_MSB-if-AF.patch[1] All other patches automatically rebased. 1. https://github.com/gregkh/linux/commit/ac7f5641e9887354a0fc6f48190533af084bb0dc Build system: x86/64 Build-tested: bcm27xx/bcm2712, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Run-tested: bcm27xx/bcm2712, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/17646 Signed-off-by: Hauke Mehrtens (cherry picked from commit 1d021458fd681dc4c27615a574cc09cc57d1c51e) --- include/kernel-6.6 | 4 ++-- ...devm_thermal_of_zone_register_with_pa.patch | 18 +++++++++--------- .../950-0087-Add-dwc_otg-driver.patch | 2 +- ...hci_sync-Add-fallback-bd-address-prop.patch | 4 ++-- ...dwc3-Set-DMA-and-coherent-masks-early.patch | 4 ++-- ...3-add-FS-LS-bus-instance-parkmode-dis.patch | 4 ++-- ...oth-hci_sync-Fix-crash-on-NULL-parent.patch | 2 +- ...dd-support-for-setting-NAK-enhancemen.patch | 4 ++-- ...ct-size-the-hashtable-more-adequately.patch | 2 +- ...bles-ignore-EOPNOTSUPP-on-flowtable-d.patch | 2 +- ...wc3-add-optional-PHY-interface-clocks.patch | 4 ++-- ...rt-8250-Add-dw-auto-flow-ctrl-support.patch | 2 +- 12 files changed, 26 insertions(+), 26 deletions(-) diff --git a/include/kernel-6.6 b/include/kernel-6.6 index f034d0754cca75..8fa79f9ce1675b 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .71 -LINUX_KERNEL_HASH-6.6.71 = 219715ba2dcfa6539fba09ad3f9212772f3507189eb60d77f8e89b06c32e724e +LINUX_VERSION-6.6 = .72 +LINUX_KERNEL_HASH-6.6.72 = feb9e514930d5968daa0b8b5486d3295d1fb2b34accf876207641884d4baef39 diff --git a/target/linux/airoha/patches-6.6/101-01-thermal-of-Add-devm_thermal_of_zone_register_with_pa.patch b/target/linux/airoha/patches-6.6/101-01-thermal-of-Add-devm_thermal_of_zone_register_with_pa.patch index 7836aef7dd1704..d646e05170368a 100644 --- a/target/linux/airoha/patches-6.6/101-01-thermal-of-Add-devm_thermal_of_zone_register_with_pa.patch +++ b/target/linux/airoha/patches-6.6/101-01-thermal-of-Add-devm_thermal_of_zone_register_with_pa.patch @@ -40,7 +40,7 @@ Signed-off-by: Christian Marangi --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c -@@ -245,7 +245,7 @@ static void thermal_of_parameters_init(s +@@ -246,7 +246,7 @@ static void thermal_of_parameters_init(s { int coef[2]; int ncoef = ARRAY_SIZE(coef); @@ -49,7 +49,7 @@ Signed-off-by: Christian Marangi tzp->no_hwmon = true; -@@ -257,14 +257,11 @@ static void thermal_of_parameters_init(s +@@ -258,14 +258,11 @@ static void thermal_of_parameters_init(s * thermal zone. Thus, we are considering only the first two * values as slope and offset. */ @@ -67,7 +67,7 @@ Signed-off-by: Christian Marangi } static struct device_node *thermal_of_zone_get_by_name(struct thermal_zone_device *tz) -@@ -458,10 +455,15 @@ static void thermal_of_zone_unregister(s +@@ -459,10 +456,15 @@ static void thermal_of_zone_unregister(s * zone properties and registers new thermal zone with those * properties. * @@ -83,7 +83,7 @@ Signed-off-by: Christian Marangi * * Return: a valid thermal zone structure pointer on success. * - EINVAL: if the device tree thermal description is malformed -@@ -469,11 +471,11 @@ static void thermal_of_zone_unregister(s +@@ -470,11 +472,11 @@ static void thermal_of_zone_unregister(s * - Other negative errors are returned by the underlying called functions */ static struct thermal_zone_device *thermal_of_zone_register(struct device_node *sensor, int id, void *data, @@ -97,7 +97,7 @@ Signed-off-by: Christian Marangi struct thermal_zone_device_ops *of_ops; struct device_node *np; int delay, pdelay; -@@ -508,7 +510,7 @@ static struct thermal_zone_device *therm +@@ -509,7 +511,7 @@ static struct thermal_zone_device *therm goto out_kfree_trips; } @@ -106,7 +106,7 @@ Signed-off-by: Christian Marangi of_ops->bind = thermal_of_bind; of_ops->unbind = thermal_of_unbind; -@@ -516,7 +518,7 @@ static struct thermal_zone_device *therm +@@ -517,7 +519,7 @@ static struct thermal_zone_device *therm mask = GENMASK_ULL((ntrips) - 1, 0); tz = thermal_zone_device_register_with_trips(np->name, trips, ntrips, @@ -115,7 +115,7 @@ Signed-off-by: Christian Marangi pdelay, delay); if (IS_ERR(tz)) { ret = PTR_ERR(tz); -@@ -571,6 +573,7 @@ static int devm_thermal_of_zone_match(st +@@ -572,6 +574,7 @@ static int devm_thermal_of_zone_match(st struct thermal_zone_device *devm_thermal_of_zone_register(struct device *dev, int sensor_id, void *data, const struct thermal_zone_device_ops *ops) { @@ -123,7 +123,7 @@ Signed-off-by: Christian Marangi struct thermal_zone_device **ptr, *tzd; ptr = devres_alloc(devm_thermal_of_zone_release, sizeof(*ptr), -@@ -578,7 +581,7 @@ struct thermal_zone_device *devm_thermal +@@ -579,7 +582,7 @@ struct thermal_zone_device *devm_thermal if (!ptr) return ERR_PTR(-ENOMEM); @@ -132,7 +132,7 @@ Signed-off-by: Christian Marangi if (IS_ERR(tzd)) { devres_free(ptr); return tzd; -@@ -592,6 +595,46 @@ struct thermal_zone_device *devm_thermal +@@ -593,6 +596,46 @@ struct thermal_zone_device *devm_thermal EXPORT_SYMBOL_GPL(devm_thermal_of_zone_register); /** diff --git a/target/linux/bcm27xx/patches-6.6/950-0087-Add-dwc_otg-driver.patch b/target/linux/bcm27xx/patches-6.6/950-0087-Add-dwc_otg-driver.patch index cb9fd4442a3481..3da9f4230bd16b 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0087-Add-dwc_otg-driver.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0087-Add-dwc_otg-driver.patch @@ -1189,7 +1189,7 @@ Signed-off-by: Alexander Winkowski } --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c -@@ -5710,7 +5710,7 @@ static void port_event(struct usb_hub *h +@@ -5712,7 +5712,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-6.6/950-0441-Bluetooth-hci_sync-Add-fallback-bd-address-prop.patch b/target/linux/bcm27xx/patches-6.6/950-0441-Bluetooth-hci_sync-Add-fallback-bd-address-prop.patch index 3f9d802de3c229..b9d1a95c6d14c6 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0441-Bluetooth-hci_sync-Add-fallback-bd-address-prop.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0441-Bluetooth-hci_sync-Add-fallback-bd-address-prop.patch @@ -20,7 +20,7 @@ Signed-off-by: Phil Elwell --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c -@@ -4872,6 +4872,7 @@ static const struct { +@@ -4873,6 +4873,7 @@ static const struct { */ static int hci_dev_setup_sync(struct hci_dev *hdev) { @@ -28,7 +28,7 @@ Signed-off-by: Phil Elwell int ret = 0; bool invalid_bdaddr; size_t i; -@@ -4900,7 +4901,8 @@ static int hci_dev_setup_sync(struct hci +@@ -4901,7 +4902,8 @@ static int hci_dev_setup_sync(struct hci test_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks); if (!ret) { if (test_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks) && diff --git a/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch b/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch index 2448bd942a9cce..db3b6cd828071d 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch @@ -333,7 +333,7 @@ Signed-off-by: Jonathan Bell /* Global Debug LSP MUX Select */ #define DWC3_GDBGLSPMUX_ENDBC BIT(15) /* Host only */ #define DWC3_GDBGLSPMUX_HOSTSELECT(n) ((n) & 0x3fff) -@@ -1066,6 +1069,7 @@ struct dwc3_scratchpad_array { +@@ -1067,6 +1070,7 @@ struct dwc3_scratchpad_array { * @tx_max_burst_prd: max periodic ESS transmit burst size * @tx_fifo_resize_max_num: max number of fifos allocated during txfifo resize * @clear_stall_protocol: endpoint number that requires a delayed status phase @@ -341,7 +341,7 @@ Signed-off-by: Jonathan Bell * @hsphy_interface: "utmi" or "ulpi" * @connected: true when we're connected to a host, false otherwise * @softconnect: true when gadget connect is called, false when disconnect runs -@@ -1303,6 +1307,7 @@ struct dwc3 { +@@ -1304,6 +1308,7 @@ struct dwc3 { u8 tx_max_burst_prd; u8 tx_fifo_resize_max_num; u8 clear_stall_protocol; diff --git a/target/linux/bcm27xx/patches-6.6/950-0853-drivers-usb-dwc3-add-FS-LS-bus-instance-parkmode-dis.patch b/target/linux/bcm27xx/patches-6.6/950-0853-drivers-usb-dwc3-add-FS-LS-bus-instance-parkmode-dis.patch index 6eb5e5697f70dc..0441512add1775 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0853-drivers-usb-dwc3-add-FS-LS-bus-instance-parkmode-dis.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0853-drivers-usb-dwc3-add-FS-LS-bus-instance-parkmode-dis.patch @@ -45,7 +45,7 @@ Signed-off-by: Jonathan Bell #define DWC3_GUCTL1_RESUME_OPMODE_HS_HOST BIT(10) /* Global Status Register */ -@@ -1121,10 +1122,12 @@ struct dwc3_scratchpad_array { +@@ -1122,10 +1123,12 @@ struct dwc3_scratchpad_array { * generation after resume from suspend. * @ulpi_ext_vbus_drv: Set to confiure the upli chip to drives CPEN pin * VBUS with an external supply. @@ -62,7 +62,7 @@ Signed-off-by: Jonathan Bell * @tx_de_emphasis_quirk: set if we enable Tx de-emphasis quirk * @tx_de_emphasis: Tx de-emphasis value * 0 - -6dB de-emphasis -@@ -1351,6 +1354,7 @@ struct dwc3 { +@@ -1352,6 +1355,7 @@ struct dwc3 { unsigned ulpi_ext_vbus_drv:1; unsigned parkmode_disable_ss_quirk:1; unsigned parkmode_disable_hs_quirk:1; diff --git a/target/linux/bcm27xx/patches-6.6/950-1218-Bluetooth-hci_sync-Fix-crash-on-NULL-parent.patch b/target/linux/bcm27xx/patches-6.6/950-1218-Bluetooth-hci_sync-Fix-crash-on-NULL-parent.patch index 223e2df2b7859b..6dfd31c70f8ea7 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1218-Bluetooth-hci_sync-Fix-crash-on-NULL-parent.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1218-Bluetooth-hci_sync-Fix-crash-on-NULL-parent.patch @@ -15,7 +15,7 @@ Signed-off-by: Phil Elwell --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c -@@ -4872,7 +4872,8 @@ static const struct { +@@ -4873,7 +4873,8 @@ static const struct { */ static int hci_dev_setup_sync(struct hci_dev *hdev) { diff --git a/target/linux/bcm27xx/patches-6.6/950-1359-usb-dwc3-core-add-support-for-setting-NAK-enhancemen.patch b/target/linux/bcm27xx/patches-6.6/950-1359-usb-dwc3-core-add-support-for-setting-NAK-enhancemen.patch index cb4f6deb39383a..8995f6f9dce053 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1359-usb-dwc3-core-add-support-for-setting-NAK-enhancemen.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1359-usb-dwc3-core-add-support-for-setting-NAK-enhancemen.patch @@ -57,7 +57,7 @@ Signed-off-by: Jonathan Bell #define DWC3_GUCTL1_PARKMODE_DISABLE_SS BIT(17) #define DWC3_GUCTL1_PARKMODE_DISABLE_HS BIT(16) #define DWC3_GUCTL1_PARKMODE_DISABLE_FSLS BIT(15) -@@ -1122,6 +1124,8 @@ struct dwc3_scratchpad_array { +@@ -1123,6 +1125,8 @@ struct dwc3_scratchpad_array { * generation after resume from suspend. * @ulpi_ext_vbus_drv: Set to confiure the upli chip to drives CPEN pin * VBUS with an external supply. @@ -66,7 +66,7 @@ Signed-off-by: Jonathan Bell * @parkmode_disable_ss_quirk: If set, disable park mode feature for all * Superspeed instances. * @parkmode_disable_hs_quirk: If set, disable park mode feature for all -@@ -1352,6 +1356,8 @@ struct dwc3 { +@@ -1353,6 +1357,8 @@ struct dwc3 { unsigned dis_tx_ipgap_linecheck_quirk:1; unsigned resume_hs_terminations:1; unsigned ulpi_ext_vbus_drv:1; diff --git a/target/linux/generic/hack-6.6/661-kernel-ct-size-the-hashtable-more-adequately.patch b/target/linux/generic/hack-6.6/661-kernel-ct-size-the-hashtable-more-adequately.patch index 020f3f3a11355d..ff959ec8d26472 100644 --- a/target/linux/generic/hack-6.6/661-kernel-ct-size-the-hashtable-more-adequately.patch +++ b/target/linux/generic/hack-6.6/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 -@@ -2682,7 +2682,7 @@ int nf_conntrack_init_start(void) +@@ -2685,7 +2685,7 @@ int nf_conntrack_init_start(void) if (!nf_conntrack_htable_size) { nf_conntrack_htable_size diff --git a/target/linux/generic/pending-6.6/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch b/target/linux/generic/pending-6.6/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch index 572aad2a3b3dde..6cb52d00a2dad9 100644 --- a/target/linux/generic/pending-6.6/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch +++ b/target/linux/generic/pending-6.6/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 -@@ -8421,7 +8421,7 @@ static int nft_register_flowtable_net_ho +@@ -8425,7 +8425,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/rockchip/patches-6.6/034-v6.7-usb-dwc3-add-optional-PHY-interface-clocks.patch b/target/linux/rockchip/patches-6.6/034-v6.7-usb-dwc3-add-optional-PHY-interface-clocks.patch index d38d260ef17d74..30e8a98fd7cdcf 100644 --- a/target/linux/rockchip/patches-6.6/034-v6.7-usb-dwc3-add-optional-PHY-interface-clocks.patch +++ b/target/linux/rockchip/patches-6.6/034-v6.7-usb-dwc3-add-optional-PHY-interface-clocks.patch @@ -71,7 +71,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h -@@ -1002,6 +1002,8 @@ struct dwc3_scratchpad_array { +@@ -1003,6 +1003,8 @@ struct dwc3_scratchpad_array { * @bus_clk: clock for accessing the registers * @ref_clk: reference clock * @susp_clk: clock used when the SS phy is in low power (S3) state @@ -80,7 +80,7 @@ Signed-off-by: Greg Kroah-Hartman * @reset: reset control * @regs: base address for our registers * @regs_size: address space size -@@ -1174,6 +1176,8 @@ struct dwc3 { +@@ -1175,6 +1177,8 @@ struct dwc3 { struct clk *bus_clk; struct clk *ref_clk; struct clk *susp_clk; diff --git a/target/linux/starfive/patches-6.6/0066-uart-8250-Add-dw-auto-flow-ctrl-support.patch b/target/linux/starfive/patches-6.6/0066-uart-8250-Add-dw-auto-flow-ctrl-support.patch index c88008a6042dd5..617d72f11fbc8a 100644 --- a/target/linux/starfive/patches-6.6/0066-uart-8250-Add-dw-auto-flow-ctrl-support.patch +++ b/target/linux/starfive/patches-6.6/0066-uart-8250-Add-dw-auto-flow-ctrl-support.patch @@ -25,7 +25,7 @@ Signed-off-by: Minda Chen + uart->probe = up->probe; if (uart->port.type != PORT_8250_CIR) { - if (serial8250_isa_config != NULL) + if (uart_console_registered(&uart->port)) --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c @@ -612,6 +612,9 @@ static int dw8250_probe(struct platform_ From f5fd378e849e20823ce663351977f6f6d0a7dbac Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Sat, 11 Jan 2025 14:46:05 +0000 Subject: [PATCH 393/877] mediatek: replace multiple fw_setenv calls by the bulk one This commit replaces multiple fw_setenv calls by the bulk one to reduce flash writes. Thanks @Linaro1985 for the idea. Signed-off-by: Mikhail Zhilkin Link: https://github.com/openwrt/openwrt/pull/17580 Signed-off-by: Hauke Mehrtens (cherry picked from commit a6b0abf4661e4dc1449494e46340f75c44df81de) --- .../filogic/base-files/lib/upgrade/platform.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) 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 2ad92b2f5600b7..11bfad2e7b1ac4 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -40,13 +40,15 @@ xiaomi_initial_setup() return 0 fi - 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 -s - <<-EOF + boot_wait on + uart_en 1 + flag_boot_rootfs 0 + flag_last_success 1 + flag_boot_success 1 + flag_try_sys1_failed 8 + flag_try_sys2_failed 8 + EOF local board=$(board_name) case "$board" in From 939550bfbfc8423873348f890d2507eb6732ffec Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Sat, 11 Jan 2025 14:55:17 +0000 Subject: [PATCH 394/877] mediatek: Xiaomi AX3000t: fix soft brick for the rd23 model This commit fixes Xiaomi AX3000t soft bricks. Issue affects at least rd23 model (Global version) users: Link: https://forum.openwrt.org/t/openwrt-support-for-xiaomi-ax3000t/180490/452 I also found that these nvram settings are wrong for the rd23 model and U-Boot erase them: ''' flag_try_sys1_failed 8 flag_try_sys2_failed 8 ''' As a result, platform.sh -> xiaomi_initial_setup() function sometimes ends early without applying settings for the rd23 model. RD03 model strategy: 1. Don't touch values those were set up by platform.sh -> xiaomi_initial_setup() function RD23 model strategy: 1. Apply correct nvram settings at every boot 2. Use bulk fw_setenv call I didn't find opened issue for AX3000t. Similar AX3200 issue: Link: https://github.com/openwrt/openwrt/issues/16347 So, other Xiaomi devices (e.g. Xiaomi WR30U) may also require fix. Fixes: 7dbcc1215a56cc1da68c81bf92d7efa174c5e051 ("mediatek: filogic: add support for Xiaomi AX3000T") Signed-off-by: Mikhail Zhilkin Link: https://github.com/openwrt/openwrt/pull/17580 Signed-off-by: Hauke Mehrtens (cherry picked from commit 42a253c7e8992e2274628b1770a0263ac433d0bc) --- .../filogic/base-files/etc/init.d/bootcount | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/target/linux/mediatek/filogic/base-files/etc/init.d/bootcount b/target/linux/mediatek/filogic/base-files/etc/init.d/bootcount index c52d004c639cd8..a0e7d40862930f 100755 --- a/target/linux/mediatek/filogic/base-files/etc/init.d/bootcount +++ b/target/linux/mediatek/filogic/base-files/etc/init.d/bootcount @@ -5,6 +5,24 @@ START=99 boot() { case $(board_name) in + xiaomi,mi-router-ax3000t) + . /lib/upgrade/common.sh + [ "$(rootfs_type)" = "tmpfs" ] && \ + logger "bootcount: initramfs mode detected, exit" && \ + return 0 + [ "$(fw_printenv -n flag_try_sys2_failed 2>&1)" = "8" ] && \ + logger "bootcount: rd03 model detected, exit" && \ + return 0 + fw_setenv -s - <<-EOF + flag_boot_rootfs 0 + flag_boot_success 1 + flag_last_success 0 + flag_ota_reboot 0 + flag_try_sys1_failed 0 + flag_try_sys2_failed 0 + EOF + logger "bootcount: rd23 model detected, nvram was updated" + ;; zyxel,ex5700-telenor) fw_setenv uboot_bootcount 0 ;; From ad98c322cc50e4b2819dc195cb195b0e3daf9d5a Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Tue, 21 Jan 2025 00:10:50 +0100 Subject: [PATCH 395/877] ath79: meraki-mr18: fix initramfs build Now, that initramfs images built for ZTE devices work, by moving LZMA_TEXT_START further up the available RAM - same fix works successfully for Meraki MR18 too. Apply it and reenable initramfs generation again. Fixes: 1d49310fdb5e ("ath79: add Cisco Meraki MR18") Signed-off-by: Lech Perczak Link: https://github.com/openwrt/openwrt/pull/17680 Signed-off-by: Robert Marko (cherry picked from commit 7423e67e1b8c7e4c9f527d1300dbeaab72b1f95f) --- target/linux/ath79/image/nand.mk | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/target/linux/ath79/image/nand.mk b/target/linux/ath79/image/nand.mk index e8494da15da7e3..68cb5431872f23 100644 --- a/target/linux/ath79/image/nand.mk +++ b/target/linux/ath79/image/nand.mk @@ -313,10 +313,9 @@ define Device/meraki_mr18 BLOCKSIZE := 128k PAGESIZE := 2048 LOADER_TYPE := bin + LZMA_TEXT_START := 0x82800000 KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | meraki-header MR18 -# Initramfs-build fails due to size issues -# KERNEL_INITRAMFS := $$(KERNEL) - KERNEL_INITRAMFS := + KERNEL_INITRAMFS := $$(KERNEL) IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata SUPPORTED_DEVICES += mr18 endef From 454dbafd9b34226c83b4c26d415531d235bdc0cf Mon Sep 17 00:00:00 2001 From: John Audia Date: Tue, 21 Jan 2025 15:07:46 -0500 Subject: [PATCH 396/877] kernel: bump 6.6 to 6.6.73 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.73 No patches needed a rebase. Build system: x86/64 Build-tested: bcm27xx/bcm2712, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Run-tested: bcm27xx/bcm2712, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/17687 Signed-off-by: Hauke Mehrtens (cherry picked from commit 761b244964f8d5da9fbd27a618565b4c38ae0cbc) --- include/kernel-6.6 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/kernel-6.6 b/include/kernel-6.6 index 8fa79f9ce1675b..aa0a345b293acc 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .72 -LINUX_KERNEL_HASH-6.6.72 = feb9e514930d5968daa0b8b5486d3295d1fb2b34accf876207641884d4baef39 +LINUX_VERSION-6.6 = .73 +LINUX_KERNEL_HASH-6.6.73 = d2028db190c201650898be8db1c705e9fe73ab44fc04290b4f7af63514122490 From 642b5b619967ebe91c8051f76b14e2c703703535 Mon Sep 17 00:00:00 2001 From: Danila Romanov Date: Mon, 20 Jan 2025 18:40:20 +0300 Subject: [PATCH 397/877] generic: mtk_eth_soc: reduce driver memory usage 1. Import pending patch to fix ramips/mt7621 64MB targets. 2. Do not enable CONFIG_PAGE_POOL_STATS by default. Signed-off-by: Danila Romanov Signed-off-by: Felix Fietkau (cherry picked from commit 15887235c1e3b732d4c8e14afac253d00a7bfb36) --- ...th_soc-reduce-rx-ring-size-for-older.patch | 104 ++++++++++++++++++ ..._eth_soc-do-not-enable-page-pool-sta.patch | 43 ++++++++ 2 files changed, 147 insertions(+) create mode 100644 target/linux/generic/pending-6.6/738-01-net-ethernet-mtk_eth_soc-reduce-rx-ring-size-for-older.patch create mode 100644 target/linux/generic/pending-6.6/738-02-net-ethernet-mtk_eth_soc-do-not-enable-page-pool-sta.patch diff --git a/target/linux/generic/pending-6.6/738-01-net-ethernet-mtk_eth_soc-reduce-rx-ring-size-for-older.patch b/target/linux/generic/pending-6.6/738-01-net-ethernet-mtk_eth_soc-reduce-rx-ring-size-for-older.patch new file mode 100644 index 00000000000000..b492f4d0c089b0 --- /dev/null +++ b/target/linux/generic/pending-6.6/738-01-net-ethernet-mtk_eth_soc-reduce-rx-ring-size-for-older.patch @@ -0,0 +1,104 @@ +From: Felix Fietkau +Subject: [PATCH net-next 3/4] net: ethernet: mtk_eth_soc: reduce rx ring size for older chipsets +Date: Tue, 15 Oct 2024 13:09:37 +0200 + +Commit c57e55819443 ("net: ethernet: mtk_eth_soc: handle dma buffer +size soc specific") resolved some tx timeout issues by bumping FQ and +tx ring sizes from 512 to 2048 entries (the value used in the MediaTek +SDK), however it also changed the rx ring size for all chipsets in the +same way. + +Based on a few tests, it seems that a symmetric rx/tx ring size of 2048 +really only makes sense on MT7988, which is capable of 10G ethernet links. + +Older chipsets are typically deployed in systems that are more memory +constrained and don't actually need the larger rings to handle received +packets. + +In order to reduce wasted memory set the ring size based on the SoC to +the following values: +- 2048 on MT7988 +- 1024 on MT7986 +- 512 (previous value) on everything else, except: +- 256 on RT5350 (the oldest supported chipset) + +Fixes: c57e55819443 ("net: ethernet: mtk_eth_soc: handle dma buffer size soc specific") +Signed-off-by: Felix Fietkau +--- + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -5381,7 +5381,7 @@ static const struct mtk_soc_data mt2701_ + .desc_size = sizeof(struct mtk_rx_dma), + .irq_done_mask = MTK_RX_DONE_INT, + .dma_l4_valid = RX_DMA_L4_VALID, +- .dma_size = MTK_DMA_SIZE(2K), ++ .dma_size = MTK_DMA_SIZE(512), + .dma_max_len = MTK_TX_DMA_BUF_LEN, + .dma_len_offset = 16, + }, +@@ -5409,7 +5409,7 @@ static const struct mtk_soc_data mt7621_ + .desc_size = sizeof(struct mtk_rx_dma), + .irq_done_mask = MTK_RX_DONE_INT, + .dma_l4_valid = RX_DMA_L4_VALID, +- .dma_size = MTK_DMA_SIZE(2K), ++ .dma_size = MTK_DMA_SIZE(512), + .dma_max_len = MTK_TX_DMA_BUF_LEN, + .dma_len_offset = 16, + }, +@@ -5439,7 +5439,7 @@ static const struct mtk_soc_data mt7622_ + .desc_size = sizeof(struct mtk_rx_dma), + .irq_done_mask = MTK_RX_DONE_INT, + .dma_l4_valid = RX_DMA_L4_VALID, +- .dma_size = MTK_DMA_SIZE(2K), ++ .dma_size = MTK_DMA_SIZE(512), + .dma_max_len = MTK_TX_DMA_BUF_LEN, + .dma_len_offset = 16, + }, +@@ -5468,7 +5468,7 @@ static const struct mtk_soc_data mt7623_ + .desc_size = sizeof(struct mtk_rx_dma), + .irq_done_mask = MTK_RX_DONE_INT, + .dma_l4_valid = RX_DMA_L4_VALID, +- .dma_size = MTK_DMA_SIZE(2K), ++ .dma_size = MTK_DMA_SIZE(512), + .dma_max_len = MTK_TX_DMA_BUF_LEN, + .dma_len_offset = 16, + }, +@@ -5494,7 +5494,7 @@ static const struct mtk_soc_data mt7629_ + .desc_size = sizeof(struct mtk_rx_dma), + .irq_done_mask = MTK_RX_DONE_INT, + .dma_l4_valid = RX_DMA_L4_VALID, +- .dma_size = MTK_DMA_SIZE(2K), ++ .dma_size = MTK_DMA_SIZE(512), + .dma_max_len = MTK_TX_DMA_BUF_LEN, + .dma_len_offset = 16, + }, +@@ -5526,7 +5526,7 @@ static const struct mtk_soc_data mt7981_ + .dma_l4_valid = RX_DMA_L4_VALID_V2, + .dma_max_len = MTK_TX_DMA_BUF_LEN, + .dma_len_offset = 16, +- .dma_size = MTK_DMA_SIZE(2K), ++ .dma_size = MTK_DMA_SIZE(512), + }, + }; + +@@ -5556,7 +5556,7 @@ static const struct mtk_soc_data mt7986_ + .dma_l4_valid = RX_DMA_L4_VALID_V2, + .dma_max_len = MTK_TX_DMA_BUF_LEN, + .dma_len_offset = 16, +- .dma_size = MTK_DMA_SIZE(2K), ++ .dma_size = MTK_DMA_SIZE(1K), + }, + }; + +@@ -5609,7 +5609,7 @@ static const struct mtk_soc_data rt5350_ + .dma_l4_valid = RX_DMA_L4_VALID_PDMA, + .dma_max_len = MTK_TX_DMA_BUF_LEN, + .dma_len_offset = 16, +- .dma_size = MTK_DMA_SIZE(2K), ++ .dma_size = MTK_DMA_SIZE(256), + }, + }; + diff --git a/target/linux/generic/pending-6.6/738-02-net-ethernet-mtk_eth_soc-do-not-enable-page-pool-sta.patch b/target/linux/generic/pending-6.6/738-02-net-ethernet-mtk_eth_soc-do-not-enable-page-pool-sta.patch new file mode 100644 index 00000000000000..ab374d93e480c7 --- /dev/null +++ b/target/linux/generic/pending-6.6/738-02-net-ethernet-mtk_eth_soc-do-not-enable-page-pool-sta.patch @@ -0,0 +1,43 @@ +From: Danila Romanov +Date: Wed, 22 Jan 2025 06:48:45 +0100 +Subject: [PATCH] net: ethernet: mtk_eth_soc: do not enable page pool stats by + default + +There is no reason for it to be enabled by default. +Align mtk_eth_soc driver to mt76 driver. + +This option incurs additional CPU cost in allocation and recycle paths +and additional memory cost to store the statistics. + +Signed-off-by: Danila Romanov +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/ethernet/mediatek/Kconfig ++++ b/drivers/net/ethernet/mediatek/Kconfig +@@ -18,7 +18,6 @@ config NET_MEDIATEK_SOC + select PHYLINK + select DIMLIB + select PAGE_POOL +- select PAGE_POOL_STATS + select PCS_MTK_LYNXI + select REGMAP_MMIO + help +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -4552,6 +4552,7 @@ static int mtk_get_sset_count(struct net + + static void mtk_ethtool_pp_stats(struct mtk_eth *eth, u64 *data) + { ++#ifdef CONFIG_PAGE_POOL_STATS + struct page_pool_stats stats = {}; + int i; + +@@ -4564,6 +4565,7 @@ static void mtk_ethtool_pp_stats(struct + page_pool_get_stats(ring->page_pool, &stats); + } + page_pool_ethtool_stats_get(data, &stats); ++#endif + } + + static void mtk_get_ethtool_stats(struct net_device *dev, From 419ef19dba74f5259d1579d4c5c57b4785de46f0 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 22 Jan 2025 12:11:56 +0100 Subject: [PATCH 398/877] kernel: backport improvement to page pool fragment handling from 6.7 Makes it easier to keep drivers like mt76 in sync with newer versions Signed-off-by: Felix Fietkau (cherry picked from commit 9508ca44eb577a13e795e0a6c5683689efc61475) (cherry picked from commit 478041997f068c87c6356108cf3dc3b667666dd5) --- ...nt-API-support-for-32-bit-arch-with-.patch | 139 +++++++++++++ ...frag_count-handling-in-page_pool_is_.patch | 183 ++++++++++++++++++ 2 files changed, 322 insertions(+) create mode 100644 target/linux/generic/backport-6.6/620-01-v6.7-page_pool-fragment-API-support-for-32-bit-arch-with-.patch create mode 100644 target/linux/generic/backport-6.6/620-02-v6.7-page_pool-unify-frag_count-handling-in-page_pool_is_.patch diff --git a/target/linux/generic/backport-6.6/620-01-v6.7-page_pool-fragment-API-support-for-32-bit-arch-with-.patch b/target/linux/generic/backport-6.6/620-01-v6.7-page_pool-fragment-API-support-for-32-bit-arch-with-.patch new file mode 100644 index 00000000000000..0f57e2ec663983 --- /dev/null +++ b/target/linux/generic/backport-6.6/620-01-v6.7-page_pool-fragment-API-support-for-32-bit-arch-with-.patch @@ -0,0 +1,139 @@ +From: Yunsheng Lin +Date: Fri, 13 Oct 2023 14:48:21 +0800 +Subject: [PATCH] page_pool: fragment API support for 32-bit arch with 64-bit + DMA + +Currently page_pool_alloc_frag() is not supported in 32-bit +arch with 64-bit DMA because of the overlap issue between +pp_frag_count and dma_addr_upper in 'struct page' for those +arches, which seems to be quite common, see [1], which means +driver may need to handle it when using fragment API. + +It is assumed that the combination of the above arch with an +address space >16TB does not exist, as all those arches have +64b equivalent, it seems logical to use the 64b version for a +system with a large address space. It is also assumed that dma +address is page aligned when we are dma mapping a page aligned +buffer, see [2]. + +That means we're storing 12 bits of 0 at the lower end for a +dma address, we can reuse those bits for the above arches to +support 32b+12b, which is 16TB of memory. + +If we make a wrong assumption, a warning is emitted so that +user can report to us. + +1. https://lore.kernel.org/all/20211117075652.58299-1-linyunsheng@huawei.com/ +2. https://lore.kernel.org/all/20230818145145.4b357c89@kernel.org/ + +Tested-by: Alexander Lobakin +Signed-off-by: Yunsheng Lin +CC: Lorenzo Bianconi +CC: Alexander Duyck +CC: Liang Chen +CC: Guillaume Tucker +CC: Matthew Wilcox +CC: Linux-MM +Link: https://lore.kernel.org/r/20231013064827.61135-2-linyunsheng@huawei.com +Signed-off-by: Jakub Kicinski +--- + +--- a/include/linux/mm_types.h ++++ b/include/linux/mm_types.h +@@ -125,18 +125,7 @@ struct page { + struct page_pool *pp; + unsigned long _pp_mapping_pad; + unsigned long dma_addr; +- union { +- /** +- * dma_addr_upper: might require a 64-bit +- * value on 32-bit architectures. +- */ +- unsigned long dma_addr_upper; +- /** +- * For frag page support, not supported in +- * 32-bit architectures with 64-bit DMA. +- */ +- atomic_long_t pp_frag_count; +- }; ++ atomic_long_t pp_frag_count; + }; + struct { /* Tail pages of compound page */ + unsigned long compound_head; /* Bit zero is set */ +--- a/include/net/page_pool/helpers.h ++++ b/include/net/page_pool/helpers.h +@@ -197,7 +197,7 @@ static inline void page_pool_recycle_dir + page_pool_put_full_page(pool, page, true); + } + +-#define PAGE_POOL_DMA_USE_PP_FRAG_COUNT \ ++#define PAGE_POOL_32BIT_ARCH_WITH_64BIT_DMA \ + (sizeof(dma_addr_t) > sizeof(unsigned long)) + + /** +@@ -211,17 +211,25 @@ static inline dma_addr_t page_pool_get_d + { + dma_addr_t ret = page->dma_addr; + +- if (PAGE_POOL_DMA_USE_PP_FRAG_COUNT) +- ret |= (dma_addr_t)page->dma_addr_upper << 16 << 16; ++ if (PAGE_POOL_32BIT_ARCH_WITH_64BIT_DMA) ++ ret <<= PAGE_SHIFT; + + return ret; + } + +-static inline void page_pool_set_dma_addr(struct page *page, dma_addr_t addr) ++static inline bool page_pool_set_dma_addr(struct page *page, dma_addr_t addr) + { ++ if (PAGE_POOL_32BIT_ARCH_WITH_64BIT_DMA) { ++ page->dma_addr = addr >> PAGE_SHIFT; ++ ++ /* We assume page alignment to shave off bottom bits, ++ * if this "compression" doesn't work we need to drop. ++ */ ++ return addr != (dma_addr_t)page->dma_addr << PAGE_SHIFT; ++ } ++ + page->dma_addr = addr; +- if (PAGE_POOL_DMA_USE_PP_FRAG_COUNT) +- page->dma_addr_upper = upper_32_bits(addr); ++ return false; + } + + static inline bool page_pool_put(struct page_pool *pool) +--- a/net/core/page_pool.c ++++ b/net/core/page_pool.c +@@ -211,10 +211,6 @@ static int page_pool_init(struct page_po + */ + } + +- if (PAGE_POOL_DMA_USE_PP_FRAG_COUNT && +- pool->p.flags & PP_FLAG_PAGE_FRAG) +- return -EINVAL; +- + #ifdef CONFIG_PAGE_POOL_STATS + pool->recycle_stats = alloc_percpu(struct page_pool_recycle_stats); + if (!pool->recycle_stats) +@@ -363,12 +359,20 @@ static bool page_pool_dma_map(struct pag + if (dma_mapping_error(pool->p.dev, dma)) + return false; + +- page_pool_set_dma_addr(page, dma); ++ if (page_pool_set_dma_addr(page, dma)) ++ goto unmap_failed; + + if (pool->p.flags & PP_FLAG_DMA_SYNC_DEV) + page_pool_dma_sync_for_device(pool, page, pool->p.max_len); + + return true; ++ ++unmap_failed: ++ WARN_ON_ONCE("unexpected DMA address, please report to netdev@"); ++ dma_unmap_page_attrs(pool->p.dev, dma, ++ PAGE_SIZE << pool->p.order, pool->p.dma_dir, ++ DMA_ATTR_SKIP_CPU_SYNC | DMA_ATTR_WEAK_ORDERING); ++ return false; + } + + static void page_pool_set_pp_info(struct page_pool *pool, diff --git a/target/linux/generic/backport-6.6/620-02-v6.7-page_pool-unify-frag_count-handling-in-page_pool_is_.patch b/target/linux/generic/backport-6.6/620-02-v6.7-page_pool-unify-frag_count-handling-in-page_pool_is_.patch new file mode 100644 index 00000000000000..1ad0eb449d7622 --- /dev/null +++ b/target/linux/generic/backport-6.6/620-02-v6.7-page_pool-unify-frag_count-handling-in-page_pool_is_.patch @@ -0,0 +1,183 @@ +From: Yunsheng Lin +Date: Fri, 20 Oct 2023 17:59:48 +0800 +Subject: [PATCH] page_pool: unify frag_count handling in + page_pool_is_last_frag() + +Currently when page_pool_create() is called with +PP_FLAG_PAGE_FRAG flag, page_pool_alloc_pages() is only +allowed to be called under the below constraints: +1. page_pool_fragment_page() need to be called to setup + page->pp_frag_count immediately. +2. page_pool_defrag_page() often need to be called to drain + the page->pp_frag_count when there is no more user will + be holding on to that page. + +Those constraints exist in order to support a page to be +split into multi fragments. + +And those constraints have some overhead because of the +cache line dirtying/bouncing and atomic update. + +Those constraints are unavoidable for case when we need a +page to be split into more than one fragment, but there is +also case that we want to avoid the above constraints and +their overhead when a page can't be split as it can only +hold a fragment as requested by user, depending on different +use cases: +use case 1: allocate page without page splitting. +use case 2: allocate page with page splitting. +use case 3: allocate page with or without page splitting + depending on the fragment size. + +Currently page pool only provide page_pool_alloc_pages() and +page_pool_alloc_frag() API to enable the 1 & 2 separately, +so we can not use a combination of 1 & 2 to enable 3, it is +not possible yet because of the per page_pool flag +PP_FLAG_PAGE_FRAG. + +So in order to allow allocating unsplit page without the +overhead of split page while still allow allocating split +page we need to remove the per page_pool flag in +page_pool_is_last_frag(), as best as I can think of, it seems +there are two methods as below: +1. Add per page flag/bit to indicate a page is split or + not, which means we might need to update that flag/bit + everytime the page is recycled, dirtying the cache line + of 'struct page' for use case 1. +2. Unify the page->pp_frag_count handling for both split and + unsplit page by assuming all pages in the page pool is split + into a big fragment initially. + +As page pool already supports use case 1 without dirtying the +cache line of 'struct page' whenever a page is recyclable, we +need to support the above use case 3 with minimal overhead, +especially not adding any noticeable overhead for use case 1, +and we are already doing an optimization by not updating +pp_frag_count in page_pool_defrag_page() for the last fragment +user, this patch chooses to unify the pp_frag_count handling +to support the above use case 3. + +There is no noticeable performance degradation and some +justification for unifying the frag_count handling with this +patch applied using a micro-benchmark testing in [1]. + +1. https://lore.kernel.org/all/bf2591f8-7b3c-4480-bb2c-31dc9da1d6ac@huawei.com/ + +Signed-off-by: Yunsheng Lin +CC: Lorenzo Bianconi +CC: Alexander Duyck +CC: Liang Chen +CC: Alexander Lobakin +Link: https://lore.kernel.org/r/20231020095952.11055-2-linyunsheng@huawei.com +Signed-off-by: Jakub Kicinski +--- + +--- a/include/net/page_pool/helpers.h ++++ b/include/net/page_pool/helpers.h +@@ -115,28 +115,49 @@ static inline long page_pool_defrag_page + long ret; + + /* If nr == pp_frag_count then we have cleared all remaining +- * references to the page. No need to actually overwrite it, instead +- * we can leave this to be overwritten by the calling function. ++ * references to the page: ++ * 1. 'n == 1': no need to actually overwrite it. ++ * 2. 'n != 1': overwrite it with one, which is the rare case ++ * for pp_frag_count draining. + * +- * The main advantage to doing this is that an atomic_read is +- * generally a much cheaper operation than an atomic update, +- * especially when dealing with a page that may be partitioned +- * into only 2 or 3 pieces. ++ * The main advantage to doing this is that not only we avoid a atomic ++ * update, as an atomic_read is generally a much cheaper operation than ++ * an atomic update, especially when dealing with a page that may be ++ * partitioned into only 2 or 3 pieces; but also unify the pp_frag_count ++ * handling by ensuring all pages have partitioned into only 1 piece ++ * initially, and only overwrite it when the page is partitioned into ++ * more than one piece. + */ +- if (atomic_long_read(&page->pp_frag_count) == nr) ++ if (atomic_long_read(&page->pp_frag_count) == nr) { ++ /* As we have ensured nr is always one for constant case using ++ * the BUILD_BUG_ON(), only need to handle the non-constant case ++ * here for pp_frag_count draining, which is a rare case. ++ */ ++ BUILD_BUG_ON(__builtin_constant_p(nr) && nr != 1); ++ if (!__builtin_constant_p(nr)) ++ atomic_long_set(&page->pp_frag_count, 1); ++ + return 0; ++ } + + ret = atomic_long_sub_return(nr, &page->pp_frag_count); + WARN_ON(ret < 0); ++ ++ /* We are the last user here too, reset pp_frag_count back to 1 to ++ * ensure all pages have been partitioned into 1 piece initially, ++ * this should be the rare case when the last two fragment users call ++ * page_pool_defrag_page() currently. ++ */ ++ if (unlikely(!ret)) ++ atomic_long_set(&page->pp_frag_count, 1); ++ + return ret; + } + +-static inline bool page_pool_is_last_frag(struct page_pool *pool, +- struct page *page) ++static inline bool page_pool_is_last_frag(struct page *page) + { +- /* If fragments aren't enabled or count is 0 we were the last user */ +- return !(pool->p.flags & PP_FLAG_PAGE_FRAG) || +- (page_pool_defrag_page(page, 1) == 0); ++ /* If page_pool_defrag_page() returns 0, we were the last user */ ++ return page_pool_defrag_page(page, 1) == 0; + } + + /** +@@ -161,7 +182,7 @@ static inline void page_pool_put_page(st + * allow registering MEM_TYPE_PAGE_POOL, but shield linker. + */ + #ifdef CONFIG_PAGE_POOL +- if (!page_pool_is_last_frag(pool, page)) ++ if (!page_pool_is_last_frag(page)) + return; + + page_pool_put_defragged_page(pool, page, dma_sync_size, allow_direct); +--- a/net/core/page_pool.c ++++ b/net/core/page_pool.c +@@ -380,6 +380,14 @@ static void page_pool_set_pp_info(struct + { + page->pp = pool; + page->pp_magic |= PP_SIGNATURE; ++ ++ /* Ensuring all pages have been split into one fragment initially: ++ * page_pool_set_pp_info() is only called once for every page when it ++ * is allocated from the page allocator and page_pool_fragment_page() ++ * is dirtying the same cache line as the page->pp_magic above, so ++ * the overhead is negligible. ++ */ ++ page_pool_fragment_page(page, 1); + if (pool->p.init_callback) + pool->p.init_callback(page, pool->p.init_arg); + } +@@ -676,7 +684,7 @@ void page_pool_put_page_bulk(struct page + struct page *page = virt_to_head_page(data[i]); + + /* It is not the last user for the page frag case */ +- if (!page_pool_is_last_frag(pool, page)) ++ if (!page_pool_is_last_frag(page)) + continue; + + page = __page_pool_put_page(pool, page, -1, false); +@@ -752,8 +760,7 @@ struct page *page_pool_alloc_frag(struct + unsigned int max_size = PAGE_SIZE << pool->p.order; + struct page *page = pool->frag_page; + +- if (WARN_ON(!(pool->p.flags & PP_FLAG_PAGE_FRAG) || +- size > max_size)) ++ if (WARN_ON(size > max_size)) + return NULL; + + size = ALIGN(size, dma_get_cache_alignment()); From eff00e2fb12721cb8fc0a61dd9f3732d7f594215 Mon Sep 17 00:00:00 2001 From: Mieczyslaw Nalewaj Date: Wed, 22 Jan 2025 17:05:30 +0100 Subject: [PATCH 399/877] generic: refresh hack patches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refresh hack patches with make target/linux/refresh. Fixes: 9508ca44eb57 ("kernel: backport improvement to page pool fragment handling from 6.7") Signed-off-by: Mieczyslaw Nalewaj Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit ee730a66e9c670ec2ee37ee2b207accd539e1d15) --- ...0-net-page_pool-try-to-free-deferred-skbs-while-waitin.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/generic/hack-6.6/610-net-page_pool-try-to-free-deferred-skbs-while-waitin.patch b/target/linux/generic/hack-6.6/610-net-page_pool-try-to-free-deferred-skbs-while-waitin.patch index 36c28b94f60e75..c1f595913100df 100644 --- a/target/linux/generic/hack-6.6/610-net-page_pool-try-to-free-deferred-skbs-while-waitin.patch +++ b/target/linux/generic/hack-6.6/610-net-page_pool-try-to-free-deferred-skbs-while-waitin.patch @@ -16,7 +16,7 @@ Signed-off-by: Felix Fietkau --- a/net/core/page_pool.c +++ b/net/core/page_pool.c -@@ -862,12 +862,23 @@ static void page_pool_release_retry(stru +@@ -873,12 +873,23 @@ static void page_pool_release_retry(stru { struct delayed_work *dwq = to_delayed_work(wq); struct page_pool *pool = container_of(dwq, typeof(*pool), release_dw); From a872a245a2559d5c12b0578cec8dcbf2bd9ae87b Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Fri, 17 Jan 2025 20:53:03 +0000 Subject: [PATCH 400/877] generic: net: phy: realtek: expose temperature sensors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Expose the temperature sensor built-into RTL822x 2.5G and 5G PHYs. Signed-off-by: Daniel Golle Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 3a189e38317e3390ba5b17523f55bd2fb1b72327) --- ...HWMON-support-for-standalone-version.patch | 64 +++++++++++++++++++ ...-use-genphy_soft_reset-for-2.5G-PHYs.patch | 14 ++-- ...altek-introduce-rtl822x_aldps_probe.patch} | 30 +++++---- ...ealtek-support-interrupt-of-RTL8221B.patch | 8 +-- 4 files changed, 92 insertions(+), 24 deletions(-) create mode 100644 target/linux/generic/backport-6.6/781-26-v6.14-net-phy-realtek-HWMON-support-for-standalone-version.patch rename target/linux/generic/pending-6.6/{720-04-net-phy-realtek-introduce-rtl822x_probe.patch => 720-04-net-phy-realtek-introduce-rtl822x_aldps_probe.patch} (85%) diff --git a/target/linux/generic/backport-6.6/781-26-v6.14-net-phy-realtek-HWMON-support-for-standalone-version.patch b/target/linux/generic/backport-6.6/781-26-v6.14-net-phy-realtek-HWMON-support-for-standalone-version.patch new file mode 100644 index 00000000000000..8b8c97c54f4d39 --- /dev/null +++ b/target/linux/generic/backport-6.6/781-26-v6.14-net-phy-realtek-HWMON-support-for-standalone-version.patch @@ -0,0 +1,64 @@ +From 64ff63aeefb03139ae27454bd4208244579ae88e Mon Sep 17 00:00:00 2001 +From: Aleksander Jan Bajkowski +Date: Fri, 17 Jan 2025 23:24:21 +0100 +Subject: [PATCH] net: phy: realtek: HWMON support for standalone versions of + RTL8221B and RTL8251 + +HWMON support has been added for the RTL8221/8251 PHYs integrated together +with the MAC inside the RTL8125/8126 chips. This patch extends temperature +reading support for standalone variants of the mentioned PHYs. + +I don't know whether the earlier revisions of the RTL8226 also have a +built-in temperature sensor, so they have been skipped for now. + +Tested on RTL8221B-VB-CG. + +Signed-off-by: Aleksander Jan Bajkowski +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/phy/realtek/realtek_main.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/net/phy/realtek/realtek_main.c ++++ b/drivers/net/phy/realtek/realtek_main.c +@@ -1474,6 +1474,7 @@ static struct phy_driver realtek_drvs[] + }, { + .match_phy_device = rtl8221b_vb_cg_c22_match_phy_device, + .name = "RTL8221B-VB-CG 2.5Gbps PHY (C22)", ++ .probe = rtl822x_probe, + .get_features = rtl822x_get_features, + .config_aneg = rtl822x_config_aneg, + .config_init = rtl822xb_config_init, +@@ -1486,6 +1487,7 @@ static struct phy_driver realtek_drvs[] + }, { + .match_phy_device = rtl8221b_vb_cg_c45_match_phy_device, + .name = "RTL8221B-VB-CG 2.5Gbps PHY (C45)", ++ .probe = rtl822x_probe, + .config_init = rtl822xb_config_init, + .get_rate_matching = rtl822xb_get_rate_matching, + .get_features = rtl822x_c45_get_features, +@@ -1496,6 +1498,7 @@ static struct phy_driver realtek_drvs[] + }, { + .match_phy_device = rtl8221b_vn_cg_c22_match_phy_device, + .name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)", ++ .probe = rtl822x_probe, + .get_features = rtl822x_get_features, + .config_aneg = rtl822x_config_aneg, + .config_init = rtl822xb_config_init, +@@ -1508,6 +1511,7 @@ static struct phy_driver realtek_drvs[] + }, { + .match_phy_device = rtl8221b_vn_cg_c45_match_phy_device, + .name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)", ++ .probe = rtl822x_probe, + .config_init = rtl822xb_config_init, + .get_rate_matching = rtl822xb_get_rate_matching, + .get_features = rtl822x_c45_get_features, +@@ -1518,6 +1522,7 @@ static struct phy_driver realtek_drvs[] + }, { + .match_phy_device = rtl8251b_c45_match_phy_device, + .name = "RTL8251B 5Gbps PHY", ++ .probe = rtl822x_probe, + .get_features = rtl822x_get_features, + .config_aneg = rtl822x_config_aneg, + .read_status = rtl822x_read_status, diff --git a/target/linux/generic/pending-6.6/720-01-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch b/target/linux/generic/pending-6.6/720-01-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch index 3f43412648f46a..24885e3681e135 100644 --- a/target/linux/generic/pending-6.6/720-01-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch +++ b/target/linux/generic/pending-6.6/720-01-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch @@ -52,30 +52,30 @@ Signed-off-by: Daniel Golle .match_phy_device = rtl8221b_vb_cg_c22_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C22)", + .soft_reset = genphy_soft_reset, + .probe = rtl822x_probe, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, - .config_init = rtl822xb_config_init, -@@ -1486,6 +1491,7 @@ static struct phy_driver realtek_drvs[] +@@ -1487,6 +1492,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c45_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C45)", + .soft_reset = genphy_soft_reset, + .probe = rtl822x_probe, .config_init = rtl822xb_config_init, .get_rate_matching = rtl822xb_get_rate_matching, - .get_features = rtl822x_c45_get_features, -@@ -1496,6 +1502,7 @@ static struct phy_driver realtek_drvs[] +@@ -1498,6 +1504,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c22_match_phy_device, .name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)", + .soft_reset = genphy_soft_reset, + .probe = rtl822x_probe, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, - .config_init = rtl822xb_config_init, -@@ -1508,6 +1515,7 @@ static struct phy_driver realtek_drvs[] +@@ -1511,6 +1518,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c45_match_phy_device, .name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)", + .soft_reset = genphy_soft_reset, + .probe = rtl822x_probe, .config_init = rtl822xb_config_init, .get_rate_matching = rtl822xb_get_rate_matching, - .get_features = rtl822x_c45_get_features, diff --git a/target/linux/generic/pending-6.6/720-04-net-phy-realtek-introduce-rtl822x_probe.patch b/target/linux/generic/pending-6.6/720-04-net-phy-realtek-introduce-rtl822x_aldps_probe.patch similarity index 85% rename from target/linux/generic/pending-6.6/720-04-net-phy-realtek-introduce-rtl822x_probe.patch rename to target/linux/generic/pending-6.6/720-04-net-phy-realtek-introduce-rtl822x_aldps_probe.patch index b73e6c6443c5e7..6610af12c35132 100644 --- a/target/linux/generic/pending-6.6/720-04-net-phy-realtek-introduce-rtl822x_probe.patch +++ b/target/linux/generic/pending-6.6/720-04-net-phy-realtek-introduce-rtl822x_aldps_probe.patch @@ -44,7 +44,7 @@ Signed-off-by: Daniel Golle + + phy_write_mmd(phydev, MDIO_MMD_VEND1, RTL8221B_PHYCR1, val); + -+ return 0; ++ return rtl822x_probe(phydev); +} + static int rtlgen_resume(struct phy_device *phydev) @@ -66,35 +66,39 @@ Signed-off-by: Daniel Golle .soft_reset = genphy_soft_reset, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, -@@ -1502,6 +1527,7 @@ static struct phy_driver realtek_drvs[] - }, { +@@ -1503,7 +1528,7 @@ static struct phy_driver realtek_drvs[] .match_phy_device = rtl8221b_vb_cg_c22_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C22)", -+ .probe = rtl822x_aldps_probe, .soft_reset = genphy_soft_reset, +- .probe = rtl822x_probe, ++ .probe = rtl822x_aldps_probe, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, -@@ -1515,6 +1541,7 @@ static struct phy_driver realtek_drvs[] - }, { + .config_init = rtl822xb_config_init, +@@ -1517,7 +1542,7 @@ static struct phy_driver realtek_drvs[] .match_phy_device = rtl8221b_vb_cg_c45_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C45)", -+ .probe = rtl822x_aldps_probe, .soft_reset = genphy_soft_reset, +- .probe = rtl822x_probe, ++ .probe = rtl822x_aldps_probe, .config_init = rtl822xb_config_init, .get_rate_matching = rtl822xb_get_rate_matching, -@@ -1526,6 +1553,7 @@ static struct phy_driver realtek_drvs[] - }, { + .get_features = rtl822x_c45_get_features, +@@ -1529,7 +1554,7 @@ static struct phy_driver realtek_drvs[] .match_phy_device = rtl8221b_vn_cg_c22_match_phy_device, .name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)", -+ .probe = rtl822x_aldps_probe, .soft_reset = genphy_soft_reset, +- .probe = rtl822x_probe, ++ .probe = rtl822x_aldps_probe, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, -@@ -1539,6 +1567,7 @@ static struct phy_driver realtek_drvs[] - }, { + .config_init = rtl822xb_config_init, +@@ -1543,7 +1568,7 @@ static struct phy_driver realtek_drvs[] .match_phy_device = rtl8221b_vn_cg_c45_match_phy_device, .name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)", -+ .probe = rtl822x_aldps_probe, .soft_reset = genphy_soft_reset, +- .probe = rtl822x_probe, ++ .probe = rtl822x_aldps_probe, .config_init = rtl822xb_config_init, .get_rate_matching = rtl822xb_get_rate_matching, + .get_features = rtl822x_c45_get_features, diff --git a/target/linux/generic/pending-6.6/720-06-net-phy-realtek-support-interrupt-of-RTL8221B.patch b/target/linux/generic/pending-6.6/720-06-net-phy-realtek-support-interrupt-of-RTL8221B.patch index c855a211e8ffd9..3e9b34b8a5e864 100644 --- a/target/linux/generic/pending-6.6/720-06-net-phy-realtek-support-interrupt-of-RTL8221B.patch +++ b/target/linux/generic/pending-6.6/720-06-net-phy-realtek-support-interrupt-of-RTL8221B.patch @@ -70,8 +70,8 @@ Signed-off-by: Jianhui Zhao .name = "RTL8221B-VB-CG 2.5Gbps PHY (C22)", + .config_intr = rtl8221b_config_intr, + .handle_interrupt = rtl8221b_handle_interrupt, - .probe = rtl822x_aldps_probe, .soft_reset = genphy_soft_reset, + .probe = rtl822x_aldps_probe, .get_features = rtl822x_get_features, @@ -1563,6 +1610,8 @@ static struct phy_driver realtek_drvs[] }, { @@ -79,8 +79,8 @@ Signed-off-by: Jianhui Zhao .name = "RTL8221B-VB-CG 2.5Gbps PHY (C45)", + .config_intr = rtl8221b_config_intr, + .handle_interrupt = rtl8221b_handle_interrupt, - .probe = rtl822x_aldps_probe, .soft_reset = genphy_soft_reset, + .probe = rtl822x_aldps_probe, .config_init = rtl822xb_config_init, @@ -1575,6 +1624,8 @@ static struct phy_driver realtek_drvs[] }, { @@ -88,8 +88,8 @@ Signed-off-by: Jianhui Zhao .name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)", + .config_intr = rtl8221b_config_intr, + .handle_interrupt = rtl8221b_handle_interrupt, - .probe = rtl822x_aldps_probe, .soft_reset = genphy_soft_reset, + .probe = rtl822x_aldps_probe, .get_features = rtl822x_get_features, @@ -1589,6 +1640,8 @@ static struct phy_driver realtek_drvs[] }, { @@ -97,6 +97,6 @@ Signed-off-by: Jianhui Zhao .name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)", + .config_intr = rtl8221b_config_intr, + .handle_interrupt = rtl8221b_handle_interrupt, - .probe = rtl822x_aldps_probe, .soft_reset = genphy_soft_reset, + .probe = rtl822x_aldps_probe, .config_init = rtl822xb_config_init, From 9d9e06a30ab9720dbd02209f910912ce14800a4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Wed, 22 Jan 2025 20:34:26 +0100 Subject: [PATCH 401/877] generic: fix version number on realtek phy patches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These patches have been accepted in linux v6.14 instead of v6.13. Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 12a07e934c013c87ea96ddda8ec18c9af0362c53) --- ...14-net-phy-realtek-clear-1000Base-T-lpa-if-link-is-down.patch} | 0 ...14-net-phy-realtek-clear-master_slave_state-if-link-is-.patch} | 0 ...> 781-22-v6.14-net-phy-realtek-always-clear-NBase-T-lpa.patch} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename target/linux/generic/backport-6.6/{781-20-v6.13-net-phy-realtek-clear-1000Base-T-lpa-if-link-is-down.patch => 781-20-v6.14-net-phy-realtek-clear-1000Base-T-lpa-if-link-is-down.patch} (100%) rename target/linux/generic/backport-6.6/{781-21-v6.13-net-phy-realtek-clear-master_slave_state-if-link-is-.patch => 781-21-v6.14-net-phy-realtek-clear-master_slave_state-if-link-is-.patch} (100%) rename target/linux/generic/backport-6.6/{781-22-v6.13-net-phy-realtek-always-clear-NBase-T-lpa.patch => 781-22-v6.14-net-phy-realtek-always-clear-NBase-T-lpa.patch} (100%) diff --git a/target/linux/generic/backport-6.6/781-20-v6.13-net-phy-realtek-clear-1000Base-T-lpa-if-link-is-down.patch b/target/linux/generic/backport-6.6/781-20-v6.14-net-phy-realtek-clear-1000Base-T-lpa-if-link-is-down.patch similarity index 100% rename from target/linux/generic/backport-6.6/781-20-v6.13-net-phy-realtek-clear-1000Base-T-lpa-if-link-is-down.patch rename to target/linux/generic/backport-6.6/781-20-v6.14-net-phy-realtek-clear-1000Base-T-lpa-if-link-is-down.patch diff --git a/target/linux/generic/backport-6.6/781-21-v6.13-net-phy-realtek-clear-master_slave_state-if-link-is-.patch b/target/linux/generic/backport-6.6/781-21-v6.14-net-phy-realtek-clear-master_slave_state-if-link-is-.patch similarity index 100% rename from target/linux/generic/backport-6.6/781-21-v6.13-net-phy-realtek-clear-master_slave_state-if-link-is-.patch rename to target/linux/generic/backport-6.6/781-21-v6.14-net-phy-realtek-clear-master_slave_state-if-link-is-.patch diff --git a/target/linux/generic/backport-6.6/781-22-v6.13-net-phy-realtek-always-clear-NBase-T-lpa.patch b/target/linux/generic/backport-6.6/781-22-v6.14-net-phy-realtek-always-clear-NBase-T-lpa.patch similarity index 100% rename from target/linux/generic/backport-6.6/781-22-v6.13-net-phy-realtek-always-clear-NBase-T-lpa.patch rename to target/linux/generic/backport-6.6/781-22-v6.14-net-phy-realtek-always-clear-NBase-T-lpa.patch From 58d0057481d4f0fbd2c9bc9707fca3cab50a4050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Wed, 22 Jan 2025 20:42:49 +0100 Subject: [PATCH 402/877] generic: backport pending gpio-regmap ops patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch has been accepted for linux v6.14 so we can move it from pending to backport. Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 2f2e21a52bdfdcf83868e3169768fda134aa883b) --- ...-regmap-Use-generic-request-free-ops.patch | 30 ++++ ...-regmap-Use-generic-request-free-ops.patch | 131 ------------------ 2 files changed, 30 insertions(+), 131 deletions(-) create mode 100644 target/linux/generic/backport-6.6/880-v6.14-gpio-regmap-Use-generic-request-free-ops.patch delete mode 100644 target/linux/generic/pending-6.6/821-gpio-regmap-Use-generic-request-free-ops.patch diff --git a/target/linux/generic/backport-6.6/880-v6.14-gpio-regmap-Use-generic-request-free-ops.patch b/target/linux/generic/backport-6.6/880-v6.14-gpio-regmap-Use-generic-request-free-ops.patch new file mode 100644 index 00000000000000..f9299f973370aa --- /dev/null +++ b/target/linux/generic/backport-6.6/880-v6.14-gpio-regmap-Use-generic-request-free-ops.patch @@ -0,0 +1,30 @@ +From b0fa00fe38f673c986633c11087274deeb7ce7b0 Mon Sep 17 00:00:00 2001 +From: Sander Vanheule +Date: Tue, 7 Jan 2025 21:16:20 +0100 +Subject: [PATCH] gpio: regmap: Use generic request/free ops + +Set the gpiochip request and free ops to the generic implementations. +This way a user can provide a gpio-ranges property defined for a pinmux, +easing muxing of gpio functions. Provided that the pin controller +implementents the pinmux op .gpio_request_enable(), pins will +automatically be muxed to their GPIO function when requested. + +Signed-off-by: Sander Vanheule +Acked-by: Michael Walle +Link: https://lore.kernel.org/r/20250107201621.12467-1-sander@svanheule.net +Signed-off-by: Bartosz Golaszewski +--- + drivers/gpio/gpio-regmap.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/gpio/gpio-regmap.c ++++ b/drivers/gpio/gpio-regmap.c +@@ -262,6 +262,8 @@ struct gpio_regmap *gpio_regmap_register + chip->label = config->label ?: dev_name(config->parent); + chip->can_sleep = regmap_might_sleep(config->regmap); + ++ chip->request = gpiochip_generic_request; ++ chip->free = gpiochip_generic_free; + chip->get = gpio_regmap_get; + if (gpio->reg_set_base && gpio->reg_clr_base) + chip->set = gpio_regmap_set_with_clear; diff --git a/target/linux/generic/pending-6.6/821-gpio-regmap-Use-generic-request-free-ops.patch b/target/linux/generic/pending-6.6/821-gpio-regmap-Use-generic-request-free-ops.patch deleted file mode 100644 index 344a5b1c5a7482..00000000000000 --- a/target/linux/generic/pending-6.6/821-gpio-regmap-Use-generic-request-free-ops.patch +++ /dev/null @@ -1,131 +0,0 @@ -From patchwork Tue Jan 7 20:16:20 2025 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 8bit -X-Patchwork-Submitter: Sander Vanheule -X-Patchwork-Id: 2031059 -Return-Path: - -X-Original-To: incoming@patchwork.ozlabs.org -Delivered-To: patchwork-incoming@legolas.ozlabs.org -Authentication-Results: legolas.ozlabs.org; - dkim=pass (2048-bit key; - secure) header.d=svanheule.net header.i=@svanheule.net header.a=rsa-sha256 - header.s=mail1707 header.b=YjCvLC2H; - dkim-atps=neutral -Authentication-Results: legolas.ozlabs.org; - spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org - (client-ip=2604:1380:4601:e00::3; helo=am.mirrors.kernel.org; - envelope-from=linux-gpio+bounces-14582-incoming=patchwork.ozlabs.org@vger.kernel.org; - receiver=patchwork.ozlabs.org) -Received: from am.mirrors.kernel.org (am.mirrors.kernel.org - [IPv6:2604:1380:4601:e00::3]) - (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) - key-exchange X25519 server-signature ECDSA (secp384r1)) - (No client certificate requested) - by legolas.ozlabs.org (Postfix) with ESMTPS id 4YSMxB3WwSz1yPG - for ; Wed, 8 Jan 2025 07:25:18 +1100 (AEDT) -Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) - (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) - (No client certificate requested) - by am.mirrors.kernel.org (Postfix) with ESMTPS id A7B811887AD1 - for ; Tue, 7 Jan 2025 20:25:19 +0000 (UTC) -Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) - by smtp.subspace.kernel.org (Postfix) with ESMTP id C09A21F63FE; - Tue, 7 Jan 2025 20:25:11 +0000 (UTC) -Authentication-Results: smtp.subspace.kernel.org; - dkim=pass (2048-bit key) header.d=svanheule.net header.i=@svanheule.net - header.b="YjCvLC2H" -X-Original-To: linux-gpio@vger.kernel.org -Received: from polaris.svanheule.net (polaris.svanheule.net [84.16.241.116]) - (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) - (No client certificate requested) - by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8DD631DF97A - for ; Tue, 7 Jan 2025 20:25:07 +0000 (UTC) -Authentication-Results: smtp.subspace.kernel.org; - arc=none smtp.client-ip=84.16.241.116 -ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; - t=1736281511; cv=none; - b=Xe/s+ul4S/+nhYxSMqUWJ/GXKP+J7uJo6tFw/w5bTXcmGxkbpCXTLOiTNXAhv8PMhTfsLYSQes6VF8dzDXaJxL4c8SlQsPNfGH/PqecmSvFMbZTz1XbjP9mBUCvX9lxCH8CSRavkuPuYdhss3a56TgaFzi9GifUSHCsHGs7+xk0= -ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; - s=arc-20240116; t=1736281511; c=relaxed/simple; - bh=31kjLyaoVOzIAs1m+zMi59Ia2jUwYW56Jp1YE6hLflg=; - h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; - b=q7miNkZBtMq3dcxL5HMjUpP3EFdQ7/xU/WnWIFVl6MK4rszqphqvaziMOK6avsn+UA5pAx2JJV8bDY8LfNhiVWwZtPfxbikjjZFm1HYlCDWmGudasM0b//K3/On625L4iqFWmVmLUdEdhvwIkJKSL4wTfN0OMz27EI272o5ygLg= -ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; - dmarc=pass (p=none dis=none) header.from=svanheule.net; - spf=pass smtp.mailfrom=svanheule.net; - dkim=pass (2048-bit key) header.d=svanheule.net header.i=@svanheule.net - header.b=YjCvLC2H; arc=none smtp.client-ip=84.16.241.116 -Authentication-Results: smtp.subspace.kernel.org; - dmarc=pass (p=none dis=none) header.from=svanheule.net -Authentication-Results: smtp.subspace.kernel.org; - spf=pass smtp.mailfrom=svanheule.net -Received: from terra.vega.svanheule.net (unknown [94.110.49.146]) - (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) - key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest - SHA256) - (No client certificate requested) - (Authenticated sender: sander@svanheule.net) - by polaris.svanheule.net (Postfix) with ESMTPSA id 1E18459A0D6; - Tue, 7 Jan 2025 21:17:02 +0100 (CET) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svanheule.net; - s=mail1707; t=1736281022; - h=from:from:reply-to:subject:subject:date:date:message-id:message-id: - to:to:cc:cc:mime-version:mime-version:content-type:content-type: - content-transfer-encoding:content-transfer-encoding; - bh=yNGIiTe7uonx3NZIc6+B7LVjvR8RnIV2zq++EO7NLhg=; - b=YjCvLC2HqArIGWGFkNYmh+oloGi7ZFo7WZGlTbxuHqrQVJ6mLNoLCTCkPkX1EJWEQyNysD - Jj+7tBnAYyCrJ0NuSTD9CPW1+KwKP4wlvWpBUlayCdUJyU4rzjqmlYAI5vJ1UX8FOnvEpn - KeWjgjbeMI6dvIE7ATPFkDvMrDxR9KSEe/1pfzY3E5jh1T8tcnTRMQKTll7hSUBN63dVfJ - U7wnHRLvwx8ESIjrHDKOlsSohmV6lyQTrgEeE2RCM6SpZPNoSpPVjTinF1kPuMHNWHV+Th - 6eDOblXxt859JECDowM0NjF87XJqjgph22+A1WUV4iaePO4GIWo9DQ3KhP/Pyg== -From: Sander Vanheule -To: Michael Walle , - Linus Walleij , - Bartosz Golaszewski , - linux-gpio@vger.kernel.org, - linux-kernel@vger.kernel.org -Cc: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= , - jonas.gorski@gmail.com, kylehendrydev@gmail.com, - florian.fainelli@broadcom.com, Sander Vanheule -Subject: [PATCH] gpio: regmap: Use generic request/free ops -Date: Tue, 7 Jan 2025 21:16:20 +0100 -Message-ID: <20250107201621.12467-1-sander@svanheule.net> -X-Mailer: git-send-email 2.47.1 -Precedence: bulk -X-Mailing-List: linux-gpio@vger.kernel.org -List-Id: -List-Subscribe: -List-Unsubscribe: -MIME-Version: 1.0 - -Set the gpiochip request and free ops to the generic implementations. -This way a user can provide a gpio-ranges property defined for a pinmux, -easing muxing of gpio functions. Provided that the pin controller -implementents the pinmux op .gpio_request_enable(), pins will -automatically be muxed to their GPIO function when requested. - -Signed-off-by: Sander Vanheule -Acked-by: Michael Walle ---- -Álvaro has submitted a similar patch today. My implementation's impact -is more limited, but I hadn't gotten around to submitting it yet. - -For the original (short) discussion, see: -https://lore.kernel.org/linux-gpio/20250107102735.317446-1-noltari@gmail.com/T/#t - - drivers/gpio/gpio-regmap.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/drivers/gpio/gpio-regmap.c -+++ b/drivers/gpio/gpio-regmap.c -@@ -262,6 +262,8 @@ struct gpio_regmap *gpio_regmap_register - chip->label = config->label ?: dev_name(config->parent); - chip->can_sleep = regmap_might_sleep(config->regmap); - -+ chip->request = gpiochip_generic_request; -+ chip->free = gpiochip_generic_free; - chip->get = gpio_regmap_get; - if (gpio->reg_set_base && gpio->reg_clr_base) - chip->set = gpio_regmap_set_with_clear; From 8c660861ef97b40395671b4c1bfde2c0867e18b9 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Wed, 22 Jan 2025 22:49:23 +0100 Subject: [PATCH 403/877] OpenWrt v24.10.0-rc6: 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 581de056c41e3e..c16689d75ed2df 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git;openwrt-24.10 -src-git luci https://git.openwrt.org/project/luci.git;openwrt-24.10 -src-git routing https://git.openwrt.org/feed/routing.git;openwrt-24.10 -src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-24.10 +src-git packages https://git.openwrt.org/feed/packages.git^212eb308f108b2460909b3cd25d68374913b266f +src-git luci https://git.openwrt.org/project/luci.git^36b610767adf7172f87e89e02edc1a91af1fcb45 +src-git routing https://git.openwrt.org/feed/routing.git^e87b55c6a642947ad7e24cd5054a637df63d5dbe +src-git telephony https://git.openwrt.org/feed/telephony.git^fd605af7143165a2490681ec1752f259873b9147 diff --git a/include/version.mk b/include/version.mk index a6ebe587797707..5fff60170118fd 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),24.10-SNAPSHOT) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),24.10.0-rc6) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION)) +VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r28388-58d0057481) VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO)) -VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/24.10-SNAPSHOT) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/24.10.0-rc6) 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 80db993d46b837..ae0517f2cc0465 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/24.10-SNAPSHOT" + default "https://downloads.openwrt.org/releases/24.10.0-rc6" 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..d98b48a5e3d534 --- /dev/null +++ b/version @@ -0,0 +1 @@ +r28388-58d0057481 diff --git a/version.date b/version.date new file mode 100644 index 00000000000000..5c263ddd8ab8de --- /dev/null +++ b/version.date @@ -0,0 +1 @@ +1737575574 From 18c47b0e968c4b2b102cd78b12b87615a35e8424 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Wed, 22 Jan 2025 22:49:28 +0100 Subject: [PATCH 404/877] OpenWrt v24.10.0-rc6: 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 c16689d75ed2df..581de056c41e3e 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git^212eb308f108b2460909b3cd25d68374913b266f -src-git luci https://git.openwrt.org/project/luci.git^36b610767adf7172f87e89e02edc1a91af1fcb45 -src-git routing https://git.openwrt.org/feed/routing.git^e87b55c6a642947ad7e24cd5054a637df63d5dbe -src-git telephony https://git.openwrt.org/feed/telephony.git^fd605af7143165a2490681ec1752f259873b9147 +src-git packages https://git.openwrt.org/feed/packages.git;openwrt-24.10 +src-git luci https://git.openwrt.org/project/luci.git;openwrt-24.10 +src-git routing https://git.openwrt.org/feed/routing.git;openwrt-24.10 +src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-24.10 diff --git a/include/version.mk b/include/version.mk index 5fff60170118fd..a6ebe587797707 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),24.10.0-rc6) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),24.10-SNAPSHOT) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r28388-58d0057481) +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/24.10.0-rc6) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/24.10-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 ae0517f2cc0465..80db993d46b837 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/24.10.0-rc6" + default "https://downloads.openwrt.org/releases/24.10-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 d98b48a5e3d534..00000000000000 --- a/version +++ /dev/null @@ -1 +0,0 @@ -r28388-58d0057481 diff --git a/version.date b/version.date deleted file mode 100644 index 5c263ddd8ab8de..00000000000000 --- a/version.date +++ /dev/null @@ -1 +0,0 @@ -1737575574 From 8290303ea42e75fe54d744aa3b6a7d1d6f960f09 Mon Sep 17 00:00:00 2001 From: Dim Fish Date: Fri, 11 Oct 2024 19:25:29 +0300 Subject: [PATCH 405/877] mediatek: add Airoha AN8855 gigabit switch driver New revisions of Xiaomi AX3000T with 1.0.84+ stock firmware contain new hardware. This commit add support for Airoha AN8855 gigabit switch driver with 6.6 kernel patches Based on https://patchwork.kernel.org/project/netdevbpf/cover/20241209134459.27110-1-ansuelsmth@gmail.com/ Signed-off-by: Dim Fish Link: https://github.com/openwrt/openwrt/pull/16709 Signed-off-by: Christian Marangi (cherry picked from commit 0fd9d00cd6fc285b2a925eb03e6350a4b00fc279) --- .../dts/mt7981b-xiaomi-mi-router-common.dtsi | 180 ++ .../files-6.6/drivers/mfd/airoha-an8855.c | 278 ++ .../files-6.6/drivers/net/dsa/an8855.c | 2311 +++++++++++++++++ .../files-6.6/drivers/net/dsa/an8855.h | 783 ++++++ .../files-6.6/drivers/net/mdio/mdio-an8855.c | 113 + .../files-6.6/drivers/net/phy/air_an8855.c | 267 ++ .../files-6.6/drivers/nvmem/an8855-efuse.c | 63 + .../include/linux/mfd/airoha-an8855-mfd.h | 41 + target/linux/mediatek/filogic/config-6.6 | 5 + target/linux/mediatek/mt7622/config-6.6 | 5 + target/linux/mediatek/mt7623/config-6.6 | 5 + target/linux/mediatek/mt7629/config-6.6 | 5 + .../737-net-dsa-add-Airoha-AN8855.patch | 309 +++ ...et-phylink-move-phylink_pcs_neg_mode.patch | 166 ++ ...-negotiation-of-in-band-capabilities.patch | 1233 +++++++++ 15 files changed, 5764 insertions(+) create mode 100644 target/linux/mediatek/files-6.6/drivers/mfd/airoha-an8855.c create mode 100644 target/linux/mediatek/files-6.6/drivers/net/dsa/an8855.c create mode 100644 target/linux/mediatek/files-6.6/drivers/net/dsa/an8855.h create mode 100644 target/linux/mediatek/files-6.6/drivers/net/mdio/mdio-an8855.c create mode 100644 target/linux/mediatek/files-6.6/drivers/net/phy/air_an8855.c create mode 100644 target/linux/mediatek/files-6.6/drivers/nvmem/an8855-efuse.c create mode 100644 target/linux/mediatek/files-6.6/include/linux/mfd/airoha-an8855-mfd.h create mode 100644 target/linux/mediatek/patches-6.6/737-net-dsa-add-Airoha-AN8855.patch create mode 100644 target/linux/mediatek/patches-6.6/738-net-phylink-move-phylink_pcs_neg_mode.patch create mode 100644 target/linux/mediatek/patches-6.6/739-net-add-negotiation-of-in-band-capabilities.patch diff --git a/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-common.dtsi b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-common.dtsi index d6872395a9017a..c64b55cf6fa4ee 100644 --- a/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-common.dtsi +++ b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-common.dtsi @@ -83,6 +83,11 @@ interrupt-parent = <&pio>; interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; }; + + mfd: mfd@1 { + compatible = "airoha,an8855-mfd"; + reg = <1>; + }; }; &switch { @@ -124,6 +129,181 @@ }; }; +&mfd { + efuse { + compatible = "airoha,an8855-efuse"; + #nvmem-cell-cells = <0>; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + shift_sel_port0_tx_a: shift-sel-port0-tx-a@c { + reg = <0xc 0x4>; + }; + + shift_sel_port0_tx_b: shift-sel-port0-tx-b@10 { + reg = <0x10 0x4>; + }; + + shift_sel_port0_tx_c: shift-sel-port0-tx-c@14 { + reg = <0x14 0x4>; + }; + + shift_sel_port0_tx_d: shift-sel-port0-tx-d@18 { + reg = <0x18 0x4>; + }; + + shift_sel_port1_tx_a: shift-sel-port1-tx-a@1c { + reg = <0x1c 0x4>; + }; + + shift_sel_port1_tx_b: shift-sel-port1-tx-b@20 { + reg = <0x20 0x4>; + }; + + shift_sel_port1_tx_c: shift-sel-port1-tx-c@24 { + reg = <0x24 0x4>; + }; + + shift_sel_port1_tx_d: shift-sel-port1-tx-d@28 { + reg = <0x28 0x4>; + }; + + shift_sel_port2_tx_a: shift-sel-port2-tx-a@2c { + reg = <0x2c 0x4>; + }; + + shift_sel_port2_tx_b: shift-sel-port2-tx-b@30 { + reg = <0x30 0x4>; + }; + + shift_sel_port2_tx_c: shift-sel-port2-tx-c@34 { + reg = <0x34 0x4>; + }; + + shift_sel_port2_tx_d: shift-sel-port2-tx-d@38 { + reg = <0x38 0x4>; + }; + + shift_sel_port3_tx_a: shift-sel-port3-tx-a@4c { + reg = <0x4c 0x4>; + }; + + shift_sel_port3_tx_b: shift-sel-port3-tx-b@50 { + reg = <0x50 0x4>; + }; + + shift_sel_port3_tx_c: shift-sel-port3-tx-c@54 { + reg = <0x54 0x4>; + }; + + shift_sel_port3_tx_d: shift-sel-port3-tx-d@58 { + reg = <0x58 0x4>; + }; + }; + }; + + ethernet-switch { + compatible = "airoha,an8855-switch"; + reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; + airoha,ext-surge; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "wan"; + phy-mode = "internal"; + phy-handle = <&internal_phy1>; + }; + + port@1 { + reg = <1>; + label = "lan2"; + phy-mode = "internal"; + phy-handle = <&internal_phy2>; + }; + + port@2 { + reg = <2>; + label = "lan3"; + phy-mode = "internal"; + phy-handle = <&internal_phy3>; + }; + + port@3 { + reg = <3>; + label = "lan4"; + phy-mode = "internal"; + phy-handle = <&internal_phy4>; + }; + + port@5 { + reg = <5>; + label = "cpu"; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; + }; + + mdio { + compatible = "airoha,an8855-mdio"; + #address-cells = <1>; + #size-cells = <0>; + + internal_phy1: phy@1 { + reg = <1>; + + nvmem-cells = <&shift_sel_port0_tx_a>, + <&shift_sel_port0_tx_b>, + <&shift_sel_port0_tx_c>, + <&shift_sel_port0_tx_d>; + nvmem-cell-names = "tx_a", "tx_b", "tx_c", "tx_d"; + }; + + internal_phy2: phy@2 { + reg = <2>; + + nvmem-cells = <&shift_sel_port1_tx_a>, + <&shift_sel_port1_tx_b>, + <&shift_sel_port1_tx_c>, + <&shift_sel_port1_tx_d>; + nvmem-cell-names = "tx_a", "tx_b", "tx_c", "tx_d"; + }; + + internal_phy3: phy@3 { + reg = <3>; + + nvmem-cells = <&shift_sel_port2_tx_a>, + <&shift_sel_port2_tx_b>, + <&shift_sel_port2_tx_c>, + <&shift_sel_port2_tx_d>; + nvmem-cell-names = "tx_a", "tx_b", "tx_c", "tx_d"; + }; + + internal_phy4: phy@4 { + reg = <4>; + + nvmem-cells = <&shift_sel_port3_tx_a>, + <&shift_sel_port3_tx_b>, + <&shift_sel_port3_tx_c>, + <&shift_sel_port3_tx_d>; + nvmem-cell-names = "tx_a", "tx_b", "tx_c", "tx_d"; + }; + }; +}; + &spi0 { pinctrl-names = "default"; pinctrl-0 = <&spi0_flash_pins>; diff --git a/target/linux/mediatek/files-6.6/drivers/mfd/airoha-an8855.c b/target/linux/mediatek/files-6.6/drivers/mfd/airoha-an8855.c new file mode 100644 index 00000000000000..eeaea348aa412c --- /dev/null +++ b/target/linux/mediatek/files-6.6/drivers/mfd/airoha-an8855.c @@ -0,0 +1,278 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * MFD driver for Airoha AN8855 Switch + */ + +#include +#include +#include +#include +#include +#include + +static const struct mfd_cell an8855_mfd_devs[] = { + { + .name = "an8855-efuse", + .of_compatible = "airoha,an8855-efuse", + }, { + .name = "an8855-switch", + .of_compatible = "airoha,an8855-switch", + }, { + .name = "an8855-mdio", + .of_compatible = "airoha,an8855-mdio", + } +}; + +int an8855_mii_set_page(struct an8855_mfd_priv *priv, u8 phy_id, + u8 page) __must_hold(&priv->bus->mdio_lock) +{ + struct mii_bus *bus = priv->bus; + int ret; + + ret = __mdiobus_write(bus, phy_id, AN8855_PHY_SELECT_PAGE, page); + if (ret < 0) + dev_err_ratelimited(&bus->dev, + "failed to set an8855 mii page\n"); + + /* Cache current page if next mii read/write is for switch */ + priv->current_page = page; + return ret < 0 ? ret : 0; +} +EXPORT_SYMBOL_GPL(an8855_mii_set_page); + +static int an8855_mii_read32(struct mii_bus *bus, u8 phy_id, u32 reg, + u32 *val) __must_hold(&bus->mdio_lock) +{ + int lo, hi, ret; + + ret = __mdiobus_write(bus, phy_id, AN8855_PBUS_MODE, + AN8855_PBUS_MODE_ADDR_FIXED); + if (ret < 0) + goto err; + + ret = __mdiobus_write(bus, phy_id, AN8855_PBUS_RD_ADDR_HIGH, + upper_16_bits(reg)); + if (ret < 0) + goto err; + ret = __mdiobus_write(bus, phy_id, AN8855_PBUS_RD_ADDR_LOW, + lower_16_bits(reg)); + if (ret < 0) + goto err; + + hi = __mdiobus_read(bus, phy_id, AN8855_PBUS_RD_DATA_HIGH); + if (hi < 0) { + ret = hi; + goto err; + } + lo = __mdiobus_read(bus, phy_id, AN8855_PBUS_RD_DATA_LOW); + if (lo < 0) { + ret = lo; + goto err; + } + + *val = ((u16)hi << 16) | ((u16)lo & 0xffff); + + return 0; +err: + dev_err_ratelimited(&bus->dev, + "failed to read an8855 register\n"); + return ret; +} + +static int an8855_regmap_read(void *ctx, uint32_t reg, uint32_t *val) +{ + struct an8855_mfd_priv *priv = ctx; + struct mii_bus *bus = priv->bus; + u16 addr = priv->switch_addr; + int ret; + + mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED); + ret = an8855_mii_set_page(priv, addr, AN8855_PHY_PAGE_EXTENDED_4); + if (ret < 0) + goto exit; + + ret = an8855_mii_read32(bus, addr, reg, val); + +exit: + mutex_unlock(&bus->mdio_lock); + + return ret < 0 ? ret : 0; +} + +static int an8855_mii_write32(struct mii_bus *bus, u8 phy_id, u32 reg, + u32 val) __must_hold(&bus->mdio_lock) +{ + int ret; + + ret = __mdiobus_write(bus, phy_id, AN8855_PBUS_MODE, + AN8855_PBUS_MODE_ADDR_FIXED); + if (ret < 0) + goto err; + + ret = __mdiobus_write(bus, phy_id, AN8855_PBUS_WR_ADDR_HIGH, + upper_16_bits(reg)); + if (ret < 0) + goto err; + ret = __mdiobus_write(bus, phy_id, AN8855_PBUS_WR_ADDR_LOW, + lower_16_bits(reg)); + if (ret < 0) + goto err; + + ret = __mdiobus_write(bus, phy_id, AN8855_PBUS_WR_DATA_HIGH, + upper_16_bits(val)); + if (ret < 0) + goto err; + ret = __mdiobus_write(bus, phy_id, AN8855_PBUS_WR_DATA_LOW, + lower_16_bits(val)); + if (ret < 0) + goto err; + + return 0; +err: + dev_err_ratelimited(&bus->dev, + "failed to write an8855 register\n"); + return ret; +} + +static int +an8855_regmap_write(void *ctx, uint32_t reg, uint32_t val) +{ + struct an8855_mfd_priv *priv = ctx; + struct mii_bus *bus = priv->bus; + u16 addr = priv->switch_addr; + int ret; + + mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED); + ret = an8855_mii_set_page(priv, addr, AN8855_PHY_PAGE_EXTENDED_4); + if (ret < 0) + goto exit; + + ret = an8855_mii_write32(bus, addr, reg, val); + +exit: + mutex_unlock(&bus->mdio_lock); + + return ret < 0 ? ret : 0; +} + +static int an8855_regmap_update_bits(void *ctx, uint32_t reg, uint32_t mask, + uint32_t write_val) +{ + struct an8855_mfd_priv *priv = ctx; + struct mii_bus *bus = priv->bus; + u16 addr = priv->switch_addr; + u32 val; + int ret; + + mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED); + ret = an8855_mii_set_page(priv, addr, AN8855_PHY_PAGE_EXTENDED_4); + if (ret < 0) + goto exit; + + ret = an8855_mii_read32(bus, addr, reg, &val); + if (ret < 0) + goto exit; + + val &= ~mask; + val |= write_val; + ret = an8855_mii_write32(bus, addr, reg, val); + +exit: + mutex_unlock(&bus->mdio_lock); + + return ret < 0 ? ret : 0; +} + +static const struct regmap_range an8855_readable_ranges[] = { + regmap_reg_range(0x10000000, 0x10000fff), /* SCU */ + regmap_reg_range(0x10001000, 0x10001fff), /* RBUS */ + regmap_reg_range(0x10002000, 0x10002fff), /* MCU */ + regmap_reg_range(0x10005000, 0x10005fff), /* SYS SCU */ + regmap_reg_range(0x10007000, 0x10007fff), /* I2C Slave */ + regmap_reg_range(0x10008000, 0x10008fff), /* I2C Master */ + regmap_reg_range(0x10009000, 0x10009fff), /* PDMA */ + regmap_reg_range(0x1000a100, 0x1000a2ff), /* General Purpose Timer */ + regmap_reg_range(0x1000a200, 0x1000a2ff), /* GPU timer */ + regmap_reg_range(0x1000a300, 0x1000a3ff), /* GPIO */ + regmap_reg_range(0x1000a400, 0x1000a5ff), /* EFUSE */ + regmap_reg_range(0x1000c000, 0x1000cfff), /* GDMP CSR */ + regmap_reg_range(0x10010000, 0x1001ffff), /* GDMP SRAM */ + regmap_reg_range(0x10200000, 0x10203fff), /* Switch - ARL Global */ + regmap_reg_range(0x10204000, 0x10207fff), /* Switch - BMU */ + regmap_reg_range(0x10208000, 0x1020bfff), /* Switch - ARL Port */ + regmap_reg_range(0x1020c000, 0x1020cfff), /* Switch - SCH */ + regmap_reg_range(0x10210000, 0x10213fff), /* Switch - MAC */ + regmap_reg_range(0x10214000, 0x10217fff), /* Switch - MIB */ + regmap_reg_range(0x10218000, 0x1021bfff), /* Switch - Port Control */ + regmap_reg_range(0x1021c000, 0x1021ffff), /* Switch - TOP */ + regmap_reg_range(0x10220000, 0x1022ffff), /* SerDes */ + regmap_reg_range(0x10286000, 0x10286fff), /* RG Batcher */ + regmap_reg_range(0x1028c000, 0x1028ffff), /* ETHER_SYS */ + regmap_reg_range(0x30000000, 0x37ffffff), /* I2C EEPROM */ + regmap_reg_range(0x38000000, 0x3fffffff), /* BOOT_ROM */ + regmap_reg_range(0xa0000000, 0xbfffffff), /* GPHY */ +}; + +static const struct regmap_access_table an8855_readable_table = { + .yes_ranges = an8855_readable_ranges, + .n_yes_ranges = ARRAY_SIZE(an8855_readable_ranges), +}; + +static const struct regmap_config an8855_regmap_config = { + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 4, + .max_register = 0xbfffffff, + .reg_read = an8855_regmap_read, + .reg_write = an8855_regmap_write, + .reg_update_bits = an8855_regmap_update_bits, + .disable_locking = true, + .rd_table = &an8855_readable_table, +}; + +static int an8855_mfd_probe(struct mdio_device *mdiodev) +{ + struct an8855_mfd_priv *priv; + struct regmap *regmap; + + priv = devm_kzalloc(&mdiodev->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + priv->bus = mdiodev->bus; + priv->dev = &mdiodev->dev; + priv->switch_addr = mdiodev->addr; + /* no DMA for mdiobus, mute warning for DMA mask not set */ + priv->dev->dma_mask = &priv->dev->coherent_dma_mask; + + regmap = devm_regmap_init(priv->dev, NULL, priv, + &an8855_regmap_config); + if (IS_ERR(regmap)) + dev_err_probe(priv->dev, PTR_ERR(priv->dev), + "regmap initialization failed\n"); + + dev_set_drvdata(&mdiodev->dev, priv); + + return devm_mfd_add_devices(priv->dev, PLATFORM_DEVID_AUTO, an8855_mfd_devs, + ARRAY_SIZE(an8855_mfd_devs), NULL, 0, + NULL); +} + +static const struct of_device_id an8855_mfd_of_match[] = { + { .compatible = "airoha,an8855-mfd" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, an8855_mfd_of_match); + +static struct mdio_driver an8855_mfd_driver = { + .probe = an8855_mfd_probe, + .mdiodrv.driver = { + .name = "an8855", + .of_match_table = an8855_mfd_of_match, + }, +}; +mdio_module_driver(an8855_mfd_driver); + +MODULE_AUTHOR("Christian Marangi "); +MODULE_DESCRIPTION("Driver for Airoha AN8855 MFD"); +MODULE_LICENSE("GPL"); diff --git a/target/linux/mediatek/files-6.6/drivers/net/dsa/an8855.c b/target/linux/mediatek/files-6.6/drivers/net/dsa/an8855.c new file mode 100644 index 00000000000000..7dd62e1a86f105 --- /dev/null +++ b/target/linux/mediatek/files-6.6/drivers/net/dsa/an8855.c @@ -0,0 +1,2311 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Airoha AN8855 DSA Switch driver + * Copyright (C) 2023 Min Yao + * Copyright (C) 2024 Christian Marangi + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "an8855.h" + +static const struct an8855_mib_desc an8855_mib[] = { + MIB_DESC(1, AN8855_PORT_MIB_TX_DROP, "TxDrop"), + MIB_DESC(1, AN8855_PORT_MIB_TX_CRC_ERR, "TxCrcErr"), + MIB_DESC(1, AN8855_PORT_MIB_TX_COLLISION, "TxCollision"), + MIB_DESC(1, AN8855_PORT_MIB_TX_OVERSIZE_DROP, "TxOversizeDrop"), + MIB_DESC(2, AN8855_PORT_MIB_TX_BAD_PKT_BYTES, "TxBadPktBytes"), + MIB_DESC(1, AN8855_PORT_MIB_RX_DROP, "RxDrop"), + MIB_DESC(1, AN8855_PORT_MIB_RX_FILTERING, "RxFiltering"), + MIB_DESC(1, AN8855_PORT_MIB_RX_CRC_ERR, "RxCrcErr"), + MIB_DESC(1, AN8855_PORT_MIB_RX_CTRL_DROP, "RxCtrlDrop"), + MIB_DESC(1, AN8855_PORT_MIB_RX_INGRESS_DROP, "RxIngressDrop"), + MIB_DESC(1, AN8855_PORT_MIB_RX_ARL_DROP, "RxArlDrop"), + MIB_DESC(1, AN8855_PORT_MIB_FLOW_CONTROL_DROP, "FlowControlDrop"), + MIB_DESC(1, AN8855_PORT_MIB_WRED_DROP, "WredDrop"), + MIB_DESC(1, AN8855_PORT_MIB_MIRROR_DROP, "MirrorDrop"), + MIB_DESC(2, AN8855_PORT_MIB_RX_BAD_PKT_BYTES, "RxBadPktBytes"), + MIB_DESC(1, AN8855_PORT_MIB_RXS_FLOW_SAMPLING_PKT_DROP, "RxsFlowSamplingPktDrop"), + MIB_DESC(1, AN8855_PORT_MIB_RXS_FLOW_TOTAL_PKT_DROP, "RxsFlowTotalPktDrop"), + MIB_DESC(1, AN8855_PORT_MIB_PORT_CONTROL_DROP, "PortControlDrop"), +}; + +static int +an8855_mib_init(struct an8855_priv *priv) +{ + int ret; + + ret = regmap_write(priv->regmap, AN8855_MIB_CCR, + AN8855_CCR_MIB_ENABLE); + if (ret) + return ret; + + return regmap_write(priv->regmap, AN8855_MIB_CCR, + AN8855_CCR_MIB_ACTIVATE); +} + +static void an8855_fdb_write(struct an8855_priv *priv, u16 vid, + u8 port_mask, const u8 *mac, + bool add) __must_hold(&priv->reg_mutex) +{ + u32 mac_reg[2] = { }; + u32 reg; + + mac_reg[0] |= FIELD_PREP(AN8855_ATA1_MAC0, mac[0]); + mac_reg[0] |= FIELD_PREP(AN8855_ATA1_MAC1, mac[1]); + mac_reg[0] |= FIELD_PREP(AN8855_ATA1_MAC2, mac[2]); + mac_reg[0] |= FIELD_PREP(AN8855_ATA1_MAC3, mac[3]); + mac_reg[1] |= FIELD_PREP(AN8855_ATA2_MAC4, mac[4]); + mac_reg[1] |= FIELD_PREP(AN8855_ATA2_MAC5, mac[5]); + + regmap_bulk_write(priv->regmap, AN8855_ATA1, mac_reg, + ARRAY_SIZE(mac_reg)); + + reg = AN8855_ATWD_IVL; + if (add) + reg |= AN8855_ATWD_VLD; + reg |= FIELD_PREP(AN8855_ATWD_VID, vid); + reg |= FIELD_PREP(AN8855_ATWD_FID, AN8855_FID_BRIDGED); + regmap_write(priv->regmap, AN8855_ATWD, reg); + regmap_write(priv->regmap, AN8855_ATWD2, + FIELD_PREP(AN8855_ATWD2_PORT, port_mask)); +} + +static void an8855_fdb_read(struct an8855_priv *priv, struct an8855_fdb *fdb) +{ + u32 reg[4]; + + regmap_bulk_read(priv->regmap, AN8855_ATRD0, reg, + ARRAY_SIZE(reg)); + + fdb->live = FIELD_GET(AN8855_ATRD0_LIVE, reg[0]); + fdb->type = FIELD_GET(AN8855_ATRD0_TYPE, reg[0]); + fdb->ivl = FIELD_GET(AN8855_ATRD0_IVL, reg[0]); + fdb->vid = FIELD_GET(AN8855_ATRD0_VID, reg[0]); + fdb->fid = FIELD_GET(AN8855_ATRD0_FID, reg[0]); + fdb->aging = FIELD_GET(AN8855_ATRD1_AGING, reg[1]); + fdb->port_mask = FIELD_GET(AN8855_ATRD3_PORTMASK, reg[3]); + fdb->mac[0] = FIELD_GET(AN8855_ATRD2_MAC0, reg[2]); + fdb->mac[1] = FIELD_GET(AN8855_ATRD2_MAC1, reg[2]); + fdb->mac[2] = FIELD_GET(AN8855_ATRD2_MAC2, reg[2]); + fdb->mac[3] = FIELD_GET(AN8855_ATRD2_MAC3, reg[2]); + fdb->mac[4] = FIELD_GET(AN8855_ATRD1_MAC4, reg[1]); + fdb->mac[5] = FIELD_GET(AN8855_ATRD1_MAC5, reg[1]); + fdb->noarp = !!FIELD_GET(AN8855_ATRD0_ARP, reg[0]); +} + +static int an8855_fdb_cmd(struct an8855_priv *priv, u32 cmd, + u32 *rsp) __must_hold(&priv->reg_mutex) +{ + u32 val; + int ret; + + /* Set the command operating upon the MAC address entries */ + val = AN8855_ATC_BUSY | cmd; + ret = regmap_write(priv->regmap, AN8855_ATC, val); + if (ret) + return ret; + + ret = regmap_read_poll_timeout(priv->regmap, AN8855_ATC, val, + !(val & AN8855_ATC_BUSY), 20, 200000); + if (ret) + return ret; + + if (rsp) + *rsp = val; + + return 0; +} + +static void +an8855_port_stp_state_set(struct dsa_switch *ds, int port, u8 state) +{ + struct dsa_port *dp = dsa_to_port(ds, port); + struct an8855_priv *priv = ds->priv; + bool learning = false; + u32 stp_state; + + switch (state) { + case BR_STATE_DISABLED: + stp_state = AN8855_STP_DISABLED; + break; + case BR_STATE_BLOCKING: + stp_state = AN8855_STP_BLOCKING; + break; + case BR_STATE_LISTENING: + stp_state = AN8855_STP_LISTENING; + break; + case BR_STATE_LEARNING: + stp_state = AN8855_STP_LEARNING; + learning = dp->learning; + break; + case BR_STATE_FORWARDING: + learning = dp->learning; + fallthrough; + default: + stp_state = AN8855_STP_FORWARDING; + break; + } + + regmap_update_bits(priv->regmap, AN8855_SSP_P(port), + AN8855_FID_PST_MASK(AN8855_FID_BRIDGED), + AN8855_FID_PST_VAL(AN8855_FID_BRIDGED, stp_state)); + + regmap_update_bits(priv->regmap, AN8855_PSC_P(port), AN8855_SA_DIS, + learning ? 0 : AN8855_SA_DIS); +} + +static void an8855_port_fast_age(struct dsa_switch *ds, int port) +{ + struct an8855_priv *priv = ds->priv; + int ret; + + /* Set to clean Dynamic entry */ + ret = regmap_write(priv->regmap, AN8855_ATA2, AN8855_ATA2_TYPE); + if (ret) + return; + + /* Set Port */ + ret = regmap_write(priv->regmap, AN8855_ATWD2, + FIELD_PREP(AN8855_ATWD2_PORT, BIT(port))); + if (ret) + return; + + /* Flush Dynamic entry at port */ + an8855_fdb_cmd(priv, AN8855_ATC_MAT(AND8855_FDB_MAT_MAC_TYPE_PORT) | + AN8855_FDB_FLUSH, NULL); +} + +static int an8855_update_port_member(struct dsa_switch *ds, int port, + const struct net_device *bridge_dev, + bool join) +{ + struct an8855_priv *priv = ds->priv; + bool isolated, other_isolated; + struct dsa_port *dp; + u32 port_mask = 0; + int ret; + + isolated = !!(priv->port_isolated_map & BIT(port)); + + dsa_switch_for_each_user_port(dp, ds) { + if (dp->index == port) + continue; + + if (!dsa_port_offloads_bridge_dev(dp, bridge_dev)) + continue; + + other_isolated = !!(priv->port_isolated_map & BIT(dp->index)); + port_mask |= BIT(dp->index); + /* Add/remove this port to the portvlan mask of the other + * ports in the bridge + */ + if (join && !(isolated && other_isolated)) + ret = regmap_set_bits(priv->regmap, + AN8855_PORTMATRIX_P(dp->index), + FIELD_PREP(AN8855_USER_PORTMATRIX, + BIT(port))); + else + ret = regmap_clear_bits(priv->regmap, + AN8855_PORTMATRIX_P(dp->index), + FIELD_PREP(AN8855_USER_PORTMATRIX, + BIT(port))); + if (ret) + return ret; + } + + /* Add/remove all other ports to this port's portvlan mask */ + return regmap_update_bits(priv->regmap, AN8855_PORTMATRIX_P(port), + AN8855_USER_PORTMATRIX, + join ? port_mask : ~port_mask); +} + +static int an8855_port_pre_bridge_flags(struct dsa_switch *ds, int port, + struct switchdev_brport_flags flags, + struct netlink_ext_ack *extack) +{ + if (flags.mask & ~(BR_LEARNING | BR_FLOOD | BR_MCAST_FLOOD | + BR_BCAST_FLOOD | BR_ISOLATED)) + return -EINVAL; + + return 0; +} + +static int an8855_port_bridge_flags(struct dsa_switch *ds, int port, + struct switchdev_brport_flags flags, + struct netlink_ext_ack *extack) +{ + struct an8855_priv *priv = ds->priv; + int ret; + + if (flags.mask & BR_LEARNING) { + ret = regmap_update_bits(priv->regmap, AN8855_PSC_P(port), AN8855_SA_DIS, + flags.val & BR_LEARNING ? 0 : AN8855_SA_DIS); + if (ret) + return ret; + } + + if (flags.mask & BR_FLOOD) { + ret = regmap_update_bits(priv->regmap, AN8855_UNUF, BIT(port), + flags.val & BR_FLOOD ? BIT(port) : 0); + if (ret) + return ret; + } + + if (flags.mask & BR_MCAST_FLOOD) { + ret = regmap_update_bits(priv->regmap, AN8855_UNMF, BIT(port), + flags.val & BR_MCAST_FLOOD ? BIT(port) : 0); + if (ret) + return ret; + + ret = regmap_update_bits(priv->regmap, AN8855_UNIPMF, BIT(port), + flags.val & BR_MCAST_FLOOD ? BIT(port) : 0); + if (ret) + return ret; + } + + if (flags.mask & BR_BCAST_FLOOD) { + ret = regmap_update_bits(priv->regmap, AN8855_BCF, BIT(port), + flags.val & BR_BCAST_FLOOD ? BIT(port) : 0); + if (ret) + return ret; + } + + if (flags.mask & BR_ISOLATED) { + struct dsa_port *dp = dsa_to_port(ds, port); + struct net_device *bridge_dev = dsa_port_bridge_dev_get(dp); + + if (flags.val & BR_ISOLATED) + priv->port_isolated_map |= BIT(port); + else + priv->port_isolated_map &= ~BIT(port); + + ret = an8855_update_port_member(ds, port, bridge_dev, true); + if (ret) + return ret; + } + + return 0; +} + +static int an8855_set_ageing_time(struct dsa_switch *ds, unsigned int msecs) +{ + struct an8855_priv *priv = ds->priv; + u32 age_count, age_unit, val; + + /* Convert msec in AN8855_L2_AGING_MS_CONSTANT counter */ + val = msecs / AN8855_L2_AGING_MS_CONSTANT; + /* Derive the count unit */ + age_unit = val / FIELD_MAX(AN8855_AGE_UNIT); + /* Get the count in unit, age_unit is always incremented by 1 internally */ + age_count = val / (age_unit + 1); + + return regmap_update_bits(priv->regmap, AN8855_AAC, + AN8855_AGE_CNT | AN8855_AGE_UNIT, + FIELD_PREP(AN8855_AGE_CNT, age_count) | + FIELD_PREP(AN8855_AGE_UNIT, age_unit)); +} + +static int an8855_port_bridge_join(struct dsa_switch *ds, int port, + struct dsa_bridge bridge, + bool *tx_fwd_offload, + struct netlink_ext_ack *extack) +{ + struct an8855_priv *priv = ds->priv; + int ret; + + ret = an8855_update_port_member(ds, port, bridge.dev, true); + if (ret) + return ret; + + /* Set to fallback mode for independent VLAN learning if in a bridge */ + return regmap_update_bits(priv->regmap, AN8855_PCR_P(port), + AN8855_PORT_VLAN, + FIELD_PREP(AN8855_PORT_VLAN, + AN8855_PORT_FALLBACK_MODE)); +} + +static void an8855_port_bridge_leave(struct dsa_switch *ds, int port, + struct dsa_bridge bridge) +{ + struct an8855_priv *priv = ds->priv; + + an8855_update_port_member(ds, port, bridge.dev, false); + + /* 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 + * port. + */ + regmap_update_bits(priv->regmap, AN8855_PCR_P(port), + AN8855_PORT_VLAN, + FIELD_PREP(AN8855_PORT_VLAN, + AN8855_PORT_MATRIX_MODE)); +} + +static int an8855_port_fdb_add(struct dsa_switch *ds, int port, + const unsigned char *addr, u16 vid, + struct dsa_db db) +{ + struct an8855_priv *priv = ds->priv; + u8 port_mask = BIT(port); + int ret; + + /* Set the vid to the port vlan id if no vid is set */ + if (!vid) + vid = AN8855_PORT_VID_DEFAULT; + + mutex_lock(&priv->reg_mutex); + an8855_fdb_write(priv, vid, port_mask, addr, true); + ret = an8855_fdb_cmd(priv, AN8855_FDB_WRITE, NULL); + mutex_unlock(&priv->reg_mutex); + + return ret; +} + +static int an8855_port_fdb_del(struct dsa_switch *ds, int port, + const unsigned char *addr, u16 vid, + struct dsa_db db) +{ + struct an8855_priv *priv = ds->priv; + u8 port_mask = BIT(port); + int ret; + + /* Set the vid to the port vlan id if no vid is set */ + if (!vid) + vid = AN8855_PORT_VID_DEFAULT; + + mutex_lock(&priv->reg_mutex); + an8855_fdb_write(priv, vid, port_mask, addr, false); + ret = an8855_fdb_cmd(priv, AN8855_FDB_WRITE, NULL); + mutex_unlock(&priv->reg_mutex); + + return ret; +} + +static int an8855_port_fdb_dump(struct dsa_switch *ds, int port, + dsa_fdb_dump_cb_t *cb, void *data) +{ + struct an8855_priv *priv = ds->priv; + int banks, count = 0; + u32 rsp; + int ret; + int i; + + mutex_lock(&priv->reg_mutex); + + /* Load search port */ + ret = regmap_write(priv->regmap, AN8855_ATWD2, + FIELD_PREP(AN8855_ATWD2_PORT, BIT(port))); + if (ret) + goto exit; + ret = an8855_fdb_cmd(priv, AN8855_ATC_MAT(AND8855_FDB_MAT_MAC_PORT) | + AN8855_FDB_START, &rsp); + if (ret < 0) + goto exit; + + do { + /* From response get the number of banks to read, exit if 0 */ + banks = FIELD_GET(AN8855_ATC_HIT, rsp); + if (!banks) + break; + + /* Each banks have 4 entry */ + for (i = 0; i < 4; i++) { + struct an8855_fdb _fdb = { }; + + count++; + + /* Check if bank is present */ + if (!(banks & BIT(i))) + continue; + + /* Select bank entry index */ + ret = regmap_write(priv->regmap, AN8855_ATRDS, + FIELD_PREP(AN8855_ATRD_SEL, i)); + if (ret) + break; + /* wait 1ms for the bank entry to be filled */ + usleep_range(1000, 1500); + an8855_fdb_read(priv, &_fdb); + + if (!_fdb.live) + continue; + ret = cb(_fdb.mac, _fdb.vid, _fdb.noarp, data); + if (ret < 0) + break; + } + + /* Stop if reached max FDB number */ + if (count >= AN8855_NUM_FDB_RECORDS) + break; + + /* Read next bank */ + ret = an8855_fdb_cmd(priv, AN8855_ATC_MAT(AND8855_FDB_MAT_MAC_PORT) | + AN8855_FDB_NEXT, &rsp); + if (ret < 0) + break; + } while (true); + +exit: + mutex_unlock(&priv->reg_mutex); + return ret; +} + +static int an8855_vlan_cmd(struct an8855_priv *priv, enum an8855_vlan_cmd cmd, + u16 vid) __must_hold(&priv->reg_mutex) +{ + u32 val; + int ret; + + val = AN8855_VTCR_BUSY | FIELD_PREP(AN8855_VTCR_FUNC, cmd) | + FIELD_PREP(AN8855_VTCR_VID, vid); + ret = regmap_write(priv->regmap, AN8855_VTCR, val); + if (ret) + return ret; + + return regmap_read_poll_timeout(priv->regmap, AN8855_VTCR, val, + !(val & AN8855_VTCR_BUSY), 20, 200000); +} + +static int an8855_vlan_add(struct an8855_priv *priv, u8 port, u16 vid, + bool untagged) __must_hold(&priv->reg_mutex) +{ + u32 port_mask; + u32 val; + int ret; + + /* Fetch entry */ + ret = an8855_vlan_cmd(priv, AN8855_VTCR_RD_VID, vid); + if (ret) + return ret; + + ret = regmap_read(priv->regmap, AN8855_VARD0, &val); + if (ret) + return ret; + port_mask = FIELD_GET(AN8855_VA0_PORT, val) | BIT(port); + + /* Validate the entry with independent learning, create egress tag per + * VLAN and joining the port as one of the port members. + */ + val = (val & AN8855_VA0_ETAG) | AN8855_VA0_IVL_MAC | + AN8855_VA0_VTAG_EN | AN8855_VA0_VLAN_VALID | + FIELD_PREP(AN8855_VA0_PORT, port_mask) | + FIELD_PREP(AN8855_VA0_FID, AN8855_FID_BRIDGED); + ret = regmap_write(priv->regmap, AN8855_VAWD0, val); + if (ret) + return ret; + ret = regmap_write(priv->regmap, AN8855_VAWD1, 0); + if (ret) + return ret; + + /* CPU port is always taken as a tagged port for serving more than one + * VLANs across and also being applied with egress type stack mode for + * that VLAN tags would be appended after hardware special tag used as + * DSA tag. + */ + if (port == AN8855_CPU_PORT) + val = AN8855_VLAN_EGRESS_STACK; + /* Decide whether adding tag or not for those outgoing packets from the + * port inside the VLAN. + */ + else + val = untagged ? AN8855_VLAN_EGRESS_UNTAG : AN8855_VLAN_EGRESS_TAG; + ret = regmap_update_bits(priv->regmap, AN8855_VAWD0, + AN8855_VA0_ETAG_PORT_MASK(port), + AN8855_VA0_ETAG_PORT_VAL(port, val)); + if (ret) + return ret; + + /* Flush result to hardware */ + return an8855_vlan_cmd(priv, AN8855_VTCR_WR_VID, vid); +} + +static int an8855_vlan_del(struct an8855_priv *priv, u8 port, + u16 vid) __must_hold(&priv->reg_mutex) +{ + u32 port_mask; + u32 val; + int ret; + + /* Fetch entry */ + ret = an8855_vlan_cmd(priv, AN8855_VTCR_RD_VID, vid); + if (ret) + return ret; + + ret = regmap_read(priv->regmap, AN8855_VARD0, &val); + if (ret) + return ret; + port_mask = FIELD_GET(AN8855_VA0_PORT, val) & ~BIT(port); + + if (!(val & AN8855_VA0_VLAN_VALID)) { + dev_err(priv->dev, "Cannot be deleted due to invalid entry\n"); + return -EINVAL; + } + + if (port_mask) { + val = (val & AN8855_VA0_ETAG) | AN8855_VA0_IVL_MAC | + AN8855_VA0_VTAG_EN | AN8855_VA0_VLAN_VALID | + FIELD_PREP(AN8855_VA0_PORT, port_mask); + ret = regmap_write(priv->regmap, AN8855_VAWD0, val); + if (ret) + return ret; + } else { + ret = regmap_write(priv->regmap, AN8855_VAWD0, 0); + if (ret) + return ret; + } + ret = regmap_write(priv->regmap, AN8855_VAWD1, 0); + if (ret) + return ret; + + /* Flush result to hardware */ + return an8855_vlan_cmd(priv, AN8855_VTCR_WR_VID, vid); +} + +static int an8855_port_set_vlan_mode(struct an8855_priv *priv, int port, + enum an8855_port_mode port_mode, + enum an8855_vlan_port_eg_tag eg_tag, + enum an8855_vlan_port_attr vlan_attr, + enum an8855_vlan_port_acc_frm acc_frm) +{ + int ret; + + ret = regmap_update_bits(priv->regmap, AN8855_PCR_P(port), + AN8855_PORT_VLAN, + FIELD_PREP(AN8855_PORT_VLAN, port_mode)); + if (ret) + return ret; + + return regmap_update_bits(priv->regmap, AN8855_PVC_P(port), + AN8855_PVC_EG_TAG | AN8855_VLAN_ATTR | AN8855_ACC_FRM, + FIELD_PREP(AN8855_PVC_EG_TAG, eg_tag) | + FIELD_PREP(AN8855_VLAN_ATTR, vlan_attr) | + FIELD_PREP(AN8855_ACC_FRM, acc_frm)); +} + +static int an8855_port_set_pid(struct an8855_priv *priv, int port, + u16 pid) +{ + int ret; + + ret = regmap_update_bits(priv->regmap, AN8855_PPBV1_P(port), + AN8855_PPBV_G0_PORT_VID, + FIELD_PREP(AN8855_PPBV_G0_PORT_VID, pid)); + if (ret) + return ret; + + return regmap_update_bits(priv->regmap, AN8855_PVID_P(port), + AN8855_G0_PORT_VID, + FIELD_PREP(AN8855_G0_PORT_VID, pid)); +} + +static int an8855_port_vlan_filtering(struct dsa_switch *ds, int port, + bool vlan_filtering, + struct netlink_ext_ack *extack) +{ + struct an8855_priv *priv = ds->priv; + u32 val; + int ret; + + /* The port is being kept as VLAN-unaware port when bridge is + * set up with vlan_filtering not being set, Otherwise, the + * port and the corresponding CPU port is required the setup + * for becoming a VLAN-aware port. + */ + if (vlan_filtering) { + u32 acc_frm; + /* CPU port is set to fallback mode to let untagged + * frames pass through. + */ + ret = an8855_port_set_vlan_mode(priv, AN8855_CPU_PORT, + AN8855_PORT_FALLBACK_MODE, + AN8855_VLAN_EG_CONSISTENT, + AN8855_VLAN_USER, + AN8855_VLAN_ACC_ALL); + if (ret) + return ret; + + ret = regmap_read(priv->regmap, AN8855_PVID_P(port), &val); + if (ret) + return ret; + + /* Only accept tagged frames if PVID is not set */ + if (FIELD_GET(AN8855_G0_PORT_VID, val) != AN8855_PORT_VID_DEFAULT) + acc_frm = AN8855_VLAN_ACC_TAGGED; + else + acc_frm = AN8855_VLAN_ACC_ALL; + + /* Trapped into security mode allows packet forwarding through VLAN + * table lookup. + * Set the port as a user port which is to be able to recognize VID + * from incoming packets before fetching entry within the VLAN table. + */ + ret = an8855_port_set_vlan_mode(priv, port, + AN8855_PORT_SECURITY_MODE, + AN8855_VLAN_EG_DISABLED, + AN8855_VLAN_USER, + acc_frm); + if (ret) + return ret; + } else { + bool disable_cpu_vlan = true; + struct dsa_port *dp; + u32 port_mode; + + /* This is called after .port_bridge_leave when leaving a VLAN-aware + * bridge. Don't set standalone ports to fallback mode. + */ + if (dsa_port_bridge_dev_get(dsa_to_port(ds, port))) + port_mode = AN8855_PORT_FALLBACK_MODE; + else + port_mode = AN8855_PORT_MATRIX_MODE; + + /* 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 + * port. + */ + ret = an8855_port_set_vlan_mode(priv, port, port_mode, + AN8855_VLAN_EG_CONSISTENT, + AN8855_VLAN_TRANSPARENT, + AN8855_VLAN_ACC_ALL); + if (ret) + return ret; + + /* Restore default PVID */ + ret = an8855_port_set_pid(priv, port, AN8855_PORT_VID_DEFAULT); + if (ret) + return ret; + + dsa_switch_for_each_user_port(dp, ds) { + if (dsa_port_is_vlan_filtering(dp)) { + disable_cpu_vlan = false; + break; + } + } + + if (disable_cpu_vlan) { + ret = an8855_port_set_vlan_mode(priv, AN8855_CPU_PORT, + AN8855_PORT_MATRIX_MODE, + AN8855_VLAN_EG_CONSISTENT, + AN8855_VLAN_USER, + AN8855_VLAN_ACC_ALL); + if (ret) + return ret; + } + } + + return 0; +} + +static int an8855_port_vlan_add(struct dsa_switch *ds, int port, + const struct switchdev_obj_port_vlan *vlan, + struct netlink_ext_ack *extack) +{ + bool untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED; + bool pvid = vlan->flags & BRIDGE_VLAN_INFO_PVID; + struct an8855_priv *priv = ds->priv; + u32 val; + int ret; + + mutex_lock(&priv->reg_mutex); + ret = an8855_vlan_add(priv, port, vlan->vid, untagged); + mutex_unlock(&priv->reg_mutex); + if (ret) + return ret; + + if (pvid) { + /* Accept all frames if PVID is set */ + regmap_update_bits(priv->regmap, AN8855_PVC_P(port), AN8855_ACC_FRM, + FIELD_PREP(AN8855_ACC_FRM, AN8855_VLAN_ACC_ALL)); + + /* Only configure PVID if VLAN filtering is enabled */ + if (dsa_port_is_vlan_filtering(dsa_to_port(ds, port))) { + ret = an8855_port_set_pid(priv, port, vlan->vid); + if (ret) + return ret; + } + } else if (vlan->vid) { + ret = regmap_read(priv->regmap, AN8855_PVID_P(port), &val); + if (ret) + return ret; + + if (FIELD_GET(AN8855_G0_PORT_VID, val) != vlan->vid) + return 0; + + /* This VLAN is overwritten without PVID, so unset it */ + if (dsa_port_is_vlan_filtering(dsa_to_port(ds, port))) { + ret = regmap_update_bits(priv->regmap, AN8855_PVC_P(port), + AN8855_ACC_FRM, + FIELD_PREP(AN8855_ACC_FRM, + AN8855_VLAN_ACC_TAGGED)); + if (ret) + return ret; + } + + ret = an8855_port_set_pid(priv, port, AN8855_PORT_VID_DEFAULT); + if (ret) + return ret; + } + + return 0; +} + +static int an8855_port_vlan_del(struct dsa_switch *ds, int port, + const struct switchdev_obj_port_vlan *vlan) +{ + struct an8855_priv *priv = ds->priv; + u32 val; + int ret; + + mutex_lock(&priv->reg_mutex); + ret = an8855_vlan_del(priv, port, vlan->vid); + mutex_unlock(&priv->reg_mutex); + if (ret) + return ret; + + ret = regmap_read(priv->regmap, AN8855_PVID_P(port), &val); + if (ret) + return ret; + + /* PVID is being restored to the default whenever the PVID port + * is being removed from the VLAN. + */ + if (FIELD_GET(AN8855_G0_PORT_VID, val) == vlan->vid) { + /* Only accept tagged frames if the port is VLAN-aware */ + if (dsa_port_is_vlan_filtering(dsa_to_port(ds, port))) { + ret = regmap_update_bits(priv->regmap, AN8855_PVC_P(port), + AN8855_ACC_FRM, + FIELD_PREP(AN8855_ACC_FRM, + AN8855_VLAN_ACC_TAGGED)); + if (ret) + return ret; + } + + ret = an8855_port_set_pid(priv, port, AN8855_PORT_VID_DEFAULT); + if (ret) + return ret; + } + + return 0; +} + +static int +an8855_port_mdb_add(struct dsa_switch *ds, int port, + const struct switchdev_obj_port_mdb *mdb, + struct dsa_db db) +{ + struct an8855_priv *priv = ds->priv; + const u8 *addr = mdb->addr; + u16 vid = mdb->vid; + u8 port_mask = 0; + u32 val; + int ret; + + /* Set the vid to the port vlan id if no vid is set */ + if (!vid) + vid = AN8855_PORT_VID_DEFAULT; + + mutex_lock(&priv->reg_mutex); + + an8855_fdb_write(priv, vid, 0, addr, false); + if (!an8855_fdb_cmd(priv, AN8855_FDB_READ, NULL)) { + ret = regmap_read(priv->regmap, AN8855_ATRD3, &val); + if (ret) + goto exit; + + port_mask = FIELD_GET(AN8855_ATRD3_PORTMASK, val); + } + + port_mask |= BIT(port); + an8855_fdb_write(priv, vid, port_mask, addr, true); + ret = an8855_fdb_cmd(priv, AN8855_FDB_WRITE, NULL); + +exit: + mutex_unlock(&priv->reg_mutex); + + return ret; +} + +static int +an8855_port_mdb_del(struct dsa_switch *ds, int port, + const struct switchdev_obj_port_mdb *mdb, + struct dsa_db db) +{ + struct an8855_priv *priv = ds->priv; + const u8 *addr = mdb->addr; + u16 vid = mdb->vid; + u8 port_mask = 0; + u32 val; + int ret; + + /* Set the vid to the port vlan id if no vid is set */ + if (!vid) + vid = AN8855_PORT_VID_DEFAULT; + + mutex_lock(&priv->reg_mutex); + + an8855_fdb_write(priv, vid, 0, addr, 0); + if (!an8855_fdb_cmd(priv, AN8855_FDB_READ, NULL)) { + ret = regmap_read(priv->regmap, AN8855_ATRD3, &val); + if (ret) + goto exit; + + port_mask = FIELD_GET(AN8855_ATRD3_PORTMASK, val); + } + + port_mask &= ~BIT(port); + an8855_fdb_write(priv, vid, port_mask, addr, port_mask ? true : false); + ret = an8855_fdb_cmd(priv, AN8855_FDB_WRITE, NULL); + +exit: + mutex_unlock(&priv->reg_mutex); + + return ret; +} + +static int +an8855_port_change_mtu(struct dsa_switch *ds, int port, int new_mtu) +{ + struct an8855_priv *priv = ds->priv; + int length; + u32 val; + + /* When a new MTU is set, DSA always set the CPU port's MTU to the + * largest MTU of the slave ports. Because the switch only has a global + * RX length register, only allowing CPU port here is enough. + */ + if (!dsa_is_cpu_port(ds, port)) + return 0; + + /* RX length also includes Ethernet header, MTK tag, and FCS length */ + length = new_mtu + ETH_HLEN + MTK_TAG_LEN + ETH_FCS_LEN; + if (length <= 1522) + val = AN8855_MAX_RX_PKT_1518_1522; + else if (length <= 1536) + val = AN8855_MAX_RX_PKT_1536; + else if (length <= 1552) + val = AN8855_MAX_RX_PKT_1552; + else if (length <= 3072) + val = AN8855_MAX_RX_JUMBO_3K; + else if (length <= 4096) + val = AN8855_MAX_RX_JUMBO_4K; + else if (length <= 5120) + val = AN8855_MAX_RX_JUMBO_5K; + else if (length <= 6144) + val = AN8855_MAX_RX_JUMBO_6K; + else if (length <= 7168) + val = AN8855_MAX_RX_JUMBO_7K; + else if (length <= 8192) + val = AN8855_MAX_RX_JUMBO_8K; + else if (length <= 9216) + val = AN8855_MAX_RX_JUMBO_9K; + else if (length <= 12288) + val = AN8855_MAX_RX_JUMBO_12K; + else if (length <= 15360) + val = AN8855_MAX_RX_JUMBO_15K; + else + val = AN8855_MAX_RX_JUMBO_16K; + + /* Enable JUMBO packet */ + if (length > 1552) + val |= AN8855_MAX_RX_PKT_JUMBO; + + return regmap_update_bits(priv->regmap, AN8855_GMACCR, + AN8855_MAX_RX_JUMBO | AN8855_MAX_RX_PKT_LEN, + val); +} + +static int +an8855_port_max_mtu(struct dsa_switch *ds, int port) +{ + return AN8855_MAX_MTU; +} + +static void +an8855_get_strings(struct dsa_switch *ds, int port, u32 stringset, + uint8_t *data) +{ + int i; + + if (stringset != ETH_SS_STATS) + return; + + for (i = 0; i < ARRAY_SIZE(an8855_mib); i++) + ethtool_puts(&data, an8855_mib[i].name); +} + +static void +an8855_read_port_stats(struct an8855_priv *priv, int port, u32 offset, u8 size, + uint64_t *data) +{ + u32 val, reg = AN8855_PORT_MIB_COUNTER(port) + offset; + + regmap_read(priv->regmap, reg, &val); + *data = val; + + if (size == 2) { + regmap_read(priv->regmap, reg + 4, &val); + *data |= (u64)val << 32; + } +} + +static void +an8855_get_ethtool_stats(struct dsa_switch *ds, int port, uint64_t *data) +{ + struct an8855_priv *priv = ds->priv; + const struct an8855_mib_desc *mib; + int i; + + for (i = 0; i < ARRAY_SIZE(an8855_mib); i++) { + mib = &an8855_mib[i]; + + an8855_read_port_stats(priv, port, mib->offset, mib->size, + data + i); + } +} + +static int +an8855_get_sset_count(struct dsa_switch *ds, int port, int sset) +{ + if (sset != ETH_SS_STATS) + return 0; + + return ARRAY_SIZE(an8855_mib); +} + +static void +an8855_get_eth_mac_stats(struct dsa_switch *ds, int port, + struct ethtool_eth_mac_stats *mac_stats) +{ + struct an8855_priv *priv = ds->priv; + + /* MIB counter doesn't provide a FramesTransmittedOK but instead + * provide stats for Unicast, Broadcast and Multicast frames separately. + * To simulate a global frame counter, read Unicast and addition Multicast + * and Broadcast later + */ + an8855_read_port_stats(priv, port, AN8855_PORT_MIB_TX_UNICAST, 1, + &mac_stats->FramesTransmittedOK); + + an8855_read_port_stats(priv, port, AN8855_PORT_MIB_TX_SINGLE_COLLISION, 1, + &mac_stats->SingleCollisionFrames); + + an8855_read_port_stats(priv, port, AN8855_PORT_MIB_TX_MULTIPLE_COLLISION, 1, + &mac_stats->MultipleCollisionFrames); + + an8855_read_port_stats(priv, port, AN8855_PORT_MIB_RX_UNICAST, 1, + &mac_stats->FramesReceivedOK); + + an8855_read_port_stats(priv, port, AN8855_PORT_MIB_TX_BYTES, 2, + &mac_stats->OctetsTransmittedOK); + + an8855_read_port_stats(priv, port, AN8855_PORT_MIB_RX_ALIGN_ERR, 1, + &mac_stats->AlignmentErrors); + + an8855_read_port_stats(priv, port, AN8855_PORT_MIB_TX_DEFERRED, 1, + &mac_stats->FramesWithDeferredXmissions); + + an8855_read_port_stats(priv, port, AN8855_PORT_MIB_TX_LATE_COLLISION, 1, + &mac_stats->LateCollisions); + + an8855_read_port_stats(priv, port, AN8855_PORT_MIB_TX_EXCESSIVE_COLLISION, 1, + &mac_stats->FramesAbortedDueToXSColls); + + an8855_read_port_stats(priv, port, AN8855_PORT_MIB_RX_BYTES, 2, + &mac_stats->OctetsReceivedOK); + + an8855_read_port_stats(priv, port, AN8855_PORT_MIB_TX_MULTICAST, 1, + &mac_stats->MulticastFramesXmittedOK); + mac_stats->FramesTransmittedOK += mac_stats->MulticastFramesXmittedOK; + an8855_read_port_stats(priv, port, AN8855_PORT_MIB_TX_BROADCAST, 1, + &mac_stats->BroadcastFramesXmittedOK); + mac_stats->FramesTransmittedOK += mac_stats->BroadcastFramesXmittedOK; + + an8855_read_port_stats(priv, port, AN8855_PORT_MIB_RX_MULTICAST, 1, + &mac_stats->MulticastFramesReceivedOK); + mac_stats->FramesReceivedOK += mac_stats->MulticastFramesReceivedOK; + an8855_read_port_stats(priv, port, AN8855_PORT_MIB_RX_BROADCAST, 1, + &mac_stats->BroadcastFramesReceivedOK); + mac_stats->FramesReceivedOK += mac_stats->BroadcastFramesReceivedOK; +} + +static const struct ethtool_rmon_hist_range an8855_rmon_ranges[] = { + { 0, 64 }, + { 65, 127 }, + { 128, 255 }, + { 256, 511 }, + { 512, 1023 }, + { 1024, 1518 }, + { 1519, AN8855_MAX_MTU }, + {} +}; + +static void an8855_get_rmon_stats(struct dsa_switch *ds, int port, + struct ethtool_rmon_stats *rmon_stats, + const struct ethtool_rmon_hist_range **ranges) +{ + struct an8855_priv *priv = ds->priv; + + an8855_read_port_stats(priv, port, AN8855_PORT_MIB_RX_UNDER_SIZE_ERR, 1, + &rmon_stats->undersize_pkts); + an8855_read_port_stats(priv, port, AN8855_PORT_MIB_RX_OVER_SZ_ERR, 1, + &rmon_stats->oversize_pkts); + an8855_read_port_stats(priv, port, AN8855_PORT_MIB_RX_FRAG_ERR, 1, + &rmon_stats->fragments); + an8855_read_port_stats(priv, port, AN8855_PORT_MIB_RX_JABBER_ERR, 1, + &rmon_stats->jabbers); + + an8855_read_port_stats(priv, port, AN8855_PORT_MIB_RX_PKT_SZ_64, 1, + &rmon_stats->hist[0]); + an8855_read_port_stats(priv, port, AN8855_PORT_MIB_RX_PKT_SZ_65_TO_127, 1, + &rmon_stats->hist[1]); + an8855_read_port_stats(priv, port, AN8855_PORT_MIB_RX_PKT_SZ_128_TO_255, 1, + &rmon_stats->hist[2]); + an8855_read_port_stats(priv, port, AN8855_PORT_MIB_RX_PKT_SZ_256_TO_511, 1, + &rmon_stats->hist[3]); + an8855_read_port_stats(priv, port, AN8855_PORT_MIB_RX_PKT_SZ_512_TO_1023, 1, + &rmon_stats->hist[4]); + an8855_read_port_stats(priv, port, AN8855_PORT_MIB_RX_PKT_SZ_1024_TO_1518, 1, + &rmon_stats->hist[5]); + an8855_read_port_stats(priv, port, AN8855_PORT_MIB_RX_PKT_SZ_1519_TO_MAX, 1, + &rmon_stats->hist[6]); + + an8855_read_port_stats(priv, port, AN8855_PORT_MIB_TX_PKT_SZ_64, 1, + &rmon_stats->hist_tx[0]); + an8855_read_port_stats(priv, port, AN8855_PORT_MIB_TX_PKT_SZ_65_TO_127, 1, + &rmon_stats->hist_tx[1]); + an8855_read_port_stats(priv, port, AN8855_PORT_MIB_TX_PKT_SZ_128_TO_255, 1, + &rmon_stats->hist_tx[2]); + an8855_read_port_stats(priv, port, AN8855_PORT_MIB_TX_PKT_SZ_256_TO_511, 1, + &rmon_stats->hist_tx[3]); + an8855_read_port_stats(priv, port, AN8855_PORT_MIB_TX_PKT_SZ_512_TO_1023, 1, + &rmon_stats->hist_tx[4]); + an8855_read_port_stats(priv, port, AN8855_PORT_MIB_TX_PKT_SZ_1024_TO_1518, 1, + &rmon_stats->hist_tx[5]); + an8855_read_port_stats(priv, port, AN8855_PORT_MIB_TX_PKT_SZ_1519_TO_MAX, 1, + &rmon_stats->hist_tx[6]); + + *ranges = an8855_rmon_ranges; +} + +static void an8855_get_eth_ctrl_stats(struct dsa_switch *ds, int port, + struct ethtool_eth_ctrl_stats *ctrl_stats) +{ + struct an8855_priv *priv = ds->priv; + + an8855_read_port_stats(priv, port, AN8855_PORT_MIB_TX_PAUSE, 1, + &ctrl_stats->MACControlFramesTransmitted); + + an8855_read_port_stats(priv, port, AN8855_PORT_MIB_RX_PAUSE, 1, + &ctrl_stats->MACControlFramesReceived); +} + +static int an8855_port_mirror_add(struct dsa_switch *ds, int port, + struct dsa_mall_mirror_tc_entry *mirror, + bool ingress, + struct netlink_ext_ack *extack) +{ + struct an8855_priv *priv = ds->priv; + int monitor_port; + u32 val; + int ret; + + /* Check for existent entry */ + if ((ingress ? priv->mirror_rx : priv->mirror_tx) & BIT(port)) + return -EEXIST; + + ret = regmap_read(priv->regmap, AN8855_MIR, &val); + if (ret) + return ret; + + /* AN8855 supports 4 monitor port, but only use first group */ + monitor_port = FIELD_GET(AN8855_MIRROR_PORT, val); + if (val & AN8855_MIRROR_EN && monitor_port != mirror->to_local_port) + return -EEXIST; + + val = AN8855_MIRROR_EN; + val |= FIELD_PREP(AN8855_MIRROR_PORT, mirror->to_local_port); + ret = regmap_update_bits(priv->regmap, AN8855_MIR, + AN8855_MIRROR_EN | AN8855_MIRROR_PORT, + val); + if (ret) + return ret; + + ret = regmap_set_bits(priv->regmap, AN8855_PCR_P(port), + ingress ? AN8855_PORT_RX_MIR : AN8855_PORT_TX_MIR); + if (ret) + return ret; + + if (ingress) + priv->mirror_rx |= BIT(port); + else + priv->mirror_tx |= BIT(port); + + return 0; +} + +static void an8855_port_mirror_del(struct dsa_switch *ds, int port, + struct dsa_mall_mirror_tc_entry *mirror) +{ + struct an8855_priv *priv = ds->priv; + + if (mirror->ingress) + priv->mirror_rx &= ~BIT(port); + else + priv->mirror_tx &= ~BIT(port); + + regmap_clear_bits(priv->regmap, AN8855_PCR_P(port), + mirror->ingress ? AN8855_PORT_RX_MIR : + AN8855_PORT_TX_MIR); + + if (!priv->mirror_rx && !priv->mirror_tx) + regmap_clear_bits(priv->regmap, AN8855_MIR, AN8855_MIRROR_EN); +} + +static int an8855_port_set_status(struct an8855_priv *priv, int port, + bool enable) +{ + if (enable) + return regmap_set_bits(priv->regmap, AN8855_PMCR_P(port), + AN8855_PMCR_TX_EN | AN8855_PMCR_RX_EN); + else + return regmap_clear_bits(priv->regmap, AN8855_PMCR_P(port), + AN8855_PMCR_TX_EN | AN8855_PMCR_RX_EN); +} + +static int an8855_port_enable(struct dsa_switch *ds, int port, + struct phy_device *phy) +{ + return an8855_port_set_status(ds->priv, port, true); +} + +static void an8855_port_disable(struct dsa_switch *ds, int port) +{ + an8855_port_set_status(ds->priv, port, false); +} + +static u32 en8855_get_phy_flags(struct dsa_switch *ds, int port) +{ + struct an8855_priv *priv = ds->priv; + + /* PHY doesn't need calibration */ + if (!priv->phy_require_calib) + return 0; + + /* Use AN8855_PHY_FLAGS_EN_CALIBRATION to signal + * calibration needed. + */ + return AN8855_PHY_FLAGS_EN_CALIBRATION; +} + +static enum dsa_tag_protocol +an8855_get_tag_protocol(struct dsa_switch *ds, int port, + enum dsa_tag_protocol mp) +{ + return DSA_TAG_PROTO_MTK; +} + +/* Similar to MT7530 also trap link local frame and special frame to CPU */ +static int an8855_trap_special_frames(struct an8855_priv *priv) +{ + int ret; + + /* Trap BPDUs to the CPU port(s) and egress them + * VLAN-untagged. + */ + ret = regmap_update_bits(priv->regmap, AN8855_BPC, + AN8855_BPDU_BPDU_FR | AN8855_BPDU_EG_TAG | + AN8855_BPDU_PORT_FW, + AN8855_BPDU_BPDU_FR | + FIELD_PREP(AN8855_BPDU_EG_TAG, AN8855_VLAN_EG_UNTAGGED) | + FIELD_PREP(AN8855_BPDU_PORT_FW, AN8855_BPDU_CPU_ONLY)); + if (ret) + return ret; + + /* Trap 802.1X PAE frames to the CPU port(s) and egress them + * VLAN-untagged. + */ + ret = regmap_update_bits(priv->regmap, AN8855_PAC, + AN8855_PAE_BPDU_FR | AN8855_PAE_EG_TAG | + AN8855_PAE_PORT_FW, + AN8855_PAE_BPDU_FR | + FIELD_PREP(AN8855_PAE_EG_TAG, AN8855_VLAN_EG_UNTAGGED) | + FIELD_PREP(AN8855_PAE_PORT_FW, AN8855_BPDU_CPU_ONLY)); + if (ret) + return ret; + + /* Trap frames with :01 MAC DAs to the CPU port(s) and egress + * them VLAN-untagged. + */ + ret = regmap_update_bits(priv->regmap, AN8855_RGAC1, + AN8855_R01_BPDU_FR | AN8855_R01_EG_TAG | + AN8855_R01_PORT_FW, + AN8855_R01_BPDU_FR | + FIELD_PREP(AN8855_R01_EG_TAG, AN8855_VLAN_EG_UNTAGGED) | + FIELD_PREP(AN8855_R01_PORT_FW, AN8855_BPDU_CPU_ONLY)); + if (ret) + return ret; + + /* Trap frames with :02 MAC DAs to the CPU port(s) and egress + * them VLAN-untagged. + */ + ret = regmap_update_bits(priv->regmap, AN8855_RGAC1, + AN8855_R02_BPDU_FR | AN8855_R02_EG_TAG | + AN8855_R02_PORT_FW, + AN8855_R02_BPDU_FR | + FIELD_PREP(AN8855_R02_EG_TAG, AN8855_VLAN_EG_UNTAGGED) | + FIELD_PREP(AN8855_R02_PORT_FW, AN8855_BPDU_CPU_ONLY)); + if (ret) + return ret; + + /* Trap frames with :03 MAC DAs to the CPU port(s) and egress + * them VLAN-untagged. + */ + ret = regmap_update_bits(priv->regmap, AN8855_RGAC1, + AN8855_R03_BPDU_FR | AN8855_R03_EG_TAG | + AN8855_R03_PORT_FW, + AN8855_R03_BPDU_FR | + FIELD_PREP(AN8855_R03_EG_TAG, AN8855_VLAN_EG_UNTAGGED) | + FIELD_PREP(AN8855_R03_PORT_FW, AN8855_BPDU_CPU_ONLY)); + if (ret) + return ret; + + /* Trap frames with :0E MAC DAs to the CPU port(s) and egress + * them VLAN-untagged. + */ + return regmap_update_bits(priv->regmap, AN8855_RGAC1, + AN8855_R0E_BPDU_FR | AN8855_R0E_EG_TAG | + AN8855_R0E_PORT_FW, + AN8855_R0E_BPDU_FR | + FIELD_PREP(AN8855_R0E_EG_TAG, AN8855_VLAN_EG_UNTAGGED) | + FIELD_PREP(AN8855_R0E_PORT_FW, AN8855_BPDU_CPU_ONLY)); +} + +static int +an8855_setup_pvid_vlan(struct an8855_priv *priv) +{ + u32 val; + int ret; + + /* Validate the entry with independent learning, keep the original + * ingress tag attribute. + */ + val = AN8855_VA0_IVL_MAC | AN8855_VA0_EG_CON | + FIELD_PREP(AN8855_VA0_FID, AN8855_FID_BRIDGED) | + AN8855_VA0_PORT | AN8855_VA0_VLAN_VALID; + ret = regmap_write(priv->regmap, AN8855_VAWD0, val); + if (ret) + return ret; + + return an8855_vlan_cmd(priv, AN8855_VTCR_WR_VID, + AN8855_PORT_VID_DEFAULT); +} + +static int an8855_setup(struct dsa_switch *ds) +{ + struct an8855_priv *priv = ds->priv; + struct dsa_port *dp; + int ret; + + /* Enable and reset MIB counters */ + ret = an8855_mib_init(priv); + if (ret) + return ret; + + dsa_switch_for_each_user_port(dp, ds) { + /* Disable MAC by default on all user ports */ + ret = an8855_port_set_status(priv, dp->index, false); + if (ret) + return ret; + + /* Individual user ports get connected to CPU port only */ + ret = regmap_write(priv->regmap, AN8855_PORTMATRIX_P(dp->index), + FIELD_PREP(AN8855_PORTMATRIX, BIT(AN8855_CPU_PORT))); + if (ret) + return ret; + + /* Disable Broadcast Forward on user ports */ + ret = regmap_clear_bits(priv->regmap, AN8855_BCF, BIT(dp->index)); + if (ret) + return ret; + + /* Disable Unknown Unicast Forward on user ports */ + ret = regmap_clear_bits(priv->regmap, AN8855_UNUF, BIT(dp->index)); + if (ret) + return ret; + + /* Disable Unknown Multicast Forward on user ports */ + ret = regmap_clear_bits(priv->regmap, AN8855_UNMF, BIT(dp->index)); + if (ret) + return ret; + + ret = regmap_clear_bits(priv->regmap, AN8855_UNIPMF, BIT(dp->index)); + if (ret) + return ret; + + /* Set default PVID to on all user ports */ + ret = an8855_port_set_pid(priv, dp->index, AN8855_PORT_VID_DEFAULT); + if (ret) + return ret; + } + + /* Enable Airoha header mode on the cpu port */ + ret = regmap_write(priv->regmap, AN8855_PVC_P(AN8855_CPU_PORT), + AN8855_PORT_SPEC_REPLACE_MODE | AN8855_PORT_SPEC_TAG); + if (ret) + return ret; + + /* Unknown multicast frame forwarding to the cpu port */ + ret = regmap_write(priv->regmap, AN8855_UNMF, BIT(AN8855_CPU_PORT)); + if (ret) + return ret; + + /* Set CPU port number */ + ret = regmap_update_bits(priv->regmap, AN8855_MFC, + AN8855_CPU_EN | AN8855_CPU_PORT_IDX, + AN8855_CPU_EN | + FIELD_PREP(AN8855_CPU_PORT_IDX, AN8855_CPU_PORT)); + if (ret) + return ret; + + /* CPU port gets connected to all user ports of + * the switch. + */ + ret = regmap_write(priv->regmap, AN8855_PORTMATRIX_P(AN8855_CPU_PORT), + FIELD_PREP(AN8855_PORTMATRIX, dsa_user_ports(ds))); + if (ret) + return ret; + + /* CPU port is set to fallback mode to let untagged + * frames pass through. + */ + ret = regmap_update_bits(priv->regmap, AN8855_PCR_P(AN8855_CPU_PORT), + AN8855_PORT_VLAN, + FIELD_PREP(AN8855_PORT_VLAN, AN8855_PORT_FALLBACK_MODE)); + if (ret) + return ret; + + /* Enable Broadcast Forward on CPU port */ + ret = regmap_set_bits(priv->regmap, AN8855_BCF, BIT(AN8855_CPU_PORT)); + if (ret) + return ret; + + /* Enable Unknown Unicast Forward on CPU port */ + ret = regmap_set_bits(priv->regmap, AN8855_UNUF, BIT(AN8855_CPU_PORT)); + if (ret) + return ret; + + /* Enable Unknown Multicast Forward on CPU port */ + ret = regmap_set_bits(priv->regmap, AN8855_UNMF, BIT(AN8855_CPU_PORT)); + if (ret) + return ret; + + ret = regmap_set_bits(priv->regmap, AN8855_UNIPMF, BIT(AN8855_CPU_PORT)); + if (ret) + return ret; + + /* Setup Trap special frame to CPU rules */ + ret = an8855_trap_special_frames(priv); + if (ret) + return ret; + + dsa_switch_for_each_port(dp, ds) { + /* Disable Learning on all ports. + * Learning on CPU is disabled for fdb isolation and handled by + * assisted_learning_on_cpu_port. + */ + ret = regmap_set_bits(priv->regmap, AN8855_PSC_P(dp->index), + AN8855_SA_DIS); + if (ret) + return ret; + + /* Enable consistent egress tag (for VLAN unware VLAN-passtrough) */ + ret = regmap_update_bits(priv->regmap, AN8855_PVC_P(dp->index), + AN8855_PVC_EG_TAG, + FIELD_PREP(AN8855_PVC_EG_TAG, AN8855_VLAN_EG_CONSISTENT)); + if (ret) + return ret; + } + + /* Setup VLAN for Default PVID */ + ret = an8855_setup_pvid_vlan(priv); + if (ret) + return ret; + + ret = regmap_clear_bits(priv->regmap, AN8855_CKGCR, + AN8855_CKG_LNKDN_GLB_STOP | AN8855_CKG_LNKDN_PORT_STOP); + if (ret) + return ret; + + /* Release global PHY power down */ + ret = regmap_write(priv->regmap, AN8855_RG_GPHY_AFE_PWD, 0x0); + if (ret) + return ret; + + ds->configure_vlan_while_not_filtering = true; + + /* Flush the FDB table */ + ret = an8855_fdb_cmd(priv, AN8855_FDB_FLUSH, NULL); + if (ret < 0) + return ret; + + /* Set min a max ageing value supported */ + ds->ageing_time_min = AN8855_L2_AGING_MS_CONSTANT; + ds->ageing_time_max = FIELD_MAX(AN8855_AGE_CNT) * + FIELD_MAX(AN8855_AGE_UNIT) * + AN8855_L2_AGING_MS_CONSTANT; + + /* Enable assisted learning for fdb isolation */ + ds->assisted_learning_on_cpu_port = true; + + return 0; +} + +static struct phylink_pcs *an8855_phylink_mac_select_pcs(struct phylink_config *config, + phy_interface_t interface) +{ + struct dsa_port *dp = dsa_phylink_to_port(config); + struct an8855_priv *priv = dp->ds->priv; + + switch (interface) { + case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_2500BASEX: + return &priv->pcs; + default: + return NULL; + } +} + +static void an8855_phylink_mac_config(struct phylink_config *config, + unsigned int mode, + const struct phylink_link_state *state) +{ + struct dsa_port *dp = dsa_phylink_to_port(config); + struct dsa_switch *ds = dp->ds; + struct an8855_priv *priv; + int port = dp->index; + + priv = ds->priv; + + /* Nothing to configure for internal ports */ + if (port != 5) + return; + + regmap_update_bits(priv->regmap, AN8855_PMCR_P(port), + AN8855_PMCR_IFG_XMIT | AN8855_PMCR_MAC_MODE | + AN8855_PMCR_BACKOFF_EN | AN8855_PMCR_BACKPR_EN, + FIELD_PREP(AN8855_PMCR_IFG_XMIT, 0x1) | + AN8855_PMCR_MAC_MODE | AN8855_PMCR_BACKOFF_EN | + AN8855_PMCR_BACKPR_EN); +} + +static void an8855_phylink_get_caps(struct dsa_switch *ds, int port, + struct phylink_config *config) +{ + switch (port) { + case 0: + case 1: + case 2: + case 3: + case 4: + __set_bit(PHY_INTERFACE_MODE_GMII, + config->supported_interfaces); + __set_bit(PHY_INTERFACE_MODE_INTERNAL, + config->supported_interfaces); + break; + case 5: + phy_interface_set_rgmii(config->supported_interfaces); + __set_bit(PHY_INTERFACE_MODE_SGMII, + config->supported_interfaces); + __set_bit(PHY_INTERFACE_MODE_2500BASEX, + config->supported_interfaces); + break; + } + + config->mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE | + MAC_10 | MAC_100 | MAC_1000FD | MAC_2500FD; +} + +static void an8855_phylink_mac_link_down(struct phylink_config *config, + unsigned int mode, + phy_interface_t interface) +{ + struct dsa_port *dp = dsa_phylink_to_port(config); + struct an8855_priv *priv = dp->ds->priv; + + /* With autoneg just disable TX/RX else also force link down */ + if (phylink_autoneg_inband(mode)) { + regmap_clear_bits(priv->regmap, AN8855_PMCR_P(dp->index), + AN8855_PMCR_TX_EN | AN8855_PMCR_RX_EN); + } else { + regmap_update_bits(priv->regmap, AN8855_PMCR_P(dp->index), + AN8855_PMCR_TX_EN | AN8855_PMCR_RX_EN | + AN8855_PMCR_FORCE_MODE | AN8855_PMCR_FORCE_LNK, + AN8855_PMCR_FORCE_MODE); + } +} + +static void an8855_phylink_mac_link_up(struct phylink_config *config, + struct phy_device *phydev, unsigned int mode, + phy_interface_t interface, int speed, + int duplex, bool tx_pause, bool rx_pause) +{ + struct dsa_port *dp = dsa_phylink_to_port(config); + struct an8855_priv *priv = dp->ds->priv; + int port = dp->index; + u32 reg; + + reg = regmap_read(priv->regmap, AN8855_PMCR_P(port), ®); + if (phylink_autoneg_inband(mode)) { + reg &= ~AN8855_PMCR_FORCE_MODE; + } else { + reg |= AN8855_PMCR_FORCE_MODE | AN8855_PMCR_FORCE_LNK; + + reg &= ~AN8855_PMCR_FORCE_SPEED; + switch (speed) { + case SPEED_10: + reg |= AN8855_PMCR_FORCE_SPEED_10; + break; + case SPEED_100: + reg |= AN8855_PMCR_FORCE_SPEED_100; + break; + case SPEED_1000: + reg |= AN8855_PMCR_FORCE_SPEED_1000; + break; + case SPEED_2500: + reg |= AN8855_PMCR_FORCE_SPEED_2500; + break; + case SPEED_5000: + dev_err(priv->dev, "Missing support for 5G speed. Aborting...\n"); + return; + } + + reg &= ~AN8855_PMCR_FORCE_FDX; + if (duplex == DUPLEX_FULL) + reg |= AN8855_PMCR_FORCE_FDX; + + reg &= ~AN8855_PMCR_RX_FC_EN; + if (rx_pause || dsa_port_is_cpu(dp)) + reg |= AN8855_PMCR_RX_FC_EN; + + reg &= ~AN8855_PMCR_TX_FC_EN; + if (rx_pause || dsa_port_is_cpu(dp)) + reg |= AN8855_PMCR_TX_FC_EN; + + /* Disable any EEE options */ + reg &= ~(AN8855_PMCR_FORCE_EEE5G | AN8855_PMCR_FORCE_EEE2P5G | + AN8855_PMCR_FORCE_EEE1G | AN8855_PMCR_FORCE_EEE100); + } + + reg |= AN8855_PMCR_TX_EN | AN8855_PMCR_RX_EN; + + regmap_write(priv->regmap, AN8855_PMCR_P(port), reg); +} + +static unsigned int an8855_pcs_inband_caps(struct phylink_pcs *pcs, + phy_interface_t interface) +{ + /* SGMII can be configured to use inband with AN result */ + if (interface == PHY_INTERFACE_MODE_SGMII) + return LINK_INBAND_DISABLE | LINK_INBAND_ENABLE; + + /* inband is not supported in 2500-baseX and must be disabled */ + return LINK_INBAND_DISABLE; +} + +static void an8855_pcs_get_state(struct phylink_pcs *pcs, + struct phylink_link_state *state) +{ + struct an8855_priv *priv = container_of(pcs, struct an8855_priv, pcs); + u32 val; + int ret; + + ret = regmap_read(priv->regmap, AN8855_PMSR_P(AN8855_CPU_PORT), &val); + if (ret < 0) { + state->link = false; + return; + } + + state->link = !!(val & AN8855_PMSR_LNK); + state->an_complete = state->link; + state->duplex = (val & AN8855_PMSR_DPX) ? DUPLEX_FULL : + DUPLEX_HALF; + + switch (val & AN8855_PMSR_SPEED) { + case AN8855_PMSR_SPEED_10: + state->speed = SPEED_10; + break; + case AN8855_PMSR_SPEED_100: + state->speed = SPEED_100; + break; + case AN8855_PMSR_SPEED_1000: + state->speed = SPEED_1000; + break; + case AN8855_PMSR_SPEED_2500: + state->speed = SPEED_2500; + break; + case AN8855_PMSR_SPEED_5000: + dev_err(priv->dev, "Missing support for 5G speed. Setting Unknown.\n"); + fallthrough; + default: + state->speed = SPEED_UNKNOWN; + break; + } + + if (val & AN8855_PMSR_RX_FC) + state->pause |= MLO_PAUSE_RX; + if (val & AN8855_PMSR_TX_FC) + state->pause |= MLO_PAUSE_TX; +} + +static int an8855_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode, + phy_interface_t interface, + const unsigned long *advertising, + bool permit_pause_to_mac) +{ + struct an8855_priv *priv = container_of(pcs, struct an8855_priv, pcs); + u32 val; + int ret; + + /* !!! WELCOME TO HELL !!! */ + + /* TX FIR - improve TX EYE */ + ret = regmap_update_bits(priv->regmap, AN8855_INTF_CTRL_10, + AN8855_RG_DA_QP_TX_FIR_C2_SEL | + AN8855_RG_DA_QP_TX_FIR_C2_FORCE | + AN8855_RG_DA_QP_TX_FIR_C1_SEL | + AN8855_RG_DA_QP_TX_FIR_C1_FORCE, + AN8855_RG_DA_QP_TX_FIR_C2_SEL | + FIELD_PREP(AN8855_RG_DA_QP_TX_FIR_C2_FORCE, 0x4) | + AN8855_RG_DA_QP_TX_FIR_C1_SEL | + FIELD_PREP(AN8855_RG_DA_QP_TX_FIR_C1_FORCE, 0x0)); + if (ret) + return ret; + + if (interface == PHY_INTERFACE_MODE_2500BASEX) + val = 0x0; + else + val = 0xd; + ret = regmap_update_bits(priv->regmap, AN8855_INTF_CTRL_11, + AN8855_RG_DA_QP_TX_FIR_C0B_SEL | + AN8855_RG_DA_QP_TX_FIR_C0B_FORCE, + AN8855_RG_DA_QP_TX_FIR_C0B_SEL | + FIELD_PREP(AN8855_RG_DA_QP_TX_FIR_C0B_FORCE, val)); + if (ret) + return ret; + + /* RX CDR - improve RX Jitter Tolerance */ + if (interface == PHY_INTERFACE_MODE_2500BASEX) + val = 0x5; + else + val = 0x6; + ret = regmap_update_bits(priv->regmap, AN8855_RG_QP_CDR_LPF_BOT_LIM, + AN8855_RG_QP_CDR_LPF_KP_GAIN | + AN8855_RG_QP_CDR_LPF_KI_GAIN, + FIELD_PREP(AN8855_RG_QP_CDR_LPF_KP_GAIN, val) | + FIELD_PREP(AN8855_RG_QP_CDR_LPF_KI_GAIN, val)); + if (ret) + return ret; + + /* PLL */ + if (interface == PHY_INTERFACE_MODE_2500BASEX) + val = 0x1; + else + val = 0x0; + ret = regmap_update_bits(priv->regmap, AN8855_QP_DIG_MODE_CTRL_1, + AN8855_RG_TPHY_SPEED, + FIELD_PREP(AN8855_RG_TPHY_SPEED, val)); + if (ret) + return ret; + + /* PLL - LPF */ + ret = regmap_update_bits(priv->regmap, AN8855_PLL_CTRL_2, + AN8855_RG_DA_QP_PLL_RICO_SEL_INTF | + AN8855_RG_DA_QP_PLL_FBKSEL_INTF | + AN8855_RG_DA_QP_PLL_BR_INTF | + AN8855_RG_DA_QP_PLL_BPD_INTF | + AN8855_RG_DA_QP_PLL_BPA_INTF | + AN8855_RG_DA_QP_PLL_BC_INTF, + AN8855_RG_DA_QP_PLL_RICO_SEL_INTF | + FIELD_PREP(AN8855_RG_DA_QP_PLL_FBKSEL_INTF, 0x0) | + FIELD_PREP(AN8855_RG_DA_QP_PLL_BR_INTF, 0x3) | + FIELD_PREP(AN8855_RG_DA_QP_PLL_BPD_INTF, 0x0) | + FIELD_PREP(AN8855_RG_DA_QP_PLL_BPA_INTF, 0x5) | + FIELD_PREP(AN8855_RG_DA_QP_PLL_BC_INTF, 0x1)); + if (ret) + return ret; + + /* PLL - ICO */ + ret = regmap_set_bits(priv->regmap, AN8855_PLL_CTRL_4, + AN8855_RG_DA_QP_PLL_ICOLP_EN_INTF); + if (ret) + return ret; + ret = regmap_clear_bits(priv->regmap, AN8855_PLL_CTRL_2, + AN8855_RG_DA_QP_PLL_ICOIQ_EN_INTF); + if (ret) + return ret; + + /* PLL - CHP */ + if (interface == PHY_INTERFACE_MODE_2500BASEX) + val = 0x6; + else + val = 0x4; + ret = regmap_update_bits(priv->regmap, AN8855_PLL_CTRL_2, + AN8855_RG_DA_QP_PLL_IR_INTF, + FIELD_PREP(AN8855_RG_DA_QP_PLL_IR_INTF, val)); + if (ret) + return ret; + + /* PLL - PFD */ + ret = regmap_update_bits(priv->regmap, AN8855_PLL_CTRL_2, + AN8855_RG_DA_QP_PLL_PFD_OFFSET_EN_INTRF | + AN8855_RG_DA_QP_PLL_PFD_OFFSET_INTF | + AN8855_RG_DA_QP_PLL_KBAND_PREDIV_INTF, + FIELD_PREP(AN8855_RG_DA_QP_PLL_PFD_OFFSET_INTF, 0x1) | + FIELD_PREP(AN8855_RG_DA_QP_PLL_KBAND_PREDIV_INTF, 0x1)); + if (ret) + return ret; + + /* PLL - POSTDIV */ + ret = regmap_update_bits(priv->regmap, AN8855_PLL_CTRL_2, + AN8855_RG_DA_QP_PLL_POSTDIV_EN_INTF | + AN8855_RG_DA_QP_PLL_PHY_CK_EN_INTF | + AN8855_RG_DA_QP_PLL_PCK_SEL_INTF, + AN8855_RG_DA_QP_PLL_PCK_SEL_INTF); + if (ret) + return ret; + + /* PLL - SDM */ + ret = regmap_update_bits(priv->regmap, AN8855_PLL_CTRL_2, + AN8855_RG_DA_QP_PLL_SDM_HREN_INTF, + FIELD_PREP(AN8855_RG_DA_QP_PLL_SDM_HREN_INTF, 0x0)); + if (ret) + return ret; + ret = regmap_clear_bits(priv->regmap, AN8855_PLL_CTRL_2, + AN8855_RG_DA_QP_PLL_SDM_IFM_INTF); + if (ret) + return ret; + + ret = regmap_update_bits(priv->regmap, AN8855_SS_LCPLL_PWCTL_SETTING_2, + AN8855_RG_NCPO_ANA_MSB, + FIELD_PREP(AN8855_RG_NCPO_ANA_MSB, 0x1)); + if (ret) + return ret; + + if (interface == PHY_INTERFACE_MODE_2500BASEX) + val = 0x7a000000; + else + val = 0x48000000; + ret = regmap_write(priv->regmap, AN8855_SS_LCPLL_TDC_FLT_2, + FIELD_PREP(AN8855_RG_LCPLL_NCPO_VALUE, val)); + if (ret) + return ret; + ret = regmap_write(priv->regmap, AN8855_SS_LCPLL_TDC_PCW_1, + FIELD_PREP(AN8855_RG_LCPLL_PON_HRDDS_PCW_NCPO_GPON, val)); + if (ret) + return ret; + + ret = regmap_clear_bits(priv->regmap, AN8855_SS_LCPLL_TDC_FLT_5, + AN8855_RG_LCPLL_NCPO_CHG); + if (ret) + return ret; + ret = regmap_clear_bits(priv->regmap, AN8855_PLL_CK_CTRL_0, + AN8855_RG_DA_QP_PLL_SDM_DI_EN_INTF); + if (ret) + return ret; + + /* PLL - SS */ + ret = regmap_update_bits(priv->regmap, AN8855_PLL_CTRL_3, + AN8855_RG_DA_QP_PLL_SSC_DELTA_INTF, + FIELD_PREP(AN8855_RG_DA_QP_PLL_SSC_DELTA_INTF, 0x0)); + if (ret) + return ret; + ret = regmap_update_bits(priv->regmap, AN8855_PLL_CTRL_4, + AN8855_RG_DA_QP_PLL_SSC_DIR_DLY_INTF, + FIELD_PREP(AN8855_RG_DA_QP_PLL_SSC_DIR_DLY_INTF, 0x0)); + if (ret) + return ret; + ret = regmap_update_bits(priv->regmap, AN8855_PLL_CTRL_3, + AN8855_RG_DA_QP_PLL_SSC_PERIOD_INTF, + FIELD_PREP(AN8855_RG_DA_QP_PLL_SSC_PERIOD_INTF, 0x0)); + if (ret) + return ret; + + /* PLL - TDC */ + ret = regmap_clear_bits(priv->regmap, AN8855_PLL_CK_CTRL_0, + AN8855_RG_DA_QP_PLL_TDC_TXCK_SEL_INTF); + if (ret) + return ret; + + ret = regmap_set_bits(priv->regmap, AN8855_RG_QP_PLL_SDM_ORD, + AN8855_RG_QP_PLL_SSC_TRI_EN); + if (ret) + return ret; + ret = regmap_set_bits(priv->regmap, AN8855_RG_QP_PLL_SDM_ORD, + AN8855_RG_QP_PLL_SSC_PHASE_INI); + if (ret) + return ret; + + ret = regmap_update_bits(priv->regmap, AN8855_RG_QP_RX_DAC_EN, + AN8855_RG_QP_SIGDET_HF, + FIELD_PREP(AN8855_RG_QP_SIGDET_HF, 0x2)); + if (ret) + return ret; + + /* TCL Disable (only for Co-SIM) */ + ret = regmap_clear_bits(priv->regmap, AN8855_PON_RXFEDIG_CTRL_0, + AN8855_RG_QP_EQ_RX500M_CK_SEL); + if (ret) + return ret; + + /* TX Init */ + if (interface == PHY_INTERFACE_MODE_2500BASEX) + val = 0x4; + else + val = 0x0; + ret = regmap_update_bits(priv->regmap, AN8855_RG_QP_TX_MODE, + AN8855_RG_QP_TX_RESERVE | + AN8855_RG_QP_TX_MODE_16B_EN, + FIELD_PREP(AN8855_RG_QP_TX_RESERVE, val)); + if (ret) + return ret; + + /* RX Control/Init */ + ret = regmap_set_bits(priv->regmap, AN8855_RG_QP_RXAFE_RESERVE, + AN8855_RG_QP_CDR_PD_10B_EN); + if (ret) + return ret; + + if (interface == PHY_INTERFACE_MODE_2500BASEX) + val = 0x1; + else + val = 0x2; + ret = regmap_update_bits(priv->regmap, AN8855_RG_QP_CDR_LPF_MJV_LIM, + AN8855_RG_QP_CDR_LPF_RATIO, + FIELD_PREP(AN8855_RG_QP_CDR_LPF_RATIO, val)); + if (ret) + return ret; + + ret = regmap_update_bits(priv->regmap, AN8855_RG_QP_CDR_LPF_SETVALUE, + AN8855_RG_QP_CDR_PR_BUF_IN_SR | + AN8855_RG_QP_CDR_PR_BETA_SEL, + FIELD_PREP(AN8855_RG_QP_CDR_PR_BUF_IN_SR, 0x6) | + FIELD_PREP(AN8855_RG_QP_CDR_PR_BETA_SEL, 0x1)); + if (ret) + return ret; + + if (interface == PHY_INTERFACE_MODE_2500BASEX) + val = 0xf; + else + val = 0xc; + ret = regmap_update_bits(priv->regmap, AN8855_RG_QP_CDR_PR_CKREF_DIV1, + AN8855_RG_QP_CDR_PR_DAC_BAND, + FIELD_PREP(AN8855_RG_QP_CDR_PR_DAC_BAND, val)); + if (ret) + return ret; + + ret = regmap_update_bits(priv->regmap, AN8855_RG_QP_CDR_PR_KBAND_DIV_PCIE, + AN8855_RG_QP_CDR_PR_KBAND_PCIE_MODE | + AN8855_RG_QP_CDR_PR_KBAND_DIV_PCIE_MASK, + FIELD_PREP(AN8855_RG_QP_CDR_PR_KBAND_DIV_PCIE_MASK, 0x19)); + if (ret) + return ret; + + ret = regmap_update_bits(priv->regmap, AN8855_RG_QP_CDR_FORCE_IBANDLPF_R_OFF, + AN8855_RG_QP_CDR_PHYCK_SEL | + AN8855_RG_QP_CDR_PHYCK_RSTB | + AN8855_RG_QP_CDR_PHYCK_DIV, + FIELD_PREP(AN8855_RG_QP_CDR_PHYCK_SEL, 0x2) | + FIELD_PREP(AN8855_RG_QP_CDR_PHYCK_DIV, 0x21)); + if (ret) + return ret; + + ret = regmap_clear_bits(priv->regmap, AN8855_RG_QP_CDR_PR_KBAND_DIV_PCIE, + AN8855_RG_QP_CDR_PR_XFICK_EN); + if (ret) + return ret; + + ret = regmap_update_bits(priv->regmap, AN8855_RG_QP_CDR_PR_CKREF_DIV1, + AN8855_RG_QP_CDR_PR_KBAND_DIV, + FIELD_PREP(AN8855_RG_QP_CDR_PR_KBAND_DIV, 0x4)); + if (ret) + return ret; + + ret = regmap_update_bits(priv->regmap, AN8855_RX_CTRL_26, + AN8855_RG_QP_EQ_RETRAIN_ONLY_EN | + AN8855_RG_LINK_NE_EN | + AN8855_RG_LINK_ERRO_EN, + AN8855_RG_QP_EQ_RETRAIN_ONLY_EN | + AN8855_RG_LINK_ERRO_EN); + if (ret) + return ret; + + ret = regmap_update_bits(priv->regmap, AN8855_RX_DLY_0, + AN8855_RG_QP_RX_SAOSC_EN_H_DLY | + AN8855_RG_QP_RX_PI_CAL_EN_H_DLY, + FIELD_PREP(AN8855_RG_QP_RX_SAOSC_EN_H_DLY, 0x3f) | + FIELD_PREP(AN8855_RG_QP_RX_PI_CAL_EN_H_DLY, 0x6f)); + if (ret) + return ret; + + ret = regmap_update_bits(priv->regmap, AN8855_RX_CTRL_42, + AN8855_RG_QP_EQ_EN_DLY, + FIELD_PREP(AN8855_RG_QP_EQ_EN_DLY, 0x150)); + if (ret) + return ret; + + ret = regmap_update_bits(priv->regmap, AN8855_RX_CTRL_2, + AN8855_RG_QP_RX_EQ_EN_H_DLY, + FIELD_PREP(AN8855_RG_QP_RX_EQ_EN_H_DLY, 0x150)); + if (ret) + return ret; + + ret = regmap_update_bits(priv->regmap, AN8855_PON_RXFEDIG_CTRL_9, + AN8855_RG_QP_EQ_LEQOSC_DLYCNT, + FIELD_PREP(AN8855_RG_QP_EQ_LEQOSC_DLYCNT, 0x1)); + if (ret) + return ret; + + ret = regmap_update_bits(priv->regmap, AN8855_RX_CTRL_8, + AN8855_RG_DA_QP_SAOSC_DONE_TIME | + AN8855_RG_DA_QP_LEQOS_EN_TIME, + FIELD_PREP(AN8855_RG_DA_QP_SAOSC_DONE_TIME, 0x200) | + FIELD_PREP(AN8855_RG_DA_QP_LEQOS_EN_TIME, 0xfff)); + if (ret) + return ret; + + /* Frequency meter */ + if (interface == PHY_INTERFACE_MODE_2500BASEX) + val = 0x10; + else + val = 0x28; + ret = regmap_update_bits(priv->regmap, AN8855_RX_CTRL_5, + AN8855_RG_FREDET_CHK_CYCLE, + FIELD_PREP(AN8855_RG_FREDET_CHK_CYCLE, val)); + if (ret) + return ret; + + ret = regmap_update_bits(priv->regmap, AN8855_RX_CTRL_6, + AN8855_RG_FREDET_GOLDEN_CYCLE, + FIELD_PREP(AN8855_RG_FREDET_GOLDEN_CYCLE, 0x64)); + if (ret) + return ret; + + ret = regmap_update_bits(priv->regmap, AN8855_RX_CTRL_7, + AN8855_RG_FREDET_TOLERATE_CYCLE, + FIELD_PREP(AN8855_RG_FREDET_TOLERATE_CYCLE, 0x2710)); + if (ret) + return ret; + + ret = regmap_set_bits(priv->regmap, AN8855_PLL_CTRL_0, + AN8855_RG_PHYA_AUTO_INIT); + if (ret) + return ret; + + /* PCS Init */ + if (interface == PHY_INTERFACE_MODE_SGMII && + neg_mode == PHYLINK_PCS_NEG_INBAND_DISABLED) { + ret = regmap_clear_bits(priv->regmap, AN8855_QP_DIG_MODE_CTRL_0, + AN8855_RG_SGMII_MODE | AN8855_RG_SGMII_AN_EN); + if (ret) + return ret; + } + + ret = regmap_clear_bits(priv->regmap, AN8855_RG_HSGMII_PCS_CTROL_1, + AN8855_RG_TBI_10B_MODE); + if (ret) + return ret; + + if (neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED) { + /* Set AN Ability - Interrupt */ + ret = regmap_set_bits(priv->regmap, AN8855_SGMII_REG_AN_FORCE_CL37, + AN8855_RG_FORCE_AN_DONE); + if (ret) + return ret; + + ret = regmap_update_bits(priv->regmap, AN8855_SGMII_REG_AN_13, + AN8855_SGMII_REMOTE_FAULT_DIS | + AN8855_SGMII_IF_MODE, + AN8855_SGMII_REMOTE_FAULT_DIS | + FIELD_PREP(AN8855_SGMII_IF_MODE, 0xb)); + if (ret) + return ret; + } + + /* Rate Adaption - GMII path config. */ + if (interface == PHY_INTERFACE_MODE_2500BASEX) { + ret = regmap_clear_bits(priv->regmap, AN8855_RATE_ADP_P0_CTRL_0, + AN8855_RG_P0_DIS_MII_MODE); + if (ret) + return ret; + } else { + if (neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED) { + ret = regmap_set_bits(priv->regmap, AN8855_MII_RA_AN_ENABLE, + AN8855_RG_P0_RA_AN_EN); + if (ret) + return ret; + } else { + ret = regmap_update_bits(priv->regmap, AN8855_RG_AN_SGMII_MODE_FORCE, + AN8855_RG_FORCE_CUR_SGMII_MODE | + AN8855_RG_FORCE_CUR_SGMII_SEL, + AN8855_RG_FORCE_CUR_SGMII_SEL); + if (ret) + return ret; + + ret = regmap_clear_bits(priv->regmap, AN8855_RATE_ADP_P0_CTRL_0, + AN8855_RG_P0_MII_RA_RX_EN | + AN8855_RG_P0_MII_RA_TX_EN | + AN8855_RG_P0_MII_RA_RX_MODE | + AN8855_RG_P0_MII_RA_TX_MODE); + if (ret) + return ret; + } + + ret = regmap_set_bits(priv->regmap, AN8855_RATE_ADP_P0_CTRL_0, + AN8855_RG_P0_MII_MODE); + if (ret) + return ret; + } + + ret = regmap_set_bits(priv->regmap, AN8855_RG_RATE_ADAPT_CTRL_0, + AN8855_RG_RATE_ADAPT_RX_BYPASS | + AN8855_RG_RATE_ADAPT_TX_BYPASS | + AN8855_RG_RATE_ADAPT_RX_EN | + AN8855_RG_RATE_ADAPT_TX_EN); + if (ret) + return ret; + + /* Disable AN if not in autoneg */ + ret = regmap_update_bits(priv->regmap, AN8855_SGMII_REG_AN0, BMCR_ANENABLE, + neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED ? BMCR_ANENABLE : + 0); + if (ret) + return ret; + + if (interface == PHY_INTERFACE_MODE_SGMII) { + /* Follow SDK init flow with restarting AN after AN enable */ + if (neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED) { + ret = regmap_set_bits(priv->regmap, AN8855_SGMII_REG_AN0, + BMCR_ANRESTART); + if (ret) + return ret; + } else { + ret = regmap_set_bits(priv->regmap, AN8855_PHY_RX_FORCE_CTRL_0, + AN8855_RG_FORCE_TXC_SEL); + if (ret) + return ret; + } + } + + /* Force Speed with fixed-link or 2500base-x as doesn't support aneg */ + if (interface == PHY_INTERFACE_MODE_2500BASEX || + neg_mode != PHYLINK_PCS_NEG_INBAND_ENABLED) { + if (interface == PHY_INTERFACE_MODE_2500BASEX) + val = AN8855_RG_LINK_MODE_P0_SPEED_2500; + else + val = AN8855_RG_LINK_MODE_P0_SPEED_1000; + ret = regmap_update_bits(priv->regmap, AN8855_SGMII_STS_CTRL_0, + AN8855_RG_LINK_MODE_P0 | + AN8855_RG_FORCE_SPD_MODE_P0, + val | AN8855_RG_FORCE_SPD_MODE_P0); + if (ret) + return ret; + } + + /* bypass flow control to MAC */ + ret = regmap_write(priv->regmap, AN8855_MSG_RX_LIK_STS_0, + AN8855_RG_DPX_STS_P3 | AN8855_RG_DPX_STS_P2 | + AN8855_RG_DPX_STS_P1 | AN8855_RG_TXFC_STS_P0 | + AN8855_RG_RXFC_STS_P0 | AN8855_RG_DPX_STS_P0); + if (ret) + return ret; + ret = regmap_write(priv->regmap, AN8855_MSG_RX_LIK_STS_2, + AN8855_RG_RXFC_AN_BYPASS_P3 | + AN8855_RG_RXFC_AN_BYPASS_P2 | + AN8855_RG_RXFC_AN_BYPASS_P1 | + AN8855_RG_TXFC_AN_BYPASS_P3 | + AN8855_RG_TXFC_AN_BYPASS_P2 | + AN8855_RG_TXFC_AN_BYPASS_P1 | + AN8855_RG_DPX_AN_BYPASS_P3 | + AN8855_RG_DPX_AN_BYPASS_P2 | + AN8855_RG_DPX_AN_BYPASS_P1 | + AN8855_RG_DPX_AN_BYPASS_P0); + if (ret) + return ret; + + return 0; +} + +static void an8855_pcs_an_restart(struct phylink_pcs *pcs) +{ + return; +} + +static const struct phylink_pcs_ops an8855_pcs_ops = { + .pcs_inband_caps = an8855_pcs_inband_caps, + .pcs_get_state = an8855_pcs_get_state, + .pcs_config = an8855_pcs_config, + .pcs_an_restart = an8855_pcs_an_restart, +}; + +static const struct phylink_mac_ops an8855_phylink_mac_ops = { + .mac_select_pcs = an8855_phylink_mac_select_pcs, + .mac_config = an8855_phylink_mac_config, + .mac_link_down = an8855_phylink_mac_link_down, + .mac_link_up = an8855_phylink_mac_link_up, +}; + +static const struct dsa_switch_ops an8855_switch_ops = { + .get_tag_protocol = an8855_get_tag_protocol, + .setup = an8855_setup, + .get_phy_flags = en8855_get_phy_flags, + .phylink_get_caps = an8855_phylink_get_caps, + .get_strings = an8855_get_strings, + .get_ethtool_stats = an8855_get_ethtool_stats, + .get_sset_count = an8855_get_sset_count, + .get_eth_mac_stats = an8855_get_eth_mac_stats, + .get_eth_ctrl_stats = an8855_get_eth_ctrl_stats, + .get_rmon_stats = an8855_get_rmon_stats, + .port_enable = an8855_port_enable, + .port_disable = an8855_port_disable, + .set_ageing_time = an8855_set_ageing_time, + .port_bridge_join = an8855_port_bridge_join, + .port_bridge_leave = an8855_port_bridge_leave, + .port_fast_age = an8855_port_fast_age, + .port_stp_state_set = an8855_port_stp_state_set, + .port_pre_bridge_flags = an8855_port_pre_bridge_flags, + .port_bridge_flags = an8855_port_bridge_flags, + .port_vlan_filtering = an8855_port_vlan_filtering, + .port_vlan_add = an8855_port_vlan_add, + .port_vlan_del = an8855_port_vlan_del, + .port_fdb_add = an8855_port_fdb_add, + .port_fdb_del = an8855_port_fdb_del, + .port_fdb_dump = an8855_port_fdb_dump, + .port_mdb_add = an8855_port_mdb_add, + .port_mdb_del = an8855_port_mdb_del, + .port_change_mtu = an8855_port_change_mtu, + .port_max_mtu = an8855_port_max_mtu, + .port_mirror_add = an8855_port_mirror_add, + .port_mirror_del = an8855_port_mirror_del, +}; + +static int an8855_read_switch_id(struct an8855_priv *priv) +{ + u32 id; + int ret; + + ret = regmap_read(priv->regmap, AN8855_CREV, &id); + if (ret) + return ret; + + if (id != AN8855_ID) { + dev_err(priv->dev, + "Switch id detected %x but expected %x\n", + id, AN8855_ID); + return -ENODEV; + } + + return 0; +} + +static int an8855_switch_probe(struct platform_device *pdev) +{ + struct an8855_priv *priv; + u32 val; + int ret; + + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + priv->dev = &pdev->dev; + priv->phy_require_calib = of_property_read_bool(priv->dev->of_node, + "airoha,ext-surge"); + + priv->reset_gpio = devm_gpiod_get_optional(priv->dev, "reset", + GPIOD_OUT_LOW); + if (IS_ERR(priv->reset_gpio)) + return PTR_ERR(priv->reset_gpio); + + /* Get regmap from MFD */ + priv->regmap = dev_get_regmap(priv->dev->parent, NULL); + + if (priv->reset_gpio) { + usleep_range(100000, 150000); + gpiod_set_value_cansleep(priv->reset_gpio, 0); + usleep_range(100000, 150000); + gpiod_set_value_cansleep(priv->reset_gpio, 1); + + /* Poll HWTRAP reg to wait for Switch to fully Init */ + ret = regmap_read_poll_timeout(priv->regmap, AN8855_HWTRAP, val, + val, 20, 200000); + if (ret) + return ret; + } + + ret = an8855_read_switch_id(priv); + if (ret) + return ret; + + priv->ds = devm_kzalloc(priv->dev, sizeof(*priv->ds), GFP_KERNEL); + if (!priv->ds) + return -ENOMEM; + + priv->ds->dev = priv->dev; + priv->ds->num_ports = AN8855_NUM_PORTS; + priv->ds->priv = priv; + priv->ds->ops = &an8855_switch_ops; + devm_mutex_init(priv->dev, &priv->reg_mutex); + priv->ds->phylink_mac_ops = &an8855_phylink_mac_ops; + + priv->pcs.ops = &an8855_pcs_ops; + priv->pcs.neg_mode = true; + priv->pcs.poll = true; + + dev_set_drvdata(priv->dev, priv); + + return dsa_register_switch(priv->ds); +} + +static int an8855_switch_remove(struct platform_device *pdev) +{ + struct an8855_priv *priv = dev_get_drvdata(&pdev->dev); + + if (!priv) + return 0; + + dsa_unregister_switch(priv->ds); + return 0; +} + +static const struct of_device_id an8855_switch_of_match[] = { + { .compatible = "airoha,an8855-switch" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, an8855_switch_of_match); + +static struct platform_driver an8855_switch_driver = { + .probe = an8855_switch_probe, + .remove = an8855_switch_remove, + .driver = { + .name = "an8855-switch", + .of_match_table = an8855_switch_of_match, + }, +}; +module_platform_driver(an8855_switch_driver); + +MODULE_AUTHOR("Min Yao "); +MODULE_AUTHOR("Christian Marangi "); +MODULE_DESCRIPTION("Driver for Airoha AN8855 Switch"); +MODULE_LICENSE("GPL"); diff --git a/target/linux/mediatek/files-6.6/drivers/net/dsa/an8855.h b/target/linux/mediatek/files-6.6/drivers/net/dsa/an8855.h new file mode 100644 index 00000000000000..2462b9d33752bc --- /dev/null +++ b/target/linux/mediatek/files-6.6/drivers/net/dsa/an8855.h @@ -0,0 +1,783 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) 2023 Min Yao + * Copyright (C) 2024 Christian Marangi + */ + +#ifndef __AN8855_H +#define __AN8855_H + +#include + +#define AN8855_NUM_PORTS 6 +#define AN8855_CPU_PORT 5 +#define AN8855_NUM_FDB_RECORDS 2048 +#define AN8855_GPHY_SMI_ADDR_DEFAULT 1 +#define AN8855_PORT_VID_DEFAULT 0 + +#define MTK_TAG_LEN 4 +#define AN8855_MAX_MTU (15360 - ETH_HLEN - ETH_FCS_LEN - MTK_TAG_LEN) + +#define AN8855_L2_AGING_MS_CONSTANT 1024 + +#define AN8855_PHY_FLAGS_EN_CALIBRATION BIT(0) + +/* AN8855_SCU 0x10000000 */ +#define AN8855_RG_GPIO_LED_MODE 0x10000054 +#define AN8855_RG_GPIO_LED_SEL(i) (0x10000000 + (0x0058 + ((i) * 4))) +#define AN8855_RG_INTB_MODE 0x10000080 +#define AN8855_RG_RGMII_TXCK_C 0x100001d0 + +#define AN8855_PKG_SEL 0x10000094 +#define AN8855_PAG_SEL_AN8855H 0x2 + +/* Register for hw trap status */ +#define AN8855_HWTRAP 0x1000009c + +#define AN8855_RG_GPIO_L_INV 0x10000010 +#define AN8855_RG_GPIO_CTRL 0x1000a300 +#define AN8855_RG_GPIO_DATA 0x1000a304 +#define AN8855_RG_GPIO_OE 0x1000a314 + +#define AN8855_CREV 0x10005000 +#define AN8855_ID 0x8855 + +/* Register for system reset */ +#define AN8855_RST_CTRL 0x100050c0 +#define AN8855_SYS_CTRL_SYS_RST BIT(31) + +#define AN8855_INT_MASK 0x100050f0 +#define AN8855_INT_SYS BIT(15) + +#define AN8855_RG_CLK_CPU_ICG 0x10005034 +#define AN8855_MCU_ENABLE BIT(3) + +#define AN8855_RG_TIMER_CTL 0x1000a100 +#define AN8855_WDOG_ENABLE BIT(25) + +#define AN8855_RG_GDMP_RAM 0x10010000 + +/* Registers to mac forward control for unknown frames */ +#define AN8855_MFC 0x10200010 +#define AN8855_CPU_EN BIT(15) +#define AN8855_CPU_PORT_IDX GENMASK(12, 8) + +#define AN8855_PAC 0x10200024 +#define AN8855_TAG_PAE_MANG_FR BIT(30) +#define AN8855_TAG_PAE_BPDU_FR BIT(28) +#define AN8855_TAG_PAE_EG_TAG GENMASK(27, 25) +#define AN8855_TAG_PAE_LKY_VLAN BIT(24) +#define AN8855_TAG_PAE_PRI_HIGH BIT(23) +#define AN8855_TAG_PAE_MIR GENMASK(20, 19) +#define AN8855_TAG_PAE_PORT_FW GENMASK(18, 16) +#define AN8855_PAE_MANG_FR BIT(14) +#define AN8855_PAE_BPDU_FR BIT(12) +#define AN8855_PAE_EG_TAG GENMASK(11, 9) +#define AN8855_PAE_LKY_VLAN BIT(8) +#define AN8855_PAE_PRI_HIGH BIT(7) +#define AN8855_PAE_MIR GENMASK(4, 3) +#define AN8855_PAE_PORT_FW GENMASK(2, 0) + +#define AN8855_RGAC1 0x10200028 +#define AN8855_R02_MANG_FR BIT(30) +#define AN8855_R02_BPDU_FR BIT(28) +#define AN8855_R02_EG_TAG GENMASK(27, 25) +#define AN8855_R02_LKY_VLAN BIT(24) +#define AN8855_R02_PRI_HIGH BIT(23) +#define AN8855_R02_MIR GENMASK(20, 19) +#define AN8855_R02_PORT_FW GENMASK(18, 16) +#define AN8855_R01_MANG_FR BIT(14) +#define AN8855_R01_BPDU_FR BIT(12) +#define AN8855_R01_EG_TAG GENMASK(11, 9) +#define AN8855_R01_LKY_VLAN BIT(8) +#define AN8855_R01_PRI_HIGH BIT(7) +#define AN8855_R01_MIR GENMASK(4, 3) +#define AN8855_R01_PORT_FW GENMASK(2, 0) + +#define AN8855_RGAC2 0x1020002c +#define AN8855_R0E_MANG_FR BIT(30) +#define AN8855_R0E_BPDU_FR BIT(28) +#define AN8855_R0E_EG_TAG GENMASK(27, 25) +#define AN8855_R0E_LKY_VLAN BIT(24) +#define AN8855_R0E_PRI_HIGH BIT(23) +#define AN8855_R0E_MIR GENMASK(20, 19) +#define AN8855_R0E_PORT_FW GENMASK(18, 16) +#define AN8855_R03_MANG_FR BIT(14) +#define AN8855_R03_BPDU_FR BIT(12) +#define AN8855_R03_EG_TAG GENMASK(11, 9) +#define AN8855_R03_LKY_VLAN BIT(8) +#define AN8855_R03_PRI_HIGH BIT(7) +#define AN8855_R03_MIR GENMASK(4, 3) +#define AN8855_R03_PORT_FW GENMASK(2, 0) + +#define AN8855_AAC 0x102000a0 +#define AN8855_MAC_AUTO_FLUSH BIT(28) +/* Control Address Table Age time. + * (AN8855_AGE_CNT + 1) * ( AN8855_AGE_UNIT + 1 ) * AN8855_L2_AGING_MS_CONSTANT + */ +#define AN8855_AGE_CNT GENMASK(20, 12) +/* Value in seconds. Value is always incremented of 1 */ +#define AN8855_AGE_UNIT GENMASK(10, 0) + +/* Registers for ARL Unknown Unicast Forward control */ +#define AN8855_UNUF 0x102000b4 + +/* Registers for ARL Unknown Multicast Forward control */ +#define AN8855_UNMF 0x102000b8 + +/* Registers for ARL Broadcast forward control */ +#define AN8855_BCF 0x102000bc + +/* Registers for port address age disable */ +#define AN8855_AGDIS 0x102000c0 + +/* Registers for mirror port control */ +#define AN8855_MIR 0x102000cc +#define AN8855_MIRROR_EN BIT(7) +#define AN8855_MIRROR_PORT GENMASK(4, 0) + +/* Registers for BPDU and PAE frame control*/ +#define AN8855_BPC 0x102000d0 +#define AN8855_BPDU_MANG_FR BIT(14) +#define AN8855_BPDU_BPDU_FR BIT(12) +#define AN8855_BPDU_EG_TAG GENMASK(11, 9) +#define AN8855_BPDU_LKY_VLAN BIT(8) +#define AN8855_BPDU_PRI_HIGH BIT(7) +#define AN8855_BPDU_MIR GENMASK(4, 3) +#define AN8855_BPDU_PORT_FW GENMASK(2, 0) + +/* Registers for IP Unknown Multicast Forward control */ +#define AN8855_UNIPMF 0x102000dc + +enum an8855_bpdu_port_fw { + AN8855_BPDU_FOLLOW_MFC = 0, + AN8855_BPDU_CPU_EXCLUDE = 4, + AN8855_BPDU_CPU_INCLUDE = 5, + AN8855_BPDU_CPU_ONLY = 6, + AN8855_BPDU_DROP = 7, +}; + +/* Register for address table control */ +#define AN8855_ATC 0x10200300 +#define AN8855_ATC_BUSY BIT(31) +#define AN8855_ATC_HASH GENMASK(24, 16) +#define AN8855_ATC_HIT GENMASK(15, 12) +#define AN8855_ATC_MAT_MASK GENMASK(11, 7) +#define AN8855_ATC_MAT(x) FIELD_PREP(AN8855_ATC_MAT_MASK, x) +#define AN8855_ATC_SAT GENMASK(5, 4) +#define AN8855_ATC_CMD GENMASK(2, 0) + +enum an8855_fdb_mat_cmds { + AND8855_FDB_MAT_ALL = 0, + AND8855_FDB_MAT_MAC, /* All MAC address */ + AND8855_FDB_MAT_DYNAMIC_MAC, /* All Dynamic MAC address */ + AND8855_FDB_MAT_STATIC_MAC, /* All Static Mac Address */ + AND8855_FDB_MAT_DIP, /* All DIP/GA address */ + AND8855_FDB_MAT_DIP_IPV4, /* All DIP/GA IPv4 address */ + AND8855_FDB_MAT_DIP_IPV6, /* All DIP/GA IPv6 address */ + AND8855_FDB_MAT_DIP_SIP, /* All DIP_SIP address */ + AND8855_FDB_MAT_DIP_SIP_IPV4, /* All DIP_SIP IPv4 address */ + AND8855_FDB_MAT_DIP_SIP_IPV6, /* All DIP_SIP IPv6 address */ + AND8855_FDB_MAT_MAC_CVID, /* All MAC address with CVID */ + AND8855_FDB_MAT_MAC_FID, /* All MAC address with Filter ID */ + AND8855_FDB_MAT_MAC_PORT, /* All MAC address with port */ + AND8855_FDB_MAT_DIP_SIP_DIP_IPV4, /* All DIP_SIP address with DIP_IPV4 */ + AND8855_FDB_MAT_DIP_SIP_SIP_IPV4, /* All DIP_SIP address with SIP_IPV4 */ + AND8855_FDB_MAT_DIP_SIP_DIP_IPV6, /* All DIP_SIP address with DIP_IPV6 */ + AND8855_FDB_MAT_DIP_SIP_SIP_IPV6, /* All DIP_SIP address with SIP_IPV6 */ + /* All MAC address with MAC type (dynamic or static) with CVID */ + AND8855_FDB_MAT_MAC_TYPE_CVID, + /* All MAC address with MAC type (dynamic or static) with Filter ID */ + AND8855_FDB_MAT_MAC_TYPE_FID, + /* All MAC address with MAC type (dynamic or static) with port */ + AND8855_FDB_MAT_MAC_TYPE_PORT, +}; + +enum an8855_fdb_cmds { + AN8855_FDB_READ = 0, + AN8855_FDB_WRITE = 1, + AN8855_FDB_FLUSH = 2, + AN8855_FDB_START = 4, + AN8855_FDB_NEXT = 5, +}; + +/* Registers for address table access */ +#define AN8855_ATA1 0x10200304 +#define AN8855_ATA1_MAC0 GENMASK(31, 24) +#define AN8855_ATA1_MAC1 GENMASK(23, 16) +#define AN8855_ATA1_MAC2 GENMASK(15, 8) +#define AN8855_ATA1_MAC3 GENMASK(7, 0) +#define AN8855_ATA2 0x10200308 +#define AN8855_ATA2_MAC4 GENMASK(31, 24) +#define AN8855_ATA2_MAC5 GENMASK(23, 16) +#define AN8855_ATA2_UNAUTH BIT(10) +#define AN8855_ATA2_TYPE BIT(9) /* 1: dynamic, 0: static */ +#define AN8855_ATA2_AGE GENMASK(8, 0) + +/* Register for address table write data */ +#define AN8855_ATWD 0x10200324 +#define AN8855_ATWD_FID GENMASK(31, 28) +#define AN8855_ATWD_VID GENMASK(27, 16) +#define AN8855_ATWD_IVL BIT(15) +#define AN8855_ATWD_EG_TAG GENMASK(14, 12) +#define AN8855_ATWD_SA_MIR GENMASK(9, 8) +#define AN8855_ATWD_SA_FWD GENMASK(7, 5) +#define AN8855_ATWD_UPRI GENMASK(4, 2) +#define AN8855_ATWD_LEAKY BIT(1) +#define AN8855_ATWD_VLD BIT(0) /* vid LOAD */ +#define AN8855_ATWD2 0x10200328 +#define AN8855_ATWD2_PORT GENMASK(7, 0) + +/* Registers for table search read address */ +#define AN8855_ATRDS 0x10200330 +#define AN8855_ATRD_SEL GENMASK(1, 0) +#define AN8855_ATRD0 0x10200334 +#define AN8855_ATRD0_FID GENMASK(28, 25) +#define AN8855_ATRD0_VID GENMASK(21, 10) +#define AN8855_ATRD0_IVL BIT(9) +#define AN8855_ATRD0_TYPE GENMASK(4, 3) +#define AN8855_ATRD0_ARP GENMASK(2, 1) +#define AN8855_ATRD0_LIVE BIT(0) +#define AN8855_ATRD1 0x10200338 +#define AN8855_ATRD1_MAC4 GENMASK(31, 24) +#define AN8855_ATRD1_MAC5 GENMASK(23, 16) +#define AN8855_ATRD1_AGING GENMASK(11, 3) +#define AN8855_ATRD2 0x1020033c +#define AN8855_ATRD2_MAC0 GENMASK(31, 24) +#define AN8855_ATRD2_MAC1 GENMASK(23, 16) +#define AN8855_ATRD2_MAC2 GENMASK(15, 8) +#define AN8855_ATRD2_MAC3 GENMASK(7, 0) +#define AN8855_ATRD3 0x10200340 +#define AN8855_ATRD3_PORTMASK GENMASK(7, 0) + +enum an8855_fdb_type { + AN8855_MAC_TB_TY_MAC = 0, + AN8855_MAC_TB_TY_DIP = 1, + AN8855_MAC_TB_TY_DIP_SIP = 2, +}; + +/* Register for vlan table control */ +#define AN8855_VTCR 0x10200600 +#define AN8855_VTCR_BUSY BIT(31) +#define AN8855_VTCR_FUNC GENMASK(15, 12) +#define AN8855_VTCR_VID GENMASK(11, 0) + +enum an8855_vlan_cmd { + /* Read/Write the specified VID entry from VAWD register based + * on VID. + */ + AN8855_VTCR_RD_VID = 0, + AN8855_VTCR_WR_VID = 1, +}; + +/* Register for setup vlan write data */ +#define AN8855_VAWD0 0x10200604 +/* VLAN Member Control */ +#define AN8855_VA0_PORT GENMASK(31, 26) +/* Egress Tag Control */ +#define AN8855_VA0_ETAG GENMASK(23, 12) +#define AN8855_VA0_ETAG_PORT GENMASK(13, 12) +#define AN8855_VA0_ETAG_PORT_SHIFT(port) ((port) * 2) +#define AN8855_VA0_ETAG_PORT_MASK(port) (AN8855_VA0_ETAG_PORT << \ + AN8855_VA0_ETAG_PORT_SHIFT(port)) +#define AN8855_VA0_ETAG_PORT_VAL(port, val) (FIELD_PREP(AN8855_VA0_ETAG_PORT, (val)) << \ + AN8855_VA0_ETAG_PORT_SHIFT(port)) +#define AN8855_VA0_EG_CON BIT(11) +#define AN8855_VA0_VTAG_EN BIT(10) /* Per VLAN Egress Tag Control */ +#define AN8855_VA0_IVL_MAC BIT(5) /* Independent VLAN Learning */ +#define AN8855_VA0_FID GENMASK(4, 1) +#define AN8855_VA0_VLAN_VALID BIT(0) /* VLAN Entry Valid */ +#define AN8855_VAWD1 0x10200608 +#define AN8855_VA1_PORT_STAG BIT(1) + +enum an8855_fid { + AN8855_FID_STANDALONE = 0, + AN8855_FID_BRIDGED = 1, +}; + +/* Same register field of VAWD0 */ +#define AN8855_VARD0 0x10200618 + +enum an8855_vlan_egress_attr { + AN8855_VLAN_EGRESS_UNTAG = 0, + AN8855_VLAN_EGRESS_TAG = 2, + AN8855_VLAN_EGRESS_STACK = 3, +}; + +/* Register for port STP state control */ +#define AN8855_SSP_P(x) (0x10208000 + ((x) * 0x200)) +/* Up to 16 FID supported, each with the same mask */ +#define AN8855_FID_PST GENMASK(1, 0) +#define AN8855_FID_PST_SHIFT(fid) (2 * (fid)) +#define AN8855_FID_PST_MASK(fid) (AN8855_FID_PST << \ + AN8855_FID_PST_SHIFT(fid)) +#define AN8855_FID_PST_VAL(fid, val) (FIELD_PREP(AN8855_FID_PST, (val)) << \ + AN8855_FID_PST_SHIFT(fid)) + +enum an8855_stp_state { + AN8855_STP_DISABLED = 0, + AN8855_STP_BLOCKING = 1, + AN8855_STP_LISTENING = AN8855_STP_BLOCKING, + AN8855_STP_LEARNING = 2, + AN8855_STP_FORWARDING = 3 +}; + +/* Register for port control */ +#define AN8855_PCR_P(x) (0x10208004 + ((x) * 0x200)) +#define AN8855_EG_TAG GENMASK(29, 28) +#define AN8855_PORT_PRI GENMASK(26, 24) +#define AN8855_PORT_TX_MIR BIT(20) +#define AN8855_PORT_RX_MIR BIT(16) +#define AN8855_PORT_VLAN GENMASK(1, 0) + +enum an8855_port_mode { + /* Port Matrix Mode: Frames are forwarded by the PCR_MATRIX members. */ + AN8855_PORT_MATRIX_MODE = 0, + + /* Fallback Mode: Forward received frames with ingress ports that do + * not belong to the VLAN member. Frames whose VID is not listed on + * the VLAN table are forwarded by the PCR_MATRIX members. + */ + AN8855_PORT_FALLBACK_MODE = 1, + + /* Check Mode: Forward received frames whose ingress do not + * belong to the VLAN member. Discard frames if VID ismiddes on the + * VLAN table. + */ + AN8855_PORT_CHECK_MODE = 2, + + /* Security Mode: Discard any frame due to ingress membership + * violation or VID missed on the VLAN table. + */ + AN8855_PORT_SECURITY_MODE = 3, +}; + +/* Register for port security control */ +#define AN8855_PSC_P(x) (0x1020800c + ((x) * 0x200)) +#define AN8855_SA_DIS BIT(4) + +/* Register for port vlan control */ +#define AN8855_PVC_P(x) (0x10208010 + ((x) * 0x200)) +#define AN8855_PORT_SPEC_REPLACE_MODE BIT(11) +#define AN8855_PVC_EG_TAG GENMASK(10, 8) +#define AN8855_VLAN_ATTR GENMASK(7, 6) +#define AN8855_PORT_SPEC_TAG BIT(5) +#define AN8855_ACC_FRM GENMASK(1, 0) + +enum an8855_vlan_port_eg_tag { + AN8855_VLAN_EG_DISABLED = 0, + AN8855_VLAN_EG_CONSISTENT = 1, + AN8855_VLAN_EG_UNTAGGED = 4, + AN8855_VLAN_EG_SWAP = 5, + AN8855_VLAN_EG_TAGGED = 6, + AN8855_VLAN_EG_STACK = 7, +}; + +enum an8855_vlan_port_attr { + AN8855_VLAN_USER = 0, + AN8855_VLAN_STACK = 1, + AN8855_VLAN_TRANSPARENT = 3, +}; + +enum an8855_vlan_port_acc_frm { + AN8855_VLAN_ACC_ALL = 0, + AN8855_VLAN_ACC_TAGGED = 1, + AN8855_VLAN_ACC_UNTAGGED = 2, +}; + +#define AN8855_PPBV1_P(x) (0x10208014 + ((x) * 0x200)) +#define AN8855_PPBV_G0_PORT_VID GENMASK(11, 0) + +#define AN8855_PORTMATRIX_P(x) (0x10208044 + ((x) * 0x200)) +#define AN8855_PORTMATRIX GENMASK(5, 0) +/* Port matrix without the CPU port that should never be removed */ +#define AN8855_USER_PORTMATRIX GENMASK(4, 0) + +/* Register for port PVID */ +#define AN8855_PVID_P(x) (0x10208048 + ((x) * 0x200)) +#define AN8855_G0_PORT_VID GENMASK(11, 0) + +/* Register for port MAC control register */ +#define AN8855_PMCR_P(x) (0x10210000 + ((x) * 0x200)) +#define AN8855_PMCR_FORCE_MODE BIT(31) +#define AN8855_PMCR_FORCE_SPEED GENMASK(30, 28) +#define AN8855_PMCR_FORCE_SPEED_5000 FIELD_PREP_CONST(AN8855_PMCR_FORCE_SPEED, 0x4) +#define AN8855_PMCR_FORCE_SPEED_2500 FIELD_PREP_CONST(AN8855_PMCR_FORCE_SPEED, 0x3) +#define AN8855_PMCR_FORCE_SPEED_1000 FIELD_PREP_CONST(AN8855_PMCR_FORCE_SPEED, 0x2) +#define AN8855_PMCR_FORCE_SPEED_100 FIELD_PREP_CONST(AN8855_PMCR_FORCE_SPEED, 0x1) +#define AN8855_PMCR_FORCE_SPEED_10 FIELD_PREP_CONST(AN8855_PMCR_FORCE_SPEED, 0x1) +#define AN8855_PMCR_FORCE_FDX BIT(25) +#define AN8855_PMCR_FORCE_LNK BIT(24) +#define AN8855_PMCR_IFG_XMIT GENMASK(21, 20) +#define AN8855_PMCR_EXT_PHY BIT(19) +#define AN8855_PMCR_MAC_MODE BIT(18) +#define AN8855_PMCR_TX_EN BIT(16) +#define AN8855_PMCR_RX_EN BIT(15) +#define AN8855_PMCR_BACKOFF_EN BIT(12) +#define AN8855_PMCR_BACKPR_EN BIT(11) +#define AN8855_PMCR_FORCE_EEE5G BIT(9) +#define AN8855_PMCR_FORCE_EEE2P5G BIT(8) +#define AN8855_PMCR_FORCE_EEE1G BIT(7) +#define AN8855_PMCR_FORCE_EEE100 BIT(6) +#define AN8855_PMCR_TX_FC_EN BIT(5) +#define AN8855_PMCR_RX_FC_EN BIT(4) + +#define AN8855_PMSR_P(x) (0x10210010 + (x) * 0x200) +#define AN8855_PMSR_SPEED GENMASK(30, 28) +#define AN8855_PMSR_SPEED_5000 FIELD_PREP_CONST(AN8855_PMSR_SPEED, 0x4) +#define AN8855_PMSR_SPEED_2500 FIELD_PREP_CONST(AN8855_PMSR_SPEED, 0x3) +#define AN8855_PMSR_SPEED_1000 FIELD_PREP_CONST(AN8855_PMSR_SPEED, 0x2) +#define AN8855_PMSR_SPEED_100 FIELD_PREP_CONST(AN8855_PMSR_SPEED, 0x1) +#define AN8855_PMSR_SPEED_10 FIELD_PREP_CONST(AN8855_PMSR_SPEED, 0x0) +#define AN8855_PMSR_DPX BIT(25) +#define AN8855_PMSR_LNK BIT(24) +#define AN8855_PMSR_EEE1G BIT(7) +#define AN8855_PMSR_EEE100M BIT(6) +#define AN8855_PMSR_RX_FC BIT(5) +#define AN8855_PMSR_TX_FC BIT(4) + +#define AN8855_PMEEECR_P(x) (0x10210004 + (x) * 0x200) +#define AN8855_LPI_MODE_EN BIT(31) +#define AN8855_WAKEUP_TIME_2500 GENMASK(23, 16) +#define AN8855_WAKEUP_TIME_1000 GENMASK(15, 8) +#define AN8855_WAKEUP_TIME_100 GENMASK(7, 0) +#define AN8855_PMEEECR2_P(x) (0x10210008 + (x) * 0x200) +#define AN8855_WAKEUP_TIME_5000 GENMASK(7, 0) + +#define AN8855_GMACCR 0x10213e00 +#define AN8855_MAX_RX_JUMBO GENMASK(7, 4) +/* 2K for 0x0, 0x1, 0x2 */ +#define AN8855_MAX_RX_JUMBO_2K FIELD_PREP_CONST(AN8855_MAX_RX_JUMBO, 0x0) +#define AN8855_MAX_RX_JUMBO_3K FIELD_PREP_CONST(AN8855_MAX_RX_JUMBO, 0x3) +#define AN8855_MAX_RX_JUMBO_4K FIELD_PREP_CONST(AN8855_MAX_RX_JUMBO, 0x4) +#define AN8855_MAX_RX_JUMBO_5K FIELD_PREP_CONST(AN8855_MAX_RX_JUMBO, 0x5) +#define AN8855_MAX_RX_JUMBO_6K FIELD_PREP_CONST(AN8855_MAX_RX_JUMBO, 0x6) +#define AN8855_MAX_RX_JUMBO_7K FIELD_PREP_CONST(AN8855_MAX_RX_JUMBO, 0x7) +#define AN8855_MAX_RX_JUMBO_8K FIELD_PREP_CONST(AN8855_MAX_RX_JUMBO, 0x8) +#define AN8855_MAX_RX_JUMBO_9K FIELD_PREP_CONST(AN8855_MAX_RX_JUMBO, 0x9) +#define AN8855_MAX_RX_JUMBO_12K FIELD_PREP_CONST(AN8855_MAX_RX_JUMBO, 0xa) +#define AN8855_MAX_RX_JUMBO_15K FIELD_PREP_CONST(AN8855_MAX_RX_JUMBO, 0xb) +#define AN8855_MAX_RX_JUMBO_16K FIELD_PREP_CONST(AN8855_MAX_RX_JUMBO, 0xc) +#define AN8855_MAX_RX_PKT_LEN GENMASK(1, 0) +#define AN8855_MAX_RX_PKT_1518_1522 FIELD_PREP_CONST(AN8855_MAX_RX_PKT_LEN, 0x0) +#define AN8855_MAX_RX_PKT_1536 FIELD_PREP_CONST(AN8855_MAX_RX_PKT_LEN, 0x1) +#define AN8855_MAX_RX_PKT_1552 FIELD_PREP_CONST(AN8855_MAX_RX_PKT_LEN, 0x2) +#define AN8855_MAX_RX_PKT_JUMBO FIELD_PREP_CONST(AN8855_MAX_RX_PKT_LEN, 0x3) + +#define AN8855_CKGCR 0x10213e1c +#define AN8855_LPI_TXIDLE_THD_MASK GENMASK(31, 14) +#define AN8855_CKG_LNKDN_PORT_STOP BIT(1) +#define AN8855_CKG_LNKDN_GLB_STOP BIT(0) + +/* Register for MIB */ +#define AN8855_PORT_MIB_COUNTER(x) (0x10214000 + (x) * 0x200) +/* Each define is an offset of AN8855_PORT_MIB_COUNTER */ +#define AN8855_PORT_MIB_TX_DROP 0x00 +#define AN8855_PORT_MIB_TX_CRC_ERR 0x04 +#define AN8855_PORT_MIB_TX_UNICAST 0x08 +#define AN8855_PORT_MIB_TX_MULTICAST 0x0c +#define AN8855_PORT_MIB_TX_BROADCAST 0x10 +#define AN8855_PORT_MIB_TX_COLLISION 0x14 +#define AN8855_PORT_MIB_TX_SINGLE_COLLISION 0x18 +#define AN8855_PORT_MIB_TX_MULTIPLE_COLLISION 0x1c +#define AN8855_PORT_MIB_TX_DEFERRED 0x20 +#define AN8855_PORT_MIB_TX_LATE_COLLISION 0x24 +#define AN8855_PORT_MIB_TX_EXCESSIVE_COLLISION 0x28 +#define AN8855_PORT_MIB_TX_PAUSE 0x2c +#define AN8855_PORT_MIB_TX_PKT_SZ_64 0x30 +#define AN8855_PORT_MIB_TX_PKT_SZ_65_TO_127 0x34 +#define AN8855_PORT_MIB_TX_PKT_SZ_128_TO_255 0x38 +#define AN8855_PORT_MIB_TX_PKT_SZ_256_TO_511 0x3 +#define AN8855_PORT_MIB_TX_PKT_SZ_512_TO_1023 0x40 +#define AN8855_PORT_MIB_TX_PKT_SZ_1024_TO_1518 0x44 +#define AN8855_PORT_MIB_TX_PKT_SZ_1519_TO_MAX 0x48 +#define AN8855_PORT_MIB_TX_BYTES 0x4c /* 64 bytes */ +#define AN8855_PORT_MIB_TX_OVERSIZE_DROP 0x54 +#define AN8855_PORT_MIB_TX_BAD_PKT_BYTES 0x58 /* 64 bytes */ +#define AN8855_PORT_MIB_RX_DROP 0x80 +#define AN8855_PORT_MIB_RX_FILTERING 0x84 +#define AN8855_PORT_MIB_RX_UNICAST 0x88 +#define AN8855_PORT_MIB_RX_MULTICAST 0x8c +#define AN8855_PORT_MIB_RX_BROADCAST 0x90 +#define AN8855_PORT_MIB_RX_ALIGN_ERR 0x94 +#define AN8855_PORT_MIB_RX_CRC_ERR 0x98 +#define AN8855_PORT_MIB_RX_UNDER_SIZE_ERR 0x9c +#define AN8855_PORT_MIB_RX_FRAG_ERR 0xa0 +#define AN8855_PORT_MIB_RX_OVER_SZ_ERR 0xa4 +#define AN8855_PORT_MIB_RX_JABBER_ERR 0xa8 +#define AN8855_PORT_MIB_RX_PAUSE 0xac +#define AN8855_PORT_MIB_RX_PKT_SZ_64 0xb0 +#define AN8855_PORT_MIB_RX_PKT_SZ_65_TO_127 0xb4 +#define AN8855_PORT_MIB_RX_PKT_SZ_128_TO_255 0xb8 +#define AN8855_PORT_MIB_RX_PKT_SZ_256_TO_511 0xbc +#define AN8855_PORT_MIB_RX_PKT_SZ_512_TO_1023 0xc0 +#define AN8855_PORT_MIB_RX_PKT_SZ_1024_TO_1518 0xc4 +#define AN8855_PORT_MIB_RX_PKT_SZ_1519_TO_MAX 0xc8 +#define AN8855_PORT_MIB_RX_BYTES 0xcc /* 64 bytes */ +#define AN8855_PORT_MIB_RX_CTRL_DROP 0xd4 +#define AN8855_PORT_MIB_RX_INGRESS_DROP 0xd8 +#define AN8855_PORT_MIB_RX_ARL_DROP 0xdc +#define AN8855_PORT_MIB_FLOW_CONTROL_DROP 0xe0 +#define AN8855_PORT_MIB_WRED_DROP 0xe4 +#define AN8855_PORT_MIB_MIRROR_DROP 0xe8 +#define AN8855_PORT_MIB_RX_BAD_PKT_BYTES 0xec /* 64 bytes */ +#define AN8855_PORT_MIB_RXS_FLOW_SAMPLING_PKT_DROP 0xf4 +#define AN8855_PORT_MIB_RXS_FLOW_TOTAL_PKT_DROP 0xf8 +#define AN8855_PORT_MIB_PORT_CONTROL_DROP 0xfc +#define AN8855_MIB_CCR 0x10213e30 +#define AN8855_CCR_MIB_ENABLE BIT(31) +#define AN8855_CCR_RX_OCT_CNT_GOOD BIT(7) +#define AN8855_CCR_RX_OCT_CNT_BAD BIT(6) +#define AN8855_CCR_TX_OCT_CNT_GOOD BIT(5) +#define AN8855_CCR_TX_OCT_CNT_BAD BIT(4) +#define AN8855_CCR_RX_OCT_CNT_GOOD_2 BIT(3) +#define AN8855_CCR_RX_OCT_CNT_BAD_2 BIT(2) +#define AN8855_CCR_TX_OCT_CNT_GOOD_2 BIT(1) +#define AN8855_CCR_TX_OCT_CNT_BAD_2 BIT(0) +#define AN8855_CCR_MIB_ACTIVATE (AN8855_CCR_MIB_ENABLE | \ + AN8855_CCR_RX_OCT_CNT_GOOD | \ + AN8855_CCR_RX_OCT_CNT_BAD | \ + AN8855_CCR_TX_OCT_CNT_GOOD | \ + AN8855_CCR_TX_OCT_CNT_BAD | \ + AN8855_CCR_RX_OCT_CNT_BAD_2 | \ + AN8855_CCR_TX_OCT_CNT_BAD_2) +#define AN8855_MIB_CLR 0x10213e34 +#define AN8855_MIB_PORT6_CLR BIT(6) +#define AN8855_MIB_PORT5_CLR BIT(5) +#define AN8855_MIB_PORT4_CLR BIT(4) +#define AN8855_MIB_PORT3_CLR BIT(3) +#define AN8855_MIB_PORT2_CLR BIT(2) +#define AN8855_MIB_PORT1_CLR BIT(1) +#define AN8855_MIB_PORT0_CLR BIT(0) + +/* HSGMII/SGMII Configuration register */ +/* AN8855_HSGMII_AN_CSR_BASE 0x10220000 */ +#define AN8855_SGMII_REG_AN0 0x10220000 +/* AN8855_SGMII_AN_ENABLE BMCR_ANENABLE */ +/* AN8855_SGMII_AN_RESTART BMCR_ANRESTART */ +#define AN8855_SGMII_REG_AN_13 0x10220034 +#define AN8855_SGMII_REMOTE_FAULT_DIS BIT(8) +#define AN8855_SGMII_IF_MODE GENMASK(5, 0) +#define AN8855_SGMII_REG_AN_FORCE_CL37 0x10220060 +#define AN8855_RG_FORCE_AN_DONE BIT(0) + +/* AN8855_HSGMII_CSR_PCS_BASE 0x10220000 */ +#define AN8855_RG_HSGMII_PCS_CTROL_1 0x10220a00 +#define AN8855_RG_TBI_10B_MODE BIT(30) +#define AN8855_RG_AN_SGMII_MODE_FORCE 0x10220a24 +#define AN8855_RG_FORCE_CUR_SGMII_MODE GENMASK(5, 4) +#define AN8855_RG_FORCE_CUR_SGMII_SEL BIT(0) + +/* AN8855_MULTI_SGMII_CSR_BASE 0x10224000 */ +#define AN8855_SGMII_STS_CTRL_0 0x10224018 +#define AN8855_RG_LINK_MODE_P0 GENMASK(5, 4) +#define AN8855_RG_LINK_MODE_P0_SPEED_2500 FIELD_PREP_CONST(AN8855_RG_LINK_MODE_P0, 0x3) +#define AN8855_RG_LINK_MODE_P0_SPEED_1000 FIELD_PREP_CONST(AN8855_RG_LINK_MODE_P0, 0x2) +#define AN8855_RG_LINK_MODE_P0_SPEED_100 FIELD_PREP_CONST(AN8855_RG_LINK_MODE_P0, 0x1) +#define AN8855_RG_LINK_MODE_P0_SPEED_10 FIELD_PREP_CONST(AN8855_RG_LINK_MODE_P0, 0x0) +#define AN8855_RG_FORCE_SPD_MODE_P0 BIT(2) +#define AN8855_MSG_RX_CTRL_0 0x10224100 +#define AN8855_MSG_RX_LIK_STS_0 0x10224514 +#define AN8855_RG_DPX_STS_P3 BIT(24) +#define AN8855_RG_DPX_STS_P2 BIT(16) +#define AN8855_RG_EEE1G_STS_P1 BIT(12) +#define AN8855_RG_DPX_STS_P1 BIT(8) +#define AN8855_RG_TXFC_STS_P0 BIT(2) +#define AN8855_RG_RXFC_STS_P0 BIT(1) +#define AN8855_RG_DPX_STS_P0 BIT(0) +#define AN8855_MSG_RX_LIK_STS_2 0x1022451c +#define AN8855_RG_RXFC_AN_BYPASS_P3 BIT(11) +#define AN8855_RG_RXFC_AN_BYPASS_P2 BIT(10) +#define AN8855_RG_RXFC_AN_BYPASS_P1 BIT(9) +#define AN8855_RG_TXFC_AN_BYPASS_P3 BIT(7) +#define AN8855_RG_TXFC_AN_BYPASS_P2 BIT(6) +#define AN8855_RG_TXFC_AN_BYPASS_P1 BIT(5) +#define AN8855_RG_DPX_AN_BYPASS_P3 BIT(3) +#define AN8855_RG_DPX_AN_BYPASS_P2 BIT(2) +#define AN8855_RG_DPX_AN_BYPASS_P1 BIT(1) +#define AN8855_RG_DPX_AN_BYPASS_P0 BIT(0) +#define AN8855_PHY_RX_FORCE_CTRL_0 0x10224520 +#define AN8855_RG_FORCE_TXC_SEL BIT(4) + +/* AN8855_XFI_CSR_PCS_BASE 0x10225000 */ +#define AN8855_RG_USXGMII_AN_CONTROL_0 0x10225bf8 + +/* AN8855_MULTI_PHY_RA_CSR_BASE 0x10226000 */ +#define AN8855_RG_RATE_ADAPT_CTRL_0 0x10226000 +#define AN8855_RG_RATE_ADAPT_RX_BYPASS BIT(27) +#define AN8855_RG_RATE_ADAPT_TX_BYPASS BIT(26) +#define AN8855_RG_RATE_ADAPT_RX_EN BIT(4) +#define AN8855_RG_RATE_ADAPT_TX_EN BIT(0) +#define AN8855_RATE_ADP_P0_CTRL_0 0x10226100 +#define AN8855_RG_P0_DIS_MII_MODE BIT(31) +#define AN8855_RG_P0_MII_MODE BIT(28) +#define AN8855_RG_P0_MII_RA_RX_EN BIT(3) +#define AN8855_RG_P0_MII_RA_TX_EN BIT(2) +#define AN8855_RG_P0_MII_RA_RX_MODE BIT(1) +#define AN8855_RG_P0_MII_RA_TX_MODE BIT(0) +#define AN8855_MII_RA_AN_ENABLE 0x10226300 +#define AN8855_RG_P0_RA_AN_EN BIT(0) + +/* AN8855_QP_DIG_CSR_BASE 0x1022a000 */ +#define AN8855_QP_CK_RST_CTRL_4 0x1022a310 +#define AN8855_QP_DIG_MODE_CTRL_0 0x1022a324 +#define AN8855_RG_SGMII_MODE GENMASK(5, 4) +#define AN8855_RG_SGMII_AN_EN BIT(0) +#define AN8855_QP_DIG_MODE_CTRL_1 0x1022a330 +#define AN8855_RG_TPHY_SPEED GENMASK(3, 2) + +/* AN8855_SERDES_WRAPPER_BASE 0x1022c000 */ +#define AN8855_USGMII_CTRL_0 0x1022c000 + +/* AN8855_QP_PMA_TOP_BASE 0x1022e000 */ +#define AN8855_PON_RXFEDIG_CTRL_0 0x1022e100 +#define AN8855_RG_QP_EQ_RX500M_CK_SEL BIT(12) +#define AN8855_PON_RXFEDIG_CTRL_9 0x1022e124 +#define AN8855_RG_QP_EQ_LEQOSC_DLYCNT GENMASK(2, 0) + +#define AN8855_SS_LCPLL_PWCTL_SETTING_2 0x1022e208 +#define AN8855_RG_NCPO_ANA_MSB GENMASK(17, 16) +#define AN8855_SS_LCPLL_TDC_FLT_2 0x1022e230 +#define AN8855_RG_LCPLL_NCPO_VALUE GENMASK(30, 0) +#define AN8855_SS_LCPLL_TDC_FLT_5 0x1022e23c +#define AN8855_RG_LCPLL_NCPO_CHG BIT(24) +#define AN8855_SS_LCPLL_TDC_PCW_1 0x1022e248 +#define AN8855_RG_LCPLL_PON_HRDDS_PCW_NCPO_GPON GENMASK(30, 0) +#define AN8855_INTF_CTRL_8 0x1022e320 +#define AN8855_INTF_CTRL_9 0x1022e324 +#define AN8855_INTF_CTRL_10 0x1022e328 +#define AN8855_RG_DA_QP_TX_FIR_C2_SEL BIT(29) +#define AN8855_RG_DA_QP_TX_FIR_C2_FORCE GENMASK(28, 24) +#define AN8855_RG_DA_QP_TX_FIR_C1_SEL BIT(21) +#define AN8855_RG_DA_QP_TX_FIR_C1_FORCE GENMASK(20, 16) +#define AN8855_INTF_CTRL_11 0x1022e32c +#define AN8855_RG_DA_QP_TX_FIR_C0B_SEL BIT(6) +#define AN8855_RG_DA_QP_TX_FIR_C0B_FORCE GENMASK(5, 0) +#define AN8855_PLL_CTRL_0 0x1022e400 +#define AN8855_RG_PHYA_AUTO_INIT BIT(0) +#define AN8855_PLL_CTRL_2 0x1022e408 +#define AN8855_RG_DA_QP_PLL_SDM_IFM_INTF BIT(30) +#define AN8855_RG_DA_QP_PLL_RICO_SEL_INTF BIT(29) +#define AN8855_RG_DA_QP_PLL_POSTDIV_EN_INTF BIT(28) +#define AN8855_RG_DA_QP_PLL_PHY_CK_EN_INTF BIT(27) +#define AN8855_RG_DA_QP_PLL_PFD_OFFSET_EN_INTRF BIT(26) +#define AN8855_RG_DA_QP_PLL_PFD_OFFSET_INTF GENMASK(25, 24) +#define AN8855_RG_DA_QP_PLL_PCK_SEL_INTF BIT(22) +#define AN8855_RG_DA_QP_PLL_KBAND_PREDIV_INTF GENMASK(21, 20) +#define AN8855_RG_DA_QP_PLL_IR_INTF GENMASK(19, 16) +#define AN8855_RG_DA_QP_PLL_ICOIQ_EN_INTF BIT(14) +#define AN8855_RG_DA_QP_PLL_FBKSEL_INTF GENMASK(13, 12) +#define AN8855_RG_DA_QP_PLL_BR_INTF GENMASK(10, 8) +#define AN8855_RG_DA_QP_PLL_BPD_INTF GENMASK(7, 6) +#define AN8855_RG_DA_QP_PLL_BPA_INTF GENMASK(4, 2) +#define AN8855_RG_DA_QP_PLL_BC_INTF GENMASK(1, 0) +#define AN8855_PLL_CTRL_3 0x1022e40c +#define AN8855_RG_DA_QP_PLL_SSC_PERIOD_INTF GENMASK(31, 16) +#define AN8855_RG_DA_QP_PLL_SSC_DELTA_INTF GENMASK(15, 0) +#define AN8855_PLL_CTRL_4 0x1022e410 +#define AN8855_RG_DA_QP_PLL_SDM_HREN_INTF GENMASK(4, 3) +#define AN8855_RG_DA_QP_PLL_ICOLP_EN_INTF BIT(2) +#define AN8855_RG_DA_QP_PLL_SSC_DIR_DLY_INTF GENMASK(1, 0) +#define AN8855_PLL_CK_CTRL_0 0x1022e414 +#define AN8855_RG_DA_QP_PLL_TDC_TXCK_SEL_INTF BIT(9) +#define AN8855_RG_DA_QP_PLL_SDM_DI_EN_INTF BIT(8) +#define AN8855_RX_DLY_0 0x1022e614 +#define AN8855_RG_QP_RX_SAOSC_EN_H_DLY GENMASK(13, 8) +#define AN8855_RG_QP_RX_PI_CAL_EN_H_DLY GENMASK(7, 0) +#define AN8855_RX_CTRL_2 0x1022e630 +#define AN8855_RG_QP_RX_EQ_EN_H_DLY GENMASK(28, 16) +#define AN8855_RX_CTRL_5 0x1022e63c +#define AN8855_RG_FREDET_CHK_CYCLE GENMASK(29, 10) +#define AN8855_RX_CTRL_6 0x1022e640 +#define AN8855_RG_FREDET_GOLDEN_CYCLE GENMASK(19, 0) +#define AN8855_RX_CTRL_7 0x1022e644 +#define AN8855_RG_FREDET_TOLERATE_CYCLE GENMASK(19, 0) +#define AN8855_RX_CTRL_8 0x1022e648 +#define AN8855_RG_DA_QP_SAOSC_DONE_TIME GENMASK(27, 16) +#define AN8855_RG_DA_QP_LEQOS_EN_TIME GENMASK(14, 0) +#define AN8855_RX_CTRL_26 0x1022e690 +#define AN8855_RG_QP_EQ_RETRAIN_ONLY_EN BIT(26) +#define AN8855_RG_LINK_NE_EN BIT(24) +#define AN8855_RG_LINK_ERRO_EN BIT(23) +#define AN8855_RX_CTRL_42 0x1022e6d0 +#define AN8855_RG_QP_EQ_EN_DLY GENMASK(12, 0) + +/* AN8855_QP_ANA_CSR_BASE 0x1022f000 */ +#define AN8855_RG_QP_RX_DAC_EN 0x1022f000 +#define AN8855_RG_QP_SIGDET_HF GENMASK(17, 16) +#define AN8855_RG_QP_RXAFE_RESERVE 0x1022f004 +#define AN8855_RG_QP_CDR_PD_10B_EN BIT(11) +#define AN8855_RG_QP_CDR_LPF_BOT_LIM 0x1022f008 +#define AN8855_RG_QP_CDR_LPF_KP_GAIN GENMASK(26, 24) +#define AN8855_RG_QP_CDR_LPF_KI_GAIN GENMASK(22, 20) +#define AN8855_RG_QP_CDR_LPF_MJV_LIM 0x1022f00c +#define AN8855_RG_QP_CDR_LPF_RATIO GENMASK(5, 4) +#define AN8855_RG_QP_CDR_LPF_SETVALUE 0x1022f014 +#define AN8855_RG_QP_CDR_PR_BUF_IN_SR GENMASK(31, 29) +#define AN8855_RG_QP_CDR_PR_BETA_SEL GENMASK(28, 25) +#define AN8855_RG_QP_CDR_PR_CKREF_DIV1 0x1022f018 +#define AN8855_RG_QP_CDR_PR_KBAND_DIV GENMASK(26, 24) +#define AN8855_RG_QP_CDR_PR_DAC_BAND GENMASK(12, 8) +#define AN8855_RG_QP_CDR_PR_KBAND_DIV_PCIE 0x1022f01c +#define AN8855_RG_QP_CDR_PR_XFICK_EN BIT(30) +#define AN8855_RG_QP_CDR_PR_KBAND_PCIE_MODE BIT(6) +#define AN8855_RG_QP_CDR_PR_KBAND_DIV_PCIE_MASK GENMASK(5, 0) +#define AN8855_RG_QP_CDR_FORCE_IBANDLPF_R_OFF 0x1022f020 +#define AN8855_RG_QP_CDR_PHYCK_SEL GENMASK(17, 16) +#define AN8855_RG_QP_CDR_PHYCK_RSTB BIT(13) +#define AN8855_RG_QP_CDR_PHYCK_DIV GENMASK(12, 6) +#define AN8855_RG_QP_TX_MODE 0x1022f028 +#define AN8855_RG_QP_TX_RESERVE GENMASK(31, 16) +#define AN8855_RG_QP_TX_MODE_16B_EN BIT(0) +#define AN8855_RG_QP_PLL_IPLL_DIG_PWR_SEL 0x1022f03c +#define AN8855_RG_QP_PLL_SDM_ORD 0x1022f040 +#define AN8855_RG_QP_PLL_SSC_PHASE_INI BIT(4) +#define AN8855_RG_QP_PLL_SSC_TRI_EN BIT(3) + +/* AN8855_ETHER_SYS_BASE 0x1028c800 */ +#define AN8855_RG_GPHY_AFE_PWD 0x1028c840 +#define AN8855_RG_GPHY_SMI_ADDR 0x1028c848 + +#define MIB_DESC(_s, _o, _n) \ + { \ + .size = (_s), \ + .offset = (_o), \ + .name = (_n), \ + } + +struct an8855_mib_desc { + unsigned int size; + unsigned int offset; + const char *name; +}; + +struct an8855_fdb { + u16 vid; + u8 port_mask; + u16 aging; + u8 mac[6]; + bool noarp; + u8 live; + u8 type; + u8 fid; + u8 ivl; +}; + +struct an8855_priv { + struct device *dev; + struct dsa_switch *ds; + struct regmap *regmap; + struct gpio_desc *reset_gpio; + /* Protect ATU or VLAN table access */ + struct mutex reg_mutex; + + struct phylink_pcs pcs; + + u8 mirror_rx; + u8 mirror_tx; + u8 port_isolated_map; + + bool phy_require_calib; +}; + +#endif /* __AN8855_H */ diff --git a/target/linux/mediatek/files-6.6/drivers/net/mdio/mdio-an8855.c b/target/linux/mediatek/files-6.6/drivers/net/mdio/mdio-an8855.c new file mode 100644 index 00000000000000..5feba72c021b49 --- /dev/null +++ b/target/linux/mediatek/files-6.6/drivers/net/mdio/mdio-an8855.c @@ -0,0 +1,113 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * MDIO passthrough driver for Airoha AN8855 Switch + */ + +#include +#include +#include +#include + +static int an855_phy_restore_page(struct an8855_mfd_priv *priv, + int phy) __must_hold(&priv->bus->mdio_lock) +{ + /* Check PHY page only for addr shared with switch */ + if (phy != priv->switch_addr) + return 0; + + /* Don't restore page if it's not set to switch page */ + if (priv->current_page != FIELD_GET(AN8855_PHY_PAGE, + AN8855_PHY_PAGE_EXTENDED_4)) + return 0; + + /* Restore page to 0, PHY might change page right after but that + * will be ignored as it won't be a switch page. + */ + return an8855_mii_set_page(priv, phy, AN8855_PHY_PAGE_STANDARD); +} + +static int an8855_phy_read(struct mii_bus *bus, int phy, int regnum) +{ + struct an8855_mfd_priv *priv = bus->priv; + struct mii_bus *real_bus = priv->bus; + int ret; + + mutex_lock_nested(&real_bus->mdio_lock, MDIO_MUTEX_NESTED); + + ret = an855_phy_restore_page(priv, phy); + if (ret) + goto exit; + + ret = __mdiobus_read(real_bus, phy, regnum); +exit: + mutex_unlock(&real_bus->mdio_lock); + + return ret; +} + +static int an8855_phy_write(struct mii_bus *bus, int phy, int regnum, u16 val) +{ + struct an8855_mfd_priv *priv = bus->priv; + struct mii_bus *real_bus = priv->bus; + int ret; + + mutex_lock_nested(&real_bus->mdio_lock, MDIO_MUTEX_NESTED); + + ret = an855_phy_restore_page(priv, phy); + if (ret) + goto exit; + + ret = __mdiobus_write(real_bus, phy, regnum, val); +exit: + mutex_unlock(&real_bus->mdio_lock); + + return ret; +} + +static int an8855_mdio_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct an8855_mfd_priv *priv; + struct mii_bus *bus; + int ret; + + /* Get priv of MFD */ + priv = dev_get_drvdata(dev->parent); + + bus = devm_mdiobus_alloc(dev); + if (!bus) + return -ENOMEM; + + bus->priv = priv; + bus->name = KBUILD_MODNAME "-mii"; + snprintf(bus->id, MII_BUS_ID_SIZE, KBUILD_MODNAME "-%d", + priv->switch_addr); + bus->parent = dev; + bus->read = an8855_phy_read; + bus->write = an8855_phy_write; + + ret = devm_of_mdiobus_register(dev, bus, dev->of_node); + if (ret) + return dev_err_probe(dev, ret, "failed to register MDIO bus\n"); + + return ret; +} + +static const struct of_device_id an8855_mdio_of_match[] = { + { .compatible = "airoha,an8855-mdio", }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, an8855_mdio_of_match); + +static struct platform_driver an8855_mdio_driver = { + .probe = an8855_mdio_probe, + .driver = { + .name = "an8855-mdio", + .of_match_table = an8855_mdio_of_match, + }, +}; +module_platform_driver(an8855_mdio_driver); + +MODULE_AUTHOR("Christian Marangi "); +MODULE_DESCRIPTION("Driver for AN8855 MDIO passthrough"); +MODULE_LICENSE("GPL"); diff --git a/target/linux/mediatek/files-6.6/drivers/net/phy/air_an8855.c b/target/linux/mediatek/files-6.6/drivers/net/phy/air_an8855.c new file mode 100644 index 00000000000000..7fab0854ef7838 --- /dev/null +++ b/target/linux/mediatek/files-6.6/drivers/net/phy/air_an8855.c @@ -0,0 +1,267 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2024 Christian Marangi + */ + +#include +#include +#include +#include + +#define AN8855_PHY_SELECT_PAGE 0x1f +#define AN8855_PHY_PAGE GENMASK(2, 0) +#define AN8855_PHY_PAGE_STANDARD FIELD_PREP_CONST(AN8855_PHY_PAGE, 0x0) +#define AN8855_PHY_PAGE_EXTENDED_1 FIELD_PREP_CONST(AN8855_PHY_PAGE, 0x1) + +/* MII Registers Page 1 */ +#define AN8855_PHY_EXT_REG_14 0x14 +#define AN8855_PHY_EN_DOWN_SHIFT BIT(4) + +/* R50 Calibration regs in MDIO_MMD_VEND1 */ +#define AN8855_PHY_R500HM_RSEL_TX_AB 0x174 +#define AN8855_PHY_R50OHM_RSEL_TX_A_EN BIT(15) +#define AN8855_PHY_R50OHM_RSEL_TX_A GENMASK(14, 8) +#define AN8855_PHY_R50OHM_RSEL_TX_B_EN BIT(7) +#define AN8855_PHY_R50OHM_RSEL_TX_B GENMASK(6, 0) +#define AN8855_PHY_R500HM_RSEL_TX_CD 0x175 +#define AN8855_PHY_R50OHM_RSEL_TX_C_EN BIT(15) +#define AN8855_PHY_R50OHM_RSEL_TX_C GENMASK(14, 8) +#define AN8855_PHY_R50OHM_RSEL_TX_D_EN BIT(7) +#define AN8855_PHY_R50OHM_RSEL_TX_D GENMASK(6, 0) + +#define AN8855_SWITCH_EFUSE_R50O GENMASK(30, 24) + +/* PHY TX PAIR DELAY SELECT Register */ +#define AN8855_PHY_TX_PAIR_DLY_SEL_GBE 0x013 +#define AN8855_PHY_CR_DA_TX_PAIR_DELKAY_SEL_A_GBE GENMASK(14, 12) +#define AN8855_PHY_CR_DA_TX_PAIR_DELKAY_SEL_B_GBE GENMASK(10, 8) +#define AN8855_PHY_CR_DA_TX_PAIR_DELKAY_SEL_C_GBE GENMASK(6, 4) +#define AN8855_PHY_CR_DA_TX_PAIR_DELKAY_SEL_D_GBE GENMASK(2, 0) +/* PHY ADC Register */ +#define AN8855_PHY_RXADC_CTRL 0x0d8 +#define AN8855_PHY_RG_AD_SAMNPLE_PHSEL_A BIT(12) +#define AN8855_PHY_RG_AD_SAMNPLE_PHSEL_B BIT(8) +#define AN8855_PHY_RG_AD_SAMNPLE_PHSEL_C BIT(4) +#define AN8855_PHY_RG_AD_SAMNPLE_PHSEL_D BIT(0) +#define AN8855_PHY_RXADC_REV_0 0x0d9 +#define AN8855_PHY_RG_AD_RESERVE0_A GENMASK(15, 8) +#define AN8855_PHY_RG_AD_RESERVE0_B GENMASK(7, 0) +#define AN8855_PHY_RXADC_REV_1 0x0da +#define AN8855_PHY_RG_AD_RESERVE0_C GENMASK(15, 8) +#define AN8855_PHY_RG_AD_RESERVE0_D GENMASK(7, 0) + +#define AN8855_PHY_ID 0xc0ff0410 + +#define AN8855_PHY_FLAGS_EN_CALIBRATION BIT(0) + +struct air_an8855_priv { + u8 calibration_data[4]; +}; + +static const u8 dsa_r50ohm_table[] = { + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 126, 122, 117, + 112, 109, 104, 101, 97, 94, 90, 88, 84, 80, + 78, 74, 72, 68, 66, 64, 61, 58, 56, 53, + 51, 48, 47, 44, 42, 40, 38, 36, 34, 32, + 31, 28, 27, 24, 24, 22, 20, 18, 16, 16, + 14, 12, 11, 9 +}; + +static int en8855_get_r50ohm_val(struct device *dev, const char *calib_name, + u8 *dest) +{ + u32 shift_sel, val; + int ret; + int i; + + ret = nvmem_cell_read_u32(dev, calib_name, &val); + if (ret) + return ret; + + shift_sel = FIELD_GET(AN8855_SWITCH_EFUSE_R50O, val); + for (i = 0; i < ARRAY_SIZE(dsa_r50ohm_table); i++) + if (dsa_r50ohm_table[i] == shift_sel) + break; + + if (i < 8 || i >= ARRAY_SIZE(dsa_r50ohm_table)) + *dest = dsa_r50ohm_table[25]; + else + *dest = dsa_r50ohm_table[i - 8]; + + return 0; +} + +static int an8855_probe(struct phy_device *phydev) +{ + struct device *dev = &phydev->mdio.dev; + struct device_node *node = dev->of_node; + struct air_an8855_priv *priv; + + /* If we don't have a node, skip calib */ + if (!node) + return 0; + + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + phydev->priv = priv; + + return 0; +} + +static int an8855_get_downshift(struct phy_device *phydev, u8 *data) +{ + int val; + + val = phy_read_paged(phydev, AN8855_PHY_PAGE_EXTENDED_1, AN8855_PHY_EXT_REG_14); + if (val < 0) + return val; + + *data = val & AN8855_PHY_EN_DOWN_SHIFT ? DOWNSHIFT_DEV_DEFAULT_COUNT : + DOWNSHIFT_DEV_DISABLE; + + return 0; +} + +static int an8855_set_downshift(struct phy_device *phydev, u8 cnt) +{ + u16 ds = cnt != DOWNSHIFT_DEV_DISABLE ? AN8855_PHY_EN_DOWN_SHIFT : 0; + + return phy_modify_paged(phydev, AN8855_PHY_PAGE_EXTENDED_1, + AN8855_PHY_EXT_REG_14, AN8855_PHY_EN_DOWN_SHIFT, + ds); +} + +static int an8855_config_init(struct phy_device *phydev) +{ + struct air_an8855_priv *priv = phydev->priv; + struct device *dev = &phydev->mdio.dev; + int ret; + + /* Enable HW auto downshift */ + ret = an8855_set_downshift(phydev, DOWNSHIFT_DEV_DEFAULT_COUNT); + if (ret) + return ret; + + /* Apply calibration values, if needed. + * AN8855_PHY_FLAGS_EN_CALIBRATION signal this. + */ + if (priv && phydev->dev_flags & AN8855_PHY_FLAGS_EN_CALIBRATION) { + u8 *calibration_data = priv->calibration_data; + + ret = en8855_get_r50ohm_val(dev, "tx_a", &calibration_data[0]); + if (ret) + return ret; + + ret = en8855_get_r50ohm_val(dev, "tx_b", &calibration_data[1]); + if (ret) + return ret; + + ret = en8855_get_r50ohm_val(dev, "tx_c", &calibration_data[2]); + if (ret) + return ret; + + ret = en8855_get_r50ohm_val(dev, "tx_d", &calibration_data[3]); + if (ret) + return ret; + + ret = phy_modify_mmd(phydev, MDIO_MMD_VEND1, AN8855_PHY_R500HM_RSEL_TX_AB, + AN8855_PHY_R50OHM_RSEL_TX_A | AN8855_PHY_R50OHM_RSEL_TX_B, + FIELD_PREP(AN8855_PHY_R50OHM_RSEL_TX_A, calibration_data[0]) | + FIELD_PREP(AN8855_PHY_R50OHM_RSEL_TX_B, calibration_data[1])); + if (ret) + return ret; + ret = phy_modify_mmd(phydev, MDIO_MMD_VEND1, AN8855_PHY_R500HM_RSEL_TX_CD, + AN8855_PHY_R50OHM_RSEL_TX_C | AN8855_PHY_R50OHM_RSEL_TX_D, + FIELD_PREP(AN8855_PHY_R50OHM_RSEL_TX_C, calibration_data[2]) | + FIELD_PREP(AN8855_PHY_R50OHM_RSEL_TX_D, calibration_data[3])); + if (ret) + return ret; + } + + /* Apply values to reduce signal noise */ + ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, AN8855_PHY_TX_PAIR_DLY_SEL_GBE, + FIELD_PREP(AN8855_PHY_CR_DA_TX_PAIR_DELKAY_SEL_A_GBE, 0x4) | + FIELD_PREP(AN8855_PHY_CR_DA_TX_PAIR_DELKAY_SEL_C_GBE, 0x4)); + if (ret) + return ret; + ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, AN8855_PHY_RXADC_CTRL, + AN8855_PHY_RG_AD_SAMNPLE_PHSEL_A | + AN8855_PHY_RG_AD_SAMNPLE_PHSEL_C); + if (ret) + return ret; + ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, AN8855_PHY_RXADC_REV_0, + FIELD_PREP(AN8855_PHY_RG_AD_RESERVE0_A, 0x1)); + if (ret) + return ret; + ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, AN8855_PHY_RXADC_REV_1, + FIELD_PREP(AN8855_PHY_RG_AD_RESERVE0_C, 0x1)); + if (ret) + return ret; + + return 0; +} + +static int an8855_get_tunable(struct phy_device *phydev, + struct ethtool_tunable *tuna, void *data) +{ + switch (tuna->id) { + case ETHTOOL_PHY_DOWNSHIFT: + return an8855_get_downshift(phydev, data); + default: + return -EOPNOTSUPP; + } +} + +static int an8855_set_tunable(struct phy_device *phydev, + struct ethtool_tunable *tuna, const void *data) +{ + switch (tuna->id) { + case ETHTOOL_PHY_DOWNSHIFT: + return an8855_set_downshift(phydev, *(const u8 *)data); + default: + return -EOPNOTSUPP; + } +} + +static int an8855_read_page(struct phy_device *phydev) +{ + return __phy_read(phydev, AN8855_PHY_SELECT_PAGE); +} + +static int an8855_write_page(struct phy_device *phydev, int page) +{ + return __phy_write(phydev, AN8855_PHY_SELECT_PAGE, page); +} + +static struct phy_driver an8855_driver[] = { +{ + PHY_ID_MATCH_EXACT(AN8855_PHY_ID), + .name = "Airoha AN8855 internal PHY", + /* PHY_GBIT_FEATURES */ + .flags = PHY_IS_INTERNAL, + .probe = an8855_probe, + .config_init = an8855_config_init, + .soft_reset = genphy_soft_reset, + .get_tunable = an8855_get_tunable, + .set_tunable = an8855_set_tunable, + .suspend = genphy_suspend, + .resume = genphy_resume, + .read_page = an8855_read_page, + .write_page = an8855_write_page, +}, }; + +module_phy_driver(an8855_driver); + +static struct mdio_device_id __maybe_unused an8855_tbl[] = { + { PHY_ID_MATCH_EXACT(AN8855_PHY_ID) }, + { } +}; + +MODULE_DEVICE_TABLE(mdio, an8855_tbl); + +MODULE_DESCRIPTION("Airoha AN8855 PHY driver"); +MODULE_AUTHOR("Christian Marangi "); +MODULE_LICENSE("GPL"); diff --git a/target/linux/mediatek/files-6.6/drivers/nvmem/an8855-efuse.c b/target/linux/mediatek/files-6.6/drivers/nvmem/an8855-efuse.c new file mode 100644 index 00000000000000..7940453d6e58e3 --- /dev/null +++ b/target/linux/mediatek/files-6.6/drivers/nvmem/an8855-efuse.c @@ -0,0 +1,63 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Airoha AN8855 Switch EFUSE Driver + */ + +#include +#include +#include +#include +#include + +#define AN8855_EFUSE_CELL 50 + +#define AN8855_EFUSE_DATA0 0x1000a500 +#define AN8855_EFUSE_R50O GENMASK(30, 24) + +static int an8855_efuse_read(void *context, unsigned int offset, + void *val, size_t bytes) +{ + struct regmap *regmap = context; + + return regmap_bulk_read(regmap, AN8855_EFUSE_DATA0 + offset, + val, bytes / sizeof(u32)); +} + +static int an8855_efuse_probe(struct platform_device *pdev) +{ + struct nvmem_config an8855_nvmem_config = { + .name = "an8855-efuse", + .size = AN8855_EFUSE_CELL * sizeof(u32), + .stride = sizeof(u32), + .word_size = sizeof(u32), + .reg_read = an8855_efuse_read, + }; + struct device *dev = &pdev->dev; + struct nvmem_device *nvmem; + + /* Assign NVMEM priv to MFD regmap */ + an8855_nvmem_config.priv = dev_get_regmap(dev->parent, NULL); + an8855_nvmem_config.dev = dev; + nvmem = devm_nvmem_register(dev, &an8855_nvmem_config); + + return PTR_ERR_OR_ZERO(nvmem); +} + +static const struct of_device_id an8855_efuse_of_match[] = { + { .compatible = "airoha,an8855-efuse", }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, an8855_efuse_of_match); + +static struct platform_driver an8855_efuse_driver = { + .probe = an8855_efuse_probe, + .driver = { + .name = "an8855-efuse", + .of_match_table = an8855_efuse_of_match, + }, +}; +module_platform_driver(an8855_efuse_driver); + +MODULE_AUTHOR("Christian Marangi "); +MODULE_DESCRIPTION("Driver for AN8855 Switch EFUSE"); +MODULE_LICENSE("GPL"); diff --git a/target/linux/mediatek/files-6.6/include/linux/mfd/airoha-an8855-mfd.h b/target/linux/mediatek/files-6.6/include/linux/mfd/airoha-an8855-mfd.h new file mode 100644 index 00000000000000..56061566a0796f --- /dev/null +++ b/target/linux/mediatek/files-6.6/include/linux/mfd/airoha-an8855-mfd.h @@ -0,0 +1,41 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * MFD driver for Airoha AN8855 Switch + */ +#ifndef _LINUX_INCLUDE_MFD_AIROHA_AN8855_MFD_H +#define _LINUX_INCLUDE_MFD_AIROHA_AN8855_MFD_H + +#include + +/* MII Registers */ +#define AN8855_PHY_SELECT_PAGE 0x1f +#define AN8855_PHY_PAGE GENMASK(2, 0) +#define AN8855_PHY_PAGE_STANDARD FIELD_PREP_CONST(AN8855_PHY_PAGE, 0x0) +#define AN8855_PHY_PAGE_EXTENDED_1 FIELD_PREP_CONST(AN8855_PHY_PAGE, 0x1) +#define AN8855_PHY_PAGE_EXTENDED_4 FIELD_PREP_CONST(AN8855_PHY_PAGE, 0x4) + +/* MII Registers Page 4 */ +#define AN8855_PBUS_MODE 0x10 +#define AN8855_PBUS_MODE_ADDR_FIXED 0x0 +#define AN8855_PBUS_MODE_ADDR_INCR BIT(15) +#define AN8855_PBUS_WR_ADDR_HIGH 0x11 +#define AN8855_PBUS_WR_ADDR_LOW 0x12 +#define AN8855_PBUS_WR_DATA_HIGH 0x13 +#define AN8855_PBUS_WR_DATA_LOW 0x14 +#define AN8855_PBUS_RD_ADDR_HIGH 0x15 +#define AN8855_PBUS_RD_ADDR_LOW 0x16 +#define AN8855_PBUS_RD_DATA_HIGH 0x17 +#define AN8855_PBUS_RD_DATA_LOW 0x18 + +struct an8855_mfd_priv { + struct device *dev; + struct mii_bus *bus; + + unsigned int switch_addr; + u16 current_page; +}; + +int an8855_mii_set_page(struct an8855_mfd_priv *priv, u8 phy_id, + u8 page); + +#endif diff --git a/target/linux/mediatek/filogic/config-6.6 b/target/linux/mediatek/filogic/config-6.6 index 408ac5483e59c3..8b8444175dec4d 100644 --- a/target/linux/mediatek/filogic/config-6.6 +++ b/target/linux/mediatek/filogic/config-6.6 @@ -1,5 +1,6 @@ CONFIG_64BIT=y # CONFIG_AHCI_MTK is not set +CONFIG_AIR_AN8855_PHY=y CONFIG_AIROHA_EN8801SC_PHY=y CONFIG_ARCH_BINFMT_ELF_EXTRA_PHDRS=y CONFIG_ARCH_CORRECT_STACKTRACE_ON_KRETPROBE=y @@ -236,12 +237,14 @@ CONFIG_MAXLINEAR_GPHY=y CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y +CONFIG_MDIO_AN8855=y CONFIG_MEDIATEK_2P5GE_PHY=y CONFIG_MEDIATEK_GE_PHY=y CONFIG_MEDIATEK_GE_SOC_PHY=y CONFIG_MEDIATEK_WATCHDOG=y CONFIG_MESSAGE_LOGLEVEL_DEFAULT=7 CONFIG_MFD_SYSCON=y +CONFIG_MFD_AIROHA_AN8855=y CONFIG_MIGRATION=y # CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY is not set CONFIG_MMC=y @@ -290,6 +293,7 @@ CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NEED_SG_DMA_LENGTH=y CONFIG_NET_DEVLINK=y CONFIG_NET_DSA=y +CONFIG_NET_DSA_AN8855=y CONFIG_NET_DSA_MT7530=y CONFIG_NET_DSA_MT7530_MDIO=y CONFIG_NET_DSA_MT7530_MMIO=y @@ -308,6 +312,7 @@ CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=4 CONFIG_NVMEM=y +CONFIG_NVMEM_AN8855_EFUSE=y CONFIG_NVMEM_BLOCK=y CONFIG_NVMEM_LAYOUTS=y CONFIG_NVMEM_LAYOUT_ADTRAN=y diff --git a/target/linux/mediatek/mt7622/config-6.6 b/target/linux/mediatek/mt7622/config-6.6 index ec3be8df9aa574..c3c8b60684dceb 100644 --- a/target/linux/mediatek/mt7622/config-6.6 +++ b/target/linux/mediatek/mt7622/config-6.6 @@ -1,5 +1,6 @@ CONFIG_64BIT=y # CONFIG_AHCI_MTK is not set +# CONFIG_AIR_AN8855_PHY is not set # CONFIG_AIROHA_EN8801SC_PHY is not set CONFIG_AQUANTIA_PHY=y CONFIG_ARCH_BINFMT_ELF_EXTRA_PHDRS=y @@ -240,12 +241,14 @@ CONFIG_MAXLINEAR_GPHY=y CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y +# CONFIG_MDIO_AN8855 is not set # CONFIG_MEDIATEK_2P5GE_PHY is not set CONFIG_MEDIATEK_GE_PHY=y # CONFIG_MEDIATEK_GE_SOC_PHY is not set CONFIG_MEDIATEK_WATCHDOG=y CONFIG_MESSAGE_LOGLEVEL_DEFAULT=7 CONFIG_MFD_SYSCON=y +# CONFIG_MFD_AIROHA_AN8855 is not set CONFIG_MIGRATION=y # CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY is not set CONFIG_MMC=y @@ -294,6 +297,7 @@ CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NEED_SG_DMA_LENGTH=y CONFIG_NET_DEVLINK=y CONFIG_NET_DSA=y +# CONFIG_NET_DSA_AN8855 is not set CONFIG_NET_DSA_MT7530=y CONFIG_NET_DSA_MT7530_MDIO=y # CONFIG_NET_DSA_MT7530_MMIO is not set @@ -312,6 +316,7 @@ CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=2 CONFIG_NVMEM=y +# CONFIG_NVMEM_AN8855_EFUSE is not set CONFIG_NVMEM_BLOCK=y CONFIG_NVMEM_LAYOUTS=y CONFIG_NVMEM_LAYOUT_ADTRAN=y diff --git a/target/linux/mediatek/mt7623/config-6.6 b/target/linux/mediatek/mt7623/config-6.6 index 6bc92a09dce30e..9d12c48eeeea1e 100644 --- a/target/linux/mediatek/mt7623/config-6.6 +++ b/target/linux/mediatek/mt7623/config-6.6 @@ -1,4 +1,5 @@ # CONFIG_AIO is not set +# CONFIG_AIR_AN8855_PHY is not set # CONFIG_AIROHA_EN8801SC_PHY is not set CONFIG_ALIGNMENT_TRAP=y CONFIG_ARCH_32BIT_OFF_T=y @@ -352,6 +353,7 @@ CONFIG_MDIO_BITBANG=y CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y +# CONFIG_MDIO_AN8855 is not set CONFIG_MDIO_GPIO=y CONFIG_MEDIATEK_GE_PHY=y CONFIG_MEDIATEK_MT6577_AUXADC=y @@ -361,6 +363,7 @@ CONFIG_MFD_CORE=y # CONFIG_MFD_HI6421_SPMI is not set CONFIG_MFD_MT6397=y CONFIG_MFD_SYSCON=y +# CONFIG_MFD_AIROHA_AN8855 is not set CONFIG_MIGHT_HAVE_CACHE_L2X0=y CONFIG_MIGRATION=y CONFIG_MMC=y @@ -410,6 +413,7 @@ CONFIG_NEED_SRCU_NMI_SAFE=y CONFIG_NEON=y CONFIG_NET_DEVLINK=y CONFIG_NET_DSA=y +# CONFIG_NET_DSA_AN8855 is not set CONFIG_NET_DSA_MT7530=y CONFIG_NET_DSA_MT7530_MDIO=y # CONFIG_NET_DSA_MT7530_MMIO is not set @@ -431,6 +435,7 @@ CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=4 CONFIG_NVMEM=y +# CONFIG_NVMEM_AN8855_EFUSE is not set CONFIG_NVMEM_LAYOUTS=y # CONFIG_NVMEM_LAYOUT_ADTRAN is not set CONFIG_NVMEM_MTK_EFUSE=y diff --git a/target/linux/mediatek/mt7629/config-6.6 b/target/linux/mediatek/mt7629/config-6.6 index 9f57bda3e9e7a7..d66a514f63e626 100644 --- a/target/linux/mediatek/mt7629/config-6.6 +++ b/target/linux/mediatek/mt7629/config-6.6 @@ -1,3 +1,4 @@ +# CONFIG_AIR_AN8855_PHY is not set # CONFIG_AIROHA_EN8801SC_PHY is not set CONFIG_ALIGNMENT_TRAP=y CONFIG_ARCH_32BIT_OFF_T=y @@ -181,9 +182,11 @@ CONFIG_MACH_MT7629=y CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y +# CONFIG_MDIO_AN8855 is not set CONFIG_MEDIATEK_GE_PHY=y CONFIG_MEDIATEK_WATCHDOG=y CONFIG_MFD_SYSCON=y +# CONFIG_MFD_AIROHA_AN8855 is not set CONFIG_MIGHT_HAVE_CACHE_L2X0=y CONFIG_MIGRATION=y CONFIG_MMU_LAZY_TLB_REFCOUNT=y @@ -216,6 +219,7 @@ CONFIG_NETFILTER=y CONFIG_NETFILTER_BPF_LINK=y CONFIG_NET_DEVLINK=y CONFIG_NET_DSA=y +# CONFIG_NET_DSA_AN8855 is not set CONFIG_NET_DSA_MT7530=y CONFIG_NET_DSA_MT7530_MDIO=y # CONFIG_NET_DSA_MT7530_MMIO is not set @@ -234,6 +238,7 @@ CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=2 CONFIG_NVMEM=y +# CONFIG_NVMEM_AN8855_EFUSE is not set CONFIG_NVMEM_LAYOUTS=y # CONFIG_NVMEM_LAYOUT_ADTRAN is not set # CONFIG_NVMEM_MTK_EFUSE is not set diff --git a/target/linux/mediatek/patches-6.6/737-net-dsa-add-Airoha-AN8855.patch b/target/linux/mediatek/patches-6.6/737-net-dsa-add-Airoha-AN8855.patch new file mode 100644 index 00000000000000..bd70bec4b37e13 --- /dev/null +++ b/target/linux/mediatek/patches-6.6/737-net-dsa-add-Airoha-AN8855.patch @@ -0,0 +1,309 @@ +From: Christian Marangi +To: Christian Marangi , + Lee Jones , Rob Herring , + Krzysztof Kozlowski , + Conor Dooley , + Andrew Lunn , + "David S. Miller" , + Eric Dumazet , + Jakub Kicinski , Paolo Abeni , + Vladimir Oltean , + Srinivas Kandagatla , + Heiner Kallweit , + Russell King , + Matthias Brugger , + AngeloGioacchino Del Regno + , + linux-arm-kernel@lists.infradead.org, + linux-mediatek@lists.infradead.org, netdev@vger.kernel.org, + devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, + upstream@airoha.com +Subject: [net-next PATCH v11 0/9] net: dsa: Add Airoha AN8855 support +Date: Mon, 9 Dec 2024 14:44:17 +0100 [thread overview] +Message-ID: <20241209134459.27110-1-ansuelsmth@gmail.com> (raw) + +This small series add the initial support for the Airoha AN8855 Switch. + +It's a 5 port Gigabit Switch with SGMII/HSGMII upstream port. + +This is starting to get in the wild and there are already some router +having this switch chip. + +It's conceptually similar to mediatek switch but register and bits +are different. And there is that massive Hell that is the PCS +configuration. +Saddly for that part we have absolutely NO documentation currently. + +There is this special thing where PHY needs to be calibrated with values +from the switch efuse. (the thing have a whole cpu timer and MCU) + +Changes v11: +- Address reviews from Christophe (spell mistake + dev_err_probe) +- Fix kconfig dependency for MFD driver (depends on MDIO_DEVICE instead of MDIO) + (indirectly fix link error for mdio APIs) +- Fix copy-paste error for MFD driver of_table +- Fix compilation error for PHY (move NVMEM to .config) +- Drop unneeded NVMEM node from MDIO example schema (from Andrew) +- Adapt MFD example schema to MDIO reg property restrictions +Changes v10: +- Entire rework to MFD + split to MDIO, EFUSE, SWITCH separate drivers +- Drop EEE OPs (while Russell finish RFC for EEE changes) +- Use new pcs_inpand OPs +- Drop AN restart function and move to pcs_config +- Enable assisted_learning and disable CPU learn (preparation for fdb_isolation) +- Move EFUSE read in Internal PHY driver to .config to handle EPROBE_DEFER + (needed now that NVMEM driver is register externally instead of internally to switch + node) +Changes v9: +- Error out on using 5G speed as currently not supported +- Add missing MAC_2500FD in phylink mac_capabilities +- Add comment and improve if condition for an8855_phylink_mac_config +Changes v8: +- Add port Fast Age support +- Add support for Port Isolation +- Use correct register for Learning Disable +- Add support for Ageing Time OP +- Set default PVID to 0 by default +- Add mdb OPs +- Add port change MTU +- Fix support for Upper VLAN +Changes v7: +- Fix devm_dsa_register_switch wrong export symbol +Changes v6: +- Drop standard MIB and handle with ethtool OPs (as requested by Jakub) +- Cosmetic: use bool instead of 0 or 1 +Changes v5: +- Add devm_dsa_register_switch() patch +- Add Reviewed-by tag for DT patch +Changes v4: +- Set regmap readable_table static (mute compilation warning) +- Add support for port_bridge flags (LEARNING, FLOOD) +- Reset fdb struct in fdb_dump +- Drop support_asym_pause in port_enable +- Add define for get_phy_flags +- Fix bug for port not inititially part of a bridge + (in an8855_setup the port matrix was always cleared but + the CPU port was never initially added) +- Disable learning and flood for user port by default +- Set CPU port to flood and learning by default +- Correctly AND force duplex and flow control in an8855_phylink_mac_link_up +- Drop RGMII from pcs_config +- Check ret in "Disable AN if not in autoneg" +- Use devm_mutex_init +- Fix typo for AN8855_PORT_CHECK_MODE +- Better define AN8855_STP_LISTENING = AN8855_STP_BLOCKING +- Fix typo in AN8855_PHY_EN_DOWN_SHIFT +- Use paged helper for PHY +- Skip calibration in config_init if priv not defined +Changes v3: +- Out of RFC +- Switch PHY code to select_page API +- Better describe masks and bits in PHY driver for ADC register +- Drop raw values and use define for mii read/write +- Switch to absolute PHY address +- Replace raw values with mask and bits for pcs_config +- Fix typo for ext-surge property name +- Drop support for relocating Switch base PHY address on the bus +Changes v2: +- Drop mutex guard patch +- Drop guard usage in DSA driver +- Use __mdiobus_write/read +- Check return condition and return errors for mii read/write +- Fix wrong logic for EEE +- Fix link_down (don't force link down with autoneg) +- Fix forcing speed on sgmii autoneg +- Better document link speed for sgmii reg +- Use standard define for sgmii reg +- Imlement nvmem support to expose switch EFUSE +- Rework PHY calibration with the use of NVMEM producer/consumer +- Update DT with new NVMEM property +- Move aneg validation for 2500-basex in pcs_config +- Move r50Ohm table and function to PHY driver + +Christian Marangi (9): + dt-bindings: nvmem: Document support for Airoha AN8855 Switch EFUSE + dt-bindings: net: Document support for Airoha AN8855 Switch Virtual + MDIO + dt-bindings: net: dsa: Document support for Airoha AN8855 DSA Switch + dt-bindings: mfd: Document support for Airoha AN8855 Switch SoC + mfd: an8855: Add support for Airoha AN8855 Switch MFD + net: mdio: Add Airoha AN8855 Switch MDIO Passtrough + nvmem: an8855: Add support for Airoha AN8855 Switch EFUSE + net: dsa: Add Airoha AN8855 5-Port Gigabit DSA Switch driver + net: phy: Add Airoha AN8855 Internal Switch Gigabit PHY + + .../bindings/mfd/airoha,an8855-mfd.yaml | 178 ++ + .../bindings/net/airoha,an8855-mdio.yaml | 56 + + .../net/dsa/airoha,an8855-switch.yaml | 105 + + .../bindings/nvmem/airoha,an8855-efuse.yaml | 123 + + MAINTAINERS | 17 + + drivers/mfd/Kconfig | 10 + + drivers/mfd/Makefile | 1 + + drivers/mfd/airoha-an8855.c | 278 ++ + drivers/net/dsa/Kconfig | 9 + + drivers/net/dsa/Makefile | 1 + + drivers/net/dsa/an8855.c | 2310 +++++++++++++++++ + drivers/net/dsa/an8855.h | 783 ++++++ + drivers/net/mdio/Kconfig | 9 + + drivers/net/mdio/Makefile | 1 + + drivers/net/mdio/mdio-an8855.c | 113 + + drivers/net/phy/Kconfig | 5 + + drivers/net/phy/Makefile | 1 + + drivers/net/phy/air_an8855.c | 267 ++ + drivers/nvmem/Kconfig | 11 + + drivers/nvmem/Makefile | 2 + + drivers/nvmem/an8855-efuse.c | 63 + + include/linux/mfd/airoha-an8855-mfd.h | 41 + + 22 files changed, 4384 insertions(+) + create mode 100644 Documentation/devicetree/bindings/mfd/airoha,an8855-mfd.yaml + create mode 100644 Documentation/devicetree/bindings/net/airoha,an8855-mdio.yaml + create mode 100644 Documentation/devicetree/bindings/net/dsa/airoha,an8855-switch.yaml + create mode 100644 Documentation/devicetree/bindings/nvmem/airoha,an8855-efuse.yaml + create mode 100644 drivers/mfd/airoha-an8855.c + create mode 100644 drivers/net/dsa/an8855.c + create mode 100644 drivers/net/dsa/an8855.h + create mode 100644 drivers/net/mdio/mdio-an8855.c + create mode 100644 drivers/net/phy/air_an8855.c + create mode 100644 drivers/nvmem/an8855-efuse.c + create mode 100644 include/linux/mfd/airoha-an8855-mfd.h + +--- a/drivers/mfd/Kconfig ++++ b/drivers/mfd/Kconfig +@@ -41,6 +41,16 @@ config MFD_ALTERA_SYSMGR + using regmap_mmio accesses for ARM32 parts and SMC calls to + EL3 for ARM64 parts. + ++config MFD_AIROHA_AN8855 ++ tristate "Airoha AN8855 Switch MFD" ++ select MFD_CORE ++ select MDIO_DEVICE ++ depends on NETDEVICES && OF ++ help ++ Support for the Airoha AN8855 Switch MFD. This is a SoC Switch ++ that provides various peripherals. Currently it provides a ++ DSA switch and a NVMEM provider. ++ + config MFD_ACT8945A + tristate "Active-semi ACT8945A" + select MFD_CORE +--- a/drivers/mfd/Makefile ++++ b/drivers/mfd/Makefile +@@ -7,6 +7,7 @@ + obj-$(CONFIG_MFD_88PM860X) += 88pm860x.o + obj-$(CONFIG_MFD_88PM800) += 88pm800.o 88pm80x.o + obj-$(CONFIG_MFD_88PM805) += 88pm805.o 88pm80x.o ++obj-$(CONFIG_MFD_AIROHA_AN8855) += airoha-an8855.o + obj-$(CONFIG_MFD_ACT8945A) += act8945a.o + obj-$(CONFIG_MFD_SM501) += sm501.o + obj-$(CONFIG_ARCH_BCM2835) += bcm2835-pm.o +--- a/drivers/net/dsa/Kconfig ++++ b/drivers/net/dsa/Kconfig +@@ -24,6 +24,15 @@ config NET_DSA_LOOP + This enables support for a fake mock-up switch chip which + exercises the DSA APIs. + ++config NET_DSA_AN8855 ++ tristate "Airoha AN8855 Ethernet switch support" ++ depends on MFD_AIROHA_AN8855 ++ depends on NET_DSA ++ select NET_DSA_TAG_MTK ++ help ++ This enables support for the Airoha AN8855 Ethernet switch ++ chip. ++ + source "drivers/net/dsa/hirschmann/Kconfig" + + config NET_DSA_LANTIQ_GSWIP +--- a/drivers/net/dsa/Makefile ++++ b/drivers/net/dsa/Makefile +@@ -5,6 +5,7 @@ obj-$(CONFIG_NET_DSA_LOOP) += dsa_loop.o + ifdef CONFIG_NET_DSA_LOOP + obj-$(CONFIG_FIXED_PHY) += dsa_loop_bdinfo.o + endif ++obj-$(CONFIG_NET_DSA_AN8855) += an8855.o + 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 +--- a/drivers/net/mdio/Kconfig ++++ b/drivers/net/mdio/Kconfig +@@ -61,6 +61,15 @@ config MDIO_XGENE + This module provides a driver for the MDIO busses found in the + APM X-Gene SoC's. + ++config MDIO_AN8855 ++ tristate "Airoha AN8855 Switch MDIO bus controller" ++ depends on MFD_AIROHA_AN8855 ++ depends on OF_MDIO ++ help ++ This module provides a driver for the Airoha AN8855 Switch ++ that requires a MDIO passtrough as switch address is shared ++ with the internal PHYs and requires additional page handling. ++ + config MDIO_ASPEED + tristate "ASPEED MDIO bus controller" + depends on ARCH_ASPEED || COMPILE_TEST +--- a/drivers/net/mdio/Makefile ++++ b/drivers/net/mdio/Makefile +@@ -5,6 +5,7 @@ obj-$(CONFIG_ACPI_MDIO) += acpi_mdio.o + obj-$(CONFIG_FWNODE_MDIO) += fwnode_mdio.o + obj-$(CONFIG_OF_MDIO) += of_mdio.o + ++obj-$(CONFIG_MDIO_AN8855) += mdio-an8855.o + obj-$(CONFIG_MDIO_ASPEED) += mdio-aspeed.o + obj-$(CONFIG_MDIO_BCM_IPROC) += mdio-bcm-iproc.o + obj-$(CONFIG_MDIO_BCM_UNIMAC) += mdio-bcm-unimac.o +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -147,6 +147,11 @@ config AIROHA_EN8801SC_PHY + help + Currently supports the Airoha EN8801SC PHY. + ++config AIR_AN8855_PHY ++ tristate "Airoha AN8855 Internal Gigabit PHY" ++ help ++ Currently supports the internal Airoha AN8855 Switch PHY. ++ + config AIR_EN8811H_PHY + tristate "Airoha EN8811H 2.5 Gigabit PHY" + help +--- a/drivers/net/phy/Makefile ++++ b/drivers/net/phy/Makefile +@@ -50,6 +50,7 @@ obj-y += $(sfp-obj-y) $(sfp-obj-m) + obj-$(CONFIG_ADIN_PHY) += adin.o + obj-$(CONFIG_ADIN1100_PHY) += adin1100.o + obj-$(CONFIG_AIROHA_EN8801SC_PHY) += en8801sc.o ++obj-$(CONFIG_AIR_AN8855_PHY) += air_an8855.o + obj-$(CONFIG_AIR_EN8811H_PHY) += air_en8811h.o + obj-$(CONFIG_AMD_PHY) += amd.o + obj-$(CONFIG_AQUANTIA_PHY) += aquantia/ +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -29,6 +29,17 @@ source "drivers/nvmem/layouts/Kconfig" + + # Devices + ++config NVMEM_AN8855_EFUSE ++ tristate "Airoha AN8855 eFuse support" ++ depends on MFD_AIROHA_AN8855 || COMPILE_TEST ++ help ++ Say y here to enable support for reading eFuses on Airoha AN8855 ++ Switch. These are e.g. used to store factory programmed ++ calibration data required for the PHY. ++ ++ This driver can also be built as a module. If so, the module will ++ be called nvmem-an8855-efuse. ++ + config NVMEM_APPLE_EFUSES + tristate "Apple eFuse support" + depends on ARCH_APPLE || COMPILE_TEST +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -10,6 +10,8 @@ nvmem_layouts-y := layouts.o + obj-y += layouts/ + + # Devices ++obj-$(CONFIG_NVMEM_AN8855_EFUSE) += nvmem-an8855-efuse.o ++nvmem-an8855-efuse-y := an8855-efuse.o + obj-$(CONFIG_NVMEM_APPLE_EFUSES) += nvmem-apple-efuses.o + nvmem-apple-efuses-y := apple-efuses.o + obj-$(CONFIG_NVMEM_BCM_OCOTP) += nvmem-bcm-ocotp.o diff --git a/target/linux/mediatek/patches-6.6/738-net-phylink-move-phylink_pcs_neg_mode.patch b/target/linux/mediatek/patches-6.6/738-net-phylink-move-phylink_pcs_neg_mode.patch new file mode 100644 index 00000000000000..2860b785faf869 --- /dev/null +++ b/target/linux/mediatek/patches-6.6/738-net-phylink-move-phylink_pcs_neg_mode.patch @@ -0,0 +1,166 @@ +From 5e5401d6612ef599ad45785b941eebda7effc90f Mon Sep 17 00:00:00 2001 +From: "Russell King (Oracle)" +Date: Thu, 4 Jan 2024 09:47:36 +0000 +Subject: [PATCH] net: phylink: move phylink_pcs_neg_mode() into phylink.c + +Move phylink_pcs_neg_mode() from the header file into the .c file since +nothing should be using it. + +Signed-off-by: Russell King (Oracle) +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/phy/phylink.c | 66 +++++++++++++++++++++++++++++++++++++++ + include/linux/phylink.h | 66 --------------------------------------- + 2 files changed, 66 insertions(+), 66 deletions(-) + +--- a/drivers/net/phy/phylink.c ++++ b/drivers/net/phy/phylink.c +@@ -1150,6 +1150,72 @@ static void phylink_pcs_an_restart(struc + pl->pcs->ops->pcs_an_restart(pl->pcs); + } + ++/** ++ * phylink_pcs_neg_mode() - helper to determine PCS inband mode ++ * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND. ++ * @interface: interface mode to be used ++ * @advertising: adertisement ethtool link mode mask ++ * ++ * Determines the negotiation mode to be used by the PCS, and returns ++ * one of: ++ * ++ * - %PHYLINK_PCS_NEG_NONE: interface mode does not support inband ++ * - %PHYLINK_PCS_NEG_OUTBAND: an out of band mode (e.g. reading the PHY) ++ * will be used. ++ * - %PHYLINK_PCS_NEG_INBAND_DISABLED: inband mode selected but autoneg ++ * disabled ++ * - %PHYLINK_PCS_NEG_INBAND_ENABLED: inband mode selected and autoneg enabled ++ * ++ * Note: this is for cases where the PCS itself is involved in negotiation ++ * (e.g. Clause 37, SGMII and similar) not Clause 73. ++ */ ++static unsigned int phylink_pcs_neg_mode(unsigned int mode, ++ phy_interface_t interface, ++ const unsigned long *advertising) ++{ ++ unsigned int neg_mode; ++ ++ switch (interface) { ++ case PHY_INTERFACE_MODE_SGMII: ++ case PHY_INTERFACE_MODE_QSGMII: ++ case PHY_INTERFACE_MODE_QUSGMII: ++ case PHY_INTERFACE_MODE_USXGMII: ++ /* These protocols are designed for use with a PHY which ++ * communicates its negotiation result back to the MAC via ++ * inband communication. Note: there exist PHYs that run ++ * with SGMII but do not send the inband data. ++ */ ++ if (!phylink_autoneg_inband(mode)) ++ neg_mode = PHYLINK_PCS_NEG_OUTBAND; ++ else ++ neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED; ++ break; ++ ++ case PHY_INTERFACE_MODE_1000BASEX: ++ case PHY_INTERFACE_MODE_2500BASEX: ++ /* 1000base-X is designed for use media-side for Fibre ++ * connections, and thus the Autoneg bit needs to be ++ * taken into account. We also do this for 2500base-X ++ * as well, but drivers may not support this, so may ++ * need to override this. ++ */ ++ if (!phylink_autoneg_inband(mode)) ++ neg_mode = PHYLINK_PCS_NEG_OUTBAND; ++ else if (linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, ++ advertising)) ++ neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED; ++ else ++ neg_mode = PHYLINK_PCS_NEG_INBAND_DISABLED; ++ break; ++ ++ default: ++ neg_mode = PHYLINK_PCS_NEG_NONE; ++ break; ++ } ++ ++ return neg_mode; ++} ++ + static void phylink_major_config(struct phylink *pl, bool restart, + const struct phylink_link_state *state) + { +--- a/include/linux/phylink.h ++++ b/include/linux/phylink.h +@@ -99,72 +99,6 @@ static inline bool phylink_autoneg_inban + } + + /** +- * phylink_pcs_neg_mode() - helper to determine PCS inband mode +- * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND. +- * @interface: interface mode to be used +- * @advertising: adertisement ethtool link mode mask +- * +- * Determines the negotiation mode to be used by the PCS, and returns +- * one of: +- * +- * - %PHYLINK_PCS_NEG_NONE: interface mode does not support inband +- * - %PHYLINK_PCS_NEG_OUTBAND: an out of band mode (e.g. reading the PHY) +- * will be used. +- * - %PHYLINK_PCS_NEG_INBAND_DISABLED: inband mode selected but autoneg +- * disabled +- * - %PHYLINK_PCS_NEG_INBAND_ENABLED: inband mode selected and autoneg enabled +- * +- * Note: this is for cases where the PCS itself is involved in negotiation +- * (e.g. Clause 37, SGMII and similar) not Clause 73. +- */ +-static inline unsigned int phylink_pcs_neg_mode(unsigned int mode, +- phy_interface_t interface, +- const unsigned long *advertising) +-{ +- unsigned int neg_mode; +- +- switch (interface) { +- case PHY_INTERFACE_MODE_SGMII: +- case PHY_INTERFACE_MODE_QSGMII: +- case PHY_INTERFACE_MODE_QUSGMII: +- case PHY_INTERFACE_MODE_USXGMII: +- /* These protocols are designed for use with a PHY which +- * communicates its negotiation result back to the MAC via +- * inband communication. Note: there exist PHYs that run +- * with SGMII but do not send the inband data. +- */ +- if (!phylink_autoneg_inband(mode)) +- neg_mode = PHYLINK_PCS_NEG_OUTBAND; +- else +- neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED; +- break; +- +- case PHY_INTERFACE_MODE_1000BASEX: +- case PHY_INTERFACE_MODE_2500BASEX: +- /* 1000base-X is designed for use media-side for Fibre +- * connections, and thus the Autoneg bit needs to be +- * taken into account. We also do this for 2500base-X +- * as well, but drivers may not support this, so may +- * need to override this. +- */ +- if (!phylink_autoneg_inband(mode)) +- neg_mode = PHYLINK_PCS_NEG_OUTBAND; +- else if (linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, +- advertising)) +- neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED; +- else +- neg_mode = PHYLINK_PCS_NEG_INBAND_DISABLED; +- break; +- +- default: +- neg_mode = PHYLINK_PCS_NEG_NONE; +- break; +- } +- +- return neg_mode; +-} +- +-/** + * struct phylink_link_state - link state structure + * @advertising: ethtool bitmask containing advertised link modes + * @lp_advertising: ethtool bitmask containing link partner advertised link diff --git a/target/linux/mediatek/patches-6.6/739-net-add-negotiation-of-in-band-capabilities.patch b/target/linux/mediatek/patches-6.6/739-net-add-negotiation-of-in-band-capabilities.patch new file mode 100644 index 00000000000000..44a6aad7f535f5 --- /dev/null +++ b/target/linux/mediatek/patches-6.6/739-net-add-negotiation-of-in-band-capabilities.patch @@ -0,0 +1,1233 @@ +From: "Russell King (Oracle)" +To: Andrew Lunn , Heiner Kallweit +Cc: Alexander Couzens , + Andrew Lunn , + AngeloGioacchino Del Regno + , + Broadcom internal kernel review list + , + Daniel Golle , + "David S. Miller" , + Eric Dumazet , + Florian Fainelli , + Ioana Ciornei , + Jakub Kicinski , + Jose Abreu , + linux-arm-kernel@lists.infradead.org, + linux-mediatek@lists.infradead.org, + Marcin Wojtas , + Matthias Brugger , + netdev@vger.kernel.org, Paolo Abeni +Subject: [PATCH RFC net-next 00/16] net: add negotiation of in-band capabilities +Date: Tue, 26 Nov 2024 09:23:48 +0000 [thread overview] +Message-ID: (raw) + +Hi, + +Yes, this is one patch over the limit of 15 for netdev - but I think it's +important to include the last patch to head off review comments like "why +don't you remove phylink_phy_no_inband() in this series?" + +Phylink's handling of in-band has been deficient for a long time, and +people keep hitting problems with it. Notably, situations with the way- +to-late standardized 2500Base-X and whether that should or should not +have in-band enabled. We have also been carrying a hack in the form of +phylink_phy_no_inband() for a PHY that has been used on a SFP module, +but has no in-band capabilities, not even for SGMII. + +When phylink is trying to operate in in-band mode, this series will look +at the capabilities of the MAC-side PCS and PHY, and work out whether +in-band can or should be used, programming the PHY as appropriate. This +includes in-band bypass mode at the PHY. + +We don't... yet... support that on the MAC side PCS, because that +requires yet more complexity. + +Patch 1 passes struct phylink and struct phylink_pcs into +phylink_pcs_neg_mode() so we can look at more state in this function in +a future patch. + +Patch 2 splits "cur_link_an_mode" (the MLO_AN_* mode) into two separate +purposes - a requested and an active mode. The active mode is the one +we will be using for the MAC, which becomes dependent on the result of +in-band negotiation. + +Patch 3 adds debug to phylink_major_config() so we can see what is going +on with the requested and active AN modes. + +Patch 4 adds to phylib a method to get the in-band capabilities of the +PHY from phylib. Patches 5 and 6 add implementations for BCM84881 and +some Marvell PHYs found on SFPs. + +Patch 7 adds to phylib a method to configure the PHY in-band signalling, +and patch 8 implements it for those Marvell PHYs that support the method +in patch 4. + +Patch 9 does the same as patch 4 but for the MAC-side PCS, with patches +10 through 14 adding support to several PCS. + +Patch 15 adds the code to phylink_pcs_neg_mode() which looks at the +capabilities, and works out whether to use in-band or out-band mode for +driving the link between the MAC PCS and PHY. + +Patch 16 removes the phylink_phy_no_inband() hack now that we are +publishing the in-band capabilities from the BCM84881 PHY driver. + + drivers/net/ethernet/marvell/mvneta.c | 27 +- + drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 25 +- + drivers/net/pcs/pcs-lynx.c | 22 ++ + drivers/net/pcs/pcs-mtk-lynxi.c | 16 ++ + drivers/net/pcs/pcs-xpcs.c | 28 ++ + drivers/net/phy/bcm84881.c | 10 + + drivers/net/phy/marvell.c | 48 ++++ + drivers/net/phy/phy.c | 52 ++++ + drivers/net/phy/phylink.c | 352 +++++++++++++++++++----- + include/linux/phy.h | 34 +++ + include/linux/phylink.h | 17 ++ + 11 files changed, 539 insertions(+), 92 deletions(-) + +--- a/drivers/net/phy/phylink.c ++++ b/drivers/net/phy/phylink.c +@@ -56,7 +56,8 @@ struct phylink { + struct phy_device *phydev; + phy_interface_t link_interface; /* PHY_INTERFACE_xxx */ + u8 cfg_link_an_mode; /* MLO_AN_xxx */ +- u8 cur_link_an_mode; ++ u8 req_link_an_mode; /* Requested MLO_AN_xxx mode */ ++ u8 act_link_an_mode; /* Active MLO_AN_xxx mode */ + u8 link_port; /* The current non-phy ethtool port */ + __ETHTOOL_DECLARE_LINK_MODE_MASK(supported); + +@@ -74,6 +75,7 @@ struct phylink { + + struct mutex state_mutex; + struct phylink_link_state phy_state; ++ unsigned int phy_ib_mode; + struct work_struct resolve; + unsigned int pcs_neg_mode; + unsigned int pcs_state; +@@ -175,6 +177,24 @@ static const char *phylink_an_mode_str(u + return mode < ARRAY_SIZE(modestr) ? modestr[mode] : "unknown"; + } + ++static const char *phylink_pcs_mode_str(unsigned int mode) ++{ ++ if (!mode) ++ return "none"; ++ ++ if (mode & PHYLINK_PCS_NEG_OUTBAND) ++ return "outband"; ++ ++ if (mode & PHYLINK_PCS_NEG_INBAND) { ++ if (mode & PHYLINK_PCS_NEG_ENABLED) ++ return "inband,an-enabled"; ++ else ++ return "inband,an-disabled"; ++ } ++ ++ return "unknown"; ++} ++ + static unsigned int phylink_interface_signal_rate(phy_interface_t interface) + { + switch (interface) { +@@ -1053,6 +1073,15 @@ static void phylink_resolve_an_pause(str + } + } + ++static unsigned int phylink_pcs_inband_caps(struct phylink_pcs *pcs, ++ phy_interface_t interface) ++{ ++ if (pcs && pcs->ops->pcs_inband_caps) ++ return pcs->ops->pcs_inband_caps(pcs, interface); ++ ++ return 0; ++} ++ + static void phylink_pcs_pre_config(struct phylink_pcs *pcs, + phy_interface_t interface) + { +@@ -1106,6 +1135,24 @@ static void phylink_pcs_link_up(struct p + pcs->ops->pcs_link_up(pcs, neg_mode, interface, speed, duplex); + } + ++/* Query inband for a specific interface mode, asking the MAC for the ++ * PCS which will be used to handle the interface mode. ++ */ ++static unsigned int phylink_inband_caps(struct phylink *pl, ++ phy_interface_t interface) ++{ ++ struct phylink_pcs *pcs; ++ ++ if (!pl->mac_ops->mac_select_pcs) ++ return 0; ++ ++ pcs = pl->mac_ops->mac_select_pcs(pl->config, interface); ++ if (!pcs) ++ return 0; ++ ++ return phylink_pcs_inband_caps(pcs, interface); ++} ++ + static void phylink_pcs_poll_stop(struct phylink *pl) + { + if (pl->cfg_link_an_mode == MLO_AN_INBAND) +@@ -1132,13 +1179,13 @@ static void phylink_mac_config(struct ph + + phylink_dbg(pl, + "%s: mode=%s/%s/%s adv=%*pb pause=%02x\n", +- __func__, phylink_an_mode_str(pl->cur_link_an_mode), ++ __func__, phylink_an_mode_str(pl->act_link_an_mode), + phy_modes(st.interface), + phy_rate_matching_to_str(st.rate_matching), + __ETHTOOL_LINK_MODE_MASK_NBITS, st.advertising, + st.pause); + +- pl->mac_ops->mac_config(pl->config, pl->cur_link_an_mode, &st); ++ pl->mac_ops->mac_config(pl->config, pl->act_link_an_mode, &st); + } + + static void phylink_pcs_an_restart(struct phylink *pl) +@@ -1146,13 +1193,14 @@ static void phylink_pcs_an_restart(struc + if (pl->pcs && linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, + pl->link_config.advertising) && + phy_interface_mode_is_8023z(pl->link_config.interface) && +- phylink_autoneg_inband(pl->cur_link_an_mode)) ++ phylink_autoneg_inband(pl->act_link_an_mode)) + pl->pcs->ops->pcs_an_restart(pl->pcs); + } + + /** + * phylink_pcs_neg_mode() - helper to determine PCS inband mode +- * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND. ++ * @pl: a pointer to a &struct phylink returned from phylink_create() ++ * @pcs: a pointer to &struct phylink_pcs + * @interface: interface mode to be used + * @advertising: adertisement ethtool link mode mask + * +@@ -1169,11 +1217,21 @@ static void phylink_pcs_an_restart(struc + * Note: this is for cases where the PCS itself is involved in negotiation + * (e.g. Clause 37, SGMII and similar) not Clause 73. + */ +-static unsigned int phylink_pcs_neg_mode(unsigned int mode, +- phy_interface_t interface, +- const unsigned long *advertising) ++static void phylink_pcs_neg_mode(struct phylink *pl, struct phylink_pcs *pcs, ++ phy_interface_t interface, ++ const unsigned long *advertising) + { +- unsigned int neg_mode; ++ unsigned int pcs_ib_caps = 0; ++ unsigned int phy_ib_caps = 0; ++ unsigned int neg_mode, mode; ++ enum { ++ INBAND_CISCO_SGMII, ++ INBAND_BASEX, ++ } type; ++ ++ mode = pl->req_link_an_mode; ++ ++ pl->phy_ib_mode = 0; + + switch (interface) { + case PHY_INTERFACE_MODE_SGMII: +@@ -1185,10 +1243,7 @@ static unsigned int phylink_pcs_neg_mode + * inband communication. Note: there exist PHYs that run + * with SGMII but do not send the inband data. + */ +- if (!phylink_autoneg_inband(mode)) +- neg_mode = PHYLINK_PCS_NEG_OUTBAND; +- else +- neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED; ++ type = INBAND_CISCO_SGMII; + break; + + case PHY_INTERFACE_MODE_1000BASEX: +@@ -1199,21 +1254,143 @@ static unsigned int phylink_pcs_neg_mode + * as well, but drivers may not support this, so may + * need to override this. + */ +- if (!phylink_autoneg_inband(mode)) ++ type = INBAND_BASEX; ++ break; ++ ++ default: ++ pl->pcs_neg_mode = PHYLINK_PCS_NEG_NONE; ++ pl->act_link_an_mode = mode; ++ return; ++ } ++ ++ if (pcs) ++ pcs_ib_caps = phylink_pcs_inband_caps(pcs, interface); ++ ++ if (pl->phydev) ++ phy_ib_caps = phy_inband_caps(pl->phydev, interface); ++ ++ phylink_dbg(pl, "interface %s inband modes: pcs=%02x phy=%02x\n", ++ phy_modes(interface), pcs_ib_caps, phy_ib_caps); ++ ++ if (!phylink_autoneg_inband(mode)) { ++ bool pcs_ib_only = false; ++ bool phy_ib_only = false; ++ ++ if (pcs_ib_caps && pcs_ib_caps != LINK_INBAND_DISABLE) { ++ /* PCS supports reporting in-band capabilities, and ++ * supports more than disable mode. ++ */ ++ if (pcs_ib_caps & LINK_INBAND_DISABLE) ++ neg_mode = PHYLINK_PCS_NEG_OUTBAND; ++ else if (pcs_ib_caps & LINK_INBAND_ENABLE) ++ pcs_ib_only = true; ++ } ++ ++ if (phy_ib_caps && phy_ib_caps != LINK_INBAND_DISABLE) { ++ /* PHY supports in-band capabilities, and supports ++ * more than disable mode. ++ */ ++ if (phy_ib_caps & LINK_INBAND_DISABLE) ++ pl->phy_ib_mode = LINK_INBAND_DISABLE; ++ else if (phy_ib_caps & LINK_INBAND_BYPASS) ++ pl->phy_ib_mode = LINK_INBAND_BYPASS; ++ else if (phy_ib_caps & LINK_INBAND_ENABLE) ++ phy_ib_only = true; ++ } ++ ++ /* If either the PCS or PHY requires inband to be enabled, ++ * this is an invalid configuration. Provide a diagnostic ++ * message for this case, but don't try to force the issue. ++ */ ++ if (pcs_ib_only || phy_ib_only) ++ phylink_warn(pl, ++ "firmware wants %s mode, but %s%s%s requires inband\n", ++ phylink_an_mode_str(mode), ++ pcs_ib_only ? "PCS" : "", ++ pcs_ib_only && phy_ib_only ? " and " : "", ++ phy_ib_only ? "PHY" : ""); ++ ++ neg_mode = PHYLINK_PCS_NEG_OUTBAND; ++ } else if (type == INBAND_CISCO_SGMII || pl->phydev) { ++ /* For SGMII modes which are designed to be used with PHYs, or ++ * Base-X with a PHY, we try to use in-band mode where-ever ++ * possible. However, there are some PHYs e.g. BCM84881 which ++ * do not support in-band. ++ */ ++ const unsigned int inband_ok = LINK_INBAND_ENABLE | ++ LINK_INBAND_BYPASS; ++ const unsigned int outband_ok = LINK_INBAND_DISABLE | ++ LINK_INBAND_BYPASS; ++ /* PCS PHY ++ * D E D E ++ * 0 0 0 0 no information inband enabled ++ * 1 0 0 0 pcs doesn't support outband ++ * 0 1 0 0 pcs required inband enabled ++ * 1 1 0 0 pcs optional inband enabled ++ * 0 0 1 0 phy doesn't support outband ++ * 1 0 1 0 pcs+phy doesn't support outband ++ * 0 1 1 0 pcs required, phy doesn't support, invalid ++ * 1 1 1 0 pcs optional, phy doesn't support, outband ++ * 0 0 0 1 phy required inband enabled ++ * 1 0 0 1 pcs doesn't support, phy required, invalid ++ * 0 1 0 1 pcs+phy required inband enabled ++ * 1 1 0 1 pcs optional, phy required inband enabled ++ * 0 0 1 1 phy optional inband enabled ++ * 1 0 1 1 pcs doesn't support, phy optional, outband ++ * 0 1 1 1 pcs required, phy optional inband enabled ++ * 1 1 1 1 pcs+phy optional inband enabled ++ */ ++ if ((!pcs_ib_caps || pcs_ib_caps & inband_ok) && ++ (!phy_ib_caps || phy_ib_caps & inband_ok)) { ++ /* In-band supported or unknown at both ends. Enable ++ * in-band mode with or without bypass at the PHY. ++ */ ++ if (phy_ib_caps & LINK_INBAND_ENABLE) ++ pl->phy_ib_mode = LINK_INBAND_ENABLE; ++ else if (phy_ib_caps & LINK_INBAND_BYPASS) ++ pl->phy_ib_mode = LINK_INBAND_BYPASS; ++ ++ neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED; ++ } else if ((!pcs_ib_caps || pcs_ib_caps & outband_ok) && ++ (!phy_ib_caps || phy_ib_caps & outband_ok)) { ++ /* Either in-band not supported at at least one end. ++ * In-band bypass at the other end is possible. ++ */ ++ if (phy_ib_caps & LINK_INBAND_DISABLE) ++ pl->phy_ib_mode = LINK_INBAND_DISABLE; ++ else if (phy_ib_caps & LINK_INBAND_BYPASS) ++ pl->phy_ib_mode = LINK_INBAND_BYPASS; ++ + neg_mode = PHYLINK_PCS_NEG_OUTBAND; ++ if (pl->phydev) ++ mode = MLO_AN_PHY; ++ } else { ++ /* invalid */ ++ phylink_warn(pl, "%s: incompatible in-band capabilities, trying in-band", ++ phy_modes(interface)); ++ neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED; ++ } ++ } else { ++ /* For Base-X without a PHY */ ++ if (pcs_ib_caps == LINK_INBAND_DISABLE) ++ /* If the PCS doesn't support inband, then inband must ++ * be disabled. ++ */ ++ neg_mode = PHYLINK_PCS_NEG_INBAND_DISABLED; ++ else if (pcs_ib_caps == LINK_INBAND_ENABLE) ++ /* If the PCS requires inband, then inband must always ++ * be enabled. ++ */ ++ neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED; + else if (linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, + advertising)) + neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED; + else + neg_mode = PHYLINK_PCS_NEG_INBAND_DISABLED; +- break; +- +- default: +- neg_mode = PHYLINK_PCS_NEG_NONE; +- break; + } + +- return neg_mode; ++ pl->pcs_neg_mode = neg_mode; ++ pl->act_link_an_mode = mode; + } + + static void phylink_major_config(struct phylink *pl, bool restart, +@@ -1225,11 +1402,9 @@ static void phylink_major_config(struct + unsigned int neg_mode; + int err; + +- phylink_dbg(pl, "major config %s\n", phy_modes(state->interface)); +- +- pl->pcs_neg_mode = phylink_pcs_neg_mode(pl->cur_link_an_mode, +- state->interface, +- state->advertising); ++ phylink_dbg(pl, "major config, requested %s/%s\n", ++ phylink_an_mode_str(pl->req_link_an_mode), ++ phy_modes(state->interface)); + + if (pl->using_mac_select_pcs) { + pcs = pl->mac_ops->mac_select_pcs(pl->config, state->interface); +@@ -1243,10 +1418,17 @@ static void phylink_major_config(struct + pcs_changed = pcs && pl->pcs != pcs; + } + ++ phylink_pcs_neg_mode(pl, pcs, state->interface, state->advertising); ++ ++ phylink_dbg(pl, "major config, active %s/%s/%s\n", ++ phylink_an_mode_str(pl->act_link_an_mode), ++ phylink_pcs_mode_str(pl->pcs_neg_mode), ++ phy_modes(state->interface)); ++ + phylink_pcs_poll_stop(pl); + + if (pl->mac_ops->mac_prepare) { +- err = pl->mac_ops->mac_prepare(pl->config, pl->cur_link_an_mode, ++ err = pl->mac_ops->mac_prepare(pl->config, pl->act_link_an_mode, + state->interface); + if (err < 0) { + phylink_err(pl, "mac_prepare failed: %pe\n", +@@ -1280,7 +1462,7 @@ static void phylink_major_config(struct + if (pl->pcs_state == PCS_STATE_STARTING || pcs_changed) + phylink_pcs_enable(pl->pcs); + +- neg_mode = pl->cur_link_an_mode; ++ neg_mode = pl->act_link_an_mode; + if (pl->pcs && pl->pcs->neg_mode) + neg_mode = pl->pcs_neg_mode; + +@@ -1296,13 +1478,20 @@ static void phylink_major_config(struct + phylink_pcs_an_restart(pl); + + if (pl->mac_ops->mac_finish) { +- err = pl->mac_ops->mac_finish(pl->config, pl->cur_link_an_mode, ++ err = pl->mac_ops->mac_finish(pl->config, pl->act_link_an_mode, + state->interface); + if (err < 0) + phylink_err(pl, "mac_finish failed: %pe\n", + ERR_PTR(err)); + } + ++ if (pl->phydev && pl->phy_ib_mode) { ++ err = phy_config_inband(pl->phydev, pl->phy_ib_mode); ++ if (err < 0) ++ phylink_err(pl, "phy_config_inband: %pe\n", ++ ERR_PTR(err)); ++ } ++ + if (pl->sfp_bus) { + rate_kbd = phylink_interface_signal_rate(state->interface); + if (rate_kbd) +@@ -1327,17 +1516,16 @@ static int phylink_change_inband_advert( + return 0; + + phylink_dbg(pl, "%s: mode=%s/%s adv=%*pb pause=%02x\n", __func__, +- phylink_an_mode_str(pl->cur_link_an_mode), ++ phylink_an_mode_str(pl->req_link_an_mode), + phy_modes(pl->link_config.interface), + __ETHTOOL_LINK_MODE_MASK_NBITS, pl->link_config.advertising, + pl->link_config.pause); + + /* Recompute the PCS neg mode */ +- pl->pcs_neg_mode = phylink_pcs_neg_mode(pl->cur_link_an_mode, +- pl->link_config.interface, +- pl->link_config.advertising); ++ phylink_pcs_neg_mode(pl, pl->pcs, pl->link_config.interface, ++ pl->link_config.advertising); + +- neg_mode = pl->cur_link_an_mode; ++ neg_mode = pl->act_link_an_mode; + if (pl->pcs->neg_mode) + neg_mode = pl->pcs_neg_mode; + +@@ -1402,7 +1590,7 @@ static void phylink_mac_initial_config(s + { + struct phylink_link_state link_state; + +- switch (pl->cur_link_an_mode) { ++ switch (pl->req_link_an_mode) { + case MLO_AN_PHY: + link_state = pl->phy_state; + break; +@@ -1476,14 +1664,14 @@ static void phylink_link_up(struct phyli + + pl->cur_interface = link_state.interface; + +- neg_mode = pl->cur_link_an_mode; ++ neg_mode = pl->act_link_an_mode; + if (pl->pcs && pl->pcs->neg_mode) + neg_mode = pl->pcs_neg_mode; + + phylink_pcs_link_up(pl->pcs, neg_mode, pl->cur_interface, speed, + duplex); + +- pl->mac_ops->mac_link_up(pl->config, pl->phydev, pl->cur_link_an_mode, ++ pl->mac_ops->mac_link_up(pl->config, pl->phydev, pl->act_link_an_mode, + pl->cur_interface, speed, duplex, + !!(link_state.pause & MLO_PAUSE_TX), rx_pause); + +@@ -1503,7 +1691,7 @@ static void phylink_link_down(struct phy + + if (ndev) + netif_carrier_off(ndev); +- pl->mac_ops->mac_link_down(pl->config, pl->cur_link_an_mode, ++ pl->mac_ops->mac_link_down(pl->config, pl->act_link_an_mode, + pl->cur_interface); + phylink_info(pl, "Link is Down\n"); + } +@@ -1530,7 +1718,7 @@ static void phylink_resolve(struct work_ + link_state.link = false; + retrigger = true; + } else { +- switch (pl->cur_link_an_mode) { ++ switch (pl->act_link_an_mode) { + case MLO_AN_PHY: + link_state = pl->phy_state; + phylink_apply_manual_flow(pl, &link_state); +@@ -1773,7 +1961,7 @@ struct phylink *phylink_create(struct ph + } + } + +- pl->cur_link_an_mode = pl->cfg_link_an_mode; ++ pl->req_link_an_mode = pl->cfg_link_an_mode; + + ret = phylink_register_sfp(pl, fwnode); + if (ret < 0) { +@@ -2236,7 +2424,7 @@ void phylink_start(struct phylink *pl) + ASSERT_RTNL(); + + phylink_info(pl, "configuring for %s/%s link mode\n", +- phylink_an_mode_str(pl->cur_link_an_mode), ++ phylink_an_mode_str(pl->req_link_an_mode), + phy_modes(pl->link_config.interface)); + + /* Always set the carrier off */ +@@ -2495,7 +2683,7 @@ int phylink_ethtool_ksettings_get(struct + + linkmode_copy(kset->link_modes.supported, pl->supported); + +- switch (pl->cur_link_an_mode) { ++ switch (pl->act_link_an_mode) { + case MLO_AN_FIXED: + /* We are using fixed settings. Report these as the + * current link settings - and note that these also +@@ -2526,6 +2714,26 @@ int phylink_ethtool_ksettings_get(struct + } + EXPORT_SYMBOL_GPL(phylink_ethtool_ksettings_get); + ++static bool phylink_validate_pcs_inband_autoneg(struct phylink *pl, ++ phy_interface_t interface, ++ unsigned long *adv) ++{ ++ unsigned int inband = phylink_inband_caps(pl, interface); ++ unsigned int mask; ++ ++ /* If the PCS doesn't implement inband support, be permissive. */ ++ if (!inband) ++ return true; ++ ++ if (linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, adv)) ++ mask = LINK_INBAND_ENABLE; ++ else ++ mask = LINK_INBAND_DISABLE; ++ ++ /* Check whether the PCS implements the required mode */ ++ return !!(inband & mask); ++} ++ + /** + * phylink_ethtool_ksettings_set() - set the link settings + * @pl: a pointer to a &struct phylink returned from phylink_create() +@@ -2587,7 +2795,7 @@ int phylink_ethtool_ksettings_set(struct + /* If we have a fixed link, refuse to change link parameters. + * If the link parameters match, accept them but do nothing. + */ +- if (pl->cur_link_an_mode == MLO_AN_FIXED) { ++ if (pl->req_link_an_mode == MLO_AN_FIXED) { + if (s->speed != pl->link_config.speed || + s->duplex != pl->link_config.duplex) + return -EINVAL; +@@ -2603,7 +2811,7 @@ int phylink_ethtool_ksettings_set(struct + * is our default case) but do not allow the advertisement to + * be changed. If the advertisement matches, simply return. + */ +- if (pl->cur_link_an_mode == MLO_AN_FIXED) { ++ if (pl->req_link_an_mode == MLO_AN_FIXED) { + if (!linkmode_equal(config.advertising, + pl->link_config.advertising)) + return -EINVAL; +@@ -2643,7 +2851,7 @@ int phylink_ethtool_ksettings_set(struct + linkmode_copy(support, pl->supported); + if (phylink_validate(pl, support, &config)) { + phylink_err(pl, "validation of %s/%s with support %*pb failed\n", +- phylink_an_mode_str(pl->cur_link_an_mode), ++ phylink_an_mode_str(pl->req_link_an_mode), + phy_modes(config.interface), + __ETHTOOL_LINK_MODE_MASK_NBITS, support); + return -EINVAL; +@@ -2661,6 +2869,13 @@ int phylink_ethtool_ksettings_set(struct + phylink_is_empty_linkmode(config.advertising)) + return -EINVAL; + ++ /* Validate the autonegotiation state. We don't have a PHY in this ++ * situation, so the PCS is the media-facing entity. ++ */ ++ if (!phylink_validate_pcs_inband_autoneg(pl, config.interface, ++ config.advertising)) ++ return -EINVAL; ++ + mutex_lock(&pl->state_mutex); + pl->link_config.speed = config.speed; + pl->link_config.duplex = config.duplex; +@@ -2743,7 +2958,7 @@ int phylink_ethtool_set_pauseparam(struc + + ASSERT_RTNL(); + +- if (pl->cur_link_an_mode == MLO_AN_FIXED) ++ if (pl->req_link_an_mode == MLO_AN_FIXED) + return -EOPNOTSUPP; + + if (!phylink_test(pl->supported, Pause) && +@@ -3007,7 +3222,7 @@ static int phylink_mii_read(struct phyli + struct phylink_link_state state; + int val = 0xffff; + +- switch (pl->cur_link_an_mode) { ++ switch (pl->act_link_an_mode) { + case MLO_AN_FIXED: + if (phy_id == 0) { + phylink_get_fixed_state(pl, &state); +@@ -3032,7 +3247,7 @@ static int phylink_mii_read(struct phyli + static int phylink_mii_write(struct phylink *pl, unsigned int phy_id, + unsigned int reg, unsigned int val) + { +- switch (pl->cur_link_an_mode) { ++ switch (pl->act_link_an_mode) { + case MLO_AN_FIXED: + break; + +@@ -3202,10 +3417,11 @@ static phy_interface_t phylink_choose_sf + return interface; + } + +-static void phylink_sfp_set_config(struct phylink *pl, u8 mode, ++static void phylink_sfp_set_config(struct phylink *pl, + unsigned long *supported, + struct phylink_link_state *state) + { ++ u8 mode = MLO_AN_INBAND; + bool changed = false; + + phylink_dbg(pl, "requesting link mode %s/%s with support %*pb\n", +@@ -3222,9 +3438,9 @@ static void phylink_sfp_set_config(struc + changed = true; + } + +- if (pl->cur_link_an_mode != mode || ++ if (pl->req_link_an_mode != mode || + pl->link_config.interface != state->interface) { +- pl->cur_link_an_mode = mode; ++ pl->req_link_an_mode = mode; + pl->link_config.interface = state->interface; + + changed = true; +@@ -3239,8 +3455,7 @@ static void phylink_sfp_set_config(struc + phylink_mac_initial_config(pl, false); + } + +-static int phylink_sfp_config_phy(struct phylink *pl, u8 mode, +- struct phy_device *phy) ++static int phylink_sfp_config_phy(struct phylink *pl, struct phy_device *phy) + { + __ETHTOOL_DECLARE_LINK_MODE_MASK(support1); + __ETHTOOL_DECLARE_LINK_MODE_MASK(support); +@@ -3279,8 +3494,7 @@ static int phylink_sfp_config_phy(struct + ret = phylink_validate(pl, support1, &config); + if (ret) { + phylink_err(pl, +- "validation of %s/%s with support %*pb failed: %pe\n", +- phylink_an_mode_str(mode), ++ "validation of %s with support %*pb failed: %pe\n", + phy_modes(config.interface), + __ETHTOOL_LINK_MODE_MASK_NBITS, support, + ERR_PTR(ret)); +@@ -3289,7 +3503,7 @@ static int phylink_sfp_config_phy(struct + + pl->link_port = pl->sfp_port; + +- phylink_sfp_set_config(pl, mode, support, &config); ++ phylink_sfp_set_config(pl, support, &config); + + return 0; + } +@@ -3345,6 +3559,12 @@ static int phylink_sfp_config_optical(st + phylink_dbg(pl, "optical SFP: chosen %s interface\n", + phy_modes(interface)); + ++ if (!phylink_validate_pcs_inband_autoneg(pl, interface, ++ config.advertising)) { ++ phylink_err(pl, "autoneg setting not compatible with PCS"); ++ return -EINVAL; ++ } ++ + config.interface = interface; + + /* Ignore errors if we're expecting a PHY to attach later */ +@@ -3358,7 +3578,7 @@ static int phylink_sfp_config_optical(st + + pl->link_port = pl->sfp_port; + +- phylink_sfp_set_config(pl, MLO_AN_INBAND, pl->sfp_support, &config); ++ phylink_sfp_set_config(pl, pl->sfp_support, &config); + + return 0; + } +@@ -3429,20 +3649,10 @@ static void phylink_sfp_link_up(void *up + phylink_enable_and_run_resolve(pl, PHYLINK_DISABLE_LINK); + } + +-/* The Broadcom BCM84881 in the Methode DM7052 is unable to provide a SGMII +- * or 802.3z control word, so inband will not work. +- */ +-static bool phylink_phy_no_inband(struct phy_device *phy) +-{ +- return phy->is_c45 && phy_id_compare(phy->c45_ids.device_ids[1], +- 0xae025150, 0xfffffff0); +-} +- + static int phylink_sfp_connect_phy(void *upstream, struct phy_device *phy) + { + struct phylink *pl = upstream; + phy_interface_t interface; +- u8 mode; + int ret; + + /* +@@ -3454,17 +3664,12 @@ static int phylink_sfp_connect_phy(void + */ + phy_support_asym_pause(phy); + +- if (phylink_phy_no_inband(phy)) +- mode = MLO_AN_PHY; +- else +- mode = MLO_AN_INBAND; +- + /* Set the PHY's host supported interfaces */ + phy_interface_and(phy->host_interfaces, phylink_sfp_interfaces, + pl->config->supported_interfaces); + + /* Do the initial configuration */ +- ret = phylink_sfp_config_phy(pl, mode, phy); ++ ret = phylink_sfp_config_phy(pl, phy); + if (ret < 0) + return ret; + +--- a/drivers/net/phy/phy.c ++++ b/drivers/net/phy/phy.c +@@ -973,6 +973,58 @@ static int phy_check_link_status(struct + } + + /** ++ * phy_inband_caps - query which in-band signalling modes are supported ++ * @phydev: a pointer to a &struct phy_device ++ * @interface: the interface mode for the PHY ++ * ++ * Returns zero if it is unknown what in-band signalling is supported by the ++ * PHY (e.g. because the PHY driver doesn't implement the method.) Otherwise, ++ * returns a bit mask of the LINK_INBAND_* values from ++ * &enum link_inband_signalling to describe which inband modes are supported ++ * by the PHY for this interface mode. ++ */ ++unsigned int phy_inband_caps(struct phy_device *phydev, ++ phy_interface_t interface) ++{ ++ if (phydev->drv && phydev->drv->inband_caps) ++ return phydev->drv->inband_caps(phydev, interface); ++ ++ return 0; ++} ++EXPORT_SYMBOL_GPL(phy_inband_caps); ++ ++/** ++ * phy_config_inband - configure the desired PHY in-band mode ++ * @phydev: the phy_device struct ++ * @modes: in-band modes to configure ++ * ++ * Description: disables, enables or enables-with-bypass in-band signalling ++ * between the PHY and host system. ++ * ++ * Returns: zero on success, or negative errno value. ++ */ ++int phy_config_inband(struct phy_device *phydev, unsigned int modes) ++{ ++ int err; ++ ++ if (!!(modes & LINK_INBAND_DISABLE) + ++ !!(modes & LINK_INBAND_ENABLE) + ++ !!(modes & LINK_INBAND_BYPASS) != 1) ++ return -EINVAL; ++ ++ mutex_lock(&phydev->lock); ++ if (!phydev->drv) ++ err = -EIO; ++ else if (!phydev->drv->config_inband) ++ err = -EOPNOTSUPP; ++ else ++ err = phydev->drv->config_inband(phydev, modes); ++ mutex_unlock(&phydev->lock); ++ ++ return err; ++} ++ ++/** + * _phy_start_aneg - start auto-negotiation for this PHY device + * @phydev: the phy_device struct + * +--- a/include/linux/phy.h ++++ b/include/linux/phy.h +@@ -800,6 +800,24 @@ struct phy_tdr_config { + #define PHY_PAIR_ALL -1 + + /** ++ * enum link_inband_signalling - in-band signalling modes that are supported ++ * ++ * @LINK_INBAND_DISABLE: in-band signalling can be disabled ++ * @LINK_INBAND_ENABLE: in-band signalling can be enabled without bypass ++ * @LINK_INBAND_BYPASS: in-band signalling can be enabled with bypass ++ * ++ * The possible and required bits can only be used if the valid bit is set. ++ * If possible is clear, that means inband signalling can not be used. ++ * Required is only valid when possible is set, and means that inband ++ * signalling must be used. ++ */ ++enum link_inband_signalling { ++ LINK_INBAND_DISABLE = BIT(0), ++ LINK_INBAND_ENABLE = BIT(1), ++ LINK_INBAND_BYPASS = BIT(2), ++}; ++ ++/** + * struct phy_plca_cfg - Configuration of the PLCA (Physical Layer Collision + * Avoidance) Reconciliation Sublayer. + * +@@ -939,6 +957,19 @@ struct phy_driver { + int (*get_features)(struct phy_device *phydev); + + /** ++ * @inband_caps: query whether in-band is supported for the given PHY ++ * interface mode. Returns a bitmask of bits defined by enum ++ * link_inband_signalling. ++ */ ++ unsigned int (*inband_caps)(struct phy_device *phydev, ++ phy_interface_t interface); ++ ++ /** ++ * @config_inband: configure in-band mode for the PHY ++ */ ++ int (*config_inband)(struct phy_device *phydev, unsigned int modes); ++ ++ /** + * @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 +@@ -1774,6 +1805,9 @@ void phy_stop(struct phy_device *phydev) + int phy_config_aneg(struct phy_device *phydev); + int phy_start_aneg(struct phy_device *phydev); + int phy_aneg_done(struct phy_device *phydev); ++unsigned int phy_inband_caps(struct phy_device *phydev, ++ phy_interface_t interface); ++int phy_config_inband(struct phy_device *phydev, unsigned int modes); + int phy_speed_down(struct phy_device *phydev, bool sync); + int phy_speed_up(struct phy_device *phydev); + bool phy_check_valid(int speed, int duplex, unsigned long *features); +--- a/drivers/net/phy/bcm84881.c ++++ b/drivers/net/phy/bcm84881.c +@@ -223,11 +223,21 @@ static int bcm84881_read_status(struct p + return genphy_c45_read_mdix(phydev); + } + ++/* The Broadcom BCM84881 in the Methode DM7052 is unable to provide a SGMII ++ * or 802.3z control word, so inband will not work. ++ */ ++static unsigned int bcm84881_inband_caps(struct phy_device *phydev, ++ phy_interface_t interface) ++{ ++ return LINK_INBAND_DISABLE; ++} ++ + static struct phy_driver bcm84881_drivers[] = { + { + .phy_id = 0xae025150, + .phy_id_mask = 0xfffffff0, + .name = "Broadcom BCM84881", ++ .inband_caps = bcm84881_inband_caps, + .config_init = bcm84881_config_init, + .probe = bcm84881_probe, + .get_features = bcm84881_get_features, +--- a/drivers/net/phy/marvell.c ++++ b/drivers/net/phy/marvell.c +@@ -673,6 +673,48 @@ static int marvell_config_aneg_fiber(str + return genphy_check_and_restart_aneg(phydev, changed); + } + ++static unsigned int m88e1111_inband_caps(struct phy_device *phydev, ++ phy_interface_t interface) ++{ ++ /* In 1000base-X and SGMII modes, the inband mode can be changed ++ * through the Fibre page BMCR ANENABLE bit. ++ */ ++ if (interface == PHY_INTERFACE_MODE_1000BASEX || ++ interface == PHY_INTERFACE_MODE_SGMII) ++ return LINK_INBAND_DISABLE | LINK_INBAND_ENABLE | ++ LINK_INBAND_BYPASS; ++ ++ return 0; ++} ++ ++static int m88e1111_config_inband(struct phy_device *phydev, unsigned int modes) ++{ ++ u16 extsr, bmcr; ++ int err; ++ ++ if (phydev->interface != PHY_INTERFACE_MODE_1000BASEX && ++ phydev->interface != PHY_INTERFACE_MODE_SGMII) ++ return -EINVAL; ++ ++ if (modes == LINK_INBAND_BYPASS) ++ extsr = MII_M1111_HWCFG_SERIAL_AN_BYPASS; ++ else ++ extsr = 0; ++ ++ if (modes == LINK_INBAND_DISABLE) ++ bmcr = 0; ++ else ++ bmcr = BMCR_ANENABLE; ++ ++ err = phy_modify(phydev, MII_M1111_PHY_EXT_SR, ++ MII_M1111_HWCFG_SERIAL_AN_BYPASS, extsr); ++ if (err < 0) ++ return extsr; ++ ++ return phy_modify_paged(phydev, MII_MARVELL_FIBER_PAGE, MII_BMCR, ++ BMCR_ANENABLE, bmcr); ++} ++ + static int m88e1111_config_aneg(struct phy_device *phydev) + { + int extsr = phy_read(phydev, MII_M1111_PHY_EXT_SR); +@@ -3292,6 +3334,8 @@ static struct phy_driver marvell_drivers + .name = "Marvell 88E1112", + /* PHY_GBIT_FEATURES */ + .probe = marvell_probe, ++ .inband_caps = m88e1111_inband_caps, ++ .config_inband = m88e1111_config_inband, + .config_init = m88e1112_config_init, + .config_aneg = marvell_config_aneg, + .config_intr = marvell_config_intr, +@@ -3312,6 +3356,8 @@ static struct phy_driver marvell_drivers + .name = "Marvell 88E1111", + /* PHY_GBIT_FEATURES */ + .probe = marvell_probe, ++ .inband_caps = m88e1111_inband_caps, ++ .config_inband = m88e1111_config_inband, + .config_init = m88e1111gbe_config_init, + .config_aneg = m88e1111_config_aneg, + .read_status = marvell_read_status, +@@ -3333,6 +3379,8 @@ static struct phy_driver marvell_drivers + .name = "Marvell 88E1111 (Finisar)", + /* PHY_GBIT_FEATURES */ + .probe = marvell_probe, ++ .inband_caps = m88e1111_inband_caps, ++ .config_inband = m88e1111_config_inband, + .config_init = m88e1111gbe_config_init, + .config_aneg = m88e1111_config_aneg, + .read_status = marvell_read_status, +--- a/include/linux/phylink.h ++++ b/include/linux/phylink.h +@@ -432,6 +432,7 @@ struct phylink_pcs { + /** + * struct phylink_pcs_ops - MAC PCS operations structure. + * @pcs_validate: validate the link configuration. ++ * @pcs_inband_caps: query inband support for interface mode. + * @pcs_enable: enable the PCS. + * @pcs_disable: disable the PCS. + * @pcs_pre_config: pre-mac_config method (for errata) +@@ -445,6 +446,8 @@ struct phylink_pcs { + struct phylink_pcs_ops { + int (*pcs_validate)(struct phylink_pcs *pcs, unsigned long *supported, + const struct phylink_link_state *state); ++ unsigned int (*pcs_inband_caps)(struct phylink_pcs *pcs, ++ phy_interface_t interface); + int (*pcs_enable)(struct phylink_pcs *pcs); + void (*pcs_disable)(struct phylink_pcs *pcs); + void (*pcs_pre_config)(struct phylink_pcs *pcs, +@@ -481,6 +484,20 @@ int pcs_validate(struct phylink_pcs *pcs + const struct phylink_link_state *state); + + /** ++ * pcs_inband_caps - query PCS in-band capabilities for interface mode. ++ * @pcs: a pointer to a &struct phylink_pcs. ++ * @interface: interface mode to be queried ++ * ++ * Returns zero if it is unknown what in-band signalling is supported by the ++ * PHY (e.g. because the PHY driver doesn't implement the method.) Otherwise, ++ * returns a bit mask of the LINK_INBAND_* values from ++ * &enum link_inband_signalling to describe which inband modes are supported ++ * for this interface mode. ++ */ ++unsigned int pcs_inband_caps(struct phylink_pcs *pcs, ++ phy_interface_t interface); ++ ++/** + * pcs_enable() - enable the PCS. + * @pcs: a pointer to a &struct phylink_pcs. + */ +--- a/drivers/net/ethernet/marvell/mvneta.c ++++ b/drivers/net/ethernet/marvell/mvneta.c +@@ -3959,20 +3959,27 @@ static struct mvneta_port *mvneta_pcs_to + return container_of(pcs, struct mvneta_port, phylink_pcs); + } + +-static int mvneta_pcs_validate(struct phylink_pcs *pcs, +- unsigned long *supported, +- const struct phylink_link_state *state) ++static unsigned int mvneta_pcs_inband_caps(struct phylink_pcs *pcs, ++ phy_interface_t interface) + { +- /* We only support QSGMII, SGMII, 802.3z and RGMII modes. +- * When in 802.3z mode, we must have AN enabled: ++ /* When operating in an 802.3z mode, we must have AN enabled: + * "Bit 2 Field InBandAnEn In-band Auto-Negotiation enable. ... + * When = 1 (1000BASE-X) this field must be set to 1." ++ * Therefore, inband is "required". + */ +- if (phy_interface_mode_is_8023z(state->interface) && +- !phylink_test(state->advertising, Autoneg)) +- return -EINVAL; ++ if (phy_interface_mode_is_8023z(interface)) ++ return LINK_INBAND_ENABLE; + +- return 0; ++ /* QSGMII, SGMII and RGMII can be configured to use inband ++ * signalling of the AN result. Indicate these as "possible". ++ */ ++ if (interface == PHY_INTERFACE_MODE_SGMII || ++ interface == PHY_INTERFACE_MODE_QSGMII || ++ phy_interface_mode_is_rgmii(interface)) ++ return LINK_INBAND_DISABLE | LINK_INBAND_ENABLE; ++ ++ /* For any other modes, indicate that inband is not supported. */ ++ return LINK_INBAND_DISABLE; + } + + static void mvneta_pcs_get_state(struct phylink_pcs *pcs, +@@ -4070,7 +4077,7 @@ static void mvneta_pcs_an_restart(struct + } + + static const struct phylink_pcs_ops mvneta_phylink_pcs_ops = { +- .pcs_validate = mvneta_pcs_validate, ++ .pcs_inband_caps = mvneta_pcs_inband_caps, + .pcs_get_state = mvneta_pcs_get_state, + .pcs_config = mvneta_pcs_config, + .pcs_an_restart = mvneta_pcs_an_restart, +--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c ++++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +@@ -6214,19 +6214,26 @@ static const struct phylink_pcs_ops mvpp + .pcs_config = mvpp2_xlg_pcs_config, + }; + +-static int mvpp2_gmac_pcs_validate(struct phylink_pcs *pcs, +- unsigned long *supported, +- const struct phylink_link_state *state) ++static unsigned int mvpp2_gmac_pcs_inband_caps(struct phylink_pcs *pcs, ++ phy_interface_t interface) + { +- /* When in 802.3z mode, we must have AN enabled: ++ /* When operating in an 802.3z mode, we must have AN enabled: + * Bit 2 Field InBandAnEn In-band Auto-Negotiation enable. ... + * When = 1 (1000BASE-X) this field must be set to 1. ++ * Therefore, inband is "required". + */ +- if (phy_interface_mode_is_8023z(state->interface) && +- !phylink_test(state->advertising, Autoneg)) +- return -EINVAL; ++ if (phy_interface_mode_is_8023z(interface)) ++ return LINK_INBAND_ENABLE; + +- return 0; ++ /* SGMII and RGMII can be configured to use inband signalling of the ++ * AN result. Indicate these as "possible". ++ */ ++ if (interface == PHY_INTERFACE_MODE_SGMII || ++ phy_interface_mode_is_rgmii(interface)) ++ return LINK_INBAND_DISABLE | LINK_INBAND_ENABLE; ++ ++ /* For any other modes, indicate that inband is not supported. */ ++ return LINK_INBAND_DISABLE; + } + + static void mvpp2_gmac_pcs_get_state(struct phylink_pcs *pcs, +@@ -6333,7 +6340,7 @@ static void mvpp2_gmac_pcs_an_restart(st + } + + static const struct phylink_pcs_ops mvpp2_phylink_gmac_pcs_ops = { +- .pcs_validate = mvpp2_gmac_pcs_validate, ++ .pcs_inband_caps = mvpp2_gmac_pcs_inband_caps, + .pcs_get_state = mvpp2_gmac_pcs_get_state, + .pcs_config = mvpp2_gmac_pcs_config, + .pcs_an_restart = mvpp2_gmac_pcs_an_restart, +--- a/drivers/net/pcs/pcs-lynx.c ++++ b/drivers/net/pcs/pcs-lynx.c +@@ -35,6 +35,27 @@ enum sgmii_speed { + #define phylink_pcs_to_lynx(pl_pcs) container_of((pl_pcs), struct lynx_pcs, pcs) + #define lynx_to_phylink_pcs(lynx) (&(lynx)->pcs) + ++static unsigned int lynx_pcs_inband_caps(struct phylink_pcs *pcs, ++ phy_interface_t interface) ++{ ++ switch (interface) { ++ case PHY_INTERFACE_MODE_1000BASEX: ++ case PHY_INTERFACE_MODE_SGMII: ++ case PHY_INTERFACE_MODE_QSGMII: ++ return LINK_INBAND_DISABLE | LINK_INBAND_ENABLE; ++ ++ case PHY_INTERFACE_MODE_10GBASER: ++ case PHY_INTERFACE_MODE_2500BASEX: ++ return LINK_INBAND_DISABLE; ++ ++ case PHY_INTERFACE_MODE_USXGMII: ++ return LINK_INBAND_ENABLE; ++ ++ default: ++ return 0; ++ } ++} ++ + static void lynx_pcs_get_state_usxgmii(struct mdio_device *pcs, + struct phylink_link_state *state) + { +@@ -307,6 +328,7 @@ static void lynx_pcs_link_up(struct phyl + } + + static const struct phylink_pcs_ops lynx_pcs_phylink_ops = { ++ .pcs_inband_caps = lynx_pcs_inband_caps, + .pcs_get_state = lynx_pcs_get_state, + .pcs_config = lynx_pcs_config, + .pcs_an_restart = lynx_pcs_an_restart, +--- a/drivers/net/pcs/pcs-mtk-lynxi.c ++++ b/drivers/net/pcs/pcs-mtk-lynxi.c +@@ -110,6 +110,21 @@ static struct mtk_pcs_lynxi *pcs_to_mtk_ + return container_of(pcs, struct mtk_pcs_lynxi, pcs); + } + ++static unsigned int mtk_pcs_lynxi_inband_caps(struct phylink_pcs *pcs, ++ phy_interface_t interface) ++{ ++ switch (interface) { ++ case PHY_INTERFACE_MODE_1000BASEX: ++ case PHY_INTERFACE_MODE_2500BASEX: ++ case PHY_INTERFACE_MODE_SGMII: ++ case PHY_INTERFACE_MODE_QSGMII: ++ return LINK_INBAND_DISABLE | LINK_INBAND_ENABLE; ++ ++ default: ++ return 0; ++ } ++} ++ + static void mtk_pcs_lynxi_get_state(struct phylink_pcs *pcs, + struct phylink_link_state *state) + { +@@ -302,6 +317,7 @@ static void mtk_pcs_lynxi_disable(struct + } + + static const struct phylink_pcs_ops mtk_pcs_lynxi_ops = { ++ .pcs_inband_caps = mtk_pcs_lynxi_inband_caps, + .pcs_get_state = mtk_pcs_lynxi_get_state, + .pcs_config = mtk_pcs_lynxi_config, + .pcs_an_restart = mtk_pcs_lynxi_restart_an, +--- a/drivers/net/pcs/pcs-xpcs.c ++++ b/drivers/net/pcs/pcs-xpcs.c +@@ -628,6 +628,33 @@ static int xpcs_validate(struct phylink_ + return 0; + } + ++static unsigned int xpcs_inband_caps(struct phylink_pcs *pcs, ++ phy_interface_t interface) ++{ ++ struct dw_xpcs *xpcs = phylink_pcs_to_xpcs(pcs); ++ const struct dw_xpcs_compat *compat; ++ ++ compat = xpcs_find_compat(xpcs, interface); ++ if (!compat) ++ return 0; ++ ++ switch (compat->an_mode) { ++ case DW_AN_C73: ++ return LINK_INBAND_ENABLE; ++ ++ case DW_AN_C37_SGMII: ++ case DW_AN_C37_1000BASEX: ++ return LINK_INBAND_DISABLE | LINK_INBAND_ENABLE; ++ ++ case DW_10GBASER: ++ case DW_2500BASEX: ++ return LINK_INBAND_DISABLE; ++ ++ default: ++ return 0; ++ } ++} ++ + void xpcs_get_interfaces(struct dw_xpcs *xpcs, unsigned long *interfaces) + { + int i, j; +@@ -1331,6 +1358,7 @@ static const struct xpcs_id xpcs_id_list + + static const struct phylink_pcs_ops xpcs_phylink_ops = { + .pcs_validate = xpcs_validate, ++ .pcs_inband_caps = xpcs_inband_caps, + .pcs_config = xpcs_config, + .pcs_get_state = xpcs_get_state, + .pcs_an_restart = xpcs_an_restart, From bf0a1296a5533f3b8aa2d07f2f4b3022d074c082 Mon Sep 17 00:00:00 2001 From: Ivan Deng Date: Thu, 16 Jan 2025 00:53:36 -0800 Subject: [PATCH 406/877] qualcommax: add missing WAN LED support to Spectrum SAX1V1K routers Fixed an issue where both WAN LEDs light up before plugging in the ethernet cable and no blinking regardless of WAN network activity. Updated the LED configuration to reflect proper status: Green indicates 2.5Gb connection speed. Yellow indicates other connection speed and traffic activity. This resolves inconsistent WAN LED behavior on Spectrum SAX1V1K routers. Signed-off-by: Ivan Deng Link: https://github.com/openwrt/openwrt/pull/17623 Signed-off-by: Robert Marko (cherry picked from commit 8e78bc39a38d2a82818bcae467d3bcbbbe8531f3) --- .../arm64/boot/dts/qcom/ipq8072-sax1v1k.dts | 21 +++++++++++++++++++ .../ipq807x/base-files/etc/board.d/01_leds | 3 ++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-sax1v1k.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-sax1v1k.dts index fbb652a097b05f..15ca4d8ec403cc 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-sax1v1k.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-sax1v1k.dts @@ -137,6 +137,27 @@ reg = <28>; reset-gpios = <&tlmm 44 GPIO_ACTIVE_LOW>; reset-deassert-us = <10000>; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_WAN; + default-state = "keep"; + active-low; + }; + + led@2 { + reg = <2>; + color = ; + function = LED_FUNCTION_WAN; + default-state = "keep"; + active-low; + }; + }; }; }; diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/01_leds b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/01_leds index b5c3cbc73656fa..ae941657f94ea9 100644 --- a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/01_leds +++ b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/01_leds @@ -16,7 +16,8 @@ asus,rt-ax89x) ucidef_set_led_netdev "sfp" "SFP" "white:sfp" "10g-sfp" ucidef_set_led_netdev "wan" "WAN" "white:wan" "wan" ;; -dynalink,dl-wrx36) +dynalink,dl-wrx36|\ +spectrum,sax1v1k) ucidef_set_led_netdev "wan-port-link-green" "WAN-PORT-LINK-GREEN" "90000.mdio-1:1c:green:wan" "wan" "link_2500" ucidef_set_led_netdev "wan-port-link-yellow" "WAN-PORT-LINK-YELLOW" "90000.mdio-1:1c:yellow:wan" "wan" "tx rx link_10 link_100 link_1000" ;; From 7a1da5486f378a74c614d49de3ac37ddb82ccc87 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Fri, 24 Jan 2025 17:07:21 +0100 Subject: [PATCH 407/877] realtek: Fix old compatible for HPE 1920-8G PoE Supported devices are listed in the metadata as the first part of the DTS compatible. This normally follows the format "vendor,device". When updating the device name of the 180W 1920-8G PoE an underscore was used, instead of a comma, to join the vendor and device name. This will lead to warnings for users wanting to sysupgrade a device with an older compatible, as the device's info does not match the one the metadata. Fixes: 987c96e88927 ("realtek: rename hpe,1920-8g-poe to match hardware") Signed-off-by: Sander Vanheule (cherry picked from commit 6a7fa68569ac11bb2c2abb14026e8b84acd3a12f) --- target/linux/realtek/image/rtl838x.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/realtek/image/rtl838x.mk b/target/linux/realtek/image/rtl838x.mk index 866659ad141210..9ade8d536b7dd9 100644 --- a/target/linux/realtek/image/rtl838x.mk +++ b/target/linux/realtek/image/rtl838x.mk @@ -124,7 +124,7 @@ define Device/hpe_1920-8g-poe-180w DEVICE_MODEL := 1920-8G-PoE+ 180W (JG922A) DEVICE_PACKAGES += realtek-poe H3C_DEVICE_ID := 0x00010025 - SUPPORTED_DEVICES += hpe_1920-8g-poe + SUPPORTED_DEVICES += hpe,1920-8g-poe endef TARGET_DEVICES += hpe_1920-8g-poe-180w From 0ba00ec205a449fd341a7b094363048a8884da63 Mon Sep 17 00:00:00 2001 From: Florian Maurer Date: Wed, 22 Jan 2025 19:59:12 +0100 Subject: [PATCH 408/877] mediatek-mt7622: netgear-wax206 fix wifi leds the wifi leds of the wax206 were not reacting. This patch enables the green leds to show activity, as the blue ones are very bright. Also set the label-mac to the gmac0 Signed-off-by: Florian Maurer Link: https://github.com/openwrt/openwrt/pull/17694 Signed-off-by: Hauke Mehrtens (cherry picked from commit 9ada8578fd2768d077607b189987972ad600a804) --- target/linux/mediatek/dts/mt7622-netgear-wax206.dts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/linux/mediatek/dts/mt7622-netgear-wax206.dts b/target/linux/mediatek/dts/mt7622-netgear-wax206.dts index 524a49874089fb..4881004ac3b750 100644 --- a/target/linux/mediatek/dts/mt7622-netgear-wax206.dts +++ b/target/linux/mediatek/dts/mt7622-netgear-wax206.dts @@ -13,6 +13,7 @@ aliases { ethernet0 = &gmac0; + label-mac-device = &gmac0; led-boot = &led_power_r; led-failsafe = &led_power_r; led-running = &led_power_g; @@ -84,6 +85,7 @@ default-state = "off"; gpios = <&pio 85 GPIO_ACTIVE_LOW>; label = "wifin:green"; + linux,default-trigger = "phy0tpt"; }; wifin_blue { @@ -96,6 +98,7 @@ default-state = "off"; gpios = <&pio 2 GPIO_ACTIVE_HIGH>; label = "wifia:green"; + linux,default-trigger = "phy1tpt"; }; wifia_blue { From 9b32a8ec9d21197202f689225ca3ead817d5a689 Mon Sep 17 00:00:00 2001 From: Sergey Ryazanov Date: Thu, 23 Jan 2025 00:26:51 +0200 Subject: [PATCH 409/877] kernel: vrx518_tc: fix RX desc phys to virt mapping It looks like VRX518 returns phys addr of data buffer in the 'data_ptr' field of the RX descriptor and an actual data offset within the buffer in the 'byte_off' field. In order to map the phys address back to virtual we need the original phys address of the allocated buffer. In the same driver applies offset to phys address before the mapping, what leads to WARN_ON triggering in plat_mem_virt() function with subsequent kernel panic: WARNING: CPU: 0 PID: 0 at .../sw_plat.c:764 0xbf306cd0 [vrx518_tc@8af9f5d0+0x25000] ... Unable to handle kernel NULL pointer dereference at virtual address 00000000 pgd = aff5701e [00000000] *pgd=00000000 Internal error: Oops: 5 [#1] SMP ARM Noticed in ATM mode, when chip always returns byte_off = 4. In order to fix the issue, pass the phys address to plat_mem_virt() as is and apply byte_off later for proper DMA syncing and on mapped virtual address when copying RXed data into the skb. Run tested with FRITZ!Box 7530 on both ADSL and VDSL (thanks Jan) links. Fixes: 474bbe23b7 ("kernel: add Intel/Lantiq VRX518 TC driver") Tested-by: Jan Hoffmann # VDSL link Reported-and-tested-by: nebibigon93@yandex.ru # ADSL link Signed-off-by: Sergey Ryazanov Link: https://patchwork.ozlabs.org/project/openwrt/patch/20250122222654.21833-2-ryazanov.s.a@gmail.com/ Signed-off-by: Hauke Mehrtens (cherry picked from commit 7bd579689d2304c73c263be3e030d76c551d6e87) --- package/kernel/lantiq/vrx518_tc/patches/200-swplat.patch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/kernel/lantiq/vrx518_tc/patches/200-swplat.patch b/package/kernel/lantiq/vrx518_tc/patches/200-swplat.patch index edc97998b739de..6596a8b913fc9a 100644 --- a/package/kernel/lantiq/vrx518_tc/patches/200-swplat.patch +++ b/package/kernel/lantiq/vrx518_tc/patches/200-swplat.patch @@ -855,12 +855,12 @@ This replaces it by a basic working implementation. - continue; + + // this seems to be a pointer to a DS PKT buffer -+ phyaddr = desc->data_ptr + desc->byte_off; ++ phyaddr = desc->data_ptr; + ptr = plat_mem_virt(phyaddr); -+ + len = desc->data_len; + -+ dma_sync_single_range_for_cpu(pdev, phyaddr, 0, len, DMA_FROM_DEVICE); ++ dma_sync_single_for_cpu(pdev, phyaddr, desc->byte_off + len, ++ DMA_FROM_DEVICE); + + skb = netdev_alloc_skb(g_plat_priv->netdev, len); + if (unlikely(!skb)) { @@ -871,7 +871,7 @@ This replaces it by a basic working implementation. - ring_idx_inc(rxout, idx); + + dst = skb_put(skb, len); -+ memcpy(dst, ptr, len); ++ memcpy(dst, ptr + desc->byte_off, len); + + priv->tc_ops.recv(g_plat_priv->netdev, skb); + From 6383f24378ed745c2a9fe2645df9d31470eb9599 Mon Sep 17 00:00:00 2001 From: Sergey Ryazanov Date: Thu, 23 Jan 2025 00:26:52 +0200 Subject: [PATCH 410/877] kernel: vrx518_tc: fix ADSL/ATM operation ATM TC layer have some issues which effectively prevent VRX518 from being used as ADSL modem. Specifically, there one crash during the ATM layer configuration and wrong PVC ID selection on packet receiving what breaks RX path. Fix both of the issues. Make subif iface registration optional to prevent the crash (see more details in the new patch) and update the hardcoded PVC ID to match the first allocated channel. Run tested with FRITZ!Box 7530. Fixes: 474bbe23b7 ("kernel: add Intel/Lantiq VRX518 TC driver") Reported-and-tested-by: nebibigon93@yandex.ru Signed-off-by: Sergey Ryazanov Link: https://patchwork.ozlabs.org/project/openwrt/patch/20250122222654.21833-3-ryazanov.s.a@gmail.com/ Signed-off-by: Hauke Mehrtens (cherry picked from commit 470335450e67002366fcbcd7334b15bdf008e44d) --- .../lantiq/vrx518_tc/patches/100-compat.patch | 2 +- ...tm_tc-fix-crash-on-subif_reg-absence.patch | 75 +++++++++++++++++++ 2 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 package/kernel/lantiq/vrx518_tc/patches/207-dcdp-atm_tc-fix-crash-on-subif_reg-absence.patch diff --git a/package/kernel/lantiq/vrx518_tc/patches/100-compat.patch b/package/kernel/lantiq/vrx518_tc/patches/100-compat.patch index d04c1ed5df0dc2..81e32369baefcc 100644 --- a/package/kernel/lantiq/vrx518_tc/patches/100-compat.patch +++ b/package/kernel/lantiq/vrx518_tc/patches/100-compat.patch @@ -166,7 +166,7 @@ - return (skb->DW0 >> 3) & 0xF; +// return (skb->DW0 >> 3) & 0xF; -+ return 1; ++ return 0; /* We use only one connection for now, so return the first connection id */ } static int atm_get_qid_by_vcc(struct net_device *dev, struct sk_buff *skb, diff --git a/package/kernel/lantiq/vrx518_tc/patches/207-dcdp-atm_tc-fix-crash-on-subif_reg-absence.patch b/package/kernel/lantiq/vrx518_tc/patches/207-dcdp-atm_tc-fix-crash-on-subif_reg-absence.patch new file mode 100644 index 00000000000000..87456424c32121 --- /dev/null +++ b/package/kernel/lantiq/vrx518_tc/patches/207-dcdp-atm_tc-fix-crash-on-subif_reg-absence.patch @@ -0,0 +1,75 @@ +From: Sergey Ryazanov +Date: Fri, 10 Jan 2025 00:57:27 +0000 +Subject: [PATCH] vrx518_tc: atm_tc: fix crash on subif_reg absence + +VRX518 (sw_plat) platform does not provid the subif_reg/subif_unreg ops +in the same time ATM TC layer unconditionally calls them, what leads to +the kernel crash on the atm_hook_mpoa_setup hook invocation from the ATM +stack: + + vrx518_tc:mpoa_setup_sync : sync: conn: 0, vpi: 0, vci: 35, mpoa_type: 0, mpoa_mode: 0 + Unable to handle kernel NULL pointer dereference at virtual address 00000000 + +Subif registration is optional and PTM TC do this only when the +corresponding ops are defined. Do the same for ATM TC and call +subif_reg/subif_unreg only if they are not NULL. + +While at it, move subif related data preparation under the 'if' block +in order to group and isolate that aux code. + +Run tested with FRITZ!Box 7530. + +Signed-off-by: Sergey Ryazanov +--- +--- a/dcdp/atm_tc.c ++++ b/dcdp/atm_tc.c +@@ -1232,8 +1232,9 @@ static void ppe_close(struct atm_vcc *vc + validate_oam_htu_entry(priv, 0); + spin_unlock_bh(&priv->atm_lock); + +- priv->tc_priv->tc_ops.subif_unreg(dev, (!dev) ? dev_name : dev->name, +- priv->conn[cid].subif_id, 0); ++ if (priv->tc_priv->tc_ops.subif_unreg) ++ priv->tc_priv->tc_ops.subif_unreg(dev, (!dev) ? dev_name : dev->name, ++ priv->conn[cid].subif_id, 0); + + memset(conn, 0, sizeof(*conn)); + +@@ -2791,24 +2792,26 @@ static void mpoa_setup_sync(struct atm_p + struct wtx_queue_config_t tx_qcfg; + struct uni_cell_header *cell_header; + struct atm_vcc *vcc; +- struct net_device *dev; +- char dev_name[32]; + + tc_dbg(priv->tc_priv, MSG_INIT, + "sync: conn: %d, vpi: %d, vci: %d, mpoa_type: %d, mpoa_mode: %d\n", + conn, priv->conn[conn].vcc->vpi, priv->conn[conn].vcc->vci, + priv->conn[conn].mpoa_type, priv->conn[conn].mpoa_mode); + +- dev = priv->conn[conn].dev; ++ if (priv->tc_priv->tc_ops.subif_reg) { ++ struct net_device *dev; ++ char dev_name[32]; ++ ++ dev = priv->conn[conn].dev; ++ if (!dev) ++ sprintf(dev_name, "atm_%d%d", ++ priv->conn[conn].vcc->vpi, priv->conn[conn].vcc->vci); + +- if (!dev) +- sprintf(dev_name, "atm_%d%d", +- priv->conn[conn].vcc->vpi, priv->conn[conn].vcc->vci); +- +- priv->tc_priv->tc_ops.subif_reg(dev, (!dev) ? dev_name : dev->name, +- &priv->conn[conn].subif_id, 0); +- tc_dbg(priv->tc_priv, MSG_INIT, +- "conn[%d]subif_id[%x]", conn, priv->conn[conn].subif_id); ++ priv->tc_priv->tc_ops.subif_reg(dev, !dev ? dev_name : dev->name, ++ &priv->conn[conn].subif_id, 0); ++ tc_dbg(priv->tc_priv, MSG_INIT, ++ "conn[%d]subif_id[%x]", conn, priv->conn[conn].subif_id); ++ } + vcc = priv->conn[conn].vcc; + + /* set htu entry */ From a96eaa645647d3f4c39bd01d2d43418abf29ad0c Mon Sep 17 00:00:00 2001 From: Sergey Ryazanov Date: Thu, 23 Jan 2025 00:26:53 +0200 Subject: [PATCH 411/877] ipq40xx: fix compatibility with linux-atm tools atm_qos struct should be the same both for user and kernel spaces. Via the __SO_ENCODE() macro it is used to define the SO_ATMQOS socket IOC. During the VRX518 support introduction, the atm_trafprm sturct nested into the atm_qos stucture was update with newer fields that are referenced by the ATM TC layer of the VRX518 TC driver. These new fields are intended to communicate information for extra traffic classes supported by the driver. But we are still using vanilla kernel headers to build the toolchain. Due to the atm.h header incoherency br2684ctl from linux-atm tools is incapable to configure the ATM bridge netdev: br2684ctl: Interface "dsl0" created sucessfully br2684ctl: Communicating over ATM 0.1.2, encapsulation: LLC br2684ctl: setsockopt SO_ATMQOS 22 <-- EINVAL errno br2684ctl: Fatal: failed to connect on socket; File descriptor in bad state There are two options to fix this incoherency. (a) update the header file in the toolchain to build linux-atm against updated atm_trafprm and atm_qos structures, or (b) revert atm_trafprm changes. Since there are no actual users of the extra ATM QoS traffic classes, just drop these extra traffic classes from vrx518_tc ATM TC layer and drop the kernel patch updating atm.h. Besides fixing the compatibility with linux-atm tools, removing the kernel patch should simplify kernel updates removing unneeded burden of maintenance. Run tested with FRITZ!Box 7530 with disabled extra traffic classes and then removed them entirely before the submission. CC: John Crispin Fixes: cfd42a0098 ("ipq40xx: add Intel/Lantiq ATM hacks") Suggested-by: Andre Heider Reported-and-tested-by: nebibigon93@yandex.ru Signed-off-by: Sergey Ryazanov Link: https://patchwork.ozlabs.org/project/openwrt/patch/20250122222654.21833-4-ryazanov.s.a@gmail.com/ Signed-off-by: Hauke Mehrtens (cherry picked from commit 6d6dc3a3c967174598a44503f4af281574660356) --- ...1-dcdp-atm_tc-drop-extra-qos-classes.patch | 144 ++++++++++++++++++ .../lantiq/vrx518_tc/patches/200-swplat.patch | 12 +- .../lantiq/vrx518_tc/patches/202-napi.patch | 4 +- ...-dcdp-atm_tc-fix-compilation-warning.patch | 6 +- ...tm_tc-fix-crash-on-subif_reg-absence.patch | 4 +- .../patches-6.6/998-lantiq-atm-hacks.patch | 43 ------ 6 files changed, 157 insertions(+), 56 deletions(-) create mode 100644 package/kernel/lantiq/vrx518_tc/patches/101-dcdp-atm_tc-drop-extra-qos-classes.patch delete mode 100644 target/linux/ipq40xx/patches-6.6/998-lantiq-atm-hacks.patch diff --git a/package/kernel/lantiq/vrx518_tc/patches/101-dcdp-atm_tc-drop-extra-qos-classes.patch b/package/kernel/lantiq/vrx518_tc/patches/101-dcdp-atm_tc-drop-extra-qos-classes.patch new file mode 100644 index 00000000000000..5c7b24654538e5 --- /dev/null +++ b/package/kernel/lantiq/vrx518_tc/patches/101-dcdp-atm_tc-drop-extra-qos-classes.patch @@ -0,0 +1,144 @@ +Extra ATM traffic classes requires atm_qos struct extension and a set of +new defines. What itself requires atm.h updates both in the kernel and +in the toolchain. On another hand we do not have any real users of these +traffic classes. + +In absence of real user there are no benefits to support this +functionality. There is only the burden of maintenance of extra patches +all around the building framework. So just drop these extra QoS traffic +classes in order to facilitate maintenance and avoid side effects like +breaking compatibility with existing userspace tools like linux-atm. + +Signed-off-by: Sergey Ryazanov +-- +--- a/dcdp/atm_tc.c ++++ b/dcdp/atm_tc.c +@@ -463,34 +463,9 @@ static void set_qsb(struct atm_priv *pri + /* Weighted Fair Queueing Factor (WFQF) */ + switch (qos->txtp.traffic_class) { + case ATM_CBR: +- case ATM_VBR_RT: + /* real time queue gets weighted fair queueing bypass */ + q_parm_tbl.bit.wfqf = 0; + break; +- case ATM_VBR_NRT: +- case ATM_UBR_PLUS: +- /* WFQF calculation here is based on virtual cell rates, +- to reduce granularity for high rates +- */ +- /* WFQF is maximum cell rate / garenteed cell rate */ +- /* wfqf = qsb_minimum_cell_rate * QSB_WFQ_NONUBR_MAX / +- requested_minimum_peak_cell_rate +- */ +- if (qos->txtp.min_pcr == 0) +- q_parm_tbl.bit.wfqf = QSB_WFQ_NONUBR_MAX; +- else { +- tmp = QSB_GCR_MIN * QSB_WFQ_NONUBR_MAX / +- qos->txtp.min_pcr; +- if (tmp == 0) +- q_parm_tbl.bit.wfqf = 1; +- else if (tmp > QSB_WFQ_NONUBR_MAX) +- q_parm_tbl.bit.wfqf +- = QSB_WFQ_NONUBR_MAX; +- else +- q_parm_tbl.bit.wfqf = tmp; +- } +- break; +- + case ATM_UBR: + default: + q_parm_tbl.bit.wfqf = QSB_WFQ_UBR_BYPASS; +@@ -498,42 +473,9 @@ static void set_qsb(struct atm_priv *pri + } + + /* Sustained Cell Rate (SCR) Leaky Bucket Shaper VBR.0/VBR.1 */ +- if (qos->txtp.traffic_class == ATM_VBR_RT || +- qos->txtp.traffic_class == ATM_VBR_NRT) { +- if (qos->txtp.scr == 0) { +- /* disable shaper */ +- q_vbr_parm_tbl.bit.taus = 0; +- q_vbr_parm_tbl.bit.ts = 0; +- } else { +- /* Cell Loss Priority (CLP) */ +- if ((vcc->atm_options & ATM_ATMOPT_CLP)) +- /* CLP1 */ +- q_parm_tbl.bit.vbr = 1; +- else +- /* CLP0 */ +- q_parm_tbl.bit.vbr = 0; +- /* Rate Shaper Parameter (TS) and +- Burst Tolerance Parameter for SCR (tauS) +- */ +- tmp = ((qsb_clk * param->qsb_tstep) >> 5) / +- qos->txtp.scr + 1; +- q_vbr_parm_tbl.bit.ts +- = tmp > QSB_TP_TS_MAX ? QSB_TP_TS_MAX : tmp; +- tmp = (qos->txtp.mbs - 1) * +- (q_vbr_parm_tbl.bit.ts - +- q_parm_tbl.bit.tp) / 64; +- if (tmp == 0) +- q_vbr_parm_tbl.bit.taus = 1; +- else if (tmp > QSB_TAUS_MAX) +- q_vbr_parm_tbl.bit.taus +- = QSB_TAUS_MAX; +- else +- q_vbr_parm_tbl.bit.taus = tmp; +- } +- } else { +- q_vbr_parm_tbl.bit.taus = 0; +- q_vbr_parm_tbl.bit.ts = 0; +- } ++ /* NB: shaper disabled since there no user interface to activate it */ ++ q_vbr_parm_tbl.bit.taus = 0; ++ q_vbr_parm_tbl.bit.ts = 0; + + /* Queue Parameter Table (QPT) */ + tc_w32(QSB_QPT_SET_MASK, QSB_RTM); +@@ -1064,15 +1006,6 @@ static int ppe_open(struct atm_vcc *vcc) + /* check bandwidth */ + if ((vcc->qos.txtp.traffic_class == ATM_CBR && + vcc->qos.txtp.max_pcr > +- (port->tx_max_cell_rate - port->tx_used_cell_rate)) +- || (vcc->qos.txtp.traffic_class == ATM_VBR_RT && +- vcc->qos.txtp.max_pcr > +- (port->tx_max_cell_rate - port->tx_used_cell_rate)) +- || (vcc->qos.txtp.traffic_class == ATM_VBR_NRT && +- vcc->qos.txtp.scr > +- (port->tx_max_cell_rate - port->tx_used_cell_rate)) +- || (vcc->qos.txtp.traffic_class == ATM_UBR_PLUS && +- vcc->qos.txtp.min_pcr > + (port->tx_max_cell_rate - port->tx_used_cell_rate))) { + tc_dbg(priv->tc_priv, MSG_INIT, "exceed TX line rate\n"); + return -EINVAL; +@@ -1128,15 +1061,8 @@ static int ppe_open(struct atm_vcc *vcc) + /* reserve bandwidth */ + switch (vcc->qos.txtp.traffic_class) { + case ATM_CBR: +- case ATM_VBR_RT: + port->tx_used_cell_rate += vcc->qos.txtp.max_pcr; + break; +- case ATM_VBR_NRT: +- port->tx_used_cell_rate += vcc->qos.txtp.scr; +- break; +- case ATM_UBR_PLUS: +- port->tx_used_cell_rate += vcc->qos.txtp.min_pcr; +- break; + } + + /* update atm_vcc structure */ +@@ -1222,15 +1148,8 @@ static void ppe_close(struct atm_vcc *vc + /* release bandwidth */ + switch (vcc->qos.txtp.traffic_class) { + case ATM_CBR: +- case ATM_VBR_RT: + port->tx_used_cell_rate -= vcc->qos.txtp.max_pcr; + break; +- case ATM_VBR_NRT: +- port->tx_used_cell_rate -= vcc->qos.txtp.scr; +- break; +- case ATM_UBR_PLUS: +- port->tx_used_cell_rate -= vcc->qos.txtp.min_pcr; +- break; + } + + /* idle for a while to let parallel operation finish */ diff --git a/package/kernel/lantiq/vrx518_tc/patches/200-swplat.patch b/package/kernel/lantiq/vrx518_tc/patches/200-swplat.patch index 6596a8b913fc9a..930fa6632c373f 100644 --- a/package/kernel/lantiq/vrx518_tc/patches/200-swplat.patch +++ b/package/kernel/lantiq/vrx518_tc/patches/200-swplat.patch @@ -3,7 +3,7 @@ This replaces it by a basic working implementation. --- a/dcdp/atm_tc.c +++ b/dcdp/atm_tc.c -@@ -603,7 +603,11 @@ static void atm_aca_init(struct atm_priv +@@ -545,7 +545,11 @@ static void atm_aca_init(struct atm_priv cfg = &priv->tc_priv->cfg; txin = ¶m.aca_txin; @@ -15,7 +15,7 @@ This replaces it by a basic working implementation. txin->hd_size_in_dw = cfg->txin.soc_desc_dwsz; txin->pd_desc_base = SB_XBAR_ADDR(__ACA_TX_IN_PD_LIST_BASE); txin->pd_desc_num = __ACA_TX_IN_PD_LIST_NUM; -@@ -625,7 +629,11 @@ static void atm_aca_init(struct atm_priv +@@ -567,7 +571,11 @@ static void atm_aca_init(struct atm_priv txin->soc_cmlt_cnt_addr); txout = ¶m.aca_txout; @@ -27,7 +27,7 @@ This replaces it by a basic working implementation. txout->hd_size_in_dw = cfg->txout.soc_desc_dwsz; txout->pd_desc_base = SB_XBAR_ADDR(__ACA_TX_OUT_PD_LIST_BASE); txout->pd_desc_num = __ACA_TX_OUT_PD_LIST_NUM; -@@ -647,7 +655,11 @@ static void atm_aca_init(struct atm_priv +@@ -589,7 +597,11 @@ static void atm_aca_init(struct atm_priv txout->soc_cmlt_cnt_addr); rxout = ¶m.aca_rxout; @@ -39,7 +39,7 @@ This replaces it by a basic working implementation. rxout->hd_size_in_dw = cfg->rxout.soc_desc_dwsz; rxout->pd_desc_base = SB_XBAR_ADDR(__ACA_RX_OUT_PD_LIST_BASE); rxout->pd_desc_num = __ACA_RX_OUT_PD_LIST_NUM; -@@ -669,7 +681,11 @@ static void atm_aca_init(struct atm_priv +@@ -611,7 +623,11 @@ static void atm_aca_init(struct atm_priv rxout->soc_cmlt_cnt_addr); rxin = ¶m.aca_rxin; @@ -51,7 +51,7 @@ This replaces it by a basic working implementation. rxin->hd_size_in_dw = cfg->rxin.soc_desc_dwsz; rxin->pd_desc_base = SB_XBAR_ADDR(__RX_IN_PD_DES_LIST_BASE); rxin->pd_desc_num = __ACA_RX_IN_PD_LIST_NUM; -@@ -1261,7 +1277,7 @@ static int ppe_ioctl(struct atm_dev *dev +@@ -1180,7 +1196,7 @@ static int ppe_ioctl(struct atm_dev *dev static int ppe_send(struct atm_vcc *vcc, struct sk_buff *skb) { int ret, qid, mpoa_pt, mpoa_type, vid; @@ -60,7 +60,7 @@ This replaces it by a basic working implementation. struct atm_priv *priv; if (!vcc) { -@@ -1327,12 +1343,14 @@ static int ppe_send(struct atm_vcc *vcc, +@@ -1246,12 +1262,14 @@ static int ppe_send(struct atm_vcc *vcc, tc_dbg(priv->tc_priv, MSG_TX, "vid: 0x%x, qid: 0x%x\n", vid, qid); diff --git a/package/kernel/lantiq/vrx518_tc/patches/202-napi.patch b/package/kernel/lantiq/vrx518_tc/patches/202-napi.patch index 266beba1a7e41c..75d18138c0803c 100644 --- a/package/kernel/lantiq/vrx518_tc/patches/202-napi.patch +++ b/package/kernel/lantiq/vrx518_tc/patches/202-napi.patch @@ -296,7 +296,7 @@ priv->tc_ops.umt_start = plat_umt_start; --- a/dcdp/atm_tc.c +++ b/dcdp/atm_tc.c -@@ -3650,7 +3650,7 @@ static void atm_aca_ring_config_init(str +@@ -3569,7 +3569,7 @@ static void atm_aca_ring_config_init(str static int atm_ring_init(struct atm_priv *priv) { atm_aca_ring_config_init(priv); @@ -305,7 +305,7 @@ } static int atm_init(struct tc_priv *tcpriv, u32 ep_id) -@@ -4020,7 +4020,7 @@ void atm_tc_unload(void) +@@ -3939,7 +3939,7 @@ void atm_tc_unload(void) /* unregister device */ if (priv->tc_priv->tc_ops.dev_unreg != NULL) priv->tc_priv->tc_ops.dev_unreg(NULL, diff --git a/package/kernel/lantiq/vrx518_tc/patches/204-dcdp-atm_tc-fix-compilation-warning.patch b/package/kernel/lantiq/vrx518_tc/patches/204-dcdp-atm_tc-fix-compilation-warning.patch index bf2d82e2b552a1..1b70a663cdd54a 100644 --- a/package/kernel/lantiq/vrx518_tc/patches/204-dcdp-atm_tc-fix-compilation-warning.patch +++ b/package/kernel/lantiq/vrx518_tc/patches/204-dcdp-atm_tc-fix-compilation-warning.patch @@ -1,6 +1,6 @@ --- a/dcdp/atm_tc.c +++ b/dcdp/atm_tc.c -@@ -746,7 +746,8 @@ static void atm_aca_init(struct atm_priv +@@ -688,7 +688,8 @@ static void atm_aca_init(struct atm_priv ACA_TXOUT_EN | ACA_RXIN_EN | ACA_RXOUT_EN, 1); } @@ -10,7 +10,7 @@ { struct tm nowtm; char tmbuf[64]; -@@ -765,7 +766,8 @@ static int print_datetime(char *buffer, +@@ -707,7 +708,8 @@ static int print_datetime(char *buffer, nowtm.tm_hour, nowtm.tm_min, nowtm.tm_sec); @@ -20,7 +20,7 @@ return 0; } -@@ -967,7 +969,7 @@ void show_atm_pvc(struct seq_file *seq, +@@ -909,7 +911,7 @@ void show_atm_pvc(struct seq_file *seq, char buf[64]; seq_printf(seq, "\tNet device: %s\n", pvc->dev->name); diff --git a/package/kernel/lantiq/vrx518_tc/patches/207-dcdp-atm_tc-fix-crash-on-subif_reg-absence.patch b/package/kernel/lantiq/vrx518_tc/patches/207-dcdp-atm_tc-fix-crash-on-subif_reg-absence.patch index 87456424c32121..f268c0908cb28a 100644 --- a/package/kernel/lantiq/vrx518_tc/patches/207-dcdp-atm_tc-fix-crash-on-subif_reg-absence.patch +++ b/package/kernel/lantiq/vrx518_tc/patches/207-dcdp-atm_tc-fix-crash-on-subif_reg-absence.patch @@ -23,7 +23,7 @@ Signed-off-by: Sergey Ryazanov --- --- a/dcdp/atm_tc.c +++ b/dcdp/atm_tc.c -@@ -1232,8 +1232,9 @@ static void ppe_close(struct atm_vcc *vc +@@ -1158,8 +1158,9 @@ static void ppe_close(struct atm_vcc *vc validate_oam_htu_entry(priv, 0); spin_unlock_bh(&priv->atm_lock); @@ -35,7 +35,7 @@ Signed-off-by: Sergey Ryazanov memset(conn, 0, sizeof(*conn)); -@@ -2791,24 +2792,26 @@ static void mpoa_setup_sync(struct atm_p +@@ -2710,24 +2711,26 @@ static void mpoa_setup_sync(struct atm_p struct wtx_queue_config_t tx_qcfg; struct uni_cell_header *cell_header; struct atm_vcc *vcc; diff --git a/target/linux/ipq40xx/patches-6.6/998-lantiq-atm-hacks.patch b/target/linux/ipq40xx/patches-6.6/998-lantiq-atm-hacks.patch deleted file mode 100644 index c15a4b3ae3e0b7..00000000000000 --- a/target/linux/ipq40xx/patches-6.6/998-lantiq-atm-hacks.patch +++ /dev/null @@ -1,43 +0,0 @@ -From: John Crispin -Date: Fri, 3 Aug 2012 10:27:25 +0200 -Subject: [PATCH 04/36] MIPS: lantiq: add atm hack - -Signed-off-by: John Crispin ---- a/include/uapi/linux/atm.h -+++ b/include/uapi/linux/atm.h -@@ -131,8 +131,14 @@ - #define ATM_ABR 4 - #define ATM_ANYCLASS 5 /* compatible with everything */ - -+#define ATM_VBR_NRT ATM_VBR -+#define ATM_VBR_RT 6 -+#define ATM_UBR_PLUS 7 -+#define ATM_GFR 8 -+ - #define ATM_MAX_PCR -1 /* maximum available PCR */ - -+ - struct atm_trafprm { - unsigned char traffic_class; /* traffic class (ATM_UBR, ...) */ - int max_pcr; /* maximum PCR in cells per second */ -@@ -155,6 +161,9 @@ struct atm_trafprm { - unsigned int adtf :10; /* ACR Decrease Time Factor (10-bit) */ - unsigned int cdf :3; /* Cutoff Decrease Factor (3-bit) */ - unsigned int spare :9; /* spare bits */ -+ int scr; /* sustained rate in cells per second */ -+ int mbs; /* maximum burst size (MBS) in cells */ -+ int cdv; /* Cell delay variation */ - }; - - struct atm_qos { ---- a/net/atm/proc.c -+++ b/net/atm/proc.c -@@ -141,7 +141,7 @@ static void *vcc_seq_next(struct seq_fil - static void pvc_info(struct seq_file *seq, struct atm_vcc *vcc) - { - static const char *const class_name[] = { -- "off", "UBR", "CBR", "VBR", "ABR"}; -+ "off","UBR","CBR","NTR-VBR","ABR","ANY","RT-VBR","UBR+","GFR"}; - static const char *const aal_name[] = { - "---", "1", "2", "3/4", /* 0- 3 */ - "???", "5", "???", "???", /* 4- 7 */ From 04a1d0d410fe4df85e5dfc1716102eb9df0d88ad Mon Sep 17 00:00:00 2001 From: Sergey Ryazanov Date: Thu, 23 Jan 2025 00:26:54 +0200 Subject: [PATCH 412/877] kernel: vrx518_tc: bump PKG_RELEASE Bump PKG_RELEASE after the previous fixes. Signed-off-by: Sergey Ryazanov Link: https://patchwork.ozlabs.org/project/openwrt/patch/20250122222654.21833-5-ryazanov.s.a@gmail.com/ Signed-off-by: Hauke Mehrtens (cherry picked from commit 78f908407e2824bc69a65acec270ffb94eca4038) --- package/kernel/lantiq/vrx518_tc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kernel/lantiq/vrx518_tc/Makefile b/package/kernel/lantiq/vrx518_tc/Makefile index a5718d9d5b2a2d..d92c6d1c639133 100644 --- a/package/kernel/lantiq/vrx518_tc/Makefile +++ b/package/kernel/lantiq/vrx518_tc/Makefile @@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=vrx518_tc PKG_VERSION:=1.5.12.4 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_BASE_NAME:=vrx518_tc_drv UGW_VERSION=8.5.2.10 From d6fe1421614b2db6bae8e2facb9645ddbee480b3 Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Tue, 3 Dec 2024 23:02:15 +0800 Subject: [PATCH 413/877] mediatek: cudy: fixes typo for spi and mtd properties Same as commit 3674689, correct 'buswidth' to 'bus-width'. Move the nmbm properties outside the partition definition. Change uppercase to lowercase, add missing read-only flag. Signed-off-by: Chukun Pan (cherry picked from commit ab375a3484db67857450ced461498ad3d7942e05) --- .../linux/mediatek/dts/mt7981b-cudy-ap3000-v1.dts | 4 ++-- .../mediatek/dts/mt7981b-cudy-ap3000outdoor-v1.dts | 12 ++++++------ .../linux/mediatek/dts/mt7981b-cudy-m3000-v1.dts | 14 +++++++------- .../linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts | 12 ++++++------ .../linux/mediatek/dts/mt7981b-cudy-wr3000s-v1.dts | 10 ++++++---- 5 files changed, 27 insertions(+), 25 deletions(-) diff --git a/target/linux/mediatek/dts/mt7981b-cudy-ap3000-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-ap3000-v1.dts index bd6c15225b4d9f..7101c4bab0a9b8 100644 --- a/target/linux/mediatek/dts/mt7981b-cudy-ap3000-v1.dts +++ b/target/linux/mediatek/dts/mt7981b-cudy-ap3000-v1.dts @@ -133,8 +133,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>; spi-cal-enable; spi-cal-mode = "read-data"; diff --git a/target/linux/mediatek/dts/mt7981b-cudy-ap3000outdoor-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-ap3000outdoor-v1.dts index a1eb9c6e1e981a..2e84d2b538ff75 100644 --- a/target/linux/mediatek/dts/mt7981b-cudy-ap3000outdoor-v1.dts +++ b/target/linux/mediatek/dts/mt7981b-cudy-ap3000outdoor-v1.dts @@ -148,6 +148,7 @@ label = "Factory"; reg = <0x180000 0x0200000>; read-only; + nvmem-layout { compatible = "fixed-layout"; #address-cells = <1>; @@ -163,6 +164,7 @@ label = "bdinfo"; reg = <0x380000 0x0040000>; read-only; + nvmem-layout { compatible = "fixed-layout"; #address-cells = <1>; @@ -174,25 +176,23 @@ #nvmem-cell-cells = <1>; }; }; - }; - partition@3C0000 { + partition@3c0000 { label = "FIP"; - reg = <0x3C0000 0x0200000>; + reg = <0x3c0000 0x0200000>; read-only; }; - partition@580000 { + partition@5c0000 { label = "ubi"; - reg = <0x5C0000 0x4000000>; + reg = <0x5c0000 0x4000000>; compatible = "linux,ubi"; }; }; }; }; - &pio { spi0_flash_pins: spi0-pins { mux { diff --git a/target/linux/mediatek/dts/mt7981b-cudy-m3000-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-m3000-v1.dts index 85bdabe47488e4..b1797157ac671c 100644 --- a/target/linux/mediatek/dts/mt7981b-cudy-m3000-v1.dts +++ b/target/linux/mediatek/dts/mt7981b-cudy-m3000-v1.dts @@ -117,7 +117,6 @@ &spi0 { pinctrl-names = "default"; pinctrl-0 = <&spi0_flash_pins>; - status = "okay"; spi_nand: spi_nand@0 { @@ -127,18 +126,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>; @@ -177,6 +176,7 @@ partition@3c0000 { label = "FIP"; reg = <0x03c0000 0x0200000>; + read-only; }; partition@5c0000 { diff --git a/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts index 1f03b42b1b0456..31a2cf51940d30 100644 --- a/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts +++ b/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts @@ -162,6 +162,7 @@ label = "Factory"; reg = <0x180000 0x0200000>; read-only; + nvmem-layout { compatible = "fixed-layout"; #address-cells = <1>; @@ -177,6 +178,7 @@ label = "bdinfo"; reg = <0x380000 0x0040000>; read-only; + nvmem-layout { compatible = "fixed-layout"; #address-cells = <1>; @@ -188,25 +190,23 @@ #nvmem-cell-cells = <1>; }; }; - }; - partition@3C0000 { + partition@3c0000 { label = "FIP"; - reg = <0x3C0000 0x0200000>; + reg = <0x3c0000 0x0200000>; read-only; }; - partition@580000 { + partition@5c0000 { label = "ubi"; - reg = <0x5C0000 0x4000000>; + reg = <0x5c0000 0x4000000>; compatible = "linux,ubi"; }; }; }; }; - &pio { spi0_flash_pins: spi0-pins { mux { diff --git a/target/linux/mediatek/dts/mt7981b-cudy-wr3000s-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-wr3000s-v1.dts index cf2f79b40770f9..ccefc1926c518e 100644 --- a/target/linux/mediatek/dts/mt7981b-cudy-wr3000s-v1.dts +++ b/target/linux/mediatek/dts/mt7981b-cudy-wr3000s-v1.dts @@ -165,6 +165,7 @@ label = "Factory"; reg = <0x180000 0x0200000>; read-only; + nvmem-layout { compatible = "fixed-layout"; #address-cells = <1>; @@ -180,6 +181,7 @@ label = "bdinfo"; reg = <0x380000 0x0040000>; read-only; + nvmem-layout { compatible = "fixed-layout"; #address-cells = <1>; @@ -193,15 +195,15 @@ }; }; - partition@3C0000 { + partition@3c0000 { label = "FIP"; - reg = <0x3C0000 0x0200000>; + reg = <0x3c0000 0x0200000>; read-only; }; - partition@580000 { + partition@5c0000 { label = "ubi"; - reg = <0x5C0000 0x4000000>; + reg = <0x5c0000 0x4000000>; compatible = "linux,ubi"; }; }; From e5f3704f9a7e1117efd53df651bce7dc01f5e58e Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Mon, 9 Dec 2024 23:17:06 +0800 Subject: [PATCH 414/877] mediatek: cudy: fixes 2.5G PHY interrupt support Fixed interrupt support for 2.5G PHY. Removed useless phy-mode on phy node. Tested on Cudy TR3000. Signed-off-by: Chukun Pan (cherry picked from commit 82b69dfaf6ca92eeffb7523295d3d81a1d54323a) --- target/linux/mediatek/dts/mt7981b-cudy-m3000-v1.dts | 8 +++----- target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts | 9 ++++----- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/target/linux/mediatek/dts/mt7981b-cudy-m3000-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-m3000-v1.dts index b1797157ac671c..abe40403afafd0 100644 --- a/target/linux/mediatek/dts/mt7981b-cudy-m3000-v1.dts +++ b/target/linux/mediatek/dts/mt7981b-cudy-m3000-v1.dts @@ -77,7 +77,6 @@ ð { pinctrl-names = "default"; pinctrl-0 = <&mdio_pins>; - status = "okay"; gmac0: mac@0 { @@ -105,12 +104,11 @@ rtl8221b_phy: ethernet-phy@1 { compatible = "ethernet-phy-ieee802.3-c45"; reg = <1>; - - reset-gpios = <&pio 39 GPIO_ACTIVE_LOW>; - - interrupts = <38 IRQ_TYPE_LEVEL_LOW>; reset-assert-us = <100000>; reset-deassert-us = <100000>; + reset-gpios = <&pio 39 GPIO_ACTIVE_LOW>; + interrupts = <38 IRQ_TYPE_LEVEL_LOW>; + interrupt-parent = <&pio>; }; }; diff --git a/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts index 31a2cf51940d30..2591de85208d92 100644 --- a/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts +++ b/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts @@ -81,7 +81,6 @@ ð { pinctrl-names = "default"; pinctrl-0 = <&mdio_pins>; - status = "okay"; gmac0: mac@0 { @@ -105,13 +104,13 @@ &mdio_bus { phy1: phy@1 { - reg = <1>; compatible = "ethernet-phy-ieee802.3-c45"; - phy-mode = "2500base-x"; - reset-gpios = <&pio 39 GPIO_ACTIVE_LOW>; - interrupts = <38 IRQ_TYPE_LEVEL_LOW>; + reg = <1>; reset-assert-us = <100000>; reset-deassert-us = <100000>; + reset-gpios = <&pio 39 GPIO_ACTIVE_LOW>; + interrupts = <38 IRQ_TYPE_LEVEL_LOW>; + interrupt-parent = <&pio>; realtek,aldps-enable; }; }; From 95dffe39f8df7cc3685d8779426e666d5cc6e3d1 Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Wed, 4 Dec 2024 23:26:28 +0800 Subject: [PATCH 415/877] mediatek: update status led for Cudy TR3000 Use white led when running, consistent with the stock firmware. Signed-off-by: Chukun Pan (cherry picked from commit 87632219d4b8f0c96ea053e375f6f324fab0806f) --- .../linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts index 2591de85208d92..ff3c83a12d7662 100644 --- a/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts +++ b/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts @@ -12,10 +12,10 @@ aliases { label-mac-device = &gmac1; - led-boot = &led_status; - led-failsafe = &led_status; - led-running = &led_status; - led-upgrade = &led_status; + led-boot = &led_sys_red; + led-failsafe = &led_sys_red; + led-running = &led_sys_white; + led-upgrade = &led_sys_white; serial0 = &uart0; }; @@ -34,8 +34,8 @@ mode { label = "mode"; - linux,input-type = ; linux,code = ; + linux,input-type = ; gpios = <&pio 0 GPIO_ACTIVE_LOW>; debounce-interval = <60>; }; @@ -44,18 +44,17 @@ leds { compatible = "gpio-leds"; - led_status: led_0 { + led_sys_red: led-0 { function = LED_FUNCTION_POWER; color = ; gpios = <&pio 11 GPIO_ACTIVE_LOW>; }; - led_1 { + led_sys_white: led-1 { function = LED_FUNCTION_STATUS; color = ; gpios = <&pio 10 GPIO_ACTIVE_LOW>; }; - }; usb_vbus: regulator-usb { From a296d09dc48942ac3047819c4f16d0fb08a5c28c Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Thu, 5 Dec 2024 23:26:18 +0800 Subject: [PATCH 416/877] mediatek: cleanup device tree for cudy devices Fixes typo for led properties. Delete the unused rfb compatible. Signed-off-by: Chukun Pan (cherry picked from commit 64d1b1089c25d778f5f22bfc0c1590a2e83b664e) --- .../mediatek/dts/mt7981b-cudy-ap3000outdoor-v1.dts | 8 ++++---- .../linux/mediatek/dts/mt7981b-cudy-m3000-v1.dts | 2 +- .../linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts | 4 +--- .../linux/mediatek/dts/mt7981b-cudy-wr3000s-v1.dts | 14 ++++++-------- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/target/linux/mediatek/dts/mt7981b-cudy-ap3000outdoor-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-ap3000outdoor-v1.dts index 2e84d2b538ff75..735cecfe4296aa 100644 --- a/target/linux/mediatek/dts/mt7981b-cudy-ap3000outdoor-v1.dts +++ b/target/linux/mediatek/dts/mt7981b-cudy-ap3000outdoor-v1.dts @@ -8,7 +8,7 @@ / { model = "Cudy AP3000 Outdoor v1"; - compatible = "cudy,ap3000outdoor-v1", "mediatek,mt7981-spim-snand-rfb"; + compatible = "cudy,ap3000outdoor-v1", "mediatek,mt7981"; aliases { label-mac-device = &wifi; @@ -42,18 +42,19 @@ leds { compatible = "gpio-leds"; - led_status_green: led@0 { + led_status_green: led-0 { function = LED_FUNCTION_STATUS; color = ; gpios = <&pio 10 GPIO_ACTIVE_HIGH>; }; - led_status_red: led_1 { + led_status_red: led-1 { function = LED_FUNCTION_POWER; color = ; gpios = <&pio 11 GPIO_ACTIVE_HIGH>; }; }; + gpio_export { compatible = "gpio-export"; #size-cells = <0>; @@ -89,7 +90,6 @@ ð { pinctrl-names = "default"; pinctrl-0 = <&mdio_pins>; - status = "okay"; gmac1: mac@1 { diff --git a/target/linux/mediatek/dts/mt7981b-cudy-m3000-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-m3000-v1.dts index abe40403afafd0..cfe9d45630d6b8 100644 --- a/target/linux/mediatek/dts/mt7981b-cudy-m3000-v1.dts +++ b/target/linux/mediatek/dts/mt7981b-cudy-m3000-v1.dts @@ -6,7 +6,7 @@ / { model = "Cudy M3000 v1"; - compatible = "cudy,m3000-v1", "mediatek,mt7981-spim-snand-rfb"; + compatible = "cudy,m3000-v1", "mediatek,mt7981"; aliases { label-mac-device = &gmac0; diff --git a/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts index ff3c83a12d7662..86d8e857f19733 100644 --- a/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts +++ b/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts @@ -8,7 +8,7 @@ / { model = "Cudy TR3000 v1"; - compatible = "cudy,tr3000-v1", "mediatek,mt7981-spim-snand-rfb"; + compatible = "cudy,tr3000-v1", "mediatek,mt7981"; aliases { label-mac-device = &gmac1; @@ -59,11 +59,9 @@ usb_vbus: regulator-usb { compatible = "regulator-fixed"; - regulator-name = "usb-vbus"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; - gpios = <&pio 9 GPIO_ACTIVE_LOW>; regulator-boot-on; }; diff --git a/target/linux/mediatek/dts/mt7981b-cudy-wr3000s-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-wr3000s-v1.dts index ccefc1926c518e..bdc6188a4aedb9 100644 --- a/target/linux/mediatek/dts/mt7981b-cudy-wr3000s-v1.dts +++ b/target/linux/mediatek/dts/mt7981b-cudy-wr3000s-v1.dts @@ -8,7 +8,7 @@ / { model = "Cudy WR3000S v1"; - compatible = "cudy,wr3000s-v1", "mediatek,mt7981-spim-snand-rfb"; + compatible = "cudy,wr3000s-v1", "mediatek,mt7981"; aliases { label-mac-device = &gmac0; @@ -42,33 +42,32 @@ leds { compatible = "gpio-leds"; - led_status: led@0 { + led_status: led-status { function = LED_FUNCTION_STATUS; color = ; gpios = <&pio 10 GPIO_ACTIVE_LOW>; }; - - led_internet { + led-internet { function = LED_FUNCTION_WAN_ONLINE; color = ; gpios = <&pio 11 GPIO_ACTIVE_LOW>; }; - led_wps { + led-wps { function = LED_FUNCTION_WPS; color = ; gpios = <&pio 9 GPIO_ACTIVE_LOW>; }; - led_wlan2g { + led-wlan2g { function = LED_FUNCTION_WLAN_2GHZ; color = ; gpios = <&pio 6 GPIO_ACTIVE_LOW>; linux,default-trigger = "phy0tpt"; }; - led_wlan5g { + led-wlan5g { function = LED_FUNCTION_WLAN_5GHZ; color = ; gpios = <&pio 7 GPIO_ACTIVE_LOW>; @@ -88,7 +87,6 @@ ð { pinctrl-names = "default"; pinctrl-0 = <&mdio_pins>; - status = "okay"; gmac0: mac@0 { From 1e9966a63ae430a5c48039fd9752bf1c465325f3 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Fri, 24 Jan 2025 22:56:59 +0100 Subject: [PATCH 417/877] kernel: Make kmod-usb-chipidea select kmod-phy-ath79-usb The USB PHY on the ar9330 and similar SoCs needs the PHY driver. In OpenWrt 23.05 it was compiled into the kernel. The kernel 6.6 configuration does not compile it in any more, make the kmod-usb-chipidea driver select it to add it to the images. Fixes: https://github.com/openwrt/openwrt/issues/17710 Fixes: 04bdf9b3323e ("ath79: disable ath79 USB phy drivers by default") Link: https://github.com/openwrt/openwrt/pull/17720 Signed-off-by: Hauke Mehrtens (cherry picked from commit b467e5a0afebbc4982213c03f90dfc6deb717b36) --- package/kernel/linux/modules/usb.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kernel/linux/modules/usb.mk b/package/kernel/linux/modules/usb.mk index 8f934800fc6410..481d2be59a201e 100644 --- a/package/kernel/linux/modules/usb.mk +++ b/package/kernel/linux/modules/usb.mk @@ -1737,7 +1737,7 @@ $(eval $(call KernelPackage,usbip-server)) define KernelPackage/usb-chipidea TITLE:=Host and device support for Chipidea controllers - DEPENDS:=+USB_GADGET_SUPPORT:kmod-usb-gadget @TARGET_ath79 +kmod-usb-ehci +kmod-usb-phy-nop +kmod-usb-roles + DEPENDS:=+USB_GADGET_SUPPORT:kmod-usb-gadget @TARGET_ath79 +kmod-usb-ehci +kmod-usb-phy-nop +kmod-usb-roles +kmod-phy-ath79-usb KCONFIG:= \ CONFIG_EXTCON \ CONFIG_USB_CHIPIDEA \ From d30773abe8cc333137a964ffedf878cc425ac9ed Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Thu, 23 Jan 2025 03:36:10 +0000 Subject: [PATCH 418/877] generic: fix probe issues with RealTek RTL8221B PHYs Import patch "net: phy: realtek: mark existing MMDs as present" When using Clause-45 mode to access RealTek RTL8221B 2.5G PHYs some versions of the PHY fail to report the MMDs present on the PHY. Mark MMDs PMAPMD, PCS and AN which are always existing according to the datasheet as present to fix that. Fixes: #16823, #17183, #17232 Signed-off-by: Daniel Golle Tested-by: Aleksander Jan Bajkowski Tested-by: Juan Pedro Paredes Caballero (cherry picked from commit 730db6b893748517949b1d3a0c0cb8b6c1288040) --- ...ealtek-mark-existing-MMDs-as-present.patch | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 target/linux/generic/pending-6.6/720-07-net-phy-realtek-mark-existing-MMDs-as-present.patch diff --git a/target/linux/generic/pending-6.6/720-07-net-phy-realtek-mark-existing-MMDs-as-present.patch b/target/linux/generic/pending-6.6/720-07-net-phy-realtek-mark-existing-MMDs-as-present.patch new file mode 100644 index 00000000000000..1ef42e866d5d97 --- /dev/null +++ b/target/linux/generic/pending-6.6/720-07-net-phy-realtek-mark-existing-MMDs-as-present.patch @@ -0,0 +1,27 @@ +From 1addfb042a9d27788a0fb2c2935045b56fd8560e Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Thu, 23 Jan 2025 03:25:29 +0000 +Subject: [PATCH] net: phy: realtek: mark existing MMDs as present + +When using Clause-45 mode to access RealTek RTL8221B 2.5G PHYs some +versions of the PHY fail to report the MMDs present on the PHY. +Mark MMDs PMAPMD, PCS and AN which are always existing according to +the datasheet as present to fix that. + +Signed-off-by: Daniel Golle +--- + drivers/net/phy/realtek/realtek_main.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/net/phy/realtek/realtek_main.c ++++ b/drivers/net/phy/realtek/realtek_main.c +@@ -1034,6 +1034,9 @@ static int rtl822x_c45_get_features(stru + linkmode_set_bit(ETHTOOL_LINK_MODE_TP_BIT, + phydev->supported); + ++ phydev->c45_ids.mmds_present |= MDIO_DEVS_PMAPMD | MDIO_DEVS_PCS | ++ MDIO_DEVS_AN; ++ + return genphy_c45_pma_read_abilities(phydev); + } + From a1ee311f59d5bd0838444afed7984d5757c5222b Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 26 Jan 2025 21:10:53 +0100 Subject: [PATCH 419/877] unetd: fix interface teardown Pass the correct device name in the network_del ubus call Signed-off-by: Felix Fietkau (cherry picked from commit 80ba0d958dc96fb7aba26614f71325507fabd58a) --- package/network/services/unetd/files/unetd.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package/network/services/unetd/files/unetd.sh b/package/network/services/unetd/files/unetd.sh index 2f0f0c478c78a9..2117eab391a198 100644 --- a/package/network/services/unetd/files/unetd.sh +++ b/package/network/services/unetd/files/unetd.sh @@ -82,11 +82,10 @@ proto_unet_setup() { proto_unet_teardown() { local config="$1" - local iface="$2" local device json_get_vars device - device="${device:-$iface}" + device="${device:-$config}" json_init json_add_string name "$device" From 298654b9ab57b953b5c5d72cc69f1c46e0a5dd23 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 26 Jan 2025 21:18:27 +0100 Subject: [PATCH 420/877] netifd: remove leftover wifi reload_legacy call Commit d12753929165 removed support for it Fixes: #17738 Signed-off-by: Felix Fietkau (cherry picked from commit a3154cfeb6c381576682a8cc5427a8b1bd9daf96) --- package/network/config/netifd/files/etc/init.d/network | 1 - 1 file changed, 1 deletion(-) diff --git a/package/network/config/netifd/files/etc/init.d/network b/package/network/config/netifd/files/etc/init.d/network index 86340b77e53c6e..b8b2a219b18482 100755 --- a/package/network/config/netifd/files/etc/init.d/network +++ b/package/network/config/netifd/files/etc/init.d/network @@ -30,7 +30,6 @@ reload_service() { init_switch ubus call network reload || rv=1 - [ -x /sbin/wifi ] && /sbin/wifi reload_legacy return $rv } From 150aa9aeee509dba5255885618d8df372670e8f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Owoc?= Date: Sun, 26 Jan 2025 19:53:31 +0100 Subject: [PATCH 421/877] ramips: mt7620: fix patching mac address in caldata MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix usage of non-existent 'caldata_patch_mac' function by using the 'caldata_patch_data' function. Fixes: #17734 Signed-off-by: Paweł Owoc Link: https://github.com/openwrt/openwrt/pull/17737 Signed-off-by: Hauke Mehrtens (cherry picked from commit 3295f6f1c254cd7e5e5285a05581bf6abbde8999) --- .../mt7620/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ramips/mt7620/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom b/target/linux/ramips/mt7620/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom index 2d1ac2e872d518..b68efcbba182aa 100644 --- a/target/linux/ramips/mt7620/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom +++ b/target/linux/ramips/mt7620/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom @@ -34,12 +34,12 @@ case "$FIRMWARE" in wan_mac=$(jboot_config_read -m -i $(find_mtd_part "config") -o 0xE000) wifi_mac=$(macaddr_add "$wan_mac" 1) jboot_eeprom_extract "config" 0xE000 - caldata_patch_mac $wifi_mac 0x4 + caldata_patch_data "${wifi_mac//:/}" 0x4 ;; dovado,tiny-ac) wifi_mac=$(mtd_get_mac_ascii u-boot-env INIC_MAC_ADDR) caldata_extract "factory" 0x0 0x200 - caldata_patch_mac $wifi_mac 0x4 + caldata_patch_data "${wifi_mac//:/}" 0x4 ;; *) caldata_die "Please define mtd-eeprom in $board DTS file!" From e1ba6e407bc5052fc86251581995a055ff24f736 Mon Sep 17 00:00:00 2001 From: Eric Fahlgren Date: Sun, 26 Jan 2025 09:25:13 -0800 Subject: [PATCH 422/877] octeon: ubnt-usg: add board name to supported devices The on-device board name reported by 'ubus call system board' is not present in the generated profiles.json. This results in upgrade tools being unable to match the image with the proper device. Let's add a 'SUPPORTED_DEVICES' entry for the board name to fix this. Links: https://forum.openwrt.org/t/owut-openwrt-upgrade-tool/200035/441 Links: https://github.com/openwrt/openwrt/commit/2a07270180ed0e295d854d6e9e59c78c40549efc Signed-off-by: Eric Fahlgren Link: https://github.com/openwrt/openwrt/pull/17736 Signed-off-by: Hauke Mehrtens (cherry picked from commit 7165937c3b6ebe5ac692fcde1cc69ba1c7a3d9c9) --- target/linux/octeon/image/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/octeon/image/Makefile b/target/linux/octeon/image/Makefile index f00e87c5201674..dec04809150aee 100644 --- a/target/linux/octeon/image/Makefile +++ b/target/linux/octeon/image/Makefile @@ -92,6 +92,7 @@ define Device/ubnt_unifi-usg DEVICE_PACKAGES += kmod-gpio-button-hotplug kmod-leds-gpio DEVICE_DTS := cn5020_ubnt_usg KERNEL += | append-dtb-to-elf + SUPPORTED_DEVICES += ubnt,usg endef TARGET_DEVICES += ubnt_unifi-usg From ea66541032b6dab9f53551b983c7a39d283207ef Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Mon, 27 Jan 2025 11:07:13 +0100 Subject: [PATCH 423/877] airoha: an7581: refresh and fix cpufreq patch Refresh cpufreq with merged upstream version. Also fix the PM Domain rebased patch to correctly expose the symbol for non Mediatek target. Update dtsi with new pm domain name. Signed-off-by: Christian Marangi (cherry picked from commit fbbfcbf150cd7c72f49c149e7f9b9f4d0bf43e4b) --- target/linux/airoha/an7581/config-6.6 | 1 + target/linux/airoha/dts/an7581.dtsi | 8 +-- ...oha-Add-EN7581-CPUFreq-SMCCC-driver.patch} | 47 +++++----------- ...ha-Add-Airoha-CPU-PM-Domain-support.patch} | 55 +++++++++---------- 4 files changed, 43 insertions(+), 68 deletions(-) rename target/linux/airoha/patches-6.6/{100-02-cpufreq-airoha-Add-EN7581-CPUFreq-SMCCC-driver.patch => 039-v6.14-cpufreq-airoha-Add-EN7581-CPUFreq-SMCCC-driver.patch} (83%) rename target/linux/airoha/patches-6.6/{100-01-pmdomain-airoha-Add-Airoha-CPU-PM-Domain-support.patch => 040-v6.14-pmdomain-airoha-Add-Airoha-CPU-PM-Domain-support.patch} (83%) diff --git a/target/linux/airoha/an7581/config-6.6 b/target/linux/airoha/an7581/config-6.6 index f80bf49f8c1190..d86aa8bbbbb041 100644 --- a/target/linux/airoha/an7581/config-6.6 +++ b/target/linux/airoha/an7581/config-6.6 @@ -1,4 +1,5 @@ CONFIG_64BIT=y +CONFIG_AIROHA_CPU_PM_DOMAIN=y CONFIG_AIROHA_THERMAL=y CONFIG_AIROHA_WATCHDOG=y CONFIG_AMPERE_ERRATUM_AC03_CPU_38=y diff --git a/target/linux/airoha/dts/an7581.dtsi b/target/linux/airoha/dts/an7581.dtsi index 820ab0bfa8fb41..2b4c1b716bec6e 100644 --- a/target/linux/airoha/dts/an7581.dtsi +++ b/target/linux/airoha/dts/an7581.dtsi @@ -81,7 +81,7 @@ clocks = <&cpufreq>; clock-names = "cpu"; power-domains = <&cpufreq>; - power-domain-names = "cpu_pd"; + power-domain-names = "perf"; next-level-cache = <&l2>; #cooling-cells = <2>; }; @@ -95,7 +95,7 @@ clocks = <&cpufreq>; clock-names = "cpu"; power-domains = <&cpufreq>; - power-domain-names = "cpu_pd"; + power-domain-names = "perf"; next-level-cache = <&l2>; #cooling-cells = <2>; }; @@ -109,7 +109,7 @@ clocks = <&cpufreq>; clock-names = "cpu"; power-domains = <&cpufreq>; - power-domain-names = "cpu_pd"; + power-domain-names = "perf"; next-level-cache = <&l2>; #cooling-cells = <2>; }; @@ -123,7 +123,7 @@ clocks = <&cpufreq>; clock-names = "cpu"; power-domains = <&cpufreq>; - power-domain-names = "cpu_pd"; + power-domain-names = "perf"; next-level-cache = <&l2>; #cooling-cells = <2>; }; diff --git a/target/linux/airoha/patches-6.6/100-02-cpufreq-airoha-Add-EN7581-CPUFreq-SMCCC-driver.patch b/target/linux/airoha/patches-6.6/039-v6.14-cpufreq-airoha-Add-EN7581-CPUFreq-SMCCC-driver.patch similarity index 83% rename from target/linux/airoha/patches-6.6/100-02-cpufreq-airoha-Add-EN7581-CPUFreq-SMCCC-driver.patch rename to target/linux/airoha/patches-6.6/039-v6.14-cpufreq-airoha-Add-EN7581-CPUFreq-SMCCC-driver.patch index 6a2e54f4d1abc7..0db82d55e14451 100644 --- a/target/linux/airoha/patches-6.6/100-02-cpufreq-airoha-Add-EN7581-CPUFreq-SMCCC-driver.patch +++ b/target/linux/airoha/patches-6.6/039-v6.14-cpufreq-airoha-Add-EN7581-CPUFreq-SMCCC-driver.patch @@ -1,7 +1,7 @@ -From fa27cb99b297a1a9c0a5824afe5a670e424fff61 Mon Sep 17 00:00:00 2001 +From 84cf9e541cccb8cb698518a9897942e8c78f1d83 Mon Sep 17 00:00:00 2001 From: Christian Marangi -Date: Wed, 16 Oct 2024 18:00:57 +0200 -Subject: [PATCH v9 2/2] cpufreq: airoha: Add EN7581 CPUFreq SMCCC driver +Date: Thu, 9 Jan 2025 14:12:58 +0100 +Subject: [PATCH] cpufreq: airoha: Add EN7581 CPUFreq SMCCC driver Add simple CPU Freq driver for Airoha EN7581 SoC that control CPU frequency scaling with SMC APIs and register a generic "cpufreq-dt" @@ -14,29 +14,8 @@ Add SoC compatible to cpufreq-dt-plat block list as a dedicated cpufreq driver is needed with OPP v2 nodes declared in DTS. Signed-off-by: Christian Marangi +Signed-off-by: Viresh Kumar --- -Changes v9: -- Fix compile error targetting wrong branch (remove_new change and new PM OPs) -Changes v8: -- Split in dedicated PM domain driver -Changes v7: -- No changes -Changes v6: -- Improve Kconfig depends logic -- Select PM (PM_GENERIC_DOMAINS depends on it) -- Drop (int) cast for -Changes v5: -- Rename cpu_pd to perf for power domain name -- Use remove instead of remove_new -Changes v4: -- Rework to clk-only + PM set_performance_state implementation -Changes v3: -- Adapt to new cpufreq-dt APIs -- Register cpufreq-dt instead of custom freq driver -Changes v2: -- Fix kernel bot error with missing slab.h and bitfield.h header -- Limit COMPILE_TEST to ARM64 due to smcc 1.2 - drivers/cpufreq/Kconfig.arm | 8 ++ drivers/cpufreq/Makefile | 1 + drivers/cpufreq/airoha-cpufreq.c | 152 +++++++++++++++++++++++++++ @@ -104,11 +83,15 @@ Changes v2: +} + +static const char * const airoha_cpufreq_clk_names[] = { "cpu", NULL }; -+static const char * const airoha_cpufreq_genpd_names[] = { "cpu_pd", NULL }; ++static const char * const airoha_cpufreq_pd_names[] = { "perf", NULL }; + +static int airoha_cpufreq_probe(struct platform_device *pdev) +{ -+ struct dev_pm_opp_config config = { }; ++ struct dev_pm_opp_config config = { ++ .clk_names = airoha_cpufreq_clk_names, ++ .config_clks = airoha_cpufreq_config_clks_nop, ++ .genpd_names = airoha_cpufreq_pd_names, ++ }; + struct platform_device *cpufreq_dt; + struct airoha_cpufreq_priv *priv; + struct device *dev = &pdev->dev; @@ -125,18 +108,14 @@ Changes v2: + if (!priv) + return -ENOMEM; + -+ config.clk_names = airoha_cpufreq_clk_names; -+ config.config_clks = airoha_cpufreq_config_clks_nop; -+ config.genpd_names = airoha_cpufreq_genpd_names; -+ config.virt_devs = &virt_devs; -+ ++ /* Set OPP table conf with NOP config_clks */ + priv->opp_token = dev_pm_opp_set_config(cpu_dev, &config); + if (priv->opp_token < 0) + return dev_err_probe(dev, priv->opp_token, "Failed to set OPP config\n"); + + /* Set Attached PM for OPP ACTIVE */ + if (virt_devs) { -+ const char * const *name = airoha_cpufreq_genpd_names; ++ const char * const *name = airoha_cpufreq_pd_names; + int i, j; + + for (i = 0; *name; i++, name++) { @@ -177,7 +156,7 @@ Changes v2: +static void airoha_cpufreq_remove(struct platform_device *pdev) +{ + struct airoha_cpufreq_priv *priv = platform_get_drvdata(pdev); -+ const char * const *name = airoha_cpufreq_genpd_names; ++ const char * const *name = airoha_cpufreq_pd_names; + int i; + + platform_device_unregister(priv->cpufreq_dt); diff --git a/target/linux/airoha/patches-6.6/100-01-pmdomain-airoha-Add-Airoha-CPU-PM-Domain-support.patch b/target/linux/airoha/patches-6.6/040-v6.14-pmdomain-airoha-Add-Airoha-CPU-PM-Domain-support.patch similarity index 83% rename from target/linux/airoha/patches-6.6/100-01-pmdomain-airoha-Add-Airoha-CPU-PM-Domain-support.patch rename to target/linux/airoha/patches-6.6/040-v6.14-pmdomain-airoha-Add-Airoha-CPU-PM-Domain-support.patch index 52d3f40b36983b..8dc8a3d304a4c1 100644 --- a/target/linux/airoha/patches-6.6/100-01-pmdomain-airoha-Add-Airoha-CPU-PM-Domain-support.patch +++ b/target/linux/airoha/patches-6.6/040-v6.14-pmdomain-airoha-Add-Airoha-CPU-PM-Domain-support.patch @@ -1,7 +1,7 @@ -From 76e4e6ce9aaae897f80e375345bf0095e1b09ff2 Mon Sep 17 00:00:00 2001 +From 82e703dd438b71432cc0ccbb90925d1e32dd014a Mon Sep 17 00:00:00 2001 From: Christian Marangi -Date: Sat, 4 Jan 2025 19:03:09 +0100 -Subject: [PATCH v9 1/2] pmdomain: airoha: Add Airoha CPU PM Domain support +Date: Thu, 9 Jan 2025 14:12:57 +0100 +Subject: [PATCH] pmdomain: airoha: Add Airoha CPU PM Domain support Add Airoha CPU PM Domain support to control frequency and power of CPU present on Airoha EN7581 SoC. @@ -11,25 +11,21 @@ passing the performance state. The driver also expose a read-only clock that expose the current CPU frequency with SMC command. Signed-off-by: Christian Marangi +Link: https://lore.kernel.org/r/20250109131313.32317-1-ansuelsmth@gmail.com +Signed-off-by: Ulf Hansson --- -Changes v9: -- Fix compile error targetting wrong branch (remove_new change) -Changes v8: -- Add this patch -- Use SMC invoke instead of 1.2 - - drivers/pmdomain/mediatek/Kconfig | 11 ++ + drivers/pmdomain/mediatek/Kconfig | 12 ++ drivers/pmdomain/mediatek/Makefile | 1 + .../pmdomain/mediatek/airoha-cpu-pmdomain.c | 144 ++++++++++++++++++ - 3 files changed, 156 insertions(+) + 3 files changed, 157 insertions(+) create mode 100644 drivers/pmdomain/mediatek/airoha-cpu-pmdomain.c --- a/drivers/soc/mediatek/Kconfig +++ b/drivers/soc/mediatek/Kconfig -@@ -72,6 +72,17 @@ config MTK_SCPSYS_PM_DOMAINS - Control Processor System (SCPSYS) has several power management related - tasks in the system. - +@@ -2,6 +2,17 @@ + # + # MediaTek SoC drivers + # +config AIROHA_CPU_PM_DOMAIN + tristate "Airoha CPU power domain" + default ARCH_AIROHA @@ -41,9 +37,9 @@ Changes v8: + CPU frequency and power is controlled by ATF with SMC command to + set performance states. + - config MTK_MMSYS - tristate "MediaTek MMSYS Support" - default ARCH_MEDIATEK + menu "MediaTek SoC drivers" + depends on ARCH_MEDIATEK || COMPILE_TEST + --- a/drivers/pmdomain/mediatek/Makefile +++ b/drivers/pmdomain/mediatek/Makefile @@ -1,3 +1,4 @@ @@ -53,7 +49,7 @@ Changes v8: +obj-$(CONFIG_AIROHA_CPU_PM_DOMAIN) += airoha-cpu-pmdomain.o --- /dev/null +++ b/drivers/pmdomain/mediatek/airoha-cpu-pmdomain.c -@@ -0,0 +1,145 @@ +@@ -0,0 +1,144 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include @@ -123,9 +119,13 @@ Changes v8: +{ + struct airoha_cpu_pmdomain_priv *priv; + struct device *dev = &pdev->dev; -+ struct clk_init_data init = { }; ++ const struct clk_init_data init = { ++ .name = "cpu", ++ .ops = &airoha_cpu_pmdomain_clk_ops, ++ /* Clock with no set_rate, can't cache */ ++ .flags = CLK_GET_RATE_NOCACHE, ++ }; + struct generic_pm_domain *pd; -+ struct clk_hw *hw; + int ret; + + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); @@ -133,18 +133,13 @@ Changes v8: + return -ENOMEM; + + /* Init and register a get-only clk for Cpufreq */ -+ init.name = "cpu"; -+ init.ops = &airoha_cpu_pmdomain_clk_ops; -+ /* Clock with no set_rate, can't cache */ -+ init.flags = CLK_GET_RATE_NOCACHE; -+ -+ hw = &priv->hw; -+ hw->init = &init; -+ ret = devm_clk_hw_register(dev, hw); ++ priv->hw.init = &init; ++ ret = devm_clk_hw_register(dev, &priv->hw); + if (ret) + return ret; + -+ ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, hw); ++ ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, ++ &priv->hw); + if (ret) + return ret; + From 077a8690347d48cf2b54cb4bde7e29a7df3d26f4 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Mon, 27 Jan 2025 12:02:24 +0100 Subject: [PATCH 424/877] airoha: an7581: replace eMMC support with upstream version Replace eMMC support with upstream version where we declare dummy clock and dummy regulator instead of a specific compatible. Also drop the downstream patch for it. Signed-off-by: Christian Marangi (cherry picked from commit b7edf88b0fe15b32be802c7de54036ff8e66dcc1) --- target/linux/airoha/an7581/config-6.6 | 2 + target/linux/airoha/dts/an7581-evb-emmc.dts | 3 +- target/linux/airoha/dts/an7581.dtsi | 23 ++- ...k-sd-add-support-for-AN7581-MMC-Host.patch | 136 ------------------ 4 files changed, 24 insertions(+), 140 deletions(-) delete mode 100644 target/linux/airoha/patches-6.6/111-mmc-mtk-sd-add-support-for-AN7581-MMC-Host.patch diff --git a/target/linux/airoha/an7581/config-6.6 b/target/linux/airoha/an7581/config-6.6 index d86aa8bbbbb041..812dcd76bba083 100644 --- a/target/linux/airoha/an7581/config-6.6 +++ b/target/linux/airoha/an7581/config-6.6 @@ -496,6 +496,8 @@ CONFIG_RATIONAL=y CONFIG_RCU_CPU_STALL_TIMEOUT=21 CONFIG_REGMAP=y CONFIG_REGMAP_MMIO=y +CONFIG_REGULATOR=y +CONFIG_REGULATOR_FIXED_VOLTAGE=y CONFIG_RELOCATABLE=y CONFIG_RESET_CONTROLLER=y CONFIG_RFS_ACCEL=y diff --git a/target/linux/airoha/dts/an7581-evb-emmc.dts b/target/linux/airoha/dts/an7581-evb-emmc.dts index 91d797779562ba..26d446e2a1efbd 100644 --- a/target/linux/airoha/dts/an7581-evb-emmc.dts +++ b/target/linux/airoha/dts/an7581-evb-emmc.dts @@ -100,8 +100,9 @@ }; &mmc0 { - pinctrl-names = "default"; + pinctrl-names = "default", "state_uhs"; pinctrl-0 = <&mmc_pins>; + pinctrl-1 = <&mmc_pins>; status = "okay"; #address-cells = <1>; diff --git a/target/linux/airoha/dts/an7581.dtsi b/target/linux/airoha/dts/an7581.dtsi index 2b4c1b716bec6e..762a6aa1a897c8 100644 --- a/target/linux/airoha/dts/an7581.dtsi +++ b/target/linux/airoha/dts/an7581.dtsi @@ -332,6 +332,21 @@ }; }; + clk25m: oscillator { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <25000000>; + clock-output-names = "clkxtal"; + }; + + vmmc_3v3: regulator-vmmc-3v3 { + compatible = "regulator-fixed"; + regulator-name = "vmmc"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; + soc { compatible = "simple-bus"; #address-cells = <2>; @@ -535,13 +550,15 @@ }; mmc0: mmc@1fa0e000 { - compatible = "airoha,an7581-mmc"; + compatible = "mediatek,mt7622-mmc"; reg = <0x0 0x1fa0e000 0x0 0x1000>, <0x0 0x1fa0c000 0x0 0x60>; interrupts = ; - clocks = <&scuclk EN7581_CLK_EMMC>; - clock-names = "source"; bus-width = <4>; + clocks = <&scuclk EN7581_CLK_EMMC>, <&clk25m>; + clock-names = "source", "hclk"; + bus-width = <4>; max-frequency = <52000000>; + vmmc-supply = <&vmmc_3v3>; disable-wp; cap-mmc-highspeed; non-removable; diff --git a/target/linux/airoha/patches-6.6/111-mmc-mtk-sd-add-support-for-AN7581-MMC-Host.patch b/target/linux/airoha/patches-6.6/111-mmc-mtk-sd-add-support-for-AN7581-MMC-Host.patch deleted file mode 100644 index d116bb9ee05462..00000000000000 --- a/target/linux/airoha/patches-6.6/111-mmc-mtk-sd-add-support-for-AN7581-MMC-Host.patch +++ /dev/null @@ -1,136 +0,0 @@ -From f38f16925e1aa7cc71f63d3d52997b1c98cd7781 Mon Sep 17 00:00:00 2001 -From: Christian Marangi -Date: Wed, 11 Dec 2024 11:27:10 +0100 -Subject: [PATCH 4/4] mmc: mtk-sd: add support for AN7581 MMC Host - -Add support for AN7581 MMC Host. The MMC Host controller is based on -mt7622 with the difference of not having regulator supply and state_uhs -pins and hclk clock. - -Some minor fixes are applied to check if the state_uhs pins are defined -and make hclk optional for the new airoha compatible. - -Signed-off-by: Christian Marangi ---- - drivers/mmc/host/mtk-sd.c | 55 ++++++++++++++++++++++++++++++++------- - 1 file changed, 46 insertions(+), 9 deletions(-) - ---- a/drivers/mmc/host/mtk-sd.c -+++ b/drivers/mmc/host/mtk-sd.c -@@ -615,6 +615,19 @@ static const struct mtk_mmc_compatible m - .stop_clk_fix = true, - }; - -+static const struct mtk_mmc_compatible an7581_compat = { -+ .clk_div_bits = 12, -+ .recheck_sdio_irq = true, -+ .hs400_tune = false, -+ .pad_tune_reg = MSDC_PAD_TUNE0, -+ .async_fifo = true, -+ .data_tune = true, -+ .busy_check = true, -+ .stop_clk_fix = true, -+ .enhance_rx = true, -+ .support_64g = false, -+}; -+ - static const struct of_device_id msdc_of_ids[] = { - { .compatible = "mediatek,mt2701-mmc", .data = &mt2701_compat}, - { .compatible = "mediatek,mt2712-mmc", .data = &mt2712_compat}, -@@ -627,7 +640,7 @@ static const struct of_device_id msdc_of - { .compatible = "mediatek,mt8173-mmc", .data = &mt8173_compat}, - { .compatible = "mediatek,mt8183-mmc", .data = &mt8183_compat}, - { .compatible = "mediatek,mt8516-mmc", .data = &mt8516_compat}, -- -+ { .compatible = "airoha,an7581-mmc", .data = &an7581_compat}, - {} - }; - MODULE_DEVICE_TABLE(of, msdc_of_ids); -@@ -1479,6 +1492,10 @@ static int msdc_ops_switch_volt(struct m - struct msdc_host *host = mmc_priv(mmc); - int ret; - -+ /* Skip setting supply if not supported */ -+ if (!mmc->supply.vqmmc) -+ return 0; -+ - if (!IS_ERR(mmc->supply.vqmmc)) { - if (ios->signal_voltage != MMC_SIGNAL_VOLTAGE_330 && - ios->signal_voltage != MMC_SIGNAL_VOLTAGE_180) { -@@ -1578,7 +1595,9 @@ static void msdc_enable_sdio_irq(struct - dev_dbg(host->dev, "SDIO eint irq: %d!\n", host->eint_irq); - } - -- pinctrl_select_state(host->pinctrl, host->pins_uhs); -+ /* Skip setting uhs pins if not supported */ -+ if (host->pins_uhs) -+ pinctrl_select_state(host->pinctrl, host->pins_uhs); - } else { - dev_pm_clear_wake_irq(host->dev); - } -@@ -1886,6 +1905,10 @@ static void msdc_ops_set_ios(struct mmc_ - - msdc_set_buswidth(host, ios->bus_width); - -+ /* Skip regulator if not supported */ -+ if (!mmc->supply.vmmc) -+ goto skip_regulator; -+ - /* Suspend/Resume will do power off/on */ - switch (ios->power_mode) { - case MMC_POWER_UP: -@@ -1921,6 +1944,7 @@ static void msdc_ops_set_ios(struct mmc_ - break; - } - -+skip_regulator: - if (host->mclk != ios->clock || host->timing != ios->timing) - msdc_set_mclk(host, ios->timing, ios->clock); - } -@@ -2617,9 +2641,12 @@ static int msdc_of_clock_parse(struct pl - if (IS_ERR(host->src_clk)) - return PTR_ERR(host->src_clk); - -- host->h_clk = devm_clk_get(&pdev->dev, "hclk"); -- if (IS_ERR(host->h_clk)) -- return PTR_ERR(host->h_clk); -+ /* AN7581 SoC doesn't have hclk */ -+ if (!device_is_compatible(&pdev->dev, "airoha,an7581-mmc")) { -+ host->h_clk = devm_clk_get(&pdev->dev, "hclk"); -+ if (IS_ERR(host->h_clk)) -+ return PTR_ERR(host->h_clk); -+ } - - host->bus_clk = devm_clk_get_optional(&pdev->dev, "bus_clk"); - if (IS_ERR(host->bus_clk)) -@@ -2731,10 +2758,13 @@ static int msdc_drv_probe(struct platfor - return PTR_ERR(host->pins_default); - } - -- host->pins_uhs = pinctrl_lookup_state(host->pinctrl, "state_uhs"); -- if (IS_ERR(host->pins_uhs)) { -- dev_err(&pdev->dev, "Cannot find pinctrl uhs!\n"); -- return PTR_ERR(host->pins_uhs); -+ /* AN7581 doesn't have state_uhs pins */ -+ if (!device_is_compatible(&pdev->dev, "airoha,an7581-mmc")) { -+ host->pins_uhs = pinctrl_lookup_state(host->pinctrl, "state_uhs"); -+ if (IS_ERR(host->pins_uhs)) { -+ dev_err(&pdev->dev, "Cannot find pinctrl uhs!\n"); -+ return PTR_ERR(host->pins_uhs); -+ } - } - - /* Support for SDIO eint irq ? */ -@@ -2815,6 +2845,12 @@ static int msdc_drv_probe(struct platfor - dev_err(&pdev->dev, "Cannot ungate clocks!\n"); - goto release_clk; - } -+ -+ /* AN7581 without regulator require tune to OCR values */ -+ if (device_is_compatible(&pdev->dev, "airoha,an7581-mmc") && -+ !mmc->ocr_avail) -+ mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; -+ - msdc_init_hw(host); - - if (mmc->caps2 & MMC_CAP2_CQE) { From 2bff6e490a8cb5af1504a8975df5aa1208e7b9f5 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Mon, 27 Jan 2025 12:14:28 +0100 Subject: [PATCH 425/877] airoha: an7581: replace clock patch with upstream version Replace clock patch for eMMC with upstream version to add the tag and flag them as upstreamed. Signed-off-by: Christian Marangi (cherry picked from commit a9b408a97f7bf8b1f98f355fefe3c9bfc959d5a6) --- ...Rework-clock-handling-for-different-clock.patch} | 13 +++++++------ ...s-clock-drop-NUM_CLOCKS-define-for-EN7581.patch} | 7 +++++-- ...bindings-clock-add-ID-for-eMMC-for-EN7581.patch} | 6 ++++-- ...-clk-en7523-Add-clock-for-eMMC-for-EN7581.patch} | 6 ++++-- 4 files changed, 20 insertions(+), 12 deletions(-) rename target/linux/airoha/patches-6.6/{110-01-clk-en7523-Rework-clock-handling-for-different-clock.patch => 041-01-v6.14-clk-en7523-Rework-clock-handling-for-different-clock.patch} (87%) rename target/linux/airoha/patches-6.6/{110-02-dt-bindings-clock-drop-NUM_CLOCKS-define-for-EN7581.patch => 041-02-v6.14-dt-bindings-clock-drop-NUM_CLOCKS-define-for-EN7581.patch} (69%) rename target/linux/airoha/patches-6.6/{110-03-dt-bindings-clock-add-ID-for-eMMC-for-EN7581.patch => 041-03-v6.14-dt-bindings-clock-add-ID-for-eMMC-for-EN7581.patch} (74%) rename target/linux/airoha/patches-6.6/{110-04-clk-en7523-Add-clock-for-eMMC-for-EN7581.patch => 041-04-v6.14-clk-en7523-Add-clock-for-eMMC-for-EN7581.patch} (84%) diff --git a/target/linux/airoha/patches-6.6/110-01-clk-en7523-Rework-clock-handling-for-different-clock.patch b/target/linux/airoha/patches-6.6/041-01-v6.14-clk-en7523-Rework-clock-handling-for-different-clock.patch similarity index 87% rename from target/linux/airoha/patches-6.6/110-01-clk-en7523-Rework-clock-handling-for-different-clock.patch rename to target/linux/airoha/patches-6.6/041-01-v6.14-clk-en7523-Rework-clock-handling-for-different-clock.patch index 187715a5cc3302..96d2bbf28ef81f 100644 --- a/target/linux/airoha/patches-6.6/110-01-clk-en7523-Rework-clock-handling-for-different-clock.patch +++ b/target/linux/airoha/patches-6.6/041-01-v6.14-clk-en7523-Rework-clock-handling-for-different-clock.patch @@ -1,6 +1,6 @@ -From 04cd09990fdc3106d9fc4c47dda100e521d62a43 Mon Sep 17 00:00:00 2001 +From e4a9748e7103c47e575459db2b6a77d14f34da2b Mon Sep 17 00:00:00 2001 From: Christian Marangi -Date: Wed, 18 Dec 2024 10:03:45 +0100 +Date: Tue, 14 Jan 2025 00:10:02 +0100 Subject: [PATCH 1/4] clk: en7523: Rework clock handling for different clock numbers @@ -12,6 +12,8 @@ clocks number in match_data and alloca clk_data based on the compatible match_data. Signed-off-by: Christian Marangi +Link: https://lore.kernel.org/r/20250113231030.6735-2-ansuelsmth@gmail.com +Signed-off-by: Stephen Boyd --- drivers/clk/clk-en7523.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) @@ -44,7 +46,7 @@ Signed-off-by: Christian Marangi } static int en7523_reset_update(struct reset_controller_dev *rcdev, -@@ -702,21 +699,24 @@ static int en7523_clk_probe(struct platf +@@ -702,13 +699,15 @@ static int en7523_clk_probe(struct platf struct clk_hw_onecell_data *clk_data; int r; @@ -58,12 +60,11 @@ Signed-off-by: Christian Marangi return -ENOMEM; - soc_data = device_get_match_data(&pdev->dev); ++ clk_data->num = soc_data->num_clocks; r = soc_data->hw_init(pdev, clk_data); if (r) return r; - -+ clk_data->num = soc_data->num_clocks; - return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data); +@@ -717,6 +716,7 @@ static int en7523_clk_probe(struct platf } static const struct en_clk_soc_data en7523_data = { diff --git a/target/linux/airoha/patches-6.6/110-02-dt-bindings-clock-drop-NUM_CLOCKS-define-for-EN7581.patch b/target/linux/airoha/patches-6.6/041-02-v6.14-dt-bindings-clock-drop-NUM_CLOCKS-define-for-EN7581.patch similarity index 69% rename from target/linux/airoha/patches-6.6/110-02-dt-bindings-clock-drop-NUM_CLOCKS-define-for-EN7581.patch rename to target/linux/airoha/patches-6.6/041-02-v6.14-dt-bindings-clock-drop-NUM_CLOCKS-define-for-EN7581.patch index e858d8b77d4c3b..5db79a47488f91 100644 --- a/target/linux/airoha/patches-6.6/110-02-dt-bindings-clock-drop-NUM_CLOCKS-define-for-EN7581.patch +++ b/target/linux/airoha/patches-6.6/041-02-v6.14-dt-bindings-clock-drop-NUM_CLOCKS-define-for-EN7581.patch @@ -1,6 +1,6 @@ -From 8fc9b68ee448d0e687d4dc52ec95bf367eb04caa Mon Sep 17 00:00:00 2001 +From 02d3b7557ce28c373ea1e925ae16ab5988284313 Mon Sep 17 00:00:00 2001 From: Christian Marangi -Date: Thu, 19 Dec 2024 13:13:37 +0100 +Date: Tue, 14 Jan 2025 00:10:03 +0100 Subject: [PATCH 2/4] dt-bindings: clock: drop NUM_CLOCKS define for EN7581 Drop NUM_CLOCKS define for EN7581 include. This is not a binding and @@ -8,6 +8,9 @@ should not be placed here. Value is derived internally in the user driver. Signed-off-by: Christian Marangi +Acked-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/20250113231030.6735-3-ansuelsmth@gmail.com +Signed-off-by: Stephen Boyd --- include/dt-bindings/clock/en7523-clk.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/target/linux/airoha/patches-6.6/110-03-dt-bindings-clock-add-ID-for-eMMC-for-EN7581.patch b/target/linux/airoha/patches-6.6/041-03-v6.14-dt-bindings-clock-add-ID-for-eMMC-for-EN7581.patch similarity index 74% rename from target/linux/airoha/patches-6.6/110-03-dt-bindings-clock-add-ID-for-eMMC-for-EN7581.patch rename to target/linux/airoha/patches-6.6/041-03-v6.14-dt-bindings-clock-add-ID-for-eMMC-for-EN7581.patch index 7bc987f4203679..a3f0c9e6fea76e 100644 --- a/target/linux/airoha/patches-6.6/110-03-dt-bindings-clock-add-ID-for-eMMC-for-EN7581.patch +++ b/target/linux/airoha/patches-6.6/041-03-v6.14-dt-bindings-clock-add-ID-for-eMMC-for-EN7581.patch @@ -1,6 +1,6 @@ -From 238436f998c551688695d26ecdcd2ea4d51190b1 Mon Sep 17 00:00:00 2001 +From 82108ad3285f58f314ad41398f44017c7dbe44de Mon Sep 17 00:00:00 2001 From: Christian Marangi -Date: Wed, 11 Dec 2024 12:22:37 +0100 +Date: Tue, 14 Jan 2025 00:10:04 +0100 Subject: [PATCH 3/4] dt-bindings: clock: add ID for eMMC for EN7581 Add ID for eMMC for EN7581. This is to control clock selection of eMMC @@ -8,6 +8,8 @@ between 200MHz and 150MHz. Signed-off-by: Christian Marangi Acked-by: Conor Dooley +Link: https://lore.kernel.org/r/20250113231030.6735-4-ansuelsmth@gmail.com +Signed-off-by: Stephen Boyd --- include/dt-bindings/clock/en7523-clk.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/linux/airoha/patches-6.6/110-04-clk-en7523-Add-clock-for-eMMC-for-EN7581.patch b/target/linux/airoha/patches-6.6/041-04-v6.14-clk-en7523-Add-clock-for-eMMC-for-EN7581.patch similarity index 84% rename from target/linux/airoha/patches-6.6/110-04-clk-en7523-Add-clock-for-eMMC-for-EN7581.patch rename to target/linux/airoha/patches-6.6/041-04-v6.14-clk-en7523-Add-clock-for-eMMC-for-EN7581.patch index 64d53391769ab1..6c8a3300bee185 100644 --- a/target/linux/airoha/patches-6.6/110-04-clk-en7523-Add-clock-for-eMMC-for-EN7581.patch +++ b/target/linux/airoha/patches-6.6/041-04-v6.14-clk-en7523-Add-clock-for-eMMC-for-EN7581.patch @@ -1,12 +1,14 @@ -From 4fc22765b3888cf6575015b904718bfd36d1f49c Mon Sep 17 00:00:00 2001 +From bfe257f9780d8f77045a7da6ec959ee0659d2f98 Mon Sep 17 00:00:00 2001 From: Christian Marangi -Date: Wed, 11 Dec 2024 12:22:38 +0100 +Date: Tue, 14 Jan 2025 00:10:05 +0100 Subject: [PATCH 4/4] clk: en7523: Add clock for eMMC for EN7581 Add clock for eMMC for EN7581. This is used to give info of the current eMMC source clock and to switch it from 200MHz or 150MHz. Signed-off-by: Christian Marangi +Link: https://lore.kernel.org/r/20250113231030.6735-5-ansuelsmth@gmail.com +Signed-off-by: Stephen Boyd --- drivers/clk/clk-en7523.c | 10 ++++++++++ 1 file changed, 10 insertions(+) From a5eb5ee1a633f67ae44e43f211396a9f734268be Mon Sep 17 00:00:00 2001 From: Anders Melchiorsen Date: Wed, 22 Jan 2025 21:54:57 +0100 Subject: [PATCH 426/877] ramips: restore full switch performance for USW-Flex Since commit f1c9afd80138 ("ramips: mt7621-dts: mux phy0/4 to gmac1") the USW-Flex lan1 port has been attached directly to the CPU. This improves routing performance but hinders switching. This is a generally accepted trade-off in that commit but for USW-Flex it is a questionable choice. This switch is designed to deliver PoE to remote places and using it as a router is unlikely. Meanwhile, the lan1 port is also PoE-in and will often be the uplink, carrying most of the traffic. Reverting f1c9afd80138 for USW-Flex restores full 1 Gbps switching performance on all ports. Signed-off-by: Anders Melchiorsen Link: https://github.com/openwrt/openwrt/pull/17703 Signed-off-by: Robert Marko (cherry picked from commit 62872f8bfd5c8bc80bb014417c6ed8057bbeb773) --- .../linux/ramips/dts/mt7621_ubnt_usw-flex.dts | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_ubnt_usw-flex.dts b/target/linux/ramips/dts/mt7621_ubnt_usw-flex.dts index f2fb48cac2b2cb..f548f1f9b786ea 100644 --- a/target/linux/ramips/dts/mt7621_ubnt_usw-flex.dts +++ b/target/linux/ramips/dts/mt7621_ubnt_usw-flex.dts @@ -64,19 +64,6 @@ label = "dsa"; }; -&gmac1 { - status = "okay"; - label = "lan1"; - phy-handle = <ðphy4>; - - nvmem-cells = <&macaddr_eeprom>; - nvmem-cell-names = "mac-address"; -}; - -ðphy4 { - /delete-property/ interrupts; -}; - &switch0 { ports { port@0 { @@ -98,6 +85,11 @@ status = "okay"; label = "lan2"; }; + + port@4 { + status = "okay"; + label = "lan1"; + }; }; }; From d0289daa69fd5063cefc8665b38375040ee69226 Mon Sep 17 00:00:00 2001 From: Thomas Richard Date: Mon, 27 Jan 2025 14:02:28 +0100 Subject: [PATCH 427/877] stm32: enable CONFIG_SMSC_PHY The STM32MP135F-DK board uses the LAN8742 PHY. Enable CONFIG_SMSC_PHY to have full PHY support. Signed-off-by: Thomas Richard Link: https://github.com/openwrt/openwrt/pull/17745 Signed-off-by: Robert Marko (cherry picked from commit d981f28f762a559ae50386fa089b050aaaa78555) --- target/linux/stm32/stm32mp1/config-6.6 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/stm32/stm32mp1/config-6.6 b/target/linux/stm32/stm32mp1/config-6.6 index e19abcc7dcc4be..0428216ecbb0fc 100644 --- a/target/linux/stm32/stm32mp1/config-6.6 +++ b/target/linux/stm32/stm32mp1/config-6.6 @@ -423,6 +423,7 @@ CONFIG_SGL_ALLOC=y CONFIG_SG_POOL=y CONFIG_SMP=y CONFIG_SMP_ON_UP=y +CONFIG_SMSC_PHY=y CONFIG_SOCK_RX_QUEUE_MAPPING=y CONFIG_SOC_BUS=y CONFIG_SOFTIRQ_ON_OWN_STACK=y From 4e70887d43dbf6b5e013b6755d61e66e37eba41c Mon Sep 17 00:00:00 2001 From: Hannu Nyman Date: Sun, 10 Nov 2024 15:57:01 +0200 Subject: [PATCH 428/877] wolfssl: Adjust version for apk Adjust wolfssl version for apk by removing the "-stable" from the OpenWrt version, although it is still needed for upstream download archive name. Define PKG_BUILD_DIR accordingly. Utilize new short version to simplify ABI_VERSION calculation. Signed-off-by: Hannu Nyman Link: https://github.com/openwrt/openwrt/pull/16906 Signed-off-by: Christian Marangi (cherry picked from commit be952e98bc1d768a0da5b84e59a6e7c04a1cdab8) --- package/libs/wolfssl/Makefile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/package/libs/wolfssl/Makefile b/package/libs/wolfssl/Makefile index bac4a8ef52bc83..56daacc71bd03e 100644 --- a/package/libs/wolfssl/Makefile +++ b/package/libs/wolfssl/Makefile @@ -8,13 +8,16 @@ include $(TOPDIR)/rules.mk PKG_NAME:=wolfssl -PKG_VERSION:=5.7.2-stable +PKG_VERSION:=5.7.2 +PKG_REAL_VERSION:=$(PKG_VERSION)-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_SOURCE:=$(PKG_NAME)-$(PKG_REAL_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/wolfSSL/wolfssl/archive/v$(PKG_REAL_VERSION) PKG_HASH:=0f2ed82e345b833242705bbc4b08a2a2037a33f7bf9c610efae6464f6b10e305 +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_REAL_VERSION) + PKG_FIXUP:=libtool libtool-abiver PKG_INSTALL:=1 PKG_BUILD_FLAGS:=no-mips16 lto @@ -40,7 +43,7 @@ PKG_CONFIG_DEPENDS:=\ CONFIG_WOLFSSL_HAS_TLSV13 \ CONFIG_WOLFSSL_HAS_WPAS -PKG_ABI_VERSION:=$(patsubst %-stable,%,$(PKG_VERSION)).$(call version_abbrev,$(call confvar,$(PKG_CONFIG_DEPENDS))) +PKG_ABI_VERSION:=$(PKG_VERSION).$(call version_abbrev,$(call confvar,$(PKG_CONFIG_DEPENDS))) PKG_CONFIG_DEPENDS+=\ CONFIG_PACKAGE_libwolfssl-benchmark \ From 6f7bbd03954e8aa79484b7c5b727dd814bfee78d Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Mon, 27 Jan 2025 01:37:39 +0100 Subject: [PATCH 429/877] wolfssl: Update to version 5.7.6 This fixes multiple bugs and also minor security problems. Changelog: https://github.com/wolfSSL/wolfssl/releases/tag/v5.7.4-stable https://github.com/wolfSSL/wolfssl/releases/tag/v5.7.6-stable The package size increases: 525814 bin/packages/mips_24kc/base/libwolfssl5.7.2.e624513f-5.7.2-r1.apk 549408 bin/packages/mips_24kc/base/libwolfssl5.7.6.e624513f-5.7.6-r1.apk Link: https://github.com/openwrt/openwrt/pull/17742 Signed-off-by: Hauke Mehrtens (cherry picked from commit 0a7e92c2442bc09eec3875aae21996d9a5430806) --- package/libs/wolfssl/Makefile | 4 ++-- .../libs/wolfssl/patches/100-disable-hardening-check.patch | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package/libs/wolfssl/Makefile b/package/libs/wolfssl/Makefile index 56daacc71bd03e..ee6baefddcd462 100644 --- a/package/libs/wolfssl/Makefile +++ b/package/libs/wolfssl/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=wolfssl -PKG_VERSION:=5.7.2 +PKG_VERSION:=5.7.6 PKG_REAL_VERSION:=$(PKG_VERSION)-stable PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_REAL_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/wolfSSL/wolfssl/archive/v$(PKG_REAL_VERSION) -PKG_HASH:=0f2ed82e345b833242705bbc4b08a2a2037a33f7bf9c610efae6464f6b10e305 +PKG_HASH:=52b1e439e30d1ed8162a16308a8525a862183b67aa30373b11166ecbab000d63 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_REAL_VERSION) diff --git a/package/libs/wolfssl/patches/100-disable-hardening-check.patch b/package/libs/wolfssl/patches/100-disable-hardening-check.patch index 174e657982b3fe..ab695d391d83c9 100644 --- a/package/libs/wolfssl/patches/100-disable-hardening-check.patch +++ b/package/libs/wolfssl/patches/100-disable-hardening-check.patch @@ -1,6 +1,6 @@ --- a/wolfssl/wolfcrypt/settings.h +++ b/wolfssl/wolfcrypt/settings.h -@@ -3046,7 +3046,7 @@ extern void uITRON4_free(void *p) ; +@@ -3722,7 +3722,7 @@ extern void uITRON4_free(void *p) ; /* warning for not using harden build options (default with ./configure) */ /* do not warn if big integer support is disabled */ From 50cb934142e3f6668dc8ebb8a7e54e6b17e14bd1 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Mon, 27 Jan 2025 01:09:33 +0100 Subject: [PATCH 430/877] apm821xx: NETGEAR WNDR4700: Fix compat version The definition for the netgear_wndr4700 had two different DEVICE_COMPAT_VERSION definitions. In commit 5815884c3a2 ("apm821xx: migrate to DSA"), an additional DEVICE_COMPAT_VERSION := 3.0 attribute was added to the device definition. The old one with version 2.0 stayed and was defined later overwriting the new one. Replace the old version 2.0 with the new version 3.0 Fixes: 5815884c3a2a ("apm821xx: migrate to DSA") Link: https://forum.openwrt.org/t/openwrt-24-10-0-rc6-sixth-release-candidate/222466/43 Link: https://github.com/openwrt/openwrt/pull/17741 Signed-off-by: Hauke Mehrtens (cherry picked from commit dab52c00d712a421d6e61eebc51359e5d38ad347) --- target/linux/apm821xx/image/nand.mk | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/target/linux/apm821xx/image/nand.mk b/target/linux/apm821xx/image/nand.mk index 92bdaa87d03372..7b3945183e5baf 100644 --- a/target/linux/apm821xx/image/nand.mk +++ b/target/linux/apm821xx/image/nand.mk @@ -89,9 +89,6 @@ endef TARGET_DEVICES += netgear_wndap660 define Device/netgear_wndr4700 - DEVICE_COMPAT_VERSION := 3.0 - DEVICE_COMPAT_MESSAGE := Network swconfig configuration cannot be upgraded to DSA. \ - Upgrade via sysupgrade mechanism is not possible. DEVICE_VENDOR := NETGEAR DEVICE_MODEL := Centria N900 WNDR4700 DEVICE_ALT0_VENDOR := NETGEAR @@ -123,8 +120,9 @@ define Device/netgear_wndr4700 NETGEAR_HW_ID := 29763875+128+256 UBINIZE_OPTS := -E 5 SUPPORTED_DEVICES += wndr4700 - DEVICE_COMPAT_VERSION := 2.0 + DEVICE_COMPAT_VERSION := 3.0 DEVICE_COMPAT_MESSAGE := kernel and ubi partitions had to be resized. \ + Network swconfig configuration cannot be upgraded to DSA. \ Upgrade via sysupgrade mechanism is not possible. endef TARGET_DEVICES += netgear_wndr4700 From daef29c75d284a31ca5d957e64b3bf4629e7d049 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Mon, 27 Jan 2025 16:12:23 +0100 Subject: [PATCH 431/877] dnsmasq: add fix related to DNSSEC verification from upstream MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To find the DS record for a given zone the parent zone's nameserver must be queried and not the nameserver for the zone. Otherwise DNSSEC verification for unsigned delegations breaks. Signed-off-by: Uwe Kleine-König Link: https://patchwork.ozlabs.org/project/openwrt/patch/20250127151223.1420006-1-uwe+openwrt@kleine-koenig.org/ Signed-off-by: Hauke Mehrtens (cherry picked from commit 6dc0f0c50cf1072ec3751c0fb1fc152a0a86487d) --- package/network/services/dnsmasq/Makefile | 2 +- ...0003-Handle-DS-queries-to-auth-zones.patch | 98 +++++++++++++++++++ 2 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 package/network/services/dnsmasq/patches/0003-Handle-DS-queries-to-auth-zones.patch diff --git a/package/network/services/dnsmasq/Makefile b/package/network/services/dnsmasq/Makefile index 0a597c03ce405b..47a5ae54ae7f5c 100644 --- a/package/network/services/dnsmasq/Makefile +++ b/package/network/services/dnsmasq/Makefile @@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=dnsmasq PKG_UPSTREAM_VERSION:=2.90 PKG_VERSION:=$(subst test,~~test,$(subst rc,~rc,$(PKG_UPSTREAM_VERSION))) -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_SOURCE:=$(PKG_NAME)-$(PKG_UPSTREAM_VERSION).tar.xz PKG_SOURCE_URL:=https://thekelleys.org.uk/dnsmasq/ diff --git a/package/network/services/dnsmasq/patches/0003-Handle-DS-queries-to-auth-zones.patch b/package/network/services/dnsmasq/patches/0003-Handle-DS-queries-to-auth-zones.patch new file mode 100644 index 00000000000000..bd7270c904cc10 --- /dev/null +++ b/package/network/services/dnsmasq/patches/0003-Handle-DS-queries-to-auth-zones.patch @@ -0,0 +1,98 @@ +From 8ce27433f8b2e17c557cb55e4f16941d309deeac Mon Sep 17 00:00:00 2001 +From: Simon Kelley +Date: Fri, 17 Jan 2025 17:49:29 +0000 +Subject: [PATCH] Handle DS queries to auth zones. +Origin: upstream, v2.91test8 + +When dnsmasq is configured to act as an authoritative server and has +an authoritative zone configured, and recieves a query for +that zone _as_forwarder_ it answers the query directly rather +than forwarding it. This doesn't affect the answer, but it +saves dnsmasq forwarding the query to the recusor upstream, +whch then bounces it back to dnsmasq in auth mode. The +exception should be when the query is for the root of zone, for a DS +RR. The answer to that has to come from the parent, via the +recursor, and will typically be a proof-of-nonexistence since +dnsmasq doesn't support signed zones. This patch suppresses +local answers and forces forwarding to the upstream recursor +for such queries. It stops breakage when a DNSSEC validating +client makes queries to dnsmasq acting as forwarder for a zone +for which it is authoritative. + +[ukleinek: drop changes to CHANGELOG to prevent conflicts] +--- + src/forward.c | 52 +++++++++++++++++++++++++++++++++++++-------------- + 1 file changed, 38 insertions(+), 14 deletions(-) + +--- a/src/forward.c ++++ b/src/forward.c +@@ -1744,15 +1744,27 @@ void receive_query(struct listener *list + #endif + + #ifdef HAVE_AUTH +- /* find queries for zones we're authoritative for, and answer them directly */ ++ /* Find queries for zones we're authoritative for, and answer them directly. ++ The exception to this is DS queries for the zone route. They ++ have to come from the parent zone. Since dnsmasq's auth server ++ can't do DNSSEC, the zone will be unsigned, and anything using ++ dnsmasq as a forwarder and doing validation will be expecting to ++ see the proof of non-existence from the parent. */ + if (!auth_dns && !option_bool(OPT_LOCALISE)) + for (zone = daemon->auth_zones; zone; zone = zone->next) +- if (in_zone(zone, daemon->namebuff, NULL)) +- { +- auth_dns = 1; +- local_auth = 1; +- break; +- } ++ { ++ char *cut; ++ ++ if (in_zone(zone, daemon->namebuff, &cut)) ++ { ++ if (type != T_DS || cut) ++ { ++ auth_dns = 1; ++ local_auth = 1; ++ } ++ break; ++ } ++ } + #endif + + #ifdef HAVE_LOOP +@@ -2268,15 +2280,27 @@ unsigned char *tcp_request(int confd, ti + &peer_addr, auth_dns ? "auth" : "query", qtype); + + #ifdef HAVE_AUTH +- /* find queries for zones we're authoritative for, and answer them directly */ ++ /* Find queries for zones we're authoritative for, and answer them directly. ++ The exception to this is DS queries for the zone route. They ++ have to come from the parent zone. Since dnsmasq's auth server ++ can't do DNSSEC, the zone will be unsigned, and anything using ++ dnsmasq as a forwarder and doing validation will be expecting to ++ see the proof of non-existence from the parent. */ + if (!auth_dns && !option_bool(OPT_LOCALISE)) + for (zone = daemon->auth_zones; zone; zone = zone->next) +- if (in_zone(zone, daemon->namebuff, NULL)) +- { +- auth_dns = 1; +- local_auth = 1; +- break; +- } ++ { ++ char *cut; ++ ++ if (in_zone(zone, daemon->namebuff, &cut)) ++ { ++ if (qtype != T_DS || cut) ++ { ++ auth_dns = 1; ++ local_auth = 1; ++ } ++ break; ++ } ++ } + #endif + } + } From 6cbfbb18531e9e283ee4e50b14d53a27625fe518 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Tue, 28 Jan 2025 00:06:47 +0100 Subject: [PATCH 432/877] OpenWrt v24.10.0-rc7: 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 581de056c41e3e..1fca5eb2e55445 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git;openwrt-24.10 -src-git luci https://git.openwrt.org/project/luci.git;openwrt-24.10 -src-git routing https://git.openwrt.org/feed/routing.git;openwrt-24.10 -src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-24.10 +src-git packages https://git.openwrt.org/feed/packages.git^cf301cd92c4c501271cf6c1caf19eabef3ce0c09 +src-git luci https://git.openwrt.org/project/luci.git^bdf1db5fb536b155d4b035f3bbf9590782e41cf7 +src-git routing https://git.openwrt.org/feed/routing.git^e87b55c6a642947ad7e24cd5054a637df63d5dbe +src-git telephony https://git.openwrt.org/feed/telephony.git^fd605af7143165a2490681ec1752f259873b9147 diff --git a/include/version.mk b/include/version.mk index a6ebe587797707..91fc63dfbd7e1a 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),24.10-SNAPSHOT) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),24.10.0-rc7) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION)) +VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r28417-daef29c75d) VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO)) -VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/24.10-SNAPSHOT) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/24.10.0-rc7) 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 80db993d46b837..ec94880c57e4d7 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/24.10-SNAPSHOT" + default "https://downloads.openwrt.org/releases/24.10.0-rc7" 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..058b842db70aee --- /dev/null +++ b/version @@ -0,0 +1 @@ +r28417-daef29c75d diff --git a/version.date b/version.date new file mode 100644 index 00000000000000..31766eae0c5a51 --- /dev/null +++ b/version.date @@ -0,0 +1 @@ +1738018409 From c08ba0f7126b60570a81ef86500d9f83eeb8dc8f Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Tue, 28 Jan 2025 00:06:50 +0100 Subject: [PATCH 433/877] OpenWrt v24.10.0-rc7: 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 1fca5eb2e55445..581de056c41e3e 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git^cf301cd92c4c501271cf6c1caf19eabef3ce0c09 -src-git luci https://git.openwrt.org/project/luci.git^bdf1db5fb536b155d4b035f3bbf9590782e41cf7 -src-git routing https://git.openwrt.org/feed/routing.git^e87b55c6a642947ad7e24cd5054a637df63d5dbe -src-git telephony https://git.openwrt.org/feed/telephony.git^fd605af7143165a2490681ec1752f259873b9147 +src-git packages https://git.openwrt.org/feed/packages.git;openwrt-24.10 +src-git luci https://git.openwrt.org/project/luci.git;openwrt-24.10 +src-git routing https://git.openwrt.org/feed/routing.git;openwrt-24.10 +src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-24.10 diff --git a/include/version.mk b/include/version.mk index 91fc63dfbd7e1a..a6ebe587797707 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),24.10.0-rc7) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),24.10-SNAPSHOT) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r28417-daef29c75d) +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/24.10.0-rc7) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/24.10-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 ec94880c57e4d7..80db993d46b837 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/24.10.0-rc7" + default "https://downloads.openwrt.org/releases/24.10-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 058b842db70aee..00000000000000 --- a/version +++ /dev/null @@ -1 +0,0 @@ -r28417-daef29c75d diff --git a/version.date b/version.date deleted file mode 100644 index 31766eae0c5a51..00000000000000 --- a/version.date +++ /dev/null @@ -1 +0,0 @@ -1738018409 From e2c2a6ed7f87f494ba23d130de00638028c0c71c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Tue, 28 Jan 2025 08:28:01 +0100 Subject: [PATCH 434/877] bmips: shg2500: add missing led controller cells MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes the following DT warnings: ../dts/bcm63168-sercomm-shg2500.dts:76.4-14: Warning (reg_format): /ubus/spi@10001000/led-controller@1/led@1:reg: property has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1) ../dts/bcm63168-sercomm-shg2500.dts:75.9-78.5: Warning (avoid_default_addr_size): /ubus/spi@10001000/led-controller@1/led@1: Relying on default #address-cells value ../dts/bcm63168-sercomm-shg2500.dts:75.9-78.5: Warning (avoid_default_addr_size): /ubus/spi@10001000/led-controller@1/led@1: Relying on default #size-cells value Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit fbe0bd5f6453a61fab871bee56883afc5c6308cf) --- target/linux/bmips/dts/bcm63168-sercomm-shg2500.dts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/linux/bmips/dts/bcm63168-sercomm-shg2500.dts b/target/linux/bmips/dts/bcm63168-sercomm-shg2500.dts index 7ea76bebc31424..3f9ca000cc11c1 100644 --- a/target/linux/bmips/dts/bcm63168-sercomm-shg2500.dts +++ b/target/linux/bmips/dts/bcm63168-sercomm-shg2500.dts @@ -68,6 +68,8 @@ status = "okay"; led-controller@1 { + #address-cells = <1>; + #size-cells = <0>; compatible = "sercomm,msp430-leds"; reg = <1>; spi-max-frequency = <500000>; From 1a75172721a1c917312105e9e0449fa431c0154c Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 1 Jan 2025 16:06:10 +0800 Subject: [PATCH 435/877] ramips: pinctrl: allow mux SDXC pins for mt76x8 The mt76x8 SDXC pin register definition is incompatible with the mtmips generic pinctrl driver structure. This hack allows us to mux the SDXC IO to different pin groups in device tree. Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17446 (cherry picked from commit 05ec3b50a8e673786dda0224b23f18b5d96a4a65) Link: https://github.com/openwrt/openwrt/pull/17754 Signed-off-by: Hauke Mehrtens --- ...tmips-allow-mux-SDXC-pins-for-mt76x8.patch | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 target/linux/ramips/patches-6.6/809-pinctrl-mtmips-allow-mux-SDXC-pins-for-mt76x8.patch diff --git a/target/linux/ramips/patches-6.6/809-pinctrl-mtmips-allow-mux-SDXC-pins-for-mt76x8.patch b/target/linux/ramips/patches-6.6/809-pinctrl-mtmips-allow-mux-SDXC-pins-for-mt76x8.patch new file mode 100644 index 00000000000000..69dcd7fb2c82c7 --- /dev/null +++ b/target/linux/ramips/patches-6.6/809-pinctrl-mtmips-allow-mux-SDXC-pins-for-mt76x8.patch @@ -0,0 +1,105 @@ +From: Shiji Yang +Date: Wed, 1 Jan 2025 13:30:11 +0800 +Subject: [PATCH] pinctrl: mtmips: allow mux SDXC pins for mt76x8 + +This is a hack to supprot two types of mt76x8 SDXC pinmaps: + +a) Use ethernet phy pins as SDXC IO. + +&pinctrl { + ephy-digital; + + sdxc_iot_mode: sdxc_iot_mode { + esd { + groups = "esd"; + function = "iot"; + }; + + sdxc { + groups = "sdmode"; + function = "sdxc"; + }; + }; +}; + +b) Use I2S/I2C/GPIO0/UART1 pins as SDXC IO. + +&pinctrl { + ephy-analog; + + sdxc_router_mode: sdxc_router_mode { + groups = "esd", "gpio", "i2c", "i2s", "sdmode", "uart1"; + function = "gpio"; + }; +}; + +Signed-off-by: Shiji Yang +--- + drivers/pinctrl/mediatek/pinctrl-mt76x8.c | 24 ++++++++++++++++++++++- + 1 file changed, 22 insertions(+), 1 deletion(-) + +--- a/drivers/pinctrl/mediatek/pinctrl-mt76x8.c ++++ b/drivers/pinctrl/mediatek/pinctrl-mt76x8.c +@@ -1,10 +1,13 @@ + // SPDX-License-Identifier: GPL-2.0-only + ++#include + #include + #include + #include + #include "pinctrl-mtmips.h" + ++#define SYSC_REG_AGPIO_CFG 0x3c ++ + #define MT76X8_GPIO_MODE_MASK 0x3 + + #define MT76X8_GPIO_MODE_P4LED_KN 58 +@@ -26,6 +29,7 @@ + #define MT76X8_GPIO_MODE_I2C 20 + #define MT76X8_GPIO_MODE_REFCLK 18 + #define MT76X8_GPIO_MODE_PERST 16 ++#define MT76X8_GPIO_MODE_ESD 15 + #define MT76X8_GPIO_MODE_WDT 14 + #define MT76X8_GPIO_MODE_SPI 12 + #define MT76X8_GPIO_MODE_SDMODE 10 +@@ -74,6 +78,12 @@ static struct mtmips_pmx_func refclk_grp + static struct mtmips_pmx_func perst_grp[] = { FUNC("perst", 0, 36, 1) }; + static struct mtmips_pmx_func wdt_grp[] = { FUNC("wdt", 0, 38, 1) }; + static struct mtmips_pmx_func spi_grp[] = { FUNC("spi", 0, 7, 4) }; ++/* ++ * "esd" (Ethernet SDXC) group supports two mode: ++ * "gpio" - SDXC mux to I2S/I2C/GPIO0/UART1 pins with "gpio" mode ++ * "iot" - SDXC mux to EPHY pins, eth p1-p4 pad must be set to "digital" ++ */ ++static struct mtmips_pmx_func esd_grp[] = { FUNC("iot", 0, 47, 1) }; + + static struct mtmips_pmx_func sd_mode_grp[] = { + FUNC("jtag", 3, 22, 8), +@@ -216,6 +226,7 @@ static struct mtmips_pmx_group mt76x8_pi + GRP("perst", perst_grp, 1, MT76X8_GPIO_MODE_PERST), + GRP("wdt", wdt_grp, 1, MT76X8_GPIO_MODE_WDT), + GRP("spi", spi_grp, 1, MT76X8_GPIO_MODE_SPI), ++ GRP("esd", esd_grp, 1, MT76X8_GPIO_MODE_ESD), + GRP_G("sdmode", sd_mode_grp, MT76X8_GPIO_MODE_MASK, + 1, MT76X8_GPIO_MODE_SDMODE), + GRP_G("uart0", uart0_grp, MT76X8_GPIO_MODE_MASK, +@@ -257,7 +268,18 @@ static struct mtmips_pmx_group mt76x8_pi + + static int mt76x8_pinctrl_probe(struct platform_device *pdev) + { +- return mtmips_pinctrl_init(pdev, mt76x8_pinmux_data); ++ int ret; ++ ++ ret = mtmips_pinctrl_init(pdev, mt76x8_pinmux_data); ++ if (ret) ++ return ret; ++ ++ if (of_property_present(pdev->dev.of_node, "ephy-analog")) ++ rt_sysc_m32(0xf << 17, 0, SYSC_REG_AGPIO_CFG); ++ else if (of_property_present(pdev->dev.of_node, "ephy-digital")) ++ rt_sysc_m32(0xf << 17, 0xf << 17, SYSC_REG_AGPIO_CFG); ++ ++ return ret; + } + + static const struct of_device_id mt76x8_pinctrl_match[] = { From 7a916c75e8f5625f76fd22d41622333b0524b4b8 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Wed, 29 Jan 2025 23:37:34 +0100 Subject: [PATCH 436/877] x86: Add kmod-drm-i915 as default package Add kmod-drm-i915 to the default packages. It was build into the kernel before and is now build as a kernel module. Fixes: 77cfe8fd15d3 ("x86: make i915 as a kmod with required firmware") Link: https://github.com/openwrt/openwrt/pull/17781 Signed-off-by: Robert Marko (cherry picked from commit 8390599c9a29dbb0019447df9086cb8667bfd3d7) Link: https://github.com/openwrt/openwrt/pull/17792 Signed-off-by: Hauke Mehrtens --- target/linux/x86/image/64.mk | 2 +- target/linux/x86/image/generic.mk | 3 ++- target/linux/x86/image/legacy.mk | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/target/linux/x86/image/64.mk b/target/linux/x86/image/64.mk index 7bc79006d348bc..88c0248b58ffd4 100644 --- a/target/linux/x86/image/64.mk +++ b/target/linux/x86/image/64.mk @@ -4,7 +4,7 @@ define Device/generic DEVICE_PACKAGES += \ kmod-amazon-ena kmod-amd-xgbe kmod-bnx2 kmod-dwmac-intel kmod-e1000e kmod-e1000 \ kmod-forcedeth kmod-fs-vfat kmod-igb kmod-igc kmod-ixgbe kmod-r8169 \ - kmod-tg3 + kmod-tg3 kmod-drm-i915 GRUB2_VARIANT := generic endef TARGET_DEVICES += generic diff --git a/target/linux/x86/image/generic.mk b/target/linux/x86/image/generic.mk index e9545fbf319123..f8dd15ed3696fb 100644 --- a/target/linux/x86/image/generic.mk +++ b/target/linux/x86/image/generic.mk @@ -3,7 +3,8 @@ define Device/generic DEVICE_MODEL := x86 DEVICE_PACKAGES += kmod-3c59x kmod-8139too kmod-e100 kmod-e1000 kmod-natsemi \ kmod-ne2k-pci kmod-pcnet32 kmod-r8169 kmod-sis900 kmod-tg3 \ - kmod-via-rhine kmod-via-velocity kmod-forcedeth kmod-fs-vfat + kmod-via-rhine kmod-via-velocity kmod-forcedeth kmod-fs-vfat \ + kmod-drm-i915 GRUB2_VARIANT := generic endef TARGET_DEVICES += generic diff --git a/target/linux/x86/image/legacy.mk b/target/linux/x86/image/legacy.mk index 6c0d8e78f9ab57..cf65a542f000e1 100644 --- a/target/linux/x86/image/legacy.mk +++ b/target/linux/x86/image/legacy.mk @@ -3,7 +3,8 @@ define Device/generic DEVICE_MODEL := x86/legacy DEVICE_PACKAGES += kmod-3c59x kmod-8139too kmod-e100 kmod-e1000 \ kmod-natsemi kmod-ne2k-pci kmod-pcnet32 kmod-r8169 kmod-sis900 \ - kmod-tg3 kmod-via-rhine kmod-via-velocity kmod-forcedeth + kmod-tg3 kmod-via-rhine kmod-via-velocity kmod-forcedeth \ + kmod-drm-i915 GRUB2_VARIANT := legacy endef TARGET_DEVICES += generic From 81db3077483388ec8fa7be441e34756438678f78 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Thu, 30 Jan 2025 05:49:43 +0000 Subject: [PATCH 437/877] generic: net: phy: realtek: work-around hang on SerDes setup On some but not all devices using the RTL8221B 2.5GBit/s PHY the SerDes setup sequence may hang under some circumstances (eg. <2500M link partner present during boot). RTL8221B-VB-CG 2.5Gbps PHY (C45) mdio-bus:01: rtl822xb_config_init failed: -110 Work-around the issue by performing a hardware reset and subsequent retry of the SerDes setup, which seems to always succeed. Doing this requires moving ALDPS setup to config_init (which is anyway the better place for that) as it otherwise doesn't survive the reset. Also disable listening on MDIO address 0 which may be used by other PHYs despite being spec'ed as "broadcast address", as bus activity on address 0 may otherwise confuse the RealTek PHY for good reasons. Tested-by: Luis Mita Signed-off-by: Daniel Golle (cherry picked from commit c87a767801ef375feadb0a5c41d5a674ad3a7d2c) Link: https://github.com/openwrt/openwrt/pull/17790 Signed-off-by: Hauke Mehrtens --- ...ealtek-introduce-rtl822x_aldps_probe.patch | 104 ------------------ .../720-04-net-phy-realtek-setup-aldps.patch | 42 +++++++ ...tek-detect-early-version-of-RTL8221B.patch | 2 +- ...ealtek-support-interrupt-of-RTL8221B.patch | 18 +-- ...ealtek-mark-existing-MMDs-as-present.patch | 2 +- ...hy-realtek-work-around-broken-serdes.patch | 58 ++++++++++ ...t-phy-realtek-disable-MDIO-broadcast.patch | 27 +++++ 7 files changed, 138 insertions(+), 115 deletions(-) delete mode 100644 target/linux/generic/pending-6.6/720-04-net-phy-realtek-introduce-rtl822x_aldps_probe.patch create mode 100644 target/linux/generic/pending-6.6/720-04-net-phy-realtek-setup-aldps.patch create mode 100644 target/linux/generic/pending-6.6/720-08-net-phy-realtek-work-around-broken-serdes.patch create mode 100644 target/linux/generic/pending-6.6/720-09-net-phy-realtek-disable-MDIO-broadcast.patch diff --git a/target/linux/generic/pending-6.6/720-04-net-phy-realtek-introduce-rtl822x_aldps_probe.patch b/target/linux/generic/pending-6.6/720-04-net-phy-realtek-introduce-rtl822x_aldps_probe.patch deleted file mode 100644 index 6610af12c35132..00000000000000 --- a/target/linux/generic/pending-6.6/720-04-net-phy-realtek-introduce-rtl822x_aldps_probe.patch +++ /dev/null @@ -1,104 +0,0 @@ -From 9155098547fb1172d4fa536f3f6bc9d42f59d08c Mon Sep 17 00:00:00 2001 -From: Daniel Golle -Date: Sat, 22 Apr 2023 03:26:01 +0100 -Subject: [PATCH] net: phy: realtek: setup ALDPS on RTL822x - -Setup Link Down Power Saving Mode according the DTS property -just like for RTL821x 1GE PHYs. - -Signed-off-by: Daniel Golle ---- - drivers/net/phy/realtek/realtek_main.c | 11 +++++++++++ - 1 file changed, 11 insertions(+) - ---- a/drivers/net/phy/realtek/realtek_main.c -+++ b/drivers/net/phy/realtek/realtek_main.c -@@ -82,6 +82,10 @@ - - #define RTL822X_VND2_GANLPAR 0xa414 - -+#define RTL8221B_PHYCR1 0xa430 -+#define RTL8221B_PHYCR1_ALDPS_EN BIT(2) -+#define RTL8221B_PHYCR1_ALDPS_XTAL_OFF_EN BIT(12) -+ - #define RTL8366RB_POWER_SAVE 0x15 - #define RTL8366RB_POWER_SAVE_ON BIT(12) - -@@ -1207,6 +1211,25 @@ static int rtl8251b_c45_match_phy_device - return rtlgen_is_c45_match(phydev, RTL_8251B, true); - } - -+static int rtl822x_aldps_probe(struct phy_device *phydev) -+{ -+ struct device *dev = &phydev->mdio.dev; -+ int val; -+ -+ val = phy_read_mmd(phydev, MDIO_MMD_VEND1, RTL8221B_PHYCR1); -+ if (val < 0) -+ return val; -+ -+ if (of_property_read_bool(dev->of_node, "realtek,aldps-enable")) -+ val |= RTL8221B_PHYCR1_ALDPS_EN | RTL8221B_PHYCR1_ALDPS_XTAL_OFF_EN; -+ else -+ val &= ~(RTL8221B_PHYCR1_ALDPS_EN | RTL8221B_PHYCR1_ALDPS_XTAL_OFF_EN); -+ -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, RTL8221B_PHYCR1, val); -+ -+ return rtl822x_probe(phydev); -+} -+ - static int rtlgen_resume(struct phy_device *phydev) - { - int ret = genphy_resume(phydev); -@@ -1478,6 +1501,7 @@ static struct phy_driver realtek_drvs[] - }, { - PHY_ID_MATCH_EXACT(0x001cc838), - .name = "RTL8226-CG 2.5Gbps PHY", -+ .probe = rtl822x_aldps_probe, - .soft_reset = genphy_soft_reset, - .get_features = rtl822x_get_features, - .config_aneg = rtl822x_config_aneg, -@@ -1489,6 +1513,7 @@ static struct phy_driver realtek_drvs[] - }, { - PHY_ID_MATCH_EXACT(0x001cc848), - .name = "RTL8226B-CG_RTL8221B-CG 2.5Gbps PHY", -+ .probe = rtl822x_aldps_probe, - .soft_reset = genphy_soft_reset, - .get_features = rtl822x_get_features, - .config_aneg = rtl822x_config_aneg, -@@ -1503,7 +1528,7 @@ static struct phy_driver realtek_drvs[] - .match_phy_device = rtl8221b_vb_cg_c22_match_phy_device, - .name = "RTL8221B-VB-CG 2.5Gbps PHY (C22)", - .soft_reset = genphy_soft_reset, -- .probe = rtl822x_probe, -+ .probe = rtl822x_aldps_probe, - .get_features = rtl822x_get_features, - .config_aneg = rtl822x_config_aneg, - .config_init = rtl822xb_config_init, -@@ -1517,7 +1542,7 @@ static struct phy_driver realtek_drvs[] - .match_phy_device = rtl8221b_vb_cg_c45_match_phy_device, - .name = "RTL8221B-VB-CG 2.5Gbps PHY (C45)", - .soft_reset = genphy_soft_reset, -- .probe = rtl822x_probe, -+ .probe = rtl822x_aldps_probe, - .config_init = rtl822xb_config_init, - .get_rate_matching = rtl822xb_get_rate_matching, - .get_features = rtl822x_c45_get_features, -@@ -1529,7 +1554,7 @@ static struct phy_driver realtek_drvs[] - .match_phy_device = rtl8221b_vn_cg_c22_match_phy_device, - .name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)", - .soft_reset = genphy_soft_reset, -- .probe = rtl822x_probe, -+ .probe = rtl822x_aldps_probe, - .get_features = rtl822x_get_features, - .config_aneg = rtl822x_config_aneg, - .config_init = rtl822xb_config_init, -@@ -1543,7 +1568,7 @@ static struct phy_driver realtek_drvs[] - .match_phy_device = rtl8221b_vn_cg_c45_match_phy_device, - .name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)", - .soft_reset = genphy_soft_reset, -- .probe = rtl822x_probe, -+ .probe = rtl822x_aldps_probe, - .config_init = rtl822xb_config_init, - .get_rate_matching = rtl822xb_get_rate_matching, - .get_features = rtl822x_c45_get_features, diff --git a/target/linux/generic/pending-6.6/720-04-net-phy-realtek-setup-aldps.patch b/target/linux/generic/pending-6.6/720-04-net-phy-realtek-setup-aldps.patch new file mode 100644 index 00000000000000..23b3ca893a79d9 --- /dev/null +++ b/target/linux/generic/pending-6.6/720-04-net-phy-realtek-setup-aldps.patch @@ -0,0 +1,42 @@ +From 9155098547fb1172d4fa536f3f6bc9d42f59d08c Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Sat, 22 Apr 2023 03:26:01 +0100 +Subject: [PATCH] net: phy: realtek: setup ALDPS on RTL822x + +Setup Link Down Power Saving Mode according the DTS property +just like for RTL821x 1GE PHYs. + +Signed-off-by: Daniel Golle +--- + drivers/net/phy/realtek/realtek_main.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +--- a/drivers/net/phy/realtek/realtek_main.c ++++ b/drivers/net/phy/realtek/realtek_main.c +@@ -82,6 +82,10 @@ + + #define RTL822X_VND2_GANLPAR 0xa414 + ++#define RTL8221B_PHYCR1 0xa430 ++#define RTL8221B_PHYCR1_ALDPS_EN BIT(2) ++#define RTL8221B_PHYCR1_ALDPS_XTAL_OFF_EN BIT(12) ++ + #define RTL8366RB_POWER_SAVE 0x15 + #define RTL8366RB_POWER_SAVE_ON BIT(12) + +@@ -889,6 +893,15 @@ static int rtl822xb_config_init(struct p + if (ret < 0) + return ret; + ++ if (of_property_read_bool(phydev->mdio.dev.of_node, "realtek,aldps-enable")) ++ ret = phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, RTL8221B_PHYCR1, ++ RTL8221B_PHYCR1_ALDPS_EN | RTL8221B_PHYCR1_ALDPS_XTAL_OFF_EN); ++ else ++ ret = phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, RTL8221B_PHYCR1, ++ RTL8221B_PHYCR1_ALDPS_EN | RTL8221B_PHYCR1_ALDPS_XTAL_OFF_EN); ++ if (ret < 0) ++ return ret; ++ + /* Disable SGMII AN */ + ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x7588, 0x2); + if (ret < 0) diff --git a/target/linux/generic/pending-6.6/720-05-net-phy-realtek-detect-early-version-of-RTL8221B.patch b/target/linux/generic/pending-6.6/720-05-net-phy-realtek-detect-early-version-of-RTL8221B.patch index 22c271c3eb25f9..d7fbf3a2a6cd7b 100644 --- a/target/linux/generic/pending-6.6/720-05-net-phy-realtek-detect-early-version-of-RTL8221B.patch +++ b/target/linux/generic/pending-6.6/720-05-net-phy-realtek-detect-early-version-of-RTL8221B.patch @@ -14,7 +14,7 @@ Signed-off-by: Daniel Golle Signed-off-by: Mieczyslaw Nalewaj --- a/drivers/net/phy/realtek/realtek_main.c +++ b/drivers/net/phy/realtek/realtek_main.c -@@ -1157,10 +1157,32 @@ static int rtl8226_match_phy_device(stru +@@ -1166,10 +1166,32 @@ static int rtl8226_match_phy_device(stru static int rtlgen_is_c45_match(struct phy_device *phydev, unsigned int id, bool is_c45) { diff --git a/target/linux/generic/pending-6.6/720-06-net-phy-realtek-support-interrupt-of-RTL8221B.patch b/target/linux/generic/pending-6.6/720-06-net-phy-realtek-support-interrupt-of-RTL8221B.patch index 3e9b34b8a5e864..45ca5413f30324 100644 --- a/target/linux/generic/pending-6.6/720-06-net-phy-realtek-support-interrupt-of-RTL8221B.patch +++ b/target/linux/generic/pending-6.6/720-06-net-phy-realtek-support-interrupt-of-RTL8221B.patch @@ -12,7 +12,7 @@ Signed-off-by: Jianhui Zhao --- a/drivers/net/phy/realtek/realtek_main.c +++ b/drivers/net/phy/realtek/realtek_main.c -@@ -1387,6 +1387,51 @@ static irqreturn_t rtl9000a_handle_inter +@@ -1377,6 +1377,51 @@ static irqreturn_t rtl9000a_handle_inter return IRQ_HANDLED; } @@ -64,39 +64,39 @@ Signed-off-by: Jianhui Zhao static struct phy_driver realtek_drvs[] = { { PHY_ID_MATCH_EXACT(0x00008201), -@@ -1549,6 +1594,8 @@ static struct phy_driver realtek_drvs[] +@@ -1537,6 +1582,8 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c22_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C22)", + .config_intr = rtl8221b_config_intr, + .handle_interrupt = rtl8221b_handle_interrupt, .soft_reset = genphy_soft_reset, - .probe = rtl822x_aldps_probe, + .probe = rtl822x_probe, .get_features = rtl822x_get_features, -@@ -1563,6 +1610,8 @@ static struct phy_driver realtek_drvs[] +@@ -1551,6 +1598,8 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c45_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C45)", + .config_intr = rtl8221b_config_intr, + .handle_interrupt = rtl8221b_handle_interrupt, .soft_reset = genphy_soft_reset, - .probe = rtl822x_aldps_probe, + .probe = rtl822x_probe, .config_init = rtl822xb_config_init, -@@ -1575,6 +1624,8 @@ static struct phy_driver realtek_drvs[] +@@ -1563,6 +1612,8 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c22_match_phy_device, .name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)", + .config_intr = rtl8221b_config_intr, + .handle_interrupt = rtl8221b_handle_interrupt, .soft_reset = genphy_soft_reset, - .probe = rtl822x_aldps_probe, + .probe = rtl822x_probe, .get_features = rtl822x_get_features, -@@ -1589,6 +1640,8 @@ static struct phy_driver realtek_drvs[] +@@ -1577,6 +1628,8 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c45_match_phy_device, .name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)", + .config_intr = rtl8221b_config_intr, + .handle_interrupt = rtl8221b_handle_interrupt, .soft_reset = genphy_soft_reset, - .probe = rtl822x_aldps_probe, + .probe = rtl822x_probe, .config_init = rtl822xb_config_init, diff --git a/target/linux/generic/pending-6.6/720-07-net-phy-realtek-mark-existing-MMDs-as-present.patch b/target/linux/generic/pending-6.6/720-07-net-phy-realtek-mark-existing-MMDs-as-present.patch index 1ef42e866d5d97..555e5905d3a33c 100644 --- a/target/linux/generic/pending-6.6/720-07-net-phy-realtek-mark-existing-MMDs-as-present.patch +++ b/target/linux/generic/pending-6.6/720-07-net-phy-realtek-mark-existing-MMDs-as-present.patch @@ -15,7 +15,7 @@ Signed-off-by: Daniel Golle --- a/drivers/net/phy/realtek/realtek_main.c +++ b/drivers/net/phy/realtek/realtek_main.c -@@ -1034,6 +1034,9 @@ static int rtl822x_c45_get_features(stru +@@ -1043,6 +1043,9 @@ static int rtl822x_c45_get_features(stru linkmode_set_bit(ETHTOOL_LINK_MODE_TP_BIT, phydev->supported); diff --git a/target/linux/generic/pending-6.6/720-08-net-phy-realtek-work-around-broken-serdes.patch b/target/linux/generic/pending-6.6/720-08-net-phy-realtek-work-around-broken-serdes.patch new file mode 100644 index 00000000000000..e356a0a6ee52ca --- /dev/null +++ b/target/linux/generic/pending-6.6/720-08-net-phy-realtek-work-around-broken-serdes.patch @@ -0,0 +1,58 @@ +From: Daniel Golle +Date: Thu, 30 Jan 2025 05:33:12 +0000 +Subject: [PATCH] net: phy: realtek: work around broken SerDes + +For still unknown reasons the SerDes init sequence may sometimes +time out because a self-clearing bit never clears, indicating the +PHY has entered an unrecoverable error state. + +Work-around the issue by triggering a hardware reset and retry the +setup sequence while warning the user that this has happened. +This is really more of a work-around than a fix, and should be +replaced by a better actual fix in future (hopefully). + +Signed-off-by: Daniel Golle +--- +--- a/drivers/net/phy/realtek/realtek_main.c ++++ b/drivers/net/phy/realtek/realtek_main.c +@@ -923,6 +923,22 @@ static int rtl822xb_config_init(struct p + return 0; + } + ++static int rtl822xb_config_init_war(struct phy_device *phydev) ++{ ++ int ret; ++ ++ ret = rtl822xb_config_init(phydev); ++ ++ if (ret == -ETIMEDOUT) { ++ phydev_warn(phydev, "SerDes setup timed out, retrying\n"); ++ phy_device_reset(phydev, 1); ++ phy_device_reset(phydev, 0); ++ ret = rtl822xb_config_init(phydev); ++ } ++ ++ return ret; ++} ++ + static int rtl822xb_get_rate_matching(struct phy_device *phydev, + phy_interface_t iface) + { +@@ -1605,7 +1621,7 @@ static struct phy_driver realtek_drvs[] + .handle_interrupt = rtl8221b_handle_interrupt, + .soft_reset = genphy_soft_reset, + .probe = rtl822x_probe, +- .config_init = rtl822xb_config_init, ++ .config_init = rtl822xb_config_init_war, + .get_rate_matching = rtl822xb_get_rate_matching, + .get_features = rtl822x_c45_get_features, + .config_aneg = rtl822x_c45_config_aneg, +@@ -1635,7 +1651,7 @@ static struct phy_driver realtek_drvs[] + .handle_interrupt = rtl8221b_handle_interrupt, + .soft_reset = genphy_soft_reset, + .probe = rtl822x_probe, +- .config_init = rtl822xb_config_init, ++ .config_init = rtl822xb_config_init_war, + .get_rate_matching = rtl822xb_get_rate_matching, + .get_features = rtl822x_c45_get_features, + .config_aneg = rtl822x_c45_config_aneg, diff --git a/target/linux/generic/pending-6.6/720-09-net-phy-realtek-disable-MDIO-broadcast.patch b/target/linux/generic/pending-6.6/720-09-net-phy-realtek-disable-MDIO-broadcast.patch new file mode 100644 index 00000000000000..b2d26a87806ed5 --- /dev/null +++ b/target/linux/generic/pending-6.6/720-09-net-phy-realtek-disable-MDIO-broadcast.patch @@ -0,0 +1,27 @@ +From: Daniel Golle +Date: Thu, 30 Jan 2025 05:38:31 +0000 +Subject: [PATCH] net: phy: realtek: disable MDIO broadcast + +RealTek's PHYs by default also listen on MDIO address 0 which is defined +as broadcast address. This can lead to problems if there is an actual PHY +(such as MT7981 built-in PHY) present at this address, as accessing that +PHY may then confuse the RealTek PHY. + +Disabled listening on the MDIO broadcast address to avoid such problems. + +Signed-off-by: Daniel Golle +--- +--- a/drivers/net/phy/realtek/realtek_main.c ++++ b/drivers/net/phy/realtek/realtek_main.c +@@ -849,6 +849,11 @@ static int rtl822xb_config_init(struct p + phydev->host_interfaces) || + phydev->interface == PHY_INTERFACE_MODE_SGMII; + ++ /* disable listening on MDIO broadcast address (0) */ ++ ret = phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2, 0xa430, BIT(13)); ++ if (ret < 0) ++ return ret; ++ + /* fill in possible interfaces */ + __assign_bit(PHY_INTERFACE_MODE_2500BASEX, phydev->possible_interfaces, + has_2500); From c1d5de0c59efd25ecb5922cb11e5d38b072cf993 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sat, 1 Feb 2025 05:03:50 +0000 Subject: [PATCH 438/877] mediatek: mt7622: fix SATA on BPi-R64 Two commits which made their way into Linux stable broke the SATA support on the BPi-R64. Fix this by reverting a node rename which broke DT-overlay application and import a (still pending) patch re-adding the 'syscon' compatible to the pciesys clock-controller which also contains phy-mode bits referenced by the ahci_mtk driver expecting to access them using syscon_regmap_lookup_by_phandle(). Signed-off-by: Daniel Golle (cherry picked from commit 69890e16b37d59b55ba64633522c727f957cb2fd) --- ...m64-dts-mediatek-fix-t-phy-unit-name.patch | 33 +++++++++++++++++++ ...ek-mt7622-readd-syscon-to-pciesys-no.patch | 33 +++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 target/linux/mediatek/patches-6.6/115-Revert-arm64-dts-mediatek-fix-t-phy-unit-name.patch create mode 100644 target/linux/mediatek/patches-6.6/116-arm64-dts-mediatek-mt7622-readd-syscon-to-pciesys-no.patch diff --git a/target/linux/mediatek/patches-6.6/115-Revert-arm64-dts-mediatek-fix-t-phy-unit-name.patch b/target/linux/mediatek/patches-6.6/115-Revert-arm64-dts-mediatek-fix-t-phy-unit-name.patch new file mode 100644 index 00000000000000..1d53cefd7f7fc6 --- /dev/null +++ b/target/linux/mediatek/patches-6.6/115-Revert-arm64-dts-mediatek-fix-t-phy-unit-name.patch @@ -0,0 +1,33 @@ +From 4c4baed29b168e9bf39545a945a9523ea280cb44 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Sat, 1 Feb 2025 04:24:17 +0000 +Subject: [PATCH 1/2] Revert "arm64: dts: mediatek: fix t-phy unit name" + +This reverts commit 963c3b0c47ec29b4c49c9f45965cd066f419d17f. +--- + arch/arm64/boot/dts/mediatek/mt7622.dtsi | 2 +- + arch/arm64/boot/dts/mediatek/mt7986a.dtsi | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi ++++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi +@@ -908,7 +908,7 @@ + status = "disabled"; + }; + +- sata_phy: t-phy { ++ sata_phy: t-phy@1a243000 { + compatible = "mediatek,mt7622-tphy", + "mediatek,generic-tphy-v1"; + #address-cells = <2>; +--- a/arch/arm64/boot/dts/mediatek/mt7986a.dtsi ++++ b/arch/arm64/boot/dts/mediatek/mt7986a.dtsi +@@ -428,7 +428,7 @@ + }; + }; + +- pcie_phy: t-phy { ++ pcie_phy: t-phy@11c00000 { + compatible = "mediatek,mt7986-tphy", + "mediatek,generic-tphy-v2"; + ranges; diff --git a/target/linux/mediatek/patches-6.6/116-arm64-dts-mediatek-mt7622-readd-syscon-to-pciesys-no.patch b/target/linux/mediatek/patches-6.6/116-arm64-dts-mediatek-mt7622-readd-syscon-to-pciesys-no.patch new file mode 100644 index 00000000000000..4ae72fd70ae65d --- /dev/null +++ b/target/linux/mediatek/patches-6.6/116-arm64-dts-mediatek-mt7622-readd-syscon-to-pciesys-no.patch @@ -0,0 +1,33 @@ +From 98bc223d174c7f544e8f6c4f0caa8fa144f2f4dc Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Fri, 28 Jun 2024 12:55:40 +0200 +Subject: [PATCH 2/2] arm64: dts: mediatek: mt7622: readd syscon to pciesys + node + +Sata node reference the pciesys with the property mediatek,phy-node +and that is used as a syscon to access the pciesys regs. + +Readd the syscon compatible to pciesys node to restore correct +functionality of the SATA interface. + +Fixes: 3ba5a6159434 ("arm64: dts: mediatek: mt7622: fix clock controllers") +Reported-by: Frank Wunderlich +Co-developed-by: Frank Wunderlich +Signed-off-by: Frank Wunderlich +Signed-off-by: Christian Marangi +Cc: stable@vger.kernel.org +--- + arch/arm64/boot/dts/mediatek/mt7622.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi ++++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi +@@ -798,7 +798,7 @@ + }; + + pciesys: clock-controller@1a100800 { +- compatible = "mediatek,mt7622-pciesys"; ++ compatible = "mediatek,mt7622-pciesys", "syscon"; + reg = <0 0x1a100800 0 0x1000>; + #clock-cells = <1>; + #reset-cells = <1>; From 4d213b2ae2c1902a9e5c8db08c8eaab4df65c71d Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sun, 2 Feb 2025 16:00:54 +0800 Subject: [PATCH 439/877] ramips: fix xtal clock registration issue on RT3883 The redundant xtal clock source caused clock registration failure. Link: https://lore.kernel.org/all/20250108093636.265033-1-sergio.paracuellos@gmail.com/ Fixes: https://github.com/openwrt/openwrt/issues/17677 Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17830 Signed-off-by: Hauke Mehrtens (cherry picked from commit cfca9d689459426a119edbc02ecb7c778a3c2b77) --- target/linux/ramips/dts/rt3883.dtsi | 20 +++---- ...ove-duplicated-xtal-clock-for-Ralink.patch | 28 +++++++++ ...0-mips-ralink-update-CPU-clock-index.patch | 58 +++++++++++++++++++ 3 files changed, 96 insertions(+), 10 deletions(-) create mode 100644 target/linux/ramips/patches-6.6/003-v6.14-clk-ralink-mtmips-remove-duplicated-xtal-clock-for-Ralink.patch create mode 100644 target/linux/ramips/patches-6.6/100-mips-ralink-update-CPU-clock-index.patch diff --git a/target/linux/ramips/dts/rt3883.dtsi b/target/linux/ramips/dts/rt3883.dtsi index 363b1959b67bf3..509d1c21e84d36 100644 --- a/target/linux/ramips/dts/rt3883.dtsi +++ b/target/linux/ramips/dts/rt3883.dtsi @@ -51,7 +51,7 @@ compatible = "ralink,rt2880-timer"; reg = <0x100 0x20>; - clocks = <&sysc 5>; + clocks = <&sysc 4>; interrupt-parent = <&intc>; interrupts = <1>; @@ -61,7 +61,7 @@ compatible = "ralink,rt2880-wdt"; reg = <0x120 0x10>; - clocks = <&sysc 6>; + clocks = <&sysc 5>; resets = <&sysc 8>; reset-names = "wdt"; @@ -93,7 +93,7 @@ compatible = "ralink,rt3883-uart", "ralink,rt2880-uart", "ns16550a"; reg = <0x500 0x100>; - clocks = <&sysc 7>; + clocks = <&sysc 6>; resets = <&sysc 12>; @@ -187,7 +187,7 @@ compatible = "ralink,rt2880-i2c"; reg = <0x900 0x100>; - clocks = <&sysc 8>; + clocks = <&sysc 7>; resets = <&sysc 16>; reset-names = "i2c"; @@ -205,7 +205,7 @@ compatible = "ralink,rt3883-i2s"; reg = <0xa00 0x100>; - clocks = <&sysc 9>; + clocks = <&sysc 8>; resets = <&sysc 17>; reset-names = "i2s"; @@ -229,7 +229,7 @@ #address-cells = <1>; #size-cells = <0>; - clocks = <&sysc 10>; + clocks = <&sysc 9>; resets = <&sysc 18>; reset-names = "spi"; @@ -246,7 +246,7 @@ #address-cells = <1>; #size-cells = <0>; - clocks = <&sysc 11>; + clocks = <&sysc 10>; resets = <&sysc 18>; reset-names = "spi"; @@ -261,7 +261,7 @@ compatible = "ralink,rt3883-uart", "ralink,rt2880-uart", "ns16550a"; reg = <0xc00 0x100>; - clocks = <&sysc 12>; + clocks = <&sysc 11>; resets = <&sysc 19>; @@ -343,7 +343,7 @@ #size-cells = <0>; reg = <0x10100000 0x10000>; - clocks = <&sysc 13>; + clocks = <&sysc 12>; resets = <&sysc 21>; reset-names = "fe"; @@ -463,7 +463,7 @@ compatible = "ralink,rt3883-wmac", "ralink,rt2880-wmac"; reg = <0x10180000 0x40000>; - clocks = <&sysc 14>; + clocks = <&sysc 13>; interrupt-parent = <&cpuintc>; interrupts = <6>; diff --git a/target/linux/ramips/patches-6.6/003-v6.14-clk-ralink-mtmips-remove-duplicated-xtal-clock-for-Ralink.patch b/target/linux/ramips/patches-6.6/003-v6.14-clk-ralink-mtmips-remove-duplicated-xtal-clock-for-Ralink.patch new file mode 100644 index 00000000000000..71a32a0bc117c8 --- /dev/null +++ b/target/linux/ramips/patches-6.6/003-v6.14-clk-ralink-mtmips-remove-duplicated-xtal-clock-for-Ralink.patch @@ -0,0 +1,28 @@ +From 830d8062d25581cf0beaa334486eea06834044da Mon Sep 17 00:00:00 2001 +From: Sergio Paracuellos +Date: Wed, 8 Jan 2025 10:36:36 +0100 +Subject: [PATCH] clk: ralink: mtmips: remove duplicated 'xtal' clock for + Ralink SoC RT3883 + +Ralink SoC RT3883 has already 'xtal' defined as a base clock so there is no +need to redefine it again in fixed clocks section. Hence, remove the duplicate +one from there. + +Fixes: d34db686a3d7 ("clk: ralink: mtmips: fix clocks probe order in oldest ralink SoCs") +Signed-off-by: Sergio Paracuellos +Link: https://lore.kernel.org/r/20250108093636.265033-1-sergio.paracuellos@gmail.com +Signed-off-by: Stephen Boyd +--- + drivers/clk/ralink/clk-mtmips.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/clk/ralink/clk-mtmips.c ++++ b/drivers/clk/ralink/clk-mtmips.c +@@ -266,7 +266,6 @@ err_clk_unreg: + } + + static struct mtmips_clk_fixed rt3883_fixed_clocks[] = { +- CLK_FIXED("xtal", NULL, 40000000), + CLK_FIXED("periph", "xtal", 40000000) + }; + diff --git a/target/linux/ramips/patches-6.6/100-mips-ralink-update-CPU-clock-index.patch b/target/linux/ramips/patches-6.6/100-mips-ralink-update-CPU-clock-index.patch new file mode 100644 index 00000000000000..c19771ee87ac25 --- /dev/null +++ b/target/linux/ramips/patches-6.6/100-mips-ralink-update-CPU-clock-index.patch @@ -0,0 +1,58 @@ +From ef57412d070fe663a66a5473ffc708bd89671259 Mon Sep 17 00:00:00 2001 +From: Signed-off-by: Shiji Yang +Date: Sun, 2 Feb 2025 17:10:14 +0800 +Subject: [PATCH] mips: ralink: update CPU clock index + +Some clock indexes have been reorganized in commit d34db686a3d7 +("clk: ralink: mtmips: fix clocks probe order in oldest ralink SoCs"). +Update CPU clock index to match the clock driver changes. + +Signed-off-by: Shiji Yang +Co-authored-by: Mieczyslaw Nalewaj +--- + arch/mips/ralink/clk.c | 11 ++--------- + 1 file changed, 2 insertions(+), 9 deletions(-) + +--- a/arch/mips/ralink/clk.c ++++ b/arch/mips/ralink/clk.c +@@ -19,27 +19,22 @@ + + static const char *clk_cpu(int *idx) + { ++ *idx = 1; ++ + switch (ralink_soc) { + case RT2880_SOC: +- *idx = 0; + return "ralink,rt2880-sysc"; + case RT3883_SOC: +- *idx = 0; + return "ralink,rt3883-sysc"; + case RT305X_SOC_RT3050: +- *idx = 0; + return "ralink,rt3050-sysc"; + case RT305X_SOC_RT3052: +- *idx = 0; + return "ralink,rt3052-sysc"; + case RT305X_SOC_RT3350: +- *idx = 1; + return "ralink,rt3350-sysc"; + case RT305X_SOC_RT3352: +- *idx = 1; + return "ralink,rt3352-sysc"; + case RT305X_SOC_RT5350: +- *idx = 1; + return "ralink,rt5350-sysc"; + case MT762X_SOC_MT7620A: + *idx = 2; +@@ -48,10 +43,8 @@ static const char *clk_cpu(int *idx) + *idx = 2; + return "ralink,mt7620-sysc"; + case MT762X_SOC_MT7628AN: +- *idx = 1; + return "ralink,mt7628-sysc"; + case MT762X_SOC_MT7688: +- *idx = 1; + return "ralink,mt7688-sysc"; + default: + *idx = -1; From cd747cb3aa6c276ce6d41326f3c2d24e45a30389 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Mon, 3 Feb 2025 01:48:39 +0100 Subject: [PATCH 440/877] ipq806x: fix broken WAN on Linksys EAX and Asrock G10 Fix broken WAN on Linksys EAX and Asrock G10 by incrementing the WAN interface MAC address + 1. This caused conflicting entry in the FDB table and caused the WAN port to malfunction with the DSA conversion. Fixes: #17157 Fixes: #15585 Fixes: #16604 Link: https://github.com/openwrt/openwrt/pull/17839 Signed-off-by: Christian Marangi (cherry picked from commit eba2fbf63814bbcf8c99c98177818476fca808a7) --- target/linux/ipq806x/base-files/etc/board.d/02_network | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/linux/ipq806x/base-files/etc/board.d/02_network b/target/linux/ipq806x/base-files/etc/board.d/02_network index 77d47b8cd0d1cc..43ee5ccd14b9c5 100644 --- a/target/linux/ipq806x/base-files/etc/board.d/02_network +++ b/target/linux/ipq806x/base-files/etc/board.d/02_network @@ -81,12 +81,12 @@ ipq806x_setup_macs() linksys,ea7500-v1) hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr) ucidef_set_interface_macaddr "lan" "$hw_mac_addr" - ucidef_set_interface_macaddr "wan" "$hw_mac_addr" + ucidef_set_interface_macaddr "wan" "$(macaddr_add $hw_mac_addr 1)" ;; linksys,ea8500) hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr) ucidef_set_interface_macaddr "lan" "$hw_mac_addr" - ucidef_set_interface_macaddr "wan" "$hw_mac_addr" + ucidef_set_interface_macaddr "wan" "$(macaddr_add $hw_mac_addr 1)" ;; linksys,e8350-v1 |\ zyxel,nbg6817) @@ -98,7 +98,7 @@ ipq806x_setup_macs() hw_mac_addr=$(mtd_get_mac_ascii hwconfig HW.LAN.MAC.Address) ucidef_set_interface_macaddr "lan" "$hw_mac_addr" hw_mac_addr=$(mtd_get_mac_ascii hwconfig HW.WAN.MAC.Address) - ucidef_set_interface_macaddr "wan" "$hw_mac_addr" + ucidef_set_interface_macaddr "wan" "$(macaddr_add $hw_mac_addr 1)" ;; esac } From 6df0e3d02ac89d3ad7da1ade7fc51b15163bd136 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Tue, 4 Feb 2025 00:07:25 +0100 Subject: [PATCH 441/877] Revert "ramips: mt7620: fix patching mac address in caldata" This reverts commit 3295f6f1c254cd7e5e5285a05581bf6abbde8999. It looks like the eeprom gets broken after this change. I think this change was not tested on a real device before it was merged. The MAC addresses will be broken again after this revert. Fixes: #17818 Signed-off-by: Hauke Mehrtens (cherry picked from commit f628467dfd6b32ead172d33a2593f04901395343) --- .../mt7620/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ramips/mt7620/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom b/target/linux/ramips/mt7620/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom index b68efcbba182aa..2d1ac2e872d518 100644 --- a/target/linux/ramips/mt7620/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom +++ b/target/linux/ramips/mt7620/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom @@ -34,12 +34,12 @@ case "$FIRMWARE" in wan_mac=$(jboot_config_read -m -i $(find_mtd_part "config") -o 0xE000) wifi_mac=$(macaddr_add "$wan_mac" 1) jboot_eeprom_extract "config" 0xE000 - caldata_patch_data "${wifi_mac//:/}" 0x4 + caldata_patch_mac $wifi_mac 0x4 ;; dovado,tiny-ac) wifi_mac=$(mtd_get_mac_ascii u-boot-env INIC_MAC_ADDR) caldata_extract "factory" 0x0 0x200 - caldata_patch_data "${wifi_mac//:/}" 0x4 + caldata_patch_mac $wifi_mac 0x4 ;; *) caldata_die "Please define mtd-eeprom in $board DTS file!" From 1fad1b4965dc6f4e5f4ba7b9605987f443a4c276 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Tue, 4 Feb 2025 00:10:35 +0100 Subject: [PATCH 442/877] OpenWrt v24.10.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 581de056c41e3e..1a13af3413f59e 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git;openwrt-24.10 -src-git luci https://git.openwrt.org/project/luci.git;openwrt-24.10 -src-git routing https://git.openwrt.org/feed/routing.git;openwrt-24.10 -src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-24.10 +src-git packages https://git.openwrt.org/feed/packages.git^201fd099b80a2931b7326ce20b0cbb824296c99f +src-git luci https://git.openwrt.org/project/luci.git^7b0663a5557118499dc3b3d44550efc1b6fa3feb +src-git routing https://git.openwrt.org/feed/routing.git^e87b55c6a642947ad7e24cd5054a637df63d5dbe +src-git telephony https://git.openwrt.org/feed/telephony.git^fd605af7143165a2490681ec1752f259873b9147 diff --git a/include/version.mk b/include/version.mk index a6ebe587797707..3ed6f31ca69806 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),24.10-SNAPSHOT) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),24.10.0) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION)) +VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r28427-6df0e3d02a) VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO)) -VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/24.10-SNAPSHOT) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/24.10.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 80db993d46b837..7d50eebef64a38 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/24.10-SNAPSHOT" + default "https://downloads.openwrt.org/releases/24.10.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..020bafa99e3dfe --- /dev/null +++ b/version @@ -0,0 +1 @@ +r28427-6df0e3d02a diff --git a/version.date b/version.date new file mode 100644 index 00000000000000..13577ada7b4ffb --- /dev/null +++ b/version.date @@ -0,0 +1 @@ +1738624177 From 9e1b04fbdc74fb546c82aaae1920fd4d069bd8e9 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Tue, 4 Feb 2025 00:10:38 +0100 Subject: [PATCH 443/877] OpenWrt v24.10.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 1a13af3413f59e..581de056c41e3e 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git^201fd099b80a2931b7326ce20b0cbb824296c99f -src-git luci https://git.openwrt.org/project/luci.git^7b0663a5557118499dc3b3d44550efc1b6fa3feb -src-git routing https://git.openwrt.org/feed/routing.git^e87b55c6a642947ad7e24cd5054a637df63d5dbe -src-git telephony https://git.openwrt.org/feed/telephony.git^fd605af7143165a2490681ec1752f259873b9147 +src-git packages https://git.openwrt.org/feed/packages.git;openwrt-24.10 +src-git luci https://git.openwrt.org/project/luci.git;openwrt-24.10 +src-git routing https://git.openwrt.org/feed/routing.git;openwrt-24.10 +src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-24.10 diff --git a/include/version.mk b/include/version.mk index 3ed6f31ca69806..a6ebe587797707 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),24.10.0) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),24.10-SNAPSHOT) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r28427-6df0e3d02a) +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/24.10.0) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/24.10-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 7d50eebef64a38..80db993d46b837 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/24.10.0" + default "https://downloads.openwrt.org/releases/24.10-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 020bafa99e3dfe..00000000000000 --- a/version +++ /dev/null @@ -1 +0,0 @@ -r28427-6df0e3d02a diff --git a/version.date b/version.date deleted file mode 100644 index 13577ada7b4ffb..00000000000000 --- a/version.date +++ /dev/null @@ -1 +0,0 @@ -1738624177 From e4d840b312fa736e1e1e5a32d1ea43025d4186ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Fri, 31 Jan 2025 08:57:11 +0100 Subject: [PATCH 444/877] generic: 6.6: backport upstream r8169 patches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit b11bff90f2ad r8169: add support for RTL8125BP rev.b b3593df26ab1 r8169: add support for RTL8125D rev.b b299ea006928 r8169: adjust version numbering for RTL8126 bb18265c3aba r8169: remove support for chip version 11 2e20bf8cc057 r8169: remove unused flag RTL_FLAG_TASK_RESET_NO_QUEUE_WAKE e340bff27e63 r8169: copy vendor driver 2.5G/5G EEE advertisement constraints The EEE advertisement patch has been reworked for linux v6.6 because phy_set_eee_broken() is only present on linux >= v6.13 and eee_broken_modes declaration has been converted to a bitmap, so linkmode_set_bit() can't be used either. https://github.com/torvalds/linux/commit/e340bff27e63ed61a1e9895bed546107859e48a7 https://github.com/torvalds/linux/commit/ed623fb8e38e2a241da12864778ec9c9cf930c65 https://github.com/torvalds/linux/commit/721aa69e708b7432af83c4bb00a30e2b7c27da28 Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 084618f8db7d0e413b47bab3e0ea70804bf84ee2) --- ...r-driver-2.5G-5G-EEE-advertisement-c.patch | 82 ++++++ ...sed-flag-RTL_FLAG_TASK_RESET_NO_QUEU.patch | 35 +++ ...9-remove-support-for-chip-version-11.patch | 114 ++++++++ ...adjust-version-numbering-for-RTL8126.patch | 257 ++++++++++++++++++ ...r8169-add-support-for-RTL8125D-rev.b.patch | 90 ++++++ ...8169-add-support-for-RTL8125BP-rev.b.patch | 184 +++++++++++++ 6 files changed, 762 insertions(+) create mode 100644 target/linux/generic/backport-6.6/780-44-v6.13-r8169-copy-vendor-driver-2.5G-5G-EEE-advertisement-c.patch create mode 100644 target/linux/generic/backport-6.6/780-45-v6.14-r8169-remove-unused-flag-RTL_FLAG_TASK_RESET_NO_QUEU.patch create mode 100644 target/linux/generic/backport-6.6/780-46-v6.14-r8169-remove-support-for-chip-version-11.patch create mode 100644 target/linux/generic/backport-6.6/780-47-v6.14-r8169-adjust-version-numbering-for-RTL8126.patch create mode 100644 target/linux/generic/backport-6.6/780-48-v6.14-r8169-add-support-for-RTL8125D-rev.b.patch create mode 100644 target/linux/generic/backport-6.6/780-49-v6.14-r8169-add-support-for-RTL8125BP-rev.b.patch diff --git a/target/linux/generic/backport-6.6/780-44-v6.13-r8169-copy-vendor-driver-2.5G-5G-EEE-advertisement-c.patch b/target/linux/generic/backport-6.6/780-44-v6.13-r8169-copy-vendor-driver-2.5G-5G-EEE-advertisement-c.patch new file mode 100644 index 00000000000000..fb01dad458540f --- /dev/null +++ b/target/linux/generic/backport-6.6/780-44-v6.13-r8169-copy-vendor-driver-2.5G-5G-EEE-advertisement-c.patch @@ -0,0 +1,82 @@ +From e340bff27e63ed61a1e9895bed546107859e48a7 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Fri, 8 Nov 2024 08:08:24 +0100 +Subject: [PATCH] r8169: copy vendor driver 2.5G/5G EEE advertisement + constraints + +Vendor driver r8125 doesn't advertise 2.5G EEE on RTL8125A, and r8126 +doesn't advertise 5G EEE. Likely there are compatibility issues, +therefore do the same in r8169. +With this change we don't have to disable 2.5G EEE advertisement in +rtl8125a_config_eee_phy() any longer. +We use new phylib accessor phy_set_eee_broken() to mark the respective +EEE modes as broken. + +Signed-off-by: Heiner Kallweit +Link: https://patch.msgid.link/ce185e10-8a2f-4cf8-a49b-fd8fb3c3c8a1@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169_main.c | 6 ++++++ + drivers/net/ethernet/realtek/r8169_phy_config.c | 16 ++++------------ + 2 files changed, 10 insertions(+), 12 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -5236,6 +5236,11 @@ static int r8169_mdio_register(struct rt + tp->phydev->supported_eee); + phy_support_asym_pause(tp->phydev); + ++ /* mimic behavior of r8125/r8126 vendor drivers */ ++ if (tp->mac_version == RTL_GIGA_MAC_VER_61) ++ tp->phydev->eee_broken_modes |= MDIO_EEE_2_5GT; ++ tp->phydev->eee_broken_modes |= MDIO_EEE_5GT; ++ + /* PHY will be woken up in rtl_open() */ + phy_suspend(tp->phydev); + +--- a/drivers/net/ethernet/realtek/r8169_phy_config.c ++++ b/drivers/net/ethernet/realtek/r8169_phy_config.c +@@ -96,15 +96,7 @@ static void rtl8125_common_config_eee_ph + phy_modify_paged(phydev, 0xa4a, 0x11, 0x0200, 0x0000); + } + +-static void rtl8125a_config_eee_phy(struct phy_device *phydev) +-{ +- rtl8168g_config_eee_phy(phydev); +- /* disable EEE at 2.5Gbps */ +- phy_modify_paged(phydev, 0xa6d, 0x12, 0x0001, 0x0000); +- rtl8125_common_config_eee_phy(phydev); +-} +- +-static void rtl8125b_config_eee_phy(struct phy_device *phydev) ++static void rtl8125_config_eee_phy(struct phy_device *phydev) + { + rtl8168g_config_eee_phy(phydev); + rtl8125_common_config_eee_phy(phydev); +@@ -1066,7 +1058,7 @@ static void rtl8125a_2_hw_phy_config(str + rtl8168g_enable_gphy_10m(phydev); + + rtl8168g_disable_aldps(phydev); +- rtl8125a_config_eee_phy(phydev); ++ rtl8125_config_eee_phy(phydev); + } + + static void rtl8125b_hw_phy_config(struct rtl8169_private *tp, +@@ -1106,7 +1098,7 @@ static void rtl8125b_hw_phy_config(struc + + rtl8125_legacy_force_mode(phydev); + rtl8168g_disable_aldps(phydev); +- rtl8125b_config_eee_phy(phydev); ++ rtl8125_config_eee_phy(phydev); + } + + static void rtl8125d_hw_phy_config(struct rtl8169_private *tp, +@@ -1116,7 +1108,7 @@ static void rtl8125d_hw_phy_config(struc + rtl8168g_enable_gphy_10m(phydev); + rtl8125_legacy_force_mode(phydev); + rtl8168g_disable_aldps(phydev); +- rtl8125b_config_eee_phy(phydev); ++ rtl8125_config_eee_phy(phydev); + } + + static void rtl8126a_hw_phy_config(struct rtl8169_private *tp, diff --git a/target/linux/generic/backport-6.6/780-45-v6.14-r8169-remove-unused-flag-RTL_FLAG_TASK_RESET_NO_QUEU.patch b/target/linux/generic/backport-6.6/780-45-v6.14-r8169-remove-unused-flag-RTL_FLAG_TASK_RESET_NO_QUEU.patch new file mode 100644 index 00000000000000..476f7a576044e3 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-45-v6.14-r8169-remove-unused-flag-RTL_FLAG_TASK_RESET_NO_QUEU.patch @@ -0,0 +1,35 @@ +From 2e20bf8cc05766dcd0357cdfcada49e1bc45512b Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Mon, 2 Dec 2024 21:14:35 +0100 +Subject: [PATCH] r8169: remove unused flag RTL_FLAG_TASK_RESET_NO_QUEUE_WAKE + +After 854d71c555dfc3 ("r8169: remove original workaround for RTL8125 +broken rx issue") this flag isn't used any longer. So remove it. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Michal Swiatkowski +Link: https://patch.msgid.link/d9dd214b-3027-4f60-b0e8-6f34a0c76582@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169_main.c | 3 --- + 1 file changed, 3 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -623,7 +623,6 @@ struct rtl8169_tc_offsets { + enum rtl_flag { + RTL_FLAG_TASK_ENABLED = 0, + RTL_FLAG_TASK_RESET_PENDING, +- RTL_FLAG_TASK_RESET_NO_QUEUE_WAKE, + RTL_FLAG_TASK_TX_TIMEOUT, + RTL_FLAG_MAX + }; +@@ -4729,8 +4728,6 @@ static void rtl_task(struct work_struct + reset: + rtl_reset_work(tp); + netif_wake_queue(tp->dev); +- } else if (test_and_clear_bit(RTL_FLAG_TASK_RESET_NO_QUEUE_WAKE, tp->wk.flags)) { +- rtl_reset_work(tp); + } + } + diff --git a/target/linux/generic/backport-6.6/780-46-v6.14-r8169-remove-support-for-chip-version-11.patch b/target/linux/generic/backport-6.6/780-46-v6.14-r8169-remove-support-for-chip-version-11.patch new file mode 100644 index 00000000000000..9ffe091140db75 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-46-v6.14-r8169-remove-support-for-chip-version-11.patch @@ -0,0 +1,114 @@ +From bb18265c3aba92b91a1355609769f3e967b65dee Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Mon, 2 Dec 2024 21:20:02 +0100 +Subject: [PATCH] r8169: remove support for chip version 11 + +This is a follow-up to 982300c115d2 ("r8169: remove detection of chip +version 11 (early RTL8168b)"). Nobody complained yet, so remove +support for this chip version. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Link: https://patch.msgid.link/b689ab6d-20b5-4b64-bd7e-531a0a972ba3@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169.h | 2 +- + drivers/net/ethernet/realtek/r8169_main.c | 14 +------------- + drivers/net/ethernet/realtek/r8169_phy_config.c | 10 ---------- + 3 files changed, 2 insertions(+), 24 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169.h ++++ b/drivers/net/ethernet/realtek/r8169.h +@@ -23,7 +23,7 @@ enum mac_version { + RTL_GIGA_MAC_VER_08, + RTL_GIGA_MAC_VER_09, + RTL_GIGA_MAC_VER_10, +- RTL_GIGA_MAC_VER_11, ++ /* support for RTL_GIGA_MAC_VER_11 has been removed */ + /* RTL_GIGA_MAC_VER_12 was handled the same as VER_17 */ + /* RTL_GIGA_MAC_VER_13 was merged with VER_10 */ + RTL_GIGA_MAC_VER_14, +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -103,7 +103,6 @@ static const struct { + [RTL_GIGA_MAC_VER_08] = {"RTL8102e" }, + [RTL_GIGA_MAC_VER_09] = {"RTL8102e/RTL8103e" }, + [RTL_GIGA_MAC_VER_10] = {"RTL8101e/RTL8100e" }, +- [RTL_GIGA_MAC_VER_11] = {"RTL8168b/8111b" }, + [RTL_GIGA_MAC_VER_14] = {"RTL8401" }, + [RTL_GIGA_MAC_VER_17] = {"RTL8168b/8111b" }, + [RTL_GIGA_MAC_VER_18] = {"RTL8168cp/8111cp" }, +@@ -2336,7 +2335,7 @@ static enum mac_version rtl8169_get_mac_ + + /* 8168B family. */ + { 0x7c8, 0x380, RTL_GIGA_MAC_VER_17 }, +- /* This one is very old and rare, let's see if anybody complains. ++ /* This one is very old and rare, support has been removed. + * { 0x7c8, 0x300, RTL_GIGA_MAC_VER_11 }, + */ + +@@ -3806,7 +3805,6 @@ static void rtl_hw_config(struct rtl8169 + [RTL_GIGA_MAC_VER_08] = rtl_hw_start_8102e_3, + [RTL_GIGA_MAC_VER_09] = rtl_hw_start_8102e_2, + [RTL_GIGA_MAC_VER_10] = NULL, +- [RTL_GIGA_MAC_VER_11] = rtl_hw_start_8168b, + [RTL_GIGA_MAC_VER_14] = rtl_hw_start_8401, + [RTL_GIGA_MAC_VER_17] = rtl_hw_start_8168b, + [RTL_GIGA_MAC_VER_18] = rtl_hw_start_8168cp_1, +@@ -4682,12 +4680,6 @@ static irqreturn_t rtl8169_interrupt(int + if (status & LinkChg) + phy_mac_interrupt(tp->phydev); + +- if (unlikely(status & RxFIFOOver && +- tp->mac_version == RTL_GIGA_MAC_VER_11)) { +- netif_stop_queue(tp->dev); +- rtl_schedule_task(tp, RTL_FLAG_TASK_RESET_PENDING); +- } +- + rtl_irq_disable(tp); + napi_schedule(&tp->napi); + out: +@@ -5107,9 +5099,6 @@ static void rtl_set_irq_mask(struct rtl8 + + if (tp->mac_version <= RTL_GIGA_MAC_VER_06) + tp->irq_mask |= SYSErr | RxFIFOOver; +- else if (tp->mac_version == RTL_GIGA_MAC_VER_11) +- /* special workaround needed */ +- tp->irq_mask |= RxFIFOOver; + } + + static int rtl_alloc_irq(struct rtl8169_private *tp) +@@ -5304,7 +5293,6 @@ static int rtl_jumbo_max(struct rtl8169_ + case RTL_GIGA_MAC_VER_02 ... RTL_GIGA_MAC_VER_06: + return JUMBO_7K; + /* RTL8168b */ +- case RTL_GIGA_MAC_VER_11: + case RTL_GIGA_MAC_VER_17: + return JUMBO_4K; + /* RTL8168c */ +--- a/drivers/net/ethernet/realtek/r8169_phy_config.c ++++ b/drivers/net/ethernet/realtek/r8169_phy_config.c +@@ -276,15 +276,6 @@ static void rtl8169sce_hw_phy_config(str + rtl_writephy_batch(phydev, phy_reg_init); + } + +-static void rtl8168bb_hw_phy_config(struct rtl8169_private *tp, +- struct phy_device *phydev) +-{ +- phy_write(phydev, 0x1f, 0x0001); +- phy_set_bits(phydev, 0x16, BIT(0)); +- phy_write(phydev, 0x10, 0xf41b); +- phy_write(phydev, 0x1f, 0x0000); +-} +- + static void rtl8168bef_hw_phy_config(struct rtl8169_private *tp, + struct phy_device *phydev) + { +@@ -1136,7 +1127,6 @@ void r8169_hw_phy_config(struct rtl8169_ + [RTL_GIGA_MAC_VER_08] = rtl8102e_hw_phy_config, + [RTL_GIGA_MAC_VER_09] = rtl8102e_hw_phy_config, + [RTL_GIGA_MAC_VER_10] = NULL, +- [RTL_GIGA_MAC_VER_11] = rtl8168bb_hw_phy_config, + [RTL_GIGA_MAC_VER_14] = rtl8401_hw_phy_config, + [RTL_GIGA_MAC_VER_17] = rtl8168bef_hw_phy_config, + [RTL_GIGA_MAC_VER_18] = rtl8168cp_1_hw_phy_config, diff --git a/target/linux/generic/backport-6.6/780-47-v6.14-r8169-adjust-version-numbering-for-RTL8126.patch b/target/linux/generic/backport-6.6/780-47-v6.14-r8169-adjust-version-numbering-for-RTL8126.patch new file mode 100644 index 00000000000000..efa41eb67b5d4c --- /dev/null +++ b/target/linux/generic/backport-6.6/780-47-v6.14-r8169-adjust-version-numbering-for-RTL8126.patch @@ -0,0 +1,257 @@ +From b299ea0069284186b0d3d54aebe87f0d195d457a Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Fri, 13 Dec 2024 20:01:41 +0100 +Subject: [PATCH] r8169: adjust version numbering for RTL8126 + +Adjust version numbering for RTL8126, so that it doesn't overlap with +new RTL8125 versions. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Link: https://patch.msgid.link/6a354364-20e9-48ad-a198-468264288757@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169.h | 4 +- + drivers/net/ethernet/realtek/r8169_main.c | 62 +++++++++---------- + .../net/ethernet/realtek/r8169_phy_config.c | 4 +- + 3 files changed, 35 insertions(+), 35 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169.h ++++ b/drivers/net/ethernet/realtek/r8169.h +@@ -69,8 +69,8 @@ enum mac_version { + RTL_GIGA_MAC_VER_61, + RTL_GIGA_MAC_VER_63, + RTL_GIGA_MAC_VER_64, +- RTL_GIGA_MAC_VER_65, +- RTL_GIGA_MAC_VER_66, ++ RTL_GIGA_MAC_VER_70, ++ RTL_GIGA_MAC_VER_71, + RTL_GIGA_MAC_NONE + }; + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -139,8 +139,8 @@ static const struct { + /* reserve 62 for CFG_METHOD_4 in the vendor driver */ + [RTL_GIGA_MAC_VER_63] = {"RTL8125B", FIRMWARE_8125B_2}, + [RTL_GIGA_MAC_VER_64] = {"RTL8125D", FIRMWARE_8125D_1}, +- [RTL_GIGA_MAC_VER_65] = {"RTL8126A", FIRMWARE_8126A_2}, +- [RTL_GIGA_MAC_VER_66] = {"RTL8126A", FIRMWARE_8126A_3}, ++ [RTL_GIGA_MAC_VER_70] = {"RTL8126A", FIRMWARE_8126A_2}, ++ [RTL_GIGA_MAC_VER_71] = {"RTL8126A", FIRMWARE_8126A_3}, + }; + + static const struct pci_device_id rtl8169_pci_tbl[] = { +@@ -1228,7 +1228,7 @@ static void rtl_writephy(struct rtl8169_ + case RTL_GIGA_MAC_VER_31: + r8168dp_2_mdio_write(tp, location, val); + break; +- case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_66: ++ case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_71: + r8168g_mdio_write(tp, location, val); + break; + default: +@@ -1243,7 +1243,7 @@ static int rtl_readphy(struct rtl8169_pr + case RTL_GIGA_MAC_VER_28: + case RTL_GIGA_MAC_VER_31: + return r8168dp_2_mdio_read(tp, location); +- case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_66: ++ case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_71: + return r8168g_mdio_read(tp, location); + default: + return r8169_mdio_read(tp, location); +@@ -1574,7 +1574,7 @@ static void __rtl8169_set_wol(struct rtl + break; + case RTL_GIGA_MAC_VER_34: + case RTL_GIGA_MAC_VER_37: +- case RTL_GIGA_MAC_VER_39 ... RTL_GIGA_MAC_VER_66: ++ case RTL_GIGA_MAC_VER_39 ... RTL_GIGA_MAC_VER_71: + r8169_mod_reg8_cond(tp, Config2, PME_SIGNAL, wolopts); + break; + default: +@@ -2047,7 +2047,7 @@ static void rtl_set_eee_txidle_timer(str + tp->tx_lpi_timer = timer_val; + r8168_mac_ocp_write(tp, 0xe048, timer_val); + break; +- case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_66: ++ case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_71: + tp->tx_lpi_timer = timer_val; + RTL_W16(tp, EEE_TXIDLE_TIMER_8125, timer_val); + break; +@@ -2256,8 +2256,8 @@ static enum mac_version rtl8169_get_mac_ + enum mac_version ver; + } mac_info[] = { + /* 8126A family. */ +- { 0x7cf, 0x64a, RTL_GIGA_MAC_VER_66 }, +- { 0x7cf, 0x649, RTL_GIGA_MAC_VER_65 }, ++ { 0x7cf, 0x64a, RTL_GIGA_MAC_VER_71 }, ++ { 0x7cf, 0x649, RTL_GIGA_MAC_VER_70 }, + + /* 8125D family. */ + { 0x7cf, 0x688, RTL_GIGA_MAC_VER_64 }, +@@ -2529,7 +2529,7 @@ static void rtl_init_rxcfg(struct rtl816 + case RTL_GIGA_MAC_VER_61: + RTL_W32(tp, RxConfig, RX_FETCH_DFLT_8125 | RX_DMA_BURST); + break; +- case RTL_GIGA_MAC_VER_63 ... RTL_GIGA_MAC_VER_66: ++ case RTL_GIGA_MAC_VER_63 ... RTL_GIGA_MAC_VER_71: + RTL_W32(tp, RxConfig, RX_FETCH_DFLT_8125 | RX_DMA_BURST | + RX_PAUSE_SLOT_ON); + break; +@@ -2661,7 +2661,7 @@ static void rtl_wait_txrx_fifo_empty(str + case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_61: + rtl_loop_wait_high(tp, &rtl_rxtx_empty_cond, 100, 42); + break; +- case RTL_GIGA_MAC_VER_63 ... RTL_GIGA_MAC_VER_66: ++ case RTL_GIGA_MAC_VER_63 ... RTL_GIGA_MAC_VER_71: + RTL_W8(tp, ChipCmd, RTL_R8(tp, ChipCmd) | StopReq); + rtl_loop_wait_high(tp, &rtl_rxtx_empty_cond, 100, 42); + rtl_loop_wait_high(tp, &rtl_rxtx_empty_cond_2, 100, 42); +@@ -2904,7 +2904,7 @@ static void rtl_enable_exit_l1(struct rt + case RTL_GIGA_MAC_VER_37 ... RTL_GIGA_MAC_VER_38: + rtl_eri_set_bits(tp, 0xd4, 0x0c00); + break; +- case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_66: ++ case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_71: + r8168_mac_ocp_modify(tp, 0xc0ac, 0, 0x1f80); + break; + default: +@@ -2918,7 +2918,7 @@ static void rtl_disable_exit_l1(struct r + case RTL_GIGA_MAC_VER_34 ... RTL_GIGA_MAC_VER_38: + rtl_eri_clear_bits(tp, 0xd4, 0x1f00); + break; +- case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_66: ++ case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_71: + r8168_mac_ocp_modify(tp, 0xc0ac, 0x1f80, 0); + break; + default: +@@ -2944,8 +2944,8 @@ static void rtl_hw_aspm_clkreq_enable(st + + rtl_mod_config5(tp, 0, ASPM_en); + switch (tp->mac_version) { +- case RTL_GIGA_MAC_VER_65: +- case RTL_GIGA_MAC_VER_66: ++ case RTL_GIGA_MAC_VER_70: ++ case RTL_GIGA_MAC_VER_71: + val8 = RTL_R8(tp, INT_CFG0_8125) | INT_CFG0_CLKREQEN; + RTL_W8(tp, INT_CFG0_8125, val8); + break; +@@ -2956,7 +2956,7 @@ static void rtl_hw_aspm_clkreq_enable(st + + switch (tp->mac_version) { + case RTL_GIGA_MAC_VER_46 ... RTL_GIGA_MAC_VER_48: +- case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_66: ++ case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_71: + /* reset ephy tx/rx disable timer */ + r8168_mac_ocp_modify(tp, 0xe094, 0xff00, 0); + /* chip can trigger L1.2 */ +@@ -2968,7 +2968,7 @@ static void rtl_hw_aspm_clkreq_enable(st + } else { + switch (tp->mac_version) { + case RTL_GIGA_MAC_VER_46 ... RTL_GIGA_MAC_VER_48: +- case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_66: ++ case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_71: + r8168_mac_ocp_modify(tp, 0xe092, 0x00ff, 0); + break; + default: +@@ -2976,8 +2976,8 @@ static void rtl_hw_aspm_clkreq_enable(st + } + + switch (tp->mac_version) { +- case RTL_GIGA_MAC_VER_65: +- case RTL_GIGA_MAC_VER_66: ++ case RTL_GIGA_MAC_VER_70: ++ case RTL_GIGA_MAC_VER_71: + val8 = RTL_R8(tp, INT_CFG0_8125) & ~INT_CFG0_CLKREQEN; + RTL_W8(tp, INT_CFG0_8125, val8); + break; +@@ -3697,12 +3697,12 @@ static void rtl_hw_start_8125_common(str + /* disable new tx descriptor format */ + r8168_mac_ocp_modify(tp, 0xeb58, 0x0001, 0x0000); + +- if (tp->mac_version == RTL_GIGA_MAC_VER_65 || +- tp->mac_version == RTL_GIGA_MAC_VER_66) ++ if (tp->mac_version == RTL_GIGA_MAC_VER_70 || ++ tp->mac_version == RTL_GIGA_MAC_VER_71) + RTL_W8(tp, 0xD8, RTL_R8(tp, 0xD8) & ~0x02); + +- if (tp->mac_version == RTL_GIGA_MAC_VER_65 || +- tp->mac_version == RTL_GIGA_MAC_VER_66) ++ if (tp->mac_version == RTL_GIGA_MAC_VER_70 || ++ tp->mac_version == RTL_GIGA_MAC_VER_71) + r8168_mac_ocp_modify(tp, 0xe614, 0x0700, 0x0400); + else if (tp->mac_version == RTL_GIGA_MAC_VER_63) + r8168_mac_ocp_modify(tp, 0xe614, 0x0700, 0x0200); +@@ -3720,8 +3720,8 @@ static void rtl_hw_start_8125_common(str + r8168_mac_ocp_modify(tp, 0xe056, 0x00f0, 0x0030); + r8168_mac_ocp_modify(tp, 0xe040, 0x1000, 0x0000); + r8168_mac_ocp_modify(tp, 0xea1c, 0x0003, 0x0001); +- if (tp->mac_version == RTL_GIGA_MAC_VER_65 || +- tp->mac_version == RTL_GIGA_MAC_VER_66) ++ if (tp->mac_version == RTL_GIGA_MAC_VER_70 || ++ tp->mac_version == RTL_GIGA_MAC_VER_71) + r8168_mac_ocp_modify(tp, 0xea1c, 0x0300, 0x0000); + else + r8168_mac_ocp_modify(tp, 0xea1c, 0x0004, 0x0000); +@@ -3840,8 +3840,8 @@ static void rtl_hw_config(struct rtl8169 + [RTL_GIGA_MAC_VER_61] = rtl_hw_start_8125a_2, + [RTL_GIGA_MAC_VER_63] = rtl_hw_start_8125b, + [RTL_GIGA_MAC_VER_64] = rtl_hw_start_8125d, +- [RTL_GIGA_MAC_VER_65] = rtl_hw_start_8126a, +- [RTL_GIGA_MAC_VER_66] = rtl_hw_start_8126a, ++ [RTL_GIGA_MAC_VER_70] = rtl_hw_start_8126a, ++ [RTL_GIGA_MAC_VER_71] = rtl_hw_start_8126a, + }; + + if (hw_configs[tp->mac_version]) +@@ -3862,8 +3862,8 @@ static void rtl_hw_start_8125(struct rtl + RTL_W32(tp, i, 0); + break; + case RTL_GIGA_MAC_VER_63: +- case RTL_GIGA_MAC_VER_65: +- case RTL_GIGA_MAC_VER_66: ++ case RTL_GIGA_MAC_VER_70: ++ case RTL_GIGA_MAC_VER_71: + for (i = 0xa00; i < 0xa80; i += 4) + RTL_W32(tp, i, 0); + RTL_W16(tp, INT_CFG1_8125, 0x0000); +@@ -4095,7 +4095,7 @@ static void rtl8169_cleanup(struct rtl81 + RTL_W8(tp, ChipCmd, RTL_R8(tp, ChipCmd) | StopReq); + rtl_loop_wait_high(tp, &rtl_txcfg_empty_cond, 100, 666); + break; +- case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_66: ++ case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_71: + rtl_enable_rxdvgate(tp); + fsleep(2000); + break; +@@ -4252,7 +4252,7 @@ static unsigned int rtl_quirk_packet_pad + + switch (tp->mac_version) { + case RTL_GIGA_MAC_VER_34: +- case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_66: ++ case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_71: + padto = max_t(unsigned int, padto, ETH_ZLEN); + break; + default: +@@ -5274,7 +5274,7 @@ static void rtl_hw_initialize(struct rtl + case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_48: + rtl_hw_init_8168g(tp); + break; +- case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_66: ++ case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_71: + rtl_hw_init_8125(tp); + break; + default: +--- a/drivers/net/ethernet/realtek/r8169_phy_config.c ++++ b/drivers/net/ethernet/realtek/r8169_phy_config.c +@@ -1162,8 +1162,8 @@ void r8169_hw_phy_config(struct rtl8169_ + [RTL_GIGA_MAC_VER_61] = rtl8125a_2_hw_phy_config, + [RTL_GIGA_MAC_VER_63] = rtl8125b_hw_phy_config, + [RTL_GIGA_MAC_VER_64] = rtl8125d_hw_phy_config, +- [RTL_GIGA_MAC_VER_65] = rtl8126a_hw_phy_config, +- [RTL_GIGA_MAC_VER_66] = rtl8126a_hw_phy_config, ++ [RTL_GIGA_MAC_VER_70] = rtl8126a_hw_phy_config, ++ [RTL_GIGA_MAC_VER_71] = rtl8126a_hw_phy_config, + }; + + if (phy_configs[ver]) diff --git a/target/linux/generic/backport-6.6/780-48-v6.14-r8169-add-support-for-RTL8125D-rev.b.patch b/target/linux/generic/backport-6.6/780-48-v6.14-r8169-add-support-for-RTL8125D-rev.b.patch new file mode 100644 index 00000000000000..eeede542af61e4 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-48-v6.14-r8169-add-support-for-RTL8125D-rev.b.patch @@ -0,0 +1,90 @@ +From b3593df26ab19f114d613693fa8a92ab202803d0 Mon Sep 17 00:00:00 2001 +From: ChunHao Lin +Date: Fri, 13 Dec 2024 20:02:58 +0100 +Subject: [PATCH] r8169: add support for RTL8125D rev.b + +Add support for RTL8125D rev.b. Its XID is 0x689. It is basically +based on the one with XID 0x688, but with different firmware file. + +Signed-off-by: ChunHao Lin +[hkallweit1@gmail.com: rebased after adjusted version numbering] +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Link: https://patch.msgid.link/75e5e9ec-d01f-43ac-b0f4-e7456baf18d1@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169.h | 1 + + drivers/net/ethernet/realtek/r8169_main.c | 6 ++++++ + drivers/net/ethernet/realtek/r8169_phy_config.c | 1 + + 3 files changed, 8 insertions(+) + +--- a/drivers/net/ethernet/realtek/r8169.h ++++ b/drivers/net/ethernet/realtek/r8169.h +@@ -69,6 +69,7 @@ enum mac_version { + RTL_GIGA_MAC_VER_61, + RTL_GIGA_MAC_VER_63, + RTL_GIGA_MAC_VER_64, ++ RTL_GIGA_MAC_VER_65, + RTL_GIGA_MAC_VER_70, + RTL_GIGA_MAC_VER_71, + RTL_GIGA_MAC_NONE +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -56,6 +56,7 @@ + #define FIRMWARE_8125A_3 "rtl_nic/rtl8125a-3.fw" + #define FIRMWARE_8125B_2 "rtl_nic/rtl8125b-2.fw" + #define FIRMWARE_8125D_1 "rtl_nic/rtl8125d-1.fw" ++#define FIRMWARE_8125D_2 "rtl_nic/rtl8125d-2.fw" + #define FIRMWARE_8126A_2 "rtl_nic/rtl8126a-2.fw" + #define FIRMWARE_8126A_3 "rtl_nic/rtl8126a-3.fw" + +@@ -139,6 +140,7 @@ static const struct { + /* reserve 62 for CFG_METHOD_4 in the vendor driver */ + [RTL_GIGA_MAC_VER_63] = {"RTL8125B", FIRMWARE_8125B_2}, + [RTL_GIGA_MAC_VER_64] = {"RTL8125D", FIRMWARE_8125D_1}, ++ [RTL_GIGA_MAC_VER_65] = {"RTL8125D", FIRMWARE_8125D_2}, + [RTL_GIGA_MAC_VER_70] = {"RTL8126A", FIRMWARE_8126A_2}, + [RTL_GIGA_MAC_VER_71] = {"RTL8126A", FIRMWARE_8126A_3}, + }; +@@ -706,6 +708,7 @@ MODULE_FIRMWARE(FIRMWARE_8107E_2); + MODULE_FIRMWARE(FIRMWARE_8125A_3); + MODULE_FIRMWARE(FIRMWARE_8125B_2); + MODULE_FIRMWARE(FIRMWARE_8125D_1); ++MODULE_FIRMWARE(FIRMWARE_8125D_2); + MODULE_FIRMWARE(FIRMWARE_8126A_2); + MODULE_FIRMWARE(FIRMWARE_8126A_3); + +@@ -2260,6 +2263,7 @@ static enum mac_version rtl8169_get_mac_ + { 0x7cf, 0x649, RTL_GIGA_MAC_VER_70 }, + + /* 8125D family. */ ++ { 0x7cf, 0x689, RTL_GIGA_MAC_VER_65 }, + { 0x7cf, 0x688, RTL_GIGA_MAC_VER_64 }, + + /* 8125B family. */ +@@ -3840,6 +3844,7 @@ static void rtl_hw_config(struct rtl8169 + [RTL_GIGA_MAC_VER_61] = rtl_hw_start_8125a_2, + [RTL_GIGA_MAC_VER_63] = rtl_hw_start_8125b, + [RTL_GIGA_MAC_VER_64] = rtl_hw_start_8125d, ++ [RTL_GIGA_MAC_VER_65] = rtl_hw_start_8125d, + [RTL_GIGA_MAC_VER_70] = rtl_hw_start_8126a, + [RTL_GIGA_MAC_VER_71] = rtl_hw_start_8126a, + }; +@@ -3858,6 +3863,7 @@ static void rtl_hw_start_8125(struct rtl + switch (tp->mac_version) { + case RTL_GIGA_MAC_VER_61: + case RTL_GIGA_MAC_VER_64: ++ case RTL_GIGA_MAC_VER_65: + for (i = 0xa00; i < 0xb00; i += 4) + RTL_W32(tp, i, 0); + break; +--- a/drivers/net/ethernet/realtek/r8169_phy_config.c ++++ b/drivers/net/ethernet/realtek/r8169_phy_config.c +@@ -1162,6 +1162,7 @@ void r8169_hw_phy_config(struct rtl8169_ + [RTL_GIGA_MAC_VER_61] = rtl8125a_2_hw_phy_config, + [RTL_GIGA_MAC_VER_63] = rtl8125b_hw_phy_config, + [RTL_GIGA_MAC_VER_64] = rtl8125d_hw_phy_config, ++ [RTL_GIGA_MAC_VER_65] = rtl8125d_hw_phy_config, + [RTL_GIGA_MAC_VER_70] = rtl8126a_hw_phy_config, + [RTL_GIGA_MAC_VER_71] = rtl8126a_hw_phy_config, + }; diff --git a/target/linux/generic/backport-6.6/780-49-v6.14-r8169-add-support-for-RTL8125BP-rev.b.patch b/target/linux/generic/backport-6.6/780-49-v6.14-r8169-add-support-for-RTL8125BP-rev.b.patch new file mode 100644 index 00000000000000..f101bdc6fb7471 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-49-v6.14-r8169-add-support-for-RTL8125BP-rev.b.patch @@ -0,0 +1,184 @@ +From b11bff90f2ad52c5c55c822ecd20326619a73898 Mon Sep 17 00:00:00 2001 +From: ChunHao Lin +Date: Tue, 7 Jan 2025 14:43:55 +0800 +Subject: [PATCH] r8169: add support for RTL8125BP rev.b + +Add support for RTL8125BP rev.b. Its XID is 0x689. This chip supports +DASH and its dash type is "RTL_DASH_25_BP". + +Signed-off-by: ChunHao Lin +Reviewed-by: Heiner Kallweit +Link: https://patch.msgid.link/20250107064355.104711-1-hau@realtek.com +Signed-off-by: Paolo Abeni +--- + drivers/net/ethernet/realtek/r8169.h | 1 + + drivers/net/ethernet/realtek/r8169_main.c | 30 +++++++++++++++++++ + .../net/ethernet/realtek/r8169_phy_config.c | 23 ++++++++++++++ + 3 files changed, 54 insertions(+) + +--- a/drivers/net/ethernet/realtek/r8169.h ++++ b/drivers/net/ethernet/realtek/r8169.h +@@ -70,6 +70,7 @@ enum mac_version { + RTL_GIGA_MAC_VER_63, + RTL_GIGA_MAC_VER_64, + RTL_GIGA_MAC_VER_65, ++ RTL_GIGA_MAC_VER_66, + RTL_GIGA_MAC_VER_70, + RTL_GIGA_MAC_VER_71, + RTL_GIGA_MAC_NONE +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -57,6 +57,7 @@ + #define FIRMWARE_8125B_2 "rtl_nic/rtl8125b-2.fw" + #define FIRMWARE_8125D_1 "rtl_nic/rtl8125d-1.fw" + #define FIRMWARE_8125D_2 "rtl_nic/rtl8125d-2.fw" ++#define FIRMWARE_8125BP_2 "rtl_nic/rtl8125bp-2.fw" + #define FIRMWARE_8126A_2 "rtl_nic/rtl8126a-2.fw" + #define FIRMWARE_8126A_3 "rtl_nic/rtl8126a-3.fw" + +@@ -141,6 +142,7 @@ static const struct { + [RTL_GIGA_MAC_VER_63] = {"RTL8125B", FIRMWARE_8125B_2}, + [RTL_GIGA_MAC_VER_64] = {"RTL8125D", FIRMWARE_8125D_1}, + [RTL_GIGA_MAC_VER_65] = {"RTL8125D", FIRMWARE_8125D_2}, ++ [RTL_GIGA_MAC_VER_66] = {"RTL8125BP", FIRMWARE_8125BP_2}, + [RTL_GIGA_MAC_VER_70] = {"RTL8126A", FIRMWARE_8126A_2}, + [RTL_GIGA_MAC_VER_71] = {"RTL8126A", FIRMWARE_8126A_3}, + }; +@@ -632,6 +634,7 @@ enum rtl_dash_type { + RTL_DASH_NONE, + RTL_DASH_DP, + RTL_DASH_EP, ++ RTL_DASH_25_BP, + }; + + struct rtl8169_private { +@@ -709,6 +712,7 @@ MODULE_FIRMWARE(FIRMWARE_8125A_3); + MODULE_FIRMWARE(FIRMWARE_8125B_2); + MODULE_FIRMWARE(FIRMWARE_8125D_1); + MODULE_FIRMWARE(FIRMWARE_8125D_2); ++MODULE_FIRMWARE(FIRMWARE_8125BP_2); + MODULE_FIRMWARE(FIRMWARE_8126A_2); + MODULE_FIRMWARE(FIRMWARE_8126A_3); + +@@ -1361,10 +1365,19 @@ static void rtl8168ep_driver_start(struc + rtl_loop_wait_high(tp, &rtl_ep_ocp_read_cond, 10000, 30); + } + ++static void rtl8125bp_driver_start(struct rtl8169_private *tp) ++{ ++ r8168ep_ocp_write(tp, 0x01, 0x14, OOB_CMD_DRIVER_START); ++ r8168ep_ocp_write(tp, 0x01, 0x18, 0x00); ++ r8168ep_ocp_write(tp, 0x01, 0x10, 0x01); ++} ++ + static void rtl8168_driver_start(struct rtl8169_private *tp) + { + if (tp->dash_type == RTL_DASH_DP) + rtl8168dp_driver_start(tp); ++ else if (tp->dash_type == RTL_DASH_25_BP) ++ rtl8125bp_driver_start(tp); + else + rtl8168ep_driver_start(tp); + } +@@ -1385,10 +1398,19 @@ static void rtl8168ep_driver_stop(struct + rtl_loop_wait_low(tp, &rtl_ep_ocp_read_cond, 10000, 10); + } + ++static void rtl8125bp_driver_stop(struct rtl8169_private *tp) ++{ ++ r8168ep_ocp_write(tp, 0x01, 0x14, OOB_CMD_DRIVER_STOP); ++ r8168ep_ocp_write(tp, 0x01, 0x18, 0x00); ++ r8168ep_ocp_write(tp, 0x01, 0x10, 0x01); ++} ++ + static void rtl8168_driver_stop(struct rtl8169_private *tp) + { + if (tp->dash_type == RTL_DASH_DP) + rtl8168dp_driver_stop(tp); ++ else if (tp->dash_type == RTL_DASH_25_BP) ++ rtl8125bp_driver_stop(tp); + else + rtl8168ep_driver_stop(tp); + } +@@ -1411,6 +1433,7 @@ static bool rtl_dash_is_enabled(struct r + case RTL_DASH_DP: + return r8168dp_check_dash(tp); + case RTL_DASH_EP: ++ case RTL_DASH_25_BP: + return r8168ep_check_dash(tp); + default: + return false; +@@ -1425,6 +1448,8 @@ static enum rtl_dash_type rtl_get_dash_t + return RTL_DASH_DP; + case RTL_GIGA_MAC_VER_51 ... RTL_GIGA_MAC_VER_53: + return RTL_DASH_EP; ++ case RTL_GIGA_MAC_VER_66: ++ return RTL_DASH_25_BP; + default: + return RTL_DASH_NONE; + } +@@ -2262,6 +2287,9 @@ static enum mac_version rtl8169_get_mac_ + { 0x7cf, 0x64a, RTL_GIGA_MAC_VER_71 }, + { 0x7cf, 0x649, RTL_GIGA_MAC_VER_70 }, + ++ /* 8125BP family. */ ++ { 0x7cf, 0x681, RTL_GIGA_MAC_VER_66 }, ++ + /* 8125D family. */ + { 0x7cf, 0x689, RTL_GIGA_MAC_VER_65 }, + { 0x7cf, 0x688, RTL_GIGA_MAC_VER_64 }, +@@ -3845,6 +3873,7 @@ static void rtl_hw_config(struct rtl8169 + [RTL_GIGA_MAC_VER_63] = rtl_hw_start_8125b, + [RTL_GIGA_MAC_VER_64] = rtl_hw_start_8125d, + [RTL_GIGA_MAC_VER_65] = rtl_hw_start_8125d, ++ [RTL_GIGA_MAC_VER_66] = rtl_hw_start_8125d, + [RTL_GIGA_MAC_VER_70] = rtl_hw_start_8126a, + [RTL_GIGA_MAC_VER_71] = rtl_hw_start_8126a, + }; +@@ -3864,6 +3893,7 @@ static void rtl_hw_start_8125(struct rtl + case RTL_GIGA_MAC_VER_61: + case RTL_GIGA_MAC_VER_64: + case RTL_GIGA_MAC_VER_65: ++ case RTL_GIGA_MAC_VER_66: + for (i = 0xa00; i < 0xb00; i += 4) + RTL_W32(tp, i, 0); + break; +--- a/drivers/net/ethernet/realtek/r8169_phy_config.c ++++ b/drivers/net/ethernet/realtek/r8169_phy_config.c +@@ -1102,6 +1102,28 @@ static void rtl8125d_hw_phy_config(struc + rtl8125_config_eee_phy(phydev); + } + ++static void rtl8125bp_hw_phy_config(struct rtl8169_private *tp, ++ struct phy_device *phydev) ++{ ++ r8169_apply_firmware(tp); ++ rtl8168g_enable_gphy_10m(phydev); ++ ++ r8168g_phy_param(phydev, 0x8010, 0x0800, 0x0000); ++ ++ phy_write(phydev, 0x1f, 0x0b87); ++ phy_write(phydev, 0x16, 0x8088); ++ phy_modify(phydev, 0x17, 0xff00, 0x9000); ++ phy_write(phydev, 0x16, 0x808f); ++ phy_modify(phydev, 0x17, 0xff00, 0x9000); ++ phy_write(phydev, 0x1f, 0x0000); ++ ++ r8168g_phy_param(phydev, 0x8174, 0x2000, 0x1800); ++ ++ rtl8125_legacy_force_mode(phydev); ++ rtl8168g_disable_aldps(phydev); ++ rtl8125_config_eee_phy(phydev); ++} ++ + static void rtl8126a_hw_phy_config(struct rtl8169_private *tp, + struct phy_device *phydev) + { +@@ -1163,6 +1185,7 @@ void r8169_hw_phy_config(struct rtl8169_ + [RTL_GIGA_MAC_VER_63] = rtl8125b_hw_phy_config, + [RTL_GIGA_MAC_VER_64] = rtl8125d_hw_phy_config, + [RTL_GIGA_MAC_VER_65] = rtl8125d_hw_phy_config, ++ [RTL_GIGA_MAC_VER_66] = rtl8125bp_hw_phy_config, + [RTL_GIGA_MAC_VER_70] = rtl8126a_hw_phy_config, + [RTL_GIGA_MAC_VER_71] = rtl8126a_hw_phy_config, + }; From 92e020b50f04535009c91aa708bdb7598f1d9d4a Mon Sep 17 00:00:00 2001 From: Mieczyslaw Nalewaj Date: Thu, 23 Jan 2025 18:07:22 +0100 Subject: [PATCH 445/877] mt76: update to Git HEAD (2025-01-22) 3e85822b9c66 page_pool: remove PP_FLAG_PAGE_FRAG a22d59e4ad50 tools: fix allocation check and missing memory freeing Signed-off-by: Felix Fietkau Signed-off-by: Mieczyslaw Nalewaj (cherry picked from commit 17dc079) Link: https://github.com/openwrt/openwrt/pull/17707 Signed-off-by: Robert Marko --- 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 cd168f49bcc0dd..ef2c619885c9c2 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:=2025-01-14 -PKG_SOURCE_VERSION:=8e4f72b682e9070108536507c5e2720b18c3816d -PKG_MIRROR_HASH:=fa8c5a2ece9e7287605910d9f906b601711c7863613addaadd666f9e3858a9e7 +PKG_SOURCE_DATE:=2025-01-22 +PKG_SOURCE_VERSION:=a22d59e4ad50c89326342a0736cd2c1ba32e8a0b +PKG_MIRROR_HASH:=e8bbbada2171ea31a6788e3e46e81c409a9fe038eefe4b41f541da848a1b1bcd PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 From 7609571dcd9383439d34320d27f963cc81014c76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Wed, 5 Feb 2025 08:49:20 +0100 Subject: [PATCH 446/877] kernel: r8168: update to v8.055.00 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changelog: https://github.com/openwrt/rtl8168/compare/8.054.00...8.055.00 Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 5dd763680e874b0082e4cfbbc729fa75ee056601) --- package/kernel/r8168/Makefile | 4 ++-- .../001-r8168_n-fix-proc_dump_rx_desc_2-on-32-bits.patch | 2 +- .../200-r8168-print-link-speed-and-duplex-mode.patch | 8 +++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/package/kernel/r8168/Makefile b/package/kernel/r8168/Makefile index 2604425deac2bc..0b846113df6d93 100644 --- a/package/kernel/r8168/Makefile +++ b/package/kernel/r8168/Makefile @@ -1,12 +1,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=r8168 -PKG_VERSION:=8.054.00 +PKG_VERSION:=8.055.00 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://github.com/openwrt/rtl8168/releases/download/$(PKG_VERSION) -PKG_HASH:=5480120cf823e991e8cbd325118c1ec0c57d8f42760ba1a7334bd07d291d235d +PKG_HASH:=61deb2a9cb7d6b08748ad51734b108da95d629712b64b204e2e6bd3f16d0a48f PKG_BUILD_PARALLEL:=1 PKG_LICENSE:=GPLv2 diff --git a/package/kernel/r8168/patches/001-r8168_n-fix-proc_dump_rx_desc_2-on-32-bits.patch b/package/kernel/r8168/patches/001-r8168_n-fix-proc_dump_rx_desc_2-on-32-bits.patch index b53819a0cbb90e..bb00411e06094d 100644 --- a/package/kernel/r8168/patches/001-r8168_n-fix-proc_dump_rx_desc_2-on-32-bits.patch +++ b/package/kernel/r8168/patches/001-r8168_n-fix-proc_dump_rx_desc_2-on-32-bits.patch @@ -13,7 +13,7 @@ Signed-off-by: Álvaro Fernández Rojas --- a/src/r8168_n.c +++ b/src/r8168_n.c -@@ -1655,9 +1655,9 @@ static int proc_dump_rx_desc_2(struct se +@@ -1668,9 +1668,9 @@ static int proc_dump_rx_desc_2(struct se j, k); for (i=0; i<(tp->RxDescLength/4); i++) { if (!(i % 4)) diff --git a/package/kernel/r8168/patches/200-r8168-print-link-speed-and-duplex-mode.patch b/package/kernel/r8168/patches/200-r8168-print-link-speed-and-duplex-mode.patch index 41162b4d9b11fb..150c41d63249ab 100644 --- a/package/kernel/r8168/patches/200-r8168-print-link-speed-and-duplex-mode.patch +++ b/package/kernel/r8168/patches/200-r8168-print-link-speed-and-duplex-mode.patch @@ -18,7 +18,7 @@ Signed-off-by: Chukun Pan --- a/src/r8168.h +++ b/src/r8168.h -@@ -1468,6 +1468,8 @@ enum RTL8168_register_content { +@@ -1480,6 +1480,8 @@ enum RTL8168_register_content { LinkStatus = 0x02, FullDup = 0x01, @@ -37,7 +37,7 @@ Signed-off-by: Chukun Pan #include #include #include -@@ -5369,6 +5370,36 @@ rtl8168_link_down_patch(struct net_devic +@@ -5396,6 +5397,38 @@ rtl8168_link_down_patch(struct net_devic #endif } @@ -66,6 +66,8 @@ Signed-off-by: Chukun Pan + speed = SPEED_100; + else if (status & _10bps) + speed = SPEED_10; ++ else if (eee_giga_lite) ++ speed = SPEED_1000; + } + + return speed; @@ -74,7 +76,7 @@ Signed-off-by: Chukun Pan static void rtl8168_check_link_status(struct net_device *dev) { -@@ -5388,11 +5419,18 @@ rtl8168_check_link_status(struct net_dev +@@ -5415,11 +5448,18 @@ rtl8168_check_link_status(struct net_dev if (link_status_on) { rtl8168_link_on_patch(dev); From 8cd50a6aeca3aaef5c391fb092e273d6b4c92f70 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 7 Feb 2025 11:11:42 +0100 Subject: [PATCH 447/877] build: conditionally build llvm bpf toolchain by default Unless another toolchain is present (or selected), build the bpf toolchain whenever a package is selected that needs it. Signed-off-by: Felix Fietkau (cherry picked from commit 6605e45676815156f0c47d4117ee401e6616fcac) --- include/bpf.mk | 2 +- package/network/services/unetd/Makefile | 1 + toolchain/Config.in | 14 +++++++------- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/include/bpf.mk b/include/bpf.mk index 2b7aa8512c2cb9..8a0121aabec042 100644 --- a/include/bpf.mk +++ b/include/bpf.mk @@ -1,4 +1,4 @@ -BPF_DEPENDS := @HAS_BPF_TOOLCHAIN +BPF_DEPENDS := @HAS_BPF_TOOLCHAIN +@NEED_BPF_TOOLCHAIN LLVM_VER:= CLANG_MIN_VER:=12 diff --git a/package/network/services/unetd/Makefile b/package/network/services/unetd/Makefile index c3875219985848..66d27ff6b92844 100644 --- a/package/network/services/unetd/Makefile +++ b/package/network/services/unetd/Makefile @@ -40,6 +40,7 @@ define Package/unetd/config bool "VXLAN support" depends on PACKAGE_unetd depends on HAS_BPF_TOOLCHAIN + select NEED_BPF_TOOLCHAIN default y endef diff --git a/toolchain/Config.in b/toolchain/Config.in index b4ba5b3b677cf9..71ebbeb47bf2a0 100644 --- a/toolchain/Config.in +++ b/toolchain/Config.in @@ -40,9 +40,8 @@ menuconfig TARGET_OPTIONS choice BPF_TOOLCHAIN prompt "BPF toolchain" if DEVEL - default BPF_TOOLCHAIN_BUILD_LLVM if BUILDBOT default BPF_TOOLCHAIN_PREBUILT if HAS_PREBUILT_LLVM_TOOLCHAIN - default BPF_TOOLCHAIN_NONE + default BPF_TOOLCHAIN_BUILD_LLVM config BPF_TOOLCHAIN_NONE bool "None" @@ -57,7 +56,7 @@ menuconfig TARGET_OPTIONS bool "Use host LLVM toolchain" config BPF_TOOLCHAIN_BUILD_LLVM - select USE_LLVM_BUILD + select USE_LLVM_BUILD if NEED_BPF_TOOLCHAIN bool "Build LLVM toolchain for eBPF" help If enabled, a LLVM toolchain for building eBPF binaries will be built. @@ -320,23 +319,24 @@ config GDB_PYTHON Enable the python bindings for GDB to allow using python in the gdb shell. config HAS_BPF_TOOLCHAIN + default y if !BPF_TOOLCHAIN_NONE + bool + +config NEED_BPF_TOOLCHAIN bool config HAS_PREBUILT_LLVM_TOOLCHAIN def_bool $(shell, [ -f llvm-bpf/.llvm-version ] && echo y || echo n) config USE_LLVM_HOST - select HAS_BPF_TOOLCHAIN bool config USE_LLVM_PREBUILT - select HAS_BPF_TOOLCHAIN default y if !DEVEL && !BUILDBOT && HAS_PREBUILT_LLVM_TOOLCHAIN bool config USE_LLVM_BUILD - default y if !DEVEL && BUILDBOT - select HAS_BPF_TOOLCHAIN + default y if !DEVEL && NEED_BPF_TOOLCHAIN && (BUILDBOT || !HAS_PREBUILT_LLVM_TOOLCHAIN) bool config USE_GLIBC From 122b637889c4bd3463e2ca4f07008b067ac19591 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 8 Feb 2025 22:27:27 +0100 Subject: [PATCH 448/877] umdns: add firewall rule for configured interfaces Makes it easier to enable MDNS on wan without having to edit the firewall configuration for it Signed-off-by: Felix Fietkau (cherry picked from commit 05138fe898ce2d102795bdc979a6d874a3d24424) --- package/network/services/umdns/files/umdns.init | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/package/network/services/umdns/files/umdns.init b/package/network/services/umdns/files/umdns.init index e9a2c05e093e30..61b2a338d677f6 100644 --- a/package/network/services/umdns/files/umdns.init +++ b/package/network/services/umdns/files/umdns.init @@ -35,6 +35,23 @@ start_service() { procd_set_param command "$PROG" [ -f /etc/seccomp/umdns.json ] && procd_set_param seccomp /etc/seccomp/umdns.json procd_set_param respawn + + procd_open_data + json_add_array firewall + + for n in $network; do + json_add_object "" + json_add_string type rule + json_add_string proto udp + json_add_string src "$n" + json_add_int dest_port 5353 + json_add_string target ACCEPT + json_close_object + done + + json_close_array + procd_close_data + procd_open_trigger procd_add_config_trigger "config.change" "umdns" /etc/init.d/umdns reload for n in $network; do From 37cc725b1aee994f86cd54f5a7fe10eb20a1eaf0 Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Tue, 4 Feb 2025 15:55:08 +0000 Subject: [PATCH 449/877] kernel: nmbm: add mediatek,bmt-mtd-overridden-oobsize property This commit adds new "mediatek,bmt-mtd-overridden-oobsize" property. The property helps avoid "NMBM configuration mismatch" error if mtd "OOB size" is not equal to the "spare size" which is stored in the nmbm signature. Signed-off-by: Mikhail Zhilkin Link: https://github.com/openwrt/openwrt/pull/17549 Signed-off-by: Robert Marko (cherry picked from commit e585ae70d4f2a563b3b0e430e15ee19ad25caeb5) Signed-off-by: Mikhail Zhilkin Link: https://github.com/openwrt/openwrt/pull/17898 Signed-off-by: Hauke Mehrtens --- target/linux/generic/files/drivers/mtd/nand/mtk_bmt.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/target/linux/generic/files/drivers/mtd/nand/mtk_bmt.c b/target/linux/generic/files/drivers/mtd/nand/mtk_bmt.c index bcff7d6ac82076..063adb50fb6062 100644 --- a/target/linux/generic/files/drivers/mtd/nand/mtk_bmt.c +++ b/target/linux/generic/files/drivers/mtd/nand/mtk_bmt.c @@ -407,6 +407,7 @@ int mtk_bmt_attach(struct mtd_info *mtd) { struct device_node *np; int ret = 0; + u32 overridden_oobsize = 0; if (bmtd.mtd) return -ENOSPC; @@ -431,6 +432,14 @@ int mtk_bmt_attach(struct mtd_info *mtd) bmtd.mtd = mtd; mtk_bmt_replace_ops(mtd); + if (!of_property_read_u32(np, "mediatek,bmt-mtd-overridden-oobsize", + &overridden_oobsize)) + if (overridden_oobsize < bmtd.mtd->oobsize) { + bmtd.mtd->oobsize = overridden_oobsize; + pr_info("NMBM: mtd OOB size has been overridden to %luB\n", + (long unsigned int)bmtd.mtd->oobsize); + } + bmtd.blk_size = mtd->erasesize; bmtd.blk_shift = ffs(bmtd.blk_size) - 1; bmtd.pg_size = mtd->writesize; From db30b60bf13b17d24b4d3643780d1658cac24974 Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Tue, 4 Feb 2025 16:08:53 +0000 Subject: [PATCH 450/877] mediatek: fix nmbm configuration mismatch (Xiaomi AX3000t) This commit fixes nmbm configuration mismatch error on Xiaomi AX3000t with Winbond W25N01KVZEIR spi-nand: ''' [ 0.786783] NMBM configuration mismatch ''' Root cause: 1. U-Boot W25N01KV spi-nand driver ia compiled with 64B OOB size for the chip and store this size in the nmbm signature; 2. Linux W25N01KV driver use 96B OOB. The change doesn't affect AX3000t variants with other spi-nand chips (ESMT, Foresee) because their Linux drivers use 64B OOB. Fixes: openwrt#16972 Tested-by: Aleksandr Danilov Signed-off-by: Mikhail Zhilkin Link: https://github.com/openwrt/openwrt/pull/17549 Signed-off-by: Robert Marko (cherry picked from commit 3299d19c01080c3320e3ff6964d7825da81bb8b4) Signed-off-by: Mikhail Zhilkin Link: https://github.com/openwrt/openwrt/pull/17898 Signed-off-by: Hauke Mehrtens --- target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-ax3000t.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-ax3000t.dts b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-ax3000t.dts index cc0d44fdf5d48d..d4b11cbe048004 100644 --- a/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-ax3000t.dts +++ b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-ax3000t.dts @@ -12,6 +12,7 @@ mediatek,nmbm; mediatek,bmt-max-ratio = <1>; mediatek,bmt-max-reserved-blocks = <64>; + mediatek,bmt-mtd-overridden-oobsize = <64>; }; &partitions { From fa64175e1ac66b63887fafe9916f4eb0698b9b18 Mon Sep 17 00:00:00 2001 From: Tim Harvey Date: Tue, 17 Dec 2024 14:51:57 -0800 Subject: [PATCH 451/877] generic: 6.6: add backported btsdio patch for cyw437 Add a backport of a btsdio patch for the cyw437 bluetooth controller. Signed-off-by: Tim Harvey Link: https://github.com/openwrt/openwrt/pull/17717 Signed-off-by: Robert Marko Link: https://github.com/openwrt/openwrt/pull/17762 Signed-off-by: Hauke Mehrtens (cherry picked from commit c9f11523dd5b8639b24b97043d70f2a197a00a84) --- ...-Do-not-bind-to-non-removable-CYW437.patch | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 target/linux/generic/backport-6.6/903-v6.12-Bluetooth-btsdio-Do-not-bind-to-non-removable-CYW437.patch diff --git a/target/linux/generic/backport-6.6/903-v6.12-Bluetooth-btsdio-Do-not-bind-to-non-removable-CYW437.patch b/target/linux/generic/backport-6.6/903-v6.12-Bluetooth-btsdio-Do-not-bind-to-non-removable-CYW437.patch new file mode 100644 index 00000000000000..09c3938ff5db5e --- /dev/null +++ b/target/linux/generic/backport-6.6/903-v6.12-Bluetooth-btsdio-Do-not-bind-to-non-removable-CYW437.patch @@ -0,0 +1,25 @@ +From 6a9eb32230f33ae273f6ffbabb0aaf560869816e Mon Sep 17 00:00:00 2001 +From: Scott Ehlert +Date: Mon, 29 Apr 2024 11:23:09 -0700 +Subject: [PATCH] Bluetooth: btsdio: Do not bind to non-removable CYW4373 + +CYW4373 devices soldered onto the PCB (non-removable), +use a UART connection for Bluetooth and the advertised btsdio +support as an SDIO function should be ignored. + +Signed-off-by: Scott Ehlert +Signed-off-by: Tim Harvey +--- + drivers/bluetooth/btsdio.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/bluetooth/btsdio.c ++++ b/drivers/bluetooth/btsdio.c +@@ -295,6 +295,7 @@ static int btsdio_probe(struct sdio_func + case SDIO_DEVICE_ID_BROADCOM_4345: + case SDIO_DEVICE_ID_BROADCOM_43455: + case SDIO_DEVICE_ID_BROADCOM_4356: ++ case SDIO_DEVICE_ID_BROADCOM_CYPRESS_4373: + return -ENODEV; + } + } From e2b064f5a4bafc28fe73b2cd4c35bb78acd992c9 Mon Sep 17 00:00:00 2001 From: Tim Harvey Date: Tue, 17 Dec 2024 14:50:51 -0800 Subject: [PATCH 452/877] imx: 6.6: add some backported kernel patches for Gateworks Venice Add several dt backports for the Gateworks Venice product family. Signed-off-by: Tim Harvey Link: https://github.com/openwrt/openwrt/pull/17717 Signed-off-by: Robert Marko Link: https://github.com/openwrt/openwrt/pull/17762 Signed-off-by: Hauke Mehrtens (cherry picked from commit 1ce87cf25c19f030b81954639545db2ab7f17062) --- ...64-dts-imx8mm-venice-add-RTC-aliases.patch | 189 +++ ...-venice-gw74xx-add-M2SKT_GPIO10-gpio.patch | 36 + ...ts-freescale-rename-gw7905-to-gw75xx.patch | 1426 +++++++++++++++++ ...nice-gw75xx-add-Accelerometer-device.patch | 79 + ...X8M-Plus-Gateworks-GW82XX-2X-support.patch | 1107 +++++++++++++ 5 files changed, 2837 insertions(+) create mode 100644 target/linux/imx/patches-6.6/500-6.13-arm64-dts-imx8mm-venice-add-RTC-aliases.patch create mode 100644 target/linux/imx/patches-6.6/501-6.13-arm64-dts-imx8mp-venice-gw74xx-add-M2SKT_GPIO10-gpio.patch create mode 100644 target/linux/imx/patches-6.6/502-6.13-arm64-dts-freescale-rename-gw7905-to-gw75xx.patch create mode 100644 target/linux/imx/patches-6.6/503-6.13-arm64-dts-imx8m-venice-gw75xx-add-Accelerometer-device.patch create mode 100644 target/linux/imx/patches-6.6/504-6.13-arm64-dts-imx-Add-i.MX8M-Plus-Gateworks-GW82XX-2X-support.patch diff --git a/target/linux/imx/patches-6.6/500-6.13-arm64-dts-imx8mm-venice-add-RTC-aliases.patch b/target/linux/imx/patches-6.6/500-6.13-arm64-dts-imx8mm-venice-add-RTC-aliases.patch new file mode 100644 index 00000000000000..2d398defc47f68 --- /dev/null +++ b/target/linux/imx/patches-6.6/500-6.13-arm64-dts-imx8mm-venice-add-RTC-aliases.patch @@ -0,0 +1,189 @@ +From 82b521f4bb8cab09aa016acf2c1b55ffc736eb2e Mon Sep 17 00:00:00 2001 +From: Tim Harvey +Date: Mon, 9 Sep 2024 15:15:01 -0700 +Subject: [PATCH] arm64: dts: imx8mm-venice-*: add RTC aliases + +Add aliases for the RTCs on the Gateworks Venice boards and on the imx8m +SoC. This ensures that the primary RTC is always the one on-board +provided by the Gateworks System Controller (GSC) which is battery +backed as opposed to the one in the IMX8M. + +Signed-off-by: Tim Harvey +Signed-off-by: Shawn Guo +--- + arch/arm64/boot/dts/freescale/imx8mm-venice-gw700x.dtsi | 7 ++++++- + arch/arm64/boot/dts/freescale/imx8mm-venice-gw7901.dts | 4 +++- + arch/arm64/boot/dts/freescale/imx8mm-venice-gw7902.dts | 4 +++- + arch/arm64/boot/dts/freescale/imx8mm-venice-gw7903.dts | 4 +++- + arch/arm64/boot/dts/freescale/imx8mm-venice-gw7904.dts | 7 ++++++- + arch/arm64/boot/dts/freescale/imx8mn-venice-gw7902.dts | 4 +++- + arch/arm64/boot/dts/freescale/imx8mp-venice-gw702x.dtsi | 4 +++- + arch/arm64/boot/dts/freescale/imx8mp-venice-gw74xx.dts | 4 +++- + 8 files changed, 30 insertions(+), 8 deletions(-) + +--- a/arch/arm64/boot/dts/freescale/imx8mm-venice-gw700x.dtsi ++++ b/arch/arm64/boot/dts/freescale/imx8mm-venice-gw700x.dtsi +@@ -8,6 +8,11 @@ + #include + + / { ++ aliases { ++ rtc0 = &gsc_rtc; ++ rtc1 = &snvs_rtc; ++ }; ++ + memory@40000000 { + device_type = "memory"; + reg = <0x0 0x40000000 0 0x80000000>; +@@ -272,7 +277,7 @@ + pagesize = <16>; + }; + +- rtc@68 { ++ gsc_rtc: rtc@68 { + compatible = "dallas,ds1672"; + reg = <0x68>; + }; +--- a/arch/arm64/boot/dts/freescale/imx8mm-venice-gw7901.dts ++++ b/arch/arm64/boot/dts/freescale/imx8mm-venice-gw7901.dts +@@ -22,6 +22,8 @@ + ethernet2 = &lan2; + ethernet3 = &lan3; + ethernet4 = &lan4; ++ rtc0 = &gsc_rtc; ++ rtc1 = &snvs_rtc; + usb0 = &usbotg1; + usb1 = &usbotg2; + }; +@@ -495,7 +497,7 @@ + pagesize = <16>; + }; + +- rtc@68 { ++ gsc_rtc: rtc@68 { + compatible = "dallas,ds1672"; + reg = <0x68>; + }; +--- a/arch/arm64/boot/dts/freescale/imx8mm-venice-gw7902.dts ++++ b/arch/arm64/boot/dts/freescale/imx8mm-venice-gw7902.dts +@@ -19,6 +19,8 @@ + + aliases { + ethernet1 = ð1; ++ rtc0 = &gsc_rtc; ++ rtc1 = &snvs_rtc; + usb0 = &usbotg1; + usb1 = &usbotg2; + }; +@@ -562,7 +564,7 @@ + pagesize = <16>; + }; + +- rtc@68 { ++ gsc_rtc: rtc@68 { + compatible = "dallas,ds1672"; + reg = <0x68>; + }; +--- a/arch/arm64/boot/dts/freescale/imx8mm-venice-gw7903.dts ++++ b/arch/arm64/boot/dts/freescale/imx8mm-venice-gw7903.dts +@@ -18,6 +18,8 @@ + + aliases { + ethernet0 = &fec1; ++ rtc0 = &gsc_rtc; ++ rtc1 = &snvs_rtc; + usb0 = &usbotg1; + }; + +@@ -392,7 +394,7 @@ + pagesize = <16>; + }; + +- rtc@68 { ++ gsc_rtc: rtc@68 { + compatible = "dallas,ds1672"; + reg = <0x68>; + }; +--- a/arch/arm64/boot/dts/freescale/imx8mm-venice-gw7904.dts ++++ b/arch/arm64/boot/dts/freescale/imx8mm-venice-gw7904.dts +@@ -16,6 +16,11 @@ + model = "Gateworks Venice GW7904 i.MX8MM board"; + compatible = "gateworks,imx8mm-gw7904", "fsl,imx8mm"; + ++ aliases { ++ rtc0 = &gsc_rtc; ++ rtc1 = &snvs_rtc; ++ }; ++ + chosen { + stdout-path = &uart2; + }; +@@ -436,7 +441,7 @@ + pagesize = <16>; + }; + +- rtc@68 { ++ gsc_rtc: rtc@68 { + compatible = "dallas,ds1672"; + reg = <0x68>; + }; +--- a/arch/arm64/boot/dts/freescale/imx8mn-venice-gw7902.dts ++++ b/arch/arm64/boot/dts/freescale/imx8mn-venice-gw7902.dts +@@ -17,6 +17,8 @@ + compatible = "gw,imx8mn-gw7902", "fsl,imx8mn"; + + aliases { ++ rtc0 = &gsc_rtc; ++ rtc1 = &snvs_rtc; + usb0 = &usbotg1; + }; + +@@ -560,7 +562,7 @@ + pagesize = <16>; + }; + +- rtc@68 { ++ gsc_rtc: rtc@68 { + compatible = "dallas,ds1672"; + reg = <0x68>; + }; +--- a/arch/arm64/boot/dts/freescale/imx8mp-venice-gw702x.dtsi ++++ b/arch/arm64/boot/dts/freescale/imx8mp-venice-gw702x.dtsi +@@ -10,6 +10,8 @@ + / { + aliases { + ethernet0 = &eqos; ++ rtc0 = &gsc_rtc; ++ rtc1 = &snvs_rtc; + }; + + memory@40000000 { +@@ -260,7 +262,7 @@ + pagesize = <16>; + }; + +- rtc@68 { ++ gsc_rtc: rtc@68 { + compatible = "dallas,ds1672"; + reg = <0x68>; + }; +--- a/arch/arm64/boot/dts/freescale/imx8mp-venice-gw74xx.dts ++++ b/arch/arm64/boot/dts/freescale/imx8mp-venice-gw74xx.dts +@@ -24,6 +24,8 @@ + ethernet4 = &lan3; + ethernet5 = &lan4; + ethernet6 = &lan5; ++ rtc0 = &gsc_rtc; ++ rtc1 = &snvs_rtc; + }; + + chosen { +@@ -444,7 +446,7 @@ + pagesize = <16>; + }; + +- rtc@68 { ++ gsc_rtc: rtc@68 { + compatible = "dallas,ds1672"; + reg = <0x68>; + }; diff --git a/target/linux/imx/patches-6.6/501-6.13-arm64-dts-imx8mp-venice-gw74xx-add-M2SKT_GPIO10-gpio.patch b/target/linux/imx/patches-6.6/501-6.13-arm64-dts-imx8mp-venice-gw74xx-add-M2SKT_GPIO10-gpio.patch new file mode 100644 index 00000000000000..14c8f88e319797 --- /dev/null +++ b/target/linux/imx/patches-6.6/501-6.13-arm64-dts-imx8mp-venice-gw74xx-add-M2SKT_GPIO10-gpio.patch @@ -0,0 +1,36 @@ +From e6d8fd29bd3d796a00ff9b69f9fae011aec3cb40 Mon Sep 17 00:00:00 2001 +From: Tim Harvey +Date: Thu, 5 Sep 2024 11:32:28 -0700 +Subject: [PATCH] arm64: dts: imx8mp-venice-gw74xx: add M2SKT_GPIO10 gpio + configuration + +The GW74xx D revision has added a M2SKT_GPIO10 GPIO which routes to the +GPIO10 pin of the M.2 socket for compatibility with certain devices. + +Add the iomux and a line name for this. + +Signed-off-by: Tim Harvey +Signed-off-by: Shawn Guo +--- + arch/arm64/boot/dts/freescale/imx8mp-venice-gw74xx.dts | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/arch/arm64/boot/dts/freescale/imx8mp-venice-gw74xx.dts ++++ b/arch/arm64/boot/dts/freescale/imx8mp-venice-gw74xx.dts +@@ -264,7 +264,7 @@ + &gpio3 { + gpio-line-names = + "", "", "", "", "", "", "m2_rst", "", +- "", "", "", "", "", "", "", "", ++ "", "", "", "", "", "", "m2_gpio10", "", + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", ""; + }; +@@ -786,6 +786,7 @@ + MX8MP_IOMUXC_SD2_CMD__GPIO2_IO14 0x40000150 /* PCIE3_WDIS# */ + MX8MP_IOMUXC_SD2_DATA3__GPIO2_IO18 0x40000150 /* PCIE2_WDIS# */ + MX8MP_IOMUXC_NAND_DATA00__GPIO3_IO06 0x40000040 /* M2SKT_RST# */ ++ MX8MP_IOMUXC_NAND_DQS__GPIO3_IO14 0x40000040 /* M2SKT_GPIO10 */ + MX8MP_IOMUXC_SAI3_TXD__GPIO5_IO01 0x40000104 /* UART_TERM */ + MX8MP_IOMUXC_SAI3_TXFS__GPIO4_IO31 0x40000104 /* UART_RS485 */ + MX8MP_IOMUXC_SAI3_TXC__GPIO5_IO00 0x40000104 /* UART_HALF */ diff --git a/target/linux/imx/patches-6.6/502-6.13-arm64-dts-freescale-rename-gw7905-to-gw75xx.patch b/target/linux/imx/patches-6.6/502-6.13-arm64-dts-freescale-rename-gw7905-to-gw75xx.patch new file mode 100644 index 00000000000000..056b85002e4c98 --- /dev/null +++ b/target/linux/imx/patches-6.6/502-6.13-arm64-dts-freescale-rename-gw7905-to-gw75xx.patch @@ -0,0 +1,1426 @@ +From 14c3de96e14b30b1b83016abe607034a5a7e1c6b Mon Sep 17 00:00:00 2001 +From: Tim Harvey +Date: Wed, 24 Jan 2024 10:16:03 -0800 +Subject: [PATCH] arm64: dts: freescale: rename gw7905 to gw75xx + +The GW7905 was renamed to GW7500 before production release. + +Signed-off-by: Tim Harvey +--- + Documentation/devicetree/bindings/arm/fsl.yaml | 4 ++-- + arch/arm64/boot/dts/freescale/Makefile | 4 ++-- + ...8mm-venice-gw7905-0x.dts => imx8mm-venice-gw75xx-0x.dts} | 6 +++--- + ...{imx8mm-venice-gw7905.dtsi => imx8mm-venice-gw75xx.dtsi} | 0 + ...8mp-venice-gw7905-2x.dts => imx8mp-venice-gw75xx-2x.dts} | 6 +++--- + ...{imx8mp-venice-gw7905.dtsi => imx8mp-venice-gw75xx.dtsi} | 0 + 6 files changed, 10 insertions(+), 10 deletions(-) + rename arch/arm64/boot/dts/freescale/{imx8mm-venice-gw7905-0x.dts => imx8mm-venice-gw75xx-0x.dts} (67%) + rename arch/arm64/boot/dts/freescale/{imx8mm-venice-gw7905.dtsi => imx8mm-venice-gw75xx.dtsi} (100%) + rename arch/arm64/boot/dts/freescale/{imx8mp-venice-gw7905-2x.dts => imx8mp-venice-gw75xx-2x.dts} (67%) + rename arch/arm64/boot/dts/freescale/{imx8mp-venice-gw7905.dtsi => imx8mp-venice-gw75xx.dtsi} (100%) + +--- a/Documentation/devicetree/bindings/arm/fsl.yaml ++++ b/Documentation/devicetree/bindings/arm/fsl.yaml +@@ -908,8 +908,8 @@ properties: + - fsl,imx8mm-ddr4-evk # i.MX8MM DDR4 EVK Board + - fsl,imx8mm-evk # i.MX8MM EVK Board + - fsl,imx8mm-evkb # i.MX8MM EVKB Board ++ - gateworks,imx8mm-gw75xx-0x # i.MX8MM Gateworks Board + - gateworks,imx8mm-gw7904 +- - gateworks,imx8mm-gw7905-0x # i.MX8MM Gateworks Board + - gw,imx8mm-gw71xx-0x # i.MX8MM Gateworks Development Kit + - gw,imx8mm-gw72xx-0x # i.MX8MM Gateworks Development Kit + - gw,imx8mm-gw73xx-0x # i.MX8MM Gateworks Development Kit +@@ -1036,7 +1036,7 @@ properties: + - gateworks,imx8mp-gw72xx-2x # i.MX8MP Gateworks Board + - gateworks,imx8mp-gw73xx-2x # i.MX8MP Gateworks Board + - gateworks,imx8mp-gw74xx # i.MX8MP Gateworks Board +- - gateworks,imx8mp-gw7905-2x # i.MX8MP Gateworks Board ++ - gateworks,imx8mp-gw75xx-2x # i.MX8MP Gateworks Board + - toradex,verdin-imx8mp # Verdin iMX8M Plus Modules + - toradex,verdin-imx8mp-nonwifi # Verdin iMX8M Plus Modules without Wi-Fi / BT + - toradex,verdin-imx8mp-wifi # Verdin iMX8M Plus Wi-Fi / BT Modules +--- a/arch/arm64/boot/dts/freescale/Makefile ++++ b/arch/arm64/boot/dts/freescale/Makefile +@@ -72,11 +72,11 @@ dtb-$(CONFIG_ARCH_MXC) += imx8mm-var-som + dtb-$(CONFIG_ARCH_MXC) += imx8mm-venice-gw71xx-0x.dtb + dtb-$(CONFIG_ARCH_MXC) += imx8mm-venice-gw72xx-0x.dtb + dtb-$(CONFIG_ARCH_MXC) += imx8mm-venice-gw73xx-0x.dtb ++dtb-$(CONFIG_ARCH_MXC) += imx8mm-venice-gw75xx-0x.dtb + dtb-$(CONFIG_ARCH_MXC) += imx8mm-venice-gw7901.dtb + dtb-$(CONFIG_ARCH_MXC) += imx8mm-venice-gw7902.dtb + dtb-$(CONFIG_ARCH_MXC) += imx8mm-venice-gw7903.dtb + dtb-$(CONFIG_ARCH_MXC) += imx8mm-venice-gw7904.dtb +-dtb-$(CONFIG_ARCH_MXC) += imx8mm-venice-gw7905-0x.dtb + dtb-$(CONFIG_ARCH_MXC) += imx8mm-verdin-nonwifi-dahlia.dtb + dtb-$(CONFIG_ARCH_MXC) += imx8mm-verdin-nonwifi-dev.dtb + dtb-$(CONFIG_ARCH_MXC) += imx8mm-verdin-nonwifi-yavia.dtb +@@ -107,7 +107,7 @@ dtb-$(CONFIG_ARCH_MXC) += imx8mp-venice- + dtb-$(CONFIG_ARCH_MXC) += imx8mp-venice-gw72xx-2x.dtb + dtb-$(CONFIG_ARCH_MXC) += imx8mp-venice-gw73xx-2x.dtb + dtb-$(CONFIG_ARCH_MXC) += imx8mp-venice-gw74xx.dtb +-dtb-$(CONFIG_ARCH_MXC) += imx8mp-venice-gw7905-2x.dtb ++dtb-$(CONFIG_ARCH_MXC) += imx8mp-venice-gw75xx-2x.dtb + dtb-$(CONFIG_ARCH_MXC) += imx8mp-verdin-nonwifi-dahlia.dtb + dtb-$(CONFIG_ARCH_MXC) += imx8mp-verdin-nonwifi-dev.dtb + dtb-$(CONFIG_ARCH_MXC) += imx8mp-verdin-nonwifi-yavia.dtb +--- a/arch/arm64/boot/dts/freescale/imx8mm-venice-gw7905-0x.dts ++++ /dev/null +@@ -1,28 +0,0 @@ +-// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +-/* +- * Copyright 2023 Gateworks Corporation +- */ +- +-/dts-v1/; +- +-#include "imx8mm.dtsi" +-#include "imx8mm-venice-gw700x.dtsi" +-#include "imx8mm-venice-gw7905.dtsi" +- +-/ { +- model = "Gateworks Venice GW7905-0x i.MX8MM Development Kit"; +- compatible = "gateworks,imx8mm-gw7905-0x", "fsl,imx8mm"; +- +- chosen { +- stdout-path = &uart2; +- }; +-}; +- +-/* Disable SOM interfaces not used on baseboard */ +-&fec1 { +- status = "disabled"; +-}; +- +-&usdhc1 { +- status = "disabled"; +-}; +--- /dev/null ++++ b/arch/arm64/boot/dts/freescale/imx8mm-venice-gw75xx-0x.dts +@@ -0,0 +1,28 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright 2023 Gateworks Corporation ++ */ ++ ++/dts-v1/; ++ ++#include "imx8mm.dtsi" ++#include "imx8mm-venice-gw700x.dtsi" ++#include "imx8mm-venice-gw75xx.dtsi" ++ ++/ { ++ model = "Gateworks Venice GW75xx-0x i.MX8MM Development Kit"; ++ compatible = "gateworks,imx8mm-gw75xx-0x", "fsl,imx8mm"; ++ ++ chosen { ++ stdout-path = &uart2; ++ }; ++}; ++ ++/* Disable SOM interfaces not used on baseboard */ ++&fec1 { ++ status = "disabled"; ++}; ++ ++&usdhc1 { ++ status = "disabled"; ++}; +--- a/arch/arm64/boot/dts/freescale/imx8mp-venice-gw7905-2x.dts ++++ /dev/null +@@ -1,28 +0,0 @@ +-// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +-/* +- * Copyright 2023 Gateworks Corporation +- */ +- +-/dts-v1/; +- +-#include "imx8mp.dtsi" +-#include "imx8mp-venice-gw702x.dtsi" +-#include "imx8mp-venice-gw7905.dtsi" +- +-/ { +- model = "Gateworks Venice GW7905-2x i.MX8MP Development Kit"; +- compatible = "gateworks,imx8mp-gw7905-2x", "fsl,imx8mp"; +- +- chosen { +- stdout-path = &uart2; +- }; +-}; +- +-/* Disable SOM interfaces not used on baseboard */ +-&eqos { +- status = "disabled"; +-}; +- +-&usdhc1 { +- status = "disabled"; +-}; +--- /dev/null ++++ b/arch/arm64/boot/dts/freescale/imx8mp-venice-gw75xx-2x.dts +@@ -0,0 +1,28 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright 2023 Gateworks Corporation ++ */ ++ ++/dts-v1/; ++ ++#include "imx8mp.dtsi" ++#include "imx8mp-venice-gw702x.dtsi" ++#include "imx8mp-venice-gw75xx.dtsi" ++ ++/ { ++ model = "Gateworks Venice GW75xx-2x i.MX8MP Development Kit"; ++ compatible = "gateworks,imx8mp-gw75xx-2x", "fsl,imx8mp"; ++ ++ chosen { ++ stdout-path = &uart2; ++ }; ++}; ++ ++/* Disable SOM interfaces not used on baseboard */ ++&eqos { ++ status = "disabled"; ++}; ++ ++&usdhc1 { ++ status = "disabled"; ++}; +--- /dev/null ++++ b/arch/arm64/boot/dts/freescale/imx8mm-venice-gw75xx.dtsi +@@ -0,0 +1,303 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright 2023 Gateworks Corporation ++ */ ++ ++#include ++#include ++#include ++ ++/ { ++ led-controller { ++ compatible = "gpio-leds"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_gpio_leds>; ++ ++ led-0 { ++ function = LED_FUNCTION_STATUS; ++ color = ; ++ gpios = <&gpio4 0 GPIO_ACTIVE_HIGH>; ++ default-state = "on"; ++ linux,default-trigger = "heartbeat"; ++ }; ++ ++ led-1 { ++ function = LED_FUNCTION_STATUS; ++ color = ; ++ gpios = <&gpio4 2 GPIO_ACTIVE_HIGH>; ++ default-state = "off"; ++ }; ++ }; ++ ++ pcie0_refclk: clock-pcie0 { ++ compatible = "fixed-clock"; ++ #clock-cells = <0>; ++ clock-frequency = <100000000>; ++ }; ++ ++ pps { ++ compatible = "pps-gpio"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_pps>; ++ gpios = <&gpio4 5 GPIO_ACTIVE_HIGH>; ++ status = "okay"; ++ }; ++ ++ reg_usb2_vbus: regulator-usb2-vbus { ++ compatible = "regulator-fixed"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_reg_usb2_en>; ++ regulator-name = "usb2_vbus"; ++ gpio = <&gpio1 8 GPIO_ACTIVE_HIGH>; ++ enable-active-high; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ }; ++ ++ reg_usdhc2_vmmc: regulator-usdhc2 { ++ compatible = "regulator-fixed"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_reg_usdhc2_vmmc>; ++ regulator-name = "SD2_3P3V"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>; ++ enable-active-high; ++ }; ++}; ++ ++/* off-board header */ ++&ecspi2 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_spi2>; ++ cs-gpios = <&gpio5 13 GPIO_ACTIVE_LOW>; ++ status = "okay"; ++}; ++ ++&gpio1 { ++ gpio-line-names = ++ "", "", "", "", ++ "", "", "", "", ++ "", "", "", "", ++ "", "gpioa", "gpiob", "", ++ "", "", "", "", ++ "", "", "", "", ++ "", "", "", "", ++ "", "", "", ""; ++}; ++ ++&gpio4 { ++ gpio-line-names = ++ "", "", "", "pci_usb_sel", ++ "", "", "", "pci_wdis#", ++ "", "", "", "", ++ "", "", "", "", ++ "", "", "", "", ++ "", "", "", "", ++ "", "", "", "", ++ "", "", "", ""; ++}; ++ ++&gpio5 { ++ gpio-line-names = ++ "", "", "", "", ++ "gpioc", "gpiod", "", "", ++ "", "", "", "", ++ "", "", "", "", ++ "", "", "", "", ++ "", "", "", "", ++ "", "", "", "", ++ "", "", "", ""; ++}; ++ ++&i2c2 { ++ clock-frequency = <400000>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_i2c2>; ++ status = "okay"; ++ ++ eeprom@52 { ++ compatible = "atmel,24c32"; ++ reg = <0x52>; ++ pagesize = <32>; ++ }; ++}; ++ ++/* off-board header */ ++&i2c3 { ++ clock-frequency = <400000>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_i2c3>; ++ status = "okay"; ++}; ++ ++&pcie_phy { ++ fsl,refclk-pad-mode = ; ++ fsl,clkreq-unsupported; ++ clocks = <&pcie0_refclk>; ++ clock-names = "ref"; ++ status = "okay"; ++}; ++ ++&pcie0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_pcie0>; ++ reset-gpio = <&gpio4 6 GPIO_ACTIVE_LOW>; ++ status = "okay"; ++}; ++ ++/* GPS */ ++&uart1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_uart1>; ++ status = "okay"; ++}; ++ ++/* USB1 - Type C front panel SINK port J14 */ ++&usbotg1 { ++ dr_mode = "peripheral"; ++ status = "okay"; ++}; ++ ++/* USB2 4-port USB3.0 HUB: ++ * P1 - USBC connector (host only) ++ * P2 - USB2 test connector ++ * P3 - miniPCIe full card ++ * P4 - miniPCIe half card ++ */ ++&usbotg2 { ++ dr_mode = "host"; ++ vbus-supply = <®_usb2_vbus>; ++ status = "okay"; ++}; ++ ++/* microSD */ ++&usdhc2 { ++ pinctrl-names = "default", "state_100mhz", "state_200mhz"; ++ pinctrl-0 = <&pinctrl_usdhc2>, <&pinctrl_usdhc2_gpio>; ++ pinctrl-1 = <&pinctrl_usdhc2_100mhz>, <&pinctrl_usdhc2_gpio>; ++ pinctrl-2 = <&pinctrl_usdhc2_200mhz>, <&pinctrl_usdhc2_gpio>; ++ cd-gpios = <&gpio2 12 GPIO_ACTIVE_LOW>; ++ vmmc-supply = <®_usdhc2_vmmc>; ++ bus-width = <4>; ++ status = "okay"; ++}; ++ ++&iomuxc { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_hog>; ++ ++ pinctrl_hog: hoggrp { ++ fsl,pins = < ++ MX8MM_IOMUXC_GPIO1_IO13_GPIO1_IO13 0x40000040 /* GPIOA */ ++ MX8MM_IOMUXC_GPIO1_IO14_GPIO1_IO14 0x40000040 /* GPIOB */ ++ MX8MM_IOMUXC_SAI1_RXD1_GPIO4_IO3 0x40000106 /* PCI_USBSEL */ ++ MX8MM_IOMUXC_SAI1_RXD5_GPIO4_IO7 0x40000106 /* PCIE_WDIS# */ ++ MX8MM_IOMUXC_SPDIF_EXT_CLK_GPIO5_IO5 0x40000040 /* GPIOD */ ++ MX8MM_IOMUXC_SPDIF_RX_GPIO5_IO4 0x40000040 /* GPIOC */ ++ >; ++ }; ++ ++ pinctrl_gpio_leds: gpioledgrp { ++ fsl,pins = < ++ MX8MM_IOMUXC_SAI1_RXFS_GPIO4_IO0 0x6 /* LEDG */ ++ MX8MM_IOMUXC_SAI1_RXD0_GPIO4_IO2 0x6 /* LEDR */ ++ >; ++ }; ++ ++ pinctrl_i2c2: i2c2grp { ++ fsl,pins = < ++ MX8MM_IOMUXC_I2C2_SCL_I2C2_SCL 0x400001c2 ++ MX8MM_IOMUXC_I2C2_SDA_I2C2_SDA 0x400001c2 ++ >; ++ }; ++ ++ pinctrl_i2c3: i2c3grp { ++ fsl,pins = < ++ MX8MM_IOMUXC_I2C3_SCL_I2C3_SCL 0x400001c2 ++ MX8MM_IOMUXC_I2C3_SDA_I2C3_SDA 0x400001c2 ++ >; ++ }; ++ ++ pinctrl_pcie0: pciegrp { ++ fsl,pins = < ++ MX8MM_IOMUXC_SAI1_RXD4_GPIO4_IO6 0x106 ++ >; ++ }; ++ ++ pinctrl_pps: ppsgrp { ++ fsl,pins = < ++ MX8MM_IOMUXC_SAI1_RXD3_GPIO4_IO5 0x106 ++ >; ++ }; ++ ++ pinctrl_reg_usb2_en: regusb2grp { ++ fsl,pins = < ++ MX8MM_IOMUXC_GPIO1_IO08_GPIO1_IO8 0x6 /* USBHUB_RST# (ext p/u) */ ++ >; ++ }; ++ ++ pinctrl_reg_usdhc2_vmmc: regusdhc2vmmcgrp { ++ fsl,pins = < ++ MX8MM_IOMUXC_SD2_RESET_B_GPIO2_IO19 0x40 ++ >; ++ }; ++ ++ pinctrl_spi2: spi2grp { ++ fsl,pins = < ++ MX8MM_IOMUXC_ECSPI2_SCLK_ECSPI2_SCLK 0x140 ++ MX8MM_IOMUXC_ECSPI2_MOSI_ECSPI2_MOSI 0x140 ++ MX8MM_IOMUXC_ECSPI2_MISO_ECSPI2_MISO 0x140 ++ MX8MM_IOMUXC_ECSPI2_SS0_GPIO5_IO13 0x140 ++ >; ++ }; ++ ++ pinctrl_uart1: uart1grp { ++ fsl,pins = < ++ MX8MM_IOMUXC_UART1_RXD_UART1_DCE_RX 0x140 ++ MX8MM_IOMUXC_UART1_TXD_UART1_DCE_TX 0x140 ++ >; ++ }; ++ ++ pinctrl_usdhc2: usdhc2grp { ++ fsl,pins = < ++ MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK 0x190 ++ MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD 0x1d0 ++ MX8MM_IOMUXC_SD2_DATA0_USDHC2_DATA0 0x1d0 ++ MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1 0x1d0 ++ MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d0 ++ MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d0 ++ MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0xc0 ++ >; ++ }; ++ ++ pinctrl_usdhc2_100mhz: usdhc2-100mhzgrp { ++ fsl,pins = < ++ MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK 0x194 ++ MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD 0x1d4 ++ MX8MM_IOMUXC_SD2_DATA0_USDHC2_DATA0 0x1d4 ++ MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1 0x1d4 ++ MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d4 ++ MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d4 ++ MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0xc0 ++ >; ++ }; ++ ++ pinctrl_usdhc2_200mhz: usdhc2-200mhzgrp { ++ fsl,pins = < ++ MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK 0x196 ++ MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD 0x1d6 ++ MX8MM_IOMUXC_SD2_DATA0_USDHC2_DATA0 0x1d6 ++ MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1 0x1d6 ++ MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d6 ++ MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d6 ++ MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0xc0 ++ >; ++ }; ++ ++ pinctrl_usdhc2_gpio: usdhc2gpiogrp { ++ fsl,pins = < ++ MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x1c4 ++ >; ++ }; ++}; +--- a/arch/arm64/boot/dts/freescale/imx8mm-venice-gw7905.dtsi ++++ /dev/null +@@ -1,303 +0,0 @@ +-// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +-/* +- * Copyright 2023 Gateworks Corporation +- */ +- +-#include +-#include +-#include +- +-/ { +- led-controller { +- compatible = "gpio-leds"; +- pinctrl-names = "default"; +- pinctrl-0 = <&pinctrl_gpio_leds>; +- +- led-0 { +- function = LED_FUNCTION_STATUS; +- color = ; +- gpios = <&gpio4 0 GPIO_ACTIVE_HIGH>; +- default-state = "on"; +- linux,default-trigger = "heartbeat"; +- }; +- +- led-1 { +- function = LED_FUNCTION_STATUS; +- color = ; +- gpios = <&gpio4 2 GPIO_ACTIVE_HIGH>; +- default-state = "off"; +- }; +- }; +- +- pcie0_refclk: clock-pcie0 { +- compatible = "fixed-clock"; +- #clock-cells = <0>; +- clock-frequency = <100000000>; +- }; +- +- pps { +- compatible = "pps-gpio"; +- pinctrl-names = "default"; +- pinctrl-0 = <&pinctrl_pps>; +- gpios = <&gpio4 5 GPIO_ACTIVE_HIGH>; +- status = "okay"; +- }; +- +- reg_usb2_vbus: regulator-usb2-vbus { +- compatible = "regulator-fixed"; +- pinctrl-names = "default"; +- pinctrl-0 = <&pinctrl_reg_usb2_en>; +- regulator-name = "usb2_vbus"; +- gpio = <&gpio1 8 GPIO_ACTIVE_HIGH>; +- enable-active-high; +- regulator-min-microvolt = <5000000>; +- regulator-max-microvolt = <5000000>; +- }; +- +- reg_usdhc2_vmmc: regulator-usdhc2 { +- compatible = "regulator-fixed"; +- pinctrl-names = "default"; +- pinctrl-0 = <&pinctrl_reg_usdhc2_vmmc>; +- regulator-name = "SD2_3P3V"; +- regulator-min-microvolt = <3300000>; +- regulator-max-microvolt = <3300000>; +- gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>; +- enable-active-high; +- }; +-}; +- +-/* off-board header */ +-&ecspi2 { +- pinctrl-names = "default"; +- pinctrl-0 = <&pinctrl_spi2>; +- cs-gpios = <&gpio5 13 GPIO_ACTIVE_LOW>; +- status = "okay"; +-}; +- +-&gpio1 { +- gpio-line-names = +- "", "", "", "", +- "", "", "", "", +- "", "", "", "", +- "", "gpioa", "gpiob", "", +- "", "", "", "", +- "", "", "", "", +- "", "", "", "", +- "", "", "", ""; +-}; +- +-&gpio4 { +- gpio-line-names = +- "", "", "", "pci_usb_sel", +- "", "", "", "pci_wdis#", +- "", "", "", "", +- "", "", "", "", +- "", "", "", "", +- "", "", "", "", +- "", "", "", "", +- "", "", "", ""; +-}; +- +-&gpio5 { +- gpio-line-names = +- "", "", "", "", +- "gpioc", "gpiod", "", "", +- "", "", "", "", +- "", "", "", "", +- "", "", "", "", +- "", "", "", "", +- "", "", "", "", +- "", "", "", ""; +-}; +- +-&i2c2 { +- clock-frequency = <400000>; +- pinctrl-names = "default"; +- pinctrl-0 = <&pinctrl_i2c2>; +- status = "okay"; +- +- eeprom@52 { +- compatible = "atmel,24c32"; +- reg = <0x52>; +- pagesize = <32>; +- }; +-}; +- +-/* off-board header */ +-&i2c3 { +- clock-frequency = <400000>; +- pinctrl-names = "default"; +- pinctrl-0 = <&pinctrl_i2c3>; +- status = "okay"; +-}; +- +-&pcie_phy { +- fsl,refclk-pad-mode = ; +- fsl,clkreq-unsupported; +- clocks = <&pcie0_refclk>; +- clock-names = "ref"; +- status = "okay"; +-}; +- +-&pcie0 { +- pinctrl-names = "default"; +- pinctrl-0 = <&pinctrl_pcie0>; +- reset-gpio = <&gpio4 6 GPIO_ACTIVE_LOW>; +- status = "okay"; +-}; +- +-/* GPS */ +-&uart1 { +- pinctrl-names = "default"; +- pinctrl-0 = <&pinctrl_uart1>; +- status = "okay"; +-}; +- +-/* USB1 - Type C front panel SINK port J14 */ +-&usbotg1 { +- dr_mode = "peripheral"; +- status = "okay"; +-}; +- +-/* USB2 4-port USB3.0 HUB: +- * P1 - USBC connector (host only) +- * P2 - USB2 test connector +- * P3 - miniPCIe full card +- * P4 - miniPCIe half card +- */ +-&usbotg2 { +- dr_mode = "host"; +- vbus-supply = <®_usb2_vbus>; +- status = "okay"; +-}; +- +-/* microSD */ +-&usdhc2 { +- pinctrl-names = "default", "state_100mhz", "state_200mhz"; +- pinctrl-0 = <&pinctrl_usdhc2>, <&pinctrl_usdhc2_gpio>; +- pinctrl-1 = <&pinctrl_usdhc2_100mhz>, <&pinctrl_usdhc2_gpio>; +- pinctrl-2 = <&pinctrl_usdhc2_200mhz>, <&pinctrl_usdhc2_gpio>; +- cd-gpios = <&gpio2 12 GPIO_ACTIVE_LOW>; +- vmmc-supply = <®_usdhc2_vmmc>; +- bus-width = <4>; +- status = "okay"; +-}; +- +-&iomuxc { +- pinctrl-names = "default"; +- pinctrl-0 = <&pinctrl_hog>; +- +- pinctrl_hog: hoggrp { +- fsl,pins = < +- MX8MM_IOMUXC_GPIO1_IO13_GPIO1_IO13 0x40000040 /* GPIOA */ +- MX8MM_IOMUXC_GPIO1_IO14_GPIO1_IO14 0x40000040 /* GPIOB */ +- MX8MM_IOMUXC_SAI1_RXD1_GPIO4_IO3 0x40000106 /* PCI_USBSEL */ +- MX8MM_IOMUXC_SAI1_RXD5_GPIO4_IO7 0x40000106 /* PCIE_WDIS# */ +- MX8MM_IOMUXC_SPDIF_EXT_CLK_GPIO5_IO5 0x40000040 /* GPIOD */ +- MX8MM_IOMUXC_SPDIF_RX_GPIO5_IO4 0x40000040 /* GPIOC */ +- >; +- }; +- +- pinctrl_gpio_leds: gpioledgrp { +- fsl,pins = < +- MX8MM_IOMUXC_SAI1_RXFS_GPIO4_IO0 0x6 /* LEDG */ +- MX8MM_IOMUXC_SAI1_RXD0_GPIO4_IO2 0x6 /* LEDR */ +- >; +- }; +- +- pinctrl_i2c2: i2c2grp { +- fsl,pins = < +- MX8MM_IOMUXC_I2C2_SCL_I2C2_SCL 0x400001c2 +- MX8MM_IOMUXC_I2C2_SDA_I2C2_SDA 0x400001c2 +- >; +- }; +- +- pinctrl_i2c3: i2c3grp { +- fsl,pins = < +- MX8MM_IOMUXC_I2C3_SCL_I2C3_SCL 0x400001c2 +- MX8MM_IOMUXC_I2C3_SDA_I2C3_SDA 0x400001c2 +- >; +- }; +- +- pinctrl_pcie0: pciegrp { +- fsl,pins = < +- MX8MM_IOMUXC_SAI1_RXD4_GPIO4_IO6 0x106 +- >; +- }; +- +- pinctrl_pps: ppsgrp { +- fsl,pins = < +- MX8MM_IOMUXC_SAI1_RXD3_GPIO4_IO5 0x106 +- >; +- }; +- +- pinctrl_reg_usb2_en: regusb2grp { +- fsl,pins = < +- MX8MM_IOMUXC_GPIO1_IO08_GPIO1_IO8 0x6 /* USBHUB_RST# (ext p/u) */ +- >; +- }; +- +- pinctrl_reg_usdhc2_vmmc: regusdhc2vmmcgrp { +- fsl,pins = < +- MX8MM_IOMUXC_SD2_RESET_B_GPIO2_IO19 0x40 +- >; +- }; +- +- pinctrl_spi2: spi2grp { +- fsl,pins = < +- MX8MM_IOMUXC_ECSPI2_SCLK_ECSPI2_SCLK 0x140 +- MX8MM_IOMUXC_ECSPI2_MOSI_ECSPI2_MOSI 0x140 +- MX8MM_IOMUXC_ECSPI2_MISO_ECSPI2_MISO 0x140 +- MX8MM_IOMUXC_ECSPI2_SS0_GPIO5_IO13 0x140 +- >; +- }; +- +- pinctrl_uart1: uart1grp { +- fsl,pins = < +- MX8MM_IOMUXC_UART1_RXD_UART1_DCE_RX 0x140 +- MX8MM_IOMUXC_UART1_TXD_UART1_DCE_TX 0x140 +- >; +- }; +- +- pinctrl_usdhc2: usdhc2grp { +- fsl,pins = < +- MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK 0x190 +- MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD 0x1d0 +- MX8MM_IOMUXC_SD2_DATA0_USDHC2_DATA0 0x1d0 +- MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1 0x1d0 +- MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d0 +- MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d0 +- MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0xc0 +- >; +- }; +- +- pinctrl_usdhc2_100mhz: usdhc2-100mhzgrp { +- fsl,pins = < +- MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK 0x194 +- MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD 0x1d4 +- MX8MM_IOMUXC_SD2_DATA0_USDHC2_DATA0 0x1d4 +- MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1 0x1d4 +- MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d4 +- MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d4 +- MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0xc0 +- >; +- }; +- +- pinctrl_usdhc2_200mhz: usdhc2-200mhzgrp { +- fsl,pins = < +- MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK 0x196 +- MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD 0x1d6 +- MX8MM_IOMUXC_SD2_DATA0_USDHC2_DATA0 0x1d6 +- MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1 0x1d6 +- MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d6 +- MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d6 +- MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0xc0 +- >; +- }; +- +- pinctrl_usdhc2_gpio: usdhc2gpiogrp { +- fsl,pins = < +- MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x1c4 +- >; +- }; +-}; +--- /dev/null ++++ b/arch/arm64/boot/dts/freescale/imx8mp-venice-gw75xx.dtsi +@@ -0,0 +1,309 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright 2023 Gateworks Corporation ++ */ ++ ++#include ++#include ++#include ++ ++/ { ++ led-controller { ++ compatible = "gpio-leds"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_gpio_leds>; ++ ++ led-0 { ++ function = LED_FUNCTION_STATUS; ++ color = ; ++ gpios = <&gpio4 22 GPIO_ACTIVE_HIGH>; ++ default-state = "on"; ++ linux,default-trigger = "heartbeat"; ++ }; ++ ++ led-1 { ++ function = LED_FUNCTION_STATUS; ++ color = ; ++ gpios = <&gpio4 27 GPIO_ACTIVE_HIGH>; ++ default-state = "off"; ++ }; ++ }; ++ ++ pcie0_refclk: pcie0-refclk { ++ compatible = "fixed-clock"; ++ #clock-cells = <0>; ++ clock-frequency = <100000000>; ++ }; ++ ++ pps { ++ compatible = "pps-gpio"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_pps>; ++ gpios = <&gpio4 21 GPIO_ACTIVE_HIGH>; ++ status = "okay"; ++ }; ++ ++ reg_usb2_vbus: regulator-usb2-vbus { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_reg_usb2_en>; ++ compatible = "regulator-fixed"; ++ regulator-name = "usb2_vbus"; ++ gpio = <&gpio4 12 GPIO_ACTIVE_HIGH>; ++ enable-active-high; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ }; ++ ++ reg_usdhc2_vmmc: regulator-usdhc2 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_reg_usdhc2_vmmc>; ++ compatible = "regulator-fixed"; ++ regulator-name = "SD2_3P3V"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>; ++ enable-active-high; ++ }; ++}; ++ ++/* off-board header */ ++&ecspi2 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_spi2>; ++ cs-gpios = <&gpio5 13 GPIO_ACTIVE_LOW>; ++ status = "okay"; ++}; ++ ++&gpio4 { ++ gpio-line-names = ++ "", "", "", "", ++ "", "", "", "", ++ "", "", "", "", ++ "", "gpioa", "", "", ++ "", "", "", "", ++ "", "", "", "", ++ "", "", "", "", ++ "", "", "", ""; ++}; ++ ++&gpio4 { ++ gpio-line-names = ++ "", "gpiod", "", "", ++ "gpiob", "gpioc", "", "", ++ "", "", "", "", ++ "", "", "", "", ++ "", "", "", "", ++ "", "", "", "", ++ "", "", "pci_usb_sel", "", ++ "pci_wdis#", "", "", ""; ++}; ++ ++&i2c2 { ++ clock-frequency = <400000>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_i2c2>; ++ status = "okay"; ++ ++ eeprom@52 { ++ compatible = "atmel,24c32"; ++ reg = <0x52>; ++ pagesize = <32>; ++ }; ++}; ++ ++/* off-board header */ ++&i2c3 { ++ clock-frequency = <400000>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_i2c3>; ++ status = "okay"; ++}; ++ ++&pcie_phy { ++ fsl,refclk-pad-mode = ; ++ fsl,clkreq-unsupported; ++ clocks = <&pcie0_refclk>; ++ clock-names = "ref"; ++ status = "okay"; ++}; ++ ++&pcie { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_pcie0>; ++ reset-gpio = <&gpio4 29 GPIO_ACTIVE_LOW>; ++ status = "okay"; ++}; ++ ++/* GPS */ ++&uart1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_uart1>; ++ status = "okay"; ++}; ++ ++/* USB1 - Type C front panel SINK port J14 */ ++&usb3_0 { ++ status = "okay"; ++}; ++ ++&usb3_phy0 { ++ status = "okay"; ++}; ++ ++&usb_dwc3_0 { ++ dr_mode = "peripheral"; ++ status = "okay"; ++}; ++ ++/* USB2 4-port USB3.0 HUB: ++ * P1 - USBC connector (host only) ++ * P2 - USB2 test connector ++ * P3 - miniPCIe full card ++ * P4 - miniPCIe half card ++ */ ++&usb3_phy1 { ++ vbus-supply = <®_usb2_vbus>; ++ status = "okay"; ++}; ++ ++&usb3_1 { ++ fsl,permanently-attached; ++ fsl,disable-port-power-control; ++ status = "okay"; ++}; ++ ++&usb_dwc3_1 { ++ dr_mode = "host"; ++ status = "okay"; ++}; ++ ++/* microSD */ ++&usdhc2 { ++ pinctrl-names = "default", "state_100mhz", "state_200mhz"; ++ pinctrl-0 = <&pinctrl_usdhc2>, <&pinctrl_usdhc2_gpio>; ++ pinctrl-1 = <&pinctrl_usdhc2_100mhz>, <&pinctrl_usdhc2_gpio>; ++ pinctrl-2 = <&pinctrl_usdhc2_200mhz>, <&pinctrl_usdhc2_gpio>; ++ cd-gpios = <&gpio2 12 GPIO_ACTIVE_LOW>; ++ vmmc-supply = <®_usdhc2_vmmc>; ++ bus-width = <4>; ++ status = "okay"; ++}; ++ ++&iomuxc { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_hog>; ++ ++ pinctrl_hog: hoggrp { ++ fsl,pins = < ++ MX8MP_IOMUXC_GPIO1_IO13__GPIO1_IO13 0x40000040 /* GPIOA */ ++ MX8MP_IOMUXC_SAI1_RXC__GPIO4_IO01 0x40000040 /* GPIOD */ ++ MX8MP_IOMUXC_SAI1_RXD2__GPIO4_IO04 0x40000040 /* GPIOB */ ++ MX8MP_IOMUXC_SAI1_RXD3__GPIO4_IO05 0x40000040 /* GPIOC */ ++ MX8MP_IOMUXC_SAI2_TXD0__GPIO4_IO26 0x40000106 /* PCI_USBSEL */ ++ MX8MP_IOMUXC_SAI3_RXFS__GPIO4_IO28 0x40000106 /* PCI_WDIS# */ ++ >; ++ }; ++ ++ pinctrl_gpio_leds: gpioledgrp { ++ fsl,pins = < ++ MX8MP_IOMUXC_SAI2_RXC__GPIO4_IO22 0x6 /* LEDG */ ++ MX8MP_IOMUXC_SAI2_MCLK__GPIO4_IO27 0x6 /* LEDR */ ++ >; ++ }; ++ ++ pinctrl_i2c2: i2c2grp { ++ fsl,pins = < ++ MX8MP_IOMUXC_I2C2_SCL__I2C2_SCL 0x400001c2 ++ MX8MP_IOMUXC_I2C2_SDA__I2C2_SDA 0x400001c2 ++ >; ++ }; ++ ++ pinctrl_i2c3: i2c3grp { ++ fsl,pins = < ++ MX8MP_IOMUXC_I2C3_SCL__I2C3_SCL 0x400001c2 ++ MX8MP_IOMUXC_I2C3_SDA__I2C3_SDA 0x400001c2 ++ >; ++ }; ++ ++ pinctrl_pcie0: pciegrp { ++ fsl,pins = < ++ MX8MP_IOMUXC_SAI3_RXC__GPIO4_IO29 0x106 ++ >; ++ }; ++ ++ pinctrl_pps: ppsgrp { ++ fsl,pins = < ++ MX8MP_IOMUXC_SAI2_RXFS__GPIO4_IO21 0x106 ++ >; ++ }; ++ ++ pinctrl_reg_usb2_en: regusb2grp { ++ fsl,pins = < ++ MX8MP_IOMUXC_SAI1_TXD0__GPIO4_IO12 0x6 /* USBHUB_RST# (ext p/u) */ ++ >; ++ }; ++ ++ pinctrl_reg_usdhc2_vmmc: regusdhc2vmmcgrp { ++ fsl,pins = < ++ MX8MP_IOMUXC_SD2_RESET_B__GPIO2_IO19 0x40 ++ >; ++ }; ++ ++ pinctrl_spi2: spi2grp { ++ fsl,pins = < ++ MX8MP_IOMUXC_ECSPI2_SCLK__ECSPI2_SCLK 0x140 ++ MX8MP_IOMUXC_ECSPI2_MOSI__ECSPI2_MOSI 0x140 ++ MX8MP_IOMUXC_ECSPI2_MISO__ECSPI2_MISO 0x140 ++ MX8MP_IOMUXC_ECSPI2_SS0__GPIO5_IO13 0x140 ++ >; ++ }; ++ ++ pinctrl_uart1: uart1grp { ++ fsl,pins = < ++ MX8MP_IOMUXC_UART1_RXD__UART1_DCE_RX 0x140 ++ MX8MP_IOMUXC_UART1_TXD__UART1_DCE_TX 0x140 ++ >; ++ }; ++ ++ pinctrl_usdhc2: usdhc2grp { ++ fsl,pins = < ++ MX8MP_IOMUXC_SD2_CLK__USDHC2_CLK 0x190 ++ MX8MP_IOMUXC_SD2_CMD__USDHC2_CMD 0x1d0 ++ MX8MP_IOMUXC_SD2_DATA0__USDHC2_DATA0 0x1d0 ++ MX8MP_IOMUXC_SD2_DATA1__USDHC2_DATA1 0x1d0 ++ MX8MP_IOMUXC_SD2_DATA2__USDHC2_DATA2 0x1d0 ++ MX8MP_IOMUXC_SD2_DATA3__USDHC2_DATA3 0x1d0 ++ MX8MP_IOMUXC_GPIO1_IO04__USDHC2_VSELECT 0xc0 ++ >; ++ }; ++ ++ pinctrl_usdhc2_100mhz: usdhc2-100mhzgrp { ++ fsl,pins = < ++ MX8MP_IOMUXC_SD2_CLK__USDHC2_CLK 0x194 ++ MX8MP_IOMUXC_SD2_CMD__USDHC2_CMD 0x1d4 ++ MX8MP_IOMUXC_SD2_DATA0__USDHC2_DATA0 0x1d4 ++ MX8MP_IOMUXC_SD2_DATA1__USDHC2_DATA1 0x1d4 ++ MX8MP_IOMUXC_SD2_DATA2__USDHC2_DATA2 0x1d4 ++ MX8MP_IOMUXC_SD2_DATA3__USDHC2_DATA3 0x1d4 ++ MX8MP_IOMUXC_GPIO1_IO04__USDHC2_VSELECT 0xc0 ++ >; ++ }; ++ ++ pinctrl_usdhc2_200mhz: usdhc2-200mhzgrp { ++ fsl,pins = < ++ MX8MP_IOMUXC_SD2_CLK__USDHC2_CLK 0x196 ++ MX8MP_IOMUXC_SD2_CMD__USDHC2_CMD 0x1d6 ++ MX8MP_IOMUXC_SD2_DATA0__USDHC2_DATA0 0x1d6 ++ MX8MP_IOMUXC_SD2_DATA1__USDHC2_DATA1 0x1d6 ++ MX8MP_IOMUXC_SD2_DATA2__USDHC2_DATA2 0x1d6 ++ MX8MP_IOMUXC_SD2_DATA3__USDHC2_DATA3 0x1d6 ++ MX8MP_IOMUXC_GPIO1_IO04__USDHC2_VSELECT 0xc0 ++ >; ++ }; ++ ++ pinctrl_usdhc2_gpio: usdhc2gpiogrp { ++ fsl,pins = < ++ MX8MP_IOMUXC_SD2_CD_B__GPIO2_IO12 0x1c4 ++ >; ++ }; ++}; +--- a/arch/arm64/boot/dts/freescale/imx8mp-venice-gw7905.dtsi ++++ /dev/null +@@ -1,309 +0,0 @@ +-// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +-/* +- * Copyright 2023 Gateworks Corporation +- */ +- +-#include +-#include +-#include +- +-/ { +- led-controller { +- compatible = "gpio-leds"; +- pinctrl-names = "default"; +- pinctrl-0 = <&pinctrl_gpio_leds>; +- +- led-0 { +- function = LED_FUNCTION_STATUS; +- color = ; +- gpios = <&gpio4 22 GPIO_ACTIVE_HIGH>; +- default-state = "on"; +- linux,default-trigger = "heartbeat"; +- }; +- +- led-1 { +- function = LED_FUNCTION_STATUS; +- color = ; +- gpios = <&gpio4 27 GPIO_ACTIVE_HIGH>; +- default-state = "off"; +- }; +- }; +- +- pcie0_refclk: pcie0-refclk { +- compatible = "fixed-clock"; +- #clock-cells = <0>; +- clock-frequency = <100000000>; +- }; +- +- pps { +- compatible = "pps-gpio"; +- pinctrl-names = "default"; +- pinctrl-0 = <&pinctrl_pps>; +- gpios = <&gpio4 21 GPIO_ACTIVE_HIGH>; +- status = "okay"; +- }; +- +- reg_usb2_vbus: regulator-usb2-vbus { +- pinctrl-names = "default"; +- pinctrl-0 = <&pinctrl_reg_usb2_en>; +- compatible = "regulator-fixed"; +- regulator-name = "usb2_vbus"; +- gpio = <&gpio4 12 GPIO_ACTIVE_HIGH>; +- enable-active-high; +- regulator-min-microvolt = <5000000>; +- regulator-max-microvolt = <5000000>; +- }; +- +- reg_usdhc2_vmmc: regulator-usdhc2 { +- pinctrl-names = "default"; +- pinctrl-0 = <&pinctrl_reg_usdhc2_vmmc>; +- compatible = "regulator-fixed"; +- regulator-name = "SD2_3P3V"; +- regulator-min-microvolt = <3300000>; +- regulator-max-microvolt = <3300000>; +- gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>; +- enable-active-high; +- }; +-}; +- +-/* off-board header */ +-&ecspi2 { +- pinctrl-names = "default"; +- pinctrl-0 = <&pinctrl_spi2>; +- cs-gpios = <&gpio5 13 GPIO_ACTIVE_LOW>; +- status = "okay"; +-}; +- +-&gpio4 { +- gpio-line-names = +- "", "", "", "", +- "", "", "", "", +- "", "", "", "", +- "", "gpioa", "", "", +- "", "", "", "", +- "", "", "", "", +- "", "", "", "", +- "", "", "", ""; +-}; +- +-&gpio4 { +- gpio-line-names = +- "", "gpiod", "", "", +- "gpiob", "gpioc", "", "", +- "", "", "", "", +- "", "", "", "", +- "", "", "", "", +- "", "", "", "", +- "", "", "pci_usb_sel", "", +- "pci_wdis#", "", "", ""; +-}; +- +-&i2c2 { +- clock-frequency = <400000>; +- pinctrl-names = "default"; +- pinctrl-0 = <&pinctrl_i2c2>; +- status = "okay"; +- +- eeprom@52 { +- compatible = "atmel,24c32"; +- reg = <0x52>; +- pagesize = <32>; +- }; +-}; +- +-/* off-board header */ +-&i2c3 { +- clock-frequency = <400000>; +- pinctrl-names = "default"; +- pinctrl-0 = <&pinctrl_i2c3>; +- status = "okay"; +-}; +- +-&pcie_phy { +- fsl,refclk-pad-mode = ; +- fsl,clkreq-unsupported; +- clocks = <&pcie0_refclk>; +- clock-names = "ref"; +- status = "okay"; +-}; +- +-&pcie { +- pinctrl-names = "default"; +- pinctrl-0 = <&pinctrl_pcie0>; +- reset-gpio = <&gpio4 29 GPIO_ACTIVE_LOW>; +- status = "okay"; +-}; +- +-/* GPS */ +-&uart1 { +- pinctrl-names = "default"; +- pinctrl-0 = <&pinctrl_uart1>; +- status = "okay"; +-}; +- +-/* USB1 - Type C front panel SINK port J14 */ +-&usb3_0 { +- status = "okay"; +-}; +- +-&usb3_phy0 { +- status = "okay"; +-}; +- +-&usb_dwc3_0 { +- dr_mode = "peripheral"; +- status = "okay"; +-}; +- +-/* USB2 4-port USB3.0 HUB: +- * P1 - USBC connector (host only) +- * P2 - USB2 test connector +- * P3 - miniPCIe full card +- * P4 - miniPCIe half card +- */ +-&usb3_phy1 { +- vbus-supply = <®_usb2_vbus>; +- status = "okay"; +-}; +- +-&usb3_1 { +- fsl,permanently-attached; +- fsl,disable-port-power-control; +- status = "okay"; +-}; +- +-&usb_dwc3_1 { +- dr_mode = "host"; +- status = "okay"; +-}; +- +-/* microSD */ +-&usdhc2 { +- pinctrl-names = "default", "state_100mhz", "state_200mhz"; +- pinctrl-0 = <&pinctrl_usdhc2>, <&pinctrl_usdhc2_gpio>; +- pinctrl-1 = <&pinctrl_usdhc2_100mhz>, <&pinctrl_usdhc2_gpio>; +- pinctrl-2 = <&pinctrl_usdhc2_200mhz>, <&pinctrl_usdhc2_gpio>; +- cd-gpios = <&gpio2 12 GPIO_ACTIVE_LOW>; +- vmmc-supply = <®_usdhc2_vmmc>; +- bus-width = <4>; +- status = "okay"; +-}; +- +-&iomuxc { +- pinctrl-names = "default"; +- pinctrl-0 = <&pinctrl_hog>; +- +- pinctrl_hog: hoggrp { +- fsl,pins = < +- MX8MP_IOMUXC_GPIO1_IO13__GPIO1_IO13 0x40000040 /* GPIOA */ +- MX8MP_IOMUXC_SAI1_RXC__GPIO4_IO01 0x40000040 /* GPIOD */ +- MX8MP_IOMUXC_SAI1_RXD2__GPIO4_IO04 0x40000040 /* GPIOB */ +- MX8MP_IOMUXC_SAI1_RXD3__GPIO4_IO05 0x40000040 /* GPIOC */ +- MX8MP_IOMUXC_SAI2_TXD0__GPIO4_IO26 0x40000106 /* PCI_USBSEL */ +- MX8MP_IOMUXC_SAI3_RXFS__GPIO4_IO28 0x40000106 /* PCI_WDIS# */ +- >; +- }; +- +- pinctrl_gpio_leds: gpioledgrp { +- fsl,pins = < +- MX8MP_IOMUXC_SAI2_RXC__GPIO4_IO22 0x6 /* LEDG */ +- MX8MP_IOMUXC_SAI2_MCLK__GPIO4_IO27 0x6 /* LEDR */ +- >; +- }; +- +- pinctrl_i2c2: i2c2grp { +- fsl,pins = < +- MX8MP_IOMUXC_I2C2_SCL__I2C2_SCL 0x400001c2 +- MX8MP_IOMUXC_I2C2_SDA__I2C2_SDA 0x400001c2 +- >; +- }; +- +- pinctrl_i2c3: i2c3grp { +- fsl,pins = < +- MX8MP_IOMUXC_I2C3_SCL__I2C3_SCL 0x400001c2 +- MX8MP_IOMUXC_I2C3_SDA__I2C3_SDA 0x400001c2 +- >; +- }; +- +- pinctrl_pcie0: pciegrp { +- fsl,pins = < +- MX8MP_IOMUXC_SAI3_RXC__GPIO4_IO29 0x106 +- >; +- }; +- +- pinctrl_pps: ppsgrp { +- fsl,pins = < +- MX8MP_IOMUXC_SAI2_RXFS__GPIO4_IO21 0x106 +- >; +- }; +- +- pinctrl_reg_usb2_en: regusb2grp { +- fsl,pins = < +- MX8MP_IOMUXC_SAI1_TXD0__GPIO4_IO12 0x6 /* USBHUB_RST# (ext p/u) */ +- >; +- }; +- +- pinctrl_reg_usdhc2_vmmc: regusdhc2vmmcgrp { +- fsl,pins = < +- MX8MP_IOMUXC_SD2_RESET_B__GPIO2_IO19 0x40 +- >; +- }; +- +- pinctrl_spi2: spi2grp { +- fsl,pins = < +- MX8MP_IOMUXC_ECSPI2_SCLK__ECSPI2_SCLK 0x140 +- MX8MP_IOMUXC_ECSPI2_MOSI__ECSPI2_MOSI 0x140 +- MX8MP_IOMUXC_ECSPI2_MISO__ECSPI2_MISO 0x140 +- MX8MP_IOMUXC_ECSPI2_SS0__GPIO5_IO13 0x140 +- >; +- }; +- +- pinctrl_uart1: uart1grp { +- fsl,pins = < +- MX8MP_IOMUXC_UART1_RXD__UART1_DCE_RX 0x140 +- MX8MP_IOMUXC_UART1_TXD__UART1_DCE_TX 0x140 +- >; +- }; +- +- pinctrl_usdhc2: usdhc2grp { +- fsl,pins = < +- MX8MP_IOMUXC_SD2_CLK__USDHC2_CLK 0x190 +- MX8MP_IOMUXC_SD2_CMD__USDHC2_CMD 0x1d0 +- MX8MP_IOMUXC_SD2_DATA0__USDHC2_DATA0 0x1d0 +- MX8MP_IOMUXC_SD2_DATA1__USDHC2_DATA1 0x1d0 +- MX8MP_IOMUXC_SD2_DATA2__USDHC2_DATA2 0x1d0 +- MX8MP_IOMUXC_SD2_DATA3__USDHC2_DATA3 0x1d0 +- MX8MP_IOMUXC_GPIO1_IO04__USDHC2_VSELECT 0xc0 +- >; +- }; +- +- pinctrl_usdhc2_100mhz: usdhc2-100mhzgrp { +- fsl,pins = < +- MX8MP_IOMUXC_SD2_CLK__USDHC2_CLK 0x194 +- MX8MP_IOMUXC_SD2_CMD__USDHC2_CMD 0x1d4 +- MX8MP_IOMUXC_SD2_DATA0__USDHC2_DATA0 0x1d4 +- MX8MP_IOMUXC_SD2_DATA1__USDHC2_DATA1 0x1d4 +- MX8MP_IOMUXC_SD2_DATA2__USDHC2_DATA2 0x1d4 +- MX8MP_IOMUXC_SD2_DATA3__USDHC2_DATA3 0x1d4 +- MX8MP_IOMUXC_GPIO1_IO04__USDHC2_VSELECT 0xc0 +- >; +- }; +- +- pinctrl_usdhc2_200mhz: usdhc2-200mhzgrp { +- fsl,pins = < +- MX8MP_IOMUXC_SD2_CLK__USDHC2_CLK 0x196 +- MX8MP_IOMUXC_SD2_CMD__USDHC2_CMD 0x1d6 +- MX8MP_IOMUXC_SD2_DATA0__USDHC2_DATA0 0x1d6 +- MX8MP_IOMUXC_SD2_DATA1__USDHC2_DATA1 0x1d6 +- MX8MP_IOMUXC_SD2_DATA2__USDHC2_DATA2 0x1d6 +- MX8MP_IOMUXC_SD2_DATA3__USDHC2_DATA3 0x1d6 +- MX8MP_IOMUXC_GPIO1_IO04__USDHC2_VSELECT 0xc0 +- >; +- }; +- +- pinctrl_usdhc2_gpio: usdhc2gpiogrp { +- fsl,pins = < +- MX8MP_IOMUXC_SD2_CD_B__GPIO2_IO12 0x1c4 +- >; +- }; +-}; diff --git a/target/linux/imx/patches-6.6/503-6.13-arm64-dts-imx8m-venice-gw75xx-add-Accelerometer-device.patch b/target/linux/imx/patches-6.6/503-6.13-arm64-dts-imx8m-venice-gw75xx-add-Accelerometer-device.patch new file mode 100644 index 00000000000000..f30b6904235e08 --- /dev/null +++ b/target/linux/imx/patches-6.6/503-6.13-arm64-dts-imx8m-venice-gw75xx-add-Accelerometer-device.patch @@ -0,0 +1,79 @@ +From ede044113c0418f11dbee09069ff1dd68f284dfa Mon Sep 17 00:00:00 2001 +From: Tim Harvey +Date: Fri, 18 Oct 2024 10:36:08 -0700 +Subject: [PATCH] arm64: dts: imx8m*-venice-gw75xx: add Accelerometer device + +The GW75xx has a LIS2DE12TR 3-axis accelerometer on the I2C bus with an +interrupt pin. Add it to the device-tree. + +Signed-off-by: Tim Harvey +Signed-off-by: Shawn Guo +--- + .../boot/dts/freescale/imx8mm-venice-gw75xx.dtsi | 16 ++++++++++++++++ + .../boot/dts/freescale/imx8mp-venice-gw75xx.dtsi | 16 ++++++++++++++++ + 2 files changed, 32 insertions(+) + +--- a/arch/arm64/boot/dts/freescale/imx8mm-venice-gw75xx.dtsi ++++ b/arch/arm64/boot/dts/freescale/imx8mm-venice-gw75xx.dtsi +@@ -116,6 +116,16 @@ + pinctrl-0 = <&pinctrl_i2c2>; + status = "okay"; + ++ accelerometer@19 { ++ compatible = "st,lis2de12"; ++ reg = <0x19>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_accel>; ++ interrupt-parent = <&gpio5>; ++ interrupts = <8 IRQ_TYPE_LEVEL_LOW>; ++ st,drdy-int-pin = <1>; ++ }; ++ + eeprom@52 { + compatible = "atmel,24c32"; + reg = <0x52>; +@@ -198,6 +208,12 @@ + >; + }; + ++ pinctrl_accel: accelgrp { ++ fsl,pins = < ++ MX8MM_IOMUXC_ECSPI1_MISO_GPIO5_IO8 0x159 ++ >; ++ }; ++ + pinctrl_gpio_leds: gpioledgrp { + fsl,pins = < + MX8MM_IOMUXC_SAI1_RXFS_GPIO4_IO0 0x6 /* LEDG */ +--- a/arch/arm64/boot/dts/freescale/imx8mp-venice-gw75xx.dtsi ++++ b/arch/arm64/boot/dts/freescale/imx8mp-venice-gw75xx.dtsi +@@ -104,6 +104,16 @@ + pinctrl-0 = <&pinctrl_i2c2>; + status = "okay"; + ++ accelerometer@19 { ++ compatible = "st,lis2de12"; ++ reg = <0x19>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_accel>; ++ interrupt-parent = <&gpio5>; ++ interrupts = <8 IRQ_TYPE_LEVEL_LOW>; ++ st,drdy-int-pin = <1>; ++ }; ++ + eeprom@52 { + compatible = "atmel,24c32"; + reg = <0x52>; +@@ -204,6 +214,12 @@ + >; + }; + ++ pinctrl_accel: accelgrp { ++ fsl,pins = < ++ MX8MP_IOMUXC_ECSPI1_MISO__GPIO5_IO08 0x159 ++ >; ++ }; ++ + pinctrl_gpio_leds: gpioledgrp { + fsl,pins = < + MX8MP_IOMUXC_SAI2_RXC__GPIO4_IO22 0x6 /* LEDG */ diff --git a/target/linux/imx/patches-6.6/504-6.13-arm64-dts-imx-Add-i.MX8M-Plus-Gateworks-GW82XX-2X-support.patch b/target/linux/imx/patches-6.6/504-6.13-arm64-dts-imx-Add-i.MX8M-Plus-Gateworks-GW82XX-2X-support.patch new file mode 100644 index 00000000000000..8765474a8aca73 --- /dev/null +++ b/target/linux/imx/patches-6.6/504-6.13-arm64-dts-imx-Add-i.MX8M-Plus-Gateworks-GW82XX-2X-support.patch @@ -0,0 +1,1107 @@ +From a79d2638a7150d1605fcadebb6baa36d27cdc48e Mon Sep 17 00:00:00 2001 +From: Tim Harvey +Date: Thu, 30 May 2024 10:21:45 -0700 +Subject: [PATCH] arm64: dts: imx: Add i.MX8M Plus Gateworks GW82XX-2X support + +The Gateworks GW82XX-2X is an ARM based single board computer (SBC) +comprised of the i.MX8M Plus based gw702x SoM and the gw82xx +baseboard featuring: + - i.MX8M Plus SoC + - LPDDR4 DRAM + - eMMC FLASH + - Gateworks System Controller (GSC) + - microSD (1.8V/3.3V Capable) + - panel status bi-color LED + - pushbutton switch + - fan controller with tachometer + - USB Type-C connector + - PCIe switch + - 2x GbE RJ45 connectors + - multi-protocol RS232/RS485/RS422 Serial ports + - 2x Flexible Socket Adapters with SDIO/UART/USB/PCIe + (for M.2 and miniPCIe expansion) + - 2x isolated CAN + - GPS + - accelerometer + - magnetometer + - off-board connectors for: SPI, GPIO, I2C, ADC + - Wide range DC power input + - support for 802.3at PoE (via adapter) + +Signed-off-by: Tim Harvey +--- + .../devicetree/bindings/arm/fsl.yaml | 1 + + arch/arm64/boot/dts/freescale/Makefile | 1 + + .../dts/freescale/imx8mm-venice-gw82xx.dtsi | 460 +++++++++++++++ + .../boot/dts/freescale/imx8mp-venice-gw82xx-2 | 19 + + .../dts/freescale/imx8mp-venice-gw82xx-2x.dts | 19 + + .../dts/freescale/imx8mp-venice-gw82xx.dtsi | 533 ++++++++++++++++++ + 6 files changed, 1033 insertions(+) + create mode 100644 arch/arm64/boot/dts/freescale/imx8mm-venice-gw82xx.dtsi + create mode 100644 arch/arm64/boot/dts/freescale/imx8mp-venice-gw82xx-2 + create mode 100644 arch/arm64/boot/dts/freescale/imx8mp-venice-gw82xx-2x.dts + create mode 100644 arch/arm64/boot/dts/freescale/imx8mp-venice-gw82xx.dtsi + +--- a/Documentation/devicetree/bindings/arm/fsl.yaml ++++ b/Documentation/devicetree/bindings/arm/fsl.yaml +@@ -1037,6 +1037,7 @@ properties: + - gateworks,imx8mp-gw73xx-2x # i.MX8MP Gateworks Board + - gateworks,imx8mp-gw74xx # i.MX8MP Gateworks Board + - gateworks,imx8mp-gw75xx-2x # i.MX8MP Gateworks Board ++ - gateworks,imx8mp-gw82xx-2x # i.MX8MP Gateworks Board + - toradex,verdin-imx8mp # Verdin iMX8M Plus Modules + - toradex,verdin-imx8mp-nonwifi # Verdin iMX8M Plus Modules without Wi-Fi / BT + - toradex,verdin-imx8mp-wifi # Verdin iMX8M Plus Wi-Fi / BT Modules +--- a/arch/arm64/boot/dts/freescale/Makefile ++++ b/arch/arm64/boot/dts/freescale/Makefile +@@ -108,6 +108,7 @@ dtb-$(CONFIG_ARCH_MXC) += imx8mp-venice- + dtb-$(CONFIG_ARCH_MXC) += imx8mp-venice-gw73xx-2x.dtb + dtb-$(CONFIG_ARCH_MXC) += imx8mp-venice-gw74xx.dtb + dtb-$(CONFIG_ARCH_MXC) += imx8mp-venice-gw75xx-2x.dtb ++dtb-$(CONFIG_ARCH_MXC) += imx8mp-venice-gw82xx-2x.dtb + dtb-$(CONFIG_ARCH_MXC) += imx8mp-verdin-nonwifi-dahlia.dtb + dtb-$(CONFIG_ARCH_MXC) += imx8mp-verdin-nonwifi-dev.dtb + dtb-$(CONFIG_ARCH_MXC) += imx8mp-verdin-nonwifi-yavia.dtb +--- /dev/null ++++ b/arch/arm64/boot/dts/freescale/imx8mm-venice-gw82xx.dtsi +@@ -0,0 +1,460 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright 2020 Gateworks Corporation ++ */ ++ ++#include ++#include ++#include ++ ++/ { ++ aliases { ++ ethernet1 = ð1; ++ usb0 = &usbotg1; ++ usb1 = &usbotg2; ++ }; ++ ++ led-controller { ++ compatible = "gpio-leds"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_gpio_leds>; ++ ++ led-0 { ++ function = LED_FUNCTION_STATUS; ++ color = ; ++ gpios = <&gpio5 5 GPIO_ACTIVE_HIGH>; ++ default-state = "on"; ++ linux,default-trigger = "heartbeat"; ++ }; ++ ++ led-1 { ++ function = LED_FUNCTION_STATUS; ++ color = ; ++ gpios = <&gpio5 4 GPIO_ACTIVE_HIGH>; ++ default-state = "off"; ++ }; ++ }; ++ ++ pcie0_refclk: pcie0-refclk { ++ compatible = "fixed-clock"; ++ #clock-cells = <0>; ++ clock-frequency = <100000000>; ++ }; ++ ++ pps { ++ compatible = "pps-gpio"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_pps>; ++ gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>; ++ status = "okay"; ++ }; ++ ++ reg_1p8v: regulator-1p8v { ++ compatible = "regulator-fixed"; ++ regulator-name = "1P8V"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-always-on; ++ }; ++ ++ reg_3p3v: regulator-3p3v { ++ compatible = "regulator-fixed"; ++ regulator-name = "3P3V"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-always-on; ++ }; ++ ++ reg_usb_otg1_vbus: regulator-usb-otg1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_reg_usb1_en>; ++ compatible = "regulator-fixed"; ++ regulator-name = "usb_otg1_vbus"; ++ gpio = <&gpio1 12 GPIO_ACTIVE_HIGH>; ++ enable-active-high; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ }; ++ ++ reg_usb_otg2_vbus: regulator-usb-otg2 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_reg_usb2_en>; ++ compatible = "regulator-fixed"; ++ regulator-name = "usb_otg2_vbus"; ++ gpio = <&gpio1 8 GPIO_ACTIVE_HIGH>; ++ enable-active-high; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ }; ++ ++ reg_wifi_en: regulator-wifi-en { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_reg_wl>; ++ compatible = "regulator-fixed"; ++ regulator-name = "wl"; ++ gpio = <&gpio1 5 GPIO_ACTIVE_HIGH>; ++ startup-delay-us = <100>; ++ enable-active-high; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ }; ++}; ++ ++/* off-board header */ ++&ecspi2 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_spi2>; ++ cs-gpios = <&gpio5 13 GPIO_ACTIVE_LOW>, ++ <&gpio1 10 GPIO_ACTIVE_LOW>; ++ status = "okay"; ++ ++ tpm@1 { ++ compatible = "atmel,attpm20p", "tcg,tpm_tis-spi"; ++ reg = <0x1>; ++ spi-max-frequency = <36000000>; ++ }; ++}; ++ ++&gpio1 { ++ gpio-line-names = "rs485_term", "mipi_gpio4", "", "", ++ "", "", "pci_usb_sel", "dio0", ++ "", "dio1", "", "", "", "", "", "", ++ "", "", "", "", "", "", "", "", ++ "", "", "", "", "", "", "", ""; ++}; ++ ++&gpio4 { ++ gpio-line-names = "rs485_en", "mipi_gpio3", "rs485_hd", "mipi_gpio2", ++ "mipi_gpio1", "", "", "pci_wdis#", ++ "", "", "", "", "", "", "", "", ++ "", "", "", "", "", "", "", "", ++ "", "", "", "", "", "", "", ""; ++}; ++ ++&i2c2 { ++ clock-frequency = <400000>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_i2c2>; ++ status = "okay"; ++ ++ accelerometer@19 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_accel>; ++ compatible = "st,lis2de12"; ++ reg = <0x19>; ++ st,drdy-int-pin = <1>; ++ interrupt-parent = <&gpio4>; ++ interrupts = <5 IRQ_TYPE_LEVEL_LOW>; ++ }; ++ ++ // TODO: 0x6f PCIe switch ++}; ++ ++/* off-board header */ ++// TODO: i2c expander ++&i2c3 { ++ clock-frequency = <400000>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_i2c3>; ++ status = "okay"; ++}; ++ ++&pcie_phy { ++ fsl,refclk-pad-mode = ; ++ fsl,clkreq-unsupported; ++ clocks = <&pcie0_refclk>; ++ clock-names = "ref"; ++ status = "okay"; ++}; ++ ++&pcie0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_pcie0>; ++ reset-gpio = <&gpio4 6 GPIO_ACTIVE_LOW>; ++ clocks = <&clk IMX8MM_CLK_PCIE1_ROOT>, <&pcie0_refclk>, ++ <&clk IMX8MM_CLK_PCIE1_AUX>; ++ assigned-clocks = <&clk IMX8MM_CLK_PCIE1_AUX>, ++ <&clk IMX8MM_CLK_PCIE1_CTRL>; ++ assigned-clock-rates = <10000000>, <250000000>; ++ assigned-clock-parents = <&clk IMX8MM_SYS_PLL2_50M>, ++ <&clk IMX8MM_SYS_PLL2_250M>; ++ status = "okay"; ++ ++ // TODO: this changes - new switch ++ pcie@0,0 { ++ reg = <0x0000 0 0 0 0>; ++ device_type = "pci"; ++ #address-cells = <3>; ++ #size-cells = <2>; ++ ranges; ++ ++ pcie@0,0 { ++ reg = <0x0000 0 0 0 0>; ++ device_type = "pci"; ++ #address-cells = <3>; ++ #size-cells = <2>; ++ ranges; ++ ++ pcie@4,0 { ++ reg = <0x2000 0 0 0 0>; ++ device_type = "pci"; ++ #address-cells = <3>; ++ #size-cells = <2>; ++ ranges; ++ ++ eth1: ethernet@0,0 { ++ reg = <0x0000 0 0 0 0>; ++ #address-cells = <3>; ++ #size-cells = <2>; ++ ranges; ++ ++ local-mac-address = [00 00 00 00 00 00]; ++ }; ++ }; ++ }; ++ }; ++}; ++ ++/* off-board header */ ++&sai3 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_sai3>; ++ assigned-clocks = <&clk IMX8MM_CLK_SAI3>; ++ assigned-clock-parents = <&clk IMX8MM_AUDIO_PLL1_OUT>; ++ assigned-clock-rates = <24576000>; ++ status = "okay"; ++}; ++ ++/* GPS */ ++&uart1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_uart1>; ++ status = "okay"; ++}; ++ ++/* bluetooth HCI */ ++&uart3 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_uart3>, <&pinctrl_bten>; ++ cts-gpios = <&gpio5 8 GPIO_ACTIVE_LOW>; ++ rts-gpios = <&gpio5 9 GPIO_ACTIVE_LOW>; ++ status = "okay"; ++ ++ bluetooth { ++ compatible = "brcm,bcm4330-bt"; ++ shutdown-gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>; ++ }; ++}; ++ ++/* RS232 */ ++&uart4 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_uart4>; ++ status = "okay"; ++}; ++ ++&usbotg1 { ++ dr_mode = "otg"; ++ over-current-active-low; ++ vbus-supply = <®_usb_otg1_vbus>; ++ status = "okay"; ++}; ++ ++&usbotg2 { ++ dr_mode = "host"; ++ disable-over-current; ++ vbus-supply = <®_usb_otg2_vbus>; ++ status = "okay"; ++}; ++ ++/* SDIO WiFi */ ++&usdhc1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_usdhc1>; ++ bus-width = <4>; ++ non-removable; ++ vmmc-supply = <®_wifi_en>; ++ status = "okay"; ++}; ++ ++/* microSD */ ++&usdhc2 { ++ pinctrl-names = "default", "state_100mhz", "state_200mhz"; ++ pinctrl-0 = <&pinctrl_usdhc2>, <&pinctrl_usdhc2_gpio>; ++ pinctrl-1 = <&pinctrl_usdhc2_100mhz>, <&pinctrl_usdhc2_gpio>; ++ pinctrl-2 = <&pinctrl_usdhc2_200mhz>, <&pinctrl_usdhc2_gpio>; ++ cd-gpios = <&gpio2 12 GPIO_ACTIVE_LOW>; ++ bus-width = <4>; ++ vmmc-supply = <®_3p3v>; ++ status = "okay"; ++}; ++ ++&iomuxc { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_hog>; ++ ++ pinctrl_hog: hoggrp { ++ fsl,pins = < ++ MX8MM_IOMUXC_SPDIF_TX_GPIO5_IO3 0x40000041 /* PLUG_TEST */ ++ MX8MM_IOMUXC_GPIO1_IO06_GPIO1_IO6 0x40000041 /* PCI_USBSEL */ ++ MX8MM_IOMUXC_SAI1_RXD5_GPIO4_IO7 0x40000041 /* PCIE_WDIS# */ ++ MX8MM_IOMUXC_GPIO1_IO07_GPIO1_IO7 0x40000041 /* DIO0 */ ++ MX8MM_IOMUXC_GPIO1_IO09_GPIO1_IO9 0x40000041 /* DIO1 */ ++ MX8MM_IOMUXC_GPIO1_IO00_GPIO1_IO0 0x40000104 /* RS485_TERM */ ++ MX8MM_IOMUXC_SAI1_RXFS_GPIO4_IO0 0x40000104 /* RS485 */ ++ MX8MM_IOMUXC_SAI1_RXD0_GPIO4_IO2 0x40000104 /* RS485_HALF */ ++ >; ++ }; ++ ++ pinctrl_accel: accelgrp { ++ fsl,pins = < ++ MX8MM_IOMUXC_SAI1_RXD3_GPIO4_IO5 0x159 ++ >; ++ }; ++ ++ pinctrl_bten: btengrp { ++ fsl,pins = < ++ MX8MM_IOMUXC_GPIO1_IO03_GPIO1_IO3 0x41 ++ >; ++ }; ++ ++ pinctrl_gpio_leds: gpioledgrp { ++ fsl,pins = < ++ MX8MM_IOMUXC_SPDIF_EXT_CLK_GPIO5_IO5 0x19 ++ MX8MM_IOMUXC_SPDIF_RX_GPIO5_IO4 0x19 ++ >; ++ }; ++ ++ pinctrl_i2c3: i2c3grp { ++ fsl,pins = < ++ MX8MM_IOMUXC_I2C3_SCL_I2C3_SCL 0x400001c3 ++ MX8MM_IOMUXC_I2C3_SDA_I2C3_SDA 0x400001c3 ++ >; ++ }; ++ ++ pinctrl_pcie0: pcie0grp { ++ fsl,pins = < ++ MX8MM_IOMUXC_SAI1_RXD4_GPIO4_IO6 0x41 ++ >; ++ }; ++ ++ pinctrl_pps: ppsgrp { ++ fsl,pins = < ++ MX8MM_IOMUXC_GPIO1_IO15_GPIO1_IO15 0x41 ++ >; ++ }; ++ ++ pinctrl_reg_wl: regwlgrp { ++ fsl,pins = < ++ MX8MM_IOMUXC_GPIO1_IO05_GPIO1_IO5 0x41 ++ >; ++ }; ++ ++ pinctrl_reg_usb1_en: regusb1grp { ++ fsl,pins = < ++ MX8MM_IOMUXC_GPIO1_IO12_GPIO1_IO12 0x41 ++ MX8MM_IOMUXC_GPIO1_IO13_USB1_OTG_OC 0x41 ++ >; ++ }; ++ ++ pinctrl_reg_usb2_en: regusb2grp { ++ fsl,pins = < ++ MX8MM_IOMUXC_GPIO1_IO08_GPIO1_IO8 0x41 ++ >; ++ }; ++ ++ pinctrl_sai3: sai3grp { ++ fsl,pins = < ++ MX8MM_IOMUXC_SAI3_TXFS_SAI3_TX_SYNC 0xd6 ++ MX8MM_IOMUXC_SAI3_TXC_SAI3_TX_BCLK 0xd6 ++ MX8MM_IOMUXC_SAI3_MCLK_SAI3_MCLK 0xd6 ++ MX8MM_IOMUXC_SAI3_TXD_SAI3_TX_DATA0 0xd6 ++ MX8MM_IOMUXC_SAI3_RXD_SAI3_RX_DATA0 0xd6 ++ >; ++ }; ++ ++ pinctrl_spi2: spi2grp { ++ fsl,pins = < ++ MX8MM_IOMUXC_ECSPI2_SCLK_ECSPI2_SCLK 0xd6 ++ MX8MM_IOMUXC_ECSPI2_MOSI_ECSPI2_MOSI 0xd6 ++ MX8MM_IOMUXC_ECSPI2_MISO_ECSPI2_MISO 0xd6 ++ MX8MM_IOMUXC_ECSPI2_SS0_GPIO5_IO13 0xd6 ++ MX8MM_IOMUXC_GPIO1_IO10_GPIO1_IO10 0xd6 ++ >; ++ }; ++ ++ pinctrl_uart1: uart1grp { ++ fsl,pins = < ++ MX8MM_IOMUXC_UART1_RXD_UART1_DCE_RX 0x140 ++ MX8MM_IOMUXC_UART1_TXD_UART1_DCE_TX 0x140 ++ >; ++ }; ++ ++ pinctrl_uart3: uart3grp { ++ fsl,pins = < ++ MX8MM_IOMUXC_UART3_RXD_UART3_DCE_RX 0x140 ++ MX8MM_IOMUXC_UART3_TXD_UART3_DCE_TX 0x140 ++ MX8MM_IOMUXC_ECSPI1_MISO_GPIO5_IO8 0x140 ++ MX8MM_IOMUXC_ECSPI1_SS0_GPIO5_IO9 0x140 ++ >; ++ }; ++ ++ pinctrl_uart4: uart4grp { ++ fsl,pins = < ++ MX8MM_IOMUXC_UART4_RXD_UART4_DCE_RX 0x140 ++ MX8MM_IOMUXC_UART4_TXD_UART4_DCE_TX 0x140 ++ >; ++ }; ++ ++ pinctrl_usdhc1: usdhc1grp { ++ fsl,pins = < ++ MX8MM_IOMUXC_SD1_CLK_USDHC1_CLK 0x190 ++ MX8MM_IOMUXC_SD1_CMD_USDHC1_CMD 0x1d0 ++ MX8MM_IOMUXC_SD1_DATA0_USDHC1_DATA0 0x1d0 ++ MX8MM_IOMUXC_SD1_DATA1_USDHC1_DATA1 0x1d0 ++ MX8MM_IOMUXC_SD1_DATA2_USDHC1_DATA2 0x1d0 ++ MX8MM_IOMUXC_SD1_DATA3_USDHC1_DATA3 0x1d0 ++ >; ++ }; ++ ++ pinctrl_usdhc2: usdhc2grp { ++ fsl,pins = < ++ MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK 0x190 ++ MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD 0x1d0 ++ MX8MM_IOMUXC_SD2_DATA0_USDHC2_DATA0 0x1d0 ++ MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1 0x1d0 ++ MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d0 ++ MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d0 ++ >; ++ }; ++ ++ pinctrl_usdhc2_100mhz: usdhc2-100mhzgrp { ++ fsl,pins = < ++ MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK 0x194 ++ MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD 0x1d4 ++ MX8MM_IOMUXC_SD2_DATA0_USDHC2_DATA0 0x1d4 ++ MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1 0x1d4 ++ MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d4 ++ MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d4 ++ >; ++ }; ++ ++ pinctrl_usdhc2_200mhz: usdhc2-200mhzgrp { ++ fsl,pins = < ++ MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK 0x196 ++ MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD 0x1d6 ++ MX8MM_IOMUXC_SD2_DATA0_USDHC2_DATA0 0x1d6 ++ MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1 0x1d6 ++ MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d6 ++ MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d6 ++ >; ++ }; ++ ++ pinctrl_usdhc2_gpio: usdhc2gpiogrp { ++ fsl,pins = < ++ MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x1c4 ++ MX8MM_IOMUXC_SD2_RESET_B_USDHC2_RESET_B 0x1d0 ++ MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x1d0 ++ >; ++ }; ++}; +--- /dev/null ++++ b/arch/arm64/boot/dts/freescale/imx8mp-venice-gw82xx-2 +@@ -0,0 +1,19 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright 2024 Gateworks Corporation ++ */ ++ ++/dts-v1/; ++ ++#include "imx8mm.dtsi" ++#include "imx8mm-venice-gw700x.dtsi" ++#include "imx8mm-venice-gw82xx.dtsi" ++ ++/ { ++ model = "Gateworks Venice GW82xx-0x i.MX8MM Development Kit"; ++ compatible = "gw,imx8mm-gw82xx-0x", "fsl,imx8mm"; ++ ++ chosen { ++ stdout-path = &uart2; ++ }; ++}; +--- /dev/null ++++ b/arch/arm64/boot/dts/freescale/imx8mp-venice-gw82xx-2x.dts +@@ -0,0 +1,19 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright 2024 Gateworks Corporation ++ */ ++ ++/dts-v1/; ++ ++#include "imx8mp.dtsi" ++#include "imx8mp-venice-gw702x.dtsi" ++#include "imx8mp-venice-gw82xx.dtsi" ++ ++/ { ++ model = "Gateworks Venice GW82xx-2x i.MX8MP Development Kit"; ++ compatible = "gateworks,imx8mp-gw82xx-2x", "fsl,imx8mp"; ++ ++ chosen { ++ stdout-path = &uart2; ++ }; ++}; +--- /dev/null ++++ b/arch/arm64/boot/dts/freescale/imx8mp-venice-gw82xx.dtsi +@@ -0,0 +1,533 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright 2024 Gateworks Corporation ++ */ ++ ++#include ++#include ++#include ++ ++/ { ++ aliases { ++ ethernet1 = ð1; ++ fsa1 = &fsa0; ++ fsa2 = &fsa1; ++ }; ++ ++ led-controller { ++ compatible = "gpio-leds"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_gpio_leds>; ++ ++ led-0 { ++ function = LED_FUNCTION_STATUS; ++ color = ; ++ gpios = <&gpio4 1 GPIO_ACTIVE_HIGH>; ++ default-state = "on"; ++ linux,default-trigger = "heartbeat"; ++ }; ++ ++ led-1 { ++ function = LED_FUNCTION_STATUS; ++ color = ; ++ gpios = <&gpio4 5 GPIO_ACTIVE_HIGH>; ++ default-state = "off"; ++ }; ++ }; ++ ++ pcie0_refclk: clock-pcie0 { ++ compatible = "fixed-clock"; ++ #clock-cells = <0>; ++ clock-frequency = <100000000>; ++ }; ++ ++ pps { ++ compatible = "pps-gpio"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_pps>; ++ gpios = <&gpio4 3 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ reg_usb2_vbus: regulator-usb2 { ++ compatible = "regulator-fixed"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_reg_usb2_en>; ++ regulator-name = "usb2_vbus"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ gpio = <&gpio4 12 GPIO_ACTIVE_HIGH>; ++ enable-active-high; ++ }; ++ ++ reg_usdhc2_vmmc: regulator-usdhc2-vmmc { ++ compatible = "regulator-fixed"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_usdhc2_vmmc>; ++ regulator-name = "VDD_3V3_SD"; ++ regulator-max-microvolt = <3300000>; ++ regulator-min-microvolt = <3300000>; ++ gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>; ++ enable-active-high; ++ off-on-delay-us = <12000>; ++ startup-delay-us = <100>; ++ }; ++}; ++ ++&ecspi2 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_spi2>; ++ cs-gpios = <&gpio1 10 GPIO_ACTIVE_LOW>, /* CS0 onboard TPM */ ++ <&gpio5 13 GPIO_ACTIVE_LOW>, /* CS1 off-board J32 SPI */ ++ <&gpio1 12 GPIO_ACTIVE_LOW>, /* CS3 off-board J52 FSA1 */ ++ <&gpio4 26 GPIO_ACTIVE_LOW>; /* CS2 off-board J51 FSA2 */ ++ status = "okay"; ++ ++ tpm@0 { ++ compatible = "atmel,attpm20p", "tcg,tpm_tis-spi"; ++ reg = <0x0>; ++ spi-max-frequency = <10000000>; ++ }; ++}; ++ ++&flexcan1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_can1>; ++ status = "okay"; ++}; ++ ++&flexcan2 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_can2>; ++ status = "okay"; ++}; ++ ++&gpio1 { ++ gpio-line-names = ++ "", "", "", "", ++ "", "", "", "", ++ "", "", "", "", ++ "", "fsa2_gpio1", "", "", ++ "", "", "", "", ++ "", "", "", "", ++ "", "", "", "", ++ "", "", "", ""; ++}; ++ ++&gpio4 { ++ gpio-line-names = ++ "", "", "", "", ++ "", "", "", "", ++ "dio1", "fsa1_gpio2", "", "dio0", ++ "", "", "", "", ++ "", "", "", "", ++ "", "", "rs485_en", "rs485_term", ++ "fsa2_gpio2", "fsa1_gpio1", "", "rs485_half", ++ "", "", "", ""; ++}; ++ ++&i2c2 { ++ accelerometer@19 { ++ compatible = "st,lis2de12"; ++ reg = <0x19>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_accel>; ++ interrupt-parent = <&gpio4>; ++ interrupts = <21 IRQ_TYPE_LEVEL_LOW>; ++ st,drdy-int-pin = <1>; ++ }; ++ ++ magnetometer@1e { ++ compatible = "st,lis2mdl"; ++ reg = <0x1e>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_mag>; ++ interrupt-parent = <&gpio4>; ++ interrupts = <28 IRQ_TYPE_LEVEL_LOW>; ++ }; ++}; ++ ++&i2c3 { ++ i2c-mux@70 { ++ compatible = "nxp,pca9548"; ++ reg = <0x70>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ /* J30 */ ++ fsa1: i2c@0 { ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_fsa2i2c>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ gpio@20 { ++ compatible = "nxp,pca9555"; ++ reg = <0x20>; ++ interrupt-parent = <&gpio4>; ++ interrupts = <4 IRQ_TYPE_EDGE_FALLING>; ++ interrupt-controller; ++ #interrupt-cells = <2>; ++ gpio-controller; ++ #gpio-cells = <2>; ++ }; ++ ++ eeprom@54 { ++ compatible = "atmel,24c02"; ++ reg = <0x54>; ++ pagesize = <16>; ++ }; ++ ++ eeprom@55 { ++ compatible = "atmel,24c02"; ++ reg = <0x55>; ++ pagesize = <16>; ++ }; ++ }; ++ ++ /* J29 */ ++ fsa0: i2c@1 { ++ reg = <1>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_fsa1i2c>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ gpio@20 { ++ compatible = "nxp,pca9555"; ++ reg = <0x20>; ++ interrupt-parent = <&gpio4>; ++ interrupts = <14 IRQ_TYPE_EDGE_FALLING>; ++ interrupt-controller; ++ #interrupt-cells = <2>; ++ gpio-controller; ++ #gpio-cells = <2>; ++ }; ++ ++ eeprom@54 { ++ compatible = "atmel,24c02"; ++ reg = <0x54>; ++ pagesize = <16>; ++ }; ++ ++ eeprom@55 { ++ compatible = "atmel,24c02"; ++ reg = <0x55>; ++ pagesize = <16>; ++ }; ++ }; ++ ++ /* J33 */ ++ i2c@2 { ++ reg = <2>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ }; ++ }; ++}; ++ ++&pcie_phy { ++ clocks = <&pcie0_refclk>; ++ clock-names = "ref"; ++ fsl,refclk-pad-mode = ; ++ fsl,clkreq-unsupported; ++ status = "okay"; ++}; ++ ++&pcie { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_pcie0>; ++ reset-gpio = <&gpio4 29 GPIO_ACTIVE_LOW>; ++ status = "okay"; ++ ++ pcie@0,0 { ++ reg = <0x0000 0 0 0 0>; ++ device_type = "pci"; ++ #address-cells = <3>; ++ #size-cells = <2>; ++ ranges; ++ ++ pcie@0,0 { ++ reg = <0x0000 0 0 0 0>; ++ device_type = "pci"; ++ #address-cells = <3>; ++ #size-cells = <2>; ++ ranges; ++ ++ pcie@7,0 { ++ reg = <0x3800 0 0 0 0>; ++ device_type = "pci"; ++ #address-cells = <3>; ++ #size-cells = <2>; ++ ranges; ++ ++ eth1: ethernet@0,0 { ++ reg = <0x0000 0 0 0 0>; ++ #address-cells = <3>; ++ #size-cells = <2>; ++ ranges; ++ local-mac-address = [00 00 00 00 00 00]; ++ }; ++ }; ++ }; ++ }; ++}; ++ ++/* GPS */ ++&uart1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_uart1>; ++ status = "okay"; ++}; ++ ++/* RS232 */ ++&uart4 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_uart4>; ++ status = "okay"; ++}; ++ ++/* USB1 - FSA1 */ ++&usb3_0 { ++ fsl,permanently-attached; ++ fsl,disable-port-power-control; ++ status = "okay"; ++}; ++ ++&usb3_phy0 { ++ status = "okay"; ++}; ++ ++&usb_dwc3_0 { ++ dr_mode = "host"; ++ status = "okay"; ++}; ++ ++/* USB2 - USB3.0 Hub */ ++&usb3_1 { ++ fsl,permanently-attached; ++ fsl,disable-port-power-control; ++ status = "okay"; ++}; ++ ++&usb3_phy1 { ++ vbus-supply = <®_usb2_vbus>; ++ status = "okay"; ++}; ++ ++&usb_dwc3_1 { ++ dr_mode = "host"; ++ status = "okay"; ++}; ++ ++/* SDIO 1.8V */ ++&usdhc1 { ++ pinctrl-names = "default", "state_100mhz", "state_200mhz"; ++ pinctrl-0 = <&pinctrl_usdhc1>; ++ pinctrl-1 = <&pinctrl_usdhc1_100mhz>; ++ pinctrl-2 = <&pinctrl_usdhc1_200mhz>; ++ bus-width = <4>; ++ non-removable; ++ status = "okay"; ++}; ++ ++/* microSD */ ++&usdhc2 { ++ pinctrl-names = "default", "state_100mhz", "state_200mhz"; ++ pinctrl-0 = <&pinctrl_usdhc2>, <&pinctrl_usdhc2_gpio>; ++ pinctrl-1 = <&pinctrl_usdhc2_100mhz>, <&pinctrl_usdhc2_gpio>; ++ pinctrl-2 = <&pinctrl_usdhc2_200mhz>, <&pinctrl_usdhc2_gpio>; ++ cd-gpios = <&gpio2 12 GPIO_ACTIVE_HIGH>; /* CD is active high */ ++ bus-width = <4>; ++ vmmc-supply = <®_usdhc2_vmmc>; ++ status = "okay"; ++}; ++ ++&iomuxc { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_hog>; ++ ++ pinctrl_hog: hoggrp { ++ fsl,pins = < ++ MX8MP_IOMUXC_SAI1_RXD6__GPIO4_IO08 0x40000146 /* DIO1 */ ++ MX8MP_IOMUXC_SAI1_TXC__GPIO4_IO11 0x40000146 /* DIO0 */ ++ MX8MP_IOMUXC_SAI2_MCLK__GPIO4_IO27 0x40000106 /* RS485_HALF */ ++ MX8MP_IOMUXC_SAI2_RXC__GPIO4_IO22 0x40000106 /* RS485_EN */ ++ MX8MP_IOMUXC_SAI2_RXD0__GPIO4_IO23 0x40000106 /* RS485_TERM */ ++ >; ++ }; ++ ++ pinctrl_accel: accelgrp { ++ fsl,pins = < ++ MX8MP_IOMUXC_SAI2_RXFS__GPIO4_IO21 0x150 /* IRQ# */ ++ >; ++ }; ++ ++ pinctrl_can1: can1grp { ++ fsl,pins = < ++ MX8MP_IOMUXC_SPDIF_TX__CAN1_TX 0x154 ++ MX8MP_IOMUXC_SPDIF_RX__CAN1_RX 0x154 ++ >; ++ }; ++ ++ pinctrl_can2: can2grp { ++ fsl,pins = < ++ MX8MP_IOMUXC_SAI5_RXD3__CAN2_TX 0x154 ++ MX8MP_IOMUXC_SAI5_MCLK__CAN2_RX 0x154 ++ >; ++ }; ++ ++ pinctrl_gpio_leds: gpioledgrp { ++ fsl,pins = < ++ MX8MP_IOMUXC_SAI1_RXC__GPIO4_IO01 0x6 /* LEDG */ ++ MX8MP_IOMUXC_SAI1_RXD3__GPIO4_IO05 0x6 /* LEDR */ ++ >; ++ }; ++ ++ pinctrl_fsa1i2c: fsa1i2cgrp { ++ fsl,pins = < ++ MX8MP_IOMUXC_SAI1_TXD2__GPIO4_IO14 0x1d0 /* FSA1_ALERT# */ ++ MX8MP_IOMUXC_SAI2_TXC__GPIO4_IO25 0x400001d0 /* FSA1_GPIO1 */ ++ MX8MP_IOMUXC_SAI1_RXD7__GPIO4_IO09 0x400001d0 /* FSA1_GPIO2 */ ++ >; ++ }; ++ ++ pinctrl_fsa2i2c: fsa2i2cgrp { ++ fsl,pins = < ++ MX8MP_IOMUXC_SAI1_RXD2__GPIO4_IO04 0x1d0 /* FSA2_ALERT# */ ++ MX8MP_IOMUXC_GPIO1_IO13__GPIO1_IO13 0x400001d0 /* FSA2_GPIO1 */ ++ MX8MP_IOMUXC_SAI2_TXFS__GPIO4_IO24 0x400001d0 /* FSA2_GPIO2 */ ++ >; ++ }; ++ ++ pinctrl_mag: maggrp { ++ fsl,pins = < ++ MX8MP_IOMUXC_SAI3_RXFS__GPIO4_IO28 0x140 /* IRQ# */ ++ >; ++ }; ++ ++ pinctrl_pcie0: pcie0grp { ++ fsl,pins = < ++ MX8MP_IOMUXC_SAI3_RXC__GPIO4_IO29 0x106 /* PERST# */ ++ >; ++ }; ++ ++ pinctrl_pps: ppsgrp { ++ fsl,pins = < ++ MX8MP_IOMUXC_SAI1_RXD1__GPIO4_IO03 0x146 ++ >; ++ }; ++ ++ pinctrl_reg_usb2_en: regusb2grp { ++ fsl,pins = < ++ MX8MP_IOMUXC_SAI1_TXD0__GPIO4_IO12 0x146 /* USBHUB_RST# */ ++ >; ++ }; ++ ++ pinctrl_spi2: spi2grp { ++ fsl,pins = < ++ MX8MP_IOMUXC_ECSPI2_SCLK__ECSPI2_SCLK 0xd0 ++ MX8MP_IOMUXC_ECSPI2_MOSI__ECSPI2_MOSI 0xd0 ++ MX8MP_IOMUXC_ECSPI2_MISO__ECSPI2_MISO 0xd0 ++ MX8MP_IOMUXC_ECSPI2_SS0__GPIO5_IO13 0x140 /* J32_CS */ ++ MX8MP_IOMUXC_GPIO1_IO10__GPIO1_IO10 0x140 /* TPM_CS */ ++ MX8MP_IOMUXC_GPIO1_IO12__GPIO1_IO12 0x140 /* FSA1_CS */ ++ MX8MP_IOMUXC_SAI2_TXD0__GPIO4_IO26 0x140 /* FSA2_CS */ ++ >; ++ }; ++ ++ pinctrl_uart1: uart1grp { ++ fsl,pins = < ++ MX8MP_IOMUXC_UART1_RXD__UART1_DCE_RX 0x140 ++ MX8MP_IOMUXC_UART1_TXD__UART1_DCE_TX 0x140 ++ >; ++ }; ++ ++ pinctrl_uart4: uart4grp { ++ fsl,pins = < ++ MX8MP_IOMUXC_UART4_RXD__UART4_DCE_RX 0x140 ++ MX8MP_IOMUXC_UART4_TXD__UART4_DCE_TX 0x140 ++ >; ++ }; ++ ++ pinctrl_usdhc1: usdhc1grp { ++ fsl,pins = < ++ MX8MP_IOMUXC_SD1_CLK__USDHC1_CLK 0x190 ++ MX8MP_IOMUXC_SD1_CMD__USDHC1_CMD 0x1d0 ++ MX8MP_IOMUXC_SD1_DATA0__USDHC1_DATA0 0x1d0 ++ MX8MP_IOMUXC_SD1_DATA1__USDHC1_DATA1 0x1d0 ++ MX8MP_IOMUXC_SD1_DATA2__USDHC1_DATA2 0x1d0 ++ MX8MP_IOMUXC_SD1_DATA3__USDHC1_DATA3 0x1d0 ++ >; ++ }; ++ ++ pinctrl_usdhc1_100mhz: usdhc1-100mhzgrp { ++ fsl,pins = < ++ MX8MP_IOMUXC_SD1_CLK__USDHC1_CLK 0x194 ++ MX8MP_IOMUXC_SD1_CMD__USDHC1_CMD 0x1d4 ++ MX8MP_IOMUXC_SD1_DATA0__USDHC1_DATA0 0x1d4 ++ MX8MP_IOMUXC_SD1_DATA1__USDHC1_DATA1 0x1d4 ++ MX8MP_IOMUXC_SD1_DATA2__USDHC1_DATA2 0x1d4 ++ MX8MP_IOMUXC_SD1_DATA3__USDHC1_DATA3 0x1d4 ++ >; ++ }; ++ ++ pinctrl_usdhc1_200mhz: usdhc1-200mhzgrp { ++ fsl,pins = < ++ MX8MP_IOMUXC_SD1_CLK__USDHC1_CLK 0x196 ++ MX8MP_IOMUXC_SD1_CMD__USDHC1_CMD 0x1d6 ++ MX8MP_IOMUXC_SD1_DATA0__USDHC1_DATA0 0x1d6 ++ MX8MP_IOMUXC_SD1_DATA1__USDHC1_DATA1 0x1d6 ++ MX8MP_IOMUXC_SD1_DATA2__USDHC1_DATA2 0x1d6 ++ MX8MP_IOMUXC_SD1_DATA3__USDHC1_DATA3 0x1d6 ++ >; ++ }; ++ ++ pinctrl_usdhc2: usdhc2grp { ++ fsl,pins = < ++ MX8MP_IOMUXC_SD2_CLK__USDHC2_CLK 0x190 ++ MX8MP_IOMUXC_SD2_CMD__USDHC2_CMD 0x1d0 ++ MX8MP_IOMUXC_SD2_DATA0__USDHC2_DATA0 0x1d0 ++ MX8MP_IOMUXC_SD2_DATA1__USDHC2_DATA1 0x1d0 ++ MX8MP_IOMUXC_SD2_DATA2__USDHC2_DATA2 0x1d0 ++ MX8MP_IOMUXC_SD2_DATA3__USDHC2_DATA3 0x1d0 ++ MX8MP_IOMUXC_GPIO1_IO04__USDHC2_VSELECT 0xc1 ++ >; ++ }; ++ ++ pinctrl_usdhc2_100mhz: usdhc2-100mhzgrp { ++ fsl,pins = < ++ MX8MP_IOMUXC_SD2_CLK__USDHC2_CLK 0x194 ++ MX8MP_IOMUXC_SD2_CMD__USDHC2_CMD 0x1d4 ++ MX8MP_IOMUXC_SD2_DATA0__USDHC2_DATA0 0x1d4 ++ MX8MP_IOMUXC_SD2_DATA1__USDHC2_DATA1 0x1d4 ++ MX8MP_IOMUXC_SD2_DATA2__USDHC2_DATA2 0x1d4 ++ MX8MP_IOMUXC_SD2_DATA3__USDHC2_DATA3 0x1d4 ++ MX8MP_IOMUXC_GPIO1_IO04__USDHC2_VSELECT 0xc1 ++ >; ++ }; ++ ++ pinctrl_usdhc2_200mhz: usdhc2-200mhzgrp { ++ fsl,pins = < ++ MX8MP_IOMUXC_SD2_CLK__USDHC2_CLK 0x196 ++ MX8MP_IOMUXC_SD2_CMD__USDHC2_CMD 0x1d6 ++ MX8MP_IOMUXC_SD2_DATA0__USDHC2_DATA0 0x1d6 ++ MX8MP_IOMUXC_SD2_DATA1__USDHC2_DATA1 0x1d6 ++ MX8MP_IOMUXC_SD2_DATA2__USDHC2_DATA2 0x1d6 ++ MX8MP_IOMUXC_SD2_DATA3__USDHC2_DATA3 0x1d6 ++ MX8MP_IOMUXC_GPIO1_IO04__USDHC2_VSELECT 0xc1 ++ >; ++ }; ++ ++ pinctrl_usdhc2_vmmc: usdhc2-vmmc-grp { ++ fsl,pins = < ++ MX8MP_IOMUXC_SD2_RESET_B__GPIO2_IO19 0x1d0 ++ >; ++ }; ++ ++ pinctrl_usdhc2_gpio: usdhc2gpiogrp { ++ fsl,pins = < ++ MX8MP_IOMUXC_SD2_CD_B__GPIO2_IO12 0x1c4 ++ >; ++ }; ++}; From 7feb8be5e4fa4ef26f3ed96daa0ef26fc530892c Mon Sep 17 00:00:00 2001 From: Tim Harvey Date: Tue, 17 Dec 2024 14:52:48 -0800 Subject: [PATCH 453/877] imx: 6.6: add a patch to work around a PCI init hang on IMX8M{M,P} The act of attempting link at gen1 then trying to link at higher speeds causes a hang with the specific PCIe switch used on the Gateworks Venice boards. Work around this by linking at the highest speed first as is common with all other PCI controller drivers. Signed-off-by: Tim Harvey Link: https://github.com/openwrt/openwrt/pull/17717 Signed-off-by: Robert Marko Link: https://github.com/openwrt/openwrt/pull/17762 Signed-off-by: Hauke Mehrtens (cherry picked from commit 23a18a57cf750d9081353cdd34e44982ea10e191) --- ...-max-gen-first-for-IMX8MM-and-IMX8MP.patch | 119 ++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 target/linux/imx/patches-6.6/600-PCI-imx6-Start-link-at-max-gen-first-for-IMX8MM-and-IMX8MP.patch diff --git a/target/linux/imx/patches-6.6/600-PCI-imx6-Start-link-at-max-gen-first-for-IMX8MM-and-IMX8MP.patch b/target/linux/imx/patches-6.6/600-PCI-imx6-Start-link-at-max-gen-first-for-IMX8MM-and-IMX8MP.patch new file mode 100644 index 00000000000000..002c2044622ae0 --- /dev/null +++ b/target/linux/imx/patches-6.6/600-PCI-imx6-Start-link-at-max-gen-first-for-IMX8MM-and-IMX8MP.patch @@ -0,0 +1,119 @@ +From cf983e4a04eecb5be93af7b53cb10805ee448998 Mon Sep 17 00:00:00 2001 +From: Tim Harvey +Date: Mon, 21 Aug 2023 09:20:17 -0700 +Subject: [PATCH] PCI: imx6: Start link at max gen first for IMX8MM and IMX8MP + +commit fa33a6d87eac ("PCI: imx6: Start link in Gen1 before negotiating +for Gen2 mode") started link negotiation at Gen1 before attempting +faster speeds in order to work around an issue with a particular switch +on an IMX6Q SoC. + +This behavior is not the norm for PCI link negotiation and it has been +found to cause issues in other cases: +- IMX8MM with PI7C9X2G608GP switch: various endpoints (such as qca988x) + will fail to link more than 50% of the time +- IMX8MP with PI7C9X2G608GP switch: occasionally will fail to link with + switch and cause a CPU hang about 30% of the time + +Disable this behavior for IMX8MM and IMX8MP. + +Signed-off-by: Tim Harvey +--- + drivers/pci/controller/dwc/pci-imx6.c | 53 ++++++++++++++------------- + 1 file changed, 27 insertions(+), 26 deletions(-) + +--- a/drivers/pci/controller/dwc/pci-imx6.c ++++ b/drivers/pci/controller/dwc/pci-imx6.c +@@ -60,6 +60,7 @@ enum imx6_pcie_variants { + #define IMX6_PCIE_FLAG_IMX6_PHY BIT(0) + #define IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE BIT(1) + #define IMX6_PCIE_FLAG_SUPPORTS_SUSPEND BIT(2) ++#define IMX6_PCIE_FLAG_GEN1_LAST BIT(3) + + struct imx6_pcie_drvdata { + enum imx6_pcie_variants variant; +@@ -876,26 +877,28 @@ static int imx6_pcie_start_link(struct d + u32 tmp; + int ret; + +- /* +- * Force Gen1 operation when starting the link. In case the link is +- * started in Gen2 mode, there is a possibility the devices on the +- * bus will not be detected at all. This happens with PCIe switches. +- */ +- dw_pcie_dbi_ro_wr_en(pci); +- tmp = dw_pcie_readl_dbi(pci, offset + PCI_EXP_LNKCAP); +- tmp &= ~PCI_EXP_LNKCAP_SLS; +- tmp |= PCI_EXP_LNKCAP_SLS_2_5GB; +- dw_pcie_writel_dbi(pci, offset + PCI_EXP_LNKCAP, tmp); +- dw_pcie_dbi_ro_wr_dis(pci); ++ if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_GEN1_LAST)) { ++ /* ++ * Force Gen1 operation when starting the link. In case the link is ++ * started in Gen2 mode, there is a possibility the devices on the ++ * bus will not be detected at all. This happens with PCIe switches. ++ */ ++ dw_pcie_dbi_ro_wr_en(pci); ++ tmp = dw_pcie_readl_dbi(pci, offset + PCI_EXP_LNKCAP); ++ tmp &= ~PCI_EXP_LNKCAP_SLS; ++ tmp |= PCI_EXP_LNKCAP_SLS_2_5GB; ++ dw_pcie_writel_dbi(pci, offset + PCI_EXP_LNKCAP, tmp); ++ dw_pcie_dbi_ro_wr_dis(pci); ++ } + + /* Start LTSSM. */ + imx6_pcie_ltssm_enable(dev); + +- ret = dw_pcie_wait_for_link(pci); +- if (ret) +- goto err_reset_phy; ++ if ((pci->link_gen > 1) && !(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_GEN1_LAST)) { ++ ret = dw_pcie_wait_for_link(pci); ++ if (ret) ++ goto err_reset_phy; + +- if (pci->link_gen > 1) { + /* Allow faster modes after the link is up */ + dw_pcie_dbi_ro_wr_en(pci); + tmp = dw_pcie_readl_dbi(pci, offset + PCI_EXP_LNKCAP); +@@ -929,18 +932,14 @@ static int imx6_pcie_start_link(struct d + goto err_reset_phy; + } + } +- +- /* Make sure link training is finished as well! */ +- ret = dw_pcie_wait_for_link(pci); +- if (ret) +- goto err_reset_phy; +- } else { +- dev_info(dev, "Link: Only Gen1 is enabled\n"); + } + ++ ret = dw_pcie_wait_for_link(pci); ++ if (ret) ++ goto err_reset_phy; ++ + imx6_pcie->link_is_up = true; +- tmp = dw_pcie_readw_dbi(pci, offset + PCI_EXP_LNKSTA); +- dev_info(dev, "Link up, Gen%i\n", tmp & PCI_EXP_LNKSTA_CLS); ++ + return 0; + + err_reset_phy: +@@ -1505,12 +1504,14 @@ static const struct imx6_pcie_drvdata dr + }, + [IMX8MM] = { + .variant = IMX8MM, +- .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, ++ .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND | ++ IMX6_PCIE_FLAG_GEN1_LAST, + .gpr = "fsl,imx8mm-iomuxc-gpr", + }, + [IMX8MP] = { + .variant = IMX8MP, +- .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, ++ .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND | ++ IMX6_PCIE_FLAG_GEN1_LAST, + .gpr = "fsl,imx8mp-iomuxc-gpr", + }, + [IMX8MQ_EP] = { From c4f5028bdf2a1210734476a33c08d08a090f78ab Mon Sep 17 00:00:00 2001 From: Tim Harvey Date: Thu, 23 Jan 2025 10:29:55 -0800 Subject: [PATCH 454/877] imx: coretexa53: add network configuration for gw82xx-2x The GW82xx-2x has two network ports. By convention, the first port (eth0) should be the WAN port and the second port (eth1) should be the LAN port. Signed-off-by: Tim Harvey Link: https://github.com/openwrt/openwrt/pull/17717 Signed-off-by: Robert Marko Link: https://github.com/openwrt/openwrt/pull/17762 Signed-off-by: Hauke Mehrtens (cherry picked from commit d2eaaa90d502fa418d7d9bb8d4e6ccbe0131c832) --- target/linux/imx/cortexa53/base-files/etc/board.d/02_network | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/linux/imx/cortexa53/base-files/etc/board.d/02_network b/target/linux/imx/cortexa53/base-files/etc/board.d/02_network index f5dbbb09b97cd5..94a982aee90b92 100644 --- a/target/linux/imx/cortexa53/base-files/etc/board.d/02_network +++ b/target/linux/imx/cortexa53/base-files/etc/board.d/02_network @@ -9,7 +9,8 @@ gw,imx8mm-gw72xx-0x|\ gw,imx8mp-gw72xx-2x|\ gw,imx8mm-gw73xx-0x|\ gw,imx8mp-gw73xx-2x|\ -gw,imx8mm-gw7902-0x) +gw,imx8mm-gw7902-0x|\ +gateworks,imx8mp-gw82xx-2x) ucidef_set_interfaces_lan_wan 'eth1' 'eth0' ;; gw,imx8mm-gw7901) From 16070364f9ddaeaf6f420c6a94729380b3ad94d2 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Fri, 1 Nov 2024 09:26:15 +0100 Subject: [PATCH 455/877] ucode: update to latest HEAD b0b5d93 Merge pull request #234 from IdWV/fs 60e7a88 Merge pull request #232 from sebastianertz/lib-digest 1752779 digest: implement compile time option to exclude less common algorithms c7268a1 ci: include libmd in MacOS CI builds fcb6f70 lib: introduce digest library 1323a27 Merge pull request #246 from jow-/fix-upvalue-resolve ed5ce8f types: resolve upvalue values in arrays and objects a6e0641 vm: resolve upvalues before pushing them onto the stack ef1baab ci: drop OpenWrt tests for now 63e18ea fs: eliminate the usage of global variables b1bd7b5 types: add ucv_resource_create() helper 3408edf Merge pull request #244 from nbd168/nl80211 8af77e7 nl80211: add new attributes for multi-radio support 1423ad7 nl80211: cover extended feature and EHT rate info attributes ee1d6d8 Merge pull request #237 from sebastianertz/math 4b18a9b Merge pull request #213 from jow-/improve-vector-macros 1f022c0 math: removed global variable for thread safety e5fe6b1 treewide: refactor vector usage code 20307ee utils: improve vector utilities aa18952 Merge pull request #241 from jow-/socket-local-fanout-decl 79ccd9c socket: provide local definition of `struct fanout_args` 402280d Merge pull request #239 from jow-/safe-insert-during-obj-iteration 07afe96 Merge pull request #240 from jow-/stricter-number-conversion 736d450 types: fix potential use after free on adding keys during iteration 4134e71 vallist: more thoroughly check for trailing garbage after numeric string 9cf53dd Merge pull request #226 from jow-/lexer-improvements 2b2e732 lexer: make api functions public 855854f lexer: emit comment and template statement block tokens 328a50f lexer: improve token position reporting fa22732 Merge pull request #225 from jow-/compiler-fix-keyword-property-labels-after-spread 6e88c62 Merge pull request #224 from jow-/lib-fs-readline-leak 94d1211 compiler: properly treat property names after spread expressions 67cd123 fs: fix potential memory leak on i/o errors in .read() Signed-off-by: John Crispin (cherry picked from commit ba9cdbeea862fada261b0a874e464b63ffa860ac) --- package/utils/ucode/Makefile | 16 +++++--- .../patches/100-nl80211_vif_radio_mask.patch | 40 ------------------- 2 files changed, 11 insertions(+), 45 deletions(-) delete mode 100644 package/utils/ucode/patches/100-nl80211_vif_radio_mask.patch diff --git a/package/utils/ucode/Makefile b/package/utils/ucode/Makefile index 6ee0cf2a1d56b9..a68dea81507242 100644 --- a/package/utils/ucode/Makefile +++ b/package/utils/ucode/Makefile @@ -8,17 +8,18 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ucode -PKG_RELEASE:=3 +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=https://github.com/jow-/ucode.git -PKG_SOURCE_DATE:=2024-07-22 -PKG_SOURCE_VERSION:=b610860dd4a0591ff586dd71a50f556a0ddafced -PKG_MIRROR_HASH:=a5ec51dd989174422d3b19b022ff4f863d57eb559c9f08d54c0d10651f598357 +PKG_SOURCE_DATE:=2024-12-02 +PKG_SOURCE_VERSION:=b0b5d93846a1fb9d1d94992d5fdf508ef345e87d +PKG_MIRROR_HASH:=b43fcb38a85469552d5fb641ade271c346634a52c3628155d3215953ff2c25e1 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC PKG_ABI_VERSION:=20230711 +PKG_BUILD_DEPENDS:=libmd HOST_BUILD_DEPENDS:=libjson-c/host include $(INCLUDE_DIR)/package.mk @@ -51,7 +52,8 @@ CMAKE_HOST_OPTIONS += \ -DUCI_SUPPORT=OFF \ -DULOOP_SUPPORT=OFF \ -DDEBUG_SUPPORT=ON \ - -DLOG_SUPPORT=OFF + -DLOG_SUPPORT=OFF \ + -DDIGEST_SUPPORT=OFF define Package/ucode/default @@ -178,6 +180,10 @@ $(eval $(call UcodeModule, \ uloop, ULOOP_SUPPORT, +libubox, \ The uloop module allows ucode scripts to interact with OpenWrt uloop event loop implementation.)) +$(eval $(call UcodeModule, \ + digest, DIGEST_SUPPORT, , \ + The digest module allows ucode scripts to use libmd digests.)) + $(eval $(call BuildPackage,libucode)) $(eval $(call BuildPackage,ucode)) diff --git a/package/utils/ucode/patches/100-nl80211_vif_radio_mask.patch b/package/utils/ucode/patches/100-nl80211_vif_radio_mask.patch deleted file mode 100644 index 22e05f7c620518..00000000000000 --- a/package/utils/ucode/patches/100-nl80211_vif_radio_mask.patch +++ /dev/null @@ -1,40 +0,0 @@ ---- a/include/linux/nl80211.h -+++ b/include/linux/nl80211.h -@@ -2868,6 +2868,9 @@ enum nl80211_commands { - * nested item, it contains attributes defined in - * &enum nl80211_if_combination_attrs. - * -+ * @NL80211_ATTR_VIF_RADIO_MASK: Bitmask of allowed radios (u32). -+ * A value of 0 means all radios. -+ * - * @NUM_NL80211_ATTR: total number of nl80211_attrs available - * @NL80211_ATTR_MAX: highest attribute number currently defined - * @__NL80211_ATTR_AFTER_LAST: internal use -@@ -3416,6 +3419,8 @@ enum nl80211_attrs { - NL80211_ATTR_WIPHY_RADIOS, - NL80211_ATTR_WIPHY_INTERFACE_COMBINATIONS, - -+ NL80211_ATTR_VIF_RADIO_MASK, -+ - /* add attributes here, update the policy in nl80211.c */ - - __NL80211_ATTR_AFTER_LAST, ---- a/lib/nl80211.c -+++ b/lib/nl80211.c -@@ -829,7 +829,7 @@ static const uc_nl_nested_spec_t nl80211 - - static const uc_nl_nested_spec_t nl80211_msg = { - .headsize = 0, -- .nattrs = 128, -+ .nattrs = 129, - .attrs = { - { NL80211_ATTR_4ADDR, "4addr", DT_U8, 0, NULL }, - { NL80211_ATTR_AIRTIME_WEIGHT, "airtime_weight", DT_U16, 0, NULL }, -@@ -959,6 +959,7 @@ static const uc_nl_nested_spec_t nl80211 - { NL80211_ATTR_MAX_AP_ASSOC_STA, "max_ap_assoc", DT_U16, 0, NULL }, - { NL80211_ATTR_SURVEY_INFO, "survey_info", DT_NESTED, 0, &nl80211_survey_info_nla }, - { NL80211_ATTR_WIPHY_RADIOS, "radios", DT_NESTED, DF_MULTIPLE|DF_AUTOIDX, &nl80211_wiphy_radio_nla }, -+ { NL80211_ATTR_VIF_RADIO_MASK, "vif_radio_mask", DT_U32, 0, NULL }, - } - }; - From fbf04ab99934dd4a7dd85bc528a9f8d9f347b16e Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Fri, 6 Dec 2024 18:21:20 +0100 Subject: [PATCH 456/877] ucode: update to Git HEAD (2024-12-06) 47b54cf5a4b6 types: introduce `ucv_array_sort_r()` and `ucv_object_sort_r()` efeb57806552 types, vm: refactor usage of global variables f9d2faf67de6 vm: reset signals when freeing VM 4e86847d802d lib: utilize `ucv_array_sort_r()` and `ucv_object_sort_r()` c71444ea301f types: ucv_resource_create(): rename `typename` parameter to `type` 373df7299c79 nl80211: properly support split_wiphy_dump for single phys 9bcd25f54708 lexer: Preserve keyword, regexp flags until processing non-comment tokens 0a7ff4715cb8 main: pretty-print `-p` output by default 4c3d5b469156 struct: Add new buffer API for incremental packing/unpacking efc4122124cb struct: do not use global variables for caching types Fixes: https://github.com/jow-/ucode/issues/248 Fixes: https://github.com/jow-/ucode/issues/250 Fixes: https://github.com/efahl/owut/issues/25 Link: https://github.com/openwrt/openwrt/pull/17191 Signed-off-by: Robert Marko (cherry picked from commit af6f1a90bbc824bd22814568c5b6990aa082ce8b) --- 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 a68dea81507242..8cc5d36a74201b 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:=2024-12-02 -PKG_SOURCE_VERSION:=b0b5d93846a1fb9d1d94992d5fdf508ef345e87d -PKG_MIRROR_HASH:=b43fcb38a85469552d5fb641ade271c346634a52c3628155d3215953ff2c25e1 +PKG_SOURCE_DATE:=2024-12-06 +PKG_SOURCE_VERSION:=209f041f3193b55702fadefca51888a62d38cc28 +PKG_MIRROR_HASH:=432a7566e9536b6d0e99f924fcf2e6aaf45b88f87ed58d1e5d1dd1154307a8b7 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC From a9107e74a6eabf3763a81ce6dc04d54497de25eb Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 10 Feb 2025 17:02:20 +0100 Subject: [PATCH 457/877] ucode: update to Git HEAD (2025-02-10) a362263595e6 vm: fix inverted condition in uc_vm_signal_handlers_setup() 1b8660d33fb7 tests: adjust testcases after previous commit 4efad5388184 main: fix crash on printing -p output 0b80ceb29311 vm: close signal pipe in uc_vm_signal_handlers_reset() 175686c97d82 uci: eliminate usage of global variables 0f69da9c3777 struct: fix memory leak in buffer.pull() 47f3a6b69908 debian/control: Build-Depend on cmake 01efa7b92100 debian/control: Fix Standards-Version, add Bugs f50149d67fef debian/source/format: change to native bd001ae4f830 debian/control: libucode Recommends ucode-modules 87776a0bc2b2 docs: Mention `libmd` in macOS docs 826a5c9de7d3 docs: Fix compilation command for macOS 1fa771fc91c0 debian/copyright: fix missing dot to separate paragraphs 60c0e5eae992 debian/control: pkg-config now called pkgconf 244570db4f8e debian/changelog: switch versioning to native package scheme fa2326fc00a0 .gitignore: ignore files generated by debuild faec62367524 debian: ignore lintian warning no-manual-page af881af4b0dc main: add global SCRIPT_NAME variable 5cbd32514187 socket: fix AF_PACKET recvmsg() and sockaddr formatting 6f71a35c4cfa rtnl: properly handle runtime exceptions in listener callback 6dd08716205f ci: bump actions/upload-artifact to v4 001ced17982f socket: properly support SO_ATTACH_FILTER sockopt f0e865fe3ddd ubus: add named parameter support in functions with many params 18a2ffaf51fa fs: ioctl: export constants for direction values 0ba75bea925d fs: ioctl: improve ioctl read to avoid allocating twice 9da8b8aa4ad0 ubus: add defer.await() method 17dbf0bef4b6 ubus: add request get_fd/set_fd methods 4acb960c90f7 ubus: add support for sending file descriptors via ubus.call/defer 22b9523565a5 ubus: add support for receiving file descriptors in call and defer c0d1654a450b ubus: add support for channels b32321beb112 vm: fix crash due to stale frame pointer Fixes: https://github.com/jow-/ucode/issues/254 Fixes: https://github.com/jow-/ucode/issues/255 Signed-off-by: Felix Fietkau (cherry picked from commit 0e672e980650d8f890e620d1c359b78ef3a524d2) --- 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 8cc5d36a74201b..ef253f897edd58 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:=2024-12-06 -PKG_SOURCE_VERSION:=209f041f3193b55702fadefca51888a62d38cc28 -PKG_MIRROR_HASH:=432a7566e9536b6d0e99f924fcf2e6aaf45b88f87ed58d1e5d1dd1154307a8b7 +PKG_SOURCE_DATE:=2025-02-10 +PKG_SOURCE_VERSION:=a8a11aea0c093d669bb3c45f604dab3c291c8d25 +PKG_MIRROR_HASH:=e08c36818a72eb2953b56300207d1fb7a852ada33df36f63a495ad35ca21b88e PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC From 3e7193933bb0234527e2ad195cd49a3dbfed8d65 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 26 Jan 2025 21:20:00 +0100 Subject: [PATCH 458/877] unetd: update to Git HEAD (2025-01-26) 322500403615 service: add default group @ to match all nodes 5f7860306200 ubus: rename unetd_ubus_notify to unetd_ubus_network_notify d13752814651 enroll: add PEX sub-protocol to support enrolling new nodes into a network Signed-off-by: Felix Fietkau (cherry picked from commit c0f06cb6ac002ce90c10839b3d98aed8b41a2da5) --- 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 66d27ff6b92844..1b53596e1fbd65 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:=2024-12-17 -PKG_SOURCE_VERSION:=a0a2d80f3459425182a9f0e665d8ca8eff97c82f -PKG_MIRROR_HASH:=a6f07d91da40152b2af5b5b9d1d67d87a9991943147e47be6921c092ad7b49a3 +PKG_SOURCE_DATE:=2025-01-26 +PKG_SOURCE_VERSION:=d13752814651c70d2afc71383612fafc835b631b +PKG_MIRROR_HASH:=c9de65ae92af2498fcd9d55f9cd2017cb9ac79b03ed5816da21161aa24f226b9 PKG_LICENSE:=GPL-2.0 PKG_MAINTAINER:=Felix Fietkau From b4b2f7fd80908d0ab22e6371796255d2804824a4 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 27 Jan 2025 12:43:13 +0100 Subject: [PATCH 459/877] unetd: update to Git HEAD (2025-01-27) c293afa01c13 network: add support for the local_network option Signed-off-by: Felix Fietkau (cherry picked from commit c34eee5f39827ca38c9d4d0acef46848098867fe) --- package/network/services/unetd/Makefile | 6 ++--- package/network/services/unetd/files/unetd.sh | 27 +++++++++++-------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/package/network/services/unetd/Makefile b/package/network/services/unetd/Makefile index 1b53596e1fbd65..93dc13a7d49173 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:=2025-01-26 -PKG_SOURCE_VERSION:=d13752814651c70d2afc71383612fafc835b631b -PKG_MIRROR_HASH:=c9de65ae92af2498fcd9d55f9cd2017cb9ac79b03ed5816da21161aa24f226b9 +PKG_SOURCE_DATE:=2025-01-27 +PKG_SOURCE_VERSION:=c293afa01c1328ee8a18fc407948d0529353d7eb +PKG_MIRROR_HASH:=f91e26cd4d4304170d99a80551691291d7920b9f4e357b0775cdeb138523ccc8 PKG_LICENSE:=GPL-2.0 PKG_MAINTAINER:=Felix Fietkau diff --git a/package/network/services/unetd/files/unetd.sh b/package/network/services/unetd/files/unetd.sh index 2117eab391a198..726ee765654210 100644 --- a/package/network/services/unetd/files/unetd.sh +++ b/package/network/services/unetd/files/unetd.sh @@ -18,6 +18,7 @@ proto_unet_init_config() { proto_config_add_string domain proto_config_add_boolean dht proto_config_add_array "tunnels:list(string)" + proto_config_add_array "local_network:list(string)" proto_config_add_array "connect:list(string)" proto_config_add_array "peer_data:list(string)" no_device=1 @@ -25,6 +26,17 @@ proto_unet_init_config() { no_proto_task=1 } +add_array() { + local name="$1" + local val="$2" + + json_add_array "$name" + for c in $val; do + json_add_string "" "$c" + done + json_close_array +} + proto_unet_setup() { local config="$1" @@ -33,6 +45,7 @@ proto_unet_setup() { json_get_values tunnels tunnels json_get_values connect connect json_get_values peer_data peer_data + json_get_values local_network local_network device="${device:-$config}" [ -n "$auth_key" ] && type="${type:-dynamic}" @@ -58,17 +71,9 @@ proto_unet_setup() { done json_close_object - json_add_array auth_connect - for c in $connect; do - json_add_string "" "$c" - done - json_close_array - - json_add_array peer_data - for c in $peer_data; do - json_add_string "" "$c" - done - json_close_array + add_array local_network "$local_network" + add_array auth_connect "$connect" + add_array peer_data "$peer_data" ip link del dev "$device" >/dev/null 2>&1 ip link add dev "$device" type wireguard || { From 058cf0a67d6e9395f14447cc0ef781debb3267ac Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 29 Jan 2025 21:51:45 +0100 Subject: [PATCH 460/877] unetd: update to Git HEAD (2025-01-29) aff192cda38b ubus: hide local private key in network_get 24e4aafaaa2f ubus: add detailed peer statistics 082b5482b97f pex: improve keepalive handling Signed-off-by: Felix Fietkau (cherry picked from commit 087c5abdf59c37ed3476f6dd8a7775a940f8e38d) --- 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 93dc13a7d49173..6923c688738a25 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:=2025-01-27 -PKG_SOURCE_VERSION:=c293afa01c1328ee8a18fc407948d0529353d7eb -PKG_MIRROR_HASH:=f91e26cd4d4304170d99a80551691291d7920b9f4e357b0775cdeb138523ccc8 +PKG_SOURCE_DATE:=2025-01-29 +PKG_SOURCE_VERSION:=082b5482b97f20dc4745bc3d645e33b584cc28e4 +PKG_MIRROR_HASH:=090e7dab3b9a3358706dcee4f1889b7a1f0bdf535f2d6a0580f4160e23ccf9cb PKG_LICENSE:=GPL-2.0 PKG_MAINTAINER:=Felix Fietkau From 10ba7154dba8ff7d62399cd9147e088ec681a419 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Wed, 11 Dec 2024 15:41:21 +0100 Subject: [PATCH 461/877] umdns: update to latest HEAD 93458ac dns: fix response to TYPE_PTR query 68af311 fix unicast response port and timeout a2b4979 service: announce all services in single dns answer 4537734 display announced services in ubus call umdns browse 0b50c29 display more srv attributes in output of ubus browse function Signed-off-by: John Crispin (cherry picked from commit d162fd5ed44af7a33c9aefd72479c1c77f3234e4) --- 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 606dc7274fe3ea..ede371231a39a8 100644 --- a/package/network/services/umdns/Makefile +++ b/package/network/services/umdns/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_URL=$(PROJECT_GIT)/project/mdnsd.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2024-09-17 -PKG_SOURCE_VERSION:=fbaca4b6f530d4b2f361ee15c266aa19a708242b -PKG_MIRROR_HASH:=e3fc47a019ea54722b8d7dfc8158307a9fb4a9d18945a1a6794616e3b80d5d3b +PKG_SOURCE_DATE:=2024-12-11 +PKG_SOURCE_VERSION:=93458ac90911b84c7279070cd350405d203b702d +PKG_MIRROR_HASH:=6e6fe777d19da744116579be612590e1b41a9ef2c8ff2afeaea942d6b3da49ef PKG_MAINTAINER:=John Crispin PKG_LICENSE:=LGPL-2.1 From 5899fe220be956da98f2bc30e5c52889a25ffa72 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 10 Feb 2025 21:40:59 +0100 Subject: [PATCH 462/877] umdns: update to Git HEAD (2025-02-10) c0a2aa12c397 ubus: allow query without specifying interface c5ca22a71b2e cache: improve service discovery reliability Signed-off-by: Felix Fietkau (cherry picked from commit dd5c598de09636e7b46b7ef9a79e05b1df90cc81) --- 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 ede371231a39a8..9a2763d5b2dba3 100644 --- a/package/network/services/umdns/Makefile +++ b/package/network/services/umdns/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_URL=$(PROJECT_GIT)/project/mdnsd.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2024-12-11 -PKG_SOURCE_VERSION:=93458ac90911b84c7279070cd350405d203b702d -PKG_MIRROR_HASH:=6e6fe777d19da744116579be612590e1b41a9ef2c8ff2afeaea942d6b3da49ef +PKG_SOURCE_DATE:=2025-02-10 +PKG_SOURCE_VERSION:=c5ca22a71b2ecb83a2a28b46391dac443be315c2 +PKG_MIRROR_HASH:=2d595fa1e58f028a7ff6813b110ee6bcbc8e6ccce81b2792200508c6db9c276a PKG_MAINTAINER:=John Crispin PKG_LICENSE:=LGPL-2.1 From f47125f6644b58063b7b653a58c2338ed9d59c99 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 10 Feb 2025 22:09:26 +0100 Subject: [PATCH 463/877] build: fix building llvm tarball Add missing select NEED_BPF_TOOLCHAIN in order to ensure that the toolchain actually gets built. Fixes: https://github.com/openwrt/openwrt/issues/17926 Signed-off-by: Felix Fietkau (cherry picked from commit 04570f5ee2dfe6609c22d2d21678b14cd3314309) --- target/sdk/Config.in | 1 + 1 file changed, 1 insertion(+) diff --git a/target/sdk/Config.in b/target/sdk/Config.in index 1984e242e721b5..9fee5abdc36c51 100644 --- a/target/sdk/Config.in +++ b/target/sdk/Config.in @@ -10,6 +10,7 @@ config SDK config SDK_LLVM_BPF bool "Build the LLVM-BPF toolchain tarball" depends on BPF_TOOLCHAIN_BUILD_LLVM + select NEED_BPF_TOOLCHAIN default BUILDBOT help This is a tarball of the precompiled LLVM toolchain suitable From 7955545469688cbb228b8c5f3bdc519d12c2e8d5 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 11 Feb 2025 18:28:40 +0100 Subject: [PATCH 464/877] wifi-scripts: fix mac address allocation with macaddr_base set The 00 address_mask needs to be inverted, otherwise the mac address allocation will modify the last byte instead of the first one. Signed-off-by: Felix Fietkau (cherry picked from commit 1ee44825ad0d00527c8850446affc820d74c6e8b) --- .../config/wifi-scripts/files/usr/share/hostap/common.uc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/package/network/config/wifi-scripts/files/usr/share/hostap/common.uc b/package/network/config/wifi-scripts/files/usr/share/hostap/common.uc index fd28b664725dc2..31b526b6aee78b 100644 --- a/package/network/config/wifi-scripts/files/usr/share/hostap/common.uc +++ b/package/network/config/wifi-scripts/files/usr/share/hostap/common.uc @@ -213,9 +213,12 @@ const phy_proto = { if (!base_mask) return null; + if (base_mask == "00:00:00:00:00:00") + base_mask = "ff:ff:ff:ff:ff:ff"; + if (data.macaddr_base) base_addr = data.macaddr_base; - else if (base_mask == "00:00:00:00:00:00" && + else if (base_mask == "ff:ff:ff:ff:ff:ff" && (radio_idx > 0 || idx >= num_global)) { let addrs = split(phy_sysfs_file(phy, "addresses"), "\n"); @@ -227,8 +230,6 @@ const phy_proto = { } else { if (idx < length(addrs)) return addrs[idx]; - - base_mask = "ff:ff:ff:ff:ff:ff"; } } From cb4d2b3fb2a85bcd2aa49c4d11732e5b55e458c5 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 12 Feb 2025 11:54:59 +0100 Subject: [PATCH 465/877] hostapd: fix sta psk index for dynamic psk auth Depending on the config / circumstances, the get_psk call can be called multiple times from differnt places, which can lead to wrong sta->psk_idx values. The correct call is the one that is also interested in the vlan_id, so use the vlan_id pointer as indication of when to set sta->psk_idx. Also fix off-by-one error for secondary PSKs Fixes: b2a2c286170d ("hostapd: add support for authenticating with multiple PSKs via ubus helper") Signed-off-by: Felix Fietkau (cherry picked from commit 8118b2dace06de839e1e23f018059995f4af5e11) --- .../hostapd/patches/601-ucode_support.patch | 15 +++++++++++---- .../services/hostapd/patches/730-ft_iface.patch | 2 +- .../patches/803-hostapd-fix-80211be-build.patch | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/package/network/services/hostapd/patches/601-ucode_support.patch b/package/network/services/hostapd/patches/601-ucode_support.patch index 5a88687cf222ef..13fd2b1b518a7b 100644 --- a/package/network/services/hostapd/patches/601-ucode_support.patch +++ b/package/network/services/hostapd/patches/601-ucode_support.patch @@ -816,7 +816,7 @@ as adding/removing interfaces. if (vlan_id) *vlan_id = 0; if (psk_len) -@@ -446,13 +447,16 @@ static const u8 * hostapd_wpa_auth_get_p +@@ -446,13 +447,18 @@ static const u8 * hostapd_wpa_auth_get_p * returned psk which should not be returned again. * logic list (all hostapd_get_psk; all sta->psk) */ @@ -830,16 +830,23 @@ as adding/removing interfaces. *vlan_id = 0; psk = sta->psk->psk; - for (pos = sta->psk; pos; pos = pos->next) { ++ if (vlan_id) ++ sta->psk_idx = psk_idx; + for (pos = sta->psk; pos; pos = pos->next, psk_idx++) { if (pos->is_passphrase) { if (pbkdf2_sha1(pos->passphrase, hapd->conf->ssid.ssid, -@@ -469,6 +473,8 @@ static const u8 * hostapd_wpa_auth_get_p +@@ -466,9 +472,13 @@ static const u8 * hostapd_wpa_auth_get_p + } + if (pos->psk == prev_psk) { + psk = pos->next ? pos->next->psk : NULL; ++ if (vlan_id) ++ sta->psk_idx = psk_idx + 1; break; } } -+ if (psk) -+ sta->psk_idx = psk_idx; ++ if (vlan_id && !psk) ++ sta->psk_idx = 0; } return psk; } diff --git a/package/network/services/hostapd/patches/730-ft_iface.patch b/package/network/services/hostapd/patches/730-ft_iface.patch index ac7d3abd78af7c..f021f1f99ba4b2 100644 --- a/package/network/services/hostapd/patches/730-ft_iface.patch +++ b/package/network/services/hostapd/patches/730-ft_iface.patch @@ -29,7 +29,7 @@ a VLAN interface on top of the bridge, instead of using the bridge directly int bridge_hairpin; /* hairpin_mode on bridge members */ --- a/src/ap/wpa_auth_glue.c +++ b/src/ap/wpa_auth_glue.c -@@ -1821,8 +1821,12 @@ int hostapd_setup_wpa(struct hostapd_dat +@@ -1825,8 +1825,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/803-hostapd-fix-80211be-build.patch b/package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch index f197b71bd7b934..cbd6298d9d36c5 100644 --- a/package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch +++ b/package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch @@ -25,7 +25,7 @@ + --- a/src/ap/sta_info.h +++ b/src/ap/sta_info.h -@@ -409,23 +409,8 @@ int ap_sta_re_add(struct hostapd_data *h +@@ -408,23 +408,8 @@ int ap_sta_re_add(struct hostapd_data *h void ap_free_sta_pasn(struct hostapd_data *hapd, struct sta_info *sta); From 5b7820534389346fa15e9a22cb638a20e99350b6 Mon Sep 17 00:00:00 2001 From: Pietro Ameruoso Date: Wed, 5 Feb 2025 11:40:48 +0100 Subject: [PATCH 466/877] mediatek: filogic: fix mt7986a-zyxel-ex5601-t0-stock.dts model name and eth1 wan definition Fix the model name to reflect the stock partitioning and the wan eth1 detection in the 02_network script. Fixes: https://github.com/openwrt/openwrt/issues/14432 Fixes: b5df398a36f1 ("mediatek: add Zyxel EX5601-T0 with uboot custom partition") Signed-off-by: Pietro Ameruoso Link: https://github.com/openwrt/openwrt/pull/17859 Signed-off-by: Hauke Mehrtens (cherry picked from commit d023ee7439f6d5c9bffa6f6e10b3b90f5782e84d) --- target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-stock.dts | 4 ++-- target/linux/mediatek/filogic/base-files/etc/board.d/01_leds | 2 +- .../base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac | 2 +- 3 files changed, 4 insertions(+), 4 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 4dbbd1367794e0..b5553a8359832d 100644 --- a/target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-stock.dts +++ b/target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-stock.dts @@ -11,8 +11,8 @@ #include / { - model = "Zyxel EX5601-T0"; - compatible = "zyxel,ex5601-t0", "mediatek,mt7986a-rfb-snand"; + model = "Zyxel EX5601-T0 (stock layout)"; + compatible = "zyxel,ex5601-t0-stock", "mediatek,mt7986a"; memory@40000000 { device_type = "memory"; 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 5048e9bb8f8b4d..c2d9971f6f181b 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 @@ -126,7 +126,7 @@ xiaomi,redmi-router-ax6000-ubootmod) zbtlink,zbt-z8103ax) ucidef_set_led_netdev "wan" "wan" "green:wan" "eth1" "link tx rx" ;; -zyxel_ex5601-t0-stock|\ +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" 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 6ee525e8d0c4cd..69e39f76fc774c 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 @@ -155,7 +155,7 @@ case "$board" in routerich,ax3000-ubootmod|\ zbtlink,zbt-z8102ax|\ zbtlink,zbt-z8103ax|\ - zyxel,ex5601-t0|\ + zyxel,ex5601-t0-stock|\ zyxel,ex5601-t0-ubootmod) addr=$(mtd_get_mac_binary "Factory" 0x4) [ "$PHYNBR" = "1" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress From d89527ce14152790a45993bf558fbb7ed29884c8 Mon Sep 17 00:00:00 2001 From: Klaas Demter Date: Sun, 9 Feb 2025 11:10:42 +0100 Subject: [PATCH 467/877] uboot-envtools: add support for ZyXEL GS-1900-24EP It seems the that this was forgotten during initial adding of the device in 0688cf5aebe1dc9a2e7f3820861783c2a7a75d44 Thanks to https://forum.openwrt.org/t/zyxel-gs1900-10hp-revision-b1-support-openwrt-firmware/131841/32 for putting me on the right track for this problem Error that is being fixed - running fw_printenv results in: "Warning: Bad CRC, using default environment" and not showing boardmodel Workaround, manually changing /etc/fw_env.config to "/dev/mtd1 0x0 0x400 0x10000" Signed-off-by: Klaas Demter Link: https://github.com/openwrt/openwrt/pull/17920 Signed-off-by: Hauke Mehrtens (cherry picked from commit 71a966c480432febcc5dd120e5b01662fa8ec328) --- package/boot/uboot-envtools/files/realtek | 1 + 1 file changed, 1 insertion(+) diff --git a/package/boot/uboot-envtools/files/realtek b/package/boot/uboot-envtools/files/realtek index cd2446432d7dac..055730eb27b3d2 100644 --- a/package/boot/uboot-envtools/files/realtek +++ b/package/boot/uboot-envtools/files/realtek @@ -28,6 +28,7 @@ zyxel,gs1900-10hp|\ zyxel,gs1900-16|\ zyxel,gs1900-24-v1|\ zyxel,gs1900-24e|\ +zyxel,gs1900-24ep|\ zyxel,gs1900-24hp-v1|\ zyxel,gs1900-24hp-v2) idx="$(find_mtd_index u-boot-env)" From 424d758d1f1dc8feca008d4ce40cae3f233ea927 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Wed, 12 Feb 2025 02:25:53 +0100 Subject: [PATCH 468/877] ath79: mikrotik: fix reference clock of Routerboard 911G When support for Routerboard 911G was introduced, Routerboad 912UAG device tree was used as a base, and the common part. This led to use of 40MHz as the reference clock frequency for both [1], while RB911G uses 25MHz crystal on the board, causing heavy system clock drift. Split the definition, and set the reference clock frequency for RB911G back to 25MHz. [1] a716ac556497 ("ath79: fix reference clock for RouterBoard 912UAG") Fixes: bcc44b1212b2 ("ath79: support for MikroTik RouterBOARD 911G-(2,5)HPnD") Signed-off-by: Lech Perczak Link: https://github.com/openwrt/openwrt/pull/17944 Signed-off-by: Hauke Mehrtens (cherry picked from commit 40fc6bd5cc679875e38ea1769527affdb5be12ba) --- .../ath79/dts/ar9342_mikrotik_routerboard-911g-xhpnd.dts | 4 ++++ target/linux/ath79/dts/ar9342_mikrotik_routerboard-911g.dtsi | 4 ---- .../ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts | 4 ++++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/target/linux/ath79/dts/ar9342_mikrotik_routerboard-911g-xhpnd.dts b/target/linux/ath79/dts/ar9342_mikrotik_routerboard-911g-xhpnd.dts index 5fa44b4412ca78..655c590f8c9bda 100644 --- a/target/linux/ath79/dts/ar9342_mikrotik_routerboard-911g-xhpnd.dts +++ b/target/linux/ath79/dts/ar9342_mikrotik_routerboard-911g-xhpnd.dts @@ -9,3 +9,7 @@ compatible = "mikrotik,routerboard-911g-xhpnd", "qca,ar9342"; model = "MikroTik RouterBOARD 911G-(2,5)HPnD"; }; + +&ref { + clock-frequency = <25000000>; +}; diff --git a/target/linux/ath79/dts/ar9342_mikrotik_routerboard-911g.dtsi b/target/linux/ath79/dts/ar9342_mikrotik_routerboard-911g.dtsi index 0c98a6634ee4b7..3a8c60456f8f8e 100644 --- a/target/linux/ath79/dts/ar9342_mikrotik_routerboard-911g.dtsi +++ b/target/linux/ath79/dts/ar9342_mikrotik_routerboard-911g.dtsi @@ -146,10 +146,6 @@ }; }; -&ref { - clock-frequency = <40000000>; -}; - &spi { status = "okay"; diff --git a/target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts b/target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts index 81d7284b3da1e0..4cf62349f5bbd6 100644 --- a/target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts +++ b/target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts @@ -10,6 +10,10 @@ model = "MikroTik RouterBOARD 912UAG-(2,5)HPnD"; }; +&ref { + clock-frequency = <40000000>; +}; + &pcie { status = "okay"; }; From 2efd34dfa6d4439bfc3a6ad84386fc2df21c4dd5 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Fri, 7 Feb 2025 21:00:22 +0800 Subject: [PATCH 469/877] mac80211: rt2x00: fix eeprom load from PCI eFuse When eeprom name is not defined, the file load function should return an error code so that it can fallthrough to read eeprom form NIC inside eFuse. Fixes: https://github.com/openwrt/openwrt/issues/17854 Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17892 Signed-off-by: Hauke Mehrtens (cherry picked from commit 693108a31835d43d5e92f116b4dbd9fbed06b7ed) --- ...1-wifi-rt2x00-Add-support-for-loading-EEPROM-from-user.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kernel/mac80211/patches/rt2x00/602-01-wifi-rt2x00-Add-support-for-loading-EEPROM-from-user.patch b/package/kernel/mac80211/patches/rt2x00/602-01-wifi-rt2x00-Add-support-for-loading-EEPROM-from-user.patch index b6b1e0da96382d..f3c8ddd4f6533d 100644 --- a/package/kernel/mac80211/patches/rt2x00/602-01-wifi-rt2x00-Add-support-for-loading-EEPROM-from-user.patch +++ b/package/kernel/mac80211/patches/rt2x00/602-01-wifi-rt2x00-Add-support-for-loading-EEPROM-from-user.patch @@ -151,7 +151,7 @@ Signed-off-by: Christian Marangi + } + + if (!ee_name) -+ return 0; ++ return -ENOENT; + + rt2x00_info(rt2x00dev, "Loading EEPROM data from '%s'.\n", ee_name); + From 9b05ca988c3a778c42d12dd34d9f7aa56c953cb6 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sat, 8 Feb 2025 09:21:15 +0800 Subject: [PATCH 470/877] ramips: mt7620: add missing PA/LNA pinctrl for Linksys E1700 This device has high-power external PA and LNA[1]. So we must configure PA/LNA pins to make the wireless work properly. [1] https://fccid.io/Q87-E1700/Internal-Photos/Internal-Photos-pdf-2135639.pdf Fixes: https://github.com/openwrt/openwrt/issues/7959 Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17892 Signed-off-by: Hauke Mehrtens (cherry picked from commit 3aa9b708364fd4a46c8466750f51069e22f3dde7) --- target/linux/ramips/dts/mt7620a_linksys_e1700.dts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/linux/ramips/dts/mt7620a_linksys_e1700.dts b/target/linux/ramips/dts/mt7620a_linksys_e1700.dts index caa6780d600a4d..4dca56cd7eee8f 100644 --- a/target/linux/ramips/dts/mt7620a_linksys_e1700.dts +++ b/target/linux/ramips/dts/mt7620a_linksys_e1700.dts @@ -167,6 +167,10 @@ }; &wmac { + pinctrl-names = "default", "pa_gpio"; + pinctrl-0 = <&pa_pins>; + pinctrl-1 = <&pa_gpio_pins>; + nvmem-cells = <&eeprom_factory_0>; nvmem-cell-names = "eeprom"; }; From bccab05ac71e9d4ebec321dba997336e7ddff249 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sat, 8 Feb 2025 15:36:24 +0800 Subject: [PATCH 471/877] base-files: fix offset conversion on caldata_patch_data() `$(( ))` will convert uninitialized variable to "0". If we want to use "-n" to check the string length, it's necessary to make sure the converted variable is not empty. Fixes: 652a6677d5fa ("base-files: Add new functions for ath11k caldata") Fixes: https://github.com/openwrt/openwrt/issues/17818 Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17892 Signed-off-by: Hauke Mehrtens (cherry picked from commit 094b6f593fb4943005e13e2f8581e66bb7c2c8cf) --- package/base-files/files/lib/functions/caldata.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/base-files/files/lib/functions/caldata.sh b/package/base-files/files/lib/functions/caldata.sh index 09289728c0f5e3..f0fc907aeff1a2 100644 --- a/package/base-files/files/lib/functions/caldata.sh +++ b/package/base-files/files/lib/functions/caldata.sh @@ -125,8 +125,8 @@ caldata_valid() { caldata_patch_data() { local data=$1 local data_count=$((${#1} / 2)) - local data_offset=$(($2)) - local chksum_offset=$(($3)) + [ -n "$2" ] && local data_offset=$(($2)) + [ -n "$3" ] && local chksum_offset=$(($3)) local target=$4 local fw_data local fw_chksum From cc5bc05a0e05b91266b498060dd2fb24b61de4fc Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sat, 8 Feb 2025 15:39:13 +0800 Subject: [PATCH 472/877] Revert "Revert "ramips: mt7620: fix patching mac address in caldata"" This reverts commit f628467dfd6b32ead172d33a2593f04901395343. The initial fix was correct. However, a recently introduced bug in base-files can cause some unexpected byte overwriting in eeprom. Since it has been fixed, let's accept this patch again. Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17892 Signed-off-by: Hauke Mehrtens (cherry picked from commit 43bc5e6e122b06eb9bfd22cf0bdf3212b84073f3) --- .../mt7620/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ramips/mt7620/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom b/target/linux/ramips/mt7620/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom index 2d1ac2e872d518..b68efcbba182aa 100644 --- a/target/linux/ramips/mt7620/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom +++ b/target/linux/ramips/mt7620/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom @@ -34,12 +34,12 @@ case "$FIRMWARE" in wan_mac=$(jboot_config_read -m -i $(find_mtd_part "config") -o 0xE000) wifi_mac=$(macaddr_add "$wan_mac" 1) jboot_eeprom_extract "config" 0xE000 - caldata_patch_mac $wifi_mac 0x4 + caldata_patch_data "${wifi_mac//:/}" 0x4 ;; dovado,tiny-ac) wifi_mac=$(mtd_get_mac_ascii u-boot-env INIC_MAC_ADDR) caldata_extract "factory" 0x0 0x200 - caldata_patch_mac $wifi_mac 0x4 + caldata_patch_data "${wifi_mac//:/}" 0x4 ;; *) caldata_die "Please define mtd-eeprom in $board DTS file!" From b7b6ae742440c41882d897e9798753dd3c122b5e Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 14 Feb 2025 11:21:29 +0100 Subject: [PATCH 473/877] mt76: update to Git HEAD (2025-02-14) 2919ae2c0f94 wifi: mt76: mt7996: revise TXS size 1aaacd335577 wifi: mt76: mt7996: fix SER reset trigger on WED reset e9396ad2378f wifi: mt76: mt7996: remove unnecessary key->cipher check for BIP frames e5fef138524e mt76: only mark tx-status-failed frames as ACKed on mt76x0/2 Signed-off-by: Felix Fietkau (cherry picked from commit 3dfd1f69a769bd857061b4856270dfc78e30c610) --- 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 ef2c619885c9c2..ca7fe6c159aa2a 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:=2025-01-22 -PKG_SOURCE_VERSION:=a22d59e4ad50c89326342a0736cd2c1ba32e8a0b -PKG_MIRROR_HASH:=e8bbbada2171ea31a6788e3e46e81c409a9fe038eefe4b41f541da848a1b1bcd +PKG_SOURCE_DATE:=2025-02-14 +PKG_SOURCE_VERSION:=e5fef138524e63314cb96ff8314048d175294e95 +PKG_MIRROR_HASH:=4d6ea8669b3034c97f5b341a5473facf4fe21262a2fde71257b57c4d1c86be5e PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 From 708a81fb8b079e1d88eac8c5fd3829332b976489 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Owoc?= Date: Sun, 4 Aug 2024 01:06:39 +0200 Subject: [PATCH 474/877] qualcommax: ipq807x: remove unnecessary bootargs-append for MX4200 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The default value for the "root" parameter is "/dev/ubiblock0_0" and there is no need to append it to bootargs. Signed-off-by: Paweł Owoc Link: https://github.com/openwrt/openwrt/pull/16070 (cherry picked from commit fee2d93b276f3c44dad83849f9959638ce495de7) Signed-off-by: Rafal Boni Link: https://github.com/openwrt/openwrt/pull/17889 Signed-off-by: Robert Marko --- .../files/arch/arm64/boot/dts/qcom/ipq8174-mx4200.dtsi | 1 - 1 file changed, 1 deletion(-) diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200.dtsi index 13ce8d16016860..3698db73188a4e 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200.dtsi +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200.dtsi @@ -29,7 +29,6 @@ chosen { stdout-path = "serial0:115200n8"; - bootargs-append = " root=/dev/ubiblock0_0"; }; keys { From deccf0e37b5ffecc7e54a1e6237aa13e325092d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Owoc?= Date: Fri, 26 Jul 2024 22:21:02 +0200 Subject: [PATCH 475/877] qualcommax: ipq807x: create generic Linksys MX4x00 dts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Create a generic Linksys MX4x00 dts file and extract the specific configuration for MX4200v1/v2 to a new file. Signed-off-by: Paweł Owoc Link: https://github.com/openwrt/openwrt/pull/16070 (cherry picked from commit ff85f883ea94f562af618fb26ba8b5e85e572d64) Signed-off-by: Rafal Boni Link: https://github.com/openwrt/openwrt/pull/17889 Signed-off-by: Robert Marko --- .../arm64/boot/dts/qcom/ipq8174-mx4200.dtsi | 198 +---------------- .../arm64/boot/dts/qcom/ipq8174-mx4x00.dtsi | 204 ++++++++++++++++++ 2 files changed, 209 insertions(+), 193 deletions(-) create mode 100644 target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4x00.dtsi diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200.dtsi index 3698db73188a4e..5867cd42227b8b 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200.dtsi +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200.dtsi @@ -1,79 +1,16 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT /* Copyright (c) 2023, Mohammad Sayful Islam */ -#include "ipq8074.dtsi" -#include "ipq8074-ac-cpu.dtsi" -#include "ipq8074-ess.dtsi" -#include -#include -#include +#include "ipq8174-mx4x00.dtsi" / { - aliases { - serial0 = &blsp1_uart5; - serial1 = &blsp1_uart3; - /* - * Aliases as required by u-boot - * to patch MAC addresses - */ - ethernet1 = &dp2; - ethernet2 = &dp3; ethernet3 = &dp4; ethernet4 = &dp5; - led-boot = &led_system_blue; - led-running = &led_system_blue; - led-failsafe = &led_system_red; - led-upgrade = &led_system_green; - }; - - chosen { - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys"; - pinctrl-0 = <&button_pins>; - pinctrl-names = "default"; - - reset-button { - label = "reset"; - gpios = <&tlmm 52 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - wps-button { - label = "wps"; - gpios = <&tlmm 67 GPIO_ACTIVE_LOW>; - linux,code = ; - }; }; }; &tlmm { - button_pins: button-state { - pins = "gpio52", "gpio67"; - function = "gpio"; - drive-strength = <8>; - bias-pull-up; - }; - - 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; - }; - }; - iot_pins: iot-state { recovery-pins { pins = "gpio22"; @@ -98,26 +35,6 @@ /* Silicon Labs EFR32MG21 IoT */ }; -&blsp1_uart5 { - status = "okay"; -}; - -&prng { - status = "okay"; -}; - -&cryptobam { - status = "okay"; -}; - -&crypto { - status = "okay"; -}; - -&qpic_bam { - status = "okay"; -}; - &qpic_nand { status = "okay"; @@ -288,21 +205,25 @@ label = "alt_rootfs"; reg = <0xac80000 0x9000000>; }; + partition@13c80000 { label = "sysdiag"; reg = <0x13c80000 0x200000>; read-only; }; + partition@13e80000 { label = "0:ethphyfw"; reg = <0x13e80000 0x80000>; read-only; }; + partition@13f00000 { label = "syscfg"; reg = <0x13f00000 0xb800000>; read-only; }; + partition@1f700000 { label = "0:wififw"; reg = <0x1f700000 0x900000>; @@ -312,102 +233,6 @@ }; }; -&blsp1_i2c2 { - status = "okay"; - - led-controller@62 { - compatible = "nxp,pca9633"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x62>; - nxp,hw-blink; - - led_system_red: led@0 { - reg = <0>; - color = ; - function = LED_FUNCTION_STATUS; - }; - - led_system_green: led@1 { - reg = <1>; - color = ; - function = LED_FUNCTION_STATUS; - }; - - led_system_blue: led@2 { - reg = <2>; - color = ; - function = LED_FUNCTION_STATUS; - }; - }; -}; - -&mdio { - status = "okay"; - - pinctrl-0 = <&mdio_pins>; - pinctrl-names = "default"; - reset-gpios = <&tlmm 37 GPIO_ACTIVE_LOW>; - - ethernet-phy-package@0 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "qcom,qca8075-package"; - reg = <0>; - - qca8075_1: ethernet-phy@1 { - compatible = "ethernet-phy-ieee802.3-c22"; - reg = <1>; - }; - - qca8075_2: ethernet-phy@2 { - compatible = "ethernet-phy-ieee802.3-c22"; - reg = <2>; - }; - - qca8075_3: ethernet-phy@3 { - compatible = "ethernet-phy-ieee802.3-c22"; - reg = <3>; - }; - - qca8075_4: ethernet-phy@4 { - compatible = "ethernet-phy-ieee802.3-c22"; - reg = <4>; - }; - }; -}; - -&switch { - status = "okay"; - - switch_lan_bmp = <(ESS_PORT3 | ESS_PORT4 | ESS_PORT5)>; /* lan port bitmap */ - switch_wan_bmp = ; /* wan port bitmap */ - switch_mac_mode = ; /* mac mode for uniphy instance0*/ - - qcom,port_phyinfo { - port@2 { - port_id = <2>; - phy_address = <1>; - }; - port@3 { - port_id = <3>; - phy_address = <2>; - }; - port@4 { - port_id = <4>; - phy_address = <3>; - }; - port@5 { - port_id = <5>; - phy_address = <4>; - }; - }; -}; - -&edma { - status = "okay"; -}; - &dp2 { status = "okay"; phy-handle = <&qca8075_1>; @@ -431,16 +256,3 @@ phy-handle = <&qca8075_4>; label = "lan3"; }; - -&ssphy_0 { - status = "okay"; -}; - -&qusb_phy_0 { - status = "okay"; -}; - -&usb_0 { - status = "okay"; -}; - diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4x00.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4x00.dtsi new file mode 100644 index 00000000000000..84e68dae356bac --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4x00.dtsi @@ -0,0 +1,204 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/* Copyright (c) 2023, Mohammad Sayful Islam */ + +#include "ipq8074.dtsi" +#include "ipq8074-ac-cpu.dtsi" +#include "ipq8074-ess.dtsi" +#include +#include +#include + +/ { + aliases { + serial0 = &blsp1_uart5; + serial1 = &blsp1_uart3; + /* + * Aliases as required by u-boot + * to patch MAC addresses + */ + ethernet1 = &dp2; + ethernet2 = &dp3; + led-boot = &led_system_blue; + led-running = &led_system_blue; + led-failsafe = &led_system_red; + led-upgrade = &led_system_green; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + keys { + compatible = "gpio-keys"; + pinctrl-0 = <&button_pins>; + pinctrl-names = "default"; + + reset-button { + label = "reset"; + gpios = <&tlmm 52 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps-button { + label = "wps"; + gpios = <&tlmm 67 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&tlmm { + button_pins: button-state { + pins = "gpio52", "gpio67"; + function = "gpio"; + drive-strength = <8>; + bias-pull-up; + }; + + 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; + }; + }; +}; + +&blsp1_uart5 { + status = "okay"; +}; + +&prng { + status = "okay"; +}; + +&cryptobam { + status = "okay"; +}; + +&crypto { + status = "okay"; +}; + +&qpic_bam { + status = "okay"; +}; + +&blsp1_i2c2 { + status = "okay"; + + led-controller@62 { + compatible = "nxp,pca9633"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x62>; + nxp,hw-blink; + + led_system_red: led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_STATUS; + }; + + led_system_green: led@1 { + reg = <1>; + color = ; + function = LED_FUNCTION_STATUS; + }; + + led_system_blue: led@2 { + reg = <2>; + color = ; + function = LED_FUNCTION_STATUS; + }; + }; +}; + +&mdio { + status = "okay"; + + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + reset-gpios = <&tlmm 37 GPIO_ACTIVE_LOW>; + + ethernet-phy-package@0 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "qcom,qca8075-package"; + reg = <0>; + + qca8075_1: ethernet-phy@1 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <1>; + }; + + qca8075_2: ethernet-phy@2 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <2>; + }; + + qca8075_3: ethernet-phy@3 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <3>; + }; + + qca8075_4: ethernet-phy@4 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <4>; + }; + }; +}; + +&switch { + status = "okay"; + + switch_lan_bmp = <(ESS_PORT3 | ESS_PORT4 | ESS_PORT5)>; /* lan port bitmap */ + switch_wan_bmp = ; /* wan port bitmap */ + switch_mac_mode = ; /* mac mode for uniphy instance0*/ + + qcom,port_phyinfo { + port@2 { + port_id = <2>; + phy_address = <1>; + }; + + port@3 { + port_id = <3>; + phy_address = <2>; + }; + + port@4 { + port_id = <4>; + phy_address = <3>; + }; + + port@5 { + port_id = <5>; + phy_address = <4>; + }; + }; +}; + +&edma { + status = "okay"; +}; + +&ssphy_0 { + status = "okay"; +}; + +&qusb_phy_0 { + status = "okay"; +}; + +&usb_0 { + status = "okay"; +}; From 1252e16f7746a1deceb84a40b6208fb651972ed4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Owoc?= Date: Sat, 27 Jul 2024 23:25:14 +0200 Subject: [PATCH 476/877] qualcommax: ipq807x: define configuration for Linksys MX4x00 devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Define shared configuration for Linksys MX4x00 devices. Signed-off-by: Paweł Owoc Link: https://github.com/openwrt/openwrt/pull/16070 (cherry picked from commit 73fc1e0aa2d9956561915e342d098a6881ec85a3) Signed-off-by: Rafal Boni Link: https://github.com/openwrt/openwrt/pull/17889 Signed-off-by: Robert Marko --- target/linux/qualcommax/image/ipq807x.mk | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/target/linux/qualcommax/image/ipq807x.mk b/target/linux/qualcommax/image/ipq807x.mk index 8ca370f57e686a..c42393eb794ab6 100644 --- a/target/linux/qualcommax/image/ipq807x.mk +++ b/target/linux/qualcommax/image/ipq807x.mk @@ -170,12 +170,17 @@ define Device/linksys_mx DEVICE_PACKAGES := kmod-leds-pca963x endef -define Device/linksys_mx4200v1 +define Device/linksys_mx4x00 $(call Device/linksys_mx) + SOC := ipq8174 + DEVICE_PACKAGES += ipq-wifi-linksys_mx4200 +endef + +define Device/linksys_mx4200v1 + $(call Device/linksys_mx4x00) DEVICE_MODEL := MX4200 DEVICE_VARIANT := v1 - SOC := ipq8174 - DEVICE_PACKAGES += ipq-wifi-linksys_mx4200 kmod-bluetooth + DEVICE_PACKAGES += kmod-bluetooth endef TARGET_DEVICES += linksys_mx4200v1 From b02cdced3f2016f8e13794d39242f3e2b45827ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Owoc?= Date: Thu, 1 Aug 2024 08:53:14 +0200 Subject: [PATCH 477/877] qualcommax: ipq807x: fix mac setup for Linksys MX4200v2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently for Linksys MX4200v2 all u-boot ethXaddr variables share the same MAC address and there is no need to check them one by one. Signed-off-by: Paweł Owoc Link: https://github.com/openwrt/openwrt/pull/16070 (cherry picked from commit 80c867815636cbf32e85b431c5d06c531e4a371e) Signed-off-by: Rafal Boni Link: https://github.com/openwrt/openwrt/pull/17889 Signed-off-by: Robert Marko --- .../qualcommax/ipq807x/base-files/etc/board.d/02_network | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network index 437581d001127a..373807048dca6d 100644 --- a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network +++ b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network @@ -82,10 +82,8 @@ ipq807x_setup_macs() case "$board" in linksys,mx4200v2) label_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr) - for i in $(seq 3 5); do - [ "$(mtd_get_mac_ascii u_env eth${i}addr)" != "$label_mac" ] && lan_mac=$label_mac - done - [ "$(mtd_get_mac_ascii u_env eth2addr)" != "$label_mac" ] && wan_mac=$label_mac + [ "$(mtd_get_mac_ascii u_env eth1addr)" != "$label_mac" ] && wan_mac=$label_mac + [ "$(mtd_get_mac_ascii u_env eth2addr)" != "$label_mac" ] && lan_mac=$label_mac ;; linksys,mx8500) label_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr) From ab9f1011ac3f78b5b8ee8ac959aa270c8d4b86f0 Mon Sep 17 00:00:00 2001 From: Qiyuan Zhang Date: Fri, 2 Aug 2024 10:57:51 -0400 Subject: [PATCH 478/877] mtd: fix resetbc on nand w/ min I/O size > 2048 Fix a bug in linksys_bootcount.c that resetbc won't work on nand with min I/O size> 2048. Check the boot-log entry's intergrity with checksum. Signed-off-by: Qiyuan Zhang Link: https://github.com/openwrt/openwrt/pull/16070 (cherry picked from commit 62da99e6d506f3517f50c1efd61e1911df507ae3) Signed-off-by: Rafal Boni Link: https://github.com/openwrt/openwrt/pull/17889 Signed-off-by: Robert Marko --- package/system/mtd/src/linksys_bootcount.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/package/system/mtd/src/linksys_bootcount.c b/package/system/mtd/src/linksys_bootcount.c index bd06728696ce3f..d22486203e90c1 100644 --- a/package/system/mtd/src/linksys_bootcount.c +++ b/package/system/mtd/src/linksys_bootcount.c @@ -69,12 +69,10 @@ struct bootcounter { uint32_t checksum; }; -static char page[2048]; - int mtd_resetbc(const char *mtd) { struct mtd_info_user mtd_info; - struct bootcounter *curr = (struct bootcounter *)page; + struct bootcounter *curr = NULL; unsigned int i; unsigned int bc_offset_increment; int last_count = 0; @@ -108,24 +106,23 @@ int mtd_resetbc(const char *mtd) } num_bc = mtd_info.size / bc_offset_increment; + curr = malloc(bc_offset_increment); for (i = 0; i < num_bc; i++) { - pread(fd, curr, sizeof(*curr), i * bc_offset_increment); + pread(fd, curr, sizeof(struct bootcounter), i * bc_offset_increment); /* Existing code assumes erase is to 0xff; left as-is (2019) */ + if (curr->magic == 0xffffffff) + break; - if (curr->magic != BOOTCOUNT_MAGIC && - curr->magic != 0xffffffff) { - DLOG_ERR("Unexpected magic %08x at offset %08x; aborting.", - curr->magic, i * bc_offset_increment); + if (curr->magic != BOOTCOUNT_MAGIC || curr->checksum != curr->magic + curr->count) { + DLOG_ERR("Unexpected boot-count log at offset %08x: magic %08x boot count %08x checksum %08x; aborting.", + i * bc_offset_increment, curr->magic, curr->count, curr->checksum); retval = -2; goto out; } - if (curr->magic == 0xffffffff) - break; - last_count = curr->count; } @@ -182,6 +179,7 @@ int mtd_resetbc(const char *mtd) } out: + if (curr != NULL) free(curr); close(fd); return retval; } From 45ce95a9b31c5c3a86d99a79508c8a176b304831 Mon Sep 17 00:00:00 2001 From: Qiyuan Zhang Date: Thu, 1 Aug 2024 18:24:55 -0400 Subject: [PATCH 479/877] qualcommax: add kernel cmdline replacement hack Add kernel command line replacement hack to qualcommax. Now we can find and replace arguments in the kernel command line by setting bootargs-find-1, bootargs-replace-1, bootargs-exact-match-1 and bootargs-find-2, bootargs-replace-2, bootargs-exact-match-2 under the chosen node in the device tree. This hack replaces the first occurence of bootargs-find-X with bootargs-replace-X. When bootargs-exact-match-X is set to "y", then the replacement happens only if the kernel command line is identical to bootargs-find-X. Signed-off-by: Qiyuan Zhang Link: https://github.com/openwrt/openwrt/pull/16070 (cherry picked from commit 337f6f76ca5361f45e76facd52396936b9fc25c0) Signed-off-by: Rafal Boni Link: https://github.com/openwrt/openwrt/pull/17889 Signed-off-by: Robert Marko --- .../0911-arm64-cmdline-replacement.patch | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 target/linux/qualcommax/patches-6.6/0911-arm64-cmdline-replacement.patch diff --git a/target/linux/qualcommax/patches-6.6/0911-arm64-cmdline-replacement.patch b/target/linux/qualcommax/patches-6.6/0911-arm64-cmdline-replacement.patch new file mode 100644 index 00000000000000..afc71bf995582b --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/0911-arm64-cmdline-replacement.patch @@ -0,0 +1,105 @@ +Subject: qualcommax: add kernel cmdline replacement hack + +Add kernel command line replacement hack to qualcommax. Now we can +find and replace arguments in the kernel command line by setting +bootargs-find-1, bootargs-replace-1, bootargs-exact-match-1 +and bootargs-find-2, bootargs-replace-2, bootargs-exact-match-2 +under the chosen node in the device tree. + +This hack replaces the first occurence of bootargs-find-X with +bootargs-replace-X. If bootargs-exact-match-X is set to "y", +then the replacement happens only if the kernel command line is +identical to bootargs-find-X. + +Signed-off-by: Qiyuan Zhang +--- + drivers/of/fdt.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 71 insertions(+) + +--- a/drivers/of/fdt.c ++++ b/drivers/of/fdt.c +@@ -1158,6 +1158,14 @@ int __init early_init_dt_scan_chosen(cha + const void *rng_seed; + const void *fdt = initial_boot_params; + ++ int i, cmd_len, f_len, r_len, offset, step; ++ char *s_ptr, *l_end, *r_end, *cur_ptr, *end_ptr; ++ const char *exact_match; ++ const int bootargs_replace_num = 2; ++ const char *bootargs_replace_props[2][3] = ++ { {"bootargs-find-1", "bootargs-replace-1", "bootargs-exact-match-1"}, ++ {"bootargs-find-2", "bootargs-replace-2", "bootargs-exact-match-2"} }; ++ + node = fdt_path_offset(fdt, "/chosen"); + if (node < 0) + node = fdt_path_offset(fdt, "/chosen@0"); +@@ -1186,6 +1194,69 @@ int __init early_init_dt_scan_chosen(cha + p = of_get_flat_dt_prop(node, "bootargs", &l); + if (p != NULL && l > 0) + strscpy(cmdline, p, min(l, COMMAND_LINE_SIZE)); ++ ++ for(i = 0; i < bootargs_replace_num; i++) { ++ p = of_get_flat_dt_prop(node, bootargs_replace_props[i][0], &f_len); ++ ++ if (p == NULL || f_len == 0 ) ++ continue; ++ ++ exact_match = of_get_flat_dt_prop(node, bootargs_replace_props[i][2], &l); ++ ++ if (exact_match != NULL && l > 0 && exact_match[0] == 'y') { ++ if(strncmp(cmdline, p, r_len) == 0) ++ s_ptr = cmdline; ++ else ++ s_ptr = NULL; ++ } else { ++ s_ptr = strstr(cmdline, p); ++ } ++ ++ if(!s_ptr) ++ continue; ++ ++ p = of_get_flat_dt_prop(node, bootargs_replace_props[i][1], &r_len); ++ ++ if (p == NULL || r_len == 0) ++ continue; ++ ++ pr_info("Input kernel commad line: %s\n", cmdline); ++ ++ cmd_len = strlen(cmdline); ++ ++ if (cmd_len - f_len + r_len < COMMAND_LINE_SIZE) { ++ ++ pr_info("Replace kernel command line with %s\n", bootargs_replace_props[i][1]); ++ ++ offset = r_len - f_len; ++ ++ if (offset != 0) { ++ l_end = s_ptr + f_len - 1; ++ r_end = cmdline + cmd_len; ++ ++ if (offset > 0) { ++ step = -1; ++ cur_ptr = r_end; ++ end_ptr = l_end + step; ++ } else { ++ step = 1; ++ cur_ptr = l_end; ++ end_ptr = r_end + step; ++ } ++ ++ for (; cur_ptr != end_ptr; cur_ptr += step) ++ *(cur_ptr + offset) = *cur_ptr; ++ } ++ ++ strncpy(s_ptr, p, r_len - 1); ++ ++ pr_info("Kernel command line after replacement: %s\n", cmdline); ++ } else { ++ pr_err("Replace kernel command line with %s failed\n", bootargs_replace_props[i][1]); ++ } ++ ++ } ++ + p = of_get_flat_dt_prop(node, "bootargs-append", &l); + if (p != NULL && l > 0) + strlcat(cmdline, p, min_t(int, strlen(cmdline) + (int)l, COMMAND_LINE_SIZE)); From 082608fd2bc29dc2d9a7d4d7dc3463d72e2989f6 Mon Sep 17 00:00:00 2001 From: Qiyuan Zhang Date: Mon, 5 Aug 2024 06:47:21 -0400 Subject: [PATCH 480/877] mtd: check the return value of malloc and pread Check the return value of malloc and pread in case they fail. Signed-off-by: Qiyuan Zhang Link: https://github.com/openwrt/openwrt/pull/16070 (cherry picked from commit 3f014543cd4bd099dc089cbb9b9b2d7b0db8a021) Signed-off-by: Rafal Boni Link: https://github.com/openwrt/openwrt/pull/17889 Signed-off-by: Robert Marko --- package/system/mtd/src/linksys_bootcount.c | 24 ++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/package/system/mtd/src/linksys_bootcount.c b/package/system/mtd/src/linksys_bootcount.c index d22486203e90c1..3ec0b61718c3d8 100644 --- a/package/system/mtd/src/linksys_bootcount.c +++ b/package/system/mtd/src/linksys_bootcount.c @@ -106,17 +106,31 @@ int mtd_resetbc(const char *mtd) } num_bc = mtd_info.size / bc_offset_increment; - curr = malloc(bc_offset_increment); + curr = malloc(bc_offset_increment); + + if(curr == NULL) { + DLOG_ERR("Failed to allocate %u bytes from memory.", bc_offset_increment); + + retval = -6; + goto out; + } for (i = 0; i < num_bc; i++) { - pread(fd, curr, sizeof(struct bootcounter), i * bc_offset_increment); + ret = pread(fd, curr, sizeof(struct bootcounter), i * bc_offset_increment); + + if(ret != sizeof(struct bootcounter)) { + DLOG_ERR("Failed to read boot-count log at offset 0x%08x.", i * bc_offset_increment); + + retval = -5; + goto out; + } /* Existing code assumes erase is to 0xff; left as-is (2019) */ if (curr->magic == 0xffffffff) break; if (curr->magic != BOOTCOUNT_MAGIC || curr->checksum != curr->magic + curr->count) { - DLOG_ERR("Unexpected boot-count log at offset %08x: magic %08x boot count %08x checksum %08x; aborting.", + DLOG_ERR("Unexpected boot-count log at offset 0x%08x: magic 0x%08x boot count 0x%08x checksum 0x%08x; aborting.", i * bc_offset_increment, curr->magic, curr->count, curr->checksum); retval = -2; @@ -179,7 +193,9 @@ int mtd_resetbc(const char *mtd) } out: - if (curr != NULL) free(curr); + if (curr != NULL) + free(curr); + close(fd); return retval; } From 4c9cae19069ef7f03086ff0f180129f720c067b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Owoc?= Date: Fri, 26 Jul 2024 19:00:57 +0200 Subject: [PATCH 481/877] qualcommax: ipq807x: add support for Linksys MX4300 (LN1301) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hardware specification: ======== SoC: Qualcomm IPQ8174 Flash: 1GB (Micron MT29F8G08ABBCAH4 or AMD/Spansion S34MS08G2) RAM: 2GB (2x Kingston B5116ECMDXGJD or ESMT M15T2G16128A DDR3L) Ethernet: 4x 10/100/1000Mbps (Qualcomm QCA8075) WiFi1: 5GHz ax 2x2 (Qualcomm QCN5054 + Skyworks SKY85755-11) - channels 36-64 (low band) WiFi2: 2.4GHz ax 2x2 (Qualcomm QCN5024 + Skyworks SKY85340-11) WiFi3: 5GHz ax 4x4 (Qualcomm QCN5054 + Skyworks SKY85755-11) - channels 100-177 (high band) LED: 1x RGB status (NXP PCA9633) USB: 1x USB 3.0 Button: WPS, Reset Flash instructions: ======== 1. Manually upgrade firmware using openwrt-qualcommax-ipq807x-linksys_mx4300-squashfs-factory.bin image. More details can be found here: https://support.linksys.com/kb/article/6564-en/ After first boot check actual partition: - fw_printenv -n boot_part and install firmware on second partition using command in case of 2: - mtd -r -e kernel -n write openwrt-qualcommax-ipq807x-linksys_mx4300-squashfs-factory.bin kernel and in case of 1: - mtd -r -e alt_kernel -n write openwrt-qualcommax-ipq807x-linksys_mx4300-squashfs-factory.bin alt_kernel 2. Installation using serial connection from OEM firmware (default login: root, password: admin): - fw_printenv -n boot_part In case of 2: - flash_erase /dev/mtd21 0 0 - nandwrite -p /dev/mtd21 openwrt-qualcommax-ipq807x-linksys_mx4300-squashfs-factory.bin or in case of 1: - flash_erase /dev/mtd23 0 0 - nandwrite -p /dev/mtd23 openwrt-qualcommax-ipq807x-linksys_mx4300-squashfs-factory.bin After first boot install firmware on second partition: - mtd -r -e kernel -n write openwrt-qualcommax-ipq807x-linksys_mx4300-squashfs-factory.bin kernel or: - mtd -r -e alt_kernel -n write openwrt-qualcommax-ipq807x-linksys_mx4300-squashfs-factory.bin alt_kernel 3. Installation from initramfs image using USB drive: Put the initramfs image on the USB drive: - dd bs=1M if=openwrt-qualcommax-ipq807x-linksys_mx4300-initramfs-uImage.itb of=/dev/sdX Stop u-boot and run: - usb start && usbboot $loadaddr 0 && bootm $loadaddr Write firmware to the flash from initramfs: - mtd -e kernel -n write openwrt-qualcommax-ipq807x-linksys_mx4300-squashfs-factory.bin kernel and: - mtd -r -e alt_kernel -n write openwrt-qualcommax-ipq807x-linksys_mx4300-squashfs-factory.bin alt_kernel 4. Back to the OEM firmware: - mtd -e kernel -n write FW_MX4300_1.0.4.215382_prod.img kernel and: - mtd -r -e alt_kernel -n write FW_MX4300_1.0.4.215382_prod.img alt_kernel 5. USB recovery: Put the initramfs image on the USB: - dd bs=1M if=openwrt-qualcommax-ipq807x-linksys_mx4300-initramfs-uImage.itb of=/dev/sdX Set u-boot env: - fw_setenv bootusb 'usb start && usbboot $loadaddr 0 && bootm $loadaddr' - fw_setenv bootcmd 'run bootusb; if test $auto_recovery = no; then bootipq; elif test $boot_part = 1; then run bootpart1; else run bootpart2; fi' Co-authored-by: Qiyuan Zhang Signed-off-by: Paweł Owoc Link: https://github.com/openwrt/openwrt/pull/16070 (cherry picked from commit 4d310b176be9eea162159f2501e650ebbd6605e9) Signed-off-by: Rafal Boni Link: https://github.com/openwrt/openwrt/pull/17889 Signed-off-by: Robert Marko --- .../uboot-envtools/files/qualcommax_ipq807x | 5 + .../arm64/boot/dts/qcom/ipq8174-mx4300.dts | 273 ++++++++++++++++++ target/linux/qualcommax/image/ipq807x.mk | 11 + .../ipq807x/base-files/etc/board.d/02_network | 4 +- .../etc/hotplug.d/firmware/11-ath11k-caldata | 8 + .../ipq807x/base-files/etc/init.d/bootcount | 1 + .../base-files/lib/upgrade/platform.sh | 1 + 7 files changed, 302 insertions(+), 1 deletion(-) create mode 100644 target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4300.dts diff --git a/package/boot/uboot-envtools/files/qualcommax_ipq807x b/package/boot/uboot-envtools/files/qualcommax_ipq807x index f5fb07a4db0bf0..2d76045c66e568 100644 --- a/package/boot/uboot-envtools/files/qualcommax_ipq807x +++ b/package/boot/uboot-envtools/files/qualcommax_ipq807x @@ -37,6 +37,11 @@ linksys,mx8500) [ -n "$idx" ] && \ ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" "2" ;; +linksys,mx4300) + idx="$(find_mtd_index u_env)" + [ -n "$idx" ] && \ + ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x40000" "1" + ;; netgear,sxr80|\ netgear,sxs80|\ tplink,eap660hd-v1) diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4300.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4300.dts new file mode 100644 index 00000000000000..1477019ab941d0 --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4300.dts @@ -0,0 +1,273 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; + +#include "ipq8174-mx4x00.dtsi" + +/ { + model = "Linksys MX4300"; + compatible = "linksys,mx4300", "qcom,ipq8074"; + + chosen { + /* + In the kernel command line, replace the first occurence of bootargs-find-X with bootargs-replace-X. + If bootargs-exact-match-X is set to "y", then replacement happens only if the kernel command line + is identical to bootargs-find-X. + */ + bootargs-find-1 = "ubi.mtd=22,2048"; + bootargs-replace-1 = "ubi.mtd=22,4096"; + + bootargs-find-2 = "ubi.mtd=24,2048"; + bootargs-replace-2 = "ubi.mtd=24,4096"; + }; +}; + +&qpic_nand { + status = "okay"; + + /* + * Bootloader will find the NAND DT node by the compatible and + * then "fixup" it by adding the partitions from the SMEM table + * using the legacy bindings thus making it impossible for us + * to change the partition table or utilize NVMEM for calibration. + * So add a dummy partitions node that bootloader will populate + * and set it as disabled so the kernel ignores it instead of + * printing warnings due to the broken way bootloader adds the + * partitions. + */ + partitions { + status = "disabled"; + }; + + nand@0 { + reg = <0>; + /* + * Some devices use Micron NAND with with 8 bit ECC + * other AMD/Spansion NAND with 4 bit ECC + *nand-ecc-strength = <4>; + *nand-ecc-step-size = <512>; + */ + nand-bus-width = <8>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "0:sbl1"; + reg = <0x0 0x100000>; + read-only; + }; + + partition@100000 { + label = "0:mibib"; + reg = <0x100000 0x100000>; + read-only; + }; + + partition@200000 { + label = "0:bootconfig"; + reg = <0x200000 0x80000>; + read-only; + }; + + partition@280000 { + label = "0:bootconfig1"; + reg = <0x280000 0x80000>; + read-only; + }; + + partition@300000 { + label = "0:qsee"; + reg = <0x300000 0x300000>; + read-only; + }; + + partition@600000 { + label = "0:qsee_1"; + reg = <0x600000 0x300000>; + read-only; + }; + + partition@900000 { + label = "0:devcfg"; + reg = <0x900000 0x80000>; + read-only; + }; + + partition@980000 { + label = "0:devcfg_1"; + reg = <0x980000 0x80000>; + read-only; + }; + + partition@a00000 { + label = "0:apdp"; + reg = <0xa00000 0x80000>; + read-only; + }; + + partition@a80000 { + label = "0:apdp_1"; + reg = <0xa80000 0x80000>; + read-only; + }; + + partition@b00000 { + label = "0:rpm"; + reg = <0xb00000 0x80000>; + read-only; + }; + + partition@b80000 { + label = "0:rpm_1"; + reg = <0xb80000 0x80000>; + read-only; + }; + + partition@c00000 { + label = "0:cdt"; + reg = <0xc00000 0x80000>; + read-only; + }; + + partition@c80000 { + label = "0:cdt_1"; + reg = <0xc80000 0x80000>; + read-only; + }; + + partition@d00000 { + label = "0:appsblenv"; + reg = <0xd00000 0x80000>; + }; + + partition@d80000 { + label = "0:appsbl"; + reg = <0xd80000 0x100000>; + read-only; + }; + + partition@e80000 { + label = "0:appsbl_1"; + reg = <0xe80000 0x100000>; + read-only; + }; + + partition@f80000 { + label = "0:art"; + reg = <0xf80000 0x80000>; + read-only; + }; + + partition@1000000 { + label = "u_env"; + reg = <0x1000000 0x100000>; + }; + + partition@1100000 { + label = "s_env"; + reg = <0x1100000 0x100000>; + }; + + partition@1200000 { + label = "devinfo"; + reg = <0x1200000 0x40000>; + read-only; + }; + + partition@1240000 { + label = "kernel"; + reg = <0x1240000 0xaf40000>; + }; + + partition@1a40000 { + label = "rootfs"; + reg = <0x1a40000 0xa740000>; + }; + + partition@c180000 { + label = "alt_kernel"; + reg = <0xc180000 0xaf40000>; + }; + + partition@c980000 { + label = "alt_rootfs"; + reg = <0xc980000 0xa740000>; + }; + + partition@170c0000 { + label = "sysdiag"; + reg = <0x170c0000 0x400000>; + read-only; + }; + + partition@174c0000 { + label = "0:ethphyfw"; + reg = <0x174c0000 0x80000>; + read-only; + }; + + partition@17540000 { + label = "syscfg"; + reg = <0x17540000 0x79c0000>; + read-only; + }; + + partition@1ef00000 { + label = "secured_store"; + reg = <0x1ef00000 0x400000>; + read-only; + }; + + partition@1f300000 { + label = "0:wififw"; + reg = <0x1f300000 0x1900000>; + read-only; + }; + + partition@20c00000 { + label = "app2_data"; + reg = <0x20c00000 0x16180000>; + read-only; + }; + + partition@36d80000 { + label = "app2"; + reg = <0x36d80000 0x9280000>; + read-only; + }; + }; + }; +}; + +&dp2 { + status = "okay"; + phy-handle = <&qca8075_1>; + label = "wan"; +}; + +&dp3 { + status = "okay"; + phy-handle = <&qca8075_2>; + label = "lan3"; +}; + +&dp4 { + status = "okay"; + phy-handle = <&qca8075_3>; + label = "lan2"; +}; + +&dp5 { + status = "okay"; + phy-handle = <&qca8075_4>; + label = "lan1"; +}; + +&wifi { + status = "okay"; + + qcom,ath11k-calibration-variant = "Linksys-MX4200v1"; +}; diff --git a/target/linux/qualcommax/image/ipq807x.mk b/target/linux/qualcommax/image/ipq807x.mk index c42393eb794ab6..77d89b69380e3c 100644 --- a/target/linux/qualcommax/image/ipq807x.mk +++ b/target/linux/qualcommax/image/ipq807x.mk @@ -190,6 +190,17 @@ define Device/linksys_mx4200v2 endef TARGET_DEVICES += linksys_mx4200v2 +define Device/linksys_mx4300 + $(call Device/linksys_mx4x00) + DEVICE_MODEL := MX4300 + BLOCKSIZE := 256k + PAGESIZE := 4096 + KERNEL_SIZE := 8192k + IMAGE_SIZE := 171264k + NAND_SIZE := 1024m +endef +TARGET_DEVICES += linksys_mx4300 + define Device/linksys_mx5300 $(call Device/linksys_mx) DEVICE_MODEL := MX5300 diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network index 373807048dca6d..edb1ae9557c005 100644 --- a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network +++ b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network @@ -29,6 +29,7 @@ ipq807x_setup_interfaces() compex,wpq873|\ linksys,mx4200v1|\ linksys,mx4200v2|\ + linksys,mx4300|\ prpl,haze|\ redmi,ax6|\ spectrum,sax1v1k|\ @@ -80,7 +81,8 @@ ipq807x_setup_macs() local label_mac="" case "$board" in - linksys,mx4200v2) + linksys,mx4200v2|\ + linksys,mx4300) label_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr) [ "$(mtd_get_mac_ascii u_env eth1addr)" != "$label_mac" ] && wan_mac=$label_mac [ "$(mtd_get_mac_ascii u_env eth2addr)" != "$label_mac" ] && lan_mac=$label_mac diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata b/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata index 2e741f044841c6..34c0a476d351c4 100644 --- a/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata +++ b/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata @@ -44,6 +44,14 @@ case "$FIRMWARE" in ath11k_remove_regdomain ath11k_set_macflag ;; + linksys,mx4300) + caldata_extract "0:art" 0x1000 0x20000 + label_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr) + ath11k_patch_mac $(macaddr_add $label_mac 2) 0 + ath11k_patch_mac $(macaddr_add $label_mac 1) 1 + ath11k_patch_mac $(macaddr_add $label_mac 3) 2 + ath11k_remove_regdomain + ;; netgear,rax120v2) caldata_extract "0:art" 0x1000 0x20000 ath11k_patch_mac $(mtd_get_mac_binary boarddata1 0xc) 0 diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/init.d/bootcount b/target/linux/qualcommax/ipq807x/base-files/etc/init.d/bootcount index 26da7cd614efec..176a5a144a0799 100755 --- a/target/linux/qualcommax/ipq807x/base-files/etc/init.d/bootcount +++ b/target/linux/qualcommax/ipq807x/base-files/etc/init.d/bootcount @@ -12,6 +12,7 @@ boot() { ;; linksys,mx4200v1|\ linksys,mx4200v2|\ + linksys,mx4300|\ linksys,mx5300|\ linksys,mx8500) mtd resetbc s_env || true diff --git a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh b/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh index 70657629fcc53c..0691c92184a394 100644 --- a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh +++ b/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh @@ -168,6 +168,7 @@ platform_do_upgrade() { ;; linksys,mx4200v1|\ linksys,mx4200v2|\ + linksys,mx4300|\ linksys,mx5300|\ linksys,mx8500) boot_part="$(fw_printenv -n boot_part)" From 36bde27e796475d12dc5de205ed328ab0768a6b6 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Thu, 6 Feb 2025 05:17:54 +0000 Subject: [PATCH 482/877] mediatek: add work-around for ASUS bootloader MTD behavior ASUS makes use of U-Boot's fdt_fixup_mtdparts() function which applies the partitions defined in U-Boot's mtdparts and mtdids environment variables to the devicetree passed over to Linux. The undesired side-effect is that in this way also all additional properties and child nodes get wiped, preventing NVMEM cells to be defined for MTD partitions or UBI volumes. To work-around this issue, add an additional compatible string 'u-boot-dont-touch-spi-nand' which can be used instead of 'spi-nand' in case the replacement of the MTD partitions by U-Boot should be skipped alltogether. In practise this is mostly relevant for SPI-NAND which anyway comes only with two partitions nowadays: 'Bootloader' and 'UBI_DEV'. Hence this work-around is applicable for SPI-NAND only. Similar work-arounds for other MTD devices can be created as well should they actually be needed. Signed-off-by: Daniel Golle (cherry picked from commit c48afca32ca875c4176b4c41be94335e61556783) --- ...960-asus-hack-u-boot-ignore-mtdparts.patch | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 target/linux/mediatek/patches-6.6/960-asus-hack-u-boot-ignore-mtdparts.patch diff --git a/target/linux/mediatek/patches-6.6/960-asus-hack-u-boot-ignore-mtdparts.patch b/target/linux/mediatek/patches-6.6/960-asus-hack-u-boot-ignore-mtdparts.patch new file mode 100644 index 00000000000000..0fe2b95e8a7dd9 --- /dev/null +++ b/target/linux/mediatek/patches-6.6/960-asus-hack-u-boot-ignore-mtdparts.patch @@ -0,0 +1,47 @@ +From 30a04cf5b6ffa1249df72ccd98cef05f37890f89 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Thu, 6 Feb 2025 05:07:20 +0000 +Subject: [PATCH] mtd: spinand: add work-around to prevent bootloader wiping + mtdparts + +ASUS makes use of U-Boot's fdt_fixup_mtdparts() function which applies +the partitions defined in U-Boot's mtdparts and mtdids environment +variables to the devicetree passed over to Linux. + +The undesired side-effect is that in this way also all additional +properties and child nodes get wiped, preventing NVMEM cells to be +defined for MTD partitions or UBI volumes. + +To work-around this issue, add an additional compatible string +'u-boot-dont-touch-spi-nand' which can be used instead of 'spi-nand' in +case the replacement of the MTD partitions by U-Boot should be skipped +alltogether. + +In practise this is mostly relevant for SPI-NAND which anyway comes only +with two partitions nowadays: 'Bootloader' and 'UBI_DEV'. Hence this +work-around is applicable for SPI-NAND only. Similar work-arounds for +other MTD devices can be created as well should they actually be needed. + +Signed-off-by: Daniel Golle +--- + drivers/mtd/nand/spi/core.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/mtd/nand/spi/core.c ++++ b/drivers/mtd/nand/spi/core.c +@@ -1441,6 +1441,7 @@ static int spinand_remove(struct spi_mem + + static const struct spi_device_id spinand_ids[] = { + { .name = "spi-nand" }, ++ { .name = "u-boot-dont-touch-spi-nand" }, + { /* sentinel */ }, + }; + MODULE_DEVICE_TABLE(spi, spinand_ids); +@@ -1448,6 +1449,7 @@ MODULE_DEVICE_TABLE(spi, spinand_ids); + #ifdef CONFIG_OF + static const struct of_device_id spinand_of_ids[] = { + { .compatible = "spi-nand" }, ++ { .compatible = "u-boot-dont-touch-spi-nand" }, + { /* sentinel */ }, + }; + MODULE_DEVICE_TABLE(of, spinand_of_ids); From bbe51e72f138062f1d3ae027307fe2959a82a076 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 10 Feb 2025 23:18:46 +0000 Subject: [PATCH 483/877] mediatek: apply bootloader work-around for affected ASUS devices Apply "u-boot-dont-touch-spi-nand" to ASUS RT-AX59U, ASUS TUF-AX4200 as well as ASUS TUF-AX6000 routers to prevent U-Boot from wiping MTD child nodes from DT. Signed-off-by: Daniel Golle (cherry picked from commit 4387de94454913aa79bb88971eabcf1bfca78141) --- target/linux/mediatek/dts/mt7986a-asus-rt-ax59u.dts | 4 ++-- target/linux/mediatek/dts/mt7986a-asus-tuf-ax4200.dts | 4 ++-- target/linux/mediatek/dts/mt7986a-asus-tuf-ax6000.dts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/target/linux/mediatek/dts/mt7986a-asus-rt-ax59u.dts b/target/linux/mediatek/dts/mt7986a-asus-rt-ax59u.dts index 0034ad8284b1bd..7e0c05618f5e25 100644 --- a/target/linux/mediatek/dts/mt7986a-asus-rt-ax59u.dts +++ b/target/linux/mediatek/dts/mt7986a-asus-rt-ax59u.dts @@ -210,7 +210,7 @@ status = "okay"; spi_nand: flash@0 { - compatible = "spi-nand"; + compatible = "u-boot-dont-touch-spi-nand"; reg = <0>; #address-cells = <1>; #size-cells = <1>; @@ -224,7 +224,7 @@ * Device Tree and by that also deletes all additional properties * needed for UBI and NVMEM-on-UBI. * Prevent this from happening by tricking the loader to delete and - * replace a bait node instead. + * replace a bait node instead (works with older bootloaders). */ partitions: dummy { compatible = "u-boot-dummy-partitions"; diff --git a/target/linux/mediatek/dts/mt7986a-asus-tuf-ax4200.dts b/target/linux/mediatek/dts/mt7986a-asus-tuf-ax4200.dts index e40602fa215e1a..4ed65a8ee708a7 100644 --- a/target/linux/mediatek/dts/mt7986a-asus-tuf-ax4200.dts +++ b/target/linux/mediatek/dts/mt7986a-asus-tuf-ax4200.dts @@ -209,7 +209,7 @@ status = "okay"; spi_nand_flash: flash@0 { - compatible = "spi-nand"; + compatible = "u-boot-dont-touch-spi-nand"; #address-cells = <1>; #size-cells = <1>; reg = <0>; @@ -223,7 +223,7 @@ * Device Tree and by that also deletes all additional properties * needed for UBI and NVMEM-on-UBI. * Prevent this from happening by tricking the loader to delete and - * replace a bait node instead. + * replace a bait node instead (works with older bootloaders). */ partitions: dummy { compatible = "u-boot-dummy-partitions"; diff --git a/target/linux/mediatek/dts/mt7986a-asus-tuf-ax6000.dts b/target/linux/mediatek/dts/mt7986a-asus-tuf-ax6000.dts index 957d8deebb192a..9a0f7594c92c24 100644 --- a/target/linux/mediatek/dts/mt7986a-asus-tuf-ax6000.dts +++ b/target/linux/mediatek/dts/mt7986a-asus-tuf-ax6000.dts @@ -231,7 +231,7 @@ status = "okay"; spi_nand_flash: flash@0 { - compatible = "spi-nand"; + compatible = "u-boot-dont-touch-spi-nand"; reg = <0>; #address-cells = <1>; #size-cells = <1>; @@ -245,7 +245,7 @@ * Device Tree and by that also deletes all additional properties * needed for UBI and NVMEM-on-UBI. * Prevent this from happening by tricking the loader to delete and - * replace a bait node instead. + * replace a bait node instead (works with older bootloaders). */ partitions: dummy { compatible = "u-boot-dummy-partitions"; From 315facfce6dc13d6ec1993db1e16532cadcfcaaa Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 17 Feb 2025 12:29:27 +0100 Subject: [PATCH 484/877] kernel: receive all bridged multicast packets if IFF_ALLMULTI is set Fixes issues with odhcpd, especially in relay mode Signed-off-by: Felix Fietkau (cherry picked from commit 38c21271d2b5749f135d662c2b28ef2bbdf607b8) --- ...ly-receive-all-multicast-packets-if-.patch | 24 +++++++++++++++++++ ...d-knob-for-filtering-rx-tx-BPDU-pack.patch | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 target/linux/generic/pending-6.6/642-net-bridge-locally-receive-all-multicast-packets-if-.patch diff --git a/target/linux/generic/pending-6.6/642-net-bridge-locally-receive-all-multicast-packets-if-.patch b/target/linux/generic/pending-6.6/642-net-bridge-locally-receive-all-multicast-packets-if-.patch new file mode 100644 index 00000000000000..98edb315b1aeb4 --- /dev/null +++ b/target/linux/generic/pending-6.6/642-net-bridge-locally-receive-all-multicast-packets-if-.patch @@ -0,0 +1,24 @@ +From: Felix Fietkau +Date: Mon, 17 Feb 2025 12:21:08 +0100 +Subject: [PATCH] net: bridge: locally receive all multicast packets if + IFF_ALLMULTI is set + +If multicast snooping is enabled, multicast packets may not always end up on +the local bridge interface, if the host is not a member of the multicast +group. Similar to how IFF_PROMISC allows all packets to be received locally, +let IFF_ALLMULTI allow all multicast packets to be received. + +Signed-off-by: Felix Fietkau +--- + +--- a/net/bridge/br_input.c ++++ b/net/bridge/br_input.c +@@ -152,6 +152,8 @@ int br_handle_frame_finish(struct net *n + pkt_type = BR_PKT_MULTICAST; + if (br_multicast_rcv(&brmctx, &pmctx, vlan, skb, vid)) + goto drop; ++ if (br->dev->flags & IFF_ALLMULTI) ++ local_rcv = true; + } + } + diff --git a/target/linux/generic/pending-6.6/710-bridge-add-knob-for-filtering-rx-tx-BPDU-pack.patch b/target/linux/generic/pending-6.6/710-bridge-add-knob-for-filtering-rx-tx-BPDU-pack.patch index 96e1a19db4c7c1..31e29c447e8ade 100644 --- a/target/linux/generic/pending-6.6/710-bridge-add-knob-for-filtering-rx-tx-BPDU-pack.patch +++ b/target/linux/generic/pending-6.6/710-bridge-add-knob-for-filtering-rx-tx-BPDU-pack.patch @@ -45,7 +45,7 @@ Signed-off-by: Felix Fietkau if (!(p->flags & BR_BCAST_FLOOD) && skb->dev != br->dev) --- a/net/bridge/br_input.c +++ b/net/bridge/br_input.c -@@ -367,6 +367,8 @@ static rx_handler_result_t br_handle_fra +@@ -369,6 +369,8 @@ static rx_handler_result_t br_handle_fra fwd_mask |= p->group_fwd_mask; switch (dest[5]) { case 0x00: /* Bridge Group Address */ From 4a7945ee848d436d8c1b5ed035980a2cc6f212ed Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Fri, 27 Dec 2024 15:53:23 +0100 Subject: [PATCH 485/877] realtek: Add driver for auxiliary MDIO busses Add a driver that exposes the auxiliary busses, used for the RTL8231 expanders, as a proper MDIO controller. The device must be instantiated under an MFD device, so the driver should also be compatible with SoC managed by an external CPU via SPI. Leave the driver disabled in builds until required. Signed-off-by: Sander Vanheule (cherry picked from commit ae833c01b312258c27ff2dc1c8d44b15b7028e32) --- ...dd-Realtek-Otto-auxiliary-controller.patch | 193 ++++++++++++++++++ target/linux/realtek/rtl838x/config-6.6 | 1 + target/linux/realtek/rtl839x/config-6.6 | 1 + target/linux/realtek/rtl930x/config-6.6 | 1 + target/linux/realtek/rtl931x/config-6.6 | 1 + 5 files changed, 197 insertions(+) create mode 100644 target/linux/realtek/patches-6.6/723-net-mdio-Add-Realtek-Otto-auxiliary-controller.patch diff --git a/target/linux/realtek/patches-6.6/723-net-mdio-Add-Realtek-Otto-auxiliary-controller.patch b/target/linux/realtek/patches-6.6/723-net-mdio-Add-Realtek-Otto-auxiliary-controller.patch new file mode 100644 index 00000000000000..430f8f5c007ecc --- /dev/null +++ b/target/linux/realtek/patches-6.6/723-net-mdio-Add-Realtek-Otto-auxiliary-controller.patch @@ -0,0 +1,193 @@ +From c7ddb74c981c1a29bad82d555d08724aca93b687 Mon Sep 17 00:00:00 2001 +From: Sander Vanheule +Date: Fri, 27 Dec 2024 14:55:31 +0100 +Subject: [PATCH] net: mdio: Add Realtek Otto auxiliary controller + +SoCs in Realtek's Otto platform such as the RTL8380 and RTL8391 have a +simple auxiliary MDIO controller that is commonly used to manage RTL8231 +GPIO expanders on switch devices. + +Add a new MDIO controller driver supporting the RTL838x (maple) and +RTL839x (cypress) SoCs. + +Signed-off-by: Sander Vanheule +--- + drivers/net/mdio/Kconfig | 10 ++ + drivers/net/mdio/Makefile | 1 + + drivers/net/mdio/mdio-realtek-otto-aux.c | 129 +++++++++++++++++++++++ + 3 files changed, 140 insertions(+) + create mode 100644 drivers/net/mdio/mdio-realtek-otto-aux.c + +--- a/drivers/net/mdio/Kconfig ++++ b/drivers/net/mdio/Kconfig +@@ -207,6 +207,16 @@ config MDIO_REGMAP + regmap. Users willing to use this driver must explicitly select + REGMAP. + ++config MDIO_REALTEK_OTTO_AUX ++ tristate "Realtek Otto auxiliary MDIO interface support" ++ default MACH_REALTEK_RTL ++ depends on MACH_REALTEK_RTL ++ depends on MFD_SYSCON ++ select MDIO_DEVRES ++ help ++ This driver supports the auxilairy MDIO bus on RTL838x SoCs. This bus ++ is typically used to attach RTL8231 GPIO extenders. ++ + config MDIO_THUNDER + tristate "ThunderX SOCs MDIO buses" + depends on 64BIT +--- a/drivers/net/mdio/Makefile ++++ b/drivers/net/mdio/Makefile +@@ -20,6 +20,7 @@ obj-$(CONFIG_MDIO_MSCC_MIIM) += mdio-ms + obj-$(CONFIG_MDIO_MVUSB) += mdio-mvusb.o + obj-$(CONFIG_MDIO_OCTEON) += mdio-octeon.o + obj-$(CONFIG_MDIO_REGMAP) += mdio-regmap.o ++obj-$(CONFIG_MDIO_REALTEK_OTTO_AUX) += mdio-realtek-otto-aux.o + obj-$(CONFIG_MDIO_SMBUS) += mdio-smbus.o + obj-$(CONFIG_MDIO_SUN4I) += mdio-sun4i.o + obj-$(CONFIG_MDIO_THUNDER) += mdio-thunder.o +--- /dev/null ++++ b/drivers/net/mdio/mdio-realtek-otto-aux.c +@@ -0,0 +1,141 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define RTL8380_EXT_GPIO_INDIRECT_ACCESS 0xA09C ++#define RTL8390_EXT_GPIO_INDIRECT_ACCESS 0x0224 ++ ++#define RTL83XX_AUX_MDIO_DATA GENMASK(31, 16) ++#define RTL83XX_AUX_MDIO_REG GENMASK(11, 7) ++#define RTL83XX_AUX_MDIO_PHY_ADDR GENMASK(6, 2) ++#define RTL83XX_AUX_MDIO_WRITE BIT(1) ++#define RTL83XX_AUX_MDIO_READ 0 ++#define RTL83XX_AUX_MDIO_EXEC BIT(0) ++ ++struct realtek_aux_mdio_ctrl { ++ struct device *dev; ++ struct regmap *map; ++ unsigned int cmd_reg; ++}; ++ ++#define mii_bus_to_ctrl(bus) ((struct realtek_aux_mdio_ctrl *) bus->priv) ++ ++static int rtl83xx_aux_mdio_cmd(struct realtek_aux_mdio_ctrl *ctrl, int addr, int regnum, ++ u32 rw_bit, u16 *data) ++{ ++ unsigned int mask_volatile; ++ unsigned int cmd; ++ unsigned int run; ++ int err; ++ ++ cmd = rw_bit | RTL83XX_AUX_MDIO_EXEC; ++ cmd |= FIELD_PREP(RTL83XX_AUX_MDIO_PHY_ADDR, addr); ++ cmd |= FIELD_PREP(RTL83XX_AUX_MDIO_REG, regnum); ++ ++ mask_volatile = RTL83XX_AUX_MDIO_EXEC; ++ ++ if (rw_bit == RTL83XX_AUX_MDIO_WRITE) ++ cmd |= FIELD_PREP(RTL83XX_AUX_MDIO_DATA, *data); ++ else ++ mask_volatile |= RTL83XX_AUX_MDIO_DATA; ++ ++ err = regmap_write(ctrl->map, ctrl->cmd_reg, cmd); ++ if (err) ++ return err; ++ ++ err = regmap_read_poll_timeout(ctrl->map, ctrl->cmd_reg, run, (run != cmd), 3, 100); ++ ++ if ((run & ~mask_volatile) != (cmd & ~mask_volatile)) { ++ dev_err(ctrl->dev, "Command modified. Is offloading still active?"); ++ return -EIO; ++ } ++ ++ if (!err && (rw_bit == RTL83XX_AUX_MDIO_READ)) ++ *data = FIELD_GET(RTL83XX_AUX_MDIO_DATA, run); ++ ++ return err; ++} ++ ++static int rtl83xx_aux_mdio_read(struct mii_bus *bus, int addr, int regnum) ++{ ++ struct realtek_aux_mdio_ctrl *ctrl = mii_bus_to_ctrl(bus); ++ u16 data; ++ int err; ++ ++ err = rtl83xx_aux_mdio_cmd(ctrl, addr, regnum, RTL83XX_AUX_MDIO_READ, &data); ++ ++ if (err) ++ return err; ++ else ++ return data; ++} ++ ++static int rtl83xx_aux_mdio_write(struct mii_bus *bus, int addr, int regnum, u16 val) ++{ ++ struct realtek_aux_mdio_ctrl *ctrl = mii_bus_to_ctrl(bus); ++ ++ return rtl83xx_aux_mdio_cmd(ctrl, addr, regnum, RTL83XX_AUX_MDIO_WRITE, &val); ++} ++ ++static int realtek_aux_mdio_probe(struct platform_device *pdev) ++{ ++ struct device_node *np = pdev->dev.of_node; ++ struct realtek_aux_mdio_ctrl *ctrl; ++ struct mii_bus *bus; ++ ++ bus = devm_mdiobus_alloc_size(&pdev->dev, sizeof(*ctrl)); ++ if (!bus) ++ return -ENOMEM; ++ ++ ctrl = bus->priv; ++ ctrl->dev = &pdev->dev; ++ ctrl->cmd_reg = (unsigned int) device_get_match_data(ctrl->dev); ++ ctrl->map = syscon_node_to_regmap(np->parent); ++ if (IS_ERR(ctrl->map)) ++ return PTR_ERR(ctrl->map); ++ ++ bus->name = "RTL83xx auxiliary MDIO bus"; ++ snprintf(bus->id, MII_BUS_ID_SIZE, "rtl83xx-aux-mdio") ; ++ bus->parent = ctrl->dev; ++ bus->read = rtl83xx_aux_mdio_read; ++ bus->write = rtl83xx_aux_mdio_write; ++ /* Don't have interrupts */ ++ for (unsigned int i = 0; i < PHY_MAX_ADDR; i++) ++ bus->irq[i] = PHY_POLL; ++ ++ return devm_of_mdiobus_register(ctrl->dev, bus, np); ++} ++ ++static const struct of_device_id realtek_aux_mdio_of_match[] = { ++ { ++ .compatible = "realtek,rtl8380-aux-mdio", ++ .data = (void *) RTL8380_EXT_GPIO_INDIRECT_ACCESS, ++ }, ++ { ++ .compatible = "realtek,rtl8390-aux-mdio", ++ .data = (void *) RTL8390_EXT_GPIO_INDIRECT_ACCESS, ++ }, ++ { /* sentinel */ } ++}; ++MODULE_DEVICE_TABLE(of, realtek_aux_mdio_of_match); ++ ++static struct platform_driver realtek_aux_mdio_driver = { ++ .driver = { ++ .name = "realtek-otto-aux-mdio", ++ .of_match_table = realtek_aux_mdio_of_match ++ }, ++ .probe = realtek_aux_mdio_probe, ++}; ++module_platform_driver(realtek_aux_mdio_driver); ++ ++MODULE_AUTHOR("Sander Vanheule "); ++MODULE_DESCRIPTION("Realtek RTL83xx auxiliary MDIO bus"); ++MODULE_LICENSE("GPL v2"); diff --git a/target/linux/realtek/rtl838x/config-6.6 b/target/linux/realtek/rtl838x/config-6.6 index 44c1d7e0645c9d..d031965cea41b7 100644 --- a/target/linux/realtek/rtl838x/config-6.6 +++ b/target/linux/realtek/rtl838x/config-6.6 @@ -122,6 +122,7 @@ CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y CONFIG_MDIO_I2C=y +# CONFIG_MDIO_REALTEK_OTTO_AUX is not set CONFIG_MDIO_SMBUS=y CONFIG_MEMFD_CREATE=y CONFIG_MFD_SYSCON=y diff --git a/target/linux/realtek/rtl839x/config-6.6 b/target/linux/realtek/rtl839x/config-6.6 index 630027bf8133bb..4612a73e4ad9ec 100644 --- a/target/linux/realtek/rtl839x/config-6.6 +++ b/target/linux/realtek/rtl839x/config-6.6 @@ -121,6 +121,7 @@ CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y CONFIG_MDIO_I2C=y +# CONFIG_MDIO_REALTEK_OTTO_AUX is not set CONFIG_MDIO_SMBUS=y CONFIG_MEMFD_CREATE=y CONFIG_MFD_SYSCON=y diff --git a/target/linux/realtek/rtl930x/config-6.6 b/target/linux/realtek/rtl930x/config-6.6 index 5a29bdc3c1ba78..694f10019ebbe2 100644 --- a/target/linux/realtek/rtl930x/config-6.6 +++ b/target/linux/realtek/rtl930x/config-6.6 @@ -103,6 +103,7 @@ CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y CONFIG_MDIO_I2C=y +# CONFIG_MDIO_REALTEK_OTTO_AUX is not set CONFIG_MDIO_SMBUS=y CONFIG_MEMFD_CREATE=y CONFIG_MFD_SYSCON=y diff --git a/target/linux/realtek/rtl931x/config-6.6 b/target/linux/realtek/rtl931x/config-6.6 index df235defe83c84..9ab93d4fe760e0 100644 --- a/target/linux/realtek/rtl931x/config-6.6 +++ b/target/linux/realtek/rtl931x/config-6.6 @@ -112,6 +112,7 @@ CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y CONFIG_MDIO_I2C=y +# CONFIG_MDIO_REALTEK_OTTO_AUX is not set CONFIG_MDIO_SMBUS=y CONFIG_MEMFD_CREATE=y CONFIG_MFD_SYSCON=y From 01bc33a9132237f2b395dc4331e70e198ed6146e Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Fri, 27 Dec 2024 15:56:44 +0100 Subject: [PATCH 486/877] realtek: rtl838x: Instantiate auxiliary MDIO bus Add a disabled node for the auxiliary MDIO bus, used to manage the RTL8231 expanders. A simple-mfd parent node is added, at the same (implied) address as the switch@1b000000 node, as the switch drivers should anyway transistion to MFD subdivices at some point. Additionally, two pinctrl-single node are added to allow the MDX pins to be muxed correctly, in case the bootloader leaves these unconfigured. Signed-off-by: Sander Vanheule (cherry picked from commit 92ae8cb16c46823d5a00489b4d3a9cc724ba67a4) --- target/linux/realtek/dts/rtl838x.dtsi | 56 +++++++++++++++++++++++++ target/linux/realtek/rtl838x/config-6.6 | 2 +- 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/target/linux/realtek/dts/rtl838x.dtsi b/target/linux/realtek/dts/rtl838x.dtsi index 13ba6450b2d6f0..ab034fc1bcfc2c 100644 --- a/target/linux/realtek/dts/rtl838x.dtsi +++ b/target/linux/realtek/dts/rtl838x.dtsi @@ -232,6 +232,42 @@ }; }; + switchcore@1b000000 { + compatible = "syscon", "simple-mfd"; + reg = <0x1b000000 0x20000>; + + mdio_aux: mdio-aux { + compatible = "realtek,rtl8380-aux-mdio"; + #address-cells = <1>; + #size-cells = <0>; + + status = "disabled"; + + pinctrl-names = "default"; + pinctrl-0 = <&mdio_aux_mdx>, <&aux_mode_mdio>; + }; + }; + + pinmux@1b000144 { + compatible = "pinctrl-single"; + reg = <0x1b000144 0x4>; + + pinctrl-single,bit-per-mux; + pinctrl-single,register-width = <32>; + pinctrl-single,function-mask = <0x1>; + #pinctrl-cells = <2>; + + /* I2C mode */ + aux_mode_i2c: i2c-pins { + pinctrl-single,bits = <0x0 0x0 0x1>; + }; + + /* MDIO mode */ + aux_mode_mdio: mdx-pins { + pinctrl-single,bits = <0x0 0x1 0x1>; + }; + }; + pinmux: pinmux@1b001000 { compatible = "pinctrl-single"; reg = <0x1b001000 0x4>; @@ -262,6 +298,26 @@ }; }; + pinmux@1b00a0e0 { + compatible = "pinctrl-single"; + reg = <0x1b00a0e0 0x4>; + + pinctrl-single,bit-per-mux; + pinctrl-single,register-width = <32>; + pinctrl-single,function-mask = <0x1>; + #pinctrl-cells = <2>; + + /* Use SoC GPIO 2/3 as GPIO */ + mdio_aux_gpio: gpio-pins { + pinctrl-single,bits = <0x0 0x0 0x1>; + }; + + /* Use SoC GPIO 2/3 as MDC/MDIO */ + mdio_aux_mdx: mdx-pins { + pinctrl-single,bits = <0x0 0x1 0x1>; + }; + }; + ethernet0: ethernet@1b00a300 { compatible = "realtek,rtl838x-eth"; reg = <0x1b00a300 0x100>; diff --git a/target/linux/realtek/rtl838x/config-6.6 b/target/linux/realtek/rtl838x/config-6.6 index d031965cea41b7..020477b7bc4791 100644 --- a/target/linux/realtek/rtl838x/config-6.6 +++ b/target/linux/realtek/rtl838x/config-6.6 @@ -122,7 +122,7 @@ CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y CONFIG_MDIO_I2C=y -# CONFIG_MDIO_REALTEK_OTTO_AUX is not set +CONFIG_MDIO_REALTEK_OTTO_AUX=y CONFIG_MDIO_SMBUS=y CONFIG_MEMFD_CREATE=y CONFIG_MFD_SYSCON=y From 07ebd87bd196d3ccecd6b1f5c3d9100b59fb7e4e Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Thu, 26 Dec 2024 20:55:16 +0100 Subject: [PATCH 487/877] realtek: Add pinctrl support for RTL8231 Add pending patches to add RTL8231 support as a MDIO-bus attached multi-functional device. This includes subdrivers for the pincontrol and GPIO features, as well as the LED matrix support. Leave the drivers disabled until required by a device. Cherry picked from commit 6ef6014887c393dc07f0349028d93e4fa82e0733, but dropped already picked patch for gpio-regmap request/free, and rebased configs Signed-off-by: Sander Vanheule --- ...ap-Bypass-cache-for-shadowed-outputs.patch | 56 ++ .../802-mfd-Add-RTL8231-core-device.patch | 330 ++++++++++ ...RTL8231-pin-control-and-GPIO-support.patch | 581 ++++++++++++++++++ ...-support-for-RTL8231-LED-scan-matrix.patch | 338 ++++++++++ target/linux/realtek/rtl838x/config-6.6 | 1 + target/linux/realtek/rtl839x/config-6.6 | 1 + target/linux/realtek/rtl930x/config-6.6 | 1 + target/linux/realtek/rtl931x/config-6.6 | 1 + 8 files changed, 1309 insertions(+) create mode 100644 target/linux/realtek/patches-6.6/800-gpio-regmap-Bypass-cache-for-shadowed-outputs.patch create mode 100644 target/linux/realtek/patches-6.6/802-mfd-Add-RTL8231-core-device.patch create mode 100644 target/linux/realtek/patches-6.6/803-pinctrl-Add-RTL8231-pin-control-and-GPIO-support.patch create mode 100644 target/linux/realtek/patches-6.6/804-leds-Add-support-for-RTL8231-LED-scan-matrix.patch diff --git a/target/linux/realtek/patches-6.6/800-gpio-regmap-Bypass-cache-for-shadowed-outputs.patch b/target/linux/realtek/patches-6.6/800-gpio-regmap-Bypass-cache-for-shadowed-outputs.patch new file mode 100644 index 00000000000000..b4dbf320b2db43 --- /dev/null +++ b/target/linux/realtek/patches-6.6/800-gpio-regmap-Bypass-cache-for-shadowed-outputs.patch @@ -0,0 +1,56 @@ +From b3f79468c90d8770f007d628a1e32b2d5d44a5c2 Mon Sep 17 00:00:00 2001 +From: Sander Vanheule +Date: Sat, 15 May 2021 11:57:32 +0200 +Subject: [PATCH] gpio: regmap: Bypass cache for shadowed outputs + +Some chips have the read-only input and write-only output data registers +aliased to the same offset, but do not perform direction multiplexing on +writes. Upon writing the register, this then always updates the output +value, even when the pin is configured as input. As a result it is not +safe to perform read-modify-writes on output pins, when other pins are +still configured as input. + +For example, on a bit-banged I2C bus, where the lines are switched +between out-low and in (with external pull-up) + + OUT(L) IN OUT(H) +SCK ....../''''''|'''''' + +SDA '''''''''\.......... + ^ ^- SCK switches to direction to OUT, but now has a high + | value, breaking the clock. + | + \- Perform RMW to update SDA. This reads the current input + value for SCK, updates the SDA value and writes back a 1 + for SCK as well. + +If a register is used for both the data input and data output (and is +not marked as volatile) the driver should ensure the cache is not +updated on register reads. This ensures proper functioning of writing +the output register with regmap_update_bits(), which will then use and +update the cache only on register writes. + +Signed-off-by: Sander Vanheule +--- + drivers/gpio/gpio-regmap.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +--- a/drivers/gpio/gpio-regmap.c ++++ b/drivers/gpio/gpio-regmap.c +@@ -74,7 +74,15 @@ static int gpio_regmap_get(struct gpio_c + if (ret) + return ret; + +- ret = regmap_read(gpio->regmap, reg, &val); ++ /* ++ * Ensure we don't spoil the register cache with pin input values and ++ * perform a bypassed read. This way the cache (if any) is only used and ++ * updated on register writes. ++ */ ++ if (gpio->reg_dat_base == gpio->reg_set_base) ++ ret = regmap_read_bypassed(gpio->regmap, reg, &val); ++ else ++ ret = regmap_read(gpio->regmap, reg, &val); + if (ret) + return ret; + diff --git a/target/linux/realtek/patches-6.6/802-mfd-Add-RTL8231-core-device.patch b/target/linux/realtek/patches-6.6/802-mfd-Add-RTL8231-core-device.patch new file mode 100644 index 00000000000000..df4d4aa143479c --- /dev/null +++ b/target/linux/realtek/patches-6.6/802-mfd-Add-RTL8231-core-device.patch @@ -0,0 +1,330 @@ +From 4e3455e058d40eb2a7326016494e3c81dc506c33 Mon Sep 17 00:00:00 2001 +From: Sander Vanheule +Date: Mon, 10 May 2021 18:33:01 +0200 +Subject: [PATCH] mfd: Add RTL8231 core device + +The RTL8231 is implemented as an MDIO device, and provides a regmap +interface for register access by the core and child devices. + +The chip can also be a device on an SMI bus, an I2C-like bus by Realtek. +Since kernel support for SMI is limited, and no real-world SMI +implementations have been encountered for this device, this is currently +unimplemented. The use of the regmap interface should make any future +support relatively straightforward. + +After reset, all pins are muxed to GPIO inputs before the pin drivers +are enabled. This is done to prevent accidental system resets, when a +pin is connected to the parent SoC's reset line. + +To provide different read and write semantics for the GPIO data +registers, a secondary virtual register range is used to enable separate +caching properties of pin input and output values. + +Signed-off-by: Sander Vanheule +--- + drivers/mfd/Kconfig | 9 ++ + drivers/mfd/Makefile | 1 + + drivers/mfd/rtl8231.c | 193 ++++++++++++++++++++++++++++++++++++ + include/linux/mfd/rtl8231.h | 71 +++++++++++++ + 4 files changed, 274 insertions(+) + create mode 100644 drivers/mfd/rtl8231.c + create mode 100644 include/linux/mfd/rtl8231.h + +--- a/drivers/mfd/Kconfig ++++ b/drivers/mfd/Kconfig +@@ -1171,6 +1171,15 @@ config MFD_RDC321X + southbridge which provides access to GPIOs and Watchdog using the + southbridge PCI device configuration space. + ++config MFD_RTL8231 ++ tristate "Realtek RTL8231 GPIO and LED expander" ++ select MFD_CORE ++ select REGMAP_MDIO ++ help ++ Support for the Realtek RTL8231 GPIO and LED expander. ++ Provides up to 37 GPIOs, 88 LEDs, and one PWM output. ++ When built as a module, this module will be named rtl8231. ++ + config MFD_RT4831 + tristate "Richtek RT4831 four channel WLED and Display Bias Voltage" + depends on I2C +--- a/drivers/mfd/Makefile ++++ b/drivers/mfd/Makefile +@@ -240,6 +240,7 @@ obj-$(CONFIG_MFD_HI6421_PMIC) += hi6421- + obj-$(CONFIG_MFD_HI6421_SPMI) += hi6421-spmi-pmic.o + obj-$(CONFIG_MFD_HI655X_PMIC) += hi655x-pmic.o + obj-$(CONFIG_MFD_DLN2) += dln2.o ++obj-$(CONFIG_MFD_RTL8231) += rtl8231.o + obj-$(CONFIG_MFD_RT4831) += rt4831.o + obj-$(CONFIG_MFD_RT5033) += rt5033.o + obj-$(CONFIG_MFD_RT5120) += rt5120.o +--- /dev/null ++++ b/drivers/mfd/rtl8231.c +@@ -0,0 +1,193 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++static bool rtl8231_volatile_reg(struct device *dev, unsigned int reg) ++{ ++ switch (reg) { ++ /* ++ * Registers with self-clearing bits, strapping pin values. ++ * Don't mark the data registers as volatile, since we need ++ * caching for the output values. ++ */ ++ case RTL8231_REG_FUNC0: ++ case RTL8231_REG_FUNC1: ++ case RTL8231_REG_PIN_HI_CFG: ++ case RTL8231_REG_LED_END: ++ return true; ++ default: ++ return false; ++ } ++} ++ ++static const struct reg_field RTL8231_FIELD_LED_START = REG_FIELD(RTL8231_REG_FUNC0, 1, 1); ++ ++static const struct mfd_cell rtl8231_cells[] = { ++ { ++ .name = "rtl8231-pinctrl", ++ }, ++ { ++ .name = "rtl8231-leds", ++ .of_compatible = "realtek,rtl8231-leds", ++ }, ++}; ++ ++static int rtl8231_soft_reset(struct regmap *map) ++{ ++ const unsigned int all_pins_mask = GENMASK(RTL8231_BITS_VAL - 1, 0); ++ unsigned int val; ++ int err; ++ ++ /* SOFT_RESET bit self-clears when done */ ++ regmap_write_bits(map, RTL8231_REG_PIN_HI_CFG, ++ RTL8231_PIN_HI_CFG_SOFT_RESET, RTL8231_PIN_HI_CFG_SOFT_RESET); ++ err = regmap_read_poll_timeout(map, RTL8231_REG_PIN_HI_CFG, val, ++ !(val & RTL8231_PIN_HI_CFG_SOFT_RESET), 50, 1000); ++ if (err) ++ return err; ++ ++ regcache_mark_dirty(map); ++ ++ /* ++ * Chip reset results in a pin configuration that is a mix of LED and GPIO outputs. ++ * Select GPI functionality for all pins before enabling pin outputs. ++ */ ++ regmap_write(map, RTL8231_REG_PIN_MODE0, all_pins_mask); ++ regmap_write(map, RTL8231_REG_GPIO_DIR0, all_pins_mask); ++ regmap_write(map, RTL8231_REG_PIN_MODE1, all_pins_mask); ++ regmap_write(map, RTL8231_REG_GPIO_DIR1, all_pins_mask); ++ regmap_write(map, RTL8231_REG_PIN_HI_CFG, ++ RTL8231_PIN_HI_CFG_MODE_MASK | RTL8231_PIN_HI_CFG_DIR_MASK); ++ ++ return 0; ++} ++ ++static int rtl8231_init(struct device *dev, struct regmap *map) ++{ ++ struct regmap_field *led_start; ++ unsigned int started; ++ unsigned int val; ++ int err; ++ ++ err = regmap_read(map, RTL8231_REG_FUNC1, &val); ++ if (err) { ++ dev_err(dev, "failed to read READY_CODE\n"); ++ return err; ++ } ++ ++ val = FIELD_GET(RTL8231_FUNC1_READY_CODE_MASK, val); ++ if (val != RTL8231_FUNC1_READY_CODE_VALUE) { ++ dev_err(dev, "RTL8231 not present or ready 0x%x != 0x%x\n", ++ val, RTL8231_FUNC1_READY_CODE_VALUE); ++ return -ENODEV; ++ } ++ ++ led_start = dev_get_drvdata(dev); ++ err = regmap_field_read(led_start, &started); ++ if (err) ++ return err; ++ ++ if (!started) { ++ err = rtl8231_soft_reset(map); ++ if (err) ++ return err; ++ /* LED_START enables power to output pins, and starts the LED engine */ ++ err = regmap_field_force_write(led_start, 1); ++ } ++ ++ return err; ++} ++ ++static const struct regmap_config rtl8231_mdio_regmap_config = { ++ .val_bits = RTL8231_BITS_VAL, ++ .reg_bits = RTL8231_BITS_REG, ++ .volatile_reg = rtl8231_volatile_reg, ++ .max_register = RTL8231_REG_COUNT - 1, ++ .use_single_read = true, ++ .use_single_write = true, ++ .reg_format_endian = REGMAP_ENDIAN_BIG, ++ .val_format_endian = REGMAP_ENDIAN_BIG, ++ /* Cannot use REGCACHE_FLAT because it's not smart enough about cache invalidation */ ++ .cache_type = REGCACHE_RBTREE, ++}; ++ ++static int rtl8231_mdio_probe(struct mdio_device *mdiodev) ++{ ++ struct device *dev = &mdiodev->dev; ++ struct regmap_field *led_start; ++ struct regmap *map; ++ int err; ++ ++ map = devm_regmap_init_mdio(mdiodev, &rtl8231_mdio_regmap_config); ++ if (IS_ERR(map)) { ++ dev_err(dev, "failed to init regmap\n"); ++ return PTR_ERR(map); ++ } ++ ++ led_start = devm_regmap_field_alloc(dev, map, RTL8231_FIELD_LED_START); ++ if (IS_ERR(led_start)) ++ return PTR_ERR(led_start); ++ ++ dev_set_drvdata(dev, led_start); ++ ++ mdiodev->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); ++ if (IS_ERR(mdiodev->reset_gpio)) ++ return PTR_ERR(mdiodev->reset_gpio); ++ ++ device_property_read_u32(dev, "reset-assert-delay", &mdiodev->reset_assert_delay); ++ device_property_read_u32(dev, "reset-deassert-delay", &mdiodev->reset_deassert_delay); ++ ++ err = rtl8231_init(dev, map); ++ if (err) ++ return err; ++ ++ return devm_mfd_add_devices(dev, PLATFORM_DEVID_AUTO, rtl8231_cells, ++ ARRAY_SIZE(rtl8231_cells), NULL, 0, NULL); ++} ++ ++__maybe_unused static int rtl8231_suspend(struct device *dev) ++{ ++ struct regmap_field *led_start = dev_get_drvdata(dev); ++ ++ return regmap_field_force_write(led_start, 0); ++} ++ ++__maybe_unused static int rtl8231_resume(struct device *dev) ++{ ++ struct regmap_field *led_start = dev_get_drvdata(dev); ++ ++ return regmap_field_force_write(led_start, 1); ++} ++ ++static SIMPLE_DEV_PM_OPS(rtl8231_pm_ops, rtl8231_suspend, rtl8231_resume); ++ ++static const struct of_device_id rtl8231_of_match[] = { ++ { .compatible = "realtek,rtl8231" }, ++ {} ++}; ++MODULE_DEVICE_TABLE(of, rtl8231_of_match); ++ ++static struct mdio_driver rtl8231_mdio_driver = { ++ .mdiodrv.driver = { ++ .name = "rtl8231-expander", ++ .of_match_table = rtl8231_of_match, ++ .pm = pm_ptr(&rtl8231_pm_ops), ++ }, ++ .probe = rtl8231_mdio_probe, ++}; ++mdio_module_driver(rtl8231_mdio_driver); ++ ++MODULE_AUTHOR("Sander Vanheule "); ++MODULE_DESCRIPTION("Realtek RTL8231 GPIO and LED expander"); ++MODULE_LICENSE("GPL"); +--- /dev/null ++++ b/include/linux/mfd/rtl8231.h +@@ -0,0 +1,71 @@ ++/* SPDX-License-Identifier: GPL-2.0-or-later */ ++/* ++ * Register definitions the RTL8231 GPIO and LED expander chip ++ */ ++ ++#ifndef __LINUX_MFD_RTL8231_H ++#define __LINUX_MFD_RTL8231_H ++ ++#include ++ ++/* ++ * Registers addresses are 5 bit, values are 16 bit ++ * Also define a duplicated range of virtual addresses, to enable ++ * different read/write behaviour on the GPIO data registers ++ */ ++#define RTL8231_BITS_VAL 16 ++#define RTL8231_BITS_REG 5 ++ ++/* Chip control */ ++#define RTL8231_REG_FUNC0 0x00 ++#define RTL8231_FUNC0_SCAN_MODE BIT(0) ++#define RTL8231_FUNC0_SCAN_SINGLE 0 ++#define RTL8231_FUNC0_SCAN_BICOLOR BIT(0) ++ ++#define RTL8231_REG_FUNC1 0x01 ++#define RTL8231_FUNC1_READY_CODE_VALUE 0x37 ++#define RTL8231_FUNC1_READY_CODE_MASK GENMASK(9, 4) ++#define RTL8231_FUNC1_DEBOUNCE_MASK GENMASK(15, 10) ++ ++/* Pin control */ ++#define RTL8231_REG_PIN_MODE0 0x02 ++#define RTL8231_REG_PIN_MODE1 0x03 ++ ++#define RTL8231_PIN_MODE_LED 0 ++#define RTL8231_PIN_MODE_GPIO 1 ++ ++/* Pin high config: pin and GPIO control for pins 32-26 */ ++#define RTL8231_REG_PIN_HI_CFG 0x04 ++#define RTL8231_PIN_HI_CFG_MODE_MASK GENMASK(4, 0) ++#define RTL8231_PIN_HI_CFG_DIR_MASK GENMASK(9, 5) ++#define RTL8231_PIN_HI_CFG_INV_MASK GENMASK(14, 10) ++#define RTL8231_PIN_HI_CFG_SOFT_RESET BIT(15) ++ ++/* GPIO control registers */ ++#define RTL8231_REG_GPIO_DIR0 0x05 ++#define RTL8231_REG_GPIO_DIR1 0x06 ++#define RTL8231_REG_GPIO_INVERT0 0x07 ++#define RTL8231_REG_GPIO_INVERT1 0x08 ++ ++#define RTL8231_GPIO_DIR_IN 1 ++#define RTL8231_GPIO_DIR_OUT 0 ++ ++/* ++ * GPIO data registers ++ * Only the output data can be written to these registers, and only the input ++ * data can be read. ++ */ ++#define RTL8231_REG_GPIO_DATA0 0x1c ++#define RTL8231_REG_GPIO_DATA1 0x1d ++#define RTL8231_REG_GPIO_DATA2 0x1e ++#define RTL8231_PIN_HI_DATA_MASK GENMASK(4, 0) ++ ++/* LED control base registers */ ++#define RTL8231_REG_LED0_BASE 0x09 ++#define RTL8231_REG_LED1_BASE 0x10 ++#define RTL8231_REG_LED2_BASE 0x17 ++#define RTL8231_REG_LED_END 0x1b ++ ++#define RTL8231_REG_COUNT 0x1f ++ ++#endif /* __LINUX_MFD_RTL8231_H */ diff --git a/target/linux/realtek/patches-6.6/803-pinctrl-Add-RTL8231-pin-control-and-GPIO-support.patch b/target/linux/realtek/patches-6.6/803-pinctrl-Add-RTL8231-pin-control-and-GPIO-support.patch new file mode 100644 index 00000000000000..de0f5ee8684207 --- /dev/null +++ b/target/linux/realtek/patches-6.6/803-pinctrl-Add-RTL8231-pin-control-and-GPIO-support.patch @@ -0,0 +1,581 @@ +From 098324288a63a6dcc44e96cc381aef3d5c48d89e Mon Sep 17 00:00:00 2001 +From: Sander Vanheule +Date: Mon, 10 May 2021 22:15:31 +0200 +Subject: [PATCH] pinctrl: Add RTL8231 pin control and GPIO support + +This driver implements the GPIO and pin muxing features provided by the +RTL8231. The device should be instantiated as an MFD child, where the +parent device has already configured the regmap used for register +access. + +Debouncing is only available for the six highest GPIOs, and must be +emulated when other pins are used for (button) inputs. Although +described in the bindings, drive strength selection is currently not +implemented. + +Signed-off-by: Sander Vanheule +--- + drivers/pinctrl/Kconfig | 11 + + drivers/pinctrl/Makefile | 1 + + drivers/pinctrl/pinctrl-rtl8231.c | 521 ++++++++++++++++++++++++++++++ + 3 files changed, 533 insertions(+) + create mode 100644 drivers/pinctrl/pinctrl-rtl8231.c + +--- a/drivers/pinctrl/Kconfig ++++ b/drivers/pinctrl/Kconfig +@@ -417,6 +417,17 @@ config PINCTRL_ROCKCHIP + help + This support pinctrl and GPIO driver for Rockchip SoCs. + ++config PINCTRL_RTL8231 ++ tristate "Realtek RTL8231 GPIO expander's pin controller" ++ depends on MFD_RTL8231 ++ default MFD_RTL8231 ++ select GPIO_REGMAP ++ select GENERIC_PINCONF ++ select GENERIC_PINMUX_FUNCTIONS ++ help ++ Support for RTL8231 expander's GPIOs and pin controller. ++ When built as a module, the module will be called pinctrl-rtl8231. ++ + config PINCTRL_SINGLE + tristate "One-register-per-pin type device tree based pinctrl driver" + depends on OF +--- a/drivers/pinctrl/Makefile ++++ b/drivers/pinctrl/Makefile +@@ -43,6 +43,7 @@ obj-$(CONFIG_PINCTRL_PIC32) += pinctrl-p + obj-$(CONFIG_PINCTRL_PISTACHIO) += pinctrl-pistachio.o + obj-$(CONFIG_PINCTRL_RK805) += pinctrl-rk805.o + obj-$(CONFIG_PINCTRL_ROCKCHIP) += pinctrl-rockchip.o ++obj-$(CONFIG_PINCTRL_RTL8231) += pinctrl-rtl8231.o + obj-$(CONFIG_PINCTRL_SINGLE) += pinctrl-single.o + obj-$(CONFIG_PINCTRL_ST) += pinctrl-st.o + obj-$(CONFIG_PINCTRL_STMFX) += pinctrl-stmfx.o +--- /dev/null ++++ b/drivers/pinctrl/pinctrl-rtl8231.c +@@ -0,0 +1,525 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "core.h" ++#include "pinmux.h" ++#include ++ ++#define RTL8231_NUM_GPIOS 37 ++#define RTL8231_DEBOUNCE_USEC 100000 ++#define RTL8231_DEBOUNCE_MIN_OFFSET 31 ++ ++struct rtl8231_pin_ctrl { ++ struct pinctrl_desc pctl_desc; ++ struct regmap *map; ++}; ++ ++/* ++ * Pin controller functionality ++ */ ++static const char * const rtl8231_pin_function_names[] = { ++ "gpio", ++ "led", ++ "pwm", ++}; ++ ++enum rtl8231_pin_function { ++ RTL8231_PIN_FUNCTION_GPIO = BIT(0), ++ RTL8231_PIN_FUNCTION_LED = BIT(1), ++ RTL8231_PIN_FUNCTION_PWM = BIT(2), ++}; ++ ++struct rtl8231_pin_desc { ++ const enum rtl8231_pin_function functions; ++ const u8 reg; ++ const u8 offset; ++ const u8 gpio_function_value; ++}; ++ ++#define RTL8231_PIN_DESC(_num, _func, _reg, _fld, _val) \ ++ [_num] = { \ ++ .functions = RTL8231_PIN_FUNCTION_GPIO | _func, \ ++ .reg = _reg, \ ++ .offset = _fld, \ ++ .gpio_function_value = _val, \ ++ } ++#define RTL8231_GPIO_PIN_DESC(_num, _reg, _fld) \ ++ RTL8231_PIN_DESC(_num, 0, _reg, _fld, RTL8231_PIN_MODE_GPIO) ++#define RTL8231_LED_PIN_DESC(_num, _reg, _fld) \ ++ RTL8231_PIN_DESC(_num, RTL8231_PIN_FUNCTION_LED, _reg, _fld, RTL8231_PIN_MODE_GPIO) ++#define RTL8231_PWM_PIN_DESC(_num, _reg, _fld) \ ++ RTL8231_PIN_DESC(_num, RTL8231_PIN_FUNCTION_PWM, _reg, _fld, 0) ++ ++/* ++ * All pins have a GPIO/LED mux bit, but the bits for pins 35/36 are read-only. Use this bit ++ * for the GPIO-only pin instead of a placeholder, so the rest of the logic can stay generic. ++ */ ++static struct rtl8231_pin_desc rtl8231_pin_data[RTL8231_NUM_GPIOS] = { ++ RTL8231_LED_PIN_DESC(0, RTL8231_REG_PIN_MODE0, 0), ++ RTL8231_LED_PIN_DESC(1, RTL8231_REG_PIN_MODE0, 1), ++ RTL8231_LED_PIN_DESC(2, RTL8231_REG_PIN_MODE0, 2), ++ RTL8231_LED_PIN_DESC(3, RTL8231_REG_PIN_MODE0, 3), ++ RTL8231_LED_PIN_DESC(4, RTL8231_REG_PIN_MODE0, 4), ++ RTL8231_LED_PIN_DESC(5, RTL8231_REG_PIN_MODE0, 5), ++ RTL8231_LED_PIN_DESC(6, RTL8231_REG_PIN_MODE0, 6), ++ RTL8231_LED_PIN_DESC(7, RTL8231_REG_PIN_MODE0, 7), ++ RTL8231_LED_PIN_DESC(8, RTL8231_REG_PIN_MODE0, 8), ++ RTL8231_LED_PIN_DESC(9, RTL8231_REG_PIN_MODE0, 9), ++ RTL8231_LED_PIN_DESC(10, RTL8231_REG_PIN_MODE0, 10), ++ RTL8231_LED_PIN_DESC(11, RTL8231_REG_PIN_MODE0, 11), ++ RTL8231_LED_PIN_DESC(12, RTL8231_REG_PIN_MODE0, 12), ++ RTL8231_LED_PIN_DESC(13, RTL8231_REG_PIN_MODE0, 13), ++ RTL8231_LED_PIN_DESC(14, RTL8231_REG_PIN_MODE0, 14), ++ RTL8231_LED_PIN_DESC(15, RTL8231_REG_PIN_MODE0, 15), ++ RTL8231_LED_PIN_DESC(16, RTL8231_REG_PIN_MODE1, 0), ++ RTL8231_LED_PIN_DESC(17, RTL8231_REG_PIN_MODE1, 1), ++ RTL8231_LED_PIN_DESC(18, RTL8231_REG_PIN_MODE1, 2), ++ RTL8231_LED_PIN_DESC(19, RTL8231_REG_PIN_MODE1, 3), ++ RTL8231_LED_PIN_DESC(20, RTL8231_REG_PIN_MODE1, 4), ++ RTL8231_LED_PIN_DESC(21, RTL8231_REG_PIN_MODE1, 5), ++ RTL8231_LED_PIN_DESC(22, RTL8231_REG_PIN_MODE1, 6), ++ RTL8231_LED_PIN_DESC(23, RTL8231_REG_PIN_MODE1, 7), ++ RTL8231_LED_PIN_DESC(24, RTL8231_REG_PIN_MODE1, 8), ++ RTL8231_LED_PIN_DESC(25, RTL8231_REG_PIN_MODE1, 9), ++ RTL8231_LED_PIN_DESC(26, RTL8231_REG_PIN_MODE1, 10), ++ RTL8231_LED_PIN_DESC(27, RTL8231_REG_PIN_MODE1, 11), ++ RTL8231_LED_PIN_DESC(28, RTL8231_REG_PIN_MODE1, 12), ++ RTL8231_LED_PIN_DESC(29, RTL8231_REG_PIN_MODE1, 13), ++ RTL8231_LED_PIN_DESC(30, RTL8231_REG_PIN_MODE1, 14), ++ RTL8231_LED_PIN_DESC(31, RTL8231_REG_PIN_MODE1, 15), ++ RTL8231_LED_PIN_DESC(32, RTL8231_REG_PIN_HI_CFG, 0), ++ RTL8231_LED_PIN_DESC(33, RTL8231_REG_PIN_HI_CFG, 1), ++ RTL8231_LED_PIN_DESC(34, RTL8231_REG_PIN_HI_CFG, 2), ++ RTL8231_PWM_PIN_DESC(35, RTL8231_REG_FUNC1, 3), ++ RTL8231_GPIO_PIN_DESC(36, RTL8231_REG_PIN_HI_CFG, 4), ++}; ++ ++#define RTL8231_PIN(_num) \ ++ { \ ++ .number = _num, \ ++ .name = "gpio" #_num, \ ++ .drv_data = &rtl8231_pin_data[_num] \ ++ } ++ ++static const struct pinctrl_pin_desc rtl8231_pins[RTL8231_NUM_GPIOS] = { ++ RTL8231_PIN(0), ++ RTL8231_PIN(1), ++ RTL8231_PIN(2), ++ RTL8231_PIN(3), ++ RTL8231_PIN(4), ++ RTL8231_PIN(5), ++ RTL8231_PIN(6), ++ RTL8231_PIN(7), ++ RTL8231_PIN(8), ++ RTL8231_PIN(9), ++ RTL8231_PIN(10), ++ RTL8231_PIN(11), ++ RTL8231_PIN(12), ++ RTL8231_PIN(13), ++ RTL8231_PIN(14), ++ RTL8231_PIN(15), ++ RTL8231_PIN(16), ++ RTL8231_PIN(17), ++ RTL8231_PIN(18), ++ RTL8231_PIN(19), ++ RTL8231_PIN(20), ++ RTL8231_PIN(21), ++ RTL8231_PIN(22), ++ RTL8231_PIN(23), ++ RTL8231_PIN(24), ++ RTL8231_PIN(25), ++ RTL8231_PIN(26), ++ RTL8231_PIN(27), ++ RTL8231_PIN(28), ++ RTL8231_PIN(29), ++ RTL8231_PIN(30), ++ RTL8231_PIN(31), ++ RTL8231_PIN(32), ++ RTL8231_PIN(33), ++ RTL8231_PIN(34), ++ RTL8231_PIN(35), ++ RTL8231_PIN(36), ++}; ++ ++static int rtl8231_get_groups_count(struct pinctrl_dev *pctldev) ++{ ++ return ARRAY_SIZE(rtl8231_pins); ++} ++ ++static const char *rtl8231_get_group_name(struct pinctrl_dev *pctldev, unsigned int selector) ++{ ++ return rtl8231_pins[selector].name; ++} ++ ++static int rtl8231_get_group_pins(struct pinctrl_dev *pctldev, unsigned int selector, ++ const unsigned int **pins, unsigned int *num_pins) ++{ ++ if (selector >= ARRAY_SIZE(rtl8231_pins)) ++ return -EINVAL; ++ ++ *pins = &rtl8231_pins[selector].number; ++ *num_pins = 1; ++ ++ return 0; ++} ++ ++static const struct pinctrl_ops rtl8231_pinctrl_ops = { ++ .get_groups_count = rtl8231_get_groups_count, ++ .get_group_name = rtl8231_get_group_name, ++ .get_group_pins = rtl8231_get_group_pins, ++ .dt_node_to_map = pinconf_generic_dt_node_to_map_all, ++ .dt_free_map = pinconf_generic_dt_free_map, ++}; ++ ++static int rtl8231_set_mux(struct pinctrl_dev *pctldev, unsigned int func_selector, ++ unsigned int group_selector) ++{ ++ const struct function_desc *func = pinmux_generic_get_function(pctldev, func_selector); ++ const struct rtl8231_pin_desc *desc = rtl8231_pins[group_selector].drv_data; ++ const struct rtl8231_pin_ctrl *ctrl = pinctrl_dev_get_drvdata(pctldev); ++ unsigned int func_flag = (uintptr_t) func->data; ++ unsigned int function_mask; ++ unsigned int gpio_function; ++ ++ if (!(desc->functions & func_flag)) ++ return -EINVAL; ++ ++ function_mask = BIT(desc->offset); ++ gpio_function = desc->gpio_function_value << desc->offset; ++ ++ if (func_flag == RTL8231_PIN_FUNCTION_GPIO) ++ return regmap_update_bits(ctrl->map, desc->reg, function_mask, gpio_function); ++ else ++ return regmap_update_bits(ctrl->map, desc->reg, function_mask, ~gpio_function); ++} ++ ++static int rtl8231_gpio_request_enable(struct pinctrl_dev *pctldev, ++ struct pinctrl_gpio_range *range, unsigned int offset) ++{ ++ const struct rtl8231_pin_desc *desc = rtl8231_pins[offset].drv_data; ++ struct rtl8231_pin_ctrl *ctrl = pinctrl_dev_get_drvdata(pctldev); ++ unsigned int function_mask; ++ unsigned int gpio_function; ++ ++ function_mask = BIT(desc->offset); ++ gpio_function = desc->gpio_function_value << desc->offset; ++ ++ return regmap_update_bits(ctrl->map, desc->reg, function_mask, gpio_function); ++} ++ ++static const struct pinmux_ops rtl8231_pinmux_ops = { ++ .get_functions_count = pinmux_generic_get_function_count, ++ .get_function_name = pinmux_generic_get_function_name, ++ .get_function_groups = pinmux_generic_get_function_groups, ++ .set_mux = rtl8231_set_mux, ++ .gpio_request_enable = rtl8231_gpio_request_enable, ++ .strict = true, ++}; ++ ++static int rtl8231_pin_config_get(struct pinctrl_dev *pctldev, unsigned int offset, ++ unsigned long *config) ++{ ++ struct rtl8231_pin_ctrl *ctrl = pinctrl_dev_get_drvdata(pctldev); ++ unsigned int param = pinconf_to_config_param(*config); ++ unsigned int arg; ++ int err; ++ int v; ++ ++ switch (param) { ++ case PIN_CONFIG_INPUT_DEBOUNCE: ++ if (offset < RTL8231_DEBOUNCE_MIN_OFFSET) ++ return -EINVAL; ++ ++ err = regmap_read(ctrl->map, RTL8231_REG_FUNC1, &v); ++ if (err) ++ return err; ++ ++ v = FIELD_GET(RTL8231_FUNC1_DEBOUNCE_MASK, v); ++ if (v & BIT(offset - RTL8231_DEBOUNCE_MIN_OFFSET)) ++ arg = RTL8231_DEBOUNCE_USEC; ++ else ++ arg = 0; ++ break; ++ default: ++ return -ENOTSUPP; ++ } ++ ++ *config = pinconf_to_config_packed(param, arg); ++ ++ return 0; ++} ++ ++static int rtl8231_pin_config_set(struct pinctrl_dev *pctldev, unsigned int offset, ++ unsigned long *configs, unsigned int num_configs) ++{ ++ struct rtl8231_pin_ctrl *ctrl = pinctrl_dev_get_drvdata(pctldev); ++ unsigned int param, arg; ++ unsigned int pin_mask; ++ int err; ++ int i; ++ ++ for (i = 0; i < num_configs; i++) { ++ param = pinconf_to_config_param(configs[i]); ++ arg = pinconf_to_config_argument(configs[i]); ++ ++ switch (param) { ++ case PIN_CONFIG_INPUT_DEBOUNCE: ++ if (offset < RTL8231_DEBOUNCE_MIN_OFFSET) ++ return -EINVAL; ++ ++ pin_mask = FIELD_PREP(RTL8231_FUNC1_DEBOUNCE_MASK, ++ BIT(offset - RTL8231_DEBOUNCE_MIN_OFFSET)); ++ ++ switch (arg) { ++ case 0: ++ err = regmap_update_bits(ctrl->map, RTL8231_REG_FUNC1, ++ pin_mask, 0); ++ break; ++ case RTL8231_DEBOUNCE_USEC: ++ err = regmap_update_bits(ctrl->map, RTL8231_REG_FUNC1, ++ pin_mask, pin_mask); ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ break; ++ default: ++ return -ENOTSUPP; ++ } ++ } ++ ++ return err; ++} ++ ++static const struct pinconf_ops rtl8231_pinconf_ops = { ++ .is_generic = true, ++ .pin_config_get = rtl8231_pin_config_get, ++ .pin_config_set = rtl8231_pin_config_set, ++}; ++ ++static int rtl8231_pinctrl_init_functions(struct pinctrl_dev *pctl, struct rtl8231_pin_ctrl *ctrl) ++{ ++ const char *function_name; ++ const char **groups; ++ unsigned int f_idx; ++ unsigned int pin; ++ int num_groups; ++ int err; ++ ++ for (f_idx = 0; f_idx < ARRAY_SIZE(rtl8231_pin_function_names); f_idx++) { ++ function_name = rtl8231_pin_function_names[f_idx]; ++ ++ for (pin = 0, num_groups = 0; pin < ctrl->pctl_desc.npins; pin++) ++ if (rtl8231_pin_data[pin].functions & BIT(f_idx)) ++ num_groups++; ++ ++ groups = devm_kcalloc(pctl->dev, num_groups, sizeof(*groups), GFP_KERNEL); ++ if (!groups) ++ return -ENOMEM; ++ ++ for (pin = 0, num_groups = 0; pin < ctrl->pctl_desc.npins; pin++) ++ if (rtl8231_pin_data[pin].functions & BIT(f_idx)) ++ groups[num_groups++] = rtl8231_pins[pin].name; ++ ++ err = pinmux_generic_add_function(pctl, function_name, groups, num_groups, ++ (void *) BIT(f_idx)); ++ if (err < 0) ++ return err; ++ } ++ ++ return 0; ++} ++ ++struct pin_field_info { ++ const struct reg_field gpio_data; ++ const struct reg_field gpio_dir; ++ const struct reg_field mode; ++}; ++ ++static const struct pin_field_info pin_fields[] = { ++ { ++ .gpio_data = REG_FIELD(RTL8231_REG_GPIO_DATA0, 0, 15), ++ .gpio_dir = REG_FIELD(RTL8231_REG_GPIO_DIR0, 0, 15), ++ .mode = REG_FIELD(RTL8231_REG_PIN_MODE0, 0, 15), ++ }, ++ { ++ .gpio_data = REG_FIELD(RTL8231_REG_GPIO_DATA1, 0, 15), ++ .gpio_dir = REG_FIELD(RTL8231_REG_GPIO_DIR1, 0, 15), ++ .mode = REG_FIELD(RTL8231_REG_PIN_MODE1, 0, 15), ++ }, ++ { ++ .gpio_data = REG_FIELD(RTL8231_REG_GPIO_DATA2, 0, 4), ++ .gpio_dir = REG_FIELD(RTL8231_REG_PIN_HI_CFG, 5, 9), ++ .mode = REG_FIELD(RTL8231_REG_PIN_HI_CFG, 0, 4), ++ }, ++}; ++ ++static int rtl8231_configure_safe(struct device *dev, struct regmap *map) ++{ ++ struct regmap_field *field_data; ++ struct regmap_field *field_mode; ++ struct regmap_field *field_dir; ++ unsigned int is_output; ++ unsigned int is_gpio; ++ unsigned int data; ++ unsigned int mode; ++ unsigned int dir; ++ int err; ++ ++ for (unsigned int i = 0; i < ARRAY_SIZE(pin_fields); i++) { ++ field_data = devm_regmap_field_alloc(dev, map, pin_fields[i].gpio_data); ++ if (IS_ERR(field_data)) ++ return PTR_ERR(field_data); ++ ++ field_dir = devm_regmap_field_alloc(dev, map, pin_fields[i].gpio_dir); ++ if (IS_ERR(field_dir)) ++ return PTR_ERR(field_dir); ++ ++ field_mode = devm_regmap_field_alloc(dev, map, pin_fields[i].mode); ++ if (IS_ERR(field_mode)) ++ return PTR_ERR(field_mode); ++ ++ /* The register cache is invalid at start-up, so this should read from HW */ ++ err = regmap_field_read(field_data, &data); ++ if (err) ++ return err; ++ ++ err = regmap_field_read(field_dir, &dir); ++ if (err) ++ return err; ++ ++ err = regmap_field_read(field_mode, &mode); ++ if (err) ++ return err; ++ ++ /* Write back only the GPIO-out values to fix the cache */ ++ data &= ~dir; ++ regmap_field_write(field_data, data); ++ ++ /* ++ * Set every pin that is configured as gpio-output but muxed for the alternative ++ * (LED) function to gpio-in. That way the pin will be high impedance when it is ++ * muxed to GPIO, preventing unwanted glitches. ++ * The pin muxes are left as-is, so there are no signal changes. ++ */ ++ is_gpio = mode; ++ is_output = ~dir; ++ regmap_field_write(field_dir, dir | (~is_gpio & is_output)); ++ ++ devm_regmap_field_free(dev, field_data); ++ devm_regmap_field_free(dev, field_dir); ++ devm_regmap_field_free(dev, field_mode); ++ } ++ ++ return 0; ++} ++ ++static int rtl8231_pinctrl_init(struct device *dev, struct rtl8231_pin_ctrl *ctrl) ++{ ++ struct pinctrl_dev *pctldev; ++ int err; ++ ++ ctrl->pctl_desc.name = "rtl8231-pinctrl"; ++ ctrl->pctl_desc.owner = THIS_MODULE; ++ ctrl->pctl_desc.confops = &rtl8231_pinconf_ops; ++ ctrl->pctl_desc.pctlops = &rtl8231_pinctrl_ops; ++ ctrl->pctl_desc.pmxops = &rtl8231_pinmux_ops; ++ ctrl->pctl_desc.npins = ARRAY_SIZE(rtl8231_pins); ++ ctrl->pctl_desc.pins = rtl8231_pins; ++ ++ err = devm_pinctrl_register_and_init(dev->parent, &ctrl->pctl_desc, ctrl, &pctldev); ++ if (err) { ++ dev_err(dev, "failed to register pin controller\n"); ++ return err; ++ } ++ ++ err = rtl8231_pinctrl_init_functions(pctldev, ctrl); ++ if (err) ++ return err; ++ ++ err = pinctrl_enable(pctldev); ++ if (err) ++ dev_err(dev, "failed to enable pin controller\n"); ++ ++ return err; ++} ++ ++/* ++ * GPIO controller functionality ++ */ ++static int rtl8231_gpio_reg_mask_xlate(struct gpio_regmap *gpio, unsigned int base, ++ unsigned int offset, unsigned int *reg, unsigned int *mask) ++{ ++ unsigned int pin_mask = BIT(offset % RTL8231_BITS_VAL); ++ ++ if (base == RTL8231_REG_GPIO_DATA0 || offset < 32) { ++ *reg = base + offset / RTL8231_BITS_VAL; ++ *mask = pin_mask; ++ } else if (base == RTL8231_REG_GPIO_DIR0) { ++ *reg = RTL8231_REG_PIN_HI_CFG; ++ *mask = FIELD_PREP(RTL8231_PIN_HI_CFG_DIR_MASK, pin_mask); ++ } else { ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++static int rtl8231_pinctrl_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct rtl8231_pin_ctrl *ctrl; ++ struct gpio_regmap_config gpio_cfg = {}; ++ int err; ++ ++ ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL); ++ if (!ctrl) ++ return -ENOMEM; ++ ++ ctrl->map = dev_get_regmap(dev->parent, NULL); ++ if (!ctrl->map) ++ return -ENODEV; ++ ++ err = rtl8231_configure_safe(dev, ctrl->map); ++ if (err) ++ return err; ++ ++ err = rtl8231_pinctrl_init(dev, ctrl); ++ if (err) ++ return err; ++ ++ gpio_cfg.regmap = ctrl->map; ++ gpio_cfg.parent = dev->parent; ++ gpio_cfg.ngpio = RTL8231_NUM_GPIOS; ++ gpio_cfg.ngpio_per_reg = RTL8231_BITS_VAL; ++ ++ gpio_cfg.reg_dat_base = GPIO_REGMAP_ADDR(RTL8231_REG_GPIO_DATA0); ++ gpio_cfg.reg_set_base = GPIO_REGMAP_ADDR(RTL8231_REG_GPIO_DATA0); ++ gpio_cfg.reg_dir_in_base = GPIO_REGMAP_ADDR(RTL8231_REG_GPIO_DIR0); ++ ++ gpio_cfg.reg_mask_xlate = rtl8231_gpio_reg_mask_xlate; ++ ++ return PTR_ERR_OR_ZERO(devm_gpio_regmap_register(dev, &gpio_cfg)); ++} ++ ++static struct platform_driver rtl8231_pinctrl_driver = { ++ .driver = { ++ .name = "rtl8231-pinctrl", ++ }, ++ .probe = rtl8231_pinctrl_probe, ++}; ++module_platform_driver(rtl8231_pinctrl_driver); ++ ++MODULE_AUTHOR("Sander Vanheule "); ++MODULE_DESCRIPTION("Realtek RTL8231 pin control and GPIO support"); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/realtek/patches-6.6/804-leds-Add-support-for-RTL8231-LED-scan-matrix.patch b/target/linux/realtek/patches-6.6/804-leds-Add-support-for-RTL8231-LED-scan-matrix.patch new file mode 100644 index 00000000000000..396e544d73c378 --- /dev/null +++ b/target/linux/realtek/patches-6.6/804-leds-Add-support-for-RTL8231-LED-scan-matrix.patch @@ -0,0 +1,338 @@ +From 6b797a97c007e46d6081fc6f4b41ce8407078605 Mon Sep 17 00:00:00 2001 +From: Sander Vanheule +Date: Mon, 10 May 2021 22:16:11 +0200 +Subject: [PATCH] leds: Add support for RTL8231 LED scan matrix + +Both single and bi-color scanning modes are supported. The driver will +verify that the addresses are valid for the current mode, before +registering the LEDs. LEDs can be turned on, off, or toggled at one of +six predefined rates from 40ms to 1280ms. + +Implements a platform device for use as a child device with RTL8231 MFD, +and uses the parent regmap to access the required registers. + +Signed-off-by: Sander Vanheule +--- + drivers/leds/Kconfig | 10 ++ + drivers/leds/Makefile | 1 + + drivers/leds/leds-rtl8231.c | 291 ++++++++++++++++++++++++++++++++++++ + 3 files changed, 302 insertions(+) + create mode 100644 drivers/leds/leds-rtl8231.c + +--- a/drivers/leds/Kconfig ++++ b/drivers/leds/Kconfig +@@ -586,6 +586,16 @@ config LEDS_REGULATOR + help + This option enables support for regulator driven LEDs. + ++config LEDS_RTL8231 ++ tristate "RTL8231 LED matrix support" ++ depends on LEDS_CLASS ++ depends on MFD_RTL8231 ++ default MFD_RTL8231 ++ help ++ This option enables support for using the LED scanning matrix output ++ of the RTL8231 GPIO and LED expander chip. ++ When built as a module, this module will be named leds-rtl8231. ++ + config LEDS_BD2606MVV + tristate "LED driver for BD2606MVV" + depends on LEDS_CLASS +--- a/drivers/leds/Makefile ++++ b/drivers/leds/Makefile +@@ -77,6 +77,7 @@ obj-$(CONFIG_LEDS_PM8058) += leds-pm805 + obj-$(CONFIG_LEDS_POWERNV) += leds-powernv.o + obj-$(CONFIG_LEDS_PWM) += leds-pwm.o + obj-$(CONFIG_LEDS_REGULATOR) += leds-regulator.o ++obj-$(CONFIG_LEDS_RTL8231) += leds-rtl8231.o + obj-$(CONFIG_LEDS_SC27XX_BLTC) += leds-sc27xx-bltc.o + obj-$(CONFIG_LEDS_SUNFIRE) += leds-sunfire.o + obj-$(CONFIG_LEDS_SYSCON) += leds-syscon.o +--- /dev/null ++++ b/drivers/leds/leds-rtl8231.c +@@ -0,0 +1,285 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++/** ++ * struct led_toggle_rate - description of an LED blinking mode ++ * @interval_ms: LED toggle rate in milliseconds ++ * @mode: Register field value used to activate this mode ++ * ++ * For LED hardware accelerated blinking, with equal on and off delay. ++ * Both delays are given by @interval, so the interval at which the LED blinks ++ * (i.e. turn on and off once) is double this value. ++ */ ++struct led_toggle_rate { ++ u16 interval_ms; ++ u8 mode; ++}; ++ ++/** ++ * struct led_modes - description of all LED modes ++ * @toggle_rates: Array of led_toggle_rate values, sorted by ascending interval ++ * @num_toggle_rates: Number of elements in @led_toggle_rate ++ * @off: Register field value to turn LED off ++ * @on: Register field value to turn LED on ++ */ ++struct led_modes { ++ const struct led_toggle_rate *toggle_rates; ++ unsigned int num_toggle_rates; ++ u8 off; ++ u8 on; ++}; ++ ++struct rtl8231_led { ++ struct led_classdev led; ++ const struct led_modes *modes; ++ struct regmap_field *reg_field; ++}; ++#define to_rtl8231_led(_cdev) container_of(_cdev, struct rtl8231_led, led) ++ ++#define RTL8231_NUM_LEDS 3 ++#define RTL8231_LED_PER_REG 5 ++#define RTL8231_BITS_PER_LED 3 ++ ++static const unsigned int rtl8231_led_port_counts_single[RTL8231_NUM_LEDS] = {32, 32, 24}; ++static const unsigned int rtl8231_led_port_counts_bicolor[RTL8231_NUM_LEDS] = {24, 24, 24}; ++ ++static const unsigned int rtl8231_led_base[RTL8231_NUM_LEDS] = { ++ RTL8231_REG_LED0_BASE, ++ RTL8231_REG_LED1_BASE, ++ RTL8231_REG_LED2_BASE, ++}; ++ ++#define RTL8231_DEFAULT_TOGGLE_INTERVAL_MS 500 ++ ++static const struct led_toggle_rate rtl8231_toggle_rates[] = { ++ { 40, 1}, ++ { 80, 2}, ++ { 160, 3}, ++ { 320, 4}, ++ { 640, 5}, ++ {1280, 6}, ++}; ++ ++static const struct led_modes rtl8231_led_modes = { ++ .off = 0, ++ .on = 7, ++ .num_toggle_rates = ARRAY_SIZE(rtl8231_toggle_rates), ++ .toggle_rates = rtl8231_toggle_rates, ++}; ++ ++static void rtl8231_led_brightness_set(struct led_classdev *led_cdev, ++ enum led_brightness brightness) ++{ ++ struct rtl8231_led *pled = to_rtl8231_led(led_cdev); ++ ++ if (brightness) ++ regmap_field_write(pled->reg_field, pled->modes->on); ++ else ++ regmap_field_write(pled->reg_field, pled->modes->off); ++} ++ ++static enum led_brightness rtl8231_led_brightness_get(struct led_classdev *led_cdev) ++{ ++ struct rtl8231_led *pled = to_rtl8231_led(led_cdev); ++ u32 current_mode = pled->modes->off; ++ ++ regmap_field_read(pled->reg_field, ¤t_mode); ++ ++ if (current_mode == pled->modes->off) ++ return LED_OFF; ++ else ++ return LED_ON; ++} ++ ++static unsigned int rtl8231_led_current_interval(struct rtl8231_led *pled) ++{ ++ unsigned int mode; ++ unsigned int i; ++ ++ if (regmap_field_read(pled->reg_field, &mode)) ++ return 0; ++ ++ for (i = 0; i < pled->modes->num_toggle_rates; i++) ++ if (mode == pled->modes->toggle_rates[i].mode) ++ return pled->modes->toggle_rates[i].interval_ms; ++ ++ return 0; ++} ++ ++static int rtl8231_led_blink_set(struct led_classdev *led_cdev, unsigned long *delay_on, ++ unsigned long *delay_off) ++{ ++ struct rtl8231_led *pled = to_rtl8231_led(led_cdev); ++ const struct led_toggle_rate *rates = pled->modes->toggle_rates; ++ unsigned int num_rates = pled->modes->num_toggle_rates; ++ unsigned int interval_ms; ++ unsigned int i; ++ int err; ++ ++ if (*delay_on == 0 && *delay_off == 0) { ++ interval_ms = RTL8231_DEFAULT_TOGGLE_INTERVAL_MS; ++ } else { ++ /* ++ * If the current mode is blinking, choose the delay that (likely) changed. ++ * Otherwise, choose the interval that would have the same total delay. ++ */ ++ interval_ms = rtl8231_led_current_interval(pled); ++ if (interval_ms > 0 && interval_ms == *delay_off) ++ interval_ms = *delay_on; ++ else if (interval_ms > 0 && interval_ms == *delay_on) ++ interval_ms = *delay_off; ++ else ++ interval_ms = (*delay_on + *delay_off) / 2; ++ } ++ ++ /* Find clamped toggle interval */ ++ for (i = 0; i < (num_rates - 1); i++) ++ if (interval_ms > rates[i].interval_ms) ++ break; ++ ++ interval_ms = rates[i].interval_ms; ++ ++ err = regmap_field_write(pled->reg_field, rates[i].mode); ++ if (err) ++ return err; ++ ++ *delay_on = interval_ms; ++ *delay_off = interval_ms; ++ ++ return 0; ++} ++ ++static int rtl8231_led_read_address(struct fwnode_handle *fwnode, unsigned int *addr_port, ++ unsigned int *addr_led) ++{ ++ u32 addr[2]; ++ int err; ++ ++ err = fwnode_property_count_u32(fwnode, "reg"); ++ if (err < 0) ++ return err; ++ if (err != ARRAY_SIZE(addr)) ++ return -EINVAL; ++ ++ err = fwnode_property_read_u32_array(fwnode, "reg", addr, ARRAY_SIZE(addr)); ++ if (err) ++ return err; ++ ++ *addr_port = addr[0]; ++ *addr_led = addr[1]; ++ ++ return 0; ++} ++ ++static const struct regmap_field *rtl8231_led_get_field(struct device *dev, struct regmap *map, ++ unsigned int port_index, unsigned int led_index) ++{ ++ unsigned int offset = port_index / RTL8231_LED_PER_REG; ++ unsigned int shift = (port_index % RTL8231_LED_PER_REG) * RTL8231_BITS_PER_LED; ++ const struct reg_field field = REG_FIELD(rtl8231_led_base[led_index] + offset, shift, ++ shift + RTL8231_BITS_PER_LED - 1); ++ ++ return devm_regmap_field_alloc(dev, map, field); ++} ++ ++static int rtl8231_led_probe_single(struct device *dev, struct regmap *map, ++ const unsigned int *port_counts, struct fwnode_handle *fwnode) ++{ ++ struct led_init_data init_data = {}; ++ struct rtl8231_led *pled; ++ unsigned int port_index; ++ unsigned int led_index; ++ int err; ++ ++ pled = devm_kzalloc(dev, sizeof(*pled), GFP_KERNEL); ++ if (!pled) ++ return -ENOMEM; ++ ++ err = rtl8231_led_read_address(fwnode, &port_index, &led_index); ++ if (err) { ++ dev_err(dev, "LED address invalid"); ++ return err; ++ } ++ ++ if (led_index >= RTL8231_NUM_LEDS || port_index >= port_counts[led_index]) { ++ dev_err(dev, "LED address (%d.%d) invalid", port_index, led_index); ++ return -EINVAL; ++ } ++ ++ pled->reg_field = rtl8231_led_get_field(dev, map, port_index, led_index); ++ if (IS_ERR(pled->reg_field)) ++ return PTR_ERR(pled->reg_field); ++ ++ pled->modes = &rtl8231_led_modes; ++ ++ pled->led.max_brightness = 1; ++ pled->led.brightness_get = rtl8231_led_brightness_get; ++ pled->led.brightness_set = rtl8231_led_brightness_set; ++ pled->led.blink_set = rtl8231_led_blink_set; ++ ++ init_data.fwnode = fwnode; ++ ++ return devm_led_classdev_register_ext(dev, &pled->led, &init_data); ++} ++ ++static int rtl8231_led_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ const unsigned int *port_counts; ++ struct fwnode_handle *child; ++ struct regmap *map; ++ int err; ++ ++ map = dev_get_regmap(dev->parent, NULL); ++ if (!map) ++ return -ENODEV; ++ ++ if (device_property_match_string(dev, "realtek,led-scan-mode", "single-color") >= 0) { ++ port_counts = rtl8231_led_port_counts_single; ++ regmap_update_bits(map, RTL8231_REG_FUNC0, ++ RTL8231_FUNC0_SCAN_MODE, RTL8231_FUNC0_SCAN_SINGLE); ++ } else if (device_property_match_string(dev, "realtek,led-scan-mode", "bi-color") >= 0) { ++ port_counts = rtl8231_led_port_counts_bicolor; ++ regmap_update_bits(map, RTL8231_REG_FUNC0, ++ RTL8231_FUNC0_SCAN_MODE, RTL8231_FUNC0_SCAN_BICOLOR); ++ } else { ++ dev_err(dev, "scan mode missing or invalid"); ++ return -EINVAL; ++ } ++ ++ fwnode_for_each_available_child_node(dev->fwnode, child) { ++ err = rtl8231_led_probe_single(dev, map, port_counts, child); ++ if (err) ++ dev_warn(dev, "failed to register LED %pfwP", child); ++ } ++ ++ return 0; ++} ++ ++static const struct of_device_id of_rtl8231_led_match[] = { ++ { .compatible = "realtek,rtl8231-leds" }, ++ {} ++}; ++MODULE_DEVICE_TABLE(of, of_rtl8231_led_match); ++ ++static struct platform_driver rtl8231_led_driver = { ++ .driver = { ++ .name = "rtl8231-leds", ++ .of_match_table = of_rtl8231_led_match, ++ }, ++ .probe = rtl8231_led_probe, ++}; ++module_platform_driver(rtl8231_led_driver); ++ ++MODULE_AUTHOR("Sander Vanheule "); ++MODULE_DESCRIPTION("Realtek RTL8231 LED support"); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/realtek/rtl838x/config-6.6 b/target/linux/realtek/rtl838x/config-6.6 index 020477b7bc4791..d7d701d40deeab 100644 --- a/target/linux/realtek/rtl838x/config-6.6 +++ b/target/linux/realtek/rtl838x/config-6.6 @@ -125,6 +125,7 @@ CONFIG_MDIO_I2C=y CONFIG_MDIO_REALTEK_OTTO_AUX=y CONFIG_MDIO_SMBUS=y CONFIG_MEMFD_CREATE=y +# CONFIG_MFD_RTL8231 is not set CONFIG_MFD_SYSCON=y CONFIG_MIGRATION=y CONFIG_MIPS=y diff --git a/target/linux/realtek/rtl839x/config-6.6 b/target/linux/realtek/rtl839x/config-6.6 index 4612a73e4ad9ec..d0b8f59dd33ebe 100644 --- a/target/linux/realtek/rtl839x/config-6.6 +++ b/target/linux/realtek/rtl839x/config-6.6 @@ -124,6 +124,7 @@ CONFIG_MDIO_I2C=y # CONFIG_MDIO_REALTEK_OTTO_AUX is not set CONFIG_MDIO_SMBUS=y CONFIG_MEMFD_CREATE=y +# CONFIG_MFD_RTL8231 is not set CONFIG_MFD_SYSCON=y CONFIG_MIGRATION=y CONFIG_MIPS=y diff --git a/target/linux/realtek/rtl930x/config-6.6 b/target/linux/realtek/rtl930x/config-6.6 index 694f10019ebbe2..4f4129ed739c9b 100644 --- a/target/linux/realtek/rtl930x/config-6.6 +++ b/target/linux/realtek/rtl930x/config-6.6 @@ -106,6 +106,7 @@ CONFIG_MDIO_I2C=y # CONFIG_MDIO_REALTEK_OTTO_AUX is not set CONFIG_MDIO_SMBUS=y CONFIG_MEMFD_CREATE=y +# CONFIG_MFD_RTL8231 is not set CONFIG_MFD_SYSCON=y CONFIG_MIGRATION=y CONFIG_MIPS=y diff --git a/target/linux/realtek/rtl931x/config-6.6 b/target/linux/realtek/rtl931x/config-6.6 index 9ab93d4fe760e0..d2d052f2d14fe8 100644 --- a/target/linux/realtek/rtl931x/config-6.6 +++ b/target/linux/realtek/rtl931x/config-6.6 @@ -115,6 +115,7 @@ CONFIG_MDIO_I2C=y # CONFIG_MDIO_REALTEK_OTTO_AUX is not set CONFIG_MDIO_SMBUS=y CONFIG_MEMFD_CREATE=y +# CONFIG_MFD_RTL8231 is not set CONFIG_MFD_SYSCON=y CONFIG_MIGRATION=y CONFIG_MIPS=y From 60cae0e08fd2b4809b8189b171397ae6b6360993 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Thu, 26 Dec 2024 22:26:33 +0100 Subject: [PATCH 488/877] realtek: rtl838x: Switch GS1900 rtl8231 driver Update the devicetree files to switch the GS1900 devices over to the new pinctrl and GPIO driver. Enable the drivers to ensure the nodes can be used. This may fix issues caused by bad RMW behaviour on the GPIO data lines, or glitches due to setting the pin direction before the pin level. Although the driver supports retaining GPIO state after a warm boot, some bootloaders appear to apply a default configuration on boot, which may cause an interrupt in PoE-PSE support. Signed-off-by: Sander Vanheule (cherry picked from commit 5141e2d8617efa774b64f9ebc6d97cdc85487dc8) --- .../realtek/dts/rtl8380_zyxel_gs1900.dtsi | 25 ++++++++++++++++--- target/linux/realtek/rtl838x/config-6.6 | 7 +++++- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi b/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi index 3889fe8859a7e3..927b9527a95a00 100644 --- a/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi +++ b/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi @@ -40,18 +40,35 @@ gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; }; }; +}; + +&mdio_aux { + status = "okay"; + + // Reset GPIO is <&gpio0 1 GPIO_ACTIVE_LOW> + // Don't specify the reset info so the mdio subsystem doesn't reset the bus + //reset-gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + //reset-delay-us = <1000>; + //reset-post-delay-us = <10000>; + + gpio1: expander@0 { + compatible = "realtek,rtl8231"; + reg = <0x0>; - gpio1: rtl8231-gpio { - compatible = "realtek,rtl8231-gpio"; - #gpio-cells = <2>; gpio-controller; - indirect-access-bus-id = <0>; + #gpio-cells = <2>; + gpio-ranges = <&gpio1 0 0 37>; poe_enable { gpio-hog; gpios = <13 GPIO_ACTIVE_HIGH>; output-high; }; + + led-controller { + compatible = "realtek,rtl8231-leds"; + status = "disabled"; + }; }; }; diff --git a/target/linux/realtek/rtl838x/config-6.6 b/target/linux/realtek/rtl838x/config-6.6 index d7d701d40deeab..4cc66bbdda5b94 100644 --- a/target/linux/realtek/rtl838x/config-6.6 +++ b/target/linux/realtek/rtl838x/config-6.6 @@ -87,6 +87,7 @@ CONFIG_GPIO_GENERIC=y CONFIG_GPIO_PCA953X=y CONFIG_GPIO_PCA953X_IRQ=y CONFIG_GPIO_REALTEK_OTTO=y +CONFIG_GPIO_REGMAP=y CONFIG_GPIO_RTL8231=y CONFIG_GPIO_WATCHDOG=y # CONFIG_GPIO_WATCHDOG_ARCH_INITCALL is not set @@ -114,6 +115,7 @@ CONFIG_IRQ_MIPS_CPU=y CONFIG_IRQ_WORK=y CONFIG_JFFS2_ZLIB=y CONFIG_LEDS_GPIO=y +# CONFIG_LEDS_RTL8231 is not set CONFIG_LIBFDT=y CONFIG_LOCK_DEBUGGING_SUPPORT=y CONFIG_MACH_REALTEK_RTL=y @@ -125,7 +127,8 @@ CONFIG_MDIO_I2C=y CONFIG_MDIO_REALTEK_OTTO_AUX=y CONFIG_MDIO_SMBUS=y CONFIG_MEMFD_CREATE=y -# CONFIG_MFD_RTL8231 is not set +CONFIG_MFD_CORE=y +CONFIG_MFD_RTL8231=y CONFIG_MFD_SYSCON=y CONFIG_MIGRATION=y CONFIG_MIPS=y @@ -179,6 +182,7 @@ CONFIG_PGTABLE_LEVELS=2 CONFIG_PHYLIB=y CONFIG_PHYLINK=y CONFIG_PINCTRL=y +CONFIG_PINCTRL_RTL8231=y CONFIG_PM_OPP=y CONFIG_POWER_RESET=y CONFIG_POWER_RESET_GPIO_RESTART=y @@ -191,6 +195,7 @@ CONFIG_REALTEK_PHY=y CONFIG_REALTEK_SOC_PHY=y CONFIG_REGMAP=y CONFIG_REGMAP_I2C=y +CONFIG_REGMAP_MDIO=y CONFIG_REGMAP_MMIO=y CONFIG_RESET_CONTROLLER=y CONFIG_RTL838X=y From d6f9466196f4a4ad6cb4707e8b3ce18a6e2d1174 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Tue, 7 Jan 2025 14:55:24 +0100 Subject: [PATCH 489/877] realtek: switch RTL8231 driver for HPE 1920-8G Update the base DTS file for the 8 port HPE 1920 devices (JG920A, JG921A, JG922A), causing the new RTL8231 MFD driver to be loaded at start-up. Signed-off-by: Sander Vanheule (cherry picked from commit e5d1a501cbd0fdda47d9169e9f669c7fb4813f2a) --- .../realtek/dts/rtl8380_hpe_1920-8g.dtsi | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/target/linux/realtek/dts/rtl8380_hpe_1920-8g.dtsi b/target/linux/realtek/dts/rtl8380_hpe_1920-8g.dtsi index 262dd83d21c6c5..ddd46c4cf649ad 100644 --- a/target/linux/realtek/dts/rtl8380_hpe_1920-8g.dtsi +++ b/target/linux/realtek/dts/rtl8380_hpe_1920-8g.dtsi @@ -4,13 +4,6 @@ #include "rtl83xx_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)>; @@ -46,6 +39,24 @@ }; }; +&mdio_aux { + status = "okay"; + + gpio1: expander@0 { + compatible = "realtek,rtl8231"; + reg = <0>; + + gpio-controller; + #gpio-cells = <2>; + gpio-ranges = <&gpio1 0 0 37>; + + led-controller { + compatible = "realtek,rtl8231-leds"; + status = "disabled"; + }; + }; +}; + ðernet0 { mdio: mdio-bus { compatible = "realtek,rtl838x-mdio"; From 5b96d45474fe15397a4bc26f9013c433a1e59bd4 Mon Sep 17 00:00:00 2001 From: Evan Jobling Date: Tue, 14 Jan 2025 12:13:21 +0000 Subject: [PATCH 490/877] realtek: HPE 1920 8G PoE+ 180W move fans to hwmon The GPIO numbering has changed and is not stable. As a result fan control via gpio_switch is broken, resulting in errors: "export_store: invalid GPIO 456" Move to using hwmon and gpio-fan. This is by adding gpio_fan_array to DTS and kmod-hwmon-gpiofan to DEVICE_PACKAGES. In combination with the new rtl8231 gpio driver the default fan behaviour will be maximum fan speed. Bump compat value to 1.1 due to existing config in /etc/config/system via gpio_switch. Also notify in device compat that fan is now going to be at bootloader setting (maximum in this case) by default unless turned down. Signed-off-by: Evan Jobling Link: https://github.com/openwrt/openwrt/pull/17605 Signed-off-by: Sander Vanheule (cherry picked from commit f64541db020ef5689186609e8b7b7a3bb9755160) --- .../realtek/base-files/etc/board.d/03_gpio_switches | 1 - .../realtek/base-files/etc/board.d/05_compat-version | 3 +++ .../realtek/dts/rtl8380_hpe_1920-8g-poe-180w.dts | 11 +++++++++++ target/linux/realtek/image/common.mk | 8 ++++++++ target/linux/realtek/image/rtl838x.mk | 3 ++- 5 files changed, 24 insertions(+), 2 deletions(-) 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 c869153e4ca407..c178bd43308fc1 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,6 @@ board_config_update board=$(board_name) case "$board" in -hpe,1920-8g-poe-180w|\ hpe,1920-24g-poe-180w|\ hpe,1920-24g-poe-370w) ucidef_add_gpio_switch "fan_ctrl" "Fan control" "456" "0" diff --git a/target/linux/realtek/base-files/etc/board.d/05_compat-version b/target/linux/realtek/base-files/etc/board.d/05_compat-version index 5c4ecb9aae363d..687cbb32a5ae3d 100644 --- a/target/linux/realtek/base-files/etc/board.d/05_compat-version +++ b/target/linux/realtek/base-files/etc/board.d/05_compat-version @@ -8,6 +8,9 @@ board_config_update case "$(board_name)" in + hpe,1920-8g-poe-180w) + ucidef_set_compat_version "1.1" + ;; zyxel,gs1900-8 | \ zyxel,gs1900-8hp-v1 | \ zyxel,gs1900-8hp-v2 | \ diff --git a/target/linux/realtek/dts/rtl8380_hpe_1920-8g-poe-180w.dts b/target/linux/realtek/dts/rtl8380_hpe_1920-8g-poe-180w.dts index 6398e6d034dee3..f15498354e9ae0 100644 --- a/target/linux/realtek/dts/rtl8380_hpe_1920-8g-poe-180w.dts +++ b/target/linux/realtek/dts/rtl8380_hpe_1920-8g-poe-180w.dts @@ -5,6 +5,17 @@ / { compatible = "hpe,1920-8g-poe-180w", "realtek,rtl838x-soc"; model = "HPE 1920-8G-PoE+ 180W (JG922A)"; + + gpio_fan_array { + compatible = "gpio-fan"; + + gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>; + gpio-fan,speed-map = <5000 0>, + <8200 1>; + + alarm-gpios = <&gpio1 6 GPIO_ACTIVE_LOW>; + #cooling-cells = <2>; + }; }; &uart1 { diff --git a/target/linux/realtek/image/common.mk b/target/linux/realtek/image/common.mk index d9647dbc07288e..e600b2347d71fc 100644 --- a/target/linux/realtek/image/common.mk +++ b/target/linux/realtek/image/common.mk @@ -56,6 +56,14 @@ define Device/hpe_1920 append-metadata endef +define Device/hwmon-fan-migration + DEVICE_COMPAT_VERSION := 1.1 + DEVICE_COMPAT_MESSAGE := Fan control switched to hwmon. Your fans will retain \ + bootloader speed unless another control scheme is in place. \ + Config cannot be kept due to conflict in gpio_switch config 'fan_ctrl' under \ + /etc/config/system. +endef + define Device/zyxel_gs1900 DEVICE_COMPAT_VERSION := 2.0 DEVICE_COMPAT_MESSAGE := Dual firmware paritition merged due to size constraints. \ diff --git a/target/linux/realtek/image/rtl838x.mk b/target/linux/realtek/image/rtl838x.mk index 9ade8d536b7dd9..5f1ed3965b915c 100644 --- a/target/linux/realtek/image/rtl838x.mk +++ b/target/linux/realtek/image/rtl838x.mk @@ -120,9 +120,10 @@ TARGET_DEVICES += hpe_1920-8g-poe-65w define Device/hpe_1920-8g-poe-180w $(Device/hpe_1920) + $(Device/hwmon-fan-migration) SOC := rtl8380 DEVICE_MODEL := 1920-8G-PoE+ 180W (JG922A) - DEVICE_PACKAGES += realtek-poe + DEVICE_PACKAGES += realtek-poe kmod-hwmon-gpiofan H3C_DEVICE_ID := 0x00010025 SUPPORTED_DEVICES += hpe,1920-8g-poe endef From 88d7d0d9cc15e76318dc13415c8dce400eec9e3d Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Tue, 7 Jan 2025 14:59:20 +0100 Subject: [PATCH 491/877] realtek: switch RTL8231 driver for HPE 1920-16/24G Update the base DTS file for the 16 and 24 port HPE 1920 devices (JG923A, JG924A, JG925A, JG926A), causing the new RTL8231 MFD driver to be loaded at start-up. Signed-off-by: Sander Vanheule (cherry picked from commit 96850585e52dfff2c25d8b20b0b5cd192981ed4d) --- .../linux/realtek/dts/rtl8382_hpe_1920.dtsi | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/target/linux/realtek/dts/rtl8382_hpe_1920.dtsi b/target/linux/realtek/dts/rtl8382_hpe_1920.dtsi index af168067d4d935..20d8693a3be4d4 100644 --- a/target/linux/realtek/dts/rtl8382_hpe_1920.dtsi +++ b/target/linux/realtek/dts/rtl8382_hpe_1920.dtsi @@ -4,12 +4,6 @@ #include "rtl83xx_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"; @@ -84,6 +78,24 @@ }; }; +&mdio_aux { + status = "okay"; + + gpio1: expander@0 { + compatible = "realtek,rtl8231"; + reg = <0>; + + gpio-controller; + #gpio-cells = <2>; + gpio-ranges = <&gpio1 0 0 37>; + + led-controller { + compatible = "realtek,rtl8231-leds"; + status = "disabled"; + }; + }; +}; + ðernet0 { mdio: mdio-bus { compatible = "realtek,rtl838x-mdio"; From b98d99261a423b8c7bce3189162ddc9104f5d043 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Wed, 15 Jan 2025 20:12:02 +0100 Subject: [PATCH 492/877] realtek: HPE 1920 24G PoE+ 180W/370W move fans to hwmon Apply the equivalent of commit f64541db020e ("realtek: HPE 1920 8G PoE+ 180W move fans to hwmon") to the 24-ports variants of the HPE 1920 PoE+ switches, with model numbers JG925A and JG926A. Copy from the original commit message: Move to using hwmon and gpio-fan. This is by adding gpio_fan_array to DTS and kmod-hwmon-gpiofan to DEVICE_PACKAGES. In combination with the new rtl8231 gpio driver the default fan behaviour will be maximum fan speed. Bump compat value to 1.1 due to existing config in /etc/config/system via gpio_switch. Also notify in device compat that fan is now going to be at bootloader setting (maximum in this case) by default unless turned down. As the init script 03_gpio_switches does not perform any action after removing these devices from it, the file can be dropped. Link: https://github.com/openwrt/openwrt/pull/17598 Signed-off-by: Fabian Groffen Signed-off-by: Sander Vanheule (cherry picked from commit 0a7c8ed9d94930ba062c71df79f63c06eeab4543) --- .../base-files/etc/board.d/03_gpio_switches | 17 ----------------- .../base-files/etc/board.d/05_compat-version | 4 +++- .../dts/rtl8382_hpe_1920-24g-poe-180w.dts | 11 +++++++++++ .../dts/rtl8382_hpe_1920-24g-poe-370w.dts | 11 +++++++++++ target/linux/realtek/image/rtl838x.mk | 6 ++++-- 5 files changed, 29 insertions(+), 20 deletions(-) delete mode 100644 target/linux/realtek/base-files/etc/board.d/03_gpio_switches 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 deleted file mode 100644 index c178bd43308fc1..00000000000000 --- a/target/linux/realtek/base-files/etc/board.d/03_gpio_switches +++ /dev/null @@ -1,17 +0,0 @@ - -. /lib/functions/uci-defaults.sh - -board_config_update - -board=$(board_name) - -case "$board" in -hpe,1920-24g-poe-180w|\ -hpe,1920-24g-poe-370w) - ucidef_add_gpio_switch "fan_ctrl" "Fan control" "456" "0" - ;; -esac - -board_config_flush - -exit 0 diff --git a/target/linux/realtek/base-files/etc/board.d/05_compat-version b/target/linux/realtek/base-files/etc/board.d/05_compat-version index 687cbb32a5ae3d..9c27314b241e4e 100644 --- a/target/linux/realtek/base-files/etc/board.d/05_compat-version +++ b/target/linux/realtek/base-files/etc/board.d/05_compat-version @@ -8,7 +8,9 @@ board_config_update case "$(board_name)" in - hpe,1920-8g-poe-180w) + hpe,1920-8g-poe-180w | \ + hpe,1920-24g-poe-180w | \ + hpe,1920-24g-poe-370w) ucidef_set_compat_version "1.1" ;; zyxel,gs1900-8 | \ diff --git a/target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-180w.dts b/target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-180w.dts index 4783cec15ca18e..69e647c59a98e2 100644 --- a/target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-180w.dts +++ b/target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-180w.dts @@ -5,6 +5,17 @@ / { compatible = "hpe,1920-24g-poe-180w", "realtek,rtl838x-soc"; model = "HPE 1920-24G-PoE+ 180W (JG925A)"; + + gpio_fan_array { + compatible = "gpio-fan"; + + gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>; + gpio-fan,speed-map = <5000 0>, + <8200 1>; + + alarm-gpios = <&gpio1 6 GPIO_ACTIVE_LOW>; + #cooling-cells = <2>; + }; }; &uart1 { diff --git a/target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-370w.dts b/target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-370w.dts index ccdcf71d1bddb1..532f23ab2f2b6e 100644 --- a/target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-370w.dts +++ b/target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-370w.dts @@ -5,6 +5,17 @@ / { compatible = "hpe,1920-24g-poe-370w", "realtek,rtl838x-soc"; model = "HPE 1920-24G-PoE+ 370W (JG926A)"; + + gpio_fan_array { + compatible = "gpio-fan"; + + gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>; + gpio-fan,speed-map = <5000 0>, + <8200 1>; + + alarm-gpios = <&gpio1 6 GPIO_ACTIVE_LOW>; + #cooling-cells = <2>; + }; }; &uart1 { diff --git a/target/linux/realtek/image/rtl838x.mk b/target/linux/realtek/image/rtl838x.mk index 5f1ed3965b915c..0d6acd483afb38 100644 --- a/target/linux/realtek/image/rtl838x.mk +++ b/target/linux/realtek/image/rtl838x.mk @@ -147,18 +147,20 @@ TARGET_DEVICES += hpe_1920-24g define Device/hpe_1920-24g-poe-180w $(Device/hpe_1920) + $(Device/hwmon-fan-migration) SOC := rtl8382 DEVICE_MODEL := 1920-24G-PoE+ 180W (JG925A) - DEVICE_PACKAGES += realtek-poe + DEVICE_PACKAGES += realtek-poe kmod-hwmon-gpiofan H3C_DEVICE_ID := 0x00010028 endef TARGET_DEVICES += hpe_1920-24g-poe-180w define Device/hpe_1920-24g-poe-370w $(Device/hpe_1920) + $(Device/hwmon-fan-migration) SOC := rtl8382 DEVICE_MODEL := 1920-24G-PoE+ 370W (JG926A) - DEVICE_PACKAGES += realtek-poe + DEVICE_PACKAGES += realtek-poe kmod-hwmon-gpiofan H3C_DEVICE_ID := 0x00010029 endef TARGET_DEVICES += hpe_1920-24g-poe-370w From e8e5725cee97e7d3fe3f7c7c7bfe16e983b5c480 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Thu, 16 Jan 2025 13:23:54 +0100 Subject: [PATCH 493/877] realtek: Use atomic poll for aux-mdio commands regmap_read_poll_timeout() relies on usleep_range() to time the polling loop. With the current, rather large, scheduling interval, a short usleep_range() may take a lot longer than expected, causing performance issues. Switch the driver over to using regmap_read_poll_timeout_atomic(), which uses udelay() to time the polling loop. For comparision, the 'ethtool -m ' command is about 10 times faster with the atomic variant. Using 'perf -r10 ethtool -m lan25': - Driver using regmap_read_poll_timeout(): 2.0117 +- 0.0118 seconds time elapsed ( +- 0.58% ) - Driver using regmap_read_poll_timeout_atomic(): 0.1674 +- 0.0250 seconds time elapsed ( +- 14.95% ) Signed-off-by: Sander Vanheule (cherry picked from commit 693c1ea81a314cfa37a60a293568d2e46282b717) --- .../723-net-mdio-Add-Realtek-Otto-auxiliary-controller.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/realtek/patches-6.6/723-net-mdio-Add-Realtek-Otto-auxiliary-controller.patch b/target/linux/realtek/patches-6.6/723-net-mdio-Add-Realtek-Otto-auxiliary-controller.patch index 430f8f5c007ecc..a58cc496efe1dc 100644 --- a/target/linux/realtek/patches-6.6/723-net-mdio-Add-Realtek-Otto-auxiliary-controller.patch +++ b/target/linux/realtek/patches-6.6/723-net-mdio-Add-Realtek-Otto-auxiliary-controller.patch @@ -103,7 +103,7 @@ Signed-off-by: Sander Vanheule + if (err) + return err; + -+ err = regmap_read_poll_timeout(ctrl->map, ctrl->cmd_reg, run, (run != cmd), 3, 100); ++ err = regmap_read_poll_timeout_atomic(ctrl->map, ctrl->cmd_reg, run, (run != cmd), 3, 100); + + if ((run & ~mask_volatile) != (cmd & ~mask_volatile)) { + dev_err(ctrl->dev, "Command modified. Is offloading still active?"); From 87d3e886d51f9d49653ba8fbebe1a491fe681817 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Sat, 18 Jan 2025 13:28:44 +0100 Subject: [PATCH 494/877] realtek: Update aux-mdio driver For RTL839x, the driver was producing frequent timeouts on bus accesses. Increasing the timeout to the one from a recent Realtek SDK resolves these timeouts. To minimize overhead on different SoCs, each controller can specify their own timeout. This also add support for the register format as used on RTL93xx. Support is added for the RTL930x "ext gpio" controller. Signed-off-by: Sander Vanheule (cherry picked from commit 52ffef647152578ba89d2e4c1f9f2f869a3fc8a8) --- ...dd-Realtek-Otto-auxiliary-controller.patch | 130 +++++++++++------- 1 file changed, 82 insertions(+), 48 deletions(-) diff --git a/target/linux/realtek/patches-6.6/723-net-mdio-Add-Realtek-Otto-auxiliary-controller.patch b/target/linux/realtek/patches-6.6/723-net-mdio-Add-Realtek-Otto-auxiliary-controller.patch index a58cc496efe1dc..7315899b3f3b06 100644 --- a/target/linux/realtek/patches-6.6/723-net-mdio-Add-Realtek-Otto-auxiliary-controller.patch +++ b/target/linux/realtek/patches-6.6/723-net-mdio-Add-Realtek-Otto-auxiliary-controller.patch @@ -1,21 +1,21 @@ -From c7ddb74c981c1a29bad82d555d08724aca93b687 Mon Sep 17 00:00:00 2001 +From ffb7da9aa25765b2115e7ff3ee4f6dafa60f5421 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Fri, 27 Dec 2024 14:55:31 +0100 Subject: [PATCH] net: mdio: Add Realtek Otto auxiliary controller -SoCs in Realtek's Otto platform such as the RTL8380 and RTL8391 have a -simple auxiliary MDIO controller that is commonly used to manage RTL8231 -GPIO expanders on switch devices. +SoCs in Realtek's Otto platform such as the RTL8380, RTL8391, and +RTL9302 have a simple auxiliary MDIO controller that is commonly used to +manage RTL8231 GPIO expanders on switch devices. -Add a new MDIO controller driver supporting the RTL838x (maple) and -RTL839x (cypress) SoCs. +Add a new MDIO controller driver supporting the RTL838x (maple), RTL839x +(cypress), and RTL930x (longan) SoCs. Signed-off-by: Sander Vanheule --- drivers/net/mdio/Kconfig | 10 ++ drivers/net/mdio/Makefile | 1 + - drivers/net/mdio/mdio-realtek-otto-aux.c | 129 +++++++++++++++++++++++ - 3 files changed, 140 insertions(+) + drivers/net/mdio/mdio-realtek-otto-aux.c | 175 +++++++++++++++++++++++ + 3 files changed, 186 insertions(+) create mode 100644 drivers/net/mdio/mdio-realtek-otto-aux.c --- a/drivers/net/mdio/Kconfig @@ -49,7 +49,7 @@ Signed-off-by: Sander Vanheule obj-$(CONFIG_MDIO_THUNDER) += mdio-thunder.o --- /dev/null +++ b/drivers/net/mdio/mdio-realtek-otto-aux.c -@@ -0,0 +1,141 @@ +@@ -0,0 +1,175 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include @@ -64,65 +64,95 @@ Signed-off-by: Sander Vanheule + +#define RTL8380_EXT_GPIO_INDIRECT_ACCESS 0xA09C +#define RTL8390_EXT_GPIO_INDIRECT_ACCESS 0x0224 ++#define RTL9300_EXT_GPIO_INDIRECT_ACCESS 0xC620 + -+#define RTL83XX_AUX_MDIO_DATA GENMASK(31, 16) -+#define RTL83XX_AUX_MDIO_REG GENMASK(11, 7) -+#define RTL83XX_AUX_MDIO_PHY_ADDR GENMASK(6, 2) -+#define RTL83XX_AUX_MDIO_WRITE BIT(1) -+#define RTL83XX_AUX_MDIO_READ 0 -+#define RTL83XX_AUX_MDIO_EXEC BIT(0) ++#define RTL83XX_AUX_MDIO_DATA_OFFSET 16 ++#define RTL83XX_AUX_MDIO_RCMD_FAIL 0 ++ ++#define RTL93XX_AUX_MDIO_DATA_OFFSET 12 ++#define RTL93XX_AUX_MDIO_RCMD_FAIL BIT(28) ++ ++#define REALTEK_AUX_MDIO_REG GENMASK(11, 7) ++#define REALTEK_AUX_MDIO_PHY_ADDR GENMASK(6, 2) ++#define REALTEK_AUX_MDIO_WRITE BIT(1) ++#define REALTEK_AUX_MDIO_READ 0 ++#define REALTEK_AUX_MDIO_EXEC BIT(0) ++ ++struct realtek_aux_mdio_info { ++ unsigned int cmd_reg; ++ unsigned int data_offset; ++ unsigned int rcmd_fail_mask; ++ unsigned int timeout_us; ++}; ++ ++static const struct realtek_aux_mdio_info info_rtl838x = { ++ .cmd_reg = RTL8380_EXT_GPIO_INDIRECT_ACCESS, ++ .data_offset = RTL83XX_AUX_MDIO_DATA_OFFSET, ++ .rcmd_fail_mask = RTL83XX_AUX_MDIO_RCMD_FAIL, ++ .timeout_us = 1700, ++}; ++ ++static const struct realtek_aux_mdio_info info_rtl839x = { ++ .cmd_reg = RTL8390_EXT_GPIO_INDIRECT_ACCESS, ++ .data_offset = RTL83XX_AUX_MDIO_DATA_OFFSET, ++ .rcmd_fail_mask = RTL83XX_AUX_MDIO_RCMD_FAIL, ++ .timeout_us = 4120, ++}; ++ ++static const struct realtek_aux_mdio_info info_rtl930x = { ++ .cmd_reg = RTL9300_EXT_GPIO_INDIRECT_ACCESS, ++ .data_offset = RTL93XX_AUX_MDIO_DATA_OFFSET, ++ .rcmd_fail_mask = RTL93XX_AUX_MDIO_RCMD_FAIL, ++ .timeout_us = 19000, ++}; + +struct realtek_aux_mdio_ctrl { + struct device *dev; + struct regmap *map; -+ unsigned int cmd_reg; ++ const struct realtek_aux_mdio_info *info; +}; + +#define mii_bus_to_ctrl(bus) ((struct realtek_aux_mdio_ctrl *) bus->priv) + -+static int rtl83xx_aux_mdio_cmd(struct realtek_aux_mdio_ctrl *ctrl, int addr, int regnum, ++static int realtek_aux_mdio_cmd(struct realtek_aux_mdio_ctrl *ctrl, int addr, int regnum, + u32 rw_bit, u16 *data) +{ -+ unsigned int mask_volatile; + unsigned int cmd; -+ unsigned int run; + int err; + -+ cmd = rw_bit | RTL83XX_AUX_MDIO_EXEC; -+ cmd |= FIELD_PREP(RTL83XX_AUX_MDIO_PHY_ADDR, addr); -+ cmd |= FIELD_PREP(RTL83XX_AUX_MDIO_REG, regnum); ++ cmd = rw_bit | REALTEK_AUX_MDIO_EXEC; ++ cmd |= FIELD_PREP(REALTEK_AUX_MDIO_PHY_ADDR, addr); ++ cmd |= FIELD_PREP(REALTEK_AUX_MDIO_REG, regnum); + -+ mask_volatile = RTL83XX_AUX_MDIO_EXEC; ++ if (rw_bit == REALTEK_AUX_MDIO_WRITE) ++ cmd |= *data << ctrl->info->data_offset; + -+ if (rw_bit == RTL83XX_AUX_MDIO_WRITE) -+ cmd |= FIELD_PREP(RTL83XX_AUX_MDIO_DATA, *data); -+ else -+ mask_volatile |= RTL83XX_AUX_MDIO_DATA; ++ err = regmap_write(ctrl->map, ctrl->info->cmd_reg, cmd); ++ if (err) ++ return err; + -+ err = regmap_write(ctrl->map, ctrl->cmd_reg, cmd); ++ err = regmap_read_poll_timeout_atomic(ctrl->map, ctrl->info->cmd_reg, cmd, ++ !(cmd & REALTEK_AUX_MDIO_EXEC), 3, ctrl->info->timeout_us); + if (err) + return err; + -+ err = regmap_read_poll_timeout_atomic(ctrl->map, ctrl->cmd_reg, run, (run != cmd), 3, 100); ++ if (rw_bit == REALTEK_AUX_MDIO_READ) { ++ if (cmd & ctrl->info->rcmd_fail_mask) ++ return -EIO; + -+ if ((run & ~mask_volatile) != (cmd & ~mask_volatile)) { -+ dev_err(ctrl->dev, "Command modified. Is offloading still active?"); -+ return -EIO; ++ *data = (cmd >> ctrl->info->data_offset) & GENMASK(15, 0); + } + -+ if (!err && (rw_bit == RTL83XX_AUX_MDIO_READ)) -+ *data = FIELD_GET(RTL83XX_AUX_MDIO_DATA, run); -+ -+ return err; ++ return 0; +} + -+static int rtl83xx_aux_mdio_read(struct mii_bus *bus, int addr, int regnum) ++static int realtek_aux_mdio_read(struct mii_bus *bus, int addr, int regnum) +{ + struct realtek_aux_mdio_ctrl *ctrl = mii_bus_to_ctrl(bus); + u16 data; + int err; + -+ err = rtl83xx_aux_mdio_cmd(ctrl, addr, regnum, RTL83XX_AUX_MDIO_READ, &data); ++ err = realtek_aux_mdio_cmd(ctrl, addr, regnum, REALTEK_AUX_MDIO_READ, &data); + + if (err) + return err; @@ -130,11 +160,11 @@ Signed-off-by: Sander Vanheule + return data; +} + -+static int rtl83xx_aux_mdio_write(struct mii_bus *bus, int addr, int regnum, u16 val) ++static int realtek_aux_mdio_write(struct mii_bus *bus, int addr, int regnum, u16 val) +{ + struct realtek_aux_mdio_ctrl *ctrl = mii_bus_to_ctrl(bus); + -+ return rtl83xx_aux_mdio_cmd(ctrl, addr, regnum, RTL83XX_AUX_MDIO_WRITE, &val); ++ return realtek_aux_mdio_cmd(ctrl, addr, regnum, REALTEK_AUX_MDIO_WRITE, &val); +} + +static int realtek_aux_mdio_probe(struct platform_device *pdev) @@ -149,16 +179,16 @@ Signed-off-by: Sander Vanheule + + ctrl = bus->priv; + ctrl->dev = &pdev->dev; -+ ctrl->cmd_reg = (unsigned int) device_get_match_data(ctrl->dev); ++ ctrl->info = (const struct realtek_aux_mdio_info *) device_get_match_data(ctrl->dev); + ctrl->map = syscon_node_to_regmap(np->parent); + if (IS_ERR(ctrl->map)) + return PTR_ERR(ctrl->map); + -+ bus->name = "RTL83xx auxiliary MDIO bus"; -+ snprintf(bus->id, MII_BUS_ID_SIZE, "rtl83xx-aux-mdio") ; ++ bus->name = "Realtek auxiliary MDIO bus"; ++ snprintf(bus->id, MII_BUS_ID_SIZE, "realtek-aux-mdio") ; + bus->parent = ctrl->dev; -+ bus->read = rtl83xx_aux_mdio_read; -+ bus->write = rtl83xx_aux_mdio_write; ++ bus->read = realtek_aux_mdio_read; ++ bus->write = realtek_aux_mdio_write; + /* Don't have interrupts */ + for (unsigned int i = 0; i < PHY_MAX_ADDR; i++) + bus->irq[i] = PHY_POLL; @@ -169,11 +199,15 @@ Signed-off-by: Sander Vanheule +static const struct of_device_id realtek_aux_mdio_of_match[] = { + { + .compatible = "realtek,rtl8380-aux-mdio", -+ .data = (void *) RTL8380_EXT_GPIO_INDIRECT_ACCESS, ++ .data = &info_rtl838x, + }, + { + .compatible = "realtek,rtl8390-aux-mdio", -+ .data = (void *) RTL8390_EXT_GPIO_INDIRECT_ACCESS, ++ .data = &info_rtl839x, ++ }, ++ { ++ .compatible = "realtek,rtl9300-aux-mdio", ++ .data = &info_rtl930x, + }, + { /* sentinel */ } +}; @@ -189,5 +223,5 @@ Signed-off-by: Sander Vanheule +module_platform_driver(realtek_aux_mdio_driver); + +MODULE_AUTHOR("Sander Vanheule "); -+MODULE_DESCRIPTION("Realtek RTL83xx auxiliary MDIO bus"); ++MODULE_DESCRIPTION("Realtek otto auxiliary MDIO bus"); +MODULE_LICENSE("GPL v2"); From d7631cf577d76aa83c92daa590b96103d5860201 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Sat, 18 Jan 2025 13:45:55 +0100 Subject: [PATCH 495/877] realtek: rtl839x: Enable AUX MDIO controller Enable the driver for the Realtek Otto auxiliary MDIO driver so RTL839x devices can use it. The related node is added to the base devicetree for rtl839x-based devices, so they can enabled and use it when required. Signed-off-by: Sander Vanheule (cherry picked from commit cddcc69ddf9c6284d6c9a6399c4ea48d7a044719) --- target/linux/realtek/dts/rtl839x.dtsi | 21 +++++++++++++++++++++ target/linux/realtek/rtl839x/config-6.6 | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/target/linux/realtek/dts/rtl839x.dtsi b/target/linux/realtek/dts/rtl839x.dtsi index 3f87f5622e23df..7fc5aea70c4970 100644 --- a/target/linux/realtek/dts/rtl839x.dtsi +++ b/target/linux/realtek/dts/rtl839x.dtsi @@ -258,6 +258,22 @@ }; + switchcore@1b000000 { + compatible = "syscon", "simple-mfd"; + reg = <0x1b000000 0x20000>; + + mdio_aux: mdio-aux { + compatible = "realtek,rtl8390-aux-mdio"; + #address-cells = <1>; + #size-cells = <0>; + + status = "disabled"; + + pinctrl-names = "default"; + pinctrl-0 = <&mdio_aux_mdx>; + }; + }; + pinmux@1b000004 { compatible = "pinctrl-single"; reg = <0x1b000004 0x4>; @@ -290,6 +306,11 @@ pinmux_disable_sys_led: disable_sys_led { pinctrl-single,bits = <0x0 0x0 0x4000>; }; + + /* enable AUX MDC/MDIO */ + mdio_aux_mdx: aux-mdx-pins { + pinctrl-single,bits = <0x0 0x100000 0x1c0000>; + }; }; ethernet0: ethernet@1b00a300 { diff --git a/target/linux/realtek/rtl839x/config-6.6 b/target/linux/realtek/rtl839x/config-6.6 index d0b8f59dd33ebe..7091a039fec675 100644 --- a/target/linux/realtek/rtl839x/config-6.6 +++ b/target/linux/realtek/rtl839x/config-6.6 @@ -121,7 +121,7 @@ CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y CONFIG_MDIO_I2C=y -# CONFIG_MDIO_REALTEK_OTTO_AUX is not set +CONFIG_MDIO_REALTEK_OTTO_AUX=y CONFIG_MDIO_SMBUS=y CONFIG_MEMFD_CREATE=y # CONFIG_MFD_RTL8231 is not set From e5ac0c73914ec00c02f19343eb2a733c89b346ed Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Sat, 18 Jan 2025 13:48:17 +0100 Subject: [PATCH 496/877] realtek: rtl839x: Enable RTL8231 MFD driver Enable the RTL8231 MFD core driver, as well as the pinctrl/gpio driver to allow RTL839x devices to use it. Signed-off-by: Sander Vanheule (cherry picked from commit fd5797b7ce6856539ec0f88b25a766fc2ce00c19) --- target/linux/realtek/rtl839x/config-6.6 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/target/linux/realtek/rtl839x/config-6.6 b/target/linux/realtek/rtl839x/config-6.6 index 7091a039fec675..c84898ec3e3eb7 100644 --- a/target/linux/realtek/rtl839x/config-6.6 +++ b/target/linux/realtek/rtl839x/config-6.6 @@ -87,6 +87,7 @@ CONFIG_GPIO_GENERIC=y CONFIG_GPIO_PCA953X=y CONFIG_GPIO_PCA953X_IRQ=y CONFIG_GPIO_REALTEK_OTTO=y +CONFIG_GPIO_REGMAP=y CONFIG_GPIO_RTL8231=y CONFIG_GPIO_WATCHDOG=y # CONFIG_GPIO_WATCHDOG_ARCH_INITCALL is not set @@ -113,6 +114,7 @@ CONFIG_IRQ_MIPS_CPU=y CONFIG_IRQ_WORK=y CONFIG_JFFS2_ZLIB=y CONFIG_LEDS_GPIO=y +# CONFIG_LEDS_RTL8231 is not set CONFIG_LIBFDT=y CONFIG_LOCK_DEBUGGING_SUPPORT=y CONFIG_MACH_REALTEK_RTL=y @@ -124,7 +126,8 @@ CONFIG_MDIO_I2C=y CONFIG_MDIO_REALTEK_OTTO_AUX=y CONFIG_MDIO_SMBUS=y CONFIG_MEMFD_CREATE=y -# CONFIG_MFD_RTL8231 is not set +CONFIG_MFD_CORE=y +CONFIG_MFD_RTL8231=y CONFIG_MFD_SYSCON=y CONFIG_MIGRATION=y CONFIG_MIPS=y @@ -187,6 +190,7 @@ CONFIG_PGTABLE_LEVELS=2 CONFIG_PHYLIB=y CONFIG_PHYLINK=y CONFIG_PINCTRL=y +CONFIG_PINCTRL_RTL8231=y CONFIG_PM_OPP=y CONFIG_POWER_RESET=y CONFIG_POWER_RESET_GPIO_RESTART=y @@ -201,6 +205,7 @@ CONFIG_REALTEK_PHY=y CONFIG_REALTEK_SOC_PHY=y CONFIG_REGMAP=y CONFIG_REGMAP_I2C=y +CONFIG_REGMAP_MDIO=y CONFIG_REGMAP_MMIO=y CONFIG_RESET_CONTROLLER=y CONFIG_RFS_ACCEL=y From 3d26c1cae4ad8f094f75e5fa40af7bfe37c294e2 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Sat, 18 Jan 2025 13:39:01 +0100 Subject: [PATCH 497/877] realtek: Switch RTL8231 driver on Zyxel GS1900-48 Switch the Zyxel GS1900-48 over to the new MDIO-based driver for the RTL8231 GPIO expander. Signed-off-by: Sander Vanheule (cherry picked from commit 45aafe67f385a2b6cf65894b2f46ee8e33d87f92) --- .../realtek/dts/rtl8393_zyxel_gs1900-48.dts | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts b/target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts index a1e0a6d06d8233..6bb99b6137f350 100644 --- a/target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts +++ b/target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts @@ -32,13 +32,6 @@ }; }; - gpio1: rtl8231-gpio { - compatible = "realtek,rtl8231-gpio"; - #gpio-cells = <2>; - indirect-access-bus-id = <3>; - gpio-controller; - }; - keys { compatible = "gpio-keys-polled"; poll-interval = <20>; @@ -90,6 +83,24 @@ }; }; +&mdio_aux { + status = "okay"; + + gpio1: expander@3 { + compatible = "realtek,rtl8231"; + reg = <3>; + + gpio-controller; + #gpio-cells = <2>; + gpio-ranges = <&gpio1 0 0 37>; + + led-controller { + compatible = "realtek,rtl8231-leds"; + status = "disabled"; + }; + }; +}; + &spi0 { status = "okay"; flash@0 { From fd978c2e80b45ce2bcf45c664d2cf7e83d7f12c5 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Tue, 21 Jan 2025 19:37:25 +0100 Subject: [PATCH 498/877] realtek: Enable Zyxel GS1900's RTL8231 reset line As the bootloader is reconfiguring the RTL8231 on these devices anyway, no pin state can be maintained over warm reboots. This results in for example the PoE disable pin always being asserted by the bootloader. Define the GPIO line linked to the RTL8231's reset so the MDIO subsystem will also reset the expander on boot and ensure the line in the correct state. Signed-off-by: Sander Vanheule (cherry picked from commit b2d17dbb68c232393739e6fb48245f1f4bebb698) --- target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi b/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi index 927b9527a95a00..6ab3e4834a2e70 100644 --- a/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi +++ b/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi @@ -45,11 +45,9 @@ &mdio_aux { status = "okay"; - // Reset GPIO is <&gpio0 1 GPIO_ACTIVE_LOW> - // Don't specify the reset info so the mdio subsystem doesn't reset the bus - //reset-gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; - //reset-delay-us = <1000>; - //reset-post-delay-us = <10000>; + reset-gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + reset-delay-us = <1000>; + reset-post-delay-us = <10000>; gpio1: expander@0 { compatible = "realtek,rtl8231"; From c62bafb223b5bb861ce44c9436c348eae5109cf4 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Tue, 21 Jan 2025 19:40:11 +0100 Subject: [PATCH 499/877] realtek: Add virtual MDIO bus on rtl838x Some RTL8380M-based devices have been around for a long time and use an early A revision of the RTL8380M SoC. This revision has an issue with the auxiliary MDIO controller, causing it to malfunction. This may lead to device reboots when the controller is used. Provide a bit-banged MDIO bus, which muxes the auxiliary MDIO pins to their GPIO function. Although this will result in lower performance, there should otherwise be no functional differences. Link: https://github.com/openwrt/openwrt/issues/9534 Signed-off-by: Sander Vanheule (cherry picked from commit d4bf16a9e1618347709b0dccae71c273e6291a61) --- target/linux/realtek/dts/rtl838x.dtsi | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/target/linux/realtek/dts/rtl838x.dtsi b/target/linux/realtek/dts/rtl838x.dtsi index ab034fc1bcfc2c..18da4c93800461 100644 --- a/target/linux/realtek/dts/rtl838x.dtsi +++ b/target/linux/realtek/dts/rtl838x.dtsi @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT #include +#include /dts-v1/; @@ -120,6 +121,7 @@ aliases { serial0 = &uart0; serial1 = &uart1; + mdio-gpio1 = &mdio_gpio; }; chosen { @@ -134,6 +136,22 @@ interrupt-controller; }; + /* + * Provided for devices with RTL838xM SoC with revision A silicon. + * Newer SoCs can use the &mdio_aux bus instead. + */ + mdio_gpio: mdio { + compatible = "virtual,mdio-gpio"; + #address-cells = <1>; + #size-cells = <0>; + gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>, + <&gpio0 3 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&mdio_aux_gpio>; + + status = "disabled"; + }; + soc: soc { compatible = "simple-bus"; #address-cells = <1>; From 8e539afa957d849401997c5c6decb249f8c7aec8 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Wed, 22 Jan 2025 12:16:00 +0100 Subject: [PATCH 500/877] realtek: Move GS1900 external GPIO to new DTSI In order to be able to define the external GPIO controller on an emulated MDIO bus, move the controller definition outside of the main GS1900 include for RTL838x-based devices. Additionally, a new DTSI is provided defining the RTL8231 on the emulated MDIO bus. Signed-off-by: Sander Vanheule (cherry picked from commit a6a77896f4cddd6e69bcf86d5a6dc190fa82d53d) --- .../realtek/dts/rtl8380_zyxel_gs1900-10hp.dts | 1 + .../realtek/dts/rtl8380_zyxel_gs1900-8.dts | 1 + .../dts/rtl8380_zyxel_gs1900-8hp-v1.dts | 1 + .../dts/rtl8380_zyxel_gs1900-8hp-v2.dts | 1 + .../realtek/dts/rtl8380_zyxel_gs1900.dtsi | 28 ----------------- .../dts/rtl8380_zyxel_gs1900_gpio.dtsi | 31 +++++++++++++++++++ .../rtl8380_zyxel_gs1900_gpio_emulated.dtsi | 31 +++++++++++++++++++ .../realtek/dts/rtl8382_zyxel_gs1900-16.dts | 1 + .../dts/rtl8382_zyxel_gs1900-24-v1.dts | 1 + .../realtek/dts/rtl8382_zyxel_gs1900-24e.dts | 1 + .../realtek/dts/rtl8382_zyxel_gs1900-24ep.dts | 1 + .../dts/rtl8382_zyxel_gs1900-24hp-v1.dts | 1 + .../dts/rtl8382_zyxel_gs1900-24hp-v2.dts | 1 + 13 files changed, 72 insertions(+), 28 deletions(-) create mode 100644 target/linux/realtek/dts/rtl8380_zyxel_gs1900_gpio.dtsi create mode 100644 target/linux/realtek/dts/rtl8380_zyxel_gs1900_gpio_emulated.dtsi diff --git a/target/linux/realtek/dts/rtl8380_zyxel_gs1900-10hp.dts b/target/linux/realtek/dts/rtl8380_zyxel_gs1900-10hp.dts index 190a77b7ff7198..d21b7483922246 100644 --- a/target/linux/realtek/dts/rtl8380_zyxel_gs1900-10hp.dts +++ b/target/linux/realtek/dts/rtl8380_zyxel_gs1900-10hp.dts @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "rtl8380_zyxel_gs1900.dtsi" +#include "rtl8380_zyxel_gs1900_gpio.dtsi" / { compatible = "zyxel,gs1900-10hp", "realtek,rtl838x-soc"; diff --git a/target/linux/realtek/dts/rtl8380_zyxel_gs1900-8.dts b/target/linux/realtek/dts/rtl8380_zyxel_gs1900-8.dts index 548e83ba7308eb..1d76f55d6a1640 100644 --- a/target/linux/realtek/dts/rtl8380_zyxel_gs1900-8.dts +++ b/target/linux/realtek/dts/rtl8380_zyxel_gs1900-8.dts @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "rtl8380_zyxel_gs1900.dtsi" +#include "rtl8380_zyxel_gs1900_gpio.dtsi" / { compatible = "zyxel,gs1900-8", "realtek,rtl838x-soc"; diff --git a/target/linux/realtek/dts/rtl8380_zyxel_gs1900-8hp-v1.dts b/target/linux/realtek/dts/rtl8380_zyxel_gs1900-8hp-v1.dts index 386edfb01595f2..22c052f506f95b 100644 --- a/target/linux/realtek/dts/rtl8380_zyxel_gs1900-8hp-v1.dts +++ b/target/linux/realtek/dts/rtl8380_zyxel_gs1900-8hp-v1.dts @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "rtl8380_zyxel_gs1900.dtsi" +#include "rtl8380_zyxel_gs1900_gpio.dtsi" / { compatible = "zyxel,gs1900-8hp-v1", "realtek,rtl838x-soc"; diff --git a/target/linux/realtek/dts/rtl8380_zyxel_gs1900-8hp-v2.dts b/target/linux/realtek/dts/rtl8380_zyxel_gs1900-8hp-v2.dts index 2702f2ba1cff8a..728342c22fa782 100644 --- a/target/linux/realtek/dts/rtl8380_zyxel_gs1900-8hp-v2.dts +++ b/target/linux/realtek/dts/rtl8380_zyxel_gs1900-8hp-v2.dts @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "rtl8380_zyxel_gs1900.dtsi" +#include "rtl8380_zyxel_gs1900_gpio.dtsi" / { compatible = "zyxel,gs1900-8hp-v2", "realtek,rtl838x-soc"; diff --git a/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi b/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi index 6ab3e4834a2e70..1411ea0f18a47a 100644 --- a/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi +++ b/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi @@ -42,34 +42,6 @@ }; }; -&mdio_aux { - status = "okay"; - - reset-gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; - reset-delay-us = <1000>; - reset-post-delay-us = <10000>; - - gpio1: expander@0 { - compatible = "realtek,rtl8231"; - reg = <0x0>; - - gpio-controller; - #gpio-cells = <2>; - gpio-ranges = <&gpio1 0 0 37>; - - poe_enable { - gpio-hog; - gpios = <13 GPIO_ACTIVE_HIGH>; - output-high; - }; - - led-controller { - compatible = "realtek,rtl8231-leds"; - status = "disabled"; - }; - }; -}; - &spi0 { status = "okay"; diff --git a/target/linux/realtek/dts/rtl8380_zyxel_gs1900_gpio.dtsi b/target/linux/realtek/dts/rtl8380_zyxel_gs1900_gpio.dtsi new file mode 100644 index 00000000000000..93ec7e4a1e645d --- /dev/null +++ b/target/linux/realtek/dts/rtl8380_zyxel_gs1900_gpio.dtsi @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include + +&mdio_aux { + status = "okay"; + + reset-gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + reset-delay-us = <1000>; + reset-post-delay-us = <10000>; + + gpio1: expander@0 { + compatible = "realtek,rtl8231"; + reg = <0x0>; + + gpio-controller; + #gpio-cells = <2>; + gpio-ranges = <&gpio1 0 0 37>; + + poe_enable { + gpio-hog; + gpios = <13 GPIO_ACTIVE_HIGH>; + output-high; + }; + + led-controller { + compatible = "realtek,rtl8231-leds"; + status = "disabled"; + }; + }; +}; diff --git a/target/linux/realtek/dts/rtl8380_zyxel_gs1900_gpio_emulated.dtsi b/target/linux/realtek/dts/rtl8380_zyxel_gs1900_gpio_emulated.dtsi new file mode 100644 index 00000000000000..70969eb00cadaf --- /dev/null +++ b/target/linux/realtek/dts/rtl8380_zyxel_gs1900_gpio_emulated.dtsi @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include + +&mdio_gpio { + status = "okay"; + + reset-gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + reset-delay-us = <1000>; + reset-post-delay-us = <10000>; + + gpio1: expander@0 { + compatible = "realtek,rtl8231"; + reg = <0x0>; + + gpio-controller; + #gpio-cells = <2>; + gpio-ranges = <&gpio1 0 0 37>; + + poe_enable { + gpio-hog; + gpios = <13 GPIO_ACTIVE_HIGH>; + output-high; + }; + + led-controller { + compatible = "realtek,rtl8231-leds"; + status = "disabled"; + }; + }; +}; diff --git a/target/linux/realtek/dts/rtl8382_zyxel_gs1900-16.dts b/target/linux/realtek/dts/rtl8382_zyxel_gs1900-16.dts index 6010da2e26c3f5..5b40f1ce097b72 100644 --- a/target/linux/realtek/dts/rtl8382_zyxel_gs1900-16.dts +++ b/target/linux/realtek/dts/rtl8382_zyxel_gs1900-16.dts @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "rtl8380_zyxel_gs1900.dtsi" +#include "rtl8380_zyxel_gs1900_gpio.dtsi" / { compatible = "zyxel,gs1900-16", "realtek,rtl838x-soc"; diff --git a/target/linux/realtek/dts/rtl8382_zyxel_gs1900-24-v1.dts b/target/linux/realtek/dts/rtl8382_zyxel_gs1900-24-v1.dts index 6d98e7fae1dcd4..87cff0022ef841 100644 --- a/target/linux/realtek/dts/rtl8382_zyxel_gs1900-24-v1.dts +++ b/target/linux/realtek/dts/rtl8382_zyxel_gs1900-24-v1.dts @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "rtl8380_zyxel_gs1900.dtsi" +#include "rtl8380_zyxel_gs1900_gpio.dtsi" / { compatible = "zyxel,gs1900-24-v1", "realtek,rtl838x-soc"; diff --git a/target/linux/realtek/dts/rtl8382_zyxel_gs1900-24e.dts b/target/linux/realtek/dts/rtl8382_zyxel_gs1900-24e.dts index b455ddf23a990d..1eaf2090abaeb9 100644 --- a/target/linux/realtek/dts/rtl8382_zyxel_gs1900-24e.dts +++ b/target/linux/realtek/dts/rtl8382_zyxel_gs1900-24e.dts @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "rtl8380_zyxel_gs1900.dtsi" +#include "rtl8380_zyxel_gs1900_gpio.dtsi" / { compatible = "zyxel,gs1900-24e", "realtek,rtl838x-soc"; diff --git a/target/linux/realtek/dts/rtl8382_zyxel_gs1900-24ep.dts b/target/linux/realtek/dts/rtl8382_zyxel_gs1900-24ep.dts index 25c82f089eeaf6..fea2e77f3ecfbc 100644 --- a/target/linux/realtek/dts/rtl8382_zyxel_gs1900-24ep.dts +++ b/target/linux/realtek/dts/rtl8382_zyxel_gs1900-24ep.dts @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "rtl8380_zyxel_gs1900.dtsi" +#include "rtl8380_zyxel_gs1900_gpio.dtsi" / { compatible = "zyxel,gs1900-24ep", "realtek,rtl838x-soc"; diff --git a/target/linux/realtek/dts/rtl8382_zyxel_gs1900-24hp-v1.dts b/target/linux/realtek/dts/rtl8382_zyxel_gs1900-24hp-v1.dts index fa9bef89d6ba7f..59cd2082a8d567 100644 --- a/target/linux/realtek/dts/rtl8382_zyxel_gs1900-24hp-v1.dts +++ b/target/linux/realtek/dts/rtl8382_zyxel_gs1900-24hp-v1.dts @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "rtl8380_zyxel_gs1900.dtsi" +#include "rtl8380_zyxel_gs1900_gpio.dtsi" / { compatible = "zyxel,gs1900-24hp-v1", "realtek,rtl838x-soc"; diff --git a/target/linux/realtek/dts/rtl8382_zyxel_gs1900-24hp-v2.dts b/target/linux/realtek/dts/rtl8382_zyxel_gs1900-24hp-v2.dts index 93011cbdaadfab..78c66507f172b7 100644 --- a/target/linux/realtek/dts/rtl8382_zyxel_gs1900-24hp-v2.dts +++ b/target/linux/realtek/dts/rtl8382_zyxel_gs1900-24hp-v2.dts @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "rtl8380_zyxel_gs1900.dtsi" +#include "rtl8380_zyxel_gs1900_gpio.dtsi" / { compatible = "zyxel,gs1900-24hp-v2", "realtek,rtl838x-soc"; From f5b66f765163dfd5ef066f6e93700908916084f1 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Tue, 21 Jan 2025 19:57:22 +0100 Subject: [PATCH 501/877] realtek: rtl838x: Enable MDIO_GPIO driver The mdio-gpio driver is required to support early revision of RTL8380M slicon (rev A) where the auxilairy MDIO controller does not function correctly. Add this driver to the rtl838x kernel so devices with old SoCs are also able to function correctly. Signed-off-by: Sander Vanheule (cherry picked from commit efffcfa43693b68028a4aed4dea151b82158cc52) --- target/linux/realtek/rtl838x/config-6.6 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/linux/realtek/rtl838x/config-6.6 b/target/linux/realtek/rtl838x/config-6.6 index 4cc66bbdda5b94..0621763ca7d5ca 100644 --- a/target/linux/realtek/rtl838x/config-6.6 +++ b/target/linux/realtek/rtl838x/config-6.6 @@ -120,9 +120,11 @@ CONFIG_LIBFDT=y CONFIG_LOCK_DEBUGGING_SUPPORT=y CONFIG_MACH_REALTEK_RTL=y CONFIG_MARVELL_PHY=y +CONFIG_MDIO_BITBANG=y CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y +CONFIG_MDIO_GPIO=y CONFIG_MDIO_I2C=y CONFIG_MDIO_REALTEK_OTTO_AUX=y CONFIG_MDIO_SMBUS=y From abf7f15257e6e8100ca43cf2ff447ef5ddb8c5ac Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Wed, 22 Jan 2025 12:25:18 +0100 Subject: [PATCH 502/877] realtek: Split Zyxel GS1900-8 into v1 and v2 Zyxel GS1900-8 v2 devices have been produced more recently than v1 devices. As there are v1 boards with RTL8380M rev. C SoCs, it can likely safely be assumed that all v2 devices will also have a recent SoC revision, supporting the hardware auxiliary MDIO controller. Make the GS1900-8 v1 use an emulated auxiliary MDIO bus, for backward compatibility with devices containing an RTL8380M rev. A. Since the devicetrees are otherwise identical, GS1900-8 v1 devices with an RTL8380M rev. B or C will also be able to use the (more efficient) v2 image. This includes any currently functioning device with OpenWrt, so include the old compatible as a supported device for the GS1900-8 v2. Link: https://github.com/openwrt/openwrt/issues/9534 Signed-off-by: Sander Vanheule (cherry picked from commit 7322d3266d84ec4062046254792d78ebca3ea26d) --- .../base-files/etc/board.d/05_compat-version | 3 ++- .../realtek/dts/rtl8380_zyxel_gs1900-8-v1.dts | 13 +++++++++++++ ...900-8.dts => rtl8380_zyxel_gs1900-8-v2.dts} | 4 ++-- target/linux/realtek/image/rtl838x.mk | 18 +++++++++++++----- 4 files changed, 30 insertions(+), 8 deletions(-) create mode 100644 target/linux/realtek/dts/rtl8380_zyxel_gs1900-8-v1.dts rename target/linux/realtek/dts/{rtl8380_zyxel_gs1900-8.dts => rtl8380_zyxel_gs1900-8-v2.dts} (64%) diff --git a/target/linux/realtek/base-files/etc/board.d/05_compat-version b/target/linux/realtek/base-files/etc/board.d/05_compat-version index 9c27314b241e4e..52dbdc627edfc0 100644 --- a/target/linux/realtek/base-files/etc/board.d/05_compat-version +++ b/target/linux/realtek/base-files/etc/board.d/05_compat-version @@ -13,7 +13,8 @@ case "$(board_name)" in hpe,1920-24g-poe-370w) ucidef_set_compat_version "1.1" ;; - zyxel,gs1900-8 | \ + zyxel,gs1900-8-v1 | \ + zyxel,gs1900-8-v2 | \ zyxel,gs1900-8hp-v1 | \ zyxel,gs1900-8hp-v2 | \ zyxel,gs1900-10hp | \ diff --git a/target/linux/realtek/dts/rtl8380_zyxel_gs1900-8-v1.dts b/target/linux/realtek/dts/rtl8380_zyxel_gs1900-8-v1.dts new file mode 100644 index 00000000000000..9838c023dabcdb --- /dev/null +++ b/target/linux/realtek/dts/rtl8380_zyxel_gs1900-8-v1.dts @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "rtl8380_zyxel_gs1900.dtsi" +#include "rtl8380_zyxel_gs1900_gpio_emulated.dtsi" + +/ { + compatible = "zyxel,gs1900-8-v1", "realtek,rtl838x-soc"; + model = "Zyxel GS1900-8 v1 Switch"; +}; + +&gpio1 { + /delete-node/ poe_enable; +}; diff --git a/target/linux/realtek/dts/rtl8380_zyxel_gs1900-8.dts b/target/linux/realtek/dts/rtl8380_zyxel_gs1900-8-v2.dts similarity index 64% rename from target/linux/realtek/dts/rtl8380_zyxel_gs1900-8.dts rename to target/linux/realtek/dts/rtl8380_zyxel_gs1900-8-v2.dts index 1d76f55d6a1640..84f87ea03749f7 100644 --- a/target/linux/realtek/dts/rtl8380_zyxel_gs1900-8.dts +++ b/target/linux/realtek/dts/rtl8380_zyxel_gs1900-8-v2.dts @@ -4,8 +4,8 @@ #include "rtl8380_zyxel_gs1900_gpio.dtsi" / { - compatible = "zyxel,gs1900-8", "realtek,rtl838x-soc"; - model = "Zyxel GS1900-8v1/v2 Switch"; + compatible = "zyxel,gs1900-8-v2", "realtek,rtl838x-soc"; + model = "Zyxel GS1900-8 v2 Switch"; }; &gpio1 { diff --git a/target/linux/realtek/image/rtl838x.mk b/target/linux/realtek/image/rtl838x.mk index 0d6acd483afb38..3763418233e829 100644 --- a/target/linux/realtek/image/rtl838x.mk +++ b/target/linux/realtek/image/rtl838x.mk @@ -360,17 +360,25 @@ define Device/zyxel_gs1900-16 endef TARGET_DEVICES += zyxel_gs1900-16 -define Device/zyxel_gs1900-8 +define Device/zyxel_gs1900-8-v1 $(Device/zyxel_gs1900) SOC := rtl8380 DEVICE_MODEL := GS1900-8 DEVICE_VARIANT := v1 - DEVICE_ALT0_VENDOR := Zyxel - DEVICE_ALT0_MODEL := GS1900-8 - DEVICE_ALT0_VARIANT := v2 ZYXEL_VERS := AAHH + SUPPORTED_DEVICES += zyxel,gs1900-8 endef -TARGET_DEVICES += zyxel_gs1900-8 +TARGET_DEVICES += zyxel_gs1900-8-v1 + +define Device/zyxel_gs1900-8-v2 + $(Device/zyxel_gs1900) + SOC := rtl8380 + DEVICE_MODEL := GS1900-8 + DEVICE_VARIANT := v2 + ZYXEL_VERS := AAHH + SUPPORTED_DEVICES += zyxel,gs1900-8 +endef +TARGET_DEVICES += zyxel_gs1900-8-v2 define Device/zyxel_gs1900-8hp-v1 $(Device/zyxel_gs1900) From e76aae2253df4b4dc2ee61e4df0eb25dda809370 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Sat, 18 Jan 2025 21:40:06 +0100 Subject: [PATCH 503/877] realtek: Simple conversions to RTL8231 MFD driver Change devices with RTL8231 GPIO expander definition that can easily be translated to the new RTL8231 binding and carry over any gpio-hogs. This will let them use the new RTL8231 MFD driver, without any functional changes. Signed-off-by: Sander Vanheule (cherry picked from commit b7af54d5c18cf74b9b598b506a335443a0bbed87) --- .../realtek/dts/rtl8380_engenius_ews2910p.dts | 57 +++++++++++-------- .../realtek/dts/rtl8380_linksys_lgs310c.dts | 19 +++++-- .../realtek/dts/rtl8380_netgear_gigabit.dtsi | 19 +++++-- .../realtek/dts/rtl8382_iodata_bsh-g24mb.dts | 19 +++++-- 4 files changed, 79 insertions(+), 35 deletions(-) diff --git a/target/linux/realtek/dts/rtl8380_engenius_ews2910p.dts b/target/linux/realtek/dts/rtl8380_engenius_ews2910p.dts index 289ec8627407e3..b0f1e9b53899b9 100644 --- a/target/linux/realtek/dts/rtl8380_engenius_ews2910p.dts +++ b/target/linux/realtek/dts/rtl8380_engenius_ews2910p.dts @@ -38,29 +38,6 @@ }; }; - gpio1: rtl8231-gpio { - compatible = "realtek,rtl8231-gpio"; - #gpio-cells = <2>; - gpio-controller; - indirect-access-bus-id = <0>; - - poe_enable { - gpio-hog; - gpios = <1 GPIO_ACTIVE_HIGH>; - output-high; - line-name = "poe-enable"; - }; - - sff_p9_gpios { - gpio-hog; - gpios = < 6 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>, - < 11 GPIO_ACTIVE_HIGH>, /* los-gpio */ - < 12 GPIO_ACTIVE_LOW>; /* mod-def0-gpio */ - input; - line-name = "sff-p9-gpios"; - }; - }; - gpio-export { compatible = "gpio-export"; @@ -119,6 +96,40 @@ }; }; +&mdio_aux { + status = "okay"; + + gpio1: expander@0 { + compatible = "realtek,rtl8231"; + reg = <0>; + + gpio-controller; + #gpio-cells = <2>; + gpio-ranges = <&gpio1 0 0 37>; + + poe_enable { + gpio-hog; + gpios = <1 GPIO_ACTIVE_HIGH>; + output-high; + line-name = "poe-enable"; + }; + + sff_p9_gpios { + gpio-hog; + gpios = < 6 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>, + < 11 GPIO_ACTIVE_HIGH>, /* los-gpio */ + < 12 GPIO_ACTIVE_LOW>; /* mod-def0-gpio */ + input; + line-name = "sff-p9-gpios"; + }; + + led-controller { + compatible = "realtek,rtl8231-leds"; + status = "disabled"; + }; + }; +}; + &spi0 { status = "okay"; diff --git a/target/linux/realtek/dts/rtl8380_linksys_lgs310c.dts b/target/linux/realtek/dts/rtl8380_linksys_lgs310c.dts index 08ef740399e656..ab095dbc65966f 100644 --- a/target/linux/realtek/dts/rtl8380_linksys_lgs310c.dts +++ b/target/linux/realtek/dts/rtl8380_linksys_lgs310c.dts @@ -92,12 +92,23 @@ linux,code = ; }; }; +}; + +&mdio_aux { + status = "okay"; + + gpio1: expander@0 { + compatible = "realtek,rtl8231"; + reg = <0>; - gpio1: rtl8231-gpio { - compatible = "realtek,rtl8231-gpio"; - #gpio-cells = <2>; gpio-controller; - indirect-access-bus-id = <0>; + #gpio-cells = <2>; + gpio-ranges = <&gpio1 0 0 37>; + + led-controller { + compatible = "realtek,rtl8231-leds"; + status = "disabled"; + }; }; }; diff --git a/target/linux/realtek/dts/rtl8380_netgear_gigabit.dtsi b/target/linux/realtek/dts/rtl8380_netgear_gigabit.dtsi index aca1a14774e2ae..75bf06e674d23a 100644 --- a/target/linux/realtek/dts/rtl8380_netgear_gigabit.dtsi +++ b/target/linux/realtek/dts/rtl8380_netgear_gigabit.dtsi @@ -31,12 +31,23 @@ gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; open-source; }; +}; + +&mdio_aux { + status = "okay"; + + gpio1: expander@31 { + compatible = "realtek,rtl8231"; + reg = <31>; - gpio1: rtl8231-gpio { - compatible = "realtek,rtl8231-gpio"; - #gpio-cells = <2>; gpio-controller; - indirect-access-bus-id = <31>; + #gpio-cells = <2>; + gpio-ranges = <&gpio1 0 0 37>; + + led-controller { + compatible = "realtek,rtl8231-leds"; + status = "disabled"; + }; }; }; diff --git a/target/linux/realtek/dts/rtl8382_iodata_bsh-g24mb.dts b/target/linux/realtek/dts/rtl8382_iodata_bsh-g24mb.dts index 49b55813f9d503..c4f81656042cde 100644 --- a/target/linux/realtek/dts/rtl8382_iodata_bsh-g24mb.dts +++ b/target/linux/realtek/dts/rtl8382_iodata_bsh-g24mb.dts @@ -43,12 +43,23 @@ linux,code = ; }; }; +}; + +&mdio_aux { + status = "okay"; + + gpio1: expander@0 { + compatible = "realtek,rtl8231"; + reg = <0>; - gpio1: rtl8231-gpio { - compatible = "realtek,rtl8231-gpio"; - #gpio-cells = <2>; gpio-controller; - indirect-access-bus-id = <0>; + #gpio-cells = <2>; + gpio-ranges = <&gpio1 0 0 37>; + + led-controller { + compatible = "realtek,rtl8231-leds"; + status = "disabled"; + }; }; }; From f31df0bbba777a8012235b6ff7745b05477d0231 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Sat, 18 Jan 2025 16:51:59 +0100 Subject: [PATCH 504/877] realtek: Drop unused property on DGS-1210 gpio0 The 'indirect-access-id' property on gpio0 is a remnant from the original GPIO driver. This property has not been relevant on the SoC's embedded GPIO controller for a long time, so just drop it. Signed-off-by: Sander Vanheule (cherry picked from commit 022b7d80bf9de326f02c625f2fdeb2fb9c9203a3) --- target/linux/realtek/dts/rtl83xx_d-link_dgs-1210_common.dtsi | 4 ---- 1 file changed, 4 deletions(-) diff --git a/target/linux/realtek/dts/rtl83xx_d-link_dgs-1210_common.dtsi b/target/linux/realtek/dts/rtl83xx_d-link_dgs-1210_common.dtsi index fa623d7a9006ae..c11c26f0791957 100644 --- a/target/linux/realtek/dts/rtl83xx_d-link_dgs-1210_common.dtsi +++ b/target/linux/realtek/dts/rtl83xx_d-link_dgs-1210_common.dtsi @@ -30,10 +30,6 @@ }; }; -&gpio0 { - indirect-access-bus-id = <0>; -}; - &spi0 { status = "okay"; flash@0 { From 94e629a3a9d3cf46d8efee23ad88c101d4611add Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Sun, 12 Jan 2025 17:53:34 +0100 Subject: [PATCH 505/877] realtek: Switch DGS-1210-10P DTS to gpio.dtsi The DTS file for the DGS-1210-10P is slightly different from the other DGS-1210 devices, in that it didn't specify a gpio-restart node when it was added. The gpio-restart has been found to work on the DGS-1210-10P as well, so switch it over to the common definitions. This converts the last device from the product family to the common definition for the (external) GPIOs. Tested-by: Michel Thill Signed-off-by: Sander Vanheule (cherry picked from commit 7c0d1c1eb10a7040af6478742dd053f40b24a467) --- .../dts/rtl8382_d-link_dgs-1210-10p.dts | 29 +++++-------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/target/linux/realtek/dts/rtl8382_d-link_dgs-1210-10p.dts b/target/linux/realtek/dts/rtl8382_d-link_dgs-1210-10p.dts index 1aef88afd4e165..9365f94a500944 100644 --- a/target/linux/realtek/dts/rtl8382_d-link_dgs-1210-10p.dts +++ b/target/linux/realtek/dts/rtl8382_d-link_dgs-1210-10p.dts @@ -2,6 +2,7 @@ #include "rtl838x.dtsi" #include "rtl83xx_d-link_dgs-1210_common.dtsi" +#include "rtl83xx_d-link_dgs-1210_gpio.dtsi" / { compatible = "d-link,dgs-1210-10p", "realtek,rtl838x-soc"; @@ -43,23 +44,6 @@ tx-disable-gpio = <&gpio1 12 GPIO_ACTIVE_HIGH>; }; - keys { - compatible = "gpio-keys-polled"; - poll-interval = <20>; - - mode { - label = "mode"; - gpios = <&gpio1 30 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - reset { - label = "reset"; - gpios = <&gpio1 33 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - leds { link_act { label = "green:link_act"; @@ -76,12 +60,13 @@ gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; }; }; +}; - gpio1: rtl8231-gpio { - compatible = "realtek,rtl8231-gpio"; - #gpio-cells = <2>; - gpio-controller; - indirect-access-bus-id = <0>; +&keys { + mode { + label = "mode"; + gpios = <&gpio1 30 GPIO_ACTIVE_LOW>; + linux,code = ; }; }; From ed4f7a6dec3cad462a8befbdf6d0fb3012ce7459 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Sun, 12 Jan 2025 17:57:33 +0100 Subject: [PATCH 506/877] realtek: switch RTL8231 driver for D-Link DGS-1210 Update the common external GPIO DTSI file for the DGS-1210 devices to use an MDIO device on the auxilairy MDIO bus, as the original driver was doing behind the screen. Switching to the new driver will allow for full pin-control and will no longer reset pin config set by the bootloader. Signed-off-by: Sander Vanheule (cherry picked from commit 3d6a1a7874c991c4bd9719bf0a92ab6630034c67) --- .../dts/rtl83xx_d-link_dgs-1210_gpio.dtsi | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/target/linux/realtek/dts/rtl83xx_d-link_dgs-1210_gpio.dtsi b/target/linux/realtek/dts/rtl83xx_d-link_dgs-1210_gpio.dtsi index b1477aa182148a..ccfeef3a39e1d4 100644 --- a/target/linux/realtek/dts/rtl83xx_d-link_dgs-1210_gpio.dtsi +++ b/target/linux/realtek/dts/rtl83xx_d-link_dgs-1210_gpio.dtsi @@ -17,11 +17,22 @@ linux,code = ; }; }; +}; + +&mdio_aux { + status = "okay"; + + gpio1: expander@0 { + compatible = "realtek,rtl8231"; + reg = <0>; - gpio1: rtl8231-gpio { - compatible = "realtek,rtl8231-gpio"; - #gpio-cells = <2>; gpio-controller; - indirect-access-bus-id = <0>; + #gpio-cells = <2>; + gpio-ranges = <&gpio1 0 0 37>; + + led-controller { + compatible = "realtek,rtl8231-leds"; + status = "disabled"; + }; }; }; From 28fb32a5507c7d3f30aadb820e8132702e991a84 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Mon, 27 Jan 2025 22:17:57 +0100 Subject: [PATCH 507/877] realtek: add PoE enable line to Netgear GS110TPP By switching to the new RTL8231 driver in commit b7af54d5c18c ("realtek: Simple conversions to RTL8231 MFD driver"), the bootloader state of the RTL8231's pins is now maintained. As the bootloader de-asserts the PoE enable signal, this means PoE output is no longer available. Add a gpio-hog with high output, restoring the line value from when the pin was configured (by default) as an input with a pull-up resistor. This will hard-enable the PoE output, but the individual ports can still be administratively disabled by realtek-poe or a similar tool. Signed-off-by: Sander Vanheule (cherry picked from commit 807074309dff4eff4097900b9de53abce8684e2f) --- target/linux/realtek/dts/rtl8380_netgear_gs110tpp-v1.dts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/target/linux/realtek/dts/rtl8380_netgear_gs110tpp-v1.dts b/target/linux/realtek/dts/rtl8380_netgear_gs110tpp-v1.dts index f694ae3317c685..d25b81c3cb5cf3 100644 --- a/target/linux/realtek/dts/rtl8380_netgear_gs110tpp-v1.dts +++ b/target/linux/realtek/dts/rtl8380_netgear_gs110tpp-v1.dts @@ -37,6 +37,15 @@ }; }; +&gpio1 { + poe-enable { + gpio-hog; + gpios = <10 GPIO_ACTIVE_HIGH>; + output-high; + line-name = "poe-enable"; + }; +}; + &firmware { openwrt,ih-magic = <0x4e474520>; }; From 0ae0766f29e537484748ce6681d78d33ecea8ec6 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Tue, 28 Jan 2025 08:14:03 +0100 Subject: [PATCH 508/877] realtek: drop old RTL8231 driver The old RTL8231 driver integrated the MDIO bus access with the GPIO control ops, making this driver not very portable to newer platforms. It depended on the SoC ID instead of the compatible to determine the MDIO access register, further complicating portability. A new MFD driver is now available, which offers proper pin config as well as optional LED support, which can work on any (bitbanged) MDIO bus. Now that all devices have been migrated, we can drop the old code. Signed-off-by: Sander Vanheule (cherry picked from commit b410f2216c7a4e6c5646f999d18b952b63c85817) --- .../files-6.6/drivers/gpio/gpio-rtl8231.c | 364 ------------------ .../301-gpio-add-rtl8231-driver.patch | 50 --- target/linux/realtek/rtl838x/config-6.6 | 1 - target/linux/realtek/rtl839x/config-6.6 | 1 - target/linux/realtek/rtl930x/config-6.6 | 1 - target/linux/realtek/rtl931x/config-6.6 | 1 - 6 files changed, 418 deletions(-) delete mode 100644 target/linux/realtek/files-6.6/drivers/gpio/gpio-rtl8231.c delete mode 100644 target/linux/realtek/patches-6.6/301-gpio-add-rtl8231-driver.patch diff --git a/target/linux/realtek/files-6.6/drivers/gpio/gpio-rtl8231.c b/target/linux/realtek/files-6.6/drivers/gpio/gpio-rtl8231.c deleted file mode 100644 index 2821591a97ed9d..00000000000000 --- a/target/linux/realtek/files-6.6/drivers/gpio/gpio-rtl8231.c +++ /dev/null @@ -1,364 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only - -#include -#include -#include -#include -#include - -/* RTL8231 registers for LED control */ -#define RTL8231_LED_FUNC0 0x0000 -#define RTL8231_LED_FUNC1 0x0001 -#define RTL8231_READY_MASK 0x03f0 -#define RTL8231_READY_VALUE 0x0370 -#define RTL8231_GPIO_PIN_SEL(gpio) ((0x0002) + ((gpio) >> 4)) -#define RTL8231_GPIO_DIR(gpio) ((0x0005) + ((gpio) >> 4)) -#define RTL8231_GPIO_DATA(gpio) ((0x001C) + ((gpio) >> 4)) - -#define USEC_TIMEOUT 5000 - -#define RTL8231_SMI_BUS_ID_MAX 0x1F - -struct rtl8231_gpios { - struct gpio_chip gc; - struct device *dev; - u32 id; - u32 smi_bus_id; - u16 reg_shadow[0x20]; - u32 reg_cached; - int ext_gpio_indrt_access; -}; - -extern struct rtl83xx_soc_info soc_info; - -DEFINE_MUTEX(miim_lock); - -static u32 rtl8231_read(struct rtl8231_gpios *gpios, u32 reg) -{ - u32 t = 0, n = 0; - - reg &= 0x1f; - - /* Calculate read register address */ - t = (gpios->smi_bus_id << 2) | (reg << 7); - - /* Set execution bit: cleared when operation completed */ - t |= 1; - - /* Start execution */ - sw_w32(t, gpios->ext_gpio_indrt_access); - do { - udelay(1); - t = sw_r32(gpios->ext_gpio_indrt_access); - n++; - } while ((t & 1) && (n < USEC_TIMEOUT)); - - if (n >= USEC_TIMEOUT) - return 0x80000000; - - pr_debug("%s: %x, %x, %x\n", __func__, gpios->smi_bus_id, - reg, (t & 0xffff0000) >> 16); - - return (t & 0xffff0000) >> 16; -} - -static int rtl8231_write(struct rtl8231_gpios *gpios, u32 reg, u32 data) -{ - u32 t = 0, n = 0; - - pr_debug("%s: %x, %x, %x\n", __func__, gpios->smi_bus_id, reg, data); - reg &= 0x1f; - - t = (gpios->smi_bus_id << 2) | (reg << 7) | (data << 16); - /* Set write bit */ - t |= 2; - - /* Set execution bit: cleared when operation completed */ - t |= 1; - - /* Start execution */ - sw_w32(t, gpios->ext_gpio_indrt_access); - do { - udelay(1); - t = sw_r32(gpios->ext_gpio_indrt_access); - } while ((t & 1) && (n < USEC_TIMEOUT)); - - if (n >= USEC_TIMEOUT) - return -1; - - return 0; -} - -static u32 rtl8231_read_cached(struct rtl8231_gpios *gpios, u32 reg) -{ - if (reg > 0x1f) - return 0; - - if (gpios->reg_cached & (1 << reg)) - return gpios->reg_shadow[reg]; - - return rtl8231_read(gpios, reg); -} - -/* Set Direction of the RTL8231 pin: - * dir 1: input - * dir 0: output - */ -static int rtl8231_pin_dir(struct rtl8231_gpios *gpios, u32 gpio, u32 dir) -{ - u32 v; - int pin_sel_addr = RTL8231_GPIO_PIN_SEL(gpio); - int pin_dir_addr = RTL8231_GPIO_DIR(gpio); - int dpin = gpio % 16; - - if (gpio > 31) { - pr_debug("WARNING: HIGH pin\n"); - dpin += 5; - pin_dir_addr = pin_sel_addr; - } - - v = rtl8231_read_cached(gpios, pin_dir_addr); - if (v & 0x80000000) { - pr_err("Error reading RTL8231\n"); - return -1; - } - - v = (v & ~(1 << dpin)) | (dir << dpin); - rtl8231_write(gpios, pin_dir_addr, v); - gpios->reg_shadow[pin_dir_addr] = v; - gpios->reg_cached |= 1 << pin_dir_addr; - - return 0; -} - -static int rtl8231_pin_dir_get(struct rtl8231_gpios *gpios, u32 gpio, u32 *dir) -{ - /* dir 1: input - * dir 0: output - */ - - u32 v; - int pin_dir_addr = RTL8231_GPIO_DIR(gpio); - int pin = gpio % 16; - - if (gpio > 31) { - pin_dir_addr = RTL8231_GPIO_PIN_SEL(gpio); - pin += 5; - } - - v = rtl8231_read(gpios, pin_dir_addr); - if (v & (1 << pin)) - *dir = 1; - else - *dir = 0; - - return 0; -} - -static int rtl8231_pin_set(struct rtl8231_gpios *gpios, u32 gpio, u32 data) -{ - u32 v = rtl8231_read(gpios, RTL8231_GPIO_DATA(gpio)); - - pr_debug("%s: %d to %d\n", __func__, gpio, data); - if (v & 0x80000000) { - pr_err("Error reading RTL8231\n"); - return -1; - } - v = (v & ~(1 << (gpio % 16))) | (data << (gpio % 16)); - rtl8231_write(gpios, RTL8231_GPIO_DATA(gpio), v); - gpios->reg_shadow[RTL8231_GPIO_DATA(gpio)] = v; - gpios->reg_cached |= 1 << RTL8231_GPIO_DATA(gpio); - - return 0; -} - -static int rtl8231_pin_get(struct rtl8231_gpios *gpios, u32 gpio, u16 *state) -{ - u32 v = rtl8231_read(gpios, RTL8231_GPIO_DATA(gpio)); - - if (v & 0x80000000) { - pr_err("Error reading RTL8231\n"); - return -1; - } - - *state = v & 0xffff; - - return 0; -} - -static int rtl8231_direction_input(struct gpio_chip *gc, unsigned int offset) -{ - int err; - struct rtl8231_gpios *gpios = gpiochip_get_data(gc); - - pr_debug("%s: %d\n", __func__, offset); - mutex_lock(&miim_lock); - err = rtl8231_pin_dir(gpios, offset, 1); - mutex_unlock(&miim_lock); - - return err; -} - -static int rtl8231_direction_output(struct gpio_chip *gc, unsigned int offset, int value) -{ - int err; - struct rtl8231_gpios *gpios = gpiochip_get_data(gc); - - pr_debug("%s: %d\n", __func__, offset); - mutex_lock(&miim_lock); - err = rtl8231_pin_dir(gpios, offset, 0); - mutex_unlock(&miim_lock); - - if (!err) - err = rtl8231_pin_set(gpios, offset, value); - - return err; -} - -static int rtl8231_get_direction(struct gpio_chip *gc, unsigned int offset) -{ - u32 v = 0; - struct rtl8231_gpios *gpios = gpiochip_get_data(gc); - - pr_debug("%s: %d\n", __func__, offset); - mutex_lock(&miim_lock); - rtl8231_pin_dir_get(gpios, offset, &v); - mutex_unlock(&miim_lock); - - return v; -} - -static int rtl8231_gpio_get(struct gpio_chip *gc, unsigned int offset) -{ - u16 state = 0; - struct rtl8231_gpios *gpios = gpiochip_get_data(gc); - - mutex_lock(&miim_lock); - rtl8231_pin_get(gpios, offset, &state); - mutex_unlock(&miim_lock); - - if (state & (1 << (offset % 16))) - return 1; - - return 0; -} - -void rtl8231_gpio_set(struct gpio_chip *gc, unsigned int offset, int value) -{ - struct rtl8231_gpios *gpios = gpiochip_get_data(gc); - - rtl8231_pin_set(gpios, offset, value); -} - -int rtl8231_init(struct rtl8231_gpios *gpios) -{ - u32 ret; - - pr_info("%s called, MDIO bus ID: %d\n", __func__, gpios->smi_bus_id); - - gpios->reg_cached = 0; - - if (soc_info.family == RTL8390_FAMILY_ID) { - /* RTL8390: Enable external gpio in global led control register */ - sw_w32_mask(0x7 << 18, 0x4 << 18, RTL839X_LED_GLB_CTRL); - } else if (soc_info.family == RTL8380_FAMILY_ID) { - /* RTL8380: Enable RTL8231 indirect access mode */ - sw_w32_mask(0, 1, RTL838X_EXTRA_GPIO_CTRL); - sw_w32_mask(3, 1, RTL838X_DMY_REG5); - } - - ret = rtl8231_read(gpios, RTL8231_LED_FUNC1); - if ((ret & 0x80000000) || ((ret & RTL8231_READY_MASK) != RTL8231_READY_VALUE)) - return -ENXIO; - - /* Select GPIO functionality and force input direction for pins 0-36 */ - rtl8231_write(gpios, RTL8231_GPIO_PIN_SEL(0), 0xffff); - rtl8231_write(gpios, RTL8231_GPIO_DIR(0), 0xffff); - rtl8231_write(gpios, RTL8231_GPIO_PIN_SEL(16), 0xffff); - rtl8231_write(gpios, RTL8231_GPIO_DIR(16), 0xffff); - rtl8231_write(gpios, RTL8231_GPIO_PIN_SEL(32), 0x03ff); - - /* Set LED_Start to enable drivers for output mode */ - rtl8231_write(gpios, RTL8231_LED_FUNC0, 1 << 1); - - return 0; -} - -static const struct of_device_id rtl8231_gpio_of_match[] = { - { .compatible = "realtek,rtl8231-gpio" }, - {}, -}; - -MODULE_DEVICE_TABLE(of, rtl8231_gpio_of_match); - -static int rtl8231_gpio_probe(struct platform_device *pdev) -{ - struct device *dev = &pdev->dev; - struct device_node *np = dev->of_node; - struct rtl8231_gpios *gpios; - int err; - - pr_info("Probing RTL8231 GPIOs\n"); - - if (!np) { - dev_err(&pdev->dev, "No DT found\n"); - return -EINVAL; - } - - gpios = devm_kzalloc(dev, sizeof(*gpios), GFP_KERNEL); - if (!gpios) - return -ENOMEM; - - gpios->id = soc_info.id; - if (soc_info.family == RTL8380_FAMILY_ID) { - gpios->ext_gpio_indrt_access = RTL838X_EXT_GPIO_INDRT_ACCESS; - } - - if (soc_info.family == RTL8390_FAMILY_ID) { - gpios->ext_gpio_indrt_access = RTL839X_EXT_GPIO_INDRT_ACCESS; - } - - err = of_property_read_u32(np, "indirect-access-bus-id", &gpios->smi_bus_id); - if (!err && gpios->smi_bus_id > RTL8231_SMI_BUS_ID_MAX) - err = -EINVAL; - - if (err) { - dev_err(dev, "invalid or missing indirect-access-bus-id\n"); - return err; - } - - err = rtl8231_init(gpios); - if (err) { - dev_err(dev, "no device found at bus address %d\n", gpios->smi_bus_id); - return err; - } - - gpios->dev = dev; - gpios->gc.base = -1; - gpios->gc.ngpio = 37; - gpios->gc.label = "rtl8231"; - gpios->gc.parent = dev; - gpios->gc.owner = THIS_MODULE; - gpios->gc.can_sleep = true; - - gpios->gc.direction_input = rtl8231_direction_input; - gpios->gc.direction_output = rtl8231_direction_output; - gpios->gc.set = rtl8231_gpio_set; - gpios->gc.get = rtl8231_gpio_get; - gpios->gc.get_direction = rtl8231_get_direction; - - return devm_gpiochip_add_data(dev, &gpios->gc, gpios); -} - -static struct platform_driver rtl8231_gpio_driver = { - .driver = { - .name = "rtl8231-gpio", - .of_match_table = rtl8231_gpio_of_match, - }, - .probe = rtl8231_gpio_probe, -}; - -module_platform_driver(rtl8231_gpio_driver); - -MODULE_DESCRIPTION("Realtek RTL8231 GPIO expansion chip support"); -MODULE_LICENSE("GPL v2"); diff --git a/target/linux/realtek/patches-6.6/301-gpio-add-rtl8231-driver.patch b/target/linux/realtek/patches-6.6/301-gpio-add-rtl8231-driver.patch deleted file mode 100644 index f64e2cf94eff8c..00000000000000 --- a/target/linux/realtek/patches-6.6/301-gpio-add-rtl8231-driver.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 2b88563ee5aafd9571d965b7f2093a0f58d98a31 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Thu, 26 Nov 2020 12:02:21 +0100 -Subject: [PATCH] realtek: update the tree to the latest refactored version -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -* rename the target to realtek -* add refactored DSA driver -* add latest gpio driver -* lots of arch cleanups -* new irq driver -* additional boards - -Submitted-by: Bert Vermeulen -Submitted-by: Birger Koblitz -Submitted-by: Sander Vanheule -Submitted-by: Bjørn Mork -Submitted-by: John Crispin ---- - drivers/gpio/Kconfig | 6 ++++++ - drivers/gpio/Makefile | 1 + - 2 files changed, 7 insertions(+) - ---- a/drivers/gpio/Kconfig -+++ b/drivers/gpio/Kconfig -@@ -553,6 +553,12 @@ config GPIO_ROCKCHIP - help - Say yes here to support GPIO on Rockchip SoCs. - -+config GPIO_RTL8231 -+ tristate "RTL8231 GPIO" -+ depends on MACH_REALTEK_RTL -+ help -+ Say yes here to support Realtek RTL8231 GPIO expansion chips. -+ - config GPIO_SAMA5D2_PIOBU - tristate "SAMA5D2 PIOBU GPIO support" - depends on MFD_SYSCON ---- a/drivers/gpio/Makefile -+++ b/drivers/gpio/Makefile -@@ -138,6 +138,7 @@ obj-$(CONFIG_GPIO_RDC321X) += gpio-rdc3 - obj-$(CONFIG_GPIO_REALTEK_OTTO) += gpio-realtek-otto.o - obj-$(CONFIG_GPIO_REG) += gpio-reg.o - obj-$(CONFIG_GPIO_ROCKCHIP) += gpio-rockchip.o -+obj-$(CONFIG_GPIO_RTL8231) += gpio-rtl8231.o - obj-$(CONFIG_ARCH_SA1100) += gpio-sa1100.o - obj-$(CONFIG_GPIO_SAMA5D2_PIOBU) += gpio-sama5d2-piobu.o - obj-$(CONFIG_GPIO_SCH311X) += gpio-sch311x.o diff --git a/target/linux/realtek/rtl838x/config-6.6 b/target/linux/realtek/rtl838x/config-6.6 index 0621763ca7d5ca..274073fd6357d4 100644 --- a/target/linux/realtek/rtl838x/config-6.6 +++ b/target/linux/realtek/rtl838x/config-6.6 @@ -88,7 +88,6 @@ CONFIG_GPIO_PCA953X=y CONFIG_GPIO_PCA953X_IRQ=y CONFIG_GPIO_REALTEK_OTTO=y CONFIG_GPIO_REGMAP=y -CONFIG_GPIO_RTL8231=y CONFIG_GPIO_WATCHDOG=y # CONFIG_GPIO_WATCHDOG_ARCH_INITCALL is not set CONFIG_GRO_CELLS=y diff --git a/target/linux/realtek/rtl839x/config-6.6 b/target/linux/realtek/rtl839x/config-6.6 index c84898ec3e3eb7..f29533dab5d205 100644 --- a/target/linux/realtek/rtl839x/config-6.6 +++ b/target/linux/realtek/rtl839x/config-6.6 @@ -88,7 +88,6 @@ CONFIG_GPIO_PCA953X=y CONFIG_GPIO_PCA953X_IRQ=y CONFIG_GPIO_REALTEK_OTTO=y CONFIG_GPIO_REGMAP=y -CONFIG_GPIO_RTL8231=y CONFIG_GPIO_WATCHDOG=y # CONFIG_GPIO_WATCHDOG_ARCH_INITCALL is not set CONFIG_GRO_CELLS=y diff --git a/target/linux/realtek/rtl930x/config-6.6 b/target/linux/realtek/rtl930x/config-6.6 index 4f4129ed739c9b..2d4694599128c5 100644 --- a/target/linux/realtek/rtl930x/config-6.6 +++ b/target/linux/realtek/rtl930x/config-6.6 @@ -69,7 +69,6 @@ CONFIG_GPIO_CDEV=y CONFIG_GPIO_GENERIC=y CONFIG_GPIO_PCA953X=y CONFIG_GPIO_REALTEK_OTTO=y -CONFIG_GPIO_RTL8231=y CONFIG_GRO_CELLS=y CONFIG_HANDLE_DOMAIN_IRQ=y CONFIG_HARDWARE_WATCHPOINTS=y diff --git a/target/linux/realtek/rtl931x/config-6.6 b/target/linux/realtek/rtl931x/config-6.6 index d2d052f2d14fe8..255ff9b2a0af5b 100644 --- a/target/linux/realtek/rtl931x/config-6.6 +++ b/target/linux/realtek/rtl931x/config-6.6 @@ -75,7 +75,6 @@ CONFIG_GPIOLIB_IRQCHIP=y CONFIG_GPIO_CDEV=y CONFIG_GPIO_GENERIC=y CONFIG_GPIO_REALTEK_OTTO=y -CONFIG_GPIO_RTL8231=y CONFIG_GRO_CELLS=y CONFIG_HANDLE_DOMAIN_IRQ=y CONFIG_HARDWARE_WATCHPOINTS=y From 8f3b24643b40e14be1c9c092c74030c29fa9d8c2 Mon Sep 17 00:00:00 2001 From: Evan Jobling Date: Thu, 23 Jan 2025 00:13:35 +0000 Subject: [PATCH 509/877] realtek: HPE 1920-48G-PoE: allow fan speed control The JG928A has an RTL8231 on the aux mdio bus. Add it to dts to expose the GPIO pins used to control and monitor the fan speed. To enable speed control, add the appropriate kernel driver module to DEVICE_PACKAGES. Of note, this does not control all fans for the unit. The power supply fans are not controlled. Signed-off-by: Evan Jobling Link: https://github.com/openwrt/openwrt/pull/17699 Signed-off-by: Sander Vanheule (cherry picked from commit cbd1acbad3448280a180640e2a1a37a7144e1fb3) --- .../realtek/dts/rtl8393_hpe_1920-48g-poe.dts | 29 +++++++++++++++++++ target/linux/realtek/image/rtl839x.mk | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/target/linux/realtek/dts/rtl8393_hpe_1920-48g-poe.dts b/target/linux/realtek/dts/rtl8393_hpe_1920-48g-poe.dts index e2427754341255..9765f80d8817f2 100644 --- a/target/linux/realtek/dts/rtl8393_hpe_1920-48g-poe.dts +++ b/target/linux/realtek/dts/rtl8393_hpe_1920-48g-poe.dts @@ -5,8 +5,37 @@ / { compatible = "hpe,1920-48g-poe", "realtek,rtl8393-soc"; model = "HPE 1920-48G-PoE (JG928A)"; + + gpio_fan_array { + compatible = "gpio-fan"; + + gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>; + gpio-fan,speed-map = <5000 0>, + <8200 1>; + + alarm-gpios = <&gpio1 6 GPIO_ACTIVE_LOW>; + #cooling-cells = <2>; + }; }; &uart1 { status = "okay"; }; + +&mdio_aux { + status = "okay"; + + gpio1: expander@0 { + compatible = "realtek,rtl8231"; + reg = <0>; + + gpio-controller; + #gpio-cells = <2>; + gpio-ranges = <&gpio1 0 0 37>; + + led-controller { + compatible = "realtek,rtl8231-leds"; + status = "disabled"; + }; + }; +}; diff --git a/target/linux/realtek/image/rtl839x.mk b/target/linux/realtek/image/rtl839x.mk index 14d23ff371003c..5f9b6d56c65de1 100644 --- a/target/linux/realtek/image/rtl839x.mk +++ b/target/linux/realtek/image/rtl839x.mk @@ -21,7 +21,7 @@ define Device/hpe_1920-48g-poe $(Device/hpe_1920) SOC := rtl8393 DEVICE_MODEL := 1920-48G-PoE (JG928A) - DEVICE_PACKAGES += realtek-poe + DEVICE_PACKAGES += realtek-poe kmod-hwmon-gpiofan H3C_DEVICE_ID := 0x0001002b endef TARGET_DEVICES += hpe_1920-48g-poe From bb6f183e93883abf85c0648f1aa8e2b94cab7b82 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Sat, 22 Feb 2025 12:06:10 +0100 Subject: [PATCH 510/877] realtek: add PoE enable line to Netgear GS310TP By switching to the new RTL8231 driver in commit b7af54d5c18c ("realtek: Simple conversions to RTL8231 MFD driver"), the bootloader state of the RTL8231's pins is now maintained. As the bootloader de-asserts the PoE enable signal, this means PoE output is no longer available. Add a gpio-hog with high output, restoring the line value from when the pin was configured (by default) as an input with a pull-up resistor. This will hard-enable the PoE output, but the individual ports can still be administratively disabled by realtek-poe or a similar tool. Signed-off-by: Sander Vanheule (cherry picked from commit 890293c13cc0c7e23577cb92c36edcc9911b4400) --- target/linux/realtek/dts/rtl8380_netgear_gs310tp-v1.dts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/target/linux/realtek/dts/rtl8380_netgear_gs310tp-v1.dts b/target/linux/realtek/dts/rtl8380_netgear_gs310tp-v1.dts index a6f7181c11e601..9d58b3028a0bac 100644 --- a/target/linux/realtek/dts/rtl8380_netgear_gs310tp-v1.dts +++ b/target/linux/realtek/dts/rtl8380_netgear_gs310tp-v1.dts @@ -8,6 +8,15 @@ }; +&gpio1 { + poe-enable { + gpio-hog; + gpios = <10 GPIO_ACTIVE_HIGH>; + output-high; + line-name = "poe-enable"; + }; +}; + &firmware { openwrt,ih-magic = <0x4e474335>; }; From 8c1296f157e46f6f594cf4cef1b17d7151893b8d Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 24 Feb 2025 12:26:01 +0100 Subject: [PATCH 511/877] kernel: fix IPv6 TCP GSO segmentation with NAT Add missing checksum update Fixes: https://github.com/openwrt/openwrt/issues/15857 Signed-off-by: Felix Fietkau (cherry picked from commit 00e4b23e27bd4ed3e0370b9b474ec53f72bd1282) --- ...v6-fix-TCP-GSO-segmentation-with-NAT.patch | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 target/linux/generic/pending-6.6/686-net-ipv6-fix-TCP-GSO-segmentation-with-NAT.patch diff --git a/target/linux/generic/pending-6.6/686-net-ipv6-fix-TCP-GSO-segmentation-with-NAT.patch b/target/linux/generic/pending-6.6/686-net-ipv6-fix-TCP-GSO-segmentation-with-NAT.patch new file mode 100644 index 00000000000000..9591e16ec9107d --- /dev/null +++ b/target/linux/generic/pending-6.6/686-net-ipv6-fix-TCP-GSO-segmentation-with-NAT.patch @@ -0,0 +1,54 @@ +From: Felix Fietkau +Date: Mon, 24 Feb 2025 12:18:23 +0100 +Subject: [PATCH] net: ipv6: fix TCP GSO segmentation with NAT + +When updating the source/destination address, the TCP/UDP checksum needs to +be updated as well. + +Fixes: bee88cd5bd83 ("net: add support for segmenting TCP fraglist GSO packets") +Signed-off-by: Felix Fietkau +--- + +--- a/net/ipv6/tcpv6_offload.c ++++ b/net/ipv6/tcpv6_offload.c +@@ -112,24 +112,36 @@ static struct sk_buff *__tcpv6_gso_segme + struct sk_buff *seg; + struct tcphdr *th2; + struct ipv6hdr *iph2; ++ bool addr_equal; + + seg = segs; + th = tcp_hdr(seg); + iph = ipv6_hdr(seg); + th2 = tcp_hdr(seg->next); + iph2 = ipv6_hdr(seg->next); ++ addr_equal = ipv6_addr_equal(&iph->saddr, &iph2->saddr) && ++ ipv6_addr_equal(&iph->daddr, &iph2->daddr); + + if (!(*(const u32 *)&th->source ^ *(const u32 *)&th2->source) && +- ipv6_addr_equal(&iph->saddr, &iph2->saddr) && +- ipv6_addr_equal(&iph->daddr, &iph2->daddr)) ++ addr_equal) + return segs; + + while ((seg = seg->next)) { + th2 = tcp_hdr(seg); + iph2 = ipv6_hdr(seg); + +- iph2->saddr = iph->saddr; +- iph2->daddr = iph->daddr; ++ if (!addr_equal) { ++ inet_proto_csum_replace16(&th2->check, seg, ++ iph2->saddr.s6_addr32, ++ iph->saddr.s6_addr32, ++ true); ++ inet_proto_csum_replace16(&th2->check, seg, ++ iph2->daddr.s6_addr32, ++ iph->daddr.s6_addr32, ++ true); ++ iph2->saddr = iph->saddr; ++ iph2->daddr = iph->daddr; ++ } + __tcpv6_gso_segment_csum(seg, &th2->source, th->source); + __tcpv6_gso_segment_csum(seg, &th2->dest, th->dest); + } From 2343699c8c34ec1117664a38ff4fcbeb602dcd69 Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Mon, 13 Jan 2025 19:46:10 +0900 Subject: [PATCH 512/877] tools: firmware-utils: update to Git HEAD (2024-01-14) 12c0b42 nosimg-enc: add new tool for XikeStor SKS8300 series Signed-off-by: INAGAKI Hiroshi Link: https://github.com/openwrt/openwrt/pull/17593 Signed-off-by: Sander Vanheule (cherry picked from commit db0fcc0c8dd4424631931aea5dbb7050fa88d088) Link: https://github.com/openwrt/openwrt/pull/18030 Signed-off-by: Hauke Mehrtens --- 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 62222b6dafc2d8..117dceb7543983 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-10-20 -PKG_SOURCE_VERSION:=4b7638925d3eac03e614e40bc30cb49f5877c46d -PKG_MIRROR_HASH:=ea0e30f2b20211e4153704019ebb3f8789269893a4af6d853a85fae7c091802c +PKG_SOURCE_DATE:=2025-01-14 +PKG_SOURCE_VERSION:=12c0b42231bee58b3cd7cbe95c33de2685484a4f +PKG_MIRROR_HASH:=50d872a5069f9f672de5ea9efcf00872bcce27ec52bbb69fff3785abcee1c77c include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/cmake.mk From b803517f9099db9763846f2122ac4e80403444cb Mon Sep 17 00:00:00 2001 From: Robert Senderek Date: Mon, 17 Feb 2025 08:15:20 +0100 Subject: [PATCH 513/877] tools: firmware-utils: update to Git HEAD (2024-02-16) 2051fe5 mktplinkfw2: Add 16MLmtk layout 5d1446b tplink-safeloader: Add more special_id's for MR70X Signed-off-by: Robert Senderek Link: https://github.com/openwrt/openwrt/pull/17999 Signed-off-by: Hauke Mehrtens (cherry picked from commit 1437ff840b9b81f62a7cfca02b0ba17f506ea028) Link: https://github.com/openwrt/openwrt/pull/18030 Signed-off-by: Hauke Mehrtens --- 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 117dceb7543983..3caaa8e4372740 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:=2025-01-14 -PKG_SOURCE_VERSION:=12c0b42231bee58b3cd7cbe95c33de2685484a4f -PKG_MIRROR_HASH:=50d872a5069f9f672de5ea9efcf00872bcce27ec52bbb69fff3785abcee1c77c +PKG_SOURCE_DATE:=2025-02-16 +PKG_SOURCE_VERSION:=5d1446bf57d6490573dc71f10c05e83b36d44374 +PKG_MIRROR_HASH:=e054ea416f5a596f681bba593f71dfbe8149361432d7c17f2374c60dfe227749 include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/cmake.mk From 0963a15e7cd4084d052e8461fc68822e42805b11 Mon Sep 17 00:00:00 2001 From: Robert Senderek Date: Fri, 14 Feb 2025 09:01:39 +0100 Subject: [PATCH 514/877] ramips: Add support for Mercusys MR1800X as alt name of MR70X Both share the same OEM firmware but differ in product_name for safeloader product_name:MR1800X,product_ver:1.0.0,special_id:45550000 Signed-off-by: Robert Senderek Link: https://github.com/openwrt/openwrt/pull/17965 (cherry picked from commit f93367227e1458fb366304d0f431f12e95d244cd) Link: https://github.com/openwrt/openwrt/pull/18031 Signed-off-by: Hauke Mehrtens --- 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 68fc03d99876bd..02b09b3fe1511f 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -1963,6 +1963,8 @@ define Device/mercusys_mr70x-v1 $(Device/tplink-safeloader) DEVICE_VENDOR := MERCUSYS DEVICE_MODEL := MR70X + DEVICE_ALT0_VENDOR := MERCUSYS + DEVICE_ALT0_MODEL := MR1800X DEVICE_VARIANT := v1 DEVICE_PACKAGES := kmod-mt7915-firmware -uboot-envtools TPLINK_BOARD_ID := MR70X From 79ba16309029879b0678dc0525b0a56eef5e4acf Mon Sep 17 00:00:00 2001 From: Tim Harvey Date: Thu, 13 Feb 2025 10:36:09 -0800 Subject: [PATCH 515/877] imx: cortexa53: add 'gateworks,imx8m*' to sysupgrade board checks The upstream device-tree files are now using 'gateworks' instead of 'gw' for compatible. Add this pattern so that the newer boards support sysupgrade. Signed-off-by: Tim Harvey Link: https://github.com/openwrt/openwrt/pull/17964 (cherry picked from commit ee73d35fbe0f18bfd0f710008de369236a220510) Link: https://github.com/openwrt/openwrt/pull/18093 Signed-off-by: Hauke Mehrtens --- target/linux/imx/cortexa53/base-files/lib/upgrade/platform.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/linux/imx/cortexa53/base-files/lib/upgrade/platform.sh b/target/linux/imx/cortexa53/base-files/lib/upgrade/platform.sh index c59a69421af877..f97b55f78941c0 100755 --- a/target/linux/imx/cortexa53/base-files/lib/upgrade/platform.sh +++ b/target/linux/imx/cortexa53/base-files/lib/upgrade/platform.sh @@ -12,6 +12,7 @@ platform_check_image() { local board=$(board_name) case "$board" in + gateworks,imx8m*|\ gw,imx8m*) return 0 ;; @@ -25,6 +26,7 @@ platform_do_upgrade() { local board=$(board_name) case "$board" in + gateworks,imx8m*|\ gw,imx8m*) export_bootdevice && export_partdevice diskdev 0 || { echo "Unable to find root device." @@ -41,6 +43,7 @@ platform_copy_config() { local partdev case "$board" in + gateworks,imx8m*|\ gw,imx8m*) export_partdevice partdev 1 && { v "Storing $UPGRADE_BACKUP on /dev/$partdev..." From c51d899790441e0a37aa0996742369436550eb25 Mon Sep 17 00:00:00 2001 From: Tim Harvey Date: Thu, 13 Feb 2025 10:37:50 -0800 Subject: [PATCH 516/877] imx: cortexa53: fix sysupgrade image device support for venice Set the SUPPORTED_DEVICES Device var so that sysupgrade images are supported without a force. Signed-off-by: Tim Harvey Link: https://github.com/openwrt/openwrt/pull/17964 (cherry picked from commit 5a124ff167ed42e28dba2805793b5ddcece0eb50) Link: https://github.com/openwrt/openwrt/pull/18093 Signed-off-by: Hauke Mehrtens --- target/linux/imx/image/cortexa53.mk | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/target/linux/imx/image/cortexa53.mk b/target/linux/imx/image/cortexa53.mk index 7458162da36aa5..ec3623e8e70b93 100644 --- a/target/linux/imx/image/cortexa53.mk +++ b/target/linux/imx/image/cortexa53.mk @@ -46,6 +46,21 @@ define Device/gateworks_venice FILESYSTEMS := squashfs ext4 DEVICE_VENDOR := Gateworks DEVICE_MODEL := i.MX8M Venice + SUPPORTED_DEVICES := \ + gw,imx8mm-gw71xx-0x \ + gw,imx8mm-gw72xx-0x \ + gw,imx8mp-gw72xx-2x \ + gw,imx8mm-gw73xx-0x \ + gw,imx8mp-gw73xx-2x \ + gw,imx8mm-gw7901 \ + gw,imx8mm-gw7902 \ + gw,imx8mn-gw7902 \ + gw,imx8mm-gw7903 \ + gateworks,imx8mp-gw71xx-2x \ + gateworks,imx8mp-gw74xx \ + gateworks,imx8mm-gw7904 \ + gateworks,imx8mm-gw7905-0x \ + gateworks,imx8mp-gw7905-2x BOOT_SCRIPT := gateworks_venice PARTITION_OFFSET := 16M DEVICE_DTS := $(basename $(notdir $(wildcard $(DTS_DIR)/freescale/imx8m*-venice*.dts))) From 81ef4bc44d81036d35807f032c27ffc07160323d Mon Sep 17 00:00:00 2001 From: John Audia Date: Thu, 23 Jan 2025 12:22:43 -0500 Subject: [PATCH 517/877] kernel: bump 6.6 to 6.6.74 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.74 All patches automatically rebased. Build system: x86/64 Build-tested: bcm27xx/bcm2712, flogic/xiaomi_redmi-router-ax6000-ubootmod Run-tested: bcm27xx/bcm2712, flogic/xiaomi_redmi-router-ax6000-ubootmod Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/17708 (cherry picked from commit e9fad02c101d7d7f45fd6e5eef8a80b848718a44) Link: https://github.com/openwrt/openwrt/pull/17987 Signed-off-by: Hauke Mehrtens --- include/kernel-6.6 | 4 ++-- ...rm-v3d-Suppress-all-but-the-first-MMU-error.patch | 6 +++--- ...ew-debugfs-end-points-to-query-GPU-usage-st.patch | 6 +++--- ...m-v3d-fix-up-register-addresses-for-V3D-7.x.patch | 12 ++++++------ 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/kernel-6.6 b/include/kernel-6.6 index aa0a345b293acc..277669c3902d9c 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .73 -LINUX_KERNEL_HASH-6.6.73 = d2028db190c201650898be8db1c705e9fe73ab44fc04290b4f7af63514122490 +LINUX_VERSION-6.6 = .74 +LINUX_KERNEL_HASH-6.6.74 = f15e2b1a8bab0eba494b07858a5abc88d8f788e25f6fe4a572a77840bbd5494d diff --git a/target/linux/bcm27xx/patches-6.6/950-0183-drm-v3d-Suppress-all-but-the-first-MMU-error.patch b/target/linux/bcm27xx/patches-6.6/950-0183-drm-v3d-Suppress-all-but-the-first-MMU-error.patch index 31c7840e1444e0..eeb65bbd40e699 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0183-drm-v3d-Suppress-all-but-the-first-MMU-error.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0183-drm-v3d-Suppress-all-but-the-first-MMU-error.patch @@ -13,7 +13,7 @@ Signed-off-by: Phil Elwell --- a/drivers/gpu/drm/v3d/v3d_irq.c +++ b/drivers/gpu/drm/v3d/v3d_irq.c -@@ -177,6 +177,7 @@ v3d_hub_irq(int irq, void *arg) +@@ -181,6 +181,7 @@ v3d_hub_irq(int irq, void *arg) "GMP", }; const char *client = "?"; @@ -21,7 +21,7 @@ Signed-off-by: Phil Elwell V3D_WRITE(V3D_MMU_CTL, V3D_READ(V3D_MMU_CTL)); -@@ -186,6 +187,7 @@ v3d_hub_irq(int irq, void *arg) +@@ -190,6 +191,7 @@ v3d_hub_irq(int irq, void *arg) client = v3d41_axi_ids[axi_id]; } @@ -29,7 +29,7 @@ Signed-off-by: Phil Elwell dev_err(v3d->drm.dev, "MMU error from client %s (%d) at 0x%llx%s%s%s\n", client, axi_id, (long long)vio_addr, ((intsts & V3D_HUB_INT_MMU_WRV) ? -@@ -194,6 +196,7 @@ v3d_hub_irq(int irq, void *arg) +@@ -198,6 +200,7 @@ v3d_hub_irq(int irq, void *arg) ", pte invalid" : ""), ((intsts & V3D_HUB_INT_MMU_CAP) ? ", cap exceeded" : "")); diff --git a/target/linux/bcm27xx/patches-6.6/950-0464-drm-v3d-New-debugfs-end-points-to-query-GPU-usage-st.patch b/target/linux/bcm27xx/patches-6.6/950-0464-drm-v3d-New-debugfs-end-points-to-query-GPU-usage-st.patch index aef90564b8f391..01e267fd484bec 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0464-drm-v3d-New-debugfs-end-points-to-query-GPU-usage-st.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0464-drm-v3d-New-debugfs-end-points-to-query-GPU-usage-st.patch @@ -258,7 +258,7 @@ Signed-off-by: Jose Maria Casanova Crespo trace_v3d_bcl_irq(&v3d->drm, fence->seqno); dma_fence_signal(&fence->base); -@@ -109,6 +111,7 @@ v3d_irq(int irq, void *arg) +@@ -110,6 +112,7 @@ v3d_irq(int irq, void *arg) if (intsts & V3D_INT_FRDONE) { struct v3d_fence *fence = to_v3d_fence(v3d->render_job->base.irq_fence); @@ -266,7 +266,7 @@ Signed-off-by: Jose Maria Casanova Crespo trace_v3d_rcl_irq(&v3d->drm, fence->seqno); dma_fence_signal(&fence->base); -@@ -118,6 +121,7 @@ v3d_irq(int irq, void *arg) +@@ -120,6 +123,7 @@ v3d_irq(int irq, void *arg) if (intsts & V3D_INT_CSDDONE) { struct v3d_fence *fence = to_v3d_fence(v3d->csd_job->base.irq_fence); @@ -274,7 +274,7 @@ Signed-off-by: Jose Maria Casanova Crespo trace_v3d_csd_irq(&v3d->drm, fence->seqno); dma_fence_signal(&fence->base); -@@ -154,6 +158,7 @@ v3d_hub_irq(int irq, void *arg) +@@ -157,6 +161,7 @@ v3d_hub_irq(int irq, void *arg) if (intsts & V3D_HUB_INT_TFUC) { struct v3d_fence *fence = to_v3d_fence(v3d->tfu_job->base.irq_fence); diff --git a/target/linux/bcm27xx/patches-6.6/950-0555-drm-v3d-fix-up-register-addresses-for-V3D-7.x.patch b/target/linux/bcm27xx/patches-6.6/950-0555-drm-v3d-fix-up-register-addresses-for-V3D-7.x.patch index 1466d2aadca296..560c2f627f8d18 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0555-drm-v3d-fix-up-register-addresses-for-V3D-7.x.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0555-drm-v3d-fix-up-register-addresses-for-V3D-7.x.patch @@ -295,7 +295,7 @@ v2: fix kernel panic with debug-fs interface to list registers static irqreturn_t v3d_hub_irq(int irq, void *arg); -@@ -118,7 +119,8 @@ v3d_irq(int irq, void *arg) +@@ -120,7 +121,8 @@ v3d_irq(int irq, void *arg) status = IRQ_HANDLED; } @@ -305,7 +305,7 @@ v2: fix kernel panic with debug-fs interface to list registers struct v3d_fence *fence = to_v3d_fence(v3d->csd_job->base.irq_fence); v3d->gpu_queue_stats[V3D_CSD].last_exec_end = local_clock(); -@@ -131,7 +133,7 @@ v3d_irq(int irq, void *arg) +@@ -134,7 +136,7 @@ v3d_irq(int irq, void *arg) /* We shouldn't be triggering these if we have GMP in * always-allowed mode. */ @@ -314,7 +314,7 @@ v2: fix kernel panic with debug-fs interface to list registers dev_err(v3d->drm.dev, "GMP violation\n"); /* V3D 4.2 wires the hub and core IRQs together, so if we & -@@ -205,6 +207,11 @@ v3d_hub_irq(int irq, void *arg) +@@ -209,6 +211,11 @@ v3d_hub_irq(int irq, void *arg) status = IRQ_HANDLED; } @@ -326,7 +326,7 @@ v2: fix kernel panic with debug-fs interface to list registers return status; } -@@ -219,8 +226,8 @@ v3d_irq_init(struct v3d_dev *v3d) +@@ -223,8 +230,8 @@ v3d_irq_init(struct v3d_dev *v3d) * for us. */ for (core = 0; core < v3d->cores; core++) @@ -337,7 +337,7 @@ v2: fix kernel panic with debug-fs interface to list registers irq1 = platform_get_irq_optional(v3d_to_pdev(v3d), 1); if (irq1 == -EPROBE_DEFER) -@@ -264,12 +271,12 @@ v3d_irq_enable(struct v3d_dev *v3d) +@@ -268,12 +275,12 @@ v3d_irq_enable(struct v3d_dev *v3d) /* Enable our set of interrupts, masking out any others. */ for (core = 0; core < v3d->cores; core++) { @@ -354,7 +354,7 @@ v2: fix kernel panic with debug-fs interface to list registers } void -@@ -284,8 +291,8 @@ v3d_irq_disable(struct v3d_dev *v3d) +@@ -288,8 +295,8 @@ v3d_irq_disable(struct v3d_dev *v3d) /* Clear any pending interrupts we might have left. */ for (core = 0; core < v3d->cores; core++) From b71fafbb7070ee514d25c70339c6d4672e26d81e Mon Sep 17 00:00:00 2001 From: John Audia Date: Sun, 9 Feb 2025 10:10:31 -0500 Subject: [PATCH 518/877] kernel: bump 6.6 to 6.6.75 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.75 All patches automatically rebased. Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/17822 (cherry picked from commit 9790417109bb9ae0649f40016173e8622703b186) Link: https://github.com/openwrt/openwrt/pull/17987 Signed-off-by: Hauke Mehrtens --- include/kernel-6.6 | 4 ++-- ...-for-all-the-downstream-rpi-sound-card-dr.patch | 4 ++-- ...-device-quirks-for-Freeway-Airmouse-T3-an.patch | 2 +- ...-v3d-Suppress-all-but-the-first-MMU-error.patch | 6 +++--- ...-debugfs-end-points-to-query-GPU-usage-st.patch | 14 +++++++------- ...v3d-fix-up-register-addresses-for-V3D-7.x.patch | 12 ++++++------ ...jecting-with-source-address-failed-policy.patch | 14 +++++++------- .../generic/pending-6.6/834-ledtrig-libata.patch | 6 +++--- 8 files changed, 31 insertions(+), 31 deletions(-) diff --git a/include/kernel-6.6 b/include/kernel-6.6 index 277669c3902d9c..4586ce50c38116 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .74 -LINUX_KERNEL_HASH-6.6.74 = f15e2b1a8bab0eba494b07858a5abc88d8f788e25f6fe4a572a77840bbd5494d +LINUX_VERSION-6.6 = .75 +LINUX_KERNEL_HASH-6.6.75 = f7dfb1fa9716ba139d0b4c8161535816d400dea21d5943f513448429b1790290 diff --git a/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch b/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch index fe0e2275f10c34..7808827ee8c404 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch @@ -14927,7 +14927,7 @@ Signed-off-by: Phil Elwell config SND_SOC_TFA989X tristate "NXP/Goodix TFA989X (TFA1) amplifiers" depends on I2C -@@ -2404,4 +2422,8 @@ config SND_SOC_LPASS_TX_MACRO +@@ -2405,4 +2423,8 @@ config SND_SOC_LPASS_TX_MACRO select SND_SOC_LPASS_MACRO_COMMON tristate "Qualcomm TX Macro in LPASS(Low Power Audio SubSystem)" @@ -17583,7 +17583,7 @@ Signed-off-by: Phil Elwell * For devices with more than one control interface, we assume the --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c -@@ -2249,6 +2249,8 @@ static const struct usb_audio_quirk_flag +@@ -2251,6 +2251,8 @@ static const struct usb_audio_quirk_flag QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x534d, 0x2109, /* MacroSilicon MS2109 */ QUIRK_FLAG_ALIGN_TRANSFER), diff --git a/target/linux/bcm27xx/patches-6.6/950-0169-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch b/target/linux/bcm27xx/patches-6.6/950-0169-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch index a65d198d21f48f..afdb5aca085aa1 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0169-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0169-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 -@@ -1406,6 +1409,9 @@ +@@ -1405,6 +1408,9 @@ #define USB_VENDOR_ID_XIAOMI 0x2717 #define USB_DEVICE_ID_MI_SILENT_MOUSE 0x5014 diff --git a/target/linux/bcm27xx/patches-6.6/950-0183-drm-v3d-Suppress-all-but-the-first-MMU-error.patch b/target/linux/bcm27xx/patches-6.6/950-0183-drm-v3d-Suppress-all-but-the-first-MMU-error.patch index eeb65bbd40e699..d41fab9d94d9a4 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0183-drm-v3d-Suppress-all-but-the-first-MMU-error.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0183-drm-v3d-Suppress-all-but-the-first-MMU-error.patch @@ -13,7 +13,7 @@ Signed-off-by: Phil Elwell --- a/drivers/gpu/drm/v3d/v3d_irq.c +++ b/drivers/gpu/drm/v3d/v3d_irq.c -@@ -181,6 +181,7 @@ v3d_hub_irq(int irq, void *arg) +@@ -189,6 +189,7 @@ v3d_hub_irq(int irq, void *arg) "GMP", }; const char *client = "?"; @@ -21,7 +21,7 @@ Signed-off-by: Phil Elwell V3D_WRITE(V3D_MMU_CTL, V3D_READ(V3D_MMU_CTL)); -@@ -190,6 +191,7 @@ v3d_hub_irq(int irq, void *arg) +@@ -198,6 +199,7 @@ v3d_hub_irq(int irq, void *arg) client = v3d41_axi_ids[axi_id]; } @@ -29,7 +29,7 @@ Signed-off-by: Phil Elwell dev_err(v3d->drm.dev, "MMU error from client %s (%d) at 0x%llx%s%s%s\n", client, axi_id, (long long)vio_addr, ((intsts & V3D_HUB_INT_MMU_WRV) ? -@@ -198,6 +200,7 @@ v3d_hub_irq(int irq, void *arg) +@@ -206,6 +208,7 @@ v3d_hub_irq(int irq, void *arg) ", pte invalid" : ""), ((intsts & V3D_HUB_INT_MMU_CAP) ? ", cap exceeded" : "")); diff --git a/target/linux/bcm27xx/patches-6.6/950-0464-drm-v3d-New-debugfs-end-points-to-query-GPU-usage-st.patch b/target/linux/bcm27xx/patches-6.6/950-0464-drm-v3d-New-debugfs-end-points-to-query-GPU-usage-st.patch index 01e267fd484bec..6e546e675492f3 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0464-drm-v3d-New-debugfs-end-points-to-query-GPU-usage-st.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0464-drm-v3d-New-debugfs-end-points-to-query-GPU-usage-st.patch @@ -257,31 +257,31 @@ Signed-off-by: Jose Maria Casanova Crespo + v3d->gpu_queue_stats[V3D_BIN].last_exec_end = local_clock(); trace_v3d_bcl_irq(&v3d->drm, fence->seqno); - dma_fence_signal(&fence->base); -@@ -110,6 +112,7 @@ v3d_irq(int irq, void *arg) + +@@ -112,6 +114,7 @@ v3d_irq(int irq, void *arg) if (intsts & V3D_INT_FRDONE) { struct v3d_fence *fence = to_v3d_fence(v3d->render_job->base.irq_fence); + v3d->gpu_queue_stats[V3D_RENDER].last_exec_end = local_clock(); trace_v3d_rcl_irq(&v3d->drm, fence->seqno); - dma_fence_signal(&fence->base); -@@ -120,6 +123,7 @@ v3d_irq(int irq, void *arg) + +@@ -124,6 +127,7 @@ v3d_irq(int irq, void *arg) if (intsts & V3D_INT_CSDDONE) { struct v3d_fence *fence = to_v3d_fence(v3d->csd_job->base.irq_fence); + v3d->gpu_queue_stats[V3D_CSD].last_exec_end = local_clock(); trace_v3d_csd_irq(&v3d->drm, fence->seqno); - dma_fence_signal(&fence->base); -@@ -157,6 +161,7 @@ v3d_hub_irq(int irq, void *arg) + +@@ -163,6 +167,7 @@ v3d_hub_irq(int irq, void *arg) if (intsts & V3D_HUB_INT_TFUC) { struct v3d_fence *fence = to_v3d_fence(v3d->tfu_job->base.irq_fence); + v3d->gpu_queue_stats[V3D_TFU].last_exec_end = local_clock(); trace_v3d_tfu_irq(&v3d->drm, fence->seqno); - dma_fence_signal(&fence->base); + --- a/drivers/gpu/drm/v3d/v3d_sched.c +++ b/drivers/gpu/drm/v3d/v3d_sched.c @@ -19,6 +19,7 @@ diff --git a/target/linux/bcm27xx/patches-6.6/950-0555-drm-v3d-fix-up-register-addresses-for-V3D-7.x.patch b/target/linux/bcm27xx/patches-6.6/950-0555-drm-v3d-fix-up-register-addresses-for-V3D-7.x.patch index 560c2f627f8d18..ca8a34e8e11160 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0555-drm-v3d-fix-up-register-addresses-for-V3D-7.x.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0555-drm-v3d-fix-up-register-addresses-for-V3D-7.x.patch @@ -295,7 +295,7 @@ v2: fix kernel panic with debug-fs interface to list registers static irqreturn_t v3d_hub_irq(int irq, void *arg); -@@ -120,7 +121,8 @@ v3d_irq(int irq, void *arg) +@@ -124,7 +125,8 @@ v3d_irq(int irq, void *arg) status = IRQ_HANDLED; } @@ -305,7 +305,7 @@ v2: fix kernel panic with debug-fs interface to list registers struct v3d_fence *fence = to_v3d_fence(v3d->csd_job->base.irq_fence); v3d->gpu_queue_stats[V3D_CSD].last_exec_end = local_clock(); -@@ -134,7 +136,7 @@ v3d_irq(int irq, void *arg) +@@ -140,7 +142,7 @@ v3d_irq(int irq, void *arg) /* We shouldn't be triggering these if we have GMP in * always-allowed mode. */ @@ -314,7 +314,7 @@ v2: fix kernel panic with debug-fs interface to list registers dev_err(v3d->drm.dev, "GMP violation\n"); /* V3D 4.2 wires the hub and core IRQs together, so if we & -@@ -209,6 +211,11 @@ v3d_hub_irq(int irq, void *arg) +@@ -217,6 +219,11 @@ v3d_hub_irq(int irq, void *arg) status = IRQ_HANDLED; } @@ -326,7 +326,7 @@ v2: fix kernel panic with debug-fs interface to list registers return status; } -@@ -223,8 +230,8 @@ v3d_irq_init(struct v3d_dev *v3d) +@@ -231,8 +238,8 @@ v3d_irq_init(struct v3d_dev *v3d) * for us. */ for (core = 0; core < v3d->cores; core++) @@ -337,7 +337,7 @@ v2: fix kernel panic with debug-fs interface to list registers irq1 = platform_get_irq_optional(v3d_to_pdev(v3d), 1); if (irq1 == -EPROBE_DEFER) -@@ -268,12 +275,12 @@ v3d_irq_enable(struct v3d_dev *v3d) +@@ -276,12 +283,12 @@ v3d_irq_enable(struct v3d_dev *v3d) /* Enable our set of interrupts, masking out any others. */ for (core = 0; core < v3d->cores; core++) { @@ -354,7 +354,7 @@ v2: fix kernel panic with debug-fs interface to list registers } void -@@ -288,8 +295,8 @@ v3d_irq_disable(struct v3d_dev *v3d) +@@ -296,8 +303,8 @@ v3d_irq_disable(struct v3d_dev *v3d) /* Clear any pending interrupts we might have left. */ for (core = 0; core < v3d->cores; core++) diff --git a/target/linux/generic/pending-6.6/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch b/target/linux/generic/pending-6.6/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch index 9cf9117d097122..e239d20409e1a4 100644 --- a/target/linux/generic/pending-6.6/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch +++ b/target/linux/generic/pending-6.6/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch @@ -185,7 +185,7 @@ Signed-off-by: Jonas Gorski cfg->fc_flags |= RTF_REJECT; if (rtm->rtm_type == RTN_LOCAL) -@@ -6284,6 +6315,8 @@ static int ip6_route_dev_notify(struct n +@@ -6299,6 +6330,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 -@@ -6295,6 +6328,7 @@ static int ip6_route_dev_notify(struct n +@@ -6310,6 +6343,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 } -@@ -6495,6 +6529,8 @@ static int __net_init ip6_route_net_init +@@ -6510,6 +6544,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); -@@ -6505,11 +6541,21 @@ static int __net_init ip6_route_net_init +@@ -6520,11 +6556,21 @@ static int __net_init ip6_route_net_init ip6_template_metrics, true); INIT_LIST_HEAD(&net->ipv6.ip6_prohibit_entry->dst.rt_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); -@@ -6536,6 +6582,8 @@ out: +@@ -6551,6 +6597,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: -@@ -6555,6 +6603,7 @@ static void __net_exit ip6_route_net_exi +@@ -6570,6 +6618,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); -@@ -6638,6 +6687,9 @@ void __init ip6_route_init_special_entri +@@ -6653,6 +6702,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-6.6/834-ledtrig-libata.patch b/target/linux/generic/pending-6.6/834-ledtrig-libata.patch index 672d0d54cf30a0..75fe4dca900389 100644 --- a/target/linux/generic/pending-6.6/834-ledtrig-libata.patch +++ b/target/linux/generic/pending-6.6/834-ledtrig-libata.patch @@ -73,7 +73,7 @@ Signed-off-by: Daniel Golle /* clear exclusive status */ if (unlikely(qc->flags & ATA_QCFLAG_CLEAR_EXCL && -@@ -5494,6 +5508,9 @@ struct ata_port *ata_port_alloc(struct a +@@ -5502,6 +5516,9 @@ struct ata_port *ata_port_alloc(struct a ap->stats.unhandled_irq = 1; ap->stats.idle_irq = 1; #endif @@ -83,7 +83,7 @@ Signed-off-by: Daniel Golle ata_sff_port_init(ap); return ap; -@@ -5507,6 +5524,12 @@ void ata_port_free(struct ata_port *ap) +@@ -5515,6 +5532,12 @@ void ata_port_free(struct ata_port *ap) kfree(ap->pmp_link); kfree(ap->slave_link); kfree(ap->ncq_sense_buf); @@ -96,7 +96,7 @@ Signed-off-by: Daniel Golle kfree(ap); } EXPORT_SYMBOL_GPL(ata_port_free); -@@ -5929,7 +5952,23 @@ int ata_host_register(struct ata_host *h +@@ -5937,7 +5960,23 @@ int ata_host_register(struct ata_host *h host->ports[i]->print_id = atomic_inc_return(&ata_print_id); host->ports[i]->local_port_no = i + 1; } From 667b131ad1073b2213154954da9b2920372c4d72 Mon Sep 17 00:00:00 2001 From: John Audia Date: Sun, 9 Feb 2025 07:49:50 -0500 Subject: [PATCH 519/877] kernel: bump 6.6 to 6.6.76 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.76 Manually rebased: bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch imx/patches-6.6/600-PCI-imx6-Start-link-at-max-gen-first-for-IMX8MM-and-IMX8MP.patch Removed upstreamed: bcm27xx/patches-6.6/950-1446-media-i2c-ov9282-Correct-the-exposure-offset.patch[1] bcm47xx/patches-6.6/701-bgmac-reduce-max-frame-size-to-support-just-MTU-1500.patch[2] bcm53xx/patches-6.6/700-bgmac-reduce-max-frame-size-to-support-just-MTU-1500.patch[3] ramips/patches-6.6/003-v6.14-clk-ralink-mtmips-remove-duplicated-xtal-clock-for-Ralink.patch[4] All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.76&id=11c7649c9ec3dcaf0a7760551ad30747d9e02d81 2, 3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.76&id=5e6e723675e54ced5200bcc367e2526badc4070c 4. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.76&id=d0edcd0d18d700d76c61c091a24568b8b8c3b387 Build system: x86/64 Build-tested: bcm27xx/bcm2712, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Run-tested: bcm27xx/bcm2712, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/17822 (cherry picked from commit 84e370f16ca044896e6529d683067c17b565e6fa) Link: https://github.com/openwrt/openwrt/pull/17987 Signed-off-by: Hauke Mehrtens --- include/kernel-6.6 | 4 +-- .../105-uart-add-en7523-support.patch | 2 +- ...kip-reset-control-for-syscon-devices.patch | 8 ++--- .../900-unaligned_access_hacks.patch | 6 ++-- ...ci-add-quirk-for-host-controllers-th.patch | 4 +-- ...all-the-downstream-rpi-sound-card-dr.patch | 2 +- ...und-for-bogus-SET_DEQ_PENDING-endpoi.patch | 2 +- ...53x-Add-ti-tca9554-compatible-string.patch | 2 +- ...-quirks-add-link-TRB-quirk-for-VL805.patch | 2 +- ...5-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch | 6 ++-- ...mstb-Allow-to-build-for-ARCH_BCM2835.patch | 12 +++---- ...wc3-Set-DMA-and-coherent-masks-early.patch | 16 ++++----- ...rcmstb-Use-dynamic-GPIO-base-numbers.patch | 14 ++++---- ...-add-FS-LS-bus-instance-parkmode-dis.patch | 2 +- ...d-support-for-setting-NAK-enhancemen.patch | 2 +- ...-prevent-a-theoretical-race-on-non-c.patch | 2 +- ...c-ov9282-Correct-the-exposure-offset.patch | 31 ----------------- ...-announce-support-for-SER_RS485_RTS_.patch | 2 +- ...-frame-size-to-support-just-MTU-1500.patch | 33 ------------------- ...-frame-size-to-support-just-MTU-1500.patch | 33 ------------------- ...nand-Support-write-protection-settin.patch | 2 +- ...-to-use-SMP-threads-for-backlog-NAPI.patch | 8 ++--- ...-net-Make-USO-depend-on-CSUM-offload.patch | 6 ++-- ...64-if-device-if-driver-is-configured.patch | 2 +- ...-create-a-dummy-net_device-allocator.patch | 6 ++-- ...et-free_netdev-exit-earlier-if-dummy.patch | 2 +- .../hack-6.6/773-bgmac-add-srab-switch.patch | 4 +-- ...ow_offload-handle-netdevice-events-f.patch | 2 +- ...les-ignore-EOPNOTSUPP-on-flowtable-d.patch | 2 +- ...les-fix-bidirectional-offload-regres.patch | 6 ++-- ...0211_ptr-even-with-no-CFG82111-suppo.patch | 2 +- ...e-old-opp-to-config_clks-on-_set_opp.patch | 8 ++--- ...-max-gen-first-for-IMX8MM-and-IMX8MP.patch | 20 ++++++----- .../patches-6.6/410-bt-mtk-serial-fix.patch | 2 +- ...s-add-mmc-related-clocks-for-SoCs-MT.patch | 8 ++--- ...ove-duplicated-xtal-clock-for-Ralink.patch | 28 ---------------- .../810-uvc-add-iPassion-iP2970-support.patch | 2 +- ...c3-add-optional-PHY-interface-clocks.patch | 2 +- ...t-8250-Add-dw-auto-flow-ctrl-support.patch | 2 +- ...ove-performance-usb-using-lowmem-for.patch | 2 +- 40 files changed, 89 insertions(+), 212 deletions(-) delete mode 100644 target/linux/bcm27xx/patches-6.6/950-1446-media-i2c-ov9282-Correct-the-exposure-offset.patch delete mode 100644 target/linux/bcm47xx/patches-6.6/701-bgmac-reduce-max-frame-size-to-support-just-MTU-1500.patch delete mode 100644 target/linux/bcm53xx/patches-6.6/700-bgmac-reduce-max-frame-size-to-support-just-MTU-1500.patch delete mode 100644 target/linux/ramips/patches-6.6/003-v6.14-clk-ralink-mtmips-remove-duplicated-xtal-clock-for-Ralink.patch diff --git a/include/kernel-6.6 b/include/kernel-6.6 index 4586ce50c38116..0dcd32546d4ed3 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .75 -LINUX_KERNEL_HASH-6.6.75 = f7dfb1fa9716ba139d0b4c8161535816d400dea21d5943f513448429b1790290 +LINUX_VERSION-6.6 = .76 +LINUX_KERNEL_HASH-6.6.76 = 81168b15f0c64034a2ab553ae37a5a38b79c3fe10f69faccc9f374ced4eb13a0 diff --git a/target/linux/airoha/patches-6.6/105-uart-add-en7523-support.patch b/target/linux/airoha/patches-6.6/105-uart-add-en7523-support.patch index 38611b907ce982..80b6550be3239d 100644 --- a/target/linux/airoha/patches-6.6/105-uart-add-en7523-support.patch +++ b/target/linux/airoha/patches-6.6/105-uart-add-en7523-support.patch @@ -122,7 +122,7 @@ }; /* Uart divisor latch read */ -@@ -2880,6 +2888,12 @@ serial8250_do_set_termios(struct uart_po +@@ -2881,6 +2889,12 @@ serial8250_do_set_termios(struct uart_po serial8250_set_divisor(port, baud, quot, frac); diff --git a/target/linux/ath79/patches-6.6/820-mfd-syscon-support-skip-reset-control-for-syscon-devices.patch b/target/linux/ath79/patches-6.6/820-mfd-syscon-support-skip-reset-control-for-syscon-devices.patch index c73c8443b9f3eb..3bdc2faf3ff81a 100644 --- a/target/linux/ath79/patches-6.6/820-mfd-syscon-support-skip-reset-control-for-syscon-devices.patch +++ b/target/linux/ath79/patches-6.6/820-mfd-syscon-support-skip-reset-control-for-syscon-devices.patch @@ -16,16 +16,16 @@ Signed-off-by: Shiji Yang --- a/drivers/mfd/syscon.c +++ b/drivers/mfd/syscon.c -@@ -52,7 +52,7 @@ static struct syscon *of_syscon_register +@@ -53,7 +53,7 @@ static struct syscon *of_syscon_register int ret; struct regmap_config syscon_config = syscon_regmap_config; struct resource res; - struct reset_control *reset; + struct reset_control *reset = NULL; - syscon = kzalloc(sizeof(*syscon), GFP_KERNEL); - if (!syscon) -@@ -134,7 +134,8 @@ static struct syscon *of_syscon_register + WARN_ON(!mutex_is_locked(&syscon_list_lock)); + +@@ -133,7 +133,8 @@ static struct syscon *of_syscon_register goto err_attach_clk; } diff --git a/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch b/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch index 969cde5ce27901..51f4f542d8bdc8 100644 --- a/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch @@ -350,7 +350,7 @@ SVN-Revision: 35130 list_for_each_entry(p, head, list) { --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c -@@ -622,48 +622,53 @@ static void tcp_options_write(struct tcp +@@ -625,48 +625,53 @@ static void tcp_options_write(struct tcp u16 options = opts->options; /* mungable copy */ if (unlikely(OPTION_MD5 & options)) { @@ -427,7 +427,7 @@ SVN-Revision: 35130 } if (unlikely(opts->num_sack_blocks)) { -@@ -671,16 +676,17 @@ static void tcp_options_write(struct tcp +@@ -674,16 +679,17 @@ static void tcp_options_write(struct tcp tp->duplicate_sack : tp->selective_acks; int this_sack; @@ -451,7 +451,7 @@ SVN-Revision: 35130 } tp->rx_opt.dsack = 0; -@@ -693,13 +699,14 @@ static void tcp_options_write(struct tcp +@@ -696,13 +702,14 @@ static void tcp_options_write(struct tcp if (foc->exp) { len = TCPOLEN_EXP_FASTOPEN_BASE + foc->len; diff --git a/target/linux/bcm27xx/patches-6.6/950-0061-Revert-Revert-xhci-add-quirk-for-host-controllers-th.patch b/target/linux/bcm27xx/patches-6.6/950-0061-Revert-Revert-xhci-add-quirk-for-host-controllers-th.patch index 7dc38f06117884..3898e05aae08b9 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0061-Revert-Revert-xhci-add-quirk-for-host-controllers-th.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0061-Revert-Revert-xhci-add-quirk-for-host-controllers-th.patch @@ -28,7 +28,7 @@ We don't agree with upstream revert so undo it. pdev->device == PCI_DEVICE_ID_ASMEDIA_1042_XHCI) { --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c -@@ -634,8 +634,11 @@ static int xhci_move_dequeue_past_td(str +@@ -635,8 +635,11 @@ static int xhci_move_dequeue_past_td(str struct xhci_ring *ep_ring; struct xhci_command *cmd; struct xhci_segment *new_seg; @@ -40,7 +40,7 @@ We don't agree with upstream revert so undo it. dma_addr_t addr; u64 hw_dequeue; bool cycle_found = false; -@@ -673,7 +676,27 @@ static int xhci_move_dequeue_past_td(str +@@ -674,7 +677,27 @@ static int xhci_move_dequeue_past_td(str hw_dequeue = xhci_get_hw_deq(xhci, dev, ep_index, stream_id); new_seg = ep_ring->deq_seg; new_deq = ep_ring->dequeue; diff --git a/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch b/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch index 7808827ee8c404..1d2f0062582719 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch @@ -17583,7 +17583,7 @@ Signed-off-by: Phil Elwell * For devices with more than one control interface, we assume the --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c -@@ -2251,6 +2251,8 @@ static const struct usb_audio_quirk_flag +@@ -2253,6 +2253,8 @@ static const struct usb_audio_quirk_flag QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x534d, 0x2109, /* MacroSilicon MS2109 */ QUIRK_FLAG_ALIGN_TRANSFER), diff --git a/target/linux/bcm27xx/patches-6.6/950-0162-usb-xhci-workaround-for-bogus-SET_DEQ_PENDING-endpoi.patch b/target/linux/bcm27xx/patches-6.6/950-0162-usb-xhci-workaround-for-bogus-SET_DEQ_PENDING-endpoi.patch index bae92863652b54..9d22d745101c4b 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0162-usb-xhci-workaround-for-bogus-SET_DEQ_PENDING-endpoi.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0162-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 -@@ -739,9 +739,9 @@ deq_found: +@@ -740,9 +740,9 @@ deq_found: } if ((ep->ep_state & SET_DEQ_PENDING)) { diff --git a/target/linux/bcm27xx/patches-6.6/950-0416-gpio-pca953x-Add-ti-tca9554-compatible-string.patch b/target/linux/bcm27xx/patches-6.6/950-0416-gpio-pca953x-Add-ti-tca9554-compatible-string.patch index aa11729b717915..be8e134cf6e5db 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0416-gpio-pca953x-Add-ti-tca9554-compatible-string.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0416-gpio-pca953x-Add-ti-tca9554-compatible-string.patch @@ -10,7 +10,7 @@ Signed-off-by: Phil Elwell --- a/drivers/gpio/gpio-pca953x.c +++ b/drivers/gpio/gpio-pca953x.c -@@ -1347,6 +1347,7 @@ static const struct of_device_id pca953x +@@ -1330,6 +1330,7 @@ static const struct of_device_id pca953x { .compatible = "ti,tca6424", .data = OF_953X(24, PCA_INT), }, { .compatible = "ti,tca9538", .data = OF_953X( 8, PCA_INT), }, { .compatible = "ti,tca9539", .data = OF_953X(16, PCA_INT), }, diff --git a/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch b/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch index 55479438800104..2b267c77924c4f 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch @@ -34,7 +34,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 -@@ -729,6 +729,15 @@ static int xhci_move_dequeue_past_td(str +@@ -730,6 +730,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-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch b/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch index 26abb99fe6ff92..adf25d9495b459 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch @@ -75,7 +75,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 -@@ -3714,6 +3714,48 @@ static int xhci_align_td(struct xhci_hcd +@@ -3715,6 +3715,48 @@ static int xhci_align_td(struct xhci_hcd return 1; } @@ -124,7 +124,7 @@ Signed-off-by: Jonathan Bell /* This is very similar to what ehci-q.c qtd_fill() does */ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, struct urb *urb, int slot_id, unsigned int ep_index) -@@ -3870,6 +3912,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3871,6 +3913,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd * } check_trb_math(urb, enqd_len); @@ -133,7 +133,7 @@ Signed-off-by: Jonathan Bell giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, start_cycle, start_trb); return 0; -@@ -4019,6 +4063,8 @@ int xhci_queue_ctrl_tx(struct xhci_hcd * +@@ -4020,6 +4064,8 @@ int xhci_queue_ctrl_tx(struct xhci_hcd * /* Event on completion */ field | TRB_IOC | TRB_TYPE(TRB_STATUS) | ep_ring->cycle_state); diff --git a/target/linux/bcm27xx/patches-6.6/950-0509-gpio_brcmstb-Allow-to-build-for-ARCH_BCM2835.patch b/target/linux/bcm27xx/patches-6.6/950-0509-gpio_brcmstb-Allow-to-build-for-ARCH_BCM2835.patch index a6a976257b9ef8..cef1bf42a11f88 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0509-gpio_brcmstb-Allow-to-build-for-ARCH_BCM2835.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0509-gpio_brcmstb-Allow-to-build-for-ARCH_BCM2835.patch @@ -53,16 +53,16 @@ Signed-off-by: Phil Elwell help --- a/drivers/gpio/gpio-brcmstb.c +++ b/drivers/gpio/gpio-brcmstb.c -@@ -639,6 +639,8 @@ static int brcmstb_gpio_probe(struct pla +@@ -637,6 +637,8 @@ static int brcmstb_gpio_probe(struct pla #if defined(CONFIG_MIPS) && defined(__BIG_ENDIAN) flags = BGPIOF_BIG_ENDIAN_BYTE_ORDER; #endif + if (of_property_read_bool(np, "brcm,gpio-direct")) + flags |= BGPIOF_REG_DIRECT; - of_property_for_each_u32(np, "brcm,gpio-bank-widths", prop, p, - bank_width) { -@@ -688,7 +690,9 @@ static int brcmstb_gpio_probe(struct pla + of_property_for_each_u32(np, "brcm,gpio-bank-widths", bank_width) { + struct brcmstb_gpio_bank *bank; +@@ -685,7 +687,9 @@ static int brcmstb_gpio_probe(struct pla } gc->owner = THIS_MODULE; @@ -73,7 +73,7 @@ Signed-off-by: Phil Elwell if (!gc->label) { err = -ENOMEM; goto fail; -@@ -697,7 +701,7 @@ static int brcmstb_gpio_probe(struct pla +@@ -694,7 +698,7 @@ static int brcmstb_gpio_probe(struct pla gc->of_gpio_n_cells = 2; gc->of_xlate = brcmstb_gpio_of_xlate; /* not all ngpio lines are valid, will use bank width later */ @@ -82,7 +82,7 @@ Signed-off-by: Phil Elwell gc->offset = bank->id * MAX_GPIO_PER_BANK; if (priv->parent_irq > 0) gc->to_irq = brcmstb_gpio_to_irq; -@@ -706,8 +710,10 @@ static int brcmstb_gpio_probe(struct pla +@@ -703,8 +707,10 @@ static int brcmstb_gpio_probe(struct pla * Mask all interrupts by default, since wakeup interrupts may * be retained from S5 cold boot */ diff --git a/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch b/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch index db3b6cd828071d..8a469986f07a14 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch @@ -276,10 +276,10 @@ Signed-off-by: Jonathan Bell u8 tx_max_burst_prd = 0; u8 tx_fifo_resize_max_num; + u8 axi_pipe_limit; - const char *usb_psy_name; - int ret; -@@ -1527,6 +1566,9 @@ static void dwc3_get_properties(struct d + /* default to highest possible threshold */ + lpm_nyet_threshold = 0xf; +@@ -1525,6 +1564,9 @@ static void dwc3_get_properties(struct d */ tx_fifo_resize_max_num = 6; @@ -289,7 +289,7 @@ Signed-off-by: Jonathan Bell dwc->maximum_speed = usb_get_maximum_speed(dev); dwc->max_ssp_rate = usb_get_maximum_ssp_rate(dev); dwc->dr_mode = usb_get_dr_mode(dev); -@@ -1648,6 +1690,9 @@ static void dwc3_get_properties(struct d +@@ -1639,6 +1681,9 @@ static void dwc3_get_properties(struct d dwc->dis_split_quirk = device_property_read_bool(dev, "snps,dis-split-quirk"); @@ -299,7 +299,7 @@ Signed-off-by: Jonathan Bell dwc->lpm_nyet_threshold = lpm_nyet_threshold; dwc->tx_de_emphasis = tx_de_emphasis; -@@ -1665,6 +1710,8 @@ static void dwc3_get_properties(struct d +@@ -1656,6 +1701,8 @@ static void dwc3_get_properties(struct d dwc->tx_thr_num_pkt_prd = tx_thr_num_pkt_prd; dwc->tx_max_burst_prd = tx_max_burst_prd; @@ -308,9 +308,9 @@ Signed-off-by: Jonathan Bell dwc->imod_interval = 0; dwc->tx_fifo_resize_max_num = tx_fifo_resize_max_num; -@@ -1940,6 +1987,12 @@ static int dwc3_probe(struct platform_de - - dwc3_get_properties(dwc); +@@ -1952,6 +1999,12 @@ static int dwc3_probe(struct platform_de + if (IS_ERR(dwc->usb_psy)) + return dev_err_probe(dev, PTR_ERR(dwc->usb_psy), "couldn't get usb power supply\n"); + if (!dwc->sysdev_is_parent) { + ret = dma_set_mask_and_coherent(dwc->sysdev, DMA_BIT_MASK(64)); diff --git a/target/linux/bcm27xx/patches-6.6/950-0661-gpio-brcmstb-Use-dynamic-GPIO-base-numbers.patch b/target/linux/bcm27xx/patches-6.6/950-0661-gpio-brcmstb-Use-dynamic-GPIO-base-numbers.patch index 1f0907f39994fe..2886d9427fc80b 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0661-gpio-brcmstb-Use-dynamic-GPIO-base-numbers.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0661-gpio-brcmstb-Use-dynamic-GPIO-base-numbers.patch @@ -61,8 +61,8 @@ Fixes: 3b0213d56eb7 ("gpio: Add GPIO support for Broadcom STB SoCs") if (offset >= gc->ngpio || offset < 0) return -EINVAL; -@@ -598,8 +598,8 @@ static int brcmstb_gpio_probe(struct pla - const __be32 *p; +@@ -596,8 +596,8 @@ static int brcmstb_gpio_probe(struct pla + struct resource *res; u32 bank_width; int num_banks = 0; + int num_gpios = 0; @@ -71,7 +71,7 @@ Fixes: 3b0213d56eb7 ("gpio: Add GPIO support for Broadcom STB SoCs") unsigned long flags = 0; bool need_wakeup_event = false; -@@ -613,7 +613,6 @@ static int brcmstb_gpio_probe(struct pla +@@ -611,7 +611,6 @@ static int brcmstb_gpio_probe(struct pla if (IS_ERR(reg_base)) return PTR_ERR(reg_base); @@ -79,7 +79,7 @@ Fixes: 3b0213d56eb7 ("gpio: Add GPIO support for Broadcom STB SoCs") priv->reg_base = reg_base; priv->pdev = pdev; -@@ -655,7 +654,7 @@ static int brcmstb_gpio_probe(struct pla +@@ -652,7 +651,7 @@ static int brcmstb_gpio_probe(struct pla dev_dbg(dev, "Width 0 found: Empty bank @ %d\n", num_banks); num_banks++; @@ -88,7 +88,7 @@ Fixes: 3b0213d56eb7 ("gpio: Add GPIO support for Broadcom STB SoCs") continue; } -@@ -697,7 +696,7 @@ static int brcmstb_gpio_probe(struct pla +@@ -694,7 +693,7 @@ static int brcmstb_gpio_probe(struct pla err = -ENOMEM; goto fail; } @@ -97,7 +97,7 @@ Fixes: 3b0213d56eb7 ("gpio: Add GPIO support for Broadcom STB SoCs") gc->of_gpio_n_cells = 2; gc->of_xlate = brcmstb_gpio_of_xlate; /* not all ngpio lines are valid, will use bank width later */ -@@ -721,7 +720,7 @@ static int brcmstb_gpio_probe(struct pla +@@ -718,7 +717,7 @@ static int brcmstb_gpio_probe(struct pla bank->id); goto fail; } @@ -106,7 +106,7 @@ Fixes: 3b0213d56eb7 ("gpio: Add GPIO support for Broadcom STB SoCs") dev_dbg(dev, "bank=%d, base=%d, ngpio=%d, width=%d\n", bank->id, gc->base, gc->ngpio, bank->width); -@@ -732,7 +731,7 @@ static int brcmstb_gpio_probe(struct pla +@@ -729,7 +728,7 @@ static int brcmstb_gpio_probe(struct pla num_banks++; } diff --git a/target/linux/bcm27xx/patches-6.6/950-0853-drivers-usb-dwc3-add-FS-LS-bus-instance-parkmode-dis.patch b/target/linux/bcm27xx/patches-6.6/950-0853-drivers-usb-dwc3-add-FS-LS-bus-instance-parkmode-dis.patch index 0441512add1775..abd631b6f7ec77 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0853-drivers-usb-dwc3-add-FS-LS-bus-instance-parkmode-dis.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0853-drivers-usb-dwc3-add-FS-LS-bus-instance-parkmode-dis.patch @@ -26,7 +26,7 @@ Signed-off-by: Jonathan Bell if (DWC3_VER_IS_WITHIN(DWC3, 290A, ANY) && (dwc->maximum_speed == USB_SPEED_HIGH || dwc->maximum_speed == USB_SPEED_FULL)) -@@ -1670,6 +1673,8 @@ static void dwc3_get_properties(struct d +@@ -1661,6 +1664,8 @@ static void dwc3_get_properties(struct d "snps,parkmode-disable-ss-quirk"); dwc->parkmode_disable_hs_quirk = device_property_read_bool(dev, "snps,parkmode-disable-hs-quirk"); diff --git a/target/linux/bcm27xx/patches-6.6/950-1359-usb-dwc3-core-add-support-for-setting-NAK-enhancemen.patch b/target/linux/bcm27xx/patches-6.6/950-1359-usb-dwc3-core-add-support-for-setting-NAK-enhancemen.patch index 8995f6f9dce053..0ed02a82cff15d 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1359-usb-dwc3-core-add-support-for-setting-NAK-enhancemen.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1359-usb-dwc3-core-add-support-for-setting-NAK-enhancemen.patch @@ -35,7 +35,7 @@ Signed-off-by: Jonathan Bell if (dwc->parkmode_disable_ss_quirk) reg |= DWC3_GUCTL1_PARKMODE_DISABLE_SS; -@@ -1669,6 +1675,10 @@ static void dwc3_get_properties(struct d +@@ -1660,6 +1666,10 @@ static void dwc3_get_properties(struct d "snps,resume-hs-terminations"); dwc->ulpi_ext_vbus_drv = device_property_read_bool(dev, "snps,ulpi-ext-vbus-drv"); diff --git a/target/linux/bcm27xx/patches-6.6/950-1361-drivers-usb-xhci-prevent-a-theoretical-race-on-non-c.patch b/target/linux/bcm27xx/patches-6.6/950-1361-drivers-usb-xhci-prevent-a-theoretical-race-on-non-c.patch index c2f37a0fc1fdd1..50819fc7f2070e 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1361-drivers-usb-xhci-prevent-a-theoretical-race-on-non-c.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1361-drivers-usb-xhci-prevent-a-theoretical-race-on-non-c.patch @@ -28,7 +28,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c -@@ -506,6 +506,19 @@ void xhci_ring_ep_doorbell(struct xhci_h +@@ -507,6 +507,19 @@ void xhci_ring_ep_doorbell(struct xhci_h trace_xhci_ring_ep_doorbell(slot_id, DB_VALUE(ep_index, stream_id)); diff --git a/target/linux/bcm27xx/patches-6.6/950-1446-media-i2c-ov9282-Correct-the-exposure-offset.patch b/target/linux/bcm27xx/patches-6.6/950-1446-media-i2c-ov9282-Correct-the-exposure-offset.patch deleted file mode 100644 index f673f547dd8639..00000000000000 --- a/target/linux/bcm27xx/patches-6.6/950-1446-media-i2c-ov9282-Correct-the-exposure-offset.patch +++ /dev/null @@ -1,31 +0,0 @@ -From e23afbf2c7aae9264322eee8e5c72ca1887606df Mon Sep 17 00:00:00 2001 -From: Dave Stevenson -Date: Mon, 9 Dec 2024 10:43:18 +0000 -Subject: [PATCH] media: i2c: ov9282: Correct the exposure offset - -The datasheet lists that "Maximum exposure time is frame -length -25 row periods, where frame length is set by -registers {0x380E, 0x380F}". -However this driver had OV9282_EXPOSURE_OFFSET set to 12 -which allowed that restriction to be violated, and would -result in very under-exposed images. - -Correct the offset. - -Fixes: 14ea315bbeb7 ("media: i2c: Add ov9282 camera sensor driver") -Signed-off-by: Dave Stevenson ---- - drivers/media/i2c/ov9282.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/media/i2c/ov9282.c -+++ b/drivers/media/i2c/ov9282.c -@@ -40,7 +40,7 @@ - /* Exposure control */ - #define OV9282_REG_EXPOSURE 0x3500 - #define OV9282_EXPOSURE_MIN 1 --#define OV9282_EXPOSURE_OFFSET 12 -+#define OV9282_EXPOSURE_OFFSET 25 - #define OV9282_EXPOSURE_STEP 1 - #define OV9282_EXPOSURE_DEFAULT 0x0282 - diff --git a/target/linux/bcm27xx/patches-6.6/950-1464-serial-sc16is7xx-announce-support-for-SER_RS485_RTS_.patch b/target/linux/bcm27xx/patches-6.6/950-1464-serial-sc16is7xx-announce-support-for-SER_RS485_RTS_.patch index f78402d0c52d8c..2f52823afc0f25 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1464-serial-sc16is7xx-announce-support-for-SER_RS485_RTS_.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1464-serial-sc16is7xx-announce-support-for-SER_RS485_RTS_.patch @@ -31,7 +31,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c -@@ -1457,7 +1457,7 @@ static int sc16is7xx_setup_mctrl_ports(s +@@ -1480,7 +1480,7 @@ static int sc16is7xx_setup_mctrl_ports(s } static const struct serial_rs485 sc16is7xx_rs485_supported = { diff --git a/target/linux/bcm47xx/patches-6.6/701-bgmac-reduce-max-frame-size-to-support-just-MTU-1500.patch b/target/linux/bcm47xx/patches-6.6/701-bgmac-reduce-max-frame-size-to-support-just-MTU-1500.patch deleted file mode 100644 index 3a2f4b06ed6d8c..00000000000000 --- a/target/linux/bcm47xx/patches-6.6/701-bgmac-reduce-max-frame-size-to-support-just-MTU-1500.patch +++ /dev/null @@ -1,33 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Fri, 10 Jun 2022 13:10:47 +0200 -Subject: [PATCH] bgmac: reduce max frame size to support just MTU 1500 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -bgmac allocates new replacement buffer before handling each received -frame. Allocating & DMA-preparing 9724 B each time consumes a lot of CPU -time. Ideally bgmac should just respect currently set MTU but it isn't -the case right now. For now just revert back to the old limited frame -size. - -This change bumps NAT masquarade speed by ~95%. - -Ref: 8c7da63978f1 ("bgmac: configure MTU and add support for frames beyond 8192 byte size") -Signed-off-by: Rafał Miłecki ---- - drivers/net/ethernet/broadcom/bgmac.h | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -328,8 +328,7 @@ - #define BGMAC_RX_FRAME_OFFSET 30 /* There are 2 unused bytes between header and real data */ - #define BGMAC_RX_BUF_OFFSET (NET_SKB_PAD + NET_IP_ALIGN - \ - BGMAC_RX_FRAME_OFFSET) --/* Jumbo frame size with FCS */ --#define BGMAC_RX_MAX_FRAME_SIZE 9724 -+#define BGMAC_RX_MAX_FRAME_SIZE 1536 - #define BGMAC_RX_BUF_SIZE (BGMAC_RX_FRAME_OFFSET + BGMAC_RX_MAX_FRAME_SIZE) - #define BGMAC_RX_ALLOC_SIZE (SKB_DATA_ALIGN(BGMAC_RX_BUF_SIZE + BGMAC_RX_BUF_OFFSET) + \ - SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) diff --git a/target/linux/bcm53xx/patches-6.6/700-bgmac-reduce-max-frame-size-to-support-just-MTU-1500.patch b/target/linux/bcm53xx/patches-6.6/700-bgmac-reduce-max-frame-size-to-support-just-MTU-1500.patch deleted file mode 100644 index 3a2f4b06ed6d8c..00000000000000 --- a/target/linux/bcm53xx/patches-6.6/700-bgmac-reduce-max-frame-size-to-support-just-MTU-1500.patch +++ /dev/null @@ -1,33 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Fri, 10 Jun 2022 13:10:47 +0200 -Subject: [PATCH] bgmac: reduce max frame size to support just MTU 1500 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -bgmac allocates new replacement buffer before handling each received -frame. Allocating & DMA-preparing 9724 B each time consumes a lot of CPU -time. Ideally bgmac should just respect currently set MTU but it isn't -the case right now. For now just revert back to the old limited frame -size. - -This change bumps NAT masquarade speed by ~95%. - -Ref: 8c7da63978f1 ("bgmac: configure MTU and add support for frames beyond 8192 byte size") -Signed-off-by: Rafał Miłecki ---- - drivers/net/ethernet/broadcom/bgmac.h | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -328,8 +328,7 @@ - #define BGMAC_RX_FRAME_OFFSET 30 /* There are 2 unused bytes between header and real data */ - #define BGMAC_RX_BUF_OFFSET (NET_SKB_PAD + NET_IP_ALIGN - \ - BGMAC_RX_FRAME_OFFSET) --/* Jumbo frame size with FCS */ --#define BGMAC_RX_MAX_FRAME_SIZE 9724 -+#define BGMAC_RX_MAX_FRAME_SIZE 1536 - #define BGMAC_RX_BUF_SIZE (BGMAC_RX_FRAME_OFFSET + BGMAC_RX_MAX_FRAME_SIZE) - #define BGMAC_RX_ALLOC_SIZE (SKB_DATA_ALIGN(BGMAC_RX_BUF_SIZE + BGMAC_RX_BUF_OFFSET) + \ - SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) diff --git a/target/linux/generic/backport-6.6/400-v6.9-mtd-rawnand-brcmnand-Support-write-protection-settin.patch b/target/linux/generic/backport-6.6/400-v6.9-mtd-rawnand-brcmnand-Support-write-protection-settin.patch index 257624164ac6a6..a7186208b2be25 100644 --- a/target/linux/generic/backport-6.6/400-v6.9-mtd-rawnand-brcmnand-Support-write-protection-settin.patch +++ b/target/linux/generic/backport-6.6/400-v6.9-mtd-rawnand-brcmnand-Support-write-protection-settin.patch @@ -23,7 +23,7 @@ Link: https://lore.kernel.org/linux-mtd/20240223034758.13753-14-william.zhang@br --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c -@@ -3189,6 +3189,10 @@ int brcmnand_probe(struct platform_devic +@@ -3194,6 +3194,10 @@ int brcmnand_probe(struct platform_devic /* Disable XOR addressing */ brcmnand_rmw_reg(ctrl, BRCMNAND_CS_XOR, 0xff, 0, 0); diff --git a/target/linux/generic/backport-6.6/601-v6.10-net-Allow-to-use-SMP-threads-for-backlog-NAPI.patch b/target/linux/generic/backport-6.6/601-v6.10-net-Allow-to-use-SMP-threads-for-backlog-NAPI.patch index b3729e8b6c0a5d..3de258f953460f 100644 --- a/target/linux/generic/backport-6.6/601-v6.10-net-Allow-to-use-SMP-threads-for-backlog-NAPI.patch +++ b/target/linux/generic/backport-6.6/601-v6.10-net-Allow-to-use-SMP-threads-for-backlog-NAPI.patch @@ -250,7 +250,7 @@ Signed-off-by: Paolo Abeni return 0; } -@@ -11299,7 +11340,7 @@ static int dev_cpu_dead(unsigned int old +@@ -11303,7 +11344,7 @@ static int dev_cpu_dead(unsigned int old list_del_init(&napi->poll_list); if (napi->poll == process_backlog) @@ -259,7 +259,7 @@ Signed-off-by: Paolo Abeni else ____napi_schedule(sd, napi); } -@@ -11307,12 +11348,14 @@ static int dev_cpu_dead(unsigned int old +@@ -11311,12 +11352,14 @@ static int dev_cpu_dead(unsigned int old raise_softirq_irqoff(NET_TX_SOFTIRQ); local_irq_enable(); @@ -278,7 +278,7 @@ Signed-off-by: Paolo Abeni /* Process offline CPU's input_pkt_queue */ while ((skb = __skb_dequeue(&oldsd->process_queue))) { -@@ -11575,6 +11618,38 @@ static struct pernet_operations __net_in +@@ -11579,6 +11622,38 @@ static struct pernet_operations __net_in * */ @@ -317,7 +317,7 @@ Signed-off-by: Paolo Abeni /* * This is called single threaded during boot, so no need * to take the rtnl semaphore. -@@ -11625,7 +11700,10 @@ static int __init net_dev_init(void) +@@ -11629,7 +11704,10 @@ static int __init net_dev_init(void) init_gro_hash(&sd->backlog); sd->backlog.poll = process_backlog; sd->backlog.weight = weight_p; diff --git a/target/linux/generic/backport-6.6/611-02-v6.11-net-Make-USO-depend-on-CSUM-offload.patch b/target/linux/generic/backport-6.6/611-02-v6.11-net-Make-USO-depend-on-CSUM-offload.patch index 6b5272d583f97d..6cd162ff1cea7d 100644 --- a/target/linux/generic/backport-6.6/611-02-v6.11-net-Make-USO-depend-on-CSUM-offload.patch +++ b/target/linux/generic/backport-6.6/611-02-v6.11-net-Make-USO-depend-on-CSUM-offload.patch @@ -20,7 +20,7 @@ Signed-off-by: Jakub Kicinski --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -9761,6 +9761,15 @@ static void netdev_sync_lower_features(s +@@ -9765,6 +9765,15 @@ static void netdev_sync_lower_features(s } } @@ -36,7 +36,7 @@ Signed-off-by: Jakub Kicinski static netdev_features_t netdev_fix_features(struct net_device *dev, netdev_features_t features) { -@@ -9842,15 +9851,9 @@ static netdev_features_t netdev_fix_feat +@@ -9846,15 +9855,9 @@ static netdev_features_t netdev_fix_feat features &= ~NETIF_F_LRO; } @@ -55,7 +55,7 @@ Signed-off-by: Jakub Kicinski } if ((features & NETIF_F_HW_TLS_RX) && !(features & NETIF_F_RXCSUM)) { -@@ -9858,6 +9861,11 @@ static netdev_features_t netdev_fix_feat +@@ -9862,6 +9865,11 @@ static netdev_features_t netdev_fix_feat features &= ~NETIF_F_HW_TLS_RX; } diff --git a/target/linux/generic/backport-6.6/612-v6.9-net-get-stats64-if-device-if-driver-is-configured.patch b/target/linux/generic/backport-6.6/612-v6.9-net-get-stats64-if-device-if-driver-is-configured.patch index 8f2c26d6543344..21ba0acc5b0ea8 100644 --- a/target/linux/generic/backport-6.6/612-v6.9-net-get-stats64-if-device-if-driver-is-configured.patch +++ b/target/linux/generic/backport-6.6/612-v6.9-net-get-stats64-if-device-if-driver-is-configured.patch @@ -18,7 +18,7 @@ Signed-off-by: Paolo Abeni --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -10668,6 +10668,8 @@ struct rtnl_link_stats64 *dev_get_stats( +@@ -10672,6 +10672,8 @@ struct rtnl_link_stats64 *dev_get_stats( ops->ndo_get_stats64(dev, storage); } else if (ops->ndo_get_stats) { netdev_stats_to_stats64(storage, ops->ndo_get_stats(dev)); diff --git a/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch b/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch index c8b4ccc3004f72..c6718c8e224c39 100644 --- a/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch +++ b/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch @@ -49,7 +49,7 @@ Signed-off-by: David S. Miller unsigned char name_assign_type, --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -10355,25 +10355,12 @@ err_free_name: +@@ -10359,25 +10359,12 @@ err_free_name: } EXPORT_SYMBOL(register_netdevice); @@ -79,7 +79,7 @@ Signed-off-by: David S. Miller /* make sure we BUG if trying to hit standard * register/unregister code path */ -@@ -10393,12 +10380,32 @@ int init_dummy_netdev(struct net_device +@@ -10397,12 +10384,32 @@ int init_dummy_netdev(struct net_device * because users of this 'device' dont need to change * its refcount. */ @@ -113,7 +113,7 @@ Signed-off-by: David S. Miller /** * register_netdev - register a network device * @dev: device to register -@@ -10992,6 +10999,19 @@ void free_netdev(struct net_device *dev) +@@ -10996,6 +11003,19 @@ void free_netdev(struct net_device *dev) EXPORT_SYMBOL(free_netdev); /** diff --git a/target/linux/generic/backport-6.6/900-v6.11-net-free_netdev-exit-earlier-if-dummy.patch b/target/linux/generic/backport-6.6/900-v6.11-net-free_netdev-exit-earlier-if-dummy.patch index 5f7210812fb998..b3a592f078119d 100644 --- a/target/linux/generic/backport-6.6/900-v6.11-net-free_netdev-exit-earlier-if-dummy.patch +++ b/target/linux/generic/backport-6.6/900-v6.11-net-free_netdev-exit-earlier-if-dummy.patch @@ -23,7 +23,7 @@ Signed-off-by: David S. Miller --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -10985,7 +10985,8 @@ void free_netdev(struct net_device *dev) +@@ -10989,7 +10989,8 @@ void free_netdev(struct net_device *dev) dev->xdp_bulkq = NULL; /* Compatibility with error handling in drivers */ diff --git a/target/linux/generic/hack-6.6/773-bgmac-add-srab-switch.patch b/target/linux/generic/hack-6.6/773-bgmac-add-srab-switch.patch index 633cacd1e7c313..40634f9ed0ad2f 100644 --- a/target/linux/generic/hack-6.6/773-bgmac-add-srab-switch.patch +++ b/target/linux/generic/hack-6.6/773-bgmac-add-srab-switch.patch @@ -78,7 +78,7 @@ Signed-off-by: Hauke Mehrtens netif_napi_del(&bgmac->napi); --- a/drivers/net/ethernet/broadcom/bgmac.h +++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -388,6 +388,7 @@ +@@ -387,6 +387,7 @@ #define BGMAC_FEAT_CC4_IF_SW_TYPE_RGMII BIT(18) #define BGMAC_FEAT_CC7_IF_TYPE_RGMII BIT(19) #define BGMAC_FEAT_IDM_MASK BIT(20) @@ -86,7 +86,7 @@ Signed-off-by: Hauke Mehrtens struct bgmac_slot_info { union { -@@ -495,6 +496,9 @@ struct bgmac { +@@ -494,6 +495,9 @@ struct bgmac { void (*cmn_maskset32)(struct bgmac *bgmac, u16 offset, u32 mask, u32 set); int (*phy_connect)(struct bgmac *bgmac); diff --git a/target/linux/generic/pending-6.6/700-netfilter-nft_flow_offload-handle-netdevice-events-f.patch b/target/linux/generic/pending-6.6/700-netfilter-nft_flow_offload-handle-netdevice-events-f.patch index 750ca29287ab2f..c69be593f900cd 100644 --- a/target/linux/generic/pending-6.6/700-netfilter-nft_flow_offload-handle-netdevice-events-f.patch +++ b/target/linux/generic/pending-6.6/700-netfilter-nft_flow_offload-handle-netdevice-events-f.patch @@ -59,7 +59,7 @@ Signed-off-by: Pablo Neira Ayuso } --- a/net/netfilter/nft_flow_offload.c +++ b/net/netfilter/nft_flow_offload.c -@@ -480,47 +480,14 @@ static struct nft_expr_type nft_flow_off +@@ -486,47 +486,14 @@ static struct nft_expr_type nft_flow_off .owner = THIS_MODULE, }; diff --git a/target/linux/generic/pending-6.6/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch b/target/linux/generic/pending-6.6/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch index 6cb52d00a2dad9..373b3e87ba92f9 100644 --- a/target/linux/generic/pending-6.6/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch +++ b/target/linux/generic/pending-6.6/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 -@@ -8425,7 +8425,7 @@ static int nft_register_flowtable_net_ho +@@ -8470,7 +8470,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-6.6/704-netfilter-nf_tables-fix-bidirectional-offload-regres.patch b/target/linux/generic/pending-6.6/704-netfilter-nf_tables-fix-bidirectional-offload-regres.patch index d1d6fa3fe1f12c..a538c3333ed1b9 100644 --- a/target/linux/generic/pending-6.6/704-netfilter-nf_tables-fix-bidirectional-offload-regres.patch +++ b/target/linux/generic/pending-6.6/704-netfilter-nf_tables-fix-bidirectional-offload-regres.patch @@ -14,9 +14,9 @@ Signed-off-by: Felix Fietkau --- a/net/netfilter/nft_flow_offload.c +++ b/net/netfilter/nft_flow_offload.c -@@ -361,6 +361,7 @@ static void nft_flow_offload_eval(const - ct->proto.tcp.seen[1].flags |= IP_CT_TCP_FLAG_BE_LIBERAL; - } +@@ -367,6 +367,7 @@ static void nft_flow_offload_eval(const + if (tcph) + flow_offload_ct_tcp(ct); + __set_bit(NF_FLOW_HW_BIDIRECTIONAL, &flow->flags); ret = flow_offload_add(flowtable, flow); diff --git a/target/linux/generic/pending-6.6/731-net-permit-ieee80211_ptr-even-with-no-CFG82111-suppo.patch b/target/linux/generic/pending-6.6/731-net-permit-ieee80211_ptr-even-with-no-CFG82111-suppo.patch index 1f07c0f62c8c02..8679ffb13f8802 100644 --- a/target/linux/generic/pending-6.6/731-net-permit-ieee80211_ptr-even-with-no-CFG82111-suppo.patch +++ b/target/linux/generic/pending-6.6/731-net-permit-ieee80211_ptr-even-with-no-CFG82111-suppo.patch @@ -19,7 +19,7 @@ Signed-off-by: Christian Marangi +++ b/include/linux/netdevice.h @@ -2243,7 +2243,7 @@ struct net_device { #if IS_ENABLED(CONFIG_AX25) - void *ax25_ptr; + struct ax25_dev __rcu *ax25_ptr; #endif -#if IS_ENABLED(CONFIG_CFG80211) +#if IS_ENABLED(CONFIG_CFG80211_HEADERS) diff --git a/target/linux/generic/pending-6.6/802-OPP-Provide-old-opp-to-config_clks-on-_set_opp.patch b/target/linux/generic/pending-6.6/802-OPP-Provide-old-opp-to-config_clks-on-_set_opp.patch index 7f670914781837..3da2aed0dfca68 100644 --- a/target/linux/generic/pending-6.6/802-OPP-Provide-old-opp-to-config_clks-on-_set_opp.patch +++ b/target/linux/generic/pending-6.6/802-OPP-Provide-old-opp-to-config_clks-on-_set_opp.patch @@ -33,7 +33,7 @@ Signed-off-by: Christian Marangi return 0; --- a/drivers/opp/core.c +++ b/drivers/opp/core.c -@@ -902,7 +902,8 @@ static int _set_opp_voltage(struct devic +@@ -925,7 +925,8 @@ static int _set_opp_voltage(struct devic static int _opp_config_clk_single(struct device *dev, struct opp_table *opp_table, @@ -43,7 +43,7 @@ Signed-off-by: Christian Marangi { unsigned long *target = data; unsigned long freq; -@@ -934,8 +935,8 @@ _opp_config_clk_single(struct device *de +@@ -957,8 +958,8 @@ _opp_config_clk_single(struct device *de * the order in which they are present in the array while scaling up. */ int dev_pm_opp_config_clks_simple(struct device *dev, @@ -54,7 +54,7 @@ Signed-off-by: Christian Marangi { int ret, i; -@@ -1217,7 +1218,7 @@ static int _set_opp(struct device *dev, +@@ -1240,7 +1241,7 @@ static int _set_opp(struct device *dev, } if (opp_table->config_clks) { @@ -63,7 +63,7 @@ Signed-off-by: Christian Marangi if (ret) return ret; } -@@ -1292,7 +1293,7 @@ int dev_pm_opp_set_rate(struct device *d +@@ -1315,7 +1316,7 @@ int dev_pm_opp_set_rate(struct device *d * equivalent to a clk_set_rate() */ if (!_get_opp_count(opp_table)) { diff --git a/target/linux/imx/patches-6.6/600-PCI-imx6-Start-link-at-max-gen-first-for-IMX8MM-and-IMX8MP.patch b/target/linux/imx/patches-6.6/600-PCI-imx6-Start-link-at-max-gen-first-for-IMX8MM-and-IMX8MP.patch index 002c2044622ae0..95069c2c438640 100644 --- a/target/linux/imx/patches-6.6/600-PCI-imx6-Start-link-at-max-gen-first-for-IMX8MM-and-IMX8MP.patch +++ b/target/linux/imx/patches-6.6/600-PCI-imx6-Start-link-at-max-gen-first-for-IMX8MM-and-IMX8MP.patch @@ -30,9 +30,9 @@ Signed-off-by: Tim Harvey #define IMX6_PCIE_FLAG_SUPPORTS_SUSPEND BIT(2) +#define IMX6_PCIE_FLAG_GEN1_LAST BIT(3) - struct imx6_pcie_drvdata { - enum imx6_pcie_variants variant; -@@ -876,26 +877,28 @@ static int imx6_pcie_start_link(struct d + #define IMX6_PCIE_MAX_CLKS 6 + +@@ -836,26 +837,28 @@ static int imx6_pcie_start_link(struct d u32 tmp; int ret; @@ -76,7 +76,7 @@ Signed-off-by: Tim Harvey /* Allow faster modes after the link is up */ dw_pcie_dbi_ro_wr_en(pci); tmp = dw_pcie_readl_dbi(pci, offset + PCI_EXP_LNKCAP); -@@ -929,18 +932,14 @@ static int imx6_pcie_start_link(struct d +@@ -889,18 +892,14 @@ static int imx6_pcie_start_link(struct d goto err_reset_phy; } } @@ -100,20 +100,22 @@ Signed-off-by: Tim Harvey return 0; err_reset_phy: -@@ -1505,12 +1504,14 @@ static const struct imx6_pcie_drvdata dr +@@ -1456,14 +1455,16 @@ static const struct imx6_pcie_drvdata dr }, [IMX8MM] = { .variant = IMX8MM, - .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, + .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND | -+ IMX6_PCIE_FLAG_GEN1_LAST, ++ IMX6_PCIE_FLAG_GEN1_LAST, .gpr = "fsl,imx8mm-iomuxc-gpr", + .clk_names = imx8mm_clks, + .clks_cnt = ARRAY_SIZE(imx8mm_clks), }, [IMX8MP] = { .variant = IMX8MP, - .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, + .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND | -+ IMX6_PCIE_FLAG_GEN1_LAST, ++ IMX6_PCIE_FLAG_GEN1_LAST, .gpr = "fsl,imx8mp-iomuxc-gpr", - }, - [IMX8MQ_EP] = { + .clk_names = imx8mm_clks, + .clks_cnt = ARRAY_SIZE(imx8mm_clks), diff --git a/target/linux/mediatek/patches-6.6/410-bt-mtk-serial-fix.patch b/target/linux/mediatek/patches-6.6/410-bt-mtk-serial-fix.patch index 53e92a6dd38da4..206dad7f233dd7 100644 --- a/target/linux/mediatek/patches-6.6/410-bt-mtk-serial-fix.patch +++ b/target/linux/mediatek/patches-6.6/410-bt-mtk-serial-fix.patch @@ -19,7 +19,7 @@ }, [PORT_NPCM] = { .name = "Nuvoton 16550", -@@ -2774,6 +2774,11 @@ serial8250_do_set_termios(struct uart_po +@@ -2775,6 +2775,11 @@ serial8250_do_set_termios(struct uart_po unsigned long flags; unsigned int baud, quot, frac = 0; diff --git a/target/linux/ramips/patches-6.6/002-03-v6.13-clk-ralink-mtmips-add-mmc-related-clocks-for-SoCs-MT.patch b/target/linux/ramips/patches-6.6/002-03-v6.13-clk-ralink-mtmips-add-mmc-related-clocks-for-SoCs-MT.patch index b90a19b7ca2548..076cda246eed1b 100644 --- a/target/linux/ramips/patches-6.6/002-03-v6.13-clk-ralink-mtmips-add-mmc-related-clocks-for-SoCs-MT.patch +++ b/target/linux/ramips/patches-6.6/002-03-v6.13-clk-ralink-mtmips-add-mmc-related-clocks-for-SoCs-MT.patch @@ -42,7 +42,7 @@ Signed-off-by: Stephen Boyd { CLK_PERIPH("10300000.wmac", "xtal") } }; -@@ -272,8 +274,13 @@ static struct mtmips_clk_fixed rt3352_fi +@@ -271,8 +273,13 @@ static struct mtmips_clk_fixed rt3352_fi CLK_FIXED("periph", "xtal", 40000000) }; @@ -57,7 +57,7 @@ Signed-off-by: Stephen Boyd CLK_FIXED("periph", "xtal", 40000000) }; -@@ -328,6 +335,15 @@ static struct mtmips_clk_factor rt305x_f +@@ -327,6 +334,15 @@ static struct mtmips_clk_factor rt305x_f CLK_FACTOR("bus", "cpu", 1, 3) }; @@ -73,7 +73,7 @@ Signed-off-by: Stephen Boyd static int mtmips_register_factor_clocks(struct clk_hw_onecell_data *clk_data, struct mtmips_clk_priv *priv) { -@@ -811,10 +827,10 @@ static const struct mtmips_clk_data rt53 +@@ -810,10 +826,10 @@ static const struct mtmips_clk_data rt53 static const struct mtmips_clk_data mt7620_clk_data = { .clk_base = mt7620_clks_base, .num_clk_base = ARRAY_SIZE(mt7620_clks_base), @@ -88,7 +88,7 @@ Signed-off-by: Stephen Boyd .clk_periph = mt7620_pherip_clks, .num_clk_periph = ARRAY_SIZE(mt7620_pherip_clks), }; -@@ -824,8 +840,8 @@ static const struct mtmips_clk_data mt76 +@@ -823,8 +839,8 @@ static const struct mtmips_clk_data mt76 .num_clk_base = ARRAY_SIZE(mt76x8_clks_base), .clk_fixed = mt76x8_fixed_clocks, .num_clk_fixed = ARRAY_SIZE(mt76x8_fixed_clocks), diff --git a/target/linux/ramips/patches-6.6/003-v6.14-clk-ralink-mtmips-remove-duplicated-xtal-clock-for-Ralink.patch b/target/linux/ramips/patches-6.6/003-v6.14-clk-ralink-mtmips-remove-duplicated-xtal-clock-for-Ralink.patch deleted file mode 100644 index 71a32a0bc117c8..00000000000000 --- a/target/linux/ramips/patches-6.6/003-v6.14-clk-ralink-mtmips-remove-duplicated-xtal-clock-for-Ralink.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 830d8062d25581cf0beaa334486eea06834044da Mon Sep 17 00:00:00 2001 -From: Sergio Paracuellos -Date: Wed, 8 Jan 2025 10:36:36 +0100 -Subject: [PATCH] clk: ralink: mtmips: remove duplicated 'xtal' clock for - Ralink SoC RT3883 - -Ralink SoC RT3883 has already 'xtal' defined as a base clock so there is no -need to redefine it again in fixed clocks section. Hence, remove the duplicate -one from there. - -Fixes: d34db686a3d7 ("clk: ralink: mtmips: fix clocks probe order in oldest ralink SoCs") -Signed-off-by: Sergio Paracuellos -Link: https://lore.kernel.org/r/20250108093636.265033-1-sergio.paracuellos@gmail.com -Signed-off-by: Stephen Boyd ---- - drivers/clk/ralink/clk-mtmips.c | 1 - - 1 file changed, 1 deletion(-) - ---- a/drivers/clk/ralink/clk-mtmips.c -+++ b/drivers/clk/ralink/clk-mtmips.c -@@ -266,7 +266,6 @@ err_clk_unreg: - } - - static struct mtmips_clk_fixed rt3883_fixed_clocks[] = { -- CLK_FIXED("xtal", NULL, 40000000), - CLK_FIXED("periph", "xtal", 40000000) - }; - diff --git a/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch b/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch index a01911b1f4eb96..b545667ce3397f 100644 --- a/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch +++ b/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch @@ -42,7 +42,7 @@ Signed-off-by: John Crispin break; } -@@ -273,6 +274,7 @@ int uvc_status_init(struct uvc_device *d +@@ -274,6 +275,7 @@ int uvc_status_init(struct uvc_device *d } pipe = usb_rcvintpipe(dev->udev, ep->desc.bEndpointAddress); diff --git a/target/linux/rockchip/patches-6.6/034-v6.7-usb-dwc3-add-optional-PHY-interface-clocks.patch b/target/linux/rockchip/patches-6.6/034-v6.7-usb-dwc3-add-optional-PHY-interface-clocks.patch index 30e8a98fd7cdcf..26fedf0a6556a7 100644 --- a/target/linux/rockchip/patches-6.6/034-v6.7-usb-dwc3-add-optional-PHY-interface-clocks.patch +++ b/target/linux/rockchip/patches-6.6/034-v6.7-usb-dwc3-add-optional-PHY-interface-clocks.patch @@ -48,7 +48,7 @@ Signed-off-by: Greg Kroah-Hartman clk_disable_unprepare(dwc->susp_clk); clk_disable_unprepare(dwc->ref_clk); clk_disable_unprepare(dwc->bus_clk); -@@ -1884,6 +1898,20 @@ static int dwc3_get_clocks(struct dwc3 * +@@ -1875,6 +1889,20 @@ static int dwc3_get_clocks(struct dwc3 * } } diff --git a/target/linux/starfive/patches-6.6/0066-uart-8250-Add-dw-auto-flow-ctrl-support.patch b/target/linux/starfive/patches-6.6/0066-uart-8250-Add-dw-auto-flow-ctrl-support.patch index 617d72f11fbc8a..ec6130b7ce3d1c 100644 --- a/target/linux/starfive/patches-6.6/0066-uart-8250-Add-dw-auto-flow-ctrl-support.patch +++ b/target/linux/starfive/patches-6.6/0066-uart-8250-Add-dw-auto-flow-ctrl-support.patch @@ -67,7 +67,7 @@ Signed-off-by: Minda Chen } /* -@@ -2813,7 +2826,6 @@ serial8250_do_set_termios(struct uart_po +@@ -2814,7 +2827,6 @@ serial8250_do_set_termios(struct uart_po if (termios->c_cflag & CRTSCTS) up->mcr |= UART_MCR_AFE; } diff --git a/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch b/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch index 4c1dfabd9e992b..7c5c522f91301b 100644 --- a/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch +++ b/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch @@ -160,7 +160,7 @@ Signed-off-by: minda.chen } --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c -@@ -3707,7 +3707,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3708,7 +3708,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd * full_len = urb->transfer_buffer_length; /* If we have scatter/gather list, we use it. */ From 9ec355a921e3a09918dc304dd0cb9d2b2fe69104 Mon Sep 17 00:00:00 2001 From: John Audia Date: Tue, 11 Feb 2025 14:42:45 -0500 Subject: [PATCH 520/877] kernel: bump 6.6 to 6.6.77 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.77 No patches automatically rebased/checksum update only Build system: x86/64 Build-tested: bcm27xx/bcm2712, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Run-tested: bcm27xx/bcm2712, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/17822 (cherry picked from commit 16924e55f0c5c0b06cbec46d04c6113b8f7a5975) Link: https://github.com/openwrt/openwrt/pull/17987 Signed-off-by: Hauke Mehrtens --- include/kernel-6.6 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/kernel-6.6 b/include/kernel-6.6 index 0dcd32546d4ed3..3f07a92fc48717 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .76 -LINUX_KERNEL_HASH-6.6.76 = 81168b15f0c64034a2ab553ae37a5a38b79c3fe10f69faccc9f374ced4eb13a0 +LINUX_VERSION-6.6 = .77 +LINUX_KERNEL_HASH-6.6.77 = 081089dfcf125aef67aa940ebb995ff789b646129f5d4b2365e1d5685b29a84e From b9c6aeb62837ca5b5d9f8d92bac39687c0f060e9 Mon Sep 17 00:00:00 2001 From: John Audia Date: Mon, 17 Feb 2025 05:12:48 -0500 Subject: [PATCH 521/877] kernel: bump 6.6 to 6.6.78 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.78 Removed upstreamed: bcm27xx/patches-6.6/950-0487-drivers-media-imx296-Add-standby-delay-during-probe.patch[1] mediatek/patches-6.6/256-clk-mediatek-mt2701-vdec-fix-conversion-to-mtk_clk_s.patch[2] mediatek/patches-6.6/257-clk-mediatek-mt2701-aud-fix-conversion-to-mtk_clk_si.patch[3] mediatek/patches-6.6/258-clk-mediatek-mt2701-bdp-add-missing-dummy-clk.patch[4] mediatek/patches-6.6/259-clk-mediatek-mt2701-mm-add-missing-dummy-clk.patch[5] mediatek/patches-6.6/260-clk-mediatek-mt2701-img-add-missing-dummy-clk.patch[6] All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.78&id=25abffee5ceb6691ecd4f089be2bb28842e2d2fd 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.78&id=b6c5237ab7af82c9f1d8d772dbf309bb4aadfdbb 3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.78&id=20210b5c775d2d96f706591c64bc2ad975c37eaf 4. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.78&id=a1fa3dda6bf0b7ecd95fa8f9125e5486b699a81f 5. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.78&id=fc60e9357f15372698da373ee76de8f52d22aac2 6. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.78&id=6f4868e6b2887b55531bc8e0a4106ef0150e6326 Build system: x86/64 Build-tested: bcm27xx/bcm2712, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3, x86/64 Run-tested: bcm27xx/bcm2712, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3, x86/64 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/18000 Signed-off-by: Robert Marko (cherry picked from commit 57b0304ce93b9e84701de3091c9f272e6b14e6fa) Link: https://github.com/openwrt/openwrt/pull/17987 Signed-off-by: Hauke Mehrtens --- include/kernel-6.6 | 4 +-- ...53x-Add-ti-tca9554-compatible-string.patch | 2 +- ...mx296-Add-standby-delay-during-probe.patch | 26 ------------------- ...ok-up-preferred-fbdev-node-number-fr.patch | 4 +-- ...ange-query-for-FB-designation-from-d.patch | 2 +- ...-drm-Add-DRM_MODE_TV_MODE_MONOCHROME.patch | 4 +-- ...d-initialise-an-orientation-field-to.patch | 2 +- ...top-property-to-true-for-writeback-a.patch | 2 +- ...-number-of-overlay-planes-from-16-to.patch | 2 +- .../patches-6.6/791-tg3-no-pci-sleep.patch | 2 +- ...rk-layouts-to-become-regular-devices.patch | 2 +- ...1-nvmem-imx-ocotp-ele-support-i.MX95.patch | 6 ++--- .../hack-6.6/904-debloat_dma_buf.patch | 2 +- ...Fix-DMA-allocations-on-57766-devices.patch | 2 +- ...msm-use-sdhci_set_clock-instead-of-s.patch | 2 +- ...m-comment-unused-sdhci_msm_set_clock.patch | 2 +- .../810-uvc-add-iPassion-iP2970-support.patch | 8 +++--- 17 files changed, 24 insertions(+), 50 deletions(-) delete mode 100644 target/linux/bcm27xx/patches-6.6/950-0487-drivers-media-imx296-Add-standby-delay-during-probe.patch diff --git a/include/kernel-6.6 b/include/kernel-6.6 index 3f07a92fc48717..a22eb0f6f94199 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .77 -LINUX_KERNEL_HASH-6.6.77 = 081089dfcf125aef67aa940ebb995ff789b646129f5d4b2365e1d5685b29a84e +LINUX_VERSION-6.6 = .78 +LINUX_KERNEL_HASH-6.6.78 = 5aa39a9bd555133ad741058f9908a277e6b36bb928481e747d885b50aaaa93ed diff --git a/target/linux/bcm27xx/patches-6.6/950-0416-gpio-pca953x-Add-ti-tca9554-compatible-string.patch b/target/linux/bcm27xx/patches-6.6/950-0416-gpio-pca953x-Add-ti-tca9554-compatible-string.patch index be8e134cf6e5db..e0de6fe1cb8a98 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0416-gpio-pca953x-Add-ti-tca9554-compatible-string.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0416-gpio-pca953x-Add-ti-tca9554-compatible-string.patch @@ -10,7 +10,7 @@ Signed-off-by: Phil Elwell --- a/drivers/gpio/gpio-pca953x.c +++ b/drivers/gpio/gpio-pca953x.c -@@ -1330,6 +1330,7 @@ static const struct of_device_id pca953x +@@ -1311,6 +1311,7 @@ static const struct of_device_id pca953x { .compatible = "ti,tca6424", .data = OF_953X(24, PCA_INT), }, { .compatible = "ti,tca9538", .data = OF_953X( 8, PCA_INT), }, { .compatible = "ti,tca9539", .data = OF_953X(16, PCA_INT), }, diff --git a/target/linux/bcm27xx/patches-6.6/950-0487-drivers-media-imx296-Add-standby-delay-during-probe.patch b/target/linux/bcm27xx/patches-6.6/950-0487-drivers-media-imx296-Add-standby-delay-during-probe.patch deleted file mode 100644 index 786ba7656ccc5f..00000000000000 --- a/target/linux/bcm27xx/patches-6.6/950-0487-drivers-media-imx296-Add-standby-delay-during-probe.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 7713ce38e6a26425ace3a57b3d03ba0125c16f89 Mon Sep 17 00:00:00 2001 -From: Naushir Patuck -Date: Fri, 28 Jul 2023 12:00:40 +0100 -Subject: [PATCH 0487/1085] drivers: media: imx296: Add standby delay during - probe - -Add a 2-5ms delay when coming out of standby and before reading the -sensor info register durning probe, as instructed by the datasheet. This -standby delay is already present when the sensor starts streaming. - -Signed-off-by: Naushir Patuck ---- - drivers/media/i2c/imx296.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/drivers/media/i2c/imx296.c -+++ b/drivers/media/i2c/imx296.c -@@ -940,6 +940,8 @@ static int imx296_identify_model(struct - return ret; - } - -+ usleep_range(2000, 5000); -+ - ret = imx296_read(sensor, IMX296_SENSOR_INFO); - if (ret < 0) { - dev_err(sensor->dev, "failed to read sensor information (%d)\n", diff --git a/target/linux/bcm27xx/patches-6.6/950-0679-drm-fb-helper-Look-up-preferred-fbdev-node-number-fr.patch b/target/linux/bcm27xx/patches-6.6/950-0679-drm-fb-helper-Look-up-preferred-fbdev-node-number-fr.patch index f94efc25b24ea8..0b2b28b7f1c8d8 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0679-drm-fb-helper-Look-up-preferred-fbdev-node-number-fr.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0679-drm-fb-helper-Look-up-preferred-fbdev-node-number-fr.patch @@ -15,7 +15,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c -@@ -1851,7 +1851,7 @@ __drm_fb_helper_initial_config_and_unloc +@@ -1853,7 +1853,7 @@ __drm_fb_helper_initial_config_and_unloc struct drm_device *dev = fb_helper->dev; struct fb_info *info; unsigned int width, height; @@ -24,7 +24,7 @@ Signed-off-by: Dave Stevenson width = dev->mode_config.max_width; height = dev->mode_config.max_height; -@@ -1879,6 +1879,15 @@ __drm_fb_helper_initial_config_and_unloc +@@ -1881,6 +1881,15 @@ __drm_fb_helper_initial_config_and_unloc * register the fbdev emulation instance in kernel_fb_helper_list. */ mutex_unlock(&fb_helper->lock); diff --git a/target/linux/bcm27xx/patches-6.6/950-0684-drm-fb_helper-Change-query-for-FB-designation-from-d.patch b/target/linux/bcm27xx/patches-6.6/950-0684-drm-fb_helper-Change-query-for-FB-designation-from-d.patch index 60cabdffc31653..a63bd11af4efbf 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0684-drm-fb_helper-Change-query-for-FB-designation-from-d.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0684-drm-fb_helper-Change-query-for-FB-designation-from-d.patch @@ -12,7 +12,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c -@@ -1879,11 +1879,11 @@ __drm_fb_helper_initial_config_and_unloc +@@ -1881,11 +1881,11 @@ __drm_fb_helper_initial_config_and_unloc * register the fbdev emulation instance in kernel_fb_helper_list. */ mutex_unlock(&fb_helper->lock); diff --git a/target/linux/bcm27xx/patches-6.6/950-0923-drm-Add-DRM_MODE_TV_MODE_MONOCHROME.patch b/target/linux/bcm27xx/patches-6.6/950-0923-drm-Add-DRM_MODE_TV_MODE_MONOCHROME.patch index 485196b15a9fde..c4a5537a8c75fb 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0923-drm-Add-DRM_MODE_TV_MODE_MONOCHROME.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0923-drm-Add-DRM_MODE_TV_MODE_MONOCHROME.patch @@ -21,7 +21,7 @@ Signed-off-by: Nick Hollinghurst --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c -@@ -1049,6 +1049,7 @@ static const struct drm_prop_enum_list d +@@ -1050,6 +1050,7 @@ static const struct drm_prop_enum_list d { DRM_MODE_TV_MODE_PAL_M, "PAL-M" }, { DRM_MODE_TV_MODE_PAL_N, "PAL-N" }, { DRM_MODE_TV_MODE_SECAM, "SECAM" }, @@ -29,7 +29,7 @@ Signed-off-by: Nick Hollinghurst }; DRM_ENUM_NAME_FN(drm_get_tv_mode_name, drm_tv_mode_enum_list) -@@ -1735,6 +1736,12 @@ EXPORT_SYMBOL(drm_connector_attach_dp_su +@@ -1736,6 +1737,12 @@ EXPORT_SYMBOL(drm_connector_attach_dp_su * TV Mode is CCIR System B (aka 625-lines) together with * the SECAM Color Encoding. * diff --git a/target/linux/bcm27xx/patches-6.6/950-1051-drm-panel-Add-and-initialise-an-orientation-field-to.patch b/target/linux/bcm27xx/patches-6.6/950-1051-drm-panel-Add-and-initialise-an-orientation-field-to.patch index 694e2a0082feca..6d745f6e9d75c6 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1051-drm-panel-Add-and-initialise-an-orientation-field-to.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1051-drm-panel-Add-and-initialise-an-orientation-field-to.patch @@ -22,7 +22,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c -@@ -2697,10 +2697,15 @@ int drm_connector_set_orientation_from_p +@@ -2698,10 +2698,15 @@ int drm_connector_set_orientation_from_p { enum drm_panel_orientation orientation; diff --git a/target/linux/bcm27xx/patches-6.6/950-1365-drm-Set-non-desktop-property-to-true-for-writeback-a.patch b/target/linux/bcm27xx/patches-6.6/950-1365-drm-Set-non-desktop-property-to-true-for-writeback-a.patch index e8f52cbc43e035..a1ac849e3e1e09 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1365-drm-Set-non-desktop-property-to-true-for-writeback-a.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1365-drm-Set-non-desktop-property-to-true-for-writeback-a.patch @@ -18,7 +18,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c -@@ -361,7 +361,8 @@ static int __drm_connector_init(struct d +@@ -362,7 +362,8 @@ static int __drm_connector_init(struct d drm_object_attach_property(&connector->base, config->non_desktop_property, diff --git a/target/linux/bcm27xx/patches-6.6/950-1367-drm-vc4-Increase-number-of-overlay-planes-from-16-to.patch b/target/linux/bcm27xx/patches-6.6/950-1367-drm-vc4-Increase-number-of-overlay-planes-from-16-to.patch index 6eae6fc2ac2b25..564d7abeb6a489 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1367-drm-vc4-Increase-number-of-overlay-planes-from-16-to.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1367-drm-vc4-Increase-number-of-overlay-planes-from-16-to.patch @@ -20,7 +20,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c -@@ -362,7 +362,7 @@ static int __drm_connector_init(struct d +@@ -363,7 +363,7 @@ static int __drm_connector_init(struct d drm_object_attach_property(&connector->base, config->non_desktop_property, (connector_type != DRM_MODE_CONNECTOR_VIRTUAL && diff --git a/target/linux/bcm47xx/patches-6.6/791-tg3-no-pci-sleep.patch b/target/linux/bcm47xx/patches-6.6/791-tg3-no-pci-sleep.patch index 76e979ad58286e..07778737014e68 100644 --- a/target/linux/bcm47xx/patches-6.6/791-tg3-no-pci-sleep.patch +++ b/target/linux/bcm47xx/patches-6.6/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 -@@ -4269,7 +4269,8 @@ static int tg3_power_down_prepare(struct +@@ -4270,7 +4270,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/generic/backport-6.6/819-v6.8-0005-nvmem-core-Rework-layouts-to-become-regular-devices.patch b/target/linux/generic/backport-6.6/819-v6.8-0005-nvmem-core-Rework-layouts-to-become-regular-devices.patch index c846c485e0242e..220a9681363ad4 100644 --- a/target/linux/generic/backport-6.6/819-v6.8-0005-nvmem-core-Rework-layouts-to-become-regular-devices.patch +++ b/target/linux/generic/backport-6.6/819-v6.8-0005-nvmem-core-Rework-layouts-to-become-regular-devices.patch @@ -330,7 +330,7 @@ Signed-off-by: Greg Kroah-Hartman } EXPORT_SYMBOL_GPL(nvmem_cell_put); -@@ -2116,11 +2057,22 @@ EXPORT_SYMBOL_GPL(nvmem_dev_size); +@@ -2118,11 +2059,22 @@ EXPORT_SYMBOL_GPL(nvmem_dev_size); static int __init nvmem_init(void) { diff --git a/target/linux/generic/backport-6.6/823-v6.12-0001-nvmem-imx-ocotp-ele-support-i.MX95.patch b/target/linux/generic/backport-6.6/823-v6.12-0001-nvmem-imx-ocotp-ele-support-i.MX95.patch index c19931b3fa01e6..b96134e3150359 100644 --- a/target/linux/generic/backport-6.6/823-v6.12-0001-nvmem-imx-ocotp-ele-support-i.MX95.patch +++ b/target/linux/generic/backport-6.6/823-v6.12-0001-nvmem-imx-ocotp-ele-support-i.MX95.patch @@ -28,7 +28,7 @@ Signed-off-by: Greg Kroah-Hartman FUSE_INVALID = -1 }; -@@ -93,7 +94,10 @@ static int imx_ocotp_reg_read(void *cont +@@ -95,7 +96,10 @@ static int imx_ocotp_reg_read(void *cont continue; } @@ -39,8 +39,8 @@ Signed-off-by: Greg Kroah-Hartman + *buf++ = readl_relaxed(reg + (i << 2)); } - memcpy(val, (u8 *)p, bytes); -@@ -155,8 +159,30 @@ static const struct ocotp_devtype_data i + memcpy(val, ((u8 *)p) + skipbytes, bytes); +@@ -157,8 +161,30 @@ static const struct ocotp_devtype_data i }, }; diff --git a/target/linux/generic/hack-6.6/904-debloat_dma_buf.patch b/target/linux/generic/hack-6.6/904-debloat_dma_buf.patch index 355bd0d70cd26d..3ca98788abd4f9 100644 --- a/target/linux/generic/hack-6.6/904-debloat_dma_buf.patch +++ b/target/linux/generic/hack-6.6/904-debloat_dma_buf.patch @@ -73,7 +73,7 @@ Signed-off-by: Felix Fietkau +MODULE_LICENSE("GPL"); --- a/kernel/sched/core.c +++ b/kernel/sched/core.c -@@ -4483,6 +4483,7 @@ int wake_up_state(struct task_struct *p, +@@ -4485,6 +4485,7 @@ int wake_up_state(struct task_struct *p, { return try_to_wake_up(p, state, 0); } diff --git a/target/linux/generic/pending-6.6/791-tg3-Fix-DMA-allocations-on-57766-devices.patch b/target/linux/generic/pending-6.6/791-tg3-Fix-DMA-allocations-on-57766-devices.patch index a90d77c9f0440a..9d219d13e5b54d 100644 --- a/target/linux/generic/pending-6.6/791-tg3-Fix-DMA-allocations-on-57766-devices.patch +++ b/target/linux/generic/pending-6.6/791-tg3-Fix-DMA-allocations-on-57766-devices.patch @@ -17,7 +17,7 @@ Signed-off-by: Pavan Chebbi --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c -@@ -17731,8 +17731,10 @@ static int tg3_init_one(struct pci_dev * +@@ -17732,8 +17732,10 @@ static int tg3_init_one(struct pci_dev * } else persist_dma_mask = dma_mask = DMA_BIT_MASK(64); diff --git a/target/linux/ipq40xx/patches-6.6/400-mmc-sdhci-sdhci-msm-use-sdhci_set_clock-instead-of-s.patch b/target/linux/ipq40xx/patches-6.6/400-mmc-sdhci-sdhci-msm-use-sdhci_set_clock-instead-of-s.patch index 1c156d4398a41f..76c36db38fd85e 100644 --- a/target/linux/ipq40xx/patches-6.6/400-mmc-sdhci-sdhci-msm-use-sdhci_set_clock-instead-of-s.patch +++ b/target/linux/ipq40xx/patches-6.6/400-mmc-sdhci-sdhci-msm-use-sdhci_set_clock-instead-of-s.patch @@ -13,7 +13,7 @@ Signed-off-by: Robert Marko --- a/drivers/mmc/host/sdhci-msm.c +++ b/drivers/mmc/host/sdhci-msm.c -@@ -2320,7 +2320,7 @@ MODULE_DEVICE_TABLE(of, sdhci_msm_dt_mat +@@ -2369,7 +2369,7 @@ MODULE_DEVICE_TABLE(of, sdhci_msm_dt_mat static const struct sdhci_ops sdhci_msm_ops = { .reset = sdhci_and_cqhci_reset, diff --git a/target/linux/ipq40xx/patches-6.6/401-mmc-sdhci-msm-comment-unused-sdhci_msm_set_clock.patch b/target/linux/ipq40xx/patches-6.6/401-mmc-sdhci-msm-comment-unused-sdhci_msm_set_clock.patch index cfbb6439748b6d..a90b0aaf9b359a 100644 --- a/target/linux/ipq40xx/patches-6.6/401-mmc-sdhci-msm-comment-unused-sdhci_msm_set_clock.patch +++ b/target/linux/ipq40xx/patches-6.6/401-mmc-sdhci-msm-comment-unused-sdhci_msm_set_clock.patch @@ -13,7 +13,7 @@ Signed-off-by: Christian Marangi --- a/drivers/mmc/host/sdhci-msm.c +++ b/drivers/mmc/host/sdhci-msm.c -@@ -1755,49 +1755,49 @@ static unsigned int sdhci_msm_get_min_cl +@@ -1804,49 +1804,49 @@ static unsigned int sdhci_msm_get_min_cl return SDHCI_MSM_MIN_CLOCK; } diff --git a/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch b/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch index b545667ce3397f..dc4f2ecd9acdd5 100644 --- a/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch +++ b/target/linux/ramips/patches-6.6/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 -@@ -3271,6 +3271,18 @@ static const struct usb_device_id uvc_id +@@ -3269,6 +3269,18 @@ static const struct usb_device_id uvc_id .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) }, @@ -64,7 +64,7 @@ Signed-off-by: John Crispin #include -@@ -1275,9 +1280,149 @@ static void uvc_video_decode_data(struct +@@ -1296,9 +1301,149 @@ static void uvc_video_decode_data(struct uvc_urb->async_operations++; } @@ -214,7 +214,7 @@ Signed-off-by: John Crispin /* Mark the buffer as done if the EOF marker is set. */ if (data[1] & UVC_STREAM_EOF && buf->bytesused != 0) { uvc_dbg(stream->dev, FRAME, "Frame complete (EOF found)\n"); -@@ -1859,6 +2004,8 @@ static int uvc_init_video_isoc(struct uv +@@ -1880,6 +2025,8 @@ static int uvc_init_video_isoc(struct uv if (npackets == 0) return -ENOMEM; @@ -234,7 +234,7 @@ Signed-off-by: John Crispin /* Format flags */ #define UVC_FMT_FLAG_COMPRESSED 0x00000001 -@@ -585,6 +587,7 @@ struct uvc_device { +@@ -586,6 +588,7 @@ struct uvc_device { struct input_dev *input; char input_phys[64]; From 22943245a5154ea64aed4b850181ab1297917704 Mon Sep 17 00:00:00 2001 From: John Audia Date: Fri, 21 Feb 2025 09:14:57 -0500 Subject: [PATCH 522/877] kernel: bump 6.6 to 6.6.79 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.79 Manually rebased: ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch All other patches automatically rebased. Build system: x86/64 Build-tested: bcm27xx/bcm2712, filogic/glinet_gl-mt6000, filogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3, x86/64 Run-tested: bcm27xx/bcm2712, filogic/glinet_gl-mt6000, filogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3, x86/64 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/18066 Signed-off-by: Nick Hainke (cherry picked from commit d664d7466958d3c70e1be9258280d39825ba9ba8) Link: https://github.com/openwrt/openwrt/pull/17987 Signed-off-by: Hauke Mehrtens --- include/kernel-6.6 | 4 ++-- .../105-uart-add-en7523-support.patch | 2 +- ...roup-Disable-cgroup-memory-by-default.patch | 8 ++++---- .../950-0087-Add-dwc_otg-driver.patch | 2 +- ...el-command-line-to-disable-memory-cgr.patch | 8 ++++---- ...e-kernel-command-line-to-disable-memo.patch | 2 +- ...cklog-NAPI-to-clean-up-the-defer_list.patch | 2 +- ...t-create-a-dummy-net_device-allocator.patch | 2 +- .../780-usb-net-MeigLink_modem_support.patch | 4 ++-- ...ing-with-source-address-failed-policy.patch | 18 +++++++++--------- .../811-pci_disable_usb_common_quirks.patch | 2 +- .../patches-6.6/410-bt-mtk-serial-fix.patch | 2 +- .../810-uvc-add-iPassion-iP2970-support.patch | 18 +++++++++--------- ...itialize-pad-delay-and-drive-strength.patch | 8 ++++---- ...rt-8250-Add-dw-auto-flow-ctrl-support.patch | 2 +- 15 files changed, 42 insertions(+), 42 deletions(-) diff --git a/include/kernel-6.6 b/include/kernel-6.6 index a22eb0f6f94199..2e70a47f1d16b2 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .78 -LINUX_KERNEL_HASH-6.6.78 = 5aa39a9bd555133ad741058f9908a277e6b36bb928481e747d885b50aaaa93ed +LINUX_VERSION-6.6 = .79 +LINUX_KERNEL_HASH-6.6.79 = 07a6f904470da1a099aa1683e3025a999dd82f2438f78b006b80c6ae2e9dfe8d diff --git a/target/linux/airoha/patches-6.6/105-uart-add-en7523-support.patch b/target/linux/airoha/patches-6.6/105-uart-add-en7523-support.patch index 80b6550be3239d..80723bd5af9f4f 100644 --- a/target/linux/airoha/patches-6.6/105-uart-add-en7523-support.patch +++ b/target/linux/airoha/patches-6.6/105-uart-add-en7523-support.patch @@ -122,7 +122,7 @@ }; /* Uart divisor latch read */ -@@ -2881,6 +2889,12 @@ serial8250_do_set_termios(struct uart_po +@@ -2889,6 +2897,12 @@ serial8250_do_set_termios(struct uart_po serial8250_set_divisor(port, baud, quot, frac); diff --git a/target/linux/bcm27xx/patches-6.6/950-0065-cgroup-Disable-cgroup-memory-by-default.patch b/target/linux/bcm27xx/patches-6.6/950-0065-cgroup-Disable-cgroup-memory-by-default.patch index 5f2d80b697ce87..5600e857341644 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0065-cgroup-Disable-cgroup-memory-by-default.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0065-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 -@@ -6063,6 +6063,9 @@ int __init cgroup_init_early(void) +@@ -6059,6 +6059,9 @@ int __init cgroup_init_early(void) return 0; } @@ -27,7 +27,7 @@ Signed-off-by: Phil Elwell /** * cgroup_init - cgroup initialization * -@@ -6096,6 +6099,12 @@ int __init cgroup_init(void) +@@ -6092,6 +6095,12 @@ int __init cgroup_init(void) cgroup_unlock(); @@ -40,7 +40,7 @@ Signed-off-by: Phil Elwell for_each_subsys(ss, ssid) { if (ss->early_init) { struct cgroup_subsys_state *css = -@@ -6736,6 +6745,10 @@ static int __init cgroup_disable(char *s +@@ -6740,6 +6749,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); -@@ -6754,6 +6767,31 @@ static int __init cgroup_disable(char *s +@@ -6758,6 +6771,31 @@ static int __init cgroup_disable(char *s } __setup("cgroup_disable=", cgroup_disable); diff --git a/target/linux/bcm27xx/patches-6.6/950-0087-Add-dwc_otg-driver.patch b/target/linux/bcm27xx/patches-6.6/950-0087-Add-dwc_otg-driver.patch index 3da9f4230bd16b..82e969138e0727 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0087-Add-dwc_otg-driver.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0087-Add-dwc_otg-driver.patch @@ -1189,7 +1189,7 @@ Signed-off-by: Alexander Winkowski } --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c -@@ -5712,7 +5712,7 @@ static void port_event(struct usb_hub *h +@@ -5722,7 +5722,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-6.6/950-1349-cgroup-Use-kernel-command-line-to-disable-memory-cgr.patch b/target/linux/bcm27xx/patches-6.6/950-1349-cgroup-Use-kernel-command-line-to-disable-memory-cgr.patch index 61dec89382cff5..b1ceaad71dee9e 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1349-cgroup-Use-kernel-command-line-to-disable-memory-cgr.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1349-cgroup-Use-kernel-command-line-to-disable-memory-cgr.patch @@ -148,7 +148,7 @@ Signed-off-by: Maíra Canal --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c -@@ -6063,9 +6063,6 @@ int __init cgroup_init_early(void) +@@ -6059,9 +6059,6 @@ int __init cgroup_init_early(void) return 0; } @@ -158,7 +158,7 @@ Signed-off-by: Maíra Canal /** * cgroup_init - cgroup initialization * -@@ -6099,12 +6096,6 @@ int __init cgroup_init(void) +@@ -6095,12 +6092,6 @@ int __init cgroup_init(void) cgroup_unlock(); @@ -171,7 +171,7 @@ Signed-off-by: Maíra Canal for_each_subsys(ss, ssid) { if (ss->early_init) { struct cgroup_subsys_state *css = -@@ -6745,10 +6736,6 @@ static int __init cgroup_disable(char *s +@@ -6749,10 +6740,6 @@ static int __init cgroup_disable(char *s strcmp(token, ss->legacy_name)) continue; @@ -182,7 +182,7 @@ Signed-off-by: Maíra Canal static_branch_disable(cgroup_subsys_enabled_key[i]); pr_info("Disabling %s control group subsystem\n", ss->name); -@@ -6782,7 +6769,7 @@ static int __init cgroup_enable(char *st +@@ -6786,7 +6773,7 @@ static int __init cgroup_enable(char *st strcmp(token, ss->legacy_name)) continue; diff --git a/target/linux/bcm27xx/patches-6.6/950-1445-fixup-cgroup-Use-kernel-command-line-to-disable-memo.patch b/target/linux/bcm27xx/patches-6.6/950-1445-fixup-cgroup-Use-kernel-command-line-to-disable-memo.patch index 8c4a1c3a3e88ba..b3a73945f648d1 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1445-fixup-cgroup-Use-kernel-command-line-to-disable-memo.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1445-fixup-cgroup-Use-kernel-command-line-to-disable-memo.patch @@ -14,7 +14,7 @@ Signed-off-by: Phil Elwell --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c -@@ -6769,11 +6769,19 @@ static int __init cgroup_enable(char *st +@@ -6773,11 +6773,19 @@ static int __init cgroup_enable(char *st strcmp(token, ss->legacy_name)) continue; diff --git a/target/linux/generic/backport-6.6/602-v6.10-net-Use-backlog-NAPI-to-clean-up-the-defer_list.patch b/target/linux/generic/backport-6.6/602-v6.10-net-Use-backlog-NAPI-to-clean-up-the-defer_list.patch index 82b83552d37b81..9af345002a10ca 100644 --- a/target/linux/generic/backport-6.6/602-v6.10-net-Use-backlog-NAPI-to-clean-up-the-defer_list.patch +++ b/target/linux/generic/backport-6.6/602-v6.10-net-Use-backlog-NAPI-to-clean-up-the-defer_list.patch @@ -36,7 +36,7 @@ Signed-off-by: Paolo Abeni --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h -@@ -3300,6 +3300,7 @@ static inline void dev_xmit_recursion_de +@@ -3306,6 +3306,7 @@ static inline void dev_xmit_recursion_de __this_cpu_dec(softnet_data.xmit.recursion); } diff --git a/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch b/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch index c6718c8e224c39..8b562a0f61837a 100644 --- a/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch +++ b/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch @@ -37,7 +37,7 @@ Signed-off-by: David S. Miller --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h -@@ -4561,6 +4561,9 @@ static inline void netif_addr_unlock_bh( +@@ -4567,6 +4567,9 @@ static inline void netif_addr_unlock_bh( void ether_setup(struct net_device *dev); diff --git a/target/linux/generic/hack-6.6/780-usb-net-MeigLink_modem_support.patch b/target/linux/generic/hack-6.6/780-usb-net-MeigLink_modem_support.patch index 222633058aae68..bbd73b1e601d0f 100644 --- a/target/linux/generic/hack-6.6/780-usb-net-MeigLink_modem_support.patch +++ b/target/linux/generic/hack-6.6/780-usb-net-MeigLink_modem_support.patch @@ -44,7 +44,7 @@ Subject: [PATCH] net/usb/qmi_wwan: add MeigLink modem support #define QUECTEL_VENDOR_ID 0x2c7c /* These Quectel products use Quectel's vendor ID */ -@@ -1162,6 +1167,11 @@ static const struct usb_device_id option +@@ -1153,6 +1158,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) }, @@ -56,7 +56,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), -@@ -1203,6 +1213,11 @@ static const struct usb_device_id option +@@ -1194,6 +1204,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-6.6/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch b/target/linux/generic/pending-6.6/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch index e239d20409e1a4..9b76c82a6fbd00 100644 --- a/target/linux/generic/pending-6.6/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch +++ b/target/linux/generic/pending-6.6/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: -@@ -4546,6 +4565,17 @@ static int ip6_pkt_prohibit_out(struct n +@@ -4551,6 +4570,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. */ -@@ -5037,7 +5067,8 @@ static int rtm_to_fib6_config(struct sk_ +@@ -5042,7 +5072,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) -@@ -6299,6 +6330,8 @@ static int ip6_route_dev_notify(struct n +@@ -6304,6 +6335,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 -@@ -6310,6 +6343,7 @@ static int ip6_route_dev_notify(struct n +@@ -6315,6 +6348,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 } -@@ -6510,6 +6544,8 @@ static int __net_init ip6_route_net_init +@@ -6515,6 +6549,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); -@@ -6520,11 +6556,21 @@ static int __net_init ip6_route_net_init +@@ -6525,11 +6561,21 @@ static int __net_init ip6_route_net_init ip6_template_metrics, true); INIT_LIST_HEAD(&net->ipv6.ip6_prohibit_entry->dst.rt_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); -@@ -6551,6 +6597,8 @@ out: +@@ -6556,6 +6602,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: -@@ -6570,6 +6618,7 @@ static void __net_exit ip6_route_net_exi +@@ -6575,6 +6623,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); -@@ -6653,6 +6702,9 @@ void __init ip6_route_init_special_entri +@@ -6658,6 +6707,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-6.6/811-pci_disable_usb_common_quirks.patch b/target/linux/generic/pending-6.6/811-pci_disable_usb_common_quirks.patch index e91d1ef6b29768..7ac5347031fa58 100644 --- a/target/linux/generic/pending-6.6/811-pci_disable_usb_common_quirks.patch +++ b/target/linux/generic/pending-6.6/811-pci_disable_usb_common_quirks.patch @@ -48,7 +48,7 @@ Signed-off-by: Felix Fietkau static inline int io_type_enabled(struct pci_dev *pdev, unsigned int mask) { u16 cmd; -@@ -1283,3 +1298,4 @@ static void quirk_usb_early_handoff(stru +@@ -1292,3 +1307,4 @@ static void quirk_usb_early_handoff(stru } DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_SERIAL_USB, 8, quirk_usb_early_handoff); diff --git a/target/linux/mediatek/patches-6.6/410-bt-mtk-serial-fix.patch b/target/linux/mediatek/patches-6.6/410-bt-mtk-serial-fix.patch index 206dad7f233dd7..1a67286e612f9d 100644 --- a/target/linux/mediatek/patches-6.6/410-bt-mtk-serial-fix.patch +++ b/target/linux/mediatek/patches-6.6/410-bt-mtk-serial-fix.patch @@ -19,7 +19,7 @@ }, [PORT_NPCM] = { .name = "Nuvoton 16550", -@@ -2775,6 +2775,11 @@ serial8250_do_set_termios(struct uart_po +@@ -2783,6 +2783,11 @@ serial8250_do_set_termios(struct uart_po unsigned long flags; unsigned int baud, quot, frac = 0; diff --git a/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch b/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch index dc4f2ecd9acdd5..56b638aa3632ba 100644 --- a/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch +++ b/target/linux/ramips/patches-6.6/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 -@@ -3269,6 +3269,18 @@ static const struct usb_device_id uvc_id +@@ -3287,6 +3287,18 @@ static const struct usb_device_id uvc_id .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) }, @@ -62,9 +62,9 @@ Signed-off-by: John Crispin +#include +#include + #include #include - -@@ -1296,9 +1301,149 @@ static void uvc_video_decode_data(struct +@@ -1321,9 +1326,149 @@ static void uvc_video_decode_data(struct uvc_urb->async_operations++; } @@ -214,7 +214,7 @@ Signed-off-by: John Crispin /* Mark the buffer as done if the EOF marker is set. */ if (data[1] & UVC_STREAM_EOF && buf->bytesused != 0) { uvc_dbg(stream->dev, FRAME, "Frame complete (EOF found)\n"); -@@ -1880,6 +2025,8 @@ static int uvc_init_video_isoc(struct uv +@@ -1905,6 +2050,8 @@ static int uvc_init_video_isoc(struct uv if (npackets == 0) return -ENOMEM; @@ -225,16 +225,16 @@ Signed-off-by: John Crispin for_each_uvc_urb(uvc_urb, stream) { --- a/drivers/media/usb/uvc/uvcvideo.h +++ b/drivers/media/usb/uvc/uvcvideo.h -@@ -76,6 +76,8 @@ - #define UVC_QUIRK_NO_RESET_RESUME 0x00004000 +@@ -77,6 +77,8 @@ #define UVC_QUIRK_DISABLE_AUTOSUSPEND 0x00008000 #define UVC_QUIRK_INVALID_DEVICE_SOF 0x00010000 -+#define UVC_QUIRK_MOTION 0x00020000 -+#define UVC_QUIRK_SINGLE_ISO 0x00040000 + #define UVC_QUIRK_MJPEG_NO_EOF 0x00020000 ++#define UVC_QUIRK_MOTION 0x00040000 ++#define UVC_QUIRK_SINGLE_ISO 0x00080000 /* Format flags */ #define UVC_FMT_FLAG_COMPRESSED 0x00000001 -@@ -586,6 +588,7 @@ struct uvc_device { +@@ -587,6 +589,7 @@ struct uvc_device { struct input_dev *input; char input_phys[64]; diff --git a/target/linux/ramips/patches-6.6/831-mmc-mtk-sd-initialize-pad-delay-and-drive-strength.patch b/target/linux/ramips/patches-6.6/831-mmc-mtk-sd-initialize-pad-delay-and-drive-strength.patch index c3d13932ef33a3..7fd7b3af43d28a 100644 --- a/target/linux/ramips/patches-6.6/831-mmc-mtk-sd-initialize-pad-delay-and-drive-strength.patch +++ b/target/linux/ramips/patches-6.6/831-mmc-mtk-sd-initialize-pad-delay-and-drive-strength.patch @@ -22,7 +22,7 @@ Signed-off-by: Shiji Yang #define PAD_DS_TUNE 0x188 #define PAD_CMD_TUNE 0x18c #define EMMC51_CFG0 0x204 -@@ -400,6 +404,7 @@ struct mtk_mmc_compatible { +@@ -402,6 +406,7 @@ struct mtk_mmc_compatible { bool enhance_rx; bool support_64g; bool use_internal_cd; @@ -30,7 +30,7 @@ Signed-off-by: Shiji Yang }; struct msdc_tune_para { -@@ -537,6 +542,7 @@ static const struct mtk_mmc_compatible m +@@ -539,6 +544,7 @@ static const struct mtk_mmc_compatible m .stop_clk_fix = false, .enhance_rx = false, .use_internal_cd = true, @@ -38,7 +38,7 @@ Signed-off-by: Shiji Yang }; static const struct mtk_mmc_compatible mt7622_compat = { -@@ -1729,9 +1735,11 @@ static void msdc_init_hw(struct msdc_hos +@@ -1731,9 +1737,11 @@ static void msdc_init_hw(struct msdc_hos } writel(0, host->base + MSDC_IOCON); sdr_set_field(host->base + MSDC_IOCON, MSDC_IOCON_DDLSEL, 0); @@ -53,7 +53,7 @@ Signed-off-by: Shiji Yang sdr_set_bits(host->base + EMMC50_CFG0, EMMC50_CFG_CFCSTS_SEL); if (host->dev_comp->stop_clk_fix) { -@@ -1795,6 +1803,18 @@ static void msdc_init_hw(struct msdc_hos +@@ -1797,6 +1805,18 @@ static void msdc_init_hw(struct msdc_hos MSDC_PAD_TUNE_RXDLYSEL); } diff --git a/target/linux/starfive/patches-6.6/0066-uart-8250-Add-dw-auto-flow-ctrl-support.patch b/target/linux/starfive/patches-6.6/0066-uart-8250-Add-dw-auto-flow-ctrl-support.patch index ec6130b7ce3d1c..4fd92a46dc745f 100644 --- a/target/linux/starfive/patches-6.6/0066-uart-8250-Add-dw-auto-flow-ctrl-support.patch +++ b/target/linux/starfive/patches-6.6/0066-uart-8250-Add-dw-auto-flow-ctrl-support.patch @@ -67,7 +67,7 @@ Signed-off-by: Minda Chen } /* -@@ -2814,7 +2827,6 @@ serial8250_do_set_termios(struct uart_po +@@ -2822,7 +2835,6 @@ serial8250_do_set_termios(struct uart_po if (termios->c_cflag & CRTSCTS) up->mcr |= UART_MCR_AFE; } From 652fe915dee521a3d3b2aee4cd6efd8f0a3ff1f7 Mon Sep 17 00:00:00 2001 From: Mieczyslaw Nalewaj Date: Tue, 18 Feb 2025 10:18:41 +0100 Subject: [PATCH 523/877] ramips: improve MT7621S core detection The proposed detection method was based on reading the LAUNCH_FREADY core flag. However, this method only works before the cores are launched. For this reason, the core number detection method has been changed to a simpler one. For mt6721s the 17th revision bit is zero, hence we know that it is this chip, so the number of cores is 1. Fixes: https://github.com/openwrt/openwrt/issues/17764 Tested-by: Enrico Mioso Tested-by: Simon Etzlstorfer Tested-by: Mauri Sandberg Co-authored-by: Shiji Yang Signed-off-by: Mieczyslaw Nalewaj Link: https://github.com/openwrt/openwrt/pull/17834 (cherry picked from commit bb84c256e701a21a97443ffe9dd1d510bd6c1c40) Link: https://github.com/openwrt/openwrt/pull/18015 Signed-off-by: Hauke Mehrtens --- ...ort-for-buggy-MT7621S-core-detection.patch | 50 +++++++------------ 1 file changed, 19 insertions(+), 31 deletions(-) diff --git a/target/linux/ramips/patches-6.6/320-MIPS-add-support-for-buggy-MT7621S-core-detection.patch b/target/linux/ramips/patches-6.6/320-MIPS-add-support-for-buggy-MT7621S-core-detection.patch index ef54835f89c2a3..50329953cf4a39 100644 --- a/target/linux/ramips/patches-6.6/320-MIPS-add-support-for-buggy-MT7621S-core-detection.patch +++ b/target/linux/ramips/patches-6.6/320-MIPS-add-support-for-buggy-MT7621S-core-detection.patch @@ -26,8 +26,18 @@ Suggested-by: Felix Fietkau Signed-off-by: Ilya Lipnitskiy Signed-off-by: Thomas Bogendoerfer --- - arch/mips/include/asm/mips-cps.h | 23 ++++++++++++++++++++++- - 1 file changed, 22 insertions(+), 1 deletion(-) + +The proposed detection method was based on reading the LAUNCH_FREADY core flag. +However, this method only works before the cores are launched. +For this reason, the core number detection method has been changed to a simpler one. +For mt6721s the 17th revision bit is zero, hence we know that it is this chip, +so the number of cores is 1. + +Co-authored-by: Shiji Yang +Signed-off-by: Mieczyslaw Nalewaj +--- + arch/mips/include/asm/mips-cps.h | 5 +++++ + 1 file changed, 5 insertions(+) --- a/arch/mips/include/asm/mips-cps.h +++ b/arch/mips/include/asm/mips-cps.h @@ -35,41 +45,19 @@ Signed-off-by: Thomas Bogendoerfer #include #include -+#include ++#include + extern unsigned long __cps_access_bad_size(void) __compiletime_error("Bad size for CPS accessor"); -@@ -162,12 +164,31 @@ static inline uint64_t mips_cps_cluster_ - */ - static inline unsigned int mips_cps_numcores(unsigned int cluster) - { -+ unsigned int ncores; -+ +@@ -165,6 +167,10 @@ static inline unsigned int mips_cps_numc if (!mips_cm_present()) return 0; ++ if (IS_ENABLED(CONFIG_SOC_MT7621) && ++ !FIELD_GET(0x20000, __raw_readl(MT7621_SYSC_BASE + SYSC_REG_CHIP_REV))) ++ return 1; ++ /* Add one before masking to handle 0xff indicating no cores */ -- return FIELD_GET(CM_GCR_CONFIG_PCORES, -+ ncores = FIELD_GET(CM_GCR_CONFIG_PCORES, + return FIELD_GET(CM_GCR_CONFIG_PCORES, mips_cps_cluster_config(cluster) + 1); -+ -+ if (IS_ENABLED(CONFIG_SOC_MT7621)) { -+ struct cpulaunch *launch; -+ -+ /* -+ * Ralink MT7621S SoC is single core, but the GCR_CONFIG method -+ * always reports 2 cores. Check the second core's LAUNCH_FREADY -+ * flag to detect if the second core is missing. This method -+ * only works before the core has been started. -+ */ -+ launch = (struct cpulaunch *)CKSEG0ADDR(CPULAUNCH); -+ launch += 2; /* MT7621 has 2 VPEs per core */ -+ if (!(launch->flags & LAUNCH_FREADY)) -+ ncores = 1; -+ } -+ -+ return ncores; - } - - /** From 88ac2caceb8f408d3263e0b7d46c8c542bcc1d4d Mon Sep 17 00:00:00 2001 From: Rudy Andram Date: Wed, 12 Feb 2025 19:28:49 +0000 Subject: [PATCH 524/877] wireless-regdb: Update to version 2025.02.20 b43aeb5 wireless-regdb: assert and correct maximum bandwidth within frequency difference 68588bf wireless-regdb: Update regulatory info for Syria (SY) for 2020 0dda57e wireless-regdb: Update regulatory info for Moldova (MD) on 6GHz for 2022 b19ab0b wireless-regdb: Update regulatory info for Azerbaijan (AZ) on 6GHz for 2024 f67f40d wireless-regdb: Update regulatory info for Oman (OM) bd70876 wireless-regdb: Update regulatory rules for Armenia (AM) on 2.4 and 5 GHz 6c7cbcc wireless-regdb: Permit 320 MHz bandwidth in 6 GHz band in ETSI/CEPT f9f6b30 wireless-regdb: Update regulatory rules for Austria (AT) 39b47ea wireless-regdb: Update regulatory info for Cayman Islands (KY) for 2024 3dd7ceb wireless-regdb: allow NO-INDOOR flag in db.txt 4d754a1 wireless-regdb: Update regulatory rules for Iran (IR) on both 2.4 and 5Ghz for 2021 8c8308a wireless-regdb: Update frequency range with NO-INDOOR for Oman (OM) c2f11e2 wireless-regdb: update regulatory database based on preceding changes Signed-off-by: Rudy Andram Link: https://github.com/openwrt/openwrt/pull/17957 Signed-off-by: Hauke Mehrtens (cherry picked from commit da2cc98458f46745de95e88b6066620fbd02b190) --- 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 7d4cf63c479f4b..7055b12bfa12ef 100644 --- a/package/firmware/wireless-regdb/Makefile +++ b/package/firmware/wireless-regdb/Makefile @@ -1,14 +1,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=wireless-regdb -PKG_VERSION:=2024.10.07 +PKG_VERSION:=2025.02.20 PKG_RELEASE:=1 PKG_LICENSE:=ISC PKG_LICENSE_FILES:=LICENSE PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/software/network/wireless-regdb/ -PKG_HASH:=f76f2bd79a653e9f9dd50548d99d03a4a4eb157da056dfd5892f403ec28fb3d5 +PKG_HASH:=57f8e7721cf5a880c13ae0c202edbb21092a060d45f9e9c59bcd2a8272bfa456 PKG_MAINTAINER:=Felix Fietkau From 3abbc154546042af5efe6d299e3e40133dfb3d7f Mon Sep 17 00:00:00 2001 From: John Audia Date: Wed, 12 Feb 2025 08:56:47 -0500 Subject: [PATCH 525/877] openssl: update to 3.0.16 Changes between 3.0.15 and 3.0.16 [11 Feb 2025] CVE-2024-13176[1] - Fixed timing side-channel in ECDSA signature computation. There is a timing signal of around 300 nanoseconds when the top word of the inverted ECDSA nonce value is zero. This can happen with significant probability only for some of the supported elliptic curves. In particular the NIST P-521 curve is affected. To be able to measure this leak, the attacker process must either be located in the same physical computer or must have a very fast network connection with low latency. CVE-2024-9143[2] - Fixed possible OOB memory access with invalid low-level GF(2^m) elliptic curve parameters. Use of the low-level GF(2^m) elliptic curve APIs with untrusted explicit values for the field polynomial can lead to out-of-bounds memory reads or writes. Applications working with "exotic" explicit binary (GF(2^m)) curve parameters, that make it possible to represent invalid field polynomials with a zero constant term, via the above or similar APIs, may terminate abruptly as a result of reading or writing outside of array bounds. Remote code execution cannot easily be ruled out. 1. https://www.openssl.org/news/vulnerabilities.html#CVE-2024-13176 2. https://www.openssl.org/news/vulnerabilities.html#CVE-2024-9143 Build system: x86/64 Build-tested: bcm27xx/bcm2712 Run-tested: bcm27xx/bcm2712 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/17947 Signed-off-by: Robert Marko (cherry picked from commit b4e6fd7b76440076eeff3a0789d40acbb5363ecf) --- 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 959424ce12c540..4829670f86fe70 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.15 +PKG_VERSION:=3.0.16 PKG_RELEASE:=1 PKG_BUILD_FLAGS:=no-mips16 gc-sections no-lto @@ -21,7 +21,7 @@ PKG_SOURCE_URL:= \ https://www.openssl.org/source/old/$(PKG_BASE)/ \ https://github.com/openssl/openssl/releases/download/$(PKG_NAME)-$(PKG_VERSION)/ -PKG_HASH:=23c666d0edf20f14249b3d8f0368acaee9ab585b09e1de82107c66e1f3ec9533 +PKG_HASH:=57e03c50feab5d31b152af2b764f10379aecd8ee92f16c985983ce4a99f7ef86 PKG_LICENSE:=Apache-2.0 PKG_LICENSE_FILES:=LICENSE From d93b6a2bc23fe3842d2292326dbec5ff91c70259 Mon Sep 17 00:00:00 2001 From: Maxim Anisimov Date: Mon, 3 Jun 2024 18:52:49 +0300 Subject: [PATCH 526/877] ramips: move zyimage creation to include/image-commands.mk This is required for upcoming Keenetic KN-3911 support Signed-off-by: Maxim Anisimov Link: https://github.com/openwrt/openwrt/pull/16830 (cherry picked from commit 79db5d65ca5a19fb37e7fb428dec798f713a8632) Link: https://github.com/openwrt/openwrt/pull/18055 Signed-off-by: Hauke Mehrtens --- include/image-commands.mk | 4 ++++ target/linux/ramips/image/Makefile | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/image-commands.mk b/include/image-commands.mk index 2568fb3ade5f3d..a627ffc202cc0a 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -732,6 +732,10 @@ define Build/zip rm -rf $@.tmp endef +define Build/zyimage + $(STAGING_DIR_HOST)/bin/zyimage $(1) $@ +endef + define Build/zyxel-ras-image let \ newsize="$(call exp_units,$(RAS_ROOTFS_SIZE))"; \ diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile index 569717694345c4..53b9c314ef65ec 100644 --- a/target/linux/ramips/image/Makefile +++ b/target/linux/ramips/image/Makefile @@ -167,10 +167,6 @@ define Build/wrg-header mv $@.new $@ endef -define Build/zyimage - $(STAGING_DIR_HOST)/bin/zyimage $(1) $@ -endef - define Device/Default PROFILES = Default BLOCKSIZE := 64k From 13e91178616ba4cacb1300aab536ce15d70b88d3 Mon Sep 17 00:00:00 2001 From: Maxim Anisimov Date: Thu, 31 Oct 2024 12:27:54 +0300 Subject: [PATCH 527/877] mediatek/filogic: enable mtd virtual concat support This is required for upcoming Keenetic KN-3911 support Signed-off-by: Maxim Anisimov Link: https://github.com/openwrt/openwrt/pull/16830 (cherry picked from commit 0d651dd302cf2b6968268f27a084363b9b398760) Link: https://github.com/openwrt/openwrt/pull/18055 Signed-off-by: Hauke Mehrtens --- target/linux/mediatek/filogic/config-6.6 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/mediatek/filogic/config-6.6 b/target/linux/mediatek/filogic/config-6.6 index 8b8444175dec4d..a450de2e79c5cb 100644 --- a/target/linux/mediatek/filogic/config-6.6 +++ b/target/linux/mediatek/filogic/config-6.6 @@ -272,6 +272,7 @@ CONFIG_MTD_UBI_BLOCK=y CONFIG_MTD_UBI_FASTMAP=y CONFIG_MTD_UBI_NVMEM=y CONFIG_MTD_UBI_WL_THRESHOLD=4096 +CONFIG_MTD_VIRT_CONCAT=y # CONFIG_MTK_CMDQ is not set CONFIG_MTK_CPUX_TIMER=y # CONFIG_MTK_CQDMA is not set From 895531f5c5e99c6013e1f23e6a708a7ed6ed841e Mon Sep 17 00:00:00 2001 From: Maxim Anisimov Date: Thu, 31 Oct 2024 10:30:08 +0300 Subject: [PATCH 528/877] mediatek/filogic: add Keenetic KN-3911 support Specification: - MT7981 CPU using 2.4GHz and 5GHz WiFi (both AX) - 512MB RAM - 128MB SPI NAND - 2 LEDs (green, orange) - 3 buttons (fn, reset, wps) - 2 2.5Gbit ethernet ports based on Airoha EN8811H phy Serial Interface: - 3 Pins GND, RX, TX - Settings: 115200, 8N1 Notes: - The device supports dual boot mode Flash instruction: The only way to flash OpenWrt image is to use tftp recovery mode in U-Boot: 1. Configure PC with static IP 192.168.1.2/24 and tftp server. 2. Rename "openwrt-mediatek-filogic-keenetic_kn-3911-squashfs-factory.bin" to "KN-3911_recovery.bin" and place it in tftp server directory. 3. Connect PC with ethernet port, press the reset button, power up the device and keep button pressed until status led start blinking. 4. Device will download file from server, write it to flash and reboot. Signed-off-by: Maxim Anisimov Link: https://github.com/openwrt/openwrt/pull/16830 (cherry picked from commit 5a4eb56a7bc7d1d8028d103d50b0dba2ff7808c4) Link: https://github.com/openwrt/openwrt/pull/18055 Signed-off-by: Hauke Mehrtens --- .../mediatek/dts/mt7981b-keenetic-kn-3911.dts | 300 ++++++++++++++++++ .../filogic/base-files/etc/board.d/02_network | 13 +- .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 4 + target/linux/mediatek/image/filogic.mk | 20 ++ 4 files changed, 331 insertions(+), 6 deletions(-) create mode 100644 target/linux/mediatek/dts/mt7981b-keenetic-kn-3911.dts diff --git a/target/linux/mediatek/dts/mt7981b-keenetic-kn-3911.dts b/target/linux/mediatek/dts/mt7981b-keenetic-kn-3911.dts new file mode 100644 index 00000000000000..8a9bf0f1a9bf45 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-keenetic-kn-3911.dts @@ -0,0 +1,300 @@ +// SPDX-License-Identifier: GPL-2.0-only OR MIT + +/dts-v1/; + +#include "mt7981.dtsi" + +/ { + model = "Keenetic KN-3911"; + compatible = "keenetic,kn-3911", "mediatek,mt7981"; + + aliases { + label-mac-device = &gmac0; + led-boot = &status_led; + led-failsafe = &status_led; + led-running = &status_led; + led-upgrade = &status_led; + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + gpio-keys { + compatible = "gpio-keys"; + + button-fn { + label = "fn"; + linux,code = ; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + }; + + button-reset { + label = "reset"; + linux,code = ; + gpios = <&pio 24 GPIO_ACTIVE_LOW>; + }; + + button-wps { + label = "wps"; + linux,code = ; + gpios = <&pio 29 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + status_led: led-0 { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&pio 11 GPIO_ACTIVE_HIGH>; + }; + + led-1 { + color = ; + function = LED_FUNCTION_WPS; + gpios = <&pio 12 GPIO_ACTIVE_LOW>; + }; + }; + + virtual_flash { + compatible = "mtd-concat"; + devices = <&firmware1 &firmware2>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "kernel"; + reg = <0x0 0x600000>; + }; + + partition@400000 { + label = "ubi"; + reg = <0x600000 0x0>; + }; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +ð { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&mdio_pins>; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + phy-handle = <&phy10>; + label = "lan"; + + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_factory_4 0>; + }; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "2500base-x"; + phy-handle = <&phy11>; + label = "wan"; + + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_factory_a 0>; + }; +}; + +&mdio_bus { + phy10: ethernet-phy@a { + reg = <0xa>; + interrupt-parent = <&pio>; + interrupts = <38 IRQ_TYPE_EDGE_FALLING>; + reset-gpios = <&pio 22 GPIO_ACTIVE_LOW>; + reset-assert-us = <10000>; + reset-deassert-us = <20000>; + }; + + phy11: ethernet-phy@b { + reg = <0xb>; + interrupt-parent = <&pio>; + interrupts = <23 IRQ_TYPE_EDGE_FALLING>; + reset-gpios = <&pio 27 GPIO_ACTIVE_LOW>; + reset-assert-us = <10000>; + reset-deassert-us = <20000>; + }; +}; + +&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>; + status = "okay"; + + /* Winbond W25N01GVZEIG (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>; + + /* bl2 */ + partition@0 { + label = "preloader"; + reg = <0x0 0x80000>; + read-only; + }; + + /* fip */ + partition@80000 { + label = "u-boot"; + reg = <0x80000 0x200000>; + read-only; + }; + + partition@280000 { + label = "u-config"; + reg = <0x280000 0x80000>; + read-only; + }; + + partition@300000 { + label = "rf-eeprom"; + reg = <0x300000 0x200000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x1000>; + }; + + /* lan mac */ + macaddr_factory_4: macaddr@4 { + compatible = "mac-base"; + reg = <0x4 0x6>; + #nvmem-cell-cells = <1>; + }; + + /* wan mac */ + macaddr_factory_a: macaddr@a { + compatible = "mac-base"; + reg = <0xa 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + + firmware1: partition@500000 { + label = "firmware_1"; + reg = <0x500000 0x3500000>; + }; + + partition@3a00000 { + label = "config_1"; + reg = <0x3a00000 0x80000>; + read-only; + }; + + partition@3a80000 { + label = "dump"; + reg = <0x3a80000 0x80000>; + read-only; + }; + + partition@3c00000 { + label = "u-state"; + reg = <0x3c00000 0x20000>; + read-only; + }; + + partition@3e80000 { + label = "u-config_res"; + reg = <0x3e80000 0x80000>; + read-only; + }; + + partition@3f00000 { + label = "rf-eeprom_res"; + reg = <0x3f00000 0x200000>; + read-only; + }; + + firmware2: partition@4100000 { + label = "firmware_2"; + reg = <0x4140000 0x3500000>; + }; + + partition@7600000 { + label = "config_2"; + reg = <0x7600000 0x80000>; + read-only; + }; + }; + }; +}; + +&wifi { + nvmem-cell-names = "eeprom"; + nvmem-cells = <&eeprom_factory_0>; + status = "okay"; +}; + +&sgmiisys0 { + /delete-node/ mediatek,pnswap; +}; 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 b9c149d072172e..722204051841e8 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 @@ -92,6 +92,13 @@ mediatek_setup_interfaces() dlink,aquila-pro-ai-m60-a1) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" internet ;; + keenetic,kn-3911|\ + smartrg,sdg-8622|\ + smartrg,sdg-8632|\ + smartrg,sdg-8733a|\ + yuncore,ax835) + ucidef_set_interfaces_lan_wan lan wan + ;; mediatek,mt7986a-rfb) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan6" "eth1 wan" ;; @@ -105,12 +112,6 @@ mediatek_setup_interfaces() mercusys,mr90x-v1-ubi) ucidef_set_interfaces_lan_wan "lan0 lan1 lan2" eth1 ;; - smartrg,sdg-8622|\ - smartrg,sdg-8632|\ - smartrg,sdg-8733a|\ - yuncore,ax835) - ucidef_set_interfaces_lan_wan lan wan - ;; tplink,tl-xdr6086|\ wavlink,wl-wn586x3) 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 69e39f76fc774c..a161fb5827bcfc 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 @@ -112,6 +112,10 @@ case "$board" in jdcloud,re-cp-03) [ "$PHYNBR" = "1" ] && mmc_get_mac_binary factory 0xa > /sys${DEVPATH}/macaddress ;; + keenetic,kn-3911) + [ "$PHYNBR" = "1" ] && \ + macaddr_setbit_la "$(mtd_get_mac_binary rf-eeprom 0x4)" > /sys${DEVPATH}/macaddress + ;; mercusys,mr90x-v1|\ tplink,re6000xd) addr=$(get_mac_binary "/tmp/tp_data/default-mac" 0) diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 135a954400cb95..f6d898fa600701 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -920,6 +920,26 @@ define Device/jdcloud_re-cp-03 endef TARGET_DEVICES += jdcloud_re-cp-03 +define Device/keenetic_kn-3911 + DEVICE_VENDOR := Keenetic + DEVICE_MODEL := KN-3911 + DEVICE_DTS := mt7981b-keenetic-kn-3911 + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware kmod-phy-airoha-en8811h + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_SIZE := 6144k + IMAGE_SIZE := 108544k + KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb | \ + append-squashfs4-fakeroot + IMAGES += factory.bin + IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | \ + append-ubi | check-size | zyimage -d 0x803911 -v "KN-3911" + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += keenetic_kn-3911 + define Device/mediatek_mt7981-rfb DEVICE_VENDOR := MediaTek DEVICE_MODEL := MT7981 rfb From d7d560b84bebf4e194a487b2a729dc5814a34053 Mon Sep 17 00:00:00 2001 From: Maxim Anisimov Date: Wed, 13 Nov 2024 17:17:17 +0300 Subject: [PATCH 529/877] mediatek/filogic: add Keenetic KN-3811 support Specification: * Mediatek MT7981BA * 256 MB SPI-NAND * 512 MB DDR4 RAM * MT7976CN DBDC AX Wi-Fi * MediaTek MT7531AE (3x LAN Gigabit ports) + Internal Gbe Phy (1x WAN Gigabit port) * 4x LED (power, internet, fn, wifi) * 3x buttons (wps, fn, reset) * 1x USB 3.0 port Serial Interface: * 3 Pins GND, RX, TX * Settings: 115200, 8N1 Notes: * The device supports dual boot mode * Fn led reassigned to wlan 2.4 Flash instruction: The only way to flash OpenWrt image is to use tftp recovery mode in U-Boot: 1. Configure PC with static IP 192.168.1.2/24 and tftp server. 2. Rename "openwrt-mediatek-filogic-keenetic_kn-3811-squashfs-factory.bin" to "KN-3811_recovery.bin" and place it in tftp server directory. 3. Connect PC with ethernet port, press the reset button, power up the device and keep button pressed until status led start blinking. 4. Device will download file from server, write it to flash and reboot. Signed-off-by: Maxim Anisimov Link: https://github.com/openwrt/openwrt/pull/17135 (cherry picked from commit d087a79b7b03fe93a221fd6246ce437c5c5325c3) Link: https://github.com/openwrt/openwrt/pull/18055 Signed-off-by: Hauke Mehrtens --- .../mediatek/dts/mt7981b-keenetic-kn-3811.dts | 368 ++++++++++++++++++ .../filogic/base-files/etc/board.d/02_network | 1 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 1 + target/linux/mediatek/image/filogic.mk | 20 + 4 files changed, 390 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7981b-keenetic-kn-3811.dts diff --git a/target/linux/mediatek/dts/mt7981b-keenetic-kn-3811.dts b/target/linux/mediatek/dts/mt7981b-keenetic-kn-3811.dts new file mode 100644 index 00000000000000..87043ec907a46f --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-keenetic-kn-3811.dts @@ -0,0 +1,368 @@ +// SPDX-License-Identifier: GPL-2.0-only OR MIT + +/dts-v1/; + +#include "mt7981.dtsi" + +/ { + model = "Keenetic KN-3811"; + compatible = "keenetic,kn-3811", "mediatek,mt7981"; + + aliases { + label-mac-device = &gmac0; + led-boot = &power_led; + led-failsafe = &power_led; + led-running = &power_led; + led-upgrade = &power_led; + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + gpio-keys { + compatible = "gpio-keys"; + + button-fn { + label = "fn"; + linux,code = ; + gpios = <&pio 5 GPIO_ACTIVE_LOW>; + }; + + button-reset { + label = "reset"; + linux,code = ; + gpios = <&pio 24 GPIO_ACTIVE_LOW>; + }; + + button-wps { + label = "wps"; + linux,code = ; + gpios = <&pio 29 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + /* fn led reassigned to wlan 2.4 */ + led-0 { + color = ; + function = LED_FUNCTION_WLAN_2GHZ; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + power_led: led-1 { + color = ; + function = LED_FUNCTION_POWER; + gpios = <&pio 11 GPIO_ACTIVE_HIGH>; + }; + + led-2 { + color = ; + function = LED_FUNCTION_WAN; + gpios = <&pio 12 GPIO_ACTIVE_LOW>; + }; + + led-3 { + color = ; + function = LED_FUNCTION_WLAN_5GHZ; + gpios = <&pio 34 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + }; + + usb_vbus: regulator-usb-vbus { + compatible = "regulator-fixed"; + regulator-name = "usb_vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpios = <&pio 6 GPIO_ACTIVE_HIGH>; + enable-active-high; + regulator-boot-on; + }; + + virtual_flash { + compatible = "mtd-concat"; + devices = <&firmware1 &storage1 &firmware2 &storage2>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "kernel"; + reg = <0x0 0x600000>; + }; + + partition@400000 { + label = "ubi"; + reg = <0x600000 0x0>; + }; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +ð { + 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; + }; + }; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "gmii"; + phy-handle = <&int_gbe_phy>; + label = "wan"; + + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_factory_a 0>; + }; +}; + +&mdio_bus { + switch: switch@1f { + compatible = "mediatek,mt7531"; + reg = <0x1f>; + reset-gpios = <&pio 22 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 = "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 = ; + 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>; + status = "okay"; + + /* Winbond W25N02KV (256M) */ + 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>; + + /* bl2 */ + partition@0 { + label = "preloader"; + reg = <0x0 0x80000>; + read-only; + }; + + /* fip */ + partition@80000 { + label = "u-boot"; + reg = <0x80000 0x200000>; + read-only; + }; + + partition@280000 { + label = "u-config"; + reg = <0x280000 0x80000>; + read-only; + }; + + partition@300000 { + label = "rf-eeprom"; + reg = <0x300000 0x200000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x1000>; + }; + + /* lan mac */ + macaddr_factory_4: macaddr@4 { + compatible = "mac-base"; + reg = <0x4 0x6>; + #nvmem-cell-cells = <1>; + }; + + /* wan mac */ + macaddr_factory_a: macaddr@a { + compatible = "mac-base"; + reg = <0xa 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + + firmware1: partition@500000 { + label = "firmware_1"; + reg = <0x500000 0x3a00000>; + }; + + partition@3f00000 { + label = "config_1"; + reg = <0x3f00000 0x80000>; + read-only; + }; + + partition@3f80000 { + label = "dump"; + reg = <0x3f80000 0x80000>; + read-only; + }; + + storage1: partition@4000000 { + label = "storage_a"; + reg = <0x4000000 0x3800000>; + }; + + partition@7800000 { + label = "u-state"; + reg = <0x7800000 0x20000>; + read-only; + }; + + partition@7a80000 { + label = "u-config_res"; + reg = <0x7a80000 0x80000>; + read-only; + }; + + partition@7b00000 { + label = "rf-eeprom_res"; + reg = <0x7b00000 0x200000>; + read-only; + }; + + firmware2: partition@7d00000 { + label = "firmware_2"; + reg = <0x7d00000 0x3a00000>; + }; + + partition@b700000 { + label = "config_2"; + reg = <0xb700000 0x80000>; + read-only; + }; + + storage2: partition@b780000 { + label = "storage_b"; + reg = <0xb780000 0x3880000>; + }; + }; + }; +}; + +&wifi { + nvmem-cell-names = "eeprom"; + nvmem-cells = <&eeprom_factory_0>; + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; + +&xhci { + status = "okay"; + vbus-supply = <&usb_vbus>; +}; 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 722204051841e8..b976463cff7e2e 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 @@ -33,6 +33,7 @@ mediatek_setup_interfaces() confiabits,mt7981|\ cudy,wr3000-v1|\ jcg,q30-pro|\ + keenetic,kn-3811|\ qihoo,360t7|\ routerich,ax3000|\ routerich,ax3000-ubootmod) 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 a161fb5827bcfc..a9d06f9b846d6f 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 @@ -112,6 +112,7 @@ case "$board" in jdcloud,re-cp-03) [ "$PHYNBR" = "1" ] && mmc_get_mac_binary factory 0xa > /sys${DEVPATH}/macaddress ;; + keenetic,kn-3811|\ keenetic,kn-3911) [ "$PHYNBR" = "1" ] && \ macaddr_setbit_la "$(mtd_get_mac_binary rf-eeprom 0x4)" > /sys${DEVPATH}/macaddress diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index f6d898fa600701..e8a2888ee0e958 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -920,6 +920,26 @@ define Device/jdcloud_re-cp-03 endef TARGET_DEVICES += jdcloud_re-cp-03 +define Device/keenetic_kn-3811 + DEVICE_VENDOR := Keenetic + DEVICE_MODEL := KN-3811 + DEVICE_DTS := mt7981b-keenetic-kn-3811 + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware kmod-usb3 + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_SIZE := 6144k + IMAGE_SIZE := 233984k + KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb | \ + append-squashfs4-fakeroot + IMAGES += factory.bin + IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | \ + append-ubi | check-size | zyimage -d 0x803811 -v "KN-3811" + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += keenetic_kn-3811 + define Device/keenetic_kn-3911 DEVICE_VENDOR := Keenetic DEVICE_MODEL := KN-3911 From 1ec8d8ea5c320fb15ff351d53f3d78f5d2dfa4d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Thu, 27 Feb 2025 08:04:50 +0100 Subject: [PATCH 530/877] kernel: r8125: update to v9.015.00 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changelog: https://github.com/openwrt/rtl8125/compare/9.014.01...9.015.00 Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit a8dea562aa6146f5955ef081ee3240f0b960edf9) --- package/kernel/r8125/Makefile | 4 ++-- ...0-r8125-print-link-speed-and-duplex-mode.patch | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/package/kernel/r8125/Makefile b/package/kernel/r8125/Makefile index 647630393a4141..232cf695b86f7a 100644 --- a/package/kernel/r8125/Makefile +++ b/package/kernel/r8125/Makefile @@ -1,12 +1,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=r8125 -PKG_VERSION:=9.014.01 +PKG_VERSION:=9.015.00 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://github.com/openwrt/rtl8125/releases/download/$(PKG_VERSION) -PKG_HASH:=f006aa95501738ca55c522812c9d1b473ac781675f3ad88ce341a09316b8aa13 +PKG_HASH:=7d6906336c3ad960c3e7c0299ad655659d7110bdc933c5b568b7f2536cb8ffc3 PKG_BUILD_PARALLEL:=1 PKG_LICENSE:=GPLv2 diff --git a/package/kernel/r8125/patches/200-r8125-print-link-speed-and-duplex-mode.patch b/package/kernel/r8125/patches/200-r8125-print-link-speed-and-duplex-mode.patch index a3b35621494d67..449cc9a7e271f1 100644 --- a/package/kernel/r8125/patches/200-r8125-print-link-speed-and-duplex-mode.patch +++ b/package/kernel/r8125/patches/200-r8125-print-link-speed-and-duplex-mode.patch @@ -18,11 +18,12 @@ Signed-off-by: Álvaro Fernández Rojas --- a/src/r8125.h +++ b/src/r8125.h -@@ -1672,6 +1672,8 @@ enum RTL8125_register_content { +@@ -1687,6 +1687,9 @@ enum RTL8125_register_content { LinkStatus = 0x02, FullDup = 0x01, +#define RTL8125_FULL_DUPLEX_MASK (_2500bpsF | _1000bpsF | FullDup) ++#define RTL8125_SPEED_1000_MASK (_1000bpsF | _1000bpsL | _2500bpsL) + /* DBG_reg */ Fix_Nak_1 = (1 << 4), @@ -37,11 +38,11 @@ Signed-off-by: Álvaro Fernández Rojas #include #include #include -@@ -5116,6 +5117,38 @@ rtl8125_link_down_patch(struct net_devic +@@ -5023,6 +5024,38 @@ rtl8125_link_down_patch(struct net_devic #endif } -+static unsigned int rtl8125_phy_duplex(u16 status) ++static unsigned int rtl8125_phy_duplex(u32 status) +{ + unsigned int duplex = DUPLEX_UNKNOWN; + @@ -55,14 +56,14 @@ Signed-off-by: Álvaro Fernández Rojas + return duplex; +} + -+static int rtl8125_phy_speed(u16 status) ++static int rtl8125_phy_speed(u32 status) +{ + int speed = SPEED_UNKNOWN; + + if (status & LinkStatus) { + if (status & _2500bpsF) + speed = SPEED_2500; -+ else if (status & _1000bpsF) ++ else if (status & RTL8125_SPEED_1000_MASK) + speed = SPEED_1000; + else if (status & _100bps) + speed = SPEED_100; @@ -76,14 +77,14 @@ Signed-off-by: Álvaro Fernández Rojas static void _rtl8125_check_link_status(struct net_device *dev, unsigned int link_state) { -@@ -5128,11 +5161,18 @@ _rtl8125_check_link_status(struct net_de +@@ -5035,11 +5068,18 @@ _rtl8125_check_link_status(struct net_de if (link_state == R8125_LINK_STATE_ON) { rtl8125_link_on_patch(dev); - if (netif_msg_ifup(tp)) - printk(KERN_INFO PFX "%s: link up\n", dev->name); + if (netif_msg_ifup(tp)) { -+ const u16 phy_status = RTL_R16(tp, PHYstatus); ++ const u32 phy_status = RTL_R32(tp, PHYstatus); + const unsigned int phy_duplex = rtl8125_phy_duplex(phy_status); + const int phy_speed = rtl8125_phy_speed(phy_status); + printk(KERN_INFO PFX "%s: Link is Up - %s/%s\n", From abd08419dea521e8fbb8479d67360c4972ba8fa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Thu, 27 Feb 2025 08:06:27 +0100 Subject: [PATCH 531/877] kernel: r8126: update to v10.015.00 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changelog: https://github.com/openwrt/rtl8126/compare/10.014.01...10.015.00 Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 3d3328bf5f019507896bfa9ffeb53777fc5bfeaa) --- package/kernel/r8126/Makefile | 4 ++-- ...8126-print-link-speed-and-duplex-mode.patch | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/package/kernel/r8126/Makefile b/package/kernel/r8126/Makefile index a8f60f9dbb664b..da43697bfb9e23 100644 --- a/package/kernel/r8126/Makefile +++ b/package/kernel/r8126/Makefile @@ -1,12 +1,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=r8126 -PKG_VERSION:=10.014.01 +PKG_VERSION:=10.015.00 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://github.com/openwrt/rtl8126/releases/download/$(PKG_VERSION) -PKG_HASH:=dbb10a7abd0972e4abd1b89ea4eb22fc55d6c1dc2f711b5acf4a3bc376275e21 +PKG_HASH:=fac513aa925264a95b053e7532fcda56022d29db288f6625fafee2759a8a6124 PKG_BUILD_PARALLEL:=1 PKG_LICENSE:=GPLv2 diff --git a/package/kernel/r8126/patches/200-r8126-print-link-speed-and-duplex-mode.patch b/package/kernel/r8126/patches/200-r8126-print-link-speed-and-duplex-mode.patch index 27b3d626c152be..236f80c7fd0e12 100644 --- a/package/kernel/r8126/patches/200-r8126-print-link-speed-and-duplex-mode.patch +++ b/package/kernel/r8126/patches/200-r8126-print-link-speed-and-duplex-mode.patch @@ -18,11 +18,13 @@ Signed-off-by: Álvaro Fernández Rojas --- a/src/r8126.h +++ b/src/r8126.h -@@ -1740,6 +1740,8 @@ enum RTL8126_register_content { +@@ -1756,6 +1756,10 @@ enum RTL8126_register_content { LinkStatus = 0x02, FullDup = 0x01, +#define RTL8126_FULL_DUPLEX_MASK (_5000bpsF | _2500bpsF | _1000bpsF | FullDup) ++#define RTL8126_SPEED_1000_MASK (_1000bpsF | _1000bpsL | _2500bpsL) ++#define RTL8126_SPEED_2500_MASK (_2500bpsF | _5000bpsL) + /* DBG_reg */ Fix_Nak_1 = (1 << 4), @@ -37,11 +39,11 @@ Signed-off-by: Álvaro Fernández Rojas #include #include #include -@@ -4744,6 +4745,40 @@ rtl8126_link_down_patch(struct net_devic +@@ -4661,6 +4662,40 @@ rtl8126_link_down_patch(struct net_devic #endif } -+static unsigned int rtl8126_phy_duplex(u16 status) ++static unsigned int rtl8126_phy_duplex(u32 status) +{ + unsigned int duplex = DUPLEX_UNKNOWN; + @@ -55,16 +57,16 @@ Signed-off-by: Álvaro Fernández Rojas + return duplex; +} + -+static int rtl8126_phy_speed(u16 status) ++static int rtl8126_phy_speed(u32 status) +{ + int speed = SPEED_UNKNOWN; + + if (status & LinkStatus) { + if (status & _5000bpsF) + speed = SPEED_5000; -+ else if (status & _2500bpsF) ++ else if (status & RTL8126_SPEED_2500_MASK) + speed = SPEED_2500; -+ else if (status & _1000bpsF) ++ else if (status & RTL8126_SPEED_1000_MASK) + speed = SPEED_1000; + else if (status & _100bps) + speed = SPEED_100; @@ -78,14 +80,14 @@ Signed-off-by: Álvaro Fernández Rojas static void _rtl8126_check_link_status(struct net_device *dev, unsigned int link_state) { -@@ -4756,11 +4791,18 @@ _rtl8126_check_link_status(struct net_de +@@ -4673,11 +4708,18 @@ _rtl8126_check_link_status(struct net_de if (link_state == R8126_LINK_STATE_ON) { rtl8126_link_on_patch(dev); - if (netif_msg_ifup(tp)) - printk(KERN_INFO PFX "%s: link up\n", dev->name); + if (netif_msg_ifup(tp)) { -+ const u16 phy_status = RTL_R16(tp, PHYstatus); ++ const u32 phy_status = RTL_R32(tp, PHYstatus); + const unsigned int phy_duplex = rtl8126_phy_duplex(phy_status); + const int phy_speed = rtl8126_phy_speed(phy_status); + printk(KERN_INFO PFX "%s: Link is Up - %s/%s\n", From 89f05e032b21c28f161825f28047eed845dff2cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Thu, 27 Feb 2025 08:31:12 +0100 Subject: [PATCH 532/877] omcproxy: update to latest version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changelog: https://github.com/openwrt/omcproxy/compare/bfba2aa75802ff1a70ef2fd3eba53409a8c6e93a...582cd8d3ae7e6af0073ce1d9198387af48affd60 Signed-off-by: Álvaro Fernández Rojas --- package/network/services/omcproxy/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/network/services/omcproxy/Makefile b/package/network/services/omcproxy/Makefile index 0ca0970af2b9f1..a295431cb553e5 100644 --- a/package/network/services/omcproxy/Makefile +++ b/package/network/services/omcproxy/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=omcproxy -PKG_RELEASE:=9 +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/omcproxy.git -PKG_MIRROR_HASH:=61f03d76b14149e417360b6aaa630e920b75a31a6a497353b7160b3a374b20b2 -PKG_SOURCE_DATE:=2021-11-04 -PKG_SOURCE_VERSION:=bfba2aa75802ff1a70ef2fd3eba53409a8c6e93a +PKG_MIRROR_HASH:=b18c6dcc323dc35cfeb3503562dd3d8b9fb27fcf6ddd98690a64bd709920ff3d +PKG_SOURCE_DATE:=2025-02-27 +PKG_SOURCE_VERSION:=582cd8d3ae7e6af0073ce1d9198387af48affd60 PKG_MAINTAINER:=Steven Barth PKG_LICENSE:=Apache-2.0 From c9b97c0b4de7b63334042960a07eb91decbcb7e6 Mon Sep 17 00:00:00 2001 From: Andrea Pesaresi Date: Wed, 15 Jan 2025 01:15:20 +0100 Subject: [PATCH 533/877] ethtool: update to 6.11 Version 6.11 - October 8, 2024 * Feature: cmis: print active and inactive firmware versions * Feature: flash transceiver module firmware (--flash-module-firmware) * Feature: add T1BRR 10Mb/s mode to link mode tables * Feature: support for disabling netlink from command line * Fix: fix lanes parameter format specifier * Fix: add missing clause 33 PSE manual description * Fix: qsf: Better handling of Page A2h netlink read failure * Fix: rss: retrieve ring count using ETHTOOL_GRXRINGS ioctl (-x) * Misc: man page formatting fix * changelog here: https://git.kernel.org/pub/scm/network/ethtool/ethtool.git/commit/NEWS?id=c0ea4b70c71334ef038f7a3416b228a50dada406 Tested on gl.inet MT6000, retrieve ring count is now working Signed-off-by: Andrea Pesaresi Link: https://github.com/openwrt/openwrt/pull/17607 Signed-off-by: Robert Marko (cherry picked from commit 9454331b7fc896704a2c60b28767c282eb9ca0bd) --- package/network/utils/ethtool/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/network/utils/ethtool/Makefile b/package/network/utils/ethtool/Makefile index cfb4cfaeb947f2..893fcc1eda18e5 100644 --- a/package/network/utils/ethtool/Makefile +++ b/package/network/utils/ethtool/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ethtool -PKG_VERSION:=6.10 +PKG_VERSION:=6.11 PKG_RELEASE:=1 PKG_MAINTAINER:=Felix Fietkau PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/software/network/ethtool -PKG_HASH:=cc613fe8a2bcddee17a1e6e0d763c0f3ea33c7e930658d2d7f601aa65e426a1f +PKG_HASH:=8d91f5c72ae3f25b7e88d4781279dcb320f71e30058914370b1c574c96b31202 PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:=COPYING From e664fe6a21a7670382bebab0c93dced8e81fb8ed Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Wed, 12 Feb 2025 04:21:22 +0000 Subject: [PATCH 534/877] ethtool: work-around ETHTOOL_GRSSH/ETHTOOL_SRSSH ABI breakage ethtool since version 6.9 introduced support for getting/setting RSS input transformation supported in Linux since version 6.8. The now changed kernel ioctl ABI, however, cannot be detected from userland, and ethtool since version 6.9 simply assumes that a previously reserved field is now used to set the input transformation. Unfortunately the default value RXH_XFRM_NO_CHANGE (0xff) used by ethtool userland creates an incompatibility with older kernels which cannot be resolved easily without introducing even more ABI breakage. Work-around the issue and fix support for --set-rxfh and --set-rxfh-indir ethtool userland tool commands by making the support for input_xfrm conditional on compile time, and keep it disabled for Linux 6.6. Fixes: 8c2dcd1518 ("ethtool: update to 6.10") Signed-off-by: Daniel Golle Tested-by: Stijn Segers (cherry picked from commit 3a7467ffde413677de5465dde78a62dfa8d6774f) --- package/network/utils/ethtool/Makefile | 5 ++ ...building-for-RSS-input-xfrm-optional.patch | 67 +++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 package/network/utils/ethtool/patches/0001-ethtool-make-building-for-RSS-input-xfrm-optional.patch diff --git a/package/network/utils/ethtool/Makefile b/package/network/utils/ethtool/Makefile index 893fcc1eda18e5..5da65273ca937f 100644 --- a/package/network/utils/ethtool/Makefile +++ b/package/network/utils/ethtool/Makefile @@ -57,6 +57,11 @@ else CONFIGURE_ARGS += --disable-netlink --disable-pretty-dump endif +# enable support for input_xfrm with kernels newer than 6.6 +ifeq ($(CONFIG_LINUX_6_6),) +CONFIGURE_ARGS += --enable-rss-input-xfrm +endif + define Package/ethtool/install $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) $(PKG_BUILD_DIR)/ethtool $(1)/usr/sbin diff --git a/package/network/utils/ethtool/patches/0001-ethtool-make-building-for-RSS-input-xfrm-optional.patch b/package/network/utils/ethtool/patches/0001-ethtool-make-building-for-RSS-input-xfrm-optional.patch new file mode 100644 index 00000000000000..4c8403dcbc5d18 --- /dev/null +++ b/package/network/utils/ethtool/patches/0001-ethtool-make-building-for-RSS-input-xfrm-optional.patch @@ -0,0 +1,67 @@ +From c88eb6f4e9b2d8f71f3391db2bf0ec82ecccae81 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Wed, 12 Feb 2025 04:12:42 +0000 +Subject: [PATCH] ethtool: make building for RSS input xfrm optional + +Unfortunately there is no way to detect at runtime if the kernel the +support for RSS input transformation, and the default value +RXH_XFRM_NO_CHANGE (0xff) used by newer ethtool results in breakage +with older kernels. +As a stop-gap solution simply don't compile with support for input +xfrm by default. + +Signed-off-by: Daniel Golle +--- + configure.ac | 10 ++++++++++ + ethtool.c | 10 ++++++++++ + 2 files changed, 20 insertions(+) + +--- a/configure.ac ++++ b/configure.ac +@@ -45,6 +45,16 @@ if test x$enable_pretty_dump = xyes; the + fi + AM_CONDITIONAL([ETHTOOL_ENABLE_PRETTY_DUMP], [test x$enable_pretty_dump = xyes]) + ++AC_ARG_ENABLE(rss-input-xfrm, ++ [ --enable-rss-input-xfrm build with support for RSS input transformation (disabled by default)], ++ , ++ enable_rss_input_xfrm=no) ++if test x$enable_rss_input_xfrm = xyes; then ++ AC_DEFINE(ETHTOOL_ENABLE_RSS_INPUT_XFRM, 1, ++ [Define this to enable building with support for RSS input transformation.]) ++fi ++AM_CONDITIONAL([ETHTOOL_ENABLE_RSS_INPUT_XFRM], [test x$enable_rss_input_xfrm = xyes]) ++ + AC_ARG_WITH([bash-completion-dir], + AS_HELP_STRING([--with-bash-completion-dir[=PATH]], + [Install the bash-completion script in this directory. @<:@default=yes@:>@]), +--- a/ethtool.c ++++ b/ethtool.c +@@ -4109,9 +4109,11 @@ static int do_grxfh(struct cmd_context * + (const char *)hfuncs->data + i * ETH_GSTRING_LEN, + (rss->hfunc & (1 << i)) ? "on" : "off"); + ++#ifdef ETHTOOL_ENABLE_RSS_INPUT_XFRM + printf("RSS input transformation:\n"); + printf(" symmetric-xor: %s\n", + (rss->input_xfrm & RXH_XFRM_SYM_XOR) ? "on" : "off"); ++#endif + + out: + free(hfuncs); +@@ -4431,7 +4433,15 @@ static int do_srxfh(struct cmd_context * + rss->cmd = ETHTOOL_SRSSH; + rss->rss_context = rss_context; + rss->hfunc = req_hfunc; ++#ifdef ETHTOOL_ENABLE_RSS_INPUT_XFRM + rss->input_xfrm = req_input_xfrm; ++#else ++ if (req_input_xfrm != 0xff) { ++ perror("Compiled for kernel without support for input transformation"); ++ err = 1; ++ goto free; ++ } ++#endif + if (delete) { + rss->indir_size = rss->key_size = 0; + } else { From f3a210b7425497155b22e197a4bcdaa034f142fa Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 28 Feb 2025 16:27:36 +0100 Subject: [PATCH 535/877] unetd: update to Git HEAD (2025-02-28) 75a236be122a service: add missing null pointer check f5341f327539 ubus: add api for generating and validating security tokens 3fab99eab4d5 add udebug support 28d86bd30e97 pex: only respond to update requests when we have network data 8e6f37cc361e pex-msg: ignore no-data responses if version is zero 12e6cf7f63e1 pex: create pex host from update responses edc8fdae463a ubus: show the local addresses in network status Signed-off-by: Felix Fietkau (cherry picked from commit ce68f61cb67a4701a108f838f510e72ca63ed78e) --- package/network/services/unetd/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/network/services/unetd/Makefile b/package/network/services/unetd/Makefile index 6923c688738a25..29b192e4f1dcd6 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:=2025-01-29 -PKG_SOURCE_VERSION:=082b5482b97f20dc4745bc3d645e33b584cc28e4 -PKG_MIRROR_HASH:=090e7dab3b9a3358706dcee4f1889b7a1f0bdf535f2d6a0580f4160e23ccf9cb +PKG_SOURCE_DATE:=2025-02-28 +PKG_SOURCE_VERSION:=edc8fdae463ad7ce9bfb876af0c653ab1da197df +PKG_MIRROR_HASH:=2f0ce439b9e4815b3f20b9aaf4378e3aac114f429bb8bfd06739df118b3da9c8 PKG_LICENSE:=GPL-2.0 PKG_MAINTAINER:=Felix Fietkau @@ -32,7 +32,7 @@ define Package/unetd SECTION:=net CATEGORY:=Network TITLE:=WireGuard based VPN connection manager for OpenWrt - DEPENDS:=+libubox +libubus +libblobmsg-json +libnl-tiny +kmod-wireguard +UNETD_VXLAN_SUPPORT:libbpf + DEPENDS:=+libubox +libubus +libudebug +libblobmsg-json +libnl-tiny +kmod-wireguard +UNETD_VXLAN_SUPPORT:libbpf endef define Package/unetd/config From efffa8a6084ea534751fe28c90a83a0b486f7176 Mon Sep 17 00:00:00 2001 From: Cedric CHEDALEUX Date: Mon, 17 Feb 2025 10:41:32 +0100 Subject: [PATCH 536/877] scripts/feeds: shallow clone for specific commit update When a feed is referenced with a specific commit (i.e. ^), a full clone was performed and a branch was created from the sha1 and named with the sha1. Other git clones operations are shallowed. As Git does not support clone at a specific commit, let's first perform a shallow clone to latest commit, then fetch the relevant commit and finally checkout it (no more 'pseudo' branch). It saves bandwith and significantly speeds up the feed update process. Signed-off-by: Cedric CHEDALEUX Link: https://github.com/openwrt/openwrt/pull/18003 Signed-off-by: Robert Marko (cherry picked from commit 32d0a57dc10811a24816e51f10e55963f40fe462) --- scripts/feeds | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/feeds b/scripts/feeds index d07c28bc50f8bd..0ff67658144964 100755 --- a/scripts/feeds +++ b/scripts/feeds @@ -157,7 +157,7 @@ my %update_method = ( 'src-git' => { 'init' => "git clone --depth 1 '%s' '%s'", 'init_branch' => "git clone --depth 1 --branch '%s' '%s' '%s'", - 'init_commit' => "git clone '%s' '%s' && cd '%s' && git checkout -b '%s' '%s' && cd -", + 'init_commit' => "git clone --depth 1 '%s' '%s' && cd '%s' && git fetch --depth=1 origin '%s' && git -c advice.detachedHead=false checkout '%s' && cd -", 'update' => "git pull --ff-only", 'update_rebase' => "git pull --rebase=merges", 'update_stash' => "git pull --rebase=merges --autostash", From 9836836302afa6a7687e6b19c7780be8d16e8911 Mon Sep 17 00:00:00 2001 From: Cedric CHEDALEUX Date: Mon, 17 Feb 2025 10:44:36 +0100 Subject: [PATCH 537/877] scripts/feeds: shallow clone submodules When a feed has submodules, all its submodules are fully cloned whereas the feed itself is shallowed. Let's be consistent and perform shallow clones as well for the submodules. Signed-off-by: Cedric CHEDALEUX Link: https://github.com/openwrt/openwrt/pull/18003 Signed-off-by: Robert Marko (cherry picked from commit 9ec32cfb2733856a2ab4caee07d9b3297568381d) --- scripts/feeds | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/feeds b/scripts/feeds index 0ff67658144964..959995c7afa171 100755 --- a/scripts/feeds +++ b/scripts/feeds @@ -162,7 +162,7 @@ my %update_method = ( 'update_rebase' => "git pull --rebase=merges", 'update_stash' => "git pull --rebase=merges --autostash", 'update_force' => "git pull --ff-only || (git reset --hard HEAD; git pull --ff-only; exit 1)", - 'post_update' => "git submodule update --init --recursive", + 'post_update' => "git submodule update --init --recursive --depth 1", 'controldir' => ".git", 'revision' => "git rev-parse HEAD | tr -d '\n'"}, 'src-git-full' => { From b7ab34d46ca354ed002c192c84aef5fa8fb53ed7 Mon Sep 17 00:00:00 2001 From: Matthew Cather Date: Mon, 3 Mar 2025 13:22:11 -0600 Subject: [PATCH 538/877] hostapd: fix ucode memory leak with strings This fixes a common reference counting bug typically along the lines of: ``` uc_value_push(ucv_get(ucv_string_new(...))); ``` This would leave our new string with a reference count of 2, one from the construction of the string, the other from `ucv_get`. This would prevent the strings from being correctly cleaned up when it goes out of scope. Signed-off-by: Matthew Cather (cherry picked from commit f79968ee0f76c41414fb0c08980b9c2a259964d3) --- .../services/hostapd/src/src/ap/ucode.c | 22 +++++++++---------- .../services/hostapd/src/src/utils/ucode.c | 2 +- .../hostapd/src/wpa_supplicant/ucode.c | 17 +++++++------- 3 files changed, 19 insertions(+), 22 deletions(-) diff --git a/package/network/services/hostapd/src/src/ap/ucode.c b/package/network/services/hostapd/src/src/ap/ucode.c index 2da2b4dc938738..a7cbea05187214 100644 --- a/package/network/services/hostapd/src/src/ap/ucode.c +++ b/package/network/services/hostapd/src/src/ap/ucode.c @@ -56,7 +56,7 @@ hostapd_ucode_update_bss_list(struct hostapd_iface *iface, uc_value_t *if_bss, u 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_array_set(list, i, 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)); @@ -721,11 +721,10 @@ int hostapd_ucode_sta_auth(struct hostapd_data *hapd, struct sta_info *sta) if (wpa_ucode_call_prepare("sta_auth")) return 0; - uc_value_push(ucv_get(ucv_string_new(hapd->conf->iface))); + uc_value_push(ucv_string_new(hapd->conf->iface)); snprintf(addr, sizeof(addr), MACSTR, MAC2STR(sta->addr)); - val = ucv_string_new(addr); - uc_value_push(ucv_get(val)); + uc_value_push(ucv_string_new(addr)); val = wpa_ucode_call(2); @@ -787,16 +786,15 @@ void hostapd_ucode_sta_connected(struct hostapd_data *hapd, struct sta_info *sta if (wpa_ucode_call_prepare("sta_connected")) return; - uc_value_push(ucv_get(ucv_string_new(hapd->conf->iface))); + uc_value_push(ucv_string_new(hapd->conf->iface)); snprintf(addr, sizeof(addr), MACSTR, MAC2STR(sta->addr)); - val = ucv_string_new(addr); - uc_value_push(ucv_get(val)); + uc_value_push(ucv_string_new(addr)); val = ucv_object_new(vm); if (sta->psk_idx) ucv_object_add(val, "psk_idx", ucv_int64_new(sta->psk_idx - 1)); - uc_value_push(ucv_get(val)); + uc_value_push(val); val = wpa_ucode_call(3); if (ucv_type(val) != UC_OBJECT) @@ -889,8 +887,8 @@ void hostapd_ucode_bss_cb(struct hostapd_data *hapd, const char *type) return; val = hostapd_ucode_bss_get_uval(hapd); - uc_value_push(ucv_get(ucv_string_new(hapd->iface->phy))); - uc_value_push(ucv_get(ucv_string_new(hapd->conf->iface))); + uc_value_push(ucv_string_new(hapd->iface->phy)); + uc_value_push(ucv_string_new(hapd->conf->iface)); uc_value_push(ucv_get(val)); ucv_put(wpa_ucode_call(3)); ucv_gc(vm); @@ -923,9 +921,9 @@ void hostapd_ucode_apup_newpeer(struct hostapd_data *hapd, const char *ifname) return; val = hostapd_ucode_bss_get_uval(hapd); - uc_value_push(ucv_get(ucv_string_new(hapd->conf->iface))); // BSS ifname + uc_value_push(ucv_string_new(hapd->conf->iface)); // BSS ifname uc_value_push(ucv_get(val)); - uc_value_push(ucv_get(ucv_string_new(ifname))); // APuP peer ifname + uc_value_push(ucv_string_new(ifname)); // APuP peer ifname ucv_put(wpa_ucode_call(2)); ucv_gc(vm); } diff --git a/package/network/services/hostapd/src/src/utils/ucode.c b/package/network/services/hostapd/src/src/utils/ucode.c index 29c753c326905d..af8614b8cb8580 100644 --- a/package/network/services/hostapd/src/src/utils/ucode.c +++ b/package/network/services/hostapd/src/src/utils/ucode.c @@ -171,7 +171,7 @@ uc_value_t *uc_wpa_freq_info(uc_vm_t *vm, size_t nargs) 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, "hw_mode_str", 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)); diff --git a/package/network/services/hostapd/src/wpa_supplicant/ucode.c b/package/network/services/hostapd/src/wpa_supplicant/ucode.c index 9380b301c36eeb..31427c39a17541 100644 --- a/package/network/services/hostapd/src/wpa_supplicant/ucode.c +++ b/package/network/services/hostapd/src/wpa_supplicant/ucode.c @@ -49,7 +49,7 @@ void wpas_ucode_add_bss(struct wpa_supplicant *wpa_s) if (wpa_ucode_call_prepare("iface_add")) return; - uc_value_push(ucv_get(ucv_string_new(wpa_s->ifname))); + uc_value_push(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); @@ -67,7 +67,7 @@ void wpas_ucode_free_bss(struct wpa_supplicant *wpa_s) if (wpa_ucode_call_prepare("iface_remove")) return; - uc_value_push(ucv_get(ucv_string_new(wpa_s->ifname))); + uc_value_push(ucv_string_new(wpa_s->ifname)); uc_value_push(ucv_get(val)); ucv_put(wpa_ucode_call(2)); ucv_gc(vm); @@ -86,9 +86,9 @@ void wpas_ucode_update_state(struct wpa_supplicant *wpa_s) 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_string_new(wpa_s->ifname)); uc_value_push(ucv_get(val)); - uc_value_push(ucv_get(ucv_string_new(state))); + uc_value_push(ucv_string_new(state)); ucv_put(wpa_ucode_call(3)); ucv_gc(vm); } @@ -108,9 +108,9 @@ void wpas_ucode_event(struct wpa_supplicant *wpa_s, int event, union wpa_event_d if (wpa_ucode_call_prepare("event")) return; - uc_value_push(ucv_get(ucv_string_new(wpa_s->ifname))); + uc_value_push(ucv_string_new(wpa_s->ifname)); uc_value_push(ucv_get(val)); - uc_value_push(ucv_get(ucv_string_new(event_to_string(event)))); + uc_value_push(ucv_string_new(event_to_string(event))); val = ucv_object_new(vm); uc_value_push(ucv_get(val)); @@ -212,15 +212,14 @@ 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; + uc_value_t *ret; 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)); + ucv_object_add(ret, "state", ucv_string_new(wpa_supplicant_state_txt(wpa_s->wpa_state))); bss = wpa_s->current_bss; if (bss) { From af658023191d6fad252e1a08c9b8b1a23761d7a4 Mon Sep 17 00:00:00 2001 From: Matthew Cather Date: Mon, 3 Mar 2025 13:40:39 -0600 Subject: [PATCH 539/877] hostapd: clean-up references to local variables Remove extra ucv_get calls when passing a referenced value to an object without using it further. Signed-off-by: Matthew Cather Signed-off-by: Felix Fietkau (cherry picked from commit 22eaf1864731dd29918357b26565dbd9420fd314) --- package/network/services/hostapd/src/src/ap/ucode.c | 9 +++++---- package/network/services/hostapd/src/src/utils/ucode.c | 2 +- .../network/services/hostapd/src/wpa_supplicant/ucode.c | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/package/network/services/hostapd/src/src/ap/ucode.c b/package/network/services/hostapd/src/src/ap/ucode.c index a7cbea05187214..e1c8289c515b09 100644 --- a/package/network/services/hostapd/src/src/ap/ucode.c +++ b/package/network/services/hostapd/src/src/ap/ucode.c @@ -59,7 +59,7 @@ hostapd_ucode_update_bss_list(struct hostapd_iface *iface, uc_value_t *if_bss, u ucv_array_set(list, i, 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)); + ucv_object_add(if_bss, iface->phy, list); } static void @@ -77,9 +77,10 @@ hostapd_ucode_update_interfaces(void) 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_object_add(ucv_prototype_get(global), "interfaces", ifs); + ucv_object_add(ucv_prototype_get(global), "interface_bss", if_bss); + ucv_object_add(ucv_prototype_get(global), "bss", bss); + ucv_gc(vm); } diff --git a/package/network/services/hostapd/src/src/utils/ucode.c b/package/network/services/hostapd/src/src/utils/ucode.c index af8614b8cb8580..e61cb18db0bb1f 100644 --- a/package/network/services/hostapd/src/src/utils/ucode.c +++ b/package/network/services/hostapd/src/src/utils/ucode.c @@ -425,7 +425,7 @@ uc_value_t *wpa_ucode_global_init(const char *name, uc_resource_type_t *global_t uc_vm_registry_set(&vm, "hostap.global", global); proto = ucv_prototype_get(global); - ucv_object_add(proto, "data", ucv_get(ucv_object_new(&vm))); + ucv_object_add(proto, "data", ucv_object_new(&vm)); #define ADD_CONST(x) ucv_object_add(proto, #x, ucv_int64_new(x)) ADD_CONST(MSG_EXCESSIVE); diff --git a/package/network/services/hostapd/src/wpa_supplicant/ucode.c b/package/network/services/hostapd/src/wpa_supplicant/ucode.c index 31427c39a17541..bef7552873e327 100644 --- a/package/network/services/hostapd/src/wpa_supplicant/ucode.c +++ b/package/network/services/hostapd/src/wpa_supplicant/ucode.c @@ -38,7 +38,7 @@ wpas_ucode_update_interfaces(void) 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_object_add(ucv_prototype_get(global), "interfaces", ifs); ucv_gc(vm); } From 1af7bf38f7e78becefc0b5af503bde735c58f767 Mon Sep 17 00:00:00 2001 From: Matthew Cather Date: Mon, 3 Mar 2025 14:00:35 -0600 Subject: [PATCH 540/877] hostapd: consistent reference counting for registry Since `wpa_ucode_registry_add` collects its own reference to the values added, the two functions `hostapd_ucode_bss_get_uval` and `hostapd_ucode_iface_get_uval` would sometimes return a referenced object (from `uc_resource_new`) and sometimes return an unreferenced object (from `wpa_ucode_registry_get`). Now, both functions always return a referenced object. This change also indirectly fixes `hostapd_ucode_bss_get_uval`, ensuring it now always returns a referenced object. Signed-off-by: Matthew Cather Signed-off-by: Felix Fietkau (cherry picked from commit 7729f960933a03c9eebd2b65a695ea57718ccb77) --- package/network/services/hostapd/src/src/ap/ucode.c | 11 ++++++----- .../services/hostapd/src/wpa_supplicant/ucode.c | 6 +++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/package/network/services/hostapd/src/src/ap/ucode.c b/package/network/services/hostapd/src/src/ap/ucode.c index e1c8289c515b09..0e9a4fef119b65 100644 --- a/package/network/services/hostapd/src/src/ap/ucode.c +++ b/package/network/services/hostapd/src/src/ap/ucode.c @@ -23,7 +23,7 @@ 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); + return ucv_get(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); @@ -37,7 +37,7 @@ 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); + return ucv_get(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); @@ -54,10 +54,9 @@ hostapd_ucode_update_bss_list(struct hostapd_iface *iface, uc_value_t *if_bss, u list = ucv_array_new(vm); for (i = 0; iface->bss && 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_string_new(hapd->conf->iface)); - ucv_object_add(bss, hapd->conf->iface, ucv_get(val)); + ucv_object_add(bss, hapd->conf->iface, hostapd_ucode_bss_get_uval(hapd)); } ucv_object_add(if_bss, iface->phy, list); } @@ -73,7 +72,7 @@ hostapd_ucode_update_interfaces(void) 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))); + ucv_object_add(ifs, iface->phy, hostapd_ucode_iface_get_uval(iface)); hostapd_ucode_update_bss_list(iface, if_bss, bss); } @@ -892,6 +891,7 @@ void hostapd_ucode_bss_cb(struct hostapd_data *hapd, const char *type) uc_value_push(ucv_string_new(hapd->conf->iface)); uc_value_push(ucv_get(val)); ucv_put(wpa_ucode_call(3)); + ucv_put(val); ucv_gc(vm); } @@ -926,6 +926,7 @@ void hostapd_ucode_apup_newpeer(struct hostapd_data *hapd, const char *ifname) uc_value_push(ucv_get(val)); uc_value_push(ucv_string_new(ifname)); // APuP peer ifname ucv_put(wpa_ucode_call(2)); + ucv_put(val); ucv_gc(vm); } #endif // def CONFIG_APUP diff --git a/package/network/services/hostapd/src/wpa_supplicant/ucode.c b/package/network/services/hostapd/src/wpa_supplicant/ucode.c index bef7552873e327..506bde45c93d06 100644 --- a/package/network/services/hostapd/src/wpa_supplicant/ucode.c +++ b/package/network/services/hostapd/src/wpa_supplicant/ucode.c @@ -20,7 +20,7 @@ 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); + return ucv_get(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); @@ -36,7 +36,7 @@ wpas_ucode_update_interfaces(void) 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(ifs, wpa_s->ifname, wpas_ucode_iface_get_uval(wpa_s)); ucv_object_add(ucv_prototype_get(global), "interfaces", ifs); ucv_gc(vm); @@ -50,7 +50,7 @@ void wpas_ucode_add_bss(struct wpa_supplicant *wpa_s) return; uc_value_push(ucv_string_new(wpa_s->ifname)); - uc_value_push(ucv_get(wpas_ucode_iface_get_uval(wpa_s))); + uc_value_push(wpas_ucode_iface_get_uval(wpa_s)); ucv_put(wpa_ucode_call(2)); ucv_gc(vm); } From 634ac2bab7c4bd70f8497b4847d30f12b520ec3f Mon Sep 17 00:00:00 2001 From: Matthew Cather Date: Mon, 3 Mar 2025 15:46:03 -0600 Subject: [PATCH 541/877] hostapd: get reference to object before removal `ucv_array_set` releases the array's reference to the object being cleared. If this is the last reference to the object, it will be freed, making our pointer `val` invalid. To avoid this, we need to obtain our own reference to the object so we can safely return `val`. Signed-off-by: Matthew Cather (cherry picked from commit 6a10da2934441a59283394a84917edf4983e3043) --- package/network/services/hostapd/src/src/ap/ucode.c | 4 +++- package/network/services/hostapd/src/src/utils/ucode.c | 1 + package/network/services/hostapd/src/wpa_supplicant/ucode.c | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/package/network/services/hostapd/src/src/ap/ucode.c b/package/network/services/hostapd/src/src/ap/ucode.c index 0e9a4fef119b65..26ecc6ad309676 100644 --- a/package/network/services/hostapd/src/src/ap/ucode.c +++ b/package/network/services/hostapd/src/src/ap/ucode.c @@ -876,7 +876,7 @@ void hostapd_ucode_free(void) void hostapd_ucode_free_iface(struct hostapd_iface *iface) { - wpa_ucode_registry_remove(iface_registry, iface->ucode.idx); + ucv_put(wpa_ucode_registry_remove(iface_registry, iface->ucode.idx)); } void hostapd_ucode_bss_cb(struct hostapd_data *hapd, const char *type) @@ -910,6 +910,8 @@ void hostapd_ucode_free_bss(struct hostapd_data *hapd) uc_value_push(ucv_string_new(hapd->conf->iface)); uc_value_push(ucv_get(val)); ucv_put(wpa_ucode_call(2)); + + ucv_put(val); ucv_gc(vm); } diff --git a/package/network/services/hostapd/src/src/utils/ucode.c b/package/network/services/hostapd/src/src/utils/ucode.c index e61cb18db0bb1f..7636e46aaf2894 100644 --- a/package/network/services/hostapd/src/src/utils/ucode.c +++ b/package/network/services/hostapd/src/src/utils/ucode.c @@ -470,6 +470,7 @@ uc_value_t *wpa_ucode_registry_remove(uc_value_t *reg, int idx) if (!val) return NULL; + ucv_get(val); ucv_array_set(reg, idx - 1, NULL); dataptr = ucv_resource_dataptr(val, NULL); if (dataptr) diff --git a/package/network/services/hostapd/src/wpa_supplicant/ucode.c b/package/network/services/hostapd/src/wpa_supplicant/ucode.c index 506bde45c93d06..8335a27e892b88 100644 --- a/package/network/services/hostapd/src/wpa_supplicant/ucode.c +++ b/package/network/services/hostapd/src/wpa_supplicant/ucode.c @@ -70,6 +70,7 @@ void wpas_ucode_free_bss(struct wpa_supplicant *wpa_s) uc_value_push(ucv_string_new(wpa_s->ifname)); uc_value_push(ucv_get(val)); ucv_put(wpa_ucode_call(2)); + ucv_put(val); ucv_gc(vm); } From f0dbdf6b7fdf2c3ced067b62e678dccdb32cbab7 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 5 Mar 2025 08:00:43 +0100 Subject: [PATCH 542/877] hostapd: add missing ctrl socket initialization on bss add Fixes adding/removing individual bss interfaces Signed-off-by: Felix Fietkau (cherry picked from commit d65d546bce36ec71e3cda4e631f24cc711f7bcb2) --- package/network/services/hostapd/src/src/ap/ucode.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package/network/services/hostapd/src/src/ap/ucode.c b/package/network/services/hostapd/src/src/ap/ucode.c index 26ecc6ad309676..aa273c12cf6fc4 100644 --- a/package/network/services/hostapd/src/src/ap/ucode.c +++ b/package/network/services/hostapd/src/src/ap/ucode.c @@ -362,6 +362,8 @@ uc_hostapd_iface_add_bss(uc_vm_t *vm, size_t nargs) hapd->driver = iface->bss[0]->driver; hapd->drv_priv = iface->bss[0]->drv_priv; + os_strlcpy(hapd->ctrl_sock_iface, hapd->conf->iface, + sizeof(hapd->ctrl_sock_iface)); if (interfaces->ctrl_iface_init && interfaces->ctrl_iface_init(hapd) < 0) goto free_hapd; From 56559278b78900f6cae5fda6b8d1bb9cda41e8bf Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 5 Mar 2025 09:19:12 +0100 Subject: [PATCH 543/877] hostapd: add missing #ifdef to fix compile error when 802.11be support is disabled Fixes: d65d546bce36 ("hostapd: add missing ctrl socket initialization on bss add") Signed-off-by: Felix Fietkau (cherry picked from commit 46c17c22cd9cdccbdb0f1eeddb3f087ff8d9486f) --- package/network/services/hostapd/src/src/ap/ucode.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package/network/services/hostapd/src/src/ap/ucode.c b/package/network/services/hostapd/src/src/ap/ucode.c index aa273c12cf6fc4..b13c0ff77c7fe0 100644 --- a/package/network/services/hostapd/src/src/ap/ucode.c +++ b/package/network/services/hostapd/src/src/ap/ucode.c @@ -362,8 +362,10 @@ uc_hostapd_iface_add_bss(uc_vm_t *vm, size_t nargs) hapd->driver = iface->bss[0]->driver; hapd->drv_priv = iface->bss[0]->drv_priv; +#ifdef CONFIG_IEEE80211BE os_strlcpy(hapd->ctrl_sock_iface, hapd->conf->iface, sizeof(hapd->ctrl_sock_iface)); +#endif if (interfaces->ctrl_iface_init && interfaces->ctrl_iface_init(hapd) < 0) goto free_hapd; From 315943c61649d0fdf76c1ca7410281fccf66f45b Mon Sep 17 00:00:00 2001 From: Ahmed Naseef Date: Tue, 28 Jan 2025 11:28:31 +0400 Subject: [PATCH 544/877] kernel: usbnet: Restore usb%d naming for cdc-ethernet devices with local MAC Prior to commit https://github.com/torvalds/linux/commit/8a7d12d674ac6f2147c18f36d1e15f1a48060edf, cdc-ethernet USB LTE modems (e.g. Quectel EC200A) were consistently named usb0. After 8a7d12d67, devices began renaming to eth1 due to an assumption that local MAC addresses originate exclusively from the kernel. Some devices provide driver-assigned local MACs, causing point-to-point interfaces with driver-set MACs to adopt eth%d names instead of usb%d. Restore the naming exception for point-to-point devices: interfaces without driver MACs or with driver-provided local MACs will retain the usb%d convention. This addresses issues reported in [1] and fixed in [2]. [1] https://lore.kernel.org/all/Z00udyMgW6XnAw6h@atmark-techno.com/ [2] https://lore.kernel.org/all/20241203130457.904325-1-asmadeus@codewreck.org/ Tested-by: Ahmed Naseef Signed-off-by: Ahmed Naseef Link: https://github.com/openwrt/openwrt/pull/17757 Signed-off-by: Robert Marko (cherry picked from commit ecd609f509f29ed1f75db5c7a623f359c64efb72) --- ...me-exception-for-local-mac-addresses.patch | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 target/linux/generic/pending-6.6/155-usbnet-restore-usb%d-name-exception-for-local-mac-addresses.patch diff --git a/target/linux/generic/pending-6.6/155-usbnet-restore-usb%d-name-exception-for-local-mac-addresses.patch b/target/linux/generic/pending-6.6/155-usbnet-restore-usb%d-name-exception-for-local-mac-addresses.patch new file mode 100644 index 00000000000000..0d32800cbc983b --- /dev/null +++ b/target/linux/generic/pending-6.6/155-usbnet-restore-usb%d-name-exception-for-local-mac-addresses.patch @@ -0,0 +1,63 @@ +From linux-netdev Tue Dec 03 13:04:55 2024 +From: Dominique Martinet +Date: Tue, 03 Dec 2024 13:04:55 +0000 +To: linux-netdev +Subject: [PATCH] net: usb: usbnet: restore usb%d name exception for local mac addresses +Message-Id: <20241203130457.904325-1-asmadeus () codewreck ! org> +X-MARC-Message: https://marc.info/?l=linux-netdev&m=173323431631309 + +From: Dominique Martinet + +The previous commit assumed that local addresses always came from the +kernel, but some devices hand out local mac addresses so we ended up +with point-to-point devices with a mac set by the driver, renaming to +eth%d when they used to be named usb%d. + +Userspace should not rely on device name, but for the sake of stability +restore the local mac address check portion of the naming exception: +point to point devices which either have no mac set by the driver or +have a local mac handed out by the driver will keep the usb%d name. + +Fixes: 8a7d12d674ac ("net: usb: usbnet: fix name regression") +Signed-off-by: Dominique Martinet +--- + drivers/net/usb/usbnet.c | 20 ++++++++++++++------ + 1 file changed, 14 insertions(+), 6 deletions(-) + +--- a/drivers/net/usb/usbnet.c ++++ b/drivers/net/usb/usbnet.c +@@ -178,6 +178,17 @@ int usbnet_get_ethernet_addr(struct usbn + } + EXPORT_SYMBOL_GPL(usbnet_get_ethernet_addr); + ++static bool usbnet_needs_usb_name_format(struct usbnet *dev, struct net_device *net) ++{ ++ /* Point to point devices which don't have a real MAC address ++ * (or report a fake local one) have historically used the usb%d ++ * naming. Preserve this.. ++ */ ++ return (dev->driver_info->flags & FLAG_POINTTOPOINT) != 0 && ++ (is_zero_ether_addr(net->dev_addr) || ++ is_local_ether_addr(net->dev_addr)); ++} ++ + static void intr_complete (struct urb *urb) + { + struct usbnet *dev = urb->context; +@@ -1766,13 +1777,10 @@ usbnet_probe (struct usb_interface *udev + if (status < 0) + goto out1; + +- // heuristic: "usb%d" for links we know are two-host, +- // else "eth%d" when there's reasonable doubt. userspace +- // can rename the link if it knows better. ++ /* heuristic: rename to "eth%d" if we are not sure this link ++ * is two-host (these links keep "usb%d") */ + if ((dev->driver_info->flags & FLAG_ETHER) != 0 && +- ((dev->driver_info->flags & FLAG_POINTTOPOINT) == 0 || +- /* somebody touched it*/ +- !is_zero_ether_addr(net->dev_addr))) ++ !usbnet_needs_usb_name_format(dev, net)) + strscpy(net->name, "eth%d", sizeof(net->name)); + /* WLAN devices should always be named "wlan%d" */ + if ((dev->driver_info->flags & FLAG_WLAN) != 0) From c70d0a630404b4d243f21a4dfe17c039dd667a0b Mon Sep 17 00:00:00 2001 From: Martin Schiller Date: Thu, 6 Mar 2025 09:38:12 +0100 Subject: [PATCH 545/877] mediatek: Refresh kernel configuration I selected one subtarget after the other and refreshed their configuration using this command: make kernel_oldconfig CONFIG_TARGET=subtarget For MT7629 I had to re-add CONFIG_LEDS_SMARTRG_LED manually. Otherwise, building MT7629 with ALL_KMODS we get prompted for LEDS_SMARTRG_LED and this will break CI and in future buildbot compilation. See commit 6bdea8c7bd85 ("mediatek: mt7629: 6.6: disable LEDS_SMARTRG_LED by default") for more details. Signed-off-by: Martin Schiller Link: https://github.com/openwrt/openwrt/pull/18182 Signed-off-by: Hauke Mehrtens (cherry picked from commit 5013efc4f907550fadbf15e2fb1bdb2ead3325db) --- target/linux/mediatek/filogic/config-6.6 | 14 +++++++------- target/linux/mediatek/mt7622/config-6.6 | 16 +++++++--------- target/linux/mediatek/mt7623/config-6.6 | 23 ++++------------------- target/linux/mediatek/mt7629/config-6.6 | 11 ++++------- 4 files changed, 22 insertions(+), 42 deletions(-) diff --git a/target/linux/mediatek/filogic/config-6.6 b/target/linux/mediatek/filogic/config-6.6 index a450de2e79c5cb..915c5066695180 100644 --- a/target/linux/mediatek/filogic/config-6.6 +++ b/target/linux/mediatek/filogic/config-6.6 @@ -1,7 +1,7 @@ CONFIG_64BIT=y # CONFIG_AHCI_MTK is not set -CONFIG_AIR_AN8855_PHY=y CONFIG_AIROHA_EN8801SC_PHY=y +CONFIG_AIR_AN8855_PHY=y CONFIG_ARCH_BINFMT_ELF_EXTRA_PHDRS=y CONFIG_ARCH_CORRECT_STACKTRACE_ON_KRETPROBE=y CONFIG_ARCH_DEFAULT_KEXEC_IMAGE_VERIFY_SIG=y @@ -33,7 +33,6 @@ CONFIG_ARM64_VA_BITS_39=y CONFIG_ARM_AMBA=y CONFIG_ARM_ARCH_TIMER=y CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y -# CONFIG_ARM_CORESIGHT_PMU_ARCH_SYSTEM_PMU is not set CONFIG_ARM_GIC=y CONFIG_ARM_GIC_V2M=y CONFIG_ARM_GIC_V3=y @@ -43,7 +42,6 @@ CONFIG_ARM_MEDIATEK_CPUFREQ=y CONFIG_ARM_PMU=y CONFIG_ARM_PMUV3=y CONFIG_ARM_PSCI_FW=y -# CONFIG_ARM_SMMU_V3_PMU is not set CONFIG_ATA=y CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y CONFIG_BLK_DEV_LOOP=y @@ -97,6 +95,7 @@ CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y CONFIG_CPU_FREQ_GOV_USERSPACE=y CONFIG_CPU_FREQ_STAT=y CONFIG_CPU_LITTLE_ENDIAN=y +CONFIG_CPU_MITIGATIONS=y CONFIG_CPU_RMAP=y CONFIG_CPU_THERMAL=y CONFIG_CRC16=y @@ -167,7 +166,6 @@ CONFIG_FUNCTION_ALIGNMENT_4B=y CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y CONFIG_GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_ARGS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ARCH_TOPOLOGY=y @@ -234,17 +232,18 @@ CONFIG_LZO_COMPRESS=y CONFIG_LZO_DECOMPRESS=y CONFIG_MAGIC_SYSRQ=y CONFIG_MAXLINEAR_GPHY=y +CONFIG_MDIO_AN8855=y CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y -CONFIG_MDIO_AN8855=y CONFIG_MEDIATEK_2P5GE_PHY=y CONFIG_MEDIATEK_GE_PHY=y CONFIG_MEDIATEK_GE_SOC_PHY=y CONFIG_MEDIATEK_WATCHDOG=y CONFIG_MESSAGE_LOGLEVEL_DEFAULT=7 -CONFIG_MFD_SYSCON=y CONFIG_MFD_AIROHA_AN8855=y +CONFIG_MFD_CORE=y +CONFIG_MFD_SYSCON=y CONFIG_MIGRATION=y # CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY is not set CONFIG_MMC=y @@ -280,6 +279,7 @@ CONFIG_MTK_HSDMA=y CONFIG_MTK_INFRACFG=y CONFIG_MTK_LVTS_THERMAL=y CONFIG_MTK_LVTS_THERMAL_DEBUGFS=y +CONFIG_MTK_NET_PHYLIB=y CONFIG_MTK_PMIC_WRAP=y CONFIG_MTK_REGULATOR_COUPLER=y CONFIG_MTK_SCPSYS=y @@ -335,7 +335,6 @@ CONFIG_PAGE_POOL=y CONFIG_PAGE_POOL_STATS=y CONFIG_PAGE_SIZE_LESS_THAN_256KB=y CONFIG_PAGE_SIZE_LESS_THAN_64KB=y -CONFIG_PAHOLE_HAS_LANG_EXCLUDE=y CONFIG_PARTITION_PERCPU=y CONFIG_PCI=y CONFIG_PCIEAER=y @@ -413,6 +412,7 @@ CONFIG_RAS=y CONFIG_RATIONAL=y # CONFIG_RAVE_SP_CORE is not set CONFIG_REALTEK_PHY=y +CONFIG_REALTEK_PHY_HWMON=y CONFIG_REED_SOLOMON=y CONFIG_REED_SOLOMON_DEC8=y CONFIG_REED_SOLOMON_ENC8=y diff --git a/target/linux/mediatek/mt7622/config-6.6 b/target/linux/mediatek/mt7622/config-6.6 index c3c8b60684dceb..bdfb06af76bbe5 100644 --- a/target/linux/mediatek/mt7622/config-6.6 +++ b/target/linux/mediatek/mt7622/config-6.6 @@ -1,7 +1,7 @@ CONFIG_64BIT=y # CONFIG_AHCI_MTK is not set -# CONFIG_AIR_AN8855_PHY is not set # CONFIG_AIROHA_EN8801SC_PHY is not set +# CONFIG_AIR_AN8855_PHY is not set CONFIG_AQUANTIA_PHY=y CONFIG_ARCH_BINFMT_ELF_EXTRA_PHDRS=y CONFIG_ARCH_CORRECT_STACKTRACE_ON_KRETPROBE=y @@ -34,7 +34,6 @@ CONFIG_ARM64_VA_BITS_39=y CONFIG_ARM_AMBA=y CONFIG_ARM_ARCH_TIMER=y CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y -# CONFIG_ARM_CORESIGHT_PMU_ARCH_SYSTEM_PMU is not set CONFIG_ARM_GIC=y CONFIG_ARM_GIC_V2M=y CONFIG_ARM_GIC_V3=y @@ -44,13 +43,13 @@ CONFIG_ARM_MEDIATEK_CPUFREQ=y CONFIG_ARM_PMU=y CONFIG_ARM_PMUV3=y CONFIG_ARM_PSCI_FW=y -# CONFIG_ARM_SMMU_V3_PMU is not set CONFIG_ATA=y CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y CONFIG_BLK_DEV_LOOP=y CONFIG_BLK_DEV_SD=y CONFIG_BLK_MQ_PCI=y CONFIG_BLK_PM=y +CONFIG_BLOCK_NOTIFIERS=y CONFIG_BSD_PROCESS_ACCT=y CONFIG_BSD_PROCESS_ACCT_V3=y CONFIG_BUFFER_HEAD=y @@ -105,6 +104,7 @@ CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y CONFIG_CPU_FREQ_GOV_USERSPACE=y CONFIG_CPU_FREQ_STAT=y CONFIG_CPU_LITTLE_ENDIAN=y +CONFIG_CPU_MITIGATIONS=y CONFIG_CPU_RMAP=y CONFIG_CPU_THERMAL=y CONFIG_CRC16=y @@ -173,7 +173,6 @@ CONFIG_FUNCTION_ALIGNMENT_4B=y CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y CONFIG_GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_ARGS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ARCH_TOPOLOGY=y @@ -241,14 +240,13 @@ CONFIG_MAXLINEAR_GPHY=y CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y -# CONFIG_MDIO_AN8855 is not set # CONFIG_MEDIATEK_2P5GE_PHY is not set CONFIG_MEDIATEK_GE_PHY=y # CONFIG_MEDIATEK_GE_SOC_PHY is not set CONFIG_MEDIATEK_WATCHDOG=y CONFIG_MESSAGE_LOGLEVEL_DEFAULT=7 -CONFIG_MFD_SYSCON=y # CONFIG_MFD_AIROHA_AN8855 is not set +CONFIG_MFD_SYSCON=y CONFIG_MIGRATION=y # CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY is not set CONFIG_MMC=y @@ -283,6 +281,7 @@ CONFIG_MTK_CPUX_TIMER=y CONFIG_MTK_HSDMA=y CONFIG_MTK_INFRACFG=y # CONFIG_MTK_LVTS_THERMAL is not set +CONFIG_MTK_NET_PHYLIB=y CONFIG_MTK_PMIC_WRAP=y CONFIG_MTK_REGULATOR_COUPLER=y CONFIG_MTK_SCPSYS=y @@ -297,7 +296,6 @@ CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NEED_SG_DMA_LENGTH=y CONFIG_NET_DEVLINK=y CONFIG_NET_DSA=y -# CONFIG_NET_DSA_AN8855 is not set CONFIG_NET_DSA_MT7530=y CONFIG_NET_DSA_MT7530_MDIO=y # CONFIG_NET_DSA_MT7530_MMIO is not set @@ -316,7 +314,6 @@ CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=2 CONFIG_NVMEM=y -# CONFIG_NVMEM_AN8855_EFUSE is not set CONFIG_NVMEM_BLOCK=y CONFIG_NVMEM_LAYOUTS=y CONFIG_NVMEM_LAYOUT_ADTRAN=y @@ -338,7 +335,6 @@ CONFIG_PAGE_POOL=y CONFIG_PAGE_POOL_STATS=y CONFIG_PAGE_SIZE_LESS_THAN_256KB=y CONFIG_PAGE_SIZE_LESS_THAN_64KB=y -CONFIG_PAHOLE_HAS_LANG_EXCLUDE=y CONFIG_PARTITION_PERCPU=y CONFIG_PCI=y CONFIG_PCIEAER=y @@ -388,6 +384,7 @@ CONFIG_PM_CLK=y CONFIG_PM_GENERIC_DOMAINS=y CONFIG_PM_GENERIC_DOMAINS_OF=y CONFIG_PM_OPP=y +CONFIG_POLYNOMIAL=y CONFIG_POSIX_CPU_TIMERS_TASK_WORK=y CONFIG_POWER_RESET=y CONFIG_POWER_RESET_SYSCON=y @@ -411,6 +408,7 @@ CONFIG_RAS=y CONFIG_RATIONAL=y # CONFIG_RAVE_SP_CORE is not set CONFIG_REALTEK_PHY=y +CONFIG_REALTEK_PHY_HWMON=y CONFIG_REED_SOLOMON=y CONFIG_REED_SOLOMON_DEC8=y CONFIG_REED_SOLOMON_ENC8=y diff --git a/target/linux/mediatek/mt7623/config-6.6 b/target/linux/mediatek/mt7623/config-6.6 index 9d12c48eeeea1e..8fd0f3a5995f6a 100644 --- a/target/linux/mediatek/mt7623/config-6.6 +++ b/target/linux/mediatek/mt7623/config-6.6 @@ -1,6 +1,6 @@ # CONFIG_AIO is not set -# CONFIG_AIR_AN8855_PHY is not set # CONFIG_AIROHA_EN8801SC_PHY is not set +# CONFIG_AIR_AN8855_PHY is not set CONFIG_ALIGNMENT_TRAP=y CONFIG_ARCH_32BIT_OFF_T=y CONFIG_ARCH_HIBERNATION_POSSIBLE=y @@ -106,6 +106,7 @@ CONFIG_CPU_FREQ_GOV_POWERSAVE=y CONFIG_CPU_FREQ_STAT=y CONFIG_CPU_HAS_ASID=y CONFIG_CPU_LITTLE_ENDIAN=y +CONFIG_CPU_MITIGATIONS=y CONFIG_CPU_PABRT_V7=y CONFIG_CPU_PM=y CONFIG_CPU_RMAP=y @@ -114,8 +115,6 @@ CONFIG_CPU_THUMB_CAPABLE=y CONFIG_CPU_TLB_V7=y CONFIG_CPU_V7=y CONFIG_CRC16=y -# CONFIG_CRC32_SARWATE is not set -CONFIG_CRC32_SLICEBY8=y CONFIG_CROSS_MEMORY_ATTACH=y CONFIG_CRYPTO_CRC32=y CONFIG_CRYPTO_CRC32C=y @@ -188,17 +187,8 @@ CONFIG_DRM_MEDIATEK_HDMI=y CONFIG_DRM_MIPI_DSI=y CONFIG_DRM_PANEL=y CONFIG_DRM_PANEL_BRIDGE=y -# CONFIG_DRM_PANEL_HIMAX_HX8394 is not set -# CONFIG_DRM_PANEL_JADARD_JD9365DA_H3 is not set -# CONFIG_DRM_PANEL_MAGNACHIP_D53E6EA8966 is not set -# CONFIG_DRM_PANEL_NEWVISION_NV3051D is not set -# CONFIG_DRM_PANEL_NOVATEK_NT36523 is not set CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN=y -# CONFIG_DRM_PANEL_SONY_TD4353_JDI is not set -# CONFIG_DRM_PANEL_STARTEK_KD070FHFID015 is not set -# CONFIG_DRM_PANEL_VISIONOX_R66451 is not set -# CONFIG_DRM_PANEL_VISIONOX_VTDR6130 is not set CONFIG_DRM_SCHED=y CONFIG_DRM_SIMPLE_BRIDGE=y CONFIG_DTC=y @@ -239,7 +229,6 @@ CONFIG_FWNODE_MDIO=y CONFIG_FW_CACHE=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_BUG=y CONFIG_GENERIC_CLOCKEVENTS=y @@ -353,17 +342,16 @@ CONFIG_MDIO_BITBANG=y CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y -# CONFIG_MDIO_AN8855 is not set CONFIG_MDIO_GPIO=y CONFIG_MEDIATEK_GE_PHY=y CONFIG_MEDIATEK_MT6577_AUXADC=y CONFIG_MEDIATEK_WATCHDOG=y CONFIG_MEMORY=y +# CONFIG_MFD_AIROHA_AN8855 is not set CONFIG_MFD_CORE=y # CONFIG_MFD_HI6421_SPMI is not set CONFIG_MFD_MT6397=y CONFIG_MFD_SYSCON=y -# CONFIG_MFD_AIROHA_AN8855 is not set CONFIG_MIGHT_HAVE_CACHE_L2X0=y CONFIG_MIGRATION=y CONFIG_MMC=y @@ -395,6 +383,7 @@ CONFIG_MTK_IOMMU=y CONFIG_MTK_IOMMU_V1=y # CONFIG_MTK_LVTS_THERMAL is not set CONFIG_MTK_MMSYS=y +CONFIG_MTK_NET_PHYLIB=y CONFIG_MTK_PMIC_WRAP=y CONFIG_MTK_REGULATOR_COUPLER=y CONFIG_MTK_SCPSYS=y @@ -413,7 +402,6 @@ CONFIG_NEED_SRCU_NMI_SAFE=y CONFIG_NEON=y CONFIG_NET_DEVLINK=y CONFIG_NET_DSA=y -# CONFIG_NET_DSA_AN8855 is not set CONFIG_NET_DSA_MT7530=y CONFIG_NET_DSA_MT7530_MDIO=y # CONFIG_NET_DSA_MT7530_MMIO is not set @@ -435,7 +423,6 @@ CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=4 CONFIG_NVMEM=y -# CONFIG_NVMEM_AN8855_EFUSE is not set CONFIG_NVMEM_LAYOUTS=y # CONFIG_NVMEM_LAYOUT_ADTRAN is not set CONFIG_NVMEM_MTK_EFUSE=y @@ -461,7 +448,6 @@ CONFIG_PAGE_POOL=y CONFIG_PAGE_POOL_STATS=y CONFIG_PAGE_SIZE_LESS_THAN_256KB=y CONFIG_PAGE_SIZE_LESS_THAN_64KB=y -CONFIG_PAHOLE_HAS_LANG_EXCLUDE=y CONFIG_PCI=y CONFIG_PCIEAER=y CONFIG_PCIEPORTBUS=y @@ -588,7 +574,6 @@ CONFIG_TIMER_PROBE=y CONFIG_TOUCHSCREEN_EDT_FT5X06=y CONFIG_TREE_RCU=y CONFIG_TREE_SRCU=y -# CONFIG_UACCE is not set CONFIG_UBIFS_FS=y CONFIG_UEVENT_HELPER_PATH="" CONFIG_UIMAGE_FIT_BLK=y diff --git a/target/linux/mediatek/mt7629/config-6.6 b/target/linux/mediatek/mt7629/config-6.6 index d66a514f63e626..661f31ced6ff51 100644 --- a/target/linux/mediatek/mt7629/config-6.6 +++ b/target/linux/mediatek/mt7629/config-6.6 @@ -1,5 +1,5 @@ -# CONFIG_AIR_AN8855_PHY is not set # CONFIG_AIROHA_EN8801SC_PHY is not set +# CONFIG_AIR_AN8855_PHY is not set CONFIG_ALIGNMENT_TRAP=y CONFIG_ARCH_32BIT_OFF_T=y CONFIG_ARCH_HIBERNATION_POSSIBLE=y @@ -76,6 +76,7 @@ CONFIG_CPU_HAS_ASID=y CONFIG_CPU_IDLE=y CONFIG_CPU_IDLE_GOV_MENU=y CONFIG_CPU_LITTLE_ENDIAN=y +CONFIG_CPU_MITIGATIONS=y CONFIG_CPU_PABRT_V7=y CONFIG_CPU_PM=y CONFIG_CPU_RMAP=y @@ -112,7 +113,6 @@ CONFIG_FUNCTION_ALIGNMENT=0 CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ARCH_TOPOLOGY=y CONFIG_GENERIC_BUG=y @@ -182,11 +182,10 @@ CONFIG_MACH_MT7629=y CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y -# CONFIG_MDIO_AN8855 is not set CONFIG_MEDIATEK_GE_PHY=y CONFIG_MEDIATEK_WATCHDOG=y -CONFIG_MFD_SYSCON=y # CONFIG_MFD_AIROHA_AN8855 is not set +CONFIG_MFD_SYSCON=y CONFIG_MIGHT_HAVE_CACHE_L2X0=y CONFIG_MIGRATION=y CONFIG_MMU_LAZY_TLB_REFCOUNT=y @@ -208,6 +207,7 @@ CONFIG_MTD_UBI_WL_THRESHOLD=4096 # CONFIG_MTK_CMDQ is not set CONFIG_MTK_CPUX_TIMER=y CONFIG_MTK_INFRACFG=y +CONFIG_MTK_NET_PHYLIB=y # CONFIG_MTK_PMIC_WRAP is not set CONFIG_MTK_SCPSYS=y CONFIG_MTK_SCPSYS_PM_DOMAINS=y @@ -219,7 +219,6 @@ CONFIG_NETFILTER=y CONFIG_NETFILTER_BPF_LINK=y CONFIG_NET_DEVLINK=y CONFIG_NET_DSA=y -# CONFIG_NET_DSA_AN8855 is not set CONFIG_NET_DSA_MT7530=y CONFIG_NET_DSA_MT7530_MDIO=y # CONFIG_NET_DSA_MT7530_MMIO is not set @@ -238,7 +237,6 @@ CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=2 CONFIG_NVMEM=y -# CONFIG_NVMEM_AN8855_EFUSE is not set CONFIG_NVMEM_LAYOUTS=y # CONFIG_NVMEM_LAYOUT_ADTRAN is not set # CONFIG_NVMEM_MTK_EFUSE is not set @@ -261,7 +259,6 @@ CONFIG_PAGE_POOL=y CONFIG_PAGE_POOL_STATS=y CONFIG_PAGE_SIZE_LESS_THAN_256KB=y CONFIG_PAGE_SIZE_LESS_THAN_64KB=y -CONFIG_PAHOLE_HAS_LANG_EXCLUDE=y CONFIG_PCI=y CONFIG_PCIEAER=y CONFIG_PCIEPORTBUS=y From d00ed19ed4cbeb446741ef977b63d7c96a045323 Mon Sep 17 00:00:00 2001 From: Martin Schiller Date: Thu, 6 Mar 2025 09:52:27 +0100 Subject: [PATCH 546/877] mediatek: filogic: enable CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY The Cortex-A73 in MediaTek Filogic 880 (MT7988A) is vulnerable to multiple Spectre variants including Spectre-BHB. Ref: https://developer.arm.com/Arm%20Security%20Center/Speculative%20Processor%20Vulnerability Signed-off-by: Martin Schiller Link: https://github.com/openwrt/openwrt/pull/18182 Signed-off-by: Hauke Mehrtens (cherry picked from commit 6af46a69846e4e92fa8dcf6c3dccbaf87d513064) --- target/linux/mediatek/filogic/config-6.6 | 1 - 1 file changed, 1 deletion(-) diff --git a/target/linux/mediatek/filogic/config-6.6 b/target/linux/mediatek/filogic/config-6.6 index 915c5066695180..607d1b3c6f4cb2 100644 --- a/target/linux/mediatek/filogic/config-6.6 +++ b/target/linux/mediatek/filogic/config-6.6 @@ -245,7 +245,6 @@ CONFIG_MFD_AIROHA_AN8855=y CONFIG_MFD_CORE=y CONFIG_MFD_SYSCON=y CONFIG_MIGRATION=y -# CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY is not set CONFIG_MMC=y CONFIG_MMC_BLOCK=y CONFIG_MMC_CQHCI=y From 2b0cce92ae3cd58a96c407d1908693deec6fdf6b Mon Sep 17 00:00:00 2001 From: Eric ZHANG Date: Sun, 2 Mar 2025 15:54:37 +0800 Subject: [PATCH 547/877] dnsmasq: fix handlers for options `filter_rr` and `cache_rr` According to: - https://github.com/openwrt/luci/blob/master/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js#L700 - https://github.com/openwrt/luci/blob/master/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js#L402 These two options should be of type `MultiValue` but here there're used as single value. This results in dnsmasq crashes when either of these options are set with multiple values, which leads to an invalid space-separated value. As these options are designed to take multiple values, I think it's better to use list format eg. `list filter_rr 'AAAA'`, instead of `option filter_rr 'AAAA,HTTPS'`. See: https://forum.openwrt.org/t/selecting-more-than-one-filter-arbitrary-rr-or-cache-arbitrary-rr-in-v24-10-0-crashes-dnsmasq/225801 Tested on 24.10.0 Signed-off-by: Eric ZHANG Link: https://github.com/openwrt/openwrt/pull/18149 Signed-off-by: Christian Marangi (cherry picked from commit d136c24f7cc9f7b5ac72259ccf9193683f4ced74) --- package/network/services/dnsmasq/files/dnsmasq.init | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init index b864ea90699f48..e9afcc78d3176e 100755 --- a/package/network/services/dnsmasq/files/dnsmasq.init +++ b/package/network/services/dnsmasq/files/dnsmasq.init @@ -226,6 +226,14 @@ append_interface_name() { xappend "--interface-name=$1,$2" } +append_filter_rr() { + xappend "--filter-rr=$1" +} + +append_cache_rr() { + xappend "--cache-rr=$1" +} + filter_dnsmasq() { local cfg="$1" func="$2" match_cfg="$3" found_cfg @@ -1000,8 +1008,8 @@ dnsmasq_start() # deprecate or remove filter-X in favor of filter-rr? append_bool "$cfg" filter_aaaa "--filter-AAAA" append_bool "$cfg" filter_a "--filter-A" - append_parm "$cfg" filter_rr "--filter-rr" - append_parm "$cfg" cache_rr "--cache-rr" + config_list_foreach "$cfg" filter_rr append_filter_rr + config_list_foreach "$cfg" cache_rr append_cache_rr append_parm "$cfg" logfacility "--log-facility" config_get logfacility "$cfg" "logfacility" From 7f512e602aaceddb2f871d8a22de4cf48d7daefd Mon Sep 17 00:00:00 2001 From: Mieczyslaw Nalewaj Date: Sat, 1 Mar 2025 17:41:50 +0100 Subject: [PATCH 548/877] ramips: mt7621: 02_network optimization Merging repeating blocks inside the ramips_setup_interfaces() function. Signed-off-by: Mieczyslaw Nalewaj Link: https://github.com/openwrt/openwrt/pull/18146 (cherry picked from commit a0449f8cf3a53f746c409ce033a6c78065c5edde) Link: https://github.com/openwrt/openwrt/pull/18205 Signed-off-by: Hauke Mehrtens --- .../mt7621/base-files/etc/board.d/02_network | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) 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 f40e9616d019e2..650fef62a846ef 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 @@ -1,4 +1,3 @@ - . /lib/functions.sh . /lib/functions/uci-defaults.sh . /lib/functions/system.sh @@ -23,6 +22,7 @@ ramips_setup_interfaces() mercusys,mr70x-v1|\ netgear,wax202|\ sim,simax1800t|\ + tplink,mr600-v2-eu|\ xiaomi,mi-router-3-pro|\ xiaomi,mi-router-ac2100|\ xiaomi,mi-router-cr6606|\ @@ -68,12 +68,18 @@ ramips_setup_interfaces() ucidef_set_interface_lan "lan" ;; asiarf,ap7621-001|\ + comfast,cf-e390ax|\ + comfast,cf-ew72-v2|\ + cudy,m1800|\ dna,valokuitu-plus-ex400|\ humax,e10|\ keenetic,kn-3510|\ + meig,slt866|\ openfi,5pro|\ wavlink,ws-wn572hp3-4g|\ - winstars,ws-wn583a6) + winstars,ws-wn583a6|\ + yuncore,ax820|\ + zyxel,nr7101) ucidef_set_interfaces_lan_wan "lan" "wan" ;; asiarf,ap7621-nv1|\ @@ -105,11 +111,6 @@ ramips_setup_interfaces() uci add_list firewall.@zone[1].network='eth_data' uci add_list firewall.@zone[1].network='eth_om' ;; - cudy,m1800|\ - yuncore,ax820|\ - zyxel,nr7101) - ucidef_set_interfaces_lan_wan "lan" "wan" - ;; dlink,covr-x1860-a1) ucidef_set_interfaces_lan_wan "ethernet" "internet" ;; @@ -155,9 +156,6 @@ ramips_setup_interfaces() tplink,tl-wpa8631p-v3) ucidef_set_interface_lan "lan1 lan2 lan3 plc0" ;; - tplink,mr600-v2-eu) - ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan" - ;; ubnt,edgerouter-x) ucidef_set_interfaces_lan_wan "eth1 eth2 eth3 eth4" "eth0" ;; @@ -178,11 +176,6 @@ ramips_setup_interfaces() ruijie,rg-ew1200g-pro-v1.1) ucidef_set_interfaces_lan_wan "lan3 lan2 lan1" "wan" ;; - comfast,cf-e390ax|\ - comfast,cf-ew72-v2|\ - meig,slt866) - ucidef_set_interfaces_lan_wan "lan" "wan" - ;; *) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan" ;; From ff5b9059b43ca9dde465206698923224678a1010 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Thu, 27 Feb 2025 11:05:26 +0100 Subject: [PATCH 549/877] libpcap: add missing PKG_CONFIG_DEPENDS entries Currently, enabling USB, BT or Netfilter support after initial compilation will not trigger a rebuild, so add the missing PKG_CONFIG_DEPENDS so that rebuild gets triggered. Signed-off-by: Robert Marko (cherry picked from commit fe37574be63ef7c6c1c1e611f052ed25c99a8aa1) --- package/libs/libpcap/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/package/libs/libpcap/Makefile b/package/libs/libpcap/Makefile index 09aab0981ccfc3..14b97f902af9f8 100644 --- a/package/libs/libpcap/Makefile +++ b/package/libs/libpcap/Makefile @@ -22,7 +22,11 @@ PKG_CPE_ID:=cpe:/a:tcpdump:libpcap PKG_ASLR_PIE_REGULAR:=1 -PKG_CONFIG_DEPENDS := CONFIG_PACKAGE_rpcapd +PKG_CONFIG_DEPENDS := \ + CONFIG_PACKAGE_rpcapd \ + CONFIG_PCAP_HAS_USB \ + CONFIG_PCAP_HAS_BT \ + CONFIG_PCAP_HAS_NETFILTER include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/cmake.mk From 3da9786da3b259a83587a766c5c4e53131bc5cfa Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 3 Mar 2025 13:27:15 +0000 Subject: [PATCH 550/877] libpcap: backport support for various DSA tags Trying to tcpdump DSA conduits results in errors such as "unsupported DSA tag: mtk". Backport two commits adding support for various DSA tags to libpcap. Signed-off-by: Daniel Golle (cherry picked from commit fad94e8cda573389164827dc74e583d10eeae2e5) --- package/libs/libpcap/Makefile | 2 +- ...pport-for-Realtek-Ethertype-DSA-data.patch | 28 ++ .../002-Linux-handle-other-DSA-tags.patch | 322 ++++++++++++++++++ 3 files changed, 351 insertions(+), 1 deletion(-) create mode 100644 package/libs/libpcap/patches/001-Add-support-for-Realtek-Ethertype-DSA-data.patch create mode 100644 package/libs/libpcap/patches/002-Linux-handle-other-DSA-tags.patch diff --git a/package/libs/libpcap/Makefile b/package/libs/libpcap/Makefile index 14b97f902af9f8..052358b1f5c08f 100644 --- a/package/libs/libpcap/Makefile +++ b/package/libs/libpcap/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libpcap PKG_VERSION:=1.10.5 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://www.tcpdump.org/release/ diff --git a/package/libs/libpcap/patches/001-Add-support-for-Realtek-Ethertype-DSA-data.patch b/package/libs/libpcap/patches/001-Add-support-for-Realtek-Ethertype-DSA-data.patch new file mode 100644 index 00000000000000..5ec0e22afacd4c --- /dev/null +++ b/package/libs/libpcap/patches/001-Add-support-for-Realtek-Ethertype-DSA-data.patch @@ -0,0 +1,28 @@ +From fcb2cbc3a306afcf7785a60a74dbea431e609d76 Mon Sep 17 00:00:00 2001 +From: Luiz Angelo Daros de Luca +Date: Thu, 6 Jan 2022 15:51:54 -0300 +Subject: [PATCH 1/2] Add support for Realtek (Ethertype) DSA data + +Realtek switchtag rtl4a (4 bytes long, protocol 0xA) and rtl8_4 (8 bytes +long, protocol 0x04) are Ethertype DSA tags, inserted in the Ethernet +header similar to an 802.1Q tag. Both shares the same Ethertype 0x8899 +as other Realtek proprietary protocols. + +Realtek switchtag rtl8_4t is identical to rtl8_4 but positioned before +the CRC, at the end of the Ethernet frame. +--- + pcap-linux.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/pcap-linux.c ++++ b/pcap-linux.c +@@ -5281,6 +5281,9 @@ static struct dsa_proto { + { "brcm-prepend", DLT_DSA_TAG_BRCM_PREPEND }, + { "dsa", DLT_DSA_TAG_DSA }, + { "edsa", DLT_DSA_TAG_EDSA }, ++ { "rtl4a", DLT_EN10MB }, ++ { "rtl8_4", DLT_EN10MB }, ++ { "rtl8_4t", DLT_EN10MB }, + }; + + static int diff --git a/package/libs/libpcap/patches/002-Linux-handle-other-DSA-tags.patch b/package/libs/libpcap/patches/002-Linux-handle-other-DSA-tags.patch new file mode 100644 index 00000000000000..dc87d4010d727f --- /dev/null +++ b/package/libs/libpcap/patches/002-Linux-handle-other-DSA-tags.patch @@ -0,0 +1,322 @@ +From 7d298976beff0cce310fb53a430f82b53f43a394 Mon Sep 17 00:00:00 2001 +From: Guy Harris +Date: Fri, 14 Feb 2025 19:12:24 -0800 +Subject: [PATCH 2/2] Linux: handle other DSA tags. + +Many of those entries need their own LINKTYPE_/DLT_? values, including +tcpdump and Wireshark support for same, but at least this lets you see +raw hex data from a capture. + +Fixes #1367. + +Supercedes #1451. +--- + pcap-linux.c | 284 ++++++++++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 280 insertions(+), 4 deletions(-) + +--- a/pcap-linux.c ++++ b/pcap-linux.c +@@ -5267,23 +5267,299 @@ iface_get_offload(pcap_t *handle _U_) + } + #endif /* SIOCETHTOOL */ + ++/* ++ * As per ++ * ++ * https://www.kernel.org/doc/html/latest/networking/dsa/dsa.html#switch-tagging-protocols ++ * ++ * Type 1 means that the tag is prepended to the Ethernet packet. ++ * LINKTYPE_ETHERNET/DLT_EN10MB doesn't work, as it would try to ++ * dissect the tag data as the Ethernet header. These should get ++ * their own LINKTYPE_DLT_ values. ++ * ++ * Type 2 means that the tag is inserted into the Ethernet header ++ * after the source address and before the type/length field. ++ * ++ * Type 3 means that tag is a packet trailer. LINKTYPE_ETHERNET/DLT_EN10MB ++ * works, unless the next-layer protocol has no length field of its own, ++ * so that the tag might be treated as part of the payload. These should ++ * get their own LINKTYPE_/DLT_ values. ++ * ++ * If you get an "unsupported DSA tag" error, please add the tag to here, ++ * complete with a full comment indicating whether it's type 1, 2, or 3, ++ * and, for type 2, indicating whether it has an Ethertype and, if so ++ * what that type is, and whether it's registered with the IEEE or is ++ * self-assigned. Also, point to *something* that indicates the format ++ * of the tag. ++ */ + static struct dsa_proto { + const char *name; + bpf_u_int32 linktype; + } dsa_protos[] = { + /* +- * None is special and indicates that the interface does not have +- * any tagging protocol configured, and is therefore a standard +- * Ethernet interface. ++ * Type 1. See ++ * ++ * https://elixir.bootlin.com/linux/v6.13.2/source/net/dsa/tag_ar9331.c ++ */ ++ { "ar9331", DLT_EN10MB }, ++ ++ /* ++ * Type 2, without an Ethertype at the beginning, ++ * assigned a LINKTYPE_/DLT_ value. + */ +- { "none", DLT_EN10MB }, + { "brcm", DLT_DSA_TAG_BRCM }, ++ ++ /* ++ * Type 2, with Ethertype 0x8874, assigned to Broadcom. ++ * ++ * This doies not require a LINKTYPE_/DLT_ value, it ++ * just requires that Ethertype 0x8874 be dissected ++ * properly. ++ */ ++ { "brcm-legacy", DLT_EN10MB }, ++ ++ /* ++ * Type 1. ++ */ + { "brcm-prepend", DLT_DSA_TAG_BRCM_PREPEND }, ++ ++ /* ++ * Type 2, without an Etherype at he beginning, ++ * assigned a LINKTYPE_/DLT_ value. ++ */ + { "dsa", DLT_DSA_TAG_DSA }, ++ ++ /* ++ * Type 2, with an Ethertype field, but without ++ * an assigned Ethertype value that can be relied ++ * on; assigned a LINKTYPE_/DLT_ value. ++ */ + { "edsa", DLT_DSA_TAG_EDSA }, ++ ++ /* ++ * Type 1, with different transmit and receive headers, ++ * so can't really be handled well with the current ++ * libpcap API and with pcap files. Use DLT_LINUX_SLL, ++ * to get the direction? ++ * ++ * See ++ * ++ * https://elixir.bootlin.com/linux/v6.13.2/source/net/dsa/tag_gswip.c ++ */ ++ { "gswip", DLT_EN10MB }, ++ ++ /* ++ * Type 3. See ++ * ++ * https://elixir.bootlin.com/linux/v6.13.2/source/net/dsa/tag_hellcreek.c ++ */ ++ { "hellcreek", DLT_EN10MB }, ++ ++ /* ++ * Type 3, with different transmit and receive headers, ++ * so can't really be handled well with the current ++ * libpcap API and with pcap files. Use DLT_LINUX_SLL, ++ * to get the direction? ++ * ++ * See ++ * ++ * https://elixir.bootlin.com/linux/v6.13.2/source/net/dsa/tag_ksz.c#L102 ++ */ ++ { "ksz8795", DLT_EN10MB }, ++ ++ /* ++ * Type 3, with different transmit and receive headers, ++ * so can't really be handled well with the current ++ * libpcap API and with pcap files. Use DLT_LINUX_SLL, ++ * to get the direction? ++ * ++ * See ++ * ++ * https://elixir.bootlin.com/linux/v6.13.2/source/net/dsa/tag_ksz.c#L160 ++ */ ++ { "ksz9477", DLT_EN10MB }, ++ ++ /* ++ * Type 3, with different transmit and receive headers, ++ * so can't really be handled well with the current ++ * libpcap API and with pcap files. Use DLT_LINUX_SLL, ++ * to get the direction? ++ * ++ * See ++ * ++ * https://elixir.bootlin.com/linux/v6.13.2/source/net/dsa/tag_ksz.c#L341 ++ */ ++ { "ksz9893", DLT_EN10MB }, ++ ++ /* ++ * Type 3, with different transmit and receive headers, ++ * so can't really be handled well with the current ++ * libpcap API and with pcap files. Use DLT_LINUX_SLL, ++ * to get the direction? ++ * ++ * See ++ * ++ * https://elixir.bootlin.com/linux/v6.13.2/source/net/dsa/tag_ksz.c#L386 ++ */ ++ { "lan937x", DLT_EN10MB }, ++ ++ /* ++ * Type 2, with Ethertype 0x8100; the VID can be interpreted ++ * as per ++ * ++ * https://elixir.bootlin.com/linux/v6.13.2/source/net/dsa/tag_lan9303.c#L24 ++ * ++ * so giving its own LINKTYPE_/DLT_ value would allow a ++ * dissector to do so. ++ */ ++ { "lan9303", DLT_EN10MB }, ++ ++ /* ++ * Type 2, without an Etherype at he beginning, ++ * should be assigned a LINKTYPE_/DLT_ value. ++ * ++ * See ++ * ++ * https://elixir.bootlin.com/linux/v6.13.2/source/net/dsa/tag_mtk.c#L15 ++ */ ++ { "mtk", DLT_EN10MB }, ++ ++ /* ++ * None is special and indicates that the interface does not have ++ * any tagging protocol configured, and is therefore a standard ++ * Ethernet interface. ++ */ ++ { "none", DLT_EN10MB }, ++ ++ /* ++ * Type 1. ++ * ++ * See ++ * ++ * https://elixir.bootlin.com/linux/v6.13.2/source/net/dsa/tag_ocelot.c ++ */ ++ { "ocelot", DLT_EN10MB }, ++ ++ /* ++ * Type 1. ++ * ++ * See ++ * ++ * https://elixir.bootlin.com/linux/v6.13.2/source/net/dsa/tag_ocelot.c ++ */ ++ { "seville", DLT_EN10MB }, ++ ++ /* ++ * Type 2, with Ethertype 0x8100; the VID can be interpreted ++ * as per ++ * ++ * https://elixir.bootlin.com/linux/v6.13.2/source/net/dsa/tag_8021q.c#L15 ++ * ++ * so giving its own LINKTYPE_/DLT_ value would allow a ++ * dissector to do so. ++ */ ++ { "ocelot-8021q", DLT_EN10MB }, ++ ++ /* ++ * Type 2, without an Etherype at he beginning, ++ * should be assigned a LINKTYPE_/DLT_ value. ++ * ++ * See ++ * ++ * https://elixir.bootlin.com/linux/v6.13.2/source/net/dsa/tag_qca.c ++ */ ++ { "qca", DLT_EN10MB }, ++ ++ /* ++ * Type 2, with Ethertype 0x8899, assigned to Realtek; ++ * they use it for several on-the-Ethernet protocols ++ * as well, but there are fields that allow the two ++ * tag formats, and all the protocols in question, ++ * to be distinguiished from one another. ++ * ++ * This doies not require a LINKTYPE_/DLT_ value, it ++ * just requires that Ethertype 0x8899 be dissected ++ * properly. ++ * ++ * See ++ * ++ * https://elixir.bootlin.com/linux/v6.13.2/source/net/dsa/tag_rtl4_a.c ++ * ++ * http://realtek.info/pdf/rtl8306sd%28m%29_datasheet_1.1.pdf ++ * ++ * and various pages in tcpdump's print-realtek.c and Wireshark's ++ * epan/dissectors/packet-realtek.c for the other protocols. ++ */ + { "rtl4a", DLT_EN10MB }, ++ ++ /* ++ * Type 2, with Ethertype 0x8899, assigned to Realtek; ++ * see above. ++ */ + { "rtl8_4", DLT_EN10MB }, ++ ++ /* ++ * Type 3, with the same tag format as rtl8_4. ++ */ + { "rtl8_4t", DLT_EN10MB }, ++ ++ /* ++ * Type 2, with Ethertype 0xe001; that's probably ++ * self-assigned, so this really should ahve its ++ * own LINKTYPE_/DLT_ value. ++ * ++ * See ++ * ++ * https://elixir.bootlin.com/linux/v6.13.2/source/net/dsa/tag_rzn1_a5psw.c ++ */ ++ { "a5psw", DLT_EN10MB }, ++ ++ /* ++ * Type 2, with Ethertype 0x8100 or the self-assigned ++ * 0xdadb, so this really should ahve its own ++ * LINKTYPE_/DLT_ value; that would also allow the ++ * VID of the tag to be dissected as per ++ * ++ * https://elixir.bootlin.com/linux/v6.13.2/source/net/dsa/tag_8021q.c#L15 ++ */ ++ { "sja1105", DLT_EN10MB }, ++ ++ /* ++ * Type "none of the above", with both a header and trailer, ++ * with different transmit and receive tags. Has ++ * Ethertype 0xdadc, which is probably self-assigned. ++ * This should really have its own LINKTYPE_/DLT_ value. ++ */ ++ { "sja1110", DLT_EN10MB }, ++ ++ /* ++ * Type 3, as the name suggests. ++ * ++ * See ++ * ++ * https://elixir.bootlin.com/linux/v6.13.2/source/net/dsa/tag_trailer.c ++ */ ++ { "trailer", DLT_EN10MB }, ++ ++ /* ++ * Type 2, with Ethertype 0x8100; the VID can be interpreted ++ * as per ++ * ++ * https://elixir.bootlin.com/linux/v6.13.2/source/net/dsa/tag_8021q.c#L15 ++ * ++ * so giving its own LINKTYPE_/DLT_ value would allow a ++ * dissector to do so. ++ */ ++ { "vsc73xx-8021q", DLT_EN10MB }, ++ ++ /* ++ * Type 3. ++ * ++ * See ++ * ++ * https://elixir.bootlin.com/linux/v6.13.2/source/net/dsa/tag_xrs700x.c ++ */ ++ { "xrs700x", DLT_EN10MB }, + }; + + static int From df8679e29ff490660ec13d5fac9d09256f78e01b Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Wed, 26 Feb 2025 21:52:53 +0800 Subject: [PATCH 551/877] mediatek: add support for CMCC A10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This board is also as known as SuperElectron ZN-M5 and ZN-M8. However, for ZN-M5 and ZN-M8, there's another version uses ZX279128 as CPU chip, which is unsupported. You can check it in "高级设置" > "系统日志" > "内核日志" page from webUI. Hardware specification: SoC: MediaTek MT7981B 2x A53 Flash: 128 MB SPI-NAND RAM: 256MB Ethernet: 4x 10/100/1000 Mbps Switch: MediaTek MT7531AE WiFi: MediaTek MT7976C Button: Reset, WPS Power: DC 12V 1A Stock layout flash instructions: Login into webUI and upload sysupgrade firmware in "系统管理" > "升级固件" page. Remember to unselect "保留配置" ("Keep configurations") first before doing that. OpenWrt U-Boot layout flash instructions: 1. Flash stock layout firmware first. 2. Connect to the device via SSH, and backup everything, especially 'Factory' partition. 3. Unlock MTD partitions: opkg update && opkg install kmod-mtd-rw insmod mtd-rw i_want_a_brick=1 4. Write new BL2 and FIP: mtd write openwrt-mediatek-filogic-cmcc_a10-ubootmod-preloader.bin BL2 mtd write openwrt-mediatek-filogic-cmcc_a10-ubootmod-bl31-uboot.fip FIP 5. Set static IP on your PC: IP 192.168.1.254/24, 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. Signed-off-by: Tianling Shen Link: https://github.com/openwrt/openwrt/pull/18121 (cherry picked from commit 96c6608346758ceffebf30d74cab00db58874bb9) [sync uboot defconfigs with 24.10 branch, change apk to opkg] Signed-off-by: Tianling Shen Link: https://github.com/openwrt/openwrt/pull/18218 Signed-off-by: Hauke Mehrtens --- .../uboot-envtools/files/mediatek_filogic | 1 + package/boot/uboot-mediatek/Makefile | 13 + .../patches/446-add-cmcc_a10.patch | 327 ++++++++++++++++++ .../mediatek/dts/mt7981b-cmcc-a10-stock.dts | 40 +++ .../dts/mt7981b-cmcc-a10-ubootmod.dts | 28 ++ .../linux/mediatek/dts/mt7981b-cmcc-a10.dtsi | 254 ++++++++++++++ .../filogic/base-files/etc/board.d/02_network | 2 + .../base-files/lib/upgrade/platform.sh | 1 + target/linux/mediatek/image/filogic.mk | 55 +++ 9 files changed, 721 insertions(+) create mode 100644 package/boot/uboot-mediatek/patches/446-add-cmcc_a10.patch create mode 100644 target/linux/mediatek/dts/mt7981b-cmcc-a10-stock.dts create mode 100644 target/linux/mediatek/dts/mt7981b-cmcc-a10-ubootmod.dts create mode 100644 target/linux/mediatek/dts/mt7981b-cmcc-a10.dtsi diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index 730a28841e9880..67363b0f422709 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -34,6 +34,7 @@ ubootenv_add_ubi_default() { case "$board" in abt,asr3000|\ +cmcc,a10-ubootmod|\ h3c,magic-nx30-pro|\ jcg,q30-pro|\ mercusys,mr90x-v1-ubi|\ diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile index 8fda29afa6f3db..b1285f9ca3722c 100644 --- a/package/boot/uboot-mediatek/Makefile +++ b/package/boot/uboot-mediatek/Makefile @@ -231,6 +231,18 @@ define U-Boot/mt7981_abt_asr3000 DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3 endef +define U-Boot/mt7981_cmcc_a10 + NAME:=CMCC A10 + BUILD_SUBTARGET:=filogic + BUILD_DEVICES:=cmcc_a10-ubootmod + UBOOT_CONFIG:=mt7981_cmcc_a10 + 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_cmcc_rax3000m-emmc NAME:=CMCC RAX3000M BUILD_SUBTARGET:=filogic @@ -832,6 +844,7 @@ UBOOT_TARGETS := \ mt7628_ravpower_rp-wd009 \ mt7629_rfb \ mt7981_abt_asr3000 \ + mt7981_cmcc_a10 \ mt7981_cmcc_rax3000m-emmc \ mt7981_cmcc_rax3000m-nand \ mt7981_gatonetworks_gdsp \ diff --git a/package/boot/uboot-mediatek/patches/446-add-cmcc_a10.patch b/package/boot/uboot-mediatek/patches/446-add-cmcc_a10.patch new file mode 100644 index 00000000000000..b6165a797b055d --- /dev/null +++ b/package/boot/uboot-mediatek/patches/446-add-cmcc_a10.patch @@ -0,0 +1,327 @@ +--- /dev/null ++++ b/configs/mt7981_cmcc_a10_defconfig +@@ -0,0 +1,107 @@ ++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-cmcc-a10" ++CONFIG_OF_LIBFDT_OVERLAY=y ++CONFIG_TARGET_MT7981=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_FIT=y ++CONFIG_BOOTDELAY=30 ++CONFIG_AUTOBOOT_KEYED=y ++CONFIG_AUTOBOOT_MENU_SHOW=y ++CONFIG_DEFAULT_FDT_FILE="mediatek/mt7981-cmcc-a10.dtb" ++CONFIG_LOGLEVEL=7 ++CONFIG_PRE_CONSOLE_BUFFER=y ++CONFIG_LOG=y ++CONFIG_BOARD_LATE_INIT=y ++CONFIG_HUSH_PARSER=y ++CONFIG_SYS_PROMPT="MT7981> " ++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_GPT=y ++CONFIG_CMD_MTD=y ++CONFIG_CMD_PART=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_PXE=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_CMD_UBI=y ++CONFIG_CMD_UBI_RENAME=y ++CONFIG_OF_EMBED=y ++CONFIG_ENV_OVERWRITE=y ++CONFIG_ENV_IS_IN_UBI=y ++CONFIG_SYS_REDUNDAND_ENVIRONMENT=y ++CONFIG_ENV_UBI_PART="ubi" ++CONFIG_ENV_UBI_VOLUME="ubootenv" ++CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2" ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_USE_DEFAULT_ENV_FILE=y ++CONFIG_DEFAULT_ENV_FILE="cmcc_a10_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_MMC is not set ++CONFIG_MTD=y ++CONFIG_DM_MTD=y ++CONFIG_MTD_SPI_NAND=y ++CONFIG_MTD_UBI_FASTMAP=y ++CONFIG_PHY_FIXED=y ++CONFIG_MEDIATEK_ETH=y ++CONFIG_PHY=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_REGULATOR_GPIO=y ++CONFIG_RAM=y ++CONFIG_DM_SERIAL=y ++CONFIG_MTK_SERIAL=y ++CONFIG_SPI=y ++CONFIG_DM_SPI=y ++CONFIG_MTK_SPIM=y ++CONFIG_ZSTD=y ++CONFIG_HEXDUMP=y ++CONFIG_LMB_MAX_REGIONS=64 +--- /dev/null ++++ b/arch/arm/dts/mt7981-cmcc-a10.dts +@@ -0,0 +1,157 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later ++ ++/dts-v1/; ++#include "mt7981.dtsi" ++#include ++#include ++ ++/ { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ model = "CMCC A10"; ++ compatible = "mediatek,mt7981", "mediatek,mt7981-rfb"; ++ ++ chosen { ++ stdout-path = &uart0; ++ tick-timer = &timer0; ++ }; ++ ++ memory@40000000 { ++ device_type = "memory"; ++ reg = <0x40000000 0x10000000>; ++ }; ++ ++ gpio-keys { ++ compatible = "gpio-keys"; ++ ++ button-reset { ++ label = "reset"; ++ linux,code = ; ++ gpios = <&gpio 1 GPIO_ACTIVE_LOW>; ++ }; ++ ++ button-wps { ++ label = "wps"; ++ linux,code = ; ++ gpios = <&gpio 0 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ ++ gpio-leds { ++ compatible = "gpio-leds"; ++ ++ led-0 { ++ label = "blue:status"; ++ gpios = <&gpio 9 GPIO_ACTIVE_LOW>; ++ default-state = "off"; ++ }; ++ ++ running_led: led-1 { ++ label = "green:status"; ++ gpios = <&gpio 10 GPIO_ACTIVE_LOW>; ++ default-state = "off"; ++ }; ++ ++ boot_led: led-2 { ++ label = "red:status"; ++ gpios = <&gpio 11 GPIO_ACTIVE_LOW>; ++ default-state = "on"; ++ }; ++ }; ++}; ++ ++ð { ++ 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 = ; ++ }; ++ }; ++}; ++ ++&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 = "u-boot-env"; ++ reg = <0x100000 0x80000>; ++ }; ++ ++ partition@180000 { ++ label = "factory"; ++ reg = <0x180000 0x200000>; ++ }; ++ ++ partition@380000 { ++ label = "fip"; ++ reg = <0x380000 0x200000>; ++ }; ++ ++ partition@580000 { ++ label = "ubi"; ++ reg = <0x580000 0x7a80000>; ++ compatible = "linux,ubi"; ++ }; ++ }; ++ }; ++}; ++ ++&uart0 { ++ mediatek,force-highspeed; ++ status = "okay"; ++}; ++ ++&watchdog { ++ status = "disabled"; ++}; +--- /dev/null ++++ b/cmcc_a10_env +@@ -0,0 +1,54 @@ ++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-cmcc_a10-ubootmod-initramfs-recovery.itb ++bootfile_bl2=openwrt-mediatek-filogic-cmcc_a10-ubootmod-preloader.bin ++bootfile_fip=openwrt-mediatek-filogic-cmcc_a10-ubootmod-bl31-uboot.fip ++bootfile_upg=openwrt-mediatek-filogic-cmcc_a10-ubootmod-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 ) ) ) ++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 ++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 || run ubi_format ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic || 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 && ubi write $loadaddr fit $filesize ++ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && 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" diff --git a/target/linux/mediatek/dts/mt7981b-cmcc-a10-stock.dts b/target/linux/mediatek/dts/mt7981b-cmcc-a10-stock.dts new file mode 100644 index 00000000000000..96627f8bfb26d1 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-cmcc-a10-stock.dts @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include "mt7981b-cmcc-a10.dtsi" + +/ { + model = "CMCC A10 (stock layout)"; + compatible = "cmcc,a10-stock", "mediatek,mt7981"; +}; + +&partitions { + 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; + }; +}; + +&spi_nand { + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; +}; diff --git a/target/linux/mediatek/dts/mt7981b-cmcc-a10-ubootmod.dts b/target/linux/mediatek/dts/mt7981b-cmcc-a10-ubootmod.dts new file mode 100644 index 00000000000000..f8a1c7f665e84a --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-cmcc-a10-ubootmod.dts @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include "mt7981b-cmcc-a10.dtsi" + +/ { + model = "CMCC A10 (OpenWrt U-Boot layout)"; + compatible = "cmcc,a10-ubootmod", "mediatek,mt7981"; +}; + +&chosen { + bootargs = "root=/dev/fit0 rootwait"; + rootdisk = <&ubi_rootdisk>; +}; + +&partitions { + partition@580000 { + compatible = "linux,ubi"; + label = "ubi"; + reg = <0x580000 0x7a80000>; + + volumes { + ubi_rootdisk: ubi-volume-fit { + volname = "fit"; + }; + }; + }; +}; diff --git a/target/linux/mediatek/dts/mt7981b-cmcc-a10.dtsi b/target/linux/mediatek/dts/mt7981b-cmcc-a10.dtsi new file mode 100644 index 00000000000000..fe132aa66a1d62 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-cmcc-a10.dtsi @@ -0,0 +1,254 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/* + * Copyright (C) 2023 Tianling Shen + */ + +/dts-v1/; +#include +#include +#include +#include "mt7981.dtsi" + +/ { + aliases { + led-boot = &boot_led; + led-failsafe = &boot_led; + led-running = &running_led; + led-upgrade = &running_led; + serial0 = &uart0; + }; + + chosen: chosen { + stdout-path = "serial0:115200n8"; + }; + + memory@40000000 { + reg = <0 0x40000000 0 0x10000000>; + }; + + gpio-keys { + compatible = "gpio-keys"; + + button-reset { + label = "reset"; + linux,code = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + + button-wps { + label = "wps"; + linux,code = ; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + led-0 { + function = LED_FUNCTION_STATUS; + color = ; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + }; + + running_led: led-1 { + function = LED_FUNCTION_STATUS; + color = ; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + }; + + boot_led: led-2 { + function = LED_FUNCTION_STATUS; + color = ; + gpios = <&pio 11 GPIO_ACTIVE_LOW>; + }; + }; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + nvmem-cells = <&macaddr_factory_2a 0>; + nvmem-cell-names = "mac-address"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; +}; + +&mdio_bus { + switch: switch@1f { + 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>; + }; +}; + +&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 */ + }; + }; +}; + +&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-bus-width = <4>; + spi-rx-bus-width = <4>; + + partitions: partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + 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_a: macaddr@a { + compatible = "mac-base"; + reg = <0xa 0x6>; + #nvmem-cell-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; + }; + }; + }; +}; + +&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-cells = <&macaddr_factory_24 0>; + nvmem-cell-names = "mac-address"; + }; + + port@6 { + reg = <6>; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; + status = "okay"; + + band@1 { + reg = <1>; + nvmem-cells = <&macaddr_factory_a 0>; + nvmem-cell-names = "mac-address"; + }; +}; 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 b976463cff7e2e..6da63168234f35 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 @@ -30,6 +30,8 @@ mediatek_setup_interfaces() ;; asus,rt-ax59u|\ cetron,ct3003|\ + cmcc,a10-stock|\ + cmcc,a10-ubootmod|\ confiabits,mt7981|\ cudy,wr3000-v1|\ jcg,q30-pro|\ 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 11bfad2e7b1ac4..a13b46d4c1c509 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -71,6 +71,7 @@ platform_do_upgrade() { bananapi,bpi-r3-mini|\ bananapi,bpi-r4|\ bananapi,bpi-r4-poe|\ + cmcc,a10-ubootmod|\ cmcc,rax3000m|\ gatonetworks,gdsp|\ h3c,magic-nx30-pro|\ diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index e8a2888ee0e958..0de101df993126 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -500,6 +500,61 @@ define Device/cetron_ct3003 endef TARGET_DEVICES += cetron_ct3003 +define Device/cmcc_a10-stock + DEVICE_VENDOR := CMCC + DEVICE_MODEL := A10 (stock layout) + DEVICE_ALT0_VENDOR := SuperElectron + DEVICE_ALT0_MODEL := ZN-M5 (stock layout) + DEVICE_ALT1_VENDOR := SuperElectron + DEVICE_ALT1_MODEL := ZN-M8 (stock layout) + DEVICE_DTS := mt7981b-cmcc-a10-stock + DEVICE_DTS_DIR := ../dts + SUPPORTED_DEVICES += mediatek,mt7981-spim-snand-rfb + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-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 + 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 +endef +TARGET_DEVICES += cmcc_a10-stock + +define Device/cmcc_a10-ubootmod + DEVICE_VENDOR := CMCC + DEVICE_MODEL := A10 (OpenWrt U-Boot layout) + DEVICE_ALT0_VENDOR := SuperElectron + DEVICE_ALT0_MODEL := ZN-M5 (OpenWrt U-Boot layout) + DEVICE_ALT1_VENDOR := SuperElectron + DEVICE_ALT1_MODEL := ZN-M8 (OpenWrt U-Boot layout) + DEVICE_DTS := mt7981b-cmcc-a10-ubootmod + DEVICE_DTS_DIR := ../dts + SUPPORTED_DEVICES += cmcc,a10 + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware + 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 + ARTIFACTS := preloader.bin bl31-uboot.fip + ARTIFACT/preloader.bin := mt7981-bl2 spim-nand-ddr3 + ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot cmcc_a10 +endef +TARGET_DEVICES += cmcc_a10-ubootmod + define Device/cmcc_rax3000m DEVICE_VENDOR := CMCC DEVICE_MODEL := RAX3000M From 40d36ac96021a93bcee5d869b8342f1f4c75dd39 Mon Sep 17 00:00:00 2001 From: Coia Prant Date: Tue, 11 Mar 2025 11:21:33 +0800 Subject: [PATCH 552/877] mac80211: rt2x00: load the eeprom data from devicetree embedded data on Ralink SoCs It will allow loading eeprom from eeprom-data embedded in device tree. Ported from mediatek mt76 wireless driver (drivers/net/wireless/mediatek/mt76/eeprom.c) Signed-off-by: Coia Prant Link: https://github.com/openwrt/openwrt/pull/17472 Link: https://github.com/openwrt/openwrt/pull/18221 Signed-off-by: Hauke Mehrtens (cherry picked from commit 5d266b55ed4c4c4efe2e150b8b2326bb13bb6fb0) --- ...EEPROM-from-devicetree-embedded-data.patch | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 package/kernel/mac80211/patches/rt2x00/603-wifi-rt2x00-Add-support-for-loading-EEPROM-from-devicetree-embedded-data.patch diff --git a/package/kernel/mac80211/patches/rt2x00/603-wifi-rt2x00-Add-support-for-loading-EEPROM-from-devicetree-embedded-data.patch b/package/kernel/mac80211/patches/rt2x00/603-wifi-rt2x00-Add-support-for-loading-EEPROM-from-devicetree-embedded-data.patch new file mode 100644 index 00000000000000..0ef946a6cb78b5 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/603-wifi-rt2x00-Add-support-for-loading-EEPROM-from-devicetree-embedded-data.patch @@ -0,0 +1,76 @@ +From adf957124a115bdf3e4728e1ea8c70a632648cf0 Mon Sep 17 00:00:00 2001 +From: Coia Prant +Date: Fri, 14 Feb 2025 15:49:55 +0800 +Subject: [PATCH] wifi: rt2x00: Add support for loading EEPROM from devicetree + embedded data + +This patch allows rt2x00 to load eeprom from devicetree embedded data. + +Example: + +/* load eeprom from embedded data 'eeprom-data' */ +&wmac { + ralink,eeprom-data = <0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff + 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff + 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff + 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff + 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff + 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff + 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff + 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff + 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff + 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff + 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff + 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff + 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff + 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff + 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff + 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff>; +}; + +Signed-off-by: Coia Prant +--- + .../net/wireless/ralink/rt2x00/rt2x00eeprom.c | 25 +++++++++++++++++++ + 1 file changed, 25 insertions(+) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c +@@ -33,6 +33,27 @@ static void rt2800lib_eeprom_swap(struct + rt2x00dev->eeprom[i] = swab16(rt2x00dev->eeprom[i]); + } + ++static int rt2800lib_read_eeprom_data(struct rt2x00_dev *rt2x00dev) ++{ ++ struct device_node *np = rt2x00dev->dev->of_node; ++ unsigned int len = rt2x00dev->ops->eeprom_size; ++ const void *data; ++ int size; ++ ++ data = of_get_property(np, "ralink,eeprom-data", &size); ++ if (!data) ++ return -ENOENT; ++ ++ if (size != len) { ++ dev_err(rt2x00dev->dev, "invalid eeprom size, required: 0x%04x\n", len); ++ return -EINVAL; ++ } ++ ++ memcpy(rt2x00dev->eeprom, data, size); ++ ++ return 0; ++} ++ + #if IS_ENABLED(CONFIG_MTD) + static int rt2800lib_read_eeprom_mtd(struct rt2x00_dev *rt2x00dev) + { +@@ -193,6 +214,10 @@ int rt2x00lib_read_eeprom(struct rt2x00_ + { + int ret; + ++ ret = rt2800lib_read_eeprom_data(rt2x00dev); ++ if (!ret) ++ return 0; ++ + #if IS_ENABLED(CONFIG_MTD) + ret = rt2800lib_read_eeprom_mtd(rt2x00dev); + if (!ret) From 55e8ac531249097e74ab4b25f47f53dfe47ddb40 Mon Sep 17 00:00:00 2001 From: Coia Prant Date: Tue, 11 Mar 2025 11:33:00 +0800 Subject: [PATCH 553/877] ramips: add support for Hongdian H8922 v30 This is an industrial 4G router equipped with OpenWrt 14.07 OEM customized version WARNING: The original firmware device tree is common to multiple boards, and the device tree name is H9350. This submitted device tree is a modified version, which deletes the non-this-device parts and adds GPIO watchdog. Specification: - SoC: MediaTek MT7620A - Flash: 16 MB - RAM: 128 MB - Power: DC 5V-36V 1.5A - Ethernet: 1x WAN, 4x LAN (10/100 Mbps) - Wireless radio: 802.11n 2.4g-only - LED: System/Power (RUN): GPIO/26 active-low Ethernet: 1x WAN, 4x LAN Modem 1: GPIO/66 active-low RF 1 (Modem 1 Signal): GPIO/67 active-low Modem 2: GPIO 71 active-low RF 2 (Modem 2 Signal): GPIO/24 active-low WLAN: GPIO/72 active-low WPS: GPIO/12 active-low - Button: WPS / RESET: GPIO/34 active-low - UART: 1x UART on PCB - 115200 8N1 - GPIO Watchdog: GPIO/62 mode=toggle timeout=1s - PCIe: 2x miniPCIe for modem - SIM Slots: 2x SIM Slots Issue: - No factory partition, eeprom is located at /lib/firmware/mt7620a.eeprom Flash instruction: Using UART: 1. Configure PC with a static IP address and setup an TFTP server. 2. Put rootfs into the tftp directory. 3. Connect the UART line as described on the PCB. 4. Power up the device and press Ctrl+C to break auto boot. 5. Use `system 6` command and follow the instruction to set device and tftp server IP address and input the rootfs file name. U-boot will then load the rootfs and write it into the flash. 6. Use `system 1` command and follow the instruction to set device and tftp server IP address and input the firmware file name. U-boot will then load the firmware once. 7. Login to LuCI and use LuCI upgrade firmware. Original Firmware Dump / More details: https://blog.gov.cooking/archives/research-hongdian-h8922-and-flash.html Signed-off-by: Coia Prant Tested-by: Coia Prant Link: https://github.com/openwrt/openwrt/pull/17472 Link: https://github.com/openwrt/openwrt/pull/18221 Signed-off-by: Hauke Mehrtens (cherry picked from commit 6a1bdcf545eec8f9ed5130e7f5794fca6ee54cb3) --- package/boot/uboot-envtools/files/ramips | 1 + .../ramips/dts/mt7620a_hongdian_h8922-v30.dts | 189 ++++++++++++++++++ target/linux/ramips/image/mt7620.mk | 12 ++ .../mt7620/base-files/etc/board.d/02_network | 1 + 4 files changed, 203 insertions(+) create mode 100644 target/linux/ramips/dts/mt7620a_hongdian_h8922-v30.dts diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index 341687625c8603..0b17a0c47e2fcc 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -19,6 +19,7 @@ alfa-network,r36m-e4g|\ alfa-network,tube-e4g|\ engenius,epg600|\ engenius,esr600h|\ +hongdian,h8922-v30|\ linksys,re7000|\ meig,slt866|\ sitecom,wlr-4100-v1-002|\ diff --git a/target/linux/ramips/dts/mt7620a_hongdian_h8922-v30.dts b/target/linux/ramips/dts/mt7620a_hongdian_h8922-v30.dts new file mode 100644 index 00000000000000..d983f5f854ce45 --- /dev/null +++ b/target/linux/ramips/dts/mt7620a_hongdian_h8922-v30.dts @@ -0,0 +1,189 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7620a.dtsi" + +#include +#include +#include + +/ { + compatible = "hongdian,h8922-v30", "ralink,mt7620a-soc"; + model = "Hongdian H8922 v30"; + + aliases { + led-boot = &led_sys; + led-failsafe = &led_sys; + led-running = &led_sys; + led-upgrade = &led_sys; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + leds { + compatible = "gpio-leds"; + + led-wps { + gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_WPS; + }; + + led-rf-2 { + gpios = <&gpio1 0 GPIO_ACTIVE_LOW>; + color = ; + function = "rf"; + function-enumerator = <2>; + }; + + led_sys: led-sys { + gpios = <&gpio1 2 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_POWER; + default-state = "on"; + }; + + led-net-1 { + gpios = <&gpio2 26 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_MOBILE; + function-enumerator = <1>; + }; + + led-rf-1 { + gpios = <&gpio2 27 GPIO_ACTIVE_LOW>; + color = ; + function = "rf"; + function-enumerator = <1>; + }; + + led-net-2 { + gpios = <&gpio2 31 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_MOBILE; + function-enumerator = <2>; + }; + + led-wlan { + gpios = <&gpio3 0 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_WLAN; + linux,default-trigger = "phy0tpt"; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio1 10 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + watchdog { + compatible = "linux,wdt-gpio"; + + gpios = <&gpio2 22 GPIO_ACTIVE_HIGH>; + hw_algo = "toggle"; + hw_margin_ms = <600>; + always-running; + }; +}; + +&watchdog { + status = "disabled"; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x2f000>; + read-only; + }; + + partition@2f000 { + label = "u-boot-env"; + reg = <0x2f000 0x1000>; + read-only; + }; + + partition@30000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x30000 0xffd000>; + }; + }; + }; +}; + +&state_default { + gpio { + groups = "wled", "rgmii1", "rgmii2"; + function = "gpio"; + }; +}; + +ðernet { + pinctrl-names = "default"; + pinctrl-0 = <&ephy_pins>; + + mediatek,portmap = "llllw"; +}; + +&pcie { + status = "okay"; +}; + +&wmac { + ralink,eeprom-data = <0x20760501 0x000c4376 0x2058ffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff + 0xffffffff 0xffffffff 0x000c4376 0x2077000c 0x43762066 0x220c0000 0xffffb701 0x5577a8aa + 0x8c88ffff 0x0a000000 0x00000000 0x0000ffff 0xffff0a0a 0x0a0a0808 0x08080808 0x08080808 + 0x0e0e0e0e 0x0e0e0e0e 0x0e0e0e0e 0x0e0e80ff 0xffff80ff 0xffff0000 0xffffffff 0xffffffff + 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff + 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff + 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0x20ffffff 0xffffffff 0xffffffff 0xffff0606 + 0x06060402 0x06060400 0x06060400 0x07070400 0xffffffff 0xffffffff 0xffffffff 0xffffffff + 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff + 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff + 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff + 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff + 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff + 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff + 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff + 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk index 6cf65ad1194bfb..310cff692e2962 100644 --- a/target/linux/ramips/image/mt7620.mk +++ b/target/linux/ramips/image/mt7620.mk @@ -604,6 +604,18 @@ define Device/hnet_c108 endef TARGET_DEVICES += hnet_c108 +define Device/hongdian_h8922-v30 + SOC := mt7620a + IMAGE_SIZE := 15808k + DEVICE_VENDOR := Hongdian + DEVICE_MODEL := H8922 + DEVICE_VARIANT := v30 + DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-net-qmi-wwan kmod-usb-serial-option uqmi uboot-envtools + IMAGES += rootfs.bin + IMAGE/rootfs.bin := append-rootfs | check-size 10560k +endef +TARGET_DEVICES += hongdian_h8922-v30 + define Device/humax_e2 SOC := mt7620a IMAGE_SIZE := 7744k 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 577f77cb9339d4..f07ce73e82bf28 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 @@ -15,6 +15,7 @@ ramips_setup_interfaces() dlink,dwr-921-c1|\ dlink,dwr-922-e2|\ dovado,tiny-ac|\ + hongdian,h8922-v30|\ ohyeah,oy-0001|\ phicomm,psg1208|\ planex,db-wrt01|\ From 6e27a132058f4f60ba1aa68989e4a4de366a6557 Mon Sep 17 00:00:00 2001 From: Andreas Gnau Date: Tue, 7 Jan 2025 23:04:30 +0100 Subject: [PATCH 554/877] ramips: mt7621: Move common DNA EX400 defs to dtsi Move common definitions for DNA Valokuitu Plus EX400 to a dtsi include. This is in preparation of adding the non-branded variant of the device produced by Genexis / Inteno in the next commit. The device with DNA branding differs in the LED labling on the device. Signed-off-by: Andreas Gnau Link: https://github.com/openwrt/openwrt/pull/17551 (cherry picked from commit e8603f3b5a15856fccee2e02a5406ca9c8b2ba1d) Link: https://github.com/openwrt/openwrt/pull/18238 Signed-off-by: Hauke Mehrtens --- .../dts/mt7621_dna_valokuitu-plus-ex400.dts | 125 +---------------- .../mt7621_genexis_pulse-ex400-common.dtsi | 128 ++++++++++++++++++ 2 files changed, 129 insertions(+), 124 deletions(-) create mode 100644 target/linux/ramips/dts/mt7621_genexis_pulse-ex400-common.dtsi diff --git a/target/linux/ramips/dts/mt7621_dna_valokuitu-plus-ex400.dts b/target/linux/ramips/dts/mt7621_dna_valokuitu-plus-ex400.dts index cc5b4b71d07e45..9bbe91beef04a7 100644 --- a/target/linux/ramips/dts/mt7621_dna_valokuitu-plus-ex400.dts +++ b/target/linux/ramips/dts/mt7621_dna_valokuitu-plus-ex400.dts @@ -1,131 +1,8 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -#include "mt7621.dtsi" - -#include -#include -#include +#include "mt7621_genexis_pulse-ex400-common.dtsi" / { compatible = "dna,valokuitu-plus-ex400", "mediatek,mt7621-soc"; model = "DNA Valokuitu Plus EX400"; - - aliases { - ethernet0 = &gmac0; - label-mac-device = &gmac0; - led-boot = &led_status_red; - led-failsafe = &led_status_red; - led-running = &led_status_green; - led-upgrade = &led_update_green; - }; - - chosen { - bootargs-override = "console=ttyS0,115200 rootfstype=squashfs,jffs2"; - }; - - keys { - compatible = "gpio-keys"; - - reset { - label = "reset"; - gpios = <&gpio 18 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - leds { - compatible = "gpio-leds"; - - led_status_green: led-0 { - color = ; - function = LED_FUNCTION_STATUS; - gpios = <&gpio 8 GPIO_ACTIVE_LOW>; - }; - - led_status_red: led-1 { - color = ; - function = LED_FUNCTION_STATUS; - gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; - }; - - led_update_green: led-2 { - color = ; - function = LED_FUNCTION_PROGRAMMING; - gpios = <&gpio 12 GPIO_ACTIVE_LOW>; - }; - }; -}; - -&pcie { - status = "okay"; -}; - -&nand { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - reg = <0x00 0x100000>; - label = "uboot"; - read-only; - }; - - partition@100000 { - reg = <0x100000 0xff00000>; - label = "ubi"; - compatible = "linux,ubi"; - - volumes { - ubi-volume-env1 { - volname = "env1"; - - nvmem-layout { - compatible = "u-boot,env-redundant-count"; - - ethaddr: ethaddr { - #nvmem-cell-cells = <1>; - }; - }; - }; - }; - }; - }; -}; - -&gmac1 { - label = "wan"; - phy-handle = <ðphy0>; - nvmem-cells = <ðaddr 1>; - nvmem-cell-names = "mac-address"; - status = "okay"; -}; - -&i2c { - status = "okay"; -}; - -ðphy0 { - /delete-property/ interrupts; -}; - -&state_default { - gpio { - groups = "uart2", "uart3"; - function = "gpio"; - }; -}; - -&switch0 { - ports { - port@1 { - label = "lan"; - nvmem-cells = <ðaddr 0>; - nvmem-cell-names = "mac-address"; - status = "okay"; - }; - }; }; diff --git a/target/linux/ramips/dts/mt7621_genexis_pulse-ex400-common.dtsi b/target/linux/ramips/dts/mt7621_genexis_pulse-ex400-common.dtsi new file mode 100644 index 00000000000000..dddc381fe8b8ae --- /dev/null +++ b/target/linux/ramips/dts/mt7621_genexis_pulse-ex400-common.dtsi @@ -0,0 +1,128 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include +#include + +/ { + aliases { + ethernet0 = &gmac0; + label-mac-device = &gmac0; + led-boot = &led_status_red; + led-failsafe = &led_status_red; + led-running = &led_status_green; + led-upgrade = &led_update_green; + }; + + chosen { + bootargs-override = "console=ttyS0,115200 rootfstype=squashfs,jffs2"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status_green: led-0 { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + }; + + led_status_red: led-1 { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; + }; + + led_update_green: led-2 { + color = ; + function = LED_FUNCTION_PROGRAMMING; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&nand { + status = "okay"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + reg = <0x00 0x100000>; + label = "uboot"; + read-only; + }; + + partition@100000 { + reg = <0x100000 0xff00000>; + label = "ubi"; + compatible = "linux,ubi"; + + volumes { + ubi-volume-env1 { + volname = "env1"; + + nvmem-layout { + compatible = "u-boot,env-redundant-count"; + + ethaddr: ethaddr { + #nvmem-cell-cells = <1>; + }; + }; + }; + }; + }; + }; +}; + +&gmac1 { + label = "wan"; + phy-handle = <ðphy0>; + nvmem-cells = <ðaddr 1>; + nvmem-cell-names = "mac-address"; + status = "okay"; +}; + +&i2c { + status = "okay"; +}; + +ðphy0 { + /delete-property/ interrupts; +}; + +&state_default { + gpio { + groups = "uart2", "uart3"; + function = "gpio"; + }; +}; + +&switch0 { + ports { + port@1 { + label = "lan"; + nvmem-cells = <ðaddr 0>; + nvmem-cell-names = "mac-address"; + status = "okay"; + }; + }; +}; From dd0c2839a81bb3c5067be99b02ec5c0adff93ac6 Mon Sep 17 00:00:00 2001 From: Andreas Gnau Date: Tue, 7 Jan 2025 23:55:12 +0100 Subject: [PATCH 555/877] ramips: Add support for Genexis / Inteno Pulse EX400 Add support for Genexis Pulse EX400 / Inteno Pulse EX400. A branded variant for the Finnish ISP DNA has already been added in fea2264d9fdd (ramips: mt7621: Add DNA Valokuitu Plus EX400, 2023-07-31). This commit adds support for the generic variants with Inteno and Genexis branding. Inteno changed its name to Genexis and both brandings exist. In terms of electronics, there is no difference between the DNA-branded version and other brandings. LED markings on the case are different, though. While the DNA-version has a "software-update" LED, the other versions have a WPS LED. To reduce user confusion, create a separate image. Add the different device-tree with the different LED and rename things to work the same way for both variants. Specifications: - Device: Genexis Pulse EX400 / Inteno Pulse EX400 - SoC: MT7621A - Flash: 256 MB NAND - RAM: 256 MB - Ethernet: Built-in, 2 x 1 GbE - Wifi: MT7603 2.4 GHz 2x2 MIMO, MT7615 5 GHz 4x4 MU-MIMO - USB: 1x 2.0 - LEDs (GPIO): green/red status, green WPS - LEDs (SX9512, unsupported): Broadband, Wi-Fi 2.4G, Wi-Fi 5G - Buttons (GPIO): Reset - Buttons (SX9512, unsupported): Wi-Fi 2.4G, Wi-Fi 5G, WPS MAC addresses: - LAN: U-Boot 'ethaddr' (label) - WAN: label + 1 - 2.4 GHz: label + 6 - 5 GHz: label + 7 Serial: There is a black block connector next to the red ethernet connector. It is accessible also through holes in the casing. Pinout (TTL 3.3V) +---+---+ |Tx |Rx | +---+---+ |Vcc|Gnd| +---+---+ Firmware: The vendor firmware is a fork of OpenWrt (Reboot) with a kernel version 4.4.93. The flash is arranged as below and there is a dual boot mechanism alternating between rootfs_0 and rootfs_1. +-------+------+------+-----------+-----------+ | | env1 | env2 | rootfs_0 | rootfs_1 | | +------+------+-----------+-----------+ | | UBI volumes | +-------+-------------------------------------+ |U-Boot | UBI | +-------+-------------------------------------+ |mtd0 | mtd1 | +-------+-------------------------------------+ | NAND | +---------------------------------------------+ In OpenWrt rootfs_0 will be used as a boot partition that will contain the kernel and the dtb. The squashfs rootfs and overlay are standard OpenWrt behaviour. +-------+------+------+-----------+--------+------------+ | | env1 | env2 | rootfs_0 | rootfs | rootfs_data| | +------+------+-----------+--------+------------+ | | UBI volumes | +-------+-----------------------------------------------+ |U-Boot | UBI | +-------+-----------------------------------------------+ |mtd0 | mtd1 | +-------+-----------------------------------------------+ | NAND | +-------------------------------------------------------+ U-boot: With proper serial access, booting can be halted to U-boot by pressing any key. TFTP and flash writes are available, but only the first one has been tested. NOTE: Recovery mode can be accessed by holding down the reset button while powering on the device. The led 'Update' will show a solid green light once ready. A web server will be running at 192.168.1.1:80 and it will allow flashing a firmware package. You can cycle between rootfs_0 and rootfs_1 by pressing the reset button once. Root password: With the vendor web UI create a backup of your settings and download the archive to your computer. Within the archive in the file /etc/shadow replace the password hash for root with that of a password you know. Restore the configuration with the vendor web UI and you will have changed the root password. SSH access: You might need to enable the SSH service for LAN interface as by default it's enabled for WAN only. Installing OpenWrt: With the vendor web UI, or from the U-Boot recovery UI, install the OpenWrt factory image. Alternatively, ssh to the device and use sysupgrade -n from cli. Finalize by installing the OpenWrt sysupgrade image to get a fully functioning system. Reverting to the vendor firmware: Boot with OpenWrt initramfs image - Remove volumes rootfs_0, rootfs and rootfs_data and create vendor volumes. ubirmvol /dev/ubi0 -n 2 ubirmvol /dev/ubi0 -n 3 ubirmvol /dev/ubi0 -n 4 ubimkvol /dev/ubi0 -N rootfs_0 -S 990 ubimkvol /dev/ubi0 -N rootfs_1 -S 990 Power off and enter to the U-boot recovery to install the vendor firmware. Signed-off-by: Andreas Gnau Link: https://github.com/openwrt/openwrt/pull/17551 (cherry picked from commit 3e7337feead8e0a0f5a05f5b91d7d0fd7f14ec56) Link: https://github.com/openwrt/openwrt/pull/18238 Signed-off-by: Hauke Mehrtens --- package/boot/uboot-envtools/files/ramips | 3 +- .../dts/mt7621_dna_valokuitu-plus-ex400.dts | 15 ++++++ .../mt7621_genexis_pulse-ex400-common.dtsi | 12 +---- .../ramips/dts/mt7621_genexis_pulse-ex400.dts | 23 +++++++++ target/linux/ramips/image/mt7621.mk | 47 ++++++++++++------- .../mt7621/base-files/etc/board.d/02_network | 1 + .../mt7621/base-files/etc/init.d/bootcount | 3 +- .../lib/upgrade/{dna.sh => inteno.sh} | 13 +++-- .../mt7621/base-files/lib/upgrade/platform.sh | 5 +- 9 files changed, 87 insertions(+), 35 deletions(-) create mode 100644 target/linux/ramips/dts/mt7621_genexis_pulse-ex400.dts rename target/linux/ramips/mt7621/base-files/lib/upgrade/{dna.sh => inteno.sh} (79%) diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index 0b17a0c47e2fcc..d6124745da9a26 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -148,7 +148,8 @@ xiaomi,mi-router-cr6608|\ xiaomi,mi-router-cr6609) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x20000" ;; -dna,valokuitu-plus-ex400) +dna,valokuitu-plus-ex400|\ +genexis,pulse-ex400) ubootenv_add_uci_config "/dev/ubi0_0" "0x0" "0x1f000" "0x1f000" "1" ubootenv_add_uci_config "/dev/ubi0_1" "0x0" "0x1f000" "0x1f000" "1" ;; diff --git a/target/linux/ramips/dts/mt7621_dna_valokuitu-plus-ex400.dts b/target/linux/ramips/dts/mt7621_dna_valokuitu-plus-ex400.dts index 9bbe91beef04a7..e06da71d76fca4 100644 --- a/target/linux/ramips/dts/mt7621_dna_valokuitu-plus-ex400.dts +++ b/target/linux/ramips/dts/mt7621_dna_valokuitu-plus-ex400.dts @@ -5,4 +5,19 @@ / { compatible = "dna,valokuitu-plus-ex400", "mediatek,mt7621-soc"; model = "DNA Valokuitu Plus EX400"; + + aliases { + led-boot = &led_status_red; + led-failsafe = &led_status_red; + led-running = &led_status_green; + led-upgrade = &led_update_green; + }; +}; + +&leds { + led_update_green: led-2 { + color = ; + function = LED_FUNCTION_PROGRAMMING; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + }; }; diff --git a/target/linux/ramips/dts/mt7621_genexis_pulse-ex400-common.dtsi b/target/linux/ramips/dts/mt7621_genexis_pulse-ex400-common.dtsi index dddc381fe8b8ae..a3bc70e8cefed6 100644 --- a/target/linux/ramips/dts/mt7621_genexis_pulse-ex400-common.dtsi +++ b/target/linux/ramips/dts/mt7621_genexis_pulse-ex400-common.dtsi @@ -10,10 +10,6 @@ aliases { ethernet0 = &gmac0; label-mac-device = &gmac0; - led-boot = &led_status_red; - led-failsafe = &led_status_red; - led-running = &led_status_green; - led-upgrade = &led_update_green; }; chosen { @@ -30,7 +26,7 @@ }; }; - leds { + leds: leds { compatible = "gpio-leds"; led_status_green: led-0 { @@ -44,12 +40,6 @@ function = LED_FUNCTION_STATUS; gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; }; - - led_update_green: led-2 { - color = ; - function = LED_FUNCTION_PROGRAMMING; - gpios = <&gpio 12 GPIO_ACTIVE_LOW>; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_genexis_pulse-ex400.dts b/target/linux/ramips/dts/mt7621_genexis_pulse-ex400.dts new file mode 100644 index 00000000000000..2ec649832279ae --- /dev/null +++ b/target/linux/ramips/dts/mt7621_genexis_pulse-ex400.dts @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621_genexis_pulse-ex400-common.dtsi" + +/ { + compatible = "genexis,pulse-ex400", "mediatek,mt7621-soc"; + model = "Genexis/Inteno Pulse EX400"; + + aliases { + led-boot = &led_status_red; + led-failsafe = &led_status_red; + led-running = &led_status_green; + led-upgrade = &led_status_red; + }; +}; + +&leds { + led_wps_green: led-2 { + color = ; + function = LED_FUNCTION_WPS; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 02b09b3fe1511f..c1acada2fad3e6 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -51,7 +51,7 @@ define Build/arcadyan-trx rm $@.hsqs $@.tail endef -define Build/dna-header +define Build/inteno-y3-header BC='$(STAGING_DIR_HOST)/bin/bc' ;\ ubifsofs="1024" ;\ ubifs="$$(stat -c%s $@)" ;\ @@ -91,7 +91,7 @@ define Build/dna-header mv $@.tmp $@ endef -define Build/dna-bootfs +define Build/inteno-bootfs mkdir -p $@.ubifs-dir/boot # populate the boot fs with the dtb and the kernel image @@ -1058,23 +1058,11 @@ define Device/d-team_pbr-m1 endef TARGET_DEVICES += d-team_pbr-m1 +# Branded version of Genexis / Inteno EX400 (difference is one LED) define Device/dna_valokuitu-plus-ex400 - $(Device/dsa-migration) - IMAGE_SIZE := 117m - PAGESIZE := 2048 - MKUBIFS_OPTS := --min-io-size=$$(PAGESIZE) --leb-size=124KiB --max-leb-cnt=96 \ - --log-lebs=2 --space-fixup --squash-uids + $(Device/genexis_pulse-ex400/common) DEVICE_VENDOR := DNA DEVICE_MODEL := Valokuitu Plus EX400 - KERNEL := kernel-bin | lzma | uImage lzma - KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | uImage lzma - IMAGES += factory.bin - IMAGE/factory.bin := append-image-stage initramfs-kernel.bin | \ - dna-bootfs | dna-header | append-md5sum-ascii-salted - IMAGE/sysupgrade.bin := append-kernel | dna-bootfs | \ - sysupgrade-tar kernel=$$$$@ | check-size | append-metadata - DEVICE_IMG_NAME = $$(DEVICE_IMG_PREFIX)-$$(2) - DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615-firmware kmod-usb3 endef TARGET_DEVICES += dna_valokuitu-plus-ex400 @@ -1379,6 +1367,33 @@ define Device/gemtek_wvrtm-130acn endef TARGET_DEVICES += gemtek_wvrtm-130acn +# Common definitions shared between genexis_pulse-ex400 and dna_valokuitu-plus-ex400 +define Device/genexis_pulse-ex400/common + $(Device/dsa-migration) + IMAGE_SIZE := 117m + PAGESIZE := 2048 + MKUBIFS_OPTS := --min-io-size=$$(PAGESIZE) --leb-size=124KiB --max-leb-cnt=96 \ + --log-lebs=2 --space-fixup --squash-uids + KERNEL := kernel-bin | lzma | uImage lzma + KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | uImage lzma + IMAGES += factory.bin + IMAGE/factory.bin := append-image-stage initramfs-kernel.bin | \ + inteno-bootfs | inteno-y3-header | append-md5sum-ascii-salted + IMAGE/sysupgrade.bin := append-kernel | inteno-bootfs | \ + sysupgrade-tar kernel=$$$$@ | check-size | append-metadata + DEVICE_IMG_NAME = $$(DEVICE_IMG_PREFIX)-$$(2) + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615-firmware kmod-usb3 +endef + +define Device/genexis_pulse-ex400 + $(Device/genexis_pulse-ex400/common) + DEVICE_VENDOR := Genexis + DEVICE_MODEL := Pulse EX400 + DEVICE_ALT0_VENDOR := Inteno + DEVICE_ALT0_MODEL := Pulse EX400 +endef +TARGET_DEVICES += genexis_pulse-ex400 + define Device/glinet_gl-mt1300 $(Device/dsa-migration) IMAGE_SIZE := 32448k 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 650fef62a846ef..af5e4a8403df18 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 @@ -72,6 +72,7 @@ ramips_setup_interfaces() comfast,cf-ew72-v2|\ cudy,m1800|\ dna,valokuitu-plus-ex400|\ + genexis,pulse-ex400|\ humax,e10|\ keenetic,kn-3510|\ meig,slt866|\ 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 b83223e7ddd757..2c88d68051854a 100755 --- a/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount +++ b/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount @@ -32,7 +32,8 @@ boot() { samknows,whitebox-v8) fw_setenv bootcount 0 ;; - dna,valokuitu-plus-ex400) + dna,valokuitu-plus-ex400|\ + genexis,pulse-ex400) fw_setenv boot_cnt_primary 0 fw_setenv boot_cnt_alt 0 ;; diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/dna.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/inteno.sh similarity index 79% rename from target/linux/ramips/mt7621/base-files/lib/upgrade/dna.sh rename to target/linux/ramips/mt7621/base-files/lib/upgrade/inteno.sh index d699516ff6f2d5..677000f6b1aef7 100644 --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/dna.sh +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/inteno.sh @@ -16,11 +16,16 @@ . /lib/functions.sh . /lib/upgrade/nand.sh -dna_do_upgrade () { - tar -xaf $1 +inteno_do_upgrade () { + local tar_file=$1 + local cmd=cat + # WARNING: This fails if tar contains more than one 'sysupgrade-*' directory. + local board_dir="$(tar tf "$tar_file" | grep -m 1 '^sysupgrade-.*/$')" + board_dir="${board_dir%/}" + tar -xaf "$tar_file" # get the size of the new bootfs - local _bootfs_size=$(wc -c < ./sysupgrade-dna_valokuitu-plus-ex400/kernel) + local _bootfs_size=$(wc -c < "$board_dir/kernel") [ -n "$_bootfs_size" -a "$_bootfs_size" -gt "0" ] || nand_do_upgrade_failed # remove existing rootfses and recreate rootfs_0 @@ -32,7 +37,7 @@ dna_do_upgrade () { # update the rootfs_0 contents local _kern_ubivol=$( nand_find_volume "ubi0" "rootfs_0" ) - ubiupdatevol /dev/${_kern_ubivol} sysupgrade-dna_valokuitu-plus-ex400/kernel + ubiupdatevol "/dev/$_kern_ubivol" "$board_dir/kernel" fw_setenv root_vol rootfs_0 fw_setenv boot_cnt_primary 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 17532f795b293c..33f8ccd4ce7b13 100755 --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh @@ -156,8 +156,9 @@ platform_do_upgrade() { buffalo,wsr-2533dhpls) buffalo_do_upgrade "$1" ;; - dna,valokuitu-plus-ex400) - dna_do_upgrade "$1" + dna,valokuitu-plus-ex400|\ + genexis,pulse-ex400) + inteno_do_upgrade "$1" ;; elecom,wrc-x1800gs) [ "$(fw_printenv -n bootmenu_delay)" != "0" ] || \ From 76565015f56cd18b757b42b53667478d20753672 Mon Sep 17 00:00:00 2001 From: Andreas Gnau Date: Fri, 10 Jan 2025 22:42:03 +0100 Subject: [PATCH 556/877] ramips: mt7621: Reduce hardcoded metadata for Inteno Y3 imgs Instead of hardcoded metadata, put some sensible data instead. Signed-off-by: Andreas Gnau Link: https://github.com/openwrt/openwrt/pull/17551 (cherry picked from commit 4e3342f5f17d5d227f036b4b16e2a3721a2e8493) Link: https://github.com/openwrt/openwrt/pull/18238 Signed-off-by: Hauke Mehrtens --- target/linux/ramips/image/mt7621.mk | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index c1acada2fad3e6..37e6ce1b715e67 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -67,12 +67,12 @@ define Build/inteno-y3-header echo "IntenoIopY" > $@.tmp ;\ echo "version 5" >> $@.tmp ;\ echo "integrity MD5SUM" >> $@.tmp ;\ - echo "board EX400" >> $@.tmp ;\ - echo "chip 7621" >> $@.tmp ;\ - echo "arch all mipsel_1004kc" >> $@.tmp ;\ - echo "model EX400" >> $@.tmp ;\ - echo "release EX400-X-DNA-4.3.6.100-R-210518_0935" >> $@.tmp ;\ - echo "customer DNA" >> $@.tmp ;\ + echo "board $(word 1,$(1))" >> $@.tmp ;\ + echo "chip $(patsubst mt%,%,$(SOC:bcm%=%))" >> $@.tmp ;\ + echo "arch all $(CONFIG_TARGET_ARCH_PACKAGES)" >> $@.tmp ;\ + echo "model $(word 1,$(1))" >> $@.tmp ;\ + echo "release $(DEVICE_IMG_PREFIX)" >> $@.tmp ;\ + echo "customer $(if $(CONFIG_VERSION_DIST),$(CONFIG_VERSION_DIST),OpenWrt)" >> $@.tmp ;\ echo "ubifsofs $${ubifsofs}" >> $@.tmp ;\ echo "ubifs $${ubifs}" >> $@.tmp ;\ echo "pkginfoofs $${pkginfoofs}" >> $@.tmp ;\ @@ -1378,7 +1378,7 @@ define Device/genexis_pulse-ex400/common KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | uImage lzma IMAGES += factory.bin IMAGE/factory.bin := append-image-stage initramfs-kernel.bin | \ - inteno-bootfs | inteno-y3-header | append-md5sum-ascii-salted + inteno-bootfs | inteno-y3-header EX400 | append-md5sum-ascii-salted IMAGE/sysupgrade.bin := append-kernel | inteno-bootfs | \ sysupgrade-tar kernel=$$$$@ | check-size | append-metadata DEVICE_IMG_NAME = $$(DEVICE_IMG_PREFIX)-$$(2) From 2304486d600b3cdaef17602786251218e2317afe Mon Sep 17 00:00:00 2001 From: Michael Trinidad Date: Sun, 16 Feb 2025 18:44:03 -0500 Subject: [PATCH 557/877] mwlwifi: update to version 10.4.11-20250206 The fixes are only for the WRT1900X and WRT1200AC. It contains: Deletes the driver's ability to modify the debit table. Remove skb_get(done_skb) in txdone Reworking ISR clean code Napi replaces tasklet Add rx_decrypt feature Signed-off-by: Michael Trinidad Link: https://github.com/openwrt/openwrt/pull/17997 Signed-off-by: Christian Marangi Link: https://github.com/openwrt/openwrt/pull/18145 Signed-off-by: Hauke Mehrtens --- package/kernel/mwlwifi/Makefile | 8 +- ...memcpy-in-mwl_fwcmd_get_fw_core_dump.patch | 2 +- ...-PTR_ERR-in-pcie_bf_mimo_ctrl_decode.patch | 2 +- ...Use-zu-and-zd-for-ssize_t-and-size_t.patch | 2 +- ...CIe-DT-node-null-pointer-dereference.patch | 31 ------- .../mwlwifi/patches/020-mac80211_update.patch | 82 +++++++++---------- 6 files changed, 48 insertions(+), 79 deletions(-) delete mode 100644 package/kernel/mwlwifi/patches/010-mwlwifi-fix-PCIe-DT-node-null-pointer-dereference.patch diff --git a/package/kernel/mwlwifi/Makefile b/package/kernel/mwlwifi/Makefile index 3f2d5e0949377d..07c3acc5f909c9 100644 --- a/package/kernel/mwlwifi/Makefile +++ b/package/kernel/mwlwifi/Makefile @@ -8,16 +8,16 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mwlwifi -PKG_RELEASE=2 +PKG_RELEASE=1 PKG_LICENSE:=ISC PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/kaloz/mwlwifi PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2024-04-19 -PKG_SOURCE_VERSION:=a737d348ef4fe00434b2bc44b2b6a68ea833d95b -PKG_MIRROR_HASH:=d55f69c2fa48d02ba535b72b108fc77f5f13a52b29130a631489a053f1670d2c +PKG_SOURCE_DATE:=2025-02-06 +PKG_SOURCE_VERSION:=db97edf20fadea2617805006f5230665fadc6a8c +PKG_MIRROR_HASH:=b5464cf6d57d87f6ce5f13bd2320c7e7e671a3152a74f4ef004382f898b89ecf PKG_MAINTAINER:=Imre Kaloz PKG_BUILD_PARALLEL:=1 diff --git a/package/kernel/mwlwifi/patches/001-Simplify-coredump-memcpy-in-mwl_fwcmd_get_fw_core_dump.patch b/package/kernel/mwlwifi/patches/001-Simplify-coredump-memcpy-in-mwl_fwcmd_get_fw_core_dump.patch index 4b0feeb17e6257..20e1cce382c254 100644 --- a/package/kernel/mwlwifi/patches/001-Simplify-coredump-memcpy-in-mwl_fwcmd_get_fw_core_dump.patch +++ b/package/kernel/mwlwifi/patches/001-Simplify-coredump-memcpy-in-mwl_fwcmd_get_fw_core_dump.patch @@ -20,7 +20,7 @@ Signed-off-by: Christian Marangi --- a/hif/fwcmd.c +++ b/hif/fwcmd.c -@@ -3622,11 +3622,7 @@ int mwl_fwcmd_get_fw_core_dump(struct ie +@@ -3624,11 +3624,7 @@ int mwl_fwcmd_get_fw_core_dump(struct ie core_dump->context = pcmd->cmd_data.coredump.context; core_dump->size_kb = pcmd->cmd_data.coredump.size_kb; core_dump->flags = pcmd->cmd_data.coredump.flags; diff --git a/package/kernel/mwlwifi/patches/002-Correctly-use-PTR_ERR-in-pcie_bf_mimo_ctrl_decode.patch b/package/kernel/mwlwifi/patches/002-Correctly-use-PTR_ERR-in-pcie_bf_mimo_ctrl_decode.patch index f204e9fe73d29f..f6c398cf661b16 100644 --- a/package/kernel/mwlwifi/patches/002-Correctly-use-PTR_ERR-in-pcie_bf_mimo_ctrl_decode.patch +++ b/package/kernel/mwlwifi/patches/002-Correctly-use-PTR_ERR-in-pcie_bf_mimo_ctrl_decode.patch @@ -19,7 +19,7 @@ Signed-off-by: Christian Marangi --- a/hif/pcie/pcie.c +++ b/hif/pcie/pcie.c -@@ -1466,8 +1466,8 @@ static void pcie_bf_mimo_ctrl_decode(str +@@ -1449,8 +1449,8 @@ static void pcie_bf_mimo_ctrl_decode(str &fp_data->f_pos); filp_close(fp_data, current->files); } else { diff --git a/package/kernel/mwlwifi/patches/003-Use-zu-and-zd-for-ssize_t-and-size_t.patch b/package/kernel/mwlwifi/patches/003-Use-zu-and-zd-for-ssize_t-and-size_t.patch index d615e1338001f7..816fb222c05f5f 100644 --- a/package/kernel/mwlwifi/patches/003-Use-zu-and-zd-for-ssize_t-and-size_t.patch +++ b/package/kernel/mwlwifi/patches/003-Use-zu-and-zd-for-ssize_t-and-size_t.patch @@ -14,7 +14,7 @@ Signed-off-by: Christian Marangi --- a/debugfs.c +++ b/debugfs.c -@@ -1342,7 +1342,7 @@ done: +@@ -1394,7 +1394,7 @@ done: priv->reg_value); else len += scnprintf(p + len, size - len, diff --git a/package/kernel/mwlwifi/patches/010-mwlwifi-fix-PCIe-DT-node-null-pointer-dereference.patch b/package/kernel/mwlwifi/patches/010-mwlwifi-fix-PCIe-DT-node-null-pointer-dereference.patch deleted file mode 100644 index f37d2f8171a8df..00000000000000 --- a/package/kernel/mwlwifi/patches/010-mwlwifi-fix-PCIe-DT-node-null-pointer-dereference.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 8e809b241695252e397bf0d7fc5f36e115c38831 Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Fri, 5 Mar 2021 11:47:59 +0100 -Subject: [PATCH] mwlwifi: fix PCIe DT node null pointer dereference - -pci_bus_to_OF_node() used to get the PCI bus DT node -returns node if found or NULL if none is found. - -Since the return of pci_bus_to_OF_node() is not checked in -the DT node name print it will cause a null pointer -dereference and crash the kernel. - -So first check whether the node is not NULL and then print. - -Signed-off-by: Robert Marko ---- - hif/pcie/pcie.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/hif/pcie/pcie.c -+++ b/hif/pcie/pcie.c -@@ -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); -- wiphy_info(priv->hw->wiphy, "device node: %s\n", dev_node->full_name); -+ if (dev_node) -+ wiphy_info(priv->hw->wiphy, "device node: %s\n", dev_node->full_name); - - return dev_node; - } diff --git a/package/kernel/mwlwifi/patches/020-mac80211_update.patch b/package/kernel/mwlwifi/patches/020-mac80211_update.patch index 1c5d5819392118..1d4afabb51db3f 100644 --- a/package/kernel/mwlwifi/patches/020-mac80211_update.patch +++ b/package/kernel/mwlwifi/patches/020-mac80211_update.patch @@ -13,7 +13,7 @@ --- a/debugfs.c +++ b/debugfs.c -@@ -498,9 +498,9 @@ static ssize_t mwl_debugfs_vif_read(stru +@@ -550,9 +550,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"); @@ -26,7 +26,7 @@ len += scnprintf(p + len, size - len, "ssid: %s\n", ssid); len += scnprintf(p + len, size - len, -@@ -522,8 +522,8 @@ static ssize_t mwl_debugfs_vif_read(stru +@@ -574,8 +574,8 @@ static ssize_t mwl_debugfs_vif_read(stru "type: unknown\n"); break; } @@ -37,7 +37,7 @@ len += scnprintf(p + len, size - len, "channel: %d: width: %d\n", chan_def->chan->hw_value, -@@ -596,18 +596,18 @@ static ssize_t mwl_debugfs_sta_read(stru +@@ -648,18 +648,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 , @@ -68,7 +68,7 @@ sta->tdls, sta->tdls_initiator, sta->wme, -@@ -1158,7 +1158,7 @@ static ssize_t mwl_debugfs_dfs_radar_wri +@@ -1210,7 +1210,7 @@ static ssize_t mwl_debugfs_dfs_radar_wri struct mwl_priv *priv = (struct mwl_priv *)file->private_data; wiphy_info(priv->hw->wiphy, "simulate radar detected\n"); @@ -127,7 +127,7 @@ a_band = true; else return -EINVAL; -@@ -2090,7 +2094,7 @@ int mwl_fwcmd_set_beacon(struct ieee8021 +@@ -2092,7 +2096,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; @@ -136,7 +136,7 @@ goto err; if (b_inf->cap_info & WLAN_CAPABILITY_SPECTRUM_MGMT) -@@ -2152,38 +2156,38 @@ int mwl_fwcmd_set_new_stn_add(struct iee +@@ -2154,38 +2158,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) @@ -189,7 +189,7 @@ } pcmd->is_qos_sta = sta->wme; -@@ -2239,38 +2243,38 @@ int mwl_fwcmd_set_new_stn_add_sc4(struct +@@ -2241,38 +2245,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) @@ -242,7 +242,7 @@ } pcmd->is_qos_sta = sta->wme; -@@ -2787,9 +2791,9 @@ int mwl_fwcmd_create_ba(struct ieee80211 +@@ -2789,9 +2793,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 = @@ -254,7 +254,7 @@ IEEE80211_HT_AMPDU_PARM_DENSITY); if (direction == BA_FLAG_DIRECTION_UP) { pcmd->ba_info.create_params.reset_seq_no = 0; -@@ -2799,9 +2803,9 @@ int mwl_fwcmd_create_ba(struct ieee80211 +@@ -2801,9 +2805,9 @@ int mwl_fwcmd_create_ba(struct ieee80211 pcmd->ba_info.create_params.current_seq = cpu_to_le16(0); } if (priv->chip_type == MWL8964 && @@ -268,16 +268,16 @@ } --- a/hif/pcie/8864/tx.c +++ b/hif/pcie/8864/tx.c -@@ -490,7 +490,7 @@ static void pcie_non_pfu_tx_done(struct - } else - memmove(dma_data->data - hdrlen, &dma_data->wh, hdrlen); - skb_pull(done_skb, sizeof(*dma_data) - hdrlen); -- ieee80211_tx_status(priv->hw, done_skb); -+ ieee80211_tx_status_skb(priv->hw, done_skb); - dev_kfree_skb_any(done_skb); - done_skb = NULL; - } -@@ -743,7 +743,7 @@ void pcie_8864_tx_xmit(struct ieee80211_ +@@ -478,7 +478,7 @@ static void pcie_non_pfu_tx_done(struct + } else + memmove(dma_data->data - hdrlen, &dma_data->wh, hdrlen); + skb_pull(done_skb, sizeof(*dma_data) - hdrlen); +- ieee80211_tx_status(priv->hw, done_skb); ++ ieee80211_tx_status_skb(priv->hw, done_skb); + next: + tx_hndl = tx_hndl->pnext; + tx_desc = tx_hndl->pdesc; +@@ -730,7 +730,7 @@ void pcie_8864_tx_xmit(struct ieee80211_ index = SYSADPT_TX_WMM_QUEUES - index - 1; txpriority = index; @@ -286,7 +286,7 @@ !(xmitcontrol & EAGLE_TXD_XMITCTRL_USE_MC_RATE) && ieee80211_is_data_qos(wh->frame_control)) { tid = qos & 0xf; -@@ -925,4 +925,4 @@ void pcie_8864_tx_del_sta_amsdu_pkts(str +@@ -912,4 +912,4 @@ void pcie_8864_tx_del_sta_amsdu_pkts(str } } spin_unlock_bh(&sta_info->amsdu_lock); @@ -313,7 +313,7 @@ bypass_ack: if (++tx_done_tail >= MAX_TX_RING_DONE_SIZE) -@@ -596,13 +596,13 @@ void pcie_tx_xmit_ndp(struct ieee80211_h +@@ -593,13 +593,13 @@ void pcie_tx_xmit_ndp(struct ieee80211_h ack_skb = skb_copy(skb, GFP_ATOMIC); ack_info = IEEE80211_SKB_CB(ack_skb); pcie_tx_prepare_info(priv, 0, ack_info); @@ -340,16 +340,16 @@ pcie_priv->txbd_ring_size); for (num = 0; num < PCIE_MAX_TXRX_BD; num++) { -@@ -444,7 +444,7 @@ static void pcie_pfu_tx_done(struct mwl_ - } else - memmove(dma_data->data - hdrlen, &dma_data->wh, hdrlen); - skb_pull(done_skb, sizeof(*pfu_dma) - hdrlen); -- ieee80211_tx_status(priv->hw, done_skb); -+ ieee80211_tx_status_skb(priv->hw, done_skb); - } +@@ -431,7 +431,7 @@ static void pcie_pfu_tx_done(struct mwl_ + } else + memmove(dma_data->data - hdrlen, &dma_data->wh, hdrlen); + skb_pull(done_skb, sizeof(*pfu_dma) - hdrlen); +- ieee80211_tx_status(priv->hw, done_skb); ++ ieee80211_tx_status_skb(priv->hw, done_skb); } next: -@@ -694,7 +694,7 @@ void pcie_8997_tx_xmit(struct ieee80211_ + memset(data_buf, 0, sizeof(*data_buf)); +@@ -682,7 +682,7 @@ void pcie_8997_tx_xmit(struct ieee80211_ index = SYSADPT_TX_WMM_QUEUES - index - 1; txpriority = index; @@ -358,7 +358,7 @@ !(xmitcontrol & EAGLE_TXD_XMITCTRL_USE_MC_RATE) && ieee80211_is_data_qos(wh->frame_control)) { tid = qos & 0xf; -@@ -875,4 +875,4 @@ void pcie_8997_tx_del_sta_amsdu_pkts(str +@@ -863,4 +863,4 @@ void pcie_8997_tx_del_sta_amsdu_pkts(str } } spin_unlock_bh(&sta_info->amsdu_lock); @@ -376,7 +376,7 @@ { mwl_fwcmd_radio_disable(hw); -@@ -368,15 +368,15 @@ static void mwl_mac80211_bss_info_change +@@ -390,15 +390,15 @@ static void mwl_mac80211_bss_info_change } } @@ -395,7 +395,7 @@ { struct mwl_priv *priv = hw->priv; struct mwl_vif *mwl_vif; -@@ -426,8 +426,8 @@ static void mwl_mac80211_bss_info_change +@@ -448,8 +448,8 @@ static void mwl_mac80211_bss_info_change if (changed & (BSS_CHANGED_BEACON_INT | BSS_CHANGED_BEACON)) { struct sk_buff *skb; @@ -406,7 +406,7 @@ (!info->hidden_ssid)) { if (mwl_vif->broadcast_ssid != true) { mwl_fwcmd_broadcast_ssid_enable(hw, vif, true); -@@ -441,7 +441,7 @@ static void mwl_mac80211_bss_info_change +@@ -463,7 +463,7 @@ static void mwl_mac80211_bss_info_change } if (!mwl_vif->set_beacon) { @@ -415,7 +415,7 @@ if (skb) { mwl_fwcmd_set_beacon(hw, vif, skb->data, skb->len); -@@ -458,7 +458,7 @@ static void mwl_mac80211_bss_info_change +@@ -480,7 +480,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, @@ -424,7 +424,7 @@ { switch (vif->type) { case NL80211_IFTYPE_AP: -@@ -583,10 +583,10 @@ static int mwl_mac80211_sta_add(struct i +@@ -605,10 +605,10 @@ static int mwl_mac80211_sta_add(struct i if (vif->type == NL80211_IFTYPE_MESH_POINT) sta_info->is_mesh_node = true; @@ -437,7 +437,7 @@ sta_info->amsdu_ctrl.cap = MWL_AMSDU_SIZE_8K; sta_info->amsdu_ctrl.amsdu_allow_size = SYSADPT_AMSDU_8K_MAX_SIZE; } -@@ -670,7 +670,7 @@ static int mwl_mac80211_sta_remove(struc +@@ -692,7 +692,7 @@ static int mwl_mac80211_sta_remove(struc static int mwl_mac80211_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, @@ -446,7 +446,7 @@ const struct ieee80211_tx_queue_params *params) { struct mwl_priv *priv = hw->priv; -@@ -934,4 +934,9 @@ const struct ieee80211_ops mwl_mac80211_ +@@ -956,4 +956,9 @@ 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, @@ -502,7 +502,7 @@ case TX_RATE_FORMAT_LEGACY: --- a/hif/pcie/pcie.c +++ b/hif/pcie/pcie.c -@@ -546,7 +546,7 @@ static irqreturn_t pcie_isr_8864(struct +@@ -533,7 +533,7 @@ static irqreturn_t pcie_isr_8864(struct if (int_status & MACREG_A2HRIC_BIT_RADAR_DETECT) { wiphy_info(hw->wiphy, "radar detected by firmware\n"); @@ -510,8 +510,8 @@ + ieee80211_radar_detected(hw, NULL); } - if (int_status & MACREG_A2HRIC_BIT_CHAN_SWITCH) ieee80211_queue_work(hw, &priv->chnl_switch_handle); -@@ -593,7 +593,7 @@ static irqreturn_t pcie_isr_8997(struct + if (int_status & MACREG_A2HRIC_BIT_CHAN_SWITCH) +@@ -575,7 +575,7 @@ static irqreturn_t pcie_isr_8997(struct if (int_status & MACREG_A2HRIC_BIT_RADAR_DETECT) { wiphy_info(hw->wiphy, "radar detected by firmware\n"); @@ -520,7 +520,7 @@ } if (int_status & MACREG_A2HRIC_BIT_CHAN_SWITCH) -@@ -1071,7 +1071,7 @@ static irqreturn_t pcie_isr_ndp(struct i +@@ -1053,7 +1053,7 @@ static irqreturn_t pcie_isr_ndp(struct i if (int_status & MACREG_A2HRIC_NEWDP_DFS) { wiphy_info(hw->wiphy, "radar detected by firmware\n"); From b16b75efbac2900ea48fc3302a0e28b80e6b70a6 Mon Sep 17 00:00:00 2001 From: Roland Reinl Date: Fri, 28 Feb 2025 06:11:01 +0100 Subject: [PATCH 558/877] ramips: Add support for Cudy M1300 v2 The M1300 v2 is similar to the WR1300 series from Cudy. Differences: - Only 1 LAN port - No USB Specifications: - MT7621 - MT7603E (2.4G b/g/n) and MT7613BE (5G ac/n) wifi - 128 MB RAM - 16 MB flash MAC Addresses: - There is one on the label, e.g. xx:xx:xx:xx:xx:1C - LAN (bottom connector) is the same as the label, e.g. xx:xx:xx:xx:xx:1C - WAN (top connector) is label +2, e.g. xx:xx:xx:xx:xx:1E - WLAN (2.4G) is the same as the label, e.g. xx:xx:xx:xx:xx:1C - WLAN (5G) is the same as WAN, e.g. xx:xx:xx:xx:xx:1E UART: - is available via the pin holes on the board - From inner to outer pin: TX, RX, GND, VCC - Do NOT connect VCC - Settings: 3.3V, 115200, 8N1 GPIO: - There are two LEDs: Red (GPIO 3) and White (GPIO 4) - There are two buttons: Reset (GPIO 8) and WPS (GPIO 10) Migration to OpenWrt: - Download the migration image from the Cudy website (it should be available as soon as OpenWrt officially supports the device) - The migration image is also available here until a image is provided by Cudy: https://github.com/RolandoMagico/openwrt-build/releases/tag/M1300_Build_20240222 - File: openwrt-ramips-mt7621-cudy_m1300-v2-squashfs-flash-signed.bin - Connect computer to LAN (bottom connector) and flash the migration image via OEM web interface - In the migration image, LAN and WAN are swapped. Computer must be connected to the other port after flashing - OpenWrt is now accessible via 192.168.1.1 - After flashing an up to date OpenWrt image, LAN and WAN settings are again the same as in the OEM firmware - So use the other connector again Revert back to OEM firmware: - Set up a TFTP server on IP 192.168.1.88 and connect to the LAN port (lower port) - Provide the Cudy firmware as recovery.bin in the TFTP server - Press the reset button while powering on the device - Recovery process is started now - When recovery process is done, OEM firmware is accessible via 192.168.10.1 again General information: - No possibility to load a initramfs image via U-Boot because there is no option to interrupt U-Boot Signed-off-by: Roland Reinl Link: https://github.com/openwrt/openwrt/pull/18139 (cherry picked from commit 8a7863767056ca0dec69a6b383b6e0c0d5fc3af7) Link: https://github.com/openwrt/openwrt/pull/18204 Signed-off-by: Hauke Mehrtens --- .../linux/ramips/dts/mt7621_cudy_m1300-v2.dts | 201 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 13 ++ .../mt7621/base-files/etc/board.d/02_network | 1 + 3 files changed, 215 insertions(+) create mode 100644 target/linux/ramips/dts/mt7621_cudy_m1300-v2.dts diff --git a/target/linux/ramips/dts/mt7621_cudy_m1300-v2.dts b/target/linux/ramips/dts/mt7621_cudy_m1300-v2.dts new file mode 100644 index 00000000000000..f988b3375bb180 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_cudy_m1300-v2.dts @@ -0,0 +1,201 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include +#include + +/ { + compatible = "cudy,m1300-v2", "mediatek,mt7621-soc"; + model = "Cudy M1300 v2"; +}; + +/ { + aliases { + led-boot = &led_status_white; + led-failsafe = &led_status_red; + led-running = &led_status_white; + led-upgrade = &led_status_red; + label-mac-device = &gmac0; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio 10 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status_red: led-status-red { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + }; + + led_status_white: led-status-white { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&spi0 { + status = "okay"; + + 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 = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x400>; + }; + + eeprom_factory_8000: eeprom@8000 { + reg = <0x8000 0x4da8>; + }; + }; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0xf80000>; + }; + + partition@fd0000 { + label = "debug"; + reg = <0xfd0000 0x10000>; + read-only; + }; + + partition@fe0000 { + label = "backup"; + reg = <0xfe0000 0x10000>; + read-only; + }; + + partition@ff0000 { + label = "bdinfo"; + reg = <0xff0000 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>; + }; + }; + }; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + nvmem-cells = <&eeprom_factory_0>, <&macaddr_bdinfo_de00 0>; + nvmem-cell-names = "eeprom", "mac-address"; + ieee80211-freq-limit = <2400000 2500000>; + }; +}; + +&pcie1 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + nvmem-cells = <&eeprom_factory_8000>, <&macaddr_bdinfo_de00 2>; + nvmem-cell-names = "eeprom", "mac-address"; + ieee80211-freq-limit = <5000000 6000000>; + }; +}; + + +&gmac0 { + nvmem-cells = <&macaddr_bdinfo_de00 0>; + nvmem-cell-names = "mac-address"; +}; + +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_bdinfo_de00 2>; + nvmem-cell-names = "mac-address"; +}; + +ðphy4 { + /delete-property/ interrupts; +}; + +&switch0 { + ports { + port@3 { + status = "okay"; + label = "lan"; + }; + }; +}; + +&state_default { + gpio { + groups = "wdt", "jtag"; + function = "gpio"; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 37e6ce1b715e67..7674d0274d3713 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -685,6 +685,19 @@ define Device/confiabits_mt7621-v1 endef TARGET_DEVICES += confiabits_mt7621-v1 +define Device/cudy_m1300-v2 + $(Device/dsa-migration) + IMAGE_SIZE := 15872k + DEVICE_VENDOR := Cudy + DEVICE_MODEL := M1300 + DEVICE_VARIANT := v2 + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7663-firmware-ap \ + -uboot-envtools + UIMAGE_NAME := R15 + SUPPORTED_DEVICES += R15 +endef +TARGET_DEVICES += cudy_m1300-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 af5e4a8403df18..8d94cd592d6e2f 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 @@ -70,6 +70,7 @@ ramips_setup_interfaces() asiarf,ap7621-001|\ comfast,cf-e390ax|\ comfast,cf-ew72-v2|\ + cudy,m1300-v2|\ cudy,m1800|\ dna,valokuitu-plus-ex400|\ genexis,pulse-ex400|\ From 41613c0f7bf1bfa12a2cb23817c11d7bb7a1e84a Mon Sep 17 00:00:00 2001 From: John Audia Date: Thu, 27 Feb 2025 15:06:51 -0500 Subject: [PATCH 559/877] kernel: bump 6.6 to 6.6.80 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.80 Removed upstreamed: generic/backport-6.6/819-v6.8-0002-nvmem-Create-a-header-for-internal-sharing.patch[1] generic/backport-6.6/819-v6.8-0003-nvmem-Simplify-the-add_cells-hook.patch[2] generic/backport-6.6/819-v6.8-0004-nvmem-Move-and-rename-fixup_cell_info.patch[3] All other patches automatically rebased. 1. https://web.git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.80&id=39dfc17a38f77b14f7cb2619bd3488a18d797d5d 2. https://web.git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.80&id=276dae17ad9757c3813d9e736a0210f05ccdf8b7 3. https://web.git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.80&id=a0ee898a5024f12572e4ce45202df9b149dadc05 Build system: x86/64 Build-tested: bcm27xx/bcm2712, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Run-tested: bcm27xx/bcm2712, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/18140 Signed-off-by: Robert Marko (cherry picked from commit 86fd00b0fb83300ed7bd39af137a495c61253713) Link: https://github.com/openwrt/openwrt/pull/18208 Signed-off-by: Hauke Mehrtens --- include/kernel-6.6 | 4 +- .../900-unaligned_access_hacks.patch | 2 +- ...rs-remove-legacy_cursor_update-hacks.patch | 2 +- ...tional-threaded-NAPI-wakeup-based-on.patch | 6 +- ...-to-use-SMP-threads-for-backlog-NAPI.patch | 22 +-- ...klog-NAPI-to-clean-up-the-defer_list.patch | 4 +- ...-net-Rename-rps_lock-to-backlog_lock.patch | 18 +- ...-net-Make-USO-depend-on-CSUM-offload.patch | 6 +- ...64-if-device-if-driver-is-configured.patch | 2 +- ...-create-a-dummy-net_device-allocator.patch | 8 +- ...t-introduce-napi_is_scheduled-helper.patch | 2 +- ...4-Revert-nvmem-add-new-config-option.patch | 6 +- ...mem_layout_get_container-in-another-.patch | 4 +- ...Create-a-header-for-internal-sharing.patch | 91 ---------- ...03-nvmem-Simplify-the-add_cells-hook.patch | 79 -------- ...vmem-Move-and-rename-fixup_cell_info.patch | 169 ------------------ ...1-nvmem-imx-ocotp-ele-support-i.MX95.patch | 2 +- ...et-free_netdev-exit-earlier-if-dummy.patch | 2 +- .../721-net-add-packet-mangeling.patch | 2 +- ...680-net-add-TCP-fraglist-GRO-support.patch | 2 +- ...are-qcom_scm-disable-SDI-if-required.patch | 2 +- ...qcom_scm-Clear-download-bit-during-r.patch | 2 +- .../810-uvc-add-iPassion-iP2970-support.patch | 2 +- 23 files changed, 50 insertions(+), 389 deletions(-) delete mode 100644 target/linux/generic/backport-6.6/819-v6.8-0002-nvmem-Create-a-header-for-internal-sharing.patch delete mode 100644 target/linux/generic/backport-6.6/819-v6.8-0003-nvmem-Simplify-the-add_cells-hook.patch delete mode 100644 target/linux/generic/backport-6.6/819-v6.8-0004-nvmem-Move-and-rename-fixup_cell_info.patch diff --git a/include/kernel-6.6 b/include/kernel-6.6 index 2e70a47f1d16b2..1c340699471bbe 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .79 -LINUX_KERNEL_HASH-6.6.79 = 07a6f904470da1a099aa1683e3025a999dd82f2438f78b006b80c6ae2e9dfe8d +LINUX_VERSION-6.6 = .80 +LINUX_KERNEL_HASH-6.6.80 = 6cf911d01324f45c9dd2f44cf06f55bda0ecf383bc498f132a0c549768531327 diff --git a/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch b/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch index 51f4f542d8bdc8..91e39d7d24e139 100644 --- a/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch @@ -751,7 +751,7 @@ SVN-Revision: 35130 EXPORT_SYMBOL(xfrm_parse_spi); --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c -@@ -4262,14 +4262,16 @@ static bool tcp_parse_aligned_timestamp( +@@ -4268,14 +4268,16 @@ static bool tcp_parse_aligned_timestamp( { const __be32 *ptr = (const __be32 *)(th + 1); diff --git a/target/linux/bcm27xx/patches-6.6/950-0025-drm-atomic-helpers-remove-legacy_cursor_update-hacks.patch b/target/linux/bcm27xx/patches-6.6/950-0025-drm-atomic-helpers-remove-legacy_cursor_update-hacks.patch index 97bc25b565ef9a..4c3ff50b8cb135 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0025-drm-atomic-helpers-remove-legacy_cursor_update-hacks.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0025-drm-atomic-helpers-remove-legacy_cursor_update-hacks.patch @@ -89,7 +89,7 @@ Signed-off-by: Maxime Ripard commit->event = kzalloc(sizeof(*commit->event), --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c -@@ -7280,6 +7280,19 @@ int intel_atomic_commit(struct drm_devic +@@ -7298,6 +7298,19 @@ int intel_atomic_commit(struct drm_devic state->base.legacy_cursor_update = false; } diff --git a/target/linux/generic/backport-6.6/600-v6.10-net-Remove-conditional-threaded-NAPI-wakeup-based-on.patch b/target/linux/generic/backport-6.6/600-v6.10-net-Remove-conditional-threaded-NAPI-wakeup-based-on.patch index a6164c82389f0d..afaa5328cab7e6 100644 --- a/target/linux/generic/backport-6.6/600-v6.10-net-Remove-conditional-threaded-NAPI-wakeup-based-on.patch +++ b/target/linux/generic/backport-6.6/600-v6.10-net-Remove-conditional-threaded-NAPI-wakeup-based-on.patch @@ -32,7 +32,7 @@ Signed-off-by: Paolo Abeni --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -4483,13 +4483,7 @@ static inline void ____napi_schedule(str +@@ -4514,13 +4514,7 @@ static inline void ____napi_schedule(str */ thread = READ_ONCE(napi->thread); if (thread) { @@ -47,7 +47,7 @@ Signed-off-by: Paolo Abeni wake_up_process(thread); return; } -@@ -6645,8 +6639,6 @@ static int napi_poll(struct napi_struct +@@ -6676,8 +6670,6 @@ static int napi_poll(struct napi_struct static int napi_thread_wait(struct napi_struct *napi) { @@ -56,7 +56,7 @@ Signed-off-by: Paolo Abeni set_current_state(TASK_INTERRUPTIBLE); while (!kthread_should_stop()) { -@@ -6655,15 +6647,13 @@ static int napi_thread_wait(struct napi_ +@@ -6686,15 +6678,13 @@ static int napi_thread_wait(struct napi_ * Testing SCHED bit is not enough because SCHED bit might be * set by some other busy poll thread or by napi_disable(). */ diff --git a/target/linux/generic/backport-6.6/601-v6.10-net-Allow-to-use-SMP-threads-for-backlog-NAPI.patch b/target/linux/generic/backport-6.6/601-v6.10-net-Allow-to-use-SMP-threads-for-backlog-NAPI.patch index 3de258f953460f..98cd35ed843654 100644 --- a/target/linux/generic/backport-6.6/601-v6.10-net-Allow-to-use-SMP-threads-for-backlog-NAPI.patch +++ b/target/linux/generic/backport-6.6/601-v6.10-net-Allow-to-use-SMP-threads-for-backlog-NAPI.patch @@ -108,7 +108,7 @@ Signed-off-by: Paolo Abeni static inline void rps_lock_irqsave(struct softnet_data *sd, unsigned long *flags) { -@@ -4451,6 +4477,7 @@ EXPORT_SYMBOL(__dev_direct_xmit); +@@ -4482,6 +4508,7 @@ EXPORT_SYMBOL(__dev_direct_xmit); /************************************************************************* * Receiver routines *************************************************************************/ @@ -116,7 +116,7 @@ Signed-off-by: Paolo Abeni int netdev_max_backlog __read_mostly = 1000; EXPORT_SYMBOL(netdev_max_backlog); -@@ -4483,12 +4510,16 @@ static inline void ____napi_schedule(str +@@ -4514,12 +4541,16 @@ static inline void ____napi_schedule(str */ thread = READ_ONCE(napi->thread); if (thread) { @@ -133,7 +133,7 @@ Signed-off-by: Paolo Abeni list_add_tail(&napi->poll_list, &sd->poll_list); WRITE_ONCE(napi->list_owner, smp_processor_id()); /* If not called from net_rx_action() -@@ -4734,6 +4765,11 @@ static void napi_schedule_rps(struct sof +@@ -4765,6 +4796,11 @@ static void napi_schedule_rps(struct sof #ifdef CONFIG_RPS if (sd != mysd) { @@ -145,7 +145,7 @@ Signed-off-by: Paolo Abeni sd->rps_ipi_next = mysd->rps_ipi_list; mysd->rps_ipi_list = sd; -@@ -5957,7 +5993,7 @@ static void net_rps_action_and_irq_enabl +@@ -5988,7 +6024,7 @@ static void net_rps_action_and_irq_enabl #ifdef CONFIG_RPS struct softnet_data *remsd = sd->rps_ipi_list; @@ -154,7 +154,7 @@ Signed-off-by: Paolo Abeni sd->rps_ipi_list = NULL; local_irq_enable(); -@@ -5972,7 +6008,7 @@ static void net_rps_action_and_irq_enabl +@@ -6003,7 +6039,7 @@ static void net_rps_action_and_irq_enabl static bool sd_has_rps_ipi_waiting(struct softnet_data *sd) { #ifdef CONFIG_RPS @@ -163,7 +163,7 @@ Signed-off-by: Paolo Abeni #else return false; #endif -@@ -6016,7 +6052,7 @@ static int process_backlog(struct napi_s +@@ -6047,7 +6083,7 @@ 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. */ @@ -172,7 +172,7 @@ Signed-off-by: Paolo Abeni again = false; } else { skb_queue_splice_tail_init(&sd->input_pkt_queue, -@@ -6682,43 +6718,48 @@ static void skb_defer_free_flush(struct +@@ -6713,43 +6749,48 @@ static void skb_defer_free_flush(struct } } @@ -250,7 +250,7 @@ Signed-off-by: Paolo Abeni return 0; } -@@ -11303,7 +11344,7 @@ static int dev_cpu_dead(unsigned int old +@@ -11334,7 +11375,7 @@ static int dev_cpu_dead(unsigned int old list_del_init(&napi->poll_list); if (napi->poll == process_backlog) @@ -259,7 +259,7 @@ Signed-off-by: Paolo Abeni else ____napi_schedule(sd, napi); } -@@ -11311,12 +11352,14 @@ static int dev_cpu_dead(unsigned int old +@@ -11342,12 +11383,14 @@ static int dev_cpu_dead(unsigned int old raise_softirq_irqoff(NET_TX_SOFTIRQ); local_irq_enable(); @@ -278,7 +278,7 @@ Signed-off-by: Paolo Abeni /* Process offline CPU's input_pkt_queue */ while ((skb = __skb_dequeue(&oldsd->process_queue))) { -@@ -11579,6 +11622,38 @@ static struct pernet_operations __net_in +@@ -11610,6 +11653,38 @@ static struct pernet_operations __net_in * */ @@ -317,7 +317,7 @@ Signed-off-by: Paolo Abeni /* * This is called single threaded during boot, so no need * to take the rtnl semaphore. -@@ -11629,7 +11704,10 @@ static int __init net_dev_init(void) +@@ -11660,7 +11735,10 @@ static int __init net_dev_init(void) init_gro_hash(&sd->backlog); sd->backlog.poll = process_backlog; sd->backlog.weight = weight_p; diff --git a/target/linux/generic/backport-6.6/602-v6.10-net-Use-backlog-NAPI-to-clean-up-the-defer_list.patch b/target/linux/generic/backport-6.6/602-v6.10-net-Use-backlog-NAPI-to-clean-up-the-defer_list.patch index 9af345002a10ca..d38231684d30b6 100644 --- a/target/linux/generic/backport-6.6/602-v6.10-net-Use-backlog-NAPI-to-clean-up-the-defer_list.patch +++ b/target/linux/generic/backport-6.6/602-v6.10-net-Use-backlog-NAPI-to-clean-up-the-defer_list.patch @@ -36,7 +36,7 @@ Signed-off-by: Paolo Abeni --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h -@@ -3306,6 +3306,7 @@ static inline void dev_xmit_recursion_de +@@ -3308,6 +3308,7 @@ static inline void dev_xmit_recursion_de __this_cpu_dec(softnet_data.xmit.recursion); } @@ -82,7 +82,7 @@ Signed-off-by: Paolo Abeni spin_unlock_irq(&sd->input_pkt_queue.lock); else if (!IS_ENABLED(CONFIG_PREEMPT_RT)) local_irq_enable(); -@@ -4784,6 +4784,23 @@ static void napi_schedule_rps(struct sof +@@ -4815,6 +4815,23 @@ static void napi_schedule_rps(struct sof __napi_schedule_irqoff(&mysd->backlog); } diff --git a/target/linux/generic/backport-6.6/603-v6.10-net-Rename-rps_lock-to-backlog_lock.patch b/target/linux/generic/backport-6.6/603-v6.10-net-Rename-rps_lock-to-backlog_lock.patch index a6199cd2500efb..33ebe5d2a64540 100644 --- a/target/linux/generic/backport-6.6/603-v6.10-net-Rename-rps_lock-to-backlog_lock.patch +++ b/target/linux/generic/backport-6.6/603-v6.10-net-Rename-rps_lock-to-backlog_lock.patch @@ -67,7 +67,7 @@ Signed-off-by: Paolo Abeni { if (IS_ENABLED(CONFIG_RPS) || use_backlog_threads()) spin_unlock_irq(&sd->input_pkt_queue.lock); -@@ -4789,12 +4789,12 @@ void kick_defer_list_purge(struct softne +@@ -4820,12 +4820,12 @@ void kick_defer_list_purge(struct softne unsigned long flags; if (use_backlog_threads()) { @@ -82,7 +82,7 @@ Signed-off-by: Paolo Abeni } else if (!cmpxchg(&sd->defer_ipi_scheduled, 0, 1)) { smp_call_function_single_async(cpu, &sd->defer_csd); -@@ -4856,7 +4856,7 @@ static int enqueue_to_backlog(struct sk_ +@@ -4887,7 +4887,7 @@ static int enqueue_to_backlog(struct sk_ reason = SKB_DROP_REASON_NOT_SPECIFIED; sd = &per_cpu(softnet_data, cpu); @@ -91,7 +91,7 @@ Signed-off-by: Paolo Abeni if (!netif_running(skb->dev)) goto drop; qlen = skb_queue_len(&sd->input_pkt_queue); -@@ -4865,7 +4865,7 @@ static int enqueue_to_backlog(struct sk_ +@@ -4896,7 +4896,7 @@ static int enqueue_to_backlog(struct sk_ enqueue: __skb_queue_tail(&sd->input_pkt_queue, skb); input_queue_tail_incr_save(sd, qtail); @@ -100,7 +100,7 @@ Signed-off-by: Paolo Abeni return NET_RX_SUCCESS; } -@@ -4880,7 +4880,7 @@ enqueue: +@@ -4911,7 +4911,7 @@ enqueue: drop: sd->dropped++; @@ -109,7 +109,7 @@ Signed-off-by: Paolo Abeni dev_core_stats_rx_dropped_inc(skb->dev); kfree_skb_reason(skb, reason); -@@ -5911,7 +5911,7 @@ static void flush_backlog(struct work_st +@@ -5942,7 +5942,7 @@ static void flush_backlog(struct work_st local_bh_disable(); sd = this_cpu_ptr(&softnet_data); @@ -118,7 +118,7 @@ Signed-off-by: Paolo Abeni skb_queue_walk_safe(&sd->input_pkt_queue, skb, tmp) { if (skb->dev->reg_state == NETREG_UNREGISTERING) { __skb_unlink(skb, &sd->input_pkt_queue); -@@ -5919,7 +5919,7 @@ static void flush_backlog(struct work_st +@@ -5950,7 +5950,7 @@ static void flush_backlog(struct work_st input_queue_head_incr(sd); } } @@ -127,7 +127,7 @@ Signed-off-by: Paolo Abeni skb_queue_walk_safe(&sd->process_queue, skb, tmp) { if (skb->dev->reg_state == NETREG_UNREGISTERING) { -@@ -5937,14 +5937,14 @@ static bool flush_required(int cpu) +@@ -5968,14 +5968,14 @@ static bool flush_required(int cpu) struct softnet_data *sd = &per_cpu(softnet_data, cpu); bool do_flush; @@ -144,7 +144,7 @@ Signed-off-by: Paolo Abeni return do_flush; #endif -@@ -6059,7 +6059,7 @@ static int process_backlog(struct napi_s +@@ -6090,7 +6090,7 @@ static int process_backlog(struct napi_s } @@ -153,7 +153,7 @@ Signed-off-by: Paolo Abeni if (skb_queue_empty(&sd->input_pkt_queue)) { /* * Inline a custom version of __napi_complete(). -@@ -6075,7 +6075,7 @@ static int process_backlog(struct napi_s +@@ -6106,7 +6106,7 @@ static int process_backlog(struct napi_s skb_queue_splice_tail_init(&sd->input_pkt_queue, &sd->process_queue); } diff --git a/target/linux/generic/backport-6.6/611-02-v6.11-net-Make-USO-depend-on-CSUM-offload.patch b/target/linux/generic/backport-6.6/611-02-v6.11-net-Make-USO-depend-on-CSUM-offload.patch index 6cd162ff1cea7d..0ccf0e30d67b9e 100644 --- a/target/linux/generic/backport-6.6/611-02-v6.11-net-Make-USO-depend-on-CSUM-offload.patch +++ b/target/linux/generic/backport-6.6/611-02-v6.11-net-Make-USO-depend-on-CSUM-offload.patch @@ -20,7 +20,7 @@ Signed-off-by: Jakub Kicinski --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -9765,6 +9765,15 @@ static void netdev_sync_lower_features(s +@@ -9796,6 +9796,15 @@ static void netdev_sync_lower_features(s } } @@ -36,7 +36,7 @@ Signed-off-by: Jakub Kicinski static netdev_features_t netdev_fix_features(struct net_device *dev, netdev_features_t features) { -@@ -9846,15 +9855,9 @@ static netdev_features_t netdev_fix_feat +@@ -9877,15 +9886,9 @@ static netdev_features_t netdev_fix_feat features &= ~NETIF_F_LRO; } @@ -55,7 +55,7 @@ Signed-off-by: Jakub Kicinski } if ((features & NETIF_F_HW_TLS_RX) && !(features & NETIF_F_RXCSUM)) { -@@ -9862,6 +9865,11 @@ static netdev_features_t netdev_fix_feat +@@ -9893,6 +9896,11 @@ static netdev_features_t netdev_fix_feat features &= ~NETIF_F_HW_TLS_RX; } diff --git a/target/linux/generic/backport-6.6/612-v6.9-net-get-stats64-if-device-if-driver-is-configured.patch b/target/linux/generic/backport-6.6/612-v6.9-net-get-stats64-if-device-if-driver-is-configured.patch index 21ba0acc5b0ea8..c27ccc19427f28 100644 --- a/target/linux/generic/backport-6.6/612-v6.9-net-get-stats64-if-device-if-driver-is-configured.patch +++ b/target/linux/generic/backport-6.6/612-v6.9-net-get-stats64-if-device-if-driver-is-configured.patch @@ -18,7 +18,7 @@ Signed-off-by: Paolo Abeni --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -10672,6 +10672,8 @@ struct rtnl_link_stats64 *dev_get_stats( +@@ -10703,6 +10703,8 @@ struct rtnl_link_stats64 *dev_get_stats( ops->ndo_get_stats64(dev, storage); } else if (ops->ndo_get_stats) { netdev_stats_to_stats64(storage, ops->ndo_get_stats(dev)); diff --git a/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch b/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch index 8b562a0f61837a..dd0640e2eec2e7 100644 --- a/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch +++ b/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch @@ -37,7 +37,7 @@ Signed-off-by: David S. Miller --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h -@@ -4567,6 +4567,9 @@ static inline void netif_addr_unlock_bh( +@@ -4569,6 +4569,9 @@ static inline void netif_addr_unlock_bh( void ether_setup(struct net_device *dev); @@ -49,7 +49,7 @@ Signed-off-by: David S. Miller unsigned char name_assign_type, --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -10359,25 +10359,12 @@ err_free_name: +@@ -10390,25 +10390,12 @@ err_free_name: } EXPORT_SYMBOL(register_netdevice); @@ -79,7 +79,7 @@ Signed-off-by: David S. Miller /* make sure we BUG if trying to hit standard * register/unregister code path */ -@@ -10397,12 +10384,32 @@ int init_dummy_netdev(struct net_device +@@ -10428,12 +10415,32 @@ int init_dummy_netdev(struct net_device * because users of this 'device' dont need to change * its refcount. */ @@ -113,7 +113,7 @@ Signed-off-by: David S. Miller /** * register_netdev - register a network device * @dev: device to register -@@ -10996,6 +11003,19 @@ void free_netdev(struct net_device *dev) +@@ -11027,6 +11034,19 @@ void free_netdev(struct net_device *dev) EXPORT_SYMBOL(free_netdev); /** diff --git a/target/linux/generic/backport-6.6/770-net-introduce-napi_is_scheduled-helper.patch b/target/linux/generic/backport-6.6/770-net-introduce-napi_is_scheduled-helper.patch index 2bf136e18a3206..319bc3e47bfeb4 100644 --- a/target/linux/generic/backport-6.6/770-net-introduce-napi_is_scheduled-helper.patch +++ b/target/linux/generic/backport-6.6/770-net-introduce-napi_is_scheduled-helper.patch @@ -85,7 +85,7 @@ Signed-off-by: Paolo Abeni /** --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -6612,7 +6612,7 @@ static int __napi_poll(struct napi_struc +@@ -6643,7 +6643,7 @@ static int __napi_poll(struct napi_struc * accidentally calling ->poll() when NAPI is not scheduled. */ work = 0; diff --git a/target/linux/generic/backport-6.6/816-v6.7-0004-Revert-nvmem-add-new-config-option.patch b/target/linux/generic/backport-6.6/816-v6.7-0004-Revert-nvmem-add-new-config-option.patch index 36d15248b8a966..9c22568f72cdb1 100644 --- a/target/linux/generic/backport-6.6/816-v6.7-0004-Revert-nvmem-add-new-config-option.patch +++ b/target/linux/generic/backport-6.6/816-v6.7-0004-Revert-nvmem-add-new-config-option.patch @@ -48,7 +48,7 @@ Signed-off-by: Greg Kroah-Hartman mtd->nvmem = nvmem_register(&config); --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c -@@ -940,7 +940,7 @@ struct nvmem_device *nvmem_register(cons +@@ -918,7 +918,7 @@ struct nvmem_device *nvmem_register(cons nvmem->nkeepout = config->nkeepout; if (config->of_node) nvmem->dev.of_node = config->of_node; @@ -59,7 +59,7 @@ Signed-off-by: Greg Kroah-Hartman switch (config->id) { --- a/include/linux/nvmem-provider.h +++ b/include/linux/nvmem-provider.h -@@ -89,7 +89,6 @@ struct nvmem_cell_info { +@@ -91,7 +91,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. @@ -67,7 +67,7 @@ Signed-off-by: Greg Kroah-Hartman * @reg_read: Callback to read data. * @reg_write: Callback to write data. * @size: Device size. -@@ -122,7 +121,6 @@ struct nvmem_config { +@@ -126,7 +125,6 @@ struct nvmem_config { bool ignore_wp; struct nvmem_layout *layout; struct device_node *of_node; diff --git a/target/linux/generic/backport-6.6/819-v6.8-0001-nvmem-Move-of_nvmem_layout_get_container-in-another-.patch b/target/linux/generic/backport-6.6/819-v6.8-0001-nvmem-Move-of_nvmem_layout_get_container-in-another-.patch index 0290d648984b13..c1f5ecf6651ffc 100644 --- a/target/linux/generic/backport-6.6/819-v6.8-0001-nvmem-Move-of_nvmem_layout_get_container-in-another-.patch +++ b/target/linux/generic/backport-6.6/819-v6.8-0001-nvmem-Move-of_nvmem_layout_get_container-in-another-.patch @@ -25,7 +25,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c -@@ -846,14 +846,6 @@ static int nvmem_add_cells_from_layout(s +@@ -823,14 +823,6 @@ static int nvmem_add_cells_from_layout(s } #if IS_ENABLED(CONFIG_OF) @@ -65,7 +65,7 @@ Signed-off-by: Greg Kroah-Hartman #endif /* ifndef _LINUX_NVMEM_CONSUMER_H */ --- a/include/linux/nvmem-provider.h +++ b/include/linux/nvmem-provider.h -@@ -244,6 +244,27 @@ nvmem_layout_get_match_data(struct nvmem +@@ -241,6 +241,27 @@ nvmem_layout_get_match_data(struct nvmem #endif /* CONFIG_NVMEM */ diff --git a/target/linux/generic/backport-6.6/819-v6.8-0002-nvmem-Create-a-header-for-internal-sharing.patch b/target/linux/generic/backport-6.6/819-v6.8-0002-nvmem-Create-a-header-for-internal-sharing.patch deleted file mode 100644 index b03ce680927573..00000000000000 --- a/target/linux/generic/backport-6.6/819-v6.8-0002-nvmem-Create-a-header-for-internal-sharing.patch +++ /dev/null @@ -1,91 +0,0 @@ -From ec9c08a1cb8dc5e8e003f95f5f62de41dde235bb Mon Sep 17 00:00:00 2001 -From: Miquel Raynal -Date: Fri, 15 Dec 2023 11:15:29 +0000 -Subject: [PATCH] nvmem: Create a header for internal sharing - -Before adding all the NVMEM layout bus infrastructure to the core, let's -move the main nvmem_device structure in an internal header, only -available to the core. This way all the additional code can be added in -a dedicated file in order to keep the current core file tidy. - -Signed-off-by: Miquel Raynal -Signed-off-by: Srinivas Kandagatla -Link: https://lore.kernel.org/r/20231215111536.316972-4-srinivas.kandagatla@linaro.org -Signed-off-by: Greg Kroah-Hartman ---- - drivers/nvmem/core.c | 24 +----------------------- - drivers/nvmem/internals.h | 35 +++++++++++++++++++++++++++++++++++ - 2 files changed, 36 insertions(+), 23 deletions(-) - create mode 100644 drivers/nvmem/internals.h - ---- a/drivers/nvmem/core.c -+++ b/drivers/nvmem/core.c -@@ -19,29 +19,7 @@ - #include - #include - --struct nvmem_device { -- struct module *owner; -- struct device dev; -- int stride; -- int word_size; -- int id; -- struct kref refcnt; -- size_t size; -- bool read_only; -- bool root_only; -- int flags; -- enum nvmem_type type; -- struct bin_attribute eeprom; -- struct device *base_dev; -- struct list_head cells; -- const struct nvmem_keepout *keepout; -- unsigned int nkeepout; -- nvmem_reg_read_t reg_read; -- nvmem_reg_write_t reg_write; -- struct gpio_desc *wp_gpio; -- struct nvmem_layout *layout; -- void *priv; --}; -+#include "internals.h" - - #define to_nvmem_device(d) container_of(d, struct nvmem_device, dev) - ---- /dev/null -+++ b/drivers/nvmem/internals.h -@@ -0,0 +1,35 @@ -+/* SPDX-License-Identifier: GPL-2.0 */ -+ -+#ifndef _LINUX_NVMEM_INTERNALS_H -+#define _LINUX_NVMEM_INTERNALS_H -+ -+#include -+#include -+#include -+ -+struct nvmem_device { -+ struct module *owner; -+ struct device dev; -+ struct list_head node; -+ int stride; -+ int word_size; -+ int id; -+ struct kref refcnt; -+ size_t size; -+ bool read_only; -+ bool root_only; -+ int flags; -+ enum nvmem_type type; -+ struct bin_attribute eeprom; -+ struct device *base_dev; -+ struct list_head cells; -+ const struct nvmem_keepout *keepout; -+ unsigned int nkeepout; -+ nvmem_reg_read_t reg_read; -+ nvmem_reg_write_t reg_write; -+ struct gpio_desc *wp_gpio; -+ struct nvmem_layout *layout; -+ void *priv; -+}; -+ -+#endif /* ifndef _LINUX_NVMEM_INTERNALS_H */ diff --git a/target/linux/generic/backport-6.6/819-v6.8-0003-nvmem-Simplify-the-add_cells-hook.patch b/target/linux/generic/backport-6.6/819-v6.8-0003-nvmem-Simplify-the-add_cells-hook.patch deleted file mode 100644 index dac691e117af03..00000000000000 --- a/target/linux/generic/backport-6.6/819-v6.8-0003-nvmem-Simplify-the-add_cells-hook.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 1b7c298a4ecbc28cc6ee94005734bff55eb83d22 Mon Sep 17 00:00:00 2001 -From: Miquel Raynal -Date: Fri, 15 Dec 2023 11:15:30 +0000 -Subject: [PATCH] nvmem: Simplify the ->add_cells() hook - -The layout entry is not used and will anyway be made useless by the new -layout bus infrastructure coming next, so drop it. While at it, clarify -the kdoc entry. - -Signed-off-by: Miquel Raynal -Signed-off-by: Srinivas Kandagatla -Link: https://lore.kernel.org/r/20231215111536.316972-5-srinivas.kandagatla@linaro.org -Signed-off-by: Greg Kroah-Hartman ---- - drivers/nvmem/core.c | 2 +- - drivers/nvmem/layouts/onie-tlv.c | 3 +-- - drivers/nvmem/layouts/sl28vpd.c | 3 +-- - include/linux/nvmem-provider.h | 8 +++----- - 4 files changed, 6 insertions(+), 10 deletions(-) - ---- a/drivers/nvmem/core.c -+++ b/drivers/nvmem/core.c -@@ -815,7 +815,7 @@ static int nvmem_add_cells_from_layout(s - int ret; - - if (layout && layout->add_cells) { -- ret = layout->add_cells(&nvmem->dev, nvmem, layout); -+ ret = layout->add_cells(&nvmem->dev, nvmem); - if (ret) - return ret; - } ---- a/drivers/nvmem/layouts/onie-tlv.c -+++ b/drivers/nvmem/layouts/onie-tlv.c -@@ -182,8 +182,7 @@ static bool onie_tlv_crc_is_valid(struct - return true; - } - --static int onie_tlv_parse_table(struct device *dev, struct nvmem_device *nvmem, -- struct nvmem_layout *layout) -+static int onie_tlv_parse_table(struct device *dev, struct nvmem_device *nvmem) - { - struct onie_tlv_hdr hdr; - size_t table_len, data_len, hdr_len; ---- a/drivers/nvmem/layouts/sl28vpd.c -+++ b/drivers/nvmem/layouts/sl28vpd.c -@@ -80,8 +80,7 @@ static int sl28vpd_v1_check_crc(struct d - return 0; - } - --static int sl28vpd_add_cells(struct device *dev, struct nvmem_device *nvmem, -- struct nvmem_layout *layout) -+static int sl28vpd_add_cells(struct device *dev, struct nvmem_device *nvmem) - { - const struct nvmem_cell_info *pinfo; - struct nvmem_cell_info info = {0}; ---- a/include/linux/nvmem-provider.h -+++ b/include/linux/nvmem-provider.h -@@ -156,9 +156,8 @@ struct nvmem_cell_table { - * - * @name: Layout name. - * @of_match_table: Open firmware match table. -- * @add_cells: Will be called if a nvmem device is found which -- * has this layout. The function will add layout -- * specific cells with nvmem_add_one_cell(). -+ * @add_cells: Called to populate the layout using -+ * nvmem_add_one_cell(). - * @fixup_cell_info: Will be called before a cell is added. Can be - * used to modify the nvmem_cell_info. - * @owner: Pointer to struct module. -@@ -172,8 +171,7 @@ struct nvmem_cell_table { - struct nvmem_layout { - const char *name; - const struct of_device_id *of_match_table; -- int (*add_cells)(struct device *dev, struct nvmem_device *nvmem, -- struct nvmem_layout *layout); -+ int (*add_cells)(struct device *dev, struct nvmem_device *nvmem); - void (*fixup_cell_info)(struct nvmem_device *nvmem, - struct nvmem_layout *layout, - struct nvmem_cell_info *cell); diff --git a/target/linux/generic/backport-6.6/819-v6.8-0004-nvmem-Move-and-rename-fixup_cell_info.patch b/target/linux/generic/backport-6.6/819-v6.8-0004-nvmem-Move-and-rename-fixup_cell_info.patch deleted file mode 100644 index 0a614fc13dd884..00000000000000 --- a/target/linux/generic/backport-6.6/819-v6.8-0004-nvmem-Move-and-rename-fixup_cell_info.patch +++ /dev/null @@ -1,169 +0,0 @@ -From 1172460e716784ac7e1049a537bdca8edbf97360 Mon Sep 17 00:00:00 2001 -From: Miquel Raynal -Date: Fri, 15 Dec 2023 11:15:31 +0000 -Subject: [PATCH] nvmem: Move and rename ->fixup_cell_info() - -This hook is meant to be used by any provider and instantiating a layout -just for this is useless. Let's instead move this hook to the nvmem -device and add it to the config structure to be easily shared by the -providers. - -While at moving this hook, rename it ->fixup_dt_cell_info() to clarify -its main intended purpose. - -Signed-off-by: Miquel Raynal -Signed-off-by: Srinivas Kandagatla -Link: https://lore.kernel.org/r/20231215111536.316972-6-srinivas.kandagatla@linaro.org -Signed-off-by: Greg Kroah-Hartman ---- - drivers/nvmem/core.c | 6 +++--- - drivers/nvmem/imx-ocotp.c | 11 +++-------- - drivers/nvmem/internals.h | 2 ++ - drivers/nvmem/mtk-efuse.c | 11 +++-------- - include/linux/nvmem-provider.h | 9 ++++----- - 5 files changed, 15 insertions(+), 24 deletions(-) - ---- a/drivers/nvmem/core.c -+++ b/drivers/nvmem/core.c -@@ -674,7 +674,6 @@ static int nvmem_validate_keepouts(struc - - 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; - struct device_node *child; - const __be32 *addr; -@@ -704,8 +703,8 @@ static int nvmem_add_cells_from_dt(struc - - info.np = of_node_get(child); - -- if (layout && layout->fixup_cell_info) -- layout->fixup_cell_info(nvmem, layout, &info); -+ if (nvmem->fixup_dt_cell_info) -+ nvmem->fixup_dt_cell_info(nvmem, &info); - - ret = nvmem_add_one_cell(nvmem, &info); - kfree(info.name); -@@ -894,6 +893,7 @@ struct nvmem_device *nvmem_register(cons - - kref_init(&nvmem->refcnt); - INIT_LIST_HEAD(&nvmem->cells); -+ nvmem->fixup_dt_cell_info = config->fixup_dt_cell_info; - - nvmem->owner = config->owner; - if (!nvmem->owner && config->dev->driver) ---- a/drivers/nvmem/imx-ocotp.c -+++ b/drivers/nvmem/imx-ocotp.c -@@ -583,17 +583,12 @@ static const struct of_device_id imx_oco - }; - MODULE_DEVICE_TABLE(of, imx_ocotp_dt_ids); - --static void imx_ocotp_fixup_cell_info(struct nvmem_device *nvmem, -- struct nvmem_layout *layout, -- struct nvmem_cell_info *cell) -+static void imx_ocotp_fixup_dt_cell_info(struct nvmem_device *nvmem, -+ struct nvmem_cell_info *cell) - { - cell->read_post_process = imx_ocotp_cell_pp; - } - --static struct nvmem_layout imx_ocotp_layout = { -- .fixup_cell_info = imx_ocotp_fixup_cell_info, --}; -- - static int imx_ocotp_probe(struct platform_device *pdev) - { - struct device *dev = &pdev->dev; -@@ -619,7 +614,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; -- imx_ocotp_nvmem_config.layout = &imx_ocotp_layout; -+ imx_ocotp_nvmem_config.fixup_dt_cell_info = &imx_ocotp_fixup_dt_cell_info; - - priv->config = &imx_ocotp_nvmem_config; - ---- a/drivers/nvmem/internals.h -+++ b/drivers/nvmem/internals.h -@@ -23,6 +23,8 @@ struct nvmem_device { - struct bin_attribute eeprom; - struct device *base_dev; - struct list_head cells; -+ void (*fixup_dt_cell_info)(struct nvmem_device *nvmem, -+ struct nvmem_cell_info *cell); - const struct nvmem_keepout *keepout; - unsigned int nkeepout; - nvmem_reg_read_t reg_read; ---- a/drivers/nvmem/mtk-efuse.c -+++ b/drivers/nvmem/mtk-efuse.c -@@ -45,9 +45,8 @@ static int mtk_efuse_gpu_speedbin_pp(voi - return 0; - } - --static void mtk_efuse_fixup_cell_info(struct nvmem_device *nvmem, -- struct nvmem_layout *layout, -- struct nvmem_cell_info *cell) -+static void mtk_efuse_fixup_dt_cell_info(struct nvmem_device *nvmem, -+ struct nvmem_cell_info *cell) - { - size_t sz = strlen(cell->name); - -@@ -61,10 +60,6 @@ static void mtk_efuse_fixup_cell_info(st - cell->read_post_process = mtk_efuse_gpu_speedbin_pp; - } - --static struct nvmem_layout mtk_efuse_layout = { -- .fixup_cell_info = mtk_efuse_fixup_cell_info, --}; -- - static int mtk_efuse_probe(struct platform_device *pdev) - { - struct device *dev = &pdev->dev; -@@ -91,7 +86,7 @@ static int mtk_efuse_probe(struct platfo - econfig.priv = priv; - econfig.dev = dev; - if (pdata->uses_post_processing) -- econfig.layout = &mtk_efuse_layout; -+ econfig.fixup_dt_cell_info = &mtk_efuse_fixup_dt_cell_info; - nvmem = devm_nvmem_register(dev, &econfig); - - return PTR_ERR_OR_ZERO(nvmem); ---- a/include/linux/nvmem-provider.h -+++ b/include/linux/nvmem-provider.h -@@ -83,6 +83,8 @@ struct nvmem_cell_info { - * @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. -+ * @fixup_dt_cell_info: Will be called before a cell is added. Can be -+ * used to modify the nvmem_cell_info. - * @keepout: Optional array of keepout ranges (sorted ascending by start). - * @nkeepout: Number of elements in the keepout array. - * @type: Type of the nvmem storage -@@ -113,6 +115,8 @@ struct nvmem_config { - const struct nvmem_cell_info *cells; - int ncells; - bool add_legacy_fixed_of_cells; -+ void (*fixup_dt_cell_info)(struct nvmem_device *nvmem, -+ struct nvmem_cell_info *cell); - const struct nvmem_keepout *keepout; - unsigned int nkeepout; - enum nvmem_type type; -@@ -158,8 +162,6 @@ struct nvmem_cell_table { - * @of_match_table: Open firmware match table. - * @add_cells: Called to populate the layout using - * nvmem_add_one_cell(). -- * @fixup_cell_info: Will be called before a cell is added. Can be -- * used to modify the nvmem_cell_info. - * @owner: Pointer to struct module. - * @node: List node. - * -@@ -172,9 +174,6 @@ struct nvmem_layout { - const char *name; - const struct of_device_id *of_match_table; - int (*add_cells)(struct device *dev, struct nvmem_device *nvmem); -- void (*fixup_cell_info)(struct nvmem_device *nvmem, -- struct nvmem_layout *layout, -- struct nvmem_cell_info *cell); - - /* private */ - struct module *owner; diff --git a/target/linux/generic/backport-6.6/823-v6.12-0001-nvmem-imx-ocotp-ele-support-i.MX95.patch b/target/linux/generic/backport-6.6/823-v6.12-0001-nvmem-imx-ocotp-ele-support-i.MX95.patch index b96134e3150359..de965e1ccdc689 100644 --- a/target/linux/generic/backport-6.6/823-v6.12-0001-nvmem-imx-ocotp-ele-support-i.MX95.patch +++ b/target/linux/generic/backport-6.6/823-v6.12-0001-nvmem-imx-ocotp-ele-support-i.MX95.patch @@ -40,7 +40,7 @@ Signed-off-by: Greg Kroah-Hartman } memcpy(val, ((u8 *)p) + skipbytes, bytes); -@@ -157,8 +161,30 @@ static const struct ocotp_devtype_data i +@@ -179,8 +183,30 @@ static const struct ocotp_devtype_data i }, }; diff --git a/target/linux/generic/backport-6.6/900-v6.11-net-free_netdev-exit-earlier-if-dummy.patch b/target/linux/generic/backport-6.6/900-v6.11-net-free_netdev-exit-earlier-if-dummy.patch index b3a592f078119d..8f63a7a0df533a 100644 --- a/target/linux/generic/backport-6.6/900-v6.11-net-free_netdev-exit-earlier-if-dummy.patch +++ b/target/linux/generic/backport-6.6/900-v6.11-net-free_netdev-exit-earlier-if-dummy.patch @@ -23,7 +23,7 @@ Signed-off-by: David S. Miller --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -10989,7 +10989,8 @@ void free_netdev(struct net_device *dev) +@@ -11020,7 +11020,8 @@ void free_netdev(struct net_device *dev) dev->xdp_bulkq = NULL; /* Compatibility with error handling in drivers */ diff --git a/target/linux/generic/hack-6.6/721-net-add-packet-mangeling.patch b/target/linux/generic/hack-6.6/721-net-add-packet-mangeling.patch index e1d4367a8f5493..0935a0b9c0aea6 100644 --- a/target/linux/generic/hack-6.6/721-net-add-packet-mangeling.patch +++ b/target/linux/generic/hack-6.6/721-net-add-packet-mangeling.patch @@ -105,7 +105,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, +@@ -3628,6 +3628,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-6.6/680-net-add-TCP-fraglist-GRO-support.patch b/target/linux/generic/pending-6.6/680-net-add-TCP-fraglist-GRO-support.patch index b810e7ec91a48d..ca7c624447eb82 100644 --- a/target/linux/generic/pending-6.6/680-net-add-TCP-fraglist-GRO-support.patch +++ b/target/linux/generic/pending-6.6/680-net-add-TCP-fraglist-GRO-support.patch @@ -31,7 +31,7 @@ Signe-off-by: Felix Fietkau static inline void gro_normal_list(struct napi_struct *napi) --- a/include/net/tcp.h +++ b/include/net/tcp.h -@@ -2084,7 +2084,10 @@ void tcp_v4_destroy_sock(struct sock *sk +@@ -2101,7 +2101,10 @@ void tcp_v4_destroy_sock(struct sock *sk struct sk_buff *tcp_gso_segment(struct sk_buff *skb, netdev_features_t features); diff --git a/target/linux/ipq40xx/patches-6.6/004-v6.7-firmware-qcom_scm-disable-SDI-if-required.patch b/target/linux/ipq40xx/patches-6.6/004-v6.7-firmware-qcom_scm-disable-SDI-if-required.patch index 9df758ae1b35a8..747ba7f285005f 100644 --- a/target/linux/ipq40xx/patches-6.6/004-v6.7-firmware-qcom_scm-disable-SDI-if-required.patch +++ b/target/linux/ipq40xx/patches-6.6/004-v6.7-firmware-qcom_scm-disable-SDI-if-required.patch @@ -57,7 +57,7 @@ Signed-off-by: Bjorn Andersson static int __qcom_scm_set_dload_mode(struct device *dev, bool enable) { struct qcom_scm_desc desc = { -@@ -1473,6 +1496,13 @@ static int qcom_scm_probe(struct platfor +@@ -1474,6 +1497,13 @@ static int qcom_scm_probe(struct platfor __get_convention(); diff --git a/target/linux/ipq40xx/patches-6.6/910-Revert-firmware-qcom_scm-Clear-download-bit-during-r.patch b/target/linux/ipq40xx/patches-6.6/910-Revert-firmware-qcom_scm-Clear-download-bit-during-r.patch index 26cd0e0309b316..ab56c24a4d1c30 100644 --- a/target/linux/ipq40xx/patches-6.6/910-Revert-firmware-qcom_scm-Clear-download-bit-during-r.patch +++ b/target/linux/ipq40xx/patches-6.6/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 -@@ -1528,7 +1528,8 @@ static int qcom_scm_probe(struct platfor +@@ -1529,7 +1529,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/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch b/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch index 56b638aa3632ba..916f08ac5d73c7 100644 --- a/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch +++ b/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch @@ -234,7 +234,7 @@ Signed-off-by: John Crispin /* Format flags */ #define UVC_FMT_FLAG_COMPRESSED 0x00000001 -@@ -587,6 +589,7 @@ struct uvc_device { +@@ -591,6 +593,7 @@ struct uvc_device { struct input_dev *input; char input_phys[64]; From 0fb8d7bc731a96beb1201ba6c6fd13909d50cc36 Mon Sep 17 00:00:00 2001 From: John Audia Date: Fri, 7 Mar 2025 15:17:22 -0500 Subject: [PATCH 560/877] kernel: bump 6.6 to 6.6.81 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.81 All patches automatically rebased. For x86, CONFIG_MICROCODE_LATE_FORCE_MINREV was introduced in this bump with hrecommendation to enable it[1]. 1. https://web.git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/diff/arch/x86/Kconfig?id=v6.6.81&id2=v6.6.80 Build system: x86/64 Build-tested: bcm27xx/bcm2712, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Run-tested: bcm27xx/bcm2712, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/18188 (cherry picked from commit aabc61d93f89bf3253bad98fd2fe8d5450c352bf) Link: https://github.com/openwrt/openwrt/pull/18208 Signed-off-by: Hauke Mehrtens --- include/kernel-6.6 | 4 ++-- ...all-the-downstream-rpi-sound-card-dr.patch | 2 +- ...-net-macb-Also-set-DMA-coherent-mask.patch | 24 +++++++++---------- ...port-for-Raspberry-Pi-RP1-ethernet-c.patch | 4 ++-- ...-rockchip-Fix-typo-in-function-names.patch | 2 +- target/linux/x86/config-6.6 | 1 + 6 files changed, 19 insertions(+), 18 deletions(-) diff --git a/include/kernel-6.6 b/include/kernel-6.6 index 1c340699471bbe..c5c29a5aadf067 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .80 -LINUX_KERNEL_HASH-6.6.80 = 6cf911d01324f45c9dd2f44cf06f55bda0ecf383bc498f132a0c549768531327 +LINUX_VERSION-6.6 = .81 +LINUX_KERNEL_HASH-6.6.81 = af483828e67f1b9918bc438d789cdbb06c13a4d43a41d5f35d44c9a6d620318f diff --git a/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch b/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch index 1d2f0062582719..56712a2b48d320 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch @@ -17583,7 +17583,7 @@ Signed-off-by: Phil Elwell * For devices with more than one control interface, we assume the --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c -@@ -2253,6 +2253,8 @@ static const struct usb_audio_quirk_flag +@@ -2254,6 +2254,8 @@ static const struct usb_audio_quirk_flag QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x534d, 0x2109, /* MacroSilicon MS2109 */ QUIRK_FLAG_ALIGN_TRANSFER), diff --git a/target/linux/bcm27xx/patches-6.6/950-0518-net-macb-Also-set-DMA-coherent-mask.patch b/target/linux/bcm27xx/patches-6.6/950-0518-net-macb-Also-set-DMA-coherent-mask.patch index cbfab3e4e6c12d..9882230654470d 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0518-net-macb-Also-set-DMA-coherent-mask.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0518-net-macb-Also-set-DMA-coherent-mask.patch @@ -134,7 +134,7 @@ Signed-off-by: Jonathan Bell struct napi_struct napi_tx; dma_addr_t rx_ring_dma; -@@ -1285,9 +1304,15 @@ struct macb { +@@ -1287,9 +1306,15 @@ struct macb { u32 caps; unsigned int dma_burst_length; @@ -222,7 +222,7 @@ Signed-off-by: Jonathan Bell wmb(); // ensure softirq can see update } -@@ -2402,6 +2425,11 @@ static netdev_tx_t macb_start_xmit(struc +@@ -2404,6 +2427,11 @@ static netdev_tx_t macb_start_xmit(struc skb_tx_timestamp(skb); spin_lock_irq(&bp->lock); @@ -234,7 +234,7 @@ Signed-off-by: Jonathan Bell macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(TSTART)); spin_unlock_irq(&bp->lock); -@@ -2776,6 +2804,37 @@ static void macb_configure_dma(struct ma +@@ -2778,6 +2806,37 @@ static void macb_configure_dma(struct ma } } @@ -272,7 +272,7 @@ Signed-off-by: Jonathan Bell static void macb_init_hw(struct macb *bp) { u32 config; -@@ -2804,6 +2863,11 @@ static void macb_init_hw(struct macb *bp +@@ -2806,6 +2865,11 @@ static void macb_init_hw(struct macb *bp if (bp->caps & MACB_CAPS_JUMBO) bp->rx_frm_len_mask = MACB_RX_JFRMLEN_MASK; @@ -284,7 +284,7 @@ Signed-off-by: Jonathan Bell macb_configure_dma(bp); /* Enable RX partial store and forward and set watermark */ -@@ -3165,6 +3229,52 @@ static void gem_get_ethtool_strings(stru +@@ -3170,6 +3234,52 @@ static void gem_get_ethtool_strings(stru } } @@ -337,7 +337,7 @@ Signed-off-by: Jonathan Bell static struct net_device_stats *macb_get_stats(struct net_device *dev) { struct macb *bp = netdev_priv(dev); -@@ -3757,6 +3867,8 @@ static const struct ethtool_ops macb_eth +@@ -3764,6 +3874,8 @@ static const struct ethtool_ops macb_eth }; static const struct ethtool_ops gem_ethtool_ops = { @@ -346,7 +346,7 @@ Signed-off-by: Jonathan Bell .get_regs_len = macb_get_regs_len, .get_regs = macb_get_regs, .get_wol = macb_get_wol, -@@ -3766,6 +3878,8 @@ static const struct ethtool_ops gem_etht +@@ -3773,6 +3885,8 @@ static const struct ethtool_ops gem_etht .get_ethtool_stats = gem_get_ethtool_stats, .get_strings = gem_get_ethtool_strings, .get_sset_count = gem_get_sset_count, @@ -355,7 +355,7 @@ Signed-off-by: Jonathan Bell .get_link_ksettings = macb_get_link_ksettings, .set_link_ksettings = macb_set_link_ksettings, .get_ringparam = macb_get_ringparam, -@@ -5062,6 +5176,11 @@ static int macb_probe(struct platform_de +@@ -5069,6 +5183,11 @@ static int macb_probe(struct platform_de } } } @@ -365,9 +365,9 @@ Signed-off-by: Jonathan Bell + bp->use_aw2b_fill = device_property_read_bool(&pdev->dev, "cdns,use-aw2b-fill"); + spin_lock_init(&bp->lock); + spin_lock_init(&bp->stats_lock); - /* setup capabilities */ -@@ -5117,6 +5236,21 @@ static int macb_probe(struct platform_de +@@ -5125,6 +5244,21 @@ static int macb_probe(struct platform_de else bp->phy_interface = interface; @@ -389,7 +389,7 @@ Signed-off-by: Jonathan Bell /* IP specific init */ err = init(pdev); if (err) -@@ -5193,6 +5327,19 @@ static int macb_remove(struct platform_d +@@ -5201,6 +5335,19 @@ static int macb_remove(struct platform_d return 0; } @@ -409,7 +409,7 @@ Signed-off-by: Jonathan Bell static int __maybe_unused macb_suspend(struct device *dev) { struct net_device *netdev = dev_get_drvdata(dev); -@@ -5407,6 +5554,7 @@ static const struct dev_pm_ops macb_pm_o +@@ -5415,6 +5562,7 @@ static const struct dev_pm_ops macb_pm_o static struct platform_driver macb_driver = { .probe = macb_probe, .remove = macb_remove, diff --git a/target/linux/bcm27xx/patches-6.6/950-1423-net-macb-Add-support-for-Raspberry-Pi-RP1-ethernet-c.patch b/target/linux/bcm27xx/patches-6.6/950-1423-net-macb-Add-support-for-Raspberry-Pi-RP1-ethernet-c.patch index 6a9b7b36bd4075..c34d1c87203538 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1423-net-macb-Add-support-for-Raspberry-Pi-RP1-ethernet-c.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1423-net-macb-Add-support-for-Raspberry-Pi-RP1-ethernet-c.patch @@ -15,7 +15,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c -@@ -5023,6 +5023,17 @@ static const struct macb_config versal_c +@@ -5030,6 +5030,17 @@ static const struct macb_config versal_c .usrio = &macb_default_usrio, }; @@ -33,7 +33,7 @@ Signed-off-by: Dave Stevenson static const struct of_device_id macb_dt_ids[] = { { .compatible = "cdns,at91sam9260-macb", .data = &at91sam9260_config }, { .compatible = "cdns,macb" }, -@@ -5043,6 +5054,7 @@ static const struct of_device_id macb_dt +@@ -5050,6 +5061,7 @@ static const struct of_device_id macb_dt { .compatible = "microchip,mpfs-macb", .data = &mpfs_config }, { .compatible = "microchip,sama7g5-gem", .data = &sama7g5_gem_config }, { .compatible = "microchip,sama7g5-emac", .data = &sama7g5_emac_config }, diff --git a/target/linux/rockchip/patches-6.6/032-04-v6.10-phy-rockchip-Fix-typo-in-function-names.patch b/target/linux/rockchip/patches-6.6/032-04-v6.10-phy-rockchip-Fix-typo-in-function-names.patch index 9495dd2b108839..08620d66ecfd4c 100644 --- a/target/linux/rockchip/patches-6.6/032-04-v6.10-phy-rockchip-Fix-typo-in-function-names.patch +++ b/target/linux/rockchip/patches-6.6/032-04-v6.10-phy-rockchip-Fix-typo-in-function-names.patch @@ -26,7 +26,7 @@ Signed-off-by: Vinod Koul .init = rockchip_combphy_init, .exit = rockchip_combphy_exit, .owner = THIS_MODULE, -@@ -364,7 +364,7 @@ static int rockchip_combphy_probe(struct +@@ -367,7 +367,7 @@ static int rockchip_combphy_probe(struct return ret; } diff --git a/target/linux/x86/config-6.6 b/target/linux/x86/config-6.6 index c416bb6a08dd7b..ad7333425328c6 100644 --- a/target/linux/x86/config-6.6 +++ b/target/linux/x86/config-6.6 @@ -239,6 +239,7 @@ CONFIG_M686=y # CONFIG_MGEODEGX1 is not set # CONFIG_MGEODE_LX is not set CONFIG_MICROCODE=y +CONFIG_MICROCODE_LATE_FORCE_MINREV=y CONFIG_MICROCODE_LATE_LOADING=y CONFIG_MIGRATION=y CONFIG_MITIGATION_RFDS=y From 24db6154502a823c6c5bce6b790d2de85404888f Mon Sep 17 00:00:00 2001 From: John Audia Date: Sun, 9 Mar 2025 06:18:32 -0400 Subject: [PATCH 561/877] kernel: bump 6.6 to 6.6.82 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.82 All patches automatically rebased. Added CONFIG_MICROCODE_INITRD32=y to x86: config-6.6[1] 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/diff/arch/x86/Kconfig?id=v6.6.82&id2=v6.6.81 Build system: x86/64 Build-tested: bcm27xx/bcm2712 Run-tested: bcm27xx/bcm2712 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/18188 (cherry picked from commit 7cf8f61eb24c32bb47925cbd11f1cde68c9ba0b9) Link: https://github.com/openwrt/openwrt/pull/18208 Signed-off-by: Hauke Mehrtens --- include/kernel-6.6 | 4 ++-- target/linux/x86/config-6.6 | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/kernel-6.6 b/include/kernel-6.6 index c5c29a5aadf067..7502edfd628785 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .81 -LINUX_KERNEL_HASH-6.6.81 = af483828e67f1b9918bc438d789cdbb06c13a4d43a41d5f35d44c9a6d620318f +LINUX_VERSION-6.6 = .82 +LINUX_KERNEL_HASH-6.6.82 = f3c2389b8c23cabe747f104a3e434201ca6e7725bbbfb3a8c59a063ac4820e41 diff --git a/target/linux/x86/config-6.6 b/target/linux/x86/config-6.6 index ad7333425328c6..2b6ab88dc3e92f 100644 --- a/target/linux/x86/config-6.6 +++ b/target/linux/x86/config-6.6 @@ -239,6 +239,7 @@ CONFIG_M686=y # CONFIG_MGEODEGX1 is not set # CONFIG_MGEODE_LX is not set CONFIG_MICROCODE=y +CONFIG_MICROCODE_INITRD32=y CONFIG_MICROCODE_LATE_FORCE_MINREV=y CONFIG_MICROCODE_LATE_LOADING=y CONFIG_MIGRATION=y From a3213ab1b58b42d6288258e26f36e632e5de0ebc Mon Sep 17 00:00:00 2001 From: John Audia Date: Thu, 13 Mar 2025 16:47:09 -0400 Subject: [PATCH 562/877] kernel: bump 6.6 to 6.6.83 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.83 Removed upstreamed: bcm27xx/patches-6.6/950-0483-usb-xhci-borrow-upstream-TRB_FETCH-quirk-on-VL805-ho.patch[1] Manually rebased: bcm27xx/patches-6.6/950-0061-Revert-Revert-xhci-add-quirk-for-host-controllers-th.patch bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch All other patches automatically rebased. 1. https://web.git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/drivers/usb/host/xhci-pci.c?h=linux-6.6.y&id=c401b1b4b835d66792e884b76264d742a20d931d Build system: x86/64 Build-tested: x86/64 Run-tested: x86/64 Signed-off-by: John Audia [fixed issues with bcm27xx patches] Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 748682e8556d27d904d3fe363228e16eff47afd9) --- include/kernel-6.6 | 4 +-- ...12-net-dsa-mt7530-Add-EN7581-support.patch | 4 +-- .../900-unaligned_access_hacks.patch | 6 ++-- ...ci-add-quirk-for-host-controllers-th.patch | 12 +++---- ...-quirks-add-link-TRB-quirk-for-VL805.patch | 4 +-- ...upstream-TRB_FETCH-quirk-on-VL805-ho.patch | 32 ------------------- ...b-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch | 4 +-- ...5-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch | 10 +++--- ...wc3-Set-DMA-and-coherent-masks-early.patch | 20 ++++++------ ...-add-FS-LS-bus-instance-parkmode-dis.patch | 4 +-- ...d-support-for-setting-NAK-enhancemen.patch | 4 +-- ...ansmit-from-devices-with-no-checksum.patch | 2 +- ...3x-remove-mt753x_phylink_pcs_link_up.patch | 4 +-- ...lways-trap-frames-to-active-CPU-port.patch | 4 +-- ...tore-port-5-SGMII-capability-of-MT75.patch | 14 ++++---- ...mprove-comments-regarding-switch-por.patch | 12 +++---- ...all-port-6-setup-from-mt7530_mac_con.patch | 2 +- ...30-remove-pad_setup-function-pointer.patch | 16 +++++----- ...-correct-port-capabilities-of-MT7988.patch | 2 +- ...o-not-clear-config-supported_interfa.patch | 2 +- ...emove-.mac_port_config-for-MT7988-an.patch | 8 ++--- ...o-not-use-SW_PHY_RST-to-reset-MT7531.patch | 2 +- ...et-rid-of-useless-error-returns-on-p.patch | 16 +++++----- ...get-rid-of-priv-info-cpu_port_config.patch | 14 ++++---- ...-mt7530-get-rid-of-mt753x_mac_config.patch | 4 +-- ...ut-initialising-PCS-devices-code-bac.patch | 4 +-- ...-dsa-mt7530-simplify-link-operations.patch | 2 +- ...0-provide-own-phylink-MAC-operations.patch | 10 +++--- ...dio-read-PHY-address-of-switch-from-.patch | 2 +- ...et-dsa-mt7530-refactor-MT7530_PMCR_P.patch | 12 +++---- ...ename-p5_intf_sel-and-use-only-for-M.patch | 2 +- ...efactor-MT7530_MFC-and-MT7531_CFC-ad.patch | 2 +- ...efactor-MT7530_HWTRAP-and-MT7530_MHW.patch | 2 +- ...eturn-mt7530_setup_mdio-mt7531_setup.patch | 8 ++--- ...efine-MAC-speed-capabilities-per-swi.patch | 8 ++--- ...530-get-rid-of-function-sanity-check.patch | 2 +- ...dsa-mt7530-refactor-MT7530_PMEEECR_P.patch | 4 +-- ...se-priv-ds-num_ports-instead-of-MT75.patch | 2 +- ...o-not-pass-port-variable-to-mt7531_r.patch | 4 +-- ...xplain-exposing-MDIO-bus-of-MT7531AE.patch | 2 +- ...680-net-add-TCP-fraglist-GRO-support.patch | 16 +++++----- ...fraglist-segmentation-after-pull-fro.patch | 2 +- .../999-atm-mpoa-intel-dsl-phy-support.patch | 4 +-- ...c3-add-optional-PHY-interface-clocks.patch | 6 ++-- ...ove-performance-usb-using-lowmem-for.patch | 2 +- ...ma_alloc_noncoherent-to-alloc-low-me.patch | 2 +- 46 files changed, 134 insertions(+), 170 deletions(-) delete mode 100644 target/linux/bcm27xx/patches-6.6/950-0483-usb-xhci-borrow-upstream-TRB_FETCH-quirk-on-VL805-ho.patch diff --git a/include/kernel-6.6 b/include/kernel-6.6 index 7502edfd628785..e6f3c97c6ea397 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .82 -LINUX_KERNEL_HASH-6.6.82 = f3c2389b8c23cabe747f104a3e434201ca6e7725bbbfb3a8c59a063ac4820e41 +LINUX_VERSION-6.6 = .83 +LINUX_KERNEL_HASH-6.6.83 = 894bbbe63b7484a0bc576a1e11a8dbc090fbd476d6424431bdc8435e03c2c208 diff --git a/target/linux/airoha/patches-6.6/029-v6.12-net-dsa-mt7530-Add-EN7581-support.patch b/target/linux/airoha/patches-6.6/029-v6.12-net-dsa-mt7530-Add-EN7581-support.patch index 55e4ae9d404e64..2f37b86cca367f 100644 --- a/target/linux/airoha/patches-6.6/029-v6.12-net-dsa-mt7530-Add-EN7581-support.patch +++ b/target/linux/airoha/patches-6.6/029-v6.12-net-dsa-mt7530-Add-EN7581-support.patch @@ -79,7 +79,7 @@ Signed-off-by: David S. Miller /* Disable forwarding by default on all ports */ mt7530_rmw(priv, MT7530_PCR_P(i), PCR_MATRIX_MASK, -@@ -2783,6 +2788,28 @@ static void mt7988_mac_port_get_caps(str +@@ -2779,6 +2784,28 @@ static void mt7988_mac_port_get_caps(str } } @@ -108,7 +108,7 @@ Signed-off-by: David S. Miller static void mt7530_mac_config(struct dsa_switch *ds, int port, unsigned int mode, phy_interface_t interface) -@@ -3220,6 +3247,16 @@ const struct mt753x_info mt753x_table[] +@@ -3216,6 +3243,16 @@ const struct mt753x_info mt753x_table[] .phy_write_c45 = mt7531_ind_c45_phy_write, .mac_port_get_caps = mt7988_mac_port_get_caps, }, diff --git a/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch b/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch index 91e39d7d24e139..870567c0589f86 100644 --- a/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch @@ -858,7 +858,7 @@ SVN-Revision: 35130 --- a/net/ipv4/tcp_offload.c +++ b/net/ipv4/tcp_offload.c -@@ -63,7 +63,7 @@ static struct sk_buff *__tcpv4_gso_segme +@@ -66,7 +66,7 @@ static struct sk_buff *__tcpv4_gso_segme th2 = tcp_hdr(seg->next); iph2 = ip_hdr(seg->next); @@ -867,7 +867,7 @@ SVN-Revision: 35130 iph->daddr == iph2->daddr && iph->saddr == iph2->saddr) return segs; -@@ -264,7 +264,7 @@ struct sk_buff *tcp_gro_lookup(struct li +@@ -267,7 +267,7 @@ struct sk_buff *tcp_gro_lookup(struct li continue; th2 = tcp_hdr(p); @@ -876,7 +876,7 @@ SVN-Revision: 35130 NAPI_GRO_CB(p)->same_flow = 0; continue; } -@@ -330,8 +330,8 @@ struct sk_buff *tcp_gro_receive(struct l +@@ -333,8 +333,8 @@ struct sk_buff *tcp_gro_receive(struct l ~(TCP_FLAG_CWR | TCP_FLAG_FIN | TCP_FLAG_PSH)); flush |= (__force int)(th->ack_seq ^ th2->ack_seq); for (i = sizeof(*th); i < thlen; i += 4) diff --git a/target/linux/bcm27xx/patches-6.6/950-0061-Revert-Revert-xhci-add-quirk-for-host-controllers-th.patch b/target/linux/bcm27xx/patches-6.6/950-0061-Revert-Revert-xhci-add-quirk-for-host-controllers-th.patch index 3898e05aae08b9..e2c2b02f709c11 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0061-Revert-Revert-xhci-add-quirk-for-host-controllers-th.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0061-Revert-Revert-xhci-add-quirk-for-host-controllers-th.patch @@ -14,18 +14,14 @@ We don't agree with upstream revert so undo it. --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c -@@ -480,8 +480,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) { +@@ -485,6 +485,7 @@ static void xhci_pci_quirks(struct devic + if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == PCI_DEVICE_ID_VIA_VL805) { xhci->quirks |= XHCI_LPM_SUPPORT; + xhci->quirks |= XHCI_TRB_OVERFETCH; + xhci->quirks |= XHCI_EP_CTX_BROKEN_DCS; -+ } + } 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 @@ -635,8 +635,11 @@ static int xhci_move_dequeue_past_td(str diff --git a/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch b/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch index 2b267c77924c4f..e295c225f787ef 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch @@ -24,9 +24,9 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c -@@ -483,6 +483,7 @@ static void xhci_pci_quirks(struct devic - if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == 0x3483) { +@@ -486,6 +486,7 @@ static void xhci_pci_quirks(struct devic xhci->quirks |= XHCI_LPM_SUPPORT; + xhci->quirks |= XHCI_TRB_OVERFETCH; xhci->quirks |= XHCI_EP_CTX_BROKEN_DCS; + xhci->quirks |= XHCI_AVOID_DQ_ON_LINK; } diff --git a/target/linux/bcm27xx/patches-6.6/950-0483-usb-xhci-borrow-upstream-TRB_FETCH-quirk-on-VL805-ho.patch b/target/linux/bcm27xx/patches-6.6/950-0483-usb-xhci-borrow-upstream-TRB_FETCH-quirk-on-VL805-ho.patch deleted file mode 100644 index 852e6a36735c29..00000000000000 --- a/target/linux/bcm27xx/patches-6.6/950-0483-usb-xhci-borrow-upstream-TRB_FETCH-quirk-on-VL805-ho.patch +++ /dev/null @@ -1,32 +0,0 @@ -From bab2f1e4e90675af7ea6b48b5c28eb94e22cecd7 Mon Sep 17 00:00:00 2001 -From: Jonathan Bell -Date: Thu, 13 Jul 2023 15:06:54 +0100 -Subject: [PATCH 0483/1085] usb: xhci: borrow upstream TRB_FETCH quirk on VL805 - hosts - -This reimplements 5a57342 usb: xhci: add VLI_TRB_CACHE_BUG quirk - -The downstream implementation required a fair bit of driver surgery to -allow for truncated ring segments, which needed to shrink by a small -amount to avoid the cache prefetcher from reading off the end of one -segment and into another. - -An upstream implementation for a similar bug on a different controller -just doubles the size of the memory allocated for ring segments, which -is a bit more wasteful (+4K per allocation) but means less code churn. - -Signed-off-by: Jonathan Bell ---- - drivers/usb/host/xhci-pci.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/usb/host/xhci-pci.c -+++ b/drivers/usb/host/xhci-pci.c -@@ -484,6 +484,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; -+ xhci->quirks |= XHCI_ZHAOXIN_TRB_FETCH; - } - - if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && diff --git a/target/linux/bcm27xx/patches-6.6/950-0484-usb-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch b/target/linux/bcm27xx/patches-6.6/950-0484-usb-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch index a1e8f9ed222348..b6cfc1b7a880de 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0484-usb-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0484-usb-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch @@ -90,10 +90,10 @@ Signed-off-by: Jonathan Bell /* Allow 3 retries for everything but isoc, set CErr = 3 */ --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c -@@ -485,6 +485,7 @@ static void xhci_pci_quirks(struct devic +@@ -487,6 +487,7 @@ static void xhci_pci_quirks(struct devic + xhci->quirks |= XHCI_TRB_OVERFETCH; xhci->quirks |= XHCI_EP_CTX_BROKEN_DCS; xhci->quirks |= XHCI_AVOID_DQ_ON_LINK; - xhci->quirks |= XHCI_ZHAOXIN_TRB_FETCH; + xhci->quirks |= XHCI_VLI_SS_BULK_OUT_BUG; } diff --git a/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch b/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch index adf25d9495b459..a17245d94f3dea 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch @@ -45,9 +45,9 @@ Signed-off-by: Jonathan Bell +#define VL805_FW_VER_0138C0 0x0138C0 + /* Device for a quirk */ - #define PCI_VENDOR_ID_FRESCO_LOGIC 0x1b73 - #define PCI_DEVICE_ID_FRESCO_LOGIC_PDK 0x1000 -@@ -295,6 +297,16 @@ static int xhci_pci_reinit(struct xhci_h + #define PCI_VENDOR_ID_FRESCO_LOGIC 0x1b73 + #define PCI_DEVICE_ID_FRESCO_LOGIC_PDK 0x1000 +@@ -297,6 +299,16 @@ static int xhci_pci_reinit(struct xhci_h return 0; } @@ -64,9 +64,9 @@ Signed-off-by: Jonathan Bell static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) { struct pci_dev *pdev = to_pci_dev(dev); -@@ -486,6 +498,8 @@ static void xhci_pci_quirks(struct devic +@@ -488,6 +500,8 @@ static void xhci_pci_quirks(struct devic + xhci->quirks |= XHCI_EP_CTX_BROKEN_DCS; xhci->quirks |= XHCI_AVOID_DQ_ON_LINK; - xhci->quirks |= XHCI_ZHAOXIN_TRB_FETCH; xhci->quirks |= XHCI_VLI_SS_BULK_OUT_BUG; + if (xhci_vl805_get_fw_version(pdev) < VL805_FW_VER_0138C0) + xhci->quirks |= XHCI_VLI_HUB_TT_QUIRK; diff --git a/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch b/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch index 8a469986f07a14..a087faa35bc82e 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch @@ -212,7 +212,7 @@ Signed-off-by: Jonathan Bell }, --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c -@@ -1208,6 +1208,24 @@ static void dwc3_config_threshold(struct +@@ -1223,6 +1223,24 @@ static void dwc3_config_threshold(struct } } @@ -237,7 +237,7 @@ Signed-off-by: Jonathan Bell /** * dwc3_core_init - Low-level initialization of DWC3 Core * @dwc: Pointer to our controller context structure -@@ -1273,6 +1291,8 @@ static int dwc3_core_init(struct dwc3 *d +@@ -1288,6 +1306,8 @@ static int dwc3_core_init(struct dwc3 *d dwc3_set_incr_burst_type(dwc); @@ -246,7 +246,7 @@ Signed-off-by: Jonathan Bell ret = dwc3_phy_power_on(dwc); if (ret) goto err_exit_phy; -@@ -1362,6 +1382,24 @@ static int dwc3_core_init(struct dwc3 *d +@@ -1377,6 +1397,24 @@ static int dwc3_core_init(struct dwc3 *d dwc3_config_threshold(dwc); @@ -271,7 +271,7 @@ Signed-off-by: Jonathan Bell return 0; err_power_off_phy: -@@ -1505,6 +1543,7 @@ static void dwc3_get_properties(struct d +@@ -1520,6 +1558,7 @@ static void dwc3_get_properties(struct d u8 tx_thr_num_pkt_prd = 0; u8 tx_max_burst_prd = 0; u8 tx_fifo_resize_max_num; @@ -279,7 +279,7 @@ Signed-off-by: Jonathan Bell /* default to highest possible threshold */ lpm_nyet_threshold = 0xf; -@@ -1525,6 +1564,9 @@ static void dwc3_get_properties(struct d +@@ -1540,6 +1579,9 @@ static void dwc3_get_properties(struct d */ tx_fifo_resize_max_num = 6; @@ -289,7 +289,7 @@ Signed-off-by: Jonathan Bell dwc->maximum_speed = usb_get_maximum_speed(dev); dwc->max_ssp_rate = usb_get_maximum_ssp_rate(dev); dwc->dr_mode = usb_get_dr_mode(dev); -@@ -1639,6 +1681,9 @@ static void dwc3_get_properties(struct d +@@ -1654,6 +1696,9 @@ static void dwc3_get_properties(struct d dwc->dis_split_quirk = device_property_read_bool(dev, "snps,dis-split-quirk"); @@ -299,16 +299,16 @@ Signed-off-by: Jonathan Bell dwc->lpm_nyet_threshold = lpm_nyet_threshold; dwc->tx_de_emphasis = tx_de_emphasis; -@@ -1656,6 +1701,8 @@ static void dwc3_get_properties(struct d +@@ -1671,6 +1716,8 @@ static void dwc3_get_properties(struct d dwc->tx_thr_num_pkt_prd = tx_thr_num_pkt_prd; dwc->tx_max_burst_prd = tx_max_burst_prd; + dwc->axi_pipe_limit = axi_pipe_limit; + - dwc->imod_interval = 0; - dwc->tx_fifo_resize_max_num = tx_fifo_resize_max_num; -@@ -1952,6 +1999,12 @@ static int dwc3_probe(struct platform_de + } + +@@ -1963,6 +2010,12 @@ static int dwc3_probe(struct platform_de if (IS_ERR(dwc->usb_psy)) return dev_err_probe(dev, PTR_ERR(dwc->usb_psy), "couldn't get usb power supply\n"); diff --git a/target/linux/bcm27xx/patches-6.6/950-0853-drivers-usb-dwc3-add-FS-LS-bus-instance-parkmode-dis.patch b/target/linux/bcm27xx/patches-6.6/950-0853-drivers-usb-dwc3-add-FS-LS-bus-instance-parkmode-dis.patch index abd631b6f7ec77..47fa0b75416cf1 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0853-drivers-usb-dwc3-add-FS-LS-bus-instance-parkmode-dis.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0853-drivers-usb-dwc3-add-FS-LS-bus-instance-parkmode-dis.patch @@ -16,7 +16,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c -@@ -1372,6 +1372,9 @@ static int dwc3_core_init(struct dwc3 *d +@@ -1387,6 +1387,9 @@ static int dwc3_core_init(struct dwc3 *d if (dwc->parkmode_disable_hs_quirk) reg |= DWC3_GUCTL1_PARKMODE_DISABLE_HS; @@ -26,7 +26,7 @@ Signed-off-by: Jonathan Bell if (DWC3_VER_IS_WITHIN(DWC3, 290A, ANY) && (dwc->maximum_speed == USB_SPEED_HIGH || dwc->maximum_speed == USB_SPEED_FULL)) -@@ -1661,6 +1664,8 @@ static void dwc3_get_properties(struct d +@@ -1676,6 +1679,8 @@ static void dwc3_get_properties(struct d "snps,parkmode-disable-ss-quirk"); dwc->parkmode_disable_hs_quirk = device_property_read_bool(dev, "snps,parkmode-disable-hs-quirk"); diff --git a/target/linux/bcm27xx/patches-6.6/950-1359-usb-dwc3-core-add-support-for-setting-NAK-enhancemen.patch b/target/linux/bcm27xx/patches-6.6/950-1359-usb-dwc3-core-add-support-for-setting-NAK-enhancemen.patch index 0ed02a82cff15d..5b700990b2783a 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1359-usb-dwc3-core-add-support-for-setting-NAK-enhancemen.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1359-usb-dwc3-core-add-support-for-setting-NAK-enhancemen.patch @@ -22,7 +22,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c -@@ -1366,6 +1366,12 @@ static int dwc3_core_init(struct dwc3 *d +@@ -1381,6 +1381,12 @@ static int dwc3_core_init(struct dwc3 *d if (dwc->dis_tx_ipgap_linecheck_quirk) reg |= DWC3_GUCTL1_TX_IPGAP_LINECHECK_DIS; @@ -35,7 +35,7 @@ Signed-off-by: Jonathan Bell if (dwc->parkmode_disable_ss_quirk) reg |= DWC3_GUCTL1_PARKMODE_DISABLE_SS; -@@ -1660,6 +1666,10 @@ static void dwc3_get_properties(struct d +@@ -1675,6 +1681,10 @@ static void dwc3_get_properties(struct d "snps,resume-hs-terminations"); dwc->ulpi_ext_vbus_drv = device_property_read_bool(dev, "snps,ulpi-ext-vbus-drv"); diff --git a/target/linux/generic/backport-6.6/611-01-v6.11-udp-Allow-GSO-transmit-from-devices-with-no-checksum.patch b/target/linux/generic/backport-6.6/611-01-v6.11-udp-Allow-GSO-transmit-from-devices-with-no-checksum.patch index b9633a87725baf..d1673ec7d4a60c 100644 --- a/target/linux/generic/backport-6.6/611-01-v6.11-udp-Allow-GSO-transmit-from-devices-with-no-checksum.patch +++ b/target/linux/generic/backport-6.6/611-01-v6.11-udp-Allow-GSO-transmit-from-devices-with-no-checksum.patch @@ -65,7 +65,7 @@ Signed-off-by: Jakub Kicinski } --- a/net/ipv4/udp_offload.c +++ b/net/ipv4/udp_offload.c -@@ -380,6 +380,14 @@ struct sk_buff *__udp_gso_segment(struct +@@ -384,6 +384,14 @@ struct sk_buff *__udp_gso_segment(struct else uh->check = gso_make_checksum(seg, ~check) ? : CSUM_MANGLED_0; diff --git a/target/linux/generic/backport-6.6/790-02-v6.7-net-dsa-mt753x-remove-mt753x_phylink_pcs_link_up.patch b/target/linux/generic/backport-6.6/790-02-v6.7-net-dsa-mt753x-remove-mt753x_phylink_pcs_link_up.patch index 506024379e0a63..d99822a2e07101 100644 --- a/target/linux/generic/backport-6.6/790-02-v6.7-net-dsa-mt753x-remove-mt753x_phylink_pcs_link_up.patch +++ b/target/linux/generic/backport-6.6/790-02-v6.7-net-dsa-mt753x-remove-mt753x_phylink_pcs_link_up.patch @@ -24,7 +24,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -3037,15 +3037,6 @@ static void mt753x_phylink_mac_link_down +@@ -3033,15 +3033,6 @@ static void mt753x_phylink_mac_link_down mt7530_clear(priv, MT7530_PMCR_P(port), PMCR_LINK_SETTINGS_MASK); } @@ -40,7 +40,7 @@ Signed-off-by: Jakub Kicinski static void mt753x_phylink_mac_link_up(struct dsa_switch *ds, int port, unsigned int mode, phy_interface_t interface, -@@ -3133,8 +3124,6 @@ mt7531_cpu_port_config(struct dsa_switch +@@ -3129,8 +3120,6 @@ mt7531_cpu_port_config(struct dsa_switch return ret; mt7530_write(priv, MT7530_PMCR_P(port), PMCR_CPU_PORT_SETTING(priv->id)); diff --git a/target/linux/generic/backport-6.6/790-05-v6.9-net-dsa-mt7530-always-trap-frames-to-active-CPU-port.patch b/target/linux/generic/backport-6.6/790-05-v6.9-net-dsa-mt7530-always-trap-frames-to-active-CPU-port.patch index 8c73ea94a103bc..8fab36a4aa8198 100644 --- a/target/linux/generic/backport-6.6/790-05-v6.9-net-dsa-mt7530-always-trap-frames-to-active-CPU-port.patch +++ b/target/linux/generic/backport-6.6/790-05-v6.9-net-dsa-mt7530-always-trap-frames-to-active-CPU-port.patch @@ -49,7 +49,7 @@ Signed-off-by: Jakub Kicinski /* Add the CPU port to the CPU port bitmap for MT7531 and the switch on * the MT7988 SoC. Trapped frames will be forwarded to the CPU port that * is affine to the inbound user port. -@@ -3305,6 +3301,36 @@ static int mt753x_set_mac_eee(struct dsa +@@ -3301,6 +3297,36 @@ static int mt753x_set_mac_eee(struct dsa return 0; } @@ -86,7 +86,7 @@ Signed-off-by: Jakub Kicinski static int mt7988_pad_setup(struct dsa_switch *ds, phy_interface_t interface) { return 0; -@@ -3360,6 +3386,7 @@ const struct dsa_switch_ops mt7530_switc +@@ -3356,6 +3382,7 @@ const struct dsa_switch_ops mt7530_switc .phylink_mac_link_up = mt753x_phylink_mac_link_up, .get_mac_eee = mt753x_get_mac_eee, .set_mac_eee = mt753x_set_mac_eee, diff --git a/target/linux/generic/backport-6.6/790-07-v6.9-net-dsa-mt7530-store-port-5-SGMII-capability-of-MT75.patch b/target/linux/generic/backport-6.6/790-07-v6.9-net-dsa-mt7530-store-port-5-SGMII-capability-of-MT75.patch index 426a7bcc2f3921..5e6dfe6c6dc76c 100644 --- a/target/linux/generic/backport-6.6/790-07-v6.9-net-dsa-mt7530-store-port-5-SGMII-capability-of-MT75.patch +++ b/target/linux/generic/backport-6.6/790-07-v6.9-net-dsa-mt7530-store-port-5-SGMII-capability-of-MT75.patch @@ -100,7 +100,7 @@ Signed-off-by: Jakub Kicinski default: return "unknown"; } -@@ -2694,6 +2680,12 @@ mt7531_setup(struct dsa_switch *ds) +@@ -2695,6 +2681,12 @@ mt7531_setup(struct dsa_switch *ds) return -ENODEV; } @@ -113,7 +113,7 @@ Signed-off-by: Jakub Kicinski /* all MACs must be forced link-down before sw reset */ for (i = 0; i < MT7530_NUM_PORTS; i++) mt7530_write(priv, MT7530_PMCR_P(i), MT7531_FORCE_LNK); -@@ -2703,21 +2695,18 @@ mt7531_setup(struct dsa_switch *ds) +@@ -2704,21 +2696,18 @@ mt7531_setup(struct dsa_switch *ds) SYS_CTRL_PHY_RST | SYS_CTRL_SW_RST | SYS_CTRL_REG_RST); @@ -141,7 +141,7 @@ Signed-off-by: Jakub Kicinski mt7530_rmw(priv, MT7531_GPIO_MODE0, MT7531_GPIO0_MASK, MT7531_GPIO0_INTERRUPT); -@@ -2784,11 +2773,6 @@ static void mt7530_mac_port_get_caps(str +@@ -2780,11 +2769,6 @@ static void mt7530_mac_port_get_caps(str } } @@ -153,7 +153,7 @@ Signed-off-by: Jakub Kicinski static void mt7531_mac_port_get_caps(struct dsa_switch *ds, int port, struct phylink_config *config) { -@@ -2801,7 +2785,7 @@ static void mt7531_mac_port_get_caps(str +@@ -2797,7 +2781,7 @@ static void mt7531_mac_port_get_caps(str break; case 5: /* 2nd cpu port supports either rgmii or sgmii/8023z */ @@ -162,7 +162,7 @@ Signed-off-by: Jakub Kicinski phy_interface_set_rgmii(config->supported_interfaces); break; } -@@ -2868,7 +2852,7 @@ static int mt7531_rgmii_setup(struct mt7 +@@ -2864,7 +2848,7 @@ static int mt7531_rgmii_setup(struct mt7 { u32 val; @@ -171,7 +171,7 @@ Signed-off-by: Jakub Kicinski dev_err(priv->dev, "RGMII mode is not available for port %d\n", port); return -EINVAL; -@@ -3111,7 +3095,7 @@ mt7531_cpu_port_config(struct dsa_switch +@@ -3107,7 +3091,7 @@ mt7531_cpu_port_config(struct dsa_switch switch (port) { case 5: @@ -180,7 +180,7 @@ Signed-off-by: Jakub Kicinski interface = PHY_INTERFACE_MODE_RGMII; else interface = PHY_INTERFACE_MODE_2500BASEX; -@@ -3263,7 +3247,7 @@ mt753x_setup(struct dsa_switch *ds) +@@ -3259,7 +3243,7 @@ mt753x_setup(struct dsa_switch *ds) mt7530_free_irq_common(priv); if (priv->create_sgmii) { diff --git a/target/linux/generic/backport-6.6/790-08-v6.9-net-dsa-mt7530-improve-comments-regarding-switch-por.patch b/target/linux/generic/backport-6.6/790-08-v6.9-net-dsa-mt7530-improve-comments-regarding-switch-por.patch index 3309e248c94f31..3dddbbeee8b9a1 100644 --- a/target/linux/generic/backport-6.6/790-08-v6.9-net-dsa-mt7530-improve-comments-regarding-switch-por.patch +++ b/target/linux/generic/backport-6.6/790-08-v6.9-net-dsa-mt7530-improve-comments-regarding-switch-por.patch @@ -37,7 +37,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2751,12 +2751,14 @@ static void mt7530_mac_port_get_caps(str +@@ -2747,12 +2747,14 @@ static void mt7530_mac_port_get_caps(str struct phylink_config *config) { switch (port) { @@ -54,7 +54,7 @@ Signed-off-by: Jakub Kicinski phy_interface_set_rgmii(config->supported_interfaces); __set_bit(PHY_INTERFACE_MODE_MII, config->supported_interfaces); -@@ -2764,7 +2766,8 @@ static void mt7530_mac_port_get_caps(str +@@ -2760,7 +2762,8 @@ static void mt7530_mac_port_get_caps(str config->supported_interfaces); break; @@ -64,7 +64,7 @@ Signed-off-by: Jakub Kicinski __set_bit(PHY_INTERFACE_MODE_RGMII, config->supported_interfaces); __set_bit(PHY_INTERFACE_MODE_TRGMII, -@@ -2779,19 +2782,24 @@ static void mt7531_mac_port_get_caps(str +@@ -2775,19 +2778,24 @@ static void mt7531_mac_port_get_caps(str struct mt7530_priv *priv = ds->priv; switch (port) { @@ -92,7 +92,7 @@ Signed-off-by: Jakub Kicinski __set_bit(PHY_INTERFACE_MODE_SGMII, config->supported_interfaces); __set_bit(PHY_INTERFACE_MODE_1000BASEX, -@@ -2810,11 +2818,13 @@ static void mt7988_mac_port_get_caps(str +@@ -2806,11 +2814,13 @@ static void mt7988_mac_port_get_caps(str phy_interface_zero(config->supported_interfaces); switch (port) { @@ -107,7 +107,7 @@ Signed-off-by: Jakub Kicinski case 6: __set_bit(PHY_INTERFACE_MODE_INTERNAL, config->supported_interfaces); -@@ -2978,12 +2988,12 @@ mt753x_phylink_mac_config(struct dsa_swi +@@ -2974,12 +2984,12 @@ mt753x_phylink_mac_config(struct dsa_swi u32 mcr_cur, mcr_new; switch (port) { @@ -122,7 +122,7 @@ Signed-off-by: Jakub Kicinski if (priv->p5_interface == state->interface) break; -@@ -2993,7 +3003,7 @@ mt753x_phylink_mac_config(struct dsa_swi +@@ -2989,7 +2999,7 @@ mt753x_phylink_mac_config(struct dsa_swi if (priv->p5_intf_sel != P5_DISABLED) priv->p5_interface = state->interface; break; diff --git a/target/linux/generic/backport-6.6/790-15-v6.9-net-dsa-mt7530-call-port-6-setup-from-mt7530_mac_con.patch b/target/linux/generic/backport-6.6/790-15-v6.9-net-dsa-mt7530-call-port-6-setup-from-mt7530_mac_con.patch index 330a92e7d4d8ae..2180436abac0a9 100644 --- a/target/linux/generic/backport-6.6/790-15-v6.9-net-dsa-mt7530-call-port-6-setup-from-mt7530_mac_con.patch +++ b/target/linux/generic/backport-6.6/790-15-v6.9-net-dsa-mt7530-call-port-6-setup-from-mt7530_mac_con.patch @@ -79,7 +79,7 @@ Signed-off-by: Jakub Kicinski return 0; } -@@ -2826,11 +2830,10 @@ mt7530_mac_config(struct dsa_switch *ds, +@@ -2822,11 +2826,10 @@ mt7530_mac_config(struct dsa_switch *ds, { struct mt7530_priv *priv = ds->priv; diff --git a/target/linux/generic/backport-6.6/790-16-v6.9-net-dsa-mt7530-remove-pad_setup-function-pointer.patch b/target/linux/generic/backport-6.6/790-16-v6.9-net-dsa-mt7530-remove-pad_setup-function-pointer.patch index dcf1afa16e8116..c7e2af8ca89617 100644 --- a/target/linux/generic/backport-6.6/790-16-v6.9-net-dsa-mt7530-remove-pad_setup-function-pointer.patch +++ b/target/linux/generic/backport-6.6/790-16-v6.9-net-dsa-mt7530-remove-pad_setup-function-pointer.patch @@ -47,7 +47,7 @@ Signed-off-by: Jakub Kicinski static void mt7531_pll_setup(struct mt7530_priv *priv) { -@@ -2817,14 +2805,6 @@ static void mt7988_mac_port_get_caps(str +@@ -2813,14 +2801,6 @@ static void mt7988_mac_port_get_caps(str } static int @@ -62,7 +62,7 @@ Signed-off-by: Jakub Kicinski mt7530_mac_config(struct dsa_switch *ds, int port, unsigned int mode, phy_interface_t interface) { -@@ -2989,8 +2969,6 @@ mt753x_phylink_mac_config(struct dsa_swi +@@ -2985,8 +2965,6 @@ mt753x_phylink_mac_config(struct dsa_swi if (priv->p6_interface == state->interface) break; @@ -71,7 +71,7 @@ Signed-off-by: Jakub Kicinski if (mt753x_mac_config(ds, port, mode, state) < 0) goto unsupported; -@@ -3307,11 +3285,6 @@ mt753x_conduit_state_change(struct dsa_s +@@ -3303,11 +3281,6 @@ mt753x_conduit_state_change(struct dsa_s mt7530_rmw(priv, MT7530_MFC, CPU_EN | CPU_PORT_MASK, val); } @@ -83,7 +83,7 @@ Signed-off-by: Jakub Kicinski static int mt7988_setup(struct dsa_switch *ds) { struct mt7530_priv *priv = ds->priv; -@@ -3375,7 +3348,6 @@ const struct mt753x_info mt753x_table[] +@@ -3371,7 +3344,6 @@ const struct mt753x_info mt753x_table[] .phy_write_c22 = mt7530_phy_write_c22, .phy_read_c45 = mt7530_phy_read_c45, .phy_write_c45 = mt7530_phy_write_c45, @@ -91,7 +91,7 @@ Signed-off-by: Jakub Kicinski .mac_port_get_caps = mt7530_mac_port_get_caps, .mac_port_config = mt7530_mac_config, }, -@@ -3387,7 +3359,6 @@ const struct mt753x_info mt753x_table[] +@@ -3383,7 +3355,6 @@ const struct mt753x_info mt753x_table[] .phy_write_c22 = mt7530_phy_write_c22, .phy_read_c45 = mt7530_phy_read_c45, .phy_write_c45 = mt7530_phy_write_c45, @@ -99,7 +99,7 @@ Signed-off-by: Jakub Kicinski .mac_port_get_caps = mt7530_mac_port_get_caps, .mac_port_config = mt7530_mac_config, }, -@@ -3399,7 +3370,6 @@ const struct mt753x_info mt753x_table[] +@@ -3395,7 +3366,6 @@ const struct mt753x_info mt753x_table[] .phy_write_c22 = mt7531_ind_c22_phy_write, .phy_read_c45 = mt7531_ind_c45_phy_read, .phy_write_c45 = mt7531_ind_c45_phy_write, @@ -107,7 +107,7 @@ Signed-off-by: Jakub Kicinski .cpu_port_config = mt7531_cpu_port_config, .mac_port_get_caps = mt7531_mac_port_get_caps, .mac_port_config = mt7531_mac_config, -@@ -3412,7 +3382,6 @@ const struct mt753x_info mt753x_table[] +@@ -3408,7 +3378,6 @@ const struct mt753x_info mt753x_table[] .phy_write_c22 = mt7531_ind_c22_phy_write, .phy_read_c45 = mt7531_ind_c45_phy_read, .phy_write_c45 = mt7531_ind_c45_phy_write, @@ -115,7 +115,7 @@ Signed-off-by: Jakub Kicinski .cpu_port_config = mt7988_cpu_port_config, .mac_port_get_caps = mt7988_mac_port_get_caps, .mac_port_config = mt7988_mac_config, -@@ -3442,9 +3411,8 @@ mt7530_probe_common(struct mt7530_priv * +@@ -3438,9 +3407,8 @@ mt7530_probe_common(struct mt7530_priv * /* Sanity check if these required device operations are filled * properly. */ diff --git a/target/linux/generic/backport-6.6/790-17-v6.9-net-dsa-mt7530-correct-port-capabilities-of-MT7988.patch b/target/linux/generic/backport-6.6/790-17-v6.9-net-dsa-mt7530-correct-port-capabilities-of-MT7988.patch index f6c2919eaf6e8e..b833522deb5b42 100644 --- a/target/linux/generic/backport-6.6/790-17-v6.9-net-dsa-mt7530-correct-port-capabilities-of-MT7988.patch +++ b/target/linux/generic/backport-6.6/790-17-v6.9-net-dsa-mt7530-correct-port-capabilities-of-MT7988.patch @@ -25,7 +25,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2790,7 +2790,7 @@ static void mt7988_mac_port_get_caps(str +@@ -2786,7 +2786,7 @@ static void mt7988_mac_port_get_caps(str switch (port) { /* Ports which are connected to switch PHYs. There is no MII pinout. */ diff --git a/target/linux/generic/backport-6.6/790-18-v6.9-net-dsa-mt7530-do-not-clear-config-supported_interfa.patch b/target/linux/generic/backport-6.6/790-18-v6.9-net-dsa-mt7530-do-not-clear-config-supported_interfa.patch index 66a9158507f23a..2b12c3bc71f013 100644 --- a/target/linux/generic/backport-6.6/790-18-v6.9-net-dsa-mt7530-do-not-clear-config-supported_interfa.patch +++ b/target/linux/generic/backport-6.6/790-18-v6.9-net-dsa-mt7530-do-not-clear-config-supported_interfa.patch @@ -27,7 +27,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2786,8 +2786,6 @@ static void mt7531_mac_port_get_caps(str +@@ -2782,8 +2782,6 @@ 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) { diff --git a/target/linux/generic/backport-6.6/790-19-v6.9-net-dsa-mt7530-remove-.mac_port_config-for-MT7988-an.patch b/target/linux/generic/backport-6.6/790-19-v6.9-net-dsa-mt7530-remove-.mac_port_config-for-MT7988-an.patch index abc1108116477b..f38c0e80e8089c 100644 --- a/target/linux/generic/backport-6.6/790-19-v6.9-net-dsa-mt7530-remove-.mac_port_config-for-MT7988-an.patch +++ b/target/linux/generic/backport-6.6/790-19-v6.9-net-dsa-mt7530-remove-.mac_port_config-for-MT7988-an.patch @@ -33,7 +33,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2869,17 +2869,6 @@ static bool mt753x_is_mac_port(u32 port) +@@ -2865,17 +2865,6 @@ static bool mt753x_is_mac_port(u32 port) } static int @@ -51,7 +51,7 @@ Signed-off-by: Paolo Abeni mt7531_mac_config(struct dsa_switch *ds, int port, unsigned int mode, phy_interface_t interface) { -@@ -2919,6 +2908,9 @@ mt753x_mac_config(struct dsa_switch *ds, +@@ -2915,6 +2904,9 @@ mt753x_mac_config(struct dsa_switch *ds, { struct mt7530_priv *priv = ds->priv; @@ -61,7 +61,7 @@ Signed-off-by: Paolo Abeni return priv->info->mac_port_config(ds, port, mode, state->interface); } -@@ -3382,7 +3374,6 @@ const struct mt753x_info mt753x_table[] +@@ -3378,7 +3370,6 @@ const struct mt753x_info mt753x_table[] .phy_write_c45 = mt7531_ind_c45_phy_write, .cpu_port_config = mt7988_cpu_port_config, .mac_port_get_caps = mt7988_mac_port_get_caps, @@ -69,7 +69,7 @@ Signed-off-by: Paolo Abeni }, }; EXPORT_SYMBOL_GPL(mt753x_table); -@@ -3410,8 +3401,7 @@ mt7530_probe_common(struct mt7530_priv * +@@ -3406,8 +3397,7 @@ mt7530_probe_common(struct mt7530_priv * * properly. */ if (!priv->info->sw_setup || !priv->info->phy_read_c22 || diff --git a/target/linux/generic/backport-6.6/790-21-v6.9-net-dsa-mt7530-do-not-use-SW_PHY_RST-to-reset-MT7531.patch b/target/linux/generic/backport-6.6/790-21-v6.9-net-dsa-mt7530-do-not-use-SW_PHY_RST-to-reset-MT7531.patch index 735775d97a56b9..0ed8cbededf2a2 100644 --- a/target/linux/generic/backport-6.6/790-21-v6.9-net-dsa-mt7530-do-not-use-SW_PHY_RST-to-reset-MT7531.patch +++ b/target/linux/generic/backport-6.6/790-21-v6.9-net-dsa-mt7530-do-not-use-SW_PHY_RST-to-reset-MT7531.patch @@ -22,7 +22,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2657,14 +2657,12 @@ mt7531_setup(struct dsa_switch *ds) +@@ -2658,14 +2658,12 @@ mt7531_setup(struct dsa_switch *ds) val = mt7530_read(priv, MT7531_TOP_SIG_SR); priv->p5_sgmii = !!(val & PAD_DUAL_SGMII_EN); diff --git a/target/linux/generic/backport-6.6/790-22-v6.9-net-dsa-mt7530-get-rid-of-useless-error-returns-on-p.patch b/target/linux/generic/backport-6.6/790-22-v6.9-net-dsa-mt7530-get-rid-of-useless-error-returns-on-p.patch index c9159a1c680bf6..e037c9883e80af 100644 --- a/target/linux/generic/backport-6.6/790-22-v6.9-net-dsa-mt7530-get-rid-of-useless-error-returns-on-p.patch +++ b/target/linux/generic/backport-6.6/790-22-v6.9-net-dsa-mt7530-get-rid-of-useless-error-returns-on-p.patch @@ -36,7 +36,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2800,7 +2800,7 @@ static void mt7988_mac_port_get_caps(str +@@ -2796,7 +2796,7 @@ static void mt7988_mac_port_get_caps(str } } @@ -45,7 +45,7 @@ Signed-off-by: Paolo Abeni mt7530_mac_config(struct dsa_switch *ds, int port, unsigned int mode, phy_interface_t interface) { -@@ -2810,22 +2810,14 @@ mt7530_mac_config(struct dsa_switch *ds, +@@ -2806,22 +2806,14 @@ mt7530_mac_config(struct dsa_switch *ds, mt7530_setup_port5(priv->ds, interface); else if (port == 6) mt7530_setup_port6(priv->ds, interface); @@ -71,7 +71,7 @@ Signed-off-by: Paolo Abeni val = mt7530_read(priv, MT7531_CLKGEN_CTRL); val |= GP_CLK_EN; val &= ~GP_MODE_MASK; -@@ -2853,20 +2845,14 @@ static int mt7531_rgmii_setup(struct mt7 +@@ -2849,20 +2841,14 @@ static int mt7531_rgmii_setup(struct mt7 case PHY_INTERFACE_MODE_RGMII_ID: break; default: @@ -95,7 +95,7 @@ Signed-off-by: Paolo Abeni mt7531_mac_config(struct dsa_switch *ds, int port, unsigned int mode, phy_interface_t interface) { -@@ -2874,42 +2860,21 @@ mt7531_mac_config(struct dsa_switch *ds, +@@ -2870,42 +2856,21 @@ mt7531_mac_config(struct dsa_switch *ds, struct phy_device *phydev; struct dsa_port *dp; @@ -143,7 +143,7 @@ Signed-off-by: Paolo Abeni } static struct phylink_pcs * -@@ -2938,17 +2903,11 @@ mt753x_phylink_mac_config(struct dsa_swi +@@ -2934,17 +2899,11 @@ mt753x_phylink_mac_config(struct dsa_swi u32 mcr_cur, mcr_new; switch (port) { @@ -162,7 +162,7 @@ Signed-off-by: Paolo Abeni if (priv->p5_intf_sel != P5_DISABLED) priv->p5_interface = state->interface; -@@ -2957,16 +2916,10 @@ mt753x_phylink_mac_config(struct dsa_swi +@@ -2953,16 +2912,10 @@ mt753x_phylink_mac_config(struct dsa_swi if (priv->p6_interface == state->interface) break; @@ -180,7 +180,7 @@ Signed-off-by: Paolo Abeni } mcr_cur = mt7530_read(priv, MT7530_PMCR_P(port)); -@@ -3049,7 +3002,6 @@ mt7531_cpu_port_config(struct dsa_switch +@@ -3045,7 +2998,6 @@ mt7531_cpu_port_config(struct dsa_switch struct mt7530_priv *priv = ds->priv; phy_interface_t interface; int speed; @@ -188,7 +188,7 @@ Signed-off-by: Paolo Abeni switch (port) { case 5: -@@ -3074,9 +3026,8 @@ mt7531_cpu_port_config(struct dsa_switch +@@ -3070,9 +3022,8 @@ mt7531_cpu_port_config(struct dsa_switch else speed = SPEED_1000; diff --git a/target/linux/generic/backport-6.6/790-23-v6.9-net-dsa-mt7530-get-rid-of-priv-info-cpu_port_config.patch b/target/linux/generic/backport-6.6/790-23-v6.9-net-dsa-mt7530-get-rid-of-priv-info-cpu_port_config.patch index c52cb0d5ea0b3c..d85b40f91a7d83 100644 --- a/target/linux/generic/backport-6.6/790-23-v6.9-net-dsa-mt7530-get-rid-of-priv-info-cpu_port_config.patch +++ b/target/linux/generic/backport-6.6/790-23-v6.9-net-dsa-mt7530-get-rid-of-priv-info-cpu_port_config.patch @@ -117,7 +117,7 @@ Signed-off-by: Paolo Abeni } else { mt7530_port_disable(ds, i); -@@ -2680,10 +2664,6 @@ mt7531_setup(struct dsa_switch *ds) +@@ -2681,10 +2665,6 @@ mt7531_setup(struct dsa_switch *ds) mt7530_rmw(priv, MT7531_GPIO_MODE0, MT7531_GPIO0_MASK, MT7531_GPIO0_INTERRUPT); @@ -128,7 +128,7 @@ Signed-off-by: Paolo Abeni /* Enable Energy-Efficient Ethernet (EEE) and PHY core PLL, since * phy_device has not yet been created provided for * phy_[read,write]_mmd_indirect is called, we provide our own -@@ -2902,26 +2882,9 @@ mt753x_phylink_mac_config(struct dsa_swi +@@ -2898,26 +2878,9 @@ mt753x_phylink_mac_config(struct dsa_swi struct mt7530_priv *priv = ds->priv; u32 mcr_cur, mcr_new; @@ -156,7 +156,7 @@ Signed-off-by: Paolo Abeni mcr_cur = mt7530_read(priv, MT7530_PMCR_P(port)); mcr_new = mcr_cur; mcr_new &= ~PMCR_LINK_SETTINGS_MASK; -@@ -2957,17 +2920,10 @@ static void mt753x_phylink_mac_link_up(s +@@ -2953,17 +2916,10 @@ static void mt753x_phylink_mac_link_up(s mcr = PMCR_RX_EN | PMCR_TX_EN | PMCR_FORCE_LNK; @@ -176,7 +176,7 @@ Signed-off-by: Paolo Abeni mcr |= PMCR_FORCE_SPEED_1000; break; case SPEED_100: -@@ -2985,6 +2941,7 @@ static void mt753x_phylink_mac_link_up(s +@@ -2981,6 +2937,7 @@ static void mt753x_phylink_mac_link_up(s if (mode == MLO_AN_PHY && phydev && phy_init_eee(phydev, false) >= 0) { switch (speed) { case SPEED_1000: @@ -184,7 +184,7 @@ Signed-off-by: Paolo Abeni mcr |= PMCR_FORCE_EEE1G; break; case SPEED_100: -@@ -2996,61 +2953,6 @@ static void mt753x_phylink_mac_link_up(s +@@ -2992,61 +2949,6 @@ static void mt753x_phylink_mac_link_up(s mt7530_set(priv, MT7530_PMCR_P(port), mcr); } @@ -246,7 +246,7 @@ Signed-off-by: Paolo Abeni static void mt753x_phylink_get_caps(struct dsa_switch *ds, int port, struct phylink_config *config) { -@@ -3309,7 +3211,6 @@ const struct mt753x_info mt753x_table[] +@@ -3305,7 +3207,6 @@ const struct mt753x_info mt753x_table[] .phy_write_c22 = mt7531_ind_c22_phy_write, .phy_read_c45 = mt7531_ind_c45_phy_read, .phy_write_c45 = mt7531_ind_c45_phy_write, @@ -254,7 +254,7 @@ Signed-off-by: Paolo Abeni .mac_port_get_caps = mt7531_mac_port_get_caps, .mac_port_config = mt7531_mac_config, }, -@@ -3321,7 +3222,6 @@ const struct mt753x_info mt753x_table[] +@@ -3317,7 +3218,6 @@ const struct mt753x_info mt753x_table[] .phy_write_c22 = mt7531_ind_c22_phy_write, .phy_read_c45 = mt7531_ind_c45_phy_read, .phy_write_c45 = mt7531_ind_c45_phy_write, diff --git a/target/linux/generic/backport-6.6/790-24-v6.9-net-dsa-mt7530-get-rid-of-mt753x_mac_config.patch b/target/linux/generic/backport-6.6/790-24-v6.9-net-dsa-mt7530-get-rid-of-mt753x_mac_config.patch index 7fe77c506e7f09..47b77fca529417 100644 --- a/target/linux/generic/backport-6.6/790-24-v6.9-net-dsa-mt7530-get-rid-of-mt753x_mac_config.patch +++ b/target/linux/generic/backport-6.6/790-24-v6.9-net-dsa-mt7530-get-rid-of-mt753x_mac_config.patch @@ -18,7 +18,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2847,16 +2847,6 @@ mt7531_mac_config(struct dsa_switch *ds, +@@ -2843,16 +2843,6 @@ mt7531_mac_config(struct dsa_switch *ds, } } @@ -35,7 +35,7 @@ Signed-off-by: Paolo Abeni static struct phylink_pcs * mt753x_phylink_mac_select_pcs(struct dsa_switch *ds, int port, phy_interface_t interface) -@@ -2882,8 +2872,8 @@ mt753x_phylink_mac_config(struct dsa_swi +@@ -2878,8 +2868,8 @@ mt753x_phylink_mac_config(struct dsa_swi struct mt7530_priv *priv = ds->priv; u32 mcr_cur, mcr_new; diff --git a/target/linux/generic/backport-6.6/790-25-v6.9-net-dsa-mt7530-put-initialising-PCS-devices-code-bac.patch b/target/linux/generic/backport-6.6/790-25-v6.9-net-dsa-mt7530-put-initialising-PCS-devices-code-bac.patch index bd5c9b97720715..84b6430937f9bb 100644 --- a/target/linux/generic/backport-6.6/790-25-v6.9-net-dsa-mt7530-put-initialising-PCS-devices-code-bac.patch +++ b/target/linux/generic/backport-6.6/790-25-v6.9-net-dsa-mt7530-put-initialising-PCS-devices-code-bac.patch @@ -20,7 +20,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -3025,17 +3025,9 @@ static int +@@ -3021,17 +3021,9 @@ static int mt753x_setup(struct dsa_switch *ds) { struct mt7530_priv *priv = ds->priv; @@ -40,7 +40,7 @@ Signed-off-by: Paolo Abeni if (ret) return ret; -@@ -3047,6 +3039,14 @@ mt753x_setup(struct dsa_switch *ds) +@@ -3043,6 +3035,14 @@ mt753x_setup(struct dsa_switch *ds) if (ret && priv->irq) mt7530_free_irq_common(priv); diff --git a/target/linux/generic/backport-6.6/790-27-v6.9-net-dsa-mt7530-simplify-link-operations.patch b/target/linux/generic/backport-6.6/790-27-v6.9-net-dsa-mt7530-simplify-link-operations.patch index 54f5a59a64aa38..51ccc693514124 100644 --- a/target/linux/generic/backport-6.6/790-27-v6.9-net-dsa-mt7530-simplify-link-operations.patch +++ b/target/linux/generic/backport-6.6/790-27-v6.9-net-dsa-mt7530-simplify-link-operations.patch @@ -45,7 +45,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2880,23 +2880,13 @@ mt753x_phylink_mac_config(struct dsa_swi +@@ -2876,23 +2876,13 @@ mt753x_phylink_mac_config(struct dsa_swi const struct phylink_link_state *state) { struct mt7530_priv *priv = ds->priv; diff --git a/target/linux/generic/backport-6.6/790-33-v6.10-net-dsa-mt7530-provide-own-phylink-MAC-operations.patch b/target/linux/generic/backport-6.6/790-33-v6.10-net-dsa-mt7530-provide-own-phylink-MAC-operations.patch index 5eade735ec0435..15d876d29c797d 100644 --- a/target/linux/generic/backport-6.6/790-33-v6.10-net-dsa-mt7530-provide-own-phylink-MAC-operations.patch +++ b/target/linux/generic/backport-6.6/790-33-v6.10-net-dsa-mt7530-provide-own-phylink-MAC-operations.patch @@ -19,7 +19,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2858,28 +2858,34 @@ mt7531_mac_config(struct dsa_switch *ds, +@@ -2854,28 +2854,34 @@ mt7531_mac_config(struct dsa_switch *ds, } static struct phylink_pcs * @@ -60,7 +60,7 @@ Signed-off-by: Paolo Abeni if ((port == 5 || port == 6) && priv->info->mac_port_config) priv->info->mac_port_config(ds, port, mode, state->interface); -@@ -2889,23 +2895,25 @@ mt753x_phylink_mac_config(struct dsa_swi +@@ -2885,23 +2891,25 @@ mt753x_phylink_mac_config(struct dsa_swi mt7530_set(priv, MT7530_PMCR_P(port), PMCR_EXT_PHY); } @@ -92,7 +92,7 @@ Signed-off-by: Paolo Abeni u32 mcr; mcr = PMCR_RX_EN | PMCR_TX_EN | PMCR_FORCE_LNK; -@@ -2940,7 +2948,7 @@ static void mt753x_phylink_mac_link_up(s +@@ -2936,7 +2944,7 @@ static void mt753x_phylink_mac_link_up(s } } @@ -101,7 +101,7 @@ Signed-off-by: Paolo Abeni } static void mt753x_phylink_get_caps(struct dsa_switch *ds, int port, -@@ -3160,16 +3168,19 @@ const struct dsa_switch_ops mt7530_switc +@@ -3156,16 +3164,19 @@ const struct dsa_switch_ops mt7530_switc .port_mirror_add = mt753x_port_mirror_add, .port_mirror_del = mt753x_port_mirror_del, .phylink_get_caps = mt753x_phylink_get_caps, @@ -125,7 +125,7 @@ Signed-off-by: Paolo Abeni const struct mt753x_info mt753x_table[] = { [ID_MT7621] = { .id = ID_MT7621, -@@ -3247,6 +3258,7 @@ mt7530_probe_common(struct mt7530_priv * +@@ -3243,6 +3254,7 @@ mt7530_probe_common(struct mt7530_priv * priv->dev = dev; priv->ds->priv = priv; priv->ds->ops = &mt7530_switch_ops; diff --git a/target/linux/generic/backport-6.6/790-36-v6.10-net-dsa-mt7530-mdio-read-PHY-address-of-switch-from-.patch b/target/linux/generic/backport-6.6/790-36-v6.10-net-dsa-mt7530-mdio-read-PHY-address-of-switch-from-.patch index a6cbb0fc6b88ab..6a93090c44b3ce 100644 --- a/target/linux/generic/backport-6.6/790-36-v6.10-net-dsa-mt7530-mdio-read-PHY-address-of-switch-from-.patch +++ b/target/linux/generic/backport-6.6/790-36-v6.10-net-dsa-mt7530-mdio-read-PHY-address-of-switch-from-.patch @@ -184,7 +184,7 @@ Signed-off-by: Paolo Abeni err: if (ret < 0) dev_err(&bus->dev, -@@ -2679,16 +2687,19 @@ mt7531_setup(struct dsa_switch *ds) +@@ -2680,16 +2688,19 @@ mt7531_setup(struct dsa_switch *ds) * phy_[read,write]_mmd_indirect is called, we provide our own * mt7531_ind_mmd_phy_[read,write] to complete this function. */ diff --git a/target/linux/generic/backport-6.6/790-39-v6.10-net-dsa-mt7530-refactor-MT7530_PMCR_P.patch b/target/linux/generic/backport-6.6/790-39-v6.10-net-dsa-mt7530-refactor-MT7530_PMCR_P.patch index 89fad45dd5d7a0..1d42750aff00ea 100644 --- a/target/linux/generic/backport-6.6/790-39-v6.10-net-dsa-mt7530-refactor-MT7530_PMCR_P.patch +++ b/target/linux/generic/backport-6.6/790-39-v6.10-net-dsa-mt7530-refactor-MT7530_PMCR_P.patch @@ -64,7 +64,7 @@ Signed-off-by: Arınç ÜNAL /* Disable forwarding by default on all ports */ mt7530_rmw(priv, MT7530_PCR_P(i), PCR_MATRIX_MASK, -@@ -2639,7 +2639,7 @@ mt7531_setup(struct dsa_switch *ds) +@@ -2640,7 +2640,7 @@ mt7531_setup(struct dsa_switch *ds) /* Force link down on all ports before internal reset */ for (i = 0; i < MT7530_NUM_PORTS; i++) @@ -73,7 +73,7 @@ Signed-off-by: Arınç ÜNAL /* Reset the switch through internal reset */ mt7530_write(priv, MT7530_SYS_CTRL, SYS_CTRL_SW_RST | SYS_CTRL_REG_RST); -@@ -2881,7 +2881,7 @@ mt753x_phylink_mac_config(struct phylink +@@ -2877,7 +2877,7 @@ mt753x_phylink_mac_config(struct phylink /* Are we connected to external phy */ if (port == 5 && dsa_is_user_port(ds, 5)) @@ -82,7 +82,7 @@ Signed-off-by: Arınç ÜNAL } static void mt753x_phylink_mac_link_down(struct phylink_config *config, -@@ -2891,7 +2891,7 @@ static void mt753x_phylink_mac_link_down +@@ -2887,7 +2887,7 @@ static void mt753x_phylink_mac_link_down struct dsa_port *dp = dsa_phylink_to_port(config); struct mt7530_priv *priv = dp->ds->priv; @@ -91,7 +91,7 @@ Signed-off-by: Arınç ÜNAL } static void mt753x_phylink_mac_link_up(struct phylink_config *config, -@@ -2905,7 +2905,7 @@ static void mt753x_phylink_mac_link_up(s +@@ -2901,7 +2901,7 @@ static void mt753x_phylink_mac_link_up(s struct mt7530_priv *priv = dp->ds->priv; u32 mcr; @@ -100,7 +100,7 @@ Signed-off-by: Arınç ÜNAL switch (speed) { case SPEED_1000: -@@ -2920,9 +2920,9 @@ static void mt753x_phylink_mac_link_up(s +@@ -2916,9 +2916,9 @@ static void mt753x_phylink_mac_link_up(s if (duplex == DUPLEX_FULL) { mcr |= PMCR_FORCE_FDX; if (tx_pause) @@ -112,7 +112,7 @@ Signed-off-by: Arınç ÜNAL } if (mode == MLO_AN_PHY && phydev && phy_init_eee(phydev, false) >= 0) { -@@ -2937,7 +2937,7 @@ static void mt753x_phylink_mac_link_up(s +@@ -2933,7 +2933,7 @@ static void mt753x_phylink_mac_link_up(s } } diff --git a/target/linux/generic/backport-6.6/790-40-v6.10-net-dsa-mt7530-rename-p5_intf_sel-and-use-only-for-M.patch b/target/linux/generic/backport-6.6/790-40-v6.10-net-dsa-mt7530-rename-p5_intf_sel-and-use-only-for-M.patch index 601171a5949fc0..3bcdc1a27c4dda 100644 --- a/target/linux/generic/backport-6.6/790-40-v6.10-net-dsa-mt7530-rename-p5_intf_sel-and-use-only-for-M.patch +++ b/target/linux/generic/backport-6.6/790-40-v6.10-net-dsa-mt7530-rename-p5_intf_sel-and-use-only-for-M.patch @@ -135,7 +135,7 @@ Signed-off-by: Arınç ÜNAL mt7530_setup_port5(ds, interface); } -@@ -2654,9 +2647,6 @@ mt7531_setup(struct dsa_switch *ds) +@@ -2655,9 +2648,6 @@ mt7531_setup(struct dsa_switch *ds) MT7531_EXT_P_MDIO_12); } diff --git a/target/linux/generic/backport-6.6/790-42-v6.10-net-dsa-mt7530-refactor-MT7530_MFC-and-MT7531_CFC-ad.patch b/target/linux/generic/backport-6.6/790-42-v6.10-net-dsa-mt7530-refactor-MT7530_MFC-and-MT7531_CFC-ad.patch index a5d293b509516a..e72424c5f1f14e 100644 --- a/target/linux/generic/backport-6.6/790-42-v6.10-net-dsa-mt7530-refactor-MT7530_MFC-and-MT7531_CFC-ad.patch +++ b/target/linux/generic/backport-6.6/790-42-v6.10-net-dsa-mt7530-refactor-MT7530_MFC-and-MT7531_CFC-ad.patch @@ -101,7 +101,7 @@ Signed-off-by: Arınç ÜNAL UNU_FFP_MASK); for (i = 0; i < MT7530_NUM_PORTS; i++) { -@@ -3089,10 +3075,12 @@ mt753x_conduit_state_change(struct dsa_s +@@ -3085,10 +3071,12 @@ mt753x_conduit_state_change(struct dsa_s else priv->active_cpu_ports &= ~mask; diff --git a/target/linux/generic/backport-6.6/790-43-v6.10-net-dsa-mt7530-refactor-MT7530_HWTRAP-and-MT7530_MHW.patch b/target/linux/generic/backport-6.6/790-43-v6.10-net-dsa-mt7530-refactor-MT7530_HWTRAP-and-MT7530_MHW.patch index 1f66575f02c149..1e907c51a0ad6f 100644 --- a/target/linux/generic/backport-6.6/790-43-v6.10-net-dsa-mt7530-refactor-MT7530_HWTRAP-and-MT7530_MHW.patch +++ b/target/linux/generic/backport-6.6/790-43-v6.10-net-dsa-mt7530-refactor-MT7530_HWTRAP-and-MT7530_MHW.patch @@ -189,7 +189,7 @@ Signed-off-by: Arınç ÜNAL mt7530_pll_setup(priv); mt753x_trap_frames(priv); -@@ -2586,7 +2587,7 @@ mt7531_setup(struct dsa_switch *ds) +@@ -2587,7 +2588,7 @@ mt7531_setup(struct dsa_switch *ds) } /* Waiting for MT7530 got to stable */ diff --git a/target/linux/generic/backport-6.6/790-45-v6.10-net-dsa-mt7530-return-mt7530_setup_mdio-mt7531_setup.patch b/target/linux/generic/backport-6.6/790-45-v6.10-net-dsa-mt7530-return-mt7530_setup_mdio-mt7531_setup.patch index 2eaa77c8cf6a62..5b1ff14de6c039 100644 --- a/target/linux/generic/backport-6.6/790-45-v6.10-net-dsa-mt7530-return-mt7530_setup_mdio-mt7531_setup.patch +++ b/target/linux/generic/backport-6.6/790-45-v6.10-net-dsa-mt7530-return-mt7530_setup_mdio-mt7531_setup.patch @@ -17,7 +17,7 @@ Signed-off-by: Arınç ÜNAL --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2667,7 +2667,9 @@ mt7531_setup(struct dsa_switch *ds) +@@ -2668,7 +2668,9 @@ mt7531_setup(struct dsa_switch *ds) 0); } @@ -26,9 +26,9 @@ Signed-off-by: Arınç ÜNAL + if (ret) + return ret; - /* Setup VLAN ID 0 for VLAN-unaware bridges */ - ret = mt7530_setup_vlan0(priv); -@@ -3020,6 +3022,8 @@ mt753x_setup(struct dsa_switch *ds) + ds->assisted_learning_on_cpu_port = true; + ds->mtu_enforcement_ingress = true; +@@ -3016,6 +3018,8 @@ mt753x_setup(struct dsa_switch *ds) ret = mt7530_setup_mdio(priv); if (ret && priv->irq) mt7530_free_irq_common(priv); diff --git a/target/linux/generic/backport-6.6/790-46-v6.10-net-dsa-mt7530-define-MAC-speed-capabilities-per-swi.patch b/target/linux/generic/backport-6.6/790-46-v6.10-net-dsa-mt7530-define-MAC-speed-capabilities-per-swi.patch index 9a592c759d69a0..b7c2edf4c3416e 100644 --- a/target/linux/generic/backport-6.6/790-46-v6.10-net-dsa-mt7530-define-MAC-speed-capabilities-per-swi.patch +++ b/target/linux/generic/backport-6.6/790-46-v6.10-net-dsa-mt7530-define-MAC-speed-capabilities-per-swi.patch @@ -24,7 +24,7 @@ Signed-off-by: Arınç ÜNAL --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2685,6 +2685,8 @@ mt7531_setup(struct dsa_switch *ds) +@@ -2681,6 +2681,8 @@ mt7531_setup(struct dsa_switch *ds) static void mt7530_mac_port_get_caps(struct dsa_switch *ds, int port, struct phylink_config *config) { @@ -33,7 +33,7 @@ Signed-off-by: Arınç ÜNAL switch (port) { /* Ports which are connected to switch PHYs. There is no MII pinout. */ case 0 ... 4: -@@ -2716,6 +2718,8 @@ static void mt7531_mac_port_get_caps(str +@@ -2712,6 +2714,8 @@ static void mt7531_mac_port_get_caps(str { struct mt7530_priv *priv = ds->priv; @@ -42,7 +42,7 @@ Signed-off-by: Arınç ÜNAL switch (port) { /* Ports which are connected to switch PHYs. There is no MII pinout. */ case 0 ... 4: -@@ -2755,14 +2759,17 @@ static void mt7988_mac_port_get_caps(str +@@ -2751,14 +2755,17 @@ static void mt7988_mac_port_get_caps(str case 0 ... 3: __set_bit(PHY_INTERFACE_MODE_INTERNAL, config->supported_interfaces); @@ -62,7 +62,7 @@ Signed-off-by: Arınç ÜNAL } } -@@ -2932,9 +2939,7 @@ static void mt753x_phylink_get_caps(stru +@@ -2928,9 +2935,7 @@ static void mt753x_phylink_get_caps(stru { struct mt7530_priv *priv = ds->priv; diff --git a/target/linux/generic/backport-6.6/790-47-v6.10-net-dsa-mt7530-get-rid-of-function-sanity-check.patch b/target/linux/generic/backport-6.6/790-47-v6.10-net-dsa-mt7530-get-rid-of-function-sanity-check.patch index bc84ecb778d0ee..8a933f0066cf37 100644 --- a/target/linux/generic/backport-6.6/790-47-v6.10-net-dsa-mt7530-get-rid-of-function-sanity-check.patch +++ b/target/linux/generic/backport-6.6/790-47-v6.10-net-dsa-mt7530-get-rid-of-function-sanity-check.patch @@ -17,7 +17,7 @@ Signed-off-by: Arınç ÜNAL --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -3232,13 +3232,6 @@ mt7530_probe_common(struct mt7530_priv * +@@ -3228,13 +3228,6 @@ mt7530_probe_common(struct mt7530_priv * if (!priv->info) return -EINVAL; diff --git a/target/linux/generic/backport-6.6/790-48-v6.10-net-dsa-mt7530-refactor-MT7530_PMEEECR_P.patch b/target/linux/generic/backport-6.6/790-48-v6.10-net-dsa-mt7530-refactor-MT7530_PMEEECR_P.patch index e75db9ba3040a7..50616f0524eb92 100644 --- a/target/linux/generic/backport-6.6/790-48-v6.10-net-dsa-mt7530-refactor-MT7530_PMEEECR_P.patch +++ b/target/linux/generic/backport-6.6/790-48-v6.10-net-dsa-mt7530-refactor-MT7530_PMEEECR_P.patch @@ -19,7 +19,7 @@ Signed-off-by: Arınç ÜNAL --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -3051,10 +3051,10 @@ static int mt753x_get_mac_eee(struct dsa +@@ -3047,10 +3047,10 @@ static int mt753x_get_mac_eee(struct dsa struct ethtool_eee *e) { struct mt7530_priv *priv = ds->priv; @@ -32,7 +32,7 @@ Signed-off-by: Arınç ÜNAL return 0; } -@@ -3068,11 +3068,11 @@ static int mt753x_set_mac_eee(struct dsa +@@ -3064,11 +3064,11 @@ static int mt753x_set_mac_eee(struct dsa if (e->tx_lpi_timer > 0xFFF) return -EINVAL; diff --git a/target/linux/generic/backport-6.6/790-50-v6.10-net-dsa-mt7530-use-priv-ds-num_ports-instead-of-MT75.patch b/target/linux/generic/backport-6.6/790-50-v6.10-net-dsa-mt7530-use-priv-ds-num_ports-instead-of-MT75.patch index f63d4d7705d6e6..12749812ba878c 100644 --- a/target/linux/generic/backport-6.6/790-50-v6.10-net-dsa-mt7530-use-priv-ds-num_ports-instead-of-MT75.patch +++ b/target/linux/generic/backport-6.6/790-50-v6.10-net-dsa-mt7530-use-priv-ds-num_ports-instead-of-MT75.patch @@ -46,7 +46,7 @@ Signed-off-by: Arınç ÜNAL /* Clear link settings and enable force mode to force link down * on all ports until they're enabled later. */ -@@ -2626,7 +2626,7 @@ mt7531_setup(struct dsa_switch *ds) +@@ -2627,7 +2627,7 @@ mt7531_setup(struct dsa_switch *ds) priv->p5_sgmii = !!(val & PAD_DUAL_SGMII_EN); /* Force link down on all ports before internal reset */ diff --git a/target/linux/generic/backport-6.6/790-51-v6.10-net-dsa-mt7530-do-not-pass-port-variable-to-mt7531_r.patch b/target/linux/generic/backport-6.6/790-51-v6.10-net-dsa-mt7530-do-not-pass-port-variable-to-mt7531_r.patch index 9ba12b1269f1d2..5d2a815ccee3a1 100644 --- a/target/linux/generic/backport-6.6/790-51-v6.10-net-dsa-mt7530-do-not-pass-port-variable-to-mt7531_r.patch +++ b/target/linux/generic/backport-6.6/790-51-v6.10-net-dsa-mt7530-do-not-pass-port-variable-to-mt7531_r.patch @@ -17,7 +17,7 @@ Signed-off-by: Arınç ÜNAL --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2785,7 +2785,7 @@ mt7530_mac_config(struct dsa_switch *ds, +@@ -2781,7 +2781,7 @@ mt7530_mac_config(struct dsa_switch *ds, mt7530_setup_port6(priv->ds, interface); } @@ -26,7 +26,7 @@ Signed-off-by: Arınç ÜNAL phy_interface_t interface, struct phy_device *phydev) { -@@ -2836,7 +2836,7 @@ mt7531_mac_config(struct dsa_switch *ds, +@@ -2832,7 +2832,7 @@ mt7531_mac_config(struct dsa_switch *ds, if (phy_interface_mode_is_rgmii(interface)) { dp = dsa_to_port(ds, port); phydev = dp->slave->phydev; diff --git a/target/linux/generic/backport-6.6/790-52-v6.10-net-dsa-mt7530-explain-exposing-MDIO-bus-of-MT7531AE.patch b/target/linux/generic/backport-6.6/790-52-v6.10-net-dsa-mt7530-explain-exposing-MDIO-bus-of-MT7531AE.patch index 58c3e0bc3ce671..8a0a0685085dd3 100644 --- a/target/linux/generic/backport-6.6/790-52-v6.10-net-dsa-mt7530-explain-exposing-MDIO-bus-of-MT7531AE.patch +++ b/target/linux/generic/backport-6.6/790-52-v6.10-net-dsa-mt7530-explain-exposing-MDIO-bus-of-MT7531AE.patch @@ -19,7 +19,7 @@ Signed-off-by: Arınç ÜNAL --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2635,7 +2635,10 @@ mt7531_setup(struct dsa_switch *ds) +@@ -2636,7 +2636,10 @@ mt7531_setup(struct dsa_switch *ds) if (!priv->p5_sgmii) { mt7531_pll_setup(priv); } else { diff --git a/target/linux/generic/pending-6.6/680-net-add-TCP-fraglist-GRO-support.patch b/target/linux/generic/pending-6.6/680-net-add-TCP-fraglist-GRO-support.patch index ca7c624447eb82..fcc6a1f14fa178 100644 --- a/target/linux/generic/pending-6.6/680-net-add-TCP-fraglist-GRO-support.patch +++ b/target/linux/generic/pending-6.6/680-net-add-TCP-fraglist-GRO-support.patch @@ -81,7 +81,7 @@ Signe-off-by: Felix Fietkau { --- a/net/ipv4/tcp_offload.c +++ b/net/ipv4/tcp_offload.c -@@ -28,6 +28,70 @@ static void tcp_gso_tstamp(struct sk_buf +@@ -31,6 +31,70 @@ static void tcp_gso_tstamp(struct sk_buf } } @@ -152,7 +152,7 @@ Signe-off-by: Felix Fietkau static struct sk_buff *tcp4_gso_segment(struct sk_buff *skb, netdev_features_t features) { -@@ -37,6 +101,9 @@ static struct sk_buff *tcp4_gso_segment( +@@ -40,6 +104,9 @@ static struct sk_buff *tcp4_gso_segment( if (!pskb_may_pull(skb, sizeof(struct tcphdr))) return ERR_PTR(-EINVAL); @@ -162,7 +162,7 @@ Signe-off-by: Felix Fietkau if (unlikely(skb->ip_summed != CHECKSUM_PARTIAL)) { const struct iphdr *iph = ip_hdr(skb); struct tcphdr *th = tcp_hdr(skb); -@@ -181,61 +248,76 @@ out: +@@ -184,61 +251,76 @@ out: return segs; } @@ -269,7 +269,7 @@ Signe-off-by: Felix Fietkau flush = NAPI_GRO_CB(p)->flush; flush |= (__force int)(flags & TCP_FLAG_CWR); flush |= (__force int)((flags ^ tcp_flag_word(th2)) & -@@ -272,6 +354,19 @@ found: +@@ -275,6 +357,19 @@ found: flush |= p->decrypted ^ skb->decrypted; #endif @@ -289,7 +289,7 @@ Signe-off-by: Felix Fietkau if (flush || skb_gro_receive(p, skb)) { mss = 1; goto out_check_final; -@@ -293,7 +388,6 @@ out_check_final: +@@ -296,7 +391,6 @@ out_check_final: if (p && (!NAPI_GRO_CB(skb)->same_flow || flush)) pp = p; @@ -297,7 +297,7 @@ Signe-off-by: Felix Fietkau NAPI_GRO_CB(skb)->flush |= (flush != 0); return pp; -@@ -317,18 +411,58 @@ void tcp_gro_complete(struct sk_buff *sk +@@ -320,18 +414,58 @@ void tcp_gro_complete(struct sk_buff *sk } EXPORT_SYMBOL(tcp_gro_complete); @@ -361,7 +361,7 @@ Signe-off-by: Felix Fietkau } INDIRECT_CALLABLE_SCOPE int tcp4_gro_complete(struct sk_buff *skb, int thoff) -@@ -336,6 +470,15 @@ INDIRECT_CALLABLE_SCOPE int tcp4_gro_com +@@ -339,6 +473,15 @@ INDIRECT_CALLABLE_SCOPE int tcp4_gro_com const struct iphdr *iph = ip_hdr(skb); struct tcphdr *th = tcp_hdr(skb); @@ -379,7 +379,7 @@ Signe-off-by: Felix Fietkau skb_shinfo(skb)->gso_type |= SKB_GSO_TCPV4; --- a/net/ipv4/udp_offload.c +++ b/net/ipv4/udp_offload.c -@@ -470,33 +470,6 @@ out: +@@ -474,33 +474,6 @@ out: return segs; } diff --git a/target/linux/generic/pending-6.6/685-net-gso-fix-tcp-fraglist-segmentation-after-pull-fro.patch b/target/linux/generic/pending-6.6/685-net-gso-fix-tcp-fraglist-segmentation-after-pull-fro.patch index 235762b5c01d63..ea0fe0c9ab45b7 100644 --- a/target/linux/generic/pending-6.6/685-net-gso-fix-tcp-fraglist-segmentation-after-pull-fro.patch +++ b/target/linux/generic/pending-6.6/685-net-gso-fix-tcp-fraglist-segmentation-after-pull-fro.patch @@ -36,7 +36,7 @@ Signed-off-by: Felix Fietkau --- a/net/ipv4/tcp_offload.c +++ b/net/ipv4/tcp_offload.c -@@ -101,8 +101,14 @@ static struct sk_buff *tcp4_gso_segment( +@@ -104,8 +104,14 @@ static struct sk_buff *tcp4_gso_segment( if (!pskb_may_pull(skb, sizeof(struct tcphdr))) return ERR_PTR(-EINVAL); diff --git a/target/linux/ipq40xx/patches-6.6/999-atm-mpoa-intel-dsl-phy-support.patch b/target/linux/ipq40xx/patches-6.6/999-atm-mpoa-intel-dsl-phy-support.patch index eab26ccb11d5f7..6a9bd44ab1609e 100644 --- a/target/linux/ipq40xx/patches-6.6/999-atm-mpoa-intel-dsl-phy-support.patch +++ b/target/linux/ipq40xx/patches-6.6/999-atm-mpoa-intel-dsl-phy-support.patch @@ -4,7 +4,7 @@ Subject: [PATCH] UGW_SW-29163: ATM oam support --- a/drivers/net/ppp/ppp_generic.c +++ b/drivers/net/ppp/ppp_generic.c -@@ -2968,6 +2968,22 @@ char *ppp_dev_name(struct ppp_channel *c +@@ -2978,6 +2978,22 @@ char *ppp_dev_name(struct ppp_channel *c return name; } @@ -27,7 +27,7 @@ Subject: [PATCH] UGW_SW-29163: ATM oam support /* * Disconnect a channel from the generic layer. -@@ -3614,6 +3630,7 @@ EXPORT_SYMBOL(ppp_unregister_channel); +@@ -3624,6 +3640,7 @@ EXPORT_SYMBOL(ppp_unregister_channel); EXPORT_SYMBOL(ppp_channel_index); EXPORT_SYMBOL(ppp_unit_number); EXPORT_SYMBOL(ppp_dev_name); diff --git a/target/linux/rockchip/patches-6.6/034-v6.7-usb-dwc3-add-optional-PHY-interface-clocks.patch b/target/linux/rockchip/patches-6.6/034-v6.7-usb-dwc3-add-optional-PHY-interface-clocks.patch index 26fedf0a6556a7..4d358ea21954a1 100644 --- a/target/linux/rockchip/patches-6.6/034-v6.7-usb-dwc3-add-optional-PHY-interface-clocks.patch +++ b/target/linux/rockchip/patches-6.6/034-v6.7-usb-dwc3-add-optional-PHY-interface-clocks.patch @@ -18,7 +18,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c -@@ -845,8 +845,20 @@ static int dwc3_clk_enable(struct dwc3 * +@@ -860,8 +860,20 @@ static int dwc3_clk_enable(struct dwc3 * if (ret) goto disable_ref_clk; @@ -39,7 +39,7 @@ Signed-off-by: Greg Kroah-Hartman disable_ref_clk: clk_disable_unprepare(dwc->ref_clk); disable_bus_clk: -@@ -856,6 +868,8 @@ disable_bus_clk: +@@ -871,6 +883,8 @@ disable_bus_clk: static void dwc3_clk_disable(struct dwc3 *dwc) { @@ -48,7 +48,7 @@ Signed-off-by: Greg Kroah-Hartman clk_disable_unprepare(dwc->susp_clk); clk_disable_unprepare(dwc->ref_clk); clk_disable_unprepare(dwc->bus_clk); -@@ -1875,6 +1889,20 @@ static int dwc3_get_clocks(struct dwc3 * +@@ -1886,6 +1900,20 @@ static int dwc3_get_clocks(struct dwc3 * } } diff --git a/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch b/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch index 7c5c522f91301b..b5d9802d90df95 100644 --- a/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch +++ b/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch @@ -128,7 +128,7 @@ Signed-off-by: minda.chen int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) { dma_addr_t dma; -@@ -2436,6 +2494,12 @@ int xhci_mem_init(struct xhci_hcd *xhci, +@@ -2437,6 +2495,12 @@ int xhci_mem_init(struct xhci_hcd *xhci, xhci->isoc_bei_interval = AVOID_BEI_INTERVAL_MAX; diff --git a/target/linux/starfive/patches-6.6/0110-usb-xhci-using-dma_alloc_noncoherent-to-alloc-low-me.patch b/target/linux/starfive/patches-6.6/0110-usb-xhci-using-dma_alloc_noncoherent-to-alloc-low-me.patch index a9c03feecf684e..fad99301e6a1b9 100644 --- a/target/linux/starfive/patches-6.6/0110-usb-xhci-using-dma_alloc_noncoherent-to-alloc-low-me.patch +++ b/target/linux/starfive/patches-6.6/0110-usb-xhci-using-dma_alloc_noncoherent-to-alloc-low-me.patch @@ -71,7 +71,7 @@ Signed-off-by: Minda Chen INIT_LIST_HEAD(&xhci->cmd_list); -@@ -2495,9 +2496,11 @@ int xhci_mem_init(struct xhci_hcd *xhci, +@@ -2496,9 +2497,11 @@ int xhci_mem_init(struct xhci_hcd *xhci, xhci->isoc_bei_interval = AVOID_BEI_INTERVAL_MAX; if (xhci->quirks & XHCI_LOCAL_BUFFER) { From 07fb8d22e7b17e3634d3c807f0a4757044684bd4 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 9 Mar 2025 16:43:58 +0100 Subject: [PATCH 563/877] unetd: update to Git HEAD (2025-03-09) d8b43985e4d7 ubus: fix token_create policy 7326459bd743 ubus: dump service information on network_get 6c9c8fbd8128 service: add @all as alias for all members, unless defined differently Signed-off-by: Felix Fietkau (cherry picked from commit 84909c62c8455a08fb8bb29bd7809ab22c927bf0) --- 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 29b192e4f1dcd6..3a0ded804e73b8 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:=2025-02-28 -PKG_SOURCE_VERSION:=edc8fdae463ad7ce9bfb876af0c653ab1da197df -PKG_MIRROR_HASH:=2f0ce439b9e4815b3f20b9aaf4378e3aac114f429bb8bfd06739df118b3da9c8 +PKG_SOURCE_DATE:=2025-03-09 +PKG_SOURCE_VERSION:=6c9c8fbd81285a2cba7dd1c2c1ac2bf25ca99e27 +PKG_MIRROR_HASH:=9dc06c945713a6a289ed0838ebe59e65b4fbb333e02d5159a8e87d29754808a6 PKG_LICENSE:=GPL-2.0 PKG_MAINTAINER:=Felix Fietkau From 7f5659b79d9996409d3cb7b20446183696005785 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Sat, 15 Mar 2025 11:54:08 +0100 Subject: [PATCH 564/877] bcm27xx-gpu-fw: update to v1.20250305 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Full changelog: https://github.com/raspberrypi/firmware/compare/1.20241126...1.20250305 Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 2804cfe553c8cb67be08599407030d522862abcb) --- package/kernel/bcm27xx-gpu-fw/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/kernel/bcm27xx-gpu-fw/Makefile b/package/kernel/bcm27xx-gpu-fw/Makefile index d4b3424b91ea12..580290d88016da 100644 --- a/package/kernel/bcm27xx-gpu-fw/Makefile +++ b/package/kernel/bcm27xx-gpu-fw/Makefile @@ -2,13 +2,13 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=bcm27xx-gpu-fw -PKG_VERSION:=2024.11.26 +PKG_VERSION:=2025.03.05 PKG_VERSION_REAL:=1.$(subst .,,$(PKG_VERSION)) PKG_RELEASE:=1 PKG_SOURCE:=raspi-firmware_$(PKG_VERSION_REAL).orig.tar.xz PKG_SOURCE_URL:=https://github.com/raspberrypi/firmware/releases/download/$(PKG_VERSION_REAL) -PKG_HASH:=020dbcdbb30af5942a62fc3eb355449aba45276b67e864dee2522ff53fd936e6 +PKG_HASH:=f697079cd15389c0d8650283eb911c53a64b22550138704eb50e1145e8330b03 PKG_FLAGS:=nonshared From 36e9edd67726d30e7cb66c270b75d5b63b154da9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Sat, 15 Mar 2025 11:50:44 +0100 Subject: [PATCH 565/877] bcm27xx-utils: update to latest version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Full changelog: https://github.com/raspberrypi/utils/compare/0c02957911da1c661be201236c4f2a2be1778b3e...685afa8c0d6f2310eaefe1b528627a8bf3154ca0 Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 6403c2890cfc07e37d70c7cb5cfbc20207b5369d) --- package/utils/bcm27xx-utils/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/utils/bcm27xx-utils/Makefile b/package/utils/bcm27xx-utils/Makefile index 42a7f856888810..f1aafd666a673e 100644 --- a/package/utils/bcm27xx-utils/Makefile +++ b/package/utils/bcm27xx-utils/Makefile @@ -3,13 +3,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=bcm27xx-utils -PKG_VERSION:=2024.12.19 +PKG_VERSION:=2025.03.14 PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/raspberrypi/utils.git -PKG_SOURCE_VERSION:=0c02957911da1c661be201236c4f2a2be1778b3e -PKG_MIRROR_HASH:=8bc87c929726a13d3d3e16157033d13f78a1f85d548db131c45c3a4cbdd1e402 +PKG_SOURCE_VERSION:=685afa8c0d6f2310eaefe1b528627a8bf3154ca0 +PKG_MIRROR_HASH:=04528742fc5b55ba31f448a27588a9df707cbcc27823c1d219b7f877dd4ac200 PKG_FLAGS:=nonshared PKG_BUILD_FLAGS:=no-lto From 5872633b9d3e0b6838fde2ce8fb78da025999e74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Sat, 15 Mar 2025 11:43:43 +0100 Subject: [PATCH 566/877] bcm27xx: pull 6.6 patches from RPi repo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds latest 6.6 patches from the Raspberry Pi repository. These patches were generated from: https://github.com/raspberrypi/linux/commits/rpi-6.6.y/ With the following command: git format-patch -N v6.6.83..HEAD (HEAD -> 08d4e8f52256bd422d8a1f876411603f627d0a82) Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 251f76c1c67d62c585d799c38dab31e1385d2ad5) --- ...-add-FS-LS-bus-instance-parkmode-dis.patch | 10 +- ...d-support-for-setting-NAK-enhancemen.patch | 10 +- ...pdate-files-for-pwm-gpio-fan-overlay.patch | 246 ++ ...-Limit-analogue-gain-according-to-mo.patch | 71 + ...s-sony-imx290-Add-IMX462-to-the-IMX2.patch | 31 + ...-imx290-Add-configuration-for-IMX462.patch | 116 + ...-module-parameter-to-allow-selection.patch | 60 + ...h-imx462-overlay-to-use-the-new-comp.patch | 47 + ...imx415-Add-more-clock-configurations.patch | 327 +++ ...overlay-for-Sony-IMX415-image-sensor.patch | 214 ++ ...415-Add-read-write-control-of-VBLANK.patch | 146 ++ ...-Make-HBLANK-controllable-and-in-con.patch | 231 ++ ...-Link-frequencies-are-not-exclusive-.patch | 136 ++ ...cm2711-PL011-UARTs-are-actually-r1p5.patch | 60 + ...cm2712-PL011-UARTs-are-actually-r1p5.patch | 43 + ...ts-rp1-PL011-UARTs-are-actually-r1p5.patch | 70 + ...cm512x-Demote-No-SCLK-to-debug-level.patch | 25 + ...o-piano-dac-plus-Fix-volume-limiting.patch | 58 + ...piano-dac-plus-Remove-pointless-code.patch | 53 + ...2712-override-supports-cqe-to-a-cell.patch | 90 + ...rd-CQ-support-based-on-an-allow-list.patch | 57 + ...K_KNOWN_WORKING_SD_CQ-on-Raspberry-P.patch | 41 + ...am-DT-property-to-modify-CQE-and-or-.patch | 94 + ...509-misc-rp1-pio-Handle-probe-errors.patch | 38 + ...rmware-rp1-Simplify-rp1_firmware_get.patch | 84 + ...1-Don-t-mark-timer-regs-unconfigured.patch | 44 + ...-sdhost-Observe-SWIOTLB-memory-limit.patch | 29 + ...sp_be-Add-support-for-YUV422-planar-.patch | 31 + ...sp_be-Remove-unused-fields-in-struct.patch | 82 + ...ust-PLL-settings-based-on-the-number.patch | 163 ++ ...ne-option-to-the-device-tree-overlay.patch | 55 + ...hare-panel-Disable-new-touch-control.patch | 40 + ...Add-rgb_order-property-to-match-VC4-.patch | 325 +++ .../950-1522-add-ina238-to-i2c-sensors.patch | 102 + .../950-1524-add-shtc3-to-i2c-sensors.patch | 57 + ...i-Update-Hailo-accelerator-device-dr.patch | 2137 +++++++++++++++++ ...lays-Regularisation-and-improvements.patch | 139 ++ ...tor-out-the-common-i2c-bus-selection.patch | 1630 +++++++++++++ ...pio-SM_CONFIG_XFER32-larger-DMA-bufs.patch | 63 + ...0-1530-spi-dw-Wait-for-idle-after-TX.patch | 29 + ...o-Error-out-on-incompatible-firmware.patch | 42 + ...mware-rp1-Linger-on-firmware-failure.patch | 103 + ...rp1-Don-t-claim-channels-in-of_xlate.patch | 30 + ...-fixup-spi-dw-Wait-for-idle-after-TX.patch | 25 + ...support-for-Hifiberry-ADC8x-to-the-D.patch | 76 + ...ADC8x-support-to-the-Hifiberry-DAC8x.patch | 75 + ...c3-Set-DMA-and-coherent-masks-early.patch} | 67 +- ...d-OpenHydroponics-RootMaster-overlay.patch | 119 + ...m-pivariety-Fix-mutex-init-and-NULL-.patch | 37 + ...pio-Demote-fw-probe-error-to-warning.patch | 32 + ...s-Add-hogs-for-RP1-GPIO-46-48-on-CM5.patch | 38 + ...gpio-bridge-fix-gpiod-error-handling.patch | 25 + ...-gpio-bridge-probe-Cfg-fast_xfer-clk.patch | 37 + ...950-1547-fix-clang-compilation-error.patch | 30 + .../950-1548-delete-the-comment.patch | 22 + ...1-Add-continuous-clock-option-as-an-.patch | 66 + .../950-1550-drm-v3d-Add-clock-handling.patch | 129 + ...n-jobs-that-have-errors-flagged-in-i.patch | 61 + ...pointer-to-NULL-when-the-job-s-fence.patch | 84 + ...e-a-V3D-tech-revision-to-all-support.patch | 447 ++++ ...pu-v3d-Add-SMS-to-the-registers-list.patch | 43 + ...SMS-registers-for-power-on-off-and-r.patch | 198 ++ ...556-dts-bcm2712-Add-V3D_SMS-register.patch | 27 + ...ove-the-power-key-debounce-on-Pi-500.patch | 21 + 64 files changed, 9054 insertions(+), 64 deletions(-) create mode 100644 target/linux/bcm27xx/patches-6.6/950-1484-Add-and-update-files-for-pwm-gpio-fan-overlay.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1486-media-i2c-imx290-Limit-analogue-gain-according-to-mo.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1488-media-dt-bindings-sony-imx290-Add-IMX462-to-the-IMX2.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1489-media-i2c-imx290-Add-configuration-for-IMX462.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1490-media-imx290-Add-module-parameter-to-allow-selection.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1491-dtoverlays-Switch-imx462-overlay-to-use-the-new-comp.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1492-media-i2c-imx415-Add-more-clock-configurations.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1494-dtoverlays-Add-overlay-for-Sony-IMX415-image-sensor.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1495-media-i2c-imx415-Add-read-write-control-of-VBLANK.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1496-media-i2c-imx415-Make-HBLANK-controllable-and-in-con.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1497-media-i2c-imx415-Link-frequencies-are-not-exclusive-.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1498-dts-bcm2711-PL011-UARTs-are-actually-r1p5.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1499-dts-bcm2712-PL011-UARTs-are-actually-r1p5.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1500-dts-rp1-PL011-UARTs-are-actually-r1p5.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1501-ASoC-pcm512x-Demote-No-SCLK-to-debug-level.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1502-ASoC-allo-piano-dac-plus-Fix-volume-limiting.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1503-ASoC-allo-piano-dac-plus-Remove-pointless-code.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1505-DT-bcm2712-override-supports-cqe-to-a-cell.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1506-mmc-sd-filter-card-CQ-support-based-on-an-allow-list.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1507-mmc-set-MMC_QUIRK_KNOWN_WORKING_SD_CQ-on-Raspberry-P.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1508-mmc-use-downstream-DT-property-to-modify-CQE-and-or-.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1509-misc-rp1-pio-Handle-probe-errors.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1510-firmware-rp1-Simplify-rp1_firmware_get.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1512-dts-bcm2711-Don-t-mark-timer-regs-unconfigured.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1513-mmc-bcm2835-sdhost-Observe-SWIOTLB-memory-limit.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1514-drivers-media-pisp_be-Add-support-for-YUV422-planar-.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1515-drivers-media-pisp_be-Remove-unused-fields-in-struct.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1516-media-imx219-Adjust-PLL-settings-based-on-the-number.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1517-IMX219-Add-4-lane-option-to-the-device-tree-overlay.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1518-dtoverlays-waveshare-panel-Disable-new-touch-control.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1519-drm-rp1-rp1-dpi-Add-rgb_order-property-to-match-VC4-.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1522-add-ina238-to-i2c-sensors.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1524-add-shtc3-to-i2c-sensors.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1525-drivers-media-pci-Update-Hailo-accelerator-device-dr.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1526-overlays-Regularisation-and-improvements.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1527-overlays-Factor-out-the-common-i2c-bus-selection.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1529-misc-rp1-pio-SM_CONFIG_XFER32-larger-DMA-bufs.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1530-spi-dw-Wait-for-idle-after-TX.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1531-misc-rp1-pio-Error-out-on-incompatible-firmware.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1532-firmware-rp1-Linger-on-firmware-failure.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1533-mailbox-rp1-Don-t-claim-channels-in-of_xlate.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1534-fixup-spi-dw-Wait-for-idle-after-TX.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1535-dtoverlays-adds-support-for-Hifiberry-ADC8x-to-the-D.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1536-ASoC-adds-ADC8x-support-to-the-Hifiberry-DAC8x.patch rename target/linux/bcm27xx/patches-6.6/{950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch => 950-1539-Reapply-usb-dwc3-Set-DMA-and-coherent-masks-early.patch} (81%) create mode 100644 target/linux/bcm27xx/patches-6.6/950-1541-overlays-Add-OpenHydroponics-RootMaster-overlay.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1542-media-i2c-arducam-pivariety-Fix-mutex-init-and-NULL-.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1543-misc-rp1-pio-Demote-fw-probe-error-to-warning.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1544-dts-Add-hogs-for-RP1-GPIO-46-48-on-CM5.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1545-spi-rp2040-gpio-bridge-fix-gpiod-error-handling.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1546-spi-rp2040-gpio-bridge-probe-Cfg-fast_xfer-clk.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1547-fix-clang-compilation-error.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1548-delete-the-comment.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1549-dtoverlays-ov9281-Add-continuous-clock-option-as-an-.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1550-drm-v3d-Add-clock-handling.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1551-drm-v3d-Don-t-run-jobs-that-have-errors-flagged-in-i.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1552-drm-v3d-Set-job-pointer-to-NULL-when-the-job-s-fence.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1553-drm-v3d-Associate-a-V3D-tech-revision-to-all-support.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1554-dt-bindings-gpu-v3d-Add-SMS-to-the-registers-list.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1555-drm-v3d-Use-V3D_SMS-registers-for-power-on-off-and-r.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1556-dts-bcm2712-Add-V3D_SMS-register.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1557-dts-Remove-the-power-key-debounce-on-Pi-500.patch diff --git a/target/linux/bcm27xx/patches-6.6/950-0853-drivers-usb-dwc3-add-FS-LS-bus-instance-parkmode-dis.patch b/target/linux/bcm27xx/patches-6.6/950-0853-drivers-usb-dwc3-add-FS-LS-bus-instance-parkmode-dis.patch index 47fa0b75416cf1..77aebef467c2ee 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0853-drivers-usb-dwc3-add-FS-LS-bus-instance-parkmode-dis.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0853-drivers-usb-dwc3-add-FS-LS-bus-instance-parkmode-dis.patch @@ -16,7 +16,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c -@@ -1387,6 +1387,9 @@ static int dwc3_core_init(struct dwc3 *d +@@ -1367,6 +1367,9 @@ static int dwc3_core_init(struct dwc3 *d if (dwc->parkmode_disable_hs_quirk) reg |= DWC3_GUCTL1_PARKMODE_DISABLE_HS; @@ -26,7 +26,7 @@ Signed-off-by: Jonathan Bell if (DWC3_VER_IS_WITHIN(DWC3, 290A, ANY) && (dwc->maximum_speed == USB_SPEED_HIGH || dwc->maximum_speed == USB_SPEED_FULL)) -@@ -1676,6 +1679,8 @@ static void dwc3_get_properties(struct d +@@ -1634,6 +1637,8 @@ static void dwc3_get_properties(struct d "snps,parkmode-disable-ss-quirk"); dwc->parkmode_disable_hs_quirk = device_property_read_bool(dev, "snps,parkmode-disable-hs-quirk"); @@ -37,7 +37,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h -@@ -271,6 +271,7 @@ +@@ -268,6 +268,7 @@ #define DWC3_GUCTL1_DEV_L1_EXIT_BY_HW BIT(24) #define DWC3_GUCTL1_PARKMODE_DISABLE_SS BIT(17) #define DWC3_GUCTL1_PARKMODE_DISABLE_HS BIT(16) @@ -45,7 +45,7 @@ Signed-off-by: Jonathan Bell #define DWC3_GUCTL1_RESUME_OPMODE_HS_HOST BIT(10) /* Global Status Register */ -@@ -1122,10 +1123,12 @@ struct dwc3_scratchpad_array { +@@ -1118,10 +1119,12 @@ struct dwc3_scratchpad_array { * generation after resume from suspend. * @ulpi_ext_vbus_drv: Set to confiure the upli chip to drives CPEN pin * VBUS with an external supply. @@ -62,7 +62,7 @@ Signed-off-by: Jonathan Bell * @tx_de_emphasis_quirk: set if we enable Tx de-emphasis quirk * @tx_de_emphasis: Tx de-emphasis value * 0 - -6dB de-emphasis -@@ -1352,6 +1355,7 @@ struct dwc3 { +@@ -1347,6 +1350,7 @@ struct dwc3 { unsigned ulpi_ext_vbus_drv:1; unsigned parkmode_disable_ss_quirk:1; unsigned parkmode_disable_hs_quirk:1; diff --git a/target/linux/bcm27xx/patches-6.6/950-1359-usb-dwc3-core-add-support-for-setting-NAK-enhancemen.patch b/target/linux/bcm27xx/patches-6.6/950-1359-usb-dwc3-core-add-support-for-setting-NAK-enhancemen.patch index 5b700990b2783a..db0cce8d59d1dd 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1359-usb-dwc3-core-add-support-for-setting-NAK-enhancemen.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1359-usb-dwc3-core-add-support-for-setting-NAK-enhancemen.patch @@ -22,7 +22,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c -@@ -1381,6 +1381,12 @@ static int dwc3_core_init(struct dwc3 *d +@@ -1361,6 +1361,12 @@ static int dwc3_core_init(struct dwc3 *d if (dwc->dis_tx_ipgap_linecheck_quirk) reg |= DWC3_GUCTL1_TX_IPGAP_LINECHECK_DIS; @@ -35,7 +35,7 @@ Signed-off-by: Jonathan Bell if (dwc->parkmode_disable_ss_quirk) reg |= DWC3_GUCTL1_PARKMODE_DISABLE_SS; -@@ -1675,6 +1681,10 @@ static void dwc3_get_properties(struct d +@@ -1633,6 +1639,10 @@ static void dwc3_get_properties(struct d "snps,resume-hs-terminations"); dwc->ulpi_ext_vbus_drv = device_property_read_bool(dev, "snps,ulpi-ext-vbus-drv"); @@ -48,7 +48,7 @@ Signed-off-by: Jonathan Bell dwc->parkmode_disable_hs_quirk = device_property_read_bool(dev, --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h -@@ -269,6 +269,8 @@ +@@ -266,6 +266,8 @@ #define DWC3_GUCTL1_TX_IPGAP_LINECHECK_DIS BIT(28) #define DWC3_GUCTL1_DEV_FORCE_20_CLK_FOR_30_CLK BIT(26) #define DWC3_GUCTL1_DEV_L1_EXIT_BY_HW BIT(24) @@ -57,7 +57,7 @@ Signed-off-by: Jonathan Bell #define DWC3_GUCTL1_PARKMODE_DISABLE_SS BIT(17) #define DWC3_GUCTL1_PARKMODE_DISABLE_HS BIT(16) #define DWC3_GUCTL1_PARKMODE_DISABLE_FSLS BIT(15) -@@ -1123,6 +1125,8 @@ struct dwc3_scratchpad_array { +@@ -1119,6 +1121,8 @@ struct dwc3_scratchpad_array { * generation after resume from suspend. * @ulpi_ext_vbus_drv: Set to confiure the upli chip to drives CPEN pin * VBUS with an external supply. @@ -66,7 +66,7 @@ Signed-off-by: Jonathan Bell * @parkmode_disable_ss_quirk: If set, disable park mode feature for all * Superspeed instances. * @parkmode_disable_hs_quirk: If set, disable park mode feature for all -@@ -1353,6 +1357,8 @@ struct dwc3 { +@@ -1348,6 +1352,8 @@ struct dwc3 { unsigned dis_tx_ipgap_linecheck_quirk:1; unsigned resume_hs_terminations:1; unsigned ulpi_ext_vbus_drv:1; diff --git a/target/linux/bcm27xx/patches-6.6/950-1484-Add-and-update-files-for-pwm-gpio-fan-overlay.patch b/target/linux/bcm27xx/patches-6.6/950-1484-Add-and-update-files-for-pwm-gpio-fan-overlay.patch new file mode 100644 index 00000000000000..521b3407303e3a --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1484-Add-and-update-files-for-pwm-gpio-fan-overlay.patch @@ -0,0 +1,246 @@ +From 5fa4b1ff4db7635da04b1b8bf33b42a941064718 Mon Sep 17 00:00:00 2001 +From: Kai-Uwe Herbing <155751635+herbingk@users.noreply.github.com> +Date: Tue, 31 Dec 2024 19:44:31 +0100 +Subject: [PATCH] Add and update files for pwm-gpio-fan overlay + +Add and update files for pwm-gpio-fan overlay +Signed-off-by: Kai-Uwe Herbing <155751635+herbingk@users.noreply.github.com> +--- + arch/arm/boot/dts/overlays/Makefile | 1 + + arch/arm/boot/dts/overlays/README | 40 +++++ + .../dts/overlays/pwm-gpio-fan-overlay.dts | 170 ++++++++++++++++++ + 3 files changed, 211 insertions(+) + create mode 100644 arch/arm/boot/dts/overlays/pwm-gpio-fan-overlay.dts + +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -219,6 +219,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ + pwm.dtbo \ + pwm-2chan.dtbo \ + pwm-gpio.dtbo \ ++ pwm-gpio-fan.dtbo \ + pwm-ir-tx.dtbo \ + pwm-pio.dtbo \ + pwm1.dtbo \ +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -4036,6 +4036,46 @@ Load: dtoverlay=pwm-gpio,= + Params: gpio Output pin (default 4) + + ++Name: pwm-gpio-fan ++Info: Configure a GPIO connected PWM cooling fan controlled by the ++ software-based GPIO PWM kernel module ++Load: dtoverlay=pwm-gpio-fan,= ++Params: fan_gpio BCM number of the pin driving the fan, ++ default 18 (GPIO 18) ++ fan_temp0 CPU temperature at which fan is started with ++ low speed in millicelsius, ++ default 55000 (55 °C) ++ fan_temp1 CPU temperature at which fan is switched ++ to medium speed in millicelsius, ++ default 60000 (60 °C) ++ fan_temp2 CPU temperature at which fan is switched ++ to high speed in millicelsius, ++ default 67500 (67.5 °C) ++ fan_temp3 CPU temperature at which fan is switched ++ to max speed in millicelsius, ++ default 75000 (75 °C) ++ fan_temp0_hyst Temperature hysteris at which fan is stopped ++ in millicelsius,default 5000 (resulting ++ in 50 °C) ++ fan_temp1_hyst Temperature hysteris at which fan is switched ++ back to low speed in millicelsius, ++ default 5000 (resulting in 55 °C) ++ fan_temp2_hyst Temperature hysteris at which fan is switched ++ back to medium speed in millicelsius, ++ default 5000 (resulting in 62.5 °C) ++ fan_temp3_hyst Temperature hysteris at which fan is switched ++ back to high speed in millicelsius, ++ default 5000 (resulting in 70 °C) ++ fan_temp0_speed Fan speed for low cooling state in range ++ 0 to 255, default 114 (45% PWM duty cycle) ++ fan_temp1_speed Fan speed for medium cooling state in range ++ 0 to 255, default 152 (60% PWM duty cycle) ++ fan_temp2_speed Fan speed for high cooling state in range ++ 0 to 255, default 204 (80% PWM duty cycle) ++ fan_temp3_speed Fan speed for max cooling state in range ++ 0 to 255, default 255 (100% PWM duty cycle) ++ ++ + Name: pwm-ir-tx + Info: Use GPIO pin as pwm-assisted infrared transmitter output. + This is an alternative to "gpio-ir-tx". pwm-ir-tx makes use +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pwm-gpio-fan-overlay.dts +@@ -0,0 +1,170 @@ ++/* ++ * Overlay for a GPIO connected PWM cooling fan controlled by software GPIO PWM ++ * ++ * Optional parameters: ++ * - "fan_gpio" BCM number of the pin driving the fan, default 18 (GPIO18) ++ * ++ * - "fan_temp0" CPU temperature at which fan is started with low speed in millicelsius, ++ * default 55000 (55 °C) ++ * - "fan_temp1" CPU temperature at which fan is switched to medium speed in millicelsius, ++ * default 60000 (60 °C) ++ * - "fan_temp2" CPU temperature at which fan is switched to high speed in millicelsius, ++ * default 67500 (67.5 °C) ++ * - "fan_temp3" CPU temperature at which fan is switched to max speed in millicelsius, ++ * default 75000 (75 °C) ++ * - "fan_temp0_hyst" Temperature hysteris at which fan is stopped in millicelsius, ++ * default 5000 (resulting in 50 °C) ++ * - "fan_temp1_hyst" Temperature hysteris at which fan is switched back to low speed ++ * in millicelsius, default 5000 (resulting in 55 °C) ++ * - "fan_temp2_hyst" Temperature hysteris at which fan is switched back to medium speed ++ * in millicelsius, default 5000 (resulting in 62.5 °C) ++ * - "fan_temp3_hyst" Temperature hysteris at which fan is switched back to high speed ++ * in millicelsius, default 5000 (resulting in 70 °C) ++ * - "fan_temp0_speed" Fan speed for low cooling state in range 0 to 255, ++ * default 114 (45% PWM duty cycle) ++ * - "fan_temp1_speed" Fan speed for medium cooling state in range 0 to 255, ++ * default 152 (60% PWM duty cycle) ++ * - "fan_temp2_speed" Fan speed for high cooling state in range 0 to 255, ++ * default 204 (80% PWM duty cycle) ++ * - "fan_temp3_speed" Fan speed for max cooling state in range 0 to 255, ++ * default 255 (100% PWM duty cycle) ++ * ++ * N.B. ++ * - Uses the software GPIO PWM kernel module instead of the Pis hardware PWMs (PWM0/PWM1). ++ * This will allow for an undisturbed concurrent usage of the Pis analogue audio output. ++ * ++ * Requires: ++ * - A PWM controlled cooling fan connected to the GPIO, such as an ++ * Argon mini-fan, HighPi Pro Fan or Waveshare FAN-4020-PWM-5V ++ * - Raspberry Pi OS Bookworm with kernel 6.6.62 or above ++ * ++ * Build: ++ * - sudo dtc -I dts -O dtb -o /boot/firmware/overlays/pwm-gpiofan.dtbo pwm-gpiofan-overlay.dts ++ * ++ * Activate: ++ * - sudo nano /boot/firmware/config.txt add "dtoverlay=pwm-gpiofan" ++ * ++ */ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835"; ++ ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ pwm_gpio_pins: pwm_gpio_pins { ++ brcm,pins = <18>; /* gpio-pin = 18 */ ++ brcm,function = <1>; /* gpio function = output */ ++ brcm,pull = <0>; /* gpio pull up/down = off */ ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target-path = "/"; ++ __overlay__ { ++ pwm_gpio: pwm_gpio { ++ compatible="pwm-gpio"; ++ #pwm-cells = <2>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pwm_gpio_pins>; ++ gpios = <&gpio 18 0>; /* gpio-pin = 18 */ ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target-path = "/"; ++ __overlay__ { ++ fan0: pwm-fan { ++ compatible = "pwm-fan"; ++ #cooling-cells = <2>; ++ /* in ns = 20ms = 50 Hz */ ++ pwms = <&pwm_gpio 0 20000000 0>; ++ ++ cooling-min-state = <0>; ++ cooling-max-state = <4>; ++ /* PWM duty cycle values in a range from 0 to 255 */ ++ /* which correspond to thermal cooling states 0 to 4 */ ++ cooling-levels = <0 114 152 204 255>; ++ }; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&cpu_thermal>; ++ __overlay__ { ++ /* in ms = poll every 2s */ ++ polling-delay = <2000>; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&thermal_trips>; ++ __overlay__ { ++ /* below temperatures in millicelsius */ ++ trip0: trip0 { ++ temperature = <55000>; /* 55 °C */ ++ hysteresis = <5000>; /* 5 °C */ ++ type = "active"; ++ }; ++ trip1: trip1 { ++ temperature = <60000>; /* 60 °C */ ++ hysteresis = <5000>; /* 5 °C */ ++ type = "active"; ++ }; ++ trip2: trip2 { ++ temperature = <67500>; /* 67.5 °C */ ++ hysteresis = <5000>; /* 5 °C */ ++ type = "active"; ++ }; ++ trip3: trip3 { ++ temperature = <75000>; /* 75 °C */ ++ hysteresis = <5000>; /* 5 °C */ ++ type = "active"; ++ }; ++ }; ++ }; ++ ++ fragment@5 { ++ target = <&cooling_maps>; ++ __overlay__ { ++ map0 { ++ cooling-device = <&fan0 0 1>; ++ trip = <&trip0>; ++ }; ++ map1 { ++ cooling-device = <&fan0 1 2>; ++ trip = <&trip1>; ++ }; ++ map2 { ++ cooling-device = <&fan0 2 3>; ++ trip = <&trip2>; ++ }; ++ map3 { ++ cooling-device = <&fan0 3 4>; ++ trip = <&trip3>; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ fan_gpio = <&pwm_gpio>,"gpios:4", ++ <&pwm_gpio_pins>,"brcm,pins:0"; ++ fan_temp0 = <&trip0>,"temperature:0"; ++ fan_temp0_hyst = <&trip0>,"hysteresis:0"; ++ fan_temp0_speed = <&fan0>,"cooling-levels:4"; ++ fan_temp1 = <&trip1>,"temperature:0"; ++ fan_temp1_hyst = <&trip1>,"hysteresis:0"; ++ fan_temp1_speed = <&fan0>,"cooling-levels:8"; ++ fan_temp2 = <&trip2>,"temperature:0"; ++ fan_temp2_hyst = <&trip2>,"hysteresis:0"; ++ fan_temp2_speed = <&fan0>,"cooling-levels:12"; ++ fan_temp3 = <&trip3>,"temperature:0"; ++ fan_temp3_hyst = <&trip3>,"hysteresis:0"; ++ fan_temp3_speed = <&fan0>,"cooling-levels:16"; ++ }; ++ ++}; diff --git a/target/linux/bcm27xx/patches-6.6/950-1486-media-i2c-imx290-Limit-analogue-gain-according-to-mo.patch b/target/linux/bcm27xx/patches-6.6/950-1486-media-i2c-imx290-Limit-analogue-gain-according-to-mo.patch new file mode 100644 index 00000000000000..818f95f7c3b5dc --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1486-media-i2c-imx290-Limit-analogue-gain-according-to-mo.patch @@ -0,0 +1,71 @@ +From b3dd7e8947cddec41864e8d3ce5f5d8b81033d6a Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Wed, 20 Nov 2024 19:17:03 +0000 +Subject: [PATCH] media: i2c: imx290: Limit analogue gain according to module + +Commit ec75fd952b0b5cdab7b606cdacba237c57c1fdda upstream. + +The imx327 only supports up to 29.4dB of analogue gain, vs +the imx290 going up to 30dB. Both are in 0.3dB steps. + +As we now have model specific config, fix this mismatch, +and delete the comment referencing it. + +Signed-off-by: Dave Stevenson +Reviewed-by: Laurent Pinchart +Reviewed-by: Alexander Stein +Signed-off-by: Sakari Ailus +Signed-off-by: Mauro Carvalho Chehab +--- + drivers/media/i2c/imx290.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +--- a/drivers/media/i2c/imx290.c ++++ b/drivers/media/i2c/imx290.c +@@ -178,6 +178,7 @@ struct imx290_model_info { + enum imx290_colour_variant colour_variant; + const struct cci_reg_sequence *init_regs; + size_t init_regs_num; ++ unsigned int max_analog_gain; + const char *name; + }; + +@@ -879,14 +880,10 @@ static int imx290_ctrl_init(struct imx29 + * up to 72.0dB (240) add further digital gain. Limit the range to + * analog gain only, support for digital gain can be added separately + * if needed. +- * +- * The IMX327 and IMX462 are largely compatible with the IMX290, but +- * have an analog gain range of 0.0dB to 29.4dB and 42dB of digital +- * gain. When support for those sensors gets added to the driver, the +- * gain control should be adjusted accordingly. + */ + v4l2_ctrl_new_std(&imx290->ctrls, &imx290_ctrl_ops, +- V4L2_CID_ANALOGUE_GAIN, 0, 100, 1, 0); ++ V4L2_CID_ANALOGUE_GAIN, 0, ++ imx290->model->max_analog_gain, 1, 0); + + /* + * Correct range will be determined through imx290_ctrl_update setting +@@ -1437,18 +1434,21 @@ static const struct imx290_model_info im + .colour_variant = IMX290_VARIANT_COLOUR, + .init_regs = imx290_global_init_settings_290, + .init_regs_num = ARRAY_SIZE(imx290_global_init_settings_290), ++ .max_analog_gain = 100, + .name = "imx290", + }, + [IMX290_MODEL_IMX290LLR] = { + .colour_variant = IMX290_VARIANT_MONO, + .init_regs = imx290_global_init_settings_290, + .init_regs_num = ARRAY_SIZE(imx290_global_init_settings_290), ++ .max_analog_gain = 100, + .name = "imx290", + }, + [IMX290_MODEL_IMX327LQR] = { + .colour_variant = IMX290_VARIANT_COLOUR, + .init_regs = imx290_global_init_settings_327, + .init_regs_num = ARRAY_SIZE(imx290_global_init_settings_327), ++ .max_analog_gain = 98, + .name = "imx327", + }, + }; diff --git a/target/linux/bcm27xx/patches-6.6/950-1488-media-dt-bindings-sony-imx290-Add-IMX462-to-the-IMX2.patch b/target/linux/bcm27xx/patches-6.6/950-1488-media-dt-bindings-sony-imx290-Add-IMX462-to-the-IMX2.patch new file mode 100644 index 00000000000000..7cf477c3c8e8e5 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1488-media-dt-bindings-sony-imx290-Add-IMX462-to-the-IMX2.patch @@ -0,0 +1,31 @@ +From f4f17c3fe223b3d8ad65f5420abbcd69ef901186 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Wed, 20 Nov 2024 19:17:05 +0000 +Subject: [PATCH] media: dt-bindings: sony,imx290: Add IMX462 to the IMX290 + binding + +Commit e4faac99d5bb4b6c80f2495c40fcd71a67c40b27 upstream. + +IMX462 is the successor to IMX290, which is supportable by +the existing IMX290 driver via a new compatible string. + +Signed-off-by: Dave Stevenson +Acked-by: Conor Dooley +Reviewed-by: Laurent Pinchart +Signed-off-by: Sakari Ailus +Signed-off-by: Mauro Carvalho Chehab +--- + Documentation/devicetree/bindings/media/i2c/sony,imx290.yaml | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/Documentation/devicetree/bindings/media/i2c/sony,imx290.yaml ++++ b/Documentation/devicetree/bindings/media/i2c/sony,imx290.yaml +@@ -30,6 +30,8 @@ properties: + - sony,imx290lqr # Colour + - sony,imx290llr # Monochrome + - sony,imx327lqr # Colour ++ - sony,imx462lqr # Colour ++ - sony,imx462llr # Monochrome + - const: sony,imx290 + deprecated: true + diff --git a/target/linux/bcm27xx/patches-6.6/950-1489-media-i2c-imx290-Add-configuration-for-IMX462.patch b/target/linux/bcm27xx/patches-6.6/950-1489-media-i2c-imx290-Add-configuration-for-IMX462.patch new file mode 100644 index 00000000000000..027f4571d81392 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1489-media-i2c-imx290-Add-configuration-for-IMX462.patch @@ -0,0 +1,116 @@ +From 23037697914a6d1220768a752c6358d35ca03737 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Wed, 20 Nov 2024 19:17:06 +0000 +Subject: [PATCH] media: i2c: imx290: Add configuration for IMX462 + +Commit c699b6c7c857baba1375a1ed090bf71f695e2971 upstream. + +IMX462 is the successor to IMX290, and wants very minor +changes to the register setup. + +Add the relevant configuration to support it. + +Signed-off-by: Dave Stevenson +Reviewed-by: Laurent Pinchart +Signed-off-by: Sakari Ailus +Signed-off-by: Mauro Carvalho Chehab +--- + drivers/media/i2c/imx290.c | 66 ++++++++++++++++++++++++++++++++++++++ + 1 file changed, 66 insertions(+) + +--- a/drivers/media/i2c/imx290.c ++++ b/drivers/media/i2c/imx290.c +@@ -172,6 +172,8 @@ enum imx290_model { + IMX290_MODEL_IMX290LQR, + IMX290_MODEL_IMX290LLR, + IMX290_MODEL_IMX327LQR, ++ IMX290_MODEL_IMX462LQR, ++ IMX290_MODEL_IMX462LLR, + }; + + struct imx290_model_info { +@@ -318,6 +320,50 @@ static const struct cci_reg_sequence imx + { CCI_REG8(0x33b3), 0x04 }, + }; + ++static const struct cci_reg_sequence imx290_global_init_settings_462[] = { ++ { CCI_REG8(0x300f), 0x00 }, ++ { CCI_REG8(0x3010), 0x21 }, ++ { CCI_REG8(0x3011), 0x02 }, ++ { CCI_REG8(0x3016), 0x09 }, ++ { CCI_REG8(0x3070), 0x02 }, ++ { CCI_REG8(0x3071), 0x11 }, ++ { CCI_REG8(0x309b), 0x10 }, ++ { CCI_REG8(0x309c), 0x22 }, ++ { CCI_REG8(0x30a2), 0x02 }, ++ { CCI_REG8(0x30a6), 0x20 }, ++ { CCI_REG8(0x30a8), 0x20 }, ++ { CCI_REG8(0x30aa), 0x20 }, ++ { CCI_REG8(0x30ac), 0x20 }, ++ { CCI_REG8(0x30b0), 0x43 }, ++ { CCI_REG8(0x3119), 0x9e }, ++ { CCI_REG8(0x311c), 0x1e }, ++ { CCI_REG8(0x311e), 0x08 }, ++ { CCI_REG8(0x3128), 0x05 }, ++ { CCI_REG8(0x313d), 0x83 }, ++ { CCI_REG8(0x3150), 0x03 }, ++ { CCI_REG8(0x317e), 0x00 }, ++ { CCI_REG8(0x32b8), 0x50 }, ++ { CCI_REG8(0x32b9), 0x10 }, ++ { CCI_REG8(0x32ba), 0x00 }, ++ { CCI_REG8(0x32bb), 0x04 }, ++ { CCI_REG8(0x32c8), 0x50 }, ++ { CCI_REG8(0x32c9), 0x10 }, ++ { CCI_REG8(0x32ca), 0x00 }, ++ { CCI_REG8(0x32cb), 0x04 }, ++ { CCI_REG8(0x332c), 0xd3 }, ++ { CCI_REG8(0x332d), 0x10 }, ++ { CCI_REG8(0x332e), 0x0d }, ++ { CCI_REG8(0x3358), 0x06 }, ++ { CCI_REG8(0x3359), 0xe1 }, ++ { CCI_REG8(0x335a), 0x11 }, ++ { CCI_REG8(0x3360), 0x1e }, ++ { CCI_REG8(0x3361), 0x61 }, ++ { CCI_REG8(0x3362), 0x10 }, ++ { CCI_REG8(0x33b0), 0x50 }, ++ { CCI_REG8(0x33b2), 0x1a }, ++ { CCI_REG8(0x33b3), 0x04 }, ++}; ++ + #define IMX290_NUM_CLK_REGS 2 + static const struct cci_reg_sequence xclk_regs[][IMX290_NUM_CLK_REGS] = { + [IMX290_CLK_37_125] = { +@@ -1451,6 +1497,20 @@ static const struct imx290_model_info im + .max_analog_gain = 98, + .name = "imx327", + }, ++ [IMX290_MODEL_IMX462LQR] = { ++ .colour_variant = IMX290_VARIANT_COLOUR, ++ .init_regs = imx290_global_init_settings_462, ++ .init_regs_num = ARRAY_SIZE(imx290_global_init_settings_462), ++ .max_analog_gain = 98, ++ .name = "imx462", ++ }, ++ [IMX290_MODEL_IMX462LLR] = { ++ .colour_variant = IMX290_VARIANT_MONO, ++ .init_regs = imx290_global_init_settings_462, ++ .init_regs_num = ARRAY_SIZE(imx290_global_init_settings_462), ++ .max_analog_gain = 98, ++ .name = "imx462", ++ }, + }; + + static int imx290_parse_dt(struct imx290 *imx290) +@@ -1646,6 +1706,12 @@ static const struct of_device_id imx290_ + }, { + .compatible = "sony,imx327lqr", + .data = &imx290_models[IMX290_MODEL_IMX327LQR], ++ }, { ++ .compatible = "sony,imx462lqr", ++ .data = &imx290_models[IMX290_MODEL_IMX462LQR], ++ }, { ++ .compatible = "sony,imx462llr", ++ .data = &imx290_models[IMX290_MODEL_IMX462LLR], + }, + { /* sentinel */ }, + }; diff --git a/target/linux/bcm27xx/patches-6.6/950-1490-media-imx290-Add-module-parameter-to-allow-selection.patch b/target/linux/bcm27xx/patches-6.6/950-1490-media-imx290-Add-module-parameter-to-allow-selection.patch new file mode 100644 index 00000000000000..219cfce67bee3c --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1490-media-imx290-Add-module-parameter-to-allow-selection.patch @@ -0,0 +1,60 @@ +From c633c2e93e460925120e0817c14bbfc444a70226 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Wed, 15 May 2024 12:43:15 +0100 +Subject: [PATCH] media: imx290: Add module parameter to allow selection of HCG + mode + +The sensor has Low Conversion Gain (HCG) and High Conversion Gain (HCG) +modes, with the supposedly the HCG mode having better noise performance +at high gains. + +As this parameter changes the gain range of the sensor, it isn't +possible to make this an automatic property, and there is no +suitable V4L2 control to set it, so just add it as a module parameter. + +Signed-off-by: Dave Stevenson +--- + drivers/media/i2c/imx290.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +--- a/drivers/media/i2c/imx290.c ++++ b/drivers/media/i2c/imx290.c +@@ -13,6 +13,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -41,6 +42,9 @@ + #define IMX290_WINMODE_720P (1 << 4) + #define IMX290_WINMODE_CROP (4 << 4) + #define IMX290_FR_FDG_SEL CCI_REG8(0x3009) ++#define IMX290_FDG_HCG BIT(4) ++#define IMX290_FRSEL_60FPS BIT(0) ++#define IMX290_FDG_LCG 0 + #define IMX290_BLKLEVEL CCI_REG16_LE(0x300a) + #define IMX290_GAIN CCI_REG8(0x3014) + #define IMX290_VMAX CCI_REG24_LE(0x3018) +@@ -162,6 +166,10 @@ + + #define IMX290_NUM_SUPPLIES 3 + ++static bool hcg_mode; ++module_param(hcg_mode, bool, 0664); ++MODULE_PARM_DESC(hcg_mode, "Enable HCG mode"); ++ + enum imx290_colour_variant { + IMX290_VARIANT_COLOUR, + IMX290_VARIANT_MONO, +@@ -697,7 +705,8 @@ static int imx290_set_data_lanes(struct + &ret); + cci_write(imx290->regmap, IMX290_CSI_LANE_MODE, imx290->nlanes - 1, + &ret); +- cci_write(imx290->regmap, IMX290_FR_FDG_SEL, 0x01, &ret); ++ cci_write(imx290->regmap, IMX290_FR_FDG_SEL, IMX290_FRSEL_60FPS | ++ (hcg_mode ? IMX290_FDG_HCG : IMX290_FDG_LCG), &ret); + + return ret; + } diff --git a/target/linux/bcm27xx/patches-6.6/950-1491-dtoverlays-Switch-imx462-overlay-to-use-the-new-comp.patch b/target/linux/bcm27xx/patches-6.6/950-1491-dtoverlays-Switch-imx462-overlay-to-use-the-new-comp.patch new file mode 100644 index 00000000000000..8e894791c238de --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1491-dtoverlays-Switch-imx462-overlay-to-use-the-new-comp.patch @@ -0,0 +1,47 @@ +From eec7048c4e3aec1aadc21fcffcf6be9f5385f72a Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Tue, 12 Nov 2024 14:15:30 +0000 +Subject: [PATCH] dtoverlays: Switch imx462 overlay to use the new compatible + +Now that imx462 has a separate compatible string, make use of it. + +Signed-off-by: Dave Stevenson +--- + arch/arm/boot/dts/overlays/imx462-overlay.dts | 10 +++------- + 1 file changed, 3 insertions(+), 7 deletions(-) + +--- a/arch/arm/boot/dts/overlays/imx462-overlay.dts ++++ b/arch/arm/boot/dts/overlays/imx462-overlay.dts +@@ -1,9 +1,7 @@ + // SPDX-License-Identifier: GPL-2.0-only + // Definitions for IMX462 camera module on VC I2C bus + +-// IMX462 is the successor to IMX290. The drivers currently don't support +-// any additional feature of IMX462, so use the IMX290 compatible strings +-// for now. ++// IMX462 is the successor to IMX290. + + /dts-v1/; + /plugin/; +@@ -17,19 +15,17 @@ + // Fragment numbers deliberately high to avoid conflicts with the + // included imx290_327 overlay file. + +- //IMX462 is not defined in the bindings, so use IMX290 for now. +- + fragment@101 { + target = <&cam_node>; + __overlay__ { +- compatible = "sony,imx290lqr"; ++ compatible = "sony,imx462lqr"; + }; + }; + + fragment@102 { + target = <&cam_node>; + __dormant__ { +- compatible = "sony,imx290llr"; ++ compatible = "sony,imx462llr"; + }; + }; + diff --git a/target/linux/bcm27xx/patches-6.6/950-1492-media-i2c-imx415-Add-more-clock-configurations.patch b/target/linux/bcm27xx/patches-6.6/950-1492-media-i2c-imx415-Add-more-clock-configurations.patch new file mode 100644 index 00000000000000..0b04bf0c2b206a --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1492-media-i2c-imx415-Add-more-clock-configurations.patch @@ -0,0 +1,327 @@ +From 0a0814f830829b1a377273ddb09c156c84e1a8ca Mon Sep 17 00:00:00 2001 +From: Alexander Stein +Date: Wed, 17 Jan 2024 08:39:36 +0100 +Subject: [PATCH] media: i2c: imx415: Add more clock configurations + +Commit b814b5b2ec2d327b79e415c1baa5eecdf9aa786b upstream. + +Complete the list from "INCK Setting" section in IMX415-AAQR-C +(Rev. E19504, 2019/05/21). For consistency suffix all lane rate values by +UL, which is needed for 2376000000 anyway. + +Signed-off-by: Alexander Stein +Signed-off-by: Sakari Ailus +Signed-off-by: Mauro Carvalho Chehab +--- + drivers/media/i2c/imx415.c | 265 ++++++++++++++++++++++++++++++++++++- + 1 file changed, 260 insertions(+), 5 deletions(-) + +--- a/drivers/media/i2c/imx415.c ++++ b/drivers/media/i2c/imx415.c +@@ -124,7 +124,7 @@ struct imx415_clk_params { + /* INCK Settings - includes all lane rate and INCK dependent registers */ + static const struct imx415_clk_params imx415_clk_params[] = { + { +- .lane_rate = 594000000, ++ .lane_rate = 594000000UL, + .inck = 27000000, + .regs[0] = { IMX415_BCWAIT_TIME, 0x05D }, + .regs[1] = { IMX415_CPWAIT_TIME, 0x042 }, +@@ -139,7 +139,37 @@ static const struct imx415_clk_params im + .regs[10] = { IMX415_TXCLKESC_FREQ, 0x06C0 }, + }, + { +- .lane_rate = 720000000, ++ .lane_rate = 594000000UL, ++ .inck = 37125000, ++ .regs[0] = { IMX415_BCWAIT_TIME, 0x07F }, ++ .regs[1] = { IMX415_CPWAIT_TIME, 0x05B }, ++ .regs[2] = { IMX415_SYS_MODE, 0x7 }, ++ .regs[3] = { IMX415_INCKSEL1, 0x00 }, ++ .regs[4] = { IMX415_INCKSEL2, 0x24 }, ++ .regs[5] = { IMX415_INCKSEL3, 0x080 }, ++ .regs[6] = { IMX415_INCKSEL4, 0x0E0 }, ++ .regs[7] = { IMX415_INCKSEL5, 0x24 }, ++ .regs[8] = { IMX415_INCKSEL6, 0x0 }, ++ .regs[9] = { IMX415_INCKSEL7, 0x1 }, ++ .regs[10] = { IMX415_TXCLKESC_FREQ, 0x0984 }, ++ }, ++ { ++ .lane_rate = 594000000UL, ++ .inck = 74250000, ++ .regs[0] = { IMX415_BCWAIT_TIME, 0x0FF }, ++ .regs[1] = { IMX415_CPWAIT_TIME, 0x0B6 }, ++ .regs[2] = { IMX415_SYS_MODE, 0x7 }, ++ .regs[3] = { IMX415_INCKSEL1, 0x00 }, ++ .regs[4] = { IMX415_INCKSEL2, 0x28 }, ++ .regs[5] = { IMX415_INCKSEL3, 0x080 }, ++ .regs[6] = { IMX415_INCKSEL4, 0x0E0 }, ++ .regs[7] = { IMX415_INCKSEL5, 0x28 }, ++ .regs[8] = { IMX415_INCKSEL6, 0x0 }, ++ .regs[9] = { IMX415_INCKSEL7, 0x1 }, ++ .regs[10] = { IMX415_TXCLKESC_FREQ, 0x1290 }, ++ }, ++ { ++ .lane_rate = 720000000UL, + .inck = 24000000, + .regs[0] = { IMX415_BCWAIT_TIME, 0x054 }, + .regs[1] = { IMX415_CPWAIT_TIME, 0x03B }, +@@ -154,7 +184,22 @@ static const struct imx415_clk_params im + .regs[10] = { IMX415_TXCLKESC_FREQ, 0x0600 }, + }, + { +- .lane_rate = 891000000, ++ .lane_rate = 720000000UL, ++ .inck = 72000000, ++ .regs[0] = { IMX415_BCWAIT_TIME, 0x0F8 }, ++ .regs[1] = { IMX415_CPWAIT_TIME, 0x0B0 }, ++ .regs[2] = { IMX415_SYS_MODE, 0x9 }, ++ .regs[3] = { IMX415_INCKSEL1, 0x00 }, ++ .regs[4] = { IMX415_INCKSEL2, 0x28 }, ++ .regs[5] = { IMX415_INCKSEL3, 0x0A0 }, ++ .regs[6] = { IMX415_INCKSEL4, 0x0E0 }, ++ .regs[7] = { IMX415_INCKSEL5, 0x28 }, ++ .regs[8] = { IMX415_INCKSEL6, 0x0 }, ++ .regs[9] = { IMX415_INCKSEL7, 0x1 }, ++ .regs[10] = { IMX415_TXCLKESC_FREQ, 0x1200 }, ++ }, ++ { ++ .lane_rate = 891000000UL, + .inck = 27000000, + .regs[0] = { IMX415_BCWAIT_TIME, 0x05D }, + .regs[1] = { IMX415_CPWAIT_TIME, 0x042 }, +@@ -169,7 +214,37 @@ static const struct imx415_clk_params im + .regs[10] = { IMX415_TXCLKESC_FREQ, 0x06C0 }, + }, + { +- .lane_rate = 1440000000, ++ .lane_rate = 891000000UL, ++ .inck = 37125000, ++ .regs[0] = { IMX415_BCWAIT_TIME, 0x07F }, ++ .regs[1] = { IMX415_CPWAIT_TIME, 0x05B }, ++ .regs[2] = { IMX415_SYS_MODE, 0x5 }, ++ .regs[3] = { IMX415_INCKSEL1, 0x00 }, ++ .regs[4] = { IMX415_INCKSEL2, 0x24 }, ++ .regs[5] = { IMX415_INCKSEL3, 0x0C0 }, ++ .regs[6] = { IMX415_INCKSEL4, 0x0E0 }, ++ .regs[7] = { IMX415_INCKSEL5, 0x24 }, ++ .regs[8] = { IMX415_INCKSEL6, 0x0 }, ++ .regs[9] = { IMX415_INCKSEL7, 0x1 }, ++ .regs[10] = { IMX415_TXCLKESC_FREQ, 0x0948 }, ++ }, ++ { ++ .lane_rate = 891000000UL, ++ .inck = 74250000, ++ .regs[0] = { IMX415_BCWAIT_TIME, 0x0FF }, ++ .regs[1] = { IMX415_CPWAIT_TIME, 0x0B6 }, ++ .regs[2] = { IMX415_SYS_MODE, 0x5 }, ++ .regs[3] = { IMX415_INCKSEL1, 0x00 }, ++ .regs[4] = { IMX415_INCKSEL2, 0x28 }, ++ .regs[5] = { IMX415_INCKSEL3, 0x0C0 }, ++ .regs[6] = { IMX415_INCKSEL4, 0x0E0 }, ++ .regs[7] = { IMX415_INCKSEL5, 0x28 }, ++ .regs[8] = { IMX415_INCKSEL6, 0x0 }, ++ .regs[9] = { IMX415_INCKSEL7, 0x1 }, ++ .regs[10] = { IMX415_TXCLKESC_FREQ, 0x1290 }, ++ }, ++ { ++ .lane_rate = 1440000000UL, + .inck = 24000000, + .regs[0] = { IMX415_BCWAIT_TIME, 0x054 }, + .regs[1] = { IMX415_CPWAIT_TIME, 0x03B }, +@@ -184,7 +259,22 @@ static const struct imx415_clk_params im + .regs[10] = { IMX415_TXCLKESC_FREQ, 0x0600 }, + }, + { +- .lane_rate = 1485000000, ++ .lane_rate = 1440000000UL, ++ .inck = 72000000, ++ .regs[0] = { IMX415_BCWAIT_TIME, 0x0F8 }, ++ .regs[1] = { IMX415_CPWAIT_TIME, 0x0B0 }, ++ .regs[2] = { IMX415_SYS_MODE, 0x8 }, ++ .regs[3] = { IMX415_INCKSEL1, 0x00 }, ++ .regs[4] = { IMX415_INCKSEL2, 0x28 }, ++ .regs[5] = { IMX415_INCKSEL3, 0x0A0 }, ++ .regs[6] = { IMX415_INCKSEL4, 0x0E0 }, ++ .regs[7] = { IMX415_INCKSEL5, 0x28 }, ++ .regs[8] = { IMX415_INCKSEL6, 0x1 }, ++ .regs[9] = { IMX415_INCKSEL7, 0x0 }, ++ .regs[10] = { IMX415_TXCLKESC_FREQ, 0x1200 }, ++ }, ++ { ++ .lane_rate = 1485000000UL, + .inck = 27000000, + .regs[0] = { IMX415_BCWAIT_TIME, 0x05D }, + .regs[1] = { IMX415_CPWAIT_TIME, 0x042 }, +@@ -198,6 +288,171 @@ static const struct imx415_clk_params im + .regs[9] = { IMX415_INCKSEL7, 0x0 }, + .regs[10] = { IMX415_TXCLKESC_FREQ, 0x06C0 }, + }, ++ { ++ .lane_rate = 1485000000UL, ++ .inck = 37125000, ++ .regs[0] = { IMX415_BCWAIT_TIME, 0x07F }, ++ .regs[1] = { IMX415_CPWAIT_TIME, 0x05B }, ++ .regs[2] = { IMX415_SYS_MODE, 0x8 }, ++ .regs[3] = { IMX415_INCKSEL1, 0x00 }, ++ .regs[4] = { IMX415_INCKSEL2, 0x24 }, ++ .regs[5] = { IMX415_INCKSEL3, 0x0A0 }, ++ .regs[6] = { IMX415_INCKSEL4, 0x0E0 }, ++ .regs[7] = { IMX415_INCKSEL5, 0x24 }, ++ .regs[8] = { IMX415_INCKSEL6, 0x1 }, ++ .regs[9] = { IMX415_INCKSEL7, 0x0 }, ++ .regs[10] = { IMX415_TXCLKESC_FREQ, 0x0948 }, ++ }, ++ { ++ .lane_rate = 1485000000UL, ++ .inck = 74250000, ++ .regs[0] = { IMX415_BCWAIT_TIME, 0x0FF }, ++ .regs[1] = { IMX415_CPWAIT_TIME, 0x0B6 }, ++ .regs[2] = { IMX415_SYS_MODE, 0x8 }, ++ .regs[3] = { IMX415_INCKSEL1, 0x00 }, ++ .regs[4] = { IMX415_INCKSEL2, 0x28 }, ++ .regs[5] = { IMX415_INCKSEL3, 0x0A0 }, ++ .regs[6] = { IMX415_INCKSEL4, 0x0E0 }, ++ .regs[7] = { IMX415_INCKSEL5, 0x28 }, ++ .regs[8] = { IMX415_INCKSEL6, 0x1 }, ++ .regs[9] = { IMX415_INCKSEL7, 0x0 }, ++ .regs[10] = { IMX415_TXCLKESC_FREQ, 0x1290 }, ++ }, ++ { ++ .lane_rate = 1782000000UL, ++ .inck = 27000000, ++ .regs[0] = { IMX415_BCWAIT_TIME, 0x05D }, ++ .regs[1] = { IMX415_CPWAIT_TIME, 0x042 }, ++ .regs[2] = { IMX415_SYS_MODE, 0x4 }, ++ .regs[3] = { IMX415_INCKSEL1, 0x00 }, ++ .regs[4] = { IMX415_INCKSEL2, 0x23 }, ++ .regs[5] = { IMX415_INCKSEL3, 0x0C6 }, ++ .regs[6] = { IMX415_INCKSEL4, 0x0E7 }, ++ .regs[7] = { IMX415_INCKSEL5, 0x23 }, ++ .regs[8] = { IMX415_INCKSEL6, 0x1 }, ++ .regs[9] = { IMX415_INCKSEL7, 0x0 }, ++ .regs[10] = { IMX415_TXCLKESC_FREQ, 0x06C0 }, ++ }, ++ { ++ .lane_rate = 1782000000UL, ++ .inck = 37125000, ++ .regs[0] = { IMX415_BCWAIT_TIME, 0x07F }, ++ .regs[1] = { IMX415_CPWAIT_TIME, 0x05B }, ++ .regs[2] = { IMX415_SYS_MODE, 0x4 }, ++ .regs[3] = { IMX415_INCKSEL1, 0x00 }, ++ .regs[4] = { IMX415_INCKSEL2, 0x24 }, ++ .regs[5] = { IMX415_INCKSEL3, 0x0C0 }, ++ .regs[6] = { IMX415_INCKSEL4, 0x0E0 }, ++ .regs[7] = { IMX415_INCKSEL5, 0x24 }, ++ .regs[8] = { IMX415_INCKSEL6, 0x1 }, ++ .regs[9] = { IMX415_INCKSEL7, 0x0 }, ++ .regs[10] = { IMX415_TXCLKESC_FREQ, 0x0948 }, ++ }, ++ { ++ .lane_rate = 1782000000UL, ++ .inck = 74250000, ++ .regs[0] = { IMX415_BCWAIT_TIME, 0x0FF }, ++ .regs[1] = { IMX415_CPWAIT_TIME, 0x0B6 }, ++ .regs[2] = { IMX415_SYS_MODE, 0x4 }, ++ .regs[3] = { IMX415_INCKSEL1, 0x00 }, ++ .regs[4] = { IMX415_INCKSEL2, 0x28 }, ++ .regs[5] = { IMX415_INCKSEL3, 0x0C0 }, ++ .regs[6] = { IMX415_INCKSEL4, 0x0E0 }, ++ .regs[7] = { IMX415_INCKSEL5, 0x28 }, ++ .regs[8] = { IMX415_INCKSEL6, 0x1 }, ++ .regs[9] = { IMX415_INCKSEL7, 0x0 }, ++ .regs[10] = { IMX415_TXCLKESC_FREQ, 0x1290 }, ++ }, ++ { ++ .lane_rate = 2079000000UL, ++ .inck = 27000000, ++ .regs[0] = { IMX415_BCWAIT_TIME, 0x05D }, ++ .regs[1] = { IMX415_CPWAIT_TIME, 0x042 }, ++ .regs[2] = { IMX415_SYS_MODE, 0x2 }, ++ .regs[3] = { IMX415_INCKSEL1, 0x00 }, ++ .regs[4] = { IMX415_INCKSEL2, 0x23 }, ++ .regs[5] = { IMX415_INCKSEL3, 0x0E7 }, ++ .regs[6] = { IMX415_INCKSEL4, 0x0E7 }, ++ .regs[7] = { IMX415_INCKSEL5, 0x23 }, ++ .regs[8] = { IMX415_INCKSEL6, 0x1 }, ++ .regs[9] = { IMX415_INCKSEL7, 0x0 }, ++ .regs[10] = { IMX415_TXCLKESC_FREQ, 0x06C0 }, ++ }, ++ { ++ .lane_rate = 2079000000UL, ++ .inck = 37125000, ++ .regs[0] = { IMX415_BCWAIT_TIME, 0x07F }, ++ .regs[1] = { IMX415_CPWAIT_TIME, 0x05B }, ++ .regs[2] = { IMX415_SYS_MODE, 0x2 }, ++ .regs[3] = { IMX415_INCKSEL1, 0x00 }, ++ .regs[4] = { IMX415_INCKSEL2, 0x24 }, ++ .regs[5] = { IMX415_INCKSEL3, 0x0E0 }, ++ .regs[6] = { IMX415_INCKSEL4, 0x0E0 }, ++ .regs[7] = { IMX415_INCKSEL5, 0x24 }, ++ .regs[8] = { IMX415_INCKSEL6, 0x1 }, ++ .regs[9] = { IMX415_INCKSEL7, 0x0 }, ++ .regs[10] = { IMX415_TXCLKESC_FREQ, 0x0948 }, ++ }, ++ { ++ .lane_rate = 2079000000UL, ++ .inck = 74250000, ++ .regs[0] = { IMX415_BCWAIT_TIME, 0x0FF }, ++ .regs[1] = { IMX415_CPWAIT_TIME, 0x0B6 }, ++ .regs[2] = { IMX415_SYS_MODE, 0x2 }, ++ .regs[3] = { IMX415_INCKSEL1, 0x00 }, ++ .regs[4] = { IMX415_INCKSEL2, 0x28 }, ++ .regs[5] = { IMX415_INCKSEL3, 0x0E0 }, ++ .regs[6] = { IMX415_INCKSEL4, 0x0E0 }, ++ .regs[7] = { IMX415_INCKSEL5, 0x28 }, ++ .regs[8] = { IMX415_INCKSEL6, 0x1 }, ++ .regs[9] = { IMX415_INCKSEL7, 0x0 }, ++ .regs[10] = { IMX415_TXCLKESC_FREQ, 0x1290 }, ++ }, ++ { ++ .lane_rate = 2376000000UL, ++ .inck = 27000000, ++ .regs[0] = { IMX415_BCWAIT_TIME, 0x05D }, ++ .regs[1] = { IMX415_CPWAIT_TIME, 0x042 }, ++ .regs[2] = { IMX415_SYS_MODE, 0x0 }, ++ .regs[3] = { IMX415_INCKSEL1, 0x00 }, ++ .regs[4] = { IMX415_INCKSEL2, 0x23 }, ++ .regs[5] = { IMX415_INCKSEL3, 0x108 }, ++ .regs[6] = { IMX415_INCKSEL4, 0x0E7 }, ++ .regs[7] = { IMX415_INCKSEL5, 0x23 }, ++ .regs[8] = { IMX415_INCKSEL6, 0x1 }, ++ .regs[9] = { IMX415_INCKSEL7, 0x0 }, ++ .regs[10] = { IMX415_TXCLKESC_FREQ, 0x06C0 }, ++ }, ++ { ++ .lane_rate = 2376000000UL, ++ .inck = 37125000, ++ .regs[0] = { IMX415_BCWAIT_TIME, 0x07F }, ++ .regs[1] = { IMX415_CPWAIT_TIME, 0x05B }, ++ .regs[2] = { IMX415_SYS_MODE, 0x0 }, ++ .regs[3] = { IMX415_INCKSEL1, 0x00 }, ++ .regs[4] = { IMX415_INCKSEL2, 0x24 }, ++ .regs[5] = { IMX415_INCKSEL3, 0x100 }, ++ .regs[6] = { IMX415_INCKSEL4, 0x0E0 }, ++ .regs[7] = { IMX415_INCKSEL5, 0x24 }, ++ .regs[8] = { IMX415_INCKSEL6, 0x1 }, ++ .regs[9] = { IMX415_INCKSEL7, 0x0 }, ++ .regs[10] = { IMX415_TXCLKESC_FREQ, 0x0948 }, ++ }, ++ { ++ .lane_rate = 2376000000UL, ++ .inck = 74250000, ++ .regs[0] = { IMX415_BCWAIT_TIME, 0x0FF }, ++ .regs[1] = { IMX415_CPWAIT_TIME, 0x0B6 }, ++ .regs[2] = { IMX415_SYS_MODE, 0x0 }, ++ .regs[3] = { IMX415_INCKSEL1, 0x00 }, ++ .regs[4] = { IMX415_INCKSEL2, 0x28 }, ++ .regs[5] = { IMX415_INCKSEL3, 0x100 }, ++ .regs[6] = { IMX415_INCKSEL4, 0x0E0 }, ++ .regs[7] = { IMX415_INCKSEL5, 0x28 }, ++ .regs[8] = { IMX415_INCKSEL6, 0x1 }, ++ .regs[9] = { IMX415_INCKSEL7, 0x0 }, ++ .regs[10] = { IMX415_TXCLKESC_FREQ, 0x1290 }, ++ }, + }; + + /* all-pixel 2-lane 720 Mbps 15.74 Hz mode */ diff --git a/target/linux/bcm27xx/patches-6.6/950-1494-dtoverlays-Add-overlay-for-Sony-IMX415-image-sensor.patch b/target/linux/bcm27xx/patches-6.6/950-1494-dtoverlays-Add-overlay-for-Sony-IMX415-image-sensor.patch new file mode 100644 index 00000000000000..139cd58284082e --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1494-dtoverlays-Add-overlay-for-Sony-IMX415-image-sensor.patch @@ -0,0 +1,214 @@ +From 384e58f63a3a328f7f656052b6357f3408aac6c3 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Tue, 31 Dec 2024 20:33:46 +0000 +Subject: [PATCH] dtoverlays: Add overlay for Sony IMX415 image sensor + +Signed-off-by: Dave Stevenson +--- + arch/arm/boot/dts/overlays/Makefile | 1 + + arch/arm/boot/dts/overlays/README | 31 +++++ + arch/arm/boot/dts/overlays/imx415-overlay.dts | 116 ++++++++++++++++++ + arch/arm/boot/dts/overlays/imx415.dtsi | 27 ++++ + 4 files changed, 175 insertions(+) + create mode 100644 arch/arm/boot/dts/overlays/imx415-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/imx415.dtsi + +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -135,6 +135,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ + imx296.dtbo \ + imx327.dtbo \ + imx378.dtbo \ ++ imx415.dtbo \ + imx462.dtbo \ + imx477.dtbo \ + imx500.dtbo \ +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -2859,6 +2859,37 @@ Params: rotation Mounting + 450000000 (default), 453000000, 456000000. + + ++Name: imx415 ++Info: Sony IMX415 camera module. ++ Uses Unicam 1, which is the standard camera connector on most Pi ++ variants. By default this uses 4 CSI2 data lanes, so requires a ++ Compute Module or Pi5. ++Load: dtoverlay=imx415, ++Params: addr Set I2C address of sensor. Valid values are ++ 0x10, 0x1a, 0x36 and 0x37. Default is 0x37. ++ 4lane Enable 4 CSI2 data lanes. ++ clock-frequency Sets the clock frequency to match that used on ++ the board. ++ Valid values are 24, 27, 37.125, 72, or ++ 74.25MHz. ++ The default is 24MHz. ++ Note that the link frequencies permitted vary ++ based on the oscillator used. ++ link-frequency Confgures the link frequency to be used. Note ++ that the permitted values vary based on ++ clock-frequency and number of lanes. ++ The default is 360MHz for 720Mbit/s. ++ orientation Sensor orientation (0 = front, 1 = rear, ++ 2 = external, default external) ++ rotation Mounting rotation of the camera sensor (0 or ++ 180, default 0) ++ media-controller Configure use of Media Controller API for ++ configuring the sensor (default on) ++ cam0 Adopt the default configuration for CAM0 on a ++ Compute Module (CSI0, i2c_vc, and cam0_reg). ++ vcm Enable ad5398 VCM associated with the sensor. ++ ++ + Name: imx462 + Info: Sony IMX462 camera module. + Uses Unicam 1, which is the standard camera connector on most Pi +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/imx415-overlay.dts +@@ -0,0 +1,116 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++// Definitions for IMX415 camera module on VC I2C bus ++/dts-v1/; ++/plugin/; ++ ++#include ++ ++/{ ++ compatible = "brcm,bcm2835"; ++ ++ fragment@0 { ++ target = <&i2c0if>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ clk_frag: fragment@1 { ++ target = <&cam1_clk>; ++ cam_clk: __overlay__ { ++ status = "okay"; ++ clock-frequency = <24000000>; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&i2c0mux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ reg_frag: fragment@3 { ++ target = <&cam1_reg>; ++ cam_reg: __overlay__ { ++ startup-delay-us = <100000>; ++ }; ++ }; ++ ++ i2c_frag: fragment@100 { ++ target = <&i2c_csi_dsi>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ #include "imx415.dtsi" ++ ++ vcm: ad5398@c { ++ compatible = "adi,ad5398"; ++ reg = <0x0c>; ++ status = "disabled"; ++ VANA-supply = <&cam1_reg>; ++ }; ++ }; ++ }; ++ ++ csi_frag: fragment@101 { ++ target = <&csi1>; ++ csi: __overlay__ { ++ status = "okay"; ++ brcm,media-controller; ++ ++ port { ++ csi_ep: endpoint { ++ remote-endpoint = <&cam_endpoint>; ++ clock-lanes = <0>; ++ data-lanes = <1 2>; ++ clock-noncontinuous; ++ }; ++ }; ++ }; ++ }; ++ ++ fragment@201 { ++ target = <&cam_endpoint>; ++ __dormant__ { ++ data-lanes = <1 2 3 4>; ++ }; ++ }; ++ ++ fragment@202 { ++ target = <&csi_ep>; ++ __dormant__ { ++ data-lanes = <1 2 3 4>; ++ }; ++ }; ++ ++ ++ __overrides__ { ++ addr = <&cam_node>, "reg:0"; ++ rotation = <&cam_node>,"rotation:0"; ++ orientation = <&cam_node>,"orientation:0"; ++ media-controller = <&csi>,"brcm,media-controller?"; ++ cam0 = <&i2c_frag>, "target:0=",<&i2c_csi_dsi0>, ++ <&csi_frag>, "target:0=",<&csi0>, ++ <®_frag>, "target:0=",<&cam0_reg>, ++ <&clk_frag>, "target:0=",<&cam0_clk>, ++ <&cam_node>, "clocks:0=",<&cam0_clk>, ++ <&cam_node>, "avdd-supply:0=",<&cam0_reg>, ++ <&vcm>, "VANA-supply:0=", <&cam0_reg>; ++ vcm = <&vcm>, "status=okay", ++ <&cam_node>,"lens-focus:0=", <&vcm>; ++ clock-frequency = <&cam_clk>, "clock-frequency:0"; ++ link-frequency = <&cam_endpoint>,"link-frequencies#0"; ++ 4lane = <0>, "+201+202"; ++ }; ++}; ++ ++&cam_node { ++ status = "okay"; ++}; ++ ++&cam_endpoint { ++ remote-endpoint = <&csi_ep>; ++}; +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/imx415.dtsi +@@ -0,0 +1,27 @@ ++// Fragment that configures an imx415 ++ ++cam_node: imx415@37 { ++ compatible = "sony,imx415"; ++ reg = <0x37>; ++ status = "disabled"; ++ ++ clocks = <&cam1_clk>; ++ clock-names = "inck"; ++ ++ avdd-supply = <&cam1_reg>; /* 2.8v */ ++ dvdd-supply = <&cam_dummy_reg>; /* 1.8v */ ++ ovdd-supply = <&cam_dummy_reg>; /* 1.2v */ ++ ++ rotation = <180>; ++ orientation = <2>; ++ ++ port { ++ cam_endpoint: endpoint { ++ clock-lanes = <0>; ++ data-lanes = <1 2>; ++ //clock-noncontinuous; ++ link-frequencies = ++ /bits/ 64 <360000000>; ++ }; ++ }; ++}; diff --git a/target/linux/bcm27xx/patches-6.6/950-1495-media-i2c-imx415-Add-read-write-control-of-VBLANK.patch b/target/linux/bcm27xx/patches-6.6/950-1495-media-i2c-imx415-Add-read-write-control-of-VBLANK.patch new file mode 100644 index 00000000000000..aee483b9794701 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1495-media-i2c-imx415-Add-read-write-control-of-VBLANK.patch @@ -0,0 +1,146 @@ +From 4e8d73ce89c6dd6fdcb8dd7df8310762707c5b1a Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Wed, 1 Jan 2025 14:18:25 +0000 +Subject: [PATCH] media: i2c: imx415: Add read/write control of VBLANK + +This also requires that the ranges for the exposure control +are updated. + +Signed-off-by: Dave Stevenson +--- + drivers/media/i2c/imx415.c | 52 +++++++++++++++++++++++++------------- + 1 file changed, 34 insertions(+), 18 deletions(-) + +--- a/drivers/media/i2c/imx415.c ++++ b/drivers/media/i2c/imx415.c +@@ -25,6 +25,7 @@ + #define IMX415_PIXEL_ARRAY_WIDTH 3864 + #define IMX415_PIXEL_ARRAY_HEIGHT 2192 + #define IMX415_PIXEL_ARRAY_VBLANK 58 ++#define IMX415_EXPOSURE_OFFSET 8 + + #define IMX415_NUM_CLK_PARAM_REGS 11 + +@@ -56,6 +57,7 @@ + #define IMX415_OUTSEL IMX415_REG_8BIT(0x30C0) + #define IMX415_DRV IMX415_REG_8BIT(0x30C1) + #define IMX415_VMAX IMX415_REG_24BIT(0x3024) ++#define IMX415_VMAX_MAX 0xfffff + #define IMX415_HMAX IMX415_REG_16BIT(0x3028) + #define IMX415_SHR0 IMX415_REG_24BIT(0x3050) + #define IMX415_GAIN_PCG_0 IMX415_REG_16BIT(0x3090) +@@ -457,7 +459,6 @@ static const struct imx415_clk_params im + + /* all-pixel 2-lane 720 Mbps 15.74 Hz mode */ + static const struct imx415_reg imx415_mode_2_720[] = { +- { IMX415_VMAX, 0x08CA }, + { IMX415_HMAX, 0x07F0 }, + { IMX415_LANEMODE, IMX415_LANEMODE_2 }, + { IMX415_TCLKPOST, 0x006F }, +@@ -473,7 +474,6 @@ static const struct imx415_reg imx415_mo + + /* all-pixel 2-lane 1440 Mbps 30.01 Hz mode */ + static const struct imx415_reg imx415_mode_2_1440[] = { +- { IMX415_VMAX, 0x08CA }, + { IMX415_HMAX, 0x042A }, + { IMX415_LANEMODE, IMX415_LANEMODE_2 }, + { IMX415_TCLKPOST, 0x009F }, +@@ -489,7 +489,6 @@ static const struct imx415_reg imx415_mo + + /* all-pixel 4-lane 891 Mbps 30 Hz mode */ + static const struct imx415_reg imx415_mode_4_891[] = { +- { IMX415_VMAX, 0x08CA }, + { IMX415_HMAX, 0x044C }, + { IMX415_LANEMODE, IMX415_LANEMODE_4 }, + { IMX415_TCLKPOST, 0x007F }, +@@ -617,6 +616,7 @@ struct imx415 { + struct v4l2_ctrl *vblank; + struct v4l2_ctrl *hflip; + struct v4l2_ctrl *vflip; ++ struct v4l2_ctrl *exposure; + + unsigned int cur_mode; + unsigned int num_data_lanes; +@@ -795,16 +795,37 @@ static int imx415_s_ctrl(struct v4l2_ctr + ctrls); + const struct v4l2_mbus_framefmt *format; + struct v4l2_subdev_state *state; ++ u32 exposure_max; + unsigned int vmax; + unsigned int flip; +- +- if (!sensor->streaming) +- return 0; ++ int ret; + + state = v4l2_subdev_get_locked_active_state(&sensor->subdev); + format = v4l2_subdev_get_pad_format(&sensor->subdev, state, 0); + ++ if (ctrl->id == V4L2_CID_VBLANK) { ++ exposure_max = format->height + ctrl->val - ++ IMX415_EXPOSURE_OFFSET; ++ __v4l2_ctrl_modify_range(sensor->exposure, ++ sensor->exposure->minimum, ++ exposure_max, sensor->exposure->step, ++ sensor->exposure->default_value); ++ } ++ ++ if (!sensor->streaming) ++ return 0; ++ + switch (ctrl->id) { ++ case V4L2_CID_VBLANK: ++ ret = imx415_write(sensor, IMX415_VMAX, ++ format->height + ctrl->val); ++ if (ret) ++ return ret; ++ /* ++ * Deliberately fall through as exposure is set based on VMAX ++ * which has just changed. ++ */ ++ fallthrough; + case V4L2_CID_EXPOSURE: + /* clamp the exposure value to VMAX. */ + vmax = format->height + sensor->vblank->cur.val; +@@ -840,7 +861,8 @@ static int imx415_ctrls_init(struct imx4 + u64 pixel_rate = supported_modes[sensor->cur_mode].pixel_rate; + u64 lane_rate = supported_modes[sensor->cur_mode].lane_rate; + u32 exposure_max = IMX415_PIXEL_ARRAY_HEIGHT + +- IMX415_PIXEL_ARRAY_VBLANK - 8; ++ IMX415_PIXEL_ARRAY_VBLANK - ++ IMX415_EXPOSURE_OFFSET; + u32 hblank; + unsigned int i; + int ret; +@@ -869,8 +891,9 @@ static int imx415_ctrls_init(struct imx4 + if (ctrl) + ctrl->flags |= V4L2_CTRL_FLAG_READ_ONLY; + +- v4l2_ctrl_new_std(&sensor->ctrls, &imx415_ctrl_ops, V4L2_CID_EXPOSURE, +- 4, exposure_max, 1, exposure_max); ++ sensor->exposure = v4l2_ctrl_new_std(&sensor->ctrls, &imx415_ctrl_ops, ++ V4L2_CID_EXPOSURE, 4, ++ exposure_max, 1, exposure_max); + + v4l2_ctrl_new_std(&sensor->ctrls, &imx415_ctrl_ops, + V4L2_CID_ANALOGUE_GAIN, IMX415_AGAIN_MIN, +@@ -887,16 +910,9 @@ static int imx415_ctrls_init(struct imx4 + sensor->vblank = v4l2_ctrl_new_std(&sensor->ctrls, &imx415_ctrl_ops, + V4L2_CID_VBLANK, + IMX415_PIXEL_ARRAY_VBLANK, +- IMX415_PIXEL_ARRAY_VBLANK, 1, +- IMX415_PIXEL_ARRAY_VBLANK); +- if (sensor->vblank) +- sensor->vblank->flags |= V4L2_CTRL_FLAG_READ_ONLY; +- +- /* +- * The pixel rate used here is a virtual value and can be used for +- * calculating the frame rate together with hblank. It may not +- * necessarily be the physically correct pixel clock. +- */ ++ IMX415_VMAX_MAX - IMX415_PIXEL_ARRAY_HEIGHT, ++ 1, IMX415_PIXEL_ARRAY_VBLANK); ++ + v4l2_ctrl_new_std(&sensor->ctrls, NULL, V4L2_CID_PIXEL_RATE, pixel_rate, + pixel_rate, 1, pixel_rate); + diff --git a/target/linux/bcm27xx/patches-6.6/950-1496-media-i2c-imx415-Make-HBLANK-controllable-and-in-con.patch b/target/linux/bcm27xx/patches-6.6/950-1496-media-i2c-imx415-Make-HBLANK-controllable-and-in-con.patch new file mode 100644 index 00000000000000..7ad9e11953b78c --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1496-media-i2c-imx415-Make-HBLANK-controllable-and-in-con.patch @@ -0,0 +1,231 @@ +From 6722e1358768671c1e5761aa092efb4ae62b2c46 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Wed, 1 Jan 2025 17:01:34 +0000 +Subject: [PATCH] media: i2c: imx415: Make HBLANK controllable and in + consistent units + +The control of HMAX documented in the datasheet is consistent +with being in terms of a scaled INCK, being always 72MHz or +74.25MHz. It is NOT link frequency dependent, but the minimum +value for HMAX is dictated by the link frequency. + +If PIXEL_RATE is defined as being 12 times the 72 or 74.25MHz, +and all values are scaled down again when writing HMAX, then +the numbers all work out regardless of INCK or link frequency. +Retain an hmax_min (set to the same value as the previous fixed +hmax register value) to set as the default value to avoid changing +the behaviour for existing users. + +Signed-off-by: Dave Stevenson +--- + drivers/media/i2c/imx415.c | 86 +++++++++++++++++--------------------- + 1 file changed, 38 insertions(+), 48 deletions(-) + +--- a/drivers/media/i2c/imx415.c ++++ b/drivers/media/i2c/imx415.c +@@ -27,6 +27,9 @@ + #define IMX415_PIXEL_ARRAY_VBLANK 58 + #define IMX415_EXPOSURE_OFFSET 8 + ++#define IMX415_PIXEL_RATE_74_25MHZ 891000000 ++#define IMX415_PIXEL_RATE_72MHZ 864000000 ++ + #define IMX415_NUM_CLK_PARAM_REGS 11 + + #define IMX415_REG_8BIT(n) ((1 << 16) | (n)) +@@ -59,6 +62,8 @@ + #define IMX415_VMAX IMX415_REG_24BIT(0x3024) + #define IMX415_VMAX_MAX 0xfffff + #define IMX415_HMAX IMX415_REG_16BIT(0x3028) ++#define IMX415_HMAX_MAX 0xffff ++#define IMX415_HMAX_MULTIPLIER 12 + #define IMX415_SHR0 IMX415_REG_24BIT(0x3050) + #define IMX415_GAIN_PCG_0 IMX415_REG_16BIT(0x3090) + #define IMX415_AGAIN_MIN 0 +@@ -459,7 +464,6 @@ static const struct imx415_clk_params im + + /* all-pixel 2-lane 720 Mbps 15.74 Hz mode */ + static const struct imx415_reg imx415_mode_2_720[] = { +- { IMX415_HMAX, 0x07F0 }, + { IMX415_LANEMODE, IMX415_LANEMODE_2 }, + { IMX415_TCLKPOST, 0x006F }, + { IMX415_TCLKPREPARE, 0x002F }, +@@ -474,7 +478,6 @@ static const struct imx415_reg imx415_mo + + /* all-pixel 2-lane 1440 Mbps 30.01 Hz mode */ + static const struct imx415_reg imx415_mode_2_1440[] = { +- { IMX415_HMAX, 0x042A }, + { IMX415_LANEMODE, IMX415_LANEMODE_2 }, + { IMX415_TCLKPOST, 0x009F }, + { IMX415_TCLKPREPARE, 0x0057 }, +@@ -489,7 +492,6 @@ static const struct imx415_reg imx415_mo + + /* all-pixel 4-lane 891 Mbps 30 Hz mode */ + static const struct imx415_reg imx415_mode_4_891[] = { +- { IMX415_HMAX, 0x044C }, + { IMX415_LANEMODE, IMX415_LANEMODE_4 }, + { IMX415_TCLKPOST, 0x007F }, + { IMX415_TCLKPREPARE, 0x0037 }, +@@ -507,39 +509,10 @@ struct imx415_mode_reg_list { + const struct imx415_reg *regs; + }; + +-/* +- * Mode : number of lanes, lane rate and frame rate dependent settings +- * +- * pixel_rate and hmax_pix are needed to calculate hblank for the v4l2 ctrl +- * interface. These values can not be found in the data sheet and should be +- * treated as virtual values. Use following table when adding new modes. +- * +- * lane_rate lanes fps hmax_pix pixel_rate +- * +- * 594 2 10.000 4400 99000000 +- * 891 2 15.000 4400 148500000 +- * 720 2 15.748 4064 144000000 +- * 1782 2 30.000 4400 297000000 +- * 2079 2 30.000 4400 297000000 +- * 1440 2 30.019 4510 304615385 +- * +- * 594 4 20.000 5500 247500000 +- * 594 4 25.000 4400 247500000 +- * 720 4 25.000 4400 247500000 +- * 720 4 30.019 4510 304615385 +- * 891 4 30.000 4400 297000000 +- * 1440 4 30.019 4510 304615385 +- * 1440 4 60.038 4510 609230769 +- * 1485 4 60.000 4400 594000000 +- * 1782 4 60.000 4400 594000000 +- * 2079 4 60.000 4400 594000000 +- * 2376 4 90.164 4392 891000000 +- */ + struct imx415_mode { + u64 lane_rate; + u32 lanes; +- u32 hmax_pix; +- u64 pixel_rate; ++ u32 hmax_min; + struct imx415_mode_reg_list reg_list; + }; + +@@ -548,8 +521,7 @@ static const struct imx415_mode supporte + { + .lane_rate = 720000000, + .lanes = 2, +- .hmax_pix = 4064, +- .pixel_rate = 144000000, ++ .hmax_min = 2032, + .reg_list = { + .num_of_regs = ARRAY_SIZE(imx415_mode_2_720), + .regs = imx415_mode_2_720, +@@ -558,8 +530,7 @@ static const struct imx415_mode supporte + { + .lane_rate = 1440000000, + .lanes = 2, +- .hmax_pix = 4510, +- .pixel_rate = 304615385, ++ .hmax_min = 1066, + .reg_list = { + .num_of_regs = ARRAY_SIZE(imx415_mode_2_1440), + .regs = imx415_mode_2_1440, +@@ -568,8 +539,7 @@ static const struct imx415_mode supporte + { + .lane_rate = 891000000, + .lanes = 4, +- .hmax_pix = 4400, +- .pixel_rate = 297000000, ++ .hmax_min = 1100, + .reg_list = { + .num_of_regs = ARRAY_SIZE(imx415_mode_4_891), + .regs = imx415_mode_4_891, +@@ -601,6 +571,7 @@ static const char *const imx415_test_pat + struct imx415 { + struct device *dev; + struct clk *clk; ++ unsigned long pixel_rate; + struct regulator_bulk_data supplies[ARRAY_SIZE(imx415_supply_names)]; + struct gpio_desc *reset; + struct regmap *regmap; +@@ -614,6 +585,7 @@ struct imx415 { + + struct v4l2_ctrl_handler ctrls; + struct v4l2_ctrl *vblank; ++ struct v4l2_ctrl *hblank; + struct v4l2_ctrl *hflip; + struct v4l2_ctrl *vflip; + struct v4l2_ctrl *exposure; +@@ -845,6 +817,11 @@ static int imx415_s_ctrl(struct v4l2_ctr + case V4L2_CID_TEST_PATTERN: + return imx415_set_testpattern(sensor, ctrl->val); + ++ case V4L2_CID_HBLANK: ++ return imx415_write(sensor, IMX415_HMAX, ++ (format->width + ctrl->val) / ++ IMX415_HMAX_MULTIPLIER); ++ + default: + return -EINVAL; + } +@@ -858,12 +835,11 @@ static int imx415_ctrls_init(struct imx4 + { + struct v4l2_fwnode_device_properties props; + struct v4l2_ctrl *ctrl; +- u64 pixel_rate = supported_modes[sensor->cur_mode].pixel_rate; + u64 lane_rate = supported_modes[sensor->cur_mode].lane_rate; + u32 exposure_max = IMX415_PIXEL_ARRAY_HEIGHT + + IMX415_PIXEL_ARRAY_VBLANK - + IMX415_EXPOSURE_OFFSET; +- u32 hblank; ++ u32 hblank_min, hblank_max; + unsigned int i; + int ret; + +@@ -900,12 +876,14 @@ static int imx415_ctrls_init(struct imx4 + IMX415_AGAIN_MAX, IMX415_AGAIN_STEP, + IMX415_AGAIN_MIN); + +- hblank = supported_modes[sensor->cur_mode].hmax_pix - +- IMX415_PIXEL_ARRAY_WIDTH; ++ hblank_min = (supported_modes[sensor->cur_mode].hmax_min * ++ IMX415_HMAX_MULTIPLIER) - IMX415_PIXEL_ARRAY_WIDTH; ++ hblank_max = (IMX415_HMAX_MAX * IMX415_HMAX_MULTIPLIER) - ++ IMX415_PIXEL_ARRAY_WIDTH; + ctrl = v4l2_ctrl_new_std(&sensor->ctrls, &imx415_ctrl_ops, +- V4L2_CID_HBLANK, hblank, hblank, 1, hblank); +- if (ctrl) +- ctrl->flags |= V4L2_CTRL_FLAG_READ_ONLY; ++ V4L2_CID_HBLANK, hblank_min, ++ hblank_max, IMX415_HMAX_MULTIPLIER, ++ hblank_min); + + sensor->vblank = v4l2_ctrl_new_std(&sensor->ctrls, &imx415_ctrl_ops, + V4L2_CID_VBLANK, +@@ -913,8 +891,9 @@ static int imx415_ctrls_init(struct imx4 + IMX415_VMAX_MAX - IMX415_PIXEL_ARRAY_HEIGHT, + 1, IMX415_PIXEL_ARRAY_VBLANK); + +- v4l2_ctrl_new_std(&sensor->ctrls, NULL, V4L2_CID_PIXEL_RATE, pixel_rate, +- pixel_rate, 1, pixel_rate); ++ v4l2_ctrl_new_std(&sensor->ctrls, NULL, V4L2_CID_PIXEL_RATE, ++ sensor->pixel_rate, sensor->pixel_rate, 1, ++ sensor->pixel_rate); + + sensor->hflip = v4l2_ctrl_new_std(&sensor->ctrls, &imx415_ctrl_ops, + V4L2_CID_HFLIP, 0, 1, 1, 0); +@@ -1410,6 +1389,17 @@ static int imx415_parse_hw_config(struct + "no valid sensor mode defined\n"); + goto done_endpoint_free; + } ++ switch (inck) { ++ case 27000000: ++ case 37125000: ++ case 74250000: ++ sensor->pixel_rate = IMX415_PIXEL_RATE_74_25MHZ; ++ break; ++ case 24000000: ++ case 72000000: ++ sensor->pixel_rate = IMX415_PIXEL_RATE_72MHZ; ++ break; ++ } + + lane_rate = supported_modes[sensor->cur_mode].lane_rate; + for (i = 0; i < ARRAY_SIZE(imx415_clk_params); ++i) { diff --git a/target/linux/bcm27xx/patches-6.6/950-1497-media-i2c-imx415-Link-frequencies-are-not-exclusive-.patch b/target/linux/bcm27xx/patches-6.6/950-1497-media-i2c-imx415-Link-frequencies-are-not-exclusive-.patch new file mode 100644 index 00000000000000..d0375058c3fe23 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1497-media-i2c-imx415-Link-frequencies-are-not-exclusive-.patch @@ -0,0 +1,136 @@ +From 0292614f8cd061f71f975dae7d74fe5324545321 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Thu, 2 Jan 2025 12:43:01 +0000 +Subject: [PATCH] media: i2c: imx415: Link frequencies are not exclusive to num + lanes + +The link frequencies are equally valid in 2 or 4 lane modes, but +they change the hmax_min value for the mode as the MIPI block +has to have sufficient time to send the pixel data for each line. + +Remove the association with number of lanes, and add hmax_min +configuration for both lane options. + +Signed-off-by: Dave Stevenson +--- + drivers/media/i2c/imx415.c | 49 +++++++++++++++++--------------------- + 1 file changed, 22 insertions(+), 27 deletions(-) + +--- a/drivers/media/i2c/imx415.c ++++ b/drivers/media/i2c/imx415.c +@@ -462,9 +462,8 @@ static const struct imx415_clk_params im + }, + }; + +-/* all-pixel 2-lane 720 Mbps 15.74 Hz mode */ +-static const struct imx415_reg imx415_mode_2_720[] = { +- { IMX415_LANEMODE, IMX415_LANEMODE_2 }, ++/* 720 Mbps CSI configuration */ ++static const struct imx415_reg imx415_linkrate_720mbps[] = { + { IMX415_TCLKPOST, 0x006F }, + { IMX415_TCLKPREPARE, 0x002F }, + { IMX415_TCLKTRAIL, 0x002F }, +@@ -476,9 +475,8 @@ static const struct imx415_reg imx415_mo + { IMX415_TLPX, 0x0027 }, + }; + +-/* all-pixel 2-lane 1440 Mbps 30.01 Hz mode */ +-static const struct imx415_reg imx415_mode_2_1440[] = { +- { IMX415_LANEMODE, IMX415_LANEMODE_2 }, ++/* 1440 Mbps CSI configuration */ ++static const struct imx415_reg imx415_linkrate_1440mbps[] = { + { IMX415_TCLKPOST, 0x009F }, + { IMX415_TCLKPREPARE, 0x0057 }, + { IMX415_TCLKTRAIL, 0x0057 }, +@@ -490,9 +488,8 @@ static const struct imx415_reg imx415_mo + { IMX415_TLPX, 0x004F }, + }; + +-/* all-pixel 4-lane 891 Mbps 30 Hz mode */ +-static const struct imx415_reg imx415_mode_4_891[] = { +- { IMX415_LANEMODE, IMX415_LANEMODE_4 }, ++/* 891 Mbps */ ++static const struct imx415_reg imx415_linkrate_891mbps[] = { + { IMX415_TCLKPOST, 0x007F }, + { IMX415_TCLKPREPARE, 0x0037 }, + { IMX415_TCLKTRAIL, 0x0037 }, +@@ -511,8 +508,7 @@ struct imx415_mode_reg_list { + + struct imx415_mode { + u64 lane_rate; +- u32 lanes; +- u32 hmax_min; ++ u32 hmax_min[2]; + struct imx415_mode_reg_list reg_list; + }; + +@@ -520,29 +516,26 @@ struct imx415_mode { + static const struct imx415_mode supported_modes[] = { + { + .lane_rate = 720000000, +- .lanes = 2, +- .hmax_min = 2032, ++ .hmax_min = { 2032, 1066 }, + .reg_list = { +- .num_of_regs = ARRAY_SIZE(imx415_mode_2_720), +- .regs = imx415_mode_2_720, ++ .num_of_regs = ARRAY_SIZE(imx415_linkrate_720mbps), ++ .regs = imx415_linkrate_720mbps, + }, + }, + { + .lane_rate = 1440000000, +- .lanes = 2, +- .hmax_min = 1066, ++ .hmax_min = { 1066, 533 }, + .reg_list = { +- .num_of_regs = ARRAY_SIZE(imx415_mode_2_1440), +- .regs = imx415_mode_2_1440, ++ .num_of_regs = ARRAY_SIZE(imx415_linkrate_1440mbps), ++ .regs = imx415_linkrate_1440mbps, + }, + }, + { + .lane_rate = 891000000, +- .lanes = 4, +- .hmax_min = 1100, ++ .hmax_min = { 1100, 550 }, + .reg_list = { +- .num_of_regs = ARRAY_SIZE(imx415_mode_4_891), +- .regs = imx415_mode_4_891, ++ .num_of_regs = ARRAY_SIZE(imx415_linkrate_891mbps), ++ .regs = imx415_linkrate_891mbps, + }, + }, + }; +@@ -876,7 +869,7 @@ static int imx415_ctrls_init(struct imx4 + IMX415_AGAIN_MAX, IMX415_AGAIN_STEP, + IMX415_AGAIN_MIN); + +- hblank_min = (supported_modes[sensor->cur_mode].hmax_min * ++ hblank_min = (supported_modes[sensor->cur_mode].hmax_min[sensor->num_data_lanes == 2 ? 0 : 1] * + IMX415_HMAX_MULTIPLIER) - IMX415_PIXEL_ARRAY_WIDTH; + hblank_max = (IMX415_HMAX_MAX * IMX415_HMAX_MULTIPLIER) - + IMX415_PIXEL_ARRAY_WIDTH; +@@ -944,7 +937,11 @@ static int imx415_set_mode(struct imx415 + return ret; + } + +- return 0; ++ ret = imx415_write(sensor, IMX415_LANEMODE, ++ sensor->num_data_lanes == 2 ? IMX415_LANEMODE_2 : ++ IMX415_LANEMODE_4); ++ ++ return ret; + } + + static int imx415_setup(struct imx415 *sensor, struct v4l2_subdev_state *state) +@@ -1373,8 +1370,6 @@ static int imx415_parse_hw_config(struct + } + + for (j = 0; j < ARRAY_SIZE(supported_modes); ++j) { +- if (sensor->num_data_lanes != supported_modes[j].lanes) +- continue; + if (bus_cfg.link_frequencies[i] * 2 != + supported_modes[j].lane_rate) + continue; diff --git a/target/linux/bcm27xx/patches-6.6/950-1498-dts-bcm2711-PL011-UARTs-are-actually-r1p5.patch b/target/linux/bcm27xx/patches-6.6/950-1498-dts-bcm2711-PL011-UARTs-are-actually-r1p5.patch new file mode 100644 index 00000000000000..a184b3134a43e7 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1498-dts-bcm2711-PL011-UARTs-are-actually-r1p5.patch @@ -0,0 +1,60 @@ +From 87fc066350358ce45f5ad52424c8a2e351b1720c Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 7 Jan 2025 12:05:41 +0000 +Subject: [PATCH] dts: bcm2711: PL011 UARTs are actually r1p5 + +The ARM PL011 UART instances in BCM2711 are r1p5 spec, which means they +have 32-entry FIFOs. The correct periphid value for this is 0x00341011. +Thanks to N Buchwitz for pointing this out. + +Signed-off-by: Phil Elwell +--- + arch/arm/boot/dts/broadcom/bcm2711.dtsi | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +--- a/arch/arm/boot/dts/broadcom/bcm2711.dtsi ++++ b/arch/arm/boot/dts/broadcom/bcm2711.dtsi +@@ -134,7 +134,7 @@ + clocks = <&clocks BCM2835_CLOCK_UART>, + <&clocks BCM2835_CLOCK_VPU>; + clock-names = "uartclk", "apb_pclk"; +- arm,primecell-periphid = <0x00241011>; ++ arm,primecell-periphid = <0x00341011>; + status = "disabled"; + }; + +@@ -145,7 +145,7 @@ + clocks = <&clocks BCM2835_CLOCK_UART>, + <&clocks BCM2835_CLOCK_VPU>; + clock-names = "uartclk", "apb_pclk"; +- arm,primecell-periphid = <0x00241011>; ++ arm,primecell-periphid = <0x00341011>; + status = "disabled"; + }; + +@@ -156,7 +156,7 @@ + clocks = <&clocks BCM2835_CLOCK_UART>, + <&clocks BCM2835_CLOCK_VPU>; + clock-names = "uartclk", "apb_pclk"; +- arm,primecell-periphid = <0x00241011>; ++ arm,primecell-periphid = <0x00341011>; + status = "disabled"; + }; + +@@ -167,7 +167,7 @@ + clocks = <&clocks BCM2835_CLOCK_UART>, + <&clocks BCM2835_CLOCK_VPU>; + clock-names = "uartclk", "apb_pclk"; +- arm,primecell-periphid = <0x00241011>; ++ arm,primecell-periphid = <0x00341011>; + status = "disabled"; + }; + +@@ -1155,6 +1155,7 @@ + }; + + &uart0 { ++ arm,primecell-periphid = <0x00341011>; + interrupts = ; + }; + diff --git a/target/linux/bcm27xx/patches-6.6/950-1499-dts-bcm2712-PL011-UARTs-are-actually-r1p5.patch b/target/linux/bcm27xx/patches-6.6/950-1499-dts-bcm2712-PL011-UARTs-are-actually-r1p5.patch new file mode 100644 index 00000000000000..520d1d64252072 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1499-dts-bcm2712-PL011-UARTs-are-actually-r1p5.patch @@ -0,0 +1,43 @@ +From 602be52637ecca0b247cf832c8a4ec345844d325 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 7 Jan 2025 12:09:48 +0000 +Subject: [PATCH] dts: bcm2712: PL011 UARTs are actually r1p5 + +The ARM PL011 UART instances in BCM2712 are r1p5 spec, which means they +have 32-entry FIFOs. The correct periphid value for this is 0x00341011. +Thanks to N Buchwitz for pointing this out. + +Signed-off-by: Phil Elwell +--- + arch/arm64/boot/dts/broadcom/bcm2712.dtsi | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/arch/arm64/boot/dts/broadcom/bcm2712.dtsi ++++ b/arch/arm64/boot/dts/broadcom/bcm2712.dtsi +@@ -190,7 +190,7 @@ + clocks = <&clk_uart>, + <&clk_vpu>; + clock-names = "uartclk", "apb_pclk"; +- arm,primecell-periphid = <0x00241011>; ++ arm,primecell-periphid = <0x00341011>; + status = "disabled"; + }; + +@@ -201,7 +201,7 @@ + clocks = <&clk_uart>, + <&clk_vpu>; + clock-names = "uartclk", "apb_pclk"; +- arm,primecell-periphid = <0x00241011>; ++ arm,primecell-periphid = <0x00341011>; + status = "disabled"; + }; + +@@ -212,7 +212,7 @@ + clocks = <&clk_uart>, + <&clk_vpu>; + clock-names = "uartclk", "apb_pclk"; +- arm,primecell-periphid = <0x00241011>; ++ arm,primecell-periphid = <0x00341011>; + status = "disabled"; + }; + diff --git a/target/linux/bcm27xx/patches-6.6/950-1500-dts-rp1-PL011-UARTs-are-actually-r1p5.patch b/target/linux/bcm27xx/patches-6.6/950-1500-dts-rp1-PL011-UARTs-are-actually-r1p5.patch new file mode 100644 index 00000000000000..9363036ccb9c4b --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1500-dts-rp1-PL011-UARTs-are-actually-r1p5.patch @@ -0,0 +1,70 @@ +From 7a4972f36a63eba4d862115265a7bf77ac1e4129 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 7 Jan 2025 12:11:10 +0000 +Subject: [PATCH] dts: rp1: PL011 UARTs are actually r1p5 + +The ARM PL011 UART instances in RP1 are r1p5 spec, which means they +have 32-entry FIFOs. The correct periphid value for this is 0x00341011. +Thanks to N Buchwitz for pointing this out. + +Signed-off-by: Phil Elwell +--- + arch/arm64/boot/dts/broadcom/rp1.dtsi | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +--- a/arch/arm64/boot/dts/broadcom/rp1.dtsi ++++ b/arch/arm64/boot/dts/broadcom/rp1.dtsi +@@ -69,7 +69,7 @@ + <&rp1_dma RP1_DMA_UART0_RX>; + dma-names = "tx", "rx"; + pinctrl-names = "default"; +- arm,primecell-periphid = <0x00541011>; ++ arm,primecell-periphid = <0x00341011>; + uart-has-rtscts; + cts-event-workaround; + skip-init; +@@ -86,7 +86,7 @@ + // <&rp1_dma RP1_DMA_UART1_RX>; + // dma-names = "tx", "rx"; + pinctrl-names = "default"; +- arm,primecell-periphid = <0x00541011>; ++ arm,primecell-periphid = <0x00341011>; + uart-has-rtscts; + cts-event-workaround; + skip-init; +@@ -103,7 +103,7 @@ + // <&rp1_dma RP1_DMA_UART2_RX>; + // dma-names = "tx", "rx"; + pinctrl-names = "default"; +- arm,primecell-periphid = <0x00541011>; ++ arm,primecell-periphid = <0x00341011>; + uart-has-rtscts; + cts-event-workaround; + skip-init; +@@ -120,7 +120,7 @@ + // <&rp1_dma RP1_DMA_UART3_RX>; + // dma-names = "tx", "rx"; + pinctrl-names = "default"; +- arm,primecell-periphid = <0x00541011>; ++ arm,primecell-periphid = <0x00341011>; + uart-has-rtscts; + cts-event-workaround; + skip-init; +@@ -137,7 +137,7 @@ + // <&rp1_dma RP1_DMA_UART4_RX>; + // dma-names = "tx", "rx"; + pinctrl-names = "default"; +- arm,primecell-periphid = <0x00541011>; ++ arm,primecell-periphid = <0x00341011>; + uart-has-rtscts; + cts-event-workaround; + skip-init; +@@ -154,7 +154,7 @@ + // <&rp1_dma RP1_DMA_UART5_RX>; + // dma-names = "tx", "rx"; + pinctrl-names = "default"; +- arm,primecell-periphid = <0x00541011>; ++ arm,primecell-periphid = <0x00341011>; + uart-has-rtscts; + cts-event-workaround; + skip-init; diff --git a/target/linux/bcm27xx/patches-6.6/950-1501-ASoC-pcm512x-Demote-No-SCLK-to-debug-level.patch b/target/linux/bcm27xx/patches-6.6/950-1501-ASoC-pcm512x-Demote-No-SCLK-to-debug-level.patch new file mode 100644 index 00000000000000..02857ce6db344a --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1501-ASoC-pcm512x-Demote-No-SCLK-to-debug-level.patch @@ -0,0 +1,25 @@ +From 4f7341263ebd6ab2ae805c8f27191d24abc05a62 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 8 Jan 2025 15:48:35 +0000 +Subject: [PATCH] ASoC: pcm512x: Demote "No SCLK" to debug level + +Designing a PCM512X-based soundcard with no external SCLK is a valid +choice supported by the driver. Don't alarm users with messages that +say "No SCLK, using BCLK: -2" - reclassify them as debug information. + +Signed-off-by: Phil Elwell +--- + sound/soc/codecs/pcm512x.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/sound/soc/codecs/pcm512x.c ++++ b/sound/soc/codecs/pcm512x.c +@@ -630,7 +630,7 @@ static int pcm512x_dai_startup_slave(str + struct regmap *regmap = pcm512x->regmap; + + if (IS_ERR(pcm512x->sclk)) { +- dev_info(dev, "No SCLK, using BCLK: %ld\n", ++ dev_dbg(dev, "No SCLK, using BCLK: %ld\n", + PTR_ERR(pcm512x->sclk)); + + /* Disable reporting of missing SCLK as an error */ diff --git a/target/linux/bcm27xx/patches-6.6/950-1502-ASoC-allo-piano-dac-plus-Fix-volume-limiting.patch b/target/linux/bcm27xx/patches-6.6/950-1502-ASoC-allo-piano-dac-plus-Fix-volume-limiting.patch new file mode 100644 index 00000000000000..f08083463fb8f2 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1502-ASoC-allo-piano-dac-plus-Fix-volume-limiting.patch @@ -0,0 +1,58 @@ +From 4111f4ede92b1f5bf869f87c66fc39151999c42f Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 8 Jan 2025 15:46:30 +0000 +Subject: [PATCH] ASoC: allo-piano-dac-plus: Fix volume limiting + +Controls which only exist when snd_soc_register_card returns can't be +modified before then. Move the setting of volume limits to just before +the end of the probe function. + +Link: https://github.com/raspberrypi/linux/issues/6527 + +Signed-off-by: Phil Elwell +--- + sound/soc/bcm/allo-piano-dac-plus.c | 26 ++++++++++++++------------ + 1 file changed, 14 insertions(+), 12 deletions(-) + +--- a/sound/soc/bcm/allo-piano-dac-plus.c ++++ b/sound/soc/bcm/allo-piano-dac-plus.c +@@ -734,18 +734,6 @@ static int snd_allo_piano_dac_init(struc + if (digital_gain_0db_limit) { + int ret; + +- ret = snd_soc_limit_volume(card, "Master Playback Volume", +- 207); +- if (ret < 0) +- dev_warn(card->dev, "Failed to set master volume limit: %d\n", +- ret); +- +- ret = snd_soc_limit_volume(card, "Subwoofer Playback Volume", +- 207); +- if (ret < 0) +- dev_warn(card->dev, "Failed to set subwoofer volume limit: %d\n", +- ret); +- + //Set volume limit on both dacs + for (i = 0; i < ARRAY_SIZE(codec_ctl_pfx); i++) { + char cname[256]; +@@ -1000,6 +988,20 @@ static int snd_allo_piano_dac_probe(stru + if (ret < 0) + return dev_err_probe(&pdev->dev, ret, "snd_soc_register_card() failed\n"); + ++ if (digital_gain_0db_limit) { ++ ret = snd_soc_limit_volume(card, "Master Playback Volume", ++ 207); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to set master volume limit: %d\n", ++ ret); ++ ++ ret = snd_soc_limit_volume(card, "Subwoofer Playback Volume", ++ 207); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to set subwoofer volume limit: %d\n", ++ ret); ++ } ++ + if ((mute_gpio[0]) && (mute_gpio[1])) + snd_allo_piano_gpio_mute(&snd_allo_piano_dac); + diff --git a/target/linux/bcm27xx/patches-6.6/950-1503-ASoC-allo-piano-dac-plus-Remove-pointless-code.patch b/target/linux/bcm27xx/patches-6.6/950-1503-ASoC-allo-piano-dac-plus-Remove-pointless-code.patch new file mode 100644 index 00000000000000..bb5c21d4291696 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1503-ASoC-allo-piano-dac-plus-Remove-pointless-code.patch @@ -0,0 +1,53 @@ +From 62c33972e3eb724d80179fb71b05e923920f0b0d Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 8 Jan 2025 16:05:02 +0000 +Subject: [PATCH] ASoC: allo-piano-dac-plus: Remove pointless code + +The codec control Digital Playback Volume is one of the controls deleted +by the allo-piano-dac-plus driver. It is effectively replaced by the +soundcard controls Master Playback Volume and Subwoofer Playback Volume. + +Delete the code that sets the volume limit on those codec controls - the +limits on the soundcard volume controls are sufficient. + +Signed-off-by: Phil Elwell +--- + sound/soc/bcm/allo-piano-dac-plus.c | 20 +------------------- + 1 file changed, 1 insertion(+), 19 deletions(-) + +--- a/sound/soc/bcm/allo-piano-dac-plus.c ++++ b/sound/soc/bcm/allo-piano-dac-plus.c +@@ -731,21 +731,6 @@ static int snd_allo_piano_dac_init(struc + + mutex_init(&glb_ptr->lock); + +- if (digital_gain_0db_limit) { +- int ret; +- +- //Set volume limit on both dacs +- for (i = 0; i < ARRAY_SIZE(codec_ctl_pfx); i++) { +- char cname[256]; +- +- sprintf(cname, "%s %s", codec_ctl_pfx[i], codec_ctl_name[0]); +- ret = snd_soc_limit_volume(card, cname, 207); +- if (ret < 0) +- dev_warn(card->dev, "Failed to set %s volume limit: %d\n", +- cname, ret); +- } +- } +- + // Remove codec controls + for (i = 0; i < ARRAY_SIZE(codec_ctl_pfx); i++) { + for (j = 0; j < ARRAY_SIZE(codec_ctl_name); j++) { +@@ -753,10 +738,7 @@ static int snd_allo_piano_dac_init(struc + + sprintf(cname, "%s %s", codec_ctl_pfx[i], codec_ctl_name[j]); + kctl = snd_soc_card_get_kcontrol(card, cname); +- if (!kctl) { +- dev_err(rtd->card->dev, "Control %s not found\n", +- cname); +- } else { ++ if (kctl) { + kctl->vd[0].access = + SNDRV_CTL_ELEM_ACCESS_READWRITE; + snd_ctl_remove(card->snd_card, kctl); diff --git a/target/linux/bcm27xx/patches-6.6/950-1505-DT-bcm2712-override-supports-cqe-to-a-cell.patch b/target/linux/bcm27xx/patches-6.6/950-1505-DT-bcm2712-override-supports-cqe-to-a-cell.patch new file mode 100644 index 00000000000000..c95c1d432ea2f8 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1505-DT-bcm2712-override-supports-cqe-to-a-cell.patch @@ -0,0 +1,90 @@ +From 301420a8cc44ee457670e015adc3a08cfc4531a9 Mon Sep 17 00:00:00 2001 +From: Jonathan Bell +Date: Wed, 8 Jan 2025 14:58:37 +0000 +Subject: [PATCH] DT: bcm2712: override supports-cqe to a cell + +We want to be able to control the interop surface exposed by Command +Queueing across bcm2712 products to a more restrictive default, with +selectable disable and permissive behaviour. + +Changing the bool to a cell lets it relay a tristate value. + +Also add the override parameter to CM5 as CM5-lite may interface with +arbitrary eMMC or SD cards. + +Signed-off-by: Jonathan Bell +--- + arch/arm/boot/dts/overlays/README | 11 ++++++++--- + arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts | 4 ++-- + arch/arm64/boot/dts/broadcom/bcm2712-rpi-cm5.dtsi | 3 ++- + arch/arm64/boot/dts/broadcom/bcm2712.dtsi | 2 +- + 4 files changed, 13 insertions(+), 7 deletions(-) + +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -405,9 +405,14 @@ Params: + non-lite SKU of CM4). + (default "on") + +- sd_cqe Set to "off" to disable Command Queueing if you +- have an incompatible Class A2 SD card +- (Pi 5 only, default "on") ++ sd_cqe Modify Command Queuing behaviour on the main SD ++ interface. Legal values are: ++ 0: disable CQ ++ 1: allow CQ for known-good SD A2 cards, and all ++ eMMC cards ++ 2: allow CQ for all SD A2 cards that aren't ++ known-bad, and all eMMC cards. ++ (2712 only, default "1") + + sd_overclock Clock (in MHz) to use when the MMC framework + requests 50MHz +--- a/arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts ++++ b/arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts +@@ -365,7 +365,7 @@ dpi_16bit_gpio2: &rp1_dpi_16bit_g + sd-uhs-sdr50; + sd-uhs-ddr50; + sd-uhs-sdr104; +- supports-cqe; ++ supports-cqe = <1>; + cd-gpios = <&gio_aon 5 GPIO_ACTIVE_LOW>; + //no-1-8-v; + status = "okay"; +@@ -745,6 +745,6 @@ spi10_cs_pins: &spi10_cs_gpio1 {}; + + / { + __overrides__ { +- sd_cqe = <&sdio1>, "supports-cqe?"; ++ sd_cqe = <&sdio1>, "supports-cqe:0"; + }; + }; +--- a/arch/arm64/boot/dts/broadcom/bcm2712-rpi-cm5.dtsi ++++ b/arch/arm64/boot/dts/broadcom/bcm2712-rpi-cm5.dtsi +@@ -339,7 +339,7 @@ dpi_16bit_gpio2: &rp1_dpi_16bit_g + mmc-hs400-1_8v; + mmc-hs400-enhanced-strobe; + broken-cd; +- supports-cqe; ++ supports-cqe = <1>; + status = "okay"; + }; + +@@ -752,5 +752,6 @@ spi10_cs_pins: &spi10_cs_gpio1 {}; + <&ant2>, "output-low?=on"; + noanthogs = <&ant1>,"status=disabled", + <&ant2>, "status=disabled"; ++ sd_cqe = <&sdio1>, "supports-cqe:0"; + }; + }; +--- a/arch/arm64/boot/dts/broadcom/bcm2712.dtsi ++++ b/arch/arm64/boot/dts/broadcom/bcm2712.dtsi +@@ -1210,7 +1210,7 @@ + clocks = <&clk_emmc2>; + sdhci-caps-mask = <0x0000C000 0x0>; + sdhci-caps = <0x0 0x0>; +- supports-cqe; ++ supports-cqe = <1>; + mmc-ddr-3_3v; + status = "disabled"; + }; diff --git a/target/linux/bcm27xx/patches-6.6/950-1506-mmc-sd-filter-card-CQ-support-based-on-an-allow-list.patch b/target/linux/bcm27xx/patches-6.6/950-1506-mmc-sd-filter-card-CQ-support-based-on-an-allow-list.patch new file mode 100644 index 00000000000000..e5148707bdaaa7 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1506-mmc-sd-filter-card-CQ-support-based-on-an-allow-list.patch @@ -0,0 +1,57 @@ +From d70a60eb03ae4fc687b91b5f6c4684000be21c5f Mon Sep 17 00:00:00 2001 +From: Jonathan Bell +Date: Wed, 8 Jan 2025 15:09:53 +0000 +Subject: [PATCH] mmc: sd: filter card CQ support based on an allow-list + +We have found that many SD cards in the field, even of the same make and +model, have latent bugs in their CQ implementation. Some product lines +have fewer bugs with newer manufacture dates, but this is not a +guarantee that a particular card is at a particular firmware revision +level. + +Many of these bugs lead to card hangs or data corruption. Add a quirk to +mark a card as having a tested, working CQ implementation and ignore the +capability if absent. + +Signed-off-by: Jonathan Bell +--- + drivers/mmc/core/card.h | 5 +++++ + drivers/mmc/core/sd.c | 4 ++++ + include/linux/mmc/card.h | 1 + + 3 files changed, 10 insertions(+) + +--- a/drivers/mmc/core/card.h ++++ b/drivers/mmc/core/card.h +@@ -292,4 +292,9 @@ static inline int mmc_card_broken_sd_pow + return c->quirks & MMC_QUIRK_BROKEN_SD_POWEROFF_NOTIFY; + } + ++static inline int mmc_card_working_sd_cq(const struct mmc_card *c) ++{ ++ return c->quirks & MMC_QUIRK_WORKING_SD_CQ; ++} ++ + #endif +--- a/drivers/mmc/core/sd.c ++++ b/drivers/mmc/core/sd.c +@@ -1506,6 +1506,10 @@ cont: + goto free_card; + } + ++ /* Disallow command queueing on unvetted cards */ ++ if (!mmc_card_working_sd_cq(card)) ++ card->ext_csd.cmdq_support = false; ++ + /* Enable command queueing if supported */ + if (card->ext_csd.cmdq_support && host->caps2 & MMC_CAP2_CQE) { + /* +--- a/include/linux/mmc/card.h ++++ b/include/linux/mmc/card.h +@@ -297,6 +297,7 @@ struct mmc_card { + #define MMC_QUIRK_BROKEN_SD_CACHE (1<<15) /* Disable broken SD cache support */ + #define MMC_QUIRK_BROKEN_CACHE_FLUSH (1<<16) /* Don't flush cache until the write has occurred */ + #define MMC_QUIRK_BROKEN_SD_POWEROFF_NOTIFY (1<<17) /* Disable broken SD poweroff notify support */ ++#define MMC_QUIRK_WORKING_SD_CQ (1<<30) /* SD card has known-good CQ implementation */ + #define MMC_QUIRK_ERASE_BROKEN (1<<31) /* Skip erase */ + + bool written_flag; /* Indicates eMMC has been written since power on */ diff --git a/target/linux/bcm27xx/patches-6.6/950-1507-mmc-set-MMC_QUIRK_KNOWN_WORKING_SD_CQ-on-Raspberry-P.patch b/target/linux/bcm27xx/patches-6.6/950-1507-mmc-set-MMC_QUIRK_KNOWN_WORKING_SD_CQ-on-Raspberry-P.patch new file mode 100644 index 00000000000000..0dd1ffae7163d1 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1507-mmc-set-MMC_QUIRK_KNOWN_WORKING_SD_CQ-on-Raspberry-P.patch @@ -0,0 +1,41 @@ +From eb4d8ffb2b007963662be7eca88baf0e5c358bd6 Mon Sep 17 00:00:00 2001 +From: Jonathan Bell +Date: Wed, 8 Jan 2025 15:18:33 +0000 +Subject: [PATCH] mmc: set MMC_QUIRK_KNOWN_WORKING_SD_CQ on Raspberry Pi class + A2 cards + +These cards have a known-good CQ implementation and are based on a +Longsys product. Add the MANFID for Longsys SD, and the particular CID +details for the Pi card. + +Signed-off-by: Jonathan Bell +--- + drivers/mmc/core/card.h | 1 + + drivers/mmc/core/quirks.h | 6 ++++++ + 2 files changed, 7 insertions(+) + +--- a/drivers/mmc/core/card.h ++++ b/drivers/mmc/core/card.h +@@ -90,6 +90,7 @@ struct mmc_fixup { + #define CID_MANFID_KINGSTON 0x70 + #define CID_MANFID_HYNIX 0x90 + #define CID_MANFID_KINGSTON_SD 0x9F ++#define CID_MANFID_LONGSYS_SD 0xAD + #define CID_MANFID_NUMONYX 0xFE + + #define END_FIXUP { NULL } +--- a/drivers/mmc/core/quirks.h ++++ b/drivers/mmc/core/quirks.h +@@ -66,6 +66,12 @@ static const struct mmc_fixup __maybe_un + 0, -1ull, SDIO_ANY_ID, SDIO_ANY_ID, add_quirk_sd, + MMC_QUIRK_BROKEN_SD_CACHE, EXT_CSD_REV_ANY), + ++ /* SD A2 allow-list - only trust CQ on these cards */ ++ /* Raspberry Pi A2 cards */ ++ _FIXUP_EXT(CID_NAME_ANY, CID_MANFID_LONGSYS_SD, 0x4c53, CID_YEAR_ANY, CID_MONTH_ANY, ++ cid_rev(1, 0, 0, 0), -1ull, SDIO_ANY_ID, SDIO_ANY_ID, add_quirk_sd, ++ MMC_QUIRK_WORKING_SD_CQ, EXT_CSD_REV_ANY), ++ + END_FIXUP + }; + diff --git a/target/linux/bcm27xx/patches-6.6/950-1508-mmc-use-downstream-DT-property-to-modify-CQE-and-or-.patch b/target/linux/bcm27xx/patches-6.6/950-1508-mmc-use-downstream-DT-property-to-modify-CQE-and-or-.patch new file mode 100644 index 00000000000000..2139eef8be7ddb --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1508-mmc-use-downstream-DT-property-to-modify-CQE-and-or-.patch @@ -0,0 +1,94 @@ +From e72f42ebc9a236c023f8027a37c9351d58e28b05 Mon Sep 17 00:00:00 2001 +From: Jonathan Bell +Date: Wed, 8 Jan 2025 16:02:27 +0000 +Subject: [PATCH] mmc: use downstream DT property to modify CQE and/or SD CQ + behaviour + +Implement a tristate-style option for "supports-cqe". If the property is +absent or zero, disable CQ completely. For 1, enable CQ unconditionally +for eMMC cards, and known-good SD cards. For 2, enable for eMMC cards, +and all SD cards that are not known-bad. + +The sdhci-brcmstb driver needs to know about the tristate as its probe +sequence would otherwise override a disable in mmc_of_parse(). + +Signed-off-by: Jonathan Bell +--- + drivers/mmc/core/host.c | 11 ++++++++++- + drivers/mmc/core/sd.c | 4 ++-- + drivers/mmc/host/sdhci-brcmstb.c | 6 ++++-- + include/linux/mmc/host.h | 1 + + 4 files changed, 17 insertions(+), 5 deletions(-) + +--- a/drivers/mmc/core/host.c ++++ b/drivers/mmc/core/host.c +@@ -275,7 +275,7 @@ EXPORT_SYMBOL(mmc_of_parse_clk_phase); + int mmc_of_parse(struct mmc_host *host) + { + struct device *dev = host->parent; +- u32 bus_width, drv_type, cd_debounce_delay_ms; ++ u32 bus_width, drv_type, cd_debounce_delay_ms, cq_allow; + int ret; + + if (!dev || !dev_fwnode(dev)) +@@ -410,6 +410,15 @@ int mmc_of_parse(struct mmc_host *host) + host->caps2 &= ~(MMC_CAP2_HS400_1_8V | MMC_CAP2_HS400_1_2V | + MMC_CAP2_HS400_ES); + ++ cq_allow = 0; ++ /* ++ * Downstream property - if a u32 and 2 instead of a bool, ++ * trust most A2 SD cards claiming CQ support. ++ */ ++ device_property_read_u32(dev, "supports-cqe", &cq_allow); ++ if (cq_allow == 2) ++ host->caps2 |= MMC_CAP2_SD_CQE_PERMISSIVE; ++ + /* Must be after "non-removable" check */ + if (device_property_read_u32(dev, "fixed-emmc-driver-type", &drv_type) == 0) { + if (host->caps & MMC_CAP_NONREMOVABLE) +--- a/drivers/mmc/core/sd.c ++++ b/drivers/mmc/core/sd.c +@@ -1506,8 +1506,8 @@ cont: + goto free_card; + } + +- /* Disallow command queueing on unvetted cards */ +- if (!mmc_card_working_sd_cq(card)) ++ /* Disallow command queueing on unvetted cards unless overridden */ ++ if (!(host->caps2 & MMC_CAP2_SD_CQE_PERMISSIVE) && !mmc_card_working_sd_cq(card)) + card->ext_csd.cmdq_support = false; + + /* Enable command queueing if supported */ +--- a/drivers/mmc/host/sdhci-brcmstb.c ++++ b/drivers/mmc/host/sdhci-brcmstb.c +@@ -511,7 +511,7 @@ static int sdhci_brcmstb_probe(struct pl + struct sdhci_pltfm_host *pltfm_host; + const struct of_device_id *match; + struct sdhci_brcmstb_priv *priv; +- u32 actual_clock_mhz; ++ u32 actual_clock_mhz, cqe; + struct sdhci_host *host; + struct resource *iomem; + bool no_pinctrl = false; +@@ -540,7 +540,9 @@ static int sdhci_brcmstb_probe(struct pl + pltfm_host->clk = clk; + + priv = sdhci_pltfm_priv(pltfm_host); +- if (device_property_read_bool(&pdev->dev, "supports-cqe")) { ++ cqe = 0; ++ device_property_read_u32(&pdev->dev, "supports-cqe", &cqe); ++ if (cqe > 0) { + priv->flags |= BRCMSTB_PRIV_FLAGS_HAS_CQE; + match_priv->ops->irq = sdhci_brcmstb_cqhci_irq; + } +--- a/include/linux/mmc/host.h ++++ b/include/linux/mmc/host.h +@@ -427,6 +427,7 @@ struct mmc_host { + #define MMC_CAP2_CRYPTO 0 + #endif + #define MMC_CAP2_ALT_GPT_TEGRA (1 << 28) /* Host with eMMC that has GPT entry at a non-standard location */ ++#define MMC_CAP2_SD_CQE_PERMISSIVE (1 << 31) /* Ignore allow-list for CQ capable SD card detection */ + + int fixed_drv_type; /* fixed driver type for non-removable media */ + diff --git a/target/linux/bcm27xx/patches-6.6/950-1509-misc-rp1-pio-Handle-probe-errors.patch b/target/linux/bcm27xx/patches-6.6/950-1509-misc-rp1-pio-Handle-probe-errors.patch new file mode 100644 index 00000000000000..0aca41f744dbc4 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1509-misc-rp1-pio-Handle-probe-errors.patch @@ -0,0 +1,38 @@ +From e56aa0bd2b552daa4349a7eb2e6b0dec81d3e5cc Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 9 Jan 2025 16:40:25 +0000 +Subject: [PATCH] misc: rp1-pio: Handle probe errors + +Ensure that rp1_pio_open fails if the device failed to probe. + +Link: https://github.com/raspberrypi/linux/issues/6593 + +Signed-off-by: Phil Elwell +--- + drivers/misc/rp1-pio.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +--- a/drivers/misc/rp1-pio.c ++++ b/drivers/misc/rp1-pio.c +@@ -1014,6 +1014,9 @@ struct rp1_pio_client *rp1_pio_open(void + { + struct rp1_pio_client *client; + ++ if (!g_pio) ++ return ERR_PTR(-ENOENT); ++ + client = kzalloc(sizeof(*client), GFP_KERNEL); + if (!client) + return ERR_PTR(-ENOMEM); +@@ -1265,9 +1268,8 @@ static int rp1_pio_probe(struct platform + return dev_err_probe(dev, pdev->id, "alias is missing\n"); + + fw = devm_rp1_firmware_get(dev, dev->of_node); +- if (IS_ERR(fw)) +- return PTR_ERR(fw); +- ++ if (IS_ERR_OR_NULL(fw)) ++ return dev_err_probe(dev, -ENOENT, "failed to contact RP1 firmware\n"); + ret = rp1_firmware_get_feature(fw, FOURCC_PIO, &op_base, &op_count); + if (ret < 0) + return ret; diff --git a/target/linux/bcm27xx/patches-6.6/950-1510-firmware-rp1-Simplify-rp1_firmware_get.patch b/target/linux/bcm27xx/patches-6.6/950-1510-firmware-rp1-Simplify-rp1_firmware_get.patch new file mode 100644 index 00000000000000..71a64da9591473 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1510-firmware-rp1-Simplify-rp1_firmware_get.patch @@ -0,0 +1,84 @@ +From dafde0ac8b6d4b21578a677c8afad8714af47aaf Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 9 Jan 2025 16:33:37 +0000 +Subject: [PATCH] firmware: rp1: Simplify rp1_firmware_get + +Simplify the implementation of rp1_firmware_get, requiring its clients +to have a valid 'firmware' property. Also make it return NULL on error. + +Link: https://github.com/raspberrypi/linux/issues/6593 + +Signed-off-by: Phil Elwell +--- + drivers/firmware/rp1.c | 36 +++++++++++++++--------------------- + 1 file changed, 15 insertions(+), 21 deletions(-) + +--- a/drivers/firmware/rp1.c ++++ b/drivers/firmware/rp1.c +@@ -159,42 +159,36 @@ struct rp1_firmware *rp1_firmware_get(st + struct device_node *fwnode; + struct rp1_firmware *fw; + +- if (client) { +- fwnode = of_parse_phandle(client, "firmware", 0); +- if (!fwnode) +- fwnode = of_get_parent(client); +- if (fwnode && !of_device_is_compatible(fwnode, match)) { +- of_node_put(fwnode); +- fwnode = NULL; +- } +- } +- +- if (!fwnode) +- fwnode = of_find_matching_node(NULL, rp1_firmware_of_match); +- ++ if (!client) ++ return NULL; ++ fwnode = of_parse_phandle(client, "firmware", 0); + if (!fwnode) +- return ERR_PTR(-ENOENT); ++ return NULL; ++ if (!of_device_is_compatible(fwnode, match)) { ++ of_node_put(fwnode); ++ return NULL; ++ } + + pdev = of_find_device_by_node(fwnode); + of_node_put(fwnode); + + if (!pdev) +- return ERR_PTR(-EPROBE_DEFER); ++ goto err_exit; + + fw = platform_get_drvdata(pdev); + if (!fw) +- goto err_defer; ++ goto err_exit; + + if (!kref_get_unless_zero(&fw->consumers)) +- goto err_defer; ++ goto err_exit; + + put_device(&pdev->dev); + + return fw; + +-err_defer: ++err_exit: + put_device(&pdev->dev); +- return ERR_PTR(-EPROBE_DEFER); ++ return NULL; + } + EXPORT_SYMBOL_GPL(rp1_firmware_get); + +@@ -210,8 +204,8 @@ struct rp1_firmware *devm_rp1_firmware_g + int ret; + + fw = rp1_firmware_get(client); +- if (IS_ERR(fw)) +- return fw; ++ if (!fw) ++ return NULL; + + ret = devm_add_action_or_reset(dev, devm_rp1_firmware_put, fw); + if (ret) diff --git a/target/linux/bcm27xx/patches-6.6/950-1512-dts-bcm2711-Don-t-mark-timer-regs-unconfigured.patch b/target/linux/bcm27xx/patches-6.6/950-1512-dts-bcm2711-Don-t-mark-timer-regs-unconfigured.patch new file mode 100644 index 00000000000000..81b37af340fdb9 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1512-dts-bcm2711-Don-t-mark-timer-regs-unconfigured.patch @@ -0,0 +1,44 @@ +From d06cb3534b6553a1f76bef2ddaf833e23dc12a4c Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 10 Jan 2025 15:45:11 +0000 +Subject: [PATCH] dts: bcm2711: Don't mark timer regs unconfigured + +The DT property arm,cpu-registers-not-fw-configured tells the kernel +that the ARM architectural timer has not been configured by the +firmware. This prevents the use of a vDSO - a faster alternative to a +syscall for some common kernel operations. + +However, on Pi 4 the firmware does configure the timer, so this property +is unnecessary. Delete it. + +Also remove it from the bcm2712.dtsi where it should never have been, +since it is only relevant to 32-bit ARM kernels. + +Signed-off-by: Phil Elwell +--- + arch/arm/boot/dts/broadcom/bcm2711.dtsi | 2 -- + arch/arm64/boot/dts/broadcom/bcm2712.dtsi | 2 -- + 2 files changed, 4 deletions(-) + +--- a/arch/arm/boot/dts/broadcom/bcm2711.dtsi ++++ b/arch/arm/boot/dts/broadcom/bcm2711.dtsi +@@ -451,8 +451,6 @@ + IRQ_TYPE_LEVEL_LOW)>, + ; +- /* This only applies to the ARMv7 stub */ +- arm,cpu-registers-not-fw-configured; + }; + + cpus: cpus { +--- a/arch/arm64/boot/dts/broadcom/bcm2712.dtsi ++++ b/arch/arm64/boot/dts/broadcom/bcm2712.dtsi +@@ -741,8 +741,6 @@ + IRQ_TYPE_LEVEL_LOW)>, + ; +- /* This only applies to the ARMv7 stub */ +- arm,cpu-registers-not-fw-configured; + }; + + cpus: cpus { diff --git a/target/linux/bcm27xx/patches-6.6/950-1513-mmc-bcm2835-sdhost-Observe-SWIOTLB-memory-limit.patch b/target/linux/bcm27xx/patches-6.6/950-1513-mmc-bcm2835-sdhost-Observe-SWIOTLB-memory-limit.patch new file mode 100644 index 00000000000000..08a58f2ed5ea12 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1513-mmc-bcm2835-sdhost-Observe-SWIOTLB-memory-limit.patch @@ -0,0 +1,29 @@ +From dfff38316c1284c30c68d02cc424bad0562cf253 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 10 Jan 2025 16:33:13 +0000 +Subject: [PATCH] mmc: bcm2835-sdhost Observe SWIOTLB memory limit + +Make sure the sdhost driver doesn't use requests bigger than SWIOTLB +can handle. + +Copied from [1]. + +Link: https://github.com/raspberrypi/linux/issues/6589 +Signed-off-by: Phil Elwell +[1] d4dd9bccf485 ("mmc: bcm2835: Take SWIOTLB memory size limitation +into account") +--- + drivers/mmc/host/bcm2835-sdhost.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/mmc/host/bcm2835-sdhost.c ++++ b/drivers/mmc/host/bcm2835-sdhost.c +@@ -1971,7 +1971,7 @@ int bcm2835_sdhost_add_host(struct platf + } + + mmc->max_segs = 128; +- mmc->max_req_size = 524288; ++ mmc->max_req_size = min_t(size_t, 524288, dma_max_mapping_size(&pdev->dev)); + mmc->max_seg_size = mmc->max_req_size; + mmc->max_blk_size = 512; + mmc->max_blk_count = 65535; diff --git a/target/linux/bcm27xx/patches-6.6/950-1514-drivers-media-pisp_be-Add-support-for-YUV422-planar-.patch b/target/linux/bcm27xx/patches-6.6/950-1514-drivers-media-pisp_be-Add-support-for-YUV422-planar-.patch new file mode 100644 index 00000000000000..554c9307c11135 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1514-drivers-media-pisp_be-Add-support-for-YUV422-planar-.patch @@ -0,0 +1,31 @@ +From a73ecafc5532e31b184220149cc2863f625700bf Mon Sep 17 00:00:00 2001 +From: Naushir Patuck +Date: Wed, 15 Jan 2025 09:46:25 +0000 +Subject: [PATCH] drivers: media: pisp_be: Add support for YUV422 planar format + +List V4L2_PIX_FMT_YUV422P as supported by the PiSP backend hardware. + +Signed-off-by: Naushir Patuck +--- + .../platform/raspberrypi/pisp_be/pisp_be_formats.h | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/drivers/media/platform/raspberrypi/pisp_be/pisp_be_formats.h ++++ b/drivers/media/platform/raspberrypi/pisp_be/pisp_be_formats.h +@@ -129,6 +129,16 @@ static const struct pisp_be_format suppo + .colorspace_mask = V4L2_COLORSPACE_MASK_ALL_SRGB, + .colorspace_default = V4L2_COLORSPACE_SMPTE170M, + }, ++ { ++ .fourcc = V4L2_PIX_FMT_YUV422P, ++ /* 128 alignment to ensure U/V planes are 64 byte aligned. */ ++ .align = 128, ++ .bit_depth = 8, ++ .plane_factor = { P3(1), P3(0.5), P3(0.5) }, ++ .num_planes = 1, ++ .colorspace_mask = V4L2_COLORSPACE_MASK_ALL_SRGB, ++ .colorspace_default = V4L2_COLORSPACE_SMPTE170M, ++ }, + /* Multiplane YUV formats */ + { + .fourcc = V4L2_PIX_FMT_YUV420M, diff --git a/target/linux/bcm27xx/patches-6.6/950-1515-drivers-media-pisp_be-Remove-unused-fields-in-struct.patch b/target/linux/bcm27xx/patches-6.6/950-1515-drivers-media-pisp_be-Remove-unused-fields-in-struct.patch new file mode 100644 index 00000000000000..51b8f7e7e739eb --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1515-drivers-media-pisp_be-Remove-unused-fields-in-struct.patch @@ -0,0 +1,82 @@ +From a452251cc286f2799969f047698c76fe3d7862b9 Mon Sep 17 00:00:00 2001 +From: Naushir Patuck +Date: Thu, 16 Jan 2025 10:13:57 +0000 +Subject: [PATCH] drivers: media: pisp_be: Remove unused fields in struct + pisp_be_config + +These fields should not be set by either the user or the kernel driver +so remove them. Replace them with padding bytes to maintain backward +compatibility with existing userland applications. + +Signed-off-by: Naushir Patuck +--- + .../linux/media/raspberrypi/pisp_be_config.h | 42 ++----------------- + 1 file changed, 4 insertions(+), 38 deletions(-) + +--- a/include/uapi/linux/media/raspberrypi/pisp_be_config.h ++++ b/include/uapi/linux/media/raspberrypi/pisp_be_config.h +@@ -716,13 +716,6 @@ struct pisp_be_hog_buffer_config { + /** + * struct pisp_be_config - RaspberryPi PiSP Back End Processing configuration + * +- * @input_buffer: Input buffer addresses +- * @tdn_input_buffer: TDN input buffer addresses +- * @stitch_input_buffer: Stitch input buffer addresses +- * @tdn_output_buffer: TDN output buffer addresses +- * @stitch_output_buffer: Stitch output buffer addresses +- * @output_buffer: Output buffers addresses +- * @hog_buffer: HOG buffer addresses + * @global: Global PiSP configuration + * @input_format: Input image format + * @decompress: Decompress configuration +@@ -761,28 +754,10 @@ struct pisp_be_hog_buffer_config { + * @output_format: Output format configuration + * @hog: HOG configuration + * @axi: AXI bus configuration +- * @lsc_extra: LSC extra info +- * @cac_extra: CAC extra info +- * @downscale_extra: Downscaler extra info +- * @resample_extra: Resample extra info +- * @crop: Crop configuration +- * @hog_format: HOG format info +- * @dirty_flags_bayer: Bayer enable dirty flags +- * (:c:type:`pisp_be_bayer_enable`) +- * @dirty_flags_rgb: RGB enable dirty flags +- * (:c:type:`pisp_be_rgb_enable`) +- * @dirty_flags_extra: Extra dirty flags + */ + struct pisp_be_config { +- /* I/O configuration: */ +- struct pisp_be_input_buffer_config input_buffer; +- struct pisp_be_tdn_input_buffer_config tdn_input_buffer; +- struct pisp_be_stitch_input_buffer_config stitch_input_buffer; +- struct pisp_be_tdn_output_buffer_config tdn_output_buffer; +- struct pisp_be_stitch_output_buffer_config stitch_output_buffer; +- struct pisp_be_output_buffer_config +- output_buffer[PISP_BACK_END_NUM_OUTPUTS]; +- struct pisp_be_hog_buffer_config hog_buffer; ++ /* For backward compatibility */ ++ uint8_t pad0[112]; + /* Processing configuration: */ + struct pisp_be_global_config global; + struct pisp_image_format_config input_format; +@@ -823,17 +798,8 @@ struct pisp_be_config { + output_format[PISP_BACK_END_NUM_OUTPUTS]; + struct pisp_be_hog_config hog; + struct pisp_be_axi_config axi; +- /* Non-register fields: */ +- struct pisp_be_lsc_extra lsc_extra; +- struct pisp_be_cac_extra cac_extra; +- struct pisp_be_downscale_extra +- downscale_extra[PISP_BACK_END_NUM_OUTPUTS]; +- struct pisp_be_resample_extra resample_extra[PISP_BACK_END_NUM_OUTPUTS]; +- struct pisp_be_crop_config crop; +- struct pisp_image_format_config hog_format; +- __u32 dirty_flags_bayer; /* these use pisp_be_bayer_enable */ +- __u32 dirty_flags_rgb; /* use pisp_be_rgb_enable */ +- __u32 dirty_flags_extra; /* these use pisp_be_dirty_t */ ++ /* For backward compatibility */ ++ uint8_t pad1[84]; + } __attribute__((packed)); + + /** diff --git a/target/linux/bcm27xx/patches-6.6/950-1516-media-imx219-Adjust-PLL-settings-based-on-the-number.patch b/target/linux/bcm27xx/patches-6.6/950-1516-media-imx219-Adjust-PLL-settings-based-on-the-number.patch new file mode 100644 index 00000000000000..227ada434c89a0 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1516-media-imx219-Adjust-PLL-settings-based-on-the-number.patch @@ -0,0 +1,163 @@ +From 5b958efc20d381ee103103df5df0c88dc02ada18 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Thu, 16 Jan 2025 11:08:25 +0000 +Subject: [PATCH] media: imx219: Adjust PLL settings based on the number of + MIPI lanes + +Commit ceddfd4493b3 ("media: i2c: imx219: Support four-lane operation") +added support for device tree to allow configuration of the sensor to +use 4 lanes with a link frequency of 363MHz, and amended the advertised +pixel rate to 280.8MPix/s. + +However it didn't change any of the PLL settings, so actually it would +have been running effectively overclocked in the MIPI block, and with +the frame rate and exposure calculations being wrong. + +The pixel rate and link frequency advertised were taken from the "Clock +Setting Example" section of the datasheet. However those are based on an +external clock of 12MHz, and are unachievable with a clock of 24MHz (it +seems PREPLLCLK_VT_DIV and PREPLLCK_OP_DIV can ONLY be set via the +automatic configuration doumented in "9-1-2 EXCK_FREQ setting depend on +INCK frequency). + +Dropping all support for the 363MHz link frequency would cause problems +for existing users, so allow it from device tree, but log a warning that +the requested value is not being truly applied. + +Fixes: ceddfd4493b3 ("media: i2c: imx219: Support four-lane operation") +Co-developed-by: Peyton Howe +Signed-off-by: Peyton Howe +Signed-off-by: Dave Stevenson +--- + drivers/media/i2c/imx219.c | 83 +++++++++++++++++++++++++++++--------- + 1 file changed, 64 insertions(+), 19 deletions(-) + +--- a/drivers/media/i2c/imx219.c ++++ b/drivers/media/i2c/imx219.c +@@ -148,10 +148,11 @@ + + /* Pixel rate is fixed for all the modes */ + #define IMX219_PIXEL_RATE 182400000 +-#define IMX219_PIXEL_RATE_4LANE 280800000 ++#define IMX219_PIXEL_RATE_4LANE 281600000 + + #define IMX219_DEFAULT_LINK_FREQ 456000000 +-#define IMX219_DEFAULT_LINK_FREQ_4LANE 363000000 ++#define IMX219_DEFAULT_LINK_FREQ_4LANE_UNSUPPORTED 363000000 ++#define IMX219_DEFAULT_LINK_FREQ_4LANE 364000000 + + /* IMX219 native and active pixel array size. */ + #define IMX219_NATIVE_WIDTH 3296U +@@ -224,15 +225,6 @@ static const struct cci_reg_sequence imx + { CCI_REG8(0x30eb), 0x05 }, + { CCI_REG8(0x30eb), 0x09 }, + +- /* PLL Clock Table */ +- { IMX219_REG_VTPXCK_DIV, 5 }, +- { IMX219_REG_VTSYCK_DIV, 1 }, +- { IMX219_REG_PREPLLCK_VT_DIV, 3 }, /* 0x03 = AUTO set */ +- { IMX219_REG_PREPLLCK_OP_DIV, 3 }, /* 0x03 = AUTO set */ +- { IMX219_REG_PLL_VT_MPY, 57 }, +- { IMX219_REG_OPSYCK_DIV, 1 }, +- { IMX219_REG_PLL_OP_MPY, 114 }, +- + /* Undocumented registers */ + { CCI_REG8(0x455e), 0x00 }, + { CCI_REG8(0x471e), 0x4b }, +@@ -316,6 +308,34 @@ static const struct cci_reg_sequence raw + { IMX219_REG_OPPXCK_DIV, 10 }, + }; + ++static const struct cci_reg_sequence imx219_2lane_regs[] = { ++ /* PLL Clock Table */ ++ { IMX219_REG_VTPXCK_DIV, 5 }, ++ { IMX219_REG_VTSYCK_DIV, 1 }, ++ { IMX219_REG_PREPLLCK_VT_DIV, 3 }, /* 0x03 = AUTO set */ ++ { IMX219_REG_PREPLLCK_OP_DIV, 3 }, /* 0x03 = AUTO set */ ++ { IMX219_REG_PLL_VT_MPY, 57 }, ++ { IMX219_REG_OPSYCK_DIV, 1 }, ++ { IMX219_REG_PLL_OP_MPY, 114 }, ++ ++ /* 2-Lane CSI Mode */ ++ { IMX219_REG_CSI_LANE_MODE, IMX219_CSI_2_LANE_MODE }, ++}; ++ ++static const struct cci_reg_sequence imx219_4lane_regs[] = { ++ /* PLL Clock Table */ ++ { IMX219_REG_VTPXCK_DIV, 5 }, ++ { IMX219_REG_VTSYCK_DIV, 1 }, ++ { IMX219_REG_PREPLLCK_VT_DIV, 3 }, /* 0x03 = AUTO set */ ++ { IMX219_REG_PREPLLCK_OP_DIV, 3 }, /* 0x03 = AUTO set */ ++ { IMX219_REG_PLL_VT_MPY, 88 }, ++ { IMX219_REG_OPSYCK_DIV, 1 }, ++ { IMX219_REG_PLL_OP_MPY, 91 }, ++ ++ /* 4-Lane CSI Mode */ ++ { IMX219_REG_CSI_LANE_MODE, IMX219_CSI_4_LANE_MODE }, ++}; ++ + static const s64 imx219_link_freq_menu[] = { + IMX219_DEFAULT_LINK_FREQ, + }; +@@ -941,9 +961,11 @@ static int imx219_get_selection(struct v + + static int imx219_configure_lanes(struct imx219 *imx219) + { +- return cci_write(imx219->regmap, IMX219_REG_CSI_LANE_MODE, +- imx219->lanes == 2 ? IMX219_CSI_2_LANE_MODE : +- IMX219_CSI_4_LANE_MODE, NULL); ++ /* Write the appropriate PLL settings for the number of MIPI lanes */ ++ return cci_multi_reg_write(imx219->regmap, ++ imx219->lanes == 2 ? imx219_2lane_regs : imx219_4lane_regs, ++ imx219->lanes == 2 ? ARRAY_SIZE(imx219_2lane_regs) : ++ ARRAY_SIZE(imx219_4lane_regs), NULL); + }; + + static int imx219_start_streaming(struct imx219 *imx219, +@@ -1334,6 +1356,7 @@ static int imx219_check_hwcfg(struct dev + .bus_type = V4L2_MBUS_CSI2_DPHY + }; + int ret = -EINVAL; ++ bool link_frequency_valid = false; + + endpoint = fwnode_graph_get_next_endpoint(dev_fwnode(dev), NULL); + if (!endpoint) { +@@ -1360,11 +1383,33 @@ static int imx219_check_hwcfg(struct dev + goto error_out; + } + +- if (ep_cfg.nr_of_link_frequencies != 1 || +- (ep_cfg.link_frequencies[0] != ((imx219->lanes == 2) ? +- IMX219_DEFAULT_LINK_FREQ : IMX219_DEFAULT_LINK_FREQ_4LANE))) { +- dev_err(dev, "Link frequency not supported: %lld\n", +- ep_cfg.link_frequencies[0]); ++ if (ep_cfg.nr_of_link_frequencies == 1) { ++ switch (imx219->lanes) { ++ case 2: ++ if (ep_cfg.link_frequencies[0] == ++ IMX219_DEFAULT_LINK_FREQ) ++ link_frequency_valid = true; ++ break; ++ case 4: ++ if (ep_cfg.link_frequencies[0] == ++ IMX219_DEFAULT_LINK_FREQ_4LANE) ++ link_frequency_valid = true; ++ else if (ep_cfg.link_frequencies[0] == ++ IMX219_DEFAULT_LINK_FREQ_4LANE_UNSUPPORTED) { ++ dev_warn(dev, "Link frequency of %d not supported, but has been incorrectly advertised previously\n", ++ IMX219_DEFAULT_LINK_FREQ_4LANE_UNSUPPORTED); ++ dev_warn(dev, "Using link frequency of %d\n", ++ IMX219_DEFAULT_LINK_FREQ_4LANE); ++ link_frequency_valid = true; ++ } ++ break; ++ } ++ } ++ ++ if (!link_frequency_valid) { ++ dev_err_probe(dev, -EINVAL, ++ "Link frequency not supported: %lld\n", ++ ep_cfg.link_frequencies[0]); + goto error_out; + } + diff --git a/target/linux/bcm27xx/patches-6.6/950-1517-IMX219-Add-4-lane-option-to-the-device-tree-overlay.patch b/target/linux/bcm27xx/patches-6.6/950-1517-IMX219-Add-4-lane-option-to-the-device-tree-overlay.patch new file mode 100644 index 00000000000000..2872f18425330b --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1517-IMX219-Add-4-lane-option-to-the-device-tree-overlay.patch @@ -0,0 +1,55 @@ +From e3297f3fbffdaec8076c00167261f504bb2c64b6 Mon Sep 17 00:00:00 2001 +From: Peyton Howe +Date: Sat, 4 Jan 2025 15:15:33 -0500 +Subject: [PATCH] IMX219: Add 4-lane option to the device tree overlay + +Signed-off-by: Peyton Howe +--- + arch/arm/boot/dts/overlays/README | 2 ++ + arch/arm/boot/dts/overlays/imx219-overlay.dts | 17 +++++++++++++++++ + 2 files changed, 19 insertions(+) + +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -2757,6 +2757,8 @@ Params: rotation Mounting + cam0 Adopt the default configuration for CAM0 on a + Compute Module (CSI0, i2c_vc, and cam0_reg). + vcm Configure a VCM focus drive on the sensor. ++ 4lane Enable 4 CSI2 lanes. This requires a Compute ++ Module (1, 3, 4, or 5) or Pi 5. + + + Name: imx258 +--- a/arch/arm/boot/dts/overlays/imx219-overlay.dts ++++ b/arch/arm/boot/dts/overlays/imx219-overlay.dts +@@ -65,6 +65,22 @@ + }; + }; + ++ fragment@201 { ++ target = <&csi_ep>; ++ __dormant__ { ++ data-lanes = <1 2 3 4>; ++ }; ++ }; ++ ++ fragment@202 { ++ target = <&cam_endpoint>; ++ __dormant__ { ++ data-lanes = <1 2 3 4>; ++ link-frequencies = ++ /bits/ 64 <363000000>; ++ }; ++ }; ++ + __overrides__ { + rotation = <&cam_node>,"rotation:0"; + orientation = <&cam_node>,"orientation:0"; +@@ -77,6 +93,7 @@ + <&vcm>, "VANA-supply:0=", <&cam0_reg>; + vcm = <&vcm>, "status=okay", + <&cam_node>,"lens-focus:0=", <&vcm>; ++ 4lane = <0>, "+201+202"; + }; + }; + diff --git a/target/linux/bcm27xx/patches-6.6/950-1518-dtoverlays-waveshare-panel-Disable-new-touch-control.patch b/target/linux/bcm27xx/patches-6.6/950-1518-dtoverlays-waveshare-panel-Disable-new-touch-control.patch new file mode 100644 index 00000000000000..61534982dd13f3 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1518-dtoverlays-waveshare-panel-Disable-new-touch-control.patch @@ -0,0 +1,40 @@ +From 11381ac246576bc84dfc28f6cdd8030305c605aa Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Mon, 20 Jan 2025 11:53:04 +0000 +Subject: [PATCH] dtoverlays: waveshare-panel: Disable new touch controller by + default + +Commit e442e5c1ab6b ("arch:arm:boot:dts:overlays: Added waveshare 13.3inch +panel support") added an extra touch controller for the new panels. +On systems with old panels, it ends up spamming the kernel log as that +touch controller isn't there to respond. + +Fixes: e442e5c1ab6b ("arch:arm:boot:dts:overlays: Added waveshare 13.3inch panel support") +Signed-off-by: Dave Stevenson +--- + .../dts/overlays/vc4-kms-dsi-waveshare-panel-overlay.dts | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +--- a/arch/arm/boot/dts/overlays/vc4-kms-dsi-waveshare-panel-overlay.dts ++++ b/arch/arm/boot/dts/overlays/vc4-kms-dsi-waveshare-panel-overlay.dts +@@ -55,6 +55,7 @@ + touch2: ilitek@41 { + compatible = "ilitek,ili251x"; + reg = <0x41>; ++ status = "disabled"; + }; + }; + }; +@@ -125,8 +126,10 @@ + <&touch>, "touchscreen-inverted-x?", + <&touch>, "touchscreen-inverted-y?"; + 8_8_inch = <&panel>, "compatible=waveshare,8.8inch-panel"; +- 13_3_inch_4lane = <&panel>, "compatible=waveshare,13.3inch-4lane-panel"; +- 13_3_inch_2lane = <&panel>, "compatible=waveshare,13.3inch-2lane-panel"; ++ 13_3_inch_4lane = <&panel>, "compatible=waveshare,13.3inch-4lane-panel", ++ <&touch2>, "status=okay"; ++ 13_3_inch_2lane = <&panel>, "compatible=waveshare,13.3inch-2lane-panel", ++ <&touch2>, "status=okay"; + i2c1 = <&i2c_frag>, "target:0=",<&i2c1>, + <0>, "-3-4+5"; + disable_touch = <&touch>, "status=disabled"; diff --git a/target/linux/bcm27xx/patches-6.6/950-1519-drm-rp1-rp1-dpi-Add-rgb_order-property-to-match-VC4-.patch b/target/linux/bcm27xx/patches-6.6/950-1519-drm-rp1-rp1-dpi-Add-rgb_order-property-to-match-VC4-.patch new file mode 100644 index 00000000000000..4892c271ffc933 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1519-drm-rp1-rp1-dpi-Add-rgb_order-property-to-match-VC4-.patch @@ -0,0 +1,325 @@ +From ba9883e3b667e4f1fbeacc4346f6e9179a3a5479 Mon Sep 17 00:00:00 2001 +From: Nick Hollinghurst +Date: Mon, 20 Jan 2025 11:20:48 +0000 +Subject: [PATCH] drm: rp1: rp1-dpi: Add "rgb_order" property (to match VC4 + DPI) + +As on VC4, the OF property overrides the order implied by media +bus format. Only 4 of the 6 possible orders are supported. New +add-on hardware designs should not rely on this "legacy" feature. + +Signed-off-by: Nick Hollinghurst +--- + drivers/gpu/drm/rp1/rp1-dpi/rp1_dpi.c | 15 ++ + drivers/gpu/drm/rp1/rp1-dpi/rp1_dpi.h | 8 + + drivers/gpu/drm/rp1/rp1-dpi/rp1_dpi_hw.c | 191 ++++++++++++++--------- + 3 files changed, 143 insertions(+), 71 deletions(-) + +--- a/drivers/gpu/drm/rp1/rp1-dpi/rp1_dpi.c ++++ b/drivers/gpu/drm/rp1/rp1-dpi/rp1_dpi.c +@@ -292,6 +292,7 @@ static int rp1dpi_platform_probe(struct + struct device *dev = &pdev->dev; + struct rp1_dpi *dpi; + struct drm_bridge *bridge = NULL; ++ const char *rgb_order = NULL; + struct drm_panel *panel; + int i, j, ret; + +@@ -353,6 +354,20 @@ static int rp1dpi_platform_probe(struct + if (ret) + goto done_err; + ++ dpi->rgb_order_override = RP1DPI_ORDER_UNCHANGED; ++ if (!of_property_read_string(dev->of_node, "rgb_order", &rgb_order)) { ++ if (!strcmp(rgb_order, "rgb")) ++ dpi->rgb_order_override = RP1DPI_ORDER_RGB; ++ else if (!strcmp(rgb_order, "bgr")) ++ dpi->rgb_order_override = RP1DPI_ORDER_BGR; ++ else if (!strcmp(rgb_order, "grb")) ++ dpi->rgb_order_override = RP1DPI_ORDER_GRB; ++ else if (!strcmp(rgb_order, "brg")) ++ dpi->rgb_order_override = RP1DPI_ORDER_BRG; ++ else ++ DRM_ERROR("Invalid dpi order %s - ignored\n", rgb_order); ++ } ++ + /* Check if PIO can snoop on or override DPI's GPIO1 */ + dpi->gpio1_used = false; + for (i = 0; !dpi->gpio1_used; i++) { +--- a/drivers/gpu/drm/rp1/rp1-dpi/rp1_dpi.h ++++ b/drivers/gpu/drm/rp1/rp1-dpi/rp1_dpi.h +@@ -25,6 +25,13 @@ + #define RP1DPI_CLK_PLLCORE 2 + #define RP1DPI_NUM_CLOCKS 3 + ++/* Codes (in LE byte order) used for S/W permutation */ ++#define RP1DPI_ORDER_UNCHANGED 0 ++#define RP1DPI_ORDER_RGB 0x020100 ++#define RP1DPI_ORDER_BGR 0x000102 ++#define RP1DPI_ORDER_GRB 0x020001 ++#define RP1DPI_ORDER_BRG 0x010002 ++ + /* ---------------------------------------------------------------------- */ + + struct rp1_dpi { +@@ -45,6 +52,7 @@ struct rp1_dpi { + u32 bus_fmt; + bool de_inv, clk_inv; + bool dpi_running, pipe_enabled; ++ unsigned int rgb_order_override; + struct completion finished; + + /* Experimental stuff for interlace follows */ +--- a/drivers/gpu/drm/rp1/rp1-dpi/rp1_dpi_hw.c ++++ b/drivers/gpu/drm/rp1/rp1-dpi/rp1_dpi_hw.c +@@ -223,12 +223,90 @@ int rp1dpi_hw_busy(struct rp1_dpi *dpi) + return (rp1dpi_hw_read(dpi, DPI_DMA_STATUS) & 0xF8F) ? 1 : 0; + } + +-/* Table of supported input (in-memory/DMA) pixel formats. */ ++/* ++ * Table of supported input (in-memory/DMA) pixel formats. ++ * ++ * RP1 DPI describes RGB components in terms of their MS bit position, a 10-bit ++ * left-aligned bit-mask, and an optional right-shift-and-OR used for scaling. ++ * To make it easier to permute R, G and B components, we re-pack these fields ++ * into 32-bit code-words, which don't themselves correspond to any register. ++ */ ++ ++#define RGB_CODE(scale, shift, mask) (((scale) << 24) | ((shift) << 16) | (mask)) ++#define RGB_SCALE(c) ((c) >> 24) ++#define RGB_SHIFT(c) (((c) >> 16) & 31) ++#define RGB_MASK(c) ((c) & 0x3ff) ++ + struct rp1dpi_ipixfmt { +- u32 format; /* DRM format code */ +- u32 mask; /* RGB masks (10 bits each, left justified) */ +- u32 shift; /* RGB MSB positions in the memory word */ +- u32 rgbsz; /* Shifts used for scaling; also (BPP/8-1) */ ++ u32 format; /* DRM format code */ ++ u32 rgb_code[3]; /* (width&7), MS bit position, 10-bit mask */ ++ u32 bpp; /* Bytes per pixel minus one */ ++}; ++ ++static const struct rp1dpi_ipixfmt my_formats[] = { ++ { ++ .format = DRM_FORMAT_XRGB8888, ++ .rgb_code = { ++ RGB_CODE(0, 23, 0x3fc), ++ RGB_CODE(0, 15, 0x3fc), ++ RGB_CODE(0, 7, 0x3fc), ++ }, ++ .bpp = 3, ++ }, ++ { ++ .format = DRM_FORMAT_XBGR8888, ++ .rgb_code = { ++ RGB_CODE(0, 7, 0x3fc), ++ RGB_CODE(0, 15, 0x3fc), ++ RGB_CODE(0, 23, 0x3fc), ++ }, ++ .bpp = 3, ++ }, ++ { ++ .format = DRM_FORMAT_ARGB8888, ++ .rgb_code = { ++ RGB_CODE(0, 23, 0x3fc), ++ RGB_CODE(0, 15, 0x3fc), ++ RGB_CODE(0, 7, 0x3fc), ++ }, ++ .bpp = 3, ++ }, ++ { ++ .format = DRM_FORMAT_ABGR8888, ++ .rgb_code = { ++ RGB_CODE(0, 7, 0x3fc), ++ RGB_CODE(0, 15, 0x3fc), ++ RGB_CODE(0, 23, 0x3fc), ++ }, ++ .bpp = 3, ++ }, ++ { ++ .format = DRM_FORMAT_RGB888, ++ .rgb_code = { ++ RGB_CODE(0, 23, 0x3fc), ++ RGB_CODE(0, 15, 0x3fc), ++ RGB_CODE(0, 7, 0x3fc), ++ }, ++ .bpp = 2, ++ }, ++ { ++ .format = DRM_FORMAT_BGR888, ++ .rgb_code = { ++ RGB_CODE(0, 7, 0x3fc), ++ RGB_CODE(0, 15, 0x3fc), ++ RGB_CODE(0, 23, 0x3fc), ++ }, ++ .bpp = 2, ++ }, ++ { ++ .format = DRM_FORMAT_RGB565, ++ .rgb_code = { ++ RGB_CODE(5, 15, 0x3e0), ++ RGB_CODE(6, 10, 0x3f0), ++ RGB_CODE(5, 4, 0x3e0), ++ }, ++ .bpp = 1, ++ }, + }; + + #define IMASK_RGB(r, g, b) (FIELD_PREP_CONST(DPI_DMA_IMASK_R_MASK, r) | \ +@@ -244,63 +322,13 @@ struct rp1dpi_ipixfmt { + FIELD_PREP_CONST(DPI_DMA_SHIFT_OG_MASK, g) | \ + FIELD_PREP_CONST(DPI_DMA_SHIFT_OB_MASK, b)) + +-static const struct rp1dpi_ipixfmt my_formats[] = { +- { +- .format = DRM_FORMAT_XRGB8888, +- .mask = IMASK_RGB(0x3fc, 0x3fc, 0x3fc), +- .shift = ISHIFT_RGB(23, 15, 7), +- .rgbsz = FIELD_PREP_CONST(DPI_DMA_RGBSZ_BPP_MASK, 3), +- }, +- { +- .format = DRM_FORMAT_XBGR8888, +- .mask = IMASK_RGB(0x3fc, 0x3fc, 0x3fc), +- .shift = ISHIFT_RGB(7, 15, 23), +- .rgbsz = FIELD_PREP_CONST(DPI_DMA_RGBSZ_BPP_MASK, 3), +- }, +- { +- .format = DRM_FORMAT_ARGB8888, +- .mask = IMASK_RGB(0x3fc, 0x3fc, 0x3fc), +- .shift = ISHIFT_RGB(23, 15, 7), +- .rgbsz = FIELD_PREP_CONST(DPI_DMA_RGBSZ_BPP_MASK, 3), +- }, +- { +- .format = DRM_FORMAT_ABGR8888, +- .mask = IMASK_RGB(0x3fc, 0x3fc, 0x3fc), +- .shift = ISHIFT_RGB(7, 15, 23), +- .rgbsz = FIELD_PREP_CONST(DPI_DMA_RGBSZ_BPP_MASK, 3), +- }, +- { +- .format = DRM_FORMAT_RGB888, +- .mask = IMASK_RGB(0x3fc, 0x3fc, 0x3fc), +- .shift = ISHIFT_RGB(23, 15, 7), +- .rgbsz = FIELD_PREP_CONST(DPI_DMA_RGBSZ_BPP_MASK, 2), +- }, +- { +- .format = DRM_FORMAT_BGR888, +- .mask = IMASK_RGB(0x3fc, 0x3fc, 0x3fc), +- .shift = ISHIFT_RGB(7, 15, 23), +- .rgbsz = FIELD_PREP_CONST(DPI_DMA_RGBSZ_BPP_MASK, 2), +- }, +- { +- .format = DRM_FORMAT_RGB565, +- .mask = IMASK_RGB(0x3e0, 0x3f0, 0x3e0), +- .shift = ISHIFT_RGB(15, 10, 4), +- .rgbsz = (FIELD_PREP_CONST(DPI_DMA_RGBSZ_R_MASK, 5) | +- FIELD_PREP_CONST(DPI_DMA_RGBSZ_G_MASK, 6) | +- FIELD_PREP_CONST(DPI_DMA_RGBSZ_B_MASK, 5) | +- FIELD_PREP_CONST(DPI_DMA_RGBSZ_BPP_MASK, 1)), +- }, +- { +- .format = DRM_FORMAT_BGR565, +- .mask = IMASK_RGB(0x3e0, 0x3f0, 0x3e0), +- .shift = ISHIFT_RGB(4, 10, 15), +- .rgbsz = (FIELD_PREP_CONST(DPI_DMA_RGBSZ_R_MASK, 5) | +- FIELD_PREP_CONST(DPI_DMA_RGBSZ_G_MASK, 6) | +- FIELD_PREP_CONST(DPI_DMA_RGBSZ_B_MASK, 5) | +- FIELD_PREP_CONST(DPI_DMA_RGBSZ_BPP_MASK, 1)), +- } +-}; +- ++/* ++ * Function to update *shift with output positions, and return output RGB masks. ++ * By the time we get here, RGB order has been normalized to RGB (R most significant). ++ * Note that an internal bus is 30 bits wide: bits [21:20], [11:10], [1:0] are dropped. ++ * This makes the packed RGB5656 and RGB666 formats problematic, as colour components ++ * need to straddle the gaps; we mitigate this by hijacking input masks and scaling. ++ */ + static u32 set_output_format(u32 bus_format, u32 *shift, u32 *imask, u32 *rgbsz) + { + switch (bus_format) { +@@ -308,6 +336,7 @@ static u32 set_output_format(u32 bus_for + if (*shift == ISHIFT_RGB(15, 10, 4)) { + /* When framebuffer is RGB565, we can output RGB565 */ + *shift = ISHIFT_RGB(15, 7, 0) | OSHIFT_RGB(19, 9, 0); ++ *imask = IMASK_RGB(0x3fc, 0x3fc, 0); + *rgbsz &= DPI_DMA_RGBSZ_BPP_MASK; + return OMASK_RGB(0x3fc, 0x3fc, 0); + } +@@ -322,7 +351,7 @@ static u32 set_output_format(u32 bus_for + case MEDIA_BUS_FMT_BGR666_1X18: + /* due to a HW limitation, bit-depth is effectively RGB444 */ + *shift |= OSHIFT_RGB(23, 15, 7); +- *imask &= IMASK_RGB(0x3c0, 0x3c0, 0x3c0); ++ *imask = IMASK_RGB(0x3c0, 0x3c0, 0x3c0); + *rgbsz = BITS(DPI_DMA_RGBSZ_R, 2) | (*rgbsz & DPI_DMA_RGBSZ_BPP_MASK); + return OMASK_RGB(0x330, 0x3c0, 0x3c0); + +@@ -359,7 +388,8 @@ void rp1dpi_hw_setup(struct rp1_dpi *dpi + struct drm_display_mode const *mode) + { + u32 shift, imask, omask, rgbsz, vctrl; +- int i; ++ u32 rgb_code[3]; ++ int order, i; + + drm_info(&dpi->drm, + "in_fmt=\'%c%c%c%c\' bus_fmt=0x%x mode=%dx%d total=%dx%d%s %dkHz %cH%cV%cD%cC", +@@ -373,26 +403,45 @@ void rp1dpi_hw_setup(struct rp1_dpi *dpi + de_inv ? '-' : '+', + dpi->clk_inv ? '-' : '+'); + +- /* +- * Configure all DPI/DMA block registers, except base address. +- * DMA will not actually start until a FB base address is specified +- * using rp1dpi_hw_update(). +- */ ++ /* Look up the input (in-memory) pixel format */ + for (i = 0; i < ARRAY_SIZE(my_formats); ++i) { + if (my_formats[i].format == in_format) + break; + } + if (i >= ARRAY_SIZE(my_formats)) { + pr_err("%s: bad input format\n", __func__); +- i = 4; ++ i = ARRAY_SIZE(my_formats) - 1; + } +- if (BUS_FMT_IS_BGR(bus_format)) +- i ^= 1; +- shift = my_formats[i].shift; +- imask = my_formats[i].mask; +- rgbsz = my_formats[i].rgbsz; ++ ++ /* ++ * Although these RGB orderings refer to the output (DPI bus) format, ++ * here we permute the *input* components. After this point, "Red" ++ * will be most significant (highest numbered GPIOs), regardless ++ * of rgb_order or bus_format. This simplifies later workarounds. ++ */ ++ order = dpi->rgb_order_override; ++ if (order == RP1DPI_ORDER_UNCHANGED) ++ order = BUS_FMT_IS_BGR(bus_format) ? RP1DPI_ORDER_BGR : RP1DPI_ORDER_RGB; ++ rgb_code[0] = my_formats[i].rgb_code[order & 3]; ++ rgb_code[1] = my_formats[i].rgb_code[(order >> 8) & 3]; ++ rgb_code[2] = my_formats[i].rgb_code[(order >> 16) & 3]; ++ rgbsz = FIELD_PREP(DPI_DMA_RGBSZ_BPP_MASK, my_formats[i].bpp) | ++ FIELD_PREP(DPI_DMA_RGBSZ_R_MASK, RGB_SCALE(rgb_code[0])) | ++ FIELD_PREP(DPI_DMA_RGBSZ_G_MASK, RGB_SCALE(rgb_code[1])) | ++ FIELD_PREP(DPI_DMA_RGBSZ_B_MASK, RGB_SCALE(rgb_code[2])); ++ shift = FIELD_PREP(DPI_DMA_SHIFT_IR_MASK, RGB_SHIFT(rgb_code[0])) | ++ FIELD_PREP(DPI_DMA_SHIFT_IG_MASK, RGB_SHIFT(rgb_code[1])) | ++ FIELD_PREP(DPI_DMA_SHIFT_IB_MASK, RGB_SHIFT(rgb_code[2])); ++ imask = FIELD_PREP(DPI_DMA_IMASK_R_MASK, RGB_MASK(rgb_code[0])) | ++ FIELD_PREP(DPI_DMA_IMASK_G_MASK, RGB_MASK(rgb_code[1])) | ++ FIELD_PREP(DPI_DMA_IMASK_B_MASK, RGB_MASK(rgb_code[2])); + omask = set_output_format(bus_format, &shift, &imask, &rgbsz); + ++ /* ++ * Configure all DPI/DMA block registers, except base address. ++ * DMA will not actually start until a FB base address is specified ++ * using rp1dpi_hw_update(). ++ */ + rp1dpi_hw_write(dpi, DPI_DMA_IMASK, imask); + rp1dpi_hw_write(dpi, DPI_DMA_OMASK, omask); + rp1dpi_hw_write(dpi, DPI_DMA_SHIFT, shift); diff --git a/target/linux/bcm27xx/patches-6.6/950-1522-add-ina238-to-i2c-sensors.patch b/target/linux/bcm27xx/patches-6.6/950-1522-add-ina238-to-i2c-sensors.patch new file mode 100644 index 00000000000000..cc0f31d08babb6 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1522-add-ina238-to-i2c-sensors.patch @@ -0,0 +1,102 @@ +From 94de19285cc9bd781394bf1aa4fb8d401aac5195 Mon Sep 17 00:00:00 2001 +From: James Sarrett +Date: Sun, 26 Jan 2025 11:29:31 -0800 +Subject: [PATCH] add ina238 to i2c-sensors + +This patch adds the ina238 device tree parameters to the i2c-sensors +overlay. The ina238 driver needs 2 configuration parameters, shut_resistor +and ti,shunt-gain in addition to it's address, so they are added as well. +--- + arch/arm/boot/dts/overlays/README | 13 ++++++++++ + .../boot/dts/overlays/i2c-sensor-common.dtsi | 26 ++++++++++++++++++- + 2 files changed, 38 insertions(+), 1 deletion(-) + +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -2486,11 +2486,20 @@ Params: addr Set the + ds1621 Select the Dallas Semiconductors DS1621 temp + sensor. Valid addresses 0x48-0x4f, default 0x48 + ++ gain Gain used for measuring shunt resistor current. ++ Valid values 1 or 4, default 1. (ina238 only, ++ disabled by default) ++ + hdc100x Select the Texas Instruments HDC100x temp sensor + Valid addresses 0x40-0x43, default 0x40 + + htu21 Select the HTU21 temperature and humidity sensor + ++ ina238 Select the TI INA238 power monitor. Valid ++ addresses 0x40-0x4F, default 0x40. ++ Uses parameters shunt-resistor and ++ ti,shunt-gain for configuration ++ + int_pin Set the GPIO to use for interrupts (max30102, + mpu6050 and mpu9250 only) + +@@ -2549,6 +2558,10 @@ Params: addr Set the + reset_pin GPIO to be used to reset the device (bno055 + only, disabled by default) + ++ shunt_resistor Value of shunt resistor used for current ++ measurement in uOhms. (ina238 only, disabled ++ by default) ++ + sht3x Select the Sensirion SHT3x temperature and + humidity sensors. Valid addresses 0x44-0x45, + default 0x44 +--- a/arch/arm/boot/dts/overlays/i2c-sensor-common.dtsi ++++ b/arch/arm/boot/dts/overlays/i2c-sensor-common.dtsi +@@ -526,6 +526,27 @@ + }; + }; + ++ fragment@35 { ++ target = <&i2cbus>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ ina238: ina238@48 { ++ compatible = "ti,ina238"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <0x40>; ++ /* uOhms, uint32_t */ ++ shunt-resistor = <1000>; ++ /* 1 or 4, (±40.96 mV or ±163.84 mV) */ ++ ti,shunt-gain = <1>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ + fragment@99 { + target = <&gpio>; + __dormant__ { +@@ -573,6 +594,7 @@ + bno055 = <0>,"+31"; + sht4x = <0>,"+32"; + adt7410 = <0>,"+34"; ++ ina238 = <0>,"+35"; + + addr = <&bme280>,"reg:0", <&bmp280>,"reg:0", <&tmp102>,"reg:0", + <&lm75>,"reg:0", <&hdc100x>,"reg:0", <&sht3x>,"reg:0", +@@ -582,7 +604,7 @@ + <&ms5837>,"reg:0", <&ms8607>,"reg:0", + <&mpu6050>,"reg:0", <&mpu9250>,"reg:0", + <&bno055>,"reg:0", <&sht4x>,"reg:0", +- <&bmp380>,"reg:0", <&adt7410>,"reg:0"; ++ <&bmp380>,"reg:0", <&adt7410>,"reg:0", <&ina238>,"reg:0"; + int_pin = <&int_pins>, "brcm,pins:0", + <&int_pins>, "reg:0", + <&max30102>, "interrupts:0", +@@ -590,5 +612,7 @@ + <&mpu9250>, "interrupts:0"; + no_timeout = <&jc42>, "smbus-timeout-disable?"; + reset_pin = <&bno055>,"reset-gpios:4", <0>,"+30"; ++ shunt_resistor = <&ina238>,"shunt-resistor:0"; ++ gain = <&ina238>,"ti,shunt-gain:0"; + }; + }; diff --git a/target/linux/bcm27xx/patches-6.6/950-1524-add-shtc3-to-i2c-sensors.patch b/target/linux/bcm27xx/patches-6.6/950-1524-add-shtc3-to-i2c-sensors.patch new file mode 100644 index 00000000000000..575d52241eeff6 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1524-add-shtc3-to-i2c-sensors.patch @@ -0,0 +1,57 @@ +From aabe16b3cdc6172618803ed7a6002d1099d306e5 Mon Sep 17 00:00:00 2001 +From: James Sarrett +Date: Sun, 26 Jan 2025 22:07:02 -0800 +Subject: [PATCH] add shtc3 to i2c-sensors + +This patch adds the shtc3 device tree parameters to the i2c-sensors +overlay. The shtc3 driver needs no other configuration parameters, as the +i2c address is permanently baked in to the silicon. +--- + arch/arm/boot/dts/overlays/README | 3 +++ + .../arm/boot/dts/overlays/i2c-sensor-common.dtsi | 16 ++++++++++++++++ + 2 files changed, 19 insertions(+) + +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -2570,6 +2570,9 @@ Params: addr Set the + humidity sensors. Valid addresses 0x44-0x45, + default 0x44 + ++ shtc3 Select the Sensirion SHTC3 temperature and ++ humidity sensors. ++ + si7020 Select the Silicon Labs Si7013/20/21 humidity/ + temperature sensor + +--- a/arch/arm/boot/dts/overlays/i2c-sensor-common.dtsi ++++ b/arch/arm/boot/dts/overlays/i2c-sensor-common.dtsi +@@ -547,6 +547,21 @@ + }; + }; + ++ fragment@36 { ++ target = <&i2cbus>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ shtc3: shtc3@70 { ++ compatible = "sensirion,shtc3"; ++ reg = <0x70>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ + fragment@99 { + target = <&gpio>; + __dormant__ { +@@ -595,6 +610,7 @@ + sht4x = <0>,"+32"; + adt7410 = <0>,"+34"; + ina238 = <0>,"+35"; ++ shtc3 = <0>,"+36"; + + addr = <&bme280>,"reg:0", <&bmp280>,"reg:0", <&tmp102>,"reg:0", + <&lm75>,"reg:0", <&hdc100x>,"reg:0", <&sht3x>,"reg:0", diff --git a/target/linux/bcm27xx/patches-6.6/950-1525-drivers-media-pci-Update-Hailo-accelerator-device-dr.patch b/target/linux/bcm27xx/patches-6.6/950-1525-drivers-media-pci-Update-Hailo-accelerator-device-dr.patch new file mode 100644 index 00000000000000..72d73089e3cf68 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1525-drivers-media-pci-Update-Hailo-accelerator-device-dr.patch @@ -0,0 +1,2137 @@ +From a18d9ced4965462cb7b3b4252ada440395105308 Mon Sep 17 00:00:00 2001 +From: Naushir Patuck +Date: Thu, 23 Jan 2025 14:14:47 +0000 +Subject: [PATCH] drivers: media: pci: Update Hailo accelerator device driver + to v4.20 + +Sourced from https://github.com/hailo-ai/hailort-drivers + +Signed-off-by: Naushir Patuck +--- + .../media/pci/hailo/common/fw_validation.c | 4 +- + .../media/pci/hailo/common/fw_validation.h | 14 +- + .../pci/hailo/common/hailo_ioctl_common.h | 10 +- + drivers/media/pci/hailo/common/pcie_common.c | 175 +++-- + drivers/media/pci/hailo/common/pcie_common.h | 69 +- + drivers/media/pci/hailo/common/vdma_common.c | 70 +- + drivers/media/pci/hailo/common/vdma_common.h | 27 +- + drivers/media/pci/hailo/src/fops.c | 90 ++- + drivers/media/pci/hailo/src/nnc.c | 4 +- + drivers/media/pci/hailo/src/pcie.c | 630 ++++++++++++++++-- + drivers/media/pci/hailo/src/pcie.h | 39 +- + drivers/media/pci/hailo/src/soc.c | 18 +- + drivers/media/pci/hailo/utils/compact.h | 8 + + drivers/media/pci/hailo/vdma/memory.c | 86 ++- + drivers/media/pci/hailo/vdma/memory.h | 2 + + 15 files changed, 997 insertions(+), 249 deletions(-) + +--- a/drivers/media/pci/hailo/common/fw_validation.c ++++ b/drivers/media/pci/hailo/common/fw_validation.c +@@ -41,8 +41,8 @@ int FW_VALIDATION__validate_fw_header(ui + case HAILO_BOARD_TYPE_HAILO10H: + expected_firmware_magic = FIRMWARE_HEADER_MAGIC_HAILO15; + break; +- case HAILO_BOARD_TYPE_PLUTO: +- expected_firmware_magic = FIRMWARE_HEADER_MAGIC_PLUTO; ++ case HAILO_BOARD_TYPE_HAILO15L: ++ expected_firmware_magic = FIRMWARE_HEADER_MAGIC_HAILO15L; + break; + default: + err = -EINVAL; +--- a/drivers/media/pci/hailo/common/fw_validation.h ++++ b/drivers/media/pci/hailo/common/fw_validation.h +@@ -9,15 +9,9 @@ + #include "hailo_ioctl_common.h" + #include + +-#define FIRMWARE_HEADER_MAGIC_HAILO8 (0x1DD89DE0) +-#define FIRMWARE_HEADER_MAGIC_HAILO15 (0xE905DAAB) +-#define FIRMWARE_HEADER_MAGIC_PLUTO (0xF94739AB) +- +-#ifndef HAILO_EMULATOR +-#define FIRMWARE_WAIT_TIMEOUT_MS (5000) +-#else /* ifndef HAILO_EMULATOR */ +-#define FIRMWARE_WAIT_TIMEOUT_MS (500000) +-#endif /* ifndef HAILO_EMULATOR */ ++#define FIRMWARE_HEADER_MAGIC_HAILO8 (0x1DD89DE0) ++#define FIRMWARE_HEADER_MAGIC_HAILO15 (0xE905DAAB) ++#define FIRMWARE_HEADER_MAGIC_HAILO15L (0xF94739AB) + + typedef enum { + FIRMWARE_HEADER_VERSION_INITIAL = 0, +@@ -61,4 +55,4 @@ int FW_VALIDATION__validate_fw_header(ui + int FW_VALIDATION__validate_cert_header(uintptr_t firmware_base_address, + size_t firmware_size, u32 *outer_consumed_firmware_offset, secure_boot_certificate_header_t **out_firmware_cert); + +-#endif +\ No newline at end of file ++#endif +--- a/drivers/media/pci/hailo/common/hailo_ioctl_common.h ++++ b/drivers/media/pci/hailo/common/hailo_ioctl_common.h +@@ -7,7 +7,7 @@ + #define _HAILO_IOCTL_COMMON_H_ + + #define HAILO_DRV_VER_MAJOR 4 +-#define HAILO_DRV_VER_MINOR 19 ++#define HAILO_DRV_VER_MINOR 20 + #define HAILO_DRV_VER_REVISION 0 + + #define _STRINGIFY_EXPANDED( x ) #x +@@ -22,6 +22,7 @@ + #define MAX_VDMA_ENGINES (3) + #define SIZE_OF_VDMA_DESCRIPTOR (16) + #define VDMA_DEST_CHANNELS_START (16) ++#define MAX_SG_DESCS_COUNT (64 * 1024u) + + #define HAILO_VDMA_MAX_ONGOING_TRANSFERS (128) + #define HAILO_VDMA_MAX_ONGOING_TRANSFERS_MASK (HAILO_VDMA_MAX_ONGOING_TRANSFERS - 1) +@@ -38,6 +39,10 @@ + #define FW_ACCESS_APP_CPU_CONTROL_MASK (1 << FW_ACCESS_CONTROL_INTERRUPT_SHIFT) + #define FW_ACCESS_DRIVER_SHUTDOWN_SHIFT (2) + #define FW_ACCESS_DRIVER_SHUTDOWN_MASK (1 << FW_ACCESS_DRIVER_SHUTDOWN_SHIFT) ++// HRT-15790 TODO: separate nnc interrupts and soc interrupts ++#define FW_ACCESS_SOFT_RESET_SHIFT (3) ++#define FW_ACCESS_SOFT_RESET_MASK (1 << FW_ACCESS_SOFT_RESET_SHIFT) ++ + #define FW_ACCESS_SOC_CONTROL_SHIFT (3) + #define FW_ACCESS_SOC_CONTROL_MASK (1 << FW_ACCESS_SOC_CONTROL_SHIFT) + +@@ -184,7 +189,6 @@ enum hailo_dma_data_direction { + }; + + // Enum that states what type of buffer we are working with in the driver +-// TODO: HRT-13580 - Add specific type for user allocated and for driver allocated + enum hailo_dma_buffer_type { + HAILO_DMA_USER_PTR_BUFFER = 0, + HAILO_DMA_DMABUF_BUFFER = 1, +@@ -399,7 +403,7 @@ struct hailo_d2h_notification { + enum hailo_board_type { + HAILO_BOARD_TYPE_HAILO8 = 0, + HAILO_BOARD_TYPE_HAILO15, +- HAILO_BOARD_TYPE_PLUTO, ++ HAILO_BOARD_TYPE_HAILO15L, + HAILO_BOARD_TYPE_HAILO10H, + HAILO_BOARD_TYPE_HAILO10H_LEGACY, + HAILO_BOARD_TYPE_COUNT, +--- a/drivers/media/pci/hailo/common/pcie_common.c ++++ b/drivers/media/pci/hailo/common/pcie_common.c +@@ -30,6 +30,8 @@ + + #define ATR0_PCIE_BRIDGE_OFFSET (0x700) + ++#define ATR_PCIE_BRIDGE_OFFSET(atr_index) (ATR0_PCIE_BRIDGE_OFFSET + (atr_index * 0x20)) ++ + #define MAXIMUM_APP_FIRMWARE_CODE_SIZE (0x40000) + #define MAXIMUM_CORE_FIRMWARE_CODE_SIZE (0x20000) + +@@ -40,17 +42,21 @@ + + #define PCIE_CONFIG_VENDOR_OFFSET (0x0098) + +-#define HAILO_PCIE_HOST_DMA_DATA_ID (0) + #define HAILO_PCIE_DMA_DEVICE_INTERRUPTS_BITMASK (1 << 4) + #define HAILO_PCIE_DMA_HOST_INTERRUPTS_BITMASK (1 << 5) + #define HAILO_PCIE_DMA_SRC_CHANNELS_BITMASK (0x0000FFFF) + + #define HAILO_PCIE_MAX_ATR_TABLE_INDEX (3) + +-#define MAX_FILES_PER_STAGE (4) +- + #define BOOT_STATUS_UNINITIALIZED (0x1) + ++#define PCIE_CONTROL_SECTION_ADDRESS_H8 (0x60000000) ++#define PCIE_BLOCK_ADDRESS_ATR1 (0x200000) ++ ++#define PCIE_CONFIG_PCIE_CFG_QM_ROUTING_MODE_SET(reg_offset) \ ++ (reg_offset) = (((reg_offset) & ~0x00000004L) | ((uint32_t)(1) << 2)) ++ ++ + struct hailo_fw_addresses { + u32 boot_fw_header; + u32 app_fw_code_ram_base; +@@ -58,19 +64,14 @@ struct hailo_fw_addresses { + u32 boot_cont_cert; + u32 core_code_ram_base; + u32 core_fw_header; +- u32 atr0_trsl_addr1; + u32 raise_ready_offset; + u32 boot_status; +-}; +- +-struct loading_stage { +- const struct hailo_file_batch *batch; +- u32 trigger_address; ++ u32 pcie_cfg_regs; + }; + + struct hailo_board_compatibility { + struct hailo_fw_addresses fw_addresses; +- const struct loading_stage stages[MAX_LOADING_STAGES]; ++ const struct hailo_pcie_loading_stage stages[MAX_LOADING_STAGES]; + }; + + static const struct hailo_file_batch hailo10h_files_stg1[] = { +@@ -134,13 +135,18 @@ static const struct hailo_file_batch hai + .has_core = false + }, + { +- .filename = "hailo/hailo10h/core-image-minimal-hailo10-m2.ext4.gz", ++ .filename = "hailo/hailo10h/image-fs", ++#ifndef HAILO_EMULATOR + .address = 0x88000000, ++#else ++ // TODO : HRT-15692 - merge two cases ++ .address = 0x89000000, ++#endif /* ifndef HAILO_EMULATOR */ + .max_size = 0x20000000, // Max size 512MB + .is_mandatory = true, + .has_header = false, + .has_core = false +- }, ++ } + }; + + // If loading linux from EMMC - only need few files from second batch (u-boot-spl.bin and u-boot-tfa.itb) +@@ -173,7 +179,7 @@ static const struct hailo_file_batch hai + + static const struct hailo_file_batch hailo8_files_stg1[] = { + { +- .filename = "hailo/hailo8_fw.4.19.0.bin", ++ .filename = "hailo/hailo8_fw.bin", + .address = 0x20000, + .max_size = 0x50000, + .is_mandatory = true, +@@ -225,9 +231,10 @@ static const struct hailo_file_batch hai + } + }; + +-static const struct hailo_file_batch pluto_files_stg1[] = { ++// TODO HRT-15014 - Fix names for hailo15l legacy accelerator ++static const struct hailo_file_batch hailo15l_files_stg1[] = { + { +- .filename = "hailo/pluto_fw.bin", ++ .filename = "hailo/hailo15l_fw.bin", + .address = 0x20000, + .max_size = 0x100000, + .is_mandatory = true, +@@ -253,14 +260,15 @@ static const struct hailo_board_compatib + .app_fw_code_ram_base = 0x60000, + .core_code_ram_base = 0xC0000, + .core_fw_header = 0xA0000, +- .atr0_trsl_addr1 = 0x60000000, + .raise_ready_offset = 0x1684, + .boot_status = 0xe0000, + }, + .stages = { + { + .batch = hailo8_files_stg1, +- .trigger_address = 0xE0980 ++ .trigger_address = 0xE0980, ++ .timeout = FIRMWARE_WAIT_TIMEOUT_MS, ++ .amount_of_files_in_stage = 3 + }, + }, + }, +@@ -272,14 +280,15 @@ static const struct hailo_board_compatib + .app_fw_code_ram_base = 0x20000, + .core_code_ram_base = 0x60000, + .core_fw_header = 0xC0000, +- .atr0_trsl_addr1 = 0x000BE000, + .raise_ready_offset = 0x1754, + .boot_status = 0x80000, + }, + .stages = { + { + .batch = hailo10h_legacy_files_stg1, +- .trigger_address = 0x88c98 ++ .trigger_address = 0x88c98, ++ .timeout = FIRMWARE_WAIT_TIMEOUT_MS, ++ .amount_of_files_in_stage = 1 + }, + }, + }, +@@ -291,28 +300,34 @@ static const struct hailo_board_compatib + .app_fw_code_ram_base = 0x20000, + .core_code_ram_base = 0, + .core_fw_header = 0, +- .atr0_trsl_addr1 = 0x000BE000, + .raise_ready_offset = 0x1754, + .boot_status = 0x80000, ++ .pcie_cfg_regs = 0x002009dc, + }, + .stages = { + { + .batch = hailo10h_files_stg1, +- .trigger_address = 0x88c98 ++ .trigger_address = 0x88c98, ++ .timeout = FIRMWARE_WAIT_TIMEOUT_MS, ++ .amount_of_files_in_stage = 3 + }, + { + .batch = hailo10h_files_stg2, +- .trigger_address = 0x84000000 ++ .trigger_address = 0x84000000, ++ .timeout = PCI_EP_WAIT_TIMEOUT_MS, ++ .amount_of_files_in_stage = 4 + }, + { + .batch = hailo10h_files_stg2_linux_in_emmc, +- .trigger_address = 0x84000000 ++ .trigger_address = 0x84000000, ++ .timeout = FIRMWARE_WAIT_TIMEOUT_MS, ++ .amount_of_files_in_stage = 2 + }, + }, + }, + // HRT-11344 : none of these matter except raise_ready_offset seeing as we load fw seperately - not through driver + // After implementing bootloader put correct values here +- [HAILO_BOARD_TYPE_PLUTO] = { ++ [HAILO_BOARD_TYPE_HAILO15L] = { + .fw_addresses = { + .boot_fw_header = 0x88000, + .boot_key_cert = 0x88018, +@@ -320,44 +335,54 @@ static const struct hailo_board_compatib + .app_fw_code_ram_base = 0x20000, + .core_code_ram_base = 0x60000, + .core_fw_header = 0xC0000, +- .atr0_trsl_addr1 = 0x000BE000, + // NOTE: After they update hw consts - check register fw_access_interrupt_w1s of pcie_config + .raise_ready_offset = 0x174c, + .boot_status = 0x80000, + }, + .stages = { + { +- .batch = pluto_files_stg1, +- .trigger_address = 0x88c98 ++ .batch = hailo15l_files_stg1, ++ .trigger_address = 0x88c98, ++ .timeout = FIRMWARE_WAIT_TIMEOUT_MS, ++ .amount_of_files_in_stage = 1 + }, + }, + } + }; + ++const struct hailo_pcie_loading_stage *hailo_pcie_get_loading_stage_info(enum hailo_board_type board_type, ++ enum loading_stages stage) ++{ ++ return &compat[board_type].stages[stage]; ++} ++ ++static u32 read_and_clear_reg(struct hailo_resource *resource, u32 offset) ++{ ++ u32 value = hailo_resource_read32(resource, offset); ++ if (value != 0) { ++ hailo_resource_write32(resource, offset, value); ++ } ++ return value; ++} + + bool hailo_pcie_read_interrupt(struct hailo_pcie_resources *resources, struct hailo_pcie_interrupt_source *source) + { +- u32 channel_data_source = 0; +- u32 channel_data_dest = 0; ++ u32 istatus_host = 0; + memset(source, 0, sizeof(*source)); + +- source->interrupt_bitmask = hailo_resource_read32(&resources->config, BCS_ISTATUS_HOST); +- if (0 == source->interrupt_bitmask) { ++ istatus_host = read_and_clear_reg(&resources->config, BCS_ISTATUS_HOST); ++ if (0 == istatus_host) { + return false; + } + +- // clear signal +- hailo_resource_write32(&resources->config, BCS_ISTATUS_HOST, source->interrupt_bitmask); ++ source->sw_interrupts = (istatus_host >> BCS_ISTATUS_HOST_SW_IRQ_SHIFT); + +- if (source->interrupt_bitmask & BCS_ISTATUS_HOST_VDMA_SRC_IRQ_MASK) { +- channel_data_source = hailo_resource_read32(&resources->config, BCS_SOURCE_INTERRUPT_PER_CHANNEL); +- hailo_resource_write32(&resources->config, BCS_SOURCE_INTERRUPT_PER_CHANNEL, channel_data_source); +- } +- if (source->interrupt_bitmask & BCS_ISTATUS_HOST_VDMA_DEST_IRQ_MASK) { +- channel_data_dest = hailo_resource_read32(&resources->config, BCS_DESTINATION_INTERRUPT_PER_CHANNEL); +- hailo_resource_write32(&resources->config, BCS_DESTINATION_INTERRUPT_PER_CHANNEL, channel_data_dest); ++ if (istatus_host & BCS_ISTATUS_HOST_VDMA_SRC_IRQ_MASK) { ++ source->vdma_channels_bitmap |= read_and_clear_reg(&resources->config, BCS_SOURCE_INTERRUPT_PER_CHANNEL); ++ } ++ if (istatus_host & BCS_ISTATUS_HOST_VDMA_DEST_IRQ_MASK) { ++ source->vdma_channels_bitmap |= read_and_clear_reg(&resources->config, BCS_DESTINATION_INTERRUPT_PER_CHANNEL); + } +- source->vdma_channels_bitmap = channel_data_source | channel_data_dest; + + return true; + } +@@ -419,6 +444,15 @@ void hailo_pcie_write_firmware_driver_sh + hailo_resource_write32(&resources->fw_access, fw_addresses->raise_ready_offset, fw_access_value); + } + ++void hailo_pcie_write_firmware_soft_reset(struct hailo_pcie_resources *resources) ++{ ++ const struct hailo_fw_addresses *fw_addresses = &(compat[resources->board_type].fw_addresses); ++ const u32 fw_access_value = FW_ACCESS_SOFT_RESET_MASK; ++ ++ // Write shutdown flag to FW ++ hailo_resource_write32(&resources->fw_access, fw_addresses->raise_ready_offset, fw_access_value); ++} ++ + int hailo_pcie_configure_atr_table(struct hailo_resource *bridge_config, u64 trsl_addr, u32 atr_index) + { + size_t offset = 0; +@@ -431,7 +465,7 @@ int hailo_pcie_configure_atr_table(struc + }; + + BUG_ON(HAILO_PCIE_MAX_ATR_TABLE_INDEX < atr_index); +- offset = ATR0_PCIE_BRIDGE_OFFSET + (atr_index * 0x20); ++ offset = ATR_PCIE_BRIDGE_OFFSET(atr_index); + + return hailo_resource_write_buffer(bridge_config, offset, sizeof(atr), (void*)&atr); + } +@@ -441,7 +475,7 @@ void hailo_pcie_read_atr_table(struct ha + size_t offset = 0; + + BUG_ON(HAILO_PCIE_MAX_ATR_TABLE_INDEX < atr_index); +- offset = ATR0_PCIE_BRIDGE_OFFSET + (atr_index * 0x20); ++ offset = ATR_PCIE_BRIDGE_OFFSET(atr_index); + + hailo_resource_read_buffer(bridge_config, offset, sizeof(*atr), (void*)atr); + } +@@ -510,7 +544,7 @@ static void read_memory(struct hailo_pci + hailo_pcie_read_atr_table(&resources->config, &previous_atr, ATR_INDEX); + + if (base_address != src) { +- // Data is not aligned, write the first chunk ++ // Data is not aligned, read the first chunk + chunk_len = min((u32)(base_address + ATR_TABLE_SIZE - src), len); + read_memory_chunk(resources, base_address, (u32)(src - base_address), dest, chunk_len); + offset += chunk_len; +@@ -526,6 +560,18 @@ static void read_memory(struct hailo_pci + (((u64)(previous_atr.atr_trsl_addr_2) << 32) | previous_atr.atr_trsl_addr_1), ATR_INDEX); + } + ++// Note: This function use for enabling the vDMA transaction host<->device by read modify write of the EP registers in the SOC - for fast boot over vDMA. ++void hailo_pcie_configure_ep_registers_for_dma_transaction(struct hailo_pcie_resources *resources) ++{ ++ u32 reg_routing_mercury = 0; ++ ++ BUG_ON(compat[resources->board_type].fw_addresses.pcie_cfg_regs == 0); ++ ++ read_memory(resources, compat[resources->board_type].fw_addresses.pcie_cfg_regs, ®_routing_mercury, sizeof(reg_routing_mercury)); ++ PCIE_CONFIG_PCIE_CFG_QM_ROUTING_MODE_SET(reg_routing_mercury); ++ write_memory(resources, compat[resources->board_type].fw_addresses.pcie_cfg_regs, ®_routing_mercury, sizeof(reg_routing_mercury)); ++} ++ + static void hailo_write_app_firmware(struct hailo_pcie_resources *resources, firmware_header_t *fw_header, + secure_boot_certificate_header_t *fw_cert) + { +@@ -551,11 +597,11 @@ static void hailo_write_core_firmware(st + write_memory(resources, fw_addresses->core_fw_header, fw_header, sizeof(firmware_header_t)); + } + +-void hailo_trigger_firmware_boot(struct hailo_pcie_resources *resources, u32 address) ++void hailo_trigger_firmware_boot(struct hailo_pcie_resources *resources, u32 stage) + { + u32 pcie_finished = 1; + +- write_memory(resources, address, (void*)&pcie_finished, sizeof(pcie_finished)); ++ write_memory(resources, compat[resources->board_type].stages[stage].trigger_address, (void*)&pcie_finished, sizeof(pcie_finished)); + } + + u32 hailo_get_boot_status(struct hailo_pcie_resources *resources) +@@ -673,16 +719,14 @@ static int write_single_file(struct hail + + int hailo_pcie_write_firmware_batch(struct device *dev, struct hailo_pcie_resources *resources, u32 stage) + { +- const struct hailo_file_batch *files_batch = compat[resources->board_type].stages[stage].batch; ++ const struct hailo_pcie_loading_stage *stage_info = hailo_pcie_get_loading_stage_info(resources->board_type, stage); ++ const struct hailo_file_batch *files_batch = stage_info->batch; ++ const u8 amount_of_files = stage_info->amount_of_files_in_stage; + int file_index = 0; + int err = 0; + +- for (file_index = 0; file_index < MAX_FILES_PER_STAGE; file_index++) ++ for (file_index = 0; file_index < amount_of_files; file_index++) + { +- if (NULL == files_batch[file_index].filename) { +- break; +- } +- + dev_notice(dev, "Writing file %s\n", files_batch[file_index].filename); + + err = write_single_file(resources, &files_batch[file_index], dev); +@@ -696,31 +740,29 @@ int hailo_pcie_write_firmware_batch(stru + dev_notice(dev, "File %s written successfully\n", files_batch[file_index].filename); + } + +- hailo_trigger_firmware_boot(resources, compat[resources->board_type].stages[stage].trigger_address); ++ hailo_trigger_firmware_boot(resources, stage); + + return 0; + } + +-// TODO: HRT-14147 - remove this function +-static bool hailo_pcie_is_device_ready_for_boot(struct hailo_pcie_resources *resources) +-{ +- return hailo_get_boot_status(resources) == BOOT_STATUS_UNINITIALIZED; +-} +- + bool hailo_pcie_is_firmware_loaded(struct hailo_pcie_resources *resources) + { + u32 offset; + u32 atr_value; + +- // TODO: HRT-14147 +- if (HAILO_BOARD_TYPE_HAILO10H == resources->board_type) { +- return !hailo_pcie_is_device_ready_for_boot(resources); ++ if (HAILO_BOARD_TYPE_HAILO8 == resources->board_type) { ++ offset = ATR_PCIE_BRIDGE_OFFSET(0) + offsetof(struct hailo_atr_config, atr_trsl_addr_1); ++ atr_value = hailo_resource_read32(&resources->config, offset); ++ ++ return (PCIE_CONTROL_SECTION_ADDRESS_H8 == atr_value); + } ++ else { ++ offset = ATR_PCIE_BRIDGE_OFFSET(1) + offsetof(struct hailo_atr_config, atr_trsl_addr_1); ++ atr_value = hailo_resource_read32(&resources->config, offset); + +- offset = ATR0_PCIE_BRIDGE_OFFSET + offsetof(struct hailo_atr_config, atr_trsl_addr_1); +- atr_value = hailo_resource_read32(&resources->config, offset); ++ return (PCIE_BLOCK_ADDRESS_ATR1 == atr_value); ++ } + +- return atr_value == compat[resources->board_type].fw_addresses.atr0_trsl_addr1; + } + + bool hailo_pcie_wait_for_firmware(struct hailo_pcie_resources *resources) +@@ -764,8 +806,7 @@ void hailo_pcie_enable_interrupts(struct + hailo_resource_write32(&resources->config, BCS_DESTINATION_INTERRUPT_PER_CHANNEL, 0xFFFFFFFF); + hailo_resource_write32(&resources->config, BCS_SOURCE_INTERRUPT_PER_CHANNEL, 0xFFFFFFFF); + +- mask |= (BCS_ISTATUS_HOST_FW_IRQ_CONTROL_MASK | BCS_ISTATUS_HOST_FW_IRQ_NOTIFICATION | +- BCS_ISTATUS_HOST_DRIVER_DOWN | BCS_ISTATUS_SOC_CONNECT_ACCEPTED | BCS_ISTATUS_SOC_CLOSED_IRQ); ++ mask |= BCS_ISTATUS_HOST_SW_IRQ_MASK; + hailo_resource_write32(&resources->config, BSC_IMASK_HOST, mask); + } + +@@ -822,7 +863,7 @@ int hailo_set_device_type(struct hailo_p + switch(resources->board_type) { + case HAILO_BOARD_TYPE_HAILO8: + case HAILO_BOARD_TYPE_HAILO10H_LEGACY: +- case HAILO_BOARD_TYPE_PLUTO: ++ case HAILO_BOARD_TYPE_HAILO15L: + resources->accelerator_type = HAILO_ACCELERATOR_TYPE_NNC; + break; + case HAILO_BOARD_TYPE_HAILO10H: +--- a/drivers/media/pci/hailo/common/pcie_common.h ++++ b/drivers/media/pci/hailo/common/pcie_common.h +@@ -18,11 +18,8 @@ + #include + + +-#define BCS_ISTATUS_HOST_FW_IRQ_CONTROL_MASK (0x04000000) +-#define BCS_ISTATUS_HOST_FW_IRQ_NOTIFICATION (0x02000000) +-#define BCS_ISTATUS_HOST_DRIVER_DOWN (0x08000000) +-#define BCS_ISTATUS_SOC_CONNECT_ACCEPTED (0x10000000) +-#define BCS_ISTATUS_SOC_CLOSED_IRQ (0x20000000) ++#define BCS_ISTATUS_HOST_SW_IRQ_MASK (0xFF000000) ++#define BCS_ISTATUS_HOST_SW_IRQ_SHIFT (24) + #define BCS_ISTATUS_HOST_VDMA_SRC_IRQ_MASK (0x000000FF) + #define BCS_ISTATUS_HOST_VDMA_DEST_IRQ_MASK (0x0000FF00) + +@@ -36,13 +33,19 @@ + #define HAILO_PCIE_FW_ACCESS_BAR (4) + + #define HAILO_PCIE_DMA_ENGINES_COUNT (1) ++#define PCI_VDMA_ENGINE_INDEX (0) ++ ++#define MAX_FILES_PER_STAGE (4) ++ ++#define HAILO_PCIE_HOST_DMA_DATA_ID (0) ++#define HAILO_PCI_EP_HOST_DMA_DATA_ID (6) + + #define DRIVER_NAME "hailo" + + #define PCI_VENDOR_ID_HAILO 0x1e60 + #define PCI_DEVICE_ID_HAILO_HAILO8 0x2864 +-#define PCI_DEVICE_ID_HAILO_HAILO15 0x45C4 +-#define PCI_DEVICE_ID_HAILO_PLUTO 0x43a2 ++#define PCI_DEVICE_ID_HAILO_HAILO10H 0x45C4 ++#define PCI_DEVICE_ID_HAILO_HAILO15L 0x43a2 + + typedef u64 hailo_ptr_t; + +@@ -69,18 +72,24 @@ enum loading_stages { + MAX_LOADING_STAGES = 3 + }; + +-enum hailo_pcie_interrupt_masks { +- FW_CONTROL = BCS_ISTATUS_HOST_FW_IRQ_CONTROL_MASK, +- FW_NOTIFICATION = BCS_ISTATUS_HOST_FW_IRQ_NOTIFICATION, +- DRIVER_DOWN = BCS_ISTATUS_HOST_DRIVER_DOWN, +- SOC_CONNECT_ACCEPTED = BCS_ISTATUS_SOC_CONNECT_ACCEPTED, +- SOC_CLOSED_IRQ = BCS_ISTATUS_SOC_CLOSED_IRQ, +- VDMA_SRC_IRQ_MASK = BCS_ISTATUS_HOST_VDMA_SRC_IRQ_MASK, +- VDMA_DEST_IRQ_MASK = BCS_ISTATUS_HOST_VDMA_DEST_IRQ_MASK ++enum hailo_pcie_nnc_sw_interrupt_masks { ++ HAILO_PCIE_NNC_FW_NOTIFICATION_IRQ = 0x2, ++ HAILO_PCIE_NNC_FW_CONTROL_IRQ = 0x4, ++ HAILO_PCIE_NNC_DRIVER_DOWN_IRQ = 0x8, ++}; ++ ++enum hailo_pcie_soc_sw_interrupt_masks { ++ HAILO_PCIE_SOC_CONTROL_IRQ = 0x10, ++ HAILO_PCIE_SOC_CLOSE_IRQ = 0x20, ++}; ++ ++enum hailo_pcie_boot_interrupt_masks { ++ HAILO_PCIE_BOOT_SOFT_RESET_IRQ = 0x1, ++ HAILO_PCIE_BOOT_IRQ = 0x2, + }; + + struct hailo_pcie_interrupt_source { +- u32 interrupt_bitmask; ++ u32 sw_interrupts; + u32 vdma_channels_bitmap; + }; + +@@ -93,6 +102,13 @@ struct hailo_file_batch { + bool has_core; + }; + ++struct hailo_pcie_loading_stage { ++ const struct hailo_file_batch *batch; ++ u32 trigger_address; ++ u32 timeout; ++ u8 amount_of_files_in_stage; ++}; ++ + // TODO: HRT-6144 - Align Windows/Linux to QNX + #ifdef __QNX__ + enum hailo_bar_index { +@@ -117,8 +133,23 @@ enum hailo_bar_index { + extern "C" { + #endif + ++ ++#ifndef HAILO_EMULATOR ++#define TIME_UNTIL_REACH_BOOTLOADER (10) ++#define PCI_EP_WAIT_TIMEOUT_MS (40000) ++#define FIRMWARE_WAIT_TIMEOUT_MS (5000) ++#else /* ifndef HAILO_EMULATOR */ ++// PCI EP timeout is defined to 50000000 because on Emulator the boot time + linux init time can be very long (4+ hours) ++#define TIME_UNTIL_REACH_BOOTLOADER (10000) ++#define PCI_EP_WAIT_TIMEOUT_MS (50000000) ++#define FIRMWARE_WAIT_TIMEOUT_MS (5000000) ++#endif /* ifndef HAILO_EMULATOR */ ++ + extern struct hailo_vdma_hw hailo_pcie_vdma_hw; + ++const struct hailo_pcie_loading_stage* hailo_pcie_get_loading_stage_info(enum hailo_board_type board_type, ++ enum loading_stages stage); ++ + // Reads the interrupt source from BARs, return false if there is no interrupt. + // note - this function clears the interrupt signals. + bool hailo_pcie_read_interrupt(struct hailo_pcie_resources *resources, struct hailo_pcie_interrupt_source *source); +@@ -137,7 +168,9 @@ int hailo_pcie_memory_transfer(struct ha + + bool hailo_pcie_is_device_connected(struct hailo_pcie_resources *resources); + void hailo_pcie_write_firmware_driver_shutdown(struct hailo_pcie_resources *resources); +-void hailo_trigger_firmware_boot(struct hailo_pcie_resources *resources, u32 address); ++void hailo_pcie_write_firmware_soft_reset(struct hailo_pcie_resources *resources); ++void hailo_pcie_configure_ep_registers_for_dma_transaction(struct hailo_pcie_resources *resources); ++void hailo_trigger_firmware_boot(struct hailo_pcie_resources *resources, u32 stage); + + int hailo_set_device_type(struct hailo_pcie_resources *resources); + +@@ -157,4 +190,4 @@ void hailo_pcie_soc_read_response(struct + } + #endif + +-#endif /* _HAILO_COMMON_PCIE_COMMON_H_ */ +\ No newline at end of file ++#endif /* _HAILO_COMMON_PCIE_COMMON_H_ */ +--- a/drivers/media/pci/hailo/common/vdma_common.c ++++ b/drivers/media/pci/hailo/common/vdma_common.c +@@ -15,16 +15,6 @@ + #include + #include + +- +-#define CHANNEL_BASE_OFFSET(channel_index) ((channel_index) << 5) +- +-#define CHANNEL_CONTROL_OFFSET (0x0) +-#define CHANNEL_DEPTH_ID_OFFSET (0x1) +-#define CHANNEL_NUM_AVAIL_OFFSET (0x2) +-#define CHANNEL_NUM_PROC_OFFSET (0x4) +-#define CHANNEL_ERROR_OFFSET (0x8) +-#define CHANNEL_DEST_REGS_OFFSET (0x10) +- + #define VDMA_CHANNEL_CONTROL_START (0x1) + #define VDMA_CHANNEL_CONTROL_ABORT (0b00) + #define VDMA_CHANNEL_CONTROL_ABORT_PAUSE (0b10) +@@ -160,17 +150,17 @@ static u8 get_channel_id(u8 channel_inde + return (channel_index < MAX_VDMA_CHANNELS_PER_ENGINE) ? (channel_index & 0xF) : INVALID_VDMA_CHANNEL; + } + +-static int program_descriptors_in_chunk( ++int hailo_vdma_program_descriptors_in_chunk( + struct hailo_vdma_hw *vdma_hw, + dma_addr_t chunk_addr, + unsigned int chunk_size, + struct hailo_vdma_descriptors_list *desc_list, + u32 desc_index, + u32 max_desc_index, +- u8 channel_id) ++ u8 channel_index, ++ u8 data_id) + { + const u16 page_size = desc_list->desc_page_size; +- const u8 ddr_data_id = vdma_hw->ddr_data_id; + const u32 descs_to_program = DIV_ROUND_UP(chunk_size, page_size); + const u32 starting_desc_index = desc_index; + const u32 residue_size = chunk_size % page_size; +@@ -187,7 +177,7 @@ static int program_descriptors_in_chunk( + return -ERANGE; + } + +- encoded_addr = vdma_hw->hw_ops.encode_desc_dma_address_range(chunk_addr, chunk_addr + chunk_size, page_size, channel_id); ++ encoded_addr = vdma_hw->hw_ops.encode_desc_dma_address_range(chunk_addr, chunk_addr + chunk_size, page_size, get_channel_id(channel_index)); + if (INVALID_VDMA_ADDRESS == encoded_addr) { + return -EFAULT; + } +@@ -197,7 +187,7 @@ static int program_descriptors_in_chunk( + // 'desc_index & desc_list_len_mask' is used instead of modulo; see hailo_vdma_descriptors_list documentation. + hailo_vdma_program_descriptor( + &desc_list->desc_list[desc_index & desc_list->desc_count_mask], +- encoded_addr, page_size, ddr_data_id); ++ encoded_addr, page_size, data_id); + encoded_addr += page_size; + } + +@@ -205,7 +195,7 @@ static int program_descriptors_in_chunk( + // 'desc_index & desc_list_len_mask' is used instead of modulo; see hailo_vdma_descriptors_list documentation. + dma_desc = &desc_list->desc_list[desc_index & desc_list->desc_count_mask]; + hailo_vdma_program_descriptor(dma_desc, encoded_addr, +- (residue_size == 0) ? page_size : (u16)residue_size, ddr_data_id); ++ (residue_size == 0) ? page_size : (u16)residue_size, data_id); + + return (int)descs_to_program; + } +@@ -241,7 +231,6 @@ static int bind_and_program_descriptors_ + enum hailo_vdma_interrupts_domain last_desc_interrupts, + bool is_debug) + { +- const u8 channel_id = get_channel_id(channel_index); + int desc_programmed = 0; + int descs_programmed_in_chunk = 0; + u32 max_desc_index = 0; +@@ -279,8 +268,8 @@ static int bind_and_program_descriptors_ + (u32)(sg_dma_len(sg_entry)); + chunk_size = min((u32)program_size, chunk_size); + +- descs_programmed_in_chunk = program_descriptors_in_chunk(vdma_hw, chunk_start_addr, chunk_size, desc_list, +- starting_desc, max_desc_index, channel_id); ++ descs_programmed_in_chunk = hailo_vdma_program_descriptors_in_chunk(vdma_hw, chunk_start_addr, chunk_size, desc_list, ++ starting_desc, max_desc_index, channel_index, vdma_hw->ddr_data_id); + if (descs_programmed_in_chunk < 0) { + return descs_programmed_in_chunk; + } +@@ -363,16 +352,16 @@ static int validate_channel_state(struct + return 0; + } + +-static void set_num_avail(u8 __iomem *host_regs, u16 num_avail) ++void hailo_vdma_set_num_avail(u8 __iomem *regs, u16 num_avail) + { +- u32 host_regs_val = ioread32(host_regs); +- iowrite32(WRITE_BITS_AT_OFFSET(WORD_SIZE * BITS_IN_BYTE, CHANNEL_NUM_AVAIL_OFFSET * BITS_IN_BYTE, host_regs_val, num_avail), +- host_regs); ++ u32 regs_val = ioread32(regs); ++ iowrite32(WRITE_BITS_AT_OFFSET(WORD_SIZE * BITS_IN_BYTE, CHANNEL_NUM_AVAIL_OFFSET * BITS_IN_BYTE, regs_val, num_avail), ++ regs); + } + +-static u16 get_num_proc(u8 __iomem *host_regs) ++u16 hailo_vdma_get_num_proc(u8 __iomem *regs) + { +- return READ_BITS_AT_OFFSET(WORD_SIZE * BITS_IN_BYTE, 0, ioread32(host_regs + CHANNEL_NUM_PROC_OFFSET)); ++ return READ_BITS_AT_OFFSET(WORD_SIZE * BITS_IN_BYTE, 0, ioread32(regs + CHANNEL_NUM_PROC_OFFSET)); + } + + int hailo_vdma_launch_transfer( +@@ -455,7 +444,7 @@ int hailo_vdma_launch_transfer( + + new_num_avail = (u16)((last_desc + 1) % desc_list->desc_count); + channel->state.num_avail = new_num_avail; +- set_num_avail(channel->host_regs, new_num_avail); ++ hailo_vdma_set_num_avail(channel->host_regs, new_num_avail); + + return (int)total_descs; + } +@@ -463,7 +452,7 @@ int hailo_vdma_launch_transfer( + static void hailo_vdma_push_timestamp(struct hailo_vdma_channel *channel) + { + struct hailo_channel_interrupt_timestamp_list *timestamp_list = &channel->timestamp_list; +- const u16 num_proc = get_num_proc(channel->host_regs); ++ const u16 num_proc = hailo_vdma_get_num_proc(channel->host_regs); + if (TIMESTAMPS_CIRC_SPACE(*timestamp_list) != 0) { + timestamp_list->timestamps[timestamp_list->head].timestamp_ns = ktime_get_ns(); + timestamp_list->timestamps[timestamp_list->head].desc_num_processed = num_proc; +@@ -725,7 +714,7 @@ int hailo_vdma_engine_fill_irq_data(stru + // the actual hw_num_processed is a number between 1 and desc_count. + // Therefore the value can be desc_count, in this case we change it to + // zero. +- hw_num_proc = get_num_proc(channel->host_regs) & channel->state.desc_count_mask; ++ hw_num_proc = hailo_vdma_get_num_proc(channel->host_regs) & channel->state.desc_count_mask; + + while (ONGOING_TRANSFERS_CIRC_CNT(channel->ongoing_transfers) > 0) { + struct hailo_ongoing_transfer *cur_transfer = +@@ -780,12 +769,13 @@ static void hailo_vdma_channel_abort(u8 + VDMA_CHANNEL_CONTROL_ABORT), host_regs); + } + +-int hailo_vdma_start_channel(u8 __iomem *host_regs, uint64_t desc_dma_address, uint8_t desc_depth, ++int hailo_vdma_start_channel(u8 __iomem *regs, uint64_t desc_dma_address, uint32_t desc_count, + uint8_t data_id) + { + u16 dma_address_l = 0; + u32 dma_address_h = 0; + u32 desc_depth_data_id = 0; ++ u8 desc_depth = ceil_log2(desc_count); + + if (((desc_dma_address & 0xFFFF) != 0) || + (desc_depth > DESCRIPTOR_LIST_MAX_DEPTH)) { +@@ -798,22 +788,22 @@ int hailo_vdma_start_channel(u8 __iomem + } + + // Stop old channel state +- hailo_vdma_stop_channel(host_regs); ++ hailo_vdma_stop_channel(regs); + + // Configure address, depth and id + dma_address_l = (uint16_t)((desc_dma_address >> 16) & 0xFFFF); + iowrite32(WRITE_BITS_AT_OFFSET(WORD_SIZE * BITS_IN_BYTE, (VDMA_CHANNEL__ADDRESS_L_OFFSET - +- VDMA_CHANNEL__ALIGNED_ADDRESS_L_OFFSET) * BITS_IN_BYTE, ioread32(host_regs + +- VDMA_CHANNEL__ALIGNED_ADDRESS_L_OFFSET), dma_address_l), host_regs + VDMA_CHANNEL__ALIGNED_ADDRESS_L_OFFSET); ++ VDMA_CHANNEL__ALIGNED_ADDRESS_L_OFFSET) * BITS_IN_BYTE, ioread32(regs + ++ VDMA_CHANNEL__ALIGNED_ADDRESS_L_OFFSET), dma_address_l), regs + VDMA_CHANNEL__ALIGNED_ADDRESS_L_OFFSET); + + dma_address_h = (uint32_t)(desc_dma_address >> 32); +- iowrite32(dma_address_h, host_regs + VDMA_CHANNEL__ADDRESS_H_OFFSET); ++ iowrite32(dma_address_h, regs + VDMA_CHANNEL__ADDRESS_H_OFFSET); + + desc_depth_data_id = (uint32_t)(desc_depth << VDMA_CHANNEL_DESC_DEPTH_SHIFT) | + (data_id << VDMA_CHANNEL_DATA_ID_SHIFT); +- iowrite32(desc_depth_data_id, host_regs); ++ iowrite32(desc_depth_data_id, regs); + +- start_vdma_control_register(host_regs); ++ start_vdma_control_register(regs); + + return 0; + } +@@ -853,10 +843,10 @@ static int hailo_vdma_wait_until_channel + return -ETIMEDOUT; + } + +-void hailo_vdma_stop_channel(u8 __iomem *host_regs) ++void hailo_vdma_stop_channel(u8 __iomem *regs) + { + int err = 0; +- u8 host_side_channel_regs = READ_BITS_AT_OFFSET(BYTE_SIZE * BITS_IN_BYTE, CHANNEL_CONTROL_OFFSET * BITS_IN_BYTE, ioread32(host_regs)); ++ u8 host_side_channel_regs = READ_BITS_AT_OFFSET(BYTE_SIZE * BITS_IN_BYTE, CHANNEL_CONTROL_OFFSET * BITS_IN_BYTE, ioread32(regs)); + + if ((host_side_channel_regs & VDMA_CHANNEL_CONTROL_START_ABORT_PAUSE_RESUME_BITMASK) == VDMA_CHANNEL_CONTROL_ABORT_PAUSE) { + // The channel is aborted (we set the channel to VDMA_CHANNEL_CONTROL_ABORT_PAUSE at the end of this function) +@@ -866,17 +856,17 @@ void hailo_vdma_stop_channel(u8 __iomem + // Pause the channel + // The channel is paused to allow for "all transfers from fetched descriptors..." to be "...completed" + // (from PLDA PCIe refernce manual, "9.2.5 Starting a Channel and Transferring Data") +- hailo_vdma_channel_pause(host_regs); ++ hailo_vdma_channel_pause(regs); + + // Even if channel is stuck and not idle, force abort and return error in the end +- err = hailo_vdma_wait_until_channel_idle(host_regs); ++ err = hailo_vdma_wait_until_channel_idle(regs); + // Success oriented - if error occured print error but still abort channel + if (err < 0) { + pr_err("Timeout occured while waiting for channel to become idle\n"); + } + + // Abort the channel (even of hailo_vdma_wait_until_channel_idle function fails) +- hailo_vdma_channel_abort(host_regs); ++ hailo_vdma_channel_abort(regs); + } + + bool hailo_check_channel_index(u8 channel_index, u32 src_channels_bitmask, bool is_input_channel) +--- a/drivers/media/pci/hailo/common/vdma_common.h ++++ b/drivers/media/pci/hailo/common/vdma_common.h +@@ -16,6 +16,15 @@ + #define VDMA_DESCRIPTOR_LIST_ALIGN (1 << 16) + #define INVALID_VDMA_ADDRESS (0) + ++#define CHANNEL_BASE_OFFSET(channel_index) ((channel_index) << 5) ++ ++#define CHANNEL_CONTROL_OFFSET (0x0) ++#define CHANNEL_DEPTH_ID_OFFSET (0x1) ++#define CHANNEL_NUM_AVAIL_OFFSET (0x2) ++#define CHANNEL_NUM_PROC_OFFSET (0x4) ++#define CHANNEL_ERROR_OFFSET (0x8) ++#define CHANNEL_DEST_REGS_OFFSET (0x10) ++ + #ifdef __cplusplus + extern "C" + { +@@ -172,6 +181,20 @@ int hailo_vdma_program_descriptors_list( + enum hailo_vdma_interrupts_domain last_desc_interrupts, + bool is_debug); + ++int hailo_vdma_program_descriptors_in_chunk( ++ struct hailo_vdma_hw *vdma_hw, ++ dma_addr_t chunk_addr, ++ unsigned int chunk_size, ++ struct hailo_vdma_descriptors_list *desc_list, ++ u32 desc_index, ++ u32 max_desc_index, ++ u8 channel_index, ++ u8 data_id); ++ ++void hailo_vdma_set_num_avail(u8 __iomem *regs, u16 num_avail); ++ ++u16 hailo_vdma_get_num_proc(u8 __iomem *regs); ++ + /** + * Launch a transfer on some vdma channel. Includes: + * 1. Binding the transfer buffers to the descriptors list. +@@ -249,9 +272,9 @@ int hailo_vdma_engine_fill_irq_data(stru + struct hailo_vdma_engine *engine, u32 irq_channels_bitmap, + transfer_done_cb_t transfer_done, void *transfer_done_opaque); + +-int hailo_vdma_start_channel(u8 __iomem *host_regs, uint64_t desc_dma_address, uint8_t desc_depth, uint8_t data_id); ++int hailo_vdma_start_channel(u8 __iomem *regs, uint64_t desc_dma_address, uint32_t desc_count, uint8_t data_id); + +-void hailo_vdma_stop_channel(u8 __iomem *host_regs); ++void hailo_vdma_stop_channel(u8 __iomem *regs); + + bool hailo_check_channel_index(u8 channel_index, u32 src_channels_bitmask, bool is_input_channel); + +--- a/drivers/media/pci/hailo/src/fops.c ++++ b/drivers/media/pci/hailo/src/fops.c +@@ -294,6 +294,54 @@ static void firmware_notification_irq_ha + } + } + ++static void boot_irq_handler(struct hailo_pcie_board *board, struct hailo_pcie_interrupt_source *irq_source) ++{ ++ if (irq_source->sw_interrupts & HAILO_PCIE_BOOT_SOFT_RESET_IRQ) { ++ hailo_dbg(board, "soft reset trigger IRQ\n"); ++ complete(&board->soft_reset.reset_completed); ++ } ++ if (irq_source->sw_interrupts & HAILO_PCIE_BOOT_IRQ) { ++ hailo_dbg(board, "boot trigger IRQ\n"); ++ complete_all(&board->fw_boot.fw_loaded_completion); ++ } else { ++ board->fw_boot.boot_used_channel_bitmap &= ~irq_source->vdma_channels_bitmap; ++ hailo_dbg(board, "boot vDMA data IRQ - channel_bitmap = 0x%x\n", irq_source->vdma_channels_bitmap); ++ if (0 == board->fw_boot.boot_used_channel_bitmap) { ++ complete_all(&board->fw_boot.vdma_boot_completion); ++ hailo_dbg(board, "boot vDMA data trigger IRQ\n"); ++ } ++ } ++} ++ ++static void nnc_irq_handler(struct hailo_pcie_board *board, struct hailo_pcie_interrupt_source *irq_source) ++{ ++ if (irq_source->sw_interrupts & HAILO_PCIE_NNC_FW_CONTROL_IRQ) { ++ complete(&board->nnc.fw_control.completion); ++ } ++ ++ if (irq_source->sw_interrupts & HAILO_PCIE_NNC_DRIVER_DOWN_IRQ) { ++ complete(&board->driver_down.reset_completed); ++ } ++ ++ if (irq_source->sw_interrupts & HAILO_PCIE_NNC_FW_NOTIFICATION_IRQ) { ++ firmware_notification_irq_handler(board); ++ } ++} ++ ++static void soc_irq_handler(struct hailo_pcie_board *board, struct hailo_pcie_interrupt_source *irq_source) ++{ ++ if (irq_source->sw_interrupts & HAILO_PCIE_SOC_CONTROL_IRQ) { ++ complete_all(&board->soc.control_resp_ready); ++ } ++ ++ if (irq_source->sw_interrupts & HAILO_PCIE_SOC_CLOSE_IRQ) { ++ hailo_info(board, "soc_irq_handler - HAILO_PCIE_SOC_CLOSE_IRQ\n"); ++ // always use bitmap=0xFFFFFFFF - it is ok to wake all interrupts since each handler will check if the stream was aborted or not. ++ hailo_vdma_wakeup_interrupts(&board->vdma, &board->vdma.vdma_engines[DEFAULT_VDMA_ENGINE_INDEX], ++ 0xFFFFFFFF); ++ } ++} ++ + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) + irqreturn_t hailo_irqhandler(int irq, void *dev_id, struct pt_regs *regs) + #else +@@ -320,39 +368,21 @@ irqreturn_t hailo_irqhandler(int irq, vo + + return_value = IRQ_HANDLED; + +- // wake fw_control if needed +- if (irq_source.interrupt_bitmask & FW_CONTROL) { +- complete(&board->nnc.fw_control.completion); +- } +- +- // wake driver_down if needed +- if (irq_source.interrupt_bitmask & DRIVER_DOWN) { +- complete(&board->driver_down.reset_completed); +- } +- +- if (irq_source.interrupt_bitmask & FW_NOTIFICATION) { +- if (!completion_done(&board->fw_loaded_completion)) { +- // Complete firmware loaded completion +- complete_all(&board->fw_loaded_completion); ++ if (board->fw_boot.is_in_boot) { ++ boot_irq_handler(board, &irq_source); ++ } else { ++ if (HAILO_ACCELERATOR_TYPE_NNC == board->pcie_resources.accelerator_type) { ++ nnc_irq_handler(board, &irq_source); ++ } else if (HAILO_ACCELERATOR_TYPE_SOC == board->pcie_resources.accelerator_type) { ++ soc_irq_handler(board, &irq_source); + } else { +- firmware_notification_irq_handler(board); ++ hailo_err(board, "Invalid accelerator type %d\n", board->pcie_resources.accelerator_type); + } +- } +- +- if (irq_source.interrupt_bitmask & SOC_CONNECT_ACCEPTED) { +- complete_all(&board->soc.control_resp_ready); +- } + +- if (irq_source.interrupt_bitmask & SOC_CLOSED_IRQ) { +- hailo_info(board, "hailo_irqhandler - SOC_CLOSED_IRQ\n"); +- // always use bitmap=0xFFFFFFFF - it is ok to wake all interrupts since each handler will check if the stream was aborted or not. +- hailo_vdma_wakeup_interrupts(&board->vdma, &board->vdma.vdma_engines[DEFAULT_VDMA_ENGINE_INDEX], +- 0xFFFFFFFF); +- } +- +- if (0 != irq_source.vdma_channels_bitmap) { +- hailo_vdma_irq_handler(&board->vdma, DEFAULT_VDMA_ENGINE_INDEX, +- irq_source.vdma_channels_bitmap); ++ if (0 != irq_source.vdma_channels_bitmap) { ++ hailo_vdma_irq_handler(&board->vdma, DEFAULT_VDMA_ENGINE_INDEX, ++ irq_source.vdma_channels_bitmap); ++ } + } + } + +--- a/drivers/media/pci/hailo/src/nnc.c ++++ b/drivers/media/pci/hailo/src/nnc.c +@@ -148,8 +148,8 @@ static long hailo_read_notification_ioct + + // Check if was disabled + if (current_waiting_thread->is_disabled) { +- hailo_info(board, "HAILO_READ_NOTIFICATION, can't find notification wait for tgid=%d\n", current->tgid); +- err = -EINVAL; ++ hailo_info(board, "HAILO_READ_NOTIFICATION - notification disabled for tgid=%d\n", current->tgid); ++ err = -ECANCELED; + goto l_exit; + } + +--- a/drivers/media/pci/hailo/src/pcie.c ++++ b/drivers/media/pci/hailo/src/pcie.c +@@ -13,6 +13,7 @@ + #include + #include + #include ++#include + + #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0) + #include +@@ -29,6 +30,7 @@ + #include "utils/logs.h" + #include "utils/compact.h" + #include "vdma/vdma.h" ++#include "vdma/memory.h" + + #if LINUX_VERSION_CODE < KERNEL_VERSION( 5, 4, 0 ) + #include +@@ -46,8 +48,9 @@ enum hailo_allocate_driver_buffer_driver + static int force_desc_page_size = 0; + static bool g_is_power_mode_enabled = true; + static int force_allocation_from_driver = HAILO_NO_FORCE_BUFFER; +-static bool force_hailo15_legacy_mode = false; ++static bool force_hailo10h_legacy_mode = false; + static bool force_boot_linux_from_eemc = false; ++static bool support_soft_reset = true; + + #define DEVICE_NODE_NAME "hailo" + static int char_major = 0; +@@ -291,12 +294,468 @@ static void hailo_pcie_remove_board(stru + up(&g_hailo_add_board_mutex); + } + +-static bool wait_for_firmware_completion(struct completion *fw_load_completion) ++/** ++ * Wait until the relevant completion is done. ++ * ++ * @param completion - pointer to the completion struct to wait for. ++ * @param msecs - the amount of time to wait in milliseconds. ++ * @return false if timed out, true if completed. ++ */ ++static bool wait_for_firmware_completion(struct completion *completion, unsigned int msecs) ++{ ++ return (0 != wait_for_completion_timeout(completion, msecs_to_jiffies(msecs))); ++} ++ ++/** ++ * Program one FW file descriptors to the vDMA engine. ++ * ++ * @param dev - pointer to the device struct we are working on. ++ * @param boot_dma_state - pointer to the boot dma state struct which includes all of the boot resources. ++ * @param file_address - the address of the file in the device memory. ++ * @param transfer_buffer - the buffer to program to the vDMA engine. ++ * @param channel_index - the index of the channel to program. ++ * @param filename - the name of the file to program. ++ * @param raise_int_on_completion - true if this is the last descriptors chunk in the specific channel in the boot flow, false otherwise. If true - will enable ++ * an IRQ for the relevant channel when the transfer is finished. ++ * @return the amount of descriptors programmed on success, negative error code on failure. ++ */ ++static int pcie_vdma_program_one_file_descriptors(struct device *dev, struct hailo_pcie_boot_dma_channel_state *boot_channel_state, ++ u32 file_address, struct hailo_vdma_mapped_transfer_buffer transfer_buffer, u8 channel_index, const char *filename, bool raise_int_on_completion) ++{ ++ int device_desc = 0, host_desc = 0; ++ enum hailo_vdma_interrupts_domain interrupts_domain = raise_int_on_completion ? HAILO_VDMA_INTERRUPTS_DOMAIN_HOST : ++ HAILO_VDMA_INTERRUPTS_DOMAIN_NONE; ++ ++ hailo_dev_dbg(dev, "channel_index = %d, file_name = %s, file_address = 0x%x, transfer_buffer.offset = 0x%x,\ ++ size_to_program = 0x%x, starting_desc/desc_index = 0x%x\n", channel_index, filename, file_address, ++ transfer_buffer.offset, transfer_buffer.size, boot_channel_state->desc_program_num); ++ ++ // program descriptors ++ device_desc = hailo_vdma_program_descriptors_in_chunk(&hailo_pcie_vdma_hw, file_address, transfer_buffer.size, ++ &boot_channel_state->device_descriptors_buffer.desc_list, boot_channel_state->desc_program_num, ++ (boot_channel_state->device_descriptors_buffer.desc_list.desc_count - 1), channel_index, HAILO_PCI_EP_HOST_DMA_DATA_ID); ++ if (device_desc < 0) { ++ hailo_dev_err(dev, "Failed to program device descriptors, error = %u\n", device_desc); ++ return device_desc; ++ } ++ ++ host_desc = hailo_vdma_program_descriptors_list(&hailo_pcie_vdma_hw, &boot_channel_state->host_descriptors_buffer.desc_list, ++ boot_channel_state->desc_program_num, &transfer_buffer, true, channel_index, interrupts_domain, false); ++ if (host_desc < 0) { ++ hailo_dev_err(dev, "Failed to program host descriptors, error = %u\n", host_desc); ++ return host_desc; ++ } ++ ++ // checks that same amount of decsriptors were programmed on device side and host side ++ if (host_desc != device_desc) { ++ hailo_dev_err(dev, "Host and device descriptors should be the same\n"); ++ return -EINVAL; ++ } ++ ++ return host_desc; ++} ++ ++/** ++ * Program one FW file to the vDMA engine. ++ * ++ * @param board - pointer to the board struct we are working on. ++ * @param boot_dma_state - pointer to the boot dma state struct which includes all of the boot resources. ++ * @param file_address - the address of the file in the device memory. ++ * @param filename - the name of the file to program. ++ * @param raise_int_on_completion - true if this is the last file in the boot flow, false otherwise. uses to enable an IRQ for the ++ * relevant channel when the transfer is finished. ++ * @return 0 on success, negative error code on failure. at the end of the function the firmware is released. ++ */ ++static int pcie_vdma_program_one_file(struct hailo_pcie_board *board, struct hailo_pcie_boot_dma_state *boot_dma_state, u32 file_address, ++ const char *filename, bool raise_int_on_completion) ++{ ++ const struct firmware *firmware = NULL; ++ struct hailo_vdma_mapped_transfer_buffer transfer_buffer = {0}; ++ int desc_programmed = 0; ++ int err = 0; ++ size_t bytes_copied = 0, remaining_size = 0, data_offset = 0, desc_num_left = 0, current_desc_to_program = 0; ++ ++ hailo_notice(board, "Programing file %s for dma transfer\n", filename); ++ ++ // load firmware directly without usermode helper for the relevant file ++ err = request_firmware_direct(&firmware, filename, board->vdma.dev); ++ if (err < 0) { ++ hailo_err(board, "Failed to allocate memory for file %s\n", filename); ++ return err; ++ } ++ ++ // set the remaining size as the whole file size to begin with ++ remaining_size = firmware->size; ++ ++ while (remaining_size > 0) { ++ struct hailo_pcie_boot_dma_channel_state *channel = &boot_dma_state->channels[boot_dma_state->curr_channel_index]; ++ bool is_last_desc_chunk_of_curr_channel = false; ++ bool rais_interrupt_on_last_chunk = false; ++ ++ hailo_dbg(board, "desc_program_num = 0x%x, desc_page_size = 0x%x, on channel = %d\n", ++ channel->desc_program_num, HAILO_PCI_OVER_VDMA_PAGE_SIZE, boot_dma_state->curr_channel_index); ++ ++ // increment the channel index if the current channel is full ++ if ((MAX_SG_DESCS_COUNT - 1) == channel->desc_program_num) { ++ boot_dma_state->curr_channel_index++; ++ channel = &boot_dma_state->channels[boot_dma_state->curr_channel_index]; ++ board->fw_boot.boot_used_channel_bitmap |= (1 << boot_dma_state->curr_channel_index); ++ } ++ ++ // calculate the number of descriptors left to program and the number of bytes left to program ++ desc_num_left = (MAX_SG_DESCS_COUNT - 1) - channel->desc_program_num; ++ ++ // prepare the transfer buffer to make sure all the fields are initialized ++ transfer_buffer.sg_table = &channel->sg_table; ++ transfer_buffer.size = min(remaining_size, (desc_num_left * HAILO_PCI_OVER_VDMA_PAGE_SIZE)); ++ // no need to check for overflow since the variables are constant and always desc_program_num <= max u16 (65536) ++ // & the buffer max size is 256 Mb << 4G (max u32) ++ transfer_buffer.offset = (channel->desc_program_num * HAILO_PCI_OVER_VDMA_PAGE_SIZE); ++ ++ // check if this is the last descriptor chunk to program in the whole boot flow ++ current_desc_to_program = (transfer_buffer.size / HAILO_PCI_OVER_VDMA_PAGE_SIZE); ++ is_last_desc_chunk_of_curr_channel = ((MAX_SG_DESCS_COUNT - 1) == ++ (current_desc_to_program + channel->desc_program_num)); ++ rais_interrupt_on_last_chunk = (is_last_desc_chunk_of_curr_channel || (raise_int_on_completion && ++ (remaining_size == transfer_buffer.size))); ++ ++ // try to copy the file to the buffer, if failed, release the firmware and return ++ bytes_copied = sg_pcopy_from_buffer(transfer_buffer.sg_table->sgl, transfer_buffer.sg_table->orig_nents, ++ &firmware->data[data_offset], transfer_buffer.size, transfer_buffer.offset); ++ if (transfer_buffer.size != bytes_copied) { ++ hailo_err(board, "There is not enough memory allocated to copy file %s\n", filename); ++ release_firmware(firmware); ++ return -EFBIG; ++ } ++ ++ // program the descriptors ++ desc_programmed = pcie_vdma_program_one_file_descriptors(&board->pDev->dev, channel, (file_address + data_offset), ++ transfer_buffer, boot_dma_state->curr_channel_index, filename, rais_interrupt_on_last_chunk); ++ if (desc_programmed < 0) { ++ hailo_err(board, "Failed to program descriptors for file %s, on cahnnel = %d\n", filename, ++ boot_dma_state->curr_channel_index); ++ release_firmware(firmware); ++ return desc_programmed; ++ } ++ ++ // Update remaining size, data_offset and desc_program_num for the next iteration ++ remaining_size -= transfer_buffer.size; ++ data_offset += transfer_buffer.size; ++ channel->desc_program_num += desc_programmed; ++ } ++ ++ hailo_notice(board, "File %s programed successfully\n", filename); ++ ++ release_firmware(firmware); ++ ++ return desc_programmed; ++} ++ ++/** ++ * Program the entire batch of firmware files to the vDMA engine. ++ * ++ * @param board - pointer to the board struct we are working on. ++ * @param boot_dma_state - pointer to the boot dma state struct which includes all of the boot resources. ++ * @param resources - pointer to the hailo_pcie_resources struct. ++ * @param stage - the stage to program. ++ * @return 0 on success, negative error code on failure. ++ */ ++static long pcie_vdma_program_entire_batch(struct hailo_pcie_board *board, struct hailo_pcie_boot_dma_state *boot_dma_state, ++ struct hailo_pcie_resources *resources, u32 stage) ++{ ++ long err = 0; ++ int file_index = 0; ++ const struct hailo_pcie_loading_stage *stage_info = hailo_pcie_get_loading_stage_info(resources->board_type, stage); ++ const struct hailo_file_batch *files_batch = stage_info->batch; ++ const u8 amount_of_files = stage_info->amount_of_files_in_stage; ++ const char *filename = NULL; ++ u32 file_address = 0; ++ ++ for (file_index = 0; file_index < amount_of_files; file_index++) ++ { ++ filename = files_batch[file_index].filename; ++ file_address = files_batch[file_index].address; ++ ++ if (NULL == filename) { ++ hailo_err(board, "The amount of files wasn't specified for stage %d\n", stage); ++ break; ++ } ++ ++ err = pcie_vdma_program_one_file(board, boot_dma_state, file_address, filename, ++ (file_index == (amount_of_files - 1))); ++ if (err < 0) { ++ hailo_err(board, "Failed to program file %s\n", filename); ++ return err; ++ } ++ } ++ ++ return 0; ++} ++ ++/** ++ * Release noncontinuous memory (virtual continuous memory). (sg table and kernel_addrs) ++ * ++ * @param dev - pointer to the device struct we are working on. ++ * @param sg_table - the sg table to release. ++ * @param kernel_addrs - the kernel address to release. ++ */ ++static void pcie_vdma_release_noncontinuous_memory(struct device *dev, struct sg_table *sg_table, void *kernel_addrs) ++{ ++ dma_unmap_sg(dev, sg_table->sgl, sg_table->orig_nents, DMA_TO_DEVICE); ++ sg_free_table(sg_table); ++ vfree(kernel_addrs); ++} ++ ++/** ++ * Allocate noncontinuous memory (virtual continuous memory). ++ * ++ * @param dev - pointer to the device struct we are working on. ++ * @param buffer_size - the size of the buffer to allocate. ++ * @param kernel_addrs - pointer to the allocated buffer. ++ * @param sg_table - pointer to the sg table struct. ++ * @return 0 on success, negative error code on failure. on failure all resurces are released. (pages array, sg table, kernel_addrs) ++ */ ++static long pcie_vdma_allocate_noncontinuous_memory(struct device *dev, u64 buffer_size, void **kernel_addrs, struct sg_table *sg_table) ++{ ++ struct page **pages = NULL; ++ size_t npages = 0; ++ struct scatterlist *sgl = NULL; ++ long err = 0; ++ size_t i = 0; ++ ++ // allocate noncontinuous memory for the kernel address (virtual continuous memory) ++ *kernel_addrs = vmalloc(buffer_size); ++ if (NULL == *kernel_addrs) { ++ hailo_dev_err(dev, "Failed to allocate memory for kernel_addrs\n"); ++ err = -ENOMEM; ++ goto exit; ++ } ++ ++ // map the memory to pages ++ npages = DIV_ROUND_UP(buffer_size, PAGE_SIZE); ++ ++ // allocate memory for a virtually contiguous array for the pages ++ pages = kvmalloc_array(npages, sizeof(*pages), GFP_KERNEL); ++ if (!pages) { ++ err = -ENOMEM; ++ hailo_dev_err(dev, "Failed to allocate memory for pages\n"); ++ goto release_user_addrs; ++ } ++ ++ // walk a vmap address to the struct page it maps ++ for (i = 0; i < npages; i++) { ++ pages[i] = vmalloc_to_page(*kernel_addrs + (i * PAGE_SIZE)); ++ if (!pages[i]) { ++ err = -ENOMEM; ++ hailo_dev_err(dev, "Failed to get page from vmap address\n"); ++ goto release_array; ++ } ++ } ++ ++ // allocate and initialize the sg table from a list of pages ++ sgl = sg_alloc_table_from_pages_segment_compat(sg_table, pages, npages, 0, buffer_size, SGL_MAX_SEGMENT_SIZE, NULL, ++ 0, GFP_KERNEL); ++ if (IS_ERR(sgl)) { ++ err = PTR_ERR(sgl); ++ hailo_dev_err(dev, "sg table alloc failed (err %ld)..\n", err); ++ goto release_array; ++ } ++ ++ // map the sg list ++ sg_table->nents = dma_map_sg(dev, sg_table->sgl, sg_table->orig_nents, DMA_TO_DEVICE); ++ if (0 == sg_table->nents) { ++ hailo_dev_err(dev, "failed to map sg list for user buffer\n"); ++ err = -ENXIO; ++ goto release_sg_table; ++ } ++ ++ // clean exit - just release the pages array & return err = 0 ++ err = 0; ++ kfree(pages); ++ goto exit; ++ ++release_sg_table: ++ dma_unmap_sg(dev, sg_table->sgl, sg_table->orig_nents, DMA_TO_DEVICE); ++release_array: ++ kfree(pages); ++release_user_addrs: ++ vfree(*kernel_addrs); ++exit: ++ return err; ++} ++ ++/** ++ * Release all boot resources. ++ * ++ * @param board - pointer to the board struct we are working on. ++ * @param engine - pointer to the vdma engine struct. ++ * @param boot_dma_state - pointer to the boot dma state struct which includes all of the boot resources. ++ */ ++static void pcie_vdme_release_boot_resources(struct hailo_pcie_board *board, struct hailo_vdma_engine *engine, ++ struct hailo_pcie_boot_dma_state *boot_dma_state) ++{ ++ u8 channel_index = 0; ++ ++ // release all the resources ++ for (channel_index = 0; channel_index < HAILO_PCI_OVER_VDMA_NUM_CHANNELS; channel_index++) { ++ struct hailo_pcie_boot_dma_channel_state *channel = &boot_dma_state->channels[channel_index]; ++ // release descriptor lists ++ if (channel->host_descriptors_buffer.kernel_address != NULL) { ++ hailo_desc_list_release(&board->pDev->dev, &channel->host_descriptors_buffer); ++ } ++ if (channel->device_descriptors_buffer.kernel_address != NULL) { ++ hailo_desc_list_release(&board->pDev->dev, &channel->device_descriptors_buffer); ++ } ++ ++ // stops all boot vDMA channels ++ hailo_vdma_stop_channel(engine->channels[channel_index].host_regs); ++ hailo_vdma_stop_channel(engine->channels[channel_index].device_regs); ++ ++ // release noncontinuous memory (virtual continuous memory) ++ if (channel->kernel_addrs != NULL) { ++ pcie_vdma_release_noncontinuous_memory(&board->pDev->dev, &channel->sg_table, channel->kernel_addrs); ++ } ++ } ++} ++ ++/** ++ * Allocate boot resources for vDMA transfer. ++ * ++ * @param desc_page_size - the size of the descriptor page. ++ * @param board - pointer to the board struct we are working on. ++ * @param boot_dma_state - pointer to the boot dma state struct which includes all of the boot resources. ++ * @param engine - pointer to the vDMA engine struct. ++ * @return 0 on success, negative error code on failure. in case of failure descriptor lists are released, ++ * boot vDMA channels are stopped and memory is released. ++ */ ++static long pcie_vdme_allocate_boot_resources(u32 desc_page_size, struct hailo_pcie_board *board, ++ struct hailo_pcie_boot_dma_state *boot_dma_state, struct hailo_vdma_engine *engine) ++{ ++ long err = 0; ++ uintptr_t device_handle = 0, host_handle = 0; ++ u8 channel_index = 0; ++ ++ for (channel_index = 0; channel_index < HAILO_PCI_OVER_VDMA_NUM_CHANNELS; channel_index++) { ++ struct hailo_pcie_boot_dma_channel_state *channel = &boot_dma_state->channels[channel_index]; ++ ++ // create 2 descriptors list - 1 for the host & 1 for the device for each channel ++ err = hailo_desc_list_create(&board->pDev->dev, MAX_SG_DESCS_COUNT, desc_page_size, host_handle, false, ++ &channel->host_descriptors_buffer); ++ if (err < 0) { ++ hailo_err(board, "failed to allocate host descriptors list buffer\n"); ++ goto release_all_resources; ++ } ++ ++ err = hailo_desc_list_create(&board->pDev->dev, MAX_SG_DESCS_COUNT, desc_page_size, device_handle, false, ++ &channel->device_descriptors_buffer); ++ if (err < 0) { ++ hailo_err(board, "failed to allocate device descriptors list buffer\n"); ++ goto release_all_resources; ++ } ++ ++ // start vDMA channels - both sides with DDR at the host side (AKA ID 0) ++ err = hailo_vdma_start_channel(engine->channels[channel_index].host_regs, ++ channel->host_descriptors_buffer.dma_address, ++ channel->host_descriptors_buffer.desc_list.desc_count, board->vdma.hw->ddr_data_id); ++ if (err < 0) { ++ hailo_err(board, "Error starting host vdma channel\n"); ++ goto release_all_resources; ++ } ++ ++ err = hailo_vdma_start_channel(engine->channels[channel_index].device_regs, ++ channel->device_descriptors_buffer.dma_address, ++ channel->device_descriptors_buffer.desc_list.desc_count, board->vdma.hw->ddr_data_id); ++ if (err < 0) { ++ hailo_err(board, "Error starting device vdma channel\n"); ++ goto release_all_resources; ++ } ++ ++ // initialize the buffer size per channel ++ channel->buffer_size = (MAX_SG_DESCS_COUNT * desc_page_size); ++ ++ // allocate noncontinuous memory (virtual continuous memory) ++ err = pcie_vdma_allocate_noncontinuous_memory(&board->pDev->dev, channel->buffer_size, &channel->kernel_addrs, ++ &channel->sg_table); ++ if (err < 0) { ++ hailo_err(board, "Failed to allocate noncontinuous memory\n"); ++ goto release_all_resources; ++ } ++ } ++ ++ return 0; ++ ++release_all_resources: ++ pcie_vdme_release_boot_resources(board, engine, boot_dma_state); ++ return err; ++} ++ ++/** ++ * Write FW boot files over vDMA using multiple channels for timing optimizations. ++ * ++ * The function is divided into the following steps: ++ * 1) Allocate resources for the boot process. ++ * 2) Programs descriptors to point to the memory and start the vDMA. ++ * 3) Waits until the vDMA is done and triggers the device to start the boot process. ++ * 4) Releases all the resources. ++ * ++ * @param board - pointer to the board struct. ++ * @param stage - the stage of the boot process. ++ * @param desc_page_size - the size of the descriptor page. ++ * @return 0 on success, negative error code on failure. in any case all resurces are released. ++ */ ++static long pcie_write_firmware_batch_over_dma(struct hailo_pcie_board *board, u32 stage, u32 desc_page_size) + { +- return (0 != wait_for_completion_timeout(fw_load_completion, msecs_to_jiffies(FIRMWARE_WAIT_TIMEOUT_MS))); ++ long err = 0; ++ struct hailo_vdma_engine *engine = &board->vdma.vdma_engines[PCI_VDMA_ENGINE_INDEX]; ++ u8 channel_index = 0; ++ ++ err = pcie_vdme_allocate_boot_resources(desc_page_size, board, &board->fw_boot.boot_dma_state, engine); ++ if (err < 0) { ++ hailo_err(board, "Failed to create descriptors and start channels\n"); ++ return err; ++ } ++ ++ // initialize the completion for the vDMA boot data completion ++ reinit_completion(&board->fw_boot.vdma_boot_completion); ++ ++ err = pcie_vdma_program_entire_batch(board, &board->fw_boot.boot_dma_state, &board->pcie_resources, stage); ++ if (err < 0) { ++ hailo_err(board, "Failed to program entire batch\n"); ++ goto release_all; ++ } ++ ++ // sync the sg tables for the device before statirng the vDMA ++ for (channel_index = 0; channel_index < HAILO_PCI_OVER_VDMA_NUM_CHANNELS; channel_index++) { ++ dma_sync_sgtable_for_device(&board->pDev->dev, &board->fw_boot.boot_dma_state.channels[channel_index].sg_table, ++ DMA_TO_DEVICE); ++ } ++ ++ // start the vDMA transfer on all channels ++ for (channel_index = 0; channel_index < HAILO_PCI_OVER_VDMA_NUM_CHANNELS; channel_index++) { ++ struct hailo_pcie_boot_dma_channel_state *channel = &board->fw_boot.boot_dma_state.channels[channel_index]; ++ if (channel->desc_program_num != 0) { ++ hailo_vdma_set_num_avail(engine->channels[channel_index].host_regs, channel->desc_program_num); ++ hailo_vdma_set_num_avail(engine->channels[channel_index].device_regs, channel->desc_program_num); ++ hailo_dbg(board, "Set num avail to %u, on channel %u\n", channel->desc_program_num, channel_index); ++ } ++ } ++ ++ if (!wait_for_firmware_completion(&board->fw_boot.vdma_boot_completion, hailo_pcie_get_loading_stage_info(board->pcie_resources.board_type, SECOND_STAGE)->timeout)) { ++ hailo_err(board, "Timeout waiting for vDMA boot data completion\n"); ++ err = -ETIMEDOUT; ++ goto release_all; ++ } ++ ++ hailo_notice(board, "vDMA transfer completed, triggering boot\n"); ++ reinit_completion(&board->fw_boot.fw_loaded_completion); ++ hailo_trigger_firmware_boot(&board->pcie_resources, stage); ++ ++release_all: ++ pcie_vdme_release_boot_resources(board, engine, &board->fw_boot.boot_dma_state); ++ return err; + } + +-static int hailo_load_soc_firmware(struct hailo_pcie_resources *resources, ++static int load_soc_firmware(struct hailo_pcie_board *board, struct hailo_pcie_resources *resources, + struct device *dev, struct completion *fw_load_completion) + { + u32 boot_status = 0; +@@ -304,104 +763,165 @@ static int hailo_load_soc_firmware(struc + u32 second_stage = force_boot_linux_from_eemc ? SECOND_STAGE_LINUX_IN_EMMC : SECOND_STAGE; + + if (hailo_pcie_is_firmware_loaded(resources)) { +- hailo_dev_warn(dev, "Firmware batch was already loaded\n"); ++ hailo_dev_warn(dev, "SOC Firmware batch was already loaded\n"); + return 0; + } + ++ // configure the EP registers for the DMA transaction ++ hailo_pcie_configure_ep_registers_for_dma_transaction(resources); ++ + init_completion(fw_load_completion); ++ init_completion(&board->fw_boot.vdma_boot_completion); + + err = hailo_pcie_write_firmware_batch(dev, resources, FIRST_STAGE); + if (err < 0) { +- hailo_dev_err(dev, "Failed writing firmware files. err %d\n", err); ++ hailo_dev_err(dev, "Failed writing SOC FIRST_STAGE firmware files. err %d\n", err); + return err; + } + +- if (!wait_for_firmware_completion(fw_load_completion)) { ++ if (!wait_for_firmware_completion(fw_load_completion, hailo_pcie_get_loading_stage_info(resources->board_type, FIRST_STAGE)->timeout)) { + boot_status = hailo_get_boot_status(resources); +- hailo_dev_err(dev, "Timeout waiting for firmware file, boot status %u\n", boot_status); ++ hailo_dev_err(dev, "Timeout waiting for SOC FIRST_STAGE firmware file, boot status %u\n", boot_status); + return -ETIMEDOUT; + } +- reinit_completion(fw_load_completion); + +- err = hailo_pcie_write_firmware_batch(dev, resources, second_stage); ++ reinit_completion(fw_load_completion); ++ ++ err = (int)pcie_write_firmware_batch_over_dma(board, second_stage, HAILO_PCI_OVER_VDMA_PAGE_SIZE); + if (err < 0) { +- hailo_dev_err(dev, "Failed writing firmware files. err %d\n", err); ++ hailo_dev_err(dev, "Failed writing SOC SECOND_STAGE firmware files over vDMA. err %d\n", err); + return err; + } + +- if (!wait_for_firmware_completion(fw_load_completion)) { ++ if (!wait_for_firmware_completion(fw_load_completion, hailo_pcie_get_loading_stage_info(resources->board_type, SECOND_STAGE)->timeout)) { + boot_status = hailo_get_boot_status(resources); +- hailo_dev_err(dev, "Timeout waiting for firmware file, boot status %u\n", boot_status); ++ hailo_dev_err(dev, "Timeout waiting for SOC SECOND_STAGE firmware file, boot status %u\n", boot_status); + return -ETIMEDOUT; + } + +- hailo_dev_notice(dev, "Firmware Batch loaded successfully\n"); ++ reinit_completion(fw_load_completion); ++ reinit_completion(&board->fw_boot.vdma_boot_completion); ++ ++ hailo_dev_notice(dev, "SOC Firmware Batch loaded successfully\n"); + + return 0; + } +- +-static int hailo_load_nnc_firmware(struct hailo_pcie_resources *resources, +- struct device *dev, struct completion *fw_load_completion) ++static int load_nnc_firmware(struct hailo_pcie_board *board) + { + u32 boot_status = 0; + int err = 0; ++ struct device *dev = &board->pDev->dev; + +- if (hailo_pcie_is_firmware_loaded(resources)) { +- hailo_dev_warn(dev, "Firmware batch was already loaded\n"); +- return 0; ++ if (hailo_pcie_is_firmware_loaded(&board->pcie_resources)) { ++ if (support_soft_reset) { ++ err = hailo_pcie_soft_reset(&board->pcie_resources, &board->soft_reset.reset_completed); // send control, wait for done ++ if (err < 0) { ++ hailo_dev_err(dev, "Failed hailo pcie soft reset. err %d\n", err); ++ return 0; ++ } ++ hailo_dev_notice(dev, "Soft reset done\n"); ++ } else { ++ hailo_dev_warn(dev, "NNC Firmware batch was already loaded\n"); ++ return 0; ++ } + } + +- init_completion(fw_load_completion); ++ init_completion(&board->fw_boot.fw_loaded_completion); + +- err = hailo_pcie_write_firmware_batch(dev, resources, FIRST_STAGE); ++ err = hailo_pcie_write_firmware_batch(dev, &board->pcie_resources, FIRST_STAGE); + if (err < 0) { +- hailo_dev_err(dev, "Failed writing firmware files. err %d\n", err); ++ hailo_dev_err(dev, "Failed writing NNC firmware files. err %d\n", err); + return err; + } + +- if (!wait_for_firmware_completion(fw_load_completion)) { +- boot_status = hailo_get_boot_status(resources); +- hailo_dev_err(dev, "Timeout waiting for firmware file, boot status %u\n", boot_status); ++ if (!wait_for_firmware_completion(&board->fw_boot.fw_loaded_completion, hailo_pcie_get_loading_stage_info(board->pcie_resources.board_type, FIRST_STAGE)->timeout)) { ++ boot_status = hailo_get_boot_status(&board->pcie_resources); ++ hailo_dev_err(dev, "Timeout waiting for NNC firmware file, boot status %u\n", boot_status); + return -ETIMEDOUT; + } + +- hailo_dev_notice(dev, "Firmware loaded successfully\n"); ++ hailo_dev_notice(dev, "NNC Firmware loaded successfully\n"); + + return 0; + } + +-static int hailo_activate_board(struct hailo_pcie_board *board) ++int hailo_pcie_soft_reset(struct hailo_pcie_resources *resources, struct completion *reset_completed) + { ++ bool completion_result = false; + int err = 0; + +- (void)hailo_pcie_disable_aspm(board, PCIE_LINK_STATE_L0S, false); ++ hailo_pcie_write_firmware_soft_reset(resources); + +- err = hailo_enable_interrupts(board); +- if (err < 0) { +- hailo_err(board, "Failed Enabling interrupts %d\n", err); ++ reinit_completion(reset_completed); ++ ++ // Wait for response ++ completion_result = ++ wait_for_firmware_completion(reset_completed, msecs_to_jiffies(FIRMWARE_WAIT_TIMEOUT_MS)); ++ if (completion_result == false) { ++ pr_warn("hailo reset firmware, timeout waiting for shutdown response (timeout_ms=%d)\n", FIRMWARE_WAIT_TIMEOUT_MS); ++ err = -ETIMEDOUT; + return err; + } + ++ msleep(TIME_UNTIL_REACH_BOOTLOADER); ++ pr_notice("hailo_driver_down finished\n"); ++ ++ return err; ++} ++ ++static int load_firmware(struct hailo_pcie_board *board) ++{ + switch (board->pcie_resources.accelerator_type) { + case HAILO_ACCELERATOR_TYPE_SOC: +- err = hailo_load_soc_firmware(&board->pcie_resources, &board->pDev->dev, +- &board->fw_loaded_completion); +- break; ++ return load_soc_firmware(board, &board->pcie_resources, &board->pDev->dev, &board->fw_boot.fw_loaded_completion); + case HAILO_ACCELERATOR_TYPE_NNC: +- err = hailo_load_nnc_firmware(&board->pcie_resources, &board->pDev->dev, +- &board->fw_loaded_completion); +- break; ++ return load_nnc_firmware(board); + default: +- hailo_err(board, "Invalid board type"); +- err = -EINVAL; ++ hailo_err(board, "Invalid board type %d\n", board->pcie_resources.accelerator_type); ++ return -EINVAL; + } ++} ++ ++static int enable_boot_interrupts(struct hailo_pcie_board *board) ++{ ++ int err = hailo_enable_interrupts(board); + if (err < 0) { +- hailo_err(board, "Firmware load failed\n"); +- hailo_disable_interrupts(board); ++ hailo_err(board, "Failed enabling interrupts %d\n", err); + return err; + } + ++ board->fw_boot.is_in_boot = true; ++ return 0; ++} ++ ++static void disable_boot_interrupts(struct hailo_pcie_board *board) ++{ ++ board->fw_boot.is_in_boot = false; + hailo_disable_interrupts(board); ++} ++ ++static int hailo_activate_board(struct hailo_pcie_board *board) ++{ ++ int err = 0; ++ ktime_t start_time = 0, end_time = 0; ++ ++ (void)hailo_pcie_disable_aspm(board, PCIE_LINK_STATE_L0S, false); ++ ++ err = enable_boot_interrupts(board); ++ if (err < 0) { ++ return err; ++ } ++ ++ start_time = ktime_get(); ++ err = load_firmware(board); ++ end_time = ktime_get(); ++ hailo_notice(board, "FW loaded, took %lld ms\n", ktime_to_ms(ktime_sub(end_time, start_time))); ++ disable_boot_interrupts(board); ++ ++ if (err < 0) { ++ hailo_err(board, "Firmware load failed\n"); ++ return err; ++ } + + if (power_mode_enabled()) { + // Setting the device to low power state, until the user opens the device +@@ -520,12 +1040,9 @@ static int pcie_resources_init(struct pc + } + + +- // There is no HAILO15 as mercury through pcie unless it's legacy mode (H15 as accelerator) or HAILO-10H +- if (HAILO_BOARD_TYPE_HAILO15 == board_type){ +- if (true == force_hailo15_legacy_mode) { ++ if (HAILO_BOARD_TYPE_HAILO10H == board_type){ ++ if (true == force_hailo10h_legacy_mode) { + board_type = HAILO_BOARD_TYPE_HAILO10H_LEGACY; +- } else { +- board_type = HAILO_BOARD_TYPE_HAILO10H; + } + } + +@@ -696,7 +1213,8 @@ static int hailo_pcie_probe(struct pci_d + } + + pBoard->interrupts_enabled = false; +- init_completion(&pBoard->fw_loaded_completion); ++ pBoard->fw_boot.is_in_boot = false; ++ init_completion(&pBoard->fw_boot.fw_loaded_completion); + + sema_init(&pBoard->mutex, 1); + atomic_set(&pBoard->ref_count, 0); +@@ -707,6 +1225,7 @@ static int hailo_pcie_probe(struct pci_d + hailo_soc_init(&pBoard->soc); + + init_completion(&pBoard->driver_down.reset_completed); ++ init_completion(&pBoard->soft_reset.reset_completed); + + memset(&pBoard->memory_transfer_params, 0, sizeof(pBoard->memory_transfer_params)); + +@@ -724,6 +1243,10 @@ static int hailo_pcie_probe(struct pci_d + goto probe_release_pcie_resources; + } + ++ // Initialize the boot channel bitmap to 1 since channel 0 is always used for boot ++ // (we will always use at least 1 channel which is LSB in the bitmap) ++ pBoard->fw_boot.boot_used_channel_bitmap = (1 << 0); ++ memset(&pBoard->fw_boot.boot_dma_state, 0, sizeof(pBoard->fw_boot.boot_dma_state)); + err = hailo_activate_board(pBoard); + if (err < 0) { + hailo_err(pBoard, "Failed activating board %d\n", err); +@@ -927,8 +1450,8 @@ static const struct pci_error_handlers h + static struct pci_device_id hailo_pcie_id_table[] = + { + {PCI_DEVICE_DATA(HAILO, HAILO8, HAILO_BOARD_TYPE_HAILO8)}, +- {PCI_DEVICE_DATA(HAILO, HAILO15, HAILO_BOARD_TYPE_HAILO15)}, +- {PCI_DEVICE_DATA(HAILO, PLUTO, HAILO_BOARD_TYPE_PLUTO)}, ++ {PCI_DEVICE_DATA(HAILO, HAILO10H, HAILO_BOARD_TYPE_HAILO10H)}, ++ {PCI_DEVICE_DATA(HAILO, HAILO15L, HAILO_BOARD_TYPE_HAILO15L)}, + {0,0,0,0,0,0,0 }, + }; + +@@ -1024,12 +1547,15 @@ MODULE_PARM_DESC(force_allocation_from_d + module_param(force_desc_page_size, int, S_IRUGO); + MODULE_PARM_DESC(force_desc_page_size, "Determines the maximum DMA descriptor page size (must be a power of 2)"); + +-module_param(force_hailo15_legacy_mode, bool, S_IRUGO); +-MODULE_PARM_DESC(force_hailo15_legacy_mode, "Forces work with Hailo15 in legacy mode(relevant for emulators)"); ++module_param(force_hailo10h_legacy_mode, bool, S_IRUGO); ++MODULE_PARM_DESC(force_hailo10h_legacy_mode, "Forces work with Hailo10h in legacy mode(relevant for emulators)"); + + module_param(force_boot_linux_from_eemc, bool, S_IRUGO); + MODULE_PARM_DESC(force_boot_linux_from_eemc, "Boot the linux image from eemc (Requires special Image)"); + ++module_param(support_soft_reset, bool, S_IRUGO); ++MODULE_PARM_DESC(support_soft_reset, "enables driver reload to reload a new firmware as well"); ++ + MODULE_AUTHOR("Hailo Technologies Ltd."); + MODULE_DESCRIPTION("Hailo PCIe driver"); + MODULE_LICENSE("GPL v2"); +--- a/drivers/media/pci/hailo/src/pcie.h ++++ b/drivers/media/pci/hailo/src/pcie.h +@@ -19,6 +19,9 @@ + + #include + ++#define HAILO_PCI_OVER_VDMA_NUM_CHANNELS (8) ++#define HAILO_PCI_OVER_VDMA_PAGE_SIZE (512) ++ + struct hailo_fw_control_info { + // protects that only one fw control will be send at a time + struct semaphore mutex; +@@ -33,6 +36,11 @@ struct hailo_pcie_driver_down_info { + struct completion reset_completed; + }; + ++struct hailo_pcie_soft_reset { ++ // called from the interrupt handler to notify that FW completed reset ++ struct completion reset_completed; ++}; ++ + struct hailo_fw_boot { + // the filp that enabled interrupts for fw boot. the interrupt is enabled if this is not null + struct file *filp; +@@ -64,6 +72,32 @@ struct hailo_file_context { + u32 soc_used_channels_bitmap; + }; + ++struct hailo_pcie_boot_dma_channel_state { ++ struct hailo_descriptors_list_buffer host_descriptors_buffer; ++ struct hailo_descriptors_list_buffer device_descriptors_buffer; ++ struct sg_table sg_table; ++ u64 buffer_size; ++ void *kernel_addrs; ++ u32 desc_program_num; ++}; ++ ++struct hailo_pcie_boot_dma_state { ++ struct hailo_pcie_boot_dma_channel_state channels[HAILO_PCI_OVER_VDMA_NUM_CHANNELS]; ++ u8 curr_channel_index; ++}; ++ ++struct hailo_pcie_fw_boot { ++ struct hailo_pcie_boot_dma_state boot_dma_state; ++ // is_in_boot is set to true when the board is in boot mode ++ bool is_in_boot; ++ // boot_used_channel_bitmap is a bitmap of the channels that are used for boot ++ u16 boot_used_channel_bitmap; ++ // fw_loaded_completion is used to notify that the FW was loaded - SOC & NNC ++ struct completion fw_loaded_completion; ++ // vdma_boot_completion is used to notify that the vDMA boot data was transferred completely on all used channels for boot ++ struct completion vdma_boot_completion; ++}; ++ + struct hailo_pcie_board { + struct list_head board_list; + struct pci_dev *pDev; +@@ -74,13 +108,15 @@ struct hailo_pcie_board { + struct hailo_pcie_nnc nnc; + struct hailo_pcie_soc soc; + struct hailo_pcie_driver_down_info driver_down; ++ struct hailo_pcie_soft_reset soft_reset; + struct semaphore mutex; + struct hailo_vdma_controller vdma; + ++ struct hailo_pcie_fw_boot fw_boot; ++ + struct hailo_memory_transfer_params memory_transfer_params; + u32 desc_max_page_size; + enum hailo_allocation_mode allocation_mode; +- struct completion fw_loaded_completion; + bool interrupts_enabled; + }; + +@@ -89,6 +125,7 @@ bool power_mode_enabled(void); + struct hailo_pcie_board* hailo_pcie_get_board_index(u32 index); + void hailo_disable_interrupts(struct hailo_pcie_board *board); + int hailo_enable_interrupts(struct hailo_pcie_board *board); ++int hailo_pcie_soft_reset(struct hailo_pcie_resources *resources, struct completion *reset_completed); + + #endif /* _HAILO_PCI_PCIE_H_ */ + +--- a/drivers/media/pci/hailo/src/soc.c ++++ b/drivers/media/pci/hailo/src/soc.c +@@ -12,12 +12,15 @@ + #include "vdma_common.h" + #include "utils/logs.h" + #include "vdma/memory.h" ++#include "pcie_common.h" + + #include + +-#define PCI_SOC_VDMA_ENGINE_INDEX (0) ++#ifndef HAILO_EMULATOR + #define PCI_SOC_CONTROL_CONNECT_TIMEOUT_MS (1000) +-#define PCI_SOC_INPUT_CHANNEL_BITMASK (0x000000FF) ++#else ++#define PCI_SOC_CONTROL_CONNECT_TIMEOUT_MS (1000000) ++#endif /* ifndef HAILO_EMULATOR */ + + void hailo_soc_init(struct hailo_pcie_soc *soc) + { +@@ -84,10 +87,9 @@ long hailo_soc_connect_ioctl(struct hail + struct hailo_soc_connect_params params; + struct hailo_vdma_channel *input_channel = NULL; + struct hailo_vdma_channel *output_channel = NULL; +- struct hailo_vdma_engine *vdma_engine = &controller->vdma_engines[PCI_SOC_VDMA_ENGINE_INDEX]; ++ struct hailo_vdma_engine *vdma_engine = &controller->vdma_engines[PCI_VDMA_ENGINE_INDEX]; + struct hailo_descriptors_list_buffer *input_descriptors_buffer = NULL; + struct hailo_descriptors_list_buffer *output_descriptors_buffer = NULL; +- uint8_t depth = 0; + int err = 0; + + if (copy_from_user(¶ms, (void *)arg, sizeof(params))) { +@@ -136,9 +138,8 @@ long hailo_soc_connect_ioctl(struct hail + } + + // configure and start input channel +- depth = ceil_log2(input_descriptors_buffer->desc_list.desc_count); + // DMA Direction is only to get channel index - so +- err = hailo_vdma_start_channel(input_channel->host_regs, input_descriptors_buffer->dma_address, depth, ++ err = hailo_vdma_start_channel(input_channel->host_regs, input_descriptors_buffer->dma_address, input_descriptors_buffer->desc_list.desc_count, + board->vdma.hw->ddr_data_id); + if (err < 0) { + hailo_dev_err(&board->pDev->dev, "Error starting vdma input channel index %u\n", params.input_channel_index); +@@ -149,9 +150,8 @@ long hailo_soc_connect_ioctl(struct hail + hailo_set_bit(params.input_channel_index, &context->soc_used_channels_bitmap); + + // configure and start output channel +- depth = ceil_log2(output_descriptors_buffer->desc_list.desc_count); + // DMA Direction is only to get channel index - so +- err = hailo_vdma_start_channel(output_channel->host_regs, output_descriptors_buffer->dma_address, depth, ++ err = hailo_vdma_start_channel(output_channel->host_regs, output_descriptors_buffer->dma_address, output_descriptors_buffer->desc_list.desc_count, + board->vdma.hw->ddr_data_id); + if (err < 0) { + hailo_dev_err(&board->pDev->dev, "Error starting vdma output channel index %u\n", params.output_channel_index); +@@ -175,7 +175,7 @@ static int close_channels(struct hailo_p + { + struct hailo_pcie_soc_request request = {0}; + struct hailo_pcie_soc_response response = {0}; +- struct hailo_vdma_engine *engine = &board->vdma.vdma_engines[PCI_SOC_VDMA_ENGINE_INDEX]; ++ struct hailo_vdma_engine *engine = &board->vdma.vdma_engines[PCI_VDMA_ENGINE_INDEX]; + struct hailo_vdma_channel *channel = NULL; + u8 channel_index = 0; + +--- a/drivers/media/pci/hailo/utils/compact.h ++++ b/drivers/media/pci/hailo/utils/compact.h +@@ -48,6 +48,14 @@ static inline long get_user_pages_compac + } + #endif + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0) ++static inline void dma_sync_sgtable_for_device(struct device *dev, ++ struct sg_table *sgt, enum dma_data_direction dir) ++{ ++ dma_sync_sg_for_device(dev, sgt->sgl, sgt->orig_nents, dir); ++} ++#endif ++ + #ifndef _LINUX_MMAP_LOCK_H + static inline void mmap_read_lock(struct mm_struct *mm) + { +--- a/drivers/media/pci/hailo/vdma/memory.c ++++ b/drivers/media/pci/hailo/vdma/memory.c +@@ -14,10 +14,10 @@ + #include + #include + +- +-#define SGL_MAX_SEGMENT_SIZE (0x10000) + // See linux/mm.h + #define MMIO_AND_NO_PAGES_VMA_MASK (VM_IO | VM_PFNMAP) ++// The linux kernel names the dmabuf's vma vm_file field "dmabuf" ++#define VMA_VM_FILE_DMABUF_NAME ("dmabuf") + + static int map_mmio_address(uintptr_t user_address, u32 size, struct vm_area_struct *vma, + struct sg_table *sgt); +@@ -27,10 +27,16 @@ static void clear_sg_table(struct sg_tab + + #if LINUX_VERSION_CODE >= KERNEL_VERSION( 3, 3, 0 ) + +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) ++#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 13, 0) ++#define DMA_NS_NAME DMA_BUF ++#else ++#define DMA_NS_NAME "DMA_BUF" ++#endif // LINUX_VERSION_CODE < KERNEL_VERSION(6, 13, 0) ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) + // Import DMA_BUF namespace for needed kernels +-MODULE_IMPORT_NS(DMA_BUF); +-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) */ ++MODULE_IMPORT_NS(DMA_NS_NAME); ++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) */ + + static int hailo_map_dmabuf(struct device *dev, int dmabuf_fd, enum dma_data_direction direction, struct sg_table *sgt, + struct hailo_dmabuf_info *dmabuf_info) +@@ -103,6 +109,39 @@ static void hailo_unmap_dmabuf(struct ha + + #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION( 3, 3, 0 ) */ + ++// Function that checks if the vma is backed by a mapped dmabuf ++static bool is_dmabuf_vma(struct vm_area_struct *vma) ++{ ++ return (vma && vma->vm_file && (0 == strcmp(vma->vm_file->f_path.dentry->d_name.name, VMA_VM_FILE_DMABUF_NAME))); ++} ++ ++static int create_fd_from_vma(struct device *dev, struct vm_area_struct *vma) { ++ struct file *file = NULL; ++ int fd = 0; ++ ++ if (!vma || !vma->vm_file) { ++ dev_err(dev, "Invalid VMA or no associated file.\n"); ++ return -EINVAL; ++ } ++ ++ file = vma->vm_file; ++ ++ // This functions increments the ref count of the file ++ get_file(file); ++ ++ // 0 for default flags ++ fd = get_unused_fd_flags(0); ++ if (fd < 0) { ++ dev_err(dev, "Failed to get unused file descriptor.\n"); ++ fput(file); ++ return fd; ++ } ++ ++ // Install the file into the file descriptor table ++ fd_install(fd, file); ++ return fd; ++} ++ + struct hailo_vdma_buffer *hailo_vdma_buffer_map(struct device *dev, + uintptr_t user_address, size_t size, enum dma_data_direction direction, + enum hailo_dma_buffer_type buffer_type, struct hailo_vdma_low_memory_buffer *low_mem_driver_allocated_buffer) +@@ -112,7 +151,8 @@ struct hailo_vdma_buffer *hailo_vdma_buf + struct sg_table sgt = {0}; + struct vm_area_struct *vma = NULL; + bool is_mmio = false; +- struct hailo_dmabuf_info dmabuf_info = {0}; ++ struct hailo_dmabuf_info dmabuf_info = {0}; ++ bool created_dmabuf_fd_from_vma = false; + + mapped_buffer = kzalloc(sizeof(*mapped_buffer), GFP_KERNEL); + if (NULL == mapped_buffer) { +@@ -121,12 +161,27 @@ struct hailo_vdma_buffer *hailo_vdma_buf + goto cleanup; + } + +- if (IS_ENABLED(HAILO_SUPPORT_MMIO_DMA_MAPPING) && (HAILO_DMA_DMABUF_BUFFER != buffer_type)) { ++ if (HAILO_DMA_DMABUF_BUFFER != buffer_type) { + vma = find_vma(current->mm, user_address); +- if (NULL == vma) { +- dev_err(dev, "no vma for virt_addr/size = 0x%08lx/0x%08zx\n", user_address, size); +- ret = -EFAULT; +- goto cleanup; ++ if (IS_ENABLED(HAILO_SUPPORT_MMIO_DMA_MAPPING)) { ++ if (NULL == vma) { ++ dev_err(dev, "no vma for virt_addr/size = 0x%08lx/0x%08zx\n", user_address, size); ++ ret = -EFAULT; ++ goto cleanup; ++ } ++ } ++ ++ if (is_dmabuf_vma(vma)) { ++ dev_dbg(dev, "Given vma is backed by dmabuf - creating fd and mapping as dmabuf\n"); ++ buffer_type = HAILO_DMA_DMABUF_BUFFER; ++ ret = create_fd_from_vma(dev, vma); ++ if (ret < 0) { ++ dev_err(dev, "Failed creating fd from vma in given dmabuf\n"); ++ goto cleanup; ++ } ++ // Override user address with fd to the dmabuf - like normal dmabuf flow ++ user_address = ret; ++ created_dmabuf_fd_from_vma = true; + } + } + +@@ -157,6 +212,11 @@ struct hailo_vdma_buffer *hailo_vdma_buf + dev_err(dev, "Failed mapping dmabuf\n"); + goto cleanup; + } ++ // If created dmabuf fd from vma need to decrement refcount and release fd ++ if (created_dmabuf_fd_from_vma) { ++ fput(vma->vm_file); ++ put_unused_fd(user_address); ++ } + } else { + // user_address is a standard 'struct page' backed memory address + ret = prepare_sg_table(&sgt, user_address, size, low_mem_driver_allocated_buffer); +@@ -331,7 +391,7 @@ int hailo_desc_list_create(struct device + dev_err(dev, "Failed to allocate descriptors list, desc_count 0x%x, buffer_size 0x%zx, This failure means there is not a sufficient amount of CMA memory " + "(contiguous physical memory), This usually is caused by lack of general system memory. Please check you have sufficient memory.\n", + descriptors_count, buffer_size); +- return -ENOMEM; ++ return -ENOBUFS; + } + + descriptors->buffer_size = buffer_size; +@@ -467,7 +527,7 @@ int hailo_vdma_continuous_buffer_alloc(s + if (NULL == kernel_address) { + dev_warn(dev, "Failed to allocate continuous buffer, size 0x%zx. This failure means there is not a sufficient amount of CMA memory " + "(contiguous physical memory), This usually is caused by lack of general system memory. Please check you have sufficent memory.\n", size); +- return -ENOMEM; ++ return -ENOBUFS; + } + + continuous_buffer->kernel_address = kernel_address; +--- a/drivers/media/pci/hailo/vdma/memory.h ++++ b/drivers/media/pci/hailo/vdma/memory.h +@@ -11,6 +11,8 @@ + + #include "vdma/vdma.h" + ++#define SGL_MAX_SEGMENT_SIZE (0x10000) ++ + struct hailo_vdma_buffer *hailo_vdma_buffer_map(struct device *dev, uintptr_t user_address, size_t size, + enum dma_data_direction direction, enum hailo_dma_buffer_type buffer_type, + struct hailo_vdma_low_memory_buffer *low_mem_driver_allocated_buffer); diff --git a/target/linux/bcm27xx/patches-6.6/950-1526-overlays-Regularisation-and-improvements.patch b/target/linux/bcm27xx/patches-6.6/950-1526-overlays-Regularisation-and-improvements.patch new file mode 100644 index 00000000000000..c763b1d27a59b2 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1526-overlays-Regularisation-and-improvements.patch @@ -0,0 +1,139 @@ +From fa71765fd3c98fa170407e72e052004913da6874 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 27 Jan 2025 14:17:46 +0000 +Subject: [PATCH] overlays: Regularisation and improvements + +A few small improvements, with a view to making the updated overlays +behave the same before and after the big conversion. + +Signed-off-by: Phil Elwell +--- + arch/arm/boot/dts/overlays/ads1115-overlay.dts | 3 ++- + arch/arm/boot/dts/overlays/i2c-fan-overlay.dts | 4 ++-- + arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts | 3 ++- + arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts | 3 ++- + arch/arm/boot/dts/overlays/mcp23017-overlay.dts | 3 ++- + arch/arm/boot/dts/overlays/pca953x-overlay.dts | 2 -- + arch/arm/boot/dts/overlays/pcf857x-overlay.dts | 2 +- + arch/arm/boot/dts/overlays/sc16is750-i2c-overlay.dts | 2 +- + arch/arm/boot/dts/overlays/sc16is752-i2c-overlay.dts | 2 +- + 9 files changed, 13 insertions(+), 11 deletions(-) + +--- a/arch/arm/boot/dts/overlays/ads1115-overlay.dts ++++ b/arch/arm/boot/dts/overlays/ads1115-overlay.dts +@@ -120,7 +120,8 @@ + chd_cfg = <&channel_d>,"reg:0"; + chd_gain = <&channel_d>,"ti,gain:0"; + chd_datarate = <&channel_d>,"ti,datarate:0"; +- i2c0 = <&frag100>, "target:0=",<&i2c0>; ++ i2c0 = <&frag100>, "target:0=",<&i2c0>, ++ <0>,"+101+102"; + i2c_csi_dsi = <&frag100>, "target:0=",<&i2c_csi_dsi>, + <0>,"+101+102"; + i2c_csi_dsi0 = <&frag100>, "target:0=",<&i2c_csi_dsi0>, +--- a/arch/arm/boot/dts/overlays/i2c-fan-overlay.dts ++++ b/arch/arm/boot/dts/overlays/i2c-fan-overlay.dts +@@ -17,7 +17,6 @@ + emc2301: emc2301@2f { + compatible = "microchip,emc2301"; + reg = <0x2f>; +- status = "okay"; + #cooling-cells = <0x02>; + }; + }; +@@ -82,7 +81,8 @@ + }; + + __overrides__ { +- i2c0 = <&frag100>,"target:0=",<&i2c0>; ++ i2c0 = <&frag100>,"target:0=",<&i2c0>, ++ <0>,"+101+102"; + i2c_csi_dsi = <&frag100>,"target:0=",<&i2c_csi_dsi>, + <0>,"+101+102"; + i2c_csi_dsi0 = <&frag100>, "target:0=",<&i2c_csi_dsi0>, +--- a/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts ++++ b/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts +@@ -27,7 +27,8 @@ + }; + + __overrides__ { +- i2c0 = <&frag100>, "target:0=",<&i2c0>; ++ i2c0 = <&frag100>, "target:0=",<&i2c0>, ++ <0>,"+101+102"; + i2c_csi_dsi = <&frag100>, "target:0=",<&i2c_csi_dsi>, + <0>,"+101+102"; + i2c_csi_dsi0 = <&frag100>, "target:0=",<&i2c_csi_dsi0>, +--- a/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts ++++ b/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts +@@ -27,7 +27,8 @@ + }; + + __overrides__ { +- i2c0 = <&frag100>, "target:0=",<&i2c0>; ++ i2c0 = <&frag100>, "target:0=",<&i2c0>, ++ <0>,"+101+102"; + i2c_csi_dsi = <&frag100>, "target:0=",<&i2c_csi_dsi>, + <0>,"+101+102"; + i2c_csi_dsi0 = <&frag100>, "target:0=",<&i2c_csi_dsi0>, +--- a/arch/arm/boot/dts/overlays/mcp23017-overlay.dts ++++ b/arch/arm/boot/dts/overlays/mcp23017-overlay.dts +@@ -87,7 +87,8 @@ + addr = <&mcp23017>,"reg:0", <&mcp23017_pins>,"reg:0"; + mcp23008 = <0>,"=2"; + noints = <0>,"!1!3"; +- i2c0 = <&frag100>, "target:0=",<&i2c0>; ++ i2c0 = <&frag100>, "target:0=",<&i2c0>, ++ <0>,"+101+102"; + i2c_csi_dsi = <&frag100>, "target:0=",<&i2c_csi_dsi>, + <0>,"+101+102"; + i2c_csi_dsi0 = <&frag100>, "target:0=",<&i2c_csi_dsi0>, +--- a/arch/arm/boot/dts/overlays/pca953x-overlay.dts ++++ b/arch/arm/boot/dts/overlays/pca953x-overlay.dts +@@ -17,8 +17,6 @@ + reg = <0x20>; + gpio-controller; + #gpio-cells = <2>; +- +- status = "okay"; + }; + }; + }; +--- a/arch/arm/boot/dts/overlays/pcf857x-overlay.dts ++++ b/arch/arm/boot/dts/overlays/pcf857x-overlay.dts +@@ -11,13 +11,13 @@ + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; ++ status = "okay"; + + pcf857x: pcf857x@0 { + compatible = ""; + reg = <0x00>; + gpio-controller; + #gpio-cells = <2>; +- status = "okay"; + }; + }; + }; +--- a/arch/arm/boot/dts/overlays/sc16is750-i2c-overlay.dts ++++ b/arch/arm/boot/dts/overlays/sc16is750-i2c-overlay.dts +@@ -27,7 +27,7 @@ + }; + + fragment@1 { +- target-path = "/"; ++ target = <&clocks>; + __overlay__ { + sc16is750_clk: sc16is750_i2c_clk@48 { + compatible = "fixed-clock"; +--- a/arch/arm/boot/dts/overlays/sc16is752-i2c-overlay.dts ++++ b/arch/arm/boot/dts/overlays/sc16is752-i2c-overlay.dts +@@ -27,7 +27,7 @@ + }; + + fragment@1 { +- target-path = "/"; ++ target = <&clocks>; + __overlay__ { + sc16is752_clk: sc16is752_i2c_clk@48 { + compatible = "fixed-clock"; diff --git a/target/linux/bcm27xx/patches-6.6/950-1527-overlays-Factor-out-the-common-i2c-bus-selection.patch b/target/linux/bcm27xx/patches-6.6/950-1527-overlays-Factor-out-the-common-i2c-bus-selection.patch new file mode 100644 index 00000000000000..504e46376ad04f --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1527-overlays-Factor-out-the-common-i2c-bus-selection.patch @@ -0,0 +1,1630 @@ +From a320d39840745502d420f56b3d49b3723a12058f Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Sun, 26 Jan 2025 22:08:16 +0000 +Subject: [PATCH] overlays: Factor out the common i2c bus selection + +Create an i2c-buses.dtsi to hold all of the common I2C bus selection +logic, and refactor existing overlays to use it. This patch should +have no functional change overall except to increase the range of +options for some overlays. + +There is a slightly ugly mechanism for overriding the default bus, where +the mux nodes may or may not need to be enabled. + +Signed-off-by: Phil Elwell +--- + arch/arm/boot/dts/overlays/README | 264 ++++------------- + .../arm/boot/dts/overlays/ads1115-overlay.dts | 39 +-- + .../boot/dts/overlays/edt-ft5406-overlay.dts | 39 +-- + arch/arm/boot/dts/overlays/edt-ft5406.dtsi | 5 +- + arch/arm/boot/dts/overlays/i2c-buses.dtsi | 67 +++++ + .../arm/boot/dts/overlays/i2c-fan-overlay.dts | 45 +-- + .../arm/boot/dts/overlays/i2c-mux-overlay.dts | 42 +-- + .../dts/overlays/i2c-pwm-pca9685a-overlay.dts | 41 +-- + .../arm/boot/dts/overlays/i2c-rtc-overlay.dts | 43 +-- + .../boot/dts/overlays/i2c-sensor-overlay.dts | 43 +-- + .../boot/dts/overlays/mcp23017-overlay.dts | 47 +-- + .../arm/boot/dts/overlays/pca953x-overlay.dts | 277 +++--------------- + .../arm/boot/dts/overlays/pcf857x-overlay.dts | 38 +-- + .../dts/overlays/sc16is750-i2c-overlay.dts | 37 +-- + .../dts/overlays/sc16is752-i2c-overlay.dts | 37 +-- + .../overlays/seeed-can-fd-hat-v2-overlay.dts | 9 +- + .../overlays/vc4-kms-dsi-7inch-overlay.dts | 17 +- + .../vc4-kms-dsi-waveshare-800x480-overlay.dts | 15 +- + 18 files changed, 202 insertions(+), 903 deletions(-) + create mode 100644 arch/arm/boot/dts/overlays/i2c-buses.dtsi + +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -568,6 +568,8 @@ Load: dtoverlay=ads1115,[= + Params: addr I2C bus address of device. Set based on how the + addr pin is wired. (default=0x48 assumes addr + is pulled to GND) ++ i2c-bus Supports all the standard I2C bus selection ++ parameters - see "dtoverlay -h i2c-bus" + cha_enable Enable virtual channel a. + cha_cfg Set the configuration for virtual channel a. + (default=4 configures this channel for the +@@ -577,22 +579,6 @@ Params: addr I2C bus + cha_gain Set the gain of the Programmable Gain + Amplifier for this channel. (Default 1 sets the + full scale of the channel to 4.096 Volts) +- i2c0 Choose the I2C0 bus on GPIOs 0&1 +- i2c_csi_dsi Choose the I2C bus connected to the main +- camera/display connector. +- See "dtparam -h i2c_csi_dsi" for details. +- i2c_csi_dsi0 Choose the I2C bus connected to the second +- camera/display connector, if present. +- See "dtparam -h i2c_csi_dsi0" for details. +- i2c3 Choose the I2C3 bus (configure with the i2c3 +- overlay - BCM2711 only) +- i2c4 Choose the I2C4 bus (configure with the i2c4 +- overlay - BCM2711 only) +- i2c5 Choose the I2C5 bus (configure with the i2c5 +- overlay - BCM2711 only) +- i2c6 Choose the I2C6 bus (configure with the i2c6 +- overlay - BCM2711 only) +- i2c-path Override I2C path to allow for i2c-gpio buses + + Channel parameters can be set for each enabled channel. + A maximum of 4 channels can be enabled (letters a thru d). +@@ -1263,20 +1249,11 @@ Params: sizex Touchscr + invx Touchscreen inverted x axis + invy Touchscreen inverted y axis + swapxy Touchscreen swapped x y axis +- i2c0 Choose the I2C0 bus on GPIOs 0&1 +- i2c1 Choose the I2C1 bus on GPIOs 2&3 +- i2c3 Choose the I2C3 bus (configure with the i2c3 +- overlay - BCM2711 only) +- i2c4 Choose the I2C4 bus (configure with the i2c4 +- overlay - BCM2711 only) +- i2c5 Choose the I2C5 bus (configure with the i2c5 +- overlay - BCM2711 only) +- i2c6 Choose the I2C6 bus (configure with the i2c6 +- overlay - BCM2711 only) + addr Sets the address for the touch controller. Note + that the device must be configured to use the + specified address. +- i2c-path Override I2C path to allow for i2c-gpio buses ++ i2c-bus Supports all the standard I2C bus selection ++ parameters - see "dtoverlay -h i2c-bus" + + + Name: enc28j60 +@@ -2114,37 +2091,41 @@ Load: dtoverlay=i2c-bcm2708 + Params: + + +-Name: i2c-fan +-Info: Adds support for a number of I2C fan controllers +-Load: dtoverlay=i2c-fan,= +-Params: addr Sets the address for the fan controller. Note +- that the device must be configured to use the +- specified address. +- +- i2c0 Choose the I2C0 bus on GPIOs 0&1 +- +- i2c_csi_dsi Choose the I2C bus connected to the main +- camera/display connector. +- See "dtparam -h i2c_csi_dsi" for details. +- +- i2c_csi_dsi0 Choose the I2C bus connected to the second +- camera/display connector, if present. +- See "dtparam -h i2c_csi_dsi0" for details. +- ++Name: i2c-bus ++Info: This is not a real overlay. Many overlays support the use of a variety ++ of I2C buses, and this is where the relevant parameters are documented. ++Load: ++Params: i2c0 Choose the I2C0 bus on GPIOs 0&1 ++ i2c1 Choose the I2C1 bus on GPIOs 2&3 ++ i2c2 Choose the I2C2 bus (configure with the i2c2 ++ overlay - BCM2711 only) + i2c3 Choose the I2C3 bus (configure with the i2c3 + overlay - BCM2711 only) +- + i2c4 Choose the I2C4 bus (configure with the i2c4 + overlay - BCM2711 only) +- + i2c5 Choose the I2C5 bus (configure with the i2c5 + overlay - BCM2711 only) +- + i2c6 Choose the I2C6 bus (configure with the i2c6 + overlay - BCM2711 only) +- ++ i2c_csi_dsi Choose the I2C bus connected to the main ++ camera/display connector. ++ See "dtparam -h i2c_csi_dsi" for details. ++ i2c_csi_dsi0 Choose the I2C bus connected to the second ++ camera/display connector, if present. ++ See "dtparam -h i2c_csi_dsi0" for details. + i2c-path Override I2C path to allow for i2c-gpio buses + ++ ++Name: i2c-fan ++Info: Adds support for a number of I2C fan controllers ++Load: dtoverlay=i2c-fan,= ++Params: addr Sets the address for the fan controller. Note ++ that the device must be configured to use the ++ specified address. ++ ++ i2c-bus Supports all the standard I2C bus selection ++ parameters - see "dtoverlay -h i2c-bus" ++ + minpwm PWM setting for the fan when the SoC is below + mintemp (range 0-255. default 0) + maxpwm PWM setting for the fan when the SoC is above +@@ -2196,33 +2177,12 @@ Params: pca9542 Select t + + addr Change I2C address of the device (default 0x70) + ++ i2c-bus Supports all the standard I2C bus selection ++ parameters - see "dtoverlay -h i2c-bus" ++ + base Set an explicit base value for the channel bus + numbers + +- i2c0 Choose the I2C0 bus on GPIOs 0&1 +- +- i2c_csi_dsi Choose the I2C bus connected to the main +- camera/display connector. +- See "dtparam -h i2c_csi_dsi" for details. +- +- i2c_csi_dsi0 Choose the I2C bus connected to the second +- camera/display connector, if present. +- See "dtparam -h i2c_csi_dsi0" for details. +- +- i2c3 Choose the I2C3 bus (configure with the i2c3 +- overlay - BCM2711 only) +- +- i2c4 Choose the I2C3 bus (configure with the i2c3 +- overlay - BCM2711 only) +- +- i2c5 Choose the I2C5 bus (configure with the i2c4 +- overlay - BCM2711 only) +- +- i2c6 Choose the I2C6 bus (configure with the i2c6 +- overlay - BCM2711 only) +- +- i2c-path Override I2C path to allow for i2c-gpio buses +- + disconnect_on_idle Force the mux to disconnect all child buses + after every transaction. + +@@ -2234,22 +2194,8 @@ Name: i2c-pwm-pca9685a + Info: Adds support for an NXP PCA9685A I2C PWM controller on i2c_arm + Load: dtoverlay=i2c-pwm-pca9685a,= + Params: addr I2C address of PCA9685A (default 0x40) +- i2c0 Choose the I2C0 bus on GPIOs 0&1 +- i2c_csi_dsi Choose the I2C bus connected to the main +- camera/display connector. +- See "dtparam -h i2c_csi_dsi" for details. +- i2c_csi_dsi0 Choose the I2C bus connected to the second +- camera/display connector, if present. +- See "dtparam -h i2c_csi_dsi0" for details. +- i2c3 Choose the I2C3 bus (configure with the i2c3 +- overlay - BCM2711 only) +- i2c4 Choose the I2C3 bus (configure with the i2c3 +- overlay - BCM2711 only) +- i2c5 Choose the I2C5 bus (configure with the i2c4 +- overlay - BCM2711 only) +- i2c6 Choose the I2C6 bus (configure with the i2c6 +- overlay - BCM2711 only) +- i2c-path Override I2C path to allow for i2c-gpio buses ++ i2c-bus Supports all the standard I2C bus selection ++ parameters - see "dtoverlay -h i2c-bus" + + + Name: i2c-rtc +@@ -2303,29 +2249,8 @@ Params: abx80x Select o + + s35390a Select the ABLIC S35390A device + +- i2c0 Choose the I2C0 bus on GPIOs 0&1 +- +- i2c_csi_dsi Choose the I2C bus connected to the main +- camera/display connector. +- See "dtparam -h i2c_csi_dsi" for details. +- +- i2c_csi_dsi0 Choose the I2C bus connected to the second +- camera/display connector, if present. +- See "dtparam -h i2c_csi_dsi0" for details. +- +- i2c3 Choose the I2C3 bus (configure with the i2c3 +- overlay - BCM2711 only) +- +- i2c4 Choose the I2C3 bus (configure with the i2c3 +- overlay - BCM2711 only) +- +- i2c5 Choose the I2C5 bus (configure with the i2c4 +- overlay - BCM2711 only) +- +- i2c6 Choose the I2C6 bus (configure with the i2c6 +- overlay - BCM2711 only) +- +- i2c-path Override I2C path to allow for i2c-gpio buses ++ i2c-bus Supports all the standard I2C bus selection ++ parameters - see "dtoverlay -h i2c-bus" + + addr Sets the address for the RTC. Note that the + device must be configured to use the specified +@@ -2451,6 +2376,9 @@ Params: addr Set the + JC42, LM75, MCP980x, MPU6050, MPU9250, MS5637, + MS5803, MS5805, MS5837, MS8607, SHT3x or TMP102 + ++ i2c-bus Supports all the standard I2C bus selection ++ parameters - see "dtoverlay -h i2c-bus" ++ + adt7410 Select the Analog Devices ADT7410 and ADT7420 + temperature sensors + Valid address 0x48-0x4b, default 0x48 +@@ -2591,29 +2519,6 @@ Params: addr Set the + veml6070 Select the Vishay VEML6070 ultraviolet light + sensor + +- i2c0 Choose the I2C0 bus on GPIOs 0&1 +- +- i2c_csi_dsi Choose the I2C bus connected to the main +- camera/display connector. +- See "dtparam -h i2c_csi_dsi" for details. +- i2c_csi_dsi0 Choose the I2C bus connected to the second +- camera/display connector, if present. +- See "dtparam -h i2c_csi_dsi0" for details. +- +- i2c3 Choose the I2C3 bus (configure with the i2c3 +- overlay - BCM2711 only) +- +- i2c4 Choose the I2C3 bus (configure with the i2c3 +- overlay - BCM2711 only) +- +- i2c5 Choose the I2C5 bus (configure with the i2c4 +- overlay - BCM2711 only) +- +- i2c6 Choose the I2C6 bus (configure with the i2c6 +- overlay - BCM2711 only) +- +- i2c-path Override I2C path to allow for i2c-gpio buses +- + + Name: i2c0 + Info: Change i2c0 pin usage. Not all pin combinations are usable on all +@@ -3255,24 +3160,11 @@ Params: gpiopin Gpio pin + + addr I2C address of the MCP23017 (default: 0x20) + ++ i2c-bus Supports all the standard I2C bus selection ++ parameters - see "dtoverlay -h i2c-bus" ++ + mcp23008 Configure an MCP23008 instead. + noints Disable the interrupt GPIO line. +- i2c0 Choose the I2C0 bus on GPIOs 0&1 +- i2c_csi_dsi Choose the I2C bus connected to the main +- camera/display connector. +- See "dtparam -h i2c_csi_dsi" for details. +- i2c_csi_dsi0 Choose the I2C bus connected to the second +- camera/display connector, if present. +- See "dtparam -h i2c_csi_dsi0" for details. +- i2c3 Choose the I2C3 bus (configure with the i2c3 +- overlay - BCM2711 only) +- i2c4 Choose the I2C4 bus (configure with the i2c4 +- overlay - BCM2711 only) +- i2c5 Choose the I2C5 bus (configure with the i2c5 +- overlay - BCM2711 only) +- i2c6 Choose the I2C6 bus (configure with the i2c6 +- overlay - BCM2711 only) +- i2c-path Override I2C path to allow for i2c-gpio buses + + + Name: mcp23s17 +@@ -3692,6 +3584,8 @@ Name: pca953x + Info: TI PCA953x family of I2C GPIO expanders. Default is for NXP PCA9534. + Load: dtoverlay=pca953x,= + Params: addr I2C address of expander. Default 0x20. ++ i2c-bus Supports all the standard I2C bus selection ++ parameters - see "dtoverlay -h i2c-bus" + pca6416 Select the NXP PCA6416 (16 bit) + pca9505 Select the NXP PCA9505 (40 bit) + pca9535 Select the NXP PCA9535 (16 bit) +@@ -3722,22 +3616,6 @@ Params: addr I2C addr + cat9554 Select the Onnn CAT9554 (8 bit) + pca9654 Select the Onnn PCA9654 (8 bit) + xra1202 Select the Exar XRA1202 (8 bit) +- i2c0 Choose the I2C0 bus on GPIOs 0&1 +- i2c_csi_dsi Choose the I2C bus connected to the main +- camera/display connector. +- See "dtparam -h i2c_csi_dsi" for details. +- i2c_csi_dsi0 Choose the I2C bus connected to the second +- camera/display connector, if present. +- See "dtparam -h i2c_csi_dsi0" for details. +- i2c3 Choose the I2C3 bus (configure with the i2c3 +- overlay - BCM2711 only) +- i2c4 Choose the I2C3 bus (configure with the i2c3 +- overlay - BCM2711 only) +- i2c5 Choose the I2C5 bus (configure with the i2c4 +- overlay - BCM2711 only) +- i2c6 Choose the I2C6 bus (configure with the i2c6 +- overlay - BCM2711 only) +- i2c-path Override I2C path to allow for i2c-gpio buses + + + Name: pcf857x +@@ -3745,26 +3623,12 @@ Info: NXP PCF857x family of I2C GPIO e + Load: dtoverlay=pcf857x,= + Params: addr I2C address of expander. Default + depends on model selected. ++ i2c-bus Supports all the standard I2C bus selection ++ parameters - see "dtoverlay -h i2c-bus" + pcf8574 Select the NXP PCF8574 (8 bit) + pcf8574a Select the NXP PCF8574A (8 bit) + pcf8575 Select the NXP PCF8575 (16 bit) + pca8574 Select the NXP PCA8574 (8 bit) +- i2c0 Choose the I2C0 bus on GPIOs 0&1 +- i2c_csi_dsi Choose the I2C bus connected to the main +- camera/display connector. +- See "dtparam -h i2c_csi_dsi" for details. +- i2c_csi_dsi0 Choose the I2C bus connected to the second +- camera/display connector, if present. +- See "dtparam -h i2c_csi_dsi0" for details. +- i2c3 Choose the I2C3 bus (configure with the i2c3 +- overlay - BCM2711 only) +- i2c4 Choose the I2C3 bus (configure with the i2c3 +- overlay - BCM2711 only) +- i2c5 Choose the I2C5 bus (configure with the i2c4 +- overlay - BCM2711 only) +- i2c6 Choose the I2C6 bus (configure with the i2c6 +- overlay - BCM2711 only) +- i2c-path Override I2C path to allow for i2c-gpio buses + + + Name: pcie-32bit-dma +@@ -4463,23 +4327,9 @@ Info: Overlay for the NXP SC16IS750 UA + Load: dtoverlay=sc16is750-i2c,= + Params: int_pin GPIO used for IRQ (default 24) + addr Address (default 0x48) ++ i2c-bus Supports all the standard I2C bus selection ++ parameters - see "dtoverlay -h i2c-bus" + xtal On-board crystal frequency (default 14745600) +- i2c0 Choose the I2C0 bus on GPIOs 0&1 +- i2c_csi_dsi Choose the I2C bus connected to the main +- camera/display connector. +- See "dtparam -h i2c_csi_dsi" for details. +- i2c_csi_dsi0 Choose the I2C bus connected to the second +- camera/display connector, if present. +- See "dtparam -h i2c_csi_dsi0" for details. +- i2c3 Choose the I2C3 bus (configure with the i2c3 +- overlay - BCM2711 only) +- i2c4 Choose the I2C4 bus (configure with the i2c4 +- overlay - BCM2711 only) +- i2c5 Choose the I2C5 bus (configure with the i2c5 +- overlay - BCM2711 only) +- i2c6 Choose the I2C6 bus (configure with the i2c6 +- overlay - BCM2711 only) +- i2c-path Override I2C path to allow for i2c-gpio buses + + + Name: sc16is750-spi0 +@@ -4497,23 +4347,9 @@ Info: Overlay for the NXP SC16IS752 du + Load: dtoverlay=sc16is752-i2c,= + Params: int_pin GPIO used for IRQ (default 24) + addr Address (default 0x48) ++ i2c-bus Supports all the standard I2C bus selection ++ parameters - see "dtoverlay -h i2c-bus" + xtal On-board crystal frequency (default 14745600) +- i2c0 Choose the I2C0 bus on GPIOs 0&1 +- i2c_csi_dsi Choose the I2C bus connected to the main +- camera/display connector. +- See "dtparam -h i2c_csi_dsi" for details. +- i2c_csi_dsi0 Choose the I2C bus connected to the second +- camera/display connector, if present. +- See "dtparam -h i2c_csi_dsi0" for details. +- i2c3 Choose the I2C3 bus (configure with the i2c3 +- overlay - BCM2711 only) +- i2c4 Choose the I2C4 bus (configure with the i2c4 +- overlay - BCM2711 only) +- i2c5 Choose the I2C5 bus (configure with the i2c5 +- overlay - BCM2711 only) +- i2c6 Choose the I2C6 bus (configure with the i2c6 +- overlay - BCM2711 only) +- i2c-path Override I2C path to allow for i2c-gpio buses + + + Name: sc16is752-spi0 +--- a/arch/arm/boot/dts/overlays/ads1115-overlay.dts ++++ b/arch/arm/boot/dts/overlays/ads1115-overlay.dts +@@ -5,6 +5,8 @@ + /dts-v1/; + /plugin/; + ++#include "i2c-buses.dtsi" ++ + / { + compatible = "brcm,bcm2835"; + +@@ -81,27 +83,6 @@ + }; + }; + +- frag100: fragment@100 { +- target = <&i2c1>; +- i2cbus: __overlay__ { +- status = "okay"; +- }; +- }; +- +- fragment@101 { +- target = <&i2c0if>; +- __dormant__ { +- status = "okay"; +- }; +- }; +- +- fragment@102 { +- target = <&i2c0mux>; +- __dormant__ { +- status = "okay"; +- }; +- }; +- + __overrides__ { + addr = <&ads1115>,"reg:0"; + cha_enable = <0>,"=0"; +@@ -120,21 +101,5 @@ + chd_cfg = <&channel_d>,"reg:0"; + chd_gain = <&channel_d>,"ti,gain:0"; + chd_datarate = <&channel_d>,"ti,datarate:0"; +- i2c0 = <&frag100>, "target:0=",<&i2c0>, +- <0>,"+101+102"; +- i2c_csi_dsi = <&frag100>, "target:0=",<&i2c_csi_dsi>, +- <0>,"+101+102"; +- i2c_csi_dsi0 = <&frag100>, "target:0=",<&i2c_csi_dsi0>, +- <0>,"+101+102"; +- i2c3 = <&frag100>, "target?=0", +- <&frag100>, "target-path=i2c3"; +- i2c4 = <&frag100>, "target?=0", +- <&frag100>, "target-path=i2c4"; +- i2c5 = <&frag100>, "target?=0", +- <&frag100>, "target-path=i2c5"; +- i2c6 = <&frag100>, "target?=0", +- <&frag100>, "target-path=i2c6"; +- i2c-path = <&frag100>, "target?=0", +- <&frag100>, "target-path"; + }; + }; +--- a/arch/arm/boot/dts/overlays/edt-ft5406-overlay.dts ++++ b/arch/arm/boot/dts/overlays/edt-ft5406-overlay.dts +@@ -7,43 +7,16 @@ + /dts-v1/; + /plugin/; + ++#define ENABLE_I2C0_MUX ++#include "i2c-buses.dtsi" + #include "edt-ft5406.dtsi" + +-/ { +- fragment@0 { +- target = <&i2c0if>; +- __overlay__ { +- status = "okay"; +- }; +- }; +- +- fragment@1 { +- target = <&i2c0mux>; +- __overlay__ { +- status = "okay"; +- }; +- }; ++&busfrag { ++ target = <&i2c_csi_dsi>; ++}; + ++/ { + __overrides__ { +- i2c0 = <&ts_i2c_frag>,"target:0=",<&i2c0>; +- i2c1 = <&ts_i2c_frag>, "target?=0", +- <&ts_i2c_frag>, "target-path=i2c1", +- <0>,"-0-1"; +- i2c3 = <&ts_i2c_frag>, "target?=0", +- <&ts_i2c_frag>, "target-path=i2c3", +- <0>,"-0-1"; +- i2c4 = <&ts_i2c_frag>, "target?=0", +- <&ts_i2c_frag>, "target-path=i2c4", +- <0>,"-0-1"; +- i2c5 = <&ts_i2c_frag>, "target?=0", +- <&ts_i2c_frag>, "target-path=i2c5", +- <0>,"-0-1"; +- i2c6 = <&ts_i2c_frag>, "target?=0", +- <&ts_i2c_frag>, "target-path=i2c6", +- <0>,"-0-1"; +- i2c-path = <&ts_i2c_frag>, "target?=0", +- <&ts_i2c_frag>, "target-path", +- <0>,"-0-1"; + addr = <&ft5406>,"reg:0"; + }; + }; +--- a/arch/arm/boot/dts/overlays/edt-ft5406.dtsi ++++ b/arch/arm/boot/dts/overlays/edt-ft5406.dtsi +@@ -22,12 +22,11 @@ + }; + }; + +- ts_i2c_frag: fragment@12 { +- target = <&i2c_csi_dsi>; ++ fragment@12 { ++ target = <&i2cbus>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; +- status = "okay"; + + ft5406: ts@38 { + compatible = "edt,edt-ft5506"; +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2c-buses.dtsi +@@ -0,0 +1,67 @@ ++// Common i2c buses, and dtparams to select them ++ ++/ { ++ compatible = "brcm,bcm2835"; ++ ++ busfrag: fragment@100 { ++ target = <&i2c_arm>; ++ i2cbus: __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@101 { ++ target = <&i2c0if>; ++#ifdef ENABLE_I2C0_MUX ++ __overlay__ { ++#else ++ __dormant__ { ++#endif ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@102 { ++ target = <&i2c0mux>; ++#ifdef ENABLE_I2C0_MUX ++ __overlay__ { ++#else ++ __dormant__ { ++#endif ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ i2c0 = <&busfrag>,"target:0=",<&i2c0>, ++ <&busfrag>, "target-path?=0", ++ <0>,"+101+102"; ++ i2c_csi_dsi = <&busfrag>,"target:0=",<&i2c_csi_dsi>, ++ <&busfrag>, "target-path?=0", ++ <0>,"+101+102"; ++ i2c_csi_dsi0 = <&busfrag>, "target:0=",<&i2c_csi_dsi0>, ++ <&busfrag>, "target-path?=0", ++ <0>,"+101+102"; ++ i2c1 = <&busfrag>,"target:0=",<&i2c1>, ++ <&busfrag>, "target-path?=0", ++ <0>,"-101-102"; ++ i2c2 = <&busfrag>, "target?=0", ++ <&busfrag>, "target-path=i2c2", ++ <0>,"-101-102"; ++ i2c3 = <&busfrag>, "target?=0", ++ <&busfrag>, "target-path=i2c3", ++ <0>,"-101-102"; ++ i2c4 = <&busfrag>, "target?=0", ++ <&busfrag>, "target-path=i2c4", ++ <0>,"-101-102"; ++ i2c5 = <&busfrag>, "target?=0", ++ <&busfrag>, "target-path=i2c5", ++ <0>,"-101-102"; ++ i2c6 = <&busfrag>, "target?=0", ++ <&busfrag>, "target-path=i2c6", ++ <0>,"-101-102"; ++ i2c-path = <&busfrag>, "target?=0", ++ <&busfrag>, "target-path", ++ <0>,"-101-102"; ++ }; ++}; +--- a/arch/arm/boot/dts/overlays/i2c-fan-overlay.dts ++++ b/arch/arm/boot/dts/overlays/i2c-fan-overlay.dts +@@ -4,6 +4,8 @@ + + #include + ++#include "i2c-buses.dtsi" ++ + / { + compatible = "brcm,bcm2835"; + +@@ -22,35 +24,14 @@ + }; + }; + +- frag100: fragment@100 { +- target = <&i2c_arm>; +- i2cbus: __overlay__ { +- status = "okay"; +- }; +- }; +- +- fragment@101 { +- target = <&i2c0if>; +- __dormant__ { +- status = "okay"; +- }; +- }; +- +- fragment@102 { +- target = <&i2c0mux>; +- __dormant__ { +- status = "okay"; +- }; +- }; +- +- fragment@103 { ++ fragment@1 { + target = <&cpu_thermal>; + __overlay__ { + polling-delay = <2000>; /* milliseconds */ + }; + }; + +- fragment@104 { ++ fragment@2 { + target = <&thermal_trips>; + __overlay__ { + fanmid0: fanmid0 { +@@ -66,7 +47,7 @@ + }; + }; + +- fragment@105 { ++ fragment@3 { + target = <&cooling_maps>; + __overlay__ { + map0: map0 { +@@ -81,22 +62,6 @@ + }; + + __overrides__ { +- i2c0 = <&frag100>,"target:0=",<&i2c0>, +- <0>,"+101+102"; +- i2c_csi_dsi = <&frag100>,"target:0=",<&i2c_csi_dsi>, +- <0>,"+101+102"; +- i2c_csi_dsi0 = <&frag100>, "target:0=",<&i2c_csi_dsi0>, +- <0>,"+101+102"; +- i2c3 = <&frag100>, "target?=0", +- <&frag100>, "target-path=i2c3"; +- i2c4 = <&frag100>, "target?=0", +- <&frag100>, "target-path=i2c4"; +- i2c5 = <&frag100>, "target?=0", +- <&frag100>, "target-path=i2c5"; +- i2c6 = <&frag100>, "target?=0", +- <&frag100>, "target-path=i2c6"; +- i2c-path = <&frag100>, "target?=0", +- <&frag100>, "target-path"; + addr = <&emc2301>,"reg:0"; + minpwm = <&emc2301>,"emc2305,pwm-min.0"; + maxpwm = <&emc2301>,"emc2305,pwm-max.0"; +--- a/arch/arm/boot/dts/overlays/i2c-mux-overlay.dts ++++ b/arch/arm/boot/dts/overlays/i2c-mux-overlay.dts +@@ -5,6 +5,8 @@ + + #include + ++#include "i2c-buses.dtsi" ++ + /{ + compatible = "brcm,bcm2835"; + +@@ -13,7 +15,6 @@ + __dormant__ { + #address-cells = <1>; + #size-cells = <0>; +- status = "okay"; + + pca9542: mux@70 { + compatible = "nxp,pca9542"; +@@ -40,7 +41,6 @@ + __dormant__ { + #address-cells = <1>; + #size-cells = <0>; +- status = "okay"; + + pca9545: mux@70 { + compatible = "nxp,pca9545"; +@@ -77,7 +77,6 @@ + __dormant__ { + #address-cells = <1>; + #size-cells = <0>; +- status = "okay"; + + pca9548: mux@70 { + compatible = "nxp,pca9548"; +@@ -129,27 +128,6 @@ + }; + }; + +- frag100: fragment@100 { +- target = <&i2c_arm>; +- i2cbus: __overlay__ { +- status = "okay"; +- }; +- }; +- +- fragment@101 { +- target = <&i2c0if>; +- __dormant__ { +- status = "okay"; +- }; +- }; +- +- fragment@102 { +- target = <&i2c0mux>; +- __dormant__ { +- status = "okay"; +- }; +- }; +- + __overrides__ { + pca9542 = <0>, "+0"; + pca9545 = <0>, "+1"; +@@ -163,22 +141,6 @@ + <&pca9545>,"base-nr:0", + <&pca9548>,"base-nr:0"; + +- i2c0 = <&frag100>, "target:0=",<&i2c0>, +- <0>,"+101+102"; +- i2c_csi_dsi = <&frag100>, "target:0=",<&i2c_csi_dsi>, +- <0>,"+101+102"; +- i2c_csi_dsi0 = <&frag100>, "target:0=",<&i2c_csi_dsi0>, +- <0>,"+101+102"; +- i2c3 = <&frag100>, "target?=0", +- <&frag100>, "target-path=i2c3"; +- i2c4 = <&frag100>, "target?=0", +- <&frag100>, "target-path=i2c4"; +- i2c5 = <&frag100>, "target?=0", +- <&frag100>, "target-path=i2c5"; +- i2c6 = <&frag100>, "target?=0", +- <&frag100>, "target-path=i2c6"; +- i2c-path = <&frag100>, "target?=0", +- <&frag100>, "target-path"; + disconnect_on_idle = + <&pca9542>,"idle-state:0=", , + <&pca9545>,"idle-state:0=", , +--- a/arch/arm/boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts ++++ b/arch/arm/boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts +@@ -2,6 +2,8 @@ + /dts-v1/; + /plugin/; + ++#include "i2c-buses.dtsi" ++ + /{ + compatible = "brcm,bcm2835"; + +@@ -10,7 +12,6 @@ + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; +- status = "okay"; + + pca: pca@40 { + compatible = "nxp,pca9685-pwm"; +@@ -21,45 +22,7 @@ + }; + }; + +- +- frag100: fragment@100 { +- target = <&i2c_arm>; +- i2cbus: __overlay__ { +- status = "okay"; +- }; +- }; +- +- fragment@101 { +- target = <&i2c0if>; +- __dormant__ { +- status = "okay"; +- }; +- }; +- +- fragment@102 { +- target = <&i2c0mux>; +- __dormant__ { +- status = "okay"; +- }; +- }; +- + __overrides__ { + addr = <&pca>,"reg:0"; +- i2c0 = <&frag100>, "target:0=",<&i2c0>, +- <0>,"+101+102"; +- i2c_csi_dsi = <&frag100>, "target:0=",<&i2c_csi_dsi>, +- <0>,"+101+102"; +- i2c_csi_dsi0 = <&frag100>, "target:0=",<&i2c_csi_dsi0>, +- <0>,"+101+102"; +- i2c3 = <&frag100>, "target?=0", +- <&frag100>, "target-path=i2c3"; +- i2c4 = <&frag100>, "target?=0", +- <&frag100>, "target-path=i2c4"; +- i2c5 = <&frag100>, "target?=0", +- <&frag100>, "target-path=i2c5"; +- i2c6 = <&frag100>, "target?=0", +- <&frag100>, "target-path=i2c6"; +- i2c-path = <&frag100>, "target?=0", +- <&frag100>, "target-path"; + }; + }; +--- a/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts ++++ b/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts +@@ -3,45 +3,4 @@ + /plugin/; + + #include "i2c-rtc-common.dtsi" +- +-/ { +- frag100: fragment@100 { +- target = <&i2c_arm>; +- i2cbus: __overlay__ { +- status = "okay"; +- }; +- }; +- +- fragment@101 { +- target = <&i2c0if>; +- __dormant__ { +- status = "okay"; +- }; +- }; +- +- fragment@102 { +- target = <&i2c0mux>; +- __dormant__ { +- status = "okay"; +- }; +- }; +- +- __overrides__ { +- i2c0 = <&frag100>, "target:0=",<&i2c0>, +- <0>,"+101+102"; +- i2c_csi_dsi = <&frag100>, "target:0=",<&i2c_csi_dsi>, +- <0>,"+101+102"; +- i2c_csi_dsi0 = <&frag100>, "target:0=",<&i2c_csi_dsi0>, +- <0>,"+101+102"; +- i2c3 = <&frag100>, "target?=0", +- <&frag100>, "target-path=i2c3"; +- i2c4 = <&frag100>, "target?=0", +- <&frag100>, "target-path=i2c4"; +- i2c5 = <&frag100>, "target?=0", +- <&frag100>, "target-path=i2c5"; +- i2c6 = <&frag100>, "target?=0", +- <&frag100>, "target-path=i2c6"; +- i2c-path = <&frag100>, "target?=0", +- <&frag100>, "target-path"; +- }; +-}; ++#include "i2c-buses.dtsi" +--- a/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts ++++ b/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts +@@ -3,45 +3,4 @@ + /plugin/; + + #include "i2c-sensor-common.dtsi" +- +-/ { +- frag100: fragment@100 { +- target = <&i2c_arm>; +- i2cbus: __overlay__ { +- status = "okay"; +- }; +- }; +- +- fragment@101 { +- target = <&i2c0if>; +- __dormant__ { +- status = "okay"; +- }; +- }; +- +- fragment@102 { +- target = <&i2c0mux>; +- __dormant__ { +- status = "okay"; +- }; +- }; +- +- __overrides__ { +- i2c0 = <&frag100>, "target:0=",<&i2c0>, +- <0>,"+101+102"; +- i2c_csi_dsi = <&frag100>, "target:0=",<&i2c_csi_dsi>, +- <0>,"+101+102"; +- i2c_csi_dsi0 = <&frag100>, "target:0=",<&i2c_csi_dsi0>, +- <0>,"+101+102"; +- i2c3 = <&frag100>, "target?=0", +- <&frag100>, "target-path=i2c3"; +- i2c4 = <&frag100>, "target?=0", +- <&frag100>, "target-path=i2c4"; +- i2c5 = <&frag100>, "target?=0", +- <&frag100>, "target-path=i2c5"; +- i2c6 = <&frag100>, "target?=0", +- <&frag100>, "target-path=i2c6"; +- i2c-path = <&frag100>, "target?=0", +- <&frag100>, "target-path"; +- }; +-}; ++#include "i2c-buses.dtsi" +--- a/arch/arm/boot/dts/overlays/mcp23017-overlay.dts ++++ b/arch/arm/boot/dts/overlays/mcp23017-overlay.dts +@@ -3,16 +3,11 @@ + /dts-v1/; + /plugin/; + ++#include "i2c-buses.dtsi" ++ + / { + compatible = "brcm,bcm2835"; + +- fragment@0 { +- target = <&i2cbus>; +- __overlay__ { +- status = "okay"; +- }; +- }; +- + fragment@1 { + target = <&gpio>; + __overlay__ { +@@ -60,49 +55,11 @@ + }; + }; + +- frag100: fragment@100 { +- target = <&i2c1>; +- i2cbus: __overlay__ { +- status = "okay"; +- }; +- }; +- +- fragment@101 { +- target = <&i2c0if>; +- __dormant__ { +- status = "okay"; +- }; +- }; +- +- fragment@102 { +- target = <&i2c0mux>; +- __dormant__ { +- status = "okay"; +- }; +- }; +- + __overrides__ { + gpiopin = <&mcp23017_pins>,"brcm,pins:0", + <&mcp23017_irq>,"interrupts:0"; + addr = <&mcp23017>,"reg:0", <&mcp23017_pins>,"reg:0"; + mcp23008 = <0>,"=2"; + noints = <0>,"!1!3"; +- i2c0 = <&frag100>, "target:0=",<&i2c0>, +- <0>,"+101+102"; +- i2c_csi_dsi = <&frag100>, "target:0=",<&i2c_csi_dsi>, +- <0>,"+101+102"; +- i2c_csi_dsi0 = <&frag100>, "target:0=",<&i2c_csi_dsi0>, +- <0>,"+101+102"; +- i2c3 = <&frag100>, "target?=0", +- <&frag100>, "target-path=i2c3"; +- i2c4 = <&frag100>, "target?=0", +- <&frag100>, "target-path=i2c4"; +- i2c5 = <&frag100>, "target?=0", +- <&frag100>, "target-path=i2c5"; +- i2c6 = <&frag100>, "target?=0", +- <&frag100>, "target-path=i2c6"; +- i2c-path = <&frag100>, "target?=0", +- <&frag100>, "target-path"; + }; + }; +- +--- a/arch/arm/boot/dts/overlays/pca953x-overlay.dts ++++ b/arch/arm/boot/dts/overlays/pca953x-overlay.dts +@@ -2,11 +2,13 @@ + /dts-v1/; + /plugin/; + ++#include "i2c-buses.dtsi" ++ + /{ + compatible = "brcm,bcm2835"; + +- frag0: fragment@0 { +- target = <&i2c_arm>; ++ fragment@0 { ++ target = <&i2cbus>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; +@@ -21,248 +23,37 @@ + }; + }; + +- fragment@1 { +- target = <&pca>; +- __dormant__ { +- compatible = "nxp,pca6416"; +- }; +- }; +- fragment@2 { +- target = <&pca>; +- __dormant__ { +- compatible = "nxp,pca9505"; +- }; +- }; +- fragment@3 { +- target = <&pca>; +- __dormant__ { +- compatible = "nxp,pca9535"; +- }; +- }; +- fragment@4 { +- target = <&pca>; +- __dormant__ { +- compatible = "nxp,pca9536"; +- }; +- }; +- fragment@5 { +- target = <&pca>; +- __dormant__ { +- compatible = "nxp,pca9537"; +- }; +- }; +- fragment@6 { +- target = <&pca>; +- __dormant__ { +- compatible = "nxp,pca9538"; +- }; +- }; +- fragment@7 { +- target = <&pca>; +- __dormant__ { +- compatible = "nxp,pca9539"; +- }; +- }; +- fragment@8 { +- target = <&pca>; +- __dormant__ { +- compatible = "nxp,pca9554"; +- }; +- }; +- fragment@9 { +- target = <&pca>; +- __dormant__ { +- compatible = "nxp,pca9555"; +- }; +- }; +- fragment@10 { +- target = <&pca>; +- __dormant__ { +- compatible = "nxp,pca9556"; +- }; +- }; +- fragment@11 { +- target = <&pca>; +- __dormant__ { +- compatible = "nxp,pca9557"; +- }; +- }; +- fragment@12 { +- target = <&pca>; +- __dormant__ { +- compatible = "nxp,pca9574"; +- }; +- }; +- fragment@13 { +- target = <&pca>; +- __dormant__ { +- compatible = "nxp,pca9575"; +- }; +- }; +- fragment@14 { +- target = <&pca>; +- __dormant__ { +- compatible = "nxp,pca9698"; +- }; +- }; +- fragment@15 { +- target = <&pca>; +- __dormant__ { +- compatible = "nxp,pcal6416"; +- }; +- }; +- fragment@16 { +- target = <&pca>; +- __dormant__ { +- compatible = "nxp,pcal6524"; +- }; +- }; +- fragment@17 { +- target = <&pca>; +- __dormant__ { +- compatible = "nxp,pcal9555a"; +- }; +- }; +- fragment@18 { +- target = <&pca>; +- __dormant__ { +- compatible = "maxim,max7310"; +- }; +- }; +- fragment@19 { +- target = <&pca>; +- __dormant__ { +- compatible = "maxim,max7312"; +- }; +- }; +- fragment@20 { +- target = <&pca>; +- __dormant__ { +- compatible = "maxim,max7313"; +- }; +- }; +- fragment@21 { +- target = <&pca>; +- __dormant__ { +- compatible = "maxim,max7315"; +- }; +- }; +- fragment@22 { +- target = <&pca>; +- __dormant__ { +- compatible = "ti,pca6107"; +- }; +- }; +- fragment@23 { +- target = <&pca>; +- __dormant__ { +- compatible = "ti,tca6408"; +- }; +- }; +- fragment@24 { +- target = <&pca>; +- __dormant__ { +- compatible = "ti,tca6416"; +- }; +- }; +- fragment@25 { +- target = <&pca>; +- __dormant__ { +- compatible = "ti,tca6424"; +- }; +- }; +- fragment@26 { +- target = <&pca>; +- __dormant__ { +- compatible = "ti,tca9539"; +- }; +- }; +- fragment@27 { +- target = <&pca>; +- __dormant__ { +- compatible = "ti,tca9554"; +- }; +- }; +- fragment@28 { +- target = <&pca>; +- __dormant__ { +- compatible = "onnn,cat9554"; +- }; +- }; +- fragment@29 { +- target = <&pca>; +- __dormant__ { +- compatible = "onnn,pca9654"; +- }; +- }; +- fragment@30 { +- target = <&pca>; +- __dormant__ { +- compatible = "exar,xra1202"; +- }; +- }; +- +- fragment@100 { +- target = <&i2c0if>; +- __dormant__ { +- status = "okay"; +- }; +- }; +- +- fragment@101 { +- target = <&i2c0mux>; +- __dormant__ { +- status = "okay"; +- }; +- }; +- + __overrides__ { + addr = <&pca>,"reg:0"; +- pca6416 = <0>, "+1"; +- pca9505 = <0>, "+2"; +- pca9535 = <0>, "+3"; +- pca9536 = <0>, "+4"; +- pca9537 = <0>, "+5"; +- pca9538 = <0>, "+6"; +- pca9539 = <0>, "+7"; +- pca9554 = <0>, "+8"; +- pca9555 = <0>, "+9"; +- pca9556 = <0>, "+10"; +- pca9557 = <0>, "+11"; +- pca9574 = <0>, "+12"; +- pca9575 = <0>, "+13"; +- pca9698 = <0>, "+14"; +- pcal6416 = <0>, "+15"; +- pcal6524 = <0>, "+16"; +- pcal9555a = <0>, "+17"; +- max7310 = <0>, "+18"; +- max7312 = <0>, "+19"; +- max7313 = <0>, "+20"; +- max7315 = <0>, "+21"; +- pca6107 = <0>, "+22"; +- tca6408 = <0>, "+23"; +- tca6416 = <0>, "+24"; +- tca6424 = <0>, "+25"; +- tca9539 = <0>, "+26"; +- tca9554 = <0>, "+27"; +- cat9554 = <0>, "+28"; +- pca9654 = <0>, "+29"; +- xra1202 = <0>, "+30"; +- i2c0 = <&frag0>, "target:0=",<&i2c0>, +- <0>,"+100+101"; +- i2c_csi_dsi = <&frag0>, "target:0=",<&i2c_csi_dsi>, +- <0>,"+100+101"; +- i2c_csi_dsi0 = <&frag0>, "target:0=",<&i2c_csi_dsi0>, +- <0>,"+100+101"; +- i2c3 = <&frag0>, "target?=0", +- <&frag0>, "target-path=i2c3"; +- i2c4 = <&frag0>, "target?=0", +- <&frag0>, "target-path=i2c4"; +- i2c5 = <&frag0>, "target?=0", +- <&frag0>, "target-path=i2c5"; +- i2c6 = <&frag0>, "target?=0", +- <&frag0>, "target-path=i2c6"; +- i2c-path = <&frag0>, "target?=0", +- <&frag0>, "target-path"; ++ pca6416 = <&pca>,"compatible=nxp,pca6416"; ++ pca9505 = <&pca>,"compatible=nxp,pca9505"; ++ pca9535 = <&pca>,"compatible=nxp,pca9535"; ++ pca9536 = <&pca>,"compatible=nxp,pca9536"; ++ pca9537 = <&pca>,"compatible=nxp,pca9537"; ++ pca9538 = <&pca>,"compatible=nxp,pca9538"; ++ pca9539 = <&pca>,"compatible=nxp,pca9539"; ++ pca9554 = <&pca>,"compatible=nxp,pca9554"; ++ pca9555 = <&pca>,"compatible=nxp,pca9555"; ++ pca9556 = <&pca>,"compatible=nxp,pca9556"; ++ pca9557 = <&pca>,"compatible=nxp,pca9557"; ++ pca9574 = <&pca>,"compatible=nxp,pca9574"; ++ pca9575 = <&pca>,"compatible=nxp,pca9575"; ++ pca9698 = <&pca>,"compatible=nxp,pca9698"; ++ pcal6416 = <&pca>,"compatible=nxp,pcal6416"; ++ pcal6524 = <&pca>,"compatible=nxp,pcal6524"; ++ pcal9555a = <&pca>,"compatible=nxp,pcal9555a"; ++ max7310 = <&pca>,"compatible=maxim,max7310"; ++ max7312 = <&pca>,"compatible=maxim,max7312"; ++ max7313 = <&pca>,"compatible=maxim,max7313"; ++ max7315 = <&pca>,"compatible=maxim,max7315"; ++ pca6107 = <&pca>,"compatible=ti,pca6107"; ++ tca6408 = <&pca>,"compatible=ti,tca6408"; ++ tca6416 = <&pca>,"compatible=ti,tca6416"; ++ tca6424 = <&pca>,"compatible=ti,tca6424"; ++ tca9539 = <&pca>,"compatible=ti,tca9539"; ++ tca9554 = <&pca>,"compatible=ti,tca9554"; ++ cat9554 = <&pca>,"compatible=onnn,cat9554"; ++ pca9654 = <&pca>,"compatible=onnn,pca9654"; ++ xra1202 = <&pca>,"compatible=exar,xra1202"; + }; + }; +--- a/arch/arm/boot/dts/overlays/pcf857x-overlay.dts ++++ b/arch/arm/boot/dts/overlays/pcf857x-overlay.dts +@@ -3,11 +3,13 @@ + /dts-v1/; + /plugin/; + ++#include "i2c-buses.dtsi" ++ + / { + compatible = "brcm,bcm2835"; + +- frag0: fragment@0 { +- target = <&i2c_arm>; ++ fragment@0 { ++ target = <&i2cbus>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; +@@ -22,41 +24,11 @@ + }; + }; + +- fragment@100 { +- target = <&i2c0if>; +- __dormant__ { +- status = "okay"; +- }; +- }; +- +- fragment@101 { +- target = <&i2c0mux>; +- __dormant__ { +- status = "okay"; +- }; +- }; +- + __overrides__ { + pcf8574 = <&pcf857x>,"compatible=nxp,pcf8574", <&pcf857x>,"reg:0=0x20"; + pcf8574a = <&pcf857x>,"compatible=nxp,pcf8574a", <&pcf857x>,"reg:0=0x38"; + pcf8575 = <&pcf857x>,"compatible=nxp,pcf8575", <&pcf857x>,"reg:0=0x20"; +- pca8574 = <&pcf857x>,"compatible=nxp,pca8574", <&pcf857x>,"reg:0=0x20"; ++ pca8574 = <&pcf857x>,"compatible=nxp,pca8574", <&pcf857x>,"reg:0=0x20"; + addr = <&pcf857x>,"reg:0"; +- i2c0 = <&frag0>, "target:0=",<&i2c0>, +- <0>,"+100+101"; +- i2c_csi_dsi = <&frag0>, "target:0=",<&i2c_csi_dsi>, +- <0>,"+100+101"; +- i2c_csi_dsi0 = <&frag0>, "target:0=",<&i2c_csi_dsi0>, +- <0>,"+100+101"; +- i2c3 = <&frag0>, "target?=0", +- <&frag0>, "target-path=i2c3"; +- i2c4 = <&frag0>, "target?=0", +- <&frag0>, "target-path=i2c4"; +- i2c5 = <&frag0>, "target?=0", +- <&frag0>, "target-path=i2c5"; +- i2c6 = <&frag0>, "target?=0", +- <&frag0>, "target-path=i2c6"; +- i2c-path = <&frag0>, "target?=0", +- <&frag0>, "target-path"; + }; + }; +--- a/arch/arm/boot/dts/overlays/sc16is750-i2c-overlay.dts ++++ b/arch/arm/boot/dts/overlays/sc16is750-i2c-overlay.dts +@@ -1,15 +1,16 @@ + /dts-v1/; + /plugin/; + ++#include "i2c-buses.dtsi" ++ + / { + compatible = "brcm,bcm2835"; + +- frag0: fragment@0 { +- target = <&i2c_arm>; ++ fragment@0 { ++ target = <&i2cbus>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; +- status = "okay"; + + sc16is750: sc16is750@48 { + compatible = "nxp,sc16is750"; +@@ -48,40 +49,10 @@ + }; + }; + +- fragment@100 { +- target = <&i2c0if>; +- __dormant__ { +- status = "okay"; +- }; +- }; +- +- fragment@101 { +- target = <&i2c0mux>; +- __dormant__ { +- status = "okay"; +- }; +- }; +- + __overrides__ { + int_pin = <&sc16is750>,"interrupts:0", <&int_pins>,"brcm,pins:0", + <&int_pins>,"reg:0"; + addr = <&sc16is750>,"reg:0", <&sc16is750_clk>,"name"; + xtal = <&sc16is750_clk>,"clock-frequency:0"; +- i2c0 = <&frag0>, "target:0=",<&i2c0>, +- <0>,"+100+101"; +- i2c_csi_dsi = <&frag0>, "target:0=",<&i2c_csi_dsi>, +- <0>,"+100+101"; +- i2c_csi_dsi0 = <&frag0>, "target:0=",<&i2c_csi_dsi0>, +- <0>,"+100+101"; +- i2c3 = <&frag0>, "target?=0", +- <&frag0>, "target-path=i2c3"; +- i2c4 = <&frag0>, "target?=0", +- <&frag0>, "target-path=i2c4"; +- i2c5 = <&frag0>, "target?=0", +- <&frag0>, "target-path=i2c5"; +- i2c6 = <&frag0>, "target?=0", +- <&frag0>, "target-path=i2c6"; +- i2c-path = <&frag0>, "target?=0", +- <&frag0>, "target-path"; + }; + }; +--- a/arch/arm/boot/dts/overlays/sc16is752-i2c-overlay.dts ++++ b/arch/arm/boot/dts/overlays/sc16is752-i2c-overlay.dts +@@ -1,15 +1,16 @@ + /dts-v1/; + /plugin/; + ++#include "i2c-buses.dtsi" ++ + / { + compatible = "brcm,bcm2835"; + +- frag0: fragment@0 { +- target = <&i2c_arm>; ++ fragment@0 { ++ target = <&i2cbus>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; +- status = "okay"; + + sc16is752: sc16is752@48 { + compatible = "nxp,sc16is752"; +@@ -48,40 +49,10 @@ + }; + }; + +- fragment@100 { +- target = <&i2c0if>; +- __dormant__ { +- status = "okay"; +- }; +- }; +- +- fragment@101 { +- target = <&i2c0mux>; +- __dormant__ { +- status = "okay"; +- }; +- }; +- + __overrides__ { + int_pin = <&sc16is752>,"interrupts:0", <&int_pins>,"brcm,pins:0", + <&int_pins>,"reg:0"; + addr = <&sc16is752>,"reg:0",<&sc16is752_clk>,"name"; + xtal = <&sc16is752_clk>,"clock-frequency:0"; +- i2c0 = <&frag0>, "target:0=",<&i2c0>, +- <0>,"+100+101"; +- i2c_csi_dsi = <&frag0>, "target:0=",<&i2c_csi_dsi>, +- <0>,"+100+101"; +- i2c_csi_dsi0 = <&frag0>, "target:0=",<&i2c_csi_dsi0>, +- <0>,"+100+101"; +- i2c3 = <&frag0>, "target?=0", +- <&frag0>, "target-path=i2c3"; +- i2c4 = <&frag0>, "target?=0", +- <&frag0>, "target-path=i2c4"; +- i2c5 = <&frag0>, "target?=0", +- <&frag0>, "target-path=i2c5"; +- i2c6 = <&frag0>, "target?=0", +- <&frag0>, "target-path=i2c6"; +- i2c-path = <&frag0>, "target?=0", +- <&frag0>, "target-path"; + }; + }; +--- a/arch/arm/boot/dts/overlays/seeed-can-fd-hat-v2-overlay.dts ++++ b/arch/arm/boot/dts/overlays/seeed-can-fd-hat-v2-overlay.dts +@@ -98,8 +98,9 @@ + }; + }; + fragment@8 { +- target = <&i2cbus>; ++ target = <&i2c_arm>; + __overlay__ { ++ status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + pcf85063@51 { +@@ -108,10 +109,4 @@ + }; + }; + }; +- fragment@9 { +- target = <&i2c_arm>; +- i2cbus: __overlay__ { +- status = "okay"; +- }; +- }; + }; +--- a/arch/arm/boot/dts/overlays/vc4-kms-dsi-7inch-overlay.dts ++++ b/arch/arm/boot/dts/overlays/vc4-kms-dsi-7inch-overlay.dts +@@ -1,4 +1,4 @@ +-/* ++ /* + * Device Tree overlay for RaspberryPi 7" Touchscreen panel + * + */ +@@ -8,6 +8,11 @@ + + #include "edt-ft5406.dtsi" + ++&ft5406 { ++ vcc-supply = <®_display>; ++ reset-gpio = <®_display 1 1>; ++}; ++ + / { + /* No compatible as it will have come from edt-ft5406.dtsi */ + +@@ -77,7 +82,7 @@ + + i2c_frag: fragment@2 { + target = <&i2c_csi_dsi>; +- __overlay__ { ++ i2cbus: __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; +@@ -104,18 +109,10 @@ + status = "okay"; + }; + }; +- fragment@5 { +- target = <&ft5406>; +- __overlay__ { +- vcc-supply = <®_display>; +- reset-gpio = <®_display 1 1>; +- }; +- }; + + __overrides__ { + dsi0 = <&dsi_frag>, "target:0=",<&dsi0>, + <&i2c_frag>, "target:0=",<&i2c_csi_dsi0>, +- <&ts_i2c_frag>, "target:0=",<&i2c_csi_dsi0>, + <&panel_disp>, "reg:0=0", + <®_bridge>, "reg:0=0", + <®_bridge>, "regulator-name=bridge_reg_0"; +--- a/arch/arm/boot/dts/overlays/vc4-kms-dsi-waveshare-800x480-overlay.dts ++++ b/arch/arm/boot/dts/overlays/vc4-kms-dsi-waveshare-800x480-overlay.dts +@@ -9,6 +9,11 @@ + + #include "edt-ft5406.dtsi" + ++&ft5406 { ++ vcc-supply = <®_display>; ++ reset-gpio = <®_display 1 1>; ++}; ++ + / { + /* No compatible as it will have come from edt-ft5406.dtsi */ + +@@ -73,7 +78,7 @@ + + i2c_frag: fragment@2 { + target = <&i2c_csi_dsi>; +- __overlay__ { ++ i2cbus: __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; +@@ -100,18 +105,10 @@ + status = "okay"; + }; + }; +- fragment@5 { +- target = <&ft5406>; +- __overlay__ { +- vcc-supply = <®_display>; +- reset-gpio = <®_display 1 1>; +- }; +- }; + + __overrides__ { + dsi0 = <&dsi_frag>, "target:0=",<&dsi0>, + <&i2c_frag>, "target:0=",<&i2c_csi_dsi0>, +- <&ts_i2c_frag>, "target:0=",<&i2c_csi_dsi0>, + <®_bridge>, "reg:0=0", + <®_bridge>, "regulator-name=bridge_reg_0"; + disable_touch = <&ft5406>, "status=disabled"; diff --git a/target/linux/bcm27xx/patches-6.6/950-1529-misc-rp1-pio-SM_CONFIG_XFER32-larger-DMA-bufs.patch b/target/linux/bcm27xx/patches-6.6/950-1529-misc-rp1-pio-SM_CONFIG_XFER32-larger-DMA-bufs.patch new file mode 100644 index 00000000000000..a084ec698b03dd --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1529-misc-rp1-pio-SM_CONFIG_XFER32-larger-DMA-bufs.patch @@ -0,0 +1,63 @@ +From 8a08b4ad6dbd48a826b3052e52a4fdc88c3ac36e Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 30 Jan 2025 15:26:39 +0000 +Subject: [PATCH] misc: rp1-pio: SM_CONFIG_XFER32 = larger DMA bufs + +Add an ioctl type - SM_CONFIG_XFER32 - that takes uints for the buf_size +and buf_count values. + +Signed-off-by: Phil Elwell +--- + drivers/misc/rp1-pio.c | 9 +++++++++ + include/uapi/misc/rp1_pio_if.h | 8 ++++++++ + 2 files changed, 17 insertions(+) + +--- a/drivers/misc/rp1-pio.c ++++ b/drivers/misc/rp1-pio.c +@@ -710,6 +710,14 @@ static int rp1_pio_sm_config_xfer_user(s + args->buf_size, args->buf_count); + } + ++static int rp1_pio_sm_config_xfer32_user(struct rp1_pio_client *client, void *param) ++{ ++ struct rp1_pio_sm_config_xfer32_args *args = param; ++ ++ return rp1_pio_sm_config_xfer_internal(client, args->sm, args->dir, ++ args->buf_size, args->buf_count); ++} ++ + static int rp1_pio_sm_tx_user(struct rp1_pio_device *pio, struct dma_info *dma, + const void __user *userbuf, size_t bytes) + { +@@ -970,6 +978,7 @@ struct handler_info { + HANDLER(SM_CONFIG_XFER, sm_config_xfer_user), + HANDLER(SM_XFER_DATA, sm_xfer_data_user), + HANDLER(SM_XFER_DATA32, sm_xfer_data32_user), ++ HANDLER(SM_CONFIG_XFER32, sm_config_xfer32_user), + + HANDLER(CAN_ADD_PROGRAM, can_add_program), + HANDLER(ADD_PROGRAM, add_program), +--- a/include/uapi/misc/rp1_pio_if.h ++++ b/include/uapi/misc/rp1_pio_if.h +@@ -160,6 +160,13 @@ struct rp1_pio_sm_config_xfer_args { + uint16_t buf_count; + }; + ++struct rp1_pio_sm_config_xfer32_args { ++ uint16_t sm; ++ uint16_t dir; ++ uint32_t buf_size; ++ uint32_t buf_count; ++}; ++ + struct rp1_pio_sm_xfer_data_args { + uint16_t sm; + uint16_t dir; +@@ -185,6 +192,7 @@ struct rp1_access_hw_args { + #define PIO_IOC_SM_CONFIG_XFER _IOW(PIO_IOC_MAGIC, 0, struct rp1_pio_sm_config_xfer_args) + #define PIO_IOC_SM_XFER_DATA _IOW(PIO_IOC_MAGIC, 1, struct rp1_pio_sm_xfer_data_args) + #define PIO_IOC_SM_XFER_DATA32 _IOW(PIO_IOC_MAGIC, 2, struct rp1_pio_sm_xfer_data32_args) ++#define PIO_IOC_SM_CONFIG_XFER32 _IOW(PIO_IOC_MAGIC, 3, struct rp1_pio_sm_config_xfer32_args) + + #define PIO_IOC_READ_HW _IOW(PIO_IOC_MAGIC, 8, struct rp1_access_hw_args) + #define PIO_IOC_WRITE_HW _IOW(PIO_IOC_MAGIC, 9, struct rp1_access_hw_args) diff --git a/target/linux/bcm27xx/patches-6.6/950-1530-spi-dw-Wait-for-idle-after-TX.patch b/target/linux/bcm27xx/patches-6.6/950-1530-spi-dw-Wait-for-idle-after-TX.patch new file mode 100644 index 00000000000000..fa32b711960def --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1530-spi-dw-Wait-for-idle-after-TX.patch @@ -0,0 +1,29 @@ +From 54a442deb925c37346abbbcc566234757925910c Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 3 Feb 2025 17:50:20 +0000 +Subject: [PATCH] spi: dw: Wait for idle after TX + +If this is a DMA transfer, and if there is no simultaneous RX transfer, +wait for the interface to go idle before reporting that TX is done. + +Link: https://forums.raspberrypi.com/viewtopic.php?t=383027 + +Signed-off-by: Phil Elwell +--- + drivers/spi/spi-dw-dma.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/spi/spi-dw-dma.c ++++ b/drivers/spi/spi-dw-dma.c +@@ -304,6 +304,11 @@ static int dw_spi_dma_wait_tx_done(struc + return -EIO; + } + ++ if (!xfer->rx_buf) { ++ while (dw_readl(dws, DW_SPI_SR) & DW_SPI_SR_BUSY) ++ cpu_relax(); ++ } ++ + return 0; + } + diff --git a/target/linux/bcm27xx/patches-6.6/950-1531-misc-rp1-pio-Error-out-on-incompatible-firmware.patch b/target/linux/bcm27xx/patches-6.6/950-1531-misc-rp1-pio-Error-out-on-incompatible-firmware.patch new file mode 100644 index 00000000000000..2fa70f38a1d594 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1531-misc-rp1-pio-Error-out-on-incompatible-firmware.patch @@ -0,0 +1,42 @@ +From e0a21a407b78477aa530800255d53405950cb1fb Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 3 Feb 2025 14:44:08 +0000 +Subject: [PATCH] misc: rp1-pio: Error out on incompatible firmware + +If the RP1 firmware has reported an error then return that from the PIO +probe function, otherwise defer the probing. + +Link: https://github.com/raspberrypi/linux/issues/6642 + +Signed-off-by: Phil Elwell +--- + drivers/misc/rp1-pio.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +--- a/drivers/misc/rp1-pio.c ++++ b/drivers/misc/rp1-pio.c +@@ -1277,8 +1277,10 @@ static int rp1_pio_probe(struct platform + return dev_err_probe(dev, pdev->id, "alias is missing\n"); + + fw = devm_rp1_firmware_get(dev, dev->of_node); +- if (IS_ERR_OR_NULL(fw)) +- return dev_err_probe(dev, -ENOENT, "failed to contact RP1 firmware\n"); ++ if (!fw) ++ return dev_err_probe(dev, -EPROBE_DEFER, "failed to find RP1 firmware driver\n"); ++ if (IS_ERR(fw)) ++ return dev_err_probe(dev, PTR_ERR(fw), "failed to contact RP1 firmware\n"); + ret = rp1_firmware_get_feature(fw, FOURCC_PIO, &op_base, &op_count); + if (ret < 0) + return ret; +@@ -1355,6 +1357,11 @@ static void rp1_pio_remove(struct platfo + + if (g_pio == pio) + g_pio = NULL; ++ ++ device_destroy(pio->dev_class, pio->dev_num); ++ cdev_del(&pio->cdev); ++ class_destroy(pio->dev_class); ++ unregister_chrdev_region(pio->dev_num, 1); + } + + static const struct of_device_id rp1_pio_ids[] = { diff --git a/target/linux/bcm27xx/patches-6.6/950-1532-firmware-rp1-Linger-on-firmware-failure.patch b/target/linux/bcm27xx/patches-6.6/950-1532-firmware-rp1-Linger-on-firmware-failure.patch new file mode 100644 index 00000000000000..cf0bbc8c49c731 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1532-firmware-rp1-Linger-on-firmware-failure.patch @@ -0,0 +1,103 @@ +From 3f60adc5ce8238996ec43d2b76a6e38e46f8271b Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 3 Feb 2025 14:51:52 +0000 +Subject: [PATCH] firmware: rp1: Linger on firmware failure + +To avoid pointless retries, let the probe function succeed if the +firmware interface is configured correctly but the firmware is +incompatible. The value of the private drvdata field holds the outcome. + +Link: https://github.com/raspberrypi/linux/issues/6642 + +Signed-off-by: Phil Elwell +--- + drivers/firmware/rp1.c | 28 ++++++++++++++-------------- + 1 file changed, 14 insertions(+), 14 deletions(-) + +--- a/drivers/firmware/rp1.c ++++ b/drivers/firmware/rp1.c +@@ -114,7 +114,8 @@ static void rp1_firmware_delete(struct k + + void rp1_firmware_put(struct rp1_firmware *fw) + { +- kref_put(&fw->consumers, rp1_firmware_delete); ++ if (!IS_ERR_OR_NULL(fw)) ++ kref_put(&fw->consumers, rp1_firmware_delete); + } + EXPORT_SYMBOL_GPL(rp1_firmware_put); + +@@ -157,7 +158,7 @@ struct rp1_firmware *rp1_firmware_get(st + const char *match = rp1_firmware_of_match[0].compatible; + struct platform_device *pdev; + struct device_node *fwnode; +- struct rp1_firmware *fw; ++ struct rp1_firmware *fw = NULL; + + if (!client) + return NULL; +@@ -166,17 +167,17 @@ struct rp1_firmware *rp1_firmware_get(st + return NULL; + if (!of_device_is_compatible(fwnode, match)) { + of_node_put(fwnode); +- return NULL; ++ return ERR_PTR(-ENXIO); + } + + pdev = of_find_device_by_node(fwnode); + of_node_put(fwnode); + + if (!pdev) +- goto err_exit; ++ return ERR_PTR(-ENXIO); + + fw = platform_get_drvdata(pdev); +- if (!fw) ++ if (IS_ERR_OR_NULL(fw)) + goto err_exit; + + if (!kref_get_unless_zero(&fw->consumers)) +@@ -188,7 +189,7 @@ struct rp1_firmware *rp1_firmware_get(st + + err_exit: + put_device(&pdev->dev); +- return NULL; ++ return fw; + } + EXPORT_SYMBOL_GPL(rp1_firmware_get); + +@@ -204,8 +205,8 @@ struct rp1_firmware *devm_rp1_firmware_g + int ret; + + fw = rp1_firmware_get(client); +- if (!fw) +- return NULL; ++ if (IS_ERR_OR_NULL(fw)) ++ return fw; + + ret = devm_add_action_or_reset(dev, devm_rp1_firmware_put, fw); + if (ret) +@@ -270,19 +271,18 @@ static int rp1_firmware_probe(struct pla + init_completion(&fw->c); + kref_init(&fw->consumers); + +- platform_set_drvdata(pdev, fw); +- + ret = rp1_firmware_message(fw, GET_FIRMWARE_VERSION, + NULL, 0, &version, sizeof(version)); + if (ret == sizeof(version)) { + dev_info(dev, "RP1 Firmware version %08x%08x%08x%08x%08x\n", + version[0], version[1], version[2], version[3], version[4]); +- ret = 0; +- } else if (ret >= 0) { +- ret = -EIO; ++ platform_set_drvdata(pdev, fw); ++ } else { ++ rp1_firmware_put(fw); ++ platform_set_drvdata(pdev, ERR_PTR(-ENOENT)); + } + +- return ret; ++ return 0; + } + + static int rp1_firmware_remove(struct platform_device *pdev) diff --git a/target/linux/bcm27xx/patches-6.6/950-1533-mailbox-rp1-Don-t-claim-channels-in-of_xlate.patch b/target/linux/bcm27xx/patches-6.6/950-1533-mailbox-rp1-Don-t-claim-channels-in-of_xlate.patch new file mode 100644 index 00000000000000..5d6014d68f2f09 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1533-mailbox-rp1-Don-t-claim-channels-in-of_xlate.patch @@ -0,0 +1,30 @@ +From 4d577c42b47dfffda80da995fafd5b16fdb242e2 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 4 Feb 2025 13:18:45 +0000 +Subject: [PATCH] mailbox: rp1: Don't claim channels in of_xlate + +The of_xlate method saves the calculated event mask in the con_priv +field. It also rejects subsequent attempt to use that channel because +the mask is non-zero, which causes a repeated instantiation of a client +driver to fail. + +The of_xlate method is not meant to be a point of resource acquisition. +Leave the con_priv initialisation, but drop the test that it was +previously zero. + +Signed-off-by: Phil Elwell +--- + drivers/mailbox/rp1-mailbox.c | 2 -- + 1 file changed, 2 deletions(-) + +--- a/drivers/mailbox/rp1-mailbox.c ++++ b/drivers/mailbox/rp1-mailbox.c +@@ -133,8 +133,6 @@ static struct mbox_chan *rp1_mbox_xlate( + return ERR_PTR(-EINVAL); + + chan = &mbox->chans[doorbell]; +- if (chan->con_priv) +- return ERR_PTR(-EBUSY); + + chan->con_priv = (void *)(uintptr_t)(1 << doorbell); + diff --git a/target/linux/bcm27xx/patches-6.6/950-1534-fixup-spi-dw-Wait-for-idle-after-TX.patch b/target/linux/bcm27xx/patches-6.6/950-1534-fixup-spi-dw-Wait-for-idle-after-TX.patch new file mode 100644 index 00000000000000..9ac62a3407d59a --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1534-fixup-spi-dw-Wait-for-idle-after-TX.patch @@ -0,0 +1,25 @@ +From fab0093d88452972f05f4b13e91e31d00b55421a Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 4 Feb 2025 15:25:30 +0000 +Subject: [PATCH] fixup! spi: dw: Wait for idle after TX + +Relax a bit harder - transmission of the last bits may take a while. + +Signed-off-by: Phil Elwell +--- + drivers/spi/spi-dw-dma.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/spi/spi-dw-dma.c ++++ b/drivers/spi/spi-dw-dma.c +@@ -305,8 +305,9 @@ static int dw_spi_dma_wait_tx_done(struc + } + + if (!xfer->rx_buf) { ++ delay.value = dws->n_bytes * BITS_PER_BYTE; + while (dw_readl(dws, DW_SPI_SR) & DW_SPI_SR_BUSY) +- cpu_relax(); ++ spi_delay_exec(&delay, xfer); + } + + return 0; diff --git a/target/linux/bcm27xx/patches-6.6/950-1535-dtoverlays-adds-support-for-Hifiberry-ADC8x-to-the-D.patch b/target/linux/bcm27xx/patches-6.6/950-1535-dtoverlays-adds-support-for-Hifiberry-ADC8x-to-the-D.patch new file mode 100644 index 00000000000000..a742b30a345cfb --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1535-dtoverlays-adds-support-for-Hifiberry-ADC8x-to-the-D.patch @@ -0,0 +1,76 @@ +From 2cdd83392ba025cc88072c0153d443fc59919960 Mon Sep 17 00:00:00 2001 +From: j-schambacher +Date: Mon, 10 Feb 2025 14:58:34 +0100 +Subject: [PATCH] dtoverlays: adds support for Hifiberry ADC8x to the DAC8x + +Allows the usage of ADC8x stacked on top of the DAC8x. +Activates all I2S pins and uses now the dummy-dai instead +of the formerly used pcm5102 to allow the use of a +capture device, too. The simple card driver will +probe for the ADC8x and may activate the 8 channel +capture. Uses GPIO5 for detection. + +Signed-off-by: j-schambacher +--- + arch/arm/boot/dts/overlays/README | 3 +++ + .../boot/dts/overlays/hifiberry-dac8x-overlay.dts | 14 ++++++++++---- + 2 files changed, 13 insertions(+), 4 deletions(-) + +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -1879,6 +1879,9 @@ Params: + + Name: hifiberry-dac8x + Info: Configures the HifiBerry DAC8X audio cards (only on Pi5) ++ This driver also detects a stacked ADC8x and activates the ++ capture capabilities. ++ Note: for standalone use of the ADC8x activate the ADC8x module. + Load: dtoverlay=hifiberry-dac8x + Params: + +--- a/arch/arm/boot/dts/overlays/hifiberry-dac8x-overlay.dts ++++ b/arch/arm/boot/dts/overlays/hifiberry-dac8x-overlay.dts +@@ -1,7 +1,10 @@ ++// SPDX-License-Identifier: GPL-2.0 + // Definitions for HiFiBerry DAC8x + /dts-v1/; + /plugin/; + ++#include ++ + / { + compatible = "brcm,bcm2712"; + +@@ -10,8 +13,10 @@ + __overlay__ { + rp1_i2s0_dac8x: rp1_i2s0_dac8x { + function = "i2s0"; +- pins = "gpio18", "gpio19", "gpio21", +- "gpio23", "gpio25", "gpio27"; ++ pins = "gpio18", "gpio19", "gpio20", ++ "gpio21", "gpio22", "gpio23", ++ "gpio24", "gpio25", "gpio26", ++ "gpio27"; + bias-disable; + status = "okay"; + }; +@@ -30,9 +35,9 @@ + fragment@2 { + target-path = "/"; + __overlay__ { +- pcm5102a-codec { ++ dummy-codec { + #sound-dai-cells = <0>; +- compatible = "ti,pcm5102a"; ++ compatible = "snd-soc-dummy"; + status = "okay"; + }; + }; +@@ -43,6 +48,7 @@ + __overlay__ { + compatible = "hifiberry,hifiberry-dac8x"; + i2s-controller = <&i2s_clk_producer>; ++ hasadc-gpio = <&gpio 5 GPIO_ACTIVE_LOW>; + status = "okay"; + }; + }; diff --git a/target/linux/bcm27xx/patches-6.6/950-1536-ASoC-adds-ADC8x-support-to-the-Hifiberry-DAC8x.patch b/target/linux/bcm27xx/patches-6.6/950-1536-ASoC-adds-ADC8x-support-to-the-Hifiberry-DAC8x.patch new file mode 100644 index 00000000000000..fec52cc60f1d05 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1536-ASoC-adds-ADC8x-support-to-the-Hifiberry-DAC8x.patch @@ -0,0 +1,75 @@ +From d664f45f77423b03e5a435e480822075c03331bd Mon Sep 17 00:00:00 2001 +From: j-schambacher +Date: Mon, 10 Feb 2025 15:08:48 +0100 +Subject: [PATCH] ASoC: adds ADC8x support to the Hifiberry DAC8x + +The driver probes for the ADC8x which can be stacked on top +of the DAC8x. It enables a symmetric 8 channel capture using +the dummy-dai. + +Signed-off-by: j-schambacher +--- + sound/soc/bcm/rpi-simple-soundcard.c | 38 +++++++++++++++++++++++++--- + 1 file changed, 34 insertions(+), 4 deletions(-) + +--- a/sound/soc/bcm/rpi-simple-soundcard.c ++++ b/sound/soc/bcm/rpi-simple-soundcard.c +@@ -354,16 +354,46 @@ static struct snd_rpi_simple_drvdata drv + .dai = snd_hifiberry_dac_dai, + }; + ++SND_SOC_DAILINK_DEFS(hifiberry_dac8x, ++ DAILINK_COMP_ARRAY(COMP_EMPTY()), ++ DAILINK_COMP_ARRAY(COMP_CODEC("snd-soc-dummy", "snd-soc-dummy-dai")), ++ DAILINK_COMP_ARRAY(COMP_EMPTY())); ++ + static int hifiberry_dac8x_init(struct snd_soc_pcm_runtime *rtd) + { + struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); ++ struct snd_soc_card *card = rtd->card; ++ struct gpio_desc *gpio_desc; ++ bool has_adc; + +- /* override the defaults to reflect 4 x PCM5102A on the card +- * and limit the sample rate to 192ksps +- */ ++ /* Configure the codec for 8 channel playback */ + codec_dai->driver->playback.channels_max = 8; + codec_dai->driver->playback.rates = SNDRV_PCM_RATE_8000_192000; + ++ /* Activate capture based on ADC8x detection */ ++ gpio_desc = devm_gpiod_get(card->dev, "hasadc", GPIOD_IN); ++ if (IS_ERR(gpio_desc)) { ++ dev_err(card->dev, "Failed to get GPIO: %ld\n", PTR_ERR(gpio_desc)); ++ return PTR_ERR(gpio_desc); ++ } ++ ++ has_adc = gpiod_get_value(gpio_desc); ++ ++ if (has_adc) { ++ struct snd_soc_dai_link *dai = rtd->dai_link; ++ ++ dev_info(card->dev, "ADC8x detected: capture enabled\n"); ++ codec_dai->driver->symmetric_rate = 1; ++ codec_dai->driver->symmetric_channels = 1; ++ codec_dai->driver->symmetric_sample_bits = 1; ++ codec_dai->driver->capture.rates = SNDRV_PCM_RATE_8000_192000; ++ dai->name = "HiFiBerry DAC8xADC8x"; ++ dai->stream_name = "HiFiBerry DAC8xADC8x HiFi"; ++ } else { ++ dev_info(card->dev, "no ADC8x detected\n"); ++ rtd->dai_link->playback_only = 1; // Disable capture ++ } ++ + return 0; + } + +@@ -375,7 +405,7 @@ static struct snd_soc_dai_link snd_hifib + SND_SOC_DAIFMT_NB_NF | + SND_SOC_DAIFMT_CBS_CFS, + .init = hifiberry_dac8x_init, +- SND_SOC_DAILINK_REG(hifiberry_dac), ++ SND_SOC_DAILINK_REG(hifiberry_dac8x), + }, + }; + diff --git a/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch b/target/linux/bcm27xx/patches-6.6/950-1539-Reapply-usb-dwc3-Set-DMA-and-coherent-masks-early.patch similarity index 81% rename from target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch rename to target/linux/bcm27xx/patches-6.6/950-1539-Reapply-usb-dwc3-Set-DMA-and-coherent-masks-early.patch index a087faa35bc82e..327819f289f09e 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1539-Reapply-usb-dwc3-Set-DMA-and-coherent-masks-early.patch @@ -1,50 +1,9 @@ -From fa846f5991de6c37db1f40e26a39f52c130f2bc7 Mon Sep 17 00:00:00 2001 -From: Jonathan Bell -Date: Mon, 13 Sep 2021 11:14:32 +0100 -Subject: [PATCH 0519/1085] usb: dwc3: Set DMA and coherent masks early +From 1b1e75ae7d69816609a95ff2fb92729a2ff04d8e Mon Sep 17 00:00:00 2001 +From: Dom Cobley +Date: Mon, 10 Feb 2025 13:26:33 +0000 +Subject: [PATCH] Reapply "usb: dwc3: Set DMA and coherent masks early" -dwc3 allocates scratch and event buffers in the top-level driver. Hack the -probe function to set the DMA mask before trying to allocate these. - -I think the event buffers are only used in device mode, but the scratch -buffers may be used if core hibernation is enabled. - -usb: dwc3: add support for new DT quirks - -Apply the optional axi-pipe-limit and dis-in-autoretry-quirk properties -during driver probe. - -Signed-off-by: Jonathan Bell - -phy: phy-brcm-usb: Add 2712 support - -usb: dwc3: if the host controller instance number is present in DT, use it - -If two instances of a dwc3 host controller are specified in devicetree, -then the probe order may be arbitrary which results in the device names -swapping on a per-boot basis. - -If a "usb" alias with the instance number is specified, then use -that to construct the device name instead of autogenerating one. - -Signed-off-by: Jonathan Bell - -rp1 dwc3 changes - -drivers: usb: dwc3: allow setting GTXTHRCFG on dwc_usb3.0 hardware - -Equivalent register fields exist in the SuperSpeed Host version of the -hardware, so allow the use of TX thresholds if specified in devicetree. - -Signed-off-by: Jonathan Bell - -drivers: usb: dwc3: remove downstream quirk dis-in-autoretry - -Upstream have unilaterally disabled the feature. - -Partially reverts 6e9142a26ee0fdc3a5adc49ed6cedc0b16ec2ed1 (downstream) - -Signed-off-by: Jonathan Bell +This reverts commit 09dfdf6129532e19b2cfd4992d1d09e7119ccd48. --- drivers/phy/broadcom/Kconfig | 2 +- .../phy/broadcom/phy-brcm-usb-init-synopsys.c | 59 +++++++++++++++++++ @@ -246,7 +205,7 @@ Signed-off-by: Jonathan Bell ret = dwc3_phy_power_on(dwc); if (ret) goto err_exit_phy; -@@ -1377,6 +1397,24 @@ static int dwc3_core_init(struct dwc3 *d +@@ -1386,6 +1406,24 @@ static int dwc3_core_init(struct dwc3 *d dwc3_config_threshold(dwc); @@ -271,7 +230,7 @@ Signed-off-by: Jonathan Bell return 0; err_power_off_phy: -@@ -1520,6 +1558,7 @@ static void dwc3_get_properties(struct d +@@ -1529,6 +1567,7 @@ static void dwc3_get_properties(struct d u8 tx_thr_num_pkt_prd = 0; u8 tx_max_burst_prd = 0; u8 tx_fifo_resize_max_num; @@ -279,7 +238,7 @@ Signed-off-by: Jonathan Bell /* default to highest possible threshold */ lpm_nyet_threshold = 0xf; -@@ -1540,6 +1579,9 @@ static void dwc3_get_properties(struct d +@@ -1549,6 +1588,9 @@ static void dwc3_get_properties(struct d */ tx_fifo_resize_max_num = 6; @@ -289,7 +248,7 @@ Signed-off-by: Jonathan Bell dwc->maximum_speed = usb_get_maximum_speed(dev); dwc->max_ssp_rate = usb_get_maximum_ssp_rate(dev); dwc->dr_mode = usb_get_dr_mode(dev); -@@ -1654,6 +1696,9 @@ static void dwc3_get_properties(struct d +@@ -1669,6 +1711,9 @@ static void dwc3_get_properties(struct d dwc->dis_split_quirk = device_property_read_bool(dev, "snps,dis-split-quirk"); @@ -299,7 +258,7 @@ Signed-off-by: Jonathan Bell dwc->lpm_nyet_threshold = lpm_nyet_threshold; dwc->tx_de_emphasis = tx_de_emphasis; -@@ -1671,6 +1716,8 @@ static void dwc3_get_properties(struct d +@@ -1686,6 +1731,8 @@ static void dwc3_get_properties(struct d dwc->tx_thr_num_pkt_prd = tx_thr_num_pkt_prd; dwc->tx_max_burst_prd = tx_max_burst_prd; @@ -308,7 +267,7 @@ Signed-off-by: Jonathan Bell dwc->tx_fifo_resize_max_num = tx_fifo_resize_max_num; } -@@ -1963,6 +2010,12 @@ static int dwc3_probe(struct platform_de +@@ -1978,6 +2025,12 @@ static int dwc3_probe(struct platform_de if (IS_ERR(dwc->usb_psy)) return dev_err_probe(dev, PTR_ERR(dwc->usb_psy), "couldn't get usb power supply\n"); @@ -333,7 +292,7 @@ Signed-off-by: Jonathan Bell /* Global Debug LSP MUX Select */ #define DWC3_GDBGLSPMUX_ENDBC BIT(15) /* Host only */ #define DWC3_GDBGLSPMUX_HOSTSELECT(n) ((n) & 0x3fff) -@@ -1067,6 +1070,7 @@ struct dwc3_scratchpad_array { +@@ -1070,6 +1073,7 @@ struct dwc3_scratchpad_array { * @tx_max_burst_prd: max periodic ESS transmit burst size * @tx_fifo_resize_max_num: max number of fifos allocated during txfifo resize * @clear_stall_protocol: endpoint number that requires a delayed status phase @@ -341,7 +300,7 @@ Signed-off-by: Jonathan Bell * @hsphy_interface: "utmi" or "ulpi" * @connected: true when we're connected to a host, false otherwise * @softconnect: true when gadget connect is called, false when disconnect runs -@@ -1304,6 +1308,7 @@ struct dwc3 { +@@ -1311,6 +1315,7 @@ struct dwc3 { u8 tx_max_burst_prd; u8 tx_fifo_resize_max_num; u8 clear_stall_protocol; diff --git a/target/linux/bcm27xx/patches-6.6/950-1541-overlays-Add-OpenHydroponics-RootMaster-overlay.patch b/target/linux/bcm27xx/patches-6.6/950-1541-overlays-Add-OpenHydroponics-RootMaster-overlay.patch new file mode 100644 index 00000000000000..f16d0bdd29a270 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1541-overlays-Add-OpenHydroponics-RootMaster-overlay.patch @@ -0,0 +1,119 @@ +From 081eebdeccfd12e0aaba4b64c9f87b608777913b Mon Sep 17 00:00:00 2001 +From: Micke Prag +Date: Thu, 13 Feb 2025 22:08:43 +0100 +Subject: [PATCH] overlays: Add OpenHydroponics RootMaster overlay + +Signed-off-by: Micke Prag +--- + arch/arm/boot/dts/overlays/Makefile | 1 + + arch/arm/boot/dts/overlays/README | 7 ++ + .../boot/dts/overlays/rootmaster-overlay.dts | 77 +++++++++++++++++++ + 3 files changed, 85 insertions(+) + create mode 100644 arch/arm/boot/dts/overlays/rootmaster-overlay.dts + +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -228,6 +228,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ + qca7000-uart0.dtbo \ + ramoops.dtbo \ + ramoops-pi4.dtbo \ ++ rootmaster.dtbo \ + rotary-encoder.dtbo \ + rpi-backlight.dtbo \ + rpi-codeczero.dtbo \ +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -4084,6 +4084,13 @@ Params: base-addr Where to + console-size Size of non-panic dmesg captures (default 0) + + ++Name: rootmaster ++Info: Overlay for OpenHydroponics RootMaster board. ++ https://openhydroponics.com/hw/rootmaster ++Load: dtoverlay=rootmaster ++Params: ++ ++ + Name: rotary-encoder + Info: Overlay for GPIO connected rotary encoder. + Load: dtoverlay=rotary-encoder,= +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rootmaster-overlay.dts +@@ -0,0 +1,77 @@ ++// redo: ovmerge -c mcp251xfd-overlay.dts,spi0-0,interrupt=25 w1-gpio-overlay.dts,gpiopin=4 ++ ++/dts-v1/; ++/plugin/; ++ ++#include ++#include ++#include ++ ++/ { ++ compatible = "brcm,bcm2835"; ++ fragment@0 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ mcp251xfd_pins: mcp251xfd_spi0_0_pins { ++ brcm,pins = <25>; ++ brcm,function = ; ++ }; ++ }; ++ }; ++ fragment@2 { ++ target-path = "/clocks"; ++ __overlay__ { ++ clk_mcp251xfd_osc: mcp251xfd-spi0-0-osc { ++ #clock-cells = <0>; ++ compatible = "fixed-clock"; ++ clock-frequency = <40000000>; ++ }; ++ }; ++ }; ++ fragment@3 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ mcp251xfd@0 { ++ compatible = "microchip,mcp251xfd"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&mcp251xfd_pins>; ++ spi-max-frequency = <20000000>; ++ interrupt-parent = <&gpio>; ++ interrupts = <25 IRQ_TYPE_LEVEL_LOW>; ++ clocks = <&clk_mcp251xfd_osc>; ++ }; ++ }; ++ }; ++ fragment@4 { ++ target-path = "/"; ++ __overlay__ { ++ onewire@4 { ++ compatible = "w1-gpio"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&w1_pins>; ++ gpios = <&gpio 4 0>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ fragment@5 { ++ target = <&gpio>; ++ __overlay__ { ++ w1_pins: w1_pins@4 { ++ brcm,pins = <4>; ++ brcm,function = <0>; ++ brcm,pull = <0>; ++ }; ++ }; ++ }; ++}; diff --git a/target/linux/bcm27xx/patches-6.6/950-1542-media-i2c-arducam-pivariety-Fix-mutex-init-and-NULL-.patch b/target/linux/bcm27xx/patches-6.6/950-1542-media-i2c-arducam-pivariety-Fix-mutex-init-and-NULL-.patch new file mode 100644 index 00000000000000..784ae522f18ff5 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1542-media-i2c-arducam-pivariety-Fix-mutex-init-and-NULL-.patch @@ -0,0 +1,37 @@ +From 011cbf22d7583687ae18690185169e5da0be000a Mon Sep 17 00:00:00 2001 +From: Yuriy Pasichnyk +Date: Tue, 18 Feb 2025 16:20:31 +0200 +Subject: [PATCH] media: i2c: arducam-pivariety: Fix mutex init and NULL + pointer + +The mutex used in arducam-pivariety was not properly initialized, +which could lead to undefined behavior. This also caused a NULL +pointer dereference under certain conditions. + +This patch ensures the mutex is correctly initialized during probe +and prevents NULL pointer dereferences. + +Signed-off-by: Yuriy Pasichnyk +--- + drivers/media/i2c/arducam-pivariety.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/media/i2c/arducam-pivariety.c ++++ b/drivers/media/i2c/arducam-pivariety.c +@@ -1208,6 +1208,8 @@ static int pivariety_enum_controls(struc + if (ret) + return ret; + ++ mutex_init(&pivariety->mutex); ++ + index = 0; + while (1) { + ret = pivariety_write(pivariety, CTRL_INDEX_REG, index); +@@ -1295,6 +1297,7 @@ static int pivariety_enum_controls(struc + v4l2_ctrl_handler_setup(ctrl_hdlr); + return 0; + err: ++ mutex_destroy(&pivariety->mutex); + return -ENODEV; + } + diff --git a/target/linux/bcm27xx/patches-6.6/950-1543-misc-rp1-pio-Demote-fw-probe-error-to-warning.patch b/target/linux/bcm27xx/patches-6.6/950-1543-misc-rp1-pio-Demote-fw-probe-error-to-warning.patch new file mode 100644 index 00000000000000..af9c9f9e529204 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1543-misc-rp1-pio-Demote-fw-probe-error-to-warning.patch @@ -0,0 +1,32 @@ +From af9965a855a8c6c7140bbcccfa89eec7e90a993d Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 25 Feb 2025 12:16:33 +0000 +Subject: [PATCH] misc: rp1-pio: Demote fw probe error to warning + +Support for the RP1 firmware mailbox API is rolling out to Pi 5 EEPROM +images. For most users, the fact that the PIO is not available is no +cause for alarm. Change the message to a warning, so that it does not +appear with "quiet" in cmdline.txt. + +Link: https://github.com/raspberrypi/linux/issues/6642 + +Signed-off-by: Phil Elwell +--- + drivers/misc/rp1-pio.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/drivers/misc/rp1-pio.c ++++ b/drivers/misc/rp1-pio.c +@@ -1279,8 +1279,10 @@ static int rp1_pio_probe(struct platform + fw = devm_rp1_firmware_get(dev, dev->of_node); + if (!fw) + return dev_err_probe(dev, -EPROBE_DEFER, "failed to find RP1 firmware driver\n"); +- if (IS_ERR(fw)) +- return dev_err_probe(dev, PTR_ERR(fw), "failed to contact RP1 firmware\n"); ++ if (IS_ERR(fw)) { ++ dev_warn(dev, "failed to contact RP1 firmware\n"); ++ return PTR_ERR(fw); ++ } + ret = rp1_firmware_get_feature(fw, FOURCC_PIO, &op_base, &op_count); + if (ret < 0) + return ret; diff --git a/target/linux/bcm27xx/patches-6.6/950-1544-dts-Add-hogs-for-RP1-GPIO-46-48-on-CM5.patch b/target/linux/bcm27xx/patches-6.6/950-1544-dts-Add-hogs-for-RP1-GPIO-46-48-on-CM5.patch new file mode 100644 index 00000000000000..98eaf56ee69ce3 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1544-dts-Add-hogs-for-RP1-GPIO-46-48-on-CM5.patch @@ -0,0 +1,38 @@ +From a4e7897eef1ad4628572a6abfd30291209a0bf43 Mon Sep 17 00:00:00 2001 +From: Richard Oliver +Date: Tue, 25 Feb 2025 15:06:23 +0000 +Subject: [PATCH] dts: Add hogs for RP1 GPIO 46/48 on CM5 + +On Pi5 5, GPIOs 46/48 are made available on the 'CAM/DISP 1' connector as +'CD1_IO0_MICCLK'/'CD1_IO1_MICDAT1'. These GPIOs are not connected on +CM5. + +Add hogs for GPIO 46/48 on CM5 to prevent camera drivers from +inadvertently using them when connected to 'CAM/DISP 1' + +Signed-off-by: Richard Oliver +--- + arch/arm64/boot/dts/broadcom/bcm2712-rpi-cm5.dtsi | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +--- a/arch/arm64/boot/dts/broadcom/bcm2712-rpi-cm5.dtsi ++++ b/arch/arm64/boot/dts/broadcom/bcm2712-rpi-cm5.dtsi +@@ -734,6 +734,18 @@ spi10_cs_pins: &spi10_cs_gpio1 {}; + function = "vbus1"; + pins = "gpio42", "gpio43"; + }; ++ ++ micclk1_hog { ++ gpio-hog; ++ gpios = <46 GPIO_ACTIVE_HIGH>; ++ output-high; ++ }; ++ ++ micdat1_hog { ++ gpio-hog; ++ gpios = <48 GPIO_ACTIVE_HIGH>; ++ output-high; ++ }; + }; + + / { diff --git a/target/linux/bcm27xx/patches-6.6/950-1545-spi-rp2040-gpio-bridge-fix-gpiod-error-handling.patch b/target/linux/bcm27xx/patches-6.6/950-1545-spi-rp2040-gpio-bridge-fix-gpiod-error-handling.patch new file mode 100644 index 00000000000000..31e35a3bf2d876 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1545-spi-rp2040-gpio-bridge-fix-gpiod-error-handling.patch @@ -0,0 +1,25 @@ +From f8f3e202fb083906fbc98ef6ea445e424779c076 Mon Sep 17 00:00:00 2001 +From: Richard Oliver +Date: Tue, 25 Feb 2025 15:22:46 +0000 +Subject: [PATCH] spi: rp2040-gpio-bridge: fix gpiod error handling + +In some circumstances, devm_gpiod_get_array_optional() can return +PTR_ERR rather than NULL to indicate failure. Handle these cases. + +Signed-off-by: Richard Oliver +--- + drivers/spi/spi-rp2040-gpio-bridge.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/spi/spi-rp2040-gpio-bridge.c ++++ b/drivers/spi/spi-rp2040-gpio-bridge.c +@@ -956,7 +956,8 @@ static void rp2040_gbdg_parse_dt(struct + + rp2040_gbdg->fast_xfer_gpios = + devm_gpiod_get_array_optional(dev, "fast_xfer", GPIOD_ASIS); +- if (!rp2040_gbdg->fast_xfer_gpios) { ++ if (IS_ERR_OR_NULL(rp2040_gbdg->fast_xfer_gpios)) { ++ rp2040_gbdg->fast_xfer_gpios = NULL; + dev_info(dev, "Could not acquire fast_xfer-gpios\n"); + goto node_put; + } diff --git a/target/linux/bcm27xx/patches-6.6/950-1546-spi-rp2040-gpio-bridge-probe-Cfg-fast_xfer-clk.patch b/target/linux/bcm27xx/patches-6.6/950-1546-spi-rp2040-gpio-bridge-probe-Cfg-fast_xfer-clk.patch new file mode 100644 index 00000000000000..04b9ea60254e61 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1546-spi-rp2040-gpio-bridge-probe-Cfg-fast_xfer-clk.patch @@ -0,0 +1,37 @@ +From 2e071057fded90e789c0101498e45a1778be93fe Mon Sep 17 00:00:00 2001 +From: Richard Oliver +Date: Tue, 25 Feb 2025 15:27:59 +0000 +Subject: [PATCH] spi: rp2040-gpio-bridge: probe: Cfg fast_xfer clk + +Fast transfer mode requires that the first bit of data is clocked with a +rising edge. This can cause extra bits of data to be clocked on hardware +where the clock signal uses a pull-up. This change ensures that clk is +driven low before fast data transfer mode is entered. + +Signed-off-by: Richard Oliver +--- + drivers/spi/spi-rp2040-gpio-bridge.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/drivers/spi/spi-rp2040-gpio-bridge.c ++++ b/drivers/spi/spi-rp2040-gpio-bridge.c +@@ -617,7 +617,6 @@ static int rp2040_gbdg_fast_xfer(struct + &clock_mux); + + gpiod_direction_output(priv_data->fast_xfer_gpios->desc[0], 1); +- gpiod_direction_output(priv_data->fast_xfer_gpios->desc[1], 0); + + rp2040_gbdg_rp1_calc_offsets(priv_data->fast_xfer_data_index, + &data_bank, &data_offset); +@@ -989,6 +988,11 @@ static void rp2040_gbdg_parse_dt(struct + goto node_put; + } + ++ /* ++ * fast_xfer mode requires first data bit to be clocked on a rising ++ * edge. Configure as output-low here before fast_xfer mode is entered. ++ */ ++ gpiod_direction_output(rp2040_gbdg->fast_xfer_gpios->desc[1], 0); + node_put: + if (of_args[0].np) + of_node_put(of_args[0].np); diff --git a/target/linux/bcm27xx/patches-6.6/950-1547-fix-clang-compilation-error.patch b/target/linux/bcm27xx/patches-6.6/950-1547-fix-clang-compilation-error.patch new file mode 100644 index 00000000000000..13fa24beaf55f4 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1547-fix-clang-compilation-error.patch @@ -0,0 +1,30 @@ +From 1337c39626c14ca5e61b4cddbc097d87212a0b13 Mon Sep 17 00:00:00 2001 +From: KubaTaba1uga +Date: Mon, 3 Mar 2025 17:25:29 +0100 +Subject: [PATCH] fix clang compilation error + +--- + drivers/dma-buf/heaps/system_heap.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +--- a/drivers/dma-buf/heaps/system_heap.c ++++ b/drivers/dma-buf/heaps/system_heap.c +@@ -50,11 +50,16 @@ static gfp_t order_flags[] = {HIGH_ORDER + * to match with the sizes often found in IOMMUs. Using order 4 pages instead + * of order 0 pages can significantly improve the performance of many IOMMUs + * by reducing TLB pressure and time spent updating page tables. ++ * ++ * Note: `module_max_order` must be set explicitly instead of using ++ * `orders[0]` to avoid Clang's "initializer element is not a ++ * compile-time constant" error. + */ +-static const unsigned int orders[] = {8, 4, 0}; ++#define MAX_ORDERS_VALUE 8 ++static const unsigned int orders[] = {MAX_ORDERS_VALUE, 4, 0}; + #define NUM_ORDERS ARRAY_SIZE(orders) + +-static unsigned int module_max_order = orders[0]; ++static unsigned int module_max_order = MAX_ORDERS_VALUE; + + module_param_named(max_order, module_max_order, uint, 0400); + MODULE_PARM_DESC(max_order, "Maximum allocation order override."); diff --git a/target/linux/bcm27xx/patches-6.6/950-1548-delete-the-comment.patch b/target/linux/bcm27xx/patches-6.6/950-1548-delete-the-comment.patch new file mode 100644 index 00000000000000..0918f8cded173e --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1548-delete-the-comment.patch @@ -0,0 +1,22 @@ +From f1076a9d7a269d72b6707283560d0d38203cb07a Mon Sep 17 00:00:00 2001 +From: KubaTaba1uga +Date: Tue, 4 Mar 2025 09:50:30 +0100 +Subject: [PATCH] delete the comment + +--- + drivers/dma-buf/heaps/system_heap.c | 4 ---- + 1 file changed, 4 deletions(-) + +--- a/drivers/dma-buf/heaps/system_heap.c ++++ b/drivers/dma-buf/heaps/system_heap.c +@@ -50,10 +50,6 @@ static gfp_t order_flags[] = {HIGH_ORDER + * to match with the sizes often found in IOMMUs. Using order 4 pages instead + * of order 0 pages can significantly improve the performance of many IOMMUs + * by reducing TLB pressure and time spent updating page tables. +- * +- * Note: `module_max_order` must be set explicitly instead of using +- * `orders[0]` to avoid Clang's "initializer element is not a +- * compile-time constant" error. + */ + #define MAX_ORDERS_VALUE 8 + static const unsigned int orders[] = {MAX_ORDERS_VALUE, 4, 0}; diff --git a/target/linux/bcm27xx/patches-6.6/950-1549-dtoverlays-ov9281-Add-continuous-clock-option-as-an-.patch b/target/linux/bcm27xx/patches-6.6/950-1549-dtoverlays-ov9281-Add-continuous-clock-option-as-an-.patch new file mode 100644 index 00000000000000..a2b7df78d9c913 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1549-dtoverlays-ov9281-Add-continuous-clock-option-as-an-.patch @@ -0,0 +1,66 @@ +From ac56a225e0889e60e912ecd3a51333a5aee901fc Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Tue, 4 Mar 2025 15:28:53 +0000 +Subject: [PATCH] dtoverlays: ov9281: Add continuous clock option as an + override + +The previous change to make ov9281 always run in continuous clock +mode causes problems on Pi3 for reasons that aren't fully +understood. Pi4 is quite happy with it. + +Change the default back to being non-continuous clock, and add +an override to select continuous clock mode and its slightly +greater max frame rate. + +https://forums.raspberrypi.com/viewtopic.php?p=2300215 + +Signed-off-by: Dave Stevenson +--- + arch/arm/boot/dts/overlays/README | 3 +++ + arch/arm/boot/dts/overlays/ov9281-overlay.dts | 16 +++++++++++++++- + 2 files changed, 18 insertions(+), 1 deletion(-) + +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -3570,6 +3570,9 @@ Params: rotation Mounting + Compute Module (CSI0, i2c_vc, and cam0_reg). + arducam Slow down the regulator for slow Arducam + modules. ++ clk-continuous Switch to continuous mode on the CSI clock lane, ++ which increases the maximum frame rate slightly. ++ Appears not to work on Pi3. + + + Name: papirus +--- a/arch/arm/boot/dts/overlays/ov9281-overlay.dts ++++ b/arch/arm/boot/dts/overlays/ov9281-overlay.dts +@@ -64,6 +64,20 @@ + }; + }; + ++ fragment@6 { ++ target = <&csi_ep>; ++ __overlay__ { ++ clock-noncontinuous; ++ }; ++ }; ++ ++ fragment@7 { ++ target = <&cam_endpoint>; ++ __overlay__ { ++ clock-noncontinuous; ++ }; ++ }; ++ + __overrides__ { + rotation = <&cam_node>,"rotation:0"; + orientation = <&cam_node>,"orientation:0"; +@@ -75,7 +89,7 @@ + <&cam_node>, "avdd-supply:0=",<&cam0_reg>, + <®_frag>, "target:0=",<&cam0_reg>; + arducam = <0>, "+5"; +- ++ clk-continuous = <0>, "-6-7"; + }; + }; + diff --git a/target/linux/bcm27xx/patches-6.6/950-1550-drm-v3d-Add-clock-handling.patch b/target/linux/bcm27xx/patches-6.6/950-1550-drm-v3d-Add-clock-handling.patch new file mode 100644 index 00000000000000..3bce057bfdc836 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1550-drm-v3d-Add-clock-handling.patch @@ -0,0 +1,129 @@ +From 32c319ba2f2fd662a3b7bd042515cd650807dbff Mon Sep 17 00:00:00 2001 +From: Stefan Wahren +Date: Sat, 1 Feb 2025 13:50:46 +0100 +Subject: [PATCH] drm/v3d: Add clock handling +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +[ Upstream commit 4dd40b5f9c3d89b67af0dbe059cf4a51aac6bf06 ] + +Since the initial commit 57692c94dcbe ("drm/v3d: Introduce a new DRM driver +for Broadcom V3D V3.x+") the struct v3d_dev reserved a pointer for +an optional V3D clock. But there wasn't any code, which fetched it. +So add the missing clock handling before accessing any V3D registers. + +Signed-off-by: Stefan Wahren +Reviewed-by: Maíra Canal +Signed-off-by: Maíra Canal +Link: https://patchwork.freedesktop.org/patch/msgid/20250201125046.33030-1-wahrenst@gmx.net +[ Maíra: Backported to the downstream repository ] +Signed-off-by: Maíra Canal +--- + drivers/gpu/drm/v3d/v3d_drv.c | 44 ++++++++++++++++++++++------------- + 1 file changed, 28 insertions(+), 16 deletions(-) + +--- a/drivers/gpu/drm/v3d/v3d_drv.c ++++ b/drivers/gpu/drm/v3d/v3d_drv.c +@@ -232,11 +232,21 @@ static int v3d_platform_drm_probe(struct + if (ret) + return ret; + ++ v3d->clk = devm_clk_get_optional(dev, NULL); ++ if (IS_ERR(v3d->clk)) ++ return dev_err_probe(dev, PTR_ERR(v3d->clk), "Failed to get V3D clock\n"); ++ ++ ret = clk_prepare_enable(v3d->clk); ++ if (ret) { ++ dev_err(&pdev->dev, "Couldn't enable the V3D clock\n"); ++ return ret; ++ } ++ + mmu_debug = V3D_READ(V3D_MMU_DEBUG_INFO); + mask = DMA_BIT_MASK(30 + V3D_GET_FIELD(mmu_debug, V3D_MMU_PA_WIDTH)); + ret = dma_set_mask_and_coherent(dev, mask); + if (ret) +- return ret; ++ goto clk_disable; + + v3d->va_width = 30 + V3D_GET_FIELD(mmu_debug, V3D_MMU_VA_WIDTH); + +@@ -251,32 +261,29 @@ static int v3d_platform_drm_probe(struct + ret = PTR_ERR(v3d->reset); + + if (ret == -EPROBE_DEFER) +- return ret; ++ goto clk_disable; + + v3d->reset = NULL; + ret = map_regs(v3d, &v3d->bridge_regs, "bridge"); + if (ret) { + dev_err(dev, + "Failed to get reset control or bridge regs\n"); +- return ret; ++ goto clk_disable; + } + } + +- v3d->clk = devm_clk_get(dev, NULL); +- if (IS_ERR_OR_NULL(v3d->clk)) { +- if (PTR_ERR(v3d->clk) != -EPROBE_DEFER) +- dev_err(dev, "Failed to get clock (%ld)\n", PTR_ERR(v3d->clk)); +- return PTR_ERR(v3d->clk); +- } +- + node = rpi_firmware_find_node(); +- if (!node) +- return -EINVAL; ++ if (!node) { ++ ret = -EINVAL; ++ goto clk_disable; ++ } + + firmware = rpi_firmware_get(node); + of_node_put(node); +- if (!firmware) +- return -EPROBE_DEFER; ++ if (!firmware) { ++ ret = -EPROBE_DEFER; ++ goto clk_disable; ++ } + + v3d->clk_up_rate = rpi_firmware_clk_get_max_rate(firmware, + RPI_FIRMWARE_V3D_CLK_ID); +@@ -293,14 +300,15 @@ static int v3d_platform_drm_probe(struct + if (v3d->ver < 41) { + ret = map_regs(v3d, &v3d->gca_regs, "gca"); + if (ret) +- return ret; ++ goto clk_disable; + } + + v3d->mmu_scratch = dma_alloc_wc(dev, 4096, &v3d->mmu_scratch_paddr, + GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO); + if (!v3d->mmu_scratch) { + dev_err(dev, "Failed to allocate MMU scratch page\n"); +- return -ENOMEM; ++ ret = -ENOMEM; ++ goto clk_disable; + } + + ret = v3d_gem_init(drm); +@@ -326,6 +334,8 @@ gem_destroy: + v3d_gem_destroy(drm); + dma_free: + dma_free_wc(dev, 4096, v3d->mmu_scratch, v3d->mmu_scratch_paddr); ++clk_disable: ++ clk_disable_unprepare(v3d->clk); + return ret; + } + +@@ -340,6 +350,8 @@ static void v3d_platform_drm_remove(stru + + dma_free_wc(v3d->drm.dev, 4096, v3d->mmu_scratch, + v3d->mmu_scratch_paddr); ++ ++ clk_disable_unprepare(v3d->clk); + } + + static struct platform_driver v3d_platform_driver = { diff --git a/target/linux/bcm27xx/patches-6.6/950-1551-drm-v3d-Don-t-run-jobs-that-have-errors-flagged-in-i.patch b/target/linux/bcm27xx/patches-6.6/950-1551-drm-v3d-Don-t-run-jobs-that-have-errors-flagged-in-i.patch new file mode 100644 index 00000000000000..cdb9ad1888039f --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1551-drm-v3d-Don-t-run-jobs-that-have-errors-flagged-in-i.patch @@ -0,0 +1,61 @@ +From 5258ca4ad089548a72657522443b9c3e46fd125b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ma=C3=ADra=20Canal?= +Date: Sat, 22 Feb 2025 14:40:21 -0300 +Subject: [PATCH] drm/v3d: Don't run jobs that have errors flagged in its fence +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The V3D driver still relies on `drm_sched_increase_karma()` and +`drm_sched_resubmit_jobs()` for resubmissions when a timeout occurs. +The function `drm_sched_increase_karma()` marks the job as guilty, while +`drm_sched_resubmit_jobs()` sets an error (-ECANCELED) in the DMA fence of +that guilty job. + +Because of this, we must check whether the job’s DMA fence has been +flagged with an error before executing the job. Otherwise, the same guilty +job may be resubmitted indefinitely, causing repeated GPU resets. + +This patch adds a check for an error on the job's fence to prevent running +a guilty job that was previously flagged when the GPU timed out. + +Note that the CPU and CACHE_CLEAN queues do not require this check, as +their jobs are executed synchronously once the DRM scheduler starts them. + +Cc: stable@vger.kernel.org +Fixes: d223f98f0209 ("drm/v3d: Add support for compute shader dispatch.") +Fixes: 1584f16ca96e ("drm/v3d: Add support for submitting jobs to the TFU.") +Signed-off-by: Maíra Canal +--- + drivers/gpu/drm/v3d/v3d_sched.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +--- a/drivers/gpu/drm/v3d/v3d_sched.c ++++ b/drivers/gpu/drm/v3d/v3d_sched.c +@@ -292,11 +292,15 @@ v3d_tfu_job_run(struct drm_sched_job *sc + struct drm_device *dev = &v3d->drm; + struct dma_fence *fence; + ++ if (unlikely(job->base.base.s_fence->finished.error)) ++ return NULL; ++ ++ v3d->tfu_job = job; ++ + fence = v3d_fence_create(v3d, V3D_TFU); + if (IS_ERR(fence)) + return NULL; + +- v3d->tfu_job = job; + if (job->base.irq_fence) + dma_fence_put(job->base.irq_fence); + job->base.irq_fence = dma_fence_get(fence); +@@ -333,6 +337,9 @@ v3d_csd_job_run(struct drm_sched_job *sc + struct dma_fence *fence; + int i, csd_cfg0_reg, csd_cfg_reg_count; + ++ if (unlikely(job->base.base.s_fence->finished.error)) ++ return NULL; ++ + v3d->csd_job = job; + + v3d_invalidate_caches(v3d); diff --git a/target/linux/bcm27xx/patches-6.6/950-1552-drm-v3d-Set-job-pointer-to-NULL-when-the-job-s-fence.patch b/target/linux/bcm27xx/patches-6.6/950-1552-drm-v3d-Set-job-pointer-to-NULL-when-the-job-s-fence.patch new file mode 100644 index 00000000000000..3bf33ffc757b84 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1552-drm-v3d-Set-job-pointer-to-NULL-when-the-job-s-fence.patch @@ -0,0 +1,84 @@ +From 131564261399a36a5cf2ac2731ed1ceffba93d10 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ma=C3=ADra=20Canal?= +Date: Sat, 22 Feb 2025 14:56:46 -0300 +Subject: [PATCH] drm/v3d: Set job pointer to NULL when the job's fence has an + error +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Similar to commit e4b5ccd392b9 ("drm/v3d: Ensure job pointer is set to +NULL after job completion"), ensure the job pointer is set to `NULL` when +a job's fence has an error. Failing to do so can trigger kernel warnings +in specific scenarios, such as: + +1. v3d_csd_job_run() assigns `v3d->csd_job = job` +2. CSD job exceeds hang limit, causing a timeout → v3d_gpu_reset_for_timeout() +3. GPU reset +4. drm_sched_resubmit_jobs() sets the job's fence to `-ECANCELED`. +5. v3d_csd_job_run() detects the fence error and returns NULL, not + submitting the job to the GPU +6. User-space runs `modprobe -r v3d` +7. v3d_gem_destroy() + +v3d_gem_destroy() triggers a warning indicating that the CSD job never +ended, as we didn't set `v3d->csd_job` to NULL after the timeout. The same +can also happen to BIN, RENDER, and TFU jobs. + +Signed-off-by: Maíra Canal +--- + drivers/gpu/drm/v3d/v3d_sched.c | 18 ++++++++++++++---- + 1 file changed, 14 insertions(+), 4 deletions(-) + +--- a/drivers/gpu/drm/v3d/v3d_sched.c ++++ b/drivers/gpu/drm/v3d/v3d_sched.c +@@ -189,8 +189,12 @@ static struct dma_fence *v3d_bin_job_run + struct dma_fence *fence; + unsigned long irqflags; + +- if (unlikely(job->base.base.s_fence->finished.error)) ++ if (unlikely(job->base.base.s_fence->finished.error)) { ++ spin_lock_irqsave(&v3d->job_lock, irqflags); ++ v3d->bin_job = NULL; ++ spin_unlock_irqrestore(&v3d->job_lock, irqflags); + return NULL; ++ } + + /* Lock required around bin_job update vs + * v3d_overflow_mem_work(). +@@ -244,8 +248,10 @@ static struct dma_fence *v3d_render_job_ + struct drm_device *dev = &v3d->drm; + struct dma_fence *fence; + +- if (unlikely(job->base.base.s_fence->finished.error)) ++ if (unlikely(job->base.base.s_fence->finished.error)) { ++ v3d->render_job = NULL; + return NULL; ++ } + + v3d->render_job = job; + +@@ -292,8 +298,10 @@ v3d_tfu_job_run(struct drm_sched_job *sc + struct drm_device *dev = &v3d->drm; + struct dma_fence *fence; + +- if (unlikely(job->base.base.s_fence->finished.error)) ++ if (unlikely(job->base.base.s_fence->finished.error)) { ++ v3d->tfu_job = NULL; + return NULL; ++ } + + v3d->tfu_job = job; + +@@ -337,8 +345,10 @@ v3d_csd_job_run(struct drm_sched_job *sc + struct dma_fence *fence; + int i, csd_cfg0_reg, csd_cfg_reg_count; + +- if (unlikely(job->base.base.s_fence->finished.error)) ++ if (unlikely(job->base.base.s_fence->finished.error)) { ++ v3d->csd_job = NULL; + return NULL; ++ } + + v3d->csd_job = job; + diff --git a/target/linux/bcm27xx/patches-6.6/950-1553-drm-v3d-Associate-a-V3D-tech-revision-to-all-support.patch b/target/linux/bcm27xx/patches-6.6/950-1553-drm-v3d-Associate-a-V3D-tech-revision-to-all-support.patch new file mode 100644 index 00000000000000..a13516a04ea361 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1553-drm-v3d-Associate-a-V3D-tech-revision-to-all-support.patch @@ -0,0 +1,447 @@ +From 97988373018e7fa7ff33b7774f88d30e48f71509 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ma=C3=ADra=20Canal?= +Date: Tue, 25 Feb 2025 20:44:59 -0300 +Subject: [PATCH] drm/v3d: Associate a V3D tech revision to all supported + devices +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The V3D driver currently determines the GPU tech version (33, 41...) +by reading a register. This approach has worked so far since this +information wasn’t needed before powering on the GPU. + +V3D 7.1 introduces new registers that must be written to power on the +GPU, requiring us to know the V3D version beforehand. To address this, +associate each supported SoC with the corresponding VideoCore GPU version +as part of the device data. + +To prevent possible mistakes, add an assertion to verify that the version +specified in the device data matches the one reported by the hardware. +If there is a mismatch, the kernel will trigger a warning. + +Signed-off-by: Maíra Canal +--- + drivers/gpu/drm/v3d/v3d_debugfs.c | 128 +++++++++++++++--------------- + drivers/gpu/drm/v3d/v3d_drv.c | 22 +++-- + drivers/gpu/drm/v3d/v3d_drv.h | 11 ++- + drivers/gpu/drm/v3d/v3d_gem.c | 12 +-- + drivers/gpu/drm/v3d/v3d_irq.c | 10 +-- + drivers/gpu/drm/v3d/v3d_sched.c | 12 +-- + 6 files changed, 106 insertions(+), 89 deletions(-) + +--- a/drivers/gpu/drm/v3d/v3d_debugfs.c ++++ b/drivers/gpu/drm/v3d/v3d_debugfs.c +@@ -22,74 +22,74 @@ struct v3d_reg_def { + }; + + static const struct v3d_reg_def v3d_hub_reg_defs[] = { +- REGDEF(33, 42, V3D_HUB_AXICFG), +- REGDEF(33, 71, V3D_HUB_UIFCFG), +- REGDEF(33, 71, V3D_HUB_IDENT0), +- REGDEF(33, 71, V3D_HUB_IDENT1), +- REGDEF(33, 71, V3D_HUB_IDENT2), +- REGDEF(33, 71, V3D_HUB_IDENT3), +- REGDEF(33, 71, V3D_HUB_INT_STS), +- REGDEF(33, 71, V3D_HUB_INT_MSK_STS), +- +- REGDEF(33, 71, V3D_MMU_CTL), +- REGDEF(33, 71, V3D_MMU_VIO_ADDR), +- REGDEF(33, 71, V3D_MMU_VIO_ID), +- REGDEF(33, 71, V3D_MMU_DEBUG_INFO), +- +- REGDEF(71, 71, V3D_V7_GMP_STATUS), +- REGDEF(71, 71, V3D_V7_GMP_CFG), +- REGDEF(71, 71, V3D_V7_GMP_VIO_ADDR), ++ REGDEF(V3D_GEN_33, V3D_GEN_42, V3D_HUB_AXICFG), ++ REGDEF(V3D_GEN_33, V3D_GEN_71, V3D_HUB_UIFCFG), ++ REGDEF(V3D_GEN_33, V3D_GEN_71, V3D_HUB_IDENT0), ++ REGDEF(V3D_GEN_33, V3D_GEN_71, V3D_HUB_IDENT1), ++ REGDEF(V3D_GEN_33, V3D_GEN_71, V3D_HUB_IDENT2), ++ REGDEF(V3D_GEN_33, V3D_GEN_71, V3D_HUB_IDENT3), ++ REGDEF(V3D_GEN_33, V3D_GEN_71, V3D_HUB_INT_STS), ++ REGDEF(V3D_GEN_33, V3D_GEN_71, V3D_HUB_INT_MSK_STS), ++ ++ REGDEF(V3D_GEN_33, V3D_GEN_71, V3D_MMU_CTL), ++ REGDEF(V3D_GEN_33, V3D_GEN_71, V3D_MMU_VIO_ADDR), ++ REGDEF(V3D_GEN_33, V3D_GEN_71, V3D_MMU_VIO_ID), ++ REGDEF(V3D_GEN_33, V3D_GEN_71, V3D_MMU_DEBUG_INFO), ++ ++ REGDEF(V3D_GEN_71, V3D_GEN_71, V3D_V7_GMP_STATUS), ++ REGDEF(V3D_GEN_71, V3D_GEN_71, V3D_V7_GMP_CFG), ++ REGDEF(V3D_GEN_71, V3D_GEN_71, V3D_V7_GMP_VIO_ADDR), + }; + + static const struct v3d_reg_def v3d_gca_reg_defs[] = { +- REGDEF(33, 33, V3D_GCA_SAFE_SHUTDOWN), +- REGDEF(33, 33, V3D_GCA_SAFE_SHUTDOWN_ACK), ++ REGDEF(V3D_GEN_33, V3D_GEN_33, V3D_GCA_SAFE_SHUTDOWN), ++ REGDEF(V3D_GEN_33, V3D_GEN_33, V3D_GCA_SAFE_SHUTDOWN_ACK), + }; + + static const struct v3d_reg_def v3d_core_reg_defs[] = { +- REGDEF(33, 71, V3D_CTL_IDENT0), +- REGDEF(33, 71, V3D_CTL_IDENT1), +- REGDEF(33, 71, V3D_CTL_IDENT2), +- REGDEF(33, 71, V3D_CTL_MISCCFG), +- REGDEF(33, 71, V3D_CTL_INT_STS), +- REGDEF(33, 71, V3D_CTL_INT_MSK_STS), +- REGDEF(33, 71, V3D_CLE_CT0CS), +- REGDEF(33, 71, V3D_CLE_CT0CA), +- REGDEF(33, 71, V3D_CLE_CT0EA), +- REGDEF(33, 71, V3D_CLE_CT1CS), +- REGDEF(33, 71, V3D_CLE_CT1CA), +- REGDEF(33, 71, V3D_CLE_CT1EA), +- +- REGDEF(33, 71, V3D_PTB_BPCA), +- REGDEF(33, 71, V3D_PTB_BPCS), +- +- REGDEF(33, 41, V3D_GMP_STATUS), +- REGDEF(33, 41, V3D_GMP_CFG), +- REGDEF(33, 41, V3D_GMP_VIO_ADDR), +- +- REGDEF(33, 71, V3D_ERR_FDBGO), +- REGDEF(33, 71, V3D_ERR_FDBGB), +- REGDEF(33, 71, V3D_ERR_FDBGS), +- REGDEF(33, 71, V3D_ERR_STAT), ++ REGDEF(V3D_GEN_33, V3D_GEN_71, V3D_CTL_IDENT0), ++ REGDEF(V3D_GEN_33, V3D_GEN_71, V3D_CTL_IDENT1), ++ REGDEF(V3D_GEN_33, V3D_GEN_71, V3D_CTL_IDENT2), ++ REGDEF(V3D_GEN_33, V3D_GEN_71, V3D_CTL_MISCCFG), ++ REGDEF(V3D_GEN_33, V3D_GEN_71, V3D_CTL_INT_STS), ++ REGDEF(V3D_GEN_33, V3D_GEN_71, V3D_CTL_INT_MSK_STS), ++ REGDEF(V3D_GEN_33, V3D_GEN_71, V3D_CLE_CT0CS), ++ REGDEF(V3D_GEN_33, V3D_GEN_71, V3D_CLE_CT0CA), ++ REGDEF(V3D_GEN_33, V3D_GEN_71, V3D_CLE_CT0EA), ++ REGDEF(V3D_GEN_33, V3D_GEN_71, V3D_CLE_CT1CS), ++ REGDEF(V3D_GEN_33, V3D_GEN_71, V3D_CLE_CT1CA), ++ REGDEF(V3D_GEN_33, V3D_GEN_71, V3D_CLE_CT1EA), ++ ++ REGDEF(V3D_GEN_33, V3D_GEN_71, V3D_PTB_BPCA), ++ REGDEF(V3D_GEN_33, V3D_GEN_71, V3D_PTB_BPCS), ++ ++ REGDEF(V3D_GEN_33, V3D_GEN_41, V3D_GMP_STATUS), ++ REGDEF(V3D_GEN_33, V3D_GEN_41, V3D_GMP_CFG), ++ REGDEF(V3D_GEN_33, V3D_GEN_41, V3D_GMP_VIO_ADDR), ++ ++ REGDEF(V3D_GEN_33, V3D_GEN_71, V3D_ERR_FDBGO), ++ REGDEF(V3D_GEN_33, V3D_GEN_71, V3D_ERR_FDBGB), ++ REGDEF(V3D_GEN_33, V3D_GEN_71, V3D_ERR_FDBGS), ++ REGDEF(V3D_GEN_33, V3D_GEN_71, V3D_ERR_STAT), + }; + + static const struct v3d_reg_def v3d_csd_reg_defs[] = { +- REGDEF(41, 71, V3D_CSD_STATUS), +- REGDEF(41, 41, V3D_CSD_CURRENT_CFG0), +- REGDEF(41, 41, V3D_CSD_CURRENT_CFG1), +- REGDEF(41, 41, V3D_CSD_CURRENT_CFG2), +- REGDEF(41, 41, V3D_CSD_CURRENT_CFG3), +- REGDEF(41, 41, V3D_CSD_CURRENT_CFG4), +- REGDEF(41, 41, V3D_CSD_CURRENT_CFG5), +- REGDEF(41, 41, V3D_CSD_CURRENT_CFG6), +- REGDEF(71, 71, V3D_V7_CSD_CURRENT_CFG0), +- REGDEF(71, 71, V3D_V7_CSD_CURRENT_CFG1), +- REGDEF(71, 71, V3D_V7_CSD_CURRENT_CFG2), +- REGDEF(71, 71, V3D_V7_CSD_CURRENT_CFG3), +- REGDEF(71, 71, V3D_V7_CSD_CURRENT_CFG4), +- REGDEF(71, 71, V3D_V7_CSD_CURRENT_CFG5), +- REGDEF(71, 71, V3D_V7_CSD_CURRENT_CFG6), +- REGDEF(71, 71, V3D_V7_CSD_CURRENT_CFG7), ++ REGDEF(V3D_GEN_41, V3D_GEN_71, V3D_CSD_STATUS), ++ REGDEF(V3D_GEN_41, V3D_GEN_41, V3D_CSD_CURRENT_CFG0), ++ REGDEF(V3D_GEN_41, V3D_GEN_41, V3D_CSD_CURRENT_CFG1), ++ REGDEF(V3D_GEN_41, V3D_GEN_41, V3D_CSD_CURRENT_CFG2), ++ REGDEF(V3D_GEN_41, V3D_GEN_41, V3D_CSD_CURRENT_CFG3), ++ REGDEF(V3D_GEN_41, V3D_GEN_41, V3D_CSD_CURRENT_CFG4), ++ REGDEF(V3D_GEN_41, V3D_GEN_41, V3D_CSD_CURRENT_CFG5), ++ REGDEF(V3D_GEN_41, V3D_GEN_41, V3D_CSD_CURRENT_CFG6), ++ REGDEF(V3D_GEN_71, V3D_GEN_71, V3D_V7_CSD_CURRENT_CFG0), ++ REGDEF(V3D_GEN_71, V3D_GEN_71, V3D_V7_CSD_CURRENT_CFG1), ++ REGDEF(V3D_GEN_71, V3D_GEN_71, V3D_V7_CSD_CURRENT_CFG2), ++ REGDEF(V3D_GEN_71, V3D_GEN_71, V3D_V7_CSD_CURRENT_CFG3), ++ REGDEF(V3D_GEN_71, V3D_GEN_71, V3D_V7_CSD_CURRENT_CFG4), ++ REGDEF(V3D_GEN_71, V3D_GEN_71, V3D_V7_CSD_CURRENT_CFG5), ++ REGDEF(V3D_GEN_71, V3D_GEN_71, V3D_V7_CSD_CURRENT_CFG6), ++ REGDEF(V3D_GEN_71, V3D_GEN_71, V3D_V7_CSD_CURRENT_CFG7), + }; + + static int v3d_v3d_debugfs_regs(struct seq_file *m, void *unused) +@@ -165,7 +165,7 @@ static int v3d_v3d_debugfs_ident(struct + str_yes_no(ident2 & V3D_HUB_IDENT2_WITH_MMU)); + seq_printf(m, "TFU: %s\n", + str_yes_no(ident1 & V3D_HUB_IDENT1_WITH_TFU)); +- if (v3d->ver <= 42) { ++ if (v3d->ver <= V3D_GEN_42) { + seq_printf(m, "TSY: %s\n", + str_yes_no(ident1 & V3D_HUB_IDENT1_WITH_TSY)); + } +@@ -197,11 +197,11 @@ static int v3d_v3d_debugfs_ident(struct + seq_printf(m, " QPUs: %d\n", nslc * qups); + seq_printf(m, " Semaphores: %d\n", + V3D_GET_FIELD(ident1, V3D_IDENT1_NSEM)); +- if (v3d->ver <= 42) { ++ if (v3d->ver <= V3D_GEN_42) { + seq_printf(m, " BCG int: %d\n", + (ident2 & V3D_IDENT2_BCG_INT) != 0); + } +- if (v3d->ver < 40) { ++ if (v3d->ver < V3D_GEN_41) { + seq_printf(m, " Override TMU: %d\n", + (misccfg & V3D_MISCCFG_OVRTMUOUT) != 0); + } +@@ -311,8 +311,8 @@ static int v3d_measure_clock(struct seq_ + int core = 0; + int measure_ms = 1000; + +- if (v3d->ver >= 40) { +- int cycle_count_reg = v3d->ver < 71 ? ++ if (v3d->ver >= V3D_GEN_41) { ++ int cycle_count_reg = v3d->ver < V3D_GEN_71 ? + V3D_PCTR_CYCLE_COUNT : V3D_V7_PCTR_CYCLE_COUNT; + V3D_CORE_WRITE(core, V3D_V4_PCTR_0_SRC_0_3, + V3D_SET_FIELD(cycle_count_reg, +--- a/drivers/gpu/drm/v3d/v3d_drv.c ++++ b/drivers/gpu/drm/v3d/v3d_drv.c +@@ -17,6 +17,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -88,7 +89,7 @@ static int v3d_get_param_ioctl(struct dr + args->value = 1; + return 0; + case DRM_V3D_PARAM_SUPPORTS_PERFMON: +- args->value = (v3d->ver >= 40); ++ args->value = (v3d->ver >= V3D_GEN_41); + return 0; + case DRM_V3D_PARAM_SUPPORTS_MULTISYNC_EXT: + args->value = 1; +@@ -189,10 +190,10 @@ static const struct drm_driver v3d_drm_d + }; + + static const struct of_device_id v3d_of_match[] = { +- { .compatible = "brcm,2712-v3d" }, +- { .compatible = "brcm,2711-v3d" }, +- { .compatible = "brcm,7268-v3d" }, +- { .compatible = "brcm,7278-v3d" }, ++ { .compatible = "brcm,2711-v3d", .data = (void *)V3D_GEN_42 }, ++ { .compatible = "brcm,2712-v3d", .data = (void *)V3D_GEN_71 }, ++ { .compatible = "brcm,7268-v3d", .data = (void *)V3D_GEN_33 }, ++ { .compatible = "brcm,7278-v3d", .data = (void *)V3D_GEN_41 }, + {}, + }; + MODULE_DEVICE_TABLE(of, v3d_of_match); +@@ -211,6 +212,7 @@ static int v3d_platform_drm_probe(struct + struct device_node *node; + struct drm_device *drm; + struct v3d_dev *v3d; ++ enum v3d_gen gen; + int ret; + u32 mmu_debug; + u32 ident1; +@@ -224,6 +226,9 @@ static int v3d_platform_drm_probe(struct + + platform_set_drvdata(pdev, drm); + ++ gen = (enum v3d_gen)of_device_get_match_data(dev); ++ v3d->ver = gen; ++ + ret = map_regs(v3d, &v3d->hub_regs, "hub"); + if (ret) + return ret; +@@ -253,6 +258,11 @@ static int v3d_platform_drm_probe(struct + ident1 = V3D_READ(V3D_HUB_IDENT1); + v3d->ver = (V3D_GET_FIELD(ident1, V3D_HUB_IDENT1_TVER) * 10 + + V3D_GET_FIELD(ident1, V3D_HUB_IDENT1_REV)); ++ /* Make sure that the V3D tech version retrieved from the HW is equal ++ * to the one advertised by the device tree. ++ */ ++ WARN_ON(v3d->ver != gen); ++ + v3d->cores = V3D_GET_FIELD(ident1, V3D_HUB_IDENT1_NCORES); + WARN_ON(v3d->cores > 1); /* multicore not yet implemented */ + +@@ -297,7 +307,7 @@ static int v3d_platform_drm_probe(struct + v3d->clk_down_rate = + (clk_get_rate(clk_get_parent(v3d->clk)) / (1 << 4)) + 10000; + +- if (v3d->ver < 41) { ++ if (v3d->ver < V3D_GEN_41) { + ret = map_regs(v3d, &v3d->gca_regs, "gca"); + if (ret) + goto clk_disable; +--- a/drivers/gpu/drm/v3d/v3d_drv.h ++++ b/drivers/gpu/drm/v3d/v3d_drv.h +@@ -115,13 +115,20 @@ struct v3d_perfmon { + u64 values[]; + }; + ++enum v3d_gen { ++ V3D_GEN_33 = 33, ++ V3D_GEN_41 = 41, ++ V3D_GEN_42 = 42, ++ V3D_GEN_71 = 71, ++}; ++ + struct v3d_dev { + struct drm_device drm; + + /* Short representation (e.g. 33, 41) of the V3D tech version + * and revision. + */ +- int ver; ++ enum v3d_gen ver; + bool single_irq_line; + + void __iomem *hub_regs; +@@ -213,7 +220,7 @@ to_v3d_dev(struct drm_device *dev) + static inline bool + v3d_has_csd(struct v3d_dev *v3d) + { +- return v3d->ver >= 41; ++ return v3d->ver >= V3D_GEN_41; + } + + #define v3d_to_pdev(v3d) to_platform_device((v3d)->drm.dev) +--- a/drivers/gpu/drm/v3d/v3d_gem.c ++++ b/drivers/gpu/drm/v3d/v3d_gem.c +@@ -69,7 +69,7 @@ v3d_init_core(struct v3d_dev *v3d, int c + * type. If you want the default behavior, you can still put + * "2" in the indirect texture state's output_type field. + */ +- if (v3d->ver < 40) ++ if (v3d->ver < V3D_GEN_41) + V3D_CORE_WRITE(core, V3D_CTL_MISCCFG, V3D_MISCCFG_OVRTMUOUT); + + /* Whenever we flush the L2T cache, we always want to flush +@@ -89,7 +89,7 @@ v3d_init_hw_state(struct v3d_dev *v3d) + static void + v3d_idle_axi(struct v3d_dev *v3d, int core) + { +- if (v3d->ver >= 71) ++ if (v3d->ver >= V3D_GEN_71) + return; + + V3D_CORE_WRITE(core, V3D_GMP_CFG, V3D_GMP_CFG_STOP_REQ); +@@ -105,7 +105,7 @@ v3d_idle_axi(struct v3d_dev *v3d, int co + static void + v3d_idle_gca(struct v3d_dev *v3d) + { +- if (v3d->ver >= 41) ++ if (v3d->ver >= V3D_GEN_41) + return; + + V3D_GCA_WRITE(V3D_GCA_SAFE_SHUTDOWN, V3D_GCA_SAFE_SHUTDOWN_EN); +@@ -179,13 +179,13 @@ v3d_reset(struct v3d_dev *v3d) + static void + v3d_flush_l3(struct v3d_dev *v3d) + { +- if (v3d->ver < 41) { ++ if (v3d->ver < V3D_GEN_41) { + u32 gca_ctrl = V3D_GCA_READ(V3D_GCA_CACHE_CTRL); + + V3D_GCA_WRITE(V3D_GCA_CACHE_CTRL, + gca_ctrl | V3D_GCA_CACHE_CTRL_FLUSH); + +- if (v3d->ver < 33) { ++ if (v3d->ver < V3D_GEN_33) { + V3D_GCA_WRITE(V3D_GCA_CACHE_CTRL, + gca_ctrl & ~V3D_GCA_CACHE_CTRL_FLUSH); + } +@@ -198,7 +198,7 @@ v3d_flush_l3(struct v3d_dev *v3d) + static void + v3d_invalidate_l2c(struct v3d_dev *v3d, int core) + { +- if (v3d->ver > 32) ++ if (v3d->ver >= V3D_GEN_33) + return; + + V3D_CORE_WRITE(core, V3D_CTL_L2CACTL, +--- a/drivers/gpu/drm/v3d/v3d_irq.c ++++ b/drivers/gpu/drm/v3d/v3d_irq.c +@@ -125,8 +125,8 @@ v3d_irq(int irq, void *arg) + status = IRQ_HANDLED; + } + +- if ((v3d->ver < 71 && (intsts & V3D_INT_CSDDONE)) || +- (v3d->ver >= 71 && (intsts & V3D_V7_INT_CSDDONE))) { ++ if ((v3d->ver < V3D_GEN_71 && (intsts & V3D_INT_CSDDONE)) || ++ (v3d->ver >= V3D_GEN_71 && (intsts & V3D_V7_INT_CSDDONE))) { + struct v3d_fence *fence = + to_v3d_fence(v3d->csd_job->base.irq_fence); + v3d->gpu_queue_stats[V3D_CSD].last_exec_end = local_clock(); +@@ -142,7 +142,7 @@ v3d_irq(int irq, void *arg) + /* We shouldn't be triggering these if we have GMP in + * always-allowed mode. + */ +- if (v3d->ver < 71 && (intsts & V3D_INT_GMPV)) ++ if (v3d->ver < V3D_GEN_71 && (intsts & V3D_INT_GMPV)) + dev_err(v3d->drm.dev, "GMP violation\n"); + + /* V3D 4.2 wires the hub and core IRQs together, so if we & +@@ -200,7 +200,7 @@ v3d_hub_irq(int irq, void *arg) + + V3D_WRITE(V3D_MMU_CTL, V3D_READ(V3D_MMU_CTL)); + +- if (v3d->ver >= 41) { ++ if (v3d->ver >= V3D_GEN_41) { + axi_id = axi_id >> 5; + if (axi_id < ARRAY_SIZE(v3d41_axi_ids)) + client = v3d41_axi_ids[axi_id]; +@@ -219,7 +219,7 @@ v3d_hub_irq(int irq, void *arg) + status = IRQ_HANDLED; + } + +- if (v3d->ver >= 71 && intsts & V3D_V7_HUB_INT_GMPV) { ++ if (v3d->ver >= V3D_GEN_71 && intsts & V3D_V7_HUB_INT_GMPV) { + dev_err(v3d->drm.dev, "GMP Violation\n"); + status = IRQ_HANDLED; + } +--- a/drivers/gpu/drm/v3d/v3d_sched.c ++++ b/drivers/gpu/drm/v3d/v3d_sched.c +@@ -288,7 +288,7 @@ static struct dma_fence *v3d_render_job_ + return fence; + } + +-#define V3D_TFU_REG(name) ((v3d->ver < 71) ? V3D_TFU_ ## name : V3D_V7_TFU_ ## name) ++#define V3D_TFU_REG(name) ((v3d->ver < V3D_GEN_71) ? V3D_TFU_ ## name : V3D_V7_TFU_ ## name) + + static struct dma_fence * + v3d_tfu_job_run(struct drm_sched_job *sched_job) +@@ -321,11 +321,11 @@ v3d_tfu_job_run(struct drm_sched_job *sc + V3D_WRITE(V3D_TFU_REG(ICA), job->args.ica); + V3D_WRITE(V3D_TFU_REG(IUA), job->args.iua); + V3D_WRITE(V3D_TFU_REG(IOA), job->args.ioa); +- if (v3d->ver >= 71) ++ if (v3d->ver >= V3D_GEN_71) + V3D_WRITE(V3D_V7_TFU_IOC, job->args.v71.ioc); + V3D_WRITE(V3D_TFU_REG(IOS), job->args.ios); + V3D_WRITE(V3D_TFU_REG(COEF0), job->args.coef[0]); +- if (v3d->ver >= 71 || (job->args.coef[0] & V3D_TFU_COEF0_USECOEF)) { ++ if (v3d->ver >= V3D_GEN_71 || (job->args.coef[0] & V3D_TFU_COEF0_USECOEF)) { + V3D_WRITE(V3D_TFU_REG(COEF1), job->args.coef[1]); + V3D_WRITE(V3D_TFU_REG(COEF2), job->args.coef[2]); + V3D_WRITE(V3D_TFU_REG(COEF3), job->args.coef[3]); +@@ -367,8 +367,8 @@ v3d_csd_job_run(struct drm_sched_job *sc + v3d_sched_stats_add_job(&v3d->gpu_queue_stats[V3D_CSD], sched_job); + v3d_switch_perfmon(v3d, &job->base); + +- csd_cfg0_reg = v3d->ver < 71 ? V3D_CSD_QUEUED_CFG0 : V3D_V7_CSD_QUEUED_CFG0; +- csd_cfg_reg_count = v3d->ver < 71 ? 6 : 7; ++ csd_cfg0_reg = v3d->ver < V3D_GEN_71 ? V3D_CSD_QUEUED_CFG0 : V3D_V7_CSD_QUEUED_CFG0; ++ csd_cfg_reg_count = v3d->ver < V3D_GEN_71 ? 6 : 7; + for (i = 1; i <= csd_cfg_reg_count; i++) + V3D_CORE_WRITE(0, csd_cfg0_reg + 4 * i, job->args.cfg[i]); + /* CFG0 write kicks off the job. */ +@@ -475,7 +475,7 @@ v3d_csd_job_timedout(struct drm_sched_jo + { + struct v3d_csd_job *job = to_csd_job(sched_job); + struct v3d_dev *v3d = job->base.v3d; +- u32 batches = V3D_CORE_READ(0, (v3d->ver < 71 ? V3D_CSD_CURRENT_CFG4 : ++ u32 batches = V3D_CORE_READ(0, (v3d->ver < V3D_GEN_71 ? V3D_CSD_CURRENT_CFG4 : + V3D_V7_CSD_CURRENT_CFG4)); + + /* If we've made progress, skip reset and let the timer get diff --git a/target/linux/bcm27xx/patches-6.6/950-1554-dt-bindings-gpu-v3d-Add-SMS-to-the-registers-list.patch b/target/linux/bcm27xx/patches-6.6/950-1554-dt-bindings-gpu-v3d-Add-SMS-to-the-registers-list.patch new file mode 100644 index 00000000000000..fb03d82e3f5ea2 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1554-dt-bindings-gpu-v3d-Add-SMS-to-the-registers-list.patch @@ -0,0 +1,43 @@ +From 08e99bc475ad907f3087e4f14c2ddb6560514da1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ma=C3=ADra=20Canal?= +Date: Sat, 22 Feb 2025 15:26:39 -0300 +Subject: [PATCH] dt-bindings: gpu: v3d: Add SMS to the registers' list +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +V3D 7.1 exposes a new register block, called V3D_SMS. As BCM2712 has a +V3D 7.1 core, add a new register item to the list. Similar to the GCA +and bridge register, SMS is optional and should only be added for V3D +7.1 variants. + +Cc: Krzysztof Kozlowski +Cc: Conor Dooley +Cc: Nicolas Saenz Julienne +Cc: devicetree@vger.kernel.org +Signed-off-by: Maíra Canal +--- + Documentation/devicetree/bindings/gpu/brcm,bcm-v3d.yaml | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/Documentation/devicetree/bindings/gpu/brcm,bcm-v3d.yaml ++++ b/Documentation/devicetree/bindings/gpu/brcm,bcm-v3d.yaml +@@ -27,14 +27,16 @@ properties: + - description: core0 register (required) + - description: GCA cache controller register (if GCA controller present) + - description: bridge register (if no external reset controller) ++ - description: SMS register (if SMS controller present) + minItems: 2 + + reg-names: + items: + - const: hub + - const: core0 +- - enum: [ bridge, gca ] +- - enum: [ bridge, gca ] ++ - enum: [ bridge, gca, sms ] ++ - enum: [ bridge, gca, sms ] ++ - enum: [ bridge, gca, sms ] + minItems: 2 + + interrupts: diff --git a/target/linux/bcm27xx/patches-6.6/950-1555-drm-v3d-Use-V3D_SMS-registers-for-power-on-off-and-r.patch b/target/linux/bcm27xx/patches-6.6/950-1555-drm-v3d-Use-V3D_SMS-registers-for-power-on-off-and-r.patch new file mode 100644 index 00000000000000..a39e7242d16c5b --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1555-drm-v3d-Use-V3D_SMS-registers-for-power-on-off-and-r.patch @@ -0,0 +1,198 @@ +From 85e1a7592aa192d760159f9bc6e83d56fdf433f3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ma=C3=ADra=20Canal?= +Date: Sat, 22 Feb 2025 15:49:49 -0300 +Subject: [PATCH] drm/v3d: Use V3D_SMS registers for power on/off and reset on + V3D 7.x +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +In addition to the standard reset controller, V3D 7.x requires configuring +the V3D_SMS registers for proper power on/off and reset. Add the new +registers to `v3d_regs.h` and ensure they are properly configured during +device probing, removal, and reset. + +This change fixes GPU reset issues on the Raspberry Pi 5 (BCM2712). +Without exposing these registers, a GPU reset causes the GPU to hang, +stopping any further job execution and freezing the desktop GUI. The same +issue occurs when unloading and loading the v3d driver. + +Link: https://github.com/raspberrypi/linux/issues/6660 +Signed-off-by: Maíra Canal +--- + drivers/gpu/drm/v3d/v3d_drv.c | 40 ++++++++++++++++++++++++++++++++++ + drivers/gpu/drm/v3d/v3d_drv.h | 11 ++++++++++ + drivers/gpu/drm/v3d/v3d_gem.c | 17 +++++++++++++++ + drivers/gpu/drm/v3d/v3d_regs.h | 26 ++++++++++++++++++++++ + 4 files changed, 94 insertions(+) + +--- a/drivers/gpu/drm/v3d/v3d_drv.c ++++ b/drivers/gpu/drm/v3d/v3d_drv.c +@@ -198,6 +198,36 @@ static const struct of_device_id v3d_of_ + }; + MODULE_DEVICE_TABLE(of, v3d_of_match); + ++static void ++v3d_idle_sms(struct v3d_dev *v3d) ++{ ++ if (v3d->ver < V3D_GEN_71) ++ return; ++ ++ V3D_SMS_WRITE(V3D_SMS_TEE_CS, V3D_SMS_CLEAR_POWER_OFF); ++ ++ if (wait_for((V3D_GET_FIELD(V3D_SMS_READ(V3D_SMS_TEE_CS), ++ V3D_SMS_STATE) == V3D_SMS_IDLE), 100)) { ++ DRM_ERROR("Failed to power up SMS\n"); ++ } ++ ++ v3d_reset_sms(v3d); ++} ++ ++static void ++v3d_power_off_sms(struct v3d_dev *v3d) ++{ ++ if (v3d->ver < V3D_GEN_71) ++ return; ++ ++ V3D_SMS_WRITE(V3D_SMS_TEE_CS, V3D_SMS_POWER_OFF); ++ ++ if (wait_for((V3D_GET_FIELD(V3D_SMS_READ(V3D_SMS_TEE_CS), ++ V3D_SMS_STATE) == V3D_SMS_POWER_OFF_STATE), 100)) { ++ DRM_ERROR("Failed to power off SMS\n"); ++ } ++} ++ + static int + map_regs(struct v3d_dev *v3d, void __iomem **regs, const char *name) + { +@@ -237,6 +267,12 @@ static int v3d_platform_drm_probe(struct + if (ret) + return ret; + ++ if (v3d->ver >= V3D_GEN_71) { ++ ret = map_regs(v3d, &v3d->sms_regs, "sms"); ++ if (ret) ++ return ret; ++ } ++ + v3d->clk = devm_clk_get_optional(dev, NULL); + if (IS_ERR(v3d->clk)) + return dev_err_probe(dev, PTR_ERR(v3d->clk), "Failed to get V3D clock\n"); +@@ -247,6 +283,8 @@ static int v3d_platform_drm_probe(struct + return ret; + } + ++ v3d_idle_sms(v3d); ++ + mmu_debug = V3D_READ(V3D_MMU_DEBUG_INFO); + mask = DMA_BIT_MASK(30 + V3D_GET_FIELD(mmu_debug, V3D_MMU_PA_WIDTH)); + ret = dma_set_mask_and_coherent(dev, mask); +@@ -361,6 +399,8 @@ static void v3d_platform_drm_remove(stru + dma_free_wc(v3d->drm.dev, 4096, v3d->mmu_scratch, + v3d->mmu_scratch_paddr); + ++ v3d_power_off_sms(v3d); ++ + clk_disable_unprepare(v3d->clk); + } + +--- a/drivers/gpu/drm/v3d/v3d_drv.h ++++ b/drivers/gpu/drm/v3d/v3d_drv.h +@@ -135,6 +135,7 @@ struct v3d_dev { + void __iomem *core_regs[3]; + void __iomem *bridge_regs; + void __iomem *gca_regs; ++ void __iomem *sms_regs; + struct clk *clk; + struct delayed_work clk_down_work; + unsigned long clk_up_rate, clk_down_rate; +@@ -277,6 +278,15 @@ to_v3d_fence(struct dma_fence *fence) + #define V3D_GCA_READ(offset) readl(v3d->gca_regs + offset) + #define V3D_GCA_WRITE(offset, val) writel(val, v3d->gca_regs + offset) + ++#define V3D_SMS_IDLE 0x0 ++#define V3D_SMS_ISOLATING_FOR_RESET 0xa ++#define V3D_SMS_RESETTING 0xb ++#define V3D_SMS_ISOLATING_FOR_POWER_OFF 0xc ++#define V3D_SMS_POWER_OFF_STATE 0xd ++ ++#define V3D_SMS_READ(offset) readl(v3d->sms_regs + (offset)) ++#define V3D_SMS_WRITE(offset, val) writel(val, v3d->sms_regs + (offset)) ++ + #define V3D_CORE_READ(core, offset) readl(v3d->core_regs[core] + offset) + #define V3D_CORE_WRITE(core, offset, val) writel(val, v3d->core_regs[core] + offset) + +@@ -455,6 +465,7 @@ int v3d_wait_bo_ioctl(struct drm_device + struct drm_file *file_priv); + void v3d_job_cleanup(struct v3d_job *job); + void v3d_job_put(struct v3d_job *job); ++void v3d_reset_sms(struct v3d_dev *v3d); + void v3d_reset(struct v3d_dev *v3d); + void v3d_invalidate_caches(struct v3d_dev *v3d); + void v3d_clean_caches(struct v3d_dev *v3d); +--- a/drivers/gpu/drm/v3d/v3d_gem.c ++++ b/drivers/gpu/drm/v3d/v3d_gem.c +@@ -152,6 +152,22 @@ v3d_reset_v3d(struct v3d_dev *v3d) + } + + void ++v3d_reset_sms(struct v3d_dev *v3d) ++{ ++ if (v3d->ver < V3D_GEN_71) ++ return; ++ ++ V3D_SMS_WRITE(V3D_SMS_REE_CS, V3D_SET_FIELD(0x4, V3D_SMS_STATE)); ++ ++ if (wait_for(!(V3D_GET_FIELD(V3D_SMS_READ(V3D_SMS_REE_CS), ++ V3D_SMS_STATE) == V3D_SMS_ISOLATING_FOR_RESET) && ++ !(V3D_GET_FIELD(V3D_SMS_READ(V3D_SMS_REE_CS), ++ V3D_SMS_STATE) == V3D_SMS_RESETTING), 100)) { ++ DRM_ERROR("Failed to wait for SMS reset\n"); ++ } ++} ++ ++void + v3d_reset(struct v3d_dev *v3d) + { + struct drm_device *dev = &v3d->drm; +@@ -166,6 +182,7 @@ v3d_reset(struct v3d_dev *v3d) + v3d_idle_axi(v3d, 0); + + v3d_idle_gca(v3d); ++ v3d_reset_sms(v3d); + v3d_reset_v3d(v3d); + + v3d_mmu_set_page_table(v3d); +--- a/drivers/gpu/drm/v3d/v3d_regs.h ++++ b/drivers/gpu/drm/v3d/v3d_regs.h +@@ -543,4 +543,30 @@ + # define V3D_ERR_VPAERGS BIT(1) + # define V3D_ERR_VPAEABB BIT(0) + ++#define V3D_SMS_REE_CS 0x00000 ++#define V3D_SMS_TEE_CS 0x00400 ++# define V3D_SMS_INTERRUPT BIT(31) ++# define V3D_SMS_POWER_OFF BIT(30) ++# define V3D_SMS_CLEAR_POWER_OFF BIT(29) ++# define V3D_SMS_LOCK BIT(28) ++# define V3D_SMS_CLEAR_LOCK BIT(27) ++# define V3D_SMS_SVP_MODE_EXIT BIT(26) ++# define V3D_SMS_CLEAR_SVP_MODE_EXIT BIT(25) ++# define V3D_SMS_SVP_MODE_ENTER BIT(24) ++# define V3D_SMS_CLEAR_SVP_MODE_ENTER BIT(23) ++# define V3D_SMS_THEIR_MODE_EXIT BIT(22) ++# define V3D_SMS_THEIR_MODE_ENTER BIT(21) ++# define V3D_SMS_OUR_MODE_EXIT BIT(20) ++# define V3D_SMS_CLEAR_OUR_MODE_EXIT BIT(19) ++# define V3D_SMS_SEQ_PC_MASK V3D_MASK(16, 10) ++# define V3D_SMS_SEQ_PC_SHIFT 10 ++# define V3D_SMS_HUBCORE_STATUS_MASK V3D_MASK(9, 8) ++# define V3D_SMS_HUBCORE_STATUS_SHIFT 8 ++# define V3D_SMS_NEW_MODE_MASK V3D_MASK(7, 6) ++# define V3D_SMS_NEW_MODE_SHIFT 6 ++# define V3D_SMS_OLD_MODE_MASK V3D_MASK(5, 4) ++# define V3D_SMS_OLD_MODE_SHIFT 4 ++# define V3D_SMS_STATE_MASK V3D_MASK(3, 0) ++# define V3D_SMS_STATE_SHIFT 0 ++ + #endif /* V3D_REGS_H */ diff --git a/target/linux/bcm27xx/patches-6.6/950-1556-dts-bcm2712-Add-V3D_SMS-register.patch b/target/linux/bcm27xx/patches-6.6/950-1556-dts-bcm2712-Add-V3D_SMS-register.patch new file mode 100644 index 00000000000000..2d43d1c858da9e --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1556-dts-bcm2712-Add-V3D_SMS-register.patch @@ -0,0 +1,27 @@ +From 3c21211667e35029054b0dfebdf292e4e7d5754b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ma=C3=ADra=20Canal?= +Date: Thu, 27 Feb 2025 21:00:42 -0300 +Subject: [PATCH] dts: bcm2712: Add V3D_SMS register +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Maíra Canal +--- + arch/arm64/boot/dts/broadcom/bcm2712.dtsi | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/arch/arm64/boot/dts/broadcom/bcm2712.dtsi ++++ b/arch/arm64/boot/dts/broadcom/bcm2712.dtsi +@@ -1222,8 +1222,9 @@ + v3d: v3d@2000000 { + compatible = "brcm,2712-v3d"; + reg = <0x10 0x02000000 0x0 0x4000>, +- <0x10 0x02008000 0x0 0x6000>; +- reg-names = "hub", "core0"; ++ <0x10 0x02008000 0x0 0x6000>, ++ <0x10 0x02030800 0x0 0x0700>; ++ reg-names = "hub", "core0", "sms"; + + power-domains = <&pm BCM2835_POWER_DOMAIN_GRAFX_V3D>; + resets = <&pm BCM2835_RESET_V3D>; diff --git a/target/linux/bcm27xx/patches-6.6/950-1557-dts-Remove-the-power-key-debounce-on-Pi-500.patch b/target/linux/bcm27xx/patches-6.6/950-1557-dts-Remove-the-power-key-debounce-on-Pi-500.patch new file mode 100644 index 00000000000000..faccc79c2ca1a2 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1557-dts-Remove-the-power-key-debounce-on-Pi-500.patch @@ -0,0 +1,21 @@ +From 08d4e8f52256bd422d8a1f876411603f627d0a82 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 11 Mar 2025 08:58:52 +0000 +Subject: [PATCH] dts: Remove the power key debounce on Pi 500 + +Signed-off-by: Phil Elwell +--- + arch/arm64/boot/dts/broadcom/bcm2712-rpi-500.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/arm64/boot/dts/broadcom/bcm2712-rpi-500.dts ++++ b/arch/arm64/boot/dts/broadcom/bcm2712-rpi-500.dts +@@ -7,7 +7,7 @@ + }; + + &pwr_key { +- debounce-interval = <400>; ++ debounce-interval = <0>; + }; + + &gio { From 4e69539953740eff28618466dddc11dcae3477d3 Mon Sep 17 00:00:00 2001 From: Roland Reinl Date: Wed, 12 Mar 2025 19:11:08 +0100 Subject: [PATCH 567/877] ramips: Add support for Cudy M1200 v1 The M1200 v1 is similar to the TR1200 series from Cudy. Differences: - Only 1 LAN port - No USB Specifications: - MT7628 - MT7628AN (2.4G b/g/n) and MT7613BE (5G ac/n) wifi - 128 MB RAM - 16 MB flash MAC Addresses: - There is one on the label, e.g. xx:xx:xx:xx:xx:A4 - LAN (bottom connector) is the same as the label, e.g. xx:xx:xx:xx:xx:A4 - WAN (top connector) is label + 1, e.g. xx:xx:xx:xx:xx:A5 - WLAN (2.4G) is the same as the label, e.g. xx:xx:xx:xx:xx:A4 - WLAN (5G) is label + 2, e.g. xx:xx:xx:xx:xx:A6 UART: - is available via the pin holes on the board - The pinout is printed to the board: P: VCC, G: GND, R: RX, T:TX - RX and TX require solder bridges to be installed - Do NOT connect VCC - Settings: 3.3V, 115200, 8N1 GPIO: - There are two LEDs: Red (GPIO 4) and White (GPIO 0) - There are two buttons: Reset (GPIO 11) and WPS (GPIO 5) Migration to OpenWrt: - Download the migration image from the Cudy website (it should be available as soon as OpenWrt officially supports the device) - Connect computer to LAN (bottom connector) and flash the migration image via OEM web interface - OpenWrt is now accessible via 192.168.1.1 Revert back to OEM firmware: - Set up a TFTP server on IP 192.168.1.88 and connect to the WAN port (upper port) - Provide the Cudy firmware as recovery.bin in the TFTP server - Press the reset button while powering on the device - Recovery process is started now - When recovery process is done, OEM firmware is accessible via 192.168.10.1 again General information: - No possibility to load a initramfs image via U-Boot because there is no option to interrupt U-Boot Signed-off-by: Roland Reinl Link: https://github.com/openwrt/openwrt/pull/18233 (cherry picked from commit c13a050d5ad55ab090a592823a9f964af8614fc2) Link: https://github.com/openwrt/openwrt/pull/18252 Signed-off-by: Hauke Mehrtens --- .../ramips/dts/mt7628an_cudy_m1200-v1.dts | 187 ++++++++++++++++++ target/linux/ramips/image/mt76x8.mk | 11 ++ .../mt76x8/base-files/etc/board.d/02_network | 1 + 3 files changed, 199 insertions(+) create mode 100644 target/linux/ramips/dts/mt7628an_cudy_m1200-v1.dts diff --git a/target/linux/ramips/dts/mt7628an_cudy_m1200-v1.dts b/target/linux/ramips/dts/mt7628an_cudy_m1200-v1.dts new file mode 100644 index 00000000000000..05721d9984930e --- /dev/null +++ b/target/linux/ramips/dts/mt7628an_cudy_m1200-v1.dts @@ -0,0 +1,187 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7628an.dtsi" + +#include +#include +#include + +/ { + compatible = "cudy,m1200-v1", "mediatek,mt7628an-soc"; + model = "Cudy M1200 v1"; + + aliases { + led-boot = &led_status_white; + led-running = &led_status_white; + led-failsafe = &led_status_red; + led-upgrade = &led_status_red; + label-mac-device = ðernet; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + }; + + + wps { + label = "wps"; + linux,code = ; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status_red: led-status-red { + function = LED_FUNCTION_STATUS; + color = ; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + + led_status_white: led-status-white { + function = LED_FUNCTION_STATUS; + color = ; + gpios = <&gpio 0 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <40000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x400>; + }; + + eeprom_factory_8000: eeprom@8000 { + reg = <0x8000 0x4da8>; + }; + }; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0xf80000>; + }; + + partition@fd0000 { + label = "debug"; + reg = <0xfd0000 0x10000>; + read-only; + }; + + partition@fe0000 { + label = "backup"; + reg = <0xfe000 0x10000>; + read-only; + }; + + partition@ff0000 { + label = "bdinfo"; + reg = <0xff0000 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>; + }; + }; + }; + }; + }; +}; + +&state_default { + gpio { + groups = "i2c", "gpio", "wdt", "p0led_an", "wled_an"; + function = "gpio"; + }; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + nvmem-cells = <&eeprom_factory_8000>, <&macaddr_bdinfo_de00 2>; + nvmem-cell-names = "eeprom", "mac-address"; + ieee80211-freq-limit = <5000000 6000000>; + }; +}; + +&wmac { + status = "okay"; + + nvmem-cells = <&eeprom_factory_0>, <&macaddr_bdinfo_de00 1>; + nvmem-cell-names = "eeprom", "mac-address"; +}; + +ðernet { + nvmem-cells = <&macaddr_bdinfo_de00 0>; + nvmem-cell-names = "mac-address"; +}; + +&esw { + mediatek,portmap = <0x3d>; + mediatek,portdisable = <0x3c>; +}; diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk index 953dfeb50f91d5..1352b3befa4e8f 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -167,6 +167,17 @@ define Device/comfast_cf-wr758ac-v2 endef TARGET_DEVICES += comfast_cf-wr758ac-v2 +define Device/cudy_m1200-v1 + IMAGE_SIZE := 15872k + DEVICE_VENDOR := Cudy + DEVICE_MODEL := M1200 + DEVICE_VARIANT := v1 + DEVICE_PACKAGES := kmod-mt7615e kmod-mt7663-firmware-ap + UIMAGE_NAME := R22 + SUPPORTED_DEVICES += R22 +endef +TARGET_DEVICES += cudy_m1200-v1 + define Device/cudy_tr1200-v1 IMAGE_SIZE := 15872k DEVICE_VENDOR := Cudy diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network index 616baa80c055c7..56266e473c6d05 100644 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network @@ -97,6 +97,7 @@ ramips_setup_interfaces() ucidef_add_switch "switch0" \ "4:lan" "6@eth0" ;; + cudy,m1200-v1|\ cudy,tr1200-v1) ucidef_add_switch "switch0" \ "0:lan" "1:wan" "6@eth0" From d5a9ec601d4cbe95499986df3c0611928ef1d3dc Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Sat, 15 Feb 2025 12:24:20 +0000 Subject: [PATCH 568/877] mediatek: Xiaomi AX3000t: enable SPI calibration Xiaomi enabled SPI calibration in new firmware: - 1.0.84 and newer (rd03 model) - 1.0.76 and newer (rd23 model) This enables SPI calibration routines in OpenWrt too. Tested-by: Aleksandr Danilov Signed-off-by: Mikhail Zhilkin Link: https://github.com/openwrt/openwrt/pull/17976 (cherry picked from commit 043df82cea89786f1dcdfe47af1736bf8833fde9) Signed-off-by: Mikhail Zhilkin Link: https://github.com/openwrt/openwrt/pull/18270 Signed-off-by: Hauke Mehrtens --- .../mediatek/dts/mt7981b-xiaomi-mi-router-common.dtsi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-common.dtsi b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-common.dtsi index c64b55cf6fa4ee..511184d771b424 100644 --- a/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-common.dtsi +++ b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-common.dtsi @@ -315,6 +315,13 @@ compatible = "spi-nand"; reg = <0>; + 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-max-frequency = <52000000>; spi-tx-bus-width = <4>; spi-rx-bus-width = <4>; From a748c1af757aef53e2e781c61db7eafed0a27c66 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Sun, 2 Mar 2025 20:06:49 +0800 Subject: [PATCH 569/877] ramips: fix reading mac address for hiwifi hc5962 The spaces in variables have been stripped since commit 551e04f3c9c0 ("base-files: strip space and tab characters from ASCII mac address"), resulting "Vfac_mac " matches nothing. Fix the issue by removing the space at end. Signed-off-by: Tianling Shen Link: https://github.com/openwrt/openwrt/pull/18150 Signed-off-by: Hauke Mehrtens (cherry picked from commit 2091c29578ca99b468e79695149be6f4b6cccb36) --- target/linux/ramips/mt7621/base-files/etc/board.d/02_network | 2 +- .../mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 8d94cd592d6e2f..2374d5f60a28be 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 @@ -266,7 +266,7 @@ ramips_setup_macs() wan_mac=$label_mac ;; hiwifi,hc5962) - lan_mac=$(mtd_get_mac_ascii bdinfo "Vfac_mac ") + lan_mac=$(mtd_get_mac_ascii bdinfo "Vfac_mac") label_mac=$lan_mac [ -n "$lan_mac" ] || lan_mac=$(cat /sys/class/net/eth0/address) wan_mac=$(macaddr_add "$lan_mac" 1) 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 4a056623abc021..05e4ebe99ae04c 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 @@ -103,7 +103,7 @@ case "$board" in macaddr_setbit_la "$(mtd_get_mac_binary factory 0x4)" > /sys${DEVPATH}/macaddress ;; hiwifi,hc5962) - label_mac=$(mtd_get_mac_ascii bdinfo "Vfac_mac ") + label_mac=$(mtd_get_mac_ascii bdinfo "Vfac_mac") [ "$PHYNBR" = "0" ] && [ -n "$label_mac" ] && \ echo -n "$label_mac" > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && [ -n "$label_mac" ] && \ From cfd155aab96a1d2ce52ce21d1320e917bc6a56fd Mon Sep 17 00:00:00 2001 From: John Audia Date: Sat, 8 Mar 2025 16:33:32 -0500 Subject: [PATCH 570/877] firmware: intel-microcode: update to 20250211 Debian Changelogs from 20240531: local access. - Mitigations for INTEL-SA-01079 (CVE-2024-23918) Potential security vulnerabilities in some Intel Xeon processors using Intel SGX may allow escalation of privilege. Intel disclosed that some processor models were already fixed by a previous microcode update. - Updated mitigations for INTEL-SA-01097 (CVE-2024-24968) Improper finite state machines (FSMs) in hardware logic in some Intel Processors may allow an privileged user to potentially enable a denial of service via local access. - Mitigations for INTEL-SA-01103 (CVE-2024-23984) A potential security vulnerability in the Running Average Power Limit (RAPL) interface for some Intel Processors may allow information disclosure. Added mitigations for more processor models. * Updated Microcodes: sig 0x000806f8, pf_mask 0x87, 2024-06-20, rev 0x2b000603, size 588800 sig 0x000806f7, pf_mask 0x87, 2024-06-20, rev 0x2b000603 sig 0x000806f6, pf_mask 0x87, 2024-06-20, rev 0x2b000603 sig 0x000806f5, pf_mask 0x87, 2024-06-20, rev 0x2b000603 sig 0x000806f4, pf_mask 0x87, 2024-06-20, rev 0x2b000603 sig 0x00090672, pf_mask 0x07, 2024-05-29, rev 0x0037, size 224256 sig 0x00090675, pf_mask 0x07, 2024-05-29, rev 0x0037 sig 0x000b06f2, pf_mask 0x07, 2024-05-29, rev 0x0037 sig 0x000b06f5, pf_mask 0x07, 2024-05-29, rev 0x0037 sig 0x000906a3, pf_mask 0x80, 2024-06-03, rev 0x0435, size 223232 sig 0x000906a4, pf_mask 0x80, 2024-06-03, rev 0x0435 sig 0x000a06a4, pf_mask 0xe6, 2024-08-02, rev 0x0020, size 138240 sig 0x000b06a2, pf_mask 0xe0, 2024-05-29, rev 0x4123, size 220160 sig 0x000b06a3, pf_mask 0xe0, 2024-05-29, rev 0x4123 sig 0x000b06a8, pf_mask 0xe0, 2024-05-29, rev 0x4123 sig 0x000c06f2, pf_mask 0x87, 2024-06-20, rev 0x21000283, size 560128 sig 0x000c06f1, pf_mask 0x87, 2024-06-20, rev 0x21000283 * source: update symlinks to reflect id of the latest release, 20241112 * Update changelog for 3.20240910.1 and 3.20240813.1 with new information: INTEL-SA-1103 was addressed by 3.20240813.1 for some processor models, and not by 3.20240910. INTEL-SA-1079 was addressed by 3.20240910.1 for some processor models. -- Henrique de Moraes Holschuh Thu, 14 Nov 2024 15:37:40 -0300 intel-microcode (3.20241029.1) UNRELEASED; urgency=medium * New upstream microcode datafile 20241029 - Not relevant for operating system microcode updates - Only when loaded from firmware, this update fixes the critical, potentially hardware-damaging errata RPL061: Incorrect Internal Voltage Request on Raptor Lake (Core 13th/14th gen) Intel processors. * Updated Microcodes: sig 0x000b0671, pf_mask 0x32, 2024-08-29, rev 0x012b, size 211968 -- Henrique de Moraes Holschuh Thu, 14 Nov 2024 14:49:03 -0300 intel-microcode (3.20240910.1) unstable; urgency=medium * New upstream microcode datafile 20240910 (closes: #1081363) - Mitigations for INTEL-SA-01097 (CVE-2024-24968) Improper finite state machines (FSMs) in hardware logic in some Intel Processors may allow an privileged user to potentially enable a denial of service via local access. - Fixes for unspecified functional issues on several processor models - The processor voltage limit issue on Core 13rd/14th gen REQUIRES A FIRMWARE UPDATE. It is present in this release for sig 0xb0671, but THE VOLTAGE ISSUE FIX ONLY WORKS WHEN THE MICROCODE UPDATE IS LOADED THROUGH THE FIT TABLE IN FIRMWARE. Contact your system vendor for a firmware update that includes the appropriate microcode update for your processor. * Updated Microcodes: sig 0x00090672, pf_mask 0x07, 2024-02-22, rev 0x0036, size 224256 sig 0x00090675, pf_mask 0x07, 2024-02-22, rev 0x0036 sig 0x000b06f2, pf_mask 0x07, 2024-02-22, rev 0x0036 sig 0x000b06f5, pf_mask 0x07, 2024-02-22, rev 0x0036 sig 0x000906a3, pf_mask 0x80, 2024-02-22, rev 0x0434, size 222208 sig 0x000906a4, pf_mask 0x80, 2024-02-22, rev 0x0434 sig 0x000a06a4, pf_mask 0xe6, 2024-06-17, rev 0x001f, size 137216 sig 0x000b0671, pf_mask 0x32, 2024-07-18, rev 0x0129, size 215040 sig 0x000b06a2, pf_mask 0xe0, 2024-02-22, rev 0x4122, size 220160 sig 0x000b06a3, pf_mask 0xe0, 2024-02-22, rev 0x4122 sig 0x000b06a8, pf_mask 0xe0, 2024-02-22, rev 0x4122 sig 0x000b06e0, pf_mask 0x19, 2024-03-25, rev 0x001a, size 138240 * Update changelog for 3.20240813.1 with new information * Update changelog for 3.20240514.1 with new information * source: update symlinks to reflect id of the latest release, 20240910 -- Henrique de Moraes Holschuh Sat, 21 Sep 2024 16:40:07 -0300 intel-microcode (3.20240813.2) unstable; urgency=high * Merge changes from intel-microcode/3.20240531.1+nmu1, which were left out from 3.20240813.1 by an oversight, regressing merged-usr. Closes: #1060200 -- Henrique de Moraes Holschuh Sat, 17 Aug 2024 11:31:32 -0300 intel-microcode (3.20240813.1) unstable; urgency=medium * New upstream microcode datafile 20240813 (closes: #1078742) - Mitigations for INTEL-SA-01083 (CVE-2024-24853) Incorrect behavior order in transition between executive monitor and SMI transfer monitor (STM) in some Intel Processors may allow a privileged user to potentially enable escalation of privilege via local access. - Mitigations for INTEL-SA-01118 (CVE-2024-25939) Mirrored regions with different values in 3rd Generation Intel Xeon Scalable Processors may allow a privileged user to potentially enable denial of service via local access. - Mitigations for INTEL-SA-01100 (CVE-2024-24980) Protection mechanism failure in some 3rd, 4th, and 5th Generation Intel Xeon Processors may allow a privileged user to potentially enable escalation of privilege via local access. - Mitigations for INTEL-SA-01038 (CVE-2023-42667) Improper isolation in the Intel Core Ultra Processor stream cache mechanism may allow an authenticated user to potentially enable escalation of privilege via local access. Intel disclosed that some processor models were already fixed by the previous microcode update. - Mitigations for INTEL-SA-01046 (CVE-2023-49141) Improper isolation in some Intel Processors stream cache mechanism may allow an authenticated user to potentially enable escalation of privilege via local access. Intel disclosed that some processor models were already fixed by the previous microcode update. - Mitigations for INTEL-SA-01079 (CVE-2024-23918) Potential security vulnerabilities in some Intel Xeon processors using Intel SGX may allow escalation of privilege. Intel released this information during the full disclosure for the 20241112 update. Processor signatures 0x606a6 and 0x606c1. - Mitigations for INTEL-SA-01103 (CVE-2024-23984) A potential security vulnerability in the Running Average Power Limit (RAPL) interface for some Intel Processors may allow information disclosure. Intel released this information during the full disclosure for the 20240910 update. Processor signatures 0x5065b, 0x606a6, 0x606c1. - Fix for unspecified functional issues on several processor models - Fix for errata TGL068/ADL075/ICL088/... "Processor may hang during a microcode update". It is not clear which processors were fixed by this release, or by one of the microcode updates from 2024-05. - Mitigations for INTEL-SA-01213 (CVE-2024-36293) Improper access control in the EDECCSSA user leaf function for some Intel Processors with Intel SGX may allow an authenticated user to potentially enable denial of service via local access. Intel released this information during the full disclosure for the 20250211 update. Processor signature 0x906ec (9th Generation Intel Core processor). * Updated microcodes: sig 0x00050657, pf_mask 0xbf, 2024-03-01, rev 0x5003707, size 39936 sig 0x0005065b, pf_mask 0xbf, 2024-04-01, rev 0x7002904, size 30720 sig 0x000606a6, pf_mask 0x87, 2024-04-01, rev 0xd0003e7, size 308224 sig 0x000606c1, pf_mask 0x10, 2024-04-03, rev 0x10002b0, size 300032 sig 0x000706e5, pf_mask 0x80, 2024-02-15, rev 0x00c6, size 114688 sig 0x000806c1, pf_mask 0x80, 2024-02-15, rev 0x00b8, size 112640 sig 0x000806c2, pf_mask 0xc2, 2024-02-15, rev 0x0038, size 99328 sig 0x000806d1, pf_mask 0xc2, 2024-02-15, rev 0x0052, size 104448 sig 0x000806e9, pf_mask 0xc0, 2024-02-01, rev 0x00f6, size 106496 sig 0x000806e9, pf_mask 0x10, 2024-02-01, rev 0x00f6, size 106496 sig 0x000806ea, pf_mask 0xc0, 2024-02-01, rev 0x00f6, size 105472 sig 0x000806eb, pf_mask 0xd0, 2024-02-01, rev 0x00f6, size 106496 sig 0x000806ec, pf_mask 0x94, 2024-02-05, rev 0x00fc, size 106496 sig 0x00090661, pf_mask 0x01, 2024-04-05, rev 0x001a, size 20480 sig 0x000906ea, pf_mask 0x22, 2024-02-01, rev 0x00f8, size 105472 sig 0x000906eb, pf_mask 0x02, 2024-02-01, rev 0x00f6, size 106496 sig 0x000906ec, pf_mask 0x22, 2024-02-01, rev 0x00f8, size 106496 sig 0x000906ed, pf_mask 0x22, 2024-02-05, rev 0x0100, size 106496 sig 0x000a0652, pf_mask 0x20, 2024-02-01, rev 0x00fc, size 97280 sig 0x000a0653, pf_mask 0x22, 2024-02-01, rev 0x00fc, size 98304 sig 0x000a0655, pf_mask 0x22, 2024-02-01, rev 0x00fc, size 97280 sig 0x000a0660, pf_mask 0x80, 2024-02-01, rev 0x00fe, size 97280 sig 0x000a0661, pf_mask 0x80, 2024-02-01, rev 0x00fc, size 97280 sig 0x000a0671, pf_mask 0x02, 2024-03-07, rev 0x0062, size 108544 sig 0x000a06a4, pf_mask 0xe6, 2024-04-15, rev 0x001e, size 137216 * source: update symlinks to reflect id of the latest release, 20240813 * postinst, postrm: switch to dpkg-trigger to run update-initramfs -- Henrique de Moraes Holschuh Thu, 15 Aug 2024 14:41:50 -0300 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/18197 Signed-off-by: Hauke Mehrtens (cherry picked from commit f4801cffc3697d57a6d47e325d2f43c785ce3416) --- 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 bdd8ae73d88f3c..2ec1f22c35d872 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:=20240531 +PKG_VERSION:=20250211 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:=808cbb57a790dab7060b59b31e70e54ac47d3798d75e9784ed57a65b9f951fc4 +PKG_HASH:=06b7aca49790d673623cb42f7a62a517d82555ce96371d2967b568d6e30fd787 PKG_BUILD_DIR:=$(BUILD_DIR)/intel-microcode-3.$(PKG_VERSION).1 PKG_CPE_ID:=cpe:/a:intel:microcode From 9db716b6dcc12a9e3e0f91adacc6cef19d6e0eba Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Fri, 14 Mar 2025 19:19:11 +0800 Subject: [PATCH 571/877] stm32: modules: fix stm32-hash package build * Remove misplaced backslash to fix the build warning: WARNING: can't parse line: FILES:=/drivers/crypto/stm32/stm32-hash.ko * Add missing dependency package kmod-crypto-engine: Package kmod-stm32-hash is missing dependencies for the following libraries: crypto_engine.ko Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/18241 Signed-off-by: Hauke Mehrtens (cherry picked from commit 4efb4a26d28ecdd5fec9dc3a85bcb46a45a75f60) --- target/linux/stm32/modules.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/linux/stm32/modules.mk b/target/linux/stm32/modules.mk index baba80baba43aa..2a9ec36e46d930 100644 --- a/target/linux/stm32/modules.mk +++ b/target/linux/stm32/modules.mk @@ -216,13 +216,14 @@ define KernelPackage/stm32-hash SUBMENU:=$(CRYPTO_MENU) TITLE:=Support for STM32 hash accelerators DEPENDS:=@TARGET_stm32 \ + +kmod-crypto-engine \ +kmod-crypto-md5 \ +kmod-crypto-sha1 \ +kmod-crypto-sha256 \ +kmod-crypto-sha3 \ +kmod-crypto-rsa KCONFIG:=CONFIG_CRYPTO_DEV_STM32_HASH \ - CONFIG_CRYPTO_ENGINE=y \ + CONFIG_CRYPTO_ENGINE=y FILES:=$(LINUX_DIR)/drivers/crypto/stm32/stm32-hash.ko AUTOLOAD:=$(call AutoProbe,stm32-hash) endef From 2d8bed0fa1dd006d231143adb9c6457e2510851e Mon Sep 17 00:00:00 2001 From: Thomas Richard Date: Mon, 24 Feb 2025 11:15:51 +0100 Subject: [PATCH 572/877] optee-os.mk: override default PATH to not use hostpkg python In some cases hostpkg python from packages feed is used (hostpkg has higher priority in PATH) which causes build failure (cryptography module is missing). So override PATH to not use hostpkg python. Signed-off-by: Thomas Richard Link: https://github.com/openwrt/openwrt/pull/18102 Signed-off-by: Hauke Mehrtens (cherry picked from commit 8c3a43be27d989ef42d4148949e43266694a5168) --- include/optee-os.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/optee-os.mk b/include/optee-os.mk index 396d2406bfac92..3694b498fd583a 100644 --- a/include/optee-os.mk +++ b/include/optee-os.mk @@ -85,7 +85,7 @@ endef define Build/Compile/Optee-os +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \ - PATH=$(LINUX_DIR)/scripts/dtc/:$(PATH) \ + PATH=$(LINUX_DIR)/scripts/dtc/:$(STAGING_DIR_HOST)/bin:$(PATH) \ CROSS_COMPILE=$(TARGET_CROSS) \ CROSS_COMPILE_core="$(TARGET_CROSS)" \ CROSS_COMPILE_ta_arm64="$(TARGET_CROSS)" \ From 3c1edff2938e6055331d2934f50fa478703ba07c Mon Sep 17 00:00:00 2001 From: "J. S. Seldenthuis" Date: Sun, 23 Feb 2025 13:54:58 +0100 Subject: [PATCH 573/877] ramips: use openwrt,netdev-name to fix port name conflict on TP-Link Deco M4R v4 Since 24.10.0, eth0, used for the WAN interface, does not work. From dmesg: ... [ 1.831126] mt7530-mdio mdio-bus:1f: MT7530 adapts as multi-chip module [ 1.846204] mtk_soc_eth 1e100000.ethernet eth0: mediatek frame engine at 0xbe100000, irq 19 ... [ 1.933969] mt7530-mdio mdio-bus:1f: MT7530 adapts as multi-chip module [ 1.967668] mt7530-mdio mdio-bus:1f: configuring for fixed/rgmii link mode [ 1.975999] mt7530-mdio mdio-bus:1f eth0 (uninitialized): PHY [mt7530-0:00] driver [MediaTek MT7530 PHY] (irq=21) [ 1.986907] mt7530-mdio mdio-bus:1f: Link is Up - 1Gbps/Full - flow control rx/tx [ 1.987149] mtk_soc_eth 1e100000.ethernet eth0: error -17 registering interface eth0 [ 2.004157] mt7530-mdio mdio-bus:1f eth1 (uninitialized): PHY [mt7530-0:01] driver [MediaTek MT7530 PHY] (irq=22) [ 2.017698] mtk_soc_eth 1e100000.ethernet eth0: entered promiscuous mode [ 2.024849] DSA: tree 0 setup ... [ 4.249680] mtk_soc_eth 1e100000.ethernet dsa: renamed from eth0 ... Like #15865, it seems that gmac0 does not rename eth0 to dsa until after the switch ports are initialized, leading to a name collision (error -17 = EEXIST). This patch follows #17062 by using openwrt,netdev-name to fix the collision. Signed-off-by: J. S. Seldenthuis Link: https://github.com/openwrt/openwrt/pull/18082 Signed-off-by: Hauke Mehrtens (cherry picked from commit 4fed462454469e9af89bc92cd12d30c47d43efe4) --- target/linux/ramips/dts/mt7621_tplink_deco-m4r-v4.dts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_tplink_deco-m4r-v4.dts b/target/linux/ramips/dts/mt7621_tplink_deco-m4r-v4.dts index 6274f9859983f5..b9e359d2f14f86 100644 --- a/target/linux/ramips/dts/mt7621_tplink_deco-m4r-v4.dts +++ b/target/linux/ramips/dts/mt7621_tplink_deco-m4r-v4.dts @@ -181,19 +181,19 @@ &gmac0 { nvmem-cells = <&macaddr_config_8>; nvmem-cell-names = "mac-address"; - label = "dsa"; + openwrt,netdev-name = "dsa"; }; &switch0 { ports { port@0 { status = "okay"; - label = "eth0"; + openwrt,netdev-name = "eth0"; }; port@1 { status = "okay"; - label = "eth1"; + openwrt,netdev-name = "eth1"; }; }; }; From 82fabe43709da2d7f744e8e05ab19317420c8063 Mon Sep 17 00:00:00 2001 From: Tomasz Maciej Nowak Date: Tue, 4 Mar 2025 17:43:10 +0100 Subject: [PATCH 574/877] uboot-mediatek: u7623: remove keys pin function Apparently U-Boot will discard whole node if requested pin function is unknown to the driver. This resulted in inability to interact with U-Boot on the said board, as U-Boot always assumed the recovery key pressed and issued recovery procedure. Log snippet: button_gpio gpio-keys: pinctrl_select_state_full: pinctrl_config_one: err=-38 reset button found button pushed, resetting environment Recovery procedure also booted recovery image, which didn't affect much the 23.05.x release, since the root fs argument was valid, so changes persisted. But as 24.10.x hit with fitblk, the board will boot only recovery image (initramfs) because of default bootargs will reset on each boot and U-Boot provided bootargs took precedence. Fixes: 42eeb22450f2 ("uboot-mediatek: fix factory/reset button") Signed-off-by: Tomasz Maciej Nowak Link: https://patchwork.ozlabs.org/project/openwrt/patch/20250304164507.60511-1-tmn505@terefe.re/ Signed-off-by: Hauke Mehrtens (cherry picked from commit f8a2e1c68b48d72234172543f4232e77f065ca4d) --- .../uboot-mediatek/patches/401-update-u7623-defconfig.patch | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package/boot/uboot-mediatek/patches/401-update-u7623-defconfig.patch b/package/boot/uboot-mediatek/patches/401-update-u7623-defconfig.patch index 1fb0ae9c9eb0b7..7d193696720214 100644 --- a/package/boot/uboot-mediatek/patches/401-update-u7623-defconfig.patch +++ b/package/boot/uboot-mediatek/patches/401-update-u7623-defconfig.patch @@ -187,13 +187,12 @@ leds { compatible = "gpio-leds"; -@@ -109,6 +122,19 @@ +@@ -109,6 +122,18 @@ }; }; + key_pins_a: keys-alt { + mux { -+ function = "gpio"; + groups = "msdc3"; + }; + From 5c533d7a898b6aed5af5c52f0aaf432d632281ab Mon Sep 17 00:00:00 2001 From: Tomasz Maciej Nowak Date: Tue, 4 Mar 2025 17:43:11 +0100 Subject: [PATCH 575/877] mediatek: u7623: fix network switch enumeration With upstream changes hitting kernel 6.4 the dtb for u7623 ends up with both mac (gmac) disabled, since this is now the default status in mt7623.dtsi. Fix this by including mt7623a.dtsi (which already has all necessary bits) and enabling all revlevant ports. This will also do a side hustle of assigning proper clocks for power controller and specifying proper power domain for few devices. Link: https://lore.kernel.org/all/20230210182505.24597-1-arinc.unal@arinc9.com Signed-off-by: Tomasz Maciej Nowak Link: https://patchwork.ozlabs.org/project/openwrt/patch/20250304164507.60511-2-tmn505@terefe.re/ Signed-off-by: Hauke Mehrtens (cherry picked from commit adc4d95c742139411c551a20d93103c9a1155ddd) --- .../dts/mt7623a-unielec-u7623-02.dtsi | 117 +++++------------- 1 file changed, 30 insertions(+), 87 deletions(-) diff --git a/target/linux/mediatek/dts/mt7623a-unielec-u7623-02.dtsi b/target/linux/mediatek/dts/mt7623a-unielec-u7623-02.dtsi index fedf8b859661f8..eaa2e74112e3cf 100644 --- a/target/linux/mediatek/dts/mt7623a-unielec-u7623-02.dtsi +++ b/target/linux/mediatek/dts/mt7623a-unielec-u7623-02.dtsi @@ -4,7 +4,7 @@ */ #include -#include "mt7623.dtsi" +#include "mt7623a.dtsi" #include "mt6323.dtsi" / { @@ -102,92 +102,6 @@ status = "okay"; }; -ð { - status = "okay"; - - gmac0: mac@0 { - compatible = "mediatek,eth-mac"; - reg = <0>; - phy-mode = "trgmii"; - - fixed-link { - speed = <1000>; - full-duplex; - pause; - }; - }; - - mdio: mdio-bus { - #address-cells = <1>; - #size-cells = <0>; - - mt7530: switch@1f { - }; - }; -}; - -&mt7530 { - compatible = "mediatek,mt7530"; - reg = <31>; - #address-cells = <1>; - #size-cells = <0>; - pinctrl-names = "default"; - mediatek,mcm; - resets = <ðsys 2>; - reset-names = "mcm"; - core-supply = <&mt6323_vpa_reg>; - io-supply = <&mt6323_vemc3v3_reg>; - - dsa,mii-bus = <&mdio>; - - ports { - #address-cells = <1>; - #size-cells = <0>; - reg = <0>; - - port@0 { - reg = <0>; - label = "lan0"; - cpu = <&cpu_port0>; - }; - - port@1 { - reg = <1>; - label = "lan1"; - cpu = <&cpu_port0>; - }; - - port@2 { - reg = <2>; - label = "lan2"; - cpu = <&cpu_port0>; - }; - - port@3 { - reg = <3>; - label = "lan3"; - cpu = <&cpu_port0>; - }; - - port@4 { - reg = <4>; - label = "wan"; - cpu = <&cpu_port0>; - }; - - cpu_port0: port@6 { - reg = <6>; - ethernet = <&gmac0>; - phy-mode = "trgmii"; - - fixed-link { - speed = <1000>; - full-duplex; - }; - }; - }; -}; - &mmc0 { pinctrl-names = "default", "state_uhs"; pinctrl-0 = <&mmc0_pins_default>; @@ -305,6 +219,35 @@ mediatek,long-press-mode = <0>; }; +&switch0 { + ports { + port@0 { + status = "okay"; + label = "lan0"; + }; + + port@1 { + status = "okay"; + label = "lan1"; + }; + + port@2 { + status = "okay"; + label = "lan2"; + }; + + port@3 { + status = "okay"; + label = "lan3"; + }; + + port@4 { + status = "okay"; + label = "wan"; + }; + }; +}; + &uart2 { pinctrl-names = "default"; pinctrl-0 = <&uart2_pins_b>; From 53479294fb0a85368a0359df171e452b4bdcbdbf Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Thu, 6 Mar 2025 12:19:40 +0100 Subject: [PATCH 576/877] generic: globally enable CONFIG_PCPU_DEV_REFCNT Quoting the kconfig description for CONFIG_PCPU_DEV_REFCNT: network device refcount are using per cpu variables if this option is set. This can be forced to N to detect underflows (with a performance drop). This was introduced from kernel 5.13 and was wrongly set as disabled. Some target actually enables it but this should be always enabled unless refcount needs to be debugged (unlikely for production images) Enable in generic and drop the entry in every other target. Signed-off-by: Christian Marangi Link: https://github.com/openwrt/openwrt/pull/18174 Signed-off-by: Robert Marko (cherry picked from commit ea6f3e49d6509f3bddb43364cf7225b4935fee82) --- target/linux/d1/config-6.6 | 1 - target/linux/generic/config-6.6 | 2 +- target/linux/loongarch64/config-6.6 | 1 - target/linux/stm32/stm32mp1/config-6.6 | 1 - 4 files changed, 1 insertion(+), 4 deletions(-) diff --git a/target/linux/d1/config-6.6 b/target/linux/d1/config-6.6 index 7330cc0e24473a..0bfcdf79585a23 100644 --- a/target/linux/d1/config-6.6 +++ b/target/linux/d1/config-6.6 @@ -217,7 +217,6 @@ CONFIG_PAGE_SIZE_LESS_THAN_256KB=y CONFIG_PAGE_SIZE_LESS_THAN_64KB=y # CONFIG_PAGE_TABLE_CHECK is not set CONFIG_PANIC_TIMEOUT=0 -CONFIG_PCPU_DEV_REFCNT=y CONFIG_PGTABLE_LEVELS=5 CONFIG_PHYLIB=y CONFIG_PHYLINK=y diff --git a/target/linux/generic/config-6.6 b/target/linux/generic/config-6.6 index c8ebee70278022..46283ac3bd818d 100644 --- a/target/linux/generic/config-6.6 +++ b/target/linux/generic/config-6.6 @@ -4563,7 +4563,7 @@ CONFIG_PCI_SYSCALL=y # CONFIG_PCMCIA_XIRC2PS is not set # CONFIG_PCMCIA_XIRCOM is not set # CONFIG_PCNET32 is not set -# CONFIG_PCPU_DEV_REFCNT is not set +CONFIG_PCPU_DEV_REFCNT=y CONFIG_PCP_BATCH_SCALE_MAX=5 # CONFIG_PCSPKR_PLATFORM is not set # CONFIG_PCS_MTK_USXGMII is not set diff --git a/target/linux/loongarch64/config-6.6 b/target/linux/loongarch64/config-6.6 index 57bc7d5691a3b8..3badd8e94e2c9c 100644 --- a/target/linux/loongarch64/config-6.6 +++ b/target/linux/loongarch64/config-6.6 @@ -526,7 +526,6 @@ CONFIG_PCI_LOONGSON=y CONFIG_PCI_MSI=y CONFIG_PCI_MSI_ARCH_FALLBACKS=y CONFIG_PCI_REALLOC_ENABLE_AUTO=y -CONFIG_PCPU_DEV_REFCNT=y # CONFIG_PDS_CORE is not set CONFIG_PERF_USE_VMALLOC=y CONFIG_PGTABLE_3LEVEL=y diff --git a/target/linux/stm32/stm32mp1/config-6.6 b/target/linux/stm32/stm32mp1/config-6.6 index 0428216ecbb0fc..f7ed9030c69673 100644 --- a/target/linux/stm32/stm32mp1/config-6.6 +++ b/target/linux/stm32/stm32mp1/config-6.6 @@ -344,7 +344,6 @@ CONFIG_PAGE_SIZE_LESS_THAN_64KB=y # CONFIG_PANIC_ON_OOPS is not set CONFIG_PANIC_ON_OOPS_VALUE=0 CONFIG_PANIC_TIMEOUT=0 -CONFIG_PCPU_DEV_REFCNT=y CONFIG_PCS_XPCS=y CONFIG_PERF_USE_VMALLOC=y CONFIG_PGTABLE_LEVELS=2 From 9e63e2410d7896f114eba6efa26ad3815716256e Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 19 Mar 2025 13:18:59 +0100 Subject: [PATCH 577/877] libnl-tiny: update to Git HEAD (2025-03-19) c0df580adbd4 attr.c: fix nla_reserve size check Signed-off-by: Felix Fietkau (cherry picked from commit ddc2ae02b3495ffcc6bb5194c777952621c46c25) --- 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 c211288f8eb150..d08100169361fc 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-12-05 -PKG_SOURCE_VERSION:=965c4bf49658342ced0bd6e7cb069571b4a1ddff -PKG_MIRROR_HASH:=4b56499e71f5f10b123e1c7ee13dbfcd970de560bff8d16ab39dc25c9ff743cb +PKG_SOURCE_DATE:=2025-03-19 +PKG_SOURCE_VERSION:=c0df580adbd4d555ecc1962dbe88e91d75b67a4e +PKG_MIRROR_HASH:=1064a27824d99a93cbf8dbc808caf2cb277f1825b378ec6076d2ecfb8866a81f CMAKE_INSTALL:=1 PKG_LICENSE:=LGPL-2.1 From bde35a6c7d211ca88c4b4af7f63f9c7c5cebfa07 Mon Sep 17 00:00:00 2001 From: Paul Donald Date: Sun, 21 Apr 2024 23:18:36 +0200 Subject: [PATCH 578/877] lldpd: get_config_cid_ifaces() -> get_interface_csv() where csv = comma separated value(s) Make the function more generic. Can use it for not only 'config'. Now it can be used to parse interfaces for additional lldpd settings, e.g. custom-tlv. Tested on: 22.03.6 Signed-off-by: Paul Donald Link: https://github.com/openwrt/openwrt/pull/14872 (cherry picked from commit a015f59880c72a1bdd07de32491f85ce7f8d2a1c) Link: https://github.com/openwrt/openwrt/pull/18343 Signed-off-by: Robert Marko --- package/network/services/lldpd/files/lldpd.init | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/network/services/lldpd/files/lldpd.init b/package/network/services/lldpd/files/lldpd.init index 6c1c184bfa10a6..2ad59f8cb14cca 100644 --- a/package/network/services/lldpd/files/lldpd.init +++ b/package/network/services/lldpd/files/lldpd.init @@ -75,9 +75,9 @@ get_config_restart_hash() { export -n "$var=$_hash" } -get_config_cid_ifaces() { +get_interface_csv() { local _ifaces - config_get _ifaces 'config' "$2" + config_get _ifaces "$2" "$3" local _iface _ifnames="" # Set noglob to prevent '*' capturing diverse file names in the for ... in @@ -109,7 +109,7 @@ write_lldpd_conf() config_get lldp_hostname 'config' 'lldp_hostname' "$(cat /proc/sys/kernel/hostname)" local ifnames - get_config_cid_ifaces ifnames "interface" + get_interface_csv ifnames 'config' "interface" local lldp_mgmt_ip config_get lldp_mgmt_ip 'config' 'lldp_mgmt_ip' @@ -335,7 +335,7 @@ start_service() { # ChassisID interfaces local ifnames - get_config_cid_ifaces ifnames "cid_interface" + get_interface_csv ifnames 'config' "cid_interface" [ -n "$ifnames" ] && procd_append_param command -C "$ifnames" From de2718b2f36282d1ba8e85e99f37afa0821e5ed3 Mon Sep 17 00:00:00 2001 From: Paul Donald Date: Mon, 22 Apr 2024 00:08:48 +0200 Subject: [PATCH 579/877] lldpd: add `custom-tlv` handling Do not verify the format of TLV. Leave that to lldpd. These lldpd config entries: config custom-tlv list ports 'eth0' option tlv 'replace oui 33,44,55 subtype 254 oui-info 55,55,55,55,55' config custom-tlv option tlv 'oui 33,44,44 subtype 232' list ports 'br-lan' list ports 'eth0' config custom-tlv # oui-info truncated option tlv 'add oui 33,44,33 subtype 66 oui-info 5555555555' config custom-tlv option tlv 'add oui 33,44,31 subtype 44' config custom-tlv # invalid oui option tlv 'add oui 3322 subtype 79' config custom-tlv # invalid oui option tlv 'oui 3312 subtype 74' Produce the following lldpd.conf content: configure ports eth0 lldp custom-tlv replace oui 33,44,55 subtype 254 oui-info 55,55,55,55,55 configure ports br-lan,eth0 lldp custom-tlv oui 33,44,44 subtype 232 configure lldp custom-tlv add oui 33,44,33 subtype 66 oui-info 5555555555 configure lldp custom-tlv add oui 33,44,31 subtype 44 configure lldp custom-tlv add oui 3322 subtype 79 configure lldp custom-tlv oui 3312 subtype 74 And lldpd (v1.0.13 on v22) logs the following: Sat Mar 16 19:11:39 2024 daemon.info lldpd[10916]: custom TLV op replace oui 33:44:55 subtype fe Sat Mar 16 19:11:39 2024 daemon.info lldpd[10916]: custom TLV op add oui 33:44:44 subtype e8 Sat Mar 16 19:11:39 2024 daemon.info lldpd[10916]: custom TLV op add oui 33:44:33 subtype 42 Sat Mar 16 19:11:39 2024 daemon.info lldpd[10916]: custom TLV op add oui 33:44:33 subtype 42 Sat Mar 16 19:11:39 2024 daemon.info lldpd[10916]: custom TLV op add oui 33:44:31 subtype 2c Sat Mar 16 19:11:39 2024 daemon.info lldpd[10916]: custom TLV op add oui 33:44:31 subtype 2c Sat Mar 16 19:11:39 2024 daemon.warn lldpcli[10915]: invalid OUI value '3322' Sat Mar 16 19:11:39 2024 daemon.info lldpcli[10915]: an error occurred while executing last command Sat Mar 16 19:11:39 2024 daemon.warn lldpcli[10915]: invalid OUI value '3312' Sat Mar 16 19:11:39 2024 daemon.info lldpcli[10915]: an error occurred while executing last command Sat Mar 16 19:11:39 2024 daemon.info lldpcli[10915]: lldpd should resume operations ( The last two TLV are invalid: their oui must be three hex bytes, comma separated. Only the first hex byte of oui-info 5555555555 is used ) Depends on #14867 and its release version bump Tested on: 22.03.6 Signed-off-by: Paul Donald Link: https://github.com/openwrt/openwrt/pull/14872 (cherry picked from commit 8d1fe32c2c46a8de519f9926be2bc062cef66f24) Link: https://github.com/openwrt/openwrt/pull/18343 Signed-off-by: Robert Marko --- .../network/services/lldpd/files/lldpd.init | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/package/network/services/lldpd/files/lldpd.init b/package/network/services/lldpd/files/lldpd.init index 2ad59f8cb14cca..e60cc82fd3d844 100644 --- a/package/network/services/lldpd/files/lldpd.init +++ b/package/network/services/lldpd/files/lldpd.init @@ -98,6 +98,21 @@ get_interface_csv() { export -n "${1}=$_ifnames" } +add_custom_tlv_callback() +{ + # syntax: configure [ports ethX[,…]] lldp custom-tlv [add|replace] oui XX,XX,XX subtype XX oui-info XX[,XX,...] + # ex: configure ports br-lan,eth0 lldp custom-tlv replace oui 33,44,55 subtype 254 oui-info 55,55,55,55,55 + # ex: configure lldp custom-tlv oui 33,44,44 subtype 232 + + local _ports + local _tlv + # CSV of device ports + get_interface_csv _ports "$1" 'ports' + config_get _tlv "$1" 'tlv' + + echo "configure ${_ports:+ports $_ports }lldp custom-tlv $_tlv" >> "$LLDPD_CONF" +} + write_lldpd_conf() { local lldp_description @@ -197,6 +212,9 @@ write_lldpd_conf() [ "$lldp_mgmt_addr_advertisements" -gt 0 ] && echo "configure lldp management-addresses-advertisements" >> "$LLDPD_CONF" ||\ echo "unconfigure lldp management-addresses-advertisements" >> "$LLDPD_CONF" + # Custom TLV handling + config_foreach add_custom_tlv_callback 'custom-tlv' + # Since lldpd's sysconfdir is /tmp, we'll symlink /etc/lldpd.d to /tmp/$LLDPD_CONFS_DIR [ -e "$LLDPD_CONFS_DIR" ] || ln -s /etc/lldpd.d "$LLDPD_CONFS_DIR" } From 1c1c373943d81b9a8f5613dfec0f900d5eb0f563 Mon Sep 17 00:00:00 2001 From: Rui Salvaterra Date: Fri, 28 Mar 2025 16:00:39 +0000 Subject: [PATCH 580/877] kernel: backport igc hw vlan patch to 24.10 Fix an abysmal out-of-the-box performance issue with igc-supported Ethernet controllers and 802.1Q. Signed-off-by: Rui Salvaterra --- ...an-tag-insertion-stripping-by-defaul.patch | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 target/linux/generic/backport-6.6/792-v6.16-igc-enable-HW-vlan-tag-insertion-stripping-by-defaul.patch diff --git a/target/linux/generic/backport-6.6/792-v6.16-igc-enable-HW-vlan-tag-insertion-stripping-by-defaul.patch b/target/linux/generic/backport-6.6/792-v6.16-igc-enable-HW-vlan-tag-insertion-stripping-by-defaul.patch new file mode 100644 index 00000000000000..0ca219457c6eb0 --- /dev/null +++ b/target/linux/generic/backport-6.6/792-v6.16-igc-enable-HW-vlan-tag-insertion-stripping-by-defaul.patch @@ -0,0 +1,32 @@ +From 8cae5a0d91fea01d90ce7c1827e26934a22ca2fa Mon Sep 17 00:00:00 2001 +From: Rui Salvaterra +Date: Wed, 5 Mar 2025 11:53:56 +0000 +Subject: [PATCH] igc: enable HW vlan tag insertion/stripping by default + +This is enabled by default in other Intel drivers I've checked (e1000, e1000e, +iavf, igb and ice). Fixes an out-of-the-box performance issue when running +OpenWrt on typical mini-PCs with igc-supported Ethernet controllers and 802.1Q +VLAN configurations, as ethtool isn't part of the default packages and sane +defaults are expected. + +In my specific case, with an Intel N100-based machine with four I226-V Ethernet +controllers, my upload performance increased from under 30 Mb/s to the expected +~1 Gb/s. + +Signed-off-by: Rui Salvaterra +--- + drivers/net/ethernet/intel/igc/igc_main.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/net/ethernet/intel/igc/igc_main.c ++++ b/drivers/net/ethernet/intel/igc/igc_main.c +@@ -6850,6 +6850,9 @@ static int igc_probe(struct pci_dev *pde + netdev->xdp_features = NETDEV_XDP_ACT_BASIC | NETDEV_XDP_ACT_REDIRECT | + NETDEV_XDP_ACT_XSK_ZEROCOPY; + ++ /* enable HW vlan tag insertion/stripping by default */ ++ netdev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX; ++ + /* MTU range: 68 - 9216 */ + netdev->min_mtu = ETH_MIN_MTU; + netdev->max_mtu = MAX_STD_JUMBO_FRAME_SIZE; From 64186283b2fa316c61844ba42d0282ba8b82bde9 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sat, 29 Mar 2025 13:12:44 +0100 Subject: [PATCH 581/877] mac80211: fix compilation error for old stable kernel version Fix compilation error for old stable version caused by genlmsg_multicast_allns backport fix pushed middle version. Version 5.15 version 0-169, 6.1 version 0-115, 6.6 version 0-58 have the old genlmsg_multicast_allns version with flags variable. Compiling backport project with these version result in a compilation error. To handle this, introduce a backport function for the affected kernel version. Link: https://github.com/openwrt/openwrt/pull/18373 Signed-off-by: Christian Marangi (cherry picked from commit 40393881491aa5fd23e715d0bedf591e3b152ddd) --- ...-genlmsg_multicast_allns-upstream-ba.patch | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 package/kernel/mac80211/patches/build/300-backports-handle-genlmsg_multicast_allns-upstream-ba.patch diff --git a/package/kernel/mac80211/patches/build/300-backports-handle-genlmsg_multicast_allns-upstream-ba.patch b/package/kernel/mac80211/patches/build/300-backports-handle-genlmsg_multicast_allns-upstream-ba.patch new file mode 100644 index 00000000000000..5ab6bb736da1f3 --- /dev/null +++ b/package/kernel/mac80211/patches/build/300-backports-handle-genlmsg_multicast_allns-upstream-ba.patch @@ -0,0 +1,121 @@ +From 8dc94a59cfad70ec3a808add56718255eee39ab2 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Sat, 29 Mar 2025 12:50:55 +0100 +Subject: [PATCH] backports: handle genlmsg_multicast_allns upstream backport + changes + +Better handle genlmsg_multicast_allns upstream backport changes that +dropped a flag to the function middle version. Use a backport function +if backports project is tried to be built on older kernel version. + +Signed-off-by: Christian Marangi +--- + backport-include/net/genetlink.h | 11 +++++ + compat/Makefile | 3 +- + compat/backport-genetlink.c | 60 +++++++++++++++++++++++ + 3 files changed, 73 insertions(+), 1 deletion(-) + +--- a/backport-include/net/genetlink.h ++++ b/backport-include/net/genetlink.h +@@ -172,4 +172,15 @@ static inline int genlmsg_parse(const st + } + #endif /* LINUX_VERSION_IS_LESS(5,2,0) */ + ++#if LINUX_VERSION_IN_RANGE(5,15,0,5,15,169) || \ ++ LINUX_VERSION_IN_RANGE(6,1,0,6,1,115) || \ ++ LINUX_VERSION_IN_RANGE(6,6,0,6,6,58) ++#define genlmsg_multicast_allns LINUX_BACKPORT(genlmsg_multicast_allns) ++int backport_genlmsg_multicast_allns(const struct genl_family *family, ++ struct sk_buff *skb, u32 portid, ++ unsigned int group); ++#endif /* LINUX_VERSION_IN_RANGE(5,15,0,5,15,169) || ++ LINUX_VERSION_IN_RANGE(6,1,0,6,1,115) || ++ LINUX_VERSION_IN_RANGE(6,6,0,6,6,58) */ ++ + #endif /* __BACKPORT_NET_GENETLINK_H */ +--- a/compat/Makefile ++++ b/compat/Makefile +@@ -16,7 +16,8 @@ compat-$(CPTCFG_KERNEL_5_9) += backport- + compat-$(CPTCFG_KERNEL_5_10) += backport-5.10.o + compat-$(CPTCFG_KERNEL_5_11) += backport-5.11.o + compat-$(CPTCFG_KERNEL_5_13) += backport-5.13.o +-compat-$(CPTCFG_KERNEL_5_15) += backport-5.15.o ++compat-$(CPTCFG_KERNEL_5_15) += backport-5.15.o backport-genetlink.o ++compat-$(CPTCFG_KERNEL_6_1) += backport-genetlink.o + compat-$(CPTCFG_KERNEL_6_4) += backport-6.4.o + + compat-$(CPTCFG_BPAUTO_BUILD_CRYPTO_LIB_ARC4) += lib-crypto-arc4.o +--- a/compat/backport-genetlink.c ++++ b/compat/backport-genetlink.c +@@ -17,6 +17,7 @@ + #include + #include + ++#if LINUX_VERSION_IS_LESS(5,2,0) + static const struct genl_family *find_family_real_ops(const struct genl_ops **ops) + { + const struct genl_family *family; +@@ -249,3 +250,63 @@ int backport_genlmsg_multicast_allns(con + return genlmsg_mcast(skb, portid, group); + } + EXPORT_SYMBOL_GPL(backport_genlmsg_multicast_allns); ++#endif /* LINUX_VERSION_IS_LESS(5,2,0) */ ++ ++#if LINUX_VERSION_IN_RANGE(5,15,0,5,15,169) || \ ++ LINUX_VERSION_IN_RANGE(6,1,0,6,1,115) || \ ++ LINUX_VERSION_IN_RANGE(6,6,0,6,6,58) ++static int genlmsg_mcast(struct sk_buff *skb, u32 portid, unsigned long group) ++{ ++ struct sk_buff *tmp; ++ struct net *net, *prev = NULL; ++ bool delivered = false; ++ int err; ++ ++ rcu_read_lock(); ++ for_each_net_rcu(net) { ++ if (prev) { ++ tmp = skb_clone(skb, GFP_ATOMIC); ++ if (!tmp) { ++ err = -ENOMEM; ++ goto error; ++ } ++ err = nlmsg_multicast(prev->genl_sock, tmp, ++ portid, group, GFP_ATOMIC); ++ if (!err) ++ delivered = true; ++ else if (err != -ESRCH) ++ goto error; ++ } ++ ++ prev = net; ++ } ++ err = nlmsg_multicast(prev->genl_sock, skb, portid, group, GFP_ATOMIC); ++ ++ rcu_read_unlock(); ++ ++ if (!err) ++ delivered = true; ++ else if (err != -ESRCH) ++ return err; ++ return delivered ? 0 : -ESRCH; ++ error: ++ rcu_read_unlock(); ++ ++ kfree_skb(skb); ++ return err; ++} ++ ++int backport_genlmsg_multicast_allns(const struct genl_family *family, ++ struct sk_buff *skb, u32 portid, ++ unsigned int group) ++{ ++ if (WARN_ON_ONCE(group >= family->n_mcgrps)) ++ return -EINVAL; ++ ++ group = family->mcgrp_offset + group; ++ return genlmsg_mcast(skb, portid, group); ++} ++EXPORT_SYMBOL_GPL(backport_genlmsg_multicast_allns); ++#endif /* LINUX_VERSION_IN_RANGE(5,15,0,5,15,169) || ++ LINUX_VERSION_IN_RANGE(6,1,0,6,1,115) || ++ LINUX_VERSION_IN_RANGE(6,6,0,6,6,58) */ From 76c1d0f493e5cddf92db07a6284760d66a96126f Mon Sep 17 00:00:00 2001 From: Coia Prant Date: Mon, 17 Mar 2025 18:26:00 +0800 Subject: [PATCH 582/877] ramips: Fix Hongdian H8922 v30 pinctrl default state According to the MT7620A hardware datasheet, GPIO/14 was originally used for RIN of UARTF, but is now used as the WPS LED. Corrected pinctrl to ensure it works properly in the future. Signed-off-by: Coia Prant Link: https://github.com/openwrt/openwrt/pull/18278 Link: https://github.com/openwrt/openwrt/pull/18279 Signed-off-by: Hauke Mehrtens (cherry picked from commit 612bedaf5b0a0186e34e521ebfc122404aeff265) --- target/linux/ramips/dts/mt7620a_hongdian_h8922-v30.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ramips/dts/mt7620a_hongdian_h8922-v30.dts b/target/linux/ramips/dts/mt7620a_hongdian_h8922-v30.dts index d983f5f854ce45..64c19a6012d265 100644 --- a/target/linux/ramips/dts/mt7620a_hongdian_h8922-v30.dts +++ b/target/linux/ramips/dts/mt7620a_hongdian_h8922-v30.dts @@ -145,7 +145,7 @@ &state_default { gpio { - groups = "wled", "rgmii1", "rgmii2"; + groups = "uartf", "wled", "rgmii1", "rgmii2"; function = "gpio"; }; }; From ec231bf564f33ac7cac975e5f262b252fb2a89cc Mon Sep 17 00:00:00 2001 From: Michel Lespinasse Date: Thu, 16 Jan 2025 00:50:01 -0800 Subject: [PATCH 583/877] rockchip: show boot stages on nanopi R6 system LED Set up openwrt to show boot progress on the nanopi R6S or R6C system LED. The LED blinking states indicate the boot stage. The LED is defined as a power LED, but can still be set to heartbeat in /etc/config/system after the system is done booting. Signed-off-by: Michel Lespinasse Link: https://github.com/openwrt/openwrt/pull/17638 (cherry picked from commit de9ad11dac094b6074c9b23341acbc28806404ae) Link: https://github.com/openwrt/openwrt/pull/18347 Signed-off-by: Hauke Mehrtens --- ...1-nanopi-r6-show-boot-status-on-system-led | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 target/linux/rockchip/patches-6.6/401-1-nanopi-r6-show-boot-status-on-system-led diff --git a/target/linux/rockchip/patches-6.6/401-1-nanopi-r6-show-boot-status-on-system-led b/target/linux/rockchip/patches-6.6/401-1-nanopi-r6-show-boot-status-on-system-led new file mode 100644 index 00000000000000..f891cf5f166bb7 --- /dev/null +++ b/target/linux/rockchip/patches-6.6/401-1-nanopi-r6-show-boot-status-on-system-led @@ -0,0 +1,33 @@ +Nanopi R6: show boot progress on the system LED + +Set up openwrt to show boot progress on the nanopi R6S or R6C system LED. + +The LED blinking states indicate the boot stage. The led is defined as +a power LED, but can still be set to heartbeat in /etc/config/system +after the system is done booting. + +--- a/arch/arm64/boot/dts/rockchip/rk3588s-nanopi-r6.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3588s-nanopi-r6.dtsi +@@ -16,6 +16,10 @@ + ethernet0 = &gmac1; + mmc0 = &sdmmc; + mmc1 = &sdhci; ++ led-boot = &sys_led; ++ led-failsafe = &sys_led; ++ led-running = &sys_led; ++ led-upgrade = &sys_led; + }; + + chosen { +@@ -54,9 +58,9 @@ + + sys_led: led-0 { + color = ; +- function = LED_FUNCTION_HEARTBEAT; ++ function = LED_FUNCTION_POWER; + gpios = <&gpio1 RK_PC1 GPIO_ACTIVE_HIGH>; +- linux,default-trigger = "heartbeat"; ++ default-state = "on"; + pinctrl-names = "default"; + pinctrl-0 = <&sys_led_pin>; + }; From f9d59735c6b50a33f3a96065796f2c14103c689c Mon Sep 17 00:00:00 2001 From: Michel Lespinasse Date: Thu, 16 Jan 2025 00:50:23 -0800 Subject: [PATCH 584/877] rockchip: configure reset button on nanopi R6 Set up openwrt to handle the reset button appropriately (so that it can trigger the various recovery modes) on the nanopi R6S and R6C models. Signed-off-by: Michel Lespinasse Link: https://github.com/openwrt/openwrt/pull/17638 (cherry picked from commit 2e7d060fd1ba6160067df1a2ba303c7c2efe2a7e) Link: https://github.com/openwrt/openwrt/pull/18347 Signed-off-by: Hauke Mehrtens --- .../patches-6.6/401-2-nanopi-r6-reset-button | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 target/linux/rockchip/patches-6.6/401-2-nanopi-r6-reset-button diff --git a/target/linux/rockchip/patches-6.6/401-2-nanopi-r6-reset-button b/target/linux/rockchip/patches-6.6/401-2-nanopi-r6-reset-button new file mode 100644 index 00000000000000..5ca4aff115ceea --- /dev/null +++ b/target/linux/rockchip/patches-6.6/401-2-nanopi-r6-reset-button @@ -0,0 +1,18 @@ +Nanopi R6: set up reset button to be handled by openwrt + +Set up openwrt to handle the reset button appropriately (so that it +can trigger the various recovery modes) on the nanopi R6S and R6C models. + +--- a/arch/arm64/boot/dts/rockchip/rk3588s-nanopi-r6.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3588s-nanopi-r6.dtsi +@@ -48,8 +48,8 @@ + button-user { + debounce-interval = <50>; + gpios = <&gpio1 RK_PC0 GPIO_ACTIVE_LOW>; +- label = "User Button"; +- linux,code = ; ++ label = "reset"; ++ linux,code = ; + }; + }; + From 092ee8bf0792b85779462abf8775f3ebb493ebc3 Mon Sep 17 00:00:00 2001 From: Michel Lespinasse Date: Thu, 16 Jan 2025 00:50:58 -0800 Subject: [PATCH 585/877] rockchip: set network IRQ affinity to fast CPU cores The nanopi R6S, R6C and nanopc T6 platforms are based on rk3588(s) SoC, which has fast and slow CPU cores. Set up network interrupt affinity to be on the fast CPU cores by default. This is similar to the way this was already configured on nanopi R4S. Signed-off-by: Michel Lespinasse Link: https://github.com/openwrt/openwrt/pull/17638 (cherry picked from commit 59215154a0eba77f0a79a6e30069a3037603ebf2) Link: https://github.com/openwrt/openwrt/pull/18347 Signed-off-by: Hauke Mehrtens --- .../etc/hotplug.d/net/40-net-smp-affinity | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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 27d469bb47432a..f5cdd9be8a79f9 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,10 +30,8 @@ set_interface_core() { case "$(board_name)" in armsom,sige7|\ -friendlyarm,nanopc-t6|\ friendlyarm,nanopi-r3s|\ friendlyarm,nanopi-r5c|\ -friendlyarm,nanopi-r6c|\ radxa,e25|\ sinovoip,rk3568-bpi-r2pro) set_interface_core 2 "eth0" @@ -49,15 +47,21 @@ xunlong,orangepi-r1-plus-lts) set_interface_core 4 "eth1" "xhci-hcd:usb[0-9]+" ;; friendlyarm,nanopi-r4s|\ -friendlyarm,nanopi-r4s-enterprise) +friendlyarm,nanopi-r4s-enterprise|\ +friendlyarm,nanopi-r6c|\ +friendlyarm,nanopc-t6) set_interface_core 10 "eth0" set_interface_core 20 "eth1" ;; -friendlyarm,nanopi-r5s|\ -friendlyarm,nanopi-r6s) +friendlyarm,nanopi-r5s) set_interface_core 2 "eth0" set_interface_core 4 "eth1" set_interface_core 8 "eth2" ;; +friendlyarm,nanopi-r6s) + set_interface_core 10 "eth0" + set_interface_core 20 "eth1" + set_interface_core 40 "eth2" + ;; esac From 8e5c9dbb177ed98562d825a67d62bf30aa6874cf Mon Sep 17 00:00:00 2001 From: Michel Lespinasse Date: Thu, 16 Jan 2025 00:54:06 -0800 Subject: [PATCH 586/877] kernel: load r8169 network module at boot time This allows the network interface naming to be stable, free from any possible interaction from external USB network devices that might claim usb* interface names. (This was a real problem I encountered with a nanopi R6S device and an external rtl8152 usb3 network controller - the USB controller would claim the eth1 name, causing much confusion). Signed-off-by: Michel Lespinasse Link: https://github.com/openwrt/openwrt/pull/17638 (cherry picked from commit effcb6e4c3f6638ad4dde7a7e9218c4f7189019b) Link: https://github.com/openwrt/openwrt/pull/18347 Signed-off-by: Hauke Mehrtens --- package/kernel/linux/modules/netdevices.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk index 4cfda093ca0427..86ca7c93a1e5d1 100644 --- a/package/kernel/linux/modules/netdevices.mk +++ b/package/kernel/linux/modules/netdevices.mk @@ -976,7 +976,7 @@ define KernelPackage/r8169 CONFIG_R8169 \ CONFIG_R8169_LEDS=y FILES:=$(LINUX_DIR)/drivers/net/ethernet/realtek/r8169.ko - AUTOLOAD:=$(call AutoProbe,r8169) + AUTOLOAD:=$(call AutoProbe,r8169,1) endef define KernelPackage/r8169/description From 0073a7bc934b6e965cdbf6771166b67cdf694361 Mon Sep 17 00:00:00 2001 From: Tomas Lara Date: Mon, 17 Mar 2025 14:59:23 +0000 Subject: [PATCH 587/877] rockchip: fix missing ".patch" file extension Fixes missing .patch file extension in: - https://github.com/openwrt/openwrt/commit/de9ad11dac094b6074c9b23341acbc28806404ae - https://github.com/openwrt/openwrt/commit/2e7d060fd1ba6160067df1a2ba303c7c2efe2a7e Signed-off-by: Tomas Lara Link: https://github.com/openwrt/openwrt/pull/18281 Signed-off-by: Robert Marko (cherry picked from commit f86476b18bb99f9f9491c30430bfa9fa110cb394) Link: https://github.com/openwrt/openwrt/pull/18347 Signed-off-by: Hauke Mehrtens --- ...m-led => 401-1-nanopi-r6-show-boot-status-on-system-led.patch} | 0 ...-nanopi-r6-reset-button => 401-2-nanopi-r6-reset-button.patch} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename target/linux/rockchip/patches-6.6/{401-1-nanopi-r6-show-boot-status-on-system-led => 401-1-nanopi-r6-show-boot-status-on-system-led.patch} (100%) rename target/linux/rockchip/patches-6.6/{401-2-nanopi-r6-reset-button => 401-2-nanopi-r6-reset-button.patch} (100%) diff --git a/target/linux/rockchip/patches-6.6/401-1-nanopi-r6-show-boot-status-on-system-led b/target/linux/rockchip/patches-6.6/401-1-nanopi-r6-show-boot-status-on-system-led.patch similarity index 100% rename from target/linux/rockchip/patches-6.6/401-1-nanopi-r6-show-boot-status-on-system-led rename to target/linux/rockchip/patches-6.6/401-1-nanopi-r6-show-boot-status-on-system-led.patch diff --git a/target/linux/rockchip/patches-6.6/401-2-nanopi-r6-reset-button b/target/linux/rockchip/patches-6.6/401-2-nanopi-r6-reset-button.patch similarity index 100% rename from target/linux/rockchip/patches-6.6/401-2-nanopi-r6-reset-button rename to target/linux/rockchip/patches-6.6/401-2-nanopi-r6-reset-button.patch From 53ab5629c31f3c7ca58cb48518d530c660ee0023 Mon Sep 17 00:00:00 2001 From: Magnus Kroken Date: Wed, 26 Mar 2025 21:42:51 +0100 Subject: [PATCH 588/877] mbedtls: update to 3.6.3 This release of Mbed TLS provides the fix for a tls compatibility issue of handling fragmented handshake messages. This release includes fixes for security issues. * Potential authentication bypass in TLS handshake (CVE-2025-27810) [1] * TLS clients may unwittingly skip server authentication (CVE-2025-27809) [2] [1]: https://mbed-tls.readthedocs.io/en/latest/security-advisories/mbedtls-security-advisory-2025-03-2/ [2]: https://mbed-tls.readthedocs.io/en/latest/security-advisories/mbedtls-security-advisory-2025-03-1/ Full release announcement: https://github.com/Mbed-TLS/mbedtls/releases/tag/mbedtls-3.6.3 Signed-off-by: Magnus Kroken Link: https://github.com/openwrt/openwrt/pull/18353 Signed-off-by: Nick Hainke (cherry picked from commit 1732d81d8082163c66e5b2b3b050318922d5bb88) --- package/libs/mbedtls/Makefile | 4 ++-- package/libs/mbedtls/patches/101-remove-test.patch | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/package/libs/mbedtls/Makefile b/package/libs/mbedtls/Makefile index f5bff13324884e..6d16819d3a1359 100644 --- a/package/libs/mbedtls/Makefile +++ b/package/libs/mbedtls/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mbedtls -PKG_VERSION:=3.6.2 +PKG_VERSION:=3.6.3 PKG_RELEASE:=1 PKG_BUILD_FLAGS:=no-mips16 gc-sections no-lto PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL=https://github.com/Mbed-TLS/$(PKG_NAME)/releases/download/$(PKG_NAME)-$(PKG_VERSION) -PKG_HASH:=8b54fb9bcf4d5a7078028e0520acddefb7900b3e66fec7f7175bb5b7d85ccdca +PKG_HASH:=64cd73842cdc05e101172f7b437c65e7312e476206e1dbfd644433d11bc56327 PKG_LICENSE:=GPL-2.0-or-later PKG_LICENSE_FILES:=LICENSE diff --git a/package/libs/mbedtls/patches/101-remove-test.patch b/package/libs/mbedtls/patches/101-remove-test.patch index 5ac5e7c1e85a11..e584a8036c7069 100644 --- a/package/libs/mbedtls/patches/101-remove-test.patch +++ b/package/libs/mbedtls/patches/101-remove-test.patch @@ -1,6 +1,7 @@ --- a/programs/CMakeLists.txt +++ b/programs/CMakeLists.txt -@@ -1,13 +1,9 @@ +@@ -3,14 +3,10 @@ add_custom_target(${programs_target}) + add_subdirectory(aes) add_subdirectory(cipher) -if (NOT WIN32) From ba6627394346624be19962cc68121dee493f86d3 Mon Sep 17 00:00:00 2001 From: Tim Harvey Date: Mon, 27 Jan 2025 14:44:27 -0800 Subject: [PATCH 589/877] mac80211: ath11k: Fix DMA buffer allocation to resolve SWIOTLB issues Backport two commits to resolve issues with ath1kk causing it to fail driver registration on iommuless systems with DRAM outside of 32bit addressing such as a 4GiB imx8mm: commit 1bcd20981834 ("wifi: ath11k: Fix DMA buffer allocation to resolve SWIOTLB issues") commit eeadc6baf8b3 ("wifi: ath11k: Use dma_alloc_noncoherent for rx_tid buffer allocation") Signed-off-by: Tim Harvey Link: https://github.com/openwrt/openwrt/pull/17751 Signed-off-by: Robert Marko (cherry picked from commit fa50e53aa92e4db9dfe091e7dd55c3fc2024ad13) --- ...allocation-to-resolve-SWIOTLB-issues.patch | 91 +++++++ ...oherent-for-rx-tid-buffer-allocation.patch | 255 ++++++++++++++++++ 2 files changed, 346 insertions(+) create mode 100644 package/kernel/mac80211/patches/ath11k/001-wifi-ath11k-Fix-DMA-buffer-allocation-to-resolve-SWIOTLB-issues.patch create mode 100644 package/kernel/mac80211/patches/ath11k/002-wifi-ath11k-use-dma-alloc-noncoherent-for-rx-tid-buffer-allocation.patch diff --git a/package/kernel/mac80211/patches/ath11k/001-wifi-ath11k-Fix-DMA-buffer-allocation-to-resolve-SWIOTLB-issues.patch b/package/kernel/mac80211/patches/ath11k/001-wifi-ath11k-Fix-DMA-buffer-allocation-to-resolve-SWIOTLB-issues.patch new file mode 100644 index 00000000000000..d5d80a395d75e8 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/001-wifi-ath11k-Fix-DMA-buffer-allocation-to-resolve-SWIOTLB-issues.patch @@ -0,0 +1,91 @@ +wifi: ath11k: Fix DMA buffer allocation to resolve SWIOTLB issues +Currently, the driver allocates cacheable DMA buffers for rings like +HAL_REO_DST and HAL_WBM2SW_RELEASE. The buffers for HAL_WBM2SW_RELEASE +are large (1024 KiB), exceeding the SWIOTLB slot size of 256 KiB. This +leads to "swiotlb buffer is full" error messages on systems without an +IOMMU that use SWIOTLB, causing driver initialization failures. The driver +calls dma_map_single() with these large buffers obtained from kzalloc(), +resulting in ring initialization errors on systems without an IOMMU that +use SWIOTLB. + +To address these issues, replace the flawed buffer allocation mechanism +with the appropriate DMA API. Specifically, use dma_alloc_noncoherent() +for cacheable DMA buffers, ensuring proper freeing of buffers with +dma_free_noncoherent(). + +Error log: +[ 10.194343] ath11k_pci 0000:04:00.0: swiotlb buffer is full (sz:1048583 bytes), total 32768 (slots), used 2529 (slots) +[ 10.194406] ath11k_pci 0000:04:00.0: failed to set up tcl_comp ring (0) :-12 +[ 10.194781] ath11k_pci 0000:04:00.0: failed to init DP: -12 + +Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 +Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3 + +Reported-by: Tim Harvey +Closes: https://lore.kernel.org/all/20241210041133.GA17116@lst.de/ +Signed-off-by: P Praneesh +Tested-by: Tim Harvey +Link: https://patch.msgid.link/20250119164219.647059-2-quic_ppranees@quicinc.com +Signed-off-by: Jeff Johnson +--- a/drivers/net/wireless/ath/ath11k/dp.c ++++ b/drivers/net/wireless/ath/ath11k/dp.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-2024 Qualcomm Innovation Center, Inc. All rights reserved. ++ * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. + */ + + #include +@@ -104,14 +104,12 @@ void ath11k_dp_srng_cleanup(struct ath11 + if (!ring->vaddr_unaligned) + return; + +- if (ring->cached) { +- dma_unmap_single(ab->dev, ring->paddr_unaligned, ring->size, +- DMA_FROM_DEVICE); +- kfree(ring->vaddr_unaligned); +- } else { ++ if (ring->cached) ++ dma_free_noncoherent(ab->dev, ring->size, ring->vaddr_unaligned, ++ ring->paddr_unaligned, DMA_FROM_DEVICE); ++ else + dma_free_coherent(ab->dev, ring->size, ring->vaddr_unaligned, + ring->paddr_unaligned); +- } + + ring->vaddr_unaligned = NULL; + } +@@ -249,25 +247,14 @@ int ath11k_dp_srng_setup(struct ath11k_b + default: + cached = false; + } +- +- if (cached) { +- ring->vaddr_unaligned = kzalloc(ring->size, GFP_KERNEL); +- if (!ring->vaddr_unaligned) +- return -ENOMEM; +- +- ring->paddr_unaligned = dma_map_single(ab->dev, +- ring->vaddr_unaligned, +- ring->size, +- DMA_FROM_DEVICE); +- if (dma_mapping_error(ab->dev, ring->paddr_unaligned)) { +- kfree(ring->vaddr_unaligned); +- ring->vaddr_unaligned = NULL; +- return -ENOMEM; +- } +- } + } + +- if (!cached) ++ if (cached) ++ ring->vaddr_unaligned = dma_alloc_noncoherent(ab->dev, ring->size, ++ &ring->paddr_unaligned, ++ DMA_FROM_DEVICE, ++ GFP_KERNEL); ++ else + ring->vaddr_unaligned = dma_alloc_coherent(ab->dev, ring->size, + &ring->paddr_unaligned, + GFP_KERNEL); diff --git a/package/kernel/mac80211/patches/ath11k/002-wifi-ath11k-use-dma-alloc-noncoherent-for-rx-tid-buffer-allocation.patch b/package/kernel/mac80211/patches/ath11k/002-wifi-ath11k-use-dma-alloc-noncoherent-for-rx-tid-buffer-allocation.patch new file mode 100644 index 00000000000000..2257b0691076db --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/002-wifi-ath11k-use-dma-alloc-noncoherent-for-rx-tid-buffer-allocation.patch @@ -0,0 +1,255 @@ +wifi: ath11k: Use dma_alloc_noncoherent for rx_tid buffer allocation + +Currently, the driver allocates cacheable DMA buffers for the rx_tid +structure using kzalloc() and dma_map_single(). These buffers are +long-lived and can persist for the lifetime of the peer, which is not +advisable. Instead of using kzalloc() and dma_map_single() for allocating +cacheable DMA buffers, utilize the dma_alloc_noncoherent() helper for the +allocation of long-lived cacheable DMA buffers, such as the peer's rx_tid. +Since dma_alloc_noncoherent() returns unaligned physical and virtual +addresses, align them internally before use within the driver. This +ensures proper allocation of non-coherent memory through the kernel +helper. + +Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 +Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3 + +Signed-off-by: P Praneesh +--- a/drivers/net/wireless/ath/ath11k/dp.h ++++ b/drivers/net/wireless/ath/ath11k/dp.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-2023 Qualcomm Innovation Center, Inc. All rights reserved. ++ * Copyright (c) 2021-2023, 2025 Qualcomm Innovation Center, Inc. All rights reserved. + */ + + #ifndef ATH11K_DP_H +@@ -20,7 +20,6 @@ struct ath11k_ext_irq_grp; + + struct dp_rx_tid { + u8 tid; +- u32 *vaddr; + dma_addr_t paddr; + u32 size; + u32 ba_win_sz; +@@ -37,6 +36,9 @@ struct dp_rx_tid { + /* Timer info related to fragments */ + struct timer_list frag_timer; + struct ath11k_base *ab; ++ u32 *vaddr_unaligned; ++ dma_addr_t paddr_unaligned; ++ u32 unaligned_size; + }; + + #define DP_REO_DESC_FREE_THRESHOLD 64 +--- a/drivers/net/wireless/ath/ath11k/dp_rx.c ++++ b/drivers/net/wireless/ath/ath11k/dp_rx.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-2024 Qualcomm Innovation Center, Inc. All rights reserved. ++ * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. + */ + + #include +@@ -675,11 +675,11 @@ void ath11k_dp_reo_cmd_list_cleanup(stru + list_for_each_entry_safe(cmd, tmp, &dp->reo_cmd_list, list) { + list_del(&cmd->list); + rx_tid = &cmd->data; +- if (rx_tid->vaddr) { +- dma_unmap_single(ab->dev, rx_tid->paddr, +- rx_tid->size, DMA_BIDIRECTIONAL); +- kfree(rx_tid->vaddr); +- rx_tid->vaddr = NULL; ++ if (rx_tid->vaddr_unaligned) { ++ dma_free_noncoherent(ab->dev, rx_tid->unaligned_size, ++ rx_tid->vaddr_unaligned, ++ rx_tid->paddr_unaligned, DMA_BIDIRECTIONAL); ++ rx_tid->vaddr_unaligned = NULL; + } + kfree(cmd); + } +@@ -689,11 +689,11 @@ void ath11k_dp_reo_cmd_list_cleanup(stru + list_del(&cmd_cache->list); + dp->reo_cmd_cache_flush_count--; + rx_tid = &cmd_cache->data; +- if (rx_tid->vaddr) { +- dma_unmap_single(ab->dev, rx_tid->paddr, +- rx_tid->size, DMA_BIDIRECTIONAL); +- kfree(rx_tid->vaddr); +- rx_tid->vaddr = NULL; ++ if (rx_tid->vaddr_unaligned) { ++ dma_free_noncoherent(ab->dev, rx_tid->unaligned_size, ++ rx_tid->vaddr_unaligned, ++ rx_tid->paddr_unaligned, DMA_BIDIRECTIONAL); ++ rx_tid->vaddr_unaligned = NULL; + } + kfree(cmd_cache); + } +@@ -708,11 +708,11 @@ static void ath11k_dp_reo_cmd_free(struc + if (status != HAL_REO_CMD_SUCCESS) + ath11k_warn(dp->ab, "failed to flush rx tid hw desc, tid %d status %d\n", + rx_tid->tid, status); +- if (rx_tid->vaddr) { +- dma_unmap_single(dp->ab->dev, rx_tid->paddr, rx_tid->size, +- DMA_BIDIRECTIONAL); +- kfree(rx_tid->vaddr); +- rx_tid->vaddr = NULL; ++ if (rx_tid->vaddr_unaligned) { ++ dma_free_noncoherent(dp->ab->dev, rx_tid->unaligned_size, ++ rx_tid->vaddr_unaligned, ++ rx_tid->paddr_unaligned, DMA_BIDIRECTIONAL); ++ rx_tid->vaddr_unaligned = NULL; + } + } + +@@ -749,10 +749,10 @@ static void ath11k_dp_reo_cache_flush(st + if (ret) { + ath11k_err(ab, "failed to send HAL_REO_CMD_FLUSH_CACHE cmd, tid %d (%d)\n", + rx_tid->tid, ret); +- dma_unmap_single(ab->dev, rx_tid->paddr, rx_tid->size, +- DMA_BIDIRECTIONAL); +- kfree(rx_tid->vaddr); +- rx_tid->vaddr = NULL; ++ dma_free_noncoherent(ab->dev, rx_tid->unaligned_size, ++ rx_tid->vaddr_unaligned, ++ rx_tid->paddr_unaligned, DMA_BIDIRECTIONAL); ++ rx_tid->vaddr_unaligned = NULL; + } + } + +@@ -802,10 +802,10 @@ static void ath11k_dp_rx_tid_del_func(st + + return; + free_desc: +- dma_unmap_single(ab->dev, rx_tid->paddr, rx_tid->size, +- DMA_BIDIRECTIONAL); +- kfree(rx_tid->vaddr); +- rx_tid->vaddr = NULL; ++ dma_free_noncoherent(ab->dev, rx_tid->unaligned_size, ++ rx_tid->vaddr_unaligned, ++ rx_tid->paddr_unaligned, DMA_BIDIRECTIONAL); ++ rx_tid->vaddr_unaligned = NULL; + } + + void ath11k_peer_rx_tid_delete(struct ath11k *ar, +@@ -831,14 +831,16 @@ void ath11k_peer_rx_tid_delete(struct at + if (ret != -ESHUTDOWN) + ath11k_err(ar->ab, "failed to send HAL_REO_CMD_UPDATE_RX_QUEUE cmd, tid %d (%d)\n", + tid, ret); +- dma_unmap_single(ar->ab->dev, rx_tid->paddr, rx_tid->size, +- DMA_BIDIRECTIONAL); +- kfree(rx_tid->vaddr); +- rx_tid->vaddr = NULL; ++ dma_free_noncoherent(ar->ab->dev, rx_tid->unaligned_size, ++ rx_tid->vaddr_unaligned, ++ rx_tid->paddr_unaligned, DMA_BIDIRECTIONAL); ++ rx_tid->vaddr_unaligned = NULL; + } + + rx_tid->paddr = 0; ++ rx_tid->paddr_unaligned = 0; + rx_tid->size = 0; ++ rx_tid->unaligned_size = 0; + } + + static int ath11k_dp_rx_link_desc_return(struct ath11k_base *ab, +@@ -982,10 +984,9 @@ static void ath11k_dp_rx_tid_mem_free(st + if (!rx_tid->active) + goto unlock_exit; + +- dma_unmap_single(ab->dev, rx_tid->paddr, rx_tid->size, +- DMA_BIDIRECTIONAL); +- kfree(rx_tid->vaddr); +- rx_tid->vaddr = NULL; ++ dma_free_noncoherent(ab->dev, rx_tid->unaligned_size, rx_tid->vaddr_unaligned, ++ rx_tid->paddr_unaligned, DMA_BIDIRECTIONAL); ++ rx_tid->vaddr_unaligned = NULL; + + rx_tid->active = false; + +@@ -1000,9 +1001,8 @@ int ath11k_peer_rx_tid_setup(struct ath1 + struct ath11k_base *ab = ar->ab; + struct ath11k_peer *peer; + struct dp_rx_tid *rx_tid; +- u32 hw_desc_sz; +- u32 *addr_aligned; +- void *vaddr; ++ u32 hw_desc_sz, *vaddr; ++ void *vaddr_unaligned; + dma_addr_t paddr; + int ret; + +@@ -1050,37 +1050,34 @@ int ath11k_peer_rx_tid_setup(struct ath1 + else + hw_desc_sz = ath11k_hal_reo_qdesc_size(DP_BA_WIN_SZ_MAX, tid); + +- vaddr = kzalloc(hw_desc_sz + HAL_LINK_DESC_ALIGN - 1, GFP_ATOMIC); +- if (!vaddr) { ++ rx_tid->unaligned_size = hw_desc_sz + HAL_LINK_DESC_ALIGN - 1; ++ vaddr_unaligned = dma_alloc_noncoherent(ab->dev, rx_tid->unaligned_size, &paddr, ++ DMA_BIDIRECTIONAL, GFP_ATOMIC); ++ if (!vaddr_unaligned) { + spin_unlock_bh(&ab->base_lock); + return -ENOMEM; + } + +- addr_aligned = PTR_ALIGN(vaddr, HAL_LINK_DESC_ALIGN); +- +- ath11k_hal_reo_qdesc_setup(addr_aligned, tid, ba_win_sz, +- ssn, pn_type); +- +- paddr = dma_map_single(ab->dev, addr_aligned, hw_desc_sz, +- DMA_BIDIRECTIONAL); +- +- ret = dma_mapping_error(ab->dev, paddr); +- if (ret) { +- spin_unlock_bh(&ab->base_lock); +- ath11k_warn(ab, "failed to setup dma map for peer %pM rx tid %d: %d\n", +- peer_mac, tid, ret); +- goto err_mem_free; +- } +- +- rx_tid->vaddr = vaddr; +- rx_tid->paddr = paddr; ++ rx_tid->vaddr_unaligned = vaddr_unaligned; ++ vaddr = PTR_ALIGN(vaddr_unaligned, HAL_LINK_DESC_ALIGN); ++ rx_tid->paddr_unaligned = paddr; ++ rx_tid->paddr = rx_tid->paddr_unaligned + ((unsigned long)vaddr - ++ (unsigned long)rx_tid->vaddr_unaligned); ++ ath11k_hal_reo_qdesc_setup(vaddr, tid, ba_win_sz, ssn, pn_type); + rx_tid->size = hw_desc_sz; + rx_tid->active = true; + ++ /* After dma_alloc_noncoherent, vaddr is being modified for reo qdesc setup. ++ * Since these changes are not reflected in the device, driver now needs to ++ * explicitly call dma_sync_single_for_device. ++ */ ++ dma_sync_single_for_device(ab->dev, rx_tid->paddr, ++ rx_tid->size, ++ DMA_TO_DEVICE); + spin_unlock_bh(&ab->base_lock); + +- ret = ath11k_wmi_peer_rx_reorder_queue_setup(ar, vdev_id, peer_mac, +- paddr, tid, 1, ba_win_sz); ++ ret = ath11k_wmi_peer_rx_reorder_queue_setup(ar, vdev_id, peer_mac, rx_tid->paddr, ++ tid, 1, ba_win_sz); + if (ret) { + ath11k_warn(ar->ab, "failed to setup rx reorder queue for peer %pM tid %d: %d\n", + peer_mac, tid, ret); +@@ -1088,12 +1085,6 @@ int ath11k_peer_rx_tid_setup(struct ath1 + } + + return ret; +- +-err_mem_free: +- kfree(rx_tid->vaddr); +- rx_tid->vaddr = NULL; +- +- return ret; + } + + int ath11k_dp_rx_ampdu_start(struct ath11k *ar, From d70709e5fe6fff9659df26a78330641a12d57070 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Wed, 2 Apr 2025 18:59:59 +0200 Subject: [PATCH 590/877] bcm63xx-cfe: update to latest version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit actiontec: t1200h: add cferam.000 file Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit c01859e4f3b28b414edc62dcb6056593558d9ad0) --- package/kernel/bcm63xx-cfe/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/kernel/bcm63xx-cfe/Makefile b/package/kernel/bcm63xx-cfe/Makefile index 9bd61afdead5c3..8b6fa8010c650b 100644 --- a/package/kernel/bcm63xx-cfe/Makefile +++ b/package/kernel/bcm63xx-cfe/Makefile @@ -6,9 +6,9 @@ PKG_RELEASE:=1 PKG_SOURCE_URL:=https://github.com/openwrt/bcm63xx-cfe.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2024-06-25 -PKG_SOURCE_VERSION:=6519bd2dde3535cafeea43157755f4dbef2f90c5 -PKG_MIRROR_HASH:=db4da580b7a611a2b4ddd4ff812e5f8ddfd9694b6f5fd8246a341e61967c00ef +PKG_SOURCE_DATE:=2025-04-02 +PKG_SOURCE_VERSION:=b8128fa4bdcdaf97549138965b00d5d7ceb7bb0f +PKG_MIRROR_HASH:=d33fad4fb5f4419bb287f3c3df6cceabab01fc7852c24cf29a15befa38cc0d45 PKG_FLAGS:=nonshared From f31675b69b7565145ae6a14029ce99933bf75558 Mon Sep 17 00:00:00 2001 From: Kyle Hendry Date: Sat, 11 Jan 2025 11:33:22 -0800 Subject: [PATCH 591/877] bmips: add support for Actiontec T1200H MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Specifications: - SoC: Broadcom BCM63168 dual 400MHz MIPS - Flash: 128MB NAND ESMT F59L1G81A - RAM: 128MB DDR3 - Ethernet: 5x 1000M - Wifi: BCM435F - 1x USB 2.0 port - 2x Button - 11x LED - Coax HPNA (unsupported) - RJ11 xDSL (unsupported) Install instructions: The booloader will only install signed firmware so the image has to be manually flashed. - Set up a TFTP server on 192.168.1.0/24 to serve the initramfs image - Interrupt the bootloader and run from RAM with r 192.168.1.100:openwrt-bmips-bcm63268-actiontec_t1200h-initramfs.elf - On the openwrt console, copy the wfi image using wget/tftp/scp, i.e scp user@192.168.1.100:~/openwrt/bin/targets/bmips/bcm63268/openwrt-bmips-bcm63268-actiontec_t1200h-squashfs-cfe.bin /tmp/ - Erase half the flash partition where openwrt will be installed with flash_erase -j /dev/mtd1 0 491 - Flash the openwrt image with nandwrite -p /dev/mtd1 /tmp/openwrt-bmips-bcm63268-actiontec_t1200h-squashfs-cfe.bin - Reboot - Interrupt the bootloader again and use the c command to boot from previous firmware if vendor image is loaded Signed-off-by: Kyle Hendry [Minor improvements to DTS file] Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 65b8a978deac05894d1fd20dfe63494f4b43848d) --- .../base-files/etc/board.d/02_network | 13 +- .../base-files/lib/upgrade/platform.sh | 1 + .../bmips/dts/bcm63168-actiontec-t1200h.dts | 253 ++++++++++++++++++ target/linux/bmips/image/bcm63268.mk | 19 ++ 4 files changed, 280 insertions(+), 6 deletions(-) create mode 100644 target/linux/bmips/dts/bcm63168-actiontec-t1200h.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 328fb13df48621..70e5db05222969 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 @@ -5,6 +5,13 @@ board_config_update case "$(board_name)" in +actiontec,t1200h |\ +comtrend,vg-8050 |\ +sagem,fast-3864-op |\ +sercomm,shg2500) + ucidef_set_bridge_device switch + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan" + ;; comtrend,vr-3032u |\ smartrg,sr505n) ucidef_set_bridge_device switch @@ -17,12 +24,6 @@ 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 |\ -sagem,fast-3864-op |\ -sercomm,shg2500) - 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/bcm63268/base-files/lib/upgrade/platform.sh b/target/linux/bmips/bcm63268/base-files/lib/upgrade/platform.sh index 00b23f742f9b85..b41b5e91401303 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 + actiontec,t1200h |\ comtrend,vg-8050 |\ comtrend,vr-3032u |\ sagem,fast-3864-op) diff --git a/target/linux/bmips/dts/bcm63168-actiontec-t1200h.dts b/target/linux/bmips/dts/bcm63168-actiontec-t1200h.dts new file mode 100644 index 00000000000000..86fce53a797e65 --- /dev/null +++ b/target/linux/bmips/dts/bcm63168-actiontec-t1200h.dts @@ -0,0 +1,253 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "bcm63268.dtsi" + +/ { + model = "Actiontec T1200H"; + compatible = "actiontec,t1200h", "brcm,bcm63168", "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 32 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + + wps { + label = "wps"; + gpios = <&gpio 33 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led-0 { + label = "red:internet"; + color = ; + gpios = <&gpio 0 GPIO_ACTIVE_LOW>; + }; + + led-1 { + label = "green:internet"; + color = ; + gpios = <&gpio 1 GPIO_ACTIVE_LOW>; + }; + + led-9 { + function = LED_FUNCTION_USB; + color = ; + gpios = <&gpio 9 GPIO_ACTIVE_LOW>; + }; + + led_power_green: led-20 { + function = LED_FUNCTION_POWER; + color = ; + gpios = <&gpio 20 GPIO_ACTIVE_LOW>; + }; + + led-22 { + function = LED_FUNCTION_WAN; + color = ; + gpios = <&gpio 22 GPIO_ACTIVE_LOW>; + }; + + led_power_red: led-35 { + function = LED_FUNCTION_POWER; + color = ; + gpios = <&gpio 35 GPIO_ACTIVE_LOW>; + panic-indicator; + }; + + led-39 { + function = LED_FUNCTION_WLAN; + color = ; + gpios = <&gpio 39 GPIO_ACTIVE_LOW>; + }; + + led-43 { + function = LED_FUNCTION_WPS; + color = ; + gpios = <&gpio 43 GPIO_ACTIVE_LOW>; + }; + + led-44 { + function = LED_FUNCTION_WPS; + color = ; + gpios = <&gpio 44 GPIO_ACTIVE_LOW>; + }; + + led-46 { + label = "green:dsl"; + color = ; + gpios = <&gpio 46 GPIO_ACTIVE_LOW>; + }; + + led-49 { + label = "red:dsl"; + color = ; + gpios = <&gpio 49 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&ehci { + status = "okay"; +}; + +ðernet { + status = "okay"; + + nvmem-cells = <&macaddr_cferom_6a0>; + nvmem-cell-names = "mac-address"; +}; + +&mdio_ext { + switch@1e { + compatible = "brcm,bcm53125"; + reg = <0x1e>; + + 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@8 { + reg = <0x8>; + + phy-mode = "rgmii"; + ethernet = <&switch0port6>; + + 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>; + + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "cferom"; + reg = <0x0 0x20000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_cferom_6a0: macaddr@6a0 { + reg = <0x6a0 0x6>; + }; + }; + }; + + partition@20000 { + compatible = "brcm,wfi-split"; + label = "wfi"; + reg = <0x20000 0x7ac0000>; + }; + + partition@7b00000 { + label = "data"; + reg = <0x7b00000 0x400000>; + read-only; + }; + }; + }; +}; + +&ohci { + status = "okay"; +}; + +&pcie { + status = "okay"; +}; + +&switch0 { + dsa,member = <0 0>; + + ports { + port@3 { + reg = <3>; + label = "wan"; + + phy-handle = <&phy4>; + }; + + switch0port6: port@6 { + reg = <6>; + label = "extsw"; + + phy-mode = "rgmii"; + + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&usbh { + status = "okay"; +}; diff --git a/target/linux/bmips/image/bcm63268.mk b/target/linux/bmips/image/bcm63268.mk index ed45bead7f8bf0..3f98acc56ff056 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/actiontec_t1200h + $(Device/bcm63xx-nand) + DEVICE_VENDOR := Actiontec + DEVICE_MODEL := T1200H + CHIP_ID := 63268 + SOC := bcm63168 + CFE_RAM_FILE := actiontec,t1200h/cferam.000 + CFE_RAM_JFFS2_NAME := cferam.000 + BLOCKSIZE := 128k + PAGESIZE := 2048 + SUBPAGESIZE := 512 + VID_HDR_OFFSET := 2048 + DEVICE_PACKAGES += $(USB2_PACKAGES) \ + kmod-leds-gpio + CFE_WFI_FLASH_TYPE := 3 + CFE_WFI_VERSION := 0x5732 +endef +TARGET_DEVICES += actiontec_t1200h + define Device/comtrend_vg-8050 $(Device/bcm63xx-nand) DEVICE_VENDOR := Comtrend From 52870ddf62057533a721cd502b0ea88b47310262 Mon Sep 17 00:00:00 2001 From: John Audia Date: Sat, 22 Mar 2025 17:35:16 -0400 Subject: [PATCH 592/877] kernel: bump 6.6 to 6.6.84 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.84 All patches automatically rebased. Build system: x86/64 Build-tested: flogic/xiaomi_redmi-router-ax6000-ubootmod, x86/64 Run-tested: flogic/xiaomi_redmi-router-ax6000-ubootmod, x86/64 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/18326 Signed-off-by: Nick Hainke (cherry picked from commit 314ca0387743e5d18850d9c7c959a3206ec6fbc5) Link: https://github.com/openwrt/openwrt/pull/18419 Signed-off-by: Hauke Mehrtens --- include/kernel-6.6 | 4 ++-- ...mic-helpers-remove-legacy_cursor_update-hacks.patch | 2 +- ...-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch | 4 ++-- .../950-0923-drm-Add-DRM_MODE_TV_MODE_MONOCHROME.patch | 2 +- ...el-Add-and-initialise-an-orientation-field-to.patch | 2 +- ...-mv88e6xxx-rename-mv88e6xxx_g2_scratch_gpio_s.patch | 2 +- ...-mv88e6xxx-add-Amethyst-specific-SMI-GPIO-fun.patch | 2 +- ...1-v6.13-net-dsa-mv88e6xxx-Support-LED-control.patch | 10 +++++----- .../711-net-dsa-mv88e6xxx-disable-ATU-violation.patch | 2 +- .../linux/generic/hack-6.6/904-debloat_dma_buf.patch | 2 +- ...er-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch | 2 +- 11 files changed, 17 insertions(+), 17 deletions(-) diff --git a/include/kernel-6.6 b/include/kernel-6.6 index e6f3c97c6ea397..250365a50ff786 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .83 -LINUX_KERNEL_HASH-6.6.83 = 894bbbe63b7484a0bc576a1e11a8dbc090fbd476d6424431bdc8435e03c2c208 +LINUX_VERSION-6.6 = .84 +LINUX_KERNEL_HASH-6.6.84 = 7fd20721551a61db347c5ac6ca05818e24058682be4e4389dc51e88d4ac17ba7 diff --git a/target/linux/bcm27xx/patches-6.6/950-0025-drm-atomic-helpers-remove-legacy_cursor_update-hacks.patch b/target/linux/bcm27xx/patches-6.6/950-0025-drm-atomic-helpers-remove-legacy_cursor_update-hacks.patch index 4c3ff50b8cb135..a0981c9c0d90d8 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0025-drm-atomic-helpers-remove-legacy_cursor_update-hacks.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0025-drm-atomic-helpers-remove-legacy_cursor_update-hacks.patch @@ -89,7 +89,7 @@ Signed-off-by: Maxime Ripard commit->event = kzalloc(sizeof(*commit->event), --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c -@@ -7298,6 +7298,19 @@ int intel_atomic_commit(struct drm_devic +@@ -7297,6 +7297,19 @@ int intel_atomic_commit(struct drm_devic state->base.legacy_cursor_update = false; } diff --git a/target/linux/bcm27xx/patches-6.6/950-0169-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch b/target/linux/bcm27xx/patches-6.6/950-0169-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch index afdb5aca085aa1..9b6617361fa53c 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0169-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0169-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 -@@ -243,6 +243,9 @@ +@@ -244,6 +244,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 -@@ -1405,6 +1408,9 @@ +@@ -1408,6 +1411,9 @@ #define USB_VENDOR_ID_XIAOMI 0x2717 #define USB_DEVICE_ID_MI_SILENT_MOUSE 0x5014 diff --git a/target/linux/bcm27xx/patches-6.6/950-0923-drm-Add-DRM_MODE_TV_MODE_MONOCHROME.patch b/target/linux/bcm27xx/patches-6.6/950-0923-drm-Add-DRM_MODE_TV_MODE_MONOCHROME.patch index c4a5537a8c75fb..2fd127848818c8 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0923-drm-Add-DRM_MODE_TV_MODE_MONOCHROME.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0923-drm-Add-DRM_MODE_TV_MODE_MONOCHROME.patch @@ -29,7 +29,7 @@ Signed-off-by: Nick Hollinghurst }; DRM_ENUM_NAME_FN(drm_get_tv_mode_name, drm_tv_mode_enum_list) -@@ -1736,6 +1737,12 @@ EXPORT_SYMBOL(drm_connector_attach_dp_su +@@ -1740,6 +1741,12 @@ EXPORT_SYMBOL(drm_connector_attach_dp_su * TV Mode is CCIR System B (aka 625-lines) together with * the SECAM Color Encoding. * diff --git a/target/linux/bcm27xx/patches-6.6/950-1051-drm-panel-Add-and-initialise-an-orientation-field-to.patch b/target/linux/bcm27xx/patches-6.6/950-1051-drm-panel-Add-and-initialise-an-orientation-field-to.patch index 6d745f6e9d75c6..9dcdb585b1e1dc 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1051-drm-panel-Add-and-initialise-an-orientation-field-to.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1051-drm-panel-Add-and-initialise-an-orientation-field-to.patch @@ -22,7 +22,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c -@@ -2698,10 +2698,15 @@ int drm_connector_set_orientation_from_p +@@ -2702,10 +2702,15 @@ int drm_connector_set_orientation_from_p { enum drm_panel_orientation orientation; diff --git a/target/linux/generic/backport-6.6/896-01-v6.9-net-dsa-mv88e6xxx-rename-mv88e6xxx_g2_scratch_gpio_s.patch b/target/linux/generic/backport-6.6/896-01-v6.9-net-dsa-mv88e6xxx-rename-mv88e6xxx_g2_scratch_gpio_s.patch index 48dd6ffb6755ab..2c3e99d8e09341 100644 --- a/target/linux/generic/backport-6.6/896-01-v6.9-net-dsa-mv88e6xxx-rename-mv88e6xxx_g2_scratch_gpio_s.patch +++ b/target/linux/generic/backport-6.6/896-01-v6.9-net-dsa-mv88e6xxx-rename-mv88e6xxx_g2_scratch_gpio_s.patch @@ -19,7 +19,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c -@@ -3669,7 +3669,7 @@ static int mv88e6xxx_mdio_register(struc +@@ -3699,7 +3699,7 @@ static int mv88e6xxx_mdio_register(struc if (external) { mv88e6xxx_reg_lock(chip); diff --git a/target/linux/generic/backport-6.6/896-02-v6.9-net-dsa-mv88e6xxx-add-Amethyst-specific-SMI-GPIO-fun.patch b/target/linux/generic/backport-6.6/896-02-v6.9-net-dsa-mv88e6xxx-add-Amethyst-specific-SMI-GPIO-fun.patch index e5931573f78807..875acd3ba1671b 100644 --- a/target/linux/generic/backport-6.6/896-02-v6.9-net-dsa-mv88e6xxx-add-Amethyst-specific-SMI-GPIO-fun.patch +++ b/target/linux/generic/backport-6.6/896-02-v6.9-net-dsa-mv88e6xxx-add-Amethyst-specific-SMI-GPIO-fun.patch @@ -27,7 +27,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c -@@ -3669,7 +3669,10 @@ static int mv88e6xxx_mdio_register(struc +@@ -3699,7 +3699,10 @@ static int mv88e6xxx_mdio_register(struc if (external) { mv88e6xxx_reg_lock(chip); diff --git a/target/linux/generic/backport-6.6/901-v6.13-net-dsa-mv88e6xxx-Support-LED-control.patch b/target/linux/generic/backport-6.6/901-v6.13-net-dsa-mv88e6xxx-Support-LED-control.patch index 711246da617e09..1674359d266634 100644 --- a/target/linux/generic/backport-6.6/901-v6.13-net-dsa-mv88e6xxx-Support-LED-control.patch +++ b/target/linux/generic/backport-6.6/901-v6.13-net-dsa-mv88e6xxx-Support-LED-control.patch @@ -127,7 +127,7 @@ Signed-off-by: Linus Walleij #include #include #include -@@ -3235,14 +3236,43 @@ static int mv88e6xxx_setup_upstream_port +@@ -3265,14 +3266,43 @@ static int mv88e6xxx_setup_upstream_port static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port) { struct device_node *phy_handle = NULL; @@ -173,7 +173,7 @@ Signed-off-by: Linus Walleij err = mv88e6xxx_port_setup_mac(chip, port, LINK_UNFORCED, SPEED_UNFORCED, DUPLEX_UNFORCED, -@@ -4461,6 +4491,7 @@ static const struct mv88e6xxx_ops mv88e6 +@@ -4491,6 +4521,7 @@ static const struct mv88e6xxx_ops mv88e6 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, .port_get_cmode = mv88e6352_port_get_cmode, @@ -181,7 +181,7 @@ Signed-off-by: Linus Walleij .port_setup_message_port = mv88e6xxx_setup_message_port, .stats_snapshot = mv88e6320_g1_stats_snapshot, .stats_set_histogram = mv88e6095_g1_stats_set_histogram, -@@ -4563,6 +4594,7 @@ static const struct mv88e6xxx_ops mv88e6 +@@ -4593,6 +4624,7 @@ static const struct mv88e6xxx_ops mv88e6 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, .port_get_cmode = mv88e6352_port_get_cmode, @@ -189,7 +189,7 @@ Signed-off-by: Linus Walleij .port_setup_message_port = mv88e6xxx_setup_message_port, .stats_snapshot = mv88e6320_g1_stats_snapshot, .stats_set_histogram = mv88e6095_g1_stats_set_histogram, -@@ -4838,6 +4870,7 @@ static const struct mv88e6xxx_ops mv88e6 +@@ -4868,6 +4900,7 @@ static const struct mv88e6xxx_ops mv88e6 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, .port_get_cmode = mv88e6352_port_get_cmode, @@ -197,7 +197,7 @@ Signed-off-by: Linus Walleij .port_setup_message_port = mv88e6xxx_setup_message_port, .stats_snapshot = mv88e6320_g1_stats_snapshot, .stats_set_histogram = mv88e6095_g1_stats_set_histogram, -@@ -5260,6 +5293,7 @@ static const struct mv88e6xxx_ops mv88e6 +@@ -5290,6 +5323,7 @@ static const struct mv88e6xxx_ops mv88e6 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, .port_get_cmode = mv88e6352_port_get_cmode, diff --git a/target/linux/generic/hack-6.6/711-net-dsa-mv88e6xxx-disable-ATU-violation.patch b/target/linux/generic/hack-6.6/711-net-dsa-mv88e6xxx-disable-ATU-violation.patch index bf93a87e02e793..ab594a471e3c13 100644 --- a/target/linux/generic/hack-6.6/711-net-dsa-mv88e6xxx-disable-ATU-violation.patch +++ b/target/linux/generic/hack-6.6/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 -@@ -3405,6 +3405,9 @@ static int mv88e6xxx_setup_port(struct m +@@ -3435,6 +3435,9 @@ static int mv88e6xxx_setup_port(struct m else reg = 1 << port; diff --git a/target/linux/generic/hack-6.6/904-debloat_dma_buf.patch b/target/linux/generic/hack-6.6/904-debloat_dma_buf.patch index 3ca98788abd4f9..4d2ea46212df45 100644 --- a/target/linux/generic/hack-6.6/904-debloat_dma_buf.patch +++ b/target/linux/generic/hack-6.6/904-debloat_dma_buf.patch @@ -73,7 +73,7 @@ Signed-off-by: Felix Fietkau +MODULE_LICENSE("GPL"); --- a/kernel/sched/core.c +++ b/kernel/sched/core.c -@@ -4485,6 +4485,7 @@ int wake_up_state(struct task_struct *p, +@@ -4486,6 +4486,7 @@ int wake_up_state(struct task_struct *p, { return try_to_wake_up(p, state, 0); } diff --git a/target/linux/generic/pending-6.6/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch b/target/linux/generic/pending-6.6/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch index 373b3e87ba92f9..1ae6f893991c1f 100644 --- a/target/linux/generic/pending-6.6/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch +++ b/target/linux/generic/pending-6.6/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 -@@ -8470,7 +8470,7 @@ static int nft_register_flowtable_net_ho +@@ -8469,7 +8469,7 @@ static int nft_register_flowtable_net_ho err = flowtable->data.type->setup(&flowtable->data, hook->ops.dev, FLOW_BLOCK_BIND); From cf3988c266d85a473bb1bc30530c8938a81e0912 Mon Sep 17 00:00:00 2001 From: John Audia Date: Sun, 30 Mar 2025 08:40:06 -0400 Subject: [PATCH 593/877] kernel: bump 6.6 to 6.6.85 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.85 Removed upstreamed: bcm27xx/patches-6.6/950-1498-dts-bcm2711-PL011-UARTs-are-actually-r1p5.patch[1] bcm27xx/patches-6.6/950-1551-drm-v3d-Don-t-run-jobs-that-have-errors-flagged-in-i.patch[2] Manually rebased: bcm27xx/patches-6.6/950-1512-dts-bcm2711-Don-t-mark-timer-regs-unconfigured.patch All other patches automatically rebased. 1. https://web.git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.85&id=61820187b3ef5a15aed7ef49ed1fcc13398b449c 2. https://web.git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.85&id=7cd375d46afcce906cfcddf5aec6b318199d1f16 Build system: x86/64 Build-tested: flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3, x86/64 Run-tested: flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3, x86/64 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/18379 (cherry picked from commit 2e71e41ce66077515a8c4f5be82c75aeeead659d) Link: https://github.com/openwrt/openwrt/pull/18419 Signed-off-by: Hauke Mehrtens --- include/kernel-6.6 | 4 +- ...gfs-end-points-to-query-GPU-usage-st.patch | 10 +-- ...ix-up-register-addresses-for-V3D-7.x.patch | 12 ++-- ...cm2711-PL011-UARTs-are-actually-r1p5.patch | 60 ------------------ ...1-Don-t-mark-timer-regs-unconfigured.patch | 11 ---- ...n-jobs-that-have-errors-flagged-in-i.patch | 61 ------------------- ...ng-with-source-address-failed-policy.patch | 18 +++--- 7 files changed, 22 insertions(+), 154 deletions(-) delete mode 100644 target/linux/bcm27xx/patches-6.6/950-1498-dts-bcm2711-PL011-UARTs-are-actually-r1p5.patch delete mode 100644 target/linux/bcm27xx/patches-6.6/950-1551-drm-v3d-Don-t-run-jobs-that-have-errors-flagged-in-i.patch diff --git a/include/kernel-6.6 b/include/kernel-6.6 index 250365a50ff786..2b70664440ae45 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .84 -LINUX_KERNEL_HASH-6.6.84 = 7fd20721551a61db347c5ac6ca05818e24058682be4e4389dc51e88d4ac17ba7 +LINUX_VERSION-6.6 = .85 +LINUX_KERNEL_HASH-6.6.85 = 5ebaccf4ca3428cd26817bae62171f4efd270eed866a3e3d0a1d9e970b7b7529 diff --git a/target/linux/bcm27xx/patches-6.6/950-0464-drm-v3d-New-debugfs-end-points-to-query-GPU-usage-st.patch b/target/linux/bcm27xx/patches-6.6/950-0464-drm-v3d-New-debugfs-end-points-to-query-GPU-usage-st.patch index 6e546e675492f3..9ff7a6d0ad3f06 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0464-drm-v3d-New-debugfs-end-points-to-query-GPU-usage-st.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0464-drm-v3d-New-debugfs-end-points-to-query-GPU-usage-st.patch @@ -423,7 +423,7 @@ Signed-off-by: Jose Maria Casanova Crespo v3d_switch_perfmon(v3d, &job->base); /* XXX: Set the QCFG */ -@@ -190,6 +301,7 @@ v3d_tfu_job_run(struct drm_sched_job *sc +@@ -194,6 +305,7 @@ v3d_tfu_job_run(struct drm_sched_job *sc trace_v3d_submit_tfu(dev, to_v3d_fence(fence)->seqno); @@ -431,7 +431,7 @@ Signed-off-by: Jose Maria Casanova Crespo V3D_WRITE(V3D_TFU_IIA, job->args.iia); V3D_WRITE(V3D_TFU_IIS, job->args.iis); V3D_WRITE(V3D_TFU_ICA, job->args.ica); -@@ -231,6 +343,7 @@ v3d_csd_job_run(struct drm_sched_job *sc +@@ -238,6 +350,7 @@ v3d_csd_job_run(struct drm_sched_job *sc trace_v3d_submit_csd(dev, to_v3d_fence(fence)->seqno); @@ -439,7 +439,7 @@ Signed-off-by: Jose Maria Casanova Crespo v3d_switch_perfmon(v3d, &job->base); for (i = 1; i <= 6; i++) -@@ -247,7 +360,10 @@ v3d_cache_clean_job_run(struct drm_sched +@@ -254,7 +367,10 @@ v3d_cache_clean_job_run(struct drm_sched struct v3d_job *job = to_v3d_job(sched_job); struct v3d_dev *v3d = job->v3d; @@ -450,7 +450,7 @@ Signed-off-by: Jose Maria Casanova Crespo return NULL; } -@@ -385,8 +501,18 @@ v3d_sched_init(struct v3d_dev *v3d) +@@ -392,8 +508,18 @@ v3d_sched_init(struct v3d_dev *v3d) int hw_jobs_limit = 1; int job_hang_limit = 0; int hang_limit_ms = 500; @@ -469,7 +469,7 @@ Signed-off-by: Jose Maria Casanova Crespo ret = drm_sched_init(&v3d->queue[V3D_BIN].sched, &v3d_bin_sched_ops, hw_jobs_limit, job_hang_limit, -@@ -440,9 +566,20 @@ void +@@ -447,9 +573,20 @@ void v3d_sched_fini(struct v3d_dev *v3d) { enum v3d_queue q; diff --git a/target/linux/bcm27xx/patches-6.6/950-0555-drm-v3d-fix-up-register-addresses-for-V3D-7.x.patch b/target/linux/bcm27xx/patches-6.6/950-0555-drm-v3d-fix-up-register-addresses-for-V3D-7.x.patch index ca8a34e8e11160..4e8134287692b5 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0555-drm-v3d-fix-up-register-addresses-for-V3D-7.x.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0555-drm-v3d-fix-up-register-addresses-for-V3D-7.x.patch @@ -600,7 +600,7 @@ v2: fix kernel panic with debug-fs interface to list registers static struct dma_fence * v3d_tfu_job_run(struct drm_sched_job *sched_job) { -@@ -302,20 +304,22 @@ v3d_tfu_job_run(struct drm_sched_job *sc +@@ -306,20 +308,22 @@ v3d_tfu_job_run(struct drm_sched_job *sc trace_v3d_submit_tfu(dev, to_v3d_fence(fence)->seqno); v3d_sched_stats_add_job(&v3d->gpu_queue_stats[V3D_TFU], sched_job); @@ -635,16 +635,16 @@ v2: fix kernel panic with debug-fs interface to list registers return fence; } -@@ -327,7 +331,7 @@ v3d_csd_job_run(struct drm_sched_job *sc +@@ -331,7 +335,7 @@ v3d_csd_job_run(struct drm_sched_job *sc struct v3d_dev *v3d = job->base.v3d; struct drm_device *dev = &v3d->drm; struct dma_fence *fence; - int i; + int i, csd_cfg0_reg, csd_cfg_reg_count; - v3d->csd_job = job; - -@@ -346,10 +350,12 @@ v3d_csd_job_run(struct drm_sched_job *sc + if (unlikely(job->base.base.s_fence->finished.error)) + return NULL; +@@ -353,10 +357,12 @@ v3d_csd_job_run(struct drm_sched_job *sc v3d_sched_stats_add_job(&v3d->gpu_queue_stats[V3D_CSD], sched_job); v3d_switch_perfmon(v3d, &job->base); @@ -660,7 +660,7 @@ v2: fix kernel panic with debug-fs interface to list registers return fence; } -@@ -452,7 +458,8 @@ v3d_csd_job_timedout(struct drm_sched_jo +@@ -459,7 +465,8 @@ v3d_csd_job_timedout(struct drm_sched_jo { struct v3d_csd_job *job = to_csd_job(sched_job); struct v3d_dev *v3d = job->base.v3d; diff --git a/target/linux/bcm27xx/patches-6.6/950-1498-dts-bcm2711-PL011-UARTs-are-actually-r1p5.patch b/target/linux/bcm27xx/patches-6.6/950-1498-dts-bcm2711-PL011-UARTs-are-actually-r1p5.patch deleted file mode 100644 index a184b3134a43e7..00000000000000 --- a/target/linux/bcm27xx/patches-6.6/950-1498-dts-bcm2711-PL011-UARTs-are-actually-r1p5.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 87fc066350358ce45f5ad52424c8a2e351b1720c Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Tue, 7 Jan 2025 12:05:41 +0000 -Subject: [PATCH] dts: bcm2711: PL011 UARTs are actually r1p5 - -The ARM PL011 UART instances in BCM2711 are r1p5 spec, which means they -have 32-entry FIFOs. The correct periphid value for this is 0x00341011. -Thanks to N Buchwitz for pointing this out. - -Signed-off-by: Phil Elwell ---- - arch/arm/boot/dts/broadcom/bcm2711.dtsi | 9 +++++---- - 1 file changed, 5 insertions(+), 4 deletions(-) - ---- a/arch/arm/boot/dts/broadcom/bcm2711.dtsi -+++ b/arch/arm/boot/dts/broadcom/bcm2711.dtsi -@@ -134,7 +134,7 @@ - clocks = <&clocks BCM2835_CLOCK_UART>, - <&clocks BCM2835_CLOCK_VPU>; - clock-names = "uartclk", "apb_pclk"; -- arm,primecell-periphid = <0x00241011>; -+ arm,primecell-periphid = <0x00341011>; - status = "disabled"; - }; - -@@ -145,7 +145,7 @@ - clocks = <&clocks BCM2835_CLOCK_UART>, - <&clocks BCM2835_CLOCK_VPU>; - clock-names = "uartclk", "apb_pclk"; -- arm,primecell-periphid = <0x00241011>; -+ arm,primecell-periphid = <0x00341011>; - status = "disabled"; - }; - -@@ -156,7 +156,7 @@ - clocks = <&clocks BCM2835_CLOCK_UART>, - <&clocks BCM2835_CLOCK_VPU>; - clock-names = "uartclk", "apb_pclk"; -- arm,primecell-periphid = <0x00241011>; -+ arm,primecell-periphid = <0x00341011>; - status = "disabled"; - }; - -@@ -167,7 +167,7 @@ - clocks = <&clocks BCM2835_CLOCK_UART>, - <&clocks BCM2835_CLOCK_VPU>; - clock-names = "uartclk", "apb_pclk"; -- arm,primecell-periphid = <0x00241011>; -+ arm,primecell-periphid = <0x00341011>; - status = "disabled"; - }; - -@@ -1155,6 +1155,7 @@ - }; - - &uart0 { -+ arm,primecell-periphid = <0x00341011>; - interrupts = ; - }; - diff --git a/target/linux/bcm27xx/patches-6.6/950-1512-dts-bcm2711-Don-t-mark-timer-regs-unconfigured.patch b/target/linux/bcm27xx/patches-6.6/950-1512-dts-bcm2711-Don-t-mark-timer-regs-unconfigured.patch index 81b37af340fdb9..168dd19f16e4c2 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1512-dts-bcm2711-Don-t-mark-timer-regs-unconfigured.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1512-dts-bcm2711-Don-t-mark-timer-regs-unconfigured.patch @@ -20,17 +20,6 @@ Signed-off-by: Phil Elwell arch/arm64/boot/dts/broadcom/bcm2712.dtsi | 2 -- 2 files changed, 4 deletions(-) ---- a/arch/arm/boot/dts/broadcom/bcm2711.dtsi -+++ b/arch/arm/boot/dts/broadcom/bcm2711.dtsi -@@ -451,8 +451,6 @@ - IRQ_TYPE_LEVEL_LOW)>, - ; -- /* This only applies to the ARMv7 stub */ -- arm,cpu-registers-not-fw-configured; - }; - - cpus: cpus { --- a/arch/arm64/boot/dts/broadcom/bcm2712.dtsi +++ b/arch/arm64/boot/dts/broadcom/bcm2712.dtsi @@ -741,8 +741,6 @@ diff --git a/target/linux/bcm27xx/patches-6.6/950-1551-drm-v3d-Don-t-run-jobs-that-have-errors-flagged-in-i.patch b/target/linux/bcm27xx/patches-6.6/950-1551-drm-v3d-Don-t-run-jobs-that-have-errors-flagged-in-i.patch deleted file mode 100644 index cdb9ad1888039f..00000000000000 --- a/target/linux/bcm27xx/patches-6.6/950-1551-drm-v3d-Don-t-run-jobs-that-have-errors-flagged-in-i.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 5258ca4ad089548a72657522443b9c3e46fd125b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ma=C3=ADra=20Canal?= -Date: Sat, 22 Feb 2025 14:40:21 -0300 -Subject: [PATCH] drm/v3d: Don't run jobs that have errors flagged in its fence -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The V3D driver still relies on `drm_sched_increase_karma()` and -`drm_sched_resubmit_jobs()` for resubmissions when a timeout occurs. -The function `drm_sched_increase_karma()` marks the job as guilty, while -`drm_sched_resubmit_jobs()` sets an error (-ECANCELED) in the DMA fence of -that guilty job. - -Because of this, we must check whether the job’s DMA fence has been -flagged with an error before executing the job. Otherwise, the same guilty -job may be resubmitted indefinitely, causing repeated GPU resets. - -This patch adds a check for an error on the job's fence to prevent running -a guilty job that was previously flagged when the GPU timed out. - -Note that the CPU and CACHE_CLEAN queues do not require this check, as -their jobs are executed synchronously once the DRM scheduler starts them. - -Cc: stable@vger.kernel.org -Fixes: d223f98f0209 ("drm/v3d: Add support for compute shader dispatch.") -Fixes: 1584f16ca96e ("drm/v3d: Add support for submitting jobs to the TFU.") -Signed-off-by: Maíra Canal ---- - drivers/gpu/drm/v3d/v3d_sched.c | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - ---- a/drivers/gpu/drm/v3d/v3d_sched.c -+++ b/drivers/gpu/drm/v3d/v3d_sched.c -@@ -292,11 +292,15 @@ v3d_tfu_job_run(struct drm_sched_job *sc - struct drm_device *dev = &v3d->drm; - struct dma_fence *fence; - -+ if (unlikely(job->base.base.s_fence->finished.error)) -+ return NULL; -+ -+ v3d->tfu_job = job; -+ - fence = v3d_fence_create(v3d, V3D_TFU); - if (IS_ERR(fence)) - return NULL; - -- v3d->tfu_job = job; - if (job->base.irq_fence) - dma_fence_put(job->base.irq_fence); - job->base.irq_fence = dma_fence_get(fence); -@@ -333,6 +337,9 @@ v3d_csd_job_run(struct drm_sched_job *sc - struct dma_fence *fence; - int i, csd_cfg0_reg, csd_cfg_reg_count; - -+ if (unlikely(job->base.base.s_fence->finished.error)) -+ return NULL; -+ - v3d->csd_job = job; - - v3d_invalidate_caches(v3d); diff --git a/target/linux/generic/pending-6.6/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch b/target/linux/generic/pending-6.6/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch index 9b76c82a6fbd00..ccafdf291136ee 100644 --- a/target/linux/generic/pending-6.6/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch +++ b/target/linux/generic/pending-6.6/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: -@@ -4551,6 +4570,17 @@ static int ip6_pkt_prohibit_out(struct n +@@ -4554,6 +4573,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. */ -@@ -5042,7 +5072,8 @@ static int rtm_to_fib6_config(struct sk_ +@@ -5045,7 +5075,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) -@@ -6304,6 +6335,8 @@ static int ip6_route_dev_notify(struct n +@@ -6307,6 +6338,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 -@@ -6315,6 +6348,7 @@ static int ip6_route_dev_notify(struct n +@@ -6318,6 +6351,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 } -@@ -6515,6 +6549,8 @@ static int __net_init ip6_route_net_init +@@ -6518,6 +6552,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); -@@ -6525,11 +6561,21 @@ static int __net_init ip6_route_net_init +@@ -6528,11 +6564,21 @@ static int __net_init ip6_route_net_init ip6_template_metrics, true); INIT_LIST_HEAD(&net->ipv6.ip6_prohibit_entry->dst.rt_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); -@@ -6556,6 +6602,8 @@ out: +@@ -6559,6 +6605,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: -@@ -6575,6 +6623,7 @@ static void __net_exit ip6_route_net_exi +@@ -6578,6 +6626,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); -@@ -6658,6 +6707,9 @@ void __init ip6_route_init_special_entri +@@ -6661,6 +6710,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); From 872966692642f435f2915c678952c07cc8d1836e Mon Sep 17 00:00:00 2001 From: Jan Hoffmann Date: Thu, 27 Feb 2025 20:43:26 +0100 Subject: [PATCH 594/877] realtek: refactor RTL930x MAC config to fix PHY ports Currently, network ports using PHYs get a link, but there is no traffic. Make it work again by moving the MAC config to phylink_mac_link_up. A similiar change has been previously applied for RTL83xx in commit cd958d945be0 ("realtek: 6.6: refactor mac config and link up for RTL83xx"). Fixes: https://github.com/openwrt/openwrt/issues/17010 Signed-off-by: Jan Hoffmann Tested-by: Christoph Krapp Link: https://github.com/openwrt/openwrt/pull/18268 Signed-off-by: Sander Vanheule (cherry picked from commit a7e1e138172a1e4f9c35db93c11d026bb3338e24) --- .../files-6.6/drivers/net/dsa/rtl83xx/dsa.c | 86 +++++++++---------- .../drivers/net/dsa/rtl83xx/rtl838x.h | 5 ++ 2 files changed, 44 insertions(+), 47 deletions(-) diff --git a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/dsa.c b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/dsa.c index f9d37fb3bd2f98..b47a2f075eecd6 100644 --- a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/dsa.c +++ b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/dsa.c @@ -797,10 +797,6 @@ static void rtl93xx_phylink_mac_config(struct dsa_switch *ds, int port, { struct rtl838x_switch_priv *priv = ds->priv; int sds_num; - u32 reg; - - pr_info("%s port %d, mode %x, phy-mode: %s, speed %d, link %d\n", __func__, - port, mode, phy_modes(state->interface), state->speed, state->link); /* Nothing to be done for the CPU-port */ if (port == priv->cpu_port) @@ -815,48 +811,6 @@ static void rtl93xx_phylink_mac_config(struct dsa_switch *ds, int port, (state->interface == PHY_INTERFACE_MODE_1000BASEX || state->interface == PHY_INTERFACE_MODE_10GBASER)) rtl9300_serdes_setup(port, sds_num, state->interface); - - reg = sw_r32(priv->r->mac_force_mode_ctrl(port)); - reg &= ~(0xf << 3); - - switch (state->speed) { - case SPEED_10000: - reg |= 4 << 3; - break; - case SPEED_5000: - reg |= 6 << 3; - break; - case SPEED_2500: - reg |= 5 << 3; - break; - case SPEED_1000: - reg |= 2 << 3; - break; - case SPEED_100: - reg |= 1 << 3; - break; - default: - /* Also covers 10M */ - break; - } - - if (state->link) - reg |= RTL930X_FORCE_LINK_EN; - - if (priv->lagmembers & BIT_ULL(port)) - reg |= RTL930X_DUPLEX_MODE | RTL930X_FORCE_LINK_EN; - - if (state->duplex == DUPLEX_FULL) - reg |= RTL930X_DUPLEX_MODE; - else - reg &= ~RTL930X_DUPLEX_MODE; /* Clear duplex bit otherwise */ - - if (priv->ports[port].phy_is_integrated) - reg &= ~RTL930X_FORCE_EN; /* Clear MAC_FORCE_EN to allow SDS-MAC link */ - else - reg |= RTL930X_FORCE_EN; - - sw_w32(reg, priv->r->mac_force_mode_ctrl(port)); } static void rtl83xx_phylink_mac_link_down(struct dsa_switch *ds, int port, @@ -962,11 +916,49 @@ static void rtl93xx_phylink_mac_link_up(struct dsa_switch *ds, int port, int speed, int duplex, bool tx_pause, bool rx_pause) { + struct dsa_port *dp = dsa_to_port(ds, port); struct rtl838x_switch_priv *priv = ds->priv; + u32 mcr, spdsel; + + if (speed == SPEED_10000) + spdsel = RTL_SPEED_10000; + else if (speed == SPEED_5000) + spdsel = RTL_SPEED_5000; + else if (speed == SPEED_2500) + spdsel = RTL_SPEED_2500; + else if (speed == SPEED_1000) + spdsel = RTL_SPEED_1000; + else if (speed == SPEED_100) + spdsel = RTL_SPEED_100; + else + spdsel = RTL_SPEED_10; + + mcr = sw_r32(priv->r->mac_force_mode_ctrl(port)); + + if (priv->family_id == RTL9300_FAMILY_ID) { + mcr &= ~RTL930X_RX_PAUSE_EN; + mcr &= ~RTL930X_TX_PAUSE_EN; + mcr &= ~RTL930X_DUPLEX_MODE; + mcr &= ~RTL930X_SPEED_MASK; + mcr |= RTL930X_FORCE_LINK_EN; + mcr |= spdsel << RTL930X_SPEED_SHIFT; + + if (tx_pause) + mcr |= RTL930X_TX_PAUSE_EN; + if (rx_pause) + mcr |= RTL930X_RX_PAUSE_EN; + if (duplex == DUPLEX_FULL || priv->lagmembers & BIT_ULL(port)) + mcr |= RTL930X_DUPLEX_MODE; + if (dsa_port_is_cpu(dp) || !priv->ports[port].phy_is_integrated) + mcr |= RTL930X_FORCE_EN; + } + + pr_debug("%s port %d, mode %x, speed %d, duplex %d, txpause %d, rxpause %d: set mcr=%08x\n", + __func__, port, mode, speed, duplex, tx_pause, rx_pause, mcr); + sw_w32(mcr, priv->r->mac_force_mode_ctrl(port)); /* Restart TX/RX to port */ sw_w32_mask(0, 0x3, priv->r->mac_port_ctrl(port)); - /* TODO: Set speed/duplex/pauses */ } static void rtl83xx_get_strings(struct dsa_switch *ds, diff --git a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl838x.h b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl838x.h index 13a0bb5ffa394f..16c60983783287 100644 --- a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl838x.h +++ b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl838x.h @@ -147,6 +147,9 @@ #define RTL_SPEED_10 0 #define RTL_SPEED_100 1 #define RTL_SPEED_1000 2 +#define RTL_SPEED_2500 5 +#define RTL_SPEED_5000 6 +#define RTL_SPEED_10000 4 #define RTL83XX_FORCE_EN (1 << 0) #define RTL83XX_FORCE_LINK_EN (1 << 1) @@ -169,6 +172,8 @@ #define RTL930X_FORCE_EN (1 << 0) #define RTL930X_FORCE_LINK_EN (1 << 1) #define RTL930X_DUPLEX_MODE (1 << 2) +#define RTL930X_SPEED_SHIFT (3) +#define RTL930X_SPEED_MASK (15 << RTL930X_SPEED_SHIFT) #define RTL930X_TX_PAUSE_EN (1 << 7) #define RTL930X_RX_PAUSE_EN (1 << 8) #define RTL930X_MAC_FORCE_FC_EN (1 << 9) From eb1f411036ff239cc998c9dd872a9ba9d85add7a Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 29 Mar 2025 21:31:49 +0100 Subject: [PATCH 595/877] generic: qca8k: backport bridge port isolation support Bridge port isolation offload support has been added to the bridge core and many DSA drivers. mt7530 support was backported in OpenWrt commit c4e6a147a6c0 ("generic: 6.6: mt7530: add support for bridge port isolation"). Backport qca8k support as well. Signed-off-by: Matthias Schiffer Link: https://github.com/openwrt/openwrt/pull/18375 Signed-off-by: Christian Marangi (cherry picked from commit 5d1dedd9f7fc7a7c893e14ec6c1548e2be7a1a13) --- ...-not-write-port-mask-twice-in-bridge.patch | 58 +++++++ ...k-factor-out-bridge-join-leave-logic.patch | 153 ++++++++++++++++++ ...dd-support-for-bridge-port-isolation.patch | 91 +++++++++++ ...-qca8k-implement-lag_fdb_add-del-ops.patch | 4 +- ...-add-IPQ4019-built-in-switch-support.patch | 23 +-- 5 files changed, 311 insertions(+), 18 deletions(-) create mode 100644 target/linux/generic/backport-6.6/793-01-v6.11-net-dsa-qca8k-do-not-write-port-mask-twice-in-bridge.patch create mode 100644 target/linux/generic/backport-6.6/793-02-v6.11-net-dsa-qca8k-factor-out-bridge-join-leave-logic.patch create mode 100644 target/linux/generic/backport-6.6/793-03-v6.11-net-dsa-qca8k-add-support-for-bridge-port-isolation.patch diff --git a/target/linux/generic/backport-6.6/793-01-v6.11-net-dsa-qca8k-do-not-write-port-mask-twice-in-bridge.patch b/target/linux/generic/backport-6.6/793-01-v6.11-net-dsa-qca8k-do-not-write-port-mask-twice-in-bridge.patch new file mode 100644 index 00000000000000..22b544c4333873 --- /dev/null +++ b/target/linux/generic/backport-6.6/793-01-v6.11-net-dsa-qca8k-do-not-write-port-mask-twice-in-bridge.patch @@ -0,0 +1,58 @@ +From e85d3e6fea05c8ae21a40809a3c6b7adc97411c7 Mon Sep 17 00:00:00 2001 +Message-ID: +From: Matthias Schiffer +Date: Thu, 20 Jun 2024 19:25:48 +0200 +Subject: [PATCH] net: dsa: qca8k: do not write port mask twice in bridge + join/leave + +qca8k_port_bridge_join() set QCA8K_PORT_LOOKUP_CTRL() for i == port twice, +once in the loop handling all other port's masks, and finally at the end +with the accumulated port_mask. + +The first time it would incorrectly set the port's own bit in the mask, +only to correct the mistake a moment later. qca8k_port_bridge_leave() had +the same issue, but here the regmap_clear_bits() was a no-op rather than +setting an unintended value. + +Remove the duplicate assignment by skipping the whole loop iteration for +i == port. The unintended bit setting doesn't seem to have any negative +effects (even when not reverted right away), so the change is submitted +as a simple cleanup rather than a fix. + +Signed-off-by: Matthias Schiffer +Reviewed-by: Wojciech Drewek +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca/qca8k-common.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +--- a/drivers/net/dsa/qca/qca8k-common.c ++++ b/drivers/net/dsa/qca/qca8k-common.c +@@ -654,6 +654,8 @@ int qca8k_port_bridge_join(struct dsa_sw + port_mask = BIT(cpu_port); + + for (i = 0; i < QCA8K_NUM_PORTS; i++) { ++ if (i == port) ++ continue; + if (dsa_is_cpu_port(ds, i)) + continue; + if (!dsa_port_offloads_bridge(dsa_to_port(ds, i), &bridge)) +@@ -666,8 +668,7 @@ int qca8k_port_bridge_join(struct dsa_sw + BIT(port)); + if (ret) + return ret; +- if (i != port) +- port_mask |= BIT(i); ++ port_mask |= BIT(i); + } + + /* Add all other ports to this ports portvlan mask */ +@@ -686,6 +687,8 @@ void qca8k_port_bridge_leave(struct dsa_ + cpu_port = dsa_to_port(ds, port)->cpu_dp->index; + + for (i = 0; i < QCA8K_NUM_PORTS; i++) { ++ if (i == port) ++ continue; + if (dsa_is_cpu_port(ds, i)) + continue; + if (!dsa_port_offloads_bridge(dsa_to_port(ds, i), &bridge)) diff --git a/target/linux/generic/backport-6.6/793-02-v6.11-net-dsa-qca8k-factor-out-bridge-join-leave-logic.patch b/target/linux/generic/backport-6.6/793-02-v6.11-net-dsa-qca8k-factor-out-bridge-join-leave-logic.patch new file mode 100644 index 00000000000000..fdb7e7b8b6d480 --- /dev/null +++ b/target/linux/generic/backport-6.6/793-02-v6.11-net-dsa-qca8k-factor-out-bridge-join-leave-logic.patch @@ -0,0 +1,153 @@ +From 412e1775f413c944b8c51bdadb675be957d83dc8 Mon Sep 17 00:00:00 2001 +Message-ID: <412e1775f413c944b8c51bdadb675be957d83dc8.1728674648.git.mschiffer@universe-factory.net> +In-Reply-To: +References: +From: Matthias Schiffer +Date: Thu, 20 Jun 2024 19:25:49 +0200 +Subject: [PATCH] net: dsa: qca8k: factor out bridge join/leave logic + +Most of the logic in qca8k_port_bridge_join() and qca8k_port_bridge_leave() +is the same. Refactor to reduce duplication and prepare for reusing the +code for implementing bridge port isolation. + +dsa_port_offloads_bridge_dev() is used instead of +dsa_port_offloads_bridge(), passing the bridge in as a struct netdevice *, +as we won't have a struct dsa_bridge in qca8k_port_bridge_flags(). + +The error handling is changed slightly in the bridge leave case, +returning early and emitting an error message when a regmap access fails. +This shouldn't matter in practice, as there isn't much we can do if +communication with the switch breaks down in the middle of reconfiguration. + +Signed-off-by: Matthias Schiffer +Reviewed-by: Wojciech Drewek +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca/qca8k-common.c | 101 ++++++++++++++--------------- + 1 file changed, 50 insertions(+), 51 deletions(-) + +--- a/drivers/net/dsa/qca/qca8k-common.c ++++ b/drivers/net/dsa/qca/qca8k-common.c +@@ -615,6 +615,49 @@ void qca8k_port_stp_state_set(struct dsa + qca8k_port_configure_learning(ds, port, learning); + } + ++static int qca8k_update_port_member(struct qca8k_priv *priv, int port, ++ const struct net_device *bridge_dev, ++ bool join) ++{ ++ struct dsa_port *dp = dsa_to_port(priv->ds, port), *other_dp; ++ u32 port_mask = BIT(dp->cpu_dp->index); ++ int i, ret; ++ ++ for (i = 0; i < QCA8K_NUM_PORTS; i++) { ++ if (i == port) ++ continue; ++ if (dsa_is_cpu_port(priv->ds, i)) ++ continue; ++ ++ other_dp = dsa_to_port(priv->ds, i); ++ if (!dsa_port_offloads_bridge_dev(other_dp, bridge_dev)) ++ continue; ++ ++ /* Add/remove this port to/from the portvlan mask of the other ++ * ports in the bridge ++ */ ++ if (join) { ++ port_mask |= BIT(i); ++ ret = regmap_set_bits(priv->regmap, ++ QCA8K_PORT_LOOKUP_CTRL(i), ++ BIT(port)); ++ } else { ++ ret = regmap_clear_bits(priv->regmap, ++ QCA8K_PORT_LOOKUP_CTRL(i), ++ BIT(port)); ++ } ++ ++ if (ret) ++ return ret; ++ } ++ ++ /* Add/remove all other ports to/from this port's portvlan mask */ ++ ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(port), ++ QCA8K_PORT_LOOKUP_MEMBER, port_mask); ++ ++ return ret; ++} ++ + int qca8k_port_pre_bridge_flags(struct dsa_switch *ds, int port, + struct switchdev_brport_flags flags, + struct netlink_ext_ack *extack) +@@ -647,65 +690,21 @@ int qca8k_port_bridge_join(struct dsa_sw + struct netlink_ext_ack *extack) + { + struct qca8k_priv *priv = ds->priv; +- int port_mask, cpu_port; +- int i, ret; +- +- cpu_port = dsa_to_port(ds, port)->cpu_dp->index; +- port_mask = BIT(cpu_port); + +- for (i = 0; i < QCA8K_NUM_PORTS; i++) { +- if (i == port) +- continue; +- if (dsa_is_cpu_port(ds, i)) +- continue; +- if (!dsa_port_offloads_bridge(dsa_to_port(ds, i), &bridge)) +- continue; +- /* Add this port to the portvlan mask of the other ports +- * in the bridge +- */ +- ret = regmap_set_bits(priv->regmap, +- QCA8K_PORT_LOOKUP_CTRL(i), +- BIT(port)); +- if (ret) +- return ret; +- port_mask |= BIT(i); +- } +- +- /* Add all other ports to this ports portvlan mask */ +- ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(port), +- QCA8K_PORT_LOOKUP_MEMBER, port_mask); +- +- return ret; ++ return qca8k_update_port_member(priv, port, bridge.dev, true); + } + + void qca8k_port_bridge_leave(struct dsa_switch *ds, int port, + struct dsa_bridge bridge) + { + struct qca8k_priv *priv = ds->priv; +- int cpu_port, i; +- +- cpu_port = dsa_to_port(ds, port)->cpu_dp->index; +- +- for (i = 0; i < QCA8K_NUM_PORTS; i++) { +- if (i == port) +- continue; +- if (dsa_is_cpu_port(ds, i)) +- continue; +- if (!dsa_port_offloads_bridge(dsa_to_port(ds, i), &bridge)) +- continue; +- /* Remove this port to the portvlan mask of the other ports +- * in the bridge +- */ +- regmap_clear_bits(priv->regmap, +- QCA8K_PORT_LOOKUP_CTRL(i), +- BIT(port)); +- } ++ int err; + +- /* Set the cpu port to be the only one in the portvlan mask of +- * this port +- */ +- qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(port), +- QCA8K_PORT_LOOKUP_MEMBER, BIT(cpu_port)); ++ err = qca8k_update_port_member(priv, port, bridge.dev, false); ++ if (err) ++ dev_err(priv->dev, ++ "Failed to update switch config for bridge leave: %d\n", ++ err); + } + + void qca8k_port_fast_age(struct dsa_switch *ds, int port) diff --git a/target/linux/generic/backport-6.6/793-03-v6.11-net-dsa-qca8k-add-support-for-bridge-port-isolation.patch b/target/linux/generic/backport-6.6/793-03-v6.11-net-dsa-qca8k-add-support-for-bridge-port-isolation.patch new file mode 100644 index 00000000000000..263fe10d4b9d12 --- /dev/null +++ b/target/linux/generic/backport-6.6/793-03-v6.11-net-dsa-qca8k-add-support-for-bridge-port-isolation.patch @@ -0,0 +1,91 @@ +From 422b64025ec10981c48f9367311846bf4bd38042 Mon Sep 17 00:00:00 2001 +Message-ID: <422b64025ec10981c48f9367311846bf4bd38042.1728674648.git.mschiffer@universe-factory.net> +In-Reply-To: +References: +From: Matthias Schiffer +Date: Thu, 20 Jun 2024 19:25:50 +0200 +Subject: [PATCH] net: dsa: qca8k: add support for bridge port isolation + +Remove a pair of ports from the port matrix when both ports have the +isolated flag set. + +Signed-off-by: Matthias Schiffer +Reviewed-by: Wojciech Drewek +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca/qca8k-common.c | 22 ++++++++++++++++++++-- + drivers/net/dsa/qca/qca8k.h | 1 + + 2 files changed, 21 insertions(+), 2 deletions(-) + +--- a/drivers/net/dsa/qca/qca8k-common.c ++++ b/drivers/net/dsa/qca/qca8k-common.c +@@ -619,6 +619,7 @@ static int qca8k_update_port_member(stru + const struct net_device *bridge_dev, + bool join) + { ++ bool isolated = !!(priv->port_isolated_map & BIT(port)), other_isolated; + struct dsa_port *dp = dsa_to_port(priv->ds, port), *other_dp; + u32 port_mask = BIT(dp->cpu_dp->index); + int i, ret; +@@ -633,10 +634,12 @@ static int qca8k_update_port_member(stru + if (!dsa_port_offloads_bridge_dev(other_dp, bridge_dev)) + continue; + ++ other_isolated = !!(priv->port_isolated_map & BIT(i)); ++ + /* Add/remove this port to/from the portvlan mask of the other + * ports in the bridge + */ +- if (join) { ++ if (join && !(isolated && other_isolated)) { + port_mask |= BIT(i); + ret = regmap_set_bits(priv->regmap, + QCA8K_PORT_LOOKUP_CTRL(i), +@@ -662,7 +665,7 @@ int qca8k_port_pre_bridge_flags(struct d + struct switchdev_brport_flags flags, + struct netlink_ext_ack *extack) + { +- if (flags.mask & ~BR_LEARNING) ++ if (flags.mask & ~(BR_LEARNING | BR_ISOLATED)) + return -EINVAL; + + return 0; +@@ -672,6 +675,7 @@ int qca8k_port_bridge_flags(struct dsa_s + struct switchdev_brport_flags flags, + struct netlink_ext_ack *extack) + { ++ struct qca8k_priv *priv = ds->priv; + int ret; + + if (flags.mask & BR_LEARNING) { +@@ -680,6 +684,20 @@ int qca8k_port_bridge_flags(struct dsa_s + if (ret) + return ret; + } ++ ++ if (flags.mask & BR_ISOLATED) { ++ struct dsa_port *dp = dsa_to_port(ds, port); ++ struct net_device *bridge_dev = dsa_port_bridge_dev_get(dp); ++ ++ if (flags.val & BR_ISOLATED) ++ priv->port_isolated_map |= BIT(port); ++ else ++ priv->port_isolated_map &= ~BIT(port); ++ ++ ret = qca8k_update_port_member(priv, port, bridge_dev, true); ++ if (ret) ++ return ret; ++ } + + return 0; + } +--- a/drivers/net/dsa/qca/qca8k.h ++++ b/drivers/net/dsa/qca/qca8k.h +@@ -451,6 +451,7 @@ struct qca8k_priv { + * Bit 1: port enabled. Bit 0: port disabled. + */ + u8 port_enabled_map; ++ u8 port_isolated_map; + struct qca8k_ports_config ports_config; + struct regmap *regmap; + struct mii_bus *bus; diff --git a/target/linux/generic/pending-6.6/711-01-net-dsa-qca8k-implement-lag_fdb_add-del-ops.patch b/target/linux/generic/pending-6.6/711-01-net-dsa-qca8k-implement-lag_fdb_add-del-ops.patch index 3197aea0914b36..8d815dd2f2bc32 100644 --- a/target/linux/generic/pending-6.6/711-01-net-dsa-qca8k-implement-lag_fdb_add-del-ops.patch +++ b/target/linux/generic/pending-6.6/711-01-net-dsa-qca8k-implement-lag_fdb_add-del-ops.patch @@ -27,7 +27,7 @@ Signed-off-by: Christian Marangi .port_mirror_add = qca8k_port_mirror_add, --- a/drivers/net/dsa/qca/qca8k-common.c +++ b/drivers/net/dsa/qca/qca8k-common.c -@@ -1215,6 +1215,42 @@ int qca8k_port_lag_leave(struct dsa_swit +@@ -1235,6 +1235,42 @@ int qca8k_port_lag_leave(struct dsa_swit return qca8k_lag_refresh_portmap(ds, port, lag, true); } @@ -72,7 +72,7 @@ Signed-off-by: Christian Marangi u32 val; --- a/drivers/net/dsa/qca/qca8k.h +++ b/drivers/net/dsa/qca/qca8k.h -@@ -590,5 +590,11 @@ int qca8k_port_lag_join(struct dsa_switc +@@ -591,5 +591,11 @@ int qca8k_port_lag_join(struct dsa_switc struct netlink_ext_ack *extack); int qca8k_port_lag_leave(struct dsa_switch *ds, int port, struct dsa_lag lag); diff --git a/target/linux/ipq40xx/patches-6.6/706-net-dsa-qca8k-add-IPQ4019-built-in-switch-support.patch b/target/linux/ipq40xx/patches-6.6/706-net-dsa-qca8k-add-IPQ4019-built-in-switch-support.patch index 9bd5ca515ee5d7..76539cea88c38f 100644 --- a/target/linux/ipq40xx/patches-6.6/706-net-dsa-qca8k-add-IPQ4019-built-in-switch-support.patch +++ b/target/linux/ipq40xx/patches-6.6/706-net-dsa-qca8k-add-IPQ4019-built-in-switch-support.patch @@ -67,24 +67,15 @@ Signed-off-by: Robert Marko mask = QCA8K_VTU_FUNC0_EG_MODE_PORT_NOT(i); if ((reg & mask) != mask) { -@@ -653,7 +653,7 @@ int qca8k_port_bridge_join(struct dsa_sw - cpu_port = dsa_to_port(ds, port)->cpu_dp->index; - port_mask = BIT(cpu_port); +@@ -624,7 +624,7 @@ static int qca8k_update_port_member(stru + u32 port_mask = BIT(dp->cpu_dp->index); + int i, ret; - for (i = 0; i < QCA8K_NUM_PORTS; i++) { -+ for (i = 0; i < ds->num_ports; i++) { - if (dsa_is_cpu_port(ds, i)) - continue; - if (!dsa_port_offloads_bridge(dsa_to_port(ds, i), &bridge)) -@@ -685,7 +685,7 @@ void qca8k_port_bridge_leave(struct dsa_ - - cpu_port = dsa_to_port(ds, port)->cpu_dp->index; - -- for (i = 0; i < QCA8K_NUM_PORTS; i++) { -+ for (i = 0; i < ds->num_ports; i++) { - if (dsa_is_cpu_port(ds, i)) ++ for (i = 0; i < priv->ds->num_ports; i++) { + if (i == port) continue; - if (!dsa_port_offloads_bridge(dsa_to_port(ds, i), &bridge)) + if (dsa_is_cpu_port(priv->ds, i)) --- /dev/null +++ b/drivers/net/dsa/qca/qca8k-ipq4019.c @@ -0,0 +1,948 @@ @@ -1119,7 +1110,7 @@ Signed-off-by: Robert Marko enum { QCA8K_PORT_SPEED_10M = 0, QCA8K_PORT_SPEED_100M = 1, -@@ -466,6 +518,10 @@ struct qca8k_priv { +@@ -467,6 +519,10 @@ struct qca8k_priv { struct qca8k_pcs pcs_port_6; const struct qca8k_match_data *info; struct qca8k_led ports_led[QCA8K_LED_COUNT]; From 2868202df3898481004570175a9e4a015da9b491 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 29 Mar 2025 21:32:08 +0100 Subject: [PATCH 596/877] ipq40xx: qca8k: hook up IPQ4019 bridge flag offloading Adds support for setting bridge port learning and isolation flags on ipq40xx. Signed-off-by: Matthias Schiffer Link: https://github.com/openwrt/openwrt/pull/18375 Signed-off-by: Christian Marangi (cherry picked from commit af93874f4e5e4f6a8646964fecf385711d527e89) --- ...06-net-dsa-qca8k-add-IPQ4019-built-in-switch-support.patch | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/linux/ipq40xx/patches-6.6/706-net-dsa-qca8k-add-IPQ4019-built-in-switch-support.patch b/target/linux/ipq40xx/patches-6.6/706-net-dsa-qca8k-add-IPQ4019-built-in-switch-support.patch index 76539cea88c38f..73e99f2bdc28c2 100644 --- a/target/linux/ipq40xx/patches-6.6/706-net-dsa-qca8k-add-IPQ4019-built-in-switch-support.patch +++ b/target/linux/ipq40xx/patches-6.6/706-net-dsa-qca8k-add-IPQ4019-built-in-switch-support.patch @@ -78,7 +78,7 @@ Signed-off-by: Robert Marko if (dsa_is_cpu_port(priv->ds, i)) --- /dev/null +++ b/drivers/net/dsa/qca/qca8k-ipq4019.c -@@ -0,0 +1,948 @@ +@@ -0,0 +1,950 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2009 Felix Fietkau @@ -870,6 +870,8 @@ Signed-off-by: Robert Marko + .port_change_mtu = qca8k_port_change_mtu, + .port_max_mtu = qca8k_port_max_mtu, + .port_stp_state_set = qca8k_port_stp_state_set, ++ .port_pre_bridge_flags = qca8k_port_pre_bridge_flags, ++ .port_bridge_flags = qca8k_port_bridge_flags, + .port_bridge_join = qca8k_port_bridge_join, + .port_bridge_leave = qca8k_port_bridge_leave, + .port_fast_age = qca8k_port_fast_age, From dc7933e77fcc7a388dfa2785b57b5b7c46b8a588 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 5 Apr 2025 13:30:12 +0200 Subject: [PATCH 597/877] build: bpf: drop clang-11 lookup CLANG_MIN_VER is 12, so there is no point in looking for clang-11. Signed-off-by: Matthias Schiffer Link: https://github.com/openwrt/openwrt/pull/18422 Signed-off-by: Robert Marko (cherry picked from commit 45f0eb106bed8868c02e0ccfb545b7e1c4279841) --- include/bpf.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/bpf.mk b/include/bpf.mk index 8a0121aabec042..915662a4fefa2b 100644 --- a/include/bpf.mk +++ b/include/bpf.mk @@ -10,7 +10,7 @@ ifneq ($(CONFIG_USE_LLVM_HOST),) else BPF_PATH:=$(PATH) endif - CLANG:=$(firstword $(shell PATH='$(BPF_PATH)' command -v clang clang-13 clang-12 clang-11)) + CLANG:=$(firstword $(shell PATH='$(BPF_PATH)' command -v clang clang-13 clang-12)) LLVM_VER:=$(subst clang,,$(notdir $(CLANG))) endif ifneq ($(CONFIG_USE_LLVM_PREBUILT),) From a51b1a98e026887ea4dd8f09a6fdc8138941e2ac Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 5 Apr 2025 12:23:44 +0200 Subject: [PATCH 598/877] build: bpf: fix LLVM tool paths with host toolchain Do not assume that the various tools like llc can be found under the same path as clang; instead, look them up through BPF_PATH (while still preferring ones found next to clang). This fixes build in common setups with ccache, where clang resolves to a path like /usr/lib/ccache/bin/clang, but no other tools can be found at that location. Signed-off-by: Matthias Schiffer Link: https://github.com/openwrt/openwrt/pull/18422 Signed-off-by: Robert Marko (cherry picked from commit 89f1d56a7eab7d530be4bbb5cf21dfc80b3485b1) --- include/bpf.mk | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/include/bpf.mk b/include/bpf.mk index 915662a4fefa2b..b9c8034c683722 100644 --- a/include/bpf.mk +++ b/include/bpf.mk @@ -1,30 +1,40 @@ BPF_DEPENDS := @HAS_BPF_TOOLCHAIN +@NEED_BPF_TOOLCHAIN -LLVM_VER:= CLANG_MIN_VER:=12 ifneq ($(CONFIG_USE_LLVM_HOST),) + find-llvm-tool=$(firstword $(shell PATH='$(BPF_PATH)' command -v $(1) || echo '$(firstword $(1))-not-found')) + BPF_TOOLCHAIN_HOST_PATH:=$(call qstrip,$(CONFIG_BPF_TOOLCHAIN_HOST_PATH)) ifneq ($(BPF_TOOLCHAIN_HOST_PATH),) BPF_PATH:=$(BPF_TOOLCHAIN_HOST_PATH)/bin:$(PATH) else BPF_PATH:=$(PATH) endif - CLANG:=$(firstword $(shell PATH='$(BPF_PATH)' command -v clang clang-13 clang-12)) + CLANG:=$(call find-llvm-tool,clang clang-13 clang-12) LLVM_VER:=$(subst clang,,$(notdir $(CLANG))) -endif -ifneq ($(CONFIG_USE_LLVM_PREBUILT),) - CLANG:=$(TOPDIR)/llvm-bpf/bin/clang -endif -ifneq ($(CONFIG_USE_LLVM_BUILD),) - CLANG:=$(STAGING_DIR_HOST)/llvm-bpf/bin/clang -endif -LLVM_PATH:=$(dir $(CLANG)) -LLVM_LLC:=$(LLVM_PATH)/llc$(LLVM_VER) -LLVM_DIS:=$(LLVM_PATH)/llvm-dis$(LLVM_VER) -LLVM_OPT:=$(LLVM_PATH)/opt$(LLVM_VER) -LLVM_STRIP:=$(LLVM_PATH)/llvm-strip$(LLVM_VER) + BPF_PATH:=$(dir $(CLANG)):$(BPF_PATH) + LLVM_LLC:=$(call find-llvm-tool,llc$(LLVM_VER)) + LLVM_DIS:=$(call find-llvm-tool,llvm-dis$(LLVM_VER)) + LLVM_OPT:=$(call find-llvm-tool,opt$(LLVM_VER)) + LLVM_STRIP:=$(call find-llvm-tool,llvm-strip$(LLVM_VER)) +else + LLVM_PATH:=/invalid + + ifneq ($(CONFIG_USE_LLVM_PREBUILT),) + LLVM_PATH:=$(TOPDIR)/llvm-bpf/bin + endif + ifneq ($(CONFIG_USE_LLVM_BUILD),) + LLVM_PATH:=$(STAGING_DIR_HOST)/llvm-bpf/bin + endif + + CLANG:=$(LLVM_PATH)/clang + LLVM_LLC:=$(LLVM_PATH)/llc + LLVM_DIS:=$(LLVM_PATH)/llvm-dis + LLVM_OPT:=$(LLVM_PATH)/opt + LLVM_STRIP:=$(LLVM_PATH)/llvm-strip +endif BPF_KARCH:=mips BPF_ARCH:=mips$(if $(CONFIG_ARCH_64BIT),64)$(if $(CONFIG_BIG_ENDIAN),,el) From 2b1847c78116b4b8da9f18a7d685f112d46c126a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Thu, 10 Apr 2025 10:32:56 +0200 Subject: [PATCH 599/877] bcm27xx: pull 6.6 patches from RPi repo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds latest 6.6 patches from the Raspberry Pi repository. These patches were generated from: https://github.com/raspberrypi/linux/commits/rpi-6.6.y/ With the following command: git format-patch -N v6.6.85..HEAD (HEAD -> bba53a117a4a5c29da892962332ff1605990e17a) Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 4618d09587c4e3d5fdc7643494474be602710815) --- ...7-Add-further-link-frequency-options.patch | 77 +++++++++++++++++ ...overlays-Fix-some-unusable-fragments.patch | 82 +++++++++++++++++++ ...560-dts-rp1-Don-t-use-DMA-with-UARTs.patch | 33 ++++++++ 3 files changed, 192 insertions(+) create mode 100644 target/linux/bcm27xx/patches-6.6/950-1558-media-i2c-imx477-Add-further-link-frequency-options.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1559-overlays-Fix-some-unusable-fragments.patch create mode 100644 target/linux/bcm27xx/patches-6.6/950-1560-dts-rp1-Don-t-use-DMA-with-UARTs.patch diff --git a/target/linux/bcm27xx/patches-6.6/950-1558-media-i2c-imx477-Add-further-link-frequency-options.patch b/target/linux/bcm27xx/patches-6.6/950-1558-media-i2c-imx477-Add-further-link-frequency-options.patch new file mode 100644 index 00000000000000..8ed80cd201fda1 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1558-media-i2c-imx477-Add-further-link-frequency-options.patch @@ -0,0 +1,77 @@ +From 0553897d77e849a86e836ddf1e0c0dbbd8e64f83 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Mon, 20 Jan 2025 10:40:09 +0000 +Subject: [PATCH] media: i2c: imx477: Add further link frequency options + +https://github.com/raspberrypi/linux/issues/6004 reports further +issues with GPS interference. + +Untested, but adds further link frequency options. + +Signed-off-by: Dave Stevenson +--- + drivers/media/i2c/imx477.c | 33 +++++++++++++++++++++++++++++++++ + 1 file changed, 33 insertions(+) + +--- a/drivers/media/i2c/imx477.c ++++ b/drivers/media/i2c/imx477.c +@@ -169,12 +169,18 @@ enum { + IMX477_LINK_FREQ_450MHZ, + IMX477_LINK_FREQ_453MHZ, + IMX477_LINK_FREQ_456MHZ, ++ IMX477_LINK_FREQ_459MHZ, ++ IMX477_LINK_FREQ_462MHZ, ++ IMX477_LINK_FREQ_498MHZ, + }; + + static const s64 link_freqs[] = { + [IMX477_LINK_FREQ_450MHZ] = 450000000, + [IMX477_LINK_FREQ_453MHZ] = 453000000, + [IMX477_LINK_FREQ_456MHZ] = 456000000, ++ [IMX477_LINK_FREQ_459MHZ] = 459000000, ++ [IMX477_LINK_FREQ_462MHZ] = 462000000, ++ [IMX477_LINK_FREQ_498MHZ] = 498000000, + }; + + /* 450MHz is the nominal "default" link frequency */ +@@ -193,6 +199,21 @@ static const struct imx477_reg link_456M + {0x030F, 0x98}, + }; + ++static const struct imx477_reg link_459Mhz_regs[] = { ++ {0x030E, 0x00}, ++ {0x030F, 0x99}, ++}; ++ ++static const struct imx477_reg link_462Mhz_regs[] = { ++ {0x030E, 0x00}, ++ {0x030F, 0x9a}, ++}; ++ ++static const struct imx477_reg link_498Mhz_regs[] = { ++ {0x030E, 0x00}, ++ {0x030F, 0xa6}, ++}; ++ + static const struct imx477_reg_list link_freq_regs[] = { + [IMX477_LINK_FREQ_450MHZ] = { + .regs = link_450Mhz_regs, +@@ -206,6 +227,18 @@ static const struct imx477_reg_list link + .regs = link_456Mhz_regs, + .num_of_regs = ARRAY_SIZE(link_456Mhz_regs) + }, ++ [IMX477_LINK_FREQ_459MHZ] = { ++ .regs = link_459Mhz_regs, ++ .num_of_regs = ARRAY_SIZE(link_459Mhz_regs) ++ }, ++ [IMX477_LINK_FREQ_462MHZ] = { ++ .regs = link_462Mhz_regs, ++ .num_of_regs = ARRAY_SIZE(link_462Mhz_regs) ++ }, ++ [IMX477_LINK_FREQ_498MHZ] = { ++ .regs = link_498Mhz_regs, ++ .num_of_regs = ARRAY_SIZE(link_498Mhz_regs) ++ }, + }; + + static const struct imx477_reg mode_common_regs[] = { diff --git a/target/linux/bcm27xx/patches-6.6/950-1559-overlays-Fix-some-unusable-fragments.patch b/target/linux/bcm27xx/patches-6.6/950-1559-overlays-Fix-some-unusable-fragments.patch new file mode 100644 index 00000000000000..bebe05555239c2 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1559-overlays-Fix-some-unusable-fragments.patch @@ -0,0 +1,82 @@ +From 9da8d6df2051478f0ba16d73c65995955c19cb3a Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 18 Mar 2025 13:09:11 +0000 +Subject: [PATCH] overlays: Fix some unusable fragments + +A forthcoming overlaycheck update looks for dormant fragments with no +parameters to enable them. The test discovered some real errors, which +this patch fixes, and one case where some fragments aren't yet being +used, which this comments out until they are. + +Signed-off-by: Phil Elwell +--- + arch/arm/boot/dts/overlays/rpi-poe-overlay.dts | 2 +- + arch/arm/boot/dts/overlays/rpi-poe-plus-overlay.dts | 2 +- + arch/arm/boot/dts/overlays/sx150x-overlay.dts | 2 +- + arch/arm/boot/dts/overlays/vc4-kms-dpi-panel-overlay.dts | 4 ++++ + 4 files changed, 7 insertions(+), 3 deletions(-) + +--- a/arch/arm/boot/dts/overlays/rpi-poe-overlay.dts ++++ b/arch/arm/boot/dts/overlays/rpi-poe-overlay.dts +@@ -145,7 +145,7 @@ + poe_fan_temp2_hyst = <&trip2>,"hysteresis:0"; + poe_fan_temp3 = <&trip3>,"temperature:0"; + poe_fan_temp3_hyst = <&trip3>,"hysteresis:0"; +- i2c = <0>, "+5+6", ++ i2c = <0>, "+7+8", + <&fwpwm>,"status=disabled", + <&i2c_bus>,"status=okay", + <&poe_mfd>,"status=okay", +--- a/arch/arm/boot/dts/overlays/rpi-poe-plus-overlay.dts ++++ b/arch/arm/boot/dts/overlays/rpi-poe-plus-overlay.dts +@@ -28,7 +28,7 @@ + }; + + __overrides__ { +- i2c = <0>, "+5+6", ++ i2c = <0>, "+7+8", + <&fwpwm>,"status=disabled", + <&rpi_poe_power_supply>,"status=disabled", + <&i2c_bus>,"status=okay", +--- a/arch/arm/boot/dts/overlays/sx150x-overlay.dts ++++ b/arch/arm/boot/dts/overlays/sx150x-overlay.dts +@@ -1681,7 +1681,7 @@ + sx1507-1-3E-int-gpio = <0>,"+67+99", <&sx150x_1_3E_pins>,"brcm,pins:0", <&sx1507_1_3E>,"interrupts:0"; + sx1507-0-3F-int-gpio = <0>,"+68+100", <&sx150x_0_3F_pins>,"brcm,pins:0", <&sx1507_0_3F>,"interrupts:0"; + sx1507-1-3F-int-gpio = <0>,"+69+101", <&sx150x_1_3F_pins>,"brcm,pins:0", <&sx1507_1_3F>,"interrupts:0"; +- sx1507-0-70-int-gpio = <0>,"+60+102", <&sx150x_0_70_pins>,"brcm,pins:0", <&sx1507_0_70>,"interrupts:0"; ++ sx1507-0-70-int-gpio = <0>,"+70+102", <&sx150x_0_70_pins>,"brcm,pins:0", <&sx1507_0_70>,"interrupts:0"; + sx1507-1-70-int-gpio = <0>,"+71+103", <&sx150x_1_70_pins>,"brcm,pins:0", <&sx1507_1_70>,"interrupts:0"; + sx1507-0-71-int-gpio = <0>,"+72+104", <&sx150x_0_71_pins>,"brcm,pins:0", <&sx1507_0_71>,"interrupts:0"; + sx1507-1-71-int-gpio = <0>,"+73+105", <&sx150x_1_71_pins>,"brcm,pins:0", <&sx1507_1_71>,"interrupts:0"; +--- a/arch/arm/boot/dts/overlays/vc4-kms-dpi-panel-overlay.dts ++++ b/arch/arm/boot/dts/overlays/vc4-kms-dpi-panel-overlay.dts +@@ -42,24 +42,28 @@ + pinctrl-0 = <&dpi_18bit_gpio0>; + }; + }; ++#if 0 + fragment@92 { + target = <&dpi>; + __dormant__ { + pinctrl-0 = <&dpi_gpio0>; + }; + }; ++#endif + fragment@93 { + target = <&dpi>; + __dormant__ { + pinctrl-0 = <&dpi_16bit_cpadhi_gpio0>; + }; + }; ++#if 0 + fragment@94 { + target = <&dpi>; + __dormant__ { + pinctrl-0 = <&dpi_16bit_gpio0>; + }; + }; ++#endif + + __overrides__ { + at056tn53v1 = <0>, "+0+90"; diff --git a/target/linux/bcm27xx/patches-6.6/950-1560-dts-rp1-Don-t-use-DMA-with-UARTs.patch b/target/linux/bcm27xx/patches-6.6/950-1560-dts-rp1-Don-t-use-DMA-with-UARTs.patch new file mode 100644 index 00000000000000..df19f4cac6cf19 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.6/950-1560-dts-rp1-Don-t-use-DMA-with-UARTs.patch @@ -0,0 +1,33 @@ +From bba53a117a4a5c29da892962332ff1605990e17a Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 26 Mar 2025 11:28:28 +0000 +Subject: [PATCH] dts: rp1: Don't use DMA with UARTs + +DMA has been enabled on RP1's UART0, but with mixed success. Transmits +seem to work, but the DMA interface is not well suited to receiving +arbitrary amounts of data. In particular, the PL011 driver is slow to +pass on the received data, batching it into large blocks. + +On balance, it's better to just disable the DMA support. As with the +other UARTs, the required runes are left in the DTS as comments. + +Signed-off-by: Phil Elwell +--- + arch/arm64/boot/dts/broadcom/rp1.dtsi | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/arch/arm64/boot/dts/broadcom/rp1.dtsi ++++ b/arch/arm64/boot/dts/broadcom/rp1.dtsi +@@ -65,9 +65,9 @@ + interrupts = ; + clocks = <&rp1_clocks RP1_CLK_UART &rp1_clocks RP1_PLL_SYS_PRI_PH>; + clock-names = "uartclk", "apb_pclk"; +- dmas = <&rp1_dma RP1_DMA_UART0_TX>, +- <&rp1_dma RP1_DMA_UART0_RX>; +- dma-names = "tx", "rx"; ++ // dmas = <&rp1_dma RP1_DMA_UART0_TX>, ++ // <&rp1_dma RP1_DMA_UART0_RX>; ++ // dma-names = "tx", "rx"; + pinctrl-names = "default"; + arm,primecell-periphid = <0x00341011>; + uart-has-rtscts; From b16a42159b34890e40fefe13350b82952b79c902 Mon Sep 17 00:00:00 2001 From: Mieczyslaw Nalewaj Date: Tue, 8 Apr 2025 17:37:59 +0200 Subject: [PATCH 600/877] kernel: bump 6.6 to 6.6.86 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.86 Removed upstreamed: generic/pending-6.6/155-usbnet-restore-usb%d-name-exception-for-local-mac-addresses.patch[1] 1. https://web.git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.86&id=2beb999f73b48f3cb04d7cb9c4b5400d59f80f89 Signed-off-by: Mieczyslaw Nalewaj Link: https://github.com/openwrt/openwrt/pull/18443 Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit f7c0331c50f1bb123255e76fd544021576b4e477) Link: https://github.com/openwrt/openwrt/pull/18451 Signed-off-by: Hauke Mehrtens --- include/kernel-6.6 | 4 +- ...me-exception-for-local-mac-addresses.patch | 63 ------------------- 2 files changed, 2 insertions(+), 65 deletions(-) delete mode 100644 target/linux/generic/pending-6.6/155-usbnet-restore-usb%d-name-exception-for-local-mac-addresses.patch diff --git a/include/kernel-6.6 b/include/kernel-6.6 index 2b70664440ae45..9fd98c30464c50 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .85 -LINUX_KERNEL_HASH-6.6.85 = 5ebaccf4ca3428cd26817bae62171f4efd270eed866a3e3d0a1d9e970b7b7529 +LINUX_VERSION-6.6 = .86 +LINUX_KERNEL_HASH-6.6.86 = 49e3ad7423e40735faada0cd39665c071d47efd84ec3548acf119c9704f13e68 diff --git a/target/linux/generic/pending-6.6/155-usbnet-restore-usb%d-name-exception-for-local-mac-addresses.patch b/target/linux/generic/pending-6.6/155-usbnet-restore-usb%d-name-exception-for-local-mac-addresses.patch deleted file mode 100644 index 0d32800cbc983b..00000000000000 --- a/target/linux/generic/pending-6.6/155-usbnet-restore-usb%d-name-exception-for-local-mac-addresses.patch +++ /dev/null @@ -1,63 +0,0 @@ -From linux-netdev Tue Dec 03 13:04:55 2024 -From: Dominique Martinet -Date: Tue, 03 Dec 2024 13:04:55 +0000 -To: linux-netdev -Subject: [PATCH] net: usb: usbnet: restore usb%d name exception for local mac addresses -Message-Id: <20241203130457.904325-1-asmadeus () codewreck ! org> -X-MARC-Message: https://marc.info/?l=linux-netdev&m=173323431631309 - -From: Dominique Martinet - -The previous commit assumed that local addresses always came from the -kernel, but some devices hand out local mac addresses so we ended up -with point-to-point devices with a mac set by the driver, renaming to -eth%d when they used to be named usb%d. - -Userspace should not rely on device name, but for the sake of stability -restore the local mac address check portion of the naming exception: -point to point devices which either have no mac set by the driver or -have a local mac handed out by the driver will keep the usb%d name. - -Fixes: 8a7d12d674ac ("net: usb: usbnet: fix name regression") -Signed-off-by: Dominique Martinet ---- - drivers/net/usb/usbnet.c | 20 ++++++++++++++------ - 1 file changed, 14 insertions(+), 6 deletions(-) - ---- a/drivers/net/usb/usbnet.c -+++ b/drivers/net/usb/usbnet.c -@@ -178,6 +178,17 @@ int usbnet_get_ethernet_addr(struct usbn - } - EXPORT_SYMBOL_GPL(usbnet_get_ethernet_addr); - -+static bool usbnet_needs_usb_name_format(struct usbnet *dev, struct net_device *net) -+{ -+ /* Point to point devices which don't have a real MAC address -+ * (or report a fake local one) have historically used the usb%d -+ * naming. Preserve this.. -+ */ -+ return (dev->driver_info->flags & FLAG_POINTTOPOINT) != 0 && -+ (is_zero_ether_addr(net->dev_addr) || -+ is_local_ether_addr(net->dev_addr)); -+} -+ - static void intr_complete (struct urb *urb) - { - struct usbnet *dev = urb->context; -@@ -1766,13 +1777,10 @@ usbnet_probe (struct usb_interface *udev - if (status < 0) - goto out1; - -- // heuristic: "usb%d" for links we know are two-host, -- // else "eth%d" when there's reasonable doubt. userspace -- // can rename the link if it knows better. -+ /* heuristic: rename to "eth%d" if we are not sure this link -+ * is two-host (these links keep "usb%d") */ - if ((dev->driver_info->flags & FLAG_ETHER) != 0 && -- ((dev->driver_info->flags & FLAG_POINTTOPOINT) == 0 || -- /* somebody touched it*/ -- !is_zero_ether_addr(net->dev_addr))) -+ !usbnet_needs_usb_name_format(dev, net)) - strscpy(net->name, "eth%d", sizeof(net->name)); - /* WLAN devices should always be named "wlan%d" */ - if ((dev->driver_info->flags & FLAG_WLAN) != 0) From 8e8cafcd0e7354f6c2db09c4549fe901b843f12d Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Sat, 22 Mar 2025 17:33:39 +0000 Subject: [PATCH 601/877] mediatek: add support for netis NX31 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR adds support for netis NX31 router. Specification ------------- - SoC : MediaTek MT7981BA dual-core ARM Cortex-A53 1.3 GHz - RAM : 256 MiB DDR3 - Flash : SPI-NAND 128 MiB (ESMT) - 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 x3 (LAN, MediaTek MT7531AE) 10/100/1000 Mbps x1 (WAN, SoC internal phy) - USB : No - Buttons : Mesh, Reset - LEDs : 1x Power (blue), unmanaged 1x Status (blue), gpio-controlled 1x WiFi 2.4 GHz (blue), gpio-controlled 1x WiFi 5 GHz (blue), gpio-controlled 3x LAN activity (blue), switch-controlled 1x WAN activity (blue), gpio-controlled - Power : 12 VDC, 1 A Installation ------------ 1. Connect to the router using ssh (user: admin, pass: web interface password) 2. Make mtd backup: cat /dev/mtd0 | gzip -1 -c > /tmp/mtd0_spi0.0.bin.gz cat /dev/mtd1 | gzip -1 -c > /tmp/mtd1_BL2.bin.gz cat /dev/mtd2 | gzip -1 -c > /tmp/mtd2_u-boot-env.bin.gz cat /dev/mtd3 | gzip -1 -c > /tmp/mtd3_Factory.bin.gz cat /dev/mtd4 | gzip -1 -c > /tmp/mtd4_FIP.bin.gz cat /dev/mtd5 | gzip -1 -c > /tmp/mtd5_ubi.bin.gz 3. Download mtd backup from the /tmp dir of the router to your PC using scp protocol 4. Upload OpenWrt 'bl31-uboot.fip', 'preloader.bin' images to the /tmp dir of the router using scp protocol 5. Write FIP and BL2 (replace bootloader): mtd write /tmp/openwrt-mediatek-filogic-netis_nx31-bl31-uboot.fip FIP mtd write /tmp/openwrt-mediatek-filogic-netis_nx31-preloader.bin BL2 6. Place OpenWrt 'openwrt-mediatek-filogic-netis_nx31-initramfs-recovery.itb' image on the tftp server (IP: 192.168.1.254) 7. Erase 'ubi' partition and reboot the router: mtd erase ubi reboot 8. U-Boot automatically boot OpenWrt recovery image from tftp server to the RAM 9. Upload OpenWrt 'sysupgrade.itb' image to the /tmp dir of the router (IP: 192.168.1.1) using scp protocol 10. Connect to the router using ssh and run: sysupgrade -n openwrt-mediatek-filogic-netis_nx31-squashfs-sysupgrade.itb Return to stock --------------- 1. Unpack stock BL2 and FIP partitions backup 2. Upload stock BL2 and FIP partitions backup to the /tmp dir of the router using scp protocol 3. Connect to the router using ssh and run: apk update && apk add kmod-mtd-rw insmod mtd-rw i_want_a_brick=1 mtd unlock BL2 mtd unlock FIP 4. Restore backup: mtd write /tmp/mtd4_FIP.bin FIP mtd write /tmp/mtd1_BL2.bin BL2 5. Erase ubi and reboot: mtd erase ubi reboot 6. Power off the router 7. Press Reset button and power on the router. Release the button after ~10 sec 8. Navigate to U-Boot recovery web server (http://192.168.1.1/) and upload the OEM firmware Recovery -------- 1. Place OpenWrt 'openwrt-mediatek-filogic-netis_nx31-initramfs-recovery.itb' image on the tftp server (IP: 192.168.1.254) 2. Press “Reset” button and power on the router. After ~10 sec release the button. 3. Use OpenWrt initramfs system for recovery MAC addresses ------------- +---------+-------------------+-----------+ | | MAC | Algorithm | +---------+-------------------+-----------+ | LAN | dc:xx:xx:d1:xx:18 | label | | WAN | dc:xx:xx:d1:xx:1a | label+2 | | WLAN 2g | de:xx:xx:11:xx:19 | | | WLAN 5g | de:xx:xx:71:xx:19 | | +---------+-------------------+-----------+ The LAN MAC was found in 'Factory', 0x1fef20 The WAN MAC was found in 'Factory', 0x1fef26 The WLAN 2g/5g MAC prototype was found in 'Factory', 0x4 Signed-off-by: Mikhail Zhilkin Link: https://github.com/openwrt/openwrt/pull/18324 (cherry picked from commit d8002cb627edcbef27dedf9768a45ab0435ac55e) Signed-off-by: Mikhail Zhilkin Link: https://github.com/openwrt/openwrt/pull/18438 Signed-off-by: Hauke Mehrtens --- .../uboot-envtools/files/mediatek_filogic | 1 + package/boot/uboot-mediatek/Makefile | 13 + .../patches/445-add-netis-nx31.patch | 334 ++++++++++++++++++ .../linux/mediatek/dts/mt7981b-netis-nx31.dts | 301 ++++++++++++++++ .../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 | 8 + .../base-files/lib/upgrade/platform.sh | 1 + target/linux/mediatek/image/filogic.mk | 25 ++ 9 files changed, 687 insertions(+) create mode 100644 package/boot/uboot-mediatek/patches/445-add-netis-nx31.patch create mode 100644 target/linux/mediatek/dts/mt7981b-netis-nx31.dts diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index 67363b0f422709..b43a5dcfcd7af9 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -39,6 +39,7 @@ h3c,magic-nx30-pro|\ jcg,q30-pro|\ mercusys,mr90x-v1-ubi|\ netcore,n60|\ +netis,nx31|\ nokia,ea0326gmp|\ qihoo,360t7|\ routerich,ax3000-ubootmod|\ diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile index b1285f9ca3722c..c7f47a70c011f8 100644 --- a/package/boot/uboot-mediatek/Makefile +++ b/package/boot/uboot-mediatek/Makefile @@ -315,6 +315,18 @@ define U-Boot/mt7981_jcg_q30-pro DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3 endef +define U-Boot/mt7981_netis_nx31 + NAME:=netis NX31 + BUILD_SUBTARGET:=filogic + BUILD_DEVICES:=netis_nx31 + UBOOT_CONFIG:=mt7981_netis_nx31 + 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_nokia_ea0326gmp NAME:=Nokia EA0326GMP BUILD_SUBTARGET:=filogic @@ -852,6 +864,7 @@ UBOOT_TARGETS := \ mt7981_glinet_gl-xe3000 \ mt7981_h3c_magic-nx30-pro \ mt7981_jcg_q30-pro \ + mt7981_netis_nx31 \ mt7981_nokia_ea0326gmp \ mt7981_openwrt_one-snand \ mt7981_openwrt_one-nor \ diff --git a/package/boot/uboot-mediatek/patches/445-add-netis-nx31.patch b/package/boot/uboot-mediatek/patches/445-add-netis-nx31.patch new file mode 100644 index 00000000000000..55a94189d30687 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/445-add-netis-nx31.patch @@ -0,0 +1,334 @@ +--- /dev/null ++++ b/configs/mt7981_netis_nx31_defconfig +@@ -0,0 +1,106 @@ ++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-netis_nx31" ++CONFIG_OF_LIBFDT_OVERLAY=y ++CONFIG_TARGET_MT7981=y ++CONFIG_SYS_LOAD_ADDR=0x46000000 ++CONFIG_PRE_CON_BUF_ADDR=0x4007ef00 ++CONFIG_DEBUG_UART_BASE=0x11002000 ++CONFIG_DEBUG_UART_CLOCK=40000000 ++CONFIG_DEBUG_UART=y ++CONFIG_FIT=y ++CONFIG_BOOTDELAY=30 ++CONFIG_AUTOBOOT_KEYED=y ++CONFIG_AUTOBOOT_MENU_SHOW=y ++CONFIG_DEFAULT_FDT_FILE="mediatek/mt7981-netis_nx31.dtb" ++CONFIG_LOGLEVEL=7 ++CONFIG_PRE_CONSOLE_BUFFER=y ++CONFIG_LOG=y ++CONFIG_BOARD_LATE_INIT=y ++CONFIG_HUSH_PARSER=y ++CONFIG_SYS_PROMPT="MT7981> " ++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_GPT=y ++CONFIG_CMD_MTD=y ++CONFIG_CMD_PART=y ++CONFIG_CMD_TFTPSRV=y ++CONFIG_CMD_RARP=y ++CONFIG_CMD_CDP=y ++CONFIG_CMD_SNTP=y ++CONFIG_CMD_LINK_LOCAL=y ++CONFIG_CMD_DHCP=y ++CONFIG_CMD_DNS=y ++CONFIG_CMD_PING=y ++CONFIG_CMD_PXE=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_CMD_UBI=y ++CONFIG_CMD_UBI_RENAME=y ++CONFIG_OF_EMBED=y ++CONFIG_ENV_OVERWRITE=y ++CONFIG_ENV_IS_IN_UBI=y ++CONFIG_SYS_REDUNDAND_ENVIRONMENT=y ++CONFIG_ENV_UBI_PART="ubi" ++CONFIG_ENV_UBI_VOLUME="ubootenv" ++CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2" ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_USE_DEFAULT_ENV_FILE=y ++CONFIG_DEFAULT_ENV_FILE="defenvs/netis_nx31_env" ++CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y ++CONFIG_VERSION_VARIABLE=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_NET_RANDOM_ETHADDR=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_MMC is not set ++CONFIG_MTD=y ++CONFIG_DM_MTD=y ++CONFIG_MTD_SPI_NAND=y ++CONFIG_MTD_UBI_FASTMAP=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_MT7981=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_RAM=y ++CONFIG_DM_SERIAL=y ++CONFIG_SERIAL_RX_BUFFER=y ++CONFIG_MTK_SERIAL=y ++CONFIG_SPI=y ++CONFIG_DM_SPI=y ++CONFIG_MTK_SPIM=y ++CONFIG_ZSTD=y ++CONFIG_HEXDUMP=y +--- /dev/null ++++ b/arch/arm/dts/mt7981-netis_nx31.dts +@@ -0,0 +1,162 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (c) 2025 ++ * Author: Mikhail Zhilkin ++ */ ++ ++/dts-v1/; ++#include "mt7981.dtsi" ++#include ++#include ++ ++/ { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ model = "netis NX31"; ++ compatible = "netis,nx31", "mediatek,mt7981"; ++ ++ chosen { ++ stdout-path = &uart0; ++ tick-timer = &timer0; ++ }; ++ ++ memory@40000000 { ++ device_type = "memory"; ++ reg = <0x40000000 0x10000000>; ++ }; ++ ++ keys { ++ compatible = "gpio-keys"; ++ ++ button-0 { ++ label = "mesh"; ++ linux,code = ; ++ gpios = <&gpio 1 GPIO_ACTIVE_LOW>; ++ }; ++ ++ button-1 { ++ label = "reset"; ++ linux,code = ; ++ gpios = <&gpio 1 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ led-0 { ++ label = "blue:wlan2g"; ++ gpios = <&gpio 5 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-1 { ++ label = "blue:status"; ++ gpios = <&gpio 7 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-2 { ++ label = "blue:wan"; ++ gpios = <&gpio 8 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-3 { ++ label = "blue:wlan5g"; ++ gpios = <&gpio 34 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 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 = ; ++ }; ++ }; ++}; ++ ++&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 = "u-boot-env (unused)"; ++ reg = <0x100000 0x80000>; ++ }; ++ ++ partition@160000 { ++ label = "Factory"; ++ reg = <0x180000 0x200000>; ++ }; ++ ++ partition@380000 { ++ label = "FIP"; ++ reg = <0x380000 0x200000>; ++ }; ++ ++ partition@580000 { ++ label = "ubi"; ++ reg = <0x580000 0x7a80000>; ++ }; ++ }; ++ }; ++}; ++ ++&watchdog { ++ status = "disabled"; ++}; +--- /dev/null ++++ b/defenvs/netis_nx31_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=run check_buttons ; if pstore check ; then run boot_recovery ; else run boot_ubi ; fi ++bootconf=config-1 ++bootdelay=0 ++bootfile=openwrt-mediatek-filogic-netis_nx31-initramfs-recovery.itb ++bootfile_bl2=openwrt-mediatek-filogic-netis_nx31-preloader.bin ++bootfile_fip=openwrt-mediatek-filogic-netis_nx31-bl31-uboot.fip ++bootfile_upg=openwrt-mediatek-filogic-netis_nx31-squashfs-sysupgrade.itb ++bootled_status=blue: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_status on ; 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_status on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led bootled_status off ++boot_recovery=led $bootled_status on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led bootled_status off ++boot_ubi=run boot_production ; run boot_recovery ; run boot_tftp_forever ++boot_tftp_forever=led $bootled_status on ; while true ; do run boot_tftp ; 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 ++check_buttons=if button reset ; then run boot_tftp ; fi ++ethaddr_factory=mtd read Factory 0x40080000 0x1e0000 0x20000 && env readmem -b ethaddr 0x4009ef20 0x6 ; setenv ethaddr_factory ++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 || run ubi_format ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic || 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 && ubi write $loadaddr fit $filesize ++ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize ++_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" diff --git a/target/linux/mediatek/dts/mt7981b-netis-nx31.dts b/target/linux/mediatek/dts/mt7981b-netis-nx31.dts new file mode 100644 index 00000000000000..82f666df7944ea --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-netis-nx31.dts @@ -0,0 +1,301 @@ +// SPDX-License-Identifier: GPL-2.0-only OR MIT + +/dts-v1/; +#include +#include +#include + +#include "mt7981.dtsi" + +/ { + model = "netis NX31"; + compatible = "netis,nx31", "mediatek,mt7981"; + + aliases { + label-mac-device = &gmac0; + + led-boot = &led_status_blue; + led-failsafe = &led_status_blue; + led-running = &led_status_blue; + led-upgrade = &led_status_blue; + + serial0 = &uart0; + }; + + chosen { + rootdisk = <&ubi_fit_volume>; + stdout-path = "serial0:115200n8"; + }; + + gpio-keys { + compatible = "gpio-keys"; + + button-0 { + label = "mesh"; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + linux,code = ; + 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_2GHZ; + gpios = <&pio 5 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + led_status_blue: led-1 { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&pio 7 GPIO_ACTIVE_LOW>; + }; + + led-2 { + color = ; + function = LED_FUNCTION_WAN; + gpios = <&pio 8 GPIO_ACTIVE_LOW>; + }; + + led-3 { + color = ; + function = LED_FUNCTION_WLAN_5GHZ; + gpios = <&pio 34 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + }; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_factory_1fef20 0>; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + 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_factory_1fef26 0>; + }; +}; + +&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 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spi-nand"; + reg = <0>; + + spi-max-frequency = <52000000>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <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>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "BL2"; + reg = <0x0 0x100000>; + read-only; + }; + + partition@100000 { + label = "u-boot-env (unused)"; + reg = <0x100000 0x80000>; + read-only; + }; + + 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>; + }; + + macaddr_factory_1fef20: macaddr@1fef20 { + compatible = "mac-base"; + reg = <0x1fef20 0x6>; + #nvmem-cell-cells = <1>; + }; + + macaddr_factory_1fef26: macaddr@1fef26 { + compatible = "mac-base"; + reg = <0x1fef26 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + + partition@380000 { + label = "FIP"; + reg = <0x380000 0x200000>; + read-only; + }; + + partition@580000 { + label = "ubi"; + reg = <0x580000 0x7a80000>; + compatible = "linux,ubi"; + + volumes { + ubi_fit_volume: ubi-volume-fit { + volname = "fit"; + }; + + ubi_ubootenv: ubi-volume-ubootenv { + volname = "ubootenv"; + }; + + ubi_ubootenv2: ubi-volume-ubootenv2 { + volname = "ubootenv2"; + }; + }; + }; + }; + }; +}; + +&switch { + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@1 { + reg = <1>; + label = "lan3"; + }; + + port@2 { + reg = <2>; + label = "lan2"; + }; + + port@3 { + reg = <3>; + label = "lan1"; + }; + + 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"; +}; + +&ubi_ubootenv { + nvmem-layout { + compatible = "u-boot,env-redundant-bool"; + }; +}; + +&ubi_ubootenv2 { + nvmem-layout { + compatible = "u-boot,env-redundant-bool"; + }; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + status = "okay"; + nvmem-cell-names = "eeprom"; + nvmem-cells = <&eeprom_factory_0>; +}; 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 c2d9971f6f181b..73d91ee244103a 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 @@ -59,6 +59,9 @@ mercusys,mr90x-v1-ubi) netgear,wax220) ucidef_set_led_netdev "eth0" "LAN" "green:lan" "eth0" ;; +netis,nx31) + ucidef_set_led_netdev "wan" "wan" "blue:wan" "eth1" "link tx rx" + ;; nokia,ea0326gmp) ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth1" "link" ucidef_set_led_netdev "lan" "LAN" "green:lan" "br-lan" "link" 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 6da63168234f35..a97cd37c58781f 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,7 @@ mediatek_setup_interfaces() abt,asr3000|\ cmcc,rax3000m|\ h3c,magic-nx30-pro|\ + netis,nx31|\ nokia,ea0326gmp|\ zbtlink,zbt-z8103ax) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" 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 a9d06f9b846d6f..8b9499b319f43b 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 @@ -128,6 +128,14 @@ 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 ;; + netis,nx31) + addr=$(mtd_get_mac_binary "Factory" 0x4) + addr=$(macaddr_unsetbit $(macaddr_setbit_la $addr) 25) + addr_2g=$(macaddr_unsetbit $(macaddr_unsetbit $addr 26) 27) + addr_5g=$(macaddr_setbit $(macaddr_setbit $addr 26) 27) + [ "$PHYNBR" = "0" ] && echo "$addr_2g" > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && echo "$addr_5g" > /sys${DEVPATH}/macaddress + ;; nokia,ea0326gmp) addr=$(cat /sys/class/net/eth0/address) [ "$PHYNBR" = "0" ] && 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 a13b46d4c1c509..2a8029dd187916 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -80,6 +80,7 @@ platform_do_upgrade() { mediatek,mt7981-rfb|\ mediatek,mt7988a-rfb|\ mercusys,mr90x-v1-ubi|\ + netis,nx31|\ nokia,ea0326gmp|\ openwrt,one|\ netcore,n60|\ diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 0de101df993126..248593ede78ae6 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -1257,6 +1257,31 @@ define Device/netgear_wax220 endef TARGET_DEVICES += netgear_wax220 +define Device/netis_nx31 + DEVICE_VENDOR := netis + DEVICE_MODEL := NX31 + DEVICE_DTS := mt7981b-netis-nx31 + 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-mt7915e 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 netis_nx31 +endef +TARGET_DEVICES += netis_nx31 + define Device/nokia_ea0326gmp DEVICE_VENDOR := Nokia DEVICE_MODEL := EA0326GMP From d47f6a365fff307058f17bef94d89009ad482273 Mon Sep 17 00:00:00 2001 From: Fil Dunsky Date: Tue, 11 Mar 2025 06:57:43 +0700 Subject: [PATCH 602/877] mediatek: filogic: add support for Huasifei WH3000 **Huasifei WH3000 eMMC / Fudy MT3000** Portable Wi-Fi 6 travel router based on MediaTek MT7981A SoC. MT7981B+MT7976CN+RTL8221B Dual Core 1.3GHZ **Specifications** SoC: Filogic 820 MT7981A (1.3GHz) RAM: DDR4 1GB Flash: eMMC 8GB WiFi: 2.4GHz and 5GHz with 3 antennas Ethernet: 1x WAN (10/100/1000M) 1x LAN (10/100/1000/2500M) USB: 1x USB 3.0 port Two buttons: power/reset and mode (BTN_0) LEDS: blue, red, blue+red=pink UART: 3.3V, TX, RX, GND / 115200 8N1 **Installation via U-Boot rescue** 1. Set static IP 192.168.1.2 on your computer and default route as 192.168.1.1 2. Connect to the WAN port and hold the reset button while booting the device. 3. Wait for the LED to blink 5 times, and release the reset button. 4. Open U-boot web page on your browser at http://192.168.1.1 5. Select the OpenWRT sysupgrade image, upload it, and start the upgrade. 6. Wait for the router to flash the new firmware. 7. Wait for the router to reboot itself. **Installation via sysupgrade** Just flash sysupgrade file via [LuCI upgrade page](http://192.168.1.1/cgi-bin/luci/admin/system/flash) without saving the settings. **Installation via SSH** Upload the file to the router `/tmp` directory, `ssh root@192.168.1.1` and issue a command: ``` sysupgrade -n /tmp/openwrt-mediatek-filogic-huasifei_wh3000-emmc-squashfs-sysupgrade.bin ``` **Factory MAC** You can find your Factory MAC which is mentioned on the box at `/dev/mmcblck0p2` partition `factory` starting from `0x4` ``` dd if=/dev/mmcblk0p2 bs=1 skip=4 count=6 | hexdump -C ``` **Enlarging a partition** Though device has 8GB eMMC, it uses only 2GB `/dev/mmcblck0p6` as `rootfs` for `/rom` and `/overlay` leaving `/dev/mmcblck0p7` as empty unused space. ``` sgdisk -p /dev/mmcblk0 ``` ``` Disk /dev/mmcblk0: 15269888 sectors, 7.3 GiB Sector size (logical/physical): 512/512 bytes Disk identifier (GUID): 2BD17853-102B-4500-AA1A-8A21D4D7984D Partition table holds up to 128 entries Main partition table begins at sector 2 and ends at sector 33 First usable sector is 34, last usable sector is 14942174 Partitions will be aligned on 1024-sector boundaries Total free space is 11197 sectors (5.5 MiB) Number Start (sector) End (sector) Size Code Name 1 8192 9215 512.0 KiB 8300 u-boot-env 2 9216 13311 2.0 MiB 8300 factory 3 13312 21503 4.0 MiB 8300 fip 4 21504 29695 4.0 MiB 8300 config 5 29696 62463 16.0 MiB 8300 kernel 6 62464 4256767 2.0 GiB 8300 rootfs 7 4257792 14940159 5.1 GiB 8300 ``` You can fix that by loading into `initramfs-kernel`, deleting empty `mmcblck0p7` partition and resizing `mmcblck0p6` ``` sysupgrade -F /tmp/openwrt-initramfs-kernel.bin ``` Install and run cfdisk ``` opkg update && opkg install cfdisk cfdisk /dev/mmcblck0 ``` - Select `mmcblck0p7` -> Delete - Select `mmcblck0p6` -> Resize -> Write -> yes -> Quit You will not see any difference in `cat /proc/partitions` after that but just flash a `sysupgrade` and you'll get the whole 7.3GB space for the `/overlay`. Co-developed-by: hecatae Signed-off-by: Fil Dunsky Link: https://github.com/openwrt/openwrt/pull/18220 (cherry picked from commit 99ea96c297305c632a23e966df6aea1bfac241f9) Link: https://github.com/openwrt/openwrt/pull/18434 Signed-off-by: Hauke Mehrtens --- .../uboot-envtools/files/mediatek_filogic | 3 +- .../mediatek/dts/mt7981b-huasifei-wh3000.dts | 190 ++++++++++++++++++ .../filogic/base-files/etc/board.d/01_leds | 3 + .../filogic/base-files/etc/board.d/02_network | 3 +- .../base-files/lib/upgrade/platform.sh | 2 + target/linux/mediatek/image/filogic.mk | 15 ++ 6 files changed, 214 insertions(+), 2 deletions(-) create mode 100644 target/linux/mediatek/dts/mt7981b-huasifei-wh3000.dts diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index b43a5dcfcd7af9..add5dbb3d30ac8 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -59,7 +59,8 @@ acer,vero-w6m|\ glinet,gl-mt2500|\ glinet,gl-mt6000|\ glinet,gl-x3000|\ -glinet,gl-xe3000) +glinet,gl-xe3000|\ +huasifei,wh3000) local envdev=$(find_mmc_part "u-boot-env") ubootenv_add_uci_config "$envdev" "0x0" "0x80000" ;; diff --git a/target/linux/mediatek/dts/mt7981b-huasifei-wh3000.dts b/target/linux/mediatek/dts/mt7981b-huasifei-wh3000.dts new file mode 100644 index 00000000000000..c12367b84afbda --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-huasifei-wh3000.dts @@ -0,0 +1,190 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include +#include +#include + +#include "mt7981.dtsi" + +/ { + model = "Huasifei WH3000"; + compatible = "huasifei,wh3000", "mediatek,mt7981"; + + aliases { + serial0 = &uart0; + led-boot = &wlan_led; + led-failsafe = &wlan_led; + led-upgrade = &wlan_led; + }; + + chosen { + bootargs = "root=PARTLABEL=rootfs rootwait"; + stdout-path = "serial0:115200n8"; + }; + + gpio-keys { + compatible = "gpio-keys"; + + button-mode { + label = "mode"; + linux,code = ; + linux,input-type = ; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + button-reset { + label = "reset"; + linux,code = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + wan_led: led-0 { + function = LED_FUNCTION_WAN; + color = ; + gpios = <&pio 11 GPIO_ACTIVE_LOW>; + }; + + wlan_led: led-1 { + function = LED_FUNCTION_WLAN; + color = ; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + }; + + memory@40000000 { + reg = <0 0x40000000 0 0x40000000>; + }; +}; + +ð { + pinctrl-names = "default"; + pinctrl-0 = <&mdio_pins>; + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + nvmem-cells = <&macaddr_factory_4 2>; + nvmem-cell-names = "mac-address"; + phy-mode = "2500base-x"; + phy-handle = <&phy1>; + }; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + nvmem-cells = <&macaddr_factory_4 3>; + nvmem-cell-names = "mac-address"; + phy-mode = "gmii"; + phy-handle = <&int_gbe_phy>; + }; +}; + +&mdio_bus { + phy1: ethernet-phy@1 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <1>; + interrupts = <38 IRQ_TYPE_LEVEL_LOW>; + interrupt-parent = <&pio>; + reset-assert-us = <100000>; + reset-deassert-us = <100000>; + reset-gpios = <&pio 39 GPIO_ACTIVE_LOW>; + realtek,aldps-enable; + }; +}; + +&mmc0 { + bus-width = <8>; + cap-mmc-highspeed; + max-frequency = <52000000>; + 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"; + + card@0 { + compatible = "mmc-card"; + reg = <0>; + + block { + compatible = "block-device"; + + partitions { + block-partition-factory { + partname = "factory"; + + 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>; + }; + }; + }; + }; + }; + }; +}; + +&pio { + mmc0_pins_default: mmc0-pins-default { + mux { + function = "flash"; + groups = "emmc_45"; + }; + }; + + mmc0_pins_uhs: mmc0-pins-uhs { + mux { + function = "flash"; + groups = "emmc_45"; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; + status = "okay"; + + band@1 { + reg = <1>; + nvmem-cells = <&macaddr_factory_4 1>; + nvmem-cell-names = "mac-address"; + }; +}; + +&xhci { + 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 73d91ee244103a..840072a556257a 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 @@ -49,6 +49,9 @@ glinet,gl-xe3000) ucidef_set_led_netdev "wlan2g" "WLAN2G" "green:wifi2g" "phy0-ap0" ucidef_set_led_netdev "wlan5g" "WLAN5G" "green:wifi5g" "phy1-ap0" ;; +huasifei,wh3000) + ucidef_set_led_netdev "wan" "WAN" "red:wan" "eth1" "link tx rx" + ;; mercusys,mr90x-v1|\ mercusys,mr90x-v1-ubi) ucidef_set_led_netdev "lan-0" "lan-0" "green:lan-0" "lan0" "link tx rx" 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 a97cd37c58781f..7d9610d62c6057 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 @@ -64,7 +64,8 @@ mediatek_setup_interfaces() ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 sfp2" "eth1 wan" ;; bananapi,bpi-r3-mini|\ - edgecore,eap111) + edgecore,eap111|\ + huasifei,wh3000) ucidef_set_interfaces_lan_wan eth0 eth1 ;; bananapi,bpi-r4|\ 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 2a8029dd187916..89aeaadedb2db3 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -104,6 +104,7 @@ platform_do_upgrade() { glinet,gl-mt6000|\ glinet,gl-x3000|\ glinet,gl-xe3000|\ + huasifei,wh3000|\ smartrg,sdg-8612|\ smartrg,sdg-8614|\ smartrg,sdg-8622|\ @@ -220,6 +221,7 @@ platform_copy_config() { glinet,gl-mt6000|\ glinet,gl-x3000|\ glinet,gl-xe3000|\ + huasifei,wh3000|\ jdcloud,re-cp-03|\ smartrg,sdg-8612|\ smartrg,sdg-8614|\ diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 248593ede78ae6..60f45a73e674c9 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -925,6 +925,21 @@ define Device/h3c_magic-nx30-pro endef TARGET_DEVICES += h3c_magic-nx30-pro +define Device/huasifei_wh3000 + DEVICE_VENDOR := Huasifei + DEVICE_MODEL := WH3000 + DEVICE_DTS := mt7981b-huasifei-wh3000 + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware \ + kmod-usb3 f2fsck mkf2fs + SUPPORTED_DEVICES += huasifei,wh3000-emmc + 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 += huasifei_wh3000 + define Device/jcg_q30-pro DEVICE_VENDOR := JCG DEVICE_MODEL := Q30 PRO From 7145b85295b9b593c474028364d3f573d1c838b3 Mon Sep 17 00:00:00 2001 From: Mieczyslaw Nalewaj Date: Sun, 6 Apr 2025 18:33:59 +0200 Subject: [PATCH 603/877] kernel: modules: ixgbe,ixgbevf,i40e: remove unused settings and depends Remove settings and depends that are not used anywhere. Signed-off-by: Mieczyslaw Nalewaj Link: #18291 (cherry picked from commit b6ff3d9afa0ff8e9ae68812ac7aa6f9be168db95) Link: https://github.com/openwrt/openwrt/pull/18431 Signed-off-by: Hauke Mehrtens --- package/kernel/linux/modules/netdevices.mk | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk index 86ca7c93a1e5d1..32499e2e5e3193 100644 --- a/package/kernel/linux/modules/netdevices.mk +++ b/package/kernel/linux/modules/netdevices.mk @@ -1098,7 +1098,6 @@ define KernelPackage/ixgbe TITLE:=Intel(R) 82598/82599 PCI-Express 10 Gigabit Ethernet support DEPENDS:=@PCI_SUPPORT +kmod-mdio +kmod-ptp +kmod-hwmon-core +kmod-libphy +kmod-mdio-devres KCONFIG:=CONFIG_IXGBE \ - CONFIG_IXGBE_VXLAN=n \ CONFIG_IXGBE_HWMON=y \ CONFIG_IXGBE_DCA=n FILES:=$(LINUX_DIR)/drivers/net/ethernet/intel/ixgbe/ixgbe.ko @@ -1117,7 +1116,6 @@ define KernelPackage/ixgbevf TITLE:=Intel(R) 82599 Virtual Function Ethernet support DEPENDS:=@PCI_SUPPORT +kmod-ixgbe KCONFIG:=CONFIG_IXGBEVF \ - CONFIG_IXGBE_VXLAN=n \ CONFIG_IXGBE_HWMON=y \ CONFIG_IXGBE_DCA=n FILES:=$(LINUX_DIR)/drivers/net/ethernet/intel/ixgbevf/ixgbevf.ko @@ -1134,10 +1132,8 @@ $(eval $(call KernelPackage,ixgbevf)) define KernelPackage/i40e SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Intel(R) Ethernet Controller XL710 Family support - DEPENDS:=@PCI_SUPPORT +kmod-mdio +kmod-ptp +kmod-hwmon-core +kmod-libphy + DEPENDS:=@PCI_SUPPORT +kmod-ptp KCONFIG:=CONFIG_I40E \ - CONFIG_I40E_VXLAN=n \ - CONFIG_I40E_HWMON=y \ CONFIG_I40E_DCA=n FILES:=$(LINUX_DIR)/drivers/net/ethernet/intel/i40e/i40e.ko AUTOLOAD:=$(call AutoProbe,i40e) From 30c1c6d7c31e031aea1d4dc082c8d137f5653a0a Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sat, 29 Mar 2025 00:00:50 +0800 Subject: [PATCH 604/877] ath10k-ct: silence some harmless noisy logs Users feel anxious about some ath10k driver logs. After further investigation, in fact these logs are harmless. Only developers need to care about them in order to optimize some parameters. Let's just silence them to reduce these similar user reports. Closes: https://github.com/openwrt/openwrt/issues/13148 Closes: https://github.com/openwrt/openwrt/issues/14422 Closes: https://github.com/openwrt/openwrt/issues/15959 Closes: https://github.com/openwrt/openwrt/issues/15997 Closes: https://github.com/openwrt/openwrt/issues/16896 Closes: https://github.com/openwrt/openwrt/issues/18046 Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/18368 Signed-off-by: Robert Marko (cherry picked from commit 88234a03bc645d327016cc807c35972fcb6834eb) [Apply to ath10k-ct 6.10] Signed-off-by: Hauke Mehrtens --- ...e-warning-caused-by-unsupported-retr.patch | 34 +++++++++++++++++++ ...e-noisy-log-caused-by-flushing-queue.patch | 31 +++++++++++++++++ ...k-always-use-mac80211-loss-detection.patch | 2 +- 3 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 package/kernel/ath10k-ct/patches/205-ath10k-ct-silence-warning-caused-by-unsupported-retr.patch create mode 100644 package/kernel/ath10k-ct/patches/206-ath10k-ct-silence-noisy-log-caused-by-flushing-queue.patch diff --git a/package/kernel/ath10k-ct/patches/205-ath10k-ct-silence-warning-caused-by-unsupported-retr.patch b/package/kernel/ath10k-ct/patches/205-ath10k-ct-silence-warning-caused-by-unsupported-retr.patch new file mode 100644 index 00000000000000..9d6b0954ff027f --- /dev/null +++ b/package/kernel/ath10k-ct/patches/205-ath10k-ct-silence-warning-caused-by-unsupported-retr.patch @@ -0,0 +1,34 @@ +From: Shiji Yang +Date: Fri, 28 Mar 2025 20:26:04 +0800 +Subject: [PATCH] ath10k-ct: silence warning caused by unsupported retry_limit + value + +Some retry_limit values are not supported by ath10k wave2 chips. +We can just skip config it for these chips. And it's safe to +return 0 in this case because the hardware is still working. + +Suggested-by: Ben Greear +Signed-off-by: Shiji Yang +--- + ath10k-6.14/mac.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/ath10k-6.10/mac.c ++++ b/ath10k-6.10/mac.c +@@ -5395,7 +5395,7 @@ static int ath10k_config_retry_limit(str + */ + ath10k_warn(ar, "Firmware lacks feature flag indicating a retry limit of > 2 is OK, requested limit: %d\n", + limit); +- return -EINVAL; ++ goto skip_retry_limit; + } + + list_for_each_entry(arvif, &ar->arvifs, list) { +@@ -5406,6 +5406,7 @@ static int ath10k_config_retry_limit(str + } + } + ++skip_retry_limit: + return ret; + } + diff --git a/package/kernel/ath10k-ct/patches/206-ath10k-ct-silence-noisy-log-caused-by-flushing-queue.patch b/package/kernel/ath10k-ct/patches/206-ath10k-ct-silence-noisy-log-caused-by-flushing-queue.patch new file mode 100644 index 00000000000000..8b8042e5d701d8 --- /dev/null +++ b/package/kernel/ath10k-ct/patches/206-ath10k-ct-silence-noisy-log-caused-by-flushing-queue.patch @@ -0,0 +1,31 @@ +From: Shiji Yang +Date: Fri, 28 Mar 2025 21:02:27 +0800 +Subject: [PATCH] ath10k-ct: silence noisy log caused by flushing queue + +.flush() is a regular mac80211 operation aims to clear all pending +frames from the hardware queue. Only developers need to care about it. + +Signed-off-by: Shiji Yang +--- + ath10k-6.14/mac.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/ath10k-6.10/mac.c ++++ b/ath10k-6.10/mac.c +@@ -9061,12 +9061,12 @@ static void ath10k_flush(struct ieee8021 + if (vif) { + arvif = (void *)vif->drv_priv; + vid = arvif->vdev_id; +- ath10k_info(ar, "mac flush vdev %d drop %d queues 0x%x ar->paused: 0x%lx arvif->paused: 0x%lx\n", +- arvif->vdev_id, drop, queues, ar->tx_paused, arvif->tx_paused); ++ ath10k_dbg(ar, ATH10K_DBG_MAC, "mac flush vdev %d drop %d queues 0x%x ar->paused: 0x%lx arvif->paused: 0x%lx\n", ++ arvif->vdev_id, drop, queues, ar->tx_paused, arvif->tx_paused); + } + else { +- ath10k_info(ar, "mac flush null vif, drop %d queues 0x%x\n", +- drop, queues); ++ ath10k_dbg(ar, ATH10K_DBG_MAC, "mac flush null vif, drop %d queues 0x%x\n", ++ drop, queues); + } + + 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 index 35026cc0f943d5..1f9f38c2b04dae 100644 --- 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 @@ -18,7 +18,7 @@ Signed-off-by: David Bauer --- a/ath10k-6.10/mac.c +++ b/ath10k-6.10/mac.c -@@ -11316,7 +11316,6 @@ int ath10k_mac_register(struct ath10k *a +@@ -11317,7 +11317,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); From ced823497ade50b4997fcb08d3671830e05ee8df Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 2 Apr 2025 08:10:29 +0800 Subject: [PATCH 605/877] ath10k-ct: remove "qcom,coexist-support" property type hack The ath10k dt-binding property "qcom,coexist-support" was explicitly defined as type uint8 since upstream commit ed09c61eb19d ("dt-bindings: net: Convert ath10k to YAML"). Therefore, this hack patch no longer makes sense. Link: https://github.com/torvalds/linux/commit/ed09c61eb19d9889780c791cb316ac76468f5186 Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/18393 Signed-off-by: Robert Marko (cherry picked from commit da13174aa1736f571a808173a1e8159202d7af95) --- ...k-read-qcom-coexist-support-as-a-u32.patch | 60 ------------------- 1 file changed, 60 deletions(-) delete mode 100644 package/kernel/ath10k-ct/patches/130-ath10k-read-qcom-coexist-support-as-a-u32.patch diff --git a/package/kernel/ath10k-ct/patches/130-ath10k-read-qcom-coexist-support-as-a-u32.patch b/package/kernel/ath10k-ct/patches/130-ath10k-read-qcom-coexist-support-as-a-u32.patch deleted file mode 100644 index 61090a49d0e44f..00000000000000 --- a/package/kernel/ath10k-ct/patches/130-ath10k-read-qcom-coexist-support-as-a-u32.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 630df9786fdaeb78c21f1e28c9b70ac83a1b482c Mon Sep 17 00:00:00 2001 -From: Vincent Tremblay -Date: Sat, 31 Dec 2022 09:24:00 -0500 -Subject: [PATCH] ath10k: read qcom,coexist-support as a u32 - -Read qcom,coexist-support as a u32 instead of a u8 - -When we set the property to <1> in the DT (as specified in the doc), -"of_property_read_u8" read 0 instead of 1. This is because of the data format. - -By default <1> is written with 32 bits. -The problem is that the driver is trying to read a u8. - -The difference can be visualized using hexdump in a running device: -Default 32 bits output: -======================= -0000000 0000 0100 -0000004 - -8 bits output: -============== -0000000 0001 -0000001 - -By changing "of_property_read_u8" by "of_property_read_u32", the driver -is aligned with the documentation and is able to read the value without -modifying the DT. - -The other solution would be to force the value in the DT to be saved as -an 8 bits value (qcom,coexist-support = /bits/ 8 <1>), -which is against the doc and less intuitive. - -Validation: -=========== -The patch was tested on a real device and we can see in the debug logs -that the feature is properly initialized: - -[ 109.102097] ath10k_ahb a000000.wifi: boot coex_support 1 coex_gpio_pin 52 - -Signed-off-by: Vincent Tremblay - ---- a/ath10k-6.10/core.c -+++ b/ath10k-6.10/core.c -@@ -2871,14 +2871,14 @@ done: - static void ath10k_core_fetch_btcoex_dt(struct ath10k *ar) - { - struct device_node *node; -- u8 coex_support = 0; -+ u32 coex_support = 0; - int ret; - - node = ar->dev->of_node; - if (!node) - goto out; - -- ret = of_property_read_u8(node, "qcom,coexist-support", &coex_support); -+ ret = of_property_read_u32(node, "qcom,coexist-support", &coex_support); - if (ret) { - ar->coex_support = true; - goto out; From 31c3ab3b458c058eeac06e8b83355b1564ee321c Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 2 Apr 2025 08:10:29 +0800 Subject: [PATCH 606/877] ipq40xx: dts: fix "qcom,coexist-support" property type Convert the property variable type of "qcom,coexist-support" from u32 to u8 to match the definition in the dt-bindings document. Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/18393 Signed-off-by: Robert Marko (cherry picked from commit 3526dbabdc63c6ac8a932333ab989d1f99b6945b) --- .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-whw03.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-whw03.dtsi b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-whw03.dtsi index 6c9eaadd77078d..9da7e44547d270 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-whw03.dtsi +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-whw03.dtsi @@ -274,7 +274,7 @@ pinctrl-0 = <&wifi_0_pins>; pinctrl-names = "default"; - qcom,coexist-support = <1>; + qcom,coexist-support = /bits/ 8 <1>; qcom,coexist-gpio-pin = <52>; }; From 3f00d6ba01036bee3572b805f1b1e1acff817f91 Mon Sep 17 00:00:00 2001 From: Ming Kuang Date: Fri, 21 Mar 2025 23:21:05 +0800 Subject: [PATCH 607/877] wifi-scripts: mac80211.sh: add EHT and HE160 support to iw_htmode For WIFI7 devices (such as mt7925e), the dev width is currently always "20 MHz (no HT)" in monitor mode. Add EHT and HE160 support to iw_htmode to fix this issue. Additionally, the following changes are made: 1. Set iw_htmode to 160MHz for VHT160. The reason for the current VHT160 setting is unclear and seems to have been in place for over a decade (ibss_htmode [1]). If anyone knows its impact, please inform me so I can restore it. 2. Modify MHZ to MHz. The original matching table in the current iw tool uses MHz. Although the match is case-insensitive, correcting this won't hurt. [1]: https://github.com/openwrt/openwrt/commit/768d09be8781228d3553142c0f1e1231c6aacc7c Signed-off-by: Ming Kuang Link: https://github.com/openwrt/openwrt/pull/18319 Signed-off-by: Hauke Mehrtens (cherry picked from commit 86eb1c0b5add1e0b493b25508c45b2df9d722c78) --- .../files/lib/netifd/wireless/mac80211.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh index b4aa19bf526ec2..059fd9b8c8a50d 100755 --- a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh +++ b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh @@ -740,8 +740,10 @@ mac80211_prepare_vif() { mac80211_prepare_iw_htmode() { case "$htmode" in - VHT20|HT20|HE20) iw_htmode=HT20;; - HT40*|VHT40|VHT160|HE40) + HT20|VHT20|HE20|EHT20) + iw_htmode=HT20 + ;; + HT40*|VHT40|HE40|EHT40) case "$band" in 2g) case "$htmode" in @@ -765,8 +767,11 @@ mac80211_prepare_iw_htmode() { esac [ "$auto_channel" -gt 0 ] && iw_htmode="HT40+" ;; - VHT80|HE80) - iw_htmode="80MHZ" + VHT80|HE80|EHT80) + iw_htmode="80MHz" + ;; + VHT160|HE160|EHT160) + iw_htmode="160MHz" ;; NONE|NOHT) iw_htmode="NOHT" From eed88d4f10b456355216103b6f57c1c1ad03caff Mon Sep 17 00:00:00 2001 From: Matthias Franck Date: Fri, 31 Jan 2025 10:00:46 +0100 Subject: [PATCH 608/877] busybox: use external libtirpc when using glibc In recent glibc versions rpc functionality has been moved to a separate library instead of glibc itself. Depend on this library when rpc functionality is needed and glibc is used. Signed-off-by: Matthias Franck Link: https://github.com/openwrt/openwrt/pull/17796 Signed-off-by: Hauke Mehrtens (cherry picked from commit 84e090086795a45d5580138436ce74b6170584ab) --- package/utils/busybox/Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile index 7d302bd159f09f..e3b9f256e0c797 100644 --- a/package/utils/busybox/Makefile +++ b/package/utils/busybox/Makefile @@ -48,7 +48,7 @@ define Package/busybox/Default MAINTAINER:=Felix Fietkau TITLE:=Core utilities for embedded Linux URL:=http://busybox.net/ - DEPENDS:=+BUSYBOX_CONFIG_PAM:libpam +BUSYBOX_CONFIG_NTPD:jsonfilter + DEPENDS:=+BUSYBOX_CONFIG_PAM:libpam +BUSYBOX_CONFIG_NTPD:jsonfilter +(USE_GLIBC&&BUSYBOX_CONFIG_FEATURE_MOUNT_NFS)||(USE_GLIBC&&BUSYBOX_CONFIG_FEATURE_INETD_RPC):libtirpc USERID:=ntp=123:ntp=123 endef @@ -104,6 +104,13 @@ ifeq ($(CONFIG_USE_GLIBC),y) LDLIBS += $(call BUSYBOX_IF_ENABLED,NSLOOKUP,resolv) endif +ifneq ($(CONFIG_BUSYBOX_$(BUSYBOX_SYM)_FEATURE_MOUNT_NFS)$(CONFIG_BUSYBOX_$(BUSYBOX_SYM)_FEATURE_INETD_RPC),) +ifndef CONFIG_USE_MUSL + TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include/tirpc + LDLIBS += tirpc +endif +endif + ifeq ($(BUILD_VARIANT),selinux) LDLIBS += selinux sepol endif From b4af5bbcf7f5282cb03632188fb1acf8ca83ecad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Thu, 10 Apr 2025 14:01:33 +0200 Subject: [PATCH 609/877] package: add kmod-r8127 ethernet driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit r8127 is an out of tree driver provided by Realtek for RTL8127 devices. Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 851ea69d8ebf4bdc80b29562123b96cd94387e9e) --- package/kernel/r8127/Makefile | 47 ++++++++ ...127-print-link-speed-and-duplex-mode.patch | 107 ++++++++++++++++++ 2 files changed, 154 insertions(+) create mode 100644 package/kernel/r8127/Makefile create mode 100644 package/kernel/r8127/patches/200-r8127-print-link-speed-and-duplex-mode.patch diff --git a/package/kernel/r8127/Makefile b/package/kernel/r8127/Makefile new file mode 100644 index 00000000000000..bb0c5e0a6ca810 --- /dev/null +++ b/package/kernel/r8127/Makefile @@ -0,0 +1,47 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=r8127 +PKG_VERSION:=11.014.00 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=https://github.com/openwrt/rtl8127/releases/download/$(PKG_VERSION) +PKG_HASH:=f496bc16c32d2e8f9482c57d006604c70d9e8d55b4f1f999b88c602de9104094 + +PKG_BUILD_PARALLEL:=1 +PKG_LICENSE:=GPLv2 +PKG_MAINTAINER:=Alvaro Fernandez Rojas + +include $(INCLUDE_DIR)/kernel.mk +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/r8127 + SUBMENU:=Network Devices + TITLE:=Realtek RTL8127 PCI 10 Gigabit Ethernet driver + DEPENDS:=@PCI_SUPPORT +kmod-libphy + FILES:=$(PKG_BUILD_DIR)/src/r8127.ko + AUTOLOAD:=$(call AutoProbe,r8127) + PROVIDES:=kmod-r8169 + VARIANT:=regular +endef + +define KernelPackage/r8127-rss +$(call KernelPackage/r8127) + CONFLICTS:=kmod-r8127 + TITLE+= (RSS) + VARIANT:=rss +endef + +ifeq ($(BUILD_VARIANT),rss) + PKG_MAKE_FLAGS += ENABLE_RSS_SUPPORT=y +endif + +define Build/Compile + +$(KERNEL_MAKE) $(PKG_JOBS) \ + $(PKG_MAKE_FLAGS) \ + M="$(PKG_BUILD_DIR)/src" \ + modules +endef + +$(eval $(call KernelPackage,r8127)) +$(eval $(call KernelPackage,r8127-rss)) diff --git a/package/kernel/r8127/patches/200-r8127-print-link-speed-and-duplex-mode.patch b/package/kernel/r8127/patches/200-r8127-print-link-speed-and-duplex-mode.patch new file mode 100644 index 00000000000000..2a428207855da2 --- /dev/null +++ b/package/kernel/r8127/patches/200-r8127-print-link-speed-and-duplex-mode.patch @@ -0,0 +1,107 @@ +From 5ca1d47e065c0318774a946ffdf76010c78cc164 Mon Sep 17 00:00:00 2001 +From: Chukun Pan +Date: Sat, 10 Aug 2024 20:16:32 +0800 +Subject: [PATCH] r8127: print link speed and duplex mode +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Like other Ethernet drivers, print link speed and duplex mode +when the interface is up. Formatting output at the same time. + +Signed-off-by: Chukun Pan +Signed-off-by: Álvaro Fernández Rojas +--- + src/r8127.h | 2 ++ + src/r8127_n.c | 48 +++++++++++++++++++++++++++++++++++++++++++++--- + 2 files changed, 47 insertions(+), 3 deletions(-) + +--- a/src/r8127.h ++++ b/src/r8127.h +@@ -1753,6 +1753,11 @@ enum RTL8127_register_content { + LinkStatus = 0x02, + FullDup = 0x01, + ++#define RTL8127_FULL_DUPLEX_MASK (_10000bpsF | _5000bpsF | _2500bpsF | _1000bpsF | FullDup) ++#define RTL8127_SPEED_1000_MASK (_1000bpsF | _1000bpsL | _2500bpsL) ++#define RTL8127_SPEED_2500_MASK (_2500bpsF | _5000bpsL) ++#define RTL8127_SPEED_5000_MASK (_5000bpsF | _10000bpsL) ++ + /* DBG_reg */ + Fix_Nak_1 = (1 << 4), + Fix_Nak_2 = (1 << 3), +--- a/src/r8127_n.c ++++ b/src/r8127_n.c +@@ -39,6 +39,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -4746,6 +4747,42 @@ rtl8127_link_down_patch(struct net_devic + #endif + } + ++static unsigned int rtl8127_phy_duplex(u32 status) ++{ ++ unsigned int duplex = DUPLEX_UNKNOWN; ++ ++ if (status & LinkStatus) { ++ if (status & RTL8127_FULL_DUPLEX_MASK) ++ duplex = DUPLEX_FULL; ++ else ++ duplex = DUPLEX_HALF; ++ } ++ ++ return duplex; ++} ++ ++static int rtl8127_phy_speed(u32 status) ++{ ++ int speed = SPEED_UNKNOWN; ++ ++ if (status & LinkStatus) { ++ if (status & _10000bpsF) ++ speed = SPEED_10000; ++ else if (status & RTL8127_SPEED_5000_MASK) ++ speed = SPEED_5000; ++ else if (status & RTL8127_SPEED_2500_MASK) ++ speed = SPEED_2500; ++ else if (status & RTL8127_SPEED_1000_MASK) ++ speed = SPEED_1000; ++ else if (status & _100bps) ++ speed = SPEED_100; ++ else if (status & _10bps) ++ speed = SPEED_10; ++ } ++ ++ return speed; ++} ++ + static void + _rtl8127_check_link_status(struct net_device *dev, unsigned int link_state) + { +@@ -4758,11 +4795,18 @@ _rtl8127_check_link_status(struct net_de + if (link_state == R8127_LINK_STATE_ON) { + rtl8127_link_on_patch(dev); + +- if (netif_msg_ifup(tp)) +- printk(KERN_INFO PFX "%s: link up\n", dev->name); ++ if (netif_msg_ifup(tp)) { ++ const u32 phy_status = RTL_R32(tp, PHYstatus); ++ const unsigned int phy_duplex = rtl8127_phy_duplex(phy_status); ++ const int phy_speed = rtl8127_phy_speed(phy_status); ++ printk(KERN_INFO PFX "%s: Link is Up - %s/%s\n", ++ dev->name, ++ phy_speed_to_str(phy_speed), ++ phy_duplex_to_str(phy_duplex)); ++ } + } else { + if (netif_msg_ifdown(tp)) +- printk(KERN_INFO PFX "%s: link down\n", dev->name); ++ printk(KERN_INFO PFX "%s: Link is Down\n", dev->name); + + rtl8127_link_down_patch(dev); + } From c0ae5d207173328113188e2919735cfffaf47d95 Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Sun, 13 Apr 2025 19:41:19 +0900 Subject: [PATCH 610/877] ath79: fix initramfs execution for NEC Aterm devices Fix execution of initramfs image on NEC Aterm devices by increasing available memory for lzma extraction of lzma-loader. The size of initramfs image of v24.10.0 exceeds available memory (LZMA_TEXT_START - LOADADDR) and loader data running at LZMA_TEXT_START will be overwritten by extracted data. As a result, LZMA extraction will be broken and stuck (or unexpectedly reset). Fix that issue by setting higher LZMA_TEXT_START address to increase available memory for LZMA extraction by lzma-loader. log (v24.10.0): boot> tftpd tftpd start 192.168.0.1 boot> start tftp load openwrt-24.10.0-ath79-generic-ne end tftp load length = 6569768 start memory load ... memory load complete begin : 0x80040000 length : 6567044 startup: 0x80040000 boot> boot begin : 0x80040000 length : 6567044 startup: 0x80040000 option: 0x0 NEC Aterm series (QCA9558) Calibrating SGMII SGMII cal value = 0xe Configuring SGMII force mode SGMII_CONFIG : 0x000000a2 MR_AN_CONTROL: 0x00008140 MR_AN_CONTROL: 0x00000140 OpenWrt kernel loader for AR7XXX/AR9XXX Copyright (C) 2011 Gabor Juhos Decompressing kernel... [:]');retu <--- (stuck) IPL:SOFT-RESET <--- (reset by WDT) memory test ... ok flinstall OK boot version: 1.0.0 ... Signed-off-by: INAGAKI Hiroshi Link: https://github.com/openwrt/openwrt/pull/18476 Signed-off-by: Robert Marko (cherry picked from commit 10a674d27738020384a1bfcca693200999a9e406) --- target/linux/ath79/image/common-nec.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ath79/image/common-nec.mk b/target/linux/ath79/image/common-nec.mk index 7981a72d8eed5c..23671e215de8d1 100644 --- a/target/linux/ath79/image/common-nec.mk +++ b/target/linux/ath79/image/common-nec.mk @@ -8,6 +8,7 @@ endef define Device/nec-netbsd-aterm DEVICE_VENDOR := NEC LOADER_TYPE := bin + LZMA_TEXT_START := 0x82800000 KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | uImage none KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | loader-kernel | uImage none ARTIFACTS := uboot.bin From 04256646797da82a3a0c419d298ca7719192d128 Mon Sep 17 00:00:00 2001 From: Hannu Nyman Date: Sat, 12 Apr 2025 19:47:28 +0300 Subject: [PATCH 611/877] ca-certificates: Update to 20241223 Update ca-certificates to version 20241223 * Update Mozilla certificate authority bundle to version 2.70. The following certificate authorities were added (+): + Telekom Security TLS ECC Root 2020 + Telekom Security TLS RSA Root 2023 + FIRMAPROFESIONAL CA ROOT-A WEB + TWCA CYBER Root CA + SecureSign Root CA12 + SecureSign Root CA14 + SecureSign Root CA15 The following certificate authorities were removed (-): - Security Communication Root CA (closes: #1063093) Signed-off-by: Hannu Nyman Link: https://github.com/openwrt/openwrt/pull/18468 Signed-off-by: Robert Marko (cherry picked from commit c79572210fa47d015b3bdc03f38c25ef5262a318) --- package/system/ca-certificates/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/system/ca-certificates/Makefile b/package/system/ca-certificates/Makefile index 254d7b5178d89e..5b282c339e64bf 100644 --- a/package/system/ca-certificates/Makefile +++ b/package/system/ca-certificates/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ca-certificates -PKG_VERSION:=20240203 +PKG_VERSION:=20241223 PKG_RELEASE:=1 PKG_MAINTAINER:= @@ -16,7 +16,7 @@ PKG_LICENSE_FILES:=debian/copyright PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@DEBIAN/pool/main/c/ca-certificates -PKG_HASH:=3286d3fc42c4d11b7086711a85f865b44065ce05cf1fb5376b2abed07622a9c6 +PKG_HASH:=dd8286d0a9dd35c756fea5f1df3fed1510fb891f376903891b003cd9b1ad7e03 PKG_INSTALL:=1 include $(INCLUDE_DIR)/package.mk From d183d7bb7827a469f09bf77f2f22fd9d70ac0ed6 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Mon, 14 Apr 2025 01:07:35 +0200 Subject: [PATCH 612/877] OpenWrt v24.10.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 581de056c41e3e..30fa22a128cb7d 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git;openwrt-24.10 -src-git luci https://git.openwrt.org/project/luci.git;openwrt-24.10 -src-git routing https://git.openwrt.org/feed/routing.git;openwrt-24.10 -src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-24.10 +src-git packages https://git.openwrt.org/feed/packages.git^d8cd30f4e281d6853b3de134c4f147a807583e43 +src-git luci https://git.openwrt.org/project/luci.git^2ac26e56cc55102cb10e7b0867c2b78e0f6d5fd8 +src-git routing https://git.openwrt.org/feed/routing.git^c9b636698881059a3c981032770968f5a98ff201 +src-git telephony https://git.openwrt.org/feed/telephony.git^fd605af7143165a2490681ec1752f259873b9147 diff --git a/include/version.mk b/include/version.mk index a6ebe587797707..bcbe1ea1cad0ee 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),24.10-SNAPSHOT) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),24.10.1) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION)) +VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r28597-0425664679) VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO)) -VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/24.10-SNAPSHOT) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/24.10.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 80db993d46b837..08a6e1c4e1f279 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/24.10-SNAPSHOT" + default "https://downloads.openwrt.org/releases/24.10.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..05eac7c66821cd --- /dev/null +++ b/version @@ -0,0 +1 @@ +r28597-0425664679 diff --git a/version.date b/version.date new file mode 100644 index 00000000000000..8b33b85f10ba82 --- /dev/null +++ b/version.date @@ -0,0 +1 @@ +1744562312 From 6271b14140609bfb7480c231ff57ce4e68b2744d Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Mon, 14 Apr 2025 01:07:39 +0200 Subject: [PATCH 613/877] OpenWrt v24.10.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 30fa22a128cb7d..581de056c41e3e 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git^d8cd30f4e281d6853b3de134c4f147a807583e43 -src-git luci https://git.openwrt.org/project/luci.git^2ac26e56cc55102cb10e7b0867c2b78e0f6d5fd8 -src-git routing https://git.openwrt.org/feed/routing.git^c9b636698881059a3c981032770968f5a98ff201 -src-git telephony https://git.openwrt.org/feed/telephony.git^fd605af7143165a2490681ec1752f259873b9147 +src-git packages https://git.openwrt.org/feed/packages.git;openwrt-24.10 +src-git luci https://git.openwrt.org/project/luci.git;openwrt-24.10 +src-git routing https://git.openwrt.org/feed/routing.git;openwrt-24.10 +src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-24.10 diff --git a/include/version.mk b/include/version.mk index bcbe1ea1cad0ee..a6ebe587797707 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),24.10.1) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),24.10-SNAPSHOT) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r28597-0425664679) +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/24.10.1) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/24.10-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 08a6e1c4e1f279..80db993d46b837 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/24.10.1" + default "https://downloads.openwrt.org/releases/24.10-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 05eac7c66821cd..00000000000000 --- a/version +++ /dev/null @@ -1 +0,0 @@ -r28597-0425664679 diff --git a/version.date b/version.date deleted file mode 100644 index 8b33b85f10ba82..00000000000000 --- a/version.date +++ /dev/null @@ -1 +0,0 @@ -1744562312 From be1b2548882fc04237e67882dc84449678019f7f Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Tue, 18 Mar 2025 14:20:52 +0000 Subject: [PATCH 614/877] kernel: move accepted patch from pending-6.6 to backport-6.6 742-net-phy-air_en8811h-reset-netdev-rules-when-LED-is-s.patch has been accepted a while ago as https://git.kernel.org/torvalds/linux/c/87bfdbbb1992 Signed-off-by: Daniel Golle (cherry picked from commit 7a303d861a58bdcdd37430fcbf54bdd76b7cf6e0) --- ...01-net-phy-air_en8811h-Add-the-Airoha-EN8811H-PHY-drive.patch} | 0 ...> 798-v6.10-02-net-phy-air_en8811h-fix-some-error-codes.patch} | 0 ...03-net-phy-air_en8811h-reset-netdev-rules-when-LED-is-s.patch} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename target/linux/generic/backport-6.6/{798-v6.10-net-phy-air_en8811h-Add-the-Airoha-EN8811H-PHY-drive.patch => 798-v6.10-01-net-phy-air_en8811h-Add-the-Airoha-EN8811H-PHY-drive.patch} (100%) rename target/linux/generic/backport-6.6/{799-v6.10-net-phy-air_en8811h-fix-some-error-codes.patch => 798-v6.10-02-net-phy-air_en8811h-fix-some-error-codes.patch} (100%) rename target/linux/generic/{pending-6.6/742-net-phy-air_en8811h-reset-netdev-rules-when-LED-is-s.patch => backport-6.6/798-v6.10-03-net-phy-air_en8811h-reset-netdev-rules-when-LED-is-s.patch} (100%) diff --git a/target/linux/generic/backport-6.6/798-v6.10-net-phy-air_en8811h-Add-the-Airoha-EN8811H-PHY-drive.patch b/target/linux/generic/backport-6.6/798-v6.10-01-net-phy-air_en8811h-Add-the-Airoha-EN8811H-PHY-drive.patch similarity index 100% rename from target/linux/generic/backport-6.6/798-v6.10-net-phy-air_en8811h-Add-the-Airoha-EN8811H-PHY-drive.patch rename to target/linux/generic/backport-6.6/798-v6.10-01-net-phy-air_en8811h-Add-the-Airoha-EN8811H-PHY-drive.patch diff --git a/target/linux/generic/backport-6.6/799-v6.10-net-phy-air_en8811h-fix-some-error-codes.patch b/target/linux/generic/backport-6.6/798-v6.10-02-net-phy-air_en8811h-fix-some-error-codes.patch similarity index 100% rename from target/linux/generic/backport-6.6/799-v6.10-net-phy-air_en8811h-fix-some-error-codes.patch rename to target/linux/generic/backport-6.6/798-v6.10-02-net-phy-air_en8811h-fix-some-error-codes.patch diff --git a/target/linux/generic/pending-6.6/742-net-phy-air_en8811h-reset-netdev-rules-when-LED-is-s.patch b/target/linux/generic/backport-6.6/798-v6.10-03-net-phy-air_en8811h-reset-netdev-rules-when-LED-is-s.patch similarity index 100% rename from target/linux/generic/pending-6.6/742-net-phy-air_en8811h-reset-netdev-rules-when-LED-is-s.patch rename to target/linux/generic/backport-6.6/798-v6.10-03-net-phy-air_en8811h-reset-netdev-rules-when-LED-is-s.patch From 9e9f6875bcc576946f37dce8d88742d259065f0b Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Fri, 28 Mar 2025 15:40:28 +0000 Subject: [PATCH 615/877] generic: fitblk: close block device if mapping image failed In case a broken fit image is present on flash the fitblk driver would not map any /dev/fit* devices, but also not always close the block device the image resides on. In case of ubiblock devices this is fatal as one then cannot remove the ubiblock device (-EBUSY), and hence cannot replace the broken image. Always close the block device in case no sub-image was mapped. Signed-off-by: Daniel Golle (cherry picked from commit 2b9c81d1cbc65eeb9304b7274058418efa8a9c78) --- .../510-block-add-uImage.FIT-subimage-block-driver.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/generic/pending-6.6/510-block-add-uImage.FIT-subimage-block-driver.patch b/target/linux/generic/pending-6.6/510-block-add-uImage.FIT-subimage-block-driver.patch index b06c29ffaf18c4..5a88631513d696 100644 --- a/target/linux/generic/pending-6.6/510-block-add-uImage.FIT-subimage-block-driver.patch +++ b/target/linux/generic/pending-6.6/510-block-add-uImage.FIT-subimage-block-driver.patch @@ -656,7 +656,7 @@ Signed-off-by: Daniel Golle + add_fit_subimage_device(bdev, slot++, start_sect, nr_sects, true); + } + -+ if (!found || !slot) ++ if (!slot) + goto out_bootconf; + + dev_info(dev, "mapped %u uImage.FIT filesystem sub-image%s as /dev/fit%s%u%s\n", @@ -675,7 +675,7 @@ Signed-off-by: Daniel Golle + kfree(bootconf); + kfree(fit); +out_blkdev: -+ if (!found || ret) ++ if (!slot) + blkdev_put(bdev, &_fitblk_claim_ptr); + + return ret; From 4ee8c2dd1be2c1cbabe324c237e9da7c418c7976 Mon Sep 17 00:00:00 2001 From: Mieczyslaw Nalewaj Date: Sat, 15 Mar 2025 12:14:12 +0100 Subject: [PATCH 616/877] generic: rename backport patches to names containing version Rename 770-net-introduce-napi_is_scheduled-helper.patch to 770-v6.7-net-introduce-napi_is_scheduled-helper.patch because it is used since kernel 6.7 (https://lore.kernel.org/lkml/20231028011741.2400327-1-kuba@kernel.org/). Link: https://web.git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-6.7.y&id=7f3eb2174512fe6c9c0f062e96eccb0d3cc6d5cd Rename 751-01-STABLE-net-ethernet-mediatek-split-tx-and-rx-fields-in-mtk_.patch to 751-01-v6.8-net-ethernet-mediatek-split-tx-and-rx-fields-in-mtk_.patch because it is used since kernel 6.8.12 (https://lore.kernel.org/lkml/2024053036-matron-confess-13e0@gregkh/). Link: https://web.git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-6.8.y&id=b411384df5814fe6fd861d4869607577bcec73a1 Rename 751-02-STABLE-net-ethernet-mediatek-use-QDMA-instead-of-ADMAv2-on-.patch to 751-02-v6.8-net-ethernet-mediatek-use-QDMA-instead-of-ADMAv2-on-.patch because it is used since kernel 6.8.12 (https://lore.kernel.org/lkml/2024053036-matron-confess-13e0@gregkh/). Link: https://web.git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-6.8.y&id=0849f56b5146b70f2da328b1d178d0a3c53d6846 Signed-off-by: Mieczyslaw Nalewaj Link: https://github.com/openwrt/openwrt/pull/18253 (cherry picked from commit 0991d2f06d09f0aa5788e099e3cec15c9043bcb5) Link: https://github.com/openwrt/openwrt/pull/18428 Signed-off-by: Hauke Mehrtens --- ....8-net-ethernet-mediatek-split-tx-and-rx-fields-in-mtk_.patch} | 0 ....8-net-ethernet-mediatek-use-QDMA-instead-of-ADMAv2-on-.patch} | 0 ...atch => 770-v6.7-net-introduce-napi_is_scheduled-helper.patch} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename target/linux/generic/backport-6.6/{751-01-STABLE-net-ethernet-mediatek-split-tx-and-rx-fields-in-mtk_.patch => 751-01-v6.8-net-ethernet-mediatek-split-tx-and-rx-fields-in-mtk_.patch} (100%) rename target/linux/generic/backport-6.6/{751-02-STABLE-net-ethernet-mediatek-use-QDMA-instead-of-ADMAv2-on-.patch => 751-02-v6.8-net-ethernet-mediatek-use-QDMA-instead-of-ADMAv2-on-.patch} (100%) rename target/linux/generic/backport-6.6/{770-net-introduce-napi_is_scheduled-helper.patch => 770-v6.7-net-introduce-napi_is_scheduled-helper.patch} (100%) diff --git a/target/linux/generic/backport-6.6/751-01-STABLE-net-ethernet-mediatek-split-tx-and-rx-fields-in-mtk_.patch b/target/linux/generic/backport-6.6/751-01-v6.8-net-ethernet-mediatek-split-tx-and-rx-fields-in-mtk_.patch similarity index 100% rename from target/linux/generic/backport-6.6/751-01-STABLE-net-ethernet-mediatek-split-tx-and-rx-fields-in-mtk_.patch rename to target/linux/generic/backport-6.6/751-01-v6.8-net-ethernet-mediatek-split-tx-and-rx-fields-in-mtk_.patch diff --git a/target/linux/generic/backport-6.6/751-02-STABLE-net-ethernet-mediatek-use-QDMA-instead-of-ADMAv2-on-.patch b/target/linux/generic/backport-6.6/751-02-v6.8-net-ethernet-mediatek-use-QDMA-instead-of-ADMAv2-on-.patch similarity index 100% rename from target/linux/generic/backport-6.6/751-02-STABLE-net-ethernet-mediatek-use-QDMA-instead-of-ADMAv2-on-.patch rename to target/linux/generic/backport-6.6/751-02-v6.8-net-ethernet-mediatek-use-QDMA-instead-of-ADMAv2-on-.patch diff --git a/target/linux/generic/backport-6.6/770-net-introduce-napi_is_scheduled-helper.patch b/target/linux/generic/backport-6.6/770-v6.7-net-introduce-napi_is_scheduled-helper.patch similarity index 100% rename from target/linux/generic/backport-6.6/770-net-introduce-napi_is_scheduled-helper.patch rename to target/linux/generic/backport-6.6/770-v6.7-net-introduce-napi_is_scheduled-helper.patch From 687d713e799955491da6efa6dc1915fd4a3be903 Mon Sep 17 00:00:00 2001 From: Mieczyslaw Nalewaj Date: Sun, 16 Mar 2025 17:30:37 +0100 Subject: [PATCH 617/877] generic: rename backport patch 752-03 to name with correct version Rename 752-03-v6.6-net-ethernet-mtk_eth_soc-rely-on-mtk_pse_port-defini.patch to 752-03-v6.7-net-ethernet-mtk_eth_soc-rely-on-mtk_pse_port-defini.patch because it is used since kernel 6.7 (https://lore.kernel.org/lkml/20231028011741.2400327-1-kuba@kernel.org/). Link: https://web.git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-6.7.y&id=5c33c09c89789ea45d2aac2471a28c9f90b04c95 Signed-off-by: Mieczyslaw Nalewaj Link: https://github.com/openwrt/openwrt/pull/18253 (cherry picked from commit a81099bca25fc6a6476d55f0ca8fa1d3f5e458e4) Link: https://github.com/openwrt/openwrt/pull/18428 Signed-off-by: Hauke Mehrtens --- ....7-net-ethernet-mtk_eth_soc-rely-on-mtk_pse_port-defini.patch} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename target/linux/generic/backport-6.6/{752-03-v6.6-net-ethernet-mtk_eth_soc-rely-on-mtk_pse_port-defini.patch => 752-03-v6.7-net-ethernet-mtk_eth_soc-rely-on-mtk_pse_port-defini.patch} (100%) diff --git a/target/linux/generic/backport-6.6/752-03-v6.6-net-ethernet-mtk_eth_soc-rely-on-mtk_pse_port-defini.patch b/target/linux/generic/backport-6.6/752-03-v6.7-net-ethernet-mtk_eth_soc-rely-on-mtk_pse_port-defini.patch similarity index 100% rename from target/linux/generic/backport-6.6/752-03-v6.6-net-ethernet-mtk_eth_soc-rely-on-mtk_pse_port-defini.patch rename to target/linux/generic/backport-6.6/752-03-v6.7-net-ethernet-mtk_eth_soc-rely-on-mtk_pse_port-defini.patch From c5abbe71d9d236c366e05e748c4713c82d87f3c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Tue, 22 Apr 2025 12:54:16 +0200 Subject: [PATCH 618/877] generic: backport pmdomain dummy release patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes the following warning trace on bcm27xx devices when bcm2835-power is deferred: [ 0.216800] ------------[ cut here ]------------ [ 0.216807] Device 'grafx' does not have a release() function, it is broken and must be fixed. See Documentation/core-api/kobject.rst. [ 0.216863] WARNING: CPU: 0 PID: 1 at drivers/base/core.c:2516 device_release+0x80/0x90 [ 0.216887] Modules linked in: [ 0.216896] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.6.85 #0 [ 0.216905] Hardware name: Raspberry Pi 4 Model B Rev 1.1 (DT) [ 0.216911] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 0.216919] pc : device_release+0x80/0x90 [ 0.216928] lr : device_release+0x80/0x90 [ 0.216936] sp : ffffffc080ccb6d0 [ 0.216940] x29: ffffffc080ccb6d0 x28: 0000000000000000 x27: ffffff8040d49810 [ 0.216953] x26: ffffff8040c904b8 x25: ffffff8040c904a0 x24: ffffffc0808a7f08 [ 0.216964] x23: ffffffc080a1a6d8 x22: 0000000000000000 x21: ffffffc080a1afe0 [ 0.216976] x20: 0000000000000000 x19: ffffff8040c900b8 x18: 000000000000009f [ 0.216987] x17: 206e656b6f726220 x16: 7369207469202c6e x15: ffffffc080b4ee88 [ 0.216998] x14: 00000000000001dd x13: 000000000000009f x12: 00000000ffffffea [ 0.217009] x11: 00000000ffffefff x10: ffffffc080ba6e88 x9 : ffffffc080b4ee30 [ 0.217020] x8 : 0000000000017fe8 x7 : c0000000ffffefff x6 : 0000000000057fa8 [ 0.217031] x5 : 0000000000000fff x4 : 0000000000000000 x3 : ffffffc080ccb4d0 [ 0.217042] x2 : ffffffc080b4edc8 x1 : ffffffc080b4edc8 x0 : 000000000000007a [ 0.217053] Call trace: [ 0.217058] device_release+0x80/0x90 [ 0.217067] kobject_put+0xac/0x100 [ 0.217078] put_device+0x14/0x24 [ 0.217086] genpd_remove+0x16c/0x244 [ 0.217093] pm_genpd_remove+0x2c/0x50 [ 0.217099] bcm2835_power_probe+0x1f8/0x2b8 [ 0.217107] platform_probe+0x68/0xc4 [ 0.217118] really_probe+0x148/0x2b0 [ 0.217125] __driver_probe_device+0x78/0x128 [ 0.217131] driver_probe_device+0x40/0xdc [ 0.217138] __device_attach_driver+0xb8/0xf8 [ 0.217145] bus_for_each_drv+0x70/0xb8 [ 0.217151] __device_attach+0xa0/0x184 [ 0.217158] device_initial_probe+0x14/0x20 [ 0.217165] bus_probe_device+0xac/0xb0 [ 0.217171] device_add+0x5a8/0x760 [ 0.217177] platform_device_add+0x184/0x240 [ 0.217184] mfd_add_device+0x3e8/0x4c0 [ 0.217195] devm_mfd_add_devices+0xa0/0x118 [ 0.217202] bcm2835_pm_probe+0x144/0x1d8 [ 0.217210] platform_probe+0x68/0xc4 [ 0.217217] really_probe+0x148/0x2b0 [ 0.217224] __driver_probe_device+0x78/0x128 [ 0.217230] driver_probe_device+0x40/0xdc [ 0.217237] __driver_attach+0x90/0x160 [ 0.217243] bus_for_each_dev+0x64/0xa4 [ 0.217249] driver_attach+0x24/0x30 [ 0.217256] bus_add_driver+0xe4/0x208 [ 0.217262] driver_register+0x5c/0x124 [ 0.217269] __platform_driver_register+0x28/0x34 [ 0.217276] bcm2835_pm_driver_init+0x1c/0x28 [ 0.217286] do_one_initcall+0x6c/0x1fc [ 0.217294] kernel_init_freeable+0x208/0x2e4 [ 0.217306] kernel_init+0x28/0x1e4 [ 0.217313] ret_from_fork+0x10/0x20 [ 0.217320] ---[ end trace 0000000000000000 ]--- This issue was introduced in v6.6.69 with the following backport: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=36a6e8aeae4a41767bb59f56b100c8cc9ffae2cb The upstream patch has been adapted to v6.6: https://github.com/torvalds/linux/commit/f64f610ec6ab59dd0391b03842cea3a4cd8ee34f More info: https://github.com/raspberrypi/linux/issues/6777 Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit f65c44f67f5d435cb552310f2d455fbfdac935c2) --- ...d-dummy-release-function-to-genpd-de.patch | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 target/linux/generic/backport-6.6/910-v6.13-pmdomain-core-add-dummy-release-function-to-genpd-de.patch diff --git a/target/linux/generic/backport-6.6/910-v6.13-pmdomain-core-add-dummy-release-function-to-genpd-de.patch b/target/linux/generic/backport-6.6/910-v6.13-pmdomain-core-add-dummy-release-function-to-genpd-de.patch new file mode 100644 index 00000000000000..b392bd0d0c6c5b --- /dev/null +++ b/target/linux/generic/backport-6.6/910-v6.13-pmdomain-core-add-dummy-release-function-to-genpd-de.patch @@ -0,0 +1,46 @@ +From f64f610ec6ab59dd0391b03842cea3a4cd8ee34f Mon Sep 17 00:00:00 2001 +From: Lucas Stach +Date: Wed, 18 Dec 2024 19:44:33 +0100 +Subject: [PATCH] pmdomain: core: add dummy release function to genpd device + +The genpd device, which is really only used as a handle to lookup +OPP, but not even registered to the device core otherwise and thus +lifetime linked to the genpd struct it is contained in, is missing +a release function. After b8f7bbd1f4ec ("pmdomain: core: Add +missing put_device()") the device will be cleaned up going through +the driver core device_release() function, which will warn when no +release callback is present for the device. Add a dummy release +function to shut up the warning. + +Signed-off-by: Lucas Stach +Tested-by: Luca Ceresoli +Fixes: b8f7bbd1f4ec ("pmdomain: core: Add missing put_device()") +Cc: stable@vger.kernel.org +Message-ID: <20241218184433.1930532-1-l.stach@pengutronix.de> +Signed-off-by: Ulf Hansson +--- + drivers/base/power/domain.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/base/power/domain.c ++++ b/drivers/base/power/domain.c +@@ -2040,6 +2040,11 @@ static void genpd_lock_init(struct gener + } + } + ++static void genpd_provider_release(struct device *dev) ++{ ++ /* nothing to be done here */ ++} ++ + /** + * pm_genpd_init - Initialize a generic I/O PM domain object. + * @genpd: PM domain object to initialize. +@@ -2106,6 +2111,7 @@ int pm_genpd_init(struct generic_pm_doma + return ret; + + device_initialize(&genpd->dev); ++ genpd->dev.release = genpd_provider_release; + dev_set_name(&genpd->dev, "%s", genpd->name); + + mutex_lock(&gpd_list_lock); From 5663f8e1669a6fb73092ae9f020ebd996bb405a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Tue, 22 Apr 2025 14:36:49 +0200 Subject: [PATCH 619/877] generic: 6.6: backport upstream v6.15 r8169 patches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit b48688ea3c9ac r8169: disable RTL8126 ZRX-DC timeout 3d9b8ac534126 r8169: enable RTL8168H/RTL8168EP/RTL8168FP ASPM support 473367a5ffe16 r8169: increase max jumbo packet size on RTL8125/RTL8126 853e80369cfce r8169: add PHY c45 ops for MDIO_MMD_VENDOR2 registers d30460f42675f r8169: add support for Intel Killer E5000 faac69a4ae5ab r8169: don't scan PHY addresses > 0 135c3c86a7cef r8169: make Kconfig option for LED support user-visible Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 36623119b3e6532a3d051a37e93b2fbaa3dd1f6d) --- ...ig-option-for-LED-support-user-visib.patch | 28 ++++++++ ....15-r8169-don-t-scan-PHY-addresses-0.patch | 26 +++++++ ...9-add-support-for-Intel-Killer-E5000.patch | 25 +++++++ ...5-ops-for-MDIO_MMD_VENDOR2-registers.patch | 67 +++++++++++++++++++ ...ax-jumbo-packet-size-on-RTL8125-RTL8.patch | 40 +++++++++++ ...8168H-RTL8168EP-RTL8168FP-ASPM-suppo.patch | 27 ++++++++ ...r8169-disable-RTL8126-ZRX-DC-timeout.patch | 60 +++++++++++++++++ 7 files changed, 273 insertions(+) create mode 100644 target/linux/generic/backport-6.6/780-50-v6.15-r8169-make-Kconfig-option-for-LED-support-user-visib.patch create mode 100644 target/linux/generic/backport-6.6/780-51-v6.15-r8169-don-t-scan-PHY-addresses-0.patch create mode 100644 target/linux/generic/backport-6.6/780-52-v6.15-r8169-add-support-for-Intel-Killer-E5000.patch create mode 100644 target/linux/generic/backport-6.6/780-53-v6.15-r8169-add-PHY-c45-ops-for-MDIO_MMD_VENDOR2-registers.patch create mode 100644 target/linux/generic/backport-6.6/780-54-v6.15-r8169-increase-max-jumbo-packet-size-on-RTL8125-RTL8.patch create mode 100644 target/linux/generic/backport-6.6/780-55-v6.15-r8169-enable-RTL8168H-RTL8168EP-RTL8168FP-ASPM-suppo.patch create mode 100644 target/linux/generic/backport-6.6/780-56-v6.15-r8169-disable-RTL8126-ZRX-DC-timeout.patch diff --git a/target/linux/generic/backport-6.6/780-50-v6.15-r8169-make-Kconfig-option-for-LED-support-user-visib.patch b/target/linux/generic/backport-6.6/780-50-v6.15-r8169-make-Kconfig-option-for-LED-support-user-visib.patch new file mode 100644 index 00000000000000..62acd269639091 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-50-v6.15-r8169-make-Kconfig-option-for-LED-support-user-visib.patch @@ -0,0 +1,28 @@ +From 135c3c86a7cef4ba3d368da15b16c275b74582d3 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Mon, 3 Feb 2025 21:35:24 +0100 +Subject: [PATCH] r8169: make Kconfig option for LED support user-visible + +Make config option R8169_LEDS user-visible, so that users can remove +support if not needed. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Link: https://patch.msgid.link/d29f0cdb-32bf-435f-b59d-dc96bca1e3ab@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/Kconfig | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/net/ethernet/realtek/Kconfig ++++ b/drivers/net/ethernet/realtek/Kconfig +@@ -114,7 +114,8 @@ config R8169 + will be called r8169. This is recommended. + + config R8169_LEDS +- def_bool R8169 && LEDS_TRIGGER_NETDEV ++ bool "Support for controlling the NIC LEDs" ++ depends on R8169 && LEDS_TRIGGER_NETDEV + depends on !(R8169=y && LEDS_CLASS=m) + help + Optional support for controlling the NIC LED's with the netdev diff --git a/target/linux/generic/backport-6.6/780-51-v6.15-r8169-don-t-scan-PHY-addresses-0.patch b/target/linux/generic/backport-6.6/780-51-v6.15-r8169-don-t-scan-PHY-addresses-0.patch new file mode 100644 index 00000000000000..735f3ff4f9d5e7 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-51-v6.15-r8169-don-t-scan-PHY-addresses-0.patch @@ -0,0 +1,26 @@ +From faac69a4ae5abb49e62c79c66b51bb905c9aa5ec Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Tue, 4 Feb 2025 07:58:17 +0100 +Subject: [PATCH] r8169: don't scan PHY addresses > 0 + +The PHY address is a dummy, because r8169 PHY access registers +don't support a PHY address. Therefore scan address 0 only. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Andrew Lunn +Link: https://patch.msgid.link/830637dd-4016-4a68-92b3-618fcac6589d@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169_main.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -5230,6 +5230,7 @@ static int r8169_mdio_register(struct rt + new_bus->priv = tp; + new_bus->parent = &pdev->dev; + new_bus->irq[0] = PHY_MAC_INTERRUPT; ++ new_bus->phy_mask = GENMASK(31, 1); + snprintf(new_bus->id, MII_BUS_ID_SIZE, "r8169-%x-%x", + pci_domain_nr(pdev->bus), pci_dev_id(pdev)); + diff --git a/target/linux/generic/backport-6.6/780-52-v6.15-r8169-add-support-for-Intel-Killer-E5000.patch b/target/linux/generic/backport-6.6/780-52-v6.15-r8169-add-support-for-Intel-Killer-E5000.patch new file mode 100644 index 00000000000000..d741d193ab536d --- /dev/null +++ b/target/linux/generic/backport-6.6/780-52-v6.15-r8169-add-support-for-Intel-Killer-E5000.patch @@ -0,0 +1,25 @@ +From d30460f42675fef5cd4b44ffbc49b545524555e3 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Wed, 12 Feb 2025 08:03:56 +0100 +Subject: [PATCH] r8169: add support for Intel Killer E5000 + +This adds support for the Intel Killer E5000 which seems to be a +rebranded RTL8126. Copied from r8126 vendor driver. + +Signed-off-by: Heiner Kallweit +Link: https://patch.msgid.link/9db73e9b-e2e8-45de-97a5-041c5f71d774@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169_main.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -169,6 +169,7 @@ static const struct pci_device_id rtl816 + { PCI_VDEVICE(REALTEK, 0x8125) }, + { PCI_VDEVICE(REALTEK, 0x8126) }, + { PCI_VDEVICE(REALTEK, 0x3000) }, ++ { PCI_VDEVICE(REALTEK, 0x5000) }, + {} + }; + diff --git a/target/linux/generic/backport-6.6/780-53-v6.15-r8169-add-PHY-c45-ops-for-MDIO_MMD_VENDOR2-registers.patch b/target/linux/generic/backport-6.6/780-53-v6.15-r8169-add-PHY-c45-ops-for-MDIO_MMD_VENDOR2-registers.patch new file mode 100644 index 00000000000000..010a8abc021224 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-53-v6.15-r8169-add-PHY-c45-ops-for-MDIO_MMD_VENDOR2-registers.patch @@ -0,0 +1,67 @@ +From 853e80369cfceb2331bf34f251ba11c6602cc67f Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Thu, 13 Feb 2025 20:15:42 +0100 +Subject: [PATCH] r8169: add PHY c45 ops for MDIO_MMD_VENDOR2 registers + +The integrated PHYs on chip versions from RTL8168g allow to address +MDIO_MMD_VEND2 registers. All c22 standard registers are mapped to +MDIO_MMD_VEND2 registers. So far the paging mechanism is used to +address PHY registers. Add support for c45 ops to address MDIO_MMD_VEND2 +registers directly, w/o the paging. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Andrew Lunn +Link: https://patch.msgid.link/d6f97eaa-0f13-468f-89cb-75a41087bc4a@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169_main.c | 32 +++++++++++++++++++++++ + 1 file changed, 32 insertions(+) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -5208,6 +5208,33 @@ static int r8169_mdio_write_reg(struct m + return 0; + } + ++static int r8169_mdio_read_reg_c45(struct mii_bus *mii_bus, int addr, ++ int devnum, int regnum) ++{ ++ struct rtl8169_private *tp = mii_bus->priv; ++ ++ if (addr > 0) ++ return -ENODEV; ++ ++ if (devnum == MDIO_MMD_VEND2 && regnum > MDIO_STAT2) ++ return r8168_phy_ocp_read(tp, regnum); ++ ++ return 0; ++} ++ ++static int r8169_mdio_write_reg_c45(struct mii_bus *mii_bus, int addr, ++ int devnum, int regnum, u16 val) ++{ ++ struct rtl8169_private *tp = mii_bus->priv; ++ ++ if (addr > 0 || devnum != MDIO_MMD_VEND2 || regnum <= MDIO_STAT2) ++ return -ENODEV; ++ ++ r8168_phy_ocp_write(tp, regnum, val); ++ ++ return 0; ++} ++ + static int r8169_mdio_register(struct rtl8169_private *tp) + { + struct pci_dev *pdev = tp->pci_dev; +@@ -5238,6 +5265,11 @@ static int r8169_mdio_register(struct rt + new_bus->read = r8169_mdio_read_reg; + new_bus->write = r8169_mdio_write_reg; + ++ if (tp->mac_version >= RTL_GIGA_MAC_VER_40) { ++ new_bus->read_c45 = r8169_mdio_read_reg_c45; ++ new_bus->write_c45 = r8169_mdio_write_reg_c45; ++ } ++ + ret = devm_mdiobus_register(&pdev->dev, new_bus); + if (ret) + return ret; diff --git a/target/linux/generic/backport-6.6/780-54-v6.15-r8169-increase-max-jumbo-packet-size-on-RTL8125-RTL8.patch b/target/linux/generic/backport-6.6/780-54-v6.15-r8169-increase-max-jumbo-packet-size-on-RTL8125-RTL8.patch new file mode 100644 index 00000000000000..f8d7e8008adaff --- /dev/null +++ b/target/linux/generic/backport-6.6/780-54-v6.15-r8169-increase-max-jumbo-packet-size-on-RTL8125-RTL8.patch @@ -0,0 +1,40 @@ +From 473367a5ffe1607a61be481e2feda684eb5faea9 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Fri, 7 Mar 2025 08:29:47 +0100 +Subject: [PATCH] r8169: increase max jumbo packet size on RTL8125/RTL8126 + +Realtek confirmed that all RTL8125/RTL8126 chip versions support up to +16K jumbo packets. Reflect this in the driver. + +Tested by Rui on RTL8125B with 12K jumbo packets. + +Suggested-by: Rui Salvaterra +Tested-by: Rui Salvaterra +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Link: https://patch.msgid.link/396762ad-cc65-4e60-b01e-8847db89e98b@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169_main.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -89,6 +89,7 @@ + #define JUMBO_6K (6 * SZ_1K - VLAN_ETH_HLEN - ETH_FCS_LEN) + #define JUMBO_7K (7 * SZ_1K - VLAN_ETH_HLEN - ETH_FCS_LEN) + #define JUMBO_9K (9 * SZ_1K - VLAN_ETH_HLEN - ETH_FCS_LEN) ++#define JUMBO_16K (SZ_16K - VLAN_ETH_HLEN - ETH_FCS_LEN) + + static const struct { + const char *name; +@@ -5368,6 +5369,9 @@ static int rtl_jumbo_max(struct rtl8169_ + /* RTL8168c */ + case RTL_GIGA_MAC_VER_18 ... RTL_GIGA_MAC_VER_24: + return JUMBO_6K; ++ /* RTL8125/8126 */ ++ case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_71: ++ return JUMBO_16K; + default: + return JUMBO_9K; + } diff --git a/target/linux/generic/backport-6.6/780-55-v6.15-r8169-enable-RTL8168H-RTL8168EP-RTL8168FP-ASPM-suppo.patch b/target/linux/generic/backport-6.6/780-55-v6.15-r8169-enable-RTL8168H-RTL8168EP-RTL8168FP-ASPM-suppo.patch new file mode 100644 index 00000000000000..32623e235843cd --- /dev/null +++ b/target/linux/generic/backport-6.6/780-55-v6.15-r8169-enable-RTL8168H-RTL8168EP-RTL8168FP-ASPM-suppo.patch @@ -0,0 +1,27 @@ +From 3d9b8ac5341269d31e59fd5d58d47266ac78bc32 Mon Sep 17 00:00:00 2001 +From: ChunHao Lin +Date: Tue, 18 Mar 2025 16:37:20 +0800 +Subject: [PATCH] r8169: enable RTL8168H/RTL8168EP/RTL8168FP ASPM support + +This patch will enable RTL8168H/RTL8168EP/RTL8168FP ASPM support on +the platforms that have tested with ASPM enabled. + +Signed-off-by: ChunHao Lin +Reviewed-by: Heiner Kallweit +Link: https://patch.msgid.link/20250318083721.4127-2-hau@realtek.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169_main.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -5406,7 +5406,7 @@ done: + /* register is set if system vendor successfully tested ASPM 1.2 */ + static bool rtl_aspm_is_safe(struct rtl8169_private *tp) + { +- if (tp->mac_version >= RTL_GIGA_MAC_VER_61 && ++ if (tp->mac_version >= RTL_GIGA_MAC_VER_46 && + r8168_mac_ocp_read(tp, 0xc0b2) & 0xf) + return true; + diff --git a/target/linux/generic/backport-6.6/780-56-v6.15-r8169-disable-RTL8126-ZRX-DC-timeout.patch b/target/linux/generic/backport-6.6/780-56-v6.15-r8169-disable-RTL8126-ZRX-DC-timeout.patch new file mode 100644 index 00000000000000..3f81f4b54bf0b4 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-56-v6.15-r8169-disable-RTL8126-ZRX-DC-timeout.patch @@ -0,0 +1,60 @@ +From b48688ea3c9ac8d5d910c6e91fb7f80d846581f0 Mon Sep 17 00:00:00 2001 +From: ChunHao Lin +Date: Tue, 18 Mar 2025 16:37:21 +0800 +Subject: [PATCH] r8169: disable RTL8126 ZRX-DC timeout + +Disable it due to it dose not meet ZRX-DC specification. If it is enabled, +device will exit L1 substate every 100ms. Disable it for saving more power +in L1 substate. + +Signed-off-by: ChunHao Lin +Reviewed-by: Heiner Kallweit +Link: https://patch.msgid.link/20250318083721.4127-3-hau@realtek.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169_main.c | 27 +++++++++++++++++++++++ + 1 file changed, 27 insertions(+) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -2856,6 +2856,32 @@ static u32 rtl_csi_read(struct rtl8169_p + RTL_R32(tp, CSIDR) : ~0; + } + ++static void rtl_disable_zrxdc_timeout(struct rtl8169_private *tp) ++{ ++ struct pci_dev *pdev = tp->pci_dev; ++ u32 csi; ++ int rc; ++ u8 val; ++ ++#define RTL_GEN3_RELATED_OFF 0x0890 ++#define RTL_GEN3_ZRXDC_NONCOMPL 0x1 ++ if (pdev->cfg_size > RTL_GEN3_RELATED_OFF) { ++ rc = pci_read_config_byte(pdev, RTL_GEN3_RELATED_OFF, &val); ++ if (rc == PCIBIOS_SUCCESSFUL) { ++ val &= ~RTL_GEN3_ZRXDC_NONCOMPL; ++ rc = pci_write_config_byte(pdev, RTL_GEN3_RELATED_OFF, ++ val); ++ if (rc == PCIBIOS_SUCCESSFUL) ++ return; ++ } ++ } ++ ++ netdev_notice_once(tp->dev, ++ "No native access to PCI extended config space, falling back to CSI\n"); ++ csi = rtl_csi_read(tp, RTL_GEN3_RELATED_OFF); ++ rtl_csi_write(tp, RTL_GEN3_RELATED_OFF, csi & ~RTL_GEN3_ZRXDC_NONCOMPL); ++} ++ + static void rtl_set_aspm_entry_latency(struct rtl8169_private *tp, u8 val) + { + struct pci_dev *pdev = tp->pci_dev; +@@ -3828,6 +3854,7 @@ static void rtl_hw_start_8125d(struct rt + + static void rtl_hw_start_8126a(struct rtl8169_private *tp) + { ++ rtl_disable_zrxdc_timeout(tp); + rtl_set_def_aspm_entry_latency(tp); + rtl_hw_start_8125_common(tp); + } From 1eab9b8a9b33b61baa6331a87e4d7b54ac747fa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Tue, 22 Apr 2025 14:39:05 +0200 Subject: [PATCH 620/877] generic: 6.6: backport upstream v6.15 Realtek PHY patches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bfc17c1658353 net: phy: realtek: disable PHY-mode EEE fabcfd6d10999 net: phy: realtek: add defines for shadowed c45 standard registers 8af2136e77989 net: phy: realtek: add helper RTL822X_VND2_C22_REG 02d3b306ac2f0 net: phy: realtek: switch from paged to MMD ops in rtl822x functions da681ed73fb98 net: phy: realtek: improve mmd register access for internal PHY's 0bea93fdbaf86 net: phy: realtek: use string choices helpers 51773846fab24 net: phy: realtek: make HWMON support a user-visible Kconfig symbol Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 7673a165a955269773eb604d3678d86d0bb7f49c) --- ...make-HWMON-support-a-user-visible-Kc.patch | 35 +++++ ...y-realtek-use-string-choices-helpers.patch | 54 +++++++ ...improve-mmd-register-access-for-inte.patch | 134 ++++++++++++++++++ ...switch-from-paged-to-MMD-ops-in-rtl8.patch | 52 +++++++ ...ltek-add-helper-RTL822X_VND2_C22_REG.patch | 48 +++++++ ...add-defines-for-shadowed-c45-standar.patch | 113 +++++++++++++++ ...net-phy-realtek-disable-PHY-mode-EEE.patch | 54 +++++++ ...-use-genphy_soft_reset-for-2.5G-PHYs.patch | 16 +-- ...sable-SGMII-in-band-AN-for-2-5G-PHYs.patch | 4 +- ...make-sure-paged-read-is-protected-by.patch | 2 +- .../720-04-net-phy-realtek-setup-aldps.patch | 6 +- ...tek-detect-early-version-of-RTL8221B.patch | 2 +- ...ealtek-support-interrupt-of-RTL8221B.patch | 10 +- ...ealtek-mark-existing-MMDs-as-present.patch | 2 +- ...hy-realtek-work-around-broken-serdes.patch | 6 +- ...t-phy-realtek-disable-MDIO-broadcast.patch | 2 +- 16 files changed, 515 insertions(+), 25 deletions(-) create mode 100644 target/linux/generic/backport-6.6/781-27-v6.15-net-phy-realtek-make-HWMON-support-a-user-visible-Kc.patch create mode 100644 target/linux/generic/backport-6.6/781-28-v6.15-net-phy-realtek-use-string-choices-helpers.patch create mode 100644 target/linux/generic/backport-6.6/781-29-v6.15-net-phy-realtek-improve-mmd-register-access-for-inte.patch create mode 100644 target/linux/generic/backport-6.6/781-30-v6.15-net-phy-realtek-switch-from-paged-to-MMD-ops-in-rtl8.patch create mode 100644 target/linux/generic/backport-6.6/781-31-v6.15-net-phy-realtek-add-helper-RTL822X_VND2_C22_REG.patch create mode 100644 target/linux/generic/backport-6.6/781-32-v6.15-net-phy-realtek-add-defines-for-shadowed-c45-standar.patch create mode 100644 target/linux/generic/backport-6.6/781-33-v6.15-net-phy-realtek-disable-PHY-mode-EEE.patch diff --git a/target/linux/generic/backport-6.6/781-27-v6.15-net-phy-realtek-make-HWMON-support-a-user-visible-Kc.patch b/target/linux/generic/backport-6.6/781-27-v6.15-net-phy-realtek-make-HWMON-support-a-user-visible-Kc.patch new file mode 100644 index 00000000000000..821d7ee8798765 --- /dev/null +++ b/target/linux/generic/backport-6.6/781-27-v6.15-net-phy-realtek-make-HWMON-support-a-user-visible-Kc.patch @@ -0,0 +1,35 @@ +From 51773846fab24a353bed4ebb660997ced4bc32d7 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Mon, 3 Feb 2025 21:33:39 +0100 +Subject: [PATCH] net: phy: realtek: make HWMON support a user-visible Kconfig + symbol + +Make config symbol REALTEK_PHY_HWMON user-visible, so that users can +remove support if not needed. + +Suggested-by: Geert Uytterhoeven +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Link: https://patch.msgid.link/3466ee92-166a-4b0f-9ae7-42b9e046f333@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/phy/realtek/Kconfig | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +--- a/drivers/net/phy/realtek/Kconfig ++++ b/drivers/net/phy/realtek/Kconfig +@@ -4,8 +4,12 @@ config REALTEK_PHY + help + Currently supports RTL821x/RTL822x and fast ethernet PHYs + ++if REALTEK_PHY ++ + config REALTEK_PHY_HWMON +- def_bool REALTEK_PHY && HWMON +- depends on !(REALTEK_PHY=y && HWMON=m) ++ bool "HWMON support for Realtek PHYs" ++ depends on HWMON && !(REALTEK_PHY=y && HWMON=m) + help + Optional hwmon support for the temperature sensor ++ ++endif # REALTEK_PHY diff --git a/target/linux/generic/backport-6.6/781-28-v6.15-net-phy-realtek-use-string-choices-helpers.patch b/target/linux/generic/backport-6.6/781-28-v6.15-net-phy-realtek-use-string-choices-helpers.patch new file mode 100644 index 00000000000000..d3e09bc7cdda93 --- /dev/null +++ b/target/linux/generic/backport-6.6/781-28-v6.15-net-phy-realtek-use-string-choices-helpers.patch @@ -0,0 +1,54 @@ +From 0bea93fdbaf8675b7e8124bdcaf51497dcc8bcfa Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Mon, 3 Feb 2025 21:41:36 +0100 +Subject: [PATCH] net: phy: realtek: use string choices helpers + +Use string choices helpers to simplify the code. + +Reported-by: kernel test robot +Closes: https://lore.kernel.org/oe-kbuild-all/202501190707.qQS8PGHW-lkp@intel.com/ +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Signed-off-by: David S. Miller +--- + drivers/net/phy/realtek/realtek_main.c | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +--- a/drivers/net/phy/realtek/realtek_main.c ++++ b/drivers/net/phy/realtek/realtek_main.c +@@ -13,6 +13,7 @@ + #include + #include + #include ++#include + + #include "realtek.h" + +@@ -422,11 +423,11 @@ static int rtl8211f_config_init(struct p + } else if (ret) { + dev_dbg(dev, + "%s 2ns TX delay (and changing the value from pin-strapping RXD1 or the bootloader)\n", +- val_txdly ? "Enabling" : "Disabling"); ++ str_enable_disable(val_txdly)); + } else { + dev_dbg(dev, + "2ns TX delay was already %s (by pin-strapping RXD1 or bootloader configuration)\n", +- val_txdly ? "enabled" : "disabled"); ++ str_enabled_disabled(val_txdly)); + } + + ret = phy_modify_paged_changed(phydev, 0xd08, 0x15, RTL8211F_RX_DELAY, +@@ -437,11 +438,11 @@ static int rtl8211f_config_init(struct p + } else if (ret) { + dev_dbg(dev, + "%s 2ns RX delay (and changing the value from pin-strapping RXD0 or the bootloader)\n", +- val_rxdly ? "Enabling" : "Disabling"); ++ str_enable_disable(val_rxdly)); + } else { + dev_dbg(dev, + "2ns RX delay was already %s (by pin-strapping RXD0 or bootloader configuration)\n", +- val_rxdly ? "enabled" : "disabled"); ++ str_enabled_disabled(val_rxdly)); + } + + if (priv->has_phycr2) { diff --git a/target/linux/generic/backport-6.6/781-29-v6.15-net-phy-realtek-improve-mmd-register-access-for-inte.patch b/target/linux/generic/backport-6.6/781-29-v6.15-net-phy-realtek-improve-mmd-register-access-for-inte.patch new file mode 100644 index 00000000000000..3a3a20d58be8ad --- /dev/null +++ b/target/linux/generic/backport-6.6/781-29-v6.15-net-phy-realtek-improve-mmd-register-access-for-inte.patch @@ -0,0 +1,134 @@ +From da681ed73fb980286fc29de707b35d76bb33e123 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Thu, 13 Feb 2025 20:18:17 +0100 +Subject: [PATCH] net: phy: realtek: improve mmd register access for internal + PHY's + +r8169 provides the MDIO bus for the internal PHY's. It has been extended +with c45 access functions for addressing MDIO_MMD_VEND2 registers. +So we can switch from paged access to directly addressing the +MDIO_MMD_VEND2 registers. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Andrew Lunn +Link: https://patch.msgid.link/a5f2333c-dda9-48ad-9801-77049766e632@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/phy/realtek/realtek_main.c | 79 +++++++++++--------------- + 1 file changed, 33 insertions(+), 46 deletions(-) + +--- a/drivers/net/phy/realtek/realtek_main.c ++++ b/drivers/net/phy/realtek/realtek_main.c +@@ -735,29 +735,31 @@ static int rtlgen_read_status(struct phy + return 0; + } + ++static int rtlgen_read_vend2(struct phy_device *phydev, int regnum) ++{ ++ return __mdiobus_c45_read(phydev->mdio.bus, 0, MDIO_MMD_VEND2, regnum); ++} ++ ++static int rtlgen_write_vend2(struct phy_device *phydev, int regnum, u16 val) ++{ ++ return __mdiobus_c45_write(phydev->mdio.bus, 0, MDIO_MMD_VEND2, regnum, ++ val); ++} ++ + static int rtlgen_read_mmd(struct phy_device *phydev, int devnum, u16 regnum) + { + int ret; + +- if (devnum == MDIO_MMD_VEND2) { +- rtl821x_write_page(phydev, regnum >> 4); +- ret = __phy_read(phydev, 0x10 + ((regnum & 0xf) >> 1)); +- rtl821x_write_page(phydev, 0); +- } else if (devnum == MDIO_MMD_PCS && regnum == MDIO_PCS_EEE_ABLE) { +- rtl821x_write_page(phydev, 0xa5c); +- ret = __phy_read(phydev, 0x12); +- rtl821x_write_page(phydev, 0); +- } else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV) { +- rtl821x_write_page(phydev, 0xa5d); +- ret = __phy_read(phydev, 0x10); +- rtl821x_write_page(phydev, 0); +- } else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_LPABLE) { +- rtl821x_write_page(phydev, 0xa5d); +- ret = __phy_read(phydev, 0x11); +- rtl821x_write_page(phydev, 0); +- } else { ++ if (devnum == MDIO_MMD_VEND2) ++ ret = rtlgen_read_vend2(phydev, regnum); ++ else if (devnum == MDIO_MMD_PCS && regnum == MDIO_PCS_EEE_ABLE) ++ ret = rtlgen_read_vend2(phydev, 0xa5c4); ++ else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV) ++ ret = rtlgen_read_vend2(phydev, 0xa5d0); ++ else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_LPABLE) ++ ret = rtlgen_read_vend2(phydev, 0xa5d2); ++ else + ret = -EOPNOTSUPP; +- } + + return ret; + } +@@ -767,17 +769,12 @@ static int rtlgen_write_mmd(struct phy_d + { + int ret; + +- if (devnum == MDIO_MMD_VEND2) { +- rtl821x_write_page(phydev, regnum >> 4); +- ret = __phy_write(phydev, 0x10 + ((regnum & 0xf) >> 1), val); +- rtl821x_write_page(phydev, 0); +- } else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV) { +- rtl821x_write_page(phydev, 0xa5d); +- ret = __phy_write(phydev, 0x10, val); +- rtl821x_write_page(phydev, 0); +- } else { ++ if (devnum == MDIO_MMD_VEND2) ++ ret = rtlgen_write_vend2(phydev, regnum, val); ++ else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV) ++ ret = rtlgen_write_vend2(phydev, regnum, 0xa5d0); ++ else + ret = -EOPNOTSUPP; +- } + + return ret; + } +@@ -789,19 +786,12 @@ static int rtl822x_read_mmd(struct phy_d + if (ret != -EOPNOTSUPP) + return ret; + +- if (devnum == MDIO_MMD_PCS && regnum == MDIO_PCS_EEE_ABLE2) { +- rtl821x_write_page(phydev, 0xa6e); +- ret = __phy_read(phydev, 0x16); +- rtl821x_write_page(phydev, 0); +- } else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV2) { +- rtl821x_write_page(phydev, 0xa6d); +- ret = __phy_read(phydev, 0x12); +- rtl821x_write_page(phydev, 0); +- } else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_LPABLE2) { +- rtl821x_write_page(phydev, 0xa6d); +- ret = __phy_read(phydev, 0x10); +- rtl821x_write_page(phydev, 0); +- } ++ if (devnum == MDIO_MMD_PCS && regnum == MDIO_PCS_EEE_ABLE2) ++ ret = rtlgen_read_vend2(phydev, 0xa6ec); ++ else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV2) ++ ret = rtlgen_read_vend2(phydev, 0xa6d4); ++ else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_LPABLE2) ++ ret = rtlgen_read_vend2(phydev, 0xa6d0); + + return ret; + } +@@ -814,11 +804,8 @@ static int rtl822x_write_mmd(struct phy_ + if (ret != -EOPNOTSUPP) + return ret; + +- if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV2) { +- rtl821x_write_page(phydev, 0xa6d); +- ret = __phy_write(phydev, 0x12, val); +- rtl821x_write_page(phydev, 0); +- } ++ if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV2) ++ ret = rtlgen_write_vend2(phydev, 0xa6d4, val); + + return ret; + } diff --git a/target/linux/generic/backport-6.6/781-30-v6.15-net-phy-realtek-switch-from-paged-to-MMD-ops-in-rtl8.patch b/target/linux/generic/backport-6.6/781-30-v6.15-net-phy-realtek-switch-from-paged-to-MMD-ops-in-rtl8.patch new file mode 100644 index 00000000000000..5e3c3ce70a0f62 --- /dev/null +++ b/target/linux/generic/backport-6.6/781-30-v6.15-net-phy-realtek-switch-from-paged-to-MMD-ops-in-rtl8.patch @@ -0,0 +1,52 @@ +From 02d3b306ac2f0b174753d1c5b9e4e5fb8ec5057e Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Thu, 13 Feb 2025 20:19:14 +0100 +Subject: [PATCH] net: phy: realtek: switch from paged to MMD ops in rtl822x + functions + +The MDIO bus provided by r8169 for the internal PHY's now supports +c45 ops for the MDIO_MMD_VEND2 device. So we can switch to standard +MMD ops here. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Andrew Lunn +Link: https://patch.msgid.link/81416f95-0fac-4225-87b4-828e3738b8ed@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/phy/realtek/realtek_main.c | 11 +++++------ + 1 file changed, 5 insertions(+), 6 deletions(-) + +--- a/drivers/net/phy/realtek/realtek_main.c ++++ b/drivers/net/phy/realtek/realtek_main.c +@@ -901,7 +901,7 @@ static int rtl822x_get_features(struct p + { + int val; + +- val = phy_read_paged(phydev, 0xa61, 0x13); ++ val = phy_read_mmd(phydev, MDIO_MMD_VEND2, 0xa616); + if (val < 0) + return val; + +@@ -922,10 +922,9 @@ static int rtl822x_config_aneg(struct ph + if (phydev->autoneg == AUTONEG_ENABLE) { + u16 adv = linkmode_adv_to_mii_10gbt_adv_t(phydev->advertising); + +- ret = phy_modify_paged_changed(phydev, 0xa5d, 0x12, +- MDIO_AN_10GBT_CTRL_ADV2_5G | +- MDIO_AN_10GBT_CTRL_ADV5G, +- adv); ++ ret = phy_modify_mmd_changed(phydev, MDIO_MMD_VEND2, 0xa5d4, ++ MDIO_AN_10GBT_CTRL_ADV2_5G | ++ MDIO_AN_10GBT_CTRL_ADV5G, adv); + if (ret < 0) + return ret; + } +@@ -969,7 +968,7 @@ static int rtl822x_read_status(struct ph + !phydev->autoneg_complete) + return 0; + +- lpadv = phy_read_paged(phydev, 0xa5d, 0x13); ++ lpadv = phy_read_mmd(phydev, MDIO_MMD_VEND2, 0xa5d6); + if (lpadv < 0) + return lpadv; + diff --git a/target/linux/generic/backport-6.6/781-31-v6.15-net-phy-realtek-add-helper-RTL822X_VND2_C22_REG.patch b/target/linux/generic/backport-6.6/781-31-v6.15-net-phy-realtek-add-helper-RTL822X_VND2_C22_REG.patch new file mode 100644 index 00000000000000..5134d08b1cc40f --- /dev/null +++ b/target/linux/generic/backport-6.6/781-31-v6.15-net-phy-realtek-add-helper-RTL822X_VND2_C22_REG.patch @@ -0,0 +1,48 @@ +From 8af2136e77989a64fae0284bf76fd584e32edd3a Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Fri, 14 Feb 2025 21:31:14 +0100 +Subject: [PATCH] net: phy: realtek: add helper RTL822X_VND2_C22_REG + +C22 register space is mapped to 0xa400 in MMD VEND2 register space. +Add a helper to access mapped C22 registers. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Andrew Lunn +Link: https://patch.msgid.link/6344277b-c5c7-449b-ac89-d5425306ca76@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/phy/realtek/realtek_main.c | 9 ++++----- + 1 file changed, 4 insertions(+), 5 deletions(-) + +--- a/drivers/net/phy/realtek/realtek_main.c ++++ b/drivers/net/phy/realtek/realtek_main.c +@@ -79,9 +79,7 @@ + /* RTL822X_VND2_XXXXX registers are only accessible when phydev->is_c45 + * is set, they cannot be accessed by C45-over-C22. + */ +-#define RTL822X_VND2_GBCR 0xa412 +- +-#define RTL822X_VND2_GANLPAR 0xa414 ++#define RTL822X_VND2_C22_REG(reg) (0xa400 + 2 * (reg)) + + #define RTL8366RB_POWER_SAVE 0x15 + #define RTL8366RB_POWER_SAVE_ON BIT(12) +@@ -1015,7 +1013,8 @@ static int rtl822x_c45_config_aneg(struc + val = linkmode_adv_to_mii_ctrl1000_t(phydev->advertising); + + /* Vendor register as C45 has no standardized support for 1000BaseT */ +- ret = phy_modify_mmd_changed(phydev, MDIO_MMD_VEND2, RTL822X_VND2_GBCR, ++ ret = phy_modify_mmd_changed(phydev, MDIO_MMD_VEND2, ++ RTL822X_VND2_C22_REG(MII_CTRL1000), + ADVERTISE_1000FULL, val); + if (ret < 0) + return ret; +@@ -1032,7 +1031,7 @@ static int rtl822x_c45_read_status(struc + /* Vendor register as C45 has no standardized support for 1000BaseT */ + if (phydev->autoneg == AUTONEG_ENABLE && genphy_c45_aneg_done(phydev)) { + val = phy_read_mmd(phydev, MDIO_MMD_VEND2, +- RTL822X_VND2_GANLPAR); ++ RTL822X_VND2_C22_REG(MII_STAT1000)); + if (val < 0) + return val; + } else { diff --git a/target/linux/generic/backport-6.6/781-32-v6.15-net-phy-realtek-add-defines-for-shadowed-c45-standar.patch b/target/linux/generic/backport-6.6/781-32-v6.15-net-phy-realtek-add-defines-for-shadowed-c45-standar.patch new file mode 100644 index 00000000000000..ff7d5b1fb6aa04 --- /dev/null +++ b/target/linux/generic/backport-6.6/781-32-v6.15-net-phy-realtek-add-defines-for-shadowed-c45-standar.patch @@ -0,0 +1,113 @@ +From fabcfd6d10999024a721ae1b965b57eb8a305ace Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Sat, 15 Feb 2025 14:29:15 +0100 +Subject: [PATCH] net: phy: realtek: add defines for shadowed c45 standard + registers + +Realtek shadows standard c45 registers in VEND2 device register space. +Add defines for these VEND2 registers, based on the names of the +standard c45 registers. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Andrew Lunn +Link: https://patch.msgid.link/c90bdf76-f8b8-4d06-9656-7a52d5658ee6@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/phy/realtek/realtek_main.c | 33 +++++++++++++++++--------- + 1 file changed, 22 insertions(+), 11 deletions(-) + +--- a/drivers/net/phy/realtek/realtek_main.c ++++ b/drivers/net/phy/realtek/realtek_main.c +@@ -94,6 +94,16 @@ + #define RTL_VND2_PHYSR_MASTER BIT(11) + #define RTL_VND2_PHYSR_SPEED_MASK (RTL_VND2_PHYSR_SPEEDL | RTL_VND2_PHYSR_SPEEDH) + ++#define RTL_MDIO_PCS_EEE_ABLE 0xa5c4 ++#define RTL_MDIO_AN_EEE_ADV 0xa5d0 ++#define RTL_MDIO_AN_EEE_LPABLE 0xa5d2 ++#define RTL_MDIO_AN_10GBT_CTRL 0xa5d4 ++#define RTL_MDIO_AN_10GBT_STAT 0xa5d6 ++#define RTL_MDIO_PMA_SPEED 0xa616 ++#define RTL_MDIO_AN_EEE_LPABLE2 0xa6d0 ++#define RTL_MDIO_AN_EEE_ADV2 0xa6d4 ++#define RTL_MDIO_PCS_EEE_ABLE2 0xa6ec ++ + #define RTL_GENERIC_PHYID 0x001cc800 + #define RTL_8211FVD_PHYID 0x001cc878 + #define RTL_8221B 0x001cc840 +@@ -751,11 +761,11 @@ static int rtlgen_read_mmd(struct phy_de + if (devnum == MDIO_MMD_VEND2) + ret = rtlgen_read_vend2(phydev, regnum); + else if (devnum == MDIO_MMD_PCS && regnum == MDIO_PCS_EEE_ABLE) +- ret = rtlgen_read_vend2(phydev, 0xa5c4); ++ ret = rtlgen_read_vend2(phydev, RTL_MDIO_PCS_EEE_ABLE); + else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV) +- ret = rtlgen_read_vend2(phydev, 0xa5d0); ++ ret = rtlgen_read_vend2(phydev, RTL_MDIO_AN_EEE_ADV); + else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_LPABLE) +- ret = rtlgen_read_vend2(phydev, 0xa5d2); ++ ret = rtlgen_read_vend2(phydev, RTL_MDIO_AN_EEE_LPABLE); + else + ret = -EOPNOTSUPP; + +@@ -770,7 +780,7 @@ static int rtlgen_write_mmd(struct phy_d + if (devnum == MDIO_MMD_VEND2) + ret = rtlgen_write_vend2(phydev, regnum, val); + else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV) +- ret = rtlgen_write_vend2(phydev, regnum, 0xa5d0); ++ ret = rtlgen_write_vend2(phydev, regnum, RTL_MDIO_AN_EEE_ADV); + else + ret = -EOPNOTSUPP; + +@@ -785,11 +795,11 @@ static int rtl822x_read_mmd(struct phy_d + return ret; + + if (devnum == MDIO_MMD_PCS && regnum == MDIO_PCS_EEE_ABLE2) +- ret = rtlgen_read_vend2(phydev, 0xa6ec); ++ ret = rtlgen_read_vend2(phydev, RTL_MDIO_PCS_EEE_ABLE2); + else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV2) +- ret = rtlgen_read_vend2(phydev, 0xa6d4); ++ ret = rtlgen_read_vend2(phydev, RTL_MDIO_AN_EEE_ADV2); + else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_LPABLE2) +- ret = rtlgen_read_vend2(phydev, 0xa6d0); ++ ret = rtlgen_read_vend2(phydev, RTL_MDIO_AN_EEE_LPABLE2); + + return ret; + } +@@ -803,7 +813,7 @@ static int rtl822x_write_mmd(struct phy_ + return ret; + + if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV2) +- ret = rtlgen_write_vend2(phydev, 0xa6d4, val); ++ ret = rtlgen_write_vend2(phydev, RTL_MDIO_AN_EEE_ADV2, val); + + return ret; + } +@@ -899,7 +909,7 @@ static int rtl822x_get_features(struct p + { + int val; + +- val = phy_read_mmd(phydev, MDIO_MMD_VEND2, 0xa616); ++ val = phy_read_mmd(phydev, MDIO_MMD_VEND2, RTL_MDIO_PMA_SPEED); + if (val < 0) + return val; + +@@ -920,7 +930,8 @@ static int rtl822x_config_aneg(struct ph + if (phydev->autoneg == AUTONEG_ENABLE) { + u16 adv = linkmode_adv_to_mii_10gbt_adv_t(phydev->advertising); + +- ret = phy_modify_mmd_changed(phydev, MDIO_MMD_VEND2, 0xa5d4, ++ ret = phy_modify_mmd_changed(phydev, MDIO_MMD_VEND2, ++ RTL_MDIO_AN_10GBT_CTRL, + MDIO_AN_10GBT_CTRL_ADV2_5G | + MDIO_AN_10GBT_CTRL_ADV5G, adv); + if (ret < 0) +@@ -966,7 +977,7 @@ static int rtl822x_read_status(struct ph + !phydev->autoneg_complete) + return 0; + +- lpadv = phy_read_mmd(phydev, MDIO_MMD_VEND2, 0xa5d6); ++ lpadv = phy_read_mmd(phydev, MDIO_MMD_VEND2, RTL_MDIO_AN_10GBT_STAT); + if (lpadv < 0) + return lpadv; + diff --git a/target/linux/generic/backport-6.6/781-33-v6.15-net-phy-realtek-disable-PHY-mode-EEE.patch b/target/linux/generic/backport-6.6/781-33-v6.15-net-phy-realtek-disable-PHY-mode-EEE.patch new file mode 100644 index 00000000000000..4d755d4e22a405 --- /dev/null +++ b/target/linux/generic/backport-6.6/781-33-v6.15-net-phy-realtek-disable-PHY-mode-EEE.patch @@ -0,0 +1,54 @@ +From bfc17c1658353f22843c7c13e27c2d31950f1887 Mon Sep 17 00:00:00 2001 +From: "Russell King (Oracle)" +Date: Sun, 16 Mar 2025 12:39:54 +0000 +Subject: [PATCH] net: phy: realtek: disable PHY-mode EEE + +Realtek RTL8211F has a "PHY-mode" EEE support which interferes with an +IEEE 802.3 compliant implementation. This mode defaults to enabled, and +results in the MAC receive path not seeing the link transition to LPI +state. + +Fix this by disabling PHY-mode EEE. + +Signed-off-by: Russell King (Oracle) +Reviewed-by: Andrew Lunn +Link: https://patch.msgid.link/E1ttnHW-00785s-Uq@rmk-PC.armlinux.org.uk +Signed-off-by: Paolo Abeni +--- + drivers/net/phy/realtek/realtek_main.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +--- a/drivers/net/phy/realtek/realtek_main.c ++++ b/drivers/net/phy/realtek/realtek_main.c +@@ -33,6 +33,9 @@ + + #define RTL8211F_PHYCR1 0x18 + #define RTL8211F_PHYCR2 0x19 ++#define RTL8211F_CLKOUT_EN BIT(0) ++#define RTL8211F_PHYCR2_PHY_EEE_ENABLE BIT(5) ++ + #define RTL8211F_INSR 0x1d + + #define RTL8211F_LEDCR 0x10 +@@ -55,8 +58,6 @@ + #define RTL8211E_TX_DELAY BIT(12) + #define RTL8211E_RX_DELAY BIT(11) + +-#define RTL8211F_CLKOUT_EN BIT(0) +- + #define RTL8201F_ISR 0x1e + #define RTL8201F_ISR_ANERR BIT(15) + #define RTL8201F_ISR_DUPLEX BIT(13) +@@ -453,6 +454,12 @@ static int rtl8211f_config_init(struct p + str_enabled_disabled(val_rxdly)); + } + ++ /* Disable PHY-mode EEE so LPI is passed to the MAC */ ++ ret = phy_modify_paged(phydev, 0xa43, RTL8211F_PHYCR2, ++ RTL8211F_PHYCR2_PHY_EEE_ENABLE, 0); ++ if (ret) ++ return ret; ++ + if (priv->has_phycr2) { + ret = phy_modify_paged(phydev, 0xa43, RTL8211F_PHYCR2, + RTL8211F_CLKOUT_EN, priv->phycr2); diff --git a/target/linux/generic/pending-6.6/720-01-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch b/target/linux/generic/pending-6.6/720-01-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch index 24885e3681e135..6a68ae428ca9c9 100644 --- a/target/linux/generic/pending-6.6/720-01-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch +++ b/target/linux/generic/pending-6.6/720-01-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch @@ -15,7 +15,7 @@ Signed-off-by: Daniel Golle --- a/drivers/net/phy/realtek/realtek_main.c +++ b/drivers/net/phy/realtek/realtek_main.c -@@ -1430,6 +1430,7 @@ static struct phy_driver realtek_drvs[] +@@ -1434,6 +1434,7 @@ static struct phy_driver realtek_drvs[] }, { .name = "RTL8226 2.5Gbps PHY", .match_phy_device = rtl8226_match_phy_device, @@ -23,7 +23,7 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, -@@ -1440,6 +1441,7 @@ static struct phy_driver realtek_drvs[] +@@ -1444,6 +1445,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_match_phy_device, .name = "RTL8226B_RTL8221B 2.5Gbps PHY", @@ -31,7 +31,7 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .config_init = rtl822xb_config_init, -@@ -1452,6 +1454,7 @@ static struct phy_driver realtek_drvs[] +@@ -1456,6 +1458,7 @@ static struct phy_driver realtek_drvs[] }, { PHY_ID_MATCH_EXACT(0x001cc838), .name = "RTL8226-CG 2.5Gbps PHY", @@ -39,7 +39,7 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, -@@ -1462,6 +1465,7 @@ static struct phy_driver realtek_drvs[] +@@ -1466,6 +1469,7 @@ static struct phy_driver realtek_drvs[] }, { PHY_ID_MATCH_EXACT(0x001cc848), .name = "RTL8226B-CG_RTL8221B-CG 2.5Gbps PHY", @@ -47,7 +47,7 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .config_init = rtl822xb_config_init, -@@ -1474,6 +1478,7 @@ static struct phy_driver realtek_drvs[] +@@ -1478,6 +1482,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c22_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C22)", @@ -55,7 +55,7 @@ Signed-off-by: Daniel Golle .probe = rtl822x_probe, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, -@@ -1487,6 +1492,7 @@ static struct phy_driver realtek_drvs[] +@@ -1491,6 +1496,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c45_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C45)", @@ -63,7 +63,7 @@ Signed-off-by: Daniel Golle .probe = rtl822x_probe, .config_init = rtl822xb_config_init, .get_rate_matching = rtl822xb_get_rate_matching, -@@ -1498,6 +1504,7 @@ static struct phy_driver realtek_drvs[] +@@ -1502,6 +1508,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c22_match_phy_device, .name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)", @@ -71,7 +71,7 @@ Signed-off-by: Daniel Golle .probe = rtl822x_probe, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, -@@ -1511,6 +1518,7 @@ static struct phy_driver realtek_drvs[] +@@ -1515,6 +1522,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c45_match_phy_device, .name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)", diff --git a/target/linux/generic/pending-6.6/720-02-net-phy-realtek-disable-SGMII-in-band-AN-for-2-5G-PHYs.patch b/target/linux/generic/pending-6.6/720-02-net-phy-realtek-disable-SGMII-in-band-AN-for-2-5G-PHYs.patch index edc03b55758ef1..6ecd7235b4238d 100644 --- a/target/linux/generic/pending-6.6/720-02-net-phy-realtek-disable-SGMII-in-band-AN-for-2-5G-PHYs.patch +++ b/target/linux/generic/pending-6.6/720-02-net-phy-realtek-disable-SGMII-in-band-AN-for-2-5G-PHYs.patch @@ -20,7 +20,7 @@ Signed-off-by: Daniel Golle --- a/drivers/net/phy/realtek/realtek_main.c +++ b/drivers/net/phy/realtek/realtek_main.c -@@ -834,8 +834,8 @@ static int rtl822x_probe(struct phy_devi +@@ -837,8 +837,8 @@ static int rtl822x_probe(struct phy_devi static int rtl822xb_config_init(struct phy_device *phydev) { bool has_2500, has_sgmii; @@ -30,7 +30,7 @@ Signed-off-by: Daniel Golle has_2500 = test_bit(PHY_INTERFACE_MODE_2500BASEX, phydev->host_interfaces) || -@@ -885,7 +885,29 @@ static int rtl822xb_config_init(struct p +@@ -888,7 +888,29 @@ static int rtl822xb_config_init(struct p if (ret < 0) return ret; diff --git a/target/linux/generic/pending-6.6/720-03-net-phy-realtek-make-sure-paged-read-is-protected-by.patch b/target/linux/generic/pending-6.6/720-03-net-phy-realtek-make-sure-paged-read-is-protected-by.patch index d5f80d1c919d42..86ba13370aef4b 100644 --- a/target/linux/generic/pending-6.6/720-03-net-phy-realtek-make-sure-paged-read-is-protected-by.patch +++ b/target/linux/generic/pending-6.6/720-03-net-phy-realtek-make-sure-paged-read-is-protected-by.patch @@ -18,7 +18,7 @@ Signed-off-by: Daniel Golle --- a/drivers/net/phy/realtek/realtek_main.c +++ b/drivers/net/phy/realtek/realtek_main.c -@@ -1111,9 +1111,11 @@ static bool rtlgen_supports_2_5gbps(stru +@@ -1115,9 +1115,11 @@ static bool rtlgen_supports_2_5gbps(stru { int val; diff --git a/target/linux/generic/pending-6.6/720-04-net-phy-realtek-setup-aldps.patch b/target/linux/generic/pending-6.6/720-04-net-phy-realtek-setup-aldps.patch index 23b3ca893a79d9..fb9944e8e5685a 100644 --- a/target/linux/generic/pending-6.6/720-04-net-phy-realtek-setup-aldps.patch +++ b/target/linux/generic/pending-6.6/720-04-net-phy-realtek-setup-aldps.patch @@ -14,8 +14,8 @@ Signed-off-by: Daniel Golle --- a/drivers/net/phy/realtek/realtek_main.c +++ b/drivers/net/phy/realtek/realtek_main.c @@ -82,6 +82,10 @@ - - #define RTL822X_VND2_GANLPAR 0xa414 + */ + #define RTL822X_VND2_C22_REG(reg) (0xa400 + 2 * (reg)) +#define RTL8221B_PHYCR1 0xa430 +#define RTL8221B_PHYCR1_ALDPS_EN BIT(2) @@ -24,7 +24,7 @@ Signed-off-by: Daniel Golle #define RTL8366RB_POWER_SAVE 0x15 #define RTL8366RB_POWER_SAVE_ON BIT(12) -@@ -889,6 +893,15 @@ static int rtl822xb_config_init(struct p +@@ -892,6 +896,15 @@ static int rtl822xb_config_init(struct p if (ret < 0) return ret; diff --git a/target/linux/generic/pending-6.6/720-05-net-phy-realtek-detect-early-version-of-RTL8221B.patch b/target/linux/generic/pending-6.6/720-05-net-phy-realtek-detect-early-version-of-RTL8221B.patch index d7fbf3a2a6cd7b..ca08dcafdf12a1 100644 --- a/target/linux/generic/pending-6.6/720-05-net-phy-realtek-detect-early-version-of-RTL8221B.patch +++ b/target/linux/generic/pending-6.6/720-05-net-phy-realtek-detect-early-version-of-RTL8221B.patch @@ -14,7 +14,7 @@ Signed-off-by: Daniel Golle Signed-off-by: Mieczyslaw Nalewaj --- a/drivers/net/phy/realtek/realtek_main.c +++ b/drivers/net/phy/realtek/realtek_main.c -@@ -1166,10 +1166,32 @@ static int rtl8226_match_phy_device(stru +@@ -1170,10 +1170,32 @@ static int rtl8226_match_phy_device(stru static int rtlgen_is_c45_match(struct phy_device *phydev, unsigned int id, bool is_c45) { diff --git a/target/linux/generic/pending-6.6/720-06-net-phy-realtek-support-interrupt-of-RTL8221B.patch b/target/linux/generic/pending-6.6/720-06-net-phy-realtek-support-interrupt-of-RTL8221B.patch index 45ca5413f30324..24109d8d546fe9 100644 --- a/target/linux/generic/pending-6.6/720-06-net-phy-realtek-support-interrupt-of-RTL8221B.patch +++ b/target/linux/generic/pending-6.6/720-06-net-phy-realtek-support-interrupt-of-RTL8221B.patch @@ -12,7 +12,7 @@ Signed-off-by: Jianhui Zhao --- a/drivers/net/phy/realtek/realtek_main.c +++ b/drivers/net/phy/realtek/realtek_main.c -@@ -1377,6 +1377,51 @@ static irqreturn_t rtl9000a_handle_inter +@@ -1381,6 +1381,51 @@ static irqreturn_t rtl9000a_handle_inter return IRQ_HANDLED; } @@ -64,7 +64,7 @@ Signed-off-by: Jianhui Zhao static struct phy_driver realtek_drvs[] = { { PHY_ID_MATCH_EXACT(0x00008201), -@@ -1537,6 +1582,8 @@ static struct phy_driver realtek_drvs[] +@@ -1541,6 +1586,8 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c22_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C22)", @@ -73,7 +73,7 @@ Signed-off-by: Jianhui Zhao .soft_reset = genphy_soft_reset, .probe = rtl822x_probe, .get_features = rtl822x_get_features, -@@ -1551,6 +1598,8 @@ static struct phy_driver realtek_drvs[] +@@ -1555,6 +1602,8 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c45_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C45)", @@ -82,7 +82,7 @@ Signed-off-by: Jianhui Zhao .soft_reset = genphy_soft_reset, .probe = rtl822x_probe, .config_init = rtl822xb_config_init, -@@ -1563,6 +1612,8 @@ static struct phy_driver realtek_drvs[] +@@ -1567,6 +1616,8 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c22_match_phy_device, .name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)", @@ -91,7 +91,7 @@ Signed-off-by: Jianhui Zhao .soft_reset = genphy_soft_reset, .probe = rtl822x_probe, .get_features = rtl822x_get_features, -@@ -1577,6 +1628,8 @@ static struct phy_driver realtek_drvs[] +@@ -1581,6 +1632,8 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c45_match_phy_device, .name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)", diff --git a/target/linux/generic/pending-6.6/720-07-net-phy-realtek-mark-existing-MMDs-as-present.patch b/target/linux/generic/pending-6.6/720-07-net-phy-realtek-mark-existing-MMDs-as-present.patch index 555e5905d3a33c..9c93a26b409b56 100644 --- a/target/linux/generic/pending-6.6/720-07-net-phy-realtek-mark-existing-MMDs-as-present.patch +++ b/target/linux/generic/pending-6.6/720-07-net-phy-realtek-mark-existing-MMDs-as-present.patch @@ -15,7 +15,7 @@ Signed-off-by: Daniel Golle --- a/drivers/net/phy/realtek/realtek_main.c +++ b/drivers/net/phy/realtek/realtek_main.c -@@ -1043,6 +1043,9 @@ static int rtl822x_c45_get_features(stru +@@ -1046,6 +1046,9 @@ static int rtl822x_c45_get_features(stru linkmode_set_bit(ETHTOOL_LINK_MODE_TP_BIT, phydev->supported); diff --git a/target/linux/generic/pending-6.6/720-08-net-phy-realtek-work-around-broken-serdes.patch b/target/linux/generic/pending-6.6/720-08-net-phy-realtek-work-around-broken-serdes.patch index e356a0a6ee52ca..48a9ba08dabc87 100644 --- a/target/linux/generic/pending-6.6/720-08-net-phy-realtek-work-around-broken-serdes.patch +++ b/target/linux/generic/pending-6.6/720-08-net-phy-realtek-work-around-broken-serdes.patch @@ -15,7 +15,7 @@ Signed-off-by: Daniel Golle --- --- a/drivers/net/phy/realtek/realtek_main.c +++ b/drivers/net/phy/realtek/realtek_main.c -@@ -923,6 +923,22 @@ static int rtl822xb_config_init(struct p +@@ -926,6 +926,22 @@ static int rtl822xb_config_init(struct p return 0; } @@ -38,7 +38,7 @@ Signed-off-by: Daniel Golle static int rtl822xb_get_rate_matching(struct phy_device *phydev, phy_interface_t iface) { -@@ -1605,7 +1621,7 @@ static struct phy_driver realtek_drvs[] +@@ -1609,7 +1625,7 @@ static struct phy_driver realtek_drvs[] .handle_interrupt = rtl8221b_handle_interrupt, .soft_reset = genphy_soft_reset, .probe = rtl822x_probe, @@ -47,7 +47,7 @@ Signed-off-by: Daniel Golle .get_rate_matching = rtl822xb_get_rate_matching, .get_features = rtl822x_c45_get_features, .config_aneg = rtl822x_c45_config_aneg, -@@ -1635,7 +1651,7 @@ static struct phy_driver realtek_drvs[] +@@ -1639,7 +1655,7 @@ static struct phy_driver realtek_drvs[] .handle_interrupt = rtl8221b_handle_interrupt, .soft_reset = genphy_soft_reset, .probe = rtl822x_probe, diff --git a/target/linux/generic/pending-6.6/720-09-net-phy-realtek-disable-MDIO-broadcast.patch b/target/linux/generic/pending-6.6/720-09-net-phy-realtek-disable-MDIO-broadcast.patch index b2d26a87806ed5..d783b292e80752 100644 --- a/target/linux/generic/pending-6.6/720-09-net-phy-realtek-disable-MDIO-broadcast.patch +++ b/target/linux/generic/pending-6.6/720-09-net-phy-realtek-disable-MDIO-broadcast.patch @@ -13,7 +13,7 @@ Signed-off-by: Daniel Golle --- --- a/drivers/net/phy/realtek/realtek_main.c +++ b/drivers/net/phy/realtek/realtek_main.c -@@ -849,6 +849,11 @@ static int rtl822xb_config_init(struct p +@@ -852,6 +852,11 @@ static int rtl822xb_config_init(struct p phydev->host_interfaces) || phydev->interface == PHY_INTERFACE_MODE_SGMII; From 6c15645a12a3ecbb920cb36e109cd6ee63b431ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Wed, 23 Apr 2025 09:11:51 +0200 Subject: [PATCH 621/877] kernel: r8101: load module at boot time MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows the network interface naming to be stable, free from any possible interaction from external USB network devices that might claim usb* interface names. Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 7aeb837bf46acdd68b5ed373741be897bbb2067d) --- package/kernel/r8101/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/kernel/r8101/Makefile b/package/kernel/r8101/Makefile index 2a09855c0503c1..4b528036a2122a 100644 --- a/package/kernel/r8101/Makefile +++ b/package/kernel/r8101/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=r8101 PKG_VERSION:=1.039.00 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://github.com/openwrt/rtl8101/releases/download/$(PKG_VERSION) @@ -20,7 +20,7 @@ define KernelPackage/r8101 TITLE:=Realtek RTL8101 PCI Fast Ethernet driver DEPENDS:=@PCI_SUPPORT +kmod-libphy FILES:=$(PKG_BUILD_DIR)/src/r8101.ko - AUTOLOAD:=$(call AutoProbe,r8101) + AUTOLOAD:=$(call AutoProbe,r8101,1) PROVIDES:=kmod-r8169 endef From 7bef5367a7e4575d54fc89a9b6ac1cd0c212c014 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Wed, 23 Apr 2025 09:17:21 +0200 Subject: [PATCH 622/877] kernel: r8168: load module at boot time MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows the network interface naming to be stable, free from any possible interaction from external USB network devices that might claim usb* interface names. Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 617961403c27733de5e9c11b0b2e6ea44d2dcec4) --- package/kernel/r8168/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/kernel/r8168/Makefile b/package/kernel/r8168/Makefile index 0b846113df6d93..d35f3dc61cb4ea 100644 --- a/package/kernel/r8168/Makefile +++ b/package/kernel/r8168/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=r8168 PKG_VERSION:=8.055.00 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://github.com/openwrt/rtl8168/releases/download/$(PKG_VERSION) @@ -20,7 +20,7 @@ define KernelPackage/r8168 TITLE:=Realtek RTL8168 PCI Gigabit Ethernet driver DEPENDS:=@PCI_SUPPORT +kmod-libphy FILES:=$(PKG_BUILD_DIR)/src/r8168.ko - AUTOLOAD:=$(call AutoProbe,r8168) + AUTOLOAD:=$(call AutoProbe,r8168,1) PROVIDES:=kmod-r8169 endef From 50cf9bbf173b70458566369350268f379e8f199b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Wed, 23 Apr 2025 09:18:22 +0200 Subject: [PATCH 623/877] kernel: r8125: load module at boot time MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows the network interface naming to be stable, free from any possible interaction from external USB network devices that might claim usb* interface names. Signed-off-by: Pavel Kubelun Link: https://github.com/openwrt/openwrt/pull/18509 Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit ce9f539672d2d55cea97e47a0e33459179237781) --- package/kernel/r8125/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/kernel/r8125/Makefile b/package/kernel/r8125/Makefile index 232cf695b86f7a..9dde19437ad9fb 100644 --- a/package/kernel/r8125/Makefile +++ b/package/kernel/r8125/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=r8125 PKG_VERSION:=9.015.00 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://github.com/openwrt/rtl8125/releases/download/$(PKG_VERSION) @@ -20,7 +20,7 @@ define KernelPackage/r8125 TITLE:=Realtek RTL8125 PCI 2.5 Gigabit Ethernet driver DEPENDS:=@PCI_SUPPORT +kmod-libphy FILES:=$(PKG_BUILD_DIR)/src/r8125.ko - AUTOLOAD:=$(call AutoProbe,r8125) + AUTOLOAD:=$(call AutoProbe,r8125,1) PROVIDES:=kmod-r8169 VARIANT:=regular endef From 111d88e896b7ef778812c1d67fa1433c07fc116d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Wed, 23 Apr 2025 09:20:18 +0200 Subject: [PATCH 624/877] kernel: r8126: load module at boot time MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows the network interface naming to be stable, free from any possible interaction from external USB network devices that might claim usb* interface names. Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 9bb151d0c635241ceaa29525668cd225a10494d0) --- package/kernel/r8126/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/kernel/r8126/Makefile b/package/kernel/r8126/Makefile index da43697bfb9e23..9f0f074d6235e0 100644 --- a/package/kernel/r8126/Makefile +++ b/package/kernel/r8126/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=r8126 PKG_VERSION:=10.015.00 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://github.com/openwrt/rtl8126/releases/download/$(PKG_VERSION) @@ -20,7 +20,7 @@ define KernelPackage/r8126 TITLE:=Realtek RTL8126 PCI 5 Gigabit Ethernet driver DEPENDS:=@PCI_SUPPORT +kmod-libphy FILES:=$(PKG_BUILD_DIR)/src/r8126.ko - AUTOLOAD:=$(call AutoProbe,r8126) + AUTOLOAD:=$(call AutoProbe,r8126,1) PROVIDES:=kmod-r8169 VARIANT:=regular endef From 31292ddc10b188fe12432636cd3e0a0a4ff43537 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Wed, 23 Apr 2025 09:20:43 +0200 Subject: [PATCH 625/877] kernel: r8127: load module at boot time MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows the network interface naming to be stable, free from any possible interaction from external USB network devices that might claim usb* interface names. Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit b5680bd11339b2ed489e1deeaaa2a3432691490a) --- package/kernel/r8127/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/kernel/r8127/Makefile b/package/kernel/r8127/Makefile index bb0c5e0a6ca810..b4b1c49eb5edd1 100644 --- a/package/kernel/r8127/Makefile +++ b/package/kernel/r8127/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=r8127 PKG_VERSION:=11.014.00 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://github.com/openwrt/rtl8127/releases/download/$(PKG_VERSION) @@ -20,7 +20,7 @@ define KernelPackage/r8127 TITLE:=Realtek RTL8127 PCI 10 Gigabit Ethernet driver DEPENDS:=@PCI_SUPPORT +kmod-libphy FILES:=$(PKG_BUILD_DIR)/src/r8127.ko - AUTOLOAD:=$(call AutoProbe,r8127) + AUTOLOAD:=$(call AutoProbe,r8127,1) PROVIDES:=kmod-r8169 VARIANT:=regular endef From ec82f459c9a5d7ed8f55bf5a175e80e8f57c3d63 Mon Sep 17 00:00:00 2001 From: Pavel Kubelun Date: Wed, 16 Apr 2025 21:07:32 +0300 Subject: [PATCH 626/877] kernel: r8125: disable ASPM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Disable ASPM support for this NIC, fixing strange behavior problems, such as increased latency, strange uneven throughput, etc. With this option disabled the NIC achieves stable performance. Upsteam r8169 driver disables ASPM by default for this NIC. Signed-off-by: Pavel Kubelun Link: https://github.com/openwrt/openwrt/pull/18509 [bump release, fix commit description, split 2nd tx queue part] Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit f99b39fd0caf4ba5f1be06841b772557243c4546) --- package/kernel/r8125/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/kernel/r8125/Makefile b/package/kernel/r8125/Makefile index 9dde19437ad9fb..6a97143e1706d3 100644 --- a/package/kernel/r8125/Makefile +++ b/package/kernel/r8125/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=r8125 PKG_VERSION:=9.015.00 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://github.com/openwrt/rtl8125/releases/download/$(PKG_VERSION) @@ -23,6 +23,7 @@ define KernelPackage/r8125 AUTOLOAD:=$(call AutoProbe,r8125,1) PROVIDES:=kmod-r8169 VARIANT:=regular + PKG_MAKE_FLAGS += CONFIG_ASPM=n endef define KernelPackage/r8125-rss From a42c06d674769dcb194658cfcec4387b6dc5132a Mon Sep 17 00:00:00 2001 From: Pavel Kubelun Date: Wed, 16 Apr 2025 21:07:32 +0300 Subject: [PATCH 627/877] kernel: r8125: rss: enable ENABLE_MULTIPLE_TX_QUEUE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We need both ENABLE_RSS_SUPPORT and ENABLE_MULTIPLE_TX_QUEUE in order to support multiple RX and TX queues. Signed-off-by: Pavel Kubelun Link: https://github.com/openwrt/openwrt/pull/18509 [bump release, improve commit description and package changes] Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit d127963a4676909d2f58eb54859925a25cdaa063) --- package/kernel/r8125/Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/package/kernel/r8125/Makefile b/package/kernel/r8125/Makefile index 6a97143e1706d3..70b58198cc9c8c 100644 --- a/package/kernel/r8125/Makefile +++ b/package/kernel/r8125/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=r8125 PKG_VERSION:=9.015.00 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://github.com/openwrt/rtl8125/releases/download/$(PKG_VERSION) @@ -34,7 +34,9 @@ $(call KernelPackage/r8125) endef ifeq ($(BUILD_VARIANT),rss) - PKG_MAKE_FLAGS += ENABLE_RSS_SUPPORT=y + PKG_MAKE_FLAGS += \ + ENABLE_MULTIPLE_TX_QUEUE=y \ + ENABLE_RSS_SUPPORT=y endif define Build/Compile From c46ee416be7d50804143b92a217eb397d3e6797a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Wed, 23 Apr 2025 09:37:43 +0200 Subject: [PATCH 628/877] kernel: r8126: rss: enable ENABLE_MULTIPLE_TX_QUEUE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We need both ENABLE_RSS_SUPPORT and ENABLE_MULTIPLE_TX_QUEUE in order to support multiple RX and TX queues. Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit a3e51a395652ec6b8b827de396b56ebc576d81e8) --- package/kernel/r8126/Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/package/kernel/r8126/Makefile b/package/kernel/r8126/Makefile index 9f0f074d6235e0..cce9045b23b9d4 100644 --- a/package/kernel/r8126/Makefile +++ b/package/kernel/r8126/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=r8126 PKG_VERSION:=10.015.00 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://github.com/openwrt/rtl8126/releases/download/$(PKG_VERSION) @@ -33,7 +33,9 @@ $(call KernelPackage/r8126) endef ifeq ($(BUILD_VARIANT),rss) - PKG_MAKE_FLAGS += ENABLE_RSS_SUPPORT=y + PKG_MAKE_FLAGS += \ + ENABLE_MULTIPLE_TX_QUEUE=y \ + ENABLE_RSS_SUPPORT=y endif define Build/Compile From da59bc0a6bdf9d3ec3de5f017ccf73f81e9b64cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Wed, 23 Apr 2025 09:38:04 +0200 Subject: [PATCH 629/877] kernel: r8127: rss: enable ENABLE_MULTIPLE_TX_QUEUE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We need both ENABLE_RSS_SUPPORT and ENABLE_MULTIPLE_TX_QUEUE in order to support multiple RX and TX queues. Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 7615de6ef0830d3917de66aaf4d5df6d3ff45c61) --- package/kernel/r8127/Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/package/kernel/r8127/Makefile b/package/kernel/r8127/Makefile index b4b1c49eb5edd1..4a1035cc4cc31d 100644 --- a/package/kernel/r8127/Makefile +++ b/package/kernel/r8127/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=r8127 PKG_VERSION:=11.014.00 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://github.com/openwrt/rtl8127/releases/download/$(PKG_VERSION) @@ -33,7 +33,9 @@ $(call KernelPackage/r8127) endef ifeq ($(BUILD_VARIANT),rss) - PKG_MAKE_FLAGS += ENABLE_RSS_SUPPORT=y + PKG_MAKE_FLAGS += \ + ENABLE_MULTIPLE_TX_QUEUE=y \ + ENABLE_RSS_SUPPORT=y endif define Build/Compile From 49901245e5a958d5f955129006b2481273e71064 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Wed, 23 Apr 2025 09:39:24 +0200 Subject: [PATCH 630/877] kernel: r8168: add RSS variant MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of enabling RSS support, let's introduce a variant and let users choose between both variants since it can cause network issues. Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit cb3fc1aef9c01f23d7f740bf0c5f4b432d6d0e79) --- package/kernel/r8168/Makefile | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/package/kernel/r8168/Makefile b/package/kernel/r8168/Makefile index d35f3dc61cb4ea..98cf5ea35aa72c 100644 --- a/package/kernel/r8168/Makefile +++ b/package/kernel/r8168/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=r8168 PKG_VERSION:=8.055.00 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://github.com/openwrt/rtl8168/releases/download/$(PKG_VERSION) @@ -22,8 +22,22 @@ define KernelPackage/r8168 FILES:=$(PKG_BUILD_DIR)/src/r8168.ko AUTOLOAD:=$(call AutoProbe,r8168,1) PROVIDES:=kmod-r8169 + VARIANT:=regular endef +define KernelPackage/r8168-rss +$(call KernelPackage/r8168) + CONFLICTS:=kmod-r8168 + TITLE+= (RSS) + VARIANT:=rss +endef + +ifeq ($(BUILD_VARIANT),rss) + PKG_MAKE_FLAGS += \ + ENABLE_MULTIPLE_TX_QUEUE=y \ + ENABLE_RSS_SUPPORT=y +endif + define Build/Compile +$(KERNEL_MAKE) $(PKG_JOBS) \ M="$(PKG_BUILD_DIR)/src" \ @@ -31,3 +45,4 @@ define Build/Compile endef $(eval $(call KernelPackage,r8168)) +$(eval $(call KernelPackage,r8168-rss)) From 3a481ae21bdc504f7f0325151ee0cb4f25dfd2cd Mon Sep 17 00:00:00 2001 From: Weijie Gao Date: Wed, 23 Apr 2025 02:15:09 +0800 Subject: [PATCH 631/877] toolchain: mold: add PKG_NAME to Makefile In include/host-build.mk, HOST_BUILD_DIR is set by default value: HOST_BUILD_DIR ?= $(BUILD_DIR_HOST)/$(PKG_NAME) However the mold package has no PKG_NAME set at all. This means the HOST_BUILD_DIR is identical to $(BUILD_DIR_HOST). In the Host/Prepare stage, by default, the $(HOST_BUILD_DIR) will be deleted at first unconditionally. Since HOST_BUILD_DIR is identical to $(BUILD_DIR_HOST), the entire build_dir/toolchain-* directory will be removed and this will cause build failure. Adding PKG_NAME:=ld.mold can solve this issue. Signed-off-by: Weijie Gao Link: https://github.com/openwrt/openwrt/pull/18567 Signed-off-by: Robert Marko (cherry picked from commit b9cb07eced1de81b647608ee89a95d925c7c12a8) --- toolchain/mold/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/toolchain/mold/Makefile b/toolchain/mold/Makefile index a2acba89d3c808..60361841aaaf64 100644 --- a/toolchain/mold/Makefile +++ b/toolchain/mold/Makefile @@ -3,6 +3,9 @@ # See /LICENSE for more information. # include $(TOPDIR)/rules.mk + +PKG_NAME:=ld.mold + include $(INCLUDE_DIR)/toolchain-build.mk define Host/Configure From 274418b028b33bd77bac6e5984f584595d1cf352 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 24 Apr 2025 14:22:34 +0200 Subject: [PATCH 632/877] udebug: add missing dependencies Signed-off-by: Felix Fietkau (cherry picked from commit b0710e964df705079a09435e87b1ecc3058d33bf) --- package/libs/udebug/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/libs/udebug/Makefile b/package/libs/udebug/Makefile index bfb13cf788428b..42ca510be57d35 100644 --- a/package/libs/udebug/Makefile +++ b/package/libs/udebug/Makefile @@ -51,7 +51,7 @@ define Package/udebug-cli SECTION:=utils CATEGORY:=Utilities TITLE:=OpenWrt debug service CLI - DEPENDS:=+udebugd +ucode-mod-udebug + DEPENDS:=+udebugd +ucode-mod-udebug +ucode-mod-uloop +ucode-mod-ubus endef define Package/libudebug/install From 9b652e276f9d9bea40902c11cae39ca2c61e3f92 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Wed, 16 Apr 2025 11:42:54 +0200 Subject: [PATCH 633/877] tools: m4: set -std=gnu17 Fedora 42 updated to GCC15 which now defaults to GNU23 as the default instead of GNU17[1], and this breaks m4 compilation. Its been reported upstream [2], so until its fixed lets simply set C language version back to GNU17. [1] https://gcc.gnu.org/gcc-15/porting_to.html#c23 [2] https://savannah.gnu.org/support/?111150 Link: https://github.com/openwrt/openwrt/pull/18505 (cherry picked from commit 8c141e53d720b14a1d8595e0f756f1619df6e763) Link: https://github.com/openwrt/openwrt/pull/18581 Signed-off-by: Robert Marko --- tools/m4/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/m4/Makefile b/tools/m4/Makefile index ee369f3cbb3d99..c13155397d25f3 100644 --- a/tools/m4/Makefile +++ b/tools/m4/Makefile @@ -18,6 +18,7 @@ HOST_BUILD_PARALLEL:=1 include $(INCLUDE_DIR)/host-build.mk +HOST_CFLAGS += -std=gnu17 HOST_CONFIGURE_VARS += gl_cv_func_strstr_linear=no define Host/Uninstall From 5531dc7109017237d3ac6d9611a9231766c5c8fc Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Wed, 16 Apr 2025 13:56:22 +0200 Subject: [PATCH 634/877] tools: cpio: fix compilation with GCC15 Fedora 42 updated to GCC15 which now defaults to GNU23 as the default instead of GNU17[1], and this breaks cpio compilation. Its been reported upstream [2], so import the patch attached to the bug report that fixes compilation with GCC15. [1] https://gcc.gnu.org/gcc-15/porting_to.html#c23 [2] https://savannah.gnu.org/bugs/?66297 Link: https://github.com/openwrt/openwrt/pull/18506 (cherry picked from commit c5041094ba06b3cdfb9458f1cb5acb00a9cbacd3) Link: https://github.com/openwrt/openwrt/pull/18581 Signed-off-by: Robert Marko --- tools/cpio/patches/cpio-c23.patch | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tools/cpio/patches/cpio-c23.patch diff --git a/tools/cpio/patches/cpio-c23.patch b/tools/cpio/patches/cpio-c23.patch new file mode 100644 index 00000000000000..825f369d6e9004 --- /dev/null +++ b/tools/cpio/patches/cpio-c23.patch @@ -0,0 +1,23 @@ +--- a/src/extern.h ++++ b/src/extern.h +@@ -97,7 +97,8 @@ extern char input_is_special; + extern char output_is_special; + extern char input_is_seekable; + extern char output_is_seekable; +-extern int (*xstat) (); ++//void not good enough ++extern int (*xstat) (const char * restrict, struct stat * restrict); + extern void (*copy_function) (); + extern char *change_directory_option; + +--- a/src/global.c ++++ b/src/global.c +@@ -185,7 +185,7 @@ bool to_stdout_option = false; + + /* A pointer to either lstat or stat, depending on whether + dereferencing of symlinks is done for input files. */ +-int (*xstat) (); ++int (*xstat) (const char * restrict, struct stat * restrict); + + /* Which copy operation to perform. (-i, -o, -p) */ + void (*copy_function) () = 0; From 1e51fd037d780725ca31cc92b39078468a383295 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Wed, 16 Apr 2025 13:59:14 +0200 Subject: [PATCH 635/877] tools: elfutils: set -std=gnu17 Fedora 42 updated to GCC15 which now defaults to GNU23 as the default instead of GNU17[1], and this breaks m4 compilation. This looks like a gnulib issue, so until that is updated/fixed lets simply set C language version back to GNU17. [1] https://gcc.gnu.org/gcc-15/porting_to.html#c23 Link: https://github.com/openwrt/openwrt/pull/18506 (cherry picked from commit f165dd2f78f7aaafa85f59f5c35264dd03e3a6ce) Link: https://github.com/openwrt/openwrt/pull/18581 Signed-off-by: Robert Marko --- tools/elfutils/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/elfutils/Makefile b/tools/elfutils/Makefile index 2836cadc87d60b..ae829cd3400bd3 100644 --- a/tools/elfutils/Makefile +++ b/tools/elfutils/Makefile @@ -69,7 +69,7 @@ ifeq ($(HOST_OS),Darwin) HOST_CFLAGS += -I/opt/homebrew/include endif -HOST_CFLAGS += -Wno-error -fPIC +HOST_CFLAGS += -Wno-error -fPIC -std=gnu17 HOST_CONFIGURE_ARGS += \ --without-libintl-prefix \ From d9fccc8e1a246bfa10a62ffaf60328d7f65178ed Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Wed, 16 Apr 2025 14:04:26 +0200 Subject: [PATCH 636/877] tools: gmp: fix compilation with GCC15 Fedora 42 updated to GCC15 which now defaults to GNU23 as the default instead of GNU17[1], and this breaks GMP compilation by failing to find a working compiler test. Its been fixed upstream [2][3], so backport the fix to fix GCC15 compilation. [1] https://gcc.gnu.org/gcc-15/porting_to.html#c23 [2] https://gmplib.org/repo/gmp/rev/8e7bb4ae7a18 [3] https://gmplib.org/repo/gmp/rev/d66d66d82dbb Link: https://github.com/openwrt/openwrt/pull/18506 (cherry picked from commit 31800db91d43042813b7249a09fd61c356b39767) Link: https://github.com/openwrt/openwrt/pull/18581 Signed-off-by: Robert Marko --- .../patches/001-acinclude-m4-fix-std23.patch | 19 ++++++++++++++++ ...002-acinclude-m4-add-parameter-names.patch | 22 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 tools/gmp/patches/001-acinclude-m4-fix-std23.patch create mode 100644 tools/gmp/patches/002-acinclude-m4-add-parameter-names.patch diff --git a/tools/gmp/patches/001-acinclude-m4-fix-std23.patch b/tools/gmp/patches/001-acinclude-m4-fix-std23.patch new file mode 100644 index 00000000000000..05271764b7e574 --- /dev/null +++ b/tools/gmp/patches/001-acinclude-m4-fix-std23.patch @@ -0,0 +1,19 @@ +# HG changeset patch +# User Marc Glisse +# Date 1738186682 -3600 +# Wed Jan 29 22:38:02 2025 +0100 +# Node ID 8e7bb4ae7a18b1405ea7f9cbcda450b7d920a901 +# Parent e84c5c785bbe8ed8c3620194e50b65adfc2f5d83 +Complete function prototype in acinclude.m4 for C23 compatibility + +--- a/acinclude.m4 ++++ b/acinclude.m4 +@@ -609,7 +609,7 @@ GMP_PROG_CC_WORKS_PART([$1], [long long + + #if defined (__GNUC__) && ! defined (__cplusplus) + typedef unsigned long long t1;typedef t1*t2; +-void g(){} ++void g(int,t1 const*,t1,t2,t1 const*,int){} + void h(){} + static __inline__ t1 e(t2 rp,t2 up,int n,t1 v0) + {t1 c,x,r;int i;if(v0){c=1;for(i=1;i +# Date 1743513946 -7200 +# Tue Apr 01 15:25:46 2025 +0200 +# Node ID d66d66d82dbbe4f561920d28c1e1cbe6818452c7 +# Parent 1a2ad0e32507e842486c8ac9d5cdc772fd0c335e +Add parameter names to function prototype + + 2025-02-01 Marc Glisse + + * longlong.h (loongarch64 umul_ppmm): __int128__ -> __int128. +--- a/acinclude.m4 ++++ b/acinclude.m4 +@@ -609,7 +609,7 @@ GMP_PROG_CC_WORKS_PART([$1], [long long + + #if defined (__GNUC__) && ! defined (__cplusplus) + typedef unsigned long long t1;typedef t1*t2; +-void g(int,t1 const*,t1,t2,t1 const*,int){} ++void g(int a,t1 const*b,t1 c,t2 d,t1 const*e,int f){} + void h(){} + static __inline__ t1 e(t2 rp,t2 up,int n,t1 v0) + {t1 c,x,r;int i;if(v0){c=1;for(i=1;i Date: Tue, 22 Apr 2025 19:09:56 -0700 Subject: [PATCH 637/877] tools/squashfs3-lzma: fix compilation with GCC15 Function pointers require proper types now. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/18572 (cherry picked from commit d5c6452516fdc542696907e58543a549d834c630) Link: https://github.com/openwrt/openwrt/pull/18581 Signed-off-by: Robert Marko --- tools/squashfs3-lzma/patches/160-gcc15.patch | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tools/squashfs3-lzma/patches/160-gcc15.patch diff --git a/tools/squashfs3-lzma/patches/160-gcc15.patch b/tools/squashfs3-lzma/patches/160-gcc15.patch new file mode 100644 index 00000000000000..542fa52202457f --- /dev/null +++ b/tools/squashfs3-lzma/patches/160-gcc15.patch @@ -0,0 +1,20 @@ +--- a/squashfs-tools/mksquashfs.c ++++ b/squashfs-tools/mksquashfs.c +@@ -290,7 +290,7 @@ void restorefs() + } + + +-void sighandler() ++void sighandler(int i) + { + if(interrupted == 1) + restorefs(); +@@ -302,7 +302,7 @@ void sighandler() + } + + +-void sighandler2() ++void sighandler2(int i) + { + EXIT_MKSQUASHFS(); + } From 5462cba522c7cef66145305a049713883938aa05 Mon Sep 17 00:00:00 2001 From: John Audia Date: Fri, 10 Jan 2025 15:26:29 -0500 Subject: [PATCH 638/877] tools/e2fsprogs: update to 1.47.2 Release information (not yet published): https://e2fsprogs.sourceforge.net/e2fsprogs-release.html#1.47.2 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/17499 Signed-off-by: Hauke Mehrtens (cherry picked from commit 40e2710dfad800e3dd81882bf1ddd429b2ce7180) Link: https://github.com/openwrt/openwrt/pull/18581 Signed-off-by: Robert Marko --- tools/e2fsprogs/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/e2fsprogs/Makefile b/tools/e2fsprogs/Makefile index 50c3888b642b4b..5deee081609b66 100644 --- a/tools/e2fsprogs/Makefile +++ b/tools/e2fsprogs/Makefile @@ -9,10 +9,10 @@ include $(TOPDIR)/rules.mk PKG_NAME:=e2fsprogs PKG_CPE_ID:=cpe:/a:e2fsprogs_project:e2fsprogs -PKG_VERSION:=1.47.0 -PKG_HASH:=0b4fe723d779b0927fb83c9ae709bc7b40f66d7df36433bef143e41c54257084 +PKG_VERSION:=1.47.2 +PKG_HASH:=08242e64ca0e8194d9c1caad49762b19209a06318199b63ce74ae4ef2d74e63c -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/kernel/people/tytso/e2fsprogs/v$(PKG_VERSION)/ HOST_BUILD_PARALLEL:=1 From e0069e7587bbcd47821691586bffe65ec7b49534 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Fri, 18 Apr 2025 12:40:50 +0200 Subject: [PATCH 639/877] jsonfilter: update to Git HEAD (2025-04-18) 8a86fb78235b build: set GNU17 for lemon compilation Link: https://github.com/openwrt/openwrt/pull/18525 (cherry picked from commit 891c8244f2b346b00190d25bd6970cf755a4aaa6) Link: https://github.com/openwrt/openwrt/pull/18581 Signed-off-by: Robert Marko --- 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 d249ea1a369da7..928ba1207b314e 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:=2024-01-23 -PKG_SOURCE_VERSION:=594cfa86469c005972ba750614f5b3f1af84d0f6 -PKG_MIRROR_HASH:=2f455f04fbfcdb4c81cccd23475b47395f847db44aa4bd9a1007b9aa0ab7fd19 +PKG_SOURCE_DATE:=2025-04-18 +PKG_SOURCE_VERSION:=8a86fb78235b5d7925b762b7b0934517890cc034 +PKG_MIRROR_HASH:=06b763387d00faae0e62af68626588ff2b8f12e0e6821950ae5422033df32757 CMAKE_INSTALL:=1 PKG_MAINTAINER:=Jo-Philipp Wich From 78d517a18cf32402eac016d92d7bb8cc8b586119 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Thu, 24 Apr 2025 12:31:30 +0200 Subject: [PATCH 640/877] toolchain: gdb: set -std=gnu17 Fedora 42 updated to GCC15 which now defaults to GNU23 as the default instead of GNU17[1], and this breaks gdb compilation. This looks like a readline issue, that was fixed in GDB 16.2 but to not update toolchain components we can simply set the C standard back to GNU17. [1] https://gcc.gnu.org/gcc-15/porting_to.html#c23 Link: https://github.com/openwrt/openwrt/pull/18581 Signed-off-by: Robert Marko --- toolchain/gdb/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/toolchain/gdb/Makefile b/toolchain/gdb/Makefile index 9b9ee5a9d8d13a..ad0c843f75d7ec 100644 --- a/toolchain/gdb/Makefile +++ b/toolchain/gdb/Makefile @@ -56,6 +56,8 @@ else HOST_CONFIGURE_ARGS+= --without-python endif +HOST_CFLAGS += -std=gnu17 + define Host/Install mkdir -p $(TOOLCHAIN_DIR)/bin $(INSTALL_BIN) $(HOST_BUILD_DIR)/gdb/gdb $(TOOLCHAIN_DIR)/bin/$(TARGET_CROSS)gdb From 0b392b925fa16c40dccc487753a4412bd054cd63 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 26 Apr 2025 19:10:54 +0200 Subject: [PATCH 641/877] kernel: fix UDPv6 GSO segmentation with NAT Fixes issues with rx-gro-list and NAT66 Fixes: https://github.com/openwrt/openwrt/issues/18387 Fixes: https://github.com/openwrt/openwrt/issues/18516 Fixes: https://github.com/openwrt/openwrt/issues/18608 Signed-off-by: Felix Fietkau (cherry picked from commit 5501a502e499e0202bdfd0feebbbedb012d5f82b) --- ...-fix-UDPv6-GSO-segmentation-with-NAT.patch | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 target/linux/generic/pending-6.6/691-net-ipv6-fix-UDPv6-GSO-segmentation-with-NAT.patch diff --git a/target/linux/generic/pending-6.6/691-net-ipv6-fix-UDPv6-GSO-segmentation-with-NAT.patch b/target/linux/generic/pending-6.6/691-net-ipv6-fix-UDPv6-GSO-segmentation-with-NAT.patch new file mode 100644 index 00000000000000..6bbe2ca880e839 --- /dev/null +++ b/target/linux/generic/pending-6.6/691-net-ipv6-fix-UDPv6-GSO-segmentation-with-NAT.patch @@ -0,0 +1,88 @@ +From: Felix Fietkau +Date: Sat, 26 Apr 2025 17:18:03 +0200 +Subject: [PATCH] net: ipv6: fix UDPv6 GSO segmentation with NAT + +If any address or port is changed, update it in all packets and recalculate +checksum. + +Fixes: 9fd1ff5d2ac7 ("udp: Support UDP fraglist GRO/GSO.") +Signed-off-by: Felix Fietkau +--- + +--- a/net/ipv4/udp_offload.c ++++ b/net/ipv4/udp_offload.c +@@ -247,6 +247,62 @@ static struct sk_buff *__udpv4_gso_segme + return segs; + } + ++static void __udpv6_gso_segment_csum(struct sk_buff *seg, ++ struct in6_addr *oldip, ++ const struct in6_addr *newip, ++ __be16 *oldport, __be16 newport) ++{ ++ struct udphdr *uh = udp_hdr(seg); ++ ++ if (ipv6_addr_equal(oldip, newip) && *oldport == newport) ++ return; ++ ++ if (uh->check) { ++ inet_proto_csum_replace16(&uh->check, seg, oldip->s6_addr32, ++ newip->s6_addr32, true); ++ ++ inet_proto_csum_replace2(&uh->check, seg, *oldport, newport, ++ false); ++ if (!uh->check) ++ uh->check = CSUM_MANGLED_0; ++ } ++ ++ *oldip = *newip; ++ *oldport = newport; ++} ++ ++static struct sk_buff *__udpv6_gso_segment_list_csum(struct sk_buff *segs) ++{ ++ const struct ipv6hdr *iph; ++ const struct udphdr *uh; ++ struct ipv6hdr *iph2; ++ struct sk_buff *seg; ++ struct udphdr *uh2; ++ ++ seg = segs; ++ uh = udp_hdr(seg); ++ iph = ipv6_hdr(seg); ++ uh2 = udp_hdr(seg->next); ++ iph2 = ipv6_hdr(seg->next); ++ ++ if (!(*(const u32 *)&uh->source ^ *(const u32 *)&uh2->source) && ++ ipv6_addr_equal(&iph->saddr, &iph2->saddr) && ++ ipv6_addr_equal(&iph->daddr, &iph2->daddr)) ++ return segs; ++ ++ while ((seg = seg->next)) { ++ uh2 = udp_hdr(seg); ++ iph2 = ipv6_hdr(seg); ++ ++ __udpv6_gso_segment_csum(seg, &iph2->saddr, &iph->saddr, ++ &uh2->source, uh->source); ++ __udpv6_gso_segment_csum(seg, &iph2->daddr, &iph->daddr, ++ &uh2->dest, uh->dest); ++ } ++ ++ return segs; ++} ++ + static struct sk_buff *__udp_gso_segment_list(struct sk_buff *skb, + netdev_features_t features, + bool is_ipv6) +@@ -259,7 +315,10 @@ static struct sk_buff *__udp_gso_segment + + udp_hdr(skb)->len = htons(sizeof(struct udphdr) + mss); + +- return is_ipv6 ? skb : __udpv4_gso_segment_list_csum(skb); ++ if (is_ipv6) ++ return __udpv6_gso_segment_list_csum(skb); ++ else ++ return __udpv4_gso_segment_list_csum(skb); + } + + struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb, From cc1b909a6b2b6524ed973fdad32a6fd92db1d23e Mon Sep 17 00:00:00 2001 From: David Bauer Date: Tue, 29 Apr 2025 19:31:09 +0200 Subject: [PATCH 642/877] ramips: make Genexis EX400 factory image dependent on initramfs The factory image generation for the Genexis EX400 image currently fails if CONFIG_TARGET_ROOTFS_INITRAMFS is disabled. Create the factory image only if said config option is enabled to avoid failing builds. Signed-off-by: David Bauer (cherry picked from commit 4e83d5ec26e297380906313283b2eeaef2a5f5fe) --- 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 7674d0274d3713..d8641223a3a5e8 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -1389,9 +1389,11 @@ define Device/genexis_pulse-ex400/common --log-lebs=2 --space-fixup --squash-uids KERNEL := kernel-bin | lzma | uImage lzma KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | uImage lzma +ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) IMAGES += factory.bin IMAGE/factory.bin := append-image-stage initramfs-kernel.bin | \ inteno-bootfs | inteno-y3-header EX400 | append-md5sum-ascii-salted +endif IMAGE/sysupgrade.bin := append-kernel | inteno-bootfs | \ sysupgrade-tar kernel=$$$$@ | check-size | append-metadata DEVICE_IMG_NAME = $$(DEVICE_IMG_PREFIX)-$$(2) From 069f988d9dbf68e90c3dddbb95391f1a6bebb590 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Fri, 2 May 2025 11:07:54 +0200 Subject: [PATCH 643/877] toolchain: binutils: fix compilation with GCC15 GCC15 has switched the C language default from GNU17 to GNU23[1] and this causes builds to fail with: In file included from mips-opc.c:29: mips-opc.c: In function 'decode_mips_operand': mips-formats.h:86:7: error: expected identifier or '(' before 'static_assert' 86 | static_assert[(1 << (SIZE)) == ARRAY_SIZE (MAP)]; \ | ^~~~~~~~~~~~~ mips-opc.c:214:15: note: in expansion of macro 'MAPPED_REG' 214 | case 'z': MAPPED_REG (0, 0, GP, reg_0_map); | ^~~~~~~~~~ So, backport upstream fix for this[2] to fix compilation with GCC15. Patch for 2.40 was manually refreshed as part of the S390 code does not exist in 2.40 as it was added after it. [1] https://gcc.gnu.org/gcc-15/porting_to.html#c23 [2] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=8ebe62f3f0d27806b1bf69f301f5e188b4acd2b4 Fixes: #18678 Link: https://github.com/openwrt/openwrt/pull/18681 Signed-off-by: Robert Marko (cherry picked from commit d3216173abfc47917807423fc7578406ea29db5b) --- ...gnu23-compatibility-wrt-static_asser.patch | 66 ++++++++++++++++ ...gnu23-compatibility-wrt-static_asser.patch | 78 +++++++++++++++++++ ...gnu23-compatibility-wrt-static_asser.patch | 78 +++++++++++++++++++ 3 files changed, 222 insertions(+) create mode 100644 toolchain/binutils/patches/2.40/050-PR-32372-opcodes-fix-std-gnu23-compatibility-wrt-static_asser.patch create mode 100644 toolchain/binutils/patches/2.42/003-PR-32372-opcodes-fix-std-gnu23-compatibility-wrt-static_asser.patch create mode 100644 toolchain/binutils/patches/2.43.1/003-PR-32372-opcodes-fix-std-gnu23-compatibility-wrt-static_asser.patch diff --git a/toolchain/binutils/patches/2.40/050-PR-32372-opcodes-fix-std-gnu23-compatibility-wrt-static_asser.patch b/toolchain/binutils/patches/2.40/050-PR-32372-opcodes-fix-std-gnu23-compatibility-wrt-static_asser.patch new file mode 100644 index 00000000000000..3364e9ae04cf53 --- /dev/null +++ b/toolchain/binutils/patches/2.40/050-PR-32372-opcodes-fix-std-gnu23-compatibility-wrt-static_asser.patch @@ -0,0 +1,66 @@ +From 8ebe62f3f0d27806b1bf69f301f5e188b4acd2b4 Mon Sep 17 00:00:00 2001 +From: Sam James +Date: Sat, 16 Nov 2024 05:03:52 +0000 +Subject: [PATCH] opcodes: fix -std=gnu23 compatibility wrt static_assert + +static_assert is declared in C23 so we can't reuse that identifier: +* Define our own static_assert conditionally; + +* Rename "static assert" hacks to _N as we do already in some places + to avoid a conflict. + +ChangeLog: + PR ld/32372 + + * i386-gen.c (static_assert): Define conditionally. + * mips-formats.h (MAPPED_INT): Rename identifier. + (MAPPED_REG): Rename identifier. + (OPTIONAL_MAPPED_REG): Rename identifier. + * s390-opc.c (static_assert): Define conditionally. +--- + opcodes/i386-gen.c | 2 ++ + opcodes/mips-formats.h | 6 +++--- + opcodes/s390-opc.c | 2 ++ + 3 files changed, 7 insertions(+), 3 deletions(-) + +--- a/opcodes/i386-gen.c ++++ b/opcodes/i386-gen.c +@@ -33,7 +33,9 @@ + + /* Build-time checks are preferrable over runtime ones. Use this construct + in preference where possible. */ ++#ifndef static_assert + #define static_assert(e) ((void)sizeof (struct { int _:1 - 2 * !(e); })) ++#endif + + static const char *program_name = NULL; + static int debug = 0; +--- a/opcodes/mips-formats.h ++++ b/opcodes/mips-formats.h +@@ -49,7 +49,7 @@ + #define MAPPED_INT(SIZE, LSB, MAP, PRINT_HEX) \ + { \ + typedef char ATTRIBUTE_UNUSED \ +- static_assert[(1 << (SIZE)) == ARRAY_SIZE (MAP)]; \ ++ static_assert_3[(1 << (SIZE)) == ARRAY_SIZE (MAP)]; \ + static const struct mips_mapped_int_operand op = { \ + { OP_MAPPED_INT, SIZE, LSB }, MAP, PRINT_HEX \ + }; \ +@@ -83,7 +83,7 @@ + #define MAPPED_REG(SIZE, LSB, BANK, MAP) \ + { \ + typedef char ATTRIBUTE_UNUSED \ +- static_assert[(1 << (SIZE)) == ARRAY_SIZE (MAP)]; \ ++ static_assert_4[(1 << (SIZE)) == ARRAY_SIZE (MAP)]; \ + static const struct mips_reg_operand op = { \ + { OP_REG, SIZE, LSB }, OP_REG_##BANK, MAP \ + }; \ +@@ -93,7 +93,7 @@ + #define OPTIONAL_MAPPED_REG(SIZE, LSB, BANK, MAP) \ + { \ + typedef char ATTRIBUTE_UNUSED \ +- static_assert[(1 << (SIZE)) == ARRAY_SIZE (MAP)]; \ ++ static_assert_5[(1 << (SIZE)) == ARRAY_SIZE (MAP)]; \ + static const struct mips_reg_operand op = { \ + { OP_OPTIONAL_REG, SIZE, LSB }, OP_REG_##BANK, MAP \ + }; \ diff --git a/toolchain/binutils/patches/2.42/003-PR-32372-opcodes-fix-std-gnu23-compatibility-wrt-static_asser.patch b/toolchain/binutils/patches/2.42/003-PR-32372-opcodes-fix-std-gnu23-compatibility-wrt-static_asser.patch new file mode 100644 index 00000000000000..9454f3fa9f2374 --- /dev/null +++ b/toolchain/binutils/patches/2.42/003-PR-32372-opcodes-fix-std-gnu23-compatibility-wrt-static_asser.patch @@ -0,0 +1,78 @@ +From 8ebe62f3f0d27806b1bf69f301f5e188b4acd2b4 Mon Sep 17 00:00:00 2001 +From: Sam James +Date: Sat, 16 Nov 2024 05:03:52 +0000 +Subject: [PATCH] opcodes: fix -std=gnu23 compatibility wrt static_assert + +static_assert is declared in C23 so we can't reuse that identifier: +* Define our own static_assert conditionally; + +* Rename "static assert" hacks to _N as we do already in some places + to avoid a conflict. + +ChangeLog: + PR ld/32372 + + * i386-gen.c (static_assert): Define conditionally. + * mips-formats.h (MAPPED_INT): Rename identifier. + (MAPPED_REG): Rename identifier. + (OPTIONAL_MAPPED_REG): Rename identifier. + * s390-opc.c (static_assert): Define conditionally. +--- + opcodes/i386-gen.c | 2 ++ + opcodes/mips-formats.h | 6 +++--- + opcodes/s390-opc.c | 2 ++ + 3 files changed, 7 insertions(+), 3 deletions(-) + +--- a/opcodes/i386-gen.c ++++ b/opcodes/i386-gen.c +@@ -30,7 +30,9 @@ + + /* Build-time checks are preferrable over runtime ones. Use this construct + in preference where possible. */ ++#ifndef static_assert + #define static_assert(e) ((void)sizeof (struct { int _:1 - 2 * !(e); })) ++#endif + + static const char *program_name = NULL; + static int debug = 0; +--- a/opcodes/mips-formats.h ++++ b/opcodes/mips-formats.h +@@ -49,7 +49,7 @@ + #define MAPPED_INT(SIZE, LSB, MAP, PRINT_HEX) \ + { \ + typedef char ATTRIBUTE_UNUSED \ +- static_assert[(1 << (SIZE)) == ARRAY_SIZE (MAP)]; \ ++ static_assert_3[(1 << (SIZE)) == ARRAY_SIZE (MAP)]; \ + static const struct mips_mapped_int_operand op = { \ + { OP_MAPPED_INT, SIZE, LSB }, MAP, PRINT_HEX \ + }; \ +@@ -83,7 +83,7 @@ + #define MAPPED_REG(SIZE, LSB, BANK, MAP) \ + { \ + typedef char ATTRIBUTE_UNUSED \ +- static_assert[(1 << (SIZE)) == ARRAY_SIZE (MAP)]; \ ++ static_assert_4[(1 << (SIZE)) == ARRAY_SIZE (MAP)]; \ + static const struct mips_reg_operand op = { \ + { OP_REG, SIZE, LSB }, OP_REG_##BANK, MAP \ + }; \ +@@ -93,7 +93,7 @@ + #define OPTIONAL_MAPPED_REG(SIZE, LSB, BANK, MAP) \ + { \ + typedef char ATTRIBUTE_UNUSED \ +- static_assert[(1 << (SIZE)) == ARRAY_SIZE (MAP)]; \ ++ static_assert_5[(1 << (SIZE)) == ARRAY_SIZE (MAP)]; \ + static const struct mips_reg_operand op = { \ + { OP_OPTIONAL_REG, SIZE, LSB }, OP_REG_##BANK, MAP \ + }; \ +--- a/opcodes/s390-opc.c ++++ b/opcodes/s390-opc.c +@@ -36,7 +36,9 @@ + + /* Build-time checks are preferrable over runtime ones. Use this construct + in preference where possible. */ ++#ifndef static_assert + #define static_assert(e) ((void)sizeof (struct { int _:1 - 2 * !(e); })) ++#endif + + #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) + diff --git a/toolchain/binutils/patches/2.43.1/003-PR-32372-opcodes-fix-std-gnu23-compatibility-wrt-static_asser.patch b/toolchain/binutils/patches/2.43.1/003-PR-32372-opcodes-fix-std-gnu23-compatibility-wrt-static_asser.patch new file mode 100644 index 00000000000000..9454f3fa9f2374 --- /dev/null +++ b/toolchain/binutils/patches/2.43.1/003-PR-32372-opcodes-fix-std-gnu23-compatibility-wrt-static_asser.patch @@ -0,0 +1,78 @@ +From 8ebe62f3f0d27806b1bf69f301f5e188b4acd2b4 Mon Sep 17 00:00:00 2001 +From: Sam James +Date: Sat, 16 Nov 2024 05:03:52 +0000 +Subject: [PATCH] opcodes: fix -std=gnu23 compatibility wrt static_assert + +static_assert is declared in C23 so we can't reuse that identifier: +* Define our own static_assert conditionally; + +* Rename "static assert" hacks to _N as we do already in some places + to avoid a conflict. + +ChangeLog: + PR ld/32372 + + * i386-gen.c (static_assert): Define conditionally. + * mips-formats.h (MAPPED_INT): Rename identifier. + (MAPPED_REG): Rename identifier. + (OPTIONAL_MAPPED_REG): Rename identifier. + * s390-opc.c (static_assert): Define conditionally. +--- + opcodes/i386-gen.c | 2 ++ + opcodes/mips-formats.h | 6 +++--- + opcodes/s390-opc.c | 2 ++ + 3 files changed, 7 insertions(+), 3 deletions(-) + +--- a/opcodes/i386-gen.c ++++ b/opcodes/i386-gen.c +@@ -30,7 +30,9 @@ + + /* Build-time checks are preferrable over runtime ones. Use this construct + in preference where possible. */ ++#ifndef static_assert + #define static_assert(e) ((void)sizeof (struct { int _:1 - 2 * !(e); })) ++#endif + + static const char *program_name = NULL; + static int debug = 0; +--- a/opcodes/mips-formats.h ++++ b/opcodes/mips-formats.h +@@ -49,7 +49,7 @@ + #define MAPPED_INT(SIZE, LSB, MAP, PRINT_HEX) \ + { \ + typedef char ATTRIBUTE_UNUSED \ +- static_assert[(1 << (SIZE)) == ARRAY_SIZE (MAP)]; \ ++ static_assert_3[(1 << (SIZE)) == ARRAY_SIZE (MAP)]; \ + static const struct mips_mapped_int_operand op = { \ + { OP_MAPPED_INT, SIZE, LSB }, MAP, PRINT_HEX \ + }; \ +@@ -83,7 +83,7 @@ + #define MAPPED_REG(SIZE, LSB, BANK, MAP) \ + { \ + typedef char ATTRIBUTE_UNUSED \ +- static_assert[(1 << (SIZE)) == ARRAY_SIZE (MAP)]; \ ++ static_assert_4[(1 << (SIZE)) == ARRAY_SIZE (MAP)]; \ + static const struct mips_reg_operand op = { \ + { OP_REG, SIZE, LSB }, OP_REG_##BANK, MAP \ + }; \ +@@ -93,7 +93,7 @@ + #define OPTIONAL_MAPPED_REG(SIZE, LSB, BANK, MAP) \ + { \ + typedef char ATTRIBUTE_UNUSED \ +- static_assert[(1 << (SIZE)) == ARRAY_SIZE (MAP)]; \ ++ static_assert_5[(1 << (SIZE)) == ARRAY_SIZE (MAP)]; \ + static const struct mips_reg_operand op = { \ + { OP_OPTIONAL_REG, SIZE, LSB }, OP_REG_##BANK, MAP \ + }; \ +--- a/opcodes/s390-opc.c ++++ b/opcodes/s390-opc.c +@@ -36,7 +36,9 @@ + + /* Build-time checks are preferrable over runtime ones. Use this construct + in preference where possible. */ ++#ifndef static_assert + #define static_assert(e) ((void)sizeof (struct { int _:1 - 2 * !(e); })) ++#endif + + #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) + From 99708cc16dbd7c93db80698fbe5c69f07995a3e6 Mon Sep 17 00:00:00 2001 From: Christoph Krapp Date: Mon, 14 Apr 2025 20:47:56 +0200 Subject: [PATCH 644/877] mediatek: filogic: add support for ASUS RT-AX52 Hardware -------- SOC: MediaTek MT7981b RAM: 256MB DDR3 FLASH: 128MB SPI-NAND (Winbond W25N01GV) WIFI: Mediatek MT7981b DBDC 802.11ax 2.4/5 GHz ETH: MediaTek MT7531 Switch UART: 3V3 115200 8N1 (Pinout silkscreened / Do not connect VCC) Installation ----------------------------------------------------------- Vendor-UI Method ----------------------------------------------------------- 1. Download the OpenWrt initramfs.trx image. 2. Connect the PC via LAN to one of the yellow router ports and wait until your PC to get a DHCP lease. 3. Browse to http://192.168.50.1 4. If your router is brand new, finish the setup process and log into the Web-UI. 5. Navigate to Administration -> Firmware Upgrade and upload the downloaded OpenWrt image. 6. Wait for OpenWrt to boot. Transfer the sysupgrade image to the device using scp and install using sysupgrade. $ sysupgrade -n ----------------------------------------------------------- TFTP Method ----------------------------------------------------------- 1. Download the OpenWrt initramfs image. Copy the image to a TFTP server reachable at 192.168.1.70/24. Rename the image to rtax52.bin. 2. Connect the PC with TFTP server to the RT-AX52. 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. 3. Download & Boot the OpenWrt initramfs image. $ setenv ipaddr 192.168.1.1 $ setenv serverip 192.168.1.70 $ tftpboot 0x46000000 rtax52.bin $ bootm 0x46000000 4. Wait for OpenWrt to boot. Transfer the sysupgrade image to the device using scp and install using sysupgrade. $ sysupgrade -n --------------------------------------------------------------------------- Revert to stock firmware: 1: Download the rt-ax52 firmware from ASUS official website. Save the firmware to tftp server directory and rename to RT-AX52.trx 2: Connect the PC with TFTP server to the RT-AX52. Set a static ip on the ethernet interface of your PC. (ip address: 192.168.1.70, subnet mask:255.255.255.0) 3: Conect to the serial console, power on again, interrupt the autoboot process by pressing '4' when prompted. $: ubi remove linux $: ubi remove jffs2 $: ubi remove rootfs $: ubi remove rootfs_data $: ubi create linux 0x45fe000 $: reset Then the dut will reboot,interrupt the autoboot process by pressing '2' when prompted. 2: Load System code then write to Flash via TFTP. Warning!! Erase Linux in Flash then burn new one. Are you sure?(Y/N) $: enter y you will see the follow, type enter directly: Input device IP (192.168.1.1) ==: Input server IP (192.168.1.70) ==: Input Linux Kernel filename (RT-AX52.trx) ==: 4: wait for the device run up Based on support for ASUS RT-AX52 by liudongdongdong7397 and trx image generation by remittor Signed-off-by: Christoph Krapp (cherry picked from commit 50d9ca6e5a04724e4263a348bdbe5ff4b1c43998) (remove factory image generation) Signed-off-by: David Bauer --- .../mediatek/dts/mt7981b-asus-rt-ax52.dts | 301 ++++++++++++++++++ .../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 | 1 + .../base-files/lib/upgrade/platform.sh | 2 + target/linux/mediatek/image/filogic.mk | 15 + 6 files changed, 323 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7981b-asus-rt-ax52.dts diff --git a/target/linux/mediatek/dts/mt7981b-asus-rt-ax52.dts b/target/linux/mediatek/dts/mt7981b-asus-rt-ax52.dts new file mode 100644 index 00000000000000..7f4926b4936a4c --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-asus-rt-ax52.dts @@ -0,0 +1,301 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; +#include "mt7981.dtsi" +/ { + model = "ASUS RT-AX52"; + compatible = "asus,rt-ax52", "mediatek,mt7981"; + + aliases { + serial0 = &uart0; + label-mac-device = &gmac0; + led-boot = &led_system; + led-failsafe = &led_system; + led-running = &led_system; + led-upgrade = &led_system; + }; + + chosen { + stdout-path = "serial0:115200n8"; + bootargs-override = ""; + }; + + memory { + reg = <0 0x40000000 0 0x10000000>; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + wlan24 { + function = LED_FUNCTION_WLAN_2GHZ; + color = ; + gpios = <&pio 34 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + wlan5 { + function = LED_FUNCTION_WLAN_5GHZ; + color = ; + gpios = <&pio 35 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + + wan { + function = LED_FUNCTION_WAN; + color = ; + gpios = <&pio 8 GPIO_ACTIVE_LOW>; + }; + + led_system: system { + label = "blue:system"; + gpios = <&pio 12 GPIO_ACTIVE_HIGH>; + }; + }; + + timer { + clock-frequency = <12996791>; + }; +}; + +&uart0 { + status = "okay"; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + /* LAN */ + compatible = "mediatek,eth-mac"; + reg = <0>; + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + gmac1: mac@1 { + /* WAN */ + compatible = "mediatek,eth-mac"; + reg = <1>; + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; + phy-mode = "gmii"; + phy-handle = <&phy0>; + label = "wan"; + }; + + mdio: mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + + phy0: ethernet-phy@0 { + compatible = "ethernet-phy-id03a2.9461"; + reg = <0>; + phy-mode = "gmii"; + #nvmem-cells = <&phy_calibration>; + #nvmem-cell-names = "phy-cal-data"; + }; + + switch@1f { + compatible = "mediatek,mt7531"; + reg = <31>; + reset-gpios = <&pio 39 0>; + + 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>; + 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: flash@0 { + compatible = "u-boot-dont-touch-spi-nand"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0>; + + spi-max-frequency = <52000000>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + + /* + * ASUS bootloader tries to replace the partitions defined in + * Device Tree and by that also deletes all additional properties + * needed for UBI and NVMEM-on-UBI. + * Prevent this from happening by tricking the loader to delete and + * replace a bait node instead (works with older bootloaders). + */ + partitions: dummy { + compatible = "u-boot-dummy-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + reg = <0x0 0x0>; + label = "remove_me"; + }; + }; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + reg = <0x0 0x400000>; + label = "bootloader"; + read-only; + }; + + partition@400000 { + compatible = "linux,ubi"; + reg = <0x400000 0xfc00000>; + label = "UBI_DEV"; + + volumes { + ubi_factory: ubi-volume-factory { + volname = "Factory"; + }; + }; + }; + }; + }; +}; + +&ubi_factory { + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x1000>; + }; + + macaddr_factory_4: macaddr@4 { + reg = <0x4 0x6>; + }; + }; +}; + +&spi1 { + pinctrl-names = "default"; + pinctrl-0 = <&spic_pins>; + status = "disabled"; +}; + +&pio { + i2c_pins: i2c-pins-g0 { + mux { + function = "i2c"; + groups = "i2c0_0"; + }; + }; + + 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 = ; + }; + }; + + spic_pins: spi1-pins { + mux { + function = "spi"; + groups = "spi1_1"; + }; + }; + + uart1_pins: uart1-pins-g1 { + mux { + function = "uart"; + groups = "uart1_1"; + }; + }; + + uart2_pins: uart2-pins-g1 { + mux { + function = "uart"; + groups = "uart2_1"; + }; + }; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; + + 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 840072a556257a..326f09341d7797 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 @@ -11,6 +11,9 @@ abt,asr3000) ucidef_set_led_netdev "wlan2g" "WLAN2G" "green:wlan-2ghz" "phy0-ap0" ucidef_set_led_netdev "wlan5g" "WLAN5G" "green:wlan-5ghz" "phy1-ap0" ;; +asus,rt-ax52) + ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan" "link tx rx" + ;; 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" 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 7d9610d62c6057..d970b2385864de 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,7 @@ mediatek_setup_interfaces() arcadyan,mozart) ucidef_set_interfaces_lan_wan "lan0 eth1" eth2 ;; + asus,rt-ax52|\ asus,rt-ax59u|\ cetron,ct3003|\ cmcc,a10-stock|\ 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 8b9499b319f43b..194154c0432d4c 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,6 +37,7 @@ case "$board" in macaddr_setbit_la $(macaddr_setbit $(macaddr_add $addr 1) 28) > \ /sys${DEVPATH}/macaddress ;; + asus,rt-ax52|\ 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 89aeaadedb2db3..f5e8ba962d73c6 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -116,6 +116,7 @@ platform_do_upgrade() { CI_ROOTPART="rootfs" emmc_do_upgrade "$1" ;; + asus,rt-ax52|\ asus,rt-ax59u|\ asus,tuf-ax4200|\ asus,tuf-ax6000) @@ -240,6 +241,7 @@ platform_pre_upgrade() { local board=$(board_name) case "$board" in + asus,rt-ax52|\ asus,rt-ax59u|\ asus,tuf-ax4200|\ asus,tuf-ax6000) diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 60f45a73e674c9..8f4090a74fb606 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -258,6 +258,21 @@ $(call Device/adtran_smartrg) endef TARGET_DEVICES += smartrg_sdg-8734 +define Device/asus_rt-ax52 + DEVICE_VENDOR := ASUS + DEVICE_MODEL := RT-AX52 + DEVICE_DTS := mt7981b-asus-rt-ax52 + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-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_rt-ax52 + define Device/asus_rt-ax59u DEVICE_VENDOR := ASUS DEVICE_MODEL := RT-AX59U From 02422b04d4942316e441252efd83959a5647102b Mon Sep 17 00:00:00 2001 From: Tim Harvey Date: Mon, 14 Apr 2025 10:34:31 -0700 Subject: [PATCH 645/877] imx: coretexa53: add network config for single-port Gateworks Venice boards Add network config for single-port Gateworks venice boards such that the ethernet port is the WAN port instead of the default being a LAN port. Signed-off-by: Tim Harvey Link: https://github.com/openwrt/openwrt/pull/18629 Signed-off-by: Robert Marko (cherry picked from commit 2d6f0275f89428ff8da5f796e6e446b2b3f95a7c) --- .../linux/imx/cortexa53/base-files/etc/board.d/02_network | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/target/linux/imx/cortexa53/base-files/etc/board.d/02_network b/target/linux/imx/cortexa53/base-files/etc/board.d/02_network index 94a982aee90b92..f16826156ec312 100644 --- a/target/linux/imx/cortexa53/base-files/etc/board.d/02_network +++ b/target/linux/imx/cortexa53/base-files/etc/board.d/02_network @@ -5,6 +5,14 @@ board=$(board_name) board_config_update case "$board" in +gw,imx8mm-gw71xx-0x|\ +gateworks,imx8mp-gw71xx-2x|\ +gateworks,imx8mm-gw75xx-0x|\ +gateworks,imx8mp-gw75xx-2x|\ +gw,imx8mm-gw7903|\ +gateworks,imx8mm-gw7904) + ucidef_set_interface_wan 'eth0' + ;; gw,imx8mm-gw72xx-0x|\ gw,imx8mp-gw72xx-2x|\ gw,imx8mm-gw73xx-0x|\ From c9de6f06db28db88a217fa30572b748509148f1f Mon Sep 17 00:00:00 2001 From: Dave Marquard Date: Tue, 6 May 2025 02:33:59 +0000 Subject: [PATCH 646/877] linux-firmware: add Raspberry Pi 5 CM NVRAM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The RPi 5 Compute Module expects the same NVRAM as the one from RPi 4 on a different file. Signed-off-by: Dave Marquard Link: https://github.com/openwrt/openwrt/pull/18722 Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 8774dd7761d3701affe8f3b06c84cf4b9bce1120) --- package/firmware/linux-firmware/Makefile | 2 +- package/firmware/linux-firmware/broadcom.mk | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/package/firmware/linux-firmware/Makefile b/package/firmware/linux-firmware/Makefile index 433ff03a21b032..a2b78967f7a676 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:=20241110 -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/broadcom.mk b/package/firmware/linux-firmware/broadcom.mk index c4e5885f77c232..c37edf211c0b7a 100644 --- a/package/firmware/linux-firmware/broadcom.mk +++ b/package/firmware/linux-firmware/broadcom.mk @@ -128,12 +128,18 @@ define Package/brcmfmac-nvram-43455-sdio/install $(LN) \ brcmfmac43455-sdio.raspberrypi,4-model-b.txt \ $(1)/lib/firmware/brcm/brcmfmac43455-sdio.raspberrypi,5-model-b.txt + $(LN) \ + brcmfmac43455-sdio.raspberrypi,4-model-b.txt \ + $(1)/lib/firmware/brcm/brcmfmac43455-sdio.raspberrypi,5-compute-module.txt $(LN) \ brcmfmac43455-sdio.raspberrypi,4-model-b.txt \ $(1)/lib/firmware/brcm/brcmfmac43455-sdio.Raspberry\ Pi\ Foundation-Raspberry\ Pi\ Compute\ Module\ 4.txt $(LN) \ brcmfmac43455-sdio.raspberrypi,4-model-b.txt \ $(1)/lib/firmware/brcm/brcmfmac43455-sdio.Raspberry\ Pi\ Foundation-Raspberry\ Pi\ 5\ Model\ B.txt + $(LN) \ + brcmfmac43455-sdio.raspberrypi,4-model-b.txt \ + $(1)/lib/firmware/brcm/brcmfmac43455-sdio.Raspberry\ Pi\ Foundation-Raspberry\ Pi\ Compute\ Module\ 5.txt $(INSTALL_DATA) \ $(PKG_BUILD_DIR)/brcm/brcmfmac43455-sdio.MINIX-NEO\ Z83-4.txt \ $(1)/lib/firmware/brcm/ From b546f80a3f070800d90d4ac9038d0e1180d1f019 Mon Sep 17 00:00:00 2001 From: Dave Marquard Date: Sat, 26 Apr 2025 17:39:33 -0700 Subject: [PATCH 647/877] bcm27xx: bcm2712: support all devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - RPi 500 - RPi 5 Compute Module - RPi 5B (bcm2712 d0 rev) Signed-off-by: Dave Marquard Link: https://github.com/openwrt/openwrt/pull/18622 Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 169dc6270a4ebdc7ec839a4930bbed35ae05ffa2) --- .../bcm27xx/base-files/etc/board.d/02_network | 2 ++ .../lib/preinit/05_set_preinit_iface_brcm2708 | 2 ++ target/linux/bcm27xx/image/Makefile | 15 ++++++++++++--- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/target/linux/bcm27xx/base-files/etc/board.d/02_network b/target/linux/bcm27xx/base-files/etc/board.d/02_network index f246139c385bd8..e05c369d642db2 100644 --- a/target/linux/bcm27xx/base-files/etc/board.d/02_network +++ b/target/linux/bcm27xx/base-files/etc/board.d/02_network @@ -17,6 +17,8 @@ raspberrypi,3-model-b-plus |\ raspberrypi,400 |\ raspberrypi,4-compute-module |\ raspberrypi,4-model-b |\ +raspberrypi,500 |\ +raspberrypi,5-compute-module |\ raspberrypi,5-model-b |\ raspberrypi,model-b |\ raspberrypi,model-b-plus |\ diff --git a/target/linux/bcm27xx/base-files/lib/preinit/05_set_preinit_iface_brcm2708 b/target/linux/bcm27xx/base-files/lib/preinit/05_set_preinit_iface_brcm2708 index 120475b55dcda6..bce75d7119b29a 100644 --- a/target/linux/bcm27xx/base-files/lib/preinit/05_set_preinit_iface_brcm2708 +++ b/target/linux/bcm27xx/base-files/lib/preinit/05_set_preinit_iface_brcm2708 @@ -12,6 +12,8 @@ set_preinit_iface() { raspberrypi,400 |\ raspberrypi,4-compute-module |\ raspberrypi,4-model-b |\ + raspberrypi,500 |\ + raspberrypi,5-compute-module |\ raspberrypi,5-model-b |\ raspberrypi,model-b |\ raspberrypi,model-b-plus |\ diff --git a/target/linux/bcm27xx/image/Makefile b/target/linux/bcm27xx/image/Makefile index 23bc3a35c9edd8..0ded372a3f2729 100644 --- a/target/linux/bcm27xx/image/Makefile +++ b/target/linux/bcm27xx/image/Makefile @@ -193,10 +193,19 @@ ifeq ($(SUBTARGET),bcm2711) endif define Device/rpi-5 - DEVICE_MODEL := 5 + DEVICE_MODEL := 5/500/CM5 KERNEL_IMG := kernel_2712.img - DEVICE_DTS := broadcom/bcm2712-rpi-5-b - SUPPORTED_DEVICES := raspberrypi,5-model-b + DEVICE_DTS := \ + broadcom/bcm2712-rpi-5-b \ + broadcom/bcm2712-rpi-cm5-cm4io \ + broadcom/bcm2712-rpi-cm5-cm5io \ + broadcom/bcm2712-rpi-cm5l-cm4io \ + broadcom/bcm2712-rpi-cm5l-cm5io \ + broadcom/bcm2712d0-rpi-5-b + SUPPORTED_DEVICES := \ + raspberrypi,500 \ + raspberrypi,5-compute-module \ + raspberrypi,5-model-b DEVICE_PACKAGES := \ cypress-firmware-43455-sdio \ brcmfmac-nvram-43455-sdio \ From 517d8a102f5f170fac6135aac170ac346c153249 Mon Sep 17 00:00:00 2001 From: John Audia Date: Fri, 11 Apr 2025 09:52:08 -0400 Subject: [PATCH 648/877] kernel: bump 6.6 to 6.6.87 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.87 Manually rebased: generic-hack/781-usb-net-rndis-support-asr.patch All other patches automatically rebased. Build system: x86/64 Build-tested: flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3, x86/64 Run-tested: flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3, x86/64 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/18457 (cherry picked from commit 66b5ed7a4eb5e8f9bc9fb1584b7fd97b0a9978bd) Link: https://github.com/openwrt/openwrt/pull/18730 Signed-off-by: Hauke Mehrtens --- include/kernel-6.6 | 4 +-- ...mstb-Add-DT-property-to-control-L1SS.patch | 2 +- ...0521-PCI-brcmstb-Add-BCM2712-support.patch | 34 +++++++++---------- ...cmstb-Change-RCB_-MPS-64B-_MODE-bits.patch | 2 +- ...stb-optionally-extend-Tperst_clk-tim.patch | 2 +- ...pci-Disable-Host-Memory-Buffer-usage.patch | 6 ++-- ...arn-if-no-host-bridge-NUMA-node-info.patch | 2 +- .../781-usb-net-rndis-support-asr.patch | 10 +++--- ...ng-with-source-address-failed-policy.patch | 22 ++++++------ ...d-knob-for-filtering-rx-tx-BPDU-pack.patch | 2 +- ...IEI-vendor-prefix-and-IEI-WT61P803-P.patch | 2 +- 11 files changed, 44 insertions(+), 44 deletions(-) diff --git a/include/kernel-6.6 b/include/kernel-6.6 index 9fd98c30464c50..e3de08df98dee6 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .86 -LINUX_KERNEL_HASH-6.6.86 = 49e3ad7423e40735faada0cd39665c071d47efd84ec3548acf119c9704f13e68 +LINUX_VERSION-6.6 = .87 +LINUX_KERNEL_HASH-6.6.87 = 8957e5c2dacdbc47a16dbf1f6303ca7088409be6197a3881f752313275357ac6 diff --git a/target/linux/bcm27xx/patches-6.6/950-0215-PCI-brcmstb-Add-DT-property-to-control-L1SS.patch b/target/linux/bcm27xx/patches-6.6/950-0215-PCI-brcmstb-Add-DT-property-to-control-L1SS.patch index f29ecab0712880..c6a5810fade4d2 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0215-PCI-brcmstb-Add-DT-property-to-control-L1SS.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0215-PCI-brcmstb-Add-DT-property-to-control-L1SS.patch @@ -65,7 +65,7 @@ Signed-off-by: Phil Elwell writel(tmp, base + PCIE_MISC_HARD_PCIE_HARD_DEBUG); return 0; -@@ -1536,6 +1551,7 @@ static int brcm_pcie_probe(struct platfo +@@ -1537,6 +1552,7 @@ static int brcm_pcie_probe(struct platfo pcie->gen = (ret < 0) ? 0 : ret; pcie->ssc = of_property_read_bool(np, "brcm,enable-ssc"); diff --git a/target/linux/bcm27xx/patches-6.6/950-0521-PCI-brcmstb-Add-BCM2712-support.patch b/target/linux/bcm27xx/patches-6.6/950-0521-PCI-brcmstb-Add-BCM2712-support.patch index c4c79ae4281fd4..38f2e8631729e9 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0521-PCI-brcmstb-Add-BCM2712-support.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0521-PCI-brcmstb-Add-BCM2712-support.patch @@ -831,7 +831,7 @@ Signed-off-by: Jonathan Bell return 0; } -@@ -1207,6 +1534,7 @@ static void brcm_pcie_enter_l23(struct b +@@ -1208,6 +1535,7 @@ static void brcm_pcie_enter_l23(struct b static int brcm_phy_cntl(struct brcm_pcie *pcie, const int start) { @@ -839,7 +839,7 @@ Signed-off-by: Jonathan Bell static const u32 shifts[PCIE_DVT_PMU_PCIE_PHY_CTRL_DAST_NFLDS] = { PCIE_DVT_PMU_PCIE_PHY_CTRL_DAST_PWRDN_SHIFT, PCIE_DVT_PMU_PCIE_PHY_CTRL_DAST_RESET_SHIFT, -@@ -1239,6 +1567,9 @@ static int brcm_phy_cntl(struct brcm_pci +@@ -1240,6 +1568,9 @@ static int brcm_phy_cntl(struct brcm_pci dev_err(pcie->dev, "failed to %s phy\n", (start ? "start" : "stop")); return ret; @@ -849,7 +849,7 @@ Signed-off-by: Jonathan Bell } static inline int brcm_phy_start(struct brcm_pcie *pcie) -@@ -1271,6 +1602,12 @@ static void brcm_pcie_turn_off(struct br +@@ -1272,6 +1603,12 @@ static void brcm_pcie_turn_off(struct br u32p_replace_bits(&tmp, 1, PCIE_MISC_HARD_PCIE_HARD_DEBUG_SERDES_IDDQ_MASK); writel(tmp, base + PCIE_MISC_HARD_PCIE_HARD_DEBUG); @@ -862,7 +862,7 @@ Signed-off-by: Jonathan Bell /* Shutdown PCIe bridge */ pcie->bridge_sw_init_set(pcie, 1); } -@@ -1301,9 +1638,9 @@ static int brcm_pcie_suspend_noirq(struc +@@ -1302,9 +1639,9 @@ static int brcm_pcie_suspend_noirq(struc if (brcm_phy_stop(pcie)) dev_err(dev, "Could not stop phy for suspend\n"); @@ -874,7 +874,7 @@ Signed-off-by: Jonathan Bell return ret; } -@@ -1398,7 +1735,7 @@ err_regulator: +@@ -1399,7 +1736,7 @@ err_regulator: if (pcie->sr) regulator_bulk_disable(pcie->sr->num_supplies, pcie->sr->supplies); err_reset: @@ -883,7 +883,7 @@ Signed-off-by: Jonathan Bell err_disable_clk: clk_disable_unprepare(pcie->clk); return ret; -@@ -1410,8 +1747,8 @@ static void __brcm_pcie_remove(struct br +@@ -1411,8 +1748,8 @@ static void __brcm_pcie_remove(struct br brcm_pcie_turn_off(pcie); if (brcm_phy_stop(pcie)) dev_err(pcie->dev, "Could not stop phy\n"); @@ -894,7 +894,7 @@ Signed-off-by: Jonathan Bell clk_disable_unprepare(pcie->clk); } -@@ -1429,12 +1766,16 @@ static const int pcie_offsets[] = { +@@ -1430,12 +1767,16 @@ static const int pcie_offsets[] = { [RGR1_SW_INIT_1] = 0x9210, [EXT_CFG_INDEX] = 0x9000, [EXT_CFG_DATA] = 0x9004, @@ -911,7 +911,7 @@ Signed-off-by: Jonathan Bell }; static const struct pcie_cfg_data generic_cfg = { -@@ -1442,6 +1783,7 @@ static const struct pcie_cfg_data generi +@@ -1443,6 +1784,7 @@ static const struct pcie_cfg_data generi .type = GENERIC, .perst_set = brcm_pcie_perst_set_generic, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, @@ -919,7 +919,7 @@ Signed-off-by: Jonathan Bell }; static const struct pcie_cfg_data bcm7425_cfg = { -@@ -1449,6 +1791,7 @@ static const struct pcie_cfg_data bcm742 +@@ -1450,6 +1792,7 @@ static const struct pcie_cfg_data bcm742 .type = BCM7425, .perst_set = brcm_pcie_perst_set_generic, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, @@ -927,7 +927,7 @@ Signed-off-by: Jonathan Bell }; static const struct pcie_cfg_data bcm7435_cfg = { -@@ -1463,12 +1806,15 @@ static const struct pcie_cfg_data bcm490 +@@ -1464,12 +1807,15 @@ static const struct pcie_cfg_data bcm490 .type = BCM4908, .perst_set = brcm_pcie_perst_set_4908, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, @@ -943,7 +943,7 @@ Signed-off-by: Jonathan Bell }; static const struct pcie_cfg_data bcm7278_cfg = { -@@ -1476,6 +1822,7 @@ static const struct pcie_cfg_data bcm727 +@@ -1477,6 +1823,7 @@ static const struct pcie_cfg_data bcm727 .type = BCM7278, .perst_set = brcm_pcie_perst_set_7278, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_7278, @@ -951,7 +951,7 @@ Signed-off-by: Jonathan Bell }; static const struct pcie_cfg_data bcm2711_cfg = { -@@ -1483,10 +1830,27 @@ static const struct pcie_cfg_data bcm271 +@@ -1484,10 +1831,27 @@ static const struct pcie_cfg_data bcm271 .type = BCM2711, .perst_set = brcm_pcie_perst_set_generic, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, @@ -979,7 +979,7 @@ Signed-off-by: Jonathan Bell { .compatible = "brcm,bcm4908-pcie", .data = &bcm4908_cfg }, { .compatible = "brcm,bcm7211-pcie", .data = &generic_cfg }, { .compatible = "brcm,bcm7278-pcie", .data = &bcm7278_cfg }, -@@ -1527,7 +1891,7 @@ static int brcm_pcie_probe(struct platfo +@@ -1528,7 +1892,7 @@ static int brcm_pcie_probe(struct platfo data = of_device_get_match_data(&pdev->dev); if (!data) { @@ -988,7 +988,7 @@ Signed-off-by: Jonathan Bell return -EINVAL; } -@@ -1538,6 +1902,7 @@ static int brcm_pcie_probe(struct platfo +@@ -1539,6 +1903,7 @@ static int brcm_pcie_probe(struct platfo pcie->type = data->type; pcie->perst_set = data->perst_set; pcie->bridge_sw_init_set = data->bridge_sw_init_set; @@ -996,7 +996,7 @@ Signed-off-by: Jonathan Bell pcie->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(pcie->base)) -@@ -1568,14 +1933,20 @@ static int brcm_pcie_probe(struct platfo +@@ -1569,14 +1934,20 @@ static int brcm_pcie_probe(struct platfo clk_disable_unprepare(pcie->clk); return PTR_ERR(pcie->perst_reset); } @@ -1019,7 +1019,7 @@ Signed-off-by: Jonathan Bell clk_disable_unprepare(pcie->clk); return ret; } -@@ -1598,6 +1969,33 @@ static int brcm_pcie_probe(struct platfo +@@ -1599,6 +1970,33 @@ static int brcm_pcie_probe(struct platfo dev_err(pcie->dev, "probe of internal MSI failed"); goto fail; } @@ -1053,7 +1053,7 @@ Signed-off-by: Jonathan Bell } bridge->ops = pcie->type == BCM7425 ? &brcm7425_pcie_ops : &brcm_pcie_ops; -@@ -1614,6 +2012,8 @@ static int brcm_pcie_probe(struct platfo +@@ -1615,6 +2013,8 @@ static int brcm_pcie_probe(struct platfo return ret; } diff --git a/target/linux/bcm27xx/patches-6.6/950-0695-PCI-brcmstb-Change-RCB_-MPS-64B-_MODE-bits.patch b/target/linux/bcm27xx/patches-6.6/950-0695-PCI-brcmstb-Change-RCB_-MPS-64B-_MODE-bits.patch index dba20dc8544ae8..70d8229b4433ad 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0695-PCI-brcmstb-Change-RCB_-MPS-64B-_MODE-bits.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0695-PCI-brcmstb-Change-RCB_-MPS-64B-_MODE-bits.patch @@ -45,7 +45,7 @@ Signed-off-by: Phil Elwell writel(tmp, base + PCIE_MISC_MISC_CTRL); brcm_pcie_set_tc_qos(pcie); -@@ -1917,6 +1918,7 @@ static int brcm_pcie_probe(struct platfo +@@ -1918,6 +1919,7 @@ static int brcm_pcie_probe(struct platfo pcie->ssc = of_property_read_bool(np, "brcm,enable-ssc"); pcie->l1ss = of_property_read_bool(np, "brcm,enable-l1ss"); diff --git a/target/linux/bcm27xx/patches-6.6/950-0697-drivers-pci-brcmstb-optionally-extend-Tperst_clk-tim.patch b/target/linux/bcm27xx/patches-6.6/950-0697-drivers-pci-brcmstb-optionally-extend-Tperst_clk-tim.patch index a0006d6a5a1403..604cf21b10ad3e 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0697-drivers-pci-brcmstb-optionally-extend-Tperst_clk-tim.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0697-drivers-pci-brcmstb-optionally-extend-Tperst_clk-tim.patch @@ -61,7 +61,7 @@ Signed-off-by: Jonathan Bell /* * Wait for 100ms after PERST# deassertion; see PCIe CEM specification -@@ -1919,6 +1940,7 @@ static int brcm_pcie_probe(struct platfo +@@ -1920,6 +1941,7 @@ static int brcm_pcie_probe(struct platfo pcie->ssc = of_property_read_bool(np, "brcm,enable-ssc"); pcie->l1ss = of_property_read_bool(np, "brcm,enable-l1ss"); pcie->rcb_mps_mode = of_property_read_bool(np, "brcm,enable-mps-rcb"); diff --git a/target/linux/bcm27xx/patches-6.6/950-1438-nvme-pci-Disable-Host-Memory-Buffer-usage.patch b/target/linux/bcm27xx/patches-6.6/950-1438-nvme-pci-Disable-Host-Memory-Buffer-usage.patch index 4f1ea9249c65a8..02c4dc449899e4 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1438-nvme-pci-Disable-Host-Memory-Buffer-usage.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1438-nvme-pci-Disable-Host-Memory-Buffer-usage.patch @@ -18,7 +18,7 @@ Signed-off-by: Phil Elwell --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c -@@ -1932,6 +1932,7 @@ static void nvme_free_host_mem(struct nv +@@ -1948,6 +1948,7 @@ static void nvme_free_host_mem(struct nv dev->nr_host_mem_descs = 0; } @@ -26,7 +26,7 @@ Signed-off-by: Phil Elwell static int __nvme_alloc_host_mem(struct nvme_dev *dev, u64 preferred, u32 chunk_size) { -@@ -2000,9 +2001,11 @@ out: +@@ -2016,9 +2017,11 @@ out: dev->host_mem_descs = NULL; return -ENOMEM; } @@ -38,7 +38,7 @@ Signed-off-by: Phil Elwell u64 min_chunk = min_t(u64, preferred, PAGE_SIZE * MAX_ORDER_NR_PAGES); u64 hmminds = max_t(u32, dev->ctrl.hmminds * 4096, PAGE_SIZE * 2); u64 chunk_size; -@@ -2015,6 +2018,7 @@ static int nvme_alloc_host_mem(struct nv +@@ -2031,6 +2034,7 @@ static int nvme_alloc_host_mem(struct nv nvme_free_host_mem(dev); } } diff --git a/target/linux/bcm27xx/patches-6.6/950-1452-Revert-PCI-Warn-if-no-host-bridge-NUMA-node-info.patch b/target/linux/bcm27xx/patches-6.6/950-1452-Revert-PCI-Warn-if-no-host-bridge-NUMA-node-info.patch index 5aa88661c3ea05..470a90cb97efde 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1452-Revert-PCI-Warn-if-no-host-bridge-NUMA-node-info.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1452-Revert-PCI-Warn-if-no-host-bridge-NUMA-node-info.patch @@ -17,7 +17,7 @@ Signed-off-by: Dom Cobley --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c -@@ -968,9 +968,6 @@ static int pci_register_host_bridge(stru +@@ -967,9 +967,6 @@ static int pci_register_host_bridge(stru else pr_info("PCI host bridge to bus %s\n", name); diff --git a/target/linux/generic/hack-6.6/781-usb-net-rndis-support-asr.patch b/target/linux/generic/hack-6.6/781-usb-net-rndis-support-asr.patch index 47339b6c22f7b2..d5cc7e0a7ef3ef 100644 --- a/target/linux/generic/hack-6.6/781-usb-net-rndis-support-asr.patch +++ b/target/linux/generic/hack-6.6/781-usb-net-rndis-support-asr.patch @@ -13,7 +13,7 @@ Signed-off-by: Daniel Golle --- 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 +@@ -640,6 +640,16 @@ static const struct driver_info wwan_rnd .tx_fixup = rndis_tx_fixup, }; @@ -30,7 +30,7 @@ Signed-off-by: Daniel Golle /*-------------------------------------------------------------------------*/ static const struct usb_device_id products [] = { -@@ -666,6 +676,36 @@ static const struct usb_device_id produc +@@ -676,6 +686,36 @@ static const struct usb_device_id produc USB_INTERFACE_INFO(USB_CLASS_WIRELESS_CONTROLLER, 1, 3), .driver_info = (unsigned long) &rndis_info, }, { @@ -64,6 +64,6 @@ Signed-off-by: Daniel Golle + 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, + /* Mobile Broadband Modem, seen in Novatel Verizon USB730L and + * Telit FN990A (RNDIS) + */ diff --git a/target/linux/generic/pending-6.6/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch b/target/linux/generic/pending-6.6/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch index ccafdf291136ee..abd6586e6cb2bb 100644 --- a/target/linux/generic/pending-6.6/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch +++ b/target/linux/generic/pending-6.6/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch @@ -138,7 +138,7 @@ Signed-off-by: Jonas Gorski static const struct rt6_info ip6_blk_hole_entry_template = { .dst = { .__rcuref = RCUREF_INIT(1), -@@ -1043,6 +1057,7 @@ static const int fib6_prop[RTN_MAX + 1] +@@ -1077,6 +1091,7 @@ static const int fib6_prop[RTN_MAX + 1] [RTN_BLACKHOLE] = -EINVAL, [RTN_UNREACHABLE] = -EHOSTUNREACH, [RTN_PROHIBIT] = -EACCES, @@ -146,7 +146,7 @@ Signed-off-by: Jonas Gorski [RTN_THROW] = -EAGAIN, [RTN_NAT] = -EINVAL, [RTN_XRESOLVE] = -EINVAL, -@@ -1078,6 +1093,10 @@ static void ip6_rt_init_dst_reject(struc +@@ -1112,6 +1127,10 @@ static void ip6_rt_init_dst_reject(struc rt->dst.output = ip6_pkt_prohibit_out; rt->dst.input = ip6_pkt_prohibit; break; @@ -157,7 +157,7 @@ Signed-off-by: Jonas Gorski case RTN_THROW: case RTN_UNREACHABLE: default: -@@ -4554,6 +4573,17 @@ static int ip6_pkt_prohibit_out(struct n +@@ -4588,6 +4607,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. */ -@@ -5045,7 +5075,8 @@ static int rtm_to_fib6_config(struct sk_ +@@ -5079,7 +5109,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) -@@ -6307,6 +6338,8 @@ static int ip6_route_dev_notify(struct n +@@ -6341,6 +6372,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 -@@ -6318,6 +6351,7 @@ static int ip6_route_dev_notify(struct n +@@ -6352,6 +6385,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 } -@@ -6518,6 +6552,8 @@ static int __net_init ip6_route_net_init +@@ -6552,6 +6586,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); -@@ -6528,11 +6564,21 @@ static int __net_init ip6_route_net_init +@@ -6562,11 +6598,21 @@ static int __net_init ip6_route_net_init ip6_template_metrics, true); INIT_LIST_HEAD(&net->ipv6.ip6_prohibit_entry->dst.rt_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); -@@ -6559,6 +6605,8 @@ out: +@@ -6593,6 +6639,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: -@@ -6578,6 +6626,7 @@ static void __net_exit ip6_route_net_exi +@@ -6612,6 +6660,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); -@@ -6661,6 +6710,9 @@ void __init ip6_route_init_special_entri +@@ -6695,6 +6744,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-6.6/710-bridge-add-knob-for-filtering-rx-tx-BPDU-pack.patch b/target/linux/generic/pending-6.6/710-bridge-add-knob-for-filtering-rx-tx-BPDU-pack.patch index 31e29c447e8ade..d62ccc571ce898 100644 --- a/target/linux/generic/pending-6.6/710-bridge-add-knob-for-filtering-rx-tx-BPDU-pack.patch +++ b/target/linux/generic/pending-6.6/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; -@@ -4978,7 +4978,9 @@ int ndo_dflt_bridge_getlink(struct sk_bu +@@ -4981,7 +4981,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/mvebu/patches-6.6/901-dt-bindings-Add-IEI-vendor-prefix-and-IEI-WT61P803-P.patch b/target/linux/mvebu/patches-6.6/901-dt-bindings-Add-IEI-vendor-prefix-and-IEI-WT61P803-P.patch index e9c1d57d244e12..2f7361c93edb68 100644 --- a/target/linux/mvebu/patches-6.6/901-dt-bindings-Add-IEI-vendor-prefix-and-IEI-WT61P803-P.patch +++ b/target/linux/mvebu/patches-6.6/901-dt-bindings-Add-IEI-vendor-prefix-and-IEI-WT61P803-P.patch @@ -207,7 +207,7 @@ Cc: Robert Marko + }; --- a/Documentation/devicetree/bindings/vendor-prefixes.yaml +++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml -@@ -609,6 +609,8 @@ patternProperties: +@@ -611,6 +611,8 @@ patternProperties: description: IC Plus Corp. "^idt,.*": description: Integrated Device Technologies, Inc. From cee749b88975fcd2861df648ff98d399e41aa1ea Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Tue, 29 Apr 2025 18:55:19 +0200 Subject: [PATCH 649/877] generic: drop extra-old-deprecated pending fix patch for sch codel Patch 620-net_sched-codel-do-not-defer-queue-length-update.patch is actually an ancient patch that somehow manage to be ported for 7 solid years. This comes from [1] where a fix patch was proposed. Nobody notice that the proposed patch was actually rejected upstream in favor of [2]. And the upstream fix patch is present in kernel from version 4.18. This means that we were actually fixing for a non existant bug and maybe introducing regression down the line. Drop the patch for good as we already have a fix for it in flace for a long time. [1] https://bugzilla.kernel.org/show_bug.cgi?id=109581 [2] https://github.com/torvalds/linux/commit/35b42da69e35536da603a50e40aa6c41b2f7b0f8 Signed-off-by: Christian Marangi (cherry picked from commit 0f9af6dcd9fc3d752a546dbd20a9b3cd6a94a4eb) Link: https://github.com/openwrt/openwrt/pull/18730 Signed-off-by: Hauke Mehrtens --- ...del-do-not-defer-queue-length-update.patch | 86 ------------------- 1 file changed, 86 deletions(-) delete mode 100644 target/linux/generic/pending-6.6/620-net_sched-codel-do-not-defer-queue-length-update.patch diff --git a/target/linux/generic/pending-6.6/620-net_sched-codel-do-not-defer-queue-length-update.patch b/target/linux/generic/pending-6.6/620-net_sched-codel-do-not-defer-queue-length-update.patch deleted file mode 100644 index 4b4825ae3b9a4a..00000000000000 --- a/target/linux/generic/pending-6.6/620-net_sched-codel-do-not-defer-queue-length-update.patch +++ /dev/null @@ -1,86 +0,0 @@ -From: Konstantin Khlebnikov -Date: Mon, 21 Aug 2017 11:14:14 +0300 -Subject: [PATCH] net_sched/codel: do not defer queue length update - -When codel wants to drop last packet in ->dequeue() it cannot call -qdisc_tree_reduce_backlog() right away - it will notify parent qdisc -about zero qlen and HTB/HFSC will deactivate class. The same class will -be deactivated second time by caller of ->dequeue(). Currently codel and -fq_codel defer update. This triggers warning in HFSC when it's qlen != 0 -but there is no active classes. - -This patch update parent queue length immediately: just temporary increase -qlen around qdisc_tree_reduce_backlog() to prevent first class deactivation -if we have skb to return. - -This might open another problem in HFSC - now operation peek could fail and -deactivate parent class. - -Signed-off-by: Konstantin Khlebnikov -Link: https://bugzilla.kernel.org/show_bug.cgi?id=109581 ---- - ---- a/net/sched/sch_codel.c -+++ b/net/sched/sch_codel.c -@@ -95,11 +95,17 @@ static struct sk_buff *codel_qdisc_deque - &q->stats, qdisc_pkt_len, codel_get_enqueue_time, - drop_func, dequeue_func); - -- /* We cant call qdisc_tree_reduce_backlog() if our qlen is 0, -- * or HTB crashes. Defer it for next round. -+ /* If our qlen is 0 qdisc_tree_reduce_backlog() will deactivate -+ * parent class, dequeue in parent qdisc will do the same if we -+ * return skb. Temporary increment qlen if we have skb. - */ -- if (q->stats.drop_count && sch->q.qlen) { -- qdisc_tree_reduce_backlog(sch, q->stats.drop_count, q->stats.drop_len); -+ if (q->stats.drop_count) { -+ if (skb) -+ sch->q.qlen++; -+ qdisc_tree_reduce_backlog(sch, q->stats.drop_count, -+ q->stats.drop_len); -+ if (skb) -+ sch->q.qlen--; - q->stats.drop_count = 0; - q->stats.drop_len = 0; - } ---- a/net/sched/sch_fq_codel.c -+++ b/net/sched/sch_fq_codel.c -@@ -304,6 +304,21 @@ begin: - &flow->cvars, &q->cstats, qdisc_pkt_len, - codel_get_enqueue_time, drop_func, dequeue_func); - -+ /* If our qlen is 0 qdisc_tree_reduce_backlog() will deactivate -+ * parent class, dequeue in parent qdisc will do the same if we -+ * return skb. Temporary increment qlen if we have skb. -+ */ -+ if (q->cstats.drop_count) { -+ if (skb) -+ sch->q.qlen++; -+ qdisc_tree_reduce_backlog(sch, q->cstats.drop_count, -+ q->cstats.drop_len); -+ if (skb) -+ sch->q.qlen--; -+ q->cstats.drop_count = 0; -+ q->cstats.drop_len = 0; -+ } -+ - if (!skb) { - /* force a pass through old_flows to prevent starvation */ - if ((head == &q->new_flows) && !list_empty(&q->old_flows)) -@@ -314,15 +329,6 @@ begin: - } - qdisc_bstats_update(sch, skb); - flow->deficit -= qdisc_pkt_len(skb); -- /* We cant call qdisc_tree_reduce_backlog() if our qlen is 0, -- * or HTB crashes. Defer it for next round. -- */ -- if (q->cstats.drop_count && sch->q.qlen) { -- qdisc_tree_reduce_backlog(sch, q->cstats.drop_count, -- q->cstats.drop_len); -- q->cstats.drop_count = 0; -- q->cstats.drop_len = 0; -- } - return skb; - } - From 9b28f32815e64c1d10db54ae6afca9053016a886 Mon Sep 17 00:00:00 2001 From: Mieczyslaw Nalewaj Date: Wed, 30 Apr 2025 13:22:33 +0200 Subject: [PATCH 650/877] kernel: bump 6.6 to 6.6.88 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.88 Manually rebased: - bcm27xx/patches-6.6/950-0327-media-i2c-ov7251-Make-the-enable-GPIO-optional.patch[1] - bcm27xx/patches-6.6/950-0521-PCI-brcmstb-Add-BCM2712-support.patch[2] - generic/hack-6.6/610-net-page_pool-try-to-free-deferred-skbs-while-waitin.patch[3] - generic/pending-6.6/734-net-ethernet-mediatek-enlarge-DMA-reserve-buffer.patch[4] All other patches automatically rebased. 1. https://web.git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.88&id=f249c05416ea0bef24c9dbed0e653d2fad87b127 2. https://web.git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.88&id=1fea7726276e5d6526ecd4e7ccb4c91a6135deb5 3. https://web.git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.88&id=95f17738b86fd198924d874a5639bcdc49c7e5b8 4. https://web.git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.88&id=a2874f0dff63829d1f540003e2d83adb610ee64a Signed-off-by: Mieczyslaw Nalewaj Link: https://github.com/openwrt/openwrt/pull/18607 (cherry picked from commit a72a2fd7e04a01490493f7d569ecfd0d4d1a82d5) Link: https://github.com/openwrt/openwrt/pull/18730 Signed-off-by: Hauke Mehrtens --- include/kernel-6.6 | 4 +- ...rl-airoha-Add-support-for-EN7581-SoC.patch | 2 +- ...he-abused-interrupt-map-on-pcie-node.patch | 2 +- ...ce-quirks-for-Freeway-Airmouse-T3-an.patch | 2 +- ...7-Support-for-the-Sony-IMX477-sensor.patch | 2 +- ...9-Support-for-the-Sony-IMX519-sensor.patch | 2 +- ...vicetree-Add-documentation-for-imx37.patch | 2 +- ...v7251-Add-fwnode-properties-controls.patch | 6 +- ...ov7251-Make-the-enable-GPIO-optional.patch | 6 +- ...-Reinstate-setting-ov7251_global_ini.patch | 2 +- ...-Add-module-param-to-select-ext-trig.patch | 2 +- ...a-i2c-Add-IMX708-CMOS-sensor-binding.patch | 2 +- ...a-i2c-Replace-IMX708-sensor-binding-.patch | 2 +- ...a-imx258-Rename-to-include-vendor-pr.patch | 2 +- ...0521-PCI-brcmstb-Add-BCM2712-support.patch | 72 ++++++++++--------- ...0545-ASoC-dwc-Support-set_bclk_ratio.patch | 4 +- ...950-0546-ASoC-dwc-Add-DMACR-handling.patch | 6 +- ...0-0547-ASOC-dwc-Improve-DMA-shutdown.patch | 14 ++-- ...8-ASOC-dwc-Fix-16-bit-audio-handling.patch | 4 +- ...ove-check-in-set_bclk_ratio-handling.patch | 2 +- ...-Switch-from-V4L2_CID_GAIN-to-V4L2_C.patch | 4 +- ...dwc-Permit-sample-rates-up-to-384kHz.patch | 2 +- ...0-0752-ASoC-dwc-Fix-full-duplex-mode.patch | 6 +- ...ndings-i2c-Add-Rohm-BU64754-bindings.patch | 2 +- ...2c-Add-driver-for-OmniVision-OV64A40.patch | 2 +- ...fer-bclk_ratio-handling-to-hw_params.patch | 6 +- ...efer-bclk_ratio-handling-to-hw_param.patch | 10 +-- ...-dwc-Correct-channel-count-reporting.patch | 6 +- ...ible-to-apply-PWM-changes-in-atomic-.patch | 2 +- ...-Add-Raspberry-Pi-PiSP-Back-End-uAPI.patch | 2 +- ...s-Add-bindings-for-Raspberry-Pi-PiSP.patch | 2 +- ...-bindings-Add-RPI-RP2040-GPIO-Bridge.patch | 2 +- ...river-for-the-RPI-RP2040-GPIO-bridge.patch | 2 +- ...s-choose-FIFO-thresholds-based-on-DM.patch | 12 ++-- ...edia-dt-bindings-i2c-Add-Sony-IMX500.patch | 2 +- ...2c-Add-driver-for-Sony-IMX500-sensor.patch | 2 +- ...A-switch-drivers-to-provide-their-ow.patch | 2 +- ...795-v6.7-16-r8152-use-napi_gro_frags.patch | 4 +- ...-nvmem-layouts-add-U-Boot-env-layout.patch | 2 +- ...x-rename-mv88e6xxx_g2_scratch_gpio_s.patch | 2 +- ...x-add-Amethyst-specific-SMI-GPIO-fun.patch | 2 +- ...et-dsa-mv88e6xxx-Support-LED-control.patch | 10 +-- ...y-to-free-deferred-skbs-while-waitin.patch | 6 +- .../hack-6.6/660-fq_codel_defaults.patch | 2 +- ...-dsa-mv88e6xxx-disable-ATU-violation.patch | 2 +- ...-r8152-add-LED-configuration-from-OF.patch | 8 +-- .../790-SFP-GE-T-ignore-TX_FAULT.patch | 4 +- ...add-uImage.FIT-subimage-block-driver.patch | 2 +- ..._F_GSO_FRAGLIST-from-NETIF_F_GSO_SOF.patch | 4 +- ...-mediatek-enlarge-DMA-reserve-buffer.patch | 2 +- ...-add-driver-for-MediaTek-USXGMII-PCS.patch | 2 +- ...introduce-the-Qualcomm-IPQESS-driver.patch | 2 +- ...dsa-add-out-of-band-tagging-protocol.patch | 2 +- ...-lantiq-gswip-convert-to-YAML-schema.patch | 2 +- .../701-staging-add-fsl_ppfe-driver.patch | 2 +- ...-pwm-mediatek-add-support-for-MT7988.patch | 4 +- ...an-entry-for-the-IEI-WT61P803-PUZZLE.patch | 2 +- .../810-uvc-add-iPassion-iP2970-support.patch | 2 +- ...sfp-re-probe-modules-on-DEV_UP-event.patch | 2 +- ...14-net-phy-sfp-add-support-for-SMBus.patch | 6 +- ...NTAINERS-Update-all-StarFive-entries.patch | 20 +++--- ...-getting-platform-data-error-for-Sta.patch | 2 +- ...-RX-master-support-for-StarFive-JH71.patch | 4 +- ...arfive-Add-JH7100-audio-reset-driver.patch | 2 +- 64 files changed, 159 insertions(+), 151 deletions(-) diff --git a/include/kernel-6.6 b/include/kernel-6.6 index e3de08df98dee6..07ba30cb3aaf51 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .87 -LINUX_KERNEL_HASH-6.6.87 = 8957e5c2dacdbc47a16dbf1f6303ca7088409be6197a3881f752313275357ac6 +LINUX_VERSION-6.6 = .88 +LINUX_KERNEL_HASH-6.6.88 = 19df89b63ef7e950de7297dabfac0569183bf87636f4c300a25336c7da490650 diff --git a/target/linux/airoha/patches-6.6/034-v6.13-pinctrl-airoha-Add-support-for-EN7581-SoC.patch b/target/linux/airoha/patches-6.6/034-v6.13-pinctrl-airoha-Add-support-for-EN7581-SoC.patch index 2e36a2540fa737..502f89f26d7a76 100644 --- a/target/linux/airoha/patches-6.6/034-v6.13-pinctrl-airoha-Add-support-for-EN7581-SoC.patch +++ b/target/linux/airoha/patches-6.6/034-v6.13-pinctrl-airoha-Add-support-for-EN7581-SoC.patch @@ -29,7 +29,7 @@ Signed-off-by: Linus Walleij --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -16870,6 +16870,13 @@ F: drivers/pinctrl/ +@@ -16871,6 +16871,13 @@ F: drivers/pinctrl/ F: include/dt-bindings/pinctrl/ F: include/linux/pinctrl/ diff --git a/target/linux/ath79/patches-6.6/810-ath79-ignore-the-abused-interrupt-map-on-pcie-node.patch b/target/linux/ath79/patches-6.6/810-ath79-ignore-the-abused-interrupt-map-on-pcie-node.patch index 330c0d139b33f8..b53461e37f65d0 100644 --- a/target/linux/ath79/patches-6.6/810-ath79-ignore-the-abused-interrupt-map-on-pcie-node.patch +++ b/target/linux/ath79/patches-6.6/810-ath79-ignore-the-abused-interrupt-map-on-pcie-node.patch @@ -22,7 +22,7 @@ Signed-off-by: Shiji Yang --- a/drivers/of/irq.c +++ b/drivers/of/irq.c -@@ -89,6 +89,8 @@ EXPORT_SYMBOL_GPL(of_irq_find_parent); +@@ -94,6 +94,8 @@ EXPORT_SYMBOL_GPL(of_irq_find_parent); * drawing board. */ static const char * const of_irq_imap_abusers[] = { diff --git a/target/linux/bcm27xx/patches-6.6/950-0169-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch b/target/linux/bcm27xx/patches-6.6/950-0169-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch index 9b6617361fa53c..12518a43987ea5 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0169-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0169-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 -@@ -1408,6 +1411,9 @@ +@@ -1439,6 +1442,9 @@ #define USB_VENDOR_ID_XIAOMI 0x2717 #define USB_DEVICE_ID_MI_SILENT_MOUSE 0x5014 diff --git a/target/linux/bcm27xx/patches-6.6/950-0173-media-i2c-imx477-Support-for-the-Sony-IMX477-sensor.patch b/target/linux/bcm27xx/patches-6.6/950-0173-media-i2c-imx477-Support-for-the-Sony-IMX477-sensor.patch index 03af7a9cb9e33f..264b3ca376ac59 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0173-media-i2c-imx477-Support-for-the-Sony-IMX477-sensor.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0173-media-i2c-imx477-Support-for-the-Sony-IMX477-sensor.patch @@ -343,7 +343,7 @@ Signed-off-by: Naushir Patuck +... --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -20057,6 +20057,14 @@ T: git git://linuxtv.org/media_tree.git +@@ -20058,6 +20058,14 @@ T: git git://linuxtv.org/media_tree.git F: Documentation/devicetree/bindings/media/i2c/sony,imx415.yaml F: drivers/media/i2c/imx415.c diff --git a/target/linux/bcm27xx/patches-6.6/950-0174-media-i2c-imx519-Support-for-the-Sony-IMX519-sensor.patch b/target/linux/bcm27xx/patches-6.6/950-0174-media-i2c-imx519-Support-for-the-Sony-IMX519-sensor.patch index 3dbfea8813957b..2ba00932c27735 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0174-media-i2c-imx519-Support-for-the-Sony-IMX519-sensor.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0174-media-i2c-imx519-Support-for-the-Sony-IMX519-sensor.patch @@ -177,7 +177,7 @@ Signed-off-by: Phil Elwell +... --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -20065,6 +20065,14 @@ T: git git://linuxtv.org/media_tree.git +@@ -20066,6 +20066,14 @@ T: git git://linuxtv.org/media_tree.git F: Documentation/devicetree/bindings/media/i2c/imx477.yaml F: drivers/media/i2c/imx477.c diff --git a/target/linux/bcm27xx/patches-6.6/950-0175-Documentation-devicetree-Add-documentation-for-imx37.patch b/target/linux/bcm27xx/patches-6.6/950-0175-Documentation-devicetree-Add-documentation-for-imx37.patch index b6df79f250563c..019ca418aebb1d 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0175-Documentation-devicetree-Add-documentation-for-imx37.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0175-Documentation-devicetree-Add-documentation-for-imx37.patch @@ -132,7 +132,7 @@ Signed-off-by: David Plowman +... --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -20062,6 +20062,7 @@ M: Raspberry Pi Kernel Maintenance --- a/drivers/media/i2c/ov7251.c +++ b/drivers/media/i2c/ov7251.c -@@ -1541,7 +1541,7 @@ static int ov7251_init_ctrls(struct ov72 +@@ -1543,7 +1543,7 @@ static int ov7251_init_ctrls(struct ov72 s64 pixel_rate; int hblank; @@ -22,7 +22,7 @@ Signed-off-by: Dave Stevenson ov7251->ctrls.lock = &ov7251->lock; v4l2_ctrl_new_std(&ov7251->ctrls, &ov7251_ctrl_ops, -@@ -1600,6 +1600,7 @@ static int ov7251_init_ctrls(struct ov72 +@@ -1602,6 +1602,7 @@ static int ov7251_init_ctrls(struct ov72 static int ov7251_probe(struct i2c_client *client) { @@ -30,7 +30,7 @@ Signed-off-by: Dave Stevenson struct device *dev = &client->dev; struct ov7251 *ov7251; unsigned int rate = 0, clk_rate = 0; -@@ -1690,6 +1691,15 @@ static int ov7251_probe(struct i2c_clien +@@ -1692,6 +1693,15 @@ static int ov7251_probe(struct i2c_clien goto destroy_mutex; } diff --git a/target/linux/bcm27xx/patches-6.6/950-0327-media-i2c-ov7251-Make-the-enable-GPIO-optional.patch b/target/linux/bcm27xx/patches-6.6/950-0327-media-i2c-ov7251-Make-the-enable-GPIO-optional.patch index c00fc4e09a45cf..abe16c51cc226b 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0327-media-i2c-ov7251-Make-the-enable-GPIO-optional.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0327-media-i2c-ov7251-Make-the-enable-GPIO-optional.patch @@ -14,13 +14,13 @@ Signed-off-by: Dave Stevenson --- a/drivers/media/i2c/ov7251.c +++ b/drivers/media/i2c/ov7251.c -@@ -1676,7 +1676,8 @@ static int ov7251_probe(struct i2c_clien +@@ -1678,7 +1678,8 @@ static int ov7251_probe(struct i2c_clien return PTR_ERR(ov7251->analog_regulator); } -- ov7251->enable_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_HIGH); +- ov7251->enable_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW); + ov7251->enable_gpio = devm_gpiod_get_optional(dev, "enable", -+ GPIOD_OUT_HIGH); ++ GPIOD_OUT_LOW); if (IS_ERR(ov7251->enable_gpio)) { dev_err(dev, "cannot get enable gpio\n"); return PTR_ERR(ov7251->enable_gpio); diff --git a/target/linux/bcm27xx/patches-6.6/950-0350-media-i2c-ov7251-Reinstate-setting-ov7251_global_ini.patch b/target/linux/bcm27xx/patches-6.6/950-0350-media-i2c-ov7251-Reinstate-setting-ov7251_global_ini.patch index 50c53c6a719ad1..ca9c0d2c26e44c 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0350-media-i2c-ov7251-Reinstate-setting-ov7251_global_ini.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0350-media-i2c-ov7251-Reinstate-setting-ov7251_global_ini.patch @@ -15,7 +15,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/media/i2c/ov7251.c +++ b/drivers/media/i2c/ov7251.c -@@ -1344,6 +1344,14 @@ static int ov7251_s_stream(struct v4l2_s +@@ -1346,6 +1346,14 @@ static int ov7251_s_stream(struct v4l2_s if (ret < 0) goto err_power_down; diff --git a/target/linux/bcm27xx/patches-6.6/950-0396-media-i2c-ov7251-Add-module-param-to-select-ext-trig.patch b/target/linux/bcm27xx/patches-6.6/950-0396-media-i2c-ov7251-Add-module-param-to-select-ext-trig.patch index 09af88873c51d6..7bcd8e41ca789d 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0396-media-i2c-ov7251-Add-module-param-to-select-ext-trig.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0396-media-i2c-ov7251-Add-module-param-to-select-ext-trig.patch @@ -62,7 +62,7 @@ Signed-off-by: Dave Stevenson static const unsigned long supported_xclk_rates[] = { [OV7251_19_2_MHZ] = 19200000, [OV7251_24_MHZ] = 24000000, -@@ -1372,6 +1384,23 @@ static int ov7251_s_stream(struct v4l2_s +@@ -1374,6 +1386,23 @@ static int ov7251_s_stream(struct v4l2_s dev_err(ov7251->dev, "could not sync v4l2 controls\n"); goto err_power_down; } diff --git a/target/linux/bcm27xx/patches-6.6/950-0407-dtbindings-media-i2c-Add-IMX708-CMOS-sensor-binding.patch b/target/linux/bcm27xx/patches-6.6/950-0407-dtbindings-media-i2c-Add-IMX708-CMOS-sensor-binding.patch index 06d744a82b5d55..5962bb3fbb9046 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0407-dtbindings-media-i2c-Add-IMX708-CMOS-sensor-binding.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0407-dtbindings-media-i2c-Add-IMX708-CMOS-sensor-binding.patch @@ -138,7 +138,7 @@ Signed-off-by: Dave Stevenson +... --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -20106,6 +20106,14 @@ T: git git://linuxtv.org/media_tree.git +@@ -20107,6 +20107,14 @@ T: git git://linuxtv.org/media_tree.git F: Documentation/devicetree/bindings/media/i2c/imx519.yaml F: drivers/media/i2c/imx519.c diff --git a/target/linux/bcm27xx/patches-6.6/950-0434-dt-bindings-media-i2c-Replace-IMX708-sensor-binding-.patch b/target/linux/bcm27xx/patches-6.6/950-0434-dt-bindings-media-i2c-Replace-IMX708-sensor-binding-.patch index a01247a1c3505d..5c8457c8690b4a 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0434-dt-bindings-media-i2c-Replace-IMX708-sensor-binding-.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0434-dt-bindings-media-i2c-Replace-IMX708-sensor-binding-.patch @@ -271,7 +271,7 @@ Signed-off-by: Naushir Patuck +... --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -20111,7 +20111,7 @@ M: Raspberry Pi Kernel Maintenance + }; --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -20012,7 +20012,7 @@ M: Sakari Ailus clk_disable_unprepare(pcie->clk); return ret; } -@@ -1599,6 +1970,33 @@ static int brcm_pcie_probe(struct platfo - dev_err(pcie->dev, "probe of internal MSI failed"); - goto fail; - } -+ } else if (pci_msi_enabled() && msi_np != pcie->np) { -+ /* Use RC_BAR1 for MIP access */ -+ u64 msi_pci_addr; -+ u64 msi_phys_addr; -+ -+ if (of_property_read_u64(msi_np, "brcm,msi-pci-addr", &msi_pci_addr)) { -+ dev_err(pcie->dev, "Unable to find MSI PCI address\n"); -+ ret = -EINVAL; -+ goto fail; -+ } -+ -+ if (of_property_read_u64(msi_np, "reg", &msi_phys_addr)) { -+ dev_err(pcie->dev, "Unable to find MSI physical address\n"); -+ ret = -EINVAL; -+ goto fail; +@@ -1595,8 +1966,38 @@ static int brcm_pcie_probe(struct platfo + if (pci_msi_enabled()) { + struct device_node *msi_np = of_parse_phandle(pcie->np, "msi-parent", 0); + +- if (msi_np == pcie->np) ++ if (msi_np == pcie->np) { + ret = brcm_pcie_enable_msi(pcie); ++ } else { ++ /* Use RC_BAR1 for MIP access */ ++ u64 msi_pci_addr; ++ u64 msi_phys_addr; ++ ++ if (of_property_read_u64(msi_np, "brcm,msi-pci-addr", &msi_pci_addr)) { ++ dev_err(pcie->dev, "Unable to find MSI PCI address\n"); ++ ret = -EINVAL; ++ of_node_put(msi_np); ++ goto fail; ++ } ++ ++ if (of_property_read_u64(msi_np, "reg", &msi_phys_addr)) { ++ dev_err(pcie->dev, "Unable to find MSI physical address\n"); ++ ret = -EINVAL; ++ of_node_put(msi_np); ++ goto fail; ++ } ++ ++ writel(lower_32_bits(msi_pci_addr) | brcm_pcie_encode_ibar_size(0x1000), ++ pcie->base + PCIE_MISC_RC_BAR1_CONFIG_LO); ++ writel(upper_32_bits(msi_pci_addr), ++ pcie->base + PCIE_MISC_RC_BAR1_CONFIG_HI); ++ ++ writel(lower_32_bits(msi_phys_addr) | ++ PCIE_MISC_UBUS_BAR1_CONFIG_REMAP_ACCESS_ENABLE_MASK, ++ pcie->base + PCIE_MISC_UBUS_BAR1_CONFIG_REMAP); ++ writel(upper_32_bits(msi_phys_addr), ++ pcie->base + PCIE_MISC_UBUS_BAR1_CONFIG_REMAP_HI); + } -+ -+ writel(lower_32_bits(msi_pci_addr) | brcm_pcie_encode_ibar_size(0x1000), -+ pcie->base + PCIE_MISC_RC_BAR1_CONFIG_LO); -+ writel(upper_32_bits(msi_pci_addr), -+ pcie->base + PCIE_MISC_RC_BAR1_CONFIG_HI); -+ -+ writel(lower_32_bits(msi_phys_addr) | -+ PCIE_MISC_UBUS_BAR1_CONFIG_REMAP_ACCESS_ENABLE_MASK, -+ pcie->base + PCIE_MISC_UBUS_BAR1_CONFIG_REMAP); -+ writel(upper_32_bits(msi_phys_addr), -+ pcie->base + PCIE_MISC_UBUS_BAR1_CONFIG_REMAP_HI); - } - bridge->ops = pcie->type == BCM7425 ? &brcm7425_pcie_ops : &brcm_pcie_ops; -@@ -1615,6 +2013,8 @@ static int brcm_pcie_probe(struct platfo + of_node_put(msi_np); + +@@ -1620,6 +2021,8 @@ static int brcm_pcie_probe(struct platfo return ret; } diff --git a/target/linux/bcm27xx/patches-6.6/950-0545-ASoC-dwc-Support-set_bclk_ratio.patch b/target/linux/bcm27xx/patches-6.6/950-0545-ASoC-dwc-Support-set_bclk_ratio.patch index 29077e0d1f6439..bc7cd7ddbaf430 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0545-ASoC-dwc-Support-set_bclk_ratio.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0545-ASoC-dwc-Support-set_bclk_ratio.patch @@ -10,7 +10,7 @@ Signed-off-by: Phil Elwell --- a/sound/soc/dwc/dwc-i2s.c +++ b/sound/soc/dwc/dwc-i2s.c -@@ -460,6 +460,40 @@ static int dw_i2s_set_tdm_slot(struct sn +@@ -459,6 +459,40 @@ static int dw_i2s_set_tdm_slot(struct sn return 0; } @@ -51,7 +51,7 @@ Signed-off-by: Phil Elwell static int dw_i2s_dai_probe(struct snd_soc_dai *dai) { struct dw_i2s_dev *dev = snd_soc_dai_get_drvdata(dai); -@@ -476,6 +510,7 @@ static const struct snd_soc_dai_ops dw_i +@@ -475,6 +509,7 @@ static const struct snd_soc_dai_ops dw_i .trigger = dw_i2s_trigger, .set_fmt = dw_i2s_set_fmt, .set_tdm_slot = dw_i2s_set_tdm_slot, diff --git a/target/linux/bcm27xx/patches-6.6/950-0546-ASoC-dwc-Add-DMACR-handling.patch b/target/linux/bcm27xx/patches-6.6/950-0546-ASoC-dwc-Add-DMACR-handling.patch index 6eba454d5c610f..bc577668ab9111 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0546-ASoC-dwc-Add-DMACR-handling.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0546-ASoC-dwc-Add-DMACR-handling.patch @@ -14,7 +14,7 @@ Signed-off-by: Phil Elwell --- a/sound/soc/dwc/dwc-i2s.c +++ b/sound/soc/dwc/dwc-i2s.c -@@ -248,7 +248,7 @@ static void dw_i2s_config(struct dw_i2s_ +@@ -247,7 +247,7 @@ static void dw_i2s_config(struct dw_i2s_ { u32 ch_reg; struct i2s_clk_config_data *config = &dev->config; @@ -23,7 +23,7 @@ Signed-off-by: Phil Elwell i2s_disable_channels(dev, stream); -@@ -260,6 +260,7 @@ static void dw_i2s_config(struct dw_i2s_ +@@ -259,6 +259,7 @@ static void dw_i2s_config(struct dw_i2s_ dev->fifo_th - 1); i2s_write_reg(dev->i2s_base, TER(ch_reg), TER_TXCHEN | dev->tdm_mask << TER_TXSLOT_SHIFT); @@ -31,7 +31,7 @@ Signed-off-by: Phil Elwell } else { i2s_write_reg(dev->i2s_base, RCR(ch_reg), dev->xfer_resolution); -@@ -267,9 +268,15 @@ static void dw_i2s_config(struct dw_i2s_ +@@ -266,9 +267,15 @@ static void dw_i2s_config(struct dw_i2s_ dev->fifo_th - 1); i2s_write_reg(dev->i2s_base, RER(ch_reg), RER_RXCHEN | dev->tdm_mask << RER_RXSLOT_SHIFT); diff --git a/target/linux/bcm27xx/patches-6.6/950-0547-ASOC-dwc-Improve-DMA-shutdown.patch b/target/linux/bcm27xx/patches-6.6/950-0547-ASOC-dwc-Improve-DMA-shutdown.patch index bbe8c77488d723..f560b694bbd3f7 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0547-ASOC-dwc-Improve-DMA-shutdown.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0547-ASOC-dwc-Improve-DMA-shutdown.patch @@ -22,7 +22,7 @@ Signed-off-by: Phil Elwell #include #include #include -@@ -208,15 +208,10 @@ static void i2s_start(struct dw_i2s_dev +@@ -206,15 +206,10 @@ static void i2s_start(struct dw_i2s_dev i2s_write_reg(dev->i2s_base, CER, 1); } @@ -37,9 +37,9 @@ Signed-off-by: Phil Elwell - else - i2s_write_reg(dev->i2s_base, IRER, 0); - if (dev->use_pio || dev->is_jh7110) - i2s_disable_irqs(dev, substream->stream, 8); -@@ -225,23 +220,15 @@ static void i2s_stop(struct dw_i2s_dev * + if (!(dev->use_pio || dev->is_jh7110)) + i2s_disable_dma(dev, substream->stream); +@@ -224,23 +219,15 @@ static void i2s_stop(struct dw_i2s_dev * if (!dev->active) { i2s_write_reg(dev->i2s_base, CER, 0); @@ -67,7 +67,7 @@ Signed-off-by: Phil Elwell } static void dw_i2s_config(struct dw_i2s_dev *dev, int stream) -@@ -354,6 +341,62 @@ static int dw_i2s_hw_params(struct snd_p +@@ -353,6 +340,62 @@ static int dw_i2s_hw_params(struct snd_p return 0; } @@ -130,7 +130,7 @@ Signed-off-by: Phil Elwell static int dw_i2s_prepare(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { -@@ -381,9 +424,12 @@ static int dw_i2s_trigger(struct snd_pcm +@@ -380,9 +423,12 @@ static int dw_i2s_trigger(struct snd_pcm i2s_start(dev, substream); break; @@ -144,7 +144,7 @@ Signed-off-by: Phil Elwell dev->active--; i2s_stop(dev, substream); break; -@@ -512,6 +558,7 @@ static int dw_i2s_dai_probe(struct snd_s +@@ -511,6 +557,7 @@ static int dw_i2s_dai_probe(struct snd_s static const struct snd_soc_dai_ops dw_i2s_dai_ops = { .probe = dw_i2s_dai_probe, .startup = dw_i2s_startup, diff --git a/target/linux/bcm27xx/patches-6.6/950-0548-ASOC-dwc-Fix-16-bit-audio-handling.patch b/target/linux/bcm27xx/patches-6.6/950-0548-ASOC-dwc-Fix-16-bit-audio-handling.patch index b8a1849dbe01fc..d5f3adaf5b80dd 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0548-ASOC-dwc-Fix-16-bit-audio-handling.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0548-ASOC-dwc-Fix-16-bit-audio-handling.patch @@ -22,7 +22,7 @@ Signed-off-by: Phil Elwell --- a/sound/soc/dwc/dwc-i2s.c +++ b/sound/soc/dwc/dwc-i2s.c -@@ -271,23 +271,34 @@ static int dw_i2s_hw_params(struct snd_p +@@ -270,23 +270,34 @@ static int dw_i2s_hw_params(struct snd_p { struct dw_i2s_dev *dev = snd_soc_dai_get_drvdata(dai); struct i2s_clk_config_data *config = &dev->config; @@ -57,7 +57,7 @@ Signed-off-by: Phil Elwell dev->ccr = 0x10; dev->xfer_resolution = 0x05; break; -@@ -519,24 +530,21 @@ static int dw_i2s_set_bclk_ratio(struct +@@ -518,24 +529,21 @@ static int dw_i2s_set_bclk_ratio(struct struct dw_i2s_dev *dev = snd_soc_dai_get_drvdata(cpu_dai); struct i2s_clk_config_data *config = &dev->config; diff --git a/target/linux/bcm27xx/patches-6.6/950-0732-ASoC-dwc-Remove-check-in-set_bclk_ratio-handling.patch b/target/linux/bcm27xx/patches-6.6/950-0732-ASoC-dwc-Remove-check-in-set_bclk_ratio-handling.patch index d6eb8cbbaa0a26..0112ecad7879e4 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0732-ASoC-dwc-Remove-check-in-set_bclk_ratio-handling.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0732-ASoC-dwc-Remove-check-in-set_bclk_ratio-handling.patch @@ -18,7 +18,7 @@ Signed-off-by: Phil Elwell --- a/sound/soc/dwc/dwc-i2s.c +++ b/sound/soc/dwc/dwc-i2s.c -@@ -528,11 +528,8 @@ static int dw_i2s_set_bclk_ratio(struct +@@ -527,11 +527,8 @@ static int dw_i2s_set_bclk_ratio(struct unsigned int ratio) { struct dw_i2s_dev *dev = snd_soc_dai_get_drvdata(cpu_dai); diff --git a/target/linux/bcm27xx/patches-6.6/950-0737-media-i2c-ov7251-Switch-from-V4L2_CID_GAIN-to-V4L2_C.patch b/target/linux/bcm27xx/patches-6.6/950-0737-media-i2c-ov7251-Switch-from-V4L2_CID_GAIN-to-V4L2_C.patch index 31e1a5cfd4e203..f71ca4cdf75af0 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0737-media-i2c-ov7251-Switch-from-V4L2_CID_GAIN-to-V4L2_C.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0737-media-i2c-ov7251-Switch-from-V4L2_CID_GAIN-to-V4L2_C.patch @@ -18,7 +18,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/media/i2c/ov7251.c +++ b/drivers/media/i2c/ov7251.c -@@ -1063,7 +1063,7 @@ static int ov7251_s_ctrl(struct v4l2_ctr +@@ -1065,7 +1065,7 @@ static int ov7251_s_ctrl(struct v4l2_ctr case V4L2_CID_EXPOSURE: ret = ov7251_set_exposure(ov7251, ctrl->val); break; @@ -27,7 +27,7 @@ Signed-off-by: Dave Stevenson ret = ov7251_set_gain(ov7251, ctrl->val); break; case V4L2_CID_TEST_PATTERN: -@@ -1588,7 +1588,7 @@ static int ov7251_init_ctrls(struct ov72 +@@ -1590,7 +1590,7 @@ static int ov7251_init_ctrls(struct ov72 ov7251->exposure = v4l2_ctrl_new_std(&ov7251->ctrls, &ov7251_ctrl_ops, V4L2_CID_EXPOSURE, 1, 32, 1, 32); ov7251->gain = v4l2_ctrl_new_std(&ov7251->ctrls, &ov7251_ctrl_ops, diff --git a/target/linux/bcm27xx/patches-6.6/950-0750-ASoC-dwc-Permit-sample-rates-up-to-384kHz.patch b/target/linux/bcm27xx/patches-6.6/950-0750-ASoC-dwc-Permit-sample-rates-up-to-384kHz.patch index 4a7aaad3a228fc..8bf58f54cfe0cc 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0750-ASoC-dwc-Permit-sample-rates-up-to-384kHz.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0750-ASoC-dwc-Permit-sample-rates-up-to-384kHz.patch @@ -15,7 +15,7 @@ Signed-off-by: Phil Elwell --- a/sound/soc/dwc/dwc-i2s.c +++ b/sound/soc/dwc/dwc-i2s.c -@@ -796,7 +796,7 @@ static int dw_configure_dai_by_dt(struct +@@ -795,7 +795,7 @@ static int dw_configure_dai_by_dt(struct u32 idx2; int ret; diff --git a/target/linux/bcm27xx/patches-6.6/950-0752-ASoC-dwc-Fix-full-duplex-mode.patch b/target/linux/bcm27xx/patches-6.6/950-0752-ASoC-dwc-Fix-full-duplex-mode.patch index cffdd3302722e9..d1814f55fa5c69 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0752-ASoC-dwc-Fix-full-duplex-mode.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0752-ASoC-dwc-Fix-full-duplex-mode.patch @@ -15,7 +15,7 @@ Signed-off-by: Phil Elwell --- a/sound/soc/dwc/dwc-i2s.c +++ b/sound/soc/dwc/dwc-i2s.c -@@ -235,10 +235,17 @@ static void dw_i2s_config(struct dw_i2s_ +@@ -234,10 +234,17 @@ static void dw_i2s_config(struct dw_i2s_ { u32 ch_reg; struct i2s_clk_config_data *config = &dev->config; @@ -34,7 +34,7 @@ Signed-off-by: Phil Elwell for (ch_reg = 0; ch_reg < (config->chan_nr / 2); ch_reg++) { if (stream == SNDRV_PCM_STREAM_PLAYBACK) { i2s_write_reg(dev->i2s_base, TCR(ch_reg), -@@ -258,10 +265,6 @@ static void dw_i2s_config(struct dw_i2s_ +@@ -257,10 +264,6 @@ static void dw_i2s_config(struct dw_i2s_ dmacr |= (DMACR_DMAEN_RXCH0 << ch_reg); } } @@ -45,7 +45,7 @@ Signed-off-by: Phil Elwell i2s_write_reg(dev->i2s_base, I2S_DMACR, dmacr); } -@@ -370,10 +373,13 @@ static int dw_i2s_startup(struct snd_pcm +@@ -369,10 +372,13 @@ static int dw_i2s_startup(struct snd_pcm dw_i2s_config(dev, substream->stream); dmacr = i2s_read_reg(dev->i2s_base, I2S_DMACR); diff --git a/target/linux/bcm27xx/patches-6.6/950-0767-media-dt-bindings-i2c-Add-Rohm-BU64754-bindings.patch b/target/linux/bcm27xx/patches-6.6/950-0767-media-dt-bindings-i2c-Add-Rohm-BU64754-bindings.patch index 824258ff89c0e0..2d3259092717a1 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0767-media-dt-bindings-i2c-Add-Rohm-BU64754-bindings.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0767-media-dt-bindings-i2c-Add-Rohm-BU64754-bindings.patch @@ -67,7 +67,7 @@ Signed-off-by: Jacopo Mondi +... --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -18619,6 +18619,13 @@ S: Supported +@@ -18620,6 +18620,13 @@ S: Supported F: drivers/iio/light/rohm-bu27008.c F: drivers/iio/light/rohm-bu27034.c diff --git a/target/linux/bcm27xx/patches-6.6/950-0768-media-i2c-Add-driver-for-OmniVision-OV64A40.patch b/target/linux/bcm27xx/patches-6.6/950-0768-media-i2c-Add-driver-for-OmniVision-OV64A40.patch index 986cc49deec8de..477ac8319ff89f 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0768-media-i2c-Add-driver-for-OmniVision-OV64A40.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0768-media-i2c-Add-driver-for-OmniVision-OV64A40.patch @@ -16,7 +16,7 @@ Signed-off-by: Jacopo Mondi --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -15871,6 +15871,14 @@ S: Maintained +@@ -15872,6 +15872,14 @@ S: Maintained T: git git://linuxtv.org/media_tree.git F: drivers/media/i2c/ov5695.c diff --git a/target/linux/bcm27xx/patches-6.6/950-0809-ASoC-dwc-Defer-bclk_ratio-handling-to-hw_params.patch b/target/linux/bcm27xx/patches-6.6/950-0809-ASoC-dwc-Defer-bclk_ratio-handling-to-hw_params.patch index 49ca7d6337265e..17b1b32263b67f 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0809-ASoC-dwc-Defer-bclk_ratio-handling-to-hw_params.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0809-ASoC-dwc-Defer-bclk_ratio-handling-to-hw_params.patch @@ -18,7 +18,7 @@ Signed-off-by: Phil Elwell --- a/sound/soc/dwc/dwc-i2s.c +++ b/sound/soc/dwc/dwc-i2s.c -@@ -314,6 +314,25 @@ static int dw_i2s_hw_params(struct snd_p +@@ -313,6 +313,25 @@ static int dw_i2s_hw_params(struct snd_p if (dev->tdm_slots) config->data_width = 32; @@ -44,7 +44,7 @@ Signed-off-by: Phil Elwell config->chan_nr = params_channels(params); switch (config->chan_nr) { -@@ -537,23 +556,7 @@ static int dw_i2s_set_bclk_ratio(struct +@@ -536,23 +555,7 @@ static int dw_i2s_set_bclk_ratio(struct dev_dbg(dev->dev, "%s(%d)\n", __func__, ratio); @@ -69,7 +69,7 @@ Signed-off-by: Phil Elwell return 0; } -@@ -1068,6 +1071,7 @@ static int dw_i2s_probe(struct platform_ +@@ -1067,6 +1070,7 @@ static int dw_i2s_probe(struct platform_ } } diff --git a/target/linux/bcm27xx/patches-6.6/950-0931-fixup-ASoC-dwc-Defer-bclk_ratio-handling-to-hw_param.patch b/target/linux/bcm27xx/patches-6.6/950-0931-fixup-ASoC-dwc-Defer-bclk_ratio-handling-to-hw_param.patch index 9f5c2b3a48dee3..7174cf0a5ae708 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0931-fixup-ASoC-dwc-Defer-bclk_ratio-handling-to-hw_param.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0931-fixup-ASoC-dwc-Defer-bclk_ratio-handling-to-hw_param.patch @@ -13,7 +13,7 @@ Signed-off-by: Phil Elwell --- a/sound/soc/dwc/dwc-i2s.c +++ b/sound/soc/dwc/dwc-i2s.c -@@ -288,21 +288,18 @@ static int dw_i2s_hw_params(struct snd_p +@@ -287,21 +287,18 @@ static int dw_i2s_hw_params(struct snd_p case SNDRV_PCM_FORMAT_S16_LE: config->data_width = 16; dma_data->dt.addr_width = 2; @@ -35,7 +35,7 @@ Signed-off-by: Phil Elwell dev->xfer_resolution = 0x05; break; -@@ -314,25 +311,6 @@ static int dw_i2s_hw_params(struct snd_p +@@ -313,25 +310,6 @@ static int dw_i2s_hw_params(struct snd_p if (dev->tdm_slots) config->data_width = 32; @@ -61,7 +61,7 @@ Signed-off-by: Phil Elwell config->chan_nr = params_channels(params); switch (config->chan_nr) { -@@ -348,11 +326,31 @@ static int dw_i2s_hw_params(struct snd_p +@@ -347,11 +325,31 @@ static int dw_i2s_hw_params(struct snd_p dw_i2s_config(dev, substream->stream); @@ -95,7 +95,7 @@ Signed-off-by: Phil Elwell if (dev->i2s_clk_cfg) { ret = dev->i2s_clk_cfg(config); if (ret < 0) { -@@ -360,8 +358,7 @@ static int dw_i2s_hw_params(struct snd_p +@@ -359,8 +357,7 @@ static int dw_i2s_hw_params(struct snd_p return ret; } } else { @@ -105,7 +105,7 @@ Signed-off-by: Phil Elwell ret = clk_set_rate(dev->clk, bitclk); if (ret) { -@@ -370,6 +367,8 @@ static int dw_i2s_hw_params(struct snd_p +@@ -369,6 +366,8 @@ static int dw_i2s_hw_params(struct snd_p return ret; } } diff --git a/target/linux/bcm27xx/patches-6.6/950-0951-ASoC-dwc-Correct-channel-count-reporting.patch b/target/linux/bcm27xx/patches-6.6/950-0951-ASoC-dwc-Correct-channel-count-reporting.patch index 8f54995dc05b06..aaf9e32b4022bb 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0951-ASoC-dwc-Correct-channel-count-reporting.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0951-ASoC-dwc-Correct-channel-count-reporting.patch @@ -17,7 +17,7 @@ Signed-off-by: Phil Elwell --- a/sound/soc/dwc/dwc-i2s.c +++ b/sound/soc/dwc/dwc-i2s.c -@@ -320,7 +320,7 @@ static int dw_i2s_hw_params(struct snd_p +@@ -319,7 +319,7 @@ static int dw_i2s_hw_params(struct snd_p case TWO_CHANNEL_SUPPORT: break; default: @@ -26,7 +26,7 @@ Signed-off-by: Phil Elwell return -EINVAL; } -@@ -708,7 +708,7 @@ static int dw_configure_dai(struct dw_i2 +@@ -707,7 +707,7 @@ static int dw_configure_dai(struct dw_i2 idx = 1; dw_i2s_dai->playback.channels_min = MIN_CHANNEL_NUM; dw_i2s_dai->playback.channels_max = @@ -35,7 +35,7 @@ Signed-off-by: Phil Elwell dw_i2s_dai->playback.formats = formats[idx]; dw_i2s_dai->playback.rates = rates; } -@@ -722,7 +722,7 @@ static int dw_configure_dai(struct dw_i2 +@@ -721,7 +721,7 @@ static int dw_configure_dai(struct dw_i2 idx = 1; dw_i2s_dai->capture.channels_min = MIN_CHANNEL_NUM; dw_i2s_dai->capture.channels_max = diff --git a/target/linux/bcm27xx/patches-6.6/950-1128-pwm-Make-it-possible-to-apply-PWM-changes-in-atomic-.patch b/target/linux/bcm27xx/patches-6.6/950-1128-pwm-Make-it-possible-to-apply-PWM-changes-in-atomic-.patch index 269bb7219a6e29..2441e8223e7247 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1128-pwm-Make-it-possible-to-apply-PWM-changes-in-atomic-.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1128-pwm-Make-it-possible-to-apply-PWM-changes-in-atomic-.patch @@ -48,7 +48,7 @@ Signed-off-by: Thierry Reding drivers cannot. If you rely on getting the inactive state, use .duty_cycle=0, --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -17437,7 +17437,7 @@ F: drivers/video/backlight/pwm_bl.c +@@ -17438,7 +17438,7 @@ F: drivers/video/backlight/pwm_bl.c F: include/dt-bindings/pwm/ F: include/linux/pwm.h F: include/linux/pwm_backlight.h diff --git a/target/linux/bcm27xx/patches-6.6/950-1149-media-uapi-Add-Raspberry-Pi-PiSP-Back-End-uAPI.patch b/target/linux/bcm27xx/patches-6.6/950-1149-media-uapi-Add-Raspberry-Pi-PiSP-Back-End-uAPI.patch index a59bcb1e9708b5..a95742b475e026 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1149-media-uapi-Add-Raspberry-Pi-PiSP-Back-End-uAPI.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1149-media-uapi-Add-Raspberry-Pi-PiSP-Back-End-uAPI.patch @@ -23,7 +23,7 @@ Signed-off-by: Jacopo Mondi --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -18032,6 +18032,13 @@ L: linux-wireless@vger.kernel.org +@@ -18033,6 +18033,13 @@ L: linux-wireless@vger.kernel.org S: Orphan F: drivers/net/wireless/legacy/ray* diff --git a/target/linux/bcm27xx/patches-6.6/950-1152-media-dt-bindings-Add-bindings-for-Raspberry-Pi-PiSP.patch b/target/linux/bcm27xx/patches-6.6/950-1152-media-dt-bindings-Add-bindings-for-Raspberry-Pi-PiSP.patch index 30c5cb35068d52..e6f15fa47151e8 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1152-media-dt-bindings-Add-bindings-for-Raspberry-Pi-PiSP.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1152-media-dt-bindings-Add-bindings-for-Raspberry-Pi-PiSP.patch @@ -87,7 +87,7 @@ Reviewed-by: Naushir Patuck + }; --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -18037,6 +18037,7 @@ M: Jacopo Mondi L: linux-media@vger.kernel.org S: Maintained diff --git a/target/linux/bcm27xx/patches-6.6/950-1164-spi-dt-bindings-Add-RPI-RP2040-GPIO-Bridge.patch b/target/linux/bcm27xx/patches-6.6/950-1164-spi-dt-bindings-Add-RPI-RP2040-GPIO-Bridge.patch index 487e508ea473be..abdf8157a5486d 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1164-spi-dt-bindings-Add-RPI-RP2040-GPIO-Bridge.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1164-spi-dt-bindings-Add-RPI-RP2040-GPIO-Bridge.patch @@ -94,7 +94,7 @@ Signed-off-by: Richard Oliver + --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -18027,6 +18027,11 @@ F: drivers/ras/ +@@ -18028,6 +18028,11 @@ F: drivers/ras/ F: include/linux/ras.h F: include/ras/ras_event.h diff --git a/target/linux/bcm27xx/patches-6.6/950-1165-spi-Add-a-driver-for-the-RPI-RP2040-GPIO-bridge.patch b/target/linux/bcm27xx/patches-6.6/950-1165-spi-Add-a-driver-for-the-RPI-RP2040-GPIO-bridge.patch index 68e2ef600778d8..3d977db80d3065 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1165-spi-Add-a-driver-for-the-RPI-RP2040-GPIO-bridge.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1165-spi-Add-a-driver-for-the-RPI-RP2040-GPIO-bridge.patch @@ -25,7 +25,7 @@ Signed-off-by: Richard Oliver --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -18031,6 +18031,7 @@ RASPBERRY PI RP2040 GPIO BRIDGE DRIVER +@@ -18032,6 +18032,7 @@ RASPBERRY PI RP2040 GPIO BRIDGE DRIVER M: Raspberry Pi Kernel Maintenance S: Maintained F: Documentation/devicetree/bindings/spi/raspberrypi,rp2040-gpio-bridge.yaml diff --git a/target/linux/bcm27xx/patches-6.6/950-1197-sound-soc-dwc-i2s-choose-FIFO-thresholds-based-on-DM.patch b/target/linux/bcm27xx/patches-6.6/950-1197-sound-soc-dwc-i2s-choose-FIFO-thresholds-based-on-DM.patch index d0e3bc1fab0f1f..18bd7657013373 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1197-sound-soc-dwc-i2s-choose-FIFO-thresholds-based-on-DM.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1197-sound-soc-dwc-i2s-choose-FIFO-thresholds-based-on-DM.patch @@ -22,7 +22,7 @@ Signed-off-by: Jonathan Bell --- a/sound/soc/dwc/dwc-i2s.c +++ b/sound/soc/dwc/dwc-i2s.c -@@ -236,6 +236,8 @@ static void dw_i2s_config(struct dw_i2s_ +@@ -235,6 +235,8 @@ static void dw_i2s_config(struct dw_i2s_ u32 ch_reg; struct i2s_clk_config_data *config = &dev->config; u32 dmacr; @@ -31,7 +31,7 @@ Signed-off-by: Jonathan Bell i2s_disable_channels(dev, stream); -@@ -251,7 +253,7 @@ static void dw_i2s_config(struct dw_i2s_ +@@ -250,7 +252,7 @@ static void dw_i2s_config(struct dw_i2s_ i2s_write_reg(dev->i2s_base, TCR(ch_reg), dev->xfer_resolution); i2s_write_reg(dev->i2s_base, TFCR(ch_reg), @@ -40,7 +40,7 @@ Signed-off-by: Jonathan Bell i2s_write_reg(dev->i2s_base, TER(ch_reg), TER_TXCHEN | dev->tdm_mask << TER_TXSLOT_SHIFT); dmacr |= (DMACR_DMAEN_TXCH0 << ch_reg); -@@ -783,8 +785,8 @@ static int dw_configure_dai_by_pd(struct +@@ -782,8 +784,8 @@ static int dw_configure_dai_by_pd(struct dev->capture_dma_data.pd.data = pdata->capture_dma_data; dev->play_dma_data.pd.addr = res->start + I2S_TXDMA; dev->capture_dma_data.pd.addr = res->start + I2S_RXDMA; @@ -51,7 +51,7 @@ Signed-off-by: Jonathan Bell dev->play_dma_data.pd.addr_width = bus_widths[idx]; dev->capture_dma_data.pd.addr_width = bus_widths[idx]; dev->play_dma_data.pd.filter = pdata->filter; -@@ -815,7 +817,10 @@ static int dw_configure_dai_by_dt(struct +@@ -814,7 +816,10 @@ static int dw_configure_dai_by_dt(struct dev->play_dma_data.dt.addr = res->start + I2S_TXDMA; dev->play_dma_data.dt.fifo_size = fifo_depth * (fifo_width[idx2]) >> 8; @@ -63,7 +63,7 @@ Signed-off-by: Jonathan Bell } if (COMP1_RX_ENABLED(comp1)) { idx2 = COMP2_RX_WORDSIZE_0(comp2); -@@ -824,9 +829,14 @@ static int dw_configure_dai_by_dt(struct +@@ -823,9 +828,14 @@ static int dw_configure_dai_by_dt(struct dev->capture_dma_data.dt.addr = res->start + I2S_RXDMA; dev->capture_dma_data.dt.fifo_size = fifo_depth * (fifo_width[idx2] >> 8); @@ -79,7 +79,7 @@ Signed-off-by: Jonathan Bell return 0; } -@@ -1070,6 +1080,7 @@ static int dw_i2s_probe(struct platform_ +@@ -1069,6 +1079,7 @@ static int dw_i2s_probe(struct platform_ } } diff --git a/target/linux/bcm27xx/patches-6.6/950-1243-media-dt-bindings-i2c-Add-Sony-IMX500.patch b/target/linux/bcm27xx/patches-6.6/950-1243-media-dt-bindings-i2c-Add-Sony-IMX500.patch index 82e58c12bc586b..cfd4b46d4ff6b7 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1243-media-dt-bindings-i2c-Add-Sony-IMX500.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1243-media-dt-bindings-i2c-Add-Sony-IMX500.patch @@ -150,7 +150,7 @@ Signed-off-by: Richard Oliver + --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -20127,6 +20127,13 @@ F: Documentation/devicetree/bindings/med +@@ -20128,6 +20128,13 @@ 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-6.6/950-1244-media-i2c-Add-driver-for-Sony-IMX500-sensor.patch b/target/linux/bcm27xx/patches-6.6/950-1244-media-i2c-Add-driver-for-Sony-IMX500-sensor.patch index 331e5863a645cf..c6b9196a525267 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1244-media-i2c-Add-driver-for-Sony-IMX500-sensor.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1244-media-i2c-Add-driver-for-Sony-IMX500-sensor.patch @@ -21,7 +21,7 @@ Signed-off-by: Richard Oliver --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -20133,6 +20133,7 @@ L: linux-media@vger.kernel.org +@@ -20134,6 +20134,7 @@ L: linux-media@vger.kernel.org S: Maintained T: git git://linuxtv.org/media_tree.git F: Documentation/devicetree/bindings/media/i2c/sony,imx500.yaml diff --git a/target/linux/generic/backport-6.6/764-v6.10-net-dsa-allow-DSA-switch-drivers-to-provide-their-ow.patch b/target/linux/generic/backport-6.6/764-v6.10-net-dsa-allow-DSA-switch-drivers-to-provide-their-ow.patch index 7c9ab16d4af989..b86935f9af7b45 100644 --- a/target/linux/generic/backport-6.6/764-v6.10-net-dsa-allow-DSA-switch-drivers-to-provide-their-ow.patch +++ b/target/linux/generic/backport-6.6/764-v6.10-net-dsa-allow-DSA-switch-drivers-to-provide-their-ow.patch @@ -38,7 +38,7 @@ Signed-off-by: Jakub Kicinski u32 phys_mii_mask; --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c -@@ -1510,6 +1510,17 @@ static int dsa_switch_probe(struct dsa_s +@@ -1549,6 +1549,17 @@ static int dsa_switch_probe(struct dsa_s if (!ds->num_ports) return -EINVAL; diff --git a/target/linux/generic/backport-6.6/795-v6.7-16-r8152-use-napi_gro_frags.patch b/target/linux/generic/backport-6.6/795-v6.7-16-r8152-use-napi_gro_frags.patch index 85b320f15aa5b4..73adadc4351df1 100644 --- a/target/linux/generic/backport-6.6/795-v6.7-16-r8152-use-napi_gro_frags.patch +++ b/target/linux/generic/backport-6.6/795-v6.7-16-r8152-use-napi_gro_frags.patch @@ -15,7 +15,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c -@@ -2584,8 +2584,9 @@ static int rx_bottom(struct r8152 *tp, i +@@ -2585,8 +2585,9 @@ static int rx_bottom(struct r8152 *tp, i while (urb->actual_length > len_used) { struct net_device *netdev = tp->netdev; struct net_device_stats *stats = &netdev->stats; @@ -26,7 +26,7 @@ Signed-off-by: Jakub Kicinski WARN_ON_ONCE(skb_queue_len(&tp->rx_queue) >= 1000); -@@ -2598,45 +2599,77 @@ static int rx_bottom(struct r8152 *tp, i +@@ -2599,45 +2600,77 @@ static int rx_bottom(struct r8152 *tp, i break; pkt_len -= ETH_FCS_LEN; diff --git a/target/linux/generic/backport-6.6/823-v6.12-0003-nvmem-layouts-add-U-Boot-env-layout.patch b/target/linux/generic/backport-6.6/823-v6.12-0003-nvmem-layouts-add-U-Boot-env-layout.patch index 15a0f77bb33192..af1b8b4e78fb51 100644 --- a/target/linux/generic/backport-6.6/823-v6.12-0003-nvmem-layouts-add-U-Boot-env-layout.patch +++ b/target/linux/generic/backport-6.6/823-v6.12-0003-nvmem-layouts-add-U-Boot-env-layout.patch @@ -41,7 +41,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -21988,6 +21988,7 @@ U-BOOT ENVIRONMENT VARIABLES +@@ -21989,6 +21989,7 @@ U-BOOT ENVIRONMENT VARIABLES M: Rafał Miłecki S: Maintained F: Documentation/devicetree/bindings/nvmem/u-boot,env.yaml diff --git a/target/linux/generic/backport-6.6/896-01-v6.9-net-dsa-mv88e6xxx-rename-mv88e6xxx_g2_scratch_gpio_s.patch b/target/linux/generic/backport-6.6/896-01-v6.9-net-dsa-mv88e6xxx-rename-mv88e6xxx_g2_scratch_gpio_s.patch index 2c3e99d8e09341..7e71e49dfa33df 100644 --- a/target/linux/generic/backport-6.6/896-01-v6.9-net-dsa-mv88e6xxx-rename-mv88e6xxx_g2_scratch_gpio_s.patch +++ b/target/linux/generic/backport-6.6/896-01-v6.9-net-dsa-mv88e6xxx-rename-mv88e6xxx_g2_scratch_gpio_s.patch @@ -19,7 +19,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c -@@ -3699,7 +3699,7 @@ static int mv88e6xxx_mdio_register(struc +@@ -3725,7 +3725,7 @@ static int mv88e6xxx_mdio_register(struc if (external) { mv88e6xxx_reg_lock(chip); diff --git a/target/linux/generic/backport-6.6/896-02-v6.9-net-dsa-mv88e6xxx-add-Amethyst-specific-SMI-GPIO-fun.patch b/target/linux/generic/backport-6.6/896-02-v6.9-net-dsa-mv88e6xxx-add-Amethyst-specific-SMI-GPIO-fun.patch index 875acd3ba1671b..4fac0e2a13ae55 100644 --- a/target/linux/generic/backport-6.6/896-02-v6.9-net-dsa-mv88e6xxx-add-Amethyst-specific-SMI-GPIO-fun.patch +++ b/target/linux/generic/backport-6.6/896-02-v6.9-net-dsa-mv88e6xxx-add-Amethyst-specific-SMI-GPIO-fun.patch @@ -27,7 +27,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c -@@ -3699,7 +3699,10 @@ static int mv88e6xxx_mdio_register(struc +@@ -3725,7 +3725,10 @@ static int mv88e6xxx_mdio_register(struc if (external) { mv88e6xxx_reg_lock(chip); diff --git a/target/linux/generic/backport-6.6/901-v6.13-net-dsa-mv88e6xxx-Support-LED-control.patch b/target/linux/generic/backport-6.6/901-v6.13-net-dsa-mv88e6xxx-Support-LED-control.patch index 1674359d266634..838cce8f4a03ff 100644 --- a/target/linux/generic/backport-6.6/901-v6.13-net-dsa-mv88e6xxx-Support-LED-control.patch +++ b/target/linux/generic/backport-6.6/901-v6.13-net-dsa-mv88e6xxx-Support-LED-control.patch @@ -127,7 +127,7 @@ Signed-off-by: Linus Walleij #include #include #include -@@ -3265,14 +3266,43 @@ static int mv88e6xxx_setup_upstream_port +@@ -3276,14 +3277,43 @@ static int mv88e6xxx_setup_upstream_port static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port) { struct device_node *phy_handle = NULL; @@ -173,7 +173,7 @@ Signed-off-by: Linus Walleij err = mv88e6xxx_port_setup_mac(chip, port, LINK_UNFORCED, SPEED_UNFORCED, DUPLEX_UNFORCED, -@@ -4491,6 +4521,7 @@ static const struct mv88e6xxx_ops mv88e6 +@@ -4517,6 +4547,7 @@ static const struct mv88e6xxx_ops mv88e6 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, .port_get_cmode = mv88e6352_port_get_cmode, @@ -181,7 +181,7 @@ Signed-off-by: Linus Walleij .port_setup_message_port = mv88e6xxx_setup_message_port, .stats_snapshot = mv88e6320_g1_stats_snapshot, .stats_set_histogram = mv88e6095_g1_stats_set_histogram, -@@ -4593,6 +4624,7 @@ static const struct mv88e6xxx_ops mv88e6 +@@ -4619,6 +4650,7 @@ static const struct mv88e6xxx_ops mv88e6 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, .port_get_cmode = mv88e6352_port_get_cmode, @@ -189,7 +189,7 @@ Signed-off-by: Linus Walleij .port_setup_message_port = mv88e6xxx_setup_message_port, .stats_snapshot = mv88e6320_g1_stats_snapshot, .stats_set_histogram = mv88e6095_g1_stats_set_histogram, -@@ -4868,6 +4900,7 @@ static const struct mv88e6xxx_ops mv88e6 +@@ -4894,6 +4926,7 @@ static const struct mv88e6xxx_ops mv88e6 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, .port_get_cmode = mv88e6352_port_get_cmode, @@ -197,7 +197,7 @@ Signed-off-by: Linus Walleij .port_setup_message_port = mv88e6xxx_setup_message_port, .stats_snapshot = mv88e6320_g1_stats_snapshot, .stats_set_histogram = mv88e6095_g1_stats_set_histogram, -@@ -5290,6 +5323,7 @@ static const struct mv88e6xxx_ops mv88e6 +@@ -5318,6 +5351,7 @@ static const struct mv88e6xxx_ops mv88e6 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, .port_get_cmode = mv88e6352_port_get_cmode, diff --git a/target/linux/generic/hack-6.6/610-net-page_pool-try-to-free-deferred-skbs-while-waitin.patch b/target/linux/generic/hack-6.6/610-net-page_pool-try-to-free-deferred-skbs-while-waitin.patch index c1f595913100df..85cd79f1a9ddd1 100644 --- a/target/linux/generic/hack-6.6/610-net-page_pool-try-to-free-deferred-skbs-while-waitin.patch +++ b/target/linux/generic/hack-6.6/610-net-page_pool-try-to-free-deferred-skbs-while-waitin.patch @@ -16,7 +16,7 @@ Signed-off-by: Felix Fietkau --- a/net/core/page_pool.c +++ b/net/core/page_pool.c -@@ -873,12 +873,23 @@ static void page_pool_release_retry(stru +@@ -873,7 +873,7 @@ static void page_pool_release_retry(stru { struct delayed_work *dwq = to_delayed_work(wq); struct page_pool *pool = container_of(dwq, typeof(*pool), release_dw); @@ -24,7 +24,9 @@ Signed-off-by: Felix Fietkau + int cpu, inflight; inflight = page_pool_release(pool); - if (!inflight) + /* In rare cases, a driver bug may cause inflight to go negative. +@@ -885,6 +885,17 @@ static void page_pool_release_retry(stru + if (inflight <= 0) return; + /* Run NET_RX_SOFTIRQ in order to free pending skbs in softnet_data diff --git a/target/linux/generic/hack-6.6/660-fq_codel_defaults.patch b/target/linux/generic/hack-6.6/660-fq_codel_defaults.patch index b923a2d206da3c..c39ae4c615c0cb 100644 --- a/target/linux/generic/hack-6.6/660-fq_codel_defaults.patch +++ b/target/linux/generic/hack-6.6/660-fq_codel_defaults.patch @@ -13,7 +13,7 @@ Signed-off-by: Felix Fietkau --- a/net/sched/sch_fq_codel.c +++ b/net/sched/sch_fq_codel.c -@@ -471,7 +471,11 @@ static int fq_codel_init(struct Qdisc *s +@@ -463,7 +463,11 @@ static int fq_codel_init(struct Qdisc *s sch->limit = 10*1024; q->flows_cnt = 1024; diff --git a/target/linux/generic/hack-6.6/711-net-dsa-mv88e6xxx-disable-ATU-violation.patch b/target/linux/generic/hack-6.6/711-net-dsa-mv88e6xxx-disable-ATU-violation.patch index ab594a471e3c13..7c62435d6ee7e9 100644 --- a/target/linux/generic/hack-6.6/711-net-dsa-mv88e6xxx-disable-ATU-violation.patch +++ b/target/linux/generic/hack-6.6/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 -@@ -3435,6 +3435,9 @@ static int mv88e6xxx_setup_port(struct m +@@ -3446,6 +3446,9 @@ static int mv88e6xxx_setup_port(struct m else reg = 1 << port; diff --git a/target/linux/generic/hack-6.6/760-net-usb-r8152-add-LED-configuration-from-OF.patch b/target/linux/generic/hack-6.6/760-net-usb-r8152-add-LED-configuration-from-OF.patch index 069c6823033594..680440b310c037 100644 --- a/target/linux/generic/hack-6.6/760-net-usb-r8152-add-LED-configuration-from-OF.patch +++ b/target/linux/generic/hack-6.6/760-net-usb-r8152-add-LED-configuration-from-OF.patch @@ -22,7 +22,7 @@ Signed-off-by: David Bauer #include #include #include -@@ -7044,6 +7045,22 @@ static void rtl_tally_reset(struct r8152 +@@ -7045,6 +7046,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; -@@ -7085,6 +7102,8 @@ static void r8152b_init(struct r8152 *tp +@@ -7086,6 +7103,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) -@@ -7225,6 +7244,8 @@ static void r8153_init(struct r8152 *tp) +@@ -7226,6 +7245,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) -@@ -7307,6 +7328,8 @@ static void r8153b_init(struct r8152 *tp +@@ -7308,6 +7329,8 @@ static void r8153b_init(struct r8152 *tp rtl_tally_reset(tp); tp->coalesce = 15000; /* 15 us */ diff --git a/target/linux/generic/hack-6.6/790-SFP-GE-T-ignore-TX_FAULT.patch b/target/linux/generic/hack-6.6/790-SFP-GE-T-ignore-TX_FAULT.patch index 1d6bc6ee079707..924425fb816d14 100644 --- a/target/linux/generic/hack-6.6/790-SFP-GE-T-ignore-TX_FAULT.patch +++ b/target/linux/generic/hack-6.6/790-SFP-GE-T-ignore-TX_FAULT.patch @@ -36,7 +36,7 @@ Signed-off-by: Daniel Golle // Lantech 8330-262D-E can operate at 2500base-X, but incorrectly report // 2500MBd NRZ in their EEPROM SFP_QUIRK_M("Lantech", "8330-262D-E", sfp_quirk_2500basex), -@@ -2590,7 +2593,8 @@ static void sfp_sm_main(struct sfp *sfp, +@@ -2592,7 +2595,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, @@ -46,7 +46,7 @@ Signed-off-by: Daniel Golle } else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR) { init_done: /* Create mdiobus and start trying for PHY */ -@@ -2844,10 +2848,12 @@ static void sfp_check_state(struct sfp * +@@ -2846,10 +2850,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/generic/pending-6.6/510-block-add-uImage.FIT-subimage-block-driver.patch b/target/linux/generic/pending-6.6/510-block-add-uImage.FIT-subimage-block-driver.patch index 5a88631513d696..056b49db3ef9c0 100644 --- a/target/linux/generic/pending-6.6/510-block-add-uImage.FIT-subimage-block-driver.patch +++ b/target/linux/generic/pending-6.6/510-block-add-uImage.FIT-subimage-block-driver.patch @@ -36,7 +36,7 @@ Signed-off-by: Daniel Golle --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -22015,6 +22015,12 @@ F: Documentation/filesystems/ubifs-authe +@@ -22016,6 +22016,12 @@ F: Documentation/filesystems/ubifs-authe F: Documentation/filesystems/ubifs.rst F: fs/ubifs/ diff --git a/target/linux/generic/pending-6.6/681-net-remove-NETIF_F_GSO_FRAGLIST-from-NETIF_F_GSO_SOF.patch b/target/linux/generic/pending-6.6/681-net-remove-NETIF_F_GSO_FRAGLIST-from-NETIF_F_GSO_SOF.patch index 58ccff247fb5c5..ff0a9ca5ae0c8d 100644 --- a/target/linux/generic/pending-6.6/681-net-remove-NETIF_F_GSO_FRAGLIST-from-NETIF_F_GSO_SOF.patch +++ b/target/linux/generic/pending-6.6/681-net-remove-NETIF_F_GSO_FRAGLIST-from-NETIF_F_GSO_SOF.patch @@ -76,7 +76,7 @@ Signed-off-by: Felix Fietkau if ((ret & NETIF_F_GSO_ENCAP_ALL) && (ret & NETIF_F_CSUM_MASK)) --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c -@@ -583,7 +583,7 @@ static int vlan_dev_init(struct net_devi +@@ -560,7 +560,7 @@ static int vlan_dev_init(struct net_devi dev->state |= (1 << __LINK_STATE_NOCARRIER); dev->hw_features = NETIF_F_HW_CSUM | NETIF_F_SG | @@ -85,7 +85,7 @@ Signed-off-by: Felix Fietkau NETIF_F_GSO_ENCAP_ALL | NETIF_F_HIGHDMA | NETIF_F_SCTP_CRC | NETIF_F_ALL_FCOE; -@@ -676,7 +676,7 @@ static netdev_features_t vlan_dev_fix_fe +@@ -653,7 +653,7 @@ static netdev_features_t vlan_dev_fix_fe if (lower_features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM)) lower_features |= NETIF_F_HW_CSUM; features = netdev_intersect_features(features, lower_features); diff --git a/target/linux/generic/pending-6.6/734-net-ethernet-mediatek-enlarge-DMA-reserve-buffer.patch b/target/linux/generic/pending-6.6/734-net-ethernet-mediatek-enlarge-DMA-reserve-buffer.patch index d786b462c2579d..f5e4edddde365a 100644 --- a/target/linux/generic/pending-6.6/734-net-ethernet-mediatek-enlarge-DMA-reserve-buffer.patch +++ b/target/linux/generic/pending-6.6/734-net-ethernet-mediatek-enlarge-DMA-reserve-buffer.patch @@ -34,7 +34,7 @@ Signed-off-by: Chad Monroe + val &= ~MTK_RESV_BUF_MASK; val |= MTK_MUTLI_CNT | MTK_RESV_BUF | MTK_WCOMP_EN | MTK_DMAD_WR_WDONE | - MTK_CHK_DDONE_EN | MTK_LEAKY_BUCKET_EN; + MTK_CHK_DDONE_EN; - else + } else { val |= MTK_RX_BT_32DWORDS; diff --git a/target/linux/generic/pending-6.6/739-05-net-pcs-add-driver-for-MediaTek-USXGMII-PCS.patch b/target/linux/generic/pending-6.6/739-05-net-pcs-add-driver-for-MediaTek-USXGMII-PCS.patch index c7fcac3abfd670..70bd736127b20d 100644 --- a/target/linux/generic/pending-6.6/739-05-net-pcs-add-driver-for-MediaTek-USXGMII-PCS.patch +++ b/target/linux/generic/pending-6.6/739-05-net-pcs-add-driver-for-MediaTek-USXGMII-PCS.patch @@ -19,7 +19,7 @@ Signed-off-by: Daniel Golle --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -13356,7 +13356,9 @@ M: Daniel Golle +@@ -13357,7 +13357,9 @@ M: Daniel Golle L: netdev@vger.kernel.org S: Maintained F: drivers/net/pcs/pcs-mtk-lynxi.c diff --git a/target/linux/ipq40xx/patches-6.6/700-net-ipqess-introduce-the-Qualcomm-IPQESS-driver.patch b/target/linux/ipq40xx/patches-6.6/700-net-ipqess-introduce-the-Qualcomm-IPQESS-driver.patch index d9ecf4b640077b..b8557bacc75865 100644 --- a/target/linux/ipq40xx/patches-6.6/700-net-ipqess-introduce-the-Qualcomm-IPQESS-driver.patch +++ b/target/linux/ipq40xx/patches-6.6/700-net-ipqess-introduce-the-Qualcomm-IPQESS-driver.patch @@ -32,7 +32,7 @@ Signed-off-by: Maxime Chevallier --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -17716,6 +17716,13 @@ L: netdev@vger.kernel.org +@@ -17717,6 +17717,13 @@ L: netdev@vger.kernel.org S: Maintained F: drivers/net/ethernet/qualcomm/emac/ diff --git a/target/linux/ipq40xx/patches-6.6/701-net-dsa-add-out-of-band-tagging-protocol.patch b/target/linux/ipq40xx/patches-6.6/701-net-dsa-add-out-of-band-tagging-protocol.patch index 9c4b520fcda0a1..469f669bd47915 100644 --- a/target/linux/ipq40xx/patches-6.6/701-net-dsa-add-out-of-band-tagging-protocol.patch +++ b/target/linux/ipq40xx/patches-6.6/701-net-dsa-add-out-of-band-tagging-protocol.patch @@ -64,7 +64,7 @@ Signed-off-by: Maxime Chevallier --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -17722,6 +17722,7 @@ L: netdev@vger.kernel.org +@@ -17723,6 +17723,7 @@ L: netdev@vger.kernel.org S: Maintained F: Documentation/devicetree/bindings/net/qcom,ipq4019-ess-edma.yaml F: drivers/net/ethernet/qualcomm/ipqess/ diff --git a/target/linux/lantiq/patches-6.6/0731-v6.11-dt-bindings-net-dsa-lantiq-gswip-convert-to-YAML-schema.patch b/target/linux/lantiq/patches-6.6/0731-v6.11-dt-bindings-net-dsa-lantiq-gswip-convert-to-YAML-schema.patch index 40e52f2812bb36..34a730c36fead3 100644 --- a/target/linux/lantiq/patches-6.6/0731-v6.11-dt-bindings-net-dsa-lantiq-gswip-convert-to-YAML-schema.patch +++ b/target/linux/lantiq/patches-6.6/0731-v6.11-dt-bindings-net-dsa-lantiq-gswip-convert-to-YAML-schema.patch @@ -382,7 +382,7 @@ Signed-off-by: Jakub Kicinski -}; --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -11863,6 +11863,7 @@ LANTIQ / INTEL Ethernet drivers +@@ -11864,6 +11864,7 @@ LANTIQ / INTEL Ethernet drivers M: Hauke Mehrtens L: netdev@vger.kernel.org S: Maintained diff --git a/target/linux/layerscape/patches-6.6/701-staging-add-fsl_ppfe-driver.patch b/target/linux/layerscape/patches-6.6/701-staging-add-fsl_ppfe-driver.patch index 764d29f10d9e17..59bbb964c5187f 100644 --- a/target/linux/layerscape/patches-6.6/701-staging-add-fsl_ppfe-driver.patch +++ b/target/linux/layerscape/patches-6.6/701-staging-add-fsl_ppfe-driver.patch @@ -891,7 +891,7 @@ Signed-off-by: Dong Aisheng +}; --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -8359,6 +8359,14 @@ F: drivers/ptp/ptp_qoriq.c +@@ -8360,6 +8360,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-6.6/806-v6.9-pwm-mediatek-add-support-for-MT7988.patch b/target/linux/mediatek/patches-6.6/806-v6.9-pwm-mediatek-add-support-for-MT7988.patch index 01768ff01fdb9a..946f3a525280ab 100644 --- a/target/linux/mediatek/patches-6.6/806-v6.9-pwm-mediatek-add-support-for-MT7988.patch +++ b/target/linux/mediatek/patches-6.6/806-v6.9-pwm-mediatek-add-support-for-MT7988.patch @@ -20,7 +20,7 @@ Signed-off-by: Uwe Kleine-König --- a/drivers/pwm/pwm-mediatek.c +++ b/drivers/pwm/pwm-mediatek.c -@@ -341,6 +341,13 @@ static const struct pwm_mediatek_of_data +@@ -345,6 +345,13 @@ static const struct pwm_mediatek_of_data .reg_offset = mtk_pwm_reg_offset_v1, }; @@ -34,7 +34,7 @@ Signed-off-by: Uwe Kleine-König static const struct pwm_mediatek_of_data mt8183_pwm_data = { .num_pwms = 4, .pwm45_fixup = false, -@@ -371,6 +378,7 @@ static const struct of_device_id pwm_med +@@ -375,6 +382,7 @@ static const struct of_device_id pwm_med { .compatible = "mediatek,mt7629-pwm", .data = &mt7629_pwm_data }, { .compatible = "mediatek,mt7981-pwm", .data = &mt7981_pwm_data }, { .compatible = "mediatek,mt7986-pwm", .data = &mt7986_pwm_data }, diff --git a/target/linux/mvebu/patches-6.6/907-MAINTAINERS-Add-an-entry-for-the-IEI-WT61P803-PUZZLE.patch b/target/linux/mvebu/patches-6.6/907-MAINTAINERS-Add-an-entry-for-the-IEI-WT61P803-PUZZLE.patch index dad8c16be1d340..d70bfe9a1af0ec 100644 --- a/target/linux/mvebu/patches-6.6/907-MAINTAINERS-Add-an-entry-for-the-IEI-WT61P803-PUZZLE.patch +++ b/target/linux/mvebu/patches-6.6/907-MAINTAINERS-Add-an-entry-for-the-IEI-WT61P803-PUZZLE.patch @@ -16,7 +16,7 @@ Cc: Robert Marko --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -10142,6 +10142,22 @@ IFCVF VIRTIO DATA PATH ACCELERATOR +@@ -10143,6 +10143,22 @@ IFCVF VIRTIO DATA PATH ACCELERATOR R: Zhu Lingshan F: drivers/vdpa/ifcvf/ diff --git a/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch b/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch index 916f08ac5d73c7..01ecb16aeb196a 100644 --- a/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch +++ b/target/linux/ramips/patches-6.6/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 -@@ -3287,6 +3287,18 @@ static const struct usb_device_id uvc_id +@@ -3296,6 +3296,18 @@ static const struct usb_device_id uvc_id .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) }, diff --git a/target/linux/realtek/patches-6.6/710-net-phy-sfp-re-probe-modules-on-DEV_UP-event.patch b/target/linux/realtek/patches-6.6/710-net-phy-sfp-re-probe-modules-on-DEV_UP-event.patch index 4e1a21aa715017..0ccd6aec6d8e6e 100644 --- a/target/linux/realtek/patches-6.6/710-net-phy-sfp-re-probe-modules-on-DEV_UP-event.patch +++ b/target/linux/realtek/patches-6.6/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 -@@ -2416,6 +2416,13 @@ static void sfp_sm_module(struct sfp *sf +@@ -2418,6 +2418,13 @@ static void sfp_sm_module(struct sfp *sf return; } diff --git a/target/linux/realtek/patches-6.6/714-net-phy-sfp-add-support-for-SMBus.patch b/target/linux/realtek/patches-6.6/714-net-phy-sfp-add-support-for-SMBus.patch index 76e2d765069b55..022a50272c588f 100644 --- a/target/linux/realtek/patches-6.6/714-net-phy-sfp-add-support-for-SMBus.patch +++ b/target/linux/realtek/patches-6.6/714-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 -@@ -663,10 +663,64 @@ static int sfp_i2c_write(struct sfp *sfp +@@ -665,10 +665,64 @@ static int sfp_i2c_write(struct sfp *sfp return ret == ARRAY_SIZE(msgs) ? len : 0; } @@ -77,7 +77,7 @@ Signed-off-by: Antoine Tenart sfp->i2c = i2c; sfp->read = sfp_i2c_read; -@@ -698,6 +752,29 @@ static int sfp_i2c_mdiobus_create(struct +@@ -700,6 +754,29 @@ static int sfp_i2c_mdiobus_create(struct return 0; } @@ -107,7 +107,7 @@ Signed-off-by: Antoine Tenart static void sfp_i2c_mdiobus_destroy(struct sfp *sfp) { mdiobus_unregister(sfp->i2c_mii); -@@ -1871,8 +1948,15 @@ static void sfp_sm_fault(struct sfp *sfp +@@ -1873,8 +1950,15 @@ static void sfp_sm_fault(struct sfp *sfp static int sfp_sm_add_mdio_bus(struct sfp *sfp) { diff --git a/target/linux/starfive/patches-6.6/0049-MAINTAINERS-Update-all-StarFive-entries.patch b/target/linux/starfive/patches-6.6/0049-MAINTAINERS-Update-all-StarFive-entries.patch index a7a832dce29ec6..57e8c08c81f023 100644 --- a/target/linux/starfive/patches-6.6/0049-MAINTAINERS-Update-all-StarFive-entries.patch +++ b/target/linux/starfive/patches-6.6/0049-MAINTAINERS-Update-all-StarFive-entries.patch @@ -12,7 +12,7 @@ Signed-off-by: Hal Feng --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -7053,6 +7053,14 @@ T: git git://anongit.freedesktop.org/drm +@@ -7054,6 +7054,14 @@ T: git git://anongit.freedesktop.org/drm F: Documentation/devicetree/bindings/display/rockchip/ F: drivers/gpu/drm/rockchip/ @@ -27,7 +27,7 @@ Signed-off-by: Hal Feng DRM DRIVERS FOR STI M: Alain Volmat L: dri-devel@lists.freedesktop.org -@@ -16016,6 +16024,13 @@ F: Documentation/i2c/busses/i2c-ocores.r +@@ -16017,6 +16025,13 @@ F: Documentation/i2c/busses/i2c-ocores.r F: drivers/i2c/busses/i2c-ocores.c F: include/linux/platform_data/i2c-ocores.h @@ -41,7 +41,7 @@ Signed-off-by: Hal Feng OPENRISC ARCHITECTURE M: Jonas Bonn M: Stefan Kristiansson -@@ -16427,6 +16442,14 @@ S: Maintained +@@ -16428,6 +16443,14 @@ S: Maintained F: Documentation/devicetree/bindings/pci/layerscape-pcie-gen4.txt F: drivers/pci/controller/mobiveil/pcie-layerscape-gen4.c @@ -56,7 +56,7 @@ Signed-off-by: Hal Feng PCI DRIVER FOR RENESAS R-CAR M: Marek Vasut M: Yoshihiro Shimoda -@@ -16658,7 +16681,7 @@ M: Daire McNamara PCIE DRIVER FOR QUALCOMM MSM M: Manivannan Sadhasivam -@@ -16682,6 +16705,13 @@ S: Maintained +@@ -16683,6 +16706,13 @@ S: Maintained F: Documentation/devicetree/bindings/pci/socionext,uniphier-pcie* F: drivers/pci/controller/dwc/pcie-uniphier* @@ -79,7 +79,7 @@ Signed-off-by: Hal Feng PCIE DRIVER FOR ST SPEAR13XX M: Pratyush Anand L: linux-pci@vger.kernel.org -@@ -18454,7 +18484,7 @@ F: drivers/char/hw_random/mpfs-rng.c +@@ -18455,7 +18485,7 @@ F: drivers/char/hw_random/mpfs-rng.c F: drivers/clk/microchip/clk-mpfs*.c F: drivers/i2c/busses/i2c-microchip-corei2c.c F: drivers/mailbox/mailbox-mpfs.c @@ -88,7 +88,7 @@ Signed-off-by: Hal Feng F: drivers/pwm/pwm-microchip-core.c F: drivers/reset/reset-mpfs.c F: drivers/rtc/rtc-mpfs.c -@@ -20435,6 +20465,15 @@ M: Ion Badulescu +@@ -20436,6 +20466,15 @@ M: Ion Badulescu S: Odd Fixes F: drivers/net/ethernet/adaptec/starfire* @@ -104,7 +104,7 @@ Signed-off-by: Hal Feng STARFIVE CRYPTO DRIVER M: Jia Jie Ho M: William Qiu -@@ -20473,6 +20512,13 @@ S: Supported +@@ -20474,6 +20513,13 @@ S: Supported F: Documentation/devicetree/bindings/clock/starfive,jh7110-pll.yaml F: drivers/clk/starfive/clk-starfive-jh7110-pll.c @@ -118,7 +118,7 @@ Signed-off-by: Hal Feng STARFIVE JH7110 SYSCON M: William Qiu M: Xingyu Wu -@@ -20520,9 +20566,10 @@ F: drivers/usb/cdns3/cdns3-starfive.c +@@ -20521,9 +20567,10 @@ F: drivers/usb/cdns3/cdns3-starfive.c STARFIVE JH71XX PMU CONTROLLER DRIVER M: Walker Chen @@ -130,7 +130,7 @@ Signed-off-by: Hal Feng F: include/dt-bindings/power/starfive,jh7110-pmu.h STARFIVE SOC DRIVERS -@@ -20530,7 +20577,13 @@ M: Conor Dooley +@@ -20531,7 +20578,13 @@ M: Conor Dooley S: Maintained T: git https://git.kernel.org/pub/scm/linux/kernel/git/conor/linux.git/ F: Documentation/devicetree/bindings/soc/starfive/ diff --git a/target/linux/starfive/patches-6.6/0052-ASoC-dwc-i2s-Fix-getting-platform-data-error-for-Sta.patch b/target/linux/starfive/patches-6.6/0052-ASoC-dwc-i2s-Fix-getting-platform-data-error-for-Sta.patch index e274e84a259ddf..65ca992201db45 100644 --- a/target/linux/starfive/patches-6.6/0052-ASoC-dwc-i2s-Fix-getting-platform-data-error-for-Sta.patch +++ b/target/linux/starfive/patches-6.6/0052-ASoC-dwc-i2s-Fix-getting-platform-data-error-for-Sta.patch @@ -16,7 +16,7 @@ Signed-off-by: Hal Feng --- a/sound/soc/dwc/dwc-i2s.c +++ b/sound/soc/dwc/dwc-i2s.c -@@ -917,7 +917,11 @@ static int jh7110_i2stx0_clk_cfg(struct +@@ -916,7 +916,11 @@ static int jh7110_i2stx0_clk_cfg(struct static int dw_i2s_probe(struct platform_device *pdev) { diff --git a/target/linux/starfive/patches-6.6/0053-ASoC-dwc-i2s-Add-RX-master-support-for-StarFive-JH71.patch b/target/linux/starfive/patches-6.6/0053-ASoC-dwc-i2s-Add-RX-master-support-for-StarFive-JH71.patch index 8203beca52ed91..48d47dce76000d 100644 --- a/target/linux/starfive/patches-6.6/0053-ASoC-dwc-i2s-Add-RX-master-support-for-StarFive-JH71.patch +++ b/target/linux/starfive/patches-6.6/0053-ASoC-dwc-i2s-Add-RX-master-support-for-StarFive-JH71.patch @@ -15,7 +15,7 @@ Signed-off-by: Hal Feng --- a/sound/soc/dwc/dwc-i2s.c +++ b/sound/soc/dwc/dwc-i2s.c -@@ -906,6 +906,27 @@ static int jh7110_i2srx_crg_init(struct +@@ -905,6 +905,27 @@ static int jh7110_i2srx_crg_init(struct return jh7110_i2s_crg_slave_init(dev); } @@ -43,7 +43,7 @@ Signed-off-by: Hal Feng static int jh7110_i2stx0_clk_cfg(struct i2s_clk_config_data *config) { struct dw_i2s_dev *dev = container_of(config, struct dw_i2s_dev, config); -@@ -1086,11 +1107,21 @@ static const struct i2s_platform_data jh +@@ -1085,11 +1106,21 @@ static const struct i2s_platform_data jh .i2s_pd_init = jh7110_i2srx_crg_init, }; diff --git a/target/linux/starfive/patches-6.6/1014-reset-starfive-Add-JH7100-audio-reset-driver.patch b/target/linux/starfive/patches-6.6/1014-reset-starfive-Add-JH7100-audio-reset-driver.patch index bc33188a44a7e3..79e7d4ddb48cbb 100644 --- a/target/linux/starfive/patches-6.6/1014-reset-starfive-Add-JH7100-audio-reset-driver.patch +++ b/target/linux/starfive/patches-6.6/1014-reset-starfive-Add-JH7100-audio-reset-driver.patch @@ -20,7 +20,7 @@ Signed-off-by: Emil Renner Berthing --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -20554,7 +20554,7 @@ STARFIVE JH71X0 RESET CONTROLLER DRIVERS +@@ -20555,7 +20555,7 @@ STARFIVE JH71X0 RESET CONTROLLER DRIVERS M: Emil Renner Berthing M: Hal Feng S: Maintained From e099424aaaee80e305722b09a79b1e3639858c68 Mon Sep 17 00:00:00 2001 From: John Audia Date: Fri, 2 May 2025 12:44:01 -0400 Subject: [PATCH 651/877] kernel: bump 6.6 to 6.6.89 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.89 All patches automatically rebased. Build system: x86/64 Build-tested: flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Run-tested: flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/18607 (cherry picked from commit fbcd547a444e76e904711cab58021dbe01620164) Link: https://github.com/openwrt/openwrt/pull/18730 Signed-off-by: Hauke Mehrtens --- include/kernel-6.6 | 4 +- ...12-net-dsa-mt7530-Add-EN7581-support.patch | 2 +- ...xx-Support-auto-downshift-to-100Mb-s.patch | 4 +- ...5-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch | 6 +-- ...arn-if-no-host-bridge-NUMA-node-info.patch | 2 +- ...iatek-split-tx-and-rx-fields-in-mtk_.patch | 26 +++++----- ...iatek-use-QDMA-instead-of-ADMAv2-on-.patch | 4 +- ..._wed-introduce-WED-support-for-MT798.patch | 2 +- ..._eth_soc-handle-dma-buffer-size-soc-.patch | 32 ++++++------ ..._eth_soc-ppe-add-support-for-multipl.patch | 24 ++++----- ..._eth_soc-implement-.-get-set-_pausep.patch | 4 +- ...tore-port-5-SGMII-capability-of-MT75.patch | 4 +- ...o-not-use-SW_PHY_RST-to-reset-MT7531.patch | 2 +- ...get-rid-of-priv-info-cpu_port_config.patch | 4 +- ...ort-link-settings-ops-and-force-link.patch | 2 +- ...dio-read-PHY-address-of-switch-from-.patch | 2 +- ...et-dsa-mt7530-refactor-MT7530_PMCR_P.patch | 4 +- ...ename-p5_intf_sel-and-use-only-for-M.patch | 2 +- ...efactor-MT7530_MFC-and-MT7531_CFC-ad.patch | 2 +- ...efactor-MT7530_HWTRAP-and-MT7530_MHW.patch | 2 +- ...eturn-mt7530_setup_mdio-mt7531_setup.patch | 6 +-- ...se-priv-ds-num_ports-instead-of-MT75.patch | 4 +- ...xplain-exposing-MDIO-bus-of-MT7531AE.patch | 2 +- ...et-dsa-mv88e6xxx-Support-LED-control.patch | 2 +- .../generic/hack-6.6/204-module_strip.patch | 2 +- .../780-usb-net-MeigLink_modem_support.patch | 4 +- ...net-mtk_eth_soc-enable-threaded-NAPI.patch | 2 +- ..._eth_soc-compile-out-netsys-v2-code-.patch | 4 +- ..._eth_soc-work-around-issue-with-send.patch | 2 +- ...-mediatek-enlarge-DMA-reserve-buffer.patch | 2 +- ..._eth_soc-add-paths-and-SerDes-modes-.patch | 50 +++++++++---------- ...th_soc-reduce-rx-ring-size-for-older.patch | 16 +++--- ..._eth_soc-do-not-enable-page-pool-sta.patch | 4 +- ...ove-performance-usb-using-lowmem-for.patch | 2 +- 34 files changed, 118 insertions(+), 118 deletions(-) diff --git a/include/kernel-6.6 b/include/kernel-6.6 index 07ba30cb3aaf51..f3ca0941dda83d 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .88 -LINUX_KERNEL_HASH-6.6.88 = 19df89b63ef7e950de7297dabfac0569183bf87636f4c300a25336c7da490650 +LINUX_VERSION-6.6 = .89 +LINUX_KERNEL_HASH-6.6.89 = c21af7d36068e4ac0704c242eac8459212e6bf4a5d09df941b9b4d17dc1eba00 diff --git a/target/linux/airoha/patches-6.6/029-v6.12-net-dsa-mt7530-Add-EN7581-support.patch b/target/linux/airoha/patches-6.6/029-v6.12-net-dsa-mt7530-Add-EN7581-support.patch index 2f37b86cca367f..d07163902d98ce 100644 --- a/target/linux/airoha/patches-6.6/029-v6.12-net-dsa-mt7530-Add-EN7581-support.patch +++ b/target/linux/airoha/patches-6.6/029-v6.12-net-dsa-mt7530-Add-EN7581-support.patch @@ -66,7 +66,7 @@ Signed-off-by: David S. Miller /* Disable forwarding by default on all ports */ mt7530_rmw(priv, MT7530_PCR_P(i), PCR_MATRIX_MASK, -@@ -2550,8 +2553,10 @@ mt7531_setup_common(struct dsa_switch *d +@@ -2553,8 +2556,10 @@ mt7531_setup_common(struct dsa_switch *d /* Clear link settings and enable force mode to force link down * on all ports until they're enabled later. */ diff --git a/target/linux/bcm27xx/patches-6.6/950-0131-net-lan78xx-Support-auto-downshift-to-100Mb-s.patch b/target/linux/bcm27xx/patches-6.6/950-0131-net-lan78xx-Support-auto-downshift-to-100Mb-s.patch index acc0d7f3e86f59..0c6145ae51c71b 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0131-net-lan78xx-Support-auto-downshift-to-100Mb-s.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0131-net-lan78xx-Support-auto-downshift-to-100Mb-s.patch @@ -31,7 +31,7 @@ Signed-off-by: Phil Elwell --- a/drivers/net/phy/microchip.c +++ b/drivers/net/phy/microchip.c -@@ -233,6 +233,7 @@ static int lan88xx_probe(struct phy_devi +@@ -192,6 +192,7 @@ static int lan88xx_probe(struct phy_devi struct device *dev = &phydev->mdio.dev; struct lan88xx_priv *priv; u32 led_modes[4]; @@ -39,7 +39,7 @@ Signed-off-by: Phil Elwell int len; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); -@@ -262,6 +263,32 @@ static int lan88xx_probe(struct phy_devi +@@ -221,6 +222,32 @@ static int lan88xx_probe(struct phy_devi return -EINVAL; } diff --git a/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch b/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch index a17245d94f3dea..5ab3a223969469 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch @@ -75,7 +75,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 -@@ -3715,6 +3715,48 @@ static int xhci_align_td(struct xhci_hcd +@@ -3718,6 +3718,48 @@ static int xhci_align_td(struct xhci_hcd return 1; } @@ -124,7 +124,7 @@ Signed-off-by: Jonathan Bell /* This is very similar to what ehci-q.c qtd_fill() does */ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, struct urb *urb, int slot_id, unsigned int ep_index) -@@ -3871,6 +3913,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3874,6 +3916,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd * } check_trb_math(urb, enqd_len); @@ -133,7 +133,7 @@ Signed-off-by: Jonathan Bell giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, start_cycle, start_trb); return 0; -@@ -4020,6 +4064,8 @@ int xhci_queue_ctrl_tx(struct xhci_hcd * +@@ -4023,6 +4067,8 @@ int xhci_queue_ctrl_tx(struct xhci_hcd * /* Event on completion */ field | TRB_IOC | TRB_TYPE(TRB_STATUS) | ep_ring->cycle_state); diff --git a/target/linux/bcm27xx/patches-6.6/950-1452-Revert-PCI-Warn-if-no-host-bridge-NUMA-node-info.patch b/target/linux/bcm27xx/patches-6.6/950-1452-Revert-PCI-Warn-if-no-host-bridge-NUMA-node-info.patch index 470a90cb97efde..e8b56706132fe2 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1452-Revert-PCI-Warn-if-no-host-bridge-NUMA-node-info.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1452-Revert-PCI-Warn-if-no-host-bridge-NUMA-node-info.patch @@ -17,7 +17,7 @@ Signed-off-by: Dom Cobley --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c -@@ -967,9 +967,6 @@ static int pci_register_host_bridge(stru +@@ -969,9 +969,6 @@ static int pci_register_host_bridge(stru else pr_info("PCI host bridge to bus %s\n", name); diff --git a/target/linux/generic/backport-6.6/751-01-v6.8-net-ethernet-mediatek-split-tx-and-rx-fields-in-mtk_.patch b/target/linux/generic/backport-6.6/751-01-v6.8-net-ethernet-mediatek-split-tx-and-rx-fields-in-mtk_.patch index 22aceecc534c59..8fb4b6fef53481 100644 --- a/target/linux/generic/backport-6.6/751-01-v6.8-net-ethernet-mediatek-split-tx-and-rx-fields-in-mtk_.patch +++ b/target/linux/generic/backport-6.6/751-01-v6.8-net-ethernet-mediatek-split-tx-and-rx-fields-in-mtk_.patch @@ -353,7 +353,7 @@ Signed-off-by: Jakub Kicinski mtk_w32(eth, 0x21021000, MTK_FE_INT_GRP); if (mtk_is_netsys_v3_or_greater(eth)) { -@@ -5037,11 +5037,15 @@ static const struct mtk_soc_data mt2701_ +@@ -5053,11 +5053,15 @@ static const struct mtk_soc_data mt2701_ .required_clks = MT7623_CLKS_BITMAP, .required_pctl = true, .version = 1, @@ -374,7 +374,7 @@ Signed-off-by: Jakub Kicinski .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5057,11 +5061,15 @@ static const struct mtk_soc_data mt7621_ +@@ -5073,11 +5077,15 @@ static const struct mtk_soc_data mt7621_ .offload_version = 1, .hash_offset = 2, .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, @@ -395,7 +395,7 @@ Signed-off-by: Jakub Kicinski .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5079,11 +5087,15 @@ static const struct mtk_soc_data mt7622_ +@@ -5095,11 +5103,15 @@ static const struct mtk_soc_data mt7622_ .hash_offset = 2, .has_accounting = true, .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, @@ -416,7 +416,7 @@ Signed-off-by: Jakub Kicinski .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5100,11 +5112,15 @@ static const struct mtk_soc_data mt7623_ +@@ -5116,11 +5128,15 @@ static const struct mtk_soc_data mt7623_ .hash_offset = 2, .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, .disable_pll_modes = true, @@ -437,7 +437,7 @@ Signed-off-by: Jakub Kicinski .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5119,11 +5135,15 @@ static const struct mtk_soc_data mt7629_ +@@ -5135,11 +5151,15 @@ static const struct mtk_soc_data mt7629_ .required_pctl = false, .has_accounting = true, .version = 1, @@ -458,7 +458,7 @@ Signed-off-by: Jakub Kicinski .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5141,11 +5161,15 @@ static const struct mtk_soc_data mt7981_ +@@ -5157,11 +5177,15 @@ static const struct mtk_soc_data mt7981_ .hash_offset = 4, .has_accounting = true, .foe_entry_size = MTK_FOE_ENTRY_V2_SIZE, @@ -479,7 +479,7 @@ Signed-off-by: Jakub Kicinski .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, .dma_len_offset = 8, }, -@@ -5163,11 +5187,15 @@ static const struct mtk_soc_data mt7986_ +@@ -5179,11 +5203,15 @@ static const struct mtk_soc_data mt7986_ .hash_offset = 4, .has_accounting = true, .foe_entry_size = MTK_FOE_ENTRY_V2_SIZE, @@ -500,7 +500,7 @@ Signed-off-by: Jakub Kicinski .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, .dma_len_offset = 8, }, -@@ -5185,11 +5213,15 @@ static const struct mtk_soc_data mt7988_ +@@ -5201,11 +5229,15 @@ static const struct mtk_soc_data mt7988_ .hash_offset = 4, .has_accounting = true, .foe_entry_size = MTK_FOE_ENTRY_V3_SIZE, @@ -521,7 +521,7 @@ Signed-off-by: Jakub Kicinski .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, .dma_len_offset = 8, }, -@@ -5202,11 +5234,15 @@ static const struct mtk_soc_data rt5350_ +@@ -5218,11 +5250,15 @@ static const struct mtk_soc_data rt5350_ .required_clks = MT7628_CLKS_BITMAP, .required_pctl = false, .version = 1, @@ -544,7 +544,7 @@ Signed-off-by: Jakub Kicinski }, --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h -@@ -327,8 +327,8 @@ +@@ -335,8 +335,8 @@ /* QDMA descriptor txd3 */ #define TX_DMA_OWNER_CPU BIT(31) #define TX_DMA_LS0 BIT(30) @@ -555,7 +555,7 @@ Signed-off-by: Jakub Kicinski #define TX_DMA_SWC BIT(14) #define TX_DMA_PQID GENMASK(3, 0) #define TX_DMA_ADDR64_MASK GENMASK(3, 0) -@@ -348,8 +348,8 @@ +@@ -356,8 +356,8 @@ /* QDMA descriptor rxd2 */ #define RX_DMA_DONE BIT(31) #define RX_DMA_LSO BIT(30) @@ -566,7 +566,7 @@ Signed-off-by: Jakub Kicinski #define RX_DMA_VTAG BIT(15) #define RX_DMA_ADDR64_MASK GENMASK(3, 0) #if IS_ENABLED(CONFIG_64BIT) -@@ -1153,10 +1153,9 @@ struct mtk_reg_map { +@@ -1161,10 +1161,9 @@ struct mtk_reg_map { * @foe_entry_size Foe table entry size. * @has_accounting Bool indicating support for accounting of * offloaded flows. @@ -580,7 +580,7 @@ Signed-off-by: Jakub Kicinski * @dma_max_len Max DMA tx/rx buffer length. * @dma_len_offset Tx/Rx DMA length field offset. */ -@@ -1174,13 +1173,17 @@ struct mtk_soc_data { +@@ -1182,13 +1181,17 @@ struct mtk_soc_data { bool has_accounting; bool disable_pll_modes; struct { diff --git a/target/linux/generic/backport-6.6/751-02-v6.8-net-ethernet-mediatek-use-QDMA-instead-of-ADMAv2-on-.patch b/target/linux/generic/backport-6.6/751-02-v6.8-net-ethernet-mediatek-use-QDMA-instead-of-ADMAv2-on-.patch index e71ff0923c8329..2499f48bc60284 100644 --- a/target/linux/generic/backport-6.6/751-02-v6.8-net-ethernet-mediatek-use-QDMA-instead-of-ADMAv2-on-.patch +++ b/target/linux/generic/backport-6.6/751-02-v6.8-net-ethernet-mediatek-use-QDMA-instead-of-ADMAv2-on-.patch @@ -94,7 +94,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); -@@ -5167,11 +5167,11 @@ static const struct mtk_soc_data mt7981_ +@@ -5183,11 +5183,11 @@ static const struct mtk_soc_data mt7981_ .dma_len_offset = 8, }, .rx = { @@ -110,7 +110,7 @@ Signed-off-by: Jakub Kicinski }, }; -@@ -5193,11 +5193,11 @@ static const struct mtk_soc_data mt7986_ +@@ -5209,11 +5209,11 @@ static const struct mtk_soc_data mt7986_ .dma_len_offset = 8, }, .rx = { diff --git a/target/linux/generic/backport-6.6/752-14-v6.7-net-ethernet-mtk_wed-introduce-WED-support-for-MT798.patch b/target/linux/generic/backport-6.6/752-14-v6.7-net-ethernet-mtk_wed-introduce-WED-support-for-MT798.patch index f565b7631f1e37..eda2fb462d67ad 100644 --- a/target/linux/generic/backport-6.6/752-14-v6.7-net-ethernet-mtk_wed-introduce-WED-support-for-MT798.patch +++ b/target/linux/generic/backport-6.6/752-14-v6.7-net-ethernet-mtk_wed-introduce-WED-support-for-MT798.patch @@ -23,7 +23,7 @@ Signed-off-by: Paolo Abeni .pse_oq_sta = 0x01a0, --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h -@@ -1132,7 +1132,7 @@ struct mtk_reg_map { +@@ -1140,7 +1140,7 @@ struct mtk_reg_map { u32 gdm1_cnt; u32 gdma_to_ppe; u32 ppe_base; diff --git a/target/linux/generic/backport-6.6/752-25-v6.10-net-ethernet-mtk_eth_soc-handle-dma-buffer-size-soc-.patch b/target/linux/generic/backport-6.6/752-25-v6.10-net-ethernet-mtk_eth_soc-handle-dma-buffer-size-soc-.patch index 3d72a5f1dacfa8..ddb810718644ca 100644 --- a/target/linux/generic/backport-6.6/752-25-v6.10-net-ethernet-mtk_eth_soc-handle-dma-buffer-size-soc-.patch +++ b/target/linux/generic/backport-6.6/752-25-v6.10-net-ethernet-mtk_eth_soc-handle-dma-buffer-size-soc-.patch @@ -181,7 +181,7 @@ Signed-off-by: David S. Miller } static bool mtk_hw_reset_check(struct mtk_eth *eth) -@@ -5045,11 +5055,14 @@ static const struct mtk_soc_data mt2701_ +@@ -5061,11 +5071,14 @@ static const struct mtk_soc_data mt2701_ .desc_size = sizeof(struct mtk_tx_dma), .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, @@ -196,7 +196,7 @@ Signed-off-by: David S. Miller .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5069,11 +5082,14 @@ static const struct mtk_soc_data mt7621_ +@@ -5085,11 +5098,14 @@ static const struct mtk_soc_data mt7621_ .desc_size = sizeof(struct mtk_tx_dma), .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, @@ -211,7 +211,7 @@ Signed-off-by: David S. Miller .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5095,11 +5111,14 @@ static const struct mtk_soc_data mt7622_ +@@ -5111,11 +5127,14 @@ static const struct mtk_soc_data mt7622_ .desc_size = sizeof(struct mtk_tx_dma), .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, @@ -226,7 +226,7 @@ Signed-off-by: David S. Miller .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5120,11 +5139,14 @@ static const struct mtk_soc_data mt7623_ +@@ -5136,11 +5155,14 @@ static const struct mtk_soc_data mt7623_ .desc_size = sizeof(struct mtk_tx_dma), .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, @@ -241,7 +241,7 @@ Signed-off-by: David S. Miller .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5143,11 +5165,14 @@ static const struct mtk_soc_data mt7629_ +@@ -5159,11 +5181,14 @@ static const struct mtk_soc_data mt7629_ .desc_size = sizeof(struct mtk_tx_dma), .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, @@ -256,7 +256,7 @@ Signed-off-by: David S. Miller .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5169,6 +5194,8 @@ static const struct mtk_soc_data mt7981_ +@@ -5185,6 +5210,8 @@ static const struct mtk_soc_data mt7981_ .desc_size = sizeof(struct mtk_tx_dma_v2), .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, .dma_len_offset = 8, @@ -265,7 +265,7 @@ Signed-off-by: David S. Miller }, .rx = { .desc_size = sizeof(struct mtk_rx_dma), -@@ -5176,6 +5203,7 @@ static const struct mtk_soc_data mt7981_ +@@ -5192,6 +5219,7 @@ static const struct mtk_soc_data mt7981_ .dma_l4_valid = RX_DMA_L4_VALID_V2, .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, @@ -273,7 +273,7 @@ Signed-off-by: David S. Miller }, }; -@@ -5195,6 +5223,8 @@ static const struct mtk_soc_data mt7986_ +@@ -5211,6 +5239,8 @@ static const struct mtk_soc_data mt7986_ .desc_size = sizeof(struct mtk_tx_dma_v2), .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, .dma_len_offset = 8, @@ -282,7 +282,7 @@ Signed-off-by: David S. Miller }, .rx = { .desc_size = sizeof(struct mtk_rx_dma), -@@ -5202,6 +5232,7 @@ static const struct mtk_soc_data mt7986_ +@@ -5218,6 +5248,7 @@ static const struct mtk_soc_data mt7986_ .dma_l4_valid = RX_DMA_L4_VALID_V2, .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, @@ -290,7 +290,7 @@ Signed-off-by: David S. Miller }, }; -@@ -5221,6 +5252,8 @@ static const struct mtk_soc_data mt7988_ +@@ -5237,6 +5268,8 @@ static const struct mtk_soc_data mt7988_ .desc_size = sizeof(struct mtk_tx_dma_v2), .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, .dma_len_offset = 8, @@ -299,7 +299,7 @@ Signed-off-by: David S. Miller }, .rx = { .desc_size = sizeof(struct mtk_rx_dma_v2), -@@ -5228,6 +5261,7 @@ static const struct mtk_soc_data mt7988_ +@@ -5244,6 +5277,7 @@ static const struct mtk_soc_data mt7988_ .dma_l4_valid = RX_DMA_L4_VALID_V2, .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, .dma_len_offset = 8, @@ -307,7 +307,7 @@ Signed-off-by: David S. Miller }, }; -@@ -5242,6 +5276,7 @@ static const struct mtk_soc_data rt5350_ +@@ -5258,6 +5292,7 @@ static const struct mtk_soc_data rt5350_ .desc_size = sizeof(struct mtk_tx_dma), .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, @@ -315,7 +315,7 @@ Signed-off-by: David S. Miller }, .rx = { .desc_size = sizeof(struct mtk_rx_dma), -@@ -5249,6 +5284,7 @@ static const struct mtk_soc_data rt5350_ +@@ -5265,6 +5300,7 @@ static const struct mtk_soc_data rt5350_ .dma_l4_valid = RX_DMA_L4_VALID_PDMA, .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, @@ -336,7 +336,7 @@ Signed-off-by: David S. Miller #define MTK_RX_ETH_HLEN (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 -@@ -1176,6 +1178,8 @@ struct mtk_soc_data { +@@ -1184,6 +1186,8 @@ struct mtk_soc_data { u32 desc_size; u32 dma_max_len; u32 dma_len_offset; @@ -345,7 +345,7 @@ Signed-off-by: David S. Miller } tx; struct { u32 desc_size; -@@ -1183,6 +1187,7 @@ struct mtk_soc_data { +@@ -1191,6 +1195,7 @@ struct mtk_soc_data { u32 dma_l4_valid; u32 dma_max_len; u32 dma_len_offset; @@ -353,7 +353,7 @@ Signed-off-by: David S. Miller } rx; }; -@@ -1264,7 +1269,7 @@ struct mtk_eth { +@@ -1272,7 +1277,7 @@ struct mtk_eth { struct napi_struct rx_napi; void *scratch_ring; dma_addr_t phy_scratch_ring; diff --git a/target/linux/generic/backport-6.6/752-26-v6.10-net-ethernet-mtk_eth_soc-ppe-add-support-for-multipl.patch b/target/linux/generic/backport-6.6/752-26-v6.10-net-ethernet-mtk_eth_soc-ppe-add-support-for-multipl.patch index 07e7e863406fea..ae75eb5c3e89f0 100644 --- a/target/linux/generic/backport-6.6/752-26-v6.10-net-ethernet-mtk_eth_soc-ppe-add-support-for-multipl.patch +++ b/target/linux/generic/backport-6.6/752-26-v6.10-net-ethernet-mtk_eth_soc-ppe-add-support-for-multipl.patch @@ -200,7 +200,7 @@ Signed-off-by: Jakub Kicinski mtk_tx_irq_disable(eth, MTK_TX_DONE_INT); mtk_rx_irq_disable(eth, eth->soc->rx.irq_done_mask); -@@ -4957,23 +4982,24 @@ static int mtk_probe(struct platform_dev +@@ -4973,23 +4998,24 @@ static int mtk_probe(struct platform_dev } if (eth->soc->offload_version) { @@ -233,7 +233,7 @@ Signed-off-by: Jakub Kicinski } for (i = 0; i < MTK_MAX_DEVS; i++) { -@@ -5076,6 +5102,7 @@ static const struct mtk_soc_data mt7621_ +@@ -5092,6 +5118,7 @@ static const struct mtk_soc_data mt7621_ .required_pctl = false, .version = 1, .offload_version = 1, @@ -241,7 +241,7 @@ Signed-off-by: Jakub Kicinski .hash_offset = 2, .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, .tx = { -@@ -5104,6 +5131,7 @@ static const struct mtk_soc_data mt7622_ +@@ -5120,6 +5147,7 @@ static const struct mtk_soc_data mt7622_ .required_pctl = false, .version = 1, .offload_version = 2, @@ -249,7 +249,7 @@ Signed-off-by: Jakub Kicinski .hash_offset = 2, .has_accounting = true, .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, -@@ -5132,6 +5160,7 @@ static const struct mtk_soc_data mt7623_ +@@ -5148,6 +5176,7 @@ static const struct mtk_soc_data mt7623_ .required_pctl = true, .version = 1, .offload_version = 1, @@ -257,7 +257,7 @@ Signed-off-by: Jakub Kicinski .hash_offset = 2, .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, .disable_pll_modes = true, -@@ -5187,6 +5216,7 @@ static const struct mtk_soc_data mt7981_ +@@ -5203,6 +5232,7 @@ static const struct mtk_soc_data mt7981_ .required_pctl = false, .version = 2, .offload_version = 2, @@ -265,7 +265,7 @@ Signed-off-by: Jakub Kicinski .hash_offset = 4, .has_accounting = true, .foe_entry_size = MTK_FOE_ENTRY_V2_SIZE, -@@ -5216,6 +5246,7 @@ static const struct mtk_soc_data mt7986_ +@@ -5232,6 +5262,7 @@ static const struct mtk_soc_data mt7986_ .required_pctl = false, .version = 2, .offload_version = 2, @@ -273,7 +273,7 @@ Signed-off-by: Jakub Kicinski .hash_offset = 4, .has_accounting = true, .foe_entry_size = MTK_FOE_ENTRY_V2_SIZE, -@@ -5245,6 +5276,7 @@ static const struct mtk_soc_data mt7988_ +@@ -5261,6 +5292,7 @@ static const struct mtk_soc_data mt7988_ .required_pctl = false, .version = 3, .offload_version = 2, @@ -283,7 +283,7 @@ Signed-off-by: Jakub Kicinski .foe_entry_size = MTK_FOE_ENTRY_V3_SIZE, --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h -@@ -1132,7 +1132,7 @@ struct mtk_reg_map { +@@ -1140,7 +1140,7 @@ struct mtk_reg_map { u32 tx_sch_rate; /* tx scheduler rate control registers */ } qdma; u32 gdm1_cnt; @@ -292,7 +292,7 @@ Signed-off-by: Jakub Kicinski u32 ppe_base; u32 wdma_base[3]; u32 pse_iq_sta; -@@ -1170,6 +1170,7 @@ struct mtk_soc_data { +@@ -1178,6 +1178,7 @@ struct mtk_soc_data { u8 offload_version; u8 hash_offset; u8 version; @@ -300,7 +300,7 @@ Signed-off-by: Jakub Kicinski u16 foe_entry_size; netdev_features_t hw_features; bool has_accounting; -@@ -1294,7 +1295,7 @@ struct mtk_eth { +@@ -1302,7 +1303,7 @@ struct mtk_eth { struct metadata_dst *dsa_meta[MTK_MAX_DSA_PORTS]; @@ -309,7 +309,7 @@ Signed-off-by: Jakub Kicinski struct rhashtable flow_table; struct bpf_prog __rcu *prog; -@@ -1319,6 +1320,7 @@ struct mtk_eth { +@@ -1327,6 +1328,7 @@ struct mtk_eth { struct mtk_mac { int id; phy_interface_t interface; @@ -317,7 +317,7 @@ Signed-off-by: Jakub Kicinski int speed; struct device_node *of_node; struct phylink *phylink; -@@ -1440,7 +1442,7 @@ int mtk_gmac_sgmii_path_setup(struct mtk +@@ -1448,7 +1450,7 @@ int mtk_gmac_sgmii_path_setup(struct mtk 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); diff --git a/target/linux/generic/backport-6.6/752-30-v6.10-net-ethernet-mtk_eth_soc-implement-.-get-set-_pausep.patch b/target/linux/generic/backport-6.6/752-30-v6.10-net-ethernet-mtk_eth_soc-implement-.-get-set-_pausep.patch index 09d7054965b224..970812c6b201ea 100644 --- a/target/linux/generic/backport-6.6/752-30-v6.10-net-ethernet-mtk_eth_soc-implement-.-get-set-_pausep.patch +++ b/target/linux/generic/backport-6.6/752-30-v6.10-net-ethernet-mtk_eth_soc-implement-.-get-set-_pausep.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 -@@ -4462,6 +4462,20 @@ static int mtk_set_rxnfc(struct net_devi +@@ -4478,6 +4478,20 @@ static int mtk_set_rxnfc(struct net_devi return ret; } @@ -41,7 +41,7 @@ Signed-off-by: Jakub Kicinski static u16 mtk_select_queue(struct net_device *dev, struct sk_buff *skb, struct net_device *sb_dev) { -@@ -4490,8 +4504,10 @@ static const struct ethtool_ops mtk_etht +@@ -4506,8 +4520,10 @@ static const struct ethtool_ops mtk_etht .get_strings = mtk_get_strings, .get_sset_count = mtk_get_sset_count, .get_ethtool_stats = mtk_get_ethtool_stats, diff --git a/target/linux/generic/backport-6.6/790-07-v6.9-net-dsa-mt7530-store-port-5-SGMII-capability-of-MT75.patch b/target/linux/generic/backport-6.6/790-07-v6.9-net-dsa-mt7530-store-port-5-SGMII-capability-of-MT75.patch index 5e6dfe6c6dc76c..43730f8aaa78eb 100644 --- a/target/linux/generic/backport-6.6/790-07-v6.9-net-dsa-mt7530-store-port-5-SGMII-capability-of-MT75.patch +++ b/target/linux/generic/backport-6.6/790-07-v6.9-net-dsa-mt7530-store-port-5-SGMII-capability-of-MT75.patch @@ -100,7 +100,7 @@ Signed-off-by: Jakub Kicinski default: return "unknown"; } -@@ -2695,6 +2681,12 @@ mt7531_setup(struct dsa_switch *ds) +@@ -2698,6 +2684,12 @@ mt7531_setup(struct dsa_switch *ds) return -ENODEV; } @@ -113,7 +113,7 @@ Signed-off-by: Jakub Kicinski /* all MACs must be forced link-down before sw reset */ for (i = 0; i < MT7530_NUM_PORTS; i++) mt7530_write(priv, MT7530_PMCR_P(i), MT7531_FORCE_LNK); -@@ -2704,21 +2696,18 @@ mt7531_setup(struct dsa_switch *ds) +@@ -2707,21 +2699,18 @@ mt7531_setup(struct dsa_switch *ds) SYS_CTRL_PHY_RST | SYS_CTRL_SW_RST | SYS_CTRL_REG_RST); diff --git a/target/linux/generic/backport-6.6/790-21-v6.9-net-dsa-mt7530-do-not-use-SW_PHY_RST-to-reset-MT7531.patch b/target/linux/generic/backport-6.6/790-21-v6.9-net-dsa-mt7530-do-not-use-SW_PHY_RST-to-reset-MT7531.patch index 0ed8cbededf2a2..95bf3caaa8c757 100644 --- a/target/linux/generic/backport-6.6/790-21-v6.9-net-dsa-mt7530-do-not-use-SW_PHY_RST-to-reset-MT7531.patch +++ b/target/linux/generic/backport-6.6/790-21-v6.9-net-dsa-mt7530-do-not-use-SW_PHY_RST-to-reset-MT7531.patch @@ -22,7 +22,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2658,14 +2658,12 @@ mt7531_setup(struct dsa_switch *ds) +@@ -2661,14 +2661,12 @@ mt7531_setup(struct dsa_switch *ds) val = mt7530_read(priv, MT7531_TOP_SIG_SR); priv->p5_sgmii = !!(val & PAD_DUAL_SGMII_EN); diff --git a/target/linux/generic/backport-6.6/790-23-v6.9-net-dsa-mt7530-get-rid-of-priv-info-cpu_port_config.patch b/target/linux/generic/backport-6.6/790-23-v6.9-net-dsa-mt7530-get-rid-of-priv-info-cpu_port_config.patch index d85b40f91a7d83..eef308d787ec4f 100644 --- a/target/linux/generic/backport-6.6/790-23-v6.9-net-dsa-mt7530-get-rid-of-priv-info-cpu_port_config.patch +++ b/target/linux/generic/backport-6.6/790-23-v6.9-net-dsa-mt7530-get-rid-of-priv-info-cpu_port_config.patch @@ -106,7 +106,7 @@ Signed-off-by: Paolo Abeni } else { mt7530_port_disable(ds, i); -@@ -2586,9 +2572,7 @@ mt7531_setup_common(struct dsa_switch *d +@@ -2589,9 +2575,7 @@ mt7531_setup_common(struct dsa_switch *d mt7530_set(priv, MT7531_DBG_CNT(i), MT7531_DIS_CLR); if (dsa_is_cpu_port(ds, i)) { @@ -117,7 +117,7 @@ Signed-off-by: Paolo Abeni } else { mt7530_port_disable(ds, i); -@@ -2681,10 +2665,6 @@ mt7531_setup(struct dsa_switch *ds) +@@ -2684,10 +2668,6 @@ mt7531_setup(struct dsa_switch *ds) mt7530_rmw(priv, MT7531_GPIO_MODE0, MT7531_GPIO0_MASK, MT7531_GPIO0_INTERRUPT); diff --git a/target/linux/generic/backport-6.6/790-26-v6.9-net-dsa-mt7530-sort-link-settings-ops-and-force-link.patch b/target/linux/generic/backport-6.6/790-26-v6.9-net-dsa-mt7530-sort-link-settings-ops-and-force-link.patch index 348c35e1ac9901..7632a5a9f0ea52 100644 --- a/target/linux/generic/backport-6.6/790-26-v6.9-net-dsa-mt7530-sort-link-settings-ops-and-force-link.patch +++ b/target/linux/generic/backport-6.6/790-26-v6.9-net-dsa-mt7530-sort-link-settings-ops-and-force-link.patch @@ -53,7 +53,7 @@ Signed-off-by: Paolo Abeni /* Disable forwarding by default on all ports */ mt7530_rmw(priv, MT7530_PCR_P(i), PCR_MATRIX_MASK, PCR_MATRIX_CLR); -@@ -2562,6 +2566,12 @@ mt7531_setup_common(struct dsa_switch *d +@@ -2565,6 +2569,12 @@ mt7531_setup_common(struct dsa_switch *d UNU_FFP_MASK); for (i = 0; i < MT7530_NUM_PORTS; i++) { diff --git a/target/linux/generic/backport-6.6/790-36-v6.10-net-dsa-mt7530-mdio-read-PHY-address-of-switch-from-.patch b/target/linux/generic/backport-6.6/790-36-v6.10-net-dsa-mt7530-mdio-read-PHY-address-of-switch-from-.patch index 6a93090c44b3ce..896bc9914b2680 100644 --- a/target/linux/generic/backport-6.6/790-36-v6.10-net-dsa-mt7530-mdio-read-PHY-address-of-switch-from-.patch +++ b/target/linux/generic/backport-6.6/790-36-v6.10-net-dsa-mt7530-mdio-read-PHY-address-of-switch-from-.patch @@ -184,7 +184,7 @@ Signed-off-by: Paolo Abeni err: if (ret < 0) dev_err(&bus->dev, -@@ -2680,16 +2688,19 @@ mt7531_setup(struct dsa_switch *ds) +@@ -2683,16 +2691,19 @@ mt7531_setup(struct dsa_switch *ds) * phy_[read,write]_mmd_indirect is called, we provide our own * mt7531_ind_mmd_phy_[read,write] to complete this function. */ diff --git a/target/linux/generic/backport-6.6/790-39-v6.10-net-dsa-mt7530-refactor-MT7530_PMCR_P.patch b/target/linux/generic/backport-6.6/790-39-v6.10-net-dsa-mt7530-refactor-MT7530_PMCR_P.patch index 1d42750aff00ea..33f9fc182f696c 100644 --- a/target/linux/generic/backport-6.6/790-39-v6.10-net-dsa-mt7530-refactor-MT7530_PMCR_P.patch +++ b/target/linux/generic/backport-6.6/790-39-v6.10-net-dsa-mt7530-refactor-MT7530_PMCR_P.patch @@ -53,7 +53,7 @@ Signed-off-by: Arınç ÜNAL /* Disable forwarding by default on all ports */ mt7530_rmw(priv, MT7530_PCR_P(i), PCR_MATRIX_MASK, -@@ -2555,8 +2555,8 @@ mt7531_setup_common(struct dsa_switch *d +@@ -2558,8 +2558,8 @@ mt7531_setup_common(struct dsa_switch *d /* Clear link settings and enable force mode to force link down * on all ports until they're enabled later. */ @@ -64,7 +64,7 @@ Signed-off-by: Arınç ÜNAL /* Disable forwarding by default on all ports */ mt7530_rmw(priv, MT7530_PCR_P(i), PCR_MATRIX_MASK, -@@ -2640,7 +2640,7 @@ mt7531_setup(struct dsa_switch *ds) +@@ -2643,7 +2643,7 @@ mt7531_setup(struct dsa_switch *ds) /* Force link down on all ports before internal reset */ for (i = 0; i < MT7530_NUM_PORTS; i++) diff --git a/target/linux/generic/backport-6.6/790-40-v6.10-net-dsa-mt7530-rename-p5_intf_sel-and-use-only-for-M.patch b/target/linux/generic/backport-6.6/790-40-v6.10-net-dsa-mt7530-rename-p5_intf_sel-and-use-only-for-M.patch index 3bcdc1a27c4dda..a2c191c56e7ed9 100644 --- a/target/linux/generic/backport-6.6/790-40-v6.10-net-dsa-mt7530-rename-p5_intf_sel-and-use-only-for-M.patch +++ b/target/linux/generic/backport-6.6/790-40-v6.10-net-dsa-mt7530-rename-p5_intf_sel-and-use-only-for-M.patch @@ -135,7 +135,7 @@ Signed-off-by: Arınç ÜNAL mt7530_setup_port5(ds, interface); } -@@ -2655,9 +2648,6 @@ mt7531_setup(struct dsa_switch *ds) +@@ -2658,9 +2651,6 @@ mt7531_setup(struct dsa_switch *ds) MT7531_EXT_P_MDIO_12); } diff --git a/target/linux/generic/backport-6.6/790-42-v6.10-net-dsa-mt7530-refactor-MT7530_MFC-and-MT7531_CFC-ad.patch b/target/linux/generic/backport-6.6/790-42-v6.10-net-dsa-mt7530-refactor-MT7530_MFC-and-MT7531_CFC-ad.patch index e72424c5f1f14e..542c8c84ce00e0 100644 --- a/target/linux/generic/backport-6.6/790-42-v6.10-net-dsa-mt7530-refactor-MT7530_MFC-and-MT7531_CFC-ad.patch +++ b/target/linux/generic/backport-6.6/790-42-v6.10-net-dsa-mt7530-refactor-MT7530_MFC-and-MT7531_CFC-ad.patch @@ -92,7 +92,7 @@ Signed-off-by: Arınç ÜNAL mt7530_write(priv, MT753X_MIRROR_REG(priv->id), val); val = mt7530_read(priv, MT7530_PCR_P(port)); -@@ -2533,7 +2519,7 @@ mt7531_setup_common(struct dsa_switch *d +@@ -2536,7 +2522,7 @@ mt7531_setup_common(struct dsa_switch *d mt7530_mib_reset(ds); /* Disable flooding on all ports */ diff --git a/target/linux/generic/backport-6.6/790-43-v6.10-net-dsa-mt7530-refactor-MT7530_HWTRAP-and-MT7530_MHW.patch b/target/linux/generic/backport-6.6/790-43-v6.10-net-dsa-mt7530-refactor-MT7530_HWTRAP-and-MT7530_MHW.patch index 1e907c51a0ad6f..4b1e18bccd5227 100644 --- a/target/linux/generic/backport-6.6/790-43-v6.10-net-dsa-mt7530-refactor-MT7530_HWTRAP-and-MT7530_MHW.patch +++ b/target/linux/generic/backport-6.6/790-43-v6.10-net-dsa-mt7530-refactor-MT7530_HWTRAP-and-MT7530_MHW.patch @@ -189,7 +189,7 @@ Signed-off-by: Arınç ÜNAL mt7530_pll_setup(priv); mt753x_trap_frames(priv); -@@ -2587,7 +2588,7 @@ mt7531_setup(struct dsa_switch *ds) +@@ -2590,7 +2591,7 @@ mt7531_setup(struct dsa_switch *ds) } /* Waiting for MT7530 got to stable */ diff --git a/target/linux/generic/backport-6.6/790-45-v6.10-net-dsa-mt7530-return-mt7530_setup_mdio-mt7531_setup.patch b/target/linux/generic/backport-6.6/790-45-v6.10-net-dsa-mt7530-return-mt7530_setup_mdio-mt7531_setup.patch index 5b1ff14de6c039..1e2b965c1c8f89 100644 --- a/target/linux/generic/backport-6.6/790-45-v6.10-net-dsa-mt7530-return-mt7530_setup_mdio-mt7531_setup.patch +++ b/target/linux/generic/backport-6.6/790-45-v6.10-net-dsa-mt7530-return-mt7530_setup_mdio-mt7531_setup.patch @@ -17,7 +17,7 @@ Signed-off-by: Arınç ÜNAL --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2668,7 +2668,9 @@ mt7531_setup(struct dsa_switch *ds) +@@ -2671,7 +2671,9 @@ mt7531_setup(struct dsa_switch *ds) 0); } @@ -26,8 +26,8 @@ Signed-off-by: Arınç ÜNAL + if (ret) + return ret; - ds->assisted_learning_on_cpu_port = true; - ds->mtu_enforcement_ingress = true; + return 0; + } @@ -3016,6 +3018,8 @@ mt753x_setup(struct dsa_switch *ds) ret = mt7530_setup_mdio(priv); if (ret && priv->irq) diff --git a/target/linux/generic/backport-6.6/790-50-v6.10-net-dsa-mt7530-use-priv-ds-num_ports-instead-of-MT75.patch b/target/linux/generic/backport-6.6/790-50-v6.10-net-dsa-mt7530-use-priv-ds-num_ports-instead-of-MT75.patch index 12749812ba878c..4173bee9a0e853 100644 --- a/target/linux/generic/backport-6.6/790-50-v6.10-net-dsa-mt7530-use-priv-ds-num_ports-instead-of-MT75.patch +++ b/target/linux/generic/backport-6.6/790-50-v6.10-net-dsa-mt7530-use-priv-ds-num_ports-instead-of-MT75.patch @@ -37,7 +37,7 @@ Signed-off-by: Arınç ÜNAL /* Clear link settings and enable force mode to force link down * on all ports until they're enabled later. */ -@@ -2539,7 +2539,7 @@ mt7531_setup_common(struct dsa_switch *d +@@ -2542,7 +2542,7 @@ mt7531_setup_common(struct dsa_switch *d mt7530_clear(priv, MT753X_MFC, BC_FFP_MASK | UNM_FFP_MASK | UNU_FFP_MASK); @@ -46,7 +46,7 @@ Signed-off-by: Arınç ÜNAL /* Clear link settings and enable force mode to force link down * on all ports until they're enabled later. */ -@@ -2627,7 +2627,7 @@ mt7531_setup(struct dsa_switch *ds) +@@ -2630,7 +2630,7 @@ mt7531_setup(struct dsa_switch *ds) priv->p5_sgmii = !!(val & PAD_DUAL_SGMII_EN); /* Force link down on all ports before internal reset */ diff --git a/target/linux/generic/backport-6.6/790-52-v6.10-net-dsa-mt7530-explain-exposing-MDIO-bus-of-MT7531AE.patch b/target/linux/generic/backport-6.6/790-52-v6.10-net-dsa-mt7530-explain-exposing-MDIO-bus-of-MT7531AE.patch index 8a0a0685085dd3..c6bc25837ffa40 100644 --- a/target/linux/generic/backport-6.6/790-52-v6.10-net-dsa-mt7530-explain-exposing-MDIO-bus-of-MT7531AE.patch +++ b/target/linux/generic/backport-6.6/790-52-v6.10-net-dsa-mt7530-explain-exposing-MDIO-bus-of-MT7531AE.patch @@ -19,7 +19,7 @@ Signed-off-by: Arınç ÜNAL --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2636,7 +2636,10 @@ mt7531_setup(struct dsa_switch *ds) +@@ -2639,7 +2639,10 @@ mt7531_setup(struct dsa_switch *ds) if (!priv->p5_sgmii) { mt7531_pll_setup(priv); } else { diff --git a/target/linux/generic/backport-6.6/901-v6.13-net-dsa-mv88e6xxx-Support-LED-control.patch b/target/linux/generic/backport-6.6/901-v6.13-net-dsa-mv88e6xxx-Support-LED-control.patch index 838cce8f4a03ff..4bb219ecfcf27b 100644 --- a/target/linux/generic/backport-6.6/901-v6.13-net-dsa-mv88e6xxx-Support-LED-control.patch +++ b/target/linux/generic/backport-6.6/901-v6.13-net-dsa-mv88e6xxx-Support-LED-control.patch @@ -197,7 +197,7 @@ Signed-off-by: Linus Walleij .port_setup_message_port = mv88e6xxx_setup_message_port, .stats_snapshot = mv88e6320_g1_stats_snapshot, .stats_set_histogram = mv88e6095_g1_stats_set_histogram, -@@ -5318,6 +5351,7 @@ static const struct mv88e6xxx_ops mv88e6 +@@ -5324,6 +5357,7 @@ static const struct mv88e6xxx_ops mv88e6 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, .port_get_cmode = mv88e6352_port_get_cmode, diff --git a/target/linux/generic/hack-6.6/204-module_strip.patch b/target/linux/generic/hack-6.6/204-module_strip.patch index 9eadd2ce16bb58..24ec94f5156460 100644 --- a/target/linux/generic/hack-6.6/204-module_strip.patch +++ b/target/linux/generic/hack-6.6/204-module_strip.patch @@ -88,7 +88,7 @@ Signed-off-by: Felix Fietkau --- a/kernel/module/Kconfig +++ b/kernel/module/Kconfig -@@ -389,4 +389,11 @@ config MODULES_TREE_LOOKUP +@@ -390,4 +390,11 @@ config MODULES_TREE_LOOKUP def_bool y depends on PERF_EVENTS || TRACING || CFI_CLANG diff --git a/target/linux/generic/hack-6.6/780-usb-net-MeigLink_modem_support.patch b/target/linux/generic/hack-6.6/780-usb-net-MeigLink_modem_support.patch index bbd73b1e601d0f..e0d578994716cd 100644 --- a/target/linux/generic/hack-6.6/780-usb-net-MeigLink_modem_support.patch +++ b/target/linux/generic/hack-6.6/780-usb-net-MeigLink_modem_support.patch @@ -44,7 +44,7 @@ Subject: [PATCH] net/usb/qmi_wwan: add MeigLink modem support #define QUECTEL_VENDOR_ID 0x2c7c /* These Quectel products use Quectel's vendor ID */ -@@ -1153,6 +1158,11 @@ static const struct usb_device_id option +@@ -1154,6 +1159,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) }, @@ -56,7 +56,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), -@@ -1194,6 +1204,11 @@ static const struct usb_device_id option +@@ -1195,6 +1205,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-6.6/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch b/target/linux/generic/pending-6.6/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch index 5563bf1f93c329..3136238801c0e0 100644 --- a/target/linux/generic/pending-6.6/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch +++ b/target/linux/generic/pending-6.6/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 -@@ -5036,6 +5036,8 @@ static int mtk_probe(struct platform_dev +@@ -5052,6 +5052,8 @@ static int mtk_probe(struct platform_dev * for NAPI to work */ init_dummy_netdev(ð->dummy_dev); diff --git a/target/linux/generic/pending-6.6/732-00-net-ethernet-mtk_eth_soc-compile-out-netsys-v2-code-.patch b/target/linux/generic/pending-6.6/732-00-net-ethernet-mtk_eth_soc-compile-out-netsys-v2-code-.patch index c3297a1087d003..ec6ed6e035d0ed 100644 --- a/target/linux/generic/pending-6.6/732-00-net-ethernet-mtk_eth_soc-compile-out-netsys-v2-code-.patch +++ b/target/linux/generic/pending-6.6/732-00-net-ethernet-mtk_eth_soc-compile-out-netsys-v2-code-.patch @@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h -@@ -1336,6 +1336,22 @@ struct mtk_mac { +@@ -1344,6 +1344,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[]; @@ -34,7 +34,7 @@ Signed-off-by: Felix Fietkau static inline bool mtk_is_netsys_v1(struct mtk_eth *eth) { return eth->soc->version == 1; -@@ -1350,6 +1366,7 @@ static inline bool mtk_is_netsys_v3_or_g +@@ -1358,6 +1374,7 @@ static inline bool mtk_is_netsys_v3_or_g { return eth->soc->version > 2; } diff --git a/target/linux/generic/pending-6.6/732-01-net-ethernet-mtk_eth_soc-work-around-issue-with-send.patch b/target/linux/generic/pending-6.6/732-01-net-ethernet-mtk_eth_soc-work-around-issue-with-send.patch index 53187934d02a33..6e3e4092900bcf 100644 --- a/target/linux/generic/pending-6.6/732-01-net-ethernet-mtk_eth_soc-work-around-issue-with-send.patch +++ b/target/linux/generic/pending-6.6/732-01-net-ethernet-mtk_eth_soc-work-around-issue-with-send.patch @@ -91,7 +91,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 -@@ -270,7 +270,7 @@ +@@ -278,7 +278,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-6.6/734-net-ethernet-mediatek-enlarge-DMA-reserve-buffer.patch b/target/linux/generic/pending-6.6/734-net-ethernet-mediatek-enlarge-DMA-reserve-buffer.patch index f5e4edddde365a..dd9783bfcb93a5 100644 --- a/target/linux/generic/pending-6.6/734-net-ethernet-mediatek-enlarge-DMA-reserve-buffer.patch +++ b/target/linux/generic/pending-6.6/734-net-ethernet-mediatek-enlarge-DMA-reserve-buffer.patch @@ -15,7 +15,7 @@ Signed-off-by: Chad Monroe --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h -@@ -271,6 +271,7 @@ +@@ -279,6 +279,7 @@ #define MTK_WCOMP_EN BIT(24) #define MTK_RESV_BUF (0x80 << 16) #define MTK_MUTLI_CNT (0x4 << 12) diff --git a/target/linux/generic/pending-6.6/737-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch b/target/linux/generic/pending-6.6/737-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch index f4e12ca63a9986..cdfb1b82704ab8 100644 --- a/target/linux/generic/pending-6.6/737-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch +++ b/target/linux/generic/pending-6.6/737-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch @@ -510,7 +510,7 @@ Signed-off-by: Daniel Golle return 0; } -@@ -4580,6 +4727,7 @@ static const struct net_device_ops mtk_n +@@ -4596,6 +4743,7 @@ static const struct net_device_ops mtk_n static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) { const __be32 *_id = of_get_property(np, "reg", NULL); @@ -518,7 +518,7 @@ Signed-off-by: Daniel Golle phy_interface_t phy_mode; struct phylink *phylink; struct mtk_mac *mac; -@@ -4616,16 +4764,41 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4632,16 +4780,41 @@ static int mtk_add_mac(struct mtk_eth *e mac->id = id; mac->hw = eth; mac->of_node = np; @@ -568,7 +568,7 @@ Signed-off-by: Daniel Golle } memset(mac->hwlro_ip, 0, sizeof(mac->hwlro_ip)); -@@ -4708,8 +4881,21 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4724,8 +4897,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); @@ -590,7 +590,7 @@ Signed-off-by: Daniel Golle phylink = phylink_create(&mac->phylink_config, of_fwnode_handle(mac->of_node), phy_mode, &mtk_phylink_ops); -@@ -4760,6 +4946,26 @@ free_netdev: +@@ -4776,6 +4962,26 @@ free_netdev: return err; } @@ -617,7 +617,7 @@ Signed-off-by: Daniel Golle void mtk_eth_set_dma_device(struct mtk_eth *eth, struct device *dma_dev) { struct net_device *dev, *tmp; -@@ -4906,7 +5112,8 @@ static int mtk_probe(struct platform_dev +@@ -4922,7 +5128,8 @@ static int mtk_probe(struct platform_dev regmap_write(cci, 0, 3); } @@ -627,7 +627,7 @@ Signed-off-by: Daniel Golle err = mtk_sgmii_init(eth); if (err) -@@ -5017,6 +5224,24 @@ static int mtk_probe(struct platform_dev +@@ -5033,6 +5240,24 @@ static int mtk_probe(struct platform_dev } } @@ -652,7 +652,7 @@ Signed-off-by: Daniel Golle if (MTK_HAS_CAPS(eth->soc->caps, MTK_SHARED_INT)) { err = devm_request_irq(eth->dev, eth->irq[0], mtk_handle_irq, 0, -@@ -5120,6 +5345,11 @@ static int mtk_remove(struct platform_de +@@ -5136,6 +5361,11 @@ static int mtk_remove(struct platform_de mtk_stop(eth->netdev[i]); mac = netdev_priv(eth->netdev[i]); phylink_disconnect_phy(mac->phylink); @@ -674,7 +674,7 @@ Signed-off-by: Daniel Golle #include #include #include -@@ -505,6 +506,21 @@ +@@ -513,6 +514,21 @@ #define INTF_MODE_RGMII_1000 (TRGMII_MODE | TRGMII_CENTRAL_ALIGNED) #define INTF_MODE_RGMII_10_100 0 @@ -696,7 +696,7 @@ Signed-off-by: Daniel Golle /* GPIO port control registers for GMAC 2*/ #define GPIO_OD33_CTRL8 0x4c0 #define GPIO_BIAS_CTRL 0xed0 -@@ -530,6 +546,7 @@ +@@ -538,6 +554,7 @@ #define SYSCFG0_SGMII_GMAC2 ((3 << 8) & SYSCFG0_SGMII_MASK) #define SYSCFG0_SGMII_GMAC1_V2 BIT(9) #define SYSCFG0_SGMII_GMAC2_V2 BIT(8) @@ -704,7 +704,7 @@ Signed-off-by: Daniel Golle /* ethernet subsystem clock register */ -@@ -568,6 +585,11 @@ +@@ -576,6 +593,11 @@ #define GEPHY_MAC_SEL BIT(1) /* Top misc registers */ @@ -716,7 +716,7 @@ Signed-off-by: Daniel Golle #define USB_PHY_SWITCH_REG 0x218 #define QPHY_SEL_MASK GENMASK(1, 0) #define SGMII_QPHY_SEL 0x2 -@@ -592,6 +614,8 @@ +@@ -600,6 +622,8 @@ #define MT7628_SDM_RBCNT (MT7628_SDM_OFFSET + 0x10c) #define MT7628_SDM_CS_ERR (MT7628_SDM_OFFSET + 0x110) @@ -725,7 +725,7 @@ Signed-off-by: Daniel Golle #define MTK_FE_CDM1_FSM 0x220 #define MTK_FE_CDM2_FSM 0x224 #define MTK_FE_CDM3_FSM 0x238 -@@ -600,6 +624,11 @@ +@@ -608,6 +632,11 @@ #define MTK_FE_CDM6_FSM 0x328 #define MTK_FE_GDM1_FSM 0x228 #define MTK_FE_GDM2_FSM 0x22C @@ -737,7 +737,7 @@ Signed-off-by: Daniel Golle #define MTK_MAC_FSM(x) (0x1010C + ((x) * 0x100)) -@@ -724,12 +753,8 @@ enum mtk_clks_map { +@@ -732,12 +761,8 @@ enum mtk_clks_map { MTK_CLK_ETHWARP_WOCPU2, MTK_CLK_ETHWARP_WOCPU1, MTK_CLK_ETHWARP_WOCPU0, @@ -750,7 +750,7 @@ Signed-off-by: Daniel Golle MTK_CLK_TOP_ETH_GMII_SEL, MTK_CLK_TOP_ETH_REFCK_50M_SEL, MTK_CLK_TOP_ETH_SYS_200M_SEL, -@@ -800,19 +825,9 @@ enum mtk_clks_map { +@@ -808,19 +833,9 @@ enum mtk_clks_map { 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) | \ @@ -770,7 +770,7 @@ Signed-off-by: Daniel Golle 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) | \ -@@ -946,6 +961,8 @@ enum mkt_eth_capabilities { +@@ -954,6 +969,8 @@ enum mkt_eth_capabilities { MTK_RGMII_BIT = 0, MTK_TRGMII_BIT, MTK_SGMII_BIT, @@ -779,7 +779,7 @@ Signed-off-by: Daniel Golle MTK_ESW_BIT, MTK_GEPHY_BIT, MTK_MUX_BIT, -@@ -966,8 +983,11 @@ enum mkt_eth_capabilities { +@@ -974,8 +991,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, @@ -791,7 +791,7 @@ Signed-off-by: Daniel Golle /* PATH BITS */ MTK_ETH_PATH_GMAC1_RGMII_BIT, -@@ -975,14 +995,21 @@ enum mkt_eth_capabilities { +@@ -983,14 +1003,21 @@ enum mkt_eth_capabilities { MTK_ETH_PATH_GMAC1_SGMII_BIT, MTK_ETH_PATH_GMAC2_RGMII_BIT, MTK_ETH_PATH_GMAC2_SGMII_BIT, @@ -813,7 +813,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) -@@ -1005,10 +1032,16 @@ enum mkt_eth_capabilities { +@@ -1013,10 +1040,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) @@ -830,7 +830,7 @@ Signed-off-by: Daniel Golle /* Supported path present on SoCs */ #define MTK_ETH_PATH_GMAC1_RGMII BIT_ULL(MTK_ETH_PATH_GMAC1_RGMII_BIT) -@@ -1016,8 +1049,13 @@ enum mkt_eth_capabilities { +@@ -1024,8 +1057,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) @@ -844,7 +844,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) -@@ -1025,7 +1063,12 @@ enum mkt_eth_capabilities { +@@ -1033,7 +1071,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) @@ -857,7 +857,7 @@ Signed-off-by: Daniel Golle /* MUXes present on SoCs */ /* 0: GDM1 -> GMAC1, 1: GDM1 -> ESW */ -@@ -1044,10 +1087,20 @@ enum mkt_eth_capabilities { +@@ -1052,10 +1095,20 @@ enum mkt_eth_capabilities { (MTK_ETH_MUX_GMAC1_GMAC2_TO_SGMII_RGMII | MTK_MUX | \ MTK_SHARED_SGMII) @@ -878,7 +878,7 @@ Signed-off-by: Daniel Golle #define MTK_HAS_CAPS(caps, _x) (((caps) & (_x)) == (_x)) #define MT7621_CAPS (MTK_GMAC1_RGMII | MTK_GMAC1_TRGMII | \ -@@ -1079,8 +1132,12 @@ enum mkt_eth_capabilities { +@@ -1087,8 +1140,12 @@ enum mkt_eth_capabilities { MTK_MUX_GMAC12_TO_GEPHY_SGMII | MTK_QDMA | \ MTK_RSTCTRL_PPE1 | MTK_SRAM) @@ -893,7 +893,7 @@ Signed-off-by: Daniel Golle struct mtk_tx_dma_desc_info { dma_addr_t addr; -@@ -1325,6 +1382,9 @@ struct mtk_mac { +@@ -1333,6 +1390,9 @@ struct mtk_mac { struct device_node *of_node; struct phylink *phylink; struct phylink_config phylink_config; @@ -903,7 +903,7 @@ Signed-off-by: Daniel Golle struct mtk_eth *hw; struct mtk_hw_stats *hw_stats; __be32 hwlro_ip[MTK_MAX_LRO_IP_CNT]; -@@ -1448,6 +1508,19 @@ static inline u32 mtk_get_ib2_multicast_ +@@ -1456,6 +1516,19 @@ static inline u32 mtk_get_ib2_multicast_ return MTK_FOE_IB2_MULTICAST; } @@ -923,7 +923,7 @@ Signed-off-by: Daniel Golle /* read the hardware status register */ void mtk_stats_update_mac(struct mtk_mac *mac); -@@ -1456,8 +1529,10 @@ u32 mtk_r32(struct mtk_eth *eth, unsigne +@@ -1464,8 +1537,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); diff --git a/target/linux/generic/pending-6.6/738-01-net-ethernet-mtk_eth_soc-reduce-rx-ring-size-for-older.patch b/target/linux/generic/pending-6.6/738-01-net-ethernet-mtk_eth_soc-reduce-rx-ring-size-for-older.patch index b492f4d0c089b0..7cfd323854ecba 100644 --- a/target/linux/generic/pending-6.6/738-01-net-ethernet-mtk_eth_soc-reduce-rx-ring-size-for-older.patch +++ b/target/linux/generic/pending-6.6/738-01-net-ethernet-mtk_eth_soc-reduce-rx-ring-size-for-older.patch @@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -5381,7 +5381,7 @@ static const struct mtk_soc_data mt2701_ +@@ -5397,7 +5397,7 @@ static const struct mtk_soc_data mt2701_ .desc_size = sizeof(struct mtk_rx_dma), .irq_done_mask = MTK_RX_DONE_INT, .dma_l4_valid = RX_DMA_L4_VALID, @@ -39,7 +39,7 @@ Signed-off-by: Felix Fietkau .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5409,7 +5409,7 @@ static const struct mtk_soc_data mt7621_ +@@ -5425,7 +5425,7 @@ static const struct mtk_soc_data mt7621_ .desc_size = sizeof(struct mtk_rx_dma), .irq_done_mask = MTK_RX_DONE_INT, .dma_l4_valid = RX_DMA_L4_VALID, @@ -48,7 +48,7 @@ Signed-off-by: Felix Fietkau .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5439,7 +5439,7 @@ static const struct mtk_soc_data mt7622_ +@@ -5455,7 +5455,7 @@ static const struct mtk_soc_data mt7622_ .desc_size = sizeof(struct mtk_rx_dma), .irq_done_mask = MTK_RX_DONE_INT, .dma_l4_valid = RX_DMA_L4_VALID, @@ -57,7 +57,7 @@ Signed-off-by: Felix Fietkau .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5468,7 +5468,7 @@ static const struct mtk_soc_data mt7623_ +@@ -5484,7 +5484,7 @@ static const struct mtk_soc_data mt7623_ .desc_size = sizeof(struct mtk_rx_dma), .irq_done_mask = MTK_RX_DONE_INT, .dma_l4_valid = RX_DMA_L4_VALID, @@ -66,7 +66,7 @@ Signed-off-by: Felix Fietkau .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5494,7 +5494,7 @@ static const struct mtk_soc_data mt7629_ +@@ -5510,7 +5510,7 @@ static const struct mtk_soc_data mt7629_ .desc_size = sizeof(struct mtk_rx_dma), .irq_done_mask = MTK_RX_DONE_INT, .dma_l4_valid = RX_DMA_L4_VALID, @@ -75,7 +75,7 @@ Signed-off-by: Felix Fietkau .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5526,7 +5526,7 @@ static const struct mtk_soc_data mt7981_ +@@ -5542,7 +5542,7 @@ static const struct mtk_soc_data mt7981_ .dma_l4_valid = RX_DMA_L4_VALID_V2, .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, @@ -84,7 +84,7 @@ Signed-off-by: Felix Fietkau }, }; -@@ -5556,7 +5556,7 @@ static const struct mtk_soc_data mt7986_ +@@ -5572,7 +5572,7 @@ static const struct mtk_soc_data mt7986_ .dma_l4_valid = RX_DMA_L4_VALID_V2, .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, @@ -93,7 +93,7 @@ Signed-off-by: Felix Fietkau }, }; -@@ -5609,7 +5609,7 @@ static const struct mtk_soc_data rt5350_ +@@ -5625,7 +5625,7 @@ static const struct mtk_soc_data rt5350_ .dma_l4_valid = RX_DMA_L4_VALID_PDMA, .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, diff --git a/target/linux/generic/pending-6.6/738-02-net-ethernet-mtk_eth_soc-do-not-enable-page-pool-sta.patch b/target/linux/generic/pending-6.6/738-02-net-ethernet-mtk_eth_soc-do-not-enable-page-pool-sta.patch index ab374d93e480c7..bd141d103237c0 100644 --- a/target/linux/generic/pending-6.6/738-02-net-ethernet-mtk_eth_soc-do-not-enable-page-pool-sta.patch +++ b/target/linux/generic/pending-6.6/738-02-net-ethernet-mtk_eth_soc-do-not-enable-page-pool-sta.patch @@ -25,7 +25,7 @@ Signed-off-by: Felix Fietkau help --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4552,6 +4552,7 @@ static int mtk_get_sset_count(struct net +@@ -4568,6 +4568,7 @@ static int mtk_get_sset_count(struct net static void mtk_ethtool_pp_stats(struct mtk_eth *eth, u64 *data) { @@ -33,7 +33,7 @@ Signed-off-by: Felix Fietkau struct page_pool_stats stats = {}; int i; -@@ -4564,6 +4565,7 @@ static void mtk_ethtool_pp_stats(struct +@@ -4580,6 +4581,7 @@ static void mtk_ethtool_pp_stats(struct page_pool_get_stats(ring->page_pool, &stats); } page_pool_ethtool_stats_get(data, &stats); diff --git a/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch b/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch index b5d9802d90df95..2da2b322b0090d 100644 --- a/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch +++ b/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch @@ -160,7 +160,7 @@ Signed-off-by: minda.chen } --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c -@@ -3708,7 +3708,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3711,7 +3711,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd * full_len = urb->transfer_buffer_length; /* If we have scatter/gather list, we use it. */ From 0ecf136f4d3126d92edc13087ce03db83b7e8223 Mon Sep 17 00:00:00 2001 From: Schneider Azima Date: Sun, 9 Mar 2025 18:42:51 -0700 Subject: [PATCH 652/877] mediatek: add support for Mercusys MR80X v3 This commit adds support for Mercusys MR80X(EU) v3 router. Device specification: - SoC: Mediatek MT7981b, Cortex-A53, 64-bit - RAM: 512MB - Flash: SPI NAND GigaDevice GD5F1GQ5UEYIGY (128 MB) - Ethernet: 4x 100/1000 Mbps LAN1,LAN2,LAN3 & WAN - Wireless: 2.4GHz (802.11 b/g/n/ax) - Wireless: 5GHz (802.11 a/n/ac/ax) - LEDs: 1 orange and 1 green status LEDs, 4 green gpio-controlled LEDs on ethernet ports - Buttons: 1 (Reset) - Bootloader: Main U-Boot - U-Boot 2022.01-rc4. Additionally, both UBI slots contain "seconduboot" (also U-Boot 2022.01-rc4) Installation (UART): - Place OpenWrt initramfs-kernel image on tftp server with IP 192.168.1.2 - Attach UART, switch on the router and interrupt the boot process by pressing 'Ctrl-C'. - Set the uboot environment for startup. setenv tp_boot_idx 0; setenv bootcmd bootm 0x46000000; saveenv If the bootarg is set to boot from ubi1, also change it to ubi0. - Load and run OpenWrt initramfs image. setenv serverip 192.168.1.2; setenv ipaddr 192.168.1.1; tftpboot initramfs-kernel.bin; bootm - Login as root via SSH (IP 192.168.1.1, port 22) - Upload OpenWrt sysupgrade.bin image to the /tmp dir of the router - Run sysupgrade: sysupgrade -n /tmp/sysupgrade.bin Recovery: - Press Reset button and power on the router. - Navigate to U-Boot recovery web server (http://192.168.1.1/) and upload the OEM firmware. 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 | 94:0C:xx:xx:xx:12 | label | | WAN | 94:0C:xx:xx:xx:13 | label+1 | | LAN | 94:0C:xx:xx:xx:12 | label | | WLAN 2g | 94:0C:xx:xx:xx:11 | label-1 | | WLAN 5g | 94:0C:xx:xx:xx:10 | label-2 | +---------+-------------------+-----------+ label MAC address was found in UBI partition "tp_data", file "default-mac". Signed-off-by: Schneider Azima Link: https://github.com/openwrt/openwrt/pull/18181 (cherry picked from commit 7921e48d43571861f15aa56717798709ff7507b6) Signed-off-by: Schneider Azima Link: https://github.com/openwrt/openwrt/pull/18522 Signed-off-by: Hauke Mehrtens --- .../uboot-envtools/files/mediatek_filogic | 1 + .../dts/mt7981b-mercusys-mr80x-v3.dts | 237 ++++++++++++++++++ .../filogic/base-files/etc/board.d/01_leds | 6 + .../filogic/base-files/etc/board.d/02_network | 7 + .../etc/hotplug.d/firmware/11-mt76-caldata | 4 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 6 + .../base-files/lib/preinit/09_mount_cfg_part | 1 + .../base-files/lib/upgrade/platform.sh | 1 + target/linux/mediatek/image/filogic.mk | 14 ++ 9 files changed, 277 insertions(+) create mode 100755 target/linux/mediatek/dts/mt7981b-mercusys-mr80x-v3.dts diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index add5dbb3d30ac8..5f586047f5789b 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -108,6 +108,7 @@ gatonetworks,gdsp) glinet,gl-mt3000) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000" ;; +mercusys,mr80x-v3|\ mercusys,mr90x-v1|\ routerich,ax3000|\ tplink,re6000xd) diff --git a/target/linux/mediatek/dts/mt7981b-mercusys-mr80x-v3.dts b/target/linux/mediatek/dts/mt7981b-mercusys-mr80x-v3.dts new file mode 100755 index 00000000000000..3bd59f75a62250 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-mercusys-mr80x-v3.dts @@ -0,0 +1,237 @@ +// SPDX-License-Identifier: GPL-2.0 + +/dts-v1/; +#include +#include + +#include "mt7981.dtsi" +/ { + model = "MERCUSYS MR80X v3"; + compatible = "mercusys,mr80x-v3", "mediatek,mt7981"; + + aliases { + led-boot = &led_status_green; + led-failsafe = &led_status_amber; + led-running = &led_status_green; + led-upgrade = &led_status_green; + + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory { + reg = <0 0x40000000 0 0x20000000>; + }; + + keys { + compatible = "gpio-keys"; + + button-reset { + label = "reset"; + linux,code = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status_amber: led-0 { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&pio 4 GPIO_ACTIVE_LOW>; + }; + + led_status_green: led-1 { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&pio 5 GPIO_ACTIVE_LOW>; + }; + + led-2 { + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <1>; + gpios = <&pio 6 GPIO_ACTIVE_LOW>; + }; + + led-3 { + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <2>; + gpios = <&pio 7 GPIO_ACTIVE_LOW>; + }; + + led-4 { + color = ; + function = LED_FUNCTION_WAN; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + }; + + led-5 { + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <3>; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + 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 = "gmii"; + phy-handle = <&int_gbe_phy>; + }; + + mdio: mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + + switch@1f { + compatible = "mediatek,mt7531"; + reg = <31>; + reset-gpios = <&pio 39 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@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: spi_nand@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spi-nand"; + 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 = "boot"; + reg = <0x00000 0x0200000>; + read-only; + }; + + partition@200000 { + label = "u-boot-env"; + reg = <0x0200000 0x0100000>; + }; + + 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 0x800000>; + 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"; +}; 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 326f09341d7797..c7455b78fcc677 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 @@ -55,6 +55,12 @@ glinet,gl-xe3000) huasifei,wh3000) ucidef_set_led_netdev "wan" "WAN" "red:wan" "eth1" "link tx rx" ;; +mercusys,mr80x-v3) + ucidef_set_led_netdev "lan1" "lan-1" "green:lan-1" "lan1" "link tx rx" + ucidef_set_led_netdev "lan2" "lan-2" "green:lan-2" "lan2" "link tx rx" + ucidef_set_led_netdev "lan3" "lan-3" "green:lan-3" "lan3" "link tx rx" + ucidef_set_led_netdev "wan" "wan" "green:wan" "wan" "link tx rx" + ;; mercusys,mr90x-v1|\ mercusys,mr90x-v1-ubi) ucidef_set_led_netdev "lan-0" "lan-0" "green:lan-0" "lan0" "link tx rx" 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 d970b2385864de..cc01a3d2b42959 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 @@ -13,6 +13,7 @@ mediatek_setup_interfaces() h3c,magic-nx30-pro|\ netis,nx31|\ nokia,ea0326gmp|\ + mercusys,mr80x-v3|\ zbtlink,zbt-z8103ax) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" eth1 ;; @@ -163,6 +164,12 @@ mediatek_setup_macs() lan_mac=$(macaddr_add "$wan_mac" 1) label_mac=$wan_mac ;; + mercusys,mr80x-v3) + mac_dirty=$(cat "/tmp/tp_data/default-mac" | sed -n 's/^'"MAC"'://p') + label_mac=$(macaddr_canonicalize "$mac_dirty") + lan_mac=$label_mac + wan_mac=$(macaddr_add "$lan_mac" 1) + ;; mercusys,mr90x-v1|\ tplink,re6000xd) label_mac=$(get_mac_binary "/tmp/tp_data/default-mac" 0) 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 8456c462b6339b..34aacb931275b2 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 @@ -9,6 +9,10 @@ board=$(board_name) case "$FIRMWARE" in "mediatek/mt7981_eeprom_mt7976_dbdc.bin") case "$board" in + mercusys,mr80x-v3) + ln -sf /tmp/tp_data/MT7981_EEPROM.bin \ + /lib/firmware/$FIRMWARE + ;; ubnt,unifi-6-plus) caldata_extract_mmc "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 194154c0432d4c..7251e05d63a6e0 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 @@ -118,6 +118,12 @@ case "$board" in [ "$PHYNBR" = "1" ] && \ macaddr_setbit_la "$(mtd_get_mac_binary rf-eeprom 0x4)" > /sys${DEVPATH}/macaddress ;; + mercusys,mr80x-v3) + mac_dirty=$(cat "/tmp/tp_data/default-mac" | sed -n 's/^'"MAC"'://p') + label_mac=$(macaddr_canonicalize "$mac_dirty") + [ "$PHYNBR" = "0" ] && macaddr_add $label_mac -1 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $label_mac -2 > /sys${DEVPATH}/macaddress + ;; mercusys,mr90x-v1|\ tplink,re6000xd) addr=$(get_mac_binary "/tmp/tp_data/default-mac" 0) 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 index 11e3b598af8eae..1474fad831c5b5 100644 --- 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 @@ -12,6 +12,7 @@ mount_ubi_part() { preinit_mount_cfg_part() { case $(board_name) in + mercusys,mr80x-v3|\ mercusys,mr90x-v1|\ tplink,re6000xd) mount_ubi_part "tp_data" 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 f5e8ba962d73c6..2c6a0372f444dc 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -134,6 +134,7 @@ platform_do_upgrade() { fw_setenv sw_tryactive 0 nand_do_upgrade "$1" ;; + mercusys,mr80x-v3|\ mercusys,mr90x-v1|\ tplink,re6000xd) CI_UBIPART="ubi0" diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 8f4090a74fb606..b4449a37fe555d 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -1203,6 +1203,20 @@ define Device/mediatek_mt7988a-rfb endef TARGET_DEVICES += mediatek_mt7988a-rfb +define Device/mercusys_mr80x-v3 + DEVICE_VENDOR := MERCUSYS + DEVICE_MODEL := MR80X + DEVICE_VARIANT := v3 + DEVICE_DTS := mt7981b-mercusys-mr80x-v3 + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += mercusys_mr80x-v3 + define Device/mercusys_mr90x-v1 DEVICE_VENDOR := MERCUSYS DEVICE_MODEL := MR90X v1 From cf9b806182ea6b17a3d68ee87149f9860e36cb85 Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Sun, 13 Apr 2025 17:39:34 +0000 Subject: [PATCH 653/877] mediatek: filogic: fix mistaken executable bit on dts file This commit fixes mistaken executable bit on mt7981b-mercusys-mr80x-v3.dts file. Fixes: 7921e48d4357 ("mediatek: add support for Mercusys MR80X v3") Signed-off-by: Mikhail Zhilkin (cherry picked from commit f733442c028ffdd1747e4ac670cc76954c278a1c) Link: https://github.com/openwrt/openwrt/pull/18522 Signed-off-by: Hauke Mehrtens --- target/linux/mediatek/dts/mt7981b-mercusys-mr80x-v3.dts | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 target/linux/mediatek/dts/mt7981b-mercusys-mr80x-v3.dts diff --git a/target/linux/mediatek/dts/mt7981b-mercusys-mr80x-v3.dts b/target/linux/mediatek/dts/mt7981b-mercusys-mr80x-v3.dts old mode 100755 new mode 100644 From ca38f13ea2fd36850edee02fea6d81f0f8b16569 Mon Sep 17 00:00:00 2001 From: Sebastian Schaper Date: Sat, 2 Nov 2024 19:28:18 +0100 Subject: [PATCH 654/877] mediatek: filogic: add support for WAVLINK WL-WN573HX3 The WL-WN573HX3 is an AX3000 outdoor Access Point by WAVLINK, also sold in Europe as 7Links WLR-1300 (ZX-5612). Specifications: - MT7981B + MT7976 AX3000 2x2 DBDC (160 MHz) - 16 MiB SPI NOR, 256 MiB RAM - Gigabit ethernet port, 802.3af PoE - IP67 outdoor case for wall or pole mounting with four single band RP-SMA fiberglass antennas (8 dBi) Installation: - OEM Web UI is at 192.168.30.1 which will forward to http://netlogin.link (using a captive portal) - login with default password `admin` - skip setup wizard by navigating directly to http://netlogin.link/html/meshUpgrade.html - upload WN573HX3-sysupgrade.bin - reset to factory defaults to discard OEM UCI settings MAC address assignment: LAN 80:xx:xx:76:xx:25 hw 0x44e WLAN 2.4G 80:xx:xx:76:xx:27 factory 0x04 (label MAC) WLAN 5G 82:xx:xx:46:xx:27 pair key 8a:xx:xx:76:xx:27 also on label, not used by OpenWrt Signed-off-by: Sebastian Schaper Link: https://github.com/openwrt/openwrt/pull/18206 (cherry-picked from commit 907cb88e103b2e784caf0803b0ee668da28f2d14) Link: https://github.com/openwrt/openwrt/pull/18557 Signed-off-by: Hauke Mehrtens --- .../lib/preinit/05_set_preinit_iface | 3 +- .../dts/mt7981b-wavlink-wl-wn573hx3.dts | 188 ++++++++++++++++++ .../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 | 4 + .../base-files/lib/upgrade/platform.sh | 3 +- target/linux/mediatek/image/filogic.mk | 18 ++ 7 files changed, 217 insertions(+), 3 deletions(-) create mode 100644 target/linux/mediatek/dts/mt7981b-wavlink-wl-wn573hx3.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 1025d1f1e1343c..421f02938ae481 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 @@ -3,7 +3,8 @@ set_preinit_iface() { cudy,m3000-v1|\ cudy,tr3000-v1|\ glinet,gl-mt3000|\ - openembed,som7981) + openembed,som7981|\ + wavlink,wl-wn573hx3) ip link set eth1 up ifname=eth1 ;; diff --git a/target/linux/mediatek/dts/mt7981b-wavlink-wl-wn573hx3.dts b/target/linux/mediatek/dts/mt7981b-wavlink-wl-wn573hx3.dts new file mode 100644 index 00000000000000..ff222247a6aa26 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-wavlink-wl-wn573hx3.dts @@ -0,0 +1,188 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/dts-v1/; + +#include "mt7981.dtsi" + +/ { + model = "WAVLINK WL-WN573HX3"; + compatible = "wavlink,wl-wn573hx3", "mediatek,mt7981"; + + aliases { + label-mac-device = &wifi; + + led-boot = &led_status_blue; + led-failsafe = &led_status_blue; + led-running = &led_status_blue; + led-upgrade = &led_status_blue; + + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + gpio-keys { + compatible = "gpio-keys"; + + button-reset { + label = "reset"; + linux,code = ; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led-0 { + color = ; + function = LED_FUNCTION_LAN; + gpios = <&pio 9 GPIO_ACTIVE_HIGH>; + }; + + led_status_blue: led-1 { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&pio 13 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-cells = <&macaddr_hw_44e 0>; + nvmem-cell-names = "mac-address"; + }; +}; + +&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 = <52000000>; + 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 0xb0000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x1000>; + }; + }; + }; + + partition@100000 { + label = "fip"; + reg = <0x100000 0x80000>; + read-only; + }; + + partition@f0000 { + compatible = "denx,fit"; + label = "firmware"; + reg = <0x180000 0xe00000>; + }; + + partition@f80000 { + label = "hw"; + reg = <0xf80000 0x80000>; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_hw_44e: macaddr@44e { + compatible = "mac-base"; + reg = <0x44e 0x11>; + #nvmem-cell-cells = <1>; + }; + }; + }; + }; + }; +}; + +&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 c7455b78fcc677..aaefa1cb561dfa 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 @@ -35,7 +35,8 @@ bananapi,bpi-r4-poe) ucidef_set_led_netdev "lan2" "lan2" "mt7530-0:02:green:lan" "lan2" "link tx rx" ucidef_set_led_netdev "lan3" "lan3" "mt7530-0:03:green:lan" "lan3" "link tx rx" ;; -cudy,re3000-v1) +cudy,re3000-v1|\ +wavlink,wl-wn573hx3) ucidef_set_led_netdev "lan" "lan" "green:lan" "eth0" "link tx rx" ;; cudy,wr3000-v1) 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 cc01a3d2b42959..3d7cdd156aeedc 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 @@ -82,6 +82,7 @@ mediatek_setup_interfaces() cudy,re3000-v1|\ netgear,wax220|\ ubnt,unifi-6-plus|\ + wavlink,wl-wn573hx3|\ zyxel,nwa50ax-pro) ucidef_set_interface_lan "eth0" ;; 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 7251e05d63a6e0..19c7eb43e86bc6 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 @@ -180,6 +180,10 @@ case "$board" in addr=$(mtd_get_mac_binary "Factory" 0x4) [ "$PHYNBR" = "1" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress ;; + wavlink,wl-wn573hx3) + addr=$(mtd_get_mac_binary factory 0x04) + [ "$PHYNBR" = "1" ] && macaddr_setbit_la $(macaddr_add $addr -0x300000) > /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 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 2c6a0372f444dc..c2600c8ca33d59 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -126,7 +126,8 @@ platform_do_upgrade() { ;; cudy,re3000-v1|\ cudy,wr3000-v1|\ - yuncore,ax835) + yuncore,ax835|\ + wavlink,wl-wn573hx3) default_do_upgrade "$1" ;; dlink,aquila-pro-ai-m30-a1|\ diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index b4449a37fe555d..733f026a46be3d 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -1602,6 +1602,24 @@ define Device/wavlink_wl-wn586x3 endef TARGET_DEVICES += wavlink_wl-wn586x3 +define Device/wavlink_wl-wn573hx3 + DEVICE_VENDOR := WAVLINK + DEVICE_MODEL := WL-WN573HX3 + DEVICE_ALT0_VENDOR := 7Links + DEVICE_ALT0_MODEL := WLR-1300 + DEVICE_DTS := mt7981b-wavlink-wl-wn573hx3 + DEVICE_DTS_DIR := ../dts + DEVICE_DTS_LOADADDR := 0x47000000 + IMAGE_SIZE := 14336k + KERNEL := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware + SUPPORTED_DEVICES += mediatek,mt7981-spim-nor-rfb + IMAGES = WN573HX3-sysupgrade.bin + IMAGE/WN573HX3-sysupgrade.bin := append-kernel | pad-to 128k | append-rootfs | pad-rootfs | check-size | append-metadata +endef +TARGET_DEVICES += wavlink_wl-wn573hx3 + define Device/xiaomi_mi-router-ax3000t DEVICE_VENDOR := Xiaomi DEVICE_MODEL := Mi Router AX3000T From 4a55d894fdddd028f36b552ee95ab30bc7a79bd4 Mon Sep 17 00:00:00 2001 From: Coia Prant Date: Sat, 19 Apr 2025 14:17:38 +0800 Subject: [PATCH 655/877] kernel: modules: add HiNIC support Add support for the Huawei Intelligent PCIE Network Interface Card (HiNIC) Signed-off-by: Coia Prant Link: https://github.com/openwrt/openwrt/pull/18534 (cherry picked from commit 5fcc57cca6497712e53c5b8366155dd92359469e) Link: https://github.com/openwrt/openwrt/pull/18571 Signed-off-by: Hauke Mehrtens --- package/kernel/linux/modules/netdevices.mk | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk index 32499e2e5e3193..87507525124190 100644 --- a/package/kernel/linux/modules/netdevices.mk +++ b/package/kernel/linux/modules/netdevices.mk @@ -1821,6 +1821,23 @@ endef $(eval $(call KernelPackage,igc)) + +define KernelPackage/hinic + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Huawei Intelligent PCIE Network Interface Card support + DEPENDS:=@PCI_SUPPORT @TARGET_x86||TARGET_armsr_armv8 + FILES:=$(LINUX_DIR)/drivers/net/ethernet/huawei/hinic/hinic.ko + KCONFIG:=CONFIG_HINIC + AUTOLOAD:=$(call AutoProbe,hinic) +endef + +define KernelPackage/hinic/description + Kernel module for HiNIC PCIE Ethernet cards +endef + +$(eval $(call KernelPackage,hinic)) + + define KernelPackage/sfc SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Solarflare SFC9000/SFC9100/EF100-family support From 6854e1e55418f0a7b0c2df835040718ff1fb39f6 Mon Sep 17 00:00:00 2001 From: Jonas Jelonek Date: Wed, 18 Dec 2024 21:57:22 +0100 Subject: [PATCH 656/877] kernel: netdevices: add driver for Broadcom NetXtreme-C/E Package bnxt_en kernel module for Broadcom NetXtreme-C/E based Ethernet network chips like BCM573xx and BCM574xx. Signed-off-by: Jonas Jelonek Link: https://github.com/openwrt/openwrt/pull/17301 (cherry picked from commit a7f4155f54ac72c388a8b515865e496bfd6ec437) Signed-off-by: Josh Bendavid Link: https://github.com/openwrt/openwrt/pull/18483 Signed-off-by: Hauke Mehrtens --- package/kernel/linux/modules/netdevices.mk | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk index 87507525124190..9126ef7d7529a4 100644 --- a/package/kernel/linux/modules/netdevices.mk +++ b/package/kernel/linux/modules/netdevices.mk @@ -1539,6 +1539,28 @@ endef $(eval $(call KernelPackage,bnx2x)) +define KernelPackage/bnxt-en + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Broadcom NetXtreme-C/E network driver + DEPENDS:=@PCI_SUPPORT +kmod-hwmon-core +kmod-lib-crc32c +kmod-mdio +kmod-ptp + FILES:=$(LINUX_DIR)/drivers/net/ethernet/broadcom/bnxt/bnxt_en.ko + KCONFIG:= \ + CONFIG_BNXT \ + CONFIG_BNXT_SRIOV=y \ + CONFIG_BNXT_FLOWER_OFFLOAD=y \ + CONFIG_BNXT_DCB=n \ + CONFIG_BNXT_HWMON=y + AUTOLOAD:=$(call AutoProbe,bnxt_en) +endef + +define KernelPackage/bnxt-en/description + Supports Broadcom NetXtreme-C/E based Ethernet NICs including: + * BCM573xx + * BCM574xx +endef + +$(eval $(call KernelPackage,bnxt-en)) + define KernelPackage/be2net SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Broadcom Emulex OneConnect 10Gbps NIC From d29ee6c47eaa194585be76787ea15e6d72d2b67b Mon Sep 17 00:00:00 2001 From: Olgun Demir Date: Sun, 20 Apr 2025 07:04:33 +0200 Subject: [PATCH 657/877] ramips: Add support for Xiaomi MiWiFi 3A The Xiaomi MiWiFi 3A wireless router has a similar system architecture as the Xiaomi Mi 4A router, which is already officially supported by OpenWrt. Product website: https://www.mi.com/miwifi3a Device specification -------------------- SoC: MT7628AN MIPS_24KEc @ 580 MHz 2.4G-bgn 2x2 WiFi: MT7612EN 5G-an, ac 80 MHz 2T2R Flash: 16 MB DRAM: 64 MB Switch: MT7628AN (integrated in SoC) Ethernet: 1 x 10 /100 Mbps USB: None Antennas: 2 x 2,4 GHz and 2 x 5 GHz (all are external and non-detachable) LEDs: blue/red/amber Buttons: Reset Serial: 115200,8n1 MAC addresses as verified by OEM firmware: ------------------------------------------ use address source LAN *:DD factory 0x28 WAN *:DD factory 0x28 2g *:DE factory 0x4 5g *:DF factory 0x8004 OEM firmware uses VLAN's to create the network interface for WAN and LAN. Bootloader info: ---------------- The stock bootloader uses a "Dual ROM Partition System". OS1 is a deep copy of OS2. The bootloader starts OS2 by default. To force start OS1 it is needed to set "flag_try_sys2_failed=1". How to install: --------------- 1- Use OpenWRTInvasion to gain Telnet, SSH and FTP access: https://github.com/acecilia/OpenWRTInvasion [IP: 192.168.31.1 | Username: root | Password: root | FTP-Port: 21] 2- Connect to router using telnet or ssh. 3- Backup all partitions. Use command "dd if=/dev/mtd0 of=/tmp/mtd0". Copy /tmp/mtd0 to computer using ftp. 4- Copy openwrt-ramips-mt76x8-xiaomi_miwifi-3a-squashfs-sysupgrade.bin to /tmp in router using ftp. 5- Enable UART access and change start image to OS1. nvram set uart_en=1 nvram set flag_last_success=1 nvram set boot_wait=on nvram set flag_try_sys2_failed=1 nvram commit 6- Erase OS1 & OS2 and install OpenWrt mtd erase OS1 mtd erase OS2 mtd -r write /tmp/openwrt-ramips-mt76x8-xiaomi_miwifi-3a-squashfs-sysupgrade.bin OS1 Credits: -------- This PR is based on the work of Zehao Zhang (Github: @ZZH-Finalize) that he had published in the PR: #15698 Signed-off-by: Olgun Demir Link: https://github.com/openwrt/openwrt/pull/18427 (cherry picked from commit c3b8108a2be4df3a114ac6d964c664dffd2d5bbf) Link: https://github.com/openwrt/openwrt/pull/18550 Signed-off-by: Hauke Mehrtens --- package/boot/uboot-envtools/files/ramips | 1 + .../ramips/dts/mt7628an_xiaomi_miwifi-3a.dts | 190 ++++++++++++++++++ target/linux/ramips/image/mt76x8.mk | 8 + .../mt76x8/base-files/etc/board.d/02_network | 4 + .../mt76x8/base-files/etc/init.d/bootcount | 1 + 5 files changed, 204 insertions(+) create mode 100644 target/linux/ramips/dts/mt7628an_xiaomi_miwifi-3a.dts mode change 100755 => 100644 target/linux/ramips/mt76x8/base-files/etc/init.d/bootcount diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index d6124745da9a26..b0f8c1c1689944 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -63,6 +63,7 @@ kroks,kndrt31r19|\ mediatek,linkit-smart-7688|\ samknows,whitebox-v8|\ xiaomi,mi-router-4c|\ +xiaomi,miwifi-3a|\ xiaomi,miwifi-nano|\ zbtlink,zbt-wg2626|\ zte,mf283plus) diff --git a/target/linux/ramips/dts/mt7628an_xiaomi_miwifi-3a.dts b/target/linux/ramips/dts/mt7628an_xiaomi_miwifi-3a.dts new file mode 100644 index 00000000000000..3a48410fa74345 --- /dev/null +++ b/target/linux/ramips/dts/mt7628an_xiaomi_miwifi-3a.dts @@ -0,0 +1,190 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7628an.dtsi" + +#include +#include +#include + +/ { + compatible = "xiaomi,miwifi-3a", "mediatek,mt7628an-soc"; + model = "Xiaomi MiWiFi 3A"; + + aliases { + led-boot = &led_status_amber; + led-failsafe = &led_status_red; + led-running = &led_status_blue; + led-upgrade = &led_status_amber; + label-mac-device = ðernet; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + leds { + compatible = "gpio-leds"; + + led_status_blue: status_blue { + function = LED_FUNCTION_STATUS; + color = ; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + }; + + led_status_red: status_red { + function = LED_FUNCTION_STATUS; + color = ; + gpios = <&gpio 37 GPIO_ACTIVE_LOW>; + }; + + led_status_amber: status_amber { + function = LED_FUNCTION_STATUS; + color = ; + gpios = <&gpio 44 GPIO_ACTIVE_LOW>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 38 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&state_default { + gpio { + groups = "gpio", "refclk", "wdt", "wled_an"; + function = "gpio"; + }; +}; + +&ehci { + status = "disabled"; +}; + +&ohci { + status = "disabled"; +}; + +&esw { + mediatek,portmap = <0x3e>; + mediatek,portdisable = <0x2a>; +}; + +&wmac { + status = "okay"; + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + nvmem-cells = <&eeprom_factory_8000>; + nvmem-cell-names = "eeprom"; + ieee80211-freq-limit = <5000000 6000000>; + }; +}; + +ðernet { + nvmem-cells = <&macaddr_factory_28>; + nvmem-cell-names = "mac-address"; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <40000000>; + + 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 = "Bdata"; + reg = <0x40000 0x10000>; + read-only; + }; + + 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 0x400>; + }; + + eeprom_factory_8000: eeprom@8000 { + reg = <0x8000 0x200>; + }; + + macaddr_factory_4: macaddr@4 { + reg = <0x4 0x6>; + }; + + macaddr_factory_28: macaddr@28 { + reg = <0x28 0x6>; + }; + + macaddr_factory_8004: macaddr@8004 { + reg = <0x8004 0x6>; + }; + }; + }; + + partition@60000 { + label = "crash"; + reg = <0x60000 0x10000>; + read-only; + }; + + partition@70000 { + label = "crash_syslog"; + reg = <0x70000 0x10000>; + read-only; + }; + + partition@80000 { + label = "overlay"; + reg = <0x80000 0x100000>; + read-only; + }; + + partition@180000 { + label = "firmware"; + compatible = "denx,uimage"; + reg = <0x180000 0xe80000>; + }; + }; + }; +}; diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk index 1352b3befa4e8f..c7168cc9368e2f 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -1121,6 +1121,14 @@ define Device/xiaomi_mi-router-4c endef TARGET_DEVICES += xiaomi_mi-router-4c +define Device/xiaomi_miwifi-3a + IMAGE_SIZE := 16064k + DEVICE_VENDOR := Xiaomi + DEVICE_MODEL := MiWiFi 3A + DEVICE_PACKAGES := kmod-mt76x2 +endef +TARGET_DEVICES += xiaomi_miwifi-3a + define Device/xiaomi_miwifi-3c IMAGE_SIZE := 15104k DEVICE_VENDOR := Xiaomi diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network index 56266e473c6d05..23ec31f91258a3 100644 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network @@ -198,6 +198,10 @@ ramips_setup_interfaces() ucidef_add_switch "switch0" \ "4:lan:1" "2:lan:2" "1:wan" "6@eth0" ;; + xiaomi,miwifi-3a) + ucidef_add_switch "switch0" \ + "0:wan" "2:lan:1" "4:lan:2" "6@eth0" + ;; xiaomi,miwifi-3c) ucidef_add_switch "switch0" \ "0:wan" "2:lan:2" "4:lan:1" "6@eth0" diff --git a/target/linux/ramips/mt76x8/base-files/etc/init.d/bootcount b/target/linux/ramips/mt76x8/base-files/etc/init.d/bootcount old mode 100755 new mode 100644 index 23f1e71b41809c..069b481bb94f76 --- a/target/linux/ramips/mt76x8/base-files/etc/init.d/bootcount +++ b/target/linux/ramips/mt76x8/base-files/etc/init.d/bootcount @@ -9,6 +9,7 @@ boot() { echo -e "bootcount\nbootchanged\n" | /usr/sbin/fw_setenv -s - ;; xiaomi,mi-router-4c|\ + xiaomi,miwifi-3a|\ xiaomi,miwifi-nano) fw_setenv flag_boot_success 1 ;; From 5db1b94b63d8b97a0d2409b11790b46373a1a20c Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Sun, 13 Apr 2025 07:02:53 +0000 Subject: [PATCH 658/877] mediatek: add support for Routerich AX3000 v1 Routerich AX3000 v1 is a wireless WiFi 6 router. Specification ------------- - SoC : MediaTek MT7981BA dual-core ARM Cortex-A53 1.3 GHz - RAM : DDR3 512 MiB - Flash : SPI-NAND 128 MiB (Winbond) - 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 x3, LAN (MediaTek MT7531AE) 10/100/1000 Mbps x1, WAN (MT7981 internal PHY) - USB : 1x 3.0 with power control - 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) 1x 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:08 | label | | LAN | 24:0f:5e:xx:xx:09 | label+1 | | WLAN 2g | 24:0f:5e:xx:xx:0a | label+2 | | WLAN 5g | 24:0f:5e:xx:xx:0b | label+3 | +---------+-------------------+-----------+ The WLAN 2g MAC was found in 'Factory', 0x4 Signed-off-by: Mikhail Zhilkin (cherry picked from commit fdb6962f20aaaa703ce91338f5efcc1d055677c8) [fix merging conflict in mediatek_filogic, 01_leds, 02_network] Signed-off-by: Mikhail Zhilkin Link: https://github.com/openwrt/openwrt/pull/18601 Signed-off-by: Hauke Mehrtens --- .../uboot-envtools/files/mediatek_filogic | 1 + .../dts/mt7981b-routerich-ax3000-v1.dts | 337 ++++++++++++++++++ .../filogic/base-files/etc/board.d/01_leds | 7 + .../filogic/base-files/etc/board.d/02_network | 1 + target/linux/mediatek/image/filogic.mk | 12 + 5 files changed, 358 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7981b-routerich-ax3000-v1.dts diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index 5f586047f5789b..0da869cdbf9b1f 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -111,6 +111,7 @@ glinet,gl-mt3000) mercusys,mr80x-v3|\ mercusys,mr90x-v1|\ routerich,ax3000|\ +routerich,ax3000-v1|\ tplink,re6000xd) 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-v1.dts b/target/linux/mediatek/dts/mt7981b-routerich-ax3000-v1.dts new file mode 100644 index 00000000000000..09c555b73c0502 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-routerich-ax3000-v1.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 v1"; + compatible = "routerich,ax3000-v1", "mediatek,mt7981"; + + aliases { + label-mac-device = &gmac1; + + 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-export { + compatible = "gpio-export"; + + gpio-0 { + gpio-export,name = "usb-enable"; + gpio-export,output = <1>; + gpios = <&pio 14 GPIO_ACTIVE_HIGH>; + }; + }; + + gpio-keys { + compatible = "gpio-keys"; + + button-0 { + label = "mesh"; + /* Reassigned to RF_KILL */ + 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_5GHZ; + 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_2GHZ; + 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>; + }; + }; +}; + +ð { + 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; + }; + }; + + 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_factory_4 (-2)>; + }; +}; + +&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 { + #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 0x7000000>; + }; + }; + }; +}; + +&switch { + 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@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>; + + ieee80211-freq-limit = <2400000 2500000>, <5170000 5835000>; + + band@0 { + reg = <0>; + nvmem-cells = <&macaddr_factory_4 (0)>; + nvmem-cell-names = "mac-address"; + }; + + band@1 { + reg = <1>; + nvmem-cells = <&macaddr_factory_4 (1)>; + nvmem-cell-names = "mac-address"; + }; +}; + +&xhci { + 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 aaefa1cb561dfa..dd0bc3597bb16c 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 @@ -98,6 +98,13 @@ routerich,ax3000-ubootmod) ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan" "link tx rx" ucidef_set_led_netdev "wan-off" "wan-off" "red:wan" "wan" "link" ;; +routerich,ax3000-v1) + 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" "eth1" "link tx rx" + ucidef_set_led_netdev "wan-off" "wan-off" "red:wan" "eth1" "link" + ;; smartrg,sdg-8733|\ smartrg,sdg-8734) ucidef_set_led_netdev "lan-1-green" "LAN1" "mdio-bus:08:green:lan" "lan1" "link_2500 link_5000" 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 3d7cdd156aeedc..3440cae0195b1a 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,7 @@ mediatek_setup_interfaces() netis,nx31|\ nokia,ea0326gmp|\ mercusys,mr80x-v3|\ + routerich,ax3000-v1|\ zbtlink,zbt-z8103ax) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" eth1 ;; diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 733f026a46be3d..9aa0cf9c04bb35 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -1481,6 +1481,18 @@ define Device/routerich_ax3000-ubootmod endef TARGET_DEVICES += routerich_ax3000-ubootmod +define Device/routerich_ax3000-v1 + DEVICE_VENDOR := Routerich + DEVICE_MODEL := AX3000 + DEVICE_VARIANT := v1 + DEVICE_DTS := mt7981b-routerich-ax3000-v1 + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware kmod-usb3 mt7981-wo-firmware + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + SUPPORTED_DEVICES += mediatek,mt7981-spim-snand-rfb +endef +TARGET_DEVICES += routerich_ax3000-v1 + define Device/ruijie_rg-x60-pro DEVICE_VENDOR := Ruijie DEVICE_MODEL := RG-X60 Pro From 52d4559fe10991a4ee910eaab1f9188fef2cb75d Mon Sep 17 00:00:00 2001 From: Eric Fahlgren Date: Thu, 8 May 2025 15:28:52 -0700 Subject: [PATCH 659/877] imagebuilder: exclude metadata for profiles that have no kernel Device profiles that specify 'DEFAULT := n' are being included in the imagebuilder metadata, specifically in .profiles.mk, even though there is no kernel built for the device. This results in 'make info' showing the device as valid, but then 'make image PROFILE=xxx' failing with 'No rule to make target xxx-kernel.bin ...' We exclude these profiles from the imagebuilder, avoiding these errors. Fixes: https://github.com/openwrt/openwrt/issues/18410 Signed-off-by: Eric Fahlgren Link: https://github.com/openwrt/openwrt/pull/18748 (cherry picked from commit b88f3ebb3341281fa7e61dc4f039062e72c86b9e) Link: https://github.com/openwrt/openwrt/pull/18765 Signed-off-by: Robert Marko --- scripts/target-metadata.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/target-metadata.pl b/scripts/target-metadata.pl index 0c17e2e3273df6..3cca361374efca 100755 --- a/scripts/target-metadata.pl +++ b/scripts/target-metadata.pl @@ -433,7 +433,7 @@ () my @targets = parse_target_metadata($file); foreach my $cur (@targets) { next unless $cur->{id} eq $target; - my @profile_ids_unique = do { my %seen; grep { !$seen{$_}++} map { $_->{id} } @{$cur->{profiles}}}; + my @profile_ids_unique = do { my %seen; grep { !$seen{$_}++} map { $_->{id} } grep { $_->{default} !~ /^n/ } @{$cur->{profiles}}}; print "PROFILE_NAMES = ".join(" ", @profile_ids_unique)."\n"; foreach my $profile (@{$cur->{profiles}}) { print $profile->{id}.'_NAME:='.$profile->{name}."\n"; From ea97c49766ad55cdfedcf7bd3eaf3b2a66d29730 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Sun, 4 May 2025 04:49:50 +0200 Subject: [PATCH 660/877] ramips: drop ALT0 name from Pulse EX400 dts model The alternative model name does not need to be represented in the DTS. Signed-off-by: David Bauer (cherry picked from commit ff55daf1eb8b96f09fceeaf62b882ba0b7dfa34b) --- target/linux/ramips/dts/mt7621_genexis_pulse-ex400.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ramips/dts/mt7621_genexis_pulse-ex400.dts b/target/linux/ramips/dts/mt7621_genexis_pulse-ex400.dts index 2ec649832279ae..7256ea0cf29c7c 100644 --- a/target/linux/ramips/dts/mt7621_genexis_pulse-ex400.dts +++ b/target/linux/ramips/dts/mt7621_genexis_pulse-ex400.dts @@ -4,7 +4,7 @@ / { compatible = "genexis,pulse-ex400", "mediatek,mt7621-soc"; - model = "Genexis/Inteno Pulse EX400"; + model = "Genexis Pulse EX400"; aliases { led-boot = &led_status_red; From 5216ad973176d7b7e27f14f51b345a1367d3606d Mon Sep 17 00:00:00 2001 From: David Bauer Date: Sun, 4 May 2025 04:47:32 +0200 Subject: [PATCH 661/877] ramips: add Semtech SX9512 touch input driver This driver is required for the touch-inputs as well as some LEDs on the Genexis Pulse EX400. The driver was also sent upstream. As the EX400 is currently the only consumer, the driver is added target-specific for ramips. Once the driver has been accepted upstream and is provided in a kernel release used by OpenWrt, the package should be moved to the global input drivers. Link: https://www.spinics.net/lists/kernel/msg5669349.html Signed-off-by: David Bauer (cherry picked from commit 0842e793381a1e60f8acdcbea0e8c59be1ac9a88) --- target/linux/ramips/modules.mk | 18 + ...51x-add-Semtech-SX9512-SX9513-driver.patch | 550 ++++++++++++++++++ 2 files changed, 568 insertions(+) create mode 100644 target/linux/ramips/patches-6.6/870-Input-sx951x-add-Semtech-SX9512-SX9513-driver.patch diff --git a/target/linux/ramips/modules.mk b/target/linux/ramips/modules.mk index 175ba94eff988b..22a9660b0f34d6 100644 --- a/target/linux/ramips/modules.mk +++ b/target/linux/ramips/modules.mk @@ -152,3 +152,21 @@ define KernelPackage/sound-mt7620/description endef $(eval $(call KernelPackage,sound-mt7620)) + + +define KernelPackage/keyboard-sx951x + SUBMENU:=Other modules + TITLE:=Semtech SX9512/SX9513 + DEPENDS:=@TARGET_ramips_mt7621 +kmod-input-core + KCONFIG:= \ + CONFIG_KEYBOARD_SX951X \ + CONFIG_INPUT_KEYBOARD=y + FILES:=$(LINUX_DIR)/drivers/input/keyboard/sx951x.ko + AUTOLOAD:=$(call AutoProbe,sx951x) +endef + +define KernelPackage/keyboard-sx951x/description + Enable support for SX9512/SX9513 capacitive touch controllers +endef + +$(eval $(call KernelPackage,keyboard-sx951x)) diff --git a/target/linux/ramips/patches-6.6/870-Input-sx951x-add-Semtech-SX9512-SX9513-driver.patch b/target/linux/ramips/patches-6.6/870-Input-sx951x-add-Semtech-SX9512-SX9513-driver.patch new file mode 100644 index 00000000000000..9b724e9d5266fe --- /dev/null +++ b/target/linux/ramips/patches-6.6/870-Input-sx951x-add-Semtech-SX9512-SX9513-driver.patch @@ -0,0 +1,550 @@ +From ba92c0187006e2a6eae9573a569d275b0bd31732 Mon Sep 17 00:00:00 2001 +From: David Bauer +Date: Fri, 2 May 2025 23:04:27 +0200 +Subject: [PATCH] Input sx951x: add Semtech SX9512/SX9513 driver + +The Semtech SX9512/SX9513 is a family of capacitive touch-keyboard +controllers. + +All chips offer 8 channel touch sensitive inputs with one LED driver per +output channel. + +The also SX9512 supports proximity detection which is currently not +supported with the driver. + +This chip can be found on the Genexis Pulse EX400 repeater platform. + +Link: https://www.mouser.com/datasheet/2/761/SEMTS05226_1-2575172.pdf +Link: https://www.spinics.net/lists/kernel/msg5669349.html + +Signed-off-by: David Bauer +--- + drivers/input/keyboard/Kconfig | 11 + + drivers/input/keyboard/Makefile | 1 + + drivers/input/keyboard/sx951x.c | 490 ++++++++++++++++++++++++++++++++ + 3 files changed, 502 insertions(+) + create mode 100644 drivers/input/keyboard/sx951x.c + +--- a/drivers/input/keyboard/Kconfig ++++ b/drivers/input/keyboard/Kconfig +@@ -616,6 +616,17 @@ config KEYBOARD_SUNKBD + To compile this driver as a module, choose M here: the + module will be called sunkbd. + ++config KEYBOARD_SX951X ++ tristate "Semtech SX951X capacitive touch controller" ++ depends on OF && I2C ++ select REGMAP_I2C ++ help ++ Say Y here to enable the Semtech SX9512/SX9153 capacitive ++ touch controller driver. ++ ++ To compile this driver as a module, choose M here: the ++ module will be called sx951x. ++ + config KEYBOARD_SH_KEYSC + tristate "SuperH KEYSC keypad support" + depends on ARCH_SHMOBILE || COMPILE_TEST +--- a/drivers/input/keyboard/Makefile ++++ b/drivers/input/keyboard/Makefile +@@ -66,6 +66,7 @@ obj-$(CONFIG_KEYBOARD_STOWAWAY) += stow + obj-$(CONFIG_KEYBOARD_ST_KEYSCAN) += st-keyscan.o + obj-$(CONFIG_KEYBOARD_SUN4I_LRADC) += sun4i-lradc-keys.o + obj-$(CONFIG_KEYBOARD_SUNKBD) += sunkbd.o ++obj-$(CONFIG_KEYBOARD_SX951X) += sx951x.o + obj-$(CONFIG_KEYBOARD_TC3589X) += tc3589x-keypad.o + obj-$(CONFIG_KEYBOARD_TEGRA) += tegra-kbc.o + obj-$(CONFIG_KEYBOARD_TM2_TOUCHKEY) += tm2-touchkey.o +--- /dev/null ++++ b/drivers/input/keyboard/sx951x.c +@@ -0,0 +1,490 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * Input driver for Semtech SX9512/SX9513 capacitive touch sensors. ++ * ++ * The difference between SX9512 and SX9513 is the presence of proximity ++ * sensing capabilities on the SX9512. ++ * ++ * SX951xB is the identical chip but with a different I2C address. ++ * ++ * (c) 2025 David Bauer ++ */ ++ ++ #include ++ #include ++ #include ++ #include ++ #include ++ #include ++ #include ++ #include ++ #include ++ ++ /* Generic properties */ ++#define SX951X_I2C_ADDRESS 0x2b ++#define SX951XB_I2C_ADDRESS_ 0x2d ++#define SX951X_NUM_CHANNELS 8 ++#define SX951X_POLL_INTERVAL 100 ++ ++/* Registers*/ ++#define SX951X_REG_IRQ_SRC 0x00 ++#define SX951X_REG_TOUCH_STATUS 0x01 ++#define SX951X_REG_PROXIMITY_STATUS 0x02 ++#define SX951X_REG_COMPENSATION_STATUS 0x03 ++#define SX951X_REG_IRQ_NVM_CTRL 0x04 ++#define SX951X_REG_SPO2_MODE_CTRL 0x07 ++#define SX951X_REG_PWR_KEY_CTRL 0x08 ++#define SX951X_REG_IRQ_MASK 0x09 ++ ++/* LED registers */ ++#define SX951X_REG_LED_MAP_ENG1 0x0c ++#define SX951X_REG_LED_MAP_ENG2 0x0d ++#define SX951X_REG_LED_PWM_FREQ 0x0e ++#define SX951X_REG_LED_MODE 0x0f ++#define SX951X_REG_LED_IDLE 0x10 ++#define SX951X_REG_LED_OFF_DELAY 0x11 ++#define SX951X_REG_LED_ON_ENG1 0x12 ++#define SX951X_REG_LED_FADE_ENG1 0x13 ++#define SX951X_REG_LED_ON_ENG2 0x14 ++#define SX951X_REG_LED_FADE_ENG2 0x15 ++#define SX951X_REG_LED_POWER_IDLE 0x16 ++#define SX951X_REG_LED_POWER_ON 0x17 ++#define SX951X_REG_LED_POWER_OFF 0x18 ++#define SX951X_REG_LED_POWER_FADE 0x19 ++#define SX951X_REG_LED_POWER_ON_PULSE 0x1a ++#define SX951X_REG_LED_POWER_MODE 0x1b ++ ++/* Capacitive touch sensing registers*/ ++#define SX951X_REG_CAP_SENSE_ENABLE 0x1e ++ ++#define SX951X_REG_CAP_SENSE_RANGE(x) (0x1f + (x)) ++#define SX951X_REG_CAP_SENSE_RANGE_CIN_DELTA_MASK GENMASK(1, 0) ++ ++#define SX951X_REG_CAP_SENSE_THRESH(x) (0x28 + (x)) ++#define SX951X_REG_CAP_SENSE_THRESH_ALL 0x30 ++ ++#define SX951X_REG_CAP_SENSE_OP 0x31 ++#define SX951X_REG_CAP_SENSE_MODE 0x32 ++#define SX951X_REG_CAP_SENSE_DEBOUNCE 0x33 ++ ++/* Reset register*/ ++#define SX951X_REG_SOFT_RESET 0xff ++ ++/* Default properties (keys)*/ ++#define SX951X_KEY_DEFAULT_CIN_DELTA 0x03 ++#define SX951X_KEY_DEFAULT_SENSE_THRESHOLD 0x04 ++ ++struct sx951x_key_data { ++ u32 cin_delta; ++ u32 sense_threshold; ++}; ++ ++struct sx951x_led { ++#ifdef CONFIG_LEDS_CLASS ++ struct led_classdev cdev; ++ struct sx951x_priv *priv; ++ ++ u32 reg; ++ bool registered; ++#endif ++}; ++ ++struct sx951x_priv { ++ struct regmap *regmap; ++ struct device *dev; ++ struct input_dev *idev; ++ const struct sx951x_hw_data *hw; ++ ++ struct sx951x_led leds[SX951X_NUM_CHANNELS]; ++ ++ /* device-config */ ++ u32 poll_interval; ++ ++ /* key-config */ ++ u32 keycodes[SX951X_NUM_CHANNELS]; ++ struct sx951x_key_data key_data[SX951X_NUM_CHANNELS]; ++}; ++ ++struct sx951x_hw_data { ++ bool has_proximity_sensing; ++}; ++ ++static const struct reg_default sx951x_reg_defaults[] = { ++ { SX951X_REG_LED_MAP_ENG1, 0x00 }, ++ { SX951X_REG_LED_MAP_ENG2, 0x00 }, ++ { SX951X_REG_LED_PWM_FREQ, 0x10 }, ++ { SX951X_REG_LED_IDLE, 0xff }, ++ { SX951X_REG_LED_ON_ENG1, 0xff }, ++ { SX951X_REG_LED_ON_ENG2, 0xff }, ++ { SX951X_REG_LED_POWER_IDLE, 0xff }, ++ { SX951X_REG_LED_POWER_ON, 0xff }, ++ { SX951X_REG_CAP_SENSE_ENABLE, 0x00 }, ++ { SX951X_REG_CAP_SENSE_RANGE(0), 0x40 }, ++ { SX951X_REG_CAP_SENSE_RANGE(1), 0x40 }, ++ { SX951X_REG_CAP_SENSE_RANGE(2), 0x40 }, ++ { SX951X_REG_CAP_SENSE_RANGE(3), 0x40 }, ++ { SX951X_REG_CAP_SENSE_RANGE(4), 0x40 }, ++ { SX951X_REG_CAP_SENSE_RANGE(5), 0x40 }, ++ { SX951X_REG_CAP_SENSE_RANGE(6), 0x40 }, ++ { SX951X_REG_CAP_SENSE_RANGE(7), 0x40 }, ++ { SX951X_REG_CAP_SENSE_THRESH(0), 0x0f }, ++ { SX951X_REG_CAP_SENSE_THRESH(1), 0x0f }, ++ { SX951X_REG_CAP_SENSE_THRESH(2), 0x0f }, ++ { SX951X_REG_CAP_SENSE_THRESH(3), 0x0f }, ++ { SX951X_REG_CAP_SENSE_THRESH(4), 0x0f }, ++ { SX951X_REG_CAP_SENSE_THRESH(5), 0x0f }, ++ { SX951X_REG_CAP_SENSE_THRESH(6), 0x0f }, ++ { SX951X_REG_CAP_SENSE_THRESH(7), 0x0f }, ++ { SX951X_REG_CAP_SENSE_THRESH_ALL, 0x0f }, ++ { SX951X_REG_CAP_SENSE_OP, 0x14 }, ++ { SX951X_REG_CAP_SENSE_MODE, 0x70 }, ++ { SX951X_REG_CAP_SENSE_DEBOUNCE, 0xff }, ++}; ++ ++static bool sx951x_volatile_reg(struct device *dev, unsigned int reg) ++{ ++ switch (reg) { ++ case SX951X_REG_TOUCH_STATUS: ++ return true; ++ default: ++ return false; ++ } ++} ++ ++static const struct regmap_config sx951x_regmap_config = { ++ .reg_bits = 8, ++ .val_bits = 8, ++ ++ .max_register = SX951X_REG_SOFT_RESET, ++ ++ .reg_defaults = sx951x_reg_defaults, ++ .num_reg_defaults = ARRAY_SIZE(sx951x_reg_defaults), ++ ++ .cache_type = REGCACHE_MAPLE, ++ .volatile_reg = sx951x_volatile_reg, ++}; ++ ++#ifdef CONFIG_LEDS_CLASS ++static int sx951x_led_set(struct led_classdev *cdev, enum led_brightness value) ++{ ++ struct sx951x_led *led = container_of(cdev, struct sx951x_led, cdev); ++ struct sx951x_priv *priv = led->priv; ++ ++ return regmap_update_bits(priv->regmap, ++ SX951X_REG_LED_MAP_ENG2, ++ BIT(led->reg), ++ value ? BIT(led->reg) : 0); ++} ++ ++static int sx951x_led_init(struct sx951x_priv *priv, ++ struct device_node *channel_node, u32 reg) ++{ ++ struct device_node *led_node; ++ struct sx951x_led *led = &priv->leds[reg]; ++ struct led_init_data init_data = {}; ++ int error; ++ ++ if (led->registered) { ++ dev_err(priv->dev, ++ "LED %d already registered\n", reg); ++ return -EINVAL; ++ } ++ ++ led_node = of_get_child_by_name(channel_node, "led"); ++ if (!led_node) { ++ /* No LED */ ++ return 0; ++ } ++ ++ led->cdev.flags = 0; ++ led->cdev.brightness_set_blocking = sx951x_led_set; ++ led->cdev.max_brightness = 1; ++ led->cdev.brightness = LED_OFF; ++ ++ init_data.default_label = of_get_property(led_node, "label", NULL); ++ init_data.fwnode = of_fwnode_handle(led_node); ++ ++ led->reg = reg; ++ led->priv = priv; ++ ++ error = devm_led_classdev_register_ext(priv->dev, &led->cdev, &init_data); ++ if (error) ++ return error; ++ ++ return 0; ++} ++#endif ++ ++static void sx951x_poll(struct input_dev *input) ++{ ++ struct sx951x_priv *priv = input_get_drvdata(input); ++ struct device *dev = priv->dev; ++ unsigned int val; ++ int error; ++ int i; ++ ++ error = regmap_read(priv->regmap, SX951X_REG_TOUCH_STATUS, &val); ++ if (error) { ++ dev_err(dev, "Failed to read touch status: %d\n", error); ++ return; ++ } ++ ++ for (i = 0; i < SX951X_NUM_CHANNELS; i++) { ++ if (priv->keycodes[i] == KEY_RESERVED) ++ continue; ++ ++ input_report_key(input, priv->keycodes[i], !!(val & BIT(i))); ++ input_sync(input); ++ } ++} ++ ++static int sx951x_channel_init(struct sx951x_priv *priv, struct device_node *of_node, ++ u32 chan_idx) ++{ ++ struct sx951x_key_data *key_data; ++ struct device *dev = priv->dev; ++ int error; ++ ++ key_data = &priv->key_data[chan_idx]; ++ ++ /* Defaults */ ++ key_data->cin_delta = SX951X_KEY_DEFAULT_CIN_DELTA; ++ key_data->sense_threshold = SX951X_KEY_DEFAULT_SENSE_THRESHOLD; ++ ++ error = of_property_read_u32(of_node, "linux,keycodes", ++ &priv->keycodes[chan_idx]); ++ if (error) { ++ /* Not configured */ ++ return 0; ++ } ++ ++ error = of_property_read_u32(of_node, "semtech,cin-delta", ++ &key_data->cin_delta); ++ if (key_data->cin_delta > 0x03) { ++ dev_err(dev, "Failed to read cin-delta for channel %d: %d\n", ++ chan_idx, error); ++ return error; ++ } ++ ++ error = of_property_read_u32(of_node, "semtech,sense-threshold", ++ &key_data->sense_threshold); ++ if (key_data->sense_threshold > 0xff) { ++ dev_err(dev, "Failed to read sense-threshold for channel %d: %d\n", ++ chan_idx, error); ++ return error; ++ } ++ ++ error = regmap_update_bits(priv->regmap, ++ SX951X_REG_CAP_SENSE_RANGE(chan_idx), ++ SX951X_REG_CAP_SENSE_RANGE_CIN_DELTA_MASK, ++ key_data->cin_delta); ++ ++ if (error) { ++ dev_err(dev, "Failed to set cin-delta for channel %d: %d\n", ++ chan_idx, error); ++ return error; ++ } ++ ++ error = regmap_write(priv->regmap, ++ SX951X_REG_CAP_SENSE_THRESH(chan_idx), ++ key_data->sense_threshold); ++ if (error) { ++ dev_err(dev, "Failed to set sense-threshold for channel %d: %d\n", ++ chan_idx, error); ++ return error; ++ } ++ ++ return 0; ++} ++ ++static int sx951x_channels_init(struct sx951x_priv *priv) ++{ ++ struct device *dev = priv->dev; ++ unsigned int channels = 0; ++ int error; ++ u32 reg; ++ ++ for_each_child_of_node_scoped(dev->of_node, child) { ++ error = of_property_read_u32(child, "reg", ®); ++ if (error != 0 || reg >= SX951X_NUM_CHANNELS) { ++ dev_err(dev, "Invalid channel %d\n", reg); ++ return -EINVAL; ++ } ++ ++ priv->keycodes[reg] = KEY_RESERVED; ++ ++ error = sx951x_channel_init(priv, child, reg); ++ if (error) { ++ dev_err(dev, "Failed to initialize channel %d: %d\n", ++ reg, error); ++ return error; ++ } ++ ++ if (priv->keycodes[reg] != KEY_RESERVED) ++ channels |= BIT(reg); ++ ++#ifdef CONFIG_LEDS_CLASS ++ error = sx951x_led_init(priv, child, reg); ++ if (error) { ++ dev_err(dev, "Failed to initialize LED %d: %d\n", ++ reg, error); ++ return error; ++ } ++#endif ++ } ++ ++ /* Enable sensing on channels with keycode configured */ ++ error = regmap_write(priv->regmap, ++ SX951X_REG_CAP_SENSE_ENABLE, ++ channels); ++ ++ return 0; ++} ++ ++static int sx951x_input_init(struct sx951x_priv *priv) ++{ ++ struct device *dev = priv->dev; ++ int i, error; ++ ++ priv->idev = devm_input_allocate_device(dev); ++ if (!priv->idev) ++ return -ENOMEM; ++ ++ priv->idev->name = "SX9512/SX9513 capacitive touch sensor"; ++ priv->idev->id.bustype = BUS_I2C; ++ __set_bit(EV_KEY, priv->idev->evbit); ++ ++ for (i = 0; i < SX951X_NUM_CHANNELS; i++) ++ __set_bit(priv->keycodes[i], priv->idev->keybit); ++ ++ __clear_bit(KEY_RESERVED, priv->idev->keybit); ++ ++ priv->idev->keycode = priv->keycodes; ++ priv->idev->keycodesize = sizeof(priv->keycodes[0]); ++ priv->idev->keycodemax = SX951X_NUM_CHANNELS; ++ ++ input_set_drvdata(priv->idev, priv); ++ ++ error = input_setup_polling(priv->idev, sx951x_poll); ++ if (error) { ++ dev_err(dev, "Unable to set up polling: %d\n", error); ++ return error; ++ } ++ ++ input_set_poll_interval(priv->idev, priv->poll_interval); ++ ++ error = input_register_device(priv->idev); ++ if (error) { ++ dev_err(dev, "Unable to register polled device: %d\n", ++ error); ++ return error; ++ } ++ ++ return 0; ++} ++ ++static int sx951x_probe(struct i2c_client *i2c_client) ++{ ++ const struct i2c_device_id *id; ++ const struct sx951x_hw_data *hw; ++ struct device *dev = &i2c_client->dev; ++ struct sx951x_priv *priv; ++ int error; ++ ++ if (i2c_client->addr != SX951X_I2C_ADDRESS && ++ i2c_client->addr != SX951XB_I2C_ADDRESS_) { ++ dev_err(dev, "Invalid I2C address: 0x%02x\n", ++ i2c_client->addr); ++ return -ENODEV; ++ } ++ ++ id = i2c_client_get_device_id(i2c_client); ++ hw = i2c_get_match_data(i2c_client); ++ if (!id || !hw) { ++ dev_err(dev, "Invalid device configuration\n"); ++ return -EINVAL; ++ } ++ ++ priv = devm_kzalloc(dev, ++ sizeof(struct sx951x_priv), ++ GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; ++ ++ priv->dev = dev; ++ priv->hw = hw; ++ ++ priv->regmap = devm_regmap_init_i2c(i2c_client, &sx951x_regmap_config); ++ if (IS_ERR(priv->regmap)) ++ return PTR_ERR(priv->regmap); ++ ++ /* Parse device configuration */ ++ if (of_property_read_u32(dev->of_node, "poll-interval", ++ &priv->poll_interval)) ++ priv->poll_interval = SX951X_POLL_INTERVAL; ++ ++ /* Register LED and input channels */ ++ error = sx951x_channels_init(priv); ++ if (error) { ++ dev_err(dev, "Failed to initialize channels: %d\n", error); ++ return error; ++ } ++ ++ /* Register input device */ ++ error = sx951x_input_init(priv); ++ if (error) { ++ dev_err(dev, "Failed to register input device: %d\n", error); ++ return error; ++ } ++ ++ return 0; ++} ++ ++static void sx951x_remove(struct i2c_client *i2c_client) ++{ ++ struct sx951x_priv *priv = i2c_get_clientdata(i2c_client); ++ ++ /* Disable sensing */ ++ regmap_write(priv->regmap, SX951X_REG_CAP_SENSE_ENABLE, 0x00); ++ ++ /* Turn off all LEDs */ ++ regmap_write(priv->regmap, SX951X_REG_LED_MAP_ENG2, 0x00); ++} ++ ++static const struct sx951x_hw_data sx9512_hw_data = { ++ .has_proximity_sensing = true, ++}; ++ ++static const struct sx951x_hw_data sx9513_hw_data = { ++ .has_proximity_sensing = false, ++}; ++ ++static const struct of_device_id sx951x_dt_ids[] = { ++ { .compatible = "semtech,sx9512", .data = &sx9512_hw_data }, ++ { .compatible = "semtech,sx9513", .data = &sx9513_hw_data }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, sx951x_dt_ids); ++ ++static const struct i2c_device_id sx951x_i2c_ids[] = { ++ { "sx9512", (kernel_ulong_t)&sx9512_hw_data }, ++ { "sx9513", (kernel_ulong_t)&sx9513_hw_data }, ++ { } ++}; ++MODULE_DEVICE_TABLE(i2c, sx951x_i2c_ids); ++ ++static struct i2c_driver sx951x_i2c_driver = { ++ .driver = { ++ .name = "sx951x", ++ .of_match_table = sx951x_dt_ids, ++ }, ++ .id_table = sx951x_i2c_ids, ++ .probe = sx951x_probe, ++ .remove = sx951x_remove, ++}; ++ ++module_i2c_driver(sx951x_i2c_driver); ++ ++MODULE_DESCRIPTION("Semtech SX9512/SX9513 driver"); ++MODULE_AUTHOR("David Bauer "); ++MODULE_LICENSE("GPL"); From 79cbeb8dd26cdad73d57d61d988c6e287b25ff5c Mon Sep 17 00:00:00 2001 From: David Bauer Date: Sun, 4 May 2025 04:45:03 +0200 Subject: [PATCH 662/877] ramips: support Genexis EX400 touch controller Add the necessary package dependencies as well as device-tree properties to support the touch-inputs as well as missing LEDs on the Genexis Pulse EX400 range extender. Signed-off-by: David Bauer (cherry picked from commit 49a1781d74590f0945973dac6d82faeb2f624b6f) --- .../ramips/dts/mt7621_genexis_pulse-ex400.dts | 82 +++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 2 +- .../mt7621/base-files/etc/board.d/01_leds | 1 + 3 files changed, 84 insertions(+), 1 deletion(-) diff --git a/target/linux/ramips/dts/mt7621_genexis_pulse-ex400.dts b/target/linux/ramips/dts/mt7621_genexis_pulse-ex400.dts index 7256ea0cf29c7c..61b3e869d7e154 100644 --- a/target/linux/ramips/dts/mt7621_genexis_pulse-ex400.dts +++ b/target/linux/ramips/dts/mt7621_genexis_pulse-ex400.dts @@ -21,3 +21,85 @@ gpios = <&gpio 12 GPIO_ACTIVE_LOW>; }; }; + +&i2c { + clock-frequency = <1000>; + + touch@2b { + compatible = "semtech,sx9512"; + + reg = <0x2b>; + + #address-cells = <1>; + #size-cells = <0>; + + poll-interval = <150>; + + /* Touch area 2.4 GHz */ + channel@1 { + reg = <1>; + + semtech,cin-delta = <0x3>; + semtech,sense-threshold = <0x04>; + + linux,keycodes = ; + }; + + /* Touch area 5 GHz */ + channel@2 { + reg = <2>; + + semtech,cin-delta = <0x3>; + semtech,sense-threshold = <0x04>; + + linux,keycodes = ; + }; + /* Touch area WPS */ + channel@3 { + reg = <3>; + + semtech,cin-delta = <0x3>; + semtech,sense-threshold = <0x04>; + + linux,keycodes = ; + }; + + channel@4 { + reg = <4>; + + led { + color = ; + function = LED_FUNCTION_WAN; + }; + }; + + channel@5 { + reg = <5>; + + led { + color = ; + function = LED_FUNCTION_WAN; + }; + }; + + channel@6 { + reg = <6>; + + led { + color = ; + function = LED_FUNCTION_WLAN_5GHZ; + linux,default-trigger = "phy1tpt"; + }; + }; + + channel@7 { + reg = <7>; + + led { + color = ; + function = LED_FUNCTION_WLAN_2GHZ; + linux,default-trigger = "phy0tpt"; + }; + }; + }; +}; \ No newline at end of file diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index d8641223a3a5e8..46c4b71afdbcc0 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -1397,7 +1397,7 @@ endif IMAGE/sysupgrade.bin := append-kernel | inteno-bootfs | \ sysupgrade-tar kernel=$$$$@ | check-size | append-metadata DEVICE_IMG_NAME = $$(DEVICE_IMG_PREFIX)-$$(2) - DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615-firmware kmod-usb3 + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615-firmware kmod-usb3 kmod-keyboard-sx951x kmod-button-hotplug endef define Device/genexis_pulse-ex400 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 d9ac110fbee2d1..5d92006d66290c 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 @@ -59,6 +59,7 @@ belkin,rt1800) ucidef_set_led_netdev "wan" "wan" "white:wan" "wan" ;; confiabits,mt7621-v1|\ +genexis,pulse-ex400|\ netis,n6) ucidef_set_led_netdev "wan" "wan" "green:wan" "wan" "link tx rx" ;; From 6adcb5d75c5a12926432220f217e11391cd6fc52 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Tue, 6 May 2025 18:23:50 +0200 Subject: [PATCH 663/877] ramips: use i2c-gpio driver for EX400 Configure the i2c pins as GPIO outputs and use the i2c-gpio driver to control the Semtech SX9512 touch controller. This fixes spurious errors in i2c transactions even at 1kHz with the native i2c driver. leds green:wan: Setting an LED's brightness failed (-6) Signed-off-by: David Bauer (cherry picked from commit f828be4d10d795e2bd74ea77ea12dec285107974) --- .../dts/mt7621_genexis_pulse-ex400-common.dtsi | 17 +++++++++++++++-- .../ramips/dts/mt7621_genexis_pulse-ex400.dts | 4 +--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_genexis_pulse-ex400-common.dtsi b/target/linux/ramips/dts/mt7621_genexis_pulse-ex400-common.dtsi index a3bc70e8cefed6..ebcf558359b426 100644 --- a/target/linux/ramips/dts/mt7621_genexis_pulse-ex400-common.dtsi +++ b/target/linux/ramips/dts/mt7621_genexis_pulse-ex400-common.dtsi @@ -41,6 +41,18 @@ gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; }; }; + + i2c_gpio: i2c-gpio { + compatible = "i2c-gpio"; + + sda-gpios = <&gpio 3 GPIO_ACTIVE_HIGH>; + scl-gpios = <&gpio 4 GPIO_ACTIVE_HIGH>; + + i2c-gpio,delay-us = <50>; + i2c-gpio,timeout-ms = <100>; + + /* Semtech SX9512 */ + }; }; &pcie { @@ -92,7 +104,8 @@ }; &i2c { - status = "okay"; + /* Uses i2c-gpio */ + status = "disabled"; }; ðphy0 { @@ -101,7 +114,7 @@ &state_default { gpio { - groups = "uart2", "uart3"; + groups = "i2c", "uart2", "uart3"; function = "gpio"; }; }; diff --git a/target/linux/ramips/dts/mt7621_genexis_pulse-ex400.dts b/target/linux/ramips/dts/mt7621_genexis_pulse-ex400.dts index 61b3e869d7e154..ad8a22ad79d369 100644 --- a/target/linux/ramips/dts/mt7621_genexis_pulse-ex400.dts +++ b/target/linux/ramips/dts/mt7621_genexis_pulse-ex400.dts @@ -22,9 +22,7 @@ }; }; -&i2c { - clock-frequency = <1000>; - +&i2c_gpio { touch@2b { compatible = "semtech,sx9512"; From d71e6920fa22a670fdfb76dcd6165c0f3d2d2c2a Mon Sep 17 00:00:00 2001 From: Christoph Krapp Date: Mon, 12 May 2025 21:19:27 +0200 Subject: [PATCH 664/877] mediatek: filogic: fix wifi on ASUS RT-AX52 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add missing kmod-7915e package to get both wireless interfaces working. Link: https://github.com/openwrt/openwrt/issues/18690 Reviewed-by: Steffen Förster Signed-off-by: Christoph Krapp (cherry picked from commit 0d6ba33181ef8846f1259e51ddc79115a4a0def4) --- 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 9aa0cf9c04bb35..129193138a118c 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -268,7 +268,7 @@ define Device/asus_rt-ax52 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 + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef TARGET_DEVICES += asus_rt-ax52 From 65906202fccc45adb77f4879fd8d36be6d7578b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Wed, 14 May 2025 09:45:24 +0200 Subject: [PATCH 665/877] bmips: add missing NAND config symbol MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bcm6328, bcm6362 and bcm6368 targets are missing a key config symbol which prevents the NAND from working. Fixes: f6c02b014d9c ("bmips: 6.1: refresh config and add missing symbols") Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 61da745817f28673b193d60bb4bc5b76dd215246) --- target/linux/bmips/bcm6328/config-6.6 | 1 + target/linux/bmips/bcm6362/config-6.6 | 1 + target/linux/bmips/bcm6368/config-6.6 | 1 + 3 files changed, 3 insertions(+) diff --git a/target/linux/bmips/bcm6328/config-6.6 b/target/linux/bmips/bcm6328/config-6.6 index c069c11d9bfa82..741159b6d6ee8d 100644 --- a/target/linux/bmips/bcm6328/config-6.6 +++ b/target/linux/bmips/bcm6328/config-6.6 @@ -164,6 +164,7 @@ CONFIG_MTD_CFI_BE_BYTE_SWAP=y CONFIG_MTD_CFI_STAA=y CONFIG_MTD_JEDECPROBE=y CONFIG_MTD_NAND_BRCMNAND=y +CONFIG_MTD_NAND_BRCMNAND_BCM63XX=y CONFIG_MTD_NAND_CORE=y CONFIG_MTD_NAND_ECC=y CONFIG_MTD_NAND_ECC_SW_HAMMING=y diff --git a/target/linux/bmips/bcm6362/config-6.6 b/target/linux/bmips/bcm6362/config-6.6 index 5e6a936ab1b702..6c05f4072781c9 100644 --- a/target/linux/bmips/bcm6362/config-6.6 +++ b/target/linux/bmips/bcm6362/config-6.6 @@ -166,6 +166,7 @@ CONFIG_MTD_CFI_BE_BYTE_SWAP=y CONFIG_MTD_CFI_STAA=y CONFIG_MTD_JEDECPROBE=y CONFIG_MTD_NAND_BRCMNAND=y +CONFIG_MTD_NAND_BRCMNAND_BCM63XX=y CONFIG_MTD_NAND_CORE=y CONFIG_MTD_NAND_ECC=y CONFIG_MTD_NAND_ECC_SW_HAMMING=y diff --git a/target/linux/bmips/bcm6368/config-6.6 b/target/linux/bmips/bcm6368/config-6.6 index e214d9a0f15f05..eda05386028094 100644 --- a/target/linux/bmips/bcm6368/config-6.6 +++ b/target/linux/bmips/bcm6368/config-6.6 @@ -165,6 +165,7 @@ CONFIG_MTD_CFI_BE_BYTE_SWAP=y CONFIG_MTD_CFI_STAA=y CONFIG_MTD_JEDECPROBE=y CONFIG_MTD_NAND_BRCMNAND=y +CONFIG_MTD_NAND_BRCMNAND_BCM63XX=y CONFIG_MTD_NAND_CORE=y CONFIG_MTD_NAND_ECC=y CONFIG_MTD_NAND_ECC_SW_HAMMING=y From 2bcc3163a6ea02919e699d0562032d821341fabb Mon Sep 17 00:00:00 2001 From: David Bauer Date: Wed, 14 May 2025 01:49:44 +0200 Subject: [PATCH 666/877] ramips: pad EX400 kernel partition to retain web recovery The web-recovery of the Genexis EX400 validates uploaded images to fit in the rootf_0 partition. With OpenWrt, only the kernel is stored in this partition, leaving the partition very small. Currently, the first factory release image won't be accepted by the recovery interface after the OpenWrt installation. Pad the image of the ubifs to 10MB. This allows the 24.10 release image to be uploaded, enabling device recovery. Signed-off-by: David Bauer (cherry picked from commit eea4689654e1b07cffe62bc97ad8fef0474bb3b7) --- 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 46c4b71afdbcc0..95bb8fc86767fd 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -1394,7 +1394,7 @@ ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) IMAGE/factory.bin := append-image-stage initramfs-kernel.bin | \ inteno-bootfs | inteno-y3-header EX400 | append-md5sum-ascii-salted endif - IMAGE/sysupgrade.bin := append-kernel | inteno-bootfs | \ + IMAGE/sysupgrade.bin := append-kernel | inteno-bootfs | pad-to 10M | \ sysupgrade-tar kernel=$$$$@ | check-size | append-metadata DEVICE_IMG_NAME = $$(DEVICE_IMG_PREFIX)-$$(2) DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615-firmware kmod-usb3 kmod-keyboard-sx951x kmod-button-hotplug From ba37852951743f0348b89a6172d30179fa138b04 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 15 May 2025 15:41:37 +0200 Subject: [PATCH 667/877] kernel: fix warning on retrying page pool release Fixes the following warning: [ 180.314652] NOHZ tick-stop error: local softirq work is pending, handler #08!!! Signed-off-by: Felix Fietkau (cherry picked from commit 610dd871aa59baef063cdc79bf57be92a0c45474) --- ..._pool-try-to-free-deferred-skbs-while-waitin.patch | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/target/linux/generic/hack-6.6/610-net-page_pool-try-to-free-deferred-skbs-while-waitin.patch b/target/linux/generic/hack-6.6/610-net-page_pool-try-to-free-deferred-skbs-while-waitin.patch index 85cd79f1a9ddd1..cfe35bc51a7ebf 100644 --- a/target/linux/generic/hack-6.6/610-net-page_pool-try-to-free-deferred-skbs-while-waitin.patch +++ b/target/linux/generic/hack-6.6/610-net-page_pool-try-to-free-deferred-skbs-while-waitin.patch @@ -16,16 +16,17 @@ Signed-off-by: Felix Fietkau --- a/net/core/page_pool.c +++ b/net/core/page_pool.c -@@ -873,7 +873,7 @@ static void page_pool_release_retry(stru +@@ -873,7 +873,8 @@ static void page_pool_release_retry(stru { struct delayed_work *dwq = to_delayed_work(wq); struct page_pool *pool = container_of(dwq, typeof(*pool), release_dw); - int inflight; ++ unsigned long flags; + int cpu, inflight; inflight = page_pool_release(pool); /* In rare cases, a driver bug may cause inflight to go negative. -@@ -885,6 +885,17 @@ static void page_pool_release_retry(stru +@@ -885,6 +886,21 @@ static void page_pool_release_retry(stru if (inflight <= 0) return; @@ -33,12 +34,16 @@ Signed-off-by: Felix Fietkau + * defer_list that can stay in the list until we have enough queued + * traffic. + */ ++ local_irq_save(flags); + for_each_online_cpu(cpu) { + struct softnet_data *sd = &per_cpu(softnet_data, cpu); + -+ if (!cmpxchg(&sd->defer_ipi_scheduled, 0, 1)) ++ if (cpu == raw_smp_processor_id()) ++ raise_softirq_irqoff(NET_RX_SOFTIRQ); ++ else if (!cmpxchg(&sd->defer_ipi_scheduled, 0, 1)) + smp_call_function_single_async(cpu, &sd->defer_csd); + } ++ local_irq_restore(flags); + /* Periodic warning */ if (time_after_eq(jiffies, pool->defer_warn)) { From d2d9b1eaeb4268fa869d8e8766f92ee4f6e9eba9 Mon Sep 17 00:00:00 2001 From: Henry Tung Date: Sun, 4 May 2025 11:29:54 -0700 Subject: [PATCH 668/877] mac80211: ath11k: fix broadcast failures during GTK rekeying Revert key_cipher change to NONE when clearing key. Setting to NONE triggers asserts in the firmware and causes broadcast drops with ath11k firmware 2.9.0.1, so until a future blob fixes this, revert this as a workaround. Imported from https://git.codelinaro.org/clo/qsdk/oss/system/feeds/wlan-open/-/blob/win.wlan_host_opensource.3.0.r24/patches/ath11k/350-ath11k-Revert-clear-the-keys-properly-when-DISABLE_K.patch Related discussion links: - https://github.com/openwrt/openwrt/issues/9555 - https://lore.kernel.org/linux-wireless/Z2Q9POuV-6MIdzRf@pilgrim/T/#t Signed-off-by: Henry Tung Link: https://github.com/openwrt/openwrt/pull/18705 Signed-off-by: Robert Marko (cherry picked from commit 94e04a4513b6697160a852ee353e57647560bdca) Link: https://github.com/openwrt/openwrt/pull/18754 Signed-off-by: Hauke Mehrtens --- ...ear-the-keys-properly-when-DISABLE_K.patch | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 package/kernel/mac80211/patches/ath11k/940-ath11k-Revert-clear-the-keys-properly-when-DISABLE_K.patch diff --git a/package/kernel/mac80211/patches/ath11k/940-ath11k-Revert-clear-the-keys-properly-when-DISABLE_K.patch b/package/kernel/mac80211/patches/ath11k/940-ath11k-Revert-clear-the-keys-properly-when-DISABLE_K.patch new file mode 100644 index 00000000000000..ec2dc222b66053 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/940-ath11k-Revert-clear-the-keys-properly-when-DISABLE_K.patch @@ -0,0 +1,48 @@ +From 52393e2ae12f18fb1a60578c24c46ebab292ddb6 Mon Sep 17 00:00:00 2001 +From: Rameshkumar Sundaram +Date: Mon, 28 Mar 2022 13:21:04 +0530 +Subject: [PATCH] ath11k: Revert: clear the keys properly when DISABLE_KEY +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Reverting the Upstream clear key change added as a part of +436a4e886598 ("ath11k: clear the keys properly +when DISABLE_KEY") +This change exposed a race in WLAN Firmware where target asserts +are seen frequently due FW not synchronizing ath11k host’s clear +key commands(CIPHER changes to NONE) with frames in TX queue. +Hence reverting this change untill FW fixes to synchronize +ath11k host’s clear key command are available. + +Signed-off-by: Rameshkumar Sundaram +--- + drivers/net/wireless/ath/ath11k/mac.c | 4 +++- + drivers/net/wireless/ath/ath11k/wmi.c | 3 +-- + 2 files changed, 4 insertions(+), 3 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -4222,7 +4222,9 @@ static int ath11k_install_key(struct ath + return 0; + + if (cmd == DISABLE_KEY) { +- arg.key_cipher = WMI_CIPHER_NONE; ++ /* TODO: Check if FW expects value other than NONE for del */ ++ /* arg.key_cipher = WMI_CIPHER_NONE; */ ++ arg.key_len = 0; + arg.key_data = NULL; + goto install; + } +--- a/drivers/net/wireless/ath/ath11k/wmi.c ++++ b/drivers/net/wireless/ath/ath11k/wmi.c +@@ -1854,8 +1854,7 @@ int ath11k_wmi_vdev_install_key(struct a + tlv = (struct wmi_tlv *)(skb->data + sizeof(*cmd)); + tlv->header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_ARRAY_BYTE) | + FIELD_PREP(WMI_TLV_LEN, key_len_aligned); +- if (arg->key_data) +- memcpy(tlv->value, (u8 *)arg->key_data, key_len_aligned); ++ memcpy(tlv->value, (u8 *)arg->key_data, key_len_aligned); + + ret = ath11k_wmi_cmd_send(wmi, skb, WMI_VDEV_INSTALL_KEY_CMDID); + if (ret) { From 6d4554429acbf992111d1dbe8456f68af40cf258 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Fri, 16 May 2025 13:18:46 +0200 Subject: [PATCH 669/877] image: respect DEFAULT and BROKEN when Default profile is selected Currently, when you select the Default profile it does not honor DEFAULT:=n nor BROKEN:=y in device profiles but rather just tries to build all of them. This may work when building directly, but when using Image Builder it will always fail since no kernel or anything else is present for devices that have DEFAULT:=n or BROKEN:=Y set since those are skipped during build. So, lets look for DEFAULT being set to "n" or BROKEN being set to "y" and then remove clear _PROFILE_SET so they dont end up being marked for installation. Fixes: #18410 Link: https://github.com/openwrt/openwrt/pull/18814 Signed-off-by: Robert Marko (cherry picked from commit f060615a78e5c5e86829b2e40c3f77e5cf7033bf) --- include/image.mk | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/image.mk b/include/image.mk index 9a4dff2167a14f..c1d71f1cc4db02 100644 --- a/include/image.mk +++ b/include/image.mk @@ -569,6 +569,13 @@ endef define Device/Check/Common _PROFILE_SET = $$(strip $$(foreach profile,$$(PROFILES) DEVICE_$(1),$$(call DEVICE_CHECK_PROFILE,$$(profile)))) + # Check if device is disabled and if so do not mark to be installed + ifeq ($$(DEFAULT),n) + _PROFILE_SET := + endif + ifeq ($$(BROKEN),y) + _PROFILE_SET := + endif DEVICE_PACKAGES += $$(call extra_packages,$$(DEVICE_PACKAGES)) ifdef TARGET_PER_DEVICE_ROOTFS $$(eval $$(call merge_packages,_PACKAGES,$$(DEVICE_PACKAGES) $$(call DEVICE_EXTRA_PACKAGES,$(1)))) From a53d1758656f3f9392a3a025f7f2e455ecff50d4 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 2 Apr 2025 23:36:28 +0800 Subject: [PATCH 670/877] generic: crypto: fix jitterentropy initialization failed issue Sync jitterentropy source code with linux-6.12 to solve the issue of jitterentropy initialization failed: [ 9.523489] jitterentropy: Initialization failed with host not compliant with requirements: 9 [ 9.661916] kmodloader: 1 module could not be probed [ 9.662377] kmodloader: - jitterentropy_rng - 0 In linux upstream commit cf27d9475f37 ("crypto: jitter - use permanent health test storage"), when FIPS crypto is disabled, the health test results are always explicitly skipped. That means it will never return error code 9 (health test failed) again. Fixes: https://github.com/openwrt/openwrt/issues/16684 Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/18399 (cherry picked from commit eec11fbbb6eb70cfcae27ac6c055d2c1bd5d20d9) Link: https://github.com/openwrt/openwrt/pull/18822 Signed-off-by: Robert Marko --- ...dd-RCTAPT-support-for-different-OSRs.patch | 445 ++++++++++++++++++ ...r-Allow-configuration-of-memory-size.patch | 159 +++++++ ...w-configuration-of-oversampling-rate.patch | 75 +++ ...er-reuse-allocated-entropy-collector.patch | 117 +++++ ...er-use-permanent-health-test-storage.patch | 242 ++++++++++ ...-Hide-esoteric-Kconfig-options-under.patch | 80 ++++ ...e-kvfree_sensitive-to-fix-Coccinelle.patch | 30 ++ ...2-crypto-jitter-set-default-OSR-to-3.patch | 36 ++ 8 files changed, 1184 insertions(+) create mode 100644 target/linux/generic/backport-6.6/906-01-v6.7-crypto-jitter-add-RCTAPT-support-for-different-OSRs.patch create mode 100644 target/linux/generic/backport-6.6/906-02-v6.7-crypto-jitter-Allow-configuration-of-memory-size.patch create mode 100644 target/linux/generic/backport-6.6/906-03-v6.7-crypto-jitter-Allow-configuration-of-oversampling-rate.patch create mode 100644 target/linux/generic/backport-6.6/906-04-v6.7-crypto-jitter-reuse-allocated-entropy-collector.patch create mode 100644 target/linux/generic/backport-6.6/906-05-v6.7-crypto-jitter-use-permanent-health-test-storage.patch create mode 100644 target/linux/generic/backport-6.6/906-06-v6.7-crypto-jitterentropy-Hide-esoteric-Kconfig-options-under.patch create mode 100644 target/linux/generic/backport-6.6/906-07-v6.10-crypto-jitter-Use-kvfree_sensitive-to-fix-Coccinelle.patch create mode 100644 target/linux/generic/backport-6.6/906-08-v6.12-crypto-jitter-set-default-OSR-to-3.patch diff --git a/target/linux/generic/backport-6.6/906-01-v6.7-crypto-jitter-add-RCTAPT-support-for-different-OSRs.patch b/target/linux/generic/backport-6.6/906-01-v6.7-crypto-jitter-add-RCTAPT-support-for-different-OSRs.patch new file mode 100644 index 00000000000000..d0ae1258f86d23 --- /dev/null +++ b/target/linux/generic/backport-6.6/906-01-v6.7-crypto-jitter-add-RCTAPT-support-for-different-OSRs.patch @@ -0,0 +1,445 @@ +From 04597c8dd6c4b55e946fec50dc3b14a5d9d54501 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Stephan=20M=C3=BCller?= +Date: Thu, 21 Sep 2023 13:48:11 +0200 +Subject: [PATCH] crypto: jitter - add RCT/APT support for different OSRs + +The oversampling rate (OSR) value specifies the heuristically implied +entropy in the recorded data - H_submitter = 1/osr. A different entropy +estimate implies a different APT/RCT cutoff value. This change adds +support for OSRs 1 through 15. This OSR can be selected by the caller +of the Jitter RNG. + +For this patch, the caller still uses one hard-coded OSR. A subsequent +patch allows this value to be configured. + +In addition, the power-up self test is adjusted as follows: + +* It allows the caller to provide an oversampling rate that should be +tested with - commonly it should be the same as used for the actual +runtime operation. This makes the power-up testing therefore consistent +with the runtime operation. + +* It calls now jent_measure_jitter (i.e. collects the full entropy +that can possibly be harvested by the Jitter RNG) instead of only +jent_condition_data (which only returns the entropy harvested from +the conditioning component). This should now alleviate reports where +the Jitter RNG initialization thinks there is too little entropy. + +* The power-up test now solely relies on the (enhanced) APT and RCT +test that is used as a health test at runtime. + +The code allowing the different OSRs as well as the power-up test +changes are present in the user space version of the Jitter RNG 3.4.1 +and thus was already in production use for some time. + +Reported-by "Ospan, Abylay" +Signed-off-by: Stephan Mueller +Signed-off-by: Herbert Xu +--- + crypto/jitterentropy-kcapi.c | 4 +- + crypto/jitterentropy.c | 233 ++++++++++++++++++----------------- + crypto/jitterentropy.h | 3 +- + 3 files changed, 123 insertions(+), 117 deletions(-) + +--- a/crypto/jitterentropy-kcapi.c ++++ b/crypto/jitterentropy-kcapi.c +@@ -245,7 +245,7 @@ static int jent_kcapi_init(struct crypto + crypto_shash_init(sdesc); + rng->sdesc = sdesc; + +- rng->entropy_collector = jent_entropy_collector_alloc(1, 0, sdesc); ++ rng->entropy_collector = jent_entropy_collector_alloc(0, 0, sdesc); + if (!rng->entropy_collector) { + ret = -ENOMEM; + goto err; +@@ -334,7 +334,7 @@ static int __init jent_mod_init(void) + + desc->tfm = tfm; + crypto_shash_init(desc); +- ret = jent_entropy_init(desc); ++ ret = jent_entropy_init(0, 0, desc); + shash_desc_zero(desc); + crypto_free_shash(tfm); + if (ret) { +--- a/crypto/jitterentropy.c ++++ b/crypto/jitterentropy.c +@@ -72,6 +72,8 @@ struct rand_data { + __u64 prev_time; /* SENSITIVE Previous time stamp */ + __u64 last_delta; /* SENSITIVE stuck test */ + __s64 last_delta2; /* SENSITIVE stuck test */ ++ ++ unsigned int flags; /* Flags used to initialize */ + unsigned int osr; /* Oversample rate */ + #define JENT_MEMORY_BLOCKS 64 + #define JENT_MEMORY_BLOCKSIZE 32 +@@ -88,16 +90,9 @@ struct rand_data { + /* Repetition Count Test */ + unsigned int rct_count; /* Number of stuck values */ + +- /* Intermittent health test failure threshold of 2^-30 */ +- /* From an SP800-90B perspective, this RCT cutoff value is equal to 31. */ +- /* However, our RCT implementation starts at 1, so we subtract 1 here. */ +-#define JENT_RCT_CUTOFF (31 - 1) /* Taken from SP800-90B sec 4.4.1 */ +-#define JENT_APT_CUTOFF 325 /* Taken from SP800-90B sec 4.4.2 */ +- /* Permanent health test failure threshold of 2^-60 */ +- /* From an SP800-90B perspective, this RCT cutoff value is equal to 61. */ +- /* However, our RCT implementation starts at 1, so we subtract 1 here. */ +-#define JENT_RCT_CUTOFF_PERMANENT (61 - 1) +-#define JENT_APT_CUTOFF_PERMANENT 355 ++ /* Adaptive Proportion Test cutoff values */ ++ unsigned int apt_cutoff; /* Intermittent health test failure */ ++ unsigned int apt_cutoff_permanent; /* Permanent health test failure */ + #define JENT_APT_WINDOW_SIZE 512 /* Data window size */ + /* LSB of time stamp to process */ + #define JENT_APT_LSB 16 +@@ -122,6 +117,9 @@ struct rand_data { + * zero). */ + #define JENT_ESTUCK 8 /* Too many stuck results during init. */ + #define JENT_EHEALTH 9 /* Health test failed during initialization */ ++#define JENT_ERCT 10 /* RCT failed during initialization */ ++#define JENT_EHASH 11 /* Hash self test failed */ ++#define JENT_EMEM 12 /* Can't allocate memory for initialization */ + + /* + * The output n bits can receive more than n bits of min entropy, of course, +@@ -148,6 +146,48 @@ struct rand_data { + ***************************************************************************/ + + /* ++ * See the SP 800-90B comment #10b for the corrected cutoff for the SP 800-90B ++ * APT. ++ * http://www.untruth.org/~josh/sp80090b/UL%20SP800-90B-final%20comments%20v1.9%2020191212.pdf ++ * In in the syntax of R, this is C = 2 + qbinom(1 − 2^(−30), 511, 2^(-1/osr)). ++ * (The original formula wasn't correct because the first symbol must ++ * necessarily have been observed, so there is no chance of observing 0 of these ++ * symbols.) ++ * ++ * For the alpha < 2^-53, R cannot be used as it uses a float data type without ++ * arbitrary precision. A SageMath script is used to calculate those cutoff ++ * values. ++ * ++ * For any value above 14, this yields the maximal allowable value of 512 ++ * (by FIPS 140-2 IG 7.19 Resolution # 16, we cannot choose a cutoff value that ++ * renders the test unable to fail). ++ */ ++static const unsigned int jent_apt_cutoff_lookup[15] = { ++ 325, 422, 459, 477, 488, 494, 499, 502, ++ 505, 507, 508, 509, 510, 511, 512 }; ++static const unsigned int jent_apt_cutoff_permanent_lookup[15] = { ++ 355, 447, 479, 494, 502, 507, 510, 512, ++ 512, 512, 512, 512, 512, 512, 512 }; ++#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) ++ ++static void jent_apt_init(struct rand_data *ec, unsigned int osr) ++{ ++ /* ++ * Establish the apt_cutoff based on the presumed entropy rate of ++ * 1/osr. ++ */ ++ if (osr >= ARRAY_SIZE(jent_apt_cutoff_lookup)) { ++ ec->apt_cutoff = jent_apt_cutoff_lookup[ ++ ARRAY_SIZE(jent_apt_cutoff_lookup) - 1]; ++ ec->apt_cutoff_permanent = jent_apt_cutoff_permanent_lookup[ ++ ARRAY_SIZE(jent_apt_cutoff_permanent_lookup) - 1]; ++ } else { ++ ec->apt_cutoff = jent_apt_cutoff_lookup[osr - 1]; ++ ec->apt_cutoff_permanent = ++ jent_apt_cutoff_permanent_lookup[osr - 1]; ++ } ++} ++/* + * Reset the APT counter + * + * @ec [in] Reference to entropy collector +@@ -187,12 +227,12 @@ static void jent_apt_insert(struct rand_ + /* APT health test failure detection */ + static int jent_apt_permanent_failure(struct rand_data *ec) + { +- return (ec->apt_count >= JENT_APT_CUTOFF_PERMANENT) ? 1 : 0; ++ return (ec->apt_count >= ec->apt_cutoff_permanent) ? 1 : 0; + } + + static int jent_apt_failure(struct rand_data *ec) + { +- return (ec->apt_count >= JENT_APT_CUTOFF) ? 1 : 0; ++ return (ec->apt_count >= ec->apt_cutoff) ? 1 : 0; + } + + /*************************************************************************** +@@ -275,15 +315,28 @@ static int jent_stuck(struct rand_data * + return 0; + } + +-/* RCT health test failure detection */ ++/* ++ * The cutoff value is based on the following consideration: ++ * alpha = 2^-30 or 2^-60 as recommended in SP800-90B. ++ * In addition, we require an entropy value H of 1/osr as this is the minimum ++ * entropy required to provide full entropy. ++ * Note, we collect (DATA_SIZE_BITS + ENTROPY_SAFETY_FACTOR)*osr deltas for ++ * inserting them into the entropy pool which should then have (close to) ++ * DATA_SIZE_BITS bits of entropy in the conditioned output. ++ * ++ * Note, ec->rct_count (which equals to value B in the pseudo code of SP800-90B ++ * section 4.4.1) starts with zero. Hence we need to subtract one from the ++ * cutoff value as calculated following SP800-90B. Thus ++ * C = ceil(-log_2(alpha)/H) = 30*osr or 60*osr. ++ */ + static int jent_rct_permanent_failure(struct rand_data *ec) + { +- return (ec->rct_count >= JENT_RCT_CUTOFF_PERMANENT) ? 1 : 0; ++ return (ec->rct_count >= (60 * ec->osr)) ? 1 : 0; + } + + static int jent_rct_failure(struct rand_data *ec) + { +- return (ec->rct_count >= JENT_RCT_CUTOFF) ? 1 : 0; ++ return (ec->rct_count >= (30 * ec->osr)) ? 1 : 0; + } + + /* Report of health test failures */ +@@ -448,7 +501,7 @@ static void jent_memaccess(struct rand_d + * + * @return result of stuck test + */ +-static int jent_measure_jitter(struct rand_data *ec) ++static int jent_measure_jitter(struct rand_data *ec, __u64 *ret_current_delta) + { + __u64 time = 0; + __u64 current_delta = 0; +@@ -472,6 +525,10 @@ static int jent_measure_jitter(struct ra + if (jent_condition_data(ec, current_delta, stuck)) + stuck = 1; + ++ /* return the raw entropy value */ ++ if (ret_current_delta) ++ *ret_current_delta = current_delta; ++ + return stuck; + } + +@@ -489,11 +546,11 @@ static void jent_gen_entropy(struct rand + safety_factor = JENT_ENTROPY_SAFETY_FACTOR; + + /* priming of the ->prev_time value */ +- jent_measure_jitter(ec); ++ jent_measure_jitter(ec, NULL); + + while (!jent_health_failure(ec)) { + /* If a stuck measurement is received, repeat measurement */ +- if (jent_measure_jitter(ec)) ++ if (jent_measure_jitter(ec, NULL)) + continue; + + /* +@@ -554,7 +611,8 @@ int jent_read_entropy(struct rand_data * + * Perform startup health tests and return permanent + * error if it fails. + */ +- if (jent_entropy_init(ec->hash_state)) ++ if (jent_entropy_init(ec->osr, ec->flags, ++ ec->hash_state)) + return -3; + + return -2; +@@ -604,11 +662,15 @@ struct rand_data *jent_entropy_collector + + /* verify and set the oversampling rate */ + if (osr == 0) +- osr = 1; /* minimum sampling rate is 1 */ ++ osr = 1; /* H_submitter = 1 / osr */ + entropy_collector->osr = osr; ++ entropy_collector->flags = flags; + + entropy_collector->hash_state = hash_state; + ++ /* Initialize the APT */ ++ jent_apt_init(entropy_collector, osr); ++ + /* fill the data pad with non-zero values */ + jent_gen_entropy(entropy_collector); + +@@ -622,20 +684,14 @@ void jent_entropy_collector_free(struct + jent_zfree(entropy_collector); + } + +-int jent_entropy_init(void *hash_state) ++int jent_entropy_init(unsigned int osr, unsigned int flags, void *hash_state) + { +- int i; +- __u64 delta_sum = 0; +- __u64 old_delta = 0; +- unsigned int nonstuck = 0; +- int time_backwards = 0; +- int count_mod = 0; +- int count_stuck = 0; +- struct rand_data ec = { 0 }; +- +- /* Required for RCT */ +- ec.osr = 1; +- ec.hash_state = hash_state; ++ struct rand_data *ec; ++ int i, time_backwards = 0, ret = 0; ++ ++ ec = jent_entropy_collector_alloc(osr, flags, hash_state); ++ if (!ec) ++ return JENT_EMEM; + + /* We could perform statistical tests here, but the problem is + * that we only have a few loop counts to do testing. These +@@ -664,31 +720,28 @@ int jent_entropy_init(void *hash_state) + #define TESTLOOPCOUNT 1024 + #define CLEARCACHE 100 + for (i = 0; (TESTLOOPCOUNT + CLEARCACHE) > i; i++) { +- __u64 time = 0; +- __u64 time2 = 0; +- __u64 delta = 0; +- unsigned int lowdelta = 0; +- int stuck; ++ __u64 start_time = 0, end_time = 0, delta = 0; + + /* Invoke core entropy collection logic */ +- jent_get_nstime(&time); +- ec.prev_time = time; +- jent_condition_data(&ec, time, 0); +- jent_get_nstime(&time2); ++ jent_measure_jitter(ec, &delta); ++ end_time = ec->prev_time; ++ start_time = ec->prev_time - delta; + + /* test whether timer works */ +- if (!time || !time2) +- return JENT_ENOTIME; +- delta = jent_delta(time, time2); ++ if (!start_time || !end_time) { ++ ret = JENT_ENOTIME; ++ goto out; ++ } ++ + /* + * test whether timer is fine grained enough to provide + * delta even when called shortly after each other -- this + * implies that we also have a high resolution timer + */ +- if (!delta) +- return JENT_ECOARSETIME; +- +- stuck = jent_stuck(&ec, delta); ++ if (!delta || (end_time == start_time)) { ++ ret = JENT_ECOARSETIME; ++ goto out; ++ } + + /* + * up to here we did not modify any variable that will be +@@ -700,49 +753,9 @@ int jent_entropy_init(void *hash_state) + if (i < CLEARCACHE) + continue; + +- if (stuck) +- count_stuck++; +- else { +- nonstuck++; +- +- /* +- * Ensure that the APT succeeded. +- * +- * With the check below that count_stuck must be less +- * than 10% of the overall generated raw entropy values +- * it is guaranteed that the APT is invoked at +- * floor((TESTLOOPCOUNT * 0.9) / 64) == 14 times. +- */ +- if ((nonstuck % JENT_APT_WINDOW_SIZE) == 0) { +- jent_apt_reset(&ec, +- delta & JENT_APT_WORD_MASK); +- } +- } +- +- /* Validate health test result */ +- if (jent_health_failure(&ec)) +- return JENT_EHEALTH; +- + /* test whether we have an increasing timer */ +- if (!(time2 > time)) ++ if (!(end_time > start_time)) + time_backwards++; +- +- /* use 32 bit value to ensure compilation on 32 bit arches */ +- lowdelta = time2 - time; +- if (!(lowdelta % 100)) +- count_mod++; +- +- /* +- * ensure that we have a varying delta timer which is necessary +- * for the calculation of entropy -- perform this check +- * only after the first loop is executed as we need to prime +- * the old_data value +- */ +- if (delta > old_delta) +- delta_sum += (delta - old_delta); +- else +- delta_sum += (old_delta - delta); +- old_delta = delta; + } + + /* +@@ -752,31 +765,23 @@ int jent_entropy_init(void *hash_state) + * should not fail. The value of 3 should cover the NTP case being + * performed during our test run. + */ +- if (time_backwards > 3) +- return JENT_ENOMONOTONIC; +- +- /* +- * Variations of deltas of time must on average be larger +- * than 1 to ensure the entropy estimation +- * implied with 1 is preserved +- */ +- if ((delta_sum) <= 1) +- return JENT_EVARVAR; ++ if (time_backwards > 3) { ++ ret = JENT_ENOMONOTONIC; ++ goto out; ++ } + +- /* +- * Ensure that we have variations in the time stamp below 10 for at +- * least 10% of all checks -- on some platforms, the counter increments +- * in multiples of 100, but not always +- */ +- if ((TESTLOOPCOUNT/10 * 9) < count_mod) +- return JENT_ECOARSETIME; ++ /* Did we encounter a health test failure? */ ++ if (jent_rct_failure(ec)) { ++ ret = JENT_ERCT; ++ goto out; ++ } ++ if (jent_apt_failure(ec)) { ++ ret = JENT_EHEALTH; ++ goto out; ++ } + +- /* +- * If we have more than 90% stuck results, then this Jitter RNG is +- * likely to not work well. +- */ +- if ((TESTLOOPCOUNT/10 * 9) < count_stuck) +- return JENT_ESTUCK; ++out: ++ jent_entropy_collector_free(ec); + +- return 0; ++ return ret; + } +--- a/crypto/jitterentropy.h ++++ b/crypto/jitterentropy.h +@@ -9,7 +9,8 @@ extern int jent_hash_time(void *hash_sta + int jent_read_random_block(void *hash_state, char *dst, unsigned int dst_len); + + struct rand_data; +-extern int jent_entropy_init(void *hash_state); ++extern int jent_entropy_init(unsigned int osr, unsigned int flags, ++ void *hash_state); + extern int jent_read_entropy(struct rand_data *ec, unsigned char *data, + unsigned int len); + diff --git a/target/linux/generic/backport-6.6/906-02-v6.7-crypto-jitter-Allow-configuration-of-memory-size.patch b/target/linux/generic/backport-6.6/906-02-v6.7-crypto-jitter-Allow-configuration-of-memory-size.patch new file mode 100644 index 00000000000000..b13fc867012b5e --- /dev/null +++ b/target/linux/generic/backport-6.6/906-02-v6.7-crypto-jitter-Allow-configuration-of-memory-size.patch @@ -0,0 +1,159 @@ +From 59bcfd788552504606e3eb774ae68052379396b6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Stephan=20M=C3=BCller?= +Date: Thu, 21 Sep 2023 13:48:33 +0200 +Subject: [PATCH] crypto: jitter - Allow configuration of memory size + +The memory size consumed by the Jitter RNG is one contributing factor in +the amount of entropy that is gathered. As the amount of entropy +directly correlates with the distance of the memory from the CPU, the +caches that are possibly present on a given system have an impact on the +collected entropy. + +Thus, the kernel compile time should offer a means to configure the +amount of memory used by the Jitter RNG. Although this option could be +turned into a runtime option (e.g. a kernel command line option), it +should remain a compile time option as otherwise adminsitrators who may +not have performed an entropy assessment may select a value that is +inappropriate. + +The default value selected by the configuration is identical to the +current Jitter RNG value. Thus, the patch should not lead to any change +in the Jitter RNG behavior. + +To accommodate larger memory buffers, kvzalloc / kvfree is used. + +Signed-off-by: Stephan Mueller +Signed-off-by: Herbert Xu +--- + crypto/Kconfig | 43 ++++++++++++++++++++++++++++++++++++ + crypto/jitterentropy-kcapi.c | 11 +++++++++ + crypto/jitterentropy.c | 16 ++++++++------ + crypto/jitterentropy.h | 2 ++ + 4 files changed, 65 insertions(+), 7 deletions(-) + +--- a/crypto/Kconfig ++++ b/crypto/Kconfig +@@ -1297,6 +1297,49 @@ config CRYPTO_JITTERENTROPY + + See https://www.chronox.de/jent/ + ++choice ++ prompt "CPU Jitter RNG Memory Size" ++ default CRYPTO_JITTERENTROPY_MEMSIZE_2 ++ depends on CRYPTO_JITTERENTROPY ++ help ++ The Jitter RNG measures the execution time of memory accesses. ++ Multiple consecutive memory accesses are performed. If the memory ++ size fits into a cache (e.g. L1), only the memory access timing ++ to that cache is measured. The closer the cache is to the CPU ++ the less variations are measured and thus the less entropy is ++ obtained. Thus, if the memory size fits into the L1 cache, the ++ obtained entropy is less than if the memory size fits within ++ L1 + L2, which in turn is less if the memory fits into ++ L1 + L2 + L3. Thus, by selecting a different memory size, ++ the entropy rate produced by the Jitter RNG can be modified. ++ ++ config CRYPTO_JITTERENTROPY_MEMSIZE_2 ++ bool "2048 Bytes (default)" ++ ++ config CRYPTO_JITTERENTROPY_MEMSIZE_128 ++ bool "128 kBytes" ++ ++ config CRYPTO_JITTERENTROPY_MEMSIZE_1024 ++ bool "1024 kBytes" ++ ++ config CRYPTO_JITTERENTROPY_MEMSIZE_8192 ++ bool "8192 kBytes" ++endchoice ++ ++config CRYPTO_JITTERENTROPY_MEMORY_BLOCKS ++ int ++ default 64 if CRYPTO_JITTERENTROPY_MEMSIZE_2 ++ default 512 if CRYPTO_JITTERENTROPY_MEMSIZE_128 ++ default 1024 if CRYPTO_JITTERENTROPY_MEMSIZE_1024 ++ default 4096 if CRYPTO_JITTERENTROPY_MEMSIZE_8192 ++ ++config CRYPTO_JITTERENTROPY_MEMORY_BLOCKSIZE ++ int ++ default 32 if CRYPTO_JITTERENTROPY_MEMSIZE_2 ++ default 256 if CRYPTO_JITTERENTROPY_MEMSIZE_128 ++ default 1024 if CRYPTO_JITTERENTROPY_MEMSIZE_1024 ++ default 2048 if CRYPTO_JITTERENTROPY_MEMSIZE_8192 ++ + config CRYPTO_JITTERENTROPY_TESTINTERFACE + bool "CPU Jitter RNG Test Interface" + depends on CRYPTO_JITTERENTROPY +--- a/crypto/jitterentropy-kcapi.c ++++ b/crypto/jitterentropy-kcapi.c +@@ -54,6 +54,17 @@ + * Helper function + ***************************************************************************/ + ++void *jent_kvzalloc(unsigned int len) ++{ ++ return kvzalloc(len, GFP_KERNEL); ++} ++ ++void jent_kvzfree(void *ptr, unsigned int len) ++{ ++ memzero_explicit(ptr, len); ++ kvfree(ptr); ++} ++ + void *jent_zalloc(unsigned int len) + { + return kzalloc(len, GFP_KERNEL); +--- a/crypto/jitterentropy.c ++++ b/crypto/jitterentropy.c +@@ -75,10 +75,10 @@ struct rand_data { + + unsigned int flags; /* Flags used to initialize */ + unsigned int osr; /* Oversample rate */ +-#define JENT_MEMORY_BLOCKS 64 +-#define JENT_MEMORY_BLOCKSIZE 32 + #define JENT_MEMORY_ACCESSLOOPS 128 +-#define JENT_MEMORY_SIZE (JENT_MEMORY_BLOCKS*JENT_MEMORY_BLOCKSIZE) ++#define JENT_MEMORY_SIZE \ ++ (CONFIG_CRYPTO_JITTERENTROPY_MEMORY_BLOCKS * \ ++ CONFIG_CRYPTO_JITTERENTROPY_MEMORY_BLOCKSIZE) + unsigned char *mem; /* Memory access location with size of + * memblocks * memblocksize */ + unsigned int memlocation; /* Pointer to byte in *mem */ +@@ -650,13 +650,15 @@ struct rand_data *jent_entropy_collector + /* Allocate memory for adding variations based on memory + * access + */ +- entropy_collector->mem = jent_zalloc(JENT_MEMORY_SIZE); ++ entropy_collector->mem = jent_kvzalloc(JENT_MEMORY_SIZE); + if (!entropy_collector->mem) { + jent_zfree(entropy_collector); + return NULL; + } +- entropy_collector->memblocksize = JENT_MEMORY_BLOCKSIZE; +- entropy_collector->memblocks = JENT_MEMORY_BLOCKS; ++ entropy_collector->memblocksize = ++ CONFIG_CRYPTO_JITTERENTROPY_MEMORY_BLOCKSIZE; ++ entropy_collector->memblocks = ++ CONFIG_CRYPTO_JITTERENTROPY_MEMORY_BLOCKS; + entropy_collector->memaccessloops = JENT_MEMORY_ACCESSLOOPS; + } + +@@ -679,7 +681,7 @@ struct rand_data *jent_entropy_collector + + void jent_entropy_collector_free(struct rand_data *entropy_collector) + { +- jent_zfree(entropy_collector->mem); ++ jent_kvzfree(entropy_collector->mem, JENT_MEMORY_SIZE); + entropy_collector->mem = NULL; + jent_zfree(entropy_collector); + } +--- a/crypto/jitterentropy.h ++++ b/crypto/jitterentropy.h +@@ -1,5 +1,7 @@ + // SPDX-License-Identifier: GPL-2.0-or-later + ++extern void *jent_kvzalloc(unsigned int len); ++extern void jent_kvzfree(void *ptr, unsigned int len); + extern void *jent_zalloc(unsigned int len); + extern void jent_zfree(void *ptr); + extern void jent_get_nstime(__u64 *out); diff --git a/target/linux/generic/backport-6.6/906-03-v6.7-crypto-jitter-Allow-configuration-of-oversampling-rate.patch b/target/linux/generic/backport-6.6/906-03-v6.7-crypto-jitter-Allow-configuration-of-oversampling-rate.patch new file mode 100644 index 00000000000000..856400fce95099 --- /dev/null +++ b/target/linux/generic/backport-6.6/906-03-v6.7-crypto-jitter-Allow-configuration-of-oversampling-rate.patch @@ -0,0 +1,75 @@ +From 0baa8fab334a4d7017235b72fa8a547433572109 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Stephan=20M=C3=BCller?= +Date: Thu, 21 Sep 2023 13:48:59 +0200 +Subject: [PATCH] crypto: jitter - Allow configuration of oversampling rate + +The oversampling rate used by the Jitter RNG allows the configuration of +the heuristically implied entropy in one timing measurement. This +entropy rate is (1 / OSR) bits of entropy per time stamp. + +Considering that the Jitter RNG now support APT/RCT health tests for +different OSRs, allow this value to be configured at compile time to +support systems with limited amount of entropy in their timer. + +The allowed range of OSR values complies with the APT/RCT cutoff health +test values which range from 1 through 15. + +The default value of the OSR selection support is left at 1 which is the +current default. Thus, the addition of the configuration support does +not alter the default Jitter RNG behavior. + +Signed-off-by: Stephan Mueller +Signed-off-by: Herbert Xu +--- + crypto/Kconfig | 17 +++++++++++++++++ + crypto/jitterentropy-kcapi.c | 6 ++++-- + 2 files changed, 21 insertions(+), 2 deletions(-) + +--- a/crypto/Kconfig ++++ b/crypto/Kconfig +@@ -1340,6 +1340,23 @@ config CRYPTO_JITTERENTROPY_MEMORY_BLOCK + default 1024 if CRYPTO_JITTERENTROPY_MEMSIZE_1024 + default 2048 if CRYPTO_JITTERENTROPY_MEMSIZE_8192 + ++config CRYPTO_JITTERENTROPY_OSR ++ int "CPU Jitter RNG Oversampling Rate" ++ range 1 15 ++ default 1 ++ depends on CRYPTO_JITTERENTROPY ++ help ++ The Jitter RNG allows the specification of an oversampling rate (OSR). ++ The Jitter RNG operation requires a fixed amount of timing ++ measurements to produce one output block of random numbers. The ++ OSR value is multiplied with the amount of timing measurements to ++ generate one output block. Thus, the timing measurement is oversampled ++ by the OSR factor. The oversampling allows the Jitter RNG to operate ++ on hardware whose timers deliver limited amount of entropy (e.g. ++ the timer is coarse) by setting the OSR to a higher value. The ++ trade-off, however, is that the Jitter RNG now requires more time ++ to generate random numbers. ++ + config CRYPTO_JITTERENTROPY_TESTINTERFACE + bool "CPU Jitter RNG Test Interface" + depends on CRYPTO_JITTERENTROPY +--- a/crypto/jitterentropy-kcapi.c ++++ b/crypto/jitterentropy-kcapi.c +@@ -256,7 +256,9 @@ static int jent_kcapi_init(struct crypto + crypto_shash_init(sdesc); + rng->sdesc = sdesc; + +- rng->entropy_collector = jent_entropy_collector_alloc(0, 0, sdesc); ++ rng->entropy_collector = ++ jent_entropy_collector_alloc(CONFIG_CRYPTO_JITTERENTROPY_OSR, 0, ++ sdesc); + if (!rng->entropy_collector) { + ret = -ENOMEM; + goto err; +@@ -345,7 +347,7 @@ static int __init jent_mod_init(void) + + desc->tfm = tfm; + crypto_shash_init(desc); +- ret = jent_entropy_init(0, 0, desc); ++ ret = jent_entropy_init(CONFIG_CRYPTO_JITTERENTROPY_OSR, 0, desc); + shash_desc_zero(desc); + crypto_free_shash(tfm); + if (ret) { diff --git a/target/linux/generic/backport-6.6/906-04-v6.7-crypto-jitter-reuse-allocated-entropy-collector.patch b/target/linux/generic/backport-6.6/906-04-v6.7-crypto-jitter-reuse-allocated-entropy-collector.patch new file mode 100644 index 00000000000000..d56f1f2449bc18 --- /dev/null +++ b/target/linux/generic/backport-6.6/906-04-v6.7-crypto-jitter-reuse-allocated-entropy-collector.patch @@ -0,0 +1,117 @@ +From 8405ec8e3c02df8b3720874c3e2169fef4553868 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Stephan=20M=C3=BCller?= +Date: Sat, 7 Oct 2023 09:10:43 +0200 +Subject: [PATCH] crypto: jitter - reuse allocated entropy collector + +In case a health test error occurs during runtime, the power-up health +tests are rerun to verify that the noise source is still good and +that the reported health test error was an outlier. For performing this +power-up health test, the already existing entropy collector instance +is used instead of allocating a new one. This change has the following +implications: + +* The noise that is collected as part of the newly run health tests is + inserted into the entropy collector and thus stirs the existing + data present in there further. Thus, the entropy collected during + the health test is not wasted. This is also allowed by SP800-90B. + +* The power-on health test is not affected by the state of the entropy + collector, because it resets the APT / RCT state. The remainder of + the state is unrelated to the health test as it is only applied to + newly obtained time stamps. + +This change also fixes a bug report about an allocation while in an +atomic lock (the lock is taken in jent_kcapi_random, jent_read_entropy +is called and this can call jent_entropy_init). + +Fixes: 04597c8dd6c4 ("jitter - add RCT/APT support for different OSRs") +Reported-by: Dan Carpenter +Signed-off-by: Stephan Mueller +Signed-off-by: Herbert Xu +--- + crypto/jitterentropy-kcapi.c | 2 +- + crypto/jitterentropy.c | 36 ++++++++++++++++++++++++++---------- + crypto/jitterentropy.h | 2 +- + 3 files changed, 28 insertions(+), 12 deletions(-) + +--- a/crypto/jitterentropy-kcapi.c ++++ b/crypto/jitterentropy-kcapi.c +@@ -347,7 +347,7 @@ static int __init jent_mod_init(void) + + desc->tfm = tfm; + crypto_shash_init(desc); +- ret = jent_entropy_init(CONFIG_CRYPTO_JITTERENTROPY_OSR, 0, desc); ++ ret = jent_entropy_init(CONFIG_CRYPTO_JITTERENTROPY_OSR, 0, desc, NULL); + shash_desc_zero(desc); + crypto_free_shash(tfm); + if (ret) { +--- a/crypto/jitterentropy.c ++++ b/crypto/jitterentropy.c +@@ -611,8 +611,7 @@ int jent_read_entropy(struct rand_data * + * Perform startup health tests and return permanent + * error if it fails. + */ +- if (jent_entropy_init(ec->osr, ec->flags, +- ec->hash_state)) ++ if (jent_entropy_init(0, 0, NULL, ec)) + return -3; + + return -2; +@@ -686,14 +685,30 @@ void jent_entropy_collector_free(struct + jent_zfree(entropy_collector); + } + +-int jent_entropy_init(unsigned int osr, unsigned int flags, void *hash_state) ++int jent_entropy_init(unsigned int osr, unsigned int flags, void *hash_state, ++ struct rand_data *p_ec) + { +- struct rand_data *ec; +- int i, time_backwards = 0, ret = 0; ++ /* ++ * If caller provides an allocated ec, reuse it which implies that the ++ * health test entropy data is used to further still the available ++ * entropy pool. ++ */ ++ struct rand_data *ec = p_ec; ++ int i, time_backwards = 0, ret = 0, ec_free = 0; + +- ec = jent_entropy_collector_alloc(osr, flags, hash_state); +- if (!ec) +- return JENT_EMEM; ++ if (!ec) { ++ ec = jent_entropy_collector_alloc(osr, flags, hash_state); ++ if (!ec) ++ return JENT_EMEM; ++ ec_free = 1; ++ } else { ++ /* Reset the APT */ ++ jent_apt_reset(ec, 0); ++ /* Ensure that a new APT base is obtained */ ++ ec->apt_base_set = 0; ++ /* Reset the RCT */ ++ ec->rct_count = 0; ++ } + + /* We could perform statistical tests here, but the problem is + * that we only have a few loop counts to do testing. These +@@ -783,7 +798,8 @@ int jent_entropy_init(unsigned int osr, + } + + out: +- jent_entropy_collector_free(ec); ++ if (ec_free) ++ jent_entropy_collector_free(ec); + + return ret; + } +--- a/crypto/jitterentropy.h ++++ b/crypto/jitterentropy.h +@@ -12,7 +12,7 @@ int jent_read_random_block(void *hash_st + + struct rand_data; + extern int jent_entropy_init(unsigned int osr, unsigned int flags, +- void *hash_state); ++ void *hash_state, struct rand_data *p_ec); + extern int jent_read_entropy(struct rand_data *ec, unsigned char *data, + unsigned int len); + diff --git a/target/linux/generic/backport-6.6/906-05-v6.7-crypto-jitter-use-permanent-health-test-storage.patch b/target/linux/generic/backport-6.6/906-05-v6.7-crypto-jitter-use-permanent-health-test-storage.patch new file mode 100644 index 00000000000000..7c59169720ca6b --- /dev/null +++ b/target/linux/generic/backport-6.6/906-05-v6.7-crypto-jitter-use-permanent-health-test-storage.patch @@ -0,0 +1,242 @@ +From cf27d9475f37fb69b5bc293e6e6d6c1d03cf7cc6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Stephan=20M=C3=BCller?= +Date: Thu, 19 Oct 2023 09:40:42 +0200 +Subject: [PATCH] crypto: jitter - use permanent health test storage + +The health test result in the current code is only given for the currently +processed raw time stamp. This implies to react on the health test error, +the result must be checked after each raw time stamp being processed. To +avoid this constant checking requirement, any health test error is recorded +and stored to be analyzed at a later time, if needed. + +This change ensures that the power-up test catches any health test error. +Without that patch, the power-up health test result is not enforced. + +The introduced changes are already in use with the user space version of +the Jitter RNG. + +Fixes: 04597c8dd6c4 ("jitter - add RCT/APT support for different OSRs") +Reported-by: Joachim Vandersmissen +Signed-off-by: Stephan Mueller +Signed-off-by: Herbert Xu +--- + crypto/jitterentropy.c | 125 ++++++++++++++++++++++++----------------- + 1 file changed, 74 insertions(+), 51 deletions(-) + +--- a/crypto/jitterentropy.c ++++ b/crypto/jitterentropy.c +@@ -100,6 +100,8 @@ struct rand_data { + unsigned int apt_observations; /* Number of collected observations */ + unsigned int apt_count; /* APT counter */ + unsigned int apt_base; /* APT base reference */ ++ unsigned int health_failure; /* Record health failure */ ++ + unsigned int apt_base_set:1; /* APT base reference set? */ + }; + +@@ -121,6 +123,13 @@ struct rand_data { + #define JENT_EHASH 11 /* Hash self test failed */ + #define JENT_EMEM 12 /* Can't allocate memory for initialization */ + ++#define JENT_RCT_FAILURE 1 /* Failure in RCT health test. */ ++#define JENT_APT_FAILURE 2 /* Failure in APT health test. */ ++#define JENT_PERMANENT_FAILURE_SHIFT 16 ++#define JENT_PERMANENT_FAILURE(x) (x << JENT_PERMANENT_FAILURE_SHIFT) ++#define JENT_RCT_FAILURE_PERMANENT JENT_PERMANENT_FAILURE(JENT_RCT_FAILURE) ++#define JENT_APT_FAILURE_PERMANENT JENT_PERMANENT_FAILURE(JENT_APT_FAILURE) ++ + /* + * The output n bits can receive more than n bits of min entropy, of course, + * but the fixed output of the conditioning function can only asymptotically +@@ -215,26 +224,22 @@ static void jent_apt_insert(struct rand_ + return; + } + +- if (delta_masked == ec->apt_base) ++ if (delta_masked == ec->apt_base) { + ec->apt_count++; + ++ /* Note, ec->apt_count starts with one. */ ++ if (ec->apt_count >= ec->apt_cutoff_permanent) ++ ec->health_failure |= JENT_APT_FAILURE_PERMANENT; ++ else if (ec->apt_count >= ec->apt_cutoff) ++ ec->health_failure |= JENT_APT_FAILURE; ++ } ++ + ec->apt_observations++; + + if (ec->apt_observations >= JENT_APT_WINDOW_SIZE) + jent_apt_reset(ec, delta_masked); + } + +-/* APT health test failure detection */ +-static int jent_apt_permanent_failure(struct rand_data *ec) +-{ +- return (ec->apt_count >= ec->apt_cutoff_permanent) ? 1 : 0; +-} +- +-static int jent_apt_failure(struct rand_data *ec) +-{ +- return (ec->apt_count >= ec->apt_cutoff) ? 1 : 0; +-} +- + /*************************************************************************** + * Stuck Test and its use as Repetition Count Test + * +@@ -261,6 +266,30 @@ static void jent_rct_insert(struct rand_ + { + if (stuck) { + ec->rct_count++; ++ ++ /* ++ * The cutoff value is based on the following consideration: ++ * alpha = 2^-30 or 2^-60 as recommended in SP800-90B. ++ * In addition, we require an entropy value H of 1/osr as this ++ * is the minimum entropy required to provide full entropy. ++ * Note, we collect (DATA_SIZE_BITS + ENTROPY_SAFETY_FACTOR)*osr ++ * deltas for inserting them into the entropy pool which should ++ * then have (close to) DATA_SIZE_BITS bits of entropy in the ++ * conditioned output. ++ * ++ * Note, ec->rct_count (which equals to value B in the pseudo ++ * code of SP800-90B section 4.4.1) starts with zero. Hence ++ * we need to subtract one from the cutoff value as calculated ++ * following SP800-90B. Thus C = ceil(-log_2(alpha)/H) = 30*osr ++ * or 60*osr. ++ */ ++ if ((unsigned int)ec->rct_count >= (60 * ec->osr)) { ++ ec->rct_count = -1; ++ ec->health_failure |= JENT_RCT_FAILURE_PERMANENT; ++ } else if ((unsigned int)ec->rct_count >= (30 * ec->osr)) { ++ ec->rct_count = -1; ++ ec->health_failure |= JENT_RCT_FAILURE; ++ } + } else { + /* Reset RCT */ + ec->rct_count = 0; +@@ -316,38 +345,24 @@ static int jent_stuck(struct rand_data * + } + + /* +- * The cutoff value is based on the following consideration: +- * alpha = 2^-30 or 2^-60 as recommended in SP800-90B. +- * In addition, we require an entropy value H of 1/osr as this is the minimum +- * entropy required to provide full entropy. +- * Note, we collect (DATA_SIZE_BITS + ENTROPY_SAFETY_FACTOR)*osr deltas for +- * inserting them into the entropy pool which should then have (close to) +- * DATA_SIZE_BITS bits of entropy in the conditioned output. ++ * Report any health test failures + * +- * Note, ec->rct_count (which equals to value B in the pseudo code of SP800-90B +- * section 4.4.1) starts with zero. Hence we need to subtract one from the +- * cutoff value as calculated following SP800-90B. Thus +- * C = ceil(-log_2(alpha)/H) = 30*osr or 60*osr. +- */ +-static int jent_rct_permanent_failure(struct rand_data *ec) +-{ +- return (ec->rct_count >= (60 * ec->osr)) ? 1 : 0; +-} +- +-static int jent_rct_failure(struct rand_data *ec) +-{ +- return (ec->rct_count >= (30 * ec->osr)) ? 1 : 0; +-} +- +-/* Report of health test failures */ +-static int jent_health_failure(struct rand_data *ec) +-{ +- return jent_rct_failure(ec) | jent_apt_failure(ec); +-} ++ * @ec [in] Reference to entropy collector ++ * ++ * @return a bitmask indicating which tests failed ++ * 0 No health test failure ++ * 1 RCT failure ++ * 2 APT failure ++ * 1<health_failure; + } + + /*************************************************************************** +@@ -594,11 +609,12 @@ int jent_read_entropy(struct rand_data * + return -1; + + while (len > 0) { +- unsigned int tocopy; ++ unsigned int tocopy, health_test_result; + + jent_gen_entropy(ec); + +- if (jent_permanent_health_failure(ec)) { ++ health_test_result = jent_health_failure(ec); ++ if (health_test_result > JENT_PERMANENT_FAILURE_SHIFT) { + /* + * At this point, the Jitter RNG instance is considered + * as a failed instance. There is no rerun of the +@@ -606,13 +622,18 @@ int jent_read_entropy(struct rand_data * + * is assumed to not further use this instance. + */ + return -3; +- } else if (jent_health_failure(ec)) { ++ } else if (health_test_result) { + /* + * Perform startup health tests and return permanent + * error if it fails. + */ +- if (jent_entropy_init(0, 0, NULL, ec)) ++ if (jent_entropy_init(0, 0, NULL, ec)) { ++ /* Mark the permanent error */ ++ ec->health_failure &= ++ JENT_RCT_FAILURE_PERMANENT | ++ JENT_APT_FAILURE_PERMANENT; + return -3; ++ } + + return -2; + } +@@ -695,6 +716,7 @@ int jent_entropy_init(unsigned int osr, + */ + struct rand_data *ec = p_ec; + int i, time_backwards = 0, ret = 0, ec_free = 0; ++ unsigned int health_test_result; + + if (!ec) { + ec = jent_entropy_collector_alloc(osr, flags, hash_state); +@@ -708,6 +730,9 @@ int jent_entropy_init(unsigned int osr, + ec->apt_base_set = 0; + /* Reset the RCT */ + ec->rct_count = 0; ++ /* Reset intermittent, leave permanent health test result */ ++ ec->health_failure &= (~JENT_RCT_FAILURE); ++ ec->health_failure &= (~JENT_APT_FAILURE); + } + + /* We could perform statistical tests here, but the problem is +@@ -788,12 +813,10 @@ int jent_entropy_init(unsigned int osr, + } + + /* Did we encounter a health test failure? */ +- if (jent_rct_failure(ec)) { +- ret = JENT_ERCT; +- goto out; +- } +- if (jent_apt_failure(ec)) { +- ret = JENT_EHEALTH; ++ health_test_result = jent_health_failure(ec); ++ if (health_test_result) { ++ ret = (health_test_result & JENT_RCT_FAILURE) ? JENT_ERCT : ++ JENT_EHEALTH; + goto out; + } + diff --git a/target/linux/generic/backport-6.6/906-06-v6.7-crypto-jitterentropy-Hide-esoteric-Kconfig-options-under.patch b/target/linux/generic/backport-6.6/906-06-v6.7-crypto-jitterentropy-Hide-esoteric-Kconfig-options-under.patch new file mode 100644 index 00000000000000..2dc2a011698321 --- /dev/null +++ b/target/linux/generic/backport-6.6/906-06-v6.7-crypto-jitterentropy-Hide-esoteric-Kconfig-options-under.patch @@ -0,0 +1,80 @@ +From e7ed6473c2c8c4e45dd861bfa06e96189b11d8db Mon Sep 17 00:00:00 2001 +From: Herbert Xu +Date: Mon, 6 Nov 2023 18:00:08 +0800 +Subject: [PATCH] crypto: jitterentropy - Hide esoteric Kconfig options under + FIPS and EXPERT + +As JITTERENTROPY is selected by default if you enable the CRYPTO +API, any Kconfig options added there will show up for every single +user. Hide the esoteric options under EXPERT as well as FIPS so +that only distro makers will see them. + +Reported-by: Linus Torvalds +Signed-off-by: Herbert Xu +Reviewed-by: Stephan Mueller +Signed-off-by: Herbert Xu +--- + crypto/Kconfig | 28 +++++++++++++++++++++++++--- + 1 file changed, 25 insertions(+), 3 deletions(-) + +--- a/crypto/Kconfig ++++ b/crypto/Kconfig +@@ -1297,10 +1297,12 @@ config CRYPTO_JITTERENTROPY + + See https://www.chronox.de/jent/ + ++if CRYPTO_JITTERENTROPY ++if CRYPTO_FIPS && EXPERT ++ + choice + prompt "CPU Jitter RNG Memory Size" + default CRYPTO_JITTERENTROPY_MEMSIZE_2 +- depends on CRYPTO_JITTERENTROPY + help + The Jitter RNG measures the execution time of memory accesses. + Multiple consecutive memory accesses are performed. If the memory +@@ -1344,7 +1346,6 @@ config CRYPTO_JITTERENTROPY_OSR + int "CPU Jitter RNG Oversampling Rate" + range 1 15 + default 1 +- depends on CRYPTO_JITTERENTROPY + help + The Jitter RNG allows the specification of an oversampling rate (OSR). + The Jitter RNG operation requires a fixed amount of timing +@@ -1359,7 +1360,6 @@ config CRYPTO_JITTERENTROPY_OSR + + config CRYPTO_JITTERENTROPY_TESTINTERFACE + bool "CPU Jitter RNG Test Interface" +- depends on CRYPTO_JITTERENTROPY + help + The test interface allows a privileged process to capture + the raw unconditioned high resolution time stamp noise that +@@ -1377,6 +1377,28 @@ config CRYPTO_JITTERENTROPY_TESTINTERFAC + + If unsure, select N. + ++endif # if CRYPTO_FIPS && EXPERT ++ ++if !(CRYPTO_FIPS && EXPERT) ++ ++config CRYPTO_JITTERENTROPY_MEMORY_BLOCKS ++ int ++ default 64 ++ ++config CRYPTO_JITTERENTROPY_MEMORY_BLOCKSIZE ++ int ++ default 32 ++ ++config CRYPTO_JITTERENTROPY_OSR ++ int ++ default 1 ++ ++config CRYPTO_JITTERENTROPY_TESTINTERFACE ++ bool ++ ++endif # if !(CRYPTO_FIPS && EXPERT) ++endif # if CRYPTO_JITTERENTROPY ++ + config CRYPTO_KDF800108_CTR + tristate + select CRYPTO_HMAC diff --git a/target/linux/generic/backport-6.6/906-07-v6.10-crypto-jitter-Use-kvfree_sensitive-to-fix-Coccinelle.patch b/target/linux/generic/backport-6.6/906-07-v6.10-crypto-jitter-Use-kvfree_sensitive-to-fix-Coccinelle.patch new file mode 100644 index 00000000000000..88a0bd15c06adb --- /dev/null +++ b/target/linux/generic/backport-6.6/906-07-v6.10-crypto-jitter-Use-kvfree_sensitive-to-fix-Coccinelle.patch @@ -0,0 +1,30 @@ +From 6e61ee1ca551292d8714c35c92a019c41db79e4e Mon Sep 17 00:00:00 2001 +From: Thorsten Blum +Date: Wed, 27 Mar 2024 23:25:09 +0100 +Subject: [PATCH] crypto: jitter - Use kvfree_sensitive() to fix Coccinelle + warning + +Replace memzero_explicit() and kvfree() with kvfree_sensitive() to fix +the following Coccinelle/coccicheck warning reported by +kfree_sensitive.cocci: + + WARNING opportunity for kfree_sensitive/kvfree_sensitive + +Signed-off-by: Thorsten Blum +Signed-off-by: Herbert Xu +--- + crypto/jitterentropy-kcapi.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/crypto/jitterentropy-kcapi.c ++++ b/crypto/jitterentropy-kcapi.c +@@ -61,8 +61,7 @@ void *jent_kvzalloc(unsigned int len) + + void jent_kvzfree(void *ptr, unsigned int len) + { +- memzero_explicit(ptr, len); +- kvfree(ptr); ++ kvfree_sensitive(ptr, len); + } + + void *jent_zalloc(unsigned int len) diff --git a/target/linux/generic/backport-6.6/906-08-v6.12-crypto-jitter-set-default-OSR-to-3.patch b/target/linux/generic/backport-6.6/906-08-v6.12-crypto-jitter-set-default-OSR-to-3.patch new file mode 100644 index 00000000000000..ade8f1005bd7a6 --- /dev/null +++ b/target/linux/generic/backport-6.6/906-08-v6.12-crypto-jitter-set-default-OSR-to-3.patch @@ -0,0 +1,36 @@ +From 95a798d20060d2b648dd604321e347c85edfd783 Mon Sep 17 00:00:00 2001 +From: Stephan Mueller +Date: Mon, 12 Aug 2024 08:25:42 +0200 +Subject: [PATCH] crypto: jitter - set default OSR to 3 + +The user space Jitter RNG library uses the oversampling rate of 3 which +implies that each time stamp is credited with 1/3 bit of entropy. To +obtain 256 bits of entropy, 768 time stamps need to be sampled. The +increase in OSR is applied based on a report where the Jitter RNG is +used on a system exhibiting a challenging environment to collect +entropy. + +This OSR default value is now applied to the Linux kernel version of +the Jitter RNG as well. + +The increase in the OSR from 1 to 3 also implies that the Jitter RNG is +now slower by default. + +Reported-by: Jeff Barnes +Signed-off-by: Stephan Mueller +Signed-off-by: Herbert Xu +--- + crypto/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/crypto/Kconfig ++++ b/crypto/Kconfig +@@ -1345,7 +1345,7 @@ config CRYPTO_JITTERENTROPY_MEMORY_BLOCK + config CRYPTO_JITTERENTROPY_OSR + int "CPU Jitter RNG Oversampling Rate" + range 1 15 +- default 1 ++ default 3 + help + The Jitter RNG allows the specification of an oversampling rate (OSR). + The Jitter RNG operation requires a fixed amount of timing From b394fa6819cbc52491c6fa24c344cab126d2f9da Mon Sep 17 00:00:00 2001 From: Martin Schiller Date: Mon, 10 Mar 2025 08:42:18 +0100 Subject: [PATCH 671/877] generic: net: phy: sfp: backport some FS copper SFP fixes This fixes the handling of some FS copper SFP modules using the RollBall protocol and needing some extra treatment. Signed-off-by: Martin Schiller (cherry picked from commit bbe58f9830b38e171541db3eb9bc80ccc9428286) --- ...rework-the-RollBall-PHY-waiting-code.patch | 134 ++++++++++++++++++ ...HY-discovery-for-FS-SFP-10G-T-module.patch | 85 +++++++++++ ...pdate-comment-for-FS-SFP-10G-T-quirk.patch | 36 +++++ ...or-Fibrestore-2.5G-copper-SFP-module.patch | 77 ++++++++++ ...-for-FS-SFP-10GM-T-copper-SFP-module.patch | 50 +++++++ .../790-SFP-GE-T-ignore-TX_FAULT.patch | 10 +- ...sfp-re-probe-modules-on-DEV_UP-event.patch | 2 +- ...14-net-phy-sfp-add-support-for-SMBus.patch | 6 +- 8 files changed, 391 insertions(+), 9 deletions(-) create mode 100644 target/linux/generic/backport-6.6/785-01-v6.8-net-sfp-rework-the-RollBall-PHY-waiting-code.patch create mode 100644 target/linux/generic/backport-6.6/785-02-v6.8-net-sfp-fix-PHY-discovery-for-FS-SFP-10G-T-module.patch create mode 100644 target/linux/generic/backport-6.6/785-03-v6.10-net-sfp-update-comment-for-FS-SFP-10G-T-quirk.patch create mode 100644 target/linux/generic/backport-6.6/785-04-v6.10-net-sfp-enhance-quirk-for-Fibrestore-2.5G-copper-SFP-module.patch create mode 100644 target/linux/generic/backport-6.6/785-05-v6.15-net-sfp-add-quirk-for-FS-SFP-10GM-T-copper-SFP-module.patch diff --git a/target/linux/generic/backport-6.6/785-01-v6.8-net-sfp-rework-the-RollBall-PHY-waiting-code.patch b/target/linux/generic/backport-6.6/785-01-v6.8-net-sfp-rework-the-RollBall-PHY-waiting-code.patch new file mode 100644 index 00000000000000..a15346346dc49e --- /dev/null +++ b/target/linux/generic/backport-6.6/785-01-v6.8-net-sfp-rework-the-RollBall-PHY-waiting-code.patch @@ -0,0 +1,134 @@ +From 2f3ce7a56c6e02bc0b258507f3a82b7511f62f9e Mon Sep 17 00:00:00 2001 +From: Marek Behún +Date: Tue, 21 Nov 2023 18:20:24 +0100 +Subject: net: sfp: rework the RollBall PHY waiting code +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RollBall SFP modules allow the access to PHY registers only after a +certain time has passed. Until then, the registers read 0xffff. + +Currently we have quirks for modules where we need to wait either 25 +seconds or 4 seconds, but recently I got hands on another module where +the wait is even shorter. + +Instead of hardcoding different wait times, lets rework the code: +- increase the PHY retry count to 25 +- when RollBall module is detected, increase the PHY retry time from + 50ms to 1s + +Signed-off-by: Marek Behún +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/phy/sfp.c | 41 +++++++++++++++++++++-------------------- + 1 file changed, 21 insertions(+), 20 deletions(-) + +--- a/drivers/net/phy/sfp.c ++++ b/drivers/net/phy/sfp.c +@@ -191,7 +191,7 @@ static const enum gpiod_flags gpio_flags + * R_PHY_RETRY is the number of attempts. + */ + #define T_PHY_RETRY msecs_to_jiffies(50) +-#define R_PHY_RETRY 12 ++#define R_PHY_RETRY 25 + + /* SFP module presence detection is poor: the three MOD DEF signals are + * the same length on the PCB, which means it's possible for MOD DEF 0 to +@@ -273,7 +273,7 @@ struct sfp { + struct sfp_eeprom_id id; + unsigned int module_power_mW; + unsigned int module_t_start_up; +- unsigned int module_t_wait; ++ unsigned int phy_t_retry; + + unsigned int rate_kbd; + unsigned int rs_threshold_kbd; +@@ -357,18 +357,22 @@ static void sfp_fixup_10gbaset_30m(struc + sfp->id.base.extended_cc = SFF8024_ECC_10GBASE_T_SR; + } + +-static void sfp_fixup_rollball_proto(struct sfp *sfp, unsigned int secs) ++static void sfp_fixup_rollball(struct sfp *sfp) + { + sfp->mdio_protocol = MDIO_I2C_ROLLBALL; +- sfp->module_t_wait = msecs_to_jiffies(secs * 1000); ++ ++ /* RollBall modules may disallow access to PHY registers for up to 25 ++ * seconds, and the reads return 0xffff before that. Increase the time ++ * between PHY probe retries from 50ms to 1s so that we will wait for ++ * the PHY for a sufficient amount of time. ++ */ ++ sfp->phy_t_retry = msecs_to_jiffies(1000); + } + + static void sfp_fixup_fs_10gt(struct sfp *sfp) + { + sfp_fixup_10gbaset_30m(sfp); +- +- // These SFPs need 4 seconds before the PHY can be accessed +- sfp_fixup_rollball_proto(sfp, 4); ++ sfp_fixup_rollball(sfp); + } + + static void sfp_fixup_halny_gsfp(struct sfp *sfp) +@@ -380,12 +384,6 @@ static void sfp_fixup_halny_gsfp(struct + sfp->state_hw_mask &= ~(SFP_F_TX_FAULT | SFP_F_LOS); + } + +-static void sfp_fixup_rollball(struct sfp *sfp) +-{ +- // Rollball SFPs need 25 seconds before the PHY can be accessed +- sfp_fixup_rollball_proto(sfp, 25); +-} +- + static void sfp_fixup_rollball_cc(struct sfp *sfp) + { + sfp_fixup_rollball(sfp); +@@ -2321,7 +2319,7 @@ static int sfp_sm_mod_probe(struct sfp * + mask |= SFP_F_RS1; + + sfp->module_t_start_up = T_START_UP; +- sfp->module_t_wait = T_WAIT; ++ sfp->phy_t_retry = T_PHY_RETRY; + + sfp->tx_fault_ignore = false; + +@@ -2555,10 +2553,9 @@ static void sfp_sm_main(struct sfp *sfp, + + /* We need to check the TX_FAULT state, which is not defined + * while TX_DISABLE is asserted. The earliest we want to do +- * anything (such as probe for a PHY) is 50ms (or more on +- * specific modules). ++ * anything (such as probe for a PHY) is 50ms. + */ +- sfp_sm_next(sfp, SFP_S_WAIT, sfp->module_t_wait); ++ sfp_sm_next(sfp, SFP_S_WAIT, T_WAIT); + break; + + case SFP_S_WAIT: +@@ -2572,8 +2569,8 @@ static void sfp_sm_main(struct sfp *sfp, + * deasserting. + */ + timeout = sfp->module_t_start_up; +- if (timeout > sfp->module_t_wait) +- timeout -= sfp->module_t_wait; ++ if (timeout > T_WAIT) ++ timeout -= T_WAIT; + else + timeout = 1; + +@@ -2616,7 +2613,11 @@ static void sfp_sm_main(struct sfp *sfp, + ret = sfp_sm_probe_for_phy(sfp); + if (ret == -ENODEV) { + if (--sfp->sm_phy_retries) { +- sfp_sm_next(sfp, SFP_S_INIT_PHY, T_PHY_RETRY); ++ sfp_sm_next(sfp, SFP_S_INIT_PHY, ++ sfp->phy_t_retry); ++ dev_dbg(sfp->dev, ++ "no PHY detected, %u tries left\n", ++ sfp->sm_phy_retries); + break; + } else { + dev_info(sfp->dev, "no PHY detected\n"); diff --git a/target/linux/generic/backport-6.6/785-02-v6.8-net-sfp-fix-PHY-discovery-for-FS-SFP-10G-T-module.patch b/target/linux/generic/backport-6.6/785-02-v6.8-net-sfp-fix-PHY-discovery-for-FS-SFP-10G-T-module.patch new file mode 100644 index 00000000000000..e14a69236f5b71 --- /dev/null +++ b/target/linux/generic/backport-6.6/785-02-v6.8-net-sfp-fix-PHY-discovery-for-FS-SFP-10G-T-module.patch @@ -0,0 +1,85 @@ +From e9301af385e7864dea353f5e58cad7339dd6c718 Mon Sep 17 00:00:00 2001 +From: Marek Behún +Date: Tue, 19 Dec 2023 17:24:15 +0100 +Subject: net: sfp: fix PHY discovery for FS SFP-10G-T module +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Commit 2f3ce7a56c6e ("net: sfp: rework the RollBall PHY waiting code") +changed the long wait before accessing RollBall / FS modules into +probing for PHY every 1 second, and trying 25 times. + +Wei Lei reports that this does not work correctly on FS modules: when +initializing, they may report values different from 0xffff in PHY ID +registers for some MMDs, causing get_phy_c45_ids() to find some bogus +MMD. + +Fix this by adding the module_t_wait member back, and setting it to 4 +seconds for FS modules. + +Fixes: 2f3ce7a56c6e ("net: sfp: rework the RollBall PHY waiting code") +Reported-by: Wei Lei +Signed-off-by: Marek Behún +Tested-by: Lei Wei +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/phy/sfp.c | 17 +++++++++++++---- + 1 file changed, 13 insertions(+), 4 deletions(-) + +--- a/drivers/net/phy/sfp.c ++++ b/drivers/net/phy/sfp.c +@@ -273,6 +273,7 @@ struct sfp { + struct sfp_eeprom_id id; + unsigned int module_power_mW; + unsigned int module_t_start_up; ++ unsigned int module_t_wait; + unsigned int phy_t_retry; + + unsigned int rate_kbd; +@@ -373,6 +374,12 @@ static void sfp_fixup_fs_10gt(struct sfp + { + sfp_fixup_10gbaset_30m(sfp); + sfp_fixup_rollball(sfp); ++ ++ /* The RollBall fixup is not enough for FS modules, the AQR chip inside ++ * them does not return 0xffff for PHY ID registers in all MMDs for the ++ * while initializing. They need a 4 second wait before accessing PHY. ++ */ ++ sfp->module_t_wait = msecs_to_jiffies(4000); + } + + static void sfp_fixup_halny_gsfp(struct sfp *sfp) +@@ -2319,6 +2326,7 @@ static int sfp_sm_mod_probe(struct sfp * + mask |= SFP_F_RS1; + + sfp->module_t_start_up = T_START_UP; ++ sfp->module_t_wait = T_WAIT; + sfp->phy_t_retry = T_PHY_RETRY; + + sfp->tx_fault_ignore = false; +@@ -2553,9 +2561,10 @@ static void sfp_sm_main(struct sfp *sfp, + + /* We need to check the TX_FAULT state, which is not defined + * while TX_DISABLE is asserted. The earliest we want to do +- * anything (such as probe for a PHY) is 50ms. ++ * anything (such as probe for a PHY) is 50ms (or more on ++ * specific modules). + */ +- sfp_sm_next(sfp, SFP_S_WAIT, T_WAIT); ++ sfp_sm_next(sfp, SFP_S_WAIT, sfp->module_t_wait); + break; + + case SFP_S_WAIT: +@@ -2569,8 +2578,8 @@ static void sfp_sm_main(struct sfp *sfp, + * deasserting. + */ + timeout = sfp->module_t_start_up; +- if (timeout > T_WAIT) +- timeout -= T_WAIT; ++ if (timeout > sfp->module_t_wait) ++ timeout -= sfp->module_t_wait; + else + timeout = 1; + diff --git a/target/linux/generic/backport-6.6/785-03-v6.10-net-sfp-update-comment-for-FS-SFP-10G-T-quirk.patch b/target/linux/generic/backport-6.6/785-03-v6.10-net-sfp-update-comment-for-FS-SFP-10G-T-quirk.patch new file mode 100644 index 00000000000000..f9e5019e94ff03 --- /dev/null +++ b/target/linux/generic/backport-6.6/785-03-v6.10-net-sfp-update-comment-for-FS-SFP-10G-T-quirk.patch @@ -0,0 +1,36 @@ +From 6999e0fc9a552ce98fcc66bee3dca7e55fba0ed3 Mon Sep 17 00:00:00 2001 +From: Marek Behún +Date: Tue, 23 Apr 2024 10:50:38 +0200 +Subject: net: sfp: update comment for FS SFP-10G-T quirk +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Update the comment for the Fibrestore SFP-10G-T module: since commit +e9301af385e7 ("net: sfp: fix PHY discovery for FS SFP-10G-T module") +we also do a 4 second wait before probing the PHY. + +Fixes: e9301af385e7 ("net: sfp: fix PHY discovery for FS SFP-10G-T module") +Signed-off-by: Marek Behún +Reviewed-by: Andrew Lunn +Reviewed-by: Jiri Pirko +Link: https://lore.kernel.org/r/20240423085039.26957-1-kabel@kernel.org +Signed-off-by: Jakub Kicinski +--- + drivers/net/phy/sfp.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/drivers/net/phy/sfp.c ++++ b/drivers/net/phy/sfp.c +@@ -454,8 +454,9 @@ static const struct sfp_quirk sfp_quirks + SFP_QUIRK("ALCATELLUCENT", "3FE46541AA", sfp_quirk_2500basex, + sfp_fixup_long_startup), + +- // Fiberstore SFP-10G-T doesn't identify as copper, and uses the +- // Rollball protocol to talk to the PHY. ++ // Fiberstore SFP-10G-T doesn't identify as copper, uses the Rollball ++ // protocol to talk to the PHY and needs 4 sec wait before probing the ++ // PHY. + SFP_QUIRK_F("FS", "SFP-10G-T", sfp_fixup_fs_10gt), + + // Fiberstore GPON-ONU-34-20BI can operate at 2500base-X, but report 1.2GBd diff --git a/target/linux/generic/backport-6.6/785-04-v6.10-net-sfp-enhance-quirk-for-Fibrestore-2.5G-copper-SFP-module.patch b/target/linux/generic/backport-6.6/785-04-v6.10-net-sfp-enhance-quirk-for-Fibrestore-2.5G-copper-SFP-module.patch new file mode 100644 index 00000000000000..6b83d3db1dded6 --- /dev/null +++ b/target/linux/generic/backport-6.6/785-04-v6.10-net-sfp-enhance-quirk-for-Fibrestore-2.5G-copper-SFP-module.patch @@ -0,0 +1,77 @@ +From cd4a32e60061789676f7f018a94fcc9ec56732a0 Mon Sep 17 00:00:00 2001 +From: Marek Behún +Date: Tue, 23 Apr 2024 10:50:39 +0200 +Subject: net: sfp: enhance quirk for Fibrestore 2.5G copper SFP module +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Enhance the quirk for Fibrestore 2.5G copper SFP module. The original +commit e27aca3760c0 ("net: sfp: add quirk for FS's 2.5G copper SFP") +introducing the quirk says that the PHY is inaccessible, but that is +not true. + +The module uses Rollball protocol to talk to the PHY, and needs a 4 +second wait before probing it, same as FS 10G module. + +The PHY inside the module is Realtek RTL8221B-VB-CG PHY. The realtek +driver recently gained support to set it up via clause 45 accesses. + +Signed-off-by: Marek Behún +Reviewed-by: Jiri Pirko +Link: https://lore.kernel.org/r/20240423085039.26957-2-kabel@kernel.org +Signed-off-by: Jakub Kicinski +--- + drivers/net/phy/sfp.c | 18 ++++++++++++------ + 1 file changed, 12 insertions(+), 6 deletions(-) + +--- a/drivers/net/phy/sfp.c ++++ b/drivers/net/phy/sfp.c +@@ -370,18 +370,23 @@ static void sfp_fixup_rollball(struct sf + sfp->phy_t_retry = msecs_to_jiffies(1000); + } + +-static void sfp_fixup_fs_10gt(struct sfp *sfp) ++static void sfp_fixup_fs_2_5gt(struct sfp *sfp) + { +- sfp_fixup_10gbaset_30m(sfp); + sfp_fixup_rollball(sfp); + +- /* The RollBall fixup is not enough for FS modules, the AQR chip inside ++ /* The RollBall fixup is not enough for FS modules, the PHY chip inside + * them does not return 0xffff for PHY ID registers in all MMDs for the + * while initializing. They need a 4 second wait before accessing PHY. + */ + sfp->module_t_wait = msecs_to_jiffies(4000); + } + ++static void sfp_fixup_fs_10gt(struct sfp *sfp) ++{ ++ sfp_fixup_10gbaset_30m(sfp); ++ sfp_fixup_fs_2_5gt(sfp); ++} ++ + static void sfp_fixup_halny_gsfp(struct sfp *sfp) + { + /* Ignore the TX_FAULT and LOS signals on this module. +@@ -459,6 +464,10 @@ static const struct sfp_quirk sfp_quirks + // PHY. + SFP_QUIRK_F("FS", "SFP-10G-T", sfp_fixup_fs_10gt), + ++ // Fiberstore SFP-2.5G-T uses Rollball protocol to talk to the PHY and ++ // needs 4 sec wait before probing the PHY. ++ SFP_QUIRK_F("FS", "SFP-2.5G-T", sfp_fixup_fs_2_5gt), ++ + // Fiberstore GPON-ONU-34-20BI can operate at 2500base-X, but report 1.2GBd + // NRZ in their EEPROM + SFP_QUIRK("FS", "GPON-ONU-34-20BI", sfp_quirk_2500basex, +@@ -475,9 +484,6 @@ static const struct sfp_quirk sfp_quirks + SFP_QUIRK("HUAWEI", "MA5671A", sfp_quirk_2500basex, + sfp_fixup_ignore_tx_fault), + +- // FS 2.5G Base-T +- SFP_QUIRK_M("FS", "SFP-2.5G-T", sfp_quirk_oem_2_5g), +- + // Lantech 8330-262D-E can operate at 2500base-X, but incorrectly report + // 2500MBd NRZ in their EEPROM + SFP_QUIRK_M("Lantech", "8330-262D-E", sfp_quirk_2500basex), diff --git a/target/linux/generic/backport-6.6/785-05-v6.15-net-sfp-add-quirk-for-FS-SFP-10GM-T-copper-SFP-module.patch b/target/linux/generic/backport-6.6/785-05-v6.15-net-sfp-add-quirk-for-FS-SFP-10GM-T-copper-SFP-module.patch new file mode 100644 index 00000000000000..37657612d7b953 --- /dev/null +++ b/target/linux/generic/backport-6.6/785-05-v6.15-net-sfp-add-quirk-for-FS-SFP-10GM-T-copper-SFP-module.patch @@ -0,0 +1,50 @@ +From 05ec5c085eb7ae044d49e04a3cff194a0b2a3251 Mon Sep 17 00:00:00 2001 +From: Martin Schiller +Date: Thu, 27 Feb 2025 08:10:58 +0100 +Subject: net: sfp: add quirk for FS SFP-10GM-T copper SFP+ module + +Add quirk for a copper SFP that identifies itself as "FS" "SFP-10GM-T". +It uses RollBall protocol to talk to the PHY and needs 4 sec wait before +probing the PHY. + +Signed-off-by: Martin Schiller +Link: https://patch.msgid.link/20250227071058.1520027-1-ms@dev.tdt.de +Signed-off-by: Jakub Kicinski +--- + drivers/net/phy/sfp.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +--- a/drivers/net/phy/sfp.c ++++ b/drivers/net/phy/sfp.c +@@ -370,7 +370,7 @@ static void sfp_fixup_rollball(struct sf + sfp->phy_t_retry = msecs_to_jiffies(1000); + } + +-static void sfp_fixup_fs_2_5gt(struct sfp *sfp) ++static void sfp_fixup_rollball_wait4s(struct sfp *sfp) + { + sfp_fixup_rollball(sfp); + +@@ -384,7 +384,7 @@ static void sfp_fixup_fs_2_5gt(struct sf + static void sfp_fixup_fs_10gt(struct sfp *sfp) + { + sfp_fixup_10gbaset_30m(sfp); +- sfp_fixup_fs_2_5gt(sfp); ++ sfp_fixup_rollball_wait4s(sfp); + } + + static void sfp_fixup_halny_gsfp(struct sfp *sfp) +@@ -464,9 +464,10 @@ static const struct sfp_quirk sfp_quirks + // PHY. + SFP_QUIRK_F("FS", "SFP-10G-T", sfp_fixup_fs_10gt), + +- // Fiberstore SFP-2.5G-T uses Rollball protocol to talk to the PHY and +- // needs 4 sec wait before probing the PHY. +- SFP_QUIRK_F("FS", "SFP-2.5G-T", sfp_fixup_fs_2_5gt), ++ // Fiberstore SFP-2.5G-T and SFP-10GM-T uses Rollball protocol to talk ++ // to the PHY and needs 4 sec wait before probing the PHY. ++ SFP_QUIRK_F("FS", "SFP-2.5G-T", sfp_fixup_rollball_wait4s), ++ SFP_QUIRK_F("FS", "SFP-10GM-T", sfp_fixup_rollball_wait4s), + + // Fiberstore GPON-ONU-34-20BI can operate at 2500base-X, but report 1.2GBd + // NRZ in their EEPROM diff --git a/target/linux/generic/hack-6.6/790-SFP-GE-T-ignore-TX_FAULT.patch b/target/linux/generic/hack-6.6/790-SFP-GE-T-ignore-TX_FAULT.patch index 924425fb816d14..b1e54a5f1628f9 100644 --- a/target/linux/generic/hack-6.6/790-SFP-GE-T-ignore-TX_FAULT.patch +++ b/target/linux/generic/hack-6.6/790-SFP-GE-T-ignore-TX_FAULT.patch @@ -26,9 +26,9 @@ Signed-off-by: Daniel Golle --- a/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c -@@ -472,6 +472,9 @@ static const struct sfp_quirk sfp_quirks - // FS 2.5G Base-T - SFP_QUIRK_M("FS", "SFP-2.5G-T", sfp_quirk_oem_2_5g), +@@ -485,6 +485,9 @@ static const struct sfp_quirk sfp_quirks + SFP_QUIRK("HUAWEI", "MA5671A", sfp_quirk_2500basex, + sfp_fixup_ignore_tx_fault), + // OEM SFP-GE-T is 1000Base-T module + SFP_QUIRK_F("OEM", "SFP-GE-T", sfp_fixup_ignore_tx_fault), @@ -36,7 +36,7 @@ Signed-off-by: Daniel Golle // Lantech 8330-262D-E can operate at 2500base-X, but incorrectly report // 2500MBd NRZ in their EEPROM SFP_QUIRK_M("Lantech", "8330-262D-E", sfp_quirk_2500basex), -@@ -2592,7 +2595,8 @@ static void sfp_sm_main(struct sfp *sfp, +@@ -2606,7 +2609,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, @@ -46,7 +46,7 @@ Signed-off-by: Daniel Golle } else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR) { init_done: /* Create mdiobus and start trying for PHY */ -@@ -2846,10 +2850,12 @@ static void sfp_check_state(struct sfp * +@@ -2864,10 +2868,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-6.6/710-net-phy-sfp-re-probe-modules-on-DEV_UP-event.patch b/target/linux/realtek/patches-6.6/710-net-phy-sfp-re-probe-modules-on-DEV_UP-event.patch index 0ccd6aec6d8e6e..ca341f64374870 100644 --- a/target/linux/realtek/patches-6.6/710-net-phy-sfp-re-probe-modules-on-DEV_UP-event.patch +++ b/target/linux/realtek/patches-6.6/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 -@@ -2418,6 +2418,13 @@ static void sfp_sm_module(struct sfp *sf +@@ -2432,6 +2432,13 @@ static void sfp_sm_module(struct sfp *sf return; } diff --git a/target/linux/realtek/patches-6.6/714-net-phy-sfp-add-support-for-SMBus.patch b/target/linux/realtek/patches-6.6/714-net-phy-sfp-add-support-for-SMBus.patch index 022a50272c588f..4d6aca99ee51e5 100644 --- a/target/linux/realtek/patches-6.6/714-net-phy-sfp-add-support-for-SMBus.patch +++ b/target/linux/realtek/patches-6.6/714-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 -@@ -665,10 +665,64 @@ static int sfp_i2c_write(struct sfp *sfp +@@ -678,10 +678,64 @@ static int sfp_i2c_write(struct sfp *sfp return ret == ARRAY_SIZE(msgs) ? len : 0; } @@ -77,7 +77,7 @@ Signed-off-by: Antoine Tenart sfp->i2c = i2c; sfp->read = sfp_i2c_read; -@@ -700,6 +754,29 @@ static int sfp_i2c_mdiobus_create(struct +@@ -713,6 +767,29 @@ static int sfp_i2c_mdiobus_create(struct return 0; } @@ -107,7 +107,7 @@ Signed-off-by: Antoine Tenart static void sfp_i2c_mdiobus_destroy(struct sfp *sfp) { mdiobus_unregister(sfp->i2c_mii); -@@ -1873,8 +1950,15 @@ static void sfp_sm_fault(struct sfp *sfp +@@ -1886,8 +1963,15 @@ static void sfp_sm_fault(struct sfp *sfp static int sfp_sm_add_mdio_bus(struct sfp *sfp) { From 6d41cbf868f4d6c4574c79049d94cbd6cc21f6b8 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Fri, 2 May 2025 01:46:25 +0300 Subject: [PATCH 672/877] realtek: add missing symbol Commit d7e82c78d7a2 added a generic kernel patch that exposes a new symbol REALTEK_PHY_HWMON when REALTEK_PHY and HWMON are enabled. The new symbol was added to kmod-phy-realtek, but the kmod is not used in the realtek target. Fixes: d7e82c78d7a2 ("generic: backport Realtek PHY patches from upstream") Signed-off-by: Stijn Tintel (cherry picked from commit ab8708767299c2aebe6a2c1f62abf246214d0d1c) --- target/linux/realtek/rtl838x/config-6.6 | 1 + target/linux/realtek/rtl839x/config-6.6 | 1 + target/linux/realtek/rtl930x/config-6.6 | 1 + 3 files changed, 3 insertions(+) diff --git a/target/linux/realtek/rtl838x/config-6.6 b/target/linux/realtek/rtl838x/config-6.6 index 274073fd6357d4..c93a8c7878e71c 100644 --- a/target/linux/realtek/rtl838x/config-6.6 +++ b/target/linux/realtek/rtl838x/config-6.6 @@ -193,6 +193,7 @@ CONFIG_RATIONAL=y CONFIG_REALTEK_OTTO_TIMER=y CONFIG_REALTEK_OTTO_WDT=y CONFIG_REALTEK_PHY=y +CONFIG_REALTEK_PHY_HWMON=y CONFIG_REALTEK_SOC_PHY=y CONFIG_REGMAP=y CONFIG_REGMAP_I2C=y diff --git a/target/linux/realtek/rtl839x/config-6.6 b/target/linux/realtek/rtl839x/config-6.6 index f29533dab5d205..e10730ac875606 100644 --- a/target/linux/realtek/rtl839x/config-6.6 +++ b/target/linux/realtek/rtl839x/config-6.6 @@ -201,6 +201,7 @@ CONFIG_RATIONAL=y CONFIG_REALTEK_OTTO_TIMER=y CONFIG_REALTEK_OTTO_WDT=y CONFIG_REALTEK_PHY=y +CONFIG_REALTEK_PHY_HWMON=y CONFIG_REALTEK_SOC_PHY=y CONFIG_REGMAP=y CONFIG_REGMAP_I2C=y diff --git a/target/linux/realtek/rtl930x/config-6.6 b/target/linux/realtek/rtl930x/config-6.6 index 2d4694599128c5..c0f3b39c41879d 100644 --- a/target/linux/realtek/rtl930x/config-6.6 +++ b/target/linux/realtek/rtl930x/config-6.6 @@ -167,6 +167,7 @@ CONFIG_RATIONAL=y CONFIG_REALTEK_OTTO_TIMER=y CONFIG_REALTEK_OTTO_WDT=y CONFIG_REALTEK_PHY=y +CONFIG_REALTEK_PHY_HWMON=y CONFIG_REALTEK_SOC_PHY=y CONFIG_REGMAP=y CONFIG_REGMAP_I2C=y From 6285ce709a27c7538ad233864703e1eb773b056b Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Tue, 20 May 2025 11:23:52 +0200 Subject: [PATCH 673/877] mvebu: armada37xx: backport pinctrl fixes Backport upstream pinctrl fixes, these are required for the follow-up I2C PXA recovery fixes. Signed-off-by: Robert Marko (cherry picked from commit 831994e25818cbd000e9de2eac8f7cc0a5eda181) --- ...7xx-use-correct-OUTPUT_VAL-register-.patch | 44 ++++++++++++++ ...7xx-set-GPIO-output-value-before-set.patch | 58 +++++++++++++++++++ ...7xx-propagate-error-from-armada_37xx.patch | 31 ++++++++++ ...7xx-propagate-error-from-armada_37xx.patch | 36 ++++++++++++ ...7xx-propagate-error-from-armada_37xx.patch | 42 ++++++++++++++ ...7xx-propagate-error-from-armada_37xx.patch | 35 +++++++++++ ...7xx-propagate-error-from-armada_37xx.patch | 31 ++++++++++ 7 files changed, 277 insertions(+) create mode 100644 target/linux/mvebu/patches-6.6/0001-v6.16-pinctrl-armada-37xx-use-correct-OUTPUT_VAL-register-.patch create mode 100644 target/linux/mvebu/patches-6.6/0002-v6.16-pinctrl-armada-37xx-set-GPIO-output-value-before-set.patch create mode 100644 target/linux/mvebu/patches-6.6/0003-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch create mode 100644 target/linux/mvebu/patches-6.6/0004-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch create mode 100644 target/linux/mvebu/patches-6.6/0005-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch create mode 100644 target/linux/mvebu/patches-6.6/0006-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch create mode 100644 target/linux/mvebu/patches-6.6/0007-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch diff --git a/target/linux/mvebu/patches-6.6/0001-v6.16-pinctrl-armada-37xx-use-correct-OUTPUT_VAL-register-.patch b/target/linux/mvebu/patches-6.6/0001-v6.16-pinctrl-armada-37xx-use-correct-OUTPUT_VAL-register-.patch new file mode 100644 index 00000000000000..0d594a20bf1590 --- /dev/null +++ b/target/linux/mvebu/patches-6.6/0001-v6.16-pinctrl-armada-37xx-use-correct-OUTPUT_VAL-register-.patch @@ -0,0 +1,44 @@ +From 947c93eb29c2a581c0b0b6d5f21af3c2b7ff6d25 Mon Sep 17 00:00:00 2001 +From: Gabor Juhos +Date: Wed, 14 May 2025 21:18:32 +0200 +Subject: [PATCH 1/7] pinctrl: armada-37xx: use correct OUTPUT_VAL register for + GPIOs > 31 + +The controller has two consecutive OUTPUT_VAL registers and both +holds output value for 32 GPIOs. Due to a missing adjustment, the +current code always uses the first register while setting the +output value whereas it should use the second one for GPIOs > 31. + +Add the missing armada_37xx_update_reg() call to adjust the register +according to the 'offset' parameter of the function to fix the issue. + +Cc: stable@vger.kernel.org +Fixes: 6702abb3bf23 ("pinctrl: armada-37xx: Fix direction_output() callback behavior") +Signed-off-by: Imre Kaloz +Reviewed-by: Andrew Lunn +Signed-off-by: Gabor Juhos +Link: https://lore.kernel.org/20250514-pinctrl-a37xx-fixes-v2-1-07e9ac1ab737@gmail.com +Signed-off-by: Linus Walleij +--- + drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c ++++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +@@ -417,6 +417,7 @@ static int armada_37xx_gpio_direction_ou + unsigned int offset, int value) + { + struct armada_37xx_pinctrl *info = gpiochip_get_data(chip); ++ unsigned int val_offset = offset; + unsigned int reg = OUTPUT_EN; + unsigned int mask, val, ret; + +@@ -429,6 +430,8 @@ static int armada_37xx_gpio_direction_ou + return ret; + + reg = OUTPUT_VAL; ++ armada_37xx_update_reg(®, &val_offset); ++ + val = value ? mask : 0; + regmap_update_bits(info->regmap, reg, mask, val); + diff --git a/target/linux/mvebu/patches-6.6/0002-v6.16-pinctrl-armada-37xx-set-GPIO-output-value-before-set.patch b/target/linux/mvebu/patches-6.6/0002-v6.16-pinctrl-armada-37xx-set-GPIO-output-value-before-set.patch new file mode 100644 index 00000000000000..02f42c03246cd9 --- /dev/null +++ b/target/linux/mvebu/patches-6.6/0002-v6.16-pinctrl-armada-37xx-set-GPIO-output-value-before-set.patch @@ -0,0 +1,58 @@ +From e6ebd4942981f8ad37189bbb36a3c8495e21ef4c Mon Sep 17 00:00:00 2001 +From: Gabor Juhos +Date: Wed, 14 May 2025 21:18:33 +0200 +Subject: [PATCH 2/7] pinctrl: armada-37xx: set GPIO output value before + setting direction + +Changing the direction before updating the output value in the +OUTPUT_VAL register may result in a glitch on the output line +if the previous value in the OUTPUT_VAL register is different +from the one we want to set. + +In order to avoid that, update the output value before changing +the direction. + +Cc: stable@vger.kernel.org +Fixes: 6702abb3bf23 ("pinctrl: armada-37xx: Fix direction_output() callback behavior") +Signed-off-by: Imre Kaloz +Reviewed-by: Andrew Lunn +Signed-off-by: Gabor Juhos +Link: https://lore.kernel.org/20250514-pinctrl-a37xx-fixes-v2-2-07e9ac1ab737@gmail.com +Signed-off-by: Linus Walleij +--- + drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 15 +++++++-------- + 1 file changed, 7 insertions(+), 8 deletions(-) + +--- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c ++++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +@@ -417,23 +417,22 @@ static int armada_37xx_gpio_direction_ou + unsigned int offset, int value) + { + struct armada_37xx_pinctrl *info = gpiochip_get_data(chip); +- unsigned int val_offset = offset; +- unsigned int reg = OUTPUT_EN; ++ unsigned int en_offset = offset; ++ unsigned int reg = OUTPUT_VAL; + unsigned int mask, val, ret; + + armada_37xx_update_reg(®, &offset); + mask = BIT(offset); ++ val = value ? mask : 0; + +- ret = regmap_update_bits(info->regmap, reg, mask, mask); +- ++ ret = regmap_update_bits(info->regmap, reg, mask, val); + if (ret) + return ret; + +- reg = OUTPUT_VAL; +- armada_37xx_update_reg(®, &val_offset); ++ reg = OUTPUT_EN; ++ armada_37xx_update_reg(®, &en_offset); + +- val = value ? mask : 0; +- regmap_update_bits(info->regmap, reg, mask, val); ++ regmap_update_bits(info->regmap, reg, mask, mask); + + return 0; + } diff --git a/target/linux/mvebu/patches-6.6/0003-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch b/target/linux/mvebu/patches-6.6/0003-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch new file mode 100644 index 00000000000000..2483dedfae7e82 --- /dev/null +++ b/target/linux/mvebu/patches-6.6/0003-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch @@ -0,0 +1,31 @@ +From 0396a8731efd17aec4719ad9981fefeaa13ffa56 Mon Sep 17 00:00:00 2001 +From: Gabor Juhos +Date: Wed, 14 May 2025 21:18:34 +0200 +Subject: [PATCH 3/7] pinctrl: armada-37xx: propagate error from + armada_37xx_gpio_direction_output() + +The regmap_update_bits() function can fail, so propagate its error +up to the stack instead of silently ignoring that. + +Signed-off-by: Imre Kaloz +Reviewed-by: Andrew Lunn +Signed-off-by: Gabor Juhos +Link: https://lore.kernel.org/20250514-pinctrl-a37xx-fixes-v2-3-07e9ac1ab737@gmail.com +Signed-off-by: Linus Walleij +--- + drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +--- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c ++++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +@@ -432,9 +432,7 @@ static int armada_37xx_gpio_direction_ou + reg = OUTPUT_EN; + armada_37xx_update_reg(®, &en_offset); + +- regmap_update_bits(info->regmap, reg, mask, mask); +- +- return 0; ++ return regmap_update_bits(info->regmap, reg, mask, mask); + } + + static int armada_37xx_gpio_get(struct gpio_chip *chip, unsigned int offset) diff --git a/target/linux/mvebu/patches-6.6/0004-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch b/target/linux/mvebu/patches-6.6/0004-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch new file mode 100644 index 00000000000000..4fe9f1b7b8628e --- /dev/null +++ b/target/linux/mvebu/patches-6.6/0004-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch @@ -0,0 +1,36 @@ +From 57273ff8bb16f3842c2597b5bbcd49e7fa12edf7 Mon Sep 17 00:00:00 2001 +From: Gabor Juhos +Date: Wed, 14 May 2025 21:18:35 +0200 +Subject: [PATCH 4/7] pinctrl: armada-37xx: propagate error from + armada_37xx_gpio_get() + +The regmap_read() function can fail, so propagate its error up to +the stack instead of silently ignoring that. + +Signed-off-by: Imre Kaloz +Reviewed-by: Andrew Lunn +Signed-off-by: Gabor Juhos +Link: https://lore.kernel.org/20250514-pinctrl-a37xx-fixes-v2-4-07e9ac1ab737@gmail.com +Signed-off-by: Linus Walleij +--- + drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c ++++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +@@ -440,11 +440,14 @@ static int armada_37xx_gpio_get(struct g + struct armada_37xx_pinctrl *info = gpiochip_get_data(chip); + unsigned int reg = INPUT_VAL; + unsigned int val, mask; ++ int ret; + + armada_37xx_update_reg(®, &offset); + mask = BIT(offset); + +- regmap_read(info->regmap, reg, &val); ++ ret = regmap_read(info->regmap, reg, &val); ++ if (ret) ++ return ret; + + return (val & mask) != 0; + } diff --git a/target/linux/mvebu/patches-6.6/0005-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch b/target/linux/mvebu/patches-6.6/0005-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch new file mode 100644 index 00000000000000..2395a0665fcc17 --- /dev/null +++ b/target/linux/mvebu/patches-6.6/0005-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch @@ -0,0 +1,42 @@ +From bfa0ff804ffa8b1246ade8be08de98c9eb19d16f Mon Sep 17 00:00:00 2001 +From: Gabor Juhos +Date: Wed, 14 May 2025 21:18:36 +0200 +Subject: [PATCH 5/7] pinctrl: armada-37xx: propagate error from + armada_37xx_pmx_gpio_set_direction() + +The armada_37xx_gpio_direction_{in,out}put() functions can fail, so +propagate their error values back to the stack instead of silently +ignoring those. + +Signed-off-by: Imre Kaloz +Reviewed-by: Andrew Lunn +Signed-off-by: Gabor Juhos +Link: https://lore.kernel.org/20250514-pinctrl-a37xx-fixes-v2-5-07e9ac1ab737@gmail.com +Signed-off-by: Linus Walleij +--- + drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +--- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c ++++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +@@ -472,16 +472,17 @@ static int armada_37xx_pmx_gpio_set_dire + { + struct armada_37xx_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); + struct gpio_chip *chip = range->gc; ++ int ret; + + dev_dbg(info->dev, "gpio_direction for pin %u as %s-%d to %s\n", + offset, range->name, offset, input ? "input" : "output"); + + if (input) +- armada_37xx_gpio_direction_input(chip, offset); ++ ret = armada_37xx_gpio_direction_input(chip, offset); + else +- armada_37xx_gpio_direction_output(chip, offset, 0); ++ ret = armada_37xx_gpio_direction_output(chip, offset, 0); + +- return 0; ++ return ret; + } + + static int armada_37xx_gpio_request_enable(struct pinctrl_dev *pctldev, diff --git a/target/linux/mvebu/patches-6.6/0006-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch b/target/linux/mvebu/patches-6.6/0006-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch new file mode 100644 index 00000000000000..9aac2e58e1ddbe --- /dev/null +++ b/target/linux/mvebu/patches-6.6/0006-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch @@ -0,0 +1,35 @@ +From 6481c0a83367b0672951ccc876fbae7ee37b594b Mon Sep 17 00:00:00 2001 +From: Gabor Juhos +Date: Wed, 14 May 2025 21:18:37 +0200 +Subject: [PATCH 6/7] pinctrl: armada-37xx: propagate error from + armada_37xx_gpio_get_direction() + +The regmap_read() function can fail, so propagate its error up to +the stack instead of silently ignoring that. + +Signed-off-by: Imre Kaloz +Reviewed-by: Andrew Lunn +Signed-off-by: Gabor Juhos +Link: https://lore.kernel.org/20250514-pinctrl-a37xx-fixes-v2-6-07e9ac1ab737@gmail.com +Signed-off-by: Linus Walleij +--- + drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c ++++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +@@ -402,10 +402,13 @@ static int armada_37xx_gpio_get_directio + struct armada_37xx_pinctrl *info = gpiochip_get_data(chip); + unsigned int reg = OUTPUT_EN; + unsigned int val, mask; ++ int ret; + + armada_37xx_update_reg(®, &offset); + mask = BIT(offset); +- regmap_read(info->regmap, reg, &val); ++ ret = regmap_read(info->regmap, reg, &val); ++ if (ret) ++ return ret; + + if (val & mask) + return GPIO_LINE_DIRECTION_OUT; diff --git a/target/linux/mvebu/patches-6.6/0007-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch b/target/linux/mvebu/patches-6.6/0007-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch new file mode 100644 index 00000000000000..6c14e50b4a733a --- /dev/null +++ b/target/linux/mvebu/patches-6.6/0007-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch @@ -0,0 +1,31 @@ +From 4229c28323db141eda69cb99427be75d3edba071 Mon Sep 17 00:00:00 2001 +From: Gabor Juhos +Date: Wed, 14 May 2025 21:18:38 +0200 +Subject: [PATCH 7/7] pinctrl: armada-37xx: propagate error from + armada_37xx_pmx_set_by_name() + +The regmap_update_bits() function can fail, so propagate its error +up to the stack instead of silently ignoring that. + +Signed-off-by: Imre Kaloz +Reviewed-by: Andrew Lunn +Signed-off-by: Gabor Juhos +Link: https://lore.kernel.org/20250514-pinctrl-a37xx-fixes-v2-7-07e9ac1ab737@gmail.com +Signed-off-by: Linus Walleij +--- + drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +--- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c ++++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +@@ -358,9 +358,7 @@ static int armada_37xx_pmx_set_by_name(s + + val = grp->val[func]; + +- regmap_update_bits(info->regmap, reg, mask, val); +- +- return 0; ++ return regmap_update_bits(info->regmap, reg, mask, val); + } + + static int armada_37xx_pmx_set(struct pinctrl_dev *pctldev, From bc8b4074002c91e2b776394bc23438f3c9566758 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Tue, 20 May 2025 11:25:17 +0200 Subject: [PATCH 674/877] mvebu: armada37xx: add pending PXA I2C recovery fix Import pending PXA I2C recovery fixes so that if I2C recovery is enabled in the DTS it does not completely break I2C as it currently does since kernel 6.6. Signed-off-by: Robert Marko (cherry picked from commit dfacae304915bcd316ac2d8c69bfe3f15749f5fa) --- ...30-01-i2c-add-init_recovery-callback.patch | 189 +++++++++++ ...ng-of-the-generic-recovery-init-code.patch | 224 +++++++++++++ ...ly-Bus-Busy-condition-on-Armada-3700.patch | 309 ++++++++++++++++++ 3 files changed, 722 insertions(+) create mode 100644 target/linux/mvebu/patches-6.6/830-01-i2c-add-init_recovery-callback.patch create mode 100644 target/linux/mvebu/patches-6.6/830-02-i2c-pxa-prevent-calling-of-the-generic-recovery-init-code.patch create mode 100644 target/linux/mvebu/patches-6.6/830-03-i2c-pxa-handle-Early-Bus-Busy-condition-on-Armada-3700.patch diff --git a/target/linux/mvebu/patches-6.6/830-01-i2c-add-init_recovery-callback.patch b/target/linux/mvebu/patches-6.6/830-01-i2c-add-init_recovery-callback.patch new file mode 100644 index 00000000000000..de46f339dec044 --- /dev/null +++ b/target/linux/mvebu/patches-6.6/830-01-i2c-add-init_recovery-callback.patch @@ -0,0 +1,189 @@ +From patchwork Sun May 11 13:31:05 2025 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Gabor Juhos +X-Patchwork-Id: 14084055 +Return-Path: + +X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on + aws-us-west-2-korg-lkml-1.web.codeaurora.org +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 smtp.lore.kernel.org (Postfix) with ESMTPS id 0802BC3ABC3 + for ; + Sun, 11 May 2025 13:35:46 +0000 (UTC) +DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; + d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help + :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References + :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: + From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: + Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; + bh=n9RYlne5nhTN7kCu5Yc7zW4CF0YUJUWg2clQo/viA0M=; b=LBsqIvaHPjMCwZZfbGyry56BIg + sEpAZY6rWjqf0DWQjODfNe8G8EZOzfHbMRA8HElCRdUR54+uQkesdQ9CuQip0FUIEkRlfRHM8HYTB + iWLgZE6pnElndi/4uhAmfvgQFvMbDhxrsoAqAjLY4K+sPr53QSEGO7ygY+TPHmcpyVfD+kRqjMAv3 + wbypdxFC5lHAOvIiAdaKreajEf7HBqztprh/D1aE29TQdWILixJTAl5isgLzJyZUOEnqrefGvBQ9g + +zg0jQwLLnjnsCMzkjho6mjwi1Q7I3ERQVRnebKf9eslmNstr9apYy5yfz6BKzHGxBk3yC+Boyvde + FP62KNGQ==; +Received: from localhost ([::1] helo=bombadil.infradead.org) + by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) + id 1uE6qC-00000007Glw-1vse; + Sun, 11 May 2025 13:35:40 +0000 +Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) + by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) + id 1uE6mD-00000007GP8-397T + for linux-arm-kernel@lists.infradead.org; + Sun, 11 May 2025 13:31:34 +0000 +Received: by mail-ej1-x630.google.com with SMTP id + a640c23a62f3a-ad1f6aa2f84so764633466b.0 + for ; + Sun, 11 May 2025 06:31:33 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=gmail.com; s=20230601; t=1746970292; x=1747575092; + darn=lists.infradead.org; + h=cc:to:in-reply-to:references:message-id:content-transfer-encoding + :mime-version:subject:date:from:from:to:cc:subject:date:message-id + :reply-to; + bh=n9RYlne5nhTN7kCu5Yc7zW4CF0YUJUWg2clQo/viA0M=; + b=mK6aKMspWjttCQGv7A/DF5F1n7JFLuDEaCeCKlEp4FrClZQD6JhAlON6yEPPTc86q2 + XnRAAh8tIk3Gu/QyNYXIsrlBeqtv5b+sxUxV+ebyFg0AaMi+tbhf8koryKoVPDMQljmm + i/Rv5GrycEwvnGMNsTHc+xLCwkjAy15KoLGdsfc+Uw3HrPmX+/8UFaVCmxltLgEprwVA + drnzRzYh3IIFjsPYJIrp75cIMMXIHwm2IqKiGuzMaDeCsB3iA/En8PHWr2trxMV7K98g + 442ZOjY0CqX1mAIKQLXmN7X3fCbOHinxxy7HefUe2YNclBf6UHr3pT2i9UBsalEpUWUl + OQ7A== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20230601; t=1746970292; x=1747575092; + h=cc:to:in-reply-to:references:message-id:content-transfer-encoding + :mime-version:subject:date:from:x-gm-message-state:from:to:cc + :subject:date:message-id:reply-to; + bh=n9RYlne5nhTN7kCu5Yc7zW4CF0YUJUWg2clQo/viA0M=; + b=HSWiBJsVViBeM5B5hMn4oUOZ7JTd6/O5/rjNuDl1Q//i4aFGGSy0L11zacjYVSLegk + 2j9UiS7yLaVSlnNJle+YrtIy/kbCayoNUrYXtU5v9MvYAHjS0WMYijekCDQ9+lDLpXwg + kpERQ/Tu1Fmqb+8Yv/XycWLCyTPR0XGXxVvGiAPs1KnXsuj71MK7/HXof0p3IDqS444Q + dBuRDx1xby4/806P/EPvdr4Xj0lVF3tkimKtaPpBdXp+kkJ8xyYlMhLHAUX16F8Xktqs + yuzG1OASvIocfiEiluOxqrM6727wJhtt8qiBxCiI/UBaEr5bUkIBvmvktYSVy+/N4Itf + +qAw== +X-Forwarded-Encrypted: i=1; + AJvYcCWF5SWWguUIUPp10Yp8M+dIc/7999B/vb7xwMluPb/Vj9FZyJ4hnhDgLC60CD9icfYXYWwLlHN06vKw5onkKXF5@lists.infradead.org +X-Gm-Message-State: AOJu0Yx7y5pv/+Mt1FmIK+MTvi1kVFAvXtKteYPDneNKNfNZuwqrLoNt + F6DpKLyTyp8r/NQFiROomu/JLI5qMM4JRr5VwmbDeYC0dWKD4xH1 +X-Gm-Gg: ASbGncttO+Rf69HYuAf22AOp+cMso2pjn2/z/ZJhaxvqOUUqzypHmtdf5RV1S1/NJt+ + 2U8XzEy/JHeASbx9scc+3q0mJPtPNp8qCQpF+0zPaU8cbrfcsiggtSVfMhZP6sxqoI2iJtnMdLF + JVZhFcynNHOqZYLBh8pWdnToMBYILJM7VhgFcJZIeDPaGbC5JDSKus+OUR31/TKl/K/+83r309I + dYCCeBcJgLPA+Z5pDDHhFh/tjag+5ID+tTI3hH7IrEjz0LCb3DFL0QEsrwm9yQn4xUtQ9ms+KST + 4DF3TYm4r0/Uqf8zWSPTbC4CL69YtYYBDCt22gKAW+PPDTQ4UBcDfIwI7MxiOOT2rnjfzWNtD+1 + 6uO29 +X-Google-Smtp-Source: + AGHT+IFAmDDIIuhS51ef1EGvEQpU//VoeH0fQBhRPIfrKUiYydYis8s+qNymb53gRE7q67J/kVk0HA== +X-Received: by 2002:a17:907:94d5:b0:acb:3acd:2845 with SMTP id + a640c23a62f3a-ad1fccfced9mr1181053766b.25.1746970291841; + Sun, 11 May 2025 06:31:31 -0700 (PDT) +Received: from [192.168.0.253] (5D59A51C.catv.pool.telekom.hu. [93.89.165.28]) + by smtp.googlemail.com with ESMTPSA id + a640c23a62f3a-ad2197bd398sm466765366b.152.2025.05.11.06.31.30 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Sun, 11 May 2025 06:31:31 -0700 (PDT) +From: Gabor Juhos +Date: Sun, 11 May 2025 15:31:05 +0200 +Subject: [PATCH 1/3] i2c: add init_recovery() callback +MIME-Version: 1.0 +Message-Id: + <20250511-i2c-pxa-fix-i2c-communication-v1-1-e9097d09a015@gmail.com> +References: + <20250511-i2c-pxa-fix-i2c-communication-v1-0-e9097d09a015@gmail.com> +In-Reply-To: + <20250511-i2c-pxa-fix-i2c-communication-v1-0-e9097d09a015@gmail.com> +To: Wolfram Sang , Andi Shyti , + Russell King , Andrew Lunn +Cc: Robert Marko , + Linus Walleij , + Russell King , linux-i2c@vger.kernel.org, + linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, + Gabor Juhos , Imre Kaloz , + stable@vger.kernel.org +X-Mailer: b4 0.14.2 +X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 +X-CRM114-CacheID: sfid-20250511_063133_790603_F3EAC078 +X-CRM114-Status: GOOD ( 20.27 ) +X-BeenThere: linux-arm-kernel@lists.infradead.org +X-Mailman-Version: 2.1.34 +Precedence: list +List-Id: +List-Unsubscribe: + , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: + , + +Sender: "linux-arm-kernel" +Errors-To: + linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org + +Add a new init_recovery() callback to struct 'i2c_bus_recovery_info' +and modify the i2c_init_recovery() function to call that if specified +instead of the generic i2c_gpio_init_recovery() function. + +This allows controller drivers to skip calling the generic code by +implementing a dummy callback function, or alternatively to run a +fine tuned custom implementation. + +This is needed for the 'i2c-pxa' driver in order to be able to fix +a long standing bug for which the fix will be implemented in a +followup patch. + +Cc: stable@vger.kernel.org # 6.3+ +Signed-off-by: Gabor Juhos +Signed-off-by: Imre Kaloz +Reviewed-by: Linus Walleij +--- + drivers/i2c/i2c-core-base.c | 8 +++++++- + include/linux/i2c.h | 4 ++++ + 2 files changed, 11 insertions(+), 1 deletion(-) + +--- a/drivers/i2c/i2c-core-base.c ++++ b/drivers/i2c/i2c-core-base.c +@@ -427,12 +427,18 @@ static int i2c_init_recovery(struct i2c_ + struct i2c_bus_recovery_info *bri = adap->bus_recovery_info; + bool is_error_level = true; + char *err_str; ++ int ret; + + if (!bri) + return 0; + +- if (i2c_gpio_init_recovery(adap) == -EPROBE_DEFER) ++ if (bri->init_recovery) { ++ ret = bri->init_recovery(adap); ++ if (ret) ++ return ret; ++ } else if (i2c_gpio_init_recovery(adap) == -EPROBE_DEFER) { + return -EPROBE_DEFER; ++ } + + if (!bri->recover_bus) { + err_str = "no suitable method provided"; +--- a/include/linux/i2c.h ++++ b/include/linux/i2c.h +@@ -622,6 +622,9 @@ struct i2c_timings { + * for generic GPIO recovery. + * @get_bus_free: Returns the bus free state as seen from the IP core in case it + * has a more complex internal logic than just reading SDA. Optional. ++ * @init_recovery: If specified, it will be called instead of the generic GPIO ++ * recovery initialization code. Platform may use a dummy callback to skip ++ * calling the generic code, or it may use a custom implementation. + * @prepare_recovery: This will be called before starting recovery. Platform may + * configure padmux here for SDA/SCL line or something else they want. + * @unprepare_recovery: This will be called after completing recovery. Platform +@@ -646,6 +649,7 @@ struct i2c_bus_recovery_info { + void (*set_sda)(struct i2c_adapter *adap, int val); + int (*get_bus_free)(struct i2c_adapter *adap); + ++ int (*init_recovery)(struct i2c_adapter *adap); + void (*prepare_recovery)(struct i2c_adapter *adap); + void (*unprepare_recovery)(struct i2c_adapter *adap); + diff --git a/target/linux/mvebu/patches-6.6/830-02-i2c-pxa-prevent-calling-of-the-generic-recovery-init-code.patch b/target/linux/mvebu/patches-6.6/830-02-i2c-pxa-prevent-calling-of-the-generic-recovery-init-code.patch new file mode 100644 index 00000000000000..a05cedcefea82c --- /dev/null +++ b/target/linux/mvebu/patches-6.6/830-02-i2c-pxa-prevent-calling-of-the-generic-recovery-init-code.patch @@ -0,0 +1,224 @@ +From patchwork Sun May 11 13:31:06 2025 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Gabor Juhos +X-Patchwork-Id: 14084056 +Return-Path: + +X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on + aws-us-west-2-korg-lkml-1.web.codeaurora.org +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 smtp.lore.kernel.org (Postfix) with ESMTPS id 72E7DC3ABC3 + for ; + Sun, 11 May 2025 13:37:50 +0000 (UTC) +DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; + d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help + :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References + :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: + From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: + Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; + bh=BySnXAIGhp18eRP0sg1mjpdXdHwBsus0rtjMi26U9uM=; b=ba0yGs/0cSs2cep9T3wjo3iDxy + VSaQu2j7YGuiAMJt8ERY5OVL7YiPC/6+MqGcLqkrGunZq/TEjXRGX9ztKqyko6KY9fLbiH1wXYBjK + /9yxbEyt9bPrIw/r64uaUOdRzZMF0i2oBn53RgZJJFaD4ou1E28BMc22AuVGshj99Dlz63ncr/Lz7 + M3/ptMOWGRp0SrImYRUdvnWj+LKyb4zqRFEYIQuq9WzyhhNuDZDaHFpdJn4go/eoS4kUvTFfixpwV + FevQupqdOn62R3ull5YYdI6BFQVL6dISjD34mjoNXJABSjuXmq8FRWuX/V3rPrvnVIflxOmzSrKrF + 8rdYY/fg==; +Received: from localhost ([::1] helo=bombadil.infradead.org) + by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) + id 1uE6sA-00000007GuC-0j29; + Sun, 11 May 2025 13:37:42 +0000 +Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) + by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) + id 1uE6mF-00000007GPb-1uOE + for linux-arm-kernel@lists.infradead.org; + Sun, 11 May 2025 13:31:36 +0000 +Received: by mail-ej1-x636.google.com with SMTP id + a640c23a62f3a-acae7e7587dso539429266b.2 + for ; + Sun, 11 May 2025 06:31:35 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=gmail.com; s=20230601; t=1746970294; x=1747575094; + darn=lists.infradead.org; + h=cc:to:in-reply-to:references:message-id:content-transfer-encoding + :mime-version:subject:date:from:from:to:cc:subject:date:message-id + :reply-to; + bh=BySnXAIGhp18eRP0sg1mjpdXdHwBsus0rtjMi26U9uM=; + b=QtIYufKg61b066knR9OpyawErNmkYyoP/2lIkHhyGY7qtGXkc1jJmC0TpPyhp0WGlm + xWP3K/PG23VcjEuGj/880thPietuKQuTF029WPfm+yrQ3uHLMzkHqyOiMYyiBR9N0Zjw + NICgywX4iqVHVBnXZTiBA7sRSjQqteatDPTGbKgZxpIHpg4ZJtfXZcCE8RiKVVgZCWsq + JgTJuTO/4J0cq5TWVOIGLrt0XOslaMmuISPbUDdArr5yKfGZqu51i747A0o0RBdEuH9Y + UPI8/GExcWWa+62KCVEwB9OmCZR81ieb8To/XdZO8hIQAlExOzKa3OOPCkS0PF0M9BBa + d++Q== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20230601; t=1746970294; x=1747575094; + h=cc:to:in-reply-to:references:message-id:content-transfer-encoding + :mime-version:subject:date:from:x-gm-message-state:from:to:cc + :subject:date:message-id:reply-to; + bh=BySnXAIGhp18eRP0sg1mjpdXdHwBsus0rtjMi26U9uM=; + b=A+LfIVmyzogyr2akFoGR3PIbjd8E/TVXGlur91KBF7h2W8msMTeMyv0PDVjqEBxWFI + cqNLira3TWf9soXrRBGaJVB111/r5woARoN4aO5otCDrh3o5U2gJ5/eZLGbcX49TqJG5 + rbI1Eq0GGXFdidQ4T5CMLtooa6B5pg7j+o2gcyG/vQlHr6MbG4/2sIDPX0JbL08xibWC + 5LqP933W+yopGIbnp3YZ9pybbvOUA9x4cYkUm1Of3idmkTN0xUh8kmUWz7FJCH4R/PAN + 5CA/vn8q1myUvXisU0oAbC9y/WrlExPfvguXjru1LTx9AdPaC9+D3Qxmh2Raz9b4NrKl + ZlVw== +X-Forwarded-Encrypted: i=1; + AJvYcCWMm/Er5t6Xp05DMDNak7mbsqx8YZmOrqz9Y39eovLKPkbqcMhQwOzxqxCY8ZfQtETNpZ8X9NptEow+bBHo+z3t@lists.infradead.org +X-Gm-Message-State: AOJu0YwBTrjBcryZjqJBq66bcSYfV2AWsDAqAfMinxG8gRUJjpKq8RXn + kKSKTp2XvMObVTWx7cEMM5BBPWl7LfLwBkjVIusbgScQ8qW8YA9H +X-Gm-Gg: ASbGnctKtEUhBLJdOfPb7cKwM8a1ZTe5+8zPX9TaLdomZybHHeteF9o/ZyUNbunUsSK + fuMy3pPFmYcC4TZtPqfZPdpagbDpOb2R/9xbSTMd1TKDDj4vFnkTIzQHA9E1ZxX44Nw6JkxA0up + S94PBow9mEb3tkHLN9hbNe7W8ksyf7RZ25IGC4FYj/wEGQsMy2VidJsfG4bIeImZ8zj8ufUCNby + 7jIjmP1taNt5U8omPEWhFuRdJfiPqIXx85tIsGVFwG7VSr/JW8LwxBCJLGhWLUZhxYqV4cEfSRC + zYKj2qkuRfx5AxzN+JGtfcxYPijsy/rI51OnjOv2CQRPuE6rESamNJiR7pmnDgvHSRm5nps5chp + /HVXU +X-Google-Smtp-Source: + AGHT+IG8Y/7VNg8lhY275mIfLbq8EaG9jCRvvK1wX7rlbuoMvEUYYC3k7sZOxh3RPmKhAB94Kfvlwg== +X-Received: by 2002:a17:907:7b04:b0:ad1:fab8:88ab with SMTP id + a640c23a62f3a-ad219085c07mr897192766b.29.1746970293535; + Sun, 11 May 2025 06:31:33 -0700 (PDT) +Received: from [192.168.0.253] (5D59A51C.catv.pool.telekom.hu. [93.89.165.28]) + by smtp.googlemail.com with ESMTPSA id + a640c23a62f3a-ad2197bd398sm466765366b.152.2025.05.11.06.31.32 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Sun, 11 May 2025 06:31:33 -0700 (PDT) +From: Gabor Juhos +Date: Sun, 11 May 2025 15:31:06 +0200 +Subject: [PATCH 2/3] i2c: pxa: prevent calling of the generic recovery init + code +MIME-Version: 1.0 +Message-Id: + <20250511-i2c-pxa-fix-i2c-communication-v1-2-e9097d09a015@gmail.com> +References: + <20250511-i2c-pxa-fix-i2c-communication-v1-0-e9097d09a015@gmail.com> +In-Reply-To: + <20250511-i2c-pxa-fix-i2c-communication-v1-0-e9097d09a015@gmail.com> +To: Wolfram Sang , Andi Shyti , + Russell King , Andrew Lunn +Cc: Robert Marko , + Linus Walleij , + Russell King , linux-i2c@vger.kernel.org, + linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, + Gabor Juhos , Imre Kaloz , + stable@vger.kernel.org +X-Mailer: b4 0.14.2 +X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 +X-CRM114-CacheID: sfid-20250511_063135_499888_294068DC +X-CRM114-Status: GOOD ( 21.30 ) +X-BeenThere: linux-arm-kernel@lists.infradead.org +X-Mailman-Version: 2.1.34 +Precedence: list +List-Id: +List-Unsubscribe: + , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: + , + +Sender: "linux-arm-kernel" +Errors-To: + linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org + +The I2C communication is completely broken on the Armada 3700 platform +since commit 0b01392c18b9 ("i2c: pxa: move to generic GPIO recovery"). + +For example, on the Methode uDPU board, probing of the two onboard +temperature sensors fails ... + + [ 7.271713] i2c i2c-0: using pinctrl states for GPIO recovery + [ 7.277503] i2c i2c-0: PXA I2C adapter + [ 7.282199] i2c i2c-1: using pinctrl states for GPIO recovery + [ 7.288241] i2c i2c-1: PXA I2C adapter + [ 7.292947] sfp sfp-eth1: Host maximum power 3.0W + [ 7.299614] sfp sfp-eth0: Host maximum power 3.0W + [ 7.308178] lm75 1-0048: supply vs not found, using dummy regulator + [ 32.489631] lm75 1-0048: probe with driver lm75 failed with error -121 + [ 32.496833] lm75 1-0049: supply vs not found, using dummy regulator + [ 82.890614] lm75 1-0049: probe with driver lm75 failed with error -121 + +... and accessing the plugged-in SFP modules also does not work: + + [ 511.298537] sfp sfp-eth1: please wait, module slow to respond + [ 536.488530] sfp sfp-eth0: please wait, module slow to respond + ... + [ 1065.688536] sfp sfp-eth1: failed to read EEPROM: -EREMOTEIO + [ 1090.888532] sfp sfp-eth0: failed to read EEPROM: -EREMOTEIO + +After a discussion [1], there was an attempt to fix the problem by +reverting the offending change by commit 7b211c767121 ("Revert "i2c: +pxa: move to generic GPIO recovery""), but that only helped to fix +the issue in the 6.1.y stable tree. The reason behind the partial succes +is that there was another change in commit 20cb3fce4d60 ("i2c: Set i2c +pinctrl recovery info from it's device pinctrl") in the 6.3-rc1 cycle +which broke things further. + +The cause of the problem is the same in case of both offending commits +mentioned above. Namely, the I2C core code changes the pinctrl state to +GPIO while running the recovery initialization code. Although the PXA +specific initialization also does this, but the key difference is that +it happens before the conrtoller is getting enabled in i2c_pxa_reset(), +whereas in the case of the generic initialization it happens after that. + +To resolve the problem, provide an empty init_recovery() callback +function thus preventing the I2C core to call the generic recovery +initialization code. + +As the result this change restores the original behaviour, which in +turn makes the I2C communication to work again as it can be seen from +the following log: + + [ 7.305277] i2c i2c-0: PXA I2C adapter + [ 7.310198] i2c i2c-1: PXA I2C adapter + [ 7.315012] sfp sfp-eth1: Host maximum power 3.0W + [ 7.324061] lm75 1-0048: supply vs not found, using dummy regulator + [ 7.331738] sfp sfp-eth0: Host maximum power 3.0W + [ 7.337000] hwmon hwmon0: temp1_input not attached to any thermal zone + [ 7.343593] lm75 1-0048: hwmon0: sensor 'tmp75c' + [ 7.348526] lm75 1-0049: supply vs not found, using dummy regulator + [ 7.356858] hwmon hwmon1: temp1_input not attached to any thermal zone + [ 7.363463] lm75 1-0049: hwmon1: sensor 'tmp75c' + ... + [ 7.730315] sfp sfp-eth1: module Mikrotik S-RJ01 rev 1.0 sn 61B103C55C58 dc 201022 + [ 7.840318] sfp sfp-eth0: module MENTECHOPTO POS22-LDCC-KR rev 1.0 sn MNC208U90009 dc 200828 + [ 7.850083] mvneta d0030000.ethernet eth0: unsupported SFP module: no common interface modes + [ 7.990335] hwmon hwmon2: temp1_input not attached to any thermal zone + +[1] https://lore.kernel.org/r/20230926160255.330417-1-robert.marko@sartura.hr + +Cc: stable@vger.kernel.org # 6.3+ +Fixes: 20cb3fce4d60 ("i2c: Set i2c pinctrl recovery info from it's device pinctrl") +Signed-off-by: Gabor Juhos +Signed-off-by: Imre Kaloz +--- + drivers/i2c/busses/i2c-pxa.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/drivers/i2c/busses/i2c-pxa.c ++++ b/drivers/i2c/busses/i2c-pxa.c +@@ -1331,6 +1331,12 @@ static void i2c_pxa_unprepare_recovery(s + i2c_pxa_enable(i2c); + } + ++static int i2c_pxa_init_recovery_cb(struct i2c_adapter *adap) ++{ ++ /* We have initialized everything already, so nothing to do here. */ ++ return 0; ++} ++ + static int i2c_pxa_init_recovery(struct pxa_i2c *i2c) + { + struct i2c_bus_recovery_info *bri = &i2c->recovery; +@@ -1399,6 +1405,7 @@ static int i2c_pxa_init_recovery(struct + return 0; + } + ++ bri->init_recovery = i2c_pxa_init_recovery_cb; + bri->prepare_recovery = i2c_pxa_prepare_recovery; + bri->unprepare_recovery = i2c_pxa_unprepare_recovery; + bri->recover_bus = i2c_generic_scl_recovery; diff --git a/target/linux/mvebu/patches-6.6/830-03-i2c-pxa-handle-Early-Bus-Busy-condition-on-Armada-3700.patch b/target/linux/mvebu/patches-6.6/830-03-i2c-pxa-handle-Early-Bus-Busy-condition-on-Armada-3700.patch new file mode 100644 index 00000000000000..52ccb8cf08cd7a --- /dev/null +++ b/target/linux/mvebu/patches-6.6/830-03-i2c-pxa-handle-Early-Bus-Busy-condition-on-Armada-3700.patch @@ -0,0 +1,309 @@ +From patchwork Sun May 11 13:31:07 2025 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Gabor Juhos +X-Patchwork-Id: 14084057 +Return-Path: + +X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on + aws-us-west-2-korg-lkml-1.web.codeaurora.org +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 smtp.lore.kernel.org (Postfix) with ESMTPS id E1323C3ABC3 + for ; + Sun, 11 May 2025 13:39:50 +0000 (UTC) +DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; + d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help + :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References + :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: + From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: + Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; + bh=jCnitIQrLGML0v/ZGaz7m1EqKZaS5okX2gqREoZgqFA=; b=gjUPiYgZ9tzalLC8hdQSBahsEr + yHwsfVsfhm/onN8EySOnZ9iefbvCDb/y94s1ll7+f7UeDZ3epWr0Kl1WPgPVKwCa7AIYumKWi/l4S + rNqCfOmyVGO0CspTKlxvV/ZHk+jAJqKqHmd/QtVxJkMi4a9d1J8BMHWdltfYPvpkJkaKxx9WINZ5v + BftwJv2+35b3ZWGRWYXmCBFUXaV/w6I0+dE51I25k4NZcTMRbR1sGYEXTm5Eu2KBtJ/UbhiKKCk0b + +BTg/BJ/O7lSKl/W3DHnImYv6s65FMGxgHCaKZlN/IWCWLanqi2hg3hmGlDqyZUvezUrcuYEed2et + w6FrGCGg==; +Received: from localhost ([::1] helo=bombadil.infradead.org) + by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) + id 1uE6u7-00000007H4F-41sI; + Sun, 11 May 2025 13:39:43 +0000 +Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]) + by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) + id 1uE6mG-00000007GQ2-3M7w + for linux-arm-kernel@lists.infradead.org; + Sun, 11 May 2025 13:31:37 +0000 +Received: by mail-ej1-x62e.google.com with SMTP id + a640c23a62f3a-ad1a87d93f7so576360566b.0 + for ; + Sun, 11 May 2025 06:31:36 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=gmail.com; s=20230601; t=1746970295; x=1747575095; + darn=lists.infradead.org; + h=cc:to:in-reply-to:references:message-id:content-transfer-encoding + :mime-version:subject:date:from:from:to:cc:subject:date:message-id + :reply-to; + bh=jCnitIQrLGML0v/ZGaz7m1EqKZaS5okX2gqREoZgqFA=; + b=dFmhAe55mI0ZYgTbA9z06jAcGpibU1yIvZWl8vsEWd0Cow+yYkQlcsnlJcoq22vUt+ + An87/vI28iqdwgYZpu+vabyC6ytUUqI5IuqTOlv/QtLak3Oi6cbHjoebb9cVfGhTpO16 + gN8BLLH5Lf9shCAy3lLQahAf3jiE41hB3YKxIusuBnm+DIMYVGMJID5Pt72YgU322uXW + hnMLbX75rnBu5DTGM12UT9+nOkBYjITOdnfEA+o3IVlzUEQRr/G7s9RNKTKnsjJDwaZb + 91UdhJBE/yz2fiFrtN6PGr1B90kJd+GAxRjrbQ8UunMu6C4ggE6aRazKcsQEZIWLa6tR + n/Vg== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20230601; t=1746970295; x=1747575095; + h=cc:to:in-reply-to:references:message-id:content-transfer-encoding + :mime-version:subject:date:from:x-gm-message-state:from:to:cc + :subject:date:message-id:reply-to; + bh=jCnitIQrLGML0v/ZGaz7m1EqKZaS5okX2gqREoZgqFA=; + b=tlFtjTi8qCbMBXjF1lESzpnVH51JUuhJV5lirRh7dyHdWcVtBgKdnrbGpR+ZDHFvvV + 1FJUR377ZyrZPwleAZ8bfUcjMx1NSDhxGsHI+05Mpt7LzRZCCUE/nuTHROytYhalDR35 + yh8YprIJwMhZ9zFNNXrZ/GQCPbRMA0fkOJYWCfMRPsf+VGHsDniGzF9Dbsy3aq0hG+mw + 5r85WCALVE55cSW22kla9QPeOxpX6nheglHKz2svFKgo+nI9xXgcR2F9vsSah5DBTxkQ + WK1fEkdtF+6If4W/u3cZ1kQTbkrifLbpV8i+z6VqFq+iRZuf9eZjyyuMXP53A7PQGpW3 + BKKA== +X-Forwarded-Encrypted: i=1; + AJvYcCWtVH3IlKfQOiuwxLM94ic5Bi0XTfGdTLWK5BWhh9b026VHto4M4zjf8wBmIUmekjUFrgWvBcW3eJkv9VuD0NNu@lists.infradead.org +X-Gm-Message-State: AOJu0YxUrhwcNLQkyGCiTZ3Ci5GaLENJhrPiMNwOQ2HqRWQ5fFYTksDJ + 6eb+myA0GGrJOmcEortiBND+ipH4vXcxwtKOVyNjgBBJMq27NJBTQ16Asw== +X-Gm-Gg: ASbGncu1guGFlZm8KpI1qJ3LeFM8WO7ZvfanWSzK7lzUZES0sLxvvjBNy8SgeycdGUF + QifE6Z+xBPK9i0m0CRfzWuNm9a/dr/W14EAzBiSWq5pOW0fbH1rGo/FFbaUZ8T7OroQ0wipdZ9J + tIZJz+dbSRk4kRsYhhm4cJZh4GfKL8me6+8NM/db/a0oKAE0VMhHLmqDw0BFjgpwdWO4YnaUBLt + MU5Pu+S3TKwVV7SHRma2c7662QZ2pxXIngJdGW2qnrr1TejUMaK39IRBPm7sgzBCntS8fd9uVdb + 35NbstsZrboDcHBnDhFroXwe5QWwncAo1aJm/DVM39fE5OCOqNDp7iz6XZbPE/fzVdEDg00L9fR + x8yAy +X-Google-Smtp-Source: + AGHT+IFtWSfALiUVVnpFFz7ImelE+nmATZJYkY40gYG/szbhM9XPyGAl4heVD8RQkSCE7sXqGFzn6Q== +X-Received: by 2002:a17:907:d30e:b0:ad2:4cad:9824 with SMTP id + a640c23a62f3a-ad24cad9bd2mr198358366b.28.1746970294838; + Sun, 11 May 2025 06:31:34 -0700 (PDT) +Received: from [192.168.0.253] (5D59A51C.catv.pool.telekom.hu. [93.89.165.28]) + by smtp.googlemail.com with ESMTPSA id + a640c23a62f3a-ad2197bd398sm466765366b.152.2025.05.11.06.31.33 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Sun, 11 May 2025 06:31:34 -0700 (PDT) +From: Gabor Juhos +Date: Sun, 11 May 2025 15:31:07 +0200 +Subject: [PATCH 3/3] i2c: pxa: handle 'Early Bus Busy' condition on Armada + 3700 +MIME-Version: 1.0 +Message-Id: + <20250511-i2c-pxa-fix-i2c-communication-v1-3-e9097d09a015@gmail.com> +References: + <20250511-i2c-pxa-fix-i2c-communication-v1-0-e9097d09a015@gmail.com> +In-Reply-To: + <20250511-i2c-pxa-fix-i2c-communication-v1-0-e9097d09a015@gmail.com> +To: Wolfram Sang , Andi Shyti , + Russell King , Andrew Lunn +Cc: Robert Marko , + Linus Walleij , + Russell King , linux-i2c@vger.kernel.org, + linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, + Gabor Juhos , Imre Kaloz , + stable@vger.kernel.org +X-Mailer: b4 0.14.2 +X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 +X-CRM114-CacheID: sfid-20250511_063136_845554_2BF89522 +X-CRM114-Status: GOOD ( 32.59 ) +X-BeenThere: linux-arm-kernel@lists.infradead.org +X-Mailman-Version: 2.1.34 +Precedence: list +List-Id: +List-Unsubscribe: + , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: + , + +Sender: "linux-arm-kernel" +Errors-To: + linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org + +Under some circumstances I2C recovery fails on Armada 3700. At least +on the Methode uDPU board, removing and replugging an SFP module fails +often, like this: + + [ 36.953127] sfp sfp-eth1: module removed + [ 38.468549] i2c i2c-1: i2c_pxa: timeout waiting for bus free + [ 38.486960] sfp sfp-eth1: module MENTECHOPTO POS22-LDCC-KR rev 1.0 sn MNC208U90009 dc 200828 + [ 38.496867] mvneta d0040000.ethernet eth1: unsupported SFP module: no common interface modes + [ 38.521448] hwmon hwmon2: temp1_input not attached to any thermal zone + [ 39.249196] sfp sfp-eth1: module removed + ... + [ 292.568799] sfp sfp-eth1: please wait, module slow to respond + ... + [ 625.208814] sfp sfp-eth1: failed to read EEPROM: -EREMOTEIO + +Note that the 'unsupported SFP module' messages are not relevant. The +module is used only for testing the I2C recovery funcionality, because +the error can be triggered easily with this specific one. + +Enabling debug in the i2c-pxa driver reveals the following: + + [ 82.034678] sfp sfp-eth1: module removed + [ 90.008654] i2c i2c-1: slave_0x50 error: timeout with active message + [ 90.015112] i2c i2c-1: msg_num: 2 msg_idx: 0 msg_ptr: 0 + [ 90.020464] i2c i2c-1: IBMR: 00000003 IDBR: 000000a0 ICR: 000007e0 ISR: 00000802 + [ 90.027906] i2c i2c-1: log: + [ 90.030787] + +This continues until the retries are exhausted ... + + [ 110.192489] i2c i2c-1: slave_0x50 error: exhausted retries + [ 110.198012] i2c i2c-1: msg_num: 2 msg_idx: 0 msg_ptr: 0 + [ 110.203323] i2c i2c-1: IBMR: 00000003 IDBR: 000000a0 ICR: 000007e0 ISR: 00000802 + [ 110.210810] i2c i2c-1: log: + [ 110.213633] + +... then the whole sequence starts again ... + + [ 115.368641] i2c i2c-1: slave_0x50 error: timeout with active message + +... while finally the SFP core gives up: + + [ 671.975258] sfp sfp-eth1: failed to read EEPROM: -EREMOTEIO + +When we analyze the log, it can be seen that bit 1 and 11 is set in the +ISR (Interface Status Register). Bit 1 indicates the ACK/NACK status, but +the purpose of bit 11 is not documented in the driver code unfortunately. + +The 'Functional Specification' document of the Armada 3700 SoCs family +however says that this bit indicates an 'Early Bus Busy' condition. The +document also notes that whenever this bit is set, it is not possible to +initiate a transaction on the I2C bus. The observed behaviour corresponds +to this statement. + +Unfortunately, I2C recovery does not help as it never runs in this +special case. Although the driver checks the busyness of the bus at +several places, but since it does not consider the A3700 specific bit +in these checks it can't determine the actual status of the bus correctly +which results in the errors above. + +In order to fix the problem, add a new member to struct 'i2c_pxa' to +store a controller specific bitmask containing the bits indicating the +busy status, and use that in the code while checking the actual status +of the bus. This ensures that the correct status can be determined on +the Armada 3700 based devices without causing functional changes on +devices based on other SoCs. + +With the change applied, the driver detects the busy condition, and runs +the recovery process: + + [ 742.617312] i2c i2c-1: state:i2c_pxa_wait_bus_not_busy:449: ISR=00000802, ICR=000007e0, IBMR=03 + [ 742.626099] i2c i2c-1: i2c_pxa: timeout waiting for bus free + [ 742.631933] i2c i2c-1: recovery: resetting controller, ISR=0x00000802 + [ 742.638421] i2c i2c-1: recovery: IBMR 0x00000003 ISR 0x00000000 + +This clears the EBB bit in the ISR register, so it makes it possible to +initiate transactions on the I2C bus again. + +After this patch, the SFP module used for testing can be removed and +replugged numerous times without causing the error described at the +beginning. Previously, the error happened after a few such attempts. + +The patch has been tested also with the following kernel versions: +5.10.237, 5.15.182, 6.1.138, 6.6.90, 6.12.28, 6.14.6. It improves +recoverabilty on all of them. + +Cc: stable@vger.kernel.org # 5.8+ +Fixes: 7c9ec2c52518 ("i2c: pxa: implement generic i2c bus recovery") +Signed-off-by: Gabor Juhos +Signed-off-by: Imre Kaloz +--- +Note: the patch is included in this series for completeness however +it can be applied independently from the preceding patches. On kernels +6.3+, it restores I2C functionality even in itself because it recovers +the controller from the bad state described in the previous patch. +--- + drivers/i2c/busses/i2c-pxa.c | 18 ++++++++++++------ + 1 file changed, 12 insertions(+), 6 deletions(-) + +--- a/drivers/i2c/busses/i2c-pxa.c ++++ b/drivers/i2c/busses/i2c-pxa.c +@@ -70,6 +70,7 @@ + #define ISR_GCAD (1 << 8) /* general call address detected */ + #define ISR_SAD (1 << 9) /* slave address detected */ + #define ISR_BED (1 << 10) /* bus error no ACK/NAK */ ++#define ISR_A3700_EBB (1 << 11) /* early bus busy for armada 3700 */ + + #define ILCR_SLV_SHIFT 0 + #define ILCR_SLV_MASK (0x1FF << ILCR_SLV_SHIFT) +@@ -262,6 +263,7 @@ struct pxa_i2c { + bool highmode_enter; + u32 fm_mask; + u32 hs_mask; ++ u32 busy_mask; + + struct i2c_bus_recovery_info recovery; + struct pinctrl *pinctrl; +@@ -428,7 +430,7 @@ static int i2c_pxa_wait_bus_not_busy(str + + while (1) { + isr = readl(_ISR(i2c)); +- if (!(isr & (ISR_IBB | ISR_UB))) ++ if (!(isr & i2c->busy_mask)) + return 0; + + if (isr & ISR_SAD) +@@ -465,7 +467,7 @@ static int i2c_pxa_wait_master(struct px + * quick check of the i2c lines themselves to ensure they've + * gone high... + */ +- if ((readl(_ISR(i2c)) & (ISR_UB | ISR_IBB)) == 0 && ++ if ((readl(_ISR(i2c)) & i2c->busy_mask) == 0 && + readl(_IBMR(i2c)) == (IBMR_SCLS | IBMR_SDAS)) { + if (i2c_debug > 0) + dev_dbg(&i2c->adap.dev, "%s: done\n", __func__); +@@ -486,7 +488,7 @@ static int i2c_pxa_set_master(struct pxa + if (i2c_debug) + dev_dbg(&i2c->adap.dev, "setting to bus master\n"); + +- if ((readl(_ISR(i2c)) & (ISR_UB | ISR_IBB)) != 0) { ++ if ((readl(_ISR(i2c)) & i2c->busy_mask) != 0) { + dev_dbg(&i2c->adap.dev, "%s: unit is busy\n", __func__); + if (!i2c_pxa_wait_master(i2c)) { + dev_dbg(&i2c->adap.dev, "%s: error: unit busy\n", __func__); +@@ -512,7 +514,7 @@ static int i2c_pxa_wait_slave(struct pxa + dev_dbg(&i2c->adap.dev, "%s: %ld: ISR=%08x, ICR=%08x, IBMR=%02x\n", + __func__, (long)jiffies, readl(_ISR(i2c)), readl(_ICR(i2c)), readl(_IBMR(i2c))); + +- if ((readl(_ISR(i2c)) & (ISR_UB|ISR_IBB)) == 0 || ++ if ((readl(_ISR(i2c)) & i2c->busy_mask) == 0 || + (readl(_ISR(i2c)) & ISR_SAD) != 0 || + (readl(_ICR(i2c)) & ICR_SCLE) == 0) { + if (i2c_debug > 1) +@@ -1170,7 +1172,7 @@ static int i2c_pxa_pio_set_master(struct + /* + * Wait for the bus to become free. + */ +- while (timeout-- && readl(_ISR(i2c)) & (ISR_IBB | ISR_UB)) ++ while (timeout-- && readl(_ISR(i2c)) & i2c->busy_mask) + udelay(1000); + + if (timeout < 0) { +@@ -1317,7 +1319,7 @@ static void i2c_pxa_unprepare_recovery(s + * handing control of the bus back to avoid the bus changing state. + */ + isr = readl(_ISR(i2c)); +- if (isr & (ISR_UB | ISR_IBB)) { ++ if (isr & i2c->busy_mask) { + dev_dbg(&i2c->adap.dev, + "recovery: resetting controller, ISR=0x%08x\n", isr); + i2c_pxa_do_reset(i2c); +@@ -1481,6 +1483,10 @@ static int i2c_pxa_probe(struct platform + i2c->fm_mask = pxa_reg_layout[i2c_type].fm; + i2c->hs_mask = pxa_reg_layout[i2c_type].hs; + ++ i2c->busy_mask = ISR_UB | ISR_IBB; ++ if (i2c_type == REGS_A3700) ++ i2c->busy_mask |= ISR_A3700_EBB; ++ + if (i2c_type != REGS_CE4100) + i2c->reg_isar = i2c->reg_base + pxa_reg_layout[i2c_type].isar; + From e2457aa09f03fbe8f3e6d4312a40ce8ead1ef9d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Wed, 21 May 2025 12:28:44 +0200 Subject: [PATCH 675/877] bcm27xx: switch to upstream SDHOST driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The RPi upstream repo switched to the upstream SDHOST driver some time ago, so it's time to do the same in our configs. Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit cd79b6ede90687d72b1864527b47760c7f7f7961) --- target/linux/bcm27xx/bcm2708/config-6.6 | 4 ++-- target/linux/bcm27xx/bcm2709/config-6.6 | 4 ++-- target/linux/bcm27xx/bcm2710/config-6.6 | 4 ++-- target/linux/bcm27xx/bcm2711/config-6.6 | 4 ++-- target/linux/bcm27xx/bcm2712/config-6.6 | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/target/linux/bcm27xx/bcm2708/config-6.6 b/target/linux/bcm27xx/bcm2708/config-6.6 index a8a3cc9af7c806..84be5f8d27365e 100644 --- a/target/linux/bcm27xx/bcm2708/config-6.6 +++ b/target/linux/bcm27xx/bcm2708/config-6.6 @@ -249,11 +249,11 @@ CONFIG_MFD_SYSCON=y CONFIG_MIGHT_HAVE_CACHE_L2X0=y CONFIG_MIGRATION=y CONFIG_MMC=y -# CONFIG_MMC_BCM2835 is not set +CONFIG_MMC_BCM2835=y CONFIG_MMC_BCM2835_DMA=y CONFIG_MMC_BCM2835_MMC=y CONFIG_MMC_BCM2835_PIO_DMA_BARRIER=2 -CONFIG_MMC_BCM2835_SDHOST=y +# CONFIG_MMC_BCM2835_SDHOST is not set CONFIG_MMC_BLOCK=y CONFIG_MMC_BLOCK_MINORS=32 CONFIG_MMC_HSQ=y diff --git a/target/linux/bcm27xx/bcm2709/config-6.6 b/target/linux/bcm27xx/bcm2709/config-6.6 index edcc8f58cc2569..747e3a6684e810 100644 --- a/target/linux/bcm27xx/bcm2709/config-6.6 +++ b/target/linux/bcm27xx/bcm2709/config-6.6 @@ -312,11 +312,11 @@ CONFIG_MICROCHIP_PHY=y CONFIG_MIGHT_HAVE_CACHE_L2X0=y CONFIG_MIGRATION=y CONFIG_MMC=y -# CONFIG_MMC_BCM2835 is not set +CONFIG_MMC_BCM2835=y CONFIG_MMC_BCM2835_DMA=y CONFIG_MMC_BCM2835_MMC=y CONFIG_MMC_BCM2835_PIO_DMA_BARRIER=2 -CONFIG_MMC_BCM2835_SDHOST=y +# CONFIG_MMC_BCM2835_SDHOST is not set CONFIG_MMC_BLOCK=y CONFIG_MMC_BLOCK_MINORS=32 CONFIG_MMC_HSQ=y diff --git a/target/linux/bcm27xx/bcm2710/config-6.6 b/target/linux/bcm27xx/bcm2710/config-6.6 index 18a9c26b01d494..26565cd237a463 100644 --- a/target/linux/bcm27xx/bcm2710/config-6.6 +++ b/target/linux/bcm27xx/bcm2710/config-6.6 @@ -310,11 +310,11 @@ CONFIG_MICROCHIP_PHY=y CONFIG_MIGRATION=y # CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY is not set CONFIG_MMC=y -# CONFIG_MMC_BCM2835 is not set +CONFIG_MMC_BCM2835=y CONFIG_MMC_BCM2835_DMA=y CONFIG_MMC_BCM2835_MMC=y CONFIG_MMC_BCM2835_PIO_DMA_BARRIER=2 -CONFIG_MMC_BCM2835_SDHOST=y +# CONFIG_MMC_BCM2835_SDHOST is not set CONFIG_MMC_BLOCK=y CONFIG_MMC_BLOCK_MINORS=32 CONFIG_MMC_HSQ=y diff --git a/target/linux/bcm27xx/bcm2711/config-6.6 b/target/linux/bcm27xx/bcm2711/config-6.6 index a48771b8e70863..7b37b67fb31b03 100644 --- a/target/linux/bcm27xx/bcm2711/config-6.6 +++ b/target/linux/bcm27xx/bcm2711/config-6.6 @@ -313,11 +313,11 @@ CONFIG_MFD_CORE=y CONFIG_MFD_SYSCON=y CONFIG_MIGRATION=y CONFIG_MMC=y -# CONFIG_MMC_BCM2835 is not set +CONFIG_MMC_BCM2835=y CONFIG_MMC_BCM2835_DMA=y CONFIG_MMC_BCM2835_MMC=y CONFIG_MMC_BCM2835_PIO_DMA_BARRIER=2 -CONFIG_MMC_BCM2835_SDHOST=y +# CONFIG_MMC_BCM2835_SDHOST is not set CONFIG_MMC_BLOCK=y CONFIG_MMC_BLOCK_MINORS=32 CONFIG_MMC_HSQ=y diff --git a/target/linux/bcm27xx/bcm2712/config-6.6 b/target/linux/bcm27xx/bcm2712/config-6.6 index 749c569a541335..daca22db8d5288 100644 --- a/target/linux/bcm27xx/bcm2712/config-6.6 +++ b/target/linux/bcm27xx/bcm2712/config-6.6 @@ -391,11 +391,11 @@ CONFIG_MFD_SYSCON=y CONFIG_MICROCHIP_PHY=y CONFIG_MIGRATION=y CONFIG_MMC=y -# CONFIG_MMC_BCM2835 is not set +CONFIG_MMC_BCM2835=y CONFIG_MMC_BCM2835_DMA=y CONFIG_MMC_BCM2835_MMC=y CONFIG_MMC_BCM2835_PIO_DMA_BARRIER=2 -CONFIG_MMC_BCM2835_SDHOST=y +# CONFIG_MMC_BCM2835_SDHOST is not set CONFIG_MMC_BLOCK=y CONFIG_MMC_BLOCK_MINORS=32 CONFIG_MMC_CQHCI=y From 8cac8d87230a38366ac7f025402b97b2dc5f3a0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Thu, 22 May 2025 10:39:47 +0200 Subject: [PATCH 676/877] generic: backport upstream v6.16 r8169 patches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit f24f7b2f3af9 r8169: add support for RTL8127A 4f51e7d370a0 r8169: merge chip versions 52 and 53 (RTL8117) f372ef6ed5a6 r8169: merge chip versions 64 and 65 (RTL8125D) 4dec0702b862 r8169: merge chip versions 70 and 71 (RTL8126A) b7ed5d5a78fc r8169: use pci_prepare_to_sleep in rtl_shutdown fe733618b27a r8169: add RTL_GIGA_MAC_VER_LAST to facilitate adding support for new chip versions 2b065c098c37 r8169: refactor chip version detection 0c49baf099ba r8169: add helper rtl8125_phy_param 8c40d99e5f43 r8169: add helper rtl_csi_mod for accessing extended config space Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 91ce7f606a623edab99d1928480c65fc44ee8665) --- ...r-rtl_csi_mod-for-accessing-extended.patch | 74 ++++ ...6-r8169-add-helper-rtl8125_phy_param.patch | 82 ++++ ...8169-refactor-chip-version-detection.patch | 401 ++++++++++++++++++ ...GA_MAC_VER_LAST-to-facilitate-adding.patch | 159 +++++++ ...pci_prepare_to_sleep-in-rtl_shutdown.patch | 37 ++ ...rge-chip-versions-70-and-71-RTL8126A.patch | 106 +++++ ...rge-chip-versions-64-and-65-RTL8125D.patch | 65 +++ ...erge-chip-versions-52-and-53-RTL8117.patch | 113 +++++ ...v6.16-r8169-add-support-for-RTL8127A.patch | 323 ++++++++++++++ 9 files changed, 1360 insertions(+) create mode 100644 target/linux/generic/backport-6.6/780-57-v6.16-r8169-add-helper-rtl_csi_mod-for-accessing-extended.patch create mode 100644 target/linux/generic/backport-6.6/780-58-v6.16-r8169-add-helper-rtl8125_phy_param.patch create mode 100644 target/linux/generic/backport-6.6/780-59-v6.16-r8169-refactor-chip-version-detection.patch create mode 100644 target/linux/generic/backport-6.6/780-60-v6.16-r8169-add-RTL_GIGA_MAC_VER_LAST-to-facilitate-adding.patch create mode 100644 target/linux/generic/backport-6.6/780-61-v6.16-r8169-use-pci_prepare_to_sleep-in-rtl_shutdown.patch create mode 100644 target/linux/generic/backport-6.6/780-62-v6.16-r8169-merge-chip-versions-70-and-71-RTL8126A.patch create mode 100644 target/linux/generic/backport-6.6/780-63-v6.16-r8169-merge-chip-versions-64-and-65-RTL8125D.patch create mode 100644 target/linux/generic/backport-6.6/780-64-v6.16-r8169-merge-chip-versions-52-and-53-RTL8117.patch create mode 100644 target/linux/generic/backport-6.6/780-65-v6.16-r8169-add-support-for-RTL8127A.patch diff --git a/target/linux/generic/backport-6.6/780-57-v6.16-r8169-add-helper-rtl_csi_mod-for-accessing-extended.patch b/target/linux/generic/backport-6.6/780-57-v6.16-r8169-add-helper-rtl_csi_mod-for-accessing-extended.patch new file mode 100644 index 00000000000000..0c5db62c9b52f1 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-57-v6.16-r8169-add-helper-rtl_csi_mod-for-accessing-extended.patch @@ -0,0 +1,74 @@ +From 8c40d99e5f43e0545a3f4fea9156313847e2eb79 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Wed, 9 Apr 2025 21:05:37 +0200 +Subject: [PATCH] r8169: add helper rtl_csi_mod for accessing extended config + space + +Add a helper for the Realtek-specific mechanism for accessing extended +config space if native access isn't possible. +This avoids code duplication. + +Signed-off-by: Heiner Kallweit +Link: https://patch.msgid.link/b368fd91-57d7-4cb5-9342-98b4d8fe9aea@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169_main.c | 26 ++++++++++++++--------- + 1 file changed, 16 insertions(+), 10 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -2856,10 +2856,23 @@ static u32 rtl_csi_read(struct rtl8169_p + RTL_R32(tp, CSIDR) : ~0; + } + ++static void rtl_csi_mod(struct rtl8169_private *tp, int addr, ++ u32 mask, u32 set) ++{ ++ u32 val; ++ ++ WARN(addr % 4, "Invalid CSI address %#x\n", addr); ++ ++ netdev_notice_once(tp->dev, ++ "No native access to PCI extended config space, falling back to CSI\n"); ++ ++ val = rtl_csi_read(tp, addr); ++ rtl_csi_write(tp, addr, (val & ~mask) | set); ++} ++ + static void rtl_disable_zrxdc_timeout(struct rtl8169_private *tp) + { + struct pci_dev *pdev = tp->pci_dev; +- u32 csi; + int rc; + u8 val; + +@@ -2876,16 +2889,12 @@ static void rtl_disable_zrxdc_timeout(st + } + } + +- netdev_notice_once(tp->dev, +- "No native access to PCI extended config space, falling back to CSI\n"); +- csi = rtl_csi_read(tp, RTL_GEN3_RELATED_OFF); +- rtl_csi_write(tp, RTL_GEN3_RELATED_OFF, csi & ~RTL_GEN3_ZRXDC_NONCOMPL); ++ rtl_csi_mod(tp, RTL_GEN3_RELATED_OFF, RTL_GEN3_ZRXDC_NONCOMPL, 0); + } + + static void rtl_set_aspm_entry_latency(struct rtl8169_private *tp, u8 val) + { + struct pci_dev *pdev = tp->pci_dev; +- u32 csi; + + /* According to Realtek the value at config space address 0x070f + * controls the L0s/L1 entrance latency. We try standard ECAM access +@@ -2897,10 +2906,7 @@ static void rtl_set_aspm_entry_latency(s + pci_write_config_byte(pdev, 0x070f, val) == PCIBIOS_SUCCESSFUL) + return; + +- netdev_notice_once(tp->dev, +- "No native access to PCI extended config space, falling back to CSI\n"); +- csi = rtl_csi_read(tp, 0x070c) & 0x00ffffff; +- rtl_csi_write(tp, 0x070c, csi | val << 24); ++ rtl_csi_mod(tp, 0x070c, 0xff000000, val << 24); + } + + static void rtl_set_def_aspm_entry_latency(struct rtl8169_private *tp) diff --git a/target/linux/generic/backport-6.6/780-58-v6.16-r8169-add-helper-rtl8125_phy_param.patch b/target/linux/generic/backport-6.6/780-58-v6.16-r8169-add-helper-rtl8125_phy_param.patch new file mode 100644 index 00000000000000..30ebb4b6f4806d --- /dev/null +++ b/target/linux/generic/backport-6.6/780-58-v6.16-r8169-add-helper-rtl8125_phy_param.patch @@ -0,0 +1,82 @@ +From 0c49baf099ba2147a6ff3bbdc3197c6ddbee5469 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Wed, 9 Apr 2025 21:14:47 +0200 +Subject: [PATCH] r8169: add helper rtl8125_phy_param + +The integrated PHY's of RTL8125/8126 have an own mechanism to access +PHY parameters, similar to what r8168g_phy_param does on earlier PHY +versions. Add helper rtl8125_phy_param to simplify the code. + +Signed-off-by: Heiner Kallweit +Link: https://patch.msgid.link/847b7356-12d6-441b-ade9-4b6e1539b84a@gmail.com +Signed-off-by: Jakub Kicinski +--- + .../net/ethernet/realtek/r8169_phy_config.c | 36 +++++++++---------- + 1 file changed, 16 insertions(+), 20 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169_phy_config.c ++++ b/drivers/net/ethernet/realtek/r8169_phy_config.c +@@ -50,6 +50,15 @@ static void r8168g_phy_param(struct phy_ + phy_restore_page(phydev, oldpage, 0); + } + ++static void rtl8125_phy_param(struct phy_device *phydev, u16 parm, ++ u16 mask, u16 val) ++{ ++ phy_lock_mdio_bus(phydev); ++ __phy_write_mmd(phydev, MDIO_MMD_VEND2, 0xb87c, parm); ++ __phy_modify_mmd(phydev, MDIO_MMD_VEND2, 0xb87e, mask, val); ++ phy_unlock_mdio_bus(phydev); ++} ++ + struct phy_reg { + u16 reg; + u16 val; +@@ -1004,12 +1013,8 @@ static void rtl8125a_2_hw_phy_config(str + phy_write_paged(phydev, 0xac5, 0x16, 0x01ff); + phy_modify_paged(phydev, 0xac8, 0x15, 0x00f0, 0x0030); + +- phy_write(phydev, 0x1f, 0x0b87); +- phy_write(phydev, 0x16, 0x80a2); +- phy_write(phydev, 0x17, 0x0153); +- phy_write(phydev, 0x16, 0x809c); +- phy_write(phydev, 0x17, 0x0153); +- phy_write(phydev, 0x1f, 0x0000); ++ rtl8125_phy_param(phydev, 0x80a2, 0xffff, 0x0153); ++ rtl8125_phy_param(phydev, 0x809c, 0xffff, 0x0153); + + phy_write(phydev, 0x1f, 0x0a43); + phy_write(phydev, 0x13, 0x81B3); +@@ -1061,14 +1066,9 @@ static void rtl8125b_hw_phy_config(struc + phy_modify_paged(phydev, 0xac4, 0x13, 0x00f0, 0x0090); + phy_modify_paged(phydev, 0xad3, 0x10, 0x0003, 0x0001); + +- phy_write(phydev, 0x1f, 0x0b87); +- phy_write(phydev, 0x16, 0x80f5); +- phy_write(phydev, 0x17, 0x760e); +- phy_write(phydev, 0x16, 0x8107); +- phy_write(phydev, 0x17, 0x360e); +- phy_write(phydev, 0x16, 0x8551); +- phy_modify(phydev, 0x17, 0xff00, 0x0800); +- phy_write(phydev, 0x1f, 0x0000); ++ rtl8125_phy_param(phydev, 0x80f5, 0xffff, 0x760e); ++ rtl8125_phy_param(phydev, 0x8107, 0xffff, 0x360e); ++ rtl8125_phy_param(phydev, 0x8551, 0xff00, 0x0800); + + phy_modify_paged(phydev, 0xbf0, 0x10, 0xe000, 0xa000); + phy_modify_paged(phydev, 0xbf4, 0x13, 0x0f00, 0x0300); +@@ -1110,12 +1110,8 @@ static void rtl8125bp_hw_phy_config(stru + + r8168g_phy_param(phydev, 0x8010, 0x0800, 0x0000); + +- phy_write(phydev, 0x1f, 0x0b87); +- phy_write(phydev, 0x16, 0x8088); +- phy_modify(phydev, 0x17, 0xff00, 0x9000); +- phy_write(phydev, 0x16, 0x808f); +- phy_modify(phydev, 0x17, 0xff00, 0x9000); +- phy_write(phydev, 0x1f, 0x0000); ++ rtl8125_phy_param(phydev, 0x8088, 0xff00, 0x9000); ++ rtl8125_phy_param(phydev, 0x808f, 0xff00, 0x9000); + + r8168g_phy_param(phydev, 0x8174, 0x2000, 0x1800); + diff --git a/target/linux/generic/backport-6.6/780-59-v6.16-r8169-refactor-chip-version-detection.patch b/target/linux/generic/backport-6.6/780-59-v6.16-r8169-refactor-chip-version-detection.patch new file mode 100644 index 00000000000000..7ffff5dc9be0ad --- /dev/null +++ b/target/linux/generic/backport-6.6/780-59-v6.16-r8169-refactor-chip-version-detection.patch @@ -0,0 +1,401 @@ +From 2b065c098c37a3ed28df7c3be59dca61b9da8402 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Tue, 15 Apr 2025 21:29:34 +0200 +Subject: [PATCH] r8169: refactor chip version detection + +Refactor chip version detection and merge both configuration tables. +Apart from reducing the code by a third, this paves the way for +merging chip version handling if only difference is the firmware. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Michal Swiatkowski +Link: https://patch.msgid.link/1fea533a-dd5a-4198-a9e2-895e11083947@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169_main.c | 325 +++++++++------------- + 1 file changed, 128 insertions(+), 197 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -91,61 +91,114 @@ + #define JUMBO_9K (9 * SZ_1K - VLAN_ETH_HLEN - ETH_FCS_LEN) + #define JUMBO_16K (SZ_16K - VLAN_ETH_HLEN - ETH_FCS_LEN) + +-static const struct { ++static const struct rtl_chip_info { ++ u16 mask; ++ u16 val; ++ enum mac_version mac_version; + const char *name; + const char *fw_name; + } rtl_chip_infos[] = { +- /* PCI devices. */ +- [RTL_GIGA_MAC_VER_02] = {"RTL8169s" }, +- [RTL_GIGA_MAC_VER_03] = {"RTL8110s" }, +- [RTL_GIGA_MAC_VER_04] = {"RTL8169sb/8110sb" }, +- [RTL_GIGA_MAC_VER_05] = {"RTL8169sc/8110sc" }, +- [RTL_GIGA_MAC_VER_06] = {"RTL8169sc/8110sc" }, +- /* PCI-E devices. */ +- [RTL_GIGA_MAC_VER_07] = {"RTL8102e" }, +- [RTL_GIGA_MAC_VER_08] = {"RTL8102e" }, +- [RTL_GIGA_MAC_VER_09] = {"RTL8102e/RTL8103e" }, +- [RTL_GIGA_MAC_VER_10] = {"RTL8101e/RTL8100e" }, +- [RTL_GIGA_MAC_VER_14] = {"RTL8401" }, +- [RTL_GIGA_MAC_VER_17] = {"RTL8168b/8111b" }, +- [RTL_GIGA_MAC_VER_18] = {"RTL8168cp/8111cp" }, +- [RTL_GIGA_MAC_VER_19] = {"RTL8168c/8111c" }, +- [RTL_GIGA_MAC_VER_20] = {"RTL8168c/8111c" }, +- [RTL_GIGA_MAC_VER_21] = {"RTL8168c/8111c" }, +- [RTL_GIGA_MAC_VER_22] = {"RTL8168c/8111c" }, +- [RTL_GIGA_MAC_VER_23] = {"RTL8168cp/8111cp" }, +- [RTL_GIGA_MAC_VER_24] = {"RTL8168cp/8111cp" }, +- [RTL_GIGA_MAC_VER_25] = {"RTL8168d/8111d", FIRMWARE_8168D_1}, +- [RTL_GIGA_MAC_VER_26] = {"RTL8168d/8111d", FIRMWARE_8168D_2}, +- [RTL_GIGA_MAC_VER_28] = {"RTL8168dp/8111dp" }, +- [RTL_GIGA_MAC_VER_29] = {"RTL8105e", FIRMWARE_8105E_1}, +- [RTL_GIGA_MAC_VER_30] = {"RTL8105e", FIRMWARE_8105E_1}, +- [RTL_GIGA_MAC_VER_31] = {"RTL8168dp/8111dp" }, +- [RTL_GIGA_MAC_VER_32] = {"RTL8168e/8111e", FIRMWARE_8168E_1}, +- [RTL_GIGA_MAC_VER_33] = {"RTL8168e/8111e", FIRMWARE_8168E_2}, +- [RTL_GIGA_MAC_VER_34] = {"RTL8168evl/8111evl", FIRMWARE_8168E_3}, +- [RTL_GIGA_MAC_VER_35] = {"RTL8168f/8111f", FIRMWARE_8168F_1}, +- [RTL_GIGA_MAC_VER_36] = {"RTL8168f/8111f", FIRMWARE_8168F_2}, +- [RTL_GIGA_MAC_VER_37] = {"RTL8402", FIRMWARE_8402_1 }, +- [RTL_GIGA_MAC_VER_38] = {"RTL8411", FIRMWARE_8411_1 }, +- [RTL_GIGA_MAC_VER_39] = {"RTL8106e", FIRMWARE_8106E_1}, +- [RTL_GIGA_MAC_VER_40] = {"RTL8168g/8111g", FIRMWARE_8168G_2}, +- [RTL_GIGA_MAC_VER_42] = {"RTL8168gu/8111gu", FIRMWARE_8168G_3}, +- [RTL_GIGA_MAC_VER_43] = {"RTL8106eus", FIRMWARE_8106E_2}, +- [RTL_GIGA_MAC_VER_44] = {"RTL8411b", FIRMWARE_8411_2 }, +- [RTL_GIGA_MAC_VER_46] = {"RTL8168h/8111h", FIRMWARE_8168H_2}, +- [RTL_GIGA_MAC_VER_48] = {"RTL8107e", FIRMWARE_8107E_2}, +- [RTL_GIGA_MAC_VER_51] = {"RTL8168ep/8111ep" }, +- [RTL_GIGA_MAC_VER_52] = {"RTL8168fp/RTL8117", FIRMWARE_8168FP_3}, +- [RTL_GIGA_MAC_VER_53] = {"RTL8168fp/RTL8117", }, +- [RTL_GIGA_MAC_VER_61] = {"RTL8125A", FIRMWARE_8125A_3}, +- /* reserve 62 for CFG_METHOD_4 in the vendor driver */ +- [RTL_GIGA_MAC_VER_63] = {"RTL8125B", FIRMWARE_8125B_2}, +- [RTL_GIGA_MAC_VER_64] = {"RTL8125D", FIRMWARE_8125D_1}, +- [RTL_GIGA_MAC_VER_65] = {"RTL8125D", FIRMWARE_8125D_2}, +- [RTL_GIGA_MAC_VER_66] = {"RTL8125BP", FIRMWARE_8125BP_2}, +- [RTL_GIGA_MAC_VER_70] = {"RTL8126A", FIRMWARE_8126A_2}, +- [RTL_GIGA_MAC_VER_71] = {"RTL8126A", FIRMWARE_8126A_3}, ++ /* 8126A family. */ ++ { 0x7cf, 0x64a, RTL_GIGA_MAC_VER_71, "RTL8126A", FIRMWARE_8126A_3 }, ++ { 0x7cf, 0x649, RTL_GIGA_MAC_VER_70, "RTL8126A", FIRMWARE_8126A_2 }, ++ ++ /* 8125BP family. */ ++ { 0x7cf, 0x681, RTL_GIGA_MAC_VER_66, "RTL8125BP", FIRMWARE_8125BP_2 }, ++ ++ /* 8125D family. */ ++ { 0x7cf, 0x689, RTL_GIGA_MAC_VER_65, "RTL8125D", FIRMWARE_8125D_2 }, ++ { 0x7cf, 0x688, RTL_GIGA_MAC_VER_64, "RTL8125D", FIRMWARE_8125D_1 }, ++ ++ /* 8125B family. */ ++ { 0x7cf, 0x641, RTL_GIGA_MAC_VER_63, "RTL8125B", FIRMWARE_8125B_2 }, ++ ++ /* 8125A family. */ ++ { 0x7cf, 0x609, RTL_GIGA_MAC_VER_61, "RTL8125A", FIRMWARE_8125A_3 }, ++ ++ /* RTL8117 */ ++ { 0x7cf, 0x54b, RTL_GIGA_MAC_VER_53, "RTL8168fp/RTL8117" }, ++ { 0x7cf, 0x54a, RTL_GIGA_MAC_VER_52, "RTL8168fp/RTL8117", ++ FIRMWARE_8168FP_3 }, ++ ++ /* 8168EP family. */ ++ { 0x7cf, 0x502, RTL_GIGA_MAC_VER_51, "RTL8168ep/8111ep" }, ++ ++ /* 8168H family. */ ++ { 0x7cf, 0x541, RTL_GIGA_MAC_VER_46, "RTL8168h/8111h", ++ FIRMWARE_8168H_2 }, ++ /* Realtek calls it RTL8168M, but it's handled like RTL8168H */ ++ { 0x7cf, 0x6c0, RTL_GIGA_MAC_VER_46, "RTL8168M", FIRMWARE_8168H_2 }, ++ ++ /* 8168G family. */ ++ { 0x7cf, 0x5c8, RTL_GIGA_MAC_VER_44, "RTL8411b", FIRMWARE_8411_2 }, ++ { 0x7cf, 0x509, RTL_GIGA_MAC_VER_42, "RTL8168gu/8111gu", ++ FIRMWARE_8168G_3 }, ++ { 0x7cf, 0x4c0, RTL_GIGA_MAC_VER_40, "RTL8168g/8111g", ++ FIRMWARE_8168G_2 }, ++ ++ /* 8168F family. */ ++ { 0x7c8, 0x488, RTL_GIGA_MAC_VER_38, "RTL8411", FIRMWARE_8411_1 }, ++ { 0x7cf, 0x481, RTL_GIGA_MAC_VER_36, "RTL8168f/8111f", ++ FIRMWARE_8168F_2 }, ++ { 0x7cf, 0x480, RTL_GIGA_MAC_VER_35, "RTL8168f/8111f", ++ FIRMWARE_8168F_1 }, ++ ++ /* 8168E family. */ ++ { 0x7c8, 0x2c8, RTL_GIGA_MAC_VER_34, "RTL8168evl/8111evl", ++ FIRMWARE_8168E_3 }, ++ { 0x7cf, 0x2c1, RTL_GIGA_MAC_VER_32, "RTL8168e/8111e", ++ FIRMWARE_8168E_1 }, ++ { 0x7c8, 0x2c0, RTL_GIGA_MAC_VER_33, "RTL8168e/8111e", ++ FIRMWARE_8168E_2 }, ++ ++ /* 8168D family. */ ++ { 0x7cf, 0x281, RTL_GIGA_MAC_VER_25, "RTL8168d/8111d", ++ FIRMWARE_8168D_1 }, ++ { 0x7c8, 0x280, RTL_GIGA_MAC_VER_26, "RTL8168d/8111d", ++ FIRMWARE_8168D_2 }, ++ ++ /* 8168DP family. */ ++ { 0x7cf, 0x28a, RTL_GIGA_MAC_VER_28, "RTL8168dp/8111dp" }, ++ { 0x7cf, 0x28b, RTL_GIGA_MAC_VER_31, "RTL8168dp/8111dp" }, ++ ++ /* 8168C family. */ ++ { 0x7cf, 0x3c9, RTL_GIGA_MAC_VER_23, "RTL8168cp/8111cp" }, ++ { 0x7cf, 0x3c8, RTL_GIGA_MAC_VER_18, "RTL8168cp/8111cp" }, ++ { 0x7c8, 0x3c8, RTL_GIGA_MAC_VER_24, "RTL8168cp/8111cp" }, ++ { 0x7cf, 0x3c0, RTL_GIGA_MAC_VER_19, "RTL8168c/8111c" }, ++ { 0x7cf, 0x3c2, RTL_GIGA_MAC_VER_20, "RTL8168c/8111c" }, ++ { 0x7cf, 0x3c3, RTL_GIGA_MAC_VER_21, "RTL8168c/8111c" }, ++ { 0x7c8, 0x3c0, RTL_GIGA_MAC_VER_22, "RTL8168c/8111c" }, ++ ++ /* 8168B family. */ ++ { 0x7c8, 0x380, RTL_GIGA_MAC_VER_17, "RTL8168b/8111b" }, ++ /* This one is very old and rare, support has been removed. ++ * { 0x7c8, 0x300, RTL_GIGA_MAC_VER_11, "RTL8168b/8111b" }, ++ */ ++ ++ /* 8101 family. */ ++ { 0x7c8, 0x448, RTL_GIGA_MAC_VER_39, "RTL8106e", FIRMWARE_8106E_1 }, ++ { 0x7c8, 0x440, RTL_GIGA_MAC_VER_37, "RTL8402", FIRMWARE_8402_1 }, ++ { 0x7cf, 0x409, RTL_GIGA_MAC_VER_29, "RTL8105e", FIRMWARE_8105E_1 }, ++ { 0x7c8, 0x408, RTL_GIGA_MAC_VER_30, "RTL8105e", FIRMWARE_8105E_1 }, ++ { 0x7cf, 0x349, RTL_GIGA_MAC_VER_08, "RTL8102e" }, ++ { 0x7cf, 0x249, RTL_GIGA_MAC_VER_08, "RTL8102e" }, ++ { 0x7cf, 0x348, RTL_GIGA_MAC_VER_07, "RTL8102e" }, ++ { 0x7cf, 0x248, RTL_GIGA_MAC_VER_07, "RTL8102e" }, ++ { 0x7cf, 0x240, RTL_GIGA_MAC_VER_14, "RTL8401" }, ++ { 0x7c8, 0x348, RTL_GIGA_MAC_VER_09, "RTL8102e/RTL8103e" }, ++ { 0x7c8, 0x248, RTL_GIGA_MAC_VER_09, "RTL8102e/RTL8103e" }, ++ { 0x7c8, 0x340, RTL_GIGA_MAC_VER_10, "RTL8101e/RTL8100e" }, ++ ++ /* 8110 family. */ ++ { 0xfc8, 0x980, RTL_GIGA_MAC_VER_06, "RTL8169sc/8110sc" }, ++ { 0xfc8, 0x180, RTL_GIGA_MAC_VER_05, "RTL8169sc/8110sc" }, ++ { 0xfc8, 0x100, RTL_GIGA_MAC_VER_04, "RTL8169sb/8110sb" }, ++ { 0xfc8, 0x040, RTL_GIGA_MAC_VER_03, "RTL8110s" }, ++ { 0xfc8, 0x008, RTL_GIGA_MAC_VER_02, "RTL8169s" }, ++ ++ /* Catch-all */ ++ { 0x000, 0x000, RTL_GIGA_MAC_NONE } + }; + + static const struct pci_device_id rtl8169_pci_tbl[] = { +@@ -2267,151 +2320,30 @@ static const struct ethtool_ops rtl8169_ + .get_eth_ctrl_stats = rtl8169_get_eth_ctrl_stats, + }; + +-static enum mac_version rtl8169_get_mac_version(u16 xid, bool gmii) ++static const struct rtl_chip_info *rtl8169_get_chip_version(u16 xid, bool gmii) + { +- /* +- * The driver currently handles the 8168Bf and the 8168Be identically +- * but they can be identified more specifically through the test below +- * if needed: +- * +- * (RTL_R32(tp, TxConfig) & 0x700000) == 0x500000 ? 8168Bf : 8168Be +- * +- * Same thing for the 8101Eb and the 8101Ec: +- * +- * (RTL_R32(tp, TxConfig) & 0x700000) == 0x200000 ? 8101Eb : 8101Ec +- */ +- static const struct rtl_mac_info { +- u16 mask; +- u16 val; +- enum mac_version ver; +- } mac_info[] = { +- /* 8126A family. */ +- { 0x7cf, 0x64a, RTL_GIGA_MAC_VER_71 }, +- { 0x7cf, 0x649, RTL_GIGA_MAC_VER_70 }, +- +- /* 8125BP family. */ +- { 0x7cf, 0x681, RTL_GIGA_MAC_VER_66 }, +- +- /* 8125D family. */ +- { 0x7cf, 0x689, RTL_GIGA_MAC_VER_65 }, +- { 0x7cf, 0x688, RTL_GIGA_MAC_VER_64 }, +- +- /* 8125B family. */ +- { 0x7cf, 0x641, RTL_GIGA_MAC_VER_63 }, +- +- /* 8125A family. */ +- { 0x7cf, 0x609, RTL_GIGA_MAC_VER_61 }, +- /* It seems only XID 609 made it to the mass market. +- * { 0x7cf, 0x608, RTL_GIGA_MAC_VER_60 }, +- * { 0x7c8, 0x608, RTL_GIGA_MAC_VER_61 }, +- */ +- +- /* RTL8117 */ +- { 0x7cf, 0x54b, RTL_GIGA_MAC_VER_53 }, +- { 0x7cf, 0x54a, RTL_GIGA_MAC_VER_52 }, +- +- /* 8168EP family. */ +- { 0x7cf, 0x502, RTL_GIGA_MAC_VER_51 }, +- /* It seems this chip version never made it to +- * the wild. Let's disable detection. +- * { 0x7cf, 0x501, RTL_GIGA_MAC_VER_50 }, +- * { 0x7cf, 0x500, RTL_GIGA_MAC_VER_49 }, +- */ +- +- /* 8168H family. */ +- { 0x7cf, 0x541, RTL_GIGA_MAC_VER_46 }, +- /* It seems this chip version never made it to +- * the wild. Let's disable detection. +- * { 0x7cf, 0x540, RTL_GIGA_MAC_VER_45 }, +- */ +- /* Realtek calls it RTL8168M, but it's handled like RTL8168H */ +- { 0x7cf, 0x6c0, RTL_GIGA_MAC_VER_46 }, +- +- /* 8168G family. */ +- { 0x7cf, 0x5c8, RTL_GIGA_MAC_VER_44 }, +- { 0x7cf, 0x509, RTL_GIGA_MAC_VER_42 }, +- /* It seems this chip version never made it to +- * the wild. Let's disable detection. +- * { 0x7cf, 0x4c1, RTL_GIGA_MAC_VER_41 }, +- */ +- { 0x7cf, 0x4c0, RTL_GIGA_MAC_VER_40 }, +- +- /* 8168F family. */ +- { 0x7c8, 0x488, RTL_GIGA_MAC_VER_38 }, +- { 0x7cf, 0x481, RTL_GIGA_MAC_VER_36 }, +- { 0x7cf, 0x480, RTL_GIGA_MAC_VER_35 }, +- +- /* 8168E family. */ +- { 0x7c8, 0x2c8, RTL_GIGA_MAC_VER_34 }, +- { 0x7cf, 0x2c1, RTL_GIGA_MAC_VER_32 }, +- { 0x7c8, 0x2c0, RTL_GIGA_MAC_VER_33 }, +- +- /* 8168D family. */ +- { 0x7cf, 0x281, RTL_GIGA_MAC_VER_25 }, +- { 0x7c8, 0x280, RTL_GIGA_MAC_VER_26 }, +- +- /* 8168DP family. */ +- /* It seems this early RTL8168dp version never made it to +- * the wild. Support has been removed. +- * { 0x7cf, 0x288, RTL_GIGA_MAC_VER_27 }, +- */ +- { 0x7cf, 0x28a, RTL_GIGA_MAC_VER_28 }, +- { 0x7cf, 0x28b, RTL_GIGA_MAC_VER_31 }, +- +- /* 8168C family. */ +- { 0x7cf, 0x3c9, RTL_GIGA_MAC_VER_23 }, +- { 0x7cf, 0x3c8, RTL_GIGA_MAC_VER_18 }, +- { 0x7c8, 0x3c8, RTL_GIGA_MAC_VER_24 }, +- { 0x7cf, 0x3c0, RTL_GIGA_MAC_VER_19 }, +- { 0x7cf, 0x3c2, RTL_GIGA_MAC_VER_20 }, +- { 0x7cf, 0x3c3, RTL_GIGA_MAC_VER_21 }, +- { 0x7c8, 0x3c0, RTL_GIGA_MAC_VER_22 }, +- +- /* 8168B family. */ +- { 0x7c8, 0x380, RTL_GIGA_MAC_VER_17 }, +- /* This one is very old and rare, support has been removed. +- * { 0x7c8, 0x300, RTL_GIGA_MAC_VER_11 }, +- */ +- +- /* 8101 family. */ +- { 0x7c8, 0x448, RTL_GIGA_MAC_VER_39 }, +- { 0x7c8, 0x440, RTL_GIGA_MAC_VER_37 }, +- { 0x7cf, 0x409, RTL_GIGA_MAC_VER_29 }, +- { 0x7c8, 0x408, RTL_GIGA_MAC_VER_30 }, +- { 0x7cf, 0x349, RTL_GIGA_MAC_VER_08 }, +- { 0x7cf, 0x249, RTL_GIGA_MAC_VER_08 }, +- { 0x7cf, 0x348, RTL_GIGA_MAC_VER_07 }, +- { 0x7cf, 0x248, RTL_GIGA_MAC_VER_07 }, +- { 0x7cf, 0x240, RTL_GIGA_MAC_VER_14 }, +- { 0x7c8, 0x348, RTL_GIGA_MAC_VER_09 }, +- { 0x7c8, 0x248, RTL_GIGA_MAC_VER_09 }, +- { 0x7c8, 0x340, RTL_GIGA_MAC_VER_10 }, +- +- /* 8110 family. */ +- { 0xfc8, 0x980, RTL_GIGA_MAC_VER_06 }, +- { 0xfc8, 0x180, RTL_GIGA_MAC_VER_05 }, +- { 0xfc8, 0x100, RTL_GIGA_MAC_VER_04 }, +- { 0xfc8, 0x040, RTL_GIGA_MAC_VER_03 }, +- { 0xfc8, 0x008, RTL_GIGA_MAC_VER_02 }, +- +- /* Catch-all */ +- { 0x000, 0x000, RTL_GIGA_MAC_NONE } ++ /* Chips combining a 1Gbps MAC with a 100Mbps PHY */ ++ static const struct rtl_chip_info rtl8106eus_info = { ++ .mac_version = RTL_GIGA_MAC_VER_43, ++ .name = "RTL8106eus", ++ .fw_name = FIRMWARE_8106E_2, + }; +- const struct rtl_mac_info *p = mac_info; +- enum mac_version ver; ++ static const struct rtl_chip_info rtl8107e_info = { ++ .mac_version = RTL_GIGA_MAC_VER_48, ++ .name = "RTL8107e", ++ .fw_name = FIRMWARE_8107E_2, ++ }; ++ const struct rtl_chip_info *p = rtl_chip_infos; + + while ((xid & p->mask) != p->val) + p++; +- ver = p->ver; + +- if (ver != RTL_GIGA_MAC_NONE && !gmii) { +- if (ver == RTL_GIGA_MAC_VER_42) +- ver = RTL_GIGA_MAC_VER_43; +- else if (ver == RTL_GIGA_MAC_VER_46) +- ver = RTL_GIGA_MAC_VER_48; +- } ++ if (p->mac_version == RTL_GIGA_MAC_VER_42 && !gmii) ++ return &rtl8106eus_info; ++ if (p->mac_version == RTL_GIGA_MAC_VER_46 && !gmii) ++ return &rtl8107e_info; + +- return ver; ++ return p; + } + + static void rtl_release_firmware(struct rtl8169_private *tp) +@@ -5448,9 +5380,9 @@ static bool rtl_aspm_is_safe(struct rtl8 + + static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) + { ++ const struct rtl_chip_info *chip; + struct rtl8169_private *tp; + int jumbo_max, region, rc; +- enum mac_version chipset; + struct net_device *dev; + u32 txconfig; + u16 xid; +@@ -5501,12 +5433,13 @@ static int rtl_init_one(struct pci_dev * + xid = (txconfig >> 20) & 0xfcf; + + /* Identify chip attached to board */ +- chipset = rtl8169_get_mac_version(xid, tp->supports_gmii); +- if (chipset == RTL_GIGA_MAC_NONE) ++ chip = rtl8169_get_chip_version(xid, tp->supports_gmii); ++ if (chip->mac_version == RTL_GIGA_MAC_NONE) + return dev_err_probe(&pdev->dev, -ENODEV, + "unknown chip XID %03x, contact r8169 maintainers (see MAINTAINERS file)\n", + xid); +- tp->mac_version = chipset; ++ tp->mac_version = chip->mac_version; ++ tp->fw_name = chip->fw_name; + + /* Disable ASPM L1 as that cause random device stop working + * problems as well as full system hangs for some PCIe devices users. +@@ -5610,8 +5543,6 @@ static int rtl_init_one(struct pci_dev * + + rtl_set_irq_mask(tp); + +- tp->fw_name = rtl_chip_infos[chipset].fw_name; +- + tp->counters = dmam_alloc_coherent (&pdev->dev, sizeof(*tp->counters), + &tp->counters_phys_addr, + GFP_KERNEL); +@@ -5636,7 +5567,7 @@ static int rtl_init_one(struct pci_dev * + } + + netdev_info(dev, "%s, %pM, XID %03x, IRQ %d\n", +- rtl_chip_infos[chipset].name, dev->dev_addr, xid, tp->irq); ++ chip->name, dev->dev_addr, xid, tp->irq); + + if (jumbo_max) + netdev_info(dev, "jumbo features [frames: %d bytes, tx checksumming: %s]\n", diff --git a/target/linux/generic/backport-6.6/780-60-v6.16-r8169-add-RTL_GIGA_MAC_VER_LAST-to-facilitate-adding.patch b/target/linux/generic/backport-6.6/780-60-v6.16-r8169-add-RTL_GIGA_MAC_VER_LAST-to-facilitate-adding.patch new file mode 100644 index 00000000000000..b46d331a3c8ff6 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-60-v6.16-r8169-add-RTL_GIGA_MAC_VER_LAST-to-facilitate-adding.patch @@ -0,0 +1,159 @@ +From fe733618b27a8c033f0d246c2efff56fca322656 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Tue, 15 Apr 2025 21:39:23 +0200 +Subject: [PATCH] r8169: add RTL_GIGA_MAC_VER_LAST to facilitate adding support + for new chip versions + +Add a new mac_version enum value RTL_GIGA_MAC_VER_LAST. Benefit is that +when adding support for a new chip version we have to touch less code, +except something changes fundamentally. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Link: https://patch.msgid.link/06991f47-2aec-4aa2-8918-2c6e79332303@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169.h | 3 ++- + drivers/net/ethernet/realtek/r8169_main.c | 28 +++++++++++------------ + 2 files changed, 16 insertions(+), 15 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169.h ++++ b/drivers/net/ethernet/realtek/r8169.h +@@ -73,7 +73,8 @@ enum mac_version { + RTL_GIGA_MAC_VER_66, + RTL_GIGA_MAC_VER_70, + RTL_GIGA_MAC_VER_71, +- RTL_GIGA_MAC_NONE ++ RTL_GIGA_MAC_NONE, ++ RTL_GIGA_MAC_VER_LAST = RTL_GIGA_MAC_NONE - 1 + }; + + struct rtl8169_private; +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -1290,7 +1290,7 @@ static void rtl_writephy(struct rtl8169_ + case RTL_GIGA_MAC_VER_31: + r8168dp_2_mdio_write(tp, location, val); + break; +- case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_71: ++ case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_LAST: + r8168g_mdio_write(tp, location, val); + break; + default: +@@ -1305,7 +1305,7 @@ static int rtl_readphy(struct rtl8169_pr + case RTL_GIGA_MAC_VER_28: + case RTL_GIGA_MAC_VER_31: + return r8168dp_2_mdio_read(tp, location); +- case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_71: ++ case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_LAST: + return r8168g_mdio_read(tp, location); + default: + return r8169_mdio_read(tp, location); +@@ -1657,7 +1657,7 @@ static void __rtl8169_set_wol(struct rtl + break; + case RTL_GIGA_MAC_VER_34: + case RTL_GIGA_MAC_VER_37: +- case RTL_GIGA_MAC_VER_39 ... RTL_GIGA_MAC_VER_71: ++ case RTL_GIGA_MAC_VER_39 ... RTL_GIGA_MAC_VER_LAST: + r8169_mod_reg8_cond(tp, Config2, PME_SIGNAL, wolopts); + break; + default: +@@ -2130,7 +2130,7 @@ static void rtl_set_eee_txidle_timer(str + tp->tx_lpi_timer = timer_val; + r8168_mac_ocp_write(tp, 0xe048, timer_val); + break; +- case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_71: ++ case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_LAST: + tp->tx_lpi_timer = timer_val; + RTL_W16(tp, EEE_TXIDLE_TIMER_8125, timer_val); + break; +@@ -2495,7 +2495,7 @@ static void rtl_init_rxcfg(struct rtl816 + case RTL_GIGA_MAC_VER_61: + RTL_W32(tp, RxConfig, RX_FETCH_DFLT_8125 | RX_DMA_BURST); + break; +- case RTL_GIGA_MAC_VER_63 ... RTL_GIGA_MAC_VER_71: ++ case RTL_GIGA_MAC_VER_63 ... RTL_GIGA_MAC_VER_LAST: + RTL_W32(tp, RxConfig, RX_FETCH_DFLT_8125 | RX_DMA_BURST | + RX_PAUSE_SLOT_ON); + break; +@@ -2627,7 +2627,7 @@ static void rtl_wait_txrx_fifo_empty(str + case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_61: + rtl_loop_wait_high(tp, &rtl_rxtx_empty_cond, 100, 42); + break; +- case RTL_GIGA_MAC_VER_63 ... RTL_GIGA_MAC_VER_71: ++ case RTL_GIGA_MAC_VER_63 ... RTL_GIGA_MAC_VER_LAST: + RTL_W8(tp, ChipCmd, RTL_R8(tp, ChipCmd) | StopReq); + rtl_loop_wait_high(tp, &rtl_rxtx_empty_cond, 100, 42); + rtl_loop_wait_high(tp, &rtl_rxtx_empty_cond_2, 100, 42); +@@ -2902,7 +2902,7 @@ static void rtl_enable_exit_l1(struct rt + case RTL_GIGA_MAC_VER_37 ... RTL_GIGA_MAC_VER_38: + rtl_eri_set_bits(tp, 0xd4, 0x0c00); + break; +- case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_71: ++ case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_LAST: + r8168_mac_ocp_modify(tp, 0xc0ac, 0, 0x1f80); + break; + default: +@@ -2916,7 +2916,7 @@ static void rtl_disable_exit_l1(struct r + case RTL_GIGA_MAC_VER_34 ... RTL_GIGA_MAC_VER_38: + rtl_eri_clear_bits(tp, 0xd4, 0x1f00); + break; +- case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_71: ++ case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_LAST: + r8168_mac_ocp_modify(tp, 0xc0ac, 0x1f80, 0); + break; + default: +@@ -2954,7 +2954,7 @@ static void rtl_hw_aspm_clkreq_enable(st + + switch (tp->mac_version) { + case RTL_GIGA_MAC_VER_46 ... RTL_GIGA_MAC_VER_48: +- case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_71: ++ case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_LAST: + /* reset ephy tx/rx disable timer */ + r8168_mac_ocp_modify(tp, 0xe094, 0xff00, 0); + /* chip can trigger L1.2 */ +@@ -2966,7 +2966,7 @@ static void rtl_hw_aspm_clkreq_enable(st + } else { + switch (tp->mac_version) { + case RTL_GIGA_MAC_VER_46 ... RTL_GIGA_MAC_VER_48: +- case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_71: ++ case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_LAST: + r8168_mac_ocp_modify(tp, 0xe092, 0x00ff, 0); + break; + default: +@@ -4098,7 +4098,7 @@ static void rtl8169_cleanup(struct rtl81 + RTL_W8(tp, ChipCmd, RTL_R8(tp, ChipCmd) | StopReq); + rtl_loop_wait_high(tp, &rtl_txcfg_empty_cond, 100, 666); + break; +- case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_71: ++ case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_LAST: + rtl_enable_rxdvgate(tp); + fsleep(2000); + break; +@@ -4255,7 +4255,7 @@ static unsigned int rtl_quirk_packet_pad + + switch (tp->mac_version) { + case RTL_GIGA_MAC_VER_34: +- case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_71: ++ case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_LAST: + padto = max_t(unsigned int, padto, ETH_ZLEN); + break; + default: +@@ -5310,7 +5310,7 @@ static void rtl_hw_initialize(struct rtl + case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_48: + rtl_hw_init_8168g(tp); + break; +- case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_71: ++ case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_LAST: + rtl_hw_init_8125(tp); + break; + default: +@@ -5335,7 +5335,7 @@ static int rtl_jumbo_max(struct rtl8169_ + case RTL_GIGA_MAC_VER_18 ... RTL_GIGA_MAC_VER_24: + return JUMBO_6K; + /* RTL8125/8126 */ +- case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_71: ++ case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_LAST: + return JUMBO_16K; + default: + return JUMBO_9K; diff --git a/target/linux/generic/backport-6.6/780-61-v6.16-r8169-use-pci_prepare_to_sleep-in-rtl_shutdown.patch b/target/linux/generic/backport-6.6/780-61-v6.16-r8169-use-pci_prepare_to_sleep-in-rtl_shutdown.patch new file mode 100644 index 00000000000000..21fdca103157c8 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-61-v6.16-r8169-use-pci_prepare_to_sleep-in-rtl_shutdown.patch @@ -0,0 +1,37 @@ +From b7ed5d5a78fccee96cf8919ac2c7a064c2f4c45b Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Mon, 21 Apr 2025 11:25:18 +0200 +Subject: [PATCH] r8169: use pci_prepare_to_sleep in rtl_shutdown + +Use pci_prepare_to_sleep() like PCI core does in pci_pm_suspend_noirq. +This aligns setting a low-power mode during shutdown with the handling +of the transition to system suspend. Also the transition to runtime +suspend uses pci_target_state() instead of setting D3hot unconditionally. + +Note: pci_prepare_to_sleep() uses device_may_wakeup() to check whether + device may generate wakeup events. So we don't lose anything by + not passing tp->saved_wolopts any longer. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Jacob Keller +Link: https://patch.msgid.link/f573fdbd-ba6d-41c1-b68f-311d3c88db2c@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169_main.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -5047,10 +5047,8 @@ static void rtl_shutdown(struct pci_dev + /* Restore original MAC address */ + rtl_rar_set(tp, tp->dev->perm_addr); + +- if (system_state == SYSTEM_POWER_OFF && !tp->dash_enabled) { +- pci_wake_from_d3(pdev, tp->saved_wolopts); +- pci_set_power_state(pdev, PCI_D3hot); +- } ++ if (system_state == SYSTEM_POWER_OFF && !tp->dash_enabled) ++ pci_prepare_to_sleep(pdev); + } + + static void rtl_remove_one(struct pci_dev *pdev) diff --git a/target/linux/generic/backport-6.6/780-62-v6.16-r8169-merge-chip-versions-70-and-71-RTL8126A.patch b/target/linux/generic/backport-6.6/780-62-v6.16-r8169-merge-chip-versions-70-and-71-RTL8126A.patch new file mode 100644 index 00000000000000..08f7d4f90ad861 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-62-v6.16-r8169-merge-chip-versions-70-and-71-RTL8126A.patch @@ -0,0 +1,106 @@ +From 4dec0702b8627c364a0e1f2c5b249e06709a1c24 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Fri, 18 Apr 2025 11:23:45 +0200 +Subject: [PATCH] r8169: merge chip versions 70 and 71 (RTL8126A) + +Handling of both chip versions is the same, only difference is +the firmware. So we can merge handling of both chip versions. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Link: https://patch.msgid.link/97d7ae79-d021-4b6b-b424-89e5e305b029@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169.h | 1 - + drivers/net/ethernet/realtek/r8169_main.c | 15 ++++----------- + drivers/net/ethernet/realtek/r8169_phy_config.c | 1 - + 3 files changed, 4 insertions(+), 13 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169.h ++++ b/drivers/net/ethernet/realtek/r8169.h +@@ -72,7 +72,6 @@ enum mac_version { + RTL_GIGA_MAC_VER_65, + RTL_GIGA_MAC_VER_66, + RTL_GIGA_MAC_VER_70, +- RTL_GIGA_MAC_VER_71, + RTL_GIGA_MAC_NONE, + RTL_GIGA_MAC_VER_LAST = RTL_GIGA_MAC_NONE - 1 + }; +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -99,7 +99,7 @@ static const struct rtl_chip_info { + const char *fw_name; + } rtl_chip_infos[] = { + /* 8126A family. */ +- { 0x7cf, 0x64a, RTL_GIGA_MAC_VER_71, "RTL8126A", FIRMWARE_8126A_3 }, ++ { 0x7cf, 0x64a, RTL_GIGA_MAC_VER_70, "RTL8126A", FIRMWARE_8126A_3 }, + { 0x7cf, 0x649, RTL_GIGA_MAC_VER_70, "RTL8126A", FIRMWARE_8126A_2 }, + + /* 8125BP family. */ +@@ -2943,7 +2943,6 @@ static void rtl_hw_aspm_clkreq_enable(st + rtl_mod_config5(tp, 0, ASPM_en); + switch (tp->mac_version) { + case RTL_GIGA_MAC_VER_70: +- case RTL_GIGA_MAC_VER_71: + val8 = RTL_R8(tp, INT_CFG0_8125) | INT_CFG0_CLKREQEN; + RTL_W8(tp, INT_CFG0_8125, val8); + break; +@@ -2975,7 +2974,6 @@ static void rtl_hw_aspm_clkreq_enable(st + + switch (tp->mac_version) { + case RTL_GIGA_MAC_VER_70: +- case RTL_GIGA_MAC_VER_71: + val8 = RTL_R8(tp, INT_CFG0_8125) & ~INT_CFG0_CLKREQEN; + RTL_W8(tp, INT_CFG0_8125, val8); + break; +@@ -3695,12 +3693,10 @@ static void rtl_hw_start_8125_common(str + /* disable new tx descriptor format */ + r8168_mac_ocp_modify(tp, 0xeb58, 0x0001, 0x0000); + +- if (tp->mac_version == RTL_GIGA_MAC_VER_70 || +- tp->mac_version == RTL_GIGA_MAC_VER_71) ++ if (tp->mac_version == RTL_GIGA_MAC_VER_70) + RTL_W8(tp, 0xD8, RTL_R8(tp, 0xD8) & ~0x02); + +- if (tp->mac_version == RTL_GIGA_MAC_VER_70 || +- tp->mac_version == RTL_GIGA_MAC_VER_71) ++ if (tp->mac_version == RTL_GIGA_MAC_VER_70) + r8168_mac_ocp_modify(tp, 0xe614, 0x0700, 0x0400); + else if (tp->mac_version == RTL_GIGA_MAC_VER_63) + r8168_mac_ocp_modify(tp, 0xe614, 0x0700, 0x0200); +@@ -3718,8 +3714,7 @@ static void rtl_hw_start_8125_common(str + r8168_mac_ocp_modify(tp, 0xe056, 0x00f0, 0x0030); + r8168_mac_ocp_modify(tp, 0xe040, 0x1000, 0x0000); + r8168_mac_ocp_modify(tp, 0xea1c, 0x0003, 0x0001); +- if (tp->mac_version == RTL_GIGA_MAC_VER_70 || +- tp->mac_version == RTL_GIGA_MAC_VER_71) ++ if (tp->mac_version == RTL_GIGA_MAC_VER_70) + r8168_mac_ocp_modify(tp, 0xea1c, 0x0300, 0x0000); + else + r8168_mac_ocp_modify(tp, 0xea1c, 0x0004, 0x0000); +@@ -3842,7 +3837,6 @@ static void rtl_hw_config(struct rtl8169 + [RTL_GIGA_MAC_VER_65] = rtl_hw_start_8125d, + [RTL_GIGA_MAC_VER_66] = rtl_hw_start_8125d, + [RTL_GIGA_MAC_VER_70] = rtl_hw_start_8126a, +- [RTL_GIGA_MAC_VER_71] = rtl_hw_start_8126a, + }; + + if (hw_configs[tp->mac_version]) +@@ -3866,7 +3860,6 @@ static void rtl_hw_start_8125(struct rtl + break; + case RTL_GIGA_MAC_VER_63: + case RTL_GIGA_MAC_VER_70: +- case RTL_GIGA_MAC_VER_71: + for (i = 0xa00; i < 0xa80; i += 4) + RTL_W32(tp, i, 0); + RTL_W16(tp, INT_CFG1_8125, 0x0000); +--- a/drivers/net/ethernet/realtek/r8169_phy_config.c ++++ b/drivers/net/ethernet/realtek/r8169_phy_config.c +@@ -1183,7 +1183,6 @@ void r8169_hw_phy_config(struct rtl8169_ + [RTL_GIGA_MAC_VER_65] = rtl8125d_hw_phy_config, + [RTL_GIGA_MAC_VER_66] = rtl8125bp_hw_phy_config, + [RTL_GIGA_MAC_VER_70] = rtl8126a_hw_phy_config, +- [RTL_GIGA_MAC_VER_71] = rtl8126a_hw_phy_config, + }; + + if (phy_configs[ver]) diff --git a/target/linux/generic/backport-6.6/780-63-v6.16-r8169-merge-chip-versions-64-and-65-RTL8125D.patch b/target/linux/generic/backport-6.6/780-63-v6.16-r8169-merge-chip-versions-64-and-65-RTL8125D.patch new file mode 100644 index 00000000000000..5b29ccd0a10237 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-63-v6.16-r8169-merge-chip-versions-64-and-65-RTL8125D.patch @@ -0,0 +1,65 @@ +From f372ef6ed5a6b0401c884561d4bba1843e54d46a Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Fri, 18 Apr 2025 11:24:30 +0200 +Subject: [PATCH] r8169: merge chip versions 64 and 65 (RTL8125D) + +Handling of both chip versions is the same, only difference is +the firmware. So we can merge handling of both chip versions. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Link: https://patch.msgid.link/0baad123-c679-4154-923f-fdc12783e900@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169.h | 1 - + drivers/net/ethernet/realtek/r8169_main.c | 4 +--- + drivers/net/ethernet/realtek/r8169_phy_config.c | 1 - + 3 files changed, 1 insertion(+), 5 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169.h ++++ b/drivers/net/ethernet/realtek/r8169.h +@@ -69,7 +69,6 @@ enum mac_version { + RTL_GIGA_MAC_VER_61, + RTL_GIGA_MAC_VER_63, + RTL_GIGA_MAC_VER_64, +- RTL_GIGA_MAC_VER_65, + RTL_GIGA_MAC_VER_66, + RTL_GIGA_MAC_VER_70, + RTL_GIGA_MAC_NONE, +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -106,7 +106,7 @@ static const struct rtl_chip_info { + { 0x7cf, 0x681, RTL_GIGA_MAC_VER_66, "RTL8125BP", FIRMWARE_8125BP_2 }, + + /* 8125D family. */ +- { 0x7cf, 0x689, RTL_GIGA_MAC_VER_65, "RTL8125D", FIRMWARE_8125D_2 }, ++ { 0x7cf, 0x689, RTL_GIGA_MAC_VER_64, "RTL8125D", FIRMWARE_8125D_2 }, + { 0x7cf, 0x688, RTL_GIGA_MAC_VER_64, "RTL8125D", FIRMWARE_8125D_1 }, + + /* 8125B family. */ +@@ -3834,7 +3834,6 @@ static void rtl_hw_config(struct rtl8169 + [RTL_GIGA_MAC_VER_61] = rtl_hw_start_8125a_2, + [RTL_GIGA_MAC_VER_63] = rtl_hw_start_8125b, + [RTL_GIGA_MAC_VER_64] = rtl_hw_start_8125d, +- [RTL_GIGA_MAC_VER_65] = rtl_hw_start_8125d, + [RTL_GIGA_MAC_VER_66] = rtl_hw_start_8125d, + [RTL_GIGA_MAC_VER_70] = rtl_hw_start_8126a, + }; +@@ -3853,7 +3852,6 @@ static void rtl_hw_start_8125(struct rtl + switch (tp->mac_version) { + case RTL_GIGA_MAC_VER_61: + case RTL_GIGA_MAC_VER_64: +- case RTL_GIGA_MAC_VER_65: + case RTL_GIGA_MAC_VER_66: + for (i = 0xa00; i < 0xb00; i += 4) + RTL_W32(tp, i, 0); +--- a/drivers/net/ethernet/realtek/r8169_phy_config.c ++++ b/drivers/net/ethernet/realtek/r8169_phy_config.c +@@ -1180,7 +1180,6 @@ void r8169_hw_phy_config(struct rtl8169_ + [RTL_GIGA_MAC_VER_61] = rtl8125a_2_hw_phy_config, + [RTL_GIGA_MAC_VER_63] = rtl8125b_hw_phy_config, + [RTL_GIGA_MAC_VER_64] = rtl8125d_hw_phy_config, +- [RTL_GIGA_MAC_VER_65] = rtl8125d_hw_phy_config, + [RTL_GIGA_MAC_VER_66] = rtl8125bp_hw_phy_config, + [RTL_GIGA_MAC_VER_70] = rtl8126a_hw_phy_config, + }; diff --git a/target/linux/generic/backport-6.6/780-64-v6.16-r8169-merge-chip-versions-52-and-53-RTL8117.patch b/target/linux/generic/backport-6.6/780-64-v6.16-r8169-merge-chip-versions-52-and-53-RTL8117.patch new file mode 100644 index 00000000000000..a03eb9f208b026 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-64-v6.16-r8169-merge-chip-versions-52-and-53-RTL8117.patch @@ -0,0 +1,113 @@ +From 4f51e7d370a04122fa78470b031d6487c52298b1 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Fri, 18 Apr 2025 11:25:17 +0200 +Subject: [PATCH] r8169: merge chip versions 52 and 53 (RTL8117) + +Handling of both chip versions is the same, only difference is +the firmware. So we can merge handling of both chip versions. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Link: https://patch.msgid.link/ae866b71-c904-434e-befb-848c831e33ff@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169.h | 1 - + drivers/net/ethernet/realtek/r8169_main.c | 17 +++++++---------- + drivers/net/ethernet/realtek/r8169_phy_config.c | 1 - + 3 files changed, 7 insertions(+), 12 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169.h ++++ b/drivers/net/ethernet/realtek/r8169.h +@@ -64,7 +64,6 @@ enum mac_version { + /* support for RTL_GIGA_MAC_VER_50 has been removed */ + RTL_GIGA_MAC_VER_51, + RTL_GIGA_MAC_VER_52, +- RTL_GIGA_MAC_VER_53, + /* support for RTL_GIGA_MAC_VER_60 has been removed */ + RTL_GIGA_MAC_VER_61, + RTL_GIGA_MAC_VER_63, +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -116,7 +116,7 @@ static const struct rtl_chip_info { + { 0x7cf, 0x609, RTL_GIGA_MAC_VER_61, "RTL8125A", FIRMWARE_8125A_3 }, + + /* RTL8117 */ +- { 0x7cf, 0x54b, RTL_GIGA_MAC_VER_53, "RTL8168fp/RTL8117" }, ++ { 0x7cf, 0x54b, RTL_GIGA_MAC_VER_52, "RTL8168fp/RTL8117" }, + { 0x7cf, 0x54a, RTL_GIGA_MAC_VER_52, "RTL8168fp/RTL8117", + FIRMWARE_8168FP_3 }, + +@@ -831,7 +831,7 @@ static bool rtl_is_8168evl_up(struct rtl + { + return tp->mac_version >= RTL_GIGA_MAC_VER_34 && + tp->mac_version != RTL_GIGA_MAC_VER_39 && +- tp->mac_version <= RTL_GIGA_MAC_VER_53; ++ tp->mac_version <= RTL_GIGA_MAC_VER_52; + } + + static bool rtl_supports_eee(struct rtl8169_private *tp) +@@ -999,9 +999,7 @@ void r8169_get_led_name(struct rtl8169_p + static void r8168fp_adjust_ocp_cmd(struct rtl8169_private *tp, u32 *cmd, int type) + { + /* based on RTL8168FP_OOBMAC_BASE in vendor driver */ +- if (type == ERIAR_OOB && +- (tp->mac_version == RTL_GIGA_MAC_VER_52 || +- tp->mac_version == RTL_GIGA_MAC_VER_53)) ++ if (type == ERIAR_OOB && tp->mac_version == RTL_GIGA_MAC_VER_52) + *cmd |= 0xf70 << 18; + } + +@@ -1501,7 +1499,7 @@ static enum rtl_dash_type rtl_get_dash_t + case RTL_GIGA_MAC_VER_28: + case RTL_GIGA_MAC_VER_31: + return RTL_DASH_DP; +- case RTL_GIGA_MAC_VER_51 ... RTL_GIGA_MAC_VER_53: ++ case RTL_GIGA_MAC_VER_51 ... RTL_GIGA_MAC_VER_52: + return RTL_DASH_EP; + case RTL_GIGA_MAC_VER_66: + return RTL_DASH_25_BP; +@@ -2489,7 +2487,7 @@ static void rtl_init_rxcfg(struct rtl816 + case RTL_GIGA_MAC_VER_38: + RTL_W32(tp, RxConfig, RX128_INT_EN | RX_MULTI_EN | RX_DMA_BURST); + break; +- case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_53: ++ case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_52: + RTL_W32(tp, RxConfig, RX128_INT_EN | RX_MULTI_EN | RX_DMA_BURST | RX_EARLY_OFF); + break; + case RTL_GIGA_MAC_VER_61: +@@ -2620,7 +2618,7 @@ DECLARE_RTL_COND(rtl_rxtx_empty_cond_2) + static void rtl_wait_txrx_fifo_empty(struct rtl8169_private *tp) + { + switch (tp->mac_version) { +- case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_53: ++ case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_52: + rtl_loop_wait_high(tp, &rtl_txcfg_empty_cond, 100, 42); + rtl_loop_wait_high(tp, &rtl_rxtx_empty_cond, 100, 42); + break; +@@ -3830,7 +3828,6 @@ static void rtl_hw_config(struct rtl8169 + [RTL_GIGA_MAC_VER_48] = rtl_hw_start_8168h_1, + [RTL_GIGA_MAC_VER_51] = rtl_hw_start_8168ep_3, + [RTL_GIGA_MAC_VER_52] = rtl_hw_start_8117, +- [RTL_GIGA_MAC_VER_53] = rtl_hw_start_8117, + [RTL_GIGA_MAC_VER_61] = rtl_hw_start_8125a_2, + [RTL_GIGA_MAC_VER_63] = rtl_hw_start_8125b, + [RTL_GIGA_MAC_VER_64] = rtl_hw_start_8125d, +@@ -5293,7 +5290,7 @@ static void rtl_hw_init_8125(struct rtl8 + static void rtl_hw_initialize(struct rtl8169_private *tp) + { + switch (tp->mac_version) { +- case RTL_GIGA_MAC_VER_51 ... RTL_GIGA_MAC_VER_53: ++ case RTL_GIGA_MAC_VER_51 ... RTL_GIGA_MAC_VER_52: + rtl8168ep_stop_cmac(tp); + fallthrough; + case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_48: +--- a/drivers/net/ethernet/realtek/r8169_phy_config.c ++++ b/drivers/net/ethernet/realtek/r8169_phy_config.c +@@ -1176,7 +1176,6 @@ void r8169_hw_phy_config(struct rtl8169_ + [RTL_GIGA_MAC_VER_48] = rtl8168h_2_hw_phy_config, + [RTL_GIGA_MAC_VER_51] = rtl8168ep_2_hw_phy_config, + [RTL_GIGA_MAC_VER_52] = rtl8117_hw_phy_config, +- [RTL_GIGA_MAC_VER_53] = rtl8117_hw_phy_config, + [RTL_GIGA_MAC_VER_61] = rtl8125a_2_hw_phy_config, + [RTL_GIGA_MAC_VER_63] = rtl8125b_hw_phy_config, + [RTL_GIGA_MAC_VER_64] = rtl8125d_hw_phy_config, diff --git a/target/linux/generic/backport-6.6/780-65-v6.16-r8169-add-support-for-RTL8127A.patch b/target/linux/generic/backport-6.6/780-65-v6.16-r8169-add-support-for-RTL8127A.patch new file mode 100644 index 00000000000000..93f7bbc0cf2a37 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-65-v6.16-r8169-add-support-for-RTL8127A.patch @@ -0,0 +1,323 @@ +From f24f7b2f3af9e008ded20f804d7829ee2efd43f2 Mon Sep 17 00:00:00 2001 +From: ChunHao Lin +Date: Thu, 15 May 2025 17:53:03 +0800 +Subject: [PATCH] r8169: add support for RTL8127A + +This adds support for 10Gbs chip RTL8127A. + +Signed-off-by: ChunHao Lin +Reviewed-by: Heiner Kallweit +Link: https://patch.msgid.link/20250515095303.3138-1-hau@realtek.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169.h | 1 + + drivers/net/ethernet/realtek/r8169_main.c | 29 ++- + .../net/ethernet/realtek/r8169_phy_config.c | 166 ++++++++++++++++++ + 3 files changed, 193 insertions(+), 3 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169.h ++++ b/drivers/net/ethernet/realtek/r8169.h +@@ -70,6 +70,7 @@ enum mac_version { + RTL_GIGA_MAC_VER_64, + RTL_GIGA_MAC_VER_66, + RTL_GIGA_MAC_VER_70, ++ RTL_GIGA_MAC_VER_80, + RTL_GIGA_MAC_NONE, + RTL_GIGA_MAC_VER_LAST = RTL_GIGA_MAC_NONE - 1 + }; +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -60,6 +60,7 @@ + #define FIRMWARE_8125BP_2 "rtl_nic/rtl8125bp-2.fw" + #define FIRMWARE_8126A_2 "rtl_nic/rtl8126a-2.fw" + #define FIRMWARE_8126A_3 "rtl_nic/rtl8126a-3.fw" ++#define FIRMWARE_8127A_1 "rtl_nic/rtl8127a-1.fw" + + #define TX_DMA_BURST 7 /* Maximum PCI burst, '7' is unlimited */ + #define InterFrameGap 0x03 /* 3 means InterFrameGap = the shortest one */ +@@ -98,6 +99,9 @@ static const struct rtl_chip_info { + const char *name; + const char *fw_name; + } rtl_chip_infos[] = { ++ /* 8127A family. */ ++ { 0x7cf, 0x6c9, RTL_GIGA_MAC_VER_80, "RTL8127A", FIRMWARE_8127A_1 }, ++ + /* 8126A family. */ + { 0x7cf, 0x64a, RTL_GIGA_MAC_VER_70, "RTL8126A", FIRMWARE_8126A_3 }, + { 0x7cf, 0x649, RTL_GIGA_MAC_VER_70, "RTL8126A", FIRMWARE_8126A_2 }, +@@ -222,8 +226,10 @@ static const struct pci_device_id rtl816 + { 0x0001, 0x8168, PCI_ANY_ID, 0x2410 }, + { PCI_VDEVICE(REALTEK, 0x8125) }, + { PCI_VDEVICE(REALTEK, 0x8126) }, ++ { PCI_VDEVICE(REALTEK, 0x8127) }, + { PCI_VDEVICE(REALTEK, 0x3000) }, + { PCI_VDEVICE(REALTEK, 0x5000) }, ++ { PCI_VDEVICE(REALTEK, 0x0e10) }, + {} + }; + +@@ -770,6 +776,7 @@ MODULE_FIRMWARE(FIRMWARE_8125D_2); + MODULE_FIRMWARE(FIRMWARE_8125BP_2); + MODULE_FIRMWARE(FIRMWARE_8126A_2); + MODULE_FIRMWARE(FIRMWARE_8126A_3); ++MODULE_FIRMWARE(FIRMWARE_8127A_1); + + static inline struct device *tp_to_dev(struct rtl8169_private *tp) + { +@@ -2941,6 +2948,7 @@ static void rtl_hw_aspm_clkreq_enable(st + rtl_mod_config5(tp, 0, ASPM_en); + switch (tp->mac_version) { + case RTL_GIGA_MAC_VER_70: ++ case RTL_GIGA_MAC_VER_80: + val8 = RTL_R8(tp, INT_CFG0_8125) | INT_CFG0_CLKREQEN; + RTL_W8(tp, INT_CFG0_8125, val8); + break; +@@ -2972,6 +2980,7 @@ static void rtl_hw_aspm_clkreq_enable(st + + switch (tp->mac_version) { + case RTL_GIGA_MAC_VER_70: ++ case RTL_GIGA_MAC_VER_80: + val8 = RTL_R8(tp, INT_CFG0_8125) & ~INT_CFG0_CLKREQEN; + RTL_W8(tp, INT_CFG0_8125, val8); + break; +@@ -3691,10 +3700,13 @@ static void rtl_hw_start_8125_common(str + /* disable new tx descriptor format */ + r8168_mac_ocp_modify(tp, 0xeb58, 0x0001, 0x0000); + +- if (tp->mac_version == RTL_GIGA_MAC_VER_70) ++ if (tp->mac_version == RTL_GIGA_MAC_VER_70 || ++ tp->mac_version == RTL_GIGA_MAC_VER_80) + RTL_W8(tp, 0xD8, RTL_R8(tp, 0xD8) & ~0x02); + +- if (tp->mac_version == RTL_GIGA_MAC_VER_70) ++ if (tp->mac_version == RTL_GIGA_MAC_VER_80) ++ r8168_mac_ocp_modify(tp, 0xe614, 0x0f00, 0x0f00); ++ else if (tp->mac_version == RTL_GIGA_MAC_VER_70) + r8168_mac_ocp_modify(tp, 0xe614, 0x0700, 0x0400); + else if (tp->mac_version == RTL_GIGA_MAC_VER_63) + r8168_mac_ocp_modify(tp, 0xe614, 0x0700, 0x0200); +@@ -3712,7 +3724,8 @@ static void rtl_hw_start_8125_common(str + r8168_mac_ocp_modify(tp, 0xe056, 0x00f0, 0x0030); + r8168_mac_ocp_modify(tp, 0xe040, 0x1000, 0x0000); + r8168_mac_ocp_modify(tp, 0xea1c, 0x0003, 0x0001); +- if (tp->mac_version == RTL_GIGA_MAC_VER_70) ++ if (tp->mac_version == RTL_GIGA_MAC_VER_70 || ++ tp->mac_version == RTL_GIGA_MAC_VER_80) + r8168_mac_ocp_modify(tp, 0xea1c, 0x0300, 0x0000); + else + r8168_mac_ocp_modify(tp, 0xea1c, 0x0004, 0x0000); +@@ -3790,6 +3803,12 @@ static void rtl_hw_start_8126a(struct rt + rtl_hw_start_8125_common(tp); + } + ++static void rtl_hw_start_8127a(struct rtl8169_private *tp) ++{ ++ rtl_set_def_aspm_entry_latency(tp); ++ rtl_hw_start_8125_common(tp); ++} ++ + static void rtl_hw_config(struct rtl8169_private *tp) + { + static const rtl_generic_fct hw_configs[] = { +@@ -3833,6 +3852,7 @@ static void rtl_hw_config(struct rtl8169 + [RTL_GIGA_MAC_VER_64] = rtl_hw_start_8125d, + [RTL_GIGA_MAC_VER_66] = rtl_hw_start_8125d, + [RTL_GIGA_MAC_VER_70] = rtl_hw_start_8126a, ++ [RTL_GIGA_MAC_VER_80] = rtl_hw_start_8127a, + }; + + if (hw_configs[tp->mac_version]) +@@ -3850,8 +3870,11 @@ static void rtl_hw_start_8125(struct rtl + case RTL_GIGA_MAC_VER_61: + case RTL_GIGA_MAC_VER_64: + case RTL_GIGA_MAC_VER_66: ++ case RTL_GIGA_MAC_VER_80: + for (i = 0xa00; i < 0xb00; i += 4) + RTL_W32(tp, i, 0); ++ if (tp->mac_version == RTL_GIGA_MAC_VER_80) ++ RTL_W16(tp, INT_CFG1_8125, 0x0000); + break; + case RTL_GIGA_MAC_VER_63: + case RTL_GIGA_MAC_VER_70: +--- a/drivers/net/ethernet/realtek/r8169_phy_config.c ++++ b/drivers/net/ethernet/realtek/r8169_phy_config.c +@@ -1130,6 +1130,171 @@ static void rtl8126a_hw_phy_config(struc + rtl8125_common_config_eee_phy(phydev); + } + ++static void rtl8127a_1_hw_phy_config(struct rtl8169_private *tp, ++ struct phy_device *phydev) ++{ ++ r8169_apply_firmware(tp); ++ rtl8168g_enable_gphy_10m(phydev); ++ ++ r8168g_phy_param(phydev, 0x8415, 0xff00, 0x9300); ++ r8168g_phy_param(phydev, 0x81a3, 0xff00, 0x0f00); ++ r8168g_phy_param(phydev, 0x81ae, 0xff00, 0x0f00); ++ r8168g_phy_param(phydev, 0x81b9, 0xff00, 0xb900); ++ rtl8125_phy_param(phydev, 0x83b0, 0x0e00, 0x0000); ++ rtl8125_phy_param(phydev, 0x83C5, 0x0e00, 0x0000); ++ rtl8125_phy_param(phydev, 0x83da, 0x0e00, 0x0000); ++ rtl8125_phy_param(phydev, 0x83ef, 0x0e00, 0x0000); ++ phy_modify_paged(phydev, 0x0bf3, 0x14, 0x01f0, 0x0160); ++ phy_modify_paged(phydev, 0x0bf3, 0x15, 0x001f, 0x0014); ++ phy_modify_paged(phydev, 0x0bf2, 0x14, 0x6000, 0x0000); ++ phy_modify_paged(phydev, 0x0bf2, 0x16, 0xc000, 0x0000); ++ phy_modify_paged(phydev, 0x0bf2, 0x14, 0x1fff, 0x0187); ++ phy_modify_paged(phydev, 0x0bf2, 0x15, 0x003f, 0x0003); ++ ++ r8168g_phy_param(phydev, 0x8173, 0xffff, 0x8620); ++ r8168g_phy_param(phydev, 0x8175, 0xffff, 0x8671); ++ r8168g_phy_param(phydev, 0x817c, 0x0000, 0x2000); ++ r8168g_phy_param(phydev, 0x8187, 0x0000, 0x2000); ++ r8168g_phy_param(phydev, 0x8192, 0x0000, 0x2000); ++ r8168g_phy_param(phydev, 0x819d, 0x0000, 0x2000); ++ r8168g_phy_param(phydev, 0x81a8, 0x2000, 0x0000); ++ r8168g_phy_param(phydev, 0x81b3, 0x2000, 0x0000); ++ r8168g_phy_param(phydev, 0x81be, 0x0000, 0x2000); ++ r8168g_phy_param(phydev, 0x817d, 0xff00, 0xa600); ++ r8168g_phy_param(phydev, 0x8188, 0xff00, 0xa600); ++ r8168g_phy_param(phydev, 0x8193, 0xff00, 0xa600); ++ r8168g_phy_param(phydev, 0x819e, 0xff00, 0xa600); ++ r8168g_phy_param(phydev, 0x81a9, 0xff00, 0x1400); ++ r8168g_phy_param(phydev, 0x81b4, 0xff00, 0x1400); ++ r8168g_phy_param(phydev, 0x81bf, 0xff00, 0xa600); ++ ++ phy_modify_paged(phydev, 0x0aea, 0x15, 0x0028, 0x0000); ++ ++ rtl8125_phy_param(phydev, 0x84f0, 0xffff, 0x201c); ++ rtl8125_phy_param(phydev, 0x84f2, 0xffff, 0x3117); ++ ++ phy_write_paged(phydev, 0x0aec, 0x13, 0x0000); ++ phy_write_paged(phydev, 0x0ae2, 0x10, 0xffff); ++ phy_write_paged(phydev, 0x0aec, 0x17, 0xffff); ++ phy_write_paged(phydev, 0x0aed, 0x11, 0xffff); ++ phy_write_paged(phydev, 0x0aec, 0x14, 0x0000); ++ phy_modify_paged(phydev, 0x0aed, 0x10, 0x0001, 0x0000); ++ phy_write_paged(phydev, 0x0adb, 0x14, 0x0150); ++ rtl8125_phy_param(phydev, 0x8197, 0xff00, 0x5000); ++ rtl8125_phy_param(phydev, 0x8231, 0xff00, 0x5000); ++ rtl8125_phy_param(phydev, 0x82cb, 0xff00, 0x5000); ++ rtl8125_phy_param(phydev, 0x82cd, 0xff00, 0x5700); ++ rtl8125_phy_param(phydev, 0x8233, 0xff00, 0x5700); ++ rtl8125_phy_param(phydev, 0x8199, 0xff00, 0x5700); ++ ++ rtl8125_phy_param(phydev, 0x815a, 0xffff, 0x0150); ++ rtl8125_phy_param(phydev, 0x81f4, 0xffff, 0x0150); ++ rtl8125_phy_param(phydev, 0x828e, 0xffff, 0x0150); ++ rtl8125_phy_param(phydev, 0x81b1, 0xffff, 0x0000); ++ rtl8125_phy_param(phydev, 0x824b, 0xffff, 0x0000); ++ rtl8125_phy_param(phydev, 0x82e5, 0xffff, 0x0000); ++ ++ rtl8125_phy_param(phydev, 0x84f7, 0xff00, 0x2800); ++ phy_modify_paged(phydev, 0x0aec, 0x11, 0x0000, 0x1000); ++ rtl8125_phy_param(phydev, 0x81b3, 0xff00, 0xad00); ++ rtl8125_phy_param(phydev, 0x824d, 0xff00, 0xad00); ++ rtl8125_phy_param(phydev, 0x82e7, 0xff00, 0xad00); ++ phy_modify_paged(phydev, 0x0ae4, 0x17, 0x000f, 0x0001); ++ rtl8125_phy_param(phydev, 0x82ce, 0xf000, 0x4000); ++ ++ rtl8125_phy_param(phydev, 0x84ac, 0xffff, 0x0000); ++ rtl8125_phy_param(phydev, 0x84ae, 0xffff, 0x0000); ++ rtl8125_phy_param(phydev, 0x84b0, 0xffff, 0xf818); ++ rtl8125_phy_param(phydev, 0x84b2, 0xff00, 0x6000); ++ ++ rtl8125_phy_param(phydev, 0x8ffc, 0xffff, 0x6008); ++ rtl8125_phy_param(phydev, 0x8ffe, 0xffff, 0xf450); ++ ++ rtl8125_phy_param(phydev, 0x8015, 0x0000, 0x0200); ++ rtl8125_phy_param(phydev, 0x8016, 0x0800, 0x0000); ++ rtl8125_phy_param(phydev, 0x8fe6, 0xff00, 0x0800); ++ rtl8125_phy_param(phydev, 0x8fe4, 0xffff, 0x2114); ++ ++ rtl8125_phy_param(phydev, 0x8647, 0xffff, 0xa7b1); ++ rtl8125_phy_param(phydev, 0x8649, 0xffff, 0xbbca); ++ rtl8125_phy_param(phydev, 0x864b, 0xff00, 0xdc00); ++ ++ rtl8125_phy_param(phydev, 0x8154, 0xc000, 0x4000); ++ rtl8125_phy_param(phydev, 0x8158, 0xc000, 0x0000); ++ ++ rtl8125_phy_param(phydev, 0x826c, 0xffff, 0xffff); ++ rtl8125_phy_param(phydev, 0x826e, 0xffff, 0xffff); ++ ++ rtl8125_phy_param(phydev, 0x8872, 0xff00, 0x0e00); ++ r8168g_phy_param(phydev, 0x8012, 0x0000, 0x0800); ++ r8168g_phy_param(phydev, 0x8012, 0x0000, 0x4000); ++ phy_modify_paged(phydev, 0x0b57, 0x13, 0x0000, 0x0001); ++ r8168g_phy_param(phydev, 0x834a, 0xff00, 0x0700); ++ rtl8125_phy_param(phydev, 0x8217, 0x3f00, 0x2a00); ++ r8168g_phy_param(phydev, 0x81b1, 0xff00, 0x0b00); ++ rtl8125_phy_param(phydev, 0x8fed, 0xff00, 0x4e00); ++ ++ rtl8125_phy_param(phydev, 0x88ac, 0xff00, 0x2300); ++ phy_modify_paged(phydev, 0x0bf0, 0x16, 0x0000, 0x3800); ++ rtl8125_phy_param(phydev, 0x88de, 0xff00, 0x0000); ++ rtl8125_phy_param(phydev, 0x80b4, 0xffff, 0x5195); ++ ++ r8168g_phy_param(phydev, 0x8370, 0xffff, 0x8671); ++ r8168g_phy_param(phydev, 0x8372, 0xffff, 0x86c8); ++ ++ r8168g_phy_param(phydev, 0x8401, 0xffff, 0x86c8); ++ r8168g_phy_param(phydev, 0x8403, 0xffff, 0x86da); ++ r8168g_phy_param(phydev, 0x8406, 0x1800, 0x1000); ++ r8168g_phy_param(phydev, 0x8408, 0x1800, 0x1000); ++ r8168g_phy_param(phydev, 0x840a, 0x1800, 0x1000); ++ r8168g_phy_param(phydev, 0x840c, 0x1800, 0x1000); ++ r8168g_phy_param(phydev, 0x840e, 0x1800, 0x1000); ++ r8168g_phy_param(phydev, 0x8410, 0x1800, 0x1000); ++ r8168g_phy_param(phydev, 0x8412, 0x1800, 0x1000); ++ r8168g_phy_param(phydev, 0x8414, 0x1800, 0x1000); ++ r8168g_phy_param(phydev, 0x8416, 0x1800, 0x1000); ++ ++ r8168g_phy_param(phydev, 0x82bd, 0xffff, 0x1f40); ++ ++ phy_modify_paged(phydev, 0x0bfb, 0x12, 0x07ff, 0x0328); ++ phy_write_paged(phydev, 0x0bfb, 0x13, 0x3e14); ++ ++ r8168g_phy_param(phydev, 0x81c4, 0xffff, 0x003b); ++ r8168g_phy_param(phydev, 0x81c6, 0xffff, 0x0086); ++ r8168g_phy_param(phydev, 0x81c8, 0xffff, 0x00b7); ++ r8168g_phy_param(phydev, 0x81ca, 0xffff, 0x00db); ++ r8168g_phy_param(phydev, 0x81cc, 0xffff, 0x00fe); ++ r8168g_phy_param(phydev, 0x81ce, 0xffff, 0x00fe); ++ r8168g_phy_param(phydev, 0x81d0, 0xffff, 0x00fe); ++ r8168g_phy_param(phydev, 0x81d2, 0xffff, 0x00fe); ++ r8168g_phy_param(phydev, 0x81d4, 0xffff, 0x00c3); ++ r8168g_phy_param(phydev, 0x81d6, 0xffff, 0x0078); ++ r8168g_phy_param(phydev, 0x81d8, 0xffff, 0x0047); ++ r8168g_phy_param(phydev, 0x81da, 0xffff, 0x0023); ++ ++ rtl8125_phy_param(phydev, 0x88d7, 0xffff, 0x01a0); ++ rtl8125_phy_param(phydev, 0x88d9, 0xffff, 0x01a0); ++ rtl8125_phy_param(phydev, 0x8ffa, 0xffff, 0x002a); ++ ++ rtl8125_phy_param(phydev, 0x8fee, 0xffff, 0xffdf); ++ rtl8125_phy_param(phydev, 0x8ff0, 0xffff, 0xffff); ++ rtl8125_phy_param(phydev, 0x8ff2, 0xffff, 0x0a4a); ++ rtl8125_phy_param(phydev, 0x8ff4, 0xffff, 0xaa5a); ++ rtl8125_phy_param(phydev, 0x8ff6, 0xffff, 0x0a4a); ++ ++ rtl8125_phy_param(phydev, 0x8ff8, 0xffff, 0xaa5a); ++ rtl8125_phy_param(phydev, 0x88d5, 0xff00, 0x0200); ++ ++ r8168g_phy_param(phydev, 0x84bb, 0xff00, 0x0a00); ++ r8168g_phy_param(phydev, 0x84c0, 0xff00, 0x1600); ++ ++ phy_modify_paged(phydev, 0x0a43, 0x10, 0x0000, 0x0003); ++ ++ rtl8125_legacy_force_mode(phydev); ++ rtl8168g_disable_aldps(phydev); ++ rtl8125_common_config_eee_phy(phydev); ++} ++ + void r8169_hw_phy_config(struct rtl8169_private *tp, struct phy_device *phydev, + enum mac_version ver) + { +@@ -1181,6 +1346,7 @@ void r8169_hw_phy_config(struct rtl8169_ + [RTL_GIGA_MAC_VER_64] = rtl8125d_hw_phy_config, + [RTL_GIGA_MAC_VER_66] = rtl8125bp_hw_phy_config, + [RTL_GIGA_MAC_VER_70] = rtl8126a_hw_phy_config, ++ [RTL_GIGA_MAC_VER_80] = rtl8127a_1_hw_phy_config, + }; + + if (phy_configs[ver]) From 424788fc467a622e0187bf715a29d6a9feb702b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Thu, 22 May 2025 10:43:00 +0200 Subject: [PATCH 677/877] generic: backport upstream v6.16 Realtek PHY patches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 83d962316128 net: phy: realtek: add RTL8127-internal PHY 708686132ba0 net: phy: realtek: Add support for PHY LEDs on RTL8211E be1cc96ddf82 net: phy: realtek: use __set_bit() in rtl8211f_led_hw_control_get() 8c4d0172657c net: phy: realtek: Group RTL82* macro definitions 12d40df259e3 net: phy: realtek: add RTL8211F register defines 7c6fa3ffd265 net: phy: realtek: Clean up RTL821x ExtPage access f3b265358b91 net: phy: realtek: remove unsed RTL821x_PHYSR* macros 7840e4d6f48a net: phy: realtek: Add support for WOL magic packet on RTL8211F Signed-off-by: Álvaro Fernández Rojas (cherry picled from commit d8375034b8f7d7950fef1fc14bf235511113ceca) --- ...-Add-support-for-WOL-magic-packet-on.patch | 126 ++++++++++ ...ek-remove-unsed-RTL821x_PHYSR-macros.patch | 28 +++ ...ltek-Clean-up-RTL821x-ExtPage-access.patch | 95 ++++++++ ...ealtek-add-RTL8211F-register-defines.patch | 139 +++++++++++ ...ealtek-Group-RTL82-macro-definitions.patch | 123 ++++++++++ ...use-__set_bit-in-rtl8211f_led_hw_con.patch | 42 ++++ ...Add-support-for-PHY-LEDs-on-RTL8211E.patch | 215 ++++++++++++++++++ ...phy-realtek-add-RTL8127-internal-PHY.patch | 35 +++ ...-use-genphy_soft_reset-for-2.5G-PHYs.patch | 16 +- ...sable-SGMII-in-band-AN-for-2-5G-PHYs.patch | 4 +- ...make-sure-paged-read-is-protected-by.patch | 2 +- .../720-04-net-phy-realtek-setup-aldps.patch | 4 +- ...tek-detect-early-version-of-RTL8221B.patch | 2 +- ...ealtek-support-interrupt-of-RTL8221B.patch | 10 +- ...ealtek-mark-existing-MMDs-as-present.patch | 2 +- ...hy-realtek-work-around-broken-serdes.patch | 6 +- ...t-phy-realtek-disable-MDIO-broadcast.patch | 2 +- 17 files changed, 827 insertions(+), 24 deletions(-) create mode 100644 target/linux/generic/backport-6.6/781-34-v6.16-net-phy-realtek-Add-support-for-WOL-magic-packet-on.patch create mode 100644 target/linux/generic/backport-6.6/781-35-v6.16-net-phy-realtek-remove-unsed-RTL821x_PHYSR-macros.patch create mode 100644 target/linux/generic/backport-6.6/781-36-v6.16-net-phy-realtek-Clean-up-RTL821x-ExtPage-access.patch create mode 100644 target/linux/generic/backport-6.6/781-37-v6.16-net-phy-realtek-add-RTL8211F-register-defines.patch create mode 100644 target/linux/generic/backport-6.6/781-38-v6.16-net-phy-realtek-Group-RTL82-macro-definitions.patch create mode 100644 target/linux/generic/backport-6.6/781-39-v6.16-net-phy-realtek-use-__set_bit-in-rtl8211f_led_hw_con.patch create mode 100644 target/linux/generic/backport-6.6/781-40-v6.16-net-phy-realtek-Add-support-for-PHY-LEDs-on-RTL8211E.patch create mode 100644 target/linux/generic/backport-6.6/781-41-v6.16-net-phy-realtek-add-RTL8127-internal-PHY.patch diff --git a/target/linux/generic/backport-6.6/781-34-v6.16-net-phy-realtek-Add-support-for-WOL-magic-packet-on.patch b/target/linux/generic/backport-6.6/781-34-v6.16-net-phy-realtek-Add-support-for-WOL-magic-packet-on.patch new file mode 100644 index 00000000000000..4ba06cc3dd2a0f --- /dev/null +++ b/target/linux/generic/backport-6.6/781-34-v6.16-net-phy-realtek-Add-support-for-WOL-magic-packet-on.patch @@ -0,0 +1,126 @@ +From 7840e4d6f48a75413470935ebdc4bab4fc0c035e Mon Sep 17 00:00:00 2001 +From: Daniel Braunwarth +Date: Tue, 29 Apr 2025 13:33:37 +0200 +Subject: [PATCH] net: phy: realtek: Add support for WOL magic packet on + RTL8211F + +The RTL8211F supports multiple WOL modes. This patch adds support for +magic packets. + +The PHY notifies the system via the INTB/PMEB pin when a WOL event +occurs. + +Signed-off-by: Daniel Braunwarth +Reviewed-by: Andrew Lunn +Link: https://patch.msgid.link/20250429-realtek_wol-v2-1-8f84def1ef2c@kuka.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/phy/realtek/realtek_main.c | 69 ++++++++++++++++++++++++++ + 1 file changed, 69 insertions(+) + +--- a/drivers/net/phy/realtek/realtek_main.c ++++ b/drivers/net/phy/realtek/realtek_main.c +@@ -10,6 +10,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -38,6 +39,24 @@ + + #define RTL8211F_INSR 0x1d + ++/* RTL8211F WOL interrupt configuration */ ++#define RTL8211F_INTBCR_PAGE 0xd40 ++#define RTL8211F_INTBCR 0x16 ++#define RTL8211F_INTBCR_INTB_PMEB BIT(5) ++ ++/* RTL8211F WOL settings */ ++#define RTL8211F_WOL_SETTINGS_PAGE 0xd8a ++#define RTL8211F_WOL_SETTINGS_EVENTS 16 ++#define RTL8211F_WOL_EVENT_MAGIC BIT(12) ++#define RTL8211F_WOL_SETTINGS_STATUS 17 ++#define RTL8211F_WOL_STATUS_RESET (BIT(15) | 0x1fff) ++ ++/* RTL8211F Unique phyiscal and multicast address (WOL) */ ++#define RTL8211F_PHYSICAL_ADDR_PAGE 0xd8c ++#define RTL8211F_PHYSICAL_ADDR_WORD0 16 ++#define RTL8211F_PHYSICAL_ADDR_WORD1 17 ++#define RTL8211F_PHYSICAL_ADDR_WORD2 18 ++ + #define RTL8211F_LEDCR 0x10 + #define RTL8211F_LEDCR_MODE BIT(15) + #define RTL8211F_LEDCR_ACT_TXRX BIT(4) +@@ -123,6 +142,7 @@ struct rtl821x_priv { + u16 phycr2; + bool has_phycr2; + struct clk *clk; ++ u32 saved_wolopts; + }; + + static int rtl821x_read_page(struct phy_device *phydev) +@@ -354,6 +374,53 @@ static irqreturn_t rtl8211f_handle_inter + return IRQ_HANDLED; + } + ++static void rtl8211f_get_wol(struct phy_device *dev, struct ethtool_wolinfo *wol) ++{ ++ wol->supported = WAKE_MAGIC; ++ if (phy_read_paged(dev, RTL8211F_WOL_SETTINGS_PAGE, RTL8211F_WOL_SETTINGS_EVENTS) ++ & RTL8211F_WOL_EVENT_MAGIC) ++ wol->wolopts = WAKE_MAGIC; ++} ++ ++static int rtl8211f_set_wol(struct phy_device *dev, struct ethtool_wolinfo *wol) ++{ ++ const u8 *mac_addr = dev->attached_dev->dev_addr; ++ int oldpage; ++ ++ oldpage = phy_save_page(dev); ++ if (oldpage < 0) ++ goto err; ++ ++ if (wol->wolopts & WAKE_MAGIC) { ++ /* Store the device address for the magic packet */ ++ rtl821x_write_page(dev, RTL8211F_PHYSICAL_ADDR_PAGE); ++ __phy_write(dev, RTL8211F_PHYSICAL_ADDR_WORD0, mac_addr[1] << 8 | (mac_addr[0])); ++ __phy_write(dev, RTL8211F_PHYSICAL_ADDR_WORD1, mac_addr[3] << 8 | (mac_addr[2])); ++ __phy_write(dev, RTL8211F_PHYSICAL_ADDR_WORD2, mac_addr[5] << 8 | (mac_addr[4])); ++ ++ /* Enable magic packet matching and reset WOL status */ ++ rtl821x_write_page(dev, RTL8211F_WOL_SETTINGS_PAGE); ++ __phy_write(dev, RTL8211F_WOL_SETTINGS_EVENTS, RTL8211F_WOL_EVENT_MAGIC); ++ __phy_write(dev, RTL8211F_WOL_SETTINGS_STATUS, RTL8211F_WOL_STATUS_RESET); ++ ++ /* Enable the WOL interrupt */ ++ rtl821x_write_page(dev, RTL8211F_INTBCR_PAGE); ++ __phy_set_bits(dev, RTL8211F_INTBCR, RTL8211F_INTBCR_INTB_PMEB); ++ } else { ++ /* Disable the WOL interrupt */ ++ rtl821x_write_page(dev, RTL8211F_INTBCR_PAGE); ++ __phy_clear_bits(dev, RTL8211F_INTBCR, RTL8211F_INTBCR_INTB_PMEB); ++ ++ /* Disable magic packet matching and reset WOL status */ ++ rtl821x_write_page(dev, RTL8211F_WOL_SETTINGS_PAGE); ++ __phy_write(dev, RTL8211F_WOL_SETTINGS_EVENTS, 0); ++ __phy_write(dev, RTL8211F_WOL_SETTINGS_STATUS, RTL8211F_WOL_STATUS_RESET); ++ } ++ ++err: ++ return phy_restore_page(dev, oldpage, 0); ++} ++ + static int rtl8211_config_aneg(struct phy_device *phydev) + { + int ret; +@@ -1400,6 +1467,8 @@ static struct phy_driver realtek_drvs[] + .read_status = rtlgen_read_status, + .config_intr = &rtl8211f_config_intr, + .handle_interrupt = rtl8211f_handle_interrupt, ++ .set_wol = rtl8211f_set_wol, ++ .get_wol = rtl8211f_get_wol, + .suspend = rtl821x_suspend, + .resume = rtl821x_resume, + .read_page = rtl821x_read_page, diff --git a/target/linux/generic/backport-6.6/781-35-v6.16-net-phy-realtek-remove-unsed-RTL821x_PHYSR-macros.patch b/target/linux/generic/backport-6.6/781-35-v6.16-net-phy-realtek-remove-unsed-RTL821x_PHYSR-macros.patch new file mode 100644 index 00000000000000..e054937fdd2d2c --- /dev/null +++ b/target/linux/generic/backport-6.6/781-35-v6.16-net-phy-realtek-remove-unsed-RTL821x_PHYSR-macros.patch @@ -0,0 +1,28 @@ +From f3b265358b911fe9e495619bdfa7797749474f95 Mon Sep 17 00:00:00 2001 +From: Michael Klein +Date: Sun, 4 May 2025 19:29:11 +0200 +Subject: [PATCH] net: phy: realtek: remove unsed RTL821x_PHYSR* macros + +These macros have there since the first revision but were never used, so +let's just remove them. + +Signed-off-by: Michael Klein +Link: https://patch.msgid.link/20250504172916.243185-2-michael@fossekall.de +Signed-off-by: Paolo Abeni +--- + drivers/net/phy/realtek/realtek_main.c | 4 ---- + 1 file changed, 4 deletions(-) + +--- a/drivers/net/phy/realtek/realtek_main.c ++++ b/drivers/net/phy/realtek/realtek_main.c +@@ -18,10 +18,6 @@ + + #include "realtek.h" + +-#define RTL821x_PHYSR 0x11 +-#define RTL821x_PHYSR_DUPLEX BIT(13) +-#define RTL821x_PHYSR_SPEED GENMASK(15, 14) +- + #define RTL821x_INER 0x12 + #define RTL8211B_INER_INIT 0x6400 + #define RTL8211E_INER_LINK_STATUS BIT(10) diff --git a/target/linux/generic/backport-6.6/781-36-v6.16-net-phy-realtek-Clean-up-RTL821x-ExtPage-access.patch b/target/linux/generic/backport-6.6/781-36-v6.16-net-phy-realtek-Clean-up-RTL821x-ExtPage-access.patch new file mode 100644 index 00000000000000..62bbf32f1a7ed2 --- /dev/null +++ b/target/linux/generic/backport-6.6/781-36-v6.16-net-phy-realtek-Clean-up-RTL821x-ExtPage-access.patch @@ -0,0 +1,95 @@ +From 7c6fa3ffd2650347b1d37f028e232e53d617c1af Mon Sep 17 00:00:00 2001 +From: Michael Klein +Date: Sun, 4 May 2025 19:29:12 +0200 +Subject: [PATCH] net: phy: realtek: Clean up RTL821x ExtPage access + +Factor out RTL8211E extension page access code to +rtl821x_modify_ext_page() and clean up rtl8211e_config_init() + +Signed-off-by: Michael Klein +Reviewed-by: Andrew Lunn +Link: https://patch.msgid.link/20250504172916.243185-3-michael@fossekall.de +Signed-off-by: Paolo Abeni +--- + drivers/net/phy/realtek/realtek_main.c | 38 ++++++++++++++++---------- + 1 file changed, 23 insertions(+), 15 deletions(-) + +--- a/drivers/net/phy/realtek/realtek_main.c ++++ b/drivers/net/phy/realtek/realtek_main.c +@@ -26,7 +26,9 @@ + #define RTL821x_INSR 0x13 + + #define RTL821x_EXT_PAGE_SELECT 0x1e ++ + #define RTL821x_PAGE_SELECT 0x1f ++#define RTL821x_SET_EXT_PAGE 0x07 + + #define RTL8211F_PHYCR1 0x18 + #define RTL8211F_PHYCR2 0x19 +@@ -69,9 +71,12 @@ + #define RTL8211F_ALDPS_ENABLE BIT(2) + #define RTL8211F_ALDPS_XTAL_OFF BIT(12) + ++#define RTL8211E_RGMII_EXT_PAGE 0xa4 ++#define RTL8211E_RGMII_DELAY 0x1c + #define RTL8211E_CTRL_DELAY BIT(13) + #define RTL8211E_TX_DELAY BIT(12) + #define RTL8211E_RX_DELAY BIT(11) ++#define RTL8211E_DELAY_MASK GENMASK(13, 11) + + #define RTL8201F_ISR 0x1e + #define RTL8201F_ISR_ANERR BIT(15) +@@ -151,6 +156,21 @@ static int rtl821x_write_page(struct phy + return __phy_write(phydev, RTL821x_PAGE_SELECT, page); + } + ++static int rtl821x_modify_ext_page(struct phy_device *phydev, u16 ext_page, ++ u32 regnum, u16 mask, u16 set) ++{ ++ int oldpage, ret = 0; ++ ++ oldpage = phy_select_page(phydev, RTL821x_SET_EXT_PAGE); ++ if (oldpage >= 0) { ++ ret = __phy_write(phydev, RTL821x_EXT_PAGE_SELECT, ext_page); ++ if (ret == 0) ++ ret = __phy_modify(phydev, regnum, mask, set); ++ } ++ ++ return phy_restore_page(phydev, oldpage, ret); ++} ++ + static int rtl821x_probe(struct phy_device *phydev) + { + struct device *dev = &phydev->mdio.dev; +@@ -670,7 +690,6 @@ static int rtl8211f_led_hw_control_set(s + + static int rtl8211e_config_init(struct phy_device *phydev) + { +- int ret = 0, oldpage; + u16 val; + + /* enable TX/RX delay for rgmii-* modes, and disable them for rgmii. */ +@@ -700,20 +719,9 @@ static int rtl8211e_config_init(struct p + * 12 = RX Delay, 11 = TX Delay + * 10:0 = Test && debug settings reserved by realtek + */ +- oldpage = phy_select_page(phydev, 0x7); +- if (oldpage < 0) +- goto err_restore_page; +- +- ret = __phy_write(phydev, RTL821x_EXT_PAGE_SELECT, 0xa4); +- if (ret) +- goto err_restore_page; +- +- ret = __phy_modify(phydev, 0x1c, RTL8211E_CTRL_DELAY +- | RTL8211E_TX_DELAY | RTL8211E_RX_DELAY, +- val); +- +-err_restore_page: +- return phy_restore_page(phydev, oldpage, ret); ++ return rtl821x_modify_ext_page(phydev, RTL8211E_RGMII_EXT_PAGE, ++ RTL8211E_RGMII_DELAY, ++ RTL8211E_DELAY_MASK, val); + } + + static int rtl8211b_suspend(struct phy_device *phydev) diff --git a/target/linux/generic/backport-6.6/781-37-v6.16-net-phy-realtek-add-RTL8211F-register-defines.patch b/target/linux/generic/backport-6.6/781-37-v6.16-net-phy-realtek-add-RTL8211F-register-defines.patch new file mode 100644 index 00000000000000..9116992832276a --- /dev/null +++ b/target/linux/generic/backport-6.6/781-37-v6.16-net-phy-realtek-add-RTL8211F-register-defines.patch @@ -0,0 +1,139 @@ +From 12d40df259e38851a0d973535e6023b33e2ea4f9 Mon Sep 17 00:00:00 2001 +From: Michael Klein +Date: Sun, 4 May 2025 19:29:13 +0200 +Subject: [PATCH] net: phy: realtek: add RTL8211F register defines + +Add some more defines for RTL8211F page and register numbers. + +Signed-off-by: Michael Klein +Reviewed-by: Andrew Lunn +Link: https://patch.msgid.link/20250504172916.243185-4-michael@fossekall.de +Signed-off-by: Paolo Abeni +--- + drivers/net/phy/realtek/realtek_main.c | 34 ++++++++++++++++++-------- + 1 file changed, 24 insertions(+), 10 deletions(-) + +--- a/drivers/net/phy/realtek/realtek_main.c ++++ b/drivers/net/phy/realtek/realtek_main.c +@@ -30,11 +30,14 @@ + #define RTL821x_PAGE_SELECT 0x1f + #define RTL821x_SET_EXT_PAGE 0x07 + ++/* RTL8211F PHY configuration */ ++#define RTL8211F_PHYCR_PAGE 0xa43 + #define RTL8211F_PHYCR1 0x18 + #define RTL8211F_PHYCR2 0x19 + #define RTL8211F_CLKOUT_EN BIT(0) + #define RTL8211F_PHYCR2_PHY_EEE_ENABLE BIT(5) + ++#define RTL8211F_INSR_PAGE 0xa43 + #define RTL8211F_INSR 0x1d + + /* RTL8211F WOL interrupt configuration */ +@@ -55,6 +58,8 @@ + #define RTL8211F_PHYSICAL_ADDR_WORD1 17 + #define RTL8211F_PHYSICAL_ADDR_WORD2 18 + ++/* RTL8211F LED configuration */ ++#define RTL8211F_LEDCR_PAGE 0xd04 + #define RTL8211F_LEDCR 0x10 + #define RTL8211F_LEDCR_MODE BIT(15) + #define RTL8211F_LEDCR_ACT_TXRX BIT(4) +@@ -64,7 +69,13 @@ + #define RTL8211F_LEDCR_MASK GENMASK(4, 0) + #define RTL8211F_LEDCR_SHIFT 5 + ++/* RTL8211F RGMII configuration */ ++#define RTL8211F_RGMII_PAGE 0xd08 ++ ++#define RTL8211F_TXCR 0x11 + #define RTL8211F_TX_DELAY BIT(8) ++ ++#define RTL8211F_RXCR 0x15 + #define RTL8211F_RX_DELAY BIT(3) + + #define RTL8211F_ALDPS_PLL_OFF BIT(1) +@@ -187,7 +198,7 @@ static int rtl821x_probe(struct phy_devi + return dev_err_probe(dev, PTR_ERR(priv->clk), + "failed to get phy clock\n"); + +- ret = phy_read_paged(phydev, 0xa43, RTL8211F_PHYCR1); ++ ret = phy_read_paged(phydev, RTL8211F_PHYCR_PAGE, RTL8211F_PHYCR1); + if (ret < 0) + return ret; + +@@ -197,7 +208,7 @@ static int rtl821x_probe(struct phy_devi + + priv->has_phycr2 = !(phy_id == RTL_8211FVD_PHYID); + if (priv->has_phycr2) { +- ret = phy_read_paged(phydev, 0xa43, RTL8211F_PHYCR2); ++ ret = phy_read_paged(phydev, RTL8211F_PHYCR_PAGE, RTL8211F_PHYCR2); + if (ret < 0) + return ret; + +@@ -233,7 +244,7 @@ static int rtl8211f_ack_interrupt(struct + { + int err; + +- err = phy_read_paged(phydev, 0xa43, RTL8211F_INSR); ++ err = phy_read_paged(phydev, RTL8211F_INSR_PAGE, RTL8211F_INSR); + + return (err < 0) ? err : 0; + } +@@ -376,7 +387,7 @@ static irqreturn_t rtl8211f_handle_inter + { + int irq_status; + +- irq_status = phy_read_paged(phydev, 0xa43, RTL8211F_INSR); ++ irq_status = phy_read_paged(phydev, RTL8211F_INSR_PAGE, RTL8211F_INSR); + if (irq_status < 0) { + phy_error(phydev); + return IRQ_NONE; +@@ -473,7 +484,7 @@ static int rtl8211f_config_init(struct p + u16 val_txdly, val_rxdly; + int ret; + +- ret = phy_modify_paged_changed(phydev, 0xa43, RTL8211F_PHYCR1, ++ ret = phy_modify_paged_changed(phydev, RTL8211F_PHYCR_PAGE, RTL8211F_PHYCR1, + RTL8211F_ALDPS_PLL_OFF | RTL8211F_ALDPS_ENABLE | RTL8211F_ALDPS_XTAL_OFF, + priv->phycr1); + if (ret < 0) { +@@ -507,7 +518,8 @@ static int rtl8211f_config_init(struct p + return 0; + } + +- ret = phy_modify_paged_changed(phydev, 0xd08, 0x11, RTL8211F_TX_DELAY, ++ ret = phy_modify_paged_changed(phydev, RTL8211F_RGMII_PAGE, ++ RTL8211F_TXCR, RTL8211F_TX_DELAY, + val_txdly); + if (ret < 0) { + dev_err(dev, "Failed to update the TX delay register\n"); +@@ -522,7 +534,8 @@ static int rtl8211f_config_init(struct p + str_enabled_disabled(val_txdly)); + } + +- ret = phy_modify_paged_changed(phydev, 0xd08, 0x15, RTL8211F_RX_DELAY, ++ ret = phy_modify_paged_changed(phydev, RTL8211F_RGMII_PAGE, ++ RTL8211F_RXCR, RTL8211F_RX_DELAY, + val_rxdly); + if (ret < 0) { + dev_err(dev, "Failed to update the RX delay register\n"); +@@ -538,14 +551,15 @@ static int rtl8211f_config_init(struct p + } + + /* Disable PHY-mode EEE so LPI is passed to the MAC */ +- ret = phy_modify_paged(phydev, 0xa43, RTL8211F_PHYCR2, ++ ret = phy_modify_paged(phydev, RTL8211F_PHYCR_PAGE, RTL8211F_PHYCR2, + RTL8211F_PHYCR2_PHY_EEE_ENABLE, 0); + if (ret) + return ret; + + if (priv->has_phycr2) { +- ret = phy_modify_paged(phydev, 0xa43, RTL8211F_PHYCR2, +- RTL8211F_CLKOUT_EN, priv->phycr2); ++ ret = phy_modify_paged(phydev, RTL8211F_PHYCR_PAGE, ++ RTL8211F_PHYCR2, RTL8211F_CLKOUT_EN, ++ priv->phycr2); + if (ret < 0) { + dev_err(dev, "clkout configuration failed: %pe\n", + ERR_PTR(ret)); diff --git a/target/linux/generic/backport-6.6/781-38-v6.16-net-phy-realtek-Group-RTL82-macro-definitions.patch b/target/linux/generic/backport-6.6/781-38-v6.16-net-phy-realtek-Group-RTL82-macro-definitions.patch new file mode 100644 index 00000000000000..0319a2b109a294 --- /dev/null +++ b/target/linux/generic/backport-6.6/781-38-v6.16-net-phy-realtek-Group-RTL82-macro-definitions.patch @@ -0,0 +1,123 @@ +From 8c4d0172657c1f2d86b9c19172150abcd0e35c39 Mon Sep 17 00:00:00 2001 +From: Michael Klein +Date: Sun, 4 May 2025 19:29:14 +0200 +Subject: [PATCH] net: phy: realtek: Group RTL82* macro definitions + +Group macro definitions by PHY in lexicographic order. Within each PHY +block, definitions are order by page number and then register number. + +Signed-off-by: Michael Klein +Reviewed-by: Andrew Lunn +Link: https://patch.msgid.link/20250504172916.243185-5-michael@fossekall.de +Signed-off-by: Paolo Abeni +--- + drivers/net/phy/realtek/realtek_main.c | 72 +++++++++++++------------- + 1 file changed, 37 insertions(+), 35 deletions(-) + +--- a/drivers/net/phy/realtek/realtek_main.c ++++ b/drivers/net/phy/realtek/realtek_main.c +@@ -18,6 +18,16 @@ + + #include "realtek.h" + ++#define RTL8201F_IER 0x13 ++ ++#define RTL8201F_ISR 0x1e ++#define RTL8201F_ISR_ANERR BIT(15) ++#define RTL8201F_ISR_DUPLEX BIT(13) ++#define RTL8201F_ISR_LINK BIT(11) ++#define RTL8201F_ISR_MASK (RTL8201F_ISR_ANERR | \ ++ RTL8201F_ISR_DUPLEX | \ ++ RTL8201F_ISR_LINK) ++ + #define RTL821x_INER 0x12 + #define RTL8211B_INER_INIT 0x6400 + #define RTL8211E_INER_LINK_STATUS BIT(10) +@@ -30,9 +40,21 @@ + #define RTL821x_PAGE_SELECT 0x1f + #define RTL821x_SET_EXT_PAGE 0x07 + ++/* RTL8211E extension page 164/0xa4 */ ++#define RTL8211E_RGMII_EXT_PAGE 0xa4 ++#define RTL8211E_RGMII_DELAY 0x1c ++#define RTL8211E_CTRL_DELAY BIT(13) ++#define RTL8211E_TX_DELAY BIT(12) ++#define RTL8211E_RX_DELAY BIT(11) ++#define RTL8211E_DELAY_MASK GENMASK(13, 11) ++ + /* RTL8211F PHY configuration */ + #define RTL8211F_PHYCR_PAGE 0xa43 + #define RTL8211F_PHYCR1 0x18 ++#define RTL8211F_ALDPS_PLL_OFF BIT(1) ++#define RTL8211F_ALDPS_ENABLE BIT(2) ++#define RTL8211F_ALDPS_XTAL_OFF BIT(12) ++ + #define RTL8211F_PHYCR2 0x19 + #define RTL8211F_CLKOUT_EN BIT(0) + #define RTL8211F_PHYCR2_PHY_EEE_ENABLE BIT(5) +@@ -40,24 +62,6 @@ + #define RTL8211F_INSR_PAGE 0xa43 + #define RTL8211F_INSR 0x1d + +-/* RTL8211F WOL interrupt configuration */ +-#define RTL8211F_INTBCR_PAGE 0xd40 +-#define RTL8211F_INTBCR 0x16 +-#define RTL8211F_INTBCR_INTB_PMEB BIT(5) +- +-/* RTL8211F WOL settings */ +-#define RTL8211F_WOL_SETTINGS_PAGE 0xd8a +-#define RTL8211F_WOL_SETTINGS_EVENTS 16 +-#define RTL8211F_WOL_EVENT_MAGIC BIT(12) +-#define RTL8211F_WOL_SETTINGS_STATUS 17 +-#define RTL8211F_WOL_STATUS_RESET (BIT(15) | 0x1fff) +- +-/* RTL8211F Unique phyiscal and multicast address (WOL) */ +-#define RTL8211F_PHYSICAL_ADDR_PAGE 0xd8c +-#define RTL8211F_PHYSICAL_ADDR_WORD0 16 +-#define RTL8211F_PHYSICAL_ADDR_WORD1 17 +-#define RTL8211F_PHYSICAL_ADDR_WORD2 18 +- + /* RTL8211F LED configuration */ + #define RTL8211F_LEDCR_PAGE 0xd04 + #define RTL8211F_LEDCR 0x10 +@@ -78,25 +82,23 @@ + #define RTL8211F_RXCR 0x15 + #define RTL8211F_RX_DELAY BIT(3) + +-#define RTL8211F_ALDPS_PLL_OFF BIT(1) +-#define RTL8211F_ALDPS_ENABLE BIT(2) +-#define RTL8211F_ALDPS_XTAL_OFF BIT(12) ++/* RTL8211F WOL interrupt configuration */ ++#define RTL8211F_INTBCR_PAGE 0xd40 ++#define RTL8211F_INTBCR 0x16 ++#define RTL8211F_INTBCR_INTB_PMEB BIT(5) + +-#define RTL8211E_RGMII_EXT_PAGE 0xa4 +-#define RTL8211E_RGMII_DELAY 0x1c +-#define RTL8211E_CTRL_DELAY BIT(13) +-#define RTL8211E_TX_DELAY BIT(12) +-#define RTL8211E_RX_DELAY BIT(11) +-#define RTL8211E_DELAY_MASK GENMASK(13, 11) ++/* RTL8211F WOL settings */ ++#define RTL8211F_WOL_SETTINGS_PAGE 0xd8a ++#define RTL8211F_WOL_SETTINGS_EVENTS 16 ++#define RTL8211F_WOL_EVENT_MAGIC BIT(12) ++#define RTL8211F_WOL_SETTINGS_STATUS 17 ++#define RTL8211F_WOL_STATUS_RESET (BIT(15) | 0x1fff) + +-#define RTL8201F_ISR 0x1e +-#define RTL8201F_ISR_ANERR BIT(15) +-#define RTL8201F_ISR_DUPLEX BIT(13) +-#define RTL8201F_ISR_LINK BIT(11) +-#define RTL8201F_ISR_MASK (RTL8201F_ISR_ANERR | \ +- RTL8201F_ISR_DUPLEX | \ +- RTL8201F_ISR_LINK) +-#define RTL8201F_IER 0x13 ++/* RTL8211F Unique phyiscal and multicast address (WOL) */ ++#define RTL8211F_PHYSICAL_ADDR_PAGE 0xd8c ++#define RTL8211F_PHYSICAL_ADDR_WORD0 16 ++#define RTL8211F_PHYSICAL_ADDR_WORD1 17 ++#define RTL8211F_PHYSICAL_ADDR_WORD2 18 + + #define RTL822X_VND1_SERDES_OPTION 0x697a + #define RTL822X_VND1_SERDES_OPTION_MODE_MASK GENMASK(5, 0) diff --git a/target/linux/generic/backport-6.6/781-39-v6.16-net-phy-realtek-use-__set_bit-in-rtl8211f_led_hw_con.patch b/target/linux/generic/backport-6.6/781-39-v6.16-net-phy-realtek-use-__set_bit-in-rtl8211f_led_hw_con.patch new file mode 100644 index 00000000000000..a9e3f9037d1f11 --- /dev/null +++ b/target/linux/generic/backport-6.6/781-39-v6.16-net-phy-realtek-use-__set_bit-in-rtl8211f_led_hw_con.patch @@ -0,0 +1,42 @@ +From be1cc96ddf82bb0c0a159751f73239d6d3e9594a Mon Sep 17 00:00:00 2001 +From: Michael Klein +Date: Sun, 4 May 2025 19:29:15 +0200 +Subject: [PATCH] net: phy: realtek: use __set_bit() in + rtl8211f_led_hw_control_get() + +rtl8211f_led_hw_control_get() does not need atomic bit operations, +replace set_bit() by __set_bit(). + +Signed-off-by: Michael Klein +Reviewed-by: Andrew Lunn +Link: https://patch.msgid.link/20250504172916.243185-6-michael@fossekall.de +Signed-off-by: Paolo Abeni +--- + drivers/net/phy/realtek/realtek_main.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +--- a/drivers/net/phy/realtek/realtek_main.c ++++ b/drivers/net/phy/realtek/realtek_main.c +@@ -659,17 +659,17 @@ static int rtl8211f_led_hw_control_get(s + val &= RTL8211F_LEDCR_MASK; + + if (val & RTL8211F_LEDCR_LINK_10) +- set_bit(TRIGGER_NETDEV_LINK_10, rules); ++ __set_bit(TRIGGER_NETDEV_LINK_10, rules); + + if (val & RTL8211F_LEDCR_LINK_100) +- set_bit(TRIGGER_NETDEV_LINK_100, rules); ++ __set_bit(TRIGGER_NETDEV_LINK_100, rules); + + if (val & RTL8211F_LEDCR_LINK_1000) +- set_bit(TRIGGER_NETDEV_LINK_1000, rules); ++ __set_bit(TRIGGER_NETDEV_LINK_1000, rules); + + if (val & RTL8211F_LEDCR_ACT_TXRX) { +- set_bit(TRIGGER_NETDEV_RX, rules); +- set_bit(TRIGGER_NETDEV_TX, rules); ++ __set_bit(TRIGGER_NETDEV_RX, rules); ++ __set_bit(TRIGGER_NETDEV_TX, rules); + } + + return 0; diff --git a/target/linux/generic/backport-6.6/781-40-v6.16-net-phy-realtek-Add-support-for-PHY-LEDs-on-RTL8211E.patch b/target/linux/generic/backport-6.6/781-40-v6.16-net-phy-realtek-Add-support-for-PHY-LEDs-on-RTL8211E.patch new file mode 100644 index 00000000000000..a4b6450e92d231 --- /dev/null +++ b/target/linux/generic/backport-6.6/781-40-v6.16-net-phy-realtek-Add-support-for-PHY-LEDs-on-RTL8211E.patch @@ -0,0 +1,215 @@ +From 708686132ba02659267c0cebcc414348ece389a5 Mon Sep 17 00:00:00 2001 +From: Michael Klein +Date: Sun, 4 May 2025 19:29:16 +0200 +Subject: [PATCH] net: phy: realtek: Add support for PHY LEDs on RTL8211E + +Like the RTL8211F, the RTL8211E PHY supports up to three LEDs. +Add netdev trigger support for them, too. + +Signed-off-by: Michael Klein +Reviewed-by: Andrew Lunn +Link: https://patch.msgid.link/20250504172916.243185-7-michael@fossekall.de +Signed-off-by: Paolo Abeni +--- + drivers/net/phy/realtek/realtek_main.c | 125 +++++++++++++++++++++++-- + 1 file changed, 119 insertions(+), 6 deletions(-) + +--- a/drivers/net/phy/realtek/realtek_main.c ++++ b/drivers/net/phy/realtek/realtek_main.c +@@ -40,6 +40,20 @@ + #define RTL821x_PAGE_SELECT 0x1f + #define RTL821x_SET_EXT_PAGE 0x07 + ++/* RTL8211E extension page 44/0x2c */ ++#define RTL8211E_LEDCR_EXT_PAGE 0x2c ++#define RTL8211E_LEDCR1 0x1a ++#define RTL8211E_LEDCR1_ACT_TXRX BIT(4) ++#define RTL8211E_LEDCR1_MASK BIT(4) ++#define RTL8211E_LEDCR1_SHIFT 1 ++ ++#define RTL8211E_LEDCR2 0x1c ++#define RTL8211E_LEDCR2_LINK_1000 BIT(2) ++#define RTL8211E_LEDCR2_LINK_100 BIT(1) ++#define RTL8211E_LEDCR2_LINK_10 BIT(0) ++#define RTL8211E_LEDCR2_MASK GENMASK(2, 0) ++#define RTL8211E_LEDCR2_SHIFT 4 ++ + /* RTL8211E extension page 164/0xa4 */ + #define RTL8211E_RGMII_EXT_PAGE 0xa4 + #define RTL8211E_RGMII_DELAY 0x1c +@@ -145,7 +159,8 @@ + #define RTL_8221B_VN_CG 0x001cc84a + #define RTL_8251B 0x001cc862 + +-#define RTL8211F_LED_COUNT 3 ++/* RTL8211E and RTL8211F support up to three LEDs */ ++#define RTL8211x_LED_COUNT 3 + + MODULE_DESCRIPTION("Realtek PHY driver"); + MODULE_AUTHOR("Johnson Leung"); +@@ -169,6 +184,21 @@ static int rtl821x_write_page(struct phy + return __phy_write(phydev, RTL821x_PAGE_SELECT, page); + } + ++static int rtl821x_read_ext_page(struct phy_device *phydev, u16 ext_page, ++ u32 regnum) ++{ ++ int oldpage, ret = 0; ++ ++ oldpage = phy_select_page(phydev, RTL821x_SET_EXT_PAGE); ++ if (oldpage >= 0) { ++ ret = __phy_write(phydev, RTL821x_EXT_PAGE_SELECT, ext_page); ++ if (ret == 0) ++ ret = __phy_read(phydev, regnum); ++ } ++ ++ return phy_restore_page(phydev, oldpage, ret); ++} ++ + static int rtl821x_modify_ext_page(struct phy_device *phydev, u16 ext_page, + u32 regnum, u16 mask, u16 set) + { +@@ -608,7 +638,7 @@ static int rtl821x_resume(struct phy_dev + return 0; + } + +-static int rtl8211f_led_hw_is_supported(struct phy_device *phydev, u8 index, ++static int rtl8211x_led_hw_is_supported(struct phy_device *phydev, u8 index, + unsigned long rules) + { + const unsigned long mask = BIT(TRIGGER_NETDEV_LINK_10) | +@@ -627,9 +657,11 @@ static int rtl8211f_led_hw_is_supported( + * rates and Active indication always at all three 10+100+1000 + * link rates. + * This code currently uses mode B only. ++ * ++ * RTL8211E PHY LED has one mode, which works like RTL8211F mode B. + */ + +- if (index >= RTL8211F_LED_COUNT) ++ if (index >= RTL8211x_LED_COUNT) + return -EINVAL; + + /* Filter out any other unsupported triggers. */ +@@ -648,7 +680,7 @@ static int rtl8211f_led_hw_control_get(s + { + int val; + +- if (index >= RTL8211F_LED_COUNT) ++ if (index >= RTL8211x_LED_COUNT) + return -EINVAL; + + val = phy_read_paged(phydev, 0xd04, RTL8211F_LEDCR); +@@ -681,7 +713,7 @@ static int rtl8211f_led_hw_control_set(s + const u16 mask = RTL8211F_LEDCR_MASK << (RTL8211F_LEDCR_SHIFT * index); + u16 reg = 0; + +- if (index >= RTL8211F_LED_COUNT) ++ if (index >= RTL8211x_LED_COUNT) + return -EINVAL; + + if (test_bit(TRIGGER_NETDEV_LINK_10, &rules)) +@@ -704,6 +736,84 @@ static int rtl8211f_led_hw_control_set(s + return phy_modify_paged(phydev, 0xd04, RTL8211F_LEDCR, mask, reg); + } + ++static int rtl8211e_led_hw_control_get(struct phy_device *phydev, u8 index, ++ unsigned long *rules) ++{ ++ int ret; ++ u16 cr1, cr2; ++ ++ if (index >= RTL8211x_LED_COUNT) ++ return -EINVAL; ++ ++ ret = rtl821x_read_ext_page(phydev, RTL8211E_LEDCR_EXT_PAGE, ++ RTL8211E_LEDCR1); ++ if (ret < 0) ++ return ret; ++ ++ cr1 = ret >> RTL8211E_LEDCR1_SHIFT * index; ++ if (cr1 & RTL8211E_LEDCR1_ACT_TXRX) { ++ __set_bit(TRIGGER_NETDEV_RX, rules); ++ __set_bit(TRIGGER_NETDEV_TX, rules); ++ } ++ ++ ret = rtl821x_read_ext_page(phydev, RTL8211E_LEDCR_EXT_PAGE, ++ RTL8211E_LEDCR2); ++ if (ret < 0) ++ return ret; ++ ++ cr2 = ret >> RTL8211E_LEDCR2_SHIFT * index; ++ if (cr2 & RTL8211E_LEDCR2_LINK_10) ++ __set_bit(TRIGGER_NETDEV_LINK_10, rules); ++ ++ if (cr2 & RTL8211E_LEDCR2_LINK_100) ++ __set_bit(TRIGGER_NETDEV_LINK_100, rules); ++ ++ if (cr2 & RTL8211E_LEDCR2_LINK_1000) ++ __set_bit(TRIGGER_NETDEV_LINK_1000, rules); ++ ++ return ret; ++} ++ ++static int rtl8211e_led_hw_control_set(struct phy_device *phydev, u8 index, ++ unsigned long rules) ++{ ++ const u16 cr1mask = ++ RTL8211E_LEDCR1_MASK << (RTL8211E_LEDCR1_SHIFT * index); ++ const u16 cr2mask = ++ RTL8211E_LEDCR2_MASK << (RTL8211E_LEDCR2_SHIFT * index); ++ u16 cr1 = 0, cr2 = 0; ++ int ret; ++ ++ if (index >= RTL8211x_LED_COUNT) ++ return -EINVAL; ++ ++ if (test_bit(TRIGGER_NETDEV_RX, &rules) || ++ test_bit(TRIGGER_NETDEV_TX, &rules)) { ++ cr1 |= RTL8211E_LEDCR1_ACT_TXRX; ++ } ++ ++ cr1 <<= RTL8211E_LEDCR1_SHIFT * index; ++ ret = rtl821x_modify_ext_page(phydev, RTL8211E_LEDCR_EXT_PAGE, ++ RTL8211E_LEDCR1, cr1mask, cr1); ++ if (ret < 0) ++ return ret; ++ ++ if (test_bit(TRIGGER_NETDEV_LINK_10, &rules)) ++ cr2 |= RTL8211E_LEDCR2_LINK_10; ++ ++ if (test_bit(TRIGGER_NETDEV_LINK_100, &rules)) ++ cr2 |= RTL8211E_LEDCR2_LINK_100; ++ ++ if (test_bit(TRIGGER_NETDEV_LINK_1000, &rules)) ++ cr2 |= RTL8211E_LEDCR2_LINK_1000; ++ ++ cr2 <<= RTL8211E_LEDCR2_SHIFT * index; ++ ret = rtl821x_modify_ext_page(phydev, RTL8211E_LEDCR_EXT_PAGE, ++ RTL8211E_LEDCR2, cr2mask, cr2); ++ ++ return ret; ++} ++ + static int rtl8211e_config_init(struct phy_device *phydev) + { + u16 val; +@@ -1479,6 +1589,9 @@ static struct phy_driver realtek_drvs[] + .resume = genphy_resume, + .read_page = rtl821x_read_page, + .write_page = rtl821x_write_page, ++ .led_hw_is_supported = rtl8211x_led_hw_is_supported, ++ .led_hw_control_get = rtl8211e_led_hw_control_get, ++ .led_hw_control_set = rtl8211e_led_hw_control_set, + }, { + PHY_ID_MATCH_EXACT(0x001cc916), + .name = "RTL8211F Gigabit Ethernet", +@@ -1494,7 +1607,7 @@ static struct phy_driver realtek_drvs[] + .read_page = rtl821x_read_page, + .write_page = rtl821x_write_page, + .flags = PHY_ALWAYS_CALL_SUSPEND, +- .led_hw_is_supported = rtl8211f_led_hw_is_supported, ++ .led_hw_is_supported = rtl8211x_led_hw_is_supported, + .led_hw_control_get = rtl8211f_led_hw_control_get, + .led_hw_control_set = rtl8211f_led_hw_control_set, + }, { diff --git a/target/linux/generic/backport-6.6/781-41-v6.16-net-phy-realtek-add-RTL8127-internal-PHY.patch b/target/linux/generic/backport-6.6/781-41-v6.16-net-phy-realtek-add-RTL8127-internal-PHY.patch new file mode 100644 index 00000000000000..04c631dfe58e1f --- /dev/null +++ b/target/linux/generic/backport-6.6/781-41-v6.16-net-phy-realtek-add-RTL8127-internal-PHY.patch @@ -0,0 +1,35 @@ +From 83d9623161283f5f6883ee3fdb88ef2177b8a5f1 Mon Sep 17 00:00:00 2001 +From: ChunHao Lin +Date: Fri, 16 May 2025 13:56:22 +0800 +Subject: [PATCH] net: phy: realtek: add RTL8127-internal PHY + +RTL8127-internal PHY is RTL8261C which is a integrated 10Gbps PHY with ID +0x001cc890. It follows the code path of RTL8125/RTL8126 internal NBase-T +PHY. + +Signed-off-by: ChunHao Lin +Reviewed-by: Andrew Lunn +Link: https://patch.msgid.link/20250516055622.3772-1-hau@realtek.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/phy/realtek/realtek_main.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/net/phy/realtek/realtek_main.c ++++ b/drivers/net/phy/realtek/realtek_main.c +@@ -158,6 +158,7 @@ + #define RTL_8221B_VB_CG 0x001cc849 + #define RTL_8221B_VN_CG 0x001cc84a + #define RTL_8251B 0x001cc862 ++#define RTL_8261C 0x001cc890 + + /* RTL8211E and RTL8211F support up to three LEDs */ + #define RTL8211x_LED_COUNT 3 +@@ -1370,6 +1371,7 @@ static int rtl_internal_nbaset_match_phy + case RTL_GENERIC_PHYID: + case RTL_8221B: + case RTL_8251B: ++ case RTL_8261C: + case 0x001cc841: + break; + default: diff --git a/target/linux/generic/pending-6.6/720-01-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch b/target/linux/generic/pending-6.6/720-01-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch index 6a68ae428ca9c9..1becba6da6f73a 100644 --- a/target/linux/generic/pending-6.6/720-01-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch +++ b/target/linux/generic/pending-6.6/720-01-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch @@ -15,7 +15,7 @@ Signed-off-by: Daniel Golle --- a/drivers/net/phy/realtek/realtek_main.c +++ b/drivers/net/phy/realtek/realtek_main.c -@@ -1434,6 +1434,7 @@ static struct phy_driver realtek_drvs[] +@@ -1638,6 +1638,7 @@ static struct phy_driver realtek_drvs[] }, { .name = "RTL8226 2.5Gbps PHY", .match_phy_device = rtl8226_match_phy_device, @@ -23,7 +23,7 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, -@@ -1444,6 +1445,7 @@ static struct phy_driver realtek_drvs[] +@@ -1648,6 +1649,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_match_phy_device, .name = "RTL8226B_RTL8221B 2.5Gbps PHY", @@ -31,7 +31,7 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .config_init = rtl822xb_config_init, -@@ -1456,6 +1458,7 @@ static struct phy_driver realtek_drvs[] +@@ -1660,6 +1662,7 @@ static struct phy_driver realtek_drvs[] }, { PHY_ID_MATCH_EXACT(0x001cc838), .name = "RTL8226-CG 2.5Gbps PHY", @@ -39,7 +39,7 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, -@@ -1466,6 +1469,7 @@ static struct phy_driver realtek_drvs[] +@@ -1670,6 +1673,7 @@ static struct phy_driver realtek_drvs[] }, { PHY_ID_MATCH_EXACT(0x001cc848), .name = "RTL8226B-CG_RTL8221B-CG 2.5Gbps PHY", @@ -47,7 +47,7 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .config_init = rtl822xb_config_init, -@@ -1478,6 +1482,7 @@ static struct phy_driver realtek_drvs[] +@@ -1682,6 +1686,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c22_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C22)", @@ -55,7 +55,7 @@ Signed-off-by: Daniel Golle .probe = rtl822x_probe, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, -@@ -1491,6 +1496,7 @@ static struct phy_driver realtek_drvs[] +@@ -1695,6 +1700,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c45_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C45)", @@ -63,7 +63,7 @@ Signed-off-by: Daniel Golle .probe = rtl822x_probe, .config_init = rtl822xb_config_init, .get_rate_matching = rtl822xb_get_rate_matching, -@@ -1502,6 +1508,7 @@ static struct phy_driver realtek_drvs[] +@@ -1706,6 +1712,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c22_match_phy_device, .name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)", @@ -71,7 +71,7 @@ Signed-off-by: Daniel Golle .probe = rtl822x_probe, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, -@@ -1515,6 +1522,7 @@ static struct phy_driver realtek_drvs[] +@@ -1719,6 +1726,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c45_match_phy_device, .name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)", diff --git a/target/linux/generic/pending-6.6/720-02-net-phy-realtek-disable-SGMII-in-band-AN-for-2-5G-PHYs.patch b/target/linux/generic/pending-6.6/720-02-net-phy-realtek-disable-SGMII-in-band-AN-for-2-5G-PHYs.patch index 6ecd7235b4238d..e11a7984d4541a 100644 --- a/target/linux/generic/pending-6.6/720-02-net-phy-realtek-disable-SGMII-in-band-AN-for-2-5G-PHYs.patch +++ b/target/linux/generic/pending-6.6/720-02-net-phy-realtek-disable-SGMII-in-band-AN-for-2-5G-PHYs.patch @@ -20,7 +20,7 @@ Signed-off-by: Daniel Golle --- a/drivers/net/phy/realtek/realtek_main.c +++ b/drivers/net/phy/realtek/realtek_main.c -@@ -837,8 +837,8 @@ static int rtl822x_probe(struct phy_devi +@@ -1035,8 +1035,8 @@ static int rtl822x_probe(struct phy_devi static int rtl822xb_config_init(struct phy_device *phydev) { bool has_2500, has_sgmii; @@ -30,7 +30,7 @@ Signed-off-by: Daniel Golle has_2500 = test_bit(PHY_INTERFACE_MODE_2500BASEX, phydev->host_interfaces) || -@@ -888,7 +888,29 @@ static int rtl822xb_config_init(struct p +@@ -1086,7 +1086,29 @@ static int rtl822xb_config_init(struct p if (ret < 0) return ret; diff --git a/target/linux/generic/pending-6.6/720-03-net-phy-realtek-make-sure-paged-read-is-protected-by.patch b/target/linux/generic/pending-6.6/720-03-net-phy-realtek-make-sure-paged-read-is-protected-by.patch index 86ba13370aef4b..e6656445dbb9a1 100644 --- a/target/linux/generic/pending-6.6/720-03-net-phy-realtek-make-sure-paged-read-is-protected-by.patch +++ b/target/linux/generic/pending-6.6/720-03-net-phy-realtek-make-sure-paged-read-is-protected-by.patch @@ -18,7 +18,7 @@ Signed-off-by: Daniel Golle --- a/drivers/net/phy/realtek/realtek_main.c +++ b/drivers/net/phy/realtek/realtek_main.c -@@ -1115,9 +1115,11 @@ static bool rtlgen_supports_2_5gbps(stru +@@ -1313,9 +1313,11 @@ static bool rtlgen_supports_2_5gbps(stru { int val; diff --git a/target/linux/generic/pending-6.6/720-04-net-phy-realtek-setup-aldps.patch b/target/linux/generic/pending-6.6/720-04-net-phy-realtek-setup-aldps.patch index fb9944e8e5685a..b36e54717d10b7 100644 --- a/target/linux/generic/pending-6.6/720-04-net-phy-realtek-setup-aldps.patch +++ b/target/linux/generic/pending-6.6/720-04-net-phy-realtek-setup-aldps.patch @@ -13,7 +13,7 @@ Signed-off-by: Daniel Golle --- a/drivers/net/phy/realtek/realtek_main.c +++ b/drivers/net/phy/realtek/realtek_main.c -@@ -82,6 +82,10 @@ +@@ -129,6 +129,10 @@ */ #define RTL822X_VND2_C22_REG(reg) (0xa400 + 2 * (reg)) @@ -24,7 +24,7 @@ Signed-off-by: Daniel Golle #define RTL8366RB_POWER_SAVE 0x15 #define RTL8366RB_POWER_SAVE_ON BIT(12) -@@ -892,6 +896,15 @@ static int rtl822xb_config_init(struct p +@@ -1090,6 +1094,15 @@ static int rtl822xb_config_init(struct p if (ret < 0) return ret; diff --git a/target/linux/generic/pending-6.6/720-05-net-phy-realtek-detect-early-version-of-RTL8221B.patch b/target/linux/generic/pending-6.6/720-05-net-phy-realtek-detect-early-version-of-RTL8221B.patch index ca08dcafdf12a1..0918794d87e265 100644 --- a/target/linux/generic/pending-6.6/720-05-net-phy-realtek-detect-early-version-of-RTL8221B.patch +++ b/target/linux/generic/pending-6.6/720-05-net-phy-realtek-detect-early-version-of-RTL8221B.patch @@ -14,7 +14,7 @@ Signed-off-by: Daniel Golle Signed-off-by: Mieczyslaw Nalewaj --- a/drivers/net/phy/realtek/realtek_main.c +++ b/drivers/net/phy/realtek/realtek_main.c -@@ -1170,10 +1170,32 @@ static int rtl8226_match_phy_device(stru +@@ -1368,10 +1368,32 @@ static int rtl8226_match_phy_device(stru static int rtlgen_is_c45_match(struct phy_device *phydev, unsigned int id, bool is_c45) { diff --git a/target/linux/generic/pending-6.6/720-06-net-phy-realtek-support-interrupt-of-RTL8221B.patch b/target/linux/generic/pending-6.6/720-06-net-phy-realtek-support-interrupt-of-RTL8221B.patch index 24109d8d546fe9..9afe8baca6614a 100644 --- a/target/linux/generic/pending-6.6/720-06-net-phy-realtek-support-interrupt-of-RTL8221B.patch +++ b/target/linux/generic/pending-6.6/720-06-net-phy-realtek-support-interrupt-of-RTL8221B.patch @@ -12,7 +12,7 @@ Signed-off-by: Jianhui Zhao --- a/drivers/net/phy/realtek/realtek_main.c +++ b/drivers/net/phy/realtek/realtek_main.c -@@ -1381,6 +1381,51 @@ static irqreturn_t rtl9000a_handle_inter +@@ -1580,6 +1580,51 @@ static irqreturn_t rtl9000a_handle_inter return IRQ_HANDLED; } @@ -64,7 +64,7 @@ Signed-off-by: Jianhui Zhao static struct phy_driver realtek_drvs[] = { { PHY_ID_MATCH_EXACT(0x00008201), -@@ -1541,6 +1586,8 @@ static struct phy_driver realtek_drvs[] +@@ -1745,6 +1790,8 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c22_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C22)", @@ -73,7 +73,7 @@ Signed-off-by: Jianhui Zhao .soft_reset = genphy_soft_reset, .probe = rtl822x_probe, .get_features = rtl822x_get_features, -@@ -1555,6 +1602,8 @@ static struct phy_driver realtek_drvs[] +@@ -1759,6 +1806,8 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c45_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C45)", @@ -82,7 +82,7 @@ Signed-off-by: Jianhui Zhao .soft_reset = genphy_soft_reset, .probe = rtl822x_probe, .config_init = rtl822xb_config_init, -@@ -1567,6 +1616,8 @@ static struct phy_driver realtek_drvs[] +@@ -1771,6 +1820,8 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c22_match_phy_device, .name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)", @@ -91,7 +91,7 @@ Signed-off-by: Jianhui Zhao .soft_reset = genphy_soft_reset, .probe = rtl822x_probe, .get_features = rtl822x_get_features, -@@ -1581,6 +1632,8 @@ static struct phy_driver realtek_drvs[] +@@ -1785,6 +1836,8 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c45_match_phy_device, .name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)", diff --git a/target/linux/generic/pending-6.6/720-07-net-phy-realtek-mark-existing-MMDs-as-present.patch b/target/linux/generic/pending-6.6/720-07-net-phy-realtek-mark-existing-MMDs-as-present.patch index 9c93a26b409b56..20bd666fd2e1d8 100644 --- a/target/linux/generic/pending-6.6/720-07-net-phy-realtek-mark-existing-MMDs-as-present.patch +++ b/target/linux/generic/pending-6.6/720-07-net-phy-realtek-mark-existing-MMDs-as-present.patch @@ -15,7 +15,7 @@ Signed-off-by: Daniel Golle --- a/drivers/net/phy/realtek/realtek_main.c +++ b/drivers/net/phy/realtek/realtek_main.c -@@ -1046,6 +1046,9 @@ static int rtl822x_c45_get_features(stru +@@ -1244,6 +1244,9 @@ static int rtl822x_c45_get_features(stru linkmode_set_bit(ETHTOOL_LINK_MODE_TP_BIT, phydev->supported); diff --git a/target/linux/generic/pending-6.6/720-08-net-phy-realtek-work-around-broken-serdes.patch b/target/linux/generic/pending-6.6/720-08-net-phy-realtek-work-around-broken-serdes.patch index 48a9ba08dabc87..1749a74e361443 100644 --- a/target/linux/generic/pending-6.6/720-08-net-phy-realtek-work-around-broken-serdes.patch +++ b/target/linux/generic/pending-6.6/720-08-net-phy-realtek-work-around-broken-serdes.patch @@ -15,7 +15,7 @@ Signed-off-by: Daniel Golle --- --- a/drivers/net/phy/realtek/realtek_main.c +++ b/drivers/net/phy/realtek/realtek_main.c -@@ -926,6 +926,22 @@ static int rtl822xb_config_init(struct p +@@ -1124,6 +1124,22 @@ static int rtl822xb_config_init(struct p return 0; } @@ -38,7 +38,7 @@ Signed-off-by: Daniel Golle static int rtl822xb_get_rate_matching(struct phy_device *phydev, phy_interface_t iface) { -@@ -1609,7 +1625,7 @@ static struct phy_driver realtek_drvs[] +@@ -1813,7 +1829,7 @@ static struct phy_driver realtek_drvs[] .handle_interrupt = rtl8221b_handle_interrupt, .soft_reset = genphy_soft_reset, .probe = rtl822x_probe, @@ -47,7 +47,7 @@ Signed-off-by: Daniel Golle .get_rate_matching = rtl822xb_get_rate_matching, .get_features = rtl822x_c45_get_features, .config_aneg = rtl822x_c45_config_aneg, -@@ -1639,7 +1655,7 @@ static struct phy_driver realtek_drvs[] +@@ -1843,7 +1859,7 @@ static struct phy_driver realtek_drvs[] .handle_interrupt = rtl8221b_handle_interrupt, .soft_reset = genphy_soft_reset, .probe = rtl822x_probe, diff --git a/target/linux/generic/pending-6.6/720-09-net-phy-realtek-disable-MDIO-broadcast.patch b/target/linux/generic/pending-6.6/720-09-net-phy-realtek-disable-MDIO-broadcast.patch index d783b292e80752..bb207500335f12 100644 --- a/target/linux/generic/pending-6.6/720-09-net-phy-realtek-disable-MDIO-broadcast.patch +++ b/target/linux/generic/pending-6.6/720-09-net-phy-realtek-disable-MDIO-broadcast.patch @@ -13,7 +13,7 @@ Signed-off-by: Daniel Golle --- --- a/drivers/net/phy/realtek/realtek_main.c +++ b/drivers/net/phy/realtek/realtek_main.c -@@ -852,6 +852,11 @@ static int rtl822xb_config_init(struct p +@@ -1050,6 +1050,11 @@ static int rtl822xb_config_init(struct p phydev->host_interfaces) || phydev->interface == PHY_INTERFACE_MODE_SGMII; From 01da18774984bcb6115230a9633891ff3c439f62 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Tue, 20 May 2025 14:52:18 -0700 Subject: [PATCH 678/877] tools: add cmake dependency to bzip2 It's using cmake.mk so it needs CMake to build. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/18880 Signed-off-by: Robert Marko (cherry picked from commit 9deb8fad2fbe6fcdc7fbe5d2eb6d8fd78992f485) --- tools/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/Makefile b/tools/Makefile index b16c5d9c5b1e6c..563b9018922e6e 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -93,6 +93,7 @@ $(curdir)/automake/compile := $(curdir)/autoconf/compile $(curdir)/pkgconf/compi $(curdir)/b43-tools/compile := $(curdir)/bison/compile $(curdir)/bc/compile := $(curdir)/bison/compile $(curdir)/libtool/compile $(curdir)/bison/compile := $(curdir)/flex/compile +$(curdir)/bzip2/compile := $(curdir)/cmake/compile $(curdir)/cbootimage/compile += $(curdir)/automake/compile $(curdir)/cmake/compile += $(curdir)/libressl/compile $(curdir)/ninja/compile $(curdir)/expat/compile $(curdir)/xz/compile $(curdir)/zlib/compile $(curdir)/zstd/compile $(curdir)/dosfstools/compile := $(curdir)/automake/compile From 0ccd68f9baedc3c9515694a4f77872ff54b53d9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Fri, 23 May 2025 11:22:37 +0200 Subject: [PATCH 679/877] mac80211: brcm: update RPi brcmfmac patches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Reorganize brcmfmac patches. - Drop outdated RPi brcmfmac patches. - Add RPi 6.12 brcmfmac patches with "rpi-6.12" name tag (excluding SAE). Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit f23ad96e479b1a818943701b00faaf1620d08e4e) --- package/kernel/mac80211/Makefile | 2 +- ...nd-bug-with-some-inconsistent-BSSes.patch} | 0 ...in-driver-tables-with-country-codes.patch} | 0 ...62-brcmfmac-Disable-power-management.patch | 27 - ...e-internal-roaming-engine-by-default.patch | 23 - ...mfmac-adds-support-for-BCM43341-wifi.patch | 29 + ...fer-a-ccode-from-OTP-over-nvram-file.patch | 130 ++++ ...ac-Increase-power-saving-delay-to-2s.patch | 24 + ...upport-DS1-exit-firmware-re-download.patch | 721 ++++++++++++++++++ ...eroperating-DPP-and-other-encryption.patch | 129 ++++ ...c-Include-modinfo-for-43456-CLM-blob.patch | 26 + ...fmac-disable-dump_survey-on-bcm2835.patch} | 6 +- 12 files changed, 1063 insertions(+), 54 deletions(-) rename package/kernel/mac80211/patches/brcm/{861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch => 860-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch} (100%) rename package/kernel/mac80211/patches/brcm/{863-brcmfmac-add-in-driver-tables-with-country-codes.patch => 861-brcmfmac-add-in-driver-tables-with-country-codes.patch} (100%) delete mode 100644 package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch delete mode 100644 package/kernel/mac80211/patches/brcm/864-brcmfmac-do-not-use-internal-roaming-engine-by-default.patch create mode 100644 package/kernel/mac80211/patches/brcm/870-01-rpi-6.12-brcmfmac-adds-support-for-BCM43341-wifi.patch create mode 100644 package/kernel/mac80211/patches/brcm/870-02-rpi-6.12-brcmfmac-Prefer-a-ccode-from-OTP-over-nvram-file.patch create mode 100644 package/kernel/mac80211/patches/brcm/870-03-rpi-6.12-brcmfmac-Increase-power-saving-delay-to-2s.patch create mode 100644 package/kernel/mac80211/patches/brcm/870-04-rpi-6.12-brcmfmac-non-upstream-support-DS1-exit-firmware-re-download.patch create mode 100644 package/kernel/mac80211/patches/brcm/870-05-rpi-6.12-brcmfmac-Fix-interoperating-DPP-and-other-encryption.patch create mode 100644 package/kernel/mac80211/patches/brcm/870-06-rpi-6.12-brcmfmac-Include-modinfo-for-43456-CLM-blob.patch rename package/kernel/mac80211/patches/brcm/{865-brcmfmac-disable-dump_survey-on-bcm2835.patch => 871-brcmfmac-disable-dump_survey-on-bcm2835.patch} (87%) diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index f924d3468476a3..375a2d869b5a72 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.12.6 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_LICENSE:=GPL-2.0-only PKG_LICENSE_FILES:=COPYING diff --git a/package/kernel/mac80211/patches/brcm/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch b/package/kernel/mac80211/patches/brcm/860-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch similarity index 100% rename from package/kernel/mac80211/patches/brcm/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch rename to package/kernel/mac80211/patches/brcm/860-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch diff --git a/package/kernel/mac80211/patches/brcm/863-brcmfmac-add-in-driver-tables-with-country-codes.patch b/package/kernel/mac80211/patches/brcm/861-brcmfmac-add-in-driver-tables-with-country-codes.patch similarity index 100% rename from package/kernel/mac80211/patches/brcm/863-brcmfmac-add-in-driver-tables-with-country-codes.patch rename to package/kernel/mac80211/patches/brcm/861-brcmfmac-add-in-driver-tables-with-country-codes.patch diff --git a/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch b/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch deleted file mode 100644 index 3472ff6afc6be1..00000000000000 --- a/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 66ae1b1750720a33e29792a177b1e696f4f005fb Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Wed, 9 Mar 2016 17:25:59 +0000 -Subject: [PATCH] brcmfmac: Disable power management - -Disable wireless power saving in the brcmfmac WLAN driver. This is a -temporary measure until the connectivity loss resulting from power -saving is resolved. - -Signed-off-by: Phil Elwell ---- - drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -3314,6 +3314,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip - * preference in cfg struct to apply this to - * FW later while initializing the dongle - */ -+#if defined(CONFIG_ARCH_BCM2835) -+ brcmf_dbg(INFO, "power management disabled\n"); -+ enabled = false; -+#endif - cfg->pwr_save = enabled; - if (!check_vif_up(ifp->vif)) { - diff --git a/package/kernel/mac80211/patches/brcm/864-brcmfmac-do-not-use-internal-roaming-engine-by-default.patch b/package/kernel/mac80211/patches/brcm/864-brcmfmac-do-not-use-internal-roaming-engine-by-default.patch deleted file mode 100644 index fe79c40c11cb88..00000000000000 --- a/package/kernel/mac80211/patches/brcm/864-brcmfmac-do-not-use-internal-roaming-engine-by-default.patch +++ /dev/null @@ -1,23 +0,0 @@ -brcmfmac: do not use internal roaming engine by default - -Some evidence of curing disconnects with this disabled, so make it a default. -Can be overridden with module parameter roamoff=0 -See: http://projectable.me/optimize-my-pi-wi-fi/ - -Signed-off-by: Phil Elwell ---- - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -@@ -59,7 +59,11 @@ static int brcmf_fcmode; - module_param_named(fcmode, brcmf_fcmode, int, 0); - MODULE_PARM_DESC(fcmode, "Mode of firmware signalled flow control"); - -+#if defined(CONFIG_ARCH_BCM2835) -+static int brcmf_roamoff = 1; -+#else - static int brcmf_roamoff; -+#endif - module_param_named(roamoff, brcmf_roamoff, int, 0400); - MODULE_PARM_DESC(roamoff, "Do not use internal roaming engine"); - diff --git a/package/kernel/mac80211/patches/brcm/870-01-rpi-6.12-brcmfmac-adds-support-for-BCM43341-wifi.patch b/package/kernel/mac80211/patches/brcm/870-01-rpi-6.12-brcmfmac-adds-support-for-BCM43341-wifi.patch new file mode 100644 index 00000000000000..23526c936552f3 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/870-01-rpi-6.12-brcmfmac-adds-support-for-BCM43341-wifi.patch @@ -0,0 +1,29 @@ +From 88759af56f126e6e151f07fa9efc7447079fca9d Mon Sep 17 00:00:00 2001 +From: Cheong2K +Date: Fri, 26 Feb 2016 18:20:10 +0800 +Subject: [PATCH] brcmfmac: adds support for BCM43341 wifi + +Signed-off-by: Phil Elwell +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 3 ++- + 3 files changed, 4 insertions(+), 3 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -609,6 +609,7 @@ BRCMF_FW_DEF(4329, "brcmfmac4329-sdio"); + BRCMF_FW_DEF(4330, "brcmfmac4330-sdio"); + BRCMF_FW_DEF(4334, "brcmfmac4334-sdio"); + BRCMF_FW_DEF(43340, "brcmfmac43340-sdio"); ++BRCMF_FW_DEF(43341, "brcmfmac43341-sdio"); + BRCMF_FW_DEF(4335, "brcmfmac4335-sdio"); + BRCMF_FW_DEF(43362, "brcmfmac43362-sdio"); + BRCMF_FW_DEF(4339, "brcmfmac4339-sdio"); +@@ -641,7 +642,7 @@ static const struct brcmf_firmware_mappi + BRCMF_FW_ENTRY(BRCM_CC_4330_CHIP_ID, 0xFFFFFFFF, 4330), + BRCMF_FW_ENTRY(BRCM_CC_4334_CHIP_ID, 0xFFFFFFFF, 4334), + BRCMF_FW_ENTRY(BRCM_CC_43340_CHIP_ID, 0xFFFFFFFF, 43340), +- BRCMF_FW_ENTRY(BRCM_CC_43341_CHIP_ID, 0xFFFFFFFF, 43340), ++ BRCMF_FW_ENTRY(BRCM_CC_43341_CHIP_ID, 0xFFFFFFFF, 43341), + BRCMF_FW_ENTRY(BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, 4335), + BRCMF_FW_ENTRY(BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, 43362), + BRCMF_FW_ENTRY(BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, 4339), diff --git a/package/kernel/mac80211/patches/brcm/870-02-rpi-6.12-brcmfmac-Prefer-a-ccode-from-OTP-over-nvram-file.patch b/package/kernel/mac80211/patches/brcm/870-02-rpi-6.12-brcmfmac-Prefer-a-ccode-from-OTP-over-nvram-file.patch new file mode 100644 index 00000000000000..9a7f9eb266409d --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/870-02-rpi-6.12-brcmfmac-Prefer-a-ccode-from-OTP-over-nvram-file.patch @@ -0,0 +1,130 @@ +From 3ac592da09acb47b728ef320e9fecde55c8e0824 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 26 Jun 2020 11:51:05 +0100 +Subject: [PATCH] brcmfmac: Prefer a ccode from OTP over nvram file + +Allow the nvram file to set a default ccode (regulatory domain) without +overriding one set in OTP. + +Signed-off-by: Phil Elwell +--- + .../broadcom/brcm80211/brcmfmac/cfg80211.c | 39 +++++++++++++------ + .../broadcom/brcm80211/brcmfmac/firmware.c | 21 +++++++++- + 2 files changed, 47 insertions(+), 13 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -9,6 +9,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -8212,31 +8213,45 @@ static void brcmf_cfg80211_reg_notifier( + struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0); + struct brcmf_pub *drvr = cfg->pub; + struct brcmf_fil_country_le ccreq; ++ char *alpha2; + s32 err; + int i; + +- /* The country code gets set to "00" by default at boot, ignore */ +- if (req->alpha2[0] == '0' && req->alpha2[1] == '0') ++ err = brcmf_fil_iovar_data_get(ifp, "country", &ccreq, sizeof(ccreq)); ++ if (err) { ++ bphy_err(drvr, "Country code iovar returned err = %d\n", err); + return; ++ } ++ ++ /* The country code gets set to "00" by default at boot - substitute ++ * any saved ccode from the nvram file unless there is a valid code ++ * already set. ++ */ ++ alpha2 = req->alpha2; ++ if (alpha2[0] == '0' && alpha2[1] == '0') { ++ extern char saved_ccode[2]; ++ ++ if ((isupper(ccreq.country_abbrev[0]) && ++ isupper(ccreq.country_abbrev[1])) || ++ !saved_ccode[0]) ++ return; ++ alpha2 = saved_ccode; ++ pr_debug("brcmfmac: substituting saved ccode %c%c\n", ++ alpha2[0], alpha2[1]); ++ } + + /* ignore non-ISO3166 country codes */ + for (i = 0; i < 2; i++) +- if (req->alpha2[i] < 'A' || req->alpha2[i] > 'Z') { ++ if (alpha2[i] < 'A' || alpha2[i] > 'Z') { + bphy_err(drvr, "not an ISO3166 code (0x%02x 0x%02x)\n", +- req->alpha2[0], req->alpha2[1]); ++ alpha2[0], alpha2[1]); + return; + } + + brcmf_dbg(TRACE, "Enter: initiator=%d, alpha=%c%c\n", req->initiator, +- req->alpha2[0], req->alpha2[1]); +- +- err = brcmf_fil_iovar_data_get(ifp, "country", &ccreq, sizeof(ccreq)); +- if (err) { +- bphy_err(drvr, "Country code iovar returned err = %d\n", err); +- return; +- } ++ alpha2[0], alpha2[1]); + +- err = brcmf_translate_country_code(ifp->drvr, req->alpha2, &ccreq); ++ err = brcmf_translate_country_code(ifp->drvr, alpha2, &ccreq); + if (err) + return; + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +@@ -10,6 +10,7 @@ + #include + #include + #include ++#include + + #include "debug.h" + #include "firmware.h" +@@ -32,6 +33,8 @@ enum nvram_parser_state { + END + }; + ++char saved_ccode[2] = {}; ++ + /** + * struct nvram_parser - internal info for parser. + * +@@ -562,11 +565,27 @@ static int brcmf_fw_request_nvram_done(c + goto fail; + } + +- if (data) ++ if (data) { ++ char *ccode = strnstr((char *)data, "ccode=", data_len); ++ /* Ensure this is a whole token */ ++ if (ccode && ((void *)ccode == (void *)data || isspace(ccode[-1]))) { ++ /* Comment out the line */ ++ ccode[0] = '#'; ++ ccode += 6; ++ if (isupper(ccode[0]) && isupper(ccode[1]) && ++ isspace(ccode[2])) { ++ pr_debug("brcmfmac: intercepting ccode=%c%c\n", ++ ccode[0], ccode[1]); ++ saved_ccode[0] = ccode[0]; ++ saved_ccode[1] = ccode[1]; ++ } ++ }; ++ + nvram = brcmf_fw_nvram_strip(data, data_len, &nvram_length, + fwctx->req->domain_nr, + fwctx->req->bus_nr, + fwctx->dev); ++ } + + if (free_bcm47xx_nvram) + bcm47xx_nvram_release_contents(data); diff --git a/package/kernel/mac80211/patches/brcm/870-03-rpi-6.12-brcmfmac-Increase-power-saving-delay-to-2s.patch b/package/kernel/mac80211/patches/brcm/870-03-rpi-6.12-brcmfmac-Increase-power-saving-delay-to-2s.patch new file mode 100644 index 00000000000000..f197e890265998 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/870-03-rpi-6.12-brcmfmac-Increase-power-saving-delay-to-2s.patch @@ -0,0 +1,24 @@ +From 12722e472a963598a88011dd4b6805ed0a0e318f Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 3 Feb 2020 09:32:22 +0000 +Subject: [PATCH] brcmfmac: Increase power saving delay to 2s + +Increase the delay before entering the lower power state to 2 seconds +(the maximum allowed) in order to reduce the packet latencies, +particularly for inbound packets. + +Signed-off-by: Phil Elwell +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -3338,6 +3338,7 @@ brcmf_cfg80211_set_power_mgmt(struct wip + bphy_err(drvr, "error (%d)\n", err); + } + ++ timeout = 2000; /* 2000ms - the maximum */ + err = brcmf_fil_iovar_int_set(ifp, "pm2_sleep_ret", + min_t(u32, timeout, BRCMF_PS_MAX_TIMEOUT_MS)); + if (err) diff --git a/package/kernel/mac80211/patches/brcm/870-04-rpi-6.12-brcmfmac-non-upstream-support-DS1-exit-firmware-re-download.patch b/package/kernel/mac80211/patches/brcm/870-04-rpi-6.12-brcmfmac-non-upstream-support-DS1-exit-firmware-re-download.patch new file mode 100644 index 00000000000000..1e2016bcadec7b --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/870-04-rpi-6.12-brcmfmac-non-upstream-support-DS1-exit-firmware-re-download.patch @@ -0,0 +1,721 @@ +From e7400640cafcf6bd84049308feb5aeabecf55b46 Mon Sep 17 00:00:00 2001 +From: Praveen Babu C +Date: Tue, 9 Jan 2018 11:33:10 +0530 +Subject: [PATCH] non-upstream: support DS1 exit firmware re-download + +In deep sleep mode (DS1) ARM is off and once exit trigger comes than +mailbox Interrupt comes to host and whole reinitiation should be done +in the ARM to start TX/RX. + +Also fix below issus for DS1 exit: +1. Sent Tx Control frame only after firmware redownload complete (check +F2 Ready before sending Tx Control frame to Firmware) +2. intermittent High DS1 TX Exit latency time (almost 3sec) ==> This is +fixed by skipping host Mailbox interrupt Multiple times (ulp state +mechanism) +3. RX GlOM save/restore in Firmware +4. Add ULP event enable & event_msgs_ext iovar configuration in FMAC +5. Add ULP_EVENT_RECV state machine for sbwad support +6. Support 2 Byte Shared memory read for DS1 Exit HUDI implementation + +Signed-off-by: Praveen Babu C +Signed-off-by: Naveen Gupta +[Merge from 4.14.77 to 5.4.18; set BRCMF_SDIO_MAX_ACCESS_ERRORS to 20] +Signed-off-by: Chi-hsien Lin +JIRA: SWWLAN-135583 +JIRA: SWWLAN-136577 +--- + .../broadcom/brcm80211/brcmfmac/bus.h | 2 +- + .../broadcom/brcm80211/brcmfmac/common.c | 39 +++ + .../broadcom/brcm80211/brcmfmac/core.c | 13 +- + .../broadcom/brcm80211/brcmfmac/debug.h | 1 + + .../broadcom/brcm80211/brcmfmac/fweh.h | 31 ++- + .../broadcom/brcm80211/brcmfmac/pcie.c | 2 +- + .../broadcom/brcm80211/brcmfmac/sdio.c | 260 +++++++++++++++++- + .../broadcom/brcm80211/brcmfmac/sdio.h | 110 ++++++++ + .../broadcom/brcm80211/brcmfmac/usb.c | 4 +- + .../broadcom/brcm80211/include/chipcommon.h | 2 + + 10 files changed, 448 insertions(+), 16 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h +@@ -298,7 +298,7 @@ void brcmf_rx_event(struct device *dev, + + int brcmf_alloc(struct device *dev, struct brcmf_mp_device *settings); + /* Indication from bus module regarding presence/insertion of dongle. */ +-int brcmf_attach(struct device *dev); ++int brcmf_attach(struct device *dev, bool start_bus); + /* Indication from bus module regarding removal/absence of dongle */ + void brcmf_detach(struct device *dev); + void brcmf_free(struct device *dev); +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +@@ -20,6 +20,8 @@ + #include "of.h" + #include "firmware.h" + #include "chip.h" ++#include "fweh.h" ++#include + + MODULE_AUTHOR("Broadcom Corporation"); + MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver."); +@@ -274,6 +276,8 @@ int brcmf_c_preinit_dcmds(struct brcmf_i + char *clmver; + char *ptr; + s32 err; ++ struct eventmsgs_ext *eventmask_msg = NULL; ++ u8 msglen; + + if (is_valid_ether_addr(ifp->mac_addr)) { + /* set mac address */ +@@ -433,6 +437,41 @@ int brcmf_c_preinit_dcmds(struct brcmf_i + goto done; + } + ++ /* Enable event_msg_ext specific to 43012 chip */ ++ if (bus->chip == CY_CC_43012_CHIP_ID) { ++ /* Program event_msg_ext to support event larger than 128 */ ++ msglen = (roundup(BRCMF_E_LAST, NBBY) / NBBY) + ++ EVENTMSGS_EXT_STRUCT_SIZE; ++ /* Allocate buffer for eventmask_msg */ ++ eventmask_msg = kzalloc(msglen, GFP_KERNEL); ++ if (!eventmask_msg) { ++ err = -ENOMEM; ++ goto done; ++ } ++ ++ /* Read the current programmed event_msgs_ext */ ++ eventmask_msg->ver = EVENTMSGS_VER; ++ eventmask_msg->len = roundup(BRCMF_E_LAST, NBBY) / NBBY; ++ err = brcmf_fil_iovar_data_get(ifp, "event_msgs_ext", ++ eventmask_msg, ++ msglen); ++ ++ /* Enable ULP event */ ++ brcmf_dbg(EVENT, "enable event ULP\n"); ++ setbit(eventmask_msg->mask, BRCMF_E_ULP); ++ ++ /* Write updated Event mask */ ++ eventmask_msg->ver = EVENTMSGS_VER; ++ eventmask_msg->command = EVENTMSGS_SET_MASK; ++ eventmask_msg->len = (roundup(BRCMF_E_LAST, NBBY) / NBBY); ++ ++ err = brcmf_fil_iovar_data_set(ifp, "event_msgs_ext", ++ eventmask_msg, msglen); ++ if (err) { ++ brcmf_err("Set event_msgs_ext error (%d)\n", err); ++ goto done; ++ } ++ } + /* Setup default scan channel time */ + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_CHANNEL_TIME, + BRCMF_DEFAULT_SCAN_CHANNEL_TIME); +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +@@ -1317,7 +1317,7 @@ int brcmf_alloc(struct device *dev, stru + return 0; + } + +-int brcmf_attach(struct device *dev) ++int brcmf_attach(struct device *dev, bool start_bus) + { + struct brcmf_bus *bus_if = dev_get_drvdata(dev); + struct brcmf_pub *drvr = bus_if->drvr; +@@ -1358,10 +1358,13 @@ int brcmf_attach(struct device *dev) + brcmf_fweh_register(drvr, BRCMF_E_PSM_WATCHDOG, + brcmf_psm_watchdog_notify); + +- ret = brcmf_bus_started(drvr, drvr->ops); +- if (ret != 0) { +- bphy_err(drvr, "dongle is not responding: err=%d\n", ret); +- goto fail; ++ if (start_bus) { ++ ret = brcmf_bus_started(drvr, drvr->ops); ++ if (ret != 0) { ++ bphy_err(drvr, "dongle is not responding: err=%d\n", ++ ret); ++ goto fail; ++ } + } + + return 0; +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h +@@ -29,6 +29,7 @@ + #define BRCMF_MSGBUF_VAL 0x00040000 + #define BRCMF_PCIE_VAL 0x00080000 + #define BRCMF_FWCON_VAL 0x00100000 ++#define BRCMF_ULP_VAL 0x00200000 + + /* set default print format */ + #undef pr_fmt +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h +@@ -94,7 +94,8 @@ struct brcmf_cfg80211_info; + BRCMF_ENUM_DEF(FIFO_CREDIT_MAP, 74) \ + BRCMF_ENUM_DEF(ACTION_FRAME_RX, 75) \ + BRCMF_ENUM_DEF(TDLS_PEER_EVENT, 92) \ +- BRCMF_ENUM_DEF(BCMC_CREDIT_SUPPORT, 127) ++ BRCMF_ENUM_DEF(BCMC_CREDIT_SUPPORT, 127) \ ++ BRCMF_ENUM_DEF(ULP, 146) + + #define BRCMF_ENUM_DEF(id, val) \ + BRCMF_E_##id = (val), +@@ -102,6 +103,12 @@ struct brcmf_cfg80211_info; + /* firmware event codes sent by the dongle */ + enum brcmf_fweh_event_code { + BRCMF_FWEH_EVENT_ENUM_DEFLIST ++ ++ /* this determines event mask length which must match ++ * minimum length check in device firmware so it is ++ * hard-coded here. ++ */ ++ BRCMF_E_LAST + }; + #undef BRCMF_ENUM_DEF + +@@ -280,6 +287,28 @@ struct brcmf_if_event { + u8 role; + }; + ++enum event_msgs_ext_command { ++ EVENTMSGS_NONE = 0, ++ EVENTMSGS_SET_BIT = 1, ++ EVENTMSGS_RESET_BIT = 2, ++ EVENTMSGS_SET_MASK = 3 ++}; ++ ++#define EVENTMSGS_VER 1 ++#define EVENTMSGS_EXT_STRUCT_SIZE offsetof(struct eventmsgs_ext, mask[0]) ++ ++/* len- for SET it would be mask size from the application to the firmware */ ++/* for GET it would be actual firmware mask size */ ++/* maxgetsize - is only used for GET. indicate max mask size that the */ ++/* application can read from the firmware */ ++struct eventmsgs_ext { ++ u8 ver; ++ u8 command; ++ u8 len; ++ u8 maxgetsize; ++ u8 mask[1]; ++}; ++ + typedef int (*brcmf_fweh_handler_t)(struct brcmf_if *ifp, + const struct brcmf_event_msg *evtmsg, + void *data); +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -2207,7 +2207,7 @@ static void brcmf_pcie_setup(struct devi + + init_waitqueue_head(&devinfo->mbdata_resp_wait); + +- ret = brcmf_attach(&devinfo->pdev->dev); ++ ret = brcmf_attach(&devinfo->pdev->dev, true); + if (ret) + goto fail; + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -35,9 +35,12 @@ + #include "core.h" + #include "common.h" + #include "bcdc.h" ++#include "debug.h" ++#include "fwil.h" + + #define DCMD_RESP_TIMEOUT msecs_to_jiffies(2500) + #define CTL_DONE_TIMEOUT msecs_to_jiffies(2500) ++#define ULP_HUDI_PROC_DONE_TIME msecs_to_jiffies(2500) + + /* watermark expressed in number of words */ + #define DEFAULT_F2_WATERMARK 0x8 +@@ -325,7 +328,16 @@ struct rte_console { + + #define KSO_WAIT_US 50 + #define MAX_KSO_ATTEMPTS (PMU_MAX_TRANSITION_DLY/KSO_WAIT_US) +-#define BRCMF_SDIO_MAX_ACCESS_ERRORS 5 ++#define BRCMF_SDIO_MAX_ACCESS_ERRORS 20 ++ ++static void brcmf_sdio_firmware_callback(struct device *dev, int err, ++ struct brcmf_fw_request *fwreq); ++static struct brcmf_fw_request * ++ brcmf_sdio_prepare_fw_request(struct brcmf_sdio *bus); ++static int brcmf_sdio_f2_ready(struct brcmf_sdio *bus); ++static int brcmf_ulp_event_notify(struct brcmf_if *ifp, ++ const struct brcmf_event_msg *evtmsg, ++ void *data); + + #ifdef DEBUG + /* Device console log buffer state */ +@@ -1105,7 +1117,7 @@ static void brcmf_sdio_get_console_addr( + } + #endif /* DEBUG */ + +-static u32 brcmf_sdio_hostmail(struct brcmf_sdio *bus) ++static u32 brcmf_sdio_hostmail(struct brcmf_sdio *bus, u32 *hmbd) + { + struct brcmf_sdio_dev *sdiod = bus->sdiodev; + struct brcmf_core *core = bus->sdio_core; +@@ -1194,6 +1206,9 @@ static u32 brcmf_sdio_hostmail(struct br + HMB_DATA_FCDATA_MASK | HMB_DATA_VERSION_MASK)) + brcmf_err("Unknown mailbox data content: 0x%02x\n", + hmb_data); ++ /* Populate hmb_data if argument is passed for DS1 check later */ ++ if (hmbd) ++ *hmbd = hmb_data; + + return intstatus; + } +@@ -2580,6 +2595,182 @@ static int brcmf_sdio_intr_rstatus(struc + return ret; + } + ++/* This Function is used to retrieve important ++ * details from dongle related to ULP mode Mostly ++ * values/SHM details that will be vary depending ++ * on the firmware branches ++ */ ++static void ++brcmf_sdio_ulp_preinit(struct device *dev) ++{ ++ struct brcmf_bus *bus_if = dev_get_drvdata(dev); ++ struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; ++ struct brcmf_if *ifp = bus_if->drvr->iflist[0]; ++ ++ brcmf_dbg(ULP, "Enter\n"); ++ ++ /* Query ulp_sdioctrl iovar to get the ULP related SHM offsets */ ++ brcmf_fil_iovar_data_get(ifp, "ulp_sdioctrl", ++ &sdiodev->fmac_ulp.ulp_shm_offset, ++ sizeof(sdiodev->fmac_ulp.ulp_shm_offset)); ++ ++ sdiodev->ulp = false; ++ ++ brcmf_dbg(ULP, "m_ulp_ctrl_sdio[%x] m_ulp_wakeevt_ind [%x]\n", ++ M_DS1_CTRL_SDIO(sdiodev->fmac_ulp), ++ M_WAKEEVENT_IND(sdiodev->fmac_ulp)); ++ brcmf_dbg(ULP, "m_ulp_wakeind [%x]\n", ++ M_ULP_WAKE_IND(sdiodev->fmac_ulp)); ++} ++ ++/* Reinitialize ARM because In DS1 mode ARM got off */ ++static int ++brcmf_sdio_ulp_reinit_fw(struct brcmf_sdio *bus) ++{ ++ struct brcmf_sdio_dev *sdiodev = bus->sdiodev; ++ struct brcmf_fw_request *fwreq; ++ int err = 0; ++ ++ /* After firmware redownload tx/rx seq are reset accordingly ++ * these values are reset on FMAC side tx_max is initially set to 4, ++ * which later is updated by FW. ++ */ ++ bus->tx_seq = 0; ++ bus->rx_seq = 0; ++ bus->tx_max = 4; ++ ++ fwreq = brcmf_sdio_prepare_fw_request(bus); ++ if (!fwreq) ++ return -ENOMEM; ++ ++ err = brcmf_fw_get_firmwares(sdiodev->dev, fwreq, ++ brcmf_sdio_firmware_callback); ++ if (err != 0) { ++ brcmf_err("async firmware request failed: %d\n", err); ++ kfree(fwreq); ++ } ++ ++ return err; ++} ++ ++/* Check if device is in DS1 mode and handshake with ULP UCODE */ ++static bool ++brcmf_sdio_ulp_pre_redownload_check(struct brcmf_sdio *bus, u32 hmb_data) ++{ ++ struct brcmf_sdio_dev *sdiod = bus->sdiodev; ++ int err = 0; ++ u32 value = 0; ++ u32 val32, ulp_wake_ind, wowl_wake_ind; ++ int reg_addr; ++ unsigned long timeout; ++ struct brcmf_ulp *fmac_ulp = &bus->sdiodev->fmac_ulp; ++ int i = 0; ++ ++ /* If any host mail box data is present, ignore DS1 exit sequence */ ++ if (hmb_data) ++ return false; ++ /* Skip if DS1 Exit is already in progress ++ * This can happen if firmware download is taking more time ++ */ ++ if (fmac_ulp->ulp_state == FMAC_ULP_TRIGGERED) ++ return false; ++ ++ value = brcmf_sdiod_func0_rb(sdiod, SDIO_CCCR_IOEx, &err); ++ ++ if (value == SDIO_FUNC_ENABLE_1) { ++ brcmf_dbg(ULP, "GOT THE INTERRUPT FROM UCODE\n"); ++ sdiod->ulp = true; ++ fmac_ulp->ulp_state = FMAC_ULP_TRIGGERED; ++ ulp_wake_ind = D11SHM_RDW(sdiod, ++ M_ULP_WAKE_IND(sdiod->fmac_ulp), ++ &err); ++ wowl_wake_ind = D11SHM_RDW(sdiod, ++ M_WAKEEVENT_IND(sdiod->fmac_ulp), ++ &err); ++ ++ brcmf_dbg(ULP, "wowl_wake_ind: 0x%08x, ulp_wake_ind: 0x%08x state %s\n", ++ wowl_wake_ind, ulp_wake_ind, (fmac_ulp->ulp_state) ? ++ "DS1 Exit Triggered" : "IDLE State"); ++ ++ if (wowl_wake_ind || ulp_wake_ind) { ++ /* RX wake Don't do anything. ++ * Just bail out and re-download firmware. ++ */ ++ /* Print out PHY TX error block when bit 9 set */ ++ if ((ulp_wake_ind & C_DS1_PHY_TXERR) && ++ M_DS1_PHYTX_ERR_BLK(sdiod->fmac_ulp)) { ++ brcmf_err("Dump PHY TX Error SHM Locations\n"); ++ for (i = 0; i < PHYTX_ERR_BLK_SIZE; i++) { ++ pr_err("0x%x", ++ D11SHM_RDW(sdiod, ++ (M_DS1_PHYTX_ERR_BLK(sdiod->fmac_ulp) + ++ (i * 2)), &err)); ++ } ++ brcmf_err("\n"); ++ } ++ } else { ++ /* TX wake negotiate with MAC */ ++ brcmf_dbg(ULP, "M_DS1_CTRL_SDIO: 0x%08x\n", ++ (u32)D11SHM_RDW(sdiod, ++ M_DS1_CTRL_SDIO(sdiod->fmac_ulp), ++ &err)); ++ val32 = D11SHM_RD(sdiod, ++ M_DS1_CTRL_SDIO(sdiod->fmac_ulp), ++ &err); ++ D11SHM_WR(sdiod, M_DS1_CTRL_SDIO(sdiod->fmac_ulp), ++ val32, (C_DS1_CTRL_SDIO_DS1_EXIT | ++ C_DS1_CTRL_REQ_VALID), &err); ++ val32 = D11REG_RD(sdiod, D11_MACCONTROL_REG, &err); ++ val32 = val32 | D11_MACCONTROL_REG_WAKE; ++ D11REG_WR(sdiod, D11_MACCONTROL_REG, val32, &err); ++ ++ /* Poll for PROC_DONE to be set by ucode */ ++ value = D11SHM_RDW(sdiod, ++ M_DS1_CTRL_SDIO(sdiod->fmac_ulp), ++ &err); ++ /* Wait here (polling) for C_DS1_CTRL_PROC_DONE */ ++ timeout = jiffies + ULP_HUDI_PROC_DONE_TIME; ++ while (!(value & C_DS1_CTRL_PROC_DONE)) { ++ value = D11SHM_RDW(sdiod, ++ M_DS1_CTRL_SDIO(sdiod->fmac_ulp), ++ &err); ++ if (time_after(jiffies, timeout)) ++ break; ++ usleep_range(1000, 2000); ++ } ++ brcmf_dbg(ULP, "M_DS1_CTRL_SDIO: 0x%08x\n", ++ (u32)D11SHM_RDW(sdiod, ++ M_DS1_CTRL_SDIO(sdiod->fmac_ulp), &err)); ++ value = D11SHM_RDW(sdiod, ++ M_DS1_CTRL_SDIO(sdiod->fmac_ulp), ++ &err); ++ if (!(value & C_DS1_CTRL_PROC_DONE)) { ++ brcmf_err("Timeout Failed to enter DS1 Exit state!\n"); ++ return false; ++ } ++ } ++ ++ ulp_wake_ind = D11SHM_RDW(sdiod, ++ M_ULP_WAKE_IND(sdiod->fmac_ulp), ++ &err); ++ wowl_wake_ind = D11SHM_RDW(sdiod, ++ M_WAKEEVENT_IND(sdiod->fmac_ulp), ++ &err); ++ brcmf_dbg(ULP, "wowl_wake_ind: 0x%08x, ulp_wake_ind: 0x%08x\n", ++ wowl_wake_ind, ulp_wake_ind); ++ reg_addr = CORE_CC_REG( ++ brcmf_chip_get_pmu(bus->ci)->base, min_res_mask); ++ brcmf_sdiod_writel(sdiod, reg_addr, ++ DEFAULT_43012_MIN_RES_MASK, &err); ++ if (err) ++ brcmf_err("min_res_mask failed\n"); ++ ++ return true; ++ } ++ ++ return false; ++} ++ + static void brcmf_sdio_dpc(struct brcmf_sdio *bus) + { + struct brcmf_sdio_dev *sdiod = bus->sdiodev; +@@ -2651,8 +2842,11 @@ static void brcmf_sdio_dpc(struct brcmf_ + + /* Handle host mailbox indication */ + if (intstatus & I_HMB_HOST_INT) { ++ u32 hmb_data = 0; + intstatus &= ~I_HMB_HOST_INT; +- intstatus |= brcmf_sdio_hostmail(bus); ++ intstatus |= brcmf_sdio_hostmail(bus, &hmb_data); ++ if (brcmf_sdio_ulp_pre_redownload_check(bus, hmb_data)) ++ brcmf_sdio_ulp_reinit_fw(bus); + } + + sdio_release_host(bus->sdiodev->func1); +@@ -2697,7 +2891,7 @@ static void brcmf_sdio_dpc(struct brcmf_ + brcmf_sdio_clrintr(bus); + + if (bus->ctrl_frame_stat && (bus->clkstate == CLK_AVAIL) && +- txctl_ok(bus)) { ++ txctl_ok(bus) && brcmf_sdio_f2_ready(bus)) { + sdio_claim_host(bus->sdiodev->func1); + if (bus->ctrl_frame_stat) { + err = brcmf_sdio_tx_ctrlframe(bus, bus->ctrl_frame_buf, +@@ -3567,6 +3761,10 @@ static int brcmf_sdio_bus_preinit(struct + if (err < 0) + goto done; + ++ /* initialize SHM address from firmware for DS1 */ ++ if (!bus->sdiodev->ulp) ++ brcmf_sdio_ulp_preinit(dev); ++ + bus->tx_hdrlen = SDPCM_HWHDR_LEN + SDPCM_SWHDR_LEN; + if (sdiodev->sg_support) { + bus->txglom = false; +@@ -4215,7 +4413,7 @@ static void brcmf_sdio_firmware_callback + u8 saveclk, bpreq; + u8 devctl; + +- brcmf_dbg(TRACE, "Enter: dev=%s, err=%d\n", dev_name(dev), err); ++ brcmf_dbg(ULP, "Enter: dev=%s, err=%d\n", dev_name(dev), err); + + if (err) + goto fail; +@@ -4392,12 +4590,25 @@ static void brcmf_sdio_firmware_callback + } + + /* Attach to the common layer, reserve hdr space */ +- err = brcmf_attach(sdiod->dev); ++ err = brcmf_attach(sdiod->dev, !bus->sdiodev->ulp); + if (err != 0) { + brcmf_err("brcmf_attach failed\n"); + goto free; + } + ++ /* Register for ULP events */ ++ if (sdiod->func1->device == SDIO_DEVICE_ID_BROADCOM_CYPRESS_43012) ++ brcmf_fweh_register(bus_if->drvr, BRCMF_E_ULP, ++ brcmf_ulp_event_notify); ++ ++ if (bus->sdiodev->ulp) { ++ /* For ULP, after firmware redownload complete ++ * set ULP state to IDLE ++ */ ++ if (bus->sdiodev->fmac_ulp.ulp_state == FMAC_ULP_TRIGGERED) ++ bus->sdiodev->fmac_ulp.ulp_state = FMAC_ULP_IDLE; ++ } ++ + /* ready */ + return; + +@@ -4640,3 +4851,40 @@ int brcmf_sdio_sleep(struct brcmf_sdio * + + return ret; + } ++ ++/* Check F2 Ready bit before sending data to Firmware */ ++static int ++brcmf_sdio_f2_ready(struct brcmf_sdio *bus) ++{ ++ int ret = -1; ++ int iordy_status = 0; ++ ++ sdio_claim_host(bus->sdiodev->func1); ++ /* Read the status of IOR2 */ ++ iordy_status = brcmf_sdiod_func0_rb(bus->sdiodev, SDIO_CCCR_IORx, NULL); ++ ++ sdio_release_host(bus->sdiodev->func1); ++ ret = iordy_status & SDIO_FUNC_ENABLE_2; ++ return ret; ++} ++ ++static int brcmf_ulp_event_notify(struct brcmf_if *ifp, ++ const struct brcmf_event_msg *evtmsg, ++ void *data) ++{ ++ int err = 0; ++ struct brcmf_bus *bus_if = ifp->drvr->bus_if; ++ struct brcmf_sdio_dev *sdiodev; ++ struct brcmf_sdio *bus; ++ struct brcmf_ulp_event *ulp_event = (struct brcmf_ulp_event *)data; ++ ++ sdiodev = bus_if->bus_priv.sdio; ++ bus = sdiodev->bus; ++ ++ brcmf_dbg(ULP, "Chip went to DS1 state : action %d\n", ++ ulp_event->ulp_dongle_action); ++ if (ulp_event->ulp_dongle_action == FMAC_ULP_ENTRY) ++ bus->sdiodev->fmac_ulp.ulp_state = FMAC_ULP_ENTRY_RECV; ++ ++ return err; ++} +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h +@@ -165,6 +165,35 @@ struct brcmf_sdreg { + struct brcmf_sdio; + struct brcmf_sdiod_freezer; + ++/* ULP SHM Offsets info */ ++struct ulp_shm_info { ++ u32 m_ulp_ctrl_sdio; ++ u32 m_ulp_wakeevt_ind; ++ u32 m_ulp_wakeind; ++ u32 m_ulp_phytxblk; ++}; ++ ++/* FMAC ULP state machine */ ++#define FMAC_ULP_IDLE (0) ++#define FMAC_ULP_ENTRY_RECV (1) ++#define FMAC_ULP_TRIGGERED (2) ++ ++/* BRCMF_E_ULP event data */ ++#define FMAC_ULP_EVENT_VERSION 1 ++#define FMAC_ULP_DISABLE_CONSOLE 1 /* Disable console */ ++#define FMAC_ULP_UCODE_DOWNLOAD 2 /* Download ULP ucode file */ ++#define FMAC_ULP_ENTRY 3 /* Inform ulp entry to Host */ ++ ++struct brcmf_ulp { ++ uint ulp_state; ++ struct ulp_shm_info ulp_shm_offset; ++}; ++ ++struct brcmf_ulp_event { ++ u16 version; ++ u16 ulp_dongle_action; ++}; ++ + struct brcmf_sdio_dev { + struct sdio_func *func1; + struct sdio_func *func2; +@@ -193,6 +222,8 @@ struct brcmf_sdio_dev { + enum brcmf_sdiod_state state; + struct brcmf_sdiod_freezer *freezer; + const struct firmware *clm_fw; ++ struct brcmf_ulp fmac_ulp; ++ bool ulp; + }; + + /* sdio core registers */ +@@ -367,4 +398,83 @@ void brcmf_sdio_wowl_config(struct devic + int brcmf_sdio_sleep(struct brcmf_sdio *bus, bool sleep); + void brcmf_sdio_trigger_dpc(struct brcmf_sdio *bus); + ++/* SHM offsets */ ++#define M_DS1_CTRL_SDIO(ptr) ((ptr).ulp_shm_offset.m_ulp_ctrl_sdio) ++#define M_WAKEEVENT_IND(ptr) ((ptr).ulp_shm_offset.m_ulp_wakeevt_ind) ++#define M_ULP_WAKE_IND(ptr) ((ptr).ulp_shm_offset.m_ulp_wakeind) ++#define M_DS1_PHYTX_ERR_BLK(ptr) ((ptr).ulp_shm_offset.m_ulp_phytxblk) ++ ++#define D11_BASE_ADDR 0x18001000 ++#define D11_AXI_BASE_ADDR 0xE8000000 ++#define D11_SHM_BASE_ADDR (D11_AXI_BASE_ADDR + 0x4000) ++ ++#define D11REG_ADDR(offset) (D11_BASE_ADDR + (offset)) ++#define D11IHR_ADDR(offset) (D11_AXI_BASE_ADDR + 0x400 + (2 * (offset))) ++#define D11SHM_ADDR(offset) (D11_SHM_BASE_ADDR + (offset)) ++ ++/* MacControl register */ ++#define D11_MACCONTROL_REG D11REG_ADDR(0x120) ++#define D11_MACCONTROL_REG_WAKE 0x4000000 ++ ++/* HUDI Sequence SHM bits */ ++#define C_DS1_CTRL_SDIO_DS1_SLEEP 0x1 ++#define C_DS1_CTRL_SDIO_MAC_ON 0x2 ++#define C_DS1_CTRL_SDIO_RADIO_PHY_ON 0x4 ++#define C_DS1_CTRL_SDIO_DS1_EXIT 0x8 ++#define C_DS1_CTRL_PROC_DONE 0x100 ++#define C_DS1_CTRL_REQ_VALID 0x200 ++ ++/* M_ULP_WAKEIND bits */ ++#define C_WATCHDOG_EXPIRY BIT(0) ++#define C_FCBS_ERROR BIT(1) ++#define C_RETX_FAILURE BIT(2) ++#define C_HOST_WAKEUP BIT(3) ++#define C_INVALID_FCBS_BLOCK BIT(4) ++#define C_HUDI_DS1_EXIT BIT(5) ++#define C_LOB_SLEEP BIT(6) ++#define C_DS1_PHY_TXERR BIT(9) ++#define C_DS1_WAKE_TIMER BIT(10) ++ ++#define PHYTX_ERR_BLK_SIZE 18 ++#define D11SHM_FIRST2BYTE_MASK 0xFFFF0000 ++#define D11SHM_SECOND2BYTE_MASK 0x0000FFFF ++#define D11SHM_2BYTE_SHIFT 16 ++ ++#define D11SHM_RD(sdh, offset, ret) \ ++ brcmf_sdiod_readl(sdh, D11SHM_ADDR(offset), ret) ++ ++/* SHM Read is motified based on SHM 4 byte alignment as SHM size is 2 bytes and ++ * 2 byte is currently not working on FMAC ++ * If SHM address is not 4 byte aligned, then right shift by 16 ++ * otherwise, mask the first two MSB bytes ++ * Suppose data in address 7260 is 0x440002 and it is 4 byte aligned ++ * Correct SHM value is 0x2 for this SHM offset and next SHM value is 0x44 ++ */ ++#define D11SHM_RDW(sdh, offset, ret) \ ++ ((offset % 4) ? \ ++ (brcmf_sdiod_readl(sdh, D11SHM_ADDR(offset), ret) \ ++ >> D11SHM_2BYTE_SHIFT) : \ ++ (brcmf_sdiod_readl(sdh, D11SHM_ADDR(offset), ret) \ ++ & D11SHM_SECOND2BYTE_MASK)) ++ ++/* SHM is of size 2 bytes, 4 bytes write will overwrite other SHM's ++ * First read 4 bytes and then clear the required two bytes based on ++ * 4 byte alignment, then update the required value and write the ++ * 4 byte value now ++ */ ++#define D11SHM_WR(sdh, offset, val, mask, ret) \ ++ do { \ ++ if ((offset) % 4) \ ++ val = (val & D11SHM_SECOND2BYTE_MASK) | \ ++ ((mask) << D11SHM_2BYTE_SHIFT); \ ++ else \ ++ val = (mask) | (val & D11SHM_FIRST2BYTE_MASK); \ ++ brcmf_sdiod_writel(sdh, D11SHM_ADDR(offset), val, ret); \ ++ } while (0) ++#define D11REG_WR(sdh, addr, val, ret) \ ++ brcmf_sdiod_writel(sdh, addr, val, ret) ++ ++#define D11REG_RD(sdh, addr, ret) \ ++ brcmf_sdiod_readl(sdh, addr, ret) ++ + #endif /* BRCMFMAC_SDIO_H */ +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +@@ -1200,7 +1200,7 @@ static void brcmf_usb_probe_phase2(struc + goto error; + + /* Attach to the common driver interface */ +- ret = brcmf_attach(devinfo->dev); ++ ret = brcmf_attach(devinfo->dev, true); + if (ret) + goto error; + +@@ -1277,7 +1277,7 @@ static int brcmf_usb_probe_cb(struct brc + ret = brcmf_alloc(devinfo->dev, devinfo->settings); + if (ret) + goto fail; +- ret = brcmf_attach(devinfo->dev); ++ ret = brcmf_attach(devinfo->dev, true); + if (ret) + goto fail; + /* we are done */ +--- a/drivers/net/wireless/broadcom/brcm80211/include/chipcommon.h ++++ b/drivers/net/wireless/broadcom/brcm80211/include/chipcommon.h +@@ -308,4 +308,6 @@ struct chipcregs { + */ + #define PMU_MAX_TRANSITION_DLY 15000 + ++#define DEFAULT_43012_MIN_RES_MASK 0x0f8bfe77 ++ + #endif /* _SBCHIPC_H */ diff --git a/package/kernel/mac80211/patches/brcm/870-05-rpi-6.12-brcmfmac-Fix-interoperating-DPP-and-other-encryption.patch b/package/kernel/mac80211/patches/brcm/870-05-rpi-6.12-brcmfmac-Fix-interoperating-DPP-and-other-encryption.patch new file mode 100644 index 00000000000000..080ce2bb865709 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/870-05-rpi-6.12-brcmfmac-Fix-interoperating-DPP-and-other-encryption.patch @@ -0,0 +1,129 @@ +From 4c1d4af0ac83705828dd11fded409163a87ea515 Mon Sep 17 00:00:00 2001 +From: Kurt Lee +Date: Thu, 20 Aug 2020 03:07:02 -0500 +Subject: [PATCH] brcmfmac: Fix interoperating DPP and other encryption network + access + +1. If firmware supports 4-way handshake offload but not supports DPP +4-way offload, when user first connects encryption network, driver will +set "sup_wpa 1" to firmware, but it will further result in DPP +connection failure since firmware won't send EAPOL frame to host. + +2. Fix DPP AP mode handling action frames. + +3. For some firmware without fwsup support, the join procedure will be +skipped due to "sup_wpa" iovar returning not-support. Check the fwsup +feature before do such iovar. + +Signed-off-by: Kurt Lee +Signed-off-by: Double Lo +Signed-off-by: Chi-hsien Lin +--- + .../broadcom/brcm80211/brcmfmac/cfg80211.c | 67 ++++++++++--------- + .../broadcom/brcm80211/brcmfmac/p2p.c | 5 ++ + 2 files changed, 42 insertions(+), 30 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -2491,43 +2491,50 @@ brcmf_cfg80211_connect(struct wiphy *wip + goto done; + } + +- if (sme->crypto.psk && +- profile->use_fwsup != BRCMF_PROFILE_FWSUP_SAE) { +- if (WARN_ON(profile->use_fwsup != BRCMF_PROFILE_FWSUP_NONE)) { +- err = -EINVAL; +- goto done; ++ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_FWSUP)) { ++ if (sme->crypto.psk) { ++ if (profile->use_fwsup != BRCMF_PROFILE_FWSUP_SAE) { ++ if (WARN_ON(profile->use_fwsup != ++ BRCMF_PROFILE_FWSUP_NONE)) { ++ err = -EINVAL; ++ goto done; ++ } ++ brcmf_dbg(INFO, "using PSK offload\n"); ++ profile->use_fwsup = BRCMF_PROFILE_FWSUP_PSK; ++ } ++ } else { ++ profile->use_fwsup = BRCMF_PROFILE_FWSUP_NONE; + } +- brcmf_dbg(INFO, "using PSK offload\n"); +- profile->use_fwsup = BRCMF_PROFILE_FWSUP_PSK; +- } + +- if (profile->use_fwsup != BRCMF_PROFILE_FWSUP_NONE) { +- /* enable firmware supplicant for this interface */ +- err = brcmf_fil_iovar_int_set(ifp, "sup_wpa", 1); +- if (err < 0) { +- bphy_err(drvr, "failed to enable fw supplicant\n"); +- goto done; ++ if (profile->use_fwsup != BRCMF_PROFILE_FWSUP_NONE) { ++ /* enable firmware supplicant for this interface */ ++ err = brcmf_fil_iovar_int_set(ifp, "sup_wpa", 1); ++ if (err < 0) { ++ bphy_err(drvr, "failed to enable fw supplicant\n"); ++ goto done; ++ } ++ } else { ++ err = brcmf_fil_iovar_int_set(ifp, "sup_wpa", 0); + } +- } + +- if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_PSK) +- err = brcmf_set_pmk(ifp, sme->crypto.psk, +- BRCMF_WSEC_MAX_PSK_LEN); +- else if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_SAE) { +- /* clean up user-space RSNE */ +- err = brcmf_fil_iovar_data_set(ifp, "wpaie", NULL, 0); +- if (err) { +- bphy_err(drvr, "failed to clean up user-space RSNE\n"); +- goto done; +- } +- err = brcmf_fwvid_set_sae_password(ifp, &sme->crypto); +- if (!err && sme->crypto.psk) ++ if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_PSK) { + err = brcmf_set_pmk(ifp, sme->crypto.psk, + BRCMF_WSEC_MAX_PSK_LEN); ++ } else if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_SAE) { ++ /* clean up user-space RSNE */ ++ err = brcmf_fil_iovar_data_set(ifp, "wpaie", NULL, 0); ++ if (err) { ++ bphy_err(drvr, "failed to clean up user-space RSNE\n"); ++ goto done; ++ } ++ err = brcmf_fwvid_set_sae_password(ifp, &sme->crypto); ++ if (!err && sme->crypto.psk) ++ err = brcmf_set_pmk(ifp, sme->crypto.psk, ++ BRCMF_WSEC_MAX_PSK_LEN); ++ } ++ if (err) ++ goto done; + } +- if (err) +- goto done; +- + /* Join with specific BSSID and cached SSID + * If SSID is zero join based on BSSID only + */ +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c +@@ -1281,6 +1281,10 @@ static s32 brcmf_p2p_abort_action_frame( + brcmf_dbg(TRACE, "Enter\n"); + + vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif; ++ ++ if (!vif) ++ vif = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif; ++ + err = brcmf_fil_bsscfg_data_set(vif->ifp, "actframe_abort", &int_val, + sizeof(s32)); + if (err) +@@ -1826,6 +1830,7 @@ bool brcmf_p2p_send_action_frame(struct + /* validate channel and p2p ies */ + if (config_af_params.search_channel && + IS_P2P_SOCIAL_CHANNEL(le32_to_cpu(af_params->channel)) && ++ p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif && + p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif->saved_ie.probe_req_ie_len) { + afx_hdl = &p2p->afx_hdl; + afx_hdl->peer_listen_chan = le32_to_cpu(af_params->channel); diff --git a/package/kernel/mac80211/patches/brcm/870-06-rpi-6.12-brcmfmac-Include-modinfo-for-43456-CLM-blob.patch b/package/kernel/mac80211/patches/brcm/870-06-rpi-6.12-brcmfmac-Include-modinfo-for-43456-CLM-blob.patch new file mode 100644 index 00000000000000..f90406fa9ae488 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/870-06-rpi-6.12-brcmfmac-Include-modinfo-for-43456-CLM-blob.patch @@ -0,0 +1,26 @@ +From 0ff7f575b657b3fdfbd6902b68a28548208f4d36 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 8 May 2025 16:55:27 +0100 +Subject: [PATCH] wifi: brcmfmac: Include modinfo for 43456 CLM blob + +Listing firmware files in the brcmfmac modinfo helps with e.g. initramfs +creation. + +See: https://github.com/raspberrypi/linux/issues/6828 + +Signed-off-by: Phil Elwell +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -631,7 +631,7 @@ BRCMF_FW_CLM_DEF(43430A1, "brcmfmac43430 + BRCMF_FW_DEF(43430B0, "brcmfmac43430b0-sdio"); + BRCMF_FW_CLM_DEF(43439, "brcmfmac43439-sdio"); + BRCMF_FW_CLM_DEF(43455, "brcmfmac43455-sdio"); +-BRCMF_FW_DEF(43456, "brcmfmac43456-sdio"); ++BRCMF_FW_CLM_DEF(43456, "brcmfmac43456-sdio"); + BRCMF_FW_CLM_DEF(4354, "brcmfmac4354-sdio"); + BRCMF_FW_CLM_DEF(4356, "brcmfmac4356-sdio"); + BRCMF_FW_DEF(4359, "brcmfmac4359-sdio"); diff --git a/package/kernel/mac80211/patches/brcm/865-brcmfmac-disable-dump_survey-on-bcm2835.patch b/package/kernel/mac80211/patches/brcm/871-brcmfmac-disable-dump_survey-on-bcm2835.patch similarity index 87% rename from package/kernel/mac80211/patches/brcm/865-brcmfmac-disable-dump_survey-on-bcm2835.patch rename to package/kernel/mac80211/patches/brcm/871-brcmfmac-disable-dump_survey-on-bcm2835.patch index 275f0aa166e48a..0dd0d11c18a96a 100644 --- a/package/kernel/mac80211/patches/brcm/865-brcmfmac-disable-dump_survey-on-bcm2835.patch +++ b/package/kernel/mac80211/patches/brcm/871-brcmfmac-disable-dump_survey-on-bcm2835.patch @@ -9,7 +9,7 @@ Signed-off-by: Álvaro Fernández Rojas --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -7986,6 +7986,7 @@ static s32 brcmf_translate_country_code( +@@ -7991,6 +7991,7 @@ static s32 brcmf_translate_country_code( return 0; } @@ -17,7 +17,7 @@ Signed-off-by: Álvaro Fernández Rojas static int brcmf_parse_dump_obss(char *buf, struct brcmf_dump_survey *survey) { -@@ -8208,6 +8209,7 @@ exit: +@@ -8213,6 +8214,7 @@ exit: brcmf_set_mpc(ifp, 1); return err; } @@ -25,7 +25,7 @@ Signed-off-by: Álvaro Fernández Rojas static void brcmf_cfg80211_reg_notifier(struct wiphy *wiphy, struct regulatory_request *req) -@@ -8360,8 +8362,10 @@ struct brcmf_cfg80211_info *brcmf_cfg802 +@@ -8379,8 +8381,10 @@ struct brcmf_cfg80211_info *brcmf_cfg802 if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL_GTK)) ops->set_rekey_data = brcmf_cfg80211_set_rekey_data; #endif From 8e272a6d839af59615d83ac580aab1b9a7272db7 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Sat, 24 May 2025 12:20:54 +0200 Subject: [PATCH 680/877] image: only filter out images when ImageBuilder is used Currently, we are filtering out images if DEFAULT:=n or BROKEN:=y are set, so if you are building from scratch and want to build custom images that are stripped down to fit, you must edit the image recipe or its just filtered out. So, to allow this behaviour when building from scratch as we can assume that person doing that knows what they are attempting to do lets just limit the filtering to ImageBuilder. Fixes: f060615a78e5 ("image: respect DEFAULT and BROKEN when Default profile is selected") Signed-off-by: Robert Marko --- include/image.mk | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/include/image.mk b/include/image.mk index c1d71f1cc4db02..6408719bdc48e3 100644 --- a/include/image.mk +++ b/include/image.mk @@ -569,12 +569,14 @@ endef define Device/Check/Common _PROFILE_SET = $$(strip $$(foreach profile,$$(PROFILES) DEVICE_$(1),$$(call DEVICE_CHECK_PROFILE,$$(profile)))) - # Check if device is disabled and if so do not mark to be installed - ifeq ($$(DEFAULT),n) - _PROFILE_SET := - endif - ifeq ($$(BROKEN),y) - _PROFILE_SET := + # Check if device is disabled and if so do not mark to be installed when ImageBuilder is used + ifeq ($(IB),1) + ifeq ($$(DEFAULT),n) + _PROFILE_SET := + endif + ifeq ($$(BROKEN),y) + _PROFILE_SET := + endif endif DEVICE_PACKAGES += $$(call extra_packages,$$(DEVICE_PACKAGES)) ifdef TARGET_PER_DEVICE_ROOTFS From e709e9bc067f0e97f9ccc43fdec451ff83bba2d5 Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Wed, 30 Apr 2025 21:15:18 +0200 Subject: [PATCH 681/877] mac80211: add patch to suppress PREP when mesh forwarding is disabled This fixes a bug where mac80211 would respond to a PREQ frame when a neighbor table entry exists locally even though it will not forward the frame and the reported path does not actually work. Link: https://github.com/openwrt/openwrt/pull/18657 Link: https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git/commit/?h=for-next&id=cf1b684a06170d253b47d6a5287821de976435bd Link: https://patches.linaro.org/project/linux-wireless/patch/20250430191042.3287004-1-benjamin@sipsolutions.net/ Signed-off-by: Benjamin Berg (cherry picked from commit 26e64260e93ffa2be2131c71dada4c89caa71e4b) --- ...-genlmsg_multicast_allns-upstream-ba.patch | 2 +- ...-not-offer-a-mesh-path-if-forwarding.patch | 56 +++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 package/kernel/mac80211/patches/subsys/400-v6.16-wifi-mac80211-do-not-offer-a-mesh-path-if-forwarding.patch diff --git a/package/kernel/mac80211/patches/build/300-backports-handle-genlmsg_multicast_allns-upstream-ba.patch b/package/kernel/mac80211/patches/build/300-backports-handle-genlmsg_multicast_allns-upstream-ba.patch index 5ab6bb736da1f3..523b5c67f42de5 100644 --- a/package/kernel/mac80211/patches/build/300-backports-handle-genlmsg_multicast_allns-upstream-ba.patch +++ b/package/kernel/mac80211/patches/build/300-backports-handle-genlmsg_multicast_allns-upstream-ba.patch @@ -43,8 +43,8 @@ Signed-off-by: Christian Marangi +compat-$(CPTCFG_KERNEL_5_15) += backport-5.15.o backport-genetlink.o +compat-$(CPTCFG_KERNEL_6_1) += backport-genetlink.o compat-$(CPTCFG_KERNEL_6_4) += backport-6.4.o + compat-$(CPTCFG_KERNEL_6_11) += backport-6.11.o - compat-$(CPTCFG_BPAUTO_BUILD_CRYPTO_LIB_ARC4) += lib-crypto-arc4.o --- a/compat/backport-genetlink.c +++ b/compat/backport-genetlink.c @@ -17,6 +17,7 @@ diff --git a/package/kernel/mac80211/patches/subsys/400-v6.16-wifi-mac80211-do-not-offer-a-mesh-path-if-forwarding.patch b/package/kernel/mac80211/patches/subsys/400-v6.16-wifi-mac80211-do-not-offer-a-mesh-path-if-forwarding.patch new file mode 100644 index 00000000000000..7c2c0b9f3fb2c0 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/400-v6.16-wifi-mac80211-do-not-offer-a-mesh-path-if-forwarding.patch @@ -0,0 +1,56 @@ +From 0d47666f48a084363ee54f389bec2865de4934b8 Mon Sep 17 00:00:00 2001 +From: Benjamin Berg +Date: Wed, 30 Apr 2025 20:25:38 +0200 +Subject: [PATCH] wifi: mac80211: do not offer a mesh path if forwarding is + disabled + +When processing a PREQ the code would always check whether we have a +mesh path locally and reply accordingly. However, when forwarding is +disabled then we should not reply with this information as we will not +forward data packets down that path. + +Move the check for dot11MeshForwarding up in the function and skip the +mesh path lookup in that case. In the else block, set forward to false +so that the rest of the function becomes a no-op and the +dot11MeshForwarding check does not need to be duplicated. + +This explains an effect observed in the Freifunk community where mesh +forwarding is disabled. In that case a mesh with three STAs and only bad +links in between them, individual STAs would occionally have indirect +mpath entries. This should not have happened. + +Signed-off-by: Benjamin Berg +Reviewed-by: Rouven Czerwinski +--- + net/mac80211/mesh_hwmp.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/net/mac80211/mesh_hwmp.c ++++ b/net/mac80211/mesh_hwmp.c +@@ -630,7 +630,7 @@ static void hwmp_preq_frame_process(stru + mesh_path_add_gate(mpath); + } + rcu_read_unlock(); +- } else { ++ } else if (ifmsh->mshcfg.dot11MeshForwarding) { + rcu_read_lock(); + mpath = mesh_path_lookup(sdata, target_addr); + if (mpath) { +@@ -648,6 +648,8 @@ static void hwmp_preq_frame_process(stru + } + } + rcu_read_unlock(); ++ } else { ++ forward = false; + } + + if (reply) { +@@ -665,7 +667,7 @@ static void hwmp_preq_frame_process(stru + } + } + +- if (forward && ifmsh->mshcfg.dot11MeshForwarding) { ++ if (forward) { + u32 preq_id; + u8 hopcount; + From 01644cba60d356acd09d37d8e450fd325c6b3456 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sat, 10 May 2025 23:52:16 +0800 Subject: [PATCH 682/877] kernel: bump 6.6 to 6.6.90 Remove upstreamed patches: bcm27xx/patches-6.6/950-0481-xhci-Use-more-event-ring-segment-table-entries.patch [1] pending-6.6/691-net-ipv6-fix-UDPv6-GSO-segmentation-with-NAT.patch [2] Manually rebased patches: generic/hack-6.6/781-usb-net-rndis-support-asr.patch [3] [1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.90&id=f377434945f528217e65fc5b18781caeba19ce72 [2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.90&id=e0272844995aff8cbf2cc88b78c2b35ca51eda43 [3] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.90&id=222b6685efe0d8c1cdb078a67bbe806f56d18f94 Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/18775 Signed-off-by: Hauke Mehrtens (cherry picked from commit 01d502623970edf5f612515bfb65f5b81d266290) Link: https://github.com/openwrt/openwrt/pull/18924 Signed-off-by: Robert Marko --- include/kernel-6.6 | 4 +- ...hci_fixup_endpoint-for-interval-adju.patch | 4 +- ...d-add-the-endpoint-context-in-xhci_f.patch | 2 +- ...ore-event-ring-segment-table-entries.patch | 66 -------------- ...-quirks-add-link-TRB-quirk-for-VL805.patch | 2 +- ...b-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch | 8 +- ...5-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch | 2 +- ...-changes-when-debug-info-is-disabled.patch | 2 +- ...-set-HID-bit-in-streaming-endpoint-c.patch | 2 +- ...support-for-performing-fake-doorbell.patch | 4 +- ...ansmit-from-devices-with-no-checksum.patch | 2 +- ...-software-USO-if-IPv6-extension-head.patch | 2 +- ...iatek-split-tx-and-rx-fields-in-mtk_.patch | 52 +++++------ ...iatek-use-QDMA-instead-of-ADMAv2-on-.patch | 8 +- ..._eth_soc-handle-dma-buffer-size-soc-.patch | 38 ++++---- ..._eth_soc-ppe-add-support-for-multipl.patch | 22 ++--- ...ediatek-Allow-gaps-in-MAC-allocation.patch | 2 +- ..._eth_soc-implement-.-get-set-_pausep.patch | 4 +- .../generic/hack-6.6/204-module_strip.patch | 8 +- .../721-net-add-packet-mangeling.patch | 4 +- .../781-usb-net-rndis-support-asr.patch | 10 +-- .../pending-6.6/655-increase_skb_pad.patch | 2 +- ...-fix-UDPv6-GSO-segmentation-with-NAT.patch | 88 ------------------- ...net-mtk_eth_soc-enable-threaded-NAPI.patch | 2 +- ..._eth_soc-reset-all-TX-queues-on-DMA-.patch | 2 +- ...-mediatek-enlarge-DMA-reserve-buffer.patch | 2 +- ..._eth_soc-add-paths-and-SerDes-modes-.patch | 18 ++-- ...th_soc-reduce-rx-ring-size-for-older.patch | 16 ++-- ..._eth_soc-do-not-enable-page-pool-sta.patch | 4 +- ...-max-gen-first-for-IMX8MM-and-IMX8MP.patch | 2 +- ...dsa-add-out-of-band-tagging-protocol.patch | 2 +- ...pc-add-compressed-zImage-for-mpc85xx.patch | 2 +- ...0-powerpc-85xx-tl-wdr4900-v1-support.patch | 2 +- .../101-powerpc-85xx-hiveap-330-support.patch | 2 +- .../106-powerpc-85xx-ws-ap3710i-support.patch | 2 +- ...-powerpc-85xx-add-ws-ap3825i-support.patch | 2 +- .../110-powerpc-85xx-br200-wp-support.patch | 2 +- ...ove-performance-usb-using-lowmem-for.patch | 24 ++--- ...ma_alloc_noncoherent-to-alloc-low-me.patch | 10 +-- 39 files changed, 139 insertions(+), 293 deletions(-) delete mode 100644 target/linux/bcm27xx/patches-6.6/950-0481-xhci-Use-more-event-ring-segment-table-entries.patch delete mode 100644 target/linux/generic/pending-6.6/691-net-ipv6-fix-UDPv6-GSO-segmentation-with-NAT.patch diff --git a/include/kernel-6.6 b/include/kernel-6.6 index f3ca0941dda83d..e4ac53448d5984 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .89 -LINUX_KERNEL_HASH-6.6.89 = c21af7d36068e4ac0704c242eac8459212e6bf4a5d09df941b9b4d17dc1eba00 +LINUX_VERSION-6.6 = .90 +LINUX_KERNEL_HASH-6.6.90 = ff856748671629c1fefef219099e0b4b81131c2d325e768cb0806e204157014e diff --git a/target/linux/bcm27xx/patches-6.6/950-0161-xhci-implement-xhci_fixup_endpoint-for-interval-adju.patch b/target/linux/bcm27xx/patches-6.6/950-0161-xhci-implement-xhci_fixup_endpoint-for-interval-adju.patch index 157fedf27080a8..886391d46f2ccd 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0161-xhci-implement-xhci_fixup_endpoint-for-interval-adju.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0161-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 -@@ -1498,6 +1498,109 @@ command_cleanup: +@@ -1524,6 +1524,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 */ -@@ -5360,6 +5463,7 @@ static const struct hc_driver xhci_hc_dr +@@ -5386,6 +5489,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-6.6/950-0163-usb-xhci-drop-and-add-the-endpoint-context-in-xhci_f.patch b/target/linux/bcm27xx/patches-6.6/950-0163-usb-xhci-drop-and-add-the-endpoint-context-in-xhci_f.patch index 70401f6e7b5aef..b5c72fb89f0310 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0163-usb-xhci-drop-and-add-the-endpoint-context-in-xhci_f.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0163-usb-xhci-drop-and-add-the-endpoint-context-in-xhci_f.patch @@ -19,7 +19,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c -@@ -1587,7 +1587,7 @@ static void xhci_fixup_endpoint(struct u +@@ -1613,7 +1613,7 @@ static void xhci_fixup_endpoint(struct u return; } ctrl_ctx->add_flags = xhci_get_endpoint_flag_from_index(ep_index); diff --git a/target/linux/bcm27xx/patches-6.6/950-0481-xhci-Use-more-event-ring-segment-table-entries.patch b/target/linux/bcm27xx/patches-6.6/950-0481-xhci-Use-more-event-ring-segment-table-entries.patch deleted file mode 100644 index 874725601c1dc7..00000000000000 --- a/target/linux/bcm27xx/patches-6.6/950-0481-xhci-Use-more-event-ring-segment-table-entries.patch +++ /dev/null @@ -1,66 +0,0 @@ -From d631e7354399aa2fb6079b72f515acd6d080c203 Mon Sep 17 00:00:00 2001 -From: Jonathan Bell -Date: Thu, 13 Jul 2023 14:43:21 +0100 -Subject: [PATCH 0481/1085] xhci: Use more event ring segment table entries - -Users have reported log spam created by "Event Ring Full" xHC event -TRBs. These are caused by interrupt latency in conjunction with a very -busy set of devices on the bus. The errors are benign, but throughput -will suffer as the xHC will pause processing of transfers until the -event ring is drained by the kernel. Expand the number of event TRB slots -available by increasing the number of event ring segments in the ERST. - -Controllers have a hardware-defined limit as to the number of ERST -entries they can process, so make the actual number in use -min(ERST_MAX_SEGS, hw_max). - -Signed-off-by: Jonathan Bell ---- - drivers/usb/host/xhci-mem.c | 9 +++++++-- - drivers/usb/host/xhci.h | 5 +++-- - 2 files changed, 10 insertions(+), 4 deletions(-) - ---- a/drivers/usb/host/xhci-mem.c -+++ b/drivers/usb/host/xhci-mem.c -@@ -2241,12 +2241,17 @@ xhci_alloc_interrupter(struct xhci_hcd * - struct device *dev = xhci_to_hcd(xhci)->self.sysdev; - struct xhci_interrupter *ir; - int ret; -+ unsigned int nr_event_segs; - - ir = kzalloc_node(sizeof(*ir), flags, dev_to_node(dev)); - if (!ir) - return NULL; - -- ir->event_ring = xhci_ring_alloc(xhci, ERST_NUM_SEGS, 1, TYPE_EVENT, -+ nr_event_segs = min_t(unsigned int, -+ 1 << HCS_ERST_MAX(xhci->hcs_params2), -+ ERST_MAX_SEGS); -+ -+ ir->event_ring = xhci_ring_alloc(xhci, nr_event_segs, 1, TYPE_EVENT, - 0, flags); - if (!ir->event_ring) { - xhci_warn(xhci, "Failed to allocate interrupter event ring\n"); -@@ -2283,7 +2288,7 @@ xhci_add_interrupter(struct xhci_hcd *xh - /* set ERST count with the number of entries in the segment table */ - erst_size = readl(&ir->ir_set->erst_size); - erst_size &= ERST_SIZE_MASK; -- erst_size |= ERST_NUM_SEGS; -+ erst_size |= ir->event_ring->num_segs; - writel(erst_size, &ir->ir_set->erst_size); - - erst_base = xhci_read_64(xhci, &ir->ir_set->erst_base); ---- a/drivers/usb/host/xhci.h -+++ b/drivers/usb/host/xhci.h -@@ -1426,8 +1426,9 @@ struct urb_priv { - * Each segment table entry is 4*32bits long. 1K seems like an ok size: - * (1K bytes * 8bytes/bit) / (4*32 bits) = 64 segment entries in the table, - * meaning 64 ring segments. -- * Initial allocated size of the ERST, in number of entries */ --#define ERST_NUM_SEGS 1 -+ */ -+/* Maximum number of segments in the ERST */ -+#define ERST_MAX_SEGS 8 - /* Poll every 60 seconds */ - #define POLL_TIMEOUT 60 - /* Stop endpoint command timeout (secs) for URB cancellation watchdog timer */ diff --git a/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch b/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch index e295c225f787ef..7ab01e4623a68b 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch @@ -52,7 +52,7 @@ 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 -@@ -1664,6 +1664,9 @@ struct xhci_hcd { +@@ -1660,6 +1660,9 @@ struct xhci_hcd { #define XHCI_CDNS_SCTX_QUIRK BIT_ULL(48) #define XHCI_ETRON_HOST BIT_ULL(49) diff --git a/target/linux/bcm27xx/patches-6.6/950-0484-usb-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch b/target/linux/bcm27xx/patches-6.6/950-0484-usb-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch index b6cfc1b7a880de..cad297ab7393c6 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0484-usb-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0484-usb-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch @@ -34,7 +34,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c -@@ -1400,6 +1400,7 @@ int xhci_endpoint_init(struct xhci_hcd * +@@ -1405,6 +1405,7 @@ int xhci_endpoint_init(struct xhci_hcd * unsigned int ep_index; struct xhci_ep_ctx *ep_ctx; struct xhci_ring *ep_ring; @@ -42,7 +42,7 @@ Signed-off-by: Jonathan Bell unsigned int max_packet; enum xhci_ring_type ring_type; u32 max_esit_payload; -@@ -1409,6 +1410,8 @@ int xhci_endpoint_init(struct xhci_hcd * +@@ -1414,6 +1415,8 @@ int xhci_endpoint_init(struct xhci_hcd * unsigned int mult; unsigned int avg_trb_len; unsigned int err_count = 0; @@ -51,7 +51,7 @@ Signed-off-by: Jonathan Bell ep_index = xhci_get_endpoint_index(&ep->desc); ep_ctx = xhci_get_ep_ctx(xhci, virt_dev->in_ctx, ep_index); -@@ -1440,9 +1443,35 @@ int xhci_endpoint_init(struct xhci_hcd * +@@ -1445,9 +1448,35 @@ int xhci_endpoint_init(struct xhci_hcd * mult = xhci_get_endpoint_mult(udev, ep); max_packet = usb_endpoint_maxp(&ep->desc); @@ -100,7 +100,7 @@ Signed-off-by: Jonathan Bell if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1666,6 +1666,7 @@ struct xhci_hcd { +@@ -1662,6 +1662,7 @@ struct xhci_hcd { /* Downstream VLI fixes */ #define XHCI_AVOID_DQ_ON_LINK BIT_ULL(56) diff --git a/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch b/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch index 5ab3a223969469..e1c96d25bb27d5 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch @@ -144,7 +144,7 @@ Signed-off-by: Jonathan Bell return 0; --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1667,6 +1667,7 @@ struct xhci_hcd { +@@ -1663,6 +1663,7 @@ struct xhci_hcd { /* Downstream VLI fixes */ #define XHCI_AVOID_DQ_ON_LINK BIT_ULL(56) #define XHCI_VLI_SS_BULK_OUT_BUG BIT_ULL(57) diff --git a/target/linux/bcm27xx/patches-6.6/950-1021-module-Avoid-ABI-changes-when-debug-info-is-disabled.patch b/target/linux/bcm27xx/patches-6.6/950-1021-module-Avoid-ABI-changes-when-debug-info-is-disabled.patch index 99b153d0bed020..8ea7e963866667 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1021-module-Avoid-ABI-changes-when-debug-info-is-disabled.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1021-module-Avoid-ABI-changes-when-debug-info-is-disabled.patch @@ -15,7 +15,7 @@ Define these members unconditionally, so that there is no ABI change. --- a/include/linux/module.h +++ b/include/linux/module.h -@@ -510,7 +510,7 @@ struct module { +@@ -512,7 +512,7 @@ struct module { unsigned int num_bpf_raw_events; struct bpf_raw_event_map *bpf_raw_events; #endif diff --git a/target/linux/bcm27xx/patches-6.6/950-1377-drivers-usb-xhci-set-HID-bit-in-streaming-endpoint-c.patch b/target/linux/bcm27xx/patches-6.6/950-1377-drivers-usb-xhci-set-HID-bit-in-streaming-endpoint-c.patch index 230537f50565d9..fc004dc57d34af 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1377-drivers-usb-xhci-set-HID-bit-in-streaming-endpoint-c.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1377-drivers-usb-xhci-set-HID-bit-in-streaming-endpoint-c.patch @@ -28,7 +28,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c -@@ -716,6 +716,14 @@ void xhci_setup_streams_ep_input_ctx(str +@@ -721,6 +721,14 @@ void xhci_setup_streams_ep_input_ctx(str ep_ctx->ep_info &= cpu_to_le32(~EP_MAXPSTREAMS_MASK); ep_ctx->ep_info |= cpu_to_le32(EP_MAXPSTREAMS(max_primary_streams) | EP_HAS_LSA); diff --git a/target/linux/bcm53xx/patches-6.6/180-usb-xhci-add-support-for-performing-fake-doorbell.patch b/target/linux/bcm53xx/patches-6.6/180-usb-xhci-add-support-for-performing-fake-doorbell.patch index aef84351482e95..5886cef55adb1f 100644 --- a/target/linux/bcm53xx/patches-6.6/180-usb-xhci-add-support-for-performing-fake-doorbell.patch +++ b/target/linux/bcm53xx/patches-6.6/180-usb-xhci-add-support-for-performing-fake-doorbell.patch @@ -85,7 +85,7 @@ it on BCM4708 family. /* * Reset a halted HC. * -@@ -481,6 +524,15 @@ static int xhci_run_finished(struct xhci +@@ -498,6 +541,15 @@ static int xhci_run_finished(struct xhci return -ENODEV; } @@ -103,7 +103,7 @@ it on BCM4708 family. if (xhci->quirks & XHCI_NEC_HOST) --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1662,6 +1662,7 @@ struct xhci_hcd { +@@ -1659,6 +1659,7 @@ struct xhci_hcd { #define XHCI_WRITE_64_HI_LO BIT_ULL(47) #define XHCI_CDNS_SCTX_QUIRK BIT_ULL(48) #define XHCI_ETRON_HOST BIT_ULL(49) diff --git a/target/linux/generic/backport-6.6/611-01-v6.11-udp-Allow-GSO-transmit-from-devices-with-no-checksum.patch b/target/linux/generic/backport-6.6/611-01-v6.11-udp-Allow-GSO-transmit-from-devices-with-no-checksum.patch index d1673ec7d4a60c..4cafd27fdcd4bd 100644 --- a/target/linux/generic/backport-6.6/611-01-v6.11-udp-Allow-GSO-transmit-from-devices-with-no-checksum.patch +++ b/target/linux/generic/backport-6.6/611-01-v6.11-udp-Allow-GSO-transmit-from-devices-with-no-checksum.patch @@ -65,7 +65,7 @@ Signed-off-by: Jakub Kicinski } --- a/net/ipv4/udp_offload.c +++ b/net/ipv4/udp_offload.c -@@ -384,6 +384,14 @@ struct sk_buff *__udp_gso_segment(struct +@@ -443,6 +443,14 @@ struct sk_buff *__udp_gso_segment(struct else uh->check = gso_make_checksum(seg, ~check) ? : CSUM_MANGLED_0; diff --git a/target/linux/generic/backport-6.6/611-03-v6.11-udp-Fall-back-to-software-USO-if-IPv6-extension-head.patch b/target/linux/generic/backport-6.6/611-03-v6.11-udp-Fall-back-to-software-USO-if-IPv6-extension-head.patch index e8eceb880c8dbd..d3df5162ac68ed 100644 --- a/target/linux/generic/backport-6.6/611-03-v6.11-udp-Fall-back-to-software-USO-if-IPv6-extension-head.patch +++ b/target/linux/generic/backport-6.6/611-03-v6.11-udp-Fall-back-to-software-USO-if-IPv6-extension-head.patch @@ -71,7 +71,7 @@ Signed-off-by: Jakub Kicinski --- a/net/ipv4/udp_offload.c +++ b/net/ipv4/udp_offload.c -@@ -283,6 +283,12 @@ struct sk_buff *__udp_gso_segment(struct +@@ -342,6 +342,12 @@ struct sk_buff *__udp_gso_segment(struct !(skb_shinfo(gso_skb)->gso_type & SKB_GSO_FRAGLIST))) return ERR_PTR(-EINVAL); diff --git a/target/linux/generic/backport-6.6/751-01-v6.8-net-ethernet-mediatek-split-tx-and-rx-fields-in-mtk_.patch b/target/linux/generic/backport-6.6/751-01-v6.8-net-ethernet-mediatek-split-tx-and-rx-fields-in-mtk_.patch index 8fb4b6fef53481..ab12cc925fe9e8 100644 --- a/target/linux/generic/backport-6.6/751-01-v6.8-net-ethernet-mediatek-split-tx-and-rx-fields-in-mtk_.patch +++ b/target/linux/generic/backport-6.6/751-01-v6.8-net-ethernet-mediatek-split-tx-and-rx-fields-in-mtk_.patch @@ -167,7 +167,7 @@ Signed-off-by: Jakub Kicinski skb->ip_summed = CHECKSUM_UNNECESSARY; else skb_checksum_none_assert(skb); -@@ -2276,7 +2276,7 @@ static int mtk_poll_tx_qdma(struct mtk_e +@@ -2280,7 +2280,7 @@ static int mtk_poll_tx_qdma(struct mtk_e break; tx_buf = mtk_desc_to_tx_buf(ring, desc, @@ -176,7 +176,7 @@ Signed-off-by: Jakub Kicinski if (!tx_buf->data) break; -@@ -2327,7 +2327,7 @@ static int mtk_poll_tx_pdma(struct mtk_e +@@ -2331,7 +2331,7 @@ static int mtk_poll_tx_pdma(struct mtk_e } mtk_tx_unmap(eth, tx_buf, &bq, true); @@ -185,7 +185,7 @@ Signed-off-by: Jakub Kicinski ring->last_free = desc; atomic_inc(&ring->free_count); -@@ -2417,7 +2417,7 @@ static int mtk_napi_rx(struct napi_struc +@@ -2421,7 +2421,7 @@ static int mtk_napi_rx(struct napi_struc do { int rx_done; @@ -194,7 +194,7 @@ Signed-off-by: Jakub Kicinski reg_map->pdma.irq_status); rx_done = mtk_poll_rx(napi, budget - rx_done_total, eth); rx_done_total += rx_done; -@@ -2433,10 +2433,10 @@ static int mtk_napi_rx(struct napi_struc +@@ -2437,10 +2437,10 @@ static int mtk_napi_rx(struct napi_struc return budget; } while (mtk_r32(eth, reg_map->pdma.irq_status) & @@ -207,7 +207,7 @@ Signed-off-by: Jakub Kicinski return rx_done_total; } -@@ -2445,7 +2445,7 @@ static int mtk_tx_alloc(struct mtk_eth * +@@ -2449,7 +2449,7 @@ static int mtk_tx_alloc(struct mtk_eth * { const struct mtk_soc_data *soc = eth->soc; struct mtk_tx_ring *ring = ð->tx_ring; @@ -216,7 +216,7 @@ Signed-off-by: Jakub Kicinski struct mtk_tx_dma_v2 *txd; int ring_size; u32 ofs, val; -@@ -2568,14 +2568,14 @@ static void mtk_tx_clean(struct mtk_eth +@@ -2572,14 +2572,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, @@ -233,7 +233,7 @@ Signed-off-by: Jakub Kicinski ring->dma_pdma, ring->phys_pdma); ring->dma_pdma = NULL; } -@@ -2630,15 +2630,15 @@ static int mtk_rx_alloc(struct mtk_eth * +@@ -2634,15 +2634,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, @@ -253,7 +253,7 @@ Signed-off-by: Jakub Kicinski } if (!ring->dma) -@@ -2649,7 +2649,7 @@ static int mtk_rx_alloc(struct mtk_eth * +@@ -2653,7 +2653,7 @@ static int mtk_rx_alloc(struct mtk_eth * dma_addr_t dma_addr; void *data; @@ -262,7 +262,7 @@ Signed-off-by: Jakub Kicinski if (ring->page_pool) { data = mtk_page_pool_get_buff(ring->page_pool, &dma_addr, GFP_KERNEL); -@@ -2740,7 +2740,7 @@ static void mtk_rx_clean(struct mtk_eth +@@ -2744,7 +2744,7 @@ static void mtk_rx_clean(struct mtk_eth if (!ring->data[i]) continue; @@ -271,7 +271,7 @@ Signed-off-by: Jakub Kicinski if (!rxd->rxd1) continue; -@@ -2757,7 +2757,7 @@ static void mtk_rx_clean(struct mtk_eth +@@ -2761,7 +2761,7 @@ static void mtk_rx_clean(struct mtk_eth if (!in_sram && ring->dma) { dma_free_coherent(eth->dma_dev, @@ -280,7 +280,7 @@ Signed-off-by: Jakub Kicinski ring->dma, ring->phys); ring->dma = NULL; } -@@ -3120,7 +3120,7 @@ static void mtk_dma_free(struct mtk_eth +@@ -3124,7 +3124,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, @@ -289,7 +289,7 @@ Signed-off-by: Jakub Kicinski eth->scratch_ring, eth->phy_scratch_ring); eth->scratch_ring = NULL; eth->phy_scratch_ring = 0; -@@ -3170,7 +3170,7 @@ static irqreturn_t mtk_handle_irq_rx(int +@@ -3174,7 +3174,7 @@ static irqreturn_t mtk_handle_irq_rx(int eth->rx_events++; if (likely(napi_schedule_prep(ð->rx_napi))) { @@ -298,7 +298,7 @@ Signed-off-by: Jakub Kicinski __napi_schedule(ð->rx_napi); } -@@ -3196,9 +3196,9 @@ static irqreturn_t mtk_handle_irq(int ir +@@ -3200,9 +3200,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) & @@ -310,7 +310,7 @@ Signed-off-by: Jakub Kicinski mtk_handle_irq_rx(irq, _eth); } if (mtk_r32(eth, reg_map->tx_irq_mask) & MTK_TX_DONE_INT) { -@@ -3216,10 +3216,10 @@ static void mtk_poll_controller(struct n +@@ -3220,10 +3220,10 @@ static void mtk_poll_controller(struct n struct mtk_eth *eth = mac->hw; mtk_tx_irq_disable(eth, MTK_TX_DONE_INT); @@ -323,7 +323,7 @@ Signed-off-by: Jakub Kicinski } #endif -@@ -3383,7 +3383,7 @@ static int mtk_open(struct net_device *d +@@ -3387,7 +3387,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); @@ -332,7 +332,7 @@ Signed-off-by: Jakub Kicinski refcount_set(ð->dma_refcnt, 1); } else -@@ -3467,7 +3467,7 @@ static int mtk_stop(struct net_device *d +@@ -3471,7 +3471,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); @@ -341,7 +341,7 @@ Signed-off-by: Jakub Kicinski napi_disable(ð->tx_napi); napi_disable(ð->rx_napi); -@@ -3943,9 +3943,9 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -3947,9 +3947,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); @@ -353,7 +353,7 @@ Signed-off-by: Jakub Kicinski mtk_w32(eth, 0x21021000, MTK_FE_INT_GRP); if (mtk_is_netsys_v3_or_greater(eth)) { -@@ -5053,11 +5053,15 @@ static const struct mtk_soc_data mt2701_ +@@ -5057,11 +5057,15 @@ static const struct mtk_soc_data mt2701_ .required_clks = MT7623_CLKS_BITMAP, .required_pctl = true, .version = 1, @@ -374,7 +374,7 @@ Signed-off-by: Jakub Kicinski .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5073,11 +5077,15 @@ static const struct mtk_soc_data mt7621_ +@@ -5077,11 +5081,15 @@ static const struct mtk_soc_data mt7621_ .offload_version = 1, .hash_offset = 2, .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, @@ -395,7 +395,7 @@ Signed-off-by: Jakub Kicinski .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5095,11 +5103,15 @@ static const struct mtk_soc_data mt7622_ +@@ -5099,11 +5107,15 @@ static const struct mtk_soc_data mt7622_ .hash_offset = 2, .has_accounting = true, .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, @@ -416,7 +416,7 @@ Signed-off-by: Jakub Kicinski .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5116,11 +5128,15 @@ static const struct mtk_soc_data mt7623_ +@@ -5120,11 +5132,15 @@ static const struct mtk_soc_data mt7623_ .hash_offset = 2, .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, .disable_pll_modes = true, @@ -437,7 +437,7 @@ Signed-off-by: Jakub Kicinski .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5135,11 +5151,15 @@ static const struct mtk_soc_data mt7629_ +@@ -5139,11 +5155,15 @@ static const struct mtk_soc_data mt7629_ .required_pctl = false, .has_accounting = true, .version = 1, @@ -458,7 +458,7 @@ Signed-off-by: Jakub Kicinski .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5157,11 +5177,15 @@ static const struct mtk_soc_data mt7981_ +@@ -5161,11 +5181,15 @@ static const struct mtk_soc_data mt7981_ .hash_offset = 4, .has_accounting = true, .foe_entry_size = MTK_FOE_ENTRY_V2_SIZE, @@ -479,7 +479,7 @@ Signed-off-by: Jakub Kicinski .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, .dma_len_offset = 8, }, -@@ -5179,11 +5203,15 @@ static const struct mtk_soc_data mt7986_ +@@ -5183,11 +5207,15 @@ static const struct mtk_soc_data mt7986_ .hash_offset = 4, .has_accounting = true, .foe_entry_size = MTK_FOE_ENTRY_V2_SIZE, @@ -500,7 +500,7 @@ Signed-off-by: Jakub Kicinski .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, .dma_len_offset = 8, }, -@@ -5201,11 +5229,15 @@ static const struct mtk_soc_data mt7988_ +@@ -5205,11 +5233,15 @@ static const struct mtk_soc_data mt7988_ .hash_offset = 4, .has_accounting = true, .foe_entry_size = MTK_FOE_ENTRY_V3_SIZE, @@ -521,7 +521,7 @@ Signed-off-by: Jakub Kicinski .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, .dma_len_offset = 8, }, -@@ -5218,11 +5250,15 @@ static const struct mtk_soc_data rt5350_ +@@ -5222,11 +5254,15 @@ static const struct mtk_soc_data rt5350_ .required_clks = MT7628_CLKS_BITMAP, .required_pctl = false, .version = 1, diff --git a/target/linux/generic/backport-6.6/751-02-v6.8-net-ethernet-mediatek-use-QDMA-instead-of-ADMAv2-on-.patch b/target/linux/generic/backport-6.6/751-02-v6.8-net-ethernet-mediatek-use-QDMA-instead-of-ADMAv2-on-.patch index 2499f48bc60284..27c512864e0b93 100644 --- a/target/linux/generic/backport-6.6/751-02-v6.8-net-ethernet-mediatek-use-QDMA-instead-of-ADMAv2-on-.patch +++ b/target/linux/generic/backport-6.6/751-02-v6.8-net-ethernet-mediatek-use-QDMA-instead-of-ADMAv2-on-.patch @@ -76,7 +76,7 @@ Signed-off-by: Jakub Kicinski reason = FIELD_GET(MTK_RXD5_PPE_CPU_REASON, trxd.rxd5); hash = trxd.rxd5 & MTK_RXD5_FOE_ENTRY; if (hash != MTK_RXD5_FOE_ENTRY) -@@ -2686,7 +2686,7 @@ static int mtk_rx_alloc(struct mtk_eth * +@@ -2690,7 +2690,7 @@ static int mtk_rx_alloc(struct mtk_eth * rxd->rxd3 = 0; rxd->rxd4 = 0; @@ -85,7 +85,7 @@ Signed-off-by: Jakub Kicinski rxd->rxd5 = 0; rxd->rxd6 = 0; rxd->rxd7 = 0; -@@ -3889,7 +3889,7 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -3893,7 +3893,7 @@ static int mtk_hw_init(struct mtk_eth *e else mtk_hw_reset(eth); @@ -94,7 +94,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); -@@ -5183,11 +5183,11 @@ static const struct mtk_soc_data mt7981_ +@@ -5187,11 +5187,11 @@ static const struct mtk_soc_data mt7981_ .dma_len_offset = 8, }, .rx = { @@ -110,7 +110,7 @@ Signed-off-by: Jakub Kicinski }, }; -@@ -5209,11 +5209,11 @@ static const struct mtk_soc_data mt7986_ +@@ -5213,11 +5213,11 @@ static const struct mtk_soc_data mt7986_ .dma_len_offset = 8, }, .rx = { diff --git a/target/linux/generic/backport-6.6/752-25-v6.10-net-ethernet-mtk_eth_soc-handle-dma-buffer-size-soc-.patch b/target/linux/generic/backport-6.6/752-25-v6.10-net-ethernet-mtk_eth_soc-handle-dma-buffer-size-soc-.patch index ddb810718644ca..27dac7214b72b5 100644 --- a/target/linux/generic/backport-6.6/752-25-v6.10-net-ethernet-mtk_eth_soc-handle-dma-buffer-size-soc-.patch +++ b/target/linux/generic/backport-6.6/752-25-v6.10-net-ethernet-mtk_eth_soc-handle-dma-buffer-size-soc-.patch @@ -123,7 +123,7 @@ Signed-off-by: David S. Miller } } -@@ -2457,7 +2463,7 @@ static int mtk_tx_alloc(struct mtk_eth * +@@ -2461,7 +2467,7 @@ static int mtk_tx_alloc(struct mtk_eth * if (MTK_HAS_CAPS(soc->caps, MTK_QDMA)) ring_size = MTK_QDMA_RING_SIZE; else @@ -132,7 +132,7 @@ Signed-off-by: David S. Miller ring->buf = kcalloc(ring_size, sizeof(*ring->buf), GFP_KERNEL); -@@ -2465,8 +2471,8 @@ static int mtk_tx_alloc(struct mtk_eth * +@@ -2469,8 +2475,8 @@ static int mtk_tx_alloc(struct mtk_eth * goto no_tx_mem; if (MTK_HAS_CAPS(soc->caps, MTK_SRAM)) { @@ -143,7 +143,7 @@ Signed-off-by: David S. Miller } else { ring->dma = dma_alloc_coherent(eth->dma_dev, ring_size * sz, &ring->phys, GFP_KERNEL); -@@ -2588,6 +2594,7 @@ static void mtk_tx_clean(struct mtk_eth +@@ -2592,6 +2598,7 @@ static void mtk_tx_clean(struct mtk_eth static int mtk_rx_alloc(struct mtk_eth *eth, int ring_no, int rx_flag) { const struct mtk_reg_map *reg_map = eth->soc->reg_map; @@ -151,7 +151,7 @@ Signed-off-by: David S. Miller struct mtk_rx_ring *ring; int rx_data_len, rx_dma_size, tx_ring_size; int i; -@@ -2595,7 +2602,7 @@ static int mtk_rx_alloc(struct mtk_eth * +@@ -2599,7 +2606,7 @@ static int mtk_rx_alloc(struct mtk_eth * if (MTK_HAS_CAPS(eth->soc->caps, MTK_QDMA)) tx_ring_size = MTK_QDMA_RING_SIZE; else @@ -160,7 +160,7 @@ Signed-off-by: David S. Miller if (rx_flag == MTK_RX_FLAGS_QDMA) { if (ring_no) -@@ -2610,7 +2617,7 @@ static int mtk_rx_alloc(struct mtk_eth * +@@ -2614,7 +2621,7 @@ static int mtk_rx_alloc(struct mtk_eth * rx_dma_size = MTK_HW_LRO_DMA_SIZE; } else { rx_data_len = ETH_DATA_LEN; @@ -169,7 +169,7 @@ Signed-off-by: David S. Miller } ring->frag_size = mtk_max_frag_size(rx_data_len); -@@ -3139,7 +3146,10 @@ static void mtk_dma_free(struct mtk_eth +@@ -3143,7 +3150,10 @@ static void mtk_dma_free(struct mtk_eth mtk_rx_clean(eth, ð->rx_ring[i], false); } @@ -181,7 +181,7 @@ Signed-off-by: David S. Miller } static bool mtk_hw_reset_check(struct mtk_eth *eth) -@@ -5061,11 +5071,14 @@ static const struct mtk_soc_data mt2701_ +@@ -5065,11 +5075,14 @@ static const struct mtk_soc_data mt2701_ .desc_size = sizeof(struct mtk_tx_dma), .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, @@ -196,7 +196,7 @@ Signed-off-by: David S. Miller .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5085,11 +5098,14 @@ static const struct mtk_soc_data mt7621_ +@@ -5089,11 +5102,14 @@ static const struct mtk_soc_data mt7621_ .desc_size = sizeof(struct mtk_tx_dma), .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, @@ -211,7 +211,7 @@ Signed-off-by: David S. Miller .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5111,11 +5127,14 @@ static const struct mtk_soc_data mt7622_ +@@ -5115,11 +5131,14 @@ static const struct mtk_soc_data mt7622_ .desc_size = sizeof(struct mtk_tx_dma), .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, @@ -226,7 +226,7 @@ Signed-off-by: David S. Miller .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5136,11 +5155,14 @@ static const struct mtk_soc_data mt7623_ +@@ -5140,11 +5159,14 @@ static const struct mtk_soc_data mt7623_ .desc_size = sizeof(struct mtk_tx_dma), .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, @@ -241,7 +241,7 @@ Signed-off-by: David S. Miller .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5159,11 +5181,14 @@ static const struct mtk_soc_data mt7629_ +@@ -5163,11 +5185,14 @@ static const struct mtk_soc_data mt7629_ .desc_size = sizeof(struct mtk_tx_dma), .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, @@ -256,7 +256,7 @@ Signed-off-by: David S. Miller .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5185,6 +5210,8 @@ static const struct mtk_soc_data mt7981_ +@@ -5189,6 +5214,8 @@ static const struct mtk_soc_data mt7981_ .desc_size = sizeof(struct mtk_tx_dma_v2), .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, .dma_len_offset = 8, @@ -265,7 +265,7 @@ Signed-off-by: David S. Miller }, .rx = { .desc_size = sizeof(struct mtk_rx_dma), -@@ -5192,6 +5219,7 @@ static const struct mtk_soc_data mt7981_ +@@ -5196,6 +5223,7 @@ static const struct mtk_soc_data mt7981_ .dma_l4_valid = RX_DMA_L4_VALID_V2, .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, @@ -273,7 +273,7 @@ Signed-off-by: David S. Miller }, }; -@@ -5211,6 +5239,8 @@ static const struct mtk_soc_data mt7986_ +@@ -5215,6 +5243,8 @@ static const struct mtk_soc_data mt7986_ .desc_size = sizeof(struct mtk_tx_dma_v2), .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, .dma_len_offset = 8, @@ -282,7 +282,7 @@ Signed-off-by: David S. Miller }, .rx = { .desc_size = sizeof(struct mtk_rx_dma), -@@ -5218,6 +5248,7 @@ static const struct mtk_soc_data mt7986_ +@@ -5222,6 +5252,7 @@ static const struct mtk_soc_data mt7986_ .dma_l4_valid = RX_DMA_L4_VALID_V2, .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, @@ -290,7 +290,7 @@ Signed-off-by: David S. Miller }, }; -@@ -5237,6 +5268,8 @@ static const struct mtk_soc_data mt7988_ +@@ -5241,6 +5272,8 @@ static const struct mtk_soc_data mt7988_ .desc_size = sizeof(struct mtk_tx_dma_v2), .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, .dma_len_offset = 8, @@ -299,7 +299,7 @@ Signed-off-by: David S. Miller }, .rx = { .desc_size = sizeof(struct mtk_rx_dma_v2), -@@ -5244,6 +5277,7 @@ static const struct mtk_soc_data mt7988_ +@@ -5248,6 +5281,7 @@ static const struct mtk_soc_data mt7988_ .dma_l4_valid = RX_DMA_L4_VALID_V2, .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, .dma_len_offset = 8, @@ -307,7 +307,7 @@ Signed-off-by: David S. Miller }, }; -@@ -5258,6 +5292,7 @@ static const struct mtk_soc_data rt5350_ +@@ -5262,6 +5296,7 @@ static const struct mtk_soc_data rt5350_ .desc_size = sizeof(struct mtk_tx_dma), .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, @@ -315,7 +315,7 @@ Signed-off-by: David S. Miller }, .rx = { .desc_size = sizeof(struct mtk_rx_dma), -@@ -5265,6 +5300,7 @@ static const struct mtk_soc_data rt5350_ +@@ -5269,6 +5304,7 @@ static const struct mtk_soc_data rt5350_ .dma_l4_valid = RX_DMA_L4_VALID_PDMA, .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, diff --git a/target/linux/generic/backport-6.6/752-26-v6.10-net-ethernet-mtk_eth_soc-ppe-add-support-for-multipl.patch b/target/linux/generic/backport-6.6/752-26-v6.10-net-ethernet-mtk_eth_soc-ppe-add-support-for-multipl.patch index ae75eb5c3e89f0..87c1cec363b1b1 100644 --- a/target/linux/generic/backport-6.6/752-26-v6.10-net-ethernet-mtk_eth_soc-ppe-add-support-for-multipl.patch +++ b/target/linux/generic/backport-6.6/752-26-v6.10-net-ethernet-mtk_eth_soc-ppe-add-support-for-multipl.patch @@ -85,7 +85,7 @@ Signed-off-by: Jakub Kicinski skb_record_rx_queue(skb, 0); napi_gro_receive(napi, skb); -@@ -3276,37 +3287,27 @@ static int mtk_start_dma(struct mtk_eth +@@ -3280,37 +3291,27 @@ static int mtk_start_dma(struct mtk_eth return 0; } @@ -134,7 +134,7 @@ Signed-off-by: Jakub Kicinski } -@@ -3366,7 +3367,10 @@ static int mtk_open(struct net_device *d +@@ -3370,7 +3371,10 @@ static int mtk_open(struct net_device *d { struct mtk_mac *mac = netdev_priv(dev); struct mtk_eth *eth = mac->hw; @@ -146,7 +146,7 @@ Signed-off-by: Jakub Kicinski err = phylink_of_phy_connect(mac->phylink, mac->of_node, 0); if (err) { -@@ -3390,18 +3394,38 @@ static int mtk_open(struct net_device *d +@@ -3394,18 +3398,38 @@ static int mtk_open(struct net_device *d for (i = 0; i < ARRAY_SIZE(eth->ppe); i++) mtk_ppe_start(eth->ppe[i]); @@ -190,7 +190,7 @@ Signed-off-by: Jakub Kicinski phylink_start(mac->phylink); netif_tx_start_all_queues(dev); -@@ -3478,7 +3502,8 @@ static int mtk_stop(struct net_device *d +@@ -3482,7 +3506,8 @@ static int mtk_stop(struct net_device *d if (!refcount_dec_and_test(ð->dma_refcnt)) return 0; @@ -200,7 +200,7 @@ Signed-off-by: Jakub Kicinski mtk_tx_irq_disable(eth, MTK_TX_DONE_INT); mtk_rx_irq_disable(eth, eth->soc->rx.irq_done_mask); -@@ -4973,23 +4998,24 @@ static int mtk_probe(struct platform_dev +@@ -4977,23 +5002,24 @@ static int mtk_probe(struct platform_dev } if (eth->soc->offload_version) { @@ -233,7 +233,7 @@ Signed-off-by: Jakub Kicinski } for (i = 0; i < MTK_MAX_DEVS; i++) { -@@ -5092,6 +5118,7 @@ static const struct mtk_soc_data mt7621_ +@@ -5096,6 +5122,7 @@ static const struct mtk_soc_data mt7621_ .required_pctl = false, .version = 1, .offload_version = 1, @@ -241,7 +241,7 @@ Signed-off-by: Jakub Kicinski .hash_offset = 2, .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, .tx = { -@@ -5120,6 +5147,7 @@ static const struct mtk_soc_data mt7622_ +@@ -5124,6 +5151,7 @@ static const struct mtk_soc_data mt7622_ .required_pctl = false, .version = 1, .offload_version = 2, @@ -249,7 +249,7 @@ Signed-off-by: Jakub Kicinski .hash_offset = 2, .has_accounting = true, .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, -@@ -5148,6 +5176,7 @@ static const struct mtk_soc_data mt7623_ +@@ -5152,6 +5180,7 @@ static const struct mtk_soc_data mt7623_ .required_pctl = true, .version = 1, .offload_version = 1, @@ -257,7 +257,7 @@ Signed-off-by: Jakub Kicinski .hash_offset = 2, .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, .disable_pll_modes = true, -@@ -5203,6 +5232,7 @@ static const struct mtk_soc_data mt7981_ +@@ -5207,6 +5236,7 @@ static const struct mtk_soc_data mt7981_ .required_pctl = false, .version = 2, .offload_version = 2, @@ -265,7 +265,7 @@ Signed-off-by: Jakub Kicinski .hash_offset = 4, .has_accounting = true, .foe_entry_size = MTK_FOE_ENTRY_V2_SIZE, -@@ -5232,6 +5262,7 @@ static const struct mtk_soc_data mt7986_ +@@ -5236,6 +5266,7 @@ static const struct mtk_soc_data mt7986_ .required_pctl = false, .version = 2, .offload_version = 2, @@ -273,7 +273,7 @@ Signed-off-by: Jakub Kicinski .hash_offset = 4, .has_accounting = true, .foe_entry_size = MTK_FOE_ENTRY_V2_SIZE, -@@ -5261,6 +5292,7 @@ static const struct mtk_soc_data mt7988_ +@@ -5265,6 +5296,7 @@ static const struct mtk_soc_data mt7988_ .required_pctl = false, .version = 3, .offload_version = 2, diff --git a/target/linux/generic/backport-6.6/752-28-v6.10-net-ethernet-mediatek-Allow-gaps-in-MAC-allocation.patch b/target/linux/generic/backport-6.6/752-28-v6.10-net-ethernet-mediatek-Allow-gaps-in-MAC-allocation.patch index b62586b992f6c9..77061eb3554fee 100644 --- a/target/linux/generic/backport-6.6/752-28-v6.10-net-ethernet-mediatek-Allow-gaps-in-MAC-allocation.patch +++ b/target/linux/generic/backport-6.6/752-28-v6.10-net-ethernet-mediatek-Allow-gaps-in-MAC-allocation.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 -@@ -3396,7 +3396,7 @@ static int mtk_open(struct net_device *d +@@ -3400,7 +3400,7 @@ static int mtk_open(struct net_device *d for (i = 0; i < MTK_MAX_DEVS; i++) { if (!eth->netdev[i]) diff --git a/target/linux/generic/backport-6.6/752-30-v6.10-net-ethernet-mtk_eth_soc-implement-.-get-set-_pausep.patch b/target/linux/generic/backport-6.6/752-30-v6.10-net-ethernet-mtk_eth_soc-implement-.-get-set-_pausep.patch index 970812c6b201ea..272ceb3b45e7e7 100644 --- a/target/linux/generic/backport-6.6/752-30-v6.10-net-ethernet-mtk_eth_soc-implement-.-get-set-_pausep.patch +++ b/target/linux/generic/backport-6.6/752-30-v6.10-net-ethernet-mtk_eth_soc-implement-.-get-set-_pausep.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 -@@ -4478,6 +4478,20 @@ static int mtk_set_rxnfc(struct net_devi +@@ -4482,6 +4482,20 @@ static int mtk_set_rxnfc(struct net_devi return ret; } @@ -41,7 +41,7 @@ Signed-off-by: Jakub Kicinski static u16 mtk_select_queue(struct net_device *dev, struct sk_buff *skb, struct net_device *sb_dev) { -@@ -4506,8 +4520,10 @@ static const struct ethtool_ops mtk_etht +@@ -4510,8 +4524,10 @@ static const struct ethtool_ops mtk_etht .get_strings = mtk_get_strings, .get_sset_count = mtk_get_sset_count, .get_ethtool_stats = mtk_get_ethtool_stats, diff --git a/target/linux/generic/hack-6.6/204-module_strip.patch b/target/linux/generic/hack-6.6/204-module_strip.patch index 24ec94f5156460..ccadee1e5a671e 100644 --- a/target/linux/generic/hack-6.6/204-module_strip.patch +++ b/target/linux/generic/hack-6.6/204-module_strip.patch @@ -14,7 +14,7 @@ Signed-off-by: Felix Fietkau --- a/include/linux/module.h +++ b/include/linux/module.h -@@ -164,6 +164,7 @@ extern void cleanup_module(void); +@@ -166,6 +166,7 @@ struct module_kobject *lookup_or_create_ /* Generic info of form tag = "info" */ #define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info) @@ -22,7 +22,7 @@ Signed-off-by: Felix Fietkau /* For userspace: you can also call me... */ #define MODULE_ALIAS(_alias) MODULE_INFO(alias, _alias) -@@ -233,12 +234,12 @@ extern void cleanup_module(void); +@@ -235,12 +236,12 @@ struct module_kobject *lookup_or_create_ * Author(s), use "Name " or just "Name", for multiple * authors use multiple MODULE_AUTHOR() statements/lines. */ @@ -38,7 +38,7 @@ Signed-off-by: Felix Fietkau /* Creates an alias so file2alias.c can find device table. */ #define MODULE_DEVICE_TABLE(type, name) \ extern typeof(name) __mod_##type##__##name##_device_table \ -@@ -265,7 +266,9 @@ extern typeof(name) __mod_##type##__##na +@@ -267,7 +268,9 @@ extern typeof(name) __mod_##type##__##na */ #if defined(MODULE) || !defined(CONFIG_SYSFS) @@ -49,7 +49,7 @@ Signed-off-by: Felix Fietkau #else #define MODULE_VERSION(_version) \ MODULE_INFO(version, _version); \ -@@ -288,7 +291,7 @@ extern typeof(name) __mod_##type##__##na +@@ -290,7 +293,7 @@ extern typeof(name) __mod_##type##__##na /* Optional firmware file (or files) needed by the module * format is simply firmware file name. Multiple firmware * files require multiple MODULE_FIRMWARE() specifiers */ diff --git a/target/linux/generic/hack-6.6/721-net-add-packet-mangeling.patch b/target/linux/generic/hack-6.6/721-net-add-packet-mangeling.patch index 0935a0b9c0aea6..8b784836a003da 100644 --- a/target/linux/generic/hack-6.6/721-net-add-packet-mangeling.patch +++ b/target/linux/generic/hack-6.6/721-net-add-packet-mangeling.patch @@ -60,7 +60,7 @@ Signed-off-by: Felix Fietkau */ --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h -@@ -3095,6 +3095,10 @@ static inline int pskb_trim(struct sk_bu +@@ -3098,6 +3098,10 @@ static inline int pskb_trim(struct sk_bu return (len < skb->len) ? __pskb_trim(skb, len) : 0; } @@ -71,7 +71,7 @@ Signed-off-by: Felix Fietkau /** * pskb_trim_unique - remove end from a paged unique (not cloned) buffer * @skb: buffer to alter -@@ -3260,16 +3264,6 @@ static inline struct sk_buff *dev_alloc_ +@@ -3263,16 +3267,6 @@ static inline struct sk_buff *dev_alloc_ } diff --git a/target/linux/generic/hack-6.6/781-usb-net-rndis-support-asr.patch b/target/linux/generic/hack-6.6/781-usb-net-rndis-support-asr.patch index d5cc7e0a7ef3ef..47339b6c22f7b2 100644 --- a/target/linux/generic/hack-6.6/781-usb-net-rndis-support-asr.patch +++ b/target/linux/generic/hack-6.6/781-usb-net-rndis-support-asr.patch @@ -13,7 +13,7 @@ Signed-off-by: Daniel Golle --- a/drivers/net/usb/rndis_host.c +++ b/drivers/net/usb/rndis_host.c -@@ -640,6 +640,16 @@ static const struct driver_info wwan_rnd +@@ -630,6 +630,16 @@ static const struct driver_info zte_rndi .tx_fixup = rndis_tx_fixup, }; @@ -30,7 +30,7 @@ Signed-off-by: Daniel Golle /*-------------------------------------------------------------------------*/ static const struct usb_device_id products [] = { -@@ -676,6 +686,36 @@ static const struct usb_device_id produc +@@ -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, }, { @@ -64,6 +64,6 @@ Signed-off-by: Daniel Golle + USB_CLASS_WIRELESS_CONTROLLER, 1, 3), + .driver_info = (unsigned long) &asr_rndis_info, +}, { - /* Mobile Broadband Modem, seen in Novatel Verizon USB730L and - * Telit FN990A (RNDIS) - */ + /* Novatel Verizon USB730L */ + USB_INTERFACE_INFO(USB_CLASS_MISC, 4, 1), + .driver_info = (unsigned long) &rndis_info, diff --git a/target/linux/generic/pending-6.6/655-increase_skb_pad.patch b/target/linux/generic/pending-6.6/655-increase_skb_pad.patch index ce7db566e5ac0f..4f3bb060519a71 100644 --- a/target/linux/generic/pending-6.6/655-increase_skb_pad.patch +++ b/target/linux/generic/pending-6.6/655-increase_skb_pad.patch @@ -9,7 +9,7 @@ Signed-off-by: Felix Fietkau --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h -@@ -3062,7 +3062,7 @@ static inline int pskb_network_may_pull( +@@ -3065,7 +3065,7 @@ static inline int pskb_network_may_pull( * NET_IP_ALIGN(2) + ethernet_header(14) + IP_header(20/40) + ports(8) */ #ifndef NET_SKB_PAD diff --git a/target/linux/generic/pending-6.6/691-net-ipv6-fix-UDPv6-GSO-segmentation-with-NAT.patch b/target/linux/generic/pending-6.6/691-net-ipv6-fix-UDPv6-GSO-segmentation-with-NAT.patch deleted file mode 100644 index 6bbe2ca880e839..00000000000000 --- a/target/linux/generic/pending-6.6/691-net-ipv6-fix-UDPv6-GSO-segmentation-with-NAT.patch +++ /dev/null @@ -1,88 +0,0 @@ -From: Felix Fietkau -Date: Sat, 26 Apr 2025 17:18:03 +0200 -Subject: [PATCH] net: ipv6: fix UDPv6 GSO segmentation with NAT - -If any address or port is changed, update it in all packets and recalculate -checksum. - -Fixes: 9fd1ff5d2ac7 ("udp: Support UDP fraglist GRO/GSO.") -Signed-off-by: Felix Fietkau ---- - ---- a/net/ipv4/udp_offload.c -+++ b/net/ipv4/udp_offload.c -@@ -247,6 +247,62 @@ static struct sk_buff *__udpv4_gso_segme - return segs; - } - -+static void __udpv6_gso_segment_csum(struct sk_buff *seg, -+ struct in6_addr *oldip, -+ const struct in6_addr *newip, -+ __be16 *oldport, __be16 newport) -+{ -+ struct udphdr *uh = udp_hdr(seg); -+ -+ if (ipv6_addr_equal(oldip, newip) && *oldport == newport) -+ return; -+ -+ if (uh->check) { -+ inet_proto_csum_replace16(&uh->check, seg, oldip->s6_addr32, -+ newip->s6_addr32, true); -+ -+ inet_proto_csum_replace2(&uh->check, seg, *oldport, newport, -+ false); -+ if (!uh->check) -+ uh->check = CSUM_MANGLED_0; -+ } -+ -+ *oldip = *newip; -+ *oldport = newport; -+} -+ -+static struct sk_buff *__udpv6_gso_segment_list_csum(struct sk_buff *segs) -+{ -+ const struct ipv6hdr *iph; -+ const struct udphdr *uh; -+ struct ipv6hdr *iph2; -+ struct sk_buff *seg; -+ struct udphdr *uh2; -+ -+ seg = segs; -+ uh = udp_hdr(seg); -+ iph = ipv6_hdr(seg); -+ uh2 = udp_hdr(seg->next); -+ iph2 = ipv6_hdr(seg->next); -+ -+ if (!(*(const u32 *)&uh->source ^ *(const u32 *)&uh2->source) && -+ ipv6_addr_equal(&iph->saddr, &iph2->saddr) && -+ ipv6_addr_equal(&iph->daddr, &iph2->daddr)) -+ return segs; -+ -+ while ((seg = seg->next)) { -+ uh2 = udp_hdr(seg); -+ iph2 = ipv6_hdr(seg); -+ -+ __udpv6_gso_segment_csum(seg, &iph2->saddr, &iph->saddr, -+ &uh2->source, uh->source); -+ __udpv6_gso_segment_csum(seg, &iph2->daddr, &iph->daddr, -+ &uh2->dest, uh->dest); -+ } -+ -+ return segs; -+} -+ - static struct sk_buff *__udp_gso_segment_list(struct sk_buff *skb, - netdev_features_t features, - bool is_ipv6) -@@ -259,7 +315,10 @@ static struct sk_buff *__udp_gso_segment - - udp_hdr(skb)->len = htons(sizeof(struct udphdr) + mss); - -- return is_ipv6 ? skb : __udpv4_gso_segment_list_csum(skb); -+ if (is_ipv6) -+ return __udpv6_gso_segment_list_csum(skb); -+ else -+ return __udpv4_gso_segment_list_csum(skb); - } - - struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb, diff --git a/target/linux/generic/pending-6.6/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch b/target/linux/generic/pending-6.6/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch index 3136238801c0e0..05f64f7587b869 100644 --- a/target/linux/generic/pending-6.6/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch +++ b/target/linux/generic/pending-6.6/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 -@@ -5052,6 +5052,8 @@ static int mtk_probe(struct platform_dev +@@ -5125,6 +5125,8 @@ static int mtk_probe(struct platform_dev * for NAPI to work */ init_dummy_netdev(ð->dummy_dev); diff --git a/target/linux/generic/pending-6.6/730-net-ethernet-mtk_eth_soc-reset-all-TX-queues-on-DMA-.patch b/target/linux/generic/pending-6.6/730-net-ethernet-mtk_eth_soc-reset-all-TX-queues-on-DMA-.patch index 67d0ab45373c7b..8d8e3d83ba1939 100644 --- a/target/linux/generic/pending-6.6/730-net-ethernet-mtk_eth_soc-reset-all-TX-queues-on-DMA-.patch +++ b/target/linux/generic/pending-6.6/730-net-ethernet-mtk_eth_soc-reset-all-TX-queues-on-DMA-.patch @@ -23,7 +23,7 @@ Signed-off-by: Daniel Golle --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3135,11 +3135,19 @@ static int mtk_dma_init(struct mtk_eth * +@@ -3149,11 +3149,19 @@ static int mtk_dma_init(struct mtk_eth * static void mtk_dma_free(struct mtk_eth *eth) { const struct mtk_soc_data *soc = eth->soc; diff --git a/target/linux/generic/pending-6.6/734-net-ethernet-mediatek-enlarge-DMA-reserve-buffer.patch b/target/linux/generic/pending-6.6/734-net-ethernet-mediatek-enlarge-DMA-reserve-buffer.patch index dd9783bfcb93a5..7274c4a817d643 100644 --- a/target/linux/generic/pending-6.6/734-net-ethernet-mediatek-enlarge-DMA-reserve-buffer.patch +++ b/target/linux/generic/pending-6.6/734-net-ethernet-mediatek-enlarge-DMA-reserve-buffer.patch @@ -25,7 +25,7 @@ Signed-off-by: Chad Monroe /* QDMA Flow Control Register */ --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3309,12 +3309,14 @@ static int mtk_start_dma(struct mtk_eth +@@ -3323,12 +3323,14 @@ static int mtk_start_dma(struct mtk_eth MTK_TX_BT_32DWORDS | MTK_NDP_CO_PRO | MTK_RX_2B_OFFSET | MTK_TX_WB_DDONE; diff --git a/target/linux/generic/pending-6.6/737-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch b/target/linux/generic/pending-6.6/737-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch index cdfb1b82704ab8..fc1a388387f19f 100644 --- a/target/linux/generic/pending-6.6/737-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch +++ b/target/linux/generic/pending-6.6/737-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch @@ -490,7 +490,7 @@ Signed-off-by: Daniel Golle .mac_finish = mtk_mac_finish, .mac_link_down = mtk_mac_link_down, .mac_link_up = mtk_mac_link_up, -@@ -3417,6 +3558,9 @@ static int mtk_open(struct net_device *d +@@ -3431,6 +3572,9 @@ static int mtk_open(struct net_device *d ppe_num = eth->soc->ppe_num; @@ -500,7 +500,7 @@ Signed-off-by: Daniel Golle err = phylink_of_phy_connect(mac->phylink, mac->of_node, 0); if (err) { netdev_err(dev, "%s: could not attach PHY: %d\n", __func__, -@@ -3567,6 +3711,9 @@ static int mtk_stop(struct net_device *d +@@ -3581,6 +3725,9 @@ static int mtk_stop(struct net_device *d for (i = 0; i < ARRAY_SIZE(eth->ppe); i++) mtk_ppe_stop(eth->ppe[i]); @@ -510,7 +510,7 @@ Signed-off-by: Daniel Golle return 0; } -@@ -4596,6 +4743,7 @@ static const struct net_device_ops mtk_n +@@ -4667,6 +4814,7 @@ static const struct net_device_ops mtk_n static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) { const __be32 *_id = of_get_property(np, "reg", NULL); @@ -518,7 +518,7 @@ Signed-off-by: Daniel Golle phy_interface_t phy_mode; struct phylink *phylink; struct mtk_mac *mac; -@@ -4632,16 +4780,41 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4705,16 +4853,41 @@ static int mtk_add_mac(struct mtk_eth *e mac->id = id; mac->hw = eth; mac->of_node = np; @@ -568,7 +568,7 @@ Signed-off-by: Daniel Golle } memset(mac->hwlro_ip, 0, sizeof(mac->hwlro_ip)); -@@ -4724,8 +4897,21 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4797,8 +4970,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); @@ -590,7 +590,7 @@ Signed-off-by: Daniel Golle phylink = phylink_create(&mac->phylink_config, of_fwnode_handle(mac->of_node), phy_mode, &mtk_phylink_ops); -@@ -4776,6 +4962,26 @@ free_netdev: +@@ -4849,6 +5035,26 @@ free_netdev: return err; } @@ -617,7 +617,7 @@ Signed-off-by: Daniel Golle void mtk_eth_set_dma_device(struct mtk_eth *eth, struct device *dma_dev) { struct net_device *dev, *tmp; -@@ -4922,7 +5128,8 @@ static int mtk_probe(struct platform_dev +@@ -4995,7 +5201,8 @@ static int mtk_probe(struct platform_dev regmap_write(cci, 0, 3); } @@ -627,7 +627,7 @@ Signed-off-by: Daniel Golle err = mtk_sgmii_init(eth); if (err) -@@ -5033,6 +5240,24 @@ static int mtk_probe(struct platform_dev +@@ -5106,6 +5313,24 @@ static int mtk_probe(struct platform_dev } } @@ -652,7 +652,7 @@ Signed-off-by: Daniel Golle if (MTK_HAS_CAPS(eth->soc->caps, MTK_SHARED_INT)) { err = devm_request_irq(eth->dev, eth->irq[0], mtk_handle_irq, 0, -@@ -5136,6 +5361,11 @@ static int mtk_remove(struct platform_de +@@ -5209,6 +5434,11 @@ static int mtk_remove(struct platform_de mtk_stop(eth->netdev[i]); mac = netdev_priv(eth->netdev[i]); phylink_disconnect_phy(mac->phylink); diff --git a/target/linux/generic/pending-6.6/738-01-net-ethernet-mtk_eth_soc-reduce-rx-ring-size-for-older.patch b/target/linux/generic/pending-6.6/738-01-net-ethernet-mtk_eth_soc-reduce-rx-ring-size-for-older.patch index 7cfd323854ecba..f8b3bb84595f04 100644 --- a/target/linux/generic/pending-6.6/738-01-net-ethernet-mtk_eth_soc-reduce-rx-ring-size-for-older.patch +++ b/target/linux/generic/pending-6.6/738-01-net-ethernet-mtk_eth_soc-reduce-rx-ring-size-for-older.patch @@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -5397,7 +5397,7 @@ static const struct mtk_soc_data mt2701_ +@@ -5470,7 +5470,7 @@ static const struct mtk_soc_data mt2701_ .desc_size = sizeof(struct mtk_rx_dma), .irq_done_mask = MTK_RX_DONE_INT, .dma_l4_valid = RX_DMA_L4_VALID, @@ -39,7 +39,7 @@ Signed-off-by: Felix Fietkau .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5425,7 +5425,7 @@ static const struct mtk_soc_data mt7621_ +@@ -5498,7 +5498,7 @@ static const struct mtk_soc_data mt7621_ .desc_size = sizeof(struct mtk_rx_dma), .irq_done_mask = MTK_RX_DONE_INT, .dma_l4_valid = RX_DMA_L4_VALID, @@ -48,7 +48,7 @@ Signed-off-by: Felix Fietkau .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5455,7 +5455,7 @@ static const struct mtk_soc_data mt7622_ +@@ -5528,7 +5528,7 @@ static const struct mtk_soc_data mt7622_ .desc_size = sizeof(struct mtk_rx_dma), .irq_done_mask = MTK_RX_DONE_INT, .dma_l4_valid = RX_DMA_L4_VALID, @@ -57,7 +57,7 @@ Signed-off-by: Felix Fietkau .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5484,7 +5484,7 @@ static const struct mtk_soc_data mt7623_ +@@ -5557,7 +5557,7 @@ static const struct mtk_soc_data mt7623_ .desc_size = sizeof(struct mtk_rx_dma), .irq_done_mask = MTK_RX_DONE_INT, .dma_l4_valid = RX_DMA_L4_VALID, @@ -66,7 +66,7 @@ Signed-off-by: Felix Fietkau .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5510,7 +5510,7 @@ static const struct mtk_soc_data mt7629_ +@@ -5583,7 +5583,7 @@ static const struct mtk_soc_data mt7629_ .desc_size = sizeof(struct mtk_rx_dma), .irq_done_mask = MTK_RX_DONE_INT, .dma_l4_valid = RX_DMA_L4_VALID, @@ -75,7 +75,7 @@ Signed-off-by: Felix Fietkau .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5542,7 +5542,7 @@ static const struct mtk_soc_data mt7981_ +@@ -5615,7 +5615,7 @@ static const struct mtk_soc_data mt7981_ .dma_l4_valid = RX_DMA_L4_VALID_V2, .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, @@ -84,7 +84,7 @@ Signed-off-by: Felix Fietkau }, }; -@@ -5572,7 +5572,7 @@ static const struct mtk_soc_data mt7986_ +@@ -5645,7 +5645,7 @@ static const struct mtk_soc_data mt7986_ .dma_l4_valid = RX_DMA_L4_VALID_V2, .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, @@ -93,7 +93,7 @@ Signed-off-by: Felix Fietkau }, }; -@@ -5625,7 +5625,7 @@ static const struct mtk_soc_data rt5350_ +@@ -5698,7 +5698,7 @@ static const struct mtk_soc_data rt5350_ .dma_l4_valid = RX_DMA_L4_VALID_PDMA, .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, diff --git a/target/linux/generic/pending-6.6/738-02-net-ethernet-mtk_eth_soc-do-not-enable-page-pool-sta.patch b/target/linux/generic/pending-6.6/738-02-net-ethernet-mtk_eth_soc-do-not-enable-page-pool-sta.patch index bd141d103237c0..349af33524e6c6 100644 --- a/target/linux/generic/pending-6.6/738-02-net-ethernet-mtk_eth_soc-do-not-enable-page-pool-sta.patch +++ b/target/linux/generic/pending-6.6/738-02-net-ethernet-mtk_eth_soc-do-not-enable-page-pool-sta.patch @@ -25,7 +25,7 @@ Signed-off-by: Felix Fietkau help --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4568,6 +4568,7 @@ static int mtk_get_sset_count(struct net +@@ -4582,6 +4582,7 @@ static int mtk_get_sset_count(struct net static void mtk_ethtool_pp_stats(struct mtk_eth *eth, u64 *data) { @@ -33,7 +33,7 @@ Signed-off-by: Felix Fietkau struct page_pool_stats stats = {}; int i; -@@ -4580,6 +4581,7 @@ static void mtk_ethtool_pp_stats(struct +@@ -4594,6 +4595,7 @@ static void mtk_ethtool_pp_stats(struct page_pool_get_stats(ring->page_pool, &stats); } page_pool_ethtool_stats_get(data, &stats); diff --git a/target/linux/imx/patches-6.6/600-PCI-imx6-Start-link-at-max-gen-first-for-IMX8MM-and-IMX8MP.patch b/target/linux/imx/patches-6.6/600-PCI-imx6-Start-link-at-max-gen-first-for-IMX8MM-and-IMX8MP.patch index 95069c2c438640..d8818369bcd431 100644 --- a/target/linux/imx/patches-6.6/600-PCI-imx6-Start-link-at-max-gen-first-for-IMX8MM-and-IMX8MP.patch +++ b/target/linux/imx/patches-6.6/600-PCI-imx6-Start-link-at-max-gen-first-for-IMX8MM-and-IMX8MP.patch @@ -100,7 +100,7 @@ Signed-off-by: Tim Harvey return 0; err_reset_phy: -@@ -1456,14 +1455,16 @@ static const struct imx6_pcie_drvdata dr +@@ -1457,14 +1456,16 @@ static const struct imx6_pcie_drvdata dr }, [IMX8MM] = { .variant = IMX8MM, diff --git a/target/linux/ipq40xx/patches-6.6/701-net-dsa-add-out-of-band-tagging-protocol.patch b/target/linux/ipq40xx/patches-6.6/701-net-dsa-add-out-of-band-tagging-protocol.patch index 469f669bd47915..d49b18242af941 100644 --- a/target/linux/ipq40xx/patches-6.6/701-net-dsa-add-out-of-band-tagging-protocol.patch +++ b/target/linux/ipq40xx/patches-6.6/701-net-dsa-add-out-of-band-tagging-protocol.patch @@ -93,7 +93,7 @@ Signed-off-by: Maxime Chevallier +#endif --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h -@@ -4657,6 +4657,9 @@ enum skb_ext_id { +@@ -4683,6 +4683,9 @@ enum skb_ext_id { #if IS_ENABLED(CONFIG_MCTP_FLOWS) SKB_EXT_MCTP, #endif diff --git a/target/linux/mpc85xx/patches-6.6/010-powerpc-add-compressed-zImage-for-mpc85xx.patch b/target/linux/mpc85xx/patches-6.6/010-powerpc-add-compressed-zImage-for-mpc85xx.patch index eeb501dfebc170..c2b46afd1c4f84 100644 --- a/target/linux/mpc85xx/patches-6.6/010-powerpc-add-compressed-zImage-for-mpc85xx.patch +++ b/target/linux/mpc85xx/patches-6.6/010-powerpc-add-compressed-zImage-for-mpc85xx.patch @@ -34,7 +34,7 @@ Signed-off-by: David Bauer cuImage.mpc8572ds --- a/arch/powerpc/boot/wrapper +++ b/arch/powerpc/boot/wrapper -@@ -258,6 +258,11 @@ if [ -n "$esm_blob" -a "$platform" != "p +@@ -256,6 +256,11 @@ if [ -n "$esm_blob" -a "$platform" != "p fi case "$platform" in diff --git a/target/linux/mpc85xx/patches-6.6/100-powerpc-85xx-tl-wdr4900-v1-support.patch b/target/linux/mpc85xx/patches-6.6/100-powerpc-85xx-tl-wdr4900-v1-support.patch index 2f8d4d4e3d57a9..e16b97b730b889 100644 --- a/target/linux/mpc85xx/patches-6.6/100-powerpc-85xx-tl-wdr4900-v1-support.patch +++ b/target/linux/mpc85xx/patches-6.6/100-powerpc-85xx-tl-wdr4900-v1-support.patch @@ -38,7 +38,7 @@ Signed-off-by: Pawel Dembicki --- a/arch/powerpc/boot/wrapper +++ b/arch/powerpc/boot/wrapper -@@ -350,6 +350,11 @@ adder875-redboot) +@@ -348,6 +348,11 @@ adder875-redboot) platformo="$object/fixed-head.o $object/redboot-8xx.o" binary=y ;; diff --git a/target/linux/mpc85xx/patches-6.6/101-powerpc-85xx-hiveap-330-support.patch b/target/linux/mpc85xx/patches-6.6/101-powerpc-85xx-hiveap-330-support.patch index 85de47bfb5760b..2a46aee63eeb64 100644 --- a/target/linux/mpc85xx/patches-6.6/101-powerpc-85xx-hiveap-330-support.patch +++ b/target/linux/mpc85xx/patches-6.6/101-powerpc-85xx-hiveap-330-support.patch @@ -48,7 +48,7 @@ image-$(CONFIG_MVME7100) += dtbImage.mvme7100 --- a/arch/powerpc/boot/wrapper +++ b/arch/powerpc/boot/wrapper -@@ -350,6 +350,7 @@ adder875-redboot) +@@ -348,6 +348,7 @@ adder875-redboot) platformo="$object/fixed-head.o $object/redboot-8xx.o" binary=y ;; diff --git a/target/linux/mpc85xx/patches-6.6/106-powerpc-85xx-ws-ap3710i-support.patch b/target/linux/mpc85xx/patches-6.6/106-powerpc-85xx-ws-ap3710i-support.patch index 983772131c31cc..9e8ed55875a683 100644 --- a/target/linux/mpc85xx/patches-6.6/106-powerpc-85xx-ws-ap3710i-support.patch +++ b/target/linux/mpc85xx/patches-6.6/106-powerpc-85xx-ws-ap3710i-support.patch @@ -48,7 +48,7 @@ --- a/arch/powerpc/boot/wrapper +++ b/arch/powerpc/boot/wrapper -@@ -351,7 +351,8 @@ adder875-redboot) +@@ -349,7 +349,8 @@ adder875-redboot) binary=y ;; simpleboot-hiveap-330|\ diff --git a/target/linux/mpc85xx/patches-6.6/107-powerpc-85xx-add-ws-ap3825i-support.patch b/target/linux/mpc85xx/patches-6.6/107-powerpc-85xx-add-ws-ap3825i-support.patch index 29e3b221335530..c50012d975846c 100644 --- a/target/linux/mpc85xx/patches-6.6/107-powerpc-85xx-add-ws-ap3825i-support.patch +++ b/target/linux/mpc85xx/patches-6.6/107-powerpc-85xx-add-ws-ap3825i-support.patch @@ -55,7 +55,7 @@ WS-AP3825i AP. --- a/arch/powerpc/boot/wrapper +++ b/arch/powerpc/boot/wrapper -@@ -352,7 +352,8 @@ adder875-redboot) +@@ -350,7 +350,8 @@ adder875-redboot) ;; simpleboot-hiveap-330|\ simpleboot-tl-wdr4900-v1|\ diff --git a/target/linux/mpc85xx/patches-6.6/110-powerpc-85xx-br200-wp-support.patch b/target/linux/mpc85xx/patches-6.6/110-powerpc-85xx-br200-wp-support.patch index 28a2bed017f07f..d967191e66bcf6 100644 --- a/target/linux/mpc85xx/patches-6.6/110-powerpc-85xx-br200-wp-support.patch +++ b/target/linux/mpc85xx/patches-6.6/110-powerpc-85xx-br200-wp-support.patch @@ -47,7 +47,7 @@ image-$(CONFIG_WS_AP3710I) += simpleImage.ws-ap3710i --- a/arch/powerpc/boot/wrapper +++ b/arch/powerpc/boot/wrapper -@@ -350,6 +350,7 @@ adder875-redboot) +@@ -348,6 +348,7 @@ adder875-redboot) platformo="$object/fixed-head.o $object/redboot-8xx.o" binary=y ;; diff --git a/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch b/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch index 2da2b322b0090d..052972af30da03 100644 --- a/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch +++ b/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch @@ -50,7 +50,7 @@ Signed-off-by: minda.chen #include "xhci.h" #include "xhci-trace.h" -@@ -1842,6 +1843,7 @@ xhci_free_interrupter(struct xhci_hcd *x +@@ -1878,6 +1879,7 @@ EXPORT_SYMBOL_GPL(xhci_remove_secondary_ void xhci_mem_cleanup(struct xhci_hcd *xhci) { struct device *dev = xhci_to_hcd(xhci)->self.sysdev; @@ -58,7 +58,7 @@ Signed-off-by: minda.chen int i, j, num_ports; cancel_delayed_work_sync(&xhci->cmd_timer); -@@ -1887,6 +1889,13 @@ void xhci_mem_cleanup(struct xhci_hcd *x +@@ -1928,6 +1930,13 @@ void xhci_mem_cleanup(struct xhci_hcd *x xhci_dbg_trace(xhci, trace_xhci_dbg_init, "Freed medium stream array pool"); @@ -72,9 +72,9 @@ Signed-off-by: minda.chen if (xhci->dcbaa) dma_free_coherent(dev, sizeof(*xhci->dcbaa), xhci->dcbaa, xhci->dcbaa->dma); -@@ -2300,6 +2309,55 @@ xhci_add_interrupter(struct xhci_hcd *xh - return 0; +@@ -2399,6 +2408,55 @@ xhci_create_secondary_interrupter(struct } + EXPORT_SYMBOL_GPL(xhci_create_secondary_interrupter); +int xhci_setup_local_lowmem(struct xhci_hcd *xhci, size_t size) +{ @@ -127,8 +127,8 @@ Signed-off-by: minda.chen + int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) { - dma_addr_t dma; -@@ -2437,6 +2495,12 @@ int xhci_mem_init(struct xhci_hcd *xhci, + struct xhci_interrupter *ir; +@@ -2540,6 +2598,12 @@ int xhci_mem_init(struct xhci_hcd *xhci, xhci->isoc_bei_interval = AVOID_BEI_INTERVAL_MAX; @@ -181,7 +181,7 @@ Signed-off-by: minda.chen #include "xhci.h" #include "xhci-trace.h" -@@ -1286,6 +1288,55 @@ static void xhci_unmap_temp_buf(struct u +@@ -1312,6 +1314,55 @@ static void xhci_unmap_temp_buf(struct u urb->transfer_buffer = NULL; } @@ -237,7 +237,7 @@ Signed-off-by: minda.chen /* * Bypass the DMA mapping if URB is suitable for Immediate Transfer (IDT), * we'll copy the actual data into the TRB address register. This is limited to -@@ -1306,9 +1357,11 @@ static int xhci_map_urb_for_dma(struct u +@@ -1332,9 +1383,11 @@ static int xhci_map_urb_for_dma(struct u if (xhci_urb_temp_buffer_required(hcd, urb)) return xhci_map_temp_buffer(hcd, urb); } @@ -249,7 +249,7 @@ Signed-off-by: minda.chen static void xhci_unmap_urb_for_dma(struct usb_hcd *hcd, struct urb *urb) { struct xhci_hcd *xhci; -@@ -1321,8 +1374,10 @@ static void xhci_unmap_urb_for_dma(struc +@@ -1347,8 +1400,10 @@ static void xhci_unmap_urb_for_dma(struc if ((xhci->quirks & XHCI_SG_TRB_CACHE_SIZE_QUIRK) && unmap_temp_buf) xhci_unmap_temp_buf(hcd, urb); @@ -263,7 +263,7 @@ Signed-off-by: minda.chen /** --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1509,6 +1509,13 @@ struct xhci_hub { +@@ -1506,6 +1506,13 @@ struct xhci_hub { u8 min_rev; }; @@ -277,7 +277,7 @@ Signed-off-by: minda.chen /* There is one xhci_hcd structure per controller */ struct xhci_hcd { struct usb_hcd *main_hcd; -@@ -1663,6 +1670,8 @@ struct xhci_hcd { +@@ -1660,6 +1667,8 @@ struct xhci_hcd { #define XHCI_CDNS_SCTX_QUIRK BIT_ULL(48) #define XHCI_ETRON_HOST BIT_ULL(49) @@ -286,7 +286,7 @@ Signed-off-by: minda.chen unsigned int num_active_eps; unsigned int limit_active_eps; struct xhci_port *hw_ports; -@@ -1692,6 +1701,8 @@ struct xhci_hcd { +@@ -1689,6 +1698,8 @@ struct xhci_hcd { struct list_head regset_list; void *dbc; diff --git a/target/linux/starfive/patches-6.6/0110-usb-xhci-using-dma_alloc_noncoherent-to-alloc-low-me.patch b/target/linux/starfive/patches-6.6/0110-usb-xhci-using-dma_alloc_noncoherent-to-alloc-low-me.patch index fad99301e6a1b9..b955ba810355e1 100644 --- a/target/linux/starfive/patches-6.6/0110-usb-xhci-using-dma_alloc_noncoherent-to-alloc-low-me.patch +++ b/target/linux/starfive/patches-6.6/0110-usb-xhci-using-dma_alloc_noncoherent-to-alloc-low-me.patch @@ -16,7 +16,7 @@ Signed-off-by: Minda Chen --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c -@@ -1891,7 +1891,8 @@ void xhci_mem_cleanup(struct xhci_hcd *x +@@ -1932,7 +1932,8 @@ void xhci_mem_cleanup(struct xhci_hcd *x if (xhci->lowmem_pool.pool) { pool = &xhci->lowmem_pool; @@ -26,7 +26,7 @@ Signed-off-by: Minda Chen gen_pool_destroy(pool->pool); pool->pool = NULL; } -@@ -2320,15 +2321,15 @@ int xhci_setup_local_lowmem(struct xhci_ +@@ -2419,15 +2420,15 @@ int xhci_setup_local_lowmem(struct xhci_ if (!pool->pool) { /* minimal alloc one page */ pool->pool = gen_pool_create(PAGE_SHIFT, dev_to_node(hcd->self.sysdev)); @@ -48,7 +48,7 @@ Signed-off-by: Minda Chen goto destroy_pool; } -@@ -2338,11 +2339,11 @@ int xhci_setup_local_lowmem(struct xhci_ +@@ -2437,11 +2438,11 @@ int xhci_setup_local_lowmem(struct xhci_ * for it. */ err = gen_pool_add_virt(pool->pool, (unsigned long)buffer, @@ -62,7 +62,7 @@ Signed-off-by: Minda Chen goto destroy_pool; } -@@ -2365,7 +2366,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, +@@ -2465,7 +2466,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, unsigned int val, val2; u64 val_64; u32 page_size, temp; @@ -71,7 +71,7 @@ Signed-off-by: Minda Chen INIT_LIST_HEAD(&xhci->cmd_list); -@@ -2496,9 +2497,11 @@ int xhci_mem_init(struct xhci_hcd *xhci, +@@ -2599,9 +2600,11 @@ int xhci_mem_init(struct xhci_hcd *xhci, xhci->isoc_bei_interval = AVOID_BEI_INTERVAL_MAX; if (xhci->quirks & XHCI_LOCAL_BUFFER) { From 90199922482d8c9dab9bdc466d26def8d5d360a0 Mon Sep 17 00:00:00 2001 From: John Audia Date: Wed, 21 May 2025 09:37:23 -0400 Subject: [PATCH 683/877] kernel: bump 6.6 to 6.6.91 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.91 Removed upstreamed: generic/pending-6.6/730-net-ethernet-mtk_eth_soc-reset-all-TX-queues-on-DMA-.patch[1] All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.91&id=68f29bb97a0e0519156664cdc23e8b1f129e3254 Build system: x86/64 Build-tested: flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Run-tested: flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/18835 Signed-off-by: Hauke Mehrtens (cherry picked from commit ecac1d8abd0398935aff30a42deb5ac29c696afd) Link: https://github.com/openwrt/openwrt/pull/18924 Signed-off-by: Robert Marko --- include/kernel-6.6 | 4 +- .../900-unaligned_access_hacks.patch | 2 +- ...x_cpus_namespace_collision_shadowing.patch | 2 +- ...-create-a-dummy-net_device-allocator.patch | 2 +- ...iatek-split-tx-and-rx-fields-in-mtk_.patch | 34 ++++++------- ...iatek-use-QDMA-instead-of-ADMAv2-on-.patch | 6 +-- ..._eth_soc-handle-dma-buffer-size-soc-.patch | 28 +++++------ ..._eth_soc-ppe-add-support-for-multipl.patch | 22 ++++----- ...ediatek-Allow-gaps-in-MAC-allocation.patch | 2 +- ..._eth_soc-implement-.-get-set-_pausep.patch | 4 +- ...net-mtk_eth_soc-enable-threaded-NAPI.patch | 2 +- ..._eth_soc-reset-all-TX-queues-on-DMA-.patch | 49 ------------------- 12 files changed, 54 insertions(+), 103 deletions(-) delete mode 100644 target/linux/generic/pending-6.6/730-net-ethernet-mtk_eth_soc-reset-all-TX-queues-on-DMA-.patch diff --git a/include/kernel-6.6 b/include/kernel-6.6 index e4ac53448d5984..c0055ecd58ad17 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .90 -LINUX_KERNEL_HASH-6.6.90 = ff856748671629c1fefef219099e0b4b81131c2d325e768cb0806e204157014e +LINUX_VERSION-6.6 = .91 +LINUX_KERNEL_HASH-6.6.91 = d08d3d175407a52cd0b25fc95e149bbd2fd6922cd37816c8fcfad18f95e254f4 diff --git a/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch b/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch index 870567c0589f86..bc1c1dd82d78d4 100644 --- a/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch @@ -323,7 +323,7 @@ SVN-Revision: 35130 SKB_DROP_REASON_IP_INHDR); --- a/include/linux/types.h +++ b/include/linux/types.h -@@ -244,5 +244,11 @@ typedef void (*swap_func_t)(void *a, voi +@@ -245,5 +245,11 @@ typedef void (*swap_func_t)(void *a, voi typedef int (*cmp_r_func_t)(const void *a, const void *b, const void *priv); typedef int (*cmp_func_t)(const void *a, const void *b); diff --git a/target/linux/generic/backport-6.6/0080-v6.9-smp-Avoid-setup_max_cpus_namespace_collision_shadowing.patch b/target/linux/generic/backport-6.6/0080-v6.9-smp-Avoid-setup_max_cpus_namespace_collision_shadowing.patch index 54ebaa1a80d3f6..c8cef08935c28d 100644 --- a/target/linux/generic/backport-6.6/0080-v6.9-smp-Avoid-setup_max_cpus_namespace_collision_shadowing.patch +++ b/target/linux/generic/backport-6.6/0080-v6.9-smp-Avoid-setup_max_cpus_namespace_collision_shadowing.patch @@ -21,7 +21,7 @@ Cc: linux-kernel@vger.kernel.org --- a/include/linux/cpu.h +++ b/include/linux/cpu.h -@@ -109,7 +109,7 @@ void notify_cpu_starting(unsigned int cp +@@ -111,7 +111,7 @@ void notify_cpu_starting(unsigned int cp extern void cpu_maps_update_begin(void); extern void cpu_maps_update_done(void); int bringup_hibernate_cpu(unsigned int sleep_cpu); diff --git a/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch b/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch index dd0640e2eec2e7..9e0bd14acfafea 100644 --- a/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch +++ b/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch @@ -37,7 +37,7 @@ Signed-off-by: David S. Miller --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h -@@ -4569,6 +4569,9 @@ static inline void netif_addr_unlock_bh( +@@ -4580,6 +4580,9 @@ static inline void netif_addr_unlock_bh( void ether_setup(struct net_device *dev); diff --git a/target/linux/generic/backport-6.6/751-01-v6.8-net-ethernet-mediatek-split-tx-and-rx-fields-in-mtk_.patch b/target/linux/generic/backport-6.6/751-01-v6.8-net-ethernet-mediatek-split-tx-and-rx-fields-in-mtk_.patch index ab12cc925fe9e8..7d232563cad504 100644 --- a/target/linux/generic/backport-6.6/751-01-v6.8-net-ethernet-mediatek-split-tx-and-rx-fields-in-mtk_.patch +++ b/target/linux/generic/backport-6.6/751-01-v6.8-net-ethernet-mediatek-split-tx-and-rx-fields-in-mtk_.patch @@ -280,8 +280,8 @@ Signed-off-by: Jakub Kicinski ring->dma, ring->phys); ring->dma = NULL; } -@@ -3124,7 +3124,7 @@ static void mtk_dma_free(struct mtk_eth - netdev_reset_queue(eth->netdev[i]); +@@ -3132,7 +3132,7 @@ static void mtk_dma_free(struct mtk_eth + 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, @@ -289,7 +289,7 @@ Signed-off-by: Jakub Kicinski eth->scratch_ring, eth->phy_scratch_ring); eth->scratch_ring = NULL; eth->phy_scratch_ring = 0; -@@ -3174,7 +3174,7 @@ static irqreturn_t mtk_handle_irq_rx(int +@@ -3182,7 +3182,7 @@ static irqreturn_t mtk_handle_irq_rx(int eth->rx_events++; if (likely(napi_schedule_prep(ð->rx_napi))) { @@ -298,7 +298,7 @@ Signed-off-by: Jakub Kicinski __napi_schedule(ð->rx_napi); } -@@ -3200,9 +3200,9 @@ static irqreturn_t mtk_handle_irq(int ir +@@ -3208,9 +3208,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) & @@ -310,7 +310,7 @@ Signed-off-by: Jakub Kicinski mtk_handle_irq_rx(irq, _eth); } if (mtk_r32(eth, reg_map->tx_irq_mask) & MTK_TX_DONE_INT) { -@@ -3220,10 +3220,10 @@ static void mtk_poll_controller(struct n +@@ -3228,10 +3228,10 @@ static void mtk_poll_controller(struct n struct mtk_eth *eth = mac->hw; mtk_tx_irq_disable(eth, MTK_TX_DONE_INT); @@ -323,7 +323,7 @@ Signed-off-by: Jakub Kicinski } #endif -@@ -3387,7 +3387,7 @@ static int mtk_open(struct net_device *d +@@ -3395,7 +3395,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); @@ -332,7 +332,7 @@ Signed-off-by: Jakub Kicinski refcount_set(ð->dma_refcnt, 1); } else -@@ -3471,7 +3471,7 @@ static int mtk_stop(struct net_device *d +@@ -3479,7 +3479,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); @@ -341,7 +341,7 @@ Signed-off-by: Jakub Kicinski napi_disable(ð->tx_napi); napi_disable(ð->rx_napi); -@@ -3947,9 +3947,9 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -3955,9 +3955,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); @@ -353,7 +353,7 @@ Signed-off-by: Jakub Kicinski mtk_w32(eth, 0x21021000, MTK_FE_INT_GRP); if (mtk_is_netsys_v3_or_greater(eth)) { -@@ -5057,11 +5057,15 @@ static const struct mtk_soc_data mt2701_ +@@ -5065,11 +5065,15 @@ static const struct mtk_soc_data mt2701_ .required_clks = MT7623_CLKS_BITMAP, .required_pctl = true, .version = 1, @@ -374,7 +374,7 @@ Signed-off-by: Jakub Kicinski .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5077,11 +5081,15 @@ static const struct mtk_soc_data mt7621_ +@@ -5085,11 +5089,15 @@ static const struct mtk_soc_data mt7621_ .offload_version = 1, .hash_offset = 2, .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, @@ -395,7 +395,7 @@ Signed-off-by: Jakub Kicinski .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5099,11 +5107,15 @@ static const struct mtk_soc_data mt7622_ +@@ -5107,11 +5115,15 @@ static const struct mtk_soc_data mt7622_ .hash_offset = 2, .has_accounting = true, .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, @@ -416,7 +416,7 @@ Signed-off-by: Jakub Kicinski .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5120,11 +5132,15 @@ static const struct mtk_soc_data mt7623_ +@@ -5128,11 +5140,15 @@ static const struct mtk_soc_data mt7623_ .hash_offset = 2, .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, .disable_pll_modes = true, @@ -437,7 +437,7 @@ Signed-off-by: Jakub Kicinski .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5139,11 +5155,15 @@ static const struct mtk_soc_data mt7629_ +@@ -5147,11 +5163,15 @@ static const struct mtk_soc_data mt7629_ .required_pctl = false, .has_accounting = true, .version = 1, @@ -458,7 +458,7 @@ Signed-off-by: Jakub Kicinski .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5161,11 +5181,15 @@ static const struct mtk_soc_data mt7981_ +@@ -5169,11 +5189,15 @@ static const struct mtk_soc_data mt7981_ .hash_offset = 4, .has_accounting = true, .foe_entry_size = MTK_FOE_ENTRY_V2_SIZE, @@ -479,7 +479,7 @@ Signed-off-by: Jakub Kicinski .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, .dma_len_offset = 8, }, -@@ -5183,11 +5207,15 @@ static const struct mtk_soc_data mt7986_ +@@ -5191,11 +5215,15 @@ static const struct mtk_soc_data mt7986_ .hash_offset = 4, .has_accounting = true, .foe_entry_size = MTK_FOE_ENTRY_V2_SIZE, @@ -500,7 +500,7 @@ Signed-off-by: Jakub Kicinski .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, .dma_len_offset = 8, }, -@@ -5205,11 +5233,15 @@ static const struct mtk_soc_data mt7988_ +@@ -5213,11 +5241,15 @@ static const struct mtk_soc_data mt7988_ .hash_offset = 4, .has_accounting = true, .foe_entry_size = MTK_FOE_ENTRY_V3_SIZE, @@ -521,7 +521,7 @@ Signed-off-by: Jakub Kicinski .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, .dma_len_offset = 8, }, -@@ -5222,11 +5254,15 @@ static const struct mtk_soc_data rt5350_ +@@ -5230,11 +5262,15 @@ static const struct mtk_soc_data rt5350_ .required_clks = MT7628_CLKS_BITMAP, .required_pctl = false, .version = 1, diff --git a/target/linux/generic/backport-6.6/751-02-v6.8-net-ethernet-mediatek-use-QDMA-instead-of-ADMAv2-on-.patch b/target/linux/generic/backport-6.6/751-02-v6.8-net-ethernet-mediatek-use-QDMA-instead-of-ADMAv2-on-.patch index 27c512864e0b93..3531399b831558 100644 --- a/target/linux/generic/backport-6.6/751-02-v6.8-net-ethernet-mediatek-use-QDMA-instead-of-ADMAv2-on-.patch +++ b/target/linux/generic/backport-6.6/751-02-v6.8-net-ethernet-mediatek-use-QDMA-instead-of-ADMAv2-on-.patch @@ -85,7 +85,7 @@ Signed-off-by: Jakub Kicinski rxd->rxd5 = 0; rxd->rxd6 = 0; rxd->rxd7 = 0; -@@ -3893,7 +3893,7 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -3901,7 +3901,7 @@ static int mtk_hw_init(struct mtk_eth *e else mtk_hw_reset(eth); @@ -94,7 +94,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); -@@ -5187,11 +5187,11 @@ static const struct mtk_soc_data mt7981_ +@@ -5195,11 +5195,11 @@ static const struct mtk_soc_data mt7981_ .dma_len_offset = 8, }, .rx = { @@ -110,7 +110,7 @@ Signed-off-by: Jakub Kicinski }, }; -@@ -5213,11 +5213,11 @@ static const struct mtk_soc_data mt7986_ +@@ -5221,11 +5221,11 @@ static const struct mtk_soc_data mt7986_ .dma_len_offset = 8, }, .rx = { diff --git a/target/linux/generic/backport-6.6/752-25-v6.10-net-ethernet-mtk_eth_soc-handle-dma-buffer-size-soc-.patch b/target/linux/generic/backport-6.6/752-25-v6.10-net-ethernet-mtk_eth_soc-handle-dma-buffer-size-soc-.patch index 27dac7214b72b5..0df5a680b3605f 100644 --- a/target/linux/generic/backport-6.6/752-25-v6.10-net-ethernet-mtk_eth_soc-handle-dma-buffer-size-soc-.patch +++ b/target/linux/generic/backport-6.6/752-25-v6.10-net-ethernet-mtk_eth_soc-handle-dma-buffer-size-soc-.patch @@ -169,7 +169,7 @@ Signed-off-by: David S. Miller } ring->frag_size = mtk_max_frag_size(rx_data_len); -@@ -3143,7 +3150,10 @@ static void mtk_dma_free(struct mtk_eth +@@ -3151,7 +3158,10 @@ static void mtk_dma_free(struct mtk_eth mtk_rx_clean(eth, ð->rx_ring[i], false); } @@ -181,7 +181,7 @@ Signed-off-by: David S. Miller } static bool mtk_hw_reset_check(struct mtk_eth *eth) -@@ -5065,11 +5075,14 @@ static const struct mtk_soc_data mt2701_ +@@ -5073,11 +5083,14 @@ static const struct mtk_soc_data mt2701_ .desc_size = sizeof(struct mtk_tx_dma), .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, @@ -196,7 +196,7 @@ Signed-off-by: David S. Miller .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5089,11 +5102,14 @@ static const struct mtk_soc_data mt7621_ +@@ -5097,11 +5110,14 @@ static const struct mtk_soc_data mt7621_ .desc_size = sizeof(struct mtk_tx_dma), .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, @@ -211,7 +211,7 @@ Signed-off-by: David S. Miller .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5115,11 +5131,14 @@ static const struct mtk_soc_data mt7622_ +@@ -5123,11 +5139,14 @@ static const struct mtk_soc_data mt7622_ .desc_size = sizeof(struct mtk_tx_dma), .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, @@ -226,7 +226,7 @@ Signed-off-by: David S. Miller .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5140,11 +5159,14 @@ static const struct mtk_soc_data mt7623_ +@@ -5148,11 +5167,14 @@ static const struct mtk_soc_data mt7623_ .desc_size = sizeof(struct mtk_tx_dma), .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, @@ -241,7 +241,7 @@ Signed-off-by: David S. Miller .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5163,11 +5185,14 @@ static const struct mtk_soc_data mt7629_ +@@ -5171,11 +5193,14 @@ static const struct mtk_soc_data mt7629_ .desc_size = sizeof(struct mtk_tx_dma), .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, @@ -256,7 +256,7 @@ Signed-off-by: David S. Miller .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5189,6 +5214,8 @@ static const struct mtk_soc_data mt7981_ +@@ -5197,6 +5222,8 @@ static const struct mtk_soc_data mt7981_ .desc_size = sizeof(struct mtk_tx_dma_v2), .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, .dma_len_offset = 8, @@ -265,7 +265,7 @@ Signed-off-by: David S. Miller }, .rx = { .desc_size = sizeof(struct mtk_rx_dma), -@@ -5196,6 +5223,7 @@ static const struct mtk_soc_data mt7981_ +@@ -5204,6 +5231,7 @@ static const struct mtk_soc_data mt7981_ .dma_l4_valid = RX_DMA_L4_VALID_V2, .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, @@ -273,7 +273,7 @@ Signed-off-by: David S. Miller }, }; -@@ -5215,6 +5243,8 @@ static const struct mtk_soc_data mt7986_ +@@ -5223,6 +5251,8 @@ static const struct mtk_soc_data mt7986_ .desc_size = sizeof(struct mtk_tx_dma_v2), .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, .dma_len_offset = 8, @@ -282,7 +282,7 @@ Signed-off-by: David S. Miller }, .rx = { .desc_size = sizeof(struct mtk_rx_dma), -@@ -5222,6 +5252,7 @@ static const struct mtk_soc_data mt7986_ +@@ -5230,6 +5260,7 @@ static const struct mtk_soc_data mt7986_ .dma_l4_valid = RX_DMA_L4_VALID_V2, .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, @@ -290,7 +290,7 @@ Signed-off-by: David S. Miller }, }; -@@ -5241,6 +5272,8 @@ static const struct mtk_soc_data mt7988_ +@@ -5249,6 +5280,8 @@ static const struct mtk_soc_data mt7988_ .desc_size = sizeof(struct mtk_tx_dma_v2), .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, .dma_len_offset = 8, @@ -299,7 +299,7 @@ Signed-off-by: David S. Miller }, .rx = { .desc_size = sizeof(struct mtk_rx_dma_v2), -@@ -5248,6 +5281,7 @@ static const struct mtk_soc_data mt7988_ +@@ -5256,6 +5289,7 @@ static const struct mtk_soc_data mt7988_ .dma_l4_valid = RX_DMA_L4_VALID_V2, .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, .dma_len_offset = 8, @@ -307,7 +307,7 @@ Signed-off-by: David S. Miller }, }; -@@ -5262,6 +5296,7 @@ static const struct mtk_soc_data rt5350_ +@@ -5270,6 +5304,7 @@ static const struct mtk_soc_data rt5350_ .desc_size = sizeof(struct mtk_tx_dma), .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, @@ -315,7 +315,7 @@ Signed-off-by: David S. Miller }, .rx = { .desc_size = sizeof(struct mtk_rx_dma), -@@ -5269,6 +5304,7 @@ static const struct mtk_soc_data rt5350_ +@@ -5277,6 +5312,7 @@ static const struct mtk_soc_data rt5350_ .dma_l4_valid = RX_DMA_L4_VALID_PDMA, .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, diff --git a/target/linux/generic/backport-6.6/752-26-v6.10-net-ethernet-mtk_eth_soc-ppe-add-support-for-multipl.patch b/target/linux/generic/backport-6.6/752-26-v6.10-net-ethernet-mtk_eth_soc-ppe-add-support-for-multipl.patch index 87c1cec363b1b1..e924551eb9a6cf 100644 --- a/target/linux/generic/backport-6.6/752-26-v6.10-net-ethernet-mtk_eth_soc-ppe-add-support-for-multipl.patch +++ b/target/linux/generic/backport-6.6/752-26-v6.10-net-ethernet-mtk_eth_soc-ppe-add-support-for-multipl.patch @@ -85,7 +85,7 @@ Signed-off-by: Jakub Kicinski skb_record_rx_queue(skb, 0); napi_gro_receive(napi, skb); -@@ -3280,37 +3291,27 @@ static int mtk_start_dma(struct mtk_eth +@@ -3288,37 +3299,27 @@ static int mtk_start_dma(struct mtk_eth return 0; } @@ -134,7 +134,7 @@ Signed-off-by: Jakub Kicinski } -@@ -3370,7 +3371,10 @@ static int mtk_open(struct net_device *d +@@ -3378,7 +3379,10 @@ static int mtk_open(struct net_device *d { struct mtk_mac *mac = netdev_priv(dev); struct mtk_eth *eth = mac->hw; @@ -146,7 +146,7 @@ Signed-off-by: Jakub Kicinski err = phylink_of_phy_connect(mac->phylink, mac->of_node, 0); if (err) { -@@ -3394,18 +3398,38 @@ static int mtk_open(struct net_device *d +@@ -3402,18 +3406,38 @@ static int mtk_open(struct net_device *d for (i = 0; i < ARRAY_SIZE(eth->ppe); i++) mtk_ppe_start(eth->ppe[i]); @@ -190,7 +190,7 @@ Signed-off-by: Jakub Kicinski phylink_start(mac->phylink); netif_tx_start_all_queues(dev); -@@ -3482,7 +3506,8 @@ static int mtk_stop(struct net_device *d +@@ -3490,7 +3514,8 @@ static int mtk_stop(struct net_device *d if (!refcount_dec_and_test(ð->dma_refcnt)) return 0; @@ -200,7 +200,7 @@ Signed-off-by: Jakub Kicinski mtk_tx_irq_disable(eth, MTK_TX_DONE_INT); mtk_rx_irq_disable(eth, eth->soc->rx.irq_done_mask); -@@ -4977,23 +5002,24 @@ static int mtk_probe(struct platform_dev +@@ -4985,23 +5010,24 @@ static int mtk_probe(struct platform_dev } if (eth->soc->offload_version) { @@ -233,7 +233,7 @@ Signed-off-by: Jakub Kicinski } for (i = 0; i < MTK_MAX_DEVS; i++) { -@@ -5096,6 +5122,7 @@ static const struct mtk_soc_data mt7621_ +@@ -5104,6 +5130,7 @@ static const struct mtk_soc_data mt7621_ .required_pctl = false, .version = 1, .offload_version = 1, @@ -241,7 +241,7 @@ Signed-off-by: Jakub Kicinski .hash_offset = 2, .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, .tx = { -@@ -5124,6 +5151,7 @@ static const struct mtk_soc_data mt7622_ +@@ -5132,6 +5159,7 @@ static const struct mtk_soc_data mt7622_ .required_pctl = false, .version = 1, .offload_version = 2, @@ -249,7 +249,7 @@ Signed-off-by: Jakub Kicinski .hash_offset = 2, .has_accounting = true, .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, -@@ -5152,6 +5180,7 @@ static const struct mtk_soc_data mt7623_ +@@ -5160,6 +5188,7 @@ static const struct mtk_soc_data mt7623_ .required_pctl = true, .version = 1, .offload_version = 1, @@ -257,7 +257,7 @@ Signed-off-by: Jakub Kicinski .hash_offset = 2, .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, .disable_pll_modes = true, -@@ -5207,6 +5236,7 @@ static const struct mtk_soc_data mt7981_ +@@ -5215,6 +5244,7 @@ static const struct mtk_soc_data mt7981_ .required_pctl = false, .version = 2, .offload_version = 2, @@ -265,7 +265,7 @@ Signed-off-by: Jakub Kicinski .hash_offset = 4, .has_accounting = true, .foe_entry_size = MTK_FOE_ENTRY_V2_SIZE, -@@ -5236,6 +5266,7 @@ static const struct mtk_soc_data mt7986_ +@@ -5244,6 +5274,7 @@ static const struct mtk_soc_data mt7986_ .required_pctl = false, .version = 2, .offload_version = 2, @@ -273,7 +273,7 @@ Signed-off-by: Jakub Kicinski .hash_offset = 4, .has_accounting = true, .foe_entry_size = MTK_FOE_ENTRY_V2_SIZE, -@@ -5265,6 +5296,7 @@ static const struct mtk_soc_data mt7988_ +@@ -5273,6 +5304,7 @@ static const struct mtk_soc_data mt7988_ .required_pctl = false, .version = 3, .offload_version = 2, diff --git a/target/linux/generic/backport-6.6/752-28-v6.10-net-ethernet-mediatek-Allow-gaps-in-MAC-allocation.patch b/target/linux/generic/backport-6.6/752-28-v6.10-net-ethernet-mediatek-Allow-gaps-in-MAC-allocation.patch index 77061eb3554fee..27ad9dca2cb161 100644 --- a/target/linux/generic/backport-6.6/752-28-v6.10-net-ethernet-mediatek-Allow-gaps-in-MAC-allocation.patch +++ b/target/linux/generic/backport-6.6/752-28-v6.10-net-ethernet-mediatek-Allow-gaps-in-MAC-allocation.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 -@@ -3400,7 +3400,7 @@ static int mtk_open(struct net_device *d +@@ -3408,7 +3408,7 @@ static int mtk_open(struct net_device *d for (i = 0; i < MTK_MAX_DEVS; i++) { if (!eth->netdev[i]) diff --git a/target/linux/generic/backport-6.6/752-30-v6.10-net-ethernet-mtk_eth_soc-implement-.-get-set-_pausep.patch b/target/linux/generic/backport-6.6/752-30-v6.10-net-ethernet-mtk_eth_soc-implement-.-get-set-_pausep.patch index 272ceb3b45e7e7..b16910e18eba2b 100644 --- a/target/linux/generic/backport-6.6/752-30-v6.10-net-ethernet-mtk_eth_soc-implement-.-get-set-_pausep.patch +++ b/target/linux/generic/backport-6.6/752-30-v6.10-net-ethernet-mtk_eth_soc-implement-.-get-set-_pausep.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 -@@ -4482,6 +4482,20 @@ static int mtk_set_rxnfc(struct net_devi +@@ -4490,6 +4490,20 @@ static int mtk_set_rxnfc(struct net_devi return ret; } @@ -41,7 +41,7 @@ Signed-off-by: Jakub Kicinski static u16 mtk_select_queue(struct net_device *dev, struct sk_buff *skb, struct net_device *sb_dev) { -@@ -4510,8 +4524,10 @@ static const struct ethtool_ops mtk_etht +@@ -4518,8 +4532,10 @@ static const struct ethtool_ops mtk_etht .get_strings = mtk_get_strings, .get_sset_count = mtk_get_sset_count, .get_ethtool_stats = mtk_get_ethtool_stats, diff --git a/target/linux/generic/pending-6.6/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch b/target/linux/generic/pending-6.6/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch index 05f64f7587b869..3b44c9aeab9446 100644 --- a/target/linux/generic/pending-6.6/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch +++ b/target/linux/generic/pending-6.6/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 -@@ -5125,6 +5125,8 @@ static int mtk_probe(struct platform_dev +@@ -5133,6 +5133,8 @@ static int mtk_probe(struct platform_dev * for NAPI to work */ init_dummy_netdev(ð->dummy_dev); diff --git a/target/linux/generic/pending-6.6/730-net-ethernet-mtk_eth_soc-reset-all-TX-queues-on-DMA-.patch b/target/linux/generic/pending-6.6/730-net-ethernet-mtk_eth_soc-reset-all-TX-queues-on-DMA-.patch deleted file mode 100644 index 8d8e3d83ba1939..00000000000000 --- a/target/linux/generic/pending-6.6/730-net-ethernet-mtk_eth_soc-reset-all-TX-queues-on-DMA-.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 7d41a5a8e9c91cc6bb011dd953570738583dd091 Mon Sep 17 00:00:00 2001 -From: Daniel Golle -Date: Wed, 18 Sep 2024 02:01:01 +0100 -Subject: [PATCH] net: ethernet: mtk_eth_soc: reset all TX queues on DMA free - -The purpose of resetting the TX queue is to reset the -byte and packet count as well as to clear the software -flow control XOFF bit. - -MediaTek developers pointed out that netdev_reset_queue would only -resets queue 0 of the network device. -Queues that are not reset may cause unexpected issues. - -Packets may stop being sent after reset and "transmit timeout" log may -be displayed. - -Import fix from MediaTek's SDK to resolve this issue. - -Signed-off-by: Daniel Golle ---- - drivers/net/ethernet/mediatek/mtk_eth_soc.c | 18 ++++++++++++++---- - 1 file changed, 14 insertions(+), 4 deletions(-) - ---- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c -+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3149,11 +3149,19 @@ static int mtk_dma_init(struct mtk_eth * - static void mtk_dma_free(struct mtk_eth *eth) - { - const struct mtk_soc_data *soc = eth->soc; -- int i; -+ int i, j, txqs = 1; -+ -+ if (MTK_HAS_CAPS(eth->soc->caps, MTK_QDMA)) -+ txqs = MTK_QDMA_NUM_QUEUES; -+ -+ for (i = 0; i < MTK_MAX_DEVS; i++) { -+ if (!eth->netdev[i]) -+ continue; -+ -+ for (j = 0; j < txqs; j++) -+ netdev_tx_reset_queue(netdev_get_tx_queue(eth->netdev[i], j)); -+ } - -- for (i = 0; i < MTK_MAX_DEVS; i++) -- if (eth->netdev[i]) -- 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->tx.desc_size, From 6f56ddc36f3d40fc2b904e19360d7be71b1ab61f Mon Sep 17 00:00:00 2001 From: John Audia Date: Thu, 22 May 2025 16:07:50 -0400 Subject: [PATCH 684/877] kernel: bump 6.6 to 6.6.92 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.92 No patches needed a rebase with this release/only archive hash updated. Build system: x86/64 Build-tested: flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Run-tested: flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/18835 Signed-off-by: Hauke Mehrtens (cherry picked from commit 2a7cfbbbef76446bc0340fecda79a2d88c9375f5) Link: https://github.com/openwrt/openwrt/pull/18924 Signed-off-by: Robert Marko --- include/kernel-6.6 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/kernel-6.6 b/include/kernel-6.6 index c0055ecd58ad17..96534d711c108a 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .91 -LINUX_KERNEL_HASH-6.6.91 = d08d3d175407a52cd0b25fc95e149bbd2fd6922cd37816c8fcfad18f95e254f4 +LINUX_VERSION-6.6 = .92 +LINUX_KERNEL_HASH-6.6.92 = 1d82a82642d281c31d86f7301bc55e12a8a9f9c04532e249ef8ae6fe7dc237ec From 3246d6c0a11e0129182b4c8bf433cb22dda6a6e0 Mon Sep 17 00:00:00 2001 From: John Audia Date: Fri, 23 May 2025 20:14:52 -0400 Subject: [PATCH 685/877] stm32: add missing config option 6.6.92 requires the addition of CONFIG_ARM_SCMI_DEBUG_COUNTERS Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/18835 Signed-off-by: Hauke Mehrtens (cherry picked from commit 83ff9600dc49716aadaf14bc7a2e1bdad171d6c1) Link: https://github.com/openwrt/openwrt/pull/18924 Signed-off-by: Robert Marko --- target/linux/stm32/stm32mp1/config-6.6 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/stm32/stm32mp1/config-6.6 b/target/linux/stm32/stm32mp1/config-6.6 index f7ed9030c69673..f6f9efaf9382ac 100644 --- a/target/linux/stm32/stm32mp1/config-6.6 +++ b/target/linux/stm32/stm32mp1/config-6.6 @@ -44,6 +44,7 @@ CONFIG_ARM_PSCI_CPUIDLE=y CONFIG_ARM_PSCI_CPUIDLE_DOMAIN=y CONFIG_ARM_PSCI_FW=y CONFIG_ARM_SCMI_CPUFREQ=y +# CONFIG_ARM_SCMI_DEBUG_COUNTERS is not set CONFIG_ARM_SCMI_HAVE_MSG=y CONFIG_ARM_SCMI_HAVE_SHMEM=y CONFIG_ARM_SCMI_HAVE_TRANSPORT=y From f37e4dc3002f2557017c8f99825197e5f7256a02 Mon Sep 17 00:00:00 2001 From: John Audia Date: Fri, 23 May 2025 20:09:49 -0400 Subject: [PATCH 686/877] rockchip: armv8: add missing config option 6.6.92 requires the addition of CONFIG_ARM_SCMI_DEBUG_COUNTERS Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/18835 Signed-off-by: Hauke Mehrtens (cherry picked from commit 763339207bb0a818d9ca3d0f0e4f928aba14b378) Link: https://github.com/openwrt/openwrt/pull/18924 Signed-off-by: Robert Marko --- target/linux/rockchip/armv8/config-6.6 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/rockchip/armv8/config-6.6 b/target/linux/rockchip/armv8/config-6.6 index 68eed3e5f9b332..187a1bb6700f9b 100644 --- a/target/linux/rockchip/armv8/config-6.6 +++ b/target/linux/rockchip/armv8/config-6.6 @@ -78,6 +78,7 @@ CONFIG_ARM_PSCI_CPUIDLE_DOMAIN=y CONFIG_ARM_PSCI_FW=y # CONFIG_ARM_RK3399_DMC_DEVFREQ is not set CONFIG_ARM_SCMI_CPUFREQ=y +# CONFIG_ARM_SCMI_DEBUG_COUNTERS is not set CONFIG_ARM_SCMI_HAVE_SHMEM=y CONFIG_ARM_SCMI_HAVE_TRANSPORT=y CONFIG_ARM_SCMI_POWER_CONTROL=y From 3a2a2c995f8370424dbf257d43e5446965a46ebc Mon Sep 17 00:00:00 2001 From: Goetz Goerisch Date: Mon, 26 May 2025 12:48:06 +0200 Subject: [PATCH 687/877] kernel: refresh patches manually refresh kernel patches Signed-off-by: Goetz Goerisch Link: https://github.com/openwrt/openwrt/pull/18924 Signed-off-by: Robert Marko --- ...all-the-downstream-rpi-sound-card-dr.patch | 2 +- ...-Add-a-timing-for-the-Raspberry-Pi-7.patch | 4 +- ...nel-simple-add-Geekworm-MZP280-Panel.patch | 4 +- ...a-introduce-a-customisable-threshold.patch | 2 +- ...mple-Add-Innolux-AT056tN53V1-5.6-VGA.patch | 4 +- ...gfs-end-points-to-query-GPU-usage-st.patch | 4 +- ...-net-macb-Also-set-DMA-coherent-mask.patch | 24 ++++----- ...ix-up-register-addresses-for-V3D-7.x.patch | 6 +-- ...-Alter-the-timing-for-the-Pi-7-DSI-d.patch | 2 +- .../950-0757-drm-panel-add-panel-dsi.patch | 4 +- ...-Fix-7inch-panel-mode-for-misalignme.patch | 2 +- ...-Increase-pixel-clock-on-Pi-7inch-pa.patch | 2 +- ...port-for-Raspberry-Pi-RP1-ethernet-c.patch | 4 +- ...pci-Disable-Host-Memory-Buffer-usage.patch | 6 +-- ...e-a-V3D-tech-revision-to-all-support.patch | 4 +- ...680-net-add-TCP-fraglist-GRO-support.patch | 2 +- ...net-mtk_eth_soc-enable-threaded-NAPI.patch | 2 +- ...-mediatek-enlarge-DMA-reserve-buffer.patch | 2 +- ..._eth_soc-add-paths-and-SerDes-modes-.patch | 18 +++---- ...th_soc-reduce-rx-ring-size-for-older.patch | 51 ++----------------- ..._eth_soc-do-not-enable-page-pool-sta.patch | 4 +- 21 files changed, 54 insertions(+), 99 deletions(-) diff --git a/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch b/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch index 56712a2b48d320..9f346943ccbd89 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch @@ -17583,7 +17583,7 @@ Signed-off-by: Phil Elwell * For devices with more than one control interface, we assume the --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c -@@ -2254,6 +2254,8 @@ static const struct usb_audio_quirk_flag +@@ -2258,6 +2258,8 @@ static const struct usb_audio_quirk_flag QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x534d, 0x2109, /* MacroSilicon MS2109 */ QUIRK_FLAG_ALIGN_TRANSFER), diff --git a/target/linux/bcm27xx/patches-6.6/950-0301-drm-panel-simple-Add-a-timing-for-the-Raspberry-Pi-7.patch b/target/linux/bcm27xx/patches-6.6/950-0301-drm-panel-simple-Add-a-timing-for-the-Raspberry-Pi-7.patch index e3a07581f82967..d838b0f8527259 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0301-drm-panel-simple-Add-a-timing-for-the-Raspberry-Pi-7.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0301-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 -@@ -3376,6 +3376,31 @@ static const struct panel_desc rocktech_ +@@ -3377,6 +3377,31 @@ static const struct panel_desc rocktech_ .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 }, -@@ -4452,6 +4477,9 @@ static const struct of_device_id platfor +@@ -4453,6 +4478,9 @@ static const struct of_device_id platfor .compatible = "rocktech,rk043fn48h", .data = &rocktech_rk043fn48h, }, { diff --git a/target/linux/bcm27xx/patches-6.6/950-0343-drm-panel-simple-add-Geekworm-MZP280-Panel.patch b/target/linux/bcm27xx/patches-6.6/950-0343-drm-panel-simple-add-Geekworm-MZP280-Panel.patch index 49493e67a9cdc6..5019e794e55f30 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0343-drm-panel-simple-add-Geekworm-MZP280-Panel.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0343-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 -@@ -2035,6 +2035,32 @@ static const struct panel_desc friendlya +@@ -2036,6 +2036,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, -@@ -4327,6 +4353,9 @@ static const struct of_device_id platfor +@@ -4328,6 +4354,9 @@ static const struct of_device_id platfor .compatible = "friendlyarm,hd702e", .data = &friendlyarm_hd702e, }, { diff --git a/target/linux/bcm27xx/patches-6.6/950-0359-mm-page_alloc-cma-introduce-a-customisable-threshold.patch b/target/linux/bcm27xx/patches-6.6/950-0359-mm-page_alloc-cma-introduce-a-customisable-threshold.patch index 8cf8a05098cb97..08eb5aa74251a5 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0359-mm-page_alloc-cma-introduce-a-customisable-threshold.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0359-mm-page_alloc-cma-introduce-a-customisable-threshold.patch @@ -48,7 +48,7 @@ Signed-off-by: David Plowman /* * A cached value of the page's pageblock's migratetype, used when the page is * put on a pcplist. Used to avoid the pageblock migratetype lookup when -@@ -2109,12 +2130,13 @@ __rmqueue(struct zone *zone, unsigned in +@@ -2108,12 +2129,13 @@ __rmqueue(struct zone *zone, unsigned in if (IS_ENABLED(CONFIG_CMA)) { /* * Balance movable allocations between regular and CMA areas by diff --git a/target/linux/bcm27xx/patches-6.6/950-0401-drm-panel-simple-Add-Innolux-AT056tN53V1-5.6-VGA.patch b/target/linux/bcm27xx/patches-6.6/950-0401-drm-panel-simple-Add-Innolux-AT056tN53V1-5.6-VGA.patch index 394109d5658be9..3ca1f8c520f457 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0401-drm-panel-simple-Add-Innolux-AT056tN53V1-5.6-VGA.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0401-drm-panel-simple-Add-Innolux-AT056tN53V1-5.6-VGA.patch @@ -126,7 +126,7 @@ Signed-off-by: Phil Elwell - MEDIA_BUS_FMT_RGB666_1X24_CPADHI --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c -@@ -2241,6 +2241,38 @@ static const struct panel_desc innolux_a +@@ -2242,6 +2242,38 @@ static const struct panel_desc innolux_a .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE, }; @@ -165,7 +165,7 @@ Signed-off-by: Phil Elwell static const struct drm_display_mode innolux_at070tn92_mode = { .clock = 33333, .hdisplay = 800, -@@ -4377,6 +4409,9 @@ static const struct of_device_id platfor +@@ -4378,6 +4410,9 @@ static const struct of_device_id platfor .compatible = "innolux,at043tn24", .data = &innolux_at043tn24, }, { diff --git a/target/linux/bcm27xx/patches-6.6/950-0464-drm-v3d-New-debugfs-end-points-to-query-GPU-usage-st.patch b/target/linux/bcm27xx/patches-6.6/950-0464-drm-v3d-New-debugfs-end-points-to-query-GPU-usage-st.patch index 9ff7a6d0ad3f06..c2c73a8c964649 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0464-drm-v3d-New-debugfs-end-points-to-query-GPU-usage-st.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0464-drm-v3d-New-debugfs-end-points-to-query-GPU-usage-st.patch @@ -450,7 +450,7 @@ Signed-off-by: Jose Maria Casanova Crespo return NULL; } -@@ -392,8 +508,18 @@ v3d_sched_init(struct v3d_dev *v3d) +@@ -406,8 +522,18 @@ v3d_sched_init(struct v3d_dev *v3d) int hw_jobs_limit = 1; int job_hang_limit = 0; int hang_limit_ms = 500; @@ -469,7 +469,7 @@ Signed-off-by: Jose Maria Casanova Crespo ret = drm_sched_init(&v3d->queue[V3D_BIN].sched, &v3d_bin_sched_ops, hw_jobs_limit, job_hang_limit, -@@ -447,9 +573,20 @@ void +@@ -461,9 +587,20 @@ void v3d_sched_fini(struct v3d_dev *v3d) { enum v3d_queue q; diff --git a/target/linux/bcm27xx/patches-6.6/950-0518-net-macb-Also-set-DMA-coherent-mask.patch b/target/linux/bcm27xx/patches-6.6/950-0518-net-macb-Also-set-DMA-coherent-mask.patch index 9882230654470d..31a173a2e08ca8 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0518-net-macb-Also-set-DMA-coherent-mask.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0518-net-macb-Also-set-DMA-coherent-mask.patch @@ -199,7 +199,7 @@ Signed-off-by: Jonathan Bell snprintf(bp->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x", bp->pdev->name, bp->pdev->id); bp->mii_bus->priv = bp; -@@ -1648,6 +1665,11 @@ static int macb_rx(struct macb_queue *qu +@@ -1641,6 +1658,11 @@ static int macb_rx(struct macb_queue *qu macb_init_rx_ring(queue); queue_writel(queue, RBQP, queue->rx_ring_dma); @@ -211,7 +211,7 @@ Signed-off-by: Jonathan Bell macb_writel(bp, NCR, ctrl | MACB_BIT(RE)); -@@ -1948,8 +1970,9 @@ static irqreturn_t macb_interrupt(int ir +@@ -1941,8 +1963,9 @@ static irqreturn_t macb_interrupt(int ir queue_writel(queue, ISR, MACB_BIT(TCOMP) | MACB_BIT(TXUBR)); @@ -222,7 +222,7 @@ Signed-off-by: Jonathan Bell wmb(); // ensure softirq can see update } -@@ -2404,6 +2427,11 @@ static netdev_tx_t macb_start_xmit(struc +@@ -2397,6 +2420,11 @@ static netdev_tx_t macb_start_xmit(struc skb_tx_timestamp(skb); spin_lock_irq(&bp->lock); @@ -234,7 +234,7 @@ Signed-off-by: Jonathan Bell macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(TSTART)); spin_unlock_irq(&bp->lock); -@@ -2778,6 +2806,37 @@ static void macb_configure_dma(struct ma +@@ -2771,6 +2799,37 @@ static void macb_configure_dma(struct ma } } @@ -272,7 +272,7 @@ Signed-off-by: Jonathan Bell static void macb_init_hw(struct macb *bp) { u32 config; -@@ -2806,6 +2865,11 @@ static void macb_init_hw(struct macb *bp +@@ -2799,6 +2858,11 @@ static void macb_init_hw(struct macb *bp if (bp->caps & MACB_CAPS_JUMBO) bp->rx_frm_len_mask = MACB_RX_JFRMLEN_MASK; @@ -284,7 +284,7 @@ Signed-off-by: Jonathan Bell macb_configure_dma(bp); /* Enable RX partial store and forward and set watermark */ -@@ -3170,6 +3234,52 @@ static void gem_get_ethtool_strings(stru +@@ -3163,6 +3227,52 @@ static void gem_get_ethtool_strings(stru } } @@ -337,7 +337,7 @@ Signed-off-by: Jonathan Bell static struct net_device_stats *macb_get_stats(struct net_device *dev) { struct macb *bp = netdev_priv(dev); -@@ -3764,6 +3874,8 @@ static const struct ethtool_ops macb_eth +@@ -3757,6 +3867,8 @@ static const struct ethtool_ops macb_eth }; static const struct ethtool_ops gem_ethtool_ops = { @@ -346,7 +346,7 @@ Signed-off-by: Jonathan Bell .get_regs_len = macb_get_regs_len, .get_regs = macb_get_regs, .get_wol = macb_get_wol, -@@ -3773,6 +3885,8 @@ static const struct ethtool_ops gem_etht +@@ -3766,6 +3878,8 @@ static const struct ethtool_ops gem_etht .get_ethtool_stats = gem_get_ethtool_stats, .get_strings = gem_get_ethtool_strings, .get_sset_count = gem_get_sset_count, @@ -355,7 +355,7 @@ Signed-off-by: Jonathan Bell .get_link_ksettings = macb_get_link_ksettings, .set_link_ksettings = macb_set_link_ksettings, .get_ringparam = macb_get_ringparam, -@@ -5069,6 +5183,11 @@ static int macb_probe(struct platform_de +@@ -5062,6 +5176,11 @@ static int macb_probe(struct platform_de } } } @@ -367,7 +367,7 @@ Signed-off-by: Jonathan Bell spin_lock_init(&bp->lock); spin_lock_init(&bp->stats_lock); -@@ -5125,6 +5244,21 @@ static int macb_probe(struct platform_de +@@ -5118,6 +5237,21 @@ static int macb_probe(struct platform_de else bp->phy_interface = interface; @@ -389,7 +389,7 @@ Signed-off-by: Jonathan Bell /* IP specific init */ err = init(pdev); if (err) -@@ -5201,6 +5335,19 @@ static int macb_remove(struct platform_d +@@ -5194,6 +5328,19 @@ static int macb_remove(struct platform_d return 0; } @@ -409,7 +409,7 @@ Signed-off-by: Jonathan Bell static int __maybe_unused macb_suspend(struct device *dev) { struct net_device *netdev = dev_get_drvdata(dev); -@@ -5415,6 +5562,7 @@ static const struct dev_pm_ops macb_pm_o +@@ -5408,6 +5555,7 @@ static const struct dev_pm_ops macb_pm_o static struct platform_driver macb_driver = { .probe = macb_probe, .remove = macb_remove, diff --git a/target/linux/bcm27xx/patches-6.6/950-0555-drm-v3d-fix-up-register-addresses-for-V3D-7.x.patch b/target/linux/bcm27xx/patches-6.6/950-0555-drm-v3d-fix-up-register-addresses-for-V3D-7.x.patch index 4e8134287692b5..965571e533e1c9 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0555-drm-v3d-fix-up-register-addresses-for-V3D-7.x.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0555-drm-v3d-fix-up-register-addresses-for-V3D-7.x.patch @@ -660,7 +660,7 @@ v2: fix kernel panic with debug-fs interface to list registers return fence; } -@@ -459,7 +465,8 @@ v3d_csd_job_timedout(struct drm_sched_jo +@@ -471,7 +477,8 @@ v3d_csd_job_timedout(struct drm_sched_jo { struct v3d_csd_job *job = to_csd_job(sched_job); struct v3d_dev *v3d = job->base.v3d; @@ -668,5 +668,5 @@ v2: fix kernel panic with debug-fs interface to list registers + u32 batches = V3D_CORE_READ(0, (v3d->ver < 71 ? V3D_CSD_CURRENT_CFG4 : + V3D_V7_CSD_CURRENT_CFG4)); - /* If we've made progress, skip reset and let the timer get - * rearmed. + /* If we've made progress, skip reset, add the job to the pending + * list, and let the timer get rearmed. diff --git a/target/linux/bcm27xx/patches-6.6/950-0636-drm-panel-simple-Alter-the-timing-for-the-Pi-7-DSI-d.patch b/target/linux/bcm27xx/patches-6.6/950-0636-drm-panel-simple-Alter-the-timing-for-the-Pi-7-DSI-d.patch index b72020d7e4173e..667841c8f56ab2 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0636-drm-panel-simple-Alter-the-timing-for-the-Pi-7-DSI-d.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0636-drm-panel-simple-Alter-the-timing-for-the-Pi-7-DSI-d.patch @@ -16,7 +16,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c -@@ -3438,11 +3438,11 @@ static const struct panel_desc rocktech_ +@@ -3439,11 +3439,11 @@ static const struct panel_desc rocktech_ }; static const struct drm_display_mode raspberrypi_7inch_mode = { diff --git a/target/linux/bcm27xx/patches-6.6/950-0757-drm-panel-add-panel-dsi.patch b/target/linux/bcm27xx/patches-6.6/950-0757-drm-panel-add-panel-dsi.patch index 4e9ba92a1883ac..f62410aeaac6ac 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0757-drm-panel-add-panel-dsi.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0757-drm-panel-add-panel-dsi.patch @@ -23,7 +23,7 @@ Signed-off-by: Timon Skerutsch /** * struct panel_desc - Describes a simple panel. -@@ -4903,6 +4904,9 @@ static const struct panel_desc_dsi osd10 +@@ -4904,6 +4905,9 @@ static const struct panel_desc_dsi osd10 .lanes = 4, }; @@ -33,7 +33,7 @@ Signed-off-by: Timon Skerutsch static const struct of_device_id dsi_of_match[] = { { .compatible = "auo,b080uan01", -@@ -4926,20 +4930,137 @@ static const struct of_device_id dsi_of_ +@@ -4927,20 +4931,137 @@ static const struct of_device_id dsi_of_ .compatible = "osddisplays,osd101t2045-53ts", .data = &osd101t2045_53ts }, { diff --git a/target/linux/bcm27xx/patches-6.6/950-1069-drm-panel-simple-Fix-7inch-panel-mode-for-misalignme.patch b/target/linux/bcm27xx/patches-6.6/950-1069-drm-panel-simple-Fix-7inch-panel-mode-for-misalignme.patch index 6a413ec90bfa33..eacc9c8b811a8e 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1069-drm-panel-simple-Fix-7inch-panel-mode-for-misalignme.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1069-drm-panel-simple-Fix-7inch-panel-mode-for-misalignme.patch @@ -16,7 +16,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c -@@ -3421,11 +3421,11 @@ static const struct drm_display_mode ras +@@ -3422,11 +3422,11 @@ static const struct drm_display_mode ras .hdisplay = 800, .hsync_start = 800 + 59, .hsync_end = 800 + 59 + 2, diff --git a/target/linux/bcm27xx/patches-6.6/950-1070-drm-panel-simple-Increase-pixel-clock-on-Pi-7inch-pa.patch b/target/linux/bcm27xx/patches-6.6/950-1070-drm-panel-simple-Increase-pixel-clock-on-Pi-7inch-pa.patch index 68129c8de9ef5b..9c1094bd9be173 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1070-drm-panel-simple-Increase-pixel-clock-on-Pi-7inch-pa.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1070-drm-panel-simple-Increase-pixel-clock-on-Pi-7inch-pa.patch @@ -21,7 +21,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c -@@ -3417,11 +3417,11 @@ static const struct panel_desc rocktech_ +@@ -3418,11 +3418,11 @@ static const struct panel_desc rocktech_ }; static const struct drm_display_mode raspberrypi_7inch_mode = { diff --git a/target/linux/bcm27xx/patches-6.6/950-1423-net-macb-Add-support-for-Raspberry-Pi-RP1-ethernet-c.patch b/target/linux/bcm27xx/patches-6.6/950-1423-net-macb-Add-support-for-Raspberry-Pi-RP1-ethernet-c.patch index c34d1c87203538..6a9b7b36bd4075 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1423-net-macb-Add-support-for-Raspberry-Pi-RP1-ethernet-c.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1423-net-macb-Add-support-for-Raspberry-Pi-RP1-ethernet-c.patch @@ -15,7 +15,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c -@@ -5030,6 +5030,17 @@ static const struct macb_config versal_c +@@ -5023,6 +5023,17 @@ static const struct macb_config versal_c .usrio = &macb_default_usrio, }; @@ -33,7 +33,7 @@ Signed-off-by: Dave Stevenson static const struct of_device_id macb_dt_ids[] = { { .compatible = "cdns,at91sam9260-macb", .data = &at91sam9260_config }, { .compatible = "cdns,macb" }, -@@ -5050,6 +5061,7 @@ static const struct of_device_id macb_dt +@@ -5043,6 +5054,7 @@ static const struct of_device_id macb_dt { .compatible = "microchip,mpfs-macb", .data = &mpfs_config }, { .compatible = "microchip,sama7g5-gem", .data = &sama7g5_gem_config }, { .compatible = "microchip,sama7g5-emac", .data = &sama7g5_emac_config }, diff --git a/target/linux/bcm27xx/patches-6.6/950-1438-nvme-pci-Disable-Host-Memory-Buffer-usage.patch b/target/linux/bcm27xx/patches-6.6/950-1438-nvme-pci-Disable-Host-Memory-Buffer-usage.patch index 02c4dc449899e4..777d134313c712 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1438-nvme-pci-Disable-Host-Memory-Buffer-usage.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1438-nvme-pci-Disable-Host-Memory-Buffer-usage.patch @@ -18,7 +18,7 @@ Signed-off-by: Phil Elwell --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c -@@ -1948,6 +1948,7 @@ static void nvme_free_host_mem(struct nv +@@ -1950,6 +1950,7 @@ static void nvme_free_host_mem(struct nv dev->nr_host_mem_descs = 0; } @@ -26,7 +26,7 @@ Signed-off-by: Phil Elwell static int __nvme_alloc_host_mem(struct nvme_dev *dev, u64 preferred, u32 chunk_size) { -@@ -2016,9 +2017,11 @@ out: +@@ -2018,9 +2019,11 @@ out: dev->host_mem_descs = NULL; return -ENOMEM; } @@ -38,7 +38,7 @@ Signed-off-by: Phil Elwell u64 min_chunk = min_t(u64, preferred, PAGE_SIZE * MAX_ORDER_NR_PAGES); u64 hmminds = max_t(u32, dev->ctrl.hmminds * 4096, PAGE_SIZE * 2); u64 chunk_size; -@@ -2031,6 +2034,7 @@ static int nvme_alloc_host_mem(struct nv +@@ -2033,6 +2036,7 @@ static int nvme_alloc_host_mem(struct nv nvme_free_host_mem(dev); } } diff --git a/target/linux/bcm27xx/patches-6.6/950-1553-drm-v3d-Associate-a-V3D-tech-revision-to-all-support.patch b/target/linux/bcm27xx/patches-6.6/950-1553-drm-v3d-Associate-a-V3D-tech-revision-to-all-support.patch index a13516a04ea361..b5d65b7fedd380 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1553-drm-v3d-Associate-a-V3D-tech-revision-to-all-support.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1553-drm-v3d-Associate-a-V3D-tech-revision-to-all-support.patch @@ -436,7 +436,7 @@ Signed-off-by: Maíra Canal for (i = 1; i <= csd_cfg_reg_count; i++) V3D_CORE_WRITE(0, csd_cfg0_reg + 4 * i, job->args.cfg[i]); /* CFG0 write kicks off the job. */ -@@ -475,7 +475,7 @@ v3d_csd_job_timedout(struct drm_sched_jo +@@ -487,7 +487,7 @@ v3d_csd_job_timedout(struct drm_sched_jo { struct v3d_csd_job *job = to_csd_job(sched_job); struct v3d_dev *v3d = job->base.v3d; @@ -444,4 +444,4 @@ Signed-off-by: Maíra Canal + u32 batches = V3D_CORE_READ(0, (v3d->ver < V3D_GEN_71 ? V3D_CSD_CURRENT_CFG4 : V3D_V7_CSD_CURRENT_CFG4)); - /* If we've made progress, skip reset and let the timer get + /* If we've made progress, skip reset, add the job to the pending diff --git a/target/linux/generic/pending-6.6/680-net-add-TCP-fraglist-GRO-support.patch b/target/linux/generic/pending-6.6/680-net-add-TCP-fraglist-GRO-support.patch index fcc6a1f14fa178..223fce786e8088 100644 --- a/target/linux/generic/pending-6.6/680-net-add-TCP-fraglist-GRO-support.patch +++ b/target/linux/generic/pending-6.6/680-net-add-TCP-fraglist-GRO-support.patch @@ -379,7 +379,7 @@ Signe-off-by: Felix Fietkau skb_shinfo(skb)->gso_type |= SKB_GSO_TCPV4; --- a/net/ipv4/udp_offload.c +++ b/net/ipv4/udp_offload.c -@@ -474,33 +474,6 @@ out: +@@ -533,33 +533,6 @@ out: return segs; } diff --git a/target/linux/generic/pending-6.6/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch b/target/linux/generic/pending-6.6/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch index 3b44c9aeab9446..cd3c9df2bbd035 100644 --- a/target/linux/generic/pending-6.6/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch +++ b/target/linux/generic/pending-6.6/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 -@@ -5133,6 +5133,8 @@ static int mtk_probe(struct platform_dev +@@ -5064,6 +5064,8 @@ static int mtk_probe(struct platform_dev * for NAPI to work */ init_dummy_netdev(ð->dummy_dev); diff --git a/target/linux/generic/pending-6.6/734-net-ethernet-mediatek-enlarge-DMA-reserve-buffer.patch b/target/linux/generic/pending-6.6/734-net-ethernet-mediatek-enlarge-DMA-reserve-buffer.patch index 7274c4a817d643..c97df557c68fb3 100644 --- a/target/linux/generic/pending-6.6/734-net-ethernet-mediatek-enlarge-DMA-reserve-buffer.patch +++ b/target/linux/generic/pending-6.6/734-net-ethernet-mediatek-enlarge-DMA-reserve-buffer.patch @@ -25,7 +25,7 @@ Signed-off-by: Chad Monroe /* QDMA Flow Control Register */ --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3323,12 +3323,14 @@ static int mtk_start_dma(struct mtk_eth +@@ -3313,12 +3313,14 @@ static int mtk_start_dma(struct mtk_eth MTK_TX_BT_32DWORDS | MTK_NDP_CO_PRO | MTK_RX_2B_OFFSET | MTK_TX_WB_DDONE; diff --git a/target/linux/generic/pending-6.6/737-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch b/target/linux/generic/pending-6.6/737-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch index fc1a388387f19f..4d718f9fa086b5 100644 --- a/target/linux/generic/pending-6.6/737-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch +++ b/target/linux/generic/pending-6.6/737-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch @@ -490,7 +490,7 @@ Signed-off-by: Daniel Golle .mac_finish = mtk_mac_finish, .mac_link_down = mtk_mac_link_down, .mac_link_up = mtk_mac_link_up, -@@ -3431,6 +3572,9 @@ static int mtk_open(struct net_device *d +@@ -3421,6 +3562,9 @@ static int mtk_open(struct net_device *d ppe_num = eth->soc->ppe_num; @@ -500,7 +500,7 @@ Signed-off-by: Daniel Golle err = phylink_of_phy_connect(mac->phylink, mac->of_node, 0); if (err) { netdev_err(dev, "%s: could not attach PHY: %d\n", __func__, -@@ -3581,6 +3725,9 @@ static int mtk_stop(struct net_device *d +@@ -3571,6 +3715,9 @@ static int mtk_stop(struct net_device *d for (i = 0; i < ARRAY_SIZE(eth->ppe); i++) mtk_ppe_stop(eth->ppe[i]); @@ -510,7 +510,7 @@ Signed-off-by: Daniel Golle return 0; } -@@ -4667,6 +4814,7 @@ static const struct net_device_ops mtk_n +@@ -4600,6 +4747,7 @@ static const struct net_device_ops mtk_n static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) { const __be32 *_id = of_get_property(np, "reg", NULL); @@ -518,7 +518,7 @@ Signed-off-by: Daniel Golle phy_interface_t phy_mode; struct phylink *phylink; struct mtk_mac *mac; -@@ -4705,16 +4853,41 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4636,16 +4784,41 @@ static int mtk_add_mac(struct mtk_eth *e mac->id = id; mac->hw = eth; mac->of_node = np; @@ -568,7 +568,7 @@ Signed-off-by: Daniel Golle } memset(mac->hwlro_ip, 0, sizeof(mac->hwlro_ip)); -@@ -4797,8 +4970,21 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4728,8 +4901,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); @@ -590,7 +590,7 @@ Signed-off-by: Daniel Golle phylink = phylink_create(&mac->phylink_config, of_fwnode_handle(mac->of_node), phy_mode, &mtk_phylink_ops); -@@ -4849,6 +5035,26 @@ free_netdev: +@@ -4780,6 +4966,26 @@ free_netdev: return err; } @@ -617,7 +617,7 @@ Signed-off-by: Daniel Golle void mtk_eth_set_dma_device(struct mtk_eth *eth, struct device *dma_dev) { struct net_device *dev, *tmp; -@@ -4995,7 +5201,8 @@ static int mtk_probe(struct platform_dev +@@ -4926,7 +5132,8 @@ static int mtk_probe(struct platform_dev regmap_write(cci, 0, 3); } @@ -627,7 +627,7 @@ Signed-off-by: Daniel Golle err = mtk_sgmii_init(eth); if (err) -@@ -5106,6 +5313,24 @@ static int mtk_probe(struct platform_dev +@@ -5037,6 +5244,24 @@ static int mtk_probe(struct platform_dev } } @@ -652,7 +652,7 @@ Signed-off-by: Daniel Golle if (MTK_HAS_CAPS(eth->soc->caps, MTK_SHARED_INT)) { err = devm_request_irq(eth->dev, eth->irq[0], mtk_handle_irq, 0, -@@ -5209,6 +5434,11 @@ static int mtk_remove(struct platform_de +@@ -5140,6 +5365,11 @@ static int mtk_remove(struct platform_de mtk_stop(eth->netdev[i]); mac = netdev_priv(eth->netdev[i]); phylink_disconnect_phy(mac->phylink); diff --git a/target/linux/generic/pending-6.6/738-01-net-ethernet-mtk_eth_soc-reduce-rx-ring-size-for-older.patch b/target/linux/generic/pending-6.6/738-01-net-ethernet-mtk_eth_soc-reduce-rx-ring-size-for-older.patch index f8b3bb84595f04..83f7efe6369bb1 100644 --- a/target/linux/generic/pending-6.6/738-01-net-ethernet-mtk_eth_soc-reduce-rx-ring-size-for-older.patch +++ b/target/linux/generic/pending-6.6/738-01-net-ethernet-mtk_eth_soc-reduce-rx-ring-size-for-older.patch @@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -5470,7 +5470,7 @@ static const struct mtk_soc_data mt2701_ +@@ -5459,7 +5459,7 @@ static const struct mtk_soc_data mt7622_ .desc_size = sizeof(struct mtk_rx_dma), .irq_done_mask = MTK_RX_DONE_INT, .dma_l4_valid = RX_DMA_L4_VALID, @@ -39,7 +39,7 @@ Signed-off-by: Felix Fietkau .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5498,7 +5498,7 @@ static const struct mtk_soc_data mt7621_ +@@ -5488,7 +5488,7 @@ static const struct mtk_soc_data mt7623_ .desc_size = sizeof(struct mtk_rx_dma), .irq_done_mask = MTK_RX_DONE_INT, .dma_l4_valid = RX_DMA_L4_VALID, @@ -48,7 +48,7 @@ Signed-off-by: Felix Fietkau .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5528,7 +5528,7 @@ static const struct mtk_soc_data mt7622_ +@@ -5514,7 +5514,7 @@ static const struct mtk_soc_data mt7629_ .desc_size = sizeof(struct mtk_rx_dma), .irq_done_mask = MTK_RX_DONE_INT, .dma_l4_valid = RX_DMA_L4_VALID, @@ -57,48 +57,3 @@ Signed-off-by: Felix Fietkau .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5557,7 +5557,7 @@ static const struct mtk_soc_data mt7623_ - .desc_size = sizeof(struct mtk_rx_dma), - .irq_done_mask = MTK_RX_DONE_INT, - .dma_l4_valid = RX_DMA_L4_VALID, -- .dma_size = MTK_DMA_SIZE(2K), -+ .dma_size = MTK_DMA_SIZE(512), - .dma_max_len = MTK_TX_DMA_BUF_LEN, - .dma_len_offset = 16, - }, -@@ -5583,7 +5583,7 @@ static const struct mtk_soc_data mt7629_ - .desc_size = sizeof(struct mtk_rx_dma), - .irq_done_mask = MTK_RX_DONE_INT, - .dma_l4_valid = RX_DMA_L4_VALID, -- .dma_size = MTK_DMA_SIZE(2K), -+ .dma_size = MTK_DMA_SIZE(512), - .dma_max_len = MTK_TX_DMA_BUF_LEN, - .dma_len_offset = 16, - }, -@@ -5615,7 +5615,7 @@ static const struct mtk_soc_data mt7981_ - .dma_l4_valid = RX_DMA_L4_VALID_V2, - .dma_max_len = MTK_TX_DMA_BUF_LEN, - .dma_len_offset = 16, -- .dma_size = MTK_DMA_SIZE(2K), -+ .dma_size = MTK_DMA_SIZE(512), - }, - }; - -@@ -5645,7 +5645,7 @@ static const struct mtk_soc_data mt7986_ - .dma_l4_valid = RX_DMA_L4_VALID_V2, - .dma_max_len = MTK_TX_DMA_BUF_LEN, - .dma_len_offset = 16, -- .dma_size = MTK_DMA_SIZE(2K), -+ .dma_size = MTK_DMA_SIZE(1K), - }, - }; - -@@ -5698,7 +5698,7 @@ static const struct mtk_soc_data rt5350_ - .dma_l4_valid = RX_DMA_L4_VALID_PDMA, - .dma_max_len = MTK_TX_DMA_BUF_LEN, - .dma_len_offset = 16, -- .dma_size = MTK_DMA_SIZE(2K), -+ .dma_size = MTK_DMA_SIZE(256), - }, - }; - diff --git a/target/linux/generic/pending-6.6/738-02-net-ethernet-mtk_eth_soc-do-not-enable-page-pool-sta.patch b/target/linux/generic/pending-6.6/738-02-net-ethernet-mtk_eth_soc-do-not-enable-page-pool-sta.patch index 349af33524e6c6..3ca41b2a03e351 100644 --- a/target/linux/generic/pending-6.6/738-02-net-ethernet-mtk_eth_soc-do-not-enable-page-pool-sta.patch +++ b/target/linux/generic/pending-6.6/738-02-net-ethernet-mtk_eth_soc-do-not-enable-page-pool-sta.patch @@ -25,7 +25,7 @@ Signed-off-by: Felix Fietkau help --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4582,6 +4582,7 @@ static int mtk_get_sset_count(struct net +@@ -4572,6 +4572,7 @@ static int mtk_get_sset_count(struct net static void mtk_ethtool_pp_stats(struct mtk_eth *eth, u64 *data) { @@ -33,7 +33,7 @@ Signed-off-by: Felix Fietkau struct page_pool_stats stats = {}; int i; -@@ -4594,6 +4595,7 @@ static void mtk_ethtool_pp_stats(struct +@@ -4584,6 +4585,7 @@ static void mtk_ethtool_pp_stats(struct page_pool_get_stats(ring->page_pool, &stats); } page_pool_ethtool_stats_get(data, &stats); From 6d46015d8b31373aa71c703de9fc409f2430646d Mon Sep 17 00:00:00 2001 From: Goetz Goerisch Date: Mon, 26 May 2025 14:46:57 +0200 Subject: [PATCH 688/877] x86: add missing configuration Added settings: x86: CONFIG_MITIGATION_ITS=y [1] [1] https://web.git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-6.6.y&id=f7ef7f6ccf2bc3909ef5e50cbe9edf2bac71e1bd Co-authored-by: Mieczyslaw Nalewaj Signed-off-by: Mieczyslaw Nalewaj Signed-off-by: Goetz Goerisch Link: https://github.com/openwrt/openwrt/pull/18924 Signed-off-by: Robert Marko --- target/linux/x86/config-6.6 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/x86/config-6.6 b/target/linux/x86/config-6.6 index 2b6ab88dc3e92f..4fbc0c538b7c04 100644 --- a/target/linux/x86/config-6.6 +++ b/target/linux/x86/config-6.6 @@ -243,6 +243,7 @@ CONFIG_MICROCODE_INITRD32=y CONFIG_MICROCODE_LATE_FORCE_MINREV=y CONFIG_MICROCODE_LATE_LOADING=y CONFIG_MIGRATION=y +CONFIG_MITIGATION_ITS=y CONFIG_MITIGATION_RFDS=y CONFIG_MITIGATION_SPECTRE_BHI=y # CONFIG_MK6 is not set From 2f289e3b7452ac877632d9f3b2237f8276076a79 Mon Sep 17 00:00:00 2001 From: Tomasz Maciej Nowak Date: Wed, 28 May 2025 15:26:23 +0200 Subject: [PATCH 689/877] libiconv: fix compilation on hosts GCC=15 Backport upstream commit dropping external definition of mbrtowc. The said definition conflicts with one provided by GCC 15. Issue found on 24.10 SDK. Signed-off-by: Tomasz Maciej Nowak --- package/libs/libiconv-full/Makefile | 2 +- ...ing-a-function-declaration-without-a.patch | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 package/libs/libiconv-full/patches/001-Fix-a-clang-warning-a-function-declaration-without-a.patch diff --git a/package/libs/libiconv-full/Makefile b/package/libs/libiconv-full/Makefile index 0c793973a05f8a..8837942585903f 100644 --- a/package/libs/libiconv-full/Makefile +++ b/package/libs/libiconv-full/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libiconv-full PKG_VERSION:=1.17 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=libiconv-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@GNU/libiconv diff --git a/package/libs/libiconv-full/patches/001-Fix-a-clang-warning-a-function-declaration-without-a.patch b/package/libs/libiconv-full/patches/001-Fix-a-clang-warning-a-function-declaration-without-a.patch new file mode 100644 index 00000000000000..86cd2bc973c5c0 --- /dev/null +++ b/package/libs/libiconv-full/patches/001-Fix-a-clang-warning-a-function-declaration-without-a.patch @@ -0,0 +1,33 @@ +From e46dee2f581c1167137bcd045e114e96a9f00483 Mon Sep 17 00:00:00 2001 +From: Bruno Haible +Date: Sun, 29 Jan 2023 20:07:21 +0100 +Subject: [PATCH] Fix a clang warning "a function declaration without a + prototype...". + +* lib/loop_wchar.h (mbrtowc): Don't declare. Drop portability to BeOS. +--- + lib/loop_wchar.h | 3 +-- + 1 file changed, 1 insertions(+), 2 deletions(-) + +diff --git a/lib/loop_wchar.h b/lib/loop_wchar.h +index b3edc2925c60..9eb508e81a4f 100644 +--- a/lib/loop_wchar.h ++++ b/lib/loop_wchar.h +@@ -1,5 +1,5 @@ + /* +- * Copyright (C) 2000-2002, 2005-2006, 2008-2009, 2011 Free Software Foundation, Inc. ++ * Copyright (C) 2000-2002, 2005-2006, 2008-2009, 2011, 2023 Free Software Foundation, Inc. + * This file is part of the GNU LIBICONV Library. + * + * The GNU LIBICONV Library is free software; you can redistribute it +@@ -36,7 +36,6 @@ + # include + # define BUF_SIZE 64 /* assume MB_LEN_MAX <= 64 */ + /* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */ +- extern size_t mbrtowc (); + # ifdef mbstate_t + # define mbrtowc(pwc, s, n, ps) (mbrtowc)(pwc, s, n, 0) + # define mbsinit(ps) 1 +-- +2.49.0 + From 3b2051ce44517cc7f37ffe6306f6025a77a01ed2 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Sun, 4 May 2025 22:38:10 +0200 Subject: [PATCH 690/877] tools/b43-tools: update to latest version, fix C23 build Update b43-tools to the latest upstream version to fix a compilation error with C23: util.h:25:15: error: 'bool' cannot be defined via 'typedef' 25 | typedef _Bool bool; | ^~~~ Changelog: c6fc53f replace custom bool typedef with dadf30c fix format warning in compilation 2fe10ea b43-fwdump: Fix forwarding of arguments to disassembler Link: https://github.com/openwrt/openwrt/pull/18708 Signed-off-by: Nick Hainke (cherry picked from commit f8da45e25d9efcabbad65f1300de1bca7718b134) --- tools/b43-tools/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/b43-tools/Makefile b/tools/b43-tools/Makefile index 8ec13309beb898..eb2fb284a89536 100644 --- a/tools/b43-tools/Makefile +++ b/tools/b43-tools/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=b43-tools -PKG_DATE:=2022-07-05 +PKG_DATE:=2025-05-04 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/mbuesch/b43-tools.git -PKG_SOURCE_VERSION:=2fe10ea6690df9a068cb21cde537236bae784a14 -PKG_MIRROR_HASH:=4009d6c1f9ede43102897d6ebf4bd954331f3c4e2a94d4e61c0e5f303f929914 +PKG_SOURCE_VERSION:=cc352349153eeda9c164ecd0d06c161a59ec8753 +PKG_MIRROR_HASH:=c1feba649c2cf3e984a2b897b4a6938252515c0833358d51bd15e049b6b2fb65 include $(INCLUDE_DIR)/host-build.mk From a2ac2c5ea3ccde68ad08fe4188e94090d8cf2e3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Sat, 31 May 2025 09:00:21 +0200 Subject: [PATCH 691/877] generic: backport bcm63xx SPI reset fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes SPI and HSSPI coexistance on bmips bcm6362 and bcm63268. Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit ba1017bf74a6735a23d8873623fb48b42d831c56) --- ....16-spi-bcm63xx-spi-fix-shared-reset.patch | 32 +++++++++++++++++++ ...6-spi-bcm63xx-hsspi-fix-shared-reset.patch | 32 +++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 target/linux/generic/backport-6.6/421-01-v6.16-spi-bcm63xx-spi-fix-shared-reset.patch create mode 100644 target/linux/generic/backport-6.6/421-02-v6.16-spi-bcm63xx-hsspi-fix-shared-reset.patch diff --git a/target/linux/generic/backport-6.6/421-01-v6.16-spi-bcm63xx-spi-fix-shared-reset.patch b/target/linux/generic/backport-6.6/421-01-v6.16-spi-bcm63xx-spi-fix-shared-reset.patch new file mode 100644 index 00000000000000..e886350d26d9a1 --- /dev/null +++ b/target/linux/generic/backport-6.6/421-01-v6.16-spi-bcm63xx-spi-fix-shared-reset.patch @@ -0,0 +1,32 @@ +From 5ad20e3d8cfe3b2e42bbddc7e0ebaa74479bb589 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= +Date: Thu, 29 May 2025 15:09:14 +0200 +Subject: [PATCH] spi: bcm63xx-spi: fix shared reset +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Some bmips SoCs (bcm6362, bcm63268) share the same SPI reset for both SPI +and HSSPI controllers, so reset shouldn't be exclusive. + +Fixes: 38807adeaf1e ("spi: bcm63xx-spi: add reset support") +Reported-by: Jonas Gorski +Signed-off-by: Álvaro Fernández Rojas +Reviewed-by: Florian Fainelli +Link: https://patch.msgid.link/20250529130915.2519590-2-noltari@gmail.com +Signed-off-by: Mark Brown +--- + drivers/spi/spi-bcm63xx.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/spi/spi-bcm63xx.c ++++ b/drivers/spi/spi-bcm63xx.c +@@ -523,7 +523,7 @@ static int bcm63xx_spi_probe(struct plat + return PTR_ERR(clk); + } + +- reset = devm_reset_control_get_optional_exclusive(dev, NULL); ++ reset = devm_reset_control_get_optional_shared(dev, NULL); + if (IS_ERR(reset)) + return PTR_ERR(reset); + diff --git a/target/linux/generic/backport-6.6/421-02-v6.16-spi-bcm63xx-hsspi-fix-shared-reset.patch b/target/linux/generic/backport-6.6/421-02-v6.16-spi-bcm63xx-hsspi-fix-shared-reset.patch new file mode 100644 index 00000000000000..3c30269d079a59 --- /dev/null +++ b/target/linux/generic/backport-6.6/421-02-v6.16-spi-bcm63xx-hsspi-fix-shared-reset.patch @@ -0,0 +1,32 @@ +From 3d6d84c8f2f66d3fd6a43a1e2ce8e6b54c573960 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= +Date: Thu, 29 May 2025 15:09:15 +0200 +Subject: [PATCH] spi: bcm63xx-hsspi: fix shared reset +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Some bmips SoCs (bcm6362, bcm63268) share the same SPI reset for both SPI +and HSSPI controllers, so reset shouldn't be exclusive. + +Fixes: 0eeadddbf09a ("spi: bcm63xx-hsspi: add reset support") +Reported-by: Jonas Gorski +Signed-off-by: Álvaro Fernández Rojas +Reviewed-by: Florian Fainelli +Link: https://patch.msgid.link/20250529130915.2519590-3-noltari@gmail.com +Signed-off-by: Mark Brown +--- + drivers/spi/spi-bcm63xx-hsspi.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/spi/spi-bcm63xx-hsspi.c ++++ b/drivers/spi/spi-bcm63xx-hsspi.c +@@ -745,7 +745,7 @@ static int bcm63xx_hsspi_probe(struct pl + if (IS_ERR(clk)) + return PTR_ERR(clk); + +- reset = devm_reset_control_get_optional_exclusive(dev, NULL); ++ reset = devm_reset_control_get_optional_shared(dev, NULL); + if (IS_ERR(reset)) + return PTR_ERR(reset); + From 6706c8a6e358857e916737f5e0bb41d40003de26 Mon Sep 17 00:00:00 2001 From: Henry Tung Date: Fri, 9 May 2025 16:45:34 -0700 Subject: [PATCH 692/877] tools/llvm-bpf: fix compilation with GCC15 Add cstdint include to SmallVector.h. Backported from https://github.com/llvm/llvm-project/commit/7e44305041d96b064c197216b931ae3917a34ac1. Signed-off-by: Henry Tung Link: https://github.com/openwrt/openwrt/pull/18767 Signed-off-by: Robert Marko (cherry picked from commit 53054fead58aeba61b592473e26b1798452856c3) --- tools/llvm-bpf/patches/100-gcc15.patch | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tools/llvm-bpf/patches/100-gcc15.patch diff --git a/tools/llvm-bpf/patches/100-gcc15.patch b/tools/llvm-bpf/patches/100-gcc15.patch new file mode 100644 index 00000000000000..5b92af04e40761 --- /dev/null +++ b/tools/llvm-bpf/patches/100-gcc15.patch @@ -0,0 +1,23 @@ +From 7e44305041d96b064c197216b931ae3917a34ac1 Mon Sep 17 00:00:00 2001 +From: Sam James +Date: Fri, 2 Aug 2024 23:07:21 +0100 +Subject: [PATCH] [ADT] Add `` to SmallVector (#101761) + +SmallVector uses `uint32_t`, `uint64_t` without including `` +which fails to build w/ GCC 15 after a change in libstdc++ [0] + +[0] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=3a817a4a5a6d94da9127af3be9f84a74e3076ee2 +--- + llvm/include/llvm/ADT/SmallVector.h | 1 + + 1 file changed, 1 insertion(+) + +--- a/llvm/include/llvm/ADT/SmallVector.h ++++ b/llvm/include/llvm/ADT/SmallVector.h +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + #include + #include + #include From 4e63a066369305b77e1b5d8e9b7646ee5ea33745 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Sat, 31 May 2025 09:16:21 +0200 Subject: [PATCH 693/877] generic: backport brcm legacy dsa tag fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backport a small fix for brcm legacy dsa tags that has been accepted for linux v6.16. Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 84eefb493bf5924b78c33155fb7a7147682f8240) --- ...brcm-legacy-fix-pskb_may_pull-length.patch | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 target/linux/generic/backport-6.6/725-01-v6.16-net-dsa-tag_brcm-legacy-fix-pskb_may_pull-length.patch diff --git a/target/linux/generic/backport-6.6/725-01-v6.16-net-dsa-tag_brcm-legacy-fix-pskb_may_pull-length.patch b/target/linux/generic/backport-6.6/725-01-v6.16-net-dsa-tag_brcm-legacy-fix-pskb_may_pull-length.patch new file mode 100644 index 00000000000000..9fa88d2d3f94d4 --- /dev/null +++ b/target/linux/generic/backport-6.6/725-01-v6.16-net-dsa-tag_brcm-legacy-fix-pskb_may_pull-length.patch @@ -0,0 +1,31 @@ +From efdddc4484859082da6c7877ed144c8121c8ea55 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= +Date: Thu, 29 May 2025 14:44:06 +0200 +Subject: [PATCH] net: dsa: tag_brcm: legacy: fix pskb_may_pull length +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +BRCM_LEG_PORT_ID was incorrectly used for pskb_may_pull length. +The correct check is BRCM_LEG_TAG_LEN + VLAN_HLEN, or 10 bytes. + +Fixes: 964dbf186eaa ("net: dsa: tag_brcm: add support for legacy tags") +Signed-off-by: Álvaro Fernández Rojas +Reviewed-by: Florian Fainelli +Link: https://patch.msgid.link/20250529124406.2513779-1-noltari@gmail.com +Signed-off-by: Jakub Kicinski +--- + net/dsa/tag_brcm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/net/dsa/tag_brcm.c ++++ b/net/dsa/tag_brcm.c +@@ -257,7 +257,7 @@ static struct sk_buff *brcm_leg_tag_rcv( + int source_port; + u8 *brcm_tag; + +- if (unlikely(!pskb_may_pull(skb, BRCM_LEG_PORT_ID))) ++ if (unlikely(!pskb_may_pull(skb, BRCM_LEG_TAG_LEN + VLAN_HLEN))) + return NULL; + + brcm_tag = dsa_etype_header_pos_rx(skb); From 796b7681bf0bad0174ee9d2caf5e025ab0c43493 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Mon, 13 Jan 2025 15:12:38 +0100 Subject: [PATCH 694/877] ipq40xx: turn on Teltonika RUTX50 modem by default Turn on the 5G modem of the RUTX50 on by default. This allows to make the modem detectable on a fresh installation OOTB without further intervention. Signed-off-by: David Bauer (cherry picked from commit ac1ad1a7ad6bb3a528def4154e91dd398fda8db5) --- .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts index 56d920a6ddeae7..a2974597950b98 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts @@ -29,7 +29,7 @@ gpio_modem_power { gpio-export,name = "modem_power"; - gpio-export,output = <0>; + gpio-export,output = <1>; gpios = <&shift_io 9 GPIO_ACTIVE_HIGH>; }; From cab22784b1844c9b250661543a17c223add5d195 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Mon, 13 Jan 2025 15:18:31 +0100 Subject: [PATCH 695/877] ipq40xx: use correct wired MAC-addresses for RUTX50 The Teltonika RUTX50 mac-addresses on its wired interfaces are currently random on every boot. Setting the mac-addresses from device-tree using nvmem does not work, as the vendor bootloader mangles the mtd partitions, removing the nvmem-cells property. To remedy the random mac-addresse, set the correct ones in preinit. Signed-off-by: David Bauer (cherry picked from commit 08c93512fe39ac25f78fb2ab0f32cb2a830c5b70) --- .../lib/preinit/05_set_iface_mac_ipq40xx.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh b/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh index 1ede544aacc3b0..092f9da4407b21 100644 --- a/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh +++ b/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh @@ -43,6 +43,17 @@ preinit_set_mac_address() { ip link set dev sw-eth1 address "$base_mac" ip link set dev sw-eth2 address $(macaddr_add "$base_mac" 1) ;; + teltonika,rutx50) + # Vendor Bootloader removes nvmem-cells from partition, + # so this needs to be done here. + base_mac="$(mtd_get_mac_binary 0:CONFIG 0x0)" + ip link set dev eth0 address "$base_mac" + ip link set dev lan1 address "$base_mac" + ip link set dev lan2 address "$base_mac" + ip link set dev lan3 address "$base_mac" + ip link set dev lan4 address "$base_mac" + ip link set dev wan address "$(macaddr_add "$base_mac" 1)" + ;; zyxel,nbg6617) base_mac=$(cat /sys/class/net/eth0/address) ip link set dev eth0 address $(macaddr_add "$base_mac" 2) From 0a21ab73121c7db7c9c92c7cbf2a7b8b586007a6 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Mon, 13 Jan 2025 15:18:51 +0100 Subject: [PATCH 696/877] ipq40xx: enable WiFi LED for Teltonika RUTX50 Enable activity on the WiFi LEDs of the Teltonika RUTX50 like other boards in the ipq40xx target. Signed-off-by: David Bauer (cherry picked from commit 54463f1e2e17d14a24d3504acea8107f45228f27) --- .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts index a2974597950b98..ae244bd126ab20 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts @@ -103,11 +103,13 @@ led-10 { label = "green:wifi2g"; gpios = <&shift_io 12 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy0tpt"; }; led-11 { label = "green:wifi5g"; gpios = <&shift_io 13 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy1tpt"; }; }; From 0c43acc349a73b326d2aa19fcbc25f4f5875d53d Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 30 May 2025 21:25:38 +0200 Subject: [PATCH 697/877] ipq-wifi: update to Git HEAD (2025-05-30) 576ade747259 CI: add action that prints info about submited BDF-s 1d688e8654a5 qca9888 : add BDF for Yuncore WB5G08 ddfd9d2f3a8e ipq60xx: rename BDF for EAP623-Outdoor HD v1 bab36c1d947d ath10k: drop upstramed board files 09e5afab85b2 CI: add QCA9988 fde3d2a7ce59 qca9888: add TP-Link Archer C6 v2 (EU) BDF Signed-off-by: Christian Marangi (cherry picked from commit 8dd0020d1aaeb29a4da46666fbaaebda13249eb7) Signed-off-by: Leopoldo Pla Link: https://github.com/openwrt/openwrt/pull/19035 Signed-off-by: Nick Hainke --- package/firmware/ipq-wifi/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index 4732a14b1b4e1b..cdad6d45cee8fc 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:=2024-10-08 -PKG_SOURCE_VERSION:=dcbab62272bf5cab2ed857bc655d240970e14f2a -PKG_MIRROR_HASH:=e53a3872abf5e35db6baaceb56e6ffa289f8dd9b6226cf8a4d5b87b541179175 +PKG_SOURCE_DATE:=2025-05-30 +PKG_SOURCE_VERSION:=fde3d2a7ce59be389224304049a4a5b9ca49a45e +PKG_MIRROR_HASH:=2e149366118192d4976baf42ac23d22ef32e477feb111d2756a2411278b6cf46 PKG_FLAGS:=nonshared include $(INCLUDE_DIR)/package.mk From 8979768b979b7346cea0689670bdc1900787417e Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 30 May 2025 21:33:44 +0200 Subject: [PATCH 698/877] ipq-wifi: Add entry for TP-Link Archer C6 v2 Add IPQ Wifi entry for Ath79 TP-Link Archer C6 v2. Signed-off-by: Christian Marangi (cherry picked from commit c88515dd8685e719f232b3797079aba7ae069f7e) Signed-off-by: Leopoldo Pla Link: https://github.com/openwrt/openwrt/pull/19035 Signed-off-by: Nick Hainke --- package/firmware/ipq-wifi/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index cdad6d45cee8fc..a03e3037375d46 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -54,6 +54,7 @@ ALLWIFIBOARDS:= \ skspruce_wia3300-20 \ spectrum_sax1v1k \ tplink_eap660hd-v1 \ + tplink_archer-c6-v2 \ wallys_dr40x9 \ xiaomi_ax3600 \ xiaomi_ax9000 \ @@ -181,6 +182,7 @@ $(eval $(call generate-ipq-wifi-package,redmi_ax6,Redmi AX6)) $(eval $(call generate-ipq-wifi-package,skspruce_wia3300-20,SKSpruce WIA3300-20)) $(eval $(call generate-ipq-wifi-package,spectrum_sax1v1k,Spectrum SAX1V1K)) $(eval $(call generate-ipq-wifi-package,tplink_eap660hd-v1,TP-Link EAP660 HD v1)) +$(eval $(call generate-ipq-wifi-package,tplink_archer-c6-v2,TP-Link Archer C6 V2)) $(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)) From 0bf055640190f4b0093dd4ee7f2665164099a55b Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 30 May 2025 21:21:09 +0200 Subject: [PATCH 699/877] ath79: add calibtation variant for TP-Link Archer C6 v2 Now that we have a board file, add calibration variant for TP-Link Archer C6 v2 and add ipq-wifi package for it. Signed-off-by: Christian Marangi (cherry picked from commit 427c4aa266169b67aa26c0817b807d2921b4bba5) Signed-off-by: Leopoldo Pla Link: https://github.com/openwrt/openwrt/pull/19035 Signed-off-by: Nick Hainke --- target/linux/ath79/dts/qca9563_tplink_archer-c6-v2.dts | 1 + target/linux/ath79/image/generic-tp-link.mk | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/target/linux/ath79/dts/qca9563_tplink_archer-c6-v2.dts b/target/linux/ath79/dts/qca9563_tplink_archer-c6-v2.dts index 66ae2d1ffd52c7..36281f4caa137e 100644 --- a/target/linux/ath79/dts/qca9563_tplink_archer-c6-v2.dts +++ b/target/linux/ath79/dts/qca9563_tplink_archer-c6-v2.dts @@ -89,6 +89,7 @@ reg = <0x0000 0 0 0 0>; nvmem-cells = <&precal_art_5000>, <&macaddr_info_8 (-1)>; nvmem-cell-names = "pre-calibration", "mac-address"; + qcom,ath10k-calibration-variant = "TP-Link-Archer-c6-v2"; }; }; diff --git a/target/linux/ath79/image/generic-tp-link.mk b/target/linux/ath79/image/generic-tp-link.mk index c42338db783203..9c1cf90a9196ca 100644 --- a/target/linux/ath79/image/generic-tp-link.mk +++ b/target/linux/ath79/image/generic-tp-link.mk @@ -104,7 +104,7 @@ define Device/tplink_archer-c6-v2 DEVICE_MODEL := Archer C6 DEVICE_VARIANT := v2 (EU/RU/JP) TPLINK_BOARD_ID := ARCHER-C6-V2 - DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca9888-ct + DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca9888-ct -ath10k-board-qca9888 ipq-wifi-tplink_archer-c6-v2 endef TARGET_DEVICES += tplink_archer-c6-v2 From 2a348bdbef52adb99280f01ac285d4415e91f4d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Thu, 5 Jun 2025 20:37:49 +0200 Subject: [PATCH 700/877] bcm27xx-gpu-fw: update to v1.20250430 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Full changelog: https://github.com/raspberrypi/firmware/compare/1.20250305...1.20250430 Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 79f097faaec0b944be6dd4d53f06c887d63b43bc) --- package/kernel/bcm27xx-gpu-fw/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/kernel/bcm27xx-gpu-fw/Makefile b/package/kernel/bcm27xx-gpu-fw/Makefile index 580290d88016da..2d90406b58926d 100644 --- a/package/kernel/bcm27xx-gpu-fw/Makefile +++ b/package/kernel/bcm27xx-gpu-fw/Makefile @@ -2,13 +2,13 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=bcm27xx-gpu-fw -PKG_VERSION:=2025.03.05 +PKG_VERSION:=2025.04.30 PKG_VERSION_REAL:=1.$(subst .,,$(PKG_VERSION)) PKG_RELEASE:=1 PKG_SOURCE:=raspi-firmware_$(PKG_VERSION_REAL).orig.tar.xz PKG_SOURCE_URL:=https://github.com/raspberrypi/firmware/releases/download/$(PKG_VERSION_REAL) -PKG_HASH:=f697079cd15389c0d8650283eb911c53a64b22550138704eb50e1145e8330b03 +PKG_HASH:=25bcff5992c6d7057de4a5c6834b7f90b7136fe12aa63fa32793329bf74a95bf PKG_FLAGS:=nonshared From 79cfac227e2f85fb2d1496b95c62245996c3f2b8 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Fri, 21 Feb 2025 21:12:23 +0800 Subject: [PATCH 701/877] tools: zstd: update to 1.5.7 This new version has some performance enhancements. Changelog: https://github.com/facebook/zstd/releases/tag/v1.5.7 Upstreamed patch: 001-Provide-variant-pkg-config-file-for-multi-threaded-s.patch[1] [1] https://github.com/facebook/zstd/commit/f1f1ae369a4cefd3474b3528e8d1847b18750605 Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/18064 Signed-off-by: Robert Marko (cherry picked from commit ce67f0844987a9c3aac2ed510de9ddaaa1ed612f) --- tools/zstd/Makefile | 4 +- ...pkg-config-file-for-multi-threaded-s.patch | 126 ------------------ 2 files changed, 2 insertions(+), 128 deletions(-) delete mode 100644 tools/zstd/patches/001-Provide-variant-pkg-config-file-for-multi-threaded-s.patch diff --git a/tools/zstd/Makefile b/tools/zstd/Makefile index e1d36c59cfbe87..88a961f323efc4 100644 --- a/tools/zstd/Makefile +++ b/tools/zstd/Makefile @@ -1,11 +1,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=zstd -PKG_VERSION:=1.5.6 +PKG_VERSION:=1.5.7 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/facebook/zstd/releases/download/v$(PKG_VERSION) -PKG_HASH:=8c29e06cf42aacc1eafc4077ae2ec6c6fcb96a626157e0593d5e82a34fd403c1 +PKG_HASH:=eb33e51f49a15e023950cd7825ca74a4a2b43db8354825ac24fc1b7ee09e6fa3 PKG_LICENSE:=BSD-3-Clause PKG_LICENSE_FILES:=LICENSE diff --git a/tools/zstd/patches/001-Provide-variant-pkg-config-file-for-multi-threaded-s.patch b/tools/zstd/patches/001-Provide-variant-pkg-config-file-for-multi-threaded-s.patch deleted file mode 100644 index 1bbcaf4c8a10a3..00000000000000 --- a/tools/zstd/patches/001-Provide-variant-pkg-config-file-for-multi-threaded-s.patch +++ /dev/null @@ -1,126 +0,0 @@ -From f1f1ae369a4cefd3474b3528e8d1847b18750605 Mon Sep 17 00:00:00 2001 -From: Christian Marangi -Date: Sat, 6 Apr 2024 14:41:54 +0200 -Subject: [PATCH] Provide variant pkg-config file for multi-threaded static lib - -Multi-threaded static library require -pthread to correctly link and works. -The pkg-config we provide tho only works with dynamic multi-threaded library -and won't provide the correct libs and cflags values if lib-mt is used. - -To handle this, introduce an env variable MT to permit advanced user to -install and generate a correct pkg-config file for lib-mt or detect if -lib-mt target is called. - -With MT env set on calling make install-pc, libzstd.pc.in is a -pkg-config file for a multi-threaded static library. - -On calling make lib-mt, a libzstd.pc is generated for a multi-threaded -static library as it's what asked by the user by forcing it. - -libzstd.pc is changed to PHONY to force regeneration of it on calling -lib targets or install-pc to handle case where the same directory is -used for mixed compilation. - -This was notice while migrating from meson to make build system where -meson generates a correct .pc file while make doesn't. - -Signed-off-by: Christian Marangi ---- - lib/Makefile | 20 +++++++++++++++++++- - lib/README.md | 4 ++++ - lib/libzstd.pc.in | 4 ++-- - 3 files changed, 25 insertions(+), 3 deletions(-) - ---- a/lib/Makefile -+++ b/lib/Makefile -@@ -63,6 +63,8 @@ CPPFLAGS_DYNLIB += -DZSTD_MULTITHREAD # - LDFLAGS_DYNLIB += -pthread - CPPFLAGS_STATICLIB += # static library build defaults to single-threaded - -+# pkg-config Libs.private points to LDFLAGS_DYNLIB -+PCLIB := $(LDFLAGS_DYNLIB) - - ifeq ($(findstring GCC,$(CCVER)),GCC) - decompress/zstd_decompress_block.o : CFLAGS+=-fno-tree-vectorize -@@ -186,12 +188,15 @@ lib : libzstd.a libzstd - %-mt : CPPFLAGS_DYNLIB := -DZSTD_MULTITHREAD - %-mt : CPPFLAGS_STATICLIB := -DZSTD_MULTITHREAD - %-mt : LDFLAGS_DYNLIB := -pthread -+%-mt : PCLIB := -+%-mt : PCMTLIB := $(LDFLAGS_DYNLIB) - %-mt : % - @echo multi-threaded build completed - - %-nomt : CPPFLAGS_DYNLIB := - %-nomt : LDFLAGS_DYNLIB := - %-nomt : CPPFLAGS_STATICLIB := -+%-nomt : PCLIB := - %-nomt : % - @echo single-threaded build completed - -@@ -292,6 +297,14 @@ PCLIBPREFIX := $(if $(findstring $(LIBDI - # to PREFIX, rather than as a resolved value. - PCEXEC_PREFIX := $(if $(HAS_EXPLICIT_EXEC_PREFIX),$(EXEC_PREFIX),$${prefix}) - -+ -+ifneq ($(MT),) -+ PCLIB := -+ PCMTLIB := $(LDFLAGS_DYNLIB) -+else -+ PCLIB := $(LDFLAGS_DYNLIB) -+endif -+ - ifneq (,$(filter $(UNAME),FreeBSD NetBSD DragonFly)) - PKGCONFIGDIR ?= $(PREFIX)/libdata/pkgconfig - else -@@ -308,6 +321,10 @@ INSTALL_PROGRAM ?= $(INSTALL) - INSTALL_DATA ?= $(INSTALL) -m 644 - - -+# pkg-config library define. -+# For static single-threaded library declare -pthread in Libs.private -+# For static multi-threaded library declare -pthread in Libs and Cflags -+.PHONY: libzstd.pc - libzstd.pc: libzstd.pc.in - @echo creating pkgconfig - @sed \ -@@ -316,7 +333,8 @@ libzstd.pc: libzstd.pc.in - -e 's|@INCLUDEDIR@|$(PCINCPREFIX)$(PCINCDIR)|' \ - -e 's|@LIBDIR@|$(PCLIBPREFIX)$(PCLIBDIR)|' \ - -e 's|@VERSION@|$(VERSION)|' \ -- -e 's|@LIBS_PRIVATE@|$(LDFLAGS_DYNLIB)|' \ -+ -e 's|@LIBS_MT@|$(PCMTLIB)|' \ -+ -e 's|@LIBS_PRIVATE@|$(PCLIB)|' \ - $< >$@ - - .PHONY: install ---- a/lib/README.md -+++ b/lib/README.md -@@ -27,12 +27,16 @@ Enabling multithreading requires 2 condi - - For convenience, we provide a build target to generate multi and single threaded libraries: - - Force enable multithreading on both dynamic and static libraries by appending `-mt` to the target, e.g. `make lib-mt`. -+ Note that the `.pc` generated on calling `make lib-mt` will already include the require Libs and Cflags. - - Force disable multithreading on both dynamic and static libraries by appending `-nomt` to the target, e.g. `make lib-nomt`. - - By default, as mentioned before, dynamic library is multithreaded, and static library is single-threaded, e.g. `make lib`. - - When linking a POSIX program with a multithreaded version of `libzstd`, - note that it's necessary to invoke the `-pthread` flag during link stage. - -+The `.pc` generated from `make install` or `make install-pc` always assume a single-threaded static library -+is compiled. To correctly generate a `.pc` for the multi-threaded static library, set `MT=1` as ENV variable. -+ - Multithreading capabilities are exposed - via the [advanced API defined in `lib/zstd.h`](https://github.com/facebook/zstd/blob/v1.4.3/lib/zstd.h#L351). - ---- a/lib/libzstd.pc.in -+++ b/lib/libzstd.pc.in -@@ -11,6 +11,6 @@ Name: zstd - Description: fast lossless compression algorithm library - URL: https://facebook.github.io/zstd/ - Version: @VERSION@ --Libs: -L${libdir} -lzstd -+Libs: -L${libdir} -lzstd @LIBS_MT@ - Libs.private: @LIBS_PRIVATE@ --Cflags: -I${includedir} -+Cflags: -I${includedir} @LIBS_MT@ From c7c7a1cfc0c203d1e731d16720c226355e286baf Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Mon, 26 May 2025 14:54:08 +0800 Subject: [PATCH 702/877] rockchip: add missing symbol Commit 7cace002baaf added a generic kernel patch that exposes a new symbol REALTEK_PHY_HWMON when REALTEK_PHY and HWMON are enabled. The new symbol was added to kmod-phy-realtek, but the kmod is not used in the rockchip target. Signed-off-by: Tianling Shen Link: https://github.com/openwrt/openwrt/pull/18921 Signed-off-by: Hauke Mehrtens --- target/linux/rockchip/armv8/config-6.6 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/rockchip/armv8/config-6.6 b/target/linux/rockchip/armv8/config-6.6 index 187a1bb6700f9b..6a1cc94bf70c4d 100644 --- a/target/linux/rockchip/armv8/config-6.6 +++ b/target/linux/rockchip/armv8/config-6.6 @@ -552,6 +552,7 @@ CONFIG_RATIONAL=y # CONFIG_RAVE_SP_CORE is not set CONFIG_RCU_TRACE=y CONFIG_REALTEK_PHY=y +CONFIG_REALTEK_PHY_HWMON=y CONFIG_REGMAP=y CONFIG_REGMAP_I2C=y CONFIG_REGMAP_IRQ=y From 871d7a9d68c568c57ce845bb60ff7fa83db18f2d Mon Sep 17 00:00:00 2001 From: "Leon M. Busch-George" Date: Sat, 19 Oct 2024 11:43:23 +0200 Subject: [PATCH 703/877] qmi: sort config variables a little and fix minor bugs Group 'local' declarations and 'json_get_vars', sort alphabetically within groups, and split off more generic parameters. - delegate and sourcefilter were not declared as local variables Signed-off-by: Leon M. Busch-George (cherry picked from commit bf768867dc0eea6b51d2db90a8f1380cc52529c1) Signed-off-by: Felix Baumann Link: https://github.com/openwrt/openwrt/pull/18965 Signed-off-by: Hauke Mehrtens --- .../utils/uqmi/files/lib/netifd/proto/qmi.sh | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 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 8ec577a90b7823..b08b225104848a 100755 --- a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh +++ b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh @@ -34,17 +34,20 @@ proto_qmi_init_config() { proto_qmi_setup() { local interface="$1" - local dataformat connstat plmn_mode mcc mnc - 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 + + local connstat dataformat mcc mnc plmn_mode + local cid_4 cid_6 pdh_4 pdh_6 + local dns1_6 dns2_6 gateway_6 ip_6 ip_prefix_length local profile_pdptype - json_get_vars device apn v6apn auth username password pincode delay modes - json_get_vars pdptype profile v6profile dhcp dhcpv6 sourcefilter delegate autoconnect plmn ip4table - json_get_vars ip6table timeout mtu $PROTO_DEFAULT_OPTIONS + local delegate ip4table ip6table mtu sourcefilter $PROTO_DEFAULT_OPTIONS + json_get_vars delegate ip4table ip6table mtu sourcefilter $PROTO_DEFAULT_OPTIONS + + local apn auth delay device modes password pdptype pincode username v6apn + json_get_vars apn auth delay device modes password pdptype pincode username v6apn + + local profile v6profile dhcp dhcpv6 autoconnect plmn timeout + json_get_vars profile v6profile dhcp dhcpv6 autoconnect plmn timeout [ "$timeout" = "" ] && timeout="10" From fd85c0df78804adafa1e6b21f25c131fc89bac0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Sepp=C3=A4l=C3=A4?= Date: Sat, 10 May 2025 13:54:56 +0300 Subject: [PATCH 704/877] qmi: increase SIM power-cycle timeouts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some modems and SIM cards take a bit longer to initialize after UIM has been powered off. Waiting too little time can cause the qmi protocol to end up in a loop repeatedly power-cycling the SIM card. Avoid that by a) increasing the time we unconditionally sleep after --uim-power-on b) increasing the time we allow uqmi to wait for response for --uim-get-sim-state Signed-off-by: Antti Seppälä Link: https://github.com/openwrt/openwrt/pull/18772 (cherry picked from commit d63663601de4feb2b7a049c9b0901f10e79496cb) Signed-off-by: Felix Baumann Link: https://github.com/openwrt/openwrt/pull/18965 Signed-off-by: Hauke Mehrtens --- package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 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 b08b225104848a..a6a3fdaa693297 100755 --- a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh +++ b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh @@ -107,7 +107,7 @@ proto_qmi_setup() { # Check if UIM application is stuck in illegal state local uim_state_timeout=0 while true; do - json_load "$(uqmi -s -d "$device" -t 1000 --uim-get-sim-state)" + json_load "$(uqmi -s -d "$device" -t 2000 --uim-get-sim-state)" json_get_var card_application_state card_application_state # SIM card is either completely absent or state is labeled as illegal @@ -122,7 +122,7 @@ proto_qmi_setup() { if [ "$uim_state_timeout" -lt "$timeout" ] || [ "$timeout" = "0" ]; then let uim_state_timeout++ - sleep 1 + sleep 5 continue fi From 6ddc43bc7a61cdb922679f4d975d3eee3f2f5e07 Mon Sep 17 00:00:00 2001 From: Sergey Shlukov Date: Mon, 17 Feb 2025 23:12:50 +0000 Subject: [PATCH 705/877] kernel: add kmod-leds-lp5523 Add kernel module for LP5523/LP55231 LED driver. The kmod-leds-lp5523 depends on kmod-leds-lp55xx-common. Signed-off-by: Sergey Shlukov Link: https://github.com/openwrt/openwrt/pull/17753 (cherry picked from commit 92ad1ea2455e4133ece012af054899de283c95c8) Link: https://github.com/openwrt/openwrt/pull/19050 Signed-off-by: Hauke Mehrtens --- package/kernel/linux/modules/leds.mk | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/package/kernel/linux/modules/leds.mk b/package/kernel/linux/modules/leds.mk index 0c42895bb2f3c9..a555e6bd7a23b5 100644 --- a/package/kernel/linux/modules/leds.mk +++ b/package/kernel/linux/modules/leds.mk @@ -299,6 +299,23 @@ endef $(eval $(call KernelPackage,leds-lp55xx-common)) +define KernelPackage/leds-lp5523 + SUBMENU:=$(LEDS_MENU) + TITLE:=LED driver for LP5523/LP55231 controllers + DEPENDS:=+kmod-i2c-core +kmod-leds-lp55xx-common + KCONFIG:=CONFIG_LEDS_LP5523 + FILES:=$(LINUX_DIR)/drivers/leds/leds-lp5523.ko + AUTOLOAD:=$(call AutoLoad,60,leds-lp5523,1) +endef + +define KernelPackage/leds-lp5523/description + This option enables support for Texas Instruments LP5523/LP55231 + LED controllers. +endef + +$(eval $(call KernelPackage,leds-lp5523)) + + define KernelPackage/leds-lp5562 SUBMENU:=$(LEDS_MENU) TITLE:=LED driver for LP5562 controllers From b39d82195d5a01cc2646fd4774a4dae3c57c03aa Mon Sep 17 00:00:00 2001 From: Sergey Shlukov Date: Tue, 3 Jun 2025 12:08:46 +0000 Subject: [PATCH 706/877] mediatek: add support for TP-Link Archer AX80v1(US/RU/CA) This commit adds support for TP-Link Archer AX80v1(US/RU/CA). Device specification SoC Type: MediaTek MT7986AV, Cortex-A53, 64-bit RAM: ESMT M15T4G16256 (512MB) Flash: ESMT F50L1G41LB (128 MB) Ethernet: MediaTek MT7531AE + 2.5GbE MaxLinear GPY211C0VC (SLNW8) Ethernet: 1x2.5Gbe (WAN/LAN 2.5Gbps), 4xGbE (WAN/LAN 1Gbps, LAN1, LAN2, LAN3) WLAN 2g: MediaTek MT7976GN WLAN 5g: MediaTek MT7976AN LEDs: 1 red,1 green,1 blue status LEDs, Buttons: 4 (Reset,ledswitch,wps,wlan), USB ports: 1 (USB 3.0) Power: 12 VDC, 3,3 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 Installation (UART) Place OpenWrt initramfs image on tftp server with IP 192.168.1.2 Attach UART, switch on the router and interrupt the boot process by pressing 'Ctrl-C' Load and run OpenWrt initramfs image: tftpboot initramfs-kernel.bin bootm !!Attention!! is very important! After entering OpenWrt, please set / update the environment variables: fw_setenv bootargs "ubi.mtd=ubi0 console=ttyS0,115200n1 loglevel=8 earlycon=uart8250,mmio32,0x11002000 init=/etc/preinit" 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),8M(mali_data)" fw_setenv tp_boot_idx 0 Run 'sysupgrade -n' with the sysupgrade OpenWrt image from console or Luci WebUI. Recovery Press Reset button and power on the router Navigate to U-Boot recovery web server (192.168.1.1) and upload the OEM firmware Stock layout 0x000000000000-0x000000200000 : "boot" 0x000000200000-0x000000300000 : "u-boot-env" 0x000000300000-0x000003500000 : "ubi0" 0x000003500000-0x000006700000 : "ubi1" 0x000006700000-0x000006f00000 : "userconfig" 0x000006f00000-0x000007300000 : "tp_data" 0x000007300000-0x000007B00000 : "mali_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 +---------+-------------------+-----------+ | 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: Sergey Shlukov Link: https://github.com/openwrt/openwrt/pull/17753 (cherry picked from commit 8b24289a5267e486abd9ccbf4b4ad82f14d545ae) Link: https://github.com/openwrt/openwrt/pull/19050 Signed-off-by: Hauke Mehrtens --- .../uboot-envtools/files/mediatek_filogic | 3 + .../dts/mt7986a-tplink-archer-ax80-v1.dts | 332 ++++++++++++++++++ .../filogic/base-files/etc/board.d/02_network | 4 + .../etc/hotplug.d/firmware/11-mt76-caldata | 8 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 1 + .../base-files/lib/preinit/09_mount_cfg_part | 1 + .../base-files/lib/preinit/10_fix_eth_mac.sh | 1 + .../base-files/lib/upgrade/platform.sh | 1 + target/linux/mediatek/image/filogic.mk | 14 + 9 files changed, 365 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7986a-tplink-archer-ax80-v1.dts diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index 0da869cdbf9b1f..7ec1a101a05c38 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -129,6 +129,9 @@ smartrg,sdg-8734) local envdev=$(find_mmc_part "u-boot-env" "mmcblk0") ubootenv_add_uci_config "$envdev" "0x0" "0x8000" "0x8000" ;; +tplink,archer-ax80-v1) + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" "8" + ;; ubnt,unifi-6-plus) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x10000" ;; diff --git a/target/linux/mediatek/dts/mt7986a-tplink-archer-ax80-v1.dts b/target/linux/mediatek/dts/mt7986a-tplink-archer-ax80-v1.dts new file mode 100644 index 00000000000000..e1765b08f4fe30 --- /dev/null +++ b/target/linux/mediatek/dts/mt7986a-tplink-archer-ax80-v1.dts @@ -0,0 +1,332 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include +#include +#include + +#include "mt7986a.dtsi" + +/ { + compatible = "tplink,archer-ax80-v1", "mediatek,mt7986a"; + model = "TP-Link Archer AX80V1"; + + aliases { + serial0 = &uart0; + led-boot = &led_B; + led-failsafe = &led_R; + led-running = &led_B; + led-upgrade = &led_G; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory@40000000 { + reg = <0 0x40000000 0 0x20000000>; + }; + + gpio-keys { + compatible = "gpio-keys"; + + button-reset { + label = "reset"; + linux,code = ; + gpios = <&pio 7 GPIO_ACTIVE_LOW>; + }; + + button-ledswitch { + label = "ledswitch"; + linux,code = ; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + }; + + button-wps { + label = "wps"; + linux,code = ; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + }; + + button-wifi { + label = "wlan"; + linux,code = ; + gpios = <&pio 16 GPIO_ACTIVE_LOW>; + }; + }; + + 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; + }; +}; + +&auxadc { + status = "okay"; +}; + +&crypto { + status = "okay"; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + fixed-link { + speed = <2500>; + full-duplex; + }; + }; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "2500base-x"; + phy-handle = <&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>; + + 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>; + 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 = "lan0"; + }; + 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; + }; + }; + }; + }; + }; +}; + +&i2c0 { + status = "okay"; + + lp55231: led-controller@32 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "ti,lp55231"; + reg = <0x32>; + status = "okay"; + clock-mode = /bits/ 8 <1>; + + led_B: led@0 { + chan-name = "B"; + led-cur = /bits/ 8 <0x14>; + max-cur = /bits/ 8 <0x20>; + reg = <0>; + color = ; + }; + + led_G: led@3 { + chan-name = "G"; + led-cur = /bits/ 8 <0x14>; + max-cur = /bits/ 8 <0x20>; + reg = <3>; + color = ; + }; + + led_R: led@6 { + chan-name = "R"; + led-cur = /bits/ 8 <0x14>; + max-cur = /bits/ 8 <0x20>; + reg = <6>; + color = ; + }; + + }; +}; +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi_flash_pins>; + status = "okay"; + + spi_nand_flash: flash@0 { + compatible = "spi-nand"; + reg = <0>; + + spi-max-frequency = <52000000>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <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>; + + 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>; + }; + + partition@6700000 { + label = "userconfig"; + reg = <0x6700000 0x800000>; + }; + + factory:partition@6f00000 { + label = "tp_data"; + reg = <0x6f00000 0x400000>; + }; + + partition@7300000 { + label = "mali_data"; + reg = <0x7300000 0x800000>; + }; + }; + }; +}; + +&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 = <4>; + mediatek,pull-up-adv = <0>; + }; + conf-pd { + pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO"; + drive-strength = <4>; + mediatek,pull-down-adv = <0>; + }; + }; + 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>; + }; + }; +}; + +&trng { + status = "okay"; +}; + +&uart0 { + status = "okay"; +}; + +&ssusb { + vusb33-supply = <®_3p3v>; + vbus-supply = <®_5v>; + status = "okay"; +}; + +&usb_phy { + 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/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index 3440cae0195b1a..11dd94aef6527a 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 @@ -125,6 +125,9 @@ mediatek_setup_interfaces() wavlink,wl-wn586x3) ucidef_set_interfaces_lan_wan "lan1 lan2" eth1 ;; + tplink,archer-ax80-v1) + ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3" eth1 + ;; tplink,re6000xd) ucidef_set_interface_lan "lan1 lan2 eth1" ;; @@ -173,6 +176,7 @@ mediatek_setup_macs() wan_mac=$(macaddr_add "$lan_mac" 1) ;; mercusys,mr90x-v1|\ + tplink,archer-ax80-v1|\ tplink,re6000xd) 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/firmware/11-mt76-caldata b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata index 34aacb931275b2..1d9db845db6860 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 @@ -27,6 +27,14 @@ case "$FIRMWARE" in ;; esac ;; +"mediatek/mt7986_eeprom_mt7976_dual.bin") + case "$board" in + tplink,archer-ax80-v1) + ln -sf /tmp/tp_data/MT7986_EEPROM.bin \ + /lib/firmware/$FIRMWARE + ;; + 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 19c7eb43e86bc6..e58944025802da 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 @@ -125,6 +125,7 @@ case "$board" in [ "$PHYNBR" = "1" ] && macaddr_add $label_mac -2 > /sys${DEVPATH}/macaddress ;; mercusys,mr90x-v1|\ + tplink,archer-ax80-v1|\ tplink,re6000xd) 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/preinit/09_mount_cfg_part b/target/linux/mediatek/filogic/base-files/lib/preinit/09_mount_cfg_part index 1474fad831c5b5..87e51a4429470f 100644 --- 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 @@ -14,6 +14,7 @@ preinit_mount_cfg_part() { case $(board_name) in mercusys,mr80x-v3|\ mercusys,mr90x-v1|\ + tplink,archer-ax80-v1|\ tplink,re6000xd) mount_ubi_part "tp_data" ;; 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 9d279898ac58cd..936ed44ff9667c 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 @@ -28,6 +28,7 @@ preinit_set_mac_address() { ip link set dev eth1 address "$addr" ;; mercusys,mr90x-v1|\ + tplink,archer-ax80-v1|\ tplink,re6000xd) addr=$(get_mac_binary "/tmp/tp_data/default-mac" 0) ip link set dev eth1 address "$(macaddr_add $addr 1)" 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 c2600c8ca33d59..9e1e50c50faaa9 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -137,6 +137,7 @@ platform_do_upgrade() { ;; mercusys,mr80x-v3|\ mercusys,mr90x-v1|\ + tplink,archer-ax80-v1|\ tplink,re6000xd) CI_UBIPART="ubi0" nand_do_upgrade "$1" diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 129193138a118c..44d51e404ab85f 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -1503,6 +1503,20 @@ define Device/ruijie_rg-x60-pro endef TARGET_DEVICES += ruijie_rg-x60-pro +define Device/tplink_archer-ax80-v1 + DEVICE_VENDOR := TP-Link + DEVICE_MODEL := Archer AX80V1 + DEVICE_DTS := mt7986a-tplink-archer-ax80-v1 + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-leds-lp5523 kmod-usb3 kmod-mt7915e 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 += tplink_archer-ax80-v1 + define Device/tplink_re6000xd DEVICE_VENDOR := TP-Link DEVICE_MODEL := RE6000XD From 7d74ef4b85568a29658f623d621cd3091becc98e Mon Sep 17 00:00:00 2001 From: Sander van Deijck Date: Sat, 15 Feb 2025 23:06:08 +0100 Subject: [PATCH 707/877] ramips: mt7621: add support for Arcadyan WE410443 The Arcadyan WE410443 is a WiFi AC access point distributed by various ISPs under various names, including KPN SuperWifi and BT Whole Home Wi-Fi. It features one ethernet port, dual MT7615N radios and four internal antennas. Hardware: - SoC: Mediatek MT7621AT - Flash: 32 MB - RAM: 128 MB - Ethernet: 1x 10/100/1000 Mbps, built into the SoC - WLAN: 2x MediaTek MT7615N - Buttons: 1 Reset button, 1 WPS button - LEDs: 1x Green, 1x Blue, 1x Red, all unmarked - Power: 12 VDC, 1.5A barrel plug Installation: The bootloader is locked with a password, so the image needs to be written directly to the SPI flash chip. To do this, you need to open up the case, remove the heatsink and connect the flash chip to a Raspberry Pi. Use the following connections: Flash chip --> Raspberry Pi VCC --> 3v3 RESET --> 3v3 /CS --> GPIO 8 DO --> GPIO 9 CLK --> GPIO 11 DI --> GPIO 10 GND --> Ground You can solder wires to the flash chip, or use a SOIC16 clip. More details on the Raspberry Pi and SPI chip pinouts are available on the wiki [1] When you have the Raspberry Pi connected to the flash chip, boot your Pi and follow the instructions: 1) Make sure your Pi has SPI enabled with sudo raspi-config 2) Install necessary tools: sudo apt install xxd libubootenv-tool mtd-utils 3) Upload overlay and execute: sudo dtc -@ -I dts -O dtb -o /boot/overlays/we410443.dtbo we410443-overlay.dts 4) Enable in /boot/firmware/config.txt by adding a new line containing dtoverlay=we410443 5) Reboot your Pi and verify the mtd partitions with cat /proc/mtd, you should see: dev: size erasesize name mtd0: 02000000 00001000 "all" mtd1: 00030000 00001000 "u-boot" mtd2: 00010000 00001000 "u-boot-env" mtd3: 00010000 00001000 "factory" mtd4: 01f60000 00001000 "firmware" mtd5: 00010000 00001000 "glbcfg" mtd6: 00010000 00001000 "config" mtd7: 00010000 00001000 "glbcfg2" mtd8: 00010000 00001000 "config2" 6) Optionally (but recommended), make a backup: sudo dd if=/dev/mtd0 of=backup.bin It can be restored with: sudo flashcp backup.bin /dev/mtd0 7) Set the variables for the bootloader: echo '/dev/mtd2 0x0 0x1000 0x1000' > fw_env.config sudo fw_setenv -c fw_env.config bootpartition 0 8) Finally, flash the image: sudo flashcp openwrt-ramips-mt7621-arcadyan_we410443- squashfs-sysupgrade.bin /dev/mtd4 MAC addresses The label address is stored in ASCII in the config partition Use --> Address Device --> label Ethernet --> label WLAN 2g --> + 1 WLAN 5g --> + 2 References: [1] https://openwrt.org/toh/arcadyan/astoria/we410443 Signed-off-by: Sander van Deijck Link: https://github.com/openwrt/openwrt/pull/17981 (cherry picked from commit b6a07dd0914e17d923f08c38fbfd4fa63fb2883b) Link: https://github.com/openwrt/openwrt/pull/19068 Signed-off-by: Hauke Mehrtens --- .../ramips/dts/mt7621_arcadyan_we410443.dts | 197 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 17 ++ .../mt7621/base-files/etc/board.d/02_network | 5 + .../etc/hotplug.d/ieee80211/10_fix_wifi_mac | 7 + 4 files changed, 226 insertions(+) create mode 100755 target/linux/ramips/dts/mt7621_arcadyan_we410443.dts diff --git a/target/linux/ramips/dts/mt7621_arcadyan_we410443.dts b/target/linux/ramips/dts/mt7621_arcadyan_we410443.dts new file mode 100755 index 00000000000000..ddcf37fdb03659 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_arcadyan_we410443.dts @@ -0,0 +1,197 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include +#include + +/ { + model = "Arcadyan WE410443"; + compatible = "arcadyan,we410443", "mediatek,mt7621-soc"; + + aliases { + led-boot = &led_status_green; + led-failsafe = &led_status_red; + led-running = &led_status_green; + led-upgrade = &led_status_blue; + }; + + keys { + compatible = "gpio-keys"; + + wps { + label = "wps"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status_blue: blue { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&gpio 41 GPIO_ACTIVE_HIGH>; + }; + + led_status_green: green { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&gpio 42 GPIO_ACTIVE_HIGH>; + }; + + led_status_red: red { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&gpio 44 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "all"; + reg = <0x0 0x2000000>; + read-only; + }; + + partition@1 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x4da8>; + }; + + eeprom_factory_8000: eeprom@8000 { + reg = <0x8000 0x4da8>; + }; + }; + }; + + partition@50000 { + compatible = "fixed-partitions"; + label = "firmware"; + reg = <0x50000 0x1f60000>; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "kernel"; + reg = <0x0 0x440000>; + }; + + partition@400000 { + label = "rootfs"; + reg = <0x440000 0x1b20000>; + }; + }; + + partition@1fb0000 { + label = "glbcfg"; + reg = <0x1fb0000 0x10000>; + read-only; + }; + + partition@1fc0000 { + label = "config"; + reg = <0x1fc0000 0x10000>; + read-only; + }; + + partition@1fd0000 { + label = "glbcfg2"; + reg = <0x1fd0000 0x10000>; + read-only; + }; + + partition@1fe0000 { + label = "config2"; + reg = <0x1fe0000 0x10000>; + read-only; + }; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; + ieee80211-freq-limit = <2400000 2500000>; + }; +}; + +&pcie1 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + nvmem-cells = <&eeprom_factory_8000>; + nvmem-cell-names = "eeprom"; + ieee80211-freq-limit = <5000000 6000000>; + }; +}; + +&state_default { + gpio { + groups = "i2c", "wdt", "sdhci"; + function = "gpio"; + }; +}; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "lan"; + }; + }; +}; + +&xhci { + status = "disabled"; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 95bb8fc86767fd..6f515ef61c8460 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -314,6 +314,23 @@ define Device/ampedwireless_ally-00x19k endef TARGET_DEVICES += ampedwireless_ally-00x19k +define Device/arcadyan_we410443 + $(Device/dsa-migration) + $(Device/uimage-lzma-loader) + DEVICE_VENDOR := Arcadyan + DEVICE_MODEL := WE410443 + IMAGE_SIZE := 32128k + KERNEL_SIZE := 4352k + KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | \ + uImage none | arcadyan-trx 0x746f435d + KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | loader-kernel | \ + uImage none + IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | \ + append-rootfs | pad-rootfs | check-size | append-metadata + DEVICE_PACKAGES := kmod-mt7615-firmware -uboot-envtools +endef +TARGET_DEVICES += arcadyan_we410443 + define Device/arcadyan_we420223-99 $(Device/dsa-migration) $(Device/uimage-lzma-loader) 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 2374d5f60a28be..9e4f139a4cc6e8 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 @@ -37,6 +37,7 @@ ramips_setup_interfaces() ucidef_set_interface_lan "swp0 swp1" ;; ampedwireless,ally-00x19k|\ + arcadyan,we410443|\ asus,rp-ac56|\ asus,rp-ac87|\ dlink,dap-1620-b1|\ @@ -211,6 +212,10 @@ ramips_setup_macs() wan_mac=$(mtd_get_mac_ascii hwconfig HW.WAN.MAC.Address) label_mac=$lan_mac ;; + arcadyan,we410443) + label_mac=$(mtd_get_mac_ascii config mac) + lan_mac=$label_mac + ;; arcadyan,we420223-99) label_mac=$(mtd_get_mac_ascii board_data mac) lan_mac=$label_mac 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 05e4ebe99ae04c..294929e72349d6 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 @@ -10,6 +10,13 @@ PHYNBR=${DEVPATH##*/phy} board=$(board_name) case "$board" in + arcadyan,we410443) + label_mac=$(mtd_get_mac_ascii config mac) + [ "$PHYNBR" = "0" ] && \ + macaddr_add $label_mac 1 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && \ + macaddr_add $label_mac 2 > /sys${DEVPATH}/macaddress + ;; arcadyan,we420223-99) if [ "$PHYNBR" = "0" ]; then mac24=$(macaddr_add "$(get_mac_label)" "0xf00001") From 4c4b698a9c3e419d7dc95484e1d39272fcd39b1f Mon Sep 17 00:00:00 2001 From: Markus Stockhausen Date: Tue, 6 May 2025 02:44:43 -0400 Subject: [PATCH 708/877] realtek: proper RTL8214FC fibre/copper detection The RTL8214FC currently uses generic PHY functions. That makes it look like a copper device. Switching to/from fibre works fortunately but the autonegotiation handling still works on MII_LPA (PHY register 5) as if a copper link is used. Fix that by - advertising a superset of TP/FIBRE features - using clause 37 functions when on fibre Additionally enhance the code of the driver to assist further development. - log the speed of the inserted module to detect wrongly inserted 10gbase-r modules - order phy driver functions alphabetically (keep match/name on top) - remove genphy_loopback as the kernel uses it if not provided Remark! The driver internally uses PORT_MII for the TP port. Align with that and report MII to ethtool instead of TP. Other drivers do the same and it can be changed in the future if needed. Signed-off-by: Markus Stockhausen Link: https://github.com/openwrt/openwrt/pull/18724 Signed-off-by: Robert Marko (cherry picked from commit 4cfd1c450181893a8063588eafd4eadef6a7e235) Link: https://github.com/openwrt/openwrt/pull/18755 Signed-off-by: Hauke Mehrtens --- .../files-6.6/drivers/net/phy/rtl83xx-phy.c | 69 +++++++++++++++++-- 1 file changed, 62 insertions(+), 7 deletions(-) diff --git a/target/linux/realtek/files-6.6/drivers/net/phy/rtl83xx-phy.c b/target/linux/realtek/files-6.6/drivers/net/phy/rtl83xx-phy.c index 09c6ca3b2cb130..fadd88c513a83c 100644 --- a/target/linux/realtek/files-6.6/drivers/net/phy/rtl83xx-phy.c +++ b/target/linux/realtek/files-6.6/drivers/net/phy/rtl83xx-phy.c @@ -1124,6 +1124,52 @@ static int rtl8214fc_get_port(struct phy_device *phydev) return PORT_MII; } +static int rtl8214fc_get_features(struct phy_device *phydev) +{ + int ret = 0; + + ret = genphy_read_abilities(phydev); + if (ret) + return ret; + /* + * The RTL8214FC only advertises TP capabilities in the standard registers. This is + * independent from what fibre/copper combination is currently activated. For now just + * announce the superset of all possible features. + */ + linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseX_Full_BIT, phydev->supported); + linkmode_set_bit(ETHTOOL_LINK_MODE_FIBRE_BIT, phydev->supported); + + return 0; +} + +static int rtl8214fc_read_status(struct phy_device *phydev) +{ + bool changed; + int ret; + + if (rtl8214fc_media_is_fibre(phydev)) { + phydev->port = PORT_FIBRE; + ret = genphy_c37_read_status(phydev, &changed); + } else { + phydev->port = PORT_MII; /* for now aligend with rest of code */ + ret = genphy_read_status(phydev); + } + + return ret; +} + +static int rtl8214fc_config_aneg(struct phy_device *phydev) +{ + int ret; + + if (rtl8214fc_media_is_fibre(phydev)) + ret = genphy_c37_config_aneg(phydev); + else + ret = genphy_config_aneg(phydev); + + return ret; +} + /* Enable EEE on the RTL8218B PHYs * The method used is not the preferred way (which would be based on the MAC-EEE state, * but the only way that works since the kernel first enables EEE in the MAC @@ -3699,7 +3745,15 @@ int rtl931x_link_sts_get(u32 sds) static int rtl8214fc_sfp_insert(void *upstream, const struct sfp_eeprom_id *id) { + __ETHTOOL_DECLARE_LINK_MODE_MASK(support) = { 0, }; + DECLARE_PHY_INTERFACE_MASK(interfaces); struct phy_device *phydev = upstream; + phy_interface_t iface; + + sfp_parse_support(phydev->sfp_bus, id, support, interfaces); + iface = sfp_select_interface(phydev->sfp_bus, support); + + dev_info(&phydev->mdio.dev, "%s SFP module inserted\n", phy_modes(iface)); rtl8214fc_media_set(phydev, true); @@ -3903,17 +3957,18 @@ static struct phy_driver rtl83xx_phy_driver[] = { { .match_phy_device = rtl8214fc_match_phy_device, .name = "Realtek RTL8214FC", - .features = PHY_GBIT_FIBRE_FEATURES, + .config_aneg = rtl8214fc_config_aneg, + .get_eee = rtl8214fc_get_eee, + .get_features = rtl8214fc_get_features, + .get_port = rtl8214fc_get_port, .probe = rtl8214fc_phy_probe, .read_page = rtl821x_read_page, - .write_page = rtl821x_write_page, - .suspend = rtl8214fc_suspend, + .read_status = rtl8214fc_read_status, .resume = rtl8214fc_resume, - .set_loopback = genphy_loopback, - .set_port = rtl8214fc_set_port, - .get_port = rtl8214fc_get_port, .set_eee = rtl8214fc_set_eee, - .get_eee = rtl8214fc_get_eee, + .set_port = rtl8214fc_set_port, + .suspend = rtl8214fc_suspend, + .write_page = rtl821x_write_page, }, { .match_phy_device = rtl8218b_ext_match_phy_device, From 072fd4de3c689bf9740f93cc5a881fb67ba13d12 Mon Sep 17 00:00:00 2001 From: Markus Stockhausen Date: Tue, 20 May 2025 16:10:44 -0400 Subject: [PATCH 709/877] realtek: refactor net rx interrupt handler rtl83xx_net_irq() Cleanup the code of the RTL83xx packet receive interrupt handler. Not only for better readability but to avoid inconsistencies and stalls on the RTL839x targets. The current implementation seems to come from the GPL source code. Calling the existing cleanup() function inside the interrupt context without any locks conflicts with SMP & NAPI polling and makes things worse instead of giving any benefit. Simply ignore RX buffer overruns and let the device handle packet dropping itself. Signed-off-by: Markus Stockhausen Link: https://github.com/openwrt/openwrt/pull/18855 Signed-off-by: Robert Marko (cherry picked from commit 8dde1e463884b3ac84d7ba9ca7ce557c4f6e117d) Link: https://github.com/openwrt/openwrt/pull/18755 Signed-off-by: Hauke Mehrtens --- .../drivers/net/ethernet/rtl838x_eth.c | 43 +++++-------------- .../drivers/net/ethernet/rtl838x_eth.h | 4 ++ 2 files changed, 15 insertions(+), 32 deletions(-) diff --git a/target/linux/realtek/files-6.6/drivers/net/ethernet/rtl838x_eth.c b/target/linux/realtek/files-6.6/drivers/net/ethernet/rtl838x_eth.c index 4b79090696e341..83b5462ec5f7b9 100644 --- a/target/linux/realtek/files-6.6/drivers/net/ethernet/rtl838x_eth.c +++ b/target/linux/realtek/files-6.6/drivers/net/ethernet/rtl838x_eth.c @@ -433,23 +433,19 @@ static void rtl839x_l2_notification_handler(struct rtl838x_eth_priv *priv) static irqreturn_t rtl83xx_net_irq(int irq, void *dev_id) { - struct net_device *dev = dev_id; - struct rtl838x_eth_priv *priv = netdev_priv(dev); + struct net_device *ndev = dev_id; + struct rtl838x_eth_priv *priv = netdev_priv(ndev); u32 status = sw_r32(priv->r->dma_if_intr_sts); - pr_debug("IRQ: %08x\n", status); + netdev_dbg(ndev, "RX IRQ received: %08x\n", status); - /* Ignore TX interrupt */ - if ((status & 0xf0000)) { - /* Clear ISR */ - sw_w32(0x000f0000, priv->r->dma_if_intr_sts); - } + if ((status & RTL83XX_DMA_IF_INTR_STS_RX_RUN_OUT_MASK) && net_ratelimit()) + netdev_warn(ndev, "RX buffer overrun: status 0x%x, mask: 0x%x\n", + status, sw_r32(priv->r->dma_if_intr_msk)); - /* RX interrupt */ - if (status & 0x0ff00) { - /* ACK and disable RX interrupt for this ring */ + if (status & RTL83XX_DMA_IF_INTR_STS_RX_DONE_MASK) { + /* Disable rx interrupts */ sw_w32_mask(0xff00 & status, 0, priv->r->dma_if_intr_msk); - sw_w32(0x0000ff00 & status, priv->r->dma_if_intr_sts); for (int i = 0; i < priv->rxrings; i++) { if (status & BIT(i + 8)) { pr_debug("Scheduling queue: %d\n", i); @@ -458,28 +454,11 @@ static irqreturn_t rtl83xx_net_irq(int irq, void *dev_id) } } - /* RX buffer overrun */ - if (status & 0x000ff) { - pr_debug("RX buffer overrun: status %x, mask: %x\n", - status, sw_r32(priv->r->dma_if_intr_msk)); - sw_w32(status, priv->r->dma_if_intr_sts); - rtl838x_rb_cleanup(priv, status & 0xff); - } - - if (priv->family_id == RTL8390_FAMILY_ID && status & 0x00100000) { - sw_w32(0x00100000, priv->r->dma_if_intr_sts); - rtl839x_l2_notification_handler(priv); - } - - if (priv->family_id == RTL8390_FAMILY_ID && status & 0x00200000) { - sw_w32(0x00200000, priv->r->dma_if_intr_sts); + if ((status & RTL83XX_DMA_IF_INTR_STS_NOTIFY_MASK) && priv->family_id == RTL8390_FAMILY_ID) rtl839x_l2_notification_handler(priv); - } - if (priv->family_id == RTL8390_FAMILY_ID && status & 0x00400000) { - sw_w32(0x00400000, priv->r->dma_if_intr_sts); - rtl839x_l2_notification_handler(priv); - } + /* Acknowledge all interrupts */ + sw_w32(status, priv->r->dma_if_intr_sts); return IRQ_HANDLED; } diff --git a/target/linux/realtek/files-6.6/drivers/net/ethernet/rtl838x_eth.h b/target/linux/realtek/files-6.6/drivers/net/ethernet/rtl838x_eth.h index d6d88fc2ed01b8..a87a8a5988618a 100644 --- a/target/linux/realtek/files-6.6/drivers/net/ethernet/rtl838x_eth.h +++ b/target/linux/realtek/files-6.6/drivers/net/ethernet/rtl838x_eth.h @@ -48,6 +48,10 @@ #define RTL930X_MAC_FORCE_MODE_CTRL (0xCA1C) #define RTL931X_MAC_FORCE_MODE_CTRL (0x0ddc) +#define RTL83XX_DMA_IF_INTR_STS_NOTIFY_MASK GENMASK(22, 20) +#define RTL83XX_DMA_IF_INTR_STS_RX_DONE_MASK GENMASK(15, 8) +#define RTL83XX_DMA_IF_INTR_STS_RX_RUN_OUT_MASK GENMASK(7, 0) + /* MAC address settings */ #define RTL838X_MAC (0xa9ec) #define RTL839X_MAC (0x02b4) From 0f9ebe2da714f58c25185cfd32845249e61feaf2 Mon Sep 17 00:00:00 2001 From: Markus Stockhausen Date: Sat, 17 May 2025 02:22:09 -0400 Subject: [PATCH 710/877] realtek: fix mdio parent/child locking issues Since the early beginning of the Realtek DSA driver there is an uncovered locking issue between the standard (parent) mdio bus and the DSA (child) mdio bus. This comes from the fact that the DSA bus simply links to the parent read and write functions and calls them directly. This leads to the following lock issue. - Child bus calls phy_read/write functions and uses its internal lock - Parent bus calls phy_read/write functions and uses its internal lock It becomes clear that critical section can be accessed twice without knowing that a operation from the other bus is currently active. This can lead to critical malfunctions because the mdio driver needs a lot of internal magic to get page selection done right. Effects are: - The original page is lost after a phy_write/read_paged() call - dmesg like "Realtek RTL8218B (external) rtl838x slave mii-0:00: Expected external RTL8218B, found PHY-ID 6b23" Other DSA drivers simply use the read/write functions from the parent bus and thus avoid locking issues. Do it the same way. Fixes: 2b88563ee5aafd9 ("realtek: update the tree to the latest refactored version") Signed-off-by: Markus Stockhausen Link: https://github.com/openwrt/openwrt/pull/18824 Signed-off-by: Robert Marko (cherry picked from commit 461fc06f9d72d032b2acc86fbb7662511e07dd3c) Link: https://github.com/openwrt/openwrt/pull/18755 Signed-off-by: Hauke Mehrtens --- .../drivers/net/dsa/rtl83xx/common.c | 30 ++++++++++++------- .../drivers/net/dsa/rtl83xx/rtl838x.h | 2 +- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/common.c b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/common.c index fe0980a1beb82a..805ed182c20769 100644 --- a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/common.c +++ b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/common.c @@ -271,6 +271,20 @@ int write_phy(u32 port, u32 page, u32 reg, u32 val) return -1; } +static int rtldsa_mdio_read(struct mii_bus *bus, int addr, int regnum) +{ + struct rtl838x_switch_priv *priv = bus->priv; + + return mdiobus_read_nested(priv->parent_bus, addr, regnum); +} + +static int rtldsa_mdio_write(struct mii_bus *bus, int addr, int regnum, u16 val) +{ + struct rtl838x_switch_priv *priv = bus->priv; + + return mdiobus_write_nested(priv->parent_bus, addr, regnum, val); +} + static int __init rtl83xx_mdio_probe(struct rtl838x_switch_priv *priv) { struct device *dev = priv->dev; @@ -288,8 +302,8 @@ static int __init rtl83xx_mdio_probe(struct rtl838x_switch_priv *priv) return -ENODEV; } - priv->mii_bus = of_mdio_find_bus(mii_np); - if (!priv->mii_bus) { + priv->parent_bus = of_mdio_find_bus(mii_np); + if (!priv->parent_bus) { pr_debug("Deferring probe of mdio bus\n"); return -EPROBE_DEFER; } @@ -300,18 +314,14 @@ static int __init rtl83xx_mdio_probe(struct rtl838x_switch_priv *priv) if (!bus) return -ENOMEM; - bus->name = "rtl838x slave mii"; - - /* Since the NIC driver is loaded first, we can use the mdio rw functions - * assigned there. - */ - bus->read = priv->mii_bus->read; - bus->write = priv->mii_bus->write; + bus->name = "rtldsa_mdio"; + bus->read = rtldsa_mdio_read; + bus->write = rtldsa_mdio_write; snprintf(bus->id, MII_BUS_ID_SIZE, "%s-%d", bus->name, dev->id); bus->parent = dev; priv->ds->slave_mii_bus = bus; - priv->ds->slave_mii_bus->priv = priv->mii_bus->priv; + priv->ds->slave_mii_bus->priv = priv; ret = mdiobus_register(priv->ds->slave_mii_bus); if (ret && mii_np) { diff --git a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl838x.h b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl838x.h index 16c60983783287..c721b4d0705ea4 100644 --- a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl838x.h +++ b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl838x.h @@ -1081,7 +1081,7 @@ struct rtl838x_switch_priv { struct mutex pie_mutex; /* Mutex for Packet Inspection Engine */ int link_state_irq; int mirror_group_ports[4]; - struct mii_bus *mii_bus; + struct mii_bus *parent_bus; const struct rtl838x_reg *r; u8 cpu_port; u8 port_mask; From 73ea351f6c9d0af6485074b8a96b556b837e3baf Mon Sep 17 00:00:00 2001 From: Paul Donald Date: Wed, 26 Mar 2025 18:43:45 +0100 Subject: [PATCH 711/877] lldpd: enable hardware inventory information (TLV) management lldpd can send several hardware inventory TLV fields. Extend the init script to provide these when the existing flag 'lldpmed_no_inventory' is disabled. Five new methods provide default values for some of them, taken from /etc/os-release and /etc/board.json. There is no homogeneous method to determine the hardware serial number, so it can be provided manually, as can asset ID. Note: properties >= 32 characters are truncated at send time (by lldpd), and some (Cisco) equipment displays junk after strings >= 32 characters. So truncate to 31. Tested on: 24.10.0 (known compatible with 22 and 23 also) === Example === The following lldpd config lines: configure inventory hardware-revision "v0" configure inventory software-revision "r28427-6df0e3d02a" configure inventory firmware-revision "OpenWrt 24.10.0" configure inventory serial-number "ABCDEF-123456" configure inventory manufacturer "glinet" configure inventory model "GL.iNet GL-MT6000" # 32 characters: configure inventory asset "abcdefghijklmnopqrstuvwxyz 12345" Produce the following TLV (decoded by Wireshark): Telecommunications Industry Association TR-41 Committee - Inventory - Hardware Revision 1111 111. .... .... = TLV Type: Organization Specific (127) .... ...0 0000 0110 = TLV Length: 6 Organization Unique Code: 00:12:bb (Telecommunications Industry Association TR-41 Committee) Media Subtype: Inventory - Hardware Revision (0x05) Hardware Revision: v0 Telecommunications Industry Association TR-41 Committee - Inventory - Firmware Revision 1111 111. .... .... = TLV Type: Organization Specific (127) .... ...0 0001 0011 = TLV Length: 19 Organization Unique Code: 00:12:bb (Telecommunications Industry Association TR-41 Committee) Media Subtype: Inventory - Firmware Revision (0x06) Firmware Revision: OpenWrt 24.10.0 Telecommunications Industry Association TR-41 Committee - Inventory - Software Revision 1111 111. .... .... = TLV Type: Organization Specific (127) .... ...0 0001 0101 = TLV Length: 21 Organization Unique Code: 00:12:bb (Telecommunications Industry Association TR-41 Committee) Media Subtype: Inventory - Software Revision (0x07) Software Revision: r28427-6df0e3d02a Telecommunications Industry Association TR-41 Committee - Inventory - Serial Number 1111 111. .... .... = TLV Type: Organization Specific (127) .... ...0 0001 0100 = TLV Length: 20 Organization Unique Code: 00:12:bb (Telecommunications Industry Association TR-41 Committee) Media Subtype: Inventory - Serial Number (0x08) Serial Number: ABCDEF-123456 Telecommunications Industry Association TR-41 Committee - Inventory - Manufacturer Name 1111 111. .... .... = TLV Type: Organization Specific (127) .... ...0 0000 1010 = TLV Length: 10 Organization Unique Code: 00:12:bb (Telecommunications Industry Association TR-41 Committee) Media Subtype: Inventory - Manufacturer Name (0x09) Manufacturer Name: glinet Telecommunications Industry Association TR-41 Committee - Inventory - Model Name 1111 111. .... .... = TLV Type: Organization Specific (127) .... ...0 0001 0101 = TLV Length: 21 Organization Unique Code: 00:12:bb (Telecommunications Industry Association TR-41 Committee) Media Subtype: Inventory - Model Name (0x0a) Model Name: GL.iNet GL-MT6000 Telecommunications Industry Association TR-41 Committee - Inventory - Asset ID 1111 111. .... .... = TLV Type: Organization Specific (127) .... ...0 0010 0011 = TLV Length: 35 Organization Unique Code: 00:12:bb (Telecommunications Industry Association TR-41 Committee) Media Subtype: Inventory - Asset ID (0x0b) Asset ID: abcdefghijklmnopqrstuvwxyz 1234 The Cisco DUT displays: Hardware Revision: v0 Firmware Revision: OpenWrt 24.10.0 Software Revision: r28427-6df0e3d02a Serial Number: ABCDEF-123456 Manufacturer Name: glinet Model Name: GL.iNet GL-MT6000 Asset ID: abcdefghijklmnopqrstuvwxyz 1234 Signed-off-by: Paul Donald Link: https://github.com/openwrt/openwrt/pull/18354 Signed-off-by: Robert Marko (cherry picked from commit 412c850f07285643a444815ca20d0bbb2afec17e) Link: https://github.com/openwrt/openwrt/pull/18469 Signed-off-by: Hauke Mehrtens --- .../network/services/lldpd/files/lldpd.init | 113 +++++++++++++++++- 1 file changed, 111 insertions(+), 2 deletions(-) diff --git a/package/network/services/lldpd/files/lldpd.init b/package/network/services/lldpd/files/lldpd.init index e60cc82fd3d844..e59b5d9800b919 100644 --- a/package/network/services/lldpd/files/lldpd.init +++ b/package/network/services/lldpd/files/lldpd.init @@ -1,6 +1,6 @@ #!/bin/sh /etc/rc.common # Copyright (C) 2008-2015 OpenWrt.org -# shellcheck disable=1091,2034,3037,3043,3045 +# shellcheck disable=1091,2034,3037,3043,3045,3057 START=90 STOP=01 @@ -24,15 +24,63 @@ LLDPD_RESTART_HASH=${LLDPD_RUN}/lldpd.restart_hash . "$IPKG_INSTROOT/lib/functions/network.sh" +# Load release info once for all 'find_*' functions +[ -s /etc/os-release ] && . /etc/os-release + +# Helper function to truncate output to 31 characters +truncate_output() { + # Some devices have trouble decoding inventory TLV strings > 31 chars + # lldpd truncates inventory TLV to a total TLV length of 36 (of which string = 32) + echo "${1:0:31}" +} + find_release_info() { - [ -s /etc/os-release ] && . /etc/os-release [ -z "$PRETTY_NAME" ] && [ -s /etc/openwrt_version ] && \ PRETTY_NAME="$(cat /etc/openwrt_version)" echo "${PRETTY_NAME:-Unknown OpenWrt release} @ $(cat /proc/sys/kernel/hostname)" } +find_hardware_revision() +{ + echo "${OPENWRT_DEVICE_REVISION:-Unknown hardware revision}" +} + +find_firmware_info() +{ + echo "${PRETTY_NAME:-Unknown firmware release}" +} + +find_software_revision() +{ + echo "${BUILD_ID:-Unknown software revision}" +} + +# Helper function to extract JSON values using jsonfilter +extract_json_field() { + local _path="$1" + jsonfilter -q -i /etc/board.json -e "$_path" 2>/dev/null +} + +find_manufacturer_info() +{ + local _id + # extract the model->id field, e.g.: "id": "glinet,gl-mt6000", + _id=$(extract_json_field '@.model.id') + # stash text up to first comma + _id="${_id%%,*}" + echo "${_id:-Unknown manufacturer}" +} + +find_model_info() +{ + local _name + # extract the model->name field, e.g.: "name": "GL.iNet GL-MT6000" + _name=$(extract_json_field '@.model.name') + echo "${_name:-Unknown model name}" +} + get_config_restart_hash() { local var="$1" local _string _hash v @@ -120,6 +168,48 @@ write_lldpd_conf() config_load 'lldpd' config_get lldp_description 'config' 'lldp_description' "$(find_release_info)" + # Check the 'do not send inventory' flag + local lldpmed_no_inventory + config_get_bool lldpmed_no_inventory 'config' 'lldpmed_no_inventory' 0 + + if [ "$lldpmed_no_inventory" = 0 ]; then + # lldpmed_no_inventory=1 ('-i' in start_service()) prevents these from being sent + # TIA TR-41 TLV 127 subtype 0x05 + local lldp_med_inv_hardware_revision + config_get lldp_med_inv_hardware_revision 'config' 'lldp_med_inv_hardware_revision' "$(find_hardware_revision)" + lldp_med_inv_hardware_revision=$(truncate_output "$lldp_med_inv_hardware_revision") + + # TIA TR-41 TLV 127 subtype 0x06 + local lldp_med_inv_firmware_revision + config_get lldp_med_inv_firmware_revision 'config' 'lldp_med_inv_firmware_revision' "$(find_firmware_info)" + lldp_med_inv_firmware_revision=$(truncate_output "$lldp_med_inv_firmware_revision") + + # TIA TR-41 TLV 127 subtype 0x07 + local lldp_med_inv_software_revision + config_get lldp_med_inv_software_revision 'config' 'lldp_med_inv_software_revision' "$(find_software_revision)" + lldp_med_inv_software_revision=$(truncate_output "$lldp_med_inv_software_revision") + + # TIA TR-41 TLV 127 subtype 0x08 + local lldp_med_inv_serial_number + config_get lldp_med_inv_serial_number 'config' 'lldp_med_inv_serial_number' + lldp_med_inv_serial_number=$(truncate_output "$lldp_med_inv_serial_number") + + # TIA TR-41 TLV 127 subtype 0x09 + local lldp_med_inv_manufacturer_name + config_get lldp_med_inv_manufacturer_name 'config' 'lldp_med_inv_manufacturer_name' "$(find_manufacturer_info)" + lldp_med_inv_manufacturer_name=$(truncate_output "$lldp_med_inv_manufacturer_name") + + # TIA TR-41 TLV 127 subtype 0x0a + local lldp_med_inv_model_name + config_get lldp_med_inv_model_name 'config' 'lldp_med_inv_model_name' "$(find_model_info)" + lldp_med_inv_model_name=$(truncate_output "$lldp_med_inv_model_name") + + # TIA TR-41 TLV 127 subtype 0x0b + local lldp_med_inv_asset_id + config_get lldp_med_inv_asset_id 'config' 'lldp_med_inv_asset_id' + lldp_med_inv_asset_id=$(truncate_output "$lldp_med_inv_asset_id") + fi + local lldp_hostname config_get lldp_hostname 'config' 'lldp_hostname' "$(cat /proc/sys/kernel/hostname)" @@ -182,6 +272,17 @@ write_lldpd_conf() [ -n "$lldp_mgmt_ip" ] && echo "configure system ip management pattern" "\"$lldp_mgmt_ip\"" >> "$LLDPD_CONF" [ -n "$lldp_syscapabilities" ] && echo "configure system capabilities enabled $lldp_syscapabilities" >> "$LLDPD_CONF" + if [ "$lldpmed_no_inventory" = 0 ]; then + # Hardware inventory info + [ -n "$lldp_med_inv_hardware_revision" ] && echo "configure inventory hardware-revision \"$lldp_med_inv_hardware_revision\"" >> "$LLDPD_CONF" + [ -n "$lldp_med_inv_firmware_revision" ] && echo "configure inventory firmware-revision \"$lldp_med_inv_firmware_revision\"" >> "$LLDPD_CONF" + [ -n "$lldp_med_inv_software_revision" ] && echo "configure inventory software-revision \"$lldp_med_inv_software_revision\"" >> "$LLDPD_CONF" + [ -n "$lldp_med_inv_serial_number" ] && echo "configure inventory serial-number \"$lldp_med_inv_serial_number\"" >> "$LLDPD_CONF" + [ -n "$lldp_med_inv_manufacturer_name" ] && echo "configure inventory manufacturer \"$lldp_med_inv_manufacturer_name\"" >> "$LLDPD_CONF" + [ -n "$lldp_med_inv_model_name" ] && echo "configure inventory model \"$lldp_med_inv_model_name\"" >> "$LLDPD_CONF" + [ -n "$lldp_med_inv_asset_id" ] && echo "configure inventory asset \"$lldp_med_inv_asset_id\"" >> "$LLDPD_CONF" + fi + if [ "$CONFIG_LLDPD_WITH_LLDPMED" = "y" ] && [ "$lldpmed_fast_start" -gt 0 ]; then if [ "$lldpmed_fast_start_tx_interval" -gt 0 ]; then echo "configure med fast-start tx-interval $lldpmed_fast_start_tx_interval" >> "$LLDPD_CONF" @@ -401,6 +502,14 @@ reload_service() { unconfigure system hostname unconfigure system ip management pattern unconfigure system platform + # Hardware inventory info + unconfigure inventory hardware-revision + unconfigure inventory firmware-revision + unconfigure inventory software-revision + unconfigure inventory serial-number + unconfigure inventory manufacturer + unconfigure inventory model + unconfigure inventory asset EOF if [ "$CONFIG_LLDPD_WITH_LLDPMED" = "y" ]; then $LLDPCLI -u "$LLDPSOCKET" >/dev/null 2>&1 <<-EOF From 0db2af95bcb9d82c2af2edf6c5401d3809881114 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Sun, 8 Jun 2025 12:58:37 +0200 Subject: [PATCH 712/877] kernel: r8125: update to v9.016.00 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changelog: https://github.com/openwrt/rtl8125/compare/9.015.00...9.016.00 Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 60606fa980d3fb8cd9b4bba1da9a321f9e72bebb) --- package/kernel/r8125/Makefile | 6 +++--- .../200-r8125-print-link-speed-and-duplex-mode.patch | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package/kernel/r8125/Makefile b/package/kernel/r8125/Makefile index 70b58198cc9c8c..5b7711b6dbf127 100644 --- a/package/kernel/r8125/Makefile +++ b/package/kernel/r8125/Makefile @@ -1,12 +1,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=r8125 -PKG_VERSION:=9.015.00 -PKG_RELEASE:=4 +PKG_VERSION:=9.016.00 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://github.com/openwrt/rtl8125/releases/download/$(PKG_VERSION) -PKG_HASH:=7d6906336c3ad960c3e7c0299ad655659d7110bdc933c5b568b7f2536cb8ffc3 +PKG_HASH:=cd1955dd07d2f5a6faaa210ffc4e8af992421295a32ab6ddcfa759bed9eba922 PKG_BUILD_PARALLEL:=1 PKG_LICENSE:=GPLv2 diff --git a/package/kernel/r8125/patches/200-r8125-print-link-speed-and-duplex-mode.patch b/package/kernel/r8125/patches/200-r8125-print-link-speed-and-duplex-mode.patch index 449cc9a7e271f1..b4444ee79c4ec8 100644 --- a/package/kernel/r8125/patches/200-r8125-print-link-speed-and-duplex-mode.patch +++ b/package/kernel/r8125/patches/200-r8125-print-link-speed-and-duplex-mode.patch @@ -18,7 +18,7 @@ Signed-off-by: Álvaro Fernández Rojas --- a/src/r8125.h +++ b/src/r8125.h -@@ -1687,6 +1687,9 @@ enum RTL8125_register_content { +@@ -1726,6 +1726,9 @@ enum RTL8125_register_content { LinkStatus = 0x02, FullDup = 0x01, @@ -38,7 +38,7 @@ Signed-off-by: Álvaro Fernández Rojas #include #include #include -@@ -5023,6 +5024,38 @@ rtl8125_link_down_patch(struct net_devic +@@ -5045,6 +5046,38 @@ rtl8125_link_down_patch(struct net_devic #endif } @@ -77,7 +77,7 @@ Signed-off-by: Álvaro Fernández Rojas static void _rtl8125_check_link_status(struct net_device *dev, unsigned int link_state) { -@@ -5035,11 +5068,18 @@ _rtl8125_check_link_status(struct net_de +@@ -5057,11 +5090,18 @@ _rtl8125_check_link_status(struct net_de if (link_state == R8125_LINK_STATE_ON) { rtl8125_link_on_patch(dev); From c99d356747a26d68bdb04719a4c4c7a954db8d6e Mon Sep 17 00:00:00 2001 From: Eric Fahlgren Date: Fri, 6 Jun 2025 16:43:27 -0700 Subject: [PATCH 713/877] package: rework contents of package index.json Rework the generation of the index.json version of the package indexes to match the original intent (i.e., for use by the ASU server and other downstream projects). The current file contains package names that have ABI versioning, making them unusable by ASU, so we now remove the ABI suffixes. Also adds a 'version' field to the json, so downstream utilities can detect the new semantics of the package name fields. Links: https://github.com/openwrt/openwrt/commit/218ce40cd738f3373438aab82467807a8707fb9c Signed-off-by: Eric Fahlgren Link: https://github.com/openwrt/openwrt/pull/19051 (cherry picked from commit 2b0b16f1d1571b23425b2d7ab5dc3816e2ceec12) Link: https://github.com/openwrt/openwrt/pull/19097 Signed-off-by: Robert Marko --- package/Makefile | 5 +-- scripts/make-index-json.py | 84 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 4 deletions(-) create mode 100755 scripts/make-index-json.py diff --git a/package/Makefile b/package/Makefile index abe76a619fac4a..2343777195d969 100644 --- a/package/Makefile +++ b/package/Makefile @@ -142,10 +142,7 @@ else $(call ERROR_MESSAGE,WARNING: Applying padding in $$d/Packages to workaround usign SHA-512 bug!); \ { echo ""; echo ""; } >> Packages;; \ esac; \ - echo -n '{"architecture": "$(ARCH_PACKAGES)", "packages":{' > index.json; \ - sed -n -e 's/^Package: \(.*\)$$/"\1":/p' -e 's/^Version: \(.*\)$$/"\1",/p' Packages | tr '\n' ' ' >> index.json; \ - echo '}}' >> index.json; \ - sed -i 's/, }}/}}/' index.json; \ + $(SCRIPT_DIR)/make-index-json.py -f opkg -a "$(ARCH_PACKAGES)" Packages > index.json; \ gzip -9nc Packages > Packages.gz; \ ); done ifdef CONFIG_SIGNED_PACKAGES diff --git a/scripts/make-index-json.py b/scripts/make-index-json.py new file mode 100755 index 00000000000000..af5c6cf0735d4d --- /dev/null +++ b/scripts/make-index-json.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python3 +""" +Parse the native package index files into a json file for use by downstream +tools. See: + + https://github.com/openwrt/openwrt/commit/218ce40cd738f3373438aab82467807a8707fb9c + +The "version 1" index.json contained ABI-versioned package names, making the +unusable by the ASU server. The version 2 format contains package names that +have been stripped of their ABI version. +""" + +import email.parser +import json + + +def parse_args(): + from argparse import ArgumentParser + + source_format = "apk", "opkg" + + parser = ArgumentParser() + # fmt: off + parser.add_argument("-a", "--architecture", required=True, + help="Required device architecture: like 'x86_64' or 'aarch64_generic'") + parser.add_argument("-f", "--source-format", required=True, choices=source_format, + help="Required source format of input: 'apk' or 'opkg'") + parser.add_argument(dest="source", + help="File name for input, '-' for stdin") + # fmt: on + args = parser.parse_args() + return args + + +def parse_apk(text: str) -> dict: + packages: dict = {} + + data = json.loads(text) + for package in data.get("packages", []): + package_name: str = package["name"] + + for tag in package.get("tags", []): + if tag.startswith("openwrt:abiversion="): + package_abi: str = tag.split("=")[-1] + package_name = package_name.removesuffix(package_abi) + break + + packages[package_name] = package["version"] + + return packages + + +def parse_opkg(text: str) -> dict: + packages: dict = {} + + parser: email.parser.Parser = email.parser.Parser() + chunks: list[str] = text.strip().split("\n\n") + for chunk in chunks: + package: dict = parser.parsestr(chunk, headersonly=True) + package_name: str = package["Package"] + if package_abi := package.get("ABIVersion"): + package_name = package_name.removesuffix(package_abi) + + packages[package_name] = package["Version"] + + return packages + + +if __name__ == "__main__": + import sys + + args = parse_args() + + input = sys.stdin if args.source == "-" else open(args.source, "r") + with input: + text: str = input.read() + + packages = parse_apk(text) if args.source_format == "apk" else parse_opkg(text) + index = { + "version": 2, + "architecture": args.architecture, + "packages": packages, + } + print(json.dumps(index, indent=2)) From 9d3ca6d3e537b4c1d73b0337ea83f377982d4e58 Mon Sep 17 00:00:00 2001 From: Georgi Valkov Date: Mon, 14 Apr 2025 15:28:23 +0300 Subject: [PATCH 714/877] toolchain: gdb: fix build error with Xcode 16.3 Xcode 16.3 defines TARGET_OS_MAC, it was not defined in prior versions. zutil.h conditionally defines fdopen as NULL when this macro is defined, resulting in the following build error: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:318:7: error: expected identifier or '(' 318 | FILE *fdopen(int, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(fdopen)); | ^ ./zutil.h:147:33: note: expanded from macro 'fdopen' 147 | # define fdopen(fd,mode) NULL /* No fdopen() */ In Xcode 16.2 and earlier, TARGET_OS_MAC was not defined so this entire block was ignored, gcc and gdb used to compile and work fine. This may have been used for compatibility with older versions of macOS, but is no longer needed. By pure luck, the build worked fine for a long time, because it did not properly detect macOS. Fixed by removing the check for TARGET_OS_MAC. Note that since Xcode 16.3, an entire set of TARGET_OS macros are now defined, most of which are set to 0: TARGET_OS_LINUX 0 TARGET_OS_MAC 1 TARGET_OS_OSX 1 Signed-off-by: Georgi Valkov Link: https://github.com/openwrt/openwrt/pull/18467 (cherry picked from commit dfb8115d0cc00d40f2884d3119b44f3da69c997a) Link: https://github.com/openwrt/openwrt/pull/19096 Signed-off-by: Robert Marko --- toolchain/gdb/Makefile | 2 +- .../130-fix-build-error-with-Xcode-16.3.patch | 52 +++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 toolchain/gdb/patches/130-fix-build-error-with-Xcode-16.3.patch diff --git a/toolchain/gdb/Makefile b/toolchain/gdb/Makefile index ad0c843f75d7ec..861876d54a29c8 100644 --- a/toolchain/gdb/Makefile +++ b/toolchain/gdb/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gdb PKG_VERSION:=15.2 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/gdb diff --git a/toolchain/gdb/patches/130-fix-build-error-with-Xcode-16.3.patch b/toolchain/gdb/patches/130-fix-build-error-with-Xcode-16.3.patch new file mode 100644 index 00000000000000..4f76ed3c89b831 --- /dev/null +++ b/toolchain/gdb/patches/130-fix-build-error-with-Xcode-16.3.patch @@ -0,0 +1,52 @@ +From 0a084bb6c04e453183530c3e20727be1cc55ff9a Mon Sep 17 00:00:00 2001 +From: Georgi Valkov +Date: Mon, 14 Apr 2025 15:18:00 +0300 +Subject: [PATCH] zlib: fix build error with Xcode 16.3 + +Xcode 16.3 defines TARGET_OS_MAC, it was not defined in prior versions. +zutil.h conditionally defines fdopen as NULL when this macro is defined, +resulting in the following build error: + +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:318:7: error: expected identifier or '(' + 318 | FILE *fdopen(int, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(fdopen)); + | ^ +./zutil.h:147:33: note: expanded from macro 'fdopen' + 147 | # define fdopen(fd,mode) NULL /* No fdopen() */ + +In Xcode 16.2 and earlier, TARGET_OS_MAC was not defined so this entire +block was ignored, gcc and gdb used to compile and work fine. + +This may have been used for compatibility with older versions of macOS, +but is no longer needed. By pure luck, the build worked fine for a long +time, because it did not properly detect macOS. +Fixed by removing the check for TARGET_OS_MAC. + +Note that since Xcode 16.3, an entire set of TARGET_OS macros +are now defined, most of which are set to 0: +TARGET_OS_LINUX 0 +TARGET_OS_MAC 1 +TARGET_OS_OSX 1 + +[1] https://github.com/openwrt/openwrt/pull/18467 + +Signed-off-by: Georgi Valkov +--- + zlib/zutil.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/zlib/zutil.h b/zlib/zutil.h +index d9a20ae1bf4..183e51b96b6 100644 +--- a/zlib/zutil.h ++++ b/zlib/zutil.h +@@ -137,7 +137,7 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ + # endif + #endif + +-#if defined(MACOS) || defined(TARGET_OS_MAC) ++#if defined(MACOS) + # define OS_CODE 7 + # ifndef Z_SOLO + # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os +-- +2.49.0 + From f90e7a73970f4864a0e8ec1ac3803861606d7b5d Mon Sep 17 00:00:00 2001 From: Georgi Valkov Date: Mon, 14 Apr 2025 16:07:25 +0300 Subject: [PATCH 715/877] toolchain: gcc: fix build error with Xcode 16.3 Xcode 16.3 defines TARGET_OS_MAC, it was not defined in prior versions. zutil.h conditionally defines fdopen as NULL when this macro is defined, resulting in the following build error: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:318:7: e> 318 | FILE *fdopen(int, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(fdopen)); | ^ ./zutil.h:147:33: note: expanded from macro 'fdopen' 147 | # define fdopen(fd,mode) NULL /* No fdopen() */ In Xcode 16.2 and earlier, TARGET_OS_MAC was not defined so this entire block was ignored, gcc and gdb used to compile and work fine. This may have been used for compatibility with older versions of macOS, but is no longer needed. By pure luck, the build worked fine for a long time, because it did not properly detect macOS. Fixed by removing the check for TARGET_OS_MAC. Note that since Xcode 16.3, an entire set of TARGET_OS macros are now defined, most of which are set to 0: TARGET_OS_LINUX 0 TARGET_OS_MAC 1 TARGET_OS_OSX 1 Signed-off-by: Georgi Valkov Link: https://github.com/openwrt/openwrt/pull/18467 (cherry picked from commit d3bb23946e116b0a6e2b64039c6d58d7f1a589c0) Link: https://github.com/openwrt/openwrt/pull/19096 Signed-off-by: Robert Marko --- .../980-fix-build-error-with-Xcode-16.3.patch | 52 +++++++++++++++++++ .../980-fix-build-error-with-Xcode-16.3.patch | 52 +++++++++++++++++++ .../980-fix-build-error-with-Xcode-16.3.patch | 52 +++++++++++++++++++ .../980-fix-build-error-with-Xcode-16.3.patch | 52 +++++++++++++++++++ 4 files changed, 208 insertions(+) create mode 100644 toolchain/gcc/patches-11.x/980-fix-build-error-with-Xcode-16.3.patch create mode 100644 toolchain/gcc/patches-12.x/980-fix-build-error-with-Xcode-16.3.patch create mode 100644 toolchain/gcc/patches-13.x/980-fix-build-error-with-Xcode-16.3.patch create mode 100644 toolchain/gcc/patches-14.x/980-fix-build-error-with-Xcode-16.3.patch diff --git a/toolchain/gcc/patches-11.x/980-fix-build-error-with-Xcode-16.3.patch b/toolchain/gcc/patches-11.x/980-fix-build-error-with-Xcode-16.3.patch new file mode 100644 index 00000000000000..3f4cdd57261cb2 --- /dev/null +++ b/toolchain/gcc/patches-11.x/980-fix-build-error-with-Xcode-16.3.patch @@ -0,0 +1,52 @@ +From 93954654b87552c4fe0273cab99d0f42f213f7f8 Mon Sep 17 00:00:00 2001 +From: Georgi Valkov +Date: Mon, 14 Apr 2025 15:45:59 +0300 +Subject: [PATCH] zlib: fix build error with Xcode 16.3 + +Xcode 16.3 defines TARGET_OS_MAC, it was not defined in prior versions. +zutil.h conditionally defines fdopen as NULL when this macro is defined, +resulting in the following build error: + +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:318:7: error: expected identifier or '(' + 318 | FILE *fdopen(int, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(fdopen)); + | ^ +./zutil.h:147:33: note: expanded from macro 'fdopen' + 147 | # define fdopen(fd,mode) NULL /* No fdopen() */ + +In Xcode 16.2 and earlier, TARGET_OS_MAC was not defined so this entire +block was ignored, gcc and gdb used to compile and work fine. + +This may have been used for compatibility with older versions of macOS, +but is no longer needed. By pure luck, the build worked fine for a long +time, because it did not properly detect macOS. +Fixed by removing the check for TARGET_OS_MAC. + +Note that since Xcode 16.3, an entire set of TARGET_OS macros +are now defined, most of which are set to 0: +TARGET_OS_LINUX 0 +TARGET_OS_MAC 1 +TARGET_OS_OSX 1 + +[1] https://github.com/openwrt/openwrt/pull/18467 + +Signed-off-by: Georgi Valkov +--- + zlib/zutil.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/zlib/zutil.h b/zlib/zutil.h +index 4b596adf629..9ea8d840643 100644 +--- a/zlib/zutil.h ++++ b/zlib/zutil.h +@@ -130,7 +130,7 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ + # endif + #endif + +-#if defined(MACOS) || defined(TARGET_OS_MAC) ++#if defined(MACOS) + # define OS_CODE 7 + # ifndef Z_SOLO + # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os +-- +2.49.0 + diff --git a/toolchain/gcc/patches-12.x/980-fix-build-error-with-Xcode-16.3.patch b/toolchain/gcc/patches-12.x/980-fix-build-error-with-Xcode-16.3.patch new file mode 100644 index 00000000000000..3f4cdd57261cb2 --- /dev/null +++ b/toolchain/gcc/patches-12.x/980-fix-build-error-with-Xcode-16.3.patch @@ -0,0 +1,52 @@ +From 93954654b87552c4fe0273cab99d0f42f213f7f8 Mon Sep 17 00:00:00 2001 +From: Georgi Valkov +Date: Mon, 14 Apr 2025 15:45:59 +0300 +Subject: [PATCH] zlib: fix build error with Xcode 16.3 + +Xcode 16.3 defines TARGET_OS_MAC, it was not defined in prior versions. +zutil.h conditionally defines fdopen as NULL when this macro is defined, +resulting in the following build error: + +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:318:7: error: expected identifier or '(' + 318 | FILE *fdopen(int, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(fdopen)); + | ^ +./zutil.h:147:33: note: expanded from macro 'fdopen' + 147 | # define fdopen(fd,mode) NULL /* No fdopen() */ + +In Xcode 16.2 and earlier, TARGET_OS_MAC was not defined so this entire +block was ignored, gcc and gdb used to compile and work fine. + +This may have been used for compatibility with older versions of macOS, +but is no longer needed. By pure luck, the build worked fine for a long +time, because it did not properly detect macOS. +Fixed by removing the check for TARGET_OS_MAC. + +Note that since Xcode 16.3, an entire set of TARGET_OS macros +are now defined, most of which are set to 0: +TARGET_OS_LINUX 0 +TARGET_OS_MAC 1 +TARGET_OS_OSX 1 + +[1] https://github.com/openwrt/openwrt/pull/18467 + +Signed-off-by: Georgi Valkov +--- + zlib/zutil.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/zlib/zutil.h b/zlib/zutil.h +index 4b596adf629..9ea8d840643 100644 +--- a/zlib/zutil.h ++++ b/zlib/zutil.h +@@ -130,7 +130,7 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ + # endif + #endif + +-#if defined(MACOS) || defined(TARGET_OS_MAC) ++#if defined(MACOS) + # define OS_CODE 7 + # ifndef Z_SOLO + # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os +-- +2.49.0 + diff --git a/toolchain/gcc/patches-13.x/980-fix-build-error-with-Xcode-16.3.patch b/toolchain/gcc/patches-13.x/980-fix-build-error-with-Xcode-16.3.patch new file mode 100644 index 00000000000000..3f4cdd57261cb2 --- /dev/null +++ b/toolchain/gcc/patches-13.x/980-fix-build-error-with-Xcode-16.3.patch @@ -0,0 +1,52 @@ +From 93954654b87552c4fe0273cab99d0f42f213f7f8 Mon Sep 17 00:00:00 2001 +From: Georgi Valkov +Date: Mon, 14 Apr 2025 15:45:59 +0300 +Subject: [PATCH] zlib: fix build error with Xcode 16.3 + +Xcode 16.3 defines TARGET_OS_MAC, it was not defined in prior versions. +zutil.h conditionally defines fdopen as NULL when this macro is defined, +resulting in the following build error: + +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:318:7: error: expected identifier or '(' + 318 | FILE *fdopen(int, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(fdopen)); + | ^ +./zutil.h:147:33: note: expanded from macro 'fdopen' + 147 | # define fdopen(fd,mode) NULL /* No fdopen() */ + +In Xcode 16.2 and earlier, TARGET_OS_MAC was not defined so this entire +block was ignored, gcc and gdb used to compile and work fine. + +This may have been used for compatibility with older versions of macOS, +but is no longer needed. By pure luck, the build worked fine for a long +time, because it did not properly detect macOS. +Fixed by removing the check for TARGET_OS_MAC. + +Note that since Xcode 16.3, an entire set of TARGET_OS macros +are now defined, most of which are set to 0: +TARGET_OS_LINUX 0 +TARGET_OS_MAC 1 +TARGET_OS_OSX 1 + +[1] https://github.com/openwrt/openwrt/pull/18467 + +Signed-off-by: Georgi Valkov +--- + zlib/zutil.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/zlib/zutil.h b/zlib/zutil.h +index 4b596adf629..9ea8d840643 100644 +--- a/zlib/zutil.h ++++ b/zlib/zutil.h +@@ -130,7 +130,7 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ + # endif + #endif + +-#if defined(MACOS) || defined(TARGET_OS_MAC) ++#if defined(MACOS) + # define OS_CODE 7 + # ifndef Z_SOLO + # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os +-- +2.49.0 + diff --git a/toolchain/gcc/patches-14.x/980-fix-build-error-with-Xcode-16.3.patch b/toolchain/gcc/patches-14.x/980-fix-build-error-with-Xcode-16.3.patch new file mode 100644 index 00000000000000..3f4cdd57261cb2 --- /dev/null +++ b/toolchain/gcc/patches-14.x/980-fix-build-error-with-Xcode-16.3.patch @@ -0,0 +1,52 @@ +From 93954654b87552c4fe0273cab99d0f42f213f7f8 Mon Sep 17 00:00:00 2001 +From: Georgi Valkov +Date: Mon, 14 Apr 2025 15:45:59 +0300 +Subject: [PATCH] zlib: fix build error with Xcode 16.3 + +Xcode 16.3 defines TARGET_OS_MAC, it was not defined in prior versions. +zutil.h conditionally defines fdopen as NULL when this macro is defined, +resulting in the following build error: + +/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:318:7: error: expected identifier or '(' + 318 | FILE *fdopen(int, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(fdopen)); + | ^ +./zutil.h:147:33: note: expanded from macro 'fdopen' + 147 | # define fdopen(fd,mode) NULL /* No fdopen() */ + +In Xcode 16.2 and earlier, TARGET_OS_MAC was not defined so this entire +block was ignored, gcc and gdb used to compile and work fine. + +This may have been used for compatibility with older versions of macOS, +but is no longer needed. By pure luck, the build worked fine for a long +time, because it did not properly detect macOS. +Fixed by removing the check for TARGET_OS_MAC. + +Note that since Xcode 16.3, an entire set of TARGET_OS macros +are now defined, most of which are set to 0: +TARGET_OS_LINUX 0 +TARGET_OS_MAC 1 +TARGET_OS_OSX 1 + +[1] https://github.com/openwrt/openwrt/pull/18467 + +Signed-off-by: Georgi Valkov +--- + zlib/zutil.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/zlib/zutil.h b/zlib/zutil.h +index 4b596adf629..9ea8d840643 100644 +--- a/zlib/zutil.h ++++ b/zlib/zutil.h +@@ -130,7 +130,7 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ + # endif + #endif + +-#if defined(MACOS) || defined(TARGET_OS_MAC) ++#if defined(MACOS) + # define OS_CODE 7 + # ifndef Z_SOLO + # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os +-- +2.49.0 + From d5ab1b48dc03517610d2fd64a3741cb75c3520fe Mon Sep 17 00:00:00 2001 From: Albrecht Lohofener Date: Sun, 8 Jun 2025 09:23:42 +0200 Subject: [PATCH 716/877] kernel: add support for DesignWare SPI MMIO controller MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add kernel packages for DesignWare SPI core and MMIO controllers. This is needed for the RP1 SoC found on RPi 5 devices. Tested with a Microchip ENC28J60 Ethernet controller on a RPi 5. Signed-off-by: Albrecht Lohofener Link: https://github.com/openwrt/openwrt/pull/19049 Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 82d20a0fbde937365f2ad6b4f9b754971c5c6ab2) --- package/kernel/linux/modules/spi.mk | 38 +++++++++++++++++++++++++++++ target/linux/generic/config-6.6 | 5 ++++ 2 files changed, 43 insertions(+) diff --git a/package/kernel/linux/modules/spi.mk b/package/kernel/linux/modules/spi.mk index 78a1c8a03283b2..5e8ab03b1800c0 100644 --- a/package/kernel/linux/modules/spi.mk +++ b/package/kernel/linux/modules/spi.mk @@ -73,3 +73,41 @@ define KernelPackage/spi-dev/description endef $(eval $(call KernelPackage,spi-dev)) + + +define KernelPackage/spi-dw + SUBMENU:=$(SPI_MENU) + TITLE:=DesignWare SPI controller driver (core) + KCONFIG:=\ + CONFIG_SPI=y \ + CONFIG_SPI_DESIGNWARE \ + CONFIG_SPI_DYNAMIC=y \ + CONFIG_SPI_MASTER=y + FILES:=\ + $(LINUX_DIR)/drivers/spi/spi-dw.ko + AUTOLOAD:=$(call AutoProbe,spi-dw) +endef + +define KernelPackage/spi-dw/description + This package contains the DesignWare SPI core driver. +endef + +$(eval $(call KernelPackage,spi-dw)) + + +define KernelPackage/spi-dw-mmio + SUBMENU:=$(SPI_MENU) + TITLE:=DesignWare SPI controller driver (MMIO) + DEPENDS:=+kmod-spi-dw + KCONFIG:=\ + CONFIG_SPI_DW_MMIO + FILES:=\ + $(LINUX_DIR)/drivers/spi/spi-dw-mmio.ko + AUTOLOAD:=$(call AutoProbe,spi-dw-mmio) +endef + +define KernelPackage/spi-dw-mmio/description + This package contains the DesignWare SPI MMIO driver. +endef + +$(eval $(call KernelPackage,spi-dw-mmio)) diff --git a/target/linux/generic/config-6.6 b/target/linux/generic/config-6.6 index 46283ac3bd818d..5fc31b37b087c0 100644 --- a/target/linux/generic/config-6.6 +++ b/target/linux/generic/config-6.6 @@ -6218,6 +6218,11 @@ CONFIG_SND_X86=y # CONFIG_SPI_CADENCE_XSPI is not set # CONFIG_SPI_DEBUG is not set # CONFIG_SPI_DESIGNWARE is not set +# CONFIG_SPI_DW_BT1 is not set +# CONFIG_SPI_DW_BT1_DIRMAP is not set +# CONFIG_SPI_DW_DMA is not set +# CONFIG_SPI_DW_MMIO is not set +# CONFIG_SPI_DW_PCI is not set # CONFIG_SPI_FSL_DSPI is not set # CONFIG_SPI_FSL_ESPI is not set # CONFIG_SPI_FSL_SPI is not set From bb478a6ddac2682d76814bd22b1d6cac5d044fb2 Mon Sep 17 00:00:00 2001 From: Albrecht Lohofener Date: Mon, 9 Jun 2025 07:48:32 +0200 Subject: [PATCH 717/877] kernel: add Microchip ENC28J60 SPI Ethernet controller module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ENC28J60 is a 10 Mbps half-duplex Ethernet controller interfaced via SPI. It achieves real-world bandwidth up to 5Mbit/s on devices like the RPi Zero due to SPI limits. Commonly used with Raspberry Pi Zero boards for wired network connectivity. Signed-off-by: Albrecht Lohofener Link: https://github.com/openwrt/openwrt/pull/19048 Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 4987239913794811b8ac71ff141129e276565d6b) --- package/kernel/linux/modules/netdevices.mk | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk index 9126ef7d7529a4..c60a9479788f4e 100644 --- a/package/kernel/linux/modules/netdevices.mk +++ b/package/kernel/linux/modules/netdevices.mk @@ -2026,3 +2026,19 @@ define KernelPackage/amazon-ena/description endef $(eval $(call KernelPackage,amazon-ena)) + +define KernelPackage/enc28j60 + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Microchip ENC28J60 SPI Ethernet driver + KCONFIG:=\ + CONFIG_ENC28J60 \ + CONFIG_ENC28J60_WRITEVERIFY=n + FILES:=$(LINUX_DIR)/drivers/net/ethernet/microchip/enc28j60.ko + AUTOLOAD:=$(call AutoProbe,enc28j60) +endef + +define KernelPackage/enc28j60/description + Kernel module for Microchip ENC28J60 SPI Ethernet controller +endef + +$(eval $(call KernelPackage,enc28j60)) From 40be479fe35242deb7b366bd5d273606c382826c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Sun, 8 Jun 2025 17:03:30 +0200 Subject: [PATCH 718/877] kernel: add support for DesignWare I2C Platform controller MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add kernel package for DesignWare I2C platform controller. This controller is used on the RP1 SoC found on RPi 5 devices. Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 84922a1e34f8fafeeebc3e6a25b93b95728c1706) --- package/kernel/linux/modules/i2c.mk | 22 ++++++++++++++++++++-- target/linux/generic/config-6.6 | 2 ++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/package/kernel/linux/modules/i2c.mk b/package/kernel/linux/modules/i2c.mk index 3aaf560ea908db..70bdaf22ab5f7a 100644 --- a/package/kernel/linux/modules/i2c.mk +++ b/package/kernel/linux/modules/i2c.mk @@ -116,17 +116,35 @@ I2C_DWPCI_MODULES:= \ define KernelPackage/i2c-designware-pci $(call i2c_defaults,$(I2C_DWPCI_MODULES),59) - TITLE:=Synopsys DesignWare PCI + TITLE:=Synopsys DesignWare I2C PCI DEPENDS:=@PCI_SUPPORT +kmod-i2c-designware-core +kmod-i2c-ccgs-ucsi endef define KernelPackage/i2c-designware-pci/description - Support for Synopsys DesignWare I2C controller. Only master mode is supported. + Support for Synopsys DesignWare I2C PCI controller. Only master mode is + supported. endef $(eval $(call KernelPackage,i2c-designware-pci)) +I2C_DWPLAT_MODULES:= \ + CONFIG_I2C_DESIGNWARE_PLATFORM:drivers/i2c/busses/i2c-designware-platform + +define KernelPackage/i2c-designware-platform + $(call i2c_defaults,$(I2C_DWPLAT_MODULES),59) + TITLE:=Synopsys DesignWare I2C Platform + DEPENDS:=+kmod-i2c-designware-core +endef + +define KernelPackage/i2c-designware-platform/description + Support for Synopsys DesignWare I2C Platform controller. Only master mode + is supported. +endef + +$(eval $(call KernelPackage,i2c-designware-platform)) + + I2C_GPIO_MODULES:= \ CONFIG_I2C_GPIO:drivers/i2c/busses/i2c-gpio diff --git a/target/linux/generic/config-6.6 b/target/linux/generic/config-6.6 index 5fc31b37b087c0..deb58397b5cc7b 100644 --- a/target/linux/generic/config-6.6 +++ b/target/linux/generic/config-6.6 @@ -2460,6 +2460,8 @@ CONFIG_HZ_100=y # CONFIG_I2C_DEBUG_BUS is not set # CONFIG_I2C_DEBUG_CORE is not set # CONFIG_I2C_DEMUX_PINCTRL is not set +# CONFIG_I2C_DESIGNWARE_AMDPSP is not set +# CONFIG_I2C_DESIGNWARE_BAYTRAIL is not set # CONFIG_I2C_DESIGNWARE_PCI is not set # CONFIG_I2C_DESIGNWARE_PLATFORM is not set # CONFIG_I2C_DESIGNWARE_SLAVE is not set From 2e960cc69f0cd930695933ade6881c577fc10f43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Tue, 10 Jun 2025 15:01:37 +0200 Subject: [PATCH 719/877] bcm27xx: add support for BRCMSTB I2C controller MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add kernel package for Broadcom Settop/DSL I2C controller. This controller is used on RPi devices. Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 59f83124009f8cde878f5de24a4d411779b1db03) --- target/linux/bcm27xx/modules/i2c.mk | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/target/linux/bcm27xx/modules/i2c.mk b/target/linux/bcm27xx/modules/i2c.mk index ba266b29f29bf9..0d44f1febcf49e 100644 --- a/target/linux/bcm27xx/modules/i2c.mk +++ b/target/linux/bcm27xx/modules/i2c.mk @@ -16,3 +16,19 @@ define KernelPackage/i2c-bcm2835/description endef $(eval $(call KernelPackage,i2c-bcm2835)) + + +I2C_BRCMSTB_MODULES:=\ + CONFIG_I2C_BRCMSTB:drivers/i2c/busses/i2c-brcmstb + +define KernelPackage/i2c-brcmstb + $(call i2c_defaults,$(I2C_BRCMSTB_MODULES),59) + TITLE:=Broadcom BRCMSTB I2C master controller driver + DEPENDS:=@TARGET_bcm27xx +kmod-i2c-core +endef + +define KernelPackage/i2c-brcmstb/description + This package contains the BRCM Settop/DSL I2C master controller driver +endef + +$(eval $(call KernelPackage,i2c-brcmstb)) From a3d7a9ec98b523cf331a0a2d29e28af5e23cde2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Tue, 10 Jun 2025 15:12:50 +0200 Subject: [PATCH 720/877] bcm27xx: select I2C/SPI packages by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The I2C and SPI packages required for each RPi generation is different. Therefore, in order to avoid confusion let's select them by default. Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 9117ff7b3969e57e9074e889d35f487f441e4569) --- target/linux/bcm27xx/bcm2712/config-6.6 | 5 ----- target/linux/bcm27xx/image/Makefile | 18 +++++++++++++++--- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/target/linux/bcm27xx/bcm2712/config-6.6 b/target/linux/bcm27xx/bcm2712/config-6.6 index daca22db8d5288..24f59326ae733d 100644 --- a/target/linux/bcm27xx/bcm2712/config-6.6 +++ b/target/linux/bcm27xx/bcm2712/config-6.6 @@ -320,13 +320,8 @@ CONFIG_HW_CONSOLE=y CONFIG_HW_RANDOM=y CONFIG_HW_RANDOM_IPROC_RNG200=y CONFIG_I2C=y -CONFIG_I2C_ALGOBIT=y # CONFIG_I2C_BCM2708 is not set -CONFIG_I2C_BCM2835=y CONFIG_I2C_BOARDINFO=y -CONFIG_I2C_BRCMSTB=y -CONFIG_I2C_DESIGNWARE_CORE=y -CONFIG_I2C_DESIGNWARE_PLATFORM=y CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 CONFIG_INPUT=y CONFIG_INPUT_MOUSEDEV=y diff --git a/target/linux/bcm27xx/image/Makefile b/target/linux/bcm27xx/image/Makefile index 0ded372a3f2729..8320855573a455 100644 --- a/target/linux/bcm27xx/image/Makefile +++ b/target/linux/bcm27xx/image/Makefile @@ -88,7 +88,9 @@ define Device/rpi DEVICE_PACKAGES := \ cypress-firmware-43430-sdio \ brcmfmac-nvram-43430-sdio \ - kmod-brcmfmac wpad-basic-mbedtls + kmod-brcmfmac wpad-basic-mbedtls \ + kmod-i2c-bcm2835 kmod-spi-bcm2835 \ + kmod-spi-bcm2835-aux endef ifeq ($(SUBTARGET),bcm2708) TARGET_DEVICES += rpi @@ -127,7 +129,9 @@ define Device/rpi-2 brcmfmac-nvram-43430-sdio \ cypress-firmware-43455-sdio \ brcmfmac-nvram-43455-sdio \ - kmod-brcmfmac wpad-basic-mbedtls + kmod-brcmfmac wpad-basic-mbedtls \ + kmod-i2c-bcm2835 kmod-spi-bcm2835 \ + kmod-spi-bcm2835-aux IMAGE/sysupgrade.img.gz := boot-common | boot-2708 | boot-2711 | sdcard-img | gzip | append-metadata IMAGE/factory.img.gz := boot-common | boot-2708 | boot-2711 | sdcard-img | gzip endef @@ -161,7 +165,9 @@ define Device/rpi-3 brcmfmac-nvram-43430-sdio \ cypress-firmware-43455-sdio \ brcmfmac-nvram-43455-sdio \ - kmod-brcmfmac wpad-basic-mbedtls + kmod-brcmfmac wpad-basic-mbedtls \ + kmod-i2c-bcm2835 kmod-spi-bcm2835 \ + kmod-spi-bcm2835-aux endef ifeq ($(SUBTARGET),bcm2710) TARGET_DEVICES += rpi-3 @@ -183,6 +189,9 @@ define Device/rpi-4 cypress-firmware-43455-sdio \ brcmfmac-nvram-43455-sdio \ kmod-brcmfmac wpad-basic-mbedtls \ + kmod-i2c-bcm2835 kmod-spi-bcm2835 \ + kmod-spi-bcm2835-aux \ + kmod-i2c-brcmstb \ kmod-usb-net-lan78xx \ kmod-r8169 IMAGE/sysupgrade.img.gz := boot-common | boot-2711 | sdcard-img | gzip | append-metadata @@ -210,6 +219,9 @@ define Device/rpi-5 cypress-firmware-43455-sdio \ brcmfmac-nvram-43455-sdio \ kmod-brcmfmac wpad-basic-mbedtls \ + kmod-i2c-bcm2835 kmod-spi-bcm2835 \ + kmod-i2c-brcmstb \ + kmod-i2c-designware-platform kmod-spi-dw-mmio \ kmod-hwmon-pwmfan kmod-thermal IMAGE/sysupgrade.img.gz := boot-common | sdcard-img | gzip | append-metadata IMAGE/factory.img.gz := boot-common | sdcard-img | gzip From 2f27d0fefa7e013ad5d7bfdf1c5e132d303079c3 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 16 May 2025 12:42:00 +0200 Subject: [PATCH 721/877] ubus: update to Git HEAD (2025-05-16) 88e6325092bf libubus: flush all pending requests on connection loss Signed-off-by: Felix Fietkau (cherry picked from commit 707a89bc264e0a2b6593da753301912d7ec40f77) --- package/system/ubus/Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/package/system/ubus/Makefile b/package/system/ubus/Makefile index 9a807852a250b1..ceaa587abf56ba 100644 --- a/package/system/ubus/Makefile +++ b/package/system/ubus/Makefile @@ -5,10 +5,11 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/ubus.git -PKG_SOURCE_DATE:=2025-01-02 -PKG_SOURCE_VERSION:=afa57cce0aff82f4a7a0e509d4387ebc23dd3be7 -PKG_MIRROR_HASH:=a0b3c1961f5f49d31c34a44576ce44538c3ee97bfce97f86f732d7ecc1df9798 -PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE)) +PKG_SOURCE_DATE:=2025-05-16 +PKG_SOURCE_DATE_ABI:=2025-01-02 +PKG_SOURCE_VERSION:=88e6325092bf1d1cfa877cd220670fa7cc2fad03 +PKG_MIRROR_HASH:=8af913d18c9f50cabfd3d32ce3462028ecf469d5e649ccf7f642d9d6bd6dc695 +PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE_ABI)) CMAKE_INSTALL:=1 PKG_LICENSE:=LGPL-2.1 From 0b265f4562953ec06e1171f7a09b58d7a7e8d533 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 5 May 2025 09:58:01 +0200 Subject: [PATCH 722/877] libubox: update to Git HEAD (2024-12-19) 3868f47c8f6c blob: constify attr argument to blob_memdup Signed-off-by: Felix Fietkau (cherry picked from commit 6f8f4041137cd9a922647487e7cfa3342bd3fcc9) --- package/libs/libubox/Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/package/libs/libubox/Makefile b/package/libs/libubox/Makefile index 22abfd4372e38b..6cd76bcc758fc4 100644 --- a/package/libs/libubox/Makefile +++ b/package/libs/libubox/Makefile @@ -5,10 +5,11 @@ PKG_RELEASE=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/libubox.git -PKG_MIRROR_HASH:=a4f671d10840fd8487394335636051a6df5edf6d8854af4fcb834a590efb240a -PKG_SOURCE_DATE:=2024-03-29 -PKG_SOURCE_VERSION:=eb9bcb64185ac155c02cc1a604692c4b00368324 -PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE)) +PKG_MIRROR_HASH:=e10144cfae155cf2ae5fdf167bd575dbf34c7751ddb112554b6962003f989b36 +PKG_SOURCE_DATE:=2024-12-19 +PKG_SOURCE_DATE_ABI:=2024-03-29 +PKG_SOURCE_VERSION:=3868f47c8f6c6570e62a3cdf8a7f26ffb1a67e6a +PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE_ABI)) CMAKE_INSTALL:=1 PKG_LICENSE:=ISC From f3ee7c9e14016f1510e747c42a1a231e3fa3a14c Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 17 Mar 2025 10:25:04 +0100 Subject: [PATCH 723/877] ucode: update to Git HEAD (2025-03-17) 9d94d54ed1a3 uci: implement cursor.list_append() and cursor.list_remove() a5a299075f37 zlib: rework code logic ee6a6c3ca579 zlib: deduplicate code d20f7bb87d47 zlib: add stream-oriented deflate operations 0255af462be3 zlib: add stream-oriented inflate operations 9260bd5354bf WIP: lib: support map() over objects 60f05ac60bfe docs: cover switch statement in syntax article 338aa2ebf00e docs: add article with array specific information df5a79a04b17 uci: link save() and commit() functions in cursor class description 03fb60d0e4b3 docs: add detailed documentation article for dictionaries 8e122f16327c ubus: add support for calling system objects 21a615c84367 socket: add reuseaddr argument for socket.listen() e04908ef57e7 uci: add support for altering the override config directory 9dbace122d7e socket: add missing documentation for socket.listen() reuseaddr 312b25482b30 ubus: add errval_return() helper macro 1af4a6bbc206 ubus: add channel defer() method 0002684b9772 ubus: support sending multiple reply messages on a request fb1da7157d13 ubus: remove broken implied await when calling defer() outside of uloop.run() 67a4ad20f172 ubus: fix uninitialized variable warning Fixes: https://github.com/jow-/ucode/issues/279 Signed-off-by: Felix Fietkau (cherry picked from commit 960e1c4c247abc264124b8eeabde2424eef476f7) --- 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 ef253f897edd58..dfee0c19a19196 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:=2025-02-10 -PKG_SOURCE_VERSION:=a8a11aea0c093d669bb3c45f604dab3c291c8d25 -PKG_MIRROR_HASH:=e08c36818a72eb2953b56300207d1fb7a852ada33df36f63a495ad35ca21b88e +PKG_SOURCE_DATE:=2025-03-17 +PKG_SOURCE_VERSION:=c4d7f9164c4a692f96a58cb05a118a1410ebcf62 +PKG_MIRROR_HASH:=4bdce7c5349d221066b44e3d37fcffd59a3dd4a6bce656ef52184bd90a48bde6 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC From 9d7aa9abade44d6af83a217b09fa47af65732e35 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 25 Mar 2025 11:07:24 +0100 Subject: [PATCH 724/877] ucode: update to Git HEAD (2025-03-24) 2824982da336 ubus: fix broken uc_ubus_defer() Signed-off-by: Felix Fietkau (cherry picked from commit 2ced0e59a43acc028d10bf4cbb77e8818645e23e) --- 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 dfee0c19a19196..a342c7471f4f5f 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:=2025-03-17 -PKG_SOURCE_VERSION:=c4d7f9164c4a692f96a58cb05a118a1410ebcf62 -PKG_MIRROR_HASH:=4bdce7c5349d221066b44e3d37fcffd59a3dd4a6bce656ef52184bd90a48bde6 +PKG_SOURCE_DATE:=2025-03-24 +PKG_SOURCE_VERSION:=b27d70c977ab4381f4094a0b1208e2a13fc5123f +PKG_MIRROR_HASH:=30a19d71a55ac320c92879beaed18a2f8da7b3b523eb7effa34ad3c4f9e1e50d PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC From 7dd96329ef0893918df292c1de73481f3fd7fbf4 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 9 May 2025 12:04:28 +0200 Subject: [PATCH 725/877] ucode: add fix for double registry clear on channel disconnect Avoid clobbering registry items of unrelated connections. Signed-off-by: Felix Fietkau (cherry picked from commit eaab68be92ab1a469ac448732f3297ee1444c980) --- ...-double-registry-clear-on-disconnect.patch | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 package/utils/ucode/patches/010-ubus-fix-double-registry-clear-on-disconnect.patch diff --git a/package/utils/ucode/patches/010-ubus-fix-double-registry-clear-on-disconnect.patch b/package/utils/ucode/patches/010-ubus-fix-double-registry-clear-on-disconnect.patch new file mode 100644 index 00000000000000..70b6a99be7958b --- /dev/null +++ b/package/utils/ucode/patches/010-ubus-fix-double-registry-clear-on-disconnect.patch @@ -0,0 +1,26 @@ +From: Felix Fietkau +Date: Fri, 9 May 2025 11:57:57 +0200 +Subject: [PATCH] ubus: fix double registry clear on disconnect + +Set c->registry_index to -1 in order to ensure that the resource free path +does not clobber registry items of unrelated connections. + +Signed-off-by: Felix Fietkau +--- + +--- a/lib/ubus.c ++++ b/lib/ubus.c +@@ -2375,8 +2375,11 @@ uc_ubus_channel_disconnect_cb(struct ubu + c->ctx.sock.fd = -1; + } + +- if (c->registry_index >= 0) +- connection_reg_clear(c->vm, c->registry_index); ++ if (c->registry_index >= 0) { ++ int idx = c->registry_index; ++ c->registry_index = -1; ++ connection_reg_clear(c->vm, idx); ++ } + } + + static uc_value_t * From 0ea2a93fc74f8348dfc04272e42293ad7795e962 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 11 May 2025 15:25:54 +0200 Subject: [PATCH 726/877] ucode: update to Git HEAD (2025-05-11) 567207a9bf16 fs: implement fileno() on directory handles eb1d93235509 fs: support passing directory handle or fd in chdir() 38a2254337f1 build: detect whether toolchain employs default source fortification 6eddfc9dff17 resolv: fix fd leak in send_queries 3d36856b2dc5 uci: fix memory leak on cursor() error aafde95f1ecf uci: add cursor() flags argument d8cebc5a6bfd Revert "WIP: lib: support map() over objects" 2599cf80736b zlib: incorporate latest PR changes 830f316a7e49 socker: let sock.peercred() clear error on success 4cbac141406e types: rename u64_to_constant flag to ext_flag d802fe5da5cd types: add support for resources with embedded data/values 71b4fdc6f60b types: add support for setting resource persistent flag 141f799eba08 uloop: use container_of instead of direct pointer casts 1396f8f2988d uloop: use uc_fn_thisval 9a121fc7440c uloop: drop object_registry 11b804d97086 socket: do not clear last_error in socket.error() d5b3a9dc1091 socket: add strerror() method Fixes: https://github.com/jow-/ucode/issues/285 Signed-off-by: Felix Fietkau (cherry picked from commit 2a9316fbfb6e123e0d2672a9726dc752c7f6dbdd) --- 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 a342c7471f4f5f..ed155af02f3d60 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:=2025-03-24 -PKG_SOURCE_VERSION:=b27d70c977ab4381f4094a0b1208e2a13fc5123f -PKG_MIRROR_HASH:=30a19d71a55ac320c92879beaed18a2f8da7b3b523eb7effa34ad3c4f9e1e50d +PKG_SOURCE_DATE:=2025-05-11 +PKG_SOURCE_VERSION:=d5b3a9dc1091dd28cf6f0f60cd34fc322ef27717 +PKG_MIRROR_HASH:=cd8af9d5ac28e2530b56015a3f2fcf6f36062546cac8b23a5f7b75b367209b54 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC From c45c2f3c1cc3721704a60d73f9e08cc52dea9289 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 12 May 2025 12:46:12 +0200 Subject: [PATCH 727/877] ucode: ubus: fix use-after-free on deferred request reply() method Hold a reference to the defer resource as long as it is still needed Signed-off-by: Felix Fietkau (cherry picked from commit 87bfde67f2504bbd649e185fc15619d769ab9b26) --- ...er-free-on-deferred-request-reply-me.patch | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 package/utils/ucode/patches/020-ubus-fix-use-after-free-on-deferred-request-reply-me.patch diff --git a/package/utils/ucode/patches/020-ubus-fix-use-after-free-on-deferred-request-reply-me.patch b/package/utils/ucode/patches/020-ubus-fix-use-after-free-on-deferred-request-reply-me.patch new file mode 100644 index 00000000000000..142595a5bdbb5e --- /dev/null +++ b/package/utils/ucode/patches/020-ubus-fix-use-after-free-on-deferred-request-reply-me.patch @@ -0,0 +1,27 @@ +From: Felix Fietkau +Date: Mon, 12 May 2025 12:43:44 +0200 +Subject: [PATCH] ubus: fix use-after-free on deferred request reply() method + +Hold a reference to the defer resource as long as it is still needed + +Signed-off-by: Felix Fietkau +--- + +--- a/lib/ubus.c ++++ b/lib/ubus.c +@@ -636,6 +636,7 @@ uc_ubus_call_user_cb(uc_ubus_deferred_t + uc_value_t *this, *func; + + request_reg_get(defer->vm, defer->registry_index, &this, &func, NULL, NULL); ++ ucv_get(this); + + if (ucv_is_callable(func)) { + uc_vm_stack_push(defer->vm, ucv_get(this)); +@@ -648,6 +649,7 @@ uc_ubus_call_user_cb(uc_ubus_deferred_t + } + + request_reg_clear(defer->vm, defer->registry_index); ++ ucv_put(this); + } + + static void From 79f8461b78aeeed534cb5738aef473617ed6873b Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Fri, 13 Jun 2025 14:32:47 +0200 Subject: [PATCH 728/877] ipq-wifi: add missing dependency on TARGET_ath79 A previous commit backported the ipq-wifi update to fix support for the TP-Link Archer C6 v2 by adding the device to the package. However, it missed adding the required TARGET_ath79 dependency, causing the ipq-tplink_archer-c6-v2 build to fail. The dependency was previously added in commit 4990ce613b7d ("ipq-wifi: update to 2024-02-17") when several ath79 devices were introduced. However, since this backport only fixes support for the Archer C6 v2, it is not feasible to backport all related changes. Therefore, this commit adds only the missing dependency to resolve the build issue without pulling in unrelated updates. Fixes: 0c43acc349a7 ("ipq-wifi: update to Git HEAD (2025-05-30)") Signed-off-by: Nick Hainke Link: https://github.com/openwrt/openwrt/pull/19120 Signed-off-by: Robert Marko --- package/firmware/ipq-wifi/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index a03e3037375d46..b7a492be325af4 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -73,7 +73,7 @@ define Package/ipq-wifi-default SUBMENU:=ath10k Board-Specific Overrides SECTION:=firmware CATEGORY:=Firmware - DEPENDS:=@(TARGET_ipq40xx||TARGET_ipq806x||TARGET_qualcommax) + DEPENDS:=@(TARGET_ath79||TARGET_ipq40xx||TARGET_ipq806x||TARGET_qualcommax) TITLE:=Custom Board endef From 7d620f83e39e189edf25a37ef70e6abb83a35115 Mon Sep 17 00:00:00 2001 From: John Audia Date: Wed, 4 Jun 2025 10:42:35 -0400 Subject: [PATCH 729/877] kernel: bump 6.6 to 6.6.93 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.93 Removed upstreamed: backport-6.6/780-51-v6.15-r8169-don-t-scan-PHY-addresses-0.patch[1] Additionally removed during backporting to 24.10: platform/950-0423-media-i2c-imx219-Correct-the-minimum-vblanking-value.patch [2] platform/950-1550-drm-v3d-Add-clock-handling.patch [3] 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.93&id=961ee132104b09e054308e53d8ab4a2386a21904 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.93&id=0b9d2468c3d88c924f505e950c4de74ace09795c 3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.93&id=9ef9ecabc6b559a0cf8603696997625087791a53 All other patches automatically rebased. Build system: x86/64 Build-tested: flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3, x86/64 Run-tested: flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3, x86/64 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/19026 Signed-off-by: Nick Hainke (cherry picked from commit a878dd24e7985ab87420df3e2551c99ba794838a) Co-authored-by: Goetz Goerisch Signed-off-by: Goetz Goerisch Link: https://github.com/openwrt/openwrt/pull/19113 Signed-off-by: Hauke Mehrtens --- include/kernel-6.6 | 4 +- .../900-unaligned_access_hacks.patch | 2 +- ...rs-remove-legacy_cursor_update-hacks.patch | 4 +- ...092-MMC-added-alternative-MMC-driver.patch | 4 +- ...180-Default-to-the-first-valid-input.patch | 4 +- ...v7180-Add-YPrPb-support-for-ADV7282M.patch | 2 +- ...m-v3d-Clock-V3D-down-when-not-in-use.patch | 4 +- ...ce-quirks-for-Freeway-Airmouse-T3-an.patch | 8 +- ...Handle-missing-clock-more-gracefully.patch | 2 +- ...-v3d-Switch-clock-setting-to-new-api.patch | 4 +- ...-Nasty-hack-to-allow-input-selection.patch | 8 +- ...53x-Add-ti-tca9554-compatible-string.patch | 2 +- ...-Correct-the-minimum-vblanking-value.patch | 26 ---- ...5-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch | 6 +- .../950-0514-sdhci-Add-SD-Express-hook.patch | 6 +- ...0521-PCI-brcmstb-Add-BCM2712-support.patch | 11 -- ...mc-sdhci-add-SPURIOUS_INT_RESP-quirk.patch | 2 +- ...0-Use-MEDIA_BUS_FMT_UYVY8_1X16-for-C.patch | 4 +- ...0-Add-support-for-V4L2_CID_LINK_FREQ.patch | 16 +-- ...ware-Support-non-standard-bus-speeds.patch | 2 +- ...-maximum-ADMA-transfer-length-to-4Mi.patch | 2 +- ...re-Add-support-for-bus-clear-feature.patch | 4 +- .../950-1550-drm-v3d-Add-clock-handling.patch | 129 ------------------ ...e-a-V3D-tech-revision-to-all-support.patch | 2 +- ...SMS-registers-for-power-on-off-and-r.patch | 2 +- ...-codec-add-basic-support-for-D1-audi.patch | 47 +++---- ..._eth_soc-rely-on-mtk_pse_port-defini.patch | 2 +- ..._wed-introduce-WED-support-for-MT798.patch | 2 +- ..._wed-introduce-partial-AMSDU-offload.patch | 4 +- ..._eth_soc-ppe-add-support-for-multipl.patch | 4 +- ..._eth_soc-ppe-prevent-ppe-update-for-.patch | 2 +- ...support-for-LED-s-on-RTL8168-RTL8101.patch | 4 +- ...ix-building-with-CONFIG_LEDS_CLASS-m.patch | 2 +- ...-07-v6.9-r8169-simplify-EEE-handling.patch | 4 +- ...-v6.9-r8169-add-support-for-RTL8126A.patch | 2 +- ...ode-by-using-core-provided-pcpu-stat.patch | 4 +- ...-add-LED-support-for-RTL8125-RTL8126.patch | 2 +- ...D-related-deadlock-on-module-removal.patch | 2 +- ...r8169-add-support-for-RTL8126A-rev.b.patch | 2 +- ...TSO-on-selected-chip-versions-per-de.patch | 4 +- ...leftover-locks-after-reverted-change.patch | 2 +- ...r-driver-2.5G-5G-EEE-advertisement-c.patch | 2 +- ...9-remove-support-for-chip-version-11.patch | 2 +- ...adjust-version-numbering-for-RTL8126.patch | 2 +- ....15-r8169-don-t-scan-PHY-addresses-0.patch | 26 ---- ...mem-qfprom-Mark-core-clk-as-optional.patch | 2 +- ...4-Revert-nvmem-add-new-config-option.patch | 2 +- ...mem_layout_get_container-in-another-.patch | 2 +- ...rk-layouts-to-become-regular-devices.patch | 20 +-- ...vmem-core-Expose-cells-through-sysfs.patch | 4 +- ...factor-.add_cells-callback-arguments.patch | 2 +- ...mem-drop-nvmem_layout_get_match_data.patch | 2 +- ...rint-error-on-wrong-bits-DT-property.patch | 2 +- ...igger-netdev-Extend-speeds-up-to-10G.patch | 14 +- .../hack-6.6/901-debloat_sock_diag.patch | 2 +- .../generic/hack-6.6/902-debloat_proc.patch | 4 +- ...ng-with-source-address-failed-policy.patch | 2 +- ...-support-mac-base-fixed-layout-cells.patch | 4 +- ...q-qcom-nvmem-add-support-for-IPQ6018.patch | 2 +- ...q-qcom-nvmem-add-support-for-IPQ8074.patch | 2 +- ...ove-performance-usb-using-lowmem-for.patch | 2 +- 61 files changed, 129 insertions(+), 320 deletions(-) delete mode 100644 target/linux/bcm27xx/patches-6.6/950-0423-media-i2c-imx219-Correct-the-minimum-vblanking-value.patch delete mode 100644 target/linux/bcm27xx/patches-6.6/950-1550-drm-v3d-Add-clock-handling.patch delete mode 100644 target/linux/generic/backport-6.6/780-51-v6.15-r8169-don-t-scan-PHY-addresses-0.patch diff --git a/include/kernel-6.6 b/include/kernel-6.6 index 96534d711c108a..c39b5c102aa5b3 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .92 -LINUX_KERNEL_HASH-6.6.92 = 1d82a82642d281c31d86f7301bc55e12a8a9f9c04532e249ef8ae6fe7dc237ec +LINUX_VERSION-6.6 = .93 +LINUX_KERNEL_HASH-6.6.93 = 0d79ff359635e9f009f1e330deed5f3aefd8c452b80660bffdc504b877797719 diff --git a/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch b/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch index bc1c1dd82d78d4..92c8cd90d1b055 100644 --- a/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch @@ -751,7 +751,7 @@ SVN-Revision: 35130 EXPORT_SYMBOL(xfrm_parse_spi); --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c -@@ -4268,14 +4268,16 @@ static bool tcp_parse_aligned_timestamp( +@@ -4276,14 +4276,16 @@ static bool tcp_parse_aligned_timestamp( { const __be32 *ptr = (const __be32 *)(th + 1); diff --git a/target/linux/bcm27xx/patches-6.6/950-0025-drm-atomic-helpers-remove-legacy_cursor_update-hacks.patch b/target/linux/bcm27xx/patches-6.6/950-0025-drm-atomic-helpers-remove-legacy_cursor_update-hacks.patch index a0981c9c0d90d8..6655920b1ee13d 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0025-drm-atomic-helpers-remove-legacy_cursor_update-hacks.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0025-drm-atomic-helpers-remove-legacy_cursor_update-hacks.patch @@ -60,7 +60,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c -@@ -1653,13 +1653,6 @@ drm_atomic_helper_wait_for_vblanks(struc +@@ -1681,13 +1681,6 @@ drm_atomic_helper_wait_for_vblanks(struc int i, ret; unsigned int crtc_mask = 0; @@ -74,7 +74,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; -@@ -2309,12 +2302,6 @@ int drm_atomic_helper_setup_commit(struc +@@ -2337,12 +2330,6 @@ int drm_atomic_helper_setup_commit(struc complete_all(&commit->flip_done); continue; } diff --git a/target/linux/bcm27xx/patches-6.6/950-0092-MMC-added-alternative-MMC-driver.patch b/target/linux/bcm27xx/patches-6.6/950-0092-MMC-added-alternative-MMC-driver.patch index 9b86d0e6a32af2..a0b5d2fd2a8a17 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0092-MMC-added-alternative-MMC-driver.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0092-MMC-added-alternative-MMC-driver.patch @@ -1993,7 +1993,7 @@ Signed-off-by: Phil Elwell #define MAX_TUNING_LOOP 40 -@@ -3212,7 +3212,7 @@ static void sdhci_timeout_timer(struct t +@@ -3217,7 +3217,7 @@ static void sdhci_timeout_timer(struct t spin_lock_irqsave(&host->lock, flags); if (host->cmd && !sdhci_data_line_cmd(host->cmd)) { @@ -2002,7 +2002,7 @@ Signed-off-by: Phil Elwell mmc_hostname(host->mmc)); sdhci_err_stats_inc(host, REQ_TIMEOUT); sdhci_dumpregs(host); -@@ -3235,7 +3235,7 @@ static void sdhci_timeout_data_timer(str +@@ -3240,7 +3240,7 @@ static void sdhci_timeout_data_timer(str if (host->data || host->data_cmd || (host->cmd && sdhci_data_line_cmd(host->cmd))) { diff --git a/target/linux/bcm27xx/patches-6.6/950-0138-media-adv7180-Default-to-the-first-valid-input.patch b/target/linux/bcm27xx/patches-6.6/950-0138-media-adv7180-Default-to-the-first-valid-input.patch index 7669317e602295..181b69b807ec97 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0138-media-adv7180-Default-to-the-first-valid-input.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0138-media-adv7180-Default-to-the-first-valid-input.patch @@ -16,7 +16,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/media/i2c/adv7180.c +++ b/drivers/media/i2c/adv7180.c -@@ -1340,6 +1340,7 @@ static const struct adv7180_chip_info ad +@@ -1350,6 +1350,7 @@ static const struct adv7180_chip_info ad static int init_device(struct adv7180_state *state) { int ret; @@ -24,7 +24,7 @@ Signed-off-by: Dave Stevenson mutex_lock(&state->mutex); -@@ -1387,6 +1388,18 @@ static int init_device(struct adv7180_st +@@ -1397,6 +1398,18 @@ static int init_device(struct adv7180_st goto out_unlock; } diff --git a/target/linux/bcm27xx/patches-6.6/950-0139-media-adv7180-Add-YPrPb-support-for-ADV7282M.patch b/target/linux/bcm27xx/patches-6.6/950-0139-media-adv7180-Add-YPrPb-support-for-ADV7282M.patch index faaf79f2ae0dd7..caa83f409f870f 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0139-media-adv7180-Add-YPrPb-support-for-ADV7282M.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0139-media-adv7180-Add-YPrPb-support-for-ADV7282M.patch @@ -14,7 +14,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/media/i2c/adv7180.c +++ b/drivers/media/i2c/adv7180.c -@@ -1329,6 +1329,7 @@ static const struct adv7180_chip_info ad +@@ -1339,6 +1339,7 @@ static const struct adv7180_chip_info ad BIT(ADV7182_INPUT_SVIDEO_AIN1_AIN2) | BIT(ADV7182_INPUT_SVIDEO_AIN3_AIN4) | BIT(ADV7182_INPUT_SVIDEO_AIN7_AIN8) | diff --git a/target/linux/bcm27xx/patches-6.6/950-0167-drm-v3d-Clock-V3D-down-when-not-in-use.patch b/target/linux/bcm27xx/patches-6.6/950-0167-drm-v3d-Clock-V3D-down-when-not-in-use.patch index 031d8ab6b23db9..e15fafed50876b 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0167-drm-v3d-Clock-V3D-down-when-not-in-use.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0167-drm-v3d-Clock-V3D-down-when-not-in-use.patch @@ -25,7 +25,7 @@ Signed-off-by: Phil Elwell --- a/drivers/gpu/drm/v3d/v3d_drv.c +++ b/drivers/gpu/drm/v3d/v3d_drv.c -@@ -256,6 +256,21 @@ static int v3d_platform_drm_probe(struct +@@ -266,6 +266,21 @@ static int v3d_platform_drm_probe(struct } } @@ -47,7 +47,7 @@ Signed-off-by: Phil Elwell if (v3d->ver < 41) { ret = map_regs(v3d, &v3d->gca_regs, "gca"); if (ret) -@@ -281,6 +296,9 @@ static int v3d_platform_drm_probe(struct +@@ -292,6 +307,9 @@ static int v3d_platform_drm_probe(struct if (ret) goto irq_disable; diff --git a/target/linux/bcm27xx/patches-6.6/950-0169-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch b/target/linux/bcm27xx/patches-6.6/950-0169-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch index 12518a43987ea5..86c4d87d807737 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0169-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0169-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 -@@ -244,6 +244,9 @@ +@@ -248,6 +248,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 -@@ -1439,6 +1442,9 @@ +@@ -1443,6 +1446,9 @@ #define USB_VENDOR_ID_XIAOMI 0x2717 #define USB_DEVICE_ID_MI_SILENT_MOUSE 0x5014 @@ -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 -@@ -42,6 +42,7 @@ static const struct hid_device_id hid_qu +@@ -44,6 +44,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 }, -@@ -209,6 +210,7 @@ static const struct hid_device_id hid_qu +@@ -211,6 +212,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-6.6/950-0187-v3d_drv-Handle-missing-clock-more-gracefully.patch b/target/linux/bcm27xx/patches-6.6/950-0187-v3d_drv-Handle-missing-clock-more-gracefully.patch index d8a7c28bd673f1..dc601a66979858 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0187-v3d_drv-Handle-missing-clock-more-gracefully.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0187-v3d_drv-Handle-missing-clock-more-gracefully.patch @@ -10,7 +10,7 @@ Signed-off-by: popcornmix --- a/drivers/gpu/drm/v3d/v3d_drv.c +++ b/drivers/gpu/drm/v3d/v3d_drv.c -@@ -257,10 +257,10 @@ static int v3d_platform_drm_probe(struct +@@ -267,10 +267,10 @@ static int v3d_platform_drm_probe(struct } v3d->clk = devm_clk_get(dev, NULL); diff --git a/target/linux/bcm27xx/patches-6.6/950-0376-drm-v3d-Switch-clock-setting-to-new-api.patch b/target/linux/bcm27xx/patches-6.6/950-0376-drm-v3d-Switch-clock-setting-to-new-api.patch index 2670c4e27a2b8a..aa613e73dd5bfb 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0376-drm-v3d-Switch-clock-setting-to-new-api.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0376-drm-v3d-Switch-clock-setting-to-new-api.patch @@ -34,7 +34,7 @@ Signed-off-by: Maxime Ripard struct drm_device *drm; struct v3d_dev *v3d; int ret; -@@ -262,7 +267,20 @@ static int v3d_platform_drm_probe(struct +@@ -272,7 +277,20 @@ static int v3d_platform_drm_probe(struct dev_err(dev, "Failed to get clock (%ld)\n", PTR_ERR(v3d->clk)); return PTR_ERR(v3d->clk); } @@ -56,7 +56,7 @@ Signed-off-by: Maxime Ripard /* For downclocking, drop it to the minimum frequency we can get from * the CPRMAN clock generator dividing off our parent. The divider is * 4 bits, but ask for just higher than that so that rounding doesn't -@@ -296,7 +314,7 @@ static int v3d_platform_drm_probe(struct +@@ -307,7 +325,7 @@ static int v3d_platform_drm_probe(struct if (ret) goto irq_disable; diff --git a/target/linux/bcm27xx/patches-6.6/950-0395-media-adv7180-Nasty-hack-to-allow-input-selection.patch b/target/linux/bcm27xx/patches-6.6/950-0395-media-adv7180-Nasty-hack-to-allow-input-selection.patch index 75c37d357db045..22168e3c4e7345 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0395-media-adv7180-Nasty-hack-to-allow-input-selection.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0395-media-adv7180-Nasty-hack-to-allow-input-selection.patch @@ -31,7 +31,7 @@ Signed-off-by: Dave Stevenson struct adv7180_state; #define ADV7180_FLAG_RESET_POWERED BIT(0) -@@ -406,10 +410,24 @@ out: +@@ -407,10 +411,24 @@ out: return ret; } @@ -57,7 +57,7 @@ Signed-off-by: Dave Stevenson if (ret) return ret; -@@ -435,7 +453,11 @@ static int adv7180_program_std(struct ad +@@ -436,7 +454,11 @@ static int adv7180_program_std(struct ad static int adv7180_s_std(struct v4l2_subdev *sd, v4l2_std_id std) { struct adv7180_state *state = to_state(sd); @@ -70,7 +70,7 @@ Signed-off-by: Dave Stevenson if (ret) return ret; -@@ -457,6 +479,8 @@ static int adv7180_g_std(struct v4l2_sub +@@ -458,6 +480,8 @@ static int adv7180_g_std(struct v4l2_sub { struct adv7180_state *state = to_state(sd); @@ -79,7 +79,7 @@ Signed-off-by: Dave Stevenson *norm = state->curr_norm; return 0; -@@ -886,6 +910,8 @@ static int adv7180_s_stream(struct v4l2_ +@@ -891,6 +915,8 @@ static int adv7180_s_stream(struct v4l2_ return 0; } diff --git a/target/linux/bcm27xx/patches-6.6/950-0416-gpio-pca953x-Add-ti-tca9554-compatible-string.patch b/target/linux/bcm27xx/patches-6.6/950-0416-gpio-pca953x-Add-ti-tca9554-compatible-string.patch index e0de6fe1cb8a98..9f1ac40c21741e 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0416-gpio-pca953x-Add-ti-tca9554-compatible-string.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0416-gpio-pca953x-Add-ti-tca9554-compatible-string.patch @@ -10,7 +10,7 @@ Signed-off-by: Phil Elwell --- a/drivers/gpio/gpio-pca953x.c +++ b/drivers/gpio/gpio-pca953x.c -@@ -1311,6 +1311,7 @@ static const struct of_device_id pca953x +@@ -1312,6 +1312,7 @@ static const struct of_device_id pca953x { .compatible = "ti,tca6424", .data = OF_953X(24, PCA_INT), }, { .compatible = "ti,tca9538", .data = OF_953X( 8, PCA_INT), }, { .compatible = "ti,tca9539", .data = OF_953X(16, PCA_INT), }, diff --git a/target/linux/bcm27xx/patches-6.6/950-0423-media-i2c-imx219-Correct-the-minimum-vblanking-value.patch b/target/linux/bcm27xx/patches-6.6/950-0423-media-i2c-imx219-Correct-the-minimum-vblanking-value.patch deleted file mode 100644 index ab2e9dda8c6f51..00000000000000 --- a/target/linux/bcm27xx/patches-6.6/950-0423-media-i2c-imx219-Correct-the-minimum-vblanking-value.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 4b249d9f2436af70ed9a8c2a34be0786f3fe026c Mon Sep 17 00:00:00 2001 -From: David Plowman -Date: Tue, 25 Jan 2022 15:48:53 +0000 -Subject: [PATCH 0423/1085] media: i2c: imx219: Correct the minimum vblanking - value - -The datasheet for this sensor documents the minimum vblanking as being -32 lines. It does fix some problems with occasional black lines at the -bottom of images (tested on Raspberry Pi). - -Signed-off-by: David Plowman ---- - drivers/media/i2c/imx219.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/media/i2c/imx219.c -+++ b/drivers/media/i2c/imx219.c -@@ -77,7 +77,7 @@ - #define IMX219_VTS_30FPS_640x480 0x06e3 - #define IMX219_VTS_MAX 0xffff - --#define IMX219_VBLANK_MIN 4 -+#define IMX219_VBLANK_MIN 32 - - /*Frame Length Line*/ - #define IMX219_FLL_MIN 0x08a6 diff --git a/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch b/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch index e1c96d25bb27d5..99059c12dbab19 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch @@ -75,7 +75,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 -@@ -3718,6 +3718,48 @@ static int xhci_align_td(struct xhci_hcd +@@ -3728,6 +3728,48 @@ static int xhci_align_td(struct xhci_hcd return 1; } @@ -124,7 +124,7 @@ Signed-off-by: Jonathan Bell /* This is very similar to what ehci-q.c qtd_fill() does */ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, struct urb *urb, int slot_id, unsigned int ep_index) -@@ -3874,6 +3916,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3884,6 +3926,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd * } check_trb_math(urb, enqd_len); @@ -133,7 +133,7 @@ Signed-off-by: Jonathan Bell giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, start_cycle, start_trb); return 0; -@@ -4023,6 +4067,8 @@ int xhci_queue_ctrl_tx(struct xhci_hcd * +@@ -4033,6 +4077,8 @@ int xhci_queue_ctrl_tx(struct xhci_hcd * /* Event on completion */ field | TRB_IOC | TRB_TYPE(TRB_STATUS) | ep_ring->cycle_state); diff --git a/target/linux/bcm27xx/patches-6.6/950-0514-sdhci-Add-SD-Express-hook.patch b/target/linux/bcm27xx/patches-6.6/950-0514-sdhci-Add-SD-Express-hook.patch index 17c7d2f96571f3..e1ea7998ed505e 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0514-sdhci-Add-SD-Express-hook.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0514-sdhci-Add-SD-Express-hook.patch @@ -26,7 +26,7 @@ sdhci: remove PYA0_INTR_BUG quirk. Add quirks to disable some of the higher SDR static int dwcmshc_rk35xx_init(struct sdhci_host *host, struct dwcmshc_priv *dwc_priv) --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c -@@ -3050,6 +3050,15 @@ static void sdhci_card_event(struct mmc_ +@@ -3055,6 +3055,15 @@ static void sdhci_card_event(struct mmc_ spin_unlock_irqrestore(&host->lock, flags); } @@ -42,7 +42,7 @@ sdhci: remove PYA0_INTR_BUG quirk. Add quirks to disable some of the higher SDR static const struct mmc_host_ops sdhci_ops = { .request = sdhci_request, .post_req = sdhci_post_req, -@@ -3065,6 +3074,7 @@ static const struct mmc_host_ops sdhci_o +@@ -3070,6 +3079,7 @@ static const struct mmc_host_ops sdhci_o .execute_tuning = sdhci_execute_tuning, .card_event = sdhci_card_event, .card_busy = sdhci_card_busy, @@ -50,7 +50,7 @@ sdhci: remove PYA0_INTR_BUG quirk. Add quirks to disable some of the higher SDR }; /*****************************************************************************\ -@@ -4583,6 +4593,15 @@ int sdhci_setup_host(struct sdhci_host * +@@ -4588,6 +4598,15 @@ int sdhci_setup_host(struct sdhci_host * !(host->quirks2 & SDHCI_QUIRK2_BROKEN_DDR50)) mmc->caps |= MMC_CAP_UHS_DDR50; diff --git a/target/linux/bcm27xx/patches-6.6/950-0521-PCI-brcmstb-Add-BCM2712-support.patch b/target/linux/bcm27xx/patches-6.6/950-0521-PCI-brcmstb-Add-BCM2712-support.patch index 5f5b9de3412dd6..7fdbc085f59c70 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0521-PCI-brcmstb-Add-BCM2712-support.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0521-PCI-brcmstb-Add-BCM2712-support.patch @@ -341,17 +341,6 @@ Signed-off-by: Jonathan Bell struct subdev_regulators *sr; bool ep_wakeup_capable; }; -@@ -286,8 +371,8 @@ static int brcm_pcie_encode_ibar_size(u6 - if (log2_in >= 12 && log2_in <= 15) - /* Covers 4KB to 32KB (inclusive) */ - return (log2_in - 12) + 0x1c; -- else if (log2_in >= 16 && log2_in <= 35) -- /* Covers 64KB to 32GB, (inclusive) */ -+ else if (log2_in >= 16 && log2_in <= 36) -+ /* Covers 64KB to 64GB, (inclusive) */ - return log2_in - 15; - /* Something is awry so disable */ - return 0; @@ -376,6 +461,35 @@ static int brcm_pcie_set_ssc(struct brcm return ssc && pll ? 0 : -EIO; } diff --git a/target/linux/bcm27xx/patches-6.6/950-0716-drivers-mmc-sdhci-add-SPURIOUS_INT_RESP-quirk.patch b/target/linux/bcm27xx/patches-6.6/950-0716-drivers-mmc-sdhci-add-SPURIOUS_INT_RESP-quirk.patch index aacc0e76531019..46b33165b2f30c 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0716-drivers-mmc-sdhci-add-SPURIOUS_INT_RESP-quirk.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0716-drivers-mmc-sdhci-add-SPURIOUS_INT_RESP-quirk.patch @@ -36,7 +36,7 @@ Signed-off-by: Jonathan Bell sdhci_writew(host, SDHCI_MAKE_CMD(cmd->opcode, flags), SDHCI_COMMAND); return true; -@@ -3309,6 +3315,11 @@ static void sdhci_cmd_irq(struct sdhci_h +@@ -3314,6 +3320,11 @@ static void sdhci_cmd_irq(struct sdhci_h if (intmask & SDHCI_INT_TIMEOUT) { host->cmd->error = -ETIMEDOUT; sdhci_err_stats_inc(host, CMD_TIMEOUT); diff --git a/target/linux/bcm27xx/patches-6.6/950-0813-media-i2c-adv7180-Use-MEDIA_BUS_FMT_UYVY8_1X16-for-C.patch b/target/linux/bcm27xx/patches-6.6/950-0813-media-i2c-adv7180-Use-MEDIA_BUS_FMT_UYVY8_1X16-for-C.patch index 10c014b3bf945e..efb0fad7fee584 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0813-media-i2c-adv7180-Use-MEDIA_BUS_FMT_UYVY8_1X16-for-C.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0813-media-i2c-adv7180-Use-MEDIA_BUS_FMT_UYVY8_1X16-for-C.patch @@ -17,7 +17,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/media/i2c/adv7180.c +++ b/drivers/media/i2c/adv7180.c -@@ -723,10 +723,15 @@ static int adv7180_enum_mbus_code(struct +@@ -728,10 +728,15 @@ static int adv7180_enum_mbus_code(struct struct v4l2_subdev_state *sd_state, struct v4l2_subdev_mbus_code_enum *code) { @@ -34,7 +34,7 @@ Signed-off-by: Dave Stevenson return 0; } -@@ -736,7 +741,10 @@ static int adv7180_mbus_fmt(struct v4l2_ +@@ -741,7 +746,10 @@ static int adv7180_mbus_fmt(struct v4l2_ { struct adv7180_state *state = to_state(sd); diff --git a/target/linux/bcm27xx/patches-6.6/950-0814-media-i2c-adv7180-Add-support-for-V4L2_CID_LINK_FREQ.patch b/target/linux/bcm27xx/patches-6.6/950-0814-media-i2c-adv7180-Add-support-for-V4L2_CID_LINK_FREQ.patch index e6d03342289f18..20de51aabbcc97 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0814-media-i2c-adv7180-Add-support-for-V4L2_CID_LINK_FREQ.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0814-media-i2c-adv7180-Add-support-for-V4L2_CID_LINK_FREQ.patch @@ -33,7 +33,7 @@ Signed-off-by: Dave Stevenson static int dbg_input; module_param(dbg_input, int, 0644); MODULE_PARM_DESC(dbg_input, "Input number (0-31)"); -@@ -227,6 +237,7 @@ struct adv7180_state { +@@ -228,6 +238,7 @@ struct adv7180_state { const struct adv7180_chip_info *chip_info; enum v4l2_field field; bool force_bt656_4; @@ -41,7 +41,7 @@ Signed-off-by: Dave Stevenson }; #define to_adv7180_sd(_ctrl) (&container_of(_ctrl->handler, \ struct adv7180_state, \ -@@ -620,6 +631,9 @@ static int adv7180_s_ctrl(struct v4l2_ct +@@ -621,6 +632,9 @@ static int adv7180_s_ctrl(struct v4l2_ct if (ret) return ret; @@ -51,7 +51,7 @@ Signed-off-by: Dave Stevenson val = ctrl->val; switch (ctrl->id) { case V4L2_CID_BRIGHTNESS: -@@ -661,6 +675,7 @@ static int adv7180_s_ctrl(struct v4l2_ct +@@ -662,6 +676,7 @@ static int adv7180_s_ctrl(struct v4l2_ct ret = -EINVAL; } @@ -59,7 +59,7 @@ Signed-off-by: Dave Stevenson mutex_unlock(&state->mutex); return ret; } -@@ -681,7 +696,7 @@ static const struct v4l2_ctrl_config adv +@@ -682,7 +697,7 @@ static const struct v4l2_ctrl_config adv static int adv7180_init_controls(struct adv7180_state *state) { @@ -68,9 +68,9 @@ Signed-off-by: Dave Stevenson v4l2_ctrl_new_std(&state->ctrl_hdl, &adv7180_ctrl_ops, V4L2_CID_BRIGHTNESS, ADV7180_BRI_MIN, -@@ -703,6 +718,17 @@ static int adv7180_init_controls(struct - 0, ARRAY_SIZE(test_pattern_menu) - 1, - test_pattern_menu); +@@ -708,6 +723,17 @@ static int adv7180_init_controls(struct + test_pattern_menu); + } + if (state->chip_info->flags & ADV7180_FLAG_MIPI_CSI2) { + state->link_freq = @@ -86,7 +86,7 @@ Signed-off-by: Dave Stevenson state->sd.ctrl_handler = &state->ctrl_hdl; if (state->ctrl_hdl.error) { int err = state->ctrl_hdl.error; -@@ -835,6 +861,10 @@ static int adv7180_set_pad_format(struct +@@ -840,6 +866,10 @@ static int adv7180_set_pad_format(struct adv7180_set_power(state, false); adv7180_set_field_mode(state); adv7180_set_power(state, true); diff --git a/target/linux/bcm27xx/patches-6.6/950-0864-i2c-designware-Support-non-standard-bus-speeds.patch b/target/linux/bcm27xx/patches-6.6/950-0864-i2c-designware-Support-non-standard-bus-speeds.patch index 90a64e8f2bbfb4..0e1cd5bf2a164d 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0864-i2c-designware-Support-non-standard-bus-speeds.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0864-i2c-designware-Support-non-standard-bus-speeds.patch @@ -59,7 +59,7 @@ Signed-off-by: Phil Elwell --- a/drivers/i2c/busses/i2c-designware-core.h +++ b/drivers/i2c/busses/i2c-designware-core.h -@@ -293,6 +293,7 @@ struct dw_i2c_dev { +@@ -292,6 +292,7 @@ struct dw_i2c_dev { u16 fp_lcnt; u16 hs_hcnt; u16 hs_lcnt; diff --git a/target/linux/bcm27xx/patches-6.6/950-1116-mmc-sdhci-extend-maximum-ADMA-transfer-length-to-4Mi.patch b/target/linux/bcm27xx/patches-6.6/950-1116-mmc-sdhci-extend-maximum-ADMA-transfer-length-to-4Mi.patch index f0756b59451b7d..9389ecf4d884a3 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1116-mmc-sdhci-extend-maximum-ADMA-transfer-length-to-4Mi.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1116-mmc-sdhci-extend-maximum-ADMA-transfer-length-to-4Mi.patch @@ -24,7 +24,7 @@ Signed-off-by: Jonathan Bell BUG_ON(data->blksz > host->mmc->max_blk_size); BUG_ON(data->blocks > 65535); -@@ -4727,11 +4727,16 @@ int sdhci_setup_host(struct sdhci_host * +@@ -4732,11 +4732,16 @@ int sdhci_setup_host(struct sdhci_host * spin_lock_init(&host->lock); /* diff --git a/target/linux/bcm27xx/patches-6.6/950-1396-i2c-designware-Add-support-for-bus-clear-feature.patch b/target/linux/bcm27xx/patches-6.6/950-1396-i2c-designware-Add-support-for-bus-clear-feature.patch index bc20db253afc53..df2aad53c4ebba 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1396-i2c-designware-Add-support-for-bus-clear-feature.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1396-i2c-designware-Add-support-for-bus-clear-feature.patch @@ -134,7 +134,7 @@ Signed-off-by: Phil Elwell /* Write SDA hold time if supported */ if (dev->sda_hold_time) regmap_write(dev->map, DW_IC_SDA_HOLD, dev->sda_hold_time); -@@ -1074,6 +1086,7 @@ int i2c_dw_probe_master(struct dw_i2c_de +@@ -1049,6 +1061,7 @@ int i2c_dw_probe_master(struct dw_i2c_de struct i2c_adapter *adap = &dev->adapter; unsigned long irq_flags; unsigned int ic_con; @@ -142,7 +142,7 @@ Signed-off-by: Phil Elwell int ret; init_completion(&dev->cmd_complete); -@@ -1109,7 +1122,11 @@ int i2c_dw_probe_master(struct dw_i2c_de +@@ -1083,7 +1096,11 @@ int i2c_dw_probe_master(struct dw_i2c_de if (ret) return ret; diff --git a/target/linux/bcm27xx/patches-6.6/950-1550-drm-v3d-Add-clock-handling.patch b/target/linux/bcm27xx/patches-6.6/950-1550-drm-v3d-Add-clock-handling.patch deleted file mode 100644 index 3bce057bfdc836..00000000000000 --- a/target/linux/bcm27xx/patches-6.6/950-1550-drm-v3d-Add-clock-handling.patch +++ /dev/null @@ -1,129 +0,0 @@ -From 32c319ba2f2fd662a3b7bd042515cd650807dbff Mon Sep 17 00:00:00 2001 -From: Stefan Wahren -Date: Sat, 1 Feb 2025 13:50:46 +0100 -Subject: [PATCH] drm/v3d: Add clock handling -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -[ Upstream commit 4dd40b5f9c3d89b67af0dbe059cf4a51aac6bf06 ] - -Since the initial commit 57692c94dcbe ("drm/v3d: Introduce a new DRM driver -for Broadcom V3D V3.x+") the struct v3d_dev reserved a pointer for -an optional V3D clock. But there wasn't any code, which fetched it. -So add the missing clock handling before accessing any V3D registers. - -Signed-off-by: Stefan Wahren -Reviewed-by: Maíra Canal -Signed-off-by: Maíra Canal -Link: https://patchwork.freedesktop.org/patch/msgid/20250201125046.33030-1-wahrenst@gmx.net -[ Maíra: Backported to the downstream repository ] -Signed-off-by: Maíra Canal ---- - drivers/gpu/drm/v3d/v3d_drv.c | 44 ++++++++++++++++++++++------------- - 1 file changed, 28 insertions(+), 16 deletions(-) - ---- a/drivers/gpu/drm/v3d/v3d_drv.c -+++ b/drivers/gpu/drm/v3d/v3d_drv.c -@@ -232,11 +232,21 @@ static int v3d_platform_drm_probe(struct - if (ret) - return ret; - -+ v3d->clk = devm_clk_get_optional(dev, NULL); -+ if (IS_ERR(v3d->clk)) -+ return dev_err_probe(dev, PTR_ERR(v3d->clk), "Failed to get V3D clock\n"); -+ -+ ret = clk_prepare_enable(v3d->clk); -+ if (ret) { -+ dev_err(&pdev->dev, "Couldn't enable the V3D clock\n"); -+ return ret; -+ } -+ - mmu_debug = V3D_READ(V3D_MMU_DEBUG_INFO); - mask = DMA_BIT_MASK(30 + V3D_GET_FIELD(mmu_debug, V3D_MMU_PA_WIDTH)); - ret = dma_set_mask_and_coherent(dev, mask); - if (ret) -- return ret; -+ goto clk_disable; - - v3d->va_width = 30 + V3D_GET_FIELD(mmu_debug, V3D_MMU_VA_WIDTH); - -@@ -251,32 +261,29 @@ static int v3d_platform_drm_probe(struct - ret = PTR_ERR(v3d->reset); - - if (ret == -EPROBE_DEFER) -- return ret; -+ goto clk_disable; - - v3d->reset = NULL; - ret = map_regs(v3d, &v3d->bridge_regs, "bridge"); - if (ret) { - dev_err(dev, - "Failed to get reset control or bridge regs\n"); -- return ret; -+ goto clk_disable; - } - } - -- v3d->clk = devm_clk_get(dev, NULL); -- if (IS_ERR_OR_NULL(v3d->clk)) { -- if (PTR_ERR(v3d->clk) != -EPROBE_DEFER) -- dev_err(dev, "Failed to get clock (%ld)\n", PTR_ERR(v3d->clk)); -- return PTR_ERR(v3d->clk); -- } -- - node = rpi_firmware_find_node(); -- if (!node) -- return -EINVAL; -+ if (!node) { -+ ret = -EINVAL; -+ goto clk_disable; -+ } - - firmware = rpi_firmware_get(node); - of_node_put(node); -- if (!firmware) -- return -EPROBE_DEFER; -+ if (!firmware) { -+ ret = -EPROBE_DEFER; -+ goto clk_disable; -+ } - - v3d->clk_up_rate = rpi_firmware_clk_get_max_rate(firmware, - RPI_FIRMWARE_V3D_CLK_ID); -@@ -293,14 +300,15 @@ static int v3d_platform_drm_probe(struct - if (v3d->ver < 41) { - ret = map_regs(v3d, &v3d->gca_regs, "gca"); - if (ret) -- return ret; -+ goto clk_disable; - } - - v3d->mmu_scratch = dma_alloc_wc(dev, 4096, &v3d->mmu_scratch_paddr, - GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO); - if (!v3d->mmu_scratch) { - dev_err(dev, "Failed to allocate MMU scratch page\n"); -- return -ENOMEM; -+ ret = -ENOMEM; -+ goto clk_disable; - } - - ret = v3d_gem_init(drm); -@@ -326,6 +334,8 @@ gem_destroy: - v3d_gem_destroy(drm); - dma_free: - dma_free_wc(dev, 4096, v3d->mmu_scratch, v3d->mmu_scratch_paddr); -+clk_disable: -+ clk_disable_unprepare(v3d->clk); - return ret; - } - -@@ -340,6 +350,8 @@ static void v3d_platform_drm_remove(stru - - dma_free_wc(v3d->drm.dev, 4096, v3d->mmu_scratch, - v3d->mmu_scratch_paddr); -+ -+ clk_disable_unprepare(v3d->clk); - } - - static struct platform_driver v3d_platform_driver = { diff --git a/target/linux/bcm27xx/patches-6.6/950-1553-drm-v3d-Associate-a-V3D-tech-revision-to-all-support.patch b/target/linux/bcm27xx/patches-6.6/950-1553-drm-v3d-Associate-a-V3D-tech-revision-to-all-support.patch index b5d65b7fedd380..2ada8c88a010fb 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1553-drm-v3d-Associate-a-V3D-tech-revision-to-all-support.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1553-drm-v3d-Associate-a-V3D-tech-revision-to-all-support.patch @@ -264,7 +264,7 @@ Signed-off-by: Maíra Canal v3d->cores = V3D_GET_FIELD(ident1, V3D_HUB_IDENT1_NCORES); WARN_ON(v3d->cores > 1); /* multicore not yet implemented */ -@@ -297,7 +307,7 @@ static int v3d_platform_drm_probe(struct +@@ -300,7 +310,7 @@ static int v3d_platform_drm_probe(struct v3d->clk_down_rate = (clk_get_rate(clk_get_parent(v3d->clk)) / (1 << 4)) + 10000; diff --git a/target/linux/bcm27xx/patches-6.6/950-1555-drm-v3d-Use-V3D_SMS-registers-for-power-on-off-and-r.patch b/target/linux/bcm27xx/patches-6.6/950-1555-drm-v3d-Use-V3D_SMS-registers-for-power-on-off-and-r.patch index a39e7242d16c5b..e0169d9745918d 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1555-drm-v3d-Use-V3D_SMS-registers-for-power-on-off-and-r.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1555-drm-v3d-Use-V3D_SMS-registers-for-power-on-off-and-r.patch @@ -87,7 +87,7 @@ Signed-off-by: Maíra Canal mmu_debug = V3D_READ(V3D_MMU_DEBUG_INFO); mask = DMA_BIT_MASK(30 + V3D_GET_FIELD(mmu_debug, V3D_MMU_PA_WIDTH)); ret = dma_set_mask_and_coherent(dev, mask); -@@ -361,6 +399,8 @@ static void v3d_platform_drm_remove(stru +@@ -364,6 +402,8 @@ static void v3d_platform_drm_remove(stru dma_free_wc(v3d->drm.dev, 4096, v3d->mmu_scratch, v3d->mmu_scratch_paddr); diff --git a/target/linux/d1/patches-6.6/0009-ASoC-sunxi-sun4i-codec-add-basic-support-for-D1-audi.patch b/target/linux/d1/patches-6.6/0009-ASoC-sunxi-sun4i-codec-add-basic-support-for-D1-audi.patch index 242f8f7a0e4033..b8ee82150cd5bf 100644 --- a/target/linux/d1/patches-6.6/0009-ASoC-sunxi-sun4i-codec-add-basic-support-for-D1-audi.patch +++ b/target/linux/d1/patches-6.6/0009-ASoC-sunxi-sun4i-codec-add-basic-support-for-D1-audi.patch @@ -16,7 +16,7 @@ Signed-off-by: Maksim Kiselev --- a/sound/soc/sunxi/sun4i-codec.c +++ b/sound/soc/sunxi/sun4i-codec.c -@@ -232,15 +232,65 @@ +@@ -233,16 +233,66 @@ /* TODO H3 DAP (Digital Audio Processing) bits */ @@ -76,6 +76,7 @@ Signed-off-by: Maksim Kiselev + struct clk *clk_module_dac; struct reset_control *rst; struct gpio_desc *gpio_pa; + struct gpio_desc *gpio_hp; + const struct sun4i_codec_quirks *quirks; - /* ADC_FIFOC register is at different offset on different SoCs */ @@ -84,7 +85,7 @@ Signed-off-by: Maksim Kiselev struct regmap_field *reg_adc_fifoc; struct snd_dmaengine_dai_dma_data capture_dma_data; -@@ -250,33 +300,33 @@ struct sun4i_codec { +@@ -252,33 +302,33 @@ struct sun4i_codec { static void sun4i_codec_start_playback(struct sun4i_codec *scodec) { /* Flush TX FIFO */ @@ -126,7 +127,7 @@ Signed-off-by: Maksim Kiselev } static int sun4i_codec_trigger(struct snd_pcm_substream *substream, int cmd, -@@ -325,8 +375,8 @@ static int sun4i_codec_prepare_capture(s +@@ -327,8 +377,8 @@ static int sun4i_codec_prepare_capture(s /* Set RX FIFO trigger level */ regmap_field_update_bits(scodec->reg_adc_fifoc, @@ -137,7 +138,7 @@ Signed-off-by: Maksim Kiselev /* * FIXME: Undocumented in the datasheet, but -@@ -360,13 +410,13 @@ static int sun4i_codec_prepare_playback( +@@ -362,13 +412,13 @@ static int sun4i_codec_prepare_playback( u32 val; /* Flush the TX FIFO */ @@ -156,7 +157,7 @@ Signed-off-by: Maksim Kiselev if (substream->runtime->rate > 32000) /* Use 64 bits FIR filter */ -@@ -375,13 +425,12 @@ static int sun4i_codec_prepare_playback( +@@ -377,13 +427,12 @@ static int sun4i_codec_prepare_playback( /* Use 32 bits FIR filter */ val = BIT(SUN4I_CODEC_DAC_FIFOC_FIR_VERSION); @@ -174,7 +175,7 @@ Signed-off-by: Maksim Kiselev return 0; }; -@@ -476,30 +525,32 @@ static int sun4i_codec_hw_params_capture +@@ -478,30 +527,32 @@ static int sun4i_codec_hw_params_capture 7 << SUN4I_CODEC_ADC_FIFOC_ADC_FS, hwrate << SUN4I_CODEC_ADC_FIFOC_ADC_FS); @@ -218,7 +219,7 @@ Signed-off-by: Maksim Kiselev scodec->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; } -@@ -514,9 +565,9 @@ static int sun4i_codec_hw_params_playbac +@@ -516,9 +567,9 @@ static int sun4i_codec_hw_params_playbac u32 val; /* Set DAC sample rate */ @@ -231,7 +232,7 @@ Signed-off-by: Maksim Kiselev /* Set the number of channels we want to use */ if (params_channels(params) == 1) -@@ -524,27 +575,26 @@ static int sun4i_codec_hw_params_playbac +@@ -526,27 +577,26 @@ static int sun4i_codec_hw_params_playbac else val = 0; @@ -269,7 +270,7 @@ Signed-off-by: Maksim Kiselev scodec->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; } -@@ -565,7 +615,11 @@ static int sun4i_codec_hw_params(struct +@@ -567,7 +617,11 @@ static int sun4i_codec_hw_params(struct if (!clk_freq) return -EINVAL; @@ -282,7 +283,7 @@ Signed-off-by: Maksim Kiselev if (ret) return ret; -@@ -607,10 +661,14 @@ static int sun4i_codec_startup(struct sn +@@ -609,10 +663,14 @@ static int sun4i_codec_startup(struct sn * Stop issuing DRQ when we have room for less than 16 samples * in our TX FIFO */ @@ -300,7 +301,7 @@ Signed-off-by: Maksim Kiselev } static void sun4i_codec_shutdown(struct snd_pcm_substream *substream, -@@ -619,7 +677,11 @@ static void sun4i_codec_shutdown(struct +@@ -621,7 +679,11 @@ static void sun4i_codec_shutdown(struct struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); struct sun4i_codec *scodec = snd_soc_card_get_drvdata(rtd->card); @@ -313,7 +314,7 @@ Signed-off-by: Maksim Kiselev } static const struct snd_soc_dai_ops sun4i_codec_dai_ops = { -@@ -1229,6 +1291,55 @@ static const struct snd_soc_component_dr +@@ -1231,6 +1293,55 @@ static const struct snd_soc_component_dr .endianness = 1, }; @@ -369,7 +370,7 @@ Signed-off-by: Maksim Kiselev static const struct snd_soc_component_driver sun4i_codec_component = { .name = "sun4i-codec", .legacy_dai_naming = 1, -@@ -1532,6 +1643,66 @@ static struct snd_soc_card *sun8i_v3s_co +@@ -1578,6 +1689,66 @@ static struct snd_soc_card *sun8i_v3s_co return card; }; @@ -436,7 +437,7 @@ Signed-off-by: Maksim Kiselev static const struct regmap_config sun4i_codec_regmap_config = { .reg_bits = 32, .reg_stride = 4, -@@ -1574,21 +1745,22 @@ static const struct regmap_config sun8i_ +@@ -1620,21 +1791,22 @@ static const struct regmap_config sun8i_ .max_register = SUN8I_H3_CODEC_ADC_DBG, }; @@ -467,7 +468,7 @@ Signed-off-by: Maksim Kiselev .reg_dac_txdata = SUN4I_CODEC_DAC_TXDATA, .reg_adc_rxdata = SUN4I_CODEC_ADC_RXDATA, }; -@@ -1597,7 +1769,11 @@ static const struct sun4i_codec_quirks s +@@ -1643,7 +1815,11 @@ static const struct sun4i_codec_quirks s .regmap_config = &sun6i_codec_regmap_config, .codec = &sun6i_codec_codec, .create_card = sun6i_codec_create_card, @@ -479,7 +480,7 @@ Signed-off-by: Maksim Kiselev .reg_dac_txdata = SUN4I_CODEC_DAC_TXDATA, .reg_adc_rxdata = SUN6I_CODEC_ADC_RXDATA, .has_reset = true, -@@ -1607,7 +1783,11 @@ static const struct sun4i_codec_quirks s +@@ -1653,7 +1829,11 @@ static const struct sun4i_codec_quirks s .regmap_config = &sun7i_codec_regmap_config, .codec = &sun7i_codec_codec, .create_card = sun4i_codec_create_card, @@ -491,7 +492,7 @@ Signed-off-by: Maksim Kiselev .reg_dac_txdata = SUN4I_CODEC_DAC_TXDATA, .reg_adc_rxdata = SUN4I_CODEC_ADC_RXDATA, }; -@@ -1616,7 +1796,11 @@ static const struct sun4i_codec_quirks s +@@ -1662,7 +1842,11 @@ static const struct sun4i_codec_quirks s .regmap_config = &sun8i_a23_codec_regmap_config, .codec = &sun8i_a23_codec_codec, .create_card = sun8i_a23_codec_create_card, @@ -503,7 +504,7 @@ Signed-off-by: Maksim Kiselev .reg_dac_txdata = SUN4I_CODEC_DAC_TXDATA, .reg_adc_rxdata = SUN6I_CODEC_ADC_RXDATA, .has_reset = true, -@@ -1631,7 +1815,11 @@ static const struct sun4i_codec_quirks s +@@ -1677,7 +1861,11 @@ static const struct sun4i_codec_quirks s */ .codec = &sun8i_a23_codec_codec, .create_card = sun8i_h3_codec_create_card, @@ -515,7 +516,7 @@ Signed-off-by: Maksim Kiselev .reg_dac_txdata = SUN8I_H3_CODEC_DAC_TXDATA, .reg_adc_rxdata = SUN6I_CODEC_ADC_RXDATA, .has_reset = true, -@@ -1645,12 +1833,31 @@ static const struct sun4i_codec_quirks s +@@ -1691,12 +1879,31 @@ static const struct sun4i_codec_quirks s */ .codec = &sun8i_a23_codec_codec, .create_card = sun8i_v3s_codec_create_card, @@ -547,7 +548,7 @@ Signed-off-by: Maksim Kiselev static const struct of_device_id sun4i_codec_of_match[] = { { .compatible = "allwinner,sun4i-a10-codec", -@@ -1676,6 +1883,10 @@ static const struct of_device_id sun4i_c +@@ -1722,6 +1929,10 @@ static const struct of_device_id sun4i_c .compatible = "allwinner,sun8i-v3s-codec", .data = &sun8i_v3s_codec_quirks, }, @@ -558,7 +559,7 @@ Signed-off-by: Maksim Kiselev {} }; MODULE_DEVICE_TABLE(of, sun4i_codec_of_match); -@@ -1704,6 +1915,7 @@ static int sun4i_codec_probe(struct plat +@@ -1750,6 +1961,7 @@ static int sun4i_codec_probe(struct plat dev_err(&pdev->dev, "Failed to determine the quirks to use\n"); return -ENODEV; } @@ -566,7 +567,7 @@ Signed-off-by: Maksim Kiselev scodec->regmap = devm_regmap_init_mmio(&pdev->dev, base, quirks->regmap_config); -@@ -1719,10 +1931,24 @@ static int sun4i_codec_probe(struct plat +@@ -1765,10 +1977,24 @@ static int sun4i_codec_probe(struct plat return PTR_ERR(scodec->clk_apb); } @@ -595,7 +596,7 @@ Signed-off-by: Maksim Kiselev } if (quirks->has_reset) { -@@ -1751,6 +1977,16 @@ static int sun4i_codec_probe(struct plat +@@ -1804,6 +2030,16 @@ static int sun4i_codec_probe(struct plat dev_err(&pdev->dev, "Failed to create regmap fields: %d\n", ret); return ret; diff --git a/target/linux/generic/backport-6.6/752-03-v6.7-net-ethernet-mtk_eth_soc-rely-on-mtk_pse_port-defini.patch b/target/linux/generic/backport-6.6/752-03-v6.7-net-ethernet-mtk_eth_soc-rely-on-mtk_pse_port-defini.patch index 0bf9dea24f0a16..b9820117916cab 100644 --- a/target/linux/generic/backport-6.6/752-03-v6.7-net-ethernet-mtk_eth_soc-rely-on-mtk_pse_port-defini.patch +++ b/target/linux/generic/backport-6.6/752-03-v6.7-net-ethernet-mtk_eth_soc-rely-on-mtk_pse_port-defini.patch @@ -14,7 +14,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c +++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c -@@ -196,10 +196,10 @@ mtk_flow_set_output_device(struct mtk_et +@@ -198,10 +198,10 @@ mtk_flow_set_output_device(struct mtk_et if (mtk_is_netsys_v2_or_greater(eth)) { switch (info.wdma_idx) { case 0: diff --git a/target/linux/generic/backport-6.6/752-14-v6.7-net-ethernet-mtk_wed-introduce-WED-support-for-MT798.patch b/target/linux/generic/backport-6.6/752-14-v6.7-net-ethernet-mtk_wed-introduce-WED-support-for-MT798.patch index eda2fb462d67ad..2e846f549530bf 100644 --- a/target/linux/generic/backport-6.6/752-14-v6.7-net-ethernet-mtk_wed-introduce-WED-support-for-MT798.patch +++ b/target/linux/generic/backport-6.6/752-14-v6.7-net-ethernet-mtk_wed-introduce-WED-support-for-MT798.patch @@ -34,7 +34,7 @@ Signed-off-by: Paolo Abeni }; --- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c +++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c -@@ -201,6 +201,9 @@ mtk_flow_set_output_device(struct mtk_et +@@ -203,6 +203,9 @@ mtk_flow_set_output_device(struct mtk_et case 1: pse_port = PSE_WDMA1_PORT; break; diff --git a/target/linux/generic/backport-6.6/752-16-v6.7-net-ethernet-mtk_wed-introduce-partial-AMSDU-offload.patch b/target/linux/generic/backport-6.6/752-16-v6.7-net-ethernet-mtk_wed-introduce-partial-AMSDU-offload.patch index 4e72ea128ab9b6..fee02a77ef606f 100644 --- a/target/linux/generic/backport-6.6/752-16-v6.7-net-ethernet-mtk_wed-introduce-partial-AMSDU-offload.patch +++ b/target/linux/generic/backport-6.6/752-16-v6.7-net-ethernet-mtk_wed-introduce-partial-AMSDU-offload.patch @@ -77,7 +77,7 @@ Signed-off-by: Paolo Abeni int mtk_foe_entry_commit(struct mtk_ppe *ppe, struct mtk_flow_entry *entry); --- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c +++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c -@@ -111,6 +111,7 @@ mtk_flow_get_wdma_info(struct net_device +@@ -113,6 +113,7 @@ mtk_flow_get_wdma_info(struct net_device info->queue = path->mtk_wdma.queue; info->bss = path->mtk_wdma.bss; info->wcid = path->mtk_wdma.wcid; @@ -85,7 +85,7 @@ Signed-off-by: Paolo Abeni return 0; } -@@ -192,7 +193,7 @@ mtk_flow_set_output_device(struct mtk_et +@@ -194,7 +195,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, diff --git a/target/linux/generic/backport-6.6/752-26-v6.10-net-ethernet-mtk_eth_soc-ppe-add-support-for-multipl.patch b/target/linux/generic/backport-6.6/752-26-v6.10-net-ethernet-mtk_eth_soc-ppe-add-support-for-multipl.patch index e924551eb9a6cf..576a691c3c6526 100644 --- a/target/linux/generic/backport-6.6/752-26-v6.10-net-ethernet-mtk_eth_soc-ppe-add-support-for-multipl.patch +++ b/target/linux/generic/backport-6.6/752-26-v6.10-net-ethernet-mtk_eth_soc-ppe-add-support-for-multipl.patch @@ -328,7 +328,7 @@ Signed-off-by: Jakub Kicinski int mtk_flow_offload_cmd(struct mtk_eth *eth, struct flow_cls_offload *cls, --- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c +++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c -@@ -245,10 +245,10 @@ mtk_flow_offload_replace(struct mtk_eth +@@ -247,10 +247,10 @@ mtk_flow_offload_replace(struct mtk_eth int ppe_index) { struct flow_rule *rule = flow_cls_offload_flow_rule(f); @@ -340,7 +340,7 @@ Signed-off-by: Jakub Kicinski struct mtk_flow_entry *entry; int offload_type = 0; int wed_index = -1; -@@ -264,6 +264,17 @@ mtk_flow_offload_replace(struct mtk_eth +@@ -266,6 +266,17 @@ mtk_flow_offload_replace(struct mtk_eth struct flow_match_meta match; flow_rule_match_meta(rule, &match); diff --git a/target/linux/generic/backport-6.6/752-27-v6.10-net-ethernet-mtk_eth_soc-ppe-prevent-ppe-update-for-.patch b/target/linux/generic/backport-6.6/752-27-v6.10-net-ethernet-mtk_eth_soc-ppe-prevent-ppe-update-for-.patch index dbf574d80ac274..d70c89f7c4dd88 100644 --- a/target/linux/generic/backport-6.6/752-27-v6.10-net-ethernet-mtk_eth_soc-ppe-prevent-ppe-update-for-.patch +++ b/target/linux/generic/backport-6.6/752-27-v6.10-net-ethernet-mtk_eth_soc-ppe-prevent-ppe-update-for-.patch @@ -19,7 +19,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c +++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c -@@ -266,7 +266,7 @@ mtk_flow_offload_replace(struct mtk_eth +@@ -268,7 +268,7 @@ mtk_flow_offload_replace(struct mtk_eth flow_rule_match_meta(rule, &match); if (mtk_is_netsys_v2_or_greater(eth)) { idev = __dev_get_by_index(&init_net, match.key->ingress_ifindex); diff --git a/target/linux/generic/backport-6.6/780-05-v6.8-r8169-add-support-for-LED-s-on-RTL8168-RTL8101.patch b/target/linux/generic/backport-6.6/780-05-v6.8-r8169-add-support-for-LED-s-on-RTL8168-RTL8101.patch index ccb8e413fefa42..8bb543b9d6d1c1 100644 --- a/target/linux/generic/backport-6.6/780-05-v6.8-r8169-add-support-for-LED-s-on-RTL8168-RTL8101.patch +++ b/target/linux/generic/backport-6.6/780-05-v6.8-r8169-add-support-for-LED-s-on-RTL8168-RTL8101.patch @@ -296,7 +296,7 @@ Signed-off-by: David S. Miller static void r8168fp_adjust_ocp_cmd(struct rtl8169_private *tp, u32 *cmd, int type) { /* based on RTL8168FP_OOBMAC_BASE in vendor driver */ -@@ -5203,6 +5261,7 @@ static int rtl_init_one(struct pci_dev * +@@ -5204,6 +5262,7 @@ static int rtl_init_one(struct pci_dev * raw_spin_lock_init(&tp->cfg9346_usage_lock); raw_spin_lock_init(&tp->config25_lock); raw_spin_lock_init(&tp->mac_ocp_lock); @@ -304,7 +304,7 @@ Signed-off-by: David S. Miller dev->tstats = devm_netdev_alloc_pcpu_stats(&pdev->dev, struct pcpu_sw_netstats); -@@ -5359,6 +5418,12 @@ static int rtl_init_one(struct pci_dev * +@@ -5360,6 +5419,12 @@ static int rtl_init_one(struct pci_dev * if (rc) return rc; diff --git a/target/linux/generic/backport-6.6/780-06-v6.8-r8169-fix-building-with-CONFIG_LEDS_CLASS-m.patch b/target/linux/generic/backport-6.6/780-06-v6.8-r8169-fix-building-with-CONFIG_LEDS_CLASS-m.patch index 3860de75700732..fa79d911292c3b 100644 --- a/target/linux/generic/backport-6.6/780-06-v6.8-r8169-fix-building-with-CONFIG_LEDS_CLASS-m.patch +++ b/target/linux/generic/backport-6.6/780-06-v6.8-r8169-fix-building-with-CONFIG_LEDS_CLASS-m.patch @@ -59,7 +59,7 @@ Signed-off-by: Jakub Kicinski obj-$(CONFIG_R8169) += r8169.o --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -5418,11 +5418,10 @@ static int rtl_init_one(struct pci_dev * +@@ -5419,11 +5419,10 @@ static int rtl_init_one(struct pci_dev * if (rc) return rc; diff --git a/target/linux/generic/backport-6.6/780-07-v6.9-r8169-simplify-EEE-handling.patch b/target/linux/generic/backport-6.6/780-07-v6.9-r8169-simplify-EEE-handling.patch index 0f5f68c68a10d9..e1fcb00b1d4b1e 100644 --- a/target/linux/generic/backport-6.6/780-07-v6.9-r8169-simplify-EEE-handling.patch +++ b/target/linux/generic/backport-6.6/780-07-v6.9-r8169-simplify-EEE-handling.patch @@ -75,7 +75,7 @@ Signed-off-by: Jakub Kicinski genphy_soft_reset(tp->phydev); } -@@ -5120,7 +5095,9 @@ static int r8169_mdio_register(struct rt +@@ -5121,7 +5096,9 @@ static int r8169_mdio_register(struct rt } tp->phydev->mac_managed_pm = true; @@ -86,7 +86,7 @@ Signed-off-by: Jakub Kicinski phy_support_asym_pause(tp->phydev); /* PHY will be woken up in rtl_open() */ -@@ -5255,7 +5232,6 @@ static int rtl_init_one(struct pci_dev * +@@ -5256,7 +5233,6 @@ static int rtl_init_one(struct pci_dev * tp->dev = dev; tp->pci_dev = pdev; tp->supports_gmii = ent->driver_data == RTL_CFG_NO_GBIT ? 0 : 1; diff --git a/target/linux/generic/backport-6.6/780-08-v6.9-r8169-add-support-for-RTL8126A.patch b/target/linux/generic/backport-6.6/780-08-v6.9-r8169-add-support-for-RTL8126A.patch index 210730d6b127ee..80b64d3bed9e6a 100644 --- a/target/linux/generic/backport-6.6/780-08-v6.9-r8169-add-support-for-RTL8126A.patch +++ b/target/linux/generic/backport-6.6/780-08-v6.9-r8169-add-support-for-RTL8126A.patch @@ -321,7 +321,7 @@ Signed-off-by: David S. Miller padto = max_t(unsigned int, padto, ETH_ZLEN); break; default: -@@ -5147,7 +5204,7 @@ static void rtl_hw_initialize(struct rtl +@@ -5148,7 +5205,7 @@ static void rtl_hw_initialize(struct rtl case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_48: rtl_hw_init_8168g(tp); break; diff --git a/target/linux/generic/backport-6.6/780-10-v6.9-r8169-simplify-code-by-using-core-provided-pcpu-stat.patch b/target/linux/generic/backport-6.6/780-10-v6.9-r8169-simplify-code-by-using-core-provided-pcpu-stat.patch index 959a1b0276d94c..60f0cbf06c7672 100644 --- a/target/linux/generic/backport-6.6/780-10-v6.9-r8169-simplify-code-by-using-core-provided-pcpu-stat.patch +++ b/target/linux/generic/backport-6.6/780-10-v6.9-r8169-simplify-code-by-using-core-provided-pcpu-stat.patch @@ -16,7 +16,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -5296,11 +5296,6 @@ static int rtl_init_one(struct pci_dev * +@@ -5297,11 +5297,6 @@ static int rtl_init_one(struct pci_dev * raw_spin_lock_init(&tp->mac_ocp_lock); mutex_init(&tp->led_lock); @@ -28,7 +28,7 @@ Signed-off-by: Paolo Abeni /* Get the *optional* external "ether_clk" used on some boards */ tp->clk = devm_clk_get_optional_enabled(&pdev->dev, "ether_clk"); if (IS_ERR(tp->clk)) -@@ -5415,6 +5410,8 @@ static int rtl_init_one(struct pci_dev * +@@ -5416,6 +5411,8 @@ static int rtl_init_one(struct pci_dev * dev->hw_features |= NETIF_F_RXALL; dev->hw_features |= NETIF_F_RXFCS; diff --git a/target/linux/generic/backport-6.6/780-11-v6.9-r8169-add-LED-support-for-RTL8125-RTL8126.patch b/target/linux/generic/backport-6.6/780-11-v6.9-r8169-add-LED-support-for-RTL8125-RTL8126.patch index fa9b4f10620627..cd33fc1d752379 100644 --- a/target/linux/generic/backport-6.6/780-11-v6.9-r8169-add-LED-support-for-RTL8125-RTL8126.patch +++ b/target/linux/generic/backport-6.6/780-11-v6.9-r8169-add-LED-support-for-RTL8125-RTL8126.patch @@ -225,7 +225,7 @@ Signed-off-by: Jakub Kicinski void r8169_get_led_name(struct rtl8169_private *tp, int idx, char *buf, int buf_len) { -@@ -5448,10 +5499,12 @@ static int rtl_init_one(struct pci_dev * +@@ -5449,10 +5500,12 @@ static int rtl_init_one(struct pci_dev * if (rc) return rc; diff --git a/target/linux/generic/backport-6.6/780-16-v6.9-r8169-fix-LED-related-deadlock-on-module-removal.patch b/target/linux/generic/backport-6.6/780-16-v6.9-r8169-fix-LED-related-deadlock-on-module-removal.patch index 26290cdef566ab..857c2171d505b8 100644 --- a/target/linux/generic/backport-6.6/780-16-v6.9-r8169-fix-LED-related-deadlock-on-module-removal.patch +++ b/target/linux/generic/backport-6.6/780-16-v6.9-r8169-fix-LED-related-deadlock-on-module-removal.patch @@ -133,7 +133,7 @@ Signed-off-by: David S. Miller unregister_netdev(tp->dev); if (tp->dash_type != RTL_DASH_NONE) -@@ -5533,9 +5537,9 @@ static int rtl_init_one(struct pci_dev * +@@ -5534,9 +5538,9 @@ static int rtl_init_one(struct pci_dev * if (IS_ENABLED(CONFIG_R8169_LEDS)) { if (rtl_is_8125(tp)) diff --git a/target/linux/generic/backport-6.6/780-22-v6.12-r8169-add-support-for-RTL8126A-rev.b.patch b/target/linux/generic/backport-6.6/780-22-v6.12-r8169-add-support-for-RTL8126A-rev.b.patch index 3360b61fad9834..628664b2f0e192 100644 --- a/target/linux/generic/backport-6.6/780-22-v6.12-r8169-add-support-for-RTL8126A-rev.b.patch +++ b/target/linux/generic/backport-6.6/780-22-v6.12-r8169-add-support-for-RTL8126A-rev.b.patch @@ -224,7 +224,7 @@ Signed-off-by: Jakub Kicinski padto = max_t(unsigned int, padto, ETH_ZLEN); break; default: -@@ -5294,7 +5306,7 @@ static void rtl_hw_initialize(struct rtl +@@ -5295,7 +5307,7 @@ static void rtl_hw_initialize(struct rtl case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_48: rtl_hw_init_8168g(tp); break; diff --git a/target/linux/generic/backport-6.6/780-26-v6.13-r8169-enable-SG-TSO-on-selected-chip-versions-per-de.patch b/target/linux/generic/backport-6.6/780-26-v6.13-r8169-enable-SG-TSO-on-selected-chip-versions-per-de.patch index 4b00eba62239e7..15bdb433569096 100644 --- a/target/linux/generic/backport-6.6/780-26-v6.13-r8169-enable-SG-TSO-on-selected-chip-versions-per-de.patch +++ b/target/linux/generic/backport-6.6/780-26-v6.13-r8169-enable-SG-TSO-on-selected-chip-versions-per-de.patch @@ -20,7 +20,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -5491,11 +5491,6 @@ static int rtl_init_one(struct pci_dev * +@@ -5492,11 +5492,6 @@ static int rtl_init_one(struct pci_dev * dev->features |= dev->hw_features; @@ -32,7 +32,7 @@ Signed-off-by: David S. Miller if (rtl_chip_supports_csum_v2(tp)) { dev->hw_features |= NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6; netif_set_tso_max_size(dev, RTL_GSO_MAX_SIZE_V2); -@@ -5506,6 +5501,17 @@ static int rtl_init_one(struct pci_dev * +@@ -5507,6 +5502,17 @@ static int rtl_init_one(struct pci_dev * netif_set_tso_max_segs(dev, RTL_GSO_MAX_SEGS_V1); } diff --git a/target/linux/generic/backport-6.6/780-39-v6.13-r8169-remove-leftover-locks-after-reverted-change.patch b/target/linux/generic/backport-6.6/780-39-v6.13-r8169-remove-leftover-locks-after-reverted-change.patch index c3e93989016214..90b7c8c7678a31 100644 --- a/target/linux/generic/backport-6.6/780-39-v6.13-r8169-remove-leftover-locks-after-reverted-change.patch +++ b/target/linux/generic/backport-6.6/780-39-v6.13-r8169-remove-leftover-locks-after-reverted-change.patch @@ -102,7 +102,7 @@ Signed-off-by: Jakub Kicinski switch (tp->mac_version) { case RTL_GIGA_MAC_VER_02 ... RTL_GIGA_MAC_VER_06: -@@ -5460,8 +5437,6 @@ static int rtl_init_one(struct pci_dev * +@@ -5461,8 +5438,6 @@ static int rtl_init_one(struct pci_dev * tp->supports_gmii = ent->driver_data == RTL_CFG_NO_GBIT ? 0 : 1; tp->ocp_base = OCP_STD_PHY_BASE; diff --git a/target/linux/generic/backport-6.6/780-44-v6.13-r8169-copy-vendor-driver-2.5G-5G-EEE-advertisement-c.patch b/target/linux/generic/backport-6.6/780-44-v6.13-r8169-copy-vendor-driver-2.5G-5G-EEE-advertisement-c.patch index fb01dad458540f..6da3bf59a864c2 100644 --- a/target/linux/generic/backport-6.6/780-44-v6.13-r8169-copy-vendor-driver-2.5G-5G-EEE-advertisement-c.patch +++ b/target/linux/generic/backport-6.6/780-44-v6.13-r8169-copy-vendor-driver-2.5G-5G-EEE-advertisement-c.patch @@ -22,7 +22,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -5236,6 +5236,11 @@ static int r8169_mdio_register(struct rt +@@ -5237,6 +5237,11 @@ static int r8169_mdio_register(struct rt tp->phydev->supported_eee); phy_support_asym_pause(tp->phydev); diff --git a/target/linux/generic/backport-6.6/780-46-v6.14-r8169-remove-support-for-chip-version-11.patch b/target/linux/generic/backport-6.6/780-46-v6.14-r8169-remove-support-for-chip-version-11.patch index 9ffe091140db75..e4af737edc5061 100644 --- a/target/linux/generic/backport-6.6/780-46-v6.14-r8169-remove-support-for-chip-version-11.patch +++ b/target/linux/generic/backport-6.6/780-46-v6.14-r8169-remove-support-for-chip-version-11.patch @@ -78,7 +78,7 @@ Signed-off-by: Jakub Kicinski } static int rtl_alloc_irq(struct rtl8169_private *tp) -@@ -5304,7 +5293,6 @@ static int rtl_jumbo_max(struct rtl8169_ +@@ -5305,7 +5294,6 @@ static int rtl_jumbo_max(struct rtl8169_ case RTL_GIGA_MAC_VER_02 ... RTL_GIGA_MAC_VER_06: return JUMBO_7K; /* RTL8168b */ diff --git a/target/linux/generic/backport-6.6/780-47-v6.14-r8169-adjust-version-numbering-for-RTL8126.patch b/target/linux/generic/backport-6.6/780-47-v6.14-r8169-adjust-version-numbering-for-RTL8126.patch index efa41eb67b5d4c..8c30506904ad3f 100644 --- a/target/linux/generic/backport-6.6/780-47-v6.14-r8169-adjust-version-numbering-for-RTL8126.patch +++ b/target/linux/generic/backport-6.6/780-47-v6.14-r8169-adjust-version-numbering-for-RTL8126.patch @@ -233,7 +233,7 @@ Signed-off-by: Jakub Kicinski padto = max_t(unsigned int, padto, ETH_ZLEN); break; default: -@@ -5274,7 +5274,7 @@ static void rtl_hw_initialize(struct rtl +@@ -5275,7 +5275,7 @@ static void rtl_hw_initialize(struct rtl case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_48: rtl_hw_init_8168g(tp); break; diff --git a/target/linux/generic/backport-6.6/780-51-v6.15-r8169-don-t-scan-PHY-addresses-0.patch b/target/linux/generic/backport-6.6/780-51-v6.15-r8169-don-t-scan-PHY-addresses-0.patch deleted file mode 100644 index 735f3ff4f9d5e7..00000000000000 --- a/target/linux/generic/backport-6.6/780-51-v6.15-r8169-don-t-scan-PHY-addresses-0.patch +++ /dev/null @@ -1,26 +0,0 @@ -From faac69a4ae5abb49e62c79c66b51bb905c9aa5ec Mon Sep 17 00:00:00 2001 -From: Heiner Kallweit -Date: Tue, 4 Feb 2025 07:58:17 +0100 -Subject: [PATCH] r8169: don't scan PHY addresses > 0 - -The PHY address is a dummy, because r8169 PHY access registers -don't support a PHY address. Therefore scan address 0 only. - -Signed-off-by: Heiner Kallweit -Reviewed-by: Andrew Lunn -Link: https://patch.msgid.link/830637dd-4016-4a68-92b3-618fcac6589d@gmail.com -Signed-off-by: Jakub Kicinski ---- - drivers/net/ethernet/realtek/r8169_main.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/net/ethernet/realtek/r8169_main.c -+++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -5230,6 +5230,7 @@ static int r8169_mdio_register(struct rt - new_bus->priv = tp; - new_bus->parent = &pdev->dev; - new_bus->irq[0] = PHY_MAC_INTERRUPT; -+ new_bus->phy_mask = GENMASK(31, 1); - snprintf(new_bus->id, MII_BUS_ID_SIZE, "r8169-%x-%x", - pci_domain_nr(pdev->bus), pci_dev_id(pdev)); - diff --git a/target/linux/generic/backport-6.6/816-v6.7-0001-nvmem-qfprom-Mark-core-clk-as-optional.patch b/target/linux/generic/backport-6.6/816-v6.7-0001-nvmem-qfprom-Mark-core-clk-as-optional.patch index c83d4fc579013e..cb8572ffe1e4a3 100644 --- a/target/linux/generic/backport-6.6/816-v6.7-0001-nvmem-qfprom-Mark-core-clk-as-optional.patch +++ b/target/linux/generic/backport-6.6/816-v6.7-0001-nvmem-qfprom-Mark-core-clk-as-optional.patch @@ -19,7 +19,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/drivers/nvmem/qfprom.c +++ b/drivers/nvmem/qfprom.c -@@ -424,12 +424,12 @@ static int qfprom_probe(struct platform_ +@@ -438,12 +438,12 @@ static int qfprom_probe(struct platform_ if (IS_ERR(priv->vcc)) return PTR_ERR(priv->vcc); diff --git a/target/linux/generic/backport-6.6/816-v6.7-0004-Revert-nvmem-add-new-config-option.patch b/target/linux/generic/backport-6.6/816-v6.7-0004-Revert-nvmem-add-new-config-option.patch index 9c22568f72cdb1..4f8d837ef1977d 100644 --- a/target/linux/generic/backport-6.6/816-v6.7-0004-Revert-nvmem-add-new-config-option.patch +++ b/target/linux/generic/backport-6.6/816-v6.7-0004-Revert-nvmem-add-new-config-option.patch @@ -48,7 +48,7 @@ Signed-off-by: Greg Kroah-Hartman mtd->nvmem = nvmem_register(&config); --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c -@@ -918,7 +918,7 @@ struct nvmem_device *nvmem_register(cons +@@ -932,7 +932,7 @@ struct nvmem_device *nvmem_register(cons nvmem->nkeepout = config->nkeepout; if (config->of_node) nvmem->dev.of_node = config->of_node; diff --git a/target/linux/generic/backport-6.6/819-v6.8-0001-nvmem-Move-of_nvmem_layout_get_container-in-another-.patch b/target/linux/generic/backport-6.6/819-v6.8-0001-nvmem-Move-of_nvmem_layout_get_container-in-another-.patch index c1f5ecf6651ffc..f80e8756b12264 100644 --- a/target/linux/generic/backport-6.6/819-v6.8-0001-nvmem-Move-of_nvmem_layout_get_container-in-another-.patch +++ b/target/linux/generic/backport-6.6/819-v6.8-0001-nvmem-Move-of_nvmem_layout_get_container-in-another-.patch @@ -25,7 +25,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c -@@ -823,14 +823,6 @@ static int nvmem_add_cells_from_layout(s +@@ -837,14 +837,6 @@ static int nvmem_add_cells_from_layout(s } #if IS_ENABLED(CONFIG_OF) diff --git a/target/linux/generic/backport-6.6/819-v6.8-0005-nvmem-core-Rework-layouts-to-become-regular-devices.patch b/target/linux/generic/backport-6.6/819-v6.8-0005-nvmem-core-Rework-layouts-to-become-regular-devices.patch index 220a9681363ad4..1747587c7c3b56 100644 --- a/target/linux/generic/backport-6.6/819-v6.8-0005-nvmem-core-Rework-layouts-to-become-regular-devices.patch +++ b/target/linux/generic/backport-6.6/819-v6.8-0005-nvmem-core-Rework-layouts-to-become-regular-devices.patch @@ -84,7 +84,7 @@ Signed-off-by: Greg Kroah-Hartman static int __nvmem_reg_read(struct nvmem_device *nvmem, unsigned int offset, void *val, size_t bytes) { -@@ -739,97 +736,22 @@ static int nvmem_add_cells_from_fixed_la +@@ -753,97 +750,22 @@ static int nvmem_add_cells_from_fixed_la return err; } @@ -189,7 +189,7 @@ Signed-off-by: Greg Kroah-Hartman const void *nvmem_layout_get_match_data(struct nvmem_device *nvmem, struct nvmem_layout *layout) { -@@ -837,7 +759,7 @@ const void *nvmem_layout_get_match_data( +@@ -851,7 +773,7 @@ const void *nvmem_layout_get_match_data( const struct of_device_id *match; layout_np = of_nvmem_layout_get_container(nvmem); @@ -198,7 +198,7 @@ Signed-off-by: Greg Kroah-Hartman return match ? match->data : NULL; } -@@ -949,19 +871,6 @@ struct nvmem_device *nvmem_register(cons +@@ -963,19 +885,6 @@ struct nvmem_device *nvmem_register(cons goto err_put_device; } @@ -218,7 +218,7 @@ Signed-off-by: Greg Kroah-Hartman if (config->cells) { rval = nvmem_add_cells(nvmem, config->cells, config->ncells); if (rval) -@@ -982,24 +891,24 @@ struct nvmem_device *nvmem_register(cons +@@ -996,24 +905,24 @@ struct nvmem_device *nvmem_register(cons if (rval) goto err_remove_cells; @@ -249,7 +249,7 @@ Signed-off-by: Greg Kroah-Hartman if (config->compat) nvmem_sysfs_remove_compat(nvmem, config); err_put_device: -@@ -1021,7 +930,7 @@ static void nvmem_device_release(struct +@@ -1035,7 +944,7 @@ static void nvmem_device_release(struct device_remove_bin_file(nvmem->base_dev, &nvmem->eeprom); nvmem_device_remove_all_cells(nvmem); @@ -258,7 +258,7 @@ Signed-off-by: Greg Kroah-Hartman device_unregister(&nvmem->dev); } -@@ -1323,6 +1232,12 @@ nvmem_cell_get_from_lookup(struct device +@@ -1337,6 +1246,12 @@ nvmem_cell_get_from_lookup(struct device return cell; } @@ -271,7 +271,7 @@ Signed-off-by: Greg Kroah-Hartman #if IS_ENABLED(CONFIG_OF) static struct nvmem_cell_entry * nvmem_find_cell_entry_by_node(struct nvmem_device *nvmem, struct device_node *np) -@@ -1341,6 +1256,18 @@ nvmem_find_cell_entry_by_node(struct nvm +@@ -1355,6 +1270,18 @@ nvmem_find_cell_entry_by_node(struct nvm return cell; } @@ -290,7 +290,7 @@ Signed-off-by: Greg Kroah-Hartman /** * of_nvmem_cell_get() - Get a nvmem cell from given device node and cell id * -@@ -1403,16 +1330,29 @@ struct nvmem_cell *of_nvmem_cell_get(str +@@ -1417,16 +1344,29 @@ struct nvmem_cell *of_nvmem_cell_get(str return ERR_CAST(nvmem); } @@ -322,7 +322,7 @@ Signed-off-by: Greg Kroah-Hartman return cell; } -@@ -1526,6 +1466,7 @@ void nvmem_cell_put(struct nvmem_cell *c +@@ -1540,6 +1480,7 @@ void nvmem_cell_put(struct nvmem_cell *c kfree(cell); __nvmem_device_put(nvmem); @@ -330,7 +330,7 @@ Signed-off-by: Greg Kroah-Hartman } EXPORT_SYMBOL_GPL(nvmem_cell_put); -@@ -2118,11 +2059,22 @@ EXPORT_SYMBOL_GPL(nvmem_dev_size); +@@ -2132,11 +2073,22 @@ EXPORT_SYMBOL_GPL(nvmem_dev_size); static int __init nvmem_init(void) { diff --git a/target/linux/generic/backport-6.6/819-v6.8-0006-nvmem-core-Expose-cells-through-sysfs.patch b/target/linux/generic/backport-6.6/819-v6.8-0006-nvmem-core-Expose-cells-through-sysfs.patch index 8442636b091544..478efdba05f22a 100644 --- a/target/linux/generic/backport-6.6/819-v6.8-0006-nvmem-core-Expose-cells-through-sysfs.patch +++ b/target/linux/generic/backport-6.6/819-v6.8-0006-nvmem-core-Expose-cells-through-sysfs.patch @@ -180,7 +180,7 @@ Signed-off-by: Greg Kroah-Hartman #else /* CONFIG_NVMEM_SYSFS */ static int nvmem_sysfs_setup_compat(struct nvmem_device *nvmem, -@@ -738,11 +847,25 @@ static int nvmem_add_cells_from_fixed_la +@@ -752,11 +861,25 @@ static int nvmem_add_cells_from_fixed_la int nvmem_layout_register(struct nvmem_layout *layout) { @@ -207,7 +207,7 @@ Signed-off-by: Greg Kroah-Hartman } EXPORT_SYMBOL_GPL(nvmem_layout_register); -@@ -901,10 +1024,20 @@ struct nvmem_device *nvmem_register(cons +@@ -915,10 +1038,20 @@ struct nvmem_device *nvmem_register(cons if (rval) goto err_remove_dev; diff --git a/target/linux/generic/backport-6.6/819-v6.8-0008-nvmem-layouts-refactor-.add_cells-callback-arguments.patch b/target/linux/generic/backport-6.6/819-v6.8-0008-nvmem-layouts-refactor-.add_cells-callback-arguments.patch index a95770a05906a1..536d10edfdf864 100644 --- a/target/linux/generic/backport-6.6/819-v6.8-0008-nvmem-layouts-refactor-.add_cells-callback-arguments.patch +++ b/target/linux/generic/backport-6.6/819-v6.8-0008-nvmem-layouts-refactor-.add_cells-callback-arguments.patch @@ -44,7 +44,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c -@@ -853,7 +853,7 @@ int nvmem_layout_register(struct nvmem_l +@@ -867,7 +867,7 @@ int nvmem_layout_register(struct nvmem_l return -EINVAL; /* Populate the cells */ diff --git a/target/linux/generic/backport-6.6/819-v6.8-0009-nvmem-drop-nvmem_layout_get_match_data.patch b/target/linux/generic/backport-6.6/819-v6.8-0009-nvmem-drop-nvmem_layout_get_match_data.patch index 291854bcb579d5..b55696e4245b37 100644 --- a/target/linux/generic/backport-6.6/819-v6.8-0009-nvmem-drop-nvmem_layout_get_match_data.patch +++ b/target/linux/generic/backport-6.6/819-v6.8-0009-nvmem-drop-nvmem_layout_get_match_data.patch @@ -24,7 +24,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c -@@ -875,19 +875,6 @@ void nvmem_layout_unregister(struct nvme +@@ -889,19 +889,6 @@ void nvmem_layout_unregister(struct nvme } EXPORT_SYMBOL_GPL(nvmem_layout_unregister); diff --git a/target/linux/generic/backport-6.6/820-v6.9-0007-nvmem-core-Print-error-on-wrong-bits-DT-property.patch b/target/linux/generic/backport-6.6/820-v6.9-0007-nvmem-core-Print-error-on-wrong-bits-DT-property.patch index aa4e0ab04a8a20..17a47a12277c1c 100644 --- a/target/linux/generic/backport-6.6/820-v6.9-0007-nvmem-core-Print-error-on-wrong-bits-DT-property.patch +++ b/target/linux/generic/backport-6.6/820-v6.9-0007-nvmem-core-Print-error-on-wrong-bits-DT-property.patch @@ -18,7 +18,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c -@@ -805,6 +805,11 @@ static int nvmem_add_cells_from_dt(struc +@@ -819,6 +819,11 @@ static int nvmem_add_cells_from_dt(struc if (addr && len == (2 * sizeof(u32))) { info.bit_offset = be32_to_cpup(addr++); info.nbits = be32_to_cpup(addr); diff --git a/target/linux/generic/backport-6.6/834-v6.8-leds-trigger-netdev-Extend-speeds-up-to-10G.patch b/target/linux/generic/backport-6.6/834-v6.8-leds-trigger-netdev-Extend-speeds-up-to-10G.patch index 4571d7d2bf53dc..3a64e6822d2b3b 100644 --- a/target/linux/generic/backport-6.6/834-v6.8-leds-trigger-netdev-Extend-speeds-up-to-10G.patch +++ b/target/linux/generic/backport-6.6/834-v6.8-leds-trigger-netdev-Extend-speeds-up-to-10G.patch @@ -16,7 +16,7 @@ Signed-off-by: Lee Jones --- a/drivers/leds/trigger/ledtrig-netdev.c +++ b/drivers/leds/trigger/ledtrig-netdev.c -@@ -99,6 +99,18 @@ static void set_baseline_state(struct le +@@ -104,6 +104,18 @@ static void set_baseline_state(struct le trigger_data->link_speed == SPEED_1000) blink_on = true; @@ -35,7 +35,7 @@ Signed-off-by: Lee Jones if (test_bit(TRIGGER_NETDEV_HALF_DUPLEX, &trigger_data->mode) && trigger_data->duplex == DUPLEX_HALF) blink_on = true; -@@ -289,6 +301,9 @@ static ssize_t netdev_led_attr_show(stru +@@ -294,6 +306,9 @@ static ssize_t netdev_led_attr_show(stru case TRIGGER_NETDEV_LINK_10: case TRIGGER_NETDEV_LINK_100: case TRIGGER_NETDEV_LINK_1000: @@ -45,7 +45,7 @@ Signed-off-by: Lee Jones case TRIGGER_NETDEV_HALF_DUPLEX: case TRIGGER_NETDEV_FULL_DUPLEX: case TRIGGER_NETDEV_TX: -@@ -319,6 +334,9 @@ static ssize_t netdev_led_attr_store(str +@@ -324,6 +339,9 @@ static ssize_t netdev_led_attr_store(str case TRIGGER_NETDEV_LINK_10: case TRIGGER_NETDEV_LINK_100: case TRIGGER_NETDEV_LINK_1000: @@ -55,7 +55,7 @@ Signed-off-by: Lee Jones case TRIGGER_NETDEV_HALF_DUPLEX: case TRIGGER_NETDEV_FULL_DUPLEX: case TRIGGER_NETDEV_TX: -@@ -337,7 +355,10 @@ static ssize_t netdev_led_attr_store(str +@@ -342,7 +360,10 @@ static ssize_t netdev_led_attr_store(str if (test_bit(TRIGGER_NETDEV_LINK, &mode) && (test_bit(TRIGGER_NETDEV_LINK_10, &mode) || test_bit(TRIGGER_NETDEV_LINK_100, &mode) || @@ -67,7 +67,7 @@ Signed-off-by: Lee Jones return -EINVAL; cancel_delayed_work_sync(&trigger_data->work); -@@ -367,6 +388,9 @@ DEFINE_NETDEV_TRIGGER(link, TRIGGER_NETD +@@ -372,6 +393,9 @@ DEFINE_NETDEV_TRIGGER(link, TRIGGER_NETD DEFINE_NETDEV_TRIGGER(link_10, TRIGGER_NETDEV_LINK_10); DEFINE_NETDEV_TRIGGER(link_100, TRIGGER_NETDEV_LINK_100); DEFINE_NETDEV_TRIGGER(link_1000, TRIGGER_NETDEV_LINK_1000); @@ -77,7 +77,7 @@ Signed-off-by: Lee Jones DEFINE_NETDEV_TRIGGER(half_duplex, TRIGGER_NETDEV_HALF_DUPLEX); DEFINE_NETDEV_TRIGGER(full_duplex, TRIGGER_NETDEV_FULL_DUPLEX); DEFINE_NETDEV_TRIGGER(tx, TRIGGER_NETDEV_TX); -@@ -425,6 +449,9 @@ static struct attribute *netdev_trig_att +@@ -435,6 +459,9 @@ static struct attribute *netdev_trig_att &dev_attr_link_10.attr, &dev_attr_link_100.attr, &dev_attr_link_1000.attr, @@ -87,7 +87,7 @@ Signed-off-by: Lee Jones &dev_attr_full_duplex.attr, &dev_attr_half_duplex.attr, &dev_attr_rx.attr, -@@ -522,6 +549,9 @@ static void netdev_trig_work(struct work +@@ -532,6 +559,9 @@ static void netdev_trig_work(struct work test_bit(TRIGGER_NETDEV_LINK_10, &trigger_data->mode) || test_bit(TRIGGER_NETDEV_LINK_100, &trigger_data->mode) || test_bit(TRIGGER_NETDEV_LINK_1000, &trigger_data->mode) || diff --git a/target/linux/generic/hack-6.6/901-debloat_sock_diag.patch b/target/linux/generic/hack-6.6/901-debloat_sock_diag.patch index c0ba6c008e83e5..d0a21cd7f98118 100644 --- a/target/linux/generic/hack-6.6/901-debloat_sock_diag.patch +++ b/target/linux/generic/hack-6.6/901-debloat_sock_diag.patch @@ -161,7 +161,7 @@ Signed-off-by: Felix Fietkau Support for PF_PACKET sockets monitoring interface used by the ss tool. --- a/net/unix/Kconfig +++ b/net/unix/Kconfig -@@ -29,6 +29,7 @@ config AF_UNIX_OOB +@@ -24,6 +24,7 @@ config AF_UNIX_OOB config UNIX_DIAG tristate "UNIX: socket monitoring interface" depends on UNIX diff --git a/target/linux/generic/hack-6.6/902-debloat_proc.patch b/target/linux/generic/hack-6.6/902-debloat_proc.patch index 8a2f3330abf9fc..e426c008d00a74 100644 --- a/target/linux/generic/hack-6.6/902-debloat_proc.patch +++ b/target/linux/generic/hack-6.6/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 -@@ -3037,11 +3037,13 @@ static const struct seq_operations fib_r +@@ -3015,11 +3015,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; -@@ -3052,17 +3054,21 @@ int __net_init fib_proc_init(struct net +@@ -3030,17 +3032,21 @@ int __net_init fib_proc_init(struct net return 0; out3: diff --git a/target/linux/generic/pending-6.6/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch b/target/linux/generic/pending-6.6/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch index abd6586e6cb2bb..0ad36b3430273e 100644 --- a/target/linux/generic/pending-6.6/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch +++ b/target/linux/generic/pending-6.6/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 -@@ -2784,6 +2784,7 @@ static const char *const rtn_type_names[ +@@ -2762,6 +2762,7 @@ static const char *const rtn_type_names[ [RTN_THROW] = "THROW", [RTN_NAT] = "NAT", [RTN_XRESOLVE] = "XRESOLVE", diff --git a/target/linux/generic/pending-6.6/804-nvmem-core-support-mac-base-fixed-layout-cells.patch b/target/linux/generic/pending-6.6/804-nvmem-core-support-mac-base-fixed-layout-cells.patch index 241ff77a7b4264..3b7e38d6353844 100644 --- a/target/linux/generic/pending-6.6/804-nvmem-core-support-mac-base-fixed-layout-cells.patch +++ b/target/linux/generic/pending-6.6/804-nvmem-core-support-mac-base-fixed-layout-cells.patch @@ -33,7 +33,7 @@ string. #include #include #include -@@ -796,6 +799,62 @@ static int nvmem_validate_keepouts(struc +@@ -810,6 +813,62 @@ static int nvmem_validate_keepouts(struc return 0; } @@ -96,7 +96,7 @@ string. static int nvmem_add_cells_from_dt(struct nvmem_device *nvmem, struct device_node *np) { struct device *dev = &nvmem->dev; -@@ -835,6 +894,25 @@ static int nvmem_add_cells_from_dt(struc +@@ -849,6 +908,25 @@ static int nvmem_add_cells_from_dt(struc if (nvmem->fixup_dt_cell_info) nvmem->fixup_dt_cell_info(nvmem, &info); diff --git a/target/linux/qualcommax/patches-6.6/0025-v6.7-cpufreq-qcom-nvmem-add-support-for-IPQ6018.patch b/target/linux/qualcommax/patches-6.6/0025-v6.7-cpufreq-qcom-nvmem-add-support-for-IPQ6018.patch index 95c6c9505d666e..a6be040b590d25 100644 --- a/target/linux/qualcommax/patches-6.6/0025-v6.7-cpufreq-qcom-nvmem-add-support-for-IPQ6018.patch +++ b/target/linux/qualcommax/patches-6.6/0025-v6.7-cpufreq-qcom-nvmem-add-support-for-IPQ6018.patch @@ -25,7 +25,7 @@ Signed-off-by: Viresh Kumar --- a/drivers/cpufreq/cpufreq-dt-platdev.c +++ b/drivers/cpufreq/cpufreq-dt-platdev.c -@@ -177,6 +177,7 @@ static const struct of_device_id blockli +@@ -178,6 +178,7 @@ static const struct of_device_id blockli { .compatible = "ti,am625", }, { .compatible = "ti,am62a7", }, diff --git a/target/linux/qualcommax/patches-6.6/0026-v6.7-cpufreq-qcom-nvmem-add-support-for-IPQ8074.patch b/target/linux/qualcommax/patches-6.6/0026-v6.7-cpufreq-qcom-nvmem-add-support-for-IPQ8074.patch index 5640038404702b..dc706d061b2c20 100644 --- a/target/linux/qualcommax/patches-6.6/0026-v6.7-cpufreq-qcom-nvmem-add-support-for-IPQ8074.patch +++ b/target/linux/qualcommax/patches-6.6/0026-v6.7-cpufreq-qcom-nvmem-add-support-for-IPQ8074.patch @@ -25,7 +25,7 @@ Signed-off-by: Viresh Kumar --- a/drivers/cpufreq/cpufreq-dt-platdev.c +++ b/drivers/cpufreq/cpufreq-dt-platdev.c -@@ -179,6 +179,7 @@ static const struct of_device_id blockli +@@ -180,6 +180,7 @@ static const struct of_device_id blockli { .compatible = "qcom,ipq6018", }, { .compatible = "qcom,ipq8064", }, diff --git a/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch b/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch index 052972af30da03..dff0c26fab9f42 100644 --- a/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch +++ b/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch @@ -160,7 +160,7 @@ Signed-off-by: minda.chen } --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c -@@ -3711,7 +3711,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3721,7 +3721,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd * full_len = urb->transfer_buffer_length; /* If we have scatter/gather list, we use it. */ From ff393cbe9c0727deb0c0aac277be885f7f99e84b Mon Sep 17 00:00:00 2001 From: John Audia Date: Wed, 4 Jun 2025 13:18:26 -0400 Subject: [PATCH 730/877] ipq40xx: config-6.6: add new option 6.6.93 introduced new config option[1] 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.93&id=fba6e5d44fb8df6bdadb1e90d2ddca715462248f Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/19026 Signed-off-by: Nick Hainke (cherry picked from commit 45e53284e6037df774dcf2608de448b37387ad5b) Link: https://github.com/openwrt/openwrt/pull/19113 Signed-off-by: Hauke Mehrtens --- target/linux/ipq40xx/config-6.6 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ipq40xx/config-6.6 b/target/linux/ipq40xx/config-6.6 index d1c181cd0d1b2f..cdd4d36700e98a 100644 --- a/target/linux/ipq40xx/config-6.6 +++ b/target/linux/ipq40xx/config-6.6 @@ -224,6 +224,7 @@ CONFIG_INITRAMFS_SOURCE="" CONFIG_IOMMU_SUPPORT=y # CONFIG_IPQ_APSS_PLL is not set CONFIG_IPQ_GCC_4019=y +# CONFIG_IPQ_GCC_5018 is not set # CONFIG_IPQ_GCC_6018 is not set # CONFIG_IPQ_GCC_806X is not set # CONFIG_IPQ_GCC_8074 is not set From 4b8881cee99f839ad9a515a9d7013cbc4bf62e13 Mon Sep 17 00:00:00 2001 From: John Audia Date: Thu, 5 Jun 2025 14:36:32 -0400 Subject: [PATCH 731/877] ipq806x: config-6.6: add new option 6.6.93 introduced new config option[1] 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.93&id=fba6e5d44fb8df6bdadb1e90d2ddca715462248f Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/19026 Signed-off-by: Nick Hainke (cherry picked from commit a2eaadeed263133a43f0043bc283ee5b620f410c) Link: https://github.com/openwrt/openwrt/pull/19113 Signed-off-by: Hauke Mehrtens --- target/linux/ipq806x/config-6.6 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ipq806x/config-6.6 b/target/linux/ipq806x/config-6.6 index bc3761b2e5950f..7e9558ad75206c 100644 --- a/target/linux/ipq806x/config-6.6 +++ b/target/linux/ipq806x/config-6.6 @@ -213,6 +213,7 @@ CONFIG_INITRAMFS_SOURCE="" CONFIG_IOMMU_SUPPORT=y # CONFIG_IPQ_APSS_PLL is not set # CONFIG_IPQ_GCC_4019 is not set +# CONFIG_IPQ_GCC_5018 is not set # CONFIG_IPQ_GCC_6018 is not set CONFIG_IPQ_GCC_806X=y # CONFIG_IPQ_GCC_8074 is not set From 963943787d8ed6c01681b23cf35050a1a01b5b90 Mon Sep 17 00:00:00 2001 From: Antonio Flores Date: Mon, 21 Apr 2025 10:14:54 -0400 Subject: [PATCH 732/877] rockchip: fix the SD card detection on NanoPi R6C/R6S This patch backport a fix for the SD card detection on NanoPi R6c/R6S from upstream commit https://github.com/torvalds/linux/commit/95147bb42bc163866fc103c957820345fefa96cd Signed-off-by: Antonio Flores Link: https://github.com/openwrt/openwrt/pull/18553 Signed-off-by: Robert Marko (cherry picked from commit 5c83301107d238e6c3ea829ae09d87396da0b4db) Link: https://github.com/openwrt/openwrt/pull/19138 Signed-off-by: Hauke Mehrtens --- ...ip-Fix-the-SD-card-detection-on-Nano.patch | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 target/linux/rockchip/patches-6.6/402-v6.13-arm64-dts-rockchip-Fix-the-SD-card-detection-on-Nano.patch diff --git a/target/linux/rockchip/patches-6.6/402-v6.13-arm64-dts-rockchip-Fix-the-SD-card-detection-on-Nano.patch b/target/linux/rockchip/patches-6.6/402-v6.13-arm64-dts-rockchip-Fix-the-SD-card-detection-on-Nano.patch new file mode 100644 index 00000000000000..a24c4ab8e2bb52 --- /dev/null +++ b/target/linux/rockchip/patches-6.6/402-v6.13-arm64-dts-rockchip-Fix-the-SD-card-detection-on-Nano.patch @@ -0,0 +1,25 @@ +From 95147bb42bc163866fc103c957820345fefa96cd Mon Sep 17 00:00:00 2001 +From: Anton Kirilov +Date: Thu, 19 Dec 2024 11:31:45 +0000 +Subject: [PATCH] arm64: dts: rockchip: Fix the SD card detection on NanoPi + R6C/R6S + +Fix the SD card detection on FriendlyElec NanoPi R6C/R6S boards. + +Signed-off-by: Anton Kirilov +Link: https://lore.kernel.org/r/20241219113145.483205-1-anton.kirilov@arm.com +Signed-off-by: Heiko Stuebner +--- + arch/arm64/boot/dts/rockchip/rk3588s-nanopi-r6.dtsi | 1 + + 1 file changed, 1 insertion(+) + +--- a/arch/arm64/boot/dts/rockchip/rk3588s-nanopi-r6.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3588s-nanopi-r6.dtsi +@@ -410,6 +410,7 @@ + &sdmmc { + bus-width = <4>; + cap-sd-highspeed; ++ cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>; + disable-wp; + max-frequency = <150000000>; + no-mmc; From 09915e64a651a3dafdb9610e33c5df83304263a4 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Sat, 7 Jun 2025 11:53:48 +0200 Subject: [PATCH 733/877] netifd: update to Git HEAD (2025-05-23) 61ae5732adea iprule: amend ipproto netlink nla_put_u32 to nla_put_u8 d610d68c71b8 device: add support for configuring vrf a1b6386a20a6 device: fix bonding primary port selection e8bbf246ce2e system-linux: fix sysfs name for all_ports_active flag 723c699e84f4 Restore disable_ipv6 sysctl after removing a device from bridge or bond d476e18e8d43 iprule: resolve ipproto by name 7901e66c5f27 netifd: iprule add sport and dport Signed-off-by: Robert Marko (cherry picked from commit 15c2ca0a834752cc9505751fc6d2f51861d34dfd) Link: https://github.com/openwrt/openwrt/pull/19125 Signed-off-by: Hauke Mehrtens --- 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 c327f061136ba8..86a2713e81395b 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:=2024-12-17 -PKG_SOURCE_VERSION:=ea01ed41f3212ecbe000422f3c122a01b93fe874 -PKG_MIRROR_HASH:=dbaad26c1f9b15d0caff6ccdf80d85b34d96bda72cbd2b1dc188a04136d96c28 +PKG_SOURCE_DATE:=2025-05-23 +PKG_SOURCE_VERSION:=7901e66c5f273bceee8981bc8a0c8b0e60945f60 +PKG_MIRROR_HASH:=8b85ec64e446ae065b1466c520b2d3aae329b6167221e425af903777278f557e PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 From 26c2ff9e5d341a88e7d6011982c3978b9444ea12 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Sat, 8 Mar 2025 20:39:28 +0100 Subject: [PATCH 734/877] libxml2: update to 2.13.6 Release Notes: https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.13.5 https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.13.6 Fixes: CVE-2025-24928 CVE-2024-56171 Link: https://github.com/openwrt/openwrt/pull/18194 Signed-off-by: Nick Hainke (cherry picked from commit fe47089878d5b83e56b73cce4eb053fe412cde9f) Link: https://github.com/openwrt/openwrt/pull/19122 Signed-off-by: Hauke Mehrtens --- 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 c2a804b98f365e..bcc16783d6d27b 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.13.4 +PKG_VERSION:=2.13.6 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNOME/libxml2/$(basename $(PKG_VERSION)) -PKG_HASH:=65d042e1c8010243e617efb02afda20b85c2160acdbfbcb5b26b80cec6515650 +PKG_HASH:=f453480307524968f7a04ec65e64f2a83a825973bcd260a2e7691be82ae70c96 PKG_LICENSE:=MIT PKG_LICENSE_FILES:=COPYING From 926314ab12e4858477b35d152157339e9038dee6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Jo=C5=84czyk?= Date: Sat, 5 Apr 2025 22:41:56 +0200 Subject: [PATCH 735/877] ramips/mt7621: mark EEE as broken in devicetree MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Multiple users have reported a regression [1] in OpenWRT 24.10 with the ramips/mt7621 target, which has the MT7530 PHYs: the Ethernet link is periodically going down for a brief period of time: mt7530-mdio mdio-bus:1f lan1: Link is Down br-lan: port 1(lan1) entered disabled state mt7530-mdio mdio-bus:1f lan1: Link is Up - 1Gbps/Full - flow control rx/tx The symptoms stop after disabling EEE and it was reported by Mediatek in 2021 that EEE is unstable for the MT7530 PHYs [2]: > EEE of the 10-year-old MT7530 internal gephy has many IOT problems, so > it is recommended to disable its EEE. EEE is enabled by default for these devices in OpenWRT 24.10 whereas in the previous version (OpenWRT 23.05, Linux 5.15) it was not. It was determined that in Linux 6.6, the PHY driver tries to disable EEE in mtk_gephy_config_init() in drivers/net/phy/mediatek-ge.c, but this is later overridden by a subsequent execution of the genphy_c45_write_eee_adv() function, which enables every EEE mode supported. The best way forward for now seems to be to mark EEE as broken directly in the devicetree, which affects the genphy_c45_write_eee_adv() function. There are some devices, like GnuBee GB-PC2, that define additional PHYs, for example ethernet-phy@5 or ethernet-phy@7. As reported by Chester A. Unal, these are not MT7530 PHYs and they are not affected. This would need to be cherrypicked for the OpenWRT 24.10 branch. [1] https://github.com/openwrt/openwrt/issues/17351 [2] https://lore.kernel.org/all/0adde34f936a2dafca40b06b408d82afe0852327.camel@mediatek.com/ Tested-by: Darren Tucker Signed-off-by: Mateusz Jończyk Closes: https://github.com/openwrt/openwrt/issues/17351 Link: https://github.com/openwrt/openwrt/pull/18585 (cherry picked from commit b7fa9d92aef86453c28875b50ae27fbab3b500a4) Signed-off-by: Mateusz Jończyk Tested-by: Mateusz Jończyk Link: https://github.com/openwrt/openwrt/pull/19150 Signed-off-by: Hauke Mehrtens --- target/linux/ramips/dts/mt7621.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/target/linux/ramips/dts/mt7621.dtsi b/target/linux/ramips/dts/mt7621.dtsi index da992bada4f3b1..da03d47ff6b7bf 100644 --- a/target/linux/ramips/dts/mt7621.dtsi +++ b/target/linux/ramips/dts/mt7621.dtsi @@ -522,26 +522,36 @@ ethphy0: ethernet-phy@0 { reg = <0>; interrupts = <0>; + eee-broken-100tx; + eee-broken-1000t; }; ethphy1: ethernet-phy@1 { reg = <1>; interrupts = <1>; + eee-broken-100tx; + eee-broken-1000t; }; ethphy2: ethernet-phy@2 { reg = <2>; interrupts = <2>; + eee-broken-100tx; + eee-broken-1000t; }; ethphy3: ethernet-phy@3 { reg = <3>; interrupts = <3>; + eee-broken-100tx; + eee-broken-1000t; }; ethphy4: ethernet-phy@4 { reg = <4>; interrupts = <4>; + eee-broken-100tx; + eee-broken-1000t; }; }; From a4f56aca810c80803b85c996e0b7decfb2eeb6b4 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Tue, 25 Mar 2025 00:20:32 +0200 Subject: [PATCH 736/877] include/trusted-firmware-a.mk: support LTS releases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TF-A LTS releases have an lts- prefix in their version tag. Introduce a PKG_LTS variable to support these. As the non-LTS tarbals do not contain the version prefix in the directory, we need different PKG_BUILD_DIR for each variant: ➜ tar --list --file dl/trusted-firmware-a-v2.12.tar.gz | head -n1 trusted-firmware-a-2.12/ ➜ tar --list --file dl/trusted-firmware-a-lts-v2.12.1.tar.gz | head -n1 trusted-firmware-a-lts-v2.12.1/ Signed-off-by: Stijn Tintel cherry picked from commit 06c4e8a262e4618e61866ed92e296e46a1b6b671 Signed-off-by: Thomas Richard Link: https://github.com/openwrt/openwrt/pull/19076 Signed-off-by: Hauke Mehrtens --- include/trusted-firmware-a.mk | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/include/trusted-firmware-a.mk b/include/trusted-firmware-a.mk index 40c9023f1def7b..521225fa2898bb 100644 --- a/include/trusted-firmware-a.mk +++ b/include/trusted-firmware-a.mk @@ -1,12 +1,20 @@ PKG_NAME ?= trusted-firmware-a PKG_CPE_ID ?= cpe:/a:arm:trusted_firmware-a -ifndef PKG_SOURCE_PROTO -PKG_SOURCE = trusted-firmware-a-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://codeload.github.com/TrustedFirmware-A/trusted-firmware-a/tar.gz/v$(PKG_VERSION)? -endif +PKG_LTS ?= +ifneq ($(PKG_LTS),) +PKG_VERSION_PREFIX:=lts-v +PKG_BUILD_DIR = $(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION_PREFIX)$(PKG_VERSION) +else +PKG_VERSION_PREFIX:=v PKG_BUILD_DIR = $(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) +endif + +ifndef PKG_SOURCE_PROTO +PKG_SOURCE = trusted-firmware-a-$(PKG_VERSION_PREFIX)$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://codeload.github.com/TrustedFirmware-A/trusted-firmware-a/tar.gz/$(PKG_VERSION_PREFIX)$(PKG_VERSION)? +endif PKG_TARGETS := bin PKG_FLAGS:=nonshared @@ -82,7 +90,7 @@ define Build/Compile/Trusted-Firmware-A OPENSSL_DIR=$(STAGING_DIR_HOST) \ $(if $(DTC),DTC="$(DTC)") \ PLAT=$(PLAT) \ - BUILD_STRING="OpenWrt v$(PKG_VERSION)-$(PKG_RELEASE) ($(VARIANT))" \ + BUILD_STRING="OpenWrt $(PKG_VERSION_PREFIX)$(PKG_VERSION)-$(PKG_RELEASE) ($(VARIANT))" \ $(if $(CONFIG_BINUTILS_VERSION_2_37)$(CONFIG_BINUTILS_VERSION_2_38),,LDFLAGS="-no-warn-rwx-segments") \ $(TFA_MAKE_FLAGS) endef From 04a7d672d79bc909626ab16ff6afd61bfb6af7be Mon Sep 17 00:00:00 2001 From: Thomas Richard Date: Mon, 9 Jun 2025 16:02:44 +0200 Subject: [PATCH 737/877] arm-trusted-firmware-stm32: bump to v2.10.17 Changelog: https://trustedfirmware-a.readthedocs.io/en/lts-v2.10.17/change-log.html Signed-off-by: Thomas Richard Link: https://github.com/openwrt/openwrt/pull/19076 Signed-off-by: Hauke Mehrtens --- package/boot/arm-trusted-firmware-stm32/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package/boot/arm-trusted-firmware-stm32/Makefile b/package/boot/arm-trusted-firmware-stm32/Makefile index 75a92f15af6a37..46c00a51d13e06 100644 --- a/package/boot/arm-trusted-firmware-stm32/Makefile +++ b/package/boot/arm-trusted-firmware-stm32/Makefile @@ -7,10 +7,11 @@ include $(TOPDIR)/rules.mk -PKG_VERSION:=2.10 +PKG_VERSION:=2.10.17 PKG_RELEASE:=1 +PKG_LTS:=1 -PKG_HASH:=88215a62291b9ba87da8e50b077741103cdc08fb6c9e1ebd34dfaace746d3201 +PKG_HASH:=2558b2579dd1c45db6de89c49e647c109022d45da03eb74e0f6123c294295099 PKG_MAINTAINER:=Thomas Richard include $(INCLUDE_DIR)/kernel.mk From 976b09707e8eb988b75adfb1e22c85f5ebd44762 Mon Sep 17 00:00:00 2001 From: Tony Ambardar Date: Thu, 2 Jan 2025 00:47:14 -0800 Subject: [PATCH 738/877] strace: Update to version 6.12 Release Notes: https://github.com/strace/strace/releases/tag/v6.12 Signed-off-by: Tony Ambardar Link: https://github.com/openwrt/openwrt/pull/17457 Signed-off-by: Nick Hainke (cherry picked from commit 389dd8dcf6a21b608e6418ec48368f9615afa740) Link: https://github.com/openwrt/openwrt/pull/19099 Signed-off-by: Hauke Mehrtens --- package/devel/strace/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/devel/strace/Makefile b/package/devel/strace/Makefile index f418bea5a724c7..892c05467e4ebf 100644 --- a/package/devel/strace/Makefile +++ b/package/devel/strace/Makefile @@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=strace -PKG_VERSION:=6.11 +PKG_VERSION:=6.12 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://strace.io/files/$(PKG_VERSION) -PKG_HASH:=83262583a3529f02c3501aa8b8ac772b4cbc03dc934e98bab6e4883626e283a5 +PKG_HASH:=c47da93be45b6055f4dc741d7f20efaf50ca10160a5b100c109b294fd9c0bdfe PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=LGPL-2.1-or-later From d45e94264f345544565e9266c698ed1e7f3af7b5 Mon Sep 17 00:00:00 2001 From: Russell Senior Date: Wed, 2 Apr 2025 05:47:29 -0700 Subject: [PATCH 739/877] tools/patch: bump version to v2.8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit drop upstream patches $ git log --no-merges --oneline v2.7.6..v2.8 48ceda8 Version 2.8 b3d0c93 Regression in commit abe92e8010ab affecting MariaDB tests 29fced6 Count traditional diff pattern lines correctly b5d2124 patch: fix --no-backup-if-mismatch regression 86ac7e2 Fix dodgy assert with side-effects in insert_cached_dirfd 7d87652 Declare an expected test failure on Haiku. 86baf97 build: update gnulib submodule to latest 1ba2c1b Fix two test failures on Haiku. 1da6bf8 Check for newlines only when creating a file name 30ee610 Gnulib renamed some modules 6dbc381 maint: update bootstrap from gnulib 05ac924 build: update gnulib submodule to latest 95e0092 maint: make update-copyright 5bac274 Set --no-backup-if-mismatch when in --posix mode 910fecf Add missing feature tests to the test suite be8b3c6 Disable release-prep c61485b Fix "make release" to handle alpha releases 499916f Add announce-gen module for "make release" adb1ebc Pacify gcc -fsanitize=address 6bdae94 Fix memory leak when malformed unidiff patch 72a146c Port to clang address sanitizer e2e6820 Refactor argc+argv processing 606c091 Omit needless get_some_switches code ee3cc40 Revert "Remove obsolete require_gnu_diff function" 8cae4fc Remove obsolete require_gnu_diff function 164b529 savebuf can return a null pointer 91c1e4f Spelling fixes a03e1ba Port other reject-format test to non-GNU diff 9ba5eb0 Don’t be fooled by NUL bytes in diff directives 79dd5e7 Don’t be fooled by "\000" in file name 8492a6a Port to quasi-GNU diff f6f2c6f In previous patch, make w_q static 0525681 Pacify -Wunterminated-string-initialization 301411d Spelling fixes 4615206 Remove double semicolon 923e0ef Prefer angle bracket headers 5d17ca0 Update more old copyright notices 5f4edd3 Simplify memory allocation of files to delete 802511c Report patch read errors more immediately a93b50d Port fflush usage to OpenBSD 7.5 55e224b Update old copyright notices 33a7fd8 Fix gl_gcc_warnings typo in ‘configure’ 2313b37 build: update gnulib submodule to latest 37fec39 Remove some dependencies no longer needed cc87173 Update NEWS as per recent changes 7887622 Update POSIX citations 18f4dd6 Use “Gruenbacher” in international contexts 638675c Adjust libs to match recent Gnulib 53400a1 Pacify clang -Wbitwise-conditional-parentheses e8e1bcb Remove “support” for nested critical sections b963510 Simplify critical section code in util fns 85949fb Shrink critical sections 448ff9b Defer signals by hand with sigatomic_t b95a603 output_file_later avoid a malloc+free pair 2663228 Defend against closed stdin/stdout/stderr fc77964 Stop using Gnulib ‘execute’ module 470699c Move defer_signals up f696e4e Make sigs, NUM_SIGS local 4d3a4ab Rename block_signals b3bb925 Trade a bit of space for time in parse_c_string 070d859 Allocate first patchbuf statically f46a90f Use bigger buffer size by default 2e64cfd Preinitialize fatal_act.sa_hander 45de0d9 Prefer EXIT_SUCCESS etc. to literal integers 82c4940 Fix some signal handling races eceea61 Fix --set-utc TZ setting 9c55d3f Improve logic for when rename removes source 61c72f0 Fix signal race when renaming file 705c9bc Simplify traverse_another_path via last_component 77f21a6 Stop using Gnulib dirname module fe8ffd9 Fix implausible overflow when reading symlinks 5e84bda Access checks should use effective, not real 8d4ca49 Don’t assume AT_FDCWD != -1 fe5d4a0 Copy input to output attributes via fd if possible ca4c431 Simplify timestamp epoch checking 0ad4347 Check for ftello failures c49a16d Remove format_linenum 22efdee Fix "with multiple words" line number 5a70a1b Drop Plan B c0d465f Prefer ximemdup0 to xmemdup0 b91aab2 Refactor ifetch API 55c8a5c Do not attempt huge I/Os e0e121e Use outfd when setting file attributes 241e57e Don’t assume Linux-like S_IFREG 0f8c628 Use STDOUT_FILENO etc f2c3676 Fix unlikely glitch with ed diffs cec6407 Use fds to copy attrs in create_backup_copy 6b7b01b Be more careful about (time_t) -1 0433553 X == -1 → X < 0 0a66dee Let set_file_attributes use fds not names 36ff2c9 Port to narrow unsigned uid_t 3951496 Check for output errors more systematically 6429630 Report input error right away 03cb187 Simplify EOF testing cc7cde7 Prefer other types to ‘int’ 4c6650b Detect unlikely integer overflow in size calcs abe92e8 Prefer idx_t, ptrdiff_t to lin 30449e2 Fix compatibility issue with blanks in patches 9228a8c pch_swap return type cleanup c1c438d Fix unlikely int overflow in hunk counts 5d3f41f Use char for char in plan_a fb056f2 Cache cwd_is_root dev, ino 84b5f34 Avoid ‘unsigned’ in safe.c d2e113e Simplify get_sha1 f73718b Avoid casts in patch.c 79eef3e Prefer idx_t in util.c 11588d0 Prefer idx_t in pch.c e16037d Prefer idx_t in patch.c 388926f Prefer idx_t in list.h 3582fdb Prefer idx_t in inp.c 4a47c00 build: update gnulib submodule to latest 4f8c4b8 Don’t limit strip counts etc. to INT_MAX 0a810b6 Fix unlikely integer overflows in patch.c bac3b6d Fix unlikely integer overflows in pch.c 8fb784b Fix unlikely integer overflows in inp.c e10f3ca Promote minmax.h to common.h 57e2165 Avoid some memory allocation by not using ‘const’ eb18b39 Remove unnecessary char * casts in inp.c d60cb72 Pacify gcc -Wunused-parameter when !USE_XATTR 05ef886 Pacify gcc -Wunused-parameter when !USE_XATTR 1f8d192 maint: stop using alloca ba92722 Don’t assume O_RDONLY == 0 0f98e03 Avoid syscall when nested signal block 1235ccc Add signal comment 43ee674 build: update gnulib submodule to latest e381947 Update NEWS, README-prereq 2c2a83b Omit _Noreturn when easy a13c2ea Replace __attribute__ with attribute.h 6eb2d13 Switch from ctype.h to c-ctype.h d1a6847 Simplify warning configuration d6631b3 Prefer ATTRIBUTE_* to _GL_ATTRIBUTE_* bc6899d Pacify gcc -Wno-unused-parameter da25985 Improve ‘git diff’ output if desired 248ef13 Prefer strerror to perror 6cb321a A bit more long-string fixing 47bc09d Prefer nullptr to NULL 7608746 More fixing of printing of very long strings 323da0d Don’t assume string sizes fit in int when printing 53d1014 Avoid fprintf INT_MAX overflow when merging 59681c8 Avoid sprintf INT_MAX overflow 4278b91 Reject output file names containing '\n' 34b45bc Update man page a bit. d18c05d Update copyright notices af828e5 Fix some races involving signals b3a6c95 Don’t attempt to remove files we didn’t create 9abc949 Omit goto in try_safe_open 90e62d5 Pacify clang re obsolete O_CREAT test 2b87c1e Allow nested block/unblock of signals 7aa1c3b Adjust to new Gnulib bootstrap post imports 99c0c0b maint: remove generated file lib/Makefile.am 1c087d6 Rely on Gnulib inttypes module 7214f8d Update main locals more consistently 6785b2c Use struct outfile * in function args 72d7ed0 Refactor temp names into struct abf6fb1 Simplify by using Gnulib sigaction d3816ac Avoid unnecessary freeing in output_files 346d3ac Clean up cleanup ff2317b Port better to GNU/Hurd c2d9792 Don’t say empty backups are unreadable 8c27a03 Spelling fixes d46d729 Change manywarnings usage to be more like coreutils 924698b Pacify clang, which dislikes n + "y" 8939519 Pacify -Wstrict-overflow in pch.c 531cc2b Pacify -Wsuggest-attribute=format in util.c ff13fea Port to non-VLA C compilers 3d5c0d1 Rename vars to pacify gcc -Wshadow 56788ce Stop including stdbool.h c10da77 Recommend 64-bit time_t on 32-bit platforms 1e21767 Remove pch_sha1 39005cf Move skip_spaces 755712d Remove pch_timestamp function 04f0eeb Prefer extern inline to static inline for list.h f06c123 maint: pacify gcc 14 -Wcast-align aab6e7b maint: pacify -Wanalyzer-null-argument d1d32c9 maint: work around GCC bug 109839 7575694 maint: pacify gcc -Wmissing-variable-declarations 8f78b09 maint: pacify gcc -Winline bb841fd maint: port _FORTIFY_SOURCE to Ubuntu 4887683 maint: assume STDC_HEADERS 5b8ecde maint: spruce up our .m4 files a bit 009a424 maint: omit obsolete macro calls 299167f maint: simplify .gitignore 3ec44a4 build: update gnulib submodule to latest 68cb529 build: update gnulib submodule to latest f144b35 build: Enable the 'subdir-objects' Automake option. faafc79 build: update gnulib submodule to latest c835ecc Pass the correct stat to backup files 24f81be maint: modernize README-{hacking,prereq} 7623b2d Fix test for presence of BASH_LINENO[0] 0993940 gnulib: update to latest 78ed9de Add missing-section tests to context-format test case 76e7758 Fix failed assertion 'outstate->after_newline' 15b158d Avoid invalid memory access in context format diffs dce4683 Don't follow symlinks unless --follow-symlinks is given 61d7788 Don't crash when RLIMIT_NOFILE is set to RLIM_INFINITY b7b028a Abort when cleaning up fails a5b442c Skip "ed" test when the ed utility is not installed 2b584ae Improve support for memory leak detection 9c98635 Fix swapping fake lines in pch_swap ff81775 Make the (debug & 2) output more useful 369dccc Don't leak temporary file on failed multi-file ed-style patch 1959988 Don't leak temporary file on failed ed-style patch f322a7e Request 'alloca' module from gnulib. 458ac51 Fix 'ed-style' test failure. 1e9104c Fix check of return value of fwrite(). ae81be0 maint: avoid warnings from GCC8 2a32bf0 Minor cleanups in do_ed_script ff1d3a6 Use gnulib execute module 3fcd042 Invoke ed directly instead of using the shell 123eaff Fix arbitrary command execution in ed-style patches (CVE-2018-1000156) b5a91a0 Allow input files to be missing for ed-style patches f290f48 Fix segfault with mangled rename patch 074e239 Test suite: fix Korn shell incompatibility f6bc5b1 Test suite compatibility fixes 3bbebbb Avoid set_file_attributes sign conversion warnings Signed-off-by: Russell Senior Link: https://github.com/openwrt/openwrt/pull/18479 Signed-off-by: Robert Marko (cherry picked from commit f45df2167ba6e7ae80fd0786fa4028a4263b2a6f) --- tools/patch/Makefile | 6 +- tools/patch/patches/010-CVE-2018-6951.patch | 24 --- .../patch/patches/020-CVE-2018-1000156.patch | 142 ------------------ tools/patch/patches/030-CVE-2018-6952.patch | 25 --- ...rror-handling-with-git-style-patches.patch | 53 ------- tools/patch/patches/050-CVE-2019-13636.patch | 101 ------------- tools/patch/patches/060-CVE-2019-13638.patch | 33 ---- ...l-hard-on-EACCES-when-copying-xattrs.patch | 33 ---- 8 files changed, 3 insertions(+), 414 deletions(-) delete mode 100644 tools/patch/patches/010-CVE-2018-6951.patch delete mode 100644 tools/patch/patches/020-CVE-2018-1000156.patch delete mode 100644 tools/patch/patches/030-CVE-2018-6952.patch delete mode 100644 tools/patch/patches/040-Fix-error-handling-with-git-style-patches.patch delete mode 100644 tools/patch/patches/050-CVE-2019-13636.patch delete mode 100644 tools/patch/patches/060-CVE-2019-13638.patch delete mode 100644 tools/patch/patches/070-don-t-fail-hard-on-EACCES-when-copying-xattrs.patch diff --git a/tools/patch/Makefile b/tools/patch/Makefile index f4cf588622ffa9..785793685c0a39 100644 --- a/tools/patch/Makefile +++ b/tools/patch/Makefile @@ -7,13 +7,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=patch -PKG_VERSION:=2.7.6 -PKG_RELEASE:=7 +PKG_VERSION:=2.8 +PKG_RELEASE:=1 PKG_CPE_ID:=cpe:/a:gnu:patch PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@GNU/patch -PKG_HASH:=8cf86e00ad3aaa6d26aca30640e86b0e3e1f395ed99f189b06d4c9f74bc58a4e +PKG_HASH:=308a4983ff324521b9b21310bfc2398ca861798f02307c79eb99bb0e0d2bf980 HOST_BUILD_PARALLEL := 1 diff --git a/tools/patch/patches/010-CVE-2018-6951.patch b/tools/patch/patches/010-CVE-2018-6951.patch deleted file mode 100644 index 10dc56809932ef..00000000000000 --- a/tools/patch/patches/010-CVE-2018-6951.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 1f7853c05f9949d81da9be7a02b90cc64284d1f8 Mon Sep 17 00:00:00 2001 -From: Andreas Gruenbacher -Date: Mon, 12 Feb 2018 16:48:24 +0100 -Subject: [PATCH] Fix segfault with mangled rename patch - -http://savannah.gnu.org/bugs/?53132 -* src/pch.c (intuit_diff_type): Ensure that two filenames are specified -for renames and copies (fix the existing check). ---- - src/pch.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/src/pch.c -+++ b/src/pch.c -@@ -974,7 +974,8 @@ intuit_diff_type (bool need_header, mode - if ((pch_rename () || pch_copy ()) - && ! inname - && ! ((i == OLD || i == NEW) && -- p_name[! reverse] && -+ p_name[reverse] && p_name[! reverse] && -+ name_is_valid (p_name[reverse]) && - name_is_valid (p_name[! reverse]))) - { - say ("Cannot %s file without two valid file names\n", pch_rename () ? "rename" : "copy"); diff --git a/tools/patch/patches/020-CVE-2018-1000156.patch b/tools/patch/patches/020-CVE-2018-1000156.patch deleted file mode 100644 index 99dfe540753412..00000000000000 --- a/tools/patch/patches/020-CVE-2018-1000156.patch +++ /dev/null @@ -1,142 +0,0 @@ -From b3a0ca3deed00334f9feece43f76776b6a168e47 Mon Sep 17 00:00:00 2001 -From: Andreas Gruenbacher -Date: Fri, 6 Apr 2018 12:14:49 +0200 -Subject: [PATCH] Fix arbitrary command execution in ed-style patches - (CVE-2018-1000156) - -* src/pch.c (do_ed_script): Write ed script to a temporary file instead -of piping it to ed: this will cause ed to abort on invalid commands -instead of rejecting them and carrying on. -* tests/ed-style: New test case. -* tests/Makefile.am (TESTS): Add test case. ---- - src/pch.c | 89 +++++++++++++++++++++++++++++++++++++++++-------------- - 1 file changed, 66 insertions(+), 23 deletions(-) - ---- a/src/pch.c -+++ b/src/pch.c -@@ -33,6 +33,7 @@ - # include - #endif - #include -+#include - - #define INITHUNKMAX 125 /* initial dynamic allocation size */ - -@@ -2389,22 +2390,28 @@ do_ed_script (char const *inname, char c - static char const editor_program[] = EDITOR_PROGRAM; - - file_offset beginning_of_this_line; -- FILE *pipefp = 0; - size_t chars_read; -+ FILE *tmpfp = 0; -+ char const *tmpname; -+ int tmpfd; -+ pid_t pid; -+ -+ if (! dry_run && ! skip_rest_of_patch) -+ { -+ /* Write ed script to a temporary file. This causes ed to abort on -+ invalid commands such as when line numbers or ranges exceed the -+ number of available lines. When ed reads from a pipe, it rejects -+ invalid commands and treats the next line as a new command, which -+ can lead to arbitrary command execution. */ -+ -+ tmpfd = make_tempfile (&tmpname, 'e', NULL, O_RDWR | O_BINARY, 0); -+ if (tmpfd == -1) -+ pfatal ("Can't create temporary file %s", quotearg (tmpname)); -+ tmpfp = fdopen (tmpfd, "w+b"); -+ if (! tmpfp) -+ pfatal ("Can't open stream for file %s", quotearg (tmpname)); -+ } - -- if (! dry_run && ! skip_rest_of_patch) { -- int exclusive = *outname_needs_removal ? 0 : O_EXCL; -- assert (! inerrno); -- *outname_needs_removal = true; -- copy_file (inname, outname, 0, exclusive, instat.st_mode, true); -- sprintf (buf, "%s %s%s", editor_program, -- verbosity == VERBOSE ? "" : "- ", -- outname); -- fflush (stdout); -- pipefp = popen(buf, binary_transput ? "wb" : "w"); -- if (!pipefp) -- pfatal ("Can't open pipe to %s", quotearg (buf)); -- } - for (;;) { - char ed_command_letter; - beginning_of_this_line = file_tell (pfp); -@@ -2415,14 +2422,14 @@ do_ed_script (char const *inname, char c - } - ed_command_letter = get_ed_command_letter (buf); - if (ed_command_letter) { -- if (pipefp) -- if (! fwrite (buf, sizeof *buf, chars_read, pipefp)) -+ if (tmpfp) -+ if (! fwrite (buf, sizeof *buf, chars_read, tmpfp)) - write_fatal (); - if (ed_command_letter != 'd' && ed_command_letter != 's') { - p_pass_comments_through = true; - while ((chars_read = get_line ()) != 0) { -- if (pipefp) -- if (! fwrite (buf, sizeof *buf, chars_read, pipefp)) -+ if (tmpfp) -+ if (! fwrite (buf, sizeof *buf, chars_read, tmpfp)) - write_fatal (); - if (chars_read == 2 && strEQ (buf, ".\n")) - break; -@@ -2435,13 +2442,49 @@ do_ed_script (char const *inname, char c - break; - } - } -- if (!pipefp) -+ if (!tmpfp) - return; -- if (fwrite ("w\nq\n", sizeof (char), (size_t) 4, pipefp) == 0 -- || fflush (pipefp) != 0) -+ if (fwrite ("w\nq\n", sizeof (char), (size_t) 4, tmpfp) == 0 -+ || fflush (tmpfp) != 0) - write_fatal (); -- if (pclose (pipefp) != 0) -- fatal ("%s FAILED", editor_program); -+ -+ if (lseek (tmpfd, 0, SEEK_SET) == -1) -+ pfatal ("Can't rewind to the beginning of file %s", quotearg (tmpname)); -+ -+ if (! dry_run && ! skip_rest_of_patch) { -+ int exclusive = *outname_needs_removal ? 0 : O_EXCL; -+ *outname_needs_removal = true; -+ if (inerrno != ENOENT) -+ { -+ *outname_needs_removal = true; -+ copy_file (inname, outname, 0, exclusive, instat.st_mode, true); -+ } -+ sprintf (buf, "%s %s%s", editor_program, -+ verbosity == VERBOSE ? "" : "- ", -+ outname); -+ fflush (stdout); -+ -+ pid = fork(); -+ if (pid == -1) -+ pfatal ("Can't fork"); -+ else if (pid == 0) -+ { -+ dup2 (tmpfd, 0); -+ execl ("/bin/sh", "sh", "-c", buf, (char *) 0); -+ _exit (2); -+ } -+ else -+ { -+ int wstatus; -+ if (waitpid (pid, &wstatus, 0) == -1 -+ || ! WIFEXITED (wstatus) -+ || WEXITSTATUS (wstatus) != 0) -+ fatal ("%s FAILED", editor_program); -+ } -+ } -+ -+ fclose (tmpfp); -+ safe_unlink (tmpname); - - if (ofp) - { diff --git a/tools/patch/patches/030-CVE-2018-6952.patch b/tools/patch/patches/030-CVE-2018-6952.patch deleted file mode 100644 index 36b58c79ddbaa7..00000000000000 --- a/tools/patch/patches/030-CVE-2018-6952.patch +++ /dev/null @@ -1,25 +0,0 @@ -From df40f2ea17254de269a3624319a12a93a4e395ff Mon Sep 17 00:00:00 2001 -From: Andreas Gruenbacher -Date: Fri, 17 Aug 2018 13:35:40 +0200 -Subject: [PATCH] Fix swapping fake lines in pch_swap - -* src/pch.c (pch_swap): Fix swapping p_bfake and p_efake when there is a -blank line in the middle of a context-diff hunk: that empty line stays -in the middle of the hunk and isn't swapped. - -Fixes: https://savannah.gnu.org/bugs/index.php?53133 ---- - src/pch.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/src/pch.c -+++ b/src/pch.c -@@ -2115,7 +2115,7 @@ pch_swap (void) - } - if (p_efake >= 0) { /* fix non-freeable ptr range */ - if (p_efake <= i) -- n = p_end - i + 1; -+ n = p_end - p_ptrn_lines; - else - n = -i; - p_efake += n; diff --git a/tools/patch/patches/040-Fix-error-handling-with-git-style-patches.patch b/tools/patch/patches/040-Fix-error-handling-with-git-style-patches.patch deleted file mode 100644 index 5cc958e74641b0..00000000000000 --- a/tools/patch/patches/040-Fix-error-handling-with-git-style-patches.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 424da221cec76ea200cff1fa9b08a6f3d94c28a7 Mon Sep 17 00:00:00 2001 -From: Lubomir Rintel -Date: Wed, 31 Oct 2018 16:39:13 -0700 -Subject: [PATCH] Fix error handling with git-style patches - -When an error is encountered in output_files(), the subsequent call to -cleanup() calls back into output_files() resulting in an infinte recursion. -This is trivially reproduced with a git-style patch (which utilizes -output_file_later()) that tries to patch a nonexistent or unreadable -file (see attached test case). - -* src/patch.c: (output_files) clear the files_to_output list before -iterating it, so that recursive calls won't iterate the same files. ---- - src/patch.c | 12 ++++++++---- - 1 file changed, 8 insertions(+), 4 deletions(-) - ---- a/src/patch.c -+++ b/src/patch.c -@@ -1938,8 +1938,12 @@ output_files (struct stat const *st) - { - gl_list_iterator_t iter; - const void *elt; -+ gl_list_t files; - -- iter = gl_list_iterator (files_to_output); -+ files = files_to_output; -+ init_files_to_output (); -+ -+ iter = gl_list_iterator (files); - while (gl_list_iterator_next (&iter, &elt, NULL)) - { - const struct file_to_output *file_to_output = elt; -@@ -1957,8 +1961,8 @@ output_files (struct stat const *st) - /* Free the list up to here. */ - for (;;) - { -- const void *elt2 = gl_list_get_at (files_to_output, 0); -- gl_list_remove_at (files_to_output, 0); -+ const void *elt2 = gl_list_get_at (files, 0); -+ gl_list_remove_at (files, 0); - if (elt == elt2) - break; - } -@@ -1967,7 +1971,7 @@ output_files (struct stat const *st) - } - } - gl_list_iterator_free (&iter); -- gl_list_clear (files_to_output); -+ gl_list_clear (files); - } - - /* Fatal exit with cleanup. */ diff --git a/tools/patch/patches/050-CVE-2019-13636.patch b/tools/patch/patches/050-CVE-2019-13636.patch deleted file mode 100644 index d819838bba44f7..00000000000000 --- a/tools/patch/patches/050-CVE-2019-13636.patch +++ /dev/null @@ -1,101 +0,0 @@ -From dce4683cbbe107a95f1f0d45fabc304acfb5d71a Mon Sep 17 00:00:00 2001 -From: Andreas Gruenbacher -Date: Mon, 15 Jul 2019 16:21:48 +0200 -Subject: Don't follow symlinks unless --follow-symlinks is given - -* src/inp.c (plan_a, plan_b), src/util.c (copy_to_fd, copy_file, -append_to_file): Unless the --follow-symlinks option is given, open files with -the O_NOFOLLOW flag to avoid following symlinks. So far, we were only doing -that consistently for input files. -* src/util.c (create_backup): When creating empty backup files, (re)create them -with O_CREAT | O_EXCL to avoid following symlinks in that case as well. ---- - src/inp.c | 12 ++++++++++-- - src/util.c | 14 +++++++++++--- - 2 files changed, 21 insertions(+), 5 deletions(-) - ---- a/src/inp.c -+++ b/src/inp.c -@@ -238,8 +238,13 @@ plan_a (char const *filename) - { - if (S_ISREG (instat.st_mode)) - { -- int ifd = safe_open (filename, O_RDONLY|binary_transput, 0); -+ int flags = O_RDONLY | binary_transput; - size_t buffered = 0, n; -+ int ifd; -+ -+ if (! follow_symlinks) -+ flags |= O_NOFOLLOW; -+ ifd = safe_open (filename, flags, 0); - if (ifd < 0) - pfatal ("can't open file %s", quotearg (filename)); - -@@ -340,6 +345,7 @@ plan_a (char const *filename) - static void - plan_b (char const *filename) - { -+ int flags = O_RDONLY | binary_transput; - int ifd; - FILE *ifp; - int c; -@@ -353,7 +359,9 @@ plan_b (char const *filename) - - if (instat.st_size == 0) - filename = NULL_DEVICE; -- if ((ifd = safe_open (filename, O_RDONLY | binary_transput, 0)) < 0 -+ if (! follow_symlinks) -+ flags |= O_NOFOLLOW; -+ if ((ifd = safe_open (filename, flags, 0)) < 0 - || ! (ifp = fdopen (ifd, binary_transput ? "rb" : "r"))) - pfatal ("Can't open file %s", quotearg (filename)); - if (TMPINNAME_needs_removal) ---- a/src/util.c -+++ b/src/util.c -@@ -388,7 +388,7 @@ create_backup (char const *to, const str - - try_makedirs_errno = ENOENT; - safe_unlink (bakname); -- while ((fd = safe_open (bakname, O_CREAT | O_WRONLY | O_TRUNC, 0666)) < 0) -+ while ((fd = safe_open (bakname, O_CREAT | O_EXCL | O_WRONLY | O_TRUNC, 0666)) < 0) - { - if (errno != try_makedirs_errno) - pfatal ("Can't create file %s", quotearg (bakname)); -@@ -579,10 +579,13 @@ create_file (char const *file, int open_ - static void - copy_to_fd (const char *from, int tofd) - { -+ int from_flags = O_RDONLY | O_BINARY; - int fromfd; - ssize_t i; - -- if ((fromfd = safe_open (from, O_RDONLY | O_BINARY, 0)) < 0) -+ if (! follow_symlinks) -+ from_flags |= O_NOFOLLOW; -+ if ((fromfd = safe_open (from, from_flags, 0)) < 0) - pfatal ("Can't reopen file %s", quotearg (from)); - while ((i = read (fromfd, buf, bufsize)) != 0) - { -@@ -625,6 +628,8 @@ copy_file (char const *from, char const - else - { - assert (S_ISREG (mode)); -+ if (! follow_symlinks) -+ to_flags |= O_NOFOLLOW; - tofd = create_file (to, O_WRONLY | O_BINARY | to_flags, mode, - to_dir_known_to_exist); - copy_to_fd (from, tofd); -@@ -640,9 +645,12 @@ copy_file (char const *from, char const - void - append_to_file (char const *from, char const *to) - { -+ int to_flags = O_WRONLY | O_APPEND | O_BINARY; - int tofd; - -- if ((tofd = safe_open (to, O_WRONLY | O_BINARY | O_APPEND, 0)) < 0) -+ if (! follow_symlinks) -+ to_flags |= O_NOFOLLOW; -+ if ((tofd = safe_open (to, to_flags, 0)) < 0) - pfatal ("Can't reopen file %s", quotearg (to)); - copy_to_fd (from, tofd); - if (close (tofd) != 0) diff --git a/tools/patch/patches/060-CVE-2019-13638.patch b/tools/patch/patches/060-CVE-2019-13638.patch deleted file mode 100644 index 590cf186e7c67e..00000000000000 --- a/tools/patch/patches/060-CVE-2019-13638.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 3fcd042d26d70856e826a42b5f93dc4854d80bf0 Mon Sep 17 00:00:00 2001 -From: Andreas Gruenbacher -Date: Fri, 6 Apr 2018 19:36:15 +0200 -Subject: Invoke ed directly instead of using the shell - -* src/pch.c (do_ed_script): Invoke ed directly instead of using a shell -command to avoid quoting vulnerabilities. ---- - src/pch.c | 6 ++---- - 1 file changed, 2 insertions(+), 4 deletions(-) - ---- a/src/pch.c -+++ b/src/pch.c -@@ -2459,9 +2459,6 @@ do_ed_script (char const *inname, char c - *outname_needs_removal = true; - copy_file (inname, outname, 0, exclusive, instat.st_mode, true); - } -- sprintf (buf, "%s %s%s", editor_program, -- verbosity == VERBOSE ? "" : "- ", -- outname); - fflush (stdout); - - pid = fork(); -@@ -2470,7 +2467,8 @@ do_ed_script (char const *inname, char c - else if (pid == 0) - { - dup2 (tmpfd, 0); -- execl ("/bin/sh", "sh", "-c", buf, (char *) 0); -+ assert (outname[0] != '!' && outname[0] != '-'); -+ execlp (editor_program, editor_program, "-", outname, (char *) NULL); - _exit (2); - } - else diff --git a/tools/patch/patches/070-don-t-fail-hard-on-EACCES-when-copying-xattrs.patch b/tools/patch/patches/070-don-t-fail-hard-on-EACCES-when-copying-xattrs.patch deleted file mode 100644 index e19a9c0845b4fb..00000000000000 --- a/tools/patch/patches/070-don-t-fail-hard-on-EACCES-when-copying-xattrs.patch +++ /dev/null @@ -1,33 +0,0 @@ -From f42cbe1a91a3a6f79d1eec594ce7c72aec79179b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= -Date: Wed, 9 Nov 2022 05:08:22 +0100 -Subject: [PATCH] don't fail hard on EACCES when copying xattrs - -On btrfs the xattr "btrfs.compressed" requires privileges to set, -otherwise EACCES is returned. -When patch tries to do copy this attribute it receives the error and -aborts. ---- - src/util.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/src/util.c -+++ b/src/util.c -@@ -182,7 +182,7 @@ copy_attr_error (struct error_context *c - int err = errno; - va_list ap; - -- if (err != ENOSYS && err != ENOTSUP && err != EPERM) -+ if (err != ENOSYS && err != ENOTSUP && err != EPERM && err != EACCES) - { - /* use verror module to print error message */ - va_start (ap, fmt); -@@ -284,7 +284,7 @@ set_file_attributes (char const *to, enu - } - if (attr & FA_XATTRS) - if (copy_attr (from, to) != 0 -- && errno != ENOSYS && errno != ENOTSUP && errno != EPERM) -+ && errno != ENOSYS && errno != ENOTSUP && errno != EPERM && errno != EACCES) - fatal_exit (0); - if (attr & FA_MODE) - { From a52a1387e010661d274bf2603d27907679ece80d Mon Sep 17 00:00:00 2001 From: George Sapkin Date: Sat, 5 Apr 2025 01:37:32 +0300 Subject: [PATCH 740/877] tools/expat: bump to 2.7.1 to fix several CVEs Addresses CVE-2024-8176 and CVE-2024-50602. Changelog: https://github.com/libexpat/libexpat/blob/R_2_7_1/expat/Changes Fixes: https://github.com/openwrt/packages/issues/26255 Fixes: https://github.com/advisories/GHSA-9hcv-xw76-m4h6 Fixes: https://github.com/advisories/GHSA-79wf-qgrg-2p6c Signed-off-by: George Sapkin Link: https://github.com/openwrt/openwrt/pull/18421 Signed-off-by: Hauke Mehrtens (cherry picked from commit 14a88ba520b44cf22216d1819d936cea1ec509a9) Link: https://github.com/openwrt/openwrt/pull/19079 Signed-off-by: Robert Marko --- tools/expat/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/expat/Makefile b/tools/expat/Makefile index d48837233f3040..941f0c3fbfb890 100644 --- a/tools/expat/Makefile +++ b/tools/expat/Makefile @@ -9,10 +9,10 @@ include $(TOPDIR)/rules.mk PKG_NAME:=expat PKG_CPE_ID:=cpe:/a:libexpat:libexpat -PKG_VERSION:=2.6.3 +PKG_VERSION:=2.7.1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_HASH:=17aa6cfc5c4c219c09287abfc10bc13f0c06f30bb654b28bfe6f567ca646eb79 +PKG_HASH:=0cce2e6e69b327fc607b8ff264f4b66bdf71ead55a87ffd5f3143f535f15cfa2 PKG_SOURCE_URL:=https://github.com/libexpat/libexpat/releases/download/R_$(subst .,_,$(PKG_VERSION)) HOST_BUILD_PARALLEL:=1 From fdbbb8415fd19ae0748a2bbe41b15257054e4077 Mon Sep 17 00:00:00 2001 From: Juan Pedro Paredes Caballero Date: Sat, 7 Dec 2024 14:20:31 +0100 Subject: [PATCH 741/877] mediatek: filogic: Add support for cudy wr3000h The manufacturer Cudy usually releases signed openwrt firmware, to facilitate the migration from the proprietary version to the official versions of openwrt. In contact with the manufacturer tells me that only releases the firmware of the WR3000H if and only if there is an official version. With this proposal I pretend to have an initial operative version so that they do their part, and facilitate to the users the possibility of using openwrt. In the present state, it is only possible to use this firmware by uploading and installing it with UART connection. AX3000 2.5G Dual Band Wi-Fi 6 Mesh Router (WR3000H) Hardware -------- MediaTek MT7981 WiSoC 256MB DDR3 RAM 128MB SPI-NAND (XMC XM25QH128C) MediaTek MT7981 2x2 DBDC 802.11ax 2T2R (2.4 / 5) 4 LAN MediaTek MT7531 PHY 1 WAN RTL8221B-VB-CG 2.5Gbps PHY (C22) 2 Radios MT7976CN UART: 115200 8N1 3.3V MAC: LAN MAC: label mac WAN MAC: label mac + 1 2.4G MAC: label mac 5G MAC: label mac + 1 with LA bit set Installation ------------ 1. Connect to the serial port as described in the "Hardware" section. 2. Power on the device + press reset pin. Keep pressing reset pin to enter the U-Boot shell (The recovery.bin image load process must fail). 3. Download the OpenWrt initramfs image. Place it on an TFTP server connected to the Cudy LAN ports. Make sure the server is reachable at 192.168.1.88. Rename the image to "cudy3000h.bin" 4. Download and boot the OpenWrt initramfs image. $ tftpboot 0x46000000 cudy3000h.bin; bootm 0x46000000 5. IMPORTANT: Make backup from original firmware. System -> Backup /Flash Firmware -> Save mtdblock contents. All mtdblock one by one, keep unaltered (BL2, u-boot-env, Factory, bdinfo, FIP, and ubi). 6. Transfer the OpenWrt sysupgrade image to the device using scp. Install with sysupgrade. Warning for BL2 and U-BOOT developers ------------------------------------- The nand partition layout from vendor is slightly diferent from "standard". The FIP partition starts at 0x3c0000 be carefull with BL2 to BL31. The UBI partition start at 0x5c0000 be carefull. DO NOT OVERWRITE bdinfo partition it contains hardware MAC definition Layout is start-end (not start size) - 0x000000000000-0x000007800000 : "nmbm0" - 0x000000000000-0x000000100000 : "bl2" - 0x000000100000-0x000000180000 : "u-boot-env" - 0x000000180000-0x000000380000 : "factory" - 0x000000380000-0x0000003c0000 : "bdinfo" - 0x0000003c0000-0x0000005c0000 : "fip" - 0x0000005c0000-0x0000045c0000 : "ubi" ALLWAYS for U-BOOT operations check this setenv mtdids nmbm0=nmbm0 setenv mtdparts nmbm0:1024k(bl2),512k(u-boot-env),2048k(factory),256k(bdinfo),2048k(fip),65536k(ubi) Signed-off-by: Juan Pedro Paredes Caballero Link: https://github.com/openwrt/openwrt/pull/17458 (cherry picked from commit 9d66b8b312fb6a4087244ee3ee10e1ba1623df81) Link: https://github.com/openwrt/openwrt/pull/19124 Signed-off-by: Hauke Mehrtens --- .../mediatek/dts/mt7981b-cudy-wr3000h-v1.dts | 337 ++++++++++++++++++ .../filogic/base-files/etc/board.d/01_leds | 8 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 1 + .../base-files/lib/upgrade/platform.sh | 4 + target/linux/mediatek/image/filogic.mk | 17 + 5 files changed, 367 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7981b-cudy-wr3000h-v1.dts diff --git a/target/linux/mediatek/dts/mt7981b-cudy-wr3000h-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-wr3000h-v1.dts new file mode 100644 index 00000000000000..0808eb9557a251 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-cudy-wr3000h-v1.dts @@ -0,0 +1,337 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/dts-v1/; + +#include + +#include "mt7981.dtsi" + +/ { + model = "Cudy WR3000H v1"; + compatible = "cudy,wr3000h-v1", "mediatek,mt7981-spim-snand-rfb"; + + aliases { + label-mac-device = &gmac0; + led-boot = &led_status; + led-failsafe = &led_status; + led-running = &led_status; + led-upgrade = &led_status; + serial0 = &uart0; + }; + + 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>; + }; + }; + + gpio-export { + compatible = "gpio-export"; + #size-cells = <0>; + + phyreset { + gpio-export,name = "phyreset"; + gpio-export,output = <1>; + gpios = <&pio 3 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status: led@0 { + function = LED_FUNCTION_STATUS; + color = ; + gpios = <&pio 5 GPIO_ACTIVE_LOW>; + }; + + + led_internet { + function = LED_FUNCTION_WAN_ONLINE; + color = ; + gpios = <&pio 11 GPIO_ACTIVE_LOW>; + }; + + led_wps { + function = LED_FUNCTION_WPS; + color = ; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + }; + + led_wlan2g { + function = LED_FUNCTION_WLAN_2GHZ; + color = ; + gpios = <&pio 6 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + led_wlan5g { + function = LED_FUNCTION_WLAN_5GHZ; + color = ; + gpios = <&pio 7 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + + led_lan1 { + function = LED_FUNCTION_LAN; + function-enumerator = <1>; + color = ; + gpios = <&pio 8 GPIO_ACTIVE_LOW>; + }; + + led_lan2 { + function = LED_FUNCTION_LAN; + function-enumerator = <2>; + color = ; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + }; + + led_lan3 { + function = LED_FUNCTION_LAN; + function-enumerator = <3>; + color = ; + gpios = <&pio 12 GPIO_ACTIVE_LOW>; + }; + + led_lan4 { + function = LED_FUNCTION_LAN; + function-enumerator = <4>; + color = ; + gpios = <&pio 13 GPIO_ACTIVE_LOW>; + }; + + led_wan { + function = LED_FUNCTION_WAN; + color = ; + 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_bdinfo_de00 0>; + label = "lan"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "2500base-x"; + phy-handle = <&phy6>; + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_bdinfo_de00 1>; + label = "wan"; + }; + +}; + +&mdio_bus { + switch: switch@1f { + 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>; + }; + phy6: ethernet-phy@6 { + compatible = "ethernet-phy-ieee802.3-c22"; // [RTL8221B-VB-CG 2.5Gbps PHY (C22)] + reg = <6>; + phy-mode = "2500base-x"; + }; + +}; + +&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-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 = <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>; + }; + }; + }; + + partition@380000 { + label = "bdinfo"; + reg = <0x380000 0x0040000>; + 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@3C0000 { + label = "FIP"; + reg = <0x3C0000 0x0200000>; + read-only; + }; + + partition@580000 { + label = "ubi"; + reg = <0x5C0000 0x4000000>; + compatible = "linux,ubi"; + }; + }; + }; +}; + +&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 = ; + }; + }; +}; + +&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; + }; + }; + }; +}; + +&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 dd0bc3597bb16c..3745e2cb7e3bfc 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,14 @@ wavlink,wl-wn573hx3) cudy,wr3000-v1) ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan" ;; +cudy,wr3000h-v1) + ucidef_set_led_netdev "lan1" "lan1" "white:lan-1" "lan1" "link tx rx" + ucidef_set_led_netdev "lan2" "lan2" "white:lan-2" "lan2" "link tx rx" + ucidef_set_led_netdev "lan3" "lan3" "white:lan-3" "lan3" "link tx rx" + ucidef_set_led_netdev "lan4" "lan4" "white:lan-4" "lan4" "link tx rx" + ucidef_set_led_netdev "wan" "wan" "white:wan" "wan" "link tx rx" + ucidef_set_led_netdev "internet" "internet" "white:wan-online" "wan" "link" + ;; glinet,gl-x3000|\ glinet,gl-xe3000) ucidef_set_led_default "power" "POWER" "green:power" "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 e58944025802da..f798a194a8b101 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,6 +80,7 @@ case "$board" in cudy,re3000-v1|\ cudy,tr3000-v1|\ cudy,wr3000s-v1|\ + cudy,wr3000h-v1|\ 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 9e1e50c50faaa9..d747de1d1346bf 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -124,6 +124,10 @@ platform_do_upgrade() { CI_KERNPART="linux" nand_do_upgrade "$1" ;; + cudy,wr3000h-v1) + CI_UBIPART="ubi" + nand_do_upgrade "$1" + ;; cudy,re3000-v1|\ cudy,wr3000-v1|\ yuncore,ax835|\ diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 44d51e404ab85f..56d3631cbcab90 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -773,6 +773,23 @@ define Device/cudy_wr3000s-v1 endef TARGET_DEVICES += cudy_wr3000s-v1 +define Device/cudy_wr3000h-v1 + DEVICE_VENDOR := Cudy + DEVICE_MODEL := WR3000H + DEVICE_VARIANT := v1 + DEVICE_DTS := mt7981b-cudy-wr3000h-v1 + DEVICE_DTS_DIR := ../dts + SUPPORTED_DEVICES += R59 + 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-mt7915e kmod-mt7981-firmware mt7981-wo-firmware +endef +TARGET_DEVICES += cudy_wr3000h-v1 + define Device/dlink_aquila-pro-ai-m30-a1 DEVICE_VENDOR := D-Link DEVICE_MODEL := AQUILA PRO AI M30 From 197c6ee66c8e30ce43074225543bf6bc7047f826 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Fri, 17 Jan 2025 23:23:10 +0100 Subject: [PATCH 742/877] mediatek: filogic: Cudy WR3000H: Fix SUPPORTED_DEVICES Fix the name used for the transition image from Cudy. This should make it possible to use the cudy transition image. Fixes: 9d66b8b312fb ("mediatek: filogic: Add support for cudy wr3000h") Link: https://github.com/openwrt/openwrt/pull/17652 (cherry picked from commit 0f8a5a5fd6929a3795a67ad4f98a7bc7358d22d9) Link: https://github.com/openwrt/openwrt/pull/19124 Signed-off-by: Hauke Mehrtens --- 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 56d3631cbcab90..a66502ca331db4 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -779,7 +779,7 @@ define Device/cudy_wr3000h-v1 DEVICE_VARIANT := v1 DEVICE_DTS := mt7981b-cudy-wr3000h-v1 DEVICE_DTS_DIR := ../dts - SUPPORTED_DEVICES += R59 + SUPPORTED_DEVICES += R63 UBINIZE_OPTS := -E 5 BLOCKSIZE := 128k PAGESIZE := 2048 From 72529db50ebddc7fca7a7d5dc35eab4e668544fa Mon Sep 17 00:00:00 2001 From: Juan Pedro Paredes Caballero Date: Sun, 26 Jan 2025 20:23:09 +0100 Subject: [PATCH 743/877] mediatek: filogic: fix 2.5G phy compatible for WR3000H MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Following the initial support of the Cudy WR3000H with PHY C22 for the 2.5G WAN interface, several improvements fixing issues with RealTek RTL8221B PHYs have been merged. Therefore we can now bring the DT in line with other equipment and declare the 2.5G WAN PHY as C45. Fixes: 9d66b8b ("mediatek: filogic: Add support for cudy wr3000h") Signed-off-by: Juan Pedro Paredes Caballero Link: https://github.com/openwrt/openwrt/pull/17739 [reword commit description] Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit dcc5587374ace475cc2f2a94afd1c51e10946c3d) Link: https://github.com/openwrt/openwrt/pull/19124 Signed-off-by: Hauke Mehrtens --- target/linux/mediatek/dts/mt7981b-cudy-wr3000h-v1.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/mediatek/dts/mt7981b-cudy-wr3000h-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-wr3000h-v1.dts index 0808eb9557a251..bdcc4f78eabf47 100644 --- a/target/linux/mediatek/dts/mt7981b-cudy-wr3000h-v1.dts +++ b/target/linux/mediatek/dts/mt7981b-cudy-wr3000h-v1.dts @@ -174,7 +174,7 @@ interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; }; phy6: ethernet-phy@6 { - compatible = "ethernet-phy-ieee802.3-c22"; // [RTL8221B-VB-CG 2.5Gbps PHY (C22)] + compatible = "ethernet-phy-ieee802.3-c45"; reg = <6>; phy-mode = "2500base-x"; }; From 0254415769b5eeea138d967056897cd32665f7f5 Mon Sep 17 00:00:00 2001 From: Roland Reinl Date: Sun, 27 Apr 2025 13:43:40 +0200 Subject: [PATCH 744/877] mediatek: Create common DTSI for WR3000H and WR3000S This change moves common elements of the WR3000H and the WR3000S to mt7981b-cudy-wr3000-nand.dtsi. This will simplify adding of new similar devices, for exapmle WR3000E. Signed-off-by: Roland Reinl Link: https://github.com/openwrt/openwrt/pull/18619 (cherry picked from commit 54febbc55bb0526d51f7064a585029f8be48affd) Link: https://github.com/openwrt/openwrt/pull/19124 Signed-off-by: Hauke Mehrtens --- .../dts/mt7981b-cudy-wr3000-nand.dtsi | 184 +++++++++++++++ .../mediatek/dts/mt7981b-cudy-wr3000h-v1.dts | 216 ++---------------- .../mediatek/dts/mt7981b-cudy-wr3000s-v1.dts | 182 +-------------- 3 files changed, 201 insertions(+), 381 deletions(-) create mode 100644 target/linux/mediatek/dts/mt7981b-cudy-wr3000-nand.dtsi diff --git a/target/linux/mediatek/dts/mt7981b-cudy-wr3000-nand.dtsi b/target/linux/mediatek/dts/mt7981b-cudy-wr3000-nand.dtsi new file mode 100644 index 00000000000000..90cad07f591759 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-cudy-wr3000-nand.dtsi @@ -0,0 +1,184 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +#include +#include "mt7981.dtsi" + +/ { + 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>; + }; + }; +}; + +&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_bdinfo_de00 0>; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; +}; + +&mdio_bus { + switch: switch@1f { + 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: 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-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 = <0x00000 0x0100000>; + read-only; + }; + + partition@100000 { + label = "u-boot-env"; + reg = <0x0100000 0x0080000>; + read-only; + }; + + 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>; + }; + }; + }; + + partition@380000 { + label = "bdinfo"; + reg = <0x380000 0x0040000>; + 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@3c0000 { + label = "FIP"; + reg = <0x3c0000 0x0200000>; + read-only; + }; + + partition@5c0000 { + label = "ubi"; + reg = <0x5c0000 0x4000000>; + compatible = "linux,ubi"; + }; + }; + }; +}; + +&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"; + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; +}; diff --git a/target/linux/mediatek/dts/mt7981b-cudy-wr3000h-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-wr3000h-v1.dts index bdcc4f78eabf47..e34d2a9ad2ac22 100644 --- a/target/linux/mediatek/dts/mt7981b-cudy-wr3000h-v1.dts +++ b/target/linux/mediatek/dts/mt7981b-cudy-wr3000h-v1.dts @@ -2,13 +2,11 @@ /dts-v1/; -#include - -#include "mt7981.dtsi" +#include "mt7981b-cudy-wr3000-nand.dtsi" / { model = "Cudy WR3000H v1"; - compatible = "cudy,wr3000h-v1", "mediatek,mt7981-spim-snand-rfb"; + compatible = "cudy,wr3000h-v1", "mediatek,mt7981"; aliases { label-mac-device = &gmac0; @@ -19,102 +17,70 @@ serial0 = &uart0; }; - 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>; - }; - }; - - gpio-export { - compatible = "gpio-export"; - #size-cells = <0>; - - phyreset { - gpio-export,name = "phyreset"; - gpio-export,output = <1>; - gpios = <&pio 3 GPIO_ACTIVE_LOW>; - }; - }; - leds { compatible = "gpio-leds"; - led_status: led@0 { + led_status: led-status { function = LED_FUNCTION_STATUS; color = ; gpios = <&pio 5 GPIO_ACTIVE_LOW>; }; - - led_internet { + led-internet { function = LED_FUNCTION_WAN_ONLINE; color = ; gpios = <&pio 11 GPIO_ACTIVE_LOW>; }; - led_wps { + led-wps { function = LED_FUNCTION_WPS; color = ; gpios = <&pio 9 GPIO_ACTIVE_LOW>; }; - led_wlan2g { + led-wlan2g { function = LED_FUNCTION_WLAN_2GHZ; color = ; gpios = <&pio 6 GPIO_ACTIVE_LOW>; linux,default-trigger = "phy0tpt"; }; - led_wlan5g { + led-wlan5g { function = LED_FUNCTION_WLAN_5GHZ; color = ; gpios = <&pio 7 GPIO_ACTIVE_LOW>; linux,default-trigger = "phy1tpt"; }; - led_lan1 { + led-lan1 { function = LED_FUNCTION_LAN; function-enumerator = <1>; color = ; gpios = <&pio 8 GPIO_ACTIVE_LOW>; }; - led_lan2 { + led-lan2 { function = LED_FUNCTION_LAN; function-enumerator = <2>; color = ; gpios = <&pio 10 GPIO_ACTIVE_LOW>; }; - led_lan3 { + led-lan3 { function = LED_FUNCTION_LAN; function-enumerator = <3>; color = ; gpios = <&pio 12 GPIO_ACTIVE_LOW>; }; - led_lan4 { + led-lan4 { function = LED_FUNCTION_LAN; function-enumerator = <4>; color = ; gpios = <&pio 13 GPIO_ACTIVE_LOW>; }; - led_wan { + led-wan { function = LED_FUNCTION_WAN; color = ; gpios = <&pio 35 GPIO_ACTIVE_LOW>; @@ -122,35 +88,7 @@ }; }; -&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_bdinfo_de00 0>; - label = "lan"; - - fixed-link { - speed = <2500>; - full-duplex; - pause; - }; - }; - gmac1: mac@1 { compatible = "mediatek,eth-mac"; reg = <1>; @@ -160,133 +98,16 @@ nvmem-cells = <&macaddr_bdinfo_de00 1>; label = "wan"; }; - }; &mdio_bus { - switch: switch@1f { - 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>; - }; + phy6: ethernet-phy@6 { compatible = "ethernet-phy-ieee802.3-c45"; reg = <6>; - phy-mode = "2500base-x"; - }; - -}; - -&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-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 = <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>; - }; - }; - }; - - partition@380000 { - label = "bdinfo"; - reg = <0x380000 0x0040000>; - 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@3C0000 { - label = "FIP"; - reg = <0x3C0000 0x0200000>; - read-only; - }; - - partition@580000 { - label = "ubi"; - reg = <0x5C0000 0x4000000>; - compatible = "linux,ubi"; - }; - }; - }; -}; - -&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 = ; - }; + reset-assert-us = <100000>; + reset-deassert-us = <100000>; + reset-gpios = <&pio 3 GPIO_ACTIVE_LOW>; }; }; @@ -330,8 +151,3 @@ }; }; -&wifi { - status = "okay"; - nvmem-cells = <&eeprom_factory_0>; - nvmem-cell-names = "eeprom"; -}; diff --git a/target/linux/mediatek/dts/mt7981b-cudy-wr3000s-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-wr3000s-v1.dts index bdc6188a4aedb9..ccf1821509bd7f 100644 --- a/target/linux/mediatek/dts/mt7981b-cudy-wr3000s-v1.dts +++ b/target/linux/mediatek/dts/mt7981b-cudy-wr3000s-v1.dts @@ -2,9 +2,7 @@ /dts-v1/; -#include - -#include "mt7981.dtsi" +#include "mt7981b-cudy-wr3000-nand.dtsi" / { model = "Cudy WR3000S v1"; @@ -19,26 +17,6 @@ serial0 = &uart0; }; - 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"; @@ -76,158 +54,6 @@ }; }; -&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_bdinfo_de00 0>; - - fixed-link { - speed = <2500>; - full-duplex; - pause; - }; - }; -}; - -&mdio_bus { - switch: switch@1f { - 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: 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-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 = <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>; - }; - }; - }; - - partition@380000 { - label = "bdinfo"; - reg = <0x380000 0x0040000>; - 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@3c0000 { - label = "FIP"; - reg = <0x3c0000 0x0200000>; - read-only; - }; - - partition@5c0000 { - label = "ubi"; - reg = <0x5c0000 0x4000000>; - compatible = "linux,ubi"; - }; - }; - }; -}; - -&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 = ; - }; - }; -}; - &switch { ports { #address-cells = <1>; @@ -275,9 +101,3 @@ }; }; }; - -&wifi { - status = "okay"; - nvmem-cells = <&eeprom_factory_0>; - nvmem-cell-names = "eeprom"; -}; From f50551dd18318f2255da3ecd5de5cc1078201651 Mon Sep 17 00:00:00 2001 From: Roland Reinl Date: Fri, 25 Apr 2025 21:33:47 +0200 Subject: [PATCH 745/877] mediatek: filogic: add support for Cudy WR3000E v1 The WR3000E has the same board layout as the WR3000S. Differences: - Different flash chip - LEDs with red/blue colour intead of white Hardware: - MediaTek MT7981 WiSoC - 256MB DDR3 RAM - 128MB SPI-NAND (F50L1G41LB) - MediaTek MT7981 2x2 DBDC 802.11ax 2T2R (2.4 / 5) MAC Addresses in OEM firmware: - There is one on the label, e.g. AA:BB:CC:DD:EE:FF - WLAN (2.4G) uses the same as on the label - WLAN (5G) is the one on the label but - first byte (e.g. AA) + 2 - fourth byte (e.g. DD) - 0x40 - WAN is the one on the label + 1 - LAN is the one on the label MAC Addresses in OpenWrt: - Same handling as in WR3000s is used GPIO: - 2 Buttons (all low active): - WPS on GPIO 0 - Reset on GPIO 1 - 6 LEDs (all low active): - Power: Blue on GPIO 8, no red LED - WPS: Blue on GPIO 10, Red on GPIO 4 - Internet: Blue on GPIO 11, no red LED - LAN: Blue on GPIO 9, Red on GPIO 5 - WiFi 2.4G: Blue on GPIO 6, no red LED - WiFi 5G: Blue on GPIO 7, no red LED Disassembly: - Remove the 4 screws at the bottom of the case - Cover is clipped to the bottom part of the case with clips in the front and the back UART: - UART pins are accessible on the bottom of the board - The connector with the square shape is TX - Pins: [ ] TX, ( ) RX, ( ) GND, ( ) VCC - Settings: 115200 8N1 3.3V Migration to OpenWrt via OEM firmware: - There should be a migration image available from Cudy as soon as there is official OpenWrt support - Download the migration image via OEM web interface - After flashing, OpenWrt is accessible via 192.168.1.1 - Flash the official OpenWrt image Migration to OpenWrt using TFTP: - Connect UART as described above - Press the reset button while powering on the device - U-Boot will now try to load a recovery.bin via TFTP, this must be ignored - After detecting a timeout, the U-Boot console is available via UART - Set up a TFTP server on IP 192.168.1.88 and connect it to one of the LAN ports - Provide the initramfs image via TFTP as cudy3000e.bin - Run the following command in U-Boot: tftpboot 0x46000000 cudy3000e.bin; bootm 0x46000000 - OpenWrt initramfs image is now booting and accessible via 192.168.1.1 - Flash the sysupgrade image Revert back to OEM: - Set up a TFTP server on IP 192.168.1.88 and connect it to one of the LAN ports - Provide the Cudy firmware via TFTP as recovery.bin - Press the reset button while powering on the device - Recovery process will start now - After recovery is done, the OEM firmware is available at 192.168.10.1 again Signed-off-by: Roland Reinl Link: https://github.com/openwrt/openwrt/pull/18609 (cherry picked from commit 300335f1ffc6978c82ab76e0c8185d8a870156a8) Link: https://github.com/openwrt/openwrt/pull/19063 Signed-off-by: Hauke Mehrtens --- .../mediatek/dts/mt7981b-cudy-wr3000e-v1.dts | 120 ++++++++++++++++++ .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 1 + target/linux/mediatek/image/filogic.mk | 17 +++ 3 files changed, 138 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7981b-cudy-wr3000e-v1.dts diff --git a/target/linux/mediatek/dts/mt7981b-cudy-wr3000e-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-wr3000e-v1.dts new file mode 100644 index 00000000000000..7632e6d1a90f1a --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-cudy-wr3000e-v1.dts @@ -0,0 +1,120 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/dts-v1/; + +#include "mt7981b-cudy-wr3000-nand.dtsi" + +/ { + model = "Cudy WR3000E v1"; + compatible = "cudy,wr3000e-v1", "mediatek,mt7981"; + + aliases { + label-mac-device = &gmac0; + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + serial0 = &uart0; + }; + + leds { + compatible = "gpio-leds"; + + led_power: led-power { + function = LED_FUNCTION_POWER; + color = ; + gpios = <&pio 8 GPIO_ACTIVE_LOW>; + }; + + led-lan-1 { + function = LED_FUNCTION_LAN; + color = ; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + }; + + led-lan-2 { + function = LED_FUNCTION_LAN; + color = ; + gpios = <&pio 5 GPIO_ACTIVE_LOW>; + }; + + led-wan { + function = LED_FUNCTION_WAN_ONLINE; + color = ; + gpios = <&pio 11 GPIO_ACTIVE_LOW>; + }; + + led-wps-1 { + function = LED_FUNCTION_WPS; + color = ; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + }; + + led-wps-2 { + function = LED_FUNCTION_WPS; + color = ; + gpios = <&pio 4 GPIO_ACTIVE_LOW>; + }; + + led-wlan2g { + function = LED_FUNCTION_WLAN_2GHZ; + color = ; + gpios = <&pio 6 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + led-wlan5g { + function = LED_FUNCTION_WLAN_5GHZ; + color = ; + gpios = <&pio 7 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + }; +}; +&switch { + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "wan"; + + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_bdinfo_de00 1>; + }; + + 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@6 { + reg = <6>; + label = "cpu"; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; +}; 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 f798a194a8b101..01e943617a7cd6 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 @@ -79,6 +79,7 @@ case "$board" in cudy,m3000-v1|\ cudy,re3000-v1|\ cudy,tr3000-v1|\ + cudy,wr3000e-v1|\ cudy,wr3000s-v1|\ cudy,wr3000h-v1|\ cudy,wr3000-v1) diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index a66502ca331db4..f1d2a40a17792c 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -756,6 +756,23 @@ define Device/cudy_wr3000-v1 endef TARGET_DEVICES += cudy_wr3000-v1 +define Device/cudy_wr3000e-v1 + DEVICE_VENDOR := Cudy + DEVICE_MODEL := WR3000E + DEVICE_VARIANT := v1 + DEVICE_DTS := mt7981b-cudy-wr3000e-v1 + DEVICE_DTS_DIR := ../dts + SUPPORTED_DEVICES += R53 + 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-mt7915e kmod-mt7981-firmware mt7981-wo-firmware +endef +TARGET_DEVICES += cudy_wr3000e-v1 + define Device/cudy_wr3000s-v1 DEVICE_VENDOR := Cudy DEVICE_MODEL := WR3000S From 989b12999c5b7c35ec310d26ac6f01eb9567be6e Mon Sep 17 00:00:00 2001 From: Josef Schlehofer Date: Fri, 13 Jun 2025 16:32:45 +0200 Subject: [PATCH 746/877] perf: disable slang support libs/slang2 is getting picked up from the packages feed, if the slang2 is compiled first and then if you try to compile perf, it fails due to unmet dependency. Fixes: Package perf is missing dependencies for the following libraries: libslang.so.2 Signed-off-by: Josef Schlehofer Link: https://github.com/openwrt/openwrt/pull/19123 (cherry picked from commit 764576eb5b6bae6c7142bd9e560f8c68da177b0d) Link: https://github.com/openwrt/openwrt/pull/19166 Signed-off-by: Hauke Mehrtens --- package/devel/perf/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/devel/perf/Makefile b/package/devel/perf/Makefile index 20be59516dad12..0129dc61186da0 100644 --- a/package/devel/perf/Makefile +++ b/package/devel/perf/Makefile @@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=perf PKG_VERSION:=$(LINUX_VERSION) -PKG_RELEASE:=5 +PKG_RELEASE:=6 PKG_BUILD_FLAGS:=no-mips16 no-lto PKG_BUILD_PARALLEL:=1 @@ -50,6 +50,7 @@ MAKE_FLAGS = \ NO_LZMA=1 \ NO_BACKTRACE=1 \ NO_LIBNUMA=1 \ + NO_SLANG=1 \ NO_GTK2=1 \ NO_LIBAUDIT=1 \ NO_LIBCRYPTO=1 \ From ba25b419134e4295cec45bd2d1040d469ad48340 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 20 Jun 2025 14:20:36 +0200 Subject: [PATCH 747/877] hostapd: fix dealing with mac address changes for the primary BSS Ensure that hapd->own_addr is set properly, since hostapd_setup_bss only handles it for secondary BSS interfaces Signed-off-by: Felix Fietkau (cherry picked from commit 3ebf11071159d8b2d238cfd19cadad85059fe7e3) --- 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 b13c0ff77c7fe0..758bb81ab27ce7 100644 --- a/package/network/services/hostapd/src/src/ap/ucode.c +++ b/package/network/services/hostapd/src/src/ap/ucode.c @@ -258,6 +258,9 @@ uc_hostapd_bss_set_config(uc_vm_t *vm, size_t nargs) hapd->conf = conf->bss[idx]; conf->bss[idx] = old_bss; + if (hapd == iface->bss[0]) + memcpy(hapd->own_addr, hapd->conf->bssid, ETH_ALEN); + hostapd_setup_bss(hapd, hapd == iface->bss[0], true); hostapd_ucode_update_interfaces(); hostapd_owe_update_trans(iface); From d848c2790d0263e2637d785f894589778dd38a60 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 20 Jun 2025 14:26:27 +0200 Subject: [PATCH 748/877] hostapd: fix generating own neighbor report for dynamically added/changed interfaces hostapd_neighbor_set_own_report is normally called from interface setup only. Signed-off-by: Felix Fietkau (cherry picked from commit 985005219020ac1446e28217bfdd7a0a7a7a59d0) --- 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 758bb81ab27ce7..3b1f052abcc1ea 100644 --- a/package/network/services/hostapd/src/src/ap/ucode.c +++ b/package/network/services/hostapd/src/src/ap/ucode.c @@ -10,6 +10,7 @@ #include "dfs.h" #include "acs.h" #include "ieee802_11_auth.h" +#include "neighbor_db.h" #include static uc_resource_type_t *global_type, *bss_type, *iface_type; @@ -262,6 +263,7 @@ uc_hostapd_bss_set_config(uc_vm_t *vm, size_t nargs) memcpy(hapd->own_addr, hapd->conf->bssid, ETH_ALEN); hostapd_setup_bss(hapd, hapd == iface->bss[0], true); + hostapd_neighbor_set_own_report(hapd); hostapd_ucode_update_interfaces(); hostapd_owe_update_trans(iface); @@ -387,6 +389,7 @@ uc_hostapd_iface_add_bss(uc_vm_t *vm, size_t nargs) iface->conf->bss[iface->conf->num_bss] = bss; conf->bss[idx] = NULL; ret = hostapd_ucode_bss_get_uval(hapd); + hostapd_neighbor_set_own_report(hapd); hostapd_ucode_update_interfaces(); hostapd_owe_update_trans(iface); goto out; From eee14dd6db37477d60836a8d1dcc604d483856f8 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Fri, 20 Jun 2025 23:43:01 +0200 Subject: [PATCH 749/877] wifi-scripts: add missing mesh_nolearn Add the missing mesh_nolearn option in order to make it work. Signed-off-by: David Bauer --- .../config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh index 059fd9b8c8a50d..6c3d3f38b46b95 100755 --- a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh +++ b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh @@ -12,7 +12,7 @@ MP_CONFIG_INT="mesh_retry_timeout mesh_confirm_timeout mesh_holding_timeout mesh 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" -MP_CONFIG_BOOL="mesh_auto_open_plinks mesh_fwding" +MP_CONFIG_BOOL="mesh_auto_open_plinks mesh_fwding mesh_nolearn" MP_CONFIG_STRING="mesh_power_mode" wdev_tool() { From 05d243637a8b0f2a328f2a999913d54d9c2d673e Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 21 Jun 2025 19:17:46 +0200 Subject: [PATCH 750/877] kernel: Fix IPv6 UDP fragmentation regression Fixes a IPv6 UDP fragmentation regression introduced in v6.6.93. Fixes: https://github.com/openwrt/openwrt/issues/19198 Link: https://github.com/openwrt/openwrt/pull/19199 (cherry picked from commit f62c33bc4a83b16de10a5113afebd625f9e27441) Link: https://github.com/openwrt/openwrt/pull/19201 Signed-off-by: Hauke Mehrtens --- ...50-Revert-ipv6-save-dontfrag-in-cork.patch | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 target/linux/generic/pending-6.6/650-Revert-ipv6-save-dontfrag-in-cork.patch diff --git a/target/linux/generic/pending-6.6/650-Revert-ipv6-save-dontfrag-in-cork.patch b/target/linux/generic/pending-6.6/650-Revert-ipv6-save-dontfrag-in-cork.patch new file mode 100644 index 00000000000000..18ef72ef583596 --- /dev/null +++ b/target/linux/generic/pending-6.6/650-Revert-ipv6-save-dontfrag-in-cork.patch @@ -0,0 +1,72 @@ +From 988e05f0c036c9c64f211b8b91a4a33c34db216a Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Sat, 21 Jun 2025 19:08:30 +0200 +Subject: [PATCH] Revert "ipv6: save dontfrag in cork" + +This reverts commit 8ebf2709fe4dcd0a1b7b95bf61e529ddcd3cdf51. + +This change breaks IPv6 UDP packet fragmentation. +See discussion: https://lore.kernel.org/stable/aFGl-mb--GOMY8ZQ@karahi.gladserv.com/ + +Signed-off-by: Hauke Mehrtens +--- + include/linux/ipv6.h | 1 - + net/ipv6/ip6_output.c | 9 ++++----- + 2 files changed, 4 insertions(+), 6 deletions(-) + +--- a/include/linux/ipv6.h ++++ b/include/linux/ipv6.h +@@ -199,7 +199,6 @@ struct inet6_cork { + struct ipv6_txoptions *opt; + u8 hop_limit; + u8 tclass; +- u8 dontfrag:1; + }; + + /* struct ipv6_pinfo - ipv6 private area */ +--- a/net/ipv6/ip6_output.c ++++ b/net/ipv6/ip6_output.c +@@ -1452,7 +1452,6 @@ static int ip6_setup_cork(struct sock *s + } + v6_cork->hop_limit = ipc6->hlimit; + v6_cork->tclass = ipc6->tclass; +- v6_cork->dontfrag = ipc6->dontfrag; + if (rt->dst.flags & DST_XFRM_TUNNEL) + mtu = np->pmtudisc >= IPV6_PMTUDISC_PROBE ? + READ_ONCE(rt->dst.dev->mtu) : dst_mtu(&rt->dst); +@@ -1486,7 +1485,7 @@ static int __ip6_append_data(struct sock + int getfrag(void *from, char *to, int offset, + int len, int odd, struct sk_buff *skb), + void *from, size_t length, int transhdrlen, +- unsigned int flags) ++ unsigned int flags, struct ipcm6_cookie *ipc6) + { + struct sk_buff *skb, *skb_prev = NULL; + struct inet_cork *cork = &cork_full->base; +@@ -1542,7 +1541,7 @@ static int __ip6_append_data(struct sock + if (headersize + transhdrlen > mtu) + goto emsgsize; + +- if (cork->length + length > mtu - headersize && v6_cork->dontfrag && ++ if (cork->length + length > mtu - headersize && ipc6->dontfrag && + (sk->sk_protocol == IPPROTO_UDP || + sk->sk_protocol == IPPROTO_ICMPV6 || + sk->sk_protocol == IPPROTO_RAW)) { +@@ -1914,7 +1913,7 @@ int ip6_append_data(struct sock *sk, + + return __ip6_append_data(sk, &sk->sk_write_queue, &inet->cork, + &np->cork, sk_page_frag(sk), getfrag, +- from, length, transhdrlen, flags); ++ from, length, transhdrlen, flags, ipc6); + } + EXPORT_SYMBOL_GPL(ip6_append_data); + +@@ -2119,7 +2118,7 @@ struct sk_buff *ip6_make_skb(struct sock + err = __ip6_append_data(sk, &queue, cork, &v6_cork, + ¤t->task_frag, getfrag, from, + length + exthdrlen, transhdrlen + exthdrlen, +- flags); ++ flags, ipc6); + if (err) { + __ip6_flush_pending_frames(sk, &queue, cork, &v6_cork); + return ERR_PTR(err); From 394697b7e4812c70bf8e886248c66939c22ca2d1 Mon Sep 17 00:00:00 2001 From: Christian Schmidbauer Date: Thu, 29 May 2025 11:00:10 +0200 Subject: [PATCH 751/877] ipq806x: fix Extreme Networks AP3935 LAN LED order Fixes LAN LED "1" to show activity of LAN1 and LAN LED "2" to show activity of LAN2, not vice versa. Signed-off-by: Christian Schmidbauer (cherry picked from commit f02e614f50f14be8244c2217392a317e046d8b01) --- target/linux/ipq806x/base-files/etc/board.d/01_leds | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ipq806x/base-files/etc/board.d/01_leds b/target/linux/ipq806x/base-files/etc/board.d/01_leds index c96d5e69c471d6..60988dec6b5d82 100644 --- a/target/linux/ipq806x/base-files/etc/board.d/01_leds +++ b/target/linux/ipq806x/base-files/etc/board.d/01_leds @@ -34,8 +34,8 @@ edgecore,ecw5410) ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wlan5g" "phy0tpt" ;; extreme,ap3935) - ucidef_set_led_netdev "wan" "wan" "orange:lan1" "eth1" - ucidef_set_led_netdev "lan" "lan" "orange:lan2" "eth0" + ucidef_set_led_netdev "wan" "wan" "orange:lan1" "eth0" + ucidef_set_led_netdev "lan" "lan" "orange:lan2" "eth1" ;; fortinet,fap-421e) ucidef_set_led_netdev "eth1-100" "ETH1-100" "amber:eth1" "eth0" "link_100" From 63064db76599ac0455c2f7cd6309d63c61112ae1 Mon Sep 17 00:00:00 2001 From: Christian Schmidbauer Date: Thu, 29 May 2025 13:45:10 +0200 Subject: [PATCH 752/877] ipq806x: fix Extreme Networks AP3935 LAN/WAN ports This commit changes LAN1 to be WAN and LAN2 to be LAN, like all other dual port Extreme Networks devices. This partially reverts commit 84a489b7cfc4c98b8747c9965826b2588eb3a57d Signed-off-by: Christian Schmidbauer (cherry picked from commit 710ec82367c847977ba748958fedcb4a93dd9311) --- target/linux/ipq806x/base-files/etc/board.d/02_network | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ipq806x/base-files/etc/board.d/02_network b/target/linux/ipq806x/base-files/etc/board.d/02_network index 43ee5ccd14b9c5..93ccc961f38130 100644 --- a/target/linux/ipq806x/base-files/etc/board.d/02_network +++ b/target/linux/ipq806x/base-files/etc/board.d/02_network @@ -47,7 +47,8 @@ ipq806x_setup_interfaces() ucidef_set_network_device_conduit "lan1" "eth1" ucidef_set_network_device_conduit "wan" "eth0" ;; - edgecore,ecw5410) + edgecore,ecw5410 |\ + extreme,ap3935) ucidef_set_interfaces_lan_wan "eth1" "eth0" ;; qcom,ipq8064-ap161) @@ -63,7 +64,6 @@ ipq806x_setup_interfaces() meraki,mr42) ucidef_set_interface_lan "eth0" ;; - extreme,ap3935 |\ meraki,mr52) ucidef_set_interfaces_lan_wan "eth0" "eth1" ;; From d9340319c6bb234638a9057f2fe0cc4aaf1f593e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Andr=C3=A9s=20P=C3=A9rez?= Date: Wed, 4 Jun 2025 00:21:34 +0200 Subject: [PATCH 753/877] ramips: mt7621: include uboot-envtools in some missed devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add uboot-envtools (removing -uboot-envtools) to devices which were missed in the commit 79bd017 ("ramips: mt7621: add uboot-envtools to all devices") - Mi Router 3G - Mi Router AC2100 While at here remove two redundant entries from devices which were added just after the referenced commit 79bd017 and did not account for the new DEFAULT_PACKAGES member: - SNR-CPE-ME1 - SNR-CPE-ME2-SFP Fixes: 79bd017 ("ramips: mt7621: add uboot-envtools to all devices") Fixes: https://github.com/openwrt/openwrt/issues/18960 Signed-off-by: Mario Andrés Pérez Link: https://github.com/openwrt/openwrt/pull/19012 (cherry picked from commit 6dffaf931675e70464f5cba98a1ccc707b0d784c) Link: https://github.com/openwrt/openwrt/pull/19213 Signed-off-by: Hauke Mehrtens --- target/linux/ramips/image/mt7621.mk | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 6f515ef61c8460..f6a05db8d31340 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -2540,14 +2540,14 @@ endef TARGET_DEVICES += sim_simax1800t define Device/snr_snr-cpe-me1 - $(Device/dsa-migration) - $(Device/uimage-lzma-loader) - IMAGE_SIZE := 15040k - DEVICE_VENDOR := SNR - DEVICE_MODEL := SNR-CPE-ME1 - UIMAGE_NAME := SNR-CPE-ME1-5GHZ-MT - DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x0e kmod-usb3 \ - kmod-usb-ledtrig-usbport uboot-envtools + $(Device/dsa-migration) + $(Device/uimage-lzma-loader) + IMAGE_SIZE := 15040k + DEVICE_VENDOR := SNR + DEVICE_MODEL := SNR-CPE-ME1 + UIMAGE_NAME := SNR-CPE-ME1-5GHZ-MT + DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x0e kmod-usb3 \ + kmod-usb-ledtrig-usbport endef TARGET_DEVICES += snr_snr-cpe-me1 @@ -2570,8 +2570,8 @@ define Device/snr_snr-cpe-me2-sfp DEVICE_VENDOR := SNR DEVICE_MODEL := SNR-CPE-ME2-SFP UIMAGE_NAME := $$(DEVICE_MODEL) - DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 \ - kmod-sfp kmod-usb-ledtrig-usbport uboot-envtools + DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 kmod-sfp \ + kmod-usb-ledtrig-usbport endef TARGET_DEVICES += snr_snr-cpe-me2-sfp @@ -3150,8 +3150,7 @@ define Device/xiaomi_mi-router-3g $(Device/xiaomi_nand_separate) DEVICE_MODEL := Mi Router 3G IMAGE_SIZE := 124416k - DEVICE_PACKAGES += kmod-mt7603 kmod-mt76x2 kmod-usb3 \ - kmod-usb-ledtrig-usbport -uboot-envtools + DEVICE_PACKAGES += kmod-mt7603 kmod-mt76x2 kmod-usb3 kmod-usb-ledtrig-usbport SUPPORTED_DEVICES += R3G mir3g xiaomi,mir3g endef TARGET_DEVICES += xiaomi_mi-router-3g @@ -3217,7 +3216,7 @@ define Device/xiaomi_mi-router-ac2100 $(Device/xiaomi_nand_separate) DEVICE_MODEL := Mi Router AC2100 IMAGE_SIZE := 120320k - DEVICE_PACKAGES += kmod-mt7603 kmod-mt7615-firmware -uboot-envtools + DEVICE_PACKAGES += kmod-mt7603 kmod-mt7615-firmware endef TARGET_DEVICES += xiaomi_mi-router-ac2100 From bb59922007043c0a0813d62b0d9f6e801caff9df Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Mon, 23 Jun 2025 23:32:07 +0200 Subject: [PATCH 754/877] OpenWrt v24.10.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 581de056c41e3e..90ccd1bba41a62 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git;openwrt-24.10 -src-git luci https://git.openwrt.org/project/luci.git;openwrt-24.10 -src-git routing https://git.openwrt.org/feed/routing.git;openwrt-24.10 -src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-24.10 +src-git packages https://git.openwrt.org/feed/packages.git^c7d1a8c1ae976bd0ad94a351d82ee8fbf16a81f0 +src-git luci https://git.openwrt.org/project/luci.git^d6b13f648339273facc07b173546ace459c1cabe +src-git routing https://git.openwrt.org/feed/routing.git^85d040f28c21c116c905aa15a66255dde80336e7 +src-git telephony https://git.openwrt.org/feed/telephony.git^2a4541d46199ac96fac214d02c908402831c4dc6 diff --git a/include/version.mk b/include/version.mk index a6ebe587797707..bdbcb36f13dfc0 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),24.10-SNAPSHOT) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),24.10.2) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION)) +VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r28739-d9340319c6) VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO)) -VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/24.10-SNAPSHOT) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/24.10.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 80db993d46b837..e86edd7c8ecc2e 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/24.10-SNAPSHOT" + default "https://downloads.openwrt.org/releases/24.10.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..ba758570dbe097 --- /dev/null +++ b/version @@ -0,0 +1 @@ +r28739-d9340319c6 diff --git a/version.date b/version.date new file mode 100644 index 00000000000000..3e4478798d71f9 --- /dev/null +++ b/version.date @@ -0,0 +1 @@ +1750711236 From 5ff7149a08df0a5f408ceb48c1b0ca2a40b49b3e Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Mon, 23 Jun 2025 23:32:10 +0200 Subject: [PATCH 755/877] OpenWrt v24.10.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 90ccd1bba41a62..581de056c41e3e 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git^c7d1a8c1ae976bd0ad94a351d82ee8fbf16a81f0 -src-git luci https://git.openwrt.org/project/luci.git^d6b13f648339273facc07b173546ace459c1cabe -src-git routing https://git.openwrt.org/feed/routing.git^85d040f28c21c116c905aa15a66255dde80336e7 -src-git telephony https://git.openwrt.org/feed/telephony.git^2a4541d46199ac96fac214d02c908402831c4dc6 +src-git packages https://git.openwrt.org/feed/packages.git;openwrt-24.10 +src-git luci https://git.openwrt.org/project/luci.git;openwrt-24.10 +src-git routing https://git.openwrt.org/feed/routing.git;openwrt-24.10 +src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-24.10 diff --git a/include/version.mk b/include/version.mk index bdbcb36f13dfc0..a6ebe587797707 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),24.10.2) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),24.10-SNAPSHOT) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r28739-d9340319c6) +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/24.10.2) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/24.10-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 e86edd7c8ecc2e..80db993d46b837 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/24.10.2" + default "https://downloads.openwrt.org/releases/24.10-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 ba758570dbe097..00000000000000 --- a/version +++ /dev/null @@ -1 +0,0 @@ -r28739-d9340319c6 diff --git a/version.date b/version.date deleted file mode 100644 index 3e4478798d71f9..00000000000000 --- a/version.date +++ /dev/null @@ -1 +0,0 @@ -1750711236 From 7bf3b29a5650495d3777292eeb4f13f34837e10d Mon Sep 17 00:00:00 2001 From: Tim Harvey Date: Thu, 19 Jun 2025 16:58:11 -0700 Subject: [PATCH 756/877] imx: kernel: backport additional upstream patches Backport some additional upstream patches to resolves some issues when using dt overlays on gw72xx-0x and gw73xx-0x: - 6.13-arm64-dts-imx8mm-venice-gw73xx-remove-compatible-in-overlay-files.patch - 6.12-arm64-dts-imx8mm-venice-gw72xx-remove-compatible-in-overlay-files.patch Signed-off-by: Tim Harvey Link: https://github.com/openwrt/openwrt/pull/19218 Signed-off-by: Robert Marko --- ...x-remove-compatible-in-overlay-files.patch | 56 +++++++++++++++++ ...x-remove-compatible-in-overlay-files.patch | 60 +++++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 target/linux/imx/patches-6.6/505-6.13-arm64-dts-imx8mm-venice-gw73xx-remove-compatible-in-overlay-files.patch create mode 100644 target/linux/imx/patches-6.6/506-6.12-arm64-dts-imx8mm-venice-gw72xx-remove-compatible-in-overlay-files.patch diff --git a/target/linux/imx/patches-6.6/505-6.13-arm64-dts-imx8mm-venice-gw73xx-remove-compatible-in-overlay-files.patch b/target/linux/imx/patches-6.6/505-6.13-arm64-dts-imx8mm-venice-gw73xx-remove-compatible-in-overlay-files.patch new file mode 100644 index 00000000000000..52b673e9b55385 --- /dev/null +++ b/target/linux/imx/patches-6.6/505-6.13-arm64-dts-imx8mm-venice-gw73xx-remove-compatible-in-overlay-files.patch @@ -0,0 +1,56 @@ +From d3fdc7ae2ca9cb93d634e84a2b90ebf340d6e622 Mon Sep 17 00:00:00 2001 +From: Frank Li +Date: Fri, 18 Oct 2024 14:28:23 -0400 +Subject: [PATCH] arm64: dts: imx8mm-venice-gw73xx: remove compatible in + overlay file + +Remove compatible string in overlay file to fix below warning: +'gw,imx8mm-gw73xx-0x' is not one of ['fsl,ls1043a-rdb', 'fsl,ls1043a-qds'] + +Signed-off-by: Frank Li +Signed-off-by: Shawn Guo +--- + .../boot/dts/freescale/imx8mm-venice-gw73xx-0x-rs232-rts.dtso | 4 ---- + .../boot/dts/freescale/imx8mm-venice-gw73xx-0x-rs422.dtso | 4 ---- + .../boot/dts/freescale/imx8mm-venice-gw73xx-0x-rs485.dtso | 4 ---- + 3 files changed, 12 deletions(-) + +--- a/arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-rs232-rts.dtso ++++ b/arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-rs232-rts.dtso +@@ -15,10 +15,6 @@ + /dts-v1/; + /plugin/; + +-&{/} { +- compatible = "gw,imx8mm-gw73xx-0x"; +-}; +- + &gpio4 { + rs485_en { + gpio-hog; +--- a/arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-rs422.dtso ++++ b/arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-rs422.dtso +@@ -18,10 +18,6 @@ + /dts-v1/; + /plugin/; + +-&{/} { +- compatible = "gw,imx8mm-gw73xx-0x"; +-}; +- + &gpio4 { + rs485_en { + gpio-hog; +--- a/arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-rs485.dtso ++++ b/arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-rs485.dtso +@@ -18,10 +18,6 @@ + /dts-v1/; + /plugin/; + +-&{/} { +- compatible = "gw,imx8mm-gw73xx-0x"; +-}; +- + &gpio4 { + rs485_en { + gpio-hog; diff --git a/target/linux/imx/patches-6.6/506-6.12-arm64-dts-imx8mm-venice-gw72xx-remove-compatible-in-overlay-files.patch b/target/linux/imx/patches-6.6/506-6.12-arm64-dts-imx8mm-venice-gw72xx-remove-compatible-in-overlay-files.patch new file mode 100644 index 00000000000000..bd88e35260510b --- /dev/null +++ b/target/linux/imx/patches-6.6/506-6.12-arm64-dts-imx8mm-venice-gw72xx-remove-compatible-in-overlay-files.patch @@ -0,0 +1,60 @@ +From f384d2828f0d5be67fcd69a7c4756f82465a7f2a Mon Sep 17 00:00:00 2001 +From: Fabio Estevam +Date: Mon, 1 Jul 2024 20:12:29 -0300 +Subject: [PATCH] arm64: dts: imx8mm-venice-gw72xx-0x: Remove compatible from + dtso + +There is no need to describe the compatible string inside +a dtso file. + +dt-schema produces super verbose warnings about that. + +Signed-off-by: Fabio Estevam +Acked-by: Parthiban Nallathambi +Acked-by: Tim Harvey +Signed-off-by: Shawn Guo +--- + .../boot/dts/freescale/imx8mm-venice-gw72xx-0x-rs232-rts.dtso | 4 ---- + .../boot/dts/freescale/imx8mm-venice-gw72xx-0x-rs422.dtso | 4 ---- + .../boot/dts/freescale/imx8mm-venice-gw72xx-0x-rs485.dtso | 4 ---- + 3 files changed, 12 deletions(-) + +--- a/arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-rs232-rts.dtso ++++ b/arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-rs232-rts.dtso +@@ -15,10 +15,6 @@ + /dts-v1/; + /plugin/; + +-&{/} { +- compatible = "gw,imx8mm-gw72xx-0x"; +-}; +- + &gpio4 { + rs485_en { + gpio-hog; +--- a/arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-rs422.dtso ++++ b/arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-rs422.dtso +@@ -18,10 +18,6 @@ + /dts-v1/; + /plugin/; + +-&{/} { +- compatible = "gw,imx8mm-gw72xx-0x"; +-}; +- + &gpio4 { + rs485_en { + gpio-hog; +--- a/arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-rs485.dtso ++++ b/arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-rs485.dtso +@@ -18,10 +18,6 @@ + /dts-v1/; + /plugin/; + +-&{/} { +- compatible = "gw,imx8mm-gw72xx-0x"; +-}; +- + &gpio4 { + rs485_en { + gpio-hog; From fa34d9c5112fe27c126900d741786d1ac1039f5f Mon Sep 17 00:00:00 2001 From: Tim Harvey Date: Thu, 19 Jun 2025 14:32:11 -0700 Subject: [PATCH 757/877] imx: venice: add dt overlay support Enable DT overlay support: - add dt-overlay to board features - add DEVICE_DTS_OVERLAYS - update the boot script to resize before applying each overlay Signed-off-by: Tim Harvey Link: https://github.com/openwrt/openwrt/pull/19218 Signed-off-by: Robert Marko --- target/linux/imx/cortexa53/target.mk | 1 + target/linux/imx/image/bootscript-gateworks_venice | 2 +- target/linux/imx/image/cortexa53.mk | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/target/linux/imx/cortexa53/target.mk b/target/linux/imx/cortexa53/target.mk index b9b32d18290550..cf1791b92c18c3 100644 --- a/target/linux/imx/cortexa53/target.mk +++ b/target/linux/imx/cortexa53/target.mk @@ -2,6 +2,7 @@ ARCH:=aarch64 BOARDNAME:=NXP i.MX with Cortex-A53 (ARM64) CPU_TYPE:=cortex-a53 KERNELNAME:=Image dtbs +FEATURES+=dt-overlay define Target/Description Build firmware images for NXP i.MX (Cortex-A53) based boards. diff --git a/target/linux/imx/image/bootscript-gateworks_venice b/target/linux/imx/image/bootscript-gateworks_venice index 062947f27bed8b..3f87bae50b9ef0 100644 --- a/target/linux/imx/image/bootscript-gateworks_venice +++ b/target/linux/imx/image/bootscript-gateworks_venice @@ -29,7 +29,7 @@ echo "loading DTB..." setenv fdt_addr setenv fdt_list $fdt_file $fdt_file1 $fdt_file2 $fdt_file3 $fdt_file4 $fdt_file5 setenv load_fdt 'echo Loading $fdt...; load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix}${fdt} && setenv fdt_addr ${fdt_addr_r}' -setenv apply_overlays 'fdt addr $fdt_addr_r && fdt resize && for fdt in "$fdt_overlays"; do load ${devtype} ${devnum}:${distro_bootpart} $loadaddr $prefix/$fdt && fdt apply $loadaddr && echo applied $prefix/$fdt; done' +setenv apply_overlays 'fdt addr $fdt_addr_r && for fdt in "$fdt_overlays"; do load ${devtype} ${devnum}:${distro_bootpart} $loadaddr $prefix/$fdt && fdt resize $filesize && fdt apply $loadaddr && echo applied $prefix/$fdt; done' for fdt in ${fdt_list}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${fdt}; then run load_fdt; fi; done if test -z "$fdt_addr"; then echo "Warning: Using bootloader DTB"; setenv fdt_addr $fdtcontroladdr; fi if test -n "$fdt_overlays"; then echo "Applying overlays"; run apply_overlays; fi diff --git a/target/linux/imx/image/cortexa53.mk b/target/linux/imx/image/cortexa53.mk index ec3623e8e70b93..e618e3ee0a7f0f 100644 --- a/target/linux/imx/image/cortexa53.mk +++ b/target/linux/imx/image/cortexa53.mk @@ -8,6 +8,7 @@ define Build/boot-img-ext4 rm -fR $@.boot mkdir -p $@.boot $(foreach dts,$(DEVICE_DTS), $(CP) $(KDIR)/image-$(dts).dtb $@.boot/$(dts).dtb;) + $(foreach dtbo,$(DEVICE_DTS_OVERLAY), $(CP) $(KDIR)/image-$(dtbo).dtbo $@.boot/$(dtbo).dtbo;) $(CP) $(IMAGE_KERNEL) $@.boot/$(KERNEL_NAME) -$(CP) $@-boot.scr $@.boot/boot.scr make_ext4fs -J -L kernel -l $(CONFIG_TARGET_KERNEL_PARTSIZE)M \ @@ -64,6 +65,7 @@ define Device/gateworks_venice BOOT_SCRIPT := gateworks_venice PARTITION_OFFSET := 16M DEVICE_DTS := $(basename $(notdir $(wildcard $(DTS_DIR)/freescale/imx8m*-venice*.dts))) + DEVICE_DTS_OVERLAY := $(basename $(notdir $(wildcard $(DTS_DIR)/freescale/imx8m*-venice*.dtso))) DEVICE_PACKAGES := \ kmod-hwmon-gsc kmod-rtc-ds1672 kmod-eeprom-at24 \ kmod-gpio-button-hotplug kmod-leds-gpio kmod-pps-gpio \ From 009aad8a02f1dbd70f0829d9d3f8b157be0b0c4e Mon Sep 17 00:00:00 2001 From: Tim Harvey Date: Thu, 19 Jun 2025 14:34:34 -0700 Subject: [PATCH 758/877] imx: venice: disable PCI AER As a workaround to an issue causing hang during PCI enumeration on imx8mp with a specific PCI switch, disable PCI AER. Signed-off-by: Tim Harvey Link: https://github.com/openwrt/openwrt/pull/19218 Signed-off-by: Robert Marko --- target/linux/imx/image/bootscript-gateworks_venice | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/imx/image/bootscript-gateworks_venice b/target/linux/imx/image/bootscript-gateworks_venice index 3f87bae50b9ef0..fceed130afea48 100644 --- a/target/linux/imx/image/bootscript-gateworks_venice +++ b/target/linux/imx/image/bootscript-gateworks_venice @@ -22,7 +22,7 @@ echo "Gateworks Venice OpenWrt Boot script v1.0" # partition, therefore we add 1 to the current partition setexpr rootpart ${distro_bootpart} + 1 # root on 'next' partition part uuid ${devtype} ${devnum}:${rootpart} uuid -setenv bootargs ${bootargs} console=${console} root=PARTUUID=${uuid} rootfstype=squashfs,ext4,f2fs rootwait +setenv bootargs ${bootargs} console=${console} root=PARTUUID=${uuid} rootfstype=squashfs,ext4,f2fs rootwait pci=noaer # load dtb (we try fdt_file and then fdt_file{1,2,3,4,5}) echo "loading DTB..." From 2f4005970848c3c832efecf2254f3ed2e24072c7 Mon Sep 17 00:00:00 2001 From: John Audia Date: Thu, 19 Jun 2025 10:59:11 -0400 Subject: [PATCH 759/877] kernel: bump 6.6 to 6.6.94 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.94 Removed upstreamed: generic/backport-6.6/421-01-v6.16-spi-bcm63xx-spi-fix-shared-reset.patch[1] generic/backport-6.6/421-02-v6.16-spi-bcm63xx-hsspi-fix-shared-reset.patch[2] generic/backport-6.6/725-01-v6.16-net-dsa-tag_brcm-legacy-fix-pskb_may_pull-length.patch[3] mvebu/patches-6.6/0001-v6.16-pinctrl-armada-37xx-use-correct-OUTPUT_VAL-register-.patch[4] mvebu/patches-6.6/0002-v6.16-pinctrl-armada-37xx-set-GPIO-output-value-before-set.patch[5] Added new back-port: generic/backport-6.6/001-powerpc-kernel-Fix-pcc_save_regs-inclusion.patch[6] Manually refresh: bcm27xx/patches-6.6/950-0624-drm-vc4-tests-Drop-drm-parameter-for-vc4_find_crtc_f.patch All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.94&id=29abb7fc82443bee273ba4623ce319bf7ba1d43d 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.94&id=59d5f3134b5c265df233b7f385bbe718191411be 3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.94&id=2e02edb66427e3b8752e1f3dd3cfc1bef3f2357b 4. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.94&id=39ed85ae485d991ffb24d25629a679c0b22e2d8f 5. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.94&id=8f0f45a312151a52aae920a091ea4b454ac97caf 6. Addresses a build failure for pcc Build system: x86/64 Build-tested: flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3, x86/64 Run-tested: flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3, x86/64 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/19183 (cherry picked from commit 836a4cc6d3c720d08a4b6f4c39534e6d9de34379) Signed-off-by: Goetz Goerisch Link: https://github.com/openwrt/openwrt/pull/19209 Signed-off-by: Hauke Mehrtens --- include/kernel-6.6 | 4 +- ...fault-mouse-polling-interval-to-60Hz.patch | 2 +- ...fixup_endpoint-after-mangling-interv.patch | 2 +- ...ci_sync-Add-fallback-bd-address-prop.patch | 4 +- ...0567-drivers-iommu-Add-BCM2712-IOMMU.patch | 2 +- ...op-drm-parameter-for-vc4_find_crtc_f.patch | 20 +++---- ...c4-tests-Return-the-allocated-output.patch | 2 +- ...m2712-don-t-allow-building-as-module.patch | 2 +- ...th-hci_sync-Fix-crash-on-NULL-parent.patch | 2 +- ...-an-RP1-firmware-interface-over-mbox.patch | 2 +- ...c-kernel-Fix-pcc_save_regs-inclusion.patch | 42 ++++++++++++++ ....16-spi-bcm63xx-spi-fix-shared-reset.patch | 32 ---------- ...6-spi-bcm63xx-hsspi-fix-shared-reset.patch | 32 ---------- ...ansmit-from-devices-with-no-checksum.patch | 2 +- ...-software-USO-if-IPv6-extension-head.patch | 2 +- ...HY-package-API-to-support-multiple-g.patch | 4 +- ...pport-for-PHY-package-MMD-read-write.patch | 2 +- ...-add-devm-of_phy_package_join-helper.patch | 2 +- ...whether-link-has-changed-in-c37_read.patch | 6 +- ...brcm-legacy-fix-pskb_may_pull-length.patch | 31 ---------- ...et-stmmac-improve-TX-timer-arm-logic.patch | 2 +- ...c-move-TX-timer-arm-after-DMA-enable.patch | 16 ++--- ...-support-for-PHY-LEDs-polarity-modes.patch | 8 +-- ...rt-active-high-property-for-PHY-LEDs.patch | 4 +- ...680-net-add-TCP-fraglist-GRO-support.patch | 2 +- ...detach-callback-to-struct-phy_driver.patch | 8 +-- ...-negotiation-of-in-band-capabilities.patch | 6 +- ...7xx-use-correct-OUTPUT_VAL-register-.patch | 44 -------------- ...7xx-set-GPIO-output-value-before-set.patch | 58 ------------------- ...fix-serdes-init-sequence-for-IPQ6018.patch | 2 +- ...nclude-linux-add-phy-ops-for-rtl838x.patch | 2 +- .../1009-net-stmmac-use-GFP_DMA32.patch | 4 +- 32 files changed, 99 insertions(+), 254 deletions(-) create mode 100644 target/linux/generic/backport-6.6/001-powerpc-kernel-Fix-pcc_save_regs-inclusion.patch delete mode 100644 target/linux/generic/backport-6.6/421-01-v6.16-spi-bcm63xx-spi-fix-shared-reset.patch delete mode 100644 target/linux/generic/backport-6.6/421-02-v6.16-spi-bcm63xx-hsspi-fix-shared-reset.patch delete mode 100644 target/linux/generic/backport-6.6/725-01-v6.16-net-dsa-tag_brcm-legacy-fix-pskb_may_pull-length.patch delete mode 100644 target/linux/mvebu/patches-6.6/0001-v6.16-pinctrl-armada-37xx-use-correct-OUTPUT_VAL-register-.patch delete mode 100644 target/linux/mvebu/patches-6.6/0002-v6.16-pinctrl-armada-37xx-set-GPIO-output-value-before-set.patch diff --git a/include/kernel-6.6 b/include/kernel-6.6 index c39b5c102aa5b3..a2e954d0020bad 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .93 -LINUX_KERNEL_HASH-6.6.93 = 0d79ff359635e9f009f1e330deed5f3aefd8c452b80660bffdc504b877797719 +LINUX_VERSION-6.6 = .94 +LINUX_KERNEL_HASH-6.6.94 = 713981ea26b20b476ba4ce880b76b21294576788d5db1c2188b167bcb06ecc56 diff --git a/target/linux/bcm27xx/patches-6.6/950-0121-hid-Reduce-default-mouse-polling-interval-to-60Hz.patch b/target/linux/bcm27xx/patches-6.6/950-0121-hid-Reduce-default-mouse-polling-interval-to-60Hz.patch index c3563ba402c85b..1584a946c533d6 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0121-hid-Reduce-default-mouse-polling-interval-to-60Hz.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0121-hid-Reduce-default-mouse-polling-interval-to-60Hz.patch @@ -19,7 +19,7 @@ Reduces overhead when using X module_param_named(mousepoll, hid_mousepoll_interval, uint, 0644); MODULE_PARM_DESC(mousepoll, "Polling interval of mice"); -@@ -1112,7 +1112,9 @@ static int usbhid_start(struct hid_devic +@@ -1115,7 +1115,9 @@ static int usbhid_start(struct hid_devic */ switch (hid->collection->usage) { case HID_GD_MOUSE: diff --git a/target/linux/bcm27xx/patches-6.6/950-0164-usbhid-call-usb_fixup_endpoint-after-mangling-interv.patch b/target/linux/bcm27xx/patches-6.6/950-0164-usbhid-call-usb_fixup_endpoint-after-mangling-interv.patch index 3755d9116996ea..2f14a56f8e48fc 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0164-usbhid-call-usb_fixup_endpoint-after-mangling-interv.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0164-usbhid-call-usb_fixup_endpoint-after-mangling-interv.patch @@ -13,7 +13,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c -@@ -1126,6 +1126,7 @@ static int usbhid_start(struct hid_devic +@@ -1129,6 +1129,7 @@ static int usbhid_start(struct hid_devic interval = hid_kbpoll_interval; break; } diff --git a/target/linux/bcm27xx/patches-6.6/950-0441-Bluetooth-hci_sync-Add-fallback-bd-address-prop.patch b/target/linux/bcm27xx/patches-6.6/950-0441-Bluetooth-hci_sync-Add-fallback-bd-address-prop.patch index b9d1a95c6d14c6..20cfa48ea47498 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0441-Bluetooth-hci_sync-Add-fallback-bd-address-prop.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0441-Bluetooth-hci_sync-Add-fallback-bd-address-prop.patch @@ -20,7 +20,7 @@ Signed-off-by: Phil Elwell --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c -@@ -4873,6 +4873,7 @@ static const struct { +@@ -4883,6 +4883,7 @@ static const struct { */ static int hci_dev_setup_sync(struct hci_dev *hdev) { @@ -28,7 +28,7 @@ Signed-off-by: Phil Elwell int ret = 0; bool invalid_bdaddr; size_t i; -@@ -4901,7 +4902,8 @@ static int hci_dev_setup_sync(struct hci +@@ -4911,7 +4912,8 @@ static int hci_dev_setup_sync(struct hci test_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks); if (!ret) { if (test_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks) && diff --git a/target/linux/bcm27xx/patches-6.6/950-0567-drivers-iommu-Add-BCM2712-IOMMU.patch b/target/linux/bcm27xx/patches-6.6/950-0567-drivers-iommu-Add-BCM2712-IOMMU.patch index 853224b71b02b1..d4fa6244f5f9ce 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0567-drivers-iommu-Add-BCM2712-IOMMU.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0567-drivers-iommu-Add-BCM2712-IOMMU.patch @@ -31,7 +31,7 @@ Signed-off-by: Nick Hollinghurst --- a/drivers/iommu/Kconfig +++ b/drivers/iommu/Kconfig -@@ -494,4 +494,11 @@ config SPRD_IOMMU +@@ -493,4 +493,11 @@ config SPRD_IOMMU Say Y here if you want to use the multimedia devices listed above. diff --git a/target/linux/bcm27xx/patches-6.6/950-0624-drm-vc4-tests-Drop-drm-parameter-for-vc4_find_crtc_f.patch b/target/linux/bcm27xx/patches-6.6/950-0624-drm-vc4-tests-Drop-drm-parameter-for-vc4_find_crtc_f.patch index 4c3046b0b8992e..ebc301871622c4 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0624-drm-vc4-tests-Drop-drm-parameter-for-vc4_find_crtc_f.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0624-drm-vc4-tests-Drop-drm-parameter-for-vc4_find_crtc_f.patch @@ -32,24 +32,24 @@ Signed-off-by: Maxime Ripard KUNIT_ASSERT_EQ(test, hweight32(encoder->possible_crtcs), 1); --- a/drivers/gpu/drm/vc4/tests/vc4_mock_output.c +++ b/drivers/gpu/drm/vc4/tests/vc4_mock_output.c -@@ -77,7 +77,7 @@ int vc4_mock_atomic_add_output(struct ku - encoder = vc4_find_encoder_by_type(drm, type); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, encoder); +@@ -78,7 +78,7 @@ int vc4_mock_atomic_add_output(struct ku + if (!encoder) + return -ENODEV; - crtc = vc4_find_crtc_for_encoder(test, drm, encoder); + crtc = vc4_find_crtc_for_encoder(test, encoder); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, crtc); + if (!crtc) + return -ENODEV; - output = encoder_to_vc4_dummy_output(encoder); -@@ -115,7 +115,7 @@ int vc4_mock_atomic_del_output(struct ku - encoder = vc4_find_encoder_by_type(drm, type); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, encoder); +@@ -122,7 +122,7 @@ int vc4_mock_atomic_del_output(struct ku + if (!encoder) + return -ENODEV; - crtc = vc4_find_crtc_for_encoder(test, drm, encoder); + crtc = vc4_find_crtc_for_encoder(test, encoder); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, crtc); + if (!crtc) + return -ENODEV; - crtc_state = drm_atomic_get_crtc_state(state, crtc); --- a/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c +++ b/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c @@ -131,7 +131,7 @@ get_vc4_crtc_state_for_encoder(struct ku diff --git a/target/linux/bcm27xx/patches-6.6/950-0625-drm-vc4-tests-Return-the-allocated-output.patch b/target/linux/bcm27xx/patches-6.6/950-0625-drm-vc4-tests-Return-the-allocated-output.patch index 50291da98f7bf8..023da29375fbcb 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0625-drm-vc4-tests-Return-the-allocated-output.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0625-drm-vc4-tests-Return-the-allocated-output.patch @@ -49,7 +49,7 @@ Signed-off-by: Maxime Ripard { struct drm_device *drm = state->dev; struct drm_connector_state *conn_state; -@@ -96,7 +97,7 @@ int vc4_mock_atomic_add_output(struct ku +@@ -102,7 +103,7 @@ int vc4_mock_atomic_add_output(struct ku crtc_state->active = true; diff --git a/target/linux/bcm27xx/patches-6.6/950-0867-iommu-bcm2712-don-t-allow-building-as-module.patch b/target/linux/bcm27xx/patches-6.6/950-0867-iommu-bcm2712-don-t-allow-building-as-module.patch index 36c7b844619bf3..f2bfb684440355 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0867-iommu-bcm2712-don-t-allow-building-as-module.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0867-iommu-bcm2712-don-t-allow-building-as-module.patch @@ -17,7 +17,7 @@ Signed-off-by: Ratchanan Srirattanamet --- a/drivers/iommu/Kconfig +++ b/drivers/iommu/Kconfig -@@ -495,7 +495,7 @@ config SPRD_IOMMU +@@ -494,7 +494,7 @@ config SPRD_IOMMU Say Y here if you want to use the multimedia devices listed above. config BCM2712_IOMMU diff --git a/target/linux/bcm27xx/patches-6.6/950-1218-Bluetooth-hci_sync-Fix-crash-on-NULL-parent.patch b/target/linux/bcm27xx/patches-6.6/950-1218-Bluetooth-hci_sync-Fix-crash-on-NULL-parent.patch index 6dfd31c70f8ea7..f5494ab1b88c68 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1218-Bluetooth-hci_sync-Fix-crash-on-NULL-parent.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1218-Bluetooth-hci_sync-Fix-crash-on-NULL-parent.patch @@ -15,7 +15,7 @@ Signed-off-by: Phil Elwell --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c -@@ -4873,7 +4873,8 @@ static const struct { +@@ -4883,7 +4883,8 @@ static const struct { */ static int hci_dev_setup_sync(struct hci_dev *hdev) { diff --git a/target/linux/bcm27xx/patches-6.6/950-1383-firmware-Add-an-RP1-firmware-interface-over-mbox.patch b/target/linux/bcm27xx/patches-6.6/950-1383-firmware-Add-an-RP1-firmware-interface-over-mbox.patch index 3a9eb03c94607f..87d3bdbe89afa5 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1383-firmware-Add-an-RP1-firmware-interface-over-mbox.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1383-firmware-Add-an-RP1-firmware-interface-over-mbox.patch @@ -18,7 +18,7 @@ Signed-off-by: Phil Elwell --- a/drivers/firmware/Kconfig +++ b/drivers/firmware/Kconfig -@@ -153,6 +153,15 @@ config RASPBERRYPI_FIRMWARE +@@ -152,6 +152,15 @@ config RASPBERRYPI_FIRMWARE This option enables support for communicating with the firmware on the Raspberry Pi. diff --git a/target/linux/generic/backport-6.6/001-powerpc-kernel-Fix-pcc_save_regs-inclusion.patch b/target/linux/generic/backport-6.6/001-powerpc-kernel-Fix-pcc_save_regs-inclusion.patch new file mode 100644 index 00000000000000..3d3515f5ab7f07 --- /dev/null +++ b/target/linux/generic/backport-6.6/001-powerpc-kernel-Fix-pcc_save_regs-inclusion.patch @@ -0,0 +1,42 @@ +From 93bd4a80efeb521314485a06d8c21157240497bb Mon Sep 17 00:00:00 2001 +From: Madhavan Srinivasan +Date: Sun, 11 May 2025 09:41:11 +0530 +Subject: powerpc/kernel: Fix ppc_save_regs inclusion in build + +Recent patch fixed an old commit +'fc2a5a6161a2 ("powerpc/64s: ppc_save_regs is now needed for all 64s builds")' +which is to include building of ppc_save_reg.c only when XMON +and KEXEC_CORE and PPC_BOOK3S are enabled. This was valid, since +ppc_save_regs was called only in replay_system_reset() of old +irq.c which was under BOOK3S. + +But there has been multiple refactoring of irq.c and have +added call to ppc_save_regs() from __replay_soft_interrupts +-> replay_soft_interrupts which is part of irq_64.c included +under CONFIG_PPC64. And since ppc_save_regs is called in +CRASH_DUMP path as part of crash_setup_regs in kexec.h, +CONFIG_PPC32 also needs it. + +So with this recent patch which enabled the building of +ppc_save_regs.c caused a build break when none of these +(XMON, KEXEC_CORE, BOOK3S) where enabled as part of config. +Patch to enable building of ppc_save_regs.c by defaults. + +Signed-off-by: Madhavan Srinivasan +Link: https://patch.msgid.link/20250511041111.841158-1-maddy@linux.ibm.com +--- + arch/powerpc/kernel/Makefile | 2 -- + 1 file changed, 2 deletions(-) + +--- a/arch/powerpc/kernel/Makefile ++++ b/arch/powerpc/kernel/Makefile +@@ -165,9 +165,7 @@ endif + + obj64-$(CONFIG_PPC_TRANSACTIONAL_MEM) += tm.o + +-ifneq ($(CONFIG_XMON)$(CONFIG_KEXEC_CORE)$(CONFIG_PPC_BOOK3S),) + obj-y += ppc_save_regs.o +-endif + + obj-$(CONFIG_EPAPR_PARAVIRT) += epapr_paravirt.o epapr_hcalls.o + obj-$(CONFIG_KVM_GUEST) += kvm.o kvm_emul.o diff --git a/target/linux/generic/backport-6.6/421-01-v6.16-spi-bcm63xx-spi-fix-shared-reset.patch b/target/linux/generic/backport-6.6/421-01-v6.16-spi-bcm63xx-spi-fix-shared-reset.patch deleted file mode 100644 index e886350d26d9a1..00000000000000 --- a/target/linux/generic/backport-6.6/421-01-v6.16-spi-bcm63xx-spi-fix-shared-reset.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 5ad20e3d8cfe3b2e42bbddc7e0ebaa74479bb589 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= -Date: Thu, 29 May 2025 15:09:14 +0200 -Subject: [PATCH] spi: bcm63xx-spi: fix shared reset -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Some bmips SoCs (bcm6362, bcm63268) share the same SPI reset for both SPI -and HSSPI controllers, so reset shouldn't be exclusive. - -Fixes: 38807adeaf1e ("spi: bcm63xx-spi: add reset support") -Reported-by: Jonas Gorski -Signed-off-by: Álvaro Fernández Rojas -Reviewed-by: Florian Fainelli -Link: https://patch.msgid.link/20250529130915.2519590-2-noltari@gmail.com -Signed-off-by: Mark Brown ---- - drivers/spi/spi-bcm63xx.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/spi/spi-bcm63xx.c -+++ b/drivers/spi/spi-bcm63xx.c -@@ -523,7 +523,7 @@ static int bcm63xx_spi_probe(struct plat - return PTR_ERR(clk); - } - -- reset = devm_reset_control_get_optional_exclusive(dev, NULL); -+ reset = devm_reset_control_get_optional_shared(dev, NULL); - if (IS_ERR(reset)) - return PTR_ERR(reset); - diff --git a/target/linux/generic/backport-6.6/421-02-v6.16-spi-bcm63xx-hsspi-fix-shared-reset.patch b/target/linux/generic/backport-6.6/421-02-v6.16-spi-bcm63xx-hsspi-fix-shared-reset.patch deleted file mode 100644 index 3c30269d079a59..00000000000000 --- a/target/linux/generic/backport-6.6/421-02-v6.16-spi-bcm63xx-hsspi-fix-shared-reset.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 3d6d84c8f2f66d3fd6a43a1e2ce8e6b54c573960 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= -Date: Thu, 29 May 2025 15:09:15 +0200 -Subject: [PATCH] spi: bcm63xx-hsspi: fix shared reset -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Some bmips SoCs (bcm6362, bcm63268) share the same SPI reset for both SPI -and HSSPI controllers, so reset shouldn't be exclusive. - -Fixes: 0eeadddbf09a ("spi: bcm63xx-hsspi: add reset support") -Reported-by: Jonas Gorski -Signed-off-by: Álvaro Fernández Rojas -Reviewed-by: Florian Fainelli -Link: https://patch.msgid.link/20250529130915.2519590-3-noltari@gmail.com -Signed-off-by: Mark Brown ---- - drivers/spi/spi-bcm63xx-hsspi.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/spi/spi-bcm63xx-hsspi.c -+++ b/drivers/spi/spi-bcm63xx-hsspi.c -@@ -745,7 +745,7 @@ static int bcm63xx_hsspi_probe(struct pl - if (IS_ERR(clk)) - return PTR_ERR(clk); - -- reset = devm_reset_control_get_optional_exclusive(dev, NULL); -+ reset = devm_reset_control_get_optional_shared(dev, NULL); - if (IS_ERR(reset)) - return PTR_ERR(reset); - diff --git a/target/linux/generic/backport-6.6/611-01-v6.11-udp-Allow-GSO-transmit-from-devices-with-no-checksum.patch b/target/linux/generic/backport-6.6/611-01-v6.11-udp-Allow-GSO-transmit-from-devices-with-no-checksum.patch index 4cafd27fdcd4bd..8edbce21685359 100644 --- a/target/linux/generic/backport-6.6/611-01-v6.11-udp-Allow-GSO-transmit-from-devices-with-no-checksum.patch +++ b/target/linux/generic/backport-6.6/611-01-v6.11-udp-Allow-GSO-transmit-from-devices-with-no-checksum.patch @@ -65,7 +65,7 @@ Signed-off-by: Jakub Kicinski } --- a/net/ipv4/udp_offload.c +++ b/net/ipv4/udp_offload.c -@@ -443,6 +443,14 @@ struct sk_buff *__udp_gso_segment(struct +@@ -448,6 +448,14 @@ struct sk_buff *__udp_gso_segment(struct else uh->check = gso_make_checksum(seg, ~check) ? : CSUM_MANGLED_0; diff --git a/target/linux/generic/backport-6.6/611-03-v6.11-udp-Fall-back-to-software-USO-if-IPv6-extension-head.patch b/target/linux/generic/backport-6.6/611-03-v6.11-udp-Fall-back-to-software-USO-if-IPv6-extension-head.patch index d3df5162ac68ed..2f75f5c3eea9f9 100644 --- a/target/linux/generic/backport-6.6/611-03-v6.11-udp-Fall-back-to-software-USO-if-IPv6-extension-head.patch +++ b/target/linux/generic/backport-6.6/611-03-v6.11-udp-Fall-back-to-software-USO-if-IPv6-extension-head.patch @@ -71,7 +71,7 @@ Signed-off-by: Jakub Kicinski --- a/net/ipv4/udp_offload.c +++ b/net/ipv4/udp_offload.c -@@ -342,6 +342,12 @@ struct sk_buff *__udp_gso_segment(struct +@@ -343,6 +343,12 @@ struct sk_buff *__udp_gso_segment(struct !(skb_shinfo(gso_skb)->gso_type & SKB_GSO_FRAGLIST))) return ERR_PTR(-EINVAL); diff --git a/target/linux/generic/backport-6.6/714-v6.8-02-net-phy-extend-PHY-package-API-to-support-multiple-g.patch b/target/linux/generic/backport-6.6/714-v6.8-02-net-phy-extend-PHY-package-API-to-support-multiple-g.patch index 68f855283eecbe..e7e3c8c75f656c 100644 --- a/target/linux/generic/backport-6.6/714-v6.8-02-net-phy-extend-PHY-package-API-to-support-multiple-g.patch +++ b/target/linux/generic/backport-6.6/714-v6.8-02-net-phy-extend-PHY-package-API-to-support-multiple-g.patch @@ -242,7 +242,7 @@ Signed-off-by: David S. Miller refcount_t refcnt; unsigned long flags; size_t priv_size; -@@ -1969,10 +1970,10 @@ int phy_ethtool_get_link_ksettings(struc +@@ -1966,10 +1967,10 @@ int phy_ethtool_get_link_ksettings(struc int phy_ethtool_set_link_ksettings(struct net_device *ndev, const struct ethtool_link_ksettings *cmd); int phy_ethtool_nway_reset(struct net_device *ndev); @@ -255,7 +255,7 @@ Signed-off-by: David S. Miller int __init mdio_bus_init(void); void mdio_bus_exit(void); -@@ -1995,46 +1996,65 @@ int __phy_hwtstamp_set(struct phy_device +@@ -1992,46 +1993,65 @@ int __phy_hwtstamp_set(struct phy_device struct kernel_hwtstamp_config *config, struct netlink_ext_ack *extack); diff --git a/target/linux/generic/backport-6.6/714-v6.8-04-net-phy-add-support-for-PHY-package-MMD-read-write.patch b/target/linux/generic/backport-6.6/714-v6.8-04-net-phy-add-support-for-PHY-package-MMD-read-write.patch index c20d2ec0c01b86..d42da1b71fef39 100644 --- a/target/linux/generic/backport-6.6/714-v6.8-04-net-phy-add-support-for-PHY-package-MMD-read-write.patch +++ b/target/linux/generic/backport-6.6/714-v6.8-04-net-phy-add-support-for-PHY-package-MMD-read-write.patch @@ -171,7 +171,7 @@ Signed-off-by: David S. Miller * @regnum: register number to modify --- a/include/linux/phy.h +++ b/include/linux/phy.h -@@ -2057,6 +2057,22 @@ static inline int __phy_package_write(st +@@ -2054,6 +2054,22 @@ static inline int __phy_package_write(st return __mdiobus_write(phydev->mdio.bus, addr, regnum, val); } diff --git a/target/linux/generic/backport-6.6/716-v6.9-03-net-phy-add-devm-of_phy_package_join-helper.patch b/target/linux/generic/backport-6.6/716-v6.9-03-net-phy-add-devm-of_phy_package_join-helper.patch index 25f6c5ccdad87e..1fdd91497b26b3 100644 --- a/target/linux/generic/backport-6.6/716-v6.9-03-net-phy-add-devm-of_phy_package_join-helper.patch +++ b/target/linux/generic/backport-6.6/716-v6.9-03-net-phy-add-devm-of_phy_package_join-helper.patch @@ -170,7 +170,7 @@ Signed-off-by: David S. Miller refcount_t refcnt; unsigned long flags; size_t priv_size; -@@ -1971,9 +1974,12 @@ int phy_ethtool_set_link_ksettings(struc +@@ -1968,9 +1971,12 @@ int phy_ethtool_set_link_ksettings(struc const struct ethtool_link_ksettings *cmd); int phy_ethtool_nway_reset(struct net_device *ndev); int phy_package_join(struct phy_device *phydev, int base_addr, size_t priv_size); diff --git a/target/linux/generic/backport-6.6/716-v6.9-06-net-phy-provide-whether-link-has-changed-in-c37_read.patch b/target/linux/generic/backport-6.6/716-v6.9-06-net-phy-provide-whether-link-has-changed-in-c37_read.patch index a96b9f1b6665e0..4bb44b921d45f3 100644 --- a/target/linux/generic/backport-6.6/716-v6.9-06-net-phy-provide-whether-link-has-changed-in-c37_read.patch +++ b/target/linux/generic/backport-6.6/716-v6.9-06-net-phy-provide-whether-link-has-changed-in-c37_read.patch @@ -41,7 +41,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c -@@ -2615,12 +2615,15 @@ EXPORT_SYMBOL(genphy_read_status); +@@ -2617,12 +2617,15 @@ EXPORT_SYMBOL(genphy_read_status); /** * genphy_c37_read_status - check the link status and update current link state * @phydev: target phy_device struct @@ -58,7 +58,7 @@ Signed-off-by: David S. Miller { int lpa, err, old_link = phydev->link; -@@ -2630,9 +2633,13 @@ int genphy_c37_read_status(struct phy_de +@@ -2632,9 +2635,13 @@ int genphy_c37_read_status(struct phy_de return err; /* why bother the PHY if nothing can have changed */ @@ -89,7 +89,7 @@ Signed-off-by: David S. Miller } --- a/include/linux/phy.h +++ b/include/linux/phy.h -@@ -1849,7 +1849,7 @@ int genphy_write_mmd_unsupported(struct +@@ -1846,7 +1846,7 @@ int genphy_write_mmd_unsupported(struct /* Clause 37 */ int genphy_c37_config_aneg(struct phy_device *phydev); diff --git a/target/linux/generic/backport-6.6/725-01-v6.16-net-dsa-tag_brcm-legacy-fix-pskb_may_pull-length.patch b/target/linux/generic/backport-6.6/725-01-v6.16-net-dsa-tag_brcm-legacy-fix-pskb_may_pull-length.patch deleted file mode 100644 index 9fa88d2d3f94d4..00000000000000 --- a/target/linux/generic/backport-6.6/725-01-v6.16-net-dsa-tag_brcm-legacy-fix-pskb_may_pull-length.patch +++ /dev/null @@ -1,31 +0,0 @@ -From efdddc4484859082da6c7877ed144c8121c8ea55 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= -Date: Thu, 29 May 2025 14:44:06 +0200 -Subject: [PATCH] net: dsa: tag_brcm: legacy: fix pskb_may_pull length -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -BRCM_LEG_PORT_ID was incorrectly used for pskb_may_pull length. -The correct check is BRCM_LEG_TAG_LEN + VLAN_HLEN, or 10 bytes. - -Fixes: 964dbf186eaa ("net: dsa: tag_brcm: add support for legacy tags") -Signed-off-by: Álvaro Fernández Rojas -Reviewed-by: Florian Fainelli -Link: https://patch.msgid.link/20250529124406.2513779-1-noltari@gmail.com -Signed-off-by: Jakub Kicinski ---- - net/dsa/tag_brcm.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/net/dsa/tag_brcm.c -+++ b/net/dsa/tag_brcm.c -@@ -257,7 +257,7 @@ static struct sk_buff *brcm_leg_tag_rcv( - int source_port; - u8 *brcm_tag; - -- if (unlikely(!pskb_may_pull(skb, BRCM_LEG_PORT_ID))) -+ if (unlikely(!pskb_may_pull(skb, BRCM_LEG_TAG_LEN + VLAN_HLEN))) - return NULL; - - brcm_tag = dsa_etype_header_pos_rx(skb); diff --git a/target/linux/generic/backport-6.6/771-v6.7-01-net-stmmac-improve-TX-timer-arm-logic.patch b/target/linux/generic/backport-6.6/771-v6.7-01-net-stmmac-improve-TX-timer-arm-logic.patch index a7da409aeb7809..38907ed05139bb 100644 --- a/target/linux/generic/backport-6.6/771-v6.7-01-net-stmmac-improve-TX-timer-arm-logic.patch +++ b/target/linux/generic/backport-6.6/771-v6.7-01-net-stmmac-improve-TX-timer-arm-logic.patch @@ -46,7 +46,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c -@@ -2988,13 +2988,25 @@ static void stmmac_tx_timer_arm(struct s +@@ -2993,13 +2993,25 @@ static void stmmac_tx_timer_arm(struct s { struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue]; u32 tx_coal_timer = priv->tx_coal_timer[queue]; diff --git a/target/linux/generic/backport-6.6/771-v6.7-02-net-stmmac-move-TX-timer-arm-after-DMA-enable.patch b/target/linux/generic/backport-6.6/771-v6.7-02-net-stmmac-move-TX-timer-arm-after-DMA-enable.patch index c1f2fa9589a8f0..c9fb4c17c20858 100644 --- a/target/linux/generic/backport-6.6/771-v6.7-02-net-stmmac-move-TX-timer-arm-after-DMA-enable.patch +++ b/target/linux/generic/backport-6.6/771-v6.7-02-net-stmmac-move-TX-timer-arm-after-DMA-enable.patch @@ -18,7 +18,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c -@@ -2536,9 +2536,13 @@ static void stmmac_bump_dma_threshold(st +@@ -2541,9 +2541,13 @@ static void stmmac_bump_dma_threshold(st * @priv: driver private structure * @budget: napi budget limiting this functions packet handling * @queue: TX queue index @@ -33,7 +33,7 @@ Signed-off-by: Paolo Abeni { struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue]; struct stmmac_txq_stats *txq_stats = &priv->xstats.txq_stats[queue]; -@@ -2698,7 +2702,7 @@ static int stmmac_tx_clean(struct stmmac +@@ -2703,7 +2707,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) @@ -42,7 +42,7 @@ Signed-off-by: Paolo Abeni u64_stats_update_begin(&txq_stats->napi_syncp); u64_stats_add(&txq_stats->napi.tx_packets, tx_packets); -@@ -5604,6 +5608,7 @@ static int stmmac_napi_poll_tx(struct na +@@ -5609,6 +5613,7 @@ static int stmmac_napi_poll_tx(struct na container_of(napi, struct stmmac_channel, tx_napi); struct stmmac_priv *priv = ch->priv_data; struct stmmac_txq_stats *txq_stats; @@ -50,7 +50,7 @@ Signed-off-by: Paolo Abeni u32 chan = ch->index; int work_done; -@@ -5612,7 +5617,7 @@ static int stmmac_napi_poll_tx(struct na +@@ -5617,7 +5622,7 @@ static int stmmac_napi_poll_tx(struct na u64_stats_inc(&txq_stats->napi.poll); u64_stats_update_end(&txq_stats->napi_syncp); @@ -59,7 +59,7 @@ Signed-off-by: Paolo Abeni work_done = min(work_done, budget); if (work_done < budget && napi_complete_done(napi, work_done)) { -@@ -5623,6 +5628,10 @@ static int stmmac_napi_poll_tx(struct na +@@ -5628,6 +5633,10 @@ static int stmmac_napi_poll_tx(struct na spin_unlock_irqrestore(&ch->lock, flags); } @@ -70,7 +70,7 @@ Signed-off-by: Paolo Abeni return work_done; } -@@ -5631,6 +5640,7 @@ static int stmmac_napi_poll_rxtx(struct +@@ -5636,6 +5645,7 @@ static int stmmac_napi_poll_rxtx(struct struct stmmac_channel *ch = container_of(napi, struct stmmac_channel, rxtx_napi); struct stmmac_priv *priv = ch->priv_data; @@ -78,7 +78,7 @@ Signed-off-by: Paolo Abeni int rx_done, tx_done, rxtx_done; struct stmmac_rxq_stats *rxq_stats; struct stmmac_txq_stats *txq_stats; -@@ -5646,7 +5656,7 @@ static int stmmac_napi_poll_rxtx(struct +@@ -5651,7 +5661,7 @@ static int stmmac_napi_poll_rxtx(struct u64_stats_inc(&txq_stats->napi.poll); u64_stats_update_end(&txq_stats->napi_syncp); @@ -87,7 +87,7 @@ Signed-off-by: Paolo Abeni tx_done = min(tx_done, budget); rx_done = stmmac_rx_zc(priv, budget, chan); -@@ -5671,6 +5681,10 @@ static int stmmac_napi_poll_rxtx(struct +@@ -5676,6 +5686,10 @@ static int stmmac_napi_poll_rxtx(struct spin_unlock_irqrestore(&ch->lock, flags); } diff --git a/target/linux/generic/backport-6.6/835-v6.9-net-phy-add-support-for-PHY-LEDs-polarity-modes.patch b/target/linux/generic/backport-6.6/835-v6.9-net-phy-add-support-for-PHY-LEDs-polarity-modes.patch index 1fe0e3f890cc5e..54932436c747c4 100644 --- a/target/linux/generic/backport-6.6/835-v6.9-net-phy-add-support-for-PHY-LEDs-polarity-modes.patch +++ b/target/linux/generic/backport-6.6/835-v6.9-net-phy-add-support-for-PHY-LEDs-polarity-modes.patch @@ -28,7 +28,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c -@@ -3202,6 +3202,7 @@ static int of_phy_led(struct phy_device +@@ -3204,6 +3204,7 @@ static int of_phy_led(struct phy_device struct device *dev = &phydev->mdio.dev; struct led_init_data init_data = {}; struct led_classdev *cdev; @@ -36,7 +36,7 @@ Signed-off-by: Jakub Kicinski struct phy_led *phyled; u32 index; int err; -@@ -3219,6 +3220,21 @@ static int of_phy_led(struct phy_device +@@ -3221,6 +3222,21 @@ static int of_phy_led(struct phy_device if (index > U8_MAX) return -EINVAL; @@ -60,7 +60,7 @@ Signed-off-by: Jakub Kicinski cdev->brightness_set_blocking = phy_led_set_brightness; --- a/include/linux/phy.h +++ b/include/linux/phy.h -@@ -870,6 +870,15 @@ struct phy_led { +@@ -867,6 +867,15 @@ struct phy_led { #define to_phy_led(d) container_of(d, struct phy_led, led_cdev) @@ -76,7 +76,7 @@ Signed-off-by: Jakub Kicinski /** * struct phy_driver - Driver structure for a particular PHY type * -@@ -1146,6 +1155,19 @@ struct phy_driver { +@@ -1143,6 +1152,19 @@ struct phy_driver { int (*led_hw_control_get)(struct phy_device *dev, u8 index, unsigned long *rules); diff --git a/target/linux/generic/backport-6.6/841-v6.13-net-phy-support-active-high-property-for-PHY-LEDs.patch b/target/linux/generic/backport-6.6/841-v6.13-net-phy-support-active-high-property-for-PHY-LEDs.patch index 729a31562337dc..3d8a15bd1e0869 100644 --- a/target/linux/generic/backport-6.6/841-v6.13-net-phy-support-active-high-property-for-PHY-LEDs.patch +++ b/target/linux/generic/backport-6.6/841-v6.13-net-phy-support-active-high-property-for-PHY-LEDs.patch @@ -19,7 +19,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c -@@ -3220,11 +3220,17 @@ static int of_phy_led(struct phy_device +@@ -3222,11 +3222,17 @@ static int of_phy_led(struct phy_device if (index > U8_MAX) return -EINVAL; @@ -39,7 +39,7 @@ Signed-off-by: Paolo Abeni if (!phydev->drv->led_polarity_set) --- a/include/linux/phy.h +++ b/include/linux/phy.h -@@ -872,8 +872,9 @@ struct phy_led { +@@ -869,8 +869,9 @@ struct phy_led { /* Modes for PHY LED configuration */ enum phy_led_modes { diff --git a/target/linux/generic/pending-6.6/680-net-add-TCP-fraglist-GRO-support.patch b/target/linux/generic/pending-6.6/680-net-add-TCP-fraglist-GRO-support.patch index 223fce786e8088..bb2beff43a1e10 100644 --- a/target/linux/generic/pending-6.6/680-net-add-TCP-fraglist-GRO-support.patch +++ b/target/linux/generic/pending-6.6/680-net-add-TCP-fraglist-GRO-support.patch @@ -379,7 +379,7 @@ Signe-off-by: Felix Fietkau skb_shinfo(skb)->gso_type |= SKB_GSO_TCPV4; --- a/net/ipv4/udp_offload.c +++ b/net/ipv4/udp_offload.c -@@ -533,33 +533,6 @@ out: +@@ -538,33 +538,6 @@ out: return segs; } diff --git a/target/linux/generic/pending-6.6/703-phy-add-detach-callback-to-struct-phy_driver.patch b/target/linux/generic/pending-6.6/703-phy-add-detach-callback-to-struct-phy_driver.patch index a556a9cc407149..453abe65c64014 100644 --- a/target/linux/generic/pending-6.6/703-phy-add-detach-callback-to-struct-phy_driver.patch +++ b/target/linux/generic/pending-6.6/703-phy-add-detach-callback-to-struct-phy_driver.patch @@ -11,9 +11,9 @@ Signed-off-by: Gabor Juhos --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c -@@ -1910,6 +1910,9 @@ void phy_detach(struct phy_device *phyde - if (phydev->devlink) - device_link_del(phydev->devlink); +@@ -1912,6 +1912,9 @@ void phy_detach(struct phy_device *phyde + phydev->devlink = NULL; + } + if (phydev->drv && phydev->drv->detach) + phydev->drv->detach(phydev); @@ -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 -@@ -980,6 +980,12 @@ struct phy_driver { +@@ -977,6 +977,12 @@ struct phy_driver { /** @handle_interrupt: Override default interrupt handling */ irqreturn_t (*handle_interrupt)(struct phy_device *phydev); diff --git a/target/linux/mediatek/patches-6.6/739-net-add-negotiation-of-in-band-capabilities.patch b/target/linux/mediatek/patches-6.6/739-net-add-negotiation-of-in-band-capabilities.patch index 44a6aad7f535f5..b0c78979451d78 100644 --- a/target/linux/mediatek/patches-6.6/739-net-add-negotiation-of-in-band-capabilities.patch +++ b/target/linux/mediatek/patches-6.6/739-net-add-negotiation-of-in-band-capabilities.patch @@ -826,7 +826,7 @@ publishing the in-band capabilities from the BCM84881 PHY driver. * --- a/include/linux/phy.h +++ b/include/linux/phy.h -@@ -800,6 +800,24 @@ struct phy_tdr_config { +@@ -797,6 +797,24 @@ struct phy_tdr_config { #define PHY_PAIR_ALL -1 /** @@ -851,7 +851,7 @@ publishing the in-band capabilities from the BCM84881 PHY driver. * struct phy_plca_cfg - Configuration of the PLCA (Physical Layer Collision * Avoidance) Reconciliation Sublayer. * -@@ -939,6 +957,19 @@ struct phy_driver { +@@ -936,6 +954,19 @@ struct phy_driver { int (*get_features)(struct phy_device *phydev); /** @@ -871,7 +871,7 @@ publishing the in-band capabilities from the BCM84881 PHY driver. * @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 -@@ -1774,6 +1805,9 @@ void phy_stop(struct phy_device *phydev) +@@ -1771,6 +1802,9 @@ void phy_stop(struct phy_device *phydev) int phy_config_aneg(struct phy_device *phydev); int phy_start_aneg(struct phy_device *phydev); int phy_aneg_done(struct phy_device *phydev); diff --git a/target/linux/mvebu/patches-6.6/0001-v6.16-pinctrl-armada-37xx-use-correct-OUTPUT_VAL-register-.patch b/target/linux/mvebu/patches-6.6/0001-v6.16-pinctrl-armada-37xx-use-correct-OUTPUT_VAL-register-.patch deleted file mode 100644 index 0d594a20bf1590..00000000000000 --- a/target/linux/mvebu/patches-6.6/0001-v6.16-pinctrl-armada-37xx-use-correct-OUTPUT_VAL-register-.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 947c93eb29c2a581c0b0b6d5f21af3c2b7ff6d25 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Wed, 14 May 2025 21:18:32 +0200 -Subject: [PATCH 1/7] pinctrl: armada-37xx: use correct OUTPUT_VAL register for - GPIOs > 31 - -The controller has two consecutive OUTPUT_VAL registers and both -holds output value for 32 GPIOs. Due to a missing adjustment, the -current code always uses the first register while setting the -output value whereas it should use the second one for GPIOs > 31. - -Add the missing armada_37xx_update_reg() call to adjust the register -according to the 'offset' parameter of the function to fix the issue. - -Cc: stable@vger.kernel.org -Fixes: 6702abb3bf23 ("pinctrl: armada-37xx: Fix direction_output() callback behavior") -Signed-off-by: Imre Kaloz -Reviewed-by: Andrew Lunn -Signed-off-by: Gabor Juhos -Link: https://lore.kernel.org/20250514-pinctrl-a37xx-fixes-v2-1-07e9ac1ab737@gmail.com -Signed-off-by: Linus Walleij ---- - drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c -+++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c -@@ -417,6 +417,7 @@ static int armada_37xx_gpio_direction_ou - unsigned int offset, int value) - { - struct armada_37xx_pinctrl *info = gpiochip_get_data(chip); -+ unsigned int val_offset = offset; - unsigned int reg = OUTPUT_EN; - unsigned int mask, val, ret; - -@@ -429,6 +430,8 @@ static int armada_37xx_gpio_direction_ou - return ret; - - reg = OUTPUT_VAL; -+ armada_37xx_update_reg(®, &val_offset); -+ - val = value ? mask : 0; - regmap_update_bits(info->regmap, reg, mask, val); - diff --git a/target/linux/mvebu/patches-6.6/0002-v6.16-pinctrl-armada-37xx-set-GPIO-output-value-before-set.patch b/target/linux/mvebu/patches-6.6/0002-v6.16-pinctrl-armada-37xx-set-GPIO-output-value-before-set.patch deleted file mode 100644 index 02f42c03246cd9..00000000000000 --- a/target/linux/mvebu/patches-6.6/0002-v6.16-pinctrl-armada-37xx-set-GPIO-output-value-before-set.patch +++ /dev/null @@ -1,58 +0,0 @@ -From e6ebd4942981f8ad37189bbb36a3c8495e21ef4c Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Wed, 14 May 2025 21:18:33 +0200 -Subject: [PATCH 2/7] pinctrl: armada-37xx: set GPIO output value before - setting direction - -Changing the direction before updating the output value in the -OUTPUT_VAL register may result in a glitch on the output line -if the previous value in the OUTPUT_VAL register is different -from the one we want to set. - -In order to avoid that, update the output value before changing -the direction. - -Cc: stable@vger.kernel.org -Fixes: 6702abb3bf23 ("pinctrl: armada-37xx: Fix direction_output() callback behavior") -Signed-off-by: Imre Kaloz -Reviewed-by: Andrew Lunn -Signed-off-by: Gabor Juhos -Link: https://lore.kernel.org/20250514-pinctrl-a37xx-fixes-v2-2-07e9ac1ab737@gmail.com -Signed-off-by: Linus Walleij ---- - drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 15 +++++++-------- - 1 file changed, 7 insertions(+), 8 deletions(-) - ---- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c -+++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c -@@ -417,23 +417,22 @@ static int armada_37xx_gpio_direction_ou - unsigned int offset, int value) - { - struct armada_37xx_pinctrl *info = gpiochip_get_data(chip); -- unsigned int val_offset = offset; -- unsigned int reg = OUTPUT_EN; -+ unsigned int en_offset = offset; -+ unsigned int reg = OUTPUT_VAL; - unsigned int mask, val, ret; - - armada_37xx_update_reg(®, &offset); - mask = BIT(offset); -+ val = value ? mask : 0; - -- ret = regmap_update_bits(info->regmap, reg, mask, mask); -- -+ ret = regmap_update_bits(info->regmap, reg, mask, val); - if (ret) - return ret; - -- reg = OUTPUT_VAL; -- armada_37xx_update_reg(®, &val_offset); -+ reg = OUTPUT_EN; -+ armada_37xx_update_reg(®, &en_offset); - -- val = value ? mask : 0; -- regmap_update_bits(info->regmap, reg, mask, val); -+ regmap_update_bits(info->regmap, reg, mask, mask); - - return 0; - } diff --git a/target/linux/qualcommax/patches-6.6/0061-v6.8-phy-qcom-qmp-usb-fix-serdes-init-sequence-for-IPQ6018.patch b/target/linux/qualcommax/patches-6.6/0061-v6.8-phy-qcom-qmp-usb-fix-serdes-init-sequence-for-IPQ6018.patch index 9021b572e8e04d..95e9ca7253a5e4 100644 --- a/target/linux/qualcommax/patches-6.6/0061-v6.8-phy-qcom-qmp-usb-fix-serdes-init-sequence-for-IPQ6018.patch +++ b/target/linux/qualcommax/patches-6.6/0061-v6.8-phy-qcom-qmp-usb-fix-serdes-init-sequence-for-IPQ6018.patch @@ -47,7 +47,7 @@ Signed-off-by: Vinod Koul static const struct qmp_phy_cfg ipq8074_usb3phy_cfg = { .lanes = 1, -@@ -2239,7 +2259,7 @@ err_node_put: +@@ -2243,7 +2263,7 @@ err_node_put: static const struct of_device_id qmp_usb_of_match_table[] = { { .compatible = "qcom,ipq6018-qmp-usb3-phy", diff --git a/target/linux/realtek/patches-6.6/706-include-linux-add-phy-ops-for-rtl838x.patch b/target/linux/realtek/patches-6.6/706-include-linux-add-phy-ops-for-rtl838x.patch index 09255c572147ef..8fb731206a8977 100644 --- a/target/linux/realtek/patches-6.6/706-include-linux-add-phy-ops-for-rtl838x.patch +++ b/target/linux/realtek/patches-6.6/706-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 -@@ -1181,6 +1181,10 @@ struct phy_driver { +@@ -1178,6 +1178,10 @@ struct phy_driver { */ int (*led_polarity_set)(struct phy_device *dev, int index, unsigned long modes); diff --git a/target/linux/starfive/patches-6.6/1009-net-stmmac-use-GFP_DMA32.patch b/target/linux/starfive/patches-6.6/1009-net-stmmac-use-GFP_DMA32.patch index f93917b563a36b..79f2cb3f0696b5 100644 --- a/target/linux/starfive/patches-6.6/1009-net-stmmac-use-GFP_DMA32.patch +++ b/target/linux/starfive/patches-6.6/1009-net-stmmac-use-GFP_DMA32.patch @@ -10,7 +10,7 @@ Signed-off-by: Matteo Croce --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c -@@ -1434,7 +1434,7 @@ static int stmmac_init_rx_buffers(struct +@@ -1439,7 +1439,7 @@ static int stmmac_init_rx_buffers(struct { struct stmmac_rx_queue *rx_q = &dma_conf->rx_queue[queue]; struct stmmac_rx_buffer *buf = &rx_q->buf_pool[i]; @@ -19,7 +19,7 @@ Signed-off-by: Matteo Croce if (priv->dma_cap.host_dma_width <= 32) gfp |= GFP_DMA32; -@@ -4687,7 +4687,7 @@ static inline void stmmac_rx_refill(stru +@@ -4692,7 +4692,7 @@ static inline void stmmac_rx_refill(stru struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[queue]; int dirty = stmmac_rx_dirty(priv, queue); unsigned int entry = rx_q->dirty_rx; From aaee6bfb0679c4390bdc22ed48a4e5e9743e03c3 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 21 Jun 2025 19:21:51 +0200 Subject: [PATCH 760/877] kernel: Add missing config option This broke the armsr/armv8 build. Signed-off-by: Hauke Mehrtens Link: https://github.com/openwrt/openwrt/pull/19200 Signed-off-by: Robert Marko (cherry picked from commit a944a6d6b1e1f4db635f76e481841260739b7860) --- target/linux/generic/config-6.6 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/generic/config-6.6 b/target/linux/generic/config-6.6 index deb58397b5cc7b..e31cca45cc4233 100644 --- a/target/linux/generic/config-6.6 +++ b/target/linux/generic/config-6.6 @@ -14,6 +14,7 @@ CONFIG_32BIT=y # CONFIG_ACERHDF is not set # CONFIG_ACER_WIRELESS is not set # CONFIG_ACORN_PARTITION is not set +# CONFIG_ACPI_AGDI is not set # CONFIG_ACPI_ALS is not set # CONFIG_ACPI_APEI is not set # CONFIG_ACPI_APEI_PCIEAER is not set From e876f7bc62592ca8bc3125e55936cd0f761f4d5a Mon Sep 17 00:00:00 2001 From: Marius Durbaca Date: Tue, 22 Oct 2024 16:15:57 +0300 Subject: [PATCH 761/877] mediatek: add support for Zbtlink ZBT-Z8102AX v2 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: 1. Power down the router and hold in the Reset button. 2. While holding in the button power up the router again. 3. Hold the button in for 10 seconds and then release. 4. Use your browser to go to 192.168.1.1 5. If you see a GUI that is for flashing firmware then you have the V2 model. If there is no GUI and the router continues to boot up normally you have the V1 model. 6. Now use the V2 sysugrade file. Note: Recovery GUI it can be used to recover from an incorrect firmware flash. Based on patches adding support for this device by Yannick Chabanois (openmptcprouter) and Dairyman (ofmodemsandmen) Signed-off-by: Marius Durbaca Link: https://github.com/openwrt/openwrt/pull/18514 (cherry picked from commit c908fc7d9591163ae4836f31b7e6db4611e6bc7e) Link: https://github.com/openwrt/openwrt/pull/19216 Signed-off-by: Hauke Mehrtens --- .../dts/mt7981b-zbtlink-zbt-z8102ax-v2.dts | 337 ++++++++++++++++++ .../filogic/base-files/etc/board.d/02_network | 1 + .../base-files/etc/board.d/03_gpio_switches | 3 +- .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 1 + target/linux/mediatek/image/filogic.mk | 17 + 5 files changed, 358 insertions(+), 1 deletion(-) create mode 100644 target/linux/mediatek/dts/mt7981b-zbtlink-zbt-z8102ax-v2.dts diff --git a/target/linux/mediatek/dts/mt7981b-zbtlink-zbt-z8102ax-v2.dts b/target/linux/mediatek/dts/mt7981b-zbtlink-zbt-z8102ax-v2.dts new file mode 100644 index 00000000000000..08fc4b977a18f0 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-zbtlink-zbt-z8102ax-v2.dts @@ -0,0 +1,337 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include +#include + +#include "mt7981.dtsi" + +/ { + model = "ZBT Z8102AX V2"; + compatible = "zbtlink,zbt-z8102ax-v2", "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; + label-mac-device = &gmac0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + bootargs = "earlycon=uart8250,mmio32,0x11002000 console=ttyS0,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_red: red { + gpios = <&pio 9 GPIO_ACTIVE_HIGH>; + color = ; + function = LED_FUNCTION_STATUS; + }; + + led_status_green: green { + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_STATUS; + }; + + led_status_blue: blue { + gpios = <&pio 11 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_STATUS; + }; + + led_status_5g1: 5g1 { + gpios = <&pio 8 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_USB; + function-enumerator = <0>; + }; + + led_status_5g2: 5g2 { + gpios = <&pio 13 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 = <0>; + gpios = <&pio 6 GPIO_ACTIVE_LOW>; + }; + + sim2 { + gpio-export,name = "sim2"; + gpio-export,output = <0>; + gpios = <&pio 7 GPIO_ACTIVE_LOW>; + }; + }; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + nvmem-cell-names = "mac-address"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + 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_factory_02a>; + }; +}; + +&mdio_bus { + switch: switch@1f { + 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>; + + 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 = <0x0100000 0x0080000>; + }; + + factory: partition@180000 { + label = "Factory"; + reg = <0x0180000 0x0200000>; + read-only; + }; + + partition@380000 { + label = "FIP"; + reg = <0x0380000 0x0200000>; + read-only; + }; + + nand_rootfs: partition@580000 { + label = "ubi"; + reg = <0x0580000 0x7220000>; + }; + }; + }; +}; + +&switch { + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan1"; + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_factory_004>; + }; + + port@1 { + reg = <1>; + label = "lan2"; + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_factory_004>; + }; + + port@2 { + reg = <2>; + label = "lan3"; + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_factory_004>; + }; + + port@3 { + reg = <3>; + label = "lan4"; + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_factory_004>; + }; + + port@6 { + reg = <6>; + label = "cpu"; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; +}; + +&pio { + gpio-line-names = + "wps", + "reset", + "watchdog", + "pcie", + "5g1", + "5g2", + "sim1", + "sim2", + "5g1_status", + "red_status", + "green_status", + "blue_status", + "", + "5g2_status"; + + 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"; +}; + +&usb_phy { + status = "okay"; +}; + +&xhci { + status = "okay"; +}; + +&wifi { + status = "okay"; + nvmem-cells = <&eeprom_factory>; + nvmem-cell-names = "eeprom"; +}; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_004: macaddr@004 { + reg = <0x004 0x6>; + }; + macaddr_factory_02a: macaddr@02a { + reg = <0x02a 0x6>; + }; + eeprom_factory: eeprom@0 { + reg = <0x0 0x1000>; + }; +}; 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 11dd94aef6527a..d7e9c1595587e0 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() ruijie,rg-x60-pro|\ unielec,u7981-01*|\ zbtlink,zbt-z8102ax|\ + zbtlink,zbt-z8102ax-v2|\ zyxel,ex5601-t0-stock|\ zyxel,ex5601-t0-ubootmod) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" eth1 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 4cbec1ef078db3..1fe74f2b6fd456 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,8 @@ board_config_update board=$(board_name) case "$board" in -zbtlink,zbt-z8102ax) +zbtlink,zbt-z8102ax|\ +zbtlink,zbt-z8102ax-v2) 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" 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 01e943617a7cd6..8a100d525bb0cb 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 @@ -177,6 +177,7 @@ case "$board" in routerich,ax3000|\ routerich,ax3000-ubootmod|\ zbtlink,zbt-z8102ax|\ + zbtlink,zbt-z8102ax-v2|\ zbtlink,zbt-z8103ax|\ zyxel,ex5601-t0-stock|\ zyxel,ex5601-t0-ubootmod) diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index f1d2a40a17792c..ffdc0412e64e34 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -1850,6 +1850,23 @@ define Device/zbtlink_zbt-z8102ax endef TARGET_DEVICES += zbtlink_zbt-z8102ax +define Device/zbtlink_zbt-z8102ax-v2 + DEVICE_VENDOR := Zbtlink + DEVICE_MODEL := ZBT-Z8102AX-V2 + DEVICE_DTS := mt7981b-zbtlink-zbt-z8102ax-v2 + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware kmod-usb3 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-v2 + define Device/zbtlink_zbt-z8103ax DEVICE_VENDOR := Zbtlink DEVICE_MODEL := ZBT-Z8103AX From 4a18bb1056c78e1224ae3444f5862f6265f9d91c Mon Sep 17 00:00:00 2001 From: Kazuhiro Ito Date: Sat, 28 Jun 2025 21:26:28 +0900 Subject: [PATCH 762/877] x86: 64: Enable PCI MMCONFIG Some devices can't boot since kernel 6.6 without PCI MMCONFIG. Fixes: https://github.com/openwrt/openwrt/issues/18228 Fixes: https://forum.openwrt.org/t/openwrt-24-10-x86-64-boot-hangs-after-pci-nvme-initialization/229086 Link: https://github.com/openwrt/openwrt/pull/19256 Signed-off-by: Kazuhiro Ito Link: https://github.com/openwrt/openwrt/pull/19262 Signed-off-by: Robert Marko --- target/linux/x86/64/config-6.6 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/linux/x86/64/config-6.6 b/target/linux/x86/64/config-6.6 index 1d08d31daa03d8..49e6890cd17a94 100644 --- a/target/linux/x86/64/config-6.6 +++ b/target/linux/x86/64/config-6.6 @@ -345,6 +345,7 @@ CONFIG_MFD_CORE=y # CONFIG_MFD_INTEL_LPSS_ACPI is not set # CONFIG_MFD_INTEL_PMC_BXT is not set CONFIG_MMC=y +CONFIG_MMCONF_FAM10H=y CONFIG_MMC_BLOCK=y CONFIG_MMC_CQHCI=y CONFIG_MMC_RICOH_MMC=y @@ -404,7 +405,7 @@ CONFIG_PCIEPORTBUS=y CONFIG_PCIE_PME=y CONFIG_PCI_HYPERV=y CONFIG_PCI_HYPERV_INTERFACE=y -# CONFIG_PCI_MMCONFIG is not set +CONFIG_PCI_MMCONFIG=y CONFIG_PCI_PASID=y CONFIG_PCI_PRI=y CONFIG_PCI_XEN=y From f754de7e3018f747f69538e7a70da0466c5573c1 Mon Sep 17 00:00:00 2001 From: John Audia Date: Fri, 27 Jun 2025 07:04:12 -0400 Subject: [PATCH 763/877] kernel: bump 6.6 to 6.6.95 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.95 Removed upstreamed: backport-6.6/201-v6.16-mips-Add-std-flag-specified.patch[1] mvebu/patches-6.6/0004-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch[2] mvebu/patches-6.6/0005-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch[3] mvebu/patches-6.6/0006-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch[4] mvebu/patches-6.6/0007-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch[5] gemini/patches-6.6/0005-net-ethernet-cortina-Use-TSO-also-on-common-TCP.patch [6] Manually refreshed: bcm27xx/patches-6.6/950-0092-MMC-added-alternative-MMC-driver.patch bcm27xx/patches-6.6/950-0678-fbdev-Allow-client-to-request-a-particular-dev-fbN-n.patch [7] All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.95&id=231f6a1de15b3f62eb8d6163a8b1bc5935025c69 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.95&id=ae48bc0b8be8786fd0ceab4b5a95c09b5aa93816 3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.95&id=8a15a5438c5816a1003b88ce20f25ccc92909ee7 4. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.95&id=02c966a8869becb29282403540c88ba33e19c347 5. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.95&id=14a26f6692062a529b612420adb6c0b9290b25d3 6. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.95&id=a37888a435b0737128d2d9c6f67b8d608f83df7a 7. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.95&id=0909b2b49c4546a7a08c80f53d93736b63270827 Build system: x86/64 Build-tested: flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3, x86/64 Run-tested: flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3, x86/64 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/19248 (cherry picked from commit 18319664064b6d4d7a923175b85d2faae2f44418) Co-authored-by: Goetz Goerisch Co-authored-by: Hauke Mehrtens Signed-off-by: Goetz Goerisch Link: https://github.com/openwrt/openwrt/pull/19265 Signed-off-by: Hauke Mehrtens --- include/kernel-6.6 | 4 +- .../900-unaligned_access_hacks.patch | 2 +- ...092-MMC-added-alternative-MMC-driver.patch | 6 +- ...-net-macb-Also-set-DMA-coherent-mask.patch | 6 +- ...nt-to-request-a-particular-dev-fbN-n.patch | 21 ++-- ...-add-SD-support-for-Command-Queueing.patch | 6 +- ...llocate-a-block-for-SD-extension-reg.patch | 22 ++--- ...rt-SD-extension-register-read-write-.patch | 22 ++--- ...ore-cautious-when-manipulating-Comma.patch | 2 +- ...debugfs-entries-for-SD-extension-reg.patch | 6 +- ...le-1024-byte-SD-General-Info-lengths.patch | 4 +- ...ted-write-counts-for-SD-cards-in-CQ-.patch | 4 +- ...ct-posted-write-counts-for-SD-cards-.patch | 4 +- ...ble-write-caching-on-Samsung-2023-mo.patch | 8 +- ...le-cache-on-more-known-bad-Sandisk-c.patch | 2 +- ...MC_QUIRK_BROKEN_ERASE-for-Phison-Int.patch | 2 +- ...rd-CQ-support-based-on-an-allow-list.patch | 10 +- ...K_KNOWN_WORKING_SD_CQ-on-Raspberry-P.patch | 4 +- ...am-DT-property-to-modify-CQE-and-or-.patch | 2 +- ...t-cortina-Use-TSO-also-on-common-TCP.patch | 95 ------------------- ...et-cortina-Implement-.set_pauseparam.patch | 4 +- ...klog-NAPI-to-clean-up-the-defer_list.patch | 2 +- ...-create-a-dummy-net_device-allocator.patch | 2 +- ...-a-separate-timeout-parameter-for-wa.patch | 4 +- ...-mhi_power_down_keep_dev-API-to-supp.patch | 6 +- .../800-GPIO-add-named-gpio-exports.patch | 2 +- .../generic/hack-6.6/902-debloat_proc.patch | 2 +- .../pending-6.6/532-jffs2_eofdetect.patch | 2 +- ...7xx-propagate-error-from-armada_37xx.patch | 2 +- ...7xx-propagate-error-from-armada_37xx.patch | 36 ------- ...7xx-propagate-error-from-armada_37xx.patch | 42 -------- ...7xx-propagate-error-from-armada_37xx.patch | 35 ------- ...7xx-propagate-error-from-armada_37xx.patch | 31 ------ .../810-uvc-add-iPassion-iP2970-support.patch | 2 +- 34 files changed, 86 insertions(+), 318 deletions(-) delete mode 100644 target/linux/gemini/patches-6.6/0005-net-ethernet-cortina-Use-TSO-also-on-common-TCP.patch delete mode 100644 target/linux/mvebu/patches-6.6/0004-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch delete mode 100644 target/linux/mvebu/patches-6.6/0005-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch delete mode 100644 target/linux/mvebu/patches-6.6/0006-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch delete mode 100644 target/linux/mvebu/patches-6.6/0007-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch diff --git a/include/kernel-6.6 b/include/kernel-6.6 index a2e954d0020bad..d2d952e2541871 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .94 -LINUX_KERNEL_HASH-6.6.94 = 713981ea26b20b476ba4ce880b76b21294576788d5db1c2188b167bcb06ecc56 +LINUX_VERSION-6.6 = .95 +LINUX_KERNEL_HASH-6.6.95 = 18640ae9a2c952f8f8868324378df1a9e138ad29e6b93a9c38155764ea67ea85 diff --git a/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch b/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch index 92c8cd90d1b055..9168d5e973ded8 100644 --- a/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch @@ -751,7 +751,7 @@ SVN-Revision: 35130 EXPORT_SYMBOL(xfrm_parse_spi); --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c -@@ -4276,14 +4276,16 @@ static bool tcp_parse_aligned_timestamp( +@@ -4283,14 +4283,16 @@ static bool tcp_parse_aligned_timestamp( { const __be32 *ptr = (const __be32 *)(th + 1); diff --git a/target/linux/bcm27xx/patches-6.6/950-0092-MMC-added-alternative-MMC-driver.patch b/target/linux/bcm27xx/patches-6.6/950-0092-MMC-added-alternative-MMC-driver.patch index a0b5d2fd2a8a17..e983d5295b1147 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0092-MMC-added-alternative-MMC-driver.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0092-MMC-added-alternative-MMC-driver.patch @@ -344,7 +344,7 @@ Signed-off-by: Phil Elwell } --- a/drivers/mmc/core/quirks.h +++ b/drivers/mmc/core/quirks.h -@@ -143,6 +143,14 @@ static const struct mmc_fixup __maybe_un +@@ -153,6 +153,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), @@ -2013,10 +2013,10 @@ Signed-off-by: Phil Elwell sdhci_dumpregs(host); --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h -@@ -297,6 +297,7 @@ struct mmc_card { - #define MMC_QUIRK_BROKEN_SD_CACHE (1<<15) /* Disable broken SD cache support */ +@@ -298,6 +298,7 @@ struct mmc_card { #define MMC_QUIRK_BROKEN_CACHE_FLUSH (1<<16) /* Don't flush cache until the write has occurred */ #define MMC_QUIRK_BROKEN_SD_POWEROFF_NOTIFY (1<<17) /* Disable broken SD poweroff notify support */ + #define MMC_QUIRK_NO_UHS_DDR50_TUNING (1<<18) /* Disable DDR50 tuning */ +#define MMC_QUIRK_ERASE_BROKEN (1<<31) /* Skip erase */ bool written_flag; /* Indicates eMMC has been written since power on */ diff --git a/target/linux/bcm27xx/patches-6.6/950-0518-net-macb-Also-set-DMA-coherent-mask.patch b/target/linux/bcm27xx/patches-6.6/950-0518-net-macb-Also-set-DMA-coherent-mask.patch index 31a173a2e08ca8..9abdb37960b1b5 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0518-net-macb-Also-set-DMA-coherent-mask.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0518-net-macb-Also-set-DMA-coherent-mask.patch @@ -367,7 +367,7 @@ Signed-off-by: Jonathan Bell spin_lock_init(&bp->lock); spin_lock_init(&bp->stats_lock); -@@ -5118,6 +5237,21 @@ static int macb_probe(struct platform_de +@@ -5122,6 +5241,21 @@ static int macb_probe(struct platform_de else bp->phy_interface = interface; @@ -389,7 +389,7 @@ Signed-off-by: Jonathan Bell /* IP specific init */ err = init(pdev); if (err) -@@ -5194,6 +5328,19 @@ static int macb_remove(struct platform_d +@@ -5198,6 +5332,19 @@ static int macb_remove(struct platform_d return 0; } @@ -409,7 +409,7 @@ Signed-off-by: Jonathan Bell static int __maybe_unused macb_suspend(struct device *dev) { struct net_device *netdev = dev_get_drvdata(dev); -@@ -5408,6 +5555,7 @@ static const struct dev_pm_ops macb_pm_o +@@ -5412,6 +5559,7 @@ static const struct dev_pm_ops macb_pm_o static struct platform_driver macb_driver = { .probe = macb_probe, .remove = macb_remove, diff --git a/target/linux/bcm27xx/patches-6.6/950-0678-fbdev-Allow-client-to-request-a-particular-dev-fbN-n.patch b/target/linux/bcm27xx/patches-6.6/950-0678-fbdev-Allow-client-to-request-a-particular-dev-fbN-n.patch index ee15b7969c2f26..fa382806f50eea 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0678-fbdev-Allow-client-to-request-a-particular-dev-fbN-n.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0678-fbdev-Allow-client-to-request-a-particular-dev-fbN-n.patch @@ -23,33 +23,40 @@ Signed-off-by: Dave Stevenson #define for_each_registered_fb(i) \ for (i = 0; i < FB_MAX; i++) \ if (!registered_fb[i]) {} else -@@ -938,10 +939,12 @@ static int do_register_framebuffer(struc +@@ -939,9 +940,12 @@ static int do_register_framebuffer(struc + if (num_registered_fb == FB_MAX) return -ENXIO; - num_registered_fb++; - for (i = 0 ; i < FB_MAX; i++) - if (!registered_fb[i]) - break; -- fb_info->node = i; + if (!fb_info->custom_fb_num || fb_info->node >= FB_MAX || registered_fb[fb_info->node]) { + for (i = min_dynamic_fb ; i < FB_MAX; i++) + if (!registered_fb[i]) + break; + fb_info->node = i; + } + + if (!fb_info->modelist.prev || !fb_info->modelist.next) + INIT_LIST_HEAD(&fb_info->modelist); +@@ -951,7 +955,6 @@ static int do_register_framebuffer(struc + if (err < 0) + return err; + +- fb_info->node = i; refcount_set(&fb_info->count, 1); mutex_init(&fb_info->lock); mutex_init(&fb_info->mm_lock); -@@ -976,7 +979,7 @@ static int do_register_framebuffer(struc +@@ -982,7 +985,7 @@ static int do_register_framebuffer(struc + pm_vt_switch_required(fb_info->device, true); - fb_var_to_videomode(&mode, &fb_info->var); - fb_add_videomode(&mode, &fb_info->modelist); + num_registered_fb++; - registered_fb[i] = fb_info; + registered_fb[fb_info->node] = fb_info; #ifdef CONFIG_GUMSTIX_AM200EPD { -@@ -1037,6 +1040,12 @@ static void do_unregister_framebuffer(st +@@ -1043,6 +1046,12 @@ static void do_unregister_framebuffer(st put_fb_info(fb_info); } diff --git a/target/linux/bcm27xx/patches-6.6/950-0980-drivers-mmc-add-SD-support-for-Command-Queueing.patch b/target/linux/bcm27xx/patches-6.6/950-0980-drivers-mmc-add-SD-support-for-Command-Queueing.patch index 14eb62cfac89bd..c7c227e8afef51 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0980-drivers-mmc-add-SD-support-for-Command-Queueing.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0980-drivers-mmc-add-SD-support-for-Command-Queueing.patch @@ -91,7 +91,7 @@ Signed-off-by: Jonathan Bell cmd.flags &= ~MMC_RSP_CRC; /* Ignore CRC */ --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c -@@ -1016,8 +1016,8 @@ static bool mmc_sd_card_using_v18(struct +@@ -1032,8 +1032,8 @@ static bool mmc_sd_card_using_v18(struct (SD_MODE_UHS_SDR50 | SD_MODE_UHS_SDR104 | SD_MODE_UHS_DDR50); } @@ -102,7 +102,7 @@ Signed-off-by: Jonathan Bell { struct mmc_host *host = card->host; struct mmc_request mrq = {}; -@@ -1175,8 +1175,14 @@ static int sd_parse_ext_reg_perf(struct +@@ -1191,8 +1191,14 @@ static int sd_parse_ext_reg_perf(struct card->ext_perf.feature_support |= SD_EXT_PERF_CACHE; /* Command queue support indicated via queue depth bits (0 to 4). */ @@ -118,7 +118,7 @@ Signed-off-by: Jonathan Bell card->ext_perf.fno = fno; card->ext_perf.page = page; -@@ -1563,13 +1569,41 @@ cont: +@@ -1579,13 +1585,41 @@ cont: goto free_card; } diff --git a/target/linux/bcm27xx/patches-6.6/950-0983-drivers-mmc-preallocate-a-block-for-SD-extension-reg.patch b/target/linux/bcm27xx/patches-6.6/950-0983-drivers-mmc-preallocate-a-block-for-SD-extension-reg.patch index 2d1d317891ce15..c95bd1fc55079f 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0983-drivers-mmc-preallocate-a-block-for-SD-extension-reg.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0983-drivers-mmc-preallocate-a-block-for-SD-extension-reg.patch @@ -30,7 +30,7 @@ Signed-off-by: Jonathan Bell kfree(card); --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c -@@ -1026,9 +1026,8 @@ int sd_write_ext_reg(struct mmc_card *ca +@@ -1042,9 +1042,8 @@ int sd_write_ext_reg(struct mmc_card *ca struct scatterlist sg; u8 *reg_buf; @@ -42,7 +42,7 @@ Signed-off-by: Jonathan Bell mrq.cmd = &cmd; mrq.data = &data; -@@ -1060,8 +1059,6 @@ int sd_write_ext_reg(struct mmc_card *ca +@@ -1076,8 +1075,6 @@ int sd_write_ext_reg(struct mmc_card *ca mmc_set_data_timeout(&data, card); mmc_wait_for_req(host, &mrq); @@ -51,7 +51,7 @@ Signed-off-by: Jonathan Bell /* * Note that, the SD card is allowed to signal busy on DAT0 up to 1s * after the CMD49. Although, let's leave this to be managed by the -@@ -1102,9 +1099,7 @@ static int sd_parse_ext_reg_power(struct +@@ -1118,9 +1115,7 @@ static int sd_parse_ext_reg_power(struct int err; u8 *reg_buf; @@ -62,7 +62,7 @@ Signed-off-by: Jonathan Bell /* Read the extension register for power management function. */ err = sd_read_ext_reg(card, fno, page, offset, 512, reg_buf); -@@ -1134,7 +1129,6 @@ static int sd_parse_ext_reg_power(struct +@@ -1150,7 +1145,6 @@ static int sd_parse_ext_reg_power(struct card->ext_power.offset = offset; out: @@ -70,7 +70,7 @@ Signed-off-by: Jonathan Bell return err; } -@@ -1144,9 +1138,7 @@ static int sd_parse_ext_reg_perf(struct +@@ -1160,9 +1154,7 @@ static int sd_parse_ext_reg_perf(struct int err; u8 *reg_buf; @@ -81,7 +81,7 @@ Signed-off-by: Jonathan Bell err = sd_read_ext_reg(card, fno, page, offset, 512, reg_buf); if (err) { -@@ -1189,7 +1181,6 @@ static int sd_parse_ext_reg_perf(struct +@@ -1205,7 +1197,6 @@ static int sd_parse_ext_reg_perf(struct card->ext_perf.offset = offset; out: @@ -89,7 +89,7 @@ Signed-off-by: Jonathan Bell return err; } -@@ -1260,6 +1251,12 @@ static int sd_read_ext_regs(struct mmc_c +@@ -1276,6 +1267,12 @@ static int sd_read_ext_regs(struct mmc_c if (!gen_info_buf) return -ENOMEM; @@ -102,7 +102,7 @@ Signed-off-by: Jonathan Bell /* * Read 512 bytes of general info, which is found at function number 0, * at page 0 and with no offset. -@@ -1326,9 +1323,7 @@ static int sd_flush_cache(struct mmc_hos +@@ -1342,9 +1339,7 @@ static int sd_flush_cache(struct mmc_hos if (!sd_cache_enabled(host)) return 0; @@ -113,7 +113,7 @@ Signed-off-by: Jonathan Bell /* * Set Flush Cache at bit 0 in the performance enhancement register at -@@ -1364,21 +1359,15 @@ static int sd_flush_cache(struct mmc_hos +@@ -1380,21 +1375,15 @@ static int sd_flush_cache(struct mmc_hos if (reg_buf[0] & BIT(0)) err = -ETIMEDOUT; out: @@ -135,7 +135,7 @@ Signed-off-by: Jonathan Bell /* * Set Cache Enable at bit 0 in the performance enhancement register at * 260 bytes offset. -@@ -1397,7 +1386,6 @@ static int sd_enable_cache(struct mmc_ca +@@ -1413,7 +1402,6 @@ static int sd_enable_cache(struct mmc_ca card->ext_perf.feature_enabled |= SD_EXT_PERF_CACHE; out: @@ -145,7 +145,7 @@ Signed-off-by: Jonathan Bell --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h -@@ -321,6 +321,7 @@ struct mmc_card { +@@ -322,6 +322,7 @@ struct mmc_card { struct sd_switch_caps sw_caps; /* switch (CMD6) caps */ struct sd_ext_reg ext_power; /* SD extension reg for PM */ struct sd_ext_reg ext_perf; /* SD extension reg for PERF */ diff --git a/target/linux/bcm27xx/patches-6.6/950-0994-drivers-mmc-export-SD-extension-register-read-write-.patch b/target/linux/bcm27xx/patches-6.6/950-0994-drivers-mmc-export-SD-extension-register-read-write-.patch index e2347ed9d2e98a..830b13e2d127b7 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0994-drivers-mmc-export-SD-extension-register-read-write-.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0994-drivers-mmc-export-SD-extension-register-read-write-.patch @@ -16,7 +16,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c -@@ -1016,83 +1016,6 @@ static bool mmc_sd_card_using_v18(struct +@@ -1032,83 +1032,6 @@ static bool mmc_sd_card_using_v18(struct (SD_MODE_UHS_SDR50 | SD_MODE_UHS_SDR104 | SD_MODE_UHS_DDR50); } @@ -100,7 +100,7 @@ Signed-off-by: Jonathan Bell static int sd_parse_ext_reg_power(struct mmc_card *card, u8 fno, u8 page, u16 offset) { -@@ -1102,7 +1025,7 @@ static int sd_parse_ext_reg_power(struct +@@ -1118,7 +1041,7 @@ static int sd_parse_ext_reg_power(struct reg_buf = card->ext_reg_buf; /* Read the extension register for power management function. */ @@ -109,7 +109,7 @@ Signed-off-by: Jonathan Bell if (err) { pr_warn("%s: error %d reading PM func of ext reg\n", mmc_hostname(card->host), err); -@@ -1140,7 +1063,7 @@ static int sd_parse_ext_reg_perf(struct +@@ -1156,7 +1079,7 @@ static int sd_parse_ext_reg_perf(struct reg_buf = card->ext_reg_buf; @@ -118,7 +118,7 @@ Signed-off-by: Jonathan Bell if (err) { pr_warn("%s: error %d reading PERF func of ext reg\n", mmc_hostname(card->host), err); -@@ -1235,7 +1158,7 @@ static int sd_parse_ext_reg(struct mmc_c +@@ -1251,7 +1174,7 @@ static int sd_parse_ext_reg(struct mmc_c return 0; } @@ -127,7 +127,7 @@ Signed-off-by: Jonathan Bell { int err, i; u8 num_ext, *gen_info_buf; -@@ -1261,7 +1184,7 @@ static int sd_read_ext_regs(struct mmc_c +@@ -1277,7 +1200,7 @@ static int sd_read_ext_regs(struct mmc_c * Read 512 bytes of general info, which is found at function number 0, * at page 0 and with no offset. */ @@ -136,7 +136,7 @@ Signed-off-by: Jonathan Bell if (err) { pr_err("%s: error %d reading general info of SD ext reg\n", mmc_hostname(card->host), err); -@@ -1333,7 +1256,7 @@ static int sd_flush_cache(struct mmc_hos +@@ -1349,7 +1272,7 @@ static int sd_flush_cache(struct mmc_hos page = card->ext_perf.page; offset = card->ext_perf.offset + 261; @@ -145,7 +145,7 @@ Signed-off-by: Jonathan Bell if (err) { pr_warn("%s: error %d writing Cache Flush bit\n", mmc_hostname(host), err); -@@ -1349,7 +1272,7 @@ static int sd_flush_cache(struct mmc_hos +@@ -1365,7 +1288,7 @@ static int sd_flush_cache(struct mmc_hos * Read the Flush Cache bit. The card shall reset it, to confirm that * it's has completed the flushing of the cache. */ @@ -154,7 +154,7 @@ Signed-off-by: Jonathan Bell if (err) { pr_warn("%s: error %d reading Cache Flush bit\n", mmc_hostname(host), err); -@@ -1372,7 +1295,7 @@ static int sd_enable_cache(struct mmc_ca +@@ -1388,7 +1311,7 @@ static int sd_enable_cache(struct mmc_ca * Set Cache Enable at bit 0 in the performance enhancement register at * 260 bytes offset. */ @@ -163,7 +163,7 @@ Signed-off-by: Jonathan Bell card->ext_perf.offset + 260, BIT(0)); if (err) { pr_warn("%s: error %d writing Cache Enable bit\n", -@@ -1545,7 +1468,7 @@ retry: +@@ -1561,7 +1484,7 @@ retry: cont: if (!oldcard) { /* Read/parse the extension registers. */ @@ -172,7 +172,7 @@ Signed-off-by: Jonathan Bell if (err) goto free_card; } -@@ -1672,7 +1595,7 @@ static int sd_busy_poweroff_notify_cb(vo +@@ -1688,7 +1611,7 @@ static int sd_busy_poweroff_notify_cb(vo * one byte offset and is one byte long. The Power Off Notification * Ready is bit 0. */ @@ -181,7 +181,7 @@ Signed-off-by: Jonathan Bell card->ext_power.offset + 1, 1, data->reg_buf); if (err) { pr_warn("%s: error %d reading status reg of PM func\n", -@@ -1698,7 +1621,7 @@ static int sd_poweroff_notify(struct mmc +@@ -1714,7 +1637,7 @@ static int sd_poweroff_notify(struct mmc * Set the Power Off Notification bit in the power management settings * register at 2 bytes offset. */ diff --git a/target/linux/bcm27xx/patches-6.6/950-0995-drivers-mmc-be-more-cautious-when-manipulating-Comma.patch b/target/linux/bcm27xx/patches-6.6/950-0995-drivers-mmc-be-more-cautious-when-manipulating-Comma.patch index 6a855757ac0eb0..50138211fd6413 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0995-drivers-mmc-be-more-cautious-when-manipulating-Comma.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0995-drivers-mmc-be-more-cautious-when-manipulating-Comma.patch @@ -17,7 +17,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c -@@ -1089,8 +1089,12 @@ static int sd_parse_ext_reg_perf(struct +@@ -1105,8 +1105,12 @@ static int sd_parse_ext_reg_perf(struct if ((reg_buf[4] & BIT(0)) && !mmc_card_broken_sd_cache(card)) card->ext_perf.feature_support |= SD_EXT_PERF_CACHE; diff --git a/target/linux/bcm27xx/patches-6.6/950-0996-drivers-mmc-add-debugfs-entries-for-SD-extension-reg.patch b/target/linux/bcm27xx/patches-6.6/950-0996-drivers-mmc-add-debugfs-entries-for-SD-extension-reg.patch index c12229ece9d307..fc09f375e2f629 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0996-drivers-mmc-add-debugfs-entries-for-SD-extension-reg.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0996-drivers-mmc-add-debugfs-entries-for-SD-extension-reg.patch @@ -27,7 +27,7 @@ Signed-off-by: Jonathan Bell pr_info("%s: Host Software Queue enabled\n", --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c -@@ -715,7 +715,8 @@ MMC_DEV_ATTR(oemid, "0x%04x\n", card->ci +@@ -731,7 +731,8 @@ MMC_DEV_ATTR(oemid, "0x%04x\n", card->ci MMC_DEV_ATTR(serial, "0x%08x\n", card->cid.serial); MMC_DEV_ATTR(ocr, "0x%08x\n", card->ocr); MMC_DEV_ATTR(rca, "0x%04x\n", card->rca); @@ -37,7 +37,7 @@ Signed-off-by: Jonathan Bell static ssize_t mmc_dsr_show(struct device *dev, struct device_attribute *attr, char *buf) -@@ -777,6 +778,8 @@ static struct attribute *sd_std_attrs[] +@@ -793,6 +794,8 @@ static struct attribute *sd_std_attrs[] &dev_attr_ocr.attr, &dev_attr_rca.attr, &dev_attr_dsr.attr, @@ -46,7 +46,7 @@ Signed-off-by: Jonathan Bell NULL, }; -@@ -1512,8 +1515,8 @@ cont: +@@ -1528,8 +1531,8 @@ cont: host->cqe_enabled = true; if (card->ext_csd.cmdq_en) { diff --git a/target/linux/bcm27xx/patches-6.6/950-0997-drivers-mmc-handle-1024-byte-SD-General-Info-lengths.patch b/target/linux/bcm27xx/patches-6.6/950-0997-drivers-mmc-handle-1024-byte-SD-General-Info-lengths.patch index 55b369d659a120..8af51d3a23966d 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0997-drivers-mmc-handle-1024-byte-SD-General-Info-lengths.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0997-drivers-mmc-handle-1024-byte-SD-General-Info-lengths.patch @@ -14,7 +14,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c -@@ -1177,7 +1177,7 @@ static int mmc_sd_read_ext_regs(struct m +@@ -1193,7 +1193,7 @@ static int mmc_sd_read_ext_regs(struct m if (!(card->scr.cmds & SD_SCR_CMD48_SUPPORT)) return 0; @@ -23,7 +23,7 @@ Signed-off-by: Jonathan Bell if (!gen_info_buf) return -ENOMEM; -@@ -1208,14 +1208,23 @@ static int mmc_sd_read_ext_regs(struct m +@@ -1224,14 +1224,23 @@ static int mmc_sd_read_ext_regs(struct m num_ext = gen_info_buf[4]; /* diff --git a/target/linux/bcm27xx/patches-6.6/950-1167-mmc-restrict-posted-write-counts-for-SD-cards-in-CQ-.patch b/target/linux/bcm27xx/patches-6.6/950-1167-mmc-restrict-posted-write-counts-for-SD-cards-in-CQ-.patch index b1ddf96311c62a..5408d381e2c796 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1167-mmc-restrict-posted-write-counts-for-SD-cards-in-CQ-.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1167-mmc-restrict-posted-write-counts-for-SD-cards-in-CQ-.patch @@ -129,7 +129,7 @@ Signed-off-by: Jonathan Bell bool busy; --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c -@@ -1104,6 +1104,14 @@ static int sd_parse_ext_reg_perf(struct +@@ -1120,6 +1120,14 @@ static int sd_parse_ext_reg_perf(struct pr_debug("%s: Command Queue supported depth %u\n", mmc_hostname(card->host), card->ext_csd.cmdq_depth); @@ -146,7 +146,7 @@ Signed-off-by: Jonathan Bell card->ext_perf.fno = fno; --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h -@@ -344,6 +344,8 @@ struct mmc_card { +@@ -345,6 +345,8 @@ struct mmc_card { unsigned int nr_parts; struct workqueue_struct *complete_wq; /* Private workqueue */ diff --git a/target/linux/bcm27xx/patches-6.6/950-1168-fixup-mmc-restrict-posted-write-counts-for-SD-cards-.patch b/target/linux/bcm27xx/patches-6.6/950-1168-fixup-mmc-restrict-posted-write-counts-for-SD-cards-.patch index b4f30b4b3c4666..150f93e762faf8 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1168-fixup-mmc-restrict-posted-write-counts-for-SD-cards-.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1168-fixup-mmc-restrict-posted-write-counts-for-SD-cards-.patch @@ -39,7 +39,7 @@ Signed-off-by: Jonathan Bell return BLK_STS_RESOURCE; --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c -@@ -1105,13 +1105,14 @@ static int sd_parse_ext_reg_perf(struct +@@ -1121,13 +1121,14 @@ static int sd_parse_ext_reg_perf(struct mmc_hostname(card->host), card->ext_csd.cmdq_depth); /* @@ -60,7 +60,7 @@ Signed-off-by: Jonathan Bell } card->ext_perf.fno = fno; -@@ -1375,6 +1376,7 @@ retry: +@@ -1391,6 +1392,7 @@ retry: card->ocr = ocr; card->type = MMC_TYPE_SD; diff --git a/target/linux/bcm27xx/patches-6.6/950-1260-drivers-mmc-disable-write-caching-on-Samsung-2023-mo.patch b/target/linux/bcm27xx/patches-6.6/950-1260-drivers-mmc-disable-write-caching-on-Samsung-2023-mo.patch index 761e5bea7f6533..327c74d720b6d3 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1260-drivers-mmc-disable-write-caching-on-Samsung-2023-mo.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1260-drivers-mmc-disable-write-caching-on-Samsung-2023-mo.patch @@ -26,13 +26,13 @@ Signed-off-by: Jonathan Bell #define CID_MANFID_SAMSUNG 0x15 +#define CID_MANFID_SAMSUNG_SD 0x1b #define CID_MANFID_APACER 0x27 + #define CID_MANFID_SWISSBIT 0x5D #define CID_MANFID_KINGSTON 0x70 - #define CID_MANFID_HYNIX 0x90 --- a/drivers/mmc/core/quirks.h +++ b/drivers/mmc/core/quirks.h -@@ -34,6 +34,14 @@ static const struct mmc_fixup __maybe_un - MMC_QUIRK_BROKEN_SD_CACHE | MMC_QUIRK_BROKEN_SD_POWEROFF_NOTIFY, - EXT_CSD_REV_ANY), +@@ -44,6 +44,14 @@ static const struct mmc_fixup __maybe_un + 0, -1ull, SDIO_ANY_ID, SDIO_ANY_ID, add_quirk_sd, + MMC_QUIRK_NO_UHS_DDR50_TUNING, EXT_CSD_REV_ANY), + /* + * Samsung Pro Plus/EVO Plus/Pro Ultimate SD cards (2023) claim to cache diff --git a/target/linux/bcm27xx/patches-6.6/950-1333-mmc-quirks-disable-cache-on-more-known-bad-Sandisk-c.patch b/target/linux/bcm27xx/patches-6.6/950-1333-mmc-quirks-disable-cache-on-more-known-bad-Sandisk-c.patch index c62b301c22f113..0d8111b8901032 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1333-mmc-quirks-disable-cache-on-more-known-bad-Sandisk-c.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1333-mmc-quirks-disable-cache-on-more-known-bad-Sandisk-c.patch @@ -14,7 +14,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/mmc/core/quirks.h +++ b/drivers/mmc/core/quirks.h -@@ -42,6 +42,18 @@ static const struct mmc_fixup __maybe_un +@@ -52,6 +52,18 @@ static const struct mmc_fixup __maybe_un 0, -1ull, SDIO_ANY_ID, SDIO_ANY_ID, add_quirk_sd, MMC_QUIRK_BROKEN_SD_CACHE, EXT_CSD_REV_ANY), diff --git a/target/linux/bcm27xx/patches-6.6/950-1336-mmc-quirks-add-MMC_QUIRK_BROKEN_ERASE-for-Phison-Int.patch b/target/linux/bcm27xx/patches-6.6/950-1336-mmc-quirks-add-MMC_QUIRK_BROKEN_ERASE-for-Phison-Int.patch index feb6eaf8ead981..83535468288972 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1336-mmc-quirks-add-MMC_QUIRK_BROKEN_ERASE-for-Phison-Int.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1336-mmc-quirks-add-MMC_QUIRK_BROKEN_ERASE-for-Phison-Int.patch @@ -15,7 +15,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/mmc/core/quirks.h +++ b/drivers/mmc/core/quirks.h -@@ -171,6 +171,15 @@ static const struct mmc_fixup __maybe_un +@@ -181,6 +181,15 @@ static const struct mmc_fixup __maybe_un MMC_FIXUP("SD32G", 0x41, 0x3432, add_quirk, MMC_QUIRK_ERASE_BROKEN), MMC_FIXUP("SD64G", 0x41, 0x3432, add_quirk, MMC_QUIRK_ERASE_BROKEN), diff --git a/target/linux/bcm27xx/patches-6.6/950-1506-mmc-sd-filter-card-CQ-support-based-on-an-allow-list.patch b/target/linux/bcm27xx/patches-6.6/950-1506-mmc-sd-filter-card-CQ-support-based-on-an-allow-list.patch index e5148707bdaaa7..612f31e239ac73 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1506-mmc-sd-filter-card-CQ-support-based-on-an-allow-list.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1506-mmc-sd-filter-card-CQ-support-based-on-an-allow-list.patch @@ -22,8 +22,8 @@ Signed-off-by: Jonathan Bell --- a/drivers/mmc/core/card.h +++ b/drivers/mmc/core/card.h -@@ -292,4 +292,9 @@ static inline int mmc_card_broken_sd_pow - return c->quirks & MMC_QUIRK_BROKEN_SD_POWEROFF_NOTIFY; +@@ -298,4 +298,9 @@ static inline int mmc_card_no_uhs_ddr50_ + return c->quirks & MMC_QUIRK_NO_UHS_DDR50_TUNING; } +static inline int mmc_card_working_sd_cq(const struct mmc_card *c) @@ -34,7 +34,7 @@ Signed-off-by: Jonathan Bell #endif --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c -@@ -1506,6 +1506,10 @@ cont: +@@ -1522,6 +1522,10 @@ cont: goto free_card; } @@ -47,10 +47,10 @@ Signed-off-by: Jonathan Bell /* --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h -@@ -297,6 +297,7 @@ struct mmc_card { - #define MMC_QUIRK_BROKEN_SD_CACHE (1<<15) /* Disable broken SD cache support */ +@@ -298,6 +298,7 @@ struct mmc_card { #define MMC_QUIRK_BROKEN_CACHE_FLUSH (1<<16) /* Don't flush cache until the write has occurred */ #define MMC_QUIRK_BROKEN_SD_POWEROFF_NOTIFY (1<<17) /* Disable broken SD poweroff notify support */ + #define MMC_QUIRK_NO_UHS_DDR50_TUNING (1<<18) /* Disable DDR50 tuning */ +#define MMC_QUIRK_WORKING_SD_CQ (1<<30) /* SD card has known-good CQ implementation */ #define MMC_QUIRK_ERASE_BROKEN (1<<31) /* Skip erase */ diff --git a/target/linux/bcm27xx/patches-6.6/950-1507-mmc-set-MMC_QUIRK_KNOWN_WORKING_SD_CQ-on-Raspberry-P.patch b/target/linux/bcm27xx/patches-6.6/950-1507-mmc-set-MMC_QUIRK_KNOWN_WORKING_SD_CQ-on-Raspberry-P.patch index 0dd1ffae7163d1..ac3e2ebf374a80 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1507-mmc-set-MMC_QUIRK_KNOWN_WORKING_SD_CQ-on-Raspberry-P.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1507-mmc-set-MMC_QUIRK_KNOWN_WORKING_SD_CQ-on-Raspberry-P.patch @@ -16,7 +16,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/mmc/core/card.h +++ b/drivers/mmc/core/card.h -@@ -90,6 +90,7 @@ struct mmc_fixup { +@@ -91,6 +91,7 @@ struct mmc_fixup { #define CID_MANFID_KINGSTON 0x70 #define CID_MANFID_HYNIX 0x90 #define CID_MANFID_KINGSTON_SD 0x9F @@ -26,7 +26,7 @@ Signed-off-by: Jonathan Bell #define END_FIXUP { NULL } --- a/drivers/mmc/core/quirks.h +++ b/drivers/mmc/core/quirks.h -@@ -66,6 +66,12 @@ static const struct mmc_fixup __maybe_un +@@ -76,6 +76,12 @@ static const struct mmc_fixup __maybe_un 0, -1ull, SDIO_ANY_ID, SDIO_ANY_ID, add_quirk_sd, MMC_QUIRK_BROKEN_SD_CACHE, EXT_CSD_REV_ANY), diff --git a/target/linux/bcm27xx/patches-6.6/950-1508-mmc-use-downstream-DT-property-to-modify-CQE-and-or-.patch b/target/linux/bcm27xx/patches-6.6/950-1508-mmc-use-downstream-DT-property-to-modify-CQE-and-or-.patch index 2139eef8be7ddb..cd29a177545bc2 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1508-mmc-use-downstream-DT-property-to-modify-CQE-and-or-.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1508-mmc-use-downstream-DT-property-to-modify-CQE-and-or-.patch @@ -49,7 +49,7 @@ Signed-off-by: Jonathan Bell if (host->caps & MMC_CAP_NONREMOVABLE) --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c -@@ -1506,8 +1506,8 @@ cont: +@@ -1522,8 +1522,8 @@ cont: goto free_card; } diff --git a/target/linux/gemini/patches-6.6/0005-net-ethernet-cortina-Use-TSO-also-on-common-TCP.patch b/target/linux/gemini/patches-6.6/0005-net-ethernet-cortina-Use-TSO-also-on-common-TCP.patch deleted file mode 100644 index c690b8fddb391c..00000000000000 --- a/target/linux/gemini/patches-6.6/0005-net-ethernet-cortina-Use-TSO-also-on-common-TCP.patch +++ /dev/null @@ -1,95 +0,0 @@ -From 91fb8a7328dda827bc6c0da240a1eb17028416cd Mon Sep 17 00:00:00 2001 -From: Linus Walleij -Date: Thu, 9 May 2024 23:59:28 +0200 -Subject: [PATCH 2/5] net: ethernet: cortina: Use TSO also on common TCP - -It is possible to push the segment offloader to also -process non-segmented frames: just pass the skb->len -or desired MSS to the offloader and it will handle them. - -This is especially good if the user sets up the MTU -and the frames get big, because the checksumming engine -cannot handle any frames bigger than 1518 bytes, so -segmenting them all to be at max that will be helpful -for the hardware, which only need to quirk odd frames -such as big UDP ping packets. - -The vendor driver always uses the TSO like this, and -the driver seems more stable after this, so apparently -the hardware may have been engineered to always use -the TSO on anything it can handle. - -Signed-off-by: Linus Walleij ---- - drivers/net/ethernet/cortina/gemini.c | 31 +++++++++++++++++++++------ - 1 file changed, 24 insertions(+), 7 deletions(-) - ---- a/drivers/net/ethernet/cortina/gemini.c -+++ b/drivers/net/ethernet/cortina/gemini.c -@@ -1148,6 +1148,7 @@ static int gmac_map_tx_bufs(struct net_d - struct gmac_txdesc *txd; - skb_frag_t *skb_frag; - dma_addr_t mapping; -+ bool tcp = false; - void *buffer; - u16 mss; - int ret; -@@ -1155,6 +1156,13 @@ static int gmac_map_tx_bufs(struct net_d - word1 = skb->len; - word3 = SOF_BIT; - -+ /* Determine if we are doing TCP */ -+ if (skb->protocol == htons(ETH_P_IP)) -+ tcp = (ip_hdr(skb)->protocol == IPPROTO_TCP); -+ else -+ /* IPv6 */ -+ tcp = (ipv6_hdr(skb)->nexthdr == IPPROTO_TCP); -+ - mss = skb_shinfo(skb)->gso_size; - if (mss) { - /* This means we are dealing with TCP and skb->len is the -@@ -1167,6 +1175,20 @@ static int gmac_map_tx_bufs(struct net_d - mss, skb->len); - word1 |= TSS_MTU_ENABLE_BIT; - word3 |= mss; -+ } else if (tcp) { -+ /* Even if we are not using TSO, use the segment offloader -+ * for transferring the TCP frame: the TSO engine will deal -+ * with chopping up frames that exceed ETH_DATA_LEN which -+ * the checksumming engine cannot handle (see below) into -+ * manageable chunks. It flawlessly deals with quite big -+ * frames and frames containing custom DSA EtherTypes. -+ */ -+ mss = netdev->mtu + skb_tcp_all_headers(skb); -+ mss = min(mss, skb->len); -+ netdev_dbg(netdev, "botched TSO len %04x mtu %04x mss %04x\n", -+ skb->len, netdev->mtu, mss); -+ word1 |= TSS_MTU_ENABLE_BIT; -+ word3 |= mss; - } else if (skb->len >= ETH_FRAME_LEN) { - /* Hardware offloaded checksumming isn't working on frames - * bigger than 1514 bytes. A hypothesis about this is that the -@@ -1185,21 +1207,16 @@ static int gmac_map_tx_bufs(struct net_d - } - - if (skb->ip_summed == CHECKSUM_PARTIAL) { -- int tcp = 0; -- - /* We do not switch off the checksumming on non TCP/UDP - * frames: as is shown from tests, the checksumming engine - * is smart enough to see that a frame is not actually TCP - * or UDP and then just pass it through without any changes - * to the frame. - */ -- if (skb->protocol == htons(ETH_P_IP)) { -+ if (skb->protocol == htons(ETH_P_IP)) - word1 |= TSS_IP_CHKSUM_BIT; -- tcp = ip_hdr(skb)->protocol == IPPROTO_TCP; -- } else { /* IPv6 */ -+ else - word1 |= TSS_IPV6_ENABLE_BIT; -- tcp = ipv6_hdr(skb)->nexthdr == IPPROTO_TCP; -- } - - word1 |= tcp ? TSS_TCP_CHKSUM_BIT : TSS_UDP_CHKSUM_BIT; - } diff --git a/target/linux/gemini/patches-6.6/0008-net-ethernet-cortina-Implement-.set_pauseparam.patch b/target/linux/gemini/patches-6.6/0008-net-ethernet-cortina-Implement-.set_pauseparam.patch index ad7594e855c722..687c352911fce4 100644 --- a/target/linux/gemini/patches-6.6/0008-net-ethernet-cortina-Implement-.set_pauseparam.patch +++ b/target/linux/gemini/patches-6.6/0008-net-ethernet-cortina-Implement-.set_pauseparam.patch @@ -16,7 +16,7 @@ Signed-off-by: Linus Walleij --- a/drivers/net/ethernet/cortina/gemini.c +++ b/drivers/net/ethernet/cortina/gemini.c -@@ -2143,6 +2143,19 @@ static void gmac_get_pauseparam(struct n +@@ -2147,6 +2147,19 @@ static void gmac_get_pauseparam(struct n pparam->autoneg = true; } @@ -36,7 +36,7 @@ Signed-off-by: Linus Walleij static void gmac_get_ringparam(struct net_device *netdev, struct ethtool_ringparam *rp, struct kernel_ethtool_ringparam *kernel_rp, -@@ -2263,6 +2276,7 @@ static const struct ethtool_ops gmac_351 +@@ -2267,6 +2280,7 @@ static const struct ethtool_ops gmac_351 .set_link_ksettings = gmac_set_ksettings, .nway_reset = gmac_nway_reset, .get_pauseparam = gmac_get_pauseparam, diff --git a/target/linux/generic/backport-6.6/602-v6.10-net-Use-backlog-NAPI-to-clean-up-the-defer_list.patch b/target/linux/generic/backport-6.6/602-v6.10-net-Use-backlog-NAPI-to-clean-up-the-defer_list.patch index d38231684d30b6..b721a16f18c298 100644 --- a/target/linux/generic/backport-6.6/602-v6.10-net-Use-backlog-NAPI-to-clean-up-the-defer_list.patch +++ b/target/linux/generic/backport-6.6/602-v6.10-net-Use-backlog-NAPI-to-clean-up-the-defer_list.patch @@ -36,7 +36,7 @@ Signed-off-by: Paolo Abeni --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h -@@ -3308,6 +3308,7 @@ static inline void dev_xmit_recursion_de +@@ -3309,6 +3309,7 @@ static inline void dev_xmit_recursion_de __this_cpu_dec(softnet_data.xmit.recursion); } diff --git a/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch b/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch index 9e0bd14acfafea..efc64121775b9b 100644 --- a/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch +++ b/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch @@ -37,7 +37,7 @@ Signed-off-by: David S. Miller --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h -@@ -4580,6 +4580,9 @@ static inline void netif_addr_unlock_bh( +@@ -4581,6 +4581,9 @@ static inline void netif_addr_unlock_bh( void ether_setup(struct net_device *dev); diff --git a/target/linux/generic/backport-6.6/850-v6.8-bus-mhi-host-Add-a-separate-timeout-parameter-for-wa.patch b/target/linux/generic/backport-6.6/850-v6.8-bus-mhi-host-Add-a-separate-timeout-parameter-for-wa.patch index 94d9bcd93d7c3d..4aad22248af463 100644 --- a/target/linux/generic/backport-6.6/850-v6.8-bus-mhi-host-Add-a-separate-timeout-parameter-for-wa.patch +++ b/target/linux/generic/backport-6.6/850-v6.8-bus-mhi-host-Add-a-separate-timeout-parameter-for-wa.patch @@ -109,7 +109,7 @@ Signed-off-by: Manivannan Sadhasivam if (ret) dev_err(dev, "Device failed to enter READY state\n"); } -@@ -1125,7 +1130,8 @@ int mhi_async_power_up(struct mhi_contro +@@ -1141,7 +1146,8 @@ int mhi_async_power_up(struct mhi_contro if (state == MHI_STATE_SYS_ERR) { mhi_set_mhi_state(mhi_cntrl, MHI_STATE_RESET); ret = mhi_poll_reg_field(mhi_cntrl, mhi_cntrl->regs, MHICTRL, @@ -119,7 +119,7 @@ Signed-off-by: Manivannan Sadhasivam if (ret) { dev_info(dev, "Failed to reset MHI due to syserr state\n"); goto error_exit; -@@ -1216,14 +1222,18 @@ EXPORT_SYMBOL_GPL(mhi_power_down); +@@ -1232,14 +1238,18 @@ EXPORT_SYMBOL_GPL(mhi_power_down); int mhi_sync_power_up(struct mhi_controller *mhi_cntrl) { int ret = mhi_async_power_up(mhi_cntrl); diff --git a/target/linux/generic/backport-6.6/853-v6.10-bus-mhi-host-Add-mhi_power_down_keep_dev-API-to-supp.patch b/target/linux/generic/backport-6.6/853-v6.10-bus-mhi-host-Add-mhi_power_down_keep_dev-API-to-supp.patch index 826b39b51855a3..b3e702bd627604 100644 --- a/target/linux/generic/backport-6.6/853-v6.10-bus-mhi-host-Add-mhi_power_down_keep_dev-API-to-supp.patch +++ b/target/linux/generic/backport-6.6/853-v6.10-bus-mhi-host-Add-mhi_power_down_keep_dev-API-to-supp.patch @@ -49,7 +49,7 @@ mutex_lock(&mhi_cntrl->pm_mutex); -@@ -820,7 +829,10 @@ void mhi_pm_st_worker(struct work_struct +@@ -836,7 +845,10 @@ void mhi_pm_st_worker(struct work_struct mhi_pm_sys_error_transition(mhi_cntrl); break; case DEV_ST_TRANSITION_DISABLE: @@ -61,7 +61,7 @@ break; default: break; -@@ -1174,7 +1186,8 @@ error_exit: +@@ -1190,7 +1202,8 @@ error_exit: } EXPORT_SYMBOL_GPL(mhi_async_power_up); @@ -71,7 +71,7 @@ { enum mhi_pm_state cur_state, transition_state; struct device *dev = &mhi_cntrl->mhi_dev->dev; -@@ -1210,15 +1223,32 @@ void mhi_power_down(struct mhi_controlle +@@ -1226,15 +1239,32 @@ void mhi_power_down(struct mhi_controlle write_unlock_irq(&mhi_cntrl->pm_lock); mutex_unlock(&mhi_cntrl->pm_mutex); diff --git a/target/linux/generic/hack-6.6/800-GPIO-add-named-gpio-exports.patch b/target/linux/generic/hack-6.6/800-GPIO-add-named-gpio-exports.patch index e6dcdfd92b6a1b..9c3696e76a6f85 100644 --- a/target/linux/generic/hack-6.6/800-GPIO-add-named-gpio-exports.patch +++ b/target/linux/generic/hack-6.6/800-GPIO-add-named-gpio-exports.patch @@ -15,7 +15,7 @@ Signed-off-by: John Crispin #include "gpiolib.h" #include "gpiolib-of.h" -@@ -1129,3 +1131,73 @@ void of_gpiochip_remove(struct gpio_chip +@@ -1138,3 +1140,73 @@ void of_gpiochip_remove(struct gpio_chip { of_node_put(dev_of_node(&chip->gpiodev->dev)); } diff --git a/target/linux/generic/hack-6.6/902-debloat_proc.patch b/target/linux/generic/hack-6.6/902-debloat_proc.patch index e426c008d00a74..64472ad18fce8b 100644 --- a/target/linux/generic/hack-6.6/902-debloat_proc.patch +++ b/target/linux/generic/hack-6.6/902-debloat_proc.patch @@ -396,7 +396,7 @@ Signed-off-by: Felix Fietkau } --- a/net/ipv4/route.c +++ b/net/ipv4/route.c -@@ -381,6 +381,9 @@ static struct pernet_operations ip_rt_pr +@@ -385,6 +385,9 @@ static struct pernet_operations ip_rt_pr static int __init ip_rt_proc_init(void) { diff --git a/target/linux/generic/pending-6.6/532-jffs2_eofdetect.patch b/target/linux/generic/pending-6.6/532-jffs2_eofdetect.patch index 744fbd0e21790b..88bb14a02a6afa 100644 --- a/target/linux/generic/pending-6.6/532-jffs2_eofdetect.patch +++ b/target/linux/generic/pending-6.6/532-jffs2_eofdetect.patch @@ -45,7 +45,7 @@ Signed-off-by: Felix Fietkau if (ret < 0) goto out; -@@ -567,6 +573,17 @@ full_scan: +@@ -569,6 +575,17 @@ full_scan: return err; } diff --git a/target/linux/mvebu/patches-6.6/0003-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch b/target/linux/mvebu/patches-6.6/0003-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch index 2483dedfae7e82..2d7b6b5176210f 100644 --- a/target/linux/mvebu/patches-6.6/0003-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch +++ b/target/linux/mvebu/patches-6.6/0003-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch @@ -18,7 +18,7 @@ Signed-off-by: Linus Walleij --- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c -@@ -432,9 +432,7 @@ static int armada_37xx_gpio_direction_ou +@@ -433,9 +433,7 @@ static int armada_37xx_gpio_direction_ou reg = OUTPUT_EN; armada_37xx_update_reg(®, &en_offset); diff --git a/target/linux/mvebu/patches-6.6/0004-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch b/target/linux/mvebu/patches-6.6/0004-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch deleted file mode 100644 index 4fe9f1b7b8628e..00000000000000 --- a/target/linux/mvebu/patches-6.6/0004-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 57273ff8bb16f3842c2597b5bbcd49e7fa12edf7 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Wed, 14 May 2025 21:18:35 +0200 -Subject: [PATCH 4/7] pinctrl: armada-37xx: propagate error from - armada_37xx_gpio_get() - -The regmap_read() function can fail, so propagate its error up to -the stack instead of silently ignoring that. - -Signed-off-by: Imre Kaloz -Reviewed-by: Andrew Lunn -Signed-off-by: Gabor Juhos -Link: https://lore.kernel.org/20250514-pinctrl-a37xx-fixes-v2-4-07e9ac1ab737@gmail.com -Signed-off-by: Linus Walleij ---- - drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - ---- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c -+++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c -@@ -440,11 +440,14 @@ static int armada_37xx_gpio_get(struct g - struct armada_37xx_pinctrl *info = gpiochip_get_data(chip); - unsigned int reg = INPUT_VAL; - unsigned int val, mask; -+ int ret; - - armada_37xx_update_reg(®, &offset); - mask = BIT(offset); - -- regmap_read(info->regmap, reg, &val); -+ ret = regmap_read(info->regmap, reg, &val); -+ if (ret) -+ return ret; - - return (val & mask) != 0; - } diff --git a/target/linux/mvebu/patches-6.6/0005-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch b/target/linux/mvebu/patches-6.6/0005-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch deleted file mode 100644 index 2395a0665fcc17..00000000000000 --- a/target/linux/mvebu/patches-6.6/0005-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch +++ /dev/null @@ -1,42 +0,0 @@ -From bfa0ff804ffa8b1246ade8be08de98c9eb19d16f Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Wed, 14 May 2025 21:18:36 +0200 -Subject: [PATCH 5/7] pinctrl: armada-37xx: propagate error from - armada_37xx_pmx_gpio_set_direction() - -The armada_37xx_gpio_direction_{in,out}put() functions can fail, so -propagate their error values back to the stack instead of silently -ignoring those. - -Signed-off-by: Imre Kaloz -Reviewed-by: Andrew Lunn -Signed-off-by: Gabor Juhos -Link: https://lore.kernel.org/20250514-pinctrl-a37xx-fixes-v2-5-07e9ac1ab737@gmail.com -Signed-off-by: Linus Walleij ---- - drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - ---- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c -+++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c -@@ -472,16 +472,17 @@ static int armada_37xx_pmx_gpio_set_dire - { - struct armada_37xx_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); - struct gpio_chip *chip = range->gc; -+ int ret; - - dev_dbg(info->dev, "gpio_direction for pin %u as %s-%d to %s\n", - offset, range->name, offset, input ? "input" : "output"); - - if (input) -- armada_37xx_gpio_direction_input(chip, offset); -+ ret = armada_37xx_gpio_direction_input(chip, offset); - else -- armada_37xx_gpio_direction_output(chip, offset, 0); -+ ret = armada_37xx_gpio_direction_output(chip, offset, 0); - -- return 0; -+ return ret; - } - - static int armada_37xx_gpio_request_enable(struct pinctrl_dev *pctldev, diff --git a/target/linux/mvebu/patches-6.6/0006-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch b/target/linux/mvebu/patches-6.6/0006-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch deleted file mode 100644 index 9aac2e58e1ddbe..00000000000000 --- a/target/linux/mvebu/patches-6.6/0006-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 6481c0a83367b0672951ccc876fbae7ee37b594b Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Wed, 14 May 2025 21:18:37 +0200 -Subject: [PATCH 6/7] pinctrl: armada-37xx: propagate error from - armada_37xx_gpio_get_direction() - -The regmap_read() function can fail, so propagate its error up to -the stack instead of silently ignoring that. - -Signed-off-by: Imre Kaloz -Reviewed-by: Andrew Lunn -Signed-off-by: Gabor Juhos -Link: https://lore.kernel.org/20250514-pinctrl-a37xx-fixes-v2-6-07e9ac1ab737@gmail.com -Signed-off-by: Linus Walleij ---- - drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - ---- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c -+++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c -@@ -402,10 +402,13 @@ static int armada_37xx_gpio_get_directio - struct armada_37xx_pinctrl *info = gpiochip_get_data(chip); - unsigned int reg = OUTPUT_EN; - unsigned int val, mask; -+ int ret; - - armada_37xx_update_reg(®, &offset); - mask = BIT(offset); -- regmap_read(info->regmap, reg, &val); -+ ret = regmap_read(info->regmap, reg, &val); -+ if (ret) -+ return ret; - - if (val & mask) - return GPIO_LINE_DIRECTION_OUT; diff --git a/target/linux/mvebu/patches-6.6/0007-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch b/target/linux/mvebu/patches-6.6/0007-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch deleted file mode 100644 index 6c14e50b4a733a..00000000000000 --- a/target/linux/mvebu/patches-6.6/0007-v6.16-pinctrl-armada-37xx-propagate-error-from-armada_37xx.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 4229c28323db141eda69cb99427be75d3edba071 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Wed, 14 May 2025 21:18:38 +0200 -Subject: [PATCH 7/7] pinctrl: armada-37xx: propagate error from - armada_37xx_pmx_set_by_name() - -The regmap_update_bits() function can fail, so propagate its error -up to the stack instead of silently ignoring that. - -Signed-off-by: Imre Kaloz -Reviewed-by: Andrew Lunn -Signed-off-by: Gabor Juhos -Link: https://lore.kernel.org/20250514-pinctrl-a37xx-fixes-v2-7-07e9ac1ab737@gmail.com -Signed-off-by: Linus Walleij ---- - drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - ---- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c -+++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c -@@ -358,9 +358,7 @@ static int armada_37xx_pmx_set_by_name(s - - val = grp->val[func]; - -- regmap_update_bits(info->regmap, reg, mask, val); -- -- return 0; -+ return regmap_update_bits(info->regmap, reg, mask, val); - } - - static int armada_37xx_pmx_set(struct pinctrl_dev *pctldev, diff --git a/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch b/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch index 01ecb16aeb196a..6c6cff13c9c95e 100644 --- a/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch +++ b/target/linux/ramips/patches-6.6/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 -@@ -3296,6 +3296,18 @@ static const struct usb_device_id uvc_id +@@ -3307,6 +3307,18 @@ static const struct usb_device_id uvc_id .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) }, From ad765d3cc4035406a4cd748f3339301ecc19dba8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= Date: Thu, 26 Jun 2025 11:28:06 +0200 Subject: [PATCH 764/877] mt76: fix system recovery routine for MT7915 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These patches are part of an mt76 update in main branch. Link: https://github.com/freifunk-gluon/gluon/pull/3436 Signed-off-by: Thibaut VARÈNE Link: https://github.com/openwrt/openwrt/pull/19239 Signed-off-by: Hauke Mehrtens --- ..._mcu_increase_eeprom_command_timeout.patch | 29 ++++++++++ ...t76_mt7915_mcu_lower_default_timeout.patch | 29 ++++++++++ ...15_mcu_re-init_MCU_before_loading_FW.patch | 56 +++++++++++++++++++ 3 files changed, 114 insertions(+) create mode 100644 package/kernel/mt76/patches/200-wifi_mt76_mt7915_mcu_increase_eeprom_command_timeout.patch create mode 100644 package/kernel/mt76/patches/201-wifi_mt76_mt7915_mcu_lower_default_timeout.patch create mode 100644 package/kernel/mt76/patches/202-wifi_mt76_mt7915_mcu_re-init_MCU_before_loading_FW.patch diff --git a/package/kernel/mt76/patches/200-wifi_mt76_mt7915_mcu_increase_eeprom_command_timeout.patch b/package/kernel/mt76/patches/200-wifi_mt76_mt7915_mcu_increase_eeprom_command_timeout.patch new file mode 100644 index 00000000000000..e618e536e6bb79 --- /dev/null +++ b/package/kernel/mt76/patches/200-wifi_mt76_mt7915_mcu_increase_eeprom_command_timeout.patch @@ -0,0 +1,29 @@ +From ee6dac9b6b765e8aab5727688463880c52f6193d Mon Sep 17 00:00:00 2001 +From: David Bauer +Date: Wed, 2 Apr 2025 02:45:26 +0200 +Subject: [PATCH] wifi: mt76: mt7915: mcu: increase eeprom command timeout + +Increase the timeout for MCU_EXT_CMD_EFUSE_BUFFER_MODE command. + +Regular retries upon hardware-recovery have been observed. Increasing +the timeout slightly remedies this problem. + +Signed-off-by: David Bauer +Link: https://patch.msgid.link/20250402004528.1036715-2-mail@david-bauer.net +Signed-off-by: Felix Fietkau +--- + mt7915/mcu.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/mt7915/mcu.c ++++ b/mt7915/mcu.c +@@ -208,6 +208,9 @@ mt7915_mcu_set_timeout(struct mt76_dev * + case MCU_EXT_CMD_BSS_INFO_UPDATE: + mdev->mcu.timeout = 2 * HZ; + return; ++ case MCU_EXT_CMD_EFUSE_BUFFER_MODE: ++ mdev->mcu.timeout = 10 * HZ; ++ return; + default: + break; + } diff --git a/package/kernel/mt76/patches/201-wifi_mt76_mt7915_mcu_lower_default_timeout.patch b/package/kernel/mt76/patches/201-wifi_mt76_mt7915_mcu_lower_default_timeout.patch new file mode 100644 index 00000000000000..a624fcfa0a21eb --- /dev/null +++ b/package/kernel/mt76/patches/201-wifi_mt76_mt7915_mcu_lower_default_timeout.patch @@ -0,0 +1,29 @@ +From 0534761b76e1b2e3390b345e524ce959f3fa50fb Mon Sep 17 00:00:00 2001 +From: David Bauer +Date: Wed, 2 Apr 2025 02:45:25 +0200 +Subject: [PATCH] wifi: mt76: mt7915: mcu: lower default timeout + +The default timeout set in mt76_connac2_mcu_fill_message of 20 seconds +leads to excessive stalling in case messages are lost. + +Testing showed that a smaller timeout of 5 seconds is sufficient in +normal operation. + +Signed-off-by: David Bauer +Link: https://patch.msgid.link/20250402004528.1036715-1-mail@david-bauer.net +Signed-off-by: Felix Fietkau +--- + mt7915/mcu.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/mt7915/mcu.c ++++ b/mt7915/mcu.c +@@ -197,6 +197,8 @@ mt7915_mcu_parse_response(struct mt76_de + static void + mt7915_mcu_set_timeout(struct mt76_dev *mdev, int cmd) + { ++ mdev->mcu.timeout = 5 * HZ; ++ + if ((cmd & __MCU_CMD_FIELD_ID) != MCU_CMD_EXT_CID) + return; + diff --git a/package/kernel/mt76/patches/202-wifi_mt76_mt7915_mcu_re-init_MCU_before_loading_FW.patch b/package/kernel/mt76/patches/202-wifi_mt76_mt7915_mcu_re-init_MCU_before_loading_FW.patch new file mode 100644 index 00000000000000..76d005fc21c5d4 --- /dev/null +++ b/package/kernel/mt76/patches/202-wifi_mt76_mt7915_mcu_re-init_MCU_before_loading_FW.patch @@ -0,0 +1,56 @@ +From 79dd14f2e8161b656341b6653261779199aedbe4 Mon Sep 17 00:00:00 2001 +From: David Bauer +Date: Wed, 2 Apr 2025 02:45:27 +0200 +Subject: [PATCH] wifi: mt76: mt7915: mcu: re-init MCU before loading FW patch + +Restart the MCU and release the patch semaphore before loading the MCU +patch firmware from the host. + +This fixes failures upon error recovery in case the semaphore was +previously taken and never released by the host. + +This happens from time to time upon triggering a full-chip error +recovery. Under this circumstance, the hardware restart fails and the +radio is rendered inoperational. + +Signed-off-by: David Bauer +Link: https://patch.msgid.link/20250402004528.1036715-3-mail@david-bauer.net +Signed-off-by: Felix Fietkau +--- + mt7915/mcu.c | 25 +++++++++++++++---------- + 1 file changed, 15 insertions(+), 10 deletions(-) + +--- a/mt7915/mcu.c ++++ b/mt7915/mcu.c +@@ -2097,16 +2097,21 @@ static int mt7915_load_firmware(struct m + { + int ret; + +- /* make sure fw is download state */ +- if (mt7915_firmware_state(dev, false)) { +- /* restart firmware once */ +- mt76_connac_mcu_restart(&dev->mt76); +- ret = mt7915_firmware_state(dev, false); +- if (ret) { +- dev_err(dev->mt76.dev, +- "Firmware is not ready for download\n"); +- return ret; +- } ++ /* Release Semaphore if taken by previous failed attempt */ ++ ret = mt76_connac_mcu_patch_sem_ctrl(&dev->mt76, false); ++ if (ret != PATCH_REL_SEM_SUCCESS) { ++ dev_err(dev->mt76.dev, "Could not release semaphore\n"); ++ /* Continue anyways */ ++ } ++ ++ /* Always restart MCU firmware */ ++ mt76_connac_mcu_restart(&dev->mt76); ++ ++ /* Check if MCU is ready */ ++ ret = mt7915_firmware_state(dev, false); ++ if (ret) { ++ dev_err(dev->mt76.dev, "Firmware did not enter download state\n"); ++ return ret; + } + + ret = mt76_connac2_load_patch(&dev->mt76, fw_name_var(dev, ROM_PATCH)); From 6becf1877e66e84faf4a6709c1465474639d739a Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Thu, 8 May 2025 20:10:02 +0800 Subject: [PATCH 765/877] rockchip: armv8: Refresh kernel config Run 'make kernel_oldconfig' to get an up-to-date config. Signed-off-by: Chukun Pan Link: https://github.com/openwrt/openwrt/pull/18800 Signed-off-by: Robert Marko (cherry picked from commit e66437a1ea72eafd27282303fe968aac83dcc397) Link: https://github.com/openwrt/openwrt/pull/19272 Signed-off-by: Hauke Mehrtens --- target/linux/rockchip/armv8/config-6.6 | 5 ----- 1 file changed, 5 deletions(-) diff --git a/target/linux/rockchip/armv8/config-6.6 b/target/linux/rockchip/armv8/config-6.6 index 6a1cc94bf70c4d..226c32a2d807bf 100644 --- a/target/linux/rockchip/armv8/config-6.6 +++ b/target/linux/rockchip/armv8/config-6.6 @@ -51,7 +51,6 @@ CONFIG_ARM64_PA_BITS_48=y CONFIG_ARM64_PTR_AUTH=y CONFIG_ARM64_PTR_AUTH_KERNEL=y CONFIG_ARM64_RAS_EXTN=y -CONFIG_ARM64_SME=y CONFIG_ARM64_SVE=y CONFIG_ARM64_TAGGED_ADDR_ABI=y CONFIG_ARM64_VA_BITS=48 @@ -178,8 +177,6 @@ CONFIG_CPU_THERMAL=y CONFIG_CRASH_CORE=y CONFIG_CRASH_DUMP=y CONFIG_CRC16=y -# CONFIG_CRC32_SARWATE is not set -CONFIG_CRC32_SLICEBY8=y CONFIG_CRC64=y CONFIG_CRC64_ROCKSOFT=y CONFIG_CRC_T10DIF=y @@ -258,7 +255,6 @@ CONFIG_FUNCTION_ALIGNMENT_4B=y CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y CONFIG_GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_ARGS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ARCH_TOPOLOGY=y @@ -693,7 +689,6 @@ CONFIG_TYPEC_TCPM=y # CONFIG_TYPEC_WUSB3801 is not set # CONFIG_UCLAMP_TASK is not set # CONFIG_UEVENT_HELPER is not set -CONFIG_UNINLINE_SPIN_UNLOCK=y CONFIG_UNMAP_KERNEL_AT_EL0=y CONFIG_USB=y CONFIG_USB_COMMON=y From ccc61439a39a7fe9a221264a52bbcd3366e04843 Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Fri, 9 May 2025 20:10:28 +0800 Subject: [PATCH 766/877] rockchip: replace RK356x RNG patch with upstream Replace RK356x RNG patch with upstream version to add the tag flag them as upstreamed. Signed-off-by: Chukun Pan Link: https://github.com/openwrt/openwrt/pull/18800 Signed-off-by: Robert Marko (cherry picked from commit cca80986b5644c1c8c3895b88be6c03817f0c19a) Link: https://github.com/openwrt/openwrt/pull/19272 Signed-off-by: Hauke Mehrtens --- ...d-hwrng-driver-for-Rockchip-RK3568-.patch} | 41 ++++++++++--------- ...chip-add-DT-entry-for-RNG-to-RK356x.patch} | 20 ++++----- ...ip-drop-obsolete-reset-names-from-rk.patch | 28 +++++++++++++ ...p-add-reset-names-for-combphy-on-rk.patch} | 4 +- 4 files changed, 61 insertions(+), 32 deletions(-) rename target/linux/rockchip/patches-6.6/{300-hwrng-add-hwrng-driver-for-Rockchip-RK3568-SoC.patch => 016-v6.12-hwrng-rockchip-add-hwrng-driver-for-Rockchip-RK3568-.patch} (89%) rename target/linux/rockchip/patches-6.6/{301-arm64-dts-rockchip-add-DT-entry-for-RNG-to-RK3568.patch => 017-v6.12-arm64-dts-rockchip-add-DT-entry-for-RNG-to-RK356x.patch} (65%) create mode 100644 target/linux/rockchip/patches-6.6/018-v6.12-arm64-dts-rockchip-drop-obsolete-reset-names-from-rk.patch rename target/linux/rockchip/patches-6.6/{016-v6.13-arm64-dts-rockchip-add-reset-names-for-combphy-on-rk3568.patch => 019-v6.13-arm64-dts-rockchip-add-reset-names-for-combphy-on-rk.patch} (97%) diff --git a/target/linux/rockchip/patches-6.6/300-hwrng-add-hwrng-driver-for-Rockchip-RK3568-SoC.patch b/target/linux/rockchip/patches-6.6/016-v6.12-hwrng-rockchip-add-hwrng-driver-for-Rockchip-RK3568-.patch similarity index 89% rename from target/linux/rockchip/patches-6.6/300-hwrng-add-hwrng-driver-for-Rockchip-RK3568-SoC.patch rename to target/linux/rockchip/patches-6.6/016-v6.12-hwrng-rockchip-add-hwrng-driver-for-Rockchip-RK3568-.patch index 683d1b1d5e51c9..7eed8cc877446d 100644 --- a/target/linux/rockchip/patches-6.6/300-hwrng-add-hwrng-driver-for-Rockchip-RK3568-SoC.patch +++ b/target/linux/rockchip/patches-6.6/016-v6.12-hwrng-rockchip-add-hwrng-driver-for-Rockchip-RK3568-.patch @@ -1,7 +1,7 @@ -From cea47ad1fbd46d3096fcf5c6905db3d12b5da960 Mon Sep 17 00:00:00 2001 +From dcf4fef6631c302f9bdd188979fe3172e47a29c7 Mon Sep 17 00:00:00 2001 From: Aurelien Jarno -Date: Sun, 21 Jul 2024 01:48:04 +0100 -Subject: [PATCH 2/3] hwrng: add hwrng driver for Rockchip RK3568 SoC +Date: Tue, 30 Jul 2024 17:11:04 +0100 +Subject: [PATCH] hwrng: rockchip - add hwrng driver for Rockchip RK3568 SoC Rockchip SoCs used to have a random number generator as part of their crypto device, and support for it has to be added to the corresponding @@ -11,17 +11,21 @@ greatly inspired from the downstream driver. The TRNG device does not seem to have a signal conditionner and the FIPS 140-2 test returns a lot of failures. They can be reduced by increasing -rockchip,sample-count in DT, in a tradeoff between quality and speed. +RK_RNG_SAMPLE_CNT, in a tradeoff between quality and speed. This value +has been adjusted to get ~90% of successes and the quality value has +been set accordingly. Signed-off-by: Aurelien Jarno -[daniel@makrotpia.org: code style fixes, add DT properties] +[daniel@makrotpia.org: code style fixes] Signed-off-by: Daniel Golle Acked-by: Krzysztof Kozlowski +Signed-off-by: Herbert Xu --- + MAINTAINERS | 1 + drivers/char/hw_random/Kconfig | 14 ++ drivers/char/hw_random/Makefile | 1 + - drivers/char/hw_random/rockchip-rng.c | 230 ++++++++++++++++++++++++++ - 4 files changed, 246 insertions(+) + drivers/char/hw_random/rockchip-rng.c | 227 ++++++++++++++++++++++++++ + 4 files changed, 243 insertions(+) create mode 100644 drivers/char/hw_random/rockchip-rng.c --- a/drivers/char/hw_random/Kconfig @@ -57,7 +61,7 @@ Acked-by: Krzysztof Kozlowski obj-$(CONFIG_HW_RANDOM_JH7110) += jh7110-trng.o --- /dev/null +++ b/drivers/char/hw_random/rockchip-rng.c -@@ -0,0 +1,230 @@ +@@ -0,0 +1,227 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * rockchip-rng.c True Random Number Generator driver for Rockchip RK3568 SoC @@ -85,6 +89,13 @@ Acked-by: Krzysztof Kozlowski +#define RK_RNG_POLL_PERIOD_US 100 +#define RK_RNG_POLL_TIMEOUT_US 10000 + ++/* ++ * TRNG collects osc ring output bit every RK_RNG_SAMPLE_CNT time. The value is ++ * a tradeoff between speed and quality and has been adjusted to get a quality ++ * of ~900 (~87.5% of FIPS 140-2 successes). ++ */ ++#define RK_RNG_SAMPLE_CNT 1000 ++ +/* TRNG registers from RK3568 TRM-Part2, section 5.4.1 */ +#define TRNG_RST_CTL 0x0004 +#define TRNG_RNG_CTL 0x0400 @@ -108,7 +119,6 @@ Acked-by: Krzysztof Kozlowski + struct reset_control *rst; + int clk_num; + struct clk_bulk_data *clk_bulks; -+ u32 sample_cnt; +}; + +/* The mask in the upper 16 bits determines the bits that are updated */ @@ -131,7 +141,7 @@ Acked-by: Krzysztof Kozlowski + } + + /* set the sample period */ -+ writel(rk_rng->sample_cnt, rk_rng->base + TRNG_RNG_SAMPLE_CNT); ++ writel(RK_RNG_SAMPLE_CNT, rk_rng->base + TRNG_RNG_SAMPLE_CNT); + + /* set osc ring speed and enable it */ + rk_rng_write_ctl(rk_rng, TRNG_RNG_CTL_LEN_256_BIT | @@ -187,7 +197,6 @@ Acked-by: Krzysztof Kozlowski +{ + struct device *dev = &pdev->dev; + struct rk_rng *rk_rng; -+ u32 quality; + int ret; + + rk_rng = devm_kzalloc(dev, sizeof(*rk_rng), GFP_KERNEL); @@ -208,14 +217,6 @@ Acked-by: Krzysztof Kozlowski + return dev_err_probe(dev, PTR_ERR(rk_rng->rst), + "Failed to get reset property\n"); + -+ ret = of_property_read_u32(dev->of_node, "rockchip,sample-count", &rk_rng->sample_cnt); -+ if (ret) -+ return dev_err_probe(dev, ret, "Failed to get sample-count property\n"); -+ -+ ret = of_property_read_u32(dev->of_node, "quality", &quality); -+ if (ret || quality > 1024) -+ return dev_err_probe(dev, ret, "Failed to get quality property\n"); -+ + reset_control_assert(rk_rng->rst); + udelay(2); + reset_control_deassert(rk_rng->rst); @@ -229,7 +230,7 @@ Acked-by: Krzysztof Kozlowski + } + rk_rng->rng.read = rk_rng_read; + rk_rng->rng.priv = (unsigned long) dev; -+ rk_rng->rng.quality = quality; ++ rk_rng->rng.quality = 900; + + pm_runtime_set_autosuspend_delay(dev, RK_RNG_AUTOSUSPEND_DELAY); + pm_runtime_use_autosuspend(dev); diff --git a/target/linux/rockchip/patches-6.6/301-arm64-dts-rockchip-add-DT-entry-for-RNG-to-RK3568.patch b/target/linux/rockchip/patches-6.6/017-v6.12-arm64-dts-rockchip-add-DT-entry-for-RNG-to-RK356x.patch similarity index 65% rename from target/linux/rockchip/patches-6.6/301-arm64-dts-rockchip-add-DT-entry-for-RNG-to-RK3568.patch rename to target/linux/rockchip/patches-6.6/017-v6.12-arm64-dts-rockchip-add-DT-entry-for-RNG-to-RK356x.patch index 6ba8002c756f23..bd25881f6b6368 100644 --- a/target/linux/rockchip/patches-6.6/301-arm64-dts-rockchip-add-DT-entry-for-RNG-to-RK3568.patch +++ b/target/linux/rockchip/patches-6.6/017-v6.12-arm64-dts-rockchip-add-DT-entry-for-RNG-to-RK356x.patch @@ -1,27 +1,27 @@ -From 756e7d3251ad8f6c72e7bf4c476537a89f673e38 Mon Sep 17 00:00:00 2001 +From afeccc4084963aaa932931b734c8def55613c483 Mon Sep 17 00:00:00 2001 From: Aurelien Jarno -Date: Sun, 21 Jul 2024 01:48:38 +0100 -Subject: [PATCH 3/3] arm64: dts: rockchip: add DT entry for RNG to RK356x +Date: Tue, 30 Jul 2024 17:11:44 +0100 +Subject: [PATCH] arm64: dts: rockchip: add DT entry for RNG to RK356x -Enable the just added Rockchip RNG driver for RK356x SoCs. +Include the just added Rockchip RNG driver for RK356x SoCs and +enable it on RK3568. Signed-off-by: Aurelien Jarno Signed-off-by: Daniel Golle +Link: https://lore.kernel.org/r/d2beb15377dc8b580ca5557b1a4a6f50b74055aa.1722355365.git.daniel@makrotopia.org +Signed-off-by: Heiko Stuebner --- - arch/arm64/boot/dts/rockchip/rk3568.dtsi | 7 +++++++ + arch/arm64/boot/dts/rockchip/rk3568.dtsi | 4 ++++ arch/arm64/boot/dts/rockchip/rk356x.dtsi | 10 ++++++++++ - 2 files changed, 17 insertions(+) + 2 files changed, 14 insertions(+) --- a/arch/arm64/boot/dts/rockchip/rk3568.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3568.dtsi -@@ -258,6 +258,13 @@ +@@ -257,6 +257,10 @@ }; }; +&rng { -+ rockchip,sample-count = <1000>; -+ quality = <900>; -+ + status = "okay"; +}; + diff --git a/target/linux/rockchip/patches-6.6/018-v6.12-arm64-dts-rockchip-drop-obsolete-reset-names-from-rk.patch b/target/linux/rockchip/patches-6.6/018-v6.12-arm64-dts-rockchip-drop-obsolete-reset-names-from-rk.patch new file mode 100644 index 00000000000000..14fcf50c22d25d --- /dev/null +++ b/target/linux/rockchip/patches-6.6/018-v6.12-arm64-dts-rockchip-drop-obsolete-reset-names-from-rk.patch @@ -0,0 +1,28 @@ +From ec532f3591ce6e6ed5ec6c35773a66aae118e1f0 Mon Sep 17 00:00:00 2001 +From: Heiko Stuebner +Date: Thu, 15 Aug 2024 18:25:19 +0200 +Subject: [PATCH] arm64: dts: rockchip: drop obsolete reset-names from rk356x + rng node + +The reset-names property is not part of the binding, so drop it. +It is also not used by the driver, so that property was likely +a leftover from some vendor-kernel node. + +Fixes: afeccc408496 ("arm64: dts: rockchip: add DT entry for RNG to RK356x") +Reported-by: Rob Herring +Signed-off-by: Heiko Stuebner +Link: https://lore.kernel.org/r/20240815162519.751193-1-heiko@sntech.de +--- + arch/arm64/boot/dts/rockchip/rk356x.dtsi | 1 - + 1 file changed, 1 deletion(-) + +--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi +@@ -1112,7 +1112,6 @@ + clocks = <&cru CLK_TRNG_NS>, <&cru HCLK_TRNG_NS>; + clock-names = "core", "ahb"; + resets = <&cru SRST_TRNG_NS>; +- reset-names = "reset"; + status = "disabled"; + }; + diff --git a/target/linux/rockchip/patches-6.6/016-v6.13-arm64-dts-rockchip-add-reset-names-for-combphy-on-rk3568.patch b/target/linux/rockchip/patches-6.6/019-v6.13-arm64-dts-rockchip-add-reset-names-for-combphy-on-rk.patch similarity index 97% rename from target/linux/rockchip/patches-6.6/016-v6.13-arm64-dts-rockchip-add-reset-names-for-combphy-on-rk3568.patch rename to target/linux/rockchip/patches-6.6/019-v6.13-arm64-dts-rockchip-add-reset-names-for-combphy-on-rk.patch index 7a8f86a46fdd82..e98db5ffec5ad1 100644 --- a/target/linux/rockchip/patches-6.6/016-v6.13-arm64-dts-rockchip-add-reset-names-for-combphy-on-rk3568.patch +++ b/target/linux/rockchip/patches-6.6/019-v6.13-arm64-dts-rockchip-add-reset-names-for-combphy-on-rk.patch @@ -26,7 +26,7 @@ Signed-off-by: Heiko Stuebner #phy-cells = <1>; --- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi -@@ -1747,6 +1747,7 @@ +@@ -1756,6 +1756,7 @@ assigned-clocks = <&pmucru CLK_PCIEPHY1_REF>; assigned-clock-rates = <100000000>; resets = <&cru SRST_PIPEPHY1>; @@ -34,7 +34,7 @@ Signed-off-by: Heiko Stuebner rockchip,pipe-grf = <&pipegrf>; rockchip,pipe-phy-grf = <&pipe_phy_grf1>; #phy-cells = <1>; -@@ -1763,6 +1764,7 @@ +@@ -1772,6 +1773,7 @@ assigned-clocks = <&pmucru CLK_PCIEPHY2_REF>; assigned-clock-rates = <100000000>; resets = <&cru SRST_PIPEPHY2>; From 5889aae07a51f5f01fc415f9251460cc8d37d26f Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Sat, 10 May 2025 21:06:20 +0800 Subject: [PATCH 767/877] rockchip: backport PCIe MSI fixes for RK356x SoC Backport GIC ITS support for RK356x SoC, which fixes long-standing MSI/MSI-X bug. (Previously MSI-X could only work on one PCIe node) e.g. [ 7.250882] r8125 0002:01:00.0: no MSI/MSI-X. Back to INTx. Tested on Radxa E25 with kmod-r8125-rss driver. Signed-off-by: Chukun Pan Link: https://github.com/openwrt/openwrt/pull/18800 Signed-off-by: Robert Marko (cherry picked from commit 6b99c5d21e8245e982c847189897040c55751d17) Link: https://github.com/openwrt/openwrt/pull/19272 Signed-off-by: Hauke Mehrtens --- target/linux/rockchip/armv8/config-6.6 | 1 + ...ts-Share-ITS-tables-with-a-non-trust.patch | 337 ++++++++++++++++++ ...its-Fix-over-allocation-in-itt_alloc.patch | 33 ++ ...-Rockchip-3568002-erratum-workaround.patch | 105 ++++++ ...kchip-rk356x-Add-MSI-controller-node.patch | 51 +++ ...chip-rk356x-Move-PCIe-MSI-to-use-GIC.patch | 28 ++ ...ip-Move-rk3568-PCIe3-MSI-to-use-GIC-.patch | 54 +++ 7 files changed, 609 insertions(+) create mode 100644 target/linux/rockchip/patches-6.6/020-v6.13-irqchip-gic-v3-its-Share-ITS-tables-with-a-non-trust.patch create mode 100644 target/linux/rockchip/patches-6.6/021-v6.13-irqchip-gic-v3-its-Fix-over-allocation-in-itt_alloc.patch create mode 100644 target/linux/rockchip/patches-6.6/022-v6.15-irqchip-gic-v3-Add-Rockchip-3568002-erratum-workaround.patch create mode 100644 target/linux/rockchip/patches-6.6/023-01-v6.15-arm64-dts-rockchip-rk356x-Add-MSI-controller-node.patch create mode 100644 target/linux/rockchip/patches-6.6/023-02-v6.15-arm64-dts-rockchip-rk356x-Move-PCIe-MSI-to-use-GIC.patch create mode 100644 target/linux/rockchip/patches-6.6/024-v6.16-arm64-dts-rockchip-Move-rk3568-PCIe3-MSI-to-use-GIC-.patch diff --git a/target/linux/rockchip/armv8/config-6.6 b/target/linux/rockchip/armv8/config-6.6 index 226c32a2d807bf..2bf069fa1918e9 100644 --- a/target/linux/rockchip/armv8/config-6.6 +++ b/target/linux/rockchip/armv8/config-6.6 @@ -565,6 +565,7 @@ CONFIG_RELOCATABLE=y CONFIG_RESET_CONTROLLER=y CONFIG_RESET_SCMI=y CONFIG_RFS_ACCEL=y +CONFIG_ROCKCHIP_ERRATUM_3568002=y CONFIG_ROCKCHIP_ERRATUM_3588001=y CONFIG_ROCKCHIP_GRF=y CONFIG_ROCKCHIP_IODOMAIN=y diff --git a/target/linux/rockchip/patches-6.6/020-v6.13-irqchip-gic-v3-its-Share-ITS-tables-with-a-non-trust.patch b/target/linux/rockchip/patches-6.6/020-v6.13-irqchip-gic-v3-its-Share-ITS-tables-with-a-non-trust.patch new file mode 100644 index 00000000000000..92e9bf6c868d84 --- /dev/null +++ b/target/linux/rockchip/patches-6.6/020-v6.13-irqchip-gic-v3-its-Share-ITS-tables-with-a-non-trust.patch @@ -0,0 +1,337 @@ +From b08e2f42e86b5848add254da45b56fc672e2bced Mon Sep 17 00:00:00 2001 +From: Steven Price +Date: Wed, 2 Oct 2024 15:16:29 +0100 +Subject: [PATCH] irqchip/gic-v3-its: Share ITS tables with a non-trusted + hypervisor + +Within a realm guest the ITS is emulated by the host. This means the +allocations must have been made available to the host by a call to +set_memory_decrypted(). Introduce an allocation function which performs +this extra call. + +For the ITT use a custom genpool-based allocator that calls +set_memory_decrypted() for each page allocated, but then suballocates the +size needed for each ITT. Note that there is no mechanism implemented to +return pages from the genpool, but it is unlikely that the peak number of +devices will be much larger than the normal level - so this isn't expected +to be an issue. + +Co-developed-by: Suzuki K Poulose +Signed-off-by: Suzuki K Poulose +Signed-off-by: Steven Price +Signed-off-by: Thomas Gleixner +Tested-by: Will Deacon +Reviewed-by: Marc Zyngier +Link: https://lore.kernel.org/all/20241002141630.433502-2-steven.price@arm.com +--- + drivers/irqchip/irq-gic-v3-its.c | 138 +++++++++++++++++++++++++------ + 1 file changed, 115 insertions(+), 23 deletions(-) + +--- a/drivers/irqchip/irq-gic-v3-its.c ++++ b/drivers/irqchip/irq-gic-v3-its.c +@@ -12,12 +12,14 @@ + #include + #include + #include ++#include + #include + #include + #include + #include + #include + #include ++#include + #include + #include + #include +@@ -27,6 +29,7 @@ + #include + #include + #include ++#include + #include + #include + +@@ -163,6 +166,7 @@ struct its_device { + struct its_node *its; + struct event_lpi_map event_map; + void *itt; ++ u32 itt_sz; + u32 nr_ites; + u32 device_id; + bool shared; +@@ -198,6 +202,87 @@ static DEFINE_IDA(its_vpeid_ida); + #define gic_data_rdist_rd_base() (gic_data_rdist()->rd_base) + #define gic_data_rdist_vlpi_base() (gic_data_rdist_rd_base() + SZ_128K) + ++static struct page *its_alloc_pages_node(int node, gfp_t gfp, ++ unsigned int order) ++{ ++ struct page *page; ++ int ret = 0; ++ ++ page = alloc_pages_node(node, gfp, order); ++ ++ if (!page) ++ return NULL; ++ ++ ret = set_memory_decrypted((unsigned long)page_address(page), ++ 1 << order); ++ /* ++ * If set_memory_decrypted() fails then we don't know what state the ++ * page is in, so we can't free it. Instead we leak it. ++ * set_memory_decrypted() will already have WARNed. ++ */ ++ if (ret) ++ return NULL; ++ ++ return page; ++} ++ ++static struct page *its_alloc_pages(gfp_t gfp, unsigned int order) ++{ ++ return its_alloc_pages_node(NUMA_NO_NODE, gfp, order); ++} ++ ++static void its_free_pages(void *addr, unsigned int order) ++{ ++ /* ++ * If the memory cannot be encrypted again then we must leak the pages. ++ * set_memory_encrypted() will already have WARNed. ++ */ ++ if (set_memory_encrypted((unsigned long)addr, 1 << order)) ++ return; ++ free_pages((unsigned long)addr, order); ++} ++ ++static struct gen_pool *itt_pool; ++ ++static void *itt_alloc_pool(int node, int size) ++{ ++ unsigned long addr; ++ struct page *page; ++ ++ if (size >= PAGE_SIZE) { ++ page = its_alloc_pages_node(node, GFP_KERNEL | __GFP_ZERO, get_order(size)); ++ ++ return page ? page_address(page) : NULL; ++ } ++ ++ do { ++ addr = gen_pool_alloc(itt_pool, size); ++ if (addr) ++ break; ++ ++ page = its_alloc_pages_node(node, GFP_KERNEL | __GFP_ZERO, 1); ++ if (!page) ++ break; ++ ++ gen_pool_add(itt_pool, (unsigned long)page_address(page), PAGE_SIZE, node); ++ } while (!addr); ++ ++ return (void *)addr; ++} ++ ++static void itt_free_pool(void *addr, int size) ++{ ++ if (!addr) ++ return; ++ ++ if (size >= PAGE_SIZE) { ++ its_free_pages(addr, get_order(size)); ++ return; ++ } ++ ++ gen_pool_free(itt_pool, (unsigned long)addr, size); ++} ++ + /* + * Skip ITSs that have no vLPIs mapped, unless we're on GICv4.1, as we + * always have vSGIs mapped. +@@ -2192,7 +2277,8 @@ static struct page *its_allocate_prop_ta + { + struct page *prop_page; + +- prop_page = alloc_pages(gfp_flags, get_order(LPI_PROPBASE_SZ)); ++ prop_page = its_alloc_pages(gfp_flags, ++ get_order(LPI_PROPBASE_SZ)); + if (!prop_page) + return NULL; + +@@ -2203,8 +2289,7 @@ static struct page *its_allocate_prop_ta + + static void its_free_prop_table(struct page *prop_page) + { +- free_pages((unsigned long)page_address(prop_page), +- get_order(LPI_PROPBASE_SZ)); ++ its_free_pages(page_address(prop_page), get_order(LPI_PROPBASE_SZ)); + } + + static bool gic_check_reserved_range(phys_addr_t addr, unsigned long size) +@@ -2326,7 +2411,7 @@ static int its_setup_baser(struct its_no + order = get_order(GITS_BASER_PAGES_MAX * psz); + } + +- page = alloc_pages_node(its->numa_node, GFP_KERNEL | __GFP_ZERO, order); ++ page = its_alloc_pages_node(its->numa_node, GFP_KERNEL | __GFP_ZERO, order); + if (!page) + return -ENOMEM; + +@@ -2339,7 +2424,7 @@ static int its_setup_baser(struct its_no + /* 52bit PA is supported only when PageSize=64K */ + if (psz != SZ_64K) { + pr_err("ITS: no 52bit PA support when psz=%d\n", psz); +- free_pages((unsigned long)base, order); ++ its_free_pages(base, order); + return -ENXIO; + } + +@@ -2395,7 +2480,7 @@ retry_baser: + pr_err("ITS@%pa: %s doesn't stick: %llx %llx\n", + &its->phys_base, its_base_type_string[type], + val, tmp); +- free_pages((unsigned long)base, order); ++ its_free_pages(base, order); + return -ENXIO; + } + +@@ -2534,8 +2619,7 @@ static void its_free_tables(struct its_n + + for (i = 0; i < GITS_BASER_NR_REGS; i++) { + if (its->tables[i].base) { +- free_pages((unsigned long)its->tables[i].base, +- its->tables[i].order); ++ its_free_pages(its->tables[i].base, its->tables[i].order); + its->tables[i].base = NULL; + } + } +@@ -2801,7 +2885,7 @@ static bool allocate_vpe_l2_table(int cp + + /* Allocate memory for 2nd level table */ + if (!table[idx]) { +- page = alloc_pages(GFP_KERNEL | __GFP_ZERO, get_order(psz)); ++ page = its_alloc_pages(GFP_KERNEL | __GFP_ZERO, get_order(psz)); + if (!page) + return false; + +@@ -2920,7 +3004,7 @@ static int allocate_vpe_l1_table(void) + + pr_debug("np = %d, npg = %lld, psz = %d, epp = %d, esz = %d\n", + np, npg, psz, epp, esz); +- page = alloc_pages(GFP_ATOMIC | __GFP_ZERO, get_order(np * PAGE_SIZE)); ++ page = its_alloc_pages(GFP_ATOMIC | __GFP_ZERO, get_order(np * PAGE_SIZE)); + if (!page) + return -ENOMEM; + +@@ -2966,8 +3050,7 @@ static struct page *its_allocate_pending + { + struct page *pend_page; + +- pend_page = alloc_pages(gfp_flags | __GFP_ZERO, +- get_order(LPI_PENDBASE_SZ)); ++ pend_page = its_alloc_pages(gfp_flags | __GFP_ZERO, get_order(LPI_PENDBASE_SZ)); + if (!pend_page) + return NULL; + +@@ -2979,7 +3062,7 @@ static struct page *its_allocate_pending + + static void its_free_pending_table(struct page *pt) + { +- free_pages((unsigned long)page_address(pt), get_order(LPI_PENDBASE_SZ)); ++ its_free_pages(page_address(pt), get_order(LPI_PENDBASE_SZ)); + } + + /* +@@ -3314,8 +3397,8 @@ static bool its_alloc_table_entry(struct + + /* Allocate memory for 2nd level table */ + if (!table[idx]) { +- page = alloc_pages_node(its->numa_node, GFP_KERNEL | __GFP_ZERO, +- get_order(baser->psz)); ++ page = its_alloc_pages_node(its->numa_node, GFP_KERNEL | __GFP_ZERO, ++ get_order(baser->psz)); + if (!page) + return false; + +@@ -3410,7 +3493,6 @@ static struct its_device *its_create_dev + if (WARN_ON(!is_power_of_2(nvecs))) + nvecs = roundup_pow_of_two(nvecs); + +- dev = kzalloc(sizeof(*dev), GFP_KERNEL); + /* + * Even if the device wants a single LPI, the ITT must be + * sized as a power of two (and you need at least one bit...). +@@ -3418,7 +3500,11 @@ static struct its_device *its_create_dev + nr_ites = max(2, nvecs); + sz = nr_ites * (FIELD_GET(GITS_TYPER_ITT_ENTRY_SIZE, its->typer) + 1); + sz = max(sz, ITS_ITT_ALIGN) + ITS_ITT_ALIGN - 1; +- itt = kzalloc_node(sz, GFP_KERNEL, its->numa_node); ++ ++ itt = itt_alloc_pool(its->numa_node, sz); ++ ++ dev = kzalloc(sizeof(*dev), GFP_KERNEL); ++ + if (alloc_lpis) { + lpi_map = its_lpi_alloc(nvecs, &lpi_base, &nr_lpis); + if (lpi_map) +@@ -3430,9 +3516,9 @@ static struct its_device *its_create_dev + lpi_base = 0; + } + +- if (!dev || !itt || !col_map || (!lpi_map && alloc_lpis)) { ++ if (!dev || !itt || !col_map || (!lpi_map && alloc_lpis)) { + kfree(dev); +- kfree(itt); ++ itt_free_pool(itt, sz); + bitmap_free(lpi_map); + kfree(col_map); + return NULL; +@@ -3442,6 +3528,7 @@ static struct its_device *its_create_dev + + dev->its = its; + dev->itt = itt; ++ dev->itt_sz = sz; + dev->nr_ites = nr_ites; + dev->event_map.lpi_map = lpi_map; + dev->event_map.col_map = col_map; +@@ -3469,7 +3556,7 @@ static void its_free_device(struct its_d + list_del(&its_dev->entry); + raw_spin_unlock_irqrestore(&its_dev->its->lock, flags); + kfree(its_dev->event_map.col_map); +- kfree(its_dev->itt); ++ itt_free_pool(its_dev->itt, its_dev->itt_sz); + kfree(its_dev); + } + +@@ -5112,8 +5199,9 @@ static int __init its_probe_one(struct i + } + } + +- page = alloc_pages_node(its->numa_node, GFP_KERNEL | __GFP_ZERO, +- get_order(ITS_CMD_QUEUE_SZ)); ++ page = its_alloc_pages_node(its->numa_node, ++ GFP_KERNEL | __GFP_ZERO, ++ get_order(ITS_CMD_QUEUE_SZ)); + if (!page) { + err = -ENOMEM; + goto out_unmap_sgir; +@@ -5177,7 +5265,7 @@ static int __init its_probe_one(struct i + out_free_tables: + its_free_tables(its); + out_free_cmd: +- free_pages((unsigned long)its->cmd_base, get_order(ITS_CMD_QUEUE_SZ)); ++ its_free_pages(its->cmd_base, get_order(ITS_CMD_QUEUE_SZ)); + out_unmap_sgir: + if (its->sgir_base) + iounmap(its->sgir_base); +@@ -5659,6 +5747,10 @@ int __init its_init(struct fwnode_handle + bool has_v4_1 = false; + int err; + ++ itt_pool = gen_pool_create(get_order(ITS_ITT_ALIGN), -1); ++ if (!itt_pool) ++ return -ENOMEM; ++ + gic_rdists = rdists; + + its_parent = parent_domain; diff --git a/target/linux/rockchip/patches-6.6/021-v6.13-irqchip-gic-v3-its-Fix-over-allocation-in-itt_alloc.patch b/target/linux/rockchip/patches-6.6/021-v6.13-irqchip-gic-v3-its-Fix-over-allocation-in-itt_alloc.patch new file mode 100644 index 00000000000000..a716cbee7de7f5 --- /dev/null +++ b/target/linux/rockchip/patches-6.6/021-v6.13-irqchip-gic-v3-its-Fix-over-allocation-in-itt_alloc.patch @@ -0,0 +1,33 @@ +From bc88d44bd7e45b992cf8c2c2ffbc7bb3e24db4a7 Mon Sep 17 00:00:00 2001 +From: Steven Price +Date: Mon, 21 Oct 2024 11:41:05 +0100 +Subject: [PATCH] irqchip/gic-v3-its: Fix over allocation in + itt_alloc_pool() + +itt_alloc_pool() calls its_alloc_pages_node() to allocate an individual +page to add to the pool (for allocations +Signed-off-by: Steven Price +Signed-off-by: Thomas Gleixner +Link: https://lore.kernel.org/all/1f6e19c4-1fb9-43ab-a8a2-a465c9cff84b@arm.com +Closes: https://lore.kernel.org/r/ed65312a-245c-4fa5-91ad-5d620cab7c6b%40nvidia.com +--- + drivers/irqchip/irq-gic-v3-its.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/irqchip/irq-gic-v3-its.c ++++ b/drivers/irqchip/irq-gic-v3-its.c +@@ -260,7 +260,7 @@ static void *itt_alloc_pool(int node, in + if (addr) + break; + +- page = its_alloc_pages_node(node, GFP_KERNEL | __GFP_ZERO, 1); ++ page = its_alloc_pages_node(node, GFP_KERNEL | __GFP_ZERO, 0); + if (!page) + break; + diff --git a/target/linux/rockchip/patches-6.6/022-v6.15-irqchip-gic-v3-Add-Rockchip-3568002-erratum-workaround.patch b/target/linux/rockchip/patches-6.6/022-v6.15-irqchip-gic-v3-Add-Rockchip-3568002-erratum-workaround.patch new file mode 100644 index 00000000000000..9c9e643ff944f2 --- /dev/null +++ b/target/linux/rockchip/patches-6.6/022-v6.15-irqchip-gic-v3-Add-Rockchip-3568002-erratum-workaround.patch @@ -0,0 +1,105 @@ +From 2d81e1bb625238d40a686ed909ff3e1abab7556a Mon Sep 17 00:00:00 2001 +From: Dmitry Osipenko +Date: Mon, 17 Feb 2025 01:16:32 +0300 +Subject: [PATCH] irqchip/gic-v3: Add Rockchip 3568002 erratum workaround + +Rockchip RK3566/RK3568 GIC600 integration has DDR addressing +limited to the first 32bit of physical address space. Rockchip +assigned Erratum ID #3568002 for this issue. Add driver quirk for +this Rockchip GIC Erratum. + +Note, that the 0x0201743b GIC600 ID is not Rockchip-specific and is +common for many ARM GICv3 implementations. Hence, there is an extra +of_machine_is_compatible() check. + +Signed-off-by: Dmitry Osipenko +Signed-off-by: Thomas Gleixner +Acked-by: Marc Zyngier +Link: https://lore.kernel.org/all/20250216221634.364158-2-dmitry.osipenko@collabora.com +--- + Documentation/arch/arm64/silicon-errata.rst | 2 ++ + arch/arm64/Kconfig | 9 ++++++++ + drivers/irqchip/irq-gic-v3-its.c | 23 ++++++++++++++++++++- + 3 files changed, 33 insertions(+), 1 deletion(-) + +--- a/Documentation/arch/arm64/silicon-errata.rst ++++ b/Documentation/arch/arm64/silicon-errata.rst +@@ -270,6 +270,8 @@ stable kernels. + +----------------+-----------------+-----------------+-----------------------------+ + | Rockchip | RK3588 | #3588001 | ROCKCHIP_ERRATUM_3588001 | + +----------------+-----------------+-----------------+-----------------------------+ ++| Rockchip | RK3568 | #3568002 | ROCKCHIP_ERRATUM_3568002 | +++----------------+-----------------+-----------------+-----------------------------+ + + +----------------+-----------------+-----------------+-----------------------------+ + | Fujitsu | A64FX | E#010001 | FUJITSU_ERRATUM_010001 | +--- a/arch/arm64/Kconfig ++++ b/arch/arm64/Kconfig +@@ -1267,6 +1267,15 @@ config NVIDIA_CARMEL_CNP_ERRATUM + + If unsure, say Y. + ++config ROCKCHIP_ERRATUM_3568002 ++ bool "Rockchip 3568002: GIC600 can not access physical addresses higher than 4GB" ++ default y ++ help ++ The Rockchip RK3566 and RK3568 GIC600 SoC integrations have AXI ++ addressing limited to the first 32bit of physical address space. ++ ++ If unsure, say Y. ++ + config ROCKCHIP_ERRATUM_3588001 + bool "Rockchip 3588001: GIC600 can not support shareability attributes" + default y +--- a/drivers/irqchip/irq-gic-v3-its.c ++++ b/drivers/irqchip/irq-gic-v3-its.c +@@ -202,13 +202,15 @@ static DEFINE_IDA(its_vpeid_ida); + #define gic_data_rdist_rd_base() (gic_data_rdist()->rd_base) + #define gic_data_rdist_vlpi_base() (gic_data_rdist_rd_base() + SZ_128K) + ++static gfp_t gfp_flags_quirk; ++ + static struct page *its_alloc_pages_node(int node, gfp_t gfp, + unsigned int order) + { + struct page *page; + int ret = 0; + +- page = alloc_pages_node(node, gfp, order); ++ page = alloc_pages_node(node, gfp | gfp_flags_quirk, order); + + if (!page) + return NULL; +@@ -4851,6 +4853,17 @@ static bool its_set_non_coherent(void *d + return true; + } + ++static bool __maybe_unused its_enable_rk3568002(void *data) ++{ ++ if (!of_machine_is_compatible("rockchip,rk3566") && ++ !of_machine_is_compatible("rockchip,rk3568")) ++ return false; ++ ++ gfp_flags_quirk |= GFP_DMA32; ++ ++ return true; ++} ++ + static const struct gic_quirk its_quirks[] = { + #ifdef CONFIG_CAVIUM_ERRATUM_22375 + { +@@ -4910,6 +4923,14 @@ static const struct gic_quirk its_quirks + .property = "dma-noncoherent", + .init = its_set_non_coherent, + }, ++#ifdef CONFIG_ROCKCHIP_ERRATUM_3568002 ++ { ++ .desc = "ITS: Rockchip erratum RK3568002", ++ .iidr = 0x0201743b, ++ .mask = 0xffffffff, ++ .init = its_enable_rk3568002, ++ }, ++#endif + { + } + }; diff --git a/target/linux/rockchip/patches-6.6/023-01-v6.15-arm64-dts-rockchip-rk356x-Add-MSI-controller-node.patch b/target/linux/rockchip/patches-6.6/023-01-v6.15-arm64-dts-rockchip-rk356x-Add-MSI-controller-node.patch new file mode 100644 index 00000000000000..a31e4595c4dec6 --- /dev/null +++ b/target/linux/rockchip/patches-6.6/023-01-v6.15-arm64-dts-rockchip-rk356x-Add-MSI-controller-node.patch @@ -0,0 +1,51 @@ +From f15be3d4a0a55db2b50f319c378a2d16ceb21f86 Mon Sep 17 00:00:00 2001 +From: Dmitry Osipenko +Date: Mon, 17 Feb 2025 01:16:33 +0300 +Subject: [PATCH] arm64: dts: rockchip: rk356x: Add MSI controller node + +Rockchip 356x SoC's GIC has two hardware integration issues that +affect MSI functionality of the GIC. Previously, both these GIC +issues were worked around by using MBI for MSI instead of ITS +because kernel GIC driver didn't have necessary quirks. + +First issue is about RK356x GIC not supporting programmable +shareability, while reporting it as supported in a GIC's feature +register. Rockchip assigned Erratum ID #3568001 for this issue. This +patch adds dma-noncoherent property to the GIC node, denoting that a SW +workaround is required for mitigating the issue. + +Second issue is about GIC AXI master interface addressing limited to +the first 4GB of physical address space. Rockchip assigned Erratum +ID #3568002 for this issue. + +Now that kernel supports quirks for both of the erratums, add +MSI controller node to RK356x device-tree. + +Signed-off-by: Dmitry Osipenko +Signed-off-by: Thomas Gleixner +Link: https://lore.kernel.org/all/20250216221634.364158-3-dmitry.osipenko@collabora.com +--- + arch/arm64/boot/dts/rockchip/rk356x-base.dtsi | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi +@@ -364,6 +364,18 @@ + mbi-alias = <0x0 0xfd410000>; + mbi-ranges = <296 24>; + msi-controller; ++ ranges; ++ #address-cells = <2>; ++ #size-cells = <2>; ++ dma-noncoherent; ++ ++ its: msi-controller@fd440000 { ++ compatible = "arm,gic-v3-its"; ++ reg = <0x0 0xfd440000 0 0x20000>; ++ dma-noncoherent; ++ msi-controller; ++ #msi-cells = <1>; ++ }; + }; + + usb_host0_ehci: usb@fd800000 { diff --git a/target/linux/rockchip/patches-6.6/023-02-v6.15-arm64-dts-rockchip-rk356x-Move-PCIe-MSI-to-use-GIC.patch b/target/linux/rockchip/patches-6.6/023-02-v6.15-arm64-dts-rockchip-rk356x-Move-PCIe-MSI-to-use-GIC.patch new file mode 100644 index 00000000000000..d1281332b45190 --- /dev/null +++ b/target/linux/rockchip/patches-6.6/023-02-v6.15-arm64-dts-rockchip-rk356x-Move-PCIe-MSI-to-use-GIC.patch @@ -0,0 +1,28 @@ +From b956c9de91757c9478e24fc9f6a57fd46f0a49f0 Mon Sep 17 00:00:00 2001 +From: Dmitry Osipenko +Date: Mon, 17 Feb 2025 01:16:34 +0300 +Subject: [PATCH] arm64: dts: rockchip: rk356x: Move PCIe MSI to use GIC + ITS instead of MBI + +Rockchip 356x device-tree now supports GIC ITS. Move PCIe controller's +MSI to use ITS instead of MBI. This removes extra CPU overhead of handling +PCIe MBIs by letting GIC's ITS to serve the PCIe MSIs. + +Signed-off-by: Dmitry Osipenko +Signed-off-by: Thomas Gleixner +Link: https://lore.kernel.org/all/20250216221634.364158-4-dmitry.osipenko@collabora.com +--- + arch/arm64/boot/dts/rockchip/rk356x-base.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi +@@ -1043,7 +1043,7 @@ + num-ib-windows = <6>; + num-ob-windows = <2>; + max-link-speed = <2>; +- msi-map = <0x0 &gic 0x0 0x1000>; ++ msi-map = <0x0 &its 0x0 0x1000>; + num-lanes = <1>; + phys = <&combphy2 PHY_TYPE_PCIE>; + phy-names = "pcie-phy"; diff --git a/target/linux/rockchip/patches-6.6/024-v6.16-arm64-dts-rockchip-Move-rk3568-PCIe3-MSI-to-use-GIC-.patch b/target/linux/rockchip/patches-6.6/024-v6.16-arm64-dts-rockchip-Move-rk3568-PCIe3-MSI-to-use-GIC-.patch new file mode 100644 index 00000000000000..c5bbaed492fce4 --- /dev/null +++ b/target/linux/rockchip/patches-6.6/024-v6.16-arm64-dts-rockchip-Move-rk3568-PCIe3-MSI-to-use-GIC-.patch @@ -0,0 +1,54 @@ +From fbea35a661ed100cee2f3bab8015fb0155508106 Mon Sep 17 00:00:00 2001 +From: Chukun Pan +Date: Sat, 8 Mar 2025 17:30:08 +0800 +Subject: [PATCH] arm64: dts: rockchip: Move rk3568 PCIe3 MSI to use GIC ITS + +Following commit b956c9de9175 ("arm64: dts: rockchip: rk356x: Move +PCIe MSI to use GIC ITS instead of MBI"), change the PCIe3 controller's +MSI on rk3568 to use ITS, so that all MSI-X can work properly. + +Signed-off-by: Chukun Pan +Link: https://lore.kernel.org/r/20250308093008.568437-2-amadeus@jmu.edu.cn +Signed-off-by: Heiko Stuebner +--- + arch/arm64/boot/dts/rockchip/rk3568.dtsi | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/arch/arm64/boot/dts/rockchip/rk3568.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3568.dtsi +@@ -64,7 +64,7 @@ + compatible = "rockchip,rk3568-pcie"; + #address-cells = <3>; + #size-cells = <2>; +- bus-range = <0x0 0xf>; ++ bus-range = <0x10 0x1f>; + clocks = <&cru ACLK_PCIE30X1_MST>, <&cru ACLK_PCIE30X1_SLV>, + <&cru ACLK_PCIE30X1_DBI>, <&cru PCLK_PCIE30X1>, + <&cru CLK_PCIE30X1_AUX_NDFT>; +@@ -87,7 +87,7 @@ + num-ib-windows = <6>; + num-ob-windows = <2>; + max-link-speed = <3>; +- msi-map = <0x0 &gic 0x1000 0x1000>; ++ msi-map = <0x1000 &its 0x1000 0x1000>; + num-lanes = <1>; + phys = <&pcie30phy>; + phy-names = "pcie-phy"; +@@ -117,7 +117,7 @@ + compatible = "rockchip,rk3568-pcie"; + #address-cells = <3>; + #size-cells = <2>; +- bus-range = <0x0 0xf>; ++ bus-range = <0x20 0x2f>; + clocks = <&cru ACLK_PCIE30X2_MST>, <&cru ACLK_PCIE30X2_SLV>, + <&cru ACLK_PCIE30X2_DBI>, <&cru PCLK_PCIE30X2>, + <&cru CLK_PCIE30X2_AUX_NDFT>; +@@ -140,7 +140,7 @@ + num-ib-windows = <6>; + num-ob-windows = <2>; + max-link-speed = <3>; +- msi-map = <0x0 &gic 0x2000 0x1000>; ++ msi-map = <0x2000 &its 0x2000 0x1000>; + num-lanes = <2>; + phys = <&pcie30phy>; + phy-names = "pcie-phy"; From 95c9f6e32666bf6fb8a9b16303b6f09bd6a9d83a Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Thu, 19 Jun 2025 22:16:34 +0800 Subject: [PATCH 768/877] mediatek: add ubootmod layout for cudy tr3000 v1 This allows us to use the full size of nand, which increases ubi size from 64M to 122.25M. If you are at factory firmware, please refer commit 63b8d98dd0d2 ("mediatek: add support for Cudy TR3000 v1") to boot into OpenWrt initramfs (stock layout). Flash instructions: 1. Login into the device and backup everything, especially 'Factory' part. 1. Unlock mtd partitions: opkg update && opkg install kmod-mtd-rw insmod mtd-rw i_want_a_brick=1 3. Write new BL2 and FIP mtd write openwrt-mediatek-filogic-cudy_tr3000-v1-ubootmod-preloader.bin BL2 mtd write openwrt-mediatek-filogic-cudy_tr3000-v1-ubootmod-bl31-uboot.fip FIP 4. Set static IP on your PC: IP 192.168.1.254/24, 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, perform sysupgrade. Tested-by: Yangyu Chen Signed-off-by: Tianling Shen (cherry picked from commit 6f8c58bfd8f380dfdc1d89aab29fdcdfde0ee65b) [sync uboot defconfigs with 24.10 branch, change apk to opkg] Signed-off-by: Tianling Shen Link: https://github.com/openwrt/openwrt/pull/18945 Signed-off-by: Hauke Mehrtens --- .../arm-trusted-firmware-mediatek/Makefile | 15 + .../uboot-envtools/files/mediatek_filogic | 1 + package/boot/uboot-mediatek/Makefile | 12 + .../patches/445-add-cudy_tr3000-v1.patch | 330 ++++++++++++++++++ .../lib/preinit/05_set_preinit_iface | 1 + .../dts/mt7981b-cudy-tr3000-v1-ubootmod.dts | 24 ++ .../mediatek/dts/mt7981b-cudy-tr3000-v1.dts | 228 +----------- .../mediatek/dts/mt7981b-cudy-tr3000-v1.dtsi | 212 +++++++++++ .../filogic/base-files/etc/board.d/02_network | 1 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 1 + .../base-files/lib/upgrade/platform.sh | 1 + target/linux/mediatek/image/filogic.mk | 25 ++ 12 files changed, 636 insertions(+), 215 deletions(-) create mode 100644 package/boot/uboot-mediatek/patches/445-add-cudy_tr3000-v1.patch create mode 100644 target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1-ubootmod.dts create mode 100644 target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dtsi diff --git a/package/boot/arm-trusted-firmware-mediatek/Makefile b/package/boot/arm-trusted-firmware-mediatek/Makefile index c8988fa4003719..a543196feb5d73 100644 --- a/package/boot/arm-trusted-firmware-mediatek/Makefile +++ b/package/boot/arm-trusted-firmware-mediatek/Makefile @@ -35,6 +35,8 @@ define Trusted-Firmware-A/Default DRAM_USE_COMB:= RAM_BOOT_UART_DL:= USE_UBI:= + FIP_OFFSET:= + FIP_SIZE:= endef define Trusted-Firmware-A/mt7622-nor-1ddr @@ -221,6 +223,16 @@ define Trusted-Firmware-A/mt7981-spim-nand-ddr3 DDR_TYPE:=ddr3 endef +define Trusted-Firmware-A/mt7981-cudy-tr3000-v1 + NAME:=Cudy TR3000 v1 (SPI-NAND via SPIM, DDR3) + BOOT_DEVICE:=spim-nand + BUILD_SUBTARGET:=filogic + PLAT:=mt7981 + DDR_TYPE:=ddr3 + FIP_OFFSET:=0x3c0000 + FIP_SIZE:=0x200000 +endef + define Trusted-Firmware-A/mt7986-ram-ddr4 NAME:=MediaTek MT7986 (RAM, DDR4) BOOT_DEVICE:=ram @@ -534,6 +546,7 @@ TFA_TARGETS:= \ mt7981-ram-ddr4 \ mt7981-emmc-ddr4 \ mt7981-spim-nand-ddr4 \ + mt7981-cudy-tr3000-v1 \ mt7986-ram-ddr3 \ mt7986-emmc-ddr3 \ mt7986-nor-ddr3 \ @@ -581,6 +594,8 @@ TFA_MAKE_FLAGS += \ $(if $(USE_UBI),UBI=1 $(if $(findstring mt7622,$(PLAT)),OVERRIDE_UBI_START_ADDR=0x80000)) \ $(if $(USE_UBI),UBI=1 $(if $(findstring mt7981,$(PLAT)),OVERRIDE_UBI_START_ADDR=0x100000)) \ $(if $(USE_UBI),UBI=1 $(if $(findstring mt7986,$(PLAT)),OVERRIDE_UBI_START_ADDR=0x200000)) \ + $(if $(FIP_OFFSET),OVERRIDE_FIP_BASE=$(FIP_OFFSET)) \ + $(if $(FIP_SIZE),OVERRIDE_FIP_SIZE=$(FIP_SIZE)) \ $(if $(RAM_BOOT_UART_DL),bl2,all) define Package/trusted-firmware-a-ram/install diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index 7ec1a101a05c38..3f8fa0d54388c0 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -35,6 +35,7 @@ ubootenv_add_ubi_default() { case "$board" in abt,asr3000|\ cmcc,a10-ubootmod|\ +cudy,tr3000-v1-ubootmod|\ h3c,magic-nx30-pro|\ jcg,q30-pro|\ mercusys,mr90x-v1-ubi|\ diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile index c7f47a70c011f8..f68a5d6ff583ba 100644 --- a/package/boot/uboot-mediatek/Makefile +++ b/package/boot/uboot-mediatek/Makefile @@ -267,6 +267,17 @@ define U-Boot/mt7981_cmcc_rax3000m-nand DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr4 endef +define U-Boot/mt7981_cudy_tr3000-v1 + NAME:=Cudy TR3000 v1 + BUILD_SUBTARGET:=filogic + BUILD_DEVICES:=cudy_tr3000-v1-ubootmod + UBOOT_CONFIG:=mt7981_cudy_tr3000-v1 + UBOOT_IMAGE:=u-boot.fip + BL2_BOOTDEV:=cudy-tr3000-v1 + BL2_SOC:=mt7981 + DEPENDS:=+trusted-firmware-a-mt7981-cudy-tr3000-v1 +endef + define U-Boot/mt7981_glinet_gl-x3000 NAME:=GL.iNet GL-X3000 BUILD_SUBTARGET:=filogic @@ -859,6 +870,7 @@ UBOOT_TARGETS := \ mt7981_cmcc_a10 \ mt7981_cmcc_rax3000m-emmc \ mt7981_cmcc_rax3000m-nand \ + mt7981_cudy_tr3000-v1 \ mt7981_gatonetworks_gdsp \ mt7981_glinet_gl-x3000 \ mt7981_glinet_gl-xe3000 \ diff --git a/package/boot/uboot-mediatek/patches/445-add-cudy_tr3000-v1.patch b/package/boot/uboot-mediatek/patches/445-add-cudy_tr3000-v1.patch new file mode 100644 index 00000000000000..e7d83b90cacdf5 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/445-add-cudy_tr3000-v1.patch @@ -0,0 +1,330 @@ +--- /dev/null ++++ b/configs/mt7981_cudy_tr3000-v1_defconfig +@@ -0,0 +1,107 @@ ++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-cudy-tr3000-v1" ++CONFIG_OF_LIBFDT_OVERLAY=y ++CONFIG_TARGET_MT7981=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_FIT=y ++CONFIG_BOOTDELAY=30 ++CONFIG_AUTOBOOT_KEYED=y ++CONFIG_AUTOBOOT_MENU_SHOW=y ++CONFIG_DEFAULT_FDT_FILE="mediatek/mt7981-cudy-tr3000-v1.dtb" ++CONFIG_LOGLEVEL=7 ++CONFIG_PRE_CONSOLE_BUFFER=y ++CONFIG_LOG=y ++CONFIG_BOARD_LATE_INIT=y ++CONFIG_HUSH_PARSER=y ++CONFIG_SYS_PROMPT="MT7981> " ++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_GPT=y ++CONFIG_CMD_MTD=y ++CONFIG_CMD_PART=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_PXE=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_CMD_UBI=y ++CONFIG_CMD_UBI_RENAME=y ++CONFIG_OF_EMBED=y ++CONFIG_ENV_OVERWRITE=y ++CONFIG_ENV_IS_IN_UBI=y ++CONFIG_SYS_REDUNDAND_ENVIRONMENT=y ++CONFIG_ENV_UBI_PART="ubi" ++CONFIG_ENV_UBI_VOLUME="ubootenv" ++CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2" ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_USE_DEFAULT_ENV_FILE=y ++CONFIG_DEFAULT_ENV_FILE="cudy_tr3000-v1_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_MMC is not set ++CONFIG_MTD=y ++CONFIG_DM_MTD=y ++CONFIG_MTD_SPI_NAND=y ++CONFIG_MTD_UBI_FASTMAP=y ++CONFIG_PHY_FIXED=y ++CONFIG_MEDIATEK_ETH=y ++CONFIG_PHY=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_REGULATOR_GPIO=y ++CONFIG_RAM=y ++CONFIG_DM_SERIAL=y ++CONFIG_MTK_SERIAL=y ++CONFIG_SPI=y ++CONFIG_DM_SPI=y ++CONFIG_MTK_SPIM=y ++CONFIG_ZSTD=y ++CONFIG_HEXDUMP=y ++CONFIG_LMB_MAX_REGIONS=64 +--- /dev/null ++++ b/arch/arm/dts/mt7981-cudy-tr3000-v1.dts +@@ -0,0 +1,160 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later ++ ++/dts-v1/; ++#include "mt7981.dtsi" ++#include ++#include ++ ++/ { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ model = "Cudy TR3000 v1"; ++ compatible = "mediatek,mt7981", "mediatek,mt7981-rfb"; ++ ++ chosen { ++ stdout-path = &uart0; ++ tick-timer = &timer0; ++ }; ++ ++ memory@40000000 { ++ device_type = "memory"; ++ reg = <0x40000000 0x20000000>; ++ }; ++ ++ gpio-keys { ++ compatible = "gpio-keys"; ++ ++ button-reset { ++ label = "reset"; ++ linux,code = ; ++ gpios = <&gpio 1 GPIO_ACTIVE_LOW>; ++ }; ++ ++ button-mode { ++ label = "mode"; ++ linux,code = ; ++ linux,input-type = ; ++ gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; ++ debounce-interval = <60>; ++ }; ++ }; ++ ++ gpio-leds { ++ compatible = "gpio-leds"; ++ ++ led_status: led-0 { ++ label = "red:power"; ++ gpios = <&gpio 11 GPIO_ACTIVE_LOW>; ++ default-state = "on"; ++ }; ++ ++ led-1 { ++ label = "white:status"; ++ gpios = <&gpio 10 GPIO_ACTIVE_LOW>; ++ default-state = "off"; ++ }; ++ }; ++}; ++ ++ð { ++ status = "okay"; ++ mediatek,gmac-id = <1>; ++ phy-mode = "gmii"; ++ phy-handle = <&phy0>; ++ ++ mdio { ++ phy0: ethernet-phy@0 { ++ compatible = "ethernet-phy-id03a2.9461"; ++ reg = <0x0>; ++ phy-mode = "gmii"; ++ }; ++ }; ++}; ++ ++&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 = "u-boot-env"; ++ reg = <0x100000 0x80000>; ++ }; ++ ++ partition@180000 { ++ label = "factory"; ++ reg = <0x180000 0x200000>; ++ }; ++ ++ partition@380000 { ++ label = "bdinfo"; ++ reg = <0x380000 0x40000>; ++ }; ++ ++ partition@3c0000 { ++ label = "fip"; ++ reg = <0x3c0000 0x200000>; ++ }; ++ ++ partition@5c0000 { ++ label = "ubi"; ++ reg = <0x5c0000 0x7a40000>; ++ compatible = "linux,ubi"; ++ }; ++ }; ++ }; ++}; ++ ++&uart0 { ++ mediatek,force-highspeed; ++ status = "okay"; ++}; ++ ++&watchdog { ++ status = "disabled"; ++}; +--- /dev/null ++++ b/cudy_tr3000-v1_env +@@ -0,0 +1,54 @@ ++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-cudy_tr3000-v1-ubootmod-initramfs-recovery.itb ++bootfile_bl2=openwrt-mediatek-filogic-cudy_tr3000-v1-ubootmod-preloader.bin ++bootfile_fip=openwrt-mediatek-filogic-cudy_tr3000-v1-ubootmod-bl31-uboot.fip ++bootfile_upg=openwrt-mediatek-filogic-cudy_tr3000-v1-ubootmod-squashfs-sysupgrade.itb ++bootled_pwr=red:power ++bootled_rec=white: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 ++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 || run ubi_format ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic || 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 && ubi write $loadaddr fit $filesize ++ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && 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" 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 421f02938ae481..06016683eddfc3 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 @@ -2,6 +2,7 @@ set_preinit_iface() { case $(board_name) in cudy,m3000-v1|\ cudy,tr3000-v1|\ + cudy,tr3000-v1-ubootmod|\ glinet,gl-mt3000|\ openembed,som7981|\ wavlink,wl-wn573hx3) diff --git a/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1-ubootmod.dts b/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1-ubootmod.dts new file mode 100644 index 00000000000000..07e706dc3a45af --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1-ubootmod.dts @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/dts-v1/; +#include "mt7981b-cudy-tr3000-v1.dtsi" + +/ { + model = "Cudy TR3000 v1 (OpenWrt U-Boot layout)"; + compatible = "cudy,tr3000-v1-ubootmod", "mediatek,mt7981"; +}; + +&chosen { + bootargs = "root=/dev/fit0 rootwait"; + rootdisk = <&ubi_rootdisk>; +}; + +&ubi { + reg = <0x5c0000 0x7a40000>; + + volumes { + ubi_rootdisk: ubi-volume-fit { + volname = "fit"; + }; + }; +}; diff --git a/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts index 86d8e857f19733..d65e2352b74ae8 100644 --- a/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts +++ b/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts @@ -1,228 +1,26 @@ // SPDX-License-Identifier: (GPL-2.0 OR MIT) /dts-v1/; - -#include - -#include "mt7981.dtsi" +#include "mt7981b-cudy-tr3000-v1.dtsi" / { model = "Cudy TR3000 v1"; compatible = "cudy,tr3000-v1", "mediatek,mt7981"; - - aliases { - label-mac-device = &gmac1; - led-boot = &led_sys_red; - led-failsafe = &led_sys_red; - led-running = &led_sys_white; - led-upgrade = &led_sys_white; - serial0 = &uart0; - }; - - chosen { - stdout-path = "serial0:115200n8"; - }; - - gpio-keys { - compatible = "gpio-keys"; - - reset { - label = "reset"; - linux,code = ; - gpios = <&pio 1 GPIO_ACTIVE_LOW>; - }; - - mode { - label = "mode"; - linux,code = ; - linux,input-type = ; - gpios = <&pio 0 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - led_sys_red: led-0 { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pio 11 GPIO_ACTIVE_LOW>; - }; - - led_sys_white: led-1 { - function = LED_FUNCTION_STATUS; - color = ; - gpios = <&pio 10 GPIO_ACTIVE_LOW>; - }; - }; - - usb_vbus: regulator-usb { - compatible = "regulator-fixed"; - regulator-name = "usb-vbus"; - regulator-min-microvolt = <5000000>; - regulator-max-microvolt = <5000000>; - gpios = <&pio 9 GPIO_ACTIVE_LOW>; - regulator-boot-on; - }; -}; - -&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"; - phy-handle = <&phy1>; - nvmem-cell-names = "mac-address"; - nvmem-cells = <&macaddr_bdinfo_de00 1>; - }; - - 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 { - phy1: phy@1 { - compatible = "ethernet-phy-ieee802.3-c45"; - reg = <1>; - reset-assert-us = <100000>; - reset-deassert-us = <100000>; - reset-gpios = <&pio 39 GPIO_ACTIVE_LOW>; - interrupts = <38 IRQ_TYPE_LEVEL_LOW>; - interrupt-parent = <&pio>; - realtek,aldps-enable; - }; -}; - -&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-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 = <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>; - }; - }; - }; - - partition@380000 { - label = "bdinfo"; - reg = <0x380000 0x0040000>; - 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@3c0000 { - label = "FIP"; - reg = <0x3c0000 0x0200000>; - read-only; - }; - - partition@5c0000 { - label = "ubi"; - reg = <0x5c0000 0x4000000>; - compatible = "linux,ubi"; - }; - }; - }; }; -&pio { - spi0_flash_pins: spi0-pins { - mux { - function = "spi"; - groups = "spi0", "spi0_wp_hold"; - }; - }; -}; - -&usb_phy { - status = "okay"; -}; +&spi_nand { + 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>; -&xhci { - status = "okay"; - vbus-supply = <&usb_vbus>; + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; }; -&wifi { - status = "okay"; - nvmem-cells = <&eeprom_factory_0>; - nvmem-cell-names = "eeprom"; +&ubi { + reg = <0x5c0000 0x4000000>; }; diff --git a/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dtsi b/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dtsi new file mode 100644 index 00000000000000..91cf1d01a0cb13 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dtsi @@ -0,0 +1,212 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/dts-v1/; +#include +#include "mt7981.dtsi" + +/ { + aliases { + label-mac-device = &gmac1; + led-boot = &led_sys_red; + led-failsafe = &led_sys_red; + led-running = &led_sys_white; + led-upgrade = &led_sys_white; + serial0 = &uart0; + }; + + chosen: chosen { + stdout-path = "serial0:115200n8"; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + + mode { + label = "mode"; + linux,code = ; + linux,input-type = ; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_sys_red: led-0 { + function = LED_FUNCTION_POWER; + color = ; + gpios = <&pio 11 GPIO_ACTIVE_LOW>; + }; + + led_sys_white: led-1 { + function = LED_FUNCTION_STATUS; + color = ; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + }; + }; + + usb_vbus: regulator-usb { + compatible = "regulator-fixed"; + regulator-name = "usb-vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + regulator-boot-on; + }; +}; + +&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"; + phy-handle = <&phy1>; + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_bdinfo_de00 1>; + }; + + 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 { + phy1: phy@1 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <1>; + reset-assert-us = <100000>; + reset-deassert-us = <100000>; + reset-gpios = <&pio 39 GPIO_ACTIVE_LOW>; + interrupts = <38 IRQ_TYPE_LEVEL_LOW>; + interrupt-parent = <&pio>; + realtek,aldps-enable; + }; +}; + +&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-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>; + 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>; + }; + }; + }; + + partition@380000 { + label = "bdinfo"; + reg = <0x380000 0x0040000>; + 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@3c0000 { + label = "FIP"; + reg = <0x3c0000 0x0200000>; + read-only; + }; + + ubi: partition@5c0000 { + label = "ubi"; + compatible = "linux,ubi"; + }; + }; + }; +}; + +&pio { + spi0_flash_pins: spi0-pins { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + }; +}; + +&usb_phy { + status = "okay"; +}; + +&xhci { + status = "okay"; + vbus-supply = <&usb_vbus>; +}; + +&wifi { + status = "okay"; + nvmem-cells = <&eeprom_factory_0>; + 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 d7e9c1595587e0..a3c205c26d0de7 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 @@ -90,6 +90,7 @@ mediatek_setup_interfaces() ;; cudy,m3000-v1|\ cudy,tr3000-v1|\ + cudy,tr3000-v1-ubootmod|\ glinet,gl-mt2500|\ glinet,gl-mt3000|\ glinet,gl-x3000|\ 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 8a100d525bb0cb..097b16fa31d0af 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 @@ -79,6 +79,7 @@ case "$board" in cudy,m3000-v1|\ cudy,re3000-v1|\ cudy,tr3000-v1|\ + cudy,tr3000-v1-ubootmod|\ cudy,wr3000e-v1|\ cudy,wr3000s-v1|\ cudy,wr3000h-v1|\ 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 d747de1d1346bf..ea16ee3c71e373 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -73,6 +73,7 @@ platform_do_upgrade() { bananapi,bpi-r4-poe|\ cmcc,a10-ubootmod|\ cmcc,rax3000m|\ + cudy,tr3000-v1-ubootmod|\ gatonetworks,gdsp|\ h3c,magic-nx30-pro|\ jcg,q30-pro|\ diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index ffdc0412e64e34..11861be34da81f 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -737,6 +737,31 @@ define Device/cudy_tr3000-v1 endef TARGET_DEVICES += cudy_tr3000-v1 +define Device/cudy_tr3000-v1-ubootmod + DEVICE_VENDOR := Cudy + DEVICE_MODEL := TR3000 + DEVICE_VARIANT := v1 (OpenWrt U-Boot layout) + DEVICE_DTS := mt7981b-cudy-tr3000-v1-ubootmod + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-usb3 kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware + 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 + ARTIFACTS := preloader.bin bl31-uboot.fip + ARTIFACT/preloader.bin := mt7981-bl2 cudy-tr3000-v1 + ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot cudy_tr3000-v1 +endef +TARGET_DEVICES += cudy_tr3000-v1-ubootmod + define Device/cudy_wr3000-v1 DEVICE_VENDOR := Cudy DEVICE_MODEL := WR3000 From 5096c7624fe00abfa593e21b4437bb632c303f85 Mon Sep 17 00:00:00 2001 From: Dim Fish Date: Thu, 3 Jul 2025 18:06:18 +0300 Subject: [PATCH 769/877] mediatek: spinand: force update_cache_variants to use reset for Foresee NAND Force update_cache_variantsvariants to use reset for Foresee NAND with bad blocks. Tested on Xiaomi AX3000T + F35SQA001G with bad blocks and without bad blocks Signed-off-by: Dim Fish Link: https://github.com/openwrt/openwrt/pull/17963 Signed-off-by: Chuanhong Guo (cherry picked from commit edc7cb910433e05eac61b13d94163f1e07fa6af4) [drop patch for linux kernel 6.12] Fixes: https://github.com/openwrt/openwrt/issues/17962 Signed-off-by: Mikhail Zhilkin Link: https://github.com/openwrt/openwrt/pull/19297 Signed-off-by: Hauke Mehrtens --- ...-mtd-spinand-fix-support-for-FORESEE.patch | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 target/linux/mediatek/patches-6.6/411-mtd-spinand-fix-support-for-FORESEE.patch diff --git a/target/linux/mediatek/patches-6.6/411-mtd-spinand-fix-support-for-FORESEE.patch b/target/linux/mediatek/patches-6.6/411-mtd-spinand-fix-support-for-FORESEE.patch new file mode 100644 index 00000000000000..48a6515b56a238 --- /dev/null +++ b/target/linux/mediatek/patches-6.6/411-mtd-spinand-fix-support-for-FORESEE.patch @@ -0,0 +1,19 @@ +Force update_cache_variants to use reset for Foresee NAND with bad blocks + +Tested on Xiaomi AX3000T + F35SQA001G with bad blocks and without bad blocks + +Signed-off-by: Dim Fish + +--- a/drivers/mtd/nand/spi/foresee.c ++++ b/drivers/mtd/nand/spi/foresee.c +@@ -22,8 +22,8 @@ static SPINAND_OP_VARIANTS(write_cache_v + SPINAND_PROG_LOAD(true, 0, NULL, 0)); + + static SPINAND_OP_VARIANTS(update_cache_variants, +- SPINAND_PROG_LOAD_X4(false, 0, NULL, 0), +- SPINAND_PROG_LOAD(false, 0, NULL, 0)); ++ SPINAND_PROG_LOAD_X4(true, 0, NULL, 0), ++ SPINAND_PROG_LOAD(true, 0, NULL, 0)); + + static int f35sqa002g_ooblayout_ecc(struct mtd_info *mtd, int section, + struct mtd_oob_region *region) From 32b0c8994772f1bd222b16c911c52b3c292a70b6 Mon Sep 17 00:00:00 2001 From: Valeriy Manzhos Date: Sun, 15 Jun 2025 13:08:29 +0300 Subject: [PATCH 770/877] ath79: enable USB by default on hAP ac Due to a bug, USB is not powered on after boot on hAP ac. This prevents extroot configurations from working as overlayfs is mounted before USB device can be powered on. This commit fixes this by enabling USB in devicetree. Related discussion links: - https://forum.openwrt.org/t/usb-power-is-off-on-boot/229007 --- Extroot configuration requires the USB to be powered on before preinit_main/80_mount_root. Probably the simplest approach is to enable it in the devicetree. Another approach would be to add a script into /lib/preinit that will power on USB via /sys/class/gpio/usb-power/value E.g. cat /lib/preinit/79_power_on_usb do_power_on_usb(){ echo '1' > /sys/class/gpio/usb-power/value } boot_hook_add preinit_main do_power_on_usb Signed-off-by: Valeriy Manzhos Link: https://github.com/openwrt/openwrt/pull/19149 Signed-off-by: Hauke Mehrtens (cherry picked from commit f7dba4ebbcebde7e0c5c9186e94a502aeeaf789a) Link: https://github.com/openwrt/openwrt/pull/19334 Signed-off-by: Robert Marko --- target/linux/ath79/dts/qca9558_mikrotik_routerboard-96x.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ath79/dts/qca9558_mikrotik_routerboard-96x.dtsi b/target/linux/ath79/dts/qca9558_mikrotik_routerboard-96x.dtsi index 684ca8632a4852..4e219d167c1dba 100644 --- a/target/linux/ath79/dts/qca9558_mikrotik_routerboard-96x.dtsi +++ b/target/linux/ath79/dts/qca9558_mikrotik_routerboard-96x.dtsi @@ -44,7 +44,7 @@ usb_power { gpio-export,name = "usb-power"; - gpio-export,output = <0>; + gpio-export,output = <1>; gpios = <&gpio 13 GPIO_ACTIVE_HIGH>; }; }; From 0ec28e59a815bb43c359328c8fd644f399d344da Mon Sep 17 00:00:00 2001 From: cheng wang Date: Sun, 22 Jun 2025 08:44:30 +0800 Subject: [PATCH 771/877] mediatek: add support for Cudy TR3000 256MB v1 flash version This device is similar to the Cudy TR3000 v1 128MB version. The difference is that the flash memory is 128mb and the other is 256mb Hardware: - SoC: MediaTek MT7981B - CPU: 2x 1.3 GHz Cortex-A53 - Flash: 256 MiB SPI NAND - RAM: 512 MiB - WLAN: 2.4 GHz, 5 GHz (MediaTek MT7976CN, 802.11ax) - Ethernet: 1x 10/100/1000/2500 Mbps RTL8221B WAN, 1x10/100/1000 Mbps MT7981 LAN - USB 3.0 port - Buttons: 1 Reset button, 1 slider button - LEDs: 1x Red, 1x White - Power: 5 VDC, 3 A Installation: Cudy has distributed intermediate firmware to make installation easier 1. Go to [Cudy CN official website](https://www.cudy.com/zh-cn/pages/download-center/tr3000-1-0) and download the intermediate firmware 2. Upgrade the intermediate firmware on the page 3. Visit the intermediate firmware 192.168.1.1 webpage and use the sysupgrade image to update other: If you fail to flash the device, you can use TFTP to flash back to the original firmware. 1. Ask Cudy CN official customer service for the original firmware 2. With the router off, press the RESET button. While the router is turning on, the button should continue to be pressed for at least 5 seconds. 3. A u-boot shell will automatically open. 4. Connect to LAN and set your IP to 192.168.1.88/24. Configure a TFTP server and an recovery.bin firmware file. Signed-off-by: cheng wang Link: https://github.com/openwrt/openwrt/pull/19167 (cherry picked from commit 594da824a4f2f9582941e612f1a912773d43ff1d) Link: https://github.com/openwrt/openwrt/pull/19348 Signed-off-by: Hauke Mehrtens --- .../lib/preinit/05_set_preinit_iface | 1 + .../dts/mt7981b-cudy-tr3000-256mb-v1.dts | 26 +++++++++++++++++++ .../filogic/base-files/etc/board.d/02_network | 1 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 1 + target/linux/mediatek/image/filogic.mk | 17 ++++++++++++ 5 files changed, 46 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7981b-cudy-tr3000-256mb-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 06016683eddfc3..5d8151741d5c69 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 @@ -1,6 +1,7 @@ set_preinit_iface() { case $(board_name) in cudy,m3000-v1|\ + cudy,tr3000-256mb-v1|\ cudy,tr3000-v1|\ cudy,tr3000-v1-ubootmod|\ glinet,gl-mt3000|\ diff --git a/target/linux/mediatek/dts/mt7981b-cudy-tr3000-256mb-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-tr3000-256mb-v1.dts new file mode 100644 index 00000000000000..823f0aef93a0e9 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-cudy-tr3000-256mb-v1.dts @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +#include "mt7981b-cudy-tr3000-v1.dtsi" + +/ { + model = "Cudy TR3000 256MB v1"; + compatible = "cudy,tr3000-256mb-v1", "mediatek,mt7981"; +}; + +&spi_nand { + 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>; +}; + +&ubi { + reg = <0x5c0000 0xe600000>; +}; + 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 a3c205c26d0de7..ff8ad85bd3e7de 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 @@ -89,6 +89,7 @@ mediatek_setup_interfaces() ucidef_set_interface_lan "eth0" ;; cudy,m3000-v1|\ + cudy,tr3000-256mb-v1|\ cudy,tr3000-v1|\ cudy,tr3000-v1-ubootmod|\ glinet,gl-mt2500|\ 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 097b16fa31d0af..843e815d36432f 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 @@ -78,6 +78,7 @@ case "$board" in cudy,ap3000-v1|\ cudy,m3000-v1|\ cudy,re3000-v1|\ + cudy,tr3000-256mb-v1|\ cudy,tr3000-v1|\ cudy,tr3000-v1-ubootmod|\ cudy,wr3000e-v1|\ diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 11861be34da81f..6db24cdd4d77f7 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -720,6 +720,23 @@ define Device/cudy_re3000-v1 endef TARGET_DEVICES += cudy_re3000-v1 +define Device/cudy_tr3000-256mb-v1 + DEVICE_VENDOR := Cudy + DEVICE_MODEL := TR3000 + DEVICE_VARIANT := 256mb v1 + DEVICE_DTS := mt7981b-cudy-tr3000-256mb-v1 + DEVICE_DTS_DIR := ../dts + SUPPORTED_DEVICES += R103 + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + IMAGE_SIZE := 235520k + KERNEL_IN_UBI := 1 + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + DEVICE_PACKAGES := kmod-usb3 kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware +endef +TARGET_DEVICES += cudy_tr3000-256mb-v1 + define Device/cudy_tr3000-v1 DEVICE_VENDOR := Cudy DEVICE_MODEL := TR3000 From f68c3e5057ab4fe4330bef1619fdd6a081b233bf Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 6 Jul 2025 17:51:01 +0200 Subject: [PATCH 772/877] openssl: Update to version 3.0.17 This release incorporates the following bug fixes and mitigations: Miscellaneous minor bug fixes. Link: https://github.com/openwrt/openwrt/pull/19325 Signed-off-by: Hauke Mehrtens --- package/libs/openssl/Makefile | 4 ++-- .../libs/openssl/patches/100-Configure-afalg-support.patch | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile index 4829670f86fe70..25a71fa7a438c0 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.16 +PKG_VERSION:=3.0.17 PKG_RELEASE:=1 PKG_BUILD_FLAGS:=no-mips16 gc-sections no-lto @@ -21,7 +21,7 @@ PKG_SOURCE_URL:= \ https://www.openssl.org/source/old/$(PKG_BASE)/ \ https://github.com/openssl/openssl/releases/download/$(PKG_NAME)-$(PKG_VERSION)/ -PKG_HASH:=57e03c50feab5d31b152af2b764f10379aecd8ee92f16c985983ce4a99f7ef86 +PKG_HASH:=dfdd77e4ea1b57ff3a6dbde6b0bdc3f31db5ac99e7fdd4eaf9e1fbb6ec2db8ce 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..7ce5cd43835e87 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- +@@ -1678,7 +1678,9 @@ $config{CFLAGS} = [ map { $_ eq '--ossl- unless ($disabled{afalgeng}) { $config{afalgeng}=""; From 49fdb75c7b9c3d66b87375185d2e4e725474032e Mon Sep 17 00:00:00 2001 From: Antony Kolitsos Date: Thu, 3 Jul 2025 17:17:00 -0700 Subject: [PATCH 773/877] mbedtls: update to 3.6.4 This release includes fixes for security issues. Mbed TLS 3.6 is a long-term support (LTS) branch. It will be supported with bug-fixes and security fixes until at least March 2027. Security Advisories For full details, please see the following links: Race condition in AESNI support detection [1] Heap buffer under-read when parsing PEM-encrypted material [2] Unchecked return value in LMS verification allows signature bypass [3] Out-of-bounds read in mbedtls_lms_import_public_key() [4] Timing side-channel in block cipher decryption with PKCS#7 padding [5] NULL pointer dereference after using mbedtls_asn1_store_named_data() [6] Misleading memory management in mbedtls_x509_string_to_names() [7] [1] https://mbed-tls.readthedocs.io/en/latest/security-advisories/mbedtls-security-advisory-2025-06-1/ [2] https://mbed-tls.readthedocs.io/en/latest/security-advisories/mbedtls-security-advisory-2025-06-2/ [3] https://mbed-tls.readthedocs.io/en/latest/security-advisories/mbedtls-security-advisory-2025-06-3/ [4] https://mbed-tls.readthedocs.io/en/latest/security-advisories/mbedtls-security-advisory-2025-06-4/ [5] https://mbed-tls.readthedocs.io/en/latest/security-advisories/mbedtls-security-advisory-2025-06-5/ [6] https://mbed-tls.readthedocs.io/en/latest/security-advisories/mbedtls-security-advisory-2025-06-6/ [7] https://mbed-tls.readthedocs.io/en/latest/security-advisories/mbedtls-security-advisory-2025-06-7/ Signed-off-by: Antony Kolitsos Link: https://github.com/openwrt/openwrt/pull/19291 Signed-off-by: Robert Marko (cherry picked from commit 2c8a433cd2c4f0cd4049e5b0fa147c824ec27c62) Link: https://github.com/openwrt/openwrt/pull/19324 Signed-off-by: Hauke Mehrtens --- 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 6d16819d3a1359..d6dfd6b68ff3d3 100644 --- a/package/libs/mbedtls/Makefile +++ b/package/libs/mbedtls/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mbedtls -PKG_VERSION:=3.6.3 +PKG_VERSION:=3.6.4 PKG_RELEASE:=1 PKG_BUILD_FLAGS:=no-mips16 gc-sections no-lto PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL=https://github.com/Mbed-TLS/$(PKG_NAME)/releases/download/$(PKG_NAME)-$(PKG_VERSION) -PKG_HASH:=64cd73842cdc05e101172f7b437c65e7312e476206e1dbfd644433d11bc56327 +PKG_HASH:=ec35b18a6c593cf98c3e30db8b98ff93e8940a8c4e690e66b41dfc011d678110 PKG_LICENSE:=GPL-2.0-or-later PKG_LICENSE_FILES:=LICENSE From 37233122a79c511ff205fe94643b4425daea87fb Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 1 Jul 2025 20:48:14 +0200 Subject: [PATCH 774/877] ubus: update to Git HEAD (2025-07-02) 27839f854a58 ubusd: make txq_len field signed b35b2bc63e8e ubusd: treat EACCES on write like EAGAIN 713e9d19b2b6 ubusd: retry write on EINTR 8bb523ab20e0 ubusd: fix txq_len accounting b1b783c74742 ubusd: add another tx attempt on enqueueing the first message for a client 5952b48e251c ubusd: do not call socket callback from ubus_msg_send Signed-off-by: Felix Fietkau (cherry picked from commit 90cd8640bde750e014b6c02ed9ffb6f626753fc7) (cherry picked from commit d9cd67b542e55841bda48871fd9a03391a40d1a2) --- 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 ceaa587abf56ba..7e23beb2325272 100644 --- a/package/system/ubus/Makefile +++ b/package/system/ubus/Makefile @@ -5,10 +5,10 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/ubus.git -PKG_SOURCE_DATE:=2025-05-16 +PKG_SOURCE_DATE:=2025-07-02 PKG_SOURCE_DATE_ABI:=2025-01-02 -PKG_SOURCE_VERSION:=88e6325092bf1d1cfa877cd220670fa7cc2fad03 -PKG_MIRROR_HASH:=8af913d18c9f50cabfd3d32ce3462028ecf469d5e649ccf7f642d9d6bd6dc695 +PKG_SOURCE_VERSION:=5952b48e251c0ea76dfce97f129da6f18d889eda +PKG_MIRROR_HASH:=60edfc101eaa85976d243febc368fc419fe44283bd3a743851a6bc7975e881f0 PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE_ABI)) CMAKE_INSTALL:=1 From 787072906d5f5fd9e2f239fdf31ce8fa5ee28e05 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 15 Jul 2025 15:26:16 +0200 Subject: [PATCH 775/877] build: ipkg-remove: fix source name / package confusion, optimize The script always gets passed the package name, not the source name. Optimize for the default case where the package name matches the filename prefix. Signed-off-by: Felix Fietkau (cherry picked from commit 471fd0a50281ce2a37fece402c4c5bd609b6d580) --- scripts/ipkg-remove | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/scripts/ipkg-remove b/scripts/ipkg-remove index f4957004c0ebca..19d7148e83c5a4 100755 --- a/scripts/ipkg-remove +++ b/scripts/ipkg-remove @@ -3,17 +3,24 @@ sourcename="$1"; shift for pkg in "$@"; do - tar -Ozxf "$pkg" ./control.tar.gz 2>/dev/null | tar -Ozxf - ./control 2>/dev/null | \ - while read field value; do - if [ "$field" = "SourceName:" ] && [ "$value" = "$sourcename" ]; then - rm -vf "$pkg" - break - fi - done case "$pkg" in */"${sourcename}_"*.ipk) rm -vf "$pkg" ;; + *) + tar -Ozxf "$pkg" ./control.tar.gz 2>/dev/null | tar -Ozxf - ./control 2>/dev/null | { + packagename= + abiversion= + while read field value; do + case "$field" in + Package:) packagename="$value";; + ABIVersion:) abiversion="$value";; + esac + done + [ -n "$abiversion" ] && packagename="${packagename%%$abiversion}" + [ "$packagename" = "$sourcename" ] && rm -vf "$pkg" + } + ;; esac done From b2fcc6f9f3cd19e1c54464e4d8b00ee350b4634a Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sun, 6 Jul 2025 18:50:50 +0800 Subject: [PATCH 776/877] kernel: bump 6.6 to 6.6.96 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.96 Remove upstreamed patches: generic/pending-6.6/650-Revert-ipv6-save-dontfrag-in-cork.patch [1] All other patches are automatically refreshed. [1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.96&id=c46358d0275953b27c3d86f7a224e229f2d57d05 Signed-off-by: Shiji Yang Tested-by: John Audia Link: https://github.com/openwrt/openwrt/pull/19317 (cherry picked from commit 2d8d11a42c0293595871dbbb24a33ea86a0c5ebf) Signed-off-by: Goetz Goerisch Link: https://github.com/openwrt/openwrt/pull/19354 Signed-off-by: Hauke Mehrtens --- include/kernel-6.6 | 4 +- ...all-the-downstream-rpi-sound-card-dr.patch | 2 +- ...50-Revert-ipv6-save-dontfrag-in-cork.patch | 72 ------------------- .../103-pcengines_apu6_platform.patch | 4 +- 4 files changed, 5 insertions(+), 77 deletions(-) delete mode 100644 target/linux/generic/pending-6.6/650-Revert-ipv6-save-dontfrag-in-cork.patch diff --git a/include/kernel-6.6 b/include/kernel-6.6 index d2d952e2541871..88d972d66a0d54 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .95 -LINUX_KERNEL_HASH-6.6.95 = 18640ae9a2c952f8f8868324378df1a9e138ad29e6b93a9c38155764ea67ea85 +LINUX_VERSION-6.6 = .96 +LINUX_KERNEL_HASH-6.6.96 = 9ee45843d43adb2e2ac5f6a8cb10a334e39e3e3384af8a0ce383a37f78221bdd diff --git a/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch b/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch index 9f346943ccbd89..2346d427328c74 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch @@ -17583,7 +17583,7 @@ Signed-off-by: Phil Elwell * For devices with more than one control interface, we assume the --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c -@@ -2258,6 +2258,8 @@ static const struct usb_audio_quirk_flag +@@ -2260,6 +2260,8 @@ static const struct usb_audio_quirk_flag QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x534d, 0x2109, /* MacroSilicon MS2109 */ QUIRK_FLAG_ALIGN_TRANSFER), diff --git a/target/linux/generic/pending-6.6/650-Revert-ipv6-save-dontfrag-in-cork.patch b/target/linux/generic/pending-6.6/650-Revert-ipv6-save-dontfrag-in-cork.patch deleted file mode 100644 index 18ef72ef583596..00000000000000 --- a/target/linux/generic/pending-6.6/650-Revert-ipv6-save-dontfrag-in-cork.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 988e05f0c036c9c64f211b8b91a4a33c34db216a Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Sat, 21 Jun 2025 19:08:30 +0200 -Subject: [PATCH] Revert "ipv6: save dontfrag in cork" - -This reverts commit 8ebf2709fe4dcd0a1b7b95bf61e529ddcd3cdf51. - -This change breaks IPv6 UDP packet fragmentation. -See discussion: https://lore.kernel.org/stable/aFGl-mb--GOMY8ZQ@karahi.gladserv.com/ - -Signed-off-by: Hauke Mehrtens ---- - include/linux/ipv6.h | 1 - - net/ipv6/ip6_output.c | 9 ++++----- - 2 files changed, 4 insertions(+), 6 deletions(-) - ---- a/include/linux/ipv6.h -+++ b/include/linux/ipv6.h -@@ -199,7 +199,6 @@ struct inet6_cork { - struct ipv6_txoptions *opt; - u8 hop_limit; - u8 tclass; -- u8 dontfrag:1; - }; - - /* struct ipv6_pinfo - ipv6 private area */ ---- a/net/ipv6/ip6_output.c -+++ b/net/ipv6/ip6_output.c -@@ -1452,7 +1452,6 @@ static int ip6_setup_cork(struct sock *s - } - v6_cork->hop_limit = ipc6->hlimit; - v6_cork->tclass = ipc6->tclass; -- v6_cork->dontfrag = ipc6->dontfrag; - if (rt->dst.flags & DST_XFRM_TUNNEL) - mtu = np->pmtudisc >= IPV6_PMTUDISC_PROBE ? - READ_ONCE(rt->dst.dev->mtu) : dst_mtu(&rt->dst); -@@ -1486,7 +1485,7 @@ static int __ip6_append_data(struct sock - int getfrag(void *from, char *to, int offset, - int len, int odd, struct sk_buff *skb), - void *from, size_t length, int transhdrlen, -- unsigned int flags) -+ unsigned int flags, struct ipcm6_cookie *ipc6) - { - struct sk_buff *skb, *skb_prev = NULL; - struct inet_cork *cork = &cork_full->base; -@@ -1542,7 +1541,7 @@ static int __ip6_append_data(struct sock - if (headersize + transhdrlen > mtu) - goto emsgsize; - -- if (cork->length + length > mtu - headersize && v6_cork->dontfrag && -+ if (cork->length + length > mtu - headersize && ipc6->dontfrag && - (sk->sk_protocol == IPPROTO_UDP || - sk->sk_protocol == IPPROTO_ICMPV6 || - sk->sk_protocol == IPPROTO_RAW)) { -@@ -1914,7 +1913,7 @@ int ip6_append_data(struct sock *sk, - - return __ip6_append_data(sk, &sk->sk_write_queue, &inet->cork, - &np->cork, sk_page_frag(sk), getfrag, -- from, length, transhdrlen, flags); -+ from, length, transhdrlen, flags, ipc6); - } - EXPORT_SYMBOL_GPL(ip6_append_data); - -@@ -2119,7 +2118,7 @@ struct sk_buff *ip6_make_skb(struct sock - err = __ip6_append_data(sk, &queue, cork, &v6_cork, - ¤t->task_frag, getfrag, from, - length + exthdrlen, transhdrlen + exthdrlen, -- flags); -+ flags, ipc6); - if (err) { - __ip6_flush_pending_frames(sk, &queue, cork, &v6_cork); - return ERR_PTR(err); diff --git a/target/linux/x86/patches-6.6/103-pcengines_apu6_platform.patch b/target/linux/x86/patches-6.6/103-pcengines_apu6_platform.patch index 1fd6fc89c88131..4c22d0bb02ba65 100644 --- a/target/linux/x86/patches-6.6/103-pcengines_apu6_platform.patch +++ b/target/linux/x86/patches-6.6/103-pcengines_apu6_platform.patch @@ -63,7 +63,7 @@ Sighed-off-by: Philip Prindeville --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig -@@ -707,7 +707,7 @@ config XO1_RFKILL +@@ -708,7 +708,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 -@@ -715,7 +715,7 @@ config PCENGINES_APU2 +@@ -716,7 +716,7 @@ config PCENGINES_APU2 select LEDS_GPIO help This driver provides support for the front button and LEDs on From 05d8b931fb8d2561311b029882d77b2ef6e34c2a Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Thu, 10 Jul 2025 23:59:14 +0800 Subject: [PATCH 777/877] kernel: bump 6.6 to 6.6.97 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.97 Remove upstream patches: generic/backport-6.6/001-powerpc-kernel-Fix-pcc_save_regs-inclusion.patch [1] Manually rebased patch: bcm53xx/patches-6.6/180-usb-xhci-add-support-for-performing-fake-doorbell.patch[2] New Kconfig symbol: x86: enable MITIGATION_TSA [3] All other patches are automatically refreshed. [1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.97&id=8a7ac2737211451b8b98657b919c4c4e0a4c0c2f [2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.97&id=7609899eb6b70b536123eb58eeab27c764752b82 [3] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.97&id=90293047df18caf7ed0fe566d89af0720f2dc98a Signed-off-by: Shiji Yang Co-authored-by: John Audia Tested-by: Konstantin Demin Link: https://github.com/openwrt/openwrt/pull/19317 (cherry picked from commit 04d764576b766ce849ea68af5ed7f5cfd8f47260) Co-authored-by: Goetz Goerisch Signed-off-by: Goetz Goerisch Link: https://github.com/openwrt/openwrt/pull/19354 Signed-off-by: Hauke Mehrtens --- include/kernel-6.6 | 4 +- .../901-snand-mtk-bmt-support.patch | 6 +-- ...ci-add-quirk-for-host-controllers-th.patch | 2 +- ...092-MMC-added-alternative-MMC-driver.patch | 6 +-- ...e-link-events-to-minimize-poll-storm.patch | 2 +- ...m-v3d-Clock-V3D-down-when-not-in-use.patch | 10 ++--- ...-clock-so-firmware-knows-we-are-usin.patch | 2 +- ...ci_sync-Add-fallback-bd-address-prop.patch | 4 +- ...gfs-end-points-to-query-GPU-usage-st.patch | 8 ++-- ...-quirks-add-link-TRB-quirk-for-VL805.patch | 6 +-- ...b-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch | 6 +-- ...5-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch | 6 +-- .../950-0514-sdhci-Add-SD-Express-hook.patch | 6 +-- ...ware-Add-SMBUS-quick-command-support.patch | 6 +-- ...ix-up-register-addresses-for-V3D-7.x.patch | 8 ++-- ...mc-sdhci-add-SPURIOUS_INT_RESP-quirk.patch | 2 +- ...-maximum-ADMA-transfer-length-to-4Mi.patch | 2 +- ...th-hci_sync-Fix-crash-on-NULL-parent.patch | 2 +- ...ble-write-caching-on-Samsung-2023-mo.patch | 6 +-- ...le-cache-on-more-known-bad-Sandisk-c.patch | 2 +- ...MC_QUIRK_BROKEN_ERASE-for-Phison-Int.patch | 4 +- ...re-Add-support-for-bus-clear-feature.patch | 4 +- ...K_KNOWN_WORKING_SD_CQ-on-Raspberry-P.patch | 2 +- ...e-a-V3D-tech-revision-to-all-support.patch | 12 +++--- ...SMS-registers-for-power-on-off-and-r.patch | 10 ++--- ...support-for-performing-fake-doorbell.patch | 6 +-- ...c-kernel-Fix-pcc_save_regs-inclusion.patch | 42 ------------------- ...x_cpus_namespace_collision_shadowing.patch | 2 +- ...an-tag-insertion-stripping-by-defaul.patch | 2 +- ..._F_GSO_FRAGLIST-from-NETIF_F_GSO_SOF.patch | 2 +- .../330-snand-mtk-bmt-support.patch | 6 +-- ...960-asus-hack-u-boot-ignore-mtdparts.patch | 4 +- ...tialize-pad-delay-and-drive-strength.patch | 4 +- ...ove-performance-usb-using-lowmem-for.patch | 14 +++---- ...ma_alloc_noncoherent-to-alloc-low-me.patch | 10 ++--- target/linux/x86/config-6.6 | 1 + 36 files changed, 90 insertions(+), 131 deletions(-) delete mode 100644 target/linux/generic/backport-6.6/001-powerpc-kernel-Fix-pcc_save_regs-inclusion.patch diff --git a/include/kernel-6.6 b/include/kernel-6.6 index 88d972d66a0d54..a98cd88bea22ff 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .96 -LINUX_KERNEL_HASH-6.6.96 = 9ee45843d43adb2e2ac5f6a8cb10a334e39e3e3384af8a0ce383a37f78221bdd +LINUX_VERSION-6.6 = .97 +LINUX_KERNEL_HASH-6.6.97 = 3b67c170638142da56b7a9c3295f2483b88e8c4d3bc26b2bda63b6cf0cb9ee3b diff --git a/target/linux/airoha/patches-6.6/901-snand-mtk-bmt-support.patch b/target/linux/airoha/patches-6.6/901-snand-mtk-bmt-support.patch index 939ec048555787..06026f375ec313 100644 --- a/target/linux/airoha/patches-6.6/901-snand-mtk-bmt-support.patch +++ b/target/linux/airoha/patches-6.6/901-snand-mtk-bmt-support.patch @@ -8,7 +8,7 @@ static int spinand_read_reg_op(struct spinand_device *spinand, u8 reg, u8 *val) { -@@ -1347,6 +1348,7 @@ static int spinand_probe(struct spi_mem +@@ -1348,6 +1349,7 @@ static int spinand_probe(struct spi_mem if (ret) return ret; @@ -16,7 +16,7 @@ ret = mtd_device_register(mtd, NULL, 0); if (ret) goto err_spinand_cleanup; -@@ -1354,6 +1356,7 @@ static int spinand_probe(struct spi_mem +@@ -1355,6 +1357,7 @@ static int spinand_probe(struct spi_mem return 0; err_spinand_cleanup: @@ -24,7 +24,7 @@ spinand_cleanup(spinand); return ret; -@@ -1372,6 +1375,7 @@ static int spinand_remove(struct spi_mem +@@ -1373,6 +1376,7 @@ static int spinand_remove(struct spi_mem if (ret) return ret; diff --git a/target/linux/bcm27xx/patches-6.6/950-0061-Revert-Revert-xhci-add-quirk-for-host-controllers-th.patch b/target/linux/bcm27xx/patches-6.6/950-0061-Revert-Revert-xhci-add-quirk-for-host-controllers-th.patch index e2c2b02f709c11..3dce8aa62158b5 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0061-Revert-Revert-xhci-add-quirk-for-host-controllers-th.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0061-Revert-Revert-xhci-add-quirk-for-host-controllers-th.patch @@ -14,7 +14,7 @@ We don't agree with upstream revert so undo it. --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c -@@ -485,6 +485,7 @@ static void xhci_pci_quirks(struct devic +@@ -510,6 +510,7 @@ static void xhci_pci_quirks(struct devic if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == PCI_DEVICE_ID_VIA_VL805) { xhci->quirks |= XHCI_LPM_SUPPORT; xhci->quirks |= XHCI_TRB_OVERFETCH; diff --git a/target/linux/bcm27xx/patches-6.6/950-0092-MMC-added-alternative-MMC-driver.patch b/target/linux/bcm27xx/patches-6.6/950-0092-MMC-added-alternative-MMC-driver.patch index e983d5295b1147..6dddd80026ac15 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0092-MMC-added-alternative-MMC-driver.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0092-MMC-added-alternative-MMC-driver.patch @@ -344,7 +344,7 @@ Signed-off-by: Phil Elwell } --- a/drivers/mmc/core/quirks.h +++ b/drivers/mmc/core/quirks.h -@@ -153,6 +153,14 @@ static const struct mmc_fixup __maybe_un +@@ -50,6 +50,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), @@ -1993,7 +1993,7 @@ Signed-off-by: Phil Elwell #define MAX_TUNING_LOOP 40 -@@ -3217,7 +3217,7 @@ static void sdhci_timeout_timer(struct t +@@ -3212,7 +3212,7 @@ static void sdhci_timeout_timer(struct t spin_lock_irqsave(&host->lock, flags); if (host->cmd && !sdhci_data_line_cmd(host->cmd)) { @@ -2002,7 +2002,7 @@ Signed-off-by: Phil Elwell mmc_hostname(host->mmc)); sdhci_err_stats_inc(host, REQ_TIMEOUT); sdhci_dumpregs(host); -@@ -3240,7 +3240,7 @@ static void sdhci_timeout_data_timer(str +@@ -3235,7 +3235,7 @@ static void sdhci_timeout_data_timer(str if (host->data || host->data_cmd || (host->cmd && sdhci_data_line_cmd(host->cmd))) { diff --git a/target/linux/bcm27xx/patches-6.6/950-0133-lan78xx-Debounce-link-events-to-minimize-poll-storm.patch b/target/linux/bcm27xx/patches-6.6/950-0133-lan78xx-Debounce-link-events-to-minimize-poll-storm.patch index 2ca2550acb3823..46bfe50f1aa490 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0133-lan78xx-Debounce-link-events-to-minimize-poll-storm.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0133-lan78xx-Debounce-link-events-to-minimize-poll-storm.patch @@ -29,7 +29,7 @@ See: https://github.com/raspberrypi/linux/issues/2447 static int lan78xx_read_reg(struct lan78xx_net *dev, u32 index, u32 *data) { u32 *buf; -@@ -4458,7 +4463,13 @@ static int lan78xx_probe(struct usb_inte +@@ -4456,7 +4461,13 @@ static int lan78xx_probe(struct usb_inte if (ret < 0) goto out4; diff --git a/target/linux/bcm27xx/patches-6.6/950-0167-drm-v3d-Clock-V3D-down-when-not-in-use.patch b/target/linux/bcm27xx/patches-6.6/950-0167-drm-v3d-Clock-V3D-down-when-not-in-use.patch index e15fafed50876b..099cf75a817599 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0167-drm-v3d-Clock-V3D-down-when-not-in-use.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0167-drm-v3d-Clock-V3D-down-when-not-in-use.patch @@ -59,7 +59,7 @@ Signed-off-by: Phil Elwell irq_disable: --- a/drivers/gpu/drm/v3d/v3d_drv.h +++ b/drivers/gpu/drm/v3d/v3d_drv.h -@@ -76,6 +76,12 @@ struct v3d_dev { +@@ -84,6 +84,12 @@ struct v3d_dev { void __iomem *bridge_regs; void __iomem *gca_regs; struct clk *clk; @@ -130,7 +130,7 @@ Signed-off-by: Phil Elwell v3d_init_core(struct v3d_dev *v3d, int core) { /* Set OVRTMUOUT, which means that the texture sampler uniform -@@ -318,6 +360,7 @@ static void +@@ -320,6 +362,7 @@ static void v3d_job_free(struct kref *ref) { struct v3d_job *job = container_of(ref, struct v3d_job, refcount); @@ -138,7 +138,7 @@ Signed-off-by: Phil Elwell int i; if (job->bo) { -@@ -329,6 +372,8 @@ v3d_job_free(struct kref *ref) +@@ -331,6 +374,8 @@ v3d_job_free(struct kref *ref) dma_fence_put(job->irq_fence); dma_fence_put(job->done_fence); @@ -147,7 +147,7 @@ Signed-off-by: Phil Elwell if (job->perfmon) v3d_perfmon_put(job->perfmon); -@@ -448,6 +493,7 @@ v3d_job_init(struct v3d_dev *v3d, struct +@@ -450,6 +495,7 @@ v3d_job_init(struct v3d_dev *v3d, struct goto fail_deps; } @@ -155,7 +155,7 @@ Signed-off-by: Phil Elwell kref_init(&job->refcount); return 0; -@@ -1031,6 +1077,9 @@ v3d_gem_init(struct drm_device *dev) +@@ -1033,6 +1079,9 @@ v3d_gem_init(struct drm_device *dev) if (ret) return ret; diff --git a/target/linux/bcm27xx/patches-6.6/950-0188-v3d_gem-Kick-the-clock-so-firmware-knows-we-are-usin.patch b/target/linux/bcm27xx/patches-6.6/950-0188-v3d_gem-Kick-the-clock-so-firmware-knows-we-are-usin.patch index 19c0ddaf3e671e..7850e796fc311d 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0188-v3d_gem-Kick-the-clock-so-firmware-knows-we-are-usin.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0188-v3d_gem-Kick-the-clock-so-firmware-knows-we-are-usin.patch @@ -14,7 +14,7 @@ Signed-off-by: popcornmix --- a/drivers/gpu/drm/v3d/v3d_gem.c +++ b/drivers/gpu/drm/v3d/v3d_gem.c -@@ -1080,6 +1080,10 @@ v3d_gem_init(struct drm_device *dev) +@@ -1082,6 +1082,10 @@ v3d_gem_init(struct drm_device *dev) mutex_init(&v3d->clk_lock); INIT_DELAYED_WORK(&v3d->clk_down_work, v3d_clock_down_work); diff --git a/target/linux/bcm27xx/patches-6.6/950-0441-Bluetooth-hci_sync-Add-fallback-bd-address-prop.patch b/target/linux/bcm27xx/patches-6.6/950-0441-Bluetooth-hci_sync-Add-fallback-bd-address-prop.patch index 20cfa48ea47498..c1173c30fcf447 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0441-Bluetooth-hci_sync-Add-fallback-bd-address-prop.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0441-Bluetooth-hci_sync-Add-fallback-bd-address-prop.patch @@ -20,7 +20,7 @@ Signed-off-by: Phil Elwell --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c -@@ -4883,6 +4883,7 @@ static const struct { +@@ -4879,6 +4879,7 @@ static const struct { */ static int hci_dev_setup_sync(struct hci_dev *hdev) { @@ -28,7 +28,7 @@ Signed-off-by: Phil Elwell int ret = 0; bool invalid_bdaddr; size_t i; -@@ -4911,7 +4912,8 @@ static int hci_dev_setup_sync(struct hci +@@ -4907,7 +4908,8 @@ static int hci_dev_setup_sync(struct hci test_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks); if (!ret) { if (test_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks) && diff --git a/target/linux/bcm27xx/patches-6.6/950-0464-drm-v3d-New-debugfs-end-points-to-query-GPU-usage-st.patch b/target/linux/bcm27xx/patches-6.6/950-0464-drm-v3d-New-debugfs-end-points-to-query-GPU-usage-st.patch index c2c73a8c964649..edf49764b7193c 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0464-drm-v3d-New-debugfs-end-points-to-query-GPU-usage-st.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0464-drm-v3d-New-debugfs-end-points-to-query-GPU-usage-st.patch @@ -201,7 +201,7 @@ Signed-off-by: Jose Maria Casanova Crespo /* Performance monitor object. The perform lifetime is controlled by userspace * using perfmon related ioctls. A perfmon can be attached to a submit_cl * request, and when this is the case, HW perf counters will be activated just -@@ -147,6 +198,8 @@ struct v3d_dev { +@@ -155,6 +206,8 @@ struct v3d_dev { u32 num_allocated; u32 pages_allocated; } bo_stats; @@ -210,7 +210,7 @@ Signed-off-by: Jose Maria Casanova Crespo }; static inline struct v3d_dev * -@@ -244,6 +297,11 @@ struct v3d_job { +@@ -252,6 +305,11 @@ struct v3d_job { */ struct v3d_perfmon *perfmon; @@ -222,7 +222,7 @@ Signed-off-by: Jose Maria Casanova Crespo /* Callback for the freeing of the job on refcount going to 0. */ void (*free)(struct kref *ref); }; -@@ -408,6 +466,7 @@ void v3d_mmu_remove_ptes(struct v3d_bo * +@@ -416,6 +474,7 @@ void v3d_mmu_remove_ptes(struct v3d_bo * /* v3d_sched.c */ int v3d_sched_init(struct v3d_dev *v3d); void v3d_sched_fini(struct v3d_dev *v3d); @@ -232,7 +232,7 @@ Signed-off-by: Jose Maria Casanova Crespo void v3d_perfmon_get(struct v3d_perfmon *perfmon); --- a/drivers/gpu/drm/v3d/v3d_gem.c +++ b/drivers/gpu/drm/v3d/v3d_gem.c -@@ -460,6 +460,7 @@ v3d_job_init(struct v3d_dev *v3d, struct +@@ -462,6 +462,7 @@ v3d_job_init(struct v3d_dev *v3d, struct job = *container; job->v3d = v3d; job->free = free; diff --git a/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch b/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch index 7ab01e4623a68b..727f2996155853 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch @@ -24,7 +24,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c -@@ -486,6 +486,7 @@ static void xhci_pci_quirks(struct devic +@@ -511,6 +511,7 @@ static void xhci_pci_quirks(struct devic xhci->quirks |= XHCI_LPM_SUPPORT; xhci->quirks |= XHCI_TRB_OVERFETCH; xhci->quirks |= XHCI_EP_CTX_BROKEN_DCS; @@ -52,9 +52,9 @@ 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 -@@ -1660,6 +1660,9 @@ struct xhci_hcd { - #define XHCI_CDNS_SCTX_QUIRK BIT_ULL(48) +@@ -1661,6 +1661,9 @@ struct xhci_hcd { #define XHCI_ETRON_HOST BIT_ULL(49) + #define XHCI_LIMIT_ENDPOINT_INTERVAL_9 BIT_ULL(50) +/* Downstream VLI fixes */ +#define XHCI_AVOID_DQ_ON_LINK BIT_ULL(56) diff --git a/target/linux/bcm27xx/patches-6.6/950-0484-usb-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch b/target/linux/bcm27xx/patches-6.6/950-0484-usb-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch index cad297ab7393c6..e9ad87d316dd2b 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0484-usb-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0484-usb-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch @@ -51,7 +51,7 @@ Signed-off-by: Jonathan Bell ep_index = xhci_get_endpoint_index(&ep->desc); ep_ctx = xhci_get_ep_ctx(xhci, virt_dev->in_ctx, ep_index); -@@ -1445,9 +1448,35 @@ int xhci_endpoint_init(struct xhci_hcd * +@@ -1449,9 +1452,35 @@ int xhci_endpoint_init(struct xhci_hcd * mult = xhci_get_endpoint_mult(udev, ep); max_packet = usb_endpoint_maxp(&ep->desc); @@ -90,7 +90,7 @@ Signed-off-by: Jonathan Bell /* Allow 3 retries for everything but isoc, set CErr = 3 */ --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c -@@ -487,6 +487,7 @@ static void xhci_pci_quirks(struct devic +@@ -512,6 +512,7 @@ static void xhci_pci_quirks(struct devic xhci->quirks |= XHCI_TRB_OVERFETCH; xhci->quirks |= XHCI_EP_CTX_BROKEN_DCS; xhci->quirks |= XHCI_AVOID_DQ_ON_LINK; @@ -100,7 +100,7 @@ Signed-off-by: Jonathan Bell if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1662,6 +1662,7 @@ struct xhci_hcd { +@@ -1663,6 +1663,7 @@ struct xhci_hcd { /* Downstream VLI fixes */ #define XHCI_AVOID_DQ_ON_LINK BIT_ULL(56) diff --git a/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch b/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch index 99059c12dbab19..c820ed89a246c3 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch @@ -47,7 +47,7 @@ Signed-off-by: Jonathan Bell /* Device for a quirk */ #define PCI_VENDOR_ID_FRESCO_LOGIC 0x1b73 #define PCI_DEVICE_ID_FRESCO_LOGIC_PDK 0x1000 -@@ -297,6 +299,16 @@ static int xhci_pci_reinit(struct xhci_h +@@ -307,6 +309,16 @@ static int xhci_pci_reinit(struct xhci_h return 0; } @@ -64,7 +64,7 @@ Signed-off-by: Jonathan Bell static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) { struct pci_dev *pdev = to_pci_dev(dev); -@@ -488,6 +500,8 @@ static void xhci_pci_quirks(struct devic +@@ -513,6 +525,8 @@ 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_SS_BULK_OUT_BUG; @@ -144,7 +144,7 @@ Signed-off-by: Jonathan Bell return 0; --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1663,6 +1663,7 @@ struct xhci_hcd { +@@ -1664,6 +1664,7 @@ struct xhci_hcd { /* Downstream VLI fixes */ #define XHCI_AVOID_DQ_ON_LINK BIT_ULL(56) #define XHCI_VLI_SS_BULK_OUT_BUG BIT_ULL(57) diff --git a/target/linux/bcm27xx/patches-6.6/950-0514-sdhci-Add-SD-Express-hook.patch b/target/linux/bcm27xx/patches-6.6/950-0514-sdhci-Add-SD-Express-hook.patch index e1ea7998ed505e..17c7d2f96571f3 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0514-sdhci-Add-SD-Express-hook.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0514-sdhci-Add-SD-Express-hook.patch @@ -26,7 +26,7 @@ sdhci: remove PYA0_INTR_BUG quirk. Add quirks to disable some of the higher SDR static int dwcmshc_rk35xx_init(struct sdhci_host *host, struct dwcmshc_priv *dwc_priv) --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c -@@ -3055,6 +3055,15 @@ static void sdhci_card_event(struct mmc_ +@@ -3050,6 +3050,15 @@ static void sdhci_card_event(struct mmc_ spin_unlock_irqrestore(&host->lock, flags); } @@ -42,7 +42,7 @@ sdhci: remove PYA0_INTR_BUG quirk. Add quirks to disable some of the higher SDR static const struct mmc_host_ops sdhci_ops = { .request = sdhci_request, .post_req = sdhci_post_req, -@@ -3070,6 +3079,7 @@ static const struct mmc_host_ops sdhci_o +@@ -3065,6 +3074,7 @@ static const struct mmc_host_ops sdhci_o .execute_tuning = sdhci_execute_tuning, .card_event = sdhci_card_event, .card_busy = sdhci_card_busy, @@ -50,7 +50,7 @@ sdhci: remove PYA0_INTR_BUG quirk. Add quirks to disable some of the higher SDR }; /*****************************************************************************\ -@@ -4588,6 +4598,15 @@ int sdhci_setup_host(struct sdhci_host * +@@ -4583,6 +4593,15 @@ int sdhci_setup_host(struct sdhci_host * !(host->quirks2 & SDHCI_QUIRK2_BROKEN_DDR50)) mmc->caps |= MMC_CAP_UHS_DDR50; diff --git a/target/linux/bcm27xx/patches-6.6/950-0535-i2c-designware-Add-SMBUS-quick-command-support.patch b/target/linux/bcm27xx/patches-6.6/950-0535-i2c-designware-Add-SMBUS-quick-command-support.patch index e588003e6e56e0..ff1c5ba890168b 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0535-i2c-designware-Add-SMBUS-quick-command-support.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0535-i2c-designware-Add-SMBUS-quick-command-support.patch @@ -40,7 +40,7 @@ Signed-off-by: Phil Elwell regmap_update_bits(dev->map, DW_IC_CON, DW_IC_CON_10BITADDR_MASTER, ic_con); -@@ -500,6 +504,14 @@ i2c_dw_xfer_msg(struct dw_i2c_dev *dev) +@@ -501,6 +505,14 @@ i2c_dw_xfer_msg(struct dw_i2c_dev *dev) regmap_read(dev->map, DW_IC_RXFLR, &flr); rx_limit = dev->rx_fifo_depth - flr; @@ -55,7 +55,7 @@ Signed-off-by: Phil Elwell while (buf_len > 0 && tx_limit > 0 && rx_limit > 0) { u32 cmd = 0; -@@ -781,7 +793,7 @@ static const struct i2c_algorithm i2c_dw +@@ -782,7 +794,7 @@ static const struct i2c_algorithm i2c_dw }; static const struct i2c_adapter_quirks i2c_dw_quirks = { @@ -64,7 +64,7 @@ Signed-off-by: Phil Elwell }; static u32 i2c_dw_read_clear_intrbits(struct dw_i2c_dev *dev) -@@ -914,7 +926,8 @@ void i2c_dw_configure_master(struct dw_i +@@ -915,7 +927,8 @@ void i2c_dw_configure_master(struct dw_i { struct i2c_timings *t = &dev->timings; diff --git a/target/linux/bcm27xx/patches-6.6/950-0555-drm-v3d-fix-up-register-addresses-for-V3D-7.x.patch b/target/linux/bcm27xx/patches-6.6/950-0555-drm-v3d-fix-up-register-addresses-for-V3D-7.x.patch index 965571e533e1c9..b755c393b5650f 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0555-drm-v3d-fix-up-register-addresses-for-V3D-7.x.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0555-drm-v3d-fix-up-register-addresses-for-V3D-7.x.patch @@ -335,9 +335,9 @@ v2: fix kernel panic with debug-fs interface to list registers + V3D_CORE_WRITE(core, V3D_CTL_INT_CLR, V3D_CORE_IRQS(v3d->ver)); + V3D_WRITE(V3D_HUB_INT_CLR, V3D_HUB_IRQS(v3d->ver)); - irq1 = platform_get_irq_optional(v3d_to_pdev(v3d), 1); - if (irq1 == -EPROBE_DEFER) -@@ -276,12 +283,12 @@ v3d_irq_enable(struct v3d_dev *v3d) + irq = platform_get_irq_optional(v3d_to_pdev(v3d), 1); + if (irq == -EPROBE_DEFER) +@@ -287,12 +294,12 @@ v3d_irq_enable(struct v3d_dev *v3d) /* Enable our set of interrupts, masking out any others. */ for (core = 0; core < v3d->cores; core++) { @@ -354,7 +354,7 @@ v2: fix kernel panic with debug-fs interface to list registers } void -@@ -296,8 +303,8 @@ v3d_irq_disable(struct v3d_dev *v3d) +@@ -313,8 +320,8 @@ v3d_irq_disable(struct v3d_dev *v3d) /* Clear any pending interrupts we might have left. */ for (core = 0; core < v3d->cores; core++) diff --git a/target/linux/bcm27xx/patches-6.6/950-0716-drivers-mmc-sdhci-add-SPURIOUS_INT_RESP-quirk.patch b/target/linux/bcm27xx/patches-6.6/950-0716-drivers-mmc-sdhci-add-SPURIOUS_INT_RESP-quirk.patch index 46b33165b2f30c..aacc0e76531019 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0716-drivers-mmc-sdhci-add-SPURIOUS_INT_RESP-quirk.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0716-drivers-mmc-sdhci-add-SPURIOUS_INT_RESP-quirk.patch @@ -36,7 +36,7 @@ Signed-off-by: Jonathan Bell sdhci_writew(host, SDHCI_MAKE_CMD(cmd->opcode, flags), SDHCI_COMMAND); return true; -@@ -3314,6 +3320,11 @@ static void sdhci_cmd_irq(struct sdhci_h +@@ -3309,6 +3315,11 @@ static void sdhci_cmd_irq(struct sdhci_h if (intmask & SDHCI_INT_TIMEOUT) { host->cmd->error = -ETIMEDOUT; sdhci_err_stats_inc(host, CMD_TIMEOUT); diff --git a/target/linux/bcm27xx/patches-6.6/950-1116-mmc-sdhci-extend-maximum-ADMA-transfer-length-to-4Mi.patch b/target/linux/bcm27xx/patches-6.6/950-1116-mmc-sdhci-extend-maximum-ADMA-transfer-length-to-4Mi.patch index 9389ecf4d884a3..f0756b59451b7d 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1116-mmc-sdhci-extend-maximum-ADMA-transfer-length-to-4Mi.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1116-mmc-sdhci-extend-maximum-ADMA-transfer-length-to-4Mi.patch @@ -24,7 +24,7 @@ Signed-off-by: Jonathan Bell BUG_ON(data->blksz > host->mmc->max_blk_size); BUG_ON(data->blocks > 65535); -@@ -4732,11 +4732,16 @@ int sdhci_setup_host(struct sdhci_host * +@@ -4727,11 +4727,16 @@ int sdhci_setup_host(struct sdhci_host * spin_lock_init(&host->lock); /* diff --git a/target/linux/bcm27xx/patches-6.6/950-1218-Bluetooth-hci_sync-Fix-crash-on-NULL-parent.patch b/target/linux/bcm27xx/patches-6.6/950-1218-Bluetooth-hci_sync-Fix-crash-on-NULL-parent.patch index f5494ab1b88c68..dcc38a3c647279 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1218-Bluetooth-hci_sync-Fix-crash-on-NULL-parent.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1218-Bluetooth-hci_sync-Fix-crash-on-NULL-parent.patch @@ -15,7 +15,7 @@ Signed-off-by: Phil Elwell --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c -@@ -4883,7 +4883,8 @@ static const struct { +@@ -4879,7 +4879,8 @@ static const struct { */ static int hci_dev_setup_sync(struct hci_dev *hdev) { diff --git a/target/linux/bcm27xx/patches-6.6/950-1260-drivers-mmc-disable-write-caching-on-Samsung-2023-mo.patch b/target/linux/bcm27xx/patches-6.6/950-1260-drivers-mmc-disable-write-caching-on-Samsung-2023-mo.patch index 327c74d720b6d3..1453bfa9e62079 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1260-drivers-mmc-disable-write-caching-on-Samsung-2023-mo.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1260-drivers-mmc-disable-write-caching-on-Samsung-2023-mo.patch @@ -30,9 +30,9 @@ Signed-off-by: Jonathan Bell #define CID_MANFID_KINGSTON 0x70 --- a/drivers/mmc/core/quirks.h +++ b/drivers/mmc/core/quirks.h -@@ -44,6 +44,14 @@ static const struct mmc_fixup __maybe_un - 0, -1ull, SDIO_ANY_ID, SDIO_ANY_ID, add_quirk_sd, - MMC_QUIRK_NO_UHS_DDR50_TUNING, EXT_CSD_REV_ANY), +@@ -58,6 +58,14 @@ static const struct mmc_fixup __maybe_un + MMC_FIXUP("SD32G", 0x41, 0x3432, add_quirk, MMC_QUIRK_ERASE_BROKEN), + MMC_FIXUP("SD64G", 0x41, 0x3432, add_quirk, MMC_QUIRK_ERASE_BROKEN), + /* + * Samsung Pro Plus/EVO Plus/Pro Ultimate SD cards (2023) claim to cache diff --git a/target/linux/bcm27xx/patches-6.6/950-1333-mmc-quirks-disable-cache-on-more-known-bad-Sandisk-c.patch b/target/linux/bcm27xx/patches-6.6/950-1333-mmc-quirks-disable-cache-on-more-known-bad-Sandisk-c.patch index 0d8111b8901032..b079ae700d848e 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1333-mmc-quirks-disable-cache-on-more-known-bad-Sandisk-c.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1333-mmc-quirks-disable-cache-on-more-known-bad-Sandisk-c.patch @@ -14,7 +14,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/mmc/core/quirks.h +++ b/drivers/mmc/core/quirks.h -@@ -52,6 +52,18 @@ static const struct mmc_fixup __maybe_un +@@ -66,6 +66,18 @@ static const struct mmc_fixup __maybe_un 0, -1ull, SDIO_ANY_ID, SDIO_ANY_ID, add_quirk_sd, MMC_QUIRK_BROKEN_SD_CACHE, EXT_CSD_REV_ANY), diff --git a/target/linux/bcm27xx/patches-6.6/950-1336-mmc-quirks-add-MMC_QUIRK_BROKEN_ERASE-for-Phison-Int.patch b/target/linux/bcm27xx/patches-6.6/950-1336-mmc-quirks-add-MMC_QUIRK_BROKEN_ERASE-for-Phison-Int.patch index 83535468288972..878c56b579775b 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1336-mmc-quirks-add-MMC_QUIRK_BROKEN_ERASE-for-Phison-Int.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1336-mmc-quirks-add-MMC_QUIRK_BROKEN_ERASE-for-Phison-Int.patch @@ -16,8 +16,8 @@ Signed-off-by: Jonathan Bell --- a/drivers/mmc/core/quirks.h +++ b/drivers/mmc/core/quirks.h @@ -181,6 +181,15 @@ static const struct mmc_fixup __maybe_un - MMC_FIXUP("SD32G", 0x41, 0x3432, add_quirk, MMC_QUIRK_ERASE_BROKEN), - MMC_FIXUP("SD64G", 0x41, 0x3432, add_quirk, MMC_QUIRK_ERASE_BROKEN), + MMC_FIXUP("M62704", CID_MANFID_KINGSTON, 0x0100, add_quirk_mmc, + MMC_QUIRK_TRIM_BROKEN), + /* + * Larger Integral SD cards using rebranded Phison controllers trash diff --git a/target/linux/bcm27xx/patches-6.6/950-1396-i2c-designware-Add-support-for-bus-clear-feature.patch b/target/linux/bcm27xx/patches-6.6/950-1396-i2c-designware-Add-support-for-bus-clear-feature.patch index df2aad53c4ebba..0f08ef43e40bb5 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1396-i2c-designware-Add-support-for-bus-clear-feature.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1396-i2c-designware-Add-support-for-bus-clear-feature.patch @@ -134,7 +134,7 @@ Signed-off-by: Phil Elwell /* Write SDA hold time if supported */ if (dev->sda_hold_time) regmap_write(dev->map, DW_IC_SDA_HOLD, dev->sda_hold_time); -@@ -1049,6 +1061,7 @@ int i2c_dw_probe_master(struct dw_i2c_de +@@ -1050,6 +1062,7 @@ int i2c_dw_probe_master(struct dw_i2c_de struct i2c_adapter *adap = &dev->adapter; unsigned long irq_flags; unsigned int ic_con; @@ -142,7 +142,7 @@ Signed-off-by: Phil Elwell int ret; init_completion(&dev->cmd_complete); -@@ -1083,7 +1096,11 @@ int i2c_dw_probe_master(struct dw_i2c_de +@@ -1084,7 +1097,11 @@ int i2c_dw_probe_master(struct dw_i2c_de if (ret) return ret; diff --git a/target/linux/bcm27xx/patches-6.6/950-1507-mmc-set-MMC_QUIRK_KNOWN_WORKING_SD_CQ-on-Raspberry-P.patch b/target/linux/bcm27xx/patches-6.6/950-1507-mmc-set-MMC_QUIRK_KNOWN_WORKING_SD_CQ-on-Raspberry-P.patch index ac3e2ebf374a80..3002cc5be60783 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1507-mmc-set-MMC_QUIRK_KNOWN_WORKING_SD_CQ-on-Raspberry-P.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1507-mmc-set-MMC_QUIRK_KNOWN_WORKING_SD_CQ-on-Raspberry-P.patch @@ -26,7 +26,7 @@ Signed-off-by: Jonathan Bell #define END_FIXUP { NULL } --- a/drivers/mmc/core/quirks.h +++ b/drivers/mmc/core/quirks.h -@@ -76,6 +76,12 @@ static const struct mmc_fixup __maybe_un +@@ -90,6 +90,12 @@ static const struct mmc_fixup __maybe_un 0, -1ull, SDIO_ANY_ID, SDIO_ANY_ID, add_quirk_sd, MMC_QUIRK_BROKEN_SD_CACHE, EXT_CSD_REV_ANY), diff --git a/target/linux/bcm27xx/patches-6.6/950-1553-drm-v3d-Associate-a-V3D-tech-revision-to-all-support.patch b/target/linux/bcm27xx/patches-6.6/950-1553-drm-v3d-Associate-a-V3D-tech-revision-to-all-support.patch index 2ada8c88a010fb..0b3f80704b19a1 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1553-drm-v3d-Associate-a-V3D-tech-revision-to-all-support.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1553-drm-v3d-Associate-a-V3D-tech-revision-to-all-support.patch @@ -275,8 +275,8 @@ Signed-off-by: Maíra Canal goto clk_disable; --- a/drivers/gpu/drm/v3d/v3d_drv.h +++ b/drivers/gpu/drm/v3d/v3d_drv.h -@@ -115,13 +115,20 @@ struct v3d_perfmon { - u64 values[]; +@@ -121,13 +121,20 @@ enum v3d_irq { + V3D_MAX_IRQS, }; +enum v3d_gen { @@ -296,8 +296,8 @@ Signed-off-by: Maíra Canal + enum v3d_gen ver; bool single_irq_line; - void __iomem *hub_regs; -@@ -213,7 +220,7 @@ to_v3d_dev(struct drm_device *dev) + int irq[V3D_MAX_IRQS]; +@@ -221,7 +228,7 @@ to_v3d_dev(struct drm_device *dev) static inline bool v3d_has_csd(struct v3d_dev *v3d) { @@ -335,7 +335,7 @@ Signed-off-by: Maíra Canal return; V3D_GCA_WRITE(V3D_GCA_SAFE_SHUTDOWN, V3D_GCA_SAFE_SHUTDOWN_EN); -@@ -179,13 +179,13 @@ v3d_reset(struct v3d_dev *v3d) +@@ -181,13 +181,13 @@ v3d_reset(struct v3d_dev *v3d) static void v3d_flush_l3(struct v3d_dev *v3d) { @@ -351,7 +351,7 @@ Signed-off-by: Maíra Canal V3D_GCA_WRITE(V3D_GCA_CACHE_CTRL, gca_ctrl & ~V3D_GCA_CACHE_CTRL_FLUSH); } -@@ -198,7 +198,7 @@ v3d_flush_l3(struct v3d_dev *v3d) +@@ -200,7 +200,7 @@ v3d_flush_l3(struct v3d_dev *v3d) static void v3d_invalidate_l2c(struct v3d_dev *v3d, int core) { diff --git a/target/linux/bcm27xx/patches-6.6/950-1555-drm-v3d-Use-V3D_SMS-registers-for-power-on-off-and-r.patch b/target/linux/bcm27xx/patches-6.6/950-1555-drm-v3d-Use-V3D_SMS-registers-for-power-on-off-and-r.patch index e0169d9745918d..b405938cefca07 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1555-drm-v3d-Use-V3D_SMS-registers-for-power-on-off-and-r.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1555-drm-v3d-Use-V3D_SMS-registers-for-power-on-off-and-r.patch @@ -98,7 +98,7 @@ Signed-off-by: Maíra Canal --- a/drivers/gpu/drm/v3d/v3d_drv.h +++ b/drivers/gpu/drm/v3d/v3d_drv.h -@@ -135,6 +135,7 @@ struct v3d_dev { +@@ -143,6 +143,7 @@ struct v3d_dev { void __iomem *core_regs[3]; void __iomem *bridge_regs; void __iomem *gca_regs; @@ -106,7 +106,7 @@ Signed-off-by: Maíra Canal struct clk *clk; struct delayed_work clk_down_work; unsigned long clk_up_rate, clk_down_rate; -@@ -277,6 +278,15 @@ to_v3d_fence(struct dma_fence *fence) +@@ -285,6 +286,15 @@ to_v3d_fence(struct dma_fence *fence) #define V3D_GCA_READ(offset) readl(v3d->gca_regs + offset) #define V3D_GCA_WRITE(offset, val) writel(val, v3d->gca_regs + offset) @@ -122,7 +122,7 @@ Signed-off-by: Maíra Canal #define V3D_CORE_READ(core, offset) readl(v3d->core_regs[core] + offset) #define V3D_CORE_WRITE(core, offset, val) writel(val, v3d->core_regs[core] + offset) -@@ -455,6 +465,7 @@ int v3d_wait_bo_ioctl(struct drm_device +@@ -463,6 +473,7 @@ int v3d_wait_bo_ioctl(struct drm_device struct drm_file *file_priv); void v3d_job_cleanup(struct v3d_job *job); void v3d_job_put(struct v3d_job *job); @@ -155,8 +155,8 @@ Signed-off-by: Maíra Canal v3d_reset(struct v3d_dev *v3d) { struct drm_device *dev = &v3d->drm; -@@ -166,6 +182,7 @@ v3d_reset(struct v3d_dev *v3d) - v3d_idle_axi(v3d, 0); +@@ -168,6 +184,7 @@ v3d_reset(struct v3d_dev *v3d) + v3d_irq_disable(v3d); v3d_idle_gca(v3d); + v3d_reset_sms(v3d); diff --git a/target/linux/bcm53xx/patches-6.6/180-usb-xhci-add-support-for-performing-fake-doorbell.patch b/target/linux/bcm53xx/patches-6.6/180-usb-xhci-add-support-for-performing-fake-doorbell.patch index 5886cef55adb1f..f8d8f0069bc2e0 100644 --- a/target/linux/bcm53xx/patches-6.6/180-usb-xhci-add-support-for-performing-fake-doorbell.patch +++ b/target/linux/bcm53xx/patches-6.6/180-usb-xhci-add-support-for-performing-fake-doorbell.patch @@ -103,11 +103,11 @@ it on BCM4708 family. if (xhci->quirks & XHCI_NEC_HOST) --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1659,6 +1659,7 @@ struct xhci_hcd { - #define XHCI_WRITE_64_HI_LO BIT_ULL(47) +@@ -1660,6 +1660,7 @@ struct xhci_hcd { #define XHCI_CDNS_SCTX_QUIRK BIT_ULL(48) #define XHCI_ETRON_HOST BIT_ULL(49) -+#define XHCI_FAKE_DOORBELL BIT_ULL(50) + #define XHCI_LIMIT_ENDPOINT_INTERVAL_9 BIT_ULL(50) ++#define XHCI_FAKE_DOORBELL BIT_ULL(51) unsigned int num_active_eps; unsigned int limit_active_eps; diff --git a/target/linux/generic/backport-6.6/001-powerpc-kernel-Fix-pcc_save_regs-inclusion.patch b/target/linux/generic/backport-6.6/001-powerpc-kernel-Fix-pcc_save_regs-inclusion.patch deleted file mode 100644 index 3d3515f5ab7f07..00000000000000 --- a/target/linux/generic/backport-6.6/001-powerpc-kernel-Fix-pcc_save_regs-inclusion.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 93bd4a80efeb521314485a06d8c21157240497bb Mon Sep 17 00:00:00 2001 -From: Madhavan Srinivasan -Date: Sun, 11 May 2025 09:41:11 +0530 -Subject: powerpc/kernel: Fix ppc_save_regs inclusion in build - -Recent patch fixed an old commit -'fc2a5a6161a2 ("powerpc/64s: ppc_save_regs is now needed for all 64s builds")' -which is to include building of ppc_save_reg.c only when XMON -and KEXEC_CORE and PPC_BOOK3S are enabled. This was valid, since -ppc_save_regs was called only in replay_system_reset() of old -irq.c which was under BOOK3S. - -But there has been multiple refactoring of irq.c and have -added call to ppc_save_regs() from __replay_soft_interrupts --> replay_soft_interrupts which is part of irq_64.c included -under CONFIG_PPC64. And since ppc_save_regs is called in -CRASH_DUMP path as part of crash_setup_regs in kexec.h, -CONFIG_PPC32 also needs it. - -So with this recent patch which enabled the building of -ppc_save_regs.c caused a build break when none of these -(XMON, KEXEC_CORE, BOOK3S) where enabled as part of config. -Patch to enable building of ppc_save_regs.c by defaults. - -Signed-off-by: Madhavan Srinivasan -Link: https://patch.msgid.link/20250511041111.841158-1-maddy@linux.ibm.com ---- - arch/powerpc/kernel/Makefile | 2 -- - 1 file changed, 2 deletions(-) - ---- a/arch/powerpc/kernel/Makefile -+++ b/arch/powerpc/kernel/Makefile -@@ -165,9 +165,7 @@ endif - - obj64-$(CONFIG_PPC_TRANSACTIONAL_MEM) += tm.o - --ifneq ($(CONFIG_XMON)$(CONFIG_KEXEC_CORE)$(CONFIG_PPC_BOOK3S),) - obj-y += ppc_save_regs.o --endif - - obj-$(CONFIG_EPAPR_PARAVIRT) += epapr_paravirt.o epapr_hcalls.o - obj-$(CONFIG_KVM_GUEST) += kvm.o kvm_emul.o diff --git a/target/linux/generic/backport-6.6/0080-v6.9-smp-Avoid-setup_max_cpus_namespace_collision_shadowing.patch b/target/linux/generic/backport-6.6/0080-v6.9-smp-Avoid-setup_max_cpus_namespace_collision_shadowing.patch index c8cef08935c28d..f5459aaccd5e9f 100644 --- a/target/linux/generic/backport-6.6/0080-v6.9-smp-Avoid-setup_max_cpus_namespace_collision_shadowing.patch +++ b/target/linux/generic/backport-6.6/0080-v6.9-smp-Avoid-setup_max_cpus_namespace_collision_shadowing.patch @@ -21,7 +21,7 @@ Cc: linux-kernel@vger.kernel.org --- a/include/linux/cpu.h +++ b/include/linux/cpu.h -@@ -111,7 +111,7 @@ void notify_cpu_starting(unsigned int cp +@@ -112,7 +112,7 @@ void notify_cpu_starting(unsigned int cp extern void cpu_maps_update_begin(void); extern void cpu_maps_update_done(void); int bringup_hibernate_cpu(unsigned int sleep_cpu); diff --git a/target/linux/generic/backport-6.6/792-v6.16-igc-enable-HW-vlan-tag-insertion-stripping-by-defaul.patch b/target/linux/generic/backport-6.6/792-v6.16-igc-enable-HW-vlan-tag-insertion-stripping-by-defaul.patch index 0ca219457c6eb0..5be2e83ccea42a 100644 --- a/target/linux/generic/backport-6.6/792-v6.16-igc-enable-HW-vlan-tag-insertion-stripping-by-defaul.patch +++ b/target/linux/generic/backport-6.6/792-v6.16-igc-enable-HW-vlan-tag-insertion-stripping-by-defaul.patch @@ -20,7 +20,7 @@ Signed-off-by: Rui Salvaterra --- a/drivers/net/ethernet/intel/igc/igc_main.c +++ b/drivers/net/ethernet/intel/igc/igc_main.c -@@ -6850,6 +6850,9 @@ static int igc_probe(struct pci_dev *pde +@@ -6854,6 +6854,9 @@ static int igc_probe(struct pci_dev *pde netdev->xdp_features = NETDEV_XDP_ACT_BASIC | NETDEV_XDP_ACT_REDIRECT | NETDEV_XDP_ACT_XSK_ZEROCOPY; diff --git a/target/linux/generic/pending-6.6/681-net-remove-NETIF_F_GSO_FRAGLIST-from-NETIF_F_GSO_SOF.patch b/target/linux/generic/pending-6.6/681-net-remove-NETIF_F_GSO_FRAGLIST-from-NETIF_F_GSO_SOF.patch index ff0a9ca5ae0c8d..fffb6cbb54cfa8 100644 --- a/target/linux/generic/pending-6.6/681-net-remove-NETIF_F_GSO_FRAGLIST-from-NETIF_F_GSO_SOF.patch +++ b/target/linux/generic/pending-6.6/681-net-remove-NETIF_F_GSO_FRAGLIST-from-NETIF_F_GSO_SOF.patch @@ -107,7 +107,7 @@ Signed-off-by: Felix Fietkau if (sk_can_gso(sk)) { --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h -@@ -1996,7 +1996,7 @@ void ieee80211_color_collision_detection +@@ -2005,7 +2005,7 @@ void ieee80211_color_collision_detection /* interface handling */ #define MAC80211_SUPPORTED_FEATURES_TX (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | \ NETIF_F_HW_CSUM | NETIF_F_SG | \ diff --git a/target/linux/mediatek/patches-6.6/330-snand-mtk-bmt-support.patch b/target/linux/mediatek/patches-6.6/330-snand-mtk-bmt-support.patch index 939ec048555787..06026f375ec313 100644 --- a/target/linux/mediatek/patches-6.6/330-snand-mtk-bmt-support.patch +++ b/target/linux/mediatek/patches-6.6/330-snand-mtk-bmt-support.patch @@ -8,7 +8,7 @@ static int spinand_read_reg_op(struct spinand_device *spinand, u8 reg, u8 *val) { -@@ -1347,6 +1348,7 @@ static int spinand_probe(struct spi_mem +@@ -1348,6 +1349,7 @@ static int spinand_probe(struct spi_mem if (ret) return ret; @@ -16,7 +16,7 @@ ret = mtd_device_register(mtd, NULL, 0); if (ret) goto err_spinand_cleanup; -@@ -1354,6 +1356,7 @@ static int spinand_probe(struct spi_mem +@@ -1355,6 +1357,7 @@ static int spinand_probe(struct spi_mem return 0; err_spinand_cleanup: @@ -24,7 +24,7 @@ spinand_cleanup(spinand); return ret; -@@ -1372,6 +1375,7 @@ static int spinand_remove(struct spi_mem +@@ -1373,6 +1376,7 @@ static int spinand_remove(struct spi_mem if (ret) return ret; diff --git a/target/linux/mediatek/patches-6.6/960-asus-hack-u-boot-ignore-mtdparts.patch b/target/linux/mediatek/patches-6.6/960-asus-hack-u-boot-ignore-mtdparts.patch index 0fe2b95e8a7dd9..9b503527cef58b 100644 --- a/target/linux/mediatek/patches-6.6/960-asus-hack-u-boot-ignore-mtdparts.patch +++ b/target/linux/mediatek/patches-6.6/960-asus-hack-u-boot-ignore-mtdparts.patch @@ -29,7 +29,7 @@ Signed-off-by: Daniel Golle --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c -@@ -1441,6 +1441,7 @@ static int spinand_remove(struct spi_mem +@@ -1442,6 +1442,7 @@ static int spinand_remove(struct spi_mem static const struct spi_device_id spinand_ids[] = { { .name = "spi-nand" }, @@ -37,7 +37,7 @@ Signed-off-by: Daniel Golle { /* sentinel */ }, }; MODULE_DEVICE_TABLE(spi, spinand_ids); -@@ -1448,6 +1449,7 @@ MODULE_DEVICE_TABLE(spi, spinand_ids); +@@ -1449,6 +1450,7 @@ MODULE_DEVICE_TABLE(spi, spinand_ids); #ifdef CONFIG_OF static const struct of_device_id spinand_of_ids[] = { { .compatible = "spi-nand" }, diff --git a/target/linux/ramips/patches-6.6/831-mmc-mtk-sd-initialize-pad-delay-and-drive-strength.patch b/target/linux/ramips/patches-6.6/831-mmc-mtk-sd-initialize-pad-delay-and-drive-strength.patch index 7fd7b3af43d28a..1e9b8d173b2125 100644 --- a/target/linux/ramips/patches-6.6/831-mmc-mtk-sd-initialize-pad-delay-and-drive-strength.patch +++ b/target/linux/ramips/patches-6.6/831-mmc-mtk-sd-initialize-pad-delay-and-drive-strength.patch @@ -38,7 +38,7 @@ Signed-off-by: Shiji Yang }; static const struct mtk_mmc_compatible mt7622_compat = { -@@ -1731,9 +1737,11 @@ static void msdc_init_hw(struct msdc_hos +@@ -1748,9 +1754,11 @@ static void msdc_init_hw(struct msdc_hos } writel(0, host->base + MSDC_IOCON); sdr_set_field(host->base + MSDC_IOCON, MSDC_IOCON_DDLSEL, 0); @@ -53,7 +53,7 @@ Signed-off-by: Shiji Yang sdr_set_bits(host->base + EMMC50_CFG0, EMMC50_CFG_CFCSTS_SEL); if (host->dev_comp->stop_clk_fix) { -@@ -1797,6 +1805,18 @@ static void msdc_init_hw(struct msdc_hos +@@ -1814,6 +1822,18 @@ static void msdc_init_hw(struct msdc_hos MSDC_PAD_TUNE_RXDLYSEL); } diff --git a/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch b/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch index dff0c26fab9f42..fb35138ad3dfe6 100644 --- a/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch +++ b/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch @@ -50,7 +50,7 @@ Signed-off-by: minda.chen #include "xhci.h" #include "xhci-trace.h" -@@ -1878,6 +1879,7 @@ EXPORT_SYMBOL_GPL(xhci_remove_secondary_ +@@ -1882,6 +1883,7 @@ EXPORT_SYMBOL_GPL(xhci_remove_secondary_ void xhci_mem_cleanup(struct xhci_hcd *xhci) { struct device *dev = xhci_to_hcd(xhci)->self.sysdev; @@ -58,7 +58,7 @@ Signed-off-by: minda.chen int i, j, num_ports; cancel_delayed_work_sync(&xhci->cmd_timer); -@@ -1928,6 +1930,13 @@ void xhci_mem_cleanup(struct xhci_hcd *x +@@ -1932,6 +1934,13 @@ void xhci_mem_cleanup(struct xhci_hcd *x xhci_dbg_trace(xhci, trace_xhci_dbg_init, "Freed medium stream array pool"); @@ -72,7 +72,7 @@ Signed-off-by: minda.chen if (xhci->dcbaa) dma_free_coherent(dev, sizeof(*xhci->dcbaa), xhci->dcbaa, xhci->dcbaa->dma); -@@ -2399,6 +2408,55 @@ xhci_create_secondary_interrupter(struct +@@ -2403,6 +2412,55 @@ xhci_create_secondary_interrupter(struct } EXPORT_SYMBOL_GPL(xhci_create_secondary_interrupter); @@ -128,7 +128,7 @@ Signed-off-by: minda.chen int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) { struct xhci_interrupter *ir; -@@ -2540,6 +2598,12 @@ int xhci_mem_init(struct xhci_hcd *xhci, +@@ -2544,6 +2602,12 @@ int xhci_mem_init(struct xhci_hcd *xhci, xhci->isoc_bei_interval = AVOID_BEI_INTERVAL_MAX; @@ -277,16 +277,16 @@ Signed-off-by: minda.chen /* There is one xhci_hcd structure per controller */ struct xhci_hcd { struct usb_hcd *main_hcd; -@@ -1660,6 +1667,8 @@ struct xhci_hcd { - #define XHCI_CDNS_SCTX_QUIRK BIT_ULL(48) +@@ -1661,6 +1668,8 @@ struct xhci_hcd { #define XHCI_ETRON_HOST BIT_ULL(49) + #define XHCI_LIMIT_ENDPOINT_INTERVAL_9 BIT_ULL(50) +#define XHCI_LOCAL_BUFFER BIT_ULL(63) + unsigned int num_active_eps; unsigned int limit_active_eps; struct xhci_port *hw_ports; -@@ -1689,6 +1698,8 @@ struct xhci_hcd { +@@ -1690,6 +1699,8 @@ struct xhci_hcd { struct list_head regset_list; void *dbc; diff --git a/target/linux/starfive/patches-6.6/0110-usb-xhci-using-dma_alloc_noncoherent-to-alloc-low-me.patch b/target/linux/starfive/patches-6.6/0110-usb-xhci-using-dma_alloc_noncoherent-to-alloc-low-me.patch index b955ba810355e1..e5dfb37078722a 100644 --- a/target/linux/starfive/patches-6.6/0110-usb-xhci-using-dma_alloc_noncoherent-to-alloc-low-me.patch +++ b/target/linux/starfive/patches-6.6/0110-usb-xhci-using-dma_alloc_noncoherent-to-alloc-low-me.patch @@ -16,7 +16,7 @@ Signed-off-by: Minda Chen --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c -@@ -1932,7 +1932,8 @@ void xhci_mem_cleanup(struct xhci_hcd *x +@@ -1936,7 +1936,8 @@ void xhci_mem_cleanup(struct xhci_hcd *x if (xhci->lowmem_pool.pool) { pool = &xhci->lowmem_pool; @@ -26,7 +26,7 @@ Signed-off-by: Minda Chen gen_pool_destroy(pool->pool); pool->pool = NULL; } -@@ -2419,15 +2420,15 @@ int xhci_setup_local_lowmem(struct xhci_ +@@ -2423,15 +2424,15 @@ int xhci_setup_local_lowmem(struct xhci_ if (!pool->pool) { /* minimal alloc one page */ pool->pool = gen_pool_create(PAGE_SHIFT, dev_to_node(hcd->self.sysdev)); @@ -48,7 +48,7 @@ Signed-off-by: Minda Chen goto destroy_pool; } -@@ -2437,11 +2438,11 @@ int xhci_setup_local_lowmem(struct xhci_ +@@ -2441,11 +2442,11 @@ int xhci_setup_local_lowmem(struct xhci_ * for it. */ err = gen_pool_add_virt(pool->pool, (unsigned long)buffer, @@ -62,7 +62,7 @@ Signed-off-by: Minda Chen goto destroy_pool; } -@@ -2465,7 +2466,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, +@@ -2469,7 +2470,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, unsigned int val, val2; u64 val_64; u32 page_size, temp; @@ -71,7 +71,7 @@ Signed-off-by: Minda Chen INIT_LIST_HEAD(&xhci->cmd_list); -@@ -2599,9 +2600,11 @@ int xhci_mem_init(struct xhci_hcd *xhci, +@@ -2603,9 +2604,11 @@ int xhci_mem_init(struct xhci_hcd *xhci, xhci->isoc_bei_interval = AVOID_BEI_INTERVAL_MAX; if (xhci->quirks & XHCI_LOCAL_BUFFER) { diff --git a/target/linux/x86/config-6.6 b/target/linux/x86/config-6.6 index 4fbc0c538b7c04..4a852287e7477c 100644 --- a/target/linux/x86/config-6.6 +++ b/target/linux/x86/config-6.6 @@ -244,6 +244,7 @@ CONFIG_MICROCODE_LATE_FORCE_MINREV=y CONFIG_MICROCODE_LATE_LOADING=y CONFIG_MIGRATION=y CONFIG_MITIGATION_ITS=y +CONFIG_MITIGATION_TSA=y CONFIG_MITIGATION_RFDS=y CONFIG_MITIGATION_SPECTRE_BHI=y # CONFIG_MK6 is not set From 1034594ded3c5f612c6848ccf0dfcec5603e36b6 Mon Sep 17 00:00:00 2001 From: Goetz Goerisch Date: Tue, 15 Jul 2025 18:43:41 +0200 Subject: [PATCH 778/877] kernel: bump 6.6 to 6.6.98 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.98 - x86/CPU/AMD: Properly check the TSA microcode Signed-off-by: Goetz Goerisch Link: https://github.com/openwrt/openwrt/pull/19354 Signed-off-by: Hauke Mehrtens --- include/kernel-6.6 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/kernel-6.6 b/include/kernel-6.6 index a98cd88bea22ff..1e572366f2ca57 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .97 -LINUX_KERNEL_HASH-6.6.97 = 3b67c170638142da56b7a9c3295f2483b88e8c4d3bc26b2bda63b6cf0cb9ee3b +LINUX_VERSION-6.6 = .98 +LINUX_KERNEL_HASH-6.6.98 = 296a34c500abc22c434b967d471d75568891f06a98f11fc31c5e79b037f45de5 From 791c0ad7c4b3ec74e8173e5c8552a328420f8eea Mon Sep 17 00:00:00 2001 From: Tim Harvey Date: Wed, 16 Jul 2025 09:09:34 -0700 Subject: [PATCH 779/877] uboot-envtools: add support for Gateworks venice Add uboot-envtools support for Gateworks venice boards based on i.MX8M SoC's (imx_cortexa53) which boot from and store their U-Boot env on eMMC boot0 hardware partition. Signed-off-by: Tim Harvey Link: https://github.com/openwrt/openwrt/pull/19347 (cherry picked from commit 29f7c0ef977f03c32ebc5031cc1cda75b6fa2268) Link: https://github.com/openwrt/openwrt/pull/19437 Signed-off-by: Hauke Mehrtens --- .../boot/uboot-envtools/files/imx_cortexa53 | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 package/boot/uboot-envtools/files/imx_cortexa53 diff --git a/package/boot/uboot-envtools/files/imx_cortexa53 b/package/boot/uboot-envtools/files/imx_cortexa53 new file mode 100644 index 00000000000000..6aad4ce86710de --- /dev/null +++ b/package/boot/uboot-envtools/files/imx_cortexa53 @@ -0,0 +1,21 @@ +[ -e /etc/config/ubootenv ] && exit 0 + +touch /etc/config/ubootenv + +. /lib/uboot-envtools.sh +. /lib/functions.sh + +board=$(board_name) + +case "$board" in +gw,imx8m*|\ +gateworks,imx8m*) + # board boots from emmc boot0 hardware partition + ubootenv_add_uci_config /dev/mmcblk2boot0 0x3f0000 0x8000 + ubootenv_add_uci_config /dev/mmcblk2boot0 0x3f8000 0x8000 +esac + +config_load ubootenv +config_foreach ubootenv_add_app_config ubootenv + +exit 0 From 25467b09f13f2414ed5e0f4967772c3b29360c01 Mon Sep 17 00:00:00 2001 From: Donghyun Ko Date: Sat, 3 May 2025 09:24:10 +0900 Subject: [PATCH 780/877] mediatek: add support for ipTIME AX3000SM Specification ------------- - SoC : MediaTek MT7981BA dual-core ARM Cortex-A53 1.3GHz - RAM : DDR3 256Mbytes, Nanya Technology NT5CC128M16IP - Flash : 128Mbytes NAND Flash, ESMT F50L1G41LB - WLAN : MediaTek MT7976CN dual-band Wi-Fi 6 - 2.4GHz : b/g/n/ax, MU-MIMO - 5GHz : a/n/ac/ax, MU-MIMO - Ethernet : 10/100/1000 Mbps x4, LAN (MediaTek MT7531AE) 10/100/1000 Mbps x1, WAN (MT7981 internal PHY) - UART : 1x4 pin header on PCB - [J500] 3.3V, TX, RX, GND (115200, 8N1) - Buttons : WPS, Reset - LEDs : 1x Power (Amber) 1x CPU (Amber) 1x Wi-Fi 5GHz (Amber) 1x Wi-Fi 2.4GHz (Amber) 1x WAN activity (Amber) 4x LAN activity (Amber) - Power : 12VDC, 1A (Center positive polarity) MAC address ----------- +-----------+-------------------+-----------+ | Interface | MAC | Algorithm | +-----------+-------------------+-----------+ | WLAN 2.4G | B0:38:6C:xx:xx:xx | label | | WLAN 5G | B2:38:6C:4x:xx:xx | | | WAN | B0:38:6C:xx:xx:xx | label + 1 | | LAN | B0:38:6C:xx:xx:xx | label + 3 | +-----------+-------------------+-----------+ The WLAN 2.4G MAC address was found in 'Factory' partition, 0x4 Installation ------------ 1. Download the *initramfs-kernel.bin file from the OpenWrt website 2. Attach UART to the router, and interrupt the boot process by pressing '0' If you successfully interrupt the boot process, a terminal prompt name should look like this: MT7981> 3. Connect the router(LAN port) to the PC 4. Assign the PC IP address: 192.168.0.100/24 5. Load and run the *initramfs-kernel.bin: tftpboot 0x46000000 initramfs-kernel.bin bootm 6. Upload the OpenWrt *squashfs-sysupgrade.bin to the router 7. Run 'sysupgrade -n' with the sysupgrade OpenWrt image Signed-off-by: Donghyun Ko Link: https://github.com/openwrt/openwrt/pull/18689 (Cherry picked from commit 1c6cb6d5be10281d3b45ef8deec50b9e1e9aa8bb) Link: https://github.com/openwrt/openwrt/pull/19410 Signed-off-by: Hauke Mehrtens --- .../mediatek/dts/mt7981b-iptime-ax3000sm.dts | 279 ++++++++++++++++++ .../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 + target/linux/mediatek/image/filogic.mk | 11 + 5 files changed, 299 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7981b-iptime-ax3000sm.dts diff --git a/target/linux/mediatek/dts/mt7981b-iptime-ax3000sm.dts b/target/linux/mediatek/dts/mt7981b-iptime-ax3000sm.dts new file mode 100644 index 00000000000000..ea385a08a2a394 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-iptime-ax3000sm.dts @@ -0,0 +1,279 @@ +// SPDX-License-Identifier: GPL-2.0-only OR MIT + +/dts-v1/; +#include +#include +#include + +#include "mt7981.dtsi" + +/ { + model = "ipTIME AX3000SM"; + compatible = "iptime,ax3000sm", "mediatek,mt7981"; + + aliases { + serial0 = &uart0; + label-mac-device = &gmac1; + led-boot = &led_cpu; + led-failsafe = &led_cpu; + led-running = &led_cpu; + led-upgrade = &led_cpu; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + gpio-keys { + compatible = "gpio-keys"; + + button-0 { + label = "wps"; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + linux,code = ; + 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_WAN; + gpios = <&pio 8 GPIO_ACTIVE_LOW>; + }; + + led-1 { + color = ; + function = LED_FUNCTION_WLAN_2GHZ; + gpios = <&pio 34 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + led-2 { + color = ; + function = LED_FUNCTION_WLAN_5GHZ; + gpios = <&pio 35 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + + led_cpu: led-3 { + color = ; + function = LED_FUNCTION_CPU; + gpios = <&pio 15 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +ð { + 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 (3)>; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + 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_factory_4 (1)>; + }; +}; + +&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 { + #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 { + 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 0x6E00000>; + }; + }; + }; +}; + +&switch { + 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@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"; + nvmem-cell-names = "eeprom"; + nvmem-cells = <&eeprom_factory_0>; + + band@0 { + reg = <0>; + nvmem-cells = <&macaddr_factory_4 (0)>; + nvmem-cell-names = "mac-address"; + }; + + band@1 { + reg = <1>; + nvmem-cells = <&macaddr_factory_4 (0)>; + nvmem-cell-names = "mac-address"; + }; +}; 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 3745e2cb7e3bfc..bafb7bb0738a85 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 @@ -64,6 +64,9 @@ glinet,gl-xe3000) huasifei,wh3000) ucidef_set_led_netdev "wan" "WAN" "red:wan" "eth1" "link tx rx" ;; +iptime,ax3000sm) + ucidef_set_led_netdev "wan" "wan" "amber:wan" "eth1" "link tx rx" + ;; mercusys,mr80x-v3) ucidef_set_led_netdev "lan1" "lan-1" "green:lan-1" "lan1" "link tx rx" ucidef_set_led_netdev "lan2" "lan-2" "green:lan-2" "lan2" "link tx rx" 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 ff8ad85bd3e7de..f00ba3f62f2a2a 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 @@ -46,6 +46,7 @@ mediatek_setup_interfaces() ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" wan ;; asus,tuf-ax4200|\ + iptime,ax3000sm|\ jdcloud,re-cp-03|\ mediatek,mt7981-rfb|\ netcore,n60|\ 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 843e815d36432f..aaab009b4943d6 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 @@ -108,6 +108,11 @@ case "$board" in [ "$PHYNBR" = "0" ] && macaddr_add $addr 2 > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_add $addr 3 > /sys${DEVPATH}/macaddress ;; + iptime,ax3000sm) + addr=$(mtd_get_mac_binary "Factory" 0x4) + [ "$PHYNBR" = "1" ] && macaddr_setbit_la $(macaddr_unsetbit $(macaddr_unsetbit $(macaddr_unsetbit $(macaddr_setbit $addr 26) 25) 27) 28) > \ + /sys${DEVPATH}/macaddress + ;; jcg,q30-pro|\ netcore,n60) # Originally, phy1 is phy0 mac with LA bit set. However, this would conflict diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 6db24cdd4d77f7..ec08857c962e93 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -1031,6 +1031,17 @@ define Device/huasifei_wh3000 endef TARGET_DEVICES += huasifei_wh3000 +define Device/iptime_ax3000sm + DEVICE_VENDOR := ipTIME + DEVICE_MODEL := AX3000SM + DEVICE_DTS := mt7981b-iptime-ax3000sm + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + SUPPORTED_DEVICES += mediatek,mt7981-spim-snand-rfb +endef +TARGET_DEVICES += iptime_ax3000sm + define Device/jcg_q30-pro DEVICE_VENDOR := JCG DEVICE_MODEL := Q30 PRO From f59e340e11ef223f5cd7e5aaddab591ba1de0b76 Mon Sep 17 00:00:00 2001 From: Leo Barsky Date: Thu, 17 Jul 2025 18:50:47 +0000 Subject: [PATCH 781/877] kernel: bump 6.6 to 6.6.99 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.99 All patches auto-refreshed. Signed-off-by: Leo Barsky Link: https://github.com/openwrt/openwrt/pull/19448 (cherry picked from commit 3148a577584e98b2e3a7aefbfbde6d0fbb741141) Co-authored-by: Goetz Goerisch Signed-off-by: Goetz Goerisch Link: https://github.com/openwrt/openwrt/pull/19454 Signed-off-by: Hauke Mehrtens --- include/kernel-6.6 | 4 ++-- ...hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch | 2 +- ...0441-Bluetooth-hci_sync-Add-fallback-bd-address-prop.patch | 4 ++-- ...950-1218-Bluetooth-hci_sync-Fix-crash-on-NULL-parent.patch | 2 +- .../950-1366-drm-Increase-plane_mask-to-64bit.patch | 2 +- target/linux/generic/hack-6.6/902-debloat_proc.patch | 2 +- .../806-v6.9-pwm-mediatek-add-support-for-MT7988.patch | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/kernel-6.6 b/include/kernel-6.6 index 1e572366f2ca57..7ed3e4f41d6f08 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .98 -LINUX_KERNEL_HASH-6.6.98 = 296a34c500abc22c434b967d471d75568891f06a98f11fc31c5e79b037f45de5 +LINUX_VERSION-6.6 = .99 +LINUX_KERNEL_HASH-6.6.99 = b08679729f1ec74b9fa829f5990936ca2511039d87acc7e8b3f39912de89ab36 diff --git a/target/linux/bcm27xx/patches-6.6/950-0169-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch b/target/linux/bcm27xx/patches-6.6/950-0169-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch index 86c4d87d807737..4ffa3ed95d0565 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0169-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0169-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 -@@ -1443,6 +1446,9 @@ +@@ -1446,6 +1449,9 @@ #define USB_VENDOR_ID_XIAOMI 0x2717 #define USB_DEVICE_ID_MI_SILENT_MOUSE 0x5014 diff --git a/target/linux/bcm27xx/patches-6.6/950-0441-Bluetooth-hci_sync-Add-fallback-bd-address-prop.patch b/target/linux/bcm27xx/patches-6.6/950-0441-Bluetooth-hci_sync-Add-fallback-bd-address-prop.patch index c1173c30fcf447..27acfe21b7e686 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0441-Bluetooth-hci_sync-Add-fallback-bd-address-prop.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0441-Bluetooth-hci_sync-Add-fallback-bd-address-prop.patch @@ -20,7 +20,7 @@ Signed-off-by: Phil Elwell --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c -@@ -4879,6 +4879,7 @@ static const struct { +@@ -4927,6 +4927,7 @@ static const struct { */ static int hci_dev_setup_sync(struct hci_dev *hdev) { @@ -28,7 +28,7 @@ Signed-off-by: Phil Elwell int ret = 0; bool invalid_bdaddr; size_t i; -@@ -4907,7 +4908,8 @@ static int hci_dev_setup_sync(struct hci +@@ -4955,7 +4956,8 @@ static int hci_dev_setup_sync(struct hci test_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks); if (!ret) { if (test_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks) && diff --git a/target/linux/bcm27xx/patches-6.6/950-1218-Bluetooth-hci_sync-Fix-crash-on-NULL-parent.patch b/target/linux/bcm27xx/patches-6.6/950-1218-Bluetooth-hci_sync-Fix-crash-on-NULL-parent.patch index dcc38a3c647279..d40b12792703c1 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1218-Bluetooth-hci_sync-Fix-crash-on-NULL-parent.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1218-Bluetooth-hci_sync-Fix-crash-on-NULL-parent.patch @@ -15,7 +15,7 @@ Signed-off-by: Phil Elwell --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c -@@ -4879,7 +4879,8 @@ static const struct { +@@ -4927,7 +4927,8 @@ static const struct { */ static int hci_dev_setup_sync(struct hci_dev *hdev) { diff --git a/target/linux/bcm27xx/patches-6.6/950-1366-drm-Increase-plane_mask-to-64bit.patch b/target/linux/bcm27xx/patches-6.6/950-1366-drm-Increase-plane_mask-to-64bit.patch index e27058d44cea69..f3ae9be4fdc279 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1366-drm-Increase-plane_mask-to-64bit.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1366-drm-Increase-plane_mask-to-64bit.patch @@ -32,7 +32,7 @@ Signed-off-by: Dave Stevenson drm_printf(p, "\tmode: " DRM_MODE_FMT "\n", DRM_MODE_ARG(&state->mode)); --- a/drivers/gpu/drm/drm_framebuffer.c +++ b/drivers/gpu/drm/drm_framebuffer.c -@@ -959,7 +959,7 @@ static int atomic_remove_fb(struct drm_f +@@ -986,7 +986,7 @@ static int atomic_remove_fb(struct drm_f struct drm_connector *conn __maybe_unused; struct drm_connector_state *conn_state; int i, ret; diff --git a/target/linux/generic/hack-6.6/902-debloat_proc.patch b/target/linux/generic/hack-6.6/902-debloat_proc.patch index 64472ad18fce8b..886111a66c5489 100644 --- a/target/linux/generic/hack-6.6/902-debloat_proc.patch +++ b/target/linux/generic/hack-6.6/902-debloat_proc.patch @@ -235,7 +235,7 @@ Signed-off-by: Felix Fietkau if (!pe) --- a/mm/vmalloc.c +++ b/mm/vmalloc.c -@@ -4450,6 +4450,8 @@ static const struct seq_operations vmall +@@ -4458,6 +4458,8 @@ static const struct seq_operations vmall static int __init proc_vmalloc_init(void) { diff --git a/target/linux/mediatek/patches-6.6/806-v6.9-pwm-mediatek-add-support-for-MT7988.patch b/target/linux/mediatek/patches-6.6/806-v6.9-pwm-mediatek-add-support-for-MT7988.patch index 946f3a525280ab..09e4be3b345072 100644 --- a/target/linux/mediatek/patches-6.6/806-v6.9-pwm-mediatek-add-support-for-MT7988.patch +++ b/target/linux/mediatek/patches-6.6/806-v6.9-pwm-mediatek-add-support-for-MT7988.patch @@ -20,7 +20,7 @@ Signed-off-by: Uwe Kleine-König --- a/drivers/pwm/pwm-mediatek.c +++ b/drivers/pwm/pwm-mediatek.c -@@ -345,6 +345,13 @@ static const struct pwm_mediatek_of_data +@@ -348,6 +348,13 @@ static const struct pwm_mediatek_of_data .reg_offset = mtk_pwm_reg_offset_v1, }; @@ -34,7 +34,7 @@ Signed-off-by: Uwe Kleine-König static const struct pwm_mediatek_of_data mt8183_pwm_data = { .num_pwms = 4, .pwm45_fixup = false, -@@ -375,6 +382,7 @@ static const struct of_device_id pwm_med +@@ -378,6 +385,7 @@ static const struct of_device_id pwm_med { .compatible = "mediatek,mt7629-pwm", .data = &mt7629_pwm_data }, { .compatible = "mediatek,mt7981-pwm", .data = &mt7981_pwm_data }, { .compatible = "mediatek,mt7986-pwm", .data = &mt7986_pwm_data }, From 150f181700395e5a26bb11ff7eb7da0b7118f0b0 Mon Sep 17 00:00:00 2001 From: Fil Dunsky Date: Sun, 6 Jul 2025 12:08:27 +0300 Subject: [PATCH 782/877] mediatek: add Huasifei WH3000 Pro support **Huasifei WH3000 Pro** Portable Wi-Fi 6 travel router based on MediaTek MT7981A SoC. MT7981B+MT7976CN+RTL8221B Dual Core 1.3GHZ with 5G modems module and PWM Fan. **Specifications** SoC: Filogic 820 MT7981A (1.3GHz) RAM: DDR4 1GB Flash: eMMC 8GB WiFi: 2.4GHz and 5GHz with 3 antennas Ethernet: 1x WAN (10/100/1000M) 1x LAN (10/100/1000/2500M) USB: 1x USB 3.0 port Two buttons: power/reset and mode (BTN_0) LEDS: blue, red, blue+red=pink UART: 3.3V, TX, RX, GND / 115200 8N1 **Installation via U-Boot rescue** 1. Set static IP 192.168.1.2 on your computer and default route as 192.168.1.1 2. Connect to the WAN port and hold the reset button while booting the device. 3. Wait for the LED to blink 5 times, and release the reset button. 4. Open U-boot web page on your browser at http://192.168.1.1 5. Select the OpenWRT sysupgrade image, upload it, and start the upgrade. 6. Wait for the router to flash the new firmware. 7. Wait for the router to reboot itself. **Installation via sysupgrade** Just flash sysupgrade file via [LuCI upgrade page](http://192.168.1.1/cgi-bin/luci/admin/system/flash) without saving the settings. **Installation via SSH** Upload the file to the router `/tmp` directory, `ssh root@192.168.1.1` and issue a command: ``` sysupgrade -n /tmp/openwrt-mediatek-filogic-huasifei_wh3000-pro-squashfs-sysupgrade.bin ``` **Factory MAC** You can find your Factory MAC which is mentioned on the box at `/dev/mmcblck0p2` partition `factory` starting from `0x4` ``` dd if=/dev/mmcblk0p2 bs=1 skip=4 count=6 | hexdump -C ``` Cherry-picked from https://github.com/coolsnowwolf/lede/commit/949d0bd77a2e97c2d982531f72b76c575fb28839 Fixed `green` to `blue` LED in dts, added `SUPPORTED_DEVICES += huasifei,fudy-pro` - to make sysupgrade compatible with factory QWRT/Lede fork firmware. Signed-off-by: Fil Dunsky Link: https://github.com/openwrt/openwrt/pull/19315 (cherry picked from commit db1de8d21fd7f115cc1a6274f031119c9f36eefd) Link: https://github.com/openwrt/openwrt/pull/19391 Signed-off-by: Hauke Mehrtens --- .../dts/mt7981b-huasifei-wh3000-pro.dts | 213 ++++++++++++++++++ .../filogic/base-files/etc/board.d/02_network | 3 +- .../base-files/etc/board.d/03_gpio_switches | 3 + .../base-files/lib/upgrade/platform.sh | 2 + target/linux/mediatek/image/filogic.mk | 13 ++ 5 files changed, 233 insertions(+), 1 deletion(-) create mode 100644 target/linux/mediatek/dts/mt7981b-huasifei-wh3000-pro.dts diff --git a/target/linux/mediatek/dts/mt7981b-huasifei-wh3000-pro.dts b/target/linux/mediatek/dts/mt7981b-huasifei-wh3000-pro.dts new file mode 100644 index 00000000000000..3d45453d3d9c69 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-huasifei-wh3000-pro.dts @@ -0,0 +1,213 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; + +#include +#include +#include + +#include "mt7981.dtsi" + +/ { + model = "Huasifei WH3000 Pro"; + compatible = "huasifei,wh3000-pro", "mediatek,mt7981"; + + aliases { + serial0 = &uart0; + led-boot = &led_sys_red; + led-failsafe = &led_sys_red; + led-running = &led_sys_blue; + led-upgrade = &led_sys_blue; + }; + + chosen { + stdout-path = "serial0:115200n8"; + bootargs-append = " root=PARTLABEL=rootfs rootwait"; + }; + + gpio-export { + compatible = "gpio-export"; + + modem-power { + gpio-export,name = "modem_power"; + gpio-export,output = <0>; + gpios = <&pio 4 GPIO_ACTIVE_HIGH>; + }; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + + mode { + label = "mode"; + linux,code = ; + linux,input-type = ; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + led_sys_red: led-0 { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&pio 11 GPIO_ACTIVE_LOW>; + }; + + led_sys_blue: led-1 { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + }; + }; +}; + +ð { + pinctrl-names = "default"; + pinctrl-0 = <&mdio_pins>; + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + phy-handle = <&phy1>; + + nvmem-cells = <&macaddr_factory_4 2>; + nvmem-cell-names = "mac-address"; + }; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "gmii"; + phy-handle = <&int_gbe_phy>; + + nvmem-cells = <&macaddr_factory_4 3>; + nvmem-cell-names = "mac-address"; + }; +}; + +&mdio_bus { + phy1: ethernet-phy@1 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <1>; + reset-assert-us = <100000>; + reset-deassert-us = <100000>; + reset-gpios = <&pio 39 GPIO_ACTIVE_LOW>; + interrupts = <38 IRQ_TYPE_LEVEL_LOW>; + interrupt-parent = <&pio>; + realtek,aldps-enable; + }; +}; + +&fan { + interrupt-parent = <&pio>; + interrupts = <13 IRQ_TYPE_EDGE_FALLING>; + pwms = <&pwm 1 40000 0>; + status = "okay"; +}; + +&mmc0 { + bus-width = <8>; + cap-mmc-highspeed; + max-frequency = <52000000>; + non-removable; + #address-cells = <1>; + #size-cells = <0>; + pinctrl-names = "default", "state_uhs"; + pinctrl-0 = <&mmc0_pins_default>; + pinctrl-1 = <&mmc0_pins_uhs>; + vmmc-supply = <®_3p3v>; + status = "okay"; + + card@0 { + compatible = "mmc-card"; + reg = <0>; + + block { + compatible = "block-device"; + + partitions { + block-partition-factory { + partname = "factory"; + + 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>; + }; + }; + }; + }; + }; + }; +}; + +&pio { + mmc0_pins_default: mmc0-pins-default { + mux { + function = "flash"; + groups = "emmc_45"; + }; + }; + + mmc0_pins_uhs: mmc0-pins-uhs { + mux { + function = "flash"; + groups = "emmc_45"; + }; + }; + + pwm1_pins: pwm1-pins { + mux { + function = "pwm"; + groups = "pwm1_0"; + }; + }; +}; + +&pwm { + pinctrl-names = "default"; + pinctrl-0 = <&pwm1_pins>; + status = "okay"; +}; + +&uart0 { + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; + 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 f00ba3f62f2a2a..6daace1d41a58e 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 @@ -70,7 +70,8 @@ mediatek_setup_interfaces() ;; bananapi,bpi-r3-mini|\ edgecore,eap111|\ - huasifei,wh3000) + huasifei,wh3000|\ + huasifei,wh3000-pro) ucidef_set_interfaces_lan_wan eth0 eth1 ;; bananapi,bpi-r4|\ 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 1fe74f2b6fd456..e2fe814439d41a 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,6 +5,9 @@ board_config_update board=$(board_name) case "$board" in +huasifei,wh3000-pro) + ucidef_add_gpio_switch "modem_power" "Modem power" "modem_power" "0" + ;; zbtlink,zbt-z8102ax|\ zbtlink,zbt-z8102ax-v2) ucidef_add_gpio_switch "5g1" "Power 1st modem" "5g1" "1" 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 ea16ee3c71e373..64b6d4b60b0880 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -106,6 +106,7 @@ platform_do_upgrade() { glinet,gl-x3000|\ glinet,gl-xe3000|\ huasifei,wh3000|\ + huasifei,wh3000-pro|\ smartrg,sdg-8612|\ smartrg,sdg-8614|\ smartrg,sdg-8622|\ @@ -231,6 +232,7 @@ platform_copy_config() { glinet,gl-x3000|\ glinet,gl-xe3000|\ huasifei,wh3000|\ + huasifei,wh3000-pro|\ jdcloud,re-cp-03|\ smartrg,sdg-8612|\ smartrg,sdg-8614|\ diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index ec08857c962e93..ab5a2b7c87690f 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -1031,6 +1031,19 @@ define Device/huasifei_wh3000 endef TARGET_DEVICES += huasifei_wh3000 +define Device/huasifei_wh3000-pro + DEVICE_VENDOR := Huasifei + DEVICE_MODEL := WH3000 Pro + DEVICE_DTS := mt7981b-huasifei-wh3000-pro + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware kmod-hwmon-pwmfan kmod-usb3 f2fsck mkf2fs + 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 += huasifei_wh3000-pro + define Device/iptime_ax3000sm DEVICE_VENDOR := ipTIME DEVICE_MODEL := AX3000SM From 6489f3ef89596c2b3a076034d438746865c12eaa Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 22 Jul 2025 11:58:15 +0200 Subject: [PATCH 783/877] toolchain/gcc: prevent the use of LDRD/STRD on ARMv5TE These instructions are for 64-bit load/store. On ARMv5TE, the CPU requires addresses to be aligned to 64-bit. When misaligned, behavior is undefined (effectively either loads the same word twice on LDRD, or corrupts surrounding memory on STRD). On ARMv6 and newer, unaligned access is safe. Removing these instructions for ARMv5TE is necessary, because GCC ignores alignment information in pointers and does unsafe optimizations that have shown up as bugs in various places. This patch was originally added more than 11 years ago in commit b050f87d13b5, but got lost 6 years ago, when gcc 9.1 was added in 88c07c655262. This primarily affects the kirkwood and ixp4xx targets Signed-off-by: Felix Fietkau (cherry picked from commit c1c11120069b8e04ad4b0c6e815d2e3421944933) --- .../gcc/patches-11.x/800-arm_v5te_no_ldrd_strd.patch | 11 +++++++++++ .../gcc/patches-12.x/800-arm_v5te_no_ldrd_strd.patch | 11 +++++++++++ .../gcc/patches-13.x/800-arm_v5te_no_ldrd_strd.patch | 11 +++++++++++ .../gcc/patches-14.x/800-arm_v5te_no_ldrd_strd.patch | 11 +++++++++++ 4 files changed, 44 insertions(+) create mode 100644 toolchain/gcc/patches-11.x/800-arm_v5te_no_ldrd_strd.patch create mode 100644 toolchain/gcc/patches-12.x/800-arm_v5te_no_ldrd_strd.patch create mode 100644 toolchain/gcc/patches-13.x/800-arm_v5te_no_ldrd_strd.patch create mode 100644 toolchain/gcc/patches-14.x/800-arm_v5te_no_ldrd_strd.patch diff --git a/toolchain/gcc/patches-11.x/800-arm_v5te_no_ldrd_strd.patch b/toolchain/gcc/patches-11.x/800-arm_v5te_no_ldrd_strd.patch new file mode 100644 index 00000000000000..e83cb1bebbb34b --- /dev/null +++ b/toolchain/gcc/patches-11.x/800-arm_v5te_no_ldrd_strd.patch @@ -0,0 +1,11 @@ +--- a/gcc/config/arm/arm.h ++++ b/gcc/config/arm/arm.h +@@ -165,7 +165,7 @@ emission of floating point pcs attribute + /* Thumb-1 only. */ + #define TARGET_THUMB1_ONLY (TARGET_THUMB1 && !arm_arch_notm) + +-#define TARGET_LDRD (arm_arch5te && ARM_DOUBLEWORD_ALIGN \ ++#define TARGET_LDRD (arm_arch6 && ARM_DOUBLEWORD_ALIGN \ + && !TARGET_THUMB1) + + #define TARGET_CRC32 (arm_arch_crc) diff --git a/toolchain/gcc/patches-12.x/800-arm_v5te_no_ldrd_strd.patch b/toolchain/gcc/patches-12.x/800-arm_v5te_no_ldrd_strd.patch new file mode 100644 index 00000000000000..e83cb1bebbb34b --- /dev/null +++ b/toolchain/gcc/patches-12.x/800-arm_v5te_no_ldrd_strd.patch @@ -0,0 +1,11 @@ +--- a/gcc/config/arm/arm.h ++++ b/gcc/config/arm/arm.h +@@ -165,7 +165,7 @@ emission of floating point pcs attribute + /* Thumb-1 only. */ + #define TARGET_THUMB1_ONLY (TARGET_THUMB1 && !arm_arch_notm) + +-#define TARGET_LDRD (arm_arch5te && ARM_DOUBLEWORD_ALIGN \ ++#define TARGET_LDRD (arm_arch6 && ARM_DOUBLEWORD_ALIGN \ + && !TARGET_THUMB1) + + #define TARGET_CRC32 (arm_arch_crc) diff --git a/toolchain/gcc/patches-13.x/800-arm_v5te_no_ldrd_strd.patch b/toolchain/gcc/patches-13.x/800-arm_v5te_no_ldrd_strd.patch new file mode 100644 index 00000000000000..e83cb1bebbb34b --- /dev/null +++ b/toolchain/gcc/patches-13.x/800-arm_v5te_no_ldrd_strd.patch @@ -0,0 +1,11 @@ +--- a/gcc/config/arm/arm.h ++++ b/gcc/config/arm/arm.h +@@ -165,7 +165,7 @@ emission of floating point pcs attribute + /* Thumb-1 only. */ + #define TARGET_THUMB1_ONLY (TARGET_THUMB1 && !arm_arch_notm) + +-#define TARGET_LDRD (arm_arch5te && ARM_DOUBLEWORD_ALIGN \ ++#define TARGET_LDRD (arm_arch6 && ARM_DOUBLEWORD_ALIGN \ + && !TARGET_THUMB1) + + #define TARGET_CRC32 (arm_arch_crc) diff --git a/toolchain/gcc/patches-14.x/800-arm_v5te_no_ldrd_strd.patch b/toolchain/gcc/patches-14.x/800-arm_v5te_no_ldrd_strd.patch new file mode 100644 index 00000000000000..e83cb1bebbb34b --- /dev/null +++ b/toolchain/gcc/patches-14.x/800-arm_v5te_no_ldrd_strd.patch @@ -0,0 +1,11 @@ +--- a/gcc/config/arm/arm.h ++++ b/gcc/config/arm/arm.h +@@ -165,7 +165,7 @@ emission of floating point pcs attribute + /* Thumb-1 only. */ + #define TARGET_THUMB1_ONLY (TARGET_THUMB1 && !arm_arch_notm) + +-#define TARGET_LDRD (arm_arch5te && ARM_DOUBLEWORD_ALIGN \ ++#define TARGET_LDRD (arm_arch6 && ARM_DOUBLEWORD_ALIGN \ + && !TARGET_THUMB1) + + #define TARGET_CRC32 (arm_arch_crc) From a8fb4f6f0c6b3d7797ff6cfa8d03fd499ba70db3 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 23 Jul 2025 11:52:44 +0200 Subject: [PATCH 784/877] libubox: update to Git HEAD (2025-07-23) b7acc8e6fd5e remove compatibility code for older json-c versions a1acd99f2eb7 udebug: remove obsolete debug message 49056d178f42 udebug: fix issue with snapshot of remote ring Signed-off-by: Felix Fietkau (cherry picked from commit 19a327dde53ffa49c4c475c0f343b54f2e5be95f) --- 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 6cd76bcc758fc4..48ec2e05bb2900 100644 --- a/package/libs/libubox/Makefile +++ b/package/libs/libubox/Makefile @@ -5,10 +5,10 @@ PKG_RELEASE=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/libubox.git -PKG_MIRROR_HASH:=e10144cfae155cf2ae5fdf167bd575dbf34c7751ddb112554b6962003f989b36 -PKG_SOURCE_DATE:=2024-12-19 +PKG_MIRROR_HASH:=51b48648a3a64eed74bcb1ab352aaad6ef7679a574df4445d2914b990aba5bbf +PKG_SOURCE_DATE:=2025-07-23 PKG_SOURCE_DATE_ABI:=2024-03-29 -PKG_SOURCE_VERSION:=3868f47c8f6c6570e62a3cdf8a7f26ffb1a67e6a +PKG_SOURCE_VERSION:=49056d178f42da98048a5d4c23f83a6f6bc6dd80 PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE_ABI)) CMAKE_INSTALL:=1 From 628bc50eb16f870744fd97f73190e5c84525774b Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 23 Jul 2025 11:53:02 +0200 Subject: [PATCH 785/877] udebug: update to Git HEAD (2025-07-23) 5d10084ea885 lib-ucode.c: add #define _GNU_SOURCE a95364b41d52 udebug-cli: fix terminating uloop c00eb9b685a8 ucode: use FILE handle for pcap output 4265167cb6e8 ucode: add error reporting to pcap_write 4a908ee731a6 udebug-cli: stop event loop on write failure 6e04f4187231 ucode: use ucv_resource_create_ex for remote rings c297f04e1852 ucode: drop use ucv_resource_create f207d37a1055 ucode: add support for specifying ring format 98683a94bcdd ucode: support appending array data, similar to socket.send() a7ecd483ed38 ucode: allow calling udebug.init() multiple times d4a4c788c416 ucode: fix allocation size of local ring meta 184706abaf50 ucode: add timestamp argument to foreach() 8442c948c193 ucode: add function for getting ring information f4958a4c591a ucode: add const entries for enum udebug_format 14d4fec36993 udebug-cli: add logstream command 6ed8536142bb ucode: fix entries/size confusion Signed-off-by: Felix Fietkau (cherry picked from commit 7b0ce213e9b678522dae49bac7b20681a123f019) --- package/libs/udebug/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/libs/udebug/Makefile b/package/libs/udebug/Makefile index 42ca510be57d35..30eac8793e8db9 100644 --- a/package/libs/udebug/Makefile +++ b/package/libs/udebug/Makefile @@ -11,9 +11,9 @@ PKG_NAME:=udebug CMAKE_INSTALL:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/udebug.git -PKG_MIRROR_HASH:=4dfe98b5d5813066dccd46d112502565b6961a4a7382083c529dfb423a626c2b -PKG_SOURCE_DATE:=2023-12-06 -PKG_SOURCE_VERSION:=6d3f51f9fda706f0cf4732c762e4dbe8c21e12cf +PKG_MIRROR_HASH:=578f795ef6ed0400efae8754891539e5b2922d8b164425e535b96da1b0a089c5 +PKG_SOURCE_DATE:=2025-07-23 +PKG_SOURCE_VERSION:=6ed8536142bbd4360b55a423723456a6a862c99b PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE)) PKG_LICENSE:=GPL-2.0 From 39972c47eb9e367ca8e8611b1d1de4669df2ff92 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 18 Jul 2025 12:22:10 +0200 Subject: [PATCH 786/877] ucode: update to Git HEAD (2025-07-18) 54b00e3b1fa9 ubus: fix double registry clear on disconnect 69521b55855c ubus: fix use-after-free on deferred request reply() method f499de690c33 Merge pull request #298 from nbd168/ubus-fixes 22e8c16d9deb debug: fix crash when passing tagged string to getinfo() 2c9eea5174d6 ubus: use ucv_resource_create_ex for connections/channels 0a4cf4b7e71a ubus: use ucv_resource_create_ex for for ubus.request resources 99ee75a69cd3 ubus: use ucv_resource_create_ex for ubus.deferred resources f085a42b977f ubus: use ucv_resource_create_ex for objects 94ad17d13a0d ubus: use ucv_resource_create_ex for ubus.notify resources a3fa47fdda3e ubus: use ucv_resource_create_ex for ubus.listener resources 9ab5fa869dec ubus: use ucv_resource_create_ex for ubus.subscriber resources 43dd5716db84 Merge pull request #300 from nbd168/ubus-gc be92ebd70633 CI: debian: install cmake package fd202fd40bd1 socket: respect port argument in sockinst.connect() 767c209b917b socket: properly handle async `connect(2)` errors in socket.connect() 37ac8f112af6 socket: improve port argument validation in sockinst.connect() 5b3b6b789b9c ubus: fix refcount issue in uc_ubus_object_notify cdcd50ad0408 Merge pull request #305 from nbd168/ubus-fix f682ac2f6b82 program: add bytecode version to program header flags af411d8101b2 vm: implement PVAL opcode afdfffb61258 vm: support initiating method calls with I_CALL/I_QCALL opcodes 5d680425db40 compiler: stop emitting I_MCALL/I_QMCALL opcodes a616feed39eb compiler, vm: rework optional chaining and function call semantics d29ec45ab107 Merge pull request #306 from jow-/optional-chaining-short-circuiting 0946a4fb20b8 vm: adjust JMPNT opcode behavior 6f8291f73757 compiler: improve assignment lhs expression checks 22e1346a7bda Merge pull request #308 from jow-/compiler-lhs-check-fixes cf846c4a11d4 vm: properly handle modulo by zero 4d81e6c13506 resolv: add documentation and fix clobbering ns strings 20ee2dabd243 debian/changelog: v0.0.20250529 82426d1a02e2 Merge pull request #314 from jow-/resolv-fix313 50d303c8309d ubus: add support for automatically subscribing to objects fdbf73da4136 Merge pull request #312 from nbd168/ubus-subscribe 5a0d21d59f88 vm: export function for converting exception to ucode value aaf712eb4fb4 uloop: add guard() function 693af2b61b52 ubus: add guard() function Signed-off-by: Felix Fietkau (cherry picked from commit c39a09686e3d562367ab3a47da6a005eebaf5ca2) --- package/utils/ucode/Makefile | 6 ++--- ...-double-registry-clear-on-disconnect.patch | 26 ------------------ ...er-free-on-deferred-request-reply-me.patch | 27 ------------------- 3 files changed, 3 insertions(+), 56 deletions(-) delete mode 100644 package/utils/ucode/patches/010-ubus-fix-double-registry-clear-on-disconnect.patch delete mode 100644 package/utils/ucode/patches/020-ubus-fix-use-after-free-on-deferred-request-reply-me.patch diff --git a/package/utils/ucode/Makefile b/package/utils/ucode/Makefile index ed155af02f3d60..8ae1b91c1f213a 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:=2025-05-11 -PKG_SOURCE_VERSION:=d5b3a9dc1091dd28cf6f0f60cd34fc322ef27717 -PKG_MIRROR_HASH:=cd8af9d5ac28e2530b56015a3f2fcf6f36062546cac8b23a5f7b75b367209b54 +PKG_SOURCE_DATE:=2025-07-18 +PKG_SOURCE_VERSION:=3f64c8089bf3ea4847c96b91df09fbfcaec19e1d +PKG_MIRROR_HASH:=55fbff7c527e1fadbda2e038636f39419649841ee63a5f3cdb50b9714b13420c PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC diff --git a/package/utils/ucode/patches/010-ubus-fix-double-registry-clear-on-disconnect.patch b/package/utils/ucode/patches/010-ubus-fix-double-registry-clear-on-disconnect.patch deleted file mode 100644 index 70b6a99be7958b..00000000000000 --- a/package/utils/ucode/patches/010-ubus-fix-double-registry-clear-on-disconnect.patch +++ /dev/null @@ -1,26 +0,0 @@ -From: Felix Fietkau -Date: Fri, 9 May 2025 11:57:57 +0200 -Subject: [PATCH] ubus: fix double registry clear on disconnect - -Set c->registry_index to -1 in order to ensure that the resource free path -does not clobber registry items of unrelated connections. - -Signed-off-by: Felix Fietkau ---- - ---- a/lib/ubus.c -+++ b/lib/ubus.c -@@ -2375,8 +2375,11 @@ uc_ubus_channel_disconnect_cb(struct ubu - c->ctx.sock.fd = -1; - } - -- if (c->registry_index >= 0) -- connection_reg_clear(c->vm, c->registry_index); -+ if (c->registry_index >= 0) { -+ int idx = c->registry_index; -+ c->registry_index = -1; -+ connection_reg_clear(c->vm, idx); -+ } - } - - static uc_value_t * diff --git a/package/utils/ucode/patches/020-ubus-fix-use-after-free-on-deferred-request-reply-me.patch b/package/utils/ucode/patches/020-ubus-fix-use-after-free-on-deferred-request-reply-me.patch deleted file mode 100644 index 142595a5bdbb5e..00000000000000 --- a/package/utils/ucode/patches/020-ubus-fix-use-after-free-on-deferred-request-reply-me.patch +++ /dev/null @@ -1,27 +0,0 @@ -From: Felix Fietkau -Date: Mon, 12 May 2025 12:43:44 +0200 -Subject: [PATCH] ubus: fix use-after-free on deferred request reply() method - -Hold a reference to the defer resource as long as it is still needed - -Signed-off-by: Felix Fietkau ---- - ---- a/lib/ubus.c -+++ b/lib/ubus.c -@@ -636,6 +636,7 @@ uc_ubus_call_user_cb(uc_ubus_deferred_t - uc_value_t *this, *func; - - request_reg_get(defer->vm, defer->registry_index, &this, &func, NULL, NULL); -+ ucv_get(this); - - if (ucv_is_callable(func)) { - uc_vm_stack_push(defer->vm, ucv_get(this)); -@@ -648,6 +649,7 @@ uc_ubus_call_user_cb(uc_ubus_deferred_t - } - - request_reg_clear(defer->vm, defer->registry_index); -+ ucv_put(this); - } - - static void From 3bdd6d492ee24bb46c8578ef939e41f3c998dda9 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 23 Jul 2025 12:16:03 +0200 Subject: [PATCH 787/877] ucode: add padding to uc_resource_ext_t Fixes misaligned allocations for ext resources Signed-off-by: Felix Fietkau (cherry picked from commit 6c22e8ef538926cec829dcb98f04c0347e621b7f) --- ...ode-add-padding-to-uc_resource_ext_t.patch | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 package/utils/ucode/patches/100-ucode-add-padding-to-uc_resource_ext_t.patch diff --git a/package/utils/ucode/patches/100-ucode-add-padding-to-uc_resource_ext_t.patch b/package/utils/ucode/patches/100-ucode-add-padding-to-uc_resource_ext_t.patch new file mode 100644 index 00000000000000..f8a8cf29ccd67d --- /dev/null +++ b/package/utils/ucode/patches/100-ucode-add-padding-to-uc_resource_ext_t.patch @@ -0,0 +1,21 @@ +From: Felix Fietkau +Date: Mon, 21 Jul 2025 21:07:17 +0200 +Subject: [PATCH] ucode: add padding to uc_resource_ext_t + +This ensures that user data structures tied to the ext resource are aligned +to 64 bit, as usually guaranteed by the memory allocator. + +Signed-off-by: Felix Fietkau +--- + +--- a/include/ucode/types.h ++++ b/include/ucode/types.h +@@ -213,6 +213,8 @@ typedef struct { + uint32_t persistent:1; + uint32_t uvcount:8; + uint32_t datasize:20; ++ ++ uint32_t _pad; + } uc_resource_ext_t; + + uc_declare_vector(uc_resource_types_t, uc_resource_type_t *); From ac80abb085117d5f198729b982e80f4f3de7bd18 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Wed, 9 Jul 2025 15:24:29 +0200 Subject: [PATCH 788/877] wifi-scripts: correctly set basic-rates with wpa_supplicant Correctly load the list of basic_rates from UCI. basic-rates shall be stored as a option-list. The current code did not retrieve this list correctly. wpa_supplicant uses a different config option to set basic-rates when operating in mesh-mode. Use the correct config key and calculation for mesh-interfaces. Signed-off-by: David Bauer (cherry picked from commit a854d833eabdbc3b42065927c136d75b981a1021) --- .../wifi-scripts/files/lib/netifd/hostapd.sh | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh b/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh index d673f5405bd070..6bdd0236cf994e 100644 --- a/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh +++ b/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh @@ -1361,11 +1361,13 @@ wpa_supplicant_add_network() { json_get_vars \ ssid bssid key \ - basic_rate mcast_rate \ + mcast_rate \ ieee80211w ieee80211r fils ocv \ multi_ap \ default_disabled + json_get_values basic_rate_list basic_rate + case "$auth_type" in sae|owe|eap2|eap192) set_default ieee80211w 2 @@ -1626,12 +1628,21 @@ wpa_supplicant_add_network() { [ -n "$bssid_blacklist" ] && append network_data "bssid_blacklist=$bssid_blacklist" "$N$T" [ -n "$bssid_whitelist" ] && append network_data "bssid_whitelist=$bssid_whitelist" "$N$T" - [ -n "$basic_rate" ] && { - local br rate_list= - for br in $basic_rate; do - wpa_supplicant_add_rate rate_list "$br" - done - [ -n "$rate_list" ] && append network_data "rates=$rate_list" "$N$T" + [ -n "$basic_rate_list" ] && { + local br rate rate_list= + + if [ "$mode" = mesh ]; then + for br in $basic_rate_list; do + rate="$(($br / 100))" + append rate_list "$rate" " " + done + [ -n "$rate_list" ] && append network_data "mesh_basic_rates=$rate_list" "$N$T" + else + for br in $basic_rate_list; do + wpa_supplicant_add_rate rate_list "$br" + done + [ -n "$rate_list" ] && append network_data "rates=$rate_list" "$N$T" + fi } [ -n "$mcast_rate" ] && { From 01bee440ad49bfdd4d412dcbe8ce03eadb4b75a4 Mon Sep 17 00:00:00 2001 From: John Audia Date: Sat, 12 Jul 2025 08:43:39 -0400 Subject: [PATCH 789/877] libxml2: update to 2.14.5 Release Notes: https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.13.7 https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.13.8 https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.14.3 https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.14.4 https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.14.5 Fixes: CVE-2025-32415 CVE-2025-32414 CVE-2025-6170 CVE-2025-49794 CVE-2025-49795 CVE-2025-49796 Build system: x86/64 Build-tested: x86/64-glibc Run-tested: x86/64-glibc Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/19383 (cherry picked from commit c08c2d6eb39dd5e040d6a50fdb46471b268fad1a) Link: https://github.com/openwrt/openwrt/pull/19486 Signed-off-by: Hauke Mehrtens --- package/libs/libxml2/Makefile | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/package/libs/libxml2/Makefile b/package/libs/libxml2/Makefile index bcc16783d6d27b..6976c482a31b8d 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.13.6 +PKG_VERSION:=2.14.5 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNOME/libxml2/$(basename $(PKG_VERSION)) -PKG_HASH:=f453480307524968f7a04ec65e64f2a83a825973bcd260a2e7691be82ae70c96 +PKG_HASH:=03d006f3537616833c16c53addcdc32a0eb20e55443cba4038307e3fa7d8d44b PKG_LICENSE:=MIT PKG_LICENSE_FILES:=COPYING @@ -61,7 +61,7 @@ endef CMAKE_HOST_OPTIONS += \ -DBUILD_SHARED_LIBS=OFF \ -DLIBXML2_WITH_C14N=ON \ - -DLIBXML2_WITH_CATALOG=OFF \ + -DLIBXML2_WITH_CATALOG=ON \ -DLIBXML2_WITH_DEBUG=ON \ -DLIBXML2_WITH_FTP=OFF \ -DLIBXML2_WITH_HTML=ON \ @@ -99,7 +99,7 @@ CMAKE_HOST_OPTIONS += \ CMAKE_OPTIONS += \ -DBUILD_SHARED_LIBS=ON \ -DLIBXML2_WITH_C14N=ON \ - -DLIBXML2_WITH_CATALOG=OFF \ + -DLIBXML2_WITH_CATALOG=ON \ -DLIBXML2_WITH_DEBUG=ON \ -DLIBXML2_WITH_FTP=OFF \ -DLIBXML2_WITH_HTML=ON \ @@ -160,9 +160,6 @@ define Build/InstallDev $(INSTALL_DIR) $(1)/usr/lib/pkgconfig $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libxml-2.0.pc $(1)/usr/lib/pkgconfig/ - - $(INSTALL_DIR) $(2)/share/aclocal/ - $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/aclocal/* $(2)/share/aclocal endef define Host/Install @@ -190,9 +187,6 @@ define Package/libxml2-dev/install $(INSTALL_DIR) $(1)/usr/lib/{cmake,pkgconfig} $(CP) $(PKG_INSTALL_DIR)/usr/lib/{cmake,pkgconfig} $(1)/usr/lib/ $(SED) "s,$(STAGING_DIR),,g" $(1)/usr/lib/pkgconfig/*.pc - - $(INSTALL_DIR) $(1)/usr/share/aclocal - $(CP) $(PKG_INSTALL_DIR)/usr/share/aclocal/* $(1)/usr/share/aclocal endef define Package/libxml2-utils/install From 254f6b241426e1fda72a844752e7f3979ef31626 Mon Sep 17 00:00:00 2001 From: Leo Barsky Date: Thu, 24 Jul 2025 12:12:33 +0000 Subject: [PATCH 790/877] kernel: bump 6.6 to 6.6.100 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.100 Manually refreshed: 823-v6.12-0003-nvmem-layouts-add-U-Boot-env-layout.patch All other patches auto-refreshed. Signed-off-by: Leo Barsky Link: https://github.com/openwrt/openwrt/pull/19514 (cherry picked from commit 05d344cb2ca3b95f6c3536981af4fd85122eae0d) Co-authored-by: Goetz Goerisch Signed-off-by: Goetz Goerisch Link: https://github.com/openwrt/openwrt/pull/19533 Signed-off-by: Hauke Mehrtens --- include/kernel-6.6 | 4 ++-- .../patches-6.6/950-0087-Add-dwc_otg-driver.patch | 2 +- ...835-Use-phys-addresses-for-slave-DMA-config.patch | 4 ++-- ....12-0001-nvmem-imx-ocotp-ele-support-i.MX95.patch | 8 ++++---- ...12-0003-nvmem-layouts-add-U-Boot-env-layout.patch | 12 ++++++------ ...ernel-ct-size-the-hashtable-more-adequately.patch | 2 +- .../generic/pending-6.6/630-packet_socket_type.patch | 6 +++--- ...bridge-fix-switchdev-host-mdb-entry-updates.patch | 2 +- ...e-switchdev-Don-t-drop-packets-between-port.patch | 2 +- ...e-NETIF_F_GSO_FRAGLIST-from-NETIF_F_GSO_SOF.patch | 2 +- .../825-i2c-MIPS-adds-ralink-I2C-driver.patch | 2 +- .../patches-6.6/310-add-i2c-rtl9300-support.patch | 2 +- 12 files changed, 24 insertions(+), 24 deletions(-) diff --git a/include/kernel-6.6 b/include/kernel-6.6 index 7ed3e4f41d6f08..4a55a573ae3948 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .99 -LINUX_KERNEL_HASH-6.6.99 = b08679729f1ec74b9fa829f5990936ca2511039d87acc7e8b3f39912de89ab36 +LINUX_VERSION-6.6 = .100 +LINUX_KERNEL_HASH-6.6.100 = d6c0ec4d55b14814f55b62a0b23a2d95faf66877e48fbfb4b83523e4afdf97ba diff --git a/target/linux/bcm27xx/patches-6.6/950-0087-Add-dwc_otg-driver.patch b/target/linux/bcm27xx/patches-6.6/950-0087-Add-dwc_otg-driver.patch index 82e969138e0727..0dd0c034003d85 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0087-Add-dwc_otg-driver.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0087-Add-dwc_otg-driver.patch @@ -1189,7 +1189,7 @@ Signed-off-by: Alexander Winkowski } --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c -@@ -5722,7 +5722,7 @@ static void port_event(struct usb_hub *h +@@ -5751,7 +5751,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-6.6/950-0466-mmc-bcm2835-Use-phys-addresses-for-slave-DMA-config.patch b/target/linux/bcm27xx/patches-6.6/950-0466-mmc-bcm2835-Use-phys-addresses-for-slave-DMA-config.patch index 96bbaf1ffaeae8..48a592e35c87c2 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0466-mmc-bcm2835-Use-phys-addresses-for-slave-DMA-config.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0466-mmc-bcm2835-Use-phys-addresses-for-slave-DMA-config.patch @@ -23,7 +23,7 @@ Signed-off-by: Phil Elwell #include #include #include -@@ -1347,8 +1346,8 @@ static int bcm2835_probe(struct platform +@@ -1348,8 +1347,8 @@ static int bcm2835_probe(struct platform struct device *dev = &pdev->dev; struct clk *clk; struct bcm2835_host *host; @@ -33,7 +33,7 @@ Signed-off-by: Phil Elwell int ret; dev_dbg(dev, "%s\n", __func__); -@@ -1361,23 +1360,13 @@ static int bcm2835_probe(struct platform +@@ -1362,23 +1361,13 @@ static int bcm2835_probe(struct platform host->pdev = pdev; spin_lock_init(&host->lock); diff --git a/target/linux/generic/backport-6.6/823-v6.12-0001-nvmem-imx-ocotp-ele-support-i.MX95.patch b/target/linux/generic/backport-6.6/823-v6.12-0001-nvmem-imx-ocotp-ele-support-i.MX95.patch index de965e1ccdc689..04ac6f1334e93f 100644 --- a/target/linux/generic/backport-6.6/823-v6.12-0001-nvmem-imx-ocotp-ele-support-i.MX95.patch +++ b/target/linux/generic/backport-6.6/823-v6.12-0001-nvmem-imx-ocotp-ele-support-i.MX95.patch @@ -16,8 +16,8 @@ Signed-off-by: Greg Kroah-Hartman --- a/drivers/nvmem/imx-ocotp-ele.c +++ b/drivers/nvmem/imx-ocotp-ele.c -@@ -14,8 +14,9 @@ - #include +@@ -15,8 +15,9 @@ + #include /* ETH_ALEN */ enum fuse_type { - FUSE_FSB = 1, @@ -28,7 +28,7 @@ Signed-off-by: Greg Kroah-Hartman FUSE_INVALID = -1 }; -@@ -95,7 +96,10 @@ static int imx_ocotp_reg_read(void *cont +@@ -96,7 +97,10 @@ static int imx_ocotp_reg_read(void *cont continue; } @@ -40,7 +40,7 @@ Signed-off-by: Greg Kroah-Hartman } memcpy(val, ((u8 *)p) + skipbytes, bytes); -@@ -179,8 +183,30 @@ static const struct ocotp_devtype_data i +@@ -182,8 +186,30 @@ static const struct ocotp_devtype_data i }, }; diff --git a/target/linux/generic/backport-6.6/823-v6.12-0003-nvmem-layouts-add-U-Boot-env-layout.patch b/target/linux/generic/backport-6.6/823-v6.12-0003-nvmem-layouts-add-U-Boot-env-layout.patch index af1b8b4e78fb51..3f105cfd2b9078 100644 --- a/target/linux/generic/backport-6.6/823-v6.12-0003-nvmem-layouts-add-U-Boot-env-layout.patch +++ b/target/linux/generic/backport-6.6/823-v6.12-0003-nvmem-layouts-add-U-Boot-env-layout.patch @@ -185,7 +185,7 @@ Signed-off-by: Greg Kroah-Hartman + size_t crc32_data_offset; + size_t crc32_data_len; + size_t crc32_offset; -+ __le32 *crc32_addr; ++ uint32_t *crc32_addr; + size_t data_offset; + size_t data_len; + size_t dev_size; @@ -236,8 +236,8 @@ Signed-off-by: Greg Kroah-Hartman + goto err_kfree; + } + -+ crc32_addr = (__le32 *)(buf + crc32_offset); -+ crc32 = le32_to_cpu(*crc32_addr); ++ crc32_addr = (uint32_t *)(buf + crc32_offset); ++ crc32 = *crc32_addr; + crc32_data_len = dev_size - crc32_data_offset; + data_len = dev_size - data_offset; + @@ -439,7 +439,7 @@ Signed-off-by: Greg Kroah-Hartman - size_t crc32_data_offset; - size_t crc32_data_len; - size_t crc32_offset; -- __le32 *crc32_addr; +- uint32_t *crc32_addr; - size_t data_offset; - size_t data_len; - size_t dev_size; @@ -490,8 +490,8 @@ Signed-off-by: Greg Kroah-Hartman - goto err_kfree; - } - -- crc32_addr = (__le32 *)(buf + crc32_offset); -- crc32 = le32_to_cpu(*crc32_addr); +- crc32_addr = (uint32_t *)(buf + crc32_offset); +- crc32 = *crc32_addr; - crc32_data_len = dev_size - crc32_data_offset; - data_len = dev_size - data_offset; - diff --git a/target/linux/generic/hack-6.6/661-kernel-ct-size-the-hashtable-more-adequately.patch b/target/linux/generic/hack-6.6/661-kernel-ct-size-the-hashtable-more-adequately.patch index ff959ec8d26472..64ef0736115591 100644 --- a/target/linux/generic/hack-6.6/661-kernel-ct-size-the-hashtable-more-adequately.patch +++ b/target/linux/generic/hack-6.6/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 -@@ -2685,7 +2685,7 @@ int nf_conntrack_init_start(void) +@@ -2699,7 +2699,7 @@ int nf_conntrack_init_start(void) if (!nf_conntrack_htable_size) { nf_conntrack_htable_size diff --git a/target/linux/generic/pending-6.6/630-packet_socket_type.patch b/target/linux/generic/pending-6.6/630-packet_socket_type.patch index f5c15756c5eab9..4992dd7816a72a 100644 --- a/target/linux/generic/pending-6.6/630-packet_socket_type.patch +++ b/target/linux/generic/pending-6.6/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; -@@ -3437,6 +3439,7 @@ static int packet_create(struct net *net +@@ -3436,6 +3438,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; -@@ -4104,6 +4107,16 @@ packet_setsockopt(struct socket *sock, i +@@ -4103,6 +4106,16 @@ packet_setsockopt(struct socket *sock, i packet_sock_flag_set(po, PACKET_SOCK_QDISC_BYPASS, val); return 0; } @@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau default: return -ENOPROTOOPT; } -@@ -4163,6 +4176,13 @@ static int packet_getsockopt(struct sock +@@ -4162,6 +4175,13 @@ static int packet_getsockopt(struct sock case PACKET_VNET_HDR_SZ: val = READ_ONCE(po->vnet_hdr_sz); break; diff --git a/target/linux/generic/pending-6.6/640-net-bridge-fix-switchdev-host-mdb-entry-updates.patch b/target/linux/generic/pending-6.6/640-net-bridge-fix-switchdev-host-mdb-entry-updates.patch index cf55c6a3fb8b37..8271e062ff0be2 100644 --- a/target/linux/generic/pending-6.6/640-net-bridge-fix-switchdev-host-mdb-entry-updates.patch +++ b/target/linux/generic/pending-6.6/640-net-bridge-fix-switchdev-host-mdb-entry-updates.patch @@ -20,7 +20,7 @@ Signed-off-by: Felix Fietkau --- a/net/bridge/br_switchdev.c +++ b/net/bridge/br_switchdev.c -@@ -568,10 +568,18 @@ static void br_switchdev_host_mdb(struct +@@ -571,10 +571,18 @@ static void br_switchdev_host_mdb(struct struct net_bridge_mdb_entry *mp, int type) { struct net_device *lower_dev; diff --git a/target/linux/generic/pending-6.6/641-net-bridge-switchdev-Don-t-drop-packets-between-port.patch b/target/linux/generic/pending-6.6/641-net-bridge-switchdev-Don-t-drop-packets-between-port.patch index 1c4ec61b50aee7..531e1c99c65368 100644 --- a/target/linux/generic/pending-6.6/641-net-bridge-switchdev-Don-t-drop-packets-between-port.patch +++ b/target/linux/generic/pending-6.6/641-net-bridge-switchdev-Don-t-drop-packets-between-port.patch @@ -27,7 +27,7 @@ Signed-off-by: Leon M. Busch-George --- a/net/bridge/br_switchdev.c +++ b/net/bridge/br_switchdev.c -@@ -67,7 +67,7 @@ bool nbp_switchdev_allowed_egress(const +@@ -70,7 +70,7 @@ bool nbp_switchdev_allowed_egress(const struct br_input_skb_cb *cb = BR_INPUT_SKB_CB(skb); return !test_bit(p->hwdom, &cb->fwd_hwdoms) && diff --git a/target/linux/generic/pending-6.6/681-net-remove-NETIF_F_GSO_FRAGLIST-from-NETIF_F_GSO_SOF.patch b/target/linux/generic/pending-6.6/681-net-remove-NETIF_F_GSO_FRAGLIST-from-NETIF_F_GSO_SOF.patch index fffb6cbb54cfa8..1d69f9f7751726 100644 --- a/target/linux/generic/pending-6.6/681-net-remove-NETIF_F_GSO_FRAGLIST-from-NETIF_F_GSO_SOF.patch +++ b/target/linux/generic/pending-6.6/681-net-remove-NETIF_F_GSO_FRAGLIST-from-NETIF_F_GSO_SOF.patch @@ -65,7 +65,7 @@ Signed-off-by: Felix Fietkau --- a/net/8021q/vlan.h +++ b/net/8021q/vlan.h -@@ -108,7 +108,7 @@ static inline netdev_features_t vlan_tnl +@@ -109,7 +109,7 @@ static inline netdev_features_t vlan_tnl netdev_features_t ret; ret = real_dev->hw_enc_features & diff --git a/target/linux/ramips/patches-6.6/825-i2c-MIPS-adds-ralink-I2C-driver.patch b/target/linux/ramips/patches-6.6/825-i2c-MIPS-adds-ralink-I2C-driver.patch index 9755eeb777dc5b..747d515964aa7a 100644 --- a/target/linux/ramips/patches-6.6/825-i2c-MIPS-adds-ralink-I2C-driver.patch +++ b/target/linux/ramips/patches-6.6/825-i2c-MIPS-adds-ralink-I2C-driver.patch @@ -45,7 +45,7 @@ Signed-off-by: John Crispin +}; --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig -@@ -1023,6 +1023,11 @@ config I2C_RK3X +@@ -1024,6 +1024,11 @@ config I2C_RK3X This driver can also be built as a module. If so, the module will be called i2c-rk3x. diff --git a/target/linux/realtek/patches-6.6/310-add-i2c-rtl9300-support.patch b/target/linux/realtek/patches-6.6/310-add-i2c-rtl9300-support.patch index 9eaed95d0df74c..c3b30f5fb7814a 100644 --- a/target/linux/realtek/patches-6.6/310-add-i2c-rtl9300-support.patch +++ b/target/linux/realtek/patches-6.6/310-add-i2c-rtl9300-support.patch @@ -17,7 +17,7 @@ Submitted-by: Birger Koblitz --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig -@@ -1023,6 +1023,16 @@ config I2C_RK3X +@@ -1024,6 +1024,16 @@ config I2C_RK3X This driver can also be built as a module. If so, the module will be called i2c-rk3x. From bfed41cc6a8bd641bc1280730118dc83af913a17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Mon, 9 Jun 2025 15:44:44 +0000 Subject: [PATCH 791/877] busybox: fix login applet on selinux MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently the system boots up, but is unusable because pressing enter does not provide login with error: login: can't get SID for root This is happenning, because login.c passes the Linux username directly to get_default_context(), while libselinux expects an SELinux user identity, causing the call to fail for users without a matching SELinux name (e.g., root) and aborting login on SELinux-enabled systems. Fixes: #19075 Upstream-Status: Submitted [https://lists.busybox.net/pipermail/busybox/2025-April/091407.html] Signed-off-by: Petr Štetiar Link: https://github.com/openwrt/openwrt/pull/19080 (cherry picked from commit 5809bfaaacca1d10c2e77bd073065d1d3b77527e) Link: https://github.com/openwrt/openwrt/pull/19542 Signed-off-by: Hauke Mehrtens --- ....c-libselinux-get_default_context-ex.patch | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 package/utils/busybox/patches/600-loginutils-login.c-libselinux-get_default_context-ex.patch diff --git a/package/utils/busybox/patches/600-loginutils-login.c-libselinux-get_default_context-ex.patch b/package/utils/busybox/patches/600-loginutils-login.c-libselinux-get_default_context-ex.patch new file mode 100644 index 00000000000000..8c26ee001bbe9b --- /dev/null +++ b/package/utils/busybox/patches/600-loginutils-login.c-libselinux-get_default_context-ex.patch @@ -0,0 +1,51 @@ +From 850a6d031039237b0b13d8fab9f10a7cd4752907 Mon Sep 17 00:00:00 2001 +From: Dominick Grift +Date: Sat, 5 Apr 2025 13:40:26 +0200 +Subject: [PATCH] loginutils/login.c: libselinux get_default_context() expects + seuser + +Use getseuserbyname() to get the seuser associated with username and use that +instead with get_default_context() + +>From get_default_context.3: +"These functions takes a SELinux user identity that must be defined in the SELinux policy as their input, not a Linux username." + +Fixes: #19075 +Upstream-Status: Submitted [https://lists.busybox.net/pipermail/busybox/2025-April/091407.html] +Signed-off-by: Dominick Grift +--- + loginutils/login.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +--- a/loginutils/login.c ++++ b/loginutils/login.c +@@ -183,12 +183,16 @@ static void die_if_nologin(void) + static void initselinux(char *username, char *full_tty, + security_context_t *user_sid) + { ++ char *seuser = NULL, *level = NULL; + security_context_t old_tty_sid, new_tty_sid; + + if (!is_selinux_enabled()) + return; + +- if (get_default_context(username, NULL, user_sid)) { ++ if (getseuserbyname(username, &seuser, &level)) { ++ bb_error_msg_and_die("can't get seuser for %s", username); ++ } ++ if (get_default_context(seuser, NULL, user_sid)) { + bb_error_msg_and_die("can't get SID for %s", username); + } + if (getfilecon(full_tty, &old_tty_sid) < 0) { +@@ -201,6 +205,11 @@ static void initselinux(char *username, + if (setfilecon(full_tty, new_tty_sid) != 0) { + bb_perror_msg_and_die("chsid(%s, %s) failed", full_tty, new_tty_sid); + } ++ ++ if (ENABLE_FEATURE_CLEAN_UP) { ++ free(seuser); ++ free(level); ++ } + } + #endif + From 7230ddb06bc531ce812a00db3f0ed284aee9f0a5 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 20 Jul 2025 17:46:05 +0200 Subject: [PATCH 792/877] wireless-regdb: Update to version 2025.07.10 6953f19 wireless-regdb: Update regulatory info for Indonesia (ID) for 2025 2e8214e wireless-regdb: Permit 320 MHz bandwidth in 6 GHz band for GB a94f685 wireless-regdb: Update regulatory info for Egypt (EG) for 2024 7628ce2 wireless-regdb: Update regulatory rules for Brazil (BR) on 6GHz 4411b39 wireless-regdb: Update regulatory info for Vietnam (VN) for 2025 490f136 wireless-regdb: Update regulatory info for Estonia (EE) for 2024 c56c663 wireless-regdb: update regulatory rules for Paraguay (PY) on 6 GHz for 2025 5a8ced5 wireless-regdb: Update regulatory info for CEPT countries for 6GHz listed by WiFi Alliance 5fd8ee3 wireless-regdb: update regulatory rules for Bosnia and Herzegovina (BA) for 6 GHz e05260a wireless-regdb: update regulatory database based on preceding changes Link: https://github.com/openwrt/openwrt/pull/19474 (cherry picked from commit 7fe06b7f56d95703a0cfb4c0e54dc8a6731dc70c) Link: https://github.com/openwrt/openwrt/pull/19538 Signed-off-by: Hauke Mehrtens --- 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 7055b12bfa12ef..d45c95e5e3d4f0 100644 --- a/package/firmware/wireless-regdb/Makefile +++ b/package/firmware/wireless-regdb/Makefile @@ -1,14 +1,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=wireless-regdb -PKG_VERSION:=2025.02.20 +PKG_VERSION:=2025.07.10 PKG_RELEASE:=1 PKG_LICENSE:=ISC PKG_LICENSE_FILES:=LICENSE PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/software/network/wireless-regdb/ -PKG_HASH:=57f8e7721cf5a880c13ae0c202edbb21092a060d45f9e9c59bcd2a8272bfa456 +PKG_HASH:=a8340bcdcd1b5db6c79149879d122b170f3bb075381718d4f429ad831a6fa28d PKG_MAINTAINER:=Felix Fietkau From 05a1a71530e89b2ed46eece5aa039fabc0af6387 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 27 Jul 2025 14:19:19 +0200 Subject: [PATCH 793/877] toolchain: glibc: Update glibc 2.38 to recent HEAD f510d75ff7 nscd: Use time_t for return type of addgetnetgrentX 5aa4bb67b9 resolv: Fix some unaligned accesses in resolver [BZ #30750] 249646f12b Force DT_RPATH for --enable-hardcoded-path-in-tests 697ab62d11 i386: Disable Intel Xeon Phi tests for GCC 15 and above (BZ 31782) c8cb4d2b86 misc: Add support for Linux uio.h RWF_NOAPPEND flag 712453634c s390x: Fix segfault in wcsncmp [BZ #31934] 7bfc35959d nptl: fix potential merge of __rseq_* relro symbols d9d019d674 elf: Make dl-rseq-symbols Linux only bb30bd2162 Linux: Make __rseq_size useful for feature detection (bug 31965) dc512364e8 resolv: Allow short error responses to match any query (bug 31890) 6cad0f543c resolv: Do not wait for non-existing second DNS response after error (bug 30081) 1bed6acf50 resolv: Track single-request fallback via _res._flags (bug 31476) 0301637b99 linux: Update the mremap C implementation [BZ #31968] f0e2114535 mremap: Update manual entry 6bb75212e6 Add mremap tests 3ac7ba61d2 Update syscall lists for Linux 6.5 9184c13681 resolv: Fix tst-resolv-short-response for older GCC (bug 32042) 059f82c3b9 Fix name space violation in fortify wrappers (bug 32052) c005d1bd6f x86: Fix bug in strchrnul-evex512 [BZ #32078] 28f358bc42 support: Add FAIL test failure helper 99ffa84bdc stdio-common: Add test for vfscanf with matches longer than INT_MAX [BZ #27650] 87a1968a72 Make tst-ungetc use libsupport 804d3c8db7 ungetc: Fix uninitialized read when putting into unused streams [BZ #27821] b9f72bd5de ungetc: Fix backup buffer leak on program exit [BZ #27821] 15ca66303f posix: Use facilities in tst-truncate and tst-truncate64 f30501ca75 nptl: Use facilities in tst-setuid3 370be85892 libio: Attempt wide backup free only for non-legacy code 4dd8641461 Add crt1-2.0.o for glibc 2.0 compatibility tests fa4ad10406 elf: Change ldconfig auxcache magic number (bug 32231) 9423cc5387 nptl: initialize rseq area prior to registration 37ded328c4 nptl: initialize cpu_id_start prior to rseq registration cf06772360 x86: Avoid integer truncation with large cache sizes (bug 32470) 5c9be512ee x86_64: Sort fpu/multiarch/Makefile 49016f2190 x86_64: Add log2 with FMA b2a45f1eee x86_64: Add expm1 with FMA c92946d9b2 x86_64: Add log1p with FMA 58822f954f x86: Check the lower byte of EAX of CPUID leaf 2 [BZ #30643] 7772f9358c elf: Fix slow tls access after dlopen [BZ #19924] 5a64f93365 x86: Only align destination to 1x VEC_SIZE in memset 4x loop 0d14bf0754 sysdeps/x86/Makefile: Split and sort tests dc1762113d x86_64: Fix missing wcsncat function definition without multiarch (x86-64-v4) 04b8d48432 x86: Improve large memset perf with non-temporal stores [RHEL-29312] 12fec8aae5 x86/string: Fixup alignment of main loop in str{n}cmp-evex [BZ #32212] 48642ef1a5 elf: Avoid some free (NULL) calls in _dl_update_slotinfo 549e7f7c5a elf: Support recursive use of dynamic TLS in interposed malloc c32fd59314 Fix underallocation of abort_msg_s struct (CVE-2025-0395) 650a0aaaff stdlib: Test using setenv with updated environ [BZ #32588] f984e2d7e8 assert: Add test for CVE-2025-0395 9ca74b8ad1 AArch64: Improve generic strlen 95aa21432c AArch64: Optimize memset 5fe151d86a AArch64: Remove zva_128 from memset 3de5112326 math: Improve layout of expf data 52c2b1556f AArch64: Add SVE memset 097299ffa9 AArch64: Use prefer_sve_ifuncs for SVE memset 5a08d049dc math: Improve layout of exp/exp10 data 3be3728df2 elf: Ignore LD_LIBRARY_PATH and debug env var for setuid for static 454f24e981 support: Use const char * argument in support_capture_subprogram_self_sgid 4335cd9b58 support: Add support_record_failure_barrier 31fa0f73e2 elf: Test case for bug 32976 (CVE-2025-4802) ca41fe44a5 x86_64: Fix typo in ifunc-impl-list.c. ca7e32d024 elf: Fix subprocess status handling for tst-dlopen-sgid (bug 32987) 81f58dd9b7 support: Pick group in support_capture_subprogram_self_sgid if UID == 0 5a6276d97a Fix error reporting (false negatives) in SGID tests 1a0d73a625 pthreads NPTL: lost wakeup fix 2 b5c4727e59 nptl: Update comments and indentation for new condvar implementation 1fa5e51897 nptl: Remove unnecessary catch-all-wake in condvar group switch 44eaf0615d nptl: Remove unnecessary quadruple check in pthread_cond_wait 7625579f11 nptl: Remove g_refs from condition variables 6bac834c5a nptl: Use a single loop in pthread_cond_wait instaed of a nested loop 5765653697 nptl: Fix indentation 8899e89b29 nptl: rename __condvar_quiesce_and_switch_g1 39a80f4035 nptl: Use all of g1_start and g_signals 51210d6496 nptl: PTHREAD_COND_INITIALIZER compatibility with pre-2.41 versions (bug 32786) 879f0ee122 malloc: add indirection for malloc(-like) functions in tests [BZ #32366] a637f2c42f malloc: obscure calloc use in tst-calloc 21019afe65 malloc: cleanup casts in tst-calloc 6a52d5cab0 posix: Fix double-free after allocation failure in regcomp (bug 33185) Link: https://github.com/openwrt/openwrt/pull/19551 Signed-off-by: Hauke Mehrtens --- toolchain/glibc/common.mk | 4 ++-- toolchain/glibc/patches/200-add-dl-search-paths.patch | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/toolchain/glibc/common.mk b/toolchain/glibc/common.mk index 28beda04ebdcc3..f0d451474f15ca 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:=e9f05fa1c62c8044ff025963498063f73eb51c5f -PKG_MIRROR_HASH:=fd61eb2caea0d4100638b8aa8285b0f1bc23af921c376516307c9ab8ac307739 +PKG_SOURCE_VERSION:=6a52d5cab01ee8d3303f7c0939d6b2618c8a9606 +PKG_MIRROR_HASH:=2f55c40271e064e4fa338d9a04fd258c4c59a6ad198ab4bbfb7782e318db80c2 PKG_SOURCE_URL:=https://sourceware.org/git/glibc.git PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.zst PKG_CPE_ID:=cpe:/a:gnu:glibc diff --git a/toolchain/glibc/patches/200-add-dl-search-paths.patch b/toolchain/glibc/patches/200-add-dl-search-paths.patch index 15106541ca51fc..083dc3df404647 100644 --- a/toolchain/glibc/patches/200-add-dl-search-paths.patch +++ b/toolchain/glibc/patches/200-add-dl-search-paths.patch @@ -2,7 +2,7 @@ add /usr/lib to default search path for the dynamic linker --- a/Makeconfig +++ b/Makeconfig -@@ -632,6 +632,9 @@ else +@@ -656,6 +656,9 @@ else default-rpath = $(libdir) endif From ecb35b36fae497d8233b115a44df5dc1f5d8c6b3 Mon Sep 17 00:00:00 2001 From: Jan Hoffmann Date: Thu, 10 Jul 2025 17:37:02 +0200 Subject: [PATCH 794/877] ltq-*-app: correctly report downstream band borders The direction needs to be included in the IOCTL call. Fixes: b91d7d9d78ea ("ltq-*-app: extend ubus metrics/statistics") Signed-off-by: Jan Hoffmann Link: https://github.com/openwrt/openwrt/pull/19363 (cherry picked from commit b002cdd6a3b9a469aad91b488c21a0604c01f941) Link: https://github.com/openwrt/openwrt/pull/19556 Signed-off-by: Hauke Mehrtens --- package/network/config/ltq-adsl-app/Makefile | 2 +- package/network/config/ltq-vdsl-vr11-app/Makefile | 2 +- package/network/config/ltq-vdsl-vr9-app/Makefile | 2 +- package/network/config/ltq-vdsl-vr9-app/src/src/dsl_cpe_ubus.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package/network/config/ltq-adsl-app/Makefile b/package/network/config/ltq-adsl-app/Makefile index b96a3f71e5bd1c..3da37f884d9ba6 100644 --- a/package/network/config/ltq-adsl-app/Makefile +++ b/package/network/config/ltq-adsl-app/Makefile @@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=dsl_cpe_control_danube PKG_VERSION:=3.24.4.4 -PKG_RELEASE:=13 +PKG_RELEASE:=14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_BUILD_DIR:=$(BUILD_DIR)/dsl_cpe_control-$(PKG_VERSION) PKG_SOURCE_URL:=@OPENWRT diff --git a/package/network/config/ltq-vdsl-vr11-app/Makefile b/package/network/config/ltq-vdsl-vr11-app/Makefile index f1782db285c064..2aacbbd785103c 100644 --- a/package/network/config/ltq-vdsl-vr11-app/Makefile +++ b/package/network/config/ltq-vdsl-vr11-app/Makefile @@ -9,7 +9,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=ltq-vdsl-vr11-app PKG_VERSION:=4.23.1 -PKG_RELEASE:=5 +PKG_RELEASE:=6 PKG_BASE_NAME:=dsl_cpe_control UGW_VERSION=8.5.2.10 diff --git a/package/network/config/ltq-vdsl-vr9-app/Makefile b/package/network/config/ltq-vdsl-vr9-app/Makefile index a73cd4ae62ff74..c1b3b12e1cddb6 100644 --- a/package/network/config/ltq-vdsl-vr9-app/Makefile +++ b/package/network/config/ltq-vdsl-vr9-app/Makefile @@ -9,7 +9,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=ltq-vdsl-vr9-app PKG_VERSION:=4.17.18.6 -PKG_RELEASE:=7 +PKG_RELEASE:=8 PKG_BASE_NAME:=dsl_cpe_control PKG_SOURCE:=$(PKG_BASE_NAME)_vrx-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@OPENWRT diff --git a/package/network/config/ltq-vdsl-vr9-app/src/src/dsl_cpe_ubus.c b/package/network/config/ltq-vdsl-vr9-app/src/src/dsl_cpe_ubus.c index 77a1c67b6aebc2..0636fbc8cae7df 100644 --- a/package/network/config/ltq-vdsl-vr9-app/src/src/dsl_cpe_ubus.c +++ b/package/network/config/ltq-vdsl-vr9-app/src/src/dsl_cpe_ubus.c @@ -447,7 +447,7 @@ static void pilot_tones_status(int fd) { } static void band_border_status(int fd, DSL_AccessDir_t direction) { - IOCTL(DSL_BandBorderStatus_t, DSL_FIO_BAND_BORDER_STATUS_GET); + IOCTL_DIR(DSL_BandBorderStatus_t, DSL_FIO_BAND_BORDER_STATUS_GET, direction); void *c, *c2; From 8ee468ff682e4de11f046e1c86382534483a8a4a Mon Sep 17 00:00:00 2001 From: Tomasz Maciej Nowak Date: Wed, 18 Jun 2025 18:59:29 +0200 Subject: [PATCH 795/877] tegra: bring back workaround for spurious interrupts Unfortunately they still apear with prolonged serial console usage. While it's not common to use serial console past initial setup, alas when the condition is hit the console is almost unusable. Signed-off-by: Tomasz Maciej Nowak Link: https://patchwork.ozlabs.org/project/openwrt/patch/20250618170045.473711-2-tmn505@terefe.re/ (cherry picked from commit b8dea6056d32431f21096760df71a6d98441945a) Link: https://github.com/openwrt/openwrt/pull/19555 Signed-off-by: Hauke Mehrtens --- ...interrupts-due-to-tegra2-silicon-bug.patch | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 target/linux/tegra/patches-6.6/100-serial8250-on-tegra-hsuart-recover-from-spurious-interrupts-due-to-tegra2-silicon-bug.patch diff --git a/target/linux/tegra/patches-6.6/100-serial8250-on-tegra-hsuart-recover-from-spurious-interrupts-due-to-tegra2-silicon-bug.patch b/target/linux/tegra/patches-6.6/100-serial8250-on-tegra-hsuart-recover-from-spurious-interrupts-due-to-tegra2-silicon-bug.patch new file mode 100644 index 00000000000000..8f01f73eb24a98 --- /dev/null +++ b/target/linux/tegra/patches-6.6/100-serial8250-on-tegra-hsuart-recover-from-spurious-interrupts-due-to-tegra2-silicon-bug.patch @@ -0,0 +1,77 @@ +From patchwork Fri Jul 13 11:32:42 2018 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: serial8250 on tegra hsuart: recover from spurious interrupts due to + tegra2 silicon bug +X-Patchwork-Submitter: "David R. Piegdon" +X-Patchwork-Id: 943440 +Message-Id: <4676ea34-69ce-5422-1ded-94218b89f7d9@p23q.org> +To: linux-tegra@vger.kernel.org +Date: Fri, 13 Jul 2018 11:32:42 +0000 +From: "David R. Piegdon" +List-Id: + +Hi, +a while back I sent a few mails regarding spurious interrupts in the +UARTA (hsuart) block of the Tegra2 SoC, when using the 8250 driver for +it instead of the hsuart driver. After going down a pretty deep +debugging/testing hole, I think I found a patch that fixes the issue. So +far testing in a reboot-cycle suggests that the error frequency dropped +from >3% of all reboots to at least <0.05% of all reboots. Tests +continue to run over the weekend. + +The patch below already is a second iteration; the first did not reset +the MCR or contain the lines below '// clear interrupts'. This resulted +in no more spurious interrupts, but in a few % of spurious interrupts +that were recovered the UART block did not receive any characters any +more. So further resetting was required to fully reacquire operational +state of the UART block. + +I'd love any comments/suggestions on this! + +Cheers, + +David + +--- a/drivers/tty/serial/8250/8250_core.c ++++ b/drivers/tty/serial/8250/8250_core.c +@@ -134,6 +134,38 @@ static irqreturn_t serial8250_interrupt( + + if (l == i->head && pass_counter++ > PASS_LIMIT) + break; ++ ++#ifdef CONFIG_ARCH_TEGRA_2x_SOC ++ if (!handled && (port->type == PORT_TEGRA)) { ++ /* ++ * Fix Tegra 2 CPU silicon bug where sometimes ++ * "TX holding register empty" interrupts result in a ++ * bad (metastable?) state in Tegras HSUART IP core. ++ * Only way to recover seems to be to reset all ++ * interrupts as well as the TX queue and the MCR. ++ * But we don't want to loose any outgoing characters, ++ * so only do it if the RX and TX queues are empty. ++ */ ++ unsigned char lsr = port->serial_in(port, UART_LSR); ++ const unsigned char fifo_empty_mask = ++ (UART_LSR_TEMT | UART_LSR_THRE); ++ if (((lsr & (UART_LSR_DR | fifo_empty_mask)) == ++ fifo_empty_mask)) { ++ port->serial_out(port, UART_IER, 0); ++ port->serial_out(port, UART_MCR, 0); ++ serial8250_clear_and_reinit_fifos(up); ++ port->serial_out(port, UART_MCR, up->mcr); ++ port->serial_out(port, UART_IER, up->ier); ++ // clear interrupts ++ serial_port_in(port, UART_LSR); ++ serial_port_in(port, UART_RX); ++ serial_port_in(port, UART_IIR); ++ serial_port_in(port, UART_MSR); ++ up->lsr_saved_flags = 0; ++ up->msr_saved_flags = 0; ++ } ++ } ++#endif + } while (l != end); + + spin_unlock(&i->lock); From 4c1a6ecb444067d6efdad6ded30b3f7e3683565d Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 12 Jul 2025 00:55:38 +0200 Subject: [PATCH 796/877] kernel: Fix boot of amrsr target in qemu The bootup of the armsr target sometimes failed like this: ``` [ 0.762283] NET: Registered PF_INET6 protocol family [ 0.791987] workqueue: Failed to create a worker thread: -EAGAIN [ 0.801986] workqueue: Failed to create a rescuer kthread for wq "mld": -EAGAIN [ 0.964017] NET: Unregistered PF_INET6 protocol family ``` Increase the maximum number of threads the kernel allows. Link: https://github.com/openwrt/openwrt/pull/19376 (cherry picked from commit c5330bdf7e8a577d98a4075cd9d022c1048d2913) Link: https://github.com/openwrt/openwrt/pull/19554 Signed-off-by: Hauke Mehrtens --- ...ease-minimum-number-of-allowed-threa.patch | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 target/linux/generic/pending-6.6/250-kernel-fork-Increase-minimum-number-of-allowed-threa.patch diff --git a/target/linux/generic/pending-6.6/250-kernel-fork-Increase-minimum-number-of-allowed-threa.patch b/target/linux/generic/pending-6.6/250-kernel-fork-Increase-minimum-number-of-allowed-threa.patch new file mode 100644 index 00000000000000..17470b7a158daf --- /dev/null +++ b/target/linux/generic/pending-6.6/250-kernel-fork-Increase-minimum-number-of-allowed-threa.patch @@ -0,0 +1,37 @@ +From a22c4c7bbfad3e93e717e16f6faf343259add27a Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Fri, 27 Jun 2025 11:09:04 +0100 +Subject: [PATCH v2] kernel/fork: Increase minimum number of allowed threads + +A modern Linux system creates much more than 20 threads at bootup. +When I booted up OpenWrt in qemu the system sometimes failed to boot up +when it wanted to create the 419th thread. The VM had 128MB RAM and the +calculation in set_max_threads() calculated that max_threads should be +set to 419. When the system booted up it tried to notify the user space +about every device it created because CONFIG_UEVENT_HELPER was set and +used. I counted 1299 calls to call_usermodehelper_setup(), all of +them try to create a new thread and call the userspace hotplug script in +it. + +This fixes bootup of Linux on systems with low memory. + +I saw the problem with qemu 10.0.2 using these commands: +qemu-system-aarch64 -machine virt -cpu cortex-a57 -nographic + +Cc: stable@vger.kernel.org +Signed-off-by: Hauke Mehrtens +--- + kernel/fork.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/kernel/fork.c ++++ b/kernel/fork.c +@@ -115,7 +115,7 @@ + /* + * Minimum number of threads to boot the kernel + */ +-#define MIN_THREADS 20 ++#define MIN_THREADS 600 + + /* + * Maximum number of threads From 4941509f573676c4678115a0a3a743ef78b63c17 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Thu, 3 Jul 2025 21:37:39 +0200 Subject: [PATCH 797/877] uhttpd: update to Git HEAD (2025-07-06) b3e3c05 client: don't send stray EOF chunk on connection timeout fad0d05 proc: inhibit chunked transfer encoding on existing TEs or known length 3d6f01b file: prevent writes beyond end of uh_buf on enumerating directories c7294e7 client: reject requests with multiple content-lengths and/or TEs 7e64e8b client: Allow sending content in DONE state uhttpd commit 3d6f01b fixes: CVE-2025-32108 Link: https://github.com/openwrt/openwrt/pull/19290 (cherry picked from commit efb4200ba569d6ff79ec58a3c44cd8769ba40fdc) Link: https://github.com/openwrt/openwrt/pull/19563 Signed-off-by: Hauke Mehrtens --- 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 ea76fa65ea8114..3899c5827199b0 100644 --- a/package/network/services/uhttpd/Makefile +++ b/package/network/services/uhttpd/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=4 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/uhttpd.git -PKG_SOURCE_DATE:=2023-06-25 -PKG_SOURCE_VERSION:=34a8a74dbdec3c0de38abc1b08f6a73c51263792 -PKG_MIRROR_HASH:=0603019dabb89b1b207d0f7916616c95ce8194a7ff9fd71f0ddd845dd2de944e +PKG_SOURCE_DATE:=2025-07-06 +PKG_SOURCE_VERSION:=7e64e8bad2415cec0a6d9770ec379db54273c7a7 +PKG_MIRROR_HASH:=61a7ad046f31f229f6a8620b890e448c5df397391edb5f7bd2a84446486eaff4 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=ISC From 155eea44e7695c5cd017a240469cac57c19af64b Mon Sep 17 00:00:00 2001 From: jinkela air Date: Sun, 22 Jun 2025 10:13:56 +0800 Subject: [PATCH 798/877] mediatek: Ruijie RG-X60 Pro: Fix LAN port status light Fix the status indicator light of the LAN port. Signed-off-by: jinkela air Link: https://github.com/openwrt/openwrt/pull/19135 (cherry picked from commit 1e00b92597a1e14b5eb07cc2f87d3b943b4bd876) Link: https://github.com/openwrt/openwrt/pull/19567 Signed-off-by: Hauke Mehrtens --- .../dts/mt7986a-ruijie-rg-x60-pro.dts | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/target/linux/mediatek/dts/mt7986a-ruijie-rg-x60-pro.dts b/target/linux/mediatek/dts/mt7986a-ruijie-rg-x60-pro.dts index 80b614ac2282d5..9f40fec043e7e2 100644 --- a/target/linux/mediatek/dts/mt7986a-ruijie-rg-x60-pro.dts +++ b/target/linux/mediatek/dts/mt7986a-ruijie-rg-x60-pro.dts @@ -230,21 +230,25 @@ port@0 { reg = <0>; label = "lan1"; + phy-handle = <&swphy0>; }; port@1 { reg = <1>; label = "lan2"; + phy-handle = <&swphy1>; }; port@2 { reg = <2>; label = "lan3"; + phy-handle = <&swphy2>; }; port@3 { reg = <3>; label = "lan4"; + phy-handle = <&swphy3>; }; port@6 { @@ -260,6 +264,67 @@ }; }; }; + + mdio { + #address-cells = <1>; + #size-cells = <0>; + + swphy0: phy@0 { + reg = <0>; + + 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 */ + >; + }; + + swphy1: 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 */ + >; + }; + + swphy2: 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 */ + >; + }; + + swphy3: 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 */ + >; + }; + }; }; &wifi { From b2116dbce4976ee9596d90964a4f145440b1c51e Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 9 Aug 2025 16:01:33 +0200 Subject: [PATCH 799/877] rpcd: backport ucode fix ucode: adjust for new ext resource type ucv_resource_dataptr always returns null for resources with embedded data. Fixes: https://github.com/openwrt/rpcd/issues/17 Fixes: https://github.com/openwrt/luci/issues/7878 Fixes: https://github.com/openwrt/openwrt/issues/19726 Signed-off-by: Felix Fietkau --- ...ode-adjust-for-new-ext-resource-type.patch | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 package/system/rpcd/patches/100-ucode-adjust-for-new-ext-resource-type.patch diff --git a/package/system/rpcd/patches/100-ucode-adjust-for-new-ext-resource-type.patch b/package/system/rpcd/patches/100-ucode-adjust-for-new-ext-resource-type.patch new file mode 100644 index 00000000000000..0b0acd44585d49 --- /dev/null +++ b/package/system/rpcd/patches/100-ucode-adjust-for-new-ext-resource-type.patch @@ -0,0 +1,20 @@ +From: Felix Fietkau +Date: Sat, 9 Aug 2025 15:55:11 +0200 +Subject: [PATCH] ucode: adjust for new ext resource type + +ucv_resource_dataptr always returns null for resources with embedded data. + +Signed-off-by: Felix Fietkau +--- + +--- a/ucode.c ++++ b/ucode.c +@@ -449,7 +449,7 @@ rpc_ucode_script_call(struct ubus_contex + res = uc_vm_stack_pop(&script->vm); + + /* The handler function invoked a nested aync ubus request and returned it */ +- if (ucv_resource_dataptr(res, "ubus.deferred")) { ++ if (ucv_resource_data(res, "ubus.deferred")) { + /* Install guard timer in case the reply callback is never called */ + callctx->timeout.cb = rpc_ucode_request_timeout; + uloop_timeout_set(&callctx->timeout, request_timeout); From 33728aa96c8d1206c9c31080654de2f7cf143ee5 Mon Sep 17 00:00:00 2001 From: Christian Korber Date: Wed, 21 May 2025 14:36:00 +0200 Subject: [PATCH 800/877] hostapd: fix logging of configuration content This commit is an adoption of the fix for #14049 to apply it for openwrt-24.10. Signed-off-by: Christian Korber Link: https://github.com/openwrt/openwrt/pull/17718 Link: https://github.com/openwrt/openwrt/pull/19660 Signed-off-by: Robert Marko --- .../patches/701-reload_config_inline.patch | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/package/network/services/hostapd/patches/701-reload_config_inline.patch b/package/network/services/hostapd/patches/701-reload_config_inline.patch index 54045476477fe6..24d3aa86d057d5 100644 --- a/package/network/services/hostapd/patches/701-reload_config_inline.patch +++ b/package/network/services/hostapd/patches/701-reload_config_inline.patch @@ -8,7 +8,7 @@ as adding/removing interfaces. --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -5207,7 +5207,12 @@ struct hostapd_config * hostapd_config_r +@@ -5207,7 +5207,14 @@ struct hostapd_config * hostapd_config_r int errors = 0; size_t i; @@ -19,6 +19,8 @@ as adding/removing interfaces. + } else { + f = fopen(fname, "r"); + } ++ wpa_printf(MSG_INFO, "Configuration file: Reading configuration file '%s'", ++ fname); if (f == NULL) { wpa_printf(MSG_ERROR, "Could not open configuration file '%s' " "for reading.", fname); @@ -39,3 +41,35 @@ as adding/removing interfaces. if (f == NULL) { wpa_printf(MSG_ERROR, "Failed to open config file '%s', " "error: %s", name, strerror(errno)); +--- a/hostapd/main.c ++++ b/hostapd/main.c +@@ -406,7 +406,11 @@ hostapd_interface_init(struct hapd_inter + struct hostapd_iface *iface; + int k; + +- wpa_printf(MSG_DEBUG, "Configuration file: %s", config_fname); ++ if (!strncmp(config_fname, "data:", 5)) { ++ wpa_printf(MSG_DEBUG, "Configuration file: %s", ""); ++ } else { ++ wpa_printf(MSG_DEBUG, "Configuration file: %s", config_fname); ++ } + iface = hostapd_init(interfaces, config_fname); + if (!iface) + return NULL; +--- a/src/ap/hostapd.c ++++ b/src/ap/hostapd.c +@@ -2893,7 +2893,12 @@ hostapd_interface_init_bss(struct hapd_i + } + } + +- wpa_printf(MSG_INFO, "Configuration file: %s (phy %s)%s", +- config_fname, phy, iface ? "" : " --> new PHY"); ++ if (!strncmp(config_fname, "data:", 5)) { ++ wpa_printf(MSG_INFO, "Configuration file: %s (phy %s)%s", ++ "", phy, iface ? "" : " --> new PHY"); ++ } else { ++ wpa_printf(MSG_INFO, "Configuration file: %s (phy %s)%s", ++ config_fname, phy, iface ? "" : " --> new PHY"); ++ } + if (iface) { + struct hostapd_config *conf; From 9d193d9b6549bd63117e17e22895b3cfb6de562b Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Tue, 12 Aug 2025 11:22:27 -0700 Subject: [PATCH 801/877] mpc85xx: tl-wdr4900: add back 5ghz LED In the conversion to dts, qca,led-pin was used for both interfaces. Unfortunately, it's mutually exclusive with gpio-controller which made it not do anything. Fixes: 949e1a0 ("mpc85xx: tl-wdr4900: move platform code to dts") Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/19758 Signed-off-by: Robert Marko (cherry picked from commit cc0ff28f235a14283138559249d413b7aa2a9a4d) --- .../files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts index 4fd9767d2d4550..861f4511de4d2d 100644 --- a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts +++ b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts @@ -395,18 +395,25 @@ compatible = "gpio-leds"; led-0 { + gpios = <&ath9k 0 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_WLAN_5GHZ; + linux,default-trigger = "phy0tpt"; + }; + + led-1 { gpios = <&ath9k 1 GPIO_ACTIVE_LOW>; color = ; function = LED_FUNCTION_WPS; }; - system_green: led-1 { + system_green: led-2 { gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; color = ; function = LED_FUNCTION_STATUS; }; - led-2 { + led-3 { gpios = <&gpio0 3 GPIO_ACTIVE_LOW>; color = ; function = LED_FUNCTION_USB; @@ -415,7 +422,7 @@ trigger-sources = <&hub_port1>; }; - led-3 { + led-4 { gpios = <&gpio0 4 GPIO_ACTIVE_LOW>; color = ; function = LED_FUNCTION_USB; From faf168ffc9b805c9d3386d675c631ddbacb83eb2 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 13 Aug 2025 17:25:17 +0200 Subject: [PATCH 802/877] mt76: update to Git HEAD (2025-08-13) 3e25f2bc33af wifi: mt76: mt7925: introduce MLO capability control ce3622257026 wifi: mt76: mt7925: fix fails to enter low power mode in suspend state dfdb8e975718 wifi: mt76: mt7915: fix possible integer overflows in mt7915_muru_stats_show() 29f0ad5a439a wifi: mt76: mt7925: ensure wow pattern command align fw format 5eab65bb5473 wifi: mt76: mt7925: fix country count limitation for CLC d6a197dbc9a2 wifi: mt76: Add check for devm_kstrdup() 901492c4621a wifi: mt76: mt7925: Remove unnecessary if-check 24062ce4fa0f wifi: mt76: mt7925: Simplify HIF suspend handling to avoid suspend fail 56c0beddbed8 wifi: mt76: mt7921: fix kernel panic due to null pointer dereference 11bacfcce3b9 Revert "wifi: mt76: mt7925: Update mt7925_mcu_uni_[tx,rx]_ba for MLO" 2823c50b1c15 wifi: mt76: mt7925: fix the wrong link_idx when has p2p_device f54ff3cabab6 wifi: mt76: mt7925: fix the wrong simultaneous cap for MLO aa7d366ccf40 wifi: mt76: mt7925: adjust rm BSS flow to prevent next connection failure d25359e8bb83 wifi: mt76: mt7925: integrate *mlo_sta_cmd and *sta_cmd 25a0285d8ee3 wifi: mt76: mt7925: update the power-saving flow 5910f0806c05 wifi: mt76: mt7925: load the appropriate CLC data based on hardware type 454a69cbb718 wifi: mt76: mt7925: add EHT control support based on the CLC data bdc09b8f2321 wifi: mt76: mt7925: update the channel usage when the regd domain changed 772dcb4b4e61 wifi: mt76: mt7925: remove unused acpi function for clc b94b025490ef wifi: mt76: mt792x: extend MTCL of APCI to version3 for EHT control 9ff2afce5fef wifi: mt76: mt7925: add MTCL support to enhance the regulatory compliance f11807364258 wifi: mt76: add mt76_get_power_bound helper function ffd1cbfc485e wifi: mt76: mt7921: fix returned txpower 687e2fdfbf40 wifi: mt76: mt7925: fix returned txpower 43aaa62fbc55 wifi: mt76: mt7915: cleanup mt7915_get_power_bound a4be3fc9ed4b wifi: mt76: mt7996: cleanup mt7996_get_power_bound 0ba7a69f8927 wifi: mt76: move napi_enable() from under BH 1b370c689a2f wifi: mt76: mt7921: avoid undesired changes of the preset regulatory domain e931cecc45de mt76: mt792x: fix unused variable warning 539e7e711a15 Revert "wifi: mt76: mt7925: fix returned txpower" 67c724cc60b1 Revert "wifi: mt76: mt7921: fix returned txpower" 52f51a398e7e wifi: mt76: mt7996: Add change_vif_links stub b3b61abd733f wifi: mt76: mt7996: Introduce mt7996_sta_link container 915938e83c35 wifi: mt76: mt7996: Add mt7996_sta_link struct in mt7996_vif_link 3e06380a43a4 wifi: mt76: mt7996: Add vif_cfg_changed callback f419c62e9198 wifi: mt76: mt7996: Add link_info_changed callback 3082c9edbe35 wifi: mt76: mt7996: Add mt7996_sta_state routine 46e20e5d7455 wifi: mt76: mt7996: Rely on mt7996_sta_link in sta_add/sta_remove callbacks 1de180821525 wifi: mt76: mt7996: Add mt7996_mac_sta_change_links callback 2efb26f1fc10 wifi: mt76: mt7996: Support MLO in mt7996_mac_sta_event() 2e249744bc12 wifi: mt76: Check link_conf pointer in mt76_connac_mcu_sta_basic_tlv() 0eee20d3e388 wifi: mt76: mt7996: Update mt7996_mcu_add_sta to MLO support 200ce414fe61 wifi: mt76: mt7996: Rely on mt7996_vif_link in mt7996_mcu_twt_agrt_update signature d195324131ba wifi: mt76: mt7996: Rely on mt7996_vif/sta_link in twt teardown 7757e7c140f7 wifi: mac80211: call rate_control_rate_update() for link STA a3b651aeb551 wifi: mt76: mt7996: Update mt7996_mcu_add_rate_ctrl to MLO 2a005953dc49 wifi: mt76: mt7996: Add mt7996_mcu_sta_mld_setup_tlv() and mt7996_mcu_sta_eht_mld_tlv() 58e8b71782fc wifi: mt76: mt7996: Add mt7996_mcu_teardown_mld_sta rouine e0b422f2acaf wifi: mt76: mt7996: rework mt7996_mac_write_txwi() for MLO support 21aa0c288470 wifi: mt76: mt7996: Rely on wcid_to_sta in mt7996_mac_add_txs_skb() 87c437fa8b43 wifi: mt76: mt7996: rework mt7996_rx_get_wcid to support MLO 9b4de3ce7fc7 wifi: mt76: mt7996: rework mt7996_sta_set_4addr and mt7996_sta_set_decap_offload to support MLO a369b0c14d25 wifi: mt76: mt7996: Add mt7996_sta_link to mt7996_mcu_add_bss_info signature 9c6ec015afbb wifi: mt76: mt7996: rework mt7996_set_hw_key to support MLO 60967d28a5e0 wifi: mt76: mt7996: rework mt7996_sta_hw_queue_read to support MLO 3668d57795e3 wifi: mt76: mt7996: remove mt7996_mac_enable_rtscts() 275e6a681bac wifi: mt76: mt7996: rework mt7996_mac_sta_rc_work to support MLO 057822770ca5 wifi: mt76: mt7996: rework mt7996_mac_sta_poll to support MLO b9682a51c109 wifi: mt76: mt7996: rework mt7996_update_mu_group to support MLO d1a5a0afa6d6 wifi: mt76: mt7996: rework mt7996_net_fill_forward_path to support MLO 56529041b364 wifi: mt76: mt7996: rework mt7996_mcu_add_obss_spr to support MLO c788d5748dc8 wifi: mt76: mt7996: rework mt7996_mcu_beacon_inband_discov to support MLO 974e6c2df98b wifi: mt76: mt7996: set vif default link_id adding/removing vif links 70717b761af2 wifi: mt76: mt7996: rework set/get_tsf callabcks to support MLO d01b9d300eaa wifi: mt76: mt7996: rework mt7996_ampdu_action to support MLO d5cddf65f7a7 wifi: mt76: mt7996: Update mt7996_tx to MLO support a1ed21a66913 wifi: mt76: mt792x: re-register CHANCTX_STA_CSA only for the mt7921 series a826fc287483 wifi: mt76: mt7925: update MLO cleanup flow during disconnection 0994f0af632e wifi: mt76: mt7925: fix the incomplete revert of [tx,rx]_ba for MLO 5169d4e8669b wifi: mt76: mt76x2u: add TP-Link TL-WDN6200 ID to device table 46f3a10a9f0f mt76: mt7925: sync with upstream cleanups de635e1e3adc wifi: mt76: mt7996: fix locking in mt7996_mac_sta_rc_work() 63a4edf1cb74 wifi: mt76: mt7996: add macros for pci decive id a2dd2f7896f7 wifi: mt76: connac: add support to load firmware for mt7990 3908cf04aa39 wifi: mt76: mt7996: rework WA mcu command for mt7990 6243414a4e80 wifi: mt76: mt7996: rework DMA configuration for mt7990 a8def214d736 wifi: mt76: mt7996: rework register mapping for mt7990 51db7a2d57f6 wifi: mt76: mt7996: add eeprom support for mt7990 d0799f3303e9 wifi: mt76: mt7996: adjust HW capabilities for mt7990 10c3ea97a86d wifi: mt76: connac: rework TX descriptor and TX free for mt7990 bc588ac3d104 wifi: mt76: mt7996: rework background radar check for mt7990 f8c3dd3677dd wifi: mt76: mt7996: add PCI device id for mt7990 3cec186474c4 wifi: mt76: mt7915: set correct background radar capability 9bacdb2bf2c3 wifi: mt76: mt7915: rework radar HWRDD idx a19543c7e05e wifi: mt76: mt7996: rework radar HWRDD idx b0cf33e76a3a wifi: mt76: mt7925: Fix logical vs bitwise typo 0433adc883c9 wifi: mt76: mt7925: add EHT preamble puncturing be28ef77e330 wifi: mt76: mt7996: Add NULL check in mt7996_thermal_init 55218e636092 Revert "wifi: mt76: mt7996: fill txd by host driver" fdfe9eca6401 wifi: mt76: disable napi on driver removal d7a070e11de4 wifi: mt76: mt7925: fix missing hdr_trans_tlv command for broadcast wtbl 29363a669195 wifi: mt76: mt7996: prevent uninit return in mt7996_mac_sta_add_links e285cb42be03 wifi: mt76: Remove an unneeded local variable in mt76x02_dma_init() 3dee73c357cf wifi: mt76x2: Add support for LiteOn WN4516R,WN4519R 73f9582f92b6 wifi: mt76: mt7925: introduce thermal protection cf8522c5eea8 wifi: mt76: mt7925: fix host interrupt register initialization 8a24527e6c63 wifi: mt76: mt7921: add 160 MHz AP for mt7922 device d0ef73122e8b wifi: mt76: mt7996: avoid NULL pointer dereference in mt7996_set_monitor() 7fdbe4cb5c8d wifi: mt76: mt7996: avoid null deref in mt7996_stop_phy() 925d156dab3d wifi: mt76: mt7996: fix uninitialized symbol warning a403590fd464 Revert "wifi: mt76: Check link_conf pointer in mt76_connac_mcu_sta_basic_tlv()" ca76c1bcede4 wifi: mt76: mt7996: remove duplicate check in mt7996_mcu_sta_mld_setup_tlv() b70a4a619538 wifi: mt76: scan: Fix 'mlink' dereferenced before IS_ERR_OR_NULL check 2247afffc734 wifi: mt76: add mt76_connac_mcu_build_rnr_scan_param routine 460aa7da0ef6 wifi: mt76: mt7925: add RNR scan support for 6GHz a68584ddf98e wifi: mt76: mt7996: Fix null-ptr-deref in mt7996_mmio_wed_init() 025c1d19b55a wifi: mt76: mt7915: Fix null-ptr-deref in mt7915_mmio_wed_init() c20015bdc88b wifi: mt76: mt7925: prevent multiple scan commands 832387a1f876 wifi: mt76: mt7925: refine the sniffer commnad 7bf6a2914a54 wifi: mt76: mt7925: ensure all MCU commands wait for response 1bd4dbd48281 wifi: mt76: mt7925: extend MCU support for testmode 0ca6ed4e2724 wifi: mt76: mt7925: add test mode support a2838480f805 wifi: mt76: remove capability of partial bandwidth UL MU-MIMO 1865f5ea80ea wifi: mt76: mt7996: fix beamformee SS field 3bda39f1465e wifi: mt76: mt7996: set EHT max ampdu length capability 7d30840e5b21 wifi: mt76: mt7996: drop fragments with multicast or broadcast RA bf22595a1d8a wifi: mt76: mt7996: fix invalid NSS setting when TX path differs from NSS b9f01d7c368c wifi: mt76: mt7996: change max beacon size 8808d7c4eed7 wifi: mt76: mt7996: fix RX buffer size of MCU event 36e0b90e47ff wifi: mt76: fix available_antennas setting da2c23bec426 wifi: mt76: support power delta calculation for 5 TX paths 3e161d0cf3c7 wifi: mt76: mt7925: add rfkill_poll for hardware rfkill ee6dac9b6b76 wifi: mt76: mt7915: mcu: increase eeprom command timeout 0534761b76e1 wifi: mt76: mt7915: mcu: lower default timeout 79dd14f2e816 wifi: mt76: mt7915: mcu: re-init MCU before loading FW patch f2943046881d wifi: mt76: Assume __mt76_connac_mcu_alloc_sta_req runs in atomic context 656eb209ec42 wifi: mt76: Move RCU section in mt7996_mcu_set_fixed_field() 4f47d90943a3 wifi: mt76: Move RCU section in mt7996_mcu_add_rate_ctrl_fixed() 189532e383c1 wifi: mt76: Move RCU section in mt7996_mcu_add_rate_ctrl() 5603bd03d56a wifi: mt76: Remove RCU section in mt7996_mac_sta_rc_work() ca24f0794e94 wifi: mt76: mt7925: fix the wrong config for tx interrupt 63f18baa5bb6 wifi: mt76: mt7925: fix invalid array index in ssid assignment during hw scan 4bdc4c5f26e0 wifi: mt76: mt7925: fix incorrect scan probe IE handling for hw_scan 321ae47a7439 wifi: mt76: mt7925: fix off by one in mt7925_mcu_hw_scan() 3699df4e85ec wifi: mt76: mt7925: prevent NULL pointer dereference in mt7925_sta_set_decap_offload() a17fbd3d8598 wifi: mt76: mt7921: prevent decap offload config before STA initialization 6df761e0e6c7 mt76: fix signature of platform_driver remove funtions for newer kernels 5724be1a6b12 wifi: mt76: Replace strlcpy() with strscpy() c4a114e2b8c9 wifi: mt76: fix queue assignment for deauth packets 243e572d89fc wifi: mt76: add a wrapper for wcid access with validation e41c7785589f wifi: mac80211: get tx power per link d70f62b8f1c7 wifi: mt76: fix vif link allocation 7b3cd3274a24 wifi: mt76: mt7996: Fix secondary link lookup in mt7996_mcu_sta_mld_setup_tlv() cf89b6218043 wifi: mt76: mt7996: Rely on for_each_sta_active_link() in mt7996_mcu_sta_mld_setup_tlv() d71108eedab1 wifi: mt76: mt7996: Do not set wcid.sta to 1 in mt7996_mac_sta_event() 32f8c5849ed1 wifi: mt76: mt7996: Fix mlink lookup in mt7996_tx_prepare_skb ffff9f71e29d wifi: mt76: mt7996: Fix possible OOB access in mt7996_tx() afe63e758196 wifi: mt76: mt7996: Fix valid_links bitmask in mt7996_mac_sta_{add,remove} 68dd28b99dad wifi: mt76: mt7996: Add MLO support to mt7996_tx_check_aggr() 293778652452 wifi: mt76: mt7996: Move num_sta accounting in mt7996_mac_sta_{add,remove}_links a94166b21e20 wifi: mt76: Get rid of dma_sync_single_for_device() for MMIO devices 87873d854e51 wifi: mt76: mt7925: Fix null-ptr-deref in mt7925_thermal_init() 06ba3d5e91f4 wifi: mt76: mt792x: Limit the concurrent STA and SoftAP to operate on the same channel b9f4e0df317d wifi: mt76: mt792x: improve monitor interface handling ec95319fd3fb wifi: mt76: mt7921s: Introduce SDIO WiFi/BT combo module card reset dd2d862251cb firmware: add missing mt7990 eeprom files 05eaa56bc7a4 firmware: update mt7992 firmware to 20250328 32ca2b6db354 firmware: update mt7996 firmware to 20250328 00275548ba8f wifi: mt76: mt7996: Overwrite unspecified link_id in mt7996_tx() 2601bb91e078 wifi: mt76: mt7996: Fix mt7996_mcu_sta_ba wcid configuration 110ecc331123 wifi: mt76: mt7996: Fix mt7996_mcu_bss_mld_tlv routine 449a1aca9f72 wifi: mt76: mt7996: Initialize hdr before passing to skb_put_data() 1de707e73fc7 wifi: mt76: mt7921: don't disconnect when CSA to DFS chan fce683dbcfc9 wifi: mt76: mt7925: fix locking in mt7925_change_vif_links() 11f721bce235 wifi: mt76: mt7925: fix the wrong bss cleanup for SAP b3613d9a317d wifi: mt76: mt7996: Set def_wcid pointer in mt7996_mac_sta_init_link() d1a2900a390d wifi: mt76: mt7996: Set proper link destination address in mt7996_tx() 56990ce9289a wifi: mt76: mt7925u: Add VID/PID for Netgear A9000 e796542a0585 wifi: mt76: mt7925: add MBSSID support e35e4f8fcf8a wifi: mt76: fix potential memory leak in mt76_wmac_probe() aa2f13c3be79 wifi: mt76: mt7996: disable beacons when going offchannel 630e166c958d wifi: mt76: prevent non-offchannel mgmt tx during scan/roc d3e7c2051aae wifi: mt76: mt7996: use the correct vif link for scanning/roc 903a7e0ace79 wifi: mt76: mt7921: add MBSSID support Sync with commit 4010984db9e63369dce50dd5fd34e9ad31f6f32d Signed-off-by: Felix Fietkau --- package/kernel/mt76/Makefile | 6 +- .../kernel/mt76/patches/100-api_compat.patch | 84 +++++++++++++++++++ ..._mcu_increase_eeprom_command_timeout.patch | 29 ------- ...t76_mt7915_mcu_lower_default_timeout.patch | 29 ------- ...15_mcu_re-init_MCU_before_loading_FW.patch | 56 ------------- 5 files changed, 87 insertions(+), 117 deletions(-) create mode 100644 package/kernel/mt76/patches/100-api_compat.patch delete mode 100644 package/kernel/mt76/patches/200-wifi_mt76_mt7915_mcu_increase_eeprom_command_timeout.patch delete mode 100644 package/kernel/mt76/patches/201-wifi_mt76_mt7915_mcu_lower_default_timeout.patch delete mode 100644 package/kernel/mt76/patches/202-wifi_mt76_mt7915_mcu_re-init_MCU_before_loading_FW.patch diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index ca7fe6c159aa2a..026218e478f964 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:=2025-02-14 -PKG_SOURCE_VERSION:=e5fef138524e63314cb96ff8314048d175294e95 -PKG_MIRROR_HASH:=4d6ea8669b3034c97f5b341a5473facf4fe21262a2fde71257b57c4d1c86be5e +PKG_SOURCE_DATE:=2025-08-13 +PKG_SOURCE_VERSION:=903a7e0ace79dc9802b381fa05ecd2028122dd1b +PKG_MIRROR_HASH:=fcff7a90c8745091b8113e7833dc1f25e2767ff76da1f7adad27bde225c834df PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 diff --git a/package/kernel/mt76/patches/100-api_compat.patch b/package/kernel/mt76/patches/100-api_compat.patch new file mode 100644 index 00000000000000..3dd4e1f7994f68 --- /dev/null +++ b/package/kernel/mt76/patches/100-api_compat.patch @@ -0,0 +1,84 @@ +--- a/mt7915/main.c ++++ b/mt7915/main.c +@@ -1224,10 +1224,9 @@ static void mt7915_sta_rc_work(void *dat + + static void mt7915_sta_rc_update(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, +- struct ieee80211_link_sta *link_sta, ++ struct ieee80211_sta *sta, + u32 changed) + { +- struct ieee80211_sta *sta = link_sta->sta; + struct mt7915_phy *phy = mt7915_hw_phy(hw); + struct mt7915_dev *dev = phy->dev; + struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv; +@@ -1771,7 +1770,7 @@ const struct ieee80211_ops mt7915_ops = + .stop_ap = mt7915_stop_ap, + .sta_state = mt76_sta_state, + .sta_pre_rcu_remove = mt76_sta_pre_rcu_remove, +- .link_sta_rc_update = mt7915_sta_rc_update, ++ .sta_rc_update = mt7915_sta_rc_update, + .set_key = mt7915_set_key, + .ampdu_action = mt7915_ampdu_action, + .set_rts_threshold = mt7915_set_rts_threshold, +--- a/mt7996/main.c ++++ b/mt7996/main.c +@@ -715,8 +715,7 @@ static void mt7996_configure_filter(stru + } + + static int +-mt7996_get_txpower(struct ieee80211_hw *hw, struct ieee80211_vif *vif, +- unsigned int link_id, int *dbm) ++mt7996_get_txpower(struct ieee80211_hw *hw, struct ieee80211_vif *vif, int *dbm) + { + struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv; + struct mt7996_phy *phy = mt7996_vif_link_phy(&mvif->deflink); +@@ -1714,13 +1713,12 @@ out: + rcu_read_unlock(); + } + +-static void mt7996_link_sta_rc_update(struct ieee80211_hw *hw, +- struct ieee80211_vif *vif, +- struct ieee80211_link_sta *link_sta, +- u32 changed) ++static void mt7996_sta_rc_update(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif, ++ struct ieee80211_sta *sta, ++ u32 changed) + { + struct mt7996_dev *dev = mt7996_hw_dev(hw); +- struct ieee80211_sta *sta = link_sta->sta; + + mt7996_link_rate_ctrl_update(&changed, sta); + ieee80211_queue_work(hw, &dev->rc_work); +@@ -2213,7 +2211,7 @@ const struct ieee80211_ops mt7996_ops = + .link_info_changed = mt7996_link_info_changed, + .sta_state = mt7996_sta_state, + .sta_pre_rcu_remove = mt76_sta_pre_rcu_remove, +- .link_sta_rc_update = mt7996_link_sta_rc_update, ++ .sta_rc_update = mt7996_sta_rc_update, + .set_key = mt7996_set_key, + .ampdu_action = mt7996_ampdu_action, + .set_rts_threshold = mt7996_set_rts_threshold, +--- a/mac80211.c ++++ b/mac80211.c +@@ -1704,7 +1704,7 @@ s8 mt76_get_power_bound(struct mt76_phy + EXPORT_SYMBOL_GPL(mt76_get_power_bound); + + int mt76_get_txpower(struct ieee80211_hw *hw, struct ieee80211_vif *vif, +- unsigned int link_id, int *dbm) ++ int *dbm) + { + struct mt76_phy *phy = mt76_vif_phy(hw, vif); + int n_chains, delta; +--- a/mt76.h ++++ b/mt76.h +@@ -1520,7 +1520,7 @@ int mt76_get_min_avg_rssi(struct mt76_de + s8 mt76_get_power_bound(struct mt76_phy *phy, s8 txpower); + + int mt76_get_txpower(struct ieee80211_hw *hw, struct ieee80211_vif *vif, +- unsigned int link_id, int *dbm); ++ int *dbm); + int mt76_init_sar_power(struct ieee80211_hw *hw, + const struct cfg80211_sar_specs *sar); + int mt76_get_sar_power(struct mt76_phy *phy, diff --git a/package/kernel/mt76/patches/200-wifi_mt76_mt7915_mcu_increase_eeprom_command_timeout.patch b/package/kernel/mt76/patches/200-wifi_mt76_mt7915_mcu_increase_eeprom_command_timeout.patch deleted file mode 100644 index e618e536e6bb79..00000000000000 --- a/package/kernel/mt76/patches/200-wifi_mt76_mt7915_mcu_increase_eeprom_command_timeout.patch +++ /dev/null @@ -1,29 +0,0 @@ -From ee6dac9b6b765e8aab5727688463880c52f6193d Mon Sep 17 00:00:00 2001 -From: David Bauer -Date: Wed, 2 Apr 2025 02:45:26 +0200 -Subject: [PATCH] wifi: mt76: mt7915: mcu: increase eeprom command timeout - -Increase the timeout for MCU_EXT_CMD_EFUSE_BUFFER_MODE command. - -Regular retries upon hardware-recovery have been observed. Increasing -the timeout slightly remedies this problem. - -Signed-off-by: David Bauer -Link: https://patch.msgid.link/20250402004528.1036715-2-mail@david-bauer.net -Signed-off-by: Felix Fietkau ---- - mt7915/mcu.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/mt7915/mcu.c -+++ b/mt7915/mcu.c -@@ -208,6 +208,9 @@ mt7915_mcu_set_timeout(struct mt76_dev * - case MCU_EXT_CMD_BSS_INFO_UPDATE: - mdev->mcu.timeout = 2 * HZ; - return; -+ case MCU_EXT_CMD_EFUSE_BUFFER_MODE: -+ mdev->mcu.timeout = 10 * HZ; -+ return; - default: - break; - } diff --git a/package/kernel/mt76/patches/201-wifi_mt76_mt7915_mcu_lower_default_timeout.patch b/package/kernel/mt76/patches/201-wifi_mt76_mt7915_mcu_lower_default_timeout.patch deleted file mode 100644 index a624fcfa0a21eb..00000000000000 --- a/package/kernel/mt76/patches/201-wifi_mt76_mt7915_mcu_lower_default_timeout.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 0534761b76e1b2e3390b345e524ce959f3fa50fb Mon Sep 17 00:00:00 2001 -From: David Bauer -Date: Wed, 2 Apr 2025 02:45:25 +0200 -Subject: [PATCH] wifi: mt76: mt7915: mcu: lower default timeout - -The default timeout set in mt76_connac2_mcu_fill_message of 20 seconds -leads to excessive stalling in case messages are lost. - -Testing showed that a smaller timeout of 5 seconds is sufficient in -normal operation. - -Signed-off-by: David Bauer -Link: https://patch.msgid.link/20250402004528.1036715-1-mail@david-bauer.net -Signed-off-by: Felix Fietkau ---- - mt7915/mcu.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/mt7915/mcu.c -+++ b/mt7915/mcu.c -@@ -197,6 +197,8 @@ mt7915_mcu_parse_response(struct mt76_de - static void - mt7915_mcu_set_timeout(struct mt76_dev *mdev, int cmd) - { -+ mdev->mcu.timeout = 5 * HZ; -+ - if ((cmd & __MCU_CMD_FIELD_ID) != MCU_CMD_EXT_CID) - return; - diff --git a/package/kernel/mt76/patches/202-wifi_mt76_mt7915_mcu_re-init_MCU_before_loading_FW.patch b/package/kernel/mt76/patches/202-wifi_mt76_mt7915_mcu_re-init_MCU_before_loading_FW.patch deleted file mode 100644 index 76d005fc21c5d4..00000000000000 --- a/package/kernel/mt76/patches/202-wifi_mt76_mt7915_mcu_re-init_MCU_before_loading_FW.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 79dd14f2e8161b656341b6653261779199aedbe4 Mon Sep 17 00:00:00 2001 -From: David Bauer -Date: Wed, 2 Apr 2025 02:45:27 +0200 -Subject: [PATCH] wifi: mt76: mt7915: mcu: re-init MCU before loading FW patch - -Restart the MCU and release the patch semaphore before loading the MCU -patch firmware from the host. - -This fixes failures upon error recovery in case the semaphore was -previously taken and never released by the host. - -This happens from time to time upon triggering a full-chip error -recovery. Under this circumstance, the hardware restart fails and the -radio is rendered inoperational. - -Signed-off-by: David Bauer -Link: https://patch.msgid.link/20250402004528.1036715-3-mail@david-bauer.net -Signed-off-by: Felix Fietkau ---- - mt7915/mcu.c | 25 +++++++++++++++---------- - 1 file changed, 15 insertions(+), 10 deletions(-) - ---- a/mt7915/mcu.c -+++ b/mt7915/mcu.c -@@ -2097,16 +2097,21 @@ static int mt7915_load_firmware(struct m - { - int ret; - -- /* make sure fw is download state */ -- if (mt7915_firmware_state(dev, false)) { -- /* restart firmware once */ -- mt76_connac_mcu_restart(&dev->mt76); -- ret = mt7915_firmware_state(dev, false); -- if (ret) { -- dev_err(dev->mt76.dev, -- "Firmware is not ready for download\n"); -- return ret; -- } -+ /* Release Semaphore if taken by previous failed attempt */ -+ ret = mt76_connac_mcu_patch_sem_ctrl(&dev->mt76, false); -+ if (ret != PATCH_REL_SEM_SUCCESS) { -+ dev_err(dev->mt76.dev, "Could not release semaphore\n"); -+ /* Continue anyways */ -+ } -+ -+ /* Always restart MCU firmware */ -+ mt76_connac_mcu_restart(&dev->mt76); -+ -+ /* Check if MCU is ready */ -+ ret = mt7915_firmware_state(dev, false); -+ if (ret) { -+ dev_err(dev->mt76.dev, "Firmware did not enter download state\n"); -+ return ret; - } - - ret = mt76_connac2_load_patch(&dev->mt76, fw_name_var(dev, ROM_PATCH)); From 92d4f59709eac7422391187edbd85f2a14d5589b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Thu, 14 Aug 2025 13:40:09 +0300 Subject: [PATCH 803/877] kernel: fix Mediatek queue size patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This got added in commit 15887235, cherry-picked into the 24.10 branch as 642b5b61 and was partially lost in a manual patch refresh in 3a2a2c99. The main branch still contains the full set of rx DMA size changes, so I assume it was lost by accident. With rx.dma_size=2K, my TP-Link Archer MR600v2 (MT7621) randomly reboots due to OOM. Signed-off-by: Stefan Dösinger --- ...th_soc-reduce-rx-ring-size-for-older.patch | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/target/linux/generic/pending-6.6/738-01-net-ethernet-mtk_eth_soc-reduce-rx-ring-size-for-older.patch b/target/linux/generic/pending-6.6/738-01-net-ethernet-mtk_eth_soc-reduce-rx-ring-size-for-older.patch index 83f7efe6369bb1..7b49f0e2b74b17 100644 --- a/target/linux/generic/pending-6.6/738-01-net-ethernet-mtk_eth_soc-reduce-rx-ring-size-for-older.patch +++ b/target/linux/generic/pending-6.6/738-01-net-ethernet-mtk_eth_soc-reduce-rx-ring-size-for-older.patch @@ -30,6 +30,24 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -5401,7 +5401,7 @@ static const struct mtk_soc_data mt2701_ + .desc_size = sizeof(struct mtk_rx_dma), + .irq_done_mask = MTK_RX_DONE_INT, + .dma_l4_valid = RX_DMA_L4_VALID, +- .dma_size = MTK_DMA_SIZE(2K), ++ .dma_size = MTK_DMA_SIZE(512), + .dma_max_len = MTK_TX_DMA_BUF_LEN, + .dma_len_offset = 16, + }, +@@ -5429,7 +5429,7 @@ static const struct mtk_soc_data mt7621_ + .desc_size = sizeof(struct mtk_rx_dma), + .irq_done_mask = MTK_RX_DONE_INT, + .dma_l4_valid = RX_DMA_L4_VALID, +- .dma_size = MTK_DMA_SIZE(2K), ++ .dma_size = MTK_DMA_SIZE(512), + .dma_max_len = MTK_TX_DMA_BUF_LEN, + .dma_len_offset = 16, + }, @@ -5459,7 +5459,7 @@ static const struct mtk_soc_data mt7622_ .desc_size = sizeof(struct mtk_rx_dma), .irq_done_mask = MTK_RX_DONE_INT, @@ -57,3 +75,30 @@ Signed-off-by: Felix Fietkau .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, +@@ -5546,7 +5546,7 @@ static const struct mtk_soc_data mt7981_ + .dma_l4_valid = RX_DMA_L4_VALID_V2, + .dma_max_len = MTK_TX_DMA_BUF_LEN, + .dma_len_offset = 16, +- .dma_size = MTK_DMA_SIZE(2K), ++ .dma_size = MTK_DMA_SIZE(512), + }, + }; + +@@ -5576,7 +5576,7 @@ static const struct mtk_soc_data mt7986_ + .dma_l4_valid = RX_DMA_L4_VALID_V2, + .dma_max_len = MTK_TX_DMA_BUF_LEN, + .dma_len_offset = 16, +- .dma_size = MTK_DMA_SIZE(2K), ++ .dma_size = MTK_DMA_SIZE(1K), + }, + }; + +@@ -5629,7 +5629,7 @@ static const struct mtk_soc_data rt5350_ + .dma_l4_valid = RX_DMA_L4_VALID_PDMA, + .dma_max_len = MTK_TX_DMA_BUF_LEN, + .dma_len_offset = 16, +- .dma_size = MTK_DMA_SIZE(2K), ++ .dma_size = MTK_DMA_SIZE(256), + }, + }; + From 1fef2116ac9512bf03f8daaa47292f9fce786970 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Tue, 18 Feb 2025 20:35:00 +0100 Subject: [PATCH 804/877] airoha: drop MTD Airoha parser patch Drop Airoha MTD parser patch as a better solution was agreed with a fixed partition table. Tested-by: Aleksander Jan Bajkowski # tested on Quantum W1700k Link: https://github.com/openwrt/openwrt/pull/18112 Signed-off-by: Christian Marangi (cherry picked from commit 90dee1ab30809ee415a8f18965ec2193d438195c) --- ...parser-add-support-for-Airoha-parser.patch | 170 ------------------ 1 file changed, 170 deletions(-) delete mode 100644 target/linux/airoha/patches-6.6/902-mtd-parser-add-support-for-Airoha-parser.patch diff --git a/target/linux/airoha/patches-6.6/902-mtd-parser-add-support-for-Airoha-parser.patch b/target/linux/airoha/patches-6.6/902-mtd-parser-add-support-for-Airoha-parser.patch deleted file mode 100644 index 590d0d9faa26d4..00000000000000 --- a/target/linux/airoha/patches-6.6/902-mtd-parser-add-support-for-Airoha-parser.patch +++ /dev/null @@ -1,170 +0,0 @@ -From ca46c5834ba3a74595a93d7a491fa9c943be7c30 Mon Sep 17 00:00:00 2001 -From: Christian Marangi -Date: Sun, 28 Jul 2024 12:15:53 +0200 -Subject: [PATCH 3/3] mtd: parser: add support for Airoha parser - -Add support for Airoha parser based on a post parse ofpart function. - -Airoha partition table follow normal fixed-partition implementation -with a special implementation for the ART partition. This is always the -past partition and is placed from the end of the flash - the partition -size. - -To enable this special implementation for ART partition, the relevant -node require the "airoha,dynamic-art" compatible. With that declared, -offset value is ignored and real offset is updated with the calculated -value. - -Due to usage of specific bad block management driver, the MTD size might -vary hence the ART partition offset needs to be dynamically parsed and -can't be declared statically. - -Signed-off-by: Christian Marangi ---- - drivers/mtd/parsers/Kconfig | 10 ++++++ - drivers/mtd/parsers/Makefile | 1 + - drivers/mtd/parsers/ofpart_airoha.c | 56 +++++++++++++++++++++++++++++ - drivers/mtd/parsers/ofpart_airoha.h | 18 ++++++++++ - drivers/mtd/parsers/ofpart_core.c | 6 ++++ - 5 files changed, 91 insertions(+) - create mode 100644 drivers/mtd/parsers/ofpart_airoha.c - create mode 100644 drivers/mtd/parsers/ofpart_airoha.h - ---- a/drivers/mtd/parsers/Kconfig -+++ b/drivers/mtd/parsers/Kconfig -@@ -93,6 +93,16 @@ config MTD_OF_PARTS - flash memory node, as described in - Documentation/devicetree/bindings/mtd/mtd.yaml. - -+config MTD_OF_PARTS_AIROHA -+ bool "Airoha EN7815 partitioning support" -+ depends on MTD_OF_PARTS && (ARCH_AIROHA || COMPILE_TEST) -+ default ARCH_AIROHA -+ help -+ This provides partitions parser for Airoha EN7815 family devices -+ that can have dynamic "ART" partition at the end of the flash. -+ It takes care of finding the correct offset and update property -+ with it. -+ - config MTD_OF_PARTS_BCM4908 - bool "BCM4908 partitioning support" - depends on MTD_OF_PARTS && (ARCH_BCMBCA || COMPILE_TEST) ---- a/drivers/mtd/parsers/Makefile -+++ b/drivers/mtd/parsers/Makefile -@@ -7,6 +7,7 @@ obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdl - obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o - obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o - ofpart-y += ofpart_core.o -+ofpart-$(CONFIG_MTD_OF_PARTS_AIROHA) += ofpart_airoha.o - ofpart-$(CONFIG_MTD_OF_PARTS_BCM4908) += ofpart_bcm4908.o - ofpart-$(CONFIG_MTD_OF_PARTS_LINKSYS_NS)+= ofpart_linksys_ns.o - obj-$(CONFIG_MTD_PARSER_IMAGETAG) += parser_imagetag.o ---- /dev/null -+++ b/drivers/mtd/parsers/ofpart_airoha.c -@@ -0,0 +1,56 @@ -+// SPDX-License-Identifier: GPL-2.0 -+/* -+ * Copyright (C) 2024 Christian Marangi -+ */ -+ -+#include -+#include -+ -+#include "ofpart_airoha.h" -+ -+int airoha_partitions_post_parse(struct mtd_info *mtd, -+ struct mtd_partition *parts, -+ int nr_parts) -+{ -+ struct mtd_partition *part; -+ int len, a_cells, s_cells; -+ struct device_node *pp; -+ struct property *prop; -+ const __be32 *reg; -+ __be32 *new_reg; -+ -+ part = &parts[nr_parts - 1]; -+ pp = part->of_node; -+ -+ /* Skip if ART partition have a valid offset instead of a dynamic one */ -+ if (!of_device_is_compatible(pp, "airoha,dynamic-art")) -+ return 0; -+ -+ /* ART partition is set at the end of flash - size */ -+ part->offset = mtd->size - part->size; -+ -+ /* Update the offset with the new calculate value in DT */ -+ prop = kzalloc(sizeof(*prop), GFP_KERNEL); -+ if (!prop) -+ return -ENOMEM; -+ -+ /* Reg already validated by fixed-partition parser */ -+ reg = of_get_property(pp, "reg", &len); -+ -+ /* Fixed partition */ -+ a_cells = of_n_addr_cells(pp); -+ s_cells = of_n_size_cells(pp); -+ -+ prop->name = "reg"; -+ prop->length = (a_cells + s_cells) * sizeof(__be32); -+ prop->value = kmemdup(reg, (a_cells + s_cells) * sizeof(__be32), -+ GFP_KERNEL); -+ new_reg = prop->value; -+ memset(new_reg, 0, a_cells * sizeof(__be32)); -+ new_reg[a_cells - 1] = cpu_to_be32(part->offset); -+ if (a_cells > 1) -+ new_reg[0] = cpu_to_be32(part->offset >> 32); -+ of_update_property(pp, prop); -+ -+ return 0; -+} ---- /dev/null -+++ b/drivers/mtd/parsers/ofpart_airoha.h -@@ -0,0 +1,18 @@ -+/* SPDX-License-Identifier: GPL-2.0 */ -+#ifndef __OFPART_AIROHA_H -+#define __OFPART_AIROHA_H -+ -+#ifdef CONFIG_MTD_OF_PARTS_AIROHA -+int airoha_partitions_post_parse(struct mtd_info *mtd, -+ struct mtd_partition *parts, -+ int nr_parts); -+#else -+static inline int airoha_partitions_post_parse(struct mtd_info *mtd, -+ struct mtd_partition *parts, -+ int nr_parts) -+{ -+ return -EOPNOTSUPP; -+} -+#endif -+ -+#endif ---- a/drivers/mtd/parsers/ofpart_core.c -+++ b/drivers/mtd/parsers/ofpart_core.c -@@ -16,6 +16,7 @@ - #include - #include - -+#include "ofpart_airoha.h" - #include "ofpart_bcm4908.h" - #include "ofpart_linksys_ns.h" - -@@ -23,6 +24,10 @@ struct fixed_partitions_quirks { - int (*post_parse)(struct mtd_info *mtd, struct mtd_partition *parts, int nr_parts); - }; - -+static struct fixed_partitions_quirks airoha_partitions_quirks = { -+ .post_parse = airoha_partitions_post_parse, -+}; -+ - static struct fixed_partitions_quirks bcm4908_partitions_quirks = { - .post_parse = bcm4908_partitions_post_parse, - }; -@@ -192,6 +197,7 @@ static const struct of_device_id parse_o - /* Generic */ - { .compatible = "fixed-partitions" }, - /* Customized */ -+ { .compatible = "airoha,fixed-partitions", .data = &airoha_partitions_quirks, }, - { .compatible = "brcm,bcm4908-partitions", .data = &bcm4908_partitions_quirks, }, - { .compatible = "linksys,ns-partitions", .data = &linksys_ns_partitions_quirks, }, - {}, From 1c817247186bcce50e4cbf0c737fe113843214ae Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sat, 26 Apr 2025 16:48:12 -0700 Subject: [PATCH 805/877] airoha: pwm: use devm Removes the need for a remove function in platform_device. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/18660 Signed-off-by: Christian Marangi (cherry picked from commit aa4c96b9250c06d07cde145441e391453f87ccb2) --- ...8-pwm-airoha-Add-support-for-EN7581-SoC.patch | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/target/linux/airoha/patches-6.6/108-pwm-airoha-Add-support-for-EN7581-SoC.patch b/target/linux/airoha/patches-6.6/108-pwm-airoha-Add-support-for-EN7581-SoC.patch index 8f83c696c4f558..0b114d5f53b6fe 100644 --- a/target/linux/airoha/patches-6.6/108-pwm-airoha-Add-support-for-EN7581-SoC.patch +++ b/target/linux/airoha/patches-6.6/108-pwm-airoha-Add-support-for-EN7581-SoC.patch @@ -48,7 +48,7 @@ Signed-off-by: Lorenzo Bianconi obj-$(CONFIG_PWM_ATMEL_HLCDC_PWM) += pwm-atmel-hlcdc.o --- /dev/null +++ b/drivers/pwm/pwm-airoha.c -@@ -0,0 +1,400 @@ +@@ -0,0 +1,388 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright 2022 Markus Gothe @@ -414,18 +414,7 @@ Signed-off-by: Lorenzo Bianconi + if (IS_ERR(pc->regmap)) + return PTR_ERR(pc->regmap); + -+ platform_set_drvdata(pdev, pc); -+ -+ return pwmchip_add(&pc->chip); -+} -+ -+static int airoha_pwm_remove(struct platform_device *pdev) -+{ -+ struct airoha_pwm *pc = platform_get_drvdata(pdev); -+ -+ pwmchip_remove(&pc->chip); -+ -+ return 0; ++ return devm_pwmchip_add(&pdev->dev, &pc->chip); +} + +static const struct of_device_id airoha_pwm_of_match[] = { @@ -440,7 +429,6 @@ Signed-off-by: Lorenzo Bianconi + .of_match_table = airoha_pwm_of_match, + }, + .probe = airoha_pwm_probe, -+ .remove = airoha_pwm_remove, +}; +module_platform_driver(airoha_pwm_driver); + From 30bd948a1ce88bc6d5ad7aaf9b146677bb00ab4e Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Tue, 4 Mar 2025 22:59:45 +0100 Subject: [PATCH 806/877] airoha: replace PCIe patch with upstream version Replace PCIe patch with upstream version and update DTS with new PBUS CSR property now required. Tested-by: Aleksander Jan Bajkowski # tested on Quantum W1700k Tested-by: Andrew LaMarche Link: https://github.com/openwrt/openwrt/pull/18166 Signed-off-by: Christian Marangi (cherry picked from commit 921d4385640af05637e9459c805855077cbd33c0) --- target/linux/airoha/dts/an7581.dtsi | 6 +- ...-Rely-on-clk_bulk_prepare_enable-in.patch} | 1 - ...-Move-reset-assert-callbacks-in-.po.patch} | 3 - ...-Add-comment-about-initialization-o.patch} | 3 - ...-Move-reset-delay-in-mtk_pcie_en758.patch} | 3 - ...-Rely-on-msleep-in-mtk_pcie_en7581_.patch} | 3 - ...-Avoid-PCIe-resetting-via-PERST-for.patch} | 3 - ...3-Remove-leftover-mac_reset-assert-f.patch | 34 ++++++++ ...3-Configure-PBUS_CSR-registers-for-E.patch | 81 +++++++++++++++++++ ...3-Configure-PBUS_CSR-registers-for-E.patch | 81 ------------------- ...3-Remove-mac_reset-assert-leftover-f.patch | 26 ------ 11 files changed, 120 insertions(+), 124 deletions(-) rename target/linux/airoha/patches-6.6/{401-PCI-mediatek-gen3-Rely-on-clk_bulk_prepare_enable-in.patch => 042-01-v6.14-PCI-mediatek-gen3-Rely-on-clk_bulk_prepare_enable-in.patch} (95%) rename target/linux/airoha/patches-6.6/{402-PCI-mediatek-gen3-Move-reset-assert-callbacks-in-.po.patch => 042-02-v6.14-PCI-mediatek-gen3-Move-reset-assert-callbacks-in-.po.patch} (92%) rename target/linux/airoha/patches-6.6/{403-PCI-mediatek-gen3-Add-comment-about-initialization-o.patch => 042-03-v6.14-PCI-mediatek-gen3-Add-comment-about-initialization-o.patch} (84%) rename target/linux/airoha/patches-6.6/{404-PCI-mediatek-gen3-Move-reset-delay-in-mtk_pcie_en758.patch => 042-04-v6.14-PCI-mediatek-gen3-Move-reset-delay-in-mtk_pcie_en758.patch} (89%) rename target/linux/airoha/patches-6.6/{405-PCI-mediatek-gen3-Rely-on-msleep-in-mtk_pcie_en7581_.patch => 042-05-v6.14-PCI-mediatek-gen3-Rely-on-msleep-in-mtk_pcie_en7581_.patch} (85%) rename target/linux/airoha/patches-6.6/{406-PCI-mediatek-gen3-Avoid-PCIe-resetting-via-PERST-for.patch => 042-06-v6.14-PCI-mediatek-gen3-Avoid-PCIe-resetting-via-PERST-for.patch} (94%) create mode 100644 target/linux/airoha/patches-6.6/043-v6.15-PCI-mediatek-gen3-Remove-leftover-mac_reset-assert-f.patch create mode 100644 target/linux/airoha/patches-6.6/044-v6.15-PCI-mediatek-gen3-Configure-PBUS_CSR-registers-for-E.patch delete mode 100644 target/linux/airoha/patches-6.6/407-PCI-mediatek-gen3-Configure-PBUS_CSR-registers-for-E.patch delete mode 100644 target/linux/airoha/patches-6.6/408-PCI-mediatek-gen3-Remove-mac_reset-assert-leftover-f.patch diff --git a/target/linux/airoha/dts/an7581.dtsi b/target/linux/airoha/dts/an7581.dtsi index 762a6aa1a897c8..3b9f0c6d653fb9 100644 --- a/target/linux/airoha/dts/an7581.dtsi +++ b/target/linux/airoha/dts/an7581.dtsi @@ -433,7 +433,7 @@ reg = <0x0 0x1fa20000 0x0 0x388>; }; - syscon@1fbe3400 { + pbus_csr: syscon@1fbe3400 { compatible = "airoha,en7581-pbus-csr", "syscon"; reg = <0x0 0x1fbe3400 0x0 0xff>; }; @@ -603,6 +603,8 @@ <&scuclk EN7581_PCIE2_RST>; reset-names = "phy-lane0", "phy-lane1", "phy-lane2"; + mediatek,pbus-csr = <&pbus_csr 0x0 0x4>; + interrupts = ; bus-range = <0x00 0xff>; #interrupt-cells = <1>; @@ -644,6 +646,8 @@ <&scuclk EN7581_PCIE2_RST>; reset-names = "phy-lane0", "phy-lane1", "phy-lane2"; + mediatek,pbus-csr = <&pbus_csr 0x8 0xc>; + interrupts = ; bus-range = <0x00 0xff>; #interrupt-cells = <1>; diff --git a/target/linux/airoha/patches-6.6/401-PCI-mediatek-gen3-Rely-on-clk_bulk_prepare_enable-in.patch b/target/linux/airoha/patches-6.6/042-01-v6.14-PCI-mediatek-gen3-Rely-on-clk_bulk_prepare_enable-in.patch similarity index 95% rename from target/linux/airoha/patches-6.6/401-PCI-mediatek-gen3-Rely-on-clk_bulk_prepare_enable-in.patch rename to target/linux/airoha/patches-6.6/042-01-v6.14-PCI-mediatek-gen3-Rely-on-clk_bulk_prepare_enable-in.patch index e1ba4cbac2b27c..9e353f7926dc77 100644 --- a/target/linux/airoha/patches-6.6/401-PCI-mediatek-gen3-Rely-on-clk_bulk_prepare_enable-in.patch +++ b/target/linux/airoha/patches-6.6/042-01-v6.14-PCI-mediatek-gen3-Rely-on-clk_bulk_prepare_enable-in.patch @@ -1,5 +1,4 @@ From 0e7a622da17da0042294860cdb7a2fac091d25b1 Mon Sep 17 00:00:00 2001 -Message-ID: <0e7a622da17da0042294860cdb7a2fac091d25b1.1736960708.git.lorenzo@kernel.org> From: Lorenzo Bianconi Date: Wed, 8 Jan 2025 10:50:40 +0100 Subject: [PATCH 1/6] PCI: mediatek-gen3: Rely on clk_bulk_prepare_enable() in diff --git a/target/linux/airoha/patches-6.6/402-PCI-mediatek-gen3-Move-reset-assert-callbacks-in-.po.patch b/target/linux/airoha/patches-6.6/042-02-v6.14-PCI-mediatek-gen3-Move-reset-assert-callbacks-in-.po.patch similarity index 92% rename from target/linux/airoha/patches-6.6/402-PCI-mediatek-gen3-Move-reset-assert-callbacks-in-.po.patch rename to target/linux/airoha/patches-6.6/042-02-v6.14-PCI-mediatek-gen3-Move-reset-assert-callbacks-in-.po.patch index de2b20195c2546..ed5636d4fda56c 100644 --- a/target/linux/airoha/patches-6.6/402-PCI-mediatek-gen3-Move-reset-assert-callbacks-in-.po.patch +++ b/target/linux/airoha/patches-6.6/042-02-v6.14-PCI-mediatek-gen3-Move-reset-assert-callbacks-in-.po.patch @@ -1,7 +1,4 @@ From e4c7dfd953f7618f0ccb70d87c1629634f306fab Mon Sep 17 00:00:00 2001 -Message-ID: -In-Reply-To: <0e7a622da17da0042294860cdb7a2fac091d25b1.1736960708.git.lorenzo@kernel.org> -References: <0e7a622da17da0042294860cdb7a2fac091d25b1.1736960708.git.lorenzo@kernel.org> From: Lorenzo Bianconi Date: Wed, 8 Jan 2025 10:50:41 +0100 Subject: [PATCH 2/6] PCI: mediatek-gen3: Move reset/assert callbacks in diff --git a/target/linux/airoha/patches-6.6/403-PCI-mediatek-gen3-Add-comment-about-initialization-o.patch b/target/linux/airoha/patches-6.6/042-03-v6.14-PCI-mediatek-gen3-Add-comment-about-initialization-o.patch similarity index 84% rename from target/linux/airoha/patches-6.6/403-PCI-mediatek-gen3-Add-comment-about-initialization-o.patch rename to target/linux/airoha/patches-6.6/042-03-v6.14-PCI-mediatek-gen3-Add-comment-about-initialization-o.patch index c8165ced635fa4..785e5bd7617830 100644 --- a/target/linux/airoha/patches-6.6/403-PCI-mediatek-gen3-Add-comment-about-initialization-o.patch +++ b/target/linux/airoha/patches-6.6/042-03-v6.14-PCI-mediatek-gen3-Add-comment-about-initialization-o.patch @@ -1,7 +1,4 @@ From 0c9d2d2ef0d916b490a9222ed20ff4616fca876d Mon Sep 17 00:00:00 2001 -Message-ID: <0c9d2d2ef0d916b490a9222ed20ff4616fca876d.1736960708.git.lorenzo@kernel.org> -In-Reply-To: <0e7a622da17da0042294860cdb7a2fac091d25b1.1736960708.git.lorenzo@kernel.org> -References: <0e7a622da17da0042294860cdb7a2fac091d25b1.1736960708.git.lorenzo@kernel.org> From: Lorenzo Bianconi Date: Wed, 8 Jan 2025 10:50:42 +0100 Subject: [PATCH 3/6] PCI: mediatek-gen3: Add comment about initialization diff --git a/target/linux/airoha/patches-6.6/404-PCI-mediatek-gen3-Move-reset-delay-in-mtk_pcie_en758.patch b/target/linux/airoha/patches-6.6/042-04-v6.14-PCI-mediatek-gen3-Move-reset-delay-in-mtk_pcie_en758.patch similarity index 89% rename from target/linux/airoha/patches-6.6/404-PCI-mediatek-gen3-Move-reset-delay-in-mtk_pcie_en758.patch rename to target/linux/airoha/patches-6.6/042-04-v6.14-PCI-mediatek-gen3-Move-reset-delay-in-mtk_pcie_en758.patch index cf8e1f473b69c9..1e6d4cd0922ce1 100644 --- a/target/linux/airoha/patches-6.6/404-PCI-mediatek-gen3-Move-reset-delay-in-mtk_pcie_en758.patch +++ b/target/linux/airoha/patches-6.6/042-04-v6.14-PCI-mediatek-gen3-Move-reset-delay-in-mtk_pcie_en758.patch @@ -1,7 +1,4 @@ From 90d4e466c9ea2010f33880a36317a8486ccbe082 Mon Sep 17 00:00:00 2001 -Message-ID: <90d4e466c9ea2010f33880a36317a8486ccbe082.1736960708.git.lorenzo@kernel.org> -In-Reply-To: <0e7a622da17da0042294860cdb7a2fac091d25b1.1736960708.git.lorenzo@kernel.org> -References: <0e7a622da17da0042294860cdb7a2fac091d25b1.1736960708.git.lorenzo@kernel.org> From: Lorenzo Bianconi Date: Wed, 8 Jan 2025 10:50:43 +0100 Subject: [PATCH 4/6] PCI: mediatek-gen3: Move reset delay in diff --git a/target/linux/airoha/patches-6.6/405-PCI-mediatek-gen3-Rely-on-msleep-in-mtk_pcie_en7581_.patch b/target/linux/airoha/patches-6.6/042-05-v6.14-PCI-mediatek-gen3-Rely-on-msleep-in-mtk_pcie_en7581_.patch similarity index 85% rename from target/linux/airoha/patches-6.6/405-PCI-mediatek-gen3-Rely-on-msleep-in-mtk_pcie_en7581_.patch rename to target/linux/airoha/patches-6.6/042-05-v6.14-PCI-mediatek-gen3-Rely-on-msleep-in-mtk_pcie_en7581_.patch index cbd28e19f1ea1c..eb89411d5944bf 100644 --- a/target/linux/airoha/patches-6.6/405-PCI-mediatek-gen3-Rely-on-msleep-in-mtk_pcie_en7581_.patch +++ b/target/linux/airoha/patches-6.6/042-05-v6.14-PCI-mediatek-gen3-Rely-on-msleep-in-mtk_pcie_en7581_.patch @@ -1,7 +1,4 @@ From c98bee18d0a094e37100c85effe5e161418f8644 Mon Sep 17 00:00:00 2001 -Message-ID: -In-Reply-To: <0e7a622da17da0042294860cdb7a2fac091d25b1.1736960708.git.lorenzo@kernel.org> -References: <0e7a622da17da0042294860cdb7a2fac091d25b1.1736960708.git.lorenzo@kernel.org> From: Lorenzo Bianconi Date: Wed, 8 Jan 2025 10:50:44 +0100 Subject: [PATCH 5/6] PCI: mediatek-gen3: Rely on msleep() in diff --git a/target/linux/airoha/patches-6.6/406-PCI-mediatek-gen3-Avoid-PCIe-resetting-via-PERST-for.patch b/target/linux/airoha/patches-6.6/042-06-v6.14-PCI-mediatek-gen3-Avoid-PCIe-resetting-via-PERST-for.patch similarity index 94% rename from target/linux/airoha/patches-6.6/406-PCI-mediatek-gen3-Avoid-PCIe-resetting-via-PERST-for.patch rename to target/linux/airoha/patches-6.6/042-06-v6.14-PCI-mediatek-gen3-Avoid-PCIe-resetting-via-PERST-for.patch index cdc6e353aa2290..d18d6f6b5a8117 100644 --- a/target/linux/airoha/patches-6.6/406-PCI-mediatek-gen3-Avoid-PCIe-resetting-via-PERST-for.patch +++ b/target/linux/airoha/patches-6.6/042-06-v6.14-PCI-mediatek-gen3-Avoid-PCIe-resetting-via-PERST-for.patch @@ -1,7 +1,4 @@ From 491cb9c5084790aafa02e843349492c284373231 Mon Sep 17 00:00:00 2001 -Message-ID: <491cb9c5084790aafa02e843349492c284373231.1736960708.git.lorenzo@kernel.org> -In-Reply-To: <0e7a622da17da0042294860cdb7a2fac091d25b1.1736960708.git.lorenzo@kernel.org> -References: <0e7a622da17da0042294860cdb7a2fac091d25b1.1736960708.git.lorenzo@kernel.org> From: Lorenzo Bianconi Date: Thu, 9 Jan 2025 00:30:45 +0100 Subject: [PATCH 6/6] PCI: mediatek-gen3: Avoid PCIe resetting via PERST# for diff --git a/target/linux/airoha/patches-6.6/043-v6.15-PCI-mediatek-gen3-Remove-leftover-mac_reset-assert-f.patch b/target/linux/airoha/patches-6.6/043-v6.15-PCI-mediatek-gen3-Remove-leftover-mac_reset-assert-f.patch new file mode 100644 index 00000000000000..b4a69eb684f6ae --- /dev/null +++ b/target/linux/airoha/patches-6.6/043-v6.15-PCI-mediatek-gen3-Remove-leftover-mac_reset-assert-f.patch @@ -0,0 +1,34 @@ +From b6d7bb0d3bd74b491e2e6fd59c4d5110d06fd63b Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Sat, 1 Feb 2025 12:00:18 +0100 +Subject: [PATCH] PCI: mediatek-gen3: Remove leftover mac_reset assert for + Airoha EN7581 SoC +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Remove a leftover assert for mac_reset line in mtk_pcie_en7581_power_up(). + +This is not harmful since EN7581 does not requires mac_reset and +mac_reset is not defined in EN7581 device tree. + +Signed-off-by: Lorenzo Bianconi +Reviewed-by: Manivannan Sadhasivam +Reviewed-by: Philipp Zabel +Link: https://lore.kernel.org/r/20250201-pcie-en7581-remove-mac_reset-v2-1-a06786cdc683@kernel.org +[kwilczynski: commit log] +Signed-off-by: Krzysztof Wilczyński +--- + drivers/pci/controller/pcie-mediatek-gen3.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/pci/controller/pcie-mediatek-gen3.c ++++ b/drivers/pci/controller/pcie-mediatek-gen3.c +@@ -902,7 +902,6 @@ static int mtk_pcie_en7581_power_up(stru + */ + reset_control_bulk_assert(pcie->soc->phy_resets.num_resets, + pcie->phy_resets); +- reset_control_assert(pcie->mac_reset); + + /* Wait for the time needed to complete the reset lines assert. */ + msleep(PCIE_EN7581_RESET_TIME_MS); diff --git a/target/linux/airoha/patches-6.6/044-v6.15-PCI-mediatek-gen3-Configure-PBUS_CSR-registers-for-E.patch b/target/linux/airoha/patches-6.6/044-v6.15-PCI-mediatek-gen3-Configure-PBUS_CSR-registers-for-E.patch new file mode 100644 index 00000000000000..6470e03bb56b6e --- /dev/null +++ b/target/linux/airoha/patches-6.6/044-v6.15-PCI-mediatek-gen3-Configure-PBUS_CSR-registers-for-E.patch @@ -0,0 +1,81 @@ +From 249b78298078448a699c39356d27d8183af4b281 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Tue, 25 Feb 2025 09:04:07 +0100 +Subject: [PATCH] PCI: mediatek-gen3: Configure PBUS_CSR registers for EN7581 + SoC +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Configure PBus base address and address mask to allow the hw +to detect if a given address is accessible on PCIe controller. + +Fixes: f6ab898356dd ("PCI: mediatek-gen3: Add Airoha EN7581 support") +Reviewed-by: Manivannan Sadhasivam +Signed-off-by: Lorenzo Bianconi +Link: https://lore.kernel.org/r/20250225-en7581-pcie-pbus-csr-v4-2-24324382424a@kernel.org +Signed-off-by: Krzysztof Wilczyński +--- + drivers/pci/controller/pcie-mediatek-gen3.c | 28 ++++++++++++++++++++- + 1 file changed, 27 insertions(+), 1 deletion(-) + +--- a/drivers/pci/controller/pcie-mediatek-gen3.c ++++ b/drivers/pci/controller/pcie-mediatek-gen3.c +@@ -15,6 +15,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -24,6 +25,7 @@ + #include + #include + #include ++#include + #include + + #include "../pci.h" +@@ -892,9 +894,13 @@ static int mtk_pcie_parse_port(struct mt + + static int mtk_pcie_en7581_power_up(struct mtk_gen3_pcie *pcie) + { ++ struct pci_host_bridge *host = pci_host_bridge_from_priv(pcie); + struct device *dev = pcie->dev; ++ struct resource_entry *entry; ++ struct regmap *pbus_regmap; ++ u32 val, args[2], size; ++ resource_size_t addr; + int err; +- u32 val; + + /* + * The controller may have been left out of reset by the bootloader +@@ -907,6 +913,26 @@ static int mtk_pcie_en7581_power_up(stru + msleep(PCIE_EN7581_RESET_TIME_MS); + + /* ++ * Configure PBus base address and base address mask to allow the ++ * hw to detect if a given address is accessible on PCIe controller. ++ */ ++ pbus_regmap = syscon_regmap_lookup_by_phandle_args(dev->of_node, ++ "mediatek,pbus-csr", ++ ARRAY_SIZE(args), ++ args); ++ if (IS_ERR(pbus_regmap)) ++ return PTR_ERR(pbus_regmap); ++ ++ entry = resource_list_first_type(&host->windows, IORESOURCE_MEM); ++ if (!entry) ++ return -ENODEV; ++ ++ addr = entry->res->start - entry->offset; ++ regmap_write(pbus_regmap, args[0], lower_32_bits(addr)); ++ size = lower_32_bits(resource_size(entry->res)); ++ regmap_write(pbus_regmap, args[1], GENMASK(31, __fls(size))); ++ ++ /* + * Unlike the other MediaTek Gen3 controllers, the Airoha EN7581 + * requires PHY initialization and power-on before PHY reset deassert. + */ diff --git a/target/linux/airoha/patches-6.6/407-PCI-mediatek-gen3-Configure-PBUS_CSR-registers-for-E.patch b/target/linux/airoha/patches-6.6/407-PCI-mediatek-gen3-Configure-PBUS_CSR-registers-for-E.patch deleted file mode 100644 index 49b8752dcafecd..00000000000000 --- a/target/linux/airoha/patches-6.6/407-PCI-mediatek-gen3-Configure-PBUS_CSR-registers-for-E.patch +++ /dev/null @@ -1,81 +0,0 @@ -From ca4217f3117dceb2d01e179d02031a8758404624 Mon Sep 17 00:00:00 2001 -Message-ID: -From: Lorenzo Bianconi -Date: Tue, 3 Sep 2024 23:14:02 +0200 -Subject: [PATCH] PCI: mediatek-gen3: Configure PBUS_CSR registers for EN7581 - SoC - -Configure PBus base address and address mask in order to allow the hw -detecting if a given address is on PCIE0, PCIE1 or PCIE2. - -Signed-off-by: Lorenzo Bianconi ---- - drivers/pci/controller/pcie-mediatek-gen3.c | 29 ++++++++++++++++++++- - 1 file changed, 28 insertions(+), 1 deletion(-) - ---- a/drivers/pci/controller/pcie-mediatek-gen3.c -+++ b/drivers/pci/controller/pcie-mediatek-gen3.c -@@ -15,6 +15,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -24,6 +25,7 @@ - #include - #include - #include -+#include - #include - - #include "../pci.h" -@@ -122,6 +124,13 @@ - - #define PCIE_MTK_RESET_TIME_US 10 - -+#define PCIE_EN7581_PBUS_ADDR(_n) (0x00 + ((_n) << 3)) -+#define PCIE_EN7581_PBUS_ADDR_MASK(_n) (0x04 + ((_n) << 3)) -+#define PCIE_EN7581_PBUS_BASE_ADDR(_n) \ -+ ((_n) == 2 ? 0x28000000 : \ -+ (_n) == 1 ? 0x24000000 : 0x20000000) -+#define PCIE_EN7581_PBUS_BASE_ADDR_MASK GENMASK(31, 26) -+ - /* Time in ms needed to complete PCIe reset on EN7581 SoC */ - #define PCIE_EN7581_RESET_TIME_MS 100 - -@@ -893,7 +902,8 @@ static int mtk_pcie_parse_port(struct mt - static int mtk_pcie_en7581_power_up(struct mtk_gen3_pcie *pcie) - { - struct device *dev = pcie->dev; -- int err; -+ struct regmap *map; -+ int err, slot; - u32 val; - - /* -@@ -907,6 +917,23 @@ static int mtk_pcie_en7581_power_up(stru - /* Wait for the time needed to complete the reset lines assert. */ - msleep(PCIE_EN7581_RESET_TIME_MS); - -+ map = syscon_regmap_lookup_by_compatible("airoha,en7581-pbus-csr"); -+ if (IS_ERR(map)) -+ return PTR_ERR(map); -+ -+ /* -+ * Configure PBus base address and address mask in order to allow the -+ * hw detecting if a given address is on PCIE0, PCIE1 or PCIE2. -+ */ -+ slot = of_get_pci_domain_nr(dev->of_node); -+ if (slot < 0) -+ return slot; -+ -+ regmap_write(map, PCIE_EN7581_PBUS_ADDR(slot), -+ PCIE_EN7581_PBUS_BASE_ADDR(slot)); -+ regmap_write(map, PCIE_EN7581_PBUS_ADDR_MASK(slot), -+ PCIE_EN7581_PBUS_BASE_ADDR_MASK); -+ - /* - * Unlike the other MediaTek Gen3 controllers, the Airoha EN7581 - * requires PHY initialization and power-on before PHY reset deassert. diff --git a/target/linux/airoha/patches-6.6/408-PCI-mediatek-gen3-Remove-mac_reset-assert-leftover-f.patch b/target/linux/airoha/patches-6.6/408-PCI-mediatek-gen3-Remove-mac_reset-assert-leftover-f.patch deleted file mode 100644 index f1512a95cfbe24..00000000000000 --- a/target/linux/airoha/patches-6.6/408-PCI-mediatek-gen3-Remove-mac_reset-assert-leftover-f.patch +++ /dev/null @@ -1,26 +0,0 @@ -From c4defe43ce17a87e6341d126ba736d9f7ebdc541 Mon Sep 17 00:00:00 2001 -Message-ID: -From: Lorenzo Bianconi -Date: Wed, 15 Jan 2025 18:36:26 +0100 -Subject: [PATCH] PCI: mediatek-gen3: Remove mac_reset assert leftover for - Airoha EN7581 SoC. - -Remove a leftover assert for mac_reset line in mtk_pcie_en7581_power_up(). -This is not armful since EN7581 does not requires mac_reset and -mac_reset is not defined in EN7581 device tree. - -Signed-off-by: Lorenzo Bianconi ---- - drivers/pci/controller/pcie-mediatek-gen3.c | 1 - - 1 file changed, 1 deletion(-) - ---- a/drivers/pci/controller/pcie-mediatek-gen3.c -+++ b/drivers/pci/controller/pcie-mediatek-gen3.c -@@ -912,7 +912,6 @@ static int mtk_pcie_en7581_power_up(stru - */ - reset_control_bulk_assert(pcie->soc->phy_resets.num_resets, - pcie->phy_resets); -- reset_control_assert(pcie->mac_reset); - - /* Wait for the time needed to complete the reset lines assert. */ - msleep(PCIE_EN7581_RESET_TIME_MS); From 62cee22812b0de9fc0517eb83362c14a798f5fa2 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Tue, 4 Mar 2025 23:53:39 +0100 Subject: [PATCH 807/877] airoha: backport minor fixes for ethernet driver Backport some upstream patch for Airoha ethernet driver in preparation for Flow Offload support. Tested-by: Aleksander Jan Bajkowski # tested on Quantum W1700k Tested-by: Andrew LaMarche Link: https://github.com/openwrt/openwrt/pull/18166 Signed-off-by: Christian Marangi (cherry picked from commit afea8bda0d9fc34032d7da04806c7f6caf971369) --- ...a-Fix-wrong-GDM4-register-definition.patch | 46 +++++++++++++ ...x-TSO-support-for-header-cloned-skbs.patch | 65 +++++++++++++++++++ ...oha-Reset-BQL-stopping-the-netdevice.patch | 47 ++++++++++++++ 3 files changed, 158 insertions(+) create mode 100644 target/linux/airoha/patches-6.6/045-v6.14-net-airoha-Fix-wrong-GDM4-register-definition.patch create mode 100644 target/linux/airoha/patches-6.6/046-v6.15-net-airoha-Fix-TSO-support-for-header-cloned-skbs.patch create mode 100644 target/linux/airoha/patches-6.6/047-v6.13-net-airoha-Reset-BQL-stopping-the-netdevice.patch diff --git a/target/linux/airoha/patches-6.6/045-v6.14-net-airoha-Fix-wrong-GDM4-register-definition.patch b/target/linux/airoha/patches-6.6/045-v6.14-net-airoha-Fix-wrong-GDM4-register-definition.patch new file mode 100644 index 00000000000000..e14dd3e6d5fcc3 --- /dev/null +++ b/target/linux/airoha/patches-6.6/045-v6.14-net-airoha-Fix-wrong-GDM4-register-definition.patch @@ -0,0 +1,46 @@ +From d31a49d37cb132b31cc6683eef2122f8609d6229 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Mon, 20 Jan 2025 16:41:40 +0100 +Subject: [PATCH] net: airoha: Fix wrong GDM4 register definition + +Fix wrong GDM4 register definition, in Airoha SDK GDM4 is defined at +offset 0x2400 but this doesn't make sense as it does conflict with the +CDM4 that is in the same location. + +Following the pattern where each GDM base is at the FWD_CFG, currently +GDM4 base offset is set to 0x2500. This is correct but REG_GDM4_FWD_CFG +and REG_GDM4_SRC_PORT_SET are still using the SDK reference with the +0x2400 offset. Fix these 2 define by subtracting 0x100 to each register +to reflect the real address location. + +Fixes: 23020f049327 ("net: airoha: Introduce ethernet support for EN7581 SoC") +Signed-off-by: Christian Marangi +Acked-by: Lorenzo Bianconi +Reviewed-by: Jacob Keller +Link: https://patch.msgid.link/20250120154148.13424-1-ansuelsmth@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/mediatek/airoha_eth.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/mediatek/airoha_eth.c b/drivers/net/ethernet/mediatek/airoha_eth.c +index 415d784de741..09f448f29124 100644 +--- a/drivers/net/ethernet/mediatek/airoha_eth.c ++++ b/drivers/net/ethernet/mediatek/airoha_eth.c +@@ -266,11 +266,11 @@ + #define REG_GDM3_FWD_CFG GDM3_BASE + #define GDM3_PAD_EN_MASK BIT(28) + +-#define REG_GDM4_FWD_CFG (GDM4_BASE + 0x100) ++#define REG_GDM4_FWD_CFG GDM4_BASE + #define GDM4_PAD_EN_MASK BIT(28) + #define GDM4_SPORT_OFFSET0_MASK GENMASK(11, 8) + +-#define REG_GDM4_SRC_PORT_SET (GDM4_BASE + 0x33c) ++#define REG_GDM4_SRC_PORT_SET (GDM4_BASE + 0x23c) + #define GDM4_SPORT_OFF2_MASK GENMASK(19, 16) + #define GDM4_SPORT_OFF1_MASK GENMASK(15, 12) + #define GDM4_SPORT_OFF0_MASK GENMASK(11, 8) +-- +2.48.1 + diff --git a/target/linux/airoha/patches-6.6/046-v6.15-net-airoha-Fix-TSO-support-for-header-cloned-skbs.patch b/target/linux/airoha/patches-6.6/046-v6.15-net-airoha-Fix-TSO-support-for-header-cloned-skbs.patch new file mode 100644 index 00000000000000..b381612c39c3d9 --- /dev/null +++ b/target/linux/airoha/patches-6.6/046-v6.15-net-airoha-Fix-TSO-support-for-header-cloned-skbs.patch @@ -0,0 +1,65 @@ +From c6287e1a858e336cc202b484c6138a0fe252c6b3 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Thu, 13 Feb 2025 16:34:20 +0100 +Subject: [PATCH] net: airoha: Fix TSO support for header cloned skbs + +For GSO packets, skb_cow_head() will reallocate the skb for TSO header +cloned skbs in airoha_dev_xmit(). For this reason, sinfo pointer can be +no more valid. Fix the issue relying on skb_shinfo() macro directly in +airoha_dev_xmit(). + +The problem exists since +commit 23020f049327 ("net: airoha: Introduce ethernet support for EN7581 SoC") +but it is not a user visible, since we can't currently enable TSO +for DSA user ports since we are missing to initialize net_device +vlan_features field. + +Reviewed-by: Mateusz Polchlopek +Signed-off-by: Lorenzo Bianconi +Link: https://patch.msgid.link/20250213-airoha-en7581-flowtable-offload-v4-1-b69ca16d74db@kernel.org +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/mediatek/airoha_eth.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/ethernet/mediatek/airoha_eth.c b/drivers/net/ethernet/mediatek/airoha_eth.c +index 09f448f29124..aa5f220ddbcf 100644 +--- a/drivers/net/ethernet/mediatek/airoha_eth.c ++++ b/drivers/net/ethernet/mediatek/airoha_eth.c +@@ -2556,11 +2556,10 @@ static u16 airoha_dev_select_queue(struct net_device *dev, struct sk_buff *skb, + static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb, + struct net_device *dev) + { +- struct skb_shared_info *sinfo = skb_shinfo(skb); + struct airoha_gdm_port *port = netdev_priv(dev); ++ u32 nr_frags = 1 + skb_shinfo(skb)->nr_frags; + u32 msg0, msg1, len = skb_headlen(skb); + struct airoha_qdma *qdma = port->qdma; +- u32 nr_frags = 1 + sinfo->nr_frags; + struct netdev_queue *txq; + struct airoha_queue *q; + void *data = skb->data; +@@ -2583,8 +2582,9 @@ static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb, + if (skb_cow_head(skb, 0)) + goto error; + +- if (sinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)) { +- __be16 csum = cpu_to_be16(sinfo->gso_size); ++ if (skb_shinfo(skb)->gso_type & (SKB_GSO_TCPV4 | ++ SKB_GSO_TCPV6)) { ++ __be16 csum = cpu_to_be16(skb_shinfo(skb)->gso_size); + + tcp_hdr(skb)->check = (__force __sum16)csum; + msg0 |= FIELD_PREP(QDMA_ETH_TXMSG_TSO_MASK, 1); +@@ -2613,7 +2613,7 @@ static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb, + for (i = 0; i < nr_frags; i++) { + struct airoha_qdma_desc *desc = &q->desc[index]; + struct airoha_queue_entry *e = &q->entry[index]; +- skb_frag_t *frag = &sinfo->frags[i]; ++ skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; + dma_addr_t addr; + u32 val; + +-- +2.48.1 + diff --git a/target/linux/airoha/patches-6.6/047-v6.13-net-airoha-Reset-BQL-stopping-the-netdevice.patch b/target/linux/airoha/patches-6.6/047-v6.13-net-airoha-Reset-BQL-stopping-the-netdevice.patch new file mode 100644 index 00000000000000..4a53e64aa30f6f --- /dev/null +++ b/target/linux/airoha/patches-6.6/047-v6.13-net-airoha-Reset-BQL-stopping-the-netdevice.patch @@ -0,0 +1,47 @@ +From c9f947769b77c8e8f318bfc8a0777e5d20c44d8d Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Thu, 17 Oct 2024 16:01:41 +0200 +Subject: [PATCH] net: airoha: Reset BQL stopping the netdevice + +Run airoha_qdma_cleanup_tx_queue() in ndo_stop callback in order to +unmap pending skbs. Moreover, reset BQL txq state stopping the netdevice, + +Signed-off-by: Lorenzo Bianconi +Reviewed-by: Hariprasad Kelam +Message-ID: <20241017-airoha-en7581-reset-bql-v1-1-08c0c9888de5@kernel.org> +Signed-off-by: Andrew Lunn +--- + drivers/net/ethernet/mediatek/airoha_eth.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/mediatek/airoha_eth.c b/drivers/net/ethernet/mediatek/airoha_eth.c +index 21d6eed8aece..f463a505f5ba 100644 +--- a/drivers/net/ethernet/mediatek/airoha_eth.c ++++ b/drivers/net/ethernet/mediatek/airoha_eth.c +@@ -2342,7 +2342,7 @@ static int airoha_dev_stop(struct net_device *dev) + { + struct airoha_gdm_port *port = netdev_priv(dev); + struct airoha_qdma *qdma = port->qdma; +- int err; ++ int i, err; + + netif_tx_disable(dev); + err = airoha_set_gdm_ports(qdma->eth, false); +@@ -2353,6 +2353,14 @@ static int airoha_dev_stop(struct net_device *dev) + GLOBAL_CFG_TX_DMA_EN_MASK | + GLOBAL_CFG_RX_DMA_EN_MASK); + ++ for (i = 0; i < ARRAY_SIZE(qdma->q_tx); i++) { ++ if (!qdma->q_tx[i].ndesc) ++ continue; ++ ++ airoha_qdma_cleanup_tx_queue(&qdma->q_tx[i]); ++ netdev_tx_reset_subqueue(dev, i); ++ } ++ + return 0; + } + +-- +2.48.1 + From d12f30f76006c2fc24164853acf0bc2ecf47a566 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Tue, 4 Mar 2025 23:54:31 +0100 Subject: [PATCH 808/877] airoha: backport upstream patch for Flow Offload support for AN7581 Backpot upstream patch for Flow Offload support for AN7581 and refresh all affected patch. To correctly work a dedicated firmware is needed to use the dedicated Network Coprocessor (NPU). This also introduce good cleanup and moves the driver in a dedicated Airoha directory. While currently not totally usable (due to lack of firmware blob) this is needed to backport support for external PHY/SFP support. Refresh all affected patch. Tested-by: Aleksander Jan Bajkowski # tested on Quantum W1700k Tested-by: Andrew LaMarche Link: https://github.com/openwrt/openwrt/pull/18166 (cherry picked from commit ad2077165b337d2fe1b60a1a6d306ad355961952) [ refresh patches ] Signed-off-by: Christian Marangi --- target/linux/airoha/an7581/config-6.6 | 3 +- ...a-Fix-wrong-GDM4-register-definition.patch | 5 - ...x-TSO-support-for-header-cloned-skbs.patch | 11 +- ...oha-Reset-BQL-stopping-the-netdevice.patch | 9 +- ...airoha_eth-driver-in-a-dedicated-fol.patch | 6825 +++++++++++++++++ ...oha-Move-definitions-in-airoha_eth.h.patch | 538 ++ ...reg-write-utility-routines-in-airoha.patch | 101 + ...register-definitions-in-airoha_regs..patch | 1361 ++++ ...iroha-Move-DSA-tag-in-DMA-descriptor.patch | 287 + ...t7530-Enable-Rx-sptag-for-EN7581-SoC.patch | 46 + ...ble-support-for-multiple-net_devices.patch | 144 + ...REG_GDM_FWD_CFG-initialization-in-ai.patch | 77 + ...e-airoha_set_gdm_port_fwd_cfg-in-air.patch | 120 + ...-airoha-Introduce-Airoha-NPU-support.patch | 627 ++ ...-Introduce-flowtable-offload-support.patch | 1481 ++++ ...airoha-Add-loopback-support-for-GDM2.patch | 210 + ...airoha-Introduce-PPE-debugfs-support.patch | 291 + ...-channel-configuration-for-ETS-Qdisc.patch | 6 +- 18 files changed, 12118 insertions(+), 24 deletions(-) create mode 100644 target/linux/airoha/patches-6.6/048-01-v6.15-net-airoha-Move-airoha_eth-driver-in-a-dedicated-fol.patch create mode 100644 target/linux/airoha/patches-6.6/048-02-v6.15-net-airoha-Move-definitions-in-airoha_eth.h.patch create mode 100644 target/linux/airoha/patches-6.6/048-03-v6.15-net-airoha-Move-reg-write-utility-routines-in-airoha.patch create mode 100644 target/linux/airoha/patches-6.6/048-04-v6.15-net-airoha-Move-register-definitions-in-airoha_regs..patch create mode 100644 target/linux/airoha/patches-6.6/048-05-v6.15-net-airoha-Move-DSA-tag-in-DMA-descriptor.patch create mode 100644 target/linux/airoha/patches-6.6/048-06-v6.15-net-dsa-mt7530-Enable-Rx-sptag-for-EN7581-SoC.patch create mode 100644 target/linux/airoha/patches-6.6/048-07-v6.15-net-airoha-Enable-support-for-multiple-net_devices.patch create mode 100644 target/linux/airoha/patches-6.6/048-08-v6.15-net-airoha-Move-REG_GDM_FWD_CFG-initialization-in-ai.patch create mode 100644 target/linux/airoha/patches-6.6/048-09-v6.15-net-airoha-Rename-airoha_set_gdm_port_fwd_cfg-in-air.patch create mode 100644 target/linux/airoha/patches-6.6/048-12-v6.15-net-airoha-Introduce-Airoha-NPU-support.patch create mode 100644 target/linux/airoha/patches-6.6/048-13-v6.15-net-airoha-Introduce-flowtable-offload-support.patch create mode 100644 target/linux/airoha/patches-6.6/048-14-v6.15-net-airoha-Add-loopback-support-for-GDM2.patch create mode 100644 target/linux/airoha/patches-6.6/048-15-v6.15-net-airoha-Introduce-PPE-debugfs-support.patch diff --git a/target/linux/airoha/an7581/config-6.6 b/target/linux/airoha/an7581/config-6.6 index 812dcd76bba083..44f86a3b39433f 100644 --- a/target/linux/airoha/an7581/config-6.6 +++ b/target/linux/airoha/an7581/config-6.6 @@ -403,7 +403,8 @@ CONFIG_NET_NS=y CONFIG_NET_SELFTESTS=y CONFIG_NET_SWITCHDEV=y # CONFIG_NET_VENDOR_3COM is not set -CONFIG_NET_VENDOR_MEDIATEK=y +CONFIG_NET_VENDOR_AIROHA=y +# CONFIG_NET_VENDOR_MEDIATEK is not set CONFIG_NLS=y CONFIG_NLS_DEFAULT="utf8" CONFIG_NO_HZ_COMMON=y diff --git a/target/linux/airoha/patches-6.6/045-v6.14-net-airoha-Fix-wrong-GDM4-register-definition.patch b/target/linux/airoha/patches-6.6/045-v6.14-net-airoha-Fix-wrong-GDM4-register-definition.patch index e14dd3e6d5fcc3..f17242a6c5c7fd 100644 --- a/target/linux/airoha/patches-6.6/045-v6.14-net-airoha-Fix-wrong-GDM4-register-definition.patch +++ b/target/linux/airoha/patches-6.6/045-v6.14-net-airoha-Fix-wrong-GDM4-register-definition.patch @@ -23,8 +23,6 @@ Signed-off-by: Jakub Kicinski drivers/net/ethernet/mediatek/airoha_eth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -diff --git a/drivers/net/ethernet/mediatek/airoha_eth.c b/drivers/net/ethernet/mediatek/airoha_eth.c -index 415d784de741..09f448f29124 100644 --- a/drivers/net/ethernet/mediatek/airoha_eth.c +++ b/drivers/net/ethernet/mediatek/airoha_eth.c @@ -266,11 +266,11 @@ @@ -41,6 +39,3 @@ index 415d784de741..09f448f29124 100644 #define GDM4_SPORT_OFF2_MASK GENMASK(19, 16) #define GDM4_SPORT_OFF1_MASK GENMASK(15, 12) #define GDM4_SPORT_OFF0_MASK GENMASK(11, 8) --- -2.48.1 - diff --git a/target/linux/airoha/patches-6.6/046-v6.15-net-airoha-Fix-TSO-support-for-header-cloned-skbs.patch b/target/linux/airoha/patches-6.6/046-v6.15-net-airoha-Fix-TSO-support-for-header-cloned-skbs.patch index b381612c39c3d9..9c2443ce698603 100644 --- a/target/linux/airoha/patches-6.6/046-v6.15-net-airoha-Fix-TSO-support-for-header-cloned-skbs.patch +++ b/target/linux/airoha/patches-6.6/046-v6.15-net-airoha-Fix-TSO-support-for-header-cloned-skbs.patch @@ -22,11 +22,9 @@ Signed-off-by: Jakub Kicinski drivers/net/ethernet/mediatek/airoha_eth.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) -diff --git a/drivers/net/ethernet/mediatek/airoha_eth.c b/drivers/net/ethernet/mediatek/airoha_eth.c -index 09f448f29124..aa5f220ddbcf 100644 --- a/drivers/net/ethernet/mediatek/airoha_eth.c +++ b/drivers/net/ethernet/mediatek/airoha_eth.c -@@ -2556,11 +2556,10 @@ static u16 airoha_dev_select_queue(struct net_device *dev, struct sk_buff *skb, +@@ -2549,11 +2549,10 @@ static u16 airoha_dev_select_queue(struc static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb, struct net_device *dev) { @@ -39,7 +37,7 @@ index 09f448f29124..aa5f220ddbcf 100644 struct netdev_queue *txq; struct airoha_queue *q; void *data = skb->data; -@@ -2583,8 +2582,9 @@ static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb, +@@ -2576,8 +2575,9 @@ static netdev_tx_t airoha_dev_xmit(struc if (skb_cow_head(skb, 0)) goto error; @@ -51,7 +49,7 @@ index 09f448f29124..aa5f220ddbcf 100644 tcp_hdr(skb)->check = (__force __sum16)csum; msg0 |= FIELD_PREP(QDMA_ETH_TXMSG_TSO_MASK, 1); -@@ -2613,7 +2613,7 @@ static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb, +@@ -2606,7 +2606,7 @@ static netdev_tx_t airoha_dev_xmit(struc for (i = 0; i < nr_frags; i++) { struct airoha_qdma_desc *desc = &q->desc[index]; struct airoha_queue_entry *e = &q->entry[index]; @@ -60,6 +58,3 @@ index 09f448f29124..aa5f220ddbcf 100644 dma_addr_t addr; u32 val; --- -2.48.1 - diff --git a/target/linux/airoha/patches-6.6/047-v6.13-net-airoha-Reset-BQL-stopping-the-netdevice.patch b/target/linux/airoha/patches-6.6/047-v6.13-net-airoha-Reset-BQL-stopping-the-netdevice.patch index 4a53e64aa30f6f..f20e2034c22c97 100644 --- a/target/linux/airoha/patches-6.6/047-v6.13-net-airoha-Reset-BQL-stopping-the-netdevice.patch +++ b/target/linux/airoha/patches-6.6/047-v6.13-net-airoha-Reset-BQL-stopping-the-netdevice.patch @@ -14,11 +14,9 @@ Signed-off-by: Andrew Lunn drivers/net/ethernet/mediatek/airoha_eth.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) -diff --git a/drivers/net/ethernet/mediatek/airoha_eth.c b/drivers/net/ethernet/mediatek/airoha_eth.c -index 21d6eed8aece..f463a505f5ba 100644 --- a/drivers/net/ethernet/mediatek/airoha_eth.c +++ b/drivers/net/ethernet/mediatek/airoha_eth.c -@@ -2342,7 +2342,7 @@ static int airoha_dev_stop(struct net_device *dev) +@@ -2469,7 +2469,7 @@ static int airoha_dev_stop(struct net_de { struct airoha_gdm_port *port = netdev_priv(dev); struct airoha_qdma *qdma = port->qdma; @@ -27,7 +25,7 @@ index 21d6eed8aece..f463a505f5ba 100644 netif_tx_disable(dev); err = airoha_set_gdm_ports(qdma->eth, false); -@@ -2353,6 +2353,14 @@ static int airoha_dev_stop(struct net_device *dev) +@@ -2480,6 +2480,14 @@ static int airoha_dev_stop(struct net_de GLOBAL_CFG_TX_DMA_EN_MASK | GLOBAL_CFG_RX_DMA_EN_MASK); @@ -42,6 +40,3 @@ index 21d6eed8aece..f463a505f5ba 100644 return 0; } --- -2.48.1 - diff --git a/target/linux/airoha/patches-6.6/048-01-v6.15-net-airoha-Move-airoha_eth-driver-in-a-dedicated-fol.patch b/target/linux/airoha/patches-6.6/048-01-v6.15-net-airoha-Move-airoha_eth-driver-in-a-dedicated-fol.patch new file mode 100644 index 00000000000000..255bbd2ed9d837 --- /dev/null +++ b/target/linux/airoha/patches-6.6/048-01-v6.15-net-airoha-Move-airoha_eth-driver-in-a-dedicated-fol.patch @@ -0,0 +1,6825 @@ +From fb3dda82fd38ca42140f29b3082324dcdc128293 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Fri, 28 Feb 2025 11:54:09 +0100 +Subject: [PATCH 01/15] net: airoha: Move airoha_eth driver in a dedicated + folder + +The airoha_eth driver has no codebase shared with mtk_eth_soc one. +Moreover, the upcoming features (flowtable hw offloading, PCS, ..) will +not reuse any code from MediaTek driver. Move the Airoha driver in a +dedicated folder. + +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Paolo Abeni +--- + drivers/net/ethernet/Kconfig | 2 ++ + drivers/net/ethernet/Makefile | 1 + + drivers/net/ethernet/airoha/Kconfig | 18 ++++++++++++++++++ + drivers/net/ethernet/airoha/Makefile | 6 ++++++ + .../ethernet/{mediatek => airoha}/airoha_eth.c | 0 + drivers/net/ethernet/mediatek/Kconfig | 8 -------- + drivers/net/ethernet/mediatek/Makefile | 1 - + 7 files changed, 27 insertions(+), 9 deletions(-) + create mode 100644 drivers/net/ethernet/airoha/Kconfig + create mode 100644 drivers/net/ethernet/airoha/Makefile + rename drivers/net/ethernet/{mediatek => airoha}/airoha_eth.c (100%) + +--- a/drivers/net/ethernet/Kconfig ++++ b/drivers/net/ethernet/Kconfig +@@ -23,6 +23,8 @@ source "drivers/net/ethernet/actions/Kco + source "drivers/net/ethernet/adaptec/Kconfig" + source "drivers/net/ethernet/aeroflex/Kconfig" + source "drivers/net/ethernet/agere/Kconfig" ++source "drivers/net/ethernet/airoha/Kconfig" ++source "drivers/net/ethernet/mellanox/Kconfig" + source "drivers/net/ethernet/alacritech/Kconfig" + source "drivers/net/ethernet/allwinner/Kconfig" + source "drivers/net/ethernet/alteon/Kconfig" +--- a/drivers/net/ethernet/Makefile ++++ b/drivers/net/ethernet/Makefile +@@ -10,6 +10,7 @@ obj-$(CONFIG_NET_VENDOR_ADAPTEC) += adap + obj-$(CONFIG_GRETH) += aeroflex/ + obj-$(CONFIG_NET_VENDOR_ADI) += adi/ + obj-$(CONFIG_NET_VENDOR_AGERE) += agere/ ++obj-$(CONFIG_NET_VENDOR_AIROHA) += airoha/ + obj-$(CONFIG_NET_VENDOR_ALACRITECH) += alacritech/ + obj-$(CONFIG_NET_VENDOR_ALLWINNER) += allwinner/ + obj-$(CONFIG_NET_VENDOR_ALTEON) += alteon/ +--- /dev/null ++++ b/drivers/net/ethernet/airoha/Kconfig +@@ -0,0 +1,18 @@ ++# SPDX-License-Identifier: GPL-2.0-only ++config NET_VENDOR_AIROHA ++ bool "Airoha devices" ++ depends on ARCH_AIROHA || COMPILE_TEST ++ help ++ If you have a Airoha SoC with ethernet, say Y. ++ ++if NET_VENDOR_AIROHA ++ ++config NET_AIROHA ++ tristate "Airoha SoC Gigabit Ethernet support" ++ depends on NET_DSA || !NET_DSA ++ select PAGE_POOL ++ help ++ This driver supports the gigabit ethernet MACs in the ++ Airoha SoC family. ++ ++endif #NET_VENDOR_AIROHA +--- /dev/null ++++ b/drivers/net/ethernet/airoha/Makefile +@@ -0,0 +1,6 @@ ++# SPDX-License-Identifier: GPL-2.0-only ++# ++# Airoha for the Mediatek SoCs built-in ethernet macs ++# ++ ++obj-$(CONFIG_NET_AIROHA) += airoha_eth.o +--- a/drivers/net/ethernet/mediatek/Kconfig ++++ b/drivers/net/ethernet/mediatek/Kconfig +@@ -7,14 +7,6 @@ config NET_VENDOR_MEDIATEK + + if NET_VENDOR_MEDIATEK + +-config NET_AIROHA +- tristate "Airoha SoC Gigabit Ethernet support" +- depends on NET_DSA || !NET_DSA +- select PAGE_POOL +- help +- This driver supports the gigabit ethernet MACs in the +- Airoha SoC family. +- + config NET_MEDIATEK_SOC_WED + depends on ARCH_MEDIATEK || COMPILE_TEST + def_bool NET_MEDIATEK_SOC != n +--- a/drivers/net/ethernet/mediatek/Makefile ++++ b/drivers/net/ethernet/mediatek/Makefile +@@ -11,4 +11,3 @@ mtk_eth-$(CONFIG_NET_MEDIATEK_SOC_WED) + + endif + obj-$(CONFIG_NET_MEDIATEK_SOC_WED) += mtk_wed_ops.o + obj-$(CONFIG_NET_MEDIATEK_STAR_EMAC) += mtk_star_emac.o +-obj-$(CONFIG_NET_AIROHA) += airoha_eth.o +--- /dev/null ++++ b/drivers/net/ethernet/airoha/airoha_eth.c +@@ -0,0 +1,3359 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * Copyright (c) 2024 AIROHA Inc ++ * Author: Lorenzo Bianconi ++ */ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define AIROHA_MAX_NUM_GDM_PORTS 1 ++#define AIROHA_MAX_NUM_QDMA 2 ++#define AIROHA_MAX_NUM_RSTS 3 ++#define AIROHA_MAX_NUM_XSI_RSTS 5 ++#define AIROHA_MAX_MTU 2000 ++#define AIROHA_MAX_PACKET_SIZE 2048 ++#define AIROHA_NUM_QOS_CHANNELS 4 ++#define AIROHA_NUM_QOS_QUEUES 8 ++#define AIROHA_NUM_TX_RING 32 ++#define AIROHA_NUM_RX_RING 32 ++#define AIROHA_NUM_NETDEV_TX_RINGS (AIROHA_NUM_TX_RING + \ ++ AIROHA_NUM_QOS_CHANNELS) ++#define AIROHA_FE_MC_MAX_VLAN_TABLE 64 ++#define AIROHA_FE_MC_MAX_VLAN_PORT 16 ++#define AIROHA_NUM_TX_IRQ 2 ++#define HW_DSCP_NUM 2048 ++#define IRQ_QUEUE_LEN(_n) ((_n) ? 1024 : 2048) ++#define TX_DSCP_NUM 1024 ++#define RX_DSCP_NUM(_n) \ ++ ((_n) == 2 ? 128 : \ ++ (_n) == 11 ? 128 : \ ++ (_n) == 15 ? 128 : \ ++ (_n) == 0 ? 1024 : 16) ++ ++#define PSE_RSV_PAGES 128 ++#define PSE_QUEUE_RSV_PAGES 64 ++ ++#define QDMA_METER_IDX(_n) ((_n) & 0xff) ++#define QDMA_METER_GROUP(_n) (((_n) >> 8) & 0x3) ++ ++/* FE */ ++#define PSE_BASE 0x0100 ++#define CSR_IFC_BASE 0x0200 ++#define CDM1_BASE 0x0400 ++#define GDM1_BASE 0x0500 ++#define PPE1_BASE 0x0c00 ++ ++#define CDM2_BASE 0x1400 ++#define GDM2_BASE 0x1500 ++ ++#define GDM3_BASE 0x1100 ++#define GDM4_BASE 0x2500 ++ ++#define GDM_BASE(_n) \ ++ ((_n) == 4 ? GDM4_BASE : \ ++ (_n) == 3 ? GDM3_BASE : \ ++ (_n) == 2 ? GDM2_BASE : GDM1_BASE) ++ ++#define REG_FE_DMA_GLO_CFG 0x0000 ++#define FE_DMA_GLO_L2_SPACE_MASK GENMASK(7, 4) ++#define FE_DMA_GLO_PG_SZ_MASK BIT(3) ++ ++#define REG_FE_RST_GLO_CFG 0x0004 ++#define FE_RST_GDM4_MBI_ARB_MASK BIT(3) ++#define FE_RST_GDM3_MBI_ARB_MASK BIT(2) ++#define FE_RST_CORE_MASK BIT(0) ++ ++#define REG_FE_WAN_MAC_H 0x0030 ++#define REG_FE_LAN_MAC_H 0x0040 ++ ++#define REG_FE_MAC_LMIN(_n) ((_n) + 0x04) ++#define REG_FE_MAC_LMAX(_n) ((_n) + 0x08) ++ ++#define REG_FE_CDM1_OQ_MAP0 0x0050 ++#define REG_FE_CDM1_OQ_MAP1 0x0054 ++#define REG_FE_CDM1_OQ_MAP2 0x0058 ++#define REG_FE_CDM1_OQ_MAP3 0x005c ++ ++#define REG_FE_PCE_CFG 0x0070 ++#define PCE_DPI_EN_MASK BIT(2) ++#define PCE_KA_EN_MASK BIT(1) ++#define PCE_MC_EN_MASK BIT(0) ++ ++#define REG_FE_PSE_QUEUE_CFG_WR 0x0080 ++#define PSE_CFG_PORT_ID_MASK GENMASK(27, 24) ++#define PSE_CFG_QUEUE_ID_MASK GENMASK(20, 16) ++#define PSE_CFG_WR_EN_MASK BIT(8) ++#define PSE_CFG_OQRSV_SEL_MASK BIT(0) ++ ++#define REG_FE_PSE_QUEUE_CFG_VAL 0x0084 ++#define PSE_CFG_OQ_RSV_MASK GENMASK(13, 0) ++ ++#define PSE_FQ_CFG 0x008c ++#define PSE_FQ_LIMIT_MASK GENMASK(14, 0) ++ ++#define REG_FE_PSE_BUF_SET 0x0090 ++#define PSE_SHARE_USED_LTHD_MASK GENMASK(31, 16) ++#define PSE_ALLRSV_MASK GENMASK(14, 0) ++ ++#define REG_PSE_SHARE_USED_THD 0x0094 ++#define PSE_SHARE_USED_MTHD_MASK GENMASK(31, 16) ++#define PSE_SHARE_USED_HTHD_MASK GENMASK(15, 0) ++ ++#define REG_GDM_MISC_CFG 0x0148 ++#define GDM2_RDM_ACK_WAIT_PREF_MASK BIT(9) ++#define GDM2_CHN_VLD_MODE_MASK BIT(5) ++ ++#define REG_FE_CSR_IFC_CFG CSR_IFC_BASE ++#define FE_IFC_EN_MASK BIT(0) ++ ++#define REG_FE_VIP_PORT_EN 0x01f0 ++#define REG_FE_IFC_PORT_EN 0x01f4 ++ ++#define REG_PSE_IQ_REV1 (PSE_BASE + 0x08) ++#define PSE_IQ_RES1_P2_MASK GENMASK(23, 16) ++ ++#define REG_PSE_IQ_REV2 (PSE_BASE + 0x0c) ++#define PSE_IQ_RES2_P5_MASK GENMASK(15, 8) ++#define PSE_IQ_RES2_P4_MASK GENMASK(7, 0) ++ ++#define REG_FE_VIP_EN(_n) (0x0300 + ((_n) << 3)) ++#define PATN_FCPU_EN_MASK BIT(7) ++#define PATN_SWP_EN_MASK BIT(6) ++#define PATN_DP_EN_MASK BIT(5) ++#define PATN_SP_EN_MASK BIT(4) ++#define PATN_TYPE_MASK GENMASK(3, 1) ++#define PATN_EN_MASK BIT(0) ++ ++#define REG_FE_VIP_PATN(_n) (0x0304 + ((_n) << 3)) ++#define PATN_DP_MASK GENMASK(31, 16) ++#define PATN_SP_MASK GENMASK(15, 0) ++ ++#define REG_CDM1_VLAN_CTRL CDM1_BASE ++#define CDM1_VLAN_MASK GENMASK(31, 16) ++ ++#define REG_CDM1_FWD_CFG (CDM1_BASE + 0x08) ++#define CDM1_VIP_QSEL_MASK GENMASK(24, 20) ++ ++#define REG_CDM1_CRSN_QSEL(_n) (CDM1_BASE + 0x10 + ((_n) << 2)) ++#define CDM1_CRSN_QSEL_REASON_MASK(_n) \ ++ GENMASK(4 + (((_n) % 4) << 3), (((_n) % 4) << 3)) ++ ++#define REG_CDM2_FWD_CFG (CDM2_BASE + 0x08) ++#define CDM2_OAM_QSEL_MASK GENMASK(31, 27) ++#define CDM2_VIP_QSEL_MASK GENMASK(24, 20) ++ ++#define REG_CDM2_CRSN_QSEL(_n) (CDM2_BASE + 0x10 + ((_n) << 2)) ++#define CDM2_CRSN_QSEL_REASON_MASK(_n) \ ++ GENMASK(4 + (((_n) % 4) << 3), (((_n) % 4) << 3)) ++ ++#define REG_GDM_FWD_CFG(_n) GDM_BASE(_n) ++#define GDM_DROP_CRC_ERR BIT(23) ++#define GDM_IP4_CKSUM BIT(22) ++#define GDM_TCP_CKSUM BIT(21) ++#define GDM_UDP_CKSUM BIT(20) ++#define GDM_UCFQ_MASK GENMASK(15, 12) ++#define GDM_BCFQ_MASK GENMASK(11, 8) ++#define GDM_MCFQ_MASK GENMASK(7, 4) ++#define GDM_OCFQ_MASK GENMASK(3, 0) ++ ++#define REG_GDM_INGRESS_CFG(_n) (GDM_BASE(_n) + 0x10) ++#define GDM_INGRESS_FC_EN_MASK BIT(1) ++#define GDM_STAG_EN_MASK BIT(0) ++ ++#define REG_GDM_LEN_CFG(_n) (GDM_BASE(_n) + 0x14) ++#define GDM_SHORT_LEN_MASK GENMASK(13, 0) ++#define GDM_LONG_LEN_MASK GENMASK(29, 16) ++ ++#define REG_FE_CPORT_CFG (GDM1_BASE + 0x40) ++#define FE_CPORT_PAD BIT(26) ++#define FE_CPORT_PORT_XFC_MASK BIT(25) ++#define FE_CPORT_QUEUE_XFC_MASK BIT(24) ++ ++#define REG_FE_GDM_MIB_CLEAR(_n) (GDM_BASE(_n) + 0xf0) ++#define FE_GDM_MIB_RX_CLEAR_MASK BIT(1) ++#define FE_GDM_MIB_TX_CLEAR_MASK BIT(0) ++ ++#define REG_FE_GDM1_MIB_CFG (GDM1_BASE + 0xf4) ++#define FE_STRICT_RFC2819_MODE_MASK BIT(31) ++#define FE_GDM1_TX_MIB_SPLIT_EN_MASK BIT(17) ++#define FE_GDM1_RX_MIB_SPLIT_EN_MASK BIT(16) ++#define FE_TX_MIB_ID_MASK GENMASK(15, 8) ++#define FE_RX_MIB_ID_MASK GENMASK(7, 0) ++ ++#define REG_FE_GDM_TX_OK_PKT_CNT_L(_n) (GDM_BASE(_n) + 0x104) ++#define REG_FE_GDM_TX_OK_BYTE_CNT_L(_n) (GDM_BASE(_n) + 0x10c) ++#define REG_FE_GDM_TX_ETH_PKT_CNT_L(_n) (GDM_BASE(_n) + 0x110) ++#define REG_FE_GDM_TX_ETH_BYTE_CNT_L(_n) (GDM_BASE(_n) + 0x114) ++#define REG_FE_GDM_TX_ETH_DROP_CNT(_n) (GDM_BASE(_n) + 0x118) ++#define REG_FE_GDM_TX_ETH_BC_CNT(_n) (GDM_BASE(_n) + 0x11c) ++#define REG_FE_GDM_TX_ETH_MC_CNT(_n) (GDM_BASE(_n) + 0x120) ++#define REG_FE_GDM_TX_ETH_RUNT_CNT(_n) (GDM_BASE(_n) + 0x124) ++#define REG_FE_GDM_TX_ETH_LONG_CNT(_n) (GDM_BASE(_n) + 0x128) ++#define REG_FE_GDM_TX_ETH_E64_CNT_L(_n) (GDM_BASE(_n) + 0x12c) ++#define REG_FE_GDM_TX_ETH_L64_CNT_L(_n) (GDM_BASE(_n) + 0x130) ++#define REG_FE_GDM_TX_ETH_L127_CNT_L(_n) (GDM_BASE(_n) + 0x134) ++#define REG_FE_GDM_TX_ETH_L255_CNT_L(_n) (GDM_BASE(_n) + 0x138) ++#define REG_FE_GDM_TX_ETH_L511_CNT_L(_n) (GDM_BASE(_n) + 0x13c) ++#define REG_FE_GDM_TX_ETH_L1023_CNT_L(_n) (GDM_BASE(_n) + 0x140) ++ ++#define REG_FE_GDM_RX_OK_PKT_CNT_L(_n) (GDM_BASE(_n) + 0x148) ++#define REG_FE_GDM_RX_FC_DROP_CNT(_n) (GDM_BASE(_n) + 0x14c) ++#define REG_FE_GDM_RX_RC_DROP_CNT(_n) (GDM_BASE(_n) + 0x150) ++#define REG_FE_GDM_RX_OVERFLOW_DROP_CNT(_n) (GDM_BASE(_n) + 0x154) ++#define REG_FE_GDM_RX_ERROR_DROP_CNT(_n) (GDM_BASE(_n) + 0x158) ++#define REG_FE_GDM_RX_OK_BYTE_CNT_L(_n) (GDM_BASE(_n) + 0x15c) ++#define REG_FE_GDM_RX_ETH_PKT_CNT_L(_n) (GDM_BASE(_n) + 0x160) ++#define REG_FE_GDM_RX_ETH_BYTE_CNT_L(_n) (GDM_BASE(_n) + 0x164) ++#define REG_FE_GDM_RX_ETH_DROP_CNT(_n) (GDM_BASE(_n) + 0x168) ++#define REG_FE_GDM_RX_ETH_BC_CNT(_n) (GDM_BASE(_n) + 0x16c) ++#define REG_FE_GDM_RX_ETH_MC_CNT(_n) (GDM_BASE(_n) + 0x170) ++#define REG_FE_GDM_RX_ETH_CRC_ERR_CNT(_n) (GDM_BASE(_n) + 0x174) ++#define REG_FE_GDM_RX_ETH_FRAG_CNT(_n) (GDM_BASE(_n) + 0x178) ++#define REG_FE_GDM_RX_ETH_JABBER_CNT(_n) (GDM_BASE(_n) + 0x17c) ++#define REG_FE_GDM_RX_ETH_RUNT_CNT(_n) (GDM_BASE(_n) + 0x180) ++#define REG_FE_GDM_RX_ETH_LONG_CNT(_n) (GDM_BASE(_n) + 0x184) ++#define REG_FE_GDM_RX_ETH_E64_CNT_L(_n) (GDM_BASE(_n) + 0x188) ++#define REG_FE_GDM_RX_ETH_L64_CNT_L(_n) (GDM_BASE(_n) + 0x18c) ++#define REG_FE_GDM_RX_ETH_L127_CNT_L(_n) (GDM_BASE(_n) + 0x190) ++#define REG_FE_GDM_RX_ETH_L255_CNT_L(_n) (GDM_BASE(_n) + 0x194) ++#define REG_FE_GDM_RX_ETH_L511_CNT_L(_n) (GDM_BASE(_n) + 0x198) ++#define REG_FE_GDM_RX_ETH_L1023_CNT_L(_n) (GDM_BASE(_n) + 0x19c) ++ ++#define REG_PPE1_TB_HASH_CFG (PPE1_BASE + 0x250) ++#define PPE1_SRAM_TABLE_EN_MASK BIT(0) ++#define PPE1_SRAM_HASH1_EN_MASK BIT(8) ++#define PPE1_DRAM_TABLE_EN_MASK BIT(16) ++#define PPE1_DRAM_HASH1_EN_MASK BIT(24) ++ ++#define REG_FE_GDM_TX_OK_PKT_CNT_H(_n) (GDM_BASE(_n) + 0x280) ++#define REG_FE_GDM_TX_OK_BYTE_CNT_H(_n) (GDM_BASE(_n) + 0x284) ++#define REG_FE_GDM_TX_ETH_PKT_CNT_H(_n) (GDM_BASE(_n) + 0x288) ++#define REG_FE_GDM_TX_ETH_BYTE_CNT_H(_n) (GDM_BASE(_n) + 0x28c) ++ ++#define REG_FE_GDM_RX_OK_PKT_CNT_H(_n) (GDM_BASE(_n) + 0x290) ++#define REG_FE_GDM_RX_OK_BYTE_CNT_H(_n) (GDM_BASE(_n) + 0x294) ++#define REG_FE_GDM_RX_ETH_PKT_CNT_H(_n) (GDM_BASE(_n) + 0x298) ++#define REG_FE_GDM_RX_ETH_BYTE_CNT_H(_n) (GDM_BASE(_n) + 0x29c) ++#define REG_FE_GDM_TX_ETH_E64_CNT_H(_n) (GDM_BASE(_n) + 0x2b8) ++#define REG_FE_GDM_TX_ETH_L64_CNT_H(_n) (GDM_BASE(_n) + 0x2bc) ++#define REG_FE_GDM_TX_ETH_L127_CNT_H(_n) (GDM_BASE(_n) + 0x2c0) ++#define REG_FE_GDM_TX_ETH_L255_CNT_H(_n) (GDM_BASE(_n) + 0x2c4) ++#define REG_FE_GDM_TX_ETH_L511_CNT_H(_n) (GDM_BASE(_n) + 0x2c8) ++#define REG_FE_GDM_TX_ETH_L1023_CNT_H(_n) (GDM_BASE(_n) + 0x2cc) ++#define REG_FE_GDM_RX_ETH_E64_CNT_H(_n) (GDM_BASE(_n) + 0x2e8) ++#define REG_FE_GDM_RX_ETH_L64_CNT_H(_n) (GDM_BASE(_n) + 0x2ec) ++#define REG_FE_GDM_RX_ETH_L127_CNT_H(_n) (GDM_BASE(_n) + 0x2f0) ++#define REG_FE_GDM_RX_ETH_L255_CNT_H(_n) (GDM_BASE(_n) + 0x2f4) ++#define REG_FE_GDM_RX_ETH_L511_CNT_H(_n) (GDM_BASE(_n) + 0x2f8) ++#define REG_FE_GDM_RX_ETH_L1023_CNT_H(_n) (GDM_BASE(_n) + 0x2fc) ++ ++#define REG_GDM2_CHN_RLS (GDM2_BASE + 0x20) ++#define MBI_RX_AGE_SEL_MASK GENMASK(26, 25) ++#define MBI_TX_AGE_SEL_MASK GENMASK(18, 17) ++ ++#define REG_GDM3_FWD_CFG GDM3_BASE ++#define GDM3_PAD_EN_MASK BIT(28) ++ ++#define REG_GDM4_FWD_CFG GDM4_BASE ++#define GDM4_PAD_EN_MASK BIT(28) ++#define GDM4_SPORT_OFFSET0_MASK GENMASK(11, 8) ++ ++#define REG_GDM4_SRC_PORT_SET (GDM4_BASE + 0x23c) ++#define GDM4_SPORT_OFF2_MASK GENMASK(19, 16) ++#define GDM4_SPORT_OFF1_MASK GENMASK(15, 12) ++#define GDM4_SPORT_OFF0_MASK GENMASK(11, 8) ++ ++#define REG_IP_FRAG_FP 0x2010 ++#define IP_ASSEMBLE_PORT_MASK GENMASK(24, 21) ++#define IP_ASSEMBLE_NBQ_MASK GENMASK(20, 16) ++#define IP_FRAGMENT_PORT_MASK GENMASK(8, 5) ++#define IP_FRAGMENT_NBQ_MASK GENMASK(4, 0) ++ ++#define REG_MC_VLAN_EN 0x2100 ++#define MC_VLAN_EN_MASK BIT(0) ++ ++#define REG_MC_VLAN_CFG 0x2104 ++#define MC_VLAN_CFG_CMD_DONE_MASK BIT(31) ++#define MC_VLAN_CFG_TABLE_ID_MASK GENMASK(21, 16) ++#define MC_VLAN_CFG_PORT_ID_MASK GENMASK(11, 8) ++#define MC_VLAN_CFG_TABLE_SEL_MASK BIT(4) ++#define MC_VLAN_CFG_RW_MASK BIT(0) ++ ++#define REG_MC_VLAN_DATA 0x2108 ++ ++#define REG_CDM5_RX_OQ1_DROP_CNT 0x29d4 ++ ++/* QDMA */ ++#define REG_QDMA_GLOBAL_CFG 0x0004 ++#define GLOBAL_CFG_RX_2B_OFFSET_MASK BIT(31) ++#define GLOBAL_CFG_DMA_PREFERENCE_MASK GENMASK(30, 29) ++#define GLOBAL_CFG_CPU_TXR_RR_MASK BIT(28) ++#define GLOBAL_CFG_DSCP_BYTE_SWAP_MASK BIT(27) ++#define GLOBAL_CFG_PAYLOAD_BYTE_SWAP_MASK BIT(26) ++#define GLOBAL_CFG_MULTICAST_MODIFY_FP_MASK BIT(25) ++#define GLOBAL_CFG_OAM_MODIFY_MASK BIT(24) ++#define GLOBAL_CFG_RESET_MASK BIT(23) ++#define GLOBAL_CFG_RESET_DONE_MASK BIT(22) ++#define GLOBAL_CFG_MULTICAST_EN_MASK BIT(21) ++#define GLOBAL_CFG_IRQ1_EN_MASK BIT(20) ++#define GLOBAL_CFG_IRQ0_EN_MASK BIT(19) ++#define GLOBAL_CFG_LOOPCNT_EN_MASK BIT(18) ++#define GLOBAL_CFG_RD_BYPASS_WR_MASK BIT(17) ++#define GLOBAL_CFG_QDMA_LOOPBACK_MASK BIT(16) ++#define GLOBAL_CFG_LPBK_RXQ_SEL_MASK GENMASK(13, 8) ++#define GLOBAL_CFG_CHECK_DONE_MASK BIT(7) ++#define GLOBAL_CFG_TX_WB_DONE_MASK BIT(6) ++#define GLOBAL_CFG_MAX_ISSUE_NUM_MASK GENMASK(5, 4) ++#define GLOBAL_CFG_RX_DMA_BUSY_MASK BIT(3) ++#define GLOBAL_CFG_RX_DMA_EN_MASK BIT(2) ++#define GLOBAL_CFG_TX_DMA_BUSY_MASK BIT(1) ++#define GLOBAL_CFG_TX_DMA_EN_MASK BIT(0) ++ ++#define REG_FWD_DSCP_BASE 0x0010 ++#define REG_FWD_BUF_BASE 0x0014 ++ ++#define REG_HW_FWD_DSCP_CFG 0x0018 ++#define HW_FWD_DSCP_PAYLOAD_SIZE_MASK GENMASK(29, 28) ++#define HW_FWD_DSCP_SCATTER_LEN_MASK GENMASK(17, 16) ++#define HW_FWD_DSCP_MIN_SCATTER_LEN_MASK GENMASK(15, 0) ++ ++#define REG_INT_STATUS(_n) \ ++ (((_n) == 4) ? 0x0730 : \ ++ ((_n) == 3) ? 0x0724 : \ ++ ((_n) == 2) ? 0x0720 : \ ++ ((_n) == 1) ? 0x0024 : 0x0020) ++ ++#define REG_INT_ENABLE(_n) \ ++ (((_n) == 4) ? 0x0750 : \ ++ ((_n) == 3) ? 0x0744 : \ ++ ((_n) == 2) ? 0x0740 : \ ++ ((_n) == 1) ? 0x002c : 0x0028) ++ ++/* QDMA_CSR_INT_ENABLE1 */ ++#define RX15_COHERENT_INT_MASK BIT(31) ++#define RX14_COHERENT_INT_MASK BIT(30) ++#define RX13_COHERENT_INT_MASK BIT(29) ++#define RX12_COHERENT_INT_MASK BIT(28) ++#define RX11_COHERENT_INT_MASK BIT(27) ++#define RX10_COHERENT_INT_MASK BIT(26) ++#define RX9_COHERENT_INT_MASK BIT(25) ++#define RX8_COHERENT_INT_MASK BIT(24) ++#define RX7_COHERENT_INT_MASK BIT(23) ++#define RX6_COHERENT_INT_MASK BIT(22) ++#define RX5_COHERENT_INT_MASK BIT(21) ++#define RX4_COHERENT_INT_MASK BIT(20) ++#define RX3_COHERENT_INT_MASK BIT(19) ++#define RX2_COHERENT_INT_MASK BIT(18) ++#define RX1_COHERENT_INT_MASK BIT(17) ++#define RX0_COHERENT_INT_MASK BIT(16) ++#define TX7_COHERENT_INT_MASK BIT(15) ++#define TX6_COHERENT_INT_MASK BIT(14) ++#define TX5_COHERENT_INT_MASK BIT(13) ++#define TX4_COHERENT_INT_MASK BIT(12) ++#define TX3_COHERENT_INT_MASK BIT(11) ++#define TX2_COHERENT_INT_MASK BIT(10) ++#define TX1_COHERENT_INT_MASK BIT(9) ++#define TX0_COHERENT_INT_MASK BIT(8) ++#define CNT_OVER_FLOW_INT_MASK BIT(7) ++#define IRQ1_FULL_INT_MASK BIT(5) ++#define IRQ1_INT_MASK BIT(4) ++#define HWFWD_DSCP_LOW_INT_MASK BIT(3) ++#define HWFWD_DSCP_EMPTY_INT_MASK BIT(2) ++#define IRQ0_FULL_INT_MASK BIT(1) ++#define IRQ0_INT_MASK BIT(0) ++ ++#define TX_DONE_INT_MASK(_n) \ ++ ((_n) ? IRQ1_INT_MASK | IRQ1_FULL_INT_MASK \ ++ : IRQ0_INT_MASK | IRQ0_FULL_INT_MASK) ++ ++#define INT_TX_MASK \ ++ (IRQ1_INT_MASK | IRQ1_FULL_INT_MASK | \ ++ IRQ0_INT_MASK | IRQ0_FULL_INT_MASK) ++ ++#define INT_IDX0_MASK \ ++ (TX0_COHERENT_INT_MASK | TX1_COHERENT_INT_MASK | \ ++ TX2_COHERENT_INT_MASK | TX3_COHERENT_INT_MASK | \ ++ TX4_COHERENT_INT_MASK | TX5_COHERENT_INT_MASK | \ ++ TX6_COHERENT_INT_MASK | TX7_COHERENT_INT_MASK | \ ++ RX0_COHERENT_INT_MASK | RX1_COHERENT_INT_MASK | \ ++ RX2_COHERENT_INT_MASK | RX3_COHERENT_INT_MASK | \ ++ RX4_COHERENT_INT_MASK | RX7_COHERENT_INT_MASK | \ ++ RX8_COHERENT_INT_MASK | RX9_COHERENT_INT_MASK | \ ++ RX15_COHERENT_INT_MASK | INT_TX_MASK) ++ ++/* QDMA_CSR_INT_ENABLE2 */ ++#define RX15_NO_CPU_DSCP_INT_MASK BIT(31) ++#define RX14_NO_CPU_DSCP_INT_MASK BIT(30) ++#define RX13_NO_CPU_DSCP_INT_MASK BIT(29) ++#define RX12_NO_CPU_DSCP_INT_MASK BIT(28) ++#define RX11_NO_CPU_DSCP_INT_MASK BIT(27) ++#define RX10_NO_CPU_DSCP_INT_MASK BIT(26) ++#define RX9_NO_CPU_DSCP_INT_MASK BIT(25) ++#define RX8_NO_CPU_DSCP_INT_MASK BIT(24) ++#define RX7_NO_CPU_DSCP_INT_MASK BIT(23) ++#define RX6_NO_CPU_DSCP_INT_MASK BIT(22) ++#define RX5_NO_CPU_DSCP_INT_MASK BIT(21) ++#define RX4_NO_CPU_DSCP_INT_MASK BIT(20) ++#define RX3_NO_CPU_DSCP_INT_MASK BIT(19) ++#define RX2_NO_CPU_DSCP_INT_MASK BIT(18) ++#define RX1_NO_CPU_DSCP_INT_MASK BIT(17) ++#define RX0_NO_CPU_DSCP_INT_MASK BIT(16) ++#define RX15_DONE_INT_MASK BIT(15) ++#define RX14_DONE_INT_MASK BIT(14) ++#define RX13_DONE_INT_MASK BIT(13) ++#define RX12_DONE_INT_MASK BIT(12) ++#define RX11_DONE_INT_MASK BIT(11) ++#define RX10_DONE_INT_MASK BIT(10) ++#define RX9_DONE_INT_MASK BIT(9) ++#define RX8_DONE_INT_MASK BIT(8) ++#define RX7_DONE_INT_MASK BIT(7) ++#define RX6_DONE_INT_MASK BIT(6) ++#define RX5_DONE_INT_MASK BIT(5) ++#define RX4_DONE_INT_MASK BIT(4) ++#define RX3_DONE_INT_MASK BIT(3) ++#define RX2_DONE_INT_MASK BIT(2) ++#define RX1_DONE_INT_MASK BIT(1) ++#define RX0_DONE_INT_MASK BIT(0) ++ ++#define RX_DONE_INT_MASK \ ++ (RX0_DONE_INT_MASK | RX1_DONE_INT_MASK | \ ++ RX2_DONE_INT_MASK | RX3_DONE_INT_MASK | \ ++ RX4_DONE_INT_MASK | RX7_DONE_INT_MASK | \ ++ RX8_DONE_INT_MASK | RX9_DONE_INT_MASK | \ ++ RX15_DONE_INT_MASK) ++#define INT_IDX1_MASK \ ++ (RX_DONE_INT_MASK | \ ++ RX0_NO_CPU_DSCP_INT_MASK | RX1_NO_CPU_DSCP_INT_MASK | \ ++ RX2_NO_CPU_DSCP_INT_MASK | RX3_NO_CPU_DSCP_INT_MASK | \ ++ RX4_NO_CPU_DSCP_INT_MASK | RX7_NO_CPU_DSCP_INT_MASK | \ ++ RX8_NO_CPU_DSCP_INT_MASK | RX9_NO_CPU_DSCP_INT_MASK | \ ++ RX15_NO_CPU_DSCP_INT_MASK) ++ ++/* QDMA_CSR_INT_ENABLE5 */ ++#define TX31_COHERENT_INT_MASK BIT(31) ++#define TX30_COHERENT_INT_MASK BIT(30) ++#define TX29_COHERENT_INT_MASK BIT(29) ++#define TX28_COHERENT_INT_MASK BIT(28) ++#define TX27_COHERENT_INT_MASK BIT(27) ++#define TX26_COHERENT_INT_MASK BIT(26) ++#define TX25_COHERENT_INT_MASK BIT(25) ++#define TX24_COHERENT_INT_MASK BIT(24) ++#define TX23_COHERENT_INT_MASK BIT(23) ++#define TX22_COHERENT_INT_MASK BIT(22) ++#define TX21_COHERENT_INT_MASK BIT(21) ++#define TX20_COHERENT_INT_MASK BIT(20) ++#define TX19_COHERENT_INT_MASK BIT(19) ++#define TX18_COHERENT_INT_MASK BIT(18) ++#define TX17_COHERENT_INT_MASK BIT(17) ++#define TX16_COHERENT_INT_MASK BIT(16) ++#define TX15_COHERENT_INT_MASK BIT(15) ++#define TX14_COHERENT_INT_MASK BIT(14) ++#define TX13_COHERENT_INT_MASK BIT(13) ++#define TX12_COHERENT_INT_MASK BIT(12) ++#define TX11_COHERENT_INT_MASK BIT(11) ++#define TX10_COHERENT_INT_MASK BIT(10) ++#define TX9_COHERENT_INT_MASK BIT(9) ++#define TX8_COHERENT_INT_MASK BIT(8) ++ ++#define INT_IDX4_MASK \ ++ (TX8_COHERENT_INT_MASK | TX9_COHERENT_INT_MASK | \ ++ TX10_COHERENT_INT_MASK | TX11_COHERENT_INT_MASK | \ ++ TX12_COHERENT_INT_MASK | TX13_COHERENT_INT_MASK | \ ++ TX14_COHERENT_INT_MASK | TX15_COHERENT_INT_MASK | \ ++ TX16_COHERENT_INT_MASK | TX17_COHERENT_INT_MASK | \ ++ TX18_COHERENT_INT_MASK | TX19_COHERENT_INT_MASK | \ ++ TX20_COHERENT_INT_MASK | TX21_COHERENT_INT_MASK | \ ++ TX22_COHERENT_INT_MASK | TX23_COHERENT_INT_MASK | \ ++ TX24_COHERENT_INT_MASK | TX25_COHERENT_INT_MASK | \ ++ TX26_COHERENT_INT_MASK | TX27_COHERENT_INT_MASK | \ ++ TX28_COHERENT_INT_MASK | TX29_COHERENT_INT_MASK | \ ++ TX30_COHERENT_INT_MASK | TX31_COHERENT_INT_MASK) ++ ++#define REG_TX_IRQ_BASE(_n) ((_n) ? 0x0048 : 0x0050) ++ ++#define REG_TX_IRQ_CFG(_n) ((_n) ? 0x004c : 0x0054) ++#define TX_IRQ_THR_MASK GENMASK(27, 16) ++#define TX_IRQ_DEPTH_MASK GENMASK(11, 0) ++ ++#define REG_IRQ_CLEAR_LEN(_n) ((_n) ? 0x0064 : 0x0058) ++#define IRQ_CLEAR_LEN_MASK GENMASK(7, 0) ++ ++#define REG_IRQ_STATUS(_n) ((_n) ? 0x0068 : 0x005c) ++#define IRQ_ENTRY_LEN_MASK GENMASK(27, 16) ++#define IRQ_HEAD_IDX_MASK GENMASK(11, 0) ++ ++#define REG_TX_RING_BASE(_n) \ ++ (((_n) < 8) ? 0x0100 + ((_n) << 5) : 0x0b00 + (((_n) - 8) << 5)) ++ ++#define REG_TX_RING_BLOCKING(_n) \ ++ (((_n) < 8) ? 0x0104 + ((_n) << 5) : 0x0b04 + (((_n) - 8) << 5)) ++ ++#define TX_RING_IRQ_BLOCKING_MAP_MASK BIT(6) ++#define TX_RING_IRQ_BLOCKING_CFG_MASK BIT(4) ++#define TX_RING_IRQ_BLOCKING_TX_DROP_EN_MASK BIT(2) ++#define TX_RING_IRQ_BLOCKING_MAX_TH_TXRING_EN_MASK BIT(1) ++#define TX_RING_IRQ_BLOCKING_MIN_TH_TXRING_EN_MASK BIT(0) ++ ++#define REG_TX_CPU_IDX(_n) \ ++ (((_n) < 8) ? 0x0108 + ((_n) << 5) : 0x0b08 + (((_n) - 8) << 5)) ++ ++#define TX_RING_CPU_IDX_MASK GENMASK(15, 0) ++ ++#define REG_TX_DMA_IDX(_n) \ ++ (((_n) < 8) ? 0x010c + ((_n) << 5) : 0x0b0c + (((_n) - 8) << 5)) ++ ++#define TX_RING_DMA_IDX_MASK GENMASK(15, 0) ++ ++#define IRQ_RING_IDX_MASK GENMASK(20, 16) ++#define IRQ_DESC_IDX_MASK GENMASK(15, 0) ++ ++#define REG_RX_RING_BASE(_n) \ ++ (((_n) < 16) ? 0x0200 + ((_n) << 5) : 0x0e00 + (((_n) - 16) << 5)) ++ ++#define REG_RX_RING_SIZE(_n) \ ++ (((_n) < 16) ? 0x0204 + ((_n) << 5) : 0x0e04 + (((_n) - 16) << 5)) ++ ++#define RX_RING_THR_MASK GENMASK(31, 16) ++#define RX_RING_SIZE_MASK GENMASK(15, 0) ++ ++#define REG_RX_CPU_IDX(_n) \ ++ (((_n) < 16) ? 0x0208 + ((_n) << 5) : 0x0e08 + (((_n) - 16) << 5)) ++ ++#define RX_RING_CPU_IDX_MASK GENMASK(15, 0) ++ ++#define REG_RX_DMA_IDX(_n) \ ++ (((_n) < 16) ? 0x020c + ((_n) << 5) : 0x0e0c + (((_n) - 16) << 5)) ++ ++#define REG_RX_DELAY_INT_IDX(_n) \ ++ (((_n) < 16) ? 0x0210 + ((_n) << 5) : 0x0e10 + (((_n) - 16) << 5)) ++ ++#define RX_DELAY_INT_MASK GENMASK(15, 0) ++ ++#define RX_RING_DMA_IDX_MASK GENMASK(15, 0) ++ ++#define REG_INGRESS_TRTCM_CFG 0x0070 ++#define INGRESS_TRTCM_EN_MASK BIT(31) ++#define INGRESS_TRTCM_MODE_MASK BIT(30) ++#define INGRESS_SLOW_TICK_RATIO_MASK GENMASK(29, 16) ++#define INGRESS_FAST_TICK_MASK GENMASK(15, 0) ++ ++#define REG_QUEUE_CLOSE_CFG(_n) (0x00a0 + ((_n) & 0xfc)) ++#define TXQ_DISABLE_CHAN_QUEUE_MASK(_n, _m) BIT((_m) + (((_n) & 0x3) << 3)) ++ ++#define REG_TXQ_DIS_CFG_BASE(_n) ((_n) ? 0x20a0 : 0x00a0) ++#define REG_TXQ_DIS_CFG(_n, _m) (REG_TXQ_DIS_CFG_BASE((_n)) + (_m) << 2) ++ ++#define REG_CNTR_CFG(_n) (0x0400 + ((_n) << 3)) ++#define CNTR_EN_MASK BIT(31) ++#define CNTR_ALL_CHAN_EN_MASK BIT(30) ++#define CNTR_ALL_QUEUE_EN_MASK BIT(29) ++#define CNTR_ALL_DSCP_RING_EN_MASK BIT(28) ++#define CNTR_SRC_MASK GENMASK(27, 24) ++#define CNTR_DSCP_RING_MASK GENMASK(20, 16) ++#define CNTR_CHAN_MASK GENMASK(7, 3) ++#define CNTR_QUEUE_MASK GENMASK(2, 0) ++ ++#define REG_CNTR_VAL(_n) (0x0404 + ((_n) << 3)) ++ ++#define REG_LMGR_INIT_CFG 0x1000 ++#define LMGR_INIT_START BIT(31) ++#define LMGR_SRAM_MODE_MASK BIT(30) ++#define HW_FWD_PKTSIZE_OVERHEAD_MASK GENMASK(27, 20) ++#define HW_FWD_DESC_NUM_MASK GENMASK(16, 0) ++ ++#define REG_FWD_DSCP_LOW_THR 0x1004 ++#define FWD_DSCP_LOW_THR_MASK GENMASK(17, 0) ++ ++#define REG_EGRESS_RATE_METER_CFG 0x100c ++#define EGRESS_RATE_METER_EN_MASK BIT(31) ++#define EGRESS_RATE_METER_EQ_RATE_EN_MASK BIT(17) ++#define EGRESS_RATE_METER_WINDOW_SZ_MASK GENMASK(16, 12) ++#define EGRESS_RATE_METER_TIMESLICE_MASK GENMASK(10, 0) ++ ++#define REG_EGRESS_TRTCM_CFG 0x1010 ++#define EGRESS_TRTCM_EN_MASK BIT(31) ++#define EGRESS_TRTCM_MODE_MASK BIT(30) ++#define EGRESS_SLOW_TICK_RATIO_MASK GENMASK(29, 16) ++#define EGRESS_FAST_TICK_MASK GENMASK(15, 0) ++ ++#define TRTCM_PARAM_RW_MASK BIT(31) ++#define TRTCM_PARAM_RW_DONE_MASK BIT(30) ++#define TRTCM_PARAM_TYPE_MASK GENMASK(29, 28) ++#define TRTCM_METER_GROUP_MASK GENMASK(27, 26) ++#define TRTCM_PARAM_INDEX_MASK GENMASK(23, 17) ++#define TRTCM_PARAM_RATE_TYPE_MASK BIT(16) ++ ++#define REG_TRTCM_CFG_PARAM(_n) ((_n) + 0x4) ++#define REG_TRTCM_DATA_LOW(_n) ((_n) + 0x8) ++#define REG_TRTCM_DATA_HIGH(_n) ((_n) + 0xc) ++ ++#define REG_TXWRR_MODE_CFG 0x1020 ++#define TWRR_WEIGHT_SCALE_MASK BIT(31) ++#define TWRR_WEIGHT_BASE_MASK BIT(3) ++ ++#define REG_TXWRR_WEIGHT_CFG 0x1024 ++#define TWRR_RW_CMD_MASK BIT(31) ++#define TWRR_RW_CMD_DONE BIT(30) ++#define TWRR_CHAN_IDX_MASK GENMASK(23, 19) ++#define TWRR_QUEUE_IDX_MASK GENMASK(18, 16) ++#define TWRR_VALUE_MASK GENMASK(15, 0) ++ ++#define REG_PSE_BUF_USAGE_CFG 0x1028 ++#define PSE_BUF_ESTIMATE_EN_MASK BIT(29) ++ ++#define REG_CHAN_QOS_MODE(_n) (0x1040 + ((_n) << 2)) ++#define CHAN_QOS_MODE_MASK(_n) GENMASK(2 + ((_n) << 2), (_n) << 2) ++ ++#define REG_GLB_TRTCM_CFG 0x1080 ++#define GLB_TRTCM_EN_MASK BIT(31) ++#define GLB_TRTCM_MODE_MASK BIT(30) ++#define GLB_SLOW_TICK_RATIO_MASK GENMASK(29, 16) ++#define GLB_FAST_TICK_MASK GENMASK(15, 0) ++ ++#define REG_TXQ_CNGST_CFG 0x10a0 ++#define TXQ_CNGST_DROP_EN BIT(31) ++#define TXQ_CNGST_DEI_DROP_EN BIT(30) ++ ++#define REG_SLA_TRTCM_CFG 0x1150 ++#define SLA_TRTCM_EN_MASK BIT(31) ++#define SLA_TRTCM_MODE_MASK BIT(30) ++#define SLA_SLOW_TICK_RATIO_MASK GENMASK(29, 16) ++#define SLA_FAST_TICK_MASK GENMASK(15, 0) ++ ++/* CTRL */ ++#define QDMA_DESC_DONE_MASK BIT(31) ++#define QDMA_DESC_DROP_MASK BIT(30) /* tx: drop - rx: overflow */ ++#define QDMA_DESC_MORE_MASK BIT(29) /* more SG elements */ ++#define QDMA_DESC_DEI_MASK BIT(25) ++#define QDMA_DESC_NO_DROP_MASK BIT(24) ++#define QDMA_DESC_LEN_MASK GENMASK(15, 0) ++/* DATA */ ++#define QDMA_DESC_NEXT_ID_MASK GENMASK(15, 0) ++/* TX MSG0 */ ++#define QDMA_ETH_TXMSG_MIC_IDX_MASK BIT(30) ++#define QDMA_ETH_TXMSG_SP_TAG_MASK GENMASK(29, 14) ++#define QDMA_ETH_TXMSG_ICO_MASK BIT(13) ++#define QDMA_ETH_TXMSG_UCO_MASK BIT(12) ++#define QDMA_ETH_TXMSG_TCO_MASK BIT(11) ++#define QDMA_ETH_TXMSG_TSO_MASK BIT(10) ++#define QDMA_ETH_TXMSG_FAST_MASK BIT(9) ++#define QDMA_ETH_TXMSG_OAM_MASK BIT(8) ++#define QDMA_ETH_TXMSG_CHAN_MASK GENMASK(7, 3) ++#define QDMA_ETH_TXMSG_QUEUE_MASK GENMASK(2, 0) ++/* TX MSG1 */ ++#define QDMA_ETH_TXMSG_NO_DROP BIT(31) ++#define QDMA_ETH_TXMSG_METER_MASK GENMASK(30, 24) /* 0x7f no meters */ ++#define QDMA_ETH_TXMSG_FPORT_MASK GENMASK(23, 20) ++#define QDMA_ETH_TXMSG_NBOQ_MASK GENMASK(19, 15) ++#define QDMA_ETH_TXMSG_HWF_MASK BIT(14) ++#define QDMA_ETH_TXMSG_HOP_MASK BIT(13) ++#define QDMA_ETH_TXMSG_PTP_MASK BIT(12) ++#define QDMA_ETH_TXMSG_ACNT_G1_MASK GENMASK(10, 6) /* 0x1f do not count */ ++#define QDMA_ETH_TXMSG_ACNT_G0_MASK GENMASK(5, 0) /* 0x3f do not count */ ++ ++/* RX MSG1 */ ++#define QDMA_ETH_RXMSG_DEI_MASK BIT(31) ++#define QDMA_ETH_RXMSG_IP6_MASK BIT(30) ++#define QDMA_ETH_RXMSG_IP4_MASK BIT(29) ++#define QDMA_ETH_RXMSG_IP4F_MASK BIT(28) ++#define QDMA_ETH_RXMSG_L4_VALID_MASK BIT(27) ++#define QDMA_ETH_RXMSG_L4F_MASK BIT(26) ++#define QDMA_ETH_RXMSG_SPORT_MASK GENMASK(25, 21) ++#define QDMA_ETH_RXMSG_CRSN_MASK GENMASK(20, 16) ++#define QDMA_ETH_RXMSG_PPE_ENTRY_MASK GENMASK(15, 0) ++ ++struct airoha_qdma_desc { ++ __le32 rsv; ++ __le32 ctrl; ++ __le32 addr; ++ __le32 data; ++ __le32 msg0; ++ __le32 msg1; ++ __le32 msg2; ++ __le32 msg3; ++}; ++ ++/* CTRL0 */ ++#define QDMA_FWD_DESC_CTX_MASK BIT(31) ++#define QDMA_FWD_DESC_RING_MASK GENMASK(30, 28) ++#define QDMA_FWD_DESC_IDX_MASK GENMASK(27, 16) ++#define QDMA_FWD_DESC_LEN_MASK GENMASK(15, 0) ++/* CTRL1 */ ++#define QDMA_FWD_DESC_FIRST_IDX_MASK GENMASK(15, 0) ++/* CTRL2 */ ++#define QDMA_FWD_DESC_MORE_PKT_NUM_MASK GENMASK(2, 0) ++ ++struct airoha_qdma_fwd_desc { ++ __le32 addr; ++ __le32 ctrl0; ++ __le32 ctrl1; ++ __le32 ctrl2; ++ __le32 msg0; ++ __le32 msg1; ++ __le32 rsv0; ++ __le32 rsv1; ++}; ++ ++enum { ++ QDMA_INT_REG_IDX0, ++ QDMA_INT_REG_IDX1, ++ QDMA_INT_REG_IDX2, ++ QDMA_INT_REG_IDX3, ++ QDMA_INT_REG_IDX4, ++ QDMA_INT_REG_MAX ++}; ++ ++enum { ++ XSI_PCIE0_PORT, ++ XSI_PCIE1_PORT, ++ XSI_USB_PORT, ++ XSI_AE_PORT, ++ XSI_ETH_PORT, ++}; ++ ++enum { ++ XSI_PCIE0_VIP_PORT_MASK = BIT(22), ++ XSI_PCIE1_VIP_PORT_MASK = BIT(23), ++ XSI_USB_VIP_PORT_MASK = BIT(25), ++ XSI_ETH_VIP_PORT_MASK = BIT(24), ++}; ++ ++enum { ++ DEV_STATE_INITIALIZED, ++}; ++ ++enum { ++ CDM_CRSN_QSEL_Q1 = 1, ++ CDM_CRSN_QSEL_Q5 = 5, ++ CDM_CRSN_QSEL_Q6 = 6, ++ CDM_CRSN_QSEL_Q15 = 15, ++}; ++ ++enum { ++ CRSN_08 = 0x8, ++ CRSN_21 = 0x15, /* KA */ ++ CRSN_22 = 0x16, /* hit bind and force route to CPU */ ++ CRSN_24 = 0x18, ++ CRSN_25 = 0x19, ++}; ++ ++enum { ++ FE_PSE_PORT_CDM1, ++ FE_PSE_PORT_GDM1, ++ FE_PSE_PORT_GDM2, ++ FE_PSE_PORT_GDM3, ++ FE_PSE_PORT_PPE1, ++ FE_PSE_PORT_CDM2, ++ FE_PSE_PORT_CDM3, ++ FE_PSE_PORT_CDM4, ++ FE_PSE_PORT_PPE2, ++ FE_PSE_PORT_GDM4, ++ FE_PSE_PORT_CDM5, ++ FE_PSE_PORT_DROP = 0xf, ++}; ++ ++enum tx_sched_mode { ++ TC_SCH_WRR8, ++ TC_SCH_SP, ++ TC_SCH_WRR7, ++ TC_SCH_WRR6, ++ TC_SCH_WRR5, ++ TC_SCH_WRR4, ++ TC_SCH_WRR3, ++ TC_SCH_WRR2, ++}; ++ ++enum trtcm_param_type { ++ TRTCM_MISC_MODE, /* meter_en, pps_mode, tick_sel */ ++ TRTCM_TOKEN_RATE_MODE, ++ TRTCM_BUCKETSIZE_SHIFT_MODE, ++ TRTCM_BUCKET_COUNTER_MODE, ++}; ++ ++enum trtcm_mode_type { ++ TRTCM_COMMIT_MODE, ++ TRTCM_PEAK_MODE, ++}; ++ ++enum trtcm_param { ++ TRTCM_TICK_SEL = BIT(0), ++ TRTCM_PKT_MODE = BIT(1), ++ TRTCM_METER_MODE = BIT(2), ++}; ++ ++#define MIN_TOKEN_SIZE 4096 ++#define MAX_TOKEN_SIZE_OFFSET 17 ++#define TRTCM_TOKEN_RATE_MASK GENMASK(23, 6) ++#define TRTCM_TOKEN_RATE_FRACTION_MASK GENMASK(5, 0) ++ ++struct airoha_queue_entry { ++ union { ++ void *buf; ++ struct sk_buff *skb; ++ }; ++ dma_addr_t dma_addr; ++ u16 dma_len; ++}; ++ ++struct airoha_queue { ++ struct airoha_qdma *qdma; ++ ++ /* protect concurrent queue accesses */ ++ spinlock_t lock; ++ struct airoha_queue_entry *entry; ++ struct airoha_qdma_desc *desc; ++ u16 head; ++ u16 tail; ++ ++ int queued; ++ int ndesc; ++ int free_thr; ++ int buf_size; ++ ++ struct napi_struct napi; ++ struct page_pool *page_pool; ++}; ++ ++struct airoha_tx_irq_queue { ++ struct airoha_qdma *qdma; ++ ++ struct napi_struct napi; ++ ++ int size; ++ u32 *q; ++}; ++ ++struct airoha_hw_stats { ++ /* protect concurrent hw_stats accesses */ ++ spinlock_t lock; ++ struct u64_stats_sync syncp; ++ ++ /* get_stats64 */ ++ u64 rx_ok_pkts; ++ u64 tx_ok_pkts; ++ u64 rx_ok_bytes; ++ u64 tx_ok_bytes; ++ u64 rx_multicast; ++ u64 rx_errors; ++ u64 rx_drops; ++ u64 tx_drops; ++ u64 rx_crc_error; ++ u64 rx_over_errors; ++ /* ethtool stats */ ++ u64 tx_broadcast; ++ u64 tx_multicast; ++ u64 tx_len[7]; ++ u64 rx_broadcast; ++ u64 rx_fragment; ++ u64 rx_jabber; ++ u64 rx_len[7]; ++}; ++ ++struct airoha_qdma { ++ struct airoha_eth *eth; ++ void __iomem *regs; ++ ++ /* protect concurrent irqmask accesses */ ++ spinlock_t irq_lock; ++ u32 irqmask[QDMA_INT_REG_MAX]; ++ int irq; ++ ++ struct airoha_tx_irq_queue q_tx_irq[AIROHA_NUM_TX_IRQ]; ++ ++ struct airoha_queue q_tx[AIROHA_NUM_TX_RING]; ++ struct airoha_queue q_rx[AIROHA_NUM_RX_RING]; ++ ++ /* descriptor and packet buffers for qdma hw forward */ ++ struct { ++ void *desc; ++ void *q; ++ } hfwd; ++}; ++ ++struct airoha_gdm_port { ++ struct airoha_qdma *qdma; ++ struct net_device *dev; ++ int id; ++ ++ struct airoha_hw_stats stats; ++ ++ DECLARE_BITMAP(qos_sq_bmap, AIROHA_NUM_QOS_CHANNELS); ++ ++ /* qos stats counters */ ++ u64 cpu_tx_packets; ++ u64 fwd_tx_packets; ++}; ++ ++struct airoha_eth { ++ struct device *dev; ++ ++ unsigned long state; ++ void __iomem *fe_regs; ++ ++ struct reset_control_bulk_data rsts[AIROHA_MAX_NUM_RSTS]; ++ struct reset_control_bulk_data xsi_rsts[AIROHA_MAX_NUM_XSI_RSTS]; ++ ++ struct net_device *napi_dev; ++ ++ struct airoha_qdma qdma[AIROHA_MAX_NUM_QDMA]; ++ struct airoha_gdm_port *ports[AIROHA_MAX_NUM_GDM_PORTS]; ++}; ++ ++static u32 airoha_rr(void __iomem *base, u32 offset) ++{ ++ return readl(base + offset); ++} ++ ++static void airoha_wr(void __iomem *base, u32 offset, u32 val) ++{ ++ writel(val, base + offset); ++} ++ ++static u32 airoha_rmw(void __iomem *base, u32 offset, u32 mask, u32 val) ++{ ++ val |= (airoha_rr(base, offset) & ~mask); ++ airoha_wr(base, offset, val); ++ ++ return val; ++} ++ ++#define airoha_fe_rr(eth, offset) \ ++ airoha_rr((eth)->fe_regs, (offset)) ++#define airoha_fe_wr(eth, offset, val) \ ++ airoha_wr((eth)->fe_regs, (offset), (val)) ++#define airoha_fe_rmw(eth, offset, mask, val) \ ++ airoha_rmw((eth)->fe_regs, (offset), (mask), (val)) ++#define airoha_fe_set(eth, offset, val) \ ++ airoha_rmw((eth)->fe_regs, (offset), 0, (val)) ++#define airoha_fe_clear(eth, offset, val) \ ++ airoha_rmw((eth)->fe_regs, (offset), (val), 0) ++ ++#define airoha_qdma_rr(qdma, offset) \ ++ airoha_rr((qdma)->regs, (offset)) ++#define airoha_qdma_wr(qdma, offset, val) \ ++ airoha_wr((qdma)->regs, (offset), (val)) ++#define airoha_qdma_rmw(qdma, offset, mask, val) \ ++ airoha_rmw((qdma)->regs, (offset), (mask), (val)) ++#define airoha_qdma_set(qdma, offset, val) \ ++ airoha_rmw((qdma)->regs, (offset), 0, (val)) ++#define airoha_qdma_clear(qdma, offset, val) \ ++ airoha_rmw((qdma)->regs, (offset), (val), 0) ++ ++static void airoha_qdma_set_irqmask(struct airoha_qdma *qdma, int index, ++ u32 clear, u32 set) ++{ ++ unsigned long flags; ++ ++ if (WARN_ON_ONCE(index >= ARRAY_SIZE(qdma->irqmask))) ++ return; ++ ++ spin_lock_irqsave(&qdma->irq_lock, flags); ++ ++ qdma->irqmask[index] &= ~clear; ++ qdma->irqmask[index] |= set; ++ airoha_qdma_wr(qdma, REG_INT_ENABLE(index), qdma->irqmask[index]); ++ /* Read irq_enable register in order to guarantee the update above ++ * completes in the spinlock critical section. ++ */ ++ airoha_qdma_rr(qdma, REG_INT_ENABLE(index)); ++ ++ spin_unlock_irqrestore(&qdma->irq_lock, flags); ++} ++ ++static void airoha_qdma_irq_enable(struct airoha_qdma *qdma, int index, ++ u32 mask) ++{ ++ airoha_qdma_set_irqmask(qdma, index, 0, mask); ++} ++ ++static void airoha_qdma_irq_disable(struct airoha_qdma *qdma, int index, ++ u32 mask) ++{ ++ airoha_qdma_set_irqmask(qdma, index, mask, 0); ++} ++ ++static bool airhoa_is_lan_gdm_port(struct airoha_gdm_port *port) ++{ ++ /* GDM1 port on EN7581 SoC is connected to the lan dsa switch. ++ * GDM{2,3,4} can be used as wan port connected to an external ++ * phy module. ++ */ ++ return port->id == 1; ++} ++ ++static void airoha_set_macaddr(struct airoha_gdm_port *port, const u8 *addr) ++{ ++ struct airoha_eth *eth = port->qdma->eth; ++ u32 val, reg; ++ ++ reg = airhoa_is_lan_gdm_port(port) ? REG_FE_LAN_MAC_H ++ : REG_FE_WAN_MAC_H; ++ val = (addr[0] << 16) | (addr[1] << 8) | addr[2]; ++ airoha_fe_wr(eth, reg, val); ++ ++ val = (addr[3] << 16) | (addr[4] << 8) | addr[5]; ++ airoha_fe_wr(eth, REG_FE_MAC_LMIN(reg), val); ++ airoha_fe_wr(eth, REG_FE_MAC_LMAX(reg), val); ++} ++ ++static void airoha_set_gdm_port_fwd_cfg(struct airoha_eth *eth, u32 addr, ++ u32 val) ++{ ++ airoha_fe_rmw(eth, addr, GDM_OCFQ_MASK, ++ FIELD_PREP(GDM_OCFQ_MASK, val)); ++ airoha_fe_rmw(eth, addr, GDM_MCFQ_MASK, ++ FIELD_PREP(GDM_MCFQ_MASK, val)); ++ airoha_fe_rmw(eth, addr, GDM_BCFQ_MASK, ++ FIELD_PREP(GDM_BCFQ_MASK, val)); ++ airoha_fe_rmw(eth, addr, GDM_UCFQ_MASK, ++ FIELD_PREP(GDM_UCFQ_MASK, val)); ++} ++ ++static int airoha_set_gdm_port(struct airoha_eth *eth, int port, bool enable) ++{ ++ u32 val = enable ? FE_PSE_PORT_PPE1 : FE_PSE_PORT_DROP; ++ u32 vip_port, cfg_addr; ++ ++ switch (port) { ++ case XSI_PCIE0_PORT: ++ vip_port = XSI_PCIE0_VIP_PORT_MASK; ++ cfg_addr = REG_GDM_FWD_CFG(3); ++ break; ++ case XSI_PCIE1_PORT: ++ vip_port = XSI_PCIE1_VIP_PORT_MASK; ++ cfg_addr = REG_GDM_FWD_CFG(3); ++ break; ++ case XSI_USB_PORT: ++ vip_port = XSI_USB_VIP_PORT_MASK; ++ cfg_addr = REG_GDM_FWD_CFG(4); ++ break; ++ case XSI_ETH_PORT: ++ vip_port = XSI_ETH_VIP_PORT_MASK; ++ cfg_addr = REG_GDM_FWD_CFG(4); ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ if (enable) { ++ airoha_fe_set(eth, REG_FE_VIP_PORT_EN, vip_port); ++ airoha_fe_set(eth, REG_FE_IFC_PORT_EN, vip_port); ++ } else { ++ airoha_fe_clear(eth, REG_FE_VIP_PORT_EN, vip_port); ++ airoha_fe_clear(eth, REG_FE_IFC_PORT_EN, vip_port); ++ } ++ ++ airoha_set_gdm_port_fwd_cfg(eth, cfg_addr, val); ++ ++ return 0; ++} ++ ++static int airoha_set_gdm_ports(struct airoha_eth *eth, bool enable) ++{ ++ const int port_list[] = { ++ XSI_PCIE0_PORT, ++ XSI_PCIE1_PORT, ++ XSI_USB_PORT, ++ XSI_ETH_PORT ++ }; ++ int i, err; ++ ++ for (i = 0; i < ARRAY_SIZE(port_list); i++) { ++ err = airoha_set_gdm_port(eth, port_list[i], enable); ++ if (err) ++ goto error; ++ } ++ ++ return 0; ++ ++error: ++ for (i--; i >= 0; i--) ++ airoha_set_gdm_port(eth, port_list[i], false); ++ ++ return err; ++} ++ ++static void airoha_fe_maccr_init(struct airoha_eth *eth) ++{ ++ int p; ++ ++ for (p = 1; p <= ARRAY_SIZE(eth->ports); p++) { ++ airoha_fe_set(eth, REG_GDM_FWD_CFG(p), ++ GDM_TCP_CKSUM | GDM_UDP_CKSUM | GDM_IP4_CKSUM | ++ GDM_DROP_CRC_ERR); ++ airoha_set_gdm_port_fwd_cfg(eth, REG_GDM_FWD_CFG(p), ++ FE_PSE_PORT_CDM1); ++ airoha_fe_rmw(eth, REG_GDM_LEN_CFG(p), ++ GDM_SHORT_LEN_MASK | GDM_LONG_LEN_MASK, ++ FIELD_PREP(GDM_SHORT_LEN_MASK, 60) | ++ FIELD_PREP(GDM_LONG_LEN_MASK, 4004)); ++ } ++ ++ airoha_fe_rmw(eth, REG_CDM1_VLAN_CTRL, CDM1_VLAN_MASK, ++ FIELD_PREP(CDM1_VLAN_MASK, 0x8100)); ++ ++ airoha_fe_set(eth, REG_FE_CPORT_CFG, FE_CPORT_PAD); ++} ++ ++static void airoha_fe_vip_setup(struct airoha_eth *eth) ++{ ++ airoha_fe_wr(eth, REG_FE_VIP_PATN(3), ETH_P_PPP_DISC); ++ airoha_fe_wr(eth, REG_FE_VIP_EN(3), PATN_FCPU_EN_MASK | PATN_EN_MASK); ++ ++ airoha_fe_wr(eth, REG_FE_VIP_PATN(4), PPP_LCP); ++ airoha_fe_wr(eth, REG_FE_VIP_EN(4), ++ PATN_FCPU_EN_MASK | FIELD_PREP(PATN_TYPE_MASK, 1) | ++ PATN_EN_MASK); ++ ++ airoha_fe_wr(eth, REG_FE_VIP_PATN(6), PPP_IPCP); ++ airoha_fe_wr(eth, REG_FE_VIP_EN(6), ++ PATN_FCPU_EN_MASK | FIELD_PREP(PATN_TYPE_MASK, 1) | ++ PATN_EN_MASK); ++ ++ airoha_fe_wr(eth, REG_FE_VIP_PATN(7), PPP_CHAP); ++ airoha_fe_wr(eth, REG_FE_VIP_EN(7), ++ PATN_FCPU_EN_MASK | FIELD_PREP(PATN_TYPE_MASK, 1) | ++ PATN_EN_MASK); ++ ++ /* BOOTP (0x43) */ ++ airoha_fe_wr(eth, REG_FE_VIP_PATN(8), 0x43); ++ airoha_fe_wr(eth, REG_FE_VIP_EN(8), ++ PATN_FCPU_EN_MASK | PATN_SP_EN_MASK | ++ FIELD_PREP(PATN_TYPE_MASK, 4) | PATN_EN_MASK); ++ ++ /* BOOTP (0x44) */ ++ airoha_fe_wr(eth, REG_FE_VIP_PATN(9), 0x44); ++ airoha_fe_wr(eth, REG_FE_VIP_EN(9), ++ PATN_FCPU_EN_MASK | PATN_SP_EN_MASK | ++ FIELD_PREP(PATN_TYPE_MASK, 4) | PATN_EN_MASK); ++ ++ /* ISAKMP */ ++ airoha_fe_wr(eth, REG_FE_VIP_PATN(10), 0x1f401f4); ++ airoha_fe_wr(eth, REG_FE_VIP_EN(10), ++ PATN_FCPU_EN_MASK | PATN_DP_EN_MASK | PATN_SP_EN_MASK | ++ FIELD_PREP(PATN_TYPE_MASK, 4) | PATN_EN_MASK); ++ ++ airoha_fe_wr(eth, REG_FE_VIP_PATN(11), PPP_IPV6CP); ++ airoha_fe_wr(eth, REG_FE_VIP_EN(11), ++ PATN_FCPU_EN_MASK | FIELD_PREP(PATN_TYPE_MASK, 1) | ++ PATN_EN_MASK); ++ ++ /* DHCPv6 */ ++ airoha_fe_wr(eth, REG_FE_VIP_PATN(12), 0x2220223); ++ airoha_fe_wr(eth, REG_FE_VIP_EN(12), ++ PATN_FCPU_EN_MASK | PATN_DP_EN_MASK | PATN_SP_EN_MASK | ++ FIELD_PREP(PATN_TYPE_MASK, 4) | PATN_EN_MASK); ++ ++ airoha_fe_wr(eth, REG_FE_VIP_PATN(19), PPP_PAP); ++ airoha_fe_wr(eth, REG_FE_VIP_EN(19), ++ PATN_FCPU_EN_MASK | FIELD_PREP(PATN_TYPE_MASK, 1) | ++ PATN_EN_MASK); ++ ++ /* ETH->ETH_P_1905 (0x893a) */ ++ airoha_fe_wr(eth, REG_FE_VIP_PATN(20), 0x893a); ++ airoha_fe_wr(eth, REG_FE_VIP_EN(20), ++ PATN_FCPU_EN_MASK | PATN_EN_MASK); ++ ++ airoha_fe_wr(eth, REG_FE_VIP_PATN(21), ETH_P_LLDP); ++ airoha_fe_wr(eth, REG_FE_VIP_EN(21), ++ PATN_FCPU_EN_MASK | PATN_EN_MASK); ++} ++ ++static u32 airoha_fe_get_pse_queue_rsv_pages(struct airoha_eth *eth, ++ u32 port, u32 queue) ++{ ++ u32 val; ++ ++ airoha_fe_rmw(eth, REG_FE_PSE_QUEUE_CFG_WR, ++ PSE_CFG_PORT_ID_MASK | PSE_CFG_QUEUE_ID_MASK, ++ FIELD_PREP(PSE_CFG_PORT_ID_MASK, port) | ++ FIELD_PREP(PSE_CFG_QUEUE_ID_MASK, queue)); ++ val = airoha_fe_rr(eth, REG_FE_PSE_QUEUE_CFG_VAL); ++ ++ return FIELD_GET(PSE_CFG_OQ_RSV_MASK, val); ++} ++ ++static void airoha_fe_set_pse_queue_rsv_pages(struct airoha_eth *eth, ++ u32 port, u32 queue, u32 val) ++{ ++ airoha_fe_rmw(eth, REG_FE_PSE_QUEUE_CFG_VAL, PSE_CFG_OQ_RSV_MASK, ++ FIELD_PREP(PSE_CFG_OQ_RSV_MASK, val)); ++ airoha_fe_rmw(eth, REG_FE_PSE_QUEUE_CFG_WR, ++ PSE_CFG_PORT_ID_MASK | PSE_CFG_QUEUE_ID_MASK | ++ PSE_CFG_WR_EN_MASK | PSE_CFG_OQRSV_SEL_MASK, ++ FIELD_PREP(PSE_CFG_PORT_ID_MASK, port) | ++ FIELD_PREP(PSE_CFG_QUEUE_ID_MASK, queue) | ++ PSE_CFG_WR_EN_MASK | PSE_CFG_OQRSV_SEL_MASK); ++} ++ ++static u32 airoha_fe_get_pse_all_rsv(struct airoha_eth *eth) ++{ ++ u32 val = airoha_fe_rr(eth, REG_FE_PSE_BUF_SET); ++ ++ return FIELD_GET(PSE_ALLRSV_MASK, val); ++} ++ ++static int airoha_fe_set_pse_oq_rsv(struct airoha_eth *eth, ++ u32 port, u32 queue, u32 val) ++{ ++ u32 orig_val = airoha_fe_get_pse_queue_rsv_pages(eth, port, queue); ++ u32 tmp, all_rsv, fq_limit; ++ ++ airoha_fe_set_pse_queue_rsv_pages(eth, port, queue, val); ++ ++ /* modify all rsv */ ++ all_rsv = airoha_fe_get_pse_all_rsv(eth); ++ all_rsv += (val - orig_val); ++ airoha_fe_rmw(eth, REG_FE_PSE_BUF_SET, PSE_ALLRSV_MASK, ++ FIELD_PREP(PSE_ALLRSV_MASK, all_rsv)); ++ ++ /* modify hthd */ ++ tmp = airoha_fe_rr(eth, PSE_FQ_CFG); ++ fq_limit = FIELD_GET(PSE_FQ_LIMIT_MASK, tmp); ++ tmp = fq_limit - all_rsv - 0x20; ++ airoha_fe_rmw(eth, REG_PSE_SHARE_USED_THD, ++ PSE_SHARE_USED_HTHD_MASK, ++ FIELD_PREP(PSE_SHARE_USED_HTHD_MASK, tmp)); ++ ++ tmp = fq_limit - all_rsv - 0x100; ++ airoha_fe_rmw(eth, REG_PSE_SHARE_USED_THD, ++ PSE_SHARE_USED_MTHD_MASK, ++ FIELD_PREP(PSE_SHARE_USED_MTHD_MASK, tmp)); ++ tmp = (3 * tmp) >> 2; ++ airoha_fe_rmw(eth, REG_FE_PSE_BUF_SET, ++ PSE_SHARE_USED_LTHD_MASK, ++ FIELD_PREP(PSE_SHARE_USED_LTHD_MASK, tmp)); ++ ++ return 0; ++} ++ ++static void airoha_fe_pse_ports_init(struct airoha_eth *eth) ++{ ++ const u32 pse_port_num_queues[] = { ++ [FE_PSE_PORT_CDM1] = 6, ++ [FE_PSE_PORT_GDM1] = 6, ++ [FE_PSE_PORT_GDM2] = 32, ++ [FE_PSE_PORT_GDM3] = 6, ++ [FE_PSE_PORT_PPE1] = 4, ++ [FE_PSE_PORT_CDM2] = 6, ++ [FE_PSE_PORT_CDM3] = 8, ++ [FE_PSE_PORT_CDM4] = 10, ++ [FE_PSE_PORT_PPE2] = 4, ++ [FE_PSE_PORT_GDM4] = 2, ++ [FE_PSE_PORT_CDM5] = 2, ++ }; ++ u32 all_rsv; ++ int q; ++ ++ all_rsv = airoha_fe_get_pse_all_rsv(eth); ++ /* hw misses PPE2 oq rsv */ ++ all_rsv += PSE_RSV_PAGES * pse_port_num_queues[FE_PSE_PORT_PPE2]; ++ airoha_fe_set(eth, REG_FE_PSE_BUF_SET, all_rsv); ++ ++ /* CMD1 */ ++ for (q = 0; q < pse_port_num_queues[FE_PSE_PORT_CDM1]; q++) ++ airoha_fe_set_pse_oq_rsv(eth, FE_PSE_PORT_CDM1, q, ++ PSE_QUEUE_RSV_PAGES); ++ /* GMD1 */ ++ for (q = 0; q < pse_port_num_queues[FE_PSE_PORT_GDM1]; q++) ++ airoha_fe_set_pse_oq_rsv(eth, FE_PSE_PORT_GDM1, q, ++ PSE_QUEUE_RSV_PAGES); ++ /* GMD2 */ ++ for (q = 6; q < pse_port_num_queues[FE_PSE_PORT_GDM2]; q++) ++ airoha_fe_set_pse_oq_rsv(eth, FE_PSE_PORT_GDM2, q, 0); ++ /* GMD3 */ ++ for (q = 0; q < pse_port_num_queues[FE_PSE_PORT_GDM3]; q++) ++ airoha_fe_set_pse_oq_rsv(eth, FE_PSE_PORT_GDM3, q, ++ PSE_QUEUE_RSV_PAGES); ++ /* PPE1 */ ++ for (q = 0; q < pse_port_num_queues[FE_PSE_PORT_PPE1]; q++) { ++ if (q < pse_port_num_queues[FE_PSE_PORT_PPE1]) ++ airoha_fe_set_pse_oq_rsv(eth, FE_PSE_PORT_PPE1, q, ++ PSE_QUEUE_RSV_PAGES); ++ else ++ airoha_fe_set_pse_oq_rsv(eth, FE_PSE_PORT_PPE1, q, 0); ++ } ++ /* CDM2 */ ++ for (q = 0; q < pse_port_num_queues[FE_PSE_PORT_CDM2]; q++) ++ airoha_fe_set_pse_oq_rsv(eth, FE_PSE_PORT_CDM2, q, ++ PSE_QUEUE_RSV_PAGES); ++ /* CDM3 */ ++ for (q = 0; q < pse_port_num_queues[FE_PSE_PORT_CDM3] - 1; q++) ++ airoha_fe_set_pse_oq_rsv(eth, FE_PSE_PORT_CDM3, q, 0); ++ /* CDM4 */ ++ for (q = 4; q < pse_port_num_queues[FE_PSE_PORT_CDM4]; q++) ++ airoha_fe_set_pse_oq_rsv(eth, FE_PSE_PORT_CDM4, q, ++ PSE_QUEUE_RSV_PAGES); ++ /* PPE2 */ ++ for (q = 0; q < pse_port_num_queues[FE_PSE_PORT_PPE2]; q++) { ++ if (q < pse_port_num_queues[FE_PSE_PORT_PPE2] / 2) ++ airoha_fe_set_pse_oq_rsv(eth, FE_PSE_PORT_PPE2, q, ++ PSE_QUEUE_RSV_PAGES); ++ else ++ airoha_fe_set_pse_oq_rsv(eth, FE_PSE_PORT_PPE2, q, 0); ++ } ++ /* GMD4 */ ++ for (q = 0; q < pse_port_num_queues[FE_PSE_PORT_GDM4]; q++) ++ airoha_fe_set_pse_oq_rsv(eth, FE_PSE_PORT_GDM4, q, ++ PSE_QUEUE_RSV_PAGES); ++ /* CDM5 */ ++ for (q = 0; q < pse_port_num_queues[FE_PSE_PORT_CDM5]; q++) ++ airoha_fe_set_pse_oq_rsv(eth, FE_PSE_PORT_CDM5, q, ++ PSE_QUEUE_RSV_PAGES); ++} ++ ++static int airoha_fe_mc_vlan_clear(struct airoha_eth *eth) ++{ ++ int i; ++ ++ for (i = 0; i < AIROHA_FE_MC_MAX_VLAN_TABLE; i++) { ++ int err, j; ++ u32 val; ++ ++ airoha_fe_wr(eth, REG_MC_VLAN_DATA, 0x0); ++ ++ val = FIELD_PREP(MC_VLAN_CFG_TABLE_ID_MASK, i) | ++ MC_VLAN_CFG_TABLE_SEL_MASK | MC_VLAN_CFG_RW_MASK; ++ airoha_fe_wr(eth, REG_MC_VLAN_CFG, val); ++ err = read_poll_timeout(airoha_fe_rr, val, ++ val & MC_VLAN_CFG_CMD_DONE_MASK, ++ USEC_PER_MSEC, 5 * USEC_PER_MSEC, ++ false, eth, REG_MC_VLAN_CFG); ++ if (err) ++ return err; ++ ++ for (j = 0; j < AIROHA_FE_MC_MAX_VLAN_PORT; j++) { ++ airoha_fe_wr(eth, REG_MC_VLAN_DATA, 0x0); ++ ++ val = FIELD_PREP(MC_VLAN_CFG_TABLE_ID_MASK, i) | ++ FIELD_PREP(MC_VLAN_CFG_PORT_ID_MASK, j) | ++ MC_VLAN_CFG_RW_MASK; ++ airoha_fe_wr(eth, REG_MC_VLAN_CFG, val); ++ err = read_poll_timeout(airoha_fe_rr, val, ++ val & MC_VLAN_CFG_CMD_DONE_MASK, ++ USEC_PER_MSEC, ++ 5 * USEC_PER_MSEC, false, eth, ++ REG_MC_VLAN_CFG); ++ if (err) ++ return err; ++ } ++ } ++ ++ return 0; ++} ++ ++static void airoha_fe_crsn_qsel_init(struct airoha_eth *eth) ++{ ++ /* CDM1_CRSN_QSEL */ ++ airoha_fe_rmw(eth, REG_CDM1_CRSN_QSEL(CRSN_22 >> 2), ++ CDM1_CRSN_QSEL_REASON_MASK(CRSN_22), ++ FIELD_PREP(CDM1_CRSN_QSEL_REASON_MASK(CRSN_22), ++ CDM_CRSN_QSEL_Q1)); ++ airoha_fe_rmw(eth, REG_CDM1_CRSN_QSEL(CRSN_08 >> 2), ++ CDM1_CRSN_QSEL_REASON_MASK(CRSN_08), ++ FIELD_PREP(CDM1_CRSN_QSEL_REASON_MASK(CRSN_08), ++ CDM_CRSN_QSEL_Q1)); ++ airoha_fe_rmw(eth, REG_CDM1_CRSN_QSEL(CRSN_21 >> 2), ++ CDM1_CRSN_QSEL_REASON_MASK(CRSN_21), ++ FIELD_PREP(CDM1_CRSN_QSEL_REASON_MASK(CRSN_21), ++ CDM_CRSN_QSEL_Q1)); ++ airoha_fe_rmw(eth, REG_CDM1_CRSN_QSEL(CRSN_24 >> 2), ++ CDM1_CRSN_QSEL_REASON_MASK(CRSN_24), ++ FIELD_PREP(CDM1_CRSN_QSEL_REASON_MASK(CRSN_24), ++ CDM_CRSN_QSEL_Q6)); ++ airoha_fe_rmw(eth, REG_CDM1_CRSN_QSEL(CRSN_25 >> 2), ++ CDM1_CRSN_QSEL_REASON_MASK(CRSN_25), ++ FIELD_PREP(CDM1_CRSN_QSEL_REASON_MASK(CRSN_25), ++ CDM_CRSN_QSEL_Q1)); ++ /* CDM2_CRSN_QSEL */ ++ airoha_fe_rmw(eth, REG_CDM2_CRSN_QSEL(CRSN_08 >> 2), ++ CDM2_CRSN_QSEL_REASON_MASK(CRSN_08), ++ FIELD_PREP(CDM2_CRSN_QSEL_REASON_MASK(CRSN_08), ++ CDM_CRSN_QSEL_Q1)); ++ airoha_fe_rmw(eth, REG_CDM2_CRSN_QSEL(CRSN_21 >> 2), ++ CDM2_CRSN_QSEL_REASON_MASK(CRSN_21), ++ FIELD_PREP(CDM2_CRSN_QSEL_REASON_MASK(CRSN_21), ++ CDM_CRSN_QSEL_Q1)); ++ airoha_fe_rmw(eth, REG_CDM2_CRSN_QSEL(CRSN_22 >> 2), ++ CDM2_CRSN_QSEL_REASON_MASK(CRSN_22), ++ FIELD_PREP(CDM2_CRSN_QSEL_REASON_MASK(CRSN_22), ++ CDM_CRSN_QSEL_Q1)); ++ airoha_fe_rmw(eth, REG_CDM2_CRSN_QSEL(CRSN_24 >> 2), ++ CDM2_CRSN_QSEL_REASON_MASK(CRSN_24), ++ FIELD_PREP(CDM2_CRSN_QSEL_REASON_MASK(CRSN_24), ++ CDM_CRSN_QSEL_Q6)); ++ airoha_fe_rmw(eth, REG_CDM2_CRSN_QSEL(CRSN_25 >> 2), ++ CDM2_CRSN_QSEL_REASON_MASK(CRSN_25), ++ FIELD_PREP(CDM2_CRSN_QSEL_REASON_MASK(CRSN_25), ++ CDM_CRSN_QSEL_Q1)); ++} ++ ++static int airoha_fe_init(struct airoha_eth *eth) ++{ ++ airoha_fe_maccr_init(eth); ++ ++ /* PSE IQ reserve */ ++ airoha_fe_rmw(eth, REG_PSE_IQ_REV1, PSE_IQ_RES1_P2_MASK, ++ FIELD_PREP(PSE_IQ_RES1_P2_MASK, 0x10)); ++ airoha_fe_rmw(eth, REG_PSE_IQ_REV2, ++ PSE_IQ_RES2_P5_MASK | PSE_IQ_RES2_P4_MASK, ++ FIELD_PREP(PSE_IQ_RES2_P5_MASK, 0x40) | ++ FIELD_PREP(PSE_IQ_RES2_P4_MASK, 0x34)); ++ ++ /* enable FE copy engine for MC/KA/DPI */ ++ airoha_fe_wr(eth, REG_FE_PCE_CFG, ++ PCE_DPI_EN_MASK | PCE_KA_EN_MASK | PCE_MC_EN_MASK); ++ /* set vip queue selection to ring 1 */ ++ airoha_fe_rmw(eth, REG_CDM1_FWD_CFG, CDM1_VIP_QSEL_MASK, ++ FIELD_PREP(CDM1_VIP_QSEL_MASK, 0x4)); ++ airoha_fe_rmw(eth, REG_CDM2_FWD_CFG, CDM2_VIP_QSEL_MASK, ++ FIELD_PREP(CDM2_VIP_QSEL_MASK, 0x4)); ++ /* set GDM4 source interface offset to 8 */ ++ airoha_fe_rmw(eth, REG_GDM4_SRC_PORT_SET, ++ GDM4_SPORT_OFF2_MASK | ++ GDM4_SPORT_OFF1_MASK | ++ GDM4_SPORT_OFF0_MASK, ++ FIELD_PREP(GDM4_SPORT_OFF2_MASK, 8) | ++ FIELD_PREP(GDM4_SPORT_OFF1_MASK, 8) | ++ FIELD_PREP(GDM4_SPORT_OFF0_MASK, 8)); ++ ++ /* set PSE Page as 128B */ ++ airoha_fe_rmw(eth, REG_FE_DMA_GLO_CFG, ++ FE_DMA_GLO_L2_SPACE_MASK | FE_DMA_GLO_PG_SZ_MASK, ++ FIELD_PREP(FE_DMA_GLO_L2_SPACE_MASK, 2) | ++ FE_DMA_GLO_PG_SZ_MASK); ++ airoha_fe_wr(eth, REG_FE_RST_GLO_CFG, ++ FE_RST_CORE_MASK | FE_RST_GDM3_MBI_ARB_MASK | ++ FE_RST_GDM4_MBI_ARB_MASK); ++ usleep_range(1000, 2000); ++ ++ /* connect RxRing1 and RxRing15 to PSE Port0 OQ-1 ++ * connect other rings to PSE Port0 OQ-0 ++ */ ++ airoha_fe_wr(eth, REG_FE_CDM1_OQ_MAP0, BIT(4)); ++ airoha_fe_wr(eth, REG_FE_CDM1_OQ_MAP1, BIT(28)); ++ airoha_fe_wr(eth, REG_FE_CDM1_OQ_MAP2, BIT(4)); ++ airoha_fe_wr(eth, REG_FE_CDM1_OQ_MAP3, BIT(28)); ++ ++ airoha_fe_vip_setup(eth); ++ airoha_fe_pse_ports_init(eth); ++ ++ airoha_fe_set(eth, REG_GDM_MISC_CFG, ++ GDM2_RDM_ACK_WAIT_PREF_MASK | ++ GDM2_CHN_VLD_MODE_MASK); ++ airoha_fe_rmw(eth, REG_CDM2_FWD_CFG, CDM2_OAM_QSEL_MASK, ++ FIELD_PREP(CDM2_OAM_QSEL_MASK, 15)); ++ ++ /* init fragment and assemble Force Port */ ++ /* NPU Core-3, NPU Bridge Channel-3 */ ++ airoha_fe_rmw(eth, REG_IP_FRAG_FP, ++ IP_FRAGMENT_PORT_MASK | IP_FRAGMENT_NBQ_MASK, ++ FIELD_PREP(IP_FRAGMENT_PORT_MASK, 6) | ++ FIELD_PREP(IP_FRAGMENT_NBQ_MASK, 3)); ++ /* QDMA LAN, RX Ring-22 */ ++ airoha_fe_rmw(eth, REG_IP_FRAG_FP, ++ IP_ASSEMBLE_PORT_MASK | IP_ASSEMBLE_NBQ_MASK, ++ FIELD_PREP(IP_ASSEMBLE_PORT_MASK, 0) | ++ FIELD_PREP(IP_ASSEMBLE_NBQ_MASK, 22)); ++ ++ airoha_fe_set(eth, REG_GDM3_FWD_CFG, GDM3_PAD_EN_MASK); ++ airoha_fe_set(eth, REG_GDM4_FWD_CFG, GDM4_PAD_EN_MASK); ++ ++ airoha_fe_crsn_qsel_init(eth); ++ ++ airoha_fe_clear(eth, REG_FE_CPORT_CFG, FE_CPORT_QUEUE_XFC_MASK); ++ airoha_fe_set(eth, REG_FE_CPORT_CFG, FE_CPORT_PORT_XFC_MASK); ++ ++ /* default aging mode for mbi unlock issue */ ++ airoha_fe_rmw(eth, REG_GDM2_CHN_RLS, ++ MBI_RX_AGE_SEL_MASK | MBI_TX_AGE_SEL_MASK, ++ FIELD_PREP(MBI_RX_AGE_SEL_MASK, 3) | ++ FIELD_PREP(MBI_TX_AGE_SEL_MASK, 3)); ++ ++ /* disable IFC by default */ ++ airoha_fe_clear(eth, REG_FE_CSR_IFC_CFG, FE_IFC_EN_MASK); ++ ++ /* enable 1:N vlan action, init vlan table */ ++ airoha_fe_set(eth, REG_MC_VLAN_EN, MC_VLAN_EN_MASK); ++ ++ return airoha_fe_mc_vlan_clear(eth); ++} ++ ++static int airoha_qdma_fill_rx_queue(struct airoha_queue *q) ++{ ++ enum dma_data_direction dir = page_pool_get_dma_dir(q->page_pool); ++ struct airoha_qdma *qdma = q->qdma; ++ struct airoha_eth *eth = qdma->eth; ++ int qid = q - &qdma->q_rx[0]; ++ int nframes = 0; ++ ++ while (q->queued < q->ndesc - 1) { ++ struct airoha_queue_entry *e = &q->entry[q->head]; ++ struct airoha_qdma_desc *desc = &q->desc[q->head]; ++ struct page *page; ++ int offset; ++ u32 val; ++ ++ page = page_pool_dev_alloc_frag(q->page_pool, &offset, ++ q->buf_size); ++ if (!page) ++ break; ++ ++ q->head = (q->head + 1) % q->ndesc; ++ q->queued++; ++ nframes++; ++ ++ e->buf = page_address(page) + offset; ++ e->dma_addr = page_pool_get_dma_addr(page) + offset; ++ e->dma_len = SKB_WITH_OVERHEAD(q->buf_size); ++ ++ dma_sync_single_for_device(eth->dev, e->dma_addr, e->dma_len, ++ dir); ++ ++ val = FIELD_PREP(QDMA_DESC_LEN_MASK, e->dma_len); ++ WRITE_ONCE(desc->ctrl, cpu_to_le32(val)); ++ WRITE_ONCE(desc->addr, cpu_to_le32(e->dma_addr)); ++ val = FIELD_PREP(QDMA_DESC_NEXT_ID_MASK, q->head); ++ WRITE_ONCE(desc->data, cpu_to_le32(val)); ++ WRITE_ONCE(desc->msg0, 0); ++ WRITE_ONCE(desc->msg1, 0); ++ WRITE_ONCE(desc->msg2, 0); ++ WRITE_ONCE(desc->msg3, 0); ++ ++ airoha_qdma_rmw(qdma, REG_RX_CPU_IDX(qid), ++ RX_RING_CPU_IDX_MASK, ++ FIELD_PREP(RX_RING_CPU_IDX_MASK, q->head)); ++ } ++ ++ return nframes; ++} ++ ++static int airoha_qdma_get_gdm_port(struct airoha_eth *eth, ++ struct airoha_qdma_desc *desc) ++{ ++ u32 port, sport, msg1 = le32_to_cpu(desc->msg1); ++ ++ sport = FIELD_GET(QDMA_ETH_RXMSG_SPORT_MASK, msg1); ++ switch (sport) { ++ case 0x10 ... 0x13: ++ port = 0; ++ break; ++ case 0x2 ... 0x4: ++ port = sport - 1; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ return port >= ARRAY_SIZE(eth->ports) ? -EINVAL : port; ++} ++ ++static int airoha_qdma_rx_process(struct airoha_queue *q, int budget) ++{ ++ enum dma_data_direction dir = page_pool_get_dma_dir(q->page_pool); ++ struct airoha_qdma *qdma = q->qdma; ++ struct airoha_eth *eth = qdma->eth; ++ int qid = q - &qdma->q_rx[0]; ++ int done = 0; ++ ++ while (done < budget) { ++ struct airoha_queue_entry *e = &q->entry[q->tail]; ++ struct airoha_qdma_desc *desc = &q->desc[q->tail]; ++ dma_addr_t dma_addr = le32_to_cpu(desc->addr); ++ u32 desc_ctrl = le32_to_cpu(desc->ctrl); ++ struct sk_buff *skb; ++ int len, p; ++ ++ if (!(desc_ctrl & QDMA_DESC_DONE_MASK)) ++ break; ++ ++ if (!dma_addr) ++ break; ++ ++ len = FIELD_GET(QDMA_DESC_LEN_MASK, desc_ctrl); ++ if (!len) ++ break; ++ ++ q->tail = (q->tail + 1) % q->ndesc; ++ q->queued--; ++ ++ dma_sync_single_for_cpu(eth->dev, dma_addr, ++ SKB_WITH_OVERHEAD(q->buf_size), dir); ++ ++ p = airoha_qdma_get_gdm_port(eth, desc); ++ if (p < 0 || !eth->ports[p]) { ++ page_pool_put_full_page(q->page_pool, ++ virt_to_head_page(e->buf), ++ true); ++ continue; ++ } ++ ++ skb = napi_build_skb(e->buf, q->buf_size); ++ if (!skb) { ++ page_pool_put_full_page(q->page_pool, ++ virt_to_head_page(e->buf), ++ true); ++ break; ++ } ++ ++ skb_reserve(skb, 2); ++ __skb_put(skb, len); ++ skb_mark_for_recycle(skb); ++ skb->dev = eth->ports[p]->dev; ++ skb->protocol = eth_type_trans(skb, skb->dev); ++ skb->ip_summed = CHECKSUM_UNNECESSARY; ++ skb_record_rx_queue(skb, qid); ++ napi_gro_receive(&q->napi, skb); ++ ++ done++; ++ } ++ airoha_qdma_fill_rx_queue(q); ++ ++ return done; ++} ++ ++static int airoha_qdma_rx_napi_poll(struct napi_struct *napi, int budget) ++{ ++ struct airoha_queue *q = container_of(napi, struct airoha_queue, napi); ++ int cur, done = 0; ++ ++ do { ++ cur = airoha_qdma_rx_process(q, budget - done); ++ done += cur; ++ } while (cur && done < budget); ++ ++ if (done < budget && napi_complete(napi)) ++ airoha_qdma_irq_enable(q->qdma, QDMA_INT_REG_IDX1, ++ RX_DONE_INT_MASK); ++ ++ return done; ++} ++ ++static int airoha_qdma_init_rx_queue(struct airoha_queue *q, ++ struct airoha_qdma *qdma, int ndesc) ++{ ++ const struct page_pool_params pp_params = { ++ .order = 0, ++ .pool_size = 256, ++ .flags = PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV | ++ PP_FLAG_PAGE_FRAG, ++ .dma_dir = DMA_FROM_DEVICE, ++ .max_len = PAGE_SIZE, ++ .nid = NUMA_NO_NODE, ++ .dev = qdma->eth->dev, ++ .napi = &q->napi, ++ }; ++ struct airoha_eth *eth = qdma->eth; ++ int qid = q - &qdma->q_rx[0], thr; ++ dma_addr_t dma_addr; ++ ++ q->buf_size = PAGE_SIZE / 2; ++ q->ndesc = ndesc; ++ q->qdma = qdma; ++ ++ q->entry = devm_kzalloc(eth->dev, q->ndesc * sizeof(*q->entry), ++ GFP_KERNEL); ++ if (!q->entry) ++ return -ENOMEM; ++ ++ q->page_pool = page_pool_create(&pp_params); ++ if (IS_ERR(q->page_pool)) { ++ int err = PTR_ERR(q->page_pool); ++ ++ q->page_pool = NULL; ++ return err; ++ } ++ ++ q->desc = dmam_alloc_coherent(eth->dev, q->ndesc * sizeof(*q->desc), ++ &dma_addr, GFP_KERNEL); ++ if (!q->desc) ++ return -ENOMEM; ++ ++ netif_napi_add(eth->napi_dev, &q->napi, airoha_qdma_rx_napi_poll); ++ ++ airoha_qdma_wr(qdma, REG_RX_RING_BASE(qid), dma_addr); ++ airoha_qdma_rmw(qdma, REG_RX_RING_SIZE(qid), ++ RX_RING_SIZE_MASK, ++ FIELD_PREP(RX_RING_SIZE_MASK, ndesc)); ++ ++ thr = clamp(ndesc >> 3, 1, 32); ++ airoha_qdma_rmw(qdma, REG_RX_RING_SIZE(qid), RX_RING_THR_MASK, ++ FIELD_PREP(RX_RING_THR_MASK, thr)); ++ airoha_qdma_rmw(qdma, REG_RX_DMA_IDX(qid), RX_RING_DMA_IDX_MASK, ++ FIELD_PREP(RX_RING_DMA_IDX_MASK, q->head)); ++ ++ airoha_qdma_fill_rx_queue(q); ++ ++ return 0; ++} ++ ++static void airoha_qdma_cleanup_rx_queue(struct airoha_queue *q) ++{ ++ struct airoha_eth *eth = q->qdma->eth; ++ ++ while (q->queued) { ++ struct airoha_queue_entry *e = &q->entry[q->tail]; ++ struct page *page = virt_to_head_page(e->buf); ++ ++ dma_sync_single_for_cpu(eth->dev, e->dma_addr, e->dma_len, ++ page_pool_get_dma_dir(q->page_pool)); ++ page_pool_put_full_page(q->page_pool, page, false); ++ q->tail = (q->tail + 1) % q->ndesc; ++ q->queued--; ++ } ++} ++ ++static int airoha_qdma_init_rx(struct airoha_qdma *qdma) ++{ ++ int i; ++ ++ for (i = 0; i < ARRAY_SIZE(qdma->q_rx); i++) { ++ int err; ++ ++ if (!(RX_DONE_INT_MASK & BIT(i))) { ++ /* rx-queue not binded to irq */ ++ continue; ++ } ++ ++ err = airoha_qdma_init_rx_queue(&qdma->q_rx[i], qdma, ++ RX_DSCP_NUM(i)); ++ if (err) ++ return err; ++ } ++ ++ return 0; ++} ++ ++static int airoha_qdma_tx_napi_poll(struct napi_struct *napi, int budget) ++{ ++ struct airoha_tx_irq_queue *irq_q; ++ int id, done = 0, irq_queued; ++ struct airoha_qdma *qdma; ++ struct airoha_eth *eth; ++ u32 status, head; ++ ++ irq_q = container_of(napi, struct airoha_tx_irq_queue, napi); ++ qdma = irq_q->qdma; ++ id = irq_q - &qdma->q_tx_irq[0]; ++ eth = qdma->eth; ++ ++ status = airoha_qdma_rr(qdma, REG_IRQ_STATUS(id)); ++ head = FIELD_GET(IRQ_HEAD_IDX_MASK, status); ++ head = head % irq_q->size; ++ irq_queued = FIELD_GET(IRQ_ENTRY_LEN_MASK, status); ++ ++ while (irq_queued > 0 && done < budget) { ++ u32 qid, val = irq_q->q[head]; ++ struct airoha_qdma_desc *desc; ++ struct airoha_queue_entry *e; ++ struct airoha_queue *q; ++ u32 index, desc_ctrl; ++ struct sk_buff *skb; ++ ++ if (val == 0xff) ++ break; ++ ++ irq_q->q[head] = 0xff; /* mark as done */ ++ head = (head + 1) % irq_q->size; ++ irq_queued--; ++ done++; ++ ++ qid = FIELD_GET(IRQ_RING_IDX_MASK, val); ++ if (qid >= ARRAY_SIZE(qdma->q_tx)) ++ continue; ++ ++ q = &qdma->q_tx[qid]; ++ if (!q->ndesc) ++ continue; ++ ++ index = FIELD_GET(IRQ_DESC_IDX_MASK, val); ++ if (index >= q->ndesc) ++ continue; ++ ++ spin_lock_bh(&q->lock); ++ ++ if (!q->queued) ++ goto unlock; ++ ++ desc = &q->desc[index]; ++ desc_ctrl = le32_to_cpu(desc->ctrl); ++ ++ if (!(desc_ctrl & QDMA_DESC_DONE_MASK) && ++ !(desc_ctrl & QDMA_DESC_DROP_MASK)) ++ goto unlock; ++ ++ e = &q->entry[index]; ++ skb = e->skb; ++ ++ dma_unmap_single(eth->dev, e->dma_addr, e->dma_len, ++ DMA_TO_DEVICE); ++ memset(e, 0, sizeof(*e)); ++ WRITE_ONCE(desc->msg0, 0); ++ WRITE_ONCE(desc->msg1, 0); ++ q->queued--; ++ ++ /* completion ring can report out-of-order indexes if hw QoS ++ * is enabled and packets with different priority are queued ++ * to same DMA ring. Take into account possible out-of-order ++ * reports incrementing DMA ring tail pointer ++ */ ++ while (q->tail != q->head && !q->entry[q->tail].dma_addr) ++ q->tail = (q->tail + 1) % q->ndesc; ++ ++ if (skb) { ++ u16 queue = skb_get_queue_mapping(skb); ++ struct netdev_queue *txq; ++ ++ txq = netdev_get_tx_queue(skb->dev, queue); ++ netdev_tx_completed_queue(txq, 1, skb->len); ++ if (netif_tx_queue_stopped(txq) && ++ q->ndesc - q->queued >= q->free_thr) ++ netif_tx_wake_queue(txq); ++ ++ dev_kfree_skb_any(skb); ++ } ++unlock: ++ spin_unlock_bh(&q->lock); ++ } ++ ++ if (done) { ++ int i, len = done >> 7; ++ ++ for (i = 0; i < len; i++) ++ airoha_qdma_rmw(qdma, REG_IRQ_CLEAR_LEN(id), ++ IRQ_CLEAR_LEN_MASK, 0x80); ++ airoha_qdma_rmw(qdma, REG_IRQ_CLEAR_LEN(id), ++ IRQ_CLEAR_LEN_MASK, (done & 0x7f)); ++ } ++ ++ if (done < budget && napi_complete(napi)) ++ airoha_qdma_irq_enable(qdma, QDMA_INT_REG_IDX0, ++ TX_DONE_INT_MASK(id)); ++ ++ return done; ++} ++ ++static int airoha_qdma_init_tx_queue(struct airoha_queue *q, ++ struct airoha_qdma *qdma, int size) ++{ ++ struct airoha_eth *eth = qdma->eth; ++ int i, qid = q - &qdma->q_tx[0]; ++ dma_addr_t dma_addr; ++ ++ spin_lock_init(&q->lock); ++ q->ndesc = size; ++ q->qdma = qdma; ++ q->free_thr = 1 + MAX_SKB_FRAGS; ++ ++ q->entry = devm_kzalloc(eth->dev, q->ndesc * sizeof(*q->entry), ++ GFP_KERNEL); ++ if (!q->entry) ++ return -ENOMEM; ++ ++ q->desc = dmam_alloc_coherent(eth->dev, q->ndesc * sizeof(*q->desc), ++ &dma_addr, GFP_KERNEL); ++ if (!q->desc) ++ return -ENOMEM; ++ ++ for (i = 0; i < q->ndesc; i++) { ++ u32 val; ++ ++ val = FIELD_PREP(QDMA_DESC_DONE_MASK, 1); ++ WRITE_ONCE(q->desc[i].ctrl, cpu_to_le32(val)); ++ } ++ ++ /* xmit ring drop default setting */ ++ airoha_qdma_set(qdma, REG_TX_RING_BLOCKING(qid), ++ TX_RING_IRQ_BLOCKING_TX_DROP_EN_MASK); ++ ++ airoha_qdma_wr(qdma, REG_TX_RING_BASE(qid), dma_addr); ++ airoha_qdma_rmw(qdma, REG_TX_CPU_IDX(qid), TX_RING_CPU_IDX_MASK, ++ FIELD_PREP(TX_RING_CPU_IDX_MASK, q->head)); ++ airoha_qdma_rmw(qdma, REG_TX_DMA_IDX(qid), TX_RING_DMA_IDX_MASK, ++ FIELD_PREP(TX_RING_DMA_IDX_MASK, q->head)); ++ ++ return 0; ++} ++ ++static int airoha_qdma_tx_irq_init(struct airoha_tx_irq_queue *irq_q, ++ struct airoha_qdma *qdma, int size) ++{ ++ int id = irq_q - &qdma->q_tx_irq[0]; ++ struct airoha_eth *eth = qdma->eth; ++ dma_addr_t dma_addr; ++ ++ netif_napi_add_tx(eth->napi_dev, &irq_q->napi, ++ airoha_qdma_tx_napi_poll); ++ irq_q->q = dmam_alloc_coherent(eth->dev, size * sizeof(u32), ++ &dma_addr, GFP_KERNEL); ++ if (!irq_q->q) ++ return -ENOMEM; ++ ++ memset(irq_q->q, 0xff, size * sizeof(u32)); ++ irq_q->size = size; ++ irq_q->qdma = qdma; ++ ++ airoha_qdma_wr(qdma, REG_TX_IRQ_BASE(id), dma_addr); ++ airoha_qdma_rmw(qdma, REG_TX_IRQ_CFG(id), TX_IRQ_DEPTH_MASK, ++ FIELD_PREP(TX_IRQ_DEPTH_MASK, size)); ++ airoha_qdma_rmw(qdma, REG_TX_IRQ_CFG(id), TX_IRQ_THR_MASK, ++ FIELD_PREP(TX_IRQ_THR_MASK, 1)); ++ ++ return 0; ++} ++ ++static int airoha_qdma_init_tx(struct airoha_qdma *qdma) ++{ ++ int i, err; ++ ++ for (i = 0; i < ARRAY_SIZE(qdma->q_tx_irq); i++) { ++ err = airoha_qdma_tx_irq_init(&qdma->q_tx_irq[i], qdma, ++ IRQ_QUEUE_LEN(i)); ++ if (err) ++ return err; ++ } ++ ++ for (i = 0; i < ARRAY_SIZE(qdma->q_tx); i++) { ++ err = airoha_qdma_init_tx_queue(&qdma->q_tx[i], qdma, ++ TX_DSCP_NUM); ++ if (err) ++ return err; ++ } ++ ++ return 0; ++} ++ ++static void airoha_qdma_cleanup_tx_queue(struct airoha_queue *q) ++{ ++ struct airoha_eth *eth = q->qdma->eth; ++ ++ spin_lock_bh(&q->lock); ++ while (q->queued) { ++ struct airoha_queue_entry *e = &q->entry[q->tail]; ++ ++ dma_unmap_single(eth->dev, e->dma_addr, e->dma_len, ++ DMA_TO_DEVICE); ++ dev_kfree_skb_any(e->skb); ++ e->skb = NULL; ++ ++ q->tail = (q->tail + 1) % q->ndesc; ++ q->queued--; ++ } ++ spin_unlock_bh(&q->lock); ++} ++ ++static int airoha_qdma_init_hfwd_queues(struct airoha_qdma *qdma) ++{ ++ struct airoha_eth *eth = qdma->eth; ++ dma_addr_t dma_addr; ++ u32 status; ++ int size; ++ ++ size = HW_DSCP_NUM * sizeof(struct airoha_qdma_fwd_desc); ++ qdma->hfwd.desc = dmam_alloc_coherent(eth->dev, size, &dma_addr, ++ GFP_KERNEL); ++ if (!qdma->hfwd.desc) ++ return -ENOMEM; ++ ++ airoha_qdma_wr(qdma, REG_FWD_DSCP_BASE, dma_addr); ++ ++ size = AIROHA_MAX_PACKET_SIZE * HW_DSCP_NUM; ++ qdma->hfwd.q = dmam_alloc_coherent(eth->dev, size, &dma_addr, ++ GFP_KERNEL); ++ if (!qdma->hfwd.q) ++ return -ENOMEM; ++ ++ airoha_qdma_wr(qdma, REG_FWD_BUF_BASE, dma_addr); ++ ++ airoha_qdma_rmw(qdma, REG_HW_FWD_DSCP_CFG, ++ HW_FWD_DSCP_PAYLOAD_SIZE_MASK, ++ FIELD_PREP(HW_FWD_DSCP_PAYLOAD_SIZE_MASK, 0)); ++ airoha_qdma_rmw(qdma, REG_FWD_DSCP_LOW_THR, FWD_DSCP_LOW_THR_MASK, ++ FIELD_PREP(FWD_DSCP_LOW_THR_MASK, 128)); ++ airoha_qdma_rmw(qdma, REG_LMGR_INIT_CFG, ++ LMGR_INIT_START | LMGR_SRAM_MODE_MASK | ++ HW_FWD_DESC_NUM_MASK, ++ FIELD_PREP(HW_FWD_DESC_NUM_MASK, HW_DSCP_NUM) | ++ LMGR_INIT_START); ++ ++ return read_poll_timeout(airoha_qdma_rr, status, ++ !(status & LMGR_INIT_START), USEC_PER_MSEC, ++ 30 * USEC_PER_MSEC, true, qdma, ++ REG_LMGR_INIT_CFG); ++} ++ ++static void airoha_qdma_init_qos(struct airoha_qdma *qdma) ++{ ++ airoha_qdma_clear(qdma, REG_TXWRR_MODE_CFG, TWRR_WEIGHT_SCALE_MASK); ++ airoha_qdma_set(qdma, REG_TXWRR_MODE_CFG, TWRR_WEIGHT_BASE_MASK); ++ ++ airoha_qdma_clear(qdma, REG_PSE_BUF_USAGE_CFG, ++ PSE_BUF_ESTIMATE_EN_MASK); ++ ++ airoha_qdma_set(qdma, REG_EGRESS_RATE_METER_CFG, ++ EGRESS_RATE_METER_EN_MASK | ++ EGRESS_RATE_METER_EQ_RATE_EN_MASK); ++ /* 2047us x 31 = 63.457ms */ ++ airoha_qdma_rmw(qdma, REG_EGRESS_RATE_METER_CFG, ++ EGRESS_RATE_METER_WINDOW_SZ_MASK, ++ FIELD_PREP(EGRESS_RATE_METER_WINDOW_SZ_MASK, 0x1f)); ++ airoha_qdma_rmw(qdma, REG_EGRESS_RATE_METER_CFG, ++ EGRESS_RATE_METER_TIMESLICE_MASK, ++ FIELD_PREP(EGRESS_RATE_METER_TIMESLICE_MASK, 0x7ff)); ++ ++ /* ratelimit init */ ++ airoha_qdma_set(qdma, REG_GLB_TRTCM_CFG, GLB_TRTCM_EN_MASK); ++ /* fast-tick 25us */ ++ airoha_qdma_rmw(qdma, REG_GLB_TRTCM_CFG, GLB_FAST_TICK_MASK, ++ FIELD_PREP(GLB_FAST_TICK_MASK, 25)); ++ airoha_qdma_rmw(qdma, REG_GLB_TRTCM_CFG, GLB_SLOW_TICK_RATIO_MASK, ++ FIELD_PREP(GLB_SLOW_TICK_RATIO_MASK, 40)); ++ ++ airoha_qdma_set(qdma, REG_EGRESS_TRTCM_CFG, EGRESS_TRTCM_EN_MASK); ++ airoha_qdma_rmw(qdma, REG_EGRESS_TRTCM_CFG, EGRESS_FAST_TICK_MASK, ++ FIELD_PREP(EGRESS_FAST_TICK_MASK, 25)); ++ airoha_qdma_rmw(qdma, REG_EGRESS_TRTCM_CFG, ++ EGRESS_SLOW_TICK_RATIO_MASK, ++ FIELD_PREP(EGRESS_SLOW_TICK_RATIO_MASK, 40)); ++ ++ airoha_qdma_set(qdma, REG_INGRESS_TRTCM_CFG, INGRESS_TRTCM_EN_MASK); ++ airoha_qdma_clear(qdma, REG_INGRESS_TRTCM_CFG, ++ INGRESS_TRTCM_MODE_MASK); ++ airoha_qdma_rmw(qdma, REG_INGRESS_TRTCM_CFG, INGRESS_FAST_TICK_MASK, ++ FIELD_PREP(INGRESS_FAST_TICK_MASK, 125)); ++ airoha_qdma_rmw(qdma, REG_INGRESS_TRTCM_CFG, ++ INGRESS_SLOW_TICK_RATIO_MASK, ++ FIELD_PREP(INGRESS_SLOW_TICK_RATIO_MASK, 8)); ++ ++ airoha_qdma_set(qdma, REG_SLA_TRTCM_CFG, SLA_TRTCM_EN_MASK); ++ airoha_qdma_rmw(qdma, REG_SLA_TRTCM_CFG, SLA_FAST_TICK_MASK, ++ FIELD_PREP(SLA_FAST_TICK_MASK, 25)); ++ airoha_qdma_rmw(qdma, REG_SLA_TRTCM_CFG, SLA_SLOW_TICK_RATIO_MASK, ++ FIELD_PREP(SLA_SLOW_TICK_RATIO_MASK, 40)); ++} ++ ++static void airoha_qdma_init_qos_stats(struct airoha_qdma *qdma) ++{ ++ int i; ++ ++ for (i = 0; i < AIROHA_NUM_QOS_CHANNELS; i++) { ++ /* Tx-cpu transferred count */ ++ airoha_qdma_wr(qdma, REG_CNTR_VAL(i << 1), 0); ++ airoha_qdma_wr(qdma, REG_CNTR_CFG(i << 1), ++ CNTR_EN_MASK | CNTR_ALL_QUEUE_EN_MASK | ++ CNTR_ALL_DSCP_RING_EN_MASK | ++ FIELD_PREP(CNTR_CHAN_MASK, i)); ++ /* Tx-fwd transferred count */ ++ airoha_qdma_wr(qdma, REG_CNTR_VAL((i << 1) + 1), 0); ++ airoha_qdma_wr(qdma, REG_CNTR_CFG(i << 1), ++ CNTR_EN_MASK | CNTR_ALL_QUEUE_EN_MASK | ++ CNTR_ALL_DSCP_RING_EN_MASK | ++ FIELD_PREP(CNTR_SRC_MASK, 1) | ++ FIELD_PREP(CNTR_CHAN_MASK, i)); ++ } ++} ++ ++static int airoha_qdma_hw_init(struct airoha_qdma *qdma) ++{ ++ int i; ++ ++ /* clear pending irqs */ ++ for (i = 0; i < ARRAY_SIZE(qdma->irqmask); i++) ++ airoha_qdma_wr(qdma, REG_INT_STATUS(i), 0xffffffff); ++ ++ /* setup irqs */ ++ airoha_qdma_irq_enable(qdma, QDMA_INT_REG_IDX0, INT_IDX0_MASK); ++ airoha_qdma_irq_enable(qdma, QDMA_INT_REG_IDX1, INT_IDX1_MASK); ++ airoha_qdma_irq_enable(qdma, QDMA_INT_REG_IDX4, INT_IDX4_MASK); ++ ++ /* setup irq binding */ ++ for (i = 0; i < ARRAY_SIZE(qdma->q_tx); i++) { ++ if (!qdma->q_tx[i].ndesc) ++ continue; ++ ++ if (TX_RING_IRQ_BLOCKING_MAP_MASK & BIT(i)) ++ airoha_qdma_set(qdma, REG_TX_RING_BLOCKING(i), ++ TX_RING_IRQ_BLOCKING_CFG_MASK); ++ else ++ airoha_qdma_clear(qdma, REG_TX_RING_BLOCKING(i), ++ TX_RING_IRQ_BLOCKING_CFG_MASK); ++ } ++ ++ airoha_qdma_wr(qdma, REG_QDMA_GLOBAL_CFG, ++ GLOBAL_CFG_RX_2B_OFFSET_MASK | ++ FIELD_PREP(GLOBAL_CFG_DMA_PREFERENCE_MASK, 3) | ++ GLOBAL_CFG_CPU_TXR_RR_MASK | ++ GLOBAL_CFG_PAYLOAD_BYTE_SWAP_MASK | ++ GLOBAL_CFG_MULTICAST_MODIFY_FP_MASK | ++ GLOBAL_CFG_MULTICAST_EN_MASK | ++ GLOBAL_CFG_IRQ0_EN_MASK | GLOBAL_CFG_IRQ1_EN_MASK | ++ GLOBAL_CFG_TX_WB_DONE_MASK | ++ FIELD_PREP(GLOBAL_CFG_MAX_ISSUE_NUM_MASK, 2)); ++ ++ airoha_qdma_init_qos(qdma); ++ ++ /* disable qdma rx delay interrupt */ ++ for (i = 0; i < ARRAY_SIZE(qdma->q_rx); i++) { ++ if (!qdma->q_rx[i].ndesc) ++ continue; ++ ++ airoha_qdma_clear(qdma, REG_RX_DELAY_INT_IDX(i), ++ RX_DELAY_INT_MASK); ++ } ++ ++ airoha_qdma_set(qdma, REG_TXQ_CNGST_CFG, ++ TXQ_CNGST_DROP_EN | TXQ_CNGST_DEI_DROP_EN); ++ airoha_qdma_init_qos_stats(qdma); ++ ++ return 0; ++} ++ ++static irqreturn_t airoha_irq_handler(int irq, void *dev_instance) ++{ ++ struct airoha_qdma *qdma = dev_instance; ++ u32 intr[ARRAY_SIZE(qdma->irqmask)]; ++ int i; ++ ++ for (i = 0; i < ARRAY_SIZE(qdma->irqmask); i++) { ++ intr[i] = airoha_qdma_rr(qdma, REG_INT_STATUS(i)); ++ intr[i] &= qdma->irqmask[i]; ++ airoha_qdma_wr(qdma, REG_INT_STATUS(i), intr[i]); ++ } ++ ++ if (!test_bit(DEV_STATE_INITIALIZED, &qdma->eth->state)) ++ return IRQ_NONE; ++ ++ if (intr[1] & RX_DONE_INT_MASK) { ++ airoha_qdma_irq_disable(qdma, QDMA_INT_REG_IDX1, ++ RX_DONE_INT_MASK); ++ ++ for (i = 0; i < ARRAY_SIZE(qdma->q_rx); i++) { ++ if (!qdma->q_rx[i].ndesc) ++ continue; ++ ++ if (intr[1] & BIT(i)) ++ napi_schedule(&qdma->q_rx[i].napi); ++ } ++ } ++ ++ if (intr[0] & INT_TX_MASK) { ++ for (i = 0; i < ARRAY_SIZE(qdma->q_tx_irq); i++) { ++ if (!(intr[0] & TX_DONE_INT_MASK(i))) ++ continue; ++ ++ airoha_qdma_irq_disable(qdma, QDMA_INT_REG_IDX0, ++ TX_DONE_INT_MASK(i)); ++ napi_schedule(&qdma->q_tx_irq[i].napi); ++ } ++ } ++ ++ return IRQ_HANDLED; ++} ++ ++static int airoha_qdma_init(struct platform_device *pdev, ++ struct airoha_eth *eth, ++ struct airoha_qdma *qdma) ++{ ++ int err, id = qdma - ð->qdma[0]; ++ const char *res; ++ ++ spin_lock_init(&qdma->irq_lock); ++ qdma->eth = eth; ++ ++ res = devm_kasprintf(eth->dev, GFP_KERNEL, "qdma%d", id); ++ if (!res) ++ return -ENOMEM; ++ ++ qdma->regs = devm_platform_ioremap_resource_byname(pdev, res); ++ if (IS_ERR(qdma->regs)) ++ return dev_err_probe(eth->dev, PTR_ERR(qdma->regs), ++ "failed to iomap qdma%d regs\n", id); ++ ++ qdma->irq = platform_get_irq(pdev, 4 * id); ++ if (qdma->irq < 0) ++ return qdma->irq; ++ ++ err = devm_request_irq(eth->dev, qdma->irq, airoha_irq_handler, ++ IRQF_SHARED, KBUILD_MODNAME, qdma); ++ if (err) ++ return err; ++ ++ err = airoha_qdma_init_rx(qdma); ++ if (err) ++ return err; ++ ++ err = airoha_qdma_init_tx(qdma); ++ if (err) ++ return err; ++ ++ err = airoha_qdma_init_hfwd_queues(qdma); ++ if (err) ++ return err; ++ ++ return airoha_qdma_hw_init(qdma); ++} ++ ++static int airoha_hw_init(struct platform_device *pdev, ++ struct airoha_eth *eth) ++{ ++ int err, i; ++ ++ /* disable xsi */ ++ err = reset_control_bulk_assert(ARRAY_SIZE(eth->xsi_rsts), ++ eth->xsi_rsts); ++ if (err) ++ return err; ++ ++ err = reset_control_bulk_assert(ARRAY_SIZE(eth->rsts), eth->rsts); ++ if (err) ++ return err; ++ ++ msleep(20); ++ err = reset_control_bulk_deassert(ARRAY_SIZE(eth->rsts), eth->rsts); ++ if (err) ++ return err; ++ ++ msleep(20); ++ err = airoha_fe_init(eth); ++ if (err) ++ return err; ++ ++ for (i = 0; i < ARRAY_SIZE(eth->qdma); i++) { ++ err = airoha_qdma_init(pdev, eth, ð->qdma[i]); ++ if (err) ++ return err; ++ } ++ ++ set_bit(DEV_STATE_INITIALIZED, ð->state); ++ ++ return 0; ++} ++ ++static void airoha_hw_cleanup(struct airoha_qdma *qdma) ++{ ++ int i; ++ ++ for (i = 0; i < ARRAY_SIZE(qdma->q_rx); i++) { ++ if (!qdma->q_rx[i].ndesc) ++ continue; ++ ++ netif_napi_del(&qdma->q_rx[i].napi); ++ airoha_qdma_cleanup_rx_queue(&qdma->q_rx[i]); ++ if (qdma->q_rx[i].page_pool) ++ page_pool_destroy(qdma->q_rx[i].page_pool); ++ } ++ ++ for (i = 0; i < ARRAY_SIZE(qdma->q_tx_irq); i++) ++ netif_napi_del(&qdma->q_tx_irq[i].napi); ++ ++ for (i = 0; i < ARRAY_SIZE(qdma->q_tx); i++) { ++ if (!qdma->q_tx[i].ndesc) ++ continue; ++ ++ airoha_qdma_cleanup_tx_queue(&qdma->q_tx[i]); ++ } ++} ++ ++static void airoha_qdma_start_napi(struct airoha_qdma *qdma) ++{ ++ int i; ++ ++ for (i = 0; i < ARRAY_SIZE(qdma->q_tx_irq); i++) ++ napi_enable(&qdma->q_tx_irq[i].napi); ++ ++ for (i = 0; i < ARRAY_SIZE(qdma->q_rx); i++) { ++ if (!qdma->q_rx[i].ndesc) ++ continue; ++ ++ napi_enable(&qdma->q_rx[i].napi); ++ } ++} ++ ++static void airoha_qdma_stop_napi(struct airoha_qdma *qdma) ++{ ++ int i; ++ ++ for (i = 0; i < ARRAY_SIZE(qdma->q_tx_irq); i++) ++ napi_disable(&qdma->q_tx_irq[i].napi); ++ ++ for (i = 0; i < ARRAY_SIZE(qdma->q_rx); i++) { ++ if (!qdma->q_rx[i].ndesc) ++ continue; ++ ++ napi_disable(&qdma->q_rx[i].napi); ++ } ++} ++ ++static void airoha_update_hw_stats(struct airoha_gdm_port *port) ++{ ++ struct airoha_eth *eth = port->qdma->eth; ++ u32 val, i = 0; ++ ++ spin_lock(&port->stats.lock); ++ u64_stats_update_begin(&port->stats.syncp); ++ ++ /* TX */ ++ val = airoha_fe_rr(eth, REG_FE_GDM_TX_OK_PKT_CNT_H(port->id)); ++ port->stats.tx_ok_pkts += ((u64)val << 32); ++ val = airoha_fe_rr(eth, REG_FE_GDM_TX_OK_PKT_CNT_L(port->id)); ++ port->stats.tx_ok_pkts += val; ++ ++ val = airoha_fe_rr(eth, REG_FE_GDM_TX_OK_BYTE_CNT_H(port->id)); ++ port->stats.tx_ok_bytes += ((u64)val << 32); ++ val = airoha_fe_rr(eth, REG_FE_GDM_TX_OK_BYTE_CNT_L(port->id)); ++ port->stats.tx_ok_bytes += val; ++ ++ val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_DROP_CNT(port->id)); ++ port->stats.tx_drops += val; ++ ++ val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_BC_CNT(port->id)); ++ port->stats.tx_broadcast += val; ++ ++ val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_MC_CNT(port->id)); ++ port->stats.tx_multicast += val; ++ ++ val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_RUNT_CNT(port->id)); ++ port->stats.tx_len[i] += val; ++ ++ val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_E64_CNT_H(port->id)); ++ port->stats.tx_len[i] += ((u64)val << 32); ++ val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_E64_CNT_L(port->id)); ++ port->stats.tx_len[i++] += val; ++ ++ val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_L64_CNT_H(port->id)); ++ port->stats.tx_len[i] += ((u64)val << 32); ++ val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_L64_CNT_L(port->id)); ++ port->stats.tx_len[i++] += val; ++ ++ val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_L127_CNT_H(port->id)); ++ port->stats.tx_len[i] += ((u64)val << 32); ++ val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_L127_CNT_L(port->id)); ++ port->stats.tx_len[i++] += val; ++ ++ val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_L255_CNT_H(port->id)); ++ port->stats.tx_len[i] += ((u64)val << 32); ++ val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_L255_CNT_L(port->id)); ++ port->stats.tx_len[i++] += val; ++ ++ val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_L511_CNT_H(port->id)); ++ port->stats.tx_len[i] += ((u64)val << 32); ++ val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_L511_CNT_L(port->id)); ++ port->stats.tx_len[i++] += val; ++ ++ val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_L1023_CNT_H(port->id)); ++ port->stats.tx_len[i] += ((u64)val << 32); ++ val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_L1023_CNT_L(port->id)); ++ port->stats.tx_len[i++] += val; ++ ++ val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_LONG_CNT(port->id)); ++ port->stats.tx_len[i++] += val; ++ ++ /* RX */ ++ val = airoha_fe_rr(eth, REG_FE_GDM_RX_OK_PKT_CNT_H(port->id)); ++ port->stats.rx_ok_pkts += ((u64)val << 32); ++ val = airoha_fe_rr(eth, REG_FE_GDM_RX_OK_PKT_CNT_L(port->id)); ++ port->stats.rx_ok_pkts += val; ++ ++ val = airoha_fe_rr(eth, REG_FE_GDM_RX_OK_BYTE_CNT_H(port->id)); ++ port->stats.rx_ok_bytes += ((u64)val << 32); ++ val = airoha_fe_rr(eth, REG_FE_GDM_RX_OK_BYTE_CNT_L(port->id)); ++ port->stats.rx_ok_bytes += val; ++ ++ val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_DROP_CNT(port->id)); ++ port->stats.rx_drops += val; ++ ++ val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_BC_CNT(port->id)); ++ port->stats.rx_broadcast += val; ++ ++ val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_MC_CNT(port->id)); ++ port->stats.rx_multicast += val; ++ ++ val = airoha_fe_rr(eth, REG_FE_GDM_RX_ERROR_DROP_CNT(port->id)); ++ port->stats.rx_errors += val; ++ ++ val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_CRC_ERR_CNT(port->id)); ++ port->stats.rx_crc_error += val; ++ ++ val = airoha_fe_rr(eth, REG_FE_GDM_RX_OVERFLOW_DROP_CNT(port->id)); ++ port->stats.rx_over_errors += val; ++ ++ val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_FRAG_CNT(port->id)); ++ port->stats.rx_fragment += val; ++ ++ val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_JABBER_CNT(port->id)); ++ port->stats.rx_jabber += val; ++ ++ i = 0; ++ val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_RUNT_CNT(port->id)); ++ port->stats.rx_len[i] += val; ++ ++ val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_E64_CNT_H(port->id)); ++ port->stats.rx_len[i] += ((u64)val << 32); ++ val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_E64_CNT_L(port->id)); ++ port->stats.rx_len[i++] += val; ++ ++ val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_L64_CNT_H(port->id)); ++ port->stats.rx_len[i] += ((u64)val << 32); ++ val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_L64_CNT_L(port->id)); ++ port->stats.rx_len[i++] += val; ++ ++ val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_L127_CNT_H(port->id)); ++ port->stats.rx_len[i] += ((u64)val << 32); ++ val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_L127_CNT_L(port->id)); ++ port->stats.rx_len[i++] += val; ++ ++ val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_L255_CNT_H(port->id)); ++ port->stats.rx_len[i] += ((u64)val << 32); ++ val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_L255_CNT_L(port->id)); ++ port->stats.rx_len[i++] += val; ++ ++ val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_L511_CNT_H(port->id)); ++ port->stats.rx_len[i] += ((u64)val << 32); ++ val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_L511_CNT_L(port->id)); ++ port->stats.rx_len[i++] += val; ++ ++ val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_L1023_CNT_H(port->id)); ++ port->stats.rx_len[i] += ((u64)val << 32); ++ val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_L1023_CNT_L(port->id)); ++ port->stats.rx_len[i++] += val; ++ ++ val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_LONG_CNT(port->id)); ++ port->stats.rx_len[i++] += val; ++ ++ /* reset mib counters */ ++ airoha_fe_set(eth, REG_FE_GDM_MIB_CLEAR(port->id), ++ FE_GDM_MIB_RX_CLEAR_MASK | FE_GDM_MIB_TX_CLEAR_MASK); ++ ++ u64_stats_update_end(&port->stats.syncp); ++ spin_unlock(&port->stats.lock); ++} ++ ++static int airoha_dev_open(struct net_device *dev) ++{ ++ struct airoha_gdm_port *port = netdev_priv(dev); ++ struct airoha_qdma *qdma = port->qdma; ++ int err; ++ ++ netif_tx_start_all_queues(dev); ++ err = airoha_set_gdm_ports(qdma->eth, true); ++ if (err) ++ return err; ++ ++ if (netdev_uses_dsa(dev)) ++ airoha_fe_set(qdma->eth, REG_GDM_INGRESS_CFG(port->id), ++ GDM_STAG_EN_MASK); ++ else ++ airoha_fe_clear(qdma->eth, REG_GDM_INGRESS_CFG(port->id), ++ GDM_STAG_EN_MASK); ++ ++ airoha_qdma_set(qdma, REG_QDMA_GLOBAL_CFG, ++ GLOBAL_CFG_TX_DMA_EN_MASK | ++ GLOBAL_CFG_RX_DMA_EN_MASK); ++ ++ return 0; ++} ++ ++static int airoha_dev_stop(struct net_device *dev) ++{ ++ struct airoha_gdm_port *port = netdev_priv(dev); ++ struct airoha_qdma *qdma = port->qdma; ++ int i, err; ++ ++ netif_tx_disable(dev); ++ err = airoha_set_gdm_ports(qdma->eth, false); ++ if (err) ++ return err; ++ ++ airoha_qdma_clear(qdma, REG_QDMA_GLOBAL_CFG, ++ GLOBAL_CFG_TX_DMA_EN_MASK | ++ GLOBAL_CFG_RX_DMA_EN_MASK); ++ ++ for (i = 0; i < ARRAY_SIZE(qdma->q_tx); i++) { ++ if (!qdma->q_tx[i].ndesc) ++ continue; ++ ++ airoha_qdma_cleanup_tx_queue(&qdma->q_tx[i]); ++ netdev_tx_reset_subqueue(dev, i); ++ } ++ ++ return 0; ++} ++ ++static int airoha_dev_set_macaddr(struct net_device *dev, void *p) ++{ ++ struct airoha_gdm_port *port = netdev_priv(dev); ++ int err; ++ ++ err = eth_mac_addr(dev, p); ++ if (err) ++ return err; ++ ++ airoha_set_macaddr(port, dev->dev_addr); ++ ++ return 0; ++} ++ ++static int airoha_dev_init(struct net_device *dev) ++{ ++ struct airoha_gdm_port *port = netdev_priv(dev); ++ ++ airoha_set_macaddr(port, dev->dev_addr); ++ ++ return 0; ++} ++ ++static void airoha_dev_get_stats64(struct net_device *dev, ++ struct rtnl_link_stats64 *storage) ++{ ++ struct airoha_gdm_port *port = netdev_priv(dev); ++ unsigned int start; ++ ++ airoha_update_hw_stats(port); ++ do { ++ start = u64_stats_fetch_begin(&port->stats.syncp); ++ storage->rx_packets = port->stats.rx_ok_pkts; ++ storage->tx_packets = port->stats.tx_ok_pkts; ++ storage->rx_bytes = port->stats.rx_ok_bytes; ++ storage->tx_bytes = port->stats.tx_ok_bytes; ++ storage->multicast = port->stats.rx_multicast; ++ storage->rx_errors = port->stats.rx_errors; ++ storage->rx_dropped = port->stats.rx_drops; ++ storage->tx_dropped = port->stats.tx_drops; ++ storage->rx_crc_errors = port->stats.rx_crc_error; ++ storage->rx_over_errors = port->stats.rx_over_errors; ++ } while (u64_stats_fetch_retry(&port->stats.syncp, start)); ++} ++ ++static u16 airoha_dev_select_queue(struct net_device *dev, struct sk_buff *skb, ++ struct net_device *sb_dev) ++{ ++ struct airoha_gdm_port *port = netdev_priv(dev); ++ int queue, channel; ++ ++ /* For dsa device select QoS channel according to the dsa user port ++ * index, rely on port id otherwise. Select QoS queue based on the ++ * skb priority. ++ */ ++ channel = netdev_uses_dsa(dev) ? skb_get_queue_mapping(skb) : port->id; ++ channel = channel % AIROHA_NUM_QOS_CHANNELS; ++ queue = (skb->priority - 1) % AIROHA_NUM_QOS_QUEUES; /* QoS queue */ ++ queue = channel * AIROHA_NUM_QOS_QUEUES + queue; ++ ++ return queue < dev->num_tx_queues ? queue : 0; ++} ++ ++static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb, ++ struct net_device *dev) ++{ ++ struct airoha_gdm_port *port = netdev_priv(dev); ++ u32 nr_frags = 1 + skb_shinfo(skb)->nr_frags; ++ u32 msg0, msg1, len = skb_headlen(skb); ++ struct airoha_qdma *qdma = port->qdma; ++ struct netdev_queue *txq; ++ struct airoha_queue *q; ++ void *data = skb->data; ++ int i, qid; ++ u16 index; ++ u8 fport; ++ ++ qid = skb_get_queue_mapping(skb) % ARRAY_SIZE(qdma->q_tx); ++ msg0 = FIELD_PREP(QDMA_ETH_TXMSG_CHAN_MASK, ++ qid / AIROHA_NUM_QOS_QUEUES) | ++ FIELD_PREP(QDMA_ETH_TXMSG_QUEUE_MASK, ++ qid % AIROHA_NUM_QOS_QUEUES); ++ if (skb->ip_summed == CHECKSUM_PARTIAL) ++ msg0 |= FIELD_PREP(QDMA_ETH_TXMSG_TCO_MASK, 1) | ++ FIELD_PREP(QDMA_ETH_TXMSG_UCO_MASK, 1) | ++ FIELD_PREP(QDMA_ETH_TXMSG_ICO_MASK, 1); ++ ++ /* TSO: fill MSS info in tcp checksum field */ ++ if (skb_is_gso(skb)) { ++ if (skb_cow_head(skb, 0)) ++ goto error; ++ ++ if (skb_shinfo(skb)->gso_type & (SKB_GSO_TCPV4 | ++ SKB_GSO_TCPV6)) { ++ __be16 csum = cpu_to_be16(skb_shinfo(skb)->gso_size); ++ ++ tcp_hdr(skb)->check = (__force __sum16)csum; ++ msg0 |= FIELD_PREP(QDMA_ETH_TXMSG_TSO_MASK, 1); ++ } ++ } ++ ++ fport = port->id == 4 ? FE_PSE_PORT_GDM4 : port->id; ++ msg1 = FIELD_PREP(QDMA_ETH_TXMSG_FPORT_MASK, fport) | ++ FIELD_PREP(QDMA_ETH_TXMSG_METER_MASK, 0x7f); ++ ++ q = &qdma->q_tx[qid]; ++ if (WARN_ON_ONCE(!q->ndesc)) ++ goto error; ++ ++ spin_lock_bh(&q->lock); ++ ++ txq = netdev_get_tx_queue(dev, qid); ++ if (q->queued + nr_frags > q->ndesc) { ++ /* not enough space in the queue */ ++ netif_tx_stop_queue(txq); ++ spin_unlock_bh(&q->lock); ++ return NETDEV_TX_BUSY; ++ } ++ ++ index = q->head; ++ for (i = 0; i < nr_frags; i++) { ++ struct airoha_qdma_desc *desc = &q->desc[index]; ++ struct airoha_queue_entry *e = &q->entry[index]; ++ skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; ++ dma_addr_t addr; ++ u32 val; ++ ++ addr = dma_map_single(dev->dev.parent, data, len, ++ DMA_TO_DEVICE); ++ if (unlikely(dma_mapping_error(dev->dev.parent, addr))) ++ goto error_unmap; ++ ++ index = (index + 1) % q->ndesc; ++ ++ val = FIELD_PREP(QDMA_DESC_LEN_MASK, len); ++ if (i < nr_frags - 1) ++ val |= FIELD_PREP(QDMA_DESC_MORE_MASK, 1); ++ WRITE_ONCE(desc->ctrl, cpu_to_le32(val)); ++ WRITE_ONCE(desc->addr, cpu_to_le32(addr)); ++ val = FIELD_PREP(QDMA_DESC_NEXT_ID_MASK, index); ++ WRITE_ONCE(desc->data, cpu_to_le32(val)); ++ WRITE_ONCE(desc->msg0, cpu_to_le32(msg0)); ++ WRITE_ONCE(desc->msg1, cpu_to_le32(msg1)); ++ WRITE_ONCE(desc->msg2, cpu_to_le32(0xffff)); ++ ++ e->skb = i ? NULL : skb; ++ e->dma_addr = addr; ++ e->dma_len = len; ++ ++ data = skb_frag_address(frag); ++ len = skb_frag_size(frag); ++ } ++ ++ q->head = index; ++ q->queued += i; ++ ++ skb_tx_timestamp(skb); ++ netdev_tx_sent_queue(txq, skb->len); ++ ++ if (netif_xmit_stopped(txq) || !netdev_xmit_more()) ++ airoha_qdma_rmw(qdma, REG_TX_CPU_IDX(qid), ++ TX_RING_CPU_IDX_MASK, ++ FIELD_PREP(TX_RING_CPU_IDX_MASK, q->head)); ++ ++ if (q->ndesc - q->queued < q->free_thr) ++ netif_tx_stop_queue(txq); ++ ++ spin_unlock_bh(&q->lock); ++ ++ return NETDEV_TX_OK; ++ ++error_unmap: ++ for (i--; i >= 0; i--) { ++ index = (q->head + i) % q->ndesc; ++ dma_unmap_single(dev->dev.parent, q->entry[index].dma_addr, ++ q->entry[index].dma_len, DMA_TO_DEVICE); ++ } ++ ++ spin_unlock_bh(&q->lock); ++error: ++ dev_kfree_skb_any(skb); ++ dev->stats.tx_dropped++; ++ ++ return NETDEV_TX_OK; ++} ++ ++static void airoha_ethtool_get_drvinfo(struct net_device *dev, ++ struct ethtool_drvinfo *info) ++{ ++ struct airoha_gdm_port *port = netdev_priv(dev); ++ struct airoha_eth *eth = port->qdma->eth; ++ ++ strscpy(info->driver, eth->dev->driver->name, sizeof(info->driver)); ++ strscpy(info->bus_info, dev_name(eth->dev), sizeof(info->bus_info)); ++} ++ ++static void airoha_ethtool_get_mac_stats(struct net_device *dev, ++ struct ethtool_eth_mac_stats *stats) ++{ ++ struct airoha_gdm_port *port = netdev_priv(dev); ++ unsigned int start; ++ ++ airoha_update_hw_stats(port); ++ do { ++ start = u64_stats_fetch_begin(&port->stats.syncp); ++ stats->MulticastFramesXmittedOK = port->stats.tx_multicast; ++ stats->BroadcastFramesXmittedOK = port->stats.tx_broadcast; ++ stats->BroadcastFramesReceivedOK = port->stats.rx_broadcast; ++ } while (u64_stats_fetch_retry(&port->stats.syncp, start)); ++} ++ ++static const struct ethtool_rmon_hist_range airoha_ethtool_rmon_ranges[] = { ++ { 0, 64 }, ++ { 65, 127 }, ++ { 128, 255 }, ++ { 256, 511 }, ++ { 512, 1023 }, ++ { 1024, 1518 }, ++ { 1519, 10239 }, ++ {}, ++}; ++ ++static void ++airoha_ethtool_get_rmon_stats(struct net_device *dev, ++ struct ethtool_rmon_stats *stats, ++ const struct ethtool_rmon_hist_range **ranges) ++{ ++ struct airoha_gdm_port *port = netdev_priv(dev); ++ struct airoha_hw_stats *hw_stats = &port->stats; ++ unsigned int start; ++ ++ BUILD_BUG_ON(ARRAY_SIZE(airoha_ethtool_rmon_ranges) != ++ ARRAY_SIZE(hw_stats->tx_len) + 1); ++ BUILD_BUG_ON(ARRAY_SIZE(airoha_ethtool_rmon_ranges) != ++ ARRAY_SIZE(hw_stats->rx_len) + 1); ++ ++ *ranges = airoha_ethtool_rmon_ranges; ++ airoha_update_hw_stats(port); ++ do { ++ int i; ++ ++ start = u64_stats_fetch_begin(&port->stats.syncp); ++ stats->fragments = hw_stats->rx_fragment; ++ stats->jabbers = hw_stats->rx_jabber; ++ for (i = 0; i < ARRAY_SIZE(airoha_ethtool_rmon_ranges) - 1; ++ i++) { ++ stats->hist[i] = hw_stats->rx_len[i]; ++ stats->hist_tx[i] = hw_stats->tx_len[i]; ++ } ++ } while (u64_stats_fetch_retry(&port->stats.syncp, start)); ++} ++ ++static int airoha_qdma_set_chan_tx_sched(struct airoha_gdm_port *port, ++ int channel, enum tx_sched_mode mode, ++ const u16 *weights, u8 n_weights) ++{ ++ int i; ++ ++ for (i = 0; i < AIROHA_NUM_TX_RING; i++) ++ airoha_qdma_clear(port->qdma, REG_QUEUE_CLOSE_CFG(channel), ++ TXQ_DISABLE_CHAN_QUEUE_MASK(channel, i)); ++ ++ for (i = 0; i < n_weights; i++) { ++ u32 status; ++ int err; ++ ++ airoha_qdma_wr(port->qdma, REG_TXWRR_WEIGHT_CFG, ++ TWRR_RW_CMD_MASK | ++ FIELD_PREP(TWRR_CHAN_IDX_MASK, channel) | ++ FIELD_PREP(TWRR_QUEUE_IDX_MASK, i) | ++ FIELD_PREP(TWRR_VALUE_MASK, weights[i])); ++ err = read_poll_timeout(airoha_qdma_rr, status, ++ status & TWRR_RW_CMD_DONE, ++ USEC_PER_MSEC, 10 * USEC_PER_MSEC, ++ true, port->qdma, ++ REG_TXWRR_WEIGHT_CFG); ++ if (err) ++ return err; ++ } ++ ++ airoha_qdma_rmw(port->qdma, REG_CHAN_QOS_MODE(channel >> 3), ++ CHAN_QOS_MODE_MASK(channel), ++ mode << __ffs(CHAN_QOS_MODE_MASK(channel))); ++ ++ return 0; ++} ++ ++static int airoha_qdma_set_tx_prio_sched(struct airoha_gdm_port *port, ++ int channel) ++{ ++ static const u16 w[AIROHA_NUM_QOS_QUEUES] = {}; ++ ++ return airoha_qdma_set_chan_tx_sched(port, channel, TC_SCH_SP, w, ++ ARRAY_SIZE(w)); ++} ++ ++static int airoha_qdma_set_tx_ets_sched(struct airoha_gdm_port *port, ++ int channel, ++ struct tc_ets_qopt_offload *opt) ++{ ++ struct tc_ets_qopt_offload_replace_params *p = &opt->replace_params; ++ enum tx_sched_mode mode = TC_SCH_SP; ++ u16 w[AIROHA_NUM_QOS_QUEUES] = {}; ++ int i, nstrict = 0, nwrr, qidx; ++ ++ if (p->bands > AIROHA_NUM_QOS_QUEUES) ++ return -EINVAL; ++ ++ for (i = 0; i < p->bands; i++) { ++ if (!p->quanta[i]) ++ nstrict++; ++ } ++ ++ /* this configuration is not supported by the hw */ ++ if (nstrict == AIROHA_NUM_QOS_QUEUES - 1) ++ return -EINVAL; ++ ++ /* EN7581 SoC supports fixed QoS band priority where WRR queues have ++ * lowest priorities with respect to SP ones. ++ * e.g: WRR0, WRR1, .., WRRm, SP0, SP1, .., SPn ++ */ ++ nwrr = p->bands - nstrict; ++ qidx = nstrict && nwrr ? nstrict : 0; ++ for (i = 1; i <= p->bands; i++) { ++ if (p->priomap[i % AIROHA_NUM_QOS_QUEUES] != qidx) ++ return -EINVAL; ++ ++ qidx = i == nwrr ? 0 : qidx + 1; ++ } ++ ++ for (i = 0; i < nwrr; i++) ++ w[i] = p->weights[nstrict + i]; ++ ++ if (!nstrict) ++ mode = TC_SCH_WRR8; ++ else if (nstrict < AIROHA_NUM_QOS_QUEUES - 1) ++ mode = nstrict + 1; ++ ++ return airoha_qdma_set_chan_tx_sched(port, channel, mode, w, ++ ARRAY_SIZE(w)); ++} ++ ++static int airoha_qdma_get_tx_ets_stats(struct airoha_gdm_port *port, ++ int channel, ++ struct tc_ets_qopt_offload *opt) ++{ ++ u64 cpu_tx_packets = airoha_qdma_rr(port->qdma, ++ REG_CNTR_VAL(channel << 1)); ++ u64 fwd_tx_packets = airoha_qdma_rr(port->qdma, ++ REG_CNTR_VAL((channel << 1) + 1)); ++ u64 tx_packets = (cpu_tx_packets - port->cpu_tx_packets) + ++ (fwd_tx_packets - port->fwd_tx_packets); ++ _bstats_update(opt->stats.bstats, 0, tx_packets); ++ ++ port->cpu_tx_packets = cpu_tx_packets; ++ port->fwd_tx_packets = fwd_tx_packets; ++ ++ return 0; ++} ++ ++static int airoha_tc_setup_qdisc_ets(struct airoha_gdm_port *port, ++ struct tc_ets_qopt_offload *opt) ++{ ++ int channel = TC_H_MAJ(opt->handle) >> 16; ++ ++ if (opt->parent == TC_H_ROOT) ++ return -EINVAL; ++ ++ switch (opt->command) { ++ case TC_ETS_REPLACE: ++ return airoha_qdma_set_tx_ets_sched(port, channel, opt); ++ case TC_ETS_DESTROY: ++ /* PRIO is default qdisc scheduler */ ++ return airoha_qdma_set_tx_prio_sched(port, channel); ++ case TC_ETS_STATS: ++ return airoha_qdma_get_tx_ets_stats(port, channel, opt); ++ default: ++ return -EOPNOTSUPP; ++ } ++} ++ ++static int airoha_qdma_get_trtcm_param(struct airoha_qdma *qdma, int channel, ++ u32 addr, enum trtcm_param_type param, ++ enum trtcm_mode_type mode, ++ u32 *val_low, u32 *val_high) ++{ ++ u32 idx = QDMA_METER_IDX(channel), group = QDMA_METER_GROUP(channel); ++ u32 val, config = FIELD_PREP(TRTCM_PARAM_TYPE_MASK, param) | ++ FIELD_PREP(TRTCM_METER_GROUP_MASK, group) | ++ FIELD_PREP(TRTCM_PARAM_INDEX_MASK, idx) | ++ FIELD_PREP(TRTCM_PARAM_RATE_TYPE_MASK, mode); ++ ++ airoha_qdma_wr(qdma, REG_TRTCM_CFG_PARAM(addr), config); ++ if (read_poll_timeout(airoha_qdma_rr, val, ++ val & TRTCM_PARAM_RW_DONE_MASK, ++ USEC_PER_MSEC, 10 * USEC_PER_MSEC, true, ++ qdma, REG_TRTCM_CFG_PARAM(addr))) ++ return -ETIMEDOUT; ++ ++ *val_low = airoha_qdma_rr(qdma, REG_TRTCM_DATA_LOW(addr)); ++ if (val_high) ++ *val_high = airoha_qdma_rr(qdma, REG_TRTCM_DATA_HIGH(addr)); ++ ++ return 0; ++} ++ ++static int airoha_qdma_set_trtcm_param(struct airoha_qdma *qdma, int channel, ++ u32 addr, enum trtcm_param_type param, ++ enum trtcm_mode_type mode, u32 val) ++{ ++ u32 idx = QDMA_METER_IDX(channel), group = QDMA_METER_GROUP(channel); ++ u32 config = TRTCM_PARAM_RW_MASK | ++ FIELD_PREP(TRTCM_PARAM_TYPE_MASK, param) | ++ FIELD_PREP(TRTCM_METER_GROUP_MASK, group) | ++ FIELD_PREP(TRTCM_PARAM_INDEX_MASK, idx) | ++ FIELD_PREP(TRTCM_PARAM_RATE_TYPE_MASK, mode); ++ ++ airoha_qdma_wr(qdma, REG_TRTCM_DATA_LOW(addr), val); ++ airoha_qdma_wr(qdma, REG_TRTCM_CFG_PARAM(addr), config); ++ ++ return read_poll_timeout(airoha_qdma_rr, val, ++ val & TRTCM_PARAM_RW_DONE_MASK, ++ USEC_PER_MSEC, 10 * USEC_PER_MSEC, true, ++ qdma, REG_TRTCM_CFG_PARAM(addr)); ++} ++ ++static int airoha_qdma_set_trtcm_config(struct airoha_qdma *qdma, int channel, ++ u32 addr, enum trtcm_mode_type mode, ++ bool enable, u32 enable_mask) ++{ ++ u32 val; ++ ++ if (airoha_qdma_get_trtcm_param(qdma, channel, addr, TRTCM_MISC_MODE, ++ mode, &val, NULL)) ++ return -EINVAL; ++ ++ val = enable ? val | enable_mask : val & ~enable_mask; ++ ++ return airoha_qdma_set_trtcm_param(qdma, channel, addr, TRTCM_MISC_MODE, ++ mode, val); ++} ++ ++static int airoha_qdma_set_trtcm_token_bucket(struct airoha_qdma *qdma, ++ int channel, u32 addr, ++ enum trtcm_mode_type mode, ++ u32 rate_val, u32 bucket_size) ++{ ++ u32 val, config, tick, unit, rate, rate_frac; ++ int err; ++ ++ if (airoha_qdma_get_trtcm_param(qdma, channel, addr, TRTCM_MISC_MODE, ++ mode, &config, NULL)) ++ return -EINVAL; ++ ++ val = airoha_qdma_rr(qdma, addr); ++ tick = FIELD_GET(INGRESS_FAST_TICK_MASK, val); ++ if (config & TRTCM_TICK_SEL) ++ tick *= FIELD_GET(INGRESS_SLOW_TICK_RATIO_MASK, val); ++ if (!tick) ++ return -EINVAL; ++ ++ unit = (config & TRTCM_PKT_MODE) ? 1000000 / tick : 8000 / tick; ++ if (!unit) ++ return -EINVAL; ++ ++ rate = rate_val / unit; ++ rate_frac = rate_val % unit; ++ rate_frac = FIELD_PREP(TRTCM_TOKEN_RATE_MASK, rate_frac) / unit; ++ rate = FIELD_PREP(TRTCM_TOKEN_RATE_MASK, rate) | ++ FIELD_PREP(TRTCM_TOKEN_RATE_FRACTION_MASK, rate_frac); ++ ++ err = airoha_qdma_set_trtcm_param(qdma, channel, addr, ++ TRTCM_TOKEN_RATE_MODE, mode, rate); ++ if (err) ++ return err; ++ ++ val = max_t(u32, bucket_size, MIN_TOKEN_SIZE); ++ val = min_t(u32, __fls(val), MAX_TOKEN_SIZE_OFFSET); ++ ++ return airoha_qdma_set_trtcm_param(qdma, channel, addr, ++ TRTCM_BUCKETSIZE_SHIFT_MODE, ++ mode, val); ++} ++ ++static int airoha_qdma_set_tx_rate_limit(struct airoha_gdm_port *port, ++ int channel, u32 rate, ++ u32 bucket_size) ++{ ++ int i, err; ++ ++ for (i = 0; i <= TRTCM_PEAK_MODE; i++) { ++ err = airoha_qdma_set_trtcm_config(port->qdma, channel, ++ REG_EGRESS_TRTCM_CFG, i, ++ !!rate, TRTCM_METER_MODE); ++ if (err) ++ return err; ++ ++ err = airoha_qdma_set_trtcm_token_bucket(port->qdma, channel, ++ REG_EGRESS_TRTCM_CFG, ++ i, rate, bucket_size); ++ if (err) ++ return err; ++ } ++ ++ return 0; ++} ++ ++static int airoha_tc_htb_alloc_leaf_queue(struct airoha_gdm_port *port, ++ struct tc_htb_qopt_offload *opt) ++{ ++ u32 channel = TC_H_MIN(opt->classid) % AIROHA_NUM_QOS_CHANNELS; ++ u32 rate = div_u64(opt->rate, 1000) << 3; /* kbps */ ++ struct net_device *dev = port->dev; ++ int num_tx_queues = dev->real_num_tx_queues; ++ int err; ++ ++ if (opt->parent_classid != TC_HTB_CLASSID_ROOT) { ++ NL_SET_ERR_MSG_MOD(opt->extack, "invalid parent classid"); ++ return -EINVAL; ++ } ++ ++ err = airoha_qdma_set_tx_rate_limit(port, channel, rate, opt->quantum); ++ if (err) { ++ NL_SET_ERR_MSG_MOD(opt->extack, ++ "failed configuring htb offload"); ++ return err; ++ } ++ ++ if (opt->command == TC_HTB_NODE_MODIFY) ++ return 0; ++ ++ err = netif_set_real_num_tx_queues(dev, num_tx_queues + 1); ++ if (err) { ++ airoha_qdma_set_tx_rate_limit(port, channel, 0, opt->quantum); ++ NL_SET_ERR_MSG_MOD(opt->extack, ++ "failed setting real_num_tx_queues"); ++ return err; ++ } ++ ++ set_bit(channel, port->qos_sq_bmap); ++ opt->qid = AIROHA_NUM_TX_RING + channel; ++ ++ return 0; ++} ++ ++static void airoha_tc_remove_htb_queue(struct airoha_gdm_port *port, int queue) ++{ ++ struct net_device *dev = port->dev; ++ ++ netif_set_real_num_tx_queues(dev, dev->real_num_tx_queues - 1); ++ airoha_qdma_set_tx_rate_limit(port, queue + 1, 0, 0); ++ clear_bit(queue, port->qos_sq_bmap); ++} ++ ++static int airoha_tc_htb_delete_leaf_queue(struct airoha_gdm_port *port, ++ struct tc_htb_qopt_offload *opt) ++{ ++ u32 channel = TC_H_MIN(opt->classid) % AIROHA_NUM_QOS_CHANNELS; ++ ++ if (!test_bit(channel, port->qos_sq_bmap)) { ++ NL_SET_ERR_MSG_MOD(opt->extack, "invalid queue id"); ++ return -EINVAL; ++ } ++ ++ airoha_tc_remove_htb_queue(port, channel); ++ ++ return 0; ++} ++ ++static int airoha_tc_htb_destroy(struct airoha_gdm_port *port) ++{ ++ int q; ++ ++ for_each_set_bit(q, port->qos_sq_bmap, AIROHA_NUM_QOS_CHANNELS) ++ airoha_tc_remove_htb_queue(port, q); ++ ++ return 0; ++} ++ ++static int airoha_tc_get_htb_get_leaf_queue(struct airoha_gdm_port *port, ++ struct tc_htb_qopt_offload *opt) ++{ ++ u32 channel = TC_H_MIN(opt->classid) % AIROHA_NUM_QOS_CHANNELS; ++ ++ if (!test_bit(channel, port->qos_sq_bmap)) { ++ NL_SET_ERR_MSG_MOD(opt->extack, "invalid queue id"); ++ return -EINVAL; ++ } ++ ++ opt->qid = channel; ++ ++ return 0; ++} ++ ++static int airoha_tc_setup_qdisc_htb(struct airoha_gdm_port *port, ++ struct tc_htb_qopt_offload *opt) ++{ ++ switch (opt->command) { ++ case TC_HTB_CREATE: ++ break; ++ case TC_HTB_DESTROY: ++ return airoha_tc_htb_destroy(port); ++ case TC_HTB_NODE_MODIFY: ++ case TC_HTB_LEAF_ALLOC_QUEUE: ++ return airoha_tc_htb_alloc_leaf_queue(port, opt); ++ case TC_HTB_LEAF_DEL: ++ case TC_HTB_LEAF_DEL_LAST: ++ case TC_HTB_LEAF_DEL_LAST_FORCE: ++ return airoha_tc_htb_delete_leaf_queue(port, opt); ++ case TC_HTB_LEAF_QUERY_QUEUE: ++ return airoha_tc_get_htb_get_leaf_queue(port, opt); ++ default: ++ return -EOPNOTSUPP; ++ } ++ ++ return 0; ++} ++ ++static int airoha_dev_tc_setup(struct net_device *dev, enum tc_setup_type type, ++ void *type_data) ++{ ++ struct airoha_gdm_port *port = netdev_priv(dev); ++ ++ switch (type) { ++ case TC_SETUP_QDISC_ETS: ++ return airoha_tc_setup_qdisc_ets(port, type_data); ++ case TC_SETUP_QDISC_HTB: ++ return airoha_tc_setup_qdisc_htb(port, type_data); ++ default: ++ return -EOPNOTSUPP; ++ } ++} ++ ++static const struct net_device_ops airoha_netdev_ops = { ++ .ndo_init = airoha_dev_init, ++ .ndo_open = airoha_dev_open, ++ .ndo_stop = airoha_dev_stop, ++ .ndo_select_queue = airoha_dev_select_queue, ++ .ndo_start_xmit = airoha_dev_xmit, ++ .ndo_get_stats64 = airoha_dev_get_stats64, ++ .ndo_set_mac_address = airoha_dev_set_macaddr, ++ .ndo_setup_tc = airoha_dev_tc_setup, ++}; ++ ++static const struct ethtool_ops airoha_ethtool_ops = { ++ .get_drvinfo = airoha_ethtool_get_drvinfo, ++ .get_eth_mac_stats = airoha_ethtool_get_mac_stats, ++ .get_rmon_stats = airoha_ethtool_get_rmon_stats, ++}; ++ ++static int airoha_alloc_gdm_port(struct airoha_eth *eth, struct device_node *np) ++{ ++ const __be32 *id_ptr = of_get_property(np, "reg", NULL); ++ struct airoha_gdm_port *port; ++ struct airoha_qdma *qdma; ++ struct net_device *dev; ++ int err, index; ++ u32 id; ++ ++ if (!id_ptr) { ++ dev_err(eth->dev, "missing gdm port id\n"); ++ return -EINVAL; ++ } ++ ++ id = be32_to_cpup(id_ptr); ++ index = id - 1; ++ ++ if (!id || id > ARRAY_SIZE(eth->ports)) { ++ dev_err(eth->dev, "invalid gdm port id: %d\n", id); ++ return -EINVAL; ++ } ++ ++ if (eth->ports[index]) { ++ dev_err(eth->dev, "duplicate gdm port id: %d\n", id); ++ return -EINVAL; ++ } ++ ++ dev = devm_alloc_etherdev_mqs(eth->dev, sizeof(*port), ++ AIROHA_NUM_NETDEV_TX_RINGS, ++ AIROHA_NUM_RX_RING); ++ if (!dev) { ++ dev_err(eth->dev, "alloc_etherdev failed\n"); ++ return -ENOMEM; ++ } ++ ++ qdma = ð->qdma[index % AIROHA_MAX_NUM_QDMA]; ++ dev->netdev_ops = &airoha_netdev_ops; ++ dev->ethtool_ops = &airoha_ethtool_ops; ++ dev->max_mtu = AIROHA_MAX_MTU; ++ dev->watchdog_timeo = 5 * HZ; ++ dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_RXCSUM | ++ NETIF_F_TSO6 | NETIF_F_IPV6_CSUM | ++ NETIF_F_SG | NETIF_F_TSO | ++ NETIF_F_HW_TC; ++ dev->features |= dev->hw_features; ++ dev->dev.of_node = np; ++ dev->irq = qdma->irq; ++ SET_NETDEV_DEV(dev, eth->dev); ++ ++ /* reserve hw queues for HTB offloading */ ++ err = netif_set_real_num_tx_queues(dev, AIROHA_NUM_TX_RING); ++ if (err) ++ return err; ++ ++ err = of_get_ethdev_address(np, dev); ++ if (err) { ++ if (err == -EPROBE_DEFER) ++ return err; ++ ++ eth_hw_addr_random(dev); ++ dev_info(eth->dev, "generated random MAC address %pM\n", ++ dev->dev_addr); ++ } ++ ++ port = netdev_priv(dev); ++ u64_stats_init(&port->stats.syncp); ++ spin_lock_init(&port->stats.lock); ++ port->qdma = qdma; ++ port->dev = dev; ++ port->id = id; ++ eth->ports[index] = port; ++ ++ return register_netdev(dev); ++} ++ ++static int airoha_probe(struct platform_device *pdev) ++{ ++ struct device_node *np; ++ struct airoha_eth *eth; ++ int i, err; ++ ++ eth = devm_kzalloc(&pdev->dev, sizeof(*eth), GFP_KERNEL); ++ if (!eth) ++ return -ENOMEM; ++ ++ eth->dev = &pdev->dev; ++ ++ err = dma_set_mask_and_coherent(eth->dev, DMA_BIT_MASK(32)); ++ if (err) { ++ dev_err(eth->dev, "failed configuring DMA mask\n"); ++ return err; ++ } ++ ++ eth->fe_regs = devm_platform_ioremap_resource_byname(pdev, "fe"); ++ if (IS_ERR(eth->fe_regs)) ++ return dev_err_probe(eth->dev, PTR_ERR(eth->fe_regs), ++ "failed to iomap fe regs\n"); ++ ++ eth->rsts[0].id = "fe"; ++ eth->rsts[1].id = "pdma"; ++ eth->rsts[2].id = "qdma"; ++ err = devm_reset_control_bulk_get_exclusive(eth->dev, ++ ARRAY_SIZE(eth->rsts), ++ eth->rsts); ++ if (err) { ++ dev_err(eth->dev, "failed to get bulk reset lines\n"); ++ return err; ++ } ++ ++ eth->xsi_rsts[0].id = "xsi-mac"; ++ eth->xsi_rsts[1].id = "hsi0-mac"; ++ eth->xsi_rsts[2].id = "hsi1-mac"; ++ eth->xsi_rsts[3].id = "hsi-mac"; ++ eth->xsi_rsts[4].id = "xfp-mac"; ++ err = devm_reset_control_bulk_get_exclusive(eth->dev, ++ ARRAY_SIZE(eth->xsi_rsts), ++ eth->xsi_rsts); ++ if (err) { ++ dev_err(eth->dev, "failed to get bulk xsi reset lines\n"); ++ return err; ++ } ++ ++ eth->napi_dev = alloc_netdev_dummy(0); ++ if (!eth->napi_dev) ++ return -ENOMEM; ++ ++ /* Enable threaded NAPI by default */ ++ eth->napi_dev->threaded = true; ++ strscpy(eth->napi_dev->name, "qdma_eth", sizeof(eth->napi_dev->name)); ++ platform_set_drvdata(pdev, eth); ++ ++ err = airoha_hw_init(pdev, eth); ++ if (err) ++ goto error_hw_cleanup; ++ ++ for (i = 0; i < ARRAY_SIZE(eth->qdma); i++) ++ airoha_qdma_start_napi(ð->qdma[i]); ++ ++ for_each_child_of_node(pdev->dev.of_node, np) { ++ if (!of_device_is_compatible(np, "airoha,eth-mac")) ++ continue; ++ ++ if (!of_device_is_available(np)) ++ continue; ++ ++ err = airoha_alloc_gdm_port(eth, np); ++ if (err) { ++ of_node_put(np); ++ goto error_napi_stop; ++ } ++ } ++ ++ return 0; ++ ++error_napi_stop: ++ for (i = 0; i < ARRAY_SIZE(eth->qdma); i++) ++ airoha_qdma_stop_napi(ð->qdma[i]); ++error_hw_cleanup: ++ for (i = 0; i < ARRAY_SIZE(eth->qdma); i++) ++ airoha_hw_cleanup(ð->qdma[i]); ++ ++ for (i = 0; i < ARRAY_SIZE(eth->ports); i++) { ++ struct airoha_gdm_port *port = eth->ports[i]; ++ ++ if (port && port->dev->reg_state == NETREG_REGISTERED) ++ unregister_netdev(port->dev); ++ } ++ free_netdev(eth->napi_dev); ++ platform_set_drvdata(pdev, NULL); ++ ++ return err; ++} ++ ++static void airoha_remove(struct platform_device *pdev) ++{ ++ struct airoha_eth *eth = platform_get_drvdata(pdev); ++ int i; ++ ++ for (i = 0; i < ARRAY_SIZE(eth->qdma); i++) { ++ airoha_qdma_stop_napi(ð->qdma[i]); ++ airoha_hw_cleanup(ð->qdma[i]); ++ } ++ ++ for (i = 0; i < ARRAY_SIZE(eth->ports); i++) { ++ struct airoha_gdm_port *port = eth->ports[i]; ++ ++ if (!port) ++ continue; ++ ++ airoha_dev_stop(port->dev); ++ unregister_netdev(port->dev); ++ } ++ free_netdev(eth->napi_dev); ++ ++ platform_set_drvdata(pdev, NULL); ++} ++ ++static const struct of_device_id of_airoha_match[] = { ++ { .compatible = "airoha,en7581-eth" }, ++ { /* sentinel */ } ++}; ++MODULE_DEVICE_TABLE(of, of_airoha_match); ++ ++static struct platform_driver airoha_driver = { ++ .probe = airoha_probe, ++ .remove_new = airoha_remove, ++ .driver = { ++ .name = KBUILD_MODNAME, ++ .of_match_table = of_airoha_match, ++ }, ++}; ++module_platform_driver(airoha_driver); ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Lorenzo Bianconi "); ++MODULE_DESCRIPTION("Ethernet driver for Airoha SoC"); +--- a/drivers/net/ethernet/mediatek/airoha_eth.c ++++ /dev/null +@@ -1,3359 +0,0 @@ +-// SPDX-License-Identifier: GPL-2.0-only +-/* +- * Copyright (c) 2024 AIROHA Inc +- * Author: Lorenzo Bianconi +- */ +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#define AIROHA_MAX_NUM_GDM_PORTS 1 +-#define AIROHA_MAX_NUM_QDMA 2 +-#define AIROHA_MAX_NUM_RSTS 3 +-#define AIROHA_MAX_NUM_XSI_RSTS 5 +-#define AIROHA_MAX_MTU 2000 +-#define AIROHA_MAX_PACKET_SIZE 2048 +-#define AIROHA_NUM_QOS_CHANNELS 4 +-#define AIROHA_NUM_QOS_QUEUES 8 +-#define AIROHA_NUM_TX_RING 32 +-#define AIROHA_NUM_RX_RING 32 +-#define AIROHA_NUM_NETDEV_TX_RINGS (AIROHA_NUM_TX_RING + \ +- AIROHA_NUM_QOS_CHANNELS) +-#define AIROHA_FE_MC_MAX_VLAN_TABLE 64 +-#define AIROHA_FE_MC_MAX_VLAN_PORT 16 +-#define AIROHA_NUM_TX_IRQ 2 +-#define HW_DSCP_NUM 2048 +-#define IRQ_QUEUE_LEN(_n) ((_n) ? 1024 : 2048) +-#define TX_DSCP_NUM 1024 +-#define RX_DSCP_NUM(_n) \ +- ((_n) == 2 ? 128 : \ +- (_n) == 11 ? 128 : \ +- (_n) == 15 ? 128 : \ +- (_n) == 0 ? 1024 : 16) +- +-#define PSE_RSV_PAGES 128 +-#define PSE_QUEUE_RSV_PAGES 64 +- +-#define QDMA_METER_IDX(_n) ((_n) & 0xff) +-#define QDMA_METER_GROUP(_n) (((_n) >> 8) & 0x3) +- +-/* FE */ +-#define PSE_BASE 0x0100 +-#define CSR_IFC_BASE 0x0200 +-#define CDM1_BASE 0x0400 +-#define GDM1_BASE 0x0500 +-#define PPE1_BASE 0x0c00 +- +-#define CDM2_BASE 0x1400 +-#define GDM2_BASE 0x1500 +- +-#define GDM3_BASE 0x1100 +-#define GDM4_BASE 0x2500 +- +-#define GDM_BASE(_n) \ +- ((_n) == 4 ? GDM4_BASE : \ +- (_n) == 3 ? GDM3_BASE : \ +- (_n) == 2 ? GDM2_BASE : GDM1_BASE) +- +-#define REG_FE_DMA_GLO_CFG 0x0000 +-#define FE_DMA_GLO_L2_SPACE_MASK GENMASK(7, 4) +-#define FE_DMA_GLO_PG_SZ_MASK BIT(3) +- +-#define REG_FE_RST_GLO_CFG 0x0004 +-#define FE_RST_GDM4_MBI_ARB_MASK BIT(3) +-#define FE_RST_GDM3_MBI_ARB_MASK BIT(2) +-#define FE_RST_CORE_MASK BIT(0) +- +-#define REG_FE_WAN_MAC_H 0x0030 +-#define REG_FE_LAN_MAC_H 0x0040 +- +-#define REG_FE_MAC_LMIN(_n) ((_n) + 0x04) +-#define REG_FE_MAC_LMAX(_n) ((_n) + 0x08) +- +-#define REG_FE_CDM1_OQ_MAP0 0x0050 +-#define REG_FE_CDM1_OQ_MAP1 0x0054 +-#define REG_FE_CDM1_OQ_MAP2 0x0058 +-#define REG_FE_CDM1_OQ_MAP3 0x005c +- +-#define REG_FE_PCE_CFG 0x0070 +-#define PCE_DPI_EN_MASK BIT(2) +-#define PCE_KA_EN_MASK BIT(1) +-#define PCE_MC_EN_MASK BIT(0) +- +-#define REG_FE_PSE_QUEUE_CFG_WR 0x0080 +-#define PSE_CFG_PORT_ID_MASK GENMASK(27, 24) +-#define PSE_CFG_QUEUE_ID_MASK GENMASK(20, 16) +-#define PSE_CFG_WR_EN_MASK BIT(8) +-#define PSE_CFG_OQRSV_SEL_MASK BIT(0) +- +-#define REG_FE_PSE_QUEUE_CFG_VAL 0x0084 +-#define PSE_CFG_OQ_RSV_MASK GENMASK(13, 0) +- +-#define PSE_FQ_CFG 0x008c +-#define PSE_FQ_LIMIT_MASK GENMASK(14, 0) +- +-#define REG_FE_PSE_BUF_SET 0x0090 +-#define PSE_SHARE_USED_LTHD_MASK GENMASK(31, 16) +-#define PSE_ALLRSV_MASK GENMASK(14, 0) +- +-#define REG_PSE_SHARE_USED_THD 0x0094 +-#define PSE_SHARE_USED_MTHD_MASK GENMASK(31, 16) +-#define PSE_SHARE_USED_HTHD_MASK GENMASK(15, 0) +- +-#define REG_GDM_MISC_CFG 0x0148 +-#define GDM2_RDM_ACK_WAIT_PREF_MASK BIT(9) +-#define GDM2_CHN_VLD_MODE_MASK BIT(5) +- +-#define REG_FE_CSR_IFC_CFG CSR_IFC_BASE +-#define FE_IFC_EN_MASK BIT(0) +- +-#define REG_FE_VIP_PORT_EN 0x01f0 +-#define REG_FE_IFC_PORT_EN 0x01f4 +- +-#define REG_PSE_IQ_REV1 (PSE_BASE + 0x08) +-#define PSE_IQ_RES1_P2_MASK GENMASK(23, 16) +- +-#define REG_PSE_IQ_REV2 (PSE_BASE + 0x0c) +-#define PSE_IQ_RES2_P5_MASK GENMASK(15, 8) +-#define PSE_IQ_RES2_P4_MASK GENMASK(7, 0) +- +-#define REG_FE_VIP_EN(_n) (0x0300 + ((_n) << 3)) +-#define PATN_FCPU_EN_MASK BIT(7) +-#define PATN_SWP_EN_MASK BIT(6) +-#define PATN_DP_EN_MASK BIT(5) +-#define PATN_SP_EN_MASK BIT(4) +-#define PATN_TYPE_MASK GENMASK(3, 1) +-#define PATN_EN_MASK BIT(0) +- +-#define REG_FE_VIP_PATN(_n) (0x0304 + ((_n) << 3)) +-#define PATN_DP_MASK GENMASK(31, 16) +-#define PATN_SP_MASK GENMASK(15, 0) +- +-#define REG_CDM1_VLAN_CTRL CDM1_BASE +-#define CDM1_VLAN_MASK GENMASK(31, 16) +- +-#define REG_CDM1_FWD_CFG (CDM1_BASE + 0x08) +-#define CDM1_VIP_QSEL_MASK GENMASK(24, 20) +- +-#define REG_CDM1_CRSN_QSEL(_n) (CDM1_BASE + 0x10 + ((_n) << 2)) +-#define CDM1_CRSN_QSEL_REASON_MASK(_n) \ +- GENMASK(4 + (((_n) % 4) << 3), (((_n) % 4) << 3)) +- +-#define REG_CDM2_FWD_CFG (CDM2_BASE + 0x08) +-#define CDM2_OAM_QSEL_MASK GENMASK(31, 27) +-#define CDM2_VIP_QSEL_MASK GENMASK(24, 20) +- +-#define REG_CDM2_CRSN_QSEL(_n) (CDM2_BASE + 0x10 + ((_n) << 2)) +-#define CDM2_CRSN_QSEL_REASON_MASK(_n) \ +- GENMASK(4 + (((_n) % 4) << 3), (((_n) % 4) << 3)) +- +-#define REG_GDM_FWD_CFG(_n) GDM_BASE(_n) +-#define GDM_DROP_CRC_ERR BIT(23) +-#define GDM_IP4_CKSUM BIT(22) +-#define GDM_TCP_CKSUM BIT(21) +-#define GDM_UDP_CKSUM BIT(20) +-#define GDM_UCFQ_MASK GENMASK(15, 12) +-#define GDM_BCFQ_MASK GENMASK(11, 8) +-#define GDM_MCFQ_MASK GENMASK(7, 4) +-#define GDM_OCFQ_MASK GENMASK(3, 0) +- +-#define REG_GDM_INGRESS_CFG(_n) (GDM_BASE(_n) + 0x10) +-#define GDM_INGRESS_FC_EN_MASK BIT(1) +-#define GDM_STAG_EN_MASK BIT(0) +- +-#define REG_GDM_LEN_CFG(_n) (GDM_BASE(_n) + 0x14) +-#define GDM_SHORT_LEN_MASK GENMASK(13, 0) +-#define GDM_LONG_LEN_MASK GENMASK(29, 16) +- +-#define REG_FE_CPORT_CFG (GDM1_BASE + 0x40) +-#define FE_CPORT_PAD BIT(26) +-#define FE_CPORT_PORT_XFC_MASK BIT(25) +-#define FE_CPORT_QUEUE_XFC_MASK BIT(24) +- +-#define REG_FE_GDM_MIB_CLEAR(_n) (GDM_BASE(_n) + 0xf0) +-#define FE_GDM_MIB_RX_CLEAR_MASK BIT(1) +-#define FE_GDM_MIB_TX_CLEAR_MASK BIT(0) +- +-#define REG_FE_GDM1_MIB_CFG (GDM1_BASE + 0xf4) +-#define FE_STRICT_RFC2819_MODE_MASK BIT(31) +-#define FE_GDM1_TX_MIB_SPLIT_EN_MASK BIT(17) +-#define FE_GDM1_RX_MIB_SPLIT_EN_MASK BIT(16) +-#define FE_TX_MIB_ID_MASK GENMASK(15, 8) +-#define FE_RX_MIB_ID_MASK GENMASK(7, 0) +- +-#define REG_FE_GDM_TX_OK_PKT_CNT_L(_n) (GDM_BASE(_n) + 0x104) +-#define REG_FE_GDM_TX_OK_BYTE_CNT_L(_n) (GDM_BASE(_n) + 0x10c) +-#define REG_FE_GDM_TX_ETH_PKT_CNT_L(_n) (GDM_BASE(_n) + 0x110) +-#define REG_FE_GDM_TX_ETH_BYTE_CNT_L(_n) (GDM_BASE(_n) + 0x114) +-#define REG_FE_GDM_TX_ETH_DROP_CNT(_n) (GDM_BASE(_n) + 0x118) +-#define REG_FE_GDM_TX_ETH_BC_CNT(_n) (GDM_BASE(_n) + 0x11c) +-#define REG_FE_GDM_TX_ETH_MC_CNT(_n) (GDM_BASE(_n) + 0x120) +-#define REG_FE_GDM_TX_ETH_RUNT_CNT(_n) (GDM_BASE(_n) + 0x124) +-#define REG_FE_GDM_TX_ETH_LONG_CNT(_n) (GDM_BASE(_n) + 0x128) +-#define REG_FE_GDM_TX_ETH_E64_CNT_L(_n) (GDM_BASE(_n) + 0x12c) +-#define REG_FE_GDM_TX_ETH_L64_CNT_L(_n) (GDM_BASE(_n) + 0x130) +-#define REG_FE_GDM_TX_ETH_L127_CNT_L(_n) (GDM_BASE(_n) + 0x134) +-#define REG_FE_GDM_TX_ETH_L255_CNT_L(_n) (GDM_BASE(_n) + 0x138) +-#define REG_FE_GDM_TX_ETH_L511_CNT_L(_n) (GDM_BASE(_n) + 0x13c) +-#define REG_FE_GDM_TX_ETH_L1023_CNT_L(_n) (GDM_BASE(_n) + 0x140) +- +-#define REG_FE_GDM_RX_OK_PKT_CNT_L(_n) (GDM_BASE(_n) + 0x148) +-#define REG_FE_GDM_RX_FC_DROP_CNT(_n) (GDM_BASE(_n) + 0x14c) +-#define REG_FE_GDM_RX_RC_DROP_CNT(_n) (GDM_BASE(_n) + 0x150) +-#define REG_FE_GDM_RX_OVERFLOW_DROP_CNT(_n) (GDM_BASE(_n) + 0x154) +-#define REG_FE_GDM_RX_ERROR_DROP_CNT(_n) (GDM_BASE(_n) + 0x158) +-#define REG_FE_GDM_RX_OK_BYTE_CNT_L(_n) (GDM_BASE(_n) + 0x15c) +-#define REG_FE_GDM_RX_ETH_PKT_CNT_L(_n) (GDM_BASE(_n) + 0x160) +-#define REG_FE_GDM_RX_ETH_BYTE_CNT_L(_n) (GDM_BASE(_n) + 0x164) +-#define REG_FE_GDM_RX_ETH_DROP_CNT(_n) (GDM_BASE(_n) + 0x168) +-#define REG_FE_GDM_RX_ETH_BC_CNT(_n) (GDM_BASE(_n) + 0x16c) +-#define REG_FE_GDM_RX_ETH_MC_CNT(_n) (GDM_BASE(_n) + 0x170) +-#define REG_FE_GDM_RX_ETH_CRC_ERR_CNT(_n) (GDM_BASE(_n) + 0x174) +-#define REG_FE_GDM_RX_ETH_FRAG_CNT(_n) (GDM_BASE(_n) + 0x178) +-#define REG_FE_GDM_RX_ETH_JABBER_CNT(_n) (GDM_BASE(_n) + 0x17c) +-#define REG_FE_GDM_RX_ETH_RUNT_CNT(_n) (GDM_BASE(_n) + 0x180) +-#define REG_FE_GDM_RX_ETH_LONG_CNT(_n) (GDM_BASE(_n) + 0x184) +-#define REG_FE_GDM_RX_ETH_E64_CNT_L(_n) (GDM_BASE(_n) + 0x188) +-#define REG_FE_GDM_RX_ETH_L64_CNT_L(_n) (GDM_BASE(_n) + 0x18c) +-#define REG_FE_GDM_RX_ETH_L127_CNT_L(_n) (GDM_BASE(_n) + 0x190) +-#define REG_FE_GDM_RX_ETH_L255_CNT_L(_n) (GDM_BASE(_n) + 0x194) +-#define REG_FE_GDM_RX_ETH_L511_CNT_L(_n) (GDM_BASE(_n) + 0x198) +-#define REG_FE_GDM_RX_ETH_L1023_CNT_L(_n) (GDM_BASE(_n) + 0x19c) +- +-#define REG_PPE1_TB_HASH_CFG (PPE1_BASE + 0x250) +-#define PPE1_SRAM_TABLE_EN_MASK BIT(0) +-#define PPE1_SRAM_HASH1_EN_MASK BIT(8) +-#define PPE1_DRAM_TABLE_EN_MASK BIT(16) +-#define PPE1_DRAM_HASH1_EN_MASK BIT(24) +- +-#define REG_FE_GDM_TX_OK_PKT_CNT_H(_n) (GDM_BASE(_n) + 0x280) +-#define REG_FE_GDM_TX_OK_BYTE_CNT_H(_n) (GDM_BASE(_n) + 0x284) +-#define REG_FE_GDM_TX_ETH_PKT_CNT_H(_n) (GDM_BASE(_n) + 0x288) +-#define REG_FE_GDM_TX_ETH_BYTE_CNT_H(_n) (GDM_BASE(_n) + 0x28c) +- +-#define REG_FE_GDM_RX_OK_PKT_CNT_H(_n) (GDM_BASE(_n) + 0x290) +-#define REG_FE_GDM_RX_OK_BYTE_CNT_H(_n) (GDM_BASE(_n) + 0x294) +-#define REG_FE_GDM_RX_ETH_PKT_CNT_H(_n) (GDM_BASE(_n) + 0x298) +-#define REG_FE_GDM_RX_ETH_BYTE_CNT_H(_n) (GDM_BASE(_n) + 0x29c) +-#define REG_FE_GDM_TX_ETH_E64_CNT_H(_n) (GDM_BASE(_n) + 0x2b8) +-#define REG_FE_GDM_TX_ETH_L64_CNT_H(_n) (GDM_BASE(_n) + 0x2bc) +-#define REG_FE_GDM_TX_ETH_L127_CNT_H(_n) (GDM_BASE(_n) + 0x2c0) +-#define REG_FE_GDM_TX_ETH_L255_CNT_H(_n) (GDM_BASE(_n) + 0x2c4) +-#define REG_FE_GDM_TX_ETH_L511_CNT_H(_n) (GDM_BASE(_n) + 0x2c8) +-#define REG_FE_GDM_TX_ETH_L1023_CNT_H(_n) (GDM_BASE(_n) + 0x2cc) +-#define REG_FE_GDM_RX_ETH_E64_CNT_H(_n) (GDM_BASE(_n) + 0x2e8) +-#define REG_FE_GDM_RX_ETH_L64_CNT_H(_n) (GDM_BASE(_n) + 0x2ec) +-#define REG_FE_GDM_RX_ETH_L127_CNT_H(_n) (GDM_BASE(_n) + 0x2f0) +-#define REG_FE_GDM_RX_ETH_L255_CNT_H(_n) (GDM_BASE(_n) + 0x2f4) +-#define REG_FE_GDM_RX_ETH_L511_CNT_H(_n) (GDM_BASE(_n) + 0x2f8) +-#define REG_FE_GDM_RX_ETH_L1023_CNT_H(_n) (GDM_BASE(_n) + 0x2fc) +- +-#define REG_GDM2_CHN_RLS (GDM2_BASE + 0x20) +-#define MBI_RX_AGE_SEL_MASK GENMASK(26, 25) +-#define MBI_TX_AGE_SEL_MASK GENMASK(18, 17) +- +-#define REG_GDM3_FWD_CFG GDM3_BASE +-#define GDM3_PAD_EN_MASK BIT(28) +- +-#define REG_GDM4_FWD_CFG GDM4_BASE +-#define GDM4_PAD_EN_MASK BIT(28) +-#define GDM4_SPORT_OFFSET0_MASK GENMASK(11, 8) +- +-#define REG_GDM4_SRC_PORT_SET (GDM4_BASE + 0x23c) +-#define GDM4_SPORT_OFF2_MASK GENMASK(19, 16) +-#define GDM4_SPORT_OFF1_MASK GENMASK(15, 12) +-#define GDM4_SPORT_OFF0_MASK GENMASK(11, 8) +- +-#define REG_IP_FRAG_FP 0x2010 +-#define IP_ASSEMBLE_PORT_MASK GENMASK(24, 21) +-#define IP_ASSEMBLE_NBQ_MASK GENMASK(20, 16) +-#define IP_FRAGMENT_PORT_MASK GENMASK(8, 5) +-#define IP_FRAGMENT_NBQ_MASK GENMASK(4, 0) +- +-#define REG_MC_VLAN_EN 0x2100 +-#define MC_VLAN_EN_MASK BIT(0) +- +-#define REG_MC_VLAN_CFG 0x2104 +-#define MC_VLAN_CFG_CMD_DONE_MASK BIT(31) +-#define MC_VLAN_CFG_TABLE_ID_MASK GENMASK(21, 16) +-#define MC_VLAN_CFG_PORT_ID_MASK GENMASK(11, 8) +-#define MC_VLAN_CFG_TABLE_SEL_MASK BIT(4) +-#define MC_VLAN_CFG_RW_MASK BIT(0) +- +-#define REG_MC_VLAN_DATA 0x2108 +- +-#define REG_CDM5_RX_OQ1_DROP_CNT 0x29d4 +- +-/* QDMA */ +-#define REG_QDMA_GLOBAL_CFG 0x0004 +-#define GLOBAL_CFG_RX_2B_OFFSET_MASK BIT(31) +-#define GLOBAL_CFG_DMA_PREFERENCE_MASK GENMASK(30, 29) +-#define GLOBAL_CFG_CPU_TXR_RR_MASK BIT(28) +-#define GLOBAL_CFG_DSCP_BYTE_SWAP_MASK BIT(27) +-#define GLOBAL_CFG_PAYLOAD_BYTE_SWAP_MASK BIT(26) +-#define GLOBAL_CFG_MULTICAST_MODIFY_FP_MASK BIT(25) +-#define GLOBAL_CFG_OAM_MODIFY_MASK BIT(24) +-#define GLOBAL_CFG_RESET_MASK BIT(23) +-#define GLOBAL_CFG_RESET_DONE_MASK BIT(22) +-#define GLOBAL_CFG_MULTICAST_EN_MASK BIT(21) +-#define GLOBAL_CFG_IRQ1_EN_MASK BIT(20) +-#define GLOBAL_CFG_IRQ0_EN_MASK BIT(19) +-#define GLOBAL_CFG_LOOPCNT_EN_MASK BIT(18) +-#define GLOBAL_CFG_RD_BYPASS_WR_MASK BIT(17) +-#define GLOBAL_CFG_QDMA_LOOPBACK_MASK BIT(16) +-#define GLOBAL_CFG_LPBK_RXQ_SEL_MASK GENMASK(13, 8) +-#define GLOBAL_CFG_CHECK_DONE_MASK BIT(7) +-#define GLOBAL_CFG_TX_WB_DONE_MASK BIT(6) +-#define GLOBAL_CFG_MAX_ISSUE_NUM_MASK GENMASK(5, 4) +-#define GLOBAL_CFG_RX_DMA_BUSY_MASK BIT(3) +-#define GLOBAL_CFG_RX_DMA_EN_MASK BIT(2) +-#define GLOBAL_CFG_TX_DMA_BUSY_MASK BIT(1) +-#define GLOBAL_CFG_TX_DMA_EN_MASK BIT(0) +- +-#define REG_FWD_DSCP_BASE 0x0010 +-#define REG_FWD_BUF_BASE 0x0014 +- +-#define REG_HW_FWD_DSCP_CFG 0x0018 +-#define HW_FWD_DSCP_PAYLOAD_SIZE_MASK GENMASK(29, 28) +-#define HW_FWD_DSCP_SCATTER_LEN_MASK GENMASK(17, 16) +-#define HW_FWD_DSCP_MIN_SCATTER_LEN_MASK GENMASK(15, 0) +- +-#define REG_INT_STATUS(_n) \ +- (((_n) == 4) ? 0x0730 : \ +- ((_n) == 3) ? 0x0724 : \ +- ((_n) == 2) ? 0x0720 : \ +- ((_n) == 1) ? 0x0024 : 0x0020) +- +-#define REG_INT_ENABLE(_n) \ +- (((_n) == 4) ? 0x0750 : \ +- ((_n) == 3) ? 0x0744 : \ +- ((_n) == 2) ? 0x0740 : \ +- ((_n) == 1) ? 0x002c : 0x0028) +- +-/* QDMA_CSR_INT_ENABLE1 */ +-#define RX15_COHERENT_INT_MASK BIT(31) +-#define RX14_COHERENT_INT_MASK BIT(30) +-#define RX13_COHERENT_INT_MASK BIT(29) +-#define RX12_COHERENT_INT_MASK BIT(28) +-#define RX11_COHERENT_INT_MASK BIT(27) +-#define RX10_COHERENT_INT_MASK BIT(26) +-#define RX9_COHERENT_INT_MASK BIT(25) +-#define RX8_COHERENT_INT_MASK BIT(24) +-#define RX7_COHERENT_INT_MASK BIT(23) +-#define RX6_COHERENT_INT_MASK BIT(22) +-#define RX5_COHERENT_INT_MASK BIT(21) +-#define RX4_COHERENT_INT_MASK BIT(20) +-#define RX3_COHERENT_INT_MASK BIT(19) +-#define RX2_COHERENT_INT_MASK BIT(18) +-#define RX1_COHERENT_INT_MASK BIT(17) +-#define RX0_COHERENT_INT_MASK BIT(16) +-#define TX7_COHERENT_INT_MASK BIT(15) +-#define TX6_COHERENT_INT_MASK BIT(14) +-#define TX5_COHERENT_INT_MASK BIT(13) +-#define TX4_COHERENT_INT_MASK BIT(12) +-#define TX3_COHERENT_INT_MASK BIT(11) +-#define TX2_COHERENT_INT_MASK BIT(10) +-#define TX1_COHERENT_INT_MASK BIT(9) +-#define TX0_COHERENT_INT_MASK BIT(8) +-#define CNT_OVER_FLOW_INT_MASK BIT(7) +-#define IRQ1_FULL_INT_MASK BIT(5) +-#define IRQ1_INT_MASK BIT(4) +-#define HWFWD_DSCP_LOW_INT_MASK BIT(3) +-#define HWFWD_DSCP_EMPTY_INT_MASK BIT(2) +-#define IRQ0_FULL_INT_MASK BIT(1) +-#define IRQ0_INT_MASK BIT(0) +- +-#define TX_DONE_INT_MASK(_n) \ +- ((_n) ? IRQ1_INT_MASK | IRQ1_FULL_INT_MASK \ +- : IRQ0_INT_MASK | IRQ0_FULL_INT_MASK) +- +-#define INT_TX_MASK \ +- (IRQ1_INT_MASK | IRQ1_FULL_INT_MASK | \ +- IRQ0_INT_MASK | IRQ0_FULL_INT_MASK) +- +-#define INT_IDX0_MASK \ +- (TX0_COHERENT_INT_MASK | TX1_COHERENT_INT_MASK | \ +- TX2_COHERENT_INT_MASK | TX3_COHERENT_INT_MASK | \ +- TX4_COHERENT_INT_MASK | TX5_COHERENT_INT_MASK | \ +- TX6_COHERENT_INT_MASK | TX7_COHERENT_INT_MASK | \ +- RX0_COHERENT_INT_MASK | RX1_COHERENT_INT_MASK | \ +- RX2_COHERENT_INT_MASK | RX3_COHERENT_INT_MASK | \ +- RX4_COHERENT_INT_MASK | RX7_COHERENT_INT_MASK | \ +- RX8_COHERENT_INT_MASK | RX9_COHERENT_INT_MASK | \ +- RX15_COHERENT_INT_MASK | INT_TX_MASK) +- +-/* QDMA_CSR_INT_ENABLE2 */ +-#define RX15_NO_CPU_DSCP_INT_MASK BIT(31) +-#define RX14_NO_CPU_DSCP_INT_MASK BIT(30) +-#define RX13_NO_CPU_DSCP_INT_MASK BIT(29) +-#define RX12_NO_CPU_DSCP_INT_MASK BIT(28) +-#define RX11_NO_CPU_DSCP_INT_MASK BIT(27) +-#define RX10_NO_CPU_DSCP_INT_MASK BIT(26) +-#define RX9_NO_CPU_DSCP_INT_MASK BIT(25) +-#define RX8_NO_CPU_DSCP_INT_MASK BIT(24) +-#define RX7_NO_CPU_DSCP_INT_MASK BIT(23) +-#define RX6_NO_CPU_DSCP_INT_MASK BIT(22) +-#define RX5_NO_CPU_DSCP_INT_MASK BIT(21) +-#define RX4_NO_CPU_DSCP_INT_MASK BIT(20) +-#define RX3_NO_CPU_DSCP_INT_MASK BIT(19) +-#define RX2_NO_CPU_DSCP_INT_MASK BIT(18) +-#define RX1_NO_CPU_DSCP_INT_MASK BIT(17) +-#define RX0_NO_CPU_DSCP_INT_MASK BIT(16) +-#define RX15_DONE_INT_MASK BIT(15) +-#define RX14_DONE_INT_MASK BIT(14) +-#define RX13_DONE_INT_MASK BIT(13) +-#define RX12_DONE_INT_MASK BIT(12) +-#define RX11_DONE_INT_MASK BIT(11) +-#define RX10_DONE_INT_MASK BIT(10) +-#define RX9_DONE_INT_MASK BIT(9) +-#define RX8_DONE_INT_MASK BIT(8) +-#define RX7_DONE_INT_MASK BIT(7) +-#define RX6_DONE_INT_MASK BIT(6) +-#define RX5_DONE_INT_MASK BIT(5) +-#define RX4_DONE_INT_MASK BIT(4) +-#define RX3_DONE_INT_MASK BIT(3) +-#define RX2_DONE_INT_MASK BIT(2) +-#define RX1_DONE_INT_MASK BIT(1) +-#define RX0_DONE_INT_MASK BIT(0) +- +-#define RX_DONE_INT_MASK \ +- (RX0_DONE_INT_MASK | RX1_DONE_INT_MASK | \ +- RX2_DONE_INT_MASK | RX3_DONE_INT_MASK | \ +- RX4_DONE_INT_MASK | RX7_DONE_INT_MASK | \ +- RX8_DONE_INT_MASK | RX9_DONE_INT_MASK | \ +- RX15_DONE_INT_MASK) +-#define INT_IDX1_MASK \ +- (RX_DONE_INT_MASK | \ +- RX0_NO_CPU_DSCP_INT_MASK | RX1_NO_CPU_DSCP_INT_MASK | \ +- RX2_NO_CPU_DSCP_INT_MASK | RX3_NO_CPU_DSCP_INT_MASK | \ +- RX4_NO_CPU_DSCP_INT_MASK | RX7_NO_CPU_DSCP_INT_MASK | \ +- RX8_NO_CPU_DSCP_INT_MASK | RX9_NO_CPU_DSCP_INT_MASK | \ +- RX15_NO_CPU_DSCP_INT_MASK) +- +-/* QDMA_CSR_INT_ENABLE5 */ +-#define TX31_COHERENT_INT_MASK BIT(31) +-#define TX30_COHERENT_INT_MASK BIT(30) +-#define TX29_COHERENT_INT_MASK BIT(29) +-#define TX28_COHERENT_INT_MASK BIT(28) +-#define TX27_COHERENT_INT_MASK BIT(27) +-#define TX26_COHERENT_INT_MASK BIT(26) +-#define TX25_COHERENT_INT_MASK BIT(25) +-#define TX24_COHERENT_INT_MASK BIT(24) +-#define TX23_COHERENT_INT_MASK BIT(23) +-#define TX22_COHERENT_INT_MASK BIT(22) +-#define TX21_COHERENT_INT_MASK BIT(21) +-#define TX20_COHERENT_INT_MASK BIT(20) +-#define TX19_COHERENT_INT_MASK BIT(19) +-#define TX18_COHERENT_INT_MASK BIT(18) +-#define TX17_COHERENT_INT_MASK BIT(17) +-#define TX16_COHERENT_INT_MASK BIT(16) +-#define TX15_COHERENT_INT_MASK BIT(15) +-#define TX14_COHERENT_INT_MASK BIT(14) +-#define TX13_COHERENT_INT_MASK BIT(13) +-#define TX12_COHERENT_INT_MASK BIT(12) +-#define TX11_COHERENT_INT_MASK BIT(11) +-#define TX10_COHERENT_INT_MASK BIT(10) +-#define TX9_COHERENT_INT_MASK BIT(9) +-#define TX8_COHERENT_INT_MASK BIT(8) +- +-#define INT_IDX4_MASK \ +- (TX8_COHERENT_INT_MASK | TX9_COHERENT_INT_MASK | \ +- TX10_COHERENT_INT_MASK | TX11_COHERENT_INT_MASK | \ +- TX12_COHERENT_INT_MASK | TX13_COHERENT_INT_MASK | \ +- TX14_COHERENT_INT_MASK | TX15_COHERENT_INT_MASK | \ +- TX16_COHERENT_INT_MASK | TX17_COHERENT_INT_MASK | \ +- TX18_COHERENT_INT_MASK | TX19_COHERENT_INT_MASK | \ +- TX20_COHERENT_INT_MASK | TX21_COHERENT_INT_MASK | \ +- TX22_COHERENT_INT_MASK | TX23_COHERENT_INT_MASK | \ +- TX24_COHERENT_INT_MASK | TX25_COHERENT_INT_MASK | \ +- TX26_COHERENT_INT_MASK | TX27_COHERENT_INT_MASK | \ +- TX28_COHERENT_INT_MASK | TX29_COHERENT_INT_MASK | \ +- TX30_COHERENT_INT_MASK | TX31_COHERENT_INT_MASK) +- +-#define REG_TX_IRQ_BASE(_n) ((_n) ? 0x0048 : 0x0050) +- +-#define REG_TX_IRQ_CFG(_n) ((_n) ? 0x004c : 0x0054) +-#define TX_IRQ_THR_MASK GENMASK(27, 16) +-#define TX_IRQ_DEPTH_MASK GENMASK(11, 0) +- +-#define REG_IRQ_CLEAR_LEN(_n) ((_n) ? 0x0064 : 0x0058) +-#define IRQ_CLEAR_LEN_MASK GENMASK(7, 0) +- +-#define REG_IRQ_STATUS(_n) ((_n) ? 0x0068 : 0x005c) +-#define IRQ_ENTRY_LEN_MASK GENMASK(27, 16) +-#define IRQ_HEAD_IDX_MASK GENMASK(11, 0) +- +-#define REG_TX_RING_BASE(_n) \ +- (((_n) < 8) ? 0x0100 + ((_n) << 5) : 0x0b00 + (((_n) - 8) << 5)) +- +-#define REG_TX_RING_BLOCKING(_n) \ +- (((_n) < 8) ? 0x0104 + ((_n) << 5) : 0x0b04 + (((_n) - 8) << 5)) +- +-#define TX_RING_IRQ_BLOCKING_MAP_MASK BIT(6) +-#define TX_RING_IRQ_BLOCKING_CFG_MASK BIT(4) +-#define TX_RING_IRQ_BLOCKING_TX_DROP_EN_MASK BIT(2) +-#define TX_RING_IRQ_BLOCKING_MAX_TH_TXRING_EN_MASK BIT(1) +-#define TX_RING_IRQ_BLOCKING_MIN_TH_TXRING_EN_MASK BIT(0) +- +-#define REG_TX_CPU_IDX(_n) \ +- (((_n) < 8) ? 0x0108 + ((_n) << 5) : 0x0b08 + (((_n) - 8) << 5)) +- +-#define TX_RING_CPU_IDX_MASK GENMASK(15, 0) +- +-#define REG_TX_DMA_IDX(_n) \ +- (((_n) < 8) ? 0x010c + ((_n) << 5) : 0x0b0c + (((_n) - 8) << 5)) +- +-#define TX_RING_DMA_IDX_MASK GENMASK(15, 0) +- +-#define IRQ_RING_IDX_MASK GENMASK(20, 16) +-#define IRQ_DESC_IDX_MASK GENMASK(15, 0) +- +-#define REG_RX_RING_BASE(_n) \ +- (((_n) < 16) ? 0x0200 + ((_n) << 5) : 0x0e00 + (((_n) - 16) << 5)) +- +-#define REG_RX_RING_SIZE(_n) \ +- (((_n) < 16) ? 0x0204 + ((_n) << 5) : 0x0e04 + (((_n) - 16) << 5)) +- +-#define RX_RING_THR_MASK GENMASK(31, 16) +-#define RX_RING_SIZE_MASK GENMASK(15, 0) +- +-#define REG_RX_CPU_IDX(_n) \ +- (((_n) < 16) ? 0x0208 + ((_n) << 5) : 0x0e08 + (((_n) - 16) << 5)) +- +-#define RX_RING_CPU_IDX_MASK GENMASK(15, 0) +- +-#define REG_RX_DMA_IDX(_n) \ +- (((_n) < 16) ? 0x020c + ((_n) << 5) : 0x0e0c + (((_n) - 16) << 5)) +- +-#define REG_RX_DELAY_INT_IDX(_n) \ +- (((_n) < 16) ? 0x0210 + ((_n) << 5) : 0x0e10 + (((_n) - 16) << 5)) +- +-#define RX_DELAY_INT_MASK GENMASK(15, 0) +- +-#define RX_RING_DMA_IDX_MASK GENMASK(15, 0) +- +-#define REG_INGRESS_TRTCM_CFG 0x0070 +-#define INGRESS_TRTCM_EN_MASK BIT(31) +-#define INGRESS_TRTCM_MODE_MASK BIT(30) +-#define INGRESS_SLOW_TICK_RATIO_MASK GENMASK(29, 16) +-#define INGRESS_FAST_TICK_MASK GENMASK(15, 0) +- +-#define REG_QUEUE_CLOSE_CFG(_n) (0x00a0 + ((_n) & 0xfc)) +-#define TXQ_DISABLE_CHAN_QUEUE_MASK(_n, _m) BIT((_m) + (((_n) & 0x3) << 3)) +- +-#define REG_TXQ_DIS_CFG_BASE(_n) ((_n) ? 0x20a0 : 0x00a0) +-#define REG_TXQ_DIS_CFG(_n, _m) (REG_TXQ_DIS_CFG_BASE((_n)) + (_m) << 2) +- +-#define REG_CNTR_CFG(_n) (0x0400 + ((_n) << 3)) +-#define CNTR_EN_MASK BIT(31) +-#define CNTR_ALL_CHAN_EN_MASK BIT(30) +-#define CNTR_ALL_QUEUE_EN_MASK BIT(29) +-#define CNTR_ALL_DSCP_RING_EN_MASK BIT(28) +-#define CNTR_SRC_MASK GENMASK(27, 24) +-#define CNTR_DSCP_RING_MASK GENMASK(20, 16) +-#define CNTR_CHAN_MASK GENMASK(7, 3) +-#define CNTR_QUEUE_MASK GENMASK(2, 0) +- +-#define REG_CNTR_VAL(_n) (0x0404 + ((_n) << 3)) +- +-#define REG_LMGR_INIT_CFG 0x1000 +-#define LMGR_INIT_START BIT(31) +-#define LMGR_SRAM_MODE_MASK BIT(30) +-#define HW_FWD_PKTSIZE_OVERHEAD_MASK GENMASK(27, 20) +-#define HW_FWD_DESC_NUM_MASK GENMASK(16, 0) +- +-#define REG_FWD_DSCP_LOW_THR 0x1004 +-#define FWD_DSCP_LOW_THR_MASK GENMASK(17, 0) +- +-#define REG_EGRESS_RATE_METER_CFG 0x100c +-#define EGRESS_RATE_METER_EN_MASK BIT(31) +-#define EGRESS_RATE_METER_EQ_RATE_EN_MASK BIT(17) +-#define EGRESS_RATE_METER_WINDOW_SZ_MASK GENMASK(16, 12) +-#define EGRESS_RATE_METER_TIMESLICE_MASK GENMASK(10, 0) +- +-#define REG_EGRESS_TRTCM_CFG 0x1010 +-#define EGRESS_TRTCM_EN_MASK BIT(31) +-#define EGRESS_TRTCM_MODE_MASK BIT(30) +-#define EGRESS_SLOW_TICK_RATIO_MASK GENMASK(29, 16) +-#define EGRESS_FAST_TICK_MASK GENMASK(15, 0) +- +-#define TRTCM_PARAM_RW_MASK BIT(31) +-#define TRTCM_PARAM_RW_DONE_MASK BIT(30) +-#define TRTCM_PARAM_TYPE_MASK GENMASK(29, 28) +-#define TRTCM_METER_GROUP_MASK GENMASK(27, 26) +-#define TRTCM_PARAM_INDEX_MASK GENMASK(23, 17) +-#define TRTCM_PARAM_RATE_TYPE_MASK BIT(16) +- +-#define REG_TRTCM_CFG_PARAM(_n) ((_n) + 0x4) +-#define REG_TRTCM_DATA_LOW(_n) ((_n) + 0x8) +-#define REG_TRTCM_DATA_HIGH(_n) ((_n) + 0xc) +- +-#define REG_TXWRR_MODE_CFG 0x1020 +-#define TWRR_WEIGHT_SCALE_MASK BIT(31) +-#define TWRR_WEIGHT_BASE_MASK BIT(3) +- +-#define REG_TXWRR_WEIGHT_CFG 0x1024 +-#define TWRR_RW_CMD_MASK BIT(31) +-#define TWRR_RW_CMD_DONE BIT(30) +-#define TWRR_CHAN_IDX_MASK GENMASK(23, 19) +-#define TWRR_QUEUE_IDX_MASK GENMASK(18, 16) +-#define TWRR_VALUE_MASK GENMASK(15, 0) +- +-#define REG_PSE_BUF_USAGE_CFG 0x1028 +-#define PSE_BUF_ESTIMATE_EN_MASK BIT(29) +- +-#define REG_CHAN_QOS_MODE(_n) (0x1040 + ((_n) << 2)) +-#define CHAN_QOS_MODE_MASK(_n) GENMASK(2 + ((_n) << 2), (_n) << 2) +- +-#define REG_GLB_TRTCM_CFG 0x1080 +-#define GLB_TRTCM_EN_MASK BIT(31) +-#define GLB_TRTCM_MODE_MASK BIT(30) +-#define GLB_SLOW_TICK_RATIO_MASK GENMASK(29, 16) +-#define GLB_FAST_TICK_MASK GENMASK(15, 0) +- +-#define REG_TXQ_CNGST_CFG 0x10a0 +-#define TXQ_CNGST_DROP_EN BIT(31) +-#define TXQ_CNGST_DEI_DROP_EN BIT(30) +- +-#define REG_SLA_TRTCM_CFG 0x1150 +-#define SLA_TRTCM_EN_MASK BIT(31) +-#define SLA_TRTCM_MODE_MASK BIT(30) +-#define SLA_SLOW_TICK_RATIO_MASK GENMASK(29, 16) +-#define SLA_FAST_TICK_MASK GENMASK(15, 0) +- +-/* CTRL */ +-#define QDMA_DESC_DONE_MASK BIT(31) +-#define QDMA_DESC_DROP_MASK BIT(30) /* tx: drop - rx: overflow */ +-#define QDMA_DESC_MORE_MASK BIT(29) /* more SG elements */ +-#define QDMA_DESC_DEI_MASK BIT(25) +-#define QDMA_DESC_NO_DROP_MASK BIT(24) +-#define QDMA_DESC_LEN_MASK GENMASK(15, 0) +-/* DATA */ +-#define QDMA_DESC_NEXT_ID_MASK GENMASK(15, 0) +-/* TX MSG0 */ +-#define QDMA_ETH_TXMSG_MIC_IDX_MASK BIT(30) +-#define QDMA_ETH_TXMSG_SP_TAG_MASK GENMASK(29, 14) +-#define QDMA_ETH_TXMSG_ICO_MASK BIT(13) +-#define QDMA_ETH_TXMSG_UCO_MASK BIT(12) +-#define QDMA_ETH_TXMSG_TCO_MASK BIT(11) +-#define QDMA_ETH_TXMSG_TSO_MASK BIT(10) +-#define QDMA_ETH_TXMSG_FAST_MASK BIT(9) +-#define QDMA_ETH_TXMSG_OAM_MASK BIT(8) +-#define QDMA_ETH_TXMSG_CHAN_MASK GENMASK(7, 3) +-#define QDMA_ETH_TXMSG_QUEUE_MASK GENMASK(2, 0) +-/* TX MSG1 */ +-#define QDMA_ETH_TXMSG_NO_DROP BIT(31) +-#define QDMA_ETH_TXMSG_METER_MASK GENMASK(30, 24) /* 0x7f no meters */ +-#define QDMA_ETH_TXMSG_FPORT_MASK GENMASK(23, 20) +-#define QDMA_ETH_TXMSG_NBOQ_MASK GENMASK(19, 15) +-#define QDMA_ETH_TXMSG_HWF_MASK BIT(14) +-#define QDMA_ETH_TXMSG_HOP_MASK BIT(13) +-#define QDMA_ETH_TXMSG_PTP_MASK BIT(12) +-#define QDMA_ETH_TXMSG_ACNT_G1_MASK GENMASK(10, 6) /* 0x1f do not count */ +-#define QDMA_ETH_TXMSG_ACNT_G0_MASK GENMASK(5, 0) /* 0x3f do not count */ +- +-/* RX MSG1 */ +-#define QDMA_ETH_RXMSG_DEI_MASK BIT(31) +-#define QDMA_ETH_RXMSG_IP6_MASK BIT(30) +-#define QDMA_ETH_RXMSG_IP4_MASK BIT(29) +-#define QDMA_ETH_RXMSG_IP4F_MASK BIT(28) +-#define QDMA_ETH_RXMSG_L4_VALID_MASK BIT(27) +-#define QDMA_ETH_RXMSG_L4F_MASK BIT(26) +-#define QDMA_ETH_RXMSG_SPORT_MASK GENMASK(25, 21) +-#define QDMA_ETH_RXMSG_CRSN_MASK GENMASK(20, 16) +-#define QDMA_ETH_RXMSG_PPE_ENTRY_MASK GENMASK(15, 0) +- +-struct airoha_qdma_desc { +- __le32 rsv; +- __le32 ctrl; +- __le32 addr; +- __le32 data; +- __le32 msg0; +- __le32 msg1; +- __le32 msg2; +- __le32 msg3; +-}; +- +-/* CTRL0 */ +-#define QDMA_FWD_DESC_CTX_MASK BIT(31) +-#define QDMA_FWD_DESC_RING_MASK GENMASK(30, 28) +-#define QDMA_FWD_DESC_IDX_MASK GENMASK(27, 16) +-#define QDMA_FWD_DESC_LEN_MASK GENMASK(15, 0) +-/* CTRL1 */ +-#define QDMA_FWD_DESC_FIRST_IDX_MASK GENMASK(15, 0) +-/* CTRL2 */ +-#define QDMA_FWD_DESC_MORE_PKT_NUM_MASK GENMASK(2, 0) +- +-struct airoha_qdma_fwd_desc { +- __le32 addr; +- __le32 ctrl0; +- __le32 ctrl1; +- __le32 ctrl2; +- __le32 msg0; +- __le32 msg1; +- __le32 rsv0; +- __le32 rsv1; +-}; +- +-enum { +- QDMA_INT_REG_IDX0, +- QDMA_INT_REG_IDX1, +- QDMA_INT_REG_IDX2, +- QDMA_INT_REG_IDX3, +- QDMA_INT_REG_IDX4, +- QDMA_INT_REG_MAX +-}; +- +-enum { +- XSI_PCIE0_PORT, +- XSI_PCIE1_PORT, +- XSI_USB_PORT, +- XSI_AE_PORT, +- XSI_ETH_PORT, +-}; +- +-enum { +- XSI_PCIE0_VIP_PORT_MASK = BIT(22), +- XSI_PCIE1_VIP_PORT_MASK = BIT(23), +- XSI_USB_VIP_PORT_MASK = BIT(25), +- XSI_ETH_VIP_PORT_MASK = BIT(24), +-}; +- +-enum { +- DEV_STATE_INITIALIZED, +-}; +- +-enum { +- CDM_CRSN_QSEL_Q1 = 1, +- CDM_CRSN_QSEL_Q5 = 5, +- CDM_CRSN_QSEL_Q6 = 6, +- CDM_CRSN_QSEL_Q15 = 15, +-}; +- +-enum { +- CRSN_08 = 0x8, +- CRSN_21 = 0x15, /* KA */ +- CRSN_22 = 0x16, /* hit bind and force route to CPU */ +- CRSN_24 = 0x18, +- CRSN_25 = 0x19, +-}; +- +-enum { +- FE_PSE_PORT_CDM1, +- FE_PSE_PORT_GDM1, +- FE_PSE_PORT_GDM2, +- FE_PSE_PORT_GDM3, +- FE_PSE_PORT_PPE1, +- FE_PSE_PORT_CDM2, +- FE_PSE_PORT_CDM3, +- FE_PSE_PORT_CDM4, +- FE_PSE_PORT_PPE2, +- FE_PSE_PORT_GDM4, +- FE_PSE_PORT_CDM5, +- FE_PSE_PORT_DROP = 0xf, +-}; +- +-enum tx_sched_mode { +- TC_SCH_WRR8, +- TC_SCH_SP, +- TC_SCH_WRR7, +- TC_SCH_WRR6, +- TC_SCH_WRR5, +- TC_SCH_WRR4, +- TC_SCH_WRR3, +- TC_SCH_WRR2, +-}; +- +-enum trtcm_param_type { +- TRTCM_MISC_MODE, /* meter_en, pps_mode, tick_sel */ +- TRTCM_TOKEN_RATE_MODE, +- TRTCM_BUCKETSIZE_SHIFT_MODE, +- TRTCM_BUCKET_COUNTER_MODE, +-}; +- +-enum trtcm_mode_type { +- TRTCM_COMMIT_MODE, +- TRTCM_PEAK_MODE, +-}; +- +-enum trtcm_param { +- TRTCM_TICK_SEL = BIT(0), +- TRTCM_PKT_MODE = BIT(1), +- TRTCM_METER_MODE = BIT(2), +-}; +- +-#define MIN_TOKEN_SIZE 4096 +-#define MAX_TOKEN_SIZE_OFFSET 17 +-#define TRTCM_TOKEN_RATE_MASK GENMASK(23, 6) +-#define TRTCM_TOKEN_RATE_FRACTION_MASK GENMASK(5, 0) +- +-struct airoha_queue_entry { +- union { +- void *buf; +- struct sk_buff *skb; +- }; +- dma_addr_t dma_addr; +- u16 dma_len; +-}; +- +-struct airoha_queue { +- struct airoha_qdma *qdma; +- +- /* protect concurrent queue accesses */ +- spinlock_t lock; +- struct airoha_queue_entry *entry; +- struct airoha_qdma_desc *desc; +- u16 head; +- u16 tail; +- +- int queued; +- int ndesc; +- int free_thr; +- int buf_size; +- +- struct napi_struct napi; +- struct page_pool *page_pool; +-}; +- +-struct airoha_tx_irq_queue { +- struct airoha_qdma *qdma; +- +- struct napi_struct napi; +- +- int size; +- u32 *q; +-}; +- +-struct airoha_hw_stats { +- /* protect concurrent hw_stats accesses */ +- spinlock_t lock; +- struct u64_stats_sync syncp; +- +- /* get_stats64 */ +- u64 rx_ok_pkts; +- u64 tx_ok_pkts; +- u64 rx_ok_bytes; +- u64 tx_ok_bytes; +- u64 rx_multicast; +- u64 rx_errors; +- u64 rx_drops; +- u64 tx_drops; +- u64 rx_crc_error; +- u64 rx_over_errors; +- /* ethtool stats */ +- u64 tx_broadcast; +- u64 tx_multicast; +- u64 tx_len[7]; +- u64 rx_broadcast; +- u64 rx_fragment; +- u64 rx_jabber; +- u64 rx_len[7]; +-}; +- +-struct airoha_qdma { +- struct airoha_eth *eth; +- void __iomem *regs; +- +- /* protect concurrent irqmask accesses */ +- spinlock_t irq_lock; +- u32 irqmask[QDMA_INT_REG_MAX]; +- int irq; +- +- struct airoha_tx_irq_queue q_tx_irq[AIROHA_NUM_TX_IRQ]; +- +- struct airoha_queue q_tx[AIROHA_NUM_TX_RING]; +- struct airoha_queue q_rx[AIROHA_NUM_RX_RING]; +- +- /* descriptor and packet buffers for qdma hw forward */ +- struct { +- void *desc; +- void *q; +- } hfwd; +-}; +- +-struct airoha_gdm_port { +- struct airoha_qdma *qdma; +- struct net_device *dev; +- int id; +- +- struct airoha_hw_stats stats; +- +- DECLARE_BITMAP(qos_sq_bmap, AIROHA_NUM_QOS_CHANNELS); +- +- /* qos stats counters */ +- u64 cpu_tx_packets; +- u64 fwd_tx_packets; +-}; +- +-struct airoha_eth { +- struct device *dev; +- +- unsigned long state; +- void __iomem *fe_regs; +- +- struct reset_control_bulk_data rsts[AIROHA_MAX_NUM_RSTS]; +- struct reset_control_bulk_data xsi_rsts[AIROHA_MAX_NUM_XSI_RSTS]; +- +- struct net_device *napi_dev; +- +- struct airoha_qdma qdma[AIROHA_MAX_NUM_QDMA]; +- struct airoha_gdm_port *ports[AIROHA_MAX_NUM_GDM_PORTS]; +-}; +- +-static u32 airoha_rr(void __iomem *base, u32 offset) +-{ +- return readl(base + offset); +-} +- +-static void airoha_wr(void __iomem *base, u32 offset, u32 val) +-{ +- writel(val, base + offset); +-} +- +-static u32 airoha_rmw(void __iomem *base, u32 offset, u32 mask, u32 val) +-{ +- val |= (airoha_rr(base, offset) & ~mask); +- airoha_wr(base, offset, val); +- +- return val; +-} +- +-#define airoha_fe_rr(eth, offset) \ +- airoha_rr((eth)->fe_regs, (offset)) +-#define airoha_fe_wr(eth, offset, val) \ +- airoha_wr((eth)->fe_regs, (offset), (val)) +-#define airoha_fe_rmw(eth, offset, mask, val) \ +- airoha_rmw((eth)->fe_regs, (offset), (mask), (val)) +-#define airoha_fe_set(eth, offset, val) \ +- airoha_rmw((eth)->fe_regs, (offset), 0, (val)) +-#define airoha_fe_clear(eth, offset, val) \ +- airoha_rmw((eth)->fe_regs, (offset), (val), 0) +- +-#define airoha_qdma_rr(qdma, offset) \ +- airoha_rr((qdma)->regs, (offset)) +-#define airoha_qdma_wr(qdma, offset, val) \ +- airoha_wr((qdma)->regs, (offset), (val)) +-#define airoha_qdma_rmw(qdma, offset, mask, val) \ +- airoha_rmw((qdma)->regs, (offset), (mask), (val)) +-#define airoha_qdma_set(qdma, offset, val) \ +- airoha_rmw((qdma)->regs, (offset), 0, (val)) +-#define airoha_qdma_clear(qdma, offset, val) \ +- airoha_rmw((qdma)->regs, (offset), (val), 0) +- +-static void airoha_qdma_set_irqmask(struct airoha_qdma *qdma, int index, +- u32 clear, u32 set) +-{ +- unsigned long flags; +- +- if (WARN_ON_ONCE(index >= ARRAY_SIZE(qdma->irqmask))) +- return; +- +- spin_lock_irqsave(&qdma->irq_lock, flags); +- +- qdma->irqmask[index] &= ~clear; +- qdma->irqmask[index] |= set; +- airoha_qdma_wr(qdma, REG_INT_ENABLE(index), qdma->irqmask[index]); +- /* Read irq_enable register in order to guarantee the update above +- * completes in the spinlock critical section. +- */ +- airoha_qdma_rr(qdma, REG_INT_ENABLE(index)); +- +- spin_unlock_irqrestore(&qdma->irq_lock, flags); +-} +- +-static void airoha_qdma_irq_enable(struct airoha_qdma *qdma, int index, +- u32 mask) +-{ +- airoha_qdma_set_irqmask(qdma, index, 0, mask); +-} +- +-static void airoha_qdma_irq_disable(struct airoha_qdma *qdma, int index, +- u32 mask) +-{ +- airoha_qdma_set_irqmask(qdma, index, mask, 0); +-} +- +-static bool airhoa_is_lan_gdm_port(struct airoha_gdm_port *port) +-{ +- /* GDM1 port on EN7581 SoC is connected to the lan dsa switch. +- * GDM{2,3,4} can be used as wan port connected to an external +- * phy module. +- */ +- return port->id == 1; +-} +- +-static void airoha_set_macaddr(struct airoha_gdm_port *port, const u8 *addr) +-{ +- struct airoha_eth *eth = port->qdma->eth; +- u32 val, reg; +- +- reg = airhoa_is_lan_gdm_port(port) ? REG_FE_LAN_MAC_H +- : REG_FE_WAN_MAC_H; +- val = (addr[0] << 16) | (addr[1] << 8) | addr[2]; +- airoha_fe_wr(eth, reg, val); +- +- val = (addr[3] << 16) | (addr[4] << 8) | addr[5]; +- airoha_fe_wr(eth, REG_FE_MAC_LMIN(reg), val); +- airoha_fe_wr(eth, REG_FE_MAC_LMAX(reg), val); +-} +- +-static void airoha_set_gdm_port_fwd_cfg(struct airoha_eth *eth, u32 addr, +- u32 val) +-{ +- airoha_fe_rmw(eth, addr, GDM_OCFQ_MASK, +- FIELD_PREP(GDM_OCFQ_MASK, val)); +- airoha_fe_rmw(eth, addr, GDM_MCFQ_MASK, +- FIELD_PREP(GDM_MCFQ_MASK, val)); +- airoha_fe_rmw(eth, addr, GDM_BCFQ_MASK, +- FIELD_PREP(GDM_BCFQ_MASK, val)); +- airoha_fe_rmw(eth, addr, GDM_UCFQ_MASK, +- FIELD_PREP(GDM_UCFQ_MASK, val)); +-} +- +-static int airoha_set_gdm_port(struct airoha_eth *eth, int port, bool enable) +-{ +- u32 val = enable ? FE_PSE_PORT_PPE1 : FE_PSE_PORT_DROP; +- u32 vip_port, cfg_addr; +- +- switch (port) { +- case XSI_PCIE0_PORT: +- vip_port = XSI_PCIE0_VIP_PORT_MASK; +- cfg_addr = REG_GDM_FWD_CFG(3); +- break; +- case XSI_PCIE1_PORT: +- vip_port = XSI_PCIE1_VIP_PORT_MASK; +- cfg_addr = REG_GDM_FWD_CFG(3); +- break; +- case XSI_USB_PORT: +- vip_port = XSI_USB_VIP_PORT_MASK; +- cfg_addr = REG_GDM_FWD_CFG(4); +- break; +- case XSI_ETH_PORT: +- vip_port = XSI_ETH_VIP_PORT_MASK; +- cfg_addr = REG_GDM_FWD_CFG(4); +- break; +- default: +- return -EINVAL; +- } +- +- if (enable) { +- airoha_fe_set(eth, REG_FE_VIP_PORT_EN, vip_port); +- airoha_fe_set(eth, REG_FE_IFC_PORT_EN, vip_port); +- } else { +- airoha_fe_clear(eth, REG_FE_VIP_PORT_EN, vip_port); +- airoha_fe_clear(eth, REG_FE_IFC_PORT_EN, vip_port); +- } +- +- airoha_set_gdm_port_fwd_cfg(eth, cfg_addr, val); +- +- return 0; +-} +- +-static int airoha_set_gdm_ports(struct airoha_eth *eth, bool enable) +-{ +- const int port_list[] = { +- XSI_PCIE0_PORT, +- XSI_PCIE1_PORT, +- XSI_USB_PORT, +- XSI_ETH_PORT +- }; +- int i, err; +- +- for (i = 0; i < ARRAY_SIZE(port_list); i++) { +- err = airoha_set_gdm_port(eth, port_list[i], enable); +- if (err) +- goto error; +- } +- +- return 0; +- +-error: +- for (i--; i >= 0; i--) +- airoha_set_gdm_port(eth, port_list[i], false); +- +- return err; +-} +- +-static void airoha_fe_maccr_init(struct airoha_eth *eth) +-{ +- int p; +- +- for (p = 1; p <= ARRAY_SIZE(eth->ports); p++) { +- airoha_fe_set(eth, REG_GDM_FWD_CFG(p), +- GDM_TCP_CKSUM | GDM_UDP_CKSUM | GDM_IP4_CKSUM | +- GDM_DROP_CRC_ERR); +- airoha_set_gdm_port_fwd_cfg(eth, REG_GDM_FWD_CFG(p), +- FE_PSE_PORT_CDM1); +- airoha_fe_rmw(eth, REG_GDM_LEN_CFG(p), +- GDM_SHORT_LEN_MASK | GDM_LONG_LEN_MASK, +- FIELD_PREP(GDM_SHORT_LEN_MASK, 60) | +- FIELD_PREP(GDM_LONG_LEN_MASK, 4004)); +- } +- +- airoha_fe_rmw(eth, REG_CDM1_VLAN_CTRL, CDM1_VLAN_MASK, +- FIELD_PREP(CDM1_VLAN_MASK, 0x8100)); +- +- airoha_fe_set(eth, REG_FE_CPORT_CFG, FE_CPORT_PAD); +-} +- +-static void airoha_fe_vip_setup(struct airoha_eth *eth) +-{ +- airoha_fe_wr(eth, REG_FE_VIP_PATN(3), ETH_P_PPP_DISC); +- airoha_fe_wr(eth, REG_FE_VIP_EN(3), PATN_FCPU_EN_MASK | PATN_EN_MASK); +- +- airoha_fe_wr(eth, REG_FE_VIP_PATN(4), PPP_LCP); +- airoha_fe_wr(eth, REG_FE_VIP_EN(4), +- PATN_FCPU_EN_MASK | FIELD_PREP(PATN_TYPE_MASK, 1) | +- PATN_EN_MASK); +- +- airoha_fe_wr(eth, REG_FE_VIP_PATN(6), PPP_IPCP); +- airoha_fe_wr(eth, REG_FE_VIP_EN(6), +- PATN_FCPU_EN_MASK | FIELD_PREP(PATN_TYPE_MASK, 1) | +- PATN_EN_MASK); +- +- airoha_fe_wr(eth, REG_FE_VIP_PATN(7), PPP_CHAP); +- airoha_fe_wr(eth, REG_FE_VIP_EN(7), +- PATN_FCPU_EN_MASK | FIELD_PREP(PATN_TYPE_MASK, 1) | +- PATN_EN_MASK); +- +- /* BOOTP (0x43) */ +- airoha_fe_wr(eth, REG_FE_VIP_PATN(8), 0x43); +- airoha_fe_wr(eth, REG_FE_VIP_EN(8), +- PATN_FCPU_EN_MASK | PATN_SP_EN_MASK | +- FIELD_PREP(PATN_TYPE_MASK, 4) | PATN_EN_MASK); +- +- /* BOOTP (0x44) */ +- airoha_fe_wr(eth, REG_FE_VIP_PATN(9), 0x44); +- airoha_fe_wr(eth, REG_FE_VIP_EN(9), +- PATN_FCPU_EN_MASK | PATN_SP_EN_MASK | +- FIELD_PREP(PATN_TYPE_MASK, 4) | PATN_EN_MASK); +- +- /* ISAKMP */ +- airoha_fe_wr(eth, REG_FE_VIP_PATN(10), 0x1f401f4); +- airoha_fe_wr(eth, REG_FE_VIP_EN(10), +- PATN_FCPU_EN_MASK | PATN_DP_EN_MASK | PATN_SP_EN_MASK | +- FIELD_PREP(PATN_TYPE_MASK, 4) | PATN_EN_MASK); +- +- airoha_fe_wr(eth, REG_FE_VIP_PATN(11), PPP_IPV6CP); +- airoha_fe_wr(eth, REG_FE_VIP_EN(11), +- PATN_FCPU_EN_MASK | FIELD_PREP(PATN_TYPE_MASK, 1) | +- PATN_EN_MASK); +- +- /* DHCPv6 */ +- airoha_fe_wr(eth, REG_FE_VIP_PATN(12), 0x2220223); +- airoha_fe_wr(eth, REG_FE_VIP_EN(12), +- PATN_FCPU_EN_MASK | PATN_DP_EN_MASK | PATN_SP_EN_MASK | +- FIELD_PREP(PATN_TYPE_MASK, 4) | PATN_EN_MASK); +- +- airoha_fe_wr(eth, REG_FE_VIP_PATN(19), PPP_PAP); +- airoha_fe_wr(eth, REG_FE_VIP_EN(19), +- PATN_FCPU_EN_MASK | FIELD_PREP(PATN_TYPE_MASK, 1) | +- PATN_EN_MASK); +- +- /* ETH->ETH_P_1905 (0x893a) */ +- airoha_fe_wr(eth, REG_FE_VIP_PATN(20), 0x893a); +- airoha_fe_wr(eth, REG_FE_VIP_EN(20), +- PATN_FCPU_EN_MASK | PATN_EN_MASK); +- +- airoha_fe_wr(eth, REG_FE_VIP_PATN(21), ETH_P_LLDP); +- airoha_fe_wr(eth, REG_FE_VIP_EN(21), +- PATN_FCPU_EN_MASK | PATN_EN_MASK); +-} +- +-static u32 airoha_fe_get_pse_queue_rsv_pages(struct airoha_eth *eth, +- u32 port, u32 queue) +-{ +- u32 val; +- +- airoha_fe_rmw(eth, REG_FE_PSE_QUEUE_CFG_WR, +- PSE_CFG_PORT_ID_MASK | PSE_CFG_QUEUE_ID_MASK, +- FIELD_PREP(PSE_CFG_PORT_ID_MASK, port) | +- FIELD_PREP(PSE_CFG_QUEUE_ID_MASK, queue)); +- val = airoha_fe_rr(eth, REG_FE_PSE_QUEUE_CFG_VAL); +- +- return FIELD_GET(PSE_CFG_OQ_RSV_MASK, val); +-} +- +-static void airoha_fe_set_pse_queue_rsv_pages(struct airoha_eth *eth, +- u32 port, u32 queue, u32 val) +-{ +- airoha_fe_rmw(eth, REG_FE_PSE_QUEUE_CFG_VAL, PSE_CFG_OQ_RSV_MASK, +- FIELD_PREP(PSE_CFG_OQ_RSV_MASK, val)); +- airoha_fe_rmw(eth, REG_FE_PSE_QUEUE_CFG_WR, +- PSE_CFG_PORT_ID_MASK | PSE_CFG_QUEUE_ID_MASK | +- PSE_CFG_WR_EN_MASK | PSE_CFG_OQRSV_SEL_MASK, +- FIELD_PREP(PSE_CFG_PORT_ID_MASK, port) | +- FIELD_PREP(PSE_CFG_QUEUE_ID_MASK, queue) | +- PSE_CFG_WR_EN_MASK | PSE_CFG_OQRSV_SEL_MASK); +-} +- +-static u32 airoha_fe_get_pse_all_rsv(struct airoha_eth *eth) +-{ +- u32 val = airoha_fe_rr(eth, REG_FE_PSE_BUF_SET); +- +- return FIELD_GET(PSE_ALLRSV_MASK, val); +-} +- +-static int airoha_fe_set_pse_oq_rsv(struct airoha_eth *eth, +- u32 port, u32 queue, u32 val) +-{ +- u32 orig_val = airoha_fe_get_pse_queue_rsv_pages(eth, port, queue); +- u32 tmp, all_rsv, fq_limit; +- +- airoha_fe_set_pse_queue_rsv_pages(eth, port, queue, val); +- +- /* modify all rsv */ +- all_rsv = airoha_fe_get_pse_all_rsv(eth); +- all_rsv += (val - orig_val); +- airoha_fe_rmw(eth, REG_FE_PSE_BUF_SET, PSE_ALLRSV_MASK, +- FIELD_PREP(PSE_ALLRSV_MASK, all_rsv)); +- +- /* modify hthd */ +- tmp = airoha_fe_rr(eth, PSE_FQ_CFG); +- fq_limit = FIELD_GET(PSE_FQ_LIMIT_MASK, tmp); +- tmp = fq_limit - all_rsv - 0x20; +- airoha_fe_rmw(eth, REG_PSE_SHARE_USED_THD, +- PSE_SHARE_USED_HTHD_MASK, +- FIELD_PREP(PSE_SHARE_USED_HTHD_MASK, tmp)); +- +- tmp = fq_limit - all_rsv - 0x100; +- airoha_fe_rmw(eth, REG_PSE_SHARE_USED_THD, +- PSE_SHARE_USED_MTHD_MASK, +- FIELD_PREP(PSE_SHARE_USED_MTHD_MASK, tmp)); +- tmp = (3 * tmp) >> 2; +- airoha_fe_rmw(eth, REG_FE_PSE_BUF_SET, +- PSE_SHARE_USED_LTHD_MASK, +- FIELD_PREP(PSE_SHARE_USED_LTHD_MASK, tmp)); +- +- return 0; +-} +- +-static void airoha_fe_pse_ports_init(struct airoha_eth *eth) +-{ +- const u32 pse_port_num_queues[] = { +- [FE_PSE_PORT_CDM1] = 6, +- [FE_PSE_PORT_GDM1] = 6, +- [FE_PSE_PORT_GDM2] = 32, +- [FE_PSE_PORT_GDM3] = 6, +- [FE_PSE_PORT_PPE1] = 4, +- [FE_PSE_PORT_CDM2] = 6, +- [FE_PSE_PORT_CDM3] = 8, +- [FE_PSE_PORT_CDM4] = 10, +- [FE_PSE_PORT_PPE2] = 4, +- [FE_PSE_PORT_GDM4] = 2, +- [FE_PSE_PORT_CDM5] = 2, +- }; +- u32 all_rsv; +- int q; +- +- all_rsv = airoha_fe_get_pse_all_rsv(eth); +- /* hw misses PPE2 oq rsv */ +- all_rsv += PSE_RSV_PAGES * pse_port_num_queues[FE_PSE_PORT_PPE2]; +- airoha_fe_set(eth, REG_FE_PSE_BUF_SET, all_rsv); +- +- /* CMD1 */ +- for (q = 0; q < pse_port_num_queues[FE_PSE_PORT_CDM1]; q++) +- airoha_fe_set_pse_oq_rsv(eth, FE_PSE_PORT_CDM1, q, +- PSE_QUEUE_RSV_PAGES); +- /* GMD1 */ +- for (q = 0; q < pse_port_num_queues[FE_PSE_PORT_GDM1]; q++) +- airoha_fe_set_pse_oq_rsv(eth, FE_PSE_PORT_GDM1, q, +- PSE_QUEUE_RSV_PAGES); +- /* GMD2 */ +- for (q = 6; q < pse_port_num_queues[FE_PSE_PORT_GDM2]; q++) +- airoha_fe_set_pse_oq_rsv(eth, FE_PSE_PORT_GDM2, q, 0); +- /* GMD3 */ +- for (q = 0; q < pse_port_num_queues[FE_PSE_PORT_GDM3]; q++) +- airoha_fe_set_pse_oq_rsv(eth, FE_PSE_PORT_GDM3, q, +- PSE_QUEUE_RSV_PAGES); +- /* PPE1 */ +- for (q = 0; q < pse_port_num_queues[FE_PSE_PORT_PPE1]; q++) { +- if (q < pse_port_num_queues[FE_PSE_PORT_PPE1]) +- airoha_fe_set_pse_oq_rsv(eth, FE_PSE_PORT_PPE1, q, +- PSE_QUEUE_RSV_PAGES); +- else +- airoha_fe_set_pse_oq_rsv(eth, FE_PSE_PORT_PPE1, q, 0); +- } +- /* CDM2 */ +- for (q = 0; q < pse_port_num_queues[FE_PSE_PORT_CDM2]; q++) +- airoha_fe_set_pse_oq_rsv(eth, FE_PSE_PORT_CDM2, q, +- PSE_QUEUE_RSV_PAGES); +- /* CDM3 */ +- for (q = 0; q < pse_port_num_queues[FE_PSE_PORT_CDM3] - 1; q++) +- airoha_fe_set_pse_oq_rsv(eth, FE_PSE_PORT_CDM3, q, 0); +- /* CDM4 */ +- for (q = 4; q < pse_port_num_queues[FE_PSE_PORT_CDM4]; q++) +- airoha_fe_set_pse_oq_rsv(eth, FE_PSE_PORT_CDM4, q, +- PSE_QUEUE_RSV_PAGES); +- /* PPE2 */ +- for (q = 0; q < pse_port_num_queues[FE_PSE_PORT_PPE2]; q++) { +- if (q < pse_port_num_queues[FE_PSE_PORT_PPE2] / 2) +- airoha_fe_set_pse_oq_rsv(eth, FE_PSE_PORT_PPE2, q, +- PSE_QUEUE_RSV_PAGES); +- else +- airoha_fe_set_pse_oq_rsv(eth, FE_PSE_PORT_PPE2, q, 0); +- } +- /* GMD4 */ +- for (q = 0; q < pse_port_num_queues[FE_PSE_PORT_GDM4]; q++) +- airoha_fe_set_pse_oq_rsv(eth, FE_PSE_PORT_GDM4, q, +- PSE_QUEUE_RSV_PAGES); +- /* CDM5 */ +- for (q = 0; q < pse_port_num_queues[FE_PSE_PORT_CDM5]; q++) +- airoha_fe_set_pse_oq_rsv(eth, FE_PSE_PORT_CDM5, q, +- PSE_QUEUE_RSV_PAGES); +-} +- +-static int airoha_fe_mc_vlan_clear(struct airoha_eth *eth) +-{ +- int i; +- +- for (i = 0; i < AIROHA_FE_MC_MAX_VLAN_TABLE; i++) { +- int err, j; +- u32 val; +- +- airoha_fe_wr(eth, REG_MC_VLAN_DATA, 0x0); +- +- val = FIELD_PREP(MC_VLAN_CFG_TABLE_ID_MASK, i) | +- MC_VLAN_CFG_TABLE_SEL_MASK | MC_VLAN_CFG_RW_MASK; +- airoha_fe_wr(eth, REG_MC_VLAN_CFG, val); +- err = read_poll_timeout(airoha_fe_rr, val, +- val & MC_VLAN_CFG_CMD_DONE_MASK, +- USEC_PER_MSEC, 5 * USEC_PER_MSEC, +- false, eth, REG_MC_VLAN_CFG); +- if (err) +- return err; +- +- for (j = 0; j < AIROHA_FE_MC_MAX_VLAN_PORT; j++) { +- airoha_fe_wr(eth, REG_MC_VLAN_DATA, 0x0); +- +- val = FIELD_PREP(MC_VLAN_CFG_TABLE_ID_MASK, i) | +- FIELD_PREP(MC_VLAN_CFG_PORT_ID_MASK, j) | +- MC_VLAN_CFG_RW_MASK; +- airoha_fe_wr(eth, REG_MC_VLAN_CFG, val); +- err = read_poll_timeout(airoha_fe_rr, val, +- val & MC_VLAN_CFG_CMD_DONE_MASK, +- USEC_PER_MSEC, +- 5 * USEC_PER_MSEC, false, eth, +- REG_MC_VLAN_CFG); +- if (err) +- return err; +- } +- } +- +- return 0; +-} +- +-static void airoha_fe_crsn_qsel_init(struct airoha_eth *eth) +-{ +- /* CDM1_CRSN_QSEL */ +- airoha_fe_rmw(eth, REG_CDM1_CRSN_QSEL(CRSN_22 >> 2), +- CDM1_CRSN_QSEL_REASON_MASK(CRSN_22), +- FIELD_PREP(CDM1_CRSN_QSEL_REASON_MASK(CRSN_22), +- CDM_CRSN_QSEL_Q1)); +- airoha_fe_rmw(eth, REG_CDM1_CRSN_QSEL(CRSN_08 >> 2), +- CDM1_CRSN_QSEL_REASON_MASK(CRSN_08), +- FIELD_PREP(CDM1_CRSN_QSEL_REASON_MASK(CRSN_08), +- CDM_CRSN_QSEL_Q1)); +- airoha_fe_rmw(eth, REG_CDM1_CRSN_QSEL(CRSN_21 >> 2), +- CDM1_CRSN_QSEL_REASON_MASK(CRSN_21), +- FIELD_PREP(CDM1_CRSN_QSEL_REASON_MASK(CRSN_21), +- CDM_CRSN_QSEL_Q1)); +- airoha_fe_rmw(eth, REG_CDM1_CRSN_QSEL(CRSN_24 >> 2), +- CDM1_CRSN_QSEL_REASON_MASK(CRSN_24), +- FIELD_PREP(CDM1_CRSN_QSEL_REASON_MASK(CRSN_24), +- CDM_CRSN_QSEL_Q6)); +- airoha_fe_rmw(eth, REG_CDM1_CRSN_QSEL(CRSN_25 >> 2), +- CDM1_CRSN_QSEL_REASON_MASK(CRSN_25), +- FIELD_PREP(CDM1_CRSN_QSEL_REASON_MASK(CRSN_25), +- CDM_CRSN_QSEL_Q1)); +- /* CDM2_CRSN_QSEL */ +- airoha_fe_rmw(eth, REG_CDM2_CRSN_QSEL(CRSN_08 >> 2), +- CDM2_CRSN_QSEL_REASON_MASK(CRSN_08), +- FIELD_PREP(CDM2_CRSN_QSEL_REASON_MASK(CRSN_08), +- CDM_CRSN_QSEL_Q1)); +- airoha_fe_rmw(eth, REG_CDM2_CRSN_QSEL(CRSN_21 >> 2), +- CDM2_CRSN_QSEL_REASON_MASK(CRSN_21), +- FIELD_PREP(CDM2_CRSN_QSEL_REASON_MASK(CRSN_21), +- CDM_CRSN_QSEL_Q1)); +- airoha_fe_rmw(eth, REG_CDM2_CRSN_QSEL(CRSN_22 >> 2), +- CDM2_CRSN_QSEL_REASON_MASK(CRSN_22), +- FIELD_PREP(CDM2_CRSN_QSEL_REASON_MASK(CRSN_22), +- CDM_CRSN_QSEL_Q1)); +- airoha_fe_rmw(eth, REG_CDM2_CRSN_QSEL(CRSN_24 >> 2), +- CDM2_CRSN_QSEL_REASON_MASK(CRSN_24), +- FIELD_PREP(CDM2_CRSN_QSEL_REASON_MASK(CRSN_24), +- CDM_CRSN_QSEL_Q6)); +- airoha_fe_rmw(eth, REG_CDM2_CRSN_QSEL(CRSN_25 >> 2), +- CDM2_CRSN_QSEL_REASON_MASK(CRSN_25), +- FIELD_PREP(CDM2_CRSN_QSEL_REASON_MASK(CRSN_25), +- CDM_CRSN_QSEL_Q1)); +-} +- +-static int airoha_fe_init(struct airoha_eth *eth) +-{ +- airoha_fe_maccr_init(eth); +- +- /* PSE IQ reserve */ +- airoha_fe_rmw(eth, REG_PSE_IQ_REV1, PSE_IQ_RES1_P2_MASK, +- FIELD_PREP(PSE_IQ_RES1_P2_MASK, 0x10)); +- airoha_fe_rmw(eth, REG_PSE_IQ_REV2, +- PSE_IQ_RES2_P5_MASK | PSE_IQ_RES2_P4_MASK, +- FIELD_PREP(PSE_IQ_RES2_P5_MASK, 0x40) | +- FIELD_PREP(PSE_IQ_RES2_P4_MASK, 0x34)); +- +- /* enable FE copy engine for MC/KA/DPI */ +- airoha_fe_wr(eth, REG_FE_PCE_CFG, +- PCE_DPI_EN_MASK | PCE_KA_EN_MASK | PCE_MC_EN_MASK); +- /* set vip queue selection to ring 1 */ +- airoha_fe_rmw(eth, REG_CDM1_FWD_CFG, CDM1_VIP_QSEL_MASK, +- FIELD_PREP(CDM1_VIP_QSEL_MASK, 0x4)); +- airoha_fe_rmw(eth, REG_CDM2_FWD_CFG, CDM2_VIP_QSEL_MASK, +- FIELD_PREP(CDM2_VIP_QSEL_MASK, 0x4)); +- /* set GDM4 source interface offset to 8 */ +- airoha_fe_rmw(eth, REG_GDM4_SRC_PORT_SET, +- GDM4_SPORT_OFF2_MASK | +- GDM4_SPORT_OFF1_MASK | +- GDM4_SPORT_OFF0_MASK, +- FIELD_PREP(GDM4_SPORT_OFF2_MASK, 8) | +- FIELD_PREP(GDM4_SPORT_OFF1_MASK, 8) | +- FIELD_PREP(GDM4_SPORT_OFF0_MASK, 8)); +- +- /* set PSE Page as 128B */ +- airoha_fe_rmw(eth, REG_FE_DMA_GLO_CFG, +- FE_DMA_GLO_L2_SPACE_MASK | FE_DMA_GLO_PG_SZ_MASK, +- FIELD_PREP(FE_DMA_GLO_L2_SPACE_MASK, 2) | +- FE_DMA_GLO_PG_SZ_MASK); +- airoha_fe_wr(eth, REG_FE_RST_GLO_CFG, +- FE_RST_CORE_MASK | FE_RST_GDM3_MBI_ARB_MASK | +- FE_RST_GDM4_MBI_ARB_MASK); +- usleep_range(1000, 2000); +- +- /* connect RxRing1 and RxRing15 to PSE Port0 OQ-1 +- * connect other rings to PSE Port0 OQ-0 +- */ +- airoha_fe_wr(eth, REG_FE_CDM1_OQ_MAP0, BIT(4)); +- airoha_fe_wr(eth, REG_FE_CDM1_OQ_MAP1, BIT(28)); +- airoha_fe_wr(eth, REG_FE_CDM1_OQ_MAP2, BIT(4)); +- airoha_fe_wr(eth, REG_FE_CDM1_OQ_MAP3, BIT(28)); +- +- airoha_fe_vip_setup(eth); +- airoha_fe_pse_ports_init(eth); +- +- airoha_fe_set(eth, REG_GDM_MISC_CFG, +- GDM2_RDM_ACK_WAIT_PREF_MASK | +- GDM2_CHN_VLD_MODE_MASK); +- airoha_fe_rmw(eth, REG_CDM2_FWD_CFG, CDM2_OAM_QSEL_MASK, +- FIELD_PREP(CDM2_OAM_QSEL_MASK, 15)); +- +- /* init fragment and assemble Force Port */ +- /* NPU Core-3, NPU Bridge Channel-3 */ +- airoha_fe_rmw(eth, REG_IP_FRAG_FP, +- IP_FRAGMENT_PORT_MASK | IP_FRAGMENT_NBQ_MASK, +- FIELD_PREP(IP_FRAGMENT_PORT_MASK, 6) | +- FIELD_PREP(IP_FRAGMENT_NBQ_MASK, 3)); +- /* QDMA LAN, RX Ring-22 */ +- airoha_fe_rmw(eth, REG_IP_FRAG_FP, +- IP_ASSEMBLE_PORT_MASK | IP_ASSEMBLE_NBQ_MASK, +- FIELD_PREP(IP_ASSEMBLE_PORT_MASK, 0) | +- FIELD_PREP(IP_ASSEMBLE_NBQ_MASK, 22)); +- +- airoha_fe_set(eth, REG_GDM3_FWD_CFG, GDM3_PAD_EN_MASK); +- airoha_fe_set(eth, REG_GDM4_FWD_CFG, GDM4_PAD_EN_MASK); +- +- airoha_fe_crsn_qsel_init(eth); +- +- airoha_fe_clear(eth, REG_FE_CPORT_CFG, FE_CPORT_QUEUE_XFC_MASK); +- airoha_fe_set(eth, REG_FE_CPORT_CFG, FE_CPORT_PORT_XFC_MASK); +- +- /* default aging mode for mbi unlock issue */ +- airoha_fe_rmw(eth, REG_GDM2_CHN_RLS, +- MBI_RX_AGE_SEL_MASK | MBI_TX_AGE_SEL_MASK, +- FIELD_PREP(MBI_RX_AGE_SEL_MASK, 3) | +- FIELD_PREP(MBI_TX_AGE_SEL_MASK, 3)); +- +- /* disable IFC by default */ +- airoha_fe_clear(eth, REG_FE_CSR_IFC_CFG, FE_IFC_EN_MASK); +- +- /* enable 1:N vlan action, init vlan table */ +- airoha_fe_set(eth, REG_MC_VLAN_EN, MC_VLAN_EN_MASK); +- +- return airoha_fe_mc_vlan_clear(eth); +-} +- +-static int airoha_qdma_fill_rx_queue(struct airoha_queue *q) +-{ +- enum dma_data_direction dir = page_pool_get_dma_dir(q->page_pool); +- struct airoha_qdma *qdma = q->qdma; +- struct airoha_eth *eth = qdma->eth; +- int qid = q - &qdma->q_rx[0]; +- int nframes = 0; +- +- while (q->queued < q->ndesc - 1) { +- struct airoha_queue_entry *e = &q->entry[q->head]; +- struct airoha_qdma_desc *desc = &q->desc[q->head]; +- struct page *page; +- int offset; +- u32 val; +- +- page = page_pool_dev_alloc_frag(q->page_pool, &offset, +- q->buf_size); +- if (!page) +- break; +- +- q->head = (q->head + 1) % q->ndesc; +- q->queued++; +- nframes++; +- +- e->buf = page_address(page) + offset; +- e->dma_addr = page_pool_get_dma_addr(page) + offset; +- e->dma_len = SKB_WITH_OVERHEAD(q->buf_size); +- +- dma_sync_single_for_device(eth->dev, e->dma_addr, e->dma_len, +- dir); +- +- val = FIELD_PREP(QDMA_DESC_LEN_MASK, e->dma_len); +- WRITE_ONCE(desc->ctrl, cpu_to_le32(val)); +- WRITE_ONCE(desc->addr, cpu_to_le32(e->dma_addr)); +- val = FIELD_PREP(QDMA_DESC_NEXT_ID_MASK, q->head); +- WRITE_ONCE(desc->data, cpu_to_le32(val)); +- WRITE_ONCE(desc->msg0, 0); +- WRITE_ONCE(desc->msg1, 0); +- WRITE_ONCE(desc->msg2, 0); +- WRITE_ONCE(desc->msg3, 0); +- +- airoha_qdma_rmw(qdma, REG_RX_CPU_IDX(qid), +- RX_RING_CPU_IDX_MASK, +- FIELD_PREP(RX_RING_CPU_IDX_MASK, q->head)); +- } +- +- return nframes; +-} +- +-static int airoha_qdma_get_gdm_port(struct airoha_eth *eth, +- struct airoha_qdma_desc *desc) +-{ +- u32 port, sport, msg1 = le32_to_cpu(desc->msg1); +- +- sport = FIELD_GET(QDMA_ETH_RXMSG_SPORT_MASK, msg1); +- switch (sport) { +- case 0x10 ... 0x13: +- port = 0; +- break; +- case 0x2 ... 0x4: +- port = sport - 1; +- break; +- default: +- return -EINVAL; +- } +- +- return port >= ARRAY_SIZE(eth->ports) ? -EINVAL : port; +-} +- +-static int airoha_qdma_rx_process(struct airoha_queue *q, int budget) +-{ +- enum dma_data_direction dir = page_pool_get_dma_dir(q->page_pool); +- struct airoha_qdma *qdma = q->qdma; +- struct airoha_eth *eth = qdma->eth; +- int qid = q - &qdma->q_rx[0]; +- int done = 0; +- +- while (done < budget) { +- struct airoha_queue_entry *e = &q->entry[q->tail]; +- struct airoha_qdma_desc *desc = &q->desc[q->tail]; +- dma_addr_t dma_addr = le32_to_cpu(desc->addr); +- u32 desc_ctrl = le32_to_cpu(desc->ctrl); +- struct sk_buff *skb; +- int len, p; +- +- if (!(desc_ctrl & QDMA_DESC_DONE_MASK)) +- break; +- +- if (!dma_addr) +- break; +- +- len = FIELD_GET(QDMA_DESC_LEN_MASK, desc_ctrl); +- if (!len) +- break; +- +- q->tail = (q->tail + 1) % q->ndesc; +- q->queued--; +- +- dma_sync_single_for_cpu(eth->dev, dma_addr, +- SKB_WITH_OVERHEAD(q->buf_size), dir); +- +- p = airoha_qdma_get_gdm_port(eth, desc); +- if (p < 0 || !eth->ports[p]) { +- page_pool_put_full_page(q->page_pool, +- virt_to_head_page(e->buf), +- true); +- continue; +- } +- +- skb = napi_build_skb(e->buf, q->buf_size); +- if (!skb) { +- page_pool_put_full_page(q->page_pool, +- virt_to_head_page(e->buf), +- true); +- break; +- } +- +- skb_reserve(skb, 2); +- __skb_put(skb, len); +- skb_mark_for_recycle(skb); +- skb->dev = eth->ports[p]->dev; +- skb->protocol = eth_type_trans(skb, skb->dev); +- skb->ip_summed = CHECKSUM_UNNECESSARY; +- skb_record_rx_queue(skb, qid); +- napi_gro_receive(&q->napi, skb); +- +- done++; +- } +- airoha_qdma_fill_rx_queue(q); +- +- return done; +-} +- +-static int airoha_qdma_rx_napi_poll(struct napi_struct *napi, int budget) +-{ +- struct airoha_queue *q = container_of(napi, struct airoha_queue, napi); +- int cur, done = 0; +- +- do { +- cur = airoha_qdma_rx_process(q, budget - done); +- done += cur; +- } while (cur && done < budget); +- +- if (done < budget && napi_complete(napi)) +- airoha_qdma_irq_enable(q->qdma, QDMA_INT_REG_IDX1, +- RX_DONE_INT_MASK); +- +- return done; +-} +- +-static int airoha_qdma_init_rx_queue(struct airoha_queue *q, +- struct airoha_qdma *qdma, int ndesc) +-{ +- const struct page_pool_params pp_params = { +- .order = 0, +- .pool_size = 256, +- .flags = PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV | +- PP_FLAG_PAGE_FRAG, +- .dma_dir = DMA_FROM_DEVICE, +- .max_len = PAGE_SIZE, +- .nid = NUMA_NO_NODE, +- .dev = qdma->eth->dev, +- .napi = &q->napi, +- }; +- struct airoha_eth *eth = qdma->eth; +- int qid = q - &qdma->q_rx[0], thr; +- dma_addr_t dma_addr; +- +- q->buf_size = PAGE_SIZE / 2; +- q->ndesc = ndesc; +- q->qdma = qdma; +- +- q->entry = devm_kzalloc(eth->dev, q->ndesc * sizeof(*q->entry), +- GFP_KERNEL); +- if (!q->entry) +- return -ENOMEM; +- +- q->page_pool = page_pool_create(&pp_params); +- if (IS_ERR(q->page_pool)) { +- int err = PTR_ERR(q->page_pool); +- +- q->page_pool = NULL; +- return err; +- } +- +- q->desc = dmam_alloc_coherent(eth->dev, q->ndesc * sizeof(*q->desc), +- &dma_addr, GFP_KERNEL); +- if (!q->desc) +- return -ENOMEM; +- +- netif_napi_add(eth->napi_dev, &q->napi, airoha_qdma_rx_napi_poll); +- +- airoha_qdma_wr(qdma, REG_RX_RING_BASE(qid), dma_addr); +- airoha_qdma_rmw(qdma, REG_RX_RING_SIZE(qid), +- RX_RING_SIZE_MASK, +- FIELD_PREP(RX_RING_SIZE_MASK, ndesc)); +- +- thr = clamp(ndesc >> 3, 1, 32); +- airoha_qdma_rmw(qdma, REG_RX_RING_SIZE(qid), RX_RING_THR_MASK, +- FIELD_PREP(RX_RING_THR_MASK, thr)); +- airoha_qdma_rmw(qdma, REG_RX_DMA_IDX(qid), RX_RING_DMA_IDX_MASK, +- FIELD_PREP(RX_RING_DMA_IDX_MASK, q->head)); +- +- airoha_qdma_fill_rx_queue(q); +- +- return 0; +-} +- +-static void airoha_qdma_cleanup_rx_queue(struct airoha_queue *q) +-{ +- struct airoha_eth *eth = q->qdma->eth; +- +- while (q->queued) { +- struct airoha_queue_entry *e = &q->entry[q->tail]; +- struct page *page = virt_to_head_page(e->buf); +- +- dma_sync_single_for_cpu(eth->dev, e->dma_addr, e->dma_len, +- page_pool_get_dma_dir(q->page_pool)); +- page_pool_put_full_page(q->page_pool, page, false); +- q->tail = (q->tail + 1) % q->ndesc; +- q->queued--; +- } +-} +- +-static int airoha_qdma_init_rx(struct airoha_qdma *qdma) +-{ +- int i; +- +- for (i = 0; i < ARRAY_SIZE(qdma->q_rx); i++) { +- int err; +- +- if (!(RX_DONE_INT_MASK & BIT(i))) { +- /* rx-queue not binded to irq */ +- continue; +- } +- +- err = airoha_qdma_init_rx_queue(&qdma->q_rx[i], qdma, +- RX_DSCP_NUM(i)); +- if (err) +- return err; +- } +- +- return 0; +-} +- +-static int airoha_qdma_tx_napi_poll(struct napi_struct *napi, int budget) +-{ +- struct airoha_tx_irq_queue *irq_q; +- int id, done = 0, irq_queued; +- struct airoha_qdma *qdma; +- struct airoha_eth *eth; +- u32 status, head; +- +- irq_q = container_of(napi, struct airoha_tx_irq_queue, napi); +- qdma = irq_q->qdma; +- id = irq_q - &qdma->q_tx_irq[0]; +- eth = qdma->eth; +- +- status = airoha_qdma_rr(qdma, REG_IRQ_STATUS(id)); +- head = FIELD_GET(IRQ_HEAD_IDX_MASK, status); +- head = head % irq_q->size; +- irq_queued = FIELD_GET(IRQ_ENTRY_LEN_MASK, status); +- +- while (irq_queued > 0 && done < budget) { +- u32 qid, val = irq_q->q[head]; +- struct airoha_qdma_desc *desc; +- struct airoha_queue_entry *e; +- struct airoha_queue *q; +- u32 index, desc_ctrl; +- struct sk_buff *skb; +- +- if (val == 0xff) +- break; +- +- irq_q->q[head] = 0xff; /* mark as done */ +- head = (head + 1) % irq_q->size; +- irq_queued--; +- done++; +- +- qid = FIELD_GET(IRQ_RING_IDX_MASK, val); +- if (qid >= ARRAY_SIZE(qdma->q_tx)) +- continue; +- +- q = &qdma->q_tx[qid]; +- if (!q->ndesc) +- continue; +- +- index = FIELD_GET(IRQ_DESC_IDX_MASK, val); +- if (index >= q->ndesc) +- continue; +- +- spin_lock_bh(&q->lock); +- +- if (!q->queued) +- goto unlock; +- +- desc = &q->desc[index]; +- desc_ctrl = le32_to_cpu(desc->ctrl); +- +- if (!(desc_ctrl & QDMA_DESC_DONE_MASK) && +- !(desc_ctrl & QDMA_DESC_DROP_MASK)) +- goto unlock; +- +- e = &q->entry[index]; +- skb = e->skb; +- +- dma_unmap_single(eth->dev, e->dma_addr, e->dma_len, +- DMA_TO_DEVICE); +- memset(e, 0, sizeof(*e)); +- WRITE_ONCE(desc->msg0, 0); +- WRITE_ONCE(desc->msg1, 0); +- q->queued--; +- +- /* completion ring can report out-of-order indexes if hw QoS +- * is enabled and packets with different priority are queued +- * to same DMA ring. Take into account possible out-of-order +- * reports incrementing DMA ring tail pointer +- */ +- while (q->tail != q->head && !q->entry[q->tail].dma_addr) +- q->tail = (q->tail + 1) % q->ndesc; +- +- if (skb) { +- u16 queue = skb_get_queue_mapping(skb); +- struct netdev_queue *txq; +- +- txq = netdev_get_tx_queue(skb->dev, queue); +- netdev_tx_completed_queue(txq, 1, skb->len); +- if (netif_tx_queue_stopped(txq) && +- q->ndesc - q->queued >= q->free_thr) +- netif_tx_wake_queue(txq); +- +- dev_kfree_skb_any(skb); +- } +-unlock: +- spin_unlock_bh(&q->lock); +- } +- +- if (done) { +- int i, len = done >> 7; +- +- for (i = 0; i < len; i++) +- airoha_qdma_rmw(qdma, REG_IRQ_CLEAR_LEN(id), +- IRQ_CLEAR_LEN_MASK, 0x80); +- airoha_qdma_rmw(qdma, REG_IRQ_CLEAR_LEN(id), +- IRQ_CLEAR_LEN_MASK, (done & 0x7f)); +- } +- +- if (done < budget && napi_complete(napi)) +- airoha_qdma_irq_enable(qdma, QDMA_INT_REG_IDX0, +- TX_DONE_INT_MASK(id)); +- +- return done; +-} +- +-static int airoha_qdma_init_tx_queue(struct airoha_queue *q, +- struct airoha_qdma *qdma, int size) +-{ +- struct airoha_eth *eth = qdma->eth; +- int i, qid = q - &qdma->q_tx[0]; +- dma_addr_t dma_addr; +- +- spin_lock_init(&q->lock); +- q->ndesc = size; +- q->qdma = qdma; +- q->free_thr = 1 + MAX_SKB_FRAGS; +- +- q->entry = devm_kzalloc(eth->dev, q->ndesc * sizeof(*q->entry), +- GFP_KERNEL); +- if (!q->entry) +- return -ENOMEM; +- +- q->desc = dmam_alloc_coherent(eth->dev, q->ndesc * sizeof(*q->desc), +- &dma_addr, GFP_KERNEL); +- if (!q->desc) +- return -ENOMEM; +- +- for (i = 0; i < q->ndesc; i++) { +- u32 val; +- +- val = FIELD_PREP(QDMA_DESC_DONE_MASK, 1); +- WRITE_ONCE(q->desc[i].ctrl, cpu_to_le32(val)); +- } +- +- /* xmit ring drop default setting */ +- airoha_qdma_set(qdma, REG_TX_RING_BLOCKING(qid), +- TX_RING_IRQ_BLOCKING_TX_DROP_EN_MASK); +- +- airoha_qdma_wr(qdma, REG_TX_RING_BASE(qid), dma_addr); +- airoha_qdma_rmw(qdma, REG_TX_CPU_IDX(qid), TX_RING_CPU_IDX_MASK, +- FIELD_PREP(TX_RING_CPU_IDX_MASK, q->head)); +- airoha_qdma_rmw(qdma, REG_TX_DMA_IDX(qid), TX_RING_DMA_IDX_MASK, +- FIELD_PREP(TX_RING_DMA_IDX_MASK, q->head)); +- +- return 0; +-} +- +-static int airoha_qdma_tx_irq_init(struct airoha_tx_irq_queue *irq_q, +- struct airoha_qdma *qdma, int size) +-{ +- int id = irq_q - &qdma->q_tx_irq[0]; +- struct airoha_eth *eth = qdma->eth; +- dma_addr_t dma_addr; +- +- netif_napi_add_tx(eth->napi_dev, &irq_q->napi, +- airoha_qdma_tx_napi_poll); +- irq_q->q = dmam_alloc_coherent(eth->dev, size * sizeof(u32), +- &dma_addr, GFP_KERNEL); +- if (!irq_q->q) +- return -ENOMEM; +- +- memset(irq_q->q, 0xff, size * sizeof(u32)); +- irq_q->size = size; +- irq_q->qdma = qdma; +- +- airoha_qdma_wr(qdma, REG_TX_IRQ_BASE(id), dma_addr); +- airoha_qdma_rmw(qdma, REG_TX_IRQ_CFG(id), TX_IRQ_DEPTH_MASK, +- FIELD_PREP(TX_IRQ_DEPTH_MASK, size)); +- airoha_qdma_rmw(qdma, REG_TX_IRQ_CFG(id), TX_IRQ_THR_MASK, +- FIELD_PREP(TX_IRQ_THR_MASK, 1)); +- +- return 0; +-} +- +-static int airoha_qdma_init_tx(struct airoha_qdma *qdma) +-{ +- int i, err; +- +- for (i = 0; i < ARRAY_SIZE(qdma->q_tx_irq); i++) { +- err = airoha_qdma_tx_irq_init(&qdma->q_tx_irq[i], qdma, +- IRQ_QUEUE_LEN(i)); +- if (err) +- return err; +- } +- +- for (i = 0; i < ARRAY_SIZE(qdma->q_tx); i++) { +- err = airoha_qdma_init_tx_queue(&qdma->q_tx[i], qdma, +- TX_DSCP_NUM); +- if (err) +- return err; +- } +- +- return 0; +-} +- +-static void airoha_qdma_cleanup_tx_queue(struct airoha_queue *q) +-{ +- struct airoha_eth *eth = q->qdma->eth; +- +- spin_lock_bh(&q->lock); +- while (q->queued) { +- struct airoha_queue_entry *e = &q->entry[q->tail]; +- +- dma_unmap_single(eth->dev, e->dma_addr, e->dma_len, +- DMA_TO_DEVICE); +- dev_kfree_skb_any(e->skb); +- e->skb = NULL; +- +- q->tail = (q->tail + 1) % q->ndesc; +- q->queued--; +- } +- spin_unlock_bh(&q->lock); +-} +- +-static int airoha_qdma_init_hfwd_queues(struct airoha_qdma *qdma) +-{ +- struct airoha_eth *eth = qdma->eth; +- dma_addr_t dma_addr; +- u32 status; +- int size; +- +- size = HW_DSCP_NUM * sizeof(struct airoha_qdma_fwd_desc); +- qdma->hfwd.desc = dmam_alloc_coherent(eth->dev, size, &dma_addr, +- GFP_KERNEL); +- if (!qdma->hfwd.desc) +- return -ENOMEM; +- +- airoha_qdma_wr(qdma, REG_FWD_DSCP_BASE, dma_addr); +- +- size = AIROHA_MAX_PACKET_SIZE * HW_DSCP_NUM; +- qdma->hfwd.q = dmam_alloc_coherent(eth->dev, size, &dma_addr, +- GFP_KERNEL); +- if (!qdma->hfwd.q) +- return -ENOMEM; +- +- airoha_qdma_wr(qdma, REG_FWD_BUF_BASE, dma_addr); +- +- airoha_qdma_rmw(qdma, REG_HW_FWD_DSCP_CFG, +- HW_FWD_DSCP_PAYLOAD_SIZE_MASK, +- FIELD_PREP(HW_FWD_DSCP_PAYLOAD_SIZE_MASK, 0)); +- airoha_qdma_rmw(qdma, REG_FWD_DSCP_LOW_THR, FWD_DSCP_LOW_THR_MASK, +- FIELD_PREP(FWD_DSCP_LOW_THR_MASK, 128)); +- airoha_qdma_rmw(qdma, REG_LMGR_INIT_CFG, +- LMGR_INIT_START | LMGR_SRAM_MODE_MASK | +- HW_FWD_DESC_NUM_MASK, +- FIELD_PREP(HW_FWD_DESC_NUM_MASK, HW_DSCP_NUM) | +- LMGR_INIT_START); +- +- return read_poll_timeout(airoha_qdma_rr, status, +- !(status & LMGR_INIT_START), USEC_PER_MSEC, +- 30 * USEC_PER_MSEC, true, qdma, +- REG_LMGR_INIT_CFG); +-} +- +-static void airoha_qdma_init_qos(struct airoha_qdma *qdma) +-{ +- airoha_qdma_clear(qdma, REG_TXWRR_MODE_CFG, TWRR_WEIGHT_SCALE_MASK); +- airoha_qdma_set(qdma, REG_TXWRR_MODE_CFG, TWRR_WEIGHT_BASE_MASK); +- +- airoha_qdma_clear(qdma, REG_PSE_BUF_USAGE_CFG, +- PSE_BUF_ESTIMATE_EN_MASK); +- +- airoha_qdma_set(qdma, REG_EGRESS_RATE_METER_CFG, +- EGRESS_RATE_METER_EN_MASK | +- EGRESS_RATE_METER_EQ_RATE_EN_MASK); +- /* 2047us x 31 = 63.457ms */ +- airoha_qdma_rmw(qdma, REG_EGRESS_RATE_METER_CFG, +- EGRESS_RATE_METER_WINDOW_SZ_MASK, +- FIELD_PREP(EGRESS_RATE_METER_WINDOW_SZ_MASK, 0x1f)); +- airoha_qdma_rmw(qdma, REG_EGRESS_RATE_METER_CFG, +- EGRESS_RATE_METER_TIMESLICE_MASK, +- FIELD_PREP(EGRESS_RATE_METER_TIMESLICE_MASK, 0x7ff)); +- +- /* ratelimit init */ +- airoha_qdma_set(qdma, REG_GLB_TRTCM_CFG, GLB_TRTCM_EN_MASK); +- /* fast-tick 25us */ +- airoha_qdma_rmw(qdma, REG_GLB_TRTCM_CFG, GLB_FAST_TICK_MASK, +- FIELD_PREP(GLB_FAST_TICK_MASK, 25)); +- airoha_qdma_rmw(qdma, REG_GLB_TRTCM_CFG, GLB_SLOW_TICK_RATIO_MASK, +- FIELD_PREP(GLB_SLOW_TICK_RATIO_MASK, 40)); +- +- airoha_qdma_set(qdma, REG_EGRESS_TRTCM_CFG, EGRESS_TRTCM_EN_MASK); +- airoha_qdma_rmw(qdma, REG_EGRESS_TRTCM_CFG, EGRESS_FAST_TICK_MASK, +- FIELD_PREP(EGRESS_FAST_TICK_MASK, 25)); +- airoha_qdma_rmw(qdma, REG_EGRESS_TRTCM_CFG, +- EGRESS_SLOW_TICK_RATIO_MASK, +- FIELD_PREP(EGRESS_SLOW_TICK_RATIO_MASK, 40)); +- +- airoha_qdma_set(qdma, REG_INGRESS_TRTCM_CFG, INGRESS_TRTCM_EN_MASK); +- airoha_qdma_clear(qdma, REG_INGRESS_TRTCM_CFG, +- INGRESS_TRTCM_MODE_MASK); +- airoha_qdma_rmw(qdma, REG_INGRESS_TRTCM_CFG, INGRESS_FAST_TICK_MASK, +- FIELD_PREP(INGRESS_FAST_TICK_MASK, 125)); +- airoha_qdma_rmw(qdma, REG_INGRESS_TRTCM_CFG, +- INGRESS_SLOW_TICK_RATIO_MASK, +- FIELD_PREP(INGRESS_SLOW_TICK_RATIO_MASK, 8)); +- +- airoha_qdma_set(qdma, REG_SLA_TRTCM_CFG, SLA_TRTCM_EN_MASK); +- airoha_qdma_rmw(qdma, REG_SLA_TRTCM_CFG, SLA_FAST_TICK_MASK, +- FIELD_PREP(SLA_FAST_TICK_MASK, 25)); +- airoha_qdma_rmw(qdma, REG_SLA_TRTCM_CFG, SLA_SLOW_TICK_RATIO_MASK, +- FIELD_PREP(SLA_SLOW_TICK_RATIO_MASK, 40)); +-} +- +-static void airoha_qdma_init_qos_stats(struct airoha_qdma *qdma) +-{ +- int i; +- +- for (i = 0; i < AIROHA_NUM_QOS_CHANNELS; i++) { +- /* Tx-cpu transferred count */ +- airoha_qdma_wr(qdma, REG_CNTR_VAL(i << 1), 0); +- airoha_qdma_wr(qdma, REG_CNTR_CFG(i << 1), +- CNTR_EN_MASK | CNTR_ALL_QUEUE_EN_MASK | +- CNTR_ALL_DSCP_RING_EN_MASK | +- FIELD_PREP(CNTR_CHAN_MASK, i)); +- /* Tx-fwd transferred count */ +- airoha_qdma_wr(qdma, REG_CNTR_VAL((i << 1) + 1), 0); +- airoha_qdma_wr(qdma, REG_CNTR_CFG(i << 1), +- CNTR_EN_MASK | CNTR_ALL_QUEUE_EN_MASK | +- CNTR_ALL_DSCP_RING_EN_MASK | +- FIELD_PREP(CNTR_SRC_MASK, 1) | +- FIELD_PREP(CNTR_CHAN_MASK, i)); +- } +-} +- +-static int airoha_qdma_hw_init(struct airoha_qdma *qdma) +-{ +- int i; +- +- /* clear pending irqs */ +- for (i = 0; i < ARRAY_SIZE(qdma->irqmask); i++) +- airoha_qdma_wr(qdma, REG_INT_STATUS(i), 0xffffffff); +- +- /* setup irqs */ +- airoha_qdma_irq_enable(qdma, QDMA_INT_REG_IDX0, INT_IDX0_MASK); +- airoha_qdma_irq_enable(qdma, QDMA_INT_REG_IDX1, INT_IDX1_MASK); +- airoha_qdma_irq_enable(qdma, QDMA_INT_REG_IDX4, INT_IDX4_MASK); +- +- /* setup irq binding */ +- for (i = 0; i < ARRAY_SIZE(qdma->q_tx); i++) { +- if (!qdma->q_tx[i].ndesc) +- continue; +- +- if (TX_RING_IRQ_BLOCKING_MAP_MASK & BIT(i)) +- airoha_qdma_set(qdma, REG_TX_RING_BLOCKING(i), +- TX_RING_IRQ_BLOCKING_CFG_MASK); +- else +- airoha_qdma_clear(qdma, REG_TX_RING_BLOCKING(i), +- TX_RING_IRQ_BLOCKING_CFG_MASK); +- } +- +- airoha_qdma_wr(qdma, REG_QDMA_GLOBAL_CFG, +- GLOBAL_CFG_RX_2B_OFFSET_MASK | +- FIELD_PREP(GLOBAL_CFG_DMA_PREFERENCE_MASK, 3) | +- GLOBAL_CFG_CPU_TXR_RR_MASK | +- GLOBAL_CFG_PAYLOAD_BYTE_SWAP_MASK | +- GLOBAL_CFG_MULTICAST_MODIFY_FP_MASK | +- GLOBAL_CFG_MULTICAST_EN_MASK | +- GLOBAL_CFG_IRQ0_EN_MASK | GLOBAL_CFG_IRQ1_EN_MASK | +- GLOBAL_CFG_TX_WB_DONE_MASK | +- FIELD_PREP(GLOBAL_CFG_MAX_ISSUE_NUM_MASK, 2)); +- +- airoha_qdma_init_qos(qdma); +- +- /* disable qdma rx delay interrupt */ +- for (i = 0; i < ARRAY_SIZE(qdma->q_rx); i++) { +- if (!qdma->q_rx[i].ndesc) +- continue; +- +- airoha_qdma_clear(qdma, REG_RX_DELAY_INT_IDX(i), +- RX_DELAY_INT_MASK); +- } +- +- airoha_qdma_set(qdma, REG_TXQ_CNGST_CFG, +- TXQ_CNGST_DROP_EN | TXQ_CNGST_DEI_DROP_EN); +- airoha_qdma_init_qos_stats(qdma); +- +- return 0; +-} +- +-static irqreturn_t airoha_irq_handler(int irq, void *dev_instance) +-{ +- struct airoha_qdma *qdma = dev_instance; +- u32 intr[ARRAY_SIZE(qdma->irqmask)]; +- int i; +- +- for (i = 0; i < ARRAY_SIZE(qdma->irqmask); i++) { +- intr[i] = airoha_qdma_rr(qdma, REG_INT_STATUS(i)); +- intr[i] &= qdma->irqmask[i]; +- airoha_qdma_wr(qdma, REG_INT_STATUS(i), intr[i]); +- } +- +- if (!test_bit(DEV_STATE_INITIALIZED, &qdma->eth->state)) +- return IRQ_NONE; +- +- if (intr[1] & RX_DONE_INT_MASK) { +- airoha_qdma_irq_disable(qdma, QDMA_INT_REG_IDX1, +- RX_DONE_INT_MASK); +- +- for (i = 0; i < ARRAY_SIZE(qdma->q_rx); i++) { +- if (!qdma->q_rx[i].ndesc) +- continue; +- +- if (intr[1] & BIT(i)) +- napi_schedule(&qdma->q_rx[i].napi); +- } +- } +- +- if (intr[0] & INT_TX_MASK) { +- for (i = 0; i < ARRAY_SIZE(qdma->q_tx_irq); i++) { +- if (!(intr[0] & TX_DONE_INT_MASK(i))) +- continue; +- +- airoha_qdma_irq_disable(qdma, QDMA_INT_REG_IDX0, +- TX_DONE_INT_MASK(i)); +- napi_schedule(&qdma->q_tx_irq[i].napi); +- } +- } +- +- return IRQ_HANDLED; +-} +- +-static int airoha_qdma_init(struct platform_device *pdev, +- struct airoha_eth *eth, +- struct airoha_qdma *qdma) +-{ +- int err, id = qdma - ð->qdma[0]; +- const char *res; +- +- spin_lock_init(&qdma->irq_lock); +- qdma->eth = eth; +- +- res = devm_kasprintf(eth->dev, GFP_KERNEL, "qdma%d", id); +- if (!res) +- return -ENOMEM; +- +- qdma->regs = devm_platform_ioremap_resource_byname(pdev, res); +- if (IS_ERR(qdma->regs)) +- return dev_err_probe(eth->dev, PTR_ERR(qdma->regs), +- "failed to iomap qdma%d regs\n", id); +- +- qdma->irq = platform_get_irq(pdev, 4 * id); +- if (qdma->irq < 0) +- return qdma->irq; +- +- err = devm_request_irq(eth->dev, qdma->irq, airoha_irq_handler, +- IRQF_SHARED, KBUILD_MODNAME, qdma); +- if (err) +- return err; +- +- err = airoha_qdma_init_rx(qdma); +- if (err) +- return err; +- +- err = airoha_qdma_init_tx(qdma); +- if (err) +- return err; +- +- err = airoha_qdma_init_hfwd_queues(qdma); +- if (err) +- return err; +- +- return airoha_qdma_hw_init(qdma); +-} +- +-static int airoha_hw_init(struct platform_device *pdev, +- struct airoha_eth *eth) +-{ +- int err, i; +- +- /* disable xsi */ +- err = reset_control_bulk_assert(ARRAY_SIZE(eth->xsi_rsts), +- eth->xsi_rsts); +- if (err) +- return err; +- +- err = reset_control_bulk_assert(ARRAY_SIZE(eth->rsts), eth->rsts); +- if (err) +- return err; +- +- msleep(20); +- err = reset_control_bulk_deassert(ARRAY_SIZE(eth->rsts), eth->rsts); +- if (err) +- return err; +- +- msleep(20); +- err = airoha_fe_init(eth); +- if (err) +- return err; +- +- for (i = 0; i < ARRAY_SIZE(eth->qdma); i++) { +- err = airoha_qdma_init(pdev, eth, ð->qdma[i]); +- if (err) +- return err; +- } +- +- set_bit(DEV_STATE_INITIALIZED, ð->state); +- +- return 0; +-} +- +-static void airoha_hw_cleanup(struct airoha_qdma *qdma) +-{ +- int i; +- +- for (i = 0; i < ARRAY_SIZE(qdma->q_rx); i++) { +- if (!qdma->q_rx[i].ndesc) +- continue; +- +- netif_napi_del(&qdma->q_rx[i].napi); +- airoha_qdma_cleanup_rx_queue(&qdma->q_rx[i]); +- if (qdma->q_rx[i].page_pool) +- page_pool_destroy(qdma->q_rx[i].page_pool); +- } +- +- for (i = 0; i < ARRAY_SIZE(qdma->q_tx_irq); i++) +- netif_napi_del(&qdma->q_tx_irq[i].napi); +- +- for (i = 0; i < ARRAY_SIZE(qdma->q_tx); i++) { +- if (!qdma->q_tx[i].ndesc) +- continue; +- +- airoha_qdma_cleanup_tx_queue(&qdma->q_tx[i]); +- } +-} +- +-static void airoha_qdma_start_napi(struct airoha_qdma *qdma) +-{ +- int i; +- +- for (i = 0; i < ARRAY_SIZE(qdma->q_tx_irq); i++) +- napi_enable(&qdma->q_tx_irq[i].napi); +- +- for (i = 0; i < ARRAY_SIZE(qdma->q_rx); i++) { +- if (!qdma->q_rx[i].ndesc) +- continue; +- +- napi_enable(&qdma->q_rx[i].napi); +- } +-} +- +-static void airoha_qdma_stop_napi(struct airoha_qdma *qdma) +-{ +- int i; +- +- for (i = 0; i < ARRAY_SIZE(qdma->q_tx_irq); i++) +- napi_disable(&qdma->q_tx_irq[i].napi); +- +- for (i = 0; i < ARRAY_SIZE(qdma->q_rx); i++) { +- if (!qdma->q_rx[i].ndesc) +- continue; +- +- napi_disable(&qdma->q_rx[i].napi); +- } +-} +- +-static void airoha_update_hw_stats(struct airoha_gdm_port *port) +-{ +- struct airoha_eth *eth = port->qdma->eth; +- u32 val, i = 0; +- +- spin_lock(&port->stats.lock); +- u64_stats_update_begin(&port->stats.syncp); +- +- /* TX */ +- val = airoha_fe_rr(eth, REG_FE_GDM_TX_OK_PKT_CNT_H(port->id)); +- port->stats.tx_ok_pkts += ((u64)val << 32); +- val = airoha_fe_rr(eth, REG_FE_GDM_TX_OK_PKT_CNT_L(port->id)); +- port->stats.tx_ok_pkts += val; +- +- val = airoha_fe_rr(eth, REG_FE_GDM_TX_OK_BYTE_CNT_H(port->id)); +- port->stats.tx_ok_bytes += ((u64)val << 32); +- val = airoha_fe_rr(eth, REG_FE_GDM_TX_OK_BYTE_CNT_L(port->id)); +- port->stats.tx_ok_bytes += val; +- +- val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_DROP_CNT(port->id)); +- port->stats.tx_drops += val; +- +- val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_BC_CNT(port->id)); +- port->stats.tx_broadcast += val; +- +- val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_MC_CNT(port->id)); +- port->stats.tx_multicast += val; +- +- val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_RUNT_CNT(port->id)); +- port->stats.tx_len[i] += val; +- +- val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_E64_CNT_H(port->id)); +- port->stats.tx_len[i] += ((u64)val << 32); +- val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_E64_CNT_L(port->id)); +- port->stats.tx_len[i++] += val; +- +- val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_L64_CNT_H(port->id)); +- port->stats.tx_len[i] += ((u64)val << 32); +- val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_L64_CNT_L(port->id)); +- port->stats.tx_len[i++] += val; +- +- val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_L127_CNT_H(port->id)); +- port->stats.tx_len[i] += ((u64)val << 32); +- val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_L127_CNT_L(port->id)); +- port->stats.tx_len[i++] += val; +- +- val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_L255_CNT_H(port->id)); +- port->stats.tx_len[i] += ((u64)val << 32); +- val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_L255_CNT_L(port->id)); +- port->stats.tx_len[i++] += val; +- +- val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_L511_CNT_H(port->id)); +- port->stats.tx_len[i] += ((u64)val << 32); +- val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_L511_CNT_L(port->id)); +- port->stats.tx_len[i++] += val; +- +- val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_L1023_CNT_H(port->id)); +- port->stats.tx_len[i] += ((u64)val << 32); +- val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_L1023_CNT_L(port->id)); +- port->stats.tx_len[i++] += val; +- +- val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_LONG_CNT(port->id)); +- port->stats.tx_len[i++] += val; +- +- /* RX */ +- val = airoha_fe_rr(eth, REG_FE_GDM_RX_OK_PKT_CNT_H(port->id)); +- port->stats.rx_ok_pkts += ((u64)val << 32); +- val = airoha_fe_rr(eth, REG_FE_GDM_RX_OK_PKT_CNT_L(port->id)); +- port->stats.rx_ok_pkts += val; +- +- val = airoha_fe_rr(eth, REG_FE_GDM_RX_OK_BYTE_CNT_H(port->id)); +- port->stats.rx_ok_bytes += ((u64)val << 32); +- val = airoha_fe_rr(eth, REG_FE_GDM_RX_OK_BYTE_CNT_L(port->id)); +- port->stats.rx_ok_bytes += val; +- +- val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_DROP_CNT(port->id)); +- port->stats.rx_drops += val; +- +- val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_BC_CNT(port->id)); +- port->stats.rx_broadcast += val; +- +- val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_MC_CNT(port->id)); +- port->stats.rx_multicast += val; +- +- val = airoha_fe_rr(eth, REG_FE_GDM_RX_ERROR_DROP_CNT(port->id)); +- port->stats.rx_errors += val; +- +- val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_CRC_ERR_CNT(port->id)); +- port->stats.rx_crc_error += val; +- +- val = airoha_fe_rr(eth, REG_FE_GDM_RX_OVERFLOW_DROP_CNT(port->id)); +- port->stats.rx_over_errors += val; +- +- val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_FRAG_CNT(port->id)); +- port->stats.rx_fragment += val; +- +- val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_JABBER_CNT(port->id)); +- port->stats.rx_jabber += val; +- +- i = 0; +- val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_RUNT_CNT(port->id)); +- port->stats.rx_len[i] += val; +- +- val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_E64_CNT_H(port->id)); +- port->stats.rx_len[i] += ((u64)val << 32); +- val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_E64_CNT_L(port->id)); +- port->stats.rx_len[i++] += val; +- +- val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_L64_CNT_H(port->id)); +- port->stats.rx_len[i] += ((u64)val << 32); +- val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_L64_CNT_L(port->id)); +- port->stats.rx_len[i++] += val; +- +- val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_L127_CNT_H(port->id)); +- port->stats.rx_len[i] += ((u64)val << 32); +- val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_L127_CNT_L(port->id)); +- port->stats.rx_len[i++] += val; +- +- val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_L255_CNT_H(port->id)); +- port->stats.rx_len[i] += ((u64)val << 32); +- val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_L255_CNT_L(port->id)); +- port->stats.rx_len[i++] += val; +- +- val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_L511_CNT_H(port->id)); +- port->stats.rx_len[i] += ((u64)val << 32); +- val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_L511_CNT_L(port->id)); +- port->stats.rx_len[i++] += val; +- +- val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_L1023_CNT_H(port->id)); +- port->stats.rx_len[i] += ((u64)val << 32); +- val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_L1023_CNT_L(port->id)); +- port->stats.rx_len[i++] += val; +- +- val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_LONG_CNT(port->id)); +- port->stats.rx_len[i++] += val; +- +- /* reset mib counters */ +- airoha_fe_set(eth, REG_FE_GDM_MIB_CLEAR(port->id), +- FE_GDM_MIB_RX_CLEAR_MASK | FE_GDM_MIB_TX_CLEAR_MASK); +- +- u64_stats_update_end(&port->stats.syncp); +- spin_unlock(&port->stats.lock); +-} +- +-static int airoha_dev_open(struct net_device *dev) +-{ +- struct airoha_gdm_port *port = netdev_priv(dev); +- struct airoha_qdma *qdma = port->qdma; +- int err; +- +- netif_tx_start_all_queues(dev); +- err = airoha_set_gdm_ports(qdma->eth, true); +- if (err) +- return err; +- +- if (netdev_uses_dsa(dev)) +- airoha_fe_set(qdma->eth, REG_GDM_INGRESS_CFG(port->id), +- GDM_STAG_EN_MASK); +- else +- airoha_fe_clear(qdma->eth, REG_GDM_INGRESS_CFG(port->id), +- GDM_STAG_EN_MASK); +- +- airoha_qdma_set(qdma, REG_QDMA_GLOBAL_CFG, +- GLOBAL_CFG_TX_DMA_EN_MASK | +- GLOBAL_CFG_RX_DMA_EN_MASK); +- +- return 0; +-} +- +-static int airoha_dev_stop(struct net_device *dev) +-{ +- struct airoha_gdm_port *port = netdev_priv(dev); +- struct airoha_qdma *qdma = port->qdma; +- int i, err; +- +- netif_tx_disable(dev); +- err = airoha_set_gdm_ports(qdma->eth, false); +- if (err) +- return err; +- +- airoha_qdma_clear(qdma, REG_QDMA_GLOBAL_CFG, +- GLOBAL_CFG_TX_DMA_EN_MASK | +- GLOBAL_CFG_RX_DMA_EN_MASK); +- +- for (i = 0; i < ARRAY_SIZE(qdma->q_tx); i++) { +- if (!qdma->q_tx[i].ndesc) +- continue; +- +- airoha_qdma_cleanup_tx_queue(&qdma->q_tx[i]); +- netdev_tx_reset_subqueue(dev, i); +- } +- +- return 0; +-} +- +-static int airoha_dev_set_macaddr(struct net_device *dev, void *p) +-{ +- struct airoha_gdm_port *port = netdev_priv(dev); +- int err; +- +- err = eth_mac_addr(dev, p); +- if (err) +- return err; +- +- airoha_set_macaddr(port, dev->dev_addr); +- +- return 0; +-} +- +-static int airoha_dev_init(struct net_device *dev) +-{ +- struct airoha_gdm_port *port = netdev_priv(dev); +- +- airoha_set_macaddr(port, dev->dev_addr); +- +- return 0; +-} +- +-static void airoha_dev_get_stats64(struct net_device *dev, +- struct rtnl_link_stats64 *storage) +-{ +- struct airoha_gdm_port *port = netdev_priv(dev); +- unsigned int start; +- +- airoha_update_hw_stats(port); +- do { +- start = u64_stats_fetch_begin(&port->stats.syncp); +- storage->rx_packets = port->stats.rx_ok_pkts; +- storage->tx_packets = port->stats.tx_ok_pkts; +- storage->rx_bytes = port->stats.rx_ok_bytes; +- storage->tx_bytes = port->stats.tx_ok_bytes; +- storage->multicast = port->stats.rx_multicast; +- storage->rx_errors = port->stats.rx_errors; +- storage->rx_dropped = port->stats.rx_drops; +- storage->tx_dropped = port->stats.tx_drops; +- storage->rx_crc_errors = port->stats.rx_crc_error; +- storage->rx_over_errors = port->stats.rx_over_errors; +- } while (u64_stats_fetch_retry(&port->stats.syncp, start)); +-} +- +-static u16 airoha_dev_select_queue(struct net_device *dev, struct sk_buff *skb, +- struct net_device *sb_dev) +-{ +- struct airoha_gdm_port *port = netdev_priv(dev); +- int queue, channel; +- +- /* For dsa device select QoS channel according to the dsa user port +- * index, rely on port id otherwise. Select QoS queue based on the +- * skb priority. +- */ +- channel = netdev_uses_dsa(dev) ? skb_get_queue_mapping(skb) : port->id; +- channel = channel % AIROHA_NUM_QOS_CHANNELS; +- queue = (skb->priority - 1) % AIROHA_NUM_QOS_QUEUES; /* QoS queue */ +- queue = channel * AIROHA_NUM_QOS_QUEUES + queue; +- +- return queue < dev->num_tx_queues ? queue : 0; +-} +- +-static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb, +- struct net_device *dev) +-{ +- struct airoha_gdm_port *port = netdev_priv(dev); +- u32 nr_frags = 1 + skb_shinfo(skb)->nr_frags; +- u32 msg0, msg1, len = skb_headlen(skb); +- struct airoha_qdma *qdma = port->qdma; +- struct netdev_queue *txq; +- struct airoha_queue *q; +- void *data = skb->data; +- int i, qid; +- u16 index; +- u8 fport; +- +- qid = skb_get_queue_mapping(skb) % ARRAY_SIZE(qdma->q_tx); +- msg0 = FIELD_PREP(QDMA_ETH_TXMSG_CHAN_MASK, +- qid / AIROHA_NUM_QOS_QUEUES) | +- FIELD_PREP(QDMA_ETH_TXMSG_QUEUE_MASK, +- qid % AIROHA_NUM_QOS_QUEUES); +- if (skb->ip_summed == CHECKSUM_PARTIAL) +- msg0 |= FIELD_PREP(QDMA_ETH_TXMSG_TCO_MASK, 1) | +- FIELD_PREP(QDMA_ETH_TXMSG_UCO_MASK, 1) | +- FIELD_PREP(QDMA_ETH_TXMSG_ICO_MASK, 1); +- +- /* TSO: fill MSS info in tcp checksum field */ +- if (skb_is_gso(skb)) { +- if (skb_cow_head(skb, 0)) +- goto error; +- +- if (skb_shinfo(skb)->gso_type & (SKB_GSO_TCPV4 | +- SKB_GSO_TCPV6)) { +- __be16 csum = cpu_to_be16(skb_shinfo(skb)->gso_size); +- +- tcp_hdr(skb)->check = (__force __sum16)csum; +- msg0 |= FIELD_PREP(QDMA_ETH_TXMSG_TSO_MASK, 1); +- } +- } +- +- fport = port->id == 4 ? FE_PSE_PORT_GDM4 : port->id; +- msg1 = FIELD_PREP(QDMA_ETH_TXMSG_FPORT_MASK, fport) | +- FIELD_PREP(QDMA_ETH_TXMSG_METER_MASK, 0x7f); +- +- q = &qdma->q_tx[qid]; +- if (WARN_ON_ONCE(!q->ndesc)) +- goto error; +- +- spin_lock_bh(&q->lock); +- +- txq = netdev_get_tx_queue(dev, qid); +- if (q->queued + nr_frags > q->ndesc) { +- /* not enough space in the queue */ +- netif_tx_stop_queue(txq); +- spin_unlock_bh(&q->lock); +- return NETDEV_TX_BUSY; +- } +- +- index = q->head; +- for (i = 0; i < nr_frags; i++) { +- struct airoha_qdma_desc *desc = &q->desc[index]; +- struct airoha_queue_entry *e = &q->entry[index]; +- skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; +- dma_addr_t addr; +- u32 val; +- +- addr = dma_map_single(dev->dev.parent, data, len, +- DMA_TO_DEVICE); +- if (unlikely(dma_mapping_error(dev->dev.parent, addr))) +- goto error_unmap; +- +- index = (index + 1) % q->ndesc; +- +- val = FIELD_PREP(QDMA_DESC_LEN_MASK, len); +- if (i < nr_frags - 1) +- val |= FIELD_PREP(QDMA_DESC_MORE_MASK, 1); +- WRITE_ONCE(desc->ctrl, cpu_to_le32(val)); +- WRITE_ONCE(desc->addr, cpu_to_le32(addr)); +- val = FIELD_PREP(QDMA_DESC_NEXT_ID_MASK, index); +- WRITE_ONCE(desc->data, cpu_to_le32(val)); +- WRITE_ONCE(desc->msg0, cpu_to_le32(msg0)); +- WRITE_ONCE(desc->msg1, cpu_to_le32(msg1)); +- WRITE_ONCE(desc->msg2, cpu_to_le32(0xffff)); +- +- e->skb = i ? NULL : skb; +- e->dma_addr = addr; +- e->dma_len = len; +- +- data = skb_frag_address(frag); +- len = skb_frag_size(frag); +- } +- +- q->head = index; +- q->queued += i; +- +- skb_tx_timestamp(skb); +- netdev_tx_sent_queue(txq, skb->len); +- +- if (netif_xmit_stopped(txq) || !netdev_xmit_more()) +- airoha_qdma_rmw(qdma, REG_TX_CPU_IDX(qid), +- TX_RING_CPU_IDX_MASK, +- FIELD_PREP(TX_RING_CPU_IDX_MASK, q->head)); +- +- if (q->ndesc - q->queued < q->free_thr) +- netif_tx_stop_queue(txq); +- +- spin_unlock_bh(&q->lock); +- +- return NETDEV_TX_OK; +- +-error_unmap: +- for (i--; i >= 0; i--) { +- index = (q->head + i) % q->ndesc; +- dma_unmap_single(dev->dev.parent, q->entry[index].dma_addr, +- q->entry[index].dma_len, DMA_TO_DEVICE); +- } +- +- spin_unlock_bh(&q->lock); +-error: +- dev_kfree_skb_any(skb); +- dev->stats.tx_dropped++; +- +- return NETDEV_TX_OK; +-} +- +-static void airoha_ethtool_get_drvinfo(struct net_device *dev, +- struct ethtool_drvinfo *info) +-{ +- struct airoha_gdm_port *port = netdev_priv(dev); +- struct airoha_eth *eth = port->qdma->eth; +- +- strscpy(info->driver, eth->dev->driver->name, sizeof(info->driver)); +- strscpy(info->bus_info, dev_name(eth->dev), sizeof(info->bus_info)); +-} +- +-static void airoha_ethtool_get_mac_stats(struct net_device *dev, +- struct ethtool_eth_mac_stats *stats) +-{ +- struct airoha_gdm_port *port = netdev_priv(dev); +- unsigned int start; +- +- airoha_update_hw_stats(port); +- do { +- start = u64_stats_fetch_begin(&port->stats.syncp); +- stats->MulticastFramesXmittedOK = port->stats.tx_multicast; +- stats->BroadcastFramesXmittedOK = port->stats.tx_broadcast; +- stats->BroadcastFramesReceivedOK = port->stats.rx_broadcast; +- } while (u64_stats_fetch_retry(&port->stats.syncp, start)); +-} +- +-static const struct ethtool_rmon_hist_range airoha_ethtool_rmon_ranges[] = { +- { 0, 64 }, +- { 65, 127 }, +- { 128, 255 }, +- { 256, 511 }, +- { 512, 1023 }, +- { 1024, 1518 }, +- { 1519, 10239 }, +- {}, +-}; +- +-static void +-airoha_ethtool_get_rmon_stats(struct net_device *dev, +- struct ethtool_rmon_stats *stats, +- const struct ethtool_rmon_hist_range **ranges) +-{ +- struct airoha_gdm_port *port = netdev_priv(dev); +- struct airoha_hw_stats *hw_stats = &port->stats; +- unsigned int start; +- +- BUILD_BUG_ON(ARRAY_SIZE(airoha_ethtool_rmon_ranges) != +- ARRAY_SIZE(hw_stats->tx_len) + 1); +- BUILD_BUG_ON(ARRAY_SIZE(airoha_ethtool_rmon_ranges) != +- ARRAY_SIZE(hw_stats->rx_len) + 1); +- +- *ranges = airoha_ethtool_rmon_ranges; +- airoha_update_hw_stats(port); +- do { +- int i; +- +- start = u64_stats_fetch_begin(&port->stats.syncp); +- stats->fragments = hw_stats->rx_fragment; +- stats->jabbers = hw_stats->rx_jabber; +- for (i = 0; i < ARRAY_SIZE(airoha_ethtool_rmon_ranges) - 1; +- i++) { +- stats->hist[i] = hw_stats->rx_len[i]; +- stats->hist_tx[i] = hw_stats->tx_len[i]; +- } +- } while (u64_stats_fetch_retry(&port->stats.syncp, start)); +-} +- +-static int airoha_qdma_set_chan_tx_sched(struct airoha_gdm_port *port, +- int channel, enum tx_sched_mode mode, +- const u16 *weights, u8 n_weights) +-{ +- int i; +- +- for (i = 0; i < AIROHA_NUM_TX_RING; i++) +- airoha_qdma_clear(port->qdma, REG_QUEUE_CLOSE_CFG(channel), +- TXQ_DISABLE_CHAN_QUEUE_MASK(channel, i)); +- +- for (i = 0; i < n_weights; i++) { +- u32 status; +- int err; +- +- airoha_qdma_wr(port->qdma, REG_TXWRR_WEIGHT_CFG, +- TWRR_RW_CMD_MASK | +- FIELD_PREP(TWRR_CHAN_IDX_MASK, channel) | +- FIELD_PREP(TWRR_QUEUE_IDX_MASK, i) | +- FIELD_PREP(TWRR_VALUE_MASK, weights[i])); +- err = read_poll_timeout(airoha_qdma_rr, status, +- status & TWRR_RW_CMD_DONE, +- USEC_PER_MSEC, 10 * USEC_PER_MSEC, +- true, port->qdma, +- REG_TXWRR_WEIGHT_CFG); +- if (err) +- return err; +- } +- +- airoha_qdma_rmw(port->qdma, REG_CHAN_QOS_MODE(channel >> 3), +- CHAN_QOS_MODE_MASK(channel), +- mode << __ffs(CHAN_QOS_MODE_MASK(channel))); +- +- return 0; +-} +- +-static int airoha_qdma_set_tx_prio_sched(struct airoha_gdm_port *port, +- int channel) +-{ +- static const u16 w[AIROHA_NUM_QOS_QUEUES] = {}; +- +- return airoha_qdma_set_chan_tx_sched(port, channel, TC_SCH_SP, w, +- ARRAY_SIZE(w)); +-} +- +-static int airoha_qdma_set_tx_ets_sched(struct airoha_gdm_port *port, +- int channel, +- struct tc_ets_qopt_offload *opt) +-{ +- struct tc_ets_qopt_offload_replace_params *p = &opt->replace_params; +- enum tx_sched_mode mode = TC_SCH_SP; +- u16 w[AIROHA_NUM_QOS_QUEUES] = {}; +- int i, nstrict = 0, nwrr, qidx; +- +- if (p->bands > AIROHA_NUM_QOS_QUEUES) +- return -EINVAL; +- +- for (i = 0; i < p->bands; i++) { +- if (!p->quanta[i]) +- nstrict++; +- } +- +- /* this configuration is not supported by the hw */ +- if (nstrict == AIROHA_NUM_QOS_QUEUES - 1) +- return -EINVAL; +- +- /* EN7581 SoC supports fixed QoS band priority where WRR queues have +- * lowest priorities with respect to SP ones. +- * e.g: WRR0, WRR1, .., WRRm, SP0, SP1, .., SPn +- */ +- nwrr = p->bands - nstrict; +- qidx = nstrict && nwrr ? nstrict : 0; +- for (i = 1; i <= p->bands; i++) { +- if (p->priomap[i % AIROHA_NUM_QOS_QUEUES] != qidx) +- return -EINVAL; +- +- qidx = i == nwrr ? 0 : qidx + 1; +- } +- +- for (i = 0; i < nwrr; i++) +- w[i] = p->weights[nstrict + i]; +- +- if (!nstrict) +- mode = TC_SCH_WRR8; +- else if (nstrict < AIROHA_NUM_QOS_QUEUES - 1) +- mode = nstrict + 1; +- +- return airoha_qdma_set_chan_tx_sched(port, channel, mode, w, +- ARRAY_SIZE(w)); +-} +- +-static int airoha_qdma_get_tx_ets_stats(struct airoha_gdm_port *port, +- int channel, +- struct tc_ets_qopt_offload *opt) +-{ +- u64 cpu_tx_packets = airoha_qdma_rr(port->qdma, +- REG_CNTR_VAL(channel << 1)); +- u64 fwd_tx_packets = airoha_qdma_rr(port->qdma, +- REG_CNTR_VAL((channel << 1) + 1)); +- u64 tx_packets = (cpu_tx_packets - port->cpu_tx_packets) + +- (fwd_tx_packets - port->fwd_tx_packets); +- _bstats_update(opt->stats.bstats, 0, tx_packets); +- +- port->cpu_tx_packets = cpu_tx_packets; +- port->fwd_tx_packets = fwd_tx_packets; +- +- return 0; +-} +- +-static int airoha_tc_setup_qdisc_ets(struct airoha_gdm_port *port, +- struct tc_ets_qopt_offload *opt) +-{ +- int channel = TC_H_MAJ(opt->handle) >> 16; +- +- if (opt->parent == TC_H_ROOT) +- return -EINVAL; +- +- switch (opt->command) { +- case TC_ETS_REPLACE: +- return airoha_qdma_set_tx_ets_sched(port, channel, opt); +- case TC_ETS_DESTROY: +- /* PRIO is default qdisc scheduler */ +- return airoha_qdma_set_tx_prio_sched(port, channel); +- case TC_ETS_STATS: +- return airoha_qdma_get_tx_ets_stats(port, channel, opt); +- default: +- return -EOPNOTSUPP; +- } +-} +- +-static int airoha_qdma_get_trtcm_param(struct airoha_qdma *qdma, int channel, +- u32 addr, enum trtcm_param_type param, +- enum trtcm_mode_type mode, +- u32 *val_low, u32 *val_high) +-{ +- u32 idx = QDMA_METER_IDX(channel), group = QDMA_METER_GROUP(channel); +- u32 val, config = FIELD_PREP(TRTCM_PARAM_TYPE_MASK, param) | +- FIELD_PREP(TRTCM_METER_GROUP_MASK, group) | +- FIELD_PREP(TRTCM_PARAM_INDEX_MASK, idx) | +- FIELD_PREP(TRTCM_PARAM_RATE_TYPE_MASK, mode); +- +- airoha_qdma_wr(qdma, REG_TRTCM_CFG_PARAM(addr), config); +- if (read_poll_timeout(airoha_qdma_rr, val, +- val & TRTCM_PARAM_RW_DONE_MASK, +- USEC_PER_MSEC, 10 * USEC_PER_MSEC, true, +- qdma, REG_TRTCM_CFG_PARAM(addr))) +- return -ETIMEDOUT; +- +- *val_low = airoha_qdma_rr(qdma, REG_TRTCM_DATA_LOW(addr)); +- if (val_high) +- *val_high = airoha_qdma_rr(qdma, REG_TRTCM_DATA_HIGH(addr)); +- +- return 0; +-} +- +-static int airoha_qdma_set_trtcm_param(struct airoha_qdma *qdma, int channel, +- u32 addr, enum trtcm_param_type param, +- enum trtcm_mode_type mode, u32 val) +-{ +- u32 idx = QDMA_METER_IDX(channel), group = QDMA_METER_GROUP(channel); +- u32 config = TRTCM_PARAM_RW_MASK | +- FIELD_PREP(TRTCM_PARAM_TYPE_MASK, param) | +- FIELD_PREP(TRTCM_METER_GROUP_MASK, group) | +- FIELD_PREP(TRTCM_PARAM_INDEX_MASK, idx) | +- FIELD_PREP(TRTCM_PARAM_RATE_TYPE_MASK, mode); +- +- airoha_qdma_wr(qdma, REG_TRTCM_DATA_LOW(addr), val); +- airoha_qdma_wr(qdma, REG_TRTCM_CFG_PARAM(addr), config); +- +- return read_poll_timeout(airoha_qdma_rr, val, +- val & TRTCM_PARAM_RW_DONE_MASK, +- USEC_PER_MSEC, 10 * USEC_PER_MSEC, true, +- qdma, REG_TRTCM_CFG_PARAM(addr)); +-} +- +-static int airoha_qdma_set_trtcm_config(struct airoha_qdma *qdma, int channel, +- u32 addr, enum trtcm_mode_type mode, +- bool enable, u32 enable_mask) +-{ +- u32 val; +- +- if (airoha_qdma_get_trtcm_param(qdma, channel, addr, TRTCM_MISC_MODE, +- mode, &val, NULL)) +- return -EINVAL; +- +- val = enable ? val | enable_mask : val & ~enable_mask; +- +- return airoha_qdma_set_trtcm_param(qdma, channel, addr, TRTCM_MISC_MODE, +- mode, val); +-} +- +-static int airoha_qdma_set_trtcm_token_bucket(struct airoha_qdma *qdma, +- int channel, u32 addr, +- enum trtcm_mode_type mode, +- u32 rate_val, u32 bucket_size) +-{ +- u32 val, config, tick, unit, rate, rate_frac; +- int err; +- +- if (airoha_qdma_get_trtcm_param(qdma, channel, addr, TRTCM_MISC_MODE, +- mode, &config, NULL)) +- return -EINVAL; +- +- val = airoha_qdma_rr(qdma, addr); +- tick = FIELD_GET(INGRESS_FAST_TICK_MASK, val); +- if (config & TRTCM_TICK_SEL) +- tick *= FIELD_GET(INGRESS_SLOW_TICK_RATIO_MASK, val); +- if (!tick) +- return -EINVAL; +- +- unit = (config & TRTCM_PKT_MODE) ? 1000000 / tick : 8000 / tick; +- if (!unit) +- return -EINVAL; +- +- rate = rate_val / unit; +- rate_frac = rate_val % unit; +- rate_frac = FIELD_PREP(TRTCM_TOKEN_RATE_MASK, rate_frac) / unit; +- rate = FIELD_PREP(TRTCM_TOKEN_RATE_MASK, rate) | +- FIELD_PREP(TRTCM_TOKEN_RATE_FRACTION_MASK, rate_frac); +- +- err = airoha_qdma_set_trtcm_param(qdma, channel, addr, +- TRTCM_TOKEN_RATE_MODE, mode, rate); +- if (err) +- return err; +- +- val = max_t(u32, bucket_size, MIN_TOKEN_SIZE); +- val = min_t(u32, __fls(val), MAX_TOKEN_SIZE_OFFSET); +- +- return airoha_qdma_set_trtcm_param(qdma, channel, addr, +- TRTCM_BUCKETSIZE_SHIFT_MODE, +- mode, val); +-} +- +-static int airoha_qdma_set_tx_rate_limit(struct airoha_gdm_port *port, +- int channel, u32 rate, +- u32 bucket_size) +-{ +- int i, err; +- +- for (i = 0; i <= TRTCM_PEAK_MODE; i++) { +- err = airoha_qdma_set_trtcm_config(port->qdma, channel, +- REG_EGRESS_TRTCM_CFG, i, +- !!rate, TRTCM_METER_MODE); +- if (err) +- return err; +- +- err = airoha_qdma_set_trtcm_token_bucket(port->qdma, channel, +- REG_EGRESS_TRTCM_CFG, +- i, rate, bucket_size); +- if (err) +- return err; +- } +- +- return 0; +-} +- +-static int airoha_tc_htb_alloc_leaf_queue(struct airoha_gdm_port *port, +- struct tc_htb_qopt_offload *opt) +-{ +- u32 channel = TC_H_MIN(opt->classid) % AIROHA_NUM_QOS_CHANNELS; +- u32 rate = div_u64(opt->rate, 1000) << 3; /* kbps */ +- struct net_device *dev = port->dev; +- int num_tx_queues = dev->real_num_tx_queues; +- int err; +- +- if (opt->parent_classid != TC_HTB_CLASSID_ROOT) { +- NL_SET_ERR_MSG_MOD(opt->extack, "invalid parent classid"); +- return -EINVAL; +- } +- +- err = airoha_qdma_set_tx_rate_limit(port, channel, rate, opt->quantum); +- if (err) { +- NL_SET_ERR_MSG_MOD(opt->extack, +- "failed configuring htb offload"); +- return err; +- } +- +- if (opt->command == TC_HTB_NODE_MODIFY) +- return 0; +- +- err = netif_set_real_num_tx_queues(dev, num_tx_queues + 1); +- if (err) { +- airoha_qdma_set_tx_rate_limit(port, channel, 0, opt->quantum); +- NL_SET_ERR_MSG_MOD(opt->extack, +- "failed setting real_num_tx_queues"); +- return err; +- } +- +- set_bit(channel, port->qos_sq_bmap); +- opt->qid = AIROHA_NUM_TX_RING + channel; +- +- return 0; +-} +- +-static void airoha_tc_remove_htb_queue(struct airoha_gdm_port *port, int queue) +-{ +- struct net_device *dev = port->dev; +- +- netif_set_real_num_tx_queues(dev, dev->real_num_tx_queues - 1); +- airoha_qdma_set_tx_rate_limit(port, queue + 1, 0, 0); +- clear_bit(queue, port->qos_sq_bmap); +-} +- +-static int airoha_tc_htb_delete_leaf_queue(struct airoha_gdm_port *port, +- struct tc_htb_qopt_offload *opt) +-{ +- u32 channel = TC_H_MIN(opt->classid) % AIROHA_NUM_QOS_CHANNELS; +- +- if (!test_bit(channel, port->qos_sq_bmap)) { +- NL_SET_ERR_MSG_MOD(opt->extack, "invalid queue id"); +- return -EINVAL; +- } +- +- airoha_tc_remove_htb_queue(port, channel); +- +- return 0; +-} +- +-static int airoha_tc_htb_destroy(struct airoha_gdm_port *port) +-{ +- int q; +- +- for_each_set_bit(q, port->qos_sq_bmap, AIROHA_NUM_QOS_CHANNELS) +- airoha_tc_remove_htb_queue(port, q); +- +- return 0; +-} +- +-static int airoha_tc_get_htb_get_leaf_queue(struct airoha_gdm_port *port, +- struct tc_htb_qopt_offload *opt) +-{ +- u32 channel = TC_H_MIN(opt->classid) % AIROHA_NUM_QOS_CHANNELS; +- +- if (!test_bit(channel, port->qos_sq_bmap)) { +- NL_SET_ERR_MSG_MOD(opt->extack, "invalid queue id"); +- return -EINVAL; +- } +- +- opt->qid = channel; +- +- return 0; +-} +- +-static int airoha_tc_setup_qdisc_htb(struct airoha_gdm_port *port, +- struct tc_htb_qopt_offload *opt) +-{ +- switch (opt->command) { +- case TC_HTB_CREATE: +- break; +- case TC_HTB_DESTROY: +- return airoha_tc_htb_destroy(port); +- case TC_HTB_NODE_MODIFY: +- case TC_HTB_LEAF_ALLOC_QUEUE: +- return airoha_tc_htb_alloc_leaf_queue(port, opt); +- case TC_HTB_LEAF_DEL: +- case TC_HTB_LEAF_DEL_LAST: +- case TC_HTB_LEAF_DEL_LAST_FORCE: +- return airoha_tc_htb_delete_leaf_queue(port, opt); +- case TC_HTB_LEAF_QUERY_QUEUE: +- return airoha_tc_get_htb_get_leaf_queue(port, opt); +- default: +- return -EOPNOTSUPP; +- } +- +- return 0; +-} +- +-static int airoha_dev_tc_setup(struct net_device *dev, enum tc_setup_type type, +- void *type_data) +-{ +- struct airoha_gdm_port *port = netdev_priv(dev); +- +- switch (type) { +- case TC_SETUP_QDISC_ETS: +- return airoha_tc_setup_qdisc_ets(port, type_data); +- case TC_SETUP_QDISC_HTB: +- return airoha_tc_setup_qdisc_htb(port, type_data); +- default: +- return -EOPNOTSUPP; +- } +-} +- +-static const struct net_device_ops airoha_netdev_ops = { +- .ndo_init = airoha_dev_init, +- .ndo_open = airoha_dev_open, +- .ndo_stop = airoha_dev_stop, +- .ndo_select_queue = airoha_dev_select_queue, +- .ndo_start_xmit = airoha_dev_xmit, +- .ndo_get_stats64 = airoha_dev_get_stats64, +- .ndo_set_mac_address = airoha_dev_set_macaddr, +- .ndo_setup_tc = airoha_dev_tc_setup, +-}; +- +-static const struct ethtool_ops airoha_ethtool_ops = { +- .get_drvinfo = airoha_ethtool_get_drvinfo, +- .get_eth_mac_stats = airoha_ethtool_get_mac_stats, +- .get_rmon_stats = airoha_ethtool_get_rmon_stats, +-}; +- +-static int airoha_alloc_gdm_port(struct airoha_eth *eth, struct device_node *np) +-{ +- const __be32 *id_ptr = of_get_property(np, "reg", NULL); +- struct airoha_gdm_port *port; +- struct airoha_qdma *qdma; +- struct net_device *dev; +- int err, index; +- u32 id; +- +- if (!id_ptr) { +- dev_err(eth->dev, "missing gdm port id\n"); +- return -EINVAL; +- } +- +- id = be32_to_cpup(id_ptr); +- index = id - 1; +- +- if (!id || id > ARRAY_SIZE(eth->ports)) { +- dev_err(eth->dev, "invalid gdm port id: %d\n", id); +- return -EINVAL; +- } +- +- if (eth->ports[index]) { +- dev_err(eth->dev, "duplicate gdm port id: %d\n", id); +- return -EINVAL; +- } +- +- dev = devm_alloc_etherdev_mqs(eth->dev, sizeof(*port), +- AIROHA_NUM_NETDEV_TX_RINGS, +- AIROHA_NUM_RX_RING); +- if (!dev) { +- dev_err(eth->dev, "alloc_etherdev failed\n"); +- return -ENOMEM; +- } +- +- qdma = ð->qdma[index % AIROHA_MAX_NUM_QDMA]; +- dev->netdev_ops = &airoha_netdev_ops; +- dev->ethtool_ops = &airoha_ethtool_ops; +- dev->max_mtu = AIROHA_MAX_MTU; +- dev->watchdog_timeo = 5 * HZ; +- dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_RXCSUM | +- NETIF_F_TSO6 | NETIF_F_IPV6_CSUM | +- NETIF_F_SG | NETIF_F_TSO | +- NETIF_F_HW_TC; +- dev->features |= dev->hw_features; +- dev->dev.of_node = np; +- dev->irq = qdma->irq; +- SET_NETDEV_DEV(dev, eth->dev); +- +- /* reserve hw queues for HTB offloading */ +- err = netif_set_real_num_tx_queues(dev, AIROHA_NUM_TX_RING); +- if (err) +- return err; +- +- err = of_get_ethdev_address(np, dev); +- if (err) { +- if (err == -EPROBE_DEFER) +- return err; +- +- eth_hw_addr_random(dev); +- dev_info(eth->dev, "generated random MAC address %pM\n", +- dev->dev_addr); +- } +- +- port = netdev_priv(dev); +- u64_stats_init(&port->stats.syncp); +- spin_lock_init(&port->stats.lock); +- port->qdma = qdma; +- port->dev = dev; +- port->id = id; +- eth->ports[index] = port; +- +- return register_netdev(dev); +-} +- +-static int airoha_probe(struct platform_device *pdev) +-{ +- struct device_node *np; +- struct airoha_eth *eth; +- int i, err; +- +- eth = devm_kzalloc(&pdev->dev, sizeof(*eth), GFP_KERNEL); +- if (!eth) +- return -ENOMEM; +- +- eth->dev = &pdev->dev; +- +- err = dma_set_mask_and_coherent(eth->dev, DMA_BIT_MASK(32)); +- if (err) { +- dev_err(eth->dev, "failed configuring DMA mask\n"); +- return err; +- } +- +- eth->fe_regs = devm_platform_ioremap_resource_byname(pdev, "fe"); +- if (IS_ERR(eth->fe_regs)) +- return dev_err_probe(eth->dev, PTR_ERR(eth->fe_regs), +- "failed to iomap fe regs\n"); +- +- eth->rsts[0].id = "fe"; +- eth->rsts[1].id = "pdma"; +- eth->rsts[2].id = "qdma"; +- err = devm_reset_control_bulk_get_exclusive(eth->dev, +- ARRAY_SIZE(eth->rsts), +- eth->rsts); +- if (err) { +- dev_err(eth->dev, "failed to get bulk reset lines\n"); +- return err; +- } +- +- eth->xsi_rsts[0].id = "xsi-mac"; +- eth->xsi_rsts[1].id = "hsi0-mac"; +- eth->xsi_rsts[2].id = "hsi1-mac"; +- eth->xsi_rsts[3].id = "hsi-mac"; +- eth->xsi_rsts[4].id = "xfp-mac"; +- err = devm_reset_control_bulk_get_exclusive(eth->dev, +- ARRAY_SIZE(eth->xsi_rsts), +- eth->xsi_rsts); +- if (err) { +- dev_err(eth->dev, "failed to get bulk xsi reset lines\n"); +- return err; +- } +- +- eth->napi_dev = alloc_netdev_dummy(0); +- if (!eth->napi_dev) +- return -ENOMEM; +- +- /* Enable threaded NAPI by default */ +- eth->napi_dev->threaded = true; +- strscpy(eth->napi_dev->name, "qdma_eth", sizeof(eth->napi_dev->name)); +- platform_set_drvdata(pdev, eth); +- +- err = airoha_hw_init(pdev, eth); +- if (err) +- goto error_hw_cleanup; +- +- for (i = 0; i < ARRAY_SIZE(eth->qdma); i++) +- airoha_qdma_start_napi(ð->qdma[i]); +- +- for_each_child_of_node(pdev->dev.of_node, np) { +- if (!of_device_is_compatible(np, "airoha,eth-mac")) +- continue; +- +- if (!of_device_is_available(np)) +- continue; +- +- err = airoha_alloc_gdm_port(eth, np); +- if (err) { +- of_node_put(np); +- goto error_napi_stop; +- } +- } +- +- return 0; +- +-error_napi_stop: +- for (i = 0; i < ARRAY_SIZE(eth->qdma); i++) +- airoha_qdma_stop_napi(ð->qdma[i]); +-error_hw_cleanup: +- for (i = 0; i < ARRAY_SIZE(eth->qdma); i++) +- airoha_hw_cleanup(ð->qdma[i]); +- +- for (i = 0; i < ARRAY_SIZE(eth->ports); i++) { +- struct airoha_gdm_port *port = eth->ports[i]; +- +- if (port && port->dev->reg_state == NETREG_REGISTERED) +- unregister_netdev(port->dev); +- } +- free_netdev(eth->napi_dev); +- platform_set_drvdata(pdev, NULL); +- +- return err; +-} +- +-static void airoha_remove(struct platform_device *pdev) +-{ +- struct airoha_eth *eth = platform_get_drvdata(pdev); +- int i; +- +- for (i = 0; i < ARRAY_SIZE(eth->qdma); i++) { +- airoha_qdma_stop_napi(ð->qdma[i]); +- airoha_hw_cleanup(ð->qdma[i]); +- } +- +- for (i = 0; i < ARRAY_SIZE(eth->ports); i++) { +- struct airoha_gdm_port *port = eth->ports[i]; +- +- if (!port) +- continue; +- +- airoha_dev_stop(port->dev); +- unregister_netdev(port->dev); +- } +- free_netdev(eth->napi_dev); +- +- platform_set_drvdata(pdev, NULL); +-} +- +-static const struct of_device_id of_airoha_match[] = { +- { .compatible = "airoha,en7581-eth" }, +- { /* sentinel */ } +-}; +-MODULE_DEVICE_TABLE(of, of_airoha_match); +- +-static struct platform_driver airoha_driver = { +- .probe = airoha_probe, +- .remove_new = airoha_remove, +- .driver = { +- .name = KBUILD_MODNAME, +- .of_match_table = of_airoha_match, +- }, +-}; +-module_platform_driver(airoha_driver); +- +-MODULE_LICENSE("GPL"); +-MODULE_AUTHOR("Lorenzo Bianconi "); +-MODULE_DESCRIPTION("Ethernet driver for Airoha SoC"); diff --git a/target/linux/airoha/patches-6.6/048-02-v6.15-net-airoha-Move-definitions-in-airoha_eth.h.patch b/target/linux/airoha/patches-6.6/048-02-v6.15-net-airoha-Move-definitions-in-airoha_eth.h.patch new file mode 100644 index 00000000000000..85391281a25934 --- /dev/null +++ b/target/linux/airoha/patches-6.6/048-02-v6.15-net-airoha-Move-definitions-in-airoha_eth.h.patch @@ -0,0 +1,538 @@ +From b38f4ff0ceacd6ce8d333a8dc90f405a040968d3 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Fri, 28 Feb 2025 11:54:10 +0100 +Subject: [PATCH 02/15] net: airoha: Move definitions in airoha_eth.h + +Move common airoha_eth definitions in airoha_eth.h in order to reuse +them for Packet Processor Engine (PPE) codebase. +PPE module is used to enable support for flowtable hw offloading in +airoha_eth driver. + +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Paolo Abeni +--- + drivers/net/ethernet/airoha/airoha_eth.c | 240 +--------------------- + drivers/net/ethernet/airoha/airoha_eth.h | 251 +++++++++++++++++++++++ + 2 files changed, 252 insertions(+), 239 deletions(-) + create mode 100644 drivers/net/ethernet/airoha/airoha_eth.h + +--- a/drivers/net/ethernet/airoha/airoha_eth.c ++++ b/drivers/net/ethernet/airoha/airoha_eth.c +@@ -3,14 +3,9 @@ + * Copyright (c) 2024 AIROHA Inc + * Author: Lorenzo Bianconi + */ +-#include +-#include +-#include +-#include + #include + #include + #include +-#include + #include + #include + #include +@@ -18,35 +13,7 @@ + #include + #include + +-#define AIROHA_MAX_NUM_GDM_PORTS 1 +-#define AIROHA_MAX_NUM_QDMA 2 +-#define AIROHA_MAX_NUM_RSTS 3 +-#define AIROHA_MAX_NUM_XSI_RSTS 5 +-#define AIROHA_MAX_MTU 2000 +-#define AIROHA_MAX_PACKET_SIZE 2048 +-#define AIROHA_NUM_QOS_CHANNELS 4 +-#define AIROHA_NUM_QOS_QUEUES 8 +-#define AIROHA_NUM_TX_RING 32 +-#define AIROHA_NUM_RX_RING 32 +-#define AIROHA_NUM_NETDEV_TX_RINGS (AIROHA_NUM_TX_RING + \ +- AIROHA_NUM_QOS_CHANNELS) +-#define AIROHA_FE_MC_MAX_VLAN_TABLE 64 +-#define AIROHA_FE_MC_MAX_VLAN_PORT 16 +-#define AIROHA_NUM_TX_IRQ 2 +-#define HW_DSCP_NUM 2048 +-#define IRQ_QUEUE_LEN(_n) ((_n) ? 1024 : 2048) +-#define TX_DSCP_NUM 1024 +-#define RX_DSCP_NUM(_n) \ +- ((_n) == 2 ? 128 : \ +- (_n) == 11 ? 128 : \ +- (_n) == 15 ? 128 : \ +- (_n) == 0 ? 1024 : 16) +- +-#define PSE_RSV_PAGES 128 +-#define PSE_QUEUE_RSV_PAGES 64 +- +-#define QDMA_METER_IDX(_n) ((_n) & 0xff) +-#define QDMA_METER_GROUP(_n) (((_n) >> 8) & 0x3) ++#include "airoha_eth.h" + + /* FE */ + #define PSE_BASE 0x0100 +@@ -706,211 +673,6 @@ struct airoha_qdma_fwd_desc { + __le32 rsv1; + }; + +-enum { +- QDMA_INT_REG_IDX0, +- QDMA_INT_REG_IDX1, +- QDMA_INT_REG_IDX2, +- QDMA_INT_REG_IDX3, +- QDMA_INT_REG_IDX4, +- QDMA_INT_REG_MAX +-}; +- +-enum { +- XSI_PCIE0_PORT, +- XSI_PCIE1_PORT, +- XSI_USB_PORT, +- XSI_AE_PORT, +- XSI_ETH_PORT, +-}; +- +-enum { +- XSI_PCIE0_VIP_PORT_MASK = BIT(22), +- XSI_PCIE1_VIP_PORT_MASK = BIT(23), +- XSI_USB_VIP_PORT_MASK = BIT(25), +- XSI_ETH_VIP_PORT_MASK = BIT(24), +-}; +- +-enum { +- DEV_STATE_INITIALIZED, +-}; +- +-enum { +- CDM_CRSN_QSEL_Q1 = 1, +- CDM_CRSN_QSEL_Q5 = 5, +- CDM_CRSN_QSEL_Q6 = 6, +- CDM_CRSN_QSEL_Q15 = 15, +-}; +- +-enum { +- CRSN_08 = 0x8, +- CRSN_21 = 0x15, /* KA */ +- CRSN_22 = 0x16, /* hit bind and force route to CPU */ +- CRSN_24 = 0x18, +- CRSN_25 = 0x19, +-}; +- +-enum { +- FE_PSE_PORT_CDM1, +- FE_PSE_PORT_GDM1, +- FE_PSE_PORT_GDM2, +- FE_PSE_PORT_GDM3, +- FE_PSE_PORT_PPE1, +- FE_PSE_PORT_CDM2, +- FE_PSE_PORT_CDM3, +- FE_PSE_PORT_CDM4, +- FE_PSE_PORT_PPE2, +- FE_PSE_PORT_GDM4, +- FE_PSE_PORT_CDM5, +- FE_PSE_PORT_DROP = 0xf, +-}; +- +-enum tx_sched_mode { +- TC_SCH_WRR8, +- TC_SCH_SP, +- TC_SCH_WRR7, +- TC_SCH_WRR6, +- TC_SCH_WRR5, +- TC_SCH_WRR4, +- TC_SCH_WRR3, +- TC_SCH_WRR2, +-}; +- +-enum trtcm_param_type { +- TRTCM_MISC_MODE, /* meter_en, pps_mode, tick_sel */ +- TRTCM_TOKEN_RATE_MODE, +- TRTCM_BUCKETSIZE_SHIFT_MODE, +- TRTCM_BUCKET_COUNTER_MODE, +-}; +- +-enum trtcm_mode_type { +- TRTCM_COMMIT_MODE, +- TRTCM_PEAK_MODE, +-}; +- +-enum trtcm_param { +- TRTCM_TICK_SEL = BIT(0), +- TRTCM_PKT_MODE = BIT(1), +- TRTCM_METER_MODE = BIT(2), +-}; +- +-#define MIN_TOKEN_SIZE 4096 +-#define MAX_TOKEN_SIZE_OFFSET 17 +-#define TRTCM_TOKEN_RATE_MASK GENMASK(23, 6) +-#define TRTCM_TOKEN_RATE_FRACTION_MASK GENMASK(5, 0) +- +-struct airoha_queue_entry { +- union { +- void *buf; +- struct sk_buff *skb; +- }; +- dma_addr_t dma_addr; +- u16 dma_len; +-}; +- +-struct airoha_queue { +- struct airoha_qdma *qdma; +- +- /* protect concurrent queue accesses */ +- spinlock_t lock; +- struct airoha_queue_entry *entry; +- struct airoha_qdma_desc *desc; +- u16 head; +- u16 tail; +- +- int queued; +- int ndesc; +- int free_thr; +- int buf_size; +- +- struct napi_struct napi; +- struct page_pool *page_pool; +-}; +- +-struct airoha_tx_irq_queue { +- struct airoha_qdma *qdma; +- +- struct napi_struct napi; +- +- int size; +- u32 *q; +-}; +- +-struct airoha_hw_stats { +- /* protect concurrent hw_stats accesses */ +- spinlock_t lock; +- struct u64_stats_sync syncp; +- +- /* get_stats64 */ +- u64 rx_ok_pkts; +- u64 tx_ok_pkts; +- u64 rx_ok_bytes; +- u64 tx_ok_bytes; +- u64 rx_multicast; +- u64 rx_errors; +- u64 rx_drops; +- u64 tx_drops; +- u64 rx_crc_error; +- u64 rx_over_errors; +- /* ethtool stats */ +- u64 tx_broadcast; +- u64 tx_multicast; +- u64 tx_len[7]; +- u64 rx_broadcast; +- u64 rx_fragment; +- u64 rx_jabber; +- u64 rx_len[7]; +-}; +- +-struct airoha_qdma { +- struct airoha_eth *eth; +- void __iomem *regs; +- +- /* protect concurrent irqmask accesses */ +- spinlock_t irq_lock; +- u32 irqmask[QDMA_INT_REG_MAX]; +- int irq; +- +- struct airoha_tx_irq_queue q_tx_irq[AIROHA_NUM_TX_IRQ]; +- +- struct airoha_queue q_tx[AIROHA_NUM_TX_RING]; +- struct airoha_queue q_rx[AIROHA_NUM_RX_RING]; +- +- /* descriptor and packet buffers for qdma hw forward */ +- struct { +- void *desc; +- void *q; +- } hfwd; +-}; +- +-struct airoha_gdm_port { +- struct airoha_qdma *qdma; +- struct net_device *dev; +- int id; +- +- struct airoha_hw_stats stats; +- +- DECLARE_BITMAP(qos_sq_bmap, AIROHA_NUM_QOS_CHANNELS); +- +- /* qos stats counters */ +- u64 cpu_tx_packets; +- u64 fwd_tx_packets; +-}; +- +-struct airoha_eth { +- struct device *dev; +- +- unsigned long state; +- void __iomem *fe_regs; +- +- struct reset_control_bulk_data rsts[AIROHA_MAX_NUM_RSTS]; +- struct reset_control_bulk_data xsi_rsts[AIROHA_MAX_NUM_XSI_RSTS]; +- +- struct net_device *napi_dev; +- +- struct airoha_qdma qdma[AIROHA_MAX_NUM_QDMA]; +- struct airoha_gdm_port *ports[AIROHA_MAX_NUM_GDM_PORTS]; +-}; +- + static u32 airoha_rr(void __iomem *base, u32 offset) + { + return readl(base + offset); +--- /dev/null ++++ b/drivers/net/ethernet/airoha/airoha_eth.h +@@ -0,0 +1,251 @@ ++/* SPDX-License-Identifier: GPL-2.0-only */ ++/* ++ * Copyright (c) 2024 AIROHA Inc ++ * Author: Lorenzo Bianconi ++ */ ++ ++#ifndef AIROHA_ETH_H ++#define AIROHA_ETH_H ++ ++#include ++#include ++#include ++#include ++#include ++ ++#define AIROHA_MAX_NUM_GDM_PORTS 1 ++#define AIROHA_MAX_NUM_QDMA 2 ++#define AIROHA_MAX_NUM_RSTS 3 ++#define AIROHA_MAX_NUM_XSI_RSTS 5 ++#define AIROHA_MAX_MTU 2000 ++#define AIROHA_MAX_PACKET_SIZE 2048 ++#define AIROHA_NUM_QOS_CHANNELS 4 ++#define AIROHA_NUM_QOS_QUEUES 8 ++#define AIROHA_NUM_TX_RING 32 ++#define AIROHA_NUM_RX_RING 32 ++#define AIROHA_NUM_NETDEV_TX_RINGS (AIROHA_NUM_TX_RING + \ ++ AIROHA_NUM_QOS_CHANNELS) ++#define AIROHA_FE_MC_MAX_VLAN_TABLE 64 ++#define AIROHA_FE_MC_MAX_VLAN_PORT 16 ++#define AIROHA_NUM_TX_IRQ 2 ++#define HW_DSCP_NUM 2048 ++#define IRQ_QUEUE_LEN(_n) ((_n) ? 1024 : 2048) ++#define TX_DSCP_NUM 1024 ++#define RX_DSCP_NUM(_n) \ ++ ((_n) == 2 ? 128 : \ ++ (_n) == 11 ? 128 : \ ++ (_n) == 15 ? 128 : \ ++ (_n) == 0 ? 1024 : 16) ++ ++#define PSE_RSV_PAGES 128 ++#define PSE_QUEUE_RSV_PAGES 64 ++ ++#define QDMA_METER_IDX(_n) ((_n) & 0xff) ++#define QDMA_METER_GROUP(_n) (((_n) >> 8) & 0x3) ++ ++enum { ++ QDMA_INT_REG_IDX0, ++ QDMA_INT_REG_IDX1, ++ QDMA_INT_REG_IDX2, ++ QDMA_INT_REG_IDX3, ++ QDMA_INT_REG_IDX4, ++ QDMA_INT_REG_MAX ++}; ++ ++enum { ++ XSI_PCIE0_PORT, ++ XSI_PCIE1_PORT, ++ XSI_USB_PORT, ++ XSI_AE_PORT, ++ XSI_ETH_PORT, ++}; ++ ++enum { ++ XSI_PCIE0_VIP_PORT_MASK = BIT(22), ++ XSI_PCIE1_VIP_PORT_MASK = BIT(23), ++ XSI_USB_VIP_PORT_MASK = BIT(25), ++ XSI_ETH_VIP_PORT_MASK = BIT(24), ++}; ++ ++enum { ++ DEV_STATE_INITIALIZED, ++}; ++ ++enum { ++ CDM_CRSN_QSEL_Q1 = 1, ++ CDM_CRSN_QSEL_Q5 = 5, ++ CDM_CRSN_QSEL_Q6 = 6, ++ CDM_CRSN_QSEL_Q15 = 15, ++}; ++ ++enum { ++ CRSN_08 = 0x8, ++ CRSN_21 = 0x15, /* KA */ ++ CRSN_22 = 0x16, /* hit bind and force route to CPU */ ++ CRSN_24 = 0x18, ++ CRSN_25 = 0x19, ++}; ++ ++enum { ++ FE_PSE_PORT_CDM1, ++ FE_PSE_PORT_GDM1, ++ FE_PSE_PORT_GDM2, ++ FE_PSE_PORT_GDM3, ++ FE_PSE_PORT_PPE1, ++ FE_PSE_PORT_CDM2, ++ FE_PSE_PORT_CDM3, ++ FE_PSE_PORT_CDM4, ++ FE_PSE_PORT_PPE2, ++ FE_PSE_PORT_GDM4, ++ FE_PSE_PORT_CDM5, ++ FE_PSE_PORT_DROP = 0xf, ++}; ++ ++enum tx_sched_mode { ++ TC_SCH_WRR8, ++ TC_SCH_SP, ++ TC_SCH_WRR7, ++ TC_SCH_WRR6, ++ TC_SCH_WRR5, ++ TC_SCH_WRR4, ++ TC_SCH_WRR3, ++ TC_SCH_WRR2, ++}; ++ ++enum trtcm_param_type { ++ TRTCM_MISC_MODE, /* meter_en, pps_mode, tick_sel */ ++ TRTCM_TOKEN_RATE_MODE, ++ TRTCM_BUCKETSIZE_SHIFT_MODE, ++ TRTCM_BUCKET_COUNTER_MODE, ++}; ++ ++enum trtcm_mode_type { ++ TRTCM_COMMIT_MODE, ++ TRTCM_PEAK_MODE, ++}; ++ ++enum trtcm_param { ++ TRTCM_TICK_SEL = BIT(0), ++ TRTCM_PKT_MODE = BIT(1), ++ TRTCM_METER_MODE = BIT(2), ++}; ++ ++#define MIN_TOKEN_SIZE 4096 ++#define MAX_TOKEN_SIZE_OFFSET 17 ++#define TRTCM_TOKEN_RATE_MASK GENMASK(23, 6) ++#define TRTCM_TOKEN_RATE_FRACTION_MASK GENMASK(5, 0) ++ ++struct airoha_queue_entry { ++ union { ++ void *buf; ++ struct sk_buff *skb; ++ }; ++ dma_addr_t dma_addr; ++ u16 dma_len; ++}; ++ ++struct airoha_queue { ++ struct airoha_qdma *qdma; ++ ++ /* protect concurrent queue accesses */ ++ spinlock_t lock; ++ struct airoha_queue_entry *entry; ++ struct airoha_qdma_desc *desc; ++ u16 head; ++ u16 tail; ++ ++ int queued; ++ int ndesc; ++ int free_thr; ++ int buf_size; ++ ++ struct napi_struct napi; ++ struct page_pool *page_pool; ++}; ++ ++struct airoha_tx_irq_queue { ++ struct airoha_qdma *qdma; ++ ++ struct napi_struct napi; ++ ++ int size; ++ u32 *q; ++}; ++ ++struct airoha_hw_stats { ++ /* protect concurrent hw_stats accesses */ ++ spinlock_t lock; ++ struct u64_stats_sync syncp; ++ ++ /* get_stats64 */ ++ u64 rx_ok_pkts; ++ u64 tx_ok_pkts; ++ u64 rx_ok_bytes; ++ u64 tx_ok_bytes; ++ u64 rx_multicast; ++ u64 rx_errors; ++ u64 rx_drops; ++ u64 tx_drops; ++ u64 rx_crc_error; ++ u64 rx_over_errors; ++ /* ethtool stats */ ++ u64 tx_broadcast; ++ u64 tx_multicast; ++ u64 tx_len[7]; ++ u64 rx_broadcast; ++ u64 rx_fragment; ++ u64 rx_jabber; ++ u64 rx_len[7]; ++}; ++ ++struct airoha_qdma { ++ struct airoha_eth *eth; ++ void __iomem *regs; ++ ++ /* protect concurrent irqmask accesses */ ++ spinlock_t irq_lock; ++ u32 irqmask[QDMA_INT_REG_MAX]; ++ int irq; ++ ++ struct airoha_tx_irq_queue q_tx_irq[AIROHA_NUM_TX_IRQ]; ++ ++ struct airoha_queue q_tx[AIROHA_NUM_TX_RING]; ++ struct airoha_queue q_rx[AIROHA_NUM_RX_RING]; ++ ++ /* descriptor and packet buffers for qdma hw forward */ ++ struct { ++ void *desc; ++ void *q; ++ } hfwd; ++}; ++ ++struct airoha_gdm_port { ++ struct airoha_qdma *qdma; ++ struct net_device *dev; ++ int id; ++ ++ struct airoha_hw_stats stats; ++ ++ DECLARE_BITMAP(qos_sq_bmap, AIROHA_NUM_QOS_CHANNELS); ++ ++ /* qos stats counters */ ++ u64 cpu_tx_packets; ++ u64 fwd_tx_packets; ++}; ++ ++struct airoha_eth { ++ struct device *dev; ++ ++ unsigned long state; ++ void __iomem *fe_regs; ++ ++ struct reset_control_bulk_data rsts[AIROHA_MAX_NUM_RSTS]; ++ struct reset_control_bulk_data xsi_rsts[AIROHA_MAX_NUM_XSI_RSTS]; ++ ++ struct net_device *napi_dev; ++ ++ struct airoha_qdma qdma[AIROHA_MAX_NUM_QDMA]; ++ struct airoha_gdm_port *ports[AIROHA_MAX_NUM_GDM_PORTS]; ++}; ++ ++#endif /* AIROHA_ETH_H */ diff --git a/target/linux/airoha/patches-6.6/048-03-v6.15-net-airoha-Move-reg-write-utility-routines-in-airoha.patch b/target/linux/airoha/patches-6.6/048-03-v6.15-net-airoha-Move-reg-write-utility-routines-in-airoha.patch new file mode 100644 index 00000000000000..bf24638ec91fb9 --- /dev/null +++ b/target/linux/airoha/patches-6.6/048-03-v6.15-net-airoha-Move-reg-write-utility-routines-in-airoha.patch @@ -0,0 +1,101 @@ +From e0758a8694fbaffdc72940774db295585e951119 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Fri, 28 Feb 2025 11:54:11 +0100 +Subject: [PATCH 03/15] net: airoha: Move reg/write utility routines in + airoha_eth.h + +This is a preliminary patch to introduce flowtable hw offloading +support for airoha_eth driver. + +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Paolo Abeni +--- + drivers/net/ethernet/airoha/airoha_eth.c | 28 +++--------------------- + drivers/net/ethernet/airoha/airoha_eth.h | 26 ++++++++++++++++++++++ + 2 files changed, 29 insertions(+), 25 deletions(-) + +--- a/drivers/net/ethernet/airoha/airoha_eth.c ++++ b/drivers/net/ethernet/airoha/airoha_eth.c +@@ -673,17 +673,17 @@ struct airoha_qdma_fwd_desc { + __le32 rsv1; + }; + +-static u32 airoha_rr(void __iomem *base, u32 offset) ++u32 airoha_rr(void __iomem *base, u32 offset) + { + return readl(base + offset); + } + +-static void airoha_wr(void __iomem *base, u32 offset, u32 val) ++void airoha_wr(void __iomem *base, u32 offset, u32 val) + { + writel(val, base + offset); + } + +-static u32 airoha_rmw(void __iomem *base, u32 offset, u32 mask, u32 val) ++u32 airoha_rmw(void __iomem *base, u32 offset, u32 mask, u32 val) + { + val |= (airoha_rr(base, offset) & ~mask); + airoha_wr(base, offset, val); +@@ -691,28 +691,6 @@ static u32 airoha_rmw(void __iomem *base + return val; + } + +-#define airoha_fe_rr(eth, offset) \ +- airoha_rr((eth)->fe_regs, (offset)) +-#define airoha_fe_wr(eth, offset, val) \ +- airoha_wr((eth)->fe_regs, (offset), (val)) +-#define airoha_fe_rmw(eth, offset, mask, val) \ +- airoha_rmw((eth)->fe_regs, (offset), (mask), (val)) +-#define airoha_fe_set(eth, offset, val) \ +- airoha_rmw((eth)->fe_regs, (offset), 0, (val)) +-#define airoha_fe_clear(eth, offset, val) \ +- airoha_rmw((eth)->fe_regs, (offset), (val), 0) +- +-#define airoha_qdma_rr(qdma, offset) \ +- airoha_rr((qdma)->regs, (offset)) +-#define airoha_qdma_wr(qdma, offset, val) \ +- airoha_wr((qdma)->regs, (offset), (val)) +-#define airoha_qdma_rmw(qdma, offset, mask, val) \ +- airoha_rmw((qdma)->regs, (offset), (mask), (val)) +-#define airoha_qdma_set(qdma, offset, val) \ +- airoha_rmw((qdma)->regs, (offset), 0, (val)) +-#define airoha_qdma_clear(qdma, offset, val) \ +- airoha_rmw((qdma)->regs, (offset), (val), 0) +- + static void airoha_qdma_set_irqmask(struct airoha_qdma *qdma, int index, + u32 clear, u32 set) + { +--- a/drivers/net/ethernet/airoha/airoha_eth.h ++++ b/drivers/net/ethernet/airoha/airoha_eth.h +@@ -248,4 +248,30 @@ struct airoha_eth { + struct airoha_gdm_port *ports[AIROHA_MAX_NUM_GDM_PORTS]; + }; + ++u32 airoha_rr(void __iomem *base, u32 offset); ++void airoha_wr(void __iomem *base, u32 offset, u32 val); ++u32 airoha_rmw(void __iomem *base, u32 offset, u32 mask, u32 val); ++ ++#define airoha_fe_rr(eth, offset) \ ++ airoha_rr((eth)->fe_regs, (offset)) ++#define airoha_fe_wr(eth, offset, val) \ ++ airoha_wr((eth)->fe_regs, (offset), (val)) ++#define airoha_fe_rmw(eth, offset, mask, val) \ ++ airoha_rmw((eth)->fe_regs, (offset), (mask), (val)) ++#define airoha_fe_set(eth, offset, val) \ ++ airoha_rmw((eth)->fe_regs, (offset), 0, (val)) ++#define airoha_fe_clear(eth, offset, val) \ ++ airoha_rmw((eth)->fe_regs, (offset), (val), 0) ++ ++#define airoha_qdma_rr(qdma, offset) \ ++ airoha_rr((qdma)->regs, (offset)) ++#define airoha_qdma_wr(qdma, offset, val) \ ++ airoha_wr((qdma)->regs, (offset), (val)) ++#define airoha_qdma_rmw(qdma, offset, mask, val) \ ++ airoha_rmw((qdma)->regs, (offset), (mask), (val)) ++#define airoha_qdma_set(qdma, offset, val) \ ++ airoha_rmw((qdma)->regs, (offset), 0, (val)) ++#define airoha_qdma_clear(qdma, offset, val) \ ++ airoha_rmw((qdma)->regs, (offset), (val), 0) ++ + #endif /* AIROHA_ETH_H */ diff --git a/target/linux/airoha/patches-6.6/048-04-v6.15-net-airoha-Move-register-definitions-in-airoha_regs..patch b/target/linux/airoha/patches-6.6/048-04-v6.15-net-airoha-Move-register-definitions-in-airoha_regs..patch new file mode 100644 index 00000000000000..3b2b8bfe5dcfdd --- /dev/null +++ b/target/linux/airoha/patches-6.6/048-04-v6.15-net-airoha-Move-register-definitions-in-airoha_regs..patch @@ -0,0 +1,1361 @@ +From ec663d9a82bf4d16721f6b1fc29df4892ba6c088 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Fri, 28 Feb 2025 11:54:12 +0100 +Subject: [PATCH 04/15] net: airoha: Move register definitions in airoha_regs.h + +Move common airoha_eth register definitions in airoha_regs.h in order +to reuse them for Packet Processor Engine (PPE) codebase. +PPE module is used to enable support for flowtable hw offloading in +airoha_eth driver. + +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Paolo Abeni +--- + drivers/net/ethernet/airoha/airoha_eth.c | 659 +-------------------- + drivers/net/ethernet/airoha/airoha_regs.h | 670 ++++++++++++++++++++++ + 2 files changed, 671 insertions(+), 658 deletions(-) + create mode 100644 drivers/net/ethernet/airoha/airoha_regs.h + +--- a/drivers/net/ethernet/airoha/airoha_eth.c ++++ b/drivers/net/ethernet/airoha/airoha_eth.c +@@ -13,666 +13,9 @@ + #include + #include + ++#include "airoha_regs.h" + #include "airoha_eth.h" + +-/* FE */ +-#define PSE_BASE 0x0100 +-#define CSR_IFC_BASE 0x0200 +-#define CDM1_BASE 0x0400 +-#define GDM1_BASE 0x0500 +-#define PPE1_BASE 0x0c00 +- +-#define CDM2_BASE 0x1400 +-#define GDM2_BASE 0x1500 +- +-#define GDM3_BASE 0x1100 +-#define GDM4_BASE 0x2500 +- +-#define GDM_BASE(_n) \ +- ((_n) == 4 ? GDM4_BASE : \ +- (_n) == 3 ? GDM3_BASE : \ +- (_n) == 2 ? GDM2_BASE : GDM1_BASE) +- +-#define REG_FE_DMA_GLO_CFG 0x0000 +-#define FE_DMA_GLO_L2_SPACE_MASK GENMASK(7, 4) +-#define FE_DMA_GLO_PG_SZ_MASK BIT(3) +- +-#define REG_FE_RST_GLO_CFG 0x0004 +-#define FE_RST_GDM4_MBI_ARB_MASK BIT(3) +-#define FE_RST_GDM3_MBI_ARB_MASK BIT(2) +-#define FE_RST_CORE_MASK BIT(0) +- +-#define REG_FE_WAN_MAC_H 0x0030 +-#define REG_FE_LAN_MAC_H 0x0040 +- +-#define REG_FE_MAC_LMIN(_n) ((_n) + 0x04) +-#define REG_FE_MAC_LMAX(_n) ((_n) + 0x08) +- +-#define REG_FE_CDM1_OQ_MAP0 0x0050 +-#define REG_FE_CDM1_OQ_MAP1 0x0054 +-#define REG_FE_CDM1_OQ_MAP2 0x0058 +-#define REG_FE_CDM1_OQ_MAP3 0x005c +- +-#define REG_FE_PCE_CFG 0x0070 +-#define PCE_DPI_EN_MASK BIT(2) +-#define PCE_KA_EN_MASK BIT(1) +-#define PCE_MC_EN_MASK BIT(0) +- +-#define REG_FE_PSE_QUEUE_CFG_WR 0x0080 +-#define PSE_CFG_PORT_ID_MASK GENMASK(27, 24) +-#define PSE_CFG_QUEUE_ID_MASK GENMASK(20, 16) +-#define PSE_CFG_WR_EN_MASK BIT(8) +-#define PSE_CFG_OQRSV_SEL_MASK BIT(0) +- +-#define REG_FE_PSE_QUEUE_CFG_VAL 0x0084 +-#define PSE_CFG_OQ_RSV_MASK GENMASK(13, 0) +- +-#define PSE_FQ_CFG 0x008c +-#define PSE_FQ_LIMIT_MASK GENMASK(14, 0) +- +-#define REG_FE_PSE_BUF_SET 0x0090 +-#define PSE_SHARE_USED_LTHD_MASK GENMASK(31, 16) +-#define PSE_ALLRSV_MASK GENMASK(14, 0) +- +-#define REG_PSE_SHARE_USED_THD 0x0094 +-#define PSE_SHARE_USED_MTHD_MASK GENMASK(31, 16) +-#define PSE_SHARE_USED_HTHD_MASK GENMASK(15, 0) +- +-#define REG_GDM_MISC_CFG 0x0148 +-#define GDM2_RDM_ACK_WAIT_PREF_MASK BIT(9) +-#define GDM2_CHN_VLD_MODE_MASK BIT(5) +- +-#define REG_FE_CSR_IFC_CFG CSR_IFC_BASE +-#define FE_IFC_EN_MASK BIT(0) +- +-#define REG_FE_VIP_PORT_EN 0x01f0 +-#define REG_FE_IFC_PORT_EN 0x01f4 +- +-#define REG_PSE_IQ_REV1 (PSE_BASE + 0x08) +-#define PSE_IQ_RES1_P2_MASK GENMASK(23, 16) +- +-#define REG_PSE_IQ_REV2 (PSE_BASE + 0x0c) +-#define PSE_IQ_RES2_P5_MASK GENMASK(15, 8) +-#define PSE_IQ_RES2_P4_MASK GENMASK(7, 0) +- +-#define REG_FE_VIP_EN(_n) (0x0300 + ((_n) << 3)) +-#define PATN_FCPU_EN_MASK BIT(7) +-#define PATN_SWP_EN_MASK BIT(6) +-#define PATN_DP_EN_MASK BIT(5) +-#define PATN_SP_EN_MASK BIT(4) +-#define PATN_TYPE_MASK GENMASK(3, 1) +-#define PATN_EN_MASK BIT(0) +- +-#define REG_FE_VIP_PATN(_n) (0x0304 + ((_n) << 3)) +-#define PATN_DP_MASK GENMASK(31, 16) +-#define PATN_SP_MASK GENMASK(15, 0) +- +-#define REG_CDM1_VLAN_CTRL CDM1_BASE +-#define CDM1_VLAN_MASK GENMASK(31, 16) +- +-#define REG_CDM1_FWD_CFG (CDM1_BASE + 0x08) +-#define CDM1_VIP_QSEL_MASK GENMASK(24, 20) +- +-#define REG_CDM1_CRSN_QSEL(_n) (CDM1_BASE + 0x10 + ((_n) << 2)) +-#define CDM1_CRSN_QSEL_REASON_MASK(_n) \ +- GENMASK(4 + (((_n) % 4) << 3), (((_n) % 4) << 3)) +- +-#define REG_CDM2_FWD_CFG (CDM2_BASE + 0x08) +-#define CDM2_OAM_QSEL_MASK GENMASK(31, 27) +-#define CDM2_VIP_QSEL_MASK GENMASK(24, 20) +- +-#define REG_CDM2_CRSN_QSEL(_n) (CDM2_BASE + 0x10 + ((_n) << 2)) +-#define CDM2_CRSN_QSEL_REASON_MASK(_n) \ +- GENMASK(4 + (((_n) % 4) << 3), (((_n) % 4) << 3)) +- +-#define REG_GDM_FWD_CFG(_n) GDM_BASE(_n) +-#define GDM_DROP_CRC_ERR BIT(23) +-#define GDM_IP4_CKSUM BIT(22) +-#define GDM_TCP_CKSUM BIT(21) +-#define GDM_UDP_CKSUM BIT(20) +-#define GDM_UCFQ_MASK GENMASK(15, 12) +-#define GDM_BCFQ_MASK GENMASK(11, 8) +-#define GDM_MCFQ_MASK GENMASK(7, 4) +-#define GDM_OCFQ_MASK GENMASK(3, 0) +- +-#define REG_GDM_INGRESS_CFG(_n) (GDM_BASE(_n) + 0x10) +-#define GDM_INGRESS_FC_EN_MASK BIT(1) +-#define GDM_STAG_EN_MASK BIT(0) +- +-#define REG_GDM_LEN_CFG(_n) (GDM_BASE(_n) + 0x14) +-#define GDM_SHORT_LEN_MASK GENMASK(13, 0) +-#define GDM_LONG_LEN_MASK GENMASK(29, 16) +- +-#define REG_FE_CPORT_CFG (GDM1_BASE + 0x40) +-#define FE_CPORT_PAD BIT(26) +-#define FE_CPORT_PORT_XFC_MASK BIT(25) +-#define FE_CPORT_QUEUE_XFC_MASK BIT(24) +- +-#define REG_FE_GDM_MIB_CLEAR(_n) (GDM_BASE(_n) + 0xf0) +-#define FE_GDM_MIB_RX_CLEAR_MASK BIT(1) +-#define FE_GDM_MIB_TX_CLEAR_MASK BIT(0) +- +-#define REG_FE_GDM1_MIB_CFG (GDM1_BASE + 0xf4) +-#define FE_STRICT_RFC2819_MODE_MASK BIT(31) +-#define FE_GDM1_TX_MIB_SPLIT_EN_MASK BIT(17) +-#define FE_GDM1_RX_MIB_SPLIT_EN_MASK BIT(16) +-#define FE_TX_MIB_ID_MASK GENMASK(15, 8) +-#define FE_RX_MIB_ID_MASK GENMASK(7, 0) +- +-#define REG_FE_GDM_TX_OK_PKT_CNT_L(_n) (GDM_BASE(_n) + 0x104) +-#define REG_FE_GDM_TX_OK_BYTE_CNT_L(_n) (GDM_BASE(_n) + 0x10c) +-#define REG_FE_GDM_TX_ETH_PKT_CNT_L(_n) (GDM_BASE(_n) + 0x110) +-#define REG_FE_GDM_TX_ETH_BYTE_CNT_L(_n) (GDM_BASE(_n) + 0x114) +-#define REG_FE_GDM_TX_ETH_DROP_CNT(_n) (GDM_BASE(_n) + 0x118) +-#define REG_FE_GDM_TX_ETH_BC_CNT(_n) (GDM_BASE(_n) + 0x11c) +-#define REG_FE_GDM_TX_ETH_MC_CNT(_n) (GDM_BASE(_n) + 0x120) +-#define REG_FE_GDM_TX_ETH_RUNT_CNT(_n) (GDM_BASE(_n) + 0x124) +-#define REG_FE_GDM_TX_ETH_LONG_CNT(_n) (GDM_BASE(_n) + 0x128) +-#define REG_FE_GDM_TX_ETH_E64_CNT_L(_n) (GDM_BASE(_n) + 0x12c) +-#define REG_FE_GDM_TX_ETH_L64_CNT_L(_n) (GDM_BASE(_n) + 0x130) +-#define REG_FE_GDM_TX_ETH_L127_CNT_L(_n) (GDM_BASE(_n) + 0x134) +-#define REG_FE_GDM_TX_ETH_L255_CNT_L(_n) (GDM_BASE(_n) + 0x138) +-#define REG_FE_GDM_TX_ETH_L511_CNT_L(_n) (GDM_BASE(_n) + 0x13c) +-#define REG_FE_GDM_TX_ETH_L1023_CNT_L(_n) (GDM_BASE(_n) + 0x140) +- +-#define REG_FE_GDM_RX_OK_PKT_CNT_L(_n) (GDM_BASE(_n) + 0x148) +-#define REG_FE_GDM_RX_FC_DROP_CNT(_n) (GDM_BASE(_n) + 0x14c) +-#define REG_FE_GDM_RX_RC_DROP_CNT(_n) (GDM_BASE(_n) + 0x150) +-#define REG_FE_GDM_RX_OVERFLOW_DROP_CNT(_n) (GDM_BASE(_n) + 0x154) +-#define REG_FE_GDM_RX_ERROR_DROP_CNT(_n) (GDM_BASE(_n) + 0x158) +-#define REG_FE_GDM_RX_OK_BYTE_CNT_L(_n) (GDM_BASE(_n) + 0x15c) +-#define REG_FE_GDM_RX_ETH_PKT_CNT_L(_n) (GDM_BASE(_n) + 0x160) +-#define REG_FE_GDM_RX_ETH_BYTE_CNT_L(_n) (GDM_BASE(_n) + 0x164) +-#define REG_FE_GDM_RX_ETH_DROP_CNT(_n) (GDM_BASE(_n) + 0x168) +-#define REG_FE_GDM_RX_ETH_BC_CNT(_n) (GDM_BASE(_n) + 0x16c) +-#define REG_FE_GDM_RX_ETH_MC_CNT(_n) (GDM_BASE(_n) + 0x170) +-#define REG_FE_GDM_RX_ETH_CRC_ERR_CNT(_n) (GDM_BASE(_n) + 0x174) +-#define REG_FE_GDM_RX_ETH_FRAG_CNT(_n) (GDM_BASE(_n) + 0x178) +-#define REG_FE_GDM_RX_ETH_JABBER_CNT(_n) (GDM_BASE(_n) + 0x17c) +-#define REG_FE_GDM_RX_ETH_RUNT_CNT(_n) (GDM_BASE(_n) + 0x180) +-#define REG_FE_GDM_RX_ETH_LONG_CNT(_n) (GDM_BASE(_n) + 0x184) +-#define REG_FE_GDM_RX_ETH_E64_CNT_L(_n) (GDM_BASE(_n) + 0x188) +-#define REG_FE_GDM_RX_ETH_L64_CNT_L(_n) (GDM_BASE(_n) + 0x18c) +-#define REG_FE_GDM_RX_ETH_L127_CNT_L(_n) (GDM_BASE(_n) + 0x190) +-#define REG_FE_GDM_RX_ETH_L255_CNT_L(_n) (GDM_BASE(_n) + 0x194) +-#define REG_FE_GDM_RX_ETH_L511_CNT_L(_n) (GDM_BASE(_n) + 0x198) +-#define REG_FE_GDM_RX_ETH_L1023_CNT_L(_n) (GDM_BASE(_n) + 0x19c) +- +-#define REG_PPE1_TB_HASH_CFG (PPE1_BASE + 0x250) +-#define PPE1_SRAM_TABLE_EN_MASK BIT(0) +-#define PPE1_SRAM_HASH1_EN_MASK BIT(8) +-#define PPE1_DRAM_TABLE_EN_MASK BIT(16) +-#define PPE1_DRAM_HASH1_EN_MASK BIT(24) +- +-#define REG_FE_GDM_TX_OK_PKT_CNT_H(_n) (GDM_BASE(_n) + 0x280) +-#define REG_FE_GDM_TX_OK_BYTE_CNT_H(_n) (GDM_BASE(_n) + 0x284) +-#define REG_FE_GDM_TX_ETH_PKT_CNT_H(_n) (GDM_BASE(_n) + 0x288) +-#define REG_FE_GDM_TX_ETH_BYTE_CNT_H(_n) (GDM_BASE(_n) + 0x28c) +- +-#define REG_FE_GDM_RX_OK_PKT_CNT_H(_n) (GDM_BASE(_n) + 0x290) +-#define REG_FE_GDM_RX_OK_BYTE_CNT_H(_n) (GDM_BASE(_n) + 0x294) +-#define REG_FE_GDM_RX_ETH_PKT_CNT_H(_n) (GDM_BASE(_n) + 0x298) +-#define REG_FE_GDM_RX_ETH_BYTE_CNT_H(_n) (GDM_BASE(_n) + 0x29c) +-#define REG_FE_GDM_TX_ETH_E64_CNT_H(_n) (GDM_BASE(_n) + 0x2b8) +-#define REG_FE_GDM_TX_ETH_L64_CNT_H(_n) (GDM_BASE(_n) + 0x2bc) +-#define REG_FE_GDM_TX_ETH_L127_CNT_H(_n) (GDM_BASE(_n) + 0x2c0) +-#define REG_FE_GDM_TX_ETH_L255_CNT_H(_n) (GDM_BASE(_n) + 0x2c4) +-#define REG_FE_GDM_TX_ETH_L511_CNT_H(_n) (GDM_BASE(_n) + 0x2c8) +-#define REG_FE_GDM_TX_ETH_L1023_CNT_H(_n) (GDM_BASE(_n) + 0x2cc) +-#define REG_FE_GDM_RX_ETH_E64_CNT_H(_n) (GDM_BASE(_n) + 0x2e8) +-#define REG_FE_GDM_RX_ETH_L64_CNT_H(_n) (GDM_BASE(_n) + 0x2ec) +-#define REG_FE_GDM_RX_ETH_L127_CNT_H(_n) (GDM_BASE(_n) + 0x2f0) +-#define REG_FE_GDM_RX_ETH_L255_CNT_H(_n) (GDM_BASE(_n) + 0x2f4) +-#define REG_FE_GDM_RX_ETH_L511_CNT_H(_n) (GDM_BASE(_n) + 0x2f8) +-#define REG_FE_GDM_RX_ETH_L1023_CNT_H(_n) (GDM_BASE(_n) + 0x2fc) +- +-#define REG_GDM2_CHN_RLS (GDM2_BASE + 0x20) +-#define MBI_RX_AGE_SEL_MASK GENMASK(26, 25) +-#define MBI_TX_AGE_SEL_MASK GENMASK(18, 17) +- +-#define REG_GDM3_FWD_CFG GDM3_BASE +-#define GDM3_PAD_EN_MASK BIT(28) +- +-#define REG_GDM4_FWD_CFG GDM4_BASE +-#define GDM4_PAD_EN_MASK BIT(28) +-#define GDM4_SPORT_OFFSET0_MASK GENMASK(11, 8) +- +-#define REG_GDM4_SRC_PORT_SET (GDM4_BASE + 0x23c) +-#define GDM4_SPORT_OFF2_MASK GENMASK(19, 16) +-#define GDM4_SPORT_OFF1_MASK GENMASK(15, 12) +-#define GDM4_SPORT_OFF0_MASK GENMASK(11, 8) +- +-#define REG_IP_FRAG_FP 0x2010 +-#define IP_ASSEMBLE_PORT_MASK GENMASK(24, 21) +-#define IP_ASSEMBLE_NBQ_MASK GENMASK(20, 16) +-#define IP_FRAGMENT_PORT_MASK GENMASK(8, 5) +-#define IP_FRAGMENT_NBQ_MASK GENMASK(4, 0) +- +-#define REG_MC_VLAN_EN 0x2100 +-#define MC_VLAN_EN_MASK BIT(0) +- +-#define REG_MC_VLAN_CFG 0x2104 +-#define MC_VLAN_CFG_CMD_DONE_MASK BIT(31) +-#define MC_VLAN_CFG_TABLE_ID_MASK GENMASK(21, 16) +-#define MC_VLAN_CFG_PORT_ID_MASK GENMASK(11, 8) +-#define MC_VLAN_CFG_TABLE_SEL_MASK BIT(4) +-#define MC_VLAN_CFG_RW_MASK BIT(0) +- +-#define REG_MC_VLAN_DATA 0x2108 +- +-#define REG_CDM5_RX_OQ1_DROP_CNT 0x29d4 +- +-/* QDMA */ +-#define REG_QDMA_GLOBAL_CFG 0x0004 +-#define GLOBAL_CFG_RX_2B_OFFSET_MASK BIT(31) +-#define GLOBAL_CFG_DMA_PREFERENCE_MASK GENMASK(30, 29) +-#define GLOBAL_CFG_CPU_TXR_RR_MASK BIT(28) +-#define GLOBAL_CFG_DSCP_BYTE_SWAP_MASK BIT(27) +-#define GLOBAL_CFG_PAYLOAD_BYTE_SWAP_MASK BIT(26) +-#define GLOBAL_CFG_MULTICAST_MODIFY_FP_MASK BIT(25) +-#define GLOBAL_CFG_OAM_MODIFY_MASK BIT(24) +-#define GLOBAL_CFG_RESET_MASK BIT(23) +-#define GLOBAL_CFG_RESET_DONE_MASK BIT(22) +-#define GLOBAL_CFG_MULTICAST_EN_MASK BIT(21) +-#define GLOBAL_CFG_IRQ1_EN_MASK BIT(20) +-#define GLOBAL_CFG_IRQ0_EN_MASK BIT(19) +-#define GLOBAL_CFG_LOOPCNT_EN_MASK BIT(18) +-#define GLOBAL_CFG_RD_BYPASS_WR_MASK BIT(17) +-#define GLOBAL_CFG_QDMA_LOOPBACK_MASK BIT(16) +-#define GLOBAL_CFG_LPBK_RXQ_SEL_MASK GENMASK(13, 8) +-#define GLOBAL_CFG_CHECK_DONE_MASK BIT(7) +-#define GLOBAL_CFG_TX_WB_DONE_MASK BIT(6) +-#define GLOBAL_CFG_MAX_ISSUE_NUM_MASK GENMASK(5, 4) +-#define GLOBAL_CFG_RX_DMA_BUSY_MASK BIT(3) +-#define GLOBAL_CFG_RX_DMA_EN_MASK BIT(2) +-#define GLOBAL_CFG_TX_DMA_BUSY_MASK BIT(1) +-#define GLOBAL_CFG_TX_DMA_EN_MASK BIT(0) +- +-#define REG_FWD_DSCP_BASE 0x0010 +-#define REG_FWD_BUF_BASE 0x0014 +- +-#define REG_HW_FWD_DSCP_CFG 0x0018 +-#define HW_FWD_DSCP_PAYLOAD_SIZE_MASK GENMASK(29, 28) +-#define HW_FWD_DSCP_SCATTER_LEN_MASK GENMASK(17, 16) +-#define HW_FWD_DSCP_MIN_SCATTER_LEN_MASK GENMASK(15, 0) +- +-#define REG_INT_STATUS(_n) \ +- (((_n) == 4) ? 0x0730 : \ +- ((_n) == 3) ? 0x0724 : \ +- ((_n) == 2) ? 0x0720 : \ +- ((_n) == 1) ? 0x0024 : 0x0020) +- +-#define REG_INT_ENABLE(_n) \ +- (((_n) == 4) ? 0x0750 : \ +- ((_n) == 3) ? 0x0744 : \ +- ((_n) == 2) ? 0x0740 : \ +- ((_n) == 1) ? 0x002c : 0x0028) +- +-/* QDMA_CSR_INT_ENABLE1 */ +-#define RX15_COHERENT_INT_MASK BIT(31) +-#define RX14_COHERENT_INT_MASK BIT(30) +-#define RX13_COHERENT_INT_MASK BIT(29) +-#define RX12_COHERENT_INT_MASK BIT(28) +-#define RX11_COHERENT_INT_MASK BIT(27) +-#define RX10_COHERENT_INT_MASK BIT(26) +-#define RX9_COHERENT_INT_MASK BIT(25) +-#define RX8_COHERENT_INT_MASK BIT(24) +-#define RX7_COHERENT_INT_MASK BIT(23) +-#define RX6_COHERENT_INT_MASK BIT(22) +-#define RX5_COHERENT_INT_MASK BIT(21) +-#define RX4_COHERENT_INT_MASK BIT(20) +-#define RX3_COHERENT_INT_MASK BIT(19) +-#define RX2_COHERENT_INT_MASK BIT(18) +-#define RX1_COHERENT_INT_MASK BIT(17) +-#define RX0_COHERENT_INT_MASK BIT(16) +-#define TX7_COHERENT_INT_MASK BIT(15) +-#define TX6_COHERENT_INT_MASK BIT(14) +-#define TX5_COHERENT_INT_MASK BIT(13) +-#define TX4_COHERENT_INT_MASK BIT(12) +-#define TX3_COHERENT_INT_MASK BIT(11) +-#define TX2_COHERENT_INT_MASK BIT(10) +-#define TX1_COHERENT_INT_MASK BIT(9) +-#define TX0_COHERENT_INT_MASK BIT(8) +-#define CNT_OVER_FLOW_INT_MASK BIT(7) +-#define IRQ1_FULL_INT_MASK BIT(5) +-#define IRQ1_INT_MASK BIT(4) +-#define HWFWD_DSCP_LOW_INT_MASK BIT(3) +-#define HWFWD_DSCP_EMPTY_INT_MASK BIT(2) +-#define IRQ0_FULL_INT_MASK BIT(1) +-#define IRQ0_INT_MASK BIT(0) +- +-#define TX_DONE_INT_MASK(_n) \ +- ((_n) ? IRQ1_INT_MASK | IRQ1_FULL_INT_MASK \ +- : IRQ0_INT_MASK | IRQ0_FULL_INT_MASK) +- +-#define INT_TX_MASK \ +- (IRQ1_INT_MASK | IRQ1_FULL_INT_MASK | \ +- IRQ0_INT_MASK | IRQ0_FULL_INT_MASK) +- +-#define INT_IDX0_MASK \ +- (TX0_COHERENT_INT_MASK | TX1_COHERENT_INT_MASK | \ +- TX2_COHERENT_INT_MASK | TX3_COHERENT_INT_MASK | \ +- TX4_COHERENT_INT_MASK | TX5_COHERENT_INT_MASK | \ +- TX6_COHERENT_INT_MASK | TX7_COHERENT_INT_MASK | \ +- RX0_COHERENT_INT_MASK | RX1_COHERENT_INT_MASK | \ +- RX2_COHERENT_INT_MASK | RX3_COHERENT_INT_MASK | \ +- RX4_COHERENT_INT_MASK | RX7_COHERENT_INT_MASK | \ +- RX8_COHERENT_INT_MASK | RX9_COHERENT_INT_MASK | \ +- RX15_COHERENT_INT_MASK | INT_TX_MASK) +- +-/* QDMA_CSR_INT_ENABLE2 */ +-#define RX15_NO_CPU_DSCP_INT_MASK BIT(31) +-#define RX14_NO_CPU_DSCP_INT_MASK BIT(30) +-#define RX13_NO_CPU_DSCP_INT_MASK BIT(29) +-#define RX12_NO_CPU_DSCP_INT_MASK BIT(28) +-#define RX11_NO_CPU_DSCP_INT_MASK BIT(27) +-#define RX10_NO_CPU_DSCP_INT_MASK BIT(26) +-#define RX9_NO_CPU_DSCP_INT_MASK BIT(25) +-#define RX8_NO_CPU_DSCP_INT_MASK BIT(24) +-#define RX7_NO_CPU_DSCP_INT_MASK BIT(23) +-#define RX6_NO_CPU_DSCP_INT_MASK BIT(22) +-#define RX5_NO_CPU_DSCP_INT_MASK BIT(21) +-#define RX4_NO_CPU_DSCP_INT_MASK BIT(20) +-#define RX3_NO_CPU_DSCP_INT_MASK BIT(19) +-#define RX2_NO_CPU_DSCP_INT_MASK BIT(18) +-#define RX1_NO_CPU_DSCP_INT_MASK BIT(17) +-#define RX0_NO_CPU_DSCP_INT_MASK BIT(16) +-#define RX15_DONE_INT_MASK BIT(15) +-#define RX14_DONE_INT_MASK BIT(14) +-#define RX13_DONE_INT_MASK BIT(13) +-#define RX12_DONE_INT_MASK BIT(12) +-#define RX11_DONE_INT_MASK BIT(11) +-#define RX10_DONE_INT_MASK BIT(10) +-#define RX9_DONE_INT_MASK BIT(9) +-#define RX8_DONE_INT_MASK BIT(8) +-#define RX7_DONE_INT_MASK BIT(7) +-#define RX6_DONE_INT_MASK BIT(6) +-#define RX5_DONE_INT_MASK BIT(5) +-#define RX4_DONE_INT_MASK BIT(4) +-#define RX3_DONE_INT_MASK BIT(3) +-#define RX2_DONE_INT_MASK BIT(2) +-#define RX1_DONE_INT_MASK BIT(1) +-#define RX0_DONE_INT_MASK BIT(0) +- +-#define RX_DONE_INT_MASK \ +- (RX0_DONE_INT_MASK | RX1_DONE_INT_MASK | \ +- RX2_DONE_INT_MASK | RX3_DONE_INT_MASK | \ +- RX4_DONE_INT_MASK | RX7_DONE_INT_MASK | \ +- RX8_DONE_INT_MASK | RX9_DONE_INT_MASK | \ +- RX15_DONE_INT_MASK) +-#define INT_IDX1_MASK \ +- (RX_DONE_INT_MASK | \ +- RX0_NO_CPU_DSCP_INT_MASK | RX1_NO_CPU_DSCP_INT_MASK | \ +- RX2_NO_CPU_DSCP_INT_MASK | RX3_NO_CPU_DSCP_INT_MASK | \ +- RX4_NO_CPU_DSCP_INT_MASK | RX7_NO_CPU_DSCP_INT_MASK | \ +- RX8_NO_CPU_DSCP_INT_MASK | RX9_NO_CPU_DSCP_INT_MASK | \ +- RX15_NO_CPU_DSCP_INT_MASK) +- +-/* QDMA_CSR_INT_ENABLE5 */ +-#define TX31_COHERENT_INT_MASK BIT(31) +-#define TX30_COHERENT_INT_MASK BIT(30) +-#define TX29_COHERENT_INT_MASK BIT(29) +-#define TX28_COHERENT_INT_MASK BIT(28) +-#define TX27_COHERENT_INT_MASK BIT(27) +-#define TX26_COHERENT_INT_MASK BIT(26) +-#define TX25_COHERENT_INT_MASK BIT(25) +-#define TX24_COHERENT_INT_MASK BIT(24) +-#define TX23_COHERENT_INT_MASK BIT(23) +-#define TX22_COHERENT_INT_MASK BIT(22) +-#define TX21_COHERENT_INT_MASK BIT(21) +-#define TX20_COHERENT_INT_MASK BIT(20) +-#define TX19_COHERENT_INT_MASK BIT(19) +-#define TX18_COHERENT_INT_MASK BIT(18) +-#define TX17_COHERENT_INT_MASK BIT(17) +-#define TX16_COHERENT_INT_MASK BIT(16) +-#define TX15_COHERENT_INT_MASK BIT(15) +-#define TX14_COHERENT_INT_MASK BIT(14) +-#define TX13_COHERENT_INT_MASK BIT(13) +-#define TX12_COHERENT_INT_MASK BIT(12) +-#define TX11_COHERENT_INT_MASK BIT(11) +-#define TX10_COHERENT_INT_MASK BIT(10) +-#define TX9_COHERENT_INT_MASK BIT(9) +-#define TX8_COHERENT_INT_MASK BIT(8) +- +-#define INT_IDX4_MASK \ +- (TX8_COHERENT_INT_MASK | TX9_COHERENT_INT_MASK | \ +- TX10_COHERENT_INT_MASK | TX11_COHERENT_INT_MASK | \ +- TX12_COHERENT_INT_MASK | TX13_COHERENT_INT_MASK | \ +- TX14_COHERENT_INT_MASK | TX15_COHERENT_INT_MASK | \ +- TX16_COHERENT_INT_MASK | TX17_COHERENT_INT_MASK | \ +- TX18_COHERENT_INT_MASK | TX19_COHERENT_INT_MASK | \ +- TX20_COHERENT_INT_MASK | TX21_COHERENT_INT_MASK | \ +- TX22_COHERENT_INT_MASK | TX23_COHERENT_INT_MASK | \ +- TX24_COHERENT_INT_MASK | TX25_COHERENT_INT_MASK | \ +- TX26_COHERENT_INT_MASK | TX27_COHERENT_INT_MASK | \ +- TX28_COHERENT_INT_MASK | TX29_COHERENT_INT_MASK | \ +- TX30_COHERENT_INT_MASK | TX31_COHERENT_INT_MASK) +- +-#define REG_TX_IRQ_BASE(_n) ((_n) ? 0x0048 : 0x0050) +- +-#define REG_TX_IRQ_CFG(_n) ((_n) ? 0x004c : 0x0054) +-#define TX_IRQ_THR_MASK GENMASK(27, 16) +-#define TX_IRQ_DEPTH_MASK GENMASK(11, 0) +- +-#define REG_IRQ_CLEAR_LEN(_n) ((_n) ? 0x0064 : 0x0058) +-#define IRQ_CLEAR_LEN_MASK GENMASK(7, 0) +- +-#define REG_IRQ_STATUS(_n) ((_n) ? 0x0068 : 0x005c) +-#define IRQ_ENTRY_LEN_MASK GENMASK(27, 16) +-#define IRQ_HEAD_IDX_MASK GENMASK(11, 0) +- +-#define REG_TX_RING_BASE(_n) \ +- (((_n) < 8) ? 0x0100 + ((_n) << 5) : 0x0b00 + (((_n) - 8) << 5)) +- +-#define REG_TX_RING_BLOCKING(_n) \ +- (((_n) < 8) ? 0x0104 + ((_n) << 5) : 0x0b04 + (((_n) - 8) << 5)) +- +-#define TX_RING_IRQ_BLOCKING_MAP_MASK BIT(6) +-#define TX_RING_IRQ_BLOCKING_CFG_MASK BIT(4) +-#define TX_RING_IRQ_BLOCKING_TX_DROP_EN_MASK BIT(2) +-#define TX_RING_IRQ_BLOCKING_MAX_TH_TXRING_EN_MASK BIT(1) +-#define TX_RING_IRQ_BLOCKING_MIN_TH_TXRING_EN_MASK BIT(0) +- +-#define REG_TX_CPU_IDX(_n) \ +- (((_n) < 8) ? 0x0108 + ((_n) << 5) : 0x0b08 + (((_n) - 8) << 5)) +- +-#define TX_RING_CPU_IDX_MASK GENMASK(15, 0) +- +-#define REG_TX_DMA_IDX(_n) \ +- (((_n) < 8) ? 0x010c + ((_n) << 5) : 0x0b0c + (((_n) - 8) << 5)) +- +-#define TX_RING_DMA_IDX_MASK GENMASK(15, 0) +- +-#define IRQ_RING_IDX_MASK GENMASK(20, 16) +-#define IRQ_DESC_IDX_MASK GENMASK(15, 0) +- +-#define REG_RX_RING_BASE(_n) \ +- (((_n) < 16) ? 0x0200 + ((_n) << 5) : 0x0e00 + (((_n) - 16) << 5)) +- +-#define REG_RX_RING_SIZE(_n) \ +- (((_n) < 16) ? 0x0204 + ((_n) << 5) : 0x0e04 + (((_n) - 16) << 5)) +- +-#define RX_RING_THR_MASK GENMASK(31, 16) +-#define RX_RING_SIZE_MASK GENMASK(15, 0) +- +-#define REG_RX_CPU_IDX(_n) \ +- (((_n) < 16) ? 0x0208 + ((_n) << 5) : 0x0e08 + (((_n) - 16) << 5)) +- +-#define RX_RING_CPU_IDX_MASK GENMASK(15, 0) +- +-#define REG_RX_DMA_IDX(_n) \ +- (((_n) < 16) ? 0x020c + ((_n) << 5) : 0x0e0c + (((_n) - 16) << 5)) +- +-#define REG_RX_DELAY_INT_IDX(_n) \ +- (((_n) < 16) ? 0x0210 + ((_n) << 5) : 0x0e10 + (((_n) - 16) << 5)) +- +-#define RX_DELAY_INT_MASK GENMASK(15, 0) +- +-#define RX_RING_DMA_IDX_MASK GENMASK(15, 0) +- +-#define REG_INGRESS_TRTCM_CFG 0x0070 +-#define INGRESS_TRTCM_EN_MASK BIT(31) +-#define INGRESS_TRTCM_MODE_MASK BIT(30) +-#define INGRESS_SLOW_TICK_RATIO_MASK GENMASK(29, 16) +-#define INGRESS_FAST_TICK_MASK GENMASK(15, 0) +- +-#define REG_QUEUE_CLOSE_CFG(_n) (0x00a0 + ((_n) & 0xfc)) +-#define TXQ_DISABLE_CHAN_QUEUE_MASK(_n, _m) BIT((_m) + (((_n) & 0x3) << 3)) +- +-#define REG_TXQ_DIS_CFG_BASE(_n) ((_n) ? 0x20a0 : 0x00a0) +-#define REG_TXQ_DIS_CFG(_n, _m) (REG_TXQ_DIS_CFG_BASE((_n)) + (_m) << 2) +- +-#define REG_CNTR_CFG(_n) (0x0400 + ((_n) << 3)) +-#define CNTR_EN_MASK BIT(31) +-#define CNTR_ALL_CHAN_EN_MASK BIT(30) +-#define CNTR_ALL_QUEUE_EN_MASK BIT(29) +-#define CNTR_ALL_DSCP_RING_EN_MASK BIT(28) +-#define CNTR_SRC_MASK GENMASK(27, 24) +-#define CNTR_DSCP_RING_MASK GENMASK(20, 16) +-#define CNTR_CHAN_MASK GENMASK(7, 3) +-#define CNTR_QUEUE_MASK GENMASK(2, 0) +- +-#define REG_CNTR_VAL(_n) (0x0404 + ((_n) << 3)) +- +-#define REG_LMGR_INIT_CFG 0x1000 +-#define LMGR_INIT_START BIT(31) +-#define LMGR_SRAM_MODE_MASK BIT(30) +-#define HW_FWD_PKTSIZE_OVERHEAD_MASK GENMASK(27, 20) +-#define HW_FWD_DESC_NUM_MASK GENMASK(16, 0) +- +-#define REG_FWD_DSCP_LOW_THR 0x1004 +-#define FWD_DSCP_LOW_THR_MASK GENMASK(17, 0) +- +-#define REG_EGRESS_RATE_METER_CFG 0x100c +-#define EGRESS_RATE_METER_EN_MASK BIT(31) +-#define EGRESS_RATE_METER_EQ_RATE_EN_MASK BIT(17) +-#define EGRESS_RATE_METER_WINDOW_SZ_MASK GENMASK(16, 12) +-#define EGRESS_RATE_METER_TIMESLICE_MASK GENMASK(10, 0) +- +-#define REG_EGRESS_TRTCM_CFG 0x1010 +-#define EGRESS_TRTCM_EN_MASK BIT(31) +-#define EGRESS_TRTCM_MODE_MASK BIT(30) +-#define EGRESS_SLOW_TICK_RATIO_MASK GENMASK(29, 16) +-#define EGRESS_FAST_TICK_MASK GENMASK(15, 0) +- +-#define TRTCM_PARAM_RW_MASK BIT(31) +-#define TRTCM_PARAM_RW_DONE_MASK BIT(30) +-#define TRTCM_PARAM_TYPE_MASK GENMASK(29, 28) +-#define TRTCM_METER_GROUP_MASK GENMASK(27, 26) +-#define TRTCM_PARAM_INDEX_MASK GENMASK(23, 17) +-#define TRTCM_PARAM_RATE_TYPE_MASK BIT(16) +- +-#define REG_TRTCM_CFG_PARAM(_n) ((_n) + 0x4) +-#define REG_TRTCM_DATA_LOW(_n) ((_n) + 0x8) +-#define REG_TRTCM_DATA_HIGH(_n) ((_n) + 0xc) +- +-#define REG_TXWRR_MODE_CFG 0x1020 +-#define TWRR_WEIGHT_SCALE_MASK BIT(31) +-#define TWRR_WEIGHT_BASE_MASK BIT(3) +- +-#define REG_TXWRR_WEIGHT_CFG 0x1024 +-#define TWRR_RW_CMD_MASK BIT(31) +-#define TWRR_RW_CMD_DONE BIT(30) +-#define TWRR_CHAN_IDX_MASK GENMASK(23, 19) +-#define TWRR_QUEUE_IDX_MASK GENMASK(18, 16) +-#define TWRR_VALUE_MASK GENMASK(15, 0) +- +-#define REG_PSE_BUF_USAGE_CFG 0x1028 +-#define PSE_BUF_ESTIMATE_EN_MASK BIT(29) +- +-#define REG_CHAN_QOS_MODE(_n) (0x1040 + ((_n) << 2)) +-#define CHAN_QOS_MODE_MASK(_n) GENMASK(2 + ((_n) << 2), (_n) << 2) +- +-#define REG_GLB_TRTCM_CFG 0x1080 +-#define GLB_TRTCM_EN_MASK BIT(31) +-#define GLB_TRTCM_MODE_MASK BIT(30) +-#define GLB_SLOW_TICK_RATIO_MASK GENMASK(29, 16) +-#define GLB_FAST_TICK_MASK GENMASK(15, 0) +- +-#define REG_TXQ_CNGST_CFG 0x10a0 +-#define TXQ_CNGST_DROP_EN BIT(31) +-#define TXQ_CNGST_DEI_DROP_EN BIT(30) +- +-#define REG_SLA_TRTCM_CFG 0x1150 +-#define SLA_TRTCM_EN_MASK BIT(31) +-#define SLA_TRTCM_MODE_MASK BIT(30) +-#define SLA_SLOW_TICK_RATIO_MASK GENMASK(29, 16) +-#define SLA_FAST_TICK_MASK GENMASK(15, 0) +- +-/* CTRL */ +-#define QDMA_DESC_DONE_MASK BIT(31) +-#define QDMA_DESC_DROP_MASK BIT(30) /* tx: drop - rx: overflow */ +-#define QDMA_DESC_MORE_MASK BIT(29) /* more SG elements */ +-#define QDMA_DESC_DEI_MASK BIT(25) +-#define QDMA_DESC_NO_DROP_MASK BIT(24) +-#define QDMA_DESC_LEN_MASK GENMASK(15, 0) +-/* DATA */ +-#define QDMA_DESC_NEXT_ID_MASK GENMASK(15, 0) +-/* TX MSG0 */ +-#define QDMA_ETH_TXMSG_MIC_IDX_MASK BIT(30) +-#define QDMA_ETH_TXMSG_SP_TAG_MASK GENMASK(29, 14) +-#define QDMA_ETH_TXMSG_ICO_MASK BIT(13) +-#define QDMA_ETH_TXMSG_UCO_MASK BIT(12) +-#define QDMA_ETH_TXMSG_TCO_MASK BIT(11) +-#define QDMA_ETH_TXMSG_TSO_MASK BIT(10) +-#define QDMA_ETH_TXMSG_FAST_MASK BIT(9) +-#define QDMA_ETH_TXMSG_OAM_MASK BIT(8) +-#define QDMA_ETH_TXMSG_CHAN_MASK GENMASK(7, 3) +-#define QDMA_ETH_TXMSG_QUEUE_MASK GENMASK(2, 0) +-/* TX MSG1 */ +-#define QDMA_ETH_TXMSG_NO_DROP BIT(31) +-#define QDMA_ETH_TXMSG_METER_MASK GENMASK(30, 24) /* 0x7f no meters */ +-#define QDMA_ETH_TXMSG_FPORT_MASK GENMASK(23, 20) +-#define QDMA_ETH_TXMSG_NBOQ_MASK GENMASK(19, 15) +-#define QDMA_ETH_TXMSG_HWF_MASK BIT(14) +-#define QDMA_ETH_TXMSG_HOP_MASK BIT(13) +-#define QDMA_ETH_TXMSG_PTP_MASK BIT(12) +-#define QDMA_ETH_TXMSG_ACNT_G1_MASK GENMASK(10, 6) /* 0x1f do not count */ +-#define QDMA_ETH_TXMSG_ACNT_G0_MASK GENMASK(5, 0) /* 0x3f do not count */ +- +-/* RX MSG1 */ +-#define QDMA_ETH_RXMSG_DEI_MASK BIT(31) +-#define QDMA_ETH_RXMSG_IP6_MASK BIT(30) +-#define QDMA_ETH_RXMSG_IP4_MASK BIT(29) +-#define QDMA_ETH_RXMSG_IP4F_MASK BIT(28) +-#define QDMA_ETH_RXMSG_L4_VALID_MASK BIT(27) +-#define QDMA_ETH_RXMSG_L4F_MASK BIT(26) +-#define QDMA_ETH_RXMSG_SPORT_MASK GENMASK(25, 21) +-#define QDMA_ETH_RXMSG_CRSN_MASK GENMASK(20, 16) +-#define QDMA_ETH_RXMSG_PPE_ENTRY_MASK GENMASK(15, 0) +- +-struct airoha_qdma_desc { +- __le32 rsv; +- __le32 ctrl; +- __le32 addr; +- __le32 data; +- __le32 msg0; +- __le32 msg1; +- __le32 msg2; +- __le32 msg3; +-}; +- +-/* CTRL0 */ +-#define QDMA_FWD_DESC_CTX_MASK BIT(31) +-#define QDMA_FWD_DESC_RING_MASK GENMASK(30, 28) +-#define QDMA_FWD_DESC_IDX_MASK GENMASK(27, 16) +-#define QDMA_FWD_DESC_LEN_MASK GENMASK(15, 0) +-/* CTRL1 */ +-#define QDMA_FWD_DESC_FIRST_IDX_MASK GENMASK(15, 0) +-/* CTRL2 */ +-#define QDMA_FWD_DESC_MORE_PKT_NUM_MASK GENMASK(2, 0) +- +-struct airoha_qdma_fwd_desc { +- __le32 addr; +- __le32 ctrl0; +- __le32 ctrl1; +- __le32 ctrl2; +- __le32 msg0; +- __le32 msg1; +- __le32 rsv0; +- __le32 rsv1; +-}; +- + u32 airoha_rr(void __iomem *base, u32 offset) + { + return readl(base + offset); +--- /dev/null ++++ b/drivers/net/ethernet/airoha/airoha_regs.h +@@ -0,0 +1,670 @@ ++/* SPDX-License-Identifier: GPL-2.0-only */ ++/* ++ * Copyright (c) 2024 AIROHA Inc ++ * Author: Lorenzo Bianconi ++ */ ++ ++#ifndef AIROHA_REGS_H ++#define AIROHA_REGS_H ++ ++#include ++ ++/* FE */ ++#define PSE_BASE 0x0100 ++#define CSR_IFC_BASE 0x0200 ++#define CDM1_BASE 0x0400 ++#define GDM1_BASE 0x0500 ++#define PPE1_BASE 0x0c00 ++ ++#define CDM2_BASE 0x1400 ++#define GDM2_BASE 0x1500 ++ ++#define GDM3_BASE 0x1100 ++#define GDM4_BASE 0x2500 ++ ++#define GDM_BASE(_n) \ ++ ((_n) == 4 ? GDM4_BASE : \ ++ (_n) == 3 ? GDM3_BASE : \ ++ (_n) == 2 ? GDM2_BASE : GDM1_BASE) ++ ++#define REG_FE_DMA_GLO_CFG 0x0000 ++#define FE_DMA_GLO_L2_SPACE_MASK GENMASK(7, 4) ++#define FE_DMA_GLO_PG_SZ_MASK BIT(3) ++ ++#define REG_FE_RST_GLO_CFG 0x0004 ++#define FE_RST_GDM4_MBI_ARB_MASK BIT(3) ++#define FE_RST_GDM3_MBI_ARB_MASK BIT(2) ++#define FE_RST_CORE_MASK BIT(0) ++ ++#define REG_FE_WAN_MAC_H 0x0030 ++#define REG_FE_LAN_MAC_H 0x0040 ++ ++#define REG_FE_MAC_LMIN(_n) ((_n) + 0x04) ++#define REG_FE_MAC_LMAX(_n) ((_n) + 0x08) ++ ++#define REG_FE_CDM1_OQ_MAP0 0x0050 ++#define REG_FE_CDM1_OQ_MAP1 0x0054 ++#define REG_FE_CDM1_OQ_MAP2 0x0058 ++#define REG_FE_CDM1_OQ_MAP3 0x005c ++ ++#define REG_FE_PCE_CFG 0x0070 ++#define PCE_DPI_EN_MASK BIT(2) ++#define PCE_KA_EN_MASK BIT(1) ++#define PCE_MC_EN_MASK BIT(0) ++ ++#define REG_FE_PSE_QUEUE_CFG_WR 0x0080 ++#define PSE_CFG_PORT_ID_MASK GENMASK(27, 24) ++#define PSE_CFG_QUEUE_ID_MASK GENMASK(20, 16) ++#define PSE_CFG_WR_EN_MASK BIT(8) ++#define PSE_CFG_OQRSV_SEL_MASK BIT(0) ++ ++#define REG_FE_PSE_QUEUE_CFG_VAL 0x0084 ++#define PSE_CFG_OQ_RSV_MASK GENMASK(13, 0) ++ ++#define PSE_FQ_CFG 0x008c ++#define PSE_FQ_LIMIT_MASK GENMASK(14, 0) ++ ++#define REG_FE_PSE_BUF_SET 0x0090 ++#define PSE_SHARE_USED_LTHD_MASK GENMASK(31, 16) ++#define PSE_ALLRSV_MASK GENMASK(14, 0) ++ ++#define REG_PSE_SHARE_USED_THD 0x0094 ++#define PSE_SHARE_USED_MTHD_MASK GENMASK(31, 16) ++#define PSE_SHARE_USED_HTHD_MASK GENMASK(15, 0) ++ ++#define REG_GDM_MISC_CFG 0x0148 ++#define GDM2_RDM_ACK_WAIT_PREF_MASK BIT(9) ++#define GDM2_CHN_VLD_MODE_MASK BIT(5) ++ ++#define REG_FE_CSR_IFC_CFG CSR_IFC_BASE ++#define FE_IFC_EN_MASK BIT(0) ++ ++#define REG_FE_VIP_PORT_EN 0x01f0 ++#define REG_FE_IFC_PORT_EN 0x01f4 ++ ++#define REG_PSE_IQ_REV1 (PSE_BASE + 0x08) ++#define PSE_IQ_RES1_P2_MASK GENMASK(23, 16) ++ ++#define REG_PSE_IQ_REV2 (PSE_BASE + 0x0c) ++#define PSE_IQ_RES2_P5_MASK GENMASK(15, 8) ++#define PSE_IQ_RES2_P4_MASK GENMASK(7, 0) ++ ++#define REG_FE_VIP_EN(_n) (0x0300 + ((_n) << 3)) ++#define PATN_FCPU_EN_MASK BIT(7) ++#define PATN_SWP_EN_MASK BIT(6) ++#define PATN_DP_EN_MASK BIT(5) ++#define PATN_SP_EN_MASK BIT(4) ++#define PATN_TYPE_MASK GENMASK(3, 1) ++#define PATN_EN_MASK BIT(0) ++ ++#define REG_FE_VIP_PATN(_n) (0x0304 + ((_n) << 3)) ++#define PATN_DP_MASK GENMASK(31, 16) ++#define PATN_SP_MASK GENMASK(15, 0) ++ ++#define REG_CDM1_VLAN_CTRL CDM1_BASE ++#define CDM1_VLAN_MASK GENMASK(31, 16) ++ ++#define REG_CDM1_FWD_CFG (CDM1_BASE + 0x08) ++#define CDM1_VIP_QSEL_MASK GENMASK(24, 20) ++ ++#define REG_CDM1_CRSN_QSEL(_n) (CDM1_BASE + 0x10 + ((_n) << 2)) ++#define CDM1_CRSN_QSEL_REASON_MASK(_n) \ ++ GENMASK(4 + (((_n) % 4) << 3), (((_n) % 4) << 3)) ++ ++#define REG_CDM2_FWD_CFG (CDM2_BASE + 0x08) ++#define CDM2_OAM_QSEL_MASK GENMASK(31, 27) ++#define CDM2_VIP_QSEL_MASK GENMASK(24, 20) ++ ++#define REG_CDM2_CRSN_QSEL(_n) (CDM2_BASE + 0x10 + ((_n) << 2)) ++#define CDM2_CRSN_QSEL_REASON_MASK(_n) \ ++ GENMASK(4 + (((_n) % 4) << 3), (((_n) % 4) << 3)) ++ ++#define REG_GDM_FWD_CFG(_n) GDM_BASE(_n) ++#define GDM_DROP_CRC_ERR BIT(23) ++#define GDM_IP4_CKSUM BIT(22) ++#define GDM_TCP_CKSUM BIT(21) ++#define GDM_UDP_CKSUM BIT(20) ++#define GDM_UCFQ_MASK GENMASK(15, 12) ++#define GDM_BCFQ_MASK GENMASK(11, 8) ++#define GDM_MCFQ_MASK GENMASK(7, 4) ++#define GDM_OCFQ_MASK GENMASK(3, 0) ++ ++#define REG_GDM_INGRESS_CFG(_n) (GDM_BASE(_n) + 0x10) ++#define GDM_INGRESS_FC_EN_MASK BIT(1) ++#define GDM_STAG_EN_MASK BIT(0) ++ ++#define REG_GDM_LEN_CFG(_n) (GDM_BASE(_n) + 0x14) ++#define GDM_SHORT_LEN_MASK GENMASK(13, 0) ++#define GDM_LONG_LEN_MASK GENMASK(29, 16) ++ ++#define REG_FE_CPORT_CFG (GDM1_BASE + 0x40) ++#define FE_CPORT_PAD BIT(26) ++#define FE_CPORT_PORT_XFC_MASK BIT(25) ++#define FE_CPORT_QUEUE_XFC_MASK BIT(24) ++ ++#define REG_FE_GDM_MIB_CLEAR(_n) (GDM_BASE(_n) + 0xf0) ++#define FE_GDM_MIB_RX_CLEAR_MASK BIT(1) ++#define FE_GDM_MIB_TX_CLEAR_MASK BIT(0) ++ ++#define REG_FE_GDM1_MIB_CFG (GDM1_BASE + 0xf4) ++#define FE_STRICT_RFC2819_MODE_MASK BIT(31) ++#define FE_GDM1_TX_MIB_SPLIT_EN_MASK BIT(17) ++#define FE_GDM1_RX_MIB_SPLIT_EN_MASK BIT(16) ++#define FE_TX_MIB_ID_MASK GENMASK(15, 8) ++#define FE_RX_MIB_ID_MASK GENMASK(7, 0) ++ ++#define REG_FE_GDM_TX_OK_PKT_CNT_L(_n) (GDM_BASE(_n) + 0x104) ++#define REG_FE_GDM_TX_OK_BYTE_CNT_L(_n) (GDM_BASE(_n) + 0x10c) ++#define REG_FE_GDM_TX_ETH_PKT_CNT_L(_n) (GDM_BASE(_n) + 0x110) ++#define REG_FE_GDM_TX_ETH_BYTE_CNT_L(_n) (GDM_BASE(_n) + 0x114) ++#define REG_FE_GDM_TX_ETH_DROP_CNT(_n) (GDM_BASE(_n) + 0x118) ++#define REG_FE_GDM_TX_ETH_BC_CNT(_n) (GDM_BASE(_n) + 0x11c) ++#define REG_FE_GDM_TX_ETH_MC_CNT(_n) (GDM_BASE(_n) + 0x120) ++#define REG_FE_GDM_TX_ETH_RUNT_CNT(_n) (GDM_BASE(_n) + 0x124) ++#define REG_FE_GDM_TX_ETH_LONG_CNT(_n) (GDM_BASE(_n) + 0x128) ++#define REG_FE_GDM_TX_ETH_E64_CNT_L(_n) (GDM_BASE(_n) + 0x12c) ++#define REG_FE_GDM_TX_ETH_L64_CNT_L(_n) (GDM_BASE(_n) + 0x130) ++#define REG_FE_GDM_TX_ETH_L127_CNT_L(_n) (GDM_BASE(_n) + 0x134) ++#define REG_FE_GDM_TX_ETH_L255_CNT_L(_n) (GDM_BASE(_n) + 0x138) ++#define REG_FE_GDM_TX_ETH_L511_CNT_L(_n) (GDM_BASE(_n) + 0x13c) ++#define REG_FE_GDM_TX_ETH_L1023_CNT_L(_n) (GDM_BASE(_n) + 0x140) ++ ++#define REG_FE_GDM_RX_OK_PKT_CNT_L(_n) (GDM_BASE(_n) + 0x148) ++#define REG_FE_GDM_RX_FC_DROP_CNT(_n) (GDM_BASE(_n) + 0x14c) ++#define REG_FE_GDM_RX_RC_DROP_CNT(_n) (GDM_BASE(_n) + 0x150) ++#define REG_FE_GDM_RX_OVERFLOW_DROP_CNT(_n) (GDM_BASE(_n) + 0x154) ++#define REG_FE_GDM_RX_ERROR_DROP_CNT(_n) (GDM_BASE(_n) + 0x158) ++#define REG_FE_GDM_RX_OK_BYTE_CNT_L(_n) (GDM_BASE(_n) + 0x15c) ++#define REG_FE_GDM_RX_ETH_PKT_CNT_L(_n) (GDM_BASE(_n) + 0x160) ++#define REG_FE_GDM_RX_ETH_BYTE_CNT_L(_n) (GDM_BASE(_n) + 0x164) ++#define REG_FE_GDM_RX_ETH_DROP_CNT(_n) (GDM_BASE(_n) + 0x168) ++#define REG_FE_GDM_RX_ETH_BC_CNT(_n) (GDM_BASE(_n) + 0x16c) ++#define REG_FE_GDM_RX_ETH_MC_CNT(_n) (GDM_BASE(_n) + 0x170) ++#define REG_FE_GDM_RX_ETH_CRC_ERR_CNT(_n) (GDM_BASE(_n) + 0x174) ++#define REG_FE_GDM_RX_ETH_FRAG_CNT(_n) (GDM_BASE(_n) + 0x178) ++#define REG_FE_GDM_RX_ETH_JABBER_CNT(_n) (GDM_BASE(_n) + 0x17c) ++#define REG_FE_GDM_RX_ETH_RUNT_CNT(_n) (GDM_BASE(_n) + 0x180) ++#define REG_FE_GDM_RX_ETH_LONG_CNT(_n) (GDM_BASE(_n) + 0x184) ++#define REG_FE_GDM_RX_ETH_E64_CNT_L(_n) (GDM_BASE(_n) + 0x188) ++#define REG_FE_GDM_RX_ETH_L64_CNT_L(_n) (GDM_BASE(_n) + 0x18c) ++#define REG_FE_GDM_RX_ETH_L127_CNT_L(_n) (GDM_BASE(_n) + 0x190) ++#define REG_FE_GDM_RX_ETH_L255_CNT_L(_n) (GDM_BASE(_n) + 0x194) ++#define REG_FE_GDM_RX_ETH_L511_CNT_L(_n) (GDM_BASE(_n) + 0x198) ++#define REG_FE_GDM_RX_ETH_L1023_CNT_L(_n) (GDM_BASE(_n) + 0x19c) ++ ++#define REG_PPE1_TB_HASH_CFG (PPE1_BASE + 0x250) ++#define PPE1_SRAM_TABLE_EN_MASK BIT(0) ++#define PPE1_SRAM_HASH1_EN_MASK BIT(8) ++#define PPE1_DRAM_TABLE_EN_MASK BIT(16) ++#define PPE1_DRAM_HASH1_EN_MASK BIT(24) ++ ++#define REG_FE_GDM_TX_OK_PKT_CNT_H(_n) (GDM_BASE(_n) + 0x280) ++#define REG_FE_GDM_TX_OK_BYTE_CNT_H(_n) (GDM_BASE(_n) + 0x284) ++#define REG_FE_GDM_TX_ETH_PKT_CNT_H(_n) (GDM_BASE(_n) + 0x288) ++#define REG_FE_GDM_TX_ETH_BYTE_CNT_H(_n) (GDM_BASE(_n) + 0x28c) ++ ++#define REG_FE_GDM_RX_OK_PKT_CNT_H(_n) (GDM_BASE(_n) + 0x290) ++#define REG_FE_GDM_RX_OK_BYTE_CNT_H(_n) (GDM_BASE(_n) + 0x294) ++#define REG_FE_GDM_RX_ETH_PKT_CNT_H(_n) (GDM_BASE(_n) + 0x298) ++#define REG_FE_GDM_RX_ETH_BYTE_CNT_H(_n) (GDM_BASE(_n) + 0x29c) ++#define REG_FE_GDM_TX_ETH_E64_CNT_H(_n) (GDM_BASE(_n) + 0x2b8) ++#define REG_FE_GDM_TX_ETH_L64_CNT_H(_n) (GDM_BASE(_n) + 0x2bc) ++#define REG_FE_GDM_TX_ETH_L127_CNT_H(_n) (GDM_BASE(_n) + 0x2c0) ++#define REG_FE_GDM_TX_ETH_L255_CNT_H(_n) (GDM_BASE(_n) + 0x2c4) ++#define REG_FE_GDM_TX_ETH_L511_CNT_H(_n) (GDM_BASE(_n) + 0x2c8) ++#define REG_FE_GDM_TX_ETH_L1023_CNT_H(_n) (GDM_BASE(_n) + 0x2cc) ++#define REG_FE_GDM_RX_ETH_E64_CNT_H(_n) (GDM_BASE(_n) + 0x2e8) ++#define REG_FE_GDM_RX_ETH_L64_CNT_H(_n) (GDM_BASE(_n) + 0x2ec) ++#define REG_FE_GDM_RX_ETH_L127_CNT_H(_n) (GDM_BASE(_n) + 0x2f0) ++#define REG_FE_GDM_RX_ETH_L255_CNT_H(_n) (GDM_BASE(_n) + 0x2f4) ++#define REG_FE_GDM_RX_ETH_L511_CNT_H(_n) (GDM_BASE(_n) + 0x2f8) ++#define REG_FE_GDM_RX_ETH_L1023_CNT_H(_n) (GDM_BASE(_n) + 0x2fc) ++ ++#define REG_GDM2_CHN_RLS (GDM2_BASE + 0x20) ++#define MBI_RX_AGE_SEL_MASK GENMASK(26, 25) ++#define MBI_TX_AGE_SEL_MASK GENMASK(18, 17) ++ ++#define REG_GDM3_FWD_CFG GDM3_BASE ++#define GDM3_PAD_EN_MASK BIT(28) ++ ++#define REG_GDM4_FWD_CFG GDM4_BASE ++#define GDM4_PAD_EN_MASK BIT(28) ++#define GDM4_SPORT_OFFSET0_MASK GENMASK(11, 8) ++ ++#define REG_GDM4_SRC_PORT_SET (GDM4_BASE + 0x23c) ++#define GDM4_SPORT_OFF2_MASK GENMASK(19, 16) ++#define GDM4_SPORT_OFF1_MASK GENMASK(15, 12) ++#define GDM4_SPORT_OFF0_MASK GENMASK(11, 8) ++ ++#define REG_IP_FRAG_FP 0x2010 ++#define IP_ASSEMBLE_PORT_MASK GENMASK(24, 21) ++#define IP_ASSEMBLE_NBQ_MASK GENMASK(20, 16) ++#define IP_FRAGMENT_PORT_MASK GENMASK(8, 5) ++#define IP_FRAGMENT_NBQ_MASK GENMASK(4, 0) ++ ++#define REG_MC_VLAN_EN 0x2100 ++#define MC_VLAN_EN_MASK BIT(0) ++ ++#define REG_MC_VLAN_CFG 0x2104 ++#define MC_VLAN_CFG_CMD_DONE_MASK BIT(31) ++#define MC_VLAN_CFG_TABLE_ID_MASK GENMASK(21, 16) ++#define MC_VLAN_CFG_PORT_ID_MASK GENMASK(11, 8) ++#define MC_VLAN_CFG_TABLE_SEL_MASK BIT(4) ++#define MC_VLAN_CFG_RW_MASK BIT(0) ++ ++#define REG_MC_VLAN_DATA 0x2108 ++ ++#define REG_CDM5_RX_OQ1_DROP_CNT 0x29d4 ++ ++/* QDMA */ ++#define REG_QDMA_GLOBAL_CFG 0x0004 ++#define GLOBAL_CFG_RX_2B_OFFSET_MASK BIT(31) ++#define GLOBAL_CFG_DMA_PREFERENCE_MASK GENMASK(30, 29) ++#define GLOBAL_CFG_CPU_TXR_RR_MASK BIT(28) ++#define GLOBAL_CFG_DSCP_BYTE_SWAP_MASK BIT(27) ++#define GLOBAL_CFG_PAYLOAD_BYTE_SWAP_MASK BIT(26) ++#define GLOBAL_CFG_MULTICAST_MODIFY_FP_MASK BIT(25) ++#define GLOBAL_CFG_OAM_MODIFY_MASK BIT(24) ++#define GLOBAL_CFG_RESET_MASK BIT(23) ++#define GLOBAL_CFG_RESET_DONE_MASK BIT(22) ++#define GLOBAL_CFG_MULTICAST_EN_MASK BIT(21) ++#define GLOBAL_CFG_IRQ1_EN_MASK BIT(20) ++#define GLOBAL_CFG_IRQ0_EN_MASK BIT(19) ++#define GLOBAL_CFG_LOOPCNT_EN_MASK BIT(18) ++#define GLOBAL_CFG_RD_BYPASS_WR_MASK BIT(17) ++#define GLOBAL_CFG_QDMA_LOOPBACK_MASK BIT(16) ++#define GLOBAL_CFG_LPBK_RXQ_SEL_MASK GENMASK(13, 8) ++#define GLOBAL_CFG_CHECK_DONE_MASK BIT(7) ++#define GLOBAL_CFG_TX_WB_DONE_MASK BIT(6) ++#define GLOBAL_CFG_MAX_ISSUE_NUM_MASK GENMASK(5, 4) ++#define GLOBAL_CFG_RX_DMA_BUSY_MASK BIT(3) ++#define GLOBAL_CFG_RX_DMA_EN_MASK BIT(2) ++#define GLOBAL_CFG_TX_DMA_BUSY_MASK BIT(1) ++#define GLOBAL_CFG_TX_DMA_EN_MASK BIT(0) ++ ++#define REG_FWD_DSCP_BASE 0x0010 ++#define REG_FWD_BUF_BASE 0x0014 ++ ++#define REG_HW_FWD_DSCP_CFG 0x0018 ++#define HW_FWD_DSCP_PAYLOAD_SIZE_MASK GENMASK(29, 28) ++#define HW_FWD_DSCP_SCATTER_LEN_MASK GENMASK(17, 16) ++#define HW_FWD_DSCP_MIN_SCATTER_LEN_MASK GENMASK(15, 0) ++ ++#define REG_INT_STATUS(_n) \ ++ (((_n) == 4) ? 0x0730 : \ ++ ((_n) == 3) ? 0x0724 : \ ++ ((_n) == 2) ? 0x0720 : \ ++ ((_n) == 1) ? 0x0024 : 0x0020) ++ ++#define REG_INT_ENABLE(_n) \ ++ (((_n) == 4) ? 0x0750 : \ ++ ((_n) == 3) ? 0x0744 : \ ++ ((_n) == 2) ? 0x0740 : \ ++ ((_n) == 1) ? 0x002c : 0x0028) ++ ++/* QDMA_CSR_INT_ENABLE1 */ ++#define RX15_COHERENT_INT_MASK BIT(31) ++#define RX14_COHERENT_INT_MASK BIT(30) ++#define RX13_COHERENT_INT_MASK BIT(29) ++#define RX12_COHERENT_INT_MASK BIT(28) ++#define RX11_COHERENT_INT_MASK BIT(27) ++#define RX10_COHERENT_INT_MASK BIT(26) ++#define RX9_COHERENT_INT_MASK BIT(25) ++#define RX8_COHERENT_INT_MASK BIT(24) ++#define RX7_COHERENT_INT_MASK BIT(23) ++#define RX6_COHERENT_INT_MASK BIT(22) ++#define RX5_COHERENT_INT_MASK BIT(21) ++#define RX4_COHERENT_INT_MASK BIT(20) ++#define RX3_COHERENT_INT_MASK BIT(19) ++#define RX2_COHERENT_INT_MASK BIT(18) ++#define RX1_COHERENT_INT_MASK BIT(17) ++#define RX0_COHERENT_INT_MASK BIT(16) ++#define TX7_COHERENT_INT_MASK BIT(15) ++#define TX6_COHERENT_INT_MASK BIT(14) ++#define TX5_COHERENT_INT_MASK BIT(13) ++#define TX4_COHERENT_INT_MASK BIT(12) ++#define TX3_COHERENT_INT_MASK BIT(11) ++#define TX2_COHERENT_INT_MASK BIT(10) ++#define TX1_COHERENT_INT_MASK BIT(9) ++#define TX0_COHERENT_INT_MASK BIT(8) ++#define CNT_OVER_FLOW_INT_MASK BIT(7) ++#define IRQ1_FULL_INT_MASK BIT(5) ++#define IRQ1_INT_MASK BIT(4) ++#define HWFWD_DSCP_LOW_INT_MASK BIT(3) ++#define HWFWD_DSCP_EMPTY_INT_MASK BIT(2) ++#define IRQ0_FULL_INT_MASK BIT(1) ++#define IRQ0_INT_MASK BIT(0) ++ ++#define TX_DONE_INT_MASK(_n) \ ++ ((_n) ? IRQ1_INT_MASK | IRQ1_FULL_INT_MASK \ ++ : IRQ0_INT_MASK | IRQ0_FULL_INT_MASK) ++ ++#define INT_TX_MASK \ ++ (IRQ1_INT_MASK | IRQ1_FULL_INT_MASK | \ ++ IRQ0_INT_MASK | IRQ0_FULL_INT_MASK) ++ ++#define INT_IDX0_MASK \ ++ (TX0_COHERENT_INT_MASK | TX1_COHERENT_INT_MASK | \ ++ TX2_COHERENT_INT_MASK | TX3_COHERENT_INT_MASK | \ ++ TX4_COHERENT_INT_MASK | TX5_COHERENT_INT_MASK | \ ++ TX6_COHERENT_INT_MASK | TX7_COHERENT_INT_MASK | \ ++ RX0_COHERENT_INT_MASK | RX1_COHERENT_INT_MASK | \ ++ RX2_COHERENT_INT_MASK | RX3_COHERENT_INT_MASK | \ ++ RX4_COHERENT_INT_MASK | RX7_COHERENT_INT_MASK | \ ++ RX8_COHERENT_INT_MASK | RX9_COHERENT_INT_MASK | \ ++ RX15_COHERENT_INT_MASK | INT_TX_MASK) ++ ++/* QDMA_CSR_INT_ENABLE2 */ ++#define RX15_NO_CPU_DSCP_INT_MASK BIT(31) ++#define RX14_NO_CPU_DSCP_INT_MASK BIT(30) ++#define RX13_NO_CPU_DSCP_INT_MASK BIT(29) ++#define RX12_NO_CPU_DSCP_INT_MASK BIT(28) ++#define RX11_NO_CPU_DSCP_INT_MASK BIT(27) ++#define RX10_NO_CPU_DSCP_INT_MASK BIT(26) ++#define RX9_NO_CPU_DSCP_INT_MASK BIT(25) ++#define RX8_NO_CPU_DSCP_INT_MASK BIT(24) ++#define RX7_NO_CPU_DSCP_INT_MASK BIT(23) ++#define RX6_NO_CPU_DSCP_INT_MASK BIT(22) ++#define RX5_NO_CPU_DSCP_INT_MASK BIT(21) ++#define RX4_NO_CPU_DSCP_INT_MASK BIT(20) ++#define RX3_NO_CPU_DSCP_INT_MASK BIT(19) ++#define RX2_NO_CPU_DSCP_INT_MASK BIT(18) ++#define RX1_NO_CPU_DSCP_INT_MASK BIT(17) ++#define RX0_NO_CPU_DSCP_INT_MASK BIT(16) ++#define RX15_DONE_INT_MASK BIT(15) ++#define RX14_DONE_INT_MASK BIT(14) ++#define RX13_DONE_INT_MASK BIT(13) ++#define RX12_DONE_INT_MASK BIT(12) ++#define RX11_DONE_INT_MASK BIT(11) ++#define RX10_DONE_INT_MASK BIT(10) ++#define RX9_DONE_INT_MASK BIT(9) ++#define RX8_DONE_INT_MASK BIT(8) ++#define RX7_DONE_INT_MASK BIT(7) ++#define RX6_DONE_INT_MASK BIT(6) ++#define RX5_DONE_INT_MASK BIT(5) ++#define RX4_DONE_INT_MASK BIT(4) ++#define RX3_DONE_INT_MASK BIT(3) ++#define RX2_DONE_INT_MASK BIT(2) ++#define RX1_DONE_INT_MASK BIT(1) ++#define RX0_DONE_INT_MASK BIT(0) ++ ++#define RX_DONE_INT_MASK \ ++ (RX0_DONE_INT_MASK | RX1_DONE_INT_MASK | \ ++ RX2_DONE_INT_MASK | RX3_DONE_INT_MASK | \ ++ RX4_DONE_INT_MASK | RX7_DONE_INT_MASK | \ ++ RX8_DONE_INT_MASK | RX9_DONE_INT_MASK | \ ++ RX15_DONE_INT_MASK) ++#define INT_IDX1_MASK \ ++ (RX_DONE_INT_MASK | \ ++ RX0_NO_CPU_DSCP_INT_MASK | RX1_NO_CPU_DSCP_INT_MASK | \ ++ RX2_NO_CPU_DSCP_INT_MASK | RX3_NO_CPU_DSCP_INT_MASK | \ ++ RX4_NO_CPU_DSCP_INT_MASK | RX7_NO_CPU_DSCP_INT_MASK | \ ++ RX8_NO_CPU_DSCP_INT_MASK | RX9_NO_CPU_DSCP_INT_MASK | \ ++ RX15_NO_CPU_DSCP_INT_MASK) ++ ++/* QDMA_CSR_INT_ENABLE5 */ ++#define TX31_COHERENT_INT_MASK BIT(31) ++#define TX30_COHERENT_INT_MASK BIT(30) ++#define TX29_COHERENT_INT_MASK BIT(29) ++#define TX28_COHERENT_INT_MASK BIT(28) ++#define TX27_COHERENT_INT_MASK BIT(27) ++#define TX26_COHERENT_INT_MASK BIT(26) ++#define TX25_COHERENT_INT_MASK BIT(25) ++#define TX24_COHERENT_INT_MASK BIT(24) ++#define TX23_COHERENT_INT_MASK BIT(23) ++#define TX22_COHERENT_INT_MASK BIT(22) ++#define TX21_COHERENT_INT_MASK BIT(21) ++#define TX20_COHERENT_INT_MASK BIT(20) ++#define TX19_COHERENT_INT_MASK BIT(19) ++#define TX18_COHERENT_INT_MASK BIT(18) ++#define TX17_COHERENT_INT_MASK BIT(17) ++#define TX16_COHERENT_INT_MASK BIT(16) ++#define TX15_COHERENT_INT_MASK BIT(15) ++#define TX14_COHERENT_INT_MASK BIT(14) ++#define TX13_COHERENT_INT_MASK BIT(13) ++#define TX12_COHERENT_INT_MASK BIT(12) ++#define TX11_COHERENT_INT_MASK BIT(11) ++#define TX10_COHERENT_INT_MASK BIT(10) ++#define TX9_COHERENT_INT_MASK BIT(9) ++#define TX8_COHERENT_INT_MASK BIT(8) ++ ++#define INT_IDX4_MASK \ ++ (TX8_COHERENT_INT_MASK | TX9_COHERENT_INT_MASK | \ ++ TX10_COHERENT_INT_MASK | TX11_COHERENT_INT_MASK | \ ++ TX12_COHERENT_INT_MASK | TX13_COHERENT_INT_MASK | \ ++ TX14_COHERENT_INT_MASK | TX15_COHERENT_INT_MASK | \ ++ TX16_COHERENT_INT_MASK | TX17_COHERENT_INT_MASK | \ ++ TX18_COHERENT_INT_MASK | TX19_COHERENT_INT_MASK | \ ++ TX20_COHERENT_INT_MASK | TX21_COHERENT_INT_MASK | \ ++ TX22_COHERENT_INT_MASK | TX23_COHERENT_INT_MASK | \ ++ TX24_COHERENT_INT_MASK | TX25_COHERENT_INT_MASK | \ ++ TX26_COHERENT_INT_MASK | TX27_COHERENT_INT_MASK | \ ++ TX28_COHERENT_INT_MASK | TX29_COHERENT_INT_MASK | \ ++ TX30_COHERENT_INT_MASK | TX31_COHERENT_INT_MASK) ++ ++#define REG_TX_IRQ_BASE(_n) ((_n) ? 0x0048 : 0x0050) ++ ++#define REG_TX_IRQ_CFG(_n) ((_n) ? 0x004c : 0x0054) ++#define TX_IRQ_THR_MASK GENMASK(27, 16) ++#define TX_IRQ_DEPTH_MASK GENMASK(11, 0) ++ ++#define REG_IRQ_CLEAR_LEN(_n) ((_n) ? 0x0064 : 0x0058) ++#define IRQ_CLEAR_LEN_MASK GENMASK(7, 0) ++ ++#define REG_IRQ_STATUS(_n) ((_n) ? 0x0068 : 0x005c) ++#define IRQ_ENTRY_LEN_MASK GENMASK(27, 16) ++#define IRQ_HEAD_IDX_MASK GENMASK(11, 0) ++ ++#define REG_TX_RING_BASE(_n) \ ++ (((_n) < 8) ? 0x0100 + ((_n) << 5) : 0x0b00 + (((_n) - 8) << 5)) ++ ++#define REG_TX_RING_BLOCKING(_n) \ ++ (((_n) < 8) ? 0x0104 + ((_n) << 5) : 0x0b04 + (((_n) - 8) << 5)) ++ ++#define TX_RING_IRQ_BLOCKING_MAP_MASK BIT(6) ++#define TX_RING_IRQ_BLOCKING_CFG_MASK BIT(4) ++#define TX_RING_IRQ_BLOCKING_TX_DROP_EN_MASK BIT(2) ++#define TX_RING_IRQ_BLOCKING_MAX_TH_TXRING_EN_MASK BIT(1) ++#define TX_RING_IRQ_BLOCKING_MIN_TH_TXRING_EN_MASK BIT(0) ++ ++#define REG_TX_CPU_IDX(_n) \ ++ (((_n) < 8) ? 0x0108 + ((_n) << 5) : 0x0b08 + (((_n) - 8) << 5)) ++ ++#define TX_RING_CPU_IDX_MASK GENMASK(15, 0) ++ ++#define REG_TX_DMA_IDX(_n) \ ++ (((_n) < 8) ? 0x010c + ((_n) << 5) : 0x0b0c + (((_n) - 8) << 5)) ++ ++#define TX_RING_DMA_IDX_MASK GENMASK(15, 0) ++ ++#define IRQ_RING_IDX_MASK GENMASK(20, 16) ++#define IRQ_DESC_IDX_MASK GENMASK(15, 0) ++ ++#define REG_RX_RING_BASE(_n) \ ++ (((_n) < 16) ? 0x0200 + ((_n) << 5) : 0x0e00 + (((_n) - 16) << 5)) ++ ++#define REG_RX_RING_SIZE(_n) \ ++ (((_n) < 16) ? 0x0204 + ((_n) << 5) : 0x0e04 + (((_n) - 16) << 5)) ++ ++#define RX_RING_THR_MASK GENMASK(31, 16) ++#define RX_RING_SIZE_MASK GENMASK(15, 0) ++ ++#define REG_RX_CPU_IDX(_n) \ ++ (((_n) < 16) ? 0x0208 + ((_n) << 5) : 0x0e08 + (((_n) - 16) << 5)) ++ ++#define RX_RING_CPU_IDX_MASK GENMASK(15, 0) ++ ++#define REG_RX_DMA_IDX(_n) \ ++ (((_n) < 16) ? 0x020c + ((_n) << 5) : 0x0e0c + (((_n) - 16) << 5)) ++ ++#define REG_RX_DELAY_INT_IDX(_n) \ ++ (((_n) < 16) ? 0x0210 + ((_n) << 5) : 0x0e10 + (((_n) - 16) << 5)) ++ ++#define RX_DELAY_INT_MASK GENMASK(15, 0) ++ ++#define RX_RING_DMA_IDX_MASK GENMASK(15, 0) ++ ++#define REG_INGRESS_TRTCM_CFG 0x0070 ++#define INGRESS_TRTCM_EN_MASK BIT(31) ++#define INGRESS_TRTCM_MODE_MASK BIT(30) ++#define INGRESS_SLOW_TICK_RATIO_MASK GENMASK(29, 16) ++#define INGRESS_FAST_TICK_MASK GENMASK(15, 0) ++ ++#define REG_QUEUE_CLOSE_CFG(_n) (0x00a0 + ((_n) & 0xfc)) ++#define TXQ_DISABLE_CHAN_QUEUE_MASK(_n, _m) BIT((_m) + (((_n) & 0x3) << 3)) ++ ++#define REG_TXQ_DIS_CFG_BASE(_n) ((_n) ? 0x20a0 : 0x00a0) ++#define REG_TXQ_DIS_CFG(_n, _m) (REG_TXQ_DIS_CFG_BASE((_n)) + (_m) << 2) ++ ++#define REG_CNTR_CFG(_n) (0x0400 + ((_n) << 3)) ++#define CNTR_EN_MASK BIT(31) ++#define CNTR_ALL_CHAN_EN_MASK BIT(30) ++#define CNTR_ALL_QUEUE_EN_MASK BIT(29) ++#define CNTR_ALL_DSCP_RING_EN_MASK BIT(28) ++#define CNTR_SRC_MASK GENMASK(27, 24) ++#define CNTR_DSCP_RING_MASK GENMASK(20, 16) ++#define CNTR_CHAN_MASK GENMASK(7, 3) ++#define CNTR_QUEUE_MASK GENMASK(2, 0) ++ ++#define REG_CNTR_VAL(_n) (0x0404 + ((_n) << 3)) ++ ++#define REG_LMGR_INIT_CFG 0x1000 ++#define LMGR_INIT_START BIT(31) ++#define LMGR_SRAM_MODE_MASK BIT(30) ++#define HW_FWD_PKTSIZE_OVERHEAD_MASK GENMASK(27, 20) ++#define HW_FWD_DESC_NUM_MASK GENMASK(16, 0) ++ ++#define REG_FWD_DSCP_LOW_THR 0x1004 ++#define FWD_DSCP_LOW_THR_MASK GENMASK(17, 0) ++ ++#define REG_EGRESS_RATE_METER_CFG 0x100c ++#define EGRESS_RATE_METER_EN_MASK BIT(31) ++#define EGRESS_RATE_METER_EQ_RATE_EN_MASK BIT(17) ++#define EGRESS_RATE_METER_WINDOW_SZ_MASK GENMASK(16, 12) ++#define EGRESS_RATE_METER_TIMESLICE_MASK GENMASK(10, 0) ++ ++#define REG_EGRESS_TRTCM_CFG 0x1010 ++#define EGRESS_TRTCM_EN_MASK BIT(31) ++#define EGRESS_TRTCM_MODE_MASK BIT(30) ++#define EGRESS_SLOW_TICK_RATIO_MASK GENMASK(29, 16) ++#define EGRESS_FAST_TICK_MASK GENMASK(15, 0) ++ ++#define TRTCM_PARAM_RW_MASK BIT(31) ++#define TRTCM_PARAM_RW_DONE_MASK BIT(30) ++#define TRTCM_PARAM_TYPE_MASK GENMASK(29, 28) ++#define TRTCM_METER_GROUP_MASK GENMASK(27, 26) ++#define TRTCM_PARAM_INDEX_MASK GENMASK(23, 17) ++#define TRTCM_PARAM_RATE_TYPE_MASK BIT(16) ++ ++#define REG_TRTCM_CFG_PARAM(_n) ((_n) + 0x4) ++#define REG_TRTCM_DATA_LOW(_n) ((_n) + 0x8) ++#define REG_TRTCM_DATA_HIGH(_n) ((_n) + 0xc) ++ ++#define REG_TXWRR_MODE_CFG 0x1020 ++#define TWRR_WEIGHT_SCALE_MASK BIT(31) ++#define TWRR_WEIGHT_BASE_MASK BIT(3) ++ ++#define REG_TXWRR_WEIGHT_CFG 0x1024 ++#define TWRR_RW_CMD_MASK BIT(31) ++#define TWRR_RW_CMD_DONE BIT(30) ++#define TWRR_CHAN_IDX_MASK GENMASK(23, 19) ++#define TWRR_QUEUE_IDX_MASK GENMASK(18, 16) ++#define TWRR_VALUE_MASK GENMASK(15, 0) ++ ++#define REG_PSE_BUF_USAGE_CFG 0x1028 ++#define PSE_BUF_ESTIMATE_EN_MASK BIT(29) ++ ++#define REG_CHAN_QOS_MODE(_n) (0x1040 + ((_n) << 2)) ++#define CHAN_QOS_MODE_MASK(_n) GENMASK(2 + ((_n) << 2), (_n) << 2) ++ ++#define REG_GLB_TRTCM_CFG 0x1080 ++#define GLB_TRTCM_EN_MASK BIT(31) ++#define GLB_TRTCM_MODE_MASK BIT(30) ++#define GLB_SLOW_TICK_RATIO_MASK GENMASK(29, 16) ++#define GLB_FAST_TICK_MASK GENMASK(15, 0) ++ ++#define REG_TXQ_CNGST_CFG 0x10a0 ++#define TXQ_CNGST_DROP_EN BIT(31) ++#define TXQ_CNGST_DEI_DROP_EN BIT(30) ++ ++#define REG_SLA_TRTCM_CFG 0x1150 ++#define SLA_TRTCM_EN_MASK BIT(31) ++#define SLA_TRTCM_MODE_MASK BIT(30) ++#define SLA_SLOW_TICK_RATIO_MASK GENMASK(29, 16) ++#define SLA_FAST_TICK_MASK GENMASK(15, 0) ++ ++/* CTRL */ ++#define QDMA_DESC_DONE_MASK BIT(31) ++#define QDMA_DESC_DROP_MASK BIT(30) /* tx: drop - rx: overflow */ ++#define QDMA_DESC_MORE_MASK BIT(29) /* more SG elements */ ++#define QDMA_DESC_DEI_MASK BIT(25) ++#define QDMA_DESC_NO_DROP_MASK BIT(24) ++#define QDMA_DESC_LEN_MASK GENMASK(15, 0) ++/* DATA */ ++#define QDMA_DESC_NEXT_ID_MASK GENMASK(15, 0) ++/* TX MSG0 */ ++#define QDMA_ETH_TXMSG_MIC_IDX_MASK BIT(30) ++#define QDMA_ETH_TXMSG_SP_TAG_MASK GENMASK(29, 14) ++#define QDMA_ETH_TXMSG_ICO_MASK BIT(13) ++#define QDMA_ETH_TXMSG_UCO_MASK BIT(12) ++#define QDMA_ETH_TXMSG_TCO_MASK BIT(11) ++#define QDMA_ETH_TXMSG_TSO_MASK BIT(10) ++#define QDMA_ETH_TXMSG_FAST_MASK BIT(9) ++#define QDMA_ETH_TXMSG_OAM_MASK BIT(8) ++#define QDMA_ETH_TXMSG_CHAN_MASK GENMASK(7, 3) ++#define QDMA_ETH_TXMSG_QUEUE_MASK GENMASK(2, 0) ++/* TX MSG1 */ ++#define QDMA_ETH_TXMSG_NO_DROP BIT(31) ++#define QDMA_ETH_TXMSG_METER_MASK GENMASK(30, 24) /* 0x7f no meters */ ++#define QDMA_ETH_TXMSG_FPORT_MASK GENMASK(23, 20) ++#define QDMA_ETH_TXMSG_NBOQ_MASK GENMASK(19, 15) ++#define QDMA_ETH_TXMSG_HWF_MASK BIT(14) ++#define QDMA_ETH_TXMSG_HOP_MASK BIT(13) ++#define QDMA_ETH_TXMSG_PTP_MASK BIT(12) ++#define QDMA_ETH_TXMSG_ACNT_G1_MASK GENMASK(10, 6) /* 0x1f do not count */ ++#define QDMA_ETH_TXMSG_ACNT_G0_MASK GENMASK(5, 0) /* 0x3f do not count */ ++ ++/* RX MSG1 */ ++#define QDMA_ETH_RXMSG_DEI_MASK BIT(31) ++#define QDMA_ETH_RXMSG_IP6_MASK BIT(30) ++#define QDMA_ETH_RXMSG_IP4_MASK BIT(29) ++#define QDMA_ETH_RXMSG_IP4F_MASK BIT(28) ++#define QDMA_ETH_RXMSG_L4_VALID_MASK BIT(27) ++#define QDMA_ETH_RXMSG_L4F_MASK BIT(26) ++#define QDMA_ETH_RXMSG_SPORT_MASK GENMASK(25, 21) ++#define QDMA_ETH_RXMSG_CRSN_MASK GENMASK(20, 16) ++#define QDMA_ETH_RXMSG_PPE_ENTRY_MASK GENMASK(15, 0) ++ ++struct airoha_qdma_desc { ++ __le32 rsv; ++ __le32 ctrl; ++ __le32 addr; ++ __le32 data; ++ __le32 msg0; ++ __le32 msg1; ++ __le32 msg2; ++ __le32 msg3; ++}; ++ ++/* CTRL0 */ ++#define QDMA_FWD_DESC_CTX_MASK BIT(31) ++#define QDMA_FWD_DESC_RING_MASK GENMASK(30, 28) ++#define QDMA_FWD_DESC_IDX_MASK GENMASK(27, 16) ++#define QDMA_FWD_DESC_LEN_MASK GENMASK(15, 0) ++/* CTRL1 */ ++#define QDMA_FWD_DESC_FIRST_IDX_MASK GENMASK(15, 0) ++/* CTRL2 */ ++#define QDMA_FWD_DESC_MORE_PKT_NUM_MASK GENMASK(2, 0) ++ ++struct airoha_qdma_fwd_desc { ++ __le32 addr; ++ __le32 ctrl0; ++ __le32 ctrl1; ++ __le32 ctrl2; ++ __le32 msg0; ++ __le32 msg1; ++ __le32 rsv0; ++ __le32 rsv1; ++}; ++ ++#endif /* AIROHA_REGS_H */ diff --git a/target/linux/airoha/patches-6.6/048-05-v6.15-net-airoha-Move-DSA-tag-in-DMA-descriptor.patch b/target/linux/airoha/patches-6.6/048-05-v6.15-net-airoha-Move-DSA-tag-in-DMA-descriptor.patch new file mode 100644 index 00000000000000..61e889f3d2ad99 --- /dev/null +++ b/target/linux/airoha/patches-6.6/048-05-v6.15-net-airoha-Move-DSA-tag-in-DMA-descriptor.patch @@ -0,0 +1,287 @@ +From af3cf757d5c99011b9b94ea8d78aeaccc0153fdc Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Fri, 28 Feb 2025 11:54:13 +0100 +Subject: [PATCH 05/15] net: airoha: Move DSA tag in DMA descriptor + +Packet Processor Engine (PPE) module reads DSA tags from the DMA descriptor +and requires untagged DSA packets to properly parse them. Move DSA tag +in the DMA descriptor on TX side and read DSA tag from DMA descriptor +on RX side. In order to avoid skb reallocation, store tag in skb_dst on +RX side. +This is a preliminary patch to enable netfilter flowtable hw offloading +on EN7581 SoC. + +Tested-by: Sayantan Nandy +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Paolo Abeni +--- + drivers/net/ethernet/airoha/airoha_eth.c | 125 ++++++++++++++++++++-- + drivers/net/ethernet/airoha/airoha_eth.h | 7 ++ + drivers/net/ethernet/airoha/airoha_regs.h | 2 + + 3 files changed, 128 insertions(+), 6 deletions(-) + +--- a/drivers/net/ethernet/airoha/airoha_eth.c ++++ b/drivers/net/ethernet/airoha/airoha_eth.c +@@ -9,6 +9,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -656,6 +657,7 @@ static int airoha_qdma_rx_process(struct + struct airoha_qdma_desc *desc = &q->desc[q->tail]; + dma_addr_t dma_addr = le32_to_cpu(desc->addr); + u32 desc_ctrl = le32_to_cpu(desc->ctrl); ++ struct airoha_gdm_port *port; + struct sk_buff *skb; + int len, p; + +@@ -683,6 +685,7 @@ static int airoha_qdma_rx_process(struct + continue; + } + ++ port = eth->ports[p]; + skb = napi_build_skb(e->buf, q->buf_size); + if (!skb) { + page_pool_put_full_page(q->page_pool, +@@ -694,10 +697,26 @@ static int airoha_qdma_rx_process(struct + skb_reserve(skb, 2); + __skb_put(skb, len); + skb_mark_for_recycle(skb); +- skb->dev = eth->ports[p]->dev; ++ skb->dev = port->dev; + skb->protocol = eth_type_trans(skb, skb->dev); + skb->ip_summed = CHECKSUM_UNNECESSARY; + skb_record_rx_queue(skb, qid); ++ ++ if (netdev_uses_dsa(port->dev)) { ++ /* PPE module requires untagged packets to work ++ * properly and it provides DSA port index via the ++ * DMA descriptor. Report DSA tag to the DSA stack ++ * via skb dst info. ++ */ ++ u32 sptag = FIELD_GET(QDMA_ETH_RXMSG_SPTAG, ++ le32_to_cpu(desc->msg0)); ++ ++ if (sptag < ARRAY_SIZE(port->dsa_meta) && ++ port->dsa_meta[sptag]) ++ skb_dst_set_noref(skb, ++ &port->dsa_meta[sptag]->dst); ++ } ++ + napi_gro_receive(&q->napi, skb); + + done++; +@@ -1637,25 +1656,76 @@ static u16 airoha_dev_select_queue(struc + return queue < dev->num_tx_queues ? queue : 0; + } + ++static u32 airoha_get_dsa_tag(struct sk_buff *skb, struct net_device *dev) ++{ ++#if IS_ENABLED(CONFIG_NET_DSA) ++ struct ethhdr *ehdr; ++ struct dsa_port *dp; ++ u8 xmit_tpid; ++ u16 tag; ++ ++ if (!netdev_uses_dsa(dev)) ++ return 0; ++ ++ dp = dev->dsa_ptr; ++ if (IS_ERR(dp)) ++ return 0; ++ ++ if (dp->tag_ops->proto != DSA_TAG_PROTO_MTK) ++ return 0; ++ ++ if (skb_cow_head(skb, 0)) ++ return 0; ++ ++ ehdr = (struct ethhdr *)skb->data; ++ tag = be16_to_cpu(ehdr->h_proto); ++ xmit_tpid = tag >> 8; ++ ++ switch (xmit_tpid) { ++ case MTK_HDR_XMIT_TAGGED_TPID_8100: ++ ehdr->h_proto = cpu_to_be16(ETH_P_8021Q); ++ tag &= ~(MTK_HDR_XMIT_TAGGED_TPID_8100 << 8); ++ break; ++ case MTK_HDR_XMIT_TAGGED_TPID_88A8: ++ ehdr->h_proto = cpu_to_be16(ETH_P_8021AD); ++ tag &= ~(MTK_HDR_XMIT_TAGGED_TPID_88A8 << 8); ++ break; ++ default: ++ /* PPE module requires untagged DSA packets to work properly, ++ * so move DSA tag to DMA descriptor. ++ */ ++ memmove(skb->data + MTK_HDR_LEN, skb->data, 2 * ETH_ALEN); ++ __skb_pull(skb, MTK_HDR_LEN); ++ break; ++ } ++ ++ return tag; ++#else ++ return 0; ++#endif ++} ++ + static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb, + struct net_device *dev) + { + struct airoha_gdm_port *port = netdev_priv(dev); +- u32 nr_frags = 1 + skb_shinfo(skb)->nr_frags; +- u32 msg0, msg1, len = skb_headlen(skb); + struct airoha_qdma *qdma = port->qdma; ++ u32 nr_frags, tag, msg0, msg1, len; + struct netdev_queue *txq; + struct airoha_queue *q; +- void *data = skb->data; ++ void *data; + int i, qid; + u16 index; + u8 fport; + + qid = skb_get_queue_mapping(skb) % ARRAY_SIZE(qdma->q_tx); ++ tag = airoha_get_dsa_tag(skb, dev); ++ + msg0 = FIELD_PREP(QDMA_ETH_TXMSG_CHAN_MASK, + qid / AIROHA_NUM_QOS_QUEUES) | + FIELD_PREP(QDMA_ETH_TXMSG_QUEUE_MASK, +- qid % AIROHA_NUM_QOS_QUEUES); ++ qid % AIROHA_NUM_QOS_QUEUES) | ++ FIELD_PREP(QDMA_ETH_TXMSG_SP_TAG_MASK, tag); + if (skb->ip_summed == CHECKSUM_PARTIAL) + msg0 |= FIELD_PREP(QDMA_ETH_TXMSG_TCO_MASK, 1) | + FIELD_PREP(QDMA_ETH_TXMSG_UCO_MASK, 1) | +@@ -1686,6 +1756,8 @@ static netdev_tx_t airoha_dev_xmit(struc + spin_lock_bh(&q->lock); + + txq = netdev_get_tx_queue(dev, qid); ++ nr_frags = 1 + skb_shinfo(skb)->nr_frags; ++ + if (q->queued + nr_frags > q->ndesc) { + /* not enough space in the queue */ + netif_tx_stop_queue(txq); +@@ -1693,7 +1765,10 @@ static netdev_tx_t airoha_dev_xmit(struc + return NETDEV_TX_BUSY; + } + ++ len = skb_headlen(skb); ++ data = skb->data; + index = q->head; ++ + for (i = 0; i < nr_frags; i++) { + struct airoha_qdma_desc *desc = &q->desc[index]; + struct airoha_queue_entry *e = &q->entry[index]; +@@ -2224,6 +2299,37 @@ static const struct ethtool_ops airoha_e + .get_rmon_stats = airoha_ethtool_get_rmon_stats, + }; + ++static int airoha_metadata_dst_alloc(struct airoha_gdm_port *port) ++{ ++ int i; ++ ++ for (i = 0; i < ARRAY_SIZE(port->dsa_meta); i++) { ++ struct metadata_dst *md_dst; ++ ++ md_dst = metadata_dst_alloc(0, METADATA_HW_PORT_MUX, ++ GFP_KERNEL); ++ if (!md_dst) ++ return -ENOMEM; ++ ++ md_dst->u.port_info.port_id = i; ++ port->dsa_meta[i] = md_dst; ++ } ++ ++ return 0; ++} ++ ++static void airoha_metadata_dst_free(struct airoha_gdm_port *port) ++{ ++ int i; ++ ++ for (i = 0; i < ARRAY_SIZE(port->dsa_meta); i++) { ++ if (!port->dsa_meta[i]) ++ continue; ++ ++ metadata_dst_free(port->dsa_meta[i]); ++ } ++} ++ + static int airoha_alloc_gdm_port(struct airoha_eth *eth, struct device_node *np) + { + const __be32 *id_ptr = of_get_property(np, "reg", NULL); +@@ -2296,6 +2402,10 @@ static int airoha_alloc_gdm_port(struct + port->id = id; + eth->ports[index] = port; + ++ err = airoha_metadata_dst_alloc(port); ++ if (err) ++ return err; ++ + return register_netdev(dev); + } + +@@ -2388,8 +2498,10 @@ error_hw_cleanup: + for (i = 0; i < ARRAY_SIZE(eth->ports); i++) { + struct airoha_gdm_port *port = eth->ports[i]; + +- if (port && port->dev->reg_state == NETREG_REGISTERED) ++ if (port && port->dev->reg_state == NETREG_REGISTERED) { + unregister_netdev(port->dev); ++ airoha_metadata_dst_free(port); ++ } + } + free_netdev(eth->napi_dev); + platform_set_drvdata(pdev, NULL); +@@ -2415,6 +2527,7 @@ static void airoha_remove(struct platfor + + airoha_dev_stop(port->dev); + unregister_netdev(port->dev); ++ airoha_metadata_dst_free(port); + } + free_netdev(eth->napi_dev); + +--- a/drivers/net/ethernet/airoha/airoha_eth.h ++++ b/drivers/net/ethernet/airoha/airoha_eth.h +@@ -15,6 +15,7 @@ + + #define AIROHA_MAX_NUM_GDM_PORTS 1 + #define AIROHA_MAX_NUM_QDMA 2 ++#define AIROHA_MAX_DSA_PORTS 7 + #define AIROHA_MAX_NUM_RSTS 3 + #define AIROHA_MAX_NUM_XSI_RSTS 5 + #define AIROHA_MAX_MTU 2000 +@@ -43,6 +44,10 @@ + #define QDMA_METER_IDX(_n) ((_n) & 0xff) + #define QDMA_METER_GROUP(_n) (((_n) >> 8) & 0x3) + ++#define MTK_HDR_LEN 4 ++#define MTK_HDR_XMIT_TAGGED_TPID_8100 1 ++#define MTK_HDR_XMIT_TAGGED_TPID_88A8 2 ++ + enum { + QDMA_INT_REG_IDX0, + QDMA_INT_REG_IDX1, +@@ -231,6 +236,8 @@ struct airoha_gdm_port { + /* qos stats counters */ + u64 cpu_tx_packets; + u64 fwd_tx_packets; ++ ++ struct metadata_dst *dsa_meta[AIROHA_MAX_DSA_PORTS]; + }; + + struct airoha_eth { +--- a/drivers/net/ethernet/airoha/airoha_regs.h ++++ b/drivers/net/ethernet/airoha/airoha_regs.h +@@ -624,6 +624,8 @@ + #define QDMA_ETH_TXMSG_ACNT_G1_MASK GENMASK(10, 6) /* 0x1f do not count */ + #define QDMA_ETH_TXMSG_ACNT_G0_MASK GENMASK(5, 0) /* 0x3f do not count */ + ++/* RX MSG0 */ ++#define QDMA_ETH_RXMSG_SPTAG GENMASK(21, 14) + /* RX MSG1 */ + #define QDMA_ETH_RXMSG_DEI_MASK BIT(31) + #define QDMA_ETH_RXMSG_IP6_MASK BIT(30) diff --git a/target/linux/airoha/patches-6.6/048-06-v6.15-net-dsa-mt7530-Enable-Rx-sptag-for-EN7581-SoC.patch b/target/linux/airoha/patches-6.6/048-06-v6.15-net-dsa-mt7530-Enable-Rx-sptag-for-EN7581-SoC.patch new file mode 100644 index 00000000000000..27956d553af05a --- /dev/null +++ b/target/linux/airoha/patches-6.6/048-06-v6.15-net-dsa-mt7530-Enable-Rx-sptag-for-EN7581-SoC.patch @@ -0,0 +1,46 @@ +From ab667db1e6014634c6607ebdddc16c1b8394a935 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Fri, 28 Feb 2025 11:54:14 +0100 +Subject: [PATCH 06/15] net: dsa: mt7530: Enable Rx sptag for EN7581 SoC + +Packet Processor Engine (PPE) module used for hw acceleration on EN7581 +mac block, in order to properly parse packets, requires DSA untagged +packets on TX side and read DSA tag from DMA descriptor on RX side. +For this reason, enable RX Special Tag (SPTAG) for EN7581 SoC. +This is a preliminary patch to enable netfilter flowtable hw offloading +on EN7581 SoC. + +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Paolo Abeni +--- + drivers/net/dsa/mt7530.c | 5 +++++ + drivers/net/dsa/mt7530.h | 4 ++++ + 2 files changed, 9 insertions(+) + +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -2588,6 +2588,11 @@ mt7531_setup_common(struct dsa_switch *d + /* Allow mirroring frames received on the local port (monitor port). */ + mt7530_set(priv, MT753X_AGC, LOCAL_EN); + ++ /* Enable Special Tag for rx frames */ ++ if (priv->id == ID_EN7581) ++ mt7530_write(priv, MT753X_CPORT_SPTAG_CFG, ++ CPORT_SW2FE_STAG_EN | CPORT_FE2SW_STAG_EN); ++ + /* Flush the FDB table */ + ret = mt7530_fdb_cmd(priv, MT7530_FDB_FLUSH, NULL); + if (ret < 0) +--- a/drivers/net/dsa/mt7530.h ++++ b/drivers/net/dsa/mt7530.h +@@ -615,6 +615,10 @@ enum mt7531_xtal_fsel { + #define MT7531_GPIO12_RG_RXD3_MASK GENMASK(19, 16) + #define MT7531_EXT_P_MDIO_12 (2 << 16) + ++#define MT753X_CPORT_SPTAG_CFG 0x7c10 ++#define CPORT_SW2FE_STAG_EN BIT(1) ++#define CPORT_FE2SW_STAG_EN BIT(0) ++ + /* Registers for LED GPIO control (MT7530 only) + * All registers follow this pattern: + * [ 2: 0] port 0 diff --git a/target/linux/airoha/patches-6.6/048-07-v6.15-net-airoha-Enable-support-for-multiple-net_devices.patch b/target/linux/airoha/patches-6.6/048-07-v6.15-net-airoha-Enable-support-for-multiple-net_devices.patch new file mode 100644 index 00000000000000..af4fa78c90958c --- /dev/null +++ b/target/linux/airoha/patches-6.6/048-07-v6.15-net-airoha-Enable-support-for-multiple-net_devices.patch @@ -0,0 +1,144 @@ +From 80369686737fe07c233a1152da0b84372dabdcd6 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Fri, 28 Feb 2025 11:54:15 +0100 +Subject: [PATCH 07/15] net: airoha: Enable support for multiple net_devices + +In the current codebase airoha_eth driver supports just a single +net_device connected to the Packet Switch Engine (PSE) lan port (GDM1). +As shown in commit 23020f049327 ("net: airoha: Introduce ethernet +support for EN7581 SoC"), PSE can switch packets between four GDM ports. +Enable the capability to create a net_device for each GDM port of the +PSE module. Moreover, since the QDMA blocks can be shared between +net_devices, do not stop TX/RX DMA in airoha_dev_stop() if there are +active net_devices for this QDMA block. +This is a preliminary patch to enable flowtable hw offloading for EN7581 +SoC. + +Co-developed-by: Christian Marangi +Signed-off-by: Christian Marangi +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Paolo Abeni +--- + drivers/net/ethernet/airoha/airoha_eth.c | 35 ++++++++++++++---------- + drivers/net/ethernet/airoha/airoha_eth.h | 4 ++- + 2 files changed, 24 insertions(+), 15 deletions(-) + +--- a/drivers/net/ethernet/airoha/airoha_eth.c ++++ b/drivers/net/ethernet/airoha/airoha_eth.c +@@ -1563,6 +1563,7 @@ static int airoha_dev_open(struct net_de + airoha_qdma_set(qdma, REG_QDMA_GLOBAL_CFG, + GLOBAL_CFG_TX_DMA_EN_MASK | + GLOBAL_CFG_RX_DMA_EN_MASK); ++ atomic_inc(&qdma->users); + + return 0; + } +@@ -1578,16 +1579,20 @@ static int airoha_dev_stop(struct net_de + if (err) + return err; + +- airoha_qdma_clear(qdma, REG_QDMA_GLOBAL_CFG, +- GLOBAL_CFG_TX_DMA_EN_MASK | +- GLOBAL_CFG_RX_DMA_EN_MASK); ++ for (i = 0; i < ARRAY_SIZE(qdma->q_tx); i++) ++ netdev_tx_reset_subqueue(dev, i); + +- for (i = 0; i < ARRAY_SIZE(qdma->q_tx); i++) { +- if (!qdma->q_tx[i].ndesc) +- continue; ++ if (atomic_dec_and_test(&qdma->users)) { ++ airoha_qdma_clear(qdma, REG_QDMA_GLOBAL_CFG, ++ GLOBAL_CFG_TX_DMA_EN_MASK | ++ GLOBAL_CFG_RX_DMA_EN_MASK); ++ ++ for (i = 0; i < ARRAY_SIZE(qdma->q_tx); i++) { ++ if (!qdma->q_tx[i].ndesc) ++ continue; + +- airoha_qdma_cleanup_tx_queue(&qdma->q_tx[i]); +- netdev_tx_reset_subqueue(dev, i); ++ airoha_qdma_cleanup_tx_queue(&qdma->q_tx[i]); ++ } + } + + return 0; +@@ -2330,13 +2335,14 @@ static void airoha_metadata_dst_free(str + } + } + +-static int airoha_alloc_gdm_port(struct airoha_eth *eth, struct device_node *np) ++static int airoha_alloc_gdm_port(struct airoha_eth *eth, ++ struct device_node *np, int index) + { + const __be32 *id_ptr = of_get_property(np, "reg", NULL); + struct airoha_gdm_port *port; + struct airoha_qdma *qdma; + struct net_device *dev; +- int err, index; ++ int err, p; + u32 id; + + if (!id_ptr) { +@@ -2345,14 +2351,14 @@ static int airoha_alloc_gdm_port(struct + } + + id = be32_to_cpup(id_ptr); +- index = id - 1; ++ p = id - 1; + + if (!id || id > ARRAY_SIZE(eth->ports)) { + dev_err(eth->dev, "invalid gdm port id: %d\n", id); + return -EINVAL; + } + +- if (eth->ports[index]) { ++ if (eth->ports[p]) { + dev_err(eth->dev, "duplicate gdm port id: %d\n", id); + return -EINVAL; + } +@@ -2400,7 +2406,7 @@ static int airoha_alloc_gdm_port(struct + port->qdma = qdma; + port->dev = dev; + port->id = id; +- eth->ports[index] = port; ++ eth->ports[p] = port; + + err = airoha_metadata_dst_alloc(port); + if (err) +@@ -2472,6 +2478,7 @@ static int airoha_probe(struct platform_ + for (i = 0; i < ARRAY_SIZE(eth->qdma); i++) + airoha_qdma_start_napi(ð->qdma[i]); + ++ i = 0; + for_each_child_of_node(pdev->dev.of_node, np) { + if (!of_device_is_compatible(np, "airoha,eth-mac")) + continue; +@@ -2479,7 +2486,7 @@ static int airoha_probe(struct platform_ + if (!of_device_is_available(np)) + continue; + +- err = airoha_alloc_gdm_port(eth, np); ++ err = airoha_alloc_gdm_port(eth, np, i++); + if (err) { + of_node_put(np); + goto error_napi_stop; +--- a/drivers/net/ethernet/airoha/airoha_eth.h ++++ b/drivers/net/ethernet/airoha/airoha_eth.h +@@ -13,7 +13,7 @@ + #include + #include + +-#define AIROHA_MAX_NUM_GDM_PORTS 1 ++#define AIROHA_MAX_NUM_GDM_PORTS 4 + #define AIROHA_MAX_NUM_QDMA 2 + #define AIROHA_MAX_DSA_PORTS 7 + #define AIROHA_MAX_NUM_RSTS 3 +@@ -212,6 +212,8 @@ struct airoha_qdma { + u32 irqmask[QDMA_INT_REG_MAX]; + int irq; + ++ atomic_t users; ++ + struct airoha_tx_irq_queue q_tx_irq[AIROHA_NUM_TX_IRQ]; + + struct airoha_queue q_tx[AIROHA_NUM_TX_RING]; diff --git a/target/linux/airoha/patches-6.6/048-08-v6.15-net-airoha-Move-REG_GDM_FWD_CFG-initialization-in-ai.patch b/target/linux/airoha/patches-6.6/048-08-v6.15-net-airoha-Move-REG_GDM_FWD_CFG-initialization-in-ai.patch new file mode 100644 index 00000000000000..8bc0f856577cd4 --- /dev/null +++ b/target/linux/airoha/patches-6.6/048-08-v6.15-net-airoha-Move-REG_GDM_FWD_CFG-initialization-in-ai.patch @@ -0,0 +1,77 @@ +From 67fde5d58cd43d129a979e918ec9cd5d2e2fbcfb Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Fri, 28 Feb 2025 11:54:16 +0100 +Subject: [PATCH 08/15] net: airoha: Move REG_GDM_FWD_CFG() initialization in + airoha_dev_init() + +Move REG_GDM_FWD_CFG() register initialization in airoha_dev_init +routine. Moreover, always send traffic PPE module in order to be +processed by hw accelerator. +This is a preliminary patch to enable netfilter flowtable hw offloading +on EN7581 SoC. + +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Paolo Abeni +--- + drivers/net/ethernet/airoha/airoha_eth.c | 14 ++++---------- + 1 file changed, 4 insertions(+), 10 deletions(-) + +--- a/drivers/net/ethernet/airoha/airoha_eth.c ++++ b/drivers/net/ethernet/airoha/airoha_eth.c +@@ -107,25 +107,20 @@ static void airoha_set_gdm_port_fwd_cfg( + + static int airoha_set_gdm_port(struct airoha_eth *eth, int port, bool enable) + { +- u32 val = enable ? FE_PSE_PORT_PPE1 : FE_PSE_PORT_DROP; +- u32 vip_port, cfg_addr; ++ u32 vip_port; + + switch (port) { + case XSI_PCIE0_PORT: + vip_port = XSI_PCIE0_VIP_PORT_MASK; +- cfg_addr = REG_GDM_FWD_CFG(3); + break; + case XSI_PCIE1_PORT: + vip_port = XSI_PCIE1_VIP_PORT_MASK; +- cfg_addr = REG_GDM_FWD_CFG(3); + break; + case XSI_USB_PORT: + vip_port = XSI_USB_VIP_PORT_MASK; +- cfg_addr = REG_GDM_FWD_CFG(4); + break; + case XSI_ETH_PORT: + vip_port = XSI_ETH_VIP_PORT_MASK; +- cfg_addr = REG_GDM_FWD_CFG(4); + break; + default: + return -EINVAL; +@@ -139,8 +134,6 @@ static int airoha_set_gdm_port(struct ai + airoha_fe_clear(eth, REG_FE_IFC_PORT_EN, vip_port); + } + +- airoha_set_gdm_port_fwd_cfg(eth, cfg_addr, val); +- + return 0; + } + +@@ -177,8 +170,6 @@ static void airoha_fe_maccr_init(struct + airoha_fe_set(eth, REG_GDM_FWD_CFG(p), + GDM_TCP_CKSUM | GDM_UDP_CKSUM | GDM_IP4_CKSUM | + GDM_DROP_CRC_ERR); +- airoha_set_gdm_port_fwd_cfg(eth, REG_GDM_FWD_CFG(p), +- FE_PSE_PORT_CDM1); + airoha_fe_rmw(eth, REG_GDM_LEN_CFG(p), + GDM_SHORT_LEN_MASK | GDM_LONG_LEN_MASK, + FIELD_PREP(GDM_SHORT_LEN_MASK, 60) | +@@ -1615,8 +1606,11 @@ static int airoha_dev_set_macaddr(struct + static int airoha_dev_init(struct net_device *dev) + { + struct airoha_gdm_port *port = netdev_priv(dev); ++ struct airoha_eth *eth = port->qdma->eth; + + airoha_set_macaddr(port, dev->dev_addr); ++ airoha_set_gdm_port_fwd_cfg(eth, REG_GDM_FWD_CFG(port->id), ++ FE_PSE_PORT_PPE1); + + return 0; + } diff --git a/target/linux/airoha/patches-6.6/048-09-v6.15-net-airoha-Rename-airoha_set_gdm_port_fwd_cfg-in-air.patch b/target/linux/airoha/patches-6.6/048-09-v6.15-net-airoha-Rename-airoha_set_gdm_port_fwd_cfg-in-air.patch new file mode 100644 index 00000000000000..11f879de1c407f --- /dev/null +++ b/target/linux/airoha/patches-6.6/048-09-v6.15-net-airoha-Rename-airoha_set_gdm_port_fwd_cfg-in-air.patch @@ -0,0 +1,120 @@ +From c28b8375f6d02ef3b5e8c51234cc3f6d47d9fb7f Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Fri, 28 Feb 2025 11:54:17 +0100 +Subject: [PATCH 09/15] net: airoha: Rename airoha_set_gdm_port_fwd_cfg() in + airoha_set_vip_for_gdm_port() + +Rename airoha_set_gdm_port() in airoha_set_vip_for_gdm_port(). +Get rid of airoha_set_gdm_ports routine. + +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Paolo Abeni +--- + drivers/net/ethernet/airoha/airoha_eth.c | 49 ++++++------------------ + drivers/net/ethernet/airoha/airoha_eth.h | 8 ---- + 2 files changed, 11 insertions(+), 46 deletions(-) + +--- a/drivers/net/ethernet/airoha/airoha_eth.c ++++ b/drivers/net/ethernet/airoha/airoha_eth.c +@@ -105,25 +105,23 @@ static void airoha_set_gdm_port_fwd_cfg( + FIELD_PREP(GDM_UCFQ_MASK, val)); + } + +-static int airoha_set_gdm_port(struct airoha_eth *eth, int port, bool enable) ++static int airoha_set_vip_for_gdm_port(struct airoha_gdm_port *port, ++ bool enable) + { ++ struct airoha_eth *eth = port->qdma->eth; + u32 vip_port; + +- switch (port) { +- case XSI_PCIE0_PORT: ++ switch (port->id) { ++ case 3: ++ /* FIXME: handle XSI_PCIE1_PORT */ + vip_port = XSI_PCIE0_VIP_PORT_MASK; + break; +- case XSI_PCIE1_PORT: +- vip_port = XSI_PCIE1_VIP_PORT_MASK; +- break; +- case XSI_USB_PORT: +- vip_port = XSI_USB_VIP_PORT_MASK; +- break; +- case XSI_ETH_PORT: ++ case 4: ++ /* FIXME: handle XSI_USB_PORT */ + vip_port = XSI_ETH_VIP_PORT_MASK; + break; + default: +- return -EINVAL; ++ return 0; + } + + if (enable) { +@@ -137,31 +135,6 @@ static int airoha_set_gdm_port(struct ai + return 0; + } + +-static int airoha_set_gdm_ports(struct airoha_eth *eth, bool enable) +-{ +- const int port_list[] = { +- XSI_PCIE0_PORT, +- XSI_PCIE1_PORT, +- XSI_USB_PORT, +- XSI_ETH_PORT +- }; +- int i, err; +- +- for (i = 0; i < ARRAY_SIZE(port_list); i++) { +- err = airoha_set_gdm_port(eth, port_list[i], enable); +- if (err) +- goto error; +- } +- +- return 0; +- +-error: +- for (i--; i >= 0; i--) +- airoha_set_gdm_port(eth, port_list[i], false); +- +- return err; +-} +- + static void airoha_fe_maccr_init(struct airoha_eth *eth) + { + int p; +@@ -1540,7 +1513,7 @@ static int airoha_dev_open(struct net_de + int err; + + netif_tx_start_all_queues(dev); +- err = airoha_set_gdm_ports(qdma->eth, true); ++ err = airoha_set_vip_for_gdm_port(port, true); + if (err) + return err; + +@@ -1566,7 +1539,7 @@ static int airoha_dev_stop(struct net_de + int i, err; + + netif_tx_disable(dev); +- err = airoha_set_gdm_ports(qdma->eth, false); ++ err = airoha_set_vip_for_gdm_port(port, false); + if (err) + return err; + +--- a/drivers/net/ethernet/airoha/airoha_eth.h ++++ b/drivers/net/ethernet/airoha/airoha_eth.h +@@ -58,14 +58,6 @@ enum { + }; + + enum { +- XSI_PCIE0_PORT, +- XSI_PCIE1_PORT, +- XSI_USB_PORT, +- XSI_AE_PORT, +- XSI_ETH_PORT, +-}; +- +-enum { + XSI_PCIE0_VIP_PORT_MASK = BIT(22), + XSI_PCIE1_VIP_PORT_MASK = BIT(23), + XSI_USB_VIP_PORT_MASK = BIT(25), diff --git a/target/linux/airoha/patches-6.6/048-12-v6.15-net-airoha-Introduce-Airoha-NPU-support.patch b/target/linux/airoha/patches-6.6/048-12-v6.15-net-airoha-Introduce-Airoha-NPU-support.patch new file mode 100644 index 00000000000000..41c5622304096f --- /dev/null +++ b/target/linux/airoha/patches-6.6/048-12-v6.15-net-airoha-Introduce-Airoha-NPU-support.patch @@ -0,0 +1,627 @@ +From 23290c7bc190def4e1ca61610992d9b7c32e33f3 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Fri, 28 Feb 2025 11:54:20 +0100 +Subject: [PATCH 12/15] net: airoha: Introduce Airoha NPU support + +Packet Processor Engine (PPE) module available on EN7581 SoC populates +the PPE table with 5-tuples flower rules learned from traffic forwarded +between the GDM ports connected to the Packet Switch Engine (PSE) module. +The airoha_eth driver can enable hw acceleration of learned 5-tuples +rules if the user configure them in netfilter flowtable (netfilter +flowtable support will be added with subsequent patches). +airoha_eth driver configures and collects data from the PPE module via a +Network Processor Unit (NPU) RISC-V module available on the EN7581 SoC. +Introduce basic support for Airoha NPU module. + +Tested-by: Sayantan Nandy +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Paolo Abeni +--- + drivers/net/ethernet/airoha/Kconfig | 9 + + drivers/net/ethernet/airoha/Makefile | 1 + + drivers/net/ethernet/airoha/airoha_eth.h | 2 + + drivers/net/ethernet/airoha/airoha_npu.c | 520 +++++++++++++++++++++++ + drivers/net/ethernet/airoha/airoha_npu.h | 34 ++ + 5 files changed, 566 insertions(+) + create mode 100644 drivers/net/ethernet/airoha/airoha_npu.c + create mode 100644 drivers/net/ethernet/airoha/airoha_npu.h + +--- a/drivers/net/ethernet/airoha/Kconfig ++++ b/drivers/net/ethernet/airoha/Kconfig +@@ -7,9 +7,18 @@ config NET_VENDOR_AIROHA + + if NET_VENDOR_AIROHA + ++config NET_AIROHA_NPU ++ tristate "Airoha NPU support" ++ select WANT_DEV_COREDUMP ++ select REGMAP_MMIO ++ help ++ This driver supports Airoha Network Processor (NPU) available ++ on the Airoha Soc family. ++ + config NET_AIROHA + tristate "Airoha SoC Gigabit Ethernet support" + depends on NET_DSA || !NET_DSA ++ select NET_AIROHA_NPU + select PAGE_POOL + help + This driver supports the gigabit ethernet MACs in the +--- a/drivers/net/ethernet/airoha/Makefile ++++ b/drivers/net/ethernet/airoha/Makefile +@@ -4,3 +4,4 @@ + # + + obj-$(CONFIG_NET_AIROHA) += airoha_eth.o ++obj-$(CONFIG_NET_AIROHA_NPU) += airoha_npu.o +--- a/drivers/net/ethernet/airoha/airoha_eth.h ++++ b/drivers/net/ethernet/airoha/airoha_eth.h +@@ -240,6 +240,8 @@ struct airoha_eth { + unsigned long state; + void __iomem *fe_regs; + ++ struct airoha_npu __rcu *npu; ++ + struct reset_control_bulk_data rsts[AIROHA_MAX_NUM_RSTS]; + struct reset_control_bulk_data xsi_rsts[AIROHA_MAX_NUM_XSI_RSTS]; + +--- /dev/null ++++ b/drivers/net/ethernet/airoha/airoha_npu.c +@@ -0,0 +1,520 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * Copyright (c) 2025 AIROHA Inc ++ * Author: Lorenzo Bianconi ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "airoha_npu.h" ++ ++#define NPU_EN7581_FIRMWARE_DATA "airoha/en7581_npu_data.bin" ++#define NPU_EN7581_FIRMWARE_RV32 "airoha/en7581_npu_rv32.bin" ++#define NPU_EN7581_FIRMWARE_RV32_MAX_SIZE 0x200000 ++#define NPU_EN7581_FIRMWARE_DATA_MAX_SIZE 0x10000 ++#define NPU_DUMP_SIZE 512 ++ ++#define REG_NPU_LOCAL_SRAM 0x0 ++ ++#define NPU_PC_BASE_ADDR 0x305000 ++#define REG_PC_DBG(_n) (0x305000 + ((_n) * 0x100)) ++ ++#define NPU_CLUSTER_BASE_ADDR 0x306000 ++ ++#define REG_CR_BOOT_TRIGGER (NPU_CLUSTER_BASE_ADDR + 0x000) ++#define REG_CR_BOOT_CONFIG (NPU_CLUSTER_BASE_ADDR + 0x004) ++#define REG_CR_BOOT_BASE(_n) (NPU_CLUSTER_BASE_ADDR + 0x020 + ((_n) << 2)) ++ ++#define NPU_MBOX_BASE_ADDR 0x30c000 ++ ++#define REG_CR_MBOX_INT_STATUS (NPU_MBOX_BASE_ADDR + 0x000) ++#define MBOX_INT_STATUS_MASK BIT(8) ++ ++#define REG_CR_MBOX_INT_MASK(_n) (NPU_MBOX_BASE_ADDR + 0x004 + ((_n) << 2)) ++#define REG_CR_MBQ0_CTRL(_n) (NPU_MBOX_BASE_ADDR + 0x030 + ((_n) << 2)) ++#define REG_CR_MBQ8_CTRL(_n) (NPU_MBOX_BASE_ADDR + 0x0b0 + ((_n) << 2)) ++#define REG_CR_NPU_MIB(_n) (NPU_MBOX_BASE_ADDR + 0x140 + ((_n) << 2)) ++ ++#define NPU_TIMER_BASE_ADDR 0x310100 ++#define REG_WDT_TIMER_CTRL(_n) (NPU_TIMER_BASE_ADDR + ((_n) * 0x100)) ++#define WDT_EN_MASK BIT(25) ++#define WDT_INTR_MASK BIT(21) ++ ++enum { ++ NPU_OP_SET = 1, ++ NPU_OP_SET_NO_WAIT, ++ NPU_OP_GET, ++ NPU_OP_GET_NO_WAIT, ++}; ++ ++enum { ++ NPU_FUNC_WIFI, ++ NPU_FUNC_TUNNEL, ++ NPU_FUNC_NOTIFY, ++ NPU_FUNC_DBA, ++ NPU_FUNC_TR471, ++ NPU_FUNC_PPE, ++}; ++ ++enum { ++ NPU_MBOX_ERROR, ++ NPU_MBOX_SUCCESS, ++}; ++ ++enum { ++ PPE_FUNC_SET_WAIT, ++ PPE_FUNC_SET_WAIT_HWNAT_INIT, ++ PPE_FUNC_SET_WAIT_HWNAT_DEINIT, ++ PPE_FUNC_SET_WAIT_API, ++}; ++ ++enum { ++ PPE2_SRAM_SET_ENTRY, ++ PPE_SRAM_SET_ENTRY, ++ PPE_SRAM_SET_VAL, ++ PPE_SRAM_RESET_VAL, ++}; ++ ++enum { ++ QDMA_WAN_ETHER = 1, ++ QDMA_WAN_PON_XDSL, ++}; ++ ++#define MBOX_MSG_FUNC_ID GENMASK(14, 11) ++#define MBOX_MSG_STATIC_BUF BIT(5) ++#define MBOX_MSG_STATUS GENMASK(4, 2) ++#define MBOX_MSG_DONE BIT(1) ++#define MBOX_MSG_WAIT_RSP BIT(0) ++ ++#define PPE_TYPE_L2B_IPV4 2 ++#define PPE_TYPE_L2B_IPV4_IPV6 3 ++ ++struct ppe_mbox_data { ++ u32 func_type; ++ u32 func_id; ++ union { ++ struct { ++ u8 cds; ++ u8 xpon_hal_api; ++ u8 wan_xsi; ++ u8 ct_joyme4; ++ int ppe_type; ++ int wan_mode; ++ int wan_sel; ++ } init_info; ++ struct { ++ int func_id; ++ u32 size; ++ u32 data; ++ } set_info; ++ }; ++}; ++ ++static int airoha_npu_send_msg(struct airoha_npu *npu, int func_id, ++ void *p, int size) ++{ ++ u16 core = 0; /* FIXME */ ++ u32 val, offset = core << 4; ++ dma_addr_t dma_addr; ++ void *addr; ++ int ret; ++ ++ addr = kmemdup(p, size, GFP_ATOMIC); ++ if (!addr) ++ return -ENOMEM; ++ ++ dma_addr = dma_map_single(npu->dev, addr, size, DMA_TO_DEVICE); ++ ret = dma_mapping_error(npu->dev, dma_addr); ++ if (ret) ++ goto out; ++ ++ spin_lock_bh(&npu->cores[core].lock); ++ ++ regmap_write(npu->regmap, REG_CR_MBQ0_CTRL(0) + offset, dma_addr); ++ regmap_write(npu->regmap, REG_CR_MBQ0_CTRL(1) + offset, size); ++ regmap_read(npu->regmap, REG_CR_MBQ0_CTRL(2) + offset, &val); ++ regmap_write(npu->regmap, REG_CR_MBQ0_CTRL(2) + offset, val + 1); ++ val = FIELD_PREP(MBOX_MSG_FUNC_ID, func_id) | MBOX_MSG_WAIT_RSP; ++ regmap_write(npu->regmap, REG_CR_MBQ0_CTRL(3) + offset, val); ++ ++ ret = regmap_read_poll_timeout_atomic(npu->regmap, ++ REG_CR_MBQ0_CTRL(3) + offset, ++ val, (val & MBOX_MSG_DONE), ++ 100, 100 * MSEC_PER_SEC); ++ if (!ret && FIELD_GET(MBOX_MSG_STATUS, val) != NPU_MBOX_SUCCESS) ++ ret = -EINVAL; ++ ++ spin_unlock_bh(&npu->cores[core].lock); ++ ++ dma_unmap_single(npu->dev, dma_addr, size, DMA_TO_DEVICE); ++out: ++ kfree(addr); ++ ++ return ret; ++} ++ ++static int airoha_npu_run_firmware(struct device *dev, void __iomem *base, ++ struct reserved_mem *rmem) ++{ ++ const struct firmware *fw; ++ void __iomem *addr; ++ int ret; ++ ++ ret = request_firmware(&fw, NPU_EN7581_FIRMWARE_RV32, dev); ++ if (ret) ++ return ret == -ENOENT ? -EPROBE_DEFER : ret; ++ ++ if (fw->size > NPU_EN7581_FIRMWARE_RV32_MAX_SIZE) { ++ dev_err(dev, "%s: fw size too overlimit (%zu)\n", ++ NPU_EN7581_FIRMWARE_RV32, fw->size); ++ ret = -E2BIG; ++ goto out; ++ } ++ ++ addr = devm_ioremap(dev, rmem->base, rmem->size); ++ if (!addr) { ++ ret = -ENOMEM; ++ goto out; ++ } ++ ++ memcpy_toio(addr, fw->data, fw->size); ++ release_firmware(fw); ++ ++ ret = request_firmware(&fw, NPU_EN7581_FIRMWARE_DATA, dev); ++ if (ret) ++ return ret == -ENOENT ? -EPROBE_DEFER : ret; ++ ++ if (fw->size > NPU_EN7581_FIRMWARE_DATA_MAX_SIZE) { ++ dev_err(dev, "%s: fw size too overlimit (%zu)\n", ++ NPU_EN7581_FIRMWARE_DATA, fw->size); ++ ret = -E2BIG; ++ goto out; ++ } ++ ++ memcpy_toio(base + REG_NPU_LOCAL_SRAM, fw->data, fw->size); ++out: ++ release_firmware(fw); ++ ++ return ret; ++} ++ ++static irqreturn_t airoha_npu_mbox_handler(int irq, void *npu_instance) ++{ ++ struct airoha_npu *npu = npu_instance; ++ ++ /* clear mbox interrupt status */ ++ regmap_write(npu->regmap, REG_CR_MBOX_INT_STATUS, ++ MBOX_INT_STATUS_MASK); ++ ++ /* acknowledge npu */ ++ regmap_update_bits(npu->regmap, REG_CR_MBQ8_CTRL(3), ++ MBOX_MSG_STATUS | MBOX_MSG_DONE, MBOX_MSG_DONE); ++ ++ return IRQ_HANDLED; ++} ++ ++static void airoha_npu_wdt_work(struct work_struct *work) ++{ ++ struct airoha_npu_core *core; ++ struct airoha_npu *npu; ++ void *dump; ++ u32 val[3]; ++ int c; ++ ++ core = container_of(work, struct airoha_npu_core, wdt_work); ++ npu = core->npu; ++ ++ dump = vzalloc(NPU_DUMP_SIZE); ++ if (!dump) ++ return; ++ ++ c = core - &npu->cores[0]; ++ regmap_bulk_read(npu->regmap, REG_PC_DBG(c), val, ARRAY_SIZE(val)); ++ snprintf(dump, NPU_DUMP_SIZE, "PC: %08x SP: %08x LR: %08x\n", ++ val[0], val[1], val[2]); ++ ++ dev_coredumpv(npu->dev, dump, NPU_DUMP_SIZE, GFP_KERNEL); ++} ++ ++static irqreturn_t airoha_npu_wdt_handler(int irq, void *core_instance) ++{ ++ struct airoha_npu_core *core = core_instance; ++ struct airoha_npu *npu = core->npu; ++ int c = core - &npu->cores[0]; ++ u32 val; ++ ++ regmap_set_bits(npu->regmap, REG_WDT_TIMER_CTRL(c), WDT_INTR_MASK); ++ if (!regmap_read(npu->regmap, REG_WDT_TIMER_CTRL(c), &val) && ++ FIELD_GET(WDT_EN_MASK, val)) ++ schedule_work(&core->wdt_work); ++ ++ return IRQ_HANDLED; ++} ++ ++static int airoha_npu_ppe_init(struct airoha_npu *npu) ++{ ++ struct ppe_mbox_data ppe_data = { ++ .func_type = NPU_OP_SET, ++ .func_id = PPE_FUNC_SET_WAIT_HWNAT_INIT, ++ .init_info = { ++ .ppe_type = PPE_TYPE_L2B_IPV4_IPV6, ++ .wan_mode = QDMA_WAN_ETHER, ++ }, ++ }; ++ ++ return airoha_npu_send_msg(npu, NPU_FUNC_PPE, &ppe_data, ++ sizeof(struct ppe_mbox_data)); ++} ++ ++static int airoha_npu_ppe_deinit(struct airoha_npu *npu) ++{ ++ struct ppe_mbox_data ppe_data = { ++ .func_type = NPU_OP_SET, ++ .func_id = PPE_FUNC_SET_WAIT_HWNAT_DEINIT, ++ }; ++ ++ return airoha_npu_send_msg(npu, NPU_FUNC_PPE, &ppe_data, ++ sizeof(struct ppe_mbox_data)); ++} ++ ++static int airoha_npu_ppe_flush_sram_entries(struct airoha_npu *npu, ++ dma_addr_t foe_addr, ++ int sram_num_entries) ++{ ++ struct ppe_mbox_data ppe_data = { ++ .func_type = NPU_OP_SET, ++ .func_id = PPE_FUNC_SET_WAIT_API, ++ .set_info = { ++ .func_id = PPE_SRAM_RESET_VAL, ++ .data = foe_addr, ++ .size = sram_num_entries, ++ }, ++ }; ++ ++ return airoha_npu_send_msg(npu, NPU_FUNC_PPE, &ppe_data, ++ sizeof(struct ppe_mbox_data)); ++} ++ ++static int airoha_npu_foe_commit_entry(struct airoha_npu *npu, ++ dma_addr_t foe_addr, ++ u32 entry_size, u32 hash, bool ppe2) ++{ ++ struct ppe_mbox_data ppe_data = { ++ .func_type = NPU_OP_SET, ++ .func_id = PPE_FUNC_SET_WAIT_API, ++ .set_info = { ++ .data = foe_addr, ++ .size = entry_size, ++ }, ++ }; ++ int err; ++ ++ ppe_data.set_info.func_id = ppe2 ? PPE2_SRAM_SET_ENTRY ++ : PPE_SRAM_SET_ENTRY; ++ ++ err = airoha_npu_send_msg(npu, NPU_FUNC_PPE, &ppe_data, ++ sizeof(struct ppe_mbox_data)); ++ if (err) ++ return err; ++ ++ ppe_data.set_info.func_id = PPE_SRAM_SET_VAL; ++ ppe_data.set_info.data = hash; ++ ppe_data.set_info.size = sizeof(u32); ++ ++ return airoha_npu_send_msg(npu, NPU_FUNC_PPE, &ppe_data, ++ sizeof(struct ppe_mbox_data)); ++} ++ ++struct airoha_npu *airoha_npu_get(struct device *dev) ++{ ++ struct platform_device *pdev; ++ struct device_node *np; ++ struct airoha_npu *npu; ++ ++ np = of_parse_phandle(dev->of_node, "airoha,npu", 0); ++ if (!np) ++ return ERR_PTR(-ENODEV); ++ ++ pdev = of_find_device_by_node(np); ++ of_node_put(np); ++ ++ if (!pdev) { ++ dev_err(dev, "cannot find device node %s\n", np->name); ++ return ERR_PTR(-ENODEV); ++ } ++ ++ if (!try_module_get(THIS_MODULE)) { ++ dev_err(dev, "failed to get the device driver module\n"); ++ npu = ERR_PTR(-ENODEV); ++ goto error_pdev_put; ++ } ++ ++ npu = platform_get_drvdata(pdev); ++ if (!npu) { ++ npu = ERR_PTR(-ENODEV); ++ goto error_module_put; ++ } ++ ++ if (!device_link_add(dev, &pdev->dev, DL_FLAG_AUTOREMOVE_SUPPLIER)) { ++ dev_err(&pdev->dev, ++ "failed to create device link to consumer %s\n", ++ dev_name(dev)); ++ npu = ERR_PTR(-EINVAL); ++ goto error_module_put; ++ } ++ ++ return npu; ++ ++error_module_put: ++ module_put(THIS_MODULE); ++error_pdev_put: ++ platform_device_put(pdev); ++ ++ return npu; ++} ++EXPORT_SYMBOL_GPL(airoha_npu_get); ++ ++void airoha_npu_put(struct airoha_npu *npu) ++{ ++ module_put(THIS_MODULE); ++ put_device(npu->dev); ++} ++EXPORT_SYMBOL_GPL(airoha_npu_put); ++ ++static const struct of_device_id of_airoha_npu_match[] = { ++ { .compatible = "airoha,en7581-npu" }, ++ { /* sentinel */ } ++}; ++MODULE_DEVICE_TABLE(of, of_airoha_npu_match); ++ ++static const struct regmap_config regmap_config = { ++ .name = "npu", ++ .reg_bits = 32, ++ .val_bits = 32, ++ .reg_stride = 4, ++ .disable_locking = true, ++}; ++ ++static int airoha_npu_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct reserved_mem *rmem; ++ struct airoha_npu *npu; ++ struct device_node *np; ++ void __iomem *base; ++ int i, irq, err; ++ ++ base = devm_platform_ioremap_resource(pdev, 0); ++ if (IS_ERR(base)) ++ return PTR_ERR(base); ++ ++ npu = devm_kzalloc(dev, sizeof(*npu), GFP_KERNEL); ++ if (!npu) ++ return -ENOMEM; ++ ++ npu->dev = dev; ++ npu->ops.ppe_init = airoha_npu_ppe_init; ++ npu->ops.ppe_deinit = airoha_npu_ppe_deinit; ++ npu->ops.ppe_flush_sram_entries = airoha_npu_ppe_flush_sram_entries; ++ npu->ops.ppe_foe_commit_entry = airoha_npu_foe_commit_entry; ++ ++ npu->regmap = devm_regmap_init_mmio(dev, base, ®map_config); ++ if (IS_ERR(npu->regmap)) ++ return PTR_ERR(npu->regmap); ++ ++ np = of_parse_phandle(dev->of_node, "memory-region", 0); ++ if (!np) ++ return -ENODEV; ++ ++ rmem = of_reserved_mem_lookup(np); ++ of_node_put(np); ++ ++ if (!rmem) ++ return -ENODEV; ++ ++ irq = platform_get_irq(pdev, 0); ++ if (irq < 0) ++ return irq; ++ ++ err = devm_request_irq(dev, irq, airoha_npu_mbox_handler, ++ IRQF_SHARED, "airoha-npu-mbox", npu); ++ if (err) ++ return err; ++ ++ for (i = 0; i < ARRAY_SIZE(npu->cores); i++) { ++ struct airoha_npu_core *core = &npu->cores[i]; ++ ++ spin_lock_init(&core->lock); ++ core->npu = npu; ++ ++ irq = platform_get_irq(pdev, i + 1); ++ if (irq < 0) ++ return irq; ++ ++ err = devm_request_irq(dev, irq, airoha_npu_wdt_handler, ++ IRQF_SHARED, "airoha-npu-wdt", core); ++ if (err) ++ return err; ++ ++ INIT_WORK(&core->wdt_work, airoha_npu_wdt_work); ++ } ++ ++ err = dma_set_coherent_mask(dev, DMA_BIT_MASK(32)); ++ if (err) ++ return err; ++ ++ err = airoha_npu_run_firmware(dev, base, rmem); ++ if (err) ++ return dev_err_probe(dev, err, "failed to run npu firmware\n"); ++ ++ regmap_write(npu->regmap, REG_CR_NPU_MIB(10), ++ rmem->base + NPU_EN7581_FIRMWARE_RV32_MAX_SIZE); ++ regmap_write(npu->regmap, REG_CR_NPU_MIB(11), 0x40000); /* SRAM 256K */ ++ regmap_write(npu->regmap, REG_CR_NPU_MIB(12), 0); ++ regmap_write(npu->regmap, REG_CR_NPU_MIB(21), 1); ++ msleep(100); ++ ++ /* setting booting address */ ++ for (i = 0; i < NPU_NUM_CORES; i++) ++ regmap_write(npu->regmap, REG_CR_BOOT_BASE(i), rmem->base); ++ usleep_range(1000, 2000); ++ ++ /* enable NPU cores */ ++ /* do not start core3 since it is used for WiFi offloading */ ++ regmap_write(npu->regmap, REG_CR_BOOT_CONFIG, 0xf7); ++ regmap_write(npu->regmap, REG_CR_BOOT_TRIGGER, 0x1); ++ msleep(100); ++ ++ platform_set_drvdata(pdev, npu); ++ ++ return 0; ++} ++ ++static void airoha_npu_remove(struct platform_device *pdev) ++{ ++ struct airoha_npu *npu = platform_get_drvdata(pdev); ++ int i; ++ ++ for (i = 0; i < ARRAY_SIZE(npu->cores); i++) ++ cancel_work_sync(&npu->cores[i].wdt_work); ++} ++ ++static struct platform_driver airoha_npu_driver = { ++ .probe = airoha_npu_probe, ++ .remove_new = airoha_npu_remove, ++ .driver = { ++ .name = "airoha-npu", ++ .of_match_table = of_airoha_npu_match, ++ }, ++}; ++module_platform_driver(airoha_npu_driver); ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Lorenzo Bianconi "); ++MODULE_DESCRIPTION("Airoha Network Processor Unit driver"); +--- /dev/null ++++ b/drivers/net/ethernet/airoha/airoha_npu.h +@@ -0,0 +1,34 @@ ++/* SPDX-License-Identifier: GPL-2.0-only */ ++/* ++ * Copyright (c) 2025 AIROHA Inc ++ * Author: Lorenzo Bianconi ++ */ ++ ++#define NPU_NUM_CORES 8 ++ ++struct airoha_npu { ++ struct device *dev; ++ struct regmap *regmap; ++ ++ struct airoha_npu_core { ++ struct airoha_npu *npu; ++ /* protect concurrent npu memory accesses */ ++ spinlock_t lock; ++ struct work_struct wdt_work; ++ } cores[NPU_NUM_CORES]; ++ ++ struct { ++ int (*ppe_init)(struct airoha_npu *npu); ++ int (*ppe_deinit)(struct airoha_npu *npu); ++ int (*ppe_flush_sram_entries)(struct airoha_npu *npu, ++ dma_addr_t foe_addr, ++ int sram_num_entries); ++ int (*ppe_foe_commit_entry)(struct airoha_npu *npu, ++ dma_addr_t foe_addr, ++ u32 entry_size, u32 hash, ++ bool ppe2); ++ } ops; ++}; ++ ++struct airoha_npu *airoha_npu_get(struct device *dev); ++void airoha_npu_put(struct airoha_npu *npu); diff --git a/target/linux/airoha/patches-6.6/048-13-v6.15-net-airoha-Introduce-flowtable-offload-support.patch b/target/linux/airoha/patches-6.6/048-13-v6.15-net-airoha-Introduce-flowtable-offload-support.patch new file mode 100644 index 00000000000000..225165fca5ab39 --- /dev/null +++ b/target/linux/airoha/patches-6.6/048-13-v6.15-net-airoha-Introduce-flowtable-offload-support.patch @@ -0,0 +1,1481 @@ +From 00a7678310fe3d3f408513e55d9a0b67f0db380f Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Fri, 28 Feb 2025 11:54:21 +0100 +Subject: [PATCH 13/15] net: airoha: Introduce flowtable offload support + +Introduce netfilter flowtable integration in order to allow airoha_eth +driver to offload 5-tuple flower rules learned by the PPE module if the +user accelerates them using a nft configuration similar to the one reported +below: + +table inet filter { + flowtable ft { + hook ingress priority filter + devices = { lan1, lan2, lan3, lan4, eth1 } + flags offload; + } + chain forward { + type filter hook forward priority filter; policy accept; + meta l4proto { tcp, udp } flow add @ft + } +} + +Tested-by: Sayantan Nandy +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Paolo Abeni +--- + drivers/net/ethernet/airoha/Makefile | 3 +- + drivers/net/ethernet/airoha/airoha_eth.c | 60 +- + drivers/net/ethernet/airoha/airoha_eth.h | 250 ++++++ + drivers/net/ethernet/airoha/airoha_ppe.c | 901 ++++++++++++++++++++++ + drivers/net/ethernet/airoha/airoha_regs.h | 107 ++- + 5 files changed, 1314 insertions(+), 7 deletions(-) + create mode 100644 drivers/net/ethernet/airoha/airoha_ppe.c + +--- a/drivers/net/ethernet/airoha/Makefile ++++ b/drivers/net/ethernet/airoha/Makefile +@@ -3,5 +3,6 @@ + # Airoha for the Mediatek SoCs built-in ethernet macs + # + +-obj-$(CONFIG_NET_AIROHA) += airoha_eth.o ++obj-$(CONFIG_NET_AIROHA) += airoha-eth.o ++airoha-eth-y := airoha_eth.o airoha_ppe.o + obj-$(CONFIG_NET_AIROHA_NPU) += airoha_npu.o +--- a/drivers/net/ethernet/airoha/airoha_eth.c ++++ b/drivers/net/ethernet/airoha/airoha_eth.c +@@ -8,7 +8,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -619,6 +618,7 @@ static int airoha_qdma_rx_process(struct + while (done < budget) { + struct airoha_queue_entry *e = &q->entry[q->tail]; + struct airoha_qdma_desc *desc = &q->desc[q->tail]; ++ u32 hash, reason, msg1 = le32_to_cpu(desc->msg1); + dma_addr_t dma_addr = le32_to_cpu(desc->addr); + u32 desc_ctrl = le32_to_cpu(desc->ctrl); + struct airoha_gdm_port *port; +@@ -681,6 +681,15 @@ static int airoha_qdma_rx_process(struct + &port->dsa_meta[sptag]->dst); + } + ++ hash = FIELD_GET(AIROHA_RXD4_FOE_ENTRY, msg1); ++ if (hash != AIROHA_RXD4_FOE_ENTRY) ++ skb_set_hash(skb, jhash_1word(hash, 0), ++ PKT_HASH_TYPE_L4); ++ ++ reason = FIELD_GET(AIROHA_RXD4_PPE_CPU_REASON, msg1); ++ if (reason == PPE_CPU_REASON_HIT_UNBIND_RATE_REACHED) ++ airoha_ppe_check_skb(eth->ppe, hash); ++ + napi_gro_receive(&q->napi, skb); + + done++; +@@ -1302,6 +1311,10 @@ static int airoha_hw_init(struct platfor + return err; + } + ++ err = airoha_ppe_init(eth); ++ if (err) ++ return err; ++ + set_bit(DEV_STATE_INITIALIZED, ð->state); + + return 0; +@@ -2166,6 +2179,47 @@ static int airoha_tc_htb_alloc_leaf_queu + return 0; + } + ++static int airoha_dev_setup_tc_block(struct airoha_gdm_port *port, ++ struct flow_block_offload *f) ++{ ++ flow_setup_cb_t *cb = airoha_ppe_setup_tc_block_cb; ++ static LIST_HEAD(block_cb_list); ++ struct flow_block_cb *block_cb; ++ ++ if (f->binder_type != FLOW_BLOCK_BINDER_TYPE_CLSACT_INGRESS) ++ return -EOPNOTSUPP; ++ ++ f->driver_block_list = &block_cb_list; ++ switch (f->command) { ++ case FLOW_BLOCK_BIND: ++ block_cb = flow_block_cb_lookup(f->block, cb, port->dev); ++ if (block_cb) { ++ flow_block_cb_incref(block_cb); ++ return 0; ++ } ++ block_cb = flow_block_cb_alloc(cb, port->dev, port->dev, NULL); ++ if (IS_ERR(block_cb)) ++ return PTR_ERR(block_cb); ++ ++ flow_block_cb_incref(block_cb); ++ flow_block_cb_add(block_cb, f); ++ list_add_tail(&block_cb->driver_list, &block_cb_list); ++ return 0; ++ case FLOW_BLOCK_UNBIND: ++ block_cb = flow_block_cb_lookup(f->block, cb, port->dev); ++ if (!block_cb) ++ return -ENOENT; ++ ++ if (!flow_block_cb_decref(block_cb)) { ++ flow_block_cb_remove(block_cb, f); ++ list_del(&block_cb->driver_list); ++ } ++ return 0; ++ default: ++ return -EOPNOTSUPP; ++ } ++} ++ + static void airoha_tc_remove_htb_queue(struct airoha_gdm_port *port, int queue) + { + struct net_device *dev = port->dev; +@@ -2249,6 +2303,9 @@ static int airoha_dev_tc_setup(struct ne + return airoha_tc_setup_qdisc_ets(port, type_data); + case TC_SETUP_QDISC_HTB: + return airoha_tc_setup_qdisc_htb(port, type_data); ++ case TC_SETUP_BLOCK: ++ case TC_SETUP_FT: ++ return airoha_dev_setup_tc_block(port, type_data); + default: + return -EOPNOTSUPP; + } +@@ -2505,6 +2562,7 @@ static void airoha_remove(struct platfor + } + free_netdev(eth->napi_dev); + ++ airoha_ppe_deinit(eth); + platform_set_drvdata(pdev, NULL); + } + +--- a/drivers/net/ethernet/airoha/airoha_eth.h ++++ b/drivers/net/ethernet/airoha/airoha_eth.h +@@ -12,6 +12,7 @@ + #include + #include + #include ++#include + + #define AIROHA_MAX_NUM_GDM_PORTS 4 + #define AIROHA_MAX_NUM_QDMA 2 +@@ -44,6 +45,15 @@ + #define QDMA_METER_IDX(_n) ((_n) & 0xff) + #define QDMA_METER_GROUP(_n) (((_n) >> 8) & 0x3) + ++#define PPE_NUM 2 ++#define PPE1_SRAM_NUM_ENTRIES (8 * 1024) ++#define PPE_SRAM_NUM_ENTRIES (2 * PPE1_SRAM_NUM_ENTRIES) ++#define PPE_DRAM_NUM_ENTRIES (16 * 1024) ++#define PPE_NUM_ENTRIES (PPE_SRAM_NUM_ENTRIES + PPE_DRAM_NUM_ENTRIES) ++#define PPE_HASH_MASK (PPE_NUM_ENTRIES - 1) ++#define PPE_ENTRY_SIZE 80 ++#define PPE_RAM_NUM_ENTRIES_SHIFT(_n) (__ffs((_n) >> 10)) ++ + #define MTK_HDR_LEN 4 + #define MTK_HDR_XMIT_TAGGED_TPID_8100 1 + #define MTK_HDR_XMIT_TAGGED_TPID_88A8 2 +@@ -195,6 +205,224 @@ struct airoha_hw_stats { + u64 rx_len[7]; + }; + ++enum { ++ PPE_CPU_REASON_HIT_UNBIND_RATE_REACHED = 0x0f, ++}; ++ ++enum { ++ AIROHA_FOE_STATE_INVALID, ++ AIROHA_FOE_STATE_UNBIND, ++ AIROHA_FOE_STATE_BIND, ++ AIROHA_FOE_STATE_FIN ++}; ++ ++enum { ++ PPE_PKT_TYPE_IPV4_HNAPT = 0, ++ PPE_PKT_TYPE_IPV4_ROUTE = 1, ++ PPE_PKT_TYPE_BRIDGE = 2, ++ PPE_PKT_TYPE_IPV4_DSLITE = 3, ++ PPE_PKT_TYPE_IPV6_ROUTE_3T = 4, ++ PPE_PKT_TYPE_IPV6_ROUTE_5T = 5, ++ PPE_PKT_TYPE_IPV6_6RD = 7, ++}; ++ ++#define AIROHA_FOE_MAC_SMAC_ID GENMASK(20, 16) ++#define AIROHA_FOE_MAC_PPPOE_ID GENMASK(15, 0) ++ ++struct airoha_foe_mac_info_common { ++ u16 vlan1; ++ u16 etype; ++ ++ u32 dest_mac_hi; ++ ++ u16 vlan2; ++ u16 dest_mac_lo; ++ ++ u32 src_mac_hi; ++}; ++ ++struct airoha_foe_mac_info { ++ struct airoha_foe_mac_info_common common; ++ ++ u16 pppoe_id; ++ u16 src_mac_lo; ++}; ++ ++#define AIROHA_FOE_IB1_UNBIND_PREBIND BIT(24) ++#define AIROHA_FOE_IB1_UNBIND_PACKETS GENMASK(23, 8) ++#define AIROHA_FOE_IB1_UNBIND_TIMESTAMP GENMASK(7, 0) ++ ++#define AIROHA_FOE_IB1_BIND_STATIC BIT(31) ++#define AIROHA_FOE_IB1_BIND_UDP BIT(30) ++#define AIROHA_FOE_IB1_BIND_STATE GENMASK(29, 28) ++#define AIROHA_FOE_IB1_BIND_PACKET_TYPE GENMASK(27, 25) ++#define AIROHA_FOE_IB1_BIND_TTL BIT(24) ++#define AIROHA_FOE_IB1_BIND_TUNNEL_DECAP BIT(23) ++#define AIROHA_FOE_IB1_BIND_PPPOE BIT(22) ++#define AIROHA_FOE_IB1_BIND_VPM GENMASK(21, 20) ++#define AIROHA_FOE_IB1_BIND_VLAN_LAYER GENMASK(19, 16) ++#define AIROHA_FOE_IB1_BIND_KEEPALIVE BIT(15) ++#define AIROHA_FOE_IB1_BIND_TIMESTAMP GENMASK(14, 0) ++ ++#define AIROHA_FOE_IB2_DSCP GENMASK(31, 24) ++#define AIROHA_FOE_IB2_PORT_AG GENMASK(23, 13) ++#define AIROHA_FOE_IB2_PCP BIT(12) ++#define AIROHA_FOE_IB2_MULTICAST BIT(11) ++#define AIROHA_FOE_IB2_FAST_PATH BIT(10) ++#define AIROHA_FOE_IB2_PSE_QOS BIT(9) ++#define AIROHA_FOE_IB2_PSE_PORT GENMASK(8, 5) ++#define AIROHA_FOE_IB2_NBQ GENMASK(4, 0) ++ ++#define AIROHA_FOE_ACTDP GENMASK(31, 24) ++#define AIROHA_FOE_SHAPER_ID GENMASK(23, 16) ++#define AIROHA_FOE_CHANNEL GENMASK(15, 11) ++#define AIROHA_FOE_QID GENMASK(10, 8) ++#define AIROHA_FOE_DPI BIT(7) ++#define AIROHA_FOE_TUNNEL BIT(6) ++#define AIROHA_FOE_TUNNEL_ID GENMASK(5, 0) ++ ++struct airoha_foe_bridge { ++ u32 dest_mac_hi; ++ ++ u16 src_mac_hi; ++ u16 dest_mac_lo; ++ ++ u32 src_mac_lo; ++ ++ u32 ib2; ++ ++ u32 rsv[5]; ++ ++ u32 data; ++ ++ struct airoha_foe_mac_info l2; ++}; ++ ++struct airoha_foe_ipv4_tuple { ++ u32 src_ip; ++ u32 dest_ip; ++ union { ++ struct { ++ u16 dest_port; ++ u16 src_port; ++ }; ++ struct { ++ u8 protocol; ++ u8 _pad[3]; /* fill with 0xa5a5a5 */ ++ }; ++ u32 ports; ++ }; ++}; ++ ++struct airoha_foe_ipv4 { ++ struct airoha_foe_ipv4_tuple orig_tuple; ++ ++ u32 ib2; ++ ++ struct airoha_foe_ipv4_tuple new_tuple; ++ ++ u32 rsv[2]; ++ ++ u32 data; ++ ++ struct airoha_foe_mac_info l2; ++}; ++ ++struct airoha_foe_ipv4_dslite { ++ struct airoha_foe_ipv4_tuple ip4; ++ ++ u32 ib2; ++ ++ u8 flow_label[3]; ++ u8 priority; ++ ++ u32 rsv[4]; ++ ++ u32 data; ++ ++ struct airoha_foe_mac_info l2; ++}; ++ ++struct airoha_foe_ipv6 { ++ u32 src_ip[4]; ++ u32 dest_ip[4]; ++ ++ union { ++ struct { ++ u16 dest_port; ++ u16 src_port; ++ }; ++ struct { ++ u8 protocol; ++ u8 pad[3]; ++ }; ++ u32 ports; ++ }; ++ ++ u32 data; ++ ++ u32 ib2; ++ ++ struct airoha_foe_mac_info_common l2; ++}; ++ ++struct airoha_foe_entry { ++ union { ++ struct { ++ u32 ib1; ++ union { ++ struct airoha_foe_bridge bridge; ++ struct airoha_foe_ipv4 ipv4; ++ struct airoha_foe_ipv4_dslite dslite; ++ struct airoha_foe_ipv6 ipv6; ++ DECLARE_FLEX_ARRAY(u32, d); ++ }; ++ }; ++ u8 data[PPE_ENTRY_SIZE]; ++ }; ++}; ++ ++struct airoha_flow_data { ++ struct ethhdr eth; ++ ++ union { ++ struct { ++ __be32 src_addr; ++ __be32 dst_addr; ++ } v4; ++ ++ struct { ++ struct in6_addr src_addr; ++ struct in6_addr dst_addr; ++ } v6; ++ }; ++ ++ __be16 src_port; ++ __be16 dst_port; ++ ++ struct { ++ struct { ++ u16 id; ++ __be16 proto; ++ } hdr[2]; ++ u8 num; ++ } vlan; ++ struct { ++ u16 sid; ++ u8 num; ++ } pppoe; ++}; ++ ++struct airoha_flow_table_entry { ++ struct hlist_node list; ++ ++ struct airoha_foe_entry data; ++ u32 hash; ++ ++ struct rhash_head node; ++ unsigned long cookie; ++}; ++ + struct airoha_qdma { + struct airoha_eth *eth; + void __iomem *regs; +@@ -234,6 +462,19 @@ struct airoha_gdm_port { + struct metadata_dst *dsa_meta[AIROHA_MAX_DSA_PORTS]; + }; + ++#define AIROHA_RXD4_PPE_CPU_REASON GENMASK(20, 16) ++#define AIROHA_RXD4_FOE_ENTRY GENMASK(15, 0) ++ ++struct airoha_ppe { ++ struct airoha_eth *eth; ++ ++ void *foe; ++ dma_addr_t foe_dma; ++ ++ struct hlist_head *foe_flow; ++ u16 foe_check_time[PPE_NUM_ENTRIES]; ++}; ++ + struct airoha_eth { + struct device *dev; + +@@ -242,6 +483,9 @@ struct airoha_eth { + + struct airoha_npu __rcu *npu; + ++ struct airoha_ppe *ppe; ++ struct rhashtable flow_table; ++ + struct reset_control_bulk_data rsts[AIROHA_MAX_NUM_RSTS]; + struct reset_control_bulk_data xsi_rsts[AIROHA_MAX_NUM_XSI_RSTS]; + +@@ -277,4 +521,10 @@ u32 airoha_rmw(void __iomem *base, u32 o + #define airoha_qdma_clear(qdma, offset, val) \ + airoha_rmw((qdma)->regs, (offset), (val), 0) + ++void airoha_ppe_check_skb(struct airoha_ppe *ppe, u16 hash); ++int airoha_ppe_setup_tc_block_cb(enum tc_setup_type type, void *type_data, ++ void *cb_priv); ++int airoha_ppe_init(struct airoha_eth *eth); ++void airoha_ppe_deinit(struct airoha_eth *eth); ++ + #endif /* AIROHA_ETH_H */ +--- /dev/null ++++ b/drivers/net/ethernet/airoha/airoha_ppe.c +@@ -0,0 +1,901 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * Copyright (c) 2025 AIROHA Inc ++ * Author: Lorenzo Bianconi ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include "airoha_npu.h" ++#include "airoha_regs.h" ++#include "airoha_eth.h" ++ ++static DEFINE_MUTEX(flow_offload_mutex); ++static DEFINE_SPINLOCK(ppe_lock); ++ ++static const struct rhashtable_params airoha_flow_table_params = { ++ .head_offset = offsetof(struct airoha_flow_table_entry, node), ++ .key_offset = offsetof(struct airoha_flow_table_entry, cookie), ++ .key_len = sizeof(unsigned long), ++ .automatic_shrinking = true, ++}; ++ ++static bool airoha_ppe2_is_enabled(struct airoha_eth *eth) ++{ ++ return airoha_fe_rr(eth, REG_PPE_GLO_CFG(1)) & PPE_GLO_CFG_EN_MASK; ++} ++ ++static u32 airoha_ppe_get_timestamp(struct airoha_ppe *ppe) ++{ ++ u16 timestamp = airoha_fe_rr(ppe->eth, REG_FE_FOE_TS); ++ ++ return FIELD_GET(AIROHA_FOE_IB1_BIND_TIMESTAMP, timestamp); ++} ++ ++static void airoha_ppe_hw_init(struct airoha_ppe *ppe) ++{ ++ u32 sram_tb_size, sram_num_entries, dram_num_entries; ++ struct airoha_eth *eth = ppe->eth; ++ int i; ++ ++ sram_tb_size = PPE_SRAM_NUM_ENTRIES * sizeof(struct airoha_foe_entry); ++ dram_num_entries = PPE_RAM_NUM_ENTRIES_SHIFT(PPE_DRAM_NUM_ENTRIES); ++ ++ for (i = 0; i < PPE_NUM; i++) { ++ int p; ++ ++ airoha_fe_wr(eth, REG_PPE_TB_BASE(i), ++ ppe->foe_dma + sram_tb_size); ++ ++ airoha_fe_rmw(eth, REG_PPE_BND_AGE0(i), ++ PPE_BIND_AGE0_DELTA_NON_L4 | ++ PPE_BIND_AGE0_DELTA_UDP, ++ FIELD_PREP(PPE_BIND_AGE0_DELTA_NON_L4, 1) | ++ FIELD_PREP(PPE_BIND_AGE0_DELTA_UDP, 12)); ++ airoha_fe_rmw(eth, REG_PPE_BND_AGE1(i), ++ PPE_BIND_AGE1_DELTA_TCP_FIN | ++ PPE_BIND_AGE1_DELTA_TCP, ++ FIELD_PREP(PPE_BIND_AGE1_DELTA_TCP_FIN, 1) | ++ FIELD_PREP(PPE_BIND_AGE1_DELTA_TCP, 7)); ++ ++ airoha_fe_rmw(eth, REG_PPE_TB_HASH_CFG(i), ++ PPE_SRAM_TABLE_EN_MASK | ++ PPE_SRAM_HASH1_EN_MASK | ++ PPE_DRAM_TABLE_EN_MASK | ++ PPE_SRAM_HASH0_MODE_MASK | ++ PPE_SRAM_HASH1_MODE_MASK | ++ PPE_DRAM_HASH0_MODE_MASK | ++ PPE_DRAM_HASH1_MODE_MASK, ++ FIELD_PREP(PPE_SRAM_TABLE_EN_MASK, 1) | ++ FIELD_PREP(PPE_SRAM_HASH1_EN_MASK, 1) | ++ FIELD_PREP(PPE_SRAM_HASH1_MODE_MASK, 1) | ++ FIELD_PREP(PPE_DRAM_HASH1_MODE_MASK, 3)); ++ ++ airoha_fe_rmw(eth, REG_PPE_TB_CFG(i), ++ PPE_TB_CFG_SEARCH_MISS_MASK | ++ PPE_TB_ENTRY_SIZE_MASK, ++ FIELD_PREP(PPE_TB_CFG_SEARCH_MISS_MASK, 3) | ++ FIELD_PREP(PPE_TB_ENTRY_SIZE_MASK, 0)); ++ ++ airoha_fe_wr(eth, REG_PPE_HASH_SEED(i), PPE_HASH_SEED); ++ ++ for (p = 0; p < ARRAY_SIZE(eth->ports); p++) ++ airoha_fe_rmw(eth, REG_PPE_MTU(i, p), ++ FP0_EGRESS_MTU_MASK | ++ FP1_EGRESS_MTU_MASK, ++ FIELD_PREP(FP0_EGRESS_MTU_MASK, ++ AIROHA_MAX_MTU) | ++ FIELD_PREP(FP1_EGRESS_MTU_MASK, ++ AIROHA_MAX_MTU)); ++ } ++ ++ if (airoha_ppe2_is_enabled(eth)) { ++ sram_num_entries = ++ PPE_RAM_NUM_ENTRIES_SHIFT(PPE1_SRAM_NUM_ENTRIES); ++ airoha_fe_rmw(eth, REG_PPE_TB_CFG(0), ++ PPE_SRAM_TB_NUM_ENTRY_MASK | ++ PPE_DRAM_TB_NUM_ENTRY_MASK, ++ FIELD_PREP(PPE_SRAM_TB_NUM_ENTRY_MASK, ++ sram_num_entries) | ++ FIELD_PREP(PPE_DRAM_TB_NUM_ENTRY_MASK, ++ dram_num_entries)); ++ airoha_fe_rmw(eth, REG_PPE_TB_CFG(1), ++ PPE_SRAM_TB_NUM_ENTRY_MASK | ++ PPE_DRAM_TB_NUM_ENTRY_MASK, ++ FIELD_PREP(PPE_SRAM_TB_NUM_ENTRY_MASK, ++ sram_num_entries) | ++ FIELD_PREP(PPE_DRAM_TB_NUM_ENTRY_MASK, ++ dram_num_entries)); ++ } else { ++ sram_num_entries = ++ PPE_RAM_NUM_ENTRIES_SHIFT(PPE_SRAM_NUM_ENTRIES); ++ airoha_fe_rmw(eth, REG_PPE_TB_CFG(0), ++ PPE_SRAM_TB_NUM_ENTRY_MASK | ++ PPE_DRAM_TB_NUM_ENTRY_MASK, ++ FIELD_PREP(PPE_SRAM_TB_NUM_ENTRY_MASK, ++ sram_num_entries) | ++ FIELD_PREP(PPE_DRAM_TB_NUM_ENTRY_MASK, ++ dram_num_entries)); ++ } ++} ++ ++static void airoha_ppe_flow_mangle_eth(const struct flow_action_entry *act, void *eth) ++{ ++ void *dest = eth + act->mangle.offset; ++ const void *src = &act->mangle.val; ++ ++ if (act->mangle.offset > 8) ++ return; ++ ++ if (act->mangle.mask == 0xffff) { ++ src += 2; ++ dest += 2; ++ } ++ ++ memcpy(dest, src, act->mangle.mask ? 2 : 4); ++} ++ ++static int airoha_ppe_flow_mangle_ports(const struct flow_action_entry *act, ++ struct airoha_flow_data *data) ++{ ++ u32 val = be32_to_cpu((__force __be32)act->mangle.val); ++ ++ switch (act->mangle.offset) { ++ case 0: ++ if ((__force __be32)act->mangle.mask == ~cpu_to_be32(0xffff)) ++ data->dst_port = cpu_to_be16(val); ++ else ++ data->src_port = cpu_to_be16(val >> 16); ++ break; ++ case 2: ++ data->dst_port = cpu_to_be16(val); ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++static int airoha_ppe_flow_mangle_ipv4(const struct flow_action_entry *act, ++ struct airoha_flow_data *data) ++{ ++ __be32 *dest; ++ ++ switch (act->mangle.offset) { ++ case offsetof(struct iphdr, saddr): ++ dest = &data->v4.src_addr; ++ break; ++ case offsetof(struct iphdr, daddr): ++ dest = &data->v4.dst_addr; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ memcpy(dest, &act->mangle.val, sizeof(u32)); ++ ++ return 0; ++} ++ ++static int airoha_get_dsa_port(struct net_device **dev) ++{ ++#if IS_ENABLED(CONFIG_NET_DSA) ++ struct dsa_port *dp = dsa_port_from_netdev(*dev); ++ ++ if (IS_ERR(dp)) ++ return -ENODEV; ++ ++ *dev = dsa_port_to_master(dp); ++ return dp->index; ++#else ++ return -ENODEV; ++#endif ++} ++ ++static int airoha_ppe_foe_entry_prepare(struct airoha_foe_entry *hwe, ++ struct net_device *dev, int type, ++ struct airoha_flow_data *data, ++ int l4proto) ++{ ++ int dsa_port = airoha_get_dsa_port(&dev); ++ struct airoha_foe_mac_info_common *l2; ++ u32 qdata, ports_pad, val; ++ ++ memset(hwe, 0, sizeof(*hwe)); ++ ++ val = FIELD_PREP(AIROHA_FOE_IB1_BIND_STATE, AIROHA_FOE_STATE_BIND) | ++ FIELD_PREP(AIROHA_FOE_IB1_BIND_PACKET_TYPE, type) | ++ FIELD_PREP(AIROHA_FOE_IB1_BIND_UDP, l4proto == IPPROTO_UDP) | ++ FIELD_PREP(AIROHA_FOE_IB1_BIND_VLAN_LAYER, data->vlan.num) | ++ FIELD_PREP(AIROHA_FOE_IB1_BIND_VPM, data->vlan.num) | ++ AIROHA_FOE_IB1_BIND_TTL; ++ hwe->ib1 = val; ++ ++ val = FIELD_PREP(AIROHA_FOE_IB2_PORT_AG, 0x1f); ++ if (dsa_port >= 0) ++ val |= FIELD_PREP(AIROHA_FOE_IB2_NBQ, dsa_port); ++ ++ if (dev) { ++ struct airoha_gdm_port *port = netdev_priv(dev); ++ u8 pse_port; ++ ++ pse_port = port->id == 4 ? FE_PSE_PORT_GDM4 : port->id; ++ val |= FIELD_PREP(AIROHA_FOE_IB2_PSE_PORT, pse_port); ++ } ++ ++ /* FIXME: implement QoS support setting pse_port to 2 (loopback) ++ * for uplink and setting qos bit in ib2 ++ */ ++ ++ if (is_multicast_ether_addr(data->eth.h_dest)) ++ val |= AIROHA_FOE_IB2_MULTICAST; ++ ++ ports_pad = 0xa5a5a500 | (l4proto & 0xff); ++ if (type == PPE_PKT_TYPE_IPV4_ROUTE) ++ hwe->ipv4.orig_tuple.ports = ports_pad; ++ if (type == PPE_PKT_TYPE_IPV6_ROUTE_3T) ++ hwe->ipv6.ports = ports_pad; ++ ++ qdata = FIELD_PREP(AIROHA_FOE_SHAPER_ID, 0x7f); ++ if (type == PPE_PKT_TYPE_BRIDGE) { ++ hwe->bridge.dest_mac_hi = get_unaligned_be32(data->eth.h_dest); ++ hwe->bridge.dest_mac_lo = ++ get_unaligned_be16(data->eth.h_dest + 4); ++ hwe->bridge.src_mac_hi = ++ get_unaligned_be16(data->eth.h_source); ++ hwe->bridge.src_mac_lo = ++ get_unaligned_be32(data->eth.h_source + 2); ++ hwe->bridge.data = qdata; ++ hwe->bridge.ib2 = val; ++ l2 = &hwe->bridge.l2.common; ++ } else if (type >= PPE_PKT_TYPE_IPV6_ROUTE_3T) { ++ hwe->ipv6.data = qdata; ++ hwe->ipv6.ib2 = val; ++ l2 = &hwe->ipv6.l2; ++ } else { ++ hwe->ipv4.data = qdata; ++ hwe->ipv4.ib2 = val; ++ l2 = &hwe->ipv4.l2.common; ++ } ++ ++ l2->dest_mac_hi = get_unaligned_be32(data->eth.h_dest); ++ l2->dest_mac_lo = get_unaligned_be16(data->eth.h_dest + 4); ++ if (type <= PPE_PKT_TYPE_IPV4_DSLITE) { ++ l2->src_mac_hi = get_unaligned_be32(data->eth.h_source); ++ hwe->ipv4.l2.src_mac_lo = ++ get_unaligned_be16(data->eth.h_source + 4); ++ } else { ++ l2->src_mac_hi = FIELD_PREP(AIROHA_FOE_MAC_SMAC_ID, 0xf); ++ } ++ ++ if (data->vlan.num) { ++ l2->etype = dsa_port >= 0 ? BIT(dsa_port) : 0; ++ l2->vlan1 = data->vlan.hdr[0].id; ++ if (data->vlan.num == 2) ++ l2->vlan2 = data->vlan.hdr[1].id; ++ } else if (dsa_port >= 0) { ++ l2->etype = BIT(15) | BIT(dsa_port); ++ } else if (type >= PPE_PKT_TYPE_IPV6_ROUTE_3T) { ++ l2->etype = ETH_P_IPV6; ++ } else { ++ l2->etype = ETH_P_IP; ++ } ++ ++ return 0; ++} ++ ++static int airoha_ppe_foe_entry_set_ipv4_tuple(struct airoha_foe_entry *hwe, ++ struct airoha_flow_data *data, ++ bool egress) ++{ ++ int type = FIELD_GET(AIROHA_FOE_IB1_BIND_PACKET_TYPE, hwe->ib1); ++ struct airoha_foe_ipv4_tuple *t; ++ ++ switch (type) { ++ case PPE_PKT_TYPE_IPV4_HNAPT: ++ if (egress) { ++ t = &hwe->ipv4.new_tuple; ++ break; ++ } ++ fallthrough; ++ case PPE_PKT_TYPE_IPV4_DSLITE: ++ case PPE_PKT_TYPE_IPV4_ROUTE: ++ t = &hwe->ipv4.orig_tuple; ++ break; ++ default: ++ WARN_ON_ONCE(1); ++ return -EINVAL; ++ } ++ ++ t->src_ip = be32_to_cpu(data->v4.src_addr); ++ t->dest_ip = be32_to_cpu(data->v4.dst_addr); ++ ++ if (type != PPE_PKT_TYPE_IPV4_ROUTE) { ++ t->src_port = be16_to_cpu(data->src_port); ++ t->dest_port = be16_to_cpu(data->dst_port); ++ } ++ ++ return 0; ++} ++ ++static int airoha_ppe_foe_entry_set_ipv6_tuple(struct airoha_foe_entry *hwe, ++ struct airoha_flow_data *data) ++ ++{ ++ int type = FIELD_GET(AIROHA_FOE_IB1_BIND_PACKET_TYPE, hwe->ib1); ++ u32 *src, *dest; ++ ++ switch (type) { ++ case PPE_PKT_TYPE_IPV6_ROUTE_5T: ++ case PPE_PKT_TYPE_IPV6_6RD: ++ hwe->ipv6.src_port = be16_to_cpu(data->src_port); ++ hwe->ipv6.dest_port = be16_to_cpu(data->dst_port); ++ fallthrough; ++ case PPE_PKT_TYPE_IPV6_ROUTE_3T: ++ src = hwe->ipv6.src_ip; ++ dest = hwe->ipv6.dest_ip; ++ break; ++ default: ++ WARN_ON_ONCE(1); ++ return -EINVAL; ++ } ++ ++ ipv6_addr_be32_to_cpu(src, data->v6.src_addr.s6_addr32); ++ ipv6_addr_be32_to_cpu(dest, data->v6.dst_addr.s6_addr32); ++ ++ return 0; ++} ++ ++static u32 airoha_ppe_foe_get_entry_hash(struct airoha_foe_entry *hwe) ++{ ++ int type = FIELD_GET(AIROHA_FOE_IB1_BIND_PACKET_TYPE, hwe->ib1); ++ u32 hash, hv1, hv2, hv3; ++ ++ switch (type) { ++ case PPE_PKT_TYPE_IPV4_ROUTE: ++ case PPE_PKT_TYPE_IPV4_HNAPT: ++ hv1 = hwe->ipv4.orig_tuple.ports; ++ hv2 = hwe->ipv4.orig_tuple.dest_ip; ++ hv3 = hwe->ipv4.orig_tuple.src_ip; ++ break; ++ case PPE_PKT_TYPE_IPV6_ROUTE_3T: ++ case PPE_PKT_TYPE_IPV6_ROUTE_5T: ++ hv1 = hwe->ipv6.src_ip[3] ^ hwe->ipv6.dest_ip[3]; ++ hv1 ^= hwe->ipv6.ports; ++ ++ hv2 = hwe->ipv6.src_ip[2] ^ hwe->ipv6.dest_ip[2]; ++ hv2 ^= hwe->ipv6.dest_ip[0]; ++ ++ hv3 = hwe->ipv6.src_ip[1] ^ hwe->ipv6.dest_ip[1]; ++ hv3 ^= hwe->ipv6.src_ip[0]; ++ break; ++ case PPE_PKT_TYPE_IPV4_DSLITE: ++ case PPE_PKT_TYPE_IPV6_6RD: ++ default: ++ WARN_ON_ONCE(1); ++ return PPE_HASH_MASK; ++ } ++ ++ hash = (hv1 & hv2) | ((~hv1) & hv3); ++ hash = (hash >> 24) | ((hash & 0xffffff) << 8); ++ hash ^= hv1 ^ hv2 ^ hv3; ++ hash ^= hash >> 16; ++ hash &= PPE_NUM_ENTRIES - 1; ++ ++ return hash; ++} ++ ++static struct airoha_foe_entry * ++airoha_ppe_foe_get_entry(struct airoha_ppe *ppe, u32 hash) ++{ ++ if (hash < PPE_SRAM_NUM_ENTRIES) { ++ u32 *hwe = ppe->foe + hash * sizeof(struct airoha_foe_entry); ++ struct airoha_eth *eth = ppe->eth; ++ bool ppe2; ++ u32 val; ++ int i; ++ ++ ppe2 = airoha_ppe2_is_enabled(ppe->eth) && ++ hash >= PPE1_SRAM_NUM_ENTRIES; ++ airoha_fe_wr(ppe->eth, REG_PPE_RAM_CTRL(ppe2), ++ FIELD_PREP(PPE_SRAM_CTRL_ENTRY_MASK, hash) | ++ PPE_SRAM_CTRL_REQ_MASK); ++ if (read_poll_timeout_atomic(airoha_fe_rr, val, ++ val & PPE_SRAM_CTRL_ACK_MASK, ++ 10, 100, false, eth, ++ REG_PPE_RAM_CTRL(ppe2))) ++ return NULL; ++ ++ for (i = 0; i < sizeof(struct airoha_foe_entry) / 4; i++) ++ hwe[i] = airoha_fe_rr(eth, ++ REG_PPE_RAM_ENTRY(ppe2, i)); ++ } ++ ++ return ppe->foe + hash * sizeof(struct airoha_foe_entry); ++} ++ ++static bool airoha_ppe_foe_compare_entry(struct airoha_flow_table_entry *e, ++ struct airoha_foe_entry *hwe) ++{ ++ int type = FIELD_GET(AIROHA_FOE_IB1_BIND_PACKET_TYPE, e->data.ib1); ++ int len; ++ ++ if ((hwe->ib1 ^ e->data.ib1) & AIROHA_FOE_IB1_BIND_UDP) ++ return false; ++ ++ if (type > PPE_PKT_TYPE_IPV4_DSLITE) ++ len = offsetof(struct airoha_foe_entry, ipv6.data); ++ else ++ len = offsetof(struct airoha_foe_entry, ipv4.ib2); ++ ++ return !memcmp(&e->data.d, &hwe->d, len - sizeof(hwe->ib1)); ++} ++ ++static int airoha_ppe_foe_commit_entry(struct airoha_ppe *ppe, ++ struct airoha_foe_entry *e, ++ u32 hash) ++{ ++ struct airoha_foe_entry *hwe = ppe->foe + hash * sizeof(*hwe); ++ u32 ts = airoha_ppe_get_timestamp(ppe); ++ struct airoha_eth *eth = ppe->eth; ++ ++ memcpy(&hwe->d, &e->d, sizeof(*hwe) - sizeof(hwe->ib1)); ++ wmb(); ++ ++ e->ib1 &= ~AIROHA_FOE_IB1_BIND_TIMESTAMP; ++ e->ib1 |= FIELD_PREP(AIROHA_FOE_IB1_BIND_TIMESTAMP, ts); ++ hwe->ib1 = e->ib1; ++ ++ if (hash < PPE_SRAM_NUM_ENTRIES) { ++ dma_addr_t addr = ppe->foe_dma + hash * sizeof(*hwe); ++ bool ppe2 = airoha_ppe2_is_enabled(eth) && ++ hash >= PPE1_SRAM_NUM_ENTRIES; ++ struct airoha_npu *npu; ++ int err = -ENODEV; ++ ++ rcu_read_lock(); ++ npu = rcu_dereference(eth->npu); ++ if (npu) ++ err = npu->ops.ppe_foe_commit_entry(npu, addr, ++ sizeof(*hwe), hash, ++ ppe2); ++ rcu_read_unlock(); ++ ++ return err; ++ } ++ ++ return 0; ++} ++ ++static void airoha_ppe_foe_insert_entry(struct airoha_ppe *ppe, u32 hash) ++{ ++ struct airoha_flow_table_entry *e; ++ struct airoha_foe_entry *hwe; ++ struct hlist_node *n; ++ u32 index, state; ++ ++ spin_lock_bh(&ppe_lock); ++ ++ hwe = airoha_ppe_foe_get_entry(ppe, hash); ++ if (!hwe) ++ goto unlock; ++ ++ state = FIELD_GET(AIROHA_FOE_IB1_BIND_STATE, hwe->ib1); ++ if (state == AIROHA_FOE_STATE_BIND) ++ goto unlock; ++ ++ index = airoha_ppe_foe_get_entry_hash(hwe); ++ hlist_for_each_entry_safe(e, n, &ppe->foe_flow[index], list) { ++ if (airoha_ppe_foe_compare_entry(e, hwe)) { ++ airoha_ppe_foe_commit_entry(ppe, &e->data, hash); ++ e->hash = hash; ++ break; ++ } ++ } ++unlock: ++ spin_unlock_bh(&ppe_lock); ++} ++ ++static int airoha_ppe_foe_flow_commit_entry(struct airoha_ppe *ppe, ++ struct airoha_flow_table_entry *e) ++{ ++ u32 hash = airoha_ppe_foe_get_entry_hash(&e->data); ++ ++ e->hash = 0xffff; ++ ++ spin_lock_bh(&ppe_lock); ++ hlist_add_head(&e->list, &ppe->foe_flow[hash]); ++ spin_unlock_bh(&ppe_lock); ++ ++ return 0; ++} ++ ++static void airoha_ppe_foe_flow_remove_entry(struct airoha_ppe *ppe, ++ struct airoha_flow_table_entry *e) ++{ ++ spin_lock_bh(&ppe_lock); ++ ++ hlist_del_init(&e->list); ++ if (e->hash != 0xffff) { ++ e->data.ib1 &= ~AIROHA_FOE_IB1_BIND_STATE; ++ e->data.ib1 |= FIELD_PREP(AIROHA_FOE_IB1_BIND_STATE, ++ AIROHA_FOE_STATE_INVALID); ++ airoha_ppe_foe_commit_entry(ppe, &e->data, e->hash); ++ e->hash = 0xffff; ++ } ++ ++ spin_unlock_bh(&ppe_lock); ++} ++ ++static int airoha_ppe_flow_offload_replace(struct airoha_gdm_port *port, ++ struct flow_cls_offload *f) ++{ ++ struct flow_rule *rule = flow_cls_offload_flow_rule(f); ++ struct airoha_eth *eth = port->qdma->eth; ++ struct airoha_flow_table_entry *e; ++ struct airoha_flow_data data = {}; ++ struct net_device *odev = NULL; ++ struct flow_action_entry *act; ++ struct airoha_foe_entry hwe; ++ int err, i, offload_type; ++ u16 addr_type = 0; ++ u8 l4proto = 0; ++ ++ if (rhashtable_lookup(ð->flow_table, &f->cookie, ++ airoha_flow_table_params)) ++ return -EEXIST; ++ ++ if (!flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_META)) ++ return -EOPNOTSUPP; ++ ++ if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_CONTROL)) { ++ struct flow_match_control match; ++ ++ flow_rule_match_control(rule, &match); ++ addr_type = match.key->addr_type; ++ if (flow_rule_has_control_flags(match.mask->flags, ++ f->common.extack)) ++ return -EOPNOTSUPP; ++ } else { ++ return -EOPNOTSUPP; ++ } ++ ++ if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_BASIC)) { ++ struct flow_match_basic match; ++ ++ flow_rule_match_basic(rule, &match); ++ l4proto = match.key->ip_proto; ++ } else { ++ return -EOPNOTSUPP; ++ } ++ ++ switch (addr_type) { ++ case 0: ++ offload_type = PPE_PKT_TYPE_BRIDGE; ++ if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ETH_ADDRS)) { ++ struct flow_match_eth_addrs match; ++ ++ flow_rule_match_eth_addrs(rule, &match); ++ memcpy(data.eth.h_dest, match.key->dst, ETH_ALEN); ++ memcpy(data.eth.h_source, match.key->src, ETH_ALEN); ++ } else { ++ return -EOPNOTSUPP; ++ } ++ break; ++ case FLOW_DISSECTOR_KEY_IPV4_ADDRS: ++ offload_type = PPE_PKT_TYPE_IPV4_HNAPT; ++ break; ++ case FLOW_DISSECTOR_KEY_IPV6_ADDRS: ++ offload_type = PPE_PKT_TYPE_IPV6_ROUTE_5T; ++ break; ++ default: ++ return -EOPNOTSUPP; ++ } ++ ++ flow_action_for_each(i, act, &rule->action) { ++ switch (act->id) { ++ case FLOW_ACTION_MANGLE: ++ if (offload_type == PPE_PKT_TYPE_BRIDGE) ++ return -EOPNOTSUPP; ++ ++ if (act->mangle.htype == FLOW_ACT_MANGLE_HDR_TYPE_ETH) ++ airoha_ppe_flow_mangle_eth(act, &data.eth); ++ break; ++ case FLOW_ACTION_REDIRECT: ++ odev = act->dev; ++ break; ++ case FLOW_ACTION_CSUM: ++ break; ++ case FLOW_ACTION_VLAN_PUSH: ++ if (data.vlan.num == 2 || ++ act->vlan.proto != htons(ETH_P_8021Q)) ++ return -EOPNOTSUPP; ++ ++ data.vlan.hdr[data.vlan.num].id = act->vlan.vid; ++ data.vlan.hdr[data.vlan.num].proto = act->vlan.proto; ++ data.vlan.num++; ++ break; ++ case FLOW_ACTION_VLAN_POP: ++ break; ++ case FLOW_ACTION_PPPOE_PUSH: ++ break; ++ default: ++ return -EOPNOTSUPP; ++ } ++ } ++ ++ if (!is_valid_ether_addr(data.eth.h_source) || ++ !is_valid_ether_addr(data.eth.h_dest)) ++ return -EINVAL; ++ ++ err = airoha_ppe_foe_entry_prepare(&hwe, odev, offload_type, ++ &data, l4proto); ++ if (err) ++ return err; ++ ++ if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_PORTS)) { ++ struct flow_match_ports ports; ++ ++ if (offload_type == PPE_PKT_TYPE_BRIDGE) ++ return -EOPNOTSUPP; ++ ++ flow_rule_match_ports(rule, &ports); ++ data.src_port = ports.key->src; ++ data.dst_port = ports.key->dst; ++ } else if (offload_type != PPE_PKT_TYPE_BRIDGE) { ++ return -EOPNOTSUPP; ++ } ++ ++ if (addr_type == FLOW_DISSECTOR_KEY_IPV4_ADDRS) { ++ struct flow_match_ipv4_addrs addrs; ++ ++ flow_rule_match_ipv4_addrs(rule, &addrs); ++ data.v4.src_addr = addrs.key->src; ++ data.v4.dst_addr = addrs.key->dst; ++ airoha_ppe_foe_entry_set_ipv4_tuple(&hwe, &data, false); ++ } ++ ++ if (addr_type == FLOW_DISSECTOR_KEY_IPV6_ADDRS) { ++ struct flow_match_ipv6_addrs addrs; ++ ++ flow_rule_match_ipv6_addrs(rule, &addrs); ++ ++ data.v6.src_addr = addrs.key->src; ++ data.v6.dst_addr = addrs.key->dst; ++ airoha_ppe_foe_entry_set_ipv6_tuple(&hwe, &data); ++ } ++ ++ flow_action_for_each(i, act, &rule->action) { ++ if (act->id != FLOW_ACTION_MANGLE) ++ continue; ++ ++ if (offload_type == PPE_PKT_TYPE_BRIDGE) ++ return -EOPNOTSUPP; ++ ++ switch (act->mangle.htype) { ++ case FLOW_ACT_MANGLE_HDR_TYPE_TCP: ++ case FLOW_ACT_MANGLE_HDR_TYPE_UDP: ++ err = airoha_ppe_flow_mangle_ports(act, &data); ++ break; ++ case FLOW_ACT_MANGLE_HDR_TYPE_IP4: ++ err = airoha_ppe_flow_mangle_ipv4(act, &data); ++ break; ++ case FLOW_ACT_MANGLE_HDR_TYPE_ETH: ++ /* handled earlier */ ++ break; ++ default: ++ return -EOPNOTSUPP; ++ } ++ ++ if (err) ++ return err; ++ } ++ ++ if (addr_type == FLOW_DISSECTOR_KEY_IPV4_ADDRS) { ++ err = airoha_ppe_foe_entry_set_ipv4_tuple(&hwe, &data, true); ++ if (err) ++ return err; ++ } ++ ++ e = kzalloc(sizeof(*e), GFP_KERNEL); ++ if (!e) ++ return -ENOMEM; ++ ++ e->cookie = f->cookie; ++ memcpy(&e->data, &hwe, sizeof(e->data)); ++ ++ err = airoha_ppe_foe_flow_commit_entry(eth->ppe, e); ++ if (err) ++ goto free_entry; ++ ++ err = rhashtable_insert_fast(ð->flow_table, &e->node, ++ airoha_flow_table_params); ++ if (err < 0) ++ goto remove_foe_entry; ++ ++ return 0; ++ ++remove_foe_entry: ++ airoha_ppe_foe_flow_remove_entry(eth->ppe, e); ++free_entry: ++ kfree(e); ++ ++ return err; ++} ++ ++static int airoha_ppe_flow_offload_destroy(struct airoha_gdm_port *port, ++ struct flow_cls_offload *f) ++{ ++ struct airoha_eth *eth = port->qdma->eth; ++ struct airoha_flow_table_entry *e; ++ ++ e = rhashtable_lookup(ð->flow_table, &f->cookie, ++ airoha_flow_table_params); ++ if (!e) ++ return -ENOENT; ++ ++ airoha_ppe_foe_flow_remove_entry(eth->ppe, e); ++ rhashtable_remove_fast(ð->flow_table, &e->node, ++ airoha_flow_table_params); ++ kfree(e); ++ ++ return 0; ++} ++ ++static int airoha_ppe_flow_offload_cmd(struct airoha_gdm_port *port, ++ struct flow_cls_offload *f) ++{ ++ switch (f->command) { ++ case FLOW_CLS_REPLACE: ++ return airoha_ppe_flow_offload_replace(port, f); ++ case FLOW_CLS_DESTROY: ++ return airoha_ppe_flow_offload_destroy(port, f); ++ default: ++ break; ++ } ++ ++ return -EOPNOTSUPP; ++} ++ ++static int airoha_ppe_flush_sram_entries(struct airoha_ppe *ppe, ++ struct airoha_npu *npu) ++{ ++ int i, sram_num_entries = PPE_SRAM_NUM_ENTRIES; ++ struct airoha_foe_entry *hwe = ppe->foe; ++ ++ if (airoha_ppe2_is_enabled(ppe->eth)) ++ sram_num_entries = sram_num_entries / 2; ++ ++ for (i = 0; i < sram_num_entries; i++) ++ memset(&hwe[i], 0, sizeof(*hwe)); ++ ++ return npu->ops.ppe_flush_sram_entries(npu, ppe->foe_dma, ++ PPE_SRAM_NUM_ENTRIES); ++} ++ ++static struct airoha_npu *airoha_ppe_npu_get(struct airoha_eth *eth) ++{ ++ struct airoha_npu *npu = airoha_npu_get(eth->dev); ++ ++ if (IS_ERR(npu)) { ++ request_module("airoha-npu"); ++ npu = airoha_npu_get(eth->dev); ++ } ++ ++ return npu; ++} ++ ++static int airoha_ppe_offload_setup(struct airoha_eth *eth) ++{ ++ struct airoha_npu *npu = airoha_ppe_npu_get(eth); ++ int err; ++ ++ if (IS_ERR(npu)) ++ return PTR_ERR(npu); ++ ++ err = npu->ops.ppe_init(npu); ++ if (err) ++ goto error_npu_put; ++ ++ airoha_ppe_hw_init(eth->ppe); ++ err = airoha_ppe_flush_sram_entries(eth->ppe, npu); ++ if (err) ++ goto error_npu_put; ++ ++ rcu_assign_pointer(eth->npu, npu); ++ synchronize_rcu(); ++ ++ return 0; ++ ++error_npu_put: ++ airoha_npu_put(npu); ++ ++ return err; ++} ++ ++int airoha_ppe_setup_tc_block_cb(enum tc_setup_type type, void *type_data, ++ void *cb_priv) ++{ ++ struct flow_cls_offload *cls = type_data; ++ struct net_device *dev = cb_priv; ++ struct airoha_gdm_port *port = netdev_priv(dev); ++ struct airoha_eth *eth = port->qdma->eth; ++ int err = 0; ++ ++ if (!tc_can_offload(dev) || type != TC_SETUP_CLSFLOWER) ++ return -EOPNOTSUPP; ++ ++ mutex_lock(&flow_offload_mutex); ++ ++ if (!eth->npu) ++ err = airoha_ppe_offload_setup(eth); ++ if (!err) ++ err = airoha_ppe_flow_offload_cmd(port, cls); ++ ++ mutex_unlock(&flow_offload_mutex); ++ ++ return err; ++} ++ ++void airoha_ppe_check_skb(struct airoha_ppe *ppe, u16 hash) ++{ ++ u16 now, diff; ++ ++ if (hash > PPE_HASH_MASK) ++ return; ++ ++ now = (u16)jiffies; ++ diff = now - ppe->foe_check_time[hash]; ++ if (diff < HZ / 10) ++ return; ++ ++ ppe->foe_check_time[hash] = now; ++ airoha_ppe_foe_insert_entry(ppe, hash); ++} ++ ++int airoha_ppe_init(struct airoha_eth *eth) ++{ ++ struct airoha_ppe *ppe; ++ int foe_size; ++ ++ ppe = devm_kzalloc(eth->dev, sizeof(*ppe), GFP_KERNEL); ++ if (!ppe) ++ return -ENOMEM; ++ ++ foe_size = PPE_NUM_ENTRIES * sizeof(struct airoha_foe_entry); ++ ppe->foe = dmam_alloc_coherent(eth->dev, foe_size, &ppe->foe_dma, ++ GFP_KERNEL); ++ if (!ppe->foe) ++ return -ENOMEM; ++ ++ ppe->eth = eth; ++ eth->ppe = ppe; ++ ++ ppe->foe_flow = devm_kzalloc(eth->dev, ++ PPE_NUM_ENTRIES * sizeof(*ppe->foe_flow), ++ GFP_KERNEL); ++ if (!ppe->foe_flow) ++ return -ENOMEM; ++ ++ return rhashtable_init(ð->flow_table, &airoha_flow_table_params); ++} ++ ++void airoha_ppe_deinit(struct airoha_eth *eth) ++{ ++ struct airoha_npu *npu; ++ ++ rcu_read_lock(); ++ npu = rcu_dereference(eth->npu); ++ if (npu) { ++ npu->ops.ppe_deinit(npu); ++ airoha_npu_put(npu); ++ } ++ rcu_read_unlock(); ++ ++ rhashtable_destroy(ð->flow_table); ++} +--- a/drivers/net/ethernet/airoha/airoha_regs.h ++++ b/drivers/net/ethernet/airoha/airoha_regs.h +@@ -15,6 +15,7 @@ + #define CDM1_BASE 0x0400 + #define GDM1_BASE 0x0500 + #define PPE1_BASE 0x0c00 ++#define PPE2_BASE 0x1c00 + + #define CDM2_BASE 0x1400 + #define GDM2_BASE 0x1500 +@@ -36,6 +37,7 @@ + #define FE_RST_GDM3_MBI_ARB_MASK BIT(2) + #define FE_RST_CORE_MASK BIT(0) + ++#define REG_FE_FOE_TS 0x0010 + #define REG_FE_WAN_MAC_H 0x0030 + #define REG_FE_LAN_MAC_H 0x0040 + +@@ -192,11 +194,106 @@ + #define REG_FE_GDM_RX_ETH_L511_CNT_L(_n) (GDM_BASE(_n) + 0x198) + #define REG_FE_GDM_RX_ETH_L1023_CNT_L(_n) (GDM_BASE(_n) + 0x19c) + +-#define REG_PPE1_TB_HASH_CFG (PPE1_BASE + 0x250) +-#define PPE1_SRAM_TABLE_EN_MASK BIT(0) +-#define PPE1_SRAM_HASH1_EN_MASK BIT(8) +-#define PPE1_DRAM_TABLE_EN_MASK BIT(16) +-#define PPE1_DRAM_HASH1_EN_MASK BIT(24) ++#define REG_PPE_GLO_CFG(_n) (((_n) ? PPE2_BASE : PPE1_BASE) + 0x200) ++#define PPE_GLO_CFG_BUSY_MASK BIT(31) ++#define PPE_GLO_CFG_FLOW_DROP_UPDATE_MASK BIT(9) ++#define PPE_GLO_CFG_PSE_HASH_OFS_MASK BIT(6) ++#define PPE_GLO_CFG_PPE_BSWAP_MASK BIT(5) ++#define PPE_GLO_CFG_TTL_DROP_MASK BIT(4) ++#define PPE_GLO_CFG_IP4_CS_DROP_MASK BIT(3) ++#define PPE_GLO_CFG_IP4_L4_CS_DROP_MASK BIT(2) ++#define PPE_GLO_CFG_EN_MASK BIT(0) ++ ++#define REG_PPE_PPE_FLOW_CFG(_n) (((_n) ? PPE2_BASE : PPE1_BASE) + 0x204) ++#define PPE_FLOW_CFG_IP6_HASH_GRE_KEY_MASK BIT(20) ++#define PPE_FLOW_CFG_IP4_HASH_GRE_KEY_MASK BIT(19) ++#define PPE_FLOW_CFG_IP4_HASH_FLOW_LABEL_MASK BIT(18) ++#define PPE_FLOW_CFG_IP4_NAT_FRAG_MASK BIT(17) ++#define PPE_FLOW_CFG_IP_PROTO_BLACKLIST_MASK BIT(16) ++#define PPE_FLOW_CFG_IP4_DSLITE_MASK BIT(14) ++#define PPE_FLOW_CFG_IP4_NAPT_MASK BIT(13) ++#define PPE_FLOW_CFG_IP4_NAT_MASK BIT(12) ++#define PPE_FLOW_CFG_IP6_6RD_MASK BIT(10) ++#define PPE_FLOW_CFG_IP6_5T_ROUTE_MASK BIT(9) ++#define PPE_FLOW_CFG_IP6_3T_ROUTE_MASK BIT(8) ++#define PPE_FLOW_CFG_IP4_UDP_FRAG_MASK BIT(7) ++#define PPE_FLOW_CFG_IP4_TCP_FRAG_MASK BIT(6) ++ ++#define REG_PPE_IP_PROTO_CHK(_n) (((_n) ? PPE2_BASE : PPE1_BASE) + 0x208) ++#define PPE_IP_PROTO_CHK_IPV4_MASK GENMASK(15, 0) ++#define PPE_IP_PROTO_CHK_IPV6_MASK GENMASK(31, 16) ++ ++#define REG_PPE_TB_CFG(_n) (((_n) ? PPE2_BASE : PPE1_BASE) + 0x21c) ++#define PPE_SRAM_TB_NUM_ENTRY_MASK GENMASK(26, 24) ++#define PPE_TB_CFG_KEEPALIVE_MASK GENMASK(13, 12) ++#define PPE_TB_CFG_AGE_TCP_FIN_MASK BIT(11) ++#define PPE_TB_CFG_AGE_UDP_MASK BIT(10) ++#define PPE_TB_CFG_AGE_TCP_MASK BIT(9) ++#define PPE_TB_CFG_AGE_UNBIND_MASK BIT(8) ++#define PPE_TB_CFG_AGE_NON_L4_MASK BIT(7) ++#define PPE_TB_CFG_AGE_PREBIND_MASK BIT(6) ++#define PPE_TB_CFG_SEARCH_MISS_MASK GENMASK(5, 4) ++#define PPE_TB_ENTRY_SIZE_MASK BIT(3) ++#define PPE_DRAM_TB_NUM_ENTRY_MASK GENMASK(2, 0) ++ ++#define REG_PPE_TB_BASE(_n) (((_n) ? PPE2_BASE : PPE1_BASE) + 0x220) ++ ++#define REG_PPE_BIND_RATE(_n) (((_n) ? PPE2_BASE : PPE1_BASE) + 0x228) ++#define PPE_BIND_RATE_L2B_BIND_MASK GENMASK(31, 16) ++#define PPE_BIND_RATE_BIND_MASK GENMASK(15, 0) ++ ++#define REG_PPE_BIND_LIMIT0(_n) (((_n) ? PPE2_BASE : PPE1_BASE) + 0x22c) ++#define PPE_BIND_LIMIT0_HALF_MASK GENMASK(29, 16) ++#define PPE_BIND_LIMIT0_QUARTER_MASK GENMASK(13, 0) ++ ++#define REG_PPE_BIND_LIMIT1(_n) (((_n) ? PPE2_BASE : PPE1_BASE) + 0x230) ++#define PPE_BIND_LIMIT1_NON_L4_MASK GENMASK(23, 16) ++#define PPE_BIND_LIMIT1_FULL_MASK GENMASK(13, 0) ++ ++#define REG_PPE_BND_AGE0(_n) (((_n) ? PPE2_BASE : PPE1_BASE) + 0x23c) ++#define PPE_BIND_AGE0_DELTA_NON_L4 GENMASK(30, 16) ++#define PPE_BIND_AGE0_DELTA_UDP GENMASK(14, 0) ++ ++#define REG_PPE_UNBIND_AGE(_n) (((_n) ? PPE2_BASE : PPE1_BASE) + 0x238) ++#define PPE_UNBIND_AGE_MIN_PACKETS_MASK GENMASK(31, 16) ++#define PPE_UNBIND_AGE_DELTA_MASK GENMASK(7, 0) ++ ++#define REG_PPE_BND_AGE1(_n) (((_n) ? PPE2_BASE : PPE1_BASE) + 0x240) ++#define PPE_BIND_AGE1_DELTA_TCP_FIN GENMASK(30, 16) ++#define PPE_BIND_AGE1_DELTA_TCP GENMASK(14, 0) ++ ++#define REG_PPE_HASH_SEED(_n) (((_n) ? PPE2_BASE : PPE1_BASE) + 0x244) ++#define PPE_HASH_SEED 0x12345678 ++ ++#define REG_PPE_DFT_CPORT0(_n) (((_n) ? PPE2_BASE : PPE1_BASE) + 0x248) ++ ++#define REG_PPE_DFT_CPORT1(_n) (((_n) ? PPE2_BASE : PPE1_BASE) + 0x24c) ++ ++#define REG_PPE_TB_HASH_CFG(_n) (((_n) ? PPE2_BASE : PPE1_BASE) + 0x250) ++#define PPE_DRAM_HASH1_MODE_MASK GENMASK(31, 28) ++#define PPE_DRAM_HASH1_EN_MASK BIT(24) ++#define PPE_DRAM_HASH0_MODE_MASK GENMASK(23, 20) ++#define PPE_DRAM_TABLE_EN_MASK BIT(16) ++#define PPE_SRAM_HASH1_MODE_MASK GENMASK(15, 12) ++#define PPE_SRAM_HASH1_EN_MASK BIT(8) ++#define PPE_SRAM_HASH0_MODE_MASK GENMASK(7, 4) ++#define PPE_SRAM_TABLE_EN_MASK BIT(0) ++ ++#define REG_PPE_MTU_BASE(_n) (((_n) ? PPE2_BASE : PPE1_BASE) + 0x304) ++#define REG_PPE_MTU(_m, _n) (REG_PPE_MTU_BASE(_m) + ((_n) << 2)) ++#define FP1_EGRESS_MTU_MASK GENMASK(29, 16) ++#define FP0_EGRESS_MTU_MASK GENMASK(13, 0) ++ ++#define REG_PPE_RAM_CTRL(_n) (((_n) ? PPE2_BASE : PPE1_BASE) + 0x31c) ++#define PPE_SRAM_CTRL_ACK_MASK BIT(31) ++#define PPE_SRAM_CTRL_DUAL_SUCESS_MASK BIT(30) ++#define PPE_SRAM_CTRL_ENTRY_MASK GENMASK(23, 8) ++#define PPE_SRAM_WR_DUAL_DIRECTION_MASK BIT(2) ++#define PPE_SRAM_CTRL_WR_MASK BIT(1) ++#define PPE_SRAM_CTRL_REQ_MASK BIT(0) ++ ++#define REG_PPE_RAM_BASE(_n) (((_n) ? PPE2_BASE : PPE1_BASE) + 0x320) ++#define REG_PPE_RAM_ENTRY(_m, _n) (REG_PPE_RAM_BASE(_m) + ((_n) << 2)) + + #define REG_FE_GDM_TX_OK_PKT_CNT_H(_n) (GDM_BASE(_n) + 0x280) + #define REG_FE_GDM_TX_OK_BYTE_CNT_H(_n) (GDM_BASE(_n) + 0x284) diff --git a/target/linux/airoha/patches-6.6/048-14-v6.15-net-airoha-Add-loopback-support-for-GDM2.patch b/target/linux/airoha/patches-6.6/048-14-v6.15-net-airoha-Add-loopback-support-for-GDM2.patch new file mode 100644 index 00000000000000..224fe04f4472b2 --- /dev/null +++ b/target/linux/airoha/patches-6.6/048-14-v6.15-net-airoha-Add-loopback-support-for-GDM2.patch @@ -0,0 +1,210 @@ +From 9cd451d414f6e29f507a216fb3b19fa68c011f8c Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Fri, 28 Feb 2025 11:54:22 +0100 +Subject: [PATCH 14/15] net: airoha: Add loopback support for GDM2 + +Enable hw redirection for traffic received on GDM2 port to GDM{3,4}. +This is required to apply Qdisc offloading (HTB or ETS) for traffic to +and from GDM{3,4} port. + +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Paolo Abeni +--- + drivers/net/ethernet/airoha/airoha_eth.c | 71 ++++++++++++++++++++++- + drivers/net/ethernet/airoha/airoha_eth.h | 7 +++ + drivers/net/ethernet/airoha/airoha_ppe.c | 12 ++-- + drivers/net/ethernet/airoha/airoha_regs.h | 29 +++++++++ + 4 files changed, 111 insertions(+), 8 deletions(-) + +--- a/drivers/net/ethernet/airoha/airoha_eth.c ++++ b/drivers/net/ethernet/airoha/airoha_eth.c +@@ -1589,14 +1589,81 @@ static int airoha_dev_set_macaddr(struct + return 0; + } + ++static void airhoha_set_gdm2_loopback(struct airoha_gdm_port *port) ++{ ++ u32 pse_port = port->id == 3 ? FE_PSE_PORT_GDM3 : FE_PSE_PORT_GDM4; ++ struct airoha_eth *eth = port->qdma->eth; ++ u32 chan = port->id == 3 ? 4 : 0; ++ ++ /* Forward the traffic to the proper GDM port */ ++ airoha_set_gdm_port_fwd_cfg(eth, REG_GDM_FWD_CFG(2), pse_port); ++ airoha_fe_clear(eth, REG_GDM_FWD_CFG(2), GDM_STRIP_CRC); ++ ++ /* Enable GDM2 loopback */ ++ airoha_fe_wr(eth, REG_GDM_TXCHN_EN(2), 0xffffffff); ++ airoha_fe_wr(eth, REG_GDM_RXCHN_EN(2), 0xffff); ++ airoha_fe_rmw(eth, REG_GDM_LPBK_CFG(2), ++ LPBK_CHAN_MASK | LPBK_MODE_MASK | LPBK_EN_MASK, ++ FIELD_PREP(LPBK_CHAN_MASK, chan) | LPBK_EN_MASK); ++ airoha_fe_rmw(eth, REG_GDM_LEN_CFG(2), ++ GDM_SHORT_LEN_MASK | GDM_LONG_LEN_MASK, ++ FIELD_PREP(GDM_SHORT_LEN_MASK, 60) | ++ FIELD_PREP(GDM_LONG_LEN_MASK, AIROHA_MAX_MTU)); ++ ++ /* Disable VIP and IFC for GDM2 */ ++ airoha_fe_clear(eth, REG_FE_VIP_PORT_EN, BIT(2)); ++ airoha_fe_clear(eth, REG_FE_IFC_PORT_EN, BIT(2)); ++ ++ if (port->id == 3) { ++ /* FIXME: handle XSI_PCE1_PORT */ ++ airoha_fe_wr(eth, REG_PPE_DFT_CPORT0(0), 0x5500); ++ airoha_fe_rmw(eth, REG_FE_WAN_PORT, ++ WAN1_EN_MASK | WAN1_MASK | WAN0_MASK, ++ FIELD_PREP(WAN0_MASK, HSGMII_LAN_PCIE0_SRCPORT)); ++ airoha_fe_rmw(eth, ++ REG_SP_DFT_CPORT(HSGMII_LAN_PCIE0_SRCPORT >> 3), ++ SP_CPORT_PCIE0_MASK, ++ FIELD_PREP(SP_CPORT_PCIE0_MASK, ++ FE_PSE_PORT_CDM2)); ++ } else { ++ /* FIXME: handle XSI_USB_PORT */ ++ airoha_fe_rmw(eth, REG_SRC_PORT_FC_MAP6, ++ FC_ID_OF_SRC_PORT24_MASK, ++ FIELD_PREP(FC_ID_OF_SRC_PORT24_MASK, 2)); ++ airoha_fe_rmw(eth, REG_FE_WAN_PORT, ++ WAN1_EN_MASK | WAN1_MASK | WAN0_MASK, ++ FIELD_PREP(WAN0_MASK, HSGMII_LAN_ETH_SRCPORT)); ++ airoha_fe_rmw(eth, ++ REG_SP_DFT_CPORT(HSGMII_LAN_ETH_SRCPORT >> 3), ++ SP_CPORT_ETH_MASK, ++ FIELD_PREP(SP_CPORT_ETH_MASK, FE_PSE_PORT_CDM2)); ++ } ++} ++ + static int airoha_dev_init(struct net_device *dev) + { + struct airoha_gdm_port *port = netdev_priv(dev); + struct airoha_eth *eth = port->qdma->eth; ++ u32 pse_port; + + airoha_set_macaddr(port, dev->dev_addr); +- airoha_set_gdm_port_fwd_cfg(eth, REG_GDM_FWD_CFG(port->id), +- FE_PSE_PORT_PPE1); ++ ++ switch (port->id) { ++ case 3: ++ case 4: ++ /* If GDM2 is active we can't enable loopback */ ++ if (!eth->ports[1]) ++ airhoha_set_gdm2_loopback(port); ++ fallthrough; ++ case 2: ++ pse_port = FE_PSE_PORT_PPE2; ++ break; ++ default: ++ pse_port = FE_PSE_PORT_PPE1; ++ break; ++ } ++ ++ airoha_set_gdm_port_fwd_cfg(eth, REG_GDM_FWD_CFG(port->id), pse_port); + + return 0; + } +--- a/drivers/net/ethernet/airoha/airoha_eth.h ++++ b/drivers/net/ethernet/airoha/airoha_eth.h +@@ -68,6 +68,13 @@ enum { + }; + + enum { ++ HSGMII_LAN_PCIE0_SRCPORT = 0x16, ++ HSGMII_LAN_PCIE1_SRCPORT, ++ HSGMII_LAN_ETH_SRCPORT, ++ HSGMII_LAN_USB_SRCPORT, ++}; ++ ++enum { + XSI_PCIE0_VIP_PORT_MASK = BIT(22), + XSI_PCIE1_VIP_PORT_MASK = BIT(23), + XSI_USB_VIP_PORT_MASK = BIT(25), +--- a/drivers/net/ethernet/airoha/airoha_ppe.c ++++ b/drivers/net/ethernet/airoha/airoha_ppe.c +@@ -216,7 +216,8 @@ static int airoha_ppe_foe_entry_prepare( + AIROHA_FOE_IB1_BIND_TTL; + hwe->ib1 = val; + +- val = FIELD_PREP(AIROHA_FOE_IB2_PORT_AG, 0x1f); ++ val = FIELD_PREP(AIROHA_FOE_IB2_PORT_AG, 0x1f) | ++ AIROHA_FOE_IB2_PSE_QOS; + if (dsa_port >= 0) + val |= FIELD_PREP(AIROHA_FOE_IB2_NBQ, dsa_port); + +@@ -224,14 +225,13 @@ static int airoha_ppe_foe_entry_prepare( + struct airoha_gdm_port *port = netdev_priv(dev); + u8 pse_port; + +- pse_port = port->id == 4 ? FE_PSE_PORT_GDM4 : port->id; ++ if (dsa_port >= 0) ++ pse_port = port->id == 4 ? FE_PSE_PORT_GDM4 : port->id; ++ else ++ pse_port = 2; /* uplink relies on GDM2 loopback */ + val |= FIELD_PREP(AIROHA_FOE_IB2_PSE_PORT, pse_port); + } + +- /* FIXME: implement QoS support setting pse_port to 2 (loopback) +- * for uplink and setting qos bit in ib2 +- */ +- + if (is_multicast_ether_addr(data->eth.h_dest)) + val |= AIROHA_FOE_IB2_MULTICAST; + +--- a/drivers/net/ethernet/airoha/airoha_regs.h ++++ b/drivers/net/ethernet/airoha/airoha_regs.h +@@ -38,6 +38,12 @@ + #define FE_RST_CORE_MASK BIT(0) + + #define REG_FE_FOE_TS 0x0010 ++ ++#define REG_FE_WAN_PORT 0x0024 ++#define WAN1_EN_MASK BIT(16) ++#define WAN1_MASK GENMASK(12, 8) ++#define WAN0_MASK GENMASK(4, 0) ++ + #define REG_FE_WAN_MAC_H 0x0030 + #define REG_FE_LAN_MAC_H 0x0040 + +@@ -126,6 +132,7 @@ + #define GDM_IP4_CKSUM BIT(22) + #define GDM_TCP_CKSUM BIT(21) + #define GDM_UDP_CKSUM BIT(20) ++#define GDM_STRIP_CRC BIT(16) + #define GDM_UCFQ_MASK GENMASK(15, 12) + #define GDM_BCFQ_MASK GENMASK(11, 8) + #define GDM_MCFQ_MASK GENMASK(7, 4) +@@ -139,6 +146,16 @@ + #define GDM_SHORT_LEN_MASK GENMASK(13, 0) + #define GDM_LONG_LEN_MASK GENMASK(29, 16) + ++#define REG_GDM_LPBK_CFG(_n) (GDM_BASE(_n) + 0x1c) ++#define LPBK_GAP_MASK GENMASK(31, 24) ++#define LPBK_LEN_MASK GENMASK(23, 10) ++#define LPBK_CHAN_MASK GENMASK(8, 4) ++#define LPBK_MODE_MASK GENMASK(3, 1) ++#define LPBK_EN_MASK BIT(0) ++ ++#define REG_GDM_TXCHN_EN(_n) (GDM_BASE(_n) + 0x24) ++#define REG_GDM_RXCHN_EN(_n) (GDM_BASE(_n) + 0x28) ++ + #define REG_FE_CPORT_CFG (GDM1_BASE + 0x40) + #define FE_CPORT_PAD BIT(26) + #define FE_CPORT_PORT_XFC_MASK BIT(25) +@@ -351,6 +368,18 @@ + + #define REG_MC_VLAN_DATA 0x2108 + ++#define REG_SP_DFT_CPORT(_n) (0x20e0 + ((_n) << 2)) ++#define SP_CPORT_PCIE1_MASK GENMASK(31, 28) ++#define SP_CPORT_PCIE0_MASK GENMASK(27, 24) ++#define SP_CPORT_USB_MASK GENMASK(7, 4) ++#define SP_CPORT_ETH_MASK GENMASK(7, 4) ++ ++#define REG_SRC_PORT_FC_MAP6 0x2298 ++#define FC_ID_OF_SRC_PORT27_MASK GENMASK(28, 24) ++#define FC_ID_OF_SRC_PORT26_MASK GENMASK(20, 16) ++#define FC_ID_OF_SRC_PORT25_MASK GENMASK(12, 8) ++#define FC_ID_OF_SRC_PORT24_MASK GENMASK(4, 0) ++ + #define REG_CDM5_RX_OQ1_DROP_CNT 0x29d4 + + /* QDMA */ diff --git a/target/linux/airoha/patches-6.6/048-15-v6.15-net-airoha-Introduce-PPE-debugfs-support.patch b/target/linux/airoha/patches-6.6/048-15-v6.15-net-airoha-Introduce-PPE-debugfs-support.patch new file mode 100644 index 00000000000000..50d7fa12668f9d --- /dev/null +++ b/target/linux/airoha/patches-6.6/048-15-v6.15-net-airoha-Introduce-PPE-debugfs-support.patch @@ -0,0 +1,291 @@ +From 3fe15c640f3808c3faf235553c67c867d1389e5c Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Fri, 28 Feb 2025 11:54:23 +0100 +Subject: [PATCH 15/15] net: airoha: Introduce PPE debugfs support + +Similar to PPE support for Mediatek devices, introduce PPE debugfs +in order to dump binded and unbinded flows. + +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Paolo Abeni +--- + drivers/net/ethernet/airoha/Makefile | 1 + + drivers/net/ethernet/airoha/airoha_eth.h | 14 ++ + drivers/net/ethernet/airoha/airoha_ppe.c | 17 +- + .../net/ethernet/airoha/airoha_ppe_debugfs.c | 181 ++++++++++++++++++ + 4 files changed, 209 insertions(+), 4 deletions(-) + create mode 100644 drivers/net/ethernet/airoha/airoha_ppe_debugfs.c + +--- a/drivers/net/ethernet/airoha/Makefile ++++ b/drivers/net/ethernet/airoha/Makefile +@@ -5,4 +5,5 @@ + + obj-$(CONFIG_NET_AIROHA) += airoha-eth.o + airoha-eth-y := airoha_eth.o airoha_ppe.o ++airoha-eth-$(CONFIG_DEBUG_FS) += airoha_ppe_debugfs.o + obj-$(CONFIG_NET_AIROHA_NPU) += airoha_npu.o +--- a/drivers/net/ethernet/airoha/airoha_eth.h ++++ b/drivers/net/ethernet/airoha/airoha_eth.h +@@ -7,6 +7,7 @@ + #ifndef AIROHA_ETH_H + #define AIROHA_ETH_H + ++#include + #include + #include + #include +@@ -480,6 +481,8 @@ struct airoha_ppe { + + struct hlist_head *foe_flow; + u16 foe_check_time[PPE_NUM_ENTRIES]; ++ ++ struct dentry *debugfs_dir; + }; + + struct airoha_eth { +@@ -533,5 +536,16 @@ int airoha_ppe_setup_tc_block_cb(enum tc + void *cb_priv); + int airoha_ppe_init(struct airoha_eth *eth); + void airoha_ppe_deinit(struct airoha_eth *eth); ++struct airoha_foe_entry *airoha_ppe_foe_get_entry(struct airoha_ppe *ppe, ++ u32 hash); ++ ++#if CONFIG_DEBUG_FS ++int airoha_ppe_debugfs_init(struct airoha_ppe *ppe); ++#else ++static inline int airoha_ppe_debugfs_init(struct airoha_ppe *ppe) ++{ ++ return 0; ++} ++#endif + + #endif /* AIROHA_ETH_H */ +--- a/drivers/net/ethernet/airoha/airoha_ppe.c ++++ b/drivers/net/ethernet/airoha/airoha_ppe.c +@@ -390,8 +390,8 @@ static u32 airoha_ppe_foe_get_entry_hash + return hash; + } + +-static struct airoha_foe_entry * +-airoha_ppe_foe_get_entry(struct airoha_ppe *ppe, u32 hash) ++struct airoha_foe_entry *airoha_ppe_foe_get_entry(struct airoha_ppe *ppe, ++ u32 hash) + { + if (hash < PPE_SRAM_NUM_ENTRIES) { + u32 *hwe = ppe->foe + hash * sizeof(struct airoha_foe_entry); +@@ -861,7 +861,7 @@ void airoha_ppe_check_skb(struct airoha_ + int airoha_ppe_init(struct airoha_eth *eth) + { + struct airoha_ppe *ppe; +- int foe_size; ++ int foe_size, err; + + ppe = devm_kzalloc(eth->dev, sizeof(*ppe), GFP_KERNEL); + if (!ppe) +@@ -882,7 +882,15 @@ int airoha_ppe_init(struct airoha_eth *e + if (!ppe->foe_flow) + return -ENOMEM; + +- return rhashtable_init(ð->flow_table, &airoha_flow_table_params); ++ err = rhashtable_init(ð->flow_table, &airoha_flow_table_params); ++ if (err) ++ return err; ++ ++ err = airoha_ppe_debugfs_init(ppe); ++ if (err) ++ rhashtable_destroy(ð->flow_table); ++ ++ return err; + } + + void airoha_ppe_deinit(struct airoha_eth *eth) +@@ -898,4 +906,5 @@ void airoha_ppe_deinit(struct airoha_eth + rcu_read_unlock(); + + rhashtable_destroy(ð->flow_table); ++ debugfs_remove(eth->ppe->debugfs_dir); + } +--- /dev/null ++++ b/drivers/net/ethernet/airoha/airoha_ppe_debugfs.c +@@ -0,0 +1,181 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * Copyright (c) 2025 AIROHA Inc ++ * Author: Lorenzo Bianconi ++ */ ++ ++#include "airoha_eth.h" ++ ++static void airoha_debugfs_ppe_print_tuple(struct seq_file *m, ++ void *src_addr, void *dest_addr, ++ u16 *src_port, u16 *dest_port, ++ bool ipv6) ++{ ++ __be32 n_addr[IPV6_ADDR_WORDS]; ++ ++ if (ipv6) { ++ ipv6_addr_cpu_to_be32(n_addr, src_addr); ++ seq_printf(m, "%pI6", n_addr); ++ } else { ++ seq_printf(m, "%pI4h", src_addr); ++ } ++ if (src_port) ++ seq_printf(m, ":%d", *src_port); ++ ++ seq_puts(m, "->"); ++ ++ if (ipv6) { ++ ipv6_addr_cpu_to_be32(n_addr, dest_addr); ++ seq_printf(m, "%pI6", n_addr); ++ } else { ++ seq_printf(m, "%pI4h", dest_addr); ++ } ++ if (dest_port) ++ seq_printf(m, ":%d", *dest_port); ++} ++ ++static int airoha_ppe_debugfs_foe_show(struct seq_file *m, void *private, ++ bool bind) ++{ ++ static const char *const ppe_type_str[] = { ++ [PPE_PKT_TYPE_IPV4_HNAPT] = "IPv4 5T", ++ [PPE_PKT_TYPE_IPV4_ROUTE] = "IPv4 3T", ++ [PPE_PKT_TYPE_BRIDGE] = "L2B", ++ [PPE_PKT_TYPE_IPV4_DSLITE] = "DS-LITE", ++ [PPE_PKT_TYPE_IPV6_ROUTE_3T] = "IPv6 3T", ++ [PPE_PKT_TYPE_IPV6_ROUTE_5T] = "IPv6 5T", ++ [PPE_PKT_TYPE_IPV6_6RD] = "6RD", ++ }; ++ static const char *const ppe_state_str[] = { ++ [AIROHA_FOE_STATE_INVALID] = "INV", ++ [AIROHA_FOE_STATE_UNBIND] = "UNB", ++ [AIROHA_FOE_STATE_BIND] = "BND", ++ [AIROHA_FOE_STATE_FIN] = "FIN", ++ }; ++ struct airoha_ppe *ppe = m->private; ++ int i; ++ ++ for (i = 0; i < PPE_NUM_ENTRIES; i++) { ++ const char *state_str, *type_str = "UNKNOWN"; ++ void *src_addr = NULL, *dest_addr = NULL; ++ u16 *src_port = NULL, *dest_port = NULL; ++ struct airoha_foe_mac_info_common *l2; ++ unsigned char h_source[ETH_ALEN] = {}; ++ unsigned char h_dest[ETH_ALEN]; ++ struct airoha_foe_entry *hwe; ++ u32 type, state, ib2, data; ++ bool ipv6 = false; ++ ++ hwe = airoha_ppe_foe_get_entry(ppe, i); ++ if (!hwe) ++ continue; ++ ++ state = FIELD_GET(AIROHA_FOE_IB1_BIND_STATE, hwe->ib1); ++ if (!state) ++ continue; ++ ++ if (bind && state != AIROHA_FOE_STATE_BIND) ++ continue; ++ ++ state_str = ppe_state_str[state % ARRAY_SIZE(ppe_state_str)]; ++ type = FIELD_GET(AIROHA_FOE_IB1_BIND_PACKET_TYPE, hwe->ib1); ++ if (type < ARRAY_SIZE(ppe_type_str) && ppe_type_str[type]) ++ type_str = ppe_type_str[type]; ++ ++ seq_printf(m, "%05x %s %7s", i, state_str, type_str); ++ ++ switch (type) { ++ case PPE_PKT_TYPE_IPV4_HNAPT: ++ case PPE_PKT_TYPE_IPV4_DSLITE: ++ src_port = &hwe->ipv4.orig_tuple.src_port; ++ dest_port = &hwe->ipv4.orig_tuple.dest_port; ++ fallthrough; ++ case PPE_PKT_TYPE_IPV4_ROUTE: ++ src_addr = &hwe->ipv4.orig_tuple.src_ip; ++ dest_addr = &hwe->ipv4.orig_tuple.dest_ip; ++ break; ++ case PPE_PKT_TYPE_IPV6_ROUTE_5T: ++ src_port = &hwe->ipv6.src_port; ++ dest_port = &hwe->ipv6.dest_port; ++ fallthrough; ++ case PPE_PKT_TYPE_IPV6_ROUTE_3T: ++ case PPE_PKT_TYPE_IPV6_6RD: ++ src_addr = &hwe->ipv6.src_ip; ++ dest_addr = &hwe->ipv6.dest_ip; ++ ipv6 = true; ++ break; ++ default: ++ break; ++ } ++ ++ if (src_addr && dest_addr) { ++ seq_puts(m, " orig="); ++ airoha_debugfs_ppe_print_tuple(m, src_addr, dest_addr, ++ src_port, dest_port, ipv6); ++ } ++ ++ switch (type) { ++ case PPE_PKT_TYPE_IPV4_HNAPT: ++ case PPE_PKT_TYPE_IPV4_DSLITE: ++ src_port = &hwe->ipv4.new_tuple.src_port; ++ dest_port = &hwe->ipv4.new_tuple.dest_port; ++ fallthrough; ++ case PPE_PKT_TYPE_IPV4_ROUTE: ++ src_addr = &hwe->ipv4.new_tuple.src_ip; ++ dest_addr = &hwe->ipv4.new_tuple.dest_ip; ++ seq_puts(m, " new="); ++ airoha_debugfs_ppe_print_tuple(m, src_addr, dest_addr, ++ src_port, dest_port, ++ ipv6); ++ break; ++ default: ++ break; ++ } ++ ++ if (type >= PPE_PKT_TYPE_IPV6_ROUTE_3T) { ++ data = hwe->ipv6.data; ++ ib2 = hwe->ipv6.ib2; ++ l2 = &hwe->ipv6.l2; ++ } else { ++ data = hwe->ipv4.data; ++ ib2 = hwe->ipv4.ib2; ++ l2 = &hwe->ipv4.l2.common; ++ *((__be16 *)&h_source[4]) = ++ cpu_to_be16(hwe->ipv4.l2.src_mac_lo); ++ } ++ ++ *((__be32 *)h_dest) = cpu_to_be32(l2->dest_mac_hi); ++ *((__be16 *)&h_dest[4]) = cpu_to_be16(l2->dest_mac_lo); ++ *((__be32 *)h_source) = cpu_to_be32(l2->src_mac_hi); ++ ++ seq_printf(m, " eth=%pM->%pM etype=%04x data=%08x" ++ " vlan=%d,%d ib1=%08x ib2=%08x\n", ++ h_source, h_dest, l2->etype, data, ++ l2->vlan1, l2->vlan2, hwe->ib1, ib2); ++ } ++ ++ return 0; ++} ++ ++static int airoha_ppe_debugfs_foe_all_show(struct seq_file *m, void *private) ++{ ++ return airoha_ppe_debugfs_foe_show(m, private, false); ++} ++DEFINE_SHOW_ATTRIBUTE(airoha_ppe_debugfs_foe_all); ++ ++static int airoha_ppe_debugfs_foe_bind_show(struct seq_file *m, void *private) ++{ ++ return airoha_ppe_debugfs_foe_show(m, private, true); ++} ++DEFINE_SHOW_ATTRIBUTE(airoha_ppe_debugfs_foe_bind); ++ ++int airoha_ppe_debugfs_init(struct airoha_ppe *ppe) ++{ ++ ppe->debugfs_dir = debugfs_create_dir("ppe", NULL); ++ debugfs_create_file("entries", 0444, ppe->debugfs_dir, ppe, ++ &airoha_ppe_debugfs_foe_all_fops); ++ debugfs_create_file("bind", 0444, ppe->debugfs_dir, ppe, ++ &airoha_ppe_debugfs_foe_bind_fops); ++ ++ return 0; ++} diff --git a/target/linux/airoha/patches-6.6/113-net-airoha-Fix-channel-configuration-for-ETS-Qdisc.patch b/target/linux/airoha/patches-6.6/113-net-airoha-Fix-channel-configuration-for-ETS-Qdisc.patch index e98fdad065e59e..21896d7fa998a5 100644 --- a/target/linux/airoha/patches-6.6/113-net-airoha-Fix-channel-configuration-for-ETS-Qdisc.patch +++ b/target/linux/airoha/patches-6.6/113-net-airoha-Fix-channel-configuration-for-ETS-Qdisc.patch @@ -84,9 +84,9 @@ change-id: 20250107-airoha-ets-fix-chan-e35ccac76d64 Best regards, ---- a/drivers/net/ethernet/mediatek/airoha_eth.c -+++ b/drivers/net/ethernet/mediatek/airoha_eth.c -@@ -2846,11 +2846,14 @@ static int airoha_qdma_get_tx_ets_stats( +--- a/drivers/net/ethernet/airoha/airoha_eth.c ++++ b/drivers/net/ethernet/airoha/airoha_eth.c +@@ -2064,11 +2064,14 @@ static int airoha_qdma_get_tx_ets_stats( static int airoha_tc_setup_qdisc_ets(struct airoha_gdm_port *port, struct tc_ets_qopt_offload *opt) { From 97a75a72e3fffdc686c7ed7d0bb794f29a682221 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Wed, 5 Feb 2025 22:23:21 +0100 Subject: [PATCH 809/877] generic: backport some flow offload helper patch Backport some flow offload helper patch in preparation for Airoha Flow Offload support. Link: https://github.com/openwrt/openwrt/pull/18166 (cherry picked from commit 34ba7e8a8ab10900a3ca80fc40e7cafd1e7edb50) [ drop merged patch 705-v6.12-netdevice-add-netdev... ] Signed-off-by: Christian Marangi --- ...ad-add-control-flag-checking-helpers.patch | 101 ++++++++++++++++++ ...ddr_-cpu_to_be32-be32_to_cpu-helpers.patch | 40 +++++++ 2 files changed, 141 insertions(+) create mode 100644 target/linux/generic/backport-6.6/703-v6.10-flow_offload-add-control-flag-checking-helpers.patch create mode 100644 target/linux/generic/backport-6.6/704-v6.12-ipv6-Add-ipv6_addr_-cpu_to_be32-be32_to_cpu-helpers.patch diff --git a/target/linux/generic/backport-6.6/703-v6.10-flow_offload-add-control-flag-checking-helpers.patch b/target/linux/generic/backport-6.6/703-v6.10-flow_offload-add-control-flag-checking-helpers.patch new file mode 100644 index 00000000000000..457dac16d43b43 --- /dev/null +++ b/target/linux/generic/backport-6.6/703-v6.10-flow_offload-add-control-flag-checking-helpers.patch @@ -0,0 +1,101 @@ +From d11e63119432bdb55065d094cb6fd37e9147c70d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= +Date: Thu, 11 Apr 2024 10:52:54 +0000 +Subject: [PATCH] flow_offload: add control flag checking helpers +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +These helpers aim to help drivers, with checking +for the presence of unsupported control flags. + +For drivers supporting at least one control flag: + flow_rule_is_supp_control_flags() + +For drivers using flow_rule_match_control(), but not using flags: + flow_rule_has_control_flags() + +For drivers not using flow_rule_match_control(): + flow_rule_match_has_control_flags() + +While primarily aimed at FLOW_DISSECTOR_KEY_CONTROL +and flow_rule_match_control(), then the first two +can also be used with FLOW_DISSECTOR_KEY_ENC_CONTROL +and flow_rule_match_enc_control(). + +These helpers mirrors the existing check done in sfc: + drivers/net/ethernet/sfc/tc.c +276 + +Only compile-tested. + +Signed-off-by: Asbjørn Sloth Tønnesen +Reviewed-by: Louis Peens +Signed-off-by: David S. Miller +--- + include/net/flow_offload.h | 55 ++++++++++++++++++++++++++++++++++++++ + 1 file changed, 55 insertions(+) + +--- a/include/net/flow_offload.h ++++ b/include/net/flow_offload.h +@@ -449,6 +449,61 @@ static inline bool flow_rule_match_key(c + return dissector_uses_key(rule->match.dissector, key); + } + ++/** ++ * flow_rule_is_supp_control_flags() - check for supported control flags ++ * @supp_flags: control flags supported by driver ++ * @ctrl_flags: control flags present in rule ++ * @extack: The netlink extended ACK for reporting errors. ++ * ++ * Return: true if only supported control flags are set, false otherwise. ++ */ ++static inline bool flow_rule_is_supp_control_flags(const u32 supp_flags, ++ const u32 ctrl_flags, ++ struct netlink_ext_ack *extack) ++{ ++ if (likely((ctrl_flags & ~supp_flags) == 0)) ++ return true; ++ ++ NL_SET_ERR_MSG_FMT_MOD(extack, ++ "Unsupported match on control.flags %#x", ++ ctrl_flags); ++ ++ return false; ++} ++ ++/** ++ * flow_rule_has_control_flags() - check for presence of any control flags ++ * @ctrl_flags: control flags present in rule ++ * @extack: The netlink extended ACK for reporting errors. ++ * ++ * Return: true if control flags are set, false otherwise. ++ */ ++static inline bool flow_rule_has_control_flags(const u32 ctrl_flags, ++ struct netlink_ext_ack *extack) ++{ ++ return !flow_rule_is_supp_control_flags(0, ctrl_flags, extack); ++} ++ ++/** ++ * flow_rule_match_has_control_flags() - match and check for any control flags ++ * @rule: The flow_rule under evaluation. ++ * @extack: The netlink extended ACK for reporting errors. ++ * ++ * Return: true if control flags are set, false otherwise. ++ */ ++static inline bool flow_rule_match_has_control_flags(struct flow_rule *rule, ++ struct netlink_ext_ack *extack) ++{ ++ struct flow_match_control match; ++ ++ if (!flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_CONTROL)) ++ return false; ++ ++ flow_rule_match_control(rule, &match); ++ ++ return flow_rule_has_control_flags(match.mask->flags, extack); ++} ++ + struct flow_stats { + u64 pkts; + u64 bytes; diff --git a/target/linux/generic/backport-6.6/704-v6.12-ipv6-Add-ipv6_addr_-cpu_to_be32-be32_to_cpu-helpers.patch b/target/linux/generic/backport-6.6/704-v6.12-ipv6-Add-ipv6_addr_-cpu_to_be32-be32_to_cpu-helpers.patch new file mode 100644 index 00000000000000..2f4eec6953f6cc --- /dev/null +++ b/target/linux/generic/backport-6.6/704-v6.12-ipv6-Add-ipv6_addr_-cpu_to_be32-be32_to_cpu-helpers.patch @@ -0,0 +1,40 @@ +From f40a455d01f80c6638be382d75cb1c4e7748d8af Mon Sep 17 00:00:00 2001 +From: Simon Horman +Date: Tue, 13 Aug 2024 14:33:47 +0100 +Subject: [PATCH] ipv6: Add ipv6_addr_{cpu_to_be32,be32_to_cpu} helpers + +Add helpers to convert an ipv6 addr, expressed as an array +of words, from CPU to big-endian byte order, and vice versa. + +No functional change intended. +Compile tested only. + +Suggested-by: Andrew Lunn +Link: https://lore.kernel.org/netdev/c7684349-535c-45a4-9a74-d47479a50020@lunn.ch/ +Reviewed-by: Andrew Lunn +Signed-off-by: Simon Horman +Link: https://patch.msgid.link/20240813-ipv6_addr-helpers-v2-1-5c974f8cca3e@kernel.org +Signed-off-by: Jakub Kicinski +--- + include/net/ipv6.h | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +--- a/include/net/ipv6.h ++++ b/include/net/ipv6.h +@@ -1382,4 +1382,16 @@ static inline void ip6_sock_set_recvpkti + release_sock(sk); + } + ++#define IPV6_ADDR_WORDS 4 ++ ++static inline void ipv6_addr_cpu_to_be32(__be32 *dst, const u32 *src) ++{ ++ cpu_to_be32_array(dst, src, IPV6_ADDR_WORDS); ++} ++ ++static inline void ipv6_addr_be32_to_cpu(u32 *dst, const __be32 *src) ++{ ++ be32_to_cpu_array(dst, src, IPV6_ADDR_WORDS); ++} ++ + #endif /* _NET_IPV6_H */ From 05db6b3c5aa1eebbaf510f9954f2c7d2bb7a0963 Mon Sep 17 00:00:00 2001 From: Coia Prant Date: Sat, 9 Aug 2025 01:35:57 +0800 Subject: [PATCH 810/877] ramips: add support for Hongdian H7920 v40 This is an industrial 4G router equipped with OpenWrt SNAPSHOT OEM customized version WARNING: The original firmware device tree is modified from evb boards, and the device tree name is evb board. This submitted device tree is a modified version, which deletes the non-this-device parts and adds GPIO watchdog. Specification: - SoC: MediaTek MT7628NN - Flash: 16 MB - RAM: 128 MB - Power: DC 5V-36V 1.5A - Ethernet: 1x WAN [slot not install], 1x LAN (10/100 Mbps) - Wireless radio: 802.11n 2.4g-only [antenna not install] - LED: System/Power (RUN): GPIO/37 active-low Modem: GPIO/3 active-low RF (Modem Signal): GPIO/2 active-low - Button: WPS / RESET: GPIO/11 active-low - UART: 1x UART on PCB - 115200 8N1 - Serial / COM: 1X RS232/RS485 on board (GPIO/6 hi:RS485 lo:RS232) - GPIO Watchdog: GPIO/0 mode=toggle timeout=1s - Modem: 1x Built-in modem on board (Power: GPIO/4 active-high) - PCIe: 1x miniPCIe for modem [slot not install] - SIM Slots: 1x SIM Slots Issue: - Factory partition not store mac address on original firmware Flash instruction: Using SSH/Telnet: 1. Connect the board to the computer via RJ45 Ethernet 2. Login 192.168.8.1 with root password "superzxmn" (SSH Port 22, Telnet Port 5188) 3. Download openwrt firmware on the computer. 4. Use scp or sftp put firmware to board /tmp 5. Use command "mtd -r write openwrt-ramips-mt76x8-hongdian_h7920-v40-squashfs-sysupgrade.bin firmware" to flash Original Firmware Dump / More details: https://blog.gov.cooking/archives/research-hongdian-h7920-v40-and-flash.html Signed-off-by: Coia Prant Tested-by: Coia Prant (cherry picked from commit ebee9462273d3d30dbd29434e4f715ce39f80efc) Link: https://github.com/openwrt/openwrt/pull/19716 Signed-off-by: Hauke Mehrtens --- .../dts/mt7628an_hongdian_h7920-v40.dts | 171 ++++++++++++++++++ target/linux/ramips/image/mt76x8.mk | 9 + .../mt76x8/base-files/etc/board.d/02_network | 4 +- .../base-files/etc/board.d/03_gpio_switches | 20 ++ 4 files changed, 203 insertions(+), 1 deletion(-) create mode 100644 target/linux/ramips/dts/mt7628an_hongdian_h7920-v40.dts create mode 100644 target/linux/ramips/mt76x8/base-files/etc/board.d/03_gpio_switches diff --git a/target/linux/ramips/dts/mt7628an_hongdian_h7920-v40.dts b/target/linux/ramips/dts/mt7628an_hongdian_h7920-v40.dts new file mode 100644 index 00000000000000..76c395c382e6d0 --- /dev/null +++ b/target/linux/ramips/dts/mt7628an_hongdian_h7920-v40.dts @@ -0,0 +1,171 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7628an.dtsi" + +#include +#include +#include + +/ { + compatible = "hongdian,h7920-v40", "mediatek,mt7628an-soc"; + model = "Hongdian H7920 v40"; + + aliases { + led-boot = &led_sys; + led-failsafe = &led_sys; + led-running = &led_sys; + led-upgrade = &led_sys; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + leds { + compatible = "gpio-leds"; + + led-rf { + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + color = ; + function = "rf"; + }; + + led-net { + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_MOBILE; + }; + + led_sys: led-sys { + gpios = <&gpio 37 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_POWER; + default-state = "on"; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + watchdog { + compatible = "linux,wdt-gpio"; + + gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; + hw_algo = "toggle"; + hw_margin_ms = <600>; + always-running; + }; + + gpio-export { + compatible = "gpio-export"; + + gpio_modem_power { + gpio-export,name = "modem_power"; + gpio-export,output = <0>; + gpios = <&gpio 4 GPIO_ACTIVE_HIGH>; + }; + + gpio_serial_rs485_mode { + gpio-export,name = "serial_rs485_mode"; + gpio-export,output = <0>; + gpios = <&gpio 6 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&watchdog { + status = "disabled"; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <40000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x400>; + }; + + macaddr_factory_28: macaddr@28 { + reg = <0x28 0x6>; + }; + }; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; + }; + }; +}; + +&state_default { + gpio { + groups = "i2s", "gpio", "refclk"; + function = "gpio"; + }; +}; + +ðernet { + nvmem-cells = <&macaddr_factory_28>; + nvmem-cell-names = "mac-address"; +}; + +&esw { + mediatek,portmap = <0x3e>; + mediatek,portdisable = <0x3c>; +}; + +&wmac { + status = "okay"; + + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; +}; + +&uart1 { + status = "okay"; +}; + +&pcie { + status = "okay"; +}; diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk index c7168cc9368e2f..314f8e1e9f77d7 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -321,6 +321,15 @@ define Device/hiwifi_hc5861b endef TARGET_DEVICES += hiwifi_hc5861b +define Device/hongdian_h7920-v40 + IMAGE_SIZE := 16064k + DEVICE_VENDOR := Hongdian + DEVICE_MODEL := H7920 + DEVICE_VARIANT := v40 + DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-net-qmi-wwan kmod-usb-serial-option uqmi +endef +TARGET_DEVICES += hongdian_h7920-v40 + define Device/iptime_a3 IMAGE_SIZE := 7936k UIMAGE_NAME := a3 diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network index 23ec31f91258a3..372821c3b8ebe3 100644 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network @@ -107,7 +107,8 @@ ramips_setup_interfaces() "2:lan:2" "3:lan:1" "4:wan" "6@eth0" ;; duzun,dm06|\ - glinet,gl-mt300n-v2) + glinet,gl-mt300n-v2|\ + hongdian,h7920-v40) ucidef_add_switch "switch0" \ "1:lan" "0:wan" "6@eth0" ;; @@ -277,6 +278,7 @@ ramips_setup_macs() totolink,a3) wan_mac=$(mtd_get_mac_binary u-boot 0x1fc40) ;; + hongdian,h7920-v40|\ jotale,js76x8-8m|\ jotale,js76x8-16m|\ jotale,js76x8-32m|\ diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/03_gpio_switches b/target/linux/ramips/mt76x8/base-files/etc/board.d/03_gpio_switches new file mode 100644 index 00000000000000..c70e59c48032fc --- /dev/null +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/03_gpio_switches @@ -0,0 +1,20 @@ +# +# Copyright (C) 2025 OpenWrt.org +# + +. /lib/functions/uci-defaults.sh + +board_config_update + +board=$(board_name) + +case "$board" in +hongdian,h7920-v40) + ucidef_add_gpio_switch "modem_enable" "Modem power" "modem_power" "1" + ucidef_add_gpio_switch "switch_serial_mode" "Switch RS232 to RS485" "serial_rs485_mode" "0" + ;; +esac + +board_config_flush + +exit 0 From 124f61eddbdc668ef5fc709b90510278f041bb64 Mon Sep 17 00:00:00 2001 From: Mateusz Krzak Date: Thu, 22 May 2025 18:36:38 +0200 Subject: [PATCH 811/877] mediatek: filogic: D-Link M30/M60: include initramfs in recovery Currently, if OEM recovery flashes OpenWrt to second ubi1, OpenWrt cannot boot. With this commit, recovery image is built with initramfs kernel, so that it can boot from either ubi or ubi1. This adds an extra step to OpenWrt installation from OEM: user needs to sysupgrade from initramfs to full system. Signed-off-by: Mateusz Krzak Link: https://github.com/openwrt/openwrt/pull/18878 (cherry picked from commit 6615c8cfc85f1373cf93a9fc08cb1cb3bbefc964) Signed-off-by: Mateusz Krzak Link: https://github.com/openwrt/openwrt/pull/19595 Signed-off-by: Hauke Mehrtens --- target/linux/mediatek/image/filogic.mk | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index ab5a2b7c87690f..38db49c692280c 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -860,7 +860,10 @@ define Device/dlink_aquila-pro-ai-m30-a1 IMAGES += recovery.bin IMAGE_SIZE := 51200k IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata - IMAGE/recovery.bin := sysupgrade-tar | pad-to $$(IMAGE_SIZE) | dlink-ai-recovery-header DLK6E6110001 \x6A\x28\xEE\x0B \x00\x00\x2C\x00 \x00\x00\x20\x03 \x61\x6E +ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) + IMAGE/recovery.bin := append-image-stage initramfs-kernel.bin | sysupgrade-tar kernel=$$$$@ |\ + pad-to $$(IMAGE_SIZE) | dlink-ai-recovery-header DLK6E6110001 \x6A\x28\xEE\x0B \x00\x00\x2C\x00 \x00\x00\x20\x03 \x61\x6E +endif endef TARGET_DEVICES += dlink_aquila-pro-ai-m30-a1 @@ -874,7 +877,10 @@ define Device/dlink_aquila-pro-ai-m60-a1 IMAGES += recovery.bin IMAGE_SIZE := 51200k IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata - IMAGE/recovery.bin := sysupgrade-tar | pad-to $$(IMAGE_SIZE) | dlink-ai-recovery-header DLK6E8202001 \x30\x6C\x19\x0C \x00\x00\x2C\x00 \x00\x00\x20\x03 \x82\x6E +ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) + IMAGE/recovery.bin := append-image-stage initramfs-kernel.bin | sysupgrade-tar kernel=$$$$@ |\ + pad-to $$(IMAGE_SIZE) | dlink-ai-recovery-header DLK6E8202001 \x30\x6C\x19\x0C \x00\x00\x2C\x00 \x00\x00\x20\x03 \x82\x6E +endif endef TARGET_DEVICES += dlink_aquila-pro-ai-m60-a1 From 191d73846909142c694c6c24e4b8334f9f3d4df1 Mon Sep 17 00:00:00 2001 From: Jiasheng Zhu Date: Sun, 27 Jul 2025 00:55:08 +0800 Subject: [PATCH 812/877] mediatek: add support for OpenFi 6C PR of openwrt:main: https://github.com/openwrt/openwrt/pull/19512 OpenFi 6C is a portable Wi-Fi 6 travel router based on MediaTek MT7981B+MT7976CN. Two slightly different versions have been sold. The V1 board has a green color and lacks the modem LED. The V2 board is black and has a LED for the modem. Specifications: - SoC: MediaTek MT7981B (Filogic 820) 1.3GHz dual-core ARM Cortex-A53 - RAM: 1GB DDR4 - Flash: 256MB SPI NAND - Wireless: 2.4GHz/5GHz 802.11ax - Ethernet: 1x 10/100/1000M LAN - USB: 1x USB 3.0 Type-A port - Expansion: M.2 slot for 5G modem - Cooling: PWM-controlled fan - Buttons: Reset, Mode switch - LEDs: System, Ethernet, 5G WiFi, Modem status **Installation via U-Boot web page** 1. Set static IP 192.168.21.2/255.255.255.0 on your computer. 2. Connect to the Ethernet port and hold the reset button while booting the device. Wait for 6-8 seconds, and release the reset button. 3. Open U-boot web page on your browser at http://192.168.21.1 4. Select the OpenWRT sysupgrade image, upload it, and start the upgrade. 5. Wait for automatic reboot. **Installation via sysupgrade** Flash the sysupgrade file via LuCI upgrade page without saving the settings. Signed-off-by: Jiasheng Zhu Link: https://github.com/openwrt/openwrt/pull/19512 (cherry picked from commit 536a25ebf849b2de22792786b4c6f0c15471ee93) Link: https://github.com/openwrt/openwrt/pull/19536 Signed-off-by: Hauke Mehrtens --- .../linux/mediatek/dts/mt7981b-openfi-6c.dts | 272 ++++++++++++++++++ .../filogic/base-files/etc/board.d/01_leds | 3 + .../filogic/base-files/etc/board.d/02_network | 1 + target/linux/mediatek/image/filogic.mk | 13 + 4 files changed, 289 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7981b-openfi-6c.dts diff --git a/target/linux/mediatek/dts/mt7981b-openfi-6c.dts b/target/linux/mediatek/dts/mt7981b-openfi-6c.dts new file mode 100644 index 00000000000000..24de3545760ba3 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-openfi-6c.dts @@ -0,0 +1,272 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/dts-v1/; + +#include +#include +#include + +#include "mt7981.dtsi" + +/ { + model = "OpenFi 6C"; + compatible = "openfi,6c", "mediatek,mt7981"; + + aliases { + led-boot = &led_sys_green; + led-failsafe = &led_sys_green; + led-running = &led_sys_green; + led-upgrade = &led_sys_green; + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + + mode { + label = "mode"; + linux,input-type = ; + linux,code = ; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + led_sys_green: led-0 { + function = LED_FUNCTION_STATUS; + color = ; + gpios = <&pio 2 GPIO_ACTIVE_LOW>; + }; + + led-1 { + function = LED_FUNCTION_LAN; + color = ; + gpios = <&pio 34 GPIO_ACTIVE_LOW>; + }; + + led-2 { + function = LED_FUNCTION_WLAN_5GHZ; + color = ; + gpios = <&pio 35 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + + led-3 { + function = LED_FUNCTION_MOBILE; + color = ; + gpios = <&pio 11 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-export { + compatible = "gpio-export"; + + modem_power { + gpio-export,name = "modem_power"; + gpio-export,output = <1>; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + }; + + modem_reset { + gpio-export,name = "modem_reset"; + gpio-export,output = <1>; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + }; + + modem_reset_2 { + gpio-export,name = "modem_reset_2"; + gpio-export,output = <0>; + gpios = <&pio 12 GPIO_ACTIVE_HIGH>; + }; + }; + + usb_vbus: regulator-usb-vbus { + compatible = "regulator-fixed"; + regulator-name = "usb_vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&pio 8 GPIO_ACTIVE_LOW>; + regulator-boot-on; + }; +}; + +&fan { + pwms = <&pwm 0 40000 0>; + 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-cells = <&macaddr_factory_4 0>; + nvmem-cell-names = "mac-address"; + }; +}; + +&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-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 = <0x00000 0x0100000>; + read-only; + }; + + partition@100000 { + label = "u-boot-env"; + reg = <0x0100000 0x0080000>; + }; + + 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 = "hw"; + reg = <0x0580000 0x0080000>; + read-only; + }; + + partition@600000 { + label = "cfg"; + reg = <0x0600000 0x0080000>; + read-only; + }; + + partition@680000 { + label = "ubi"; + reg = <0x680000 0xe980000>; + }; + }; + }; +}; + +&pio { + spi0_flash_pins: spi0-pins { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + }; + + pwm_pins: pwm-pins { + mux { + function = "pwm"; + groups = "pwm0_0", "pwm1_0"; + }; + }; +}; + +&usb_phy { + status = "okay"; +}; + +&xhci { + status = "okay"; + vbus-supply = <&usb_vbus>; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + #address-cells = <1>; + #size-cells = <0>; + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; + status = "okay"; + + band@0 { + reg = <0>; + nvmem-cells = <&macaddr_factory_4 2>; + nvmem-cell-names = "mac-address"; + }; + + band@1 { + reg = <1>; + nvmem-cells = <&macaddr_factory_4 3>; + nvmem-cell-names = "mac-address"; + }; +}; + +&pwm { + pinctrl-names = "default"; + pinctrl-0 = <&pwm_pins>; + 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 bafb7bb0738a85..7c2e31a0b54b0f 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 @@ -95,6 +95,9 @@ openembed,som7981) ucidef_set_led_netdev "lanact" "LANACT" "amber:lan" "eth1" "rx tx" ucidef_set_led_netdev "lanlink" "LANLINK" "green:lan" "eth1" "link" ;; +openfi,6c) + ucidef_set_led_netdev "lan" "LAN" "green:lan" "eth0" "link tx rx" + ;; openwrt,one) ucidef_set_led_netdev "wanact" "WANACT" "mdio-bus:0f:green:wan" "eth0" "rx tx" ucidef_set_led_netdev "wanlink" "WANLINK" "mdio-bus:0f:amber:wan" "eth0" "link" 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 6daace1d41a58e..59a7a720f3af66 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 @@ -85,6 +85,7 @@ mediatek_setup_interfaces() cudy,ap3000-v1|\ cudy,re3000-v1|\ netgear,wax220|\ + openfi,6c|\ ubnt,unifi-6-plus|\ wavlink,wl-wn573hx3|\ zyxel,nwa50ax-pro) diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 38db49c692280c..ac039b34763a93 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -1476,6 +1476,19 @@ define Device/openembed_som7981 endef TARGET_DEVICES += openembed_som7981 +define Device/openfi_6c + DEVICE_VENDOR := OpenFi + DEVICE_MODEL := 6C + DEVICE_DTS := mt7981b-openfi-6c + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware kmod-usb3 + 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 += openfi_6c + define Device/openwrt_one DEVICE_VENDOR := OpenWrt DEVICE_MODEL := One From e627539601d61099970ff41317f34dbc74342c75 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Mon, 11 Aug 2025 18:52:30 +0800 Subject: [PATCH 813/877] ipq40xx: dts: reduce the maximum SPI clock frequency to 24MHz The IPQ4019 datasheet indicates that the maximum supported SPI frequency is 25 MHz. My experiment on SKSpruce WIA3300-20 shows that exceeding this threshold can lead to instability of SPI peripheral. Limit the SPI clock frequency to the QSDK recommended value 24MHz to enhance stability. Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/19744 Signed-off-by: Robert Marko (cherry picked from commit 3ff8a3dca8bc24296f501b3c74214eb5005354bf) Link: https://github.com/openwrt/openwrt/pull/19796 Signed-off-by: Hauke Mehrtens --- .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-cap-ac.dts | 2 +- .../arch/arm/boot/dts/qcom/qcom-ipq4018-ens620ext.dts | 2 +- .../arch/arm/boot/dts/qcom/qcom-ipq4018-ex61x0v2.dtsi | 2 +- .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-hap-ac2.dts | 2 +- .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-nbg6617.dts | 2 +- .../arch/arm/boot/dts/qcom/qcom-ipq4018-rt-ac58u.dts | 4 ++-- .../arch/arm/boot/dts/qcom/qcom-ipq4018-sxtsq-5-ac.dts | 2 +- .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wac510.dts | 4 ++-- .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wap-ac.dtsi | 2 +- .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-hap-ac3.dts | 2 +- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-cap-ac.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-cap-ac.dts index f2690a095d9bac..627ccd5b70adcd 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-cap-ac.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-cap-ac.dts @@ -160,7 +160,7 @@ flash@0 { reg = <0>; compatible = "jedec,spi-nor"; - spi-max-frequency = <40000000>; + spi-max-frequency = <24000000>; partitions { compatible = "fixed-partitions"; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-ens620ext.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-ens620ext.dts index 8b75a570744a54..50cac400d77f04 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-ens620ext.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-ens620ext.dts @@ -150,7 +150,7 @@ #size-cells = <0>; compatible = "jedec,spi-nor"; reg = <0>; - spi-max-frequency = <50000000>; + spi-max-frequency = <24000000>; m25p,fast-read; partitions { diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-ex61x0v2.dtsi b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-ex61x0v2.dtsi index a13fc71987339a..367dd20a7a2561 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-ex61x0v2.dtsi +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-ex61x0v2.dtsi @@ -190,7 +190,7 @@ mx25l12805d@0 { compatible = "jedec,spi-nor"; reg = <0>; - spi-max-frequency = <45000000>; + spi-max-frequency = <24000000>; partitions { compatible = "fixed-partitions"; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-hap-ac2.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-hap-ac2.dts index d91725dfb7b9e9..ae244a6696d430 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-hap-ac2.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-hap-ac2.dts @@ -155,7 +155,7 @@ flash@0 { reg = <0>; compatible = "jedec,spi-nor"; - spi-max-frequency = <40000000>; + spi-max-frequency = <24000000>; partitions { compatible = "fixed-partitions"; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-nbg6617.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-nbg6617.dts index 2b79169c0df08e..d33afc7d388e7c 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-nbg6617.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-nbg6617.dts @@ -170,7 +170,7 @@ flash@0 { compatible = "jedec,spi-nor"; reg = <0>; - spi-max-frequency = <50000000>; + spi-max-frequency = <24000000>; status = "okay"; m25p,fast-read; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rt-ac58u.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rt-ac58u.dts index 946b3b3038f14c..7477d5ddc44ce4 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rt-ac58u.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rt-ac58u.dts @@ -182,7 +182,7 @@ compatible = "jedec,spi-nor"; reg = <0>; linux,modalias = "m25p80", "mx25l1606e", "n25q128a11"; - spi-max-frequency = <30000000>; + spi-max-frequency = <24000000>; partitions { compatible = "fixed-partitions"; @@ -236,7 +236,7 @@ spi-nand@1 { compatible = "spi-nand"; reg = <1>; - spi-max-frequency = <30000000>; + spi-max-frequency = <24000000>; /* * U-boot looks for "spinand,mt29f" node, diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-sxtsq-5-ac.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-sxtsq-5-ac.dts index d434145278c177..f588d94142dc71 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-sxtsq-5-ac.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-sxtsq-5-ac.dts @@ -159,7 +159,7 @@ flash@0 { reg = <0>; compatible = "jedec,spi-nor"; - spi-max-frequency = <40000000>; + spi-max-frequency = <24000000>; partitions { compatible = "fixed-partitions"; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wac510.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wac510.dts index 982ceef044e759..fc862a25b1ed7b 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wac510.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wac510.dts @@ -206,7 +206,7 @@ flash@0 { compatible = "jedec,spi-nor"; - spi-max-frequency = <50000000>; + spi-max-frequency = <24000000>; reg = <0>; partitions { @@ -298,7 +298,7 @@ nand@1 { compatible = "spi-nand"; reg = <1>; - spi-max-frequency = <48000000>; + spi-max-frequency = <24000000>; partitions { compatible = "fixed-partitions"; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wap-ac.dtsi b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wap-ac.dtsi index f8b458f9f7953f..83dd4b925bd569 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wap-ac.dtsi +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wap-ac.dtsi @@ -123,7 +123,7 @@ flash@0 { reg = <0>; compatible = "jedec,spi-nor"; - spi-max-frequency = <40000000>; + spi-max-frequency = <24000000>; partitions { compatible = "fixed-partitions"; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-hap-ac3.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-hap-ac3.dts index bd7f1b5cb982d1..bbc93c083d0060 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-hap-ac3.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-hap-ac3.dts @@ -226,7 +226,7 @@ flash@0 { reg = <0>; compatible = "jedec,spi-nor"; - spi-max-frequency = <40000000>; + spi-max-frequency = <24000000>; partitions { compatible = "fixed-partitions"; From ba7b5d23f6977a65613ee32c28c2190cd01b485e Mon Sep 17 00:00:00 2001 From: Jan Hoffmann Date: Fri, 11 Jul 2025 20:31:29 +0200 Subject: [PATCH 814/877] ltq-adsl-mei: check status register before reading mailbox messages The interrupt handler reads from the mailbox if no other reason for the interrupt is known. If a spurious interrupt is received just after a mailbox message has been sent, this means that the response to the previous message is read again and returned by DSL_BSP_SendCMV instead of the actual response. To fix this, check the status register before reading from the mailbox in the interrupt handler. Tested on Fritzbox 7320. Without this change, there is occasionally a kernel panic due to an out-of-bounds memory access in the ltq-adsl driver (in DSL_DRV_DEV_G997_SnrAllocationNscGet), as a result of an incorrect value returned by DSL_DRV_DANUBE_CmvRead. This is reproducible by calling "dsl_cpe_pipe.sh g997dsnrg 1 1" multiple times. Signed-off-by: Jan Hoffmann Link: https://github.com/openwrt/openwrt/pull/19385 (cherry picked from commit 6889ea7b9a466b73f59fad9c6ae942728b907200) Link: https://github.com/openwrt/openwrt/pull/19839 Signed-off-by: Hauke Mehrtens --- package/kernel/lantiq/ltq-adsl-mei/src/drv_mei_cpe.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/package/kernel/lantiq/ltq-adsl-mei/src/drv_mei_cpe.c b/package/kernel/lantiq/ltq-adsl-mei/src/drv_mei_cpe.c index 20a63716a310ea..5ee5b70b4774e4 100644 --- a/package/kernel/lantiq/ltq-adsl-mei/src/drv_mei_cpe.c +++ b/package/kernel/lantiq/ltq-adsl-mei/src/drv_mei_cpe.c @@ -1787,6 +1787,7 @@ extern void ifx_usb_enable_afe_oc(void); */ static irqreturn_t IFX_MEI_IrqHandle (int int1, void *void0) { + u32 stat; u32 scratch; DSL_DEV_Device_t *pDev = (DSL_DEV_Device_t *) void0; #if defined(CONFIG_LTQ_MEI_FW_LOOPBACK) && defined(DFE_PING_TEST) @@ -1820,6 +1821,12 @@ static irqreturn_t IFX_MEI_IrqHandle (int int1, void *void0) if (dsl_bsp_event_callback[event].function) (*dsl_bsp_event_callback[event].function)(pDev, event, dsl_bsp_event_callback[event].pData); } else { // normal message + IFX_MEI_LongWordReadOffset (pDev, (u32) ME_ARC2ME_STAT, &stat); + if (!(stat & ARC_TO_MEI_MSGAV)) { + // status register indicates there is no message + return IRQ_NONE; + } + IFX_MEI_MailboxRead (pDev, DSL_DEV_PRIVATE(pDev)->CMV_RxMsg, MSG_LENGTH); if (DSL_DEV_PRIVATE(pDev)-> cmv_waiting == 1) { DSL_DEV_PRIVATE(pDev)-> arcmsgav = 1; From fcaa4fdbbf46063d46bd76f1347a30309911ff13 Mon Sep 17 00:00:00 2001 From: "Bradley M. Kuhn" Date: Fri, 11 Jul 2025 13:13:36 -0700 Subject: [PATCH 815/877] Note inspiration for this script to give credit where it's due There is some confusion in the Git log of this file. Specifically, the commit message on 7b7f1702 incorrectly indicates that there was "potential fear" about copyright infringement. Upon review of this situation, there is, in my opinion, no concern of copyright infringement here. This is not legal advice; it is my opinion based of years of work on copyright policy for FOSS. However, Elliott Mitchell's idea was obviously helpful as inspiration in writing this script and deserves credit. Ideas alone, however, are not to my knowledge copyrightable anywhere in the world. Signed-off-by: Bradley M. Kuhn (cherry picked from commit d8e738e5c4034bbc8bd29db25fb0abafdc2abf17) Link: https://github.com/openwrt/openwrt/pull/19839 Signed-off-by: Hauke Mehrtens --- scripts/kernel_bump.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/kernel_bump.sh b/scripts/kernel_bump.sh index b1c17d6c3970e8..03e809eedcb65b 100755 --- a/scripts/kernel_bump.sh +++ b/scripts/kernel_bump.sh @@ -2,6 +2,9 @@ # SPDX-License-Identifier: GPL-2.0-or-later # # Copyright (C) 2024 Olliver Schinagl +# +# This script was implemented from scratch -- inspired by ideas shared +# with the OpenWrt project by Elliott Mitchell set -eu if [ -n "${DEBUG_TRACE_SH:-}" ] && \ From bf0887bd4218c473e086ad4b0652f61f504e6dbf Mon Sep 17 00:00:00 2001 From: Fengyu Wu Date: Sat, 19 Jul 2025 18:57:05 +0800 Subject: [PATCH 816/877] ca-certificates: Update to 20250419 upstream changelog: [ Alexander Kanavin ] * update-ca-certificates: add a --sysroot option [ Julien Cristau ] * Update Mozilla certificate authority bundle to version 2.74. The following certificate authorities were added (+): + D-TRUST BR Root CA 2 2023 + D-TRUST EV Root CA 2 2023 The following certificate authorities were removed (-): - Entrust Root Certification Authority - G4 - SecureSign RootCA11 - Security Communication RootCA3 - SwissSign Silver CA - G2 Signed-off-by: Fengyu Wu Link: https://github.com/openwrt/openwrt/pull/19462 (cherry picked from commit 8bf023da765e9893a3fc5a34556326f3aaa68271) Link: https://github.com/openwrt/openwrt/pull/19839 Signed-off-by: Hauke Mehrtens --- package/system/ca-certificates/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/system/ca-certificates/Makefile b/package/system/ca-certificates/Makefile index 5b282c339e64bf..4febb647ac84ed 100644 --- a/package/system/ca-certificates/Makefile +++ b/package/system/ca-certificates/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ca-certificates -PKG_VERSION:=20241223 +PKG_VERSION:=20250419 PKG_RELEASE:=1 PKG_MAINTAINER:= @@ -16,7 +16,7 @@ PKG_LICENSE_FILES:=debian/copyright PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@DEBIAN/pool/main/c/ca-certificates -PKG_HASH:=dd8286d0a9dd35c756fea5f1df3fed1510fb891f376903891b003cd9b1ad7e03 +PKG_HASH:=33b44ef78653ecd3f0f2f13e5bba6be466be2e7da72182f737912b81798ba5d2 PKG_INSTALL:=1 include $(INCLUDE_DIR)/package.mk From f894fa971b6135f14700cb8850856dec548d23b8 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 20 Jul 2025 17:36:32 +0200 Subject: [PATCH 817/877] mediatek: Remove modules.builtin file This file should be generated automatically at runtime by the kernel build system. Link: https://github.com/openwrt/openwrt/pull/19473 (cherry picked from commit e53c53b7d59d444a7964fbeaa66609f13c1133f9) Link: https://github.com/openwrt/openwrt/pull/19839 Signed-off-by: Hauke Mehrtens --- target/linux/mediatek/files/drivers/net/phy/rtk/modules.builtin | 1 - 1 file changed, 1 deletion(-) delete mode 100644 target/linux/mediatek/files/drivers/net/phy/rtk/modules.builtin diff --git a/target/linux/mediatek/files/drivers/net/phy/rtk/modules.builtin b/target/linux/mediatek/files/drivers/net/phy/rtk/modules.builtin deleted file mode 100644 index 961a70a150d478..00000000000000 --- a/target/linux/mediatek/files/drivers/net/phy/rtk/modules.builtin +++ /dev/null @@ -1 +0,0 @@ -kernel/drivers/net/phy/rtk/rtl8367s_gsw.ko From 2cffcdc7ae042c4fea79e8b21362e41aac43b81b Mon Sep 17 00:00:00 2001 From: Karsten Sperling Date: Mon, 21 Jul 2025 16:25:03 +1200 Subject: [PATCH 818/877] mbedtls: Expose MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED config option This enables software that requires this cipher suite (e.g. OpenThread Border Router) to be compiled against the shared library rather than a separate copy. Signed-off-by: Karsten Sperling Link: https://github.com/openwrt/openwrt/pull/19489 (cherry picked from commit 97dc9f8dbfde8725ca26ae7ce0f348488e62e29e) Link: https://github.com/openwrt/openwrt/pull/19839 Signed-off-by: Hauke Mehrtens --- package/libs/mbedtls/Config.in | 4 ++++ package/libs/mbedtls/Makefile | 1 + 2 files changed, 5 insertions(+) diff --git a/package/libs/mbedtls/Config.in b/package/libs/mbedtls/Config.in index 0a760ed2cb80d6..2009d5db96f3c8 100644 --- a/package/libs/mbedtls/Config.in +++ b/package/libs/mbedtls/Config.in @@ -84,6 +84,10 @@ config MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED bool "MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED" default n +config MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED + bool "MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED" + default n + comment "Curves - unselect old or less-used curves to reduce binary size" config MBEDTLS_ECP_DP_SECP192R1_ENABLED diff --git a/package/libs/mbedtls/Makefile b/package/libs/mbedtls/Makefile index d6dfd6b68ff3d3..d6dc0f7805aa46 100644 --- a/package/libs/mbedtls/Makefile +++ b/package/libs/mbedtls/Makefile @@ -53,6 +53,7 @@ MBEDTLS_BUILD_OPTS_CIPHERS= \ CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED \ CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED \ CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED \ + CONFIG_MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED \ CONFIG_MBEDTLS_NIST_KW_C \ CONFIG_MBEDTLS_RIPEMD160_C \ CONFIG_MBEDTLS_RSA_NO_CRT \ From 7f683399632dfb1a3f53ed2e04d4871c23ce91a4 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Thu, 31 Jul 2025 19:48:32 +0100 Subject: [PATCH 819/877] kernel: add backport to fix broken PHY LEDs A commit which broke netdev trigger LEDs offloaded to PHYs recently made it all the way down to the Linux 6.6 stable branch. The revert has been accepted to linux-next, however, a backport to the various -stable trees is still pending. Import the backported revert commit to fix in OpenWrt in the meantime until the revert also gets picked to linux-stable. Link: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=26f732791f2bcab18f59c61915bbe35225f30136 Signed-off-by: Daniel Golle (cherry picked from commit 1de1df1bea94547150f01006062358ebe68ae874) Link: https://github.com/openwrt/openwrt/pull/19839 Signed-off-by: Hauke Mehrtens --- ...ger-netdev-Configure-LED-blink-inter.patch | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 target/linux/generic/backport-6.6/847-v6.17-Revert-leds-trigger-netdev-Configure-LED-blink-inter.patch diff --git a/target/linux/generic/backport-6.6/847-v6.17-Revert-leds-trigger-netdev-Configure-LED-blink-inter.patch b/target/linux/generic/backport-6.6/847-v6.17-Revert-leds-trigger-netdev-Configure-LED-blink-inter.patch new file mode 100644 index 00000000000000..192f12d5c8f89e --- /dev/null +++ b/target/linux/generic/backport-6.6/847-v6.17-Revert-leds-trigger-netdev-Configure-LED-blink-inter.patch @@ -0,0 +1,81 @@ +From 26f732791f2bcab18f59c61915bbe35225f30136 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Sat, 12 Jul 2025 16:39:21 +0100 +Subject: [PATCH] Revert "leds: trigger: netdev: Configure LED blink interval + for HW offload" + +This reverts commit c629c972b310af41e9e072febb6dae9a299edde6. + +While .led_blink_set() would previously put an LED into an unconditional +permanently blinking state, the offending commit now uses same operation +to (also?) set the blink timing of the netdev trigger when offloading. + +This breaks many if not all of the existing PHY drivers which offer +offloading LED operations, as those drivers would just put the LED into +blinking state after .led_blink_set() has been called. + +Unfortunately the change even made it into stable kernels for unknown +reasons, so it should be reverted there as well. + +Fixes: c629c972b310a ("leds: trigger: netdev: Configure LED blink interval for HW offload") +Link: https://lore.kernel.org/linux-leds/c6134e26-2e45-4121-aa15-58aaef327201@lunn.ch/T/#m9d6fe81bbcb273e59f12bbedbd633edd32118387 +Suggested-by: Andrew Lunn +Cc: stable@vger.kernel.org +Signed-off-by: Daniel Golle +Reviewed-by: Andrew Lunn +Link: https://lore.kernel.org/r/6dcc77ee1c9676891d6250d8994850f521426a0f.1752334655.git.daniel@makrotopia.org +Signed-off-by: Lee Jones +--- + drivers/leds/trigger/ledtrig-netdev.c | 16 +++------------- + 1 file changed, 3 insertions(+), 13 deletions(-) + +--- a/drivers/leds/trigger/ledtrig-netdev.c ++++ b/drivers/leds/trigger/ledtrig-netdev.c +@@ -54,7 +54,6 @@ struct led_netdev_data { + unsigned int last_activity; + + unsigned long mode; +- unsigned long blink_delay; + int link_speed; + u8 duplex; + +@@ -70,10 +69,6 @@ static void set_baseline_state(struct le + /* 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); +- if (led_cdev->blink_set) { +- led_cdev->blink_set(led_cdev, &trigger_data->blink_delay, +- &trigger_data->blink_delay); +- } + + return; + } +@@ -415,11 +410,10 @@ static ssize_t interval_store(struct dev + size_t size) + { + struct led_netdev_data *trigger_data = led_trigger_get_drvdata(dev); +- struct led_classdev *led_cdev = trigger_data->led_cdev; + unsigned long value; + int ret; + +- if (trigger_data->hw_control && !led_cdev->blink_set) ++ if (trigger_data->hw_control) + return -EINVAL; + + ret = kstrtoul(buf, 0, &value); +@@ -428,13 +422,9 @@ static ssize_t interval_store(struct dev + + /* impose some basic bounds on the timer interval */ + if (value >= 5 && value <= 10000) { +- if (trigger_data->hw_control) { +- trigger_data->blink_delay = value; +- } else { +- cancel_delayed_work_sync(&trigger_data->work); ++ cancel_delayed_work_sync(&trigger_data->work); + +- atomic_set(&trigger_data->interval, msecs_to_jiffies(value)); +- } ++ atomic_set(&trigger_data->interval, msecs_to_jiffies(value)); + set_baseline_state(trigger_data); /* resets timer */ + } + From 52ec0cbab8c1cf39014174508f67621d4490bba3 Mon Sep 17 00:00:00 2001 From: Felix Golatofski Date: Mon, 4 Aug 2025 16:59:39 +0200 Subject: [PATCH 820/877] ath79: fix LED GPIOs for COMFAST CF-EW71 v2 The vendor DTS defined incorrect GPIOs for the LEDs, which caused them to not function properly. Initially, the WAN, WLAN LEDs appeared to work, but further testing showed that they were non-functional. This patch corrects the GPIO assignments in the DTS, restoring full LED functionality including blinking, except the power LED which cannot be software controlled. Tested on a CF-EW71 v2 unit. Fixes: ee3a6adc6c22 ("ath79: add support for Comfast CF-EW71 v2") Signed-off-by: Felix Golatofski Link: https://github.com/openwrt/openwrt/pull/19665 (cherry picked from commit 9ce23ac84009d720bb6d65605508bf8a737b184d) Link: https://github.com/openwrt/openwrt/pull/19839 Signed-off-by: Hauke Mehrtens --- target/linux/ath79/dts/qca9531_comfast_cf-ew71-v2.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ath79/dts/qca9531_comfast_cf-ew71-v2.dts b/target/linux/ath79/dts/qca9531_comfast_cf-ew71-v2.dts index 22776465001456..0c1e301c512c8a 100644 --- a/target/linux/ath79/dts/qca9531_comfast_cf-ew71-v2.dts +++ b/target/linux/ath79/dts/qca9531_comfast_cf-ew71-v2.dts @@ -32,13 +32,13 @@ led_wan: wan { function = LED_FUNCTION_WAN; color = ; - gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + gpios = <&gpio 0 GPIO_ACTIVE_LOW>; }; wlan { function = LED_FUNCTION_WLAN; color = ; - gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; linux,default-trigger = "phy0tpt"; }; }; From c510f7e9733e05d6496085cec1b2ac9b74f2aa19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sat, 9 Aug 2025 17:29:38 +0300 Subject: [PATCH 821/877] ramips: fix TP-Link mr600 radio partition offset MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes 5ghz WiFi work out of the box on these devices, eliminating the need to flash a magic blob to the radio partition. This was found by user BulldozerBSG on the OpenWRT Forums: https://forum.openwrt.org/t/tp-link-archer-mr600-exploration/65489/20 All credit belongs to them. I can confirm the correctness of the findings. At least one other user (Iggy87100) confirmed them too. Signed-off-by: Stefan Dösinger Link: https://github.com/openwrt/openwrt/pull/19790 (cherry picked from commit e7ed87b83b62cc3920cf1f25abbf6f06c96fee66) Link: https://github.com/openwrt/openwrt/pull/19839 Signed-off-by: Hauke Mehrtens --- .../ramips/dts/mt7621_tplink_mr600-v2-eu.dts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/target/linux/ramips/dts/mt7621_tplink_mr600-v2-eu.dts b/target/linux/ramips/dts/mt7621_tplink_mr600-v2-eu.dts index 165b48d20914de..17a4b1d6aa8175 100644 --- a/target/linux/ramips/dts/mt7621_tplink_mr600-v2-eu.dts +++ b/target/linux/ramips/dts/mt7621_tplink_mr600-v2-eu.dts @@ -136,9 +136,26 @@ read-only; }; + /* The boot log of the stock kernel suggests the radio partition is at + * 0xfe0000, but this is wrong. The U-Boot log lists it at 0xff0000. The + * WiFi driver's log output indicates the calibration data is read from a + * hardcoded 0xff0000, ignoring mtd partitions: + * + * 0x000000fe0000-0x000000ff0000 : "radio" <- WRONG + * ... + * MT7603E--> #### read 2.4G cal from flash !! #### + * spiflash_ioctl_read, Read from 0x00ff0000 length 0x10000, ... + * + * Manual inspection shows 0xfe0000 is empty (0xff) bytes. 0xff0000 contains + * the data we want. */ partition@fe0000 { - label = "radio"; + label = "filler"; reg = <0xfe0000 0x10000>; + }; + + partition@ff0000 { + label = "radio"; + reg = <0xff0000 0x10000>; read-only; nvmem-layout { From 6bf869db0fe181b28ff71f3145715adc47de1a6b Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Thu, 21 Aug 2025 22:07:06 +0200 Subject: [PATCH 822/877] kernel: Remove patch for fixed bug The problem was fixed in upstream kernel in a different way and the change was backported to kernel 6.6 in the following change: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-6.6.y&id=48e8791843206baf76827df1b6ee3cb88a2a17d8 The removed patch changes the endianness again and breaks the functionality, use only the upstream code and remove our unneeded patch. The 823-v6.12-0003-nvmem-layouts-add-U-Boot-env-layout.patch patch was adapted in the kernel bump too. It moves the code with the fix now. Fixes: 05d344cb2ca3 ("kernel: bump 6.6 to 6.6.100") Reported-by: Michael Pratt Link: https://github.com/openwrt/openwrt/pull/19830 (cherry picked from commit 4cd256c72a7e823e55475786eb1f2a1f7ffcd497) Link: https://github.com/openwrt/openwrt/pull/19839 Signed-off-by: Hauke Mehrtens --- ...env-align-endianness-of-crc32-values.patch | 45 ------------------- 1 file changed, 45 deletions(-) delete mode 100644 target/linux/generic/pending-6.6/802-nvmem-u-boot-env-align-endianness-of-crc32-values.patch diff --git a/target/linux/generic/pending-6.6/802-nvmem-u-boot-env-align-endianness-of-crc32-values.patch b/target/linux/generic/pending-6.6/802-nvmem-u-boot-env-align-endianness-of-crc32-values.patch deleted file mode 100644 index 29fe668f8de98a..00000000000000 --- a/target/linux/generic/pending-6.6/802-nvmem-u-boot-env-align-endianness-of-crc32-values.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 0e71cac033bb7689c4dfa2e6814191337ef770f5 Mon Sep 17 00:00:00 2001 -From: INAGAKI Hiroshi -Date: Thu, 13 Oct 2022 00:51:33 +0900 -Subject: [PATCH] nvmem: layouts: u-boot-env: align endianness of crc32 values -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This patch fixes crc32 error on Big-Endianness system by conversion of -calculated crc32 value. - -Little-Endianness system: - - obtained crc32: Little -calculated crc32: Little - -Big-Endianness system: - - obtained crc32: Little -calculated crc32: Big - -log (APRESIA ApresiaLightGS120GT-SS, RTL8382M, Big-Endianness): - -[ 8.570000] u_boot_env 18001200.spi:flash@0:partitions:partition@c0000: Invalid calculated CRC32: 0x88cd6f09 (expected: 0x096fcd88) -[ 8.580000] u_boot_env: probe of 18001200.spi:flash@0:partitions:partition@c0000 failed with error -22 - -Fixes: f955dc1445069 ("nvmem: add driver handling U-Boot environment variables") - -Signed-off-by: INAGAKI Hiroshi -Acked-by: Rafał Miłecki -Tested-by: Christian Lamparter -Signed-off-by: Srinivas Kandagatla ---- - ---- a/drivers/nvmem/layouts/u-boot-env.c -+++ b/drivers/nvmem/layouts/u-boot-env.c -@@ -148,7 +148,7 @@ int u_boot_env_parse(struct device *dev, - crc32_data_len = dev_size - crc32_data_offset; - data_len = dev_size - data_offset; - -- calc = crc32(~0, buf + crc32_data_offset, crc32_data_len) ^ ~0L; -+ calc = le32_to_cpu((__le32)crc32(~0, buf + crc32_data_offset, crc32_data_len) ^ ~0L); - if (calc != crc32) { - dev_err(dev, "Invalid calculated CRC32: 0x%08x (expected: 0x%08x)\n", calc, crc32); - err = -EINVAL; From 76eb96c875fce2f8b83f3e2a7a675aade308c5c9 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 25 Aug 2025 20:31:02 +0200 Subject: [PATCH 823/877] wifi-scripts: fix reload handling with random macaddr Allow initially generated MAC address to be preserved across reload Signed-off-by: Felix Fietkau (cherry picked from commit 5bdb7a59906ee71d0178f78c4b3ce4c4ff4bb4e0) --- .../wifi-scripts/files/lib/netifd/wireless/mac80211.sh | 3 +++ package/network/services/hostapd/files/hostapd.uc | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh index 6c3d3f38b46b95..eea18e830efc94 100755 --- a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh +++ b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh @@ -563,6 +563,7 @@ mac80211_hostapd_setup_bss() { $hostapd_cfg bssid=$macaddr ${default_macaddr:+#default_macaddr} +${random_macaddr:+#random_macaddr} ${dtim_period:+dtim_period=$dtim_period} ${max_listen_int:+max_listen_interval=$max_listen_int} EOF @@ -691,12 +692,14 @@ mac80211_prepare_vif() { json_add_string _ifname "$ifname" default_macaddr= + random_macaddr= if [ -z "$macaddr" ]; then macaddr="$(mac80211_generate_mac $phy)" macidx="$(($macidx + 1))" default_macaddr=1 elif [ "$macaddr" = 'random' ]; then macaddr="$(macaddr_random)" + random_macaddr=1 fi json_add_string _macaddr "$macaddr" json_add_string _default_macaddr "$default_macaddr" diff --git a/package/network/services/hostapd/files/hostapd.uc b/package/network/services/hostapd/files/hostapd.uc index f4f479c0f672e8..5c172de5dfcc8e 100644 --- a/package/network/services/hostapd/files/hostapd.uc +++ b/package/network/services/hostapd/files/hostapd.uc @@ -485,7 +485,9 @@ function iface_reload_config(name, phydev, config, old_config) // try to preserve MAC address of this BSS by reassigning another // BSS if necessary - if (cur_config.default_macaddr && + if ((cur_config.default_macaddr || cur_config.random_macaddr) && + cur_config.random_macaddr == prev_config.random_macaddr && + cur_config.default_macaddr == prev_config.default_macaddr && !macaddr_list[prev_config.bssid]) { macaddr_list[prev_config.bssid] = i; cur_config.bssid = prev_config.bssid; @@ -761,6 +763,8 @@ function iface_load_config(phy, radio, filename) while ((line = rtrim(f.read("line"), "\n")) != null) { if (line == "#default_macaddr") bss.default_macaddr = true; + if (line == "#random_macaddr") + bss.random_macaddr = true; let val = split(line, "=", 2); if (!val[0]) From c1a8e48f3b287ead810e892529a5f812a689ac5c Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 15 Aug 2025 17:32:56 +0200 Subject: [PATCH 824/877] udebug: update to Git HEAD (2025-08-15) 3d953628bf17 udebugd: add support for setting an override config 93f6df0240e5 udebug-cli: add support for overriding config on the command line Signed-off-by: Felix Fietkau (cherry picked from commit c4e7b9b9b75f4cdd3fe4ec544412fba731afecd3) --- package/libs/udebug/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/libs/udebug/Makefile b/package/libs/udebug/Makefile index 30eac8793e8db9..b99e74b76b8820 100644 --- a/package/libs/udebug/Makefile +++ b/package/libs/udebug/Makefile @@ -11,9 +11,9 @@ PKG_NAME:=udebug CMAKE_INSTALL:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/udebug.git -PKG_MIRROR_HASH:=578f795ef6ed0400efae8754891539e5b2922d8b164425e535b96da1b0a089c5 -PKG_SOURCE_DATE:=2025-07-23 -PKG_SOURCE_VERSION:=6ed8536142bbd4360b55a423723456a6a862c99b +PKG_MIRROR_HASH:=88dffbff7c91ce7f314eb0debbdfd46258633b11106a1e8609a52345a5d65593 +PKG_SOURCE_DATE:=2025-08-15 +PKG_SOURCE_VERSION:=93f6df0240e53115f488357ae83bcf0ae25422d2 PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE)) PKG_LICENSE:=GPL-2.0 From 3e0bcf3af7658d7bfee2aa2636c68be76ca6d010 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 17 Aug 2025 11:11:42 +0200 Subject: [PATCH 825/877] udebug: update to Git HEAD (2025-08-17) 892647b81d30 ucode: add ferror() call to check for closed write file descriptor Signed-off-by: Felix Fietkau (cherry picked from commit 899deae535ac7d0f659dfa3a7b7e769ea74999a4) --- package/libs/udebug/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/libs/udebug/Makefile b/package/libs/udebug/Makefile index b99e74b76b8820..1acbb16988ed87 100644 --- a/package/libs/udebug/Makefile +++ b/package/libs/udebug/Makefile @@ -11,9 +11,9 @@ PKG_NAME:=udebug CMAKE_INSTALL:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/udebug.git -PKG_MIRROR_HASH:=88dffbff7c91ce7f314eb0debbdfd46258633b11106a1e8609a52345a5d65593 -PKG_SOURCE_DATE:=2025-08-15 -PKG_SOURCE_VERSION:=93f6df0240e53115f488357ae83bcf0ae25422d2 +PKG_MIRROR_HASH:=d787e64420b6b8410ee4a432cbaaeba0d116ef0d6bb6d670289229f049d10bf7 +PKG_SOURCE_DATE:=2025-08-17 +PKG_SOURCE_VERSION:=892647b81d30fcec8d275a2c5da05b94192c095d PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE)) PKG_LICENSE:=GPL-2.0 From 5c37d1b9a71c6d107ae588964e872b3f43e53895 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 24 Aug 2025 07:18:43 +0200 Subject: [PATCH 826/877] udebug: update to Git HEAD (2025-08-24) 6e4ffe2c6657 ucode: add function for getting the number of entries in a snapshot a62edd89255b ucode: add support for fetching kernel tracepoint events edeb4d6dc690 udebug-cli: add support for streaming tracing data Signed-off-by: Felix Fietkau (cherry picked from commit 78188ee2bc3aabc4311539cead5c3a58c184945d) --- package/libs/udebug/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/libs/udebug/Makefile b/package/libs/udebug/Makefile index 1acbb16988ed87..fe9ac872194ae2 100644 --- a/package/libs/udebug/Makefile +++ b/package/libs/udebug/Makefile @@ -11,9 +11,9 @@ PKG_NAME:=udebug CMAKE_INSTALL:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/udebug.git -PKG_MIRROR_HASH:=d787e64420b6b8410ee4a432cbaaeba0d116ef0d6bb6d670289229f049d10bf7 -PKG_SOURCE_DATE:=2025-08-17 -PKG_SOURCE_VERSION:=892647b81d30fcec8d275a2c5da05b94192c095d +PKG_MIRROR_HASH:=5e7b713aa1bff3b6480d4bd94d607b9cafed787b3d1cb27513883c83e56b0273 +PKG_SOURCE_DATE:=2025-08-24 +PKG_SOURCE_VERSION:=edeb4d6dc690acb476a47e6b11633b5632b08437 PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE)) PKG_LICENSE:=GPL-2.0 From 64bbe71219d65a5c3c17409e8b2a1b78c2d9f9c0 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 14 Aug 2025 18:43:48 +0200 Subject: [PATCH 827/877] mt76: update to Git HEAD (2025-08-27) 5f61f34087c5 wifi: mt76: mt7996: fix crash on some tx status reports d729307b5e8b mt76: mt7996: add missing null pointer check fb22489fd738 wifi: mt76: do not add non-sta wcid entries to the poll list fb7e0501b8f9 wifi: mt76: mt7996: add missing check for rx wcid entries 4cd64ad1283b wifi: mt76: mt7915: fix list corruption after hardware restart ee538efba542 wifi: mt76: free pending offchannel tx frames on wcid cleanup 415b5a68878b wifi: mt76: fix list corruption 3ed2c4030d42 wifi: mt76: mt7925u: use connac3 tx aggr check in tx complete a35af277873f wifi: mt76: mt7925: skip EHT MLD TLV on non-MLD and pass conn_state for sta_cmd 384d3a9bff2d wifi: mt76: mt7996: Use deflink for AMPDU rx reordering 9bae5f956e65 wifi: mt76: Remove dead code in mt76_scan_work de1df8b888bd wifi: mt76: mt7996: Export MLO AP capabilities to mac80211 Signed-off-by: Felix Fietkau (cherry picked from commit 2760a08b407c6ecd7f56718e07b9c48b32d05844) --- package/kernel/mt76/Makefile | 6 +++--- package/kernel/mt76/patches/100-api_compat.patch | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 026218e478f964..b5b9b22873751d 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:=2025-08-13 -PKG_SOURCE_VERSION:=903a7e0ace79dc9802b381fa05ecd2028122dd1b -PKG_MIRROR_HASH:=fcff7a90c8745091b8113e7833dc1f25e2767ff76da1f7adad27bde225c834df +PKG_SOURCE_DATE:=2025-08-27 +PKG_SOURCE_VERSION:=de1df8b888bd1c99ee191f451af47b4fa9658e8c +PKG_MIRROR_HASH:=4ead68e97fc6472a682dae2f96f9dbb377f23c316511f625b85af15de46e9397 PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 diff --git a/package/kernel/mt76/patches/100-api_compat.patch b/package/kernel/mt76/patches/100-api_compat.patch index 3dd4e1f7994f68..989967164bd57e 100644 --- a/package/kernel/mt76/patches/100-api_compat.patch +++ b/package/kernel/mt76/patches/100-api_compat.patch @@ -33,7 +33,7 @@ { struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv; struct mt7996_phy *phy = mt7996_vif_link_phy(&mvif->deflink); -@@ -1714,13 +1713,12 @@ out: +@@ -1687,13 +1686,12 @@ out: rcu_read_unlock(); } @@ -51,7 +51,7 @@ mt7996_link_rate_ctrl_update(&changed, sta); ieee80211_queue_work(hw, &dev->rc_work); -@@ -2213,7 +2211,7 @@ const struct ieee80211_ops mt7996_ops = +@@ -2186,7 +2184,7 @@ const struct ieee80211_ops mt7996_ops = .link_info_changed = mt7996_link_info_changed, .sta_state = mt7996_sta_state, .sta_pre_rcu_remove = mt76_sta_pre_rcu_remove, @@ -62,7 +62,7 @@ .set_rts_threshold = mt7996_set_rts_threshold, --- a/mac80211.c +++ b/mac80211.c -@@ -1704,7 +1704,7 @@ s8 mt76_get_power_bound(struct mt76_phy +@@ -1745,7 +1745,7 @@ s8 mt76_get_power_bound(struct mt76_phy EXPORT_SYMBOL_GPL(mt76_get_power_bound); int mt76_get_txpower(struct ieee80211_hw *hw, struct ieee80211_vif *vif, @@ -73,7 +73,7 @@ int n_chains, delta; --- a/mt76.h +++ b/mt76.h -@@ -1520,7 +1520,7 @@ int mt76_get_min_avg_rssi(struct mt76_de +@@ -1521,7 +1521,7 @@ int mt76_get_min_avg_rssi(struct mt76_de s8 mt76_get_power_bound(struct mt76_phy *phy, s8 txpower); int mt76_get_txpower(struct ieee80211_hw *hw, struct ieee80211_vif *vif, From 03fe5966997363a08d686bca219b647f58ef4fc3 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 27 Aug 2025 15:24:29 +0200 Subject: [PATCH 828/877] mac80211: extend connection monitoring for MLO Required for latest mt76 Signed-off-by: Felix Fietkau (cherry picked from commit 6fbf6d0cfd080230ce4ca72605580b0c188db8a1) --- ...d-link-iteration-macro-for-link-data.patch | 55 +++++++ ...211-extend-beacon-monitoring-for-MLO.patch | 77 ++++++++++ ...extend-connection-monitoring-for-MLO.patch | 141 ++++++++++++++++++ ...ke-CONNECTION_MONITOR-optional-for-M.patch | 25 ++++ 4 files changed, 298 insertions(+) create mode 100644 package/kernel/mac80211/patches/subsys/350-wifi-mac80211-Add-link-iteration-macro-for-link-data.patch create mode 100644 package/kernel/mac80211/patches/subsys/351-wifi-mac80211-extend-beacon-monitoring-for-MLO.patch create mode 100644 package/kernel/mac80211/patches/subsys/352-wifi-mac80211-extend-connection-monitoring-for-MLO.patch create mode 100644 package/kernel/mac80211/patches/subsys/353-wifi-mac80211-Make-CONNECTION_MONITOR-optional-for-M.patch diff --git a/package/kernel/mac80211/patches/subsys/350-wifi-mac80211-Add-link-iteration-macro-for-link-data.patch b/package/kernel/mac80211/patches/subsys/350-wifi-mac80211-Add-link-iteration-macro-for-link-data.patch new file mode 100644 index 00000000000000..d78a72d246fb11 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/350-wifi-mac80211-Add-link-iteration-macro-for-link-data.patch @@ -0,0 +1,55 @@ +From: Maharaja Kennadyrajan +Date: Fri, 18 Jul 2025 11:38:35 +0530 +Subject: [PATCH] wifi: mac80211: Add link iteration macro for link data + with rcu_dereference + +Currently, the existing macro for_each_link_data() uses sdata_dereference() +which requires the wiphy lock. This lock cannot be used in atomic or RCU +read-side contexts, such as in the RX path. + +Introduce a new macro, for_each_link_data_rcu(), that iterates over link of +sdata using rcu_dereference(), making it safe to use in RCU contexts. This +allows callers to access link data without requiring the wiphy lock. + +The macro takes into account the vif.valid_links bitmap and ensures only +valid links are accessed safely. Callers are responsible for ensuring that +rcu_read_lock() is held when using this macro. + +Signed-off-by: Maharaja Kennadyrajan +Link: https://patch.msgid.link/20250718060837.59371-3-maharaja.kennadyrajan@oss.qualcomm.com +Signed-off-by: Johannes Berg +--- + +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -1211,6 +1211,30 @@ struct ieee80211_sub_if_data *vif_to_sda + if ((_link = wiphy_dereference((local)->hw.wiphy, \ + ___sdata->link[___link_id]))) + ++#define for_each_link_data(sdata, __link) \ ++ /* outer loop just to define the variable ... */ \ ++ for (struct ieee80211_sub_if_data *__sdata = (sdata); __sdata; \ ++ __sdata = NULL /* always stop */) \ ++ for (int __link_id = 0; \ ++ __link_id < ARRAY_SIZE((__sdata)->link); __link_id++) \ ++ if ((!(__sdata)->vif.valid_links || \ ++ (__sdata)->vif.valid_links & BIT(__link_id)) && \ ++ ((__link) = sdata_dereference((__sdata)->link[__link_id], \ ++ (__sdata)))) ++ ++/* ++ * for_each_link_data_rcu should be used under RCU read lock. ++ */ ++#define for_each_link_data_rcu(sdata, __link) \ ++ /* outer loop just to define the variable ... */ \ ++ for (struct ieee80211_sub_if_data *__sdata = (sdata); __sdata; \ ++ __sdata = NULL /* always stop */) \ ++ for (int __link_id = 0; \ ++ __link_id < ARRAY_SIZE((__sdata)->link); __link_id++) \ ++ if ((!(__sdata)->vif.valid_links || \ ++ (__sdata)->vif.valid_links & BIT(__link_id)) && \ ++ ((__link) = rcu_dereference((__sdata)->link[__link_id]))) \ ++ + static inline int + ieee80211_get_mbssid_beacon_len(struct cfg80211_mbssid_elems *elems, + struct cfg80211_rnr_elems *rnr_elems, diff --git a/package/kernel/mac80211/patches/subsys/351-wifi-mac80211-extend-beacon-monitoring-for-MLO.patch b/package/kernel/mac80211/patches/subsys/351-wifi-mac80211-extend-beacon-monitoring-for-MLO.patch new file mode 100644 index 00000000000000..b1986dc8aacd4c --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/351-wifi-mac80211-extend-beacon-monitoring-for-MLO.patch @@ -0,0 +1,77 @@ +From: Maharaja Kennadyrajan +Date: Fri, 18 Jul 2025 11:38:36 +0530 +Subject: [PATCH] wifi: mac80211: extend beacon monitoring for MLO + +Currently, reset beacon monitor (ieee80211_sta_reset_beacon_monitor()) +timer is handled only for non-AP non-MLD STA and do not support non-AP MLD +STA. When the beacon loss occurs in non-AP MLD STA with the current +implementation, it is treated as a single link and the timer will reset +based on the timeout of the deflink, without checking all the links. + +Check the CSA flags for all the links in the MLO and decide whether to +schedule the work queue for beacon loss. If any of the links has CSA +active, then beacon loss work is not scheduled. + +Also, call the functions ieee80211_sta_reset_beacon_monitor() and +ieee80211_sta_reset_conn_monitor() from ieee80211_csa_switch_work() only +when all the links are CSA active. + +Signed-off-by: Maharaja Kennadyrajan +Link: https://patch.msgid.link/20250718060837.59371-4-maharaja.kennadyrajan@oss.qualcomm.com +Signed-off-by: Johannes Berg +--- + +--- a/net/mac80211/mlme.c ++++ b/net/mac80211/mlme.c +@@ -2159,6 +2159,21 @@ static void ieee80211_csa_switch_work(st + } + } + ++ /* ++ * It is not necessary to reset these timers if any link does not ++ * have an active CSA and that link still receives the beacons ++ * when other links have active CSA. ++ */ ++ for_each_link_data(sdata, link) { ++ if (!link->conf->csa_active) ++ return; ++ } ++ ++ /* ++ * Reset the beacon monitor and connection monitor timers when CSA ++ * is active for all links in MLO when channel switch occurs in all ++ * the links. ++ */ + ieee80211_sta_reset_beacon_monitor(sdata); + ieee80211_sta_reset_conn_monitor(sdata); + } +@@ -7863,6 +7878,29 @@ void ieee80211_sta_work(struct ieee80211 + } + } + ++static bool ++ieee80211_is_csa_in_progress(struct ieee80211_sub_if_data *sdata) ++{ ++ /* ++ * In MLO, check the CSA flags 'active' and 'waiting_bcn' for all ++ * the links. ++ */ ++ struct ieee80211_link_data *link; ++ bool ret = true; ++ ++ rcu_read_lock(); ++ for_each_link_data_rcu(sdata, link) { ++ if (!(link->conf->csa_active && ++ !link->u.mgd.csa.waiting_bcn)) { ++ ret = false; ++ break; ++ } ++ } ++ rcu_read_unlock(); ++ ++ return ret; ++} ++ + static void ieee80211_sta_bcn_mon_timer(struct timer_list *t) + { + struct ieee80211_sub_if_data *sdata = diff --git a/package/kernel/mac80211/patches/subsys/352-wifi-mac80211-extend-connection-monitoring-for-MLO.patch b/package/kernel/mac80211/patches/subsys/352-wifi-mac80211-extend-connection-monitoring-for-MLO.patch new file mode 100644 index 00000000000000..e6227b97ea9aba --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/352-wifi-mac80211-extend-connection-monitoring-for-MLO.patch @@ -0,0 +1,141 @@ +From: Maharaja Kennadyrajan +Date: Fri, 18 Jul 2025 11:38:37 +0530 +Subject: [PATCH] wifi: mac80211: extend connection monitoring for MLO + +Currently, reset connection monitor (ieee80211_sta_reset_conn_monitor()) +timer is handled only for non-AP non-MLD STA and do not support non-AP MLD +STA. The current implementation checks for the CSA active and update the +monitor timer with the timeout value of deflink and reset the timer based +on the deflink's timeout value else schedule the connection loss work when +the deflink is timed out and it won't work for the non-AP MLD STA. + +Handle the reset connection monitor timer for non-AP MLD STA by updating +the monitor timer with the timeout value which is determined based on the +link that will expire last among all the links in MLO. If at least one link +has not timed out, the timer is updated accordingly with the latest timeout +value else schedule the connection loss work when all links have timed out. + +Remove the MLO-related WARN_ON() checks in the beacon and connection +monitoring logic code paths as they support MLO now. + +Signed-off-by: Maharaja Kennadyrajan +Link: https://patch.msgid.link/20250718060837.59371-5-maharaja.kennadyrajan@oss.qualcomm.com +Signed-off-by: Johannes Berg +--- + +--- a/net/mac80211/mlme.c ++++ b/net/mac80211/mlme.c +@@ -3831,9 +3831,6 @@ static void ieee80211_mgd_probe_ap_send( + + lockdep_assert_wiphy(sdata->local->hw.wiphy); + +- if (WARN_ON(ieee80211_vif_is_mld(&sdata->vif))) +- return; +- + /* + * Try sending broadcast probe requests for the last three + * probe requests after the first ones failed since some +@@ -3879,9 +3876,6 @@ static void ieee80211_mgd_probe_ap(struc + + lockdep_assert_wiphy(sdata->local->hw.wiphy); + +- if (WARN_ON_ONCE(ieee80211_vif_is_mld(&sdata->vif))) +- return; +- + if (!ieee80211_sdata_running(sdata)) + return; + +@@ -7921,36 +7915,73 @@ static void ieee80211_sta_bcn_mon_timer( + &sdata->u.mgd.beacon_connection_loss_work); + } + ++static unsigned long ++ieee80211_latest_active_link_conn_timeout(struct ieee80211_sub_if_data *sdata) ++{ ++ unsigned long latest_timeout = 0; ++ unsigned int link_id; ++ struct sta_info *sta; ++ ++ rcu_read_lock(); ++ ++ sta = sta_info_get(sdata, sdata->vif.cfg.ap_addr); ++ if (!sta) ++ goto out; ++ ++ for (link_id = 0; link_id < ARRAY_SIZE(sta->link); ++ link_id++) { ++ struct link_sta_info *link_sta; ++ unsigned long timeout; ++ ++ link_sta = rcu_dereference(sta->link[link_id]); ++ if (!link_sta) ++ continue; ++ ++ timeout = link_sta->status_stats.last_ack; ++ if (time_before(timeout, link_sta->rx_stats.last_rx)) ++ timeout = link_sta->rx_stats.last_rx; ++ ++ timeout += IEEE80211_CONNECTION_IDLE_TIME; ++ ++ /* ++ * latest_timeout holds the timeout of the link ++ * that will expire last among all links in an ++ * non-AP MLD STA. This ensures that the connection ++ * monitor timer is only reset if at least one link ++ * is still active, and it is scheduled to fire at ++ * the latest possible timeout. ++ */ ++ if (time_is_after_jiffies(timeout) && ++ time_after(timeout, latest_timeout)) ++ latest_timeout = timeout; ++ } ++ ++out: ++ rcu_read_unlock(); ++ ++ return latest_timeout; ++} ++ + static void ieee80211_sta_conn_mon_timer(struct timer_list *t) + { + struct ieee80211_sub_if_data *sdata = + from_timer(sdata, t, u.mgd.conn_mon_timer); + struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; + struct ieee80211_local *local = sdata->local; +- struct sta_info *sta; +- unsigned long timeout; ++ unsigned long latest_timeout; + +- if (WARN_ON(ieee80211_vif_is_mld(&sdata->vif))) ++ if (ieee80211_is_csa_in_progress(sdata)) + return; + +- if (sdata->vif.bss_conf.csa_active && +- !sdata->deflink.u.mgd.csa.waiting_bcn) +- return; +- +- sta = sta_info_get(sdata, sdata->vif.cfg.ap_addr); +- if (!sta) +- return; +- +- timeout = sta->deflink.status_stats.last_ack; +- if (time_before(sta->deflink.status_stats.last_ack, sta->deflink.rx_stats.last_rx)) +- timeout = sta->deflink.rx_stats.last_rx; +- timeout += IEEE80211_CONNECTION_IDLE_TIME; ++ latest_timeout = ieee80211_latest_active_link_conn_timeout(sdata); + +- /* If timeout is after now, then update timer to fire at +- * the later date, but do not actually probe at this time. +- */ +- if (time_is_after_jiffies(timeout)) { +- mod_timer(&ifmgd->conn_mon_timer, round_jiffies_up(timeout)); ++ /* ++ * If latest timeout is after now, then update timer to fire at ++ * the later date, but do not actually probe at this time. ++ */ ++ if (latest_timeout) { ++ mod_timer(&ifmgd->conn_mon_timer, ++ round_jiffies_up(latest_timeout)); + return; + } + diff --git a/package/kernel/mac80211/patches/subsys/353-wifi-mac80211-Make-CONNECTION_MONITOR-optional-for-M.patch b/package/kernel/mac80211/patches/subsys/353-wifi-mac80211-Make-CONNECTION_MONITOR-optional-for-M.patch new file mode 100644 index 00000000000000..bbc02cc21d9d38 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/353-wifi-mac80211-Make-CONNECTION_MONITOR-optional-for-M.patch @@ -0,0 +1,25 @@ +From: Lorenzo Bianconi +Date: Tue, 26 Aug 2025 13:54:31 +0200 +Subject: [PATCH] wifi: mac80211: Make CONNECTION_MONITOR optional for MLO sta + +Since commit '1bc892d76a6f ("wifi: mac80211: extend connection +monitoring for MLO")' mac80211 supports connection monitor for MLO +client interfaces. Remove the CONNECTION_MONITOR requirement in +ieee80211_register_hw routine. + +Fixes: 1bc892d76a6f ("wifi: mac80211: extend connection monitoring for MLO") +Signed-off-by: Lorenzo Bianconi +--- + +--- a/net/mac80211/main.c ++++ b/net/mac80211/main.c +@@ -1174,9 +1174,6 @@ int ieee80211_register_hw(struct ieee802 + if (WARN_ON(!ieee80211_hw_check(hw, MFP_CAPABLE))) + return -EINVAL; + +- if (WARN_ON(!ieee80211_hw_check(hw, CONNECTION_MONITOR))) +- return -EINVAL; +- + if (WARN_ON(ieee80211_hw_check(hw, NEED_DTIM_BEFORE_ASSOC))) + return -EINVAL; + From 406489fd83d9015f1827122d912253744c0efe5a Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 24 Aug 2025 14:48:46 +0000 Subject: [PATCH 829/877] kernel: bump 6.6 to 6.6.101 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.101 All patches auto-refreshed. Link: https://github.com/openwrt/openwrt/pull/19876 (cherry picked from commit 9fbbcd16f7bd3d6f6ec8a5be23f1cb12f49113a1) Link: https://github.com/openwrt/openwrt/pull/19877 Signed-off-by: Hauke Mehrtens --- include/kernel-6.6 | 4 ++-- ...staging-vchiq_arm-Register-vcsm-cma-as-a-platform-dr.patch | 4 ++-- ...staging-vchiq_arm-Register-bcm2835-codec-as-a-platfo.patch | 4 ++-- ...staging-vchiq_arm-Set-up-dma-ranges-on-child-devices.patch | 2 +- ...staging-vchiq-Use-the-old-dma-controller-for-OF-conf.patch | 4 ++-- ...-0194-staging-vchiq_arm-Give-vchiq-children-DT-nodes.patch | 2 +- ...209-staging-vchiq-Load-bcm2835_isp-driver-from-vchiq.patch | 4 ++-- ...50-1411-staging-vchiq_arm-Add-36-bit-address-support.patch | 4 ++-- ...0-1412-staging-vchiq_arm-children-inherit-DMA-config.patch | 2 +- target/linux/generic/hack-6.6/259-regmap_dynamic.patch | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/kernel-6.6 b/include/kernel-6.6 index 4a55a573ae3948..71181a3fc5a112 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .100 -LINUX_KERNEL_HASH-6.6.100 = d6c0ec4d55b14814f55b62a0b23a2d95faf66877e48fbfb4b83523e4afdf97ba +LINUX_VERSION-6.6 = .101 +LINUX_KERNEL_HASH-6.6.101 = 8c4ff2869736538b9b0d88ea8dbf0332b79c6ecc40a32066768a754df1fae1c0 diff --git a/target/linux/bcm27xx/patches-6.6/950-0184-staging-vchiq_arm-Register-vcsm-cma-as-a-platform-dr.patch b/target/linux/bcm27xx/patches-6.6/950-0184-staging-vchiq_arm-Register-vcsm-cma-as-a-platform-dr.patch index 741d377fc8d3be..6daa690dff2138 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0184-staging-vchiq_arm-Register-vcsm-cma-as-a-platform-dr.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0184-staging-vchiq_arm-Register-vcsm-cma-as-a-platform-dr.patch @@ -22,7 +22,7 @@ Signed-off-by: Dave Stevenson struct vchiq_drvdata { const unsigned int cache_line_size; -@@ -1825,6 +1826,7 @@ static int vchiq_probe(struct platform_d +@@ -1824,6 +1825,7 @@ static int vchiq_probe(struct platform_d goto error_exit; } @@ -30,7 +30,7 @@ Signed-off-by: Dave Stevenson bcm2835_camera = vchiq_register_child(pdev, "bcm2835-camera"); bcm2835_audio = vchiq_register_child(pdev, "bcm2835_audio"); -@@ -1840,6 +1842,7 @@ static void vchiq_remove(struct platform +@@ -1839,6 +1841,7 @@ static void vchiq_remove(struct platform { platform_device_unregister(bcm2835_audio); platform_device_unregister(bcm2835_camera); diff --git a/target/linux/bcm27xx/patches-6.6/950-0185-staging-vchiq_arm-Register-bcm2835-codec-as-a-platfo.patch b/target/linux/bcm27xx/patches-6.6/950-0185-staging-vchiq_arm-Register-bcm2835-codec-as-a-platfo.patch index 5a3c91b7800471..5adc8c75afe0d0 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0185-staging-vchiq_arm-Register-bcm2835-codec-as-a-platfo.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0185-staging-vchiq_arm-Register-bcm2835-codec-as-a-platfo.patch @@ -22,7 +22,7 @@ Signed-off-by: Dave Stevenson static struct platform_device *vcsm_cma; struct vchiq_drvdata { -@@ -1827,6 +1828,7 @@ static int vchiq_probe(struct platform_d +@@ -1826,6 +1827,7 @@ static int vchiq_probe(struct platform_d } vcsm_cma = vchiq_register_child(pdev, "vcsm-cma"); @@ -30,7 +30,7 @@ Signed-off-by: Dave Stevenson bcm2835_camera = vchiq_register_child(pdev, "bcm2835-camera"); bcm2835_audio = vchiq_register_child(pdev, "bcm2835_audio"); -@@ -1842,6 +1844,7 @@ static void vchiq_remove(struct platform +@@ -1841,6 +1843,7 @@ static void vchiq_remove(struct platform { platform_device_unregister(bcm2835_audio); platform_device_unregister(bcm2835_camera); diff --git a/target/linux/bcm27xx/patches-6.6/950-0190-staging-vchiq_arm-Set-up-dma-ranges-on-child-devices.patch b/target/linux/bcm27xx/patches-6.6/950-0190-staging-vchiq_arm-Set-up-dma-ranges-on-child-devices.patch index 3abc4f19bf77fb..525cb835e68df2 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0190-staging-vchiq_arm-Set-up-dma-ranges-on-child-devices.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0190-staging-vchiq_arm-Set-up-dma-ranges-on-child-devices.patch @@ -18,7 +18,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -@@ -1777,6 +1777,12 @@ vchiq_register_child(struct platform_dev +@@ -1776,6 +1776,12 @@ vchiq_register_child(struct platform_dev child = NULL; } diff --git a/target/linux/bcm27xx/patches-6.6/950-0191-staging-vchiq-Use-the-old-dma-controller-for-OF-conf.patch b/target/linux/bcm27xx/patches-6.6/950-0191-staging-vchiq-Use-the-old-dma-controller-for-OF-conf.patch index e5c5fdbc0b775a..5613a4100a9a1a 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0191-staging-vchiq-Use-the-old-dma-controller-for-OF-conf.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0191-staging-vchiq-Use-the-old-dma-controller-for-OF-conf.patch @@ -17,7 +17,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -@@ -1763,6 +1763,7 @@ vchiq_register_child(struct platform_dev +@@ -1762,6 +1762,7 @@ vchiq_register_child(struct platform_dev { struct platform_device_info pdevinfo; struct platform_device *child; @@ -25,7 +25,7 @@ Signed-off-by: Dave Stevenson memset(&pdevinfo, 0, sizeof(pdevinfo)); -@@ -1778,10 +1779,20 @@ vchiq_register_child(struct platform_dev +@@ -1777,10 +1778,20 @@ vchiq_register_child(struct platform_dev } /* diff --git a/target/linux/bcm27xx/patches-6.6/950-0194-staging-vchiq_arm-Give-vchiq-children-DT-nodes.patch b/target/linux/bcm27xx/patches-6.6/950-0194-staging-vchiq_arm-Give-vchiq-children-DT-nodes.patch index 9dba2dffca16a1..a75bd3da561d79 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0194-staging-vchiq_arm-Give-vchiq-children-DT-nodes.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0194-staging-vchiq_arm-Give-vchiq-children-DT-nodes.patch @@ -16,7 +16,7 @@ Signed-off-by: Phil Elwell --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -@@ -1772,12 +1772,20 @@ vchiq_register_child(struct platform_dev +@@ -1771,12 +1771,20 @@ vchiq_register_child(struct platform_dev pdevinfo.id = PLATFORM_DEVID_NONE; pdevinfo.dma_mask = DMA_BIT_MASK(32); diff --git a/target/linux/bcm27xx/patches-6.6/950-0209-staging-vchiq-Load-bcm2835_isp-driver-from-vchiq.patch b/target/linux/bcm27xx/patches-6.6/950-0209-staging-vchiq-Load-bcm2835_isp-driver-from-vchiq.patch index b5f912c85b0aad..5c1b37bfd95102 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0209-staging-vchiq-Load-bcm2835_isp-driver-from-vchiq.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0209-staging-vchiq-Load-bcm2835_isp-driver-from-vchiq.patch @@ -21,7 +21,7 @@ Signed-off-by: Naushir Patuck struct vchiq_drvdata { const unsigned int cache_line_size; -@@ -1856,6 +1857,7 @@ static int vchiq_probe(struct platform_d +@@ -1855,6 +1856,7 @@ static int vchiq_probe(struct platform_d bcm2835_codec = vchiq_register_child(pdev, "bcm2835-codec"); bcm2835_camera = vchiq_register_child(pdev, "bcm2835-camera"); bcm2835_audio = vchiq_register_child(pdev, "bcm2835_audio"); @@ -29,7 +29,7 @@ Signed-off-by: Naushir Patuck return 0; -@@ -1867,6 +1869,7 @@ error_exit: +@@ -1866,6 +1868,7 @@ error_exit: static void vchiq_remove(struct platform_device *pdev) { diff --git a/target/linux/bcm27xx/patches-6.6/950-1411-staging-vchiq_arm-Add-36-bit-address-support.patch b/target/linux/bcm27xx/patches-6.6/950-1411-staging-vchiq_arm-Add-36-bit-address-support.patch index 871b2769b10232..db65da69975334 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1411-staging-vchiq_arm-Add-36-bit-address-support.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1411-staging-vchiq_arm-Add-36-bit-address-support.patch @@ -223,7 +223,7 @@ Signed-off-by: Phil Elwell vchiq_log_info(vchiq_arm_log_level, "vchiq_init - done (slots %pK, phys %pad)", vchiq_slot_zero, &slot_phys); -@@ -1755,6 +1823,7 @@ void vchiq_platform_conn_state_changed(s +@@ -1754,6 +1822,7 @@ void vchiq_platform_conn_state_changed(s static const struct of_device_id vchiq_of_match[] = { { .compatible = "brcm,bcm2835-vchiq", .data = &bcm2835_drvdata }, { .compatible = "brcm,bcm2836-vchiq", .data = &bcm2836_drvdata }, @@ -231,7 +231,7 @@ Signed-off-by: Phil Elwell {}, }; MODULE_DEVICE_TABLE(of, vchiq_of_match); -@@ -1787,22 +1856,8 @@ vchiq_register_child(struct platform_dev +@@ -1786,22 +1855,8 @@ vchiq_register_child(struct platform_dev child->dev.of_node = np; diff --git a/target/linux/bcm27xx/patches-6.6/950-1412-staging-vchiq_arm-children-inherit-DMA-config.patch b/target/linux/bcm27xx/patches-6.6/950-1412-staging-vchiq_arm-children-inherit-DMA-config.patch index df93f3a0c4a30c..bcacf57c5c86ee 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1412-staging-vchiq_arm-children-inherit-DMA-config.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1412-staging-vchiq_arm-children-inherit-DMA-config.patch @@ -15,7 +15,7 @@ Signed-off-by: Phil Elwell --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -@@ -1856,8 +1856,18 @@ vchiq_register_child(struct platform_dev +@@ -1855,8 +1855,18 @@ vchiq_register_child(struct platform_dev child->dev.of_node = np; diff --git a/target/linux/generic/hack-6.6/259-regmap_dynamic.patch b/target/linux/generic/hack-6.6/259-regmap_dynamic.patch index 4f6dca7127b8e8..c7b7a28ce30e2e 100644 --- a/target/linux/generic/hack-6.6/259-regmap_dynamic.patch +++ b/target/linux/generic/hack-6.6/259-regmap_dynamic.patch @@ -137,7 +137,7 @@ Signed-off-by: Felix Fietkau #include #include #include -@@ -3483,3 +3484,5 @@ static int __init regmap_initcall(void) +@@ -3485,3 +3486,5 @@ static int __init regmap_initcall(void) return 0; } postcore_initcall(regmap_initcall); From a65ca44cb7a3e6fbb43b230c7c5a0684d88bae8b Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 24 Aug 2025 17:21:54 +0000 Subject: [PATCH 830/877] kernel: bump 6.6 to 6.6.102 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.102 Added backport to fix ipv6 breakage with the 6.12.42 release: generic/backport-6.6/621-proc-fix-missing-pde_set_flags.patch[1] All patches auto-refreshed. 1. https://lore.kernel.org/all/20250821105806.1453833-1-wangzijie1@honor.com Link: https://github.com/openwrt/openwrt/pull/19876 (cherry picked from commit 34e1092e88f6df4de3115ea471e632ef21407d38) Link: https://github.com/openwrt/openwrt/pull/19877 Signed-off-by: Hauke Mehrtens --- include/kernel-6.6 | 4 +- .../900-unaligned_access_hacks.patch | 2 +- ...tft-Add-support-for-display-variants.patch | 6 +- ...tibility-hack-should-be-X86-specific.patch | 4 +- .../621-proc-fix-missing-pde_set_flags.patch | 121 ++++++++++++++++++ ...t-introduce-napi_is_scheduled-helper.patch | 2 +- .../721-net-add-packet-mangeling.patch | 4 +- .../hack-6.6/904-debloat_dma_buf.patch | 2 +- .../pending-6.6/655-increase_skb_pad.patch | 2 +- ...ng-with-source-address-failed-policy.patch | 14 +- ...les-ignore-EOPNOTSUPP-on-flowtable-d.patch | 2 +- ...dsa-add-out-of-band-tagging-protocol.patch | 2 +- 12 files changed, 143 insertions(+), 22 deletions(-) create mode 100644 target/linux/generic/backport-6.6/621-proc-fix-missing-pde_set_flags.patch diff --git a/include/kernel-6.6 b/include/kernel-6.6 index 71181a3fc5a112..048ae0b42a723d 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .101 -LINUX_KERNEL_HASH-6.6.101 = 8c4ff2869736538b9b0d88ea8dbf0332b79c6ecc40a32066768a754df1fae1c0 +LINUX_VERSION-6.6 = .102 +LINUX_KERNEL_HASH-6.6.102 = 80d2feb7334c30bacbe1e7dafa9ea415efb2c0ea4f4740ecbd1467cf5d94de5c diff --git a/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch b/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch index 9168d5e973ded8..02b64bb7f88960 100644 --- a/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch @@ -579,7 +579,7 @@ SVN-Revision: 35130 goto next_ht; --- a/net/ipv6/ip6_offload.c +++ b/net/ipv6/ip6_offload.c -@@ -273,7 +273,7 @@ INDIRECT_CALLABLE_SCOPE struct sk_buff * +@@ -275,7 +275,7 @@ INDIRECT_CALLABLE_SCOPE struct sk_buff * continue; iph2 = (struct ipv6hdr *)(p->data + off); diff --git a/target/linux/bcm27xx/patches-6.6/950-0243-staging-fbtft-Add-support-for-display-variants.patch b/target/linux/bcm27xx/patches-6.6/950-0243-staging-fbtft-Add-support-for-display-variants.patch index f49c9a2b56a34c..fad8eb5a11c369 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0243-staging-fbtft-Add-support-for-display-variants.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0243-staging-fbtft-Add-support-for-display-variants.patch @@ -95,7 +95,7 @@ Signed-off-by: Phil Elwell #include