diff options
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/r8169.c | 88 |
1 files changed, 0 insertions, 88 deletions
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 2b4e975770f3..4b7cb389dc49 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -1915,92 +1915,6 @@ static void rtl_disable_msi(struct pci_dev *pdev, struct rtl8169_private *tp) | |||
1915 | } | 1915 | } |
1916 | } | 1916 | } |
1917 | 1917 | ||
1918 | static int rtl_eeprom_read(struct pci_dev *pdev, int cap, int addr, __le32 *val) | ||
1919 | { | ||
1920 | int ret, count = 100; | ||
1921 | u16 status = 0; | ||
1922 | u32 value; | ||
1923 | |||
1924 | ret = pci_write_config_word(pdev, cap + PCI_VPD_ADDR, addr); | ||
1925 | if (ret < 0) | ||
1926 | return ret; | ||
1927 | |||
1928 | do { | ||
1929 | udelay(10); | ||
1930 | ret = pci_read_config_word(pdev, cap + PCI_VPD_ADDR, &status); | ||
1931 | if (ret < 0) | ||
1932 | return ret; | ||
1933 | } while (!(status & PCI_VPD_ADDR_F) && --count); | ||
1934 | |||
1935 | if (!(status & PCI_VPD_ADDR_F)) | ||
1936 | return -ETIMEDOUT; | ||
1937 | |||
1938 | ret = pci_read_config_dword(pdev, cap + PCI_VPD_DATA, &value); | ||
1939 | if (ret < 0) | ||
1940 | return ret; | ||
1941 | |||
1942 | *val = cpu_to_le32(value); | ||
1943 | |||
1944 | return 0; | ||
1945 | } | ||
1946 | |||
1947 | static void rtl_init_mac_address(struct rtl8169_private *tp, | ||
1948 | void __iomem *ioaddr) | ||
1949 | { | ||
1950 | struct pci_dev *pdev = tp->pci_dev; | ||
1951 | int vpd_cap; | ||
1952 | __le32 sig; | ||
1953 | u8 mac[8]; | ||
1954 | u8 cfg1; | ||
1955 | |||
1956 | cfg1 = RTL_R8(Config1); | ||
1957 | if (!(cfg1 & VPD)) { | ||
1958 | if (netif_msg_probe(tp)) | ||
1959 | dev_info(&pdev->dev, "VPD access disabled, enabling\n"); | ||
1960 | RTL_W8(Cfg9346, Cfg9346_Unlock); | ||
1961 | RTL_W8(Config1, cfg1 | VPD); | ||
1962 | RTL_W8(Cfg9346, Cfg9346_Lock); | ||
1963 | } | ||
1964 | |||
1965 | vpd_cap = pci_find_capability(pdev, PCI_CAP_ID_VPD); | ||
1966 | if (!vpd_cap) | ||
1967 | return; | ||
1968 | |||
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 | ||
1979 | * Realtek says: "The VPD address does not have to be a DWORD-aligned | ||
1980 | * address as defined in the PCI 2.2 Specifications, but the VPD data | ||
1981 | * is always consecutive 4-byte data starting from the VPD address | ||
1982 | * specified." | ||
1983 | */ | ||
1984 | if (rtl_eeprom_read(pdev, vpd_cap, 0x000e, (__le32*)&mac[0]) < 0 || | ||
1985 | rtl_eeprom_read(pdev, vpd_cap, 0x0012, (__le32*)&mac[4]) < 0) { | ||
1986 | if (netif_msg_probe(tp)) { | ||
1987 | dev_warn(&pdev->dev, | ||
1988 | "reading MAC address from EEPROM failed\n"); | ||
1989 | } | ||
1990 | return; | ||
1991 | } | ||
1992 | |||
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 | } | ||
1999 | |||
2000 | if (is_valid_ether_addr(mac)) | ||
2001 | rtl_rar_set(tp, mac); | ||
2002 | } | ||
2003 | |||
2004 | static int __devinit | 1918 | static int __devinit |
2005 | rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | 1919 | rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
2006 | { | 1920 | { |
@@ -2178,8 +2092,6 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2178 | 2092 | ||
2179 | tp->mmio_addr = ioaddr; | 2093 | tp->mmio_addr = ioaddr; |
2180 | 2094 | ||
2181 | rtl_init_mac_address(tp, ioaddr); | ||
2182 | |||
2183 | /* Get MAC address */ | 2095 | /* Get MAC address */ |
2184 | for (i = 0; i < MAC_ADDR_LEN; i++) | 2096 | for (i = 0; i < MAC_ADDR_LEN; i++) |
2185 | dev->dev_addr[i] = RTL_R8(MAC0 + i); | 2097 | dev->dev_addr[i] = RTL_R8(MAC0 + i); |