diff options
author | Ioana Ciornei <ioana.ciornei@nxp.com> | 2020-11-23 17:38:13 +0200 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2020-11-25 11:18:38 -0800 |
commit | 1d1ae3c6ca3ff49843d73852bb2a8153ce16f432 (patch) | |
tree | 8896fe2b37b7cf788889c8009de8b225f9083df5 /drivers/net/phy/dp83869.c | |
parent | a4d7742149f6a4880fa8bdf941a40c345162074c (diff) | |
download | linux-stable-1d1ae3c6ca3ff49843d73852bb2a8153ce16f432.tar.gz linux-stable-1d1ae3c6ca3ff49843d73852bb2a8153ce16f432.tar.bz2 linux-stable-1d1ae3c6ca3ff49843d73852bb2a8153ce16f432.zip |
net: phy: ti: 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: Dan Murphy <dmurphy@ti.com>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/phy/dp83869.c')
-rw-r--r-- | drivers/net/phy/dp83869.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/net/phy/dp83869.c b/drivers/net/phy/dp83869.c index cf6dec7b7d8e..487d1b8beec5 100644 --- a/drivers/net/phy/dp83869.c +++ b/drivers/net/phy/dp83869.c @@ -207,6 +207,30 @@ static int dp83869_config_intr(struct phy_device *phydev) return phy_write(phydev, MII_DP83869_MICR, micr_status); } +static irqreturn_t dp83869_handle_interrupt(struct phy_device *phydev) +{ + int irq_status, irq_enabled; + + irq_status = phy_read(phydev, MII_DP83869_ISR); + if (irq_status < 0) { + phy_error(phydev); + return IRQ_NONE; + } + + irq_enabled = phy_read(phydev, MII_DP83869_MICR); + if (irq_enabled < 0) { + phy_error(phydev); + return IRQ_NONE; + } + + if (!(irq_status & irq_enabled)) + return IRQ_NONE; + + phy_trigger_machine(phydev); + + return IRQ_HANDLED; +} + static int dp83869_set_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol) { @@ -852,6 +876,7 @@ static struct phy_driver dp83869_driver[] = { /* IRQ related */ .ack_interrupt = dp83869_ack_interrupt, .config_intr = dp83869_config_intr, + .handle_interrupt = dp83869_handle_interrupt, .read_status = dp83869_read_status, .get_tunable = dp83869_get_tunable, |