Commit 36b25c26 authored by Ioana Ciornei's avatar Ioana Ciornei Committed by Jakub Kicinski

net: phy: smsc: 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: Andre Edich <andre.edich@microchip.com>
Cc: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 347917c7
...@@ -72,6 +72,30 @@ static int smsc_phy_ack_interrupt(struct phy_device *phydev) ...@@ -72,6 +72,30 @@ static int smsc_phy_ack_interrupt(struct phy_device *phydev)
return rc < 0 ? rc : 0; return rc < 0 ? rc : 0;
} }
static irqreturn_t smsc_phy_handle_interrupt(struct phy_device *phydev)
{
int irq_status, irq_enabled;
irq_enabled = phy_read(phydev, MII_LAN83C185_IM);
if (irq_enabled < 0) {
phy_error(phydev);
return IRQ_NONE;
}
irq_status = phy_read(phydev, MII_LAN83C185_ISF);
if (irq_status < 0) {
phy_error(phydev);
return IRQ_NONE;
}
if (!(irq_status & irq_enabled))
return IRQ_NONE;
phy_trigger_machine(phydev);
return IRQ_HANDLED;
}
static int smsc_phy_config_init(struct phy_device *phydev) static int smsc_phy_config_init(struct phy_device *phydev)
{ {
struct smsc_phy_priv *priv = phydev->priv; struct smsc_phy_priv *priv = phydev->priv;
...@@ -314,6 +338,7 @@ static struct phy_driver smsc_phy_driver[] = { ...@@ -314,6 +338,7 @@ static struct phy_driver smsc_phy_driver[] = {
/* IRQ related */ /* IRQ related */
.ack_interrupt = smsc_phy_ack_interrupt, .ack_interrupt = smsc_phy_ack_interrupt,
.config_intr = smsc_phy_config_intr, .config_intr = smsc_phy_config_intr,
.handle_interrupt = smsc_phy_handle_interrupt,
.suspend = genphy_suspend, .suspend = genphy_suspend,
.resume = genphy_resume, .resume = genphy_resume,
...@@ -333,6 +358,7 @@ static struct phy_driver smsc_phy_driver[] = { ...@@ -333,6 +358,7 @@ static struct phy_driver smsc_phy_driver[] = {
/* IRQ related */ /* IRQ related */
.ack_interrupt = smsc_phy_ack_interrupt, .ack_interrupt = smsc_phy_ack_interrupt,
.config_intr = smsc_phy_config_intr, .config_intr = smsc_phy_config_intr,
.handle_interrupt = smsc_phy_handle_interrupt,
/* Statistics */ /* Statistics */
.get_sset_count = smsc_get_sset_count, .get_sset_count = smsc_get_sset_count,
...@@ -362,6 +388,7 @@ static struct phy_driver smsc_phy_driver[] = { ...@@ -362,6 +388,7 @@ static struct phy_driver smsc_phy_driver[] = {
/* IRQ related */ /* IRQ related */
.ack_interrupt = smsc_phy_ack_interrupt, .ack_interrupt = smsc_phy_ack_interrupt,
.config_intr = smsc_phy_config_intr, .config_intr = smsc_phy_config_intr,
.handle_interrupt = smsc_phy_handle_interrupt,
/* Statistics */ /* Statistics */
.get_sset_count = smsc_get_sset_count, .get_sset_count = smsc_get_sset_count,
...@@ -385,6 +412,7 @@ static struct phy_driver smsc_phy_driver[] = { ...@@ -385,6 +412,7 @@ static struct phy_driver smsc_phy_driver[] = {
/* IRQ related */ /* IRQ related */
.ack_interrupt = smsc_phy_ack_interrupt, .ack_interrupt = smsc_phy_ack_interrupt,
.config_intr = smsc_phy_config_intr, .config_intr = smsc_phy_config_intr,
.handle_interrupt = smsc_phy_handle_interrupt,
.suspend = genphy_suspend, .suspend = genphy_suspend,
.resume = genphy_resume, .resume = genphy_resume,
...@@ -410,6 +438,7 @@ static struct phy_driver smsc_phy_driver[] = { ...@@ -410,6 +438,7 @@ static struct phy_driver smsc_phy_driver[] = {
/* IRQ related */ /* IRQ related */
.ack_interrupt = smsc_phy_ack_interrupt, .ack_interrupt = smsc_phy_ack_interrupt,
.config_intr = smsc_phy_config_intr, .config_intr = smsc_phy_config_intr,
.handle_interrupt = smsc_phy_handle_interrupt,
/* Statistics */ /* Statistics */
.get_sset_count = smsc_get_sset_count, .get_sset_count = smsc_get_sset_count,
...@@ -436,6 +465,7 @@ static struct phy_driver smsc_phy_driver[] = { ...@@ -436,6 +465,7 @@ static struct phy_driver smsc_phy_driver[] = {
/* IRQ related */ /* IRQ related */
.ack_interrupt = smsc_phy_ack_interrupt, .ack_interrupt = smsc_phy_ack_interrupt,
.config_intr = smsc_phy_config_intr, .config_intr = smsc_phy_config_intr,
.handle_interrupt = smsc_phy_handle_interrupt,
/* Statistics */ /* Statistics */
.get_sset_count = smsc_get_sset_count, .get_sset_count = smsc_get_sset_count,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment