[PATCH net v3 2/2] net: fec: Suspend the PHY on probe

From: John Ernberg
Date: Wed Mar 06 2024 - 08:38:53 EST


Since the power management is now performed by the FEC instead of generic
pm the PHY will not suspend until the link has been up.

Therefor suspend it on probe. It will be resumed by {of_,}phy_connect()
when the link is brought up.

Since {of_,}phy_connect() and phy_disconnect() will resume and suspend the
PHY when the link is brought up and down respectively, and phy_stop() and
phy_start() will resume and suspend the PHY in the suspend-resume paths
there is no need for any additional calls anywhere.

Signed-off-by: John Ernberg <john.ernberg@xxxxxxxx>

---

v3:
- Only call phy_suspend() in probe, it is taken care of by the phy framework (Wei Fang)
- Update commit message to reflect the above
- Drop fixes tag, this is technically not a fix anymore (Wei Fang)
Should I re-send this for the net-next tree later, or is it still ok for net?

v2:
- New patch
---
drivers/net/ethernet/freescale/fec_main.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 8decb1b072c5..fb092b7bfe85 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -2539,8 +2539,10 @@ static int fec_enet_mii_init(struct platform_device *pdev)
/* find all the PHY devices on the bus and set mac_managed_pm to true */
for (addr = 0; addr < PHY_MAX_ADDR; addr++) {
phydev = mdiobus_get_phy(fep->mii_bus, addr);
- if (phydev)
+ if (phydev) {
phydev->mac_managed_pm = true;
+ phy_suspend(phydev);
+ }
}

mii_cnt++;
--
2.43.0