[PATCH net-next v2 7/7] net: stmmac: mediatek: add support for MT8189 SoC
Louis-Alexis Eyraud
louisalexis.eyraud at collabora.com
Thu Sep 24 00:23:30 PDT 2026
Like MT8195 SoC, MT8189 SoC uses the Ethernet control registers from
the peripheral configuration (pericfg) but at a different offset.
It also has different RX and TX internal delay stage dividers (290ps
for MT8195, 180ps for MT8189), and by consequence a reduced value range
for these delays. It finally needs additional feature such as the
TX clock output enable one.
Thus, add compatible, clock definitions and specific platform data to
support the MT8189 SoC.
Signed-off-by: Louis-Alexis Eyraud <louisalexis.eyraud at collabora.com>
---
.../net/ethernet/stmicro/stmmac/dwmac-mediatek.c | 28 ++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
index 36599dc33b14..f07c331b029f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
@@ -37,8 +37,15 @@
#define ETH_FINE_DLY_RXC BIT(0)
/* Peri Configuration register for mt8189 */
+#define MT8189_PERI_ETH_CTRL_OFFSET 0x270
+
#define MT8189_CTRL0_TXC_OUT_OP_EN BIT(20)
+#define MT8189_DLY_RXC_STAGE_DIV 180 /* 180ps per stage */
+#define MT8189_DLY_RXC_MAX 5760 /* 32 * 180ps */
+#define MT8189_DLY_TXC_STAGE_DIV 180 /* 180ps per stage */
+#define MT8189_DLY_TXC_MAX 5760 /* 32 * 180ps */
+
/* Peri Configuration register for mt8195 */
#define MT8195_PERI_ETH_CTRL_OFFSET 0xFD0
@@ -124,6 +131,10 @@ static const char * const mt8195_dwmac_clk_l[] = {
"axi", "apb", "mac_cg", "mac_main", "ptp_ref"
};
+static const char * const mt8189_dwmac_clk_l[] = {
+ "mac_main", "ptp_ref"
+};
+
static int mt2712_set_interface(struct mediatek_dwmac_plat_data *plat,
u8 phy_intf_sel)
{
@@ -495,6 +506,21 @@ static void mt8195_fix_mac_speed(void *priv, phy_interface_t interface,
reg_val);
}
+static const struct mediatek_dwmac_variant mt8189_gmac_variant = {
+ .dwmac_set_phy_interface = mt8195_set_interface,
+ .dwmac_set_delay = mt8195_set_delay,
+ .dwmac_fix_mac_speed = mt8195_fix_mac_speed,
+ .clk_list = mt8189_dwmac_clk_l,
+ .num_clks = ARRAY_SIZE(mt8189_dwmac_clk_l),
+ .dma_bit_mask = 35,
+ .rx_delay_max = MT8189_DLY_RXC_MAX,
+ .tx_delay_max = MT8189_DLY_TXC_MAX,
+ .rx_delay_stage_div = MT8189_DLY_RXC_STAGE_DIV,
+ .tx_delay_stage_div = MT8189_DLY_TXC_STAGE_DIV,
+ .peri_eth_ctrl_offset = MT8189_PERI_ETH_CTRL_OFFSET,
+ .mac_txclk_out_en = true,
+};
+
static const struct mediatek_dwmac_variant mt8195_gmac_variant = {
.dwmac_set_phy_interface = mt8195_set_interface,
.dwmac_set_delay = mt8195_set_delay,
@@ -751,6 +777,8 @@ static void mediatek_dwmac_remove(struct platform_device *pdev)
static const struct of_device_id mediatek_dwmac_match[] = {
{ .compatible = "mediatek,mt2712-gmac",
.data = &mt2712_gmac_variant },
+ { .compatible = "mediatek,mt8189-gmac",
+ .data = &mt8189_gmac_variant },
{ .compatible = "mediatek,mt8195-gmac",
.data = &mt8195_gmac_variant },
{ }
--
2.55.0
More information about the linux-arm-kernel
mailing list