aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2009-05-26 23:54:48 -0400
committerDavid S. Miller <davem@davemloft.net>2009-05-26 23:54:48 -0400
commitf21b75e9d6471d7f4e2110774819be7beafc86d5 (patch)
tree226110ea10c603fe9026351c0c41c999ee0cd7d3 /drivers/net
parent3d6593e9cc40d0eacc03f75f90834794a4a477df (diff)
r8169: Use a different default for each family
The r8169 driver supports 3 different families of network chips (RTL8169, RTL8168 and RTL8101). When an unknown version is found, the driver currently always defaults to the RTL8169 variant. This has very little chance to ever work for chips of the other families. So better define a per-family default. Signed-off-by: Jean Delvare <jdelvare@suse.de> Acked-by: Francois Romieu <romieu@fr.zoreil.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/r8169.c39
1 files changed, 22 insertions, 17 deletions
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index fb2e50da0e9c..0ec0605bcebd 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -94,6 +94,7 @@ static const int multicast_filter_limit = 32;
94#define RTL_R32(reg) ((unsigned long) readl (ioaddr + (reg))) 94#define RTL_R32(reg) ((unsigned long) readl (ioaddr + (reg)))
95 95
96enum mac_version { 96enum mac_version {
97 RTL_GIGA_MAC_NONE = 0x00,
97 RTL_GIGA_MAC_VER_01 = 0x01, // 8169 98 RTL_GIGA_MAC_VER_01 = 0x01, // 8169
98 RTL_GIGA_MAC_VER_02 = 0x02, // 8169S 99 RTL_GIGA_MAC_VER_02 = 0x02, // 8169S
99 RTL_GIGA_MAC_VER_03 = 0x03, // 8110S 100 RTL_GIGA_MAC_VER_03 = 0x03, // 8110S
@@ -1300,7 +1301,8 @@ static void rtl8169_get_mac_version(struct rtl8169_private *tp,
1300 { 0xfc800000, 0x00800000, RTL_GIGA_MAC_VER_02 }, 1301 { 0xfc800000, 0x00800000, RTL_GIGA_MAC_VER_02 },
1301 { 0xfc800000, 0x00000000, RTL_GIGA_MAC_VER_01 }, 1302 { 0xfc800000, 0x00000000, RTL_GIGA_MAC_VER_01 },
1302 1303
1303 { 0x00000000, 0x00000000, RTL_GIGA_MAC_VER_01 } /* Catch-all */ 1304 /* Catch-all */
1305 { 0x00000000, 0x00000000, RTL_GIGA_MAC_NONE }
1304 }, *p = mac_info; 1306 }, *p = mac_info;
1305 u32 reg; 1307 u32 reg;
1306 1308
@@ -1308,12 +1310,6 @@ static void rtl8169_get_mac_version(struct rtl8169_private *tp,
1308 while ((reg & p->mask) != p->val) 1310 while ((reg & p->mask) != p->val)
1309 p++; 1311 p++;
1310 tp->mac_version = p->mac_version; 1312 tp->mac_version = p->mac_version;
1311
1312 if (p->mask == 0x00000000) {
1313 struct pci_dev *pdev = tp->pci_dev;
1314
1315 dev_info(&pdev->dev, "unknown MAC (%08x)\n", reg);
1316 }
1317} 1313}
1318 1314
1319static void rtl8169_print_mac_version(struct rtl8169_private *tp) 1315static void rtl8169_print_mac_version(struct rtl8169_private *tp)
@@ -1889,6 +1885,7 @@ static const struct rtl_cfg_info {
1889 u16 intr_event; 1885 u16 intr_event;
1890 u16 napi_event; 1886 u16 napi_event;
1891 unsigned features; 1887 unsigned features;
1888 u8 default_ver;
1892} rtl_cfg_infos [] = { 1889} rtl_cfg_infos [] = {
1893 [RTL_CFG_0] = { 1890 [RTL_CFG_0] = {
1894 .hw_start = rtl_hw_start_8169, 1891 .hw_start = rtl_hw_start_8169,
@@ -1897,7 +1894,8 @@ static const struct rtl_cfg_info {
1897 .intr_event = SYSErr | LinkChg | RxOverflow | 1894 .intr_event = SYSErr | LinkChg | RxOverflow |
1898 RxFIFOOver | TxErr | TxOK | RxOK | RxErr, 1895 RxFIFOOver | TxErr | TxOK | RxOK | RxErr,
1899 .napi_event = RxFIFOOver | TxErr | TxOK | RxOK | RxOverflow, 1896 .napi_event = RxFIFOOver | TxErr | TxOK | RxOK | RxOverflow,
1900 .features = RTL_FEATURE_GMII 1897 .features = RTL_FEATURE_GMII,
1898 .default_ver = RTL_GIGA_MAC_VER_01,
1901 }, 1899 },
1902 [RTL_CFG_1] = { 1900 [RTL_CFG_1] = {
1903 .hw_start = rtl_hw_start_8168, 1901 .hw_start = rtl_hw_start_8168,
@@ -1906,7 +1904,8 @@ static const struct rtl_cfg_info {
1906 .intr_event = SYSErr | LinkChg | RxOverflow | 1904 .intr_event = SYSErr | LinkChg | RxOverflow |
1907 TxErr | TxOK | RxOK | RxErr, 1905 TxErr | TxOK | RxOK | RxErr,
1908 .napi_event = TxErr | TxOK | RxOK | RxOverflow, 1906 .napi_event = TxErr | TxOK | RxOK | RxOverflow,
1909 .features = RTL_FEATURE_GMII | RTL_FEATURE_MSI 1907 .features = RTL_FEATURE_GMII | RTL_FEATURE_MSI,
1908 .default_ver = RTL_GIGA_MAC_VER_11,
1910 }, 1909 },
1911 [RTL_CFG_2] = { 1910 [RTL_CFG_2] = {
1912 .hw_start = rtl_hw_start_8101, 1911 .hw_start = rtl_hw_start_8101,
@@ -1915,7 +1914,8 @@ static const struct rtl_cfg_info {
1915 .intr_event = SYSErr | LinkChg | RxOverflow | PCSTimeout | 1914 .intr_event = SYSErr | LinkChg | RxOverflow | PCSTimeout |
1916 RxFIFOOver | TxErr | TxOK | RxOK | RxErr, 1915 RxFIFOOver | TxErr | TxOK | RxOK | RxErr,
1917 .napi_event = RxFIFOOver | TxErr | TxOK | RxOK | RxOverflow, 1916 .napi_event = RxFIFOOver | TxErr | TxOK | RxOK | RxOverflow,
1918 .features = RTL_FEATURE_MSI 1917 .features = RTL_FEATURE_MSI,
1918 .default_ver = RTL_GIGA_MAC_VER_13,
1919 } 1919 }
1920}; 1920};
1921 1921
@@ -2096,6 +2096,15 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2096 /* Identify chip attached to board */ 2096 /* Identify chip attached to board */
2097 rtl8169_get_mac_version(tp, ioaddr); 2097 rtl8169_get_mac_version(tp, ioaddr);
2098 2098
2099 /* Use appropriate default if unknown */
2100 if (tp->mac_version == RTL_GIGA_MAC_NONE) {
2101 if (netif_msg_probe(tp)) {
2102 dev_notice(&pdev->dev,
2103 "unknown MAC, using family default\n");
2104 }
2105 tp->mac_version = cfg->default_ver;
2106 }
2107
2099 rtl8169_print_mac_version(tp); 2108 rtl8169_print_mac_version(tp);
2100 2109
2101 for (i = 0; i < ARRAY_SIZE(rtl_chip_info); i++) { 2110 for (i = 0; i < ARRAY_SIZE(rtl_chip_info); i++) {
@@ -2103,13 +2112,9 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2103 break; 2112 break;
2104 } 2113 }
2105 if (i == ARRAY_SIZE(rtl_chip_info)) { 2114 if (i == ARRAY_SIZE(rtl_chip_info)) {
2106 /* Unknown chip: assume array element #0, original RTL-8169 */ 2115 dev_err(&pdev->dev,
2107 if (netif_msg_probe(tp)) { 2116 "driver bug, MAC version not found in rtl_chip_info\n");
2108 dev_printk(KERN_DEBUG, &pdev->dev, 2117 goto err_out_msi_5;
2109 "unknown chip version, assuming %s\n",
2110 rtl_chip_info[0].name);
2111 }
2112 i = 0;
2113 } 2118 }
2114 tp->chipset = i; 2119 tp->chipset = i;
2115 2120