Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/mii - Remove the waitfor argument from mii_phy_auto().



details:   https://anonhg.NetBSD.org/src/rev/38a055244155
branches:  trunk
changeset: 1011720:38a055244155
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Tue Jul 07 08:44:12 2020 +0000

description:
- Remove the waitfor argument from mii_phy_auto().
- Whitespace fix.

diffstat:

 sys/dev/mii/ciphy.c       |   8 ++++----
 sys/dev/mii/igphy.c       |   8 ++++----
 sys/dev/mii/mii_physubr.c |  33 +++++++--------------------------
 sys/dev/mii/miivar.h      |   4 ++--
 sys/dev/mii/tlphy.c       |  14 +++-----------
 sys/dev/mii/urlphy.c      |   6 +++---
 6 files changed, 23 insertions(+), 50 deletions(-)

diffs (239 lines):

diff -r 616c8bfe717d -r 38a055244155 sys/dev/mii/ciphy.c
--- a/sys/dev/mii/ciphy.c       Tue Jul 07 08:35:16 2020 +0000
+++ b/sys/dev/mii/ciphy.c       Tue Jul 07 08:44:12 2020 +0000
@@ -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 @@
                        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 @@
                if (sc->mii_ticks <= sc->mii_anegticks)
                        break;
 
-               mii_phy_auto(sc, 0);
+               mii_phy_auto(sc);
                return 0;
        }
 
diff -r 616c8bfe717d -r 38a055244155 sys/dev/mii/igphy.c
--- a/sys/dev/mii/igphy.c       Tue Jul 07 08:35:16 2020 +0000
+++ b/sys/dev/mii/igphy.c       Tue Jul 07 08:44:12 2020 +0000
@@ -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 @@
                                        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, &gtcr);
                        gtcr |= GTCR_MAN_MS;
                        PHY_WRITE(sc, MII_100T2CR, gtcr);
-                       mii_phy_auto(sc, 0);
+                       mii_phy_auto(sc);
                        break;
                default:
                        break;
diff -r 616c8bfe717d -r 38a055244155 sys/dev/mii/mii_physubr.c
--- a/sys/dev/mii/mii_physubr.c Tue Jul 07 08:35:16 2020 +0000
+++ b/sys/dev/mii/mii_physubr.c Tue Jul 07 08:44:12 2020 +0000
@@ -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 @@
                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 @@
        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 @@
                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 @@
 
        if (!device_is_active(sc->mii_dev))
                return;
-       
+
        sc->mii_flags &= ~MIIF_DOINGAUTO;
 
        /* Update the media status. */
@@ -386,7 +367,7 @@
 
        PHY_RESET(sc);
 
-       if (mii_phy_auto(sc, 0) == EJUSTRETURN)
+       if (mii_phy_auto(sc) == EJUSTRETURN)
                return EJUSTRETURN;
 
        /*
diff -r 616c8bfe717d -r 38a055244155 sys/dev/mii/miivar.h
--- a/sys/dev/mii/miivar.h      Tue Jul 07 08:35:16 2020 +0000
+++ b/sys/dev/mii/miivar.h      Tue Jul 07 08:44:12 2020 +0000
@@ -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 @@
 
 /* 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 -r 616c8bfe717d -r 38a055244155 sys/dev/mii/tlphy.c
--- a/sys/dev/mii/tlphy.c       Tue Jul 07 08:35:16 2020 +0000
+++ b/sys/dev/mii/tlphy.c       Tue Jul 07 08:44:12 2020 +0000
@@ -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 @@
        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 -r 616c8bfe717d -r 38a055244155 sys/dev/mii/urlphy.c
--- a/sys/dev/mii/urlphy.c      Tue Jul 07 08:35:16 2020 +0000
+++ b/sys/dev/mii/urlphy.c      Tue Jul 07 08:44:12 2020 +0000
@@ -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@localhost>.  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 @@
 
                PHY_RESET(sc);
 
-               if (mii_phy_auto(sc, 0) == EJUSTRETURN)
+               if (mii_phy_auto(sc) == EJUSTRETURN)
                        return 0;
 
                break;



Home | Main Index | Thread Index | Old Index