Skip to content

Commit

Permalink
net: phy: at803x: move page selection fix to config_init
Browse files Browse the repository at this point in the history
The fix to select the copper page on AR8031 was being done in the probe
function rather than config_init, so it would not be redone after resume
from suspend. Move this to config_init so it is always redone when
needed.

Fixes: c329e5a ("net: phy: at803x: select correct page on config init")
Signed-off-by: Robert Hancock <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
robhancocksed authored and davem330 committed Jan 27, 2022
1 parent fbb8295 commit 4f3a00c
Showing 1 changed file with 16 additions and 24 deletions.
40 changes: 16 additions & 24 deletions drivers/net/phy/at803x.c
Original file line number Diff line number Diff line change
Expand Up @@ -784,25 +784,7 @@ static int at803x_probe(struct phy_device *phydev)
return ret;
}

/* Some bootloaders leave the fiber page selected.
* Switch to the copper page, as otherwise we read
* the PHY capabilities from the fiber side.
*/
if (phydev->drv->phy_id == ATH8031_PHY_ID) {
phy_lock_mdio_bus(phydev);
ret = at803x_write_page(phydev, AT803X_PAGE_COPPER);
phy_unlock_mdio_bus(phydev);
if (ret)
goto err;
}

return 0;

err:
if (priv->vddio)
regulator_disable(priv->vddio);

return ret;
}

static void at803x_remove(struct phy_device *phydev)
Expand Down Expand Up @@ -912,6 +894,22 @@ static int at803x_config_init(struct phy_device *phydev)
{
int ret;

if (phydev->drv->phy_id == ATH8031_PHY_ID) {
/* Some bootloaders leave the fiber page selected.
* Switch to the copper page, as otherwise we read
* the PHY capabilities from the fiber side.
*/
phy_lock_mdio_bus(phydev);
ret = at803x_write_page(phydev, AT803X_PAGE_COPPER);
phy_unlock_mdio_bus(phydev);
if (ret)
return ret;

ret = at8031_pll_config(phydev);
if (ret < 0)
return ret;
}

/* The RX and TX delay default is:
* after HW reset: RX delay enabled and TX delay disabled
* after SW reset: RX delay enabled, while TX delay retains the
Expand Down Expand Up @@ -941,12 +939,6 @@ static int at803x_config_init(struct phy_device *phydev)
if (ret < 0)
return ret;

if (phydev->drv->phy_id == ATH8031_PHY_ID) {
ret = at8031_pll_config(phydev);
if (ret < 0)
return ret;
}

/* Ar803x extended next page bit is enabled by default. Cisco
* multigig switches read this bit and attempt to negotiate 10Gbps
* rates even if the next page bit is disabled. This is incorrect
Expand Down

0 comments on commit 4f3a00c

Please sign in to comment.