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

net: phy: aquantia: 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: Heiner Kallweit <hkallweit1@gmail.com>
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
6ab930df 30446ae4

+27
+27
drivers/net/phy/aquantia_main.c
··· 52 52 #define MDIO_AN_TX_VEND_INT_STATUS1_DOWNSHIFT BIT(1) 53 53 54 54 #define MDIO_AN_TX_VEND_INT_STATUS2 0xcc01 55 + #define MDIO_AN_TX_VEND_INT_STATUS2_MASK BIT(0) 55 56 56 57 #define MDIO_AN_TX_VEND_INT_MASK2 0xd401 57 58 #define MDIO_AN_TX_VEND_INT_MASK2_LINK BIT(0) ··· 269 268 reg = phy_read_mmd(phydev, MDIO_MMD_AN, 270 269 MDIO_AN_TX_VEND_INT_STATUS2); 271 270 return (reg < 0) ? reg : 0; 271 + } 272 + 273 + static irqreturn_t aqr_handle_interrupt(struct phy_device *phydev) 274 + { 275 + int irq_status; 276 + 277 + irq_status = phy_read_mmd(phydev, MDIO_MMD_AN, 278 + MDIO_AN_TX_VEND_INT_STATUS2); 279 + if (irq_status < 0) { 280 + phy_error(phydev); 281 + return IRQ_NONE; 282 + } 283 + 284 + if (!(irq_status & MDIO_AN_TX_VEND_INT_STATUS2_MASK)) 285 + return IRQ_NONE; 286 + 287 + phy_trigger_machine(phydev); 288 + 289 + return IRQ_HANDLED; 272 290 } 273 291 274 292 static int aqr_read_status(struct phy_device *phydev) ··· 605 585 .config_aneg = aqr_config_aneg, 606 586 .config_intr = aqr_config_intr, 607 587 .ack_interrupt = aqr_ack_interrupt, 588 + .handle_interrupt = aqr_handle_interrupt, 608 589 .read_status = aqr_read_status, 609 590 }, 610 591 { ··· 614 593 .config_aneg = aqr_config_aneg, 615 594 .config_intr = aqr_config_intr, 616 595 .ack_interrupt = aqr_ack_interrupt, 596 + .handle_interrupt = aqr_handle_interrupt, 617 597 .read_status = aqr_read_status, 618 598 }, 619 599 { ··· 623 601 .config_aneg = aqr_config_aneg, 624 602 .config_intr = aqr_config_intr, 625 603 .ack_interrupt = aqr_ack_interrupt, 604 + .handle_interrupt = aqr_handle_interrupt, 626 605 .read_status = aqr_read_status, 627 606 .suspend = aqr107_suspend, 628 607 .resume = aqr107_resume, ··· 634 611 .config_aneg = aqr_config_aneg, 635 612 .config_intr = aqr_config_intr, 636 613 .ack_interrupt = aqr_ack_interrupt, 614 + .handle_interrupt = aqr_handle_interrupt, 637 615 .read_status = aqr_read_status, 638 616 }, 639 617 { ··· 645 621 .config_aneg = aqr_config_aneg, 646 622 .config_intr = aqr_config_intr, 647 623 .ack_interrupt = aqr_ack_interrupt, 624 + .handle_interrupt = aqr_handle_interrupt, 648 625 .read_status = aqr107_read_status, 649 626 .get_tunable = aqr107_get_tunable, 650 627 .set_tunable = aqr107_set_tunable, ··· 664 639 .config_aneg = aqr_config_aneg, 665 640 .config_intr = aqr_config_intr, 666 641 .ack_interrupt = aqr_ack_interrupt, 642 + .handle_interrupt = aqr_handle_interrupt, 667 643 .read_status = aqr107_read_status, 668 644 .get_tunable = aqr107_get_tunable, 669 645 .set_tunable = aqr107_set_tunable, ··· 681 655 .config_aneg = aqr_config_aneg, 682 656 .config_intr = aqr_config_intr, 683 657 .ack_interrupt = aqr_ack_interrupt, 658 + .handle_interrupt = aqr_handle_interrupt, 684 659 .read_status = aqr_read_status, 685 660 }, 686 661 };