diff options
author | phk <phk@FreeBSD.org> | 2002-04-29 13:35:31 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2002-04-29 13:35:31 +0000 |
commit | 623b9c8449c71dee51ac80bd8c451872724d4f4e (patch) | |
tree | 9eea384f7eadc97b7396b1efe9eb6e5f002eae0b /sys | |
parent | f991342a3516788d7bdcf299d43518fc006fafe2 (diff) | |
download | FreeBSD-src-623b9c8449c71dee51ac80bd8c451872724d4f4e.zip FreeBSD-src-623b9c8449c71dee51ac80bd8c451872724d4f4e.tar.gz |
Convert exphy and ukphy over to the new code.
exphy is done flying blind, ukphy is tested on one card.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/mii/exphy.c | 28 | ||||
-rw-r--r-- | sys/dev/mii/ukphy.c | 37 | ||||
-rw-r--r-- | sys/dev/mii/ukphy_subr.c | 6 |
3 files changed, 10 insertions, 61 deletions
diff --git a/sys/dev/mii/exphy.c b/sys/dev/mii/exphy.c index 3f0286f..7ff8b63 100644 --- a/sys/dev/mii/exphy.c +++ b/sys/dev/mii/exphy.c @@ -194,7 +194,7 @@ static int exphy_attach(dev) sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; device_printf(dev, " "); - mii_add_media(sc); + mii_phy_add_media(sc); printf("\n"); #undef ADD MIIBUS_MEDIAINIT(sc->mii_dev); @@ -226,28 +226,7 @@ exphy_service(sc, mii, cmd) if ((mii->mii_ifp->if_flags & IFF_UP) == 0) break; - switch (IFM_SUBTYPE(ife->ifm_media)) { - case IFM_AUTO: - /* - * If we're already in auto mode, just return. - */ - if (PHY_READ(sc, MII_BMCR) & BMCR_AUTOEN) - return (0); - (void) mii_phy_auto(sc, 1); - break; - case IFM_100_T4: - /* - * XXX Not supported as a manual setting right now. - */ - return (EINVAL); - default: - /* - * BMCR data is stored in the ifmedia entry. - */ - PHY_WRITE(sc, MII_ANAR, - mii_anar(ife->ifm_media)); - PHY_WRITE(sc, MII_BMCR, ife->ifm_data); - } + mii_phy_setmedia(sc); break; case MII_TICK: @@ -279,8 +258,7 @@ exphy_service(sc, mii, cmd) } static void -exphy_reset(sc) - struct mii_softc *sc; +exphy_reset(struct mii_softc *sc) { mii_phy_reset(sc); diff --git a/sys/dev/mii/ukphy.c b/sys/dev/mii/ukphy.c index c041511..629f637 100644 --- a/sys/dev/mii/ukphy.c +++ b/sys/dev/mii/ukphy.c @@ -156,23 +156,15 @@ ukphy_attach(dev) sc->mii_flags |= MIIF_NOISOLATE; -#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) - - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->mii_inst), - BMCR_ISO); -#if 0 - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst), - BMCR_LOOP|BMCR_S100); -#endif - mii_phy_reset(sc); sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; + if (sc->mii_capabilities & BMSR_EXTSTAT) + sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR); device_printf(dev, " "); - mii_add_media(sc); + mii_phy_add_media(sc); printf("\n"); -#undef ADD MIIBUS_MEDIAINIT(sc->mii_dev); @@ -214,28 +206,7 @@ ukphy_service(sc, mii, cmd) if ((mii->mii_ifp->if_flags & IFF_UP) == 0) break; - switch (IFM_SUBTYPE(ife->ifm_media)) { - case IFM_AUTO: - /* - * If we're already in auto mode, just return. - */ - if (PHY_READ(sc, MII_BMCR) & BMCR_AUTOEN) - return (0); - (void) mii_phy_auto(sc, 1); - break; - case IFM_100_T4: - /* - * XXX Not supported as a manual setting right now. - */ - return (EINVAL); - default: - /* - * BMCR data is stored in the ifmedia entry. - */ - PHY_WRITE(sc, MII_ANAR, - mii_anar(ife->ifm_media)); - PHY_WRITE(sc, MII_BMCR, ife->ifm_data); - } + mii_phy_setmedia(sc); break; case MII_TICK: diff --git a/sys/dev/mii/ukphy_subr.c b/sys/dev/mii/ukphy_subr.c index ab5bc15..da14632 100644 --- a/sys/dev/mii/ukphy_subr.c +++ b/sys/dev/mii/ukphy_subr.c @@ -65,10 +65,10 @@ static const char rcsid[] = * by decoding the NWay autonegotiation, use this routine. */ void -ukphy_status(phy) - struct mii_softc *phy; +ukphy_status(struct mii_softc *phy) { struct mii_data *mii = phy->mii_pdata; + struct ifmedia_entry *ife = mii->mii_media.ifm_cur; int bmsr, bmcr, anlpar; mii->mii_media_status = IFM_AVALID; @@ -114,5 +114,5 @@ ukphy_status(phy) else mii->mii_media_active |= IFM_NONE; } else - mii->mii_media_active = mii_media_from_bmcr(bmcr); + mii->mii_media_active = ife->ifm_media; } |