From 0b54029a6e96bb2ce484f316be3870cc2617de30 Mon Sep 17 00:00:00 2001 From: James Sweeney Date: Thu, 2 Jan 2025 08:06:09 -0500 Subject: [PATCH 01/43] 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 --- 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 12fb33d85e0..1255ee8b9e1 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 65aff89f641f6adccac80ee73b02b99a904739d5 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 3 Jan 2025 11:06:08 +0100 Subject: [PATCH 02/43] 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 --- 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 d7fd80d331b..d603b6215fd 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 b2b6955f80d05a8cec69f8497df8bed44cf3c64d Mon Sep 17 00:00:00 2001 From: Florian Maurer Date: Fri, 3 Jan 2025 13:28:42 +0100 Subject: [PATCH 03/43] 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 --- .../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 2344ae7bf89..4f6cafb8853 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 8a477bafb4637e3499f69f569133039ce060559e Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Fri, 3 Jan 2025 20:37:41 +0800 Subject: [PATCH 04/43] 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 --- ...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 00000000000..7a8f86a46fd --- /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 2b70b32aef9e8e1ff275872d551c610368079911 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 3 Jan 2025 20:22:13 +0100 Subject: [PATCH 05/43] 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 --- ...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 00000000000..36c28b94f60 --- /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 fedb1f86b50986a962c899d7406566d991e030ee 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 06/43] 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 --- ...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 00000000000..771f60df91c --- /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 00000000000..4b9b9e8d48b --- /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 2b77b6e02f9..8de57707a26 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 cbef74d317b..7e48c16515d 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 216fa918e1f..722ec02cdce 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 08c13f34e44..1b9cdada6db 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 6938552d14d..63ffd0a0c93 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 a796b8f011d..c9e15fb4630 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 0eeba04a16fb72b13d90973ef8ba95f0549f973e 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 07/43] 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 --- 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 097bea7f50d..dc256237e97 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 + 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 00000000000..2403da5d555 --- /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 00000000000..8c6e6d8dc41 --- /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 00000000000..dc05299628e --- /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 00000000000..faab0df7f40 --- /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 00000000000..38b5035441f --- /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 00000000000..6430d32252b --- /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 00000000000..4792e371b63 --- /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 00000000000..4ec06cc6019 --- /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 00000000000..81058e5e9f7 --- /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 00000000000..721e51ebf05 --- /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 00000000000..de2be0165c2 --- /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 00000000000..a546c426b49 --- /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 00000000000..36c8041c94e --- /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 00000000000..8cb79c82cf3 --- /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 00000000000..20c42955e36 --- /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 00000000000..8c88c078f29 --- /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 00000000000..e7626173102 --- /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 00000000000..de86c2f6cd0 --- /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 00000000000..5bcf06098a8 --- /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 484f670ed3d41e44375bfa7f8892e660d3c8c26a 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 08/43] 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 --- .../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 130bf6723cc..6ba8002c756 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 f11bc4f201e3a4ffec8c1e2083124ebda60dd763 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 4 Jan 2025 11:54:22 +0100 Subject: [PATCH 09/43] 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 --- 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 d603b6215fd..7bc030a9df3 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 b795e5cbcffc54e858bc8d3bde0031a2ca32377e Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 4 Jan 2025 11:52:50 +0100 Subject: [PATCH 10/43] 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 --- .../files-ucode/lib/netifd/wireless/mac80211.sh | 1 + .../wifi-scripts/files/lib/netifd/wireless/mac80211.sh | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/package/network/config/wifi-scripts/files-ucode/lib/netifd/wireless/mac80211.sh b/package/network/config/wifi-scripts/files-ucode/lib/netifd/wireless/mac80211.sh index 93ab404d57c..9b86abcee5d 100755 --- a/package/network/config/wifi-scripts/files-ucode/lib/netifd/wireless/mac80211.sh +++ b/package/network/config/wifi-scripts/files-ucode/lib/netifd/wireless/mac80211.sh @@ -195,6 +195,7 @@ function setup_phy(phy, config, data) { log(`Configuring '${phy}' txantenna: ${config.txantenna}, rxantenna: ${config.rxantenna} distance: ${config.distance}`); system(`iw phy ${phy} set antenna ${config.txantenna} ${config.rxantenna}`); system(`iw phy ${phy} set distance ${config.distance}`); + system(`iw phy ${phy} set txpower ${config.txpower}`); if (config.frag) system(`iw phy ${phy} set frag ${frag}`); 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 5d9bf8ee09e..9e9922e0b35 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 @@ -1210,6 +1210,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 f105d1a9a9739267fb25612d039c392a397775bd Mon Sep 17 00:00:00 2001 From: John Audia Date: Thu, 2 Jan 2025 07:50:26 -0500 Subject: [PATCH 11/43] bcm27xx/bcm2712: Fix-up RP1 modules 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 --- 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 9dac0688df3..749c569a541 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 0f1547cd4f8..db8ba30f875 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 5a690007483..099ce3ce14d 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 dddf13e0f4a..e8a61f138cc 100644 --- a/target/linux/bcm27xx/modules/video.mk +++ b/target/linux/bcm27xx/modules/video.mk @@ -175,7 +175,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 9f97e39a9336e279be7ea1c00c4221ec3f448457 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sun, 22 Dec 2024 00:30:43 +0800 Subject: [PATCH 12/43] 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 --- .../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 9aa31843dea..f33ca076330 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 5ef71eaafd4e128ec3708a66b5633214427da373 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sun, 22 Dec 2024 00:31:06 +0800 Subject: [PATCH 13/43] 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 --- 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 6c31d88be81..ed54cedbc37 100644 --- a/package/boot/uboot-mediatek/patches/453-add-openwrt-one.patch +++ b/package/boot/uboot-mediatek/patches/453-add-openwrt-one.patch @@ -520,7 +520,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,61 @@ +@@ -0,0 +1,62 @@ +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 @@ -562,6 +562,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 f70cdfd682a87c9de942f9251fb5a0caaf43f7cf Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sat, 13 Jul 2024 11:32:45 +0800 Subject: [PATCH 14/43] 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 --- ...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 1d5c6dcd40c..c3d13932ef3 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 05ec3b50a8e673786dda0224b23f18b5d96a4a65 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 1 Jan 2025 16:06:10 +0800 Subject: [PATCH 15/43] 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 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 00000000000..69dcd7fb2c8 --- /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 cea4aae0a921d71407d11957502f8cc3b652be21 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 1 Jan 2025 16:06:38 +0800 Subject: [PATCH 16/43] 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 --- .../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 9e4068ce8c7..52cd3afac89 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 5ec041c8048..940df6e19a7 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 25a7344afbe..da44b0005c5 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 f5996ae947c88461029060d74ace6a85a30dd9fd Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 1 Jan 2025 16:16:29 +0800 Subject: [PATCH 17/43] 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 --- .../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 34ef15eca0b..fab70dc7b7f 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 d279cbcfb8e..2d45e0385f1 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 607787f68e1..71c77d7ae67 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 4982d8bccc9..da2026ec7d3 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 0764e3008228bbdafb5e4a9837fe9efec7e138a0 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 1 Jan 2025 16:17:08 +0800 Subject: [PATCH 18/43] 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 --- 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 ced479dc93e..175ba94eff9 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 b4a9f85c1394f13806fc2f51f5f6f23494773d7e Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 1 Jan 2025 16:17:53 +0800 Subject: [PATCH 19/43] 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 --- 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 df95900a26e..a9c242bfd36 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 14be320291e0c00a1291ad8bd220fd37b12ba138 Mon Sep 17 00:00:00 2001 From: Aleksander Jan Bajkowski Date: Fri, 3 Jan 2025 19:59:22 +0100 Subject: [PATCH 20/43] 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 --- .../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 b38ac9f8b84..2ba8e680b48 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 e2608213dc5..48a372f4768 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 6c35c7a4deb..8c2cdb12af5 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 58056df84f6dfd0c86d45e2e22d715a3c501ce1e Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 24 Nov 2024 12:43:07 -0800 Subject: [PATCH 21/43] bcm53xx: backport nvmem mac for meraki mr26 Avoids having to set the MAC in userspace. Also added a mac-base change to set the wifi MACs. It's not clear if upstream would want it once mac-base is upstreamed. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/17064 Signed-off-by: Robert Marko --- .../bcm53xx/base-files/etc/board.d/02_network | 5 -- .../hotplug.d/ieee80211/10-fix-mac-address | 18 ----- ...eraki-mr26-set-mac-address-for-gmac0.patch | 52 ++++++++++++++ ...ARM-dts-meraki-mr26-wifi-MACs-in-dts.patch | 67 +++++++++++++++++++ 4 files changed, 119 insertions(+), 23 deletions(-) delete mode 100644 target/linux/bcm53xx/base-files/etc/hotplug.d/ieee80211/10-fix-mac-address create mode 100644 target/linux/bcm53xx/patches-6.6/050-v6.13-ARM-dts-meraki-mr26-set-mac-address-for-gmac0.patch create mode 100644 target/linux/bcm53xx/patches-6.6/051-ARM-dts-meraki-mr26-wifi-MACs-in-dts.patch diff --git a/target/linux/bcm53xx/base-files/etc/board.d/02_network b/target/linux/bcm53xx/base-files/etc/board.d/02_network index 19569e7a781..5edf6ec9b8f 100644 --- a/target/linux/bcm53xx/base-files/etc/board.d/02_network +++ b/target/linux/bcm53xx/base-files/etc/board.d/02_network @@ -71,11 +71,6 @@ bcm53xx_setup_macs() etXmacaddr=$(nvram get et0macaddr) offset=5 ;; - meraki,mr26) - label_mac="$(mtd_get_mac_binary_ubi board-config 0x66)" - ucidef_set_interface_macaddr "lan" "$label_mac" - ucidef_set_label_macaddr "$label_mac" - ;; meraki,mx64 | \ meraki,mx64-a0 | \ meraki,mx65) diff --git a/target/linux/bcm53xx/base-files/etc/hotplug.d/ieee80211/10-fix-mac-address b/target/linux/bcm53xx/base-files/etc/hotplug.d/ieee80211/10-fix-mac-address deleted file mode 100644 index c1c56a10f39..00000000000 --- a/target/linux/bcm53xx/base-files/etc/hotplug.d/ieee80211/10-fix-mac-address +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/ash - -[ "$ACTION" = "add" ] || exit 0 - -PHYNBR=${DEVPATH##*/phy} - -[ -n $PHYNBR ] || exit 0 - -. /lib/functions.sh -. /lib/functions/system.sh - -board=$(board_name) - -case "$board" in -meraki,mr26) - macaddr_add "$(macaddr_setbit_la $(mtd_get_mac_binary_ubi 'board-config' 0x66))" $(($PHYNBR * 8 + 1)) > /sys${DEVPATH}/macaddress - ;; -esac diff --git a/target/linux/bcm53xx/patches-6.6/050-v6.13-ARM-dts-meraki-mr26-set-mac-address-for-gmac0.patch b/target/linux/bcm53xx/patches-6.6/050-v6.13-ARM-dts-meraki-mr26-set-mac-address-for-gmac0.patch new file mode 100644 index 00000000000..f6a6f819d1a --- /dev/null +++ b/target/linux/bcm53xx/patches-6.6/050-v6.13-ARM-dts-meraki-mr26-set-mac-address-for-gmac0.patch @@ -0,0 +1,52 @@ +From ad1915e2070cf832bfb81dcbeb44b073c09e6dcc Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Sun, 20 Oct 2024 18:51:47 -0700 +Subject: [PATCH] ARM: dts: meraki-mr26: set mac address for gmac0 + +Currently this needs to be done in userspace. + +Signed-off-by: Rosen Penev +Link: https://lore.kernel.org/r/20241021015147.172700-1-rosenp@gmail.com +Signed-off-by: Florian Fainelli +--- + .../dts/broadcom/bcm53015-meraki-mr26.dts | 20 +++++++++++++++++++ + 1 file changed, 20 insertions(+) + +--- a/arch/arm/boot/dts/broadcom/bcm53015-meraki-mr26.dts ++++ b/arch/arm/boot/dts/broadcom/bcm53015-meraki-mr26.dts +@@ -59,6 +59,9 @@ + + &gmac0 { + status = "okay"; ++ ++ nvmem-cells = <&macaddr_board_config_66>; ++ nvmem-cell-names = "mac-address"; + }; + + &gmac1 { +@@ -102,8 +105,25 @@ + }; + + partition@800000 { ++ compatible = "linux,ubi"; + label = "ubi"; + reg = <0x800000 0x7780000>; ++ ++ volumes { ++ ubi-volume-board-config { ++ volname = "board-config"; ++ ++ nvmem-layout { ++ compatible = "fixed-layout"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ macaddr_board_config_66: macaddr@66 { ++ reg = <0x66 0x6>; ++ }; ++ }; ++ }; ++ }; + }; + }; + }; diff --git a/target/linux/bcm53xx/patches-6.6/051-ARM-dts-meraki-mr26-wifi-MACs-in-dts.patch b/target/linux/bcm53xx/patches-6.6/051-ARM-dts-meraki-mr26-wifi-MACs-in-dts.patch new file mode 100644 index 00000000000..fd31438cdb2 --- /dev/null +++ b/target/linux/bcm53xx/patches-6.6/051-ARM-dts-meraki-mr26-wifi-MACs-in-dts.patch @@ -0,0 +1,67 @@ +From c18e0b14b466fb0aa17c8ca6e61f16ba1254aebd Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Sun, 24 Nov 2024 12:58:51 -0800 +Subject: [PATCH] ARM: dts: meraki-mr26: wifi MACs in dts + +OPENWRT HACK. Probably will not be accepted upstream. + +Signed-off-by: Rosen Penev +--- + .../dts/broadcom/bcm53015-meraki-mr26.dts | 31 ++++++++++++++++++- + 1 file changed, 30 insertions(+), 1 deletion(-) + +--- a/arch/arm/boot/dts/broadcom/bcm53015-meraki-mr26.dts ++++ b/arch/arm/boot/dts/broadcom/bcm53015-meraki-mr26.dts +@@ -60,7 +60,7 @@ + &gmac0 { + status = "okay"; + +- nvmem-cells = <&macaddr_board_config_66>; ++ nvmem-cells = <&macaddr_board_config_66 0>; + nvmem-cell-names = "mac-address"; + }; + +@@ -74,6 +74,33 @@ + status = "disabled"; + }; + ++&pcie0 { ++ wifi@0,0 { ++ reg = <0x0000 0 0 0 0>; ++ compatible = "brcm,bcm43431"; ++ nvmem-cells = <&macaddr_board_config_66 1>; ++ nvmem-cell-names = "mac-address"; ++ }; ++}; ++ ++&pcie1 { ++ wifi@0,0 { ++ reg = <0x0000 0 0 0 0>; ++ compatible = "brcm,bcm43431"; ++ nvmem-cells = <&macaddr_board_config_66 2>; ++ nvmem-cell-names = "mac-address"; ++ }; ++}; ++ ++&pcie2 { ++ wifi@0,0 { ++ reg = <0x0000 0 0 0 0>; ++ compatible = "brcm,bcm43428"; ++ nvmem-cells = <&macaddr_board_config_66 3>; ++ nvmem-cell-names = "mac-address"; ++ }; ++}; ++ + &nandcs { + partitions { + compatible = "fixed-partitions"; +@@ -119,7 +146,9 @@ + #size-cells = <1>; + + macaddr_board_config_66: macaddr@66 { ++ compatible = "mac-base"; + reg = <0x66 0x6>; ++ #nvmem-cell-cells = <1>; + }; + }; + }; From 3410ad2f40c085e5db7a71f6ae4b80734826a1e3 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Fri, 13 Dec 2024 13:30:38 +0800 Subject: [PATCH 22/43] 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 --- 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 048e32f0e16..aaeb75f2616 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 551e04f3c9c063d885ca7a91db36f27f684a3a5c Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Mon, 16 Dec 2024 15:09:50 +0800 Subject: [PATCH 23/43] 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 --- 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 aaeb75f2616..f43281b5dce 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 4baa20ec661725550a830e7c86f9f75cbb1fbc4b Mon Sep 17 00:00:00 2001 From: Thomas Richard Date: Fri, 3 Jan 2025 10:19:05 +0100 Subject: [PATCH 24/43] include/trusted-firmware-a.mk: unset CC before compiling If CC is explicitly set to a non default value, TF-A keeps this value. Otherwise it assigns generic default value. As the build bot set CC=/usr/bin/gcc-10, TF-A uses it which causes a compile issue. So unset CC before compiling. It's a new behavior since v2.12. A part of the explanation is available in this commit [1]. [1] https://github.com/ARM-software/arm-trusted-firmware/commit/e01c71266f9df46ac46dc72669449490d1c94419 Signed-off-by: Thomas Richard Link: https://github.com/openwrt/openwrt/pull/17465 Signed-off-by: Hauke Mehrtens --- include/trusted-firmware-a.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/trusted-firmware-a.mk b/include/trusted-firmware-a.mk index c0d11d68c4b..c329b76c56a 100644 --- a/include/trusted-firmware-a.mk +++ b/include/trusted-firmware-a.mk @@ -77,7 +77,8 @@ endef DTC=$(wildcard $(LINUX_DIR)/scripts/dtc/dtc) define Build/Compile/Trusted-Firmware-A - +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \ + +unset CC; \ + $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \ CROSS_COMPILE=$(TARGET_CROSS) \ OPENSSL_DIR=$(STAGING_DIR_HOST) \ $(if $(DTC),DTC="$(DTC)") \ From d5545a9595cdf9571fbf1e57ae03291145feeceb Mon Sep 17 00:00:00 2001 From: "Anton Yu. Ivanusev" Date: Thu, 26 Dec 2024 09:42:53 +0500 Subject: [PATCH 25/43] ramips: mt76x8: add support for Keenetic Extra (KN-1713) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Specification: SoC: MediaTek MT7628AN RAM: 128M DDR2, Etron Technology EM68C16CWQG-25H Flash: 32M, cFeon EN25QH256A (Dual Boot, SPI) Switch: MediaTek MT7628AN, 4 ports 100 Mbps WiFi: MediaTek MT7628AN 2.4 GHz 802.11n and MediaTek MT7613BEN 5 GHz 802.11ac USB: 1 port USB 2.0 GPIO: 3 buttons (Wi-Fi, Reset, FN), 4 LEDs (Power, Internet, FN, Wi-Fi), USB port power controls Disassembly: There are 2 screws at the bottom. After removing the screws, pry the gray plastic part around (it is secured with latches) and remove it. UART Interface: The UART interface can be connected to the 5 pin located between the WAN port and the RESET button. Pins (from WAN port to Reset button): VCC, TX, RX, NC, GRD Settings: 115200, 8N1 Flashing via OEM recovery software: 1. Download the OEM recovery software from the manufacturer's website 2. Download the firmware image (for OpenWRT it is *-squashfs-factory.bin), rename it to KN-1713_recovery.bin 3. Replace the file in the fw folder OEM recovery software with the file from step 2. 4. Run the OEM recovery software and follow the instructions. Flashing via TFTP: 1. Connect your PC and router to port 1-3, configure PC interface using IP 192.168.1.2, mask 255.255.255.252 2. Serve the firmware image (for OpenWRT it is *-squashfs-factory.bin) renamed to KN-1713_recovery.bin via TFTP 3. Power up the router while pressing Reset button on the back 4. Release Restart button when Power LED starts blinking To revert back to OEM firmware: The return to the OEM firmware is carried out by using the methods described above with the help of the appropriate firmware image. When using OEM bootloader, the firmware image size cannot exceed the size of one OEM «Firmware_x» partition or Kernel + rootFS size. Signed-off-by: Anton Yu. Ivanusev Link: https://github.com/openwrt/openwrt/pull/17382 Signed-off-by: Hauke Mehrtens --- .../ramips/dts/mt7628an_keenetic_kn-1713.dts | 241 ++++++++++++++++++ target/linux/ramips/image/mt76x8.mk | 12 + .../mt76x8/base-files/etc/board.d/01_leds | 3 +- .../mt76x8/base-files/etc/board.d/02_network | 1 + 4 files changed, 256 insertions(+), 1 deletion(-) create mode 100644 target/linux/ramips/dts/mt7628an_keenetic_kn-1713.dts diff --git a/target/linux/ramips/dts/mt7628an_keenetic_kn-1713.dts b/target/linux/ramips/dts/mt7628an_keenetic_kn-1713.dts new file mode 100644 index 00000000000..972c88eadd0 --- /dev/null +++ b/target/linux/ramips/dts/mt7628an_keenetic_kn-1713.dts @@ -0,0 +1,241 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +#include "mt7628an.dtsi" + +#include +#include +#include + +/ { + compatible = "keenetic,kn-1713", "mediatek,mt7628an-soc"; + model = "Keenetic KN-1713"; + + aliases { + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + regulator-usb { + compatible = "regulator-fixed"; + regulator-name = "USB-power"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpios = <&gpio 6 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; + + leds { + compatible = "gpio-leds"; + + led_power: power { + function = LED_FUNCTION_POWER; + color = ; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + }; + + internet { + function = LED_FUNCTION_WAN; + color = ; + gpios = <&gpio 38 GPIO_ACTIVE_LOW>; + }; + + fn { + function = LED_FUNCTION_USB; + color = ; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + }; + + wifi { + function = LED_FUNCTION_WLAN; + color = ; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt","phy1tpt"; + }; + }; + + + keys { + compatible = "gpio-keys"; + + fn { + label = "fn"; + gpios = <&gpio 32 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + reset { + label = "restart"; + gpios = <&gpio 44 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio 37 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + virtual_flash { + compatible = "mtd-concat"; + devices = <&firmware1 &firmware2>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x0 0x1CC0000>; + }; + }; + }; +}; + +&state_default { + gpio { + groups = "i2s", "i2c", "gpio", "refclk", "wdt", "wled_an"; + function = "gpio"; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <104000000>; + + partitions: partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-config"; + reg = <0x30000 0x10000>; + read-only; + }; + + partition@40000 { + label = "rf-eeprom"; + 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_400: eeprom@400 { + reg = <0x400 0x4da8>; + }; + + macaddr_factory_4: macaddr@4 { + reg = <0x4 0x6>; + }; + }; + }; + + firmware1: partition@50000 { + label = "firmware_1"; + reg = <0x50000 0xe60000>; + }; + + partition@EB0000 { + label = "config_1"; + reg = <0xEB0000 0x40000>; + read-only; + }; + + partition@EF0000 { + label = "storage"; + reg = <0xEF0000 0x100000>; + read-only; + }; + + partition@FF0000 { + label = "dump"; + reg = <0xFF0000 0x10000>; + read-only; + }; + + partition@1000000 { + label = "u-state"; + reg = <0x1000000 0x30000>; + read-only; + }; + + partition@1030000 { + label = "u-config_res"; + reg = <0x1030000 0x10000>; + read-only; + }; + + partition@1040000 { + label = "rf-eeprom_res"; + reg = <0x1040000 0x10000>; + read-only; + }; + + firmware2: partition@1050000 { + label = "firmware_2"; + reg = <0x1050000 0xE60000>; + }; + + partition@1EB0000 { + label = "Config_2"; + reg = <0x1EB0000 0x40000>; + read-only; + }; + }; + }; +}; + +ðernet { + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; +}; + +&esw { + mediatek,portmap = <0x3e>; +}; + +&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_400>; + nvmem-cell-names = "eeprom"; + ieee80211-freq-limit = <5000000 6000000>; + }; +}; diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk index da44b0005c5..dbad26a140c 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -366,6 +366,18 @@ define Device/keenetic_kn-1613 endef TARGET_DEVICES += keenetic_kn-1613 +define Device/keenetic_kn-1713 + BLOCKSIZE := 64k + IMAGE_SIZE := 13434880 + DEVICE_VENDOR := Keenetic + DEVICE_MODEL := KN-1713 + DEVICE_PACKAGES := kmod-mt7615e kmod-mt7663-firmware-ap kmod-usb2 + IMAGES += factory.bin + IMAGE/factory.bin := $$(sysupgrade_bin) | pad-to $$$$(BLOCKSIZE) | \ + check-size | zyimage -d 0x801713 -v "KN-1713" +endef +TARGET_DEVICES += keenetic_kn-1713 + define Device/keenetic_kn-3211 IMAGE_SIZE := 31488k DEVICE_VENDOR := Keenetic 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 00e5086bb3f..fda4fa3bdf3 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 @@ -58,7 +58,8 @@ hiwifi,hc5661a|\ hiwifi,hc5761a) ucidef_set_led_switch "internet" "internet" "blue:internet" "switch0" "0x10" ;; -keenetic,kn-1613) +keenetic,kn-1613|\ +keenetic,kn-1713) ucidef_set_led_switch "internet" "internet" "green:internet" "switch0" "0x01" ;; mediatek,linkit-smart-7688) 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 e57643690a1..10e0e84dde3 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 @@ -130,6 +130,7 @@ ramips_setup_interfaces() "0:lan" "1:lan" "2:lan" "6@eth0" ;; keenetic,kn-1613|\ + keenetic,kn-1713|\ motorola,mwr03) ucidef_add_switch "switch0" \ "1:lan" "2:lan" "3:lan" "0:wan" "6@eth0" From 5d0f61e957ff19a7f6ad0b733c8b422f965525c5 Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Sat, 28 Dec 2024 17:38:11 +0900 Subject: [PATCH 26/43] mediatek: mt7622: improve fixup of trx for Buffalo devices Unify the common part to the function and don't fixup trx when booting with initramfs image. Signed-off-by: INAGAKI Hiroshi Link: https://github.com/openwrt/openwrt/pull/17408 Signed-off-by: Hauke Mehrtens --- .../base-files/etc/uci-defaults/09_fix_crc | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/target/linux/mediatek/mt7622/base-files/etc/uci-defaults/09_fix_crc b/target/linux/mediatek/mt7622/base-files/etc/uci-defaults/09_fix_crc index 59b00a6e69b..25c8a0359ba 100644 --- a/target/linux/mediatek/mt7622/base-files/etc/uci-defaults/09_fix_crc +++ b/target/linux/mediatek/mt7622/base-files/etc/uci-defaults/09_fix_crc @@ -1,14 +1,22 @@ . /lib/functions.sh -kernel_size=$(sed -n 's/mtd[0-9]*: \([0-9a-f]*\).*"\(kernel\|linux\)".*/\1/p' /proc/mtd) +# don't modify FW data when booting with initramfs image +fstype="$(/bin/mount | awk '($3 ~ /^\/$/) && ($5 !~ /rootfs/) { print $5 }')" +[ "$fstype" = "tmpfs" ] && \ + exit 0 + +fixup_trx_crc() { + local trx_magic="$1" + local kernel_size=$(sed -n 's/mtd[0-9]*: \([0-9a-f]*\).*"\(kernel\|linux\)".*/\1/p' /proc/mtd) + + mtd -M $trx_magic ${kernel_size:+-c 0x$kernel_size} fixtrx firmware +} case "$(board_name)" in buffalo,wsr-2533dhp2) - mtd -M 0x44485032 ${kernel_size:+-c 0x$kernel_size} fixtrx firmware && exit 0 - exit 1 + fixup_trx_crc 0x44485032 ;; buffalo,wsr-3200ax4s) - mtd -M 0x44485033 ${kernel_size:+-c 0x$kernel_size} fixtrx firmware && exit 0 - exit 1 + fixup_trx_crc 0x44485033 ;; esac From 376d8f96b1d1285a6fce711146d223d5d325edf5 Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Sat, 28 Dec 2024 17:48:02 +0900 Subject: [PATCH 27/43] mediatek: mt7622: sync buffalo.sh with ramips/mt7621 Sync buffalo.sh with the one in ramips/mt7621 to improve handling of the TRX magic numbers of Buffalo WSR devices and switching sysupgrade method between buffalo_upgrade_ubinized() and nand_do_upgrade(). Signed-off-by: INAGAKI Hiroshi Link: https://github.com/openwrt/openwrt/pull/17408 Signed-off-by: Hauke Mehrtens --- .../mt7622/base-files/lib/upgrade/buffalo.sh | 27 ++++++++++++++++--- .../mt7622/base-files/lib/upgrade/platform.sh | 11 +------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/target/linux/mediatek/mt7622/base-files/lib/upgrade/buffalo.sh b/target/linux/mediatek/mt7622/base-files/lib/upgrade/buffalo.sh index 844cc4ed959..fcfea36966d 100644 --- a/target/linux/mediatek/mt7622/base-files/lib/upgrade/buffalo.sh +++ b/target/linux/mediatek/mt7622/base-files/lib/upgrade/buffalo.sh @@ -34,20 +34,30 @@ # # The mtd partitions "firmware" and "Kernel2" on NAND flash are os-image # partitions. These partitions are called as "Image1/Image2" in U-Boot -# on WSR-2533DHP2, and they are checked conditions when booting. +# on WSR devices, and they are checked conditions when booting. # "Image1" is always used for booting. # # == U-Boot Behaviors == # - "Image1"/"Image2" images are good, images are different or # "Image2" image is broken -# -> writes os-image to "Image2" from "Image1" +# -> copy os-image to "Image2" from "Image1" # # - "Image1" image is broken -# -> writes os-image to "Image1" from "Image2" +# -> copy os-image to "Image1" from "Image2" # # - "Image1"/"Image2" images are broken # -> fall to U-Boot command line +# TRX magic numbers of each model +case "$(board_name)" in +buffalo,wsr-2533dhp2) + BUFFALO_TRX_MAGIC="44485032" # "DHP2" + ;; +buffalo,wsr-3200ax4s) + BUFFALO_TRX_MAGIC="44485033" # "DHP3" + ;; +esac + buffalo_check_image() { local board="$1" local boardname="$(echo $board | tr ',' '_')" @@ -56,7 +66,7 @@ buffalo_check_image() { # return error state if TRX + UBI formatted image specified # to notify about configurations - if [ "$magic" = "44485032" -o "$magic" = "44485033" ]; then + if [ "$magic" = "$BUFFALO_TRX_MAGIC" ]; then echo "Your configurations won't be saved if factory-uboot.bin image specified." echo "But if you want to upgrade, please execute sysupgrade with \"-F\" option." return 1 @@ -124,3 +134,12 @@ buffalo_upgrade_ubinized() { exit 1 fi } + +buffalo_do_upgrade() { + if [ "$(get_magic_long "$1")" = "$BUFFALO_TRX_MAGIC" ]; then + buffalo_upgrade_ubinized "$1" + else + CI_KERNPART="firmware" + nand_do_upgrade "$1" + fi +} diff --git a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh index 2607f170e05..f017509637e 100755 --- a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh @@ -16,16 +16,7 @@ platform_do_upgrade() { ;; buffalo,wsr-2533dhp2|\ buffalo,wsr-3200ax4s) - local magic="$(get_magic_long "$1")" - - # use "mtd write" if the magic is "DHP2 (0x44485032)" - # or "DHP3 (0x44485033)" - if [ "$magic" = "44485032" -o "$magic" = "44485033" ]; then - buffalo_upgrade_ubinized "$1" - else - CI_KERNPART="firmware" - nand_do_upgrade "$1" - fi + buffalo_do_upgrade "$1" ;; dlink,eagle-pro-ai-m32-a1|\ dlink,eagle-pro-ai-r32-a1|\ From a06a2ef89db03fac2cbd950304e5b507da9deb1e Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Sat, 28 Dec 2024 19:07:09 +0900 Subject: [PATCH 28/43] 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 --- 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 9f5fdc86888..faf1b20e4ac 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 d5669c040beb0fa29e6916049941f0e76ce07460 Mon Sep 17 00:00:00 2001 From: John Audia Date: Sat, 4 Jan 2025 16:36:20 +0100 Subject: [PATCH 29/43] 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 --- 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 db8ba30f875..320b11708f9 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 099ce3ce14d..7ec35c95f0b 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 e7419381fdd43a49e7583a786ce2d9c2ed1b4afe Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Thu, 2 Jan 2025 15:44:45 +0100 Subject: [PATCH 30/43] 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 --- 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 93cbc7d148c..70c3ab4c7b5 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 e47260df820..38fbe1b5228 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 c9ae39b2d156ff893d88a7d75b9044aac2fdd8d0 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Wed, 1 Jan 2025 22:18:05 +0100 Subject: [PATCH 31/43] 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 --- target/linux/realtek/Makefile | 5 ----- 1 file changed, 5 deletions(-) diff --git a/target/linux/realtek/Makefile b/target/linux/realtek/Makefile index 2614b148c4d..6cdd32a9d81 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 70733c6093ee1e2fae12fdff97425270ea733dae Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 25 Dec 2024 19:39:29 +0800 Subject: [PATCH 32/43] 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 --- ...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 00000000000..e2c75979dfe --- /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 00000000000..c60d2ad54a9 --- /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 bb3f8197020..869879178fb 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 4c07a105906..df7f9927af0 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 5d583901657bdfbbf9fad77d9247872427aa5c99 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 25 Dec 2024 19:39:29 +0800 Subject: [PATCH 33/43] 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 --- ...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 00000000000..e66fbd43694 --- /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 00000000000..f7e7a8e5ffa --- /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 00000000000..7c376df197a --- /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 00000000000..aa6f9c437c6 --- /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 869879178fb..9d15d181d72 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 df7f9927af0..f4cc0443224 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 59557ca19a460d8ad70991f63616d1ad0dfe9823 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 25 Dec 2024 19:39:29 +0800 Subject: [PATCH 34/43] 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 --- ...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 00000000000..15d1601eef1 --- /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 00000000000..19d1951b7b5 --- /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 9d15d181d72..88a72fd03ec 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 f4cc0443224..eb0237a3893 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 70610a5240a94648e178713f091435bd0ba158d3 Mon Sep 17 00:00:00 2001 From: Roland Reinl Date: Wed, 18 Dec 2024 15:45:37 +0100 Subject: [PATCH 35/43] 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 --- .../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 e186589f281..c52d004c639 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 baab9ac2918..7556be52bda 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 8925c469f4ec919b3df5d8afdbc608cfdb7a8b33 Mon Sep 17 00:00:00 2001 From: Manuel Fombuena Date: Wed, 1 Jan 2025 20:42:37 +0000 Subject: [PATCH 36/43] generic: add STMicroelectronics LED1202 driver This LED controller has a driver under development which is currently being reviewed by the respective kernel maintainers. They are currently on v11 which is included here. The LED1202 is a 12-channel low quiescent current LED driver with: * Supply range from 2.6 V to 5 V * 20 mA current capability per channel * 1.8 V compatible I2C control interface * 8-bit analog dimming individual control * 12-bit local PWM resolution * 8 programmable patterns If the led node is present in the controller then the channel is set to active. The output current can be adjusted separately for each channel by 8-bit analog (current sink input) and 12-bit digital (PWM) dimming control. The LED1202 implements 12 low-side current generators with independent dimming control. Internal volatile memory allows the user to store up to 8 different patterns, each pattern is a particular output configuration in terms of PWM duty-cycle (on 4096 steps). Analog dimming (on 256 steps) is per channel but common to all patterns. Each device tree LED node will have a corresponding entry in /sys/class/leds with the label name. The brightness property corresponds to the per channel analog dimming, while the patterns[1-8] to the PWM dimming control. Signed-off-by: Manuel Fombuena Link: https://github.com/openwrt/openwrt/pull/17451 Signed-off-by: Robert Marko --- package/kernel/linux/modules/leds.mk | 17 + ...ds-add-reset-controller-based-driver.patch | 4 +- ...rt-for-Sercomm-MSP430-LED-controller.patch | 2 +- ...ings-leds-Add-LED1202-LED-Controller.patch | 181 ++++++ .../892-leds-Add-LED1202-I2C-driver.patch | 513 ++++++++++++++++++ .../950-smartrg-i2c-led-driver.patch | 4 +- 6 files changed, 716 insertions(+), 5 deletions(-) create mode 100644 target/linux/generic/pending-6.6/891-dt-bindings-leds-Add-LED1202-LED-Controller.patch create mode 100644 target/linux/generic/pending-6.6/892-leds-Add-LED1202-I2C-driver.patch diff --git a/package/kernel/linux/modules/leds.mk b/package/kernel/linux/modules/leds.mk index 0c42895bb2f..98e6fc88490 100644 --- a/package/kernel/linux/modules/leds.mk +++ b/package/kernel/linux/modules/leds.mk @@ -233,6 +233,23 @@ endef $(eval $(call KernelPackage,leds-pwm)) +define KernelPackage/leds-st1202 + SUBMENU:=LED modules + TITLE:=LED support for ST LED1202 I2C chips + DEPENDS:=+kmod-i2c-core +kmod-ledtrig-pattern + KCONFIG:=CONFIG_LEDS_ST1202 + FILES:= $(LINUX_DIR)/drivers/leds/leds-st1202.ko + AUTOLOAD:=$(call AutoProbe,leds-st1202) +endef + +define KernelPackage/leds-st1202/description + This option enables support for LEDs connected to LED1202 + LED driver chips accessed via the I2C bus. +endef + +$(eval $(call KernelPackage,leds-st1202)) + + define KernelPackage/leds-tlc591xx SUBMENU:=$(LEDS_MENU) TITLE:=LED driver for TLC59108 and TLC59116 controllers diff --git a/target/linux/ath79/patches-6.6/800-leds-add-reset-controller-based-driver.patch b/target/linux/ath79/patches-6.6/800-leds-add-reset-controller-based-driver.patch index fa958e767b3..e84cc00f4b1 100644 --- a/target/linux/ath79/patches-6.6/800-leds-add-reset-controller-based-driver.patch +++ b/target/linux/ath79/patches-6.6/800-leds-add-reset-controller-based-driver.patch @@ -13,7 +13,7 @@ Signed-off-by: John Crispin --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig -@@ -901,6 +901,17 @@ source "drivers/leds/flash/Kconfig" +@@ -911,6 +911,17 @@ source "drivers/leds/flash/Kconfig" comment "RGB LED drivers" source "drivers/leds/rgb/Kconfig" @@ -176,7 +176,7 @@ Signed-off-by: John Crispin +MODULE_ALIAS("platform:leds-reset"); --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile -@@ -88,6 +88,7 @@ obj-$(CONFIG_LEDS_TURRIS_OMNIA) += leds +@@ -89,6 +89,7 @@ obj-$(CONFIG_LEDS_TURRIS_OMNIA) += leds obj-$(CONFIG_LEDS_WM831X_STATUS) += leds-wm831x-status.o obj-$(CONFIG_LEDS_WM8350) += leds-wm8350.o obj-$(CONFIG_LEDS_WRAP) += leds-wrap.o diff --git a/target/linux/bmips/patches-6.6/700-leds-add-support-for-Sercomm-MSP430-LED-controller.patch b/target/linux/bmips/patches-6.6/700-leds-add-support-for-Sercomm-MSP430-LED-controller.patch index a2e4a62349e..0b9a29b18f5 100644 --- a/target/linux/bmips/patches-6.6/700-leds-add-support-for-Sercomm-MSP430-LED-controller.patch +++ b/target/linux/bmips/patches-6.6/700-leds-add-support-for-Sercomm-MSP430-LED-controller.patch @@ -40,6 +40,6 @@ Signed-off-by: Álvaro Fernández Rojas obj-$(CONFIG_LEDS_REGULATOR) += leds-regulator.o obj-$(CONFIG_LEDS_SC27XX_BLTC) += leds-sc27xx-bltc.o +obj-$(CONFIG_LEDS_SERCOMM_MSP430) += leds-sercomm-msp430.o + obj-$(CONFIG_LEDS_ST1202) += leds-st1202.o obj-$(CONFIG_LEDS_SUNFIRE) += leds-sunfire.o obj-$(CONFIG_LEDS_SYSCON) += leds-syscon.o - obj-$(CONFIG_LEDS_TCA6507) += leds-tca6507.o diff --git a/target/linux/generic/pending-6.6/891-dt-bindings-leds-Add-LED1202-LED-Controller.patch b/target/linux/generic/pending-6.6/891-dt-bindings-leds-Add-LED1202-LED-Controller.patch new file mode 100644 index 00000000000..164256081af --- /dev/null +++ b/target/linux/generic/pending-6.6/891-dt-bindings-leds-Add-LED1202-LED-Controller.patch @@ -0,0 +1,181 @@ +From: Vicentiu Galanopulo +To: Pavel Machek , Lee Jones , + Rob Herring , + Krzysztof Kozlowski , + Conor Dooley , + Jonathan Corbet , + Vicentiu Galanopulo , + linux-leds@vger.kernel.org, devicetree@vger.kernel.org, + linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org +Cc: Krzysztof Kozlowski +Subject: [PATCH v11 2/3] dt-bindings: leds: Add LED1202 LED Controller +Date: Wed, 18 Dec 2024 18:33:58 +0000 [thread overview] +Message-ID: <20241218183401.41687-3-vicentiu.galanopulo@remote-tech.co.uk> (raw) +In-Reply-To: <20241218183401.41687-1-vicentiu.galanopulo@remote-tech.co.uk> + +The LED1202 is a 12-channel low quiescent current LED driver with: + * Supply range from 2.6 V to 5 V + * 20 mA current capability per channel + * 1.8 V compatible I2C control interface + * 8-bit analog dimming individual control + * 12-bit local PWM resolution + * 8 programmable patterns + +If the led node is present in the controller then the channel is +set to active. + +Signed-off-by: Vicentiu Galanopulo +Reviewed-by: Krzysztof Kozlowski +--- + v1: https://lore.kernel.org/lkml/ZnCnnQfwuRueCIQ0@admins-Air/T/ + v2: https://lore.kernel.org/all/ZniNdGgKyUMV-hjq@admins-Air/T/ + v3: https://lore.kernel.org/all/ZniNdGgKyUMV-hjq@admins-Air/T/ + + Changes in v4: + - remove label property, use devm_led_classdev_register_ext instead + Changes in v3: + - remove active property + Changes in v2: + - renamed label to remove color from it + - add color property for each node + - add function and function-enumerator property for each node + + .../devicetree/bindings/leds/st,led1202.yaml | 132 ++++++++++++++++++ + 1 file changed, 132 insertions(+) + create mode 100644 Documentation/devicetree/bindings/leds/st,led1202.yaml + +--- /dev/null ++++ b/Documentation/devicetree/bindings/leds/st,led1202.yaml +@@ -0,0 +1,132 @@ ++# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/leds/st,led1202.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: ST LED1202 LED controllers ++ ++maintainers: ++ - Vicentiu Galanopulo ++ ++description: | ++ The LED1202 is a 12-channel low quiescent current LED controller ++ programmable via I2C; The output current can be adjusted separately ++ for each channel by 8-bit analog and 12-bit digital dimming control. ++ Datasheet available at ++ https://www.st.com/en/power-management/led1202.html ++ ++properties: ++ compatible: ++ const: st,led1202 ++ ++ reg: ++ maxItems: 1 ++ ++ "#address-cells": ++ const: 1 ++ ++ "#size-cells": ++ const: 0 ++ ++patternProperties: ++ "^led@[0-9a-f]$": ++ type: object ++ $ref: common.yaml# ++ unevaluatedProperties: false ++ ++ properties: ++ reg: ++ minimum: 0 ++ maximum: 11 ++ ++ required: ++ - reg ++ ++required: ++ - compatible ++ - reg ++ - "#address-cells" ++ - "#size-cells" ++ ++additionalProperties: false ++ ++examples: ++ - | ++ #include ++ ++ i2c { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ led-controller@58 { ++ compatible = "st,led1202"; ++ reg = <0x58>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ led@0 { ++ reg = <0x0>; ++ function = LED_FUNCTION_STATUS; ++ color = ; ++ function-enumerator = <1>; ++ }; ++ ++ led@1 { ++ reg = <0x1>; ++ function = LED_FUNCTION_STATUS; ++ color = ; ++ function-enumerator = <2>; ++ }; ++ ++ led@2 { ++ reg = <0x2>; ++ function = LED_FUNCTION_STATUS; ++ color = ; ++ function-enumerator = <3>; ++ }; ++ ++ led@3 { ++ reg = <0x3>; ++ function = LED_FUNCTION_STATUS; ++ color = ; ++ function-enumerator = <4>; ++ }; ++ ++ led@4 { ++ reg = <0x4>; ++ function = LED_FUNCTION_STATUS; ++ color = ; ++ function-enumerator = <5>; ++ }; ++ ++ led@5 { ++ reg = <0x5>; ++ function = LED_FUNCTION_STATUS; ++ color = ; ++ function-enumerator = <6>; ++ }; ++ ++ led@6 { ++ reg = <0x6>; ++ function = LED_FUNCTION_STATUS; ++ color = ; ++ function-enumerator = <7>; ++ }; ++ ++ led@7 { ++ reg = <0x7>; ++ function = LED_FUNCTION_STATUS; ++ color = ; ++ function-enumerator = <8>; ++ }; ++ ++ led@8 { ++ reg = <0x8>; ++ function = LED_FUNCTION_STATUS; ++ color = ; ++ function-enumerator = <9>; ++ }; ++ }; ++ }; ++... diff --git a/target/linux/generic/pending-6.6/892-leds-Add-LED1202-I2C-driver.patch b/target/linux/generic/pending-6.6/892-leds-Add-LED1202-I2C-driver.patch new file mode 100644 index 00000000000..0777c5ce283 --- /dev/null +++ b/target/linux/generic/pending-6.6/892-leds-Add-LED1202-I2C-driver.patch @@ -0,0 +1,513 @@ +From: Vicentiu Galanopulo +To: Pavel Machek , Lee Jones , + Rob Herring , + Krzysztof Kozlowski , + Conor Dooley , + Jonathan Corbet , + Vicentiu Galanopulo , + linux-leds@vger.kernel.org, devicetree@vger.kernel.org, + linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org +Subject: [PATCH v11 3/3] leds: Add LED1202 I2C driver +Date: Wed, 18 Dec 2024 18:33:59 +0000 [thread overview] +Message-ID: <20241218183401.41687-4-vicentiu.galanopulo@remote-tech.co.uk> (raw) +In-Reply-To: <20241218183401.41687-1-vicentiu.galanopulo@remote-tech.co.uk> + +The output current can be adjusted separately for each channel by 8-bit +analog (current sink input) and 12-bit digital (PWM) dimming control. The +LED1202 implements 12 low-side current generators with independent dimming +control. +Internal volatile memory allows the user to store up to 8 different patterns, +each pattern is a particular output configuration in terms of PWM +duty-cycle (on 4096 steps). Analog dimming (on 256 steps) is per channel but +common to all patterns. Each device tree LED node will have a corresponding +entry in /sys/class/leds with the label name. The brightness property +corresponds to the per channel analog dimming, while the patterns[1-8] to the +PWM dimming control. + +Signed-off-by: Vicentiu Galanopulo +--- + Changes in v10: + - update description help in Kconfig + - move st1202_led and st1202_chip into one line, declaration and definition + Changes in v9: + - log errors directly in st1202_write_reg and st1202_read_reg + - use mutex guards instead of lock/unlock + - remove i2c_set_clientdata + Changes in v7: + - fix st1202_brightness_get() error: uninitialized symbol 'value' + Changes in v6: + - fix build error + Changes in v5: + - remove unused macros + - switch to using devm_led_classdev_register_ext (struct st1202_led update) + - add prescalar_to_milliseconds (convert [22..5660]ms to [0..255] reg value) + - remove register range check in dt_init (range protected by yaml) + - address all review comments in v4 + Changes in v4: + - Remove attributes/extended attributes implementation + - Use /sys/class/leds//hw_pattern (Pavel suggestion) + - Implement review findings of Christophe JAILLET + Changes in v3: + - Rename all ll1202 to st1202, including driver file name + - Convert all magic numbers to defines + - Refactor the show/store callbacks as per Lee's and Thomas's review + - Remove ll1202_get_channel and use dev_ext_attributes instead + - Log all error values for all the functions + - Use sysfs_emit for show callbacks + Changes in v2: + - Fix build error for device_attribute modes + + drivers/leds/Kconfig | 10 + + drivers/leds/Makefile | 1 + + drivers/leds/leds-st1202.c | 416 +++++++++++++++++++++++++++++++++++++ + 3 files changed, 427 insertions(+) + create mode 100644 drivers/leds/leds-st1202.c + +--- a/drivers/leds/Kconfig ++++ b/drivers/leds/Kconfig +@@ -865,6 +865,16 @@ config LEDS_LM36274 + Say Y to enable the LM36274 LED driver for TI LMU devices. + This supports the LED device LM36274. + ++config LEDS_ST1202 ++ tristate "LED Support for STMicroelectronics LED1202 I2C chips" ++ depends on LEDS_CLASS ++ depends on I2C ++ depends on OF ++ select LEDS_TRIGGERS ++ help ++ Say Y to enable support for LEDs connected to LED1202 ++ LED driver chips accessed via the I2C bus. ++ + config LEDS_TPS6105X + tristate "LED support for TI TPS6105X" + depends on LEDS_CLASS +--- a/drivers/leds/Makefile ++++ b/drivers/leds/Makefile +@@ -78,6 +78,7 @@ obj-$(CONFIG_LEDS_POWERNV) += leds-powe + obj-$(CONFIG_LEDS_PWM) += leds-pwm.o + obj-$(CONFIG_LEDS_REGULATOR) += leds-regulator.o + obj-$(CONFIG_LEDS_SC27XX_BLTC) += leds-sc27xx-bltc.o ++obj-$(CONFIG_LEDS_ST1202) += leds-st1202.o + obj-$(CONFIG_LEDS_SUNFIRE) += leds-sunfire.o + obj-$(CONFIG_LEDS_SYSCON) += leds-syscon.o + obj-$(CONFIG_LEDS_TCA6507) += leds-tca6507.o +--- /dev/null ++++ b/drivers/leds/leds-st1202.c +@@ -0,0 +1,416 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * LED driver for STMicroelectronics LED1202 chip ++ * ++ * Copyright (C) 2024 Remote-Tech Ltd. UK ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define ST1202_CHAN_DISABLE_ALL 0x00 ++#define ST1202_CHAN_ENABLE_HIGH 0x03 ++#define ST1202_CHAN_ENABLE_LOW 0x02 ++#define ST1202_CONFIG_REG 0x04 ++/* PATS: Pattern sequence feature enable */ ++#define ST1202_CONFIG_REG_PATS BIT(7) ++/* PATSR: Pattern sequence runs (self-clear when sequence is finished) */ ++#define ST1202_CONFIG_REG_PATSR BIT(6) ++#define ST1202_CONFIG_REG_SHFT BIT(3) ++#define ST1202_DEV_ENABLE 0x01 ++#define ST1202_DEV_ENABLE_ON BIT(0) ++#define ST1202_DEV_ENABLE_RESET BIT(7) ++#define ST1202_DEVICE_ID 0x00 ++#define ST1202_ILED_REG0 0x09 ++#define ST1202_MAX_LEDS 12 ++#define ST1202_MAX_PATTERNS 8 ++#define ST1202_MILLIS_PATTERN_DUR_MAX 5660 ++#define ST1202_MILLIS_PATTERN_DUR_MIN 22 ++#define ST1202_PATTERN_DUR 0x16 ++#define ST1202_PATTERN_PWM 0x1E ++#define ST1202_PATTERN_REP 0x15 ++ ++struct st1202_led { ++ struct fwnode_handle *fwnode; ++ struct led_classdev led_cdev; ++ struct st1202_chip *chip; ++ bool is_active; ++ int led_num; ++}; ++ ++struct st1202_chip { ++ struct i2c_client *client; ++ struct mutex lock; ++ struct st1202_led leds[ST1202_MAX_LEDS]; ++}; ++ ++static struct st1202_led *cdev_to_st1202_led(struct led_classdev *cdev) ++{ ++ return container_of(cdev, struct st1202_led, led_cdev); ++} ++ ++static int st1202_read_reg(struct st1202_chip *chip, int reg, uint8_t *val) ++{ ++ struct device *dev = &chip->client->dev; ++ int ret; ++ ++ ret = i2c_smbus_read_byte_data(chip->client, reg); ++ if (ret < 0) { ++ dev_err(dev, "Failed to read register [0x%x]: %d\n", reg, ret); ++ return ret; ++ } ++ ++ *val = (uint8_t)ret; ++ return 0; ++} ++ ++static int st1202_write_reg(struct st1202_chip *chip, int reg, uint8_t val) ++{ ++ struct device *dev = &chip->client->dev; ++ int ret; ++ ++ ret = i2c_smbus_write_byte_data(chip->client, reg, val); ++ if (ret != 0) ++ dev_err(dev, "Failed to write %d to register [0x%x]: %d\n", val, reg, ret); ++ ++ return ret; ++} ++ ++static uint8_t st1202_prescalar_to_miliseconds(unsigned int value) ++{ ++ return value / ST1202_MILLIS_PATTERN_DUR_MIN - 1; ++} ++ ++static int st1202_pwm_pattern_write(struct st1202_chip *chip, int led_num, ++ int pattern, unsigned int value) ++{ ++ u8 value_l, value_h; ++ int ret; ++ ++ value_l = (u8)value; ++ value_h = (u8)(value >> 8); ++ ++ /* ++ * Datasheet: Register address low = 1Eh + 2*(xh) + 18h*(yh), ++ * where x is the channel number (led number) in hexadecimal (x = 00h .. 0Bh) ++ * and y is the pattern number in hexadecimal (y = 00h .. 07h) ++ */ ++ ret = st1202_write_reg(chip, (ST1202_PATTERN_PWM + (led_num * 2) + 0x18 * pattern), ++ value_l); ++ if (ret != 0) ++ return ret; ++ ++ /* ++ * Datasheet: Register address high = 1Eh + 01h + 2(xh) +18h*(yh), ++ * where x is the channel number in hexadecimal (x = 00h .. 0Bh) ++ * and y is the pattern number in hexadecimal (y = 00h .. 07h) ++ */ ++ ret = st1202_write_reg(chip, (ST1202_PATTERN_PWM + 0x1 + (led_num * 2) + 0x18 * pattern), ++ value_h); ++ if (ret != 0) ++ return ret; ++ ++ return 0; ++} ++ ++static int st1202_duration_pattern_write(struct st1202_chip *chip, int pattern, ++ unsigned int value) ++{ ++ return st1202_write_reg(chip, (ST1202_PATTERN_DUR + pattern), ++ st1202_prescalar_to_miliseconds(value)); ++} ++ ++static void st1202_brightness_set(struct led_classdev *led_cdev, ++ enum led_brightness value) ++{ ++ struct st1202_led *led = cdev_to_st1202_led(led_cdev); ++ struct st1202_chip *chip = led->chip; ++ ++ guard(mutex)(&chip->lock); ++ ++ st1202_write_reg(chip, ST1202_ILED_REG0 + led->led_num, value); ++} ++ ++static enum led_brightness st1202_brightness_get(struct led_classdev *led_cdev) ++{ ++ struct st1202_led *led = cdev_to_st1202_led(led_cdev); ++ struct st1202_chip *chip = led->chip; ++ u8 value = 0; ++ ++ guard(mutex)(&chip->lock); ++ ++ st1202_read_reg(chip, ST1202_ILED_REG0 + led->led_num, &value); ++ ++ return value; ++} ++ ++static int st1202_channel_set(struct st1202_chip *chip, int led_num, bool active) ++{ ++ u8 chan_low, chan_high; ++ int ret; ++ ++ guard(mutex)(&chip->lock); ++ ++ if (led_num <= 7) { ++ ret = st1202_read_reg(chip, ST1202_CHAN_ENABLE_LOW, &chan_low); ++ if (ret < 0) ++ return ret; ++ ++ chan_low = active ? chan_low | BIT(led_num) : chan_low & ~BIT(led_num); ++ ++ ret = st1202_write_reg(chip, ST1202_CHAN_ENABLE_LOW, chan_low); ++ if (ret < 0) ++ return ret; ++ ++ } else { ++ ret = st1202_read_reg(chip, ST1202_CHAN_ENABLE_HIGH, &chan_high); ++ if (ret < 0) ++ return ret; ++ ++ chan_high = active ? chan_high | (BIT(led_num) >> 8) : ++ chan_high & ~(BIT(led_num) >> 8); ++ ++ ret = st1202_write_reg(chip, ST1202_CHAN_ENABLE_HIGH, chan_high); ++ if (ret < 0) ++ return ret; ++ } ++ ++ return 0; ++} ++ ++static int st1202_led_set(struct led_classdev *ldev, enum led_brightness value) ++{ ++ struct st1202_led *led = cdev_to_st1202_led(ldev); ++ struct st1202_chip *chip = led->chip; ++ ++ return st1202_channel_set(chip, led->led_num, value == LED_OFF ? false : true); ++} ++ ++static int st1202_led_pattern_clear(struct led_classdev *ldev) ++{ ++ struct st1202_led *led = cdev_to_st1202_led(ldev); ++ struct st1202_chip *chip = led->chip; ++ int ret; ++ ++ guard(mutex)(&chip->lock); ++ ++ for (int patt = 0; patt < ST1202_MAX_PATTERNS; patt++) { ++ ret = st1202_pwm_pattern_write(chip, led->led_num, patt, LED_OFF); ++ if (ret != 0) ++ return ret; ++ ++ ret = st1202_duration_pattern_write(chip, patt, ST1202_MILLIS_PATTERN_DUR_MIN); ++ if (ret != 0) ++ return ret; ++ } ++ ++ return 0; ++} ++ ++static int st1202_led_pattern_set(struct led_classdev *ldev, ++ struct led_pattern *pattern, ++ u32 len, int repeat) ++{ ++ struct st1202_led *led = cdev_to_st1202_led(ldev); ++ struct st1202_chip *chip = led->chip; ++ int ret; ++ ++ if (len > ST1202_MAX_PATTERNS) ++ return -EINVAL; ++ ++ guard(mutex)(&chip->lock); ++ ++ for (int patt = 0; patt < len; patt++) { ++ if (pattern[patt].delta_t < ST1202_MILLIS_PATTERN_DUR_MIN || ++ pattern[patt].delta_t > ST1202_MILLIS_PATTERN_DUR_MAX) ++ return -EINVAL; ++ ++ ret = st1202_pwm_pattern_write(chip, led->led_num, patt, pattern[patt].brightness); ++ if (ret != 0) ++ return ret; ++ ++ ret = st1202_duration_pattern_write(chip, patt, pattern[patt].delta_t); ++ if (ret != 0) ++ return ret; ++ } ++ ++ ret = st1202_write_reg(chip, ST1202_PATTERN_REP, repeat); ++ if (ret != 0) ++ return ret; ++ ++ ret = st1202_write_reg(chip, ST1202_CONFIG_REG, (ST1202_CONFIG_REG_PATSR | ++ ST1202_CONFIG_REG_PATS | ST1202_CONFIG_REG_SHFT)); ++ if (ret != 0) ++ return ret; ++ ++ return 0; ++} ++ ++static int st1202_dt_init(struct st1202_chip *chip) ++{ ++ struct device *dev = &chip->client->dev; ++ struct st1202_led *led; ++ int err, reg; ++ ++ for_each_available_child_of_node_scoped(dev_of_node(dev), child) { ++ struct led_init_data init_data = {}; ++ ++ err = of_property_read_u32(child, "reg", ®); ++ if (err) ++ return dev_err_probe(dev, err, "Invalid register\n"); ++ ++ led = &chip->leds[reg]; ++ led->is_active = true; ++ led->fwnode = of_fwnode_handle(child); ++ ++ led->led_cdev.max_brightness = U8_MAX; ++ led->led_cdev.brightness_set_blocking = st1202_led_set; ++ led->led_cdev.pattern_set = st1202_led_pattern_set; ++ led->led_cdev.pattern_clear = st1202_led_pattern_clear; ++ led->led_cdev.default_trigger = "pattern"; ++ ++ init_data.fwnode = led->fwnode; ++ init_data.devicename = "st1202"; ++ init_data.default_label = ":"; ++ ++ err = devm_led_classdev_register_ext(dev, &led->led_cdev, &init_data); ++ if (err < 0) ++ return dev_err_probe(dev, err, "Failed to register LED class device\n"); ++ ++ led->led_cdev.brightness_set = st1202_brightness_set; ++ led->led_cdev.brightness_get = st1202_brightness_get; ++ } ++ ++ return 0; ++} ++ ++static int st1202_setup(struct st1202_chip *chip) ++{ ++ int ret; ++ ++ guard(mutex)(&chip->lock); ++ ++ /* ++ * Once the supply voltage is applied, the LED1202 executes some internal checks, ++ * afterwords it stops the oscillator and puts the internal LDO in quiescent mode. ++ * To start the device, EN bit must be set inside the “Device Enable” register at ++ * address 01h. As soon as EN is set, the LED1202 loads the adjustment parameters ++ * from the internal non-volatile memory and performs an auto-calibration procedure ++ * in order to increase the output current precision. ++ * Such initialization lasts about 6.5 ms. ++ */ ++ ++ /* Reset the chip during setup */ ++ ret = st1202_write_reg(chip, ST1202_DEV_ENABLE, ST1202_DEV_ENABLE_RESET); ++ if (ret < 0) ++ return ret; ++ ++ /* Enable phase-shift delay feature */ ++ ret = st1202_write_reg(chip, ST1202_CONFIG_REG, ST1202_CONFIG_REG_SHFT); ++ if (ret < 0) ++ return ret; ++ ++ /* Enable the device */ ++ ret = st1202_write_reg(chip, ST1202_DEV_ENABLE, ST1202_DEV_ENABLE_ON); ++ if (ret < 0) ++ return ret; ++ ++ /* Duration of initialization */ ++ usleep_range(6500, 10000); ++ ++ /* Deactivate all LEDS (channels) and activate only the ones found in Device Tree */ ++ ret = st1202_write_reg(chip, ST1202_CHAN_ENABLE_LOW, ST1202_CHAN_DISABLE_ALL); ++ if (ret < 0) ++ return ret; ++ ++ ret = st1202_write_reg(chip, ST1202_CHAN_ENABLE_HIGH, ST1202_CHAN_DISABLE_ALL); ++ if (ret < 0) ++ return ret; ++ ++ ret = st1202_write_reg(chip, ST1202_CONFIG_REG, ++ ST1202_CONFIG_REG_PATS | ST1202_CONFIG_REG_PATSR); ++ if (ret < 0) ++ return ret; ++ ++ return 0; ++} ++ ++static int st1202_probe(struct i2c_client *client) ++{ ++ struct st1202_chip *chip; ++ struct st1202_led *led; ++ int ret; ++ ++ if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) ++ return dev_err_probe(&client->dev, -EIO, "SMBUS Byte Data not Supported\n"); ++ ++ chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); ++ if (!chip) ++ return -ENOMEM; ++ ++ devm_mutex_init(&client->dev, &chip->lock); ++ chip->client = client; ++ ++ ret = st1202_dt_init(chip); ++ if (ret < 0) ++ return ret; ++ ++ ret = st1202_setup(chip); ++ if (ret < 0) ++ return ret; ++ ++ for (int i = 0; i < ST1202_MAX_LEDS; i++) { ++ led = &chip->leds[i]; ++ led->chip = chip; ++ led->led_num = i; ++ ++ if (!led->is_active) ++ continue; ++ ++ ret = st1202_channel_set(led->chip, led->led_num, true); ++ if (ret < 0) ++ return dev_err_probe(&client->dev, ret, ++ "Failed to activate LED channel\n"); ++ ++ ret = st1202_led_pattern_clear(&led->led_cdev); ++ if (ret < 0) ++ return dev_err_probe(&client->dev, ret, ++ "Failed to clear LED pattern\n"); ++ } ++ ++ return 0; ++} ++ ++static const struct i2c_device_id st1202_id[] = { ++ { "st1202-i2c" }, ++ { /* sentinel */ } ++}; ++MODULE_DEVICE_TABLE(i2c, st1202_id); ++ ++static const struct of_device_id st1202_dt_ids[] = { ++ { .compatible = "st,led1202" }, ++ { /* sentinel */ } ++}; ++MODULE_DEVICE_TABLE(of, st1202_dt_ids); ++ ++static struct i2c_driver st1202_driver = { ++ .driver = { ++ .name = "leds-st1202", ++ .of_match_table = of_match_ptr(st1202_dt_ids), ++ }, ++ .probe = st1202_probe, ++ .id_table = st1202_id, ++}; ++module_i2c_driver(st1202_driver); ++ ++MODULE_AUTHOR("Remote Tech LTD"); ++MODULE_DESCRIPTION("STMicroelectronics LED1202 : 12-channel constant current LED driver"); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/mediatek/patches-6.6/950-smartrg-i2c-led-driver.patch b/target/linux/mediatek/patches-6.6/950-smartrg-i2c-led-driver.patch index cb3b394dc6a..81234f68eab 100644 --- a/target/linux/mediatek/patches-6.6/950-smartrg-i2c-led-driver.patch +++ b/target/linux/mediatek/patches-6.6/950-smartrg-i2c-led-driver.patch @@ -5,7 +5,7 @@ --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig -@@ -901,6 +901,16 @@ source "drivers/leds/flash/Kconfig" +@@ -911,6 +911,16 @@ source "drivers/leds/flash/Kconfig" comment "RGB LED drivers" source "drivers/leds/rgb/Kconfig" @@ -29,6 +29,6 @@ obj-$(CONFIG_LEDS_REGULATOR) += leds-regulator.o obj-$(CONFIG_LEDS_SC27XX_BLTC) += leds-sc27xx-bltc.o +obj-$(CONFIG_LEDS_SMARTRG_LED) += leds-smartrg-system.o + obj-$(CONFIG_LEDS_ST1202) += leds-st1202.o obj-$(CONFIG_LEDS_SUNFIRE) += leds-sunfire.o obj-$(CONFIG_LEDS_SYSCON) += leds-syscon.o - obj-$(CONFIG_LEDS_TCA6507) += leds-tca6507.o From 7ce4ed4829fafdd37a57681304ea91e3749bc3c8 Mon Sep 17 00:00:00 2001 From: Manuel Fombuena Date: Thu, 2 Jan 2025 18:28:16 +0000 Subject: [PATCH 37/43] qualcommax: ipq807x: mx4200v2: fix LED controller The Linksys MX4200v2 doesn't have the same LED controller as the MX4200v1 or MX4300. It comes with the STMicroelectronics LED1202 while the others come with the NXP PCA9633. This LED controller has a driver under development which is currently being reviewed by the respective kernel maintainers. They are currently on v11. Apart from the changes needed on the MX4200v2, this commit also amends the configuration of other devices affected by this change as the LED controller is no common to all of them as it was originally thought. Signed-off-by: Manuel Fombuena Link: https://github.com/openwrt/openwrt/pull/17451 Signed-off-by: Robert Marko --- .../arm64/boot/dts/qcom/ipq8174-mx4200v1.dts | 29 +++++++++++++++++++ .../arm64/boot/dts/qcom/ipq8174-mx4200v2.dts | 26 +++++++++++++++++ .../arm64/boot/dts/qcom/ipq8174-mx4300.dts | 29 +++++++++++++++++++ .../arm64/boot/dts/qcom/ipq8174-mx4x00.dtsi | 26 ----------------- target/linux/qualcommax/image/ipq807x.mk | 12 ++++---- 5 files changed, 91 insertions(+), 31 deletions(-) diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v1.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v1.dts index 7946e5c54d3..12897419bbd 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v1.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v1.dts @@ -11,6 +11,35 @@ compatible = "linksys,mx4200v1", "qcom,ipq8074"; }; +&blsp1_i2c2 { + + 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; + }; + }; +}; + &wifi { status = "okay"; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v2.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v2.dts index 44e1b72f16a..c1779a2d488 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v2.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v2.dts @@ -10,6 +10,32 @@ compatible = "linksys,mx4200v2", "qcom,ipq8074"; }; +&blsp1_i2c2 { + + led-controller@58 { + compatible = "st,led1202"; + reg = <0x58>; + #address-cells = <1>; + #size-cells = <0>; + + led_system_green: led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_STATUS; + }; + led_system_red: led@1 { + reg = <1>; + color = ; + function = LED_FUNCTION_STATUS; + }; + led_system_blue: led@2 { + reg = <2>; + color = ; + function = LED_FUNCTION_STATUS; + }; + }; +}; + &wifi { status = "okay"; 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 index 1477019ab94..d09710b9c47 100644 --- 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 @@ -242,6 +242,35 @@ }; }; +&blsp1_i2c2 { + + 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; + }; + }; +}; + &dp2 { status = "okay"; phy-handle = <&qca8075_1>; 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 index 84e68dae356..2dca7ffd3bf 100644 --- 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 @@ -94,32 +94,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 { diff --git a/target/linux/qualcommax/image/ipq807x.mk b/target/linux/qualcommax/image/ipq807x.mk index 260b358ce89..731c2ba0caa 100644 --- a/target/linux/qualcommax/image/ipq807x.mk +++ b/target/linux/qualcommax/image/ipq807x.mk @@ -167,7 +167,6 @@ define Device/linksys_mx SOC := ipq8072 IMAGES += factory.bin IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | linksys-image type=$$$$(DEVICE_MODEL) - DEVICE_PACKAGES := kmod-leds-pca963x endef define Device/linksys_mx4x00 @@ -180,13 +179,15 @@ define Device/linksys_mx4200v1 $(call Device/linksys_mx4x00) DEVICE_MODEL := MX4200 DEVICE_VARIANT := v1 - DEVICE_PACKAGES += kmod-bluetooth + DEVICE_PACKAGES += kmod-bluetooth kmod-leds-pca963x endef TARGET_DEVICES += linksys_mx4200v1 define Device/linksys_mx4200v2 - $(call Device/linksys_mx4200v1) + $(call Device/linksys_mx4x00) + DEVICE_MODEL := MX4200 DEVICE_VARIANT := v2 + DEVICE_PACKAGES += kmod-bluetooth kmod-leds-st1202 endef TARGET_DEVICES += linksys_mx4200v2 @@ -198,6 +199,7 @@ define Device/linksys_mx4300 KERNEL_SIZE := 8192k IMAGE_SIZE := 171264k NAND_SIZE := 1024m + DEVICE_PACKAGES += kmod-leds-pca963x endef TARGET_DEVICES += linksys_mx4300 @@ -205,7 +207,7 @@ define Device/linksys_mx5300 $(call Device/linksys_mx) DEVICE_MODEL := MX5300 DEVICE_PACKAGES += kmod-rtc-ds1307 ipq-wifi-linksys_mx5300 \ - kmod-ath10k-ct ath10k-firmware-qca9984-ct + kmod-ath10k-ct ath10k-firmware-qca9984-ct kmod-leds-pca963x endef TARGET_DEVICES += linksys_mx5300 @@ -213,7 +215,7 @@ define Device/linksys_mx8500 $(call Device/linksys_mx) DEVICE_MODEL := MX8500 DEVICE_PACKAGES += ipq-wifi-linksys_mx8500 kmod-ath11k-pci \ - ath11k-firmware-qcn9074 kmod-bluetooth + ath11k-firmware-qcn9074 kmod-bluetooth kmod-leds-pca963x endef TARGET_DEVICES += linksys_mx8500 From 39b61ee36fa8e5802e008ee01c428b97cba83e46 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Sun, 5 Jan 2025 12:32:32 +0100 Subject: [PATCH 38/43] Revert "qualcommax: ipq807x: mx4200v2: fix LED controller" This reverts commit 7ce4ed4829fafdd37a57681304ea91e3749bc3c8. Turns out that this requires more work, so revert to prevent making the LED uncontrollable. Signed-off-by: Robert Marko --- .../arm64/boot/dts/qcom/ipq8174-mx4200v1.dts | 29 ------------------- .../arm64/boot/dts/qcom/ipq8174-mx4200v2.dts | 26 ----------------- .../arm64/boot/dts/qcom/ipq8174-mx4300.dts | 29 ------------------- .../arm64/boot/dts/qcom/ipq8174-mx4x00.dtsi | 26 +++++++++++++++++ target/linux/qualcommax/image/ipq807x.mk | 12 ++++---- 5 files changed, 31 insertions(+), 91 deletions(-) diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v1.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v1.dts index 12897419bbd..7946e5c54d3 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v1.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v1.dts @@ -11,35 +11,6 @@ compatible = "linksys,mx4200v1", "qcom,ipq8074"; }; -&blsp1_i2c2 { - - 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; - }; - }; -}; - &wifi { status = "okay"; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v2.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v2.dts index c1779a2d488..44e1b72f16a 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v2.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v2.dts @@ -10,32 +10,6 @@ compatible = "linksys,mx4200v2", "qcom,ipq8074"; }; -&blsp1_i2c2 { - - led-controller@58 { - compatible = "st,led1202"; - reg = <0x58>; - #address-cells = <1>; - #size-cells = <0>; - - led_system_green: led@0 { - reg = <0>; - color = ; - function = LED_FUNCTION_STATUS; - }; - led_system_red: led@1 { - reg = <1>; - color = ; - function = LED_FUNCTION_STATUS; - }; - led_system_blue: led@2 { - reg = <2>; - color = ; - function = LED_FUNCTION_STATUS; - }; - }; -}; - &wifi { status = "okay"; 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 index d09710b9c47..1477019ab94 100644 --- 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 @@ -242,35 +242,6 @@ }; }; -&blsp1_i2c2 { - - 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; - }; - }; -}; - &dp2 { status = "okay"; phy-handle = <&qca8075_1>; 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 index 2dca7ffd3bf..84e68dae356 100644 --- 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 @@ -94,6 +94,32 @@ &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 { diff --git a/target/linux/qualcommax/image/ipq807x.mk b/target/linux/qualcommax/image/ipq807x.mk index 731c2ba0caa..260b358ce89 100644 --- a/target/linux/qualcommax/image/ipq807x.mk +++ b/target/linux/qualcommax/image/ipq807x.mk @@ -167,6 +167,7 @@ define Device/linksys_mx SOC := ipq8072 IMAGES += factory.bin IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | linksys-image type=$$$$(DEVICE_MODEL) + DEVICE_PACKAGES := kmod-leds-pca963x endef define Device/linksys_mx4x00 @@ -179,15 +180,13 @@ define Device/linksys_mx4200v1 $(call Device/linksys_mx4x00) DEVICE_MODEL := MX4200 DEVICE_VARIANT := v1 - DEVICE_PACKAGES += kmod-bluetooth kmod-leds-pca963x + DEVICE_PACKAGES += kmod-bluetooth endef TARGET_DEVICES += linksys_mx4200v1 define Device/linksys_mx4200v2 - $(call Device/linksys_mx4x00) - DEVICE_MODEL := MX4200 + $(call Device/linksys_mx4200v1) DEVICE_VARIANT := v2 - DEVICE_PACKAGES += kmod-bluetooth kmod-leds-st1202 endef TARGET_DEVICES += linksys_mx4200v2 @@ -199,7 +198,6 @@ define Device/linksys_mx4300 KERNEL_SIZE := 8192k IMAGE_SIZE := 171264k NAND_SIZE := 1024m - DEVICE_PACKAGES += kmod-leds-pca963x endef TARGET_DEVICES += linksys_mx4300 @@ -207,7 +205,7 @@ define Device/linksys_mx5300 $(call Device/linksys_mx) DEVICE_MODEL := MX5300 DEVICE_PACKAGES += kmod-rtc-ds1307 ipq-wifi-linksys_mx5300 \ - kmod-ath10k-ct ath10k-firmware-qca9984-ct kmod-leds-pca963x + kmod-ath10k-ct ath10k-firmware-qca9984-ct endef TARGET_DEVICES += linksys_mx5300 @@ -215,7 +213,7 @@ define Device/linksys_mx8500 $(call Device/linksys_mx) DEVICE_MODEL := MX8500 DEVICE_PACKAGES += ipq-wifi-linksys_mx8500 kmod-ath11k-pci \ - ath11k-firmware-qcn9074 kmod-bluetooth kmod-leds-pca963x + ath11k-firmware-qcn9074 kmod-bluetooth endef TARGET_DEVICES += linksys_mx8500 From 916af73fc388d638b1a717a2411792e0680dd8e6 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Fri, 3 Jan 2025 21:46:13 +0100 Subject: [PATCH 39/43] 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 --- ...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 00000000000..dcac5be58b3 --- /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 381f6624cfb5a1beb763cb09967cb931bcd98427 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sat, 4 Jan 2025 15:59:57 +0800 Subject: [PATCH 40/43] ppp: update to 2.5.2 This is a minor upgrade that mainly fixes some compilation errors and remove old unused code. The Makefile has been reorganized. Now all package make parameters are passed as configure arguments instead of environment variables. The compilation dependencies remain the same as ppp v2.5.1 and the package size changes are negligible. Change log: https://github.com/ppp-project/ppp/blob/v2.5.2/README#L70 Upstreamed patches: 101-pppd-crypto-fix-build-without-openssl.patch [1] 102-pppd-make-pid-directory-before-create-the-pid-file.patch [2] 103-pppd-crypto-fix-gcc-14-build.patch [3] [1] https://github.com/ppp-project/ppp/commit/5f6eabdb6666d914e0f8feb3facfa591dee75a1f [2] https://github.com/ppp-project/ppp/commit/734bc0438e78b7c7cd34acfce3a4ec119d9a50b6 [3] https://github.com/ppp-project/ppp/commit/ac269dbf7c142371cd975c775c6171707ac4dde8 Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17477 Signed-off-by: Nick Hainke --- package/network/services/ppp/Makefile | 37 ++++++++------- ...ppd-crypto-fix-build-without-openssl.patch | 45 ------------------- ...directory-before-create-the-pid-file.patch | 27 ----------- .../103-pppd-crypto-fix-gcc-14-build.patch | 42 ----------------- .../ppp/patches/105-debian_demand.patch | 10 ++--- .../ppp/patches/204-radius_config.patch | 4 +- .../ppp/patches/208-fix_status_code.patch | 4 +- .../ppp/patches/310-precompile_filter.patch | 4 +- ...multilink_support_custom_iface_names.patch | 12 ++--- .../340-populate_default_gateway.patch | 4 +- .../patches/400-simplify_kernel_checks.patch | 24 +++++----- .../ppp/patches/401-no_record_file.patch | 6 +-- .../404-remove_obsolete_protocol_names.patch | 16 +++---- .../ppp/patches/500-add-pptp-plugin.patch | 4 +- 14 files changed, 65 insertions(+), 174 deletions(-) delete mode 100644 package/network/services/ppp/patches/101-pppd-crypto-fix-build-without-openssl.patch delete mode 100644 package/network/services/ppp/patches/102-pppd-make-pid-directory-before-create-the-pid-file.patch delete mode 100644 package/network/services/ppp/patches/103-pppd-crypto-fix-gcc-14-build.patch diff --git a/package/network/services/ppp/Makefile b/package/network/services/ppp/Makefile index 760a31dc0d0..ceb32c39780 100644 --- a/package/network/services/ppp/Makefile +++ b/package/network/services/ppp/Makefile @@ -9,14 +9,14 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=ppp -PKG_VERSION:=2.5.1 +PKG_VERSION:=2.5.2 PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/ppp-project/ppp -PKG_SOURCE_DATE:=2024-09-18 -PKG_SOURCE_VERSION:=d5aeec65752d4a9b3bb46771d0b221c4a4a6539e -PKG_MIRROR_HASH:=b98125933d8160ff3476b053414e787e65a94948c0ecee53f6261cd403ff4b03 +PKG_SOURCE_DATE:=2024-12-31 +PKG_SOURCE_VERSION:=9f612dc02c34509f062ed63b60bcc7e937e25178 +PKG_MIRROR_HASH:=677b71d23b668db986146e13b0c651f2ac506eb4fb244ffba1ff406cbae3511b PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=BSD-4-Clause @@ -30,17 +30,22 @@ PKG_FIXUP:=autoreconf PKG_INSTALL:=1 include $(INCLUDE_DIR)/package.mk -CONFIGURE_VARS += \ - enable_eaptls=no \ - enable_microsoft_extensions=yes \ - enable_peap=no - CONFIGURE_ARGS += \ - with_openssl=no \ - with_pam=no \ - with_pcap=no \ - with_srp=no \ - with_static_pcap=yes + --disable-cbcp \ + --disable-eaptls \ + --disable-mslanman \ + --disable-openssl-engine \ + --disable-peap \ + --disable-systemd \ + --enable-ipv6cp \ + --enable-microsoft-extensions \ + --enable-plugins \ + --with-atm \ + --with-static-pcap \ + --without-openssl \ + --without-pam \ + --without-pcap \ + --without-srp define Package/ppp/Default SECTION:=net @@ -185,8 +190,8 @@ not initiate a session. Can be useful to debug pppoe. endef ifeq ($(BUILD_VARIANT),multilink) - CONFIGURE_VARS += \ - enable_multilink=yes + CONFIGURE_ARGS += \ + --enable-multilink endif define Build/InstallDev diff --git a/package/network/services/ppp/patches/101-pppd-crypto-fix-build-without-openssl.patch b/package/network/services/ppp/patches/101-pppd-crypto-fix-build-without-openssl.patch deleted file mode 100644 index eb243694ec7..00000000000 --- a/package/network/services/ppp/patches/101-pppd-crypto-fix-build-without-openssl.patch +++ /dev/null @@ -1,45 +0,0 @@ -From: Shiji Yang -Date: Fri, 4 Oct 2024 12:19:42 +0000 -Subject: [PATCH] pppd/crypto: fix build without openssl - -Compile openssl relevant code only when PPP_WITH_OPENSSL is defined. - -Signed-off-by: Shiji Yang ---- - pppd/crypto.c | 4 ++++ - 1 file changed, 4 insertions(+) - ---- a/pppd/crypto.c -+++ b/pppd/crypto.c -@@ -199,6 +199,7 @@ int PPP_crypto_init() - { - int retval = 0; - -+#ifdef PPP_WITH_OPENSSL - #if OPENSSL_VERSION_NUMBER >= 0x30000000L - g_crypto_ctx.legacy = OSSL_PROVIDER_load(NULL, "legacy"); - if (g_crypto_ctx.legacy == NULL) -@@ -214,6 +215,7 @@ int PPP_crypto_init() - goto done; - } - #endif -+#endif - - retval = 1; - -@@ -224,6 +226,7 @@ done: - - int PPP_crypto_deinit() - { -+#ifdef PPP_WITH_OPENSSL - #if OPENSSL_VERSION_NUMBER >= 0x30000000L - if (g_crypto_ctx.legacy) { - OSSL_PROVIDER_unload(g_crypto_ctx.legacy); -@@ -239,6 +242,7 @@ int PPP_crypto_deinit() - #if OPENSSL_VERSION_NUMBER < 0x10100000L - ERR_free_strings(); - #endif -+#endif - return 1; - } - diff --git a/package/network/services/ppp/patches/102-pppd-make-pid-directory-before-create-the-pid-file.patch b/package/network/services/ppp/patches/102-pppd-make-pid-directory-before-create-the-pid-file.patch deleted file mode 100644 index 69e68cdff40..00000000000 --- a/package/network/services/ppp/patches/102-pppd-make-pid-directory-before-create-the-pid-file.patch +++ /dev/null @@ -1,27 +0,0 @@ -From: Shiji Yang -Date: Fri, 4 Oct 2024 14:02:14 +0000 -Subject: [PATCH] pppd: make pid directory before create the pid file - -If multilink feature is not enabled, the '/var/run/pppd' directory -won't be created before adding pid file. - -Fixes error message: -'Failed to create pid file /var/run/pppd/pppoe-wan.pid: No such file or directory' - -Signed-off-by: Shiji Yang ---- - pppd/main.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/pppd/main.c -+++ b/pppd/main.c -@@ -921,6 +921,9 @@ create_pidfile(int pid) - { - FILE *pidfile; - -+#ifndef PPP_WITH_TDB -+ mkdir_recursive(PPP_PATH_VARRUN); -+#endif - slprintf(pidfilename, sizeof(pidfilename), "%s/%s.pid", - PPP_PATH_VARRUN, ifname); - if ((pidfile = fopen(pidfilename, "w")) != NULL) { diff --git a/package/network/services/ppp/patches/103-pppd-crypto-fix-gcc-14-build.patch b/package/network/services/ppp/patches/103-pppd-crypto-fix-gcc-14-build.patch deleted file mode 100644 index 3a76deb0427..00000000000 --- a/package/network/services/ppp/patches/103-pppd-crypto-fix-gcc-14-build.patch +++ /dev/null @@ -1,42 +0,0 @@ -From: Tan Zien -Date: Tue, 1 Oct 2024 10:38:45 +0800 -Subject: [PATCH] pppd/crypto: fix gcc 14 build - -fix this: - -crypto.c: In function 'PPP_crypto_error': -crypto.c:178:11: error: implicit declaration of function 'vsnprintf' [-Wimplicit-function-declaration] - 178 | off = vsnprintf(buf, len, fmt, args); - | ^~~~~~~~~ -crypto.c:41:1: note: include '' or provide a declaration of 'vsnprintf' - 40 | #include "crypto-priv.h" - +++ |+#include - 41 | -crypto.c:178:26: warning: 'vsnprintf' argument 2 type is 'int' where 'long unsigned int' is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch] - 178 | off = vsnprintf(buf, len, fmt, args); - | ^~~ -: note: built-in 'vsnprintf' declared here - -Signed-off-by: Tan Zien ---- - pppd/crypto.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/pppd/crypto.c -+++ b/pppd/crypto.c -@@ -34,6 +34,7 @@ - - #include - #include -+#include - - #include "pppd.h" - #include "crypto.h" -@@ -247,7 +248,6 @@ int PPP_crypto_deinit() - } - - #ifdef UNIT_TEST --#include - - int debug; - int error_count; diff --git a/package/network/services/ppp/patches/105-debian_demand.patch b/package/network/services/ppp/patches/105-debian_demand.patch index 10ce13b2535..25f1644aa4b 100644 --- a/package/network/services/ppp/patches/105-debian_demand.patch +++ b/package/network/services/ppp/patches/105-debian_demand.patch @@ -1,6 +1,6 @@ --- a/pppd/demand.c +++ b/pppd/demand.c -@@ -40,6 +40,8 @@ +@@ -34,6 +34,8 @@ #include #include #include @@ -9,7 +9,7 @@ #include #include #include -@@ -47,6 +49,8 @@ +@@ -41,6 +43,8 @@ #include #include #include @@ -18,7 +18,7 @@ #ifdef PPP_WITH_FILTER #include #endif -@@ -223,6 +227,14 @@ loop_chars(unsigned char *p, int n) +@@ -217,6 +221,14 @@ loop_chars(unsigned char *p, int n) int c, rv; rv = 0; @@ -33,7 +33,7 @@ for (; n > 0; --n) { c = *p++; if (c == PPP_FLAG) { -@@ -299,16 +311,100 @@ loop_frame(unsigned char *frame, int len +@@ -293,16 +305,100 @@ loop_frame(unsigned char *frame, int len * loopback, now that the real serial link is up. */ void @@ -159,7 +159,7 @@ } else { --- a/pppd/pppd-private.h +++ b/pppd/pppd-private.h -@@ -368,7 +368,7 @@ void demand_conf(void); /* config interf +@@ -370,7 +370,7 @@ void demand_conf(void); /* config interf void demand_block(void); /* set all NPs to queue up packets */ void demand_unblock(void); /* set all NPs to pass packets */ void demand_discard(void); /* set all NPs to discard packets */ diff --git a/package/network/services/ppp/patches/204-radius_config.patch b/package/network/services/ppp/patches/204-radius_config.patch index 3f6db59b710..1f5fdffa956 100644 --- a/package/network/services/ppp/patches/204-radius_config.patch +++ b/package/network/services/ppp/patches/204-radius_config.patch @@ -1,6 +1,6 @@ --- a/pppd/plugins/radius/config.c +++ b/pppd/plugins/radius/config.c -@@ -381,31 +381,37 @@ static int test_config(char *filename) +@@ -379,31 +379,37 @@ static int test_config(char *filename) } #endif @@ -40,7 +40,7 @@ } --- a/pppd/plugins/radius/options.h +++ b/pppd/plugins/radius/options.h -@@ -31,24 +31,21 @@ typedef struct _option { +@@ -29,24 +29,21 @@ typedef struct _option { static SERVER acctserver = {0}; static SERVER authserver = {0}; diff --git a/package/network/services/ppp/patches/208-fix_status_code.patch b/package/network/services/ppp/patches/208-fix_status_code.patch index 10cd9453742..2d1e02742e3 100644 --- a/package/network/services/ppp/patches/208-fix_status_code.patch +++ b/package/network/services/ppp/patches/208-fix_status_code.patch @@ -12,13 +12,13 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/main.c +++ b/pppd/main.c -@@ -1152,7 +1152,8 @@ get_input(void) +@@ -1150,7 +1150,8 @@ get_input(void) } notice("Modem hangup"); hungup = 1; - code = EXIT_HANGUP; + if (code == EXIT_OK) + code = EXIT_HANGUP; + need_holdoff = 0; lcp_lowerdown(0); /* serial link is no longer available */ link_terminated(0); - return; diff --git a/package/network/services/ppp/patches/310-precompile_filter.patch b/package/network/services/ppp/patches/310-precompile_filter.patch index ad0dd03de8e..6a6d2769796 100644 --- a/package/network/services/ppp/patches/310-precompile_filter.patch +++ b/package/network/services/ppp/patches/310-precompile_filter.patch @@ -23,7 +23,7 @@ Signed-off-by: Jo-Philipp Wich # # SunOS provides a version of libpcap that would work, but SunOS has no support for activity filter AM_CONDITIONAL([PPP_WITH_FILTER], [ test "x${with_pcap}" = "xyes" && test "x${build_sunos}" != "xyes" ]) -@@ -359,6 +362,7 @@ $PACKAGE_NAME version $PACKAGE_VERSION +@@ -348,6 +351,7 @@ $PACKAGE_NAME version $PACKAGE_VERSION With libatm..........: ${with_atm:-no} With libpam..........: ${with_pam:-no} With libpcap.........: ${with_pcap:-no} @@ -33,7 +33,7 @@ Signed-off-by: Jo-Philipp Wich Linker...............: $LD $LDFLAGS $LIBS --- a/pppd/Makefile.am +++ b/pppd/Makefile.am -@@ -138,6 +138,12 @@ pppd_LDFLAGS += $(PCAP_LDFLAGS) +@@ -137,6 +137,12 @@ pppd_LDFLAGS += $(PCAP_LDFLAGS) pppd_LIBS += $(PCAP_LIBS) endif diff --git a/package/network/services/ppp/patches/321-multilink_support_custom_iface_names.patch b/package/network/services/ppp/patches/321-multilink_support_custom_iface_names.patch index a761ca650d6..2070ab7d091 100644 --- a/package/network/services/ppp/patches/321-multilink_support_custom_iface_names.patch +++ b/package/network/services/ppp/patches/321-multilink_support_custom_iface_names.patch @@ -8,7 +8,7 @@ Signed-off-by: George Kashperko 2 files changed, 53 insertions(+), 14 deletions(-) --- a/pppd/multilink.c +++ b/pppd/multilink.c -@@ -40,6 +40,7 @@ +@@ -36,6 +36,7 @@ #include #include #include @@ -16,7 +16,7 @@ Signed-off-by: George Kashperko #include "pppd-private.h" #include "fsm.h" -@@ -62,7 +63,8 @@ static void iterate_bundle_links(void (* +@@ -58,7 +59,8 @@ static void iterate_bundle_links(void (* static int get_default_epdisc(struct epdisc *); static int parse_num(char *str, const char *key, int *valp); @@ -26,7 +26,7 @@ Signed-off-by: George Kashperko #define set_ip_epdisc(ep, addr) do { \ ep->length = 4; \ -@@ -215,35 +217,38 @@ mp_join_bundle(void) +@@ -211,35 +213,38 @@ mp_join_bundle(void) key.dptr = bundle_id; key.dsize = p - bundle_id; pid = tdb_fetch(pppdb, key); @@ -73,7 +73,7 @@ Signed-off-by: George Kashperko } /* we have to make a new bundle */ -@@ -423,20 +428,39 @@ parse_num(char *str, const char *key, in +@@ -419,20 +424,39 @@ parse_num(char *str, const char *key, in return 0; } @@ -119,7 +119,7 @@ Signed-off-by: George Kashperko && memcmp(vd.dptr, key.dptr, vd.dsize) == 0; --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c -@@ -984,6 +984,16 @@ void cfg_bundle(int mrru, int mtru, int +@@ -980,6 +980,16 @@ void cfg_bundle(int mrru, int mtru, int add_fd(ppp_dev_fd); } @@ -136,7 +136,7 @@ Signed-off-by: George Kashperko /* * make_new_bundle - create a new PPP unit (i.e. a bundle) * and connect our channel to it. This should only get called -@@ -1002,6 +1012,8 @@ void make_new_bundle(int mrru, int mtru, +@@ -998,6 +1008,8 @@ void make_new_bundle(int mrru, int mtru, /* set the mrru and flags */ cfg_bundle(mrru, mtru, rssn, tssn); diff --git a/package/network/services/ppp/patches/340-populate_default_gateway.patch b/package/network/services/ppp/patches/340-populate_default_gateway.patch index f3279713469..7d20f0449d7 100644 --- a/package/network/services/ppp/patches/340-populate_default_gateway.patch +++ b/package/network/services/ppp/patches/340-populate_default_gateway.patch @@ -13,7 +13,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c -@@ -2251,6 +2251,9 @@ int sifdefaultroute (int unit, u_int32_t +@@ -2247,6 +2247,9 @@ int sifdefaultroute (int unit, u_int32_t memset (&rt, 0, sizeof (rt)); SET_SA_FAMILY (rt.rt_dst, AF_INET); @@ -23,7 +23,7 @@ Signed-off-by: Jo-Philipp Wich rt.rt_dev = ifname; rt.rt_metric = dfl_route_metric + 1; /* +1 for binary compatibility */ -@@ -2259,7 +2262,7 @@ int sifdefaultroute (int unit, u_int32_t +@@ -2255,7 +2258,7 @@ int sifdefaultroute (int unit, u_int32_t SIN_ADDR(rt.rt_genmask) = 0L; } 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 311bb8752f9..014831a3a42 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,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c -@@ -224,14 +224,10 @@ static fd_set in_fds; /* set of fds tha +@@ -220,14 +220,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; @@ -26,7 +26,7 @@ Signed-off-by: Jo-Philipp Wich static char loop_name[20]; static unsigned char inbuf[512]; /* buffer for chars read from loopback */ -@@ -249,9 +245,8 @@ static int dynaddr_set; /* 1 if ip_dyna +@@ -245,9 +241,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) */ @@ -37,7 +37,7 @@ Signed-off-by: Jo-Philipp Wich #define MAX_IFS 100 -@@ -1970,11 +1965,12 @@ int ccp_fatal_error (int unit) +@@ -1966,11 +1961,12 @@ int ccp_fatal_error (int unit) * * path_to_procfs - find the path to the proc file system mount point */ @@ -52,7 +52,7 @@ Signed-off-by: Jo-Philipp Wich struct mntent *mntent; FILE *fp; -@@ -1996,6 +1992,7 @@ static char *path_to_procfs(const char * +@@ -1992,6 +1988,7 @@ static char *path_to_procfs(const char * fclose (fp); } } @@ -60,7 +60,7 @@ Signed-off-by: Jo-Philipp Wich strlcpy(proc_path + proc_path_len, tail, sizeof(proc_path) - proc_path_len); -@@ -2889,6 +2886,8 @@ ppp_registered(void) +@@ -2883,6 +2880,8 @@ ppp_registered(void) int ppp_check_kernel_support(void) { @@ -69,7 +69,7 @@ Signed-off-by: Jo-Philipp Wich int s, ok, fd; struct ifreq ifr; int size; -@@ -3016,6 +3015,7 @@ int ppp_check_kernel_support(void) +@@ -3010,6 +3009,7 @@ int ppp_check_kernel_support(void) } close(s); return ok; @@ -77,7 +77,7 @@ Signed-off-by: Jo-Philipp Wich } #ifndef HAVE_LOGWTMP -@@ -3577,6 +3577,7 @@ get_pty(int *master_fdp, int *slave_fdp, +@@ -3571,6 +3571,7 @@ get_pty(int *master_fdp, int *slave_fdp, } #endif /* TIOCGPTN */ @@ -85,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 +3602,7 @@ get_pty(int *master_fdp, int *slave_fdp, +@@ -3595,6 +3596,7 @@ get_pty(int *master_fdp, int *slave_fdp, } } } @@ -93,7 +93,7 @@ Signed-off-by: Jo-Philipp Wich if (sfd < 0) return 0; -@@ -3716,6 +3718,7 @@ get_host_seed(void) +@@ -3710,6 +3712,7 @@ get_host_seed(void) int sys_check_options(void) { @@ -101,7 +101,7 @@ Signed-off-by: Jo-Philipp Wich 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) +@@ -3720,6 +3723,7 @@ sys_check_options(void) warn("Warning: multilink is not supported by the kernel driver"); multilink = 0; } @@ -124,7 +124,7 @@ Signed-off-by: Jo-Philipp Wich #endif --- a/pppd/plugins/pppoe/plugin.c +++ b/pppd/plugins/pppoe/plugin.c -@@ -57,9 +57,6 @@ static char const RCSID[] = +@@ -54,9 +54,6 @@ char pppd_version[] = PPPD_VERSION; @@ -134,7 +134,7 @@ Signed-off-by: Jo-Philipp Wich char *pppd_pppoe_service = NULL; static char *acName = NULL; static char *existingSession = NULL; -@@ -421,10 +418,6 @@ PPPoEDevnameHook(char *cmd, char **argv, +@@ -418,10 +415,6 @@ PPPoEDevnameHook(char *cmd, char **argv, void plugin_init(void) { diff --git a/package/network/services/ppp/patches/401-no_record_file.patch b/package/network/services/ppp/patches/401-no_record_file.patch index 5ef1a178d70..436bfb5f5ea 100644 --- a/package/network/services/ppp/patches/401-no_record_file.patch +++ b/package/network/services/ppp/patches/401-no_record_file.patch @@ -7,7 +7,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/pppd-private.h +++ b/pppd/pppd-private.h -@@ -187,7 +187,6 @@ extern int holdoff; /* Dead time before +@@ -189,7 +189,6 @@ extern int holdoff; /* Dead time before extern bool holdoff_specified; /* true if user gave a holdoff value */ extern bool notty; /* Stdin/out is not a tty */ extern char *pty_socket; /* Socket to connect to pty */ @@ -17,7 +17,7 @@ Signed-off-by: Jo-Philipp Wich extern bool tune_kernel; /* May alter kernel settings as necessary */ --- a/pppd/tty.c +++ b/pppd/tty.c -@@ -150,7 +150,7 @@ char *disconnect_script = NULL; /* Scrip +@@ -146,7 +146,7 @@ char *disconnect_script = NULL; /* Scrip char *welcomer = NULL; /* Script to run after phys link estab. */ char *ptycommand = NULL; /* Command to run on other side of pty */ bool notty = 0; /* Stdin/out is not a tty */ @@ -26,7 +26,7 @@ Signed-off-by: Jo-Philipp Wich int max_data_rate; /* max bytes/sec through charshunt */ bool sync_serial = 0; /* Device is synchronous serial device */ char *pty_socket = NULL; /* Socket to connect to pty */ -@@ -206,8 +206,10 @@ static struct option tty_options[] = { +@@ -202,8 +202,10 @@ static struct option tty_options[] = { "Send and receive over socket, arg is host:port", OPT_PRIO | OPT_DEVNAM }, diff --git a/package/network/services/ppp/patches/404-remove_obsolete_protocol_names.patch b/package/network/services/ppp/patches/404-remove_obsolete_protocol_names.patch index 6b2d15ed256..5738118c5f7 100644 --- a/package/network/services/ppp/patches/404-remove_obsolete_protocol_names.patch +++ b/package/network/services/ppp/patches/404-remove_obsolete_protocol_names.patch @@ -7,7 +7,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/main.c +++ b/pppd/main.c -@@ -984,14 +984,17 @@ struct protocol_list { +@@ -982,14 +982,17 @@ struct protocol_list { const char *name; } protocol_list[] = { { 0x21, "IP" }, @@ -25,7 +25,7 @@ Signed-off-by: Jo-Philipp Wich { 0x33, "Stream Protocol ST-II" }, { 0x35, "Banyan Vines" }, { 0x39, "AppleTalk EDDP" }, -@@ -1005,8 +1008,11 @@ struct protocol_list { +@@ -1003,8 +1006,11 @@ struct protocol_list { { 0x49, "Serial Data Transport Protocol (PPP-SDTP)" }, { 0x4b, "SNA over 802.2" }, { 0x4d, "SNA" }, @@ -37,7 +37,7 @@ Signed-off-by: Jo-Philipp Wich { 0x53, "Encryption" }, { 0x55, "Individual Link Encryption" }, { 0x57, "IPv6" }, -@@ -1017,12 +1023,15 @@ struct protocol_list { +@@ -1015,12 +1021,15 @@ struct protocol_list { { 0x65, "RTP IPHC Compressed non-TCP" }, { 0x67, "RTP IPHC Compressed UDP 8" }, { 0x69, "RTP IPHC Compressed RTP 8" }, @@ -53,7 +53,7 @@ Signed-off-by: Jo-Philipp Wich { 0x0203, "IBM Source Routing BPDU" }, { 0x0205, "DEC LANBridge100 Spanning Tree" }, { 0x0207, "Cisco Discovery Protocol" }, -@@ -1034,15 +1043,19 @@ struct protocol_list { +@@ -1032,15 +1041,19 @@ struct protocol_list { { 0x0231, "Luxcom" }, { 0x0233, "Sigma Network Systems" }, { 0x0235, "Apple Client Server Protocol" }, @@ -73,7 +73,7 @@ Signed-off-by: Jo-Philipp Wich { 0x4001, "Cray Communications Control Protocol" }, { 0x4003, "CDPD Mobile Network Registration Protocol" }, { 0x4005, "Expand accelerator protocol" }, -@@ -1053,8 +1066,10 @@ struct protocol_list { +@@ -1051,8 +1064,10 @@ struct protocol_list { { 0x4023, "RefTek Protocol" }, { 0x4025, "Fibre Channel" }, { 0x4027, "EMIT Protocols" }, @@ -84,7 +84,7 @@ Signed-off-by: Jo-Philipp Wich { 0x8023, "OSI Network Layer Control Protocol" }, { 0x8025, "Xerox NS IDP Control Protocol" }, { 0x8027, "DECnet Phase IV Control Protocol" }, -@@ -1063,7 +1078,9 @@ struct protocol_list { +@@ -1061,7 +1076,9 @@ struct protocol_list { { 0x8031, "Bridging NCP" }, { 0x8033, "Stream Protocol Control Protocol" }, { 0x8035, "Banyan Vines Control Protocol" }, @@ -94,7 +94,7 @@ Signed-off-by: Jo-Philipp Wich { 0x803f, "NETBIOS Framing Control Protocol" }, { 0x8041, "Cisco Systems Control Protocol" }, { 0x8043, "Ascom Timeplex" }, -@@ -1072,18 +1089,24 @@ struct protocol_list { +@@ -1070,18 +1087,24 @@ struct protocol_list { { 0x8049, "Serial Data Control Protocol (PPP-SDCP)" }, { 0x804b, "SNA over 802.2 Control Protocol" }, { 0x804d, "SNA Control Protocol" }, @@ -119,7 +119,7 @@ Signed-off-by: Jo-Philipp Wich { 0x8207, "Cisco Discovery Protocol Control" }, { 0x8209, "Netcs Twin Routing" }, { 0x820b, "STP - Control Protocol" }, -@@ -1092,24 +1115,29 @@ struct protocol_list { +@@ -1090,24 +1113,29 @@ struct protocol_list { { 0x8281, "MPLSCP" }, { 0x8285, "IEEE p1284.4 standard - Protocol Control" }, { 0x8287, "ETSI TETRA TNP1 Control Protocol" }, diff --git a/package/network/services/ppp/patches/500-add-pptp-plugin.patch b/package/network/services/ppp/patches/500-add-pptp-plugin.patch index 4b66cd21657..38b0c825065 100644 --- a/package/network/services/ppp/patches/500-add-pptp-plugin.patch +++ b/package/network/services/ppp/patches/500-add-pptp-plugin.patch @@ -1,6 +1,6 @@ --- a/configure.ac +++ b/configure.ac -@@ -344,6 +344,7 @@ AC_CONFIG_FILES([ +@@ -333,6 +333,7 @@ AC_CONFIG_FILES([ pppd/plugins/pppoatm/Makefile pppd/plugins/pppol2tp/Makefile pppd/plugins/radius/Makefile @@ -10,7 +10,7 @@ scripts/Makefile --- a/pppd/plugins/Makefile.am +++ b/pppd/plugins/Makefile.am -@@ -21,5 +21,5 @@ winbind_la_LDFLAGS = $(PLUGIN_LDFLAGS) +@@ -17,5 +17,5 @@ winbind_la_LDFLAGS = $(PLUGIN_LDFLAGS) winbind_la_SOURCES = winbind.c if !SUNOS From 3ec7f3a512a27f8ca6402954ad2a997176103b4b Mon Sep 17 00:00:00 2001 From: David Bauer Date: Sun, 22 Dec 2024 02:56:12 +0100 Subject: [PATCH 41/43] 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 --- .../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 9e9922e0b35..52c36a8c926 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 @@ -849,6 +849,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 @@ -859,6 +864,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 d836a930fc4..166e9403dfc 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 d09dd75fbd1314ec5f3571511195da4012d7a51a Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 31 Dec 2024 12:23:53 +0100 Subject: [PATCH 42/43] 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 --- .../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 c117a905388..6d1babf00e9 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 f2e2ed3f7f6..83b4addb796 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 b061428bb34..f2690a095d9 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 8d09bfd0b7a..469a6ca7576 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 df5d9331a1e..69164540cd4 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 e80a5402445..6cace3b88f0 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 f343bea725b..049b3a5ba3a 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 ca064837c86..a13fc719873 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 bcb3b24232c..0d7d8883fc3 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 d8b4300a520..4293191b075 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 bb197c27427..4ed8a82af6f 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 07ad4d3d520..d91725dfb7b 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 9828b4b34ef..fcacb98cb9b 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 293bf3d20a0..5deb9ba3de2 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 bf2fc0e37e2..c19262497d7 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 957ccb306c7..2b79169c0df 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 a353c7f9f3d..8040bb494b1 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 e58b3378d57..946b3b3038f 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 ea2102f7d6a..56d920a6dde 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 23e9457f029..d434145278c 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 8515f3c0347..982ceef044e 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 2b357a1f033..f8b458f9f79 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 1f26db58690..fe6e8626ea8 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 dd56cb215e8..990eb70daae 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 fc5a7a94aa3..7c8e81de330 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 d8249236f04..79242a42e43 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 3569d6e53ab..3346fc8098f 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 243d19fb033..00fc918ccfc 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 e065ef01680..c2c602114f8 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 4f6cafb8853..39905d4342d 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 106c8031e31..e60cd42778d 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 e8daef63f14..f720be6d03b 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 89ba523e57d..33400170c85 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 94be4d976e2..d792599f1a2 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 b1a04012fb2..881abc23dbe 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 4a3a323b5ff..bd7f1b5cb98 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 4e5497cbc30..09d9a8f3ddf 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 a5b55ff421f..b042329bc7b 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 7ec3c6a9ae7..e3a5ad7be5c 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 7c0260ec3c5..3eaa75b520b 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 a4606dd21cb..80a729e9632 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 06d65b89441..91cf49b1b00 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 f5a985b6d16..f03717be330 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 e115c211aab..4bef4994990 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 f87ab074162..f4c64d6b061 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 0463c61236e..5ebbaa90ade 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 3cd8997a925..48b2e43d18e 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 7a13241b661..593b3959fc1 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 54e3cc7818c..cb12381022c 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 644329419d9..887762bd232 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 f2e39c87aef..c6113e7aab0 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 ab985dfce16..c892bf0c5be 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 0673dc02416..3bcc5c3cec2 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 517d691d105..fd7878b47a0 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 62270272662..1cb1b9d5dd9 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 7f8f9be7956..520ccdfd1cc 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 dfb639e2bbb..2aea68d5205 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 8286e1899f8..9d2f7ce1bc2 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 48e0bb903e5..533ff388a9f 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 9e1dfa5c1d7..254de0a46d1 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 a549f034074..d432b2ec2d6 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 285bdd29cb55900a2009e26303ab5abb66e165e9 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Mon, 6 Jan 2025 19:12:18 +0100 Subject: [PATCH 43/43] uboot-envtools: ipq60xx: remove number of blocks It is not required to specify the number of blocks as envtools are able to autodetect it. Link: https://github.com/openwrt/openwrt/pull/17504 Signed-off-by: Robert Marko --- package/boot/uboot-envtools/files/qualcommax_ipq60xx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/boot/uboot-envtools/files/qualcommax_ipq60xx b/package/boot/uboot-envtools/files/qualcommax_ipq60xx index ccc74e2df6e..eec99ce8f97 100644 --- a/package/boot/uboot-envtools/files/qualcommax_ipq60xx +++ b/package/boot/uboot-envtools/files/qualcommax_ipq60xx @@ -18,12 +18,12 @@ cambiumnetworks,xe3-4) linksys,mr7350) idx="$(find_mtd_index u_env)" [ -n "$idx" ] && \ - ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" "2" + ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" ;; netgear,wax214) idx="$(find_mtd_index 0:appsblenv)" [ -n "$idx" ] && \ - ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" "2" + ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" ;; yuncore,fap650) idx="$(find_mtd_index 0:appsblenv)"