Skip to contentSkip to conversation

net: fec: Fix PHY init after phy_reset_after_clk_enable()

PATCH RESEND In review Marek Vasut 2 participants 4 messages Oct 6, 2020 – Oct 9, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 net: fec: Fix PHY init after phy_reset_after_clk_enable()

The phy_reset_after_clk_enable() does a PHY reset, which means the PHY loses its register settings. The fec_enet_mii_probe() starts the PHY and does the necessary calls to configure the PHY via PHY framework, and loads the correct register settings into the PHY. Therefore, fec_enet_mii_probe() should be called only after the PHY has been reset, not before as it is now.

Fixes 1b0a83ac04e3 ("net: fec: add phy_reset_after_clk_enable() support")
Cc Christoph Niedermaier <[email protected]>
Cc David S. Miller <[email protected]>
Cc NXP Linux Team <[email protected]>
Cc Richard Leitner <[email protected]>
Cc Shawn Guo <[email protected]>
---
 drivers/net/ethernet/freescale/fec_main.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/ethernet/freescale/fec_main.c +5 -5
index c043afb38b6e..2d5433301843 100644
@@ -2983,17 +2983,17 @@ fec_enet_open(struct net_device *ndev)
 	/* Init MAC prior to mii bus probe */
 	fec_restart(ndev);
 
-	/* Probe and connect to PHY when open the interface */
-	ret = fec_enet_mii_probe(ndev);
-	if (ret)
-		goto err_enet_mii_probe;
-
 	/* Call phy_reset_after_clk_enable() again if it failed during
 	 * phy_reset_after_clk_enable() before because the PHY wasn't probed.
 	 */
 	if (reset_again)
 		phy_reset_after_clk_enable(ndev->phydev);
 
+	/* Probe and connect to PHY when open the interface */
+	ret = fec_enet_mii_probe(ndev);
+	if (ret)
+		goto err_enet_mii_probe;
+
 	if (fep->quirks & FEC_QUIRK_ERR006687)
 		imx6q_cpuidle_fec_irqs_used();
 
Signature · 1 line
2.28.0
maintainer
#1 lore raw
Quoted 11 lines · On Tue, 6 Oct 2020 15:52:53 +0200 Marek Vasut wrote:

The phy_reset_after_clk_enable() does a PHY reset, which means the PHY loses its register settings. The fec_enet_mii_probe() starts the PHY and does the necessary calls to configure the PHY via PHY framework, and loads the correct register settings into the PHY. Therefore, fec_enet_mii_probe() should be called only after the PHY has been reset, not before as it is now.

Fixes 1b0a83ac04e3 ("net: fec: add phy_reset_after_clk_enable() support")

Is moving the reset before fec_enet_mii_probe() the reason you need the second patch?

net: fec: Fix phy_device lookup for phy_reset_after_clk_enable()

#2 lore raw
Quoted 13 lines · Jakub Kicinski
Quoted 11 lines · On Tue, 6 Oct 2020 15:52:53 +0200 Marek Vasut wrote:

The phy_reset_after_clk_enable() does a PHY reset, which means the PHY loses its register settings. The fec_enet_mii_probe() starts the PHY and does the necessary calls to configure the PHY via PHY framework, and loads the correct register settings into the PHY. Therefore, fec_enet_mii_probe() should be called only after the PHY has been reset, not before as it is now.

Fixes 1b0a83ac04e3 ("net: fec: add phy_reset_after_clk_enable() support")
Quoted 4 lines

Is moving the reset before fec_enet_mii_probe() the reason you need the second patch?

net: fec: Fix phy_device lookup for phy_reset_after_clk_enable()

No, the second patch addresses separate issue.

maintainer
#3 lore raw
Quoted 14 lines · On Fri, 9 Oct 2020 09:21:06 +0200 Marek Vasut wrote:
Quoted 13 lines · Jakub Kicinski
Quoted 11 lines · On Tue, 6 Oct 2020 15:52:53 +0200 Marek Vasut wrote:

The phy_reset_after_clk_enable() does a PHY reset, which means the PHY loses its register settings. The fec_enet_mii_probe() starts the PHY and does the necessary calls to configure the PHY via PHY framework, and loads the correct register settings into the PHY. Therefore, fec_enet_mii_probe() should be called only after the PHY has been reset, not before as it is now.

Fixes 1b0a83ac04e3 ("net: fec: add phy_reset_after_clk_enable() support")
Quoted 6 lines
Quoted 4 lines

Is moving the reset before fec_enet_mii_probe() the reason you need the second patch?

net: fec: Fix phy_device lookup for phy_reset_after_clk_enable()

No, the second patch addresses separate issue.

I see. Applied to net and queued for stable, thank you!