Commit afbac516 authored by Jeff Garzik's avatar Jeff Garzik

[netdrvr e100] Bug fix: enable/disable WOL based on EEPROM settings

Contributed by Scott Feldman @ Intel
parent dfaa4f3e
...@@ -494,8 +494,7 @@ e100_config_long_rx(struct e100_private *bdp, unsigned char enable) ...@@ -494,8 +494,7 @@ e100_config_long_rx(struct e100_private *bdp, unsigned char enable)
* e100_config_wol * e100_config_wol
* @bdp: atapter's private data struct * @bdp: atapter's private data struct
* *
* This sets configuration options for Wake On LAN functionality (WOL) in the * This sets configuration options for PHY and Magic Packet WoL
* config record. WOL options are retrieved from wolinfo_wolopts in @bdp
*/ */
void void
e100_config_wol(struct e100_private *bdp) e100_config_wol(struct e100_private *bdp)
...@@ -504,14 +503,21 @@ e100_config_wol(struct e100_private *bdp) ...@@ -504,14 +503,21 @@ e100_config_wol(struct e100_private *bdp)
if (bdp->wolopts & WAKE_PHY) { if (bdp->wolopts & WAKE_PHY) {
bdp->config[9] |= CB_LINK_STATUS_WOL; bdp->config[9] |= CB_LINK_STATUS_WOL;
E100_CONFIG(bdp, 9); }
else {
/* Disable PHY WoL */
bdp->config[9] &= ~CB_LINK_STATUS_WOL;
} }
if (!(bdp->wolopts & WAKE_MAGIC)) { if (bdp->wolopts & WAKE_MAGIC) {
bdp->config[19] &= ~CB_DISABLE_MAGPAK_WAKE;
}
else {
/* Disable Magic Packet WoL */
bdp->config[19] |= CB_DISABLE_MAGPAK_WAKE; bdp->config[19] |= CB_DISABLE_MAGPAK_WAKE;
E100_CONFIG(bdp, 19);
} }
E100_CONFIG(bdp, 19);
spin_unlock_bh(&(bdp->config_lock)); spin_unlock_bh(&(bdp->config_lock));
} }
......
...@@ -673,12 +673,17 @@ e100_found1(struct pci_dev *pcid, const struct pci_device_id *ent) ...@@ -673,12 +673,17 @@ e100_found1(struct pci_dev *pcid, const struct pci_device_id *ent)
bdp->device->name); bdp->device->name);
} }
/* Disabling all WOLs as initialization */ bdp->wolsupported = 0;
bdp->wolsupported = bdp->wolopts = 0; bdp->wolopts = 0;
if (bdp->rev_id >= D101A4_REV_ID) {
bdp->wolsupported = WAKE_PHY | WAKE_MAGIC; /* Check if WoL is enabled on EEPROM */
if (e100_eeprom_read(bdp, EEPROM_ID_WORD) & BIT_5) {
if (bdp->rev_id >= D101A4_REV_ID)
bdp->wolsupported = WAKE_PHY | WAKE_MAGIC;
if (bdp->rev_id >= D101MA_REV_ID) if (bdp->rev_id >= D101MA_REV_ID)
bdp->wolsupported |= WAKE_UCAST | WAKE_ARP; bdp->wolsupported |= WAKE_UCAST | WAKE_ARP;
/* Magic Packet WoL is enabled on device by default */
/* if EEPROM WoL bit is TRUE */
bdp->wolopts = WAKE_MAGIC; bdp->wolopts = WAKE_MAGIC;
} }
...@@ -4089,9 +4094,11 @@ e100_suspend(struct pci_dev *pcid, u32 state) ...@@ -4089,9 +4094,11 @@ e100_suspend(struct pci_dev *pcid, u32 state)
e100_isolate_driver(bdp); e100_isolate_driver(bdp);
pci_save_state(pcid, bdp->pci_state); pci_save_state(pcid, bdp->pci_state);
/* Enable or disable WoL */
e100_do_wol(pcid, bdp);
/* If wol is enabled */ /* If wol is enabled */
if (bdp->wolopts) { if (bdp->wolopts) {
e100_do_wol(pcid, bdp);
pci_enable_wake(pcid, 3, 1); /* Enable PME for power state D3 */ pci_enable_wake(pcid, 3, 1); /* Enable PME for power state D3 */
pci_set_power_state(pcid, 3); /* Set power state to D3. */ pci_set_power_state(pcid, 3); /* Set power state to D3. */
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment