aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/pcnet_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/pcmcia/pcnet_cs.c')
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c257
1 files changed, 85 insertions, 172 deletions
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index f9b509a6b09a..b4fd7c3ed077 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,14 +37,12 @@
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>
42#include <linux/mii.h> 43#include <linux/mii.h>
43#include "../8390.h" 44#include "../8390.h"
44 45
45#include <pcmcia/cs.h>
46#include <pcmcia/cistpl.h> 46#include <pcmcia/cistpl.h>
47#include <pcmcia/ciscode.h> 47#include <pcmcia/ciscode.h>
48#include <pcmcia/ds.h> 48#include <pcmcia/ds.h>
@@ -100,7 +100,6 @@ static void pcnet_release(struct pcmcia_device *link);
100static int pcnet_open(struct net_device *dev); 100static int pcnet_open(struct net_device *dev);
101static int pcnet_close(struct net_device *dev); 101static int pcnet_close(struct net_device *dev);
102static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 102static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
103static const struct ethtool_ops netdev_ethtool_ops;
104static irqreturn_t ei_irq_wrapper(int irq, void *dev_id); 103static irqreturn_t ei_irq_wrapper(int irq, void *dev_id);
105static void ei_watchdog(u_long arg); 104static void ei_watchdog(u_long arg);
106static void pcnet_reset_8390(struct net_device *dev); 105static void pcnet_reset_8390(struct net_device *dev);
@@ -238,14 +237,6 @@ static const struct net_device_ops pcnet_netdev_ops = {
238#endif 237#endif
239}; 238};
240 239
241/*======================================================================
242
243 pcnet_attach() creates an "instance" of the driver, allocating
244 local data structures for one device. The device is registered
245 with Card Services.
246
247======================================================================*/
248
249static int pcnet_probe(struct pcmcia_device *link) 240static int pcnet_probe(struct pcmcia_device *link)
250{ 241{
251 pcnet_dev_t *info; 242 pcnet_dev_t *info;
@@ -260,23 +251,13 @@ static int pcnet_probe(struct pcmcia_device *link)
260 info->p_dev = link; 251 info->p_dev = link;
261 link->priv = dev; 252 link->priv = dev;
262 253
263 link->conf.Attributes = CONF_ENABLE_IRQ; 254 link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
264 link->conf.IntType = INT_MEMORY_AND_IO;
265 255
266 dev->netdev_ops = &pcnet_netdev_ops; 256 dev->netdev_ops = &pcnet_netdev_ops;
267 257
268 return pcnet_config(link); 258 return pcnet_config(link);
269} /* pcnet_attach */ 259} /* pcnet_attach */
270 260
271/*======================================================================
272
273 This deletes a driver "instance". The device is de-registered
274 with Card Services. If it has been released, all local data
275 structures are freed. Otherwise, the structures will be freed
276 when the device is released.
277
278======================================================================*/
279
280static void pcnet_detach(struct pcmcia_device *link) 261static void pcnet_detach(struct pcmcia_device *link)
281{ 262{
282 struct net_device *dev = link->priv; 263 struct net_device *dev = link->priv;
@@ -300,22 +281,22 @@ static void pcnet_detach(struct pcmcia_device *link)
300static hw_info_t *get_hwinfo(struct pcmcia_device *link) 281static hw_info_t *get_hwinfo(struct pcmcia_device *link)
301{ 282{
302 struct net_device *dev = link->priv; 283 struct net_device *dev = link->priv;
303 win_req_t req;
304 u_char __iomem *base, *virt; 284 u_char __iomem *base, *virt;
305 int i, j; 285 int i, j;
306 286
307 /* Allocate a small memory window */ 287 /* Allocate a small memory window */
308 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 288 link->resource[2]->flags |= WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE;
309 req.Base = 0; req.Size = 0; 289 link->resource[2]->start = 0; link->resource[2]->end = 0;
310 req.AccessSpeed = 0; 290 i = pcmcia_request_window(link, link->resource[2], 0);
311 i = pcmcia_request_window(link, &req, &link->win);
312 if (i != 0) 291 if (i != 0)
313 return NULL; 292 return NULL;
314 293
315 virt = ioremap(req.Base, req.Size); 294 virt = ioremap(link->resource[2]->start,
295 resource_size(link->resource[2]));
316 for (i = 0; i < NR_INFO; i++) { 296 for (i = 0; i < NR_INFO; i++) {
317 pcmcia_map_mem_page(link, link->win, hw_info[i].offset & ~(req.Size-1)); 297 pcmcia_map_mem_page(link, link->resource[2],
318 base = &virt[hw_info[i].offset & (req.Size-1)]; 298 hw_info[i].offset & ~(resource_size(link->resource[2])-1));
299 base = &virt[hw_info[i].offset & (resource_size(link->resource[2])-1)];
319 if ((readb(base+0) == hw_info[i].a0) && 300 if ((readb(base+0) == hw_info[i].a0) &&
320 (readb(base+2) == hw_info[i].a1) && 301 (readb(base+2) == hw_info[i].a1) &&
321 (readb(base+4) == hw_info[i].a2)) { 302 (readb(base+4) == hw_info[i].a2)) {
@@ -326,7 +307,7 @@ static hw_info_t *get_hwinfo(struct pcmcia_device *link)
326 } 307 }
327 308
328 iounmap(virt); 309 iounmap(virt);
329 j = pcmcia_release_window(link, link->win); 310 j = pcmcia_release_window(link, link->resource[2]);
330 return (i < NR_INFO) ? hw_info+i : NULL; 311 return (i < NR_INFO) ? hw_info+i : NULL;
331} /* get_hwinfo */ 312} /* get_hwinfo */
332 313
@@ -421,7 +402,7 @@ static hw_info_t *get_ax88190(struct pcmcia_device *link)
421 int i, j; 402 int i, j;
422 403
423 /* Not much of a test, but the alternatives are messy */ 404 /* Not much of a test, but the alternatives are messy */
424 if (link->conf.ConfigBase != 0x03c0) 405 if (link->config_base != 0x03c0)
425 return NULL; 406 return NULL;
426 407
427 outb_p(0x01, ioaddr + EN0_DCFG); /* Set word-wide access. */ 408 outb_p(0x01, ioaddr + EN0_DCFG); /* Set word-wide access. */
@@ -434,8 +415,6 @@ static hw_info_t *get_ax88190(struct pcmcia_device *link)
434 dev->dev_addr[i] = j & 0xff; 415 dev->dev_addr[i] = j & 0xff;
435 dev->dev_addr[i+1] = j >> 8; 416 dev->dev_addr[i+1] = j >> 8;
436 } 417 }
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; 418 return NULL;
440} 419}
441 420
@@ -463,14 +442,6 @@ static hw_info_t *get_hwired(struct pcmcia_device *link)
463 return &default_info; 442 return &default_info;
464} /* get_hwired */ 443} /* get_hwired */
465 444
466/*======================================================================
467
468 pcnet_config() is scheduled to run after a CARD_INSERTION event
469 is received, to configure the PCMCIA socket, and to make the
470 ethernet device available to the system.
471
472======================================================================*/
473
474static int try_io_port(struct pcmcia_device *link) 445static int try_io_port(struct pcmcia_device *link)
475{ 446{
476 int j, ret; 447 int j, ret;
@@ -502,43 +473,22 @@ static int try_io_port(struct pcmcia_device *link)
502 } 473 }
503} 474}
504 475
505static int pcnet_confcheck(struct pcmcia_device *p_dev, 476static int pcnet_confcheck(struct pcmcia_device *p_dev, void *priv_data)
506 cistpl_cftable_entry_t *cfg,
507 cistpl_cftable_entry_t *dflt,
508 unsigned int vcc,
509 void *priv_data)
510{ 477{
511 int *priv = priv_data; 478 int *priv = priv_data;
512 int try = (*priv & 0x1); 479 int try = (*priv & 0x1);
513 int i;
514 cistpl_io_t *io = &cfg->io;
515 480
516 if (cfg->index == 0 || cfg->io.nwin == 0) 481 *priv &= (p_dev->resource[2]->end >= 0x4000) ? 0x10 : ~0x10;
517 return -EINVAL;
518 482
519 /* For multifunction cards, by convention, we configure the 483 if (p_dev->config_index == 0)
520 network function with window 0, and serial with window 1 */ 484 return -EINVAL;
521 if (io->nwin > 1) {
522 i = (io->win[1].len > io->win[0].len);
523 p_dev->resource[1]->start = io->win[1-i].base;
524 p_dev->resource[1]->end = io->win[1-i].len;
525 } else {
526 i = p_dev->resource[1]->end = 0;
527 }
528 485
529 *priv &= ((cfg->mem.nwin == 1) && 486 if (p_dev->resource[0]->end + p_dev->resource[1]->end < 32)
530 (cfg->mem.win[0].len >= 0x4000)) ? 0x10 : ~0x10; 487 return -EINVAL;
531 488
532 p_dev->resource[0]->start = io->win[i].base; 489 if (try)
533 p_dev->resource[0]->end = io->win[i].len;
534 if (!try)
535 p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
536 else
537 p_dev->io_lines = 16; 490 p_dev->io_lines = 16;
538 if (p_dev->resource[0]->end + p_dev->resource[1]->end >= 32) 491 return try_io_port(p_dev);
539 return try_io_port(p_dev);
540
541 return -EINVAL;
542} 492}
543 493
544static hw_info_t *pcnet_try_config(struct pcmcia_device *link, 494static hw_info_t *pcnet_try_config(struct pcmcia_device *link,
@@ -560,15 +510,14 @@ static hw_info_t *pcnet_try_config(struct pcmcia_device *link,
560 if (!link->irq) 510 if (!link->irq)
561 return NULL; 511 return NULL;
562 512
563 if (resource_size(link->resource[1]) == 8) { 513 if (resource_size(link->resource[1]) == 8)
564 link->conf.Attributes |= CONF_ENABLE_SPKR; 514 link->config_flags |= CONF_ENABLE_SPKR;
565 link->conf.Status = CCSR_AUDIO_ENA; 515
566 }
567 if ((link->manf_id == MANFID_IBM) && 516 if ((link->manf_id == MANFID_IBM) &&
568 (link->card_id == PRODID_IBM_HOME_AND_AWAY)) 517 (link->card_id == PRODID_IBM_HOME_AND_AWAY))
569 link->conf.ConfigIndex |= 0x10; 518 link->config_index |= 0x10;
570 519
571 ret = pcmcia_request_configuration(link, &link->conf); 520 ret = pcmcia_enable_device(link);
572 if (ret) 521 if (ret)
573 return NULL; 522 return NULL;
574 523
@@ -583,7 +532,7 @@ static hw_info_t *pcnet_try_config(struct pcmcia_device *link,
583 } else 532 } else
584 dev->if_port = 0; 533 dev->if_port = 0;
585 534
586 if ((link->conf.ConfigBase == 0x03c0) && 535 if ((link->config_base == 0x03c0) &&
587 (link->manf_id == 0x149) && (link->card_id == 0xc1ab)) { 536 (link->manf_id == 0x149) && (link->card_id == 0xc1ab)) {
588 dev_info(&link->dev, 537 dev_info(&link->dev,
589 "this is an AX88190 card - use axnet_cs instead.\n"); 538 "this is an AX88190 card - use axnet_cs instead.\n");
@@ -653,9 +602,7 @@ static int pcnet_config(struct pcmcia_device *link)
653 602
654 ei_status.name = "NE2000"; 603 ei_status.name = "NE2000";
655 ei_status.word16 = 1; 604 ei_status.word16 = 1;
656 ei_status.reset_8390 = &pcnet_reset_8390; 605 ei_status.reset_8390 = pcnet_reset_8390;
657
658 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
659 606
660 if (info->flags & (IS_DL10019|IS_DL10022)) 607 if (info->flags & (IS_DL10019|IS_DL10022))
661 mii_phy_probe(dev); 608 mii_phy_probe(dev);
@@ -663,25 +610,25 @@ static int pcnet_config(struct pcmcia_device *link)
663 SET_NETDEV_DEV(dev, &link->dev); 610 SET_NETDEV_DEV(dev, &link->dev);
664 611
665 if (register_netdev(dev) != 0) { 612 if (register_netdev(dev) != 0) {
666 printk(KERN_NOTICE "pcnet_cs: register_netdev() failed\n"); 613 pr_notice("register_netdev() failed\n");
667 goto failed; 614 goto failed;
668 } 615 }
669 616
670 if (info->flags & (IS_DL10019|IS_DL10022)) { 617 if (info->flags & (IS_DL10019|IS_DL10022)) {
671 u_char id = inb(dev->base_addr + 0x1a); 618 u_char id = inb(dev->base_addr + 0x1a);
672 printk(KERN_INFO "%s: NE2000 (DL100%d rev %02x): ", 619 netdev_info(dev, "NE2000 (DL100%d rev %02x): ",
673 dev->name, ((info->flags & IS_DL10022) ? 22 : 19), id); 620 (info->flags & IS_DL10022) ? 22 : 19, id);
674 if (info->pna_phy) 621 if (info->pna_phy)
675 printk("PNA, "); 622 pr_cont("PNA, ");
676 } else { 623 } else {
677 printk(KERN_INFO "%s: NE2000 Compatible: ", dev->name); 624 netdev_info(dev, "NE2000 Compatible: ");
678 } 625 }
679 printk("io %#3lx, irq %d,", dev->base_addr, dev->irq); 626 pr_cont("io %#3lx, irq %d,", dev->base_addr, dev->irq);
680 if (info->flags & USE_SHMEM) 627 if (info->flags & USE_SHMEM)
681 printk (" mem %#5lx,", dev->mem_start); 628 pr_cont(" mem %#5lx,", dev->mem_start);
682 if (info->flags & HAS_MISC_REG) 629 if (info->flags & HAS_MISC_REG)
683 printk(" %s xcvr,", if_names[dev->if_port]); 630 pr_cont(" %s xcvr,", if_names[dev->if_port]);
684 printk(" hw_addr %pM\n", dev->dev_addr); 631 pr_cont(" hw_addr %pM\n", dev->dev_addr);
685 return 0; 632 return 0;
686 633
687failed: 634failed:
@@ -689,14 +636,6 @@ failed:
689 return -ENODEV; 636 return -ENODEV;
690} /* pcnet_config */ 637} /* pcnet_config */
691 638
692/*======================================================================
693
694 After a card is removed, pcnet_release() will unregister the net
695 device, and release the PCMCIA configuration. If the device is
696 still open, this will be postponed until it is closed.
697
698======================================================================*/
699
700static void pcnet_release(struct pcmcia_device *link) 639static void pcnet_release(struct pcmcia_device *link)
701{ 640{
702 pcnet_dev_t *info = PRIV(link->priv); 641 pcnet_dev_t *info = PRIV(link->priv);
@@ -709,15 +648,6 @@ static void pcnet_release(struct pcmcia_device *link)
709 pcmcia_disable_device(link); 648 pcmcia_disable_device(link);
710} 649}
711 650
712/*======================================================================
713
714 The card status event handler. Mostly, this schedules other
715 stuff to run after an event is received. A CARD_REMOVAL event
716 also sets some flags to discourage the net drivers from trying
717 to talk to the card any more.
718
719======================================================================*/
720
721static int pcnet_suspend(struct pcmcia_device *link) 651static int pcnet_suspend(struct pcmcia_device *link)
722{ 652{
723 struct net_device *dev = link->priv; 653 struct net_device *dev = link->priv;
@@ -955,7 +885,7 @@ static void mii_phy_probe(struct net_device *dev)
955 phyid = tmp << 16; 885 phyid = tmp << 16;
956 phyid |= mdio_read(mii_addr, i, MII_PHYID_REG2); 886 phyid |= mdio_read(mii_addr, i, MII_PHYID_REG2);
957 phyid &= MII_PHYID_REV_MASK; 887 phyid &= MII_PHYID_REV_MASK;
958 pr_debug("%s: MII at %d is 0x%08x\n", dev->name, i, phyid); 888 netdev_dbg(dev, "MII at %d is 0x%08x\n", i, phyid);
959 if (phyid == AM79C9XX_HOME_PHY) { 889 if (phyid == AM79C9XX_HOME_PHY) {
960 info->pna_phy = i; 890 info->pna_phy = i;
961 } else if (phyid != AM79C9XX_ETH_PHY) { 891 } else if (phyid != AM79C9XX_ETH_PHY) {
@@ -988,7 +918,7 @@ static int pcnet_open(struct net_device *dev)
988 info->phy_id = info->eth_phy; 918 info->phy_id = info->eth_phy;
989 info->link_status = 0x00; 919 info->link_status = 0x00;
990 init_timer(&info->watchdog); 920 init_timer(&info->watchdog);
991 info->watchdog.function = &ei_watchdog; 921 info->watchdog.function = ei_watchdog;
992 info->watchdog.data = (u_long)dev; 922 info->watchdog.data = (u_long)dev;
993 info->watchdog.expires = jiffies + HZ; 923 info->watchdog.expires = jiffies + HZ;
994 add_timer(&info->watchdog); 924 add_timer(&info->watchdog);
@@ -1041,8 +971,8 @@ static void pcnet_reset_8390(struct net_device *dev)
1041 outb_p(ENISR_RESET, nic_base + EN0_ISR); /* Ack intr. */ 971 outb_p(ENISR_RESET, nic_base + EN0_ISR); /* Ack intr. */
1042 972
1043 if (i == 100) 973 if (i == 100)
1044 printk(KERN_ERR "%s: pcnet_reset_8390() did not complete.\n", 974 netdev_err(dev, "pcnet_reset_8390() did not complete.\n");
1045 dev->name); 975
1046 set_misc_reg(dev); 976 set_misc_reg(dev);
1047 977
1048} /* pcnet_reset_8390 */ 978} /* pcnet_reset_8390 */
@@ -1058,8 +988,7 @@ static int set_config(struct net_device *dev, struct ifmap *map)
1058 else if ((map->port < 1) || (map->port > 2)) 988 else if ((map->port < 1) || (map->port > 2))
1059 return -EINVAL; 989 return -EINVAL;
1060 dev->if_port = map->port; 990 dev->if_port = map->port;
1061 printk(KERN_INFO "%s: switched to %s port\n", 991 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); 992 NS8390_init(dev, 1);
1064 } 993 }
1065 return 0; 994 return 0;
@@ -1094,7 +1023,7 @@ static void ei_watchdog(u_long arg)
1094 this, we can limp along even if the interrupt is blocked */ 1023 this, we can limp along even if the interrupt is blocked */
1095 if (info->stale++ && (inb_p(nic_base + EN0_ISR) & ENISR_ALL)) { 1024 if (info->stale++ && (inb_p(nic_base + EN0_ISR) & ENISR_ALL)) {
1096 if (!info->fast_poll) 1025 if (!info->fast_poll)
1097 printk(KERN_INFO "%s: interrupt(s) dropped!\n", dev->name); 1026 netdev_info(dev, "interrupt(s) dropped!\n");
1098 ei_irq_wrapper(dev->irq, dev); 1027 ei_irq_wrapper(dev->irq, dev);
1099 info->fast_poll = HZ; 1028 info->fast_poll = HZ;
1100 } 1029 }
@@ -1114,7 +1043,7 @@ static void ei_watchdog(u_long arg)
1114 if (info->eth_phy) { 1043 if (info->eth_phy) {
1115 info->phy_id = info->eth_phy = 0; 1044 info->phy_id = info->eth_phy = 0;
1116 } else { 1045 } else {
1117 printk(KERN_INFO "%s: MII is missing!\n", dev->name); 1046 netdev_info(dev, "MII is missing!\n");
1118 info->flags &= ~HAS_MII; 1047 info->flags &= ~HAS_MII;
1119 } 1048 }
1120 goto reschedule; 1049 goto reschedule;
@@ -1123,8 +1052,7 @@ static void ei_watchdog(u_long arg)
1123 link &= 0x0004; 1052 link &= 0x0004;
1124 if (link != info->link_status) { 1053 if (link != info->link_status) {
1125 u_short p = mdio_read(mii_addr, info->phy_id, 5); 1054 u_short p = mdio_read(mii_addr, info->phy_id, 5);
1126 printk(KERN_INFO "%s: %s link beat\n", dev->name, 1055 netdev_info(dev, "%s link beat\n", link ? "found" : "lost");
1127 (link) ? "found" : "lost");
1128 if (link && (info->flags & IS_DL10022)) { 1056 if (link && (info->flags & IS_DL10022)) {
1129 /* Disable collision detection on full duplex links */ 1057 /* Disable collision detection on full duplex links */
1130 outb((p & 0x0140) ? 4 : 0, nic_base + DLINK_DIAG); 1058 outb((p & 0x0140) ? 4 : 0, nic_base + DLINK_DIAG);
@@ -1135,13 +1063,12 @@ static void ei_watchdog(u_long arg)
1135 if (link) { 1063 if (link) {
1136 if (info->phy_id == info->eth_phy) { 1064 if (info->phy_id == info->eth_phy) {
1137 if (p) 1065 if (p)
1138 printk(KERN_INFO "%s: autonegotiation complete: " 1066 netdev_info(dev, "autonegotiation complete: "
1139 "%sbaseT-%cD selected\n", dev->name, 1067 "%sbaseT-%cD selected\n",
1140 ((p & 0x0180) ? "100" : "10"), 1068 ((p & 0x0180) ? "100" : "10"),
1141 ((p & 0x0140) ? 'F' : 'H')); 1069 ((p & 0x0140) ? 'F' : 'H'));
1142 else 1070 else
1143 printk(KERN_INFO "%s: link partner did not " 1071 netdev_info(dev, "link partner did not autonegotiate\n");
1144 "autonegotiate\n", dev->name);
1145 } 1072 }
1146 NS8390_init(dev, 1); 1073 NS8390_init(dev, 1);
1147 } 1074 }
@@ -1154,7 +1081,7 @@ static void ei_watchdog(u_long arg)
1154 /* isolate this MII and try flipping to the other one */ 1081 /* isolate this MII and try flipping to the other one */
1155 mdio_write(mii_addr, info->phy_id, 0, 0x0400); 1082 mdio_write(mii_addr, info->phy_id, 0, 0x0400);
1156 info->phy_id ^= info->pna_phy ^ info->eth_phy; 1083 info->phy_id ^= info->pna_phy ^ info->eth_phy;
1157 printk(KERN_INFO "%s: switched to %s transceiver\n", dev->name, 1084 netdev_info(dev, "switched to %s transceiver\n",
1158 (info->phy_id == info->eth_phy) ? "ethernet" : "PNA"); 1085 (info->phy_id == info->eth_phy) ? "ethernet" : "PNA");
1159 mdio_write(mii_addr, info->phy_id, 0, 1086 mdio_write(mii_addr, info->phy_id, 0,
1160 (info->phy_id == info->eth_phy) ? 0x1000 : 0); 1087 (info->phy_id == info->eth_phy) ? 0x1000 : 0);
@@ -1170,18 +1097,6 @@ reschedule:
1170 1097
1171/*====================================================================*/ 1098/*====================================================================*/
1172 1099
1173static void netdev_get_drvinfo(struct net_device *dev,
1174 struct ethtool_drvinfo *info)
1175{
1176 strcpy(info->driver, "pcnet_cs");
1177}
1178
1179static const struct ethtool_ops netdev_ethtool_ops = {
1180 .get_drvinfo = netdev_get_drvinfo,
1181};
1182
1183/*====================================================================*/
1184
1185 1100
1186static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) 1101static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1187{ 1102{
@@ -1214,9 +1129,9 @@ static void dma_get_8390_hdr(struct net_device *dev,
1214 unsigned int nic_base = dev->base_addr; 1129 unsigned int nic_base = dev->base_addr;
1215 1130
1216 if (ei_status.dmaing) { 1131 if (ei_status.dmaing) {
1217 printk(KERN_NOTICE "%s: DMAing conflict in dma_block_input." 1132 netdev_notice(dev, "DMAing conflict in dma_block_input."
1218 "[DMAstat:%1x][irqlock:%1x]\n", 1133 "[DMAstat:%1x][irqlock:%1x]\n",
1219 dev->name, ei_status.dmaing, ei_status.irqlock); 1134 ei_status.dmaing, ei_status.irqlock);
1220 return; 1135 return;
1221 } 1136 }
1222 1137
@@ -1247,11 +1162,11 @@ static void dma_block_input(struct net_device *dev, int count,
1247 char *buf = skb->data; 1162 char *buf = skb->data;
1248 1163
1249 if ((ei_debug > 4) && (count != 4)) 1164 if ((ei_debug > 4) && (count != 4))
1250 pr_debug("%s: [bi=%d]\n", dev->name, count+4); 1165 netdev_dbg(dev, "[bi=%d]\n", count+4);
1251 if (ei_status.dmaing) { 1166 if (ei_status.dmaing) {
1252 printk(KERN_NOTICE "%s: DMAing conflict in dma_block_input." 1167 netdev_notice(dev, "DMAing conflict in dma_block_input."
1253 "[DMAstat:%1x][irqlock:%1x]\n", 1168 "[DMAstat:%1x][irqlock:%1x]\n",
1254 dev->name, ei_status.dmaing, ei_status.irqlock); 1169 ei_status.dmaing, ei_status.irqlock);
1255 return; 1170 return;
1256 } 1171 }
1257 ei_status.dmaing |= 0x01; 1172 ei_status.dmaing |= 0x01;
@@ -1281,9 +1196,9 @@ static void dma_block_input(struct net_device *dev, int count,
1281 break; 1196 break;
1282 } while (--tries > 0); 1197 } while (--tries > 0);
1283 if (tries <= 0) 1198 if (tries <= 0)
1284 printk(KERN_NOTICE "%s: RX transfer address mismatch," 1199 netdev_notice(dev, "RX transfer address mismatch,"
1285 "%#4.4x (expected) vs. %#4.4x (actual).\n", 1200 "%#4.4x (expected) vs. %#4.4x (actual).\n",
1286 dev->name, ring_offset + xfer_count, addr); 1201 ring_offset + xfer_count, addr);
1287 } 1202 }
1288#endif 1203#endif
1289 outb_p(ENISR_RDC, nic_base + EN0_ISR); /* Ack intr. */ 1204 outb_p(ENISR_RDC, nic_base + EN0_ISR); /* Ack intr. */
@@ -1304,7 +1219,7 @@ static void dma_block_output(struct net_device *dev, int count,
1304 1219
1305#ifdef PCMCIA_DEBUG 1220#ifdef PCMCIA_DEBUG
1306 if (ei_debug > 4) 1221 if (ei_debug > 4)
1307 printk(KERN_DEBUG "%s: [bo=%d]\n", dev->name, count); 1222 netdev_dbg(dev, "[bo=%d]\n", count);
1308#endif 1223#endif
1309 1224
1310 /* Round the count up for word writes. Do we need to do this? 1225 /* Round the count up for word writes. Do we need to do this?
@@ -1313,9 +1228,9 @@ static void dma_block_output(struct net_device *dev, int count,
1313 if (count & 0x01) 1228 if (count & 0x01)
1314 count++; 1229 count++;
1315 if (ei_status.dmaing) { 1230 if (ei_status.dmaing) {
1316 printk(KERN_NOTICE "%s: DMAing conflict in dma_block_output." 1231 netdev_notice(dev, "DMAing conflict in dma_block_output."
1317 "[DMAstat:%1x][irqlock:%1x]\n", 1232 "[DMAstat:%1x][irqlock:%1x]\n",
1318 dev->name, ei_status.dmaing, ei_status.irqlock); 1233 ei_status.dmaing, ei_status.irqlock);
1319 return; 1234 return;
1320 } 1235 }
1321 ei_status.dmaing |= 0x01; 1236 ei_status.dmaing |= 0x01;
@@ -1352,9 +1267,9 @@ static void dma_block_output(struct net_device *dev, int count,
1352 break; 1267 break;
1353 } while (--tries > 0); 1268 } while (--tries > 0);
1354 if (tries <= 0) { 1269 if (tries <= 0) {
1355 printk(KERN_NOTICE "%s: Tx packet transfer address mismatch," 1270 netdev_notice(dev, "Tx packet transfer address mismatch,"
1356 "%#4.4x (expected) vs. %#4.4x (actual).\n", 1271 "%#4.4x (expected) vs. %#4.4x (actual).\n",
1357 dev->name, (start_page << 8) + count, addr); 1272 (start_page << 8) + count, addr);
1358 if (retries++ == 0) 1273 if (retries++ == 0)
1359 goto retry; 1274 goto retry;
1360 } 1275 }
@@ -1363,8 +1278,7 @@ static void dma_block_output(struct net_device *dev, int count,
1363 1278
1364 while ((inb_p(nic_base + EN0_ISR) & ENISR_RDC) == 0) 1279 while ((inb_p(nic_base + EN0_ISR) & ENISR_RDC) == 0)
1365 if (time_after(jiffies, dma_start + PCNET_RDC_TIMEOUT)) { 1280 if (time_after(jiffies, dma_start + PCNET_RDC_TIMEOUT)) {
1366 printk(KERN_NOTICE "%s: timeout waiting for Tx RDC.\n", 1281 netdev_notice(dev, "timeout waiting for Tx RDC.\n");
1367 dev->name);
1368 pcnet_reset_8390(dev); 1282 pcnet_reset_8390(dev);
1369 NS8390_init(dev, 1); 1283 NS8390_init(dev, 1);
1370 break; 1284 break;
@@ -1388,9 +1302,9 @@ static int setup_dma_config(struct pcmcia_device *link, int start_pg,
1388 ei_status.stop_page = stop_pg; 1302 ei_status.stop_page = stop_pg;
1389 1303
1390 /* set up block i/o functions */ 1304 /* set up block i/o functions */
1391 ei_status.get_8390_hdr = &dma_get_8390_hdr; 1305 ei_status.get_8390_hdr = dma_get_8390_hdr;
1392 ei_status.block_input = &dma_block_input; 1306 ei_status.block_input = dma_block_input;
1393 ei_status.block_output = &dma_block_output; 1307 ei_status.block_output = dma_block_output;
1394 1308
1395 return 0; 1309 return 0;
1396} 1310}
@@ -1486,7 +1400,6 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg,
1486{ 1400{
1487 struct net_device *dev = link->priv; 1401 struct net_device *dev = link->priv;
1488 pcnet_dev_t *info = PRIV(dev); 1402 pcnet_dev_t *info = PRIV(dev);
1489 win_req_t req;
1490 int i, window_size, offset, ret; 1403 int i, window_size, offset, ret;
1491 1404
1492 window_size = (stop_pg - start_pg) << 8; 1405 window_size = (stop_pg - start_pg) << 8;
@@ -1497,22 +1410,22 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg,
1497 window_size = roundup_pow_of_two(window_size); 1410 window_size = roundup_pow_of_two(window_size);
1498 1411
1499 /* Allocate a memory window */ 1412 /* Allocate a memory window */
1500 req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; 1413 link->resource[3]->flags |= WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE;
1501 req.Attributes |= WIN_USE_WAIT; 1414 link->resource[3]->flags |= WIN_USE_WAIT;
1502 req.Base = 0; req.Size = window_size; 1415 link->resource[3]->start = 0; link->resource[3]->end = window_size;
1503 req.AccessSpeed = mem_speed; 1416 ret = pcmcia_request_window(link, link->resource[3], mem_speed);
1504 ret = pcmcia_request_window(link, &req, &link->win);
1505 if (ret) 1417 if (ret)
1506 goto failed; 1418 goto failed;
1507 1419
1508 offset = (start_pg << 8) + cm_offset; 1420 offset = (start_pg << 8) + cm_offset;
1509 offset -= offset % window_size; 1421 offset -= offset % window_size;
1510 ret = pcmcia_map_mem_page(link, link->win, offset); 1422 ret = pcmcia_map_mem_page(link, link->resource[3], offset);
1511 if (ret) 1423 if (ret)
1512 goto failed; 1424 goto failed;
1513 1425
1514 /* Try scribbling on the buffer */ 1426 /* Try scribbling on the buffer */
1515 info->base = ioremap(req.Base, window_size); 1427 info->base = ioremap(link->resource[3]->start,
1428 resource_size(link->resource[3]));
1516 for (i = 0; i < (TX_PAGES<<8); i += 2) 1429 for (i = 0; i < (TX_PAGES<<8); i += 2)
1517 __raw_writew((i>>1), info->base+offset+i); 1430 __raw_writew((i>>1), info->base+offset+i);
1518 udelay(100); 1431 udelay(100);
@@ -1521,24 +1434,25 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg,
1521 pcnet_reset_8390(dev); 1434 pcnet_reset_8390(dev);
1522 if (i != (TX_PAGES<<8)) { 1435 if (i != (TX_PAGES<<8)) {
1523 iounmap(info->base); 1436 iounmap(info->base);
1524 pcmcia_release_window(link, link->win); 1437 pcmcia_release_window(link, link->resource[3]);
1525 info->base = NULL; link->win = 0; 1438 info->base = NULL;
1526 goto failed; 1439 goto failed;
1527 } 1440 }
1528 1441
1529 ei_status.mem = info->base + offset; 1442 ei_status.mem = info->base + offset;
1530 ei_status.priv = req.Size; 1443 ei_status.priv = resource_size(link->resource[3]);
1531 dev->mem_start = (u_long)ei_status.mem; 1444 dev->mem_start = (u_long)ei_status.mem;
1532 dev->mem_end = dev->mem_start + req.Size; 1445 dev->mem_end = dev->mem_start + resource_size(link->resource[3]);
1533 1446
1534 ei_status.tx_start_page = start_pg; 1447 ei_status.tx_start_page = start_pg;
1535 ei_status.rx_start_page = start_pg + TX_PAGES; 1448 ei_status.rx_start_page = start_pg + TX_PAGES;
1536 ei_status.stop_page = start_pg + ((req.Size - offset) >> 8); 1449 ei_status.stop_page = start_pg + (
1450 (resource_size(link->resource[3]) - offset) >> 8);
1537 1451
1538 /* set up block i/o functions */ 1452 /* set up block i/o functions */
1539 ei_status.get_8390_hdr = &shmem_get_8390_hdr; 1453 ei_status.get_8390_hdr = shmem_get_8390_hdr;
1540 ei_status.block_input = &shmem_block_input; 1454 ei_status.block_input = shmem_block_input;
1541 ei_status.block_output = &shmem_block_output; 1455 ei_status.block_output = shmem_block_output;
1542 1456
1543 info->flags |= USE_SHMEM; 1457 info->flags |= USE_SHMEM;
1544 return 0; 1458 return 0;
@@ -1549,7 +1463,7 @@ failed:
1549 1463
1550/*====================================================================*/ 1464/*====================================================================*/
1551 1465
1552static struct pcmcia_device_id pcnet_ids[] = { 1466static const struct pcmcia_device_id pcnet_ids[] = {
1553 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0057, 0x0021), 1467 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0057, 0x0021),
1554 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0104, 0x000a), 1468 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0104, 0x000a),
1555 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0105, 0xea15), 1469 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0105, 0xea15),
@@ -1579,7 +1493,6 @@ static struct pcmcia_device_id pcnet_ids[] = {
1579 PCMCIA_DEVICE_MANF_CARD(0x0149, 0x4530), 1493 PCMCIA_DEVICE_MANF_CARD(0x0149, 0x4530),
1580 PCMCIA_DEVICE_MANF_CARD(0x0149, 0xc1ab), 1494 PCMCIA_DEVICE_MANF_CARD(0x0149, 0xc1ab),
1581 PCMCIA_DEVICE_MANF_CARD(0x0186, 0x0110), 1495 PCMCIA_DEVICE_MANF_CARD(0x0186, 0x0110),
1582 PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x2328),
1583 PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x8041), 1496 PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x8041),
1584 PCMCIA_DEVICE_MANF_CARD(0x0213, 0x2452), 1497 PCMCIA_DEVICE_MANF_CARD(0x0213, 0x2452),
1585 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0300), 1498 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0300),
@@ -1622,6 +1535,8 @@ static struct pcmcia_device_id pcnet_ids[] = {
1622 PCMCIA_DEVICE_PROD_ID12("COMPU-SHACK", "FASTline PCMCIA 10/100 Fast-Ethernet", 0xfa2e424d, 0x3953d9b9), 1535 PCMCIA_DEVICE_PROD_ID12("COMPU-SHACK", "FASTline PCMCIA 10/100 Fast-Ethernet", 0xfa2e424d, 0x3953d9b9),
1623 PCMCIA_DEVICE_PROD_ID12("CONTEC", "C-NET(PC)C-10L", 0x21cab552, 0xf6f90722), 1536 PCMCIA_DEVICE_PROD_ID12("CONTEC", "C-NET(PC)C-10L", 0x21cab552, 0xf6f90722),
1624 PCMCIA_DEVICE_PROD_ID12("corega", "FEther PCC-TXF", 0x0a21501a, 0xa51564a2), 1537 PCMCIA_DEVICE_PROD_ID12("corega", "FEther PCC-TXF", 0x0a21501a, 0xa51564a2),
1538 PCMCIA_DEVICE_PROD_ID12("corega", "Ether CF-TD", 0x0a21501a, 0x6589340a),
1539 PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega Ether CF-TD LAN Card", 0x5261440f, 0x8797663b),
1625 PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega EtherII PCC-T", 0x5261440f, 0xfa9d85bd), 1540 PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega EtherII PCC-T", 0x5261440f, 0xfa9d85bd),
1626 PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega EtherII PCC-TD", 0x5261440f, 0xc49bd73d), 1541 PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega EtherII PCC-TD", 0x5261440f, 0xc49bd73d),
1627 PCMCIA_DEVICE_PROD_ID12("Corega K.K.", "corega EtherII PCC-TD", 0xd4fdcbd8, 0xc49bd73d), 1542 PCMCIA_DEVICE_PROD_ID12("Corega K.K.", "corega EtherII PCC-TD", 0xd4fdcbd8, 0xc49bd73d),
@@ -1772,9 +1687,7 @@ MODULE_FIRMWARE("cis/PE-200.cis");
1772MODULE_FIRMWARE("cis/tamarack.cis"); 1687MODULE_FIRMWARE("cis/tamarack.cis");
1773 1688
1774static struct pcmcia_driver pcnet_driver = { 1689static struct pcmcia_driver pcnet_driver = {
1775 .drv = { 1690 .name = "pcnet_cs",
1776 .name = "pcnet_cs",
1777 },
1778 .probe = pcnet_probe, 1691 .probe = pcnet_probe,
1779 .remove = pcnet_detach, 1692 .remove = pcnet_detach,
1780 .owner = THIS_MODULE, 1693 .owner = THIS_MODULE,