[PATCH 2/3] net: mediatek: add support for MediaTek MT7987 SoC

Weijie Gao
2025-01-10T08:41:51Z

This patch adds support for MediaTek MT7987.

MT7987 features MediaTek NETSYS v3, similar to MT7988, features three GMACs
which support 2.5Gb HSGMII. One 2.5Gb PHY is also embedded an can be
connected to a dedicated GMAC.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
---
drivers/net/mtk_eth/Kconfig | 4 ++--
drivers/net/mtk_eth/mtk_eth.c | 10 ++++++++++
2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mtk_eth/Kconfig b/drivers/net/mtk_eth/Kconfig
index 8d012fb1374..467684749f1 100644
--- a/drivers/net/mtk_eth/Kconfig
+++ b/drivers/net/mtk_eth/Kconfig
@@ -16,7 +16,7 @@ config MTK_ETH_SGMII

config MTK_ETH_XGMII
bool
- default y if TARGET_MT7988
+ default y if TARGET_MT7987 || TARGET_MT7988

config MTK_ETH_SWITCH_MT7530
bool "Support for MediaTek MT7530 ethernet switch"
@@ -25,7 +25,7 @@ config MTK_ETH_SWITCH_MT7530
config MTK_ETH_SWITCH_MT7531
bool "Support for MediaTek MT7531 ethernet switch"
default y if TARGET_MT7622 || TARGET_MT7629 || TARGET_MT7981 || \
- TARGET_MT7986
+ TARGET_MT7986 || TARGET_MT7987

config MTK_ETH_SWITCH_MT7988
bool "Support for MediaTek MT7988 built-in ethernet switch"
diff --git a/drivers/net/mtk_eth/mtk_eth.c b/drivers/net/mtk_eth/mtk_eth.c
index 1e6b30769d1..5d6a42bceb4 100644
--- a/drivers/net/mtk_eth/mtk_eth.c
+++ b/drivers/net/mtk_eth/mtk_eth.c
@@ -1477,6 +1477,15 @@ static const struct mtk_soc_data mt7988_data = {
.rxd_size = sizeof(struct mtk_rx_dma_v2),
};

+static const struct mtk_soc_data mt7987_data = {
+ .caps = MT7987_CAPS,
+ .ana_rgc3 = 0x128,
+ .gdma_count = 3,
+ .pdma_base = PDMA_V3_BASE,
+ .txd_size = sizeof(struct mtk_tx_dma_v2),
+ .rxd_size = sizeof(struct mtk_rx_dma_v2),
+};
+
static const struct mtk_soc_data mt7986_data = {
.caps = MT7986_CAPS,
.ana_rgc3 = 0x128,
@@ -1531,6 +1540,7 @@ static const struct mtk_soc_data mt7621_data = {

static const struct udevice_id mtk_eth_ids[] = {
{ .compatible = "mediatek,mt7988-eth", .data = (ulong)&mt7988_data },
+ { .compatible = "mediatek,mt7987-eth", .data = (ulong)&mt7987_data },
{ .compatible = "mediatek,mt7986-eth", .data = (ulong)&mt7986_data },
{ .compatible = "mediatek,mt7981-eth", .data = (ulong)&mt7981_data },
{ .compatible = "mediatek,mt7629-eth", .data = (ulong)&mt7629_data },
--
2.34.1