summaryrefslogtreecommitdiff
path: root/drivers/net/phy
diff options
context:
space:
mode:
authorAndy Fleming <afleming@freescale.com>2011-05-18 13:44:19 +0000
committerWolfgang Denk <wd@denx.de>2011-07-27 23:21:25 +0200
commitee8fa20f54c9705218a5c21e7db7d4ba1c124b98 (patch)
tree810fe1fa28cc878ce6315fbb6849d649057b8be4 /drivers/net/phy
parent09e3a67dec72b85dfc5535d2dbe695e9b2bfc4f9 (diff)
phylib: Detect link on 10G devices correctly
gen10g_startup() had 2 bugs: 1) It had a boolean logic error in checking the MMD mask, and always checked all of them. 2) It checked devices which don't actually report link state, which meant that it would never believe the link was fully up. Fix the boolean logic, and then mask the MMD mask so only link-reporting devices are checked. Signed-off-by: Andy Fleming <afleming@freescale.com> Reported-by: Ed Swarthout <Ed.Swarthout@freescale.com>
Diffstat (limited to 'drivers/net/phy')
-rw-r--r--drivers/net/phy/generic_10g.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/net/phy/generic_10g.c b/drivers/net/phy/generic_10g.c
index 60dec457bf..e4a499d461 100644
--- a/drivers/net/phy/generic_10g.c
+++ b/drivers/net/phy/generic_10g.c
@@ -36,7 +36,7 @@ int gen10g_shutdown(struct phy_device *phydev)
int gen10g_startup(struct phy_device *phydev)
{
int devad, reg;
- u32 mmd_mask = phydev->mmds;
+ u32 mmd_mask = phydev->mmds & MDIO_DEVS_LINK;
phydev->link = 1;
@@ -44,8 +44,12 @@ int gen10g_startup(struct phy_device *phydev)
phydev->speed = SPEED_10000;
phydev->duplex = DUPLEX_FULL;
+ /*
+ * Go through all the link-reporting devices, and make sure
+ * they're all up and happy
+ */
for (devad = 0; mmd_mask; devad++, mmd_mask = mmd_mask >> 1) {
- if (!mmd_mask & 1)
+ if (!(mmd_mask & 1))
continue;
/* Read twice because link state is latched and a