[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230316205449.1659395-1-shenwei.wang@nxp.com>
Date: Thu, 16 Mar 2023 15:54:49 -0500
From: Shenwei Wang <shenwei.wang@....com>
To: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Russell King <linux@...linux.org.uk>
Cc: Giuseppe Cavallaro <peppe.cavallaro@...com>,
Alexandre Torgue <alexandre.torgue@...s.st.com>,
Jose Abreu <joabreu@...opsys.com>, netdev@...r.kernel.org,
linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org, imx@...ts.linux.dev,
Shenwei Wang <shenwei.wang@....com>
Subject: [PATCH 1/1] net: stmmac: start PHY early in __stmmac_open
By initializing the PHY and establishing the link before setting the
MAC relating configurations, this change ensures that the PHY is
operational before the MAC logic starts relying on it. This can
prevent synchronization errors and improve system stability.
This change especially applies to the RMII mode, where the PHY may drive
the REF_CLK signal, which requires the PHY to be started and operational
before the MAC logic initializes.
This change should not impact other modes of operation.
Fixes: 74371272f97f ("net: stmmac: Convert to phylink and remove phylib logic")
Signed-off-by: Shenwei Wang <shenwei.wang@....com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 8f543c3ab5c5..4feeca4d0503 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -3808,6 +3808,10 @@ static int __stmmac_open(struct net_device *dev,
}
}
+ phylink_start(priv->phylink);
+ /* We may have called phylink_speed_down before */
+ phylink_speed_up(priv->phylink);
+
/* Extra statistics */
memset(&priv->xstats, 0, sizeof(struct stmmac_extra_stats));
priv->xstats.threshold = tc;
@@ -3836,10 +3840,6 @@ static int __stmmac_open(struct net_device *dev,
stmmac_init_coalesce(priv);
- phylink_start(priv->phylink);
- /* We may have called phylink_speed_down before */
- phylink_speed_up(priv->phylink);
-
ret = stmmac_request_irq(dev);
if (ret)
goto irq_error;
--
2.34.1
Powered by blists - more mailing lists