Date: Fri, 19 Aug 2011 19:20:18 GMT From: dfilter@FreeBSD.ORG (dfilter service) To: freebsd-net@FreeBSD.org Subject: Re: kern/158156: commit references a PR Message-ID: <201108191920.p7JJKHRk049423@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/158156; it has been noted by GNATS. From: dfilter@FreeBSD.ORG (dfilter service) To: bug-followup@FreeBSD.org Cc: Subject: Re: kern/158156: commit references a PR Date: Fri, 19 Aug 2011 19:13:11 +0000 (UTC) Author: marius Date: Fri Aug 19 19:12:58 2011 New Revision: 225014 URL: http://svn.freebsd.org/changeset/base/225014 Log: r221812 reveals that at least some Broadcom PHYs default to being not only isolated but also powered down after a reset and while they just work fine [sic] when both is the case they don't if they are only deisolate but still powered down. So in order to put PHYs in an overall normal operation mode for the common case, ensure in mii_phy_reset() that they are not powered down after a reset. Unfortunately, this only helps in case of BCM5421, while BCM5709S apparently only work when they remain isolated and powered down after a reset. So don't call mii_phy_reset() in brgphy_reset() and implement the reset locally leaving the problematic bits alone. Effectively this bypasses r221812 for brgphy(4). Thanks to Justin Hibbits for doing a binary search in order to identify the problematic commit. PR: 157405, 158156 Reviewed by: yongari (mii_phy_reset() part) Approved by: re (kib) MFC after: 3 days Modified: head/sys/dev/mii/brgphy.c head/sys/dev/mii/mii_physubr.c Modified: head/sys/dev/mii/brgphy.c ============================================================================== --- head/sys/dev/mii/brgphy.c Fri Aug 19 15:21:13 2011 (r225013) +++ head/sys/dev/mii/brgphy.c Fri Aug 19 19:12:58 2011 (r225014) @@ -876,10 +876,22 @@ brgphy_reset(struct mii_softc *sc) struct bge_softc *bge_sc = NULL; struct bce_softc *bce_sc = NULL; struct ifnet *ifp; - int val; + int i, val; - /* Perform a standard PHY reset. */ - mii_phy_reset(sc); + /* + * Perform a reset. Note that at least some Broadcom PHYs default to + * being powered down as well as isolated after a reset but don't work + * if one or both of these bits are cleared. However, they just work + * fine if both bits remain set, so we don't use mii_phy_reset() here. + */ + PHY_WRITE(sc, BRGPHY_MII_BMCR, BRGPHY_BMCR_RESET); + + /* Wait 100ms for it to complete. */ + for (i = 0; i < 100; i++) { + if ((PHY_READ(sc, BRGPHY_MII_BMCR) & BRGPHY_BMCR_RESET) == 0) + break; + DELAY(1000); + } /* Handle any PHY specific procedures following the reset. */ switch (sc->mii_mpd_oui) { Modified: head/sys/dev/mii/mii_physubr.c ============================================================================== --- head/sys/dev/mii/mii_physubr.c Fri Aug 19 15:21:13 2011 (r225013) +++ head/sys/dev/mii/mii_physubr.c Fri Aug 19 19:12:58 2011 (r225014) @@ -273,8 +273,8 @@ mii_phy_reset(struct mii_softc *sc) DELAY(1000); } - /* NB: a PHY may default to isolation. */ - reg &= ~BMCR_ISO; + /* NB: a PHY may default to being powered down and/or isolated. */ + reg &= ~(BMCR_PDOWN | 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))) _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201108191920.p7JJKHRk049423>