1 From 7237a6a0c020c05bb819774391154b40b2cfaabd Mon Sep 17 00:00:00 2001
2 From: Weijie Gao <weijie.gao@mediatek.com>
3 Date: Fri, 20 May 2022 11:23:42 +0800
4 Subject: [PATCH 19/25] net: mediatek: add support for MediaTek MT7621 SoC
6 This patch adds GMAC support for MediaTek MT7621 SoC.
7 MT7621 has the same GMAC/Switch configuration as MT7623.
9 Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
10 Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
12 drivers/net/mtk_eth.c | 21 +++++++++++++++------
13 1 file changed, 15 insertions(+), 6 deletions(-)
15 --- a/drivers/net/mtk_eth.c
16 +++ b/drivers/net/mtk_eth.c
17 @@ -145,7 +145,8 @@ enum mtk_switch {
27 @@ -675,12 +676,18 @@ static int mt7530_pad_clk_setup(struct m
28 static int mt7530_setup(struct mtk_eth_priv *priv)
30 u16 phy_addr, phy_val;
35 - /* Select 250MHz clk for RGMII mode */
36 - mtk_ethsys_rmw(priv, ETHSYS_CLKCFG0_REG,
37 - ETHSYS_TRGMII_CLK_SEL362_5, 0);
38 + if (priv->soc != SOC_MT7621) {
39 + /* Select 250MHz clk for RGMII mode */
40 + mtk_ethsys_rmw(priv, ETHSYS_CLKCFG0_REG,
41 + ETHSYS_TRGMII_CLK_SEL362_5, 0);
48 /* Modify HWTRAP first to allow direct access to internal PHYs */
49 mt753x_reg_read(priv, HWTRAP_REG, &val);
50 @@ -738,7 +745,8 @@ static int mt7530_setup(struct mtk_eth_p
51 /* Lower Tx Driving for TRGMII path */
52 for (i = 0 ; i < NUM_TRGMII_CTRL ; i++)
53 mt753x_reg_write(priv, MT7530_TRGMII_TD_ODT(i),
54 - (8 << TD_DM_DRVP_S) | (8 << TD_DM_DRVN_S));
55 + (txdrv << TD_DM_DRVP_S) |
56 + (txdrv << TD_DM_DRVN_S));
58 for (i = 0 ; i < NUM_TRGMII_CTRL; i++)
59 mt753x_reg_rmw(priv, MT7530_TRGMII_RD(i), RD_TAP_M, 16);
60 @@ -1540,6 +1548,7 @@ static const struct udevice_id mtk_eth_i
61 { .compatible = "mediatek,mt7629-eth", .data = SOC_MT7629 },
62 { .compatible = "mediatek,mt7623-eth", .data = SOC_MT7623 },
63 { .compatible = "mediatek,mt7622-eth", .data = SOC_MT7622 },
64 + { .compatible = "mediatek,mt7621-eth", .data = SOC_MT7621 },