Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: phy: nxp-tja11xx: implement generic .handle_interrupt() callback

In an attempt to actually support shared IRQs in phylib, we now move the
responsibility of triggering the phylib state machine or just returning
IRQ_NONE, based on the IRQ status register, to the PHY driver. Having
3 different IRQ handling callbacks (.handle_interrupt(),
.did_interrupt() and .ack_interrupt() ) is confusing so let the PHY
driver implement directly an IRQ handler like any other device driver.
Make this driver follow the new convention.

Cc: Marek Vasut <marex@denx.de>
Cc: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Ioana Ciornei and committed by
Jakub Kicinski
52b1984a 9a12dd6f

+23
+23
drivers/net/phy/nxp-tja11xx.c
··· 44 44 #define MII_CFG2_SLEEP_REQUEST_TO_16MS 0x3 45 45 46 46 #define MII_INTSRC 21 47 + #define MII_INTSRC_LINK_FAIL BIT(10) 48 + #define MII_INTSRC_LINK_UP BIT(9) 49 + #define MII_INTSRC_MASK (MII_INTSRC_LINK_FAIL | MII_INTSRC_LINK_UP) 47 50 #define MII_INTSRC_TEMP_ERR BIT(1) 48 51 #define MII_INTSRC_UV_ERR BIT(3) 49 52 ··· 607 604 return phy_write(phydev, MII_INTEN, value); 608 605 } 609 606 607 + static irqreturn_t tja11xx_handle_interrupt(struct phy_device *phydev) 608 + { 609 + int irq_status; 610 + 611 + irq_status = phy_read(phydev, MII_INTSRC); 612 + if (irq_status < 0) { 613 + phy_error(phydev); 614 + return IRQ_NONE; 615 + } 616 + 617 + if (!(irq_status & MII_INTSRC_MASK)) 618 + return IRQ_NONE; 619 + 620 + phy_trigger_machine(phydev); 621 + 622 + return IRQ_HANDLED; 623 + } 624 + 610 625 static int tja11xx_cable_test_start(struct phy_device *phydev) 611 626 { 612 627 int ret; ··· 770 749 .get_stats = tja11xx_get_stats, 771 750 .ack_interrupt = tja11xx_ack_interrupt, 772 751 .config_intr = tja11xx_config_intr, 752 + .handle_interrupt = tja11xx_handle_interrupt, 773 753 .cable_test_start = tja11xx_cable_test_start, 774 754 .cable_test_get_status = tja11xx_cable_test_get_status, 775 755 }, { ··· 794 772 .get_stats = tja11xx_get_stats, 795 773 .ack_interrupt = tja11xx_ack_interrupt, 796 774 .config_intr = tja11xx_config_intr, 775 + .handle_interrupt = tja11xx_handle_interrupt, 797 776 .cable_test_start = tja11xx_cable_test_start, 798 777 .cable_test_get_status = tja11xx_cable_test_get_status, 799 778 }