diff options
Diffstat (limited to 'drivers/net/phy/meson-gxl.c')
-rw-r--r-- | drivers/net/phy/meson-gxl.c | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/drivers/net/phy/meson-gxl.c b/drivers/net/phy/meson-gxl.c index e8f2ca625837..7e7904fee1d9 100644 --- a/drivers/net/phy/meson-gxl.c +++ b/drivers/net/phy/meson-gxl.c @@ -204,22 +204,45 @@ static int meson_gxl_config_intr(struct phy_device *phydev) int ret; if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { + /* Ack any pending IRQ */ + ret = meson_gxl_ack_interrupt(phydev); + if (ret) + return ret; + val = INTSRC_ANEG_PR | INTSRC_PARALLEL_FAULT | INTSRC_ANEG_LP_ACK | INTSRC_LINK_DOWN | INTSRC_REMOTE_FAULT | INTSRC_ANEG_COMPLETE; + ret = phy_write(phydev, INTSRC_MASK, val); } else { val = 0; + ret = phy_write(phydev, INTSRC_MASK, val); + + /* Ack any pending IRQ */ + ret = meson_gxl_ack_interrupt(phydev); } - /* Ack any pending IRQ */ - ret = meson_gxl_ack_interrupt(phydev); - if (ret) - return ret; + return ret; +} + +static irqreturn_t meson_gxl_handle_interrupt(struct phy_device *phydev) +{ + int irq_status; + + irq_status = phy_read(phydev, INTSRC_FLAG); + if (irq_status < 0) { + phy_error(phydev); + return IRQ_NONE; + } + + if (irq_status == 0) + return IRQ_NONE; + + phy_trigger_machine(phydev); - return phy_write(phydev, INTSRC_MASK, val); + return IRQ_HANDLED; } static struct phy_driver meson_gxl_phy[] = { @@ -231,8 +254,8 @@ static struct phy_driver meson_gxl_phy[] = { .soft_reset = genphy_soft_reset, .config_init = meson_gxl_config_init, .read_status = meson_gxl_read_status, - .ack_interrupt = meson_gxl_ack_interrupt, .config_intr = meson_gxl_config_intr, + .handle_interrupt = meson_gxl_handle_interrupt, .suspend = genphy_suspend, .resume = genphy_resume, }, { @@ -241,8 +264,8 @@ static struct phy_driver meson_gxl_phy[] = { /* PHY_BASIC_FEATURES */ .flags = PHY_IS_INTERNAL, .soft_reset = genphy_soft_reset, - .ack_interrupt = meson_gxl_ack_interrupt, .config_intr = meson_gxl_config_intr, + .handle_interrupt = meson_gxl_handle_interrupt, .suspend = genphy_suspend, .resume = genphy_resume, }, |