diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-04 14:47:58 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-04 14:47:58 -0400 |
commit | 6ba74014c1ab0e37af7de6f64b4eccbbae3cb9e7 (patch) | |
tree | 8f3892fc44f1e403675a6d7e88fda5c70e56ee4c /drivers/net/tulip | |
parent | 5abd9ccced7a726c817dd6b5b96bc933859138d1 (diff) | |
parent | 3ff1c25927e3af61c6bf0e4ed959504058ae4565 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1443 commits)
phy/marvell: add 88ec048 support
igb: Program MDICNFG register prior to PHY init
e1000e: correct MAC-PHY interconnect register offset for 82579
hso: Add new product ID
can: Add driver for esd CAN-USB/2 device
l2tp: fix export of header file for userspace
can-raw: Fix skb_orphan_try handling
Revert "net: remove zap_completion_queue"
net: cleanup inclusion
phy/marvell: add 88e1121 interface mode support
u32: negative offset fix
net: Fix a typo from "dev" to "ndev"
igb: Use irq_synchronize per vector when using MSI-X
ixgbevf: fix null pointer dereference due to filter being set for VLAN 0
e1000e: Fix irq_synchronize in MSI-X case
e1000e: register pm_qos request on hardware activation
ip_fragment: fix subtracting PPPOE_SES_HLEN from mtu twice
net: Add getsockopt support for TCP thin-streams
cxgb4: update driver version
cxgb4: add new PCI IDs
...
Manually fix up conflicts in:
- drivers/net/e1000e/netdev.c: due to pm_qos registration
infrastructure changes
- drivers/net/phy/marvell.c: conflict between adding 88ec048 support
and cleaning up the IDs
- drivers/net/wireless/ipw2x00/ipw2100.c: trivial ipw2100_pm_qos_req
conflict (registration change vs marking it static)
Diffstat (limited to 'drivers/net/tulip')
-rw-r--r-- | drivers/net/tulip/de2104x.c | 4 | ||||
-rw-r--r-- | drivers/net/tulip/eeprom.c | 10 | ||||
-rw-r--r-- | drivers/net/tulip/tulip.h | 64 | ||||
-rw-r--r-- | drivers/net/tulip/tulip_core.c | 132 | ||||
-rw-r--r-- | drivers/net/tulip/winbond-840.c | 4 |
5 files changed, 180 insertions, 34 deletions
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c index 06b552fca63d..5efa57757a2c 100644 --- a/drivers/net/tulip/de2104x.c +++ b/drivers/net/tulip/de2104x.c | |||
@@ -262,13 +262,13 @@ struct de_srom_media_block { | |||
262 | u16 csr13; | 262 | u16 csr13; |
263 | u16 csr14; | 263 | u16 csr14; |
264 | u16 csr15; | 264 | u16 csr15; |
265 | } __attribute__((packed)); | 265 | } __packed; |
266 | 266 | ||
267 | struct de_srom_info_leaf { | 267 | struct de_srom_info_leaf { |
268 | u16 default_media; | 268 | u16 default_media; |
269 | u8 n_blocks; | 269 | u8 n_blocks; |
270 | u8 unused; | 270 | u8 unused; |
271 | } __attribute__((packed)); | 271 | } __packed; |
272 | 272 | ||
273 | struct de_desc { | 273 | struct de_desc { |
274 | __le32 opts1; | 274 | __le32 opts1; |
diff --git a/drivers/net/tulip/eeprom.c b/drivers/net/tulip/eeprom.c index 6002e651b9ea..3031ed9c4a1a 100644 --- a/drivers/net/tulip/eeprom.c +++ b/drivers/net/tulip/eeprom.c | |||
@@ -120,8 +120,8 @@ static void __devinit tulip_build_fake_mediatable(struct tulip_private *tp) | |||
120 | 0x00, 0x06 /* ttm bit map */ | 120 | 0x00, 0x06 /* ttm bit map */ |
121 | }; | 121 | }; |
122 | 122 | ||
123 | tp->mtable = (struct mediatable *) | 123 | tp->mtable = kmalloc(sizeof(struct mediatable) + |
124 | kmalloc(sizeof(struct mediatable) + sizeof(struct medialeaf), GFP_KERNEL); | 124 | sizeof(struct medialeaf), GFP_KERNEL); |
125 | 125 | ||
126 | if (tp->mtable == NULL) | 126 | if (tp->mtable == NULL) |
127 | return; /* Horrible, impossible failure. */ | 127 | return; /* Horrible, impossible failure. */ |
@@ -227,9 +227,9 @@ subsequent_board: | |||
227 | return; | 227 | return; |
228 | } | 228 | } |
229 | 229 | ||
230 | mtable = (struct mediatable *) | 230 | mtable = kmalloc(sizeof(struct mediatable) + |
231 | kmalloc(sizeof(struct mediatable) + count*sizeof(struct medialeaf), | 231 | count * sizeof(struct medialeaf), |
232 | GFP_KERNEL); | 232 | GFP_KERNEL); |
233 | if (mtable == NULL) | 233 | if (mtable == NULL) |
234 | return; /* Horrible, impossible failure. */ | 234 | return; /* Horrible, impossible failure. */ |
235 | last_mediatable = tp->mtable = mtable; | 235 | last_mediatable = tp->mtable = mtable; |
diff --git a/drivers/net/tulip/tulip.h b/drivers/net/tulip/tulip.h index 0afa2d4f9472..e525875ed67d 100644 --- a/drivers/net/tulip/tulip.h +++ b/drivers/net/tulip/tulip.h | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/types.h> | 20 | #include <linux/types.h> |
21 | #include <linux/spinlock.h> | 21 | #include <linux/spinlock.h> |
22 | #include <linux/netdevice.h> | 22 | #include <linux/netdevice.h> |
23 | #include <linux/ethtool.h> | ||
23 | #include <linux/timer.h> | 24 | #include <linux/timer.h> |
24 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
25 | #include <linux/pci.h> | 26 | #include <linux/pci.h> |
@@ -51,22 +52,23 @@ struct tulip_chip_table { | |||
51 | 52 | ||
52 | 53 | ||
53 | enum tbl_flag { | 54 | enum tbl_flag { |
54 | HAS_MII = 0x0001, | 55 | HAS_MII = 0x00001, |
55 | HAS_MEDIA_TABLE = 0x0002, | 56 | HAS_MEDIA_TABLE = 0x00002, |
56 | CSR12_IN_SROM = 0x0004, | 57 | CSR12_IN_SROM = 0x00004, |
57 | ALWAYS_CHECK_MII = 0x0008, | 58 | ALWAYS_CHECK_MII = 0x00008, |
58 | HAS_ACPI = 0x0010, | 59 | HAS_ACPI = 0x00010, |
59 | MC_HASH_ONLY = 0x0020, /* Hash-only multicast filter. */ | 60 | MC_HASH_ONLY = 0x00020, /* Hash-only multicast filter. */ |
60 | HAS_PNICNWAY = 0x0080, | 61 | HAS_PNICNWAY = 0x00080, |
61 | HAS_NWAY = 0x0040, /* Uses internal NWay xcvr. */ | 62 | HAS_NWAY = 0x00040, /* Uses internal NWay xcvr. */ |
62 | HAS_INTR_MITIGATION = 0x0100, | 63 | HAS_INTR_MITIGATION = 0x00100, |
63 | IS_ASIX = 0x0200, | 64 | IS_ASIX = 0x00200, |
64 | HAS_8023X = 0x0400, | 65 | HAS_8023X = 0x00400, |
65 | COMET_MAC_ADDR = 0x0800, | 66 | COMET_MAC_ADDR = 0x00800, |
66 | HAS_PCI_MWI = 0x1000, | 67 | HAS_PCI_MWI = 0x01000, |
67 | HAS_PHY_IRQ = 0x2000, | 68 | HAS_PHY_IRQ = 0x02000, |
68 | HAS_SWAPPED_SEEPROM = 0x4000, | 69 | HAS_SWAPPED_SEEPROM = 0x04000, |
69 | NEEDS_FAKE_MEDIA_TABLE = 0x8000, | 70 | NEEDS_FAKE_MEDIA_TABLE = 0x08000, |
71 | COMET_PM = 0x10000, | ||
70 | }; | 72 | }; |
71 | 73 | ||
72 | 74 | ||
@@ -120,6 +122,11 @@ enum tulip_offsets { | |||
120 | CSR13 = 0x68, | 122 | CSR13 = 0x68, |
121 | CSR14 = 0x70, | 123 | CSR14 = 0x70, |
122 | CSR15 = 0x78, | 124 | CSR15 = 0x78, |
125 | CSR18 = 0x88, | ||
126 | CSR19 = 0x8c, | ||
127 | CSR20 = 0x90, | ||
128 | CSR27 = 0xAC, | ||
129 | CSR28 = 0xB0, | ||
123 | }; | 130 | }; |
124 | 131 | ||
125 | /* register offset and bits for CFDD PCI config reg */ | 132 | /* register offset and bits for CFDD PCI config reg */ |
@@ -289,6 +296,30 @@ enum t21143_csr6_bits { | |||
289 | csr6_mask_100bt = (csr6_scr | csr6_pcs | csr6_hbd), | 296 | csr6_mask_100bt = (csr6_scr | csr6_pcs | csr6_hbd), |
290 | }; | 297 | }; |
291 | 298 | ||
299 | enum tulip_comet_csr13_bits { | ||
300 | /* The LINKOFFE and LINKONE work in conjunction with LSCE, i.e. they | ||
301 | * determine which link status transition wakes up if LSCE is | ||
302 | * enabled */ | ||
303 | comet_csr13_linkoffe = (1 << 17), | ||
304 | comet_csr13_linkone = (1 << 16), | ||
305 | comet_csr13_wfre = (1 << 10), | ||
306 | comet_csr13_mpre = (1 << 9), | ||
307 | comet_csr13_lsce = (1 << 8), | ||
308 | comet_csr13_wfr = (1 << 2), | ||
309 | comet_csr13_mpr = (1 << 1), | ||
310 | comet_csr13_lsc = (1 << 0), | ||
311 | }; | ||
312 | |||
313 | enum tulip_comet_csr18_bits { | ||
314 | comet_csr18_pmes_sticky = (1 << 24), | ||
315 | comet_csr18_pm_mode = (1 << 19), | ||
316 | comet_csr18_apm_mode = (1 << 18), | ||
317 | comet_csr18_d3a = (1 << 7) | ||
318 | }; | ||
319 | |||
320 | enum tulip_comet_csr20_bits { | ||
321 | comet_csr20_pmes = (1 << 15), | ||
322 | }; | ||
292 | 323 | ||
293 | /* Keep the ring sizes a power of two for efficiency. | 324 | /* Keep the ring sizes a power of two for efficiency. |
294 | Making the Tx ring too large decreases the effectiveness of channel | 325 | Making the Tx ring too large decreases the effectiveness of channel |
@@ -411,6 +442,7 @@ struct tulip_private { | |||
411 | unsigned int csr6; /* Current CSR6 control settings. */ | 442 | unsigned int csr6; /* Current CSR6 control settings. */ |
412 | unsigned char eeprom[EEPROM_SIZE]; /* Serial EEPROM contents. */ | 443 | unsigned char eeprom[EEPROM_SIZE]; /* Serial EEPROM contents. */ |
413 | void (*link_change) (struct net_device * dev, int csr5); | 444 | void (*link_change) (struct net_device * dev, int csr5); |
445 | struct ethtool_wolinfo wolinfo; /* WOL settings */ | ||
414 | u16 sym_advertise, mii_advertise; /* NWay capabilities advertised. */ | 446 | u16 sym_advertise, mii_advertise; /* NWay capabilities advertised. */ |
415 | u16 lpar; /* 21143 Link partner ability. */ | 447 | u16 lpar; /* 21143 Link partner ability. */ |
416 | u16 advertising[4]; | 448 | u16 advertising[4]; |
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c index 254643ed945e..3a8d7efa2acf 100644 --- a/drivers/net/tulip/tulip_core.c +++ b/drivers/net/tulip/tulip_core.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <linux/etherdevice.h> | 30 | #include <linux/etherdevice.h> |
31 | #include <linux/delay.h> | 31 | #include <linux/delay.h> |
32 | #include <linux/mii.h> | 32 | #include <linux/mii.h> |
33 | #include <linux/ethtool.h> | ||
34 | #include <linux/crc32.h> | 33 | #include <linux/crc32.h> |
35 | #include <asm/unaligned.h> | 34 | #include <asm/unaligned.h> |
36 | #include <asm/uaccess.h> | 35 | #include <asm/uaccess.h> |
@@ -272,6 +271,7 @@ static void tulip_down(struct net_device *dev); | |||
272 | static struct net_device_stats *tulip_get_stats(struct net_device *dev); | 271 | static struct net_device_stats *tulip_get_stats(struct net_device *dev); |
273 | static int private_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); | 272 | static int private_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); |
274 | static void set_rx_mode(struct net_device *dev); | 273 | static void set_rx_mode(struct net_device *dev); |
274 | static void tulip_set_wolopts(struct pci_dev *pdev, u32 wolopts); | ||
275 | #ifdef CONFIG_NET_POLL_CONTROLLER | 275 | #ifdef CONFIG_NET_POLL_CONTROLLER |
276 | static void poll_tulip(struct net_device *dev); | 276 | static void poll_tulip(struct net_device *dev); |
277 | #endif | 277 | #endif |
@@ -309,6 +309,11 @@ static void tulip_up(struct net_device *dev) | |||
309 | /* Wake the chip from sleep/snooze mode. */ | 309 | /* Wake the chip from sleep/snooze mode. */ |
310 | tulip_set_power_state (tp, 0, 0); | 310 | tulip_set_power_state (tp, 0, 0); |
311 | 311 | ||
312 | /* Disable all WOL events */ | ||
313 | pci_enable_wake(tp->pdev, PCI_D3hot, 0); | ||
314 | pci_enable_wake(tp->pdev, PCI_D3cold, 0); | ||
315 | tulip_set_wolopts(tp->pdev, 0); | ||
316 | |||
312 | /* On some chip revs we must set the MII/SYM port before the reset!? */ | 317 | /* On some chip revs we must set the MII/SYM port before the reset!? */ |
313 | if (tp->mii_cnt || (tp->mtable && tp->mtable->has_mii)) | 318 | if (tp->mii_cnt || (tp->mtable && tp->mtable->has_mii)) |
314 | iowrite32(0x00040000, ioaddr + CSR6); | 319 | iowrite32(0x00040000, ioaddr + CSR6); |
@@ -345,8 +350,8 @@ static void tulip_up(struct net_device *dev) | |||
345 | } else if (tp->flags & COMET_MAC_ADDR) { | 350 | } else if (tp->flags & COMET_MAC_ADDR) { |
346 | iowrite32(addr_low, ioaddr + 0xA4); | 351 | iowrite32(addr_low, ioaddr + 0xA4); |
347 | iowrite32(addr_high, ioaddr + 0xA8); | 352 | iowrite32(addr_high, ioaddr + 0xA8); |
348 | iowrite32(0, ioaddr + 0xAC); | 353 | iowrite32(0, ioaddr + CSR27); |
349 | iowrite32(0, ioaddr + 0xB0); | 354 | iowrite32(0, ioaddr + CSR28); |
350 | } | 355 | } |
351 | } else { | 356 | } else { |
352 | /* This is set_rx_mode(), but without starting the transmitter. */ | 357 | /* This is set_rx_mode(), but without starting the transmitter. */ |
@@ -591,10 +596,10 @@ static void tulip_tx_timeout(struct net_device *dev) | |||
591 | pr_cont(" %02x", buf[j]); | 596 | pr_cont(" %02x", buf[j]); |
592 | pr_cont(" j=%d\n", j); | 597 | pr_cont(" j=%d\n", j); |
593 | } | 598 | } |
594 | printk(KERN_DEBUG " Rx ring %08x: ", (int)tp->rx_ring); | 599 | printk(KERN_DEBUG " Rx ring %p: ", tp->rx_ring); |
595 | for (i = 0; i < RX_RING_SIZE; i++) | 600 | for (i = 0; i < RX_RING_SIZE; i++) |
596 | pr_cont(" %08x", (unsigned int)tp->rx_ring[i].status); | 601 | pr_cont(" %08x", (unsigned int)tp->rx_ring[i].status); |
597 | printk(KERN_DEBUG " Tx ring %08x: ", (int)tp->tx_ring); | 602 | printk(KERN_DEBUG " Tx ring %p: ", tp->tx_ring); |
598 | for (i = 0; i < TX_RING_SIZE; i++) | 603 | for (i = 0; i < TX_RING_SIZE; i++) |
599 | pr_cont(" %08x", (unsigned int)tp->tx_ring[i].status); | 604 | pr_cont(" %08x", (unsigned int)tp->tx_ring[i].status); |
600 | pr_cont("\n"); | 605 | pr_cont("\n"); |
@@ -876,8 +881,35 @@ static void tulip_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *in | |||
876 | strcpy(info->bus_info, pci_name(np->pdev)); | 881 | strcpy(info->bus_info, pci_name(np->pdev)); |
877 | } | 882 | } |
878 | 883 | ||
884 | |||
885 | static int tulip_ethtool_set_wol(struct net_device *dev, | ||
886 | struct ethtool_wolinfo *wolinfo) | ||
887 | { | ||
888 | struct tulip_private *tp = netdev_priv(dev); | ||
889 | |||
890 | if (wolinfo->wolopts & (~tp->wolinfo.supported)) | ||
891 | return -EOPNOTSUPP; | ||
892 | |||
893 | tp->wolinfo.wolopts = wolinfo->wolopts; | ||
894 | device_set_wakeup_enable(&tp->pdev->dev, tp->wolinfo.wolopts); | ||
895 | return 0; | ||
896 | } | ||
897 | |||
898 | static void tulip_ethtool_get_wol(struct net_device *dev, | ||
899 | struct ethtool_wolinfo *wolinfo) | ||
900 | { | ||
901 | struct tulip_private *tp = netdev_priv(dev); | ||
902 | |||
903 | wolinfo->supported = tp->wolinfo.supported; | ||
904 | wolinfo->wolopts = tp->wolinfo.wolopts; | ||
905 | return; | ||
906 | } | ||
907 | |||
908 | |||
879 | static const struct ethtool_ops ops = { | 909 | static const struct ethtool_ops ops = { |
880 | .get_drvinfo = tulip_get_drvinfo | 910 | .get_drvinfo = tulip_get_drvinfo, |
911 | .set_wol = tulip_ethtool_set_wol, | ||
912 | .get_wol = tulip_ethtool_get_wol, | ||
881 | }; | 913 | }; |
882 | 914 | ||
883 | /* Provide ioctl() calls to examine the MII xcvr state. */ | 915 | /* Provide ioctl() calls to examine the MII xcvr state. */ |
@@ -1093,8 +1125,8 @@ static void set_rx_mode(struct net_device *dev) | |||
1093 | iowrite32(3, ioaddr + CSR13); | 1125 | iowrite32(3, ioaddr + CSR13); |
1094 | iowrite32(mc_filter[1], ioaddr + CSR14); | 1126 | iowrite32(mc_filter[1], ioaddr + CSR14); |
1095 | } else if (tp->flags & COMET_MAC_ADDR) { | 1127 | } else if (tp->flags & COMET_MAC_ADDR) { |
1096 | iowrite32(mc_filter[0], ioaddr + 0xAC); | 1128 | iowrite32(mc_filter[0], ioaddr + CSR27); |
1097 | iowrite32(mc_filter[1], ioaddr + 0xB0); | 1129 | iowrite32(mc_filter[1], ioaddr + CSR28); |
1098 | } | 1130 | } |
1099 | tp->mc_filter[0] = mc_filter[0]; | 1131 | tp->mc_filter[0] = mc_filter[0]; |
1100 | tp->mc_filter[1] = mc_filter[1]; | 1132 | tp->mc_filter[1] = mc_filter[1]; |
@@ -1309,6 +1341,12 @@ static int __devinit tulip_init_one (struct pci_dev *pdev, | |||
1309 | if (pdev->subsystem_vendor == PCI_VENDOR_ID_LMC) { | 1341 | if (pdev->subsystem_vendor == PCI_VENDOR_ID_LMC) { |
1310 | pr_err(PFX "skipping LMC card\n"); | 1342 | pr_err(PFX "skipping LMC card\n"); |
1311 | return -ENODEV; | 1343 | return -ENODEV; |
1344 | } else if (pdev->subsystem_vendor == PCI_VENDOR_ID_SBE && | ||
1345 | (pdev->subsystem_device == PCI_SUBDEVICE_ID_SBE_T3E3 || | ||
1346 | pdev->subsystem_device == PCI_SUBDEVICE_ID_SBE_2T3E3_P0 || | ||
1347 | pdev->subsystem_device == PCI_SUBDEVICE_ID_SBE_2T3E3_P1)) { | ||
1348 | pr_err(PFX "skipping SBE T3E3 port\n"); | ||
1349 | return -ENODEV; | ||
1312 | } | 1350 | } |
1313 | 1351 | ||
1314 | /* | 1352 | /* |
@@ -1381,6 +1419,13 @@ static int __devinit tulip_init_one (struct pci_dev *pdev, | |||
1381 | return i; | 1419 | return i; |
1382 | } | 1420 | } |
1383 | 1421 | ||
1422 | /* The chip will fail to enter a low-power state later unless | ||
1423 | * first explicitly commanded into D0 */ | ||
1424 | if (pci_set_power_state(pdev, PCI_D0)) { | ||
1425 | printk (KERN_NOTICE PFX | ||
1426 | "Failed to set power state to D0\n"); | ||
1427 | } | ||
1428 | |||
1384 | irq = pdev->irq; | 1429 | irq = pdev->irq; |
1385 | 1430 | ||
1386 | /* alloc_etherdev ensures aligned and zeroed private structures */ | 1431 | /* alloc_etherdev ensures aligned and zeroed private structures */ |
@@ -1427,6 +1472,19 @@ static int __devinit tulip_init_one (struct pci_dev *pdev, | |||
1427 | 1472 | ||
1428 | tp->chip_id = chip_idx; | 1473 | tp->chip_id = chip_idx; |
1429 | tp->flags = tulip_tbl[chip_idx].flags; | 1474 | tp->flags = tulip_tbl[chip_idx].flags; |
1475 | |||
1476 | tp->wolinfo.supported = 0; | ||
1477 | tp->wolinfo.wolopts = 0; | ||
1478 | /* COMET: Enable power management only for AN983B */ | ||
1479 | if (chip_idx == COMET ) { | ||
1480 | u32 sig; | ||
1481 | pci_read_config_dword (pdev, 0x80, &sig); | ||
1482 | if (sig == 0x09811317) { | ||
1483 | tp->flags |= COMET_PM; | ||
1484 | tp->wolinfo.supported = WAKE_PHY | WAKE_MAGIC; | ||
1485 | printk(KERN_INFO "tulip_init_one: Enabled WOL support for AN983B\n"); | ||
1486 | } | ||
1487 | } | ||
1430 | tp->pdev = pdev; | 1488 | tp->pdev = pdev; |
1431 | tp->base_addr = ioaddr; | 1489 | tp->base_addr = ioaddr; |
1432 | tp->revision = pdev->revision; | 1490 | tp->revision = pdev->revision; |
@@ -1759,11 +1817,43 @@ err_out_free_netdev: | |||
1759 | } | 1817 | } |
1760 | 1818 | ||
1761 | 1819 | ||
1820 | /* set the registers according to the given wolopts */ | ||
1821 | static void tulip_set_wolopts (struct pci_dev *pdev, u32 wolopts) | ||
1822 | { | ||
1823 | struct net_device *dev = pci_get_drvdata(pdev); | ||
1824 | struct tulip_private *tp = netdev_priv(dev); | ||
1825 | void __iomem *ioaddr = tp->base_addr; | ||
1826 | |||
1827 | if (tp->flags & COMET_PM) { | ||
1828 | |||
1829 | unsigned int tmp; | ||
1830 | |||
1831 | tmp = ioread32(ioaddr + CSR18); | ||
1832 | tmp &= ~(comet_csr18_pmes_sticky | comet_csr18_apm_mode | comet_csr18_d3a); | ||
1833 | tmp |= comet_csr18_pm_mode; | ||
1834 | iowrite32(tmp, ioaddr + CSR18); | ||
1835 | |||
1836 | /* Set the Wake-up Control/Status Register to the given WOL options*/ | ||
1837 | tmp = ioread32(ioaddr + CSR13); | ||
1838 | tmp &= ~(comet_csr13_linkoffe | comet_csr13_linkone | comet_csr13_wfre | comet_csr13_lsce | comet_csr13_mpre); | ||
1839 | if (wolopts & WAKE_MAGIC) | ||
1840 | tmp |= comet_csr13_mpre; | ||
1841 | if (wolopts & WAKE_PHY) | ||
1842 | tmp |= comet_csr13_linkoffe | comet_csr13_linkone | comet_csr13_lsce; | ||
1843 | /* Clear the event flags */ | ||
1844 | tmp |= comet_csr13_wfr | comet_csr13_mpr | comet_csr13_lsc; | ||
1845 | iowrite32(tmp, ioaddr + CSR13); | ||
1846 | } | ||
1847 | } | ||
1848 | |||
1762 | #ifdef CONFIG_PM | 1849 | #ifdef CONFIG_PM |
1763 | 1850 | ||
1851 | |||
1764 | static int tulip_suspend (struct pci_dev *pdev, pm_message_t state) | 1852 | static int tulip_suspend (struct pci_dev *pdev, pm_message_t state) |
1765 | { | 1853 | { |
1854 | pci_power_t pstate; | ||
1766 | struct net_device *dev = pci_get_drvdata(pdev); | 1855 | struct net_device *dev = pci_get_drvdata(pdev); |
1856 | struct tulip_private *tp = netdev_priv(dev); | ||
1767 | 1857 | ||
1768 | if (!dev) | 1858 | if (!dev) |
1769 | return -EINVAL; | 1859 | return -EINVAL; |
@@ -1779,7 +1869,16 @@ static int tulip_suspend (struct pci_dev *pdev, pm_message_t state) | |||
1779 | save_state: | 1869 | save_state: |
1780 | pci_save_state(pdev); | 1870 | pci_save_state(pdev); |
1781 | pci_disable_device(pdev); | 1871 | pci_disable_device(pdev); |
1782 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); | 1872 | pstate = pci_choose_state(pdev, state); |
1873 | if (state.event == PM_EVENT_SUSPEND && pstate != PCI_D0) { | ||
1874 | int rc; | ||
1875 | |||
1876 | tulip_set_wolopts(pdev, tp->wolinfo.wolopts); | ||
1877 | rc = pci_enable_wake(pdev, pstate, tp->wolinfo.wolopts); | ||
1878 | if (rc) | ||
1879 | printk("tulip: pci_enable_wake failed (%d)\n", rc); | ||
1880 | } | ||
1881 | pci_set_power_state(pdev, pstate); | ||
1783 | 1882 | ||
1784 | return 0; | 1883 | return 0; |
1785 | } | 1884 | } |
@@ -1788,7 +1887,10 @@ save_state: | |||
1788 | static int tulip_resume(struct pci_dev *pdev) | 1887 | static int tulip_resume(struct pci_dev *pdev) |
1789 | { | 1888 | { |
1790 | struct net_device *dev = pci_get_drvdata(pdev); | 1889 | struct net_device *dev = pci_get_drvdata(pdev); |
1890 | struct tulip_private *tp = netdev_priv(dev); | ||
1891 | void __iomem *ioaddr = tp->base_addr; | ||
1791 | int retval; | 1892 | int retval; |
1893 | unsigned int tmp; | ||
1792 | 1894 | ||
1793 | if (!dev) | 1895 | if (!dev) |
1794 | return -EINVAL; | 1896 | return -EINVAL; |
@@ -1809,6 +1911,18 @@ static int tulip_resume(struct pci_dev *pdev) | |||
1809 | return retval; | 1911 | return retval; |
1810 | } | 1912 | } |
1811 | 1913 | ||
1914 | if (tp->flags & COMET_PM) { | ||
1915 | pci_enable_wake(pdev, PCI_D3hot, 0); | ||
1916 | pci_enable_wake(pdev, PCI_D3cold, 0); | ||
1917 | |||
1918 | /* Clear the PMES flag */ | ||
1919 | tmp = ioread32(ioaddr + CSR20); | ||
1920 | tmp |= comet_csr20_pmes; | ||
1921 | iowrite32(tmp, ioaddr + CSR20); | ||
1922 | |||
1923 | /* Disable all wake-up events */ | ||
1924 | tulip_set_wolopts(pdev, 0); | ||
1925 | } | ||
1812 | netif_device_attach(dev); | 1926 | netif_device_attach(dev); |
1813 | 1927 | ||
1814 | if (netif_running(dev)) | 1928 | if (netif_running(dev)) |
diff --git a/drivers/net/tulip/winbond-840.c b/drivers/net/tulip/winbond-840.c index 608b279b921b..66d41cf8da29 100644 --- a/drivers/net/tulip/winbond-840.c +++ b/drivers/net/tulip/winbond-840.c | |||
@@ -1514,12 +1514,12 @@ static int netdev_close(struct net_device *dev) | |||
1514 | if (debug > 2) { | 1514 | if (debug > 2) { |
1515 | int i; | 1515 | int i; |
1516 | 1516 | ||
1517 | printk(KERN_DEBUG" Tx ring at %08x:\n", (int)np->tx_ring); | 1517 | printk(KERN_DEBUG" Tx ring at %p:\n", np->tx_ring); |
1518 | for (i = 0; i < TX_RING_SIZE; i++) | 1518 | for (i = 0; i < TX_RING_SIZE; i++) |
1519 | printk(KERN_DEBUG " #%d desc. %04x %04x %08x\n", | 1519 | printk(KERN_DEBUG " #%d desc. %04x %04x %08x\n", |
1520 | i, np->tx_ring[i].length, | 1520 | i, np->tx_ring[i].length, |
1521 | np->tx_ring[i].status, np->tx_ring[i].buffer1); | 1521 | np->tx_ring[i].status, np->tx_ring[i].buffer1); |
1522 | printk(KERN_DEBUG " Rx ring %08x:\n", (int)np->rx_ring); | 1522 | printk(KERN_DEBUG " Rx ring %p:\n", np->rx_ring); |
1523 | for (i = 0; i < RX_RING_SIZE; i++) { | 1523 | for (i = 0; i < RX_RING_SIZE; i++) { |
1524 | printk(KERN_DEBUG " #%d desc. %04x %04x %08x\n", | 1524 | printk(KERN_DEBUG " #%d desc. %04x %04x %08x\n", |
1525 | i, np->rx_ring[i].length, | 1525 | i, np->rx_ring[i].length, |