tulip: implement wake-on-lan support

Based on a patch from http://simon.baatz.info/wol-support-for-an983b/

Tested to resume from suspend by magic packet.

Signed-off-by: Steven Walter <stevenrwalter@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Steven Walter
2010-05-31 12:34:43 +00:00
committed by David S. Miller
parent 7a1d7f01b5
commit db6f30078d
2 changed files with 156 additions and 23 deletions

View File

@@ -20,6 +20,7 @@
#include <linux/types.h>
#include <linux/spinlock.h>
#include <linux/netdevice.h>
#include <linux/ethtool.h>
#include <linux/timer.h>
#include <linux/delay.h>
#include <linux/pci.h>
@@ -51,22 +52,23 @@ struct tulip_chip_table {
enum tbl_flag {
HAS_MII = 0x0001,
HAS_MEDIA_TABLE = 0x0002,
CSR12_IN_SROM = 0x0004,
ALWAYS_CHECK_MII = 0x0008,
HAS_ACPI = 0x0010,
MC_HASH_ONLY = 0x0020, /* Hash-only multicast filter. */
HAS_PNICNWAY = 0x0080,
HAS_NWAY = 0x0040, /* Uses internal NWay xcvr. */
HAS_INTR_MITIGATION = 0x0100,
IS_ASIX = 0x0200,
HAS_8023X = 0x0400,
COMET_MAC_ADDR = 0x0800,
HAS_PCI_MWI = 0x1000,
HAS_PHY_IRQ = 0x2000,
HAS_SWAPPED_SEEPROM = 0x4000,
NEEDS_FAKE_MEDIA_TABLE = 0x8000,
HAS_MII = 0x00001,
HAS_MEDIA_TABLE = 0x00002,
CSR12_IN_SROM = 0x00004,
ALWAYS_CHECK_MII = 0x00008,
HAS_ACPI = 0x00010,
MC_HASH_ONLY = 0x00020, /* Hash-only multicast filter. */
HAS_PNICNWAY = 0x00080,
HAS_NWAY = 0x00040, /* Uses internal NWay xcvr. */
HAS_INTR_MITIGATION = 0x00100,
IS_ASIX = 0x00200,
HAS_8023X = 0x00400,
COMET_MAC_ADDR = 0x00800,
HAS_PCI_MWI = 0x01000,
HAS_PHY_IRQ = 0x02000,
HAS_SWAPPED_SEEPROM = 0x04000,
NEEDS_FAKE_MEDIA_TABLE = 0x08000,
COMET_PM = 0x10000,
};
@@ -120,6 +122,11 @@ enum tulip_offsets {
CSR13 = 0x68,
CSR14 = 0x70,
CSR15 = 0x78,
CSR18 = 0x88,
CSR19 = 0x8c,
CSR20 = 0x90,
CSR27 = 0xAC,
CSR28 = 0xB0,
};
/* register offset and bits for CFDD PCI config reg */
@@ -289,6 +296,30 @@ enum t21143_csr6_bits {
csr6_mask_100bt = (csr6_scr | csr6_pcs | csr6_hbd),
};
enum tulip_comet_csr13_bits {
/* The LINKOFFE and LINKONE work in conjunction with LSCE, i.e. they
* determine which link status transition wakes up if LSCE is
* enabled */
comet_csr13_linkoffe = (1 << 17),
comet_csr13_linkone = (1 << 16),
comet_csr13_wfre = (1 << 10),
comet_csr13_mpre = (1 << 9),
comet_csr13_lsce = (1 << 8),
comet_csr13_wfr = (1 << 2),
comet_csr13_mpr = (1 << 1),
comet_csr13_lsc = (1 << 0),
};
enum tulip_comet_csr18_bits {
comet_csr18_pmes_sticky = (1 << 24),
comet_csr18_pm_mode = (1 << 19),
comet_csr18_apm_mode = (1 << 18),
comet_csr18_d3a = (1 << 7)
};
enum tulip_comet_csr20_bits {
comet_csr20_pmes = (1 << 15),
};
/* Keep the ring sizes a power of two for efficiency.
Making the Tx ring too large decreases the effectiveness of channel
@@ -411,6 +442,7 @@ struct tulip_private {
unsigned int csr6; /* Current CSR6 control settings. */
unsigned char eeprom[EEPROM_SIZE]; /* Serial EEPROM contents. */
void (*link_change) (struct net_device * dev, int csr5);
struct ethtool_wolinfo wolinfo; /* WOL settings */
u16 sym_advertise, mii_advertise; /* NWay capabilities advertised. */
u16 lpar; /* 21143 Link partner ability. */
u16 advertising[4];