Commit f22c993f authored by Wolfram Sang's avatar Wolfram Sang Committed by Paolo Abeni

smsc911x: avoid PHY being resumed when interface is not up

SMSC911x 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: 3ce9f2be ("net: smsc911x: Stop and start PHY during suspend and resume")
Suggested-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
Link: https://lore.kernel.org/r/20230327083138.6044-1-wsa+renesas@sang-engineering.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent b4c66d75
...@@ -1037,8 +1037,6 @@ static int smsc911x_mii_probe(struct net_device *dev) ...@@ -1037,8 +1037,6 @@ static int smsc911x_mii_probe(struct net_device *dev)
return ret; return ret;
} }
/* Indicate that the MAC is responsible for managing PHY PM */
phydev->mac_managed_pm = true;
phy_attached_info(phydev); phy_attached_info(phydev);
phy_set_max_speed(phydev, SPEED_100); phy_set_max_speed(phydev, SPEED_100);
...@@ -1066,6 +1064,7 @@ static int smsc911x_mii_init(struct platform_device *pdev, ...@@ -1066,6 +1064,7 @@ static int smsc911x_mii_init(struct platform_device *pdev,
struct net_device *dev) struct net_device *dev)
{ {
struct smsc911x_data *pdata = netdev_priv(dev); struct smsc911x_data *pdata = netdev_priv(dev);
struct phy_device *phydev;
int err = -ENXIO; int err = -ENXIO;
pdata->mii_bus = mdiobus_alloc(); pdata->mii_bus = mdiobus_alloc();
...@@ -1108,6 +1107,10 @@ static int smsc911x_mii_init(struct platform_device *pdev, ...@@ -1108,6 +1107,10 @@ static int smsc911x_mii_init(struct platform_device *pdev,
goto err_out_free_bus_2; goto err_out_free_bus_2;
} }
phydev = phy_find_first(pdata->mii_bus);
if (phydev)
phydev->mac_managed_pm = true;
return 0; return 0;
err_out_free_bus_2: err_out_free_bus_2:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment