Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 117773
b: refs/heads/master
c: e1564ec
h: refs/heads/master
i:
  117771: 2fbc1b0
v: v3
  • Loading branch information
Francois Romieu authored and Jeff Garzik committed Oct 22, 2008
1 parent 8f77471 commit 9c8b5a9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 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: cd926c7330ae76b620853533e68654a1ef0c2347
refs/heads/master: e1564ec938b759268d6e67f24b5d6f429da4a5a9
22 changes: 18 additions & 4 deletions trunk/drivers/net/r8169.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ static const int multicast_filter_limit = 32;
#define RTL8169_TX_TIMEOUT (6*HZ)
#define RTL8169_PHY_TIMEOUT (10*HZ)

#define RTL_EEPROM_SIG cpu_to_le32(0x8129)
#define RTL_EEPROM_SIG_MASK cpu_to_le32(0xffff)
#define RTL_EEPROM_SIG_ADDR 0x0000

/* write/read MMIO register */
#define RTL_W8(reg, val8) writeb ((val8), ioaddr + (reg))
#define RTL_W16(reg, val16) writew ((val16), ioaddr + (reg))
Expand Down Expand Up @@ -1944,9 +1948,10 @@ static void rtl_init_mac_address(struct rtl8169_private *tp,
void __iomem *ioaddr)
{
struct pci_dev *pdev = tp->pci_dev;
u8 cfg1;
int vpd_cap;
__le32 sig;
u8 mac[8];
u8 cfg1;

cfg1 = RTL_R8(Config1);
if (!(cfg1 & VPD)) {
Expand All @@ -1961,7 +1966,16 @@ static void rtl_init_mac_address(struct rtl8169_private *tp,
if (!vpd_cap)
return;

/* MAC address is stored in EEPROM at offset 0x0e
if (rtl_eeprom_read(pdev, vpd_cap, RTL_EEPROM_SIG_ADDR, &sig) < 0)
return;

if ((sig & RTL_EEPROM_SIG_MASK) != RTL_EEPROM_SIG) {
dev_info(&pdev->dev, "Missing EEPROM signature: %08x\n", sig);
return;
}

/*
* MAC address is stored in EEPROM at offset 0x0e
* Realtek says: "The VPD address does not have to be a DWORD-aligned
* address as defined in the PCI 2.2 Specifications, but the VPD data
* is always consecutive 4-byte data starting from the VPD address
Expand All @@ -1983,8 +1997,8 @@ static void rtl_init_mac_address(struct rtl8169_private *tp,
print_mac(buf, mac));
}

/* Write MAC address */
rtl_rar_set(tp, mac);
if (is_valid_ether_addr(mac))
rtl_rar_set(tp, mac);
}

static int __devinit
Expand Down

0 comments on commit 9c8b5a9

Please sign in to comment.