Skip to content

Commit

Permalink
net: phy: DP83TC811: Fix SGMII enable/disable
Browse files Browse the repository at this point in the history
If SGMII was selected in the DT then the device should
write the SGMII enable bit.

If SGMII is not selected in the DT then the SGMII bit
should be disabled.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Dan Murphy authored and David S. Miller committed Jul 3, 2018
1 parent 4203638 commit 00f5536
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions drivers/net/phy/dp83tc811.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,21 +284,19 @@ static int dp83811_config_init(struct phy_device *phydev)
if (err < 0)
return err;

value = phy_read(phydev, MII_DP83811_SGMII_CTRL);
if (phydev->interface == PHY_INTERFACE_MODE_SGMII) {
value = phy_read(phydev, MII_DP83811_SGMII_CTRL);
if (!(value & DP83811_SGMII_EN)) {
err = phy_write(phydev, MII_DP83811_SGMII_CTRL,
err = phy_write(phydev, MII_DP83811_SGMII_CTRL,
(DP83811_SGMII_EN | value));
if (err < 0)
return err;
} else {
err = phy_write(phydev, MII_DP83811_SGMII_CTRL,
(~DP83811_SGMII_EN & value));
if (err < 0)
return err;
}
} else {
err = phy_write(phydev, MII_DP83811_SGMII_CTRL,
(~DP83811_SGMII_EN & value));
}

if (err < 0)

return err;

value = DP83811_WOL_MAGIC_EN | DP83811_WOL_SECURE_ON | DP83811_WOL_EN;

return phy_write_mmd(phydev, DP83811_DEVADDR, MII_DP83811_WOL_CFG,
Expand Down

0 comments on commit 00f5536

Please sign in to comment.