Commit 7f5ebf5d authored by Wolfram Sang's avatar Wolfram Sang Committed by Jakub Kicinski

ravb: avoid PHY being resumed when interface is not up

RAVB 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: 4924c0cd ("net: ravb: Fix PHY state warning splat during system resume")
Suggested-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: default avatarMichal Kubiak <michal.kubiak@intel.com>
Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 04504793
...@@ -1455,8 +1455,6 @@ static int ravb_phy_init(struct net_device *ndev) ...@@ -1455,8 +1455,6 @@ static int ravb_phy_init(struct net_device *ndev)
phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_100baseT_Half_BIT); phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_100baseT_Half_BIT);
} }
/* Indicate that the MAC is responsible for managing PHY PM */
phydev->mac_managed_pm = true;
phy_attached_info(phydev); phy_attached_info(phydev);
return 0; return 0;
...@@ -2379,6 +2377,8 @@ static int ravb_mdio_init(struct ravb_private *priv) ...@@ -2379,6 +2377,8 @@ static int ravb_mdio_init(struct ravb_private *priv)
{ {
struct platform_device *pdev = priv->pdev; struct platform_device *pdev = priv->pdev;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct phy_device *phydev;
struct device_node *pn;
int error; int error;
/* Bitbang init */ /* Bitbang init */
...@@ -2400,6 +2400,14 @@ static int ravb_mdio_init(struct ravb_private *priv) ...@@ -2400,6 +2400,14 @@ static int ravb_mdio_init(struct ravb_private *priv)
if (error) if (error)
goto out_free_bus; goto out_free_bus;
pn = of_parse_phandle(dev->of_node, "phy-handle", 0);
phydev = of_phy_find_device(pn);
if (phydev) {
phydev->mac_managed_pm = true;
put_device(&phydev->mdio.dev);
}
of_node_put(pn);
return 0; return 0;
out_free_bus: out_free_bus:
......
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