Skip to content

Commit fdcc8cc

Browse files
arinc9kuba-moo
authored andcommitted
net: dsa: mt7530: move lowering TRGMII driving to mt7530_setup()
Move lowering the TRGMII Tx clock driving to mt7530_setup(), after setting the core clock, as seen on the U-Boot MediaTek ethernet driver. Move the code which looks like it lowers the TRGMII Rx clock driving to after the TRGMII Tx clock driving is lowered. This is run after lowering the Tx clock driving on the U-Boot MediaTek ethernet driver as well. This way, the switch should consume less power regardless of port 6 being used. Update the comment explaining mt7530_pad_clk_setup(). Tested rgmii and trgmii modes of port 6 and rgmii mode of port 5 on MCM MT7530 on MT7621AT Unielec U7621-06 and standalone MT7530 on MT7623NI Bananapi BPI-R2. Fixes: b8f126a ("net-next: dsa: add dsa support for Mediatek MT7530 switch") Link: https://source.denx.de/u-boot/u-boot/-/blob/29a48bf9ccba45a5e560bb564bbe76e42629325f/drivers/net/mtk_eth.c#L682 Tested-by: Arınç ÜNAL <[email protected]> Signed-off-by: Arınç ÜNAL <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 8f058a6 commit fdcc8cc

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

drivers/net/dsa/mt7530.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -419,12 +419,12 @@ static void mt7530_pll_setup(struct mt7530_priv *priv)
419419
core_set(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN);
420420
}
421421

422-
/* Setup TX circuit including relevant PAD and driving */
422+
/* Setup port 6 interface mode and TRGMII TX circuit */
423423
static int
424424
mt7530_pad_clk_setup(struct dsa_switch *ds, phy_interface_t interface)
425425
{
426426
struct mt7530_priv *priv = ds->priv;
427-
u32 ncpo1, ssc_delta, trgint, i, xtal;
427+
u32 ncpo1, ssc_delta, trgint, xtal;
428428

429429
xtal = mt7530_read(priv, MT7530_MHWTRAP) & HWTRAP_XTAL_MASK;
430430

@@ -469,11 +469,6 @@ mt7530_pad_clk_setup(struct dsa_switch *ds, phy_interface_t interface)
469469
P6_INTF_MODE(trgint));
470470

471471
if (trgint) {
472-
/* Lower Tx Driving for TRGMII path */
473-
for (i = 0 ; i < NUM_TRGMII_CTRL ; i++)
474-
mt7530_write(priv, MT7530_TRGMII_TD_ODT(i),
475-
TD_DM_DRVP(8) | TD_DM_DRVN(8));
476-
477472
/* Disable the MT7530 TRGMII clocks */
478473
core_clear(priv, CORE_TRGMII_GSW_CLK_CG, REG_TRGMIICK_EN);
479474

@@ -494,10 +489,6 @@ mt7530_pad_clk_setup(struct dsa_switch *ds, phy_interface_t interface)
494489

495490
/* Enable the MT7530 TRGMII clocks */
496491
core_set(priv, CORE_TRGMII_GSW_CLK_CG, REG_TRGMIICK_EN);
497-
} else {
498-
for (i = 0 ; i < NUM_TRGMII_CTRL; i++)
499-
mt7530_rmw(priv, MT7530_TRGMII_RD(i),
500-
RD_TAP_MASK, RD_TAP(16));
501492
}
502493

503494
return 0;
@@ -2207,6 +2198,15 @@ mt7530_setup(struct dsa_switch *ds)
22072198

22082199
mt7530_pll_setup(priv);
22092200

2201+
/* Lower Tx driving for TRGMII path */
2202+
for (i = 0; i < NUM_TRGMII_CTRL; i++)
2203+
mt7530_write(priv, MT7530_TRGMII_TD_ODT(i),
2204+
TD_DM_DRVP(8) | TD_DM_DRVN(8));
2205+
2206+
for (i = 0; i < NUM_TRGMII_CTRL; i++)
2207+
mt7530_rmw(priv, MT7530_TRGMII_RD(i),
2208+
RD_TAP_MASK, RD_TAP(16));
2209+
22102210
/* Enable port 6 */
22112211
val = mt7530_read(priv, MT7530_MHWTRAP);
22122212
val &= ~MHWTRAP_P6_DIS & ~MHWTRAP_PHY_ACCESS;

0 commit comments

Comments
 (0)