Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 117819
b: refs/heads/master
c: e383d56
h: refs/heads/master
i:
  117817: 0e3912b
  117815: 0d6fec9
v: v3
  • Loading branch information
Francois Romieu authored and Linus Torvalds committed Oct 26, 2008
1 parent 23f0500 commit 9cfe047
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 89 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: 1137fb670465b6b5d15b9db7d01707a5833ee3ae
refs/heads/master: e383d56487062275e9971094f2efcca34227ee60
88 changes: 0 additions & 88 deletions trunk/drivers/net/r8169.c
Original file line number Diff line number Diff line change
Expand Up @@ -1915,92 +1915,6 @@ static void rtl_disable_msi(struct pci_dev *pdev, struct rtl8169_private *tp)
}
}

static int rtl_eeprom_read(struct pci_dev *pdev, int cap, int addr, __le32 *val)
{
int ret, count = 100;
u16 status = 0;
u32 value;

ret = pci_write_config_word(pdev, cap + PCI_VPD_ADDR, addr);
if (ret < 0)
return ret;

do {
udelay(10);
ret = pci_read_config_word(pdev, cap + PCI_VPD_ADDR, &status);
if (ret < 0)
return ret;
} while (!(status & PCI_VPD_ADDR_F) && --count);

if (!(status & PCI_VPD_ADDR_F))
return -ETIMEDOUT;

ret = pci_read_config_dword(pdev, cap + PCI_VPD_DATA, &value);
if (ret < 0)
return ret;

*val = cpu_to_le32(value);

return 0;
}

static void rtl_init_mac_address(struct rtl8169_private *tp,
void __iomem *ioaddr)
{
struct pci_dev *pdev = tp->pci_dev;
int vpd_cap;
__le32 sig;
u8 mac[8];
u8 cfg1;

cfg1 = RTL_R8(Config1);
if (!(cfg1 & VPD)) {
if (netif_msg_probe(tp))
dev_info(&pdev->dev, "VPD access disabled, enabling\n");
RTL_W8(Cfg9346, Cfg9346_Unlock);
RTL_W8(Config1, cfg1 | VPD);
RTL_W8(Cfg9346, Cfg9346_Lock);
}

vpd_cap = pci_find_capability(pdev, PCI_CAP_ID_VPD);
if (!vpd_cap)
return;

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
* specified."
*/
if (rtl_eeprom_read(pdev, vpd_cap, 0x000e, (__le32*)&mac[0]) < 0 ||
rtl_eeprom_read(pdev, vpd_cap, 0x0012, (__le32*)&mac[4]) < 0) {
if (netif_msg_probe(tp)) {
dev_warn(&pdev->dev,
"reading MAC address from EEPROM failed\n");
}
return;
}

if (netif_msg_probe(tp)) {
DECLARE_MAC_BUF(buf);

dev_info(&pdev->dev, "MAC address found in EEPROM: %s\n",
print_mac(buf, mac));
}

if (is_valid_ether_addr(mac))
rtl_rar_set(tp, mac);
}

static int __devinit
rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
{
Expand Down Expand Up @@ -2178,8 +2092,6 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)

tp->mmio_addr = ioaddr;

rtl_init_mac_address(tp, ioaddr);

/* Get MAC address */
for (i = 0; i < MAC_ADDR_LEN; i++)
dev->dev_addr[i] = RTL_R8(MAC0 + i);
Expand Down

0 comments on commit 9cfe047

Please sign in to comment.