diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2004-09-26 03:38:35 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2004-09-26 03:38:35 +0000 |
commit | 8a2abe42b39df4369d042cf7fd6cd03c36747b5a (patch) | |
tree | 73a67c30948909e42d3ddae914d7f8fa53296bfe | |
parent | 8e8d95d27df054585cfa2d500a840a20e3ebf363 (diff) |
simplify MII_TICK case by using mii_phy_tick().
-rw-r--r-- | sys/dev/mii/bmtphy.c | 34 | ||||
-rw-r--r-- | sys/dev/mii/nsphy.c | 34 |
2 files changed, 4 insertions, 64 deletions
diff --git a/sys/dev/mii/bmtphy.c b/sys/dev/mii/bmtphy.c index 0f87f3aac29..4993f66a0de 100644 --- a/sys/dev/mii/bmtphy.c +++ b/sys/dev/mii/bmtphy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bmtphy.c,v 1.7 2004/09/26 00:59:58 brad Exp $ */ +/* $OpenBSD: bmtphy.c,v 1.8 2004/09/26 03:38:34 brad Exp $ */ /* $NetBSD: nsphy.c,v 1.25 2000/02/02 23:34:57 thorpej Exp $ */ /*- @@ -166,37 +166,7 @@ bmtphy_service(sc, mii, cmd) if (IFM_INST(ife->ifm_media) != sc->mii_inst) return (0); - /* - * Only used for autonegotiation. - */ - if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO) - return (0); - - /* - * Is the interface even up? - */ - if ((mii->mii_ifp->if_flags & IFF_UP) == 0) - return (0); - - /* - * Check to see if we have link. If we do, we don't - * need to restart the autonegotiation process. Read - * the BMSR twice in case it's latched. - */ - reg = PHY_READ(sc, MII_BMSR) | - PHY_READ(sc, MII_BMSR); - if (reg & BMSR_LINK) - return (0); - - /* - * Only retry autonegotiation every 5 seconds. - */ - if (++sc->mii_ticks != sc->mii_anegticks) - return (0); - - sc->mii_ticks = 0; - bmtphy_reset(sc); - if (mii_phy_auto(sc, 0) == EJUSTRETURN) + if (mii_phy_tick(sc) == EJUSTRETURN) return (0); break; diff --git a/sys/dev/mii/nsphy.c b/sys/dev/mii/nsphy.c index 3aead79d332..58086381bea 100644 --- a/sys/dev/mii/nsphy.c +++ b/sys/dev/mii/nsphy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nsphy.c,v 1.14 2004/09/26 00:59:58 brad Exp $ */ +/* $OpenBSD: nsphy.c,v 1.15 2004/09/26 03:38:34 brad Exp $ */ /* $NetBSD: nsphy.c,v 1.25 2000/02/02 23:34:57 thorpej Exp $ */ /*- @@ -229,37 +229,7 @@ nsphy_service(sc, mii, cmd) if (IFM_INST(ife->ifm_media) != sc->mii_inst) return (0); - /* - * Only used for autonegotiation. - */ - if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO) - return (0); - - /* - * Is the interface even up? - */ - if ((mii->mii_ifp->if_flags & IFF_UP) == 0) - return (0); - - /* - * Check to see if we have link. If we do, we don't - * need to restart the autonegotiation process. Read - * the BMSR twice in case it's latched. - */ - reg = PHY_READ(sc, MII_BMSR) | - PHY_READ(sc, MII_BMSR); - if (reg & BMSR_LINK) - return (0); - - /* - * Only retry autonegotiation every 5 seconds. - */ - if (++sc->mii_ticks != sc->mii_anegticks) - return (0); - - sc->mii_ticks = 0; - nsphy_reset(sc); - if (mii_phy_auto(sc, 0) == EJUSTRETURN) + if (mii_phy_tick(sc) == EJUSTRETURN) return (0); break; |