Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/mii - Simplify sc->mii_anegticks setting. Same as Fr...



details:   https://anonhg.NetBSD.org/src/rev/efc34c48732f
branches:  trunk
changeset: 967021:efc34c48732f
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Nov 27 10:19:20 2019 +0000

description:
- Simplify sc->mii_anegticks setting. Same as FreeBSD.

   Don't set the default value not in the attach function. Instead, set the
  default value (MII_ANEGTICKS) first in the beginning of the
  mii_phy_add_media(). The function already has the code to change the value to
  MII_ANEGTICKS_GIGE if it's gigabit capable.

- Remove extra pmf_device_register() call. It's done in mii_phy_add_media().

diffstat:

 sys/arch/arm/amlogic/gxlphy.c |  14 ++++----------
 sys/dev/mii/acphy.c           |  14 +++++---------
 sys/dev/mii/amhphy.c          |  13 ++++---------
 sys/dev/mii/atphy.c           |  11 ++---------
 sys/dev/mii/bmtphy.c          |  13 ++++---------
 sys/dev/mii/brgphy.c          |  10 +++-------
 sys/dev/mii/ciphy.c           |  16 +++++-----------
 sys/dev/mii/dmphy.c           |  13 ++++---------
 sys/dev/mii/etphy.c           |  13 +++----------
 sys/dev/mii/exphy.c           |  14 ++++----------
 sys/dev/mii/gentbi.c          |  13 +++----------
 sys/dev/mii/glxtphy.c         |  13 +++----------
 sys/dev/mii/gphyter.c         |  13 +++----------
 sys/dev/mii/icsphy.c          |  13 ++++---------
 sys/dev/mii/igphy.c           |  14 ++++----------
 sys/dev/mii/ihphy.c           |  14 ++++----------
 sys/dev/mii/ikphy.c           |  14 ++++----------
 sys/dev/mii/inphy.c           |  13 ++++---------
 sys/dev/mii/iophy.c           |  13 ++++---------
 sys/dev/mii/ipgphy.c          |   7 ++-----
 sys/dev/mii/jmphy.c           |  10 ++--------
 sys/dev/mii/lxtphy.c          |  16 +++++-----------
 sys/dev/mii/makphy.c          |  13 +++----------
 sys/dev/mii/micphy.c          |  14 ++++----------
 sys/dev/mii/mii_physubr.c     |  21 +++++++++++++++++----
 sys/dev/mii/mvphy.c           |  13 ++++---------
 sys/dev/mii/nsphy.c           |  13 ++++---------
 sys/dev/mii/nsphyter.c        |  13 ++++---------
 sys/dev/mii/pnaphy.c          |  13 ++++---------
 sys/dev/mii/qsphy.c           |  13 ++++---------
 sys/dev/mii/rdcphy.c          |  12 +++---------
 sys/dev/mii/rgephy.c          |  22 ++++------------------
 sys/dev/mii/rlphy.c           |  10 ++++------
 sys/dev/mii/smscphy.c         |   9 ++-------
 sys/dev/mii/sqphy.c           |  13 ++++---------
 sys/dev/mii/tlphy.c           |  20 +++++++++-----------
 sys/dev/mii/tqphy.c           |  13 ++++---------
 sys/dev/mii/ukphy.c           |  14 ++++----------
 sys/dev/mii/urlphy.c          |  13 ++++---------
 39 files changed, 162 insertions(+), 361 deletions(-)

diffs (truncated from 1641 to 300 lines):

diff -r 54ce0a5f6af6 -r efc34c48732f sys/arch/arm/amlogic/gxlphy.c
--- a/sys/arch/arm/amlogic/gxlphy.c     Wed Nov 27 09:29:25 2019 +0000
+++ b/sys/arch/arm/amlogic/gxlphy.c     Wed Nov 27 10:19:20 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gxlphy.c,v 1.1 2019/04/21 11:02:32 jmcneill Exp $ */
+/* $NetBSD: gxlphy.c,v 1.2 2019/11/27 10:19:21 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2019 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gxlphy.c,v 1.1 2019/04/21 11:02:32 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gxlphy.c,v 1.2 2019/11/27 10:19:21 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -168,7 +168,6 @@
        sc->mii_funcs = &gxlphy_funcs;
        sc->mii_pdata = mii;
        sc->mii_flags = ma->mii_flags;
-       sc->mii_anegticks = MII_ANEGTICKS;
 
        PHY_RESET(sc);
 
@@ -180,13 +179,8 @@
        sc->mii_capabilities &= ma->mii_capmask;
        if (sc->mii_capabilities & BMSR_EXTSTAT)
                PHY_READ(sc, MII_EXTSR, &sc->mii_extcapabilities);
-       aprint_normal_dev(self, "");
-       if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0 &&
-           (sc->mii_extcapabilities & EXTSR_MEDIAMASK) == 0)
-               aprint_error("no media present");
-       else
-               mii_phy_add_media(sc);
-       aprint_normal("\n");
+
+       mii_phy_add_media(sc);
 }
 
 static int
diff -r 54ce0a5f6af6 -r efc34c48732f sys/dev/mii/acphy.c
--- a/sys/dev/mii/acphy.c       Wed Nov 27 09:29:25 2019 +0000
+++ b/sys/dev/mii/acphy.c       Wed Nov 27 10:19:20 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acphy.c,v 1.28 2019/03/25 09:20:46 msaitoh Exp $       */
+/*     $NetBSD: acphy.c,v 1.29 2019/11/27 10:19:20 msaitoh Exp $       */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acphy.c,v 1.28 2019/03/25 09:20:46 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acphy.c,v 1.29 2019/11/27 10:19:20 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -110,7 +110,6 @@
        sc->mii_funcs = &acphy_funcs;
        sc->mii_pdata = mii;
        sc->mii_flags = ma->mii_flags;
-       sc->mii_anegticks = MII_ANEGTICKS;
 
        PHY_RESET(sc);
 
@@ -122,20 +121,17 @@
 
 #define        ADD(m, c)       ifmedia_add(&mii->mii_media, (m), (c), NULL)
        if (sc->mii_flags & MIIF_HAVEFIBER) {
+               sc->mii_anegticks = MII_ANEGTICKS;
                ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_FX, 0, sc->mii_inst),
                    MII_MEDIA_100_TX);
                aprint_normal("100baseFX, ");
                ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_FX, IFM_FDX, sc->mii_inst),
                    MII_MEDIA_100_TX);
-               aprint_normal("100baseFX-FDX, ");
+               aprint_normal("100baseFX-FDX\n");
        }
 #undef ADD
 
-       if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0)
-               aprint_error("no media present");
-       else
-               mii_phy_add_media(sc);
-       aprint_normal("\n");
+       mii_phy_add_media(sc);
 }
 
 static int
diff -r 54ce0a5f6af6 -r efc34c48732f sys/dev/mii/amhphy.c
--- a/sys/dev/mii/amhphy.c      Wed Nov 27 09:29:25 2019 +0000
+++ b/sys/dev/mii/amhphy.c      Wed Nov 27 10:19:20 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amhphy.c,v 1.24 2019/11/26 08:21:03 msaitoh Exp $      */
+/*     $NetBSD: amhphy.c,v 1.25 2019/11/27 10:19:20 msaitoh Exp $      */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amhphy.c,v 1.24 2019/11/26 08:21:03 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amhphy.c,v 1.25 2019/11/27 10:19:20 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -105,18 +105,13 @@
        sc->mii_funcs = &amhphy_funcs;
        sc->mii_pdata = mii;
        sc->mii_flags = ma->mii_flags;
-       sc->mii_anegticks = MII_ANEGTICKS;
 
        PHY_RESET(sc);
 
        PHY_READ(sc, MII_BMSR, &sc->mii_capabilities);
        sc->mii_capabilities &= ma->mii_capmask;
-       aprint_normal_dev(self, "");
-       if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0)
-               aprint_error("no media present");
-       else
-               mii_phy_add_media(sc);
-       aprint_normal("\n");
+
+       mii_phy_add_media(sc);
 }
 
 static int
diff -r 54ce0a5f6af6 -r efc34c48732f sys/dev/mii/atphy.c
--- a/sys/dev/mii/atphy.c       Wed Nov 27 09:29:25 2019 +0000
+++ b/sys/dev/mii/atphy.c       Wed Nov 27 10:19:20 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atphy.c,v 1.25 2019/11/20 08:50:59 msaitoh Exp $ */
+/*     $NetBSD: atphy.c,v 1.26 2019/11/27 10:19:20 msaitoh Exp $ */
 /*     $OpenBSD: atphy.c,v 1.1 2008/09/25 20:47:16 brad Exp $  */
 
 /*-
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: atphy.c,v 1.25 2019/11/20 08:50:59 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atphy.c,v 1.26 2019/11/27 10:19:20 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -190,11 +190,6 @@
        sc->mii_funcs = &atphy_funcs;
        sc->mii_pdata = mii;
        sc->mii_flags = ma->mii_flags;
-       if (atphy_is_gige(mpd))
-               sc->mii_anegticks = MII_ANEGTICKS_GIGE;
-       else
-               sc->mii_anegticks = MII_ANEGTICKS;
-
        sc->mii_flags |= MIIF_NOLOOP;
 
        prop_dictionary_get_bool(parent_prop, "tx_internal_delay", &asc->rgmii_tx_internal_delay);
@@ -212,9 +207,7 @@
        if (atphy_is_gige(mpd) && (sc->mii_capabilities & BMSR_EXTSTAT))
                PHY_READ(sc, MII_EXTSR, &sc->mii_extcapabilities);
 
-       aprint_normal_dev(self, "");
        mii_phy_add_media(sc);
-       aprint_normal("\n");
 }
 
 int
diff -r 54ce0a5f6af6 -r efc34c48732f sys/dev/mii/bmtphy.c
--- a/sys/dev/mii/bmtphy.c      Wed Nov 27 09:29:25 2019 +0000
+++ b/sys/dev/mii/bmtphy.c      Wed Nov 27 10:19:20 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bmtphy.c,v 1.35 2019/03/25 09:20:46 msaitoh Exp $      */
+/*     $NetBSD: bmtphy.c,v 1.36 2019/11/27 10:19:20 msaitoh Exp $      */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bmtphy.c,v 1.35 2019/03/25 09:20:46 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bmtphy.c,v 1.36 2019/11/27 10:19:20 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -134,7 +134,6 @@
        sc->mii_funcs = &bmtphy_funcs;
        sc->mii_pdata = mii;
        sc->mii_flags = ma->mii_flags;
-       sc->mii_anegticks = MII_ANEGTICKS;
 
        PHY_RESET(sc);
 
@@ -142,12 +141,8 @@
 
        PHY_READ(sc, MII_BMSR, &sc->mii_capabilities);
        sc->mii_capabilities &= ma->mii_capmask;
-       aprint_normal_dev(self, "");
-       if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0)
-               aprint_error("no media present");
-       else
-               mii_phy_add_media(sc);
-       aprint_normal("\n");
+
+       mii_phy_add_media(sc);
 }
 
 static int
diff -r 54ce0a5f6af6 -r efc34c48732f sys/dev/mii/brgphy.c
--- a/sys/dev/mii/brgphy.c      Wed Nov 27 09:29:25 2019 +0000
+++ b/sys/dev/mii/brgphy.c      Wed Nov 27 10:19:20 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: brgphy.c,v 1.85 2019/11/26 08:21:03 msaitoh Exp $      */
+/*     $NetBSD: brgphy.c,v 1.86 2019/11/27 10:19:20 msaitoh Exp $      */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.85 2019/11/26 08:21:03 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.86 2019/11/27 10:19:20 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -216,7 +216,6 @@
        sc->mii_mpd_rev = MII_REV(ma->mii_id2);
        sc->mii_pdata = mii;
        sc->mii_flags = ma->mii_flags;
-       sc->mii_anegticks = MII_ANEGTICKS;
 
        if (device_is_a(parent, "bge"))
                bsc->sc_isbge = true;
@@ -271,7 +270,6 @@
        if (sc->mii_capabilities & BMSR_EXTSTAT)
                PHY_READ(sc, MII_EXTSR, &sc->mii_extcapabilities);
 
-       aprint_normal_dev(self, "");
        if (sc->mii_flags & MIIF_HAVEFIBER) {
                sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP;
 
@@ -293,14 +291,12 @@
                            & BNX_PHY_2_5G_CAPABLE_FLAG) {
                                ADD(IFM_MAKEWORD(IFM_ETHER, IFM_2500_SX,
                                        IFM_FDX, sc->mii_inst), 0);
-                               aprint_normal("2500baseSX-FDX, ");
+                               aprint_normal_dev(self, "2500baseSX-FDX\n");
 #undef ADD
                        }
                }
        }
        mii_phy_add_media(sc);
-
-       aprint_normal("\n");
 }
 
 static int
diff -r 54ce0a5f6af6 -r efc34c48732f sys/dev/mii/ciphy.c
--- a/sys/dev/mii/ciphy.c       Wed Nov 27 09:29:25 2019 +0000
+++ b/sys/dev/mii/ciphy.c       Wed Nov 27 10:19:20 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ciphy.c,v 1.37 2019/10/17 09:22:49 msaitoh Exp $ */
+/* $NetBSD: ciphy.c,v 1.38 2019/11/27 10:19:20 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2004
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.37 2019/10/17 09:22:49 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.38 2019/11/27 10:19:20 msaitoh Exp $");
 
 /*
  * Driver for the Cicada CS8201 10/100/1000 copper PHY.
@@ -117,8 +117,6 @@
        sc->mii_funcs = &ciphy_funcs;
        sc->mii_pdata = mii;
        sc->mii_flags = ma->mii_flags;
-       sc->mii_anegticks = MII_ANEGTICKS;
-
        sc->mii_flags |= MIIF_NOISOLATE;
 
        ciphy_reset(sc);
@@ -127,12 +125,8 @@
        sc->mii_capabilities &= ma->mii_capmask;
        if (sc->mii_capabilities & BMSR_EXTSTAT)
                PHY_READ(sc, MII_EXTSR, &sc->mii_extcapabilities);
-       aprint_normal_dev(self, "");
-       if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0)
-               aprint_error("no media present");
-       else
-               mii_phy_add_media(sc);
-       aprint_normal("\n");
+



Home | Main Index | Thread Index | Old Index