summaryrefslogtreecommitdiffstats
path: root/sys/dev/mii/brgphy.c
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2007-03-19 23:17:39 +0000
committerjkim <jkim@FreeBSD.org>2007-03-19 23:17:39 +0000
commita8db64a5b356ec426744ef16079c671b79e6369b (patch)
treef571bbb770a31a35f9db4c54cd332187eaf7d638 /sys/dev/mii/brgphy.c
parent260775bb6fef81275bc430d3ee467d6cf82afd47 (diff)
downloadFreeBSD-src-a8db64a5b356ec426744ef16079c671b79e6369b.zip
FreeBSD-src-a8db64a5b356ec426744ef16079c671b79e6369b.tar.gz
Revert couple of changes from 1.51 and 1.52. Reading link status with BMSR
is okay for most of the chipsets but BCM5701 PHY does not seem to like it. Set media to IFM_NONE if link is not up instead of the previous value. Reported by: Goran Lowkrantz (goran dot lowkrantz at ismobile dot com)
Diffstat (limited to 'sys/dev/mii/brgphy.c')
-rw-r--r--sys/dev/mii/brgphy.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/sys/dev/mii/brgphy.c b/sys/dev/mii/brgphy.c
index 06a3d6f..55eb0d2 100644
--- a/sys/dev/mii/brgphy.c
+++ b/sys/dev/mii/brgphy.c
@@ -311,7 +311,7 @@ brgphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
* Check to see if we have link. If we do, we don't
* need to restart the autonegotiation process.
*/
- if (PHY_READ(sc, BRGPHY_MII_BMSR) & BRGPHY_BMSR_LINK) {
+ if (PHY_READ(sc, BRGPHY_MII_AUXSTS) & BRGPHY_AUXSTS_LINK) {
sc->mii_ticks = 0; /* Reset autoneg timer. */
break;
}
@@ -416,32 +416,30 @@ static void
brgphy_status(struct mii_softc *sc)
{
struct mii_data *mii = sc->mii_pdata;
- struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
- int bmcr, bmsr;
+ int aux, bmcr, bmsr;
mii->mii_media_status = IFM_AVALID;
mii->mii_media_active = IFM_ETHER;
+ aux = PHY_READ(sc, BRGPHY_MII_AUXSTS);
bmcr = PHY_READ(sc, BRGPHY_MII_BMCR);
bmsr = PHY_READ(sc, BRGPHY_MII_BMSR);
- if (bmsr & BRGPHY_BMSR_LINK)
+ if (aux & BRGPHY_AUXSTS_LINK)
mii->mii_media_status |= IFM_ACTIVE;
if (bmcr & BRGPHY_BMCR_LOOP)
mii->mii_media_active |= IFM_LOOP;
- if (bmcr & BRGPHY_BMCR_AUTOEN) {
- if ((bmsr & BRGPHY_BMSR_ACOMP) == 0) {
- /* Erg, still trying, I guess... */
- mii->mii_media_active |= IFM_NONE;
- return;
- }
+ if ((bmcr & BRGPHY_BMCR_AUTOEN) &&
+ (bmsr & BRGPHY_BMSR_ACOMP) == 0) {
+ /* Erg, still trying, I guess... */
+ mii->mii_media_active |= IFM_NONE;
+ return;
}
- if (bmsr & BRGPHY_BMSR_LINK) {
- switch (PHY_READ(sc, BRGPHY_MII_AUXSTS) &
- BRGPHY_AUXSTS_AN_RES) {
+ if (aux & BRGPHY_AUXSTS_LINK) {
+ switch (aux & BRGPHY_AUXSTS_AN_RES) {
case BRGPHY_RES_1000FD:
mii->mii_media_active |= IFM_1000_T | IFM_FDX;
break;
@@ -468,7 +466,7 @@ brgphy_status(struct mii_softc *sc)
break;
}
} else
- mii->mii_media_active = ife->ifm_media;
+ mii->mii_media_active |= IFM_NONE;
}
static int
OpenPOWER on IntegriCloud