Module Name:    src
Committed By:   msaitoh
Date:           Fri Jul 25 18:28:03 UTC 2014

Modified Files:
        src/sys/dev/pci: if_wm.c if_wmreg.h

Log Message:
- Call wm_set_pcie_completion_timeout() on I350, I354, I210 and I211, too.
  Same as FreeBSD and OpenBSD.
- Drop PHPM_GO_LINK_D bit in WMREG_PHPM on some chips. From FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.281 -r1.282 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.58 -r1.59 src/sys/dev/pci/if_wmreg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.281 src/sys/dev/pci/if_wm.c:1.282
--- src/sys/dev/pci/if_wm.c:1.281	Wed Jul 23 10:48:16 2014
+++ src/sys/dev/pci/if_wm.c	Fri Jul 25 18:28:03 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.281 2014/07/23 10:48:16 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.282 2014/07/25 18:28:03 msaitoh 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.281 2014/07/23 10:48:16 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.282 2014/07/25 18:28:03 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -3188,7 +3188,9 @@ wm_reset(struct wm_softc *sc)
 
 	/* 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_I354))
+	    || (sc->sc_type == WM_T_82580) || (sc->sc_type == WM_T_82580ER)
+	    || (sc->sc_type == WM_T_I350) || (sc->sc_type == WM_T_I354)
+	    || (sc->sc_type == WM_T_I210) || (sc->sc_type == WM_T_I211))
 		wm_set_pcie_completion_timeout(sc);
 
 	/* Clear interrupt */
@@ -6058,6 +6060,7 @@ wm_gmii_mediainit(struct wm_softc *sc, p
 {
 	struct ifnet *ifp = &sc->sc_ethercom.ec_if;
 	struct mii_data *mii = &sc->sc_mii;
+	uint32_t reg;
 
 	/* We have MII. */
 	sc->sc_flags |= WM_F_HAS_MII;
@@ -6067,6 +6070,15 @@ wm_gmii_mediainit(struct wm_softc *sc, p
 	else
 		sc->sc_tipg = TIPG_1000T_DFLT;
 
+	/* XXX Not for I354? FreeBSD's e1000_82575.c doesn't include it */
+	if ((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)) {
+		reg = CSR_READ(sc, WMREG_PHPM);
+		reg &= ~PHPM_GO_LINK_D;
+		CSR_WRITE(sc, WMREG_PHPM, reg);
+	}
+
 	/*
 	 * Let the chip set speed/duplex on its own based on
 	 * signals from the PHY.

Index: src/sys/dev/pci/if_wmreg.h
diff -u src/sys/dev/pci/if_wmreg.h:1.58 src/sys/dev/pci/if_wmreg.h:1.59
--- src/sys/dev/pci/if_wmreg.h:1.58	Fri Jul 25 01:05:00 2014
+++ src/sys/dev/pci/if_wmreg.h	Fri Jul 25 18:28:03 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wmreg.h,v 1.58 2014/07/25 01:05:00 msaitoh Exp $	*/
+/*	$NetBSD: if_wmreg.h,v 1.59 2014/07/25 18:28:03 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -625,6 +625,9 @@ struct livengood_tcpip_ctxdesc {
 #define	WM_ICH8_MC_TABSIZE 32
 #define	WM_VLAN_TABSIZE	128
 
+#define	WMREG_PHPM	0x0e14	/* PHY Power Management */
+#define	PHPM_GO_LINK_D		__BIT(5)	/* Go Link Disconnect */
+
 #define WMREG_EEER	0x0e30	/* Energy Efficiency Ethernet "EEE" */
 #define EEER_TX_LPI_EN		0x00010000 /* EEER Tx LPI Enable */
 #define EEER_RX_LPI_EN		0x00020000 /* EEER Rx LPI Enable */

Reply via email to