2023-03-15 07:41:51

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH net v2 1/2] 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: 4924c0cdce75 ("net: ravb: 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]>
---
drivers/net/ethernet/renesas/ravb_main.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 0f54849a3823..894e2690c643 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1455,8 +1455,6 @@ static int ravb_phy_init(struct net_device *ndev)
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);

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

/* Bitbang init */
@@ -2400,6 +2400,14 @@ static int ravb_mdio_init(struct ravb_private *priv)
if (error)
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;

out_free_bus:
--
2.30.2



2023-03-16 19:58:04

by Sergey Shtylyov

[permalink] [raw]
Subject: Re: [PATCH net v2 1/2] ravb: avoid PHY being resumed when interface is not up

On 3/15/23 10:41 AM, Wolfram Sang wrote:

> 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: 4924c0cdce75 ("net: ravb: Fix PHY state warning splat during system resume")
> Suggested-by: Heiner Kallweit <[email protected]>
> Signed-off-by: Wolfram Sang <[email protected]>

[...]

Reviewed-by: Sergey Shtylyov <[email protected]>

MBR, Sergey

2023-03-16 20:02:35

by Florian Fainelli

[permalink] [raw]
Subject: Re: [PATCH net v2 1/2] ravb: avoid PHY being resumed when interface is not up

On 3/15/23 00:41, Wolfram Sang wrote:
> 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: 4924c0cdce75 ("net: ravb: 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: Florian Fainelli <[email protected]>

This is a pattern that a lot of drivers have, for better or for worse,
it would be neat if we couldcome up with a common helper that could work
mostly with OF configurations, what do you think?
--
Florian


2023-03-16 20:06:14

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH net v2 1/2] ravb: avoid PHY being resumed when interface is not up


> Reviewed-by: Florian Fainelli <[email protected]>

Thanks!

> This is a pattern that a lot of drivers have, for better or for worse, it
> would be neat if we couldcome up with a common helper that could work mostly
> with OF configurations, what do you think?

I am not so experienced in this subsystem, so I only could identify 4
drivers which need this pattern, with one not using OF. So, while I
trust you with a helper being useful, I'd like to pass this task to
someone more experienced here.


Attachments:
(No filename) (505.00 B)
signature.asc (833.00 B)
Download all attachments

2023-03-16 20:08:08

by Florian Fainelli

[permalink] [raw]
Subject: Re: [PATCH net v2 1/2] ravb: avoid PHY being resumed when interface is not up

On 3/16/23 13:06, Wolfram Sang wrote:
>
>> Reviewed-by: Florian Fainelli <[email protected]>
>
> Thanks!
>
>> This is a pattern that a lot of drivers have, for better or for worse, it
>> would be neat if we couldcome up with a common helper that could work mostly
>> with OF configurations, what do you think?
>
> I am not so experienced in this subsystem, so I only could identify 4
> drivers which need this pattern, with one not using OF. So, while I
> trust you with a helper being useful, I'd like to pass this task to
> someone more experienced here.

That seems entirely fair, I have one such platform, so may come up with
a helper after I debug this other issue I am looking at :)
--
Florian