aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/r8169.c
diff options
context:
space:
mode:
authorFrancois Romieu <romieu@fr.zoreil.com>2007-08-17 09:05:21 -0400
committerFrancois Romieu <romieu@fr.zoreil.com>2007-10-18 15:25:40 -0400
commite179bb7b437f4bd726e9ea9b08aff2fa4a530c1a (patch)
tree1a8966429c1d58fb13a4cf61c07baa6e3639e1b9 /drivers/net/r8169.c
parente3cf0cc09141ddef9d75a984c0d286040f1f2743 (diff)
r8169: remove dead wood
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.c66
1 files changed, 2 insertions, 64 deletions
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 9deda50752cf..3a3ba79da43e 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -123,15 +123,6 @@ enum mac_version {
123 RTL_GIGA_MAC_VER_20 = 0x14 // 8168C 123 RTL_GIGA_MAC_VER_20 = 0x14 // 8168C
124}; 124};
125 125
126enum phy_version {
127 RTL_GIGA_PHY_VER_C = 0x03, /* PHY Reg 0x03 bit0-3 == 0x0000 */
128 RTL_GIGA_PHY_VER_D = 0x04, /* PHY Reg 0x03 bit0-3 == 0x0000 */
129 RTL_GIGA_PHY_VER_E = 0x05, /* PHY Reg 0x03 bit0-3 == 0x0000 */
130 RTL_GIGA_PHY_VER_F = 0x06, /* PHY Reg 0x03 bit0-3 == 0x0001 */
131 RTL_GIGA_PHY_VER_G = 0x07, /* PHY Reg 0x03 bit0-3 == 0x0002 */
132 RTL_GIGA_PHY_VER_H = 0x08, /* PHY Reg 0x03 bit0-3 == 0x0003 */
133};
134
135#define _R(NAME,MAC,MASK) \ 126#define _R(NAME,MAC,MASK) \
136 { .name = NAME, .mac_version = MAC, .RxConfigMask = MASK } 127 { .name = NAME, .mac_version = MAC, .RxConfigMask = MASK }
137 128
@@ -406,7 +397,6 @@ struct rtl8169_private {
406 u32 msg_enable; 397 u32 msg_enable;
407 int chipset; 398 int chipset;
408 int mac_version; 399 int mac_version;
409 int phy_version;
410 u32 cur_rx; /* Index into the Rx descriptor buffer of next Rx pkt. */ 400 u32 cur_rx; /* Index into the Rx descriptor buffer of next Rx pkt. */
411 u32 cur_tx; /* Index into the Tx descriptor buffer of next Rx pkt. */ 401 u32 cur_tx; /* Index into the Tx descriptor buffer of next Rx pkt. */
412 u32 dirty_rx; 402 u32 dirty_rx;
@@ -1178,50 +1168,6 @@ static void rtl8169_print_mac_version(struct rtl8169_private *tp)
1178 dprintk("mac_version = 0x%02x\n", tp->mac_version); 1168 dprintk("mac_version = 0x%02x\n", tp->mac_version);
1179} 1169}
1180 1170
1181static void rtl8169_get_phy_version(struct rtl8169_private *tp,
1182 void __iomem *ioaddr)
1183{
1184 const struct {
1185 u16 mask;
1186 u16 set;
1187 int phy_version;
1188 } phy_info[] = {
1189 { 0x000f, 0x0002, RTL_GIGA_PHY_VER_G },
1190 { 0x000f, 0x0001, RTL_GIGA_PHY_VER_F },
1191 { 0x000f, 0x0000, RTL_GIGA_PHY_VER_E },
1192 { 0x0000, 0x0000, RTL_GIGA_PHY_VER_D } /* Catch-all */
1193 }, *p = phy_info;
1194 u16 reg;
1195
1196 reg = mdio_read(ioaddr, MII_PHYSID2) & 0xffff;
1197 while ((reg & p->mask) != p->set)
1198 p++;
1199 tp->phy_version = p->phy_version;
1200}
1201
1202static void rtl8169_print_phy_version(struct rtl8169_private *tp)
1203{
1204 struct {
1205 int version;
1206 char *msg;
1207 u32 reg;
1208 } phy_print[] = {
1209 { RTL_GIGA_PHY_VER_G, "RTL_GIGA_PHY_VER_G", 0x0002 },
1210 { RTL_GIGA_PHY_VER_F, "RTL_GIGA_PHY_VER_F", 0x0001 },
1211 { RTL_GIGA_PHY_VER_E, "RTL_GIGA_PHY_VER_E", 0x0000 },
1212 { RTL_GIGA_PHY_VER_D, "RTL_GIGA_PHY_VER_D", 0x0000 },
1213 { 0, NULL, 0x0000 }
1214 }, *p;
1215
1216 for (p = phy_print; p->msg; p++) {
1217 if (tp->phy_version == p->version) {
1218 dprintk("phy_version == %s (%04x)\n", p->msg, p->reg);
1219 return;
1220 }
1221 }
1222 dprintk("phy_version == Unknown\n");
1223}
1224
1225static void rtl8169_hw_phy_config(struct net_device *dev) 1171static void rtl8169_hw_phy_config(struct net_device *dev)
1226{ 1172{
1227 struct rtl8169_private *tp = netdev_priv(dev); 1173 struct rtl8169_private *tp = netdev_priv(dev);
@@ -1259,12 +1205,9 @@ static void rtl8169_hw_phy_config(struct net_device *dev)
1259 unsigned int i; 1205 unsigned int i;
1260 1206
1261 rtl8169_print_mac_version(tp); 1207 rtl8169_print_mac_version(tp);
1262 rtl8169_print_phy_version(tp);
1263 1208
1264 if (tp->mac_version <= RTL_GIGA_MAC_VER_01) 1209 if (tp->mac_version <= RTL_GIGA_MAC_VER_01)
1265 return; 1210 return;
1266 if (tp->phy_version >= RTL_GIGA_PHY_VER_H)
1267 return;
1268 1211
1269 dprintk("MAC version != 0 && PHY version == 0 or 1\n"); 1212 dprintk("MAC version != 0 && PHY version == 0 or 1\n");
1270 dprintk("Do final_reg2.cfg\n"); 1213 dprintk("Do final_reg2.cfg\n");
@@ -1309,7 +1252,6 @@ static void rtl8169_phy_timer(unsigned long __opaque)
1309 unsigned long timeout = RTL8169_PHY_TIMEOUT; 1252 unsigned long timeout = RTL8169_PHY_TIMEOUT;
1310 1253
1311 assert(tp->mac_version > RTL_GIGA_MAC_VER_01); 1254 assert(tp->mac_version > RTL_GIGA_MAC_VER_01);
1312 assert(tp->phy_version < RTL_GIGA_PHY_VER_H);
1313 1255
1314 if (!(tp->phy_1000_ctrl_reg & ADVERTISE_1000FULL)) 1256 if (!(tp->phy_1000_ctrl_reg & ADVERTISE_1000FULL))
1315 return; 1257 return;
@@ -1344,8 +1286,7 @@ static inline void rtl8169_delete_timer(struct net_device *dev)
1344 struct rtl8169_private *tp = netdev_priv(dev); 1286 struct rtl8169_private *tp = netdev_priv(dev);
1345 struct timer_list *timer = &tp->timer; 1287 struct timer_list *timer = &tp->timer;
1346 1288
1347 if ((tp->mac_version <= RTL_GIGA_MAC_VER_01) || 1289 if (tp->mac_version <= RTL_GIGA_MAC_VER_01)
1348 (tp->phy_version >= RTL_GIGA_PHY_VER_H))
1349 return; 1290 return;
1350 1291
1351 del_timer_sync(timer); 1292 del_timer_sync(timer);
@@ -1356,8 +1297,7 @@ static inline void rtl8169_request_timer(struct net_device *dev)
1356 struct rtl8169_private *tp = netdev_priv(dev); 1297 struct rtl8169_private *tp = netdev_priv(dev);
1357 struct timer_list *timer = &tp->timer; 1298 struct timer_list *timer = &tp->timer;
1358 1299
1359 if ((tp->mac_version <= RTL_GIGA_MAC_VER_01) || 1300 if (tp->mac_version <= RTL_GIGA_MAC_VER_01)
1360 (tp->phy_version >= RTL_GIGA_PHY_VER_H))
1361 return; 1301 return;
1362 1302
1363 mod_timer(timer, jiffies + RTL8169_PHY_TIMEOUT); 1303 mod_timer(timer, jiffies + RTL8169_PHY_TIMEOUT);
@@ -1675,10 +1615,8 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1675 1615
1676 /* Identify chip attached to board */ 1616 /* Identify chip attached to board */
1677 rtl8169_get_mac_version(tp, ioaddr); 1617 rtl8169_get_mac_version(tp, ioaddr);
1678 rtl8169_get_phy_version(tp, ioaddr);
1679 1618
1680 rtl8169_print_mac_version(tp); 1619 rtl8169_print_mac_version(tp);
1681 rtl8169_print_phy_version(tp);
1682 1620
1683 for (i = ARRAY_SIZE(rtl_chip_info) - 1; i >= 0; i--) { 1621 for (i = ARRAY_SIZE(rtl_chip_info) - 1; i >= 0; i--) {
1684 if (tp->mac_version == rtl_chip_info[i].mac_version) 1622 if (tp->mac_version == rtl_chip_info[i].mac_version)