From 7bd2d458c25fa25523aacbbcd33b3565cb5d6af4 Mon Sep 17 00:00:00 2001 From: Marius Strobl Date: Thu, 12 May 2011 14:16:07 +0000 Subject: [PATCH] Some PHYs like the Level One LXT970 optionally can default to isolation after rest, in which case we may need to deisolate it. Tested by: nwhitehorn MFC after 1 week --- sys/dev/mii/mii_physubr.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/sys/dev/mii/mii_physubr.c b/sys/dev/mii/mii_physubr.c index b3013ba02445..be6650595cf2 100644 --- a/sys/dev/mii/mii_physubr.c +++ b/sys/dev/mii/mii_physubr.c @@ -257,7 +257,7 @@ void mii_phy_reset(struct mii_softc *sc) { struct ifmedia_entry *ife = sc->mii_pdata->mii_media.ifm_cur; - int reg, i; + int i, reg; if ((sc->mii_flags & MIIF_NOISOLATE) != 0) reg = BMCR_RESET; @@ -273,11 +273,14 @@ mii_phy_reset(struct mii_softc *sc) DELAY(1000); } - if ((sc->mii_flags & MIIF_NOISOLATE) == 0) { - if ((ife == NULL && sc->mii_inst != 0) || - (ife != NULL && IFM_INST(ife->ifm_media) != sc->mii_inst)) - PHY_WRITE(sc, MII_BMCR, reg | BMCR_ISO); - } + /* NB: a PHY may default to isolation. */ + reg &= ~BMCR_ISO; + if ((sc->mii_flags & MIIF_NOISOLATE) == 0 && + ((ife == NULL && sc->mii_inst != 0) || + (ife != NULL && IFM_INST(ife->ifm_media) != sc->mii_inst))) + reg |= BMCR_ISO; + if (PHY_READ(sc, MII_BMCR) != reg) + PHY_WRITE(sc, MII_BMCR, reg); } void