Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/mii On the Gig PHYTER, For whatever reason, the 10ba...



details:   https://anonhg.NetBSD.org/src/rev/6dc1cda279ef
branches:  trunk
changeset: 510538:6dc1cda279ef
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Thu May 31 18:47:22 2001 +0000

description:
On the Gig PHYTER, For whatever reason, the 10baseT-related bits of the
BMSR are wired to 0, yet the PHY supports 10baseT.  So, to get around
this, we test the ANAR 10baseT bits after a PHY reset.  These bits are
set according to input pin 180.  If we see the 10baseT ANAR bits set,
we fake them in the BMSR so that we can actually autonegotiate 10baseT.

diffstat:

 sys/dev/mii/gphyter.c |  27 +++++++++++++++++++--------
 1 files changed, 19 insertions(+), 8 deletions(-)

diffs (62 lines):

diff -r 372ce7121e77 -r 6dc1cda279ef sys/dev/mii/gphyter.c
--- a/sys/dev/mii/gphyter.c     Thu May 31 18:46:07 2001 +0000
+++ b/sys/dev/mii/gphyter.c     Thu May 31 18:47:22 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gphyter.c,v 1.1 2001/05/31 16:06:58 thorpej Exp $      */
+/*     $NetBSD: gphyter.c,v 1.2 2001/05/31 18:47:22 thorpej Exp $      */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -134,7 +134,7 @@
        struct mii_attach_args *ma = aux;
        struct mii_data *mii = ma->mii_data;
        const char *model;
-       uint16_t strap;
+       int anar, strap;
 
        switch (MII_MODEL(ma->mii_id2)) {
        case MII_MODEL_xxNATSEMI_DP83861:
@@ -163,6 +163,20 @@
            PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
        if (sc->mii_capabilities & BMSR_EXTSTAT)
                sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR);
+
+       /*
+        * The Gig PHYTER seems to have the 10baseT BMSR bits
+        * hard-wired to 0, even though the device supports
+        * 10baseT.  What we do instead is read the post-reset
+        * ANAR, who's 10baseT-related bits are set by strapping
+        * pin 180, and fake the BMSR bits.
+        */
+       anar = PHY_READ(sc, MII_ANAR);
+       if (anar & ANAR_10)
+               sc->mii_capabilities |= (BMSR_10THDX & ma->mii_capmask);
+       if (anar & ANAR_10_FD)
+               sc->mii_capabilities |= (BMSR_10TFDX & ma->mii_capmask);
+
        printf("%s: ", sc->mii_dev.dv_xname);
        if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0 &&
            (sc->mii_extcapabilities & EXTSR_MEDIAMASK) == 0)
@@ -283,6 +297,9 @@
                switch (physup & (PHY_SUP_SPEED1|PHY_SUP_SPEED0)) {
                case PHY_SUP_SPEED1:
                        mii->mii_media_active |= IFM_1000_TX;
+                       gtsr = PHY_READ(sc, MII_100T2SR);
+                       if (gtsr & GTSR_MS_RES)
+                               mii->mii_media_active |= IFM_ETH_MASTER;
                        break;
 
                case PHY_SUP_SPEED0:
@@ -299,12 +316,6 @@
                }
                if (physup & PHY_SUP_DUPLEX)
                        mii->mii_media_active |= IFM_FDX;
-
-               gtsr = PHY_READ(sc, MII_100T2SR);
-#if 0
-               if (gtsr & GTSR_MS_RES)
-                       mii->mii_media_active |= IFM_MASTER;
-#endif
        } else
                mii->mii_media_active = ife->ifm_media;
 }



Home | Main Index | Thread Index | Old Index