All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: phy: micrel: use kszphy_suspend()/kszphy_resume for irq aware devices
@ 2022-01-18 11:08 Claudiu Beznea
  2022-01-18 13:36 ` Andrew Lunn
  2022-01-19 14:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Claudiu Beznea @ 2022-01-18 11:08 UTC (permalink / raw)
  To: andrew, hkallweit1, linux, davem, kuba, ioana.ciornei
  Cc: netdev, linux-kernel, Claudiu Beznea

On a setup with KSZ9131 and MACB drivers it happens on suspend path, from
time to time, that the PHY interrupt arrives after PHY and MACB were
suspended (PHY via genphy_suspend(), MACB via macb_suspend()). In this
case the phy_read() at the beginning of kszphy_handle_interrupt() will
fail (as MACB driver is suspended at this time) leading to phy_error()
being called and a stack trace being displayed on console. To solve this
.suspend/.resume functions for all KSZ devices implementing
.handle_interrupt were replaced with kszphy_suspend()/kszphy_resume()
which disable/enable interrupt before/after calling
genphy_suspend()/genphy_resume().

The fix has been adapted for all KSZ devices which implements
.handle_interrupt but it has been tested only on KSZ9131.

Fixes: 59ca4e58b917 ("net: phy: micrel: implement generic .handle_interrupt() callback")
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 drivers/net/phy/micrel.c | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index aec0fcefdccd..e2ac61f44c94 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -1547,8 +1547,8 @@ static struct phy_driver ksphy_driver[] = {
 	.config_init	= kszphy_config_init,
 	.config_intr	= kszphy_config_intr,
 	.handle_interrupt = kszphy_handle_interrupt,
-	.suspend	= genphy_suspend,
-	.resume		= genphy_resume,
+	.suspend	= kszphy_suspend,
+	.resume		= kszphy_resume,
 }, {
 	.phy_id		= PHY_ID_KSZ8021,
 	.phy_id_mask	= 0x00ffffff,
@@ -1562,8 +1562,8 @@ static struct phy_driver ksphy_driver[] = {
 	.get_sset_count = kszphy_get_sset_count,
 	.get_strings	= kszphy_get_strings,
 	.get_stats	= kszphy_get_stats,
-	.suspend	= genphy_suspend,
-	.resume		= genphy_resume,
+	.suspend	= kszphy_suspend,
+	.resume		= kszphy_resume,
 }, {
 	.phy_id		= PHY_ID_KSZ8031,
 	.phy_id_mask	= 0x00ffffff,
@@ -1577,8 +1577,8 @@ static struct phy_driver ksphy_driver[] = {
 	.get_sset_count = kszphy_get_sset_count,
 	.get_strings	= kszphy_get_strings,
 	.get_stats	= kszphy_get_stats,
-	.suspend	= genphy_suspend,
-	.resume		= genphy_resume,
+	.suspend	= kszphy_suspend,
+	.resume		= kszphy_resume,
 }, {
 	.phy_id		= PHY_ID_KSZ8041,
 	.phy_id_mask	= MICREL_PHY_ID_MASK,
@@ -1609,8 +1609,8 @@ static struct phy_driver ksphy_driver[] = {
 	.get_sset_count = kszphy_get_sset_count,
 	.get_strings	= kszphy_get_strings,
 	.get_stats	= kszphy_get_stats,
-	.suspend	= genphy_suspend,
-	.resume		= genphy_resume,
+	.suspend	= kszphy_suspend,
+	.resume		= kszphy_resume,
 }, {
 	.name		= "Micrel KSZ8051",
 	/* PHY_BASIC_FEATURES */
@@ -1623,8 +1623,8 @@ static struct phy_driver ksphy_driver[] = {
 	.get_strings	= kszphy_get_strings,
 	.get_stats	= kszphy_get_stats,
 	.match_phy_device = ksz8051_match_phy_device,
-	.suspend	= genphy_suspend,
-	.resume		= genphy_resume,
+	.suspend	= kszphy_suspend,
+	.resume		= kszphy_resume,
 }, {
 	.phy_id		= PHY_ID_KSZ8001,
 	.name		= "Micrel KSZ8001 or KS8721",
@@ -1638,8 +1638,8 @@ static struct phy_driver ksphy_driver[] = {
 	.get_sset_count = kszphy_get_sset_count,
 	.get_strings	= kszphy_get_strings,
 	.get_stats	= kszphy_get_stats,
-	.suspend	= genphy_suspend,
-	.resume		= genphy_resume,
+	.suspend	= kszphy_suspend,
+	.resume		= kszphy_resume,
 }, {
 	.phy_id		= PHY_ID_KSZ8081,
 	.name		= "Micrel KSZ8081 or KSZ8091",
@@ -1669,8 +1669,8 @@ static struct phy_driver ksphy_driver[] = {
 	.config_init	= ksz8061_config_init,
 	.config_intr	= kszphy_config_intr,
 	.handle_interrupt = kszphy_handle_interrupt,
-	.suspend	= genphy_suspend,
-	.resume		= genphy_resume,
+	.suspend	= kszphy_suspend,
+	.resume		= kszphy_resume,
 }, {
 	.phy_id		= PHY_ID_KSZ9021,
 	.phy_id_mask	= 0x000ffffe,
@@ -1685,8 +1685,8 @@ static struct phy_driver ksphy_driver[] = {
 	.get_sset_count = kszphy_get_sset_count,
 	.get_strings	= kszphy_get_strings,
 	.get_stats	= kszphy_get_stats,
-	.suspend	= genphy_suspend,
-	.resume		= genphy_resume,
+	.suspend	= kszphy_suspend,
+	.resume		= kszphy_resume,
 	.read_mmd	= genphy_read_mmd_unsupported,
 	.write_mmd	= genphy_write_mmd_unsupported,
 }, {
@@ -1704,7 +1704,7 @@ static struct phy_driver ksphy_driver[] = {
 	.get_sset_count = kszphy_get_sset_count,
 	.get_strings	= kszphy_get_strings,
 	.get_stats	= kszphy_get_stats,
-	.suspend	= genphy_suspend,
+	.suspend	= kszphy_suspend,
 	.resume		= kszphy_resume,
 }, {
 	.phy_id		= PHY_ID_LAN8814,
@@ -1732,7 +1732,7 @@ static struct phy_driver ksphy_driver[] = {
 	.get_sset_count = kszphy_get_sset_count,
 	.get_strings	= kszphy_get_strings,
 	.get_stats	= kszphy_get_stats,
-	.suspend	= genphy_suspend,
+	.suspend	= kszphy_suspend,
 	.resume		= kszphy_resume,
 }, {
 	.phy_id		= PHY_ID_KSZ8873MLL,
-- 
2.32.0


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

* Re: [PATCH] net: phy: micrel: use kszphy_suspend()/kszphy_resume for irq aware devices
  2022-01-18 11:08 [PATCH] net: phy: micrel: use kszphy_suspend()/kszphy_resume for irq aware devices Claudiu Beznea
@ 2022-01-18 13:36 ` Andrew Lunn
  2022-01-19 14:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2022-01-18 13:36 UTC (permalink / raw)
  To: Claudiu Beznea
  Cc: hkallweit1, linux, davem, kuba, ioana.ciornei, netdev, linux-kernel

On Tue, Jan 18, 2022 at 01:08:12PM +0200, Claudiu Beznea wrote:
> On a setup with KSZ9131 and MACB drivers it happens on suspend path, from
> time to time, that the PHY interrupt arrives after PHY and MACB were
> suspended (PHY via genphy_suspend(), MACB via macb_suspend()). In this
> case the phy_read() at the beginning of kszphy_handle_interrupt() will
> fail (as MACB driver is suspended at this time) leading to phy_error()
> being called and a stack trace being displayed on console. To solve this
> .suspend/.resume functions for all KSZ devices implementing
> .handle_interrupt were replaced with kszphy_suspend()/kszphy_resume()
> which disable/enable interrupt before/after calling
> genphy_suspend()/genphy_resume().
> 
> The fix has been adapted for all KSZ devices which implements
> .handle_interrupt but it has been tested only on KSZ9131.
> 
> Fixes: 59ca4e58b917 ("net: phy: micrel: implement generic .handle_interrupt() callback")
> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH] net: phy: micrel: use kszphy_suspend()/kszphy_resume for irq aware devices
  2022-01-18 11:08 [PATCH] net: phy: micrel: use kszphy_suspend()/kszphy_resume for irq aware devices Claudiu Beznea
  2022-01-18 13:36 ` Andrew Lunn
@ 2022-01-19 14:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-01-19 14:30 UTC (permalink / raw)
  To: Claudiu Beznea
  Cc: andrew, hkallweit1, linux, davem, kuba, ioana.ciornei, netdev,
	linux-kernel

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Tue, 18 Jan 2022 13:08:12 +0200 you wrote:
> On a setup with KSZ9131 and MACB drivers it happens on suspend path, from
> time to time, that the PHY interrupt arrives after PHY and MACB were
> suspended (PHY via genphy_suspend(), MACB via macb_suspend()). In this
> case the phy_read() at the beginning of kszphy_handle_interrupt() will
> fail (as MACB driver is suspended at this time) leading to phy_error()
> being called and a stack trace being displayed on console. To solve this
> .suspend/.resume functions for all KSZ devices implementing
> .handle_interrupt were replaced with kszphy_suspend()/kszphy_resume()
> which disable/enable interrupt before/after calling
> genphy_suspend()/genphy_resume().
> 
> [...]

Here is the summary with links:
  - net: phy: micrel: use kszphy_suspend()/kszphy_resume for irq aware devices
    https://git.kernel.org/netdev/net/c/f1131b9c23fb

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] 3+ messages in thread

end of thread, other threads:[~2022-01-19 14:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-18 11:08 [PATCH] net: phy: micrel: use kszphy_suspend()/kszphy_resume for irq aware devices Claudiu Beznea
2022-01-18 13:36 ` Andrew Lunn
2022-01-19 14:30 ` 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.