Skip to content

Commit 6719e2b

Browse files
IoanaCiorneikuba-moo
authored andcommitted
net: phy: meson-gxl: 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: Jerome Brunet <[email protected]> Cc: Neil Armstrong <[email protected]> Signed-off-by: Ioana Ciornei <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 12ae7ba commit 6719e2b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

drivers/net/phy/meson-gxl.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,24 @@ static int meson_gxl_config_intr(struct phy_device *phydev)
222222
return phy_write(phydev, INTSRC_MASK, val);
223223
}
224224

225+
static irqreturn_t meson_gxl_handle_interrupt(struct phy_device *phydev)
226+
{
227+
int irq_status;
228+
229+
irq_status = phy_read(phydev, INTSRC_FLAG);
230+
if (irq_status < 0) {
231+
phy_error(phydev);
232+
return IRQ_NONE;
233+
}
234+
235+
if (irq_status == 0)
236+
return IRQ_NONE;
237+
238+
phy_trigger_machine(phydev);
239+
240+
return IRQ_HANDLED;
241+
}
242+
225243
static struct phy_driver meson_gxl_phy[] = {
226244
{
227245
PHY_ID_MATCH_EXACT(0x01814400),
@@ -233,6 +251,7 @@ static struct phy_driver meson_gxl_phy[] = {
233251
.read_status = meson_gxl_read_status,
234252
.ack_interrupt = meson_gxl_ack_interrupt,
235253
.config_intr = meson_gxl_config_intr,
254+
.handle_interrupt = meson_gxl_handle_interrupt,
236255
.suspend = genphy_suspend,
237256
.resume = genphy_resume,
238257
}, {
@@ -243,6 +262,7 @@ static struct phy_driver meson_gxl_phy[] = {
243262
.soft_reset = genphy_soft_reset,
244263
.ack_interrupt = meson_gxl_ack_interrupt,
245264
.config_intr = meson_gxl_config_intr,
265+
.handle_interrupt = meson_gxl_handle_interrupt,
246266
.suspend = genphy_suspend,
247267
.resume = genphy_resume,
248268
},

0 commit comments

Comments
 (0)