Skip to contentSkip to conversation

net: phy: micrel: fix shared interrupt on LAN8814

PATCH Applied Michael Walle 5 participants 5 messages Sep 20, 2022 – Sep 22, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: phy: micrel: fix shared interrupt on LAN8814

Since commit ece19502834d ("net: phy: micrel: 1588 support for LAN8814 phy") the handler always returns IRQ_HANDLED, except in an error case. Before that commit, the interrupt status register was checked and if it was empty, IRQ_NONE was returned. Restore that behavior to play nice with the interrupt line being shared with others.

Fixes ece19502834d ("net: phy: micrel: 1588 support for LAN8814 phy")
---
 drivers/net/phy/micrel.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/net/phy/micrel.c +12 -6
index 98e9bc101d96..21b6facf6e76 100644
@@ -2732,16 +2732,19 @@ static int lan8804_config_intr(struct phy_device *phydev)
 static irqreturn_t lan8814_handle_interrupt(struct phy_device *phydev)
 {
 	int irq_status, tsu_irq_status;
+	int ret = IRQ_NONE;
 
 	irq_status = phy_read(phydev, LAN8814_INTS);
-	if (irq_status > 0 && (irq_status & LAN8814_INT_LINK))
-		phy_trigger_machine(phydev);
-
 	if (irq_status < 0) {
 		phy_error(phydev);
 		return IRQ_NONE;
 	}
 
+	if (irq_status & LAN8814_INT_LINK) {
+		phy_trigger_machine(phydev);
+		ret = IRQ_HANDLED;
+	}
+
 	while (1) {
 		tsu_irq_status = lanphy_read_page_reg(phydev, 4,
 						      LAN8814_INTR_STS_REG);
@@ -2750,12 +2753,15 @@ static irqreturn_t lan8814_handle_interrupt(struct phy_device *phydev)
 		    (tsu_irq_status & (LAN8814_INTR_STS_REG_1588_TSU0_ |
 				       LAN8814_INTR_STS_REG_1588_TSU1_ |
 				       LAN8814_INTR_STS_REG_1588_TSU2_ |
-				       LAN8814_INTR_STS_REG_1588_TSU3_)))
+				       LAN8814_INTR_STS_REG_1588_TSU3_))) {
 			lan8814_handle_ptp_interrupt(phydev);
-		else
+			ret = IRQ_HANDLED;
+		} else {
 			break;
+		}
 	}
-	return IRQ_HANDLED;
+
+	return ret;
 }
 
 static int lan8814_ack_interrupt(struct phy_device *phydev)
Signature · 1 line
2.30.2
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Michael Walle

Since commit ece19502834d ("net: phy: micrel: 1588 support for LAN8814 phy") the handler always returns IRQ_HANDLED, except in an error case. Before that commit, the interrupt status register was checked and if it was empty, IRQ_NONE was returned. Restore that behavior to play nice with the interrupt line being shared with others.

Fixes ece19502834d ("net: phy: micrel: 1588 support for LAN8814 phy")

Andrew

Reviewed-by on v1 1/1
#2 lore raw
In reply to Michael Walle
Quoted 9 lines · Michael Walle

Since commit ece19502834d ("net: phy: micrel: 1588 support for LAN8814 phy") the handler always returns IRQ_HANDLED, except in an error case. Before that commit, the interrupt status register was checked and if it was empty, IRQ_NONE was returned. Restore that behavior to play nice with the interrupt line being shared with others.

Fixes ece19502834d ("net: phy: micrel: 1588 support for LAN8814 phy")
Quoted 53 lines
---
 drivers/net/phy/micrel.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/net/phy/micrel.c +12 -7
index 98e9bc101d96..21b6facf6e76 100644
@@ -2732,16 +2732,19 @@ static int lan8804_config_intr(struct phy_device *phydev)
 static irqreturn_t lan8814_handle_interrupt(struct phy_device *phydev)
 {
        int irq_status, tsu_irq_status;
+       int ret = IRQ_NONE;
 
        irq_status = phy_read(phydev, LAN8814_INTS);
-       if (irq_status > 0 && (irq_status & LAN8814_INT_LINK))
-               phy_trigger_machine(phydev);
-
        if (irq_status < 0) {
                phy_error(phydev);
                return IRQ_NONE;
        }
 
+       if (irq_status & LAN8814_INT_LINK) {
+               phy_trigger_machine(phydev);
+               ret = IRQ_HANDLED;
+       }
+
        while (1) {
                tsu_irq_status = lanphy_read_page_reg(phydev, 4,
                                                      LAN8814_INTR_STS_REG);
@@ -2750,12 +2753,15 @@ static irqreturn_t lan8814_handle_interrupt(struct phy_device *phydev)
                    (tsu_irq_status & (LAN8814_INTR_STS_REG_1588_TSU0_ |
                                       LAN8814_INTR_STS_REG_1588_TSU1_ |
                                       LAN8814_INTR_STS_REG_1588_TSU2_ |
-                                      LAN8814_INTR_STS_REG_1588_TSU3_)))
+                                      LAN8814_INTR_STS_REG_1588_TSU3_))) {
                        lan8814_handle_ptp_interrupt(phydev);
-               else
+                       ret = IRQ_HANDLED;
+               } else {
                        break;
+               }
        }
-       return IRQ_HANDLED;
+
+       return ret;
 }
 
 static int lan8814_ack_interrupt(struct phy_device *phydev)
--

2.30.2

Signature · 1 line
/Horatiu
Reviewed-by on v1 1/1
#3 lore raw
In reply to Michael Walle
Quoted 76 lines

-----Original Message-----
From: Michael Walle <[email protected]>
Sent: Tuesday, September 20, 2022 7:46 PM
To: Andrew Lunn <[email protected]>; Heiner Kallweit <[email protected]>; Russell King <[email protected]>; David S . Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>
Cc: Divya Koppera - I30481 <[email protected]>; [email protected]; [email protected]; Horatiu Vultur - M31836 <[email protected]>; Michael Walle <[email protected]>
Subject: [PATCH net] net: phy: micrel: fix shared interrupt on LAN8814

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Since commit ece19502834d ("net: phy: micrel: 1588 support for LAN8814 phy") the handler always returns IRQ_HANDLED, except in an error case. Before that commit, the interrupt status register was checked and if it was empty, IRQ_NONE was returned. Restore that behavior to play nice with the interrupt line being shared with others.

Fixes ece19502834d ("net: phy: micrel: 1588 support for LAN8814 phy")
---
 drivers/net/phy/micrel.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/net/phy/micrel.c index renamed from drivers/net/phy/micrel.c +0 -0

98e9bc101d96..21b6facf6e76 100644

drivers/net/phy/micrel.c +6 -3
@@ -2732,16 +2732,19 @@ static int lan8804_config_intr(struct phy_device
 *phydev)  static irqreturn_t lan8814_handle_interrupt(struct phy_device
 *phydev)  {
        int irq_status, tsu_irq_status;
+       int ret = IRQ_NONE;
 
        irq_status = phy_read(phydev, LAN8814_INTS);
-       if (irq_status > 0 && (irq_status & LAN8814_INT_LINK))
-               phy_trigger_machine(phydev);
-
        if (irq_status < 0) {
                phy_error(phydev);
                return IRQ_NONE;
        }
 
+       if (irq_status & LAN8814_INT_LINK) {
+               phy_trigger_machine(phydev);
+               ret = IRQ_HANDLED;
+       }
+
        while (1) {
                tsu_irq_status = lanphy_read_page_reg(phydev, 4,
                                                      LAN8814_INTR_STS_REG); @@ -2750,12 +2753,15

@@ static irqreturn_t lan8814_handle_interrupt(struct phy_device *phydev)

                    (tsu_irq_status & (LAN8814_INTR_STS_REG_1588_TSU0_ |
                                       LAN8814_INTR_STS_REG_1588_TSU1_ |
                                       LAN8814_INTR_STS_REG_1588_TSU2_ |
drivers/net/phy/micrel.c +7 -4
-                                      LAN8814_INTR_STS_REG_1588_TSU3_)))
+
+ LAN8814_INTR_STS_REG_1588_TSU3_))) {
                        lan8814_handle_ptp_interrupt(phydev);
-               else
+                       ret = IRQ_HANDLED;
+               } else {
                        break;
+               }
        }
-       return IRQ_HANDLED;
+
+       return ret;
 }
 
 static int lan8814_ack_interrupt(struct phy_device *phydev)
--
Quoted 1 line

2.30.2

#4 lore raw
In reply to Michael Walle
This patch was applied to netdev/net.git (master) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Tue, 20 Sep 2022 16:16:19 +0200 you wrote:

Since commit ece19502834d ("net: phy: micrel: 1588 support for LAN8814 phy") the handler always returns IRQ_HANDLED, except in an error case. Before that commit, the interrupt status register was checked and if it was empty, IRQ_NONE was returned. Restore that behavior to play nice with the interrupt line being shared with others.

Fixes ece19502834d ("net: phy: micrel: 1588 support for LAN8814 phy")

[...]

Here is the summary with links:
- [net] net: phy: micrel: fix shared interrupt on LAN8814

    https://git.kernel.org/netdev/net/c/2002fbac743b

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html