diff options
author | Ioana Ciornei <ioana.ciornei@nxp.com> | 2020-11-13 18:52:25 +0200 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2020-11-17 11:37:05 -0800 |
commit | 66d7439e83607ff8e13a2a6d3337ba26b4fa2b08 (patch) | |
tree | 91b41158ed16dfb82dc8ff2614ea7880be17deac /drivers/net/phy/adin.c | |
parent | e1bc534df8555c5e86b141ece9a2c900e9694882 (diff) | |
download | linux-stable-66d7439e83607ff8e13a2a6d3337ba26b4fa2b08.tar.gz linux-stable-66d7439e83607ff8e13a2a6d3337ba26b4fa2b08.tar.bz2 linux-stable-66d7439e83607ff8e13a2a6d3337ba26b4fa2b08.zip |
net: phy: adin: 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.
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Acked-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/phy/adin.c')
-rw-r--r-- | drivers/net/phy/adin.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/net/phy/adin.c b/drivers/net/phy/adin.c index 3727b38addf7..ba24434b867d 100644 --- a/drivers/net/phy/adin.c +++ b/drivers/net/phy/adin.c @@ -479,6 +479,24 @@ static int adin_phy_config_intr(struct phy_device *phydev) ADIN1300_INT_MASK_EN); } +static irqreturn_t adin_phy_handle_interrupt(struct phy_device *phydev) +{ + int irq_status; + + irq_status = phy_read(phydev, ADIN1300_INT_STATUS_REG); + if (irq_status < 0) { + phy_error(phydev); + return IRQ_NONE; + } + + if (!(irq_status & ADIN1300_INT_LINK_STAT_CHNG_EN)) + return IRQ_NONE; + + phy_trigger_machine(phydev); + + return IRQ_HANDLED; +} + static int adin_cl45_to_adin_reg(struct phy_device *phydev, int devad, u16 cl45_regnum) { @@ -879,6 +897,7 @@ static struct phy_driver adin_driver[] = { .set_tunable = adin_set_tunable, .ack_interrupt = adin_phy_ack_intr, .config_intr = adin_phy_config_intr, + .handle_interrupt = adin_phy_handle_interrupt, .get_sset_count = adin_get_sset_count, .get_strings = adin_get_strings, .get_stats = adin_get_stats, @@ -902,6 +921,7 @@ static struct phy_driver adin_driver[] = { .set_tunable = adin_set_tunable, .ack_interrupt = adin_phy_ack_intr, .config_intr = adin_phy_config_intr, + .handle_interrupt = adin_phy_handle_interrupt, .get_sset_count = adin_get_sset_count, .get_strings = adin_get_strings, .get_stats = adin_get_stats, |