Skip to content

Commit c6be713

Browse files
Wolfram Sangkuba-moo
authored andcommitted
sh_eth: avoid PHY being resumed when interface is not up
SH_ETH doesn't need mdiobus suspend/resume, that's why it sets 'mac_managed_pm'. However, setting it needs to be moved from init to probe, so mdiobus PM functions will really never be called (e.g. when the interface is not up yet during suspend/resume). Fixes: 6a1dbfe ("net: sh_eth: Fix PHY state warning splat during system resume") Suggested-by: Heiner Kallweit <[email protected]> Signed-off-by: Wolfram Sang <[email protected]> Reviewed-by: Michal Kubiak <[email protected]> Reviewed-by: Sergey Shtylyov <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 7f5ebf5 commit c6be713

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

drivers/net/ethernet/renesas/sh_eth.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2029,8 +2029,6 @@ static int sh_eth_phy_init(struct net_device *ndev)
20292029
if (mdp->cd->register_type != SH_ETH_REG_GIGABIT)
20302030
phy_set_max_speed(phydev, SPEED_100);
20312031

2032-
/* Indicate that the MAC is responsible for managing PHY PM */
2033-
phydev->mac_managed_pm = true;
20342032
phy_attached_info(phydev);
20352033

20362034
return 0;
@@ -3097,6 +3095,8 @@ static int sh_mdio_init(struct sh_eth_private *mdp,
30973095
struct bb_info *bitbang;
30983096
struct platform_device *pdev = mdp->pdev;
30993097
struct device *dev = &mdp->pdev->dev;
3098+
struct phy_device *phydev;
3099+
struct device_node *pn;
31003100

31013101
/* create bit control struct for PHY */
31023102
bitbang = devm_kzalloc(dev, sizeof(struct bb_info), GFP_KERNEL);
@@ -3133,6 +3133,14 @@ static int sh_mdio_init(struct sh_eth_private *mdp,
31333133
if (ret)
31343134
goto out_free_bus;
31353135

3136+
pn = of_parse_phandle(dev->of_node, "phy-handle", 0);
3137+
phydev = of_phy_find_device(pn);
3138+
if (phydev) {
3139+
phydev->mac_managed_pm = true;
3140+
put_device(&phydev->mdio.dev);
3141+
}
3142+
of_node_put(pn);
3143+
31363144
return 0;
31373145

31383146
out_free_bus:

0 commit comments

Comments
 (0)