summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/dev/pci/if_nfe.c23
-rw-r--r--sys/dev/pci/if_nfereg.h7
-rw-r--r--sys/dev/pci/if_nfevar.h3
3 files changed, 26 insertions, 7 deletions
diff --git a/sys/dev/pci/if_nfe.c b/sys/dev/pci/if_nfe.c
index 26f90ad1395..3e0b7dee10c 100644
--- a/sys/dev/pci/if_nfe.c
+++ b/sys/dev/pci/if_nfe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_nfe.c,v 1.73 2007/11/17 15:52:23 jsg Exp $ */
+/* $OpenBSD: if_nfe.c,v 1.74 2007/12/05 08:30:33 jsg Exp $ */
/*-
* Copyright (c) 2006, 2007 Damien Bergamini <damien.bergamini@free.fr>
@@ -217,7 +217,7 @@ nfe_attach(struct device *parent, struct device *self, void *aux)
break;
case PCI_PRODUCT_NVIDIA_MCP51_LAN1:
case PCI_PRODUCT_NVIDIA_MCP51_LAN2:
- sc->sc_flags |= NFE_40BIT_ADDR;
+ sc->sc_flags |= NFE_40BIT_ADDR | NFE_PWR_MGMT;
break;
case PCI_PRODUCT_NVIDIA_MCP61_LAN1:
case PCI_PRODUCT_NVIDIA_MCP61_LAN2:
@@ -231,7 +231,8 @@ nfe_attach(struct device *parent, struct device *self, void *aux)
case PCI_PRODUCT_NVIDIA_MCP73_LAN2:
case PCI_PRODUCT_NVIDIA_MCP73_LAN3:
case PCI_PRODUCT_NVIDIA_MCP73_LAN4:
- sc->sc_flags |= NFE_40BIT_ADDR | NFE_CORRECT_MACADDR;
+ sc->sc_flags |= NFE_40BIT_ADDR | NFE_CORRECT_MACADDR |
+ NFE_PWR_MGMT;
break;
case PCI_PRODUCT_NVIDIA_CK804_LAN1:
case PCI_PRODUCT_NVIDIA_CK804_LAN2:
@@ -243,15 +244,27 @@ nfe_attach(struct device *parent, struct device *self, void *aux)
case PCI_PRODUCT_NVIDIA_MCP65_LAN2:
case PCI_PRODUCT_NVIDIA_MCP65_LAN3:
case PCI_PRODUCT_NVIDIA_MCP65_LAN4:
- sc->sc_flags |= NFE_JUMBO_SUP | NFE_40BIT_ADDR | NFE_CORRECT_MACADDR;
+ sc->sc_flags |= NFE_JUMBO_SUP | NFE_40BIT_ADDR |
+ NFE_CORRECT_MACADDR | NFE_PWR_MGMT;
break;
case PCI_PRODUCT_NVIDIA_MCP55_LAN1:
case PCI_PRODUCT_NVIDIA_MCP55_LAN2:
sc->sc_flags |= NFE_JUMBO_SUP | NFE_40BIT_ADDR | NFE_HW_CSUM |
- NFE_HW_VLAN;
+ NFE_HW_VLAN | NFE_PWR_MGMT;
break;
}
+ if (sc->sc_flags & NFE_PWR_MGMT) {
+ NFE_WRITE(sc, NFE_RXTX_CTL, NFE_RXTX_RESET | NFE_RXTX_BIT2);
+ NFE_WRITE(sc, NFE_MAC_RESET, NFE_MAC_RESET_MAGIC);
+ DELAY(100);
+ NFE_WRITE(sc, NFE_MAC_RESET, 0);
+ DELAY(100);
+ NFE_WRITE(sc, NFE_RXTX_CTL, NFE_RXTX_BIT2);
+ NFE_WRITE(sc, NFE_PWR2_CTL,
+ NFE_READ(sc, NFE_PWR2_CTL) & ~NFE_PWR2_WAKEUP_MASK);
+ }
+
#ifdef notyet
/* enable jumbo frames for adapters that support it */
if (sc->sc_flags & NFE_JUMBO_SUP)
diff --git a/sys/dev/pci/if_nfereg.h b/sys/dev/pci/if_nfereg.h
index c1516ccece2..427fe190ae8 100644
--- a/sys/dev/pci/if_nfereg.h
+++ b/sys/dev/pci/if_nfereg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_nfereg.h,v 1.21 2007/01/08 18:39:27 damien Exp $ */
+/* $OpenBSD: if_nfereg.h,v 1.22 2007/12/05 08:30:33 jsg Exp $ */
/*-
* Copyright (c) 2005 Jonathan Gray <jsg@openbsd.org>
@@ -34,6 +34,7 @@
#define NFE_IRQ_MASK 0x004
#define NFE_SETUP_R6 0x008
#define NFE_IMTIMER 0x00c
+#define NFE_MAC_RESET 0x03c
#define NFE_MISC1 0x080
#define NFE_TX_CTL 0x084
#define NFE_TX_STATUS 0x088
@@ -74,12 +75,15 @@
#define NFE_PWR_CAP 0x268
#define NFE_PWR_STATE 0x26c
#define NFE_VTAG_CTL 0x300
+#define NFE_PWR2_CTL 0x600
#define NFE_PHY_ERROR 0x00001
#define NFE_PHY_WRITE 0x00400
#define NFE_PHY_BUSY 0x08000
#define NFE_PHYADD_SHIFT 5
+#define NFE_MAC_RESET_MAGIC 0x00f3
+
#define NFE_STATUS_MAGIC 0x140000
#define NFE_R1_MAGIC 0x16070f
@@ -125,6 +129,7 @@
#define NFE_PWR_VALID (1 << 8)
#define NFE_PWR_WAKEUP (1 << 15)
+#define NFE_PWR2_WAKEUP_MASK 0x0f11
#define NFE_MEDIA_SET 0x10000
#define NFE_MEDIA_1000T 0x00032
diff --git a/sys/dev/pci/if_nfevar.h b/sys/dev/pci/if_nfevar.h
index d9d6c051f00..7aae8e5099f 100644
--- a/sys/dev/pci/if_nfevar.h
+++ b/sys/dev/pci/if_nfevar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_nfevar.h,v 1.12 2007/09/01 19:19:39 ckuethe Exp $ */
+/* $OpenBSD: if_nfevar.h,v 1.13 2007/12/05 08:30:33 jsg Exp $ */
/*-
* Copyright (c) 2005 Jonathan Gray <jsg@openbsd.org>
@@ -83,6 +83,7 @@ struct nfe_softc {
#define NFE_HW_VLAN 0x08
#define NFE_USE_JUMBO 0x10
#define NFE_CORRECT_MACADDR 0x20
+#define NFE_PWR_MGMT 0x40
uint32_t rxtxctl;
uint8_t mii_phyaddr;