All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net v2 0/2] net: renesas: set 'mac_managed_pm' at probe time
@ 2023-03-15  7:41 Wolfram Sang
  2023-03-15  7:41 ` [PATCH net v2 1/2] ravb: avoid PHY being resumed when interface is not up Wolfram Sang
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Wolfram Sang @ 2023-03-15  7:41 UTC (permalink / raw)
  To: netdev; +Cc: linux-renesas-soc, Wolfram Sang

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.

Changes since v1:
* added tag from Michal (thanks!)
* split out patches which are for 'net' only (Thanks, Simon!)


Wolfram Sang (2):
  ravb: avoid PHY being resumed when interface is not up
  sh_eth: avoid PHY being resumed when interface is not up

 drivers/net/ethernet/renesas/ravb_main.c | 12 ++++++++++--
 drivers/net/ethernet/renesas/sh_eth.c    | 12 ++++++++++--
 2 files changed, 20 insertions(+), 4 deletions(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH net v2 1/2] ravb: avoid PHY being resumed when interface is not up
  2023-03-15  7:41 [PATCH net v2 0/2] net: renesas: set 'mac_managed_pm' at probe time Wolfram Sang
@ 2023-03-15  7:41 ` Wolfram Sang
  2023-03-16 19:56   ` Sergey Shtylyov
  2023-03-16 20:01   ` Florian Fainelli
  2023-03-15  7:41 ` [PATCH net v2 2/2] sh_eth: " Wolfram Sang
  2023-03-17  0:30 ` [PATCH net v2 0/2] net: renesas: set 'mac_managed_pm' at probe time patchwork-bot+netdevbpf
  2 siblings, 2 replies; 9+ messages in thread
From: Wolfram Sang @ 2023-03-15  7:41 UTC (permalink / raw)
  To: netdev
  Cc: linux-renesas-soc, Wolfram Sang, Heiner Kallweit, Michal Kubiak,
	Sergey Shtylyov, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Geert Uytterhoeven, Florian Fainelli, linux-kernel

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 <hkallweit1@gmail.com>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Michal Kubiak <michal.kubiak@intel.com>
---
 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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH net v2 2/2] sh_eth: avoid PHY being resumed when interface is not up
  2023-03-15  7:41 [PATCH net v2 0/2] net: renesas: set 'mac_managed_pm' at probe time Wolfram Sang
  2023-03-15  7:41 ` [PATCH net v2 1/2] ravb: avoid PHY being resumed when interface is not up Wolfram Sang
@ 2023-03-15  7:41 ` Wolfram Sang
  2023-03-16 19:58   ` Sergey Shtylyov
  2023-03-17  0:30 ` [PATCH net v2 0/2] net: renesas: set 'mac_managed_pm' at probe time patchwork-bot+netdevbpf
  2 siblings, 1 reply; 9+ messages in thread
From: Wolfram Sang @ 2023-03-15  7:41 UTC (permalink / raw)
  To: netdev
  Cc: linux-renesas-soc, Wolfram Sang, Heiner Kallweit, Michal Kubiak,
	Sergey Shtylyov, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Geert Uytterhoeven, Florian Fainelli, linux-kernel

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: 6a1dbfefdae4 ("net: sh_eth: Fix PHY state warning splat during system resume")
Suggested-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Michal Kubiak <michal.kubiak@intel.com>
---
 drivers/net/ethernet/renesas/sh_eth.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index ed17163d7811..d8ec729825be 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -2029,8 +2029,6 @@ static int sh_eth_phy_init(struct net_device *ndev)
 	if (mdp->cd->register_type != SH_ETH_REG_GIGABIT)
 		phy_set_max_speed(phydev, SPEED_100);
 
-	/* Indicate that the MAC is responsible for managing PHY PM */
-	phydev->mac_managed_pm = true;
 	phy_attached_info(phydev);
 
 	return 0;
@@ -3097,6 +3095,8 @@ static int sh_mdio_init(struct sh_eth_private *mdp,
 	struct bb_info *bitbang;
 	struct platform_device *pdev = mdp->pdev;
 	struct device *dev = &mdp->pdev->dev;
+	struct phy_device *phydev;
+	struct device_node *pn;
 
 	/* create bit control struct for PHY */
 	bitbang = devm_kzalloc(dev, sizeof(struct bb_info), GFP_KERNEL);
@@ -3133,6 +3133,14 @@ static int sh_mdio_init(struct sh_eth_private *mdp,
 	if (ret)
 		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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH net v2 1/2] ravb: avoid PHY being resumed when interface is not up
  2023-03-15  7:41 ` [PATCH net v2 1/2] ravb: avoid PHY being resumed when interface is not up Wolfram Sang
@ 2023-03-16 19:56   ` Sergey Shtylyov
  2023-03-16 20:01   ` Florian Fainelli
  1 sibling, 0 replies; 9+ messages in thread
From: Sergey Shtylyov @ 2023-03-16 19:56 UTC (permalink / raw)
  To: Wolfram Sang, netdev
  Cc: linux-renesas-soc, Heiner Kallweit, Michal Kubiak,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Geert Uytterhoeven, Florian Fainelli, linux-kernel

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 <hkallweit1@gmail.com>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

[...]

Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>

MBR, Sergey

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net v2 2/2] sh_eth: avoid PHY being resumed when interface is not up
  2023-03-15  7:41 ` [PATCH net v2 2/2] sh_eth: " Wolfram Sang
@ 2023-03-16 19:58   ` Sergey Shtylyov
  0 siblings, 0 replies; 9+ messages in thread
From: Sergey Shtylyov @ 2023-03-16 19:58 UTC (permalink / raw)
  To: Wolfram Sang, netdev
  Cc: linux-renesas-soc, Heiner Kallweit, Michal Kubiak,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Geert Uytterhoeven, Florian Fainelli, linux-kernel

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

> 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: 6a1dbfefdae4 ("net: sh_eth: Fix PHY state warning splat during system resume")
> Suggested-by: Heiner Kallweit <hkallweit1@gmail.com>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> Reviewed-by: Michal Kubiak <michal.kubiak@intel.com>

[...]

Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>

MBR, Sergey

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net v2 1/2] ravb: avoid PHY being resumed when interface is not up
  2023-03-15  7:41 ` [PATCH net v2 1/2] ravb: avoid PHY being resumed when interface is not up Wolfram Sang
  2023-03-16 19:56   ` Sergey Shtylyov
@ 2023-03-16 20:01   ` Florian Fainelli
  2023-03-16 20:06     ` Wolfram Sang
  1 sibling, 1 reply; 9+ messages in thread
From: Florian Fainelli @ 2023-03-16 20:01 UTC (permalink / raw)
  To: Wolfram Sang, netdev
  Cc: linux-renesas-soc, Heiner Kallweit, Michal Kubiak,
	Sergey Shtylyov, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Geert Uytterhoeven, linux-kernel

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 <hkallweit1@gmail.com>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> Reviewed-by: Michal Kubiak <michal.kubiak@intel.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net v2 1/2] ravb: avoid PHY being resumed when interface is not up
  2023-03-16 20:01   ` Florian Fainelli
@ 2023-03-16 20:06     ` Wolfram Sang
  2023-03-16 20:07       ` Florian Fainelli
  0 siblings, 1 reply; 9+ messages in thread
From: Wolfram Sang @ 2023-03-16 20:06 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: netdev, linux-renesas-soc, Heiner Kallweit, Michal Kubiak,
	Sergey Shtylyov, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Geert Uytterhoeven, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 505 bytes --]


> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

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.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net v2 1/2] ravb: avoid PHY being resumed when interface is not up
  2023-03-16 20:06     ` Wolfram Sang
@ 2023-03-16 20:07       ` Florian Fainelli
  0 siblings, 0 replies; 9+ messages in thread
From: Florian Fainelli @ 2023-03-16 20:07 UTC (permalink / raw)
  To: Wolfram Sang, netdev, linux-renesas-soc, Heiner Kallweit,
	Michal Kubiak, Sergey Shtylyov, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Geert Uytterhoeven, linux-kernel

On 3/16/23 13:06, Wolfram Sang wrote:
> 
>> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
> 
> 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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net v2 0/2] net: renesas: set 'mac_managed_pm' at probe time
  2023-03-15  7:41 [PATCH net v2 0/2] net: renesas: set 'mac_managed_pm' at probe time Wolfram Sang
  2023-03-15  7:41 ` [PATCH net v2 1/2] ravb: avoid PHY being resumed when interface is not up Wolfram Sang
  2023-03-15  7:41 ` [PATCH net v2 2/2] sh_eth: " Wolfram Sang
@ 2023-03-17  0:30 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 9+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-03-17  0:30 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: netdev, linux-renesas-soc

Hello:

This series was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 15 Mar 2023 08:41:13 +0100 you wrote:
> 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.
> 
> Changes since v1:
> * added tag from Michal (thanks!)
> * split out patches which are for 'net' only (Thanks, Simon!)
> 
> [...]

Here is the summary with links:
  - [net,v2,1/2] ravb: avoid PHY being resumed when interface is not up
    https://git.kernel.org/netdev/net/c/7f5ebf5dae42
  - [net,v2,2/2] sh_eth: avoid PHY being resumed when interface is not up
    https://git.kernel.org/netdev/net/c/c6be7136afb2

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-03-17  0:30 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-15  7:41 [PATCH net v2 0/2] net: renesas: set 'mac_managed_pm' at probe time Wolfram Sang
2023-03-15  7:41 ` [PATCH net v2 1/2] ravb: avoid PHY being resumed when interface is not up Wolfram Sang
2023-03-16 19:56   ` Sergey Shtylyov
2023-03-16 20:01   ` Florian Fainelli
2023-03-16 20:06     ` Wolfram Sang
2023-03-16 20:07       ` Florian Fainelli
2023-03-15  7:41 ` [PATCH net v2 2/2] sh_eth: " Wolfram Sang
2023-03-16 19:58   ` Sergey Shtylyov
2023-03-17  0:30 ` [PATCH net v2 0/2] net: renesas: set 'mac_managed_pm' at probe time patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.