aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/mii/acphy.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/mii/acphy.c')
-rw-r--r--sys/dev/mii/acphy.c37
1 files changed, 16 insertions, 21 deletions
diff --git a/sys/dev/mii/acphy.c b/sys/dev/mii/acphy.c
index 96fefa28334fc..0008ef0b6b8d1 100644
--- a/sys/dev/mii/acphy.c
+++ b/sys/dev/mii/acphy.c
@@ -115,9 +115,9 @@ static driver_t acphy_driver = {
DRIVER_MODULE(acphy, miibus, acphy_driver, acphy_devclass, 0, 0);
-int acphy_service __P((struct mii_softc *, struct mii_data *, int));
-void acphy_reset __P((struct mii_softc *));
-void acphy_status __P((struct mii_softc *));
+static int acphy_service __P((struct mii_softc *, struct mii_data *, int));
+static void acphy_reset __P((struct mii_softc *));
+static void acphy_status __P((struct mii_softc *));
static int acphy_probe(dev)
device_t dev;
@@ -184,7 +184,7 @@ static int acphy_detach(dev)
return(0);
}
-int
+static int
acphy_service(sc, mii, cmd)
struct mii_softc *sc;
struct mii_data *mii;
@@ -253,26 +253,24 @@ acphy_service(sc, mii, cmd)
return (0);
/*
- * Only used for autonegotiation.
+ * Is the interface even up?
*/
- if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO)
+ if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
return (0);
/*
- * Is the interface even up?
+ * Only used for autonegotiation.
*/
- if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
- return (0);
+ if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO)
+ break;
/*
- * 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.
+ * check for link.
+ * Read the status register twice; BMSR_LINK is latch-low.
*/
- reg = PHY_READ(sc, MII_BMSR) |
- PHY_READ(sc, MII_BMSR);
+ reg = PHY_READ(sc, MII_BMSR) | PHY_READ(sc, MII_BMSR);
if (reg & BMSR_LINK)
- return (0);
+ break;
/*
* Only retry autonegotiation every 5 seconds.
@@ -291,14 +289,11 @@ acphy_service(sc, mii, cmd)
acphy_status(sc);
/* Callback if something changed. */
- if (sc->mii_active != mii->mii_media_active || cmd == MII_MEDIACHG) {
- MIIBUS_STATCHG(sc->mii_dev);
- sc->mii_active = mii->mii_media_active;
- }
+ mii_phy_update(sc, cmd);
return (0);
}
-void
+static void
acphy_status(sc)
struct mii_softc *sc;
{
@@ -343,7 +338,7 @@ acphy_status(sc)
mii->mii_media_active = ife->ifm_media;
}
-void
+static void
acphy_reset(sc)
struct mii_softc *sc;
{