[][kernel-6.6][mt7987][eth][Refactor the SGMII PCS clock source change from PHYA for the NETSYSv3.1]
[Description]
Refactor the SGMII PCS clock source change from PHYA for the NETSYSv3.1.
Without this patch, the users may encounter a no traffic issue on the
MT7987.
[Release-log]
N/A
Change-Id: Id4d39b4fa620c27b048ff588f05dd4720158981d
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/10620122
diff --git a/autobuild/unified/filogic/24.10/files/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7987.dtsi b/autobuild/unified/filogic/24.10/files/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7987.dtsi
index 6740a42..df8a502 100644
--- a/autobuild/unified/filogic/24.10/files/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7987.dtsi
+++ b/autobuild/unified/filogic/24.10/files/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7987.dtsi
@@ -15,6 +15,10 @@
#include <dt-bindings/reset/mediatek,mt7987-resets.h>
#include <dt-bindings/regulator/richtek,rt5190a-regulator.h>
+/* TOPRGU resets */
+#define MT7987_TOPRGU_SGMII0_GRST 1
+#define MT7987_TOPRGU_SGMII1_GRST 2
+
/ {
compatible = "mediatek,mt7987";
interrupt-parent = <&gic>;
@@ -169,6 +173,7 @@
"syscon",
"simple-mfd";
reg = <0 0x10060000 0 0x1000>;
+ resets = <&watchdog MT7987_TOPRGU_SGMII0_GRST>;
mediatek,phya_trx_ck;
#clock-cells = <1>;
@@ -187,6 +192,7 @@
"syscon",
"simple-mfd";
reg = <0 0x10070000 0 0x1000>;
+ resets = <&watchdog MT7987_TOPRGU_SGMII1_GRST>;
mediatek,phya_trx_ck;
#clock-cells = <1>;
@@ -366,13 +372,13 @@
};
watchdog: watchdog@1001c000 {
- compatible = "mediatek,mt7622-wdt",
+ compatible = "mediatek,mt7987-wdt",
+ "mediatek,mt7988-wdt",
"mediatek,mt6589-wdt",
"syscon";
reg = <0 0x1001c000 0 0x1000>;
interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
#reset-cells = <1>;
- status = "disabled";
};
pio: pinctrl@1001f000 {
diff --git a/autobuild/unified/filogic/24.10/files/target/linux/mediatek/patches-6.6/999-2604-net-pcs-mtk_lynxi-add-mt7987-support.patch b/autobuild/unified/filogic/24.10/files/target/linux/mediatek/patches-6.6/999-2604-net-pcs-mtk_lynxi-add-mt7987-support.patch
index cad0ed7..60e1984 100644
--- a/autobuild/unified/filogic/24.10/files/target/linux/mediatek/patches-6.6/999-2604-net-pcs-mtk_lynxi-add-mt7987-support.patch
+++ b/autobuild/unified/filogic/24.10/files/target/linux/mediatek/patches-6.6/999-2604-net-pcs-mtk_lynxi-add-mt7987-support.patch
@@ -1,27 +1,34 @@
-From 4428f602e4d75e7aa41d1190ab31be6199c2ac9e Mon Sep 17 00:00:00 2001
+From 6e9ec5ade644eeb136c6b827d72fac80bf2c3817 Mon Sep 17 00:00:00 2001
From: Bo-Cun Chen <bc-bocun.chen@mediatek.com>
-Date: Tue, 8 Apr 2025 12:44:02 +0800
+Date: Fri, 9 May 2025 13:22:14 +0800
Subject: [PATCH] net: pcs: mtk_lynxi add mt7987 support
Signed-off-by: Bo-Cun Chen <bc-bocun.chen@mediatek.com>
---
- drivers/net/pcs/pcs-mtk-lynxi.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
+ drivers/net/pcs/pcs-mtk-lynxi.c | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/net/pcs/pcs-mtk-lynxi.c b/drivers/net/pcs/pcs-mtk-lynxi.c
-index f5259d4..48fc5a1 100644
+index 674befb..c40f031 100644
--- a/drivers/net/pcs/pcs-mtk-lynxi.c
+++ b/drivers/net/pcs/pcs-mtk-lynxi.c
-@@ -449,7 +449,7 @@ static int mtk_pcs_lynxi_probe(struct platform_device *pdev)
+@@ -488,9 +488,12 @@ static int mtk_pcs_lynxi_probe(struct platform_device *pdev)
+ if (of_property_read_bool(np->parent, "mediatek,phya_trx_ck"))
+ flags |= MTK_SGMII_FLAG_PHYA_TRX_CK;
- mpcs->rstc = of_reset_control_get_shared(np->parent, NULL);
- if (IS_ERR(mpcs->rstc))
+- mpcs->rstc = of_reset_control_get_shared(np->parent, NULL);
+- if (IS_ERR(mpcs->rstc))
- return PTR_ERR(mpcs->rstc);
++ if (of_parse_phandle(np->parent, "resets", 0)) {
++ mpcs->rstc = of_reset_control_get_shared(np->parent, NULL);
++ if (IS_ERR(mpcs->rstc))
++ return PTR_ERR(mpcs->rstc);
++ } else
+ mpcs->rstc = NULL;
reset_control_deassert(mpcs->rstc);
mpcs->sgmii_sel = devm_clk_get_enabled(dev, "sgmii_sel");
-@@ -505,6 +505,7 @@ static int mtk_pcs_lynxi_remove(struct platform_device *pdev)
+@@ -546,6 +549,7 @@ static int mtk_pcs_lynxi_remove(struct platform_device *pdev)
}
static const struct of_device_id mtk_pcs_lynxi_of_match[] = {
diff --git a/autobuild/unified/filogic/24.10/files/target/linux/mediatek/patches-6.6/999-2608-net-pcs-mtk-lynxi-add-phya-tx-rx-clock-path.patch b/autobuild/unified/filogic/24.10/files/target/linux/mediatek/patches-6.6/999-2608-net-pcs-mtk-lynxi-add-phya-tx-rx-clock-path.patch
index e1b87ad..eafe653 100644
--- a/autobuild/unified/filogic/24.10/files/target/linux/mediatek/patches-6.6/999-2608-net-pcs-mtk-lynxi-add-phya-tx-rx-clock-path.patch
+++ b/autobuild/unified/filogic/24.10/files/target/linux/mediatek/patches-6.6/999-2608-net-pcs-mtk-lynxi-add-phya-tx-rx-clock-path.patch
@@ -95,9 +95,9 @@
+ if (of_property_read_bool(np->parent, "mediatek,phya_trx_ck"))
+ flags |= MTK_SGMII_FLAG_PHYA_TRX_CK;
+
- mpcs->rstc = of_reset_control_get_shared(np->parent, NULL);
- if (IS_ERR(mpcs->rstc))
- mpcs->rstc = NULL;
+ if (of_parse_phandle(np->parent, "resets", 0)) {
+ mpcs->rstc = of_reset_control_get_shared(np->parent, NULL);
+ if (IS_ERR(mpcs->rstc))
diff --git a/include/linux/pcs/pcs-mtk-lynxi.h b/include/linux/pcs/pcs-mtk-lynxi.h
index 656a3e5..4ab8a32 100644
--- a/include/linux/pcs/pcs-mtk-lynxi.h