Commit aa2d603a authored by Ioana Ciornei's avatar Ioana Ciornei Committed by Jakub Kicinski

net: phy: ti: remove the use of .ack_interrupt()

In preparation of removing the .ack_interrupt() callback, we must replace
its occurrences (aka phy_clear_interrupt), from the 2 places where it is
called from (phy_enable_interrupts and phy_disable_interrupts), with
equivalent functionality.

This means that clearing interrupts now becomes something that the PHY
driver is responsible of doing, before enabling interrupts and after
clearing them. Make this driver follow the new contract.

Cc: Dan Murphy <dmurphy@ti.com>
Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 1d1ae3c6
......@@ -1159,6 +1159,10 @@ static int dp83640_config_intr(struct phy_device *phydev)
int err;
if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
err = dp83640_ack_interrupt(phydev);
if (err)
return err;
misr = phy_read(phydev, MII_DP83640_MISR);
if (misr < 0)
return misr;
......@@ -1197,7 +1201,11 @@ static int dp83640_config_intr(struct phy_device *phydev)
MII_DP83640_MISR_DUP_INT_EN |
MII_DP83640_MISR_SPD_INT_EN |
MII_DP83640_MISR_LINK_INT_EN);
return phy_write(phydev, MII_DP83640_MISR, misr);
err = phy_write(phydev, MII_DP83640_MISR, misr);
if (err)
return err;
return dp83640_ack_interrupt(phydev);
}
}
......@@ -1541,7 +1549,6 @@ static struct phy_driver dp83640_driver = {
.remove = dp83640_remove,
.soft_reset = dp83640_soft_reset,
.config_init = dp83640_config_init,
.ack_interrupt = dp83640_ack_interrupt,
.config_intr = dp83640_config_intr,
.handle_interrupt = dp83640_handle_interrupt,
};
......
......@@ -119,21 +119,6 @@ struct dp83822_private {
u16 fx_sd_enable;
};
static int dp83822_ack_interrupt(struct phy_device *phydev)
{
int err;
err = phy_read(phydev, MII_DP83822_MISR1);
if (err < 0)
return err;
err = phy_read(phydev, MII_DP83822_MISR2);
if (err < 0)
return err;
return 0;
}
static int dp83822_set_wol(struct phy_device *phydev,
struct ethtool_wolinfo *wol)
{
......@@ -609,7 +594,6 @@ static int dp83822_resume(struct phy_device *phydev)
.read_status = dp83822_read_status, \
.get_wol = dp83822_get_wol, \
.set_wol = dp83822_set_wol, \
.ack_interrupt = dp83822_ack_interrupt, \
.config_intr = dp83822_config_intr, \
.handle_interrupt = dp83822_handle_interrupt, \
.suspend = dp83822_suspend, \
......@@ -625,7 +609,6 @@ static int dp83822_resume(struct phy_device *phydev)
.config_init = dp8382x_config_init, \
.get_wol = dp83822_get_wol, \
.set_wol = dp83822_set_wol, \
.ack_interrupt = dp83822_ack_interrupt, \
.config_intr = dp83822_config_intr, \
.handle_interrupt = dp83822_handle_interrupt, \
.suspend = dp83822_suspend, \
......
......@@ -67,17 +67,28 @@ static int dp83848_config_intr(struct phy_device *phydev)
return control;
if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
ret = dp83848_ack_interrupt(phydev);
if (ret)
return ret;
control |= DP83848_MICR_INT_OE;
control |= DP83848_MICR_INTEN;
ret = phy_write(phydev, DP83848_MISR, DP83848_INT_EN_MASK);
if (ret < 0)
return ret;
ret = phy_write(phydev, DP83848_MICR, control);
} else {
control &= ~DP83848_MICR_INTEN;
ret = phy_write(phydev, DP83848_MICR, control);
if (ret)
return ret;
ret = dp83848_ack_interrupt(phydev);
}
return phy_write(phydev, DP83848_MICR, control);
return ret;
}
static irqreturn_t dp83848_handle_interrupt(struct phy_device *phydev)
......@@ -134,7 +145,6 @@ MODULE_DEVICE_TABLE(mdio, dp83848_tbl);
.resume = genphy_resume, \
\
/* IRQ related */ \
.ack_interrupt = dp83848_ack_interrupt, \
.config_intr = dp83848_config_intr, \
.handle_interrupt = dp83848_handle_interrupt, \
}
......
......@@ -288,9 +288,13 @@ static void dp83867_get_wol(struct phy_device *phydev,
static int dp83867_config_intr(struct phy_device *phydev)
{
int micr_status;
int micr_status, err;
if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
err = dp83867_ack_interrupt(phydev);
if (err)
return err;
micr_status = phy_read(phydev, MII_DP83867_MICR);
if (micr_status < 0)
return micr_status;
......@@ -303,11 +307,17 @@ static int dp83867_config_intr(struct phy_device *phydev)
MII_DP83867_MICR_DUP_MODE_CHNG_INT_EN |
MII_DP83867_MICR_SLEEP_MODE_CHNG_INT_EN);
return phy_write(phydev, MII_DP83867_MICR, micr_status);
err = phy_write(phydev, MII_DP83867_MICR, micr_status);
} else {
micr_status = 0x0;
err = phy_write(phydev, MII_DP83867_MICR, micr_status);
if (err)
return err;
err = dp83867_ack_interrupt(phydev);
}
micr_status = 0x0;
return phy_write(phydev, MII_DP83867_MICR, micr_status);
return err;
}
static irqreturn_t dp83867_handle_interrupt(struct phy_device *phydev)
......@@ -849,7 +859,6 @@ static struct phy_driver dp83867_driver[] = {
.set_wol = dp83867_set_wol,
/* IRQ related */
.ack_interrupt = dp83867_ack_interrupt,
.config_intr = dp83867_config_intr,
.handle_interrupt = dp83867_handle_interrupt,
......
......@@ -186,9 +186,13 @@ static int dp83869_ack_interrupt(struct phy_device *phydev)
static int dp83869_config_intr(struct phy_device *phydev)
{
int micr_status = 0;
int micr_status = 0, err;
if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
err = dp83869_ack_interrupt(phydev);
if (err)
return err;
micr_status = phy_read(phydev, MII_DP83869_MICR);
if (micr_status < 0)
return micr_status;
......@@ -201,10 +205,16 @@ static int dp83869_config_intr(struct phy_device *phydev)
MII_DP83869_MICR_DUP_MODE_CHNG_INT_EN |
MII_DP83869_MICR_SLEEP_MODE_CHNG_INT_EN);
return phy_write(phydev, MII_DP83869_MICR, micr_status);
err = phy_write(phydev, MII_DP83869_MICR, micr_status);
} else {
err = phy_write(phydev, MII_DP83869_MICR, micr_status);
if (err)
return err;
err = dp83869_ack_interrupt(phydev);
}
return phy_write(phydev, MII_DP83869_MICR, micr_status);
return err;
}
static irqreturn_t dp83869_handle_interrupt(struct phy_device *phydev)
......@@ -874,7 +884,6 @@ static struct phy_driver dp83869_driver[] = {
.soft_reset = dp83869_phy_reset,
/* IRQ related */
.ack_interrupt = dp83869_ack_interrupt,
.config_intr = dp83869_config_intr,
.handle_interrupt = dp83869_handle_interrupt,
.read_status = dp83869_read_status,
......
......@@ -197,6 +197,10 @@ static int dp83811_config_intr(struct phy_device *phydev)
int misr_status, err;
if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
err = dp83811_ack_interrupt(phydev);
if (err)
return err;
misr_status = phy_read(phydev, MII_DP83811_INT_STAT1);
if (misr_status < 0)
return misr_status;
......@@ -249,6 +253,10 @@ static int dp83811_config_intr(struct phy_device *phydev)
return err;
err = phy_write(phydev, MII_DP83811_INT_STAT3, 0);
if (err < 0)
return err;
err = dp83811_ack_interrupt(phydev);
}
return err;
......@@ -386,7 +394,6 @@ static struct phy_driver dp83811_driver[] = {
.soft_reset = dp83811_phy_reset,
.get_wol = dp83811_get_wol,
.set_wol = dp83811_set_wol,
.ack_interrupt = dp83811_ack_interrupt,
.config_intr = dp83811_config_intr,
.handle_interrupt = dp83811_handle_interrupt,
.suspend = dp83811_suspend,
......
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