Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/mii Use (new) mii_mpd_rev in struct mii_softc rather...



details:   https://anonhg.NetBSD.org/src/rev/477fbb332de3
branches:  trunk
changeset: 792025:477fbb332de3
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Mon Dec 16 18:29:57 2013 +0000

description:
Use (new) mii_mpd_rev in struct mii_softc rather than providing our own
mii_revision in struct rgephy_softc.

diffstat:

 sys/dev/mii/rgephy.c |  24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diffs (98 lines):

diff -r 21e1ea1d0c75 -r 477fbb332de3 sys/dev/mii/rgephy.c
--- a/sys/dev/mii/rgephy.c      Mon Dec 16 15:49:40 2013 +0000
+++ b/sys/dev/mii/rgephy.c      Mon Dec 16 18:29:57 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rgephy.c,v 1.33 2013/06/16 06:29:08 msaitoh Exp $      */
+/*     $NetBSD: rgephy.c,v 1.34 2013/12/16 18:29:57 jakllsch Exp $     */
 
 /*
  * Copyright (c) 2003
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rgephy.c,v 1.33 2013/06/16 06:29:08 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rgephy.c,v 1.34 2013/12/16 18:29:57 jakllsch Exp $");
 
 
 /*
@@ -63,7 +63,6 @@
 
 struct rgephy_softc {
        struct mii_softc mii_sc;
-       int mii_revision;
 };
 
 CFATTACH_DECL_NEW(rgephy, sizeof(struct rgephy_softc),
@@ -122,11 +121,12 @@
        aprint_naive(": Media interface\n");
        aprint_normal(": %s, rev. %d\n", mpd->mpd_name, rev);
 
-       rsc->mii_revision = rev;
-
        sc->mii_dev = self;
        sc->mii_inst = mii->mii_instance;
        sc->mii_phy = ma->mii_phyno;
+       sc->mii_mpd_oui = MII_OUI(ma->mii_id1, ma->mii_id2);
+       sc->mii_mpd_model = MII_MODEL(ma->mii_id2);
+       sc->mii_mpd_rev = MII_REV(ma->mii_id2);
        sc->mii_pdata = mii;
        sc->mii_flags = mii->mii_flags;
        sc->mii_anegticks = MII_ANEGTICKS_GIGE;
@@ -303,7 +303,7 @@
                 * need to restart the autonegotiation process.  Read
                 * the BMSR twice in case it's latched.
                 */
-               if (rsc->mii_revision >= 2) {
+               if (sc->mii_mpd_rev >= 2) {
                        /* RTL8211B(L) */
                        reg = PHY_READ(sc, RGEPHY_MII_SSR);
                        if (reg & RGEPHY_SSR_LINK) {
@@ -359,7 +359,7 @@
        mii->mii_media_active = IFM_ETHER;
 
        rsc = (struct rgephy_softc *)sc;
-       if (rsc->mii_revision >= 2) {
+       if (sc->mii_mpd_rev >= 2) {
                ssr = PHY_READ(sc, RGEPHY_MII_SSR);
                if (ssr & RGEPHY_SSR_LINK)
                        mii->mii_media_status |= IFM_ACTIVE;
@@ -389,7 +389,7 @@
                }
        }
 
-       if (rsc->mii_revision >= 2) {
+       if (sc->mii_mpd_rev >= 2) {
                ssr = PHY_READ(sc, RGEPHY_MII_SSR);
                switch (ssr & RGEPHY_SSR_SPD_MASK) {
                case RGEPHY_SSR_S1000:
@@ -460,7 +460,7 @@
        int i;
 
        rsc = (struct rgephy_softc *)sc;
-       if (rsc->mii_revision < 2) {
+       if (sc->mii_mpd_rev < 2) {
                PHY_WRITE(sc, MII_BMCR, BMCR_PDOWN);
                DELAY(1000);
        }
@@ -496,7 +496,7 @@
        int val;
 
        rsc = (struct rgephy_softc *)sc;
-       if (rsc->mii_revision >= 2)
+       if (sc->mii_mpd_rev >= 2)
                return;
 
 #if 1
@@ -598,9 +598,9 @@
        DELAY(1000);
 
        rsc = (struct rgephy_softc *)sc;
-       if (rsc->mii_revision < 2) {
+       if (sc->mii_mpd_rev < 2) {
                rgephy_load_dspcode(sc);
-       } else if (rsc->mii_revision == 3) {
+       } else if (sc->mii_mpd_rev == 3) {
                /* RTL8211C(L) */
                ssr = PHY_READ(sc, RGEPHY_MII_SSR);
                if ((ssr & RGEPHY_SSR_ALDPS) != 0) {



Home | Main Index | Thread Index | Old Index