aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/r8169.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/r8169.c')
-rw-r--r--drivers/net/r8169.c99
1 files changed, 97 insertions, 2 deletions
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 96b9b0bb4705..02b11a0814dd 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -113,7 +113,8 @@ enum mac_version {
113 RTL_GIGA_MAC_VER_21 = 0x15, // 8168C 113 RTL_GIGA_MAC_VER_21 = 0x15, // 8168C
114 RTL_GIGA_MAC_VER_22 = 0x16, // 8168C 114 RTL_GIGA_MAC_VER_22 = 0x16, // 8168C
115 RTL_GIGA_MAC_VER_23 = 0x17, // 8168CP 115 RTL_GIGA_MAC_VER_23 = 0x17, // 8168CP
116 RTL_GIGA_MAC_VER_24 = 0x18 // 8168CP 116 RTL_GIGA_MAC_VER_24 = 0x18, // 8168CP
117 RTL_GIGA_MAC_VER_25 = 0x19 // 8168D
117}; 118};
118 119
119#define _R(NAME,MAC,MASK) \ 120#define _R(NAME,MAC,MASK) \
@@ -147,7 +148,8 @@ static const struct {
147 _R("RTL8168c/8111c", RTL_GIGA_MAC_VER_21, 0xff7e1880), // PCI-E 148 _R("RTL8168c/8111c", RTL_GIGA_MAC_VER_21, 0xff7e1880), // PCI-E
148 _R("RTL8168c/8111c", RTL_GIGA_MAC_VER_22, 0xff7e1880), // PCI-E 149 _R("RTL8168c/8111c", RTL_GIGA_MAC_VER_22, 0xff7e1880), // PCI-E
149 _R("RTL8168cp/8111cp", RTL_GIGA_MAC_VER_23, 0xff7e1880), // PCI-E 150 _R("RTL8168cp/8111cp", RTL_GIGA_MAC_VER_23, 0xff7e1880), // PCI-E
150 _R("RTL8168cp/8111cp", RTL_GIGA_MAC_VER_24, 0xff7e1880) // PCI-E 151 _R("RTL8168cp/8111cp", RTL_GIGA_MAC_VER_24, 0xff7e1880), // PCI-E
152 _R("RTL8168d/8111d", RTL_GIGA_MAC_VER_25, 0xff7e1880) // PCI-E
151}; 153};
152#undef _R 154#undef _R
153 155
@@ -1224,6 +1226,9 @@ static void rtl8169_get_mac_version(struct rtl8169_private *tp,
1224 u32 val; 1226 u32 val;
1225 int mac_version; 1227 int mac_version;
1226 } mac_info[] = { 1228 } mac_info[] = {
1229 /* 8168D family. */
1230 { 0x7c800000, 0x28000000, RTL_GIGA_MAC_VER_25 },
1231
1227 /* 8168C family. */ 1232 /* 8168C family. */
1228 { 0x7cf00000, 0x3ca00000, RTL_GIGA_MAC_VER_24 }, 1233 { 0x7cf00000, 0x3ca00000, RTL_GIGA_MAC_VER_24 },
1229 { 0x7cf00000, 0x3c900000, RTL_GIGA_MAC_VER_23 }, 1234 { 0x7cf00000, 0x3c900000, RTL_GIGA_MAC_VER_23 },
@@ -1499,6 +1504,76 @@ static void rtl8168c_4_hw_phy_config(void __iomem *ioaddr)
1499 rtl8168c_3_hw_phy_config(ioaddr); 1504 rtl8168c_3_hw_phy_config(ioaddr);
1500} 1505}
1501 1506
1507static void rtl8168d_hw_phy_config(void __iomem *ioaddr)
1508{
1509 struct phy_reg phy_reg_init_0[] = {
1510 { 0x1f, 0x0001 },
1511 { 0x09, 0x2770 },
1512 { 0x08, 0x04d0 },
1513 { 0x0b, 0xad15 },
1514 { 0x0c, 0x5bf0 },
1515 { 0x1c, 0xf101 },
1516 { 0x1f, 0x0003 },
1517 { 0x14, 0x94d7 },
1518 { 0x12, 0xf4d6 },
1519 { 0x09, 0xca0f },
1520 { 0x1f, 0x0002 },
1521 { 0x0b, 0x0b10 },
1522 { 0x0c, 0xd1f7 },
1523 { 0x1f, 0x0002 },
1524 { 0x06, 0x5461 },
1525 { 0x1f, 0x0002 },
1526 { 0x05, 0x6662 },
1527 { 0x1f, 0x0000 },
1528 { 0x14, 0x0060 },
1529 { 0x1f, 0x0000 },
1530 { 0x0d, 0xf8a0 },
1531 { 0x1f, 0x0005 },
1532 { 0x05, 0xffc2 }
1533 };
1534
1535 rtl_phy_write(ioaddr, phy_reg_init_0, ARRAY_SIZE(phy_reg_init_0));
1536
1537 if (mdio_read(ioaddr, 0x06) == 0xc400) {
1538 struct phy_reg phy_reg_init_1[] = {
1539 { 0x1f, 0x0005 },
1540 { 0x01, 0x0300 },
1541 { 0x1f, 0x0000 },
1542 { 0x11, 0x401c },
1543 { 0x16, 0x4100 },
1544 { 0x1f, 0x0005 },
1545 { 0x07, 0x0010 },
1546 { 0x05, 0x83dc },
1547 { 0x06, 0x087d },
1548 { 0x05, 0x8300 },
1549 { 0x06, 0x0101 },
1550 { 0x06, 0x05f8 },
1551 { 0x06, 0xf9fa },
1552 { 0x06, 0xfbef },
1553 { 0x06, 0x79e2 },
1554 { 0x06, 0x835f },
1555 { 0x06, 0xe0f8 },
1556 { 0x06, 0x9ae1 },
1557 { 0x06, 0xf89b },
1558 { 0x06, 0xef31 },
1559 { 0x06, 0x3b65 },
1560 { 0x06, 0xaa07 },
1561 { 0x06, 0x81e4 },
1562 { 0x06, 0xf89a },
1563 { 0x06, 0xe5f8 },
1564 { 0x06, 0x9baf },
1565 { 0x06, 0x06ae },
1566 { 0x05, 0x83dc },
1567 { 0x06, 0x8300 },
1568 };
1569
1570 rtl_phy_write(ioaddr, phy_reg_init_1,
1571 ARRAY_SIZE(phy_reg_init_1));
1572 }
1573
1574 mdio_write(ioaddr, 0x1f, 0x0000);
1575}
1576
1502static void rtl8102e_hw_phy_config(void __iomem *ioaddr) 1577static void rtl8102e_hw_phy_config(void __iomem *ioaddr)
1503{ 1578{
1504 struct phy_reg phy_reg_init[] = { 1579 struct phy_reg phy_reg_init[] = {
@@ -1565,6 +1640,9 @@ static void rtl_hw_phy_config(struct net_device *dev)
1565 case RTL_GIGA_MAC_VER_24: 1640 case RTL_GIGA_MAC_VER_24:
1566 rtl8168cp_2_hw_phy_config(ioaddr); 1641 rtl8168cp_2_hw_phy_config(ioaddr);
1567 break; 1642 break;
1643 case RTL_GIGA_MAC_VER_25:
1644 rtl8168d_hw_phy_config(ioaddr);
1645 break;
1568 1646
1569 default: 1647 default:
1570 break; 1648 break;
@@ -2595,6 +2673,19 @@ static void rtl_hw_start_8168c_4(void __iomem *ioaddr, struct pci_dev *pdev)
2595 __rtl_hw_start_8168cp(ioaddr, pdev); 2673 __rtl_hw_start_8168cp(ioaddr, pdev);
2596} 2674}
2597 2675
2676static void rtl_hw_start_8168d(void __iomem *ioaddr, struct pci_dev *pdev)
2677{
2678 rtl_csi_access_enable(ioaddr);
2679
2680 rtl_disable_clock_request(pdev);
2681
2682 RTL_W8(EarlyTxThres, EarlyTxThld);
2683
2684 rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT);
2685
2686 RTL_W16(CPlusCmd, RTL_R16(CPlusCmd) & ~R8168_CPCMD_QUIRK_MASK);
2687}
2688
2598static void rtl_hw_start_8168(struct net_device *dev) 2689static void rtl_hw_start_8168(struct net_device *dev)
2599{ 2690{
2600 struct rtl8169_private *tp = netdev_priv(dev); 2691 struct rtl8169_private *tp = netdev_priv(dev);
@@ -2666,6 +2757,10 @@ static void rtl_hw_start_8168(struct net_device *dev)
2666 rtl_hw_start_8168cp_3(ioaddr, pdev); 2757 rtl_hw_start_8168cp_3(ioaddr, pdev);
2667 break; 2758 break;
2668 2759
2760 case RTL_GIGA_MAC_VER_25:
2761 rtl_hw_start_8168d(ioaddr, pdev);
2762 break;
2763
2669 default: 2764 default:
2670 printk(KERN_ERR PFX "%s: unknown chipset (mac_version = %d).\n", 2765 printk(KERN_ERR PFX "%s: unknown chipset (mac_version = %d).\n",
2671 dev->name, tp->mac_version); 2766 dev->name, tp->mac_version);