Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 119243
b: refs/heads/master
c: de339c2
h: refs/heads/master
i:
  119241: bca240c
  119239: dd243df
v: v3
  • Loading branch information
Trent Piepho authored and David S. Miller committed Nov 19, 2008
1 parent 78177ae commit 44a60f8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 31c221c49f92d17632e0d662eb62a27e8b425805
refs/heads/master: de339c2aa7fea18410b1abeab5674bfbd4073a63
34 changes: 23 additions & 11 deletions trunk/drivers/net/phy/phy_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,20 +564,32 @@ EXPORT_SYMBOL(genphy_restart_aneg);
*/
int genphy_config_aneg(struct phy_device *phydev)
{
int result = 0;
int result;

if (AUTONEG_ENABLE == phydev->autoneg) {
int result = genphy_config_advert(phydev);
if (AUTONEG_ENABLE != phydev->autoneg)
return genphy_setup_forced(phydev);

result = genphy_config_advert(phydev);

if (result < 0) /* error */
return result;

if (result < 0) /* error */
return result;
if (result == 0) {
/* Advertisment hasn't changed, but maybe aneg was never on to
* begin with? Or maybe phy was isolated? */
int ctl = phy_read(phydev, MII_BMCR);

if (ctl < 0)
return ctl;

if (!(ctl & BMCR_ANENABLE) || (ctl & BMCR_ISOLATE))
result = 1; /* do restart aneg */
}

/* Only restart aneg if we are advertising something different
* than we were before. */
if (result > 0)
result = genphy_restart_aneg(phydev);
} else
result = genphy_setup_forced(phydev);
/* Only restart aneg if we are advertising something different
* than we were before. */
if (result > 0)
result = genphy_restart_aneg(phydev);

return result;
}
Expand Down

0 comments on commit 44a60f8

Please sign in to comment.