Commit 1733d0be authored by David S. Miller's avatar David S. Miller

Merge branch 'at803x-wol'

Li Yang says:

====================
fix at803x wol setting

v3:
  Break long lines
  Add back error checking of phy_read

v4:
  Disable WoL in 1588 register for AR8031 in probe
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 1696ec86 d7791cec
...@@ -459,21 +459,27 @@ static int at803x_set_wol(struct phy_device *phydev, ...@@ -459,21 +459,27 @@ static int at803x_set_wol(struct phy_device *phydev,
phy_write_mmd(phydev, MDIO_MMD_PCS, offsets[i], phy_write_mmd(phydev, MDIO_MMD_PCS, offsets[i],
mac[(i * 2) + 1] | (mac[(i * 2)] << 8)); mac[(i * 2) + 1] | (mac[(i * 2)] << 8));
/* Enable WOL function */ /* Enable WOL function for 1588 */
ret = phy_modify_mmd(phydev, MDIO_MMD_PCS, AT803X_PHY_MMD3_WOL_CTRL, if (phydev->drv->phy_id == ATH8031_PHY_ID) {
0, AT803X_WOL_EN); ret = phy_modify_mmd(phydev, MDIO_MMD_PCS,
if (ret) AT803X_PHY_MMD3_WOL_CTRL,
return ret; 0, AT803X_WOL_EN);
if (ret)
return ret;
}
/* Enable WOL interrupt */ /* Enable WOL interrupt */
ret = phy_modify(phydev, AT803X_INTR_ENABLE, 0, AT803X_INTR_ENABLE_WOL); ret = phy_modify(phydev, AT803X_INTR_ENABLE, 0, AT803X_INTR_ENABLE_WOL);
if (ret) if (ret)
return ret; return ret;
} else { } else {
/* Disable WoL function */ /* Disable WoL function for 1588 */
ret = phy_modify_mmd(phydev, MDIO_MMD_PCS, AT803X_PHY_MMD3_WOL_CTRL, if (phydev->drv->phy_id == ATH8031_PHY_ID) {
AT803X_WOL_EN, 0); ret = phy_modify_mmd(phydev, MDIO_MMD_PCS,
if (ret) AT803X_PHY_MMD3_WOL_CTRL,
return ret; AT803X_WOL_EN, 0);
if (ret)
return ret;
}
/* Disable WOL interrupt */ /* Disable WOL interrupt */
ret = phy_modify(phydev, AT803X_INTR_ENABLE, AT803X_INTR_ENABLE_WOL, 0); ret = phy_modify(phydev, AT803X_INTR_ENABLE, AT803X_INTR_ENABLE_WOL, 0);
if (ret) if (ret)
...@@ -508,11 +514,11 @@ static void at803x_get_wol(struct phy_device *phydev, ...@@ -508,11 +514,11 @@ static void at803x_get_wol(struct phy_device *phydev,
wol->supported = WAKE_MAGIC; wol->supported = WAKE_MAGIC;
wol->wolopts = 0; wol->wolopts = 0;
value = phy_read_mmd(phydev, MDIO_MMD_PCS, AT803X_PHY_MMD3_WOL_CTRL); value = phy_read(phydev, AT803X_INTR_ENABLE);
if (value < 0) if (value < 0)
return; return;
if (value & AT803X_WOL_EN) if (value & AT803X_INTR_ENABLE_WOL)
wol->wolopts |= WAKE_MAGIC; wol->wolopts |= WAKE_MAGIC;
} }
...@@ -858,9 +864,6 @@ static int at803x_probe(struct phy_device *phydev) ...@@ -858,9 +864,6 @@ static int at803x_probe(struct phy_device *phydev)
if (phydev->drv->phy_id == ATH8031_PHY_ID) { if (phydev->drv->phy_id == ATH8031_PHY_ID) {
int ccr = phy_read(phydev, AT803X_REG_CHIP_CONFIG); int ccr = phy_read(phydev, AT803X_REG_CHIP_CONFIG);
int mode_cfg; int mode_cfg;
struct ethtool_wolinfo wol = {
.wolopts = 0,
};
if (ccr < 0) if (ccr < 0)
return ccr; return ccr;
...@@ -877,12 +880,14 @@ static int at803x_probe(struct phy_device *phydev) ...@@ -877,12 +880,14 @@ static int at803x_probe(struct phy_device *phydev)
break; break;
} }
/* Disable WOL by default */ /* Disable WoL in 1588 register which is enabled
ret = at803x_set_wol(phydev, &wol); * by default
if (ret < 0) { */
phydev_err(phydev, "failed to disable WOL on probe: %d\n", ret); ret = phy_modify_mmd(phydev, MDIO_MMD_PCS,
AT803X_PHY_MMD3_WOL_CTRL,
AT803X_WOL_EN, 0);
if (ret)
return ret; return ret;
}
} }
return 0; return 0;
...@@ -2059,8 +2064,6 @@ static struct phy_driver at803x_driver[] = { ...@@ -2059,8 +2064,6 @@ static struct phy_driver at803x_driver[] = {
.flags = PHY_POLL_CABLE_TEST, .flags = PHY_POLL_CABLE_TEST,
.config_init = at803x_config_init, .config_init = at803x_config_init,
.link_change_notify = at803x_link_change_notify, .link_change_notify = at803x_link_change_notify,
.set_wol = at803x_set_wol,
.get_wol = at803x_get_wol,
.suspend = at803x_suspend, .suspend = at803x_suspend,
.resume = at803x_resume, .resume = at803x_resume,
/* PHY_BASIC_FEATURES */ /* PHY_BASIC_FEATURES */
......
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