Commit 73f476aa authored by Ioana Ciornei's avatar Ioana Ciornei Committed by Jakub Kicinski

net: phy: ti: take into account all possible interrupt sources

The previous implementation of .handle_interrupt() did not take into
account the fact that all the interrupt status registers should be
acknowledged since multiple interrupt sources could be asserted.

Fix this by reading all the status registers before exiting with
IRQ_NONE or triggering the PHY state machine.

Fixes: 1d1ae3c6 ("net: phy: ti: implement generic .handle_interrupt() callback")
Reported-by: default avatarSven Schuchmann <schuchmann@schleissheimer.de>
Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
Link: https://lore.kernel.org/r/20210226153020.867852-1-ciorneiioana@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 447621e3
...@@ -290,6 +290,7 @@ static int dp83822_config_intr(struct phy_device *phydev) ...@@ -290,6 +290,7 @@ static int dp83822_config_intr(struct phy_device *phydev)
static irqreturn_t dp83822_handle_interrupt(struct phy_device *phydev) static irqreturn_t dp83822_handle_interrupt(struct phy_device *phydev)
{ {
bool trigger_machine = false;
int irq_status; int irq_status;
/* The MISR1 and MISR2 registers are holding the interrupt status in /* The MISR1 and MISR2 registers are holding the interrupt status in
...@@ -305,7 +306,7 @@ static irqreturn_t dp83822_handle_interrupt(struct phy_device *phydev) ...@@ -305,7 +306,7 @@ static irqreturn_t dp83822_handle_interrupt(struct phy_device *phydev)
return IRQ_NONE; return IRQ_NONE;
} }
if (irq_status & ((irq_status & GENMASK(7, 0)) << 8)) if (irq_status & ((irq_status & GENMASK(7, 0)) << 8))
goto trigger_machine; trigger_machine = true;
irq_status = phy_read(phydev, MII_DP83822_MISR2); irq_status = phy_read(phydev, MII_DP83822_MISR2);
if (irq_status < 0) { if (irq_status < 0) {
...@@ -313,11 +314,11 @@ static irqreturn_t dp83822_handle_interrupt(struct phy_device *phydev) ...@@ -313,11 +314,11 @@ static irqreturn_t dp83822_handle_interrupt(struct phy_device *phydev)
return IRQ_NONE; return IRQ_NONE;
} }
if (irq_status & ((irq_status & GENMASK(7, 0)) << 8)) if (irq_status & ((irq_status & GENMASK(7, 0)) << 8))
goto trigger_machine; trigger_machine = true;
if (!trigger_machine)
return IRQ_NONE; return IRQ_NONE;
trigger_machine:
phy_trigger_machine(phydev); phy_trigger_machine(phydev);
return IRQ_HANDLED; return IRQ_HANDLED;
......
...@@ -264,6 +264,7 @@ static int dp83811_config_intr(struct phy_device *phydev) ...@@ -264,6 +264,7 @@ static int dp83811_config_intr(struct phy_device *phydev)
static irqreturn_t dp83811_handle_interrupt(struct phy_device *phydev) static irqreturn_t dp83811_handle_interrupt(struct phy_device *phydev)
{ {
bool trigger_machine = false;
int irq_status; int irq_status;
/* The INT_STAT registers 1, 2 and 3 are holding the interrupt status /* The INT_STAT registers 1, 2 and 3 are holding the interrupt status
...@@ -279,7 +280,7 @@ static irqreturn_t dp83811_handle_interrupt(struct phy_device *phydev) ...@@ -279,7 +280,7 @@ static irqreturn_t dp83811_handle_interrupt(struct phy_device *phydev)
return IRQ_NONE; return IRQ_NONE;
} }
if (irq_status & ((irq_status & GENMASK(7, 0)) << 8)) if (irq_status & ((irq_status & GENMASK(7, 0)) << 8))
goto trigger_machine; trigger_machine = true;
irq_status = phy_read(phydev, MII_DP83811_INT_STAT2); irq_status = phy_read(phydev, MII_DP83811_INT_STAT2);
if (irq_status < 0) { if (irq_status < 0) {
...@@ -287,7 +288,7 @@ static irqreturn_t dp83811_handle_interrupt(struct phy_device *phydev) ...@@ -287,7 +288,7 @@ static irqreturn_t dp83811_handle_interrupt(struct phy_device *phydev)
return IRQ_NONE; return IRQ_NONE;
} }
if (irq_status & ((irq_status & GENMASK(7, 0)) << 8)) if (irq_status & ((irq_status & GENMASK(7, 0)) << 8))
goto trigger_machine; trigger_machine = true;
irq_status = phy_read(phydev, MII_DP83811_INT_STAT3); irq_status = phy_read(phydev, MII_DP83811_INT_STAT3);
if (irq_status < 0) { if (irq_status < 0) {
...@@ -295,11 +296,11 @@ static irqreturn_t dp83811_handle_interrupt(struct phy_device *phydev) ...@@ -295,11 +296,11 @@ static irqreturn_t dp83811_handle_interrupt(struct phy_device *phydev)
return IRQ_NONE; return IRQ_NONE;
} }
if (irq_status & ((irq_status & GENMASK(7, 0)) << 8)) if (irq_status & ((irq_status & GENMASK(7, 0)) << 8))
goto trigger_machine; trigger_machine = true;
if (!trigger_machine)
return IRQ_NONE; return IRQ_NONE;
trigger_machine:
phy_trigger_machine(phydev); phy_trigger_machine(phydev);
return IRQ_HANDLED; return IRQ_HANDLED;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment