mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-16 07:35:14 +00:00
net: phy: at803x: disable WOL at probe
Before7beecaf7d5
("net: phy: at803x: improve the WOL feature") patch "at803x_get_wol" implementation used AT803X_INTR_ENABLE_WOL value to set WAKE_MAGIC flag, and now AT803X_WOL_EN value is used for the same purpose. The problem here is that the values of these two bits are different after hardware reset: AT803X_INTR_ENABLE_WOL=0 after hardware reset, but AT803X_WOL_EN=1. So now, if called right after boot, "at803x_get_wol" will set WAKE_MAGIC flag, even if WOL function is not enabled by calling "at803x_set_wol" function. The patch disables WOL function on probe thus the behavior is consistent. Fixes:7beecaf7d5
("net: phy: at803x: improve the WOL feature") Signed-off-by: Viorel Suman <viorel.suman@nxp.com> Link: https://lore.kernel.org/r/20220527084935.235274-1-viorel.suman@oss.nxp.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
3a2cd89bfb
commit
d7cd5e06c9
1 changed files with 22 additions and 11 deletions
|
@ -433,9 +433,11 @@ static void at803x_context_restore(struct phy_device *phydev,
|
||||||
static int at803x_set_wol(struct phy_device *phydev,
|
static int at803x_set_wol(struct phy_device *phydev,
|
||||||
struct ethtool_wolinfo *wol)
|
struct ethtool_wolinfo *wol)
|
||||||
{
|
{
|
||||||
|
int ret, irq_enabled;
|
||||||
|
|
||||||
|
if (wol->wolopts & WAKE_MAGIC) {
|
||||||
struct net_device *ndev = phydev->attached_dev;
|
struct net_device *ndev = phydev->attached_dev;
|
||||||
const u8 *mac;
|
const u8 *mac;
|
||||||
int ret, irq_enabled;
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
static const unsigned int offsets[] = {
|
static const unsigned int offsets[] = {
|
||||||
AT803X_LOC_MAC_ADDR_32_47_OFFSET,
|
AT803X_LOC_MAC_ADDR_32_47_OFFSET,
|
||||||
|
@ -446,7 +448,6 @@ static int at803x_set_wol(struct phy_device *phydev,
|
||||||
if (!ndev)
|
if (!ndev)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
if (wol->wolopts & WAKE_MAGIC) {
|
|
||||||
mac = (const u8 *) ndev->dev_addr;
|
mac = (const u8 *) ndev->dev_addr;
|
||||||
|
|
||||||
if (!is_valid_ether_addr(mac))
|
if (!is_valid_ether_addr(mac))
|
||||||
|
@ -857,6 +858,9 @@ 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)
|
||||||
goto err;
|
goto err;
|
||||||
|
@ -872,6 +876,13 @@ static int at803x_probe(struct phy_device *phydev)
|
||||||
priv->is_fiber = true;
|
priv->is_fiber = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Disable WOL by default */
|
||||||
|
ret = at803x_set_wol(phydev, &wol);
|
||||||
|
if (ret < 0) {
|
||||||
|
phydev_err(phydev, "failed to disable WOL on probe: %d\n", ret);
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue