diff options
Diffstat (limited to 'drivers/net/pcmcia/pcnet_cs.c')
-rw-r--r-- | drivers/net/pcmcia/pcnet_cs.c | 106 |
1 files changed, 43 insertions, 63 deletions
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index f9b509a6b09..c94311aed1a 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c | |||
@@ -28,6 +28,8 @@ | |||
28 | 28 | ||
29 | ======================================================================*/ | 29 | ======================================================================*/ |
30 | 30 | ||
31 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
32 | |||
31 | #include <linux/kernel.h> | 33 | #include <linux/kernel.h> |
32 | #include <linux/module.h> | 34 | #include <linux/module.h> |
33 | #include <linux/init.h> | 35 | #include <linux/init.h> |
@@ -35,7 +37,6 @@ | |||
35 | #include <linux/string.h> | 37 | #include <linux/string.h> |
36 | #include <linux/timer.h> | 38 | #include <linux/timer.h> |
37 | #include <linux/delay.h> | 39 | #include <linux/delay.h> |
38 | #include <linux/ethtool.h> | ||
39 | #include <linux/netdevice.h> | 40 | #include <linux/netdevice.h> |
40 | #include <linux/log2.h> | 41 | #include <linux/log2.h> |
41 | #include <linux/etherdevice.h> | 42 | #include <linux/etherdevice.h> |
@@ -100,7 +101,6 @@ static void pcnet_release(struct pcmcia_device *link); | |||
100 | static int pcnet_open(struct net_device *dev); | 101 | static int pcnet_open(struct net_device *dev); |
101 | static int pcnet_close(struct net_device *dev); | 102 | static int pcnet_close(struct net_device *dev); |
102 | static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); | 103 | static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); |
103 | static const struct ethtool_ops netdev_ethtool_ops; | ||
104 | static irqreturn_t ei_irq_wrapper(int irq, void *dev_id); | 104 | static irqreturn_t ei_irq_wrapper(int irq, void *dev_id); |
105 | static void ei_watchdog(u_long arg); | 105 | static void ei_watchdog(u_long arg); |
106 | static void pcnet_reset_8390(struct net_device *dev); | 106 | static void pcnet_reset_8390(struct net_device *dev); |
@@ -434,8 +434,6 @@ static hw_info_t *get_ax88190(struct pcmcia_device *link) | |||
434 | dev->dev_addr[i] = j & 0xff; | 434 | dev->dev_addr[i] = j & 0xff; |
435 | dev->dev_addr[i+1] = j >> 8; | 435 | dev->dev_addr[i+1] = j >> 8; |
436 | } | 436 | } |
437 | printk(KERN_NOTICE "pcnet_cs: this is an AX88190 card!\n"); | ||
438 | printk(KERN_NOTICE "pcnet_cs: use axnet_cs instead.\n"); | ||
439 | return NULL; | 437 | return NULL; |
440 | } | 438 | } |
441 | 439 | ||
@@ -653,9 +651,7 @@ static int pcnet_config(struct pcmcia_device *link) | |||
653 | 651 | ||
654 | ei_status.name = "NE2000"; | 652 | ei_status.name = "NE2000"; |
655 | ei_status.word16 = 1; | 653 | ei_status.word16 = 1; |
656 | ei_status.reset_8390 = &pcnet_reset_8390; | 654 | ei_status.reset_8390 = pcnet_reset_8390; |
657 | |||
658 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); | ||
659 | 655 | ||
660 | if (info->flags & (IS_DL10019|IS_DL10022)) | 656 | if (info->flags & (IS_DL10019|IS_DL10022)) |
661 | mii_phy_probe(dev); | 657 | mii_phy_probe(dev); |
@@ -663,25 +659,25 @@ static int pcnet_config(struct pcmcia_device *link) | |||
663 | SET_NETDEV_DEV(dev, &link->dev); | 659 | SET_NETDEV_DEV(dev, &link->dev); |
664 | 660 | ||
665 | if (register_netdev(dev) != 0) { | 661 | if (register_netdev(dev) != 0) { |
666 | printk(KERN_NOTICE "pcnet_cs: register_netdev() failed\n"); | 662 | pr_notice("register_netdev() failed\n"); |
667 | goto failed; | 663 | goto failed; |
668 | } | 664 | } |
669 | 665 | ||
670 | if (info->flags & (IS_DL10019|IS_DL10022)) { | 666 | if (info->flags & (IS_DL10019|IS_DL10022)) { |
671 | u_char id = inb(dev->base_addr + 0x1a); | 667 | u_char id = inb(dev->base_addr + 0x1a); |
672 | printk(KERN_INFO "%s: NE2000 (DL100%d rev %02x): ", | 668 | netdev_info(dev, "NE2000 (DL100%d rev %02x): ", |
673 | dev->name, ((info->flags & IS_DL10022) ? 22 : 19), id); | 669 | (info->flags & IS_DL10022) ? 22 : 19, id); |
674 | if (info->pna_phy) | 670 | if (info->pna_phy) |
675 | printk("PNA, "); | 671 | pr_cont("PNA, "); |
676 | } else { | 672 | } else { |
677 | printk(KERN_INFO "%s: NE2000 Compatible: ", dev->name); | 673 | netdev_info(dev, "NE2000 Compatible: "); |
678 | } | 674 | } |
679 | printk("io %#3lx, irq %d,", dev->base_addr, dev->irq); | 675 | pr_cont("io %#3lx, irq %d,", dev->base_addr, dev->irq); |
680 | if (info->flags & USE_SHMEM) | 676 | if (info->flags & USE_SHMEM) |
681 | printk (" mem %#5lx,", dev->mem_start); | 677 | pr_cont(" mem %#5lx,", dev->mem_start); |
682 | if (info->flags & HAS_MISC_REG) | 678 | if (info->flags & HAS_MISC_REG) |
683 | printk(" %s xcvr,", if_names[dev->if_port]); | 679 | pr_cont(" %s xcvr,", if_names[dev->if_port]); |
684 | printk(" hw_addr %pM\n", dev->dev_addr); | 680 | pr_cont(" hw_addr %pM\n", dev->dev_addr); |
685 | return 0; | 681 | return 0; |
686 | 682 | ||
687 | failed: | 683 | failed: |
@@ -955,7 +951,7 @@ static void mii_phy_probe(struct net_device *dev) | |||
955 | phyid = tmp << 16; | 951 | phyid = tmp << 16; |
956 | phyid |= mdio_read(mii_addr, i, MII_PHYID_REG2); | 952 | phyid |= mdio_read(mii_addr, i, MII_PHYID_REG2); |
957 | phyid &= MII_PHYID_REV_MASK; | 953 | phyid &= MII_PHYID_REV_MASK; |
958 | pr_debug("%s: MII at %d is 0x%08x\n", dev->name, i, phyid); | 954 | netdev_dbg(dev, "MII at %d is 0x%08x\n", i, phyid); |
959 | if (phyid == AM79C9XX_HOME_PHY) { | 955 | if (phyid == AM79C9XX_HOME_PHY) { |
960 | info->pna_phy = i; | 956 | info->pna_phy = i; |
961 | } else if (phyid != AM79C9XX_ETH_PHY) { | 957 | } else if (phyid != AM79C9XX_ETH_PHY) { |
@@ -988,7 +984,7 @@ static int pcnet_open(struct net_device *dev) | |||
988 | info->phy_id = info->eth_phy; | 984 | info->phy_id = info->eth_phy; |
989 | info->link_status = 0x00; | 985 | info->link_status = 0x00; |
990 | init_timer(&info->watchdog); | 986 | init_timer(&info->watchdog); |
991 | info->watchdog.function = &ei_watchdog; | 987 | info->watchdog.function = ei_watchdog; |
992 | info->watchdog.data = (u_long)dev; | 988 | info->watchdog.data = (u_long)dev; |
993 | info->watchdog.expires = jiffies + HZ; | 989 | info->watchdog.expires = jiffies + HZ; |
994 | add_timer(&info->watchdog); | 990 | add_timer(&info->watchdog); |
@@ -1041,8 +1037,8 @@ static void pcnet_reset_8390(struct net_device *dev) | |||
1041 | outb_p(ENISR_RESET, nic_base + EN0_ISR); /* Ack intr. */ | 1037 | outb_p(ENISR_RESET, nic_base + EN0_ISR); /* Ack intr. */ |
1042 | 1038 | ||
1043 | if (i == 100) | 1039 | if (i == 100) |
1044 | printk(KERN_ERR "%s: pcnet_reset_8390() did not complete.\n", | 1040 | netdev_err(dev, "pcnet_reset_8390() did not complete.\n"); |
1045 | dev->name); | 1041 | |
1046 | set_misc_reg(dev); | 1042 | set_misc_reg(dev); |
1047 | 1043 | ||
1048 | } /* pcnet_reset_8390 */ | 1044 | } /* pcnet_reset_8390 */ |
@@ -1058,8 +1054,7 @@ static int set_config(struct net_device *dev, struct ifmap *map) | |||
1058 | else if ((map->port < 1) || (map->port > 2)) | 1054 | else if ((map->port < 1) || (map->port > 2)) |
1059 | return -EINVAL; | 1055 | return -EINVAL; |
1060 | dev->if_port = map->port; | 1056 | dev->if_port = map->port; |
1061 | printk(KERN_INFO "%s: switched to %s port\n", | 1057 | netdev_info(dev, "switched to %s port\n", if_names[dev->if_port]); |
1062 | dev->name, if_names[dev->if_port]); | ||
1063 | NS8390_init(dev, 1); | 1058 | NS8390_init(dev, 1); |
1064 | } | 1059 | } |
1065 | return 0; | 1060 | return 0; |
@@ -1094,7 +1089,7 @@ static void ei_watchdog(u_long arg) | |||
1094 | this, we can limp along even if the interrupt is blocked */ | 1089 | this, we can limp along even if the interrupt is blocked */ |
1095 | if (info->stale++ && (inb_p(nic_base + EN0_ISR) & ENISR_ALL)) { | 1090 | if (info->stale++ && (inb_p(nic_base + EN0_ISR) & ENISR_ALL)) { |
1096 | if (!info->fast_poll) | 1091 | if (!info->fast_poll) |
1097 | printk(KERN_INFO "%s: interrupt(s) dropped!\n", dev->name); | 1092 | netdev_info(dev, "interrupt(s) dropped!\n"); |
1098 | ei_irq_wrapper(dev->irq, dev); | 1093 | ei_irq_wrapper(dev->irq, dev); |
1099 | info->fast_poll = HZ; | 1094 | info->fast_poll = HZ; |
1100 | } | 1095 | } |
@@ -1114,7 +1109,7 @@ static void ei_watchdog(u_long arg) | |||
1114 | if (info->eth_phy) { | 1109 | if (info->eth_phy) { |
1115 | info->phy_id = info->eth_phy = 0; | 1110 | info->phy_id = info->eth_phy = 0; |
1116 | } else { | 1111 | } else { |
1117 | printk(KERN_INFO "%s: MII is missing!\n", dev->name); | 1112 | netdev_info(dev, "MII is missing!\n"); |
1118 | info->flags &= ~HAS_MII; | 1113 | info->flags &= ~HAS_MII; |
1119 | } | 1114 | } |
1120 | goto reschedule; | 1115 | goto reschedule; |
@@ -1123,8 +1118,7 @@ static void ei_watchdog(u_long arg) | |||
1123 | link &= 0x0004; | 1118 | link &= 0x0004; |
1124 | if (link != info->link_status) { | 1119 | if (link != info->link_status) { |
1125 | u_short p = mdio_read(mii_addr, info->phy_id, 5); | 1120 | u_short p = mdio_read(mii_addr, info->phy_id, 5); |
1126 | printk(KERN_INFO "%s: %s link beat\n", dev->name, | 1121 | netdev_info(dev, "%s link beat\n", link ? "found" : "lost"); |
1127 | (link) ? "found" : "lost"); | ||
1128 | if (link && (info->flags & IS_DL10022)) { | 1122 | if (link && (info->flags & IS_DL10022)) { |
1129 | /* Disable collision detection on full duplex links */ | 1123 | /* Disable collision detection on full duplex links */ |
1130 | outb((p & 0x0140) ? 4 : 0, nic_base + DLINK_DIAG); | 1124 | outb((p & 0x0140) ? 4 : 0, nic_base + DLINK_DIAG); |
@@ -1135,13 +1129,12 @@ static void ei_watchdog(u_long arg) | |||
1135 | if (link) { | 1129 | if (link) { |
1136 | if (info->phy_id == info->eth_phy) { | 1130 | if (info->phy_id == info->eth_phy) { |
1137 | if (p) | 1131 | if (p) |
1138 | printk(KERN_INFO "%s: autonegotiation complete: " | 1132 | netdev_info(dev, "autonegotiation complete: " |
1139 | "%sbaseT-%cD selected\n", dev->name, | 1133 | "%sbaseT-%cD selected\n", |
1140 | ((p & 0x0180) ? "100" : "10"), | 1134 | ((p & 0x0180) ? "100" : "10"), |
1141 | ((p & 0x0140) ? 'F' : 'H')); | 1135 | ((p & 0x0140) ? 'F' : 'H')); |
1142 | else | 1136 | else |
1143 | printk(KERN_INFO "%s: link partner did not " | 1137 | netdev_info(dev, "link partner did not autonegotiate\n"); |
1144 | "autonegotiate\n", dev->name); | ||
1145 | } | 1138 | } |
1146 | NS8390_init(dev, 1); | 1139 | NS8390_init(dev, 1); |
1147 | } | 1140 | } |
@@ -1154,7 +1147,7 @@ static void ei_watchdog(u_long arg) | |||
1154 | /* isolate this MII and try flipping to the other one */ | 1147 | /* isolate this MII and try flipping to the other one */ |
1155 | mdio_write(mii_addr, info->phy_id, 0, 0x0400); | 1148 | mdio_write(mii_addr, info->phy_id, 0, 0x0400); |
1156 | info->phy_id ^= info->pna_phy ^ info->eth_phy; | 1149 | info->phy_id ^= info->pna_phy ^ info->eth_phy; |
1157 | printk(KERN_INFO "%s: switched to %s transceiver\n", dev->name, | 1150 | netdev_info(dev, "switched to %s transceiver\n", |
1158 | (info->phy_id == info->eth_phy) ? "ethernet" : "PNA"); | 1151 | (info->phy_id == info->eth_phy) ? "ethernet" : "PNA"); |
1159 | mdio_write(mii_addr, info->phy_id, 0, | 1152 | mdio_write(mii_addr, info->phy_id, 0, |
1160 | (info->phy_id == info->eth_phy) ? 0x1000 : 0); | 1153 | (info->phy_id == info->eth_phy) ? 0x1000 : 0); |
@@ -1170,18 +1163,6 @@ reschedule: | |||
1170 | 1163 | ||
1171 | /*====================================================================*/ | 1164 | /*====================================================================*/ |
1172 | 1165 | ||
1173 | static void netdev_get_drvinfo(struct net_device *dev, | ||
1174 | struct ethtool_drvinfo *info) | ||
1175 | { | ||
1176 | strcpy(info->driver, "pcnet_cs"); | ||
1177 | } | ||
1178 | |||
1179 | static const struct ethtool_ops netdev_ethtool_ops = { | ||
1180 | .get_drvinfo = netdev_get_drvinfo, | ||
1181 | }; | ||
1182 | |||
1183 | /*====================================================================*/ | ||
1184 | |||
1185 | 1166 | ||
1186 | static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | 1167 | static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) |
1187 | { | 1168 | { |
@@ -1214,9 +1195,9 @@ static void dma_get_8390_hdr(struct net_device *dev, | |||
1214 | unsigned int nic_base = dev->base_addr; | 1195 | unsigned int nic_base = dev->base_addr; |
1215 | 1196 | ||
1216 | if (ei_status.dmaing) { | 1197 | if (ei_status.dmaing) { |
1217 | printk(KERN_NOTICE "%s: DMAing conflict in dma_block_input." | 1198 | netdev_notice(dev, "DMAing conflict in dma_block_input." |
1218 | "[DMAstat:%1x][irqlock:%1x]\n", | 1199 | "[DMAstat:%1x][irqlock:%1x]\n", |
1219 | dev->name, ei_status.dmaing, ei_status.irqlock); | 1200 | ei_status.dmaing, ei_status.irqlock); |
1220 | return; | 1201 | return; |
1221 | } | 1202 | } |
1222 | 1203 | ||
@@ -1247,11 +1228,11 @@ static void dma_block_input(struct net_device *dev, int count, | |||
1247 | char *buf = skb->data; | 1228 | char *buf = skb->data; |
1248 | 1229 | ||
1249 | if ((ei_debug > 4) && (count != 4)) | 1230 | if ((ei_debug > 4) && (count != 4)) |
1250 | pr_debug("%s: [bi=%d]\n", dev->name, count+4); | 1231 | netdev_dbg(dev, "[bi=%d]\n", count+4); |
1251 | if (ei_status.dmaing) { | 1232 | if (ei_status.dmaing) { |
1252 | printk(KERN_NOTICE "%s: DMAing conflict in dma_block_input." | 1233 | netdev_notice(dev, "DMAing conflict in dma_block_input." |
1253 | "[DMAstat:%1x][irqlock:%1x]\n", | 1234 | "[DMAstat:%1x][irqlock:%1x]\n", |
1254 | dev->name, ei_status.dmaing, ei_status.irqlock); | 1235 | ei_status.dmaing, ei_status.irqlock); |
1255 | return; | 1236 | return; |
1256 | } | 1237 | } |
1257 | ei_status.dmaing |= 0x01; | 1238 | ei_status.dmaing |= 0x01; |
@@ -1281,9 +1262,9 @@ static void dma_block_input(struct net_device *dev, int count, | |||
1281 | break; | 1262 | break; |
1282 | } while (--tries > 0); | 1263 | } while (--tries > 0); |
1283 | if (tries <= 0) | 1264 | if (tries <= 0) |
1284 | printk(KERN_NOTICE "%s: RX transfer address mismatch," | 1265 | netdev_notice(dev, "RX transfer address mismatch," |
1285 | "%#4.4x (expected) vs. %#4.4x (actual).\n", | 1266 | "%#4.4x (expected) vs. %#4.4x (actual).\n", |
1286 | dev->name, ring_offset + xfer_count, addr); | 1267 | ring_offset + xfer_count, addr); |
1287 | } | 1268 | } |
1288 | #endif | 1269 | #endif |
1289 | outb_p(ENISR_RDC, nic_base + EN0_ISR); /* Ack intr. */ | 1270 | outb_p(ENISR_RDC, nic_base + EN0_ISR); /* Ack intr. */ |
@@ -1304,7 +1285,7 @@ static void dma_block_output(struct net_device *dev, int count, | |||
1304 | 1285 | ||
1305 | #ifdef PCMCIA_DEBUG | 1286 | #ifdef PCMCIA_DEBUG |
1306 | if (ei_debug > 4) | 1287 | if (ei_debug > 4) |
1307 | printk(KERN_DEBUG "%s: [bo=%d]\n", dev->name, count); | 1288 | netdev_dbg(dev, "[bo=%d]\n", count); |
1308 | #endif | 1289 | #endif |
1309 | 1290 | ||
1310 | /* Round the count up for word writes. Do we need to do this? | 1291 | /* Round the count up for word writes. Do we need to do this? |
@@ -1313,9 +1294,9 @@ static void dma_block_output(struct net_device *dev, int count, | |||
1313 | if (count & 0x01) | 1294 | if (count & 0x01) |
1314 | count++; | 1295 | count++; |
1315 | if (ei_status.dmaing) { | 1296 | if (ei_status.dmaing) { |
1316 | printk(KERN_NOTICE "%s: DMAing conflict in dma_block_output." | 1297 | netdev_notice(dev, "DMAing conflict in dma_block_output." |
1317 | "[DMAstat:%1x][irqlock:%1x]\n", | 1298 | "[DMAstat:%1x][irqlock:%1x]\n", |
1318 | dev->name, ei_status.dmaing, ei_status.irqlock); | 1299 | ei_status.dmaing, ei_status.irqlock); |
1319 | return; | 1300 | return; |
1320 | } | 1301 | } |
1321 | ei_status.dmaing |= 0x01; | 1302 | ei_status.dmaing |= 0x01; |
@@ -1352,9 +1333,9 @@ static void dma_block_output(struct net_device *dev, int count, | |||
1352 | break; | 1333 | break; |
1353 | } while (--tries > 0); | 1334 | } while (--tries > 0); |
1354 | if (tries <= 0) { | 1335 | if (tries <= 0) { |
1355 | printk(KERN_NOTICE "%s: Tx packet transfer address mismatch," | 1336 | netdev_notice(dev, "Tx packet transfer address mismatch," |
1356 | "%#4.4x (expected) vs. %#4.4x (actual).\n", | 1337 | "%#4.4x (expected) vs. %#4.4x (actual).\n", |
1357 | dev->name, (start_page << 8) + count, addr); | 1338 | (start_page << 8) + count, addr); |
1358 | if (retries++ == 0) | 1339 | if (retries++ == 0) |
1359 | goto retry; | 1340 | goto retry; |
1360 | } | 1341 | } |
@@ -1363,8 +1344,7 @@ static void dma_block_output(struct net_device *dev, int count, | |||
1363 | 1344 | ||
1364 | while ((inb_p(nic_base + EN0_ISR) & ENISR_RDC) == 0) | 1345 | while ((inb_p(nic_base + EN0_ISR) & ENISR_RDC) == 0) |
1365 | if (time_after(jiffies, dma_start + PCNET_RDC_TIMEOUT)) { | 1346 | if (time_after(jiffies, dma_start + PCNET_RDC_TIMEOUT)) { |
1366 | printk(KERN_NOTICE "%s: timeout waiting for Tx RDC.\n", | 1347 | netdev_notice(dev, "timeout waiting for Tx RDC.\n"); |
1367 | dev->name); | ||
1368 | pcnet_reset_8390(dev); | 1348 | pcnet_reset_8390(dev); |
1369 | NS8390_init(dev, 1); | 1349 | NS8390_init(dev, 1); |
1370 | break; | 1350 | break; |
@@ -1388,9 +1368,9 @@ static int setup_dma_config(struct pcmcia_device *link, int start_pg, | |||
1388 | ei_status.stop_page = stop_pg; | 1368 | ei_status.stop_page = stop_pg; |
1389 | 1369 | ||
1390 | /* set up block i/o functions */ | 1370 | /* set up block i/o functions */ |
1391 | ei_status.get_8390_hdr = &dma_get_8390_hdr; | 1371 | ei_status.get_8390_hdr = dma_get_8390_hdr; |
1392 | ei_status.block_input = &dma_block_input; | 1372 | ei_status.block_input = dma_block_input; |
1393 | ei_status.block_output = &dma_block_output; | 1373 | ei_status.block_output = dma_block_output; |
1394 | 1374 | ||
1395 | return 0; | 1375 | return 0; |
1396 | } | 1376 | } |
@@ -1536,9 +1516,9 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg, | |||
1536 | ei_status.stop_page = start_pg + ((req.Size - offset) >> 8); | 1516 | ei_status.stop_page = start_pg + ((req.Size - offset) >> 8); |
1537 | 1517 | ||
1538 | /* set up block i/o functions */ | 1518 | /* set up block i/o functions */ |
1539 | ei_status.get_8390_hdr = &shmem_get_8390_hdr; | 1519 | ei_status.get_8390_hdr = shmem_get_8390_hdr; |
1540 | ei_status.block_input = &shmem_block_input; | 1520 | ei_status.block_input = shmem_block_input; |
1541 | ei_status.block_output = &shmem_block_output; | 1521 | ei_status.block_output = shmem_block_output; |
1542 | 1522 | ||
1543 | info->flags |= USE_SHMEM; | 1523 | info->flags |= USE_SHMEM; |
1544 | return 0; | 1524 | return 0; |