Skip to content

Commit c3b8e07

Browse files
lipnitskdavem330
authored andcommitted
net: dsa: mt7530: setup core clock even in TRGMII mode
A recent change to MIPS ralink reset logic made it so mt7530 actually resets the switch on platforms such as mt7621 (where bit 2 is the reset line for the switch). That exposed an issue where the switch would not function properly in TRGMII mode after a reset. Reconfigure core clock in TRGMII mode to fix the issue. Tested on Ubiquiti ER-X (MT7621) with TRGMII mode enabled. Fixes: 3f9ef77 ("MIPS: ralink: manage low reset lines") Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 2e5de7e commit c3b8e07

File tree

1 file changed

+25
-27
lines changed

1 file changed

+25
-27
lines changed

drivers/net/dsa/mt7530.c

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -436,34 +436,32 @@ mt7530_pad_clk_setup(struct dsa_switch *ds, phy_interface_t interface)
436436
TD_DM_DRVP(8) | TD_DM_DRVN(8));
437437

438438
/* Setup core clock for MT7530 */
439-
if (!trgint) {
440-
/* Disable MT7530 core clock */
441-
core_clear(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN);
442-
443-
/* Disable PLL, since phy_device has not yet been created
444-
* provided for phy_[read,write]_mmd_indirect is called, we
445-
* provide our own core_write_mmd_indirect to complete this
446-
* function.
447-
*/
448-
core_write_mmd_indirect(priv,
449-
CORE_GSWPLL_GRP1,
450-
MDIO_MMD_VEND2,
451-
0);
452-
453-
/* Set core clock into 500Mhz */
454-
core_write(priv, CORE_GSWPLL_GRP2,
455-
RG_GSWPLL_POSDIV_500M(1) |
456-
RG_GSWPLL_FBKDIV_500M(25));
439+
/* Disable MT7530 core clock */
440+
core_clear(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN);
457441

458-
/* Enable PLL */
459-
core_write(priv, CORE_GSWPLL_GRP1,
460-
RG_GSWPLL_EN_PRE |
461-
RG_GSWPLL_POSDIV_200M(2) |
462-
RG_GSWPLL_FBKDIV_200M(32));
463-
464-
/* Enable MT7530 core clock */
465-
core_set(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN);
466-
}
442+
/* Disable PLL, since phy_device has not yet been created
443+
* provided for phy_[read,write]_mmd_indirect is called, we
444+
* provide our own core_write_mmd_indirect to complete this
445+
* function.
446+
*/
447+
core_write_mmd_indirect(priv,
448+
CORE_GSWPLL_GRP1,
449+
MDIO_MMD_VEND2,
450+
0);
451+
452+
/* Set core clock into 500Mhz */
453+
core_write(priv, CORE_GSWPLL_GRP2,
454+
RG_GSWPLL_POSDIV_500M(1) |
455+
RG_GSWPLL_FBKDIV_500M(25));
456+
457+
/* Enable PLL */
458+
core_write(priv, CORE_GSWPLL_GRP1,
459+
RG_GSWPLL_EN_PRE |
460+
RG_GSWPLL_POSDIV_200M(2) |
461+
RG_GSWPLL_FBKDIV_200M(32));
462+
463+
/* Enable MT7530 core clock */
464+
core_set(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN);
467465

468466
/* Setup the MT7530 TRGMII Tx Clock */
469467
core_set(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN);

0 commit comments

Comments
 (0)