Commit 30dd6219 authored by Christian Marangi's avatar Christian Marangi Committed by David S. Miller

net: phy: at803x: move specific at8031 config_intr to dedicated function

Move specific at8031 config_intr bits to dedicated function to make
at803x_config_initr more generic.

This is needed in preparation for PHY driver split as qca8081 share the
same function to setup interrupts.
Signed-off-by: default avatarChristian Marangi <ansuelsmth@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 27b89c9d
...@@ -990,7 +990,6 @@ static int at803x_ack_interrupt(struct phy_device *phydev) ...@@ -990,7 +990,6 @@ static int at803x_ack_interrupt(struct phy_device *phydev)
static int at803x_config_intr(struct phy_device *phydev) static int at803x_config_intr(struct phy_device *phydev)
{ {
struct at803x_priv *priv = phydev->priv;
int err; int err;
int value; int value;
...@@ -1007,10 +1006,6 @@ static int at803x_config_intr(struct phy_device *phydev) ...@@ -1007,10 +1006,6 @@ static int at803x_config_intr(struct phy_device *phydev)
value |= AT803X_INTR_ENABLE_DUPLEX_CHANGED; value |= AT803X_INTR_ENABLE_DUPLEX_CHANGED;
value |= AT803X_INTR_ENABLE_LINK_FAIL; value |= AT803X_INTR_ENABLE_LINK_FAIL;
value |= AT803X_INTR_ENABLE_LINK_SUCCESS; value |= AT803X_INTR_ENABLE_LINK_SUCCESS;
if (priv->is_fiber) {
value |= AT803X_INTR_ENABLE_LINK_FAIL_BX;
value |= AT803X_INTR_ENABLE_LINK_SUCCESS_BX;
}
err = phy_write(phydev, AT803X_INTR_ENABLE, value); err = phy_write(phydev, AT803X_INTR_ENABLE, value);
} else { } else {
...@@ -1617,6 +1612,29 @@ static int at8031_set_wol(struct phy_device *phydev, ...@@ -1617,6 +1612,29 @@ static int at8031_set_wol(struct phy_device *phydev,
return ret; return ret;
} }
static int at8031_config_intr(struct phy_device *phydev)
{
struct at803x_priv *priv = phydev->priv;
int err, value = 0;
if (phydev->interrupts == PHY_INTERRUPT_ENABLED &&
priv->is_fiber) {
/* Clear any pending interrupts */
err = at803x_ack_interrupt(phydev);
if (err)
return err;
value |= AT803X_INTR_ENABLE_LINK_FAIL_BX;
value |= AT803X_INTR_ENABLE_LINK_SUCCESS_BX;
err = phy_set_bits(phydev, AT803X_INTR_ENABLE, value);
if (err)
return err;
}
return at803x_config_intr(phydev);
}
static int qca83xx_config_init(struct phy_device *phydev) static int qca83xx_config_init(struct phy_device *phydev)
{ {
u8 switch_revision; u8 switch_revision;
...@@ -2137,7 +2155,7 @@ static struct phy_driver at803x_driver[] = { ...@@ -2137,7 +2155,7 @@ static struct phy_driver at803x_driver[] = {
.write_page = at803x_write_page, .write_page = at803x_write_page,
.get_features = at803x_get_features, .get_features = at803x_get_features,
.read_status = at803x_read_status, .read_status = at803x_read_status,
.config_intr = at803x_config_intr, .config_intr = at8031_config_intr,
.handle_interrupt = at803x_handle_interrupt, .handle_interrupt = at803x_handle_interrupt,
.get_tunable = at803x_get_tunable, .get_tunable = at803x_get_tunable,
.set_tunable = at803x_set_tunable, .set_tunable = at803x_set_tunable,
......
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