Source-Changes-HG archive

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

[src/netbsd-1-5]: src/sys/dev/mii Update from trunk:



details:   https://anonhg.NetBSD.org/src/rev/2b0f4d8ac1eb
branches:  netbsd-1-5
changeset: 488426:2b0f4d8ac1eb
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue Jul 04 04:11:12 2000 +0000

description:
Update from trunk:
Restructure the PHY entry points to use a structure of entry points
instead of discrete function pointers, and extend this to include
a "reset" entry point.  Make sure any PHY-specific reset routine is
always used, and provide one for the LXT-970 which disables MII
interrupts (as is done for a few other PHYs we have drivers for).

diffstat:

 sys/dev/mii/dmphy.c       |  11 +++++++----
 sys/dev/mii/exphy.c       |  13 ++++++++-----
 sys/dev/mii/icsphy.c      |  15 +++++++++------
 sys/dev/mii/inphy.c       |  13 ++++++++-----
 sys/dev/mii/iophy.c       |  13 ++++++++-----
 sys/dev/mii/lxtphy.c      |  24 +++++++++++++++++++-----
 sys/dev/mii/mii.c         |  10 +++++-----
 sys/dev/mii/mii_physubr.c |   8 ++++----
 sys/dev/mii/miivar.h      |  30 +++++++++++++++++++-----------
 sys/dev/mii/nsphy.c       |  13 ++++++++-----
 sys/dev/mii/nsphyter.c    |  13 ++++++++-----
 sys/dev/mii/qsphy.c       |  15 +++++++++------
 sys/dev/mii/sqphy.c       |  13 ++++++++-----
 sys/dev/mii/tlphy.c       |  13 ++++++++-----
 sys/dev/mii/tqphy.c       |  13 ++++++++-----
 sys/dev/mii/ukphy.c       |  13 ++++++++-----
 16 files changed, 144 insertions(+), 86 deletions(-)

diffs (truncated from 674 to 300 lines):

diff -r 34a50b206be2 -r 2b0f4d8ac1eb sys/dev/mii/dmphy.c
--- a/sys/dev/mii/dmphy.c       Tue Jul 04 01:18:53 2000 +0000
+++ b/sys/dev/mii/dmphy.c       Tue Jul 04 04:11:12 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dmphy.c,v 1.7 2000/04/02 03:06:19 tsutsui Exp $        */
+/*     $NetBSD: dmphy.c,v 1.7.4.1 2000/07/04 04:11:12 thorpej Exp $    */
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -99,6 +99,10 @@
 int    dmphy_service __P((struct mii_softc *, struct mii_data *, int));
 void   dmphy_status __P((struct mii_softc *));
 
+const struct mii_phy_funcs dmphy_funcs = {
+       dmphy_service, dmphy_status, mii_phy_reset,
+};
+
 int
 dmphymatch(parent, match, aux)
        struct device *parent;
@@ -129,12 +133,11 @@
 
        sc->mii_inst = mii->mii_instance;
        sc->mii_phy = ma->mii_phyno;
-       sc->mii_service = dmphy_service;
-       sc->mii_status = dmphy_status;
+       sc->mii_funcs = &dmphy_funcs;
        sc->mii_pdata = mii;
        sc->mii_flags = mii->mii_flags;
 
-       mii_phy_reset(sc);
+       PHY_RESET(sc);
 
        sc->mii_capabilities =
            PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
diff -r 34a50b206be2 -r 2b0f4d8ac1eb sys/dev/mii/exphy.c
--- a/sys/dev/mii/exphy.c       Tue Jul 04 01:18:53 2000 +0000
+++ b/sys/dev/mii/exphy.c       Tue Jul 04 04:11:12 2000 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: exphy.c,v 1.24 2000/03/06 20:56:56 thorpej Exp $       */
+/*     $NetBSD: exphy.c,v 1.24.4.1 2000/07/04 04:11:12 thorpej Exp $   */
 
 /*-
- * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
+ * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -95,6 +95,10 @@
 int    exphy_service __P((struct mii_softc *, struct mii_data *, int));
 void   exphy_reset __P((struct mii_softc *));
 
+const struct mii_phy_funcs exphy_funcs = {
+       exphy_service, ukphy_status, exphy_reset,
+};
+
 int
 exphymatch(parent, match, aux)
        struct device *parent;
@@ -132,8 +136,7 @@
 
        sc->mii_inst = mii->mii_instance;
        sc->mii_phy = ma->mii_phyno;
-       sc->mii_service = exphy_service;
-       sc->mii_status = ukphy_status;
+       sc->mii_funcs = &exphy_funcs;
        sc->mii_pdata = mii;
        sc->mii_flags = mii->mii_flags;
 
@@ -148,7 +151,7 @@
        }
        sc->mii_flags |= MIIF_NOISOLATE;
 
-       exphy_reset(sc);
+       PHY_RESET(sc);
 
        sc->mii_capabilities =
            PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
diff -r 34a50b206be2 -r 2b0f4d8ac1eb sys/dev/mii/icsphy.c
--- a/sys/dev/mii/icsphy.c      Tue Jul 04 01:18:53 2000 +0000
+++ b/sys/dev/mii/icsphy.c      Tue Jul 04 04:11:12 2000 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: icsphy.c,v 1.18 2000/03/06 20:56:57 thorpej Exp $      */
+/*     $NetBSD: icsphy.c,v 1.18.4.1 2000/07/04 04:11:12 thorpej Exp $  */
 
 /*-
- * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
+ * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -96,8 +96,12 @@
 };
 
 int    icsphy_service __P((struct mii_softc *, struct mii_data *, int));
+void   icsphy_status __P((struct mii_softc *));
 void   icsphy_reset __P((struct mii_softc *));
-void   icsphy_status __P((struct mii_softc *));
+
+const struct mii_phy_funcs icsphy_funcs = {
+       icsphy_service, icsphy_status, icsphy_reset,
+};
 
 int
 icsphymatch(parent, match, aux)
@@ -128,12 +132,11 @@
 
        sc->mii_inst = mii->mii_instance;
        sc->mii_phy = ma->mii_phyno;
-       sc->mii_service = icsphy_service;
-       sc->mii_status = icsphy_status;
+       sc->mii_funcs = &icsphy_funcs;
        sc->mii_pdata = mii;
        sc->mii_flags = mii->mii_flags;
 
-       icsphy_reset(sc);
+       PHY_RESET(sc);
 
        sc->mii_capabilities =
            PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
diff -r 34a50b206be2 -r 2b0f4d8ac1eb sys/dev/mii/inphy.c
--- a/sys/dev/mii/inphy.c       Tue Jul 04 01:18:53 2000 +0000
+++ b/sys/dev/mii/inphy.c       Tue Jul 04 04:11:12 2000 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: inphy.c,v 1.19 2000/03/06 20:56:57 thorpej Exp $       */
+/*     $NetBSD: inphy.c,v 1.19.4.1 2000/07/04 04:11:12 thorpej Exp $   */
 
 /*-
- * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
+ * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -99,6 +99,10 @@
 int    inphy_service __P((struct mii_softc *, struct mii_data *, int));
 void   inphy_status __P((struct mii_softc *));
 
+const struct mii_phy_funcs inphy_funcs = {
+       inphy_service, inphy_status, mii_phy_reset,
+};
+
 int
 inphymatch(parent, match, aux)
        struct device *parent;
@@ -128,12 +132,11 @@
 
        sc->mii_inst = mii->mii_instance;
        sc->mii_phy = ma->mii_phyno;
-       sc->mii_service = inphy_service;
-       sc->mii_status = inphy_status;
+       sc->mii_funcs = &inphy_funcs;
        sc->mii_pdata = mii;
        sc->mii_flags = mii->mii_flags;
 
-       mii_phy_reset(sc);
+       PHY_RESET(sc);
 
        sc->mii_capabilities =
            PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
diff -r 34a50b206be2 -r 2b0f4d8ac1eb sys/dev/mii/iophy.c
--- a/sys/dev/mii/iophy.c       Tue Jul 04 01:18:53 2000 +0000
+++ b/sys/dev/mii/iophy.c       Tue Jul 04 04:11:12 2000 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: iophy.c,v 1.9 2000/03/06 20:56:57 thorpej Exp $        */
+/*     $NetBSD: iophy.c,v 1.9.4.1 2000/07/04 04:11:12 thorpej Exp $    */
 
 /*
- * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
+ * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -97,6 +97,10 @@
 int    iophy_service __P((struct mii_softc *, struct mii_data *, int));
 void   iophy_status __P((struct mii_softc *));
 
+const struct mii_phy_funcs iophy_funcs = {
+       iophy_service, iophy_status, mii_phy_reset,
+};
+
 int
 iophymatch(parent, match, aux)
        struct device *parent;
@@ -130,12 +134,11 @@
 
        sc->mii_inst = mii->mii_instance;
        sc->mii_phy = ma->mii_phyno;
-       sc->mii_service = iophy_service;
-       sc->mii_status = iophy_status;
+       sc->mii_funcs = &iophy_funcs;
        sc->mii_pdata = mii;
        sc->mii_flags = mii->mii_flags;
 
-       mii_phy_reset(sc);
+       PHY_RESET(sc);
 
        sc->mii_capabilities =
            PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
diff -r 34a50b206be2 -r 2b0f4d8ac1eb sys/dev/mii/lxtphy.c
--- a/sys/dev/mii/lxtphy.c      Tue Jul 04 01:18:53 2000 +0000
+++ b/sys/dev/mii/lxtphy.c      Tue Jul 04 04:11:12 2000 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: lxtphy.c,v 1.20 2000/03/06 20:56:57 thorpej Exp $      */
+/*     $NetBSD: lxtphy.c,v 1.20.4.1 2000/07/04 04:11:12 thorpej Exp $  */
 
 /*-
- * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
+ * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -98,6 +98,11 @@
 
 int    lxtphy_service __P((struct mii_softc *, struct mii_data *, int));
 void   lxtphy_status __P((struct mii_softc *));
+void   lxtphy_reset __P((struct mii_softc *));
+
+const struct mii_phy_funcs lxtphy_funcs = {
+       lxtphy_service, lxtphy_status, lxtphy_reset,
+};
 
 int
 lxtphymatch(parent, match, aux)
@@ -128,12 +133,11 @@
 
        sc->mii_inst = mii->mii_instance;
        sc->mii_phy = ma->mii_phyno;
-       sc->mii_service = lxtphy_service;
-       sc->mii_status = lxtphy_status;
+       sc->mii_funcs = &lxtphy_funcs;
        sc->mii_pdata = mii;
        sc->mii_flags = mii->mii_flags;
 
-       mii_phy_reset(sc);
+       PHY_RESET(sc);
 
        sc->mii_capabilities =
            PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
@@ -256,3 +260,13 @@
        } else
                mii->mii_media_active = ife->ifm_media;
 }
+
+void
+lxtphy_reset(sc)
+       struct mii_softc *sc;
+{
+
+       mii_phy_reset(sc);
+       PHY_WRITE(sc, MII_LXTPHY_IER,
+           PHY_READ(sc, MII_LXTPHY_IER) & ~IER_INTEN);
+}
diff -r 34a50b206be2 -r 2b0f4d8ac1eb sys/dev/mii/mii.c
--- a/sys/dev/mii/mii.c Tue Jul 04 01:18:53 2000 +0000
+++ b/sys/dev/mii/mii.c Tue Jul 04 04:11:12 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mii.c,v 1.20 2000/03/23 07:01:36 thorpej Exp $ */
+/*     $NetBSD: mii.c,v 1.20.4.1 2000/07/04 04:11:12 thorpej Exp $     */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -265,7 +265,7 @@
 
        for (child = LIST_FIRST(&mii->mii_phys); child != NULL;
             child = LIST_NEXT(child, mii_list)) {
-               rv = (*child->mii_service)(child, mii, MII_MEDIACHG);
+               rv = PHY_SERVICE(child, mii, MII_MEDIACHG);
                if (rv)
                        return (rv);
        }
@@ -283,7 +283,7 @@
 
        for (child = LIST_FIRST(&mii->mii_phys); child != NULL;
             child = LIST_NEXT(child, mii_list))
-               (void) (*child->mii_service)(child, mii, MII_TICK);
+               (void) PHY_SERVICE(child, mii, MII_TICK);
 }
 
 /*
@@ -300,7 +300,7 @@
 
        for (child = LIST_FIRST(&mii->mii_phys); child != NULL;
             child = LIST_NEXT(child, mii_list))
-               (void) (*child->mii_service)(child, mii, MII_POLLSTAT);
+               (void) PHY_SERVICE(child, mii, MII_POLLSTAT);
 }
 
 /*
@@ -314,5 +314,5 @@
 
        for (child = LIST_FIRST(&mii->mii_phys); child != NULL;
             child = LIST_NEXT(child, mii_list))
-               (void) (*child->mii_service)(child, mii, MII_DOWN);
+               (void) PHY_SERVICE(child, mii, MII_DOWN);
 }
diff -r 34a50b206be2 -r 2b0f4d8ac1eb sys/dev/mii/mii_physubr.c
--- a/sys/dev/mii/mii_physubr.c Tue Jul 04 01:18:53 2000 +0000
+++ b/sys/dev/mii/mii_physubr.c Tue Jul 04 04:11:12 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mii_physubr.c,v 1.17 2000/03/23 07:01:36 thorpej Exp $ */



Home | Main Index | Thread Index | Old Index