Skip to content

Commit 22c5e0b

Browse files
committed
Merge branch 'net-fec-fix-to-suspend-resume-with-mac_managed_pm'
John Ernberg says: ==================== net: fec: Fix to suspend / resume with mac_managed_pm Since the introduction of mac_managed_pm in the FEC driver there were some discrepancies regarding power management of the PHY. This failed on our board that has a permanently powered Microchip LAN8700R attached to the FEC. Although the root cause of the failure can be traced back to f166f89 ("net: ethernet: fec: Replace interrupt driven MDIO with polled IO") and probably even before that, we only started noticing the problem going from 5.10 to 6.1. Since 557d5dc ("net: fec: use mac-managed PHY PM") is actually a fix to most of the power management sequencing problems that came with power managing the MDIO bus which for the FEC meant adding a race with FEC resume (and phy_start() if netif was running) and PHY resume. That it worked before for us was probably just luck... Thanks to Wei's response to my report at [1] I was able to pick up his patch and start honing in on the remaining missing details. [1]: https://lore.kernel.org/netdev/[email protected]/ v3: https://lore.kernel.org/netdev/[email protected]/ v2: https://lore.kernel.org/netdev/[email protected]/ v1: https://lore.kernel.org/netdev/[email protected]/ ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 0a6380c + cbc17e7 commit 22c5e0b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

drivers/net/ethernet/freescale/fec_main.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2454,8 +2454,6 @@ static int fec_enet_mii_probe(struct net_device *ndev)
24542454
fep->link = 0;
24552455
fep->full_duplex = 0;
24562456

2457-
phy_dev->mac_managed_pm = true;
2458-
24592457
phy_attached_info(phy_dev);
24602458

24612459
return 0;
@@ -2467,10 +2465,12 @@ static int fec_enet_mii_init(struct platform_device *pdev)
24672465
struct net_device *ndev = platform_get_drvdata(pdev);
24682466
struct fec_enet_private *fep = netdev_priv(ndev);
24692467
bool suppress_preamble = false;
2468+
struct phy_device *phydev;
24702469
struct device_node *node;
24712470
int err = -ENXIO;
24722471
u32 mii_speed, holdtime;
24732472
u32 bus_freq;
2473+
int addr;
24742474

24752475
/*
24762476
* The i.MX28 dual fec interfaces are not equal.
@@ -2584,6 +2584,13 @@ static int fec_enet_mii_init(struct platform_device *pdev)
25842584
goto err_out_free_mdiobus;
25852585
of_node_put(node);
25862586

2587+
/* find all the PHY devices on the bus and set mac_managed_pm to true */
2588+
for (addr = 0; addr < PHY_MAX_ADDR; addr++) {
2589+
phydev = mdiobus_get_phy(fep->mii_bus, addr);
2590+
if (phydev)
2591+
phydev->mac_managed_pm = true;
2592+
}
2593+
25872594
mii_cnt++;
25882595

25892596
/* save fec0 mii_bus */

0 commit comments

Comments
 (0)