diff options
author | marius <marius@FreeBSD.org> | 2010-10-02 18:53:12 +0000 |
---|---|---|
committer | marius <marius@FreeBSD.org> | 2010-10-02 18:53:12 +0000 |
commit | 9c329941907d63b275da17ba20294c7f0a2e324b (patch) | |
tree | be43fedc87f2ffc4b3d13f6ff4002bb017799ac5 /sys/dev/mii/atphy.c | |
parent | e9dc33bfce177d81402bea81ce874ef0bb9f3536 (diff) | |
download | FreeBSD-src-9c329941907d63b275da17ba20294c7f0a2e324b.zip FreeBSD-src-9c329941907d63b275da17ba20294c7f0a2e324b.tar.gz |
- In the spirit of previous simplifications factor out the checks for a
different PHY instance being selected and isolation out into the wrappers
around the service methods rather than duplicating them over and over
again (besides, a PHY driver shouldn't need to care about which instance
it actually is).
- Centralize the check for the need to isolate a non-zero PHY instance not
supporting isolation in mii_mediachg() and just ignore it rather than
panicing, which should sufficient given that a) things are likely to
just work anyway if one doesn't plug in more than one port at a time and
b) refusing to attach in this case just leaves us in a unknown but most
likely also not exactly correct configuration (besides several drivers
setting MIIF_NOISOLATE didn't care about these anyway, probably due to
setting this flag for no real reason).
- Minor fixes like removing unnecessary setting of sc->mii_anegticks,
using sc->mii_anegticks instead of hardcoded values etc.
Diffstat (limited to 'sys/dev/mii/atphy.c')
-rw-r--r-- | sys/dev/mii/atphy.c | 28 |
1 files changed, 2 insertions, 26 deletions
diff --git a/sys/dev/mii/atphy.c b/sys/dev/mii/atphy.c index a95382e..fd531ad 100644 --- a/sys/dev/mii/atphy.c +++ b/sys/dev/mii/atphy.c @@ -113,13 +113,10 @@ atphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); - sc->mii_inst = mii->mii_instance; + sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = atphy_service; sc->mii_pdata = mii; - sc->mii_anegticks = MII_ANEGTICKS_GIGE; - - mii->mii_instance++; asc->mii_oui = MII_OUI(ma->mii_id1, ma->mii_id2); asc->mii_model = MII_MODEL(ma->mii_id2); @@ -138,7 +135,7 @@ atphy_attach(device_t dev) printf("\n"); MIIBUS_MEDIAINIT(sc->mii_dev); - return(0); + return (0); } static int @@ -149,25 +146,10 @@ atphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) switch (cmd) { case MII_POLLSTAT: - /* - * If we're not polling our PHY instance, just return. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); break; case MII_MEDIACHG: /* - * If the media indicates a different PHY instance, - * isolate ourselves. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) { - bmcr = PHY_READ(sc, MII_BMCR); - PHY_WRITE(sc, MII_BMCR, bmcr | BMCR_ISO); - return (0); - } - - /* * If the interface is not up, don't do anything. */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) @@ -225,12 +207,6 @@ done: case MII_TICK: /* - * If we're not currently selected, just return. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); - - /* * Is the interface even up? */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) |