[][kernel-6.6][mt7988][eth][Change hardware configuration for the NETSYSv3]
[Description]
Change hardware configuration for the NETSYSv3.
- Enable PSE dummy page mechanism for the GDM1/2/3
- Enable PSE drop mechanism when the WDMA Rx ring full
- Correct PSE_NO_DROP configuration
- Correct CDMA_HIGH_THRESHOLD configuration
[Release-log]
N/A
Change-Id: Id6e1690beecf343d031f68574b878c2e075b41b3
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/9831187
diff --git a/autobuild/unified/global/master/files/target/linux/mediatek/patches-6.6/999-2703-net-ethernet-mtk_eth_soc-revise-hardware-configurati.patch b/autobuild/unified/global/master/files/target/linux/mediatek/patches-6.6/999-2703-net-ethernet-mtk_eth_soc-revise-hardware-configurati.patch
new file mode 100644
index 0000000..a54463e
--- /dev/null
+++ b/autobuild/unified/global/master/files/target/linux/mediatek/patches-6.6/999-2703-net-ethernet-mtk_eth_soc-revise-hardware-configurati.patch
@@ -0,0 +1,56 @@
+From d4bf1945fac3092268a089d1c86d64291b5f37ea Mon Sep 17 00:00:00 2001
+From: Bo-Cun Chen <bc-bocun.chen@mediatek.com>
+Date: Fri, 1 Nov 2024 13:55:17 +0800
+Subject: [PATCH] net: ethernet: mtk_eth_soc: revise hardware configuration for
+ NETSYSv3
+
+---
+ drivers/net/ethernet/mediatek/mtk_eth_soc.c | 13 ++++++++++---
+ drivers/net/ethernet/mediatek/mtk_eth_soc.h | 5 +++++
+ 2 files changed, 15 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+index cc33931..498a23b 100644
+--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+@@ -4192,11 +4192,18 @@ static int mtk_hw_init(struct mtk_eth *eth, bool reset)
+ mtk_w32(eth, 0x21021000, MTK_FE_INT_GRP);
+
+ if (mtk_is_netsys_v3_or_greater(eth)) {
+- /* PSE should not drop port1, port8 and port9 packets */
+- mtk_w32(eth, 0x00000302, PSE_DROP_CFG);
++ /* PSE dummy page mechanism */
++ mtk_w32(eth, PSE_DUMMY_WORK_GDM(1) | PSE_DUMMY_WORK_GDM(2) |
++ PSE_DUMMY_WORK_GDM(3) | DUMMY_PAGE_THR, PSE_DUMY_REQ);
++
++ /* PSE should not drop port8 and port9 packets from WDMA Tx */
++ mtk_w32(eth, 0x00000300, PSE_DROP_CFG);
++
++ /* PSE should drop packets to port 8/9 on WDMA Rx ring full */
++ mtk_w32(eth, 0x00000300, PSE_PPE0_DROP);
+
+ /* GDM and CDM Threshold */
+- mtk_w32(eth, 0x00000707, MTK_CDMW0_THRES);
++ mtk_w32(eth, 0x08000707, MTK_CDMW0_THRES);
+ mtk_w32(eth, 0x00000077, MTK_CDMW1_THRES);
+
+ /* Disable GDM1 RX CRC stripping */
+diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
+index bd4a62e..0df84bf 100644
+--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
+@@ -161,6 +161,11 @@
+ #define PSE_DROP_CFG 0x108
+ #define PSE_PPE0_DROP 0x110
+
++/* PSE Last FreeQ Page Request Control */
++#define PSE_DUMY_REQ 0x10C
++#define PSE_DUMMY_WORK_GDM(x) BIT(16 + (x))
++#define DUMMY_PAGE_THR 0x1
++
+ /* PSE Input Queue Reservation Register*/
+ #define PSE_IQ_REV(x) (0x140 + (((x) - 1) << 2))
+
+--
+2.45.2
+