Module Name: src Committed By: msaitoh Date: Tue Jul 7 08:44:12 UTC 2020
Modified Files: src/sys/dev/mii: ciphy.c igphy.c mii_physubr.c miivar.h tlphy.c urlphy.c Log Message: - Remove the waitfor argument from mii_phy_auto(). - Whitespace fix. To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/sys/dev/mii/ciphy.c cvs rdiff -u -r1.33 -r1.34 src/sys/dev/mii/igphy.c cvs rdiff -u -r1.90 -r1.91 src/sys/dev/mii/mii_physubr.c cvs rdiff -u -r1.71 -r1.72 src/sys/dev/mii/miivar.h cvs rdiff -u -r1.70 -r1.71 src/sys/dev/mii/tlphy.c cvs rdiff -u -r1.35 -r1.36 src/sys/dev/mii/urlphy.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/mii/ciphy.c diff -u src/sys/dev/mii/ciphy.c:1.39 src/sys/dev/mii/ciphy.c:1.40 --- src/sys/dev/mii/ciphy.c:1.39 Sun Mar 15 23:04:50 2020 +++ src/sys/dev/mii/ciphy.c Tue Jul 7 08:44:12 2020 @@ -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, stru 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; } Index: src/sys/dev/mii/igphy.c diff -u src/sys/dev/mii/igphy.c:1.33 src/sys/dev/mii/igphy.c:1.34 --- src/sys/dev/mii/igphy.c:1.33 Sun Mar 15 23:04:50 2020 +++ src/sys/dev/mii/igphy.c Tue Jul 7 08:44:12 2020 @@ -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_s 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; Index: src/sys/dev/mii/mii_physubr.c diff -u src/sys/dev/mii/mii_physubr.c:1.90 src/sys/dev/mii/mii_physubr.c:1.91 --- src/sys/dev/mii/mii_physubr.c:1.90 Sun Mar 15 23:04:50 2020 +++ src/sys/dev/mii/mii_physubr.c Tue Jul 7 08:44:12 2020 @@ -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 w 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_s 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; /* Index: src/sys/dev/mii/miivar.h diff -u src/sys/dev/mii/miivar.h:1.71 src/sys/dev/mii/miivar.h:1.72 --- src/sys/dev/mii/miivar.h:1.71 Mon May 25 19:47:58 2020 +++ src/sys/dev/mii/miivar.h Tue Jul 7 08:44:12 2020 @@ -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_sof /* 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 *); Index: src/sys/dev/mii/tlphy.c diff -u src/sys/dev/mii/tlphy.c:1.70 src/sys/dev/mii/tlphy.c:1.71 --- src/sys/dev/mii/tlphy.c:1.70 Tue Jul 7 08:35:16 2020 +++ src/sys/dev/mii/tlphy.c Tue Jul 7 08:44:12 2020 @@ -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; Index: src/sys/dev/mii/urlphy.c diff -u src/sys/dev/mii/urlphy.c:1.35 src/sys/dev/mii/urlphy.c:1.36 --- src/sys/dev/mii/urlphy.c:1.35 Wed Nov 27 10:19:21 2019 +++ src/sys/dev/mii/urlphy.c Tue Jul 7 08:44:12 2020 @@ -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 <n...@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, str PHY_RESET(sc); - if (mii_phy_auto(sc, 0) == EJUSTRETURN) + if (mii_phy_auto(sc) == EJUSTRETURN) return 0; break;