Netdev List
 help / color / mirror / Atom feed
From: Ho Jie Feng <hjf3108@gmail.com>
To: Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>, Felix Fietkau <nbd@nbd.name>,
	Lorenzo Bianconi <lorenzo@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Russell King <linux@armlinux.org.uk>
Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org,
	Gleb Pesin <dormancygrace@gmail.com>,
	Ho Jie Feng <hjf3108@gmail.com>
Subject: [PATCH net-next 11/13] net: ethernet: mtk_eth_soc: add RT2880 support
Date: Sun,  6 Dec 2026 01:21:50 +0800	[thread overview]
Message-ID: <20261205172152.3142989-12-hjf3108@gmail.com> (raw)
In-Reply-To: <20261205172152.3142989-1-hjf3108@gmail.com>

The RT2880 frame engine is the one RT3883 has, with a single RGMII
GMAC. Its checksum offload should work according to the datasheet, but
the OpenWrt driver found that it doesn't, so leave it off.

Add support for RT2880.

Build tested only, as no RT2880 hardware was available.

Signed-off-by: Ho Jie Feng <hjf3108@gmail.com>
---
 drivers/net/ethernet/mediatek/Kconfig       |  2 +-
 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 38 ++++++++++++++++++---
 drivers/net/ethernet/mediatek/mtk_eth_soc.h |  3 ++
 3 files changed, 38 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/mediatek/Kconfig b/drivers/net/ethernet/mediatek/Kconfig
index 15a6468c57..48e9f72dc3 100644
--- a/drivers/net/ethernet/mediatek/Kconfig
+++ b/drivers/net/ethernet/mediatek/Kconfig
@@ -2,7 +2,7 @@
 config NET_VENDOR_MEDIATEK
 	bool "MediaTek devices"
 	depends on ARCH_MEDIATEK || ARCH_AIROHA || SOC_MT7621 || SOC_MT7620 || \
-		   SOC_RT3883 || SOC_RT305X || COMPILE_TEST
+		   SOC_RT3883 || SOC_RT305X || SOC_RT288X || COMPILE_TEST
 	help
 	  If you have a Mediatek SoC with ethernet, say Y.
 
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index 33750f6b54..d442c33ee8 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -3678,8 +3678,11 @@ static void mtk_gdm_config(struct mtk_eth *eth, u32 id, u32 config)
 		val |= RT_GDMA_JMB_EN | FIELD_PREP(RT_GDMA_JMB_LEN, 2);
 	}
 
-	/* Enable RX checksum */
-	val |= MTK_GDMA_ICS_EN | MTK_GDMA_TCS_EN | MTK_GDMA_UCS_EN;
+	/* Enable RX checksum, else clear the checks that are on by default */
+	if (eth->soc->hw_features & NETIF_F_RXCSUM)
+		val |= MTK_GDMA_ICS_EN | MTK_GDMA_TCS_EN | MTK_GDMA_UCS_EN;
+	else
+		val &= ~(MTK_GDMA_ICS_EN | MTK_GDMA_TCS_EN | MTK_GDMA_UCS_EN);
 
 	val |= config;
 
@@ -4292,8 +4295,9 @@ static void rt2880_hw_init(struct mtk_eth *eth)
 
 	mtk_w32(eth, eth->soc->pse_fq_cfg, RT_PSE_FQ_CFG);
 
-	mtk_m32(eth, 0, RT_CSG_ICS_GEN_EN | RT_CSG_UCS_GEN_EN |
-		RT_CSG_TCS_GEN_EN, RT_CDMA_CSG_CFG);
+	if (eth->soc->hw_features & NETIF_F_IP_CSUM)
+		mtk_m32(eth, 0, RT_CSG_ICS_GEN_EN | RT_CSG_UCS_GEN_EN |
+			RT_CSG_TCS_GEN_EN, RT_CDMA_CSG_CFG);
 
 	mtk_w32(eth, RT_PSE_RESET, RT_FE_RST_GL);
 	mtk_w32(eth, 0, RT_FE_RST_GL);
@@ -5840,6 +5844,31 @@ static const struct mtk_soc_data mt7988_data = {
 	},
 };
 
+static const struct mtk_soc_data rt2880_data = {
+	.reg_map = &rt2880_reg_map,
+	.caps = RT3883_CAPS,
+	.hw_features = MTK_HW_FEATURES_RT2880,
+	.required_clks = RT3883_CLKS_BITMAP,
+	.required_pctl = false,
+	.pse_fq_cfg = RT2880_PSE_FQ_128Q,
+	.version = 1,
+	.tx = {
+		.desc_size = sizeof(struct mtk_tx_dma),
+		.irq_done_mask = RT_INT_TX_DLY,
+		.dma_max_len = MTK_TX_DMA_BUF_LEN,
+		.dma_len_offset = 16,
+		.dma_size = MTK_DMA_SIZE(2K),
+	},
+	.rx = {
+		.desc_size = sizeof(struct mtk_rx_dma),
+		.irq_done_mask = RT_INT_RX_DLY,
+		/* no .dma_l4_valid, the GDMA doesn't check the checksums */
+		.dma_max_len = MTK_TX_DMA_BUF_LEN,
+		.dma_len_offset = 16,
+		.dma_size = MTK_DMA_SIZE(2K),
+	},
+};
+
 static const struct mtk_soc_data rt3883_data = {
 	.reg_map = &rt2880_reg_map,
 	.caps = RT3883_CAPS,
@@ -5898,6 +5927,7 @@ const struct of_device_id of_mtk_match[] = {
 	{ .compatible = "mediatek,mt7981-eth", .data = &mt7981_data },
 	{ .compatible = "mediatek,mt7986-eth", .data = &mt7986_data },
 	{ .compatible = "mediatek,mt7988-eth", .data = &mt7988_data },
+	{ .compatible = "ralink,rt2880-eth", .data = &rt2880_data },
 	{ .compatible = "ralink,rt3883-eth", .data = &rt3883_data },
 	{ .compatible = "ralink,rt5350-eth", .data = &rt5350_data },
 	{},
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
index 72d0a9566e..fbcdcbd849 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
@@ -55,6 +55,8 @@
 				 NETIF_F_HW_TC)
 #define MTK_HW_FEATURES_MT7628	(NETIF_F_SG | NETIF_F_RXCSUM)
 #define MTK_HW_FEATURES_RT3883	(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM)
+/* checksum offload doesn't work on RT2880 */
+#define MTK_HW_FEATURES_RT2880	(NETIF_F_SG)
 #define NEXT_DESP_IDX(X, Y)	(((X) + 1) & ((Y) - 1))
 
 #define MTK_PP_HEADROOM		XDP_PACKET_HEADROOM
@@ -665,6 +667,7 @@
 
 #define RT_PSE_FQ_CFG		0x40
 #define RT3883_PSE_FQ_256Q	0xff908000
+#define RT2880_PSE_FQ_128Q	0x80504000
 
 #define RT_CDMA_CSG_CFG		0x80
 #define RT_CSG_ICS_GEN_EN	BIT(2)
-- 
2.53.0


  parent reply	other threads:[~2026-12-05 17:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-05 17:21 [PATCH net-next 00/13] net: ethernet: mtk_eth_soc: add support for RT3883 and related SoCs Ho Jie Feng
2026-12-05 17:21 ` [PATCH net-next 01/13] net: ethernet: mtk_eth_soc: reset PDMA TX completion index on ring setup Ho Jie Feng
2026-12-05 17:21 ` [PATCH net-next 02/13] net: ethernet: mtk_eth_soc: move PDMA TX ring registers to the register map Ho Jie Feng
2026-12-05 17:21 ` [PATCH net-next 03/13] net: ethernet: mtk_eth_soc: add a per-SoC TX done interrupt mask Ho Jie Feng
2026-12-05 17:21 ` [PATCH net-next 04/13] net: ethernet: mtk_eth_soc: complete PDMA TX on the right MAC Ho Jie Feng
2026-12-05 17:21 ` [PATCH net-next 05/13] dt-bindings: net: mediatek,net: fix the ralink,rt5350-eth constraints Ho Jie Feng
2026-12-05 17:21 ` [PATCH net-next 06/13] dt-bindings: net: mediatek,net: add ralink,rt3883-eth Ho Jie Feng
2026-12-05 17:21 ` [PATCH net-next 07/13] net: ethernet: mtk_eth_soc: use BIT_ULL() for the required clocks Ho Jie Feng
2026-12-05 17:21 ` [PATCH net-next 08/13] net: ethernet: mtk_eth_soc: add RT3883 support Ho Jie Feng
2026-12-05 17:21 ` [PATCH net-next 09/13] net: ethernet: mtk_eth_soc: allow building for RT5350 Ho Jie Feng
2026-12-05 17:21 ` [PATCH net-next 10/13] dt-bindings: net: mediatek,net: add ralink,rt2880-eth Ho Jie Feng
2026-12-05 17:21 ` Ho Jie Feng [this message]
2026-12-05 17:21 ` [PATCH net-next 12/13] dt-bindings: net: mediatek,net: add ralink,rt3050-eth Ho Jie Feng
2026-12-05 17:21 ` [PATCH net-next 13/13] net: ethernet: mtk_eth_soc: add RT305x support Ho Jie Feng
2026-12-05 17:28 ` [PATCH net-next 00/13] net: ethernet: mtk_eth_soc: add support for RT3883 and related SoCs netdev-bot+sinfo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261205172152.3142989-12-hjf3108@gmail.com \
    --to=hjf3108@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=dormancygrace@gmail.com \
    --cc=edumazet@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux@armlinux.org.uk \
    --cc=lorenzo@kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox