diff options
author | Francois Romieu <romieu@fr.zoreil.com> | 2007-08-17 08:55:46 -0400 |
---|---|---|
committer | Francois Romieu <romieu@fr.zoreil.com> | 2007-10-18 15:25:33 -0400 |
commit | e3cf0cc09141ddef9d75a984c0d286040f1f2743 (patch) | |
tree | 4adf032d82b108c4feac2bdba963a29d17c5891d /drivers/net/r8169.c | |
parent | bc1660b57021b91f4adcb8fd06fe7bbecade3a8b (diff) |
r8169: add MAC identifiers
The identifiers have been extracted from Realtek's drivers:
- version 8.002.00 of the r8168 driver
- version 6.002.00 of the r8169 driver
- version 1.002.00 of the r8101 driver
1. RTL_GIGA_MAC_VER_17 (8168Bf) is isolated from RTL_GIGA_MAC_VER_12 (8168Be)
Both are still handled the same in rtl8169_set_speed_xmii and in
rtl_set_rx_mode to avoid changes of behavior in this patch.
2. RTL_GIGA_MAC_VER_16 (8101Ec) is isolated from RTL_GIGA_MAC_VER_13 (8101Eb)
Same thing as above with relation to rtl8169_set_speed_xmii,
rtl_set_rx_mode and rtl_hw_start_8101.
3. The remaining new identifiers should not hurt.
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Edward Hsu <edward_hsu@realtek.com.tw>
Diffstat (limited to 'drivers/net/r8169.c')
-rw-r--r-- | drivers/net/r8169.c | 87 |
1 files changed, 64 insertions, 23 deletions
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index c290aa505347..9deda50752cf 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -112,10 +112,15 @@ enum mac_version { | |||
112 | RTL_GIGA_MAC_VER_05 = 0x05, // 8110SCd | 112 | RTL_GIGA_MAC_VER_05 = 0x05, // 8110SCd |
113 | RTL_GIGA_MAC_VER_06 = 0x06, // 8110SCe | 113 | RTL_GIGA_MAC_VER_06 = 0x06, // 8110SCe |
114 | RTL_GIGA_MAC_VER_11 = 0x0b, // 8168Bb | 114 | RTL_GIGA_MAC_VER_11 = 0x0b, // 8168Bb |
115 | RTL_GIGA_MAC_VER_12 = 0x0c, // 8168Be 8168Bf | 115 | RTL_GIGA_MAC_VER_12 = 0x0c, // 8168Be |
116 | RTL_GIGA_MAC_VER_13 = 0x0d, // 8101Eb 8101Ec | 116 | RTL_GIGA_MAC_VER_13 = 0x0d, // 8101Eb |
117 | RTL_GIGA_MAC_VER_14 = 0x0e, // 8101 | 117 | RTL_GIGA_MAC_VER_14 = 0x0e, // 8101 ? |
118 | RTL_GIGA_MAC_VER_15 = 0x0f // 8101 | 118 | RTL_GIGA_MAC_VER_15 = 0x0f, // 8101 ? |
119 | RTL_GIGA_MAC_VER_16 = 0x11, // 8101Ec | ||
120 | RTL_GIGA_MAC_VER_17 = 0x10, // 8168Bf | ||
121 | RTL_GIGA_MAC_VER_18 = 0x12, // 8168CP | ||
122 | RTL_GIGA_MAC_VER_19 = 0x13, // 8168C | ||
123 | RTL_GIGA_MAC_VER_20 = 0x14 // 8168C | ||
119 | }; | 124 | }; |
120 | 125 | ||
121 | enum phy_version { | 126 | enum phy_version { |
@@ -145,7 +150,12 @@ static const struct { | |||
145 | _R("RTL8168b/8111b", RTL_GIGA_MAC_VER_12, 0xff7e1880), // PCI-E | 150 | _R("RTL8168b/8111b", RTL_GIGA_MAC_VER_12, 0xff7e1880), // PCI-E |
146 | _R("RTL8101e", RTL_GIGA_MAC_VER_13, 0xff7e1880), // PCI-E 8139 | 151 | _R("RTL8101e", RTL_GIGA_MAC_VER_13, 0xff7e1880), // PCI-E 8139 |
147 | _R("RTL8100e", RTL_GIGA_MAC_VER_14, 0xff7e1880), // PCI-E 8139 | 152 | _R("RTL8100e", RTL_GIGA_MAC_VER_14, 0xff7e1880), // PCI-E 8139 |
148 | _R("RTL8100e", RTL_GIGA_MAC_VER_15, 0xff7e1880) // PCI-E 8139 | 153 | _R("RTL8100e", RTL_GIGA_MAC_VER_15, 0xff7e1880), // PCI-E 8139 |
154 | _R("RTL8168b/8111b", RTL_GIGA_MAC_VER_17, 0xff7e1880), // PCI-E | ||
155 | _R("RTL8101e", RTL_GIGA_MAC_VER_16, 0xff7e1880), // PCI-E | ||
156 | _R("RTL8168cp/8111cp", RTL_GIGA_MAC_VER_18, 0xff7e1880), // PCI-E | ||
157 | _R("RTL8168c/8111c", RTL_GIGA_MAC_VER_19, 0xff7e1880), // PCI-E | ||
158 | _R("RTL8168c/8111c", RTL_GIGA_MAC_VER_20, 0xff7e1880) // PCI-E | ||
149 | }; | 159 | }; |
150 | #undef _R | 160 | #undef _R |
151 | 161 | ||
@@ -716,7 +726,8 @@ static int rtl8169_set_speed_xmii(struct net_device *dev, | |||
716 | 726 | ||
717 | /* This tweak comes straight from Realtek's driver. */ | 727 | /* This tweak comes straight from Realtek's driver. */ |
718 | if ((speed == SPEED_100) && (duplex == DUPLEX_HALF) && | 728 | if ((speed == SPEED_100) && (duplex == DUPLEX_HALF) && |
719 | (tp->mac_version == RTL_GIGA_MAC_VER_13)) { | 729 | ((tp->mac_version == RTL_GIGA_MAC_VER_13) || |
730 | (tp->mac_version == RTL_GIGA_MAC_VER_16))) { | ||
720 | auto_nego = ADVERTISE_100HALF | ADVERTISE_CSMA; | 731 | auto_nego = ADVERTISE_100HALF | ADVERTISE_CSMA; |
721 | } | 732 | } |
722 | } | 733 | } |
@@ -724,7 +735,8 @@ static int rtl8169_set_speed_xmii(struct net_device *dev, | |||
724 | /* The 8100e/8101e do Fast Ethernet only. */ | 735 | /* The 8100e/8101e do Fast Ethernet only. */ |
725 | if ((tp->mac_version == RTL_GIGA_MAC_VER_13) || | 736 | if ((tp->mac_version == RTL_GIGA_MAC_VER_13) || |
726 | (tp->mac_version == RTL_GIGA_MAC_VER_14) || | 737 | (tp->mac_version == RTL_GIGA_MAC_VER_14) || |
727 | (tp->mac_version == RTL_GIGA_MAC_VER_15)) { | 738 | (tp->mac_version == RTL_GIGA_MAC_VER_15) || |
739 | (tp->mac_version == RTL_GIGA_MAC_VER_16)) { | ||
728 | if ((giga_ctrl & (ADVERTISE_1000FULL | ADVERTISE_1000HALF)) && | 740 | if ((giga_ctrl & (ADVERTISE_1000FULL | ADVERTISE_1000HALF)) && |
729 | netif_msg_link(tp)) { | 741 | netif_msg_link(tp)) { |
730 | printk(KERN_INFO "%s: PHY does not support 1000Mbps.\n", | 742 | printk(KERN_INFO "%s: PHY does not support 1000Mbps.\n", |
@@ -735,7 +747,8 @@ static int rtl8169_set_speed_xmii(struct net_device *dev, | |||
735 | 747 | ||
736 | auto_nego |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM; | 748 | auto_nego |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM; |
737 | 749 | ||
738 | if (tp->mac_version == RTL_GIGA_MAC_VER_12) { | 750 | if ((tp->mac_version == RTL_GIGA_MAC_VER_12) || |
751 | (tp->mac_version == RTL_GIGA_MAC_VER_17)) { | ||
739 | /* Vendor specific (0x1f) and reserved (0x0e) MII registers. */ | 752 | /* Vendor specific (0x1f) and reserved (0x0e) MII registers. */ |
740 | mdio_write(ioaddr, 0x1f, 0x0000); | 753 | mdio_write(ioaddr, 0x1f, 0x0000); |
741 | mdio_write(ioaddr, 0x0e, 0x0000); | 754 | mdio_write(ioaddr, 0x0e, 0x0000); |
@@ -1113,26 +1126,51 @@ static void rtl8169_get_mac_version(struct rtl8169_private *tp, | |||
1113 | */ | 1126 | */ |
1114 | const struct { | 1127 | const struct { |
1115 | u32 mask; | 1128 | u32 mask; |
1129 | u32 val; | ||
1116 | int mac_version; | 1130 | int mac_version; |
1117 | } mac_info[] = { | 1131 | } mac_info[] = { |
1118 | { 0x38800000, RTL_GIGA_MAC_VER_15 }, | 1132 | /* 8168B family. */ |
1119 | { 0x38000000, RTL_GIGA_MAC_VER_12 }, | 1133 | { 0x7c800000, 0x3c800000, RTL_GIGA_MAC_VER_18 }, |
1120 | { 0x34000000, RTL_GIGA_MAC_VER_13 }, | 1134 | { 0x7cf00000, 0x3c000000, RTL_GIGA_MAC_VER_19 }, |
1121 | { 0x30800000, RTL_GIGA_MAC_VER_14 }, | 1135 | { 0x7cf00000, 0x3c200000, RTL_GIGA_MAC_VER_20 }, |
1122 | { 0x30000000, RTL_GIGA_MAC_VER_11 }, | 1136 | { 0x7c800000, 0x3c000000, RTL_GIGA_MAC_VER_20 }, |
1123 | { 0x98000000, RTL_GIGA_MAC_VER_06 }, | 1137 | |
1124 | { 0x18000000, RTL_GIGA_MAC_VER_05 }, | 1138 | /* 8168B family. */ |
1125 | { 0x10000000, RTL_GIGA_MAC_VER_04 }, | 1139 | { 0x7cf00000, 0x38000000, RTL_GIGA_MAC_VER_12 }, |
1126 | { 0x04000000, RTL_GIGA_MAC_VER_03 }, | 1140 | { 0x7cf00000, 0x38500000, RTL_GIGA_MAC_VER_17 }, |
1127 | { 0x00800000, RTL_GIGA_MAC_VER_02 }, | 1141 | { 0x7c800000, 0x38000000, RTL_GIGA_MAC_VER_17 }, |
1128 | { 0x00000000, RTL_GIGA_MAC_VER_01 } /* Catch-all */ | 1142 | { 0x7c800000, 0x30000000, RTL_GIGA_MAC_VER_11 }, |
1143 | |||
1144 | /* 8101 family. */ | ||
1145 | { 0x7cf00000, 0x34000000, RTL_GIGA_MAC_VER_13 }, | ||
1146 | { 0x7cf00000, 0x34200000, RTL_GIGA_MAC_VER_16 }, | ||
1147 | { 0x7c800000, 0x34000000, RTL_GIGA_MAC_VER_16 }, | ||
1148 | /* FIXME: where did these entries come from ? -- FR */ | ||
1149 | { 0xfc800000, 0x38800000, RTL_GIGA_MAC_VER_15 }, | ||
1150 | { 0xfc800000, 0x30800000, RTL_GIGA_MAC_VER_14 }, | ||
1151 | |||
1152 | /* 8110 family. */ | ||
1153 | { 0xfc800000, 0x98000000, RTL_GIGA_MAC_VER_06 }, | ||
1154 | { 0xfc800000, 0x18000000, RTL_GIGA_MAC_VER_05 }, | ||
1155 | { 0xfc800000, 0x10000000, RTL_GIGA_MAC_VER_04 }, | ||
1156 | { 0xfc800000, 0x04000000, RTL_GIGA_MAC_VER_03 }, | ||
1157 | { 0xfc800000, 0x00800000, RTL_GIGA_MAC_VER_02 }, | ||
1158 | { 0xfc800000, 0x00000000, RTL_GIGA_MAC_VER_01 }, | ||
1159 | |||
1160 | { 0x00000000, 0x00000000, RTL_GIGA_MAC_VER_01 } /* Catch-all */ | ||
1129 | }, *p = mac_info; | 1161 | }, *p = mac_info; |
1130 | u32 reg; | 1162 | u32 reg; |
1131 | 1163 | ||
1132 | reg = RTL_R32(TxConfig) & 0xfc800000; | 1164 | reg = RTL_R32(TxConfig); |
1133 | while ((reg & p->mask) != p->mask) | 1165 | while ((reg & p->mask) != p->val) |
1134 | p++; | 1166 | p++; |
1135 | tp->mac_version = p->mac_version; | 1167 | tp->mac_version = p->mac_version; |
1168 | |||
1169 | if (p->mask == 0x00000000) { | ||
1170 | struct pci_dev *pdev = tp->pci_dev; | ||
1171 | |||
1172 | dev_info(&pdev->dev, "unknown MAC (%08x)\n", reg); | ||
1173 | } | ||
1136 | } | 1174 | } |
1137 | 1175 | ||
1138 | static void rtl8169_print_mac_version(struct rtl8169_private *tp) | 1176 | static void rtl8169_print_mac_version(struct rtl8169_private *tp) |
@@ -2074,7 +2112,8 @@ static void rtl_hw_start_8101(struct net_device *dev) | |||
2074 | void __iomem *ioaddr = tp->mmio_addr; | 2112 | void __iomem *ioaddr = tp->mmio_addr; |
2075 | struct pci_dev *pdev = tp->pci_dev; | 2113 | struct pci_dev *pdev = tp->pci_dev; |
2076 | 2114 | ||
2077 | if (tp->mac_version == RTL_GIGA_MAC_VER_13) { | 2115 | if ((tp->mac_version == RTL_GIGA_MAC_VER_13) || |
2116 | (tp->mac_version == RTL_GIGA_MAC_VER_16)) { | ||
2078 | pci_write_config_word(pdev, 0x68, 0x00); | 2117 | pci_write_config_word(pdev, 0x68, 0x00); |
2079 | pci_write_config_word(pdev, 0x69, 0x08); | 2118 | pci_write_config_word(pdev, 0x69, 0x08); |
2080 | } | 2119 | } |
@@ -3030,7 +3069,9 @@ static void rtl_set_rx_mode(struct net_device *dev) | |||
3030 | (tp->mac_version == RTL_GIGA_MAC_VER_12) || | 3069 | (tp->mac_version == RTL_GIGA_MAC_VER_12) || |
3031 | (tp->mac_version == RTL_GIGA_MAC_VER_13) || | 3070 | (tp->mac_version == RTL_GIGA_MAC_VER_13) || |
3032 | (tp->mac_version == RTL_GIGA_MAC_VER_14) || | 3071 | (tp->mac_version == RTL_GIGA_MAC_VER_14) || |
3033 | (tp->mac_version == RTL_GIGA_MAC_VER_15)) { | 3072 | (tp->mac_version == RTL_GIGA_MAC_VER_15) || |
3073 | (tp->mac_version == RTL_GIGA_MAC_VER_16) || | ||
3074 | (tp->mac_version == RTL_GIGA_MAC_VER_17)) { | ||
3034 | mc_filter[0] = 0xffffffff; | 3075 | mc_filter[0] = 0xffffffff; |
3035 | mc_filter[1] = 0xffffffff; | 3076 | mc_filter[1] = 0xffffffff; |
3036 | } | 3077 | } |