aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/mii
diff options
context:
space:
mode:
authorBill Paul <wpaul@FreeBSD.org>2000-12-12 19:31:14 +0000
committerBill Paul <wpaul@FreeBSD.org>2000-12-12 19:31:14 +0000
commit34da0ef1974dc647a54bccbfd1d1ddb65d7f858f (patch)
tree33fd3cdd9689bd60386c96db1e3ceacd3fa54199 /sys/dev/mii
parent453b55658361f079cc49d1695ef0af2bd1d37454 (diff)
Notes
Diffstat (limited to 'sys/dev/mii')
-rw-r--r--sys/dev/mii/amphy.c1
-rw-r--r--sys/dev/mii/brgphy.c4
-rw-r--r--sys/dev/mii/exphy.c1
-rw-r--r--sys/dev/mii/mii_physubr.c12
-rw-r--r--sys/dev/mii/miivar.h2
-rw-r--r--sys/dev/mii/mlphy.c1
-rw-r--r--sys/dev/mii/nsphy.c1
-rw-r--r--sys/dev/mii/pnaphy.c1
-rw-r--r--sys/dev/mii/rlphy.c1
-rw-r--r--sys/dev/mii/tdkphy.c1
-rw-r--r--sys/dev/mii/ukphy.c1
-rw-r--r--sys/dev/mii/xmphy.c4
12 files changed, 27 insertions, 3 deletions
diff --git a/sys/dev/mii/amphy.c b/sys/dev/mii/amphy.c
index 82dbb3625896..e873c8564b27 100644
--- a/sys/dev/mii/amphy.c
+++ b/sys/dev/mii/amphy.c
@@ -161,6 +161,7 @@ static int amphy_detach(dev)
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
+ mii_phy_auto_stop(sc);
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
diff --git a/sys/dev/mii/brgphy.c b/sys/dev/mii/brgphy.c
index a0118d5cb842..38febae6c35c 100644
--- a/sys/dev/mii/brgphy.c
+++ b/sys/dev/mii/brgphy.c
@@ -165,6 +165,8 @@ static int brgphy_detach(dev)
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
+ if (sc->mii_flags & MIIF_DOINGAUTO)
+ untimeout(mii_phy_auto_timeout, sc, sc->mii_auto_ch);
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
@@ -399,7 +401,7 @@ brgphy_mii_phy_auto(mii, waitfor)
*/
if ((mii->mii_flags & MIIF_DOINGAUTO) == 0) {
mii->mii_flags |= MIIF_DOINGAUTO;
- timeout(mii_phy_auto_timeout, mii, hz >> 1);
+ mii->mii_auto_ch = timeout(mii_phy_auto_timeout, mii, hz >> 1);
}
return (EJUSTRETURN);
}
diff --git a/sys/dev/mii/exphy.c b/sys/dev/mii/exphy.c
index f34f92a4645c..bbe1cc0c910a 100644
--- a/sys/dev/mii/exphy.c
+++ b/sys/dev/mii/exphy.c
@@ -214,6 +214,7 @@ static int exphy_detach(dev)
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
+ mii_phy_auto_stop(sc);
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
diff --git a/sys/dev/mii/mii_physubr.c b/sys/dev/mii/mii_physubr.c
index 7e1c8b5ec139..9139296cc5f8 100644
--- a/sys/dev/mii/mii_physubr.c
+++ b/sys/dev/mii/mii_physubr.c
@@ -106,12 +106,22 @@ mii_phy_auto(mii, waitfor)
*/
if ((mii->mii_flags & MIIF_DOINGAUTO) == 0) {
mii->mii_flags |= MIIF_DOINGAUTO;
- timeout(mii_phy_auto_timeout, mii, hz >> 1);
+ mii->mii_auto_ch = timeout(mii_phy_auto_timeout, mii, hz >> 1);
}
return (EJUSTRETURN);
}
void
+mii_phy_auto_stop(sc)
+ struct mii_softc *sc;
+{
+ if (sc->mii_flags & MIIF_DOINGAUTO) {
+ sc->mii_flags &= ~MIIF_DOINGAUTO;
+ untimeout(mii_phy_auto_timeout, sc, sc->mii_auto_ch);
+ }
+}
+
+void
mii_phy_auto_timeout(arg)
void *arg;
{
diff --git a/sys/dev/mii/miivar.h b/sys/dev/mii/miivar.h
index 4a68b9c7cf25..062686ca5ace 100644
--- a/sys/dev/mii/miivar.h
+++ b/sys/dev/mii/miivar.h
@@ -120,6 +120,7 @@ struct mii_softc {
mii_downcall_t mii_service; /* our downcall */
struct mii_data *mii_pdata; /* pointer to parent's mii_data */
+ struct callout_handle mii_auto_ch; /* callout handle for phy autoneg */
int mii_flags; /* misc. flags; see below */
int mii_capabilities; /* capabilities from BMSR */
@@ -170,6 +171,7 @@ void mii_add_media __P((struct mii_data *, int, int));
int mii_media_from_bmcr __P((int));
int mii_phy_auto __P((struct mii_softc *, int));
+void mii_phy_auto_stop __P((struct mii_softc *));
void mii_phy_reset __P((struct mii_softc *));
void ukphy_status __P((struct mii_softc *));
diff --git a/sys/dev/mii/mlphy.c b/sys/dev/mii/mlphy.c
index d83afd377c38..b38cfc3bf202 100644
--- a/sys/dev/mii/mlphy.c
+++ b/sys/dev/mii/mlphy.c
@@ -186,6 +186,7 @@ static int mlphy_detach(dev)
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
+ mii_phy_auto_stop(&sc->ml_mii);
sc->ml_mii.mii_dev = NULL;
LIST_REMOVE(&sc->ml_mii, mii_list);
diff --git a/sys/dev/mii/nsphy.c b/sys/dev/mii/nsphy.c
index aee90da9cac0..d6ee562d8695 100644
--- a/sys/dev/mii/nsphy.c
+++ b/sys/dev/mii/nsphy.c
@@ -207,6 +207,7 @@ static int nsphy_detach(dev)
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
+ mii_phy_auto_stop(sc);
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
diff --git a/sys/dev/mii/pnaphy.c b/sys/dev/mii/pnaphy.c
index 9a661b30f600..5f8580a8e238 100644
--- a/sys/dev/mii/pnaphy.c
+++ b/sys/dev/mii/pnaphy.c
@@ -168,6 +168,7 @@ static int pnaphy_detach(dev)
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
+ mii_phy_auto_stop(sc);
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
diff --git a/sys/dev/mii/rlphy.c b/sys/dev/mii/rlphy.c
index 15e7ee1a160b..0a0e3755728a 100644
--- a/sys/dev/mii/rlphy.c
+++ b/sys/dev/mii/rlphy.c
@@ -174,6 +174,7 @@ static int rlphy_detach(dev)
sc = device_get_softc(dev);
mii = device_get_softc(device_get_softc(dev));
+ mii_phy_auto_stop(sc);
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
diff --git a/sys/dev/mii/tdkphy.c b/sys/dev/mii/tdkphy.c
index e0cc5d850b03..4c3d6f8157b4 100644
--- a/sys/dev/mii/tdkphy.c
+++ b/sys/dev/mii/tdkphy.c
@@ -168,6 +168,7 @@ static int tdkphy_detach(device_t dev)
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
+ mii_phy_auto_stop(sc);
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
diff --git a/sys/dev/mii/ukphy.c b/sys/dev/mii/ukphy.c
index df004207725e..bdc47b406931 100644
--- a/sys/dev/mii/ukphy.c
+++ b/sys/dev/mii/ukphy.c
@@ -192,6 +192,7 @@ static int ukphy_detach(dev)
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
+ mii_phy_auto_stop(sc);
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
diff --git a/sys/dev/mii/xmphy.c b/sys/dev/mii/xmphy.c
index 8e46061824b3..d312ac2146ee 100644
--- a/sys/dev/mii/xmphy.c
+++ b/sys/dev/mii/xmphy.c
@@ -166,6 +166,8 @@ static int xmphy_detach(dev)
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
+ if (sc->mii_flags & MIIF_DOINGAUTO)
+ untimeout(mii_phy_auto_timeout, sc, sc->mii_auto_ch);
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
@@ -385,7 +387,7 @@ xmphy_mii_phy_auto(mii, waitfor)
*/
if ((mii->mii_flags & MIIF_DOINGAUTO) == 0) {
mii->mii_flags |= MIIF_DOINGAUTO;
- timeout(mii_phy_auto_timeout, mii, hz >> 1);
+ mii->mii_auto_ch = timeout(mii_phy_auto_timeout, mii, hz >> 1);
}
return (EJUSTRETURN);
}