Source-Changes-HG archive

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

[src/netbsd-6]: src/sys/dev/pci Pull up revisions:



details:   https://anonhg.NetBSD.org/src/rev/62f016ffe49b
branches:  netbsd-6
changeset: 775692:62f016ffe49b
user:      jdc <jdc%NetBSD.org@localhost>
date:      Thu Feb 14 22:08:28 2013 +0000

description:
Pull up revisions:
  src/sys/dev/pci/if_wm.c revision 1.243
  src/sys/dev/pci/if_wmvar.h revision 1.14
(requested by msaitoh in ticket #820).

Use 82580(and I350) specific PHY read/write functions.
Fixes PR#47542.

diffstat:

 sys/dev/pci/if_wm.c    |  62 ++++++++++++++++++++++++++++++++++++++++++++++++-
 sys/dev/pci/if_wmvar.h |   5 ++-
 2 files changed, 63 insertions(+), 4 deletions(-)

diffs (116 lines):

diff -r 0d0a8b5b8f6a -r 62f016ffe49b sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Thu Feb 14 22:06:18 2013 +0000
+++ b/sys/dev/pci/if_wm.c       Thu Feb 14 22:08:28 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wm.c,v 1.227.2.5 2012/12/17 00:30:05 riz Exp $      */
+/*     $NetBSD: if_wm.c,v 1.227.2.6 2013/02/14 22:08:28 jdc Exp $      */
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.227.2.5 2012/12/17 00:30:05 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.227.2.6 2013/02/14 22:08:28 jdc Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -542,6 +542,8 @@
 static void    wm_gmii_bm_writereg(device_t, int, int, int);
 static int     wm_gmii_hv_readreg(device_t, int, int);
 static void    wm_gmii_hv_writereg(device_t, int, int, int);
+static int     wm_gmii_82580_readreg(device_t, int, int);
+static void    wm_gmii_82580_writereg(device_t, int, int, int);
 static int     wm_sgmii_readreg(device_t, int, int);
 static void    wm_sgmii_writereg(device_t, int, int, int);
 
@@ -6277,6 +6279,10 @@
                } else if (sc->sc_type >= WM_T_80003) {
                        sc->sc_mii.mii_readreg = wm_gmii_i80003_readreg;
                        sc->sc_mii.mii_writereg = wm_gmii_i80003_writereg;
+               } else if (sc->sc_type >= WM_T_82580) {
+                       sc->sc_phytype = WMPHY_82580;
+                       sc->sc_mii.mii_readreg = wm_gmii_82580_readreg;
+                       sc->sc_mii.mii_writereg = wm_gmii_82580_writereg;
                } else if (sc->sc_type >= WM_T_82544) {
                        sc->sc_mii.mii_readreg = wm_gmii_i82544_readreg;
                        sc->sc_mii.mii_writereg = wm_gmii_i82544_writereg;
@@ -6980,6 +6986,58 @@
 }
 
 /*
+ * wm_gmii_82580_readreg:      [mii interface function]
+ *
+ *     Read a PHY register on the 82580 and I350.
+ * This could be handled by the PHY layer if we didn't have to lock the
+ * ressource ...
+ */
+static int
+wm_gmii_82580_readreg(device_t self, int phy, int reg)
+{
+       struct wm_softc *sc = device_private(self);
+       int sem;
+       int rv;
+
+       sem = swfwphysem[sc->sc_funcid];
+       if (wm_get_swfw_semaphore(sc, sem)) {
+               aprint_error_dev(sc->sc_dev, "%s: failed to get semaphore\n",
+                   __func__);
+               return 0;
+       }
+
+       rv = wm_gmii_i82544_readreg(self, phy, reg);
+
+       wm_put_swfw_semaphore(sc, sem);
+       return rv;
+}
+
+/*
+ * wm_gmii_82580_writereg:     [mii interface function]
+ *
+ *     Write a PHY register on the 82580 and I350.
+ * This could be handled by the PHY layer if we didn't have to lock the
+ * ressource ...
+ */
+static void
+wm_gmii_82580_writereg(device_t self, int phy, int reg, int val)
+{
+       struct wm_softc *sc = device_private(self);
+       int sem;
+
+       sem = swfwphysem[sc->sc_funcid];
+       if (wm_get_swfw_semaphore(sc, sem)) {
+               aprint_error_dev(sc->sc_dev, "%s: failed to get semaphore\n",
+                   __func__);
+               return;
+       }
+
+       wm_gmii_i82544_writereg(self, phy, reg, val);
+
+       wm_put_swfw_semaphore(sc, sem);
+}
+
+/*
  * wm_gmii_statchg:    [mii interface function]
  *
  *     Callback from MII layer when media changes.
diff -r 0d0a8b5b8f6a -r 62f016ffe49b sys/dev/pci/if_wmvar.h
--- a/sys/dev/pci/if_wmvar.h    Thu Feb 14 22:06:18 2013 +0000
+++ b/sys/dev/pci/if_wmvar.h    Thu Feb 14 22:08:28 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wmvar.h,v 1.12.10.1 2012/06/28 16:06:36 riz Exp $   */
+/*     $NetBSD: if_wmvar.h,v 1.12.10.2 2013/02/14 22:08:28 jdc Exp $   */
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -140,7 +140,8 @@
        WMPHY_BM,
        WMPHY_82577,
        WMPHY_82578,
-       WMPHY_82579
+       WMPHY_82579,
+       WMPHY_82580
 } wm_phy_type;
 
 



Home | Main Index | Thread Index | Old Index