[patch 10/10] EMAC: fix ibm_emac autonegotiation result parsing
From: <hidden>
Date: 2005-01-05 05:59:36
From: Matt Porter <mporter@kernel.crashing.org> Fix aneg result parsing in ibm_emac driver. Signed-off-by: Eugene Surovegin <redacted> Signed-off-by: Matt Porter <mporter@kernel.crashing.org> Signed-off-by: Andrew Morton <redacted> --- 25-akpm/drivers/net/ibm_emac/ibm_emac_phy.c | 19 ++++++++++--------- 1 files changed, 10 insertions(+), 9 deletions(-) diff -puN drivers/net/ibm_emac/ibm_emac_phy.c~fix-ibm_emac-autonegotiation-result-parsing drivers/net/ibm_emac/ibm_emac_phy.c
--- 25/drivers/net/ibm_emac/ibm_emac_phy.c~fix-ibm_emac-autonegotiation-result-parsing 2005-01-04 21:57:36.578573496 -0800
+++ 25-akpm/drivers/net/ibm_emac/ibm_emac_phy.c 2005-01-04 21:57:36.581573040 -0800@@ -191,17 +191,18 @@ static int genmii_read_link(struct mii_p u16 lpa; if (phy->autoneg) { - lpa = phy_read(phy, MII_LPA); + lpa = phy_read(phy, MII_LPA) & phy_read(phy, MII_ADVERTISE); - if (lpa & (LPA_10FULL | LPA_100FULL)) - phy->duplex = DUPLEX_FULL; - else - phy->duplex = DUPLEX_HALF; - if (lpa & (LPA_100FULL | LPA_100HALF)) - phy->speed = SPEED_100; - else - phy->speed = SPEED_10; + phy->speed = SPEED_10; + phy->duplex = DUPLEX_HALF; phy->pause = 0; + + if (lpa & (LPA_100FULL | LPA_100HALF)) { + phy->speed = SPEED_100; + if (lpa & LPA_100FULL) + phy->duplex = DUPLEX_FULL; + } else if (lpa & LPA_10FULL) + phy->duplex = DUPLEX_FULL; } /* On non-aneg, we assume what we put in BMCR is the speed, * though magic-aneg shouldn't prevent this case from occurring
_