summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2005-03-26 04:40:10 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2005-03-26 04:40:10 +0000
commit4383940392fe74c2d2b7fb9bb4bfab1af48e1459 (patch)
treed25ae963abc328866ffe27d4d2c49a5a92019347 /sys/dev
parenteedef93b45432d311e3a186545b98b7c3634d0b6 (diff)
Cleanup. Use defines, standard names, consistant comparison operators, etc.
for auto negotiation ticks code. No functional change. ok brad@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/mii/acphy.c4
-rw-r--r--sys/dev/mii/bmtphy.c4
-rw-r--r--sys/dev/mii/brgphy.c7
-rw-r--r--sys/dev/mii/ciphy.c10
-rw-r--r--sys/dev/mii/dcphy.c15
-rw-r--r--sys/dev/mii/eephy.c10
-rw-r--r--sys/dev/mii/gentbi.c4
-rw-r--r--sys/dev/mii/mii_physubr.c18
-rw-r--r--sys/dev/mii/miivar.h7
-rw-r--r--sys/dev/mii/nsgphy.c13
-rw-r--r--sys/dev/mii/nsphy.c4
-rw-r--r--sys/dev/mii/rgephy.c9
-rw-r--r--sys/dev/mii/tlphy.c8
-rw-r--r--sys/dev/mii/urlphy.c9
-rw-r--r--sys/dev/mii/xmphy.c9
15 files changed, 63 insertions, 68 deletions
diff --git a/sys/dev/mii/acphy.c b/sys/dev/mii/acphy.c
index cbfeaabf37d..4a4644b24ed 100644
--- a/sys/dev/mii/acphy.c
+++ b/sys/dev/mii/acphy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acphy.c,v 1.4 2005/02/05 04:28:23 brad Exp $ */
+/* $OpenBSD: acphy.c,v 1.5 2005/03/26 04:40:09 krw Exp $ */
/* $NetBSD: acphy.c,v 1.13 2003/04/29 01:49:33 thorpej Exp $ */
/*
@@ -114,7 +114,7 @@ acphyattach(struct device *parent, struct device *self, void *aux)
sc->mii_funcs = &acphy_funcs;
sc->mii_pdata = mii;
sc->mii_flags = ma->mii_flags;
- sc->mii_anegticks = 5;
+ sc->mii_anegticks = MII_ANEGTICKS;
PHY_RESET(sc);
diff --git a/sys/dev/mii/bmtphy.c b/sys/dev/mii/bmtphy.c
index 838f58a5152..991170e90fe 100644
--- a/sys/dev/mii/bmtphy.c
+++ b/sys/dev/mii/bmtphy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bmtphy.c,v 1.12 2005/02/04 23:23:56 brad Exp $ */
+/* $OpenBSD: bmtphy.c,v 1.13 2005/03/26 04:40:09 krw Exp $ */
/* $NetBSD: bmtphy.c,v 1.17 2005/01/17 13:17:45 scw Exp $ */
/*-
@@ -114,7 +114,7 @@ bmtphyattach(struct device *parent, struct device *self, void *aux)
sc->mii_funcs = &bmtphy_funcs;
sc->mii_pdata = mii;
sc->mii_flags = ma->mii_flags;
- sc->mii_anegticks = 5;
+ sc->mii_anegticks = MII_ANEGTICKS;
PHY_RESET(sc);
diff --git a/sys/dev/mii/brgphy.c b/sys/dev/mii/brgphy.c
index 7c36caee026..6e908e5b475 100644
--- a/sys/dev/mii/brgphy.c
+++ b/sys/dev/mii/brgphy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: brgphy.c,v 1.22 2005/02/05 22:30:52 brad Exp $ */
+/* $OpenBSD: brgphy.c,v 1.23 2005/03/26 04:40:09 krw Exp $ */
/*
* Copyright (c) 2000
@@ -142,8 +142,7 @@ brgphy_attach(struct device *parent, struct device *self, void *aux)
sc->mii_rev = MII_REV(ma->mii_id2);
sc->mii_pdata = mii;
sc->mii_flags = ma->mii_flags | MIIF_NOISOLATE;
- sc->mii_ticks = 0; /* XXX Should be zero. Should 0 in brgphy_reset?*/
- sc->mii_anegticks = 5;
+ sc->mii_anegticks = MII_ANEGTICKS;
PHY_RESET(sc);
@@ -274,7 +273,7 @@ setit:
/*
* Only retry autonegotiation every mii_anegticks seconds.
*/
- if (++sc->mii_ticks < sc->mii_anegticks)
+ if (++sc->mii_ticks <= sc->mii_anegticks)
return (0);
sc->mii_ticks = 0;
diff --git a/sys/dev/mii/ciphy.c b/sys/dev/mii/ciphy.c
index 7bc288d080e..ce1d7660bb3 100644
--- a/sys/dev/mii/ciphy.c
+++ b/sys/dev/mii/ciphy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ciphy.c,v 1.4 2005/02/19 06:00:03 brad Exp $ */
+/* $OpenBSD: ciphy.c,v 1.5 2005/03/26 04:40:09 krw Exp $ */
/* $FreeBSD: ciphy.c,v 1.1 2004/09/10 20:57:45 wpaul Exp $ */
/*
* Copyright (c) 2004
@@ -127,8 +127,7 @@ ciphyattach(struct device *parent, struct device *self, void *aux)
sc->mii_rev = MII_REV(ma->mii_id2);
sc->mii_pdata = mii;
sc->mii_flags = ma->mii_flags;
- sc->mii_ticks = 0; /* XXX */
- sc->mii_anegticks = 5;
+ sc->mii_anegticks = MII_ANEGTICKS;
sc->mii_flags |= MIIF_NOISOLATE;
@@ -270,10 +269,9 @@ setit:
break;
/*
- * Only retry autonegotiation every 5 seconds.
+ * Only retry autonegotiation every mii_anegticks seconds.
*/
- //if (++sc->mii_ticks <= 5/*10*/)
- if (++sc->mii_ticks <= sc->mii_anegticks /*10*/)
+ if (++sc->mii_ticks <= sc->mii_anegticks)
break;
sc->mii_ticks = 0;
diff --git a/sys/dev/mii/dcphy.c b/sys/dev/mii/dcphy.c
index c311be884eb..e944dd6e243 100644
--- a/sys/dev/mii/dcphy.c
+++ b/sys/dev/mii/dcphy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dcphy.c,v 1.13 2005/01/28 18:27:55 brad Exp $ */
+/* $OpenBSD: dcphy.c,v 1.14 2005/03/26 04:40:09 krw Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -99,7 +99,7 @@ struct cfdriver dcphy_cd = {
int dcphy_service(struct mii_softc *, struct mii_data *, int);
void dcphy_status(struct mii_softc *);
-int dcphy_auto(struct mii_softc *, int);
+int dcphy_mii_phy_auto(struct mii_softc *, int);
void dcphy_reset(struct mii_softc *);
const struct mii_phy_funcs dcphy_funcs = {
@@ -136,6 +136,7 @@ dcphy_attach(struct device *parent, struct device *self, void *aux)
sc->mii_funcs = &dcphy_funcs;
sc->mii_pdata = mii;
sc->mii_flags = ma->mii_flags;
+ sc->mii_anegticks = 50;
sc->mii_flags |= MIIF_NOISOLATE;
@@ -224,7 +225,7 @@ dcphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
case IFM_AUTO:
/*PHY_RESET(sc);*/
sc->mii_flags &= ~MIIF_DOINGAUTO;
- (void) dcphy_auto(sc, 0);
+ (void) dcphy_mii_phy_auto(sc, 0);
break;
case IFM_100_T4:
/*
@@ -288,7 +289,7 @@ dcphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
break;
/*
- * Only retry autonegotiation every 5 seconds.
+ * Only retry autonegotiation every mii_anegticks seconds.
*
* Otherwise, fall through to calling dcphy_status()
* since real Intel 21143 chips don't show valid link
@@ -297,12 +298,12 @@ dcphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
* successful autonegotation is never recognised on
* these chips.
*/
- if (++sc->mii_ticks != 50)
+ if (++sc->mii_ticks <= sc->mii_anegticks)
break;
sc->mii_ticks = 0;
sc->mii_flags &= ~MIIF_DOINGAUTO;
- dcphy_auto(sc, 0);
+ dcphy_mii_phy_auto(sc, 0);
break;
}
@@ -399,7 +400,7 @@ skip:
}
int
-dcphy_auto(struct mii_softc *mii, int waitfor)
+dcphy_mii_phy_auto(struct mii_softc *mii, int waitfor)
{
int i;
struct dc_softc *sc;
diff --git a/sys/dev/mii/eephy.c b/sys/dev/mii/eephy.c
index 46388ea2c74..ef59f2da4ed 100644
--- a/sys/dev/mii/eephy.c
+++ b/sys/dev/mii/eephy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: eephy.c,v 1.16 2005/02/05 22:30:52 brad Exp $ */
+/* $OpenBSD: eephy.c,v 1.17 2005/03/26 04:40:09 krw Exp $ */
/*
* Principal Author: Parag Patel
* Copyright (c) 2001
@@ -72,8 +72,6 @@ struct cfdriver eephy_cd = {
int eephy_mii_phy_auto(struct mii_softc *, int);
void eephy_reset(struct mii_softc *);
-extern void mii_phy_auto_timeout(void *);
-
const struct mii_phy_funcs eephy_funcs = {
eephy_service, eephy_status, eephy_reset,
};
@@ -129,7 +127,7 @@ eephyattach(struct device *parent, struct device *self, void *aux)
sc->mii_funcs = &eephy_funcs;
sc->mii_pdata = mii;
sc->mii_flags = ma->mii_flags;
- sc->mii_anegticks = 10;
+ sc->mii_anegticks = MII_ANEGTICKS_GIGE;
if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_MARVELL &&
MII_MODEL(ma->mii_id2) == MII_MODEL_MARVELL_E1011 &&
@@ -330,9 +328,9 @@ eephy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
}
/*
- * Only retry autonegotiation every 5 seconds.
+ * Only retry autonegotiation every mii_anegticks seconds.
*/
- if (++(sc->mii_ticks) != sc->mii_anegticks) {
+ if (++sc->mii_ticks <= sc->mii_anegticks) {
return (0);
}
sc->mii_ticks = 0;
diff --git a/sys/dev/mii/gentbi.c b/sys/dev/mii/gentbi.c
index 836eae27263..8f2ed99d4ee 100644
--- a/sys/dev/mii/gentbi.c
+++ b/sys/dev/mii/gentbi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gentbi.c,v 1.2 2004/10/08 00:37:55 brad Exp $ */
+/* $OpenBSD: gentbi.c,v 1.3 2005/03/26 04:40:09 krw Exp $ */
/* $NetBSD: gentbi.c,v 1.12 2004/04/11 15:40:56 thorpej Exp $ */
/*-
@@ -160,7 +160,7 @@ gentbiattach(struct device *parent, struct device *self, void *aux)
sc->mii_funcs = &gentbi_funcs;
sc->mii_pdata = mii;
sc->mii_flags = ma->mii_flags;
- sc->mii_anegticks = 5;
+ sc->mii_anegticks = MII_ANEGTICKS;
PHY_RESET(sc);
diff --git a/sys/dev/mii/mii_physubr.c b/sys/dev/mii/mii_physubr.c
index 7875465840a..d40b3214472 100644
--- a/sys/dev/mii/mii_physubr.c
+++ b/sys/dev/mii/mii_physubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mii_physubr.c,v 1.25 2005/02/07 15:01:24 mcbride Exp $ */
+/* $OpenBSD: mii_physubr.c,v 1.26 2005/03/26 04:40:09 krw Exp $ */
/* $NetBSD: mii_physubr.c,v 1.20 2001/04/13 23:30:09 thorpej Exp $ */
/*-
@@ -83,8 +83,6 @@ const struct mii_media mii_media_table[] = {
{ BMCR_S1000|BMCR_FDX, ANAR_CSMA, GTCR_ADV_1000TFDX },
};
-void mii_phy_auto_timeout(void *);
-
void
mii_phy_setmedia(struct mii_softc *sc)
{
@@ -251,10 +249,10 @@ mii_phy_tick(struct mii_softc *sc)
}
/*
- * Only retry autonegotiation every N seconds.
+ * Only retry autonegotiation every mii_anegticks seconds.
*/
if (!sc->mii_anegticks)
- sc->mii_anegticks = 5;
+ sc->mii_anegticks = MII_ANEGTICKS;
if (++sc->mii_ticks != sc->mii_anegticks)
return (EJUSTRETURN);
@@ -418,16 +416,16 @@ mii_phy_add_media(struct mii_softc *sc)
if (sc->mii_extcapabilities & EXTSR_MEDIAMASK) {
/*
* XXX Right now only handle 1000SX and 1000TX. Need
- * XXX to hnalde 1000LX and 1000CX some how.
+ * XXX to handle 1000LX and 1000CX some how.
*/
if (sc->mii_extcapabilities & EXTSR_1000XHDX) {
- sc->mii_anegticks = 10;
+ sc->mii_anegticks = MII_ANEGTICKS_GIGE;
sc->mii_flags |= MIIF_IS_1000X;
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_SX, 0,
sc->mii_inst), MII_MEDIA_1000_X);
}
if (sc->mii_extcapabilities & EXTSR_1000XFDX) {
- sc->mii_anegticks = 10;
+ sc->mii_anegticks = MII_ANEGTICKS_GIGE;
sc->mii_flags |= MIIF_IS_1000X;
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_SX, IFM_FDX,
sc->mii_inst), MII_MEDIA_1000_X_FDX);
@@ -442,14 +440,14 @@ mii_phy_add_media(struct mii_softc *sc)
* All 1000baseT PHYs have a 1000baseT control register.
*/
if (sc->mii_extcapabilities & EXTSR_1000THDX) {
- sc->mii_anegticks = 10;
+ sc->mii_anegticks = MII_ANEGTICKS_GIGE;
sc->mii_flags |= MIIF_HAVE_GTCR;
mii->mii_media.ifm_mask |= IFM_ETH_MASTER;
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_T, 0,
sc->mii_inst), MII_MEDIA_1000_T);
}
if (sc->mii_extcapabilities & EXTSR_1000TFDX) {
- sc->mii_anegticks = 10;
+ sc->mii_anegticks = MII_ANEGTICKS_GIGE;
sc->mii_flags |= MIIF_HAVE_GTCR;
mii->mii_media.ifm_mask |= IFM_ETH_MASTER;
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_T, IFM_FDX,
diff --git a/sys/dev/mii/miivar.h b/sys/dev/mii/miivar.h
index 3bbe6e25e64..7cda8632145 100644
--- a/sys/dev/mii/miivar.h
+++ b/sys/dev/mii/miivar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: miivar.h,v 1.22 2004/12/16 03:41:58 brad Exp $ */
+/* $OpenBSD: miivar.h,v 1.23 2005/03/26 04:40:09 krw Exp $ */
/* $NetBSD: miivar.h,v 1.17 2000/03/06 20:56:57 thorpej Exp $ */
/*-
@@ -142,6 +142,10 @@ struct mii_softc {
};
typedef struct mii_softc mii_softc_t;
+/* Default mii_anegticks values. */
+#define MII_ANEGTICKS 5
+#define MII_ANEGTICKS_GIGE 10
+
/* mii_flags */
#define MIIF_INITDONE 0x0001 /* has been initialized (mii_data) */
#define MIIF_NOISOLATE 0x0002 /* do not isolate the PHY */
@@ -251,6 +255,7 @@ void mii_phy_delete_media(struct mii_softc *);
void mii_phy_setmedia(struct mii_softc *);
int mii_phy_auto(struct mii_softc *, int);
+void mii_phy_auto_timeout(void *);
void mii_phy_reset(struct mii_softc *);
void mii_phy_down(struct mii_softc *);
int mii_phy_tick(struct mii_softc *);
diff --git a/sys/dev/mii/nsgphy.c b/sys/dev/mii/nsgphy.c
index 07ec2f1372f..aedf5968594 100644
--- a/sys/dev/mii/nsgphy.c
+++ b/sys/dev/mii/nsgphy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nsgphy.c,v 1.14 2005/02/19 06:00:04 brad Exp $ */
+/* $OpenBSD: nsgphy.c,v 1.15 2005/03/26 04:40:09 krw Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
* Copyright (c) 2001
@@ -77,8 +77,7 @@ struct cfdriver nsgphy_cd = {
int nsgphy_service(struct mii_softc *, struct mii_data *, int);
void nsgphy_status(struct mii_softc *);
-static int nsgphy_mii_phy_auto(struct mii_softc *, int);
-extern void mii_phy_auto_timeout(void *);
+int nsgphy_mii_phy_auto(struct mii_softc *, int);
const struct mii_phy_funcs nsgphy_funcs = {
nsgphy_service, nsgphy_status, mii_phy_reset,
@@ -121,7 +120,7 @@ nsgphyattach(struct device *parent, struct device *self, void *aux)
sc->mii_funcs = &nsgphy_funcs;
sc->mii_pdata = mii;
sc->mii_flags = ma->mii_flags;
- sc->mii_anegticks = 10;
+ sc->mii_anegticks = MII_ANEGTICKS_GIGE;
PHY_RESET(sc);
@@ -247,9 +246,9 @@ nsgphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
return (0);
/*
- * Only retry autonegotiation if we've hit the timeout.
+ * Only retry autonegotiation every mii_anegticks seconds.
*/
- if (++sc->mii_ticks != sc->mii_anegticks)
+ if (++sc->mii_ticks <= sc->mii_anegticks)
return (0);
sc->mii_ticks = 0;
@@ -347,7 +346,7 @@ nsgphy_status(struct mii_softc *sc)
}
-static int
+int
nsgphy_mii_phy_auto(struct mii_softc *sc, int waitfor)
{
int bmsr, ktcr = 0, i;
diff --git a/sys/dev/mii/nsphy.c b/sys/dev/mii/nsphy.c
index a364a57db9e..03ea1b3cc12 100644
--- a/sys/dev/mii/nsphy.c
+++ b/sys/dev/mii/nsphy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nsphy.c,v 1.18 2005/02/19 06:00:04 brad Exp $ */
+/* $OpenBSD: nsphy.c,v 1.19 2005/03/26 04:40:09 krw Exp $ */
/* $NetBSD: nsphy.c,v 1.25 2000/02/02 23:34:57 thorpej Exp $ */
/*-
@@ -143,7 +143,7 @@ nsphyattach(struct device *parent, struct device *self, void *aux)
sc->mii_funcs = &nsphy_funcs;
sc->mii_pdata = mii;
sc->mii_flags = ma->mii_flags;
- sc->mii_anegticks = 5;
+ sc->mii_anegticks = MII_ANEGTICKS;
PHY_RESET(sc);
diff --git a/sys/dev/mii/rgephy.c b/sys/dev/mii/rgephy.c
index 522ba91dd96..e1d60ca36fe 100644
--- a/sys/dev/mii/rgephy.c
+++ b/sys/dev/mii/rgephy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rgephy.c,v 1.8 2005/02/19 06:00:04 brad Exp $ */
+/* $OpenBSD: rgephy.c,v 1.9 2005/03/26 04:40:09 krw Exp $ */
/*
* Copyright (c) 2003
* Bill Paul <wpaul@windriver.com>. All rights reserved.
@@ -128,8 +128,7 @@ rgephyattach(struct device *parent, struct device *self, void *aux)
sc->mii_rev = MII_REV(ma->mii_id2);
sc->mii_pdata = mii;
sc->mii_flags = ma->mii_flags;
- sc->mii_ticks = 0; /* XXX */
- sc->mii_anegticks = 5;
+ sc->mii_anegticks = MII_ANEGTICKS;
sc->mii_flags |= MIIF_NOISOLATE;
@@ -273,9 +272,9 @@ setit:
break;
/*
- * Only retry autonegotiation every 5 seconds.
+ * Only retry autonegotiation every mii_anegticks seconds.
*/
- if (++sc->mii_ticks <= sc->mii_anegticks /*10*/)
+ if (++sc->mii_ticks <= sc->mii_anegticks)
break;
sc->mii_ticks = 0;
diff --git a/sys/dev/mii/tlphy.c b/sys/dev/mii/tlphy.c
index 8bb74af2827..58c4930999f 100644
--- a/sys/dev/mii/tlphy.c
+++ b/sys/dev/mii/tlphy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tlphy.c,v 1.16 2005/02/19 06:00:04 brad Exp $ */
+/* $OpenBSD: tlphy.c,v 1.17 2005/03/26 04:40:09 krw Exp $ */
/* $NetBSD: tlphy.c,v 1.26 2000/07/04 03:29:00 thorpej Exp $ */
/*-
@@ -115,7 +115,7 @@ struct cfattach tlphy_ca = {
};
int tlphy_service(struct mii_softc *, struct mii_data *, int);
-int tlphy_auto(struct tlphy_softc *, int);
+int tlphy_mii_phy_auto(struct tlphy_softc *, int);
void tlphy_acomp(struct tlphy_softc *);
void tlphy_status(struct mii_softc *);
@@ -235,7 +235,7 @@ tlphy_service(struct mii_softc *self, struct mii_data *mii, int cmd)
* an autonegotiation cycle, so there's no such
* thing as "already in auto mode".
*/
- (void) tlphy_auto(sc, 1);
+ (void) tlphy_mii_phy_auto(sc, 1);
break;
case IFM_10_2:
case IFM_10_5:
@@ -322,7 +322,7 @@ tlphy_status(struct mii_softc *physc)
}
int
-tlphy_auto(struct tlphy_softc *sc, int waitfor)
+tlphy_mii_phy_auto(struct tlphy_softc *sc, int waitfor)
{
int error;
diff --git a/sys/dev/mii/urlphy.c b/sys/dev/mii/urlphy.c
index 2aec216ec46..2b74e85e671 100644
--- a/sys/dev/mii/urlphy.c
+++ b/sys/dev/mii/urlphy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: urlphy.c,v 1.9 2005/02/05 04:56:27 brad Exp $ */
+/* $OpenBSD: urlphy.c,v 1.10 2005/03/26 04:40:09 krw Exp $ */
/* $NetBSD: urlphy.c,v 1.1 2002/03/28 21:07:53 ichiro Exp $ */
/*
* Copyright (c) 2001, 2002
@@ -114,7 +114,7 @@ urlphy_attach(struct device *parent, struct device *self, void *aux)
sc->mii_funcs = &urlphy_funcs;
sc->mii_pdata = mii;
sc->mii_flags = ma->mii_flags;
- sc->mii_anegticks = 10;
+ sc->mii_anegticks = MII_ANEGTICKS_GIGE;
/* Don't do loopback on this PHY. */
sc->mii_flags |= MIIF_NOLOOP;
@@ -193,10 +193,9 @@ urlphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
return (0);
/*
- * Only retry autonegotiation every N seconds.
+ * Only retry autonegotiation every mii_anegticks seconds.
*/
- KASSERT(sc->mii_anegticks != 0);
- if (++sc->mii_ticks != sc->mii_anegticks)
+ if (++sc->mii_ticks <= sc->mii_anegticks)
return (0);
sc->mii_ticks = 0;
diff --git a/sys/dev/mii/xmphy.c b/sys/dev/mii/xmphy.c
index c0729bb63b6..5e6109304b1 100644
--- a/sys/dev/mii/xmphy.c
+++ b/sys/dev/mii/xmphy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xmphy.c,v 1.11 2005/02/19 06:00:04 brad Exp $ */
+/* $OpenBSD: xmphy.c,v 1.12 2005/03/26 04:40:09 krw Exp $ */
/*
* Copyright (c) 2000
@@ -72,7 +72,6 @@ int xmphy_service(struct mii_softc *, struct mii_data *, int);
void xmphy_status(struct mii_softc *);
int xmphy_mii_phy_auto(struct mii_softc *, int);
-extern void mii_phy_auto_timeout(void *);
const struct mii_phy_funcs xmphy_funcs = {
xmphy_service, xmphy_status, mii_phy_reset,
@@ -112,7 +111,7 @@ xmphy_attach(struct device *parent, struct device *self, void *aux)
sc->mii_funcs = &xmphy_funcs;
sc->mii_pdata = mii;
sc->mii_flags = ma->mii_flags;
- sc->mii_anegticks = 5;
+ sc->mii_anegticks = MII_ANEGTICKS;
sc->mii_flags |= MIIF_NOISOLATE;
@@ -213,9 +212,9 @@ xmphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
return (0);
/*
- * Only retry autonegotiation every 5 seconds.
+ * Only retry autonegotiation every mii_anegticks seconds.
*/
- if (++sc->mii_ticks != sc->mii_anegticks)
+ if (++sc->mii_ticks <= sc->mii_anegticks)
return (0);
sc->mii_ticks = 0;