Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 88297
b: refs/heads/master
c: a376e79
h: refs/heads/master
i:
  88295: 490e4ac
v: v3
  • Loading branch information
Ayaz Abdulla authored and Jeff Garzik committed Apr 12, 2008
1 parent b5ce5ee commit 7b341af
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 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: 72cfe92266540d8510946921a599f140a3d4aaa8
refs/heads/master: a376e79c6079c2ba6c5fadb0e85a3bb7e465ad89
26 changes: 24 additions & 2 deletions trunk/drivers/net/forcedeth.c
Original file line number Diff line number Diff line change
Expand Up @@ -5316,15 +5316,30 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i

/* check the workaround bit for correct mac address order */
txreg = readl(base + NvRegTransmitPoll);
if ((txreg & NVREG_TRANSMITPOLL_MAC_ADDR_REV) ||
(id->driver_data & DEV_HAS_CORRECT_MACADDR)) {
if (id->driver_data & DEV_HAS_CORRECT_MACADDR) {
/* mac address is already in correct order */
dev->dev_addr[0] = (np->orig_mac[0] >> 0) & 0xff;
dev->dev_addr[1] = (np->orig_mac[0] >> 8) & 0xff;
dev->dev_addr[2] = (np->orig_mac[0] >> 16) & 0xff;
dev->dev_addr[3] = (np->orig_mac[0] >> 24) & 0xff;
dev->dev_addr[4] = (np->orig_mac[1] >> 0) & 0xff;
dev->dev_addr[5] = (np->orig_mac[1] >> 8) & 0xff;
} else if (txreg & NVREG_TRANSMITPOLL_MAC_ADDR_REV) {
/* mac address is already in correct order */
dev->dev_addr[0] = (np->orig_mac[0] >> 0) & 0xff;
dev->dev_addr[1] = (np->orig_mac[0] >> 8) & 0xff;
dev->dev_addr[2] = (np->orig_mac[0] >> 16) & 0xff;
dev->dev_addr[3] = (np->orig_mac[0] >> 24) & 0xff;
dev->dev_addr[4] = (np->orig_mac[1] >> 0) & 0xff;
dev->dev_addr[5] = (np->orig_mac[1] >> 8) & 0xff;
/*
* Set orig mac address back to the reversed version.
* This flag will be cleared during low power transition.
* Therefore, we should always put back the reversed address.
*/
np->orig_mac[0] = (dev->dev_addr[5] << 0) + (dev->dev_addr[4] << 8) +
(dev->dev_addr[3] << 16) + (dev->dev_addr[2] << 24);
np->orig_mac[1] = (dev->dev_addr[1] << 0) + (dev->dev_addr[0] << 8);
} else {
/* need to reverse mac address to correct order */
dev->dev_addr[0] = (np->orig_mac[1] >> 8) & 0xff;
Expand Down Expand Up @@ -5595,7 +5610,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);
u8 __iomem *base = get_hwbase(dev);
int rc = 0;
u32 txreg;

if (!netif_running(dev))
goto out;
Expand All @@ -5606,6 +5623,11 @@ 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);

rc = nv_open(dev);
out:
return rc;
Expand Down

0 comments on commit 7b341af

Please sign in to comment.