Skip to content

Commit c782c7f

Browse files
committed
Merge branch 'net-renesas-set-mac_managed_pm-at-probe-time'
Wolfram Sang says: ==================== net: renesas: set 'mac_managed_pm' at probe time When suspending/resuming an interface which was not up, we saw mdiobus related PM handling despite 'mac_managed_pm' being set for RAVB/SH_ETH. Heiner kindly suggested the fix to set this flag at probe time, not at init/open time. I implemented his suggestion and it works fine on these two Renesas drivers. ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 0450479 + c6be713 commit c782c7f

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

drivers/net/ethernet/renesas/ravb_main.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,8 +1455,6 @@ static int ravb_phy_init(struct net_device *ndev)
14551455
phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_100baseT_Half_BIT);
14561456
}
14571457

1458-
/* Indicate that the MAC is responsible for managing PHY PM */
1459-
phydev->mac_managed_pm = true;
14601458
phy_attached_info(phydev);
14611459

14621460
return 0;
@@ -2379,6 +2377,8 @@ static int ravb_mdio_init(struct ravb_private *priv)
23792377
{
23802378
struct platform_device *pdev = priv->pdev;
23812379
struct device *dev = &pdev->dev;
2380+
struct phy_device *phydev;
2381+
struct device_node *pn;
23822382
int error;
23832383

23842384
/* Bitbang init */
@@ -2400,6 +2400,14 @@ static int ravb_mdio_init(struct ravb_private *priv)
24002400
if (error)
24012401
goto out_free_bus;
24022402

2403+
pn = of_parse_phandle(dev->of_node, "phy-handle", 0);
2404+
phydev = of_phy_find_device(pn);
2405+
if (phydev) {
2406+
phydev->mac_managed_pm = true;
2407+
put_device(&phydev->mdio.dev);
2408+
}
2409+
of_node_put(pn);
2410+
24032411
return 0;
24042412

24052413
out_free_bus:

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)