diff options
Diffstat (limited to 'sys/dev/mii/brgphy.c')
-rw-r--r-- | sys/dev/mii/brgphy.c | 40 |
1 files changed, 10 insertions, 30 deletions
diff --git a/sys/dev/mii/brgphy.c b/sys/dev/mii/brgphy.c index c0175ff..181798e 100644 --- a/sys/dev/mii/brgphy.c +++ b/sys/dev/mii/brgphy.c @@ -191,13 +191,17 @@ brgphy_attach(device_t dev) LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); /* Initialize mii_softc structure */ - sc->mii_inst = mii->mii_instance; + sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = brgphy_service; sc->mii_pdata = mii; - sc->mii_anegticks = MII_ANEGTICKS_GIGE; + + /* + * At least some variants wedge when isolating, at least some also + * don't support loopback. + */ sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP; - mii->mii_instance++; + sc->mii_anegticks = MII_ANEGTICKS_GIGE; /* Initialize brgphy_softc structure */ bsc->mii_oui = MII_OUI(ma->mii_id1, ma->mii_id2); @@ -283,9 +287,6 @@ brgphy_attach(device_t dev) #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) - /* Create an instance of Ethernet media. */ - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->mii_inst), BMCR_ISO); - /* Add the supported media types */ if ((sc->mii_flags & MIIF_HAVEFIBER) == 0) { ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, 0, sc->mii_inst), @@ -345,26 +346,12 @@ brgphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) { struct brgphy_softc *bsc = (struct brgphy_softc *)sc; struct ifmedia_entry *ife = mii->mii_media.ifm_cur; - int error = 0; int val; switch (cmd) { case MII_POLLSTAT: - /* If we're not polling our PHY instance, just return. */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - goto brgphy_service_exit; break; case MII_MEDIACHG: - /* - * If the media indicates a different PHY instance, - * isolate ourselves. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) { - PHY_WRITE(sc, MII_BMCR, - PHY_READ(sc, MII_BMCR) | BMCR_ISO); - goto brgphy_service_exit; - } - /* If the interface is not up, don't do anything. */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) break; @@ -385,18 +372,13 @@ brgphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) mii->mii_ifp->if_flags & IFF_LINK0); break; default: - error = EINVAL; - goto brgphy_service_exit; + return (EINVAL); } break; case MII_TICK: - /* Bail if we're not currently selected. */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - goto brgphy_service_exit; - /* Bail if the interface isn't up. */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) - goto brgphy_service_exit; + return (0); /* Bail if autoneg isn't in process. */ @@ -465,8 +447,7 @@ brgphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) } } mii_phy_update(sc, cmd); -brgphy_service_exit: - return (error); + return (0); } @@ -1182,4 +1163,3 @@ brgphy_reset(struct mii_softc *sc) } } - |