Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Move some initialization stuff in wm_attach() be...



details:   https://anonhg.NetBSD.org/src/rev/66e95d78ae88
branches:  trunk
changeset: 825496:66e95d78ae88
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Tue Jul 18 08:05:03 2017 +0000

description:
Move some initialization stuff in wm_attach() before wm_reset(). Some flags
and callback function is required to set correctly before wm_reset() because
wm_reset() and some helper functions refer them.

diffstat:

 sys/dev/pci/if_wm.c |  30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)

diffs (86 lines):

diff -r 065f1eac8f46 -r 66e95d78ae88 sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Tue Jul 18 08:01:07 2017 +0000
+++ b/sys/dev/pci/if_wm.c       Tue Jul 18 08:05:03 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wm.c,v 1.526 2017/07/18 08:01:07 msaitoh Exp $      */
+/*     $NetBSD: if_wm.c,v 1.527 2017/07/18 08:05:03 msaitoh Exp $      */
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.526 2017/07/18 08:01:07 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.527 2017/07/18 08:05:03 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -2188,9 +2188,6 @@
                break;
        }
 
-       /* Reset the chip to a known state. */
-       wm_reset(sc);
-
        /* Ensure the SMBI bit is clear before first NVM or PHY access */
        switch (sc->sc_type) {
        case WM_T_82571:
@@ -2237,9 +2234,6 @@
                        sc->sc_flags |= WM_F_EEPROM_INVALID;
        }
 
-       /* Set device properties (macflags) */
-       prop_dictionary_set_uint32(dict, "macflags", sc->sc_flags);
-
        if (sc->sc_flags & WM_F_EEPROM_INVALID)
                aprint_verbose_dev(sc->sc_dev, "No EEPROM");
        else {
@@ -2263,6 +2257,15 @@
        wm_nvm_version(sc);
        aprint_verbose("\n");
 
+       /*
+        * XXX The first call of wm_gmii_setup_phytype. The result might be
+        * incorrect.
+        */
+       wm_gmii_setup_phytype(sc, 0, 0);
+
+       /* Reset the chip to a known state. */
+       wm_reset(sc);
+
        /* Check for I21[01] PLL workaround */
        if (sc->sc_type == WM_T_I210)
                sc->sc_flags |= WM_F_PLL_WA_I210;
@@ -2575,6 +2578,9 @@
        snprintb(buf, sizeof(buf), WM_FLAGS, sc->sc_flags);
        aprint_verbose_dev(sc->sc_dev, "%s\n", buf);
 
+       /* Set device properties (macflags) */
+       prop_dictionary_set_uint32(dict, "macflags", sc->sc_flags);
+
        ifp = &sc->sc_ethercom.ec_if;
        xname = device_xname(sc->sc_dev);
        strlcpy(ifp->if_xname, xname, IFNAMSIZ);
@@ -9416,12 +9422,6 @@
        /* Initialize our media structures and probe the GMII. */
        mii->mii_ifp = ifp;
 
-       /*
-        * The first call of wm_mii_setup_phytype. The result might be
-        * incorrect.
-        */
-       wm_gmii_setup_phytype(sc, 0, 0);
-
        mii->mii_statchg = wm_gmii_statchg;
 
        /* get PHY control from SMBus to PCIe */
@@ -9514,7 +9514,7 @@
 
                /*
                 * PHY Found! Check PHY type again by the second call of
-                * wm_mii_setup_phytype.
+                * wm_gmii_setup_phytype.
                 */
                wm_gmii_setup_phytype(sc, child->mii_mpd_oui,
                    child->mii_mpd_model);



Home | Main Index | Thread Index | Old Index