diff options
Diffstat (limited to 'drivers/net/r8169.c')
-rw-r--r-- | drivers/net/r8169.c | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index c821da21d8eb..2b4e975770f3 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -81,6 +81,10 @@ static const int multicast_filter_limit = 32; | |||
81 | #define RTL8169_TX_TIMEOUT (6*HZ) | 81 | #define RTL8169_TX_TIMEOUT (6*HZ) |
82 | #define RTL8169_PHY_TIMEOUT (10*HZ) | 82 | #define RTL8169_PHY_TIMEOUT (10*HZ) |
83 | 83 | ||
84 | #define RTL_EEPROM_SIG cpu_to_le32(0x8129) | ||
85 | #define RTL_EEPROM_SIG_MASK cpu_to_le32(0xffff) | ||
86 | #define RTL_EEPROM_SIG_ADDR 0x0000 | ||
87 | |||
84 | /* write/read MMIO register */ | 88 | /* write/read MMIO register */ |
85 | #define RTL_W8(reg, val8) writeb ((val8), ioaddr + (reg)) | 89 | #define RTL_W8(reg, val8) writeb ((val8), ioaddr + (reg)) |
86 | #define RTL_W16(reg, val16) writew ((val16), ioaddr + (reg)) | 90 | #define RTL_W16(reg, val16) writew ((val16), ioaddr + (reg)) |
@@ -1944,14 +1948,15 @@ static void rtl_init_mac_address(struct rtl8169_private *tp, | |||
1944 | void __iomem *ioaddr) | 1948 | void __iomem *ioaddr) |
1945 | { | 1949 | { |
1946 | struct pci_dev *pdev = tp->pci_dev; | 1950 | struct pci_dev *pdev = tp->pci_dev; |
1947 | u8 cfg1; | ||
1948 | int vpd_cap; | 1951 | int vpd_cap; |
1952 | __le32 sig; | ||
1949 | u8 mac[8]; | 1953 | u8 mac[8]; |
1950 | DECLARE_MAC_BUF(buf); | 1954 | u8 cfg1; |
1951 | 1955 | ||
1952 | cfg1 = RTL_R8(Config1); | 1956 | cfg1 = RTL_R8(Config1); |
1953 | if (!(cfg1 & VPD)) { | 1957 | if (!(cfg1 & VPD)) { |
1954 | dprintk("VPD access not enabled, enabling\n"); | 1958 | if (netif_msg_probe(tp)) |
1959 | dev_info(&pdev->dev, "VPD access disabled, enabling\n"); | ||
1955 | RTL_W8(Cfg9346, Cfg9346_Unlock); | 1960 | RTL_W8(Cfg9346, Cfg9346_Unlock); |
1956 | RTL_W8(Config1, cfg1 | VPD); | 1961 | RTL_W8(Config1, cfg1 | VPD); |
1957 | RTL_W8(Cfg9346, Cfg9346_Lock); | 1962 | RTL_W8(Cfg9346, Cfg9346_Lock); |
@@ -1961,7 +1966,16 @@ static void rtl_init_mac_address(struct rtl8169_private *tp, | |||
1961 | if (!vpd_cap) | 1966 | if (!vpd_cap) |
1962 | return; | 1967 | return; |
1963 | 1968 | ||
1964 | /* MAC address is stored in EEPROM at offset 0x0e | 1969 | if (rtl_eeprom_read(pdev, vpd_cap, RTL_EEPROM_SIG_ADDR, &sig) < 0) |
1970 | return; | ||
1971 | |||
1972 | if ((sig & RTL_EEPROM_SIG_MASK) != RTL_EEPROM_SIG) { | ||
1973 | dev_info(&pdev->dev, "Missing EEPROM signature: %08x\n", sig); | ||
1974 | return; | ||
1975 | } | ||
1976 | |||
1977 | /* | ||
1978 | * MAC address is stored in EEPROM at offset 0x0e | ||
1965 | * Realtek says: "The VPD address does not have to be a DWORD-aligned | 1979 | * Realtek says: "The VPD address does not have to be a DWORD-aligned |
1966 | * address as defined in the PCI 2.2 Specifications, but the VPD data | 1980 | * address as defined in the PCI 2.2 Specifications, but the VPD data |
1967 | * is always consecutive 4-byte data starting from the VPD address | 1981 | * is always consecutive 4-byte data starting from the VPD address |
@@ -1969,14 +1983,22 @@ static void rtl_init_mac_address(struct rtl8169_private *tp, | |||
1969 | */ | 1983 | */ |
1970 | if (rtl_eeprom_read(pdev, vpd_cap, 0x000e, (__le32*)&mac[0]) < 0 || | 1984 | if (rtl_eeprom_read(pdev, vpd_cap, 0x000e, (__le32*)&mac[0]) < 0 || |
1971 | rtl_eeprom_read(pdev, vpd_cap, 0x0012, (__le32*)&mac[4]) < 0) { | 1985 | rtl_eeprom_read(pdev, vpd_cap, 0x0012, (__le32*)&mac[4]) < 0) { |
1972 | dprintk("Reading MAC address from EEPROM failed\n"); | 1986 | if (netif_msg_probe(tp)) { |
1987 | dev_warn(&pdev->dev, | ||
1988 | "reading MAC address from EEPROM failed\n"); | ||
1989 | } | ||
1973 | return; | 1990 | return; |
1974 | } | 1991 | } |
1975 | 1992 | ||
1976 | dprintk("MAC address found in EEPROM: %s\n", print_mac(buf, mac)); | 1993 | if (netif_msg_probe(tp)) { |
1994 | DECLARE_MAC_BUF(buf); | ||
1995 | |||
1996 | dev_info(&pdev->dev, "MAC address found in EEPROM: %s\n", | ||
1997 | print_mac(buf, mac)); | ||
1998 | } | ||
1977 | 1999 | ||
1978 | /* Write MAC address */ | 2000 | if (is_valid_ether_addr(mac)) |
1979 | rtl_rar_set(tp, mac); | 2001 | rtl_rar_set(tp, mac); |
1980 | } | 2002 | } |
1981 | 2003 | ||
1982 | static int __devinit | 2004 | static int __devinit |