Skip to content

Commit 4cbf8ad

Browse files
pelwellpopcornmix
authored andcommitted
net: lan78xx: Ack pending PHY ints when resetting
lan78xx_link_reset explicitly clears the MAC's view of the PHY's IRQ status. In doing so it potentially leaves the PHY with a pending interrupt that will never be acknowledged, at which point no further interrupts will be generated. Avoid the problem by acknowledging any pending PHY interrupt after clearing the MAC's status bit. See: #2937 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
1 parent f6f7a93 commit 4cbf8ad

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

drivers/net/usb/lan78xx.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1629,7 +1629,16 @@ static int lan78xx_mac_reset(struct lan78xx_net *dev)
16291629
*/
16301630
static int lan78xx_phy_int_ack(struct lan78xx_net *dev)
16311631
{
1632-
return lan78xx_write_reg(dev, INT_STS, INT_STS_PHY_INT_);
1632+
struct phy_device *phydev = dev->net->phydev;
1633+
int ret = lan78xx_write_reg(dev, INT_STS, INT_STS_PHY_INT_);
1634+
1635+
if (unlikely(ret < 0))
1636+
return ret;
1637+
1638+
/* Acknowledge any pending PHY interrupt, lest it be the last */
1639+
phy_read(phydev, LAN88XX_INT_STS);
1640+
1641+
return 0;
16331642
}
16341643

16351644
/* some work can't be done in tasklets, so we use keventd

0 commit comments

Comments
 (0)