diff options
Diffstat (limited to 'drivers/net/r8169.c')
-rw-r--r-- | drivers/net/r8169.c | 45 |
1 files changed, 6 insertions, 39 deletions
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index f1c75751cab7..27f90b2139c0 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -214,6 +214,7 @@ static struct pci_device_id rtl8169_pci_tbl[] = { | |||
214 | { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8168), 0, 0, RTL_CFG_2 }, | 214 | { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8168), 0, 0, RTL_CFG_2 }, |
215 | { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8169), 0, 0, RTL_CFG_0 }, | 215 | { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8169), 0, 0, RTL_CFG_0 }, |
216 | { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4300), 0, 0, RTL_CFG_0 }, | 216 | { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4300), 0, 0, RTL_CFG_0 }, |
217 | { PCI_DEVICE(0x1259, 0xc107), 0, 0, RTL_CFG_0 }, | ||
217 | { PCI_DEVICE(0x16ec, 0x0116), 0, 0, RTL_CFG_0 }, | 218 | { PCI_DEVICE(0x16ec, 0x0116), 0, 0, RTL_CFG_0 }, |
218 | { PCI_VENDOR_ID_LINKSYS, 0x1032, | 219 | { PCI_VENDOR_ID_LINKSYS, 0x1032, |
219 | PCI_ANY_ID, 0x0024, 0, 0, RTL_CFG_0 }, | 220 | PCI_ANY_ID, 0x0024, 0, 0, RTL_CFG_0 }, |
@@ -1396,41 +1397,6 @@ static void rtl8169_netpoll(struct net_device *dev) | |||
1396 | } | 1397 | } |
1397 | #endif | 1398 | #endif |
1398 | 1399 | ||
1399 | static void __rtl8169_set_mac_addr(struct net_device *dev, void __iomem *ioaddr) | ||
1400 | { | ||
1401 | unsigned int i, j; | ||
1402 | |||
1403 | RTL_W8(Cfg9346, Cfg9346_Unlock); | ||
1404 | for (i = 0; i < 2; i++) { | ||
1405 | __le32 l = 0; | ||
1406 | |||
1407 | for (j = 0; j < 4; j++) { | ||
1408 | l <<= 8; | ||
1409 | l |= dev->dev_addr[4*i + j]; | ||
1410 | } | ||
1411 | RTL_W32(MAC0 + 4*i, cpu_to_be32(l)); | ||
1412 | } | ||
1413 | RTL_W8(Cfg9346, Cfg9346_Lock); | ||
1414 | } | ||
1415 | |||
1416 | static int rtl8169_set_mac_addr(struct net_device *dev, void *p) | ||
1417 | { | ||
1418 | struct rtl8169_private *tp = netdev_priv(dev); | ||
1419 | struct sockaddr *addr = p; | ||
1420 | |||
1421 | if (!is_valid_ether_addr(addr->sa_data)) | ||
1422 | return -EINVAL; | ||
1423 | |||
1424 | memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); | ||
1425 | |||
1426 | if (netif_running(dev)) { | ||
1427 | spin_lock_irq(&tp->lock); | ||
1428 | __rtl8169_set_mac_addr(dev, tp->mmio_addr); | ||
1429 | spin_unlock_irq(&tp->lock); | ||
1430 | } | ||
1431 | return 0; | ||
1432 | } | ||
1433 | |||
1434 | static void rtl8169_release_board(struct pci_dev *pdev, struct net_device *dev, | 1400 | static void rtl8169_release_board(struct pci_dev *pdev, struct net_device *dev, |
1435 | void __iomem *ioaddr) | 1401 | void __iomem *ioaddr) |
1436 | { | 1402 | { |
@@ -1680,7 +1646,6 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1680 | dev->stop = rtl8169_close; | 1646 | dev->stop = rtl8169_close; |
1681 | dev->tx_timeout = rtl8169_tx_timeout; | 1647 | dev->tx_timeout = rtl8169_tx_timeout; |
1682 | dev->set_multicast_list = rtl8169_set_rx_mode; | 1648 | dev->set_multicast_list = rtl8169_set_rx_mode; |
1683 | dev->set_mac_address = rtl8169_set_mac_addr; | ||
1684 | dev->watchdog_timeo = RTL8169_TX_TIMEOUT; | 1649 | dev->watchdog_timeo = RTL8169_TX_TIMEOUT; |
1685 | dev->irq = pdev->irq; | 1650 | dev->irq = pdev->irq; |
1686 | dev->base_addr = (unsigned long) ioaddr; | 1651 | dev->base_addr = (unsigned long) ioaddr; |
@@ -1928,8 +1893,6 @@ rtl8169_hw_start(struct net_device *dev) | |||
1928 | /* Enable all known interrupts by setting the interrupt mask. */ | 1893 | /* Enable all known interrupts by setting the interrupt mask. */ |
1929 | RTL_W16(IntrMask, rtl8169_intr_mask); | 1894 | RTL_W16(IntrMask, rtl8169_intr_mask); |
1930 | 1895 | ||
1931 | __rtl8169_set_mac_addr(dev, ioaddr); | ||
1932 | |||
1933 | netif_start_queue(dev); | 1896 | netif_start_queue(dev); |
1934 | } | 1897 | } |
1935 | 1898 | ||
@@ -2700,6 +2663,7 @@ static void rtl8169_down(struct net_device *dev) | |||
2700 | struct rtl8169_private *tp = netdev_priv(dev); | 2663 | struct rtl8169_private *tp = netdev_priv(dev); |
2701 | void __iomem *ioaddr = tp->mmio_addr; | 2664 | void __iomem *ioaddr = tp->mmio_addr; |
2702 | unsigned int poll_locked = 0; | 2665 | unsigned int poll_locked = 0; |
2666 | unsigned int intrmask; | ||
2703 | 2667 | ||
2704 | rtl8169_delete_timer(dev); | 2668 | rtl8169_delete_timer(dev); |
2705 | 2669 | ||
@@ -2738,8 +2702,11 @@ core_down: | |||
2738 | * 2) dev->change_mtu | 2702 | * 2) dev->change_mtu |
2739 | * -> rtl8169_poll can not be issued again and re-enable the | 2703 | * -> rtl8169_poll can not be issued again and re-enable the |
2740 | * interruptions. Let's simply issue the IRQ down sequence again. | 2704 | * interruptions. Let's simply issue the IRQ down sequence again. |
2705 | * | ||
2706 | * No loop if hotpluged or major error (0xffff). | ||
2741 | */ | 2707 | */ |
2742 | if (RTL_R16(IntrMask)) | 2708 | intrmask = RTL_R16(IntrMask); |
2709 | if (intrmask && (intrmask != 0xffff)) | ||
2743 | goto core_down; | 2710 | goto core_down; |
2744 | 2711 | ||
2745 | rtl8169_tx_clear(tp); | 2712 | rtl8169_tx_clear(tp); |