Skip to content

Commit

Permalink
net: phy: ti: take into account all possible interrupt sources
Browse files Browse the repository at this point in the history
[ Upstream commit 73f476a ]

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: 1d1ae3c ("net: phy: ti: implement generic .handle_interrupt() callback")
Reported-by: Sven Schuchmann <schuchmann@schleissheimer.de>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Link: https://lore.kernel.org/r/20210226153020.867852-1-ciorneiioana@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
IoanaCiornei authored and gregkh committed Mar 17, 2021
1 parent 48d541e commit 7af661b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
9 changes: 5 additions & 4 deletions drivers/net/phy/dp83822.c
Expand Up @@ -290,6 +290,7 @@ static int dp83822_config_intr(struct phy_device *phydev)

static irqreturn_t dp83822_handle_interrupt(struct phy_device *phydev)
{
bool trigger_machine = false;
int irq_status;

/* The MISR1 and MISR2 registers are holding the interrupt status in
Expand All @@ -305,19 +306,19 @@ static irqreturn_t dp83822_handle_interrupt(struct phy_device *phydev)
return IRQ_NONE;
}
if (irq_status & ((irq_status & GENMASK(7, 0)) << 8))
goto trigger_machine;
trigger_machine = true;

irq_status = phy_read(phydev, MII_DP83822_MISR2);
if (irq_status < 0) {
phy_error(phydev);
return IRQ_NONE;
}
if (irq_status & ((irq_status & GENMASK(7, 0)) << 8))
goto trigger_machine;
trigger_machine = true;

return IRQ_NONE;
if (!trigger_machine)
return IRQ_NONE;

trigger_machine:
phy_trigger_machine(phydev);

return IRQ_HANDLED;
Expand Down
11 changes: 6 additions & 5 deletions drivers/net/phy/dp83tc811.c
Expand Up @@ -264,6 +264,7 @@ static int dp83811_config_intr(struct phy_device *phydev)

static irqreturn_t dp83811_handle_interrupt(struct phy_device *phydev)
{
bool trigger_machine = false;
int irq_status;

/* The INT_STAT registers 1, 2 and 3 are holding the interrupt status
Expand All @@ -279,27 +280,27 @@ static irqreturn_t dp83811_handle_interrupt(struct phy_device *phydev)
return IRQ_NONE;
}
if (irq_status & ((irq_status & GENMASK(7, 0)) << 8))
goto trigger_machine;
trigger_machine = true;

irq_status = phy_read(phydev, MII_DP83811_INT_STAT2);
if (irq_status < 0) {
phy_error(phydev);
return IRQ_NONE;
}
if (irq_status & ((irq_status & GENMASK(7, 0)) << 8))
goto trigger_machine;
trigger_machine = true;

irq_status = phy_read(phydev, MII_DP83811_INT_STAT3);
if (irq_status < 0) {
phy_error(phydev);
return IRQ_NONE;
}
if (irq_status & ((irq_status & GENMASK(7, 0)) << 8))
goto trigger_machine;
trigger_machine = true;

return IRQ_NONE;
if (!trigger_machine)
return IRQ_NONE;

trigger_machine:
phy_trigger_machine(phydev);

return IRQ_HANDLED;
Expand Down

0 comments on commit 7af661b

Please sign in to comment.