Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 102672
b: refs/heads/master
c: 1a1ca86
h: refs/heads/master
v: v3
  • Loading branch information
Tobias Diedrich authored and Jeff Garzik committed May 31, 2008
1 parent b7bb690 commit 23fd3a8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f735a2a1a4f2a0f5cd823ce323e82675990469e2
refs/heads/master: 1a1ca86158eee303af5270338695f90bc7ae02b3
21 changes: 15 additions & 6 deletions trunk/drivers/net/forcedeth.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ union ring_type {
#define NV_PCI_REGSZ_VER1 0x270
#define NV_PCI_REGSZ_VER2 0x2d4
#define NV_PCI_REGSZ_VER3 0x604
#define NV_PCI_REGSZ_MAX 0x604

/* various timeout delays: all in usec */
#define NV_TXRX_RESET_DELAY 4
Expand Down Expand Up @@ -784,6 +785,9 @@ struct fe_priv {

/* flow control */
u32 pause_flags;

/* power saved state */
u32 saved_config_space[NV_PCI_REGSZ_MAX/4];
};

/*
Expand Down Expand Up @@ -5785,6 +5789,8 @@ static int nv_suspend(struct pci_dev *pdev, pm_message_t state)
{
struct net_device *dev = pci_get_drvdata(pdev);
struct fe_priv *np = netdev_priv(dev);
u8 __iomem *base = get_hwbase(dev);
int i;

if (!netif_running(dev))
goto out;
Expand All @@ -5794,6 +5800,10 @@ static int nv_suspend(struct pci_dev *pdev, pm_message_t state)
// Gross.
nv_close(dev);

/* save non-pci configuration space */
for (i = 0;i <= np->register_size/sizeof(u32); i++)
np->saved_config_space[i] = readl(base + i*sizeof(u32));

pci_save_state(pdev);
pci_enable_wake(pdev, pci_choose_state(pdev, state), np->wolenabled);
pci_set_power_state(pdev, pci_choose_state(pdev, state));
Expand All @@ -5804,9 +5814,9 @@ static int nv_suspend(struct pci_dev *pdev, pm_message_t state)
static int nv_resume(struct pci_dev *pdev)
{
struct net_device *dev = pci_get_drvdata(pdev);
struct fe_priv *np = netdev_priv(dev);
u8 __iomem *base = get_hwbase(dev);
int rc = 0;
u32 txreg;
int i, rc = 0;

if (!netif_running(dev))
goto out;
Expand All @@ -5817,10 +5827,9 @@ static int nv_resume(struct pci_dev *pdev)
pci_restore_state(pdev);
pci_enable_wake(pdev, PCI_D0, 0);

/* restore mac address reverse flag */
txreg = readl(base + NvRegTransmitPoll);
txreg |= NVREG_TRANSMITPOLL_MAC_ADDR_REV;
writel(txreg, base + NvRegTransmitPoll);
/* restore non-pci configuration space */
for (i = 0;i <= np->register_size/sizeof(u32); i++)
writel(np->saved_config_space[i], base+i*sizeof(u32));

rc = nv_open(dev);
nv_set_multicast(dev);
Expand Down

0 comments on commit 23fd3a8

Please sign in to comment.