summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/mediatek/mtk_sgmii.c
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2023-03-14 00:34:26 +0000
committerDavid S. Miller <davem@davemloft.net>2023-03-15 08:58:13 +0000
commit611e2dabb4b3243d176739fd6a5a34d007fa3f86 (patch)
treea0ded4f567dbee2abc6db66d496cbfd78656214a /drivers/net/ethernet/mediatek/mtk_sgmii.c
parentd8b228318935044dafe3a5bc07ee71a1f1424b8d (diff)
downloadlinux-611e2dabb4b3243d176739fd6a5a34d007fa3f86.tar.gz
net: ethernet: mtk_eth_soc: reset PCS state
Reset the internal PCS state machine when changing interface mode. This prevents confusing the state machine when changing interface modes, e.g. from SGMII to 2500Base-X or vice-versa. Fixes: 7e538372694b ("net: ethernet: mediatek: Re-add support SGMII") Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Tested-by: Bjørn Mork <bjorn@mork.no> Signed-off-by: Daniel Golle <daniel@makrotopia.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mediatek/mtk_sgmii.c')
-rw-r--r--drivers/net/ethernet/mediatek/mtk_sgmii.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mediatek/mtk_sgmii.c b/drivers/net/ethernet/mediatek/mtk_sgmii.c
index bb00de1003ac..612f65bb0345 100644
--- a/drivers/net/ethernet/mediatek/mtk_sgmii.c
+++ b/drivers/net/ethernet/mediatek/mtk_sgmii.c
@@ -88,6 +88,10 @@ static int mtk_pcs_config(struct phylink_pcs *pcs, unsigned int mode,
regmap_update_bits(mpcs->regmap, SGMSYS_QPHY_PWR_STATE_CTRL,
SGMII_PHYA_PWD, SGMII_PHYA_PWD);
+ /* Reset SGMII PCS state */
+ regmap_update_bits(mpcs->regmap, SGMII_RESERVED_0,
+ SGMII_SW_RESET, SGMII_SW_RESET);
+
if (interface == PHY_INTERFACE_MODE_2500BASEX)
rgc3 = RG_PHY_SPEED_3_125G;
else