Date: Fri, 21 Jan 2011 00:48:04 +0000 (UTC) From: Marius Strobl <marius@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r217672 - stable/8/sys/dev/mii Message-ID: <201101210048.p0L0m4wZ033543@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: marius Date: Fri Jan 21 00:48:04 2011 New Revision: 217672 URL: http://svn.freebsd.org/changeset/base/217672 Log: MFC: r217413 - Even after masking the media with IFM_GMASK the result may have bits besides the duplex ones set so just comparing it with IFM_FDX may lead to false negatives. - Simplify ciphy_service() to only set the manual configuration bits once after we have figured them all out. This also means we no longer unnecessarily update the hardware along the road. Modified: stable/8/sys/dev/mii/brgphy.c stable/8/sys/dev/mii/ciphy.c stable/8/sys/dev/mii/xmphy.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/mii/brgphy.c ============================================================================== --- stable/8/sys/dev/mii/brgphy.c Fri Jan 21 00:40:51 2011 (r217671) +++ stable/8/sys/dev/mii/brgphy.c Fri Jan 21 00:48:04 2011 (r217672) @@ -452,7 +452,7 @@ brgphy_setmedia(struct mii_softc *sc, in break; } - if ((media & IFM_GMASK) == IFM_FDX) { + if ((media & IFM_FDX) != 0) { bmcr |= BRGPHY_BMCR_FDX; gig = BRGPHY_1000CTL_AFD; } else { Modified: stable/8/sys/dev/mii/ciphy.c ============================================================================== --- stable/8/sys/dev/mii/ciphy.c Fri Jan 21 00:40:51 2011 (r217671) +++ stable/8/sys/dev/mii/ciphy.c Fri Jan 21 00:48:04 2011 (r217672) @@ -176,27 +176,24 @@ ciphy_service(struct mii_softc *sc, stru case IFM_10_T: speed = CIPHY_S10; setit: - if ((ife->ifm_media & IFM_GMASK) == IFM_FDX) { + if ((ife->ifm_media & IFM_FDX) != 0) { speed |= CIPHY_BMCR_FDX; gig = CIPHY_1000CTL_AFD; - } else { + } else gig = CIPHY_1000CTL_AHD; - } - PHY_WRITE(sc, CIPHY_MII_1000CTL, 0); + if (IFM_SUBTYPE(ife->ifm_media) == IFM_1000_T) { + gig |= CIPHY_1000CTL_MSE; + if ((ife->ifm_media & IFM_ETH_MASTER) != 0 || + (mii->mii_ifp->if_flags & IFF_LINK0) != 0) + gig |= CIPHY_1000CTL_MSC; + speed |= + CIPHY_BMCR_AUTOEN | CIPHY_BMCR_STARTNEG; + } else + gig = 0; + PHY_WRITE(sc, CIPHY_MII_1000CTL, gig); PHY_WRITE(sc, CIPHY_MII_BMCR, speed); PHY_WRITE(sc, CIPHY_MII_ANAR, CIPHY_SEL_TYPE); - - if (IFM_SUBTYPE(ife->ifm_media) != IFM_1000_T) - break; - - gig |= CIPHY_1000CTL_MSE; - if ((ife->ifm_media & IFM_ETH_MASTER) != 0 || - (mii->mii_ifp->if_flags & IFF_LINK0) != 0) - gig |= CIPHY_1000CTL_MSC; - PHY_WRITE(sc, CIPHY_MII_1000CTL, gig); - PHY_WRITE(sc, CIPHY_MII_BMCR, - speed | CIPHY_BMCR_AUTOEN | CIPHY_BMCR_STARTNEG); break; case IFM_NONE: PHY_WRITE(sc, MII_BMCR, BMCR_ISO | BMCR_PDOWN); Modified: stable/8/sys/dev/mii/xmphy.c ============================================================================== --- stable/8/sys/dev/mii/xmphy.c Fri Jan 21 00:40:51 2011 (r217671) +++ stable/8/sys/dev/mii/xmphy.c Fri Jan 21 00:48:04 2011 (r217672) @@ -171,7 +171,7 @@ xmphy_service(struct mii_softc *sc, stru break; case IFM_1000_SX: mii_phy_reset(sc); - if ((ife->ifm_media & IFM_GMASK) == IFM_FDX) { + if ((ife->ifm_media & IFM_FDX) != 0) { PHY_WRITE(sc, XMPHY_MII_ANAR, XMPHY_ANAR_FDX); PHY_WRITE(sc, XMPHY_MII_BMCR, XMPHY_BMCR_FDX); } else {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101210048.p0L0m4wZ033543>