Source-Changes-HG archive

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

[src/netbsd-6]: src Pullup the following revisions, requested by msaitoh in t...



details:   https://anonhg.NetBSD.org/src/rev/1cbcf4e4f39a
branches:  netbsd-6
changeset: 776787:1cbcf4e4f39a
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Nov 09 12:03:18 2014 +0000

description:
Pullup the following revisions, requested by msaitoh in ticket #1188:
sys/dev/pci/pcidevs                     1.1172
sys/dev/pci/if_wm.c                     1.263-1.266 via patch
sys/dev/pci/if_wmreg.h                  1.55-1.56
sys/dev/pci/if_wmvar.h                  1.17
share/man/man4/wm.4                     1.26-1.27 and 1.29 via patch

- Add I354 support.
- Insert completion barrier between register write and delay().
- Fix the definition of CTRL_GIO_M_DIS. This bit is not bit 3 but bit 2.
- Cleanup

diffstat:

 share/man/man4/wm.4    |   12 +-
 sys/dev/pci/if_wm.c    |  252 ++++++++++++++++++++++++++++++++++++++++--------
 sys/dev/pci/if_wmreg.h |   13 ++-
 sys/dev/pci/if_wmvar.h |    3 +-
 sys/dev/pci/pcidevs    |   39 +++++++-
 5 files changed, 268 insertions(+), 51 deletions(-)

diffs (truncated from 929 to 300 lines):

diff -r a7d30f7d6fad -r 1cbcf4e4f39a share/man/man4/wm.4
--- a/share/man/man4/wm.4       Sun Nov 09 11:09:11 2014 +0000
+++ b/share/man/man4/wm.4       Sun Nov 09 12:03:18 2014 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: wm.4,v 1.21.6.1 2012/06/28 16:06:36 riz Exp $
+.\"    $NetBSD: wm.4,v 1.21.6.2 2014/11/09 12:03:18 martin Exp $
 .\"
 .\" Copyright 2002, 2003 Wasabi Systems, Inc.
 .\" All rights reserved.
@@ -33,7 +33,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd June 20, 2012
+.Dd December 30, 2013
 .Dt WM 4
 .Os
 .Sh NAME
@@ -141,6 +141,14 @@
 Intel 82583 1000BASE-T Ethernet
 .It
 Intel I350 Ethernet (Copper, Fiber)
+.It
+Intel I354 (C2000 Internal) Ethernet (Copper, Fiber)
+.It
+Intel I210 Ethernet (Copper, Fiber)
+.It
+Intel I211 Ethernet
+.It
+Intel I217 and I218 Ethernet
 .El
 .Pp
 In addition to Intel's own
diff -r a7d30f7d6fad -r 1cbcf4e4f39a sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Sun Nov 09 11:09:11 2014 +0000
+++ b/sys/dev/pci/if_wm.c       Sun Nov 09 12:03:18 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wm.c,v 1.227.2.11 2014/06/03 14:57:09 msaitoh Exp $ */
+/*     $NetBSD: if_wm.c,v 1.227.2.12 2014/11/09 12:03:18 martin 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.11 2014/06/03 14:57:09 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.227.2.12 2014/11/09 12:03:18 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -543,11 +543,13 @@
 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 bool    wm_sgmii_uses_mdio(struct wm_softc *);
 static int     wm_sgmii_readreg(device_t, int, int);
 static void    wm_sgmii_writereg(device_t, int, int, int);
 
 static void    wm_gmii_statchg(device_t);
 
+static int     wm_get_phy_id_82575(struct wm_softc *);
 static void    wm_gmii_mediainit(struct wm_softc *, pci_product_id_t);
 static int     wm_gmii_mediachange(struct ifnet *);
 static void    wm_gmii_mediastatus(struct ifnet *, struct ifmediareq *);
@@ -1024,6 +1026,9 @@
          "I350 Gigabit Connection",
          WM_T_I350,            WMP_F_1000T },
 #endif
+       { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_C2000_SGMII,
+         "I354 Gigabit Connection",
+         WM_T_I354,            WMP_F_1000T },
        { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I210_T1,
          "I210-T1 Ethernet Server Adapter",
          WM_T_I210,            WMP_F_1000T },
@@ -1210,8 +1215,8 @@
 
        if ((sc->sc_type == WM_T_82575) || (sc->sc_type == WM_T_82576)
            || (sc->sc_type == WM_T_82580) || (sc->sc_type == WM_T_82580ER)
-           || (sc->sc_type == WM_T_I350) || (sc->sc_type == WM_T_I210)
-           || (sc->sc_type == WM_T_I211))
+           || (sc->sc_type == WM_T_I350) || (sc->sc_type == WM_T_I354)
+           || (sc->sc_type == WM_T_I210) || (sc->sc_type == WM_T_I211))
                sc->sc_flags |= WM_F_NEWQUEUE;
 
        /* Set device properties (mactype) */
@@ -1326,7 +1331,7 @@
            || (sc->sc_type ==  WM_T_82571) || (sc->sc_type == WM_T_80003)
            || (sc->sc_type == WM_T_82575) || (sc->sc_type == WM_T_82576)
            || (sc->sc_type == WM_T_82580) || (sc->sc_type == WM_T_82580ER)
-           || (sc->sc_type == WM_T_I350))
+           || (sc->sc_type == WM_T_I350) || (sc->sc_type == WM_T_I354))
                sc->sc_funcid = (CSR_READ(sc, WMREG_STATUS)
                    >> STATUS_FUNCID_SHIFT) & STATUS_FUNCID_MASK;
        else
@@ -1597,6 +1602,7 @@
        case WM_T_82580:
        case WM_T_82580ER:
        case WM_T_I350:
+       case WM_T_I354: /* XXXX ok? */
        case WM_T_80003:
                /* SPI */
                wm_set_spiaddrbits(sc);
@@ -1687,10 +1693,8 @@
        case WM_T_PCH:
        case WM_T_PCH2:
        case WM_T_PCH_LPT:
-               if (wm_check_mng_mode(sc) != 0) {
-                       printf ("get hw control (1)\n");
+               if (wm_check_mng_mode(sc) != 0)
                        wm_get_hw_control(sc);
-               }
                break;
        default:
                break;
@@ -1773,6 +1777,7 @@
        case WM_T_82580:
        case WM_T_82580ER:
        case WM_T_I350:
+       case WM_T_I354: /* XXX ok? */
        case WM_T_ICH8:
        case WM_T_ICH9:
        case WM_T_ICH10:
@@ -1899,20 +1904,30 @@
                case WM_T_82580:
                case WM_T_82580ER:
                case WM_T_I350:
+               case WM_T_I354:
                case WM_T_I210:
                case WM_T_I211:
                        reg = CSR_READ(sc, WMREG_CTRL_EXT);
                        switch (reg & CTRL_EXT_LINK_MODE_MASK) {
-                       case CTRL_EXT_LINK_MODE_SGMII:
-                               aprint_verbose_dev(sc->sc_dev, "SGMII\n");
-                               sc->sc_flags |= WM_F_SGMII;
+                       case CTRL_EXT_LINK_MODE_1000KX:
+                               aprint_verbose_dev(sc->sc_dev, "1000KX\n");
                                CSR_WRITE(sc, WMREG_CTRL_EXT,
                                    reg | CTRL_EXT_I2C_ENA);
-                               wm_gmii_mediainit(sc, wmp->wmp_product);
+                               panic("not supported yet\n");
                                break;
-                       case CTRL_EXT_LINK_MODE_1000KX:
+                       case CTRL_EXT_LINK_MODE_SGMII:
+                               if (wm_sgmii_uses_mdio(sc)) {
+                                       aprint_verbose_dev(sc->sc_dev,
+                                           "SGMII(MDIO)\n");
+                                       sc->sc_flags |= WM_F_SGMII;
+                                       wm_gmii_mediainit(sc,
+                                           wmp->wmp_product);
+                                       break;
+                               }
+                               aprint_verbose_dev(sc->sc_dev, "SGMII(I2C)\n");
+                               /*FALLTHROUGH*/
                        case CTRL_EXT_LINK_MODE_PCIE_SERDES:
-                               aprint_verbose_dev(sc->sc_dev, "1000KX or SERDES\n");
+                               aprint_verbose_dev(sc->sc_dev, "SERDES\n");
                                CSR_WRITE(sc, WMREG_CTRL_EXT,
                                    reg | CTRL_EXT_I2C_ENA);
                                panic("not supported yet\n");
@@ -1965,6 +1980,7 @@
        case WM_T_82580:
        case WM_T_82580ER:
        case WM_T_I350:
+       case WM_T_I354: /* XXXX ok? */
        case WM_T_I210:
        case WM_T_I211:
        case WM_T_80003:
@@ -3708,7 +3724,8 @@
                 * For an eratta, the RCTL_SECRC bit in RCTL register
                 * is always set in I350, so we don't trim it.
                 */
-               if ((sc->sc_type != WM_T_I350) && (sc->sc_type != WM_T_I210)
+               if ((sc->sc_type != WM_T_I350) && (sc->sc_type != WM_T_I354)
+                   && (sc->sc_type != WM_T_I210)
                    && (sc->sc_type != WM_T_I211)) {
                        if (m->m_len < ETHER_CRC_LEN) {
                                sc->sc_rxtail->m_len
@@ -3759,6 +3776,7 @@
                 * If VLANs are enabled, VLAN packets have been unwrapped
                 * for us.  Associate the tag with the packet.
                 */
+               /* XXXX should check for i350 and i354 */
                if ((status & WRX_ST_VP) != 0) {
                        VLAN_INPUT_TAG(ifp, m,
                            le16toh(vlantag),
@@ -4041,6 +4059,7 @@
        case WM_T_82572:
        case WM_T_82575:        /* XXX need special handing for jumbo frames */
        case WM_T_I350:
+       case WM_T_I354:
        case WM_T_80003:
                sc->sc_pba = PBA_32K;
                break;
@@ -4099,7 +4118,7 @@
 
        /* Set the completion timeout for interface */
        if ((sc->sc_type == WM_T_82575) || (sc->sc_type == WM_T_82576)
-           || (sc->sc_type == WM_T_I350))
+           || (sc->sc_type == WM_T_I350) || (sc->sc_type == WM_T_I354))
                wm_set_pcie_completion_timeout(sc);
 
        /* Clear interrupt */
@@ -4107,8 +4126,9 @@
 
        /* Stop the transmit and receive processes. */
        CSR_WRITE(sc, WMREG_RCTL, 0);
+       sc->sc_rctl &= ~RCTL_EN;
        CSR_WRITE(sc, WMREG_TCTL, TCTL_PSP);
-       sc->sc_rctl &= ~RCTL_EN;
+       CSR_WRITE_FLUSH(sc);
 
        /* XXX set_tbi_sbp_82543() */
 
@@ -4133,6 +4153,7 @@
        if ((sc->sc_type == WM_T_82541) || (sc->sc_type == WM_T_82547)) {
                CSR_WRITE(sc, WMREG_CTRL,
                    CSR_READ(sc, WMREG_CTRL) | CTRL_PHY_RESET);
+               CSR_WRITE_FLUSH(sc);
                delay(5000);
        }
 
@@ -4193,6 +4214,7 @@
                }
                wm_get_swfwhw_semaphore(sc);
                CSR_WRITE(sc, WMREG_CTRL, reg);
+               /* Don't insert a completion barrier when reset */
                delay(20*1000);
                wm_put_swfwhw_semaphore(sc);
                break;
@@ -4212,6 +4234,7 @@
        case WM_T_82580ER:
        case WM_T_82583:
        case WM_T_I350:
+       case WM_T_I354:
        case WM_T_I210:
        case WM_T_I211:
        default:
@@ -4242,6 +4265,7 @@
                delay(10);
                reg = CSR_READ(sc, WMREG_CTRL_EXT) | CTRL_EXT_EE_RST;
                CSR_WRITE(sc, WMREG_CTRL_EXT, reg);
+               CSR_WRITE_FLUSH(sc);
                delay(2000);
                break;
        case WM_T_82540:
@@ -4268,6 +4292,7 @@
                        delay(10);
                        reg = CSR_READ(sc, WMREG_CTRL_EXT) | CTRL_EXT_EE_RST;
                        CSR_WRITE(sc, WMREG_CTRL_EXT, reg);
+                       CSR_WRITE_FLUSH(sc);
                }
                /* check EECD_EE_AUTORD */
                wm_get_auto_rd_done(sc);
@@ -4284,6 +4309,7 @@
        case WM_T_82580:
        case WM_T_82580ER:
        case WM_T_I350:
+       case WM_T_I354:
        case WM_T_I210:
        case WM_T_I211:
        case WM_T_80003:
@@ -4310,6 +4336,7 @@
        case WM_T_82580ER:
 #endif
        case WM_T_I350:
+       case WM_T_I354:
        case WM_T_ICH8:
        case WM_T_ICH9:
                if ((CSR_READ(sc, WMREG_EECD) & EECD_EE_PRES) == 0) {
@@ -4319,7 +4346,8 @@
                            || (sc->sc_type == WM_T_82576)
                            || (sc->sc_type == WM_T_82580)
                            || (sc->sc_type == WM_T_82580ER)
-                           || (sc->sc_type == WM_T_I350))
+                           || (sc->sc_type == WM_T_I350)
+                           || (sc->sc_type == WM_T_I354))
                                wm_reset_init_script_82575(sc);
                }
                break;
@@ -4328,7 +4356,7 @@
        }
 
        if ((sc->sc_type == WM_T_82580) || (sc->sc_type == WM_T_82580ER)
-           || (sc->sc_type == WM_T_I350)) {
+           || (sc->sc_type == WM_T_I350) || (sc->sc_type == WM_T_I354)) {
                /* clear global device reset status bit */
                CSR_WRITE(sc, WMREG_STATUS, STATUS_DEV_RST_SET);
        }
@@ -4564,7 +4592,7 @@
         * Clear out the VLAN table -- we don't use it (yet).
         */
        CSR_WRITE(sc, WMREG_VET, 0);
-       if (sc->sc_type == WM_T_I350)
+       if ((sc->sc_type == WM_T_I350) || (sc->sc_type == WM_T_I354))
                trynum = 10; /* Due to hw errata */
        else
                trynum = 1;
@@ -4763,7 +4791,8 @@
         * The I350 has a bug where it always strips the CRC whether



Home | Main Index | Thread Index | Old Index