diff options
| author | msaitoh <msaitoh@NetBSD.org> | 2020-07-07 08:44:12 +0000 |
|---|---|---|
| committer | msaitoh <msaitoh@NetBSD.org> | 2020-07-07 08:44:12 +0000 |
| commit | e28eda5d760f273da5f37e607c53868c85bde9ca (patch) | |
| tree | 185554f51d2e136b39a085e72f203d9d630d5955 /sys/dev/mii | |
| parent | 9779613792e5ad2bcd7876fc97093397d5d1d026 (diff) | |
- Remove the waitfor argument from mii_phy_auto().
- Whitespace fix.
Diffstat (limited to 'sys/dev/mii')
| -rw-r--r-- | sys/dev/mii/ciphy.c | 8 | ||||
| -rw-r--r-- | sys/dev/mii/igphy.c | 8 | ||||
| -rw-r--r-- | sys/dev/mii/mii_physubr.c | 33 | ||||
| -rw-r--r-- | sys/dev/mii/miivar.h | 4 | ||||
| -rw-r--r-- | sys/dev/mii/tlphy.c | 14 | ||||
| -rw-r--r-- | sys/dev/mii/urlphy.c | 6 |
6 files changed, 23 insertions, 50 deletions
diff --git a/sys/dev/mii/ciphy.c b/sys/dev/mii/ciphy.c index e23e5acafbd..722122da3e2 100644 --- a/sys/dev/mii/ciphy.c +++ b/sys/dev/mii/ciphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: ciphy.c,v 1.39 2020/03/15 23:04:50 thorpej Exp $ */ +/* $NetBSD: ciphy.c,v 1.40 2020/07/07 08:44:12 msaitoh Exp $ */ /*- * Copyright (c) 2004 @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.39 2020/03/15 23:04:50 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.40 2020/07/07 08:44:12 msaitoh Exp $"); /* * Driver for the Cicada CS8201 10/100/1000 copper PHY. @@ -173,7 +173,7 @@ ciphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) if (reg & BMCR_AUTOEN) return 0; #endif - (void) mii_phy_auto(sc, 0); + (void) mii_phy_auto(sc); break; case IFM_1000_T: speed = BMCR_S1000; @@ -273,7 +273,7 @@ setit: if (sc->mii_ticks <= sc->mii_anegticks) break; - mii_phy_auto(sc, 0); + mii_phy_auto(sc); return 0; } diff --git a/sys/dev/mii/igphy.c b/sys/dev/mii/igphy.c index 3b9aa59a782..027f461f2f5 100644 --- a/sys/dev/mii/igphy.c +++ b/sys/dev/mii/igphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: igphy.c,v 1.33 2020/03/15 23:04:50 thorpej Exp $ */ +/* $NetBSD: igphy.c,v 1.34 2020/07/07 08:44:12 msaitoh Exp $ */ /* * The Intel copyright applies to the analog register setup, and the @@ -70,7 +70,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: igphy.c,v 1.33 2020/03/15 23:04:50 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: igphy.c,v 1.34 2020/07/07 08:44:12 msaitoh Exp $"); #ifdef _KERNEL_OPT #include "opt_mii.h" @@ -523,14 +523,14 @@ igphy_smartspeed_workaround(struct mii_softc *sc) gtcr &= ~GTCR_MAN_MS; PHY_WRITE(sc, MII_100T2CR, gtcr); } - mii_phy_auto(sc, 0); + mii_phy_auto(sc); } break; case IGPHY_TICK_DOWNSHIFT: PHY_READ(sc, MII_100T2CR, >cr); gtcr |= GTCR_MAN_MS; PHY_WRITE(sc, MII_100T2CR, gtcr); - mii_phy_auto(sc, 0); + mii_phy_auto(sc); break; default: break; diff --git a/sys/dev/mii/mii_physubr.c b/sys/dev/mii/mii_physubr.c index 0a4a3a9fddc..43728a4227d 100644 --- a/sys/dev/mii/mii_physubr.c +++ b/sys/dev/mii/mii_physubr.c @@ -1,4 +1,4 @@ -/* $NetBSD: mii_physubr.c,v 1.90 2020/03/15 23:04:50 thorpej Exp $ */ +/* $NetBSD: mii_physubr.c,v 1.91 2020/07/07 08:44:12 msaitoh Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.90 2020/03/15 23:04:50 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.91 2020/07/07 08:44:12 msaitoh Exp $"); #include <sys/param.h> #include <sys/device.h> @@ -147,7 +147,7 @@ mii_phy_setmedia(struct mii_softc *sc) PHY_READ(sc, MII_BMCR, &bmcr); if ((bmcr & BMCR_AUTOEN) == 0 || (sc->mii_flags & (MIIF_FORCEANEG | MIIF_DOPAUSE))) - (void) mii_phy_auto(sc, 1); + (void) mii_phy_auto(sc); return; } @@ -193,15 +193,14 @@ mii_phy_setmedia(struct mii_softc *sc) if (sc->mii_flags & MIIF_HAVE_GTCR) PHY_WRITE(sc, MII_100T2CR, gtcr); if (IFM_SUBTYPE(ife->ifm_media) == IFM_1000_T) - mii_phy_auto(sc, 0); + mii_phy_auto(sc); else PHY_WRITE(sc, MII_BMCR, bmcr); } int -mii_phy_auto(struct mii_softc *sc, int waitfor) +mii_phy_auto(struct mii_softc *sc) { - int i; struct mii_data *mii = sc->mii_pdata; struct ifmedia_entry *ife = mii->mii_media.ifm_cur; @@ -266,24 +265,6 @@ mii_phy_auto(struct mii_softc *sc, int waitfor) PHY_WRITE(sc, MII_BMCR, BMCR_AUTOEN | BMCR_STARTNEG); } - if (waitfor) { - /* Wait 500ms for it to complete. */ - for (i = 0; i < 500; i++) { - uint16_t bmsr; - - PHY_READ(sc, MII_BMSR, &bmsr); - if (bmsr & BMSR_ACOMP) - return 0; - delay(1000); - } - - /* - * Don't need to worry about clearing MIIF_DOINGAUTO. If that's - * set, a timeout is pending, and it will clear the flag. - */ - return EIO; - } - /* * Just let it finish asynchronously. This is for the benefit of * the tick handler driving autonegotiation. Don't want 500ms @@ -308,7 +289,7 @@ mii_phy_auto_timeout_locked(struct mii_softc *sc) if (!device_is_active(sc->mii_dev)) return; - + sc->mii_flags &= ~MIIF_DOINGAUTO; /* Update the media status. */ @@ -386,7 +367,7 @@ mii_phy_tick(struct mii_softc *sc) PHY_RESET(sc); - if (mii_phy_auto(sc, 0) == EJUSTRETURN) + if (mii_phy_auto(sc) == EJUSTRETURN) return EJUSTRETURN; /* diff --git a/sys/dev/mii/miivar.h b/sys/dev/mii/miivar.h index d1d9ea85a39..d62e3fa108e 100644 --- a/sys/dev/mii/miivar.h +++ b/sys/dev/mii/miivar.h @@ -1,4 +1,4 @@ -/* $NetBSD: miivar.h,v 1.71 2020/05/25 19:47:58 jmcneill Exp $ */ +/* $NetBSD: miivar.h,v 1.72 2020/07/07 08:44:12 msaitoh Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001, 2020 The NetBSD Foundation, Inc. @@ -331,7 +331,7 @@ void mii_phy_delete_media(struct mii_softc *); /* MII must be LOCKED */ void mii_phy_setmedia(struct mii_softc *); -int mii_phy_auto(struct mii_softc *, int); +int mii_phy_auto(struct mii_softc *); 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/tlphy.c b/sys/dev/mii/tlphy.c index 3fc9a52023b..9878ce29d83 100644 --- a/sys/dev/mii/tlphy.c +++ b/sys/dev/mii/tlphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: tlphy.c,v 1.70 2020/07/07 08:35:16 msaitoh Exp $ */ +/* $NetBSD: tlphy.c,v 1.71 2020/07/07 08:44:12 msaitoh Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -59,7 +59,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: tlphy.c,v 1.70 2020/07/07 08:35:16 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tlphy.c,v 1.71 2020/07/07 08:44:12 msaitoh Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -367,15 +367,7 @@ tlphy_auto(struct tlphy_softc *tsc) struct mii_softc *sc = &tsc->sc_mii; int error; - switch ((error = mii_phy_auto(sc, 0))) { - case EIO: - /* - * Just assume we're not in full-duplex mode. - * XXX Check link and try AUI/BNC? - */ - PHY_WRITE(sc, MII_BMCR, 0); - break; - + switch ((error = mii_phy_auto(sc))) { case EJUSTRETURN: /* Flag that we need to program when it completes. */ tsc->sc_need_acomp = 1; diff --git a/sys/dev/mii/urlphy.c b/sys/dev/mii/urlphy.c index 851ad64c205..3d2878c60ca 100644 --- a/sys/dev/mii/urlphy.c +++ b/sys/dev/mii/urlphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: urlphy.c,v 1.35 2019/11/27 10:19:21 msaitoh Exp $ */ +/* $NetBSD: urlphy.c,v 1.36 2020/07/07 08:44:12 msaitoh Exp $ */ /* * Copyright (c) 2001, 2002 * Shingo WATANABE <nabe@nabechan.org>. All rights reserved. @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: urlphy.c,v 1.35 2019/11/27 10:19:21 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: urlphy.c,v 1.36 2020/07/07 08:44:12 msaitoh Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -199,7 +199,7 @@ urlphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) PHY_RESET(sc); - if (mii_phy_auto(sc, 0) == EJUSTRETURN) + if (mii_phy_auto(sc) == EJUSTRETURN) return 0; break; |
