diff options
Diffstat (limited to 'drivers/net/r8169.c')
-rw-r--r-- | drivers/net/r8169.c | 46 |
1 files changed, 18 insertions, 28 deletions
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index e8960f294a6e..3acfeeabdee1 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -171,6 +171,8 @@ static struct pci_device_id rtl8169_pci_tbl[] = { | |||
171 | { PCI_DEVICE(0x16ec, 0x0116), 0, 0, RTL_CFG_0 }, | 171 | { PCI_DEVICE(0x16ec, 0x0116), 0, 0, RTL_CFG_0 }, |
172 | { PCI_VENDOR_ID_LINKSYS, 0x1032, | 172 | { PCI_VENDOR_ID_LINKSYS, 0x1032, |
173 | PCI_ANY_ID, 0x0024, 0, 0, RTL_CFG_0 }, | 173 | PCI_ANY_ID, 0x0024, 0, 0, RTL_CFG_0 }, |
174 | { 0x0001, 0x8168, | ||
175 | PCI_ANY_ID, 0x2410, 0, 0, RTL_CFG_2 }, | ||
174 | {0,}, | 176 | {0,}, |
175 | }; | 177 | }; |
176 | 178 | ||
@@ -392,7 +394,9 @@ struct rtl8169_private { | |||
392 | void __iomem *mmio_addr; /* memory map physical address */ | 394 | void __iomem *mmio_addr; /* memory map physical address */ |
393 | struct pci_dev *pci_dev; /* Index of PCI device */ | 395 | struct pci_dev *pci_dev; /* Index of PCI device */ |
394 | struct net_device *dev; | 396 | struct net_device *dev; |
397 | #ifdef CONFIG_R8169_NAPI | ||
395 | struct napi_struct napi; | 398 | struct napi_struct napi; |
399 | #endif | ||
396 | spinlock_t lock; /* spin lock flag */ | 400 | spinlock_t lock; /* spin lock flag */ |
397 | u32 msg_enable; | 401 | u32 msg_enable; |
398 | int chipset; | 402 | int chipset; |
@@ -466,7 +470,7 @@ static void mdio_write(void __iomem *ioaddr, int reg_addr, int value) | |||
466 | { | 470 | { |
467 | int i; | 471 | int i; |
468 | 472 | ||
469 | RTL_W32(PHYAR, 0x80000000 | (reg_addr & 0xFF) << 16 | value); | 473 | RTL_W32(PHYAR, 0x80000000 | (reg_addr & 0x1f) << 16 | (value & 0xffff)); |
470 | 474 | ||
471 | for (i = 20; i > 0; i--) { | 475 | for (i = 20; i > 0; i--) { |
472 | /* | 476 | /* |
@@ -483,7 +487,7 @@ static int mdio_read(void __iomem *ioaddr, int reg_addr) | |||
483 | { | 487 | { |
484 | int i, value = -1; | 488 | int i, value = -1; |
485 | 489 | ||
486 | RTL_W32(PHYAR, 0x0 | (reg_addr & 0xFF) << 16); | 490 | RTL_W32(PHYAR, 0x0 | (reg_addr & 0x1f) << 16); |
487 | 491 | ||
488 | for (i = 20; i > 0; i--) { | 492 | for (i = 20; i > 0; i--) { |
489 | /* | 493 | /* |
@@ -491,7 +495,7 @@ static int mdio_read(void __iomem *ioaddr, int reg_addr) | |||
491 | * the specified MII register. | 495 | * the specified MII register. |
492 | */ | 496 | */ |
493 | if (RTL_R32(PHYAR) & 0x80000000) { | 497 | if (RTL_R32(PHYAR) & 0x80000000) { |
494 | value = (int) (RTL_R32(PHYAR) & 0xFFFF); | 498 | value = RTL_R32(PHYAR) & 0xffff; |
495 | break; | 499 | break; |
496 | } | 500 | } |
497 | udelay(25); | 501 | udelay(25); |
@@ -1243,16 +1247,6 @@ static void rtl8169sb_hw_phy_config(void __iomem *ioaddr) | |||
1243 | 1247 | ||
1244 | rtl_phy_write(ioaddr, phy_reg_init, ARRAY_SIZE(phy_reg_init)); | 1248 | rtl_phy_write(ioaddr, phy_reg_init, ARRAY_SIZE(phy_reg_init)); |
1245 | } | 1249 | } |
1246 | static void rtl8168b_hw_phy_config(void __iomem *ioaddr) | ||
1247 | { | ||
1248 | struct phy_reg phy_reg_init[] = { | ||
1249 | { 0x1f, 0x0000 }, | ||
1250 | { 0x10, 0xf41b }, | ||
1251 | { 0x1f, 0x0000 } | ||
1252 | }; | ||
1253 | |||
1254 | rtl_phy_write(ioaddr, phy_reg_init, ARRAY_SIZE(phy_reg_init)); | ||
1255 | } | ||
1256 | 1250 | ||
1257 | static void rtl8168cp_hw_phy_config(void __iomem *ioaddr) | 1251 | static void rtl8168cp_hw_phy_config(void __iomem *ioaddr) |
1258 | { | 1252 | { |
@@ -1322,11 +1316,6 @@ static void rtl_hw_phy_config(struct net_device *dev) | |||
1322 | case RTL_GIGA_MAC_VER_04: | 1316 | case RTL_GIGA_MAC_VER_04: |
1323 | rtl8169sb_hw_phy_config(ioaddr); | 1317 | rtl8169sb_hw_phy_config(ioaddr); |
1324 | break; | 1318 | break; |
1325 | case RTL_GIGA_MAC_VER_11: | ||
1326 | case RTL_GIGA_MAC_VER_12: | ||
1327 | case RTL_GIGA_MAC_VER_17: | ||
1328 | rtl8168b_hw_phy_config(ioaddr); | ||
1329 | break; | ||
1330 | case RTL_GIGA_MAC_VER_18: | 1319 | case RTL_GIGA_MAC_VER_18: |
1331 | rtl8168cp_hw_phy_config(ioaddr); | 1320 | rtl8168cp_hw_phy_config(ioaddr); |
1332 | break; | 1321 | break; |
@@ -1737,7 +1726,8 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1737 | tp->features |= rtl_try_msi(pdev, ioaddr, cfg); | 1726 | tp->features |= rtl_try_msi(pdev, ioaddr, cfg); |
1738 | RTL_W8(Cfg9346, Cfg9346_Lock); | 1727 | RTL_W8(Cfg9346, Cfg9346_Lock); |
1739 | 1728 | ||
1740 | if (RTL_R8(PHYstatus) & TBI_Enable) { | 1729 | if ((tp->mac_version <= RTL_GIGA_MAC_VER_06) && |
1730 | (RTL_R8(PHYstatus) & TBI_Enable)) { | ||
1741 | tp->set_speed = rtl8169_set_speed_tbi; | 1731 | tp->set_speed = rtl8169_set_speed_tbi; |
1742 | tp->get_settings = rtl8169_gset_tbi; | 1732 | tp->get_settings = rtl8169_gset_tbi; |
1743 | tp->phy_reset_enable = rtl8169_tbi_reset_enable; | 1733 | tp->phy_reset_enable = rtl8169_tbi_reset_enable; |
@@ -2012,7 +2002,7 @@ static void rtl8169_set_magic_reg(void __iomem *ioaddr, unsigned mac_version) | |||
2012 | u32 clk; | 2002 | u32 clk; |
2013 | 2003 | ||
2014 | clk = RTL_R8(Config2) & PCI_Clock_66MHz; | 2004 | clk = RTL_R8(Config2) & PCI_Clock_66MHz; |
2015 | for (i = 0; i < ARRAY_SIZE(cfg2_info); i++) { | 2005 | for (i = 0; i < ARRAY_SIZE(cfg2_info); i++, p++) { |
2016 | if ((p->mac_version == mac_version) && (p->clk == clk)) { | 2006 | if ((p->mac_version == mac_version) && (p->clk == clk)) { |
2017 | RTL_W32(0x7c, p->val); | 2007 | RTL_W32(0x7c, p->val); |
2018 | break; | 2008 | break; |
@@ -2221,7 +2211,7 @@ out: | |||
2221 | 2211 | ||
2222 | static inline void rtl8169_make_unusable_by_asic(struct RxDesc *desc) | 2212 | static inline void rtl8169_make_unusable_by_asic(struct RxDesc *desc) |
2223 | { | 2213 | { |
2224 | desc->addr = 0x0badbadbadbadbadull; | 2214 | desc->addr = cpu_to_le64(0x0badbadbadbadbadull); |
2225 | desc->opts1 &= ~cpu_to_le32(DescOwn | RsvdMask); | 2215 | desc->opts1 &= ~cpu_to_le32(DescOwn | RsvdMask); |
2226 | } | 2216 | } |
2227 | 2217 | ||
@@ -2408,6 +2398,8 @@ static void rtl8169_wait_for_quiescence(struct net_device *dev) | |||
2408 | rtl8169_irq_mask_and_ack(ioaddr); | 2398 | rtl8169_irq_mask_and_ack(ioaddr); |
2409 | 2399 | ||
2410 | #ifdef CONFIG_R8169_NAPI | 2400 | #ifdef CONFIG_R8169_NAPI |
2401 | tp->intr_mask = 0xffff; | ||
2402 | RTL_W16(IntrMask, tp->intr_event); | ||
2411 | napi_enable(&tp->napi); | 2403 | napi_enable(&tp->napi); |
2412 | #endif | 2404 | #endif |
2413 | } | 2405 | } |
@@ -2845,7 +2837,7 @@ static int rtl8169_rx_interrupt(struct net_device *dev, | |||
2845 | } | 2837 | } |
2846 | 2838 | ||
2847 | /* Work around for AMD plateform. */ | 2839 | /* Work around for AMD plateform. */ |
2848 | if ((desc->opts2 & 0xfffe000) && | 2840 | if ((desc->opts2 & cpu_to_le32(0xfffe000)) && |
2849 | (tp->mac_version == RTL_GIGA_MAC_VER_05)) { | 2841 | (tp->mac_version == RTL_GIGA_MAC_VER_05)) { |
2850 | desc->opts2 = 0; | 2842 | desc->opts2 = 0; |
2851 | cur_rx++; | 2843 | cur_rx++; |
@@ -2989,13 +2981,16 @@ static void rtl8169_down(struct net_device *dev) | |||
2989 | { | 2981 | { |
2990 | struct rtl8169_private *tp = netdev_priv(dev); | 2982 | struct rtl8169_private *tp = netdev_priv(dev); |
2991 | void __iomem *ioaddr = tp->mmio_addr; | 2983 | void __iomem *ioaddr = tp->mmio_addr; |
2992 | unsigned int poll_locked = 0; | ||
2993 | unsigned int intrmask; | 2984 | unsigned int intrmask; |
2994 | 2985 | ||
2995 | rtl8169_delete_timer(dev); | 2986 | rtl8169_delete_timer(dev); |
2996 | 2987 | ||
2997 | netif_stop_queue(dev); | 2988 | netif_stop_queue(dev); |
2998 | 2989 | ||
2990 | #ifdef CONFIG_R8169_NAPI | ||
2991 | napi_disable(&tp->napi); | ||
2992 | #endif | ||
2993 | |||
2999 | core_down: | 2994 | core_down: |
3000 | spin_lock_irq(&tp->lock); | 2995 | spin_lock_irq(&tp->lock); |
3001 | 2996 | ||
@@ -3009,11 +3004,6 @@ core_down: | |||
3009 | 3004 | ||
3010 | synchronize_irq(dev->irq); | 3005 | synchronize_irq(dev->irq); |
3011 | 3006 | ||
3012 | if (!poll_locked) { | ||
3013 | napi_disable(&tp->napi); | ||
3014 | poll_locked++; | ||
3015 | } | ||
3016 | |||
3017 | /* Give a racing hard_start_xmit a few cycles to complete. */ | 3007 | /* Give a racing hard_start_xmit a few cycles to complete. */ |
3018 | synchronize_sched(); /* FIXME: should this be synchronize_irq()? */ | 3008 | synchronize_sched(); /* FIXME: should this be synchronize_irq()? */ |
3019 | 3009 | ||